mirror of
https://github.com/flextype/flextype.git
synced 2025-08-07 05:36:54 +02:00
Code cleanup and refactoring #5
This commit is contained in:
@@ -99,7 +99,7 @@ class Filters
|
||||
* @return boolean
|
||||
*/
|
||||
public static function addListener($filter_name, $function_to_add, $priority = 10, $accepted_args = 1)
|
||||
{
|
||||
{
|
||||
// Redefine arguments
|
||||
$filter_name = (string) $filter_name;
|
||||
$function_to_add = $function_to_add;
|
||||
|
@@ -33,7 +33,7 @@ class Markdown
|
||||
* @param string $content Content to parse
|
||||
* @return string Formatted content
|
||||
*/
|
||||
public static function parse($content)
|
||||
public static function parse(string $content) : string
|
||||
{
|
||||
!static::$markdown and static::$markdown = new ParsedownExtra();
|
||||
|
||||
|
@@ -26,6 +26,8 @@ class Pages
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Page
|
||||
*
|
||||
* @var Page
|
||||
*/
|
||||
public static $page;
|
||||
@@ -125,7 +127,7 @@ class Pages
|
||||
/**
|
||||
* Get page
|
||||
*/
|
||||
public static function getPage($url = '', $raw = false, $url_abs = false)
|
||||
public static function getPage(string $url = '', bool $raw = false, bool $url_abs = false)
|
||||
{
|
||||
$file = static::finder($url, $url_abs);
|
||||
|
||||
@@ -143,7 +145,7 @@ class Pages
|
||||
return static::$page;
|
||||
}
|
||||
|
||||
public static function parseContent($content)
|
||||
public static function parseContent(string $content) : string
|
||||
{
|
||||
$content = Shortcodes::parse($content);
|
||||
$content = Markdown::parse($content);
|
||||
|
@@ -56,7 +56,7 @@ class Plugins
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Rawilum I18n
|
||||
* Initialize Rawilum Plugins
|
||||
*
|
||||
* <code>
|
||||
* Plugins::init();
|
||||
|
@@ -18,16 +18,28 @@ use Session;
|
||||
class Rawilum
|
||||
{
|
||||
/**
|
||||
* An instance of the Fansoro class
|
||||
* An instance of the Rawilum class
|
||||
*
|
||||
* @var object
|
||||
* @access protected
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Filesystem
|
||||
*
|
||||
* @var object
|
||||
* @access public
|
||||
*/
|
||||
public static $filesystem = null;
|
||||
|
||||
/**
|
||||
* Finder
|
||||
*
|
||||
* @var object
|
||||
* @access public
|
||||
*/
|
||||
public static $finder = null;
|
||||
public static $parsedown = null;
|
||||
|
||||
/**
|
||||
* Protected clone method to enforce singleton behavior.
|
||||
@@ -46,89 +58,6 @@ class Rawilum
|
||||
*/
|
||||
const VERSION = '0.0.0';
|
||||
|
||||
/**
|
||||
* Init Rawilum Application
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
/*protected static function init()
|
||||
{
|
||||
// Create container
|
||||
$container = new static();
|
||||
|
||||
// Define markdown service
|
||||
$container['markdown'] = function ($c) {
|
||||
return new ParsedownExtra();
|
||||
};
|
||||
|
||||
// Define filesystem service
|
||||
$container['filesystem'] = function ($c) {
|
||||
return new Filesystem();
|
||||
};
|
||||
|
||||
// Define finder service
|
||||
$container['finder'] = function ($c) {
|
||||
return new Finder();
|
||||
};
|
||||
|
||||
// Define cache service
|
||||
$container['cache'] = function ($c) {
|
||||
return new Cache($c);
|
||||
};
|
||||
|
||||
// Define config service
|
||||
$container['config'] = function ($c) {
|
||||
return new Config($c);
|
||||
};
|
||||
|
||||
// Define shortcodes service
|
||||
$container['shortcodes'] = function ($c) {
|
||||
return new Shortcodes($c);
|
||||
};
|
||||
|
||||
// Define events service
|
||||
$container['events'] = function ($c) {
|
||||
return new Events($c);
|
||||
};
|
||||
|
||||
// Define filters service
|
||||
$container['filters'] = function ($c) {
|
||||
return new Filters($c);
|
||||
};
|
||||
|
||||
// Define i18n service
|
||||
$container['i18n'] = function ($c) {
|
||||
return new I18n($c);
|
||||
};
|
||||
|
||||
// Define plugins service
|
||||
$container['plugins'] = function ($c) {
|
||||
return new Plugins($c);
|
||||
};
|
||||
|
||||
// Define pages service
|
||||
$container['pages'] = function ($c) {
|
||||
return new Pages($c);
|
||||
};
|
||||
|
||||
// Define themes service
|
||||
$container['themes'] = function ($c) {
|
||||
return new Themes($c);
|
||||
};
|
||||
|
||||
// Init I18n
|
||||
$container['i18n']->init();
|
||||
|
||||
// Init Plugins
|
||||
$container['plugins']->init();
|
||||
|
||||
// Get current page
|
||||
$container['pages']->getPage(Url::getUriString());
|
||||
|
||||
// Return container
|
||||
return $container;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
Reference in New Issue
Block a user