From 0e3ec5626a0251b0eb0a525105c17589a5ca044f Mon Sep 17 00:00:00 2001 From: Awilum Date: Thu, 15 Mar 2018 01:41:08 +0300 Subject: [PATCH] Code cleanup and refactoring #5 --- rawilum/Config.php | 10 +++++----- rawilum/Filters.php | 14 +++++++------- rawilum/Plugins.php | 2 +- rawilum/Shortcodes.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/rawilum/Config.php b/rawilum/Config.php index cb9b3fe9..247e674f 100755 --- a/rawilum/Config.php +++ b/rawilum/Config.php @@ -26,7 +26,7 @@ class Config * @var array * @access protected */ - protected static $config = []; + protected $config = []; /** * Constructor. @@ -38,7 +38,7 @@ class Config $this->rawilum = $c; if ($this->rawilum['filesystem']->exists($site_config = CONFIG_PATH . '/' . 'site.yml')) { - self::$config['site'] = Yaml::parse(file_get_contents($site_config)); + $this->config['site'] = Yaml::parse(file_get_contents($site_config)); } else { throw new RuntimeException("Rawilum site config file does not exist."); } @@ -53,7 +53,7 @@ class Config */ public function set($key, $value) { - Arr::set(self::$config, $key, $value); + Arr::set($this->config, $key, $value); } /** @@ -66,7 +66,7 @@ class Config */ public function get($key, $default = null) { - return Arr::get(self::$config, $key, $default); + return Arr::get($this->config, $key, $default); } /** @@ -77,6 +77,6 @@ class Config */ public function getConfig() { - return self::$config; + return $this->config; } } diff --git a/rawilum/Filters.php b/rawilum/Filters.php index df4e98b5..64907335 100755 --- a/rawilum/Filters.php +++ b/rawilum/Filters.php @@ -24,7 +24,7 @@ class Filters * @var array * @access protected */ - protected static $filters = []; + protected $filters = []; /** * Construct @@ -53,11 +53,11 @@ class Filters $args = array_slice(func_get_args(), 2); - if (! isset(static::$filters[$filter_name])) { + if (! isset($this->filters[$filter_name])) { return $value; } - foreach (static::$filters[$filter_name] as $priority => $functions) { + foreach ($this->filters[$filter_name] as $priority => $functions) { if (! is_null($functions)) { foreach ($functions as $function) { $all_args = array_merge(array($value), $args); @@ -107,18 +107,18 @@ class Filters $accepted_args = (int) $accepted_args; // Check that we don't already have the same filter at the same priority. Thanks to WP :) - if (isset(static::$filters[$filter_name]["$priority"])) { - foreach (static::$filters[$filter_name]["$priority"] as $filter) { + if (isset($this->filters[$filter_name]["$priority"])) { + foreach ($this->filters[$filter_name]["$priority"] as $filter) { if ($filter['function'] == $function_to_add) { return true; } } } - static::$filters[$filter_name]["$priority"][] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); + $this->filters[$filter_name]["$priority"][] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); // Sort - ksort(static::$filters[$filter_name]["$priority"]); + ksort($this->filters[$filter_name]["$priority"]); return true; } diff --git a/rawilum/Plugins.php b/rawilum/Plugins.php index ccca2737..9d7013ec 100755 --- a/rawilum/Plugins.php +++ b/rawilum/Plugins.php @@ -11,7 +11,7 @@ use Symfony\Component\Yaml\Yaml; * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - + class Plugins { /** diff --git a/rawilum/Shortcodes.php b/rawilum/Shortcodes.php index 12c454bf..de38320d 100644 --- a/rawilum/Shortcodes.php +++ b/rawilum/Shortcodes.php @@ -22,7 +22,7 @@ class Shortcodes * * @var shortcode_tags */ - protected $shortcode_tags = array(); + protected $shortcode_tags = []; /** * Construct