1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 14:16:46 +02:00

Code cleanup and refactoring #5

This commit is contained in:
Awilum
2018-03-15 01:41:08 +03:00
parent a1f4df62ab
commit 0e3ec5626a
4 changed files with 14 additions and 14 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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
{
/**

View File

@@ -22,7 +22,7 @@ class Shortcodes
*
* @var shortcode_tags
*/
protected $shortcode_tags = array();
protected $shortcode_tags = [];
/**
* Construct