diff --git a/framework/Rid.php b/framework/Rid.php
index 569d1d4..eac8962 100644
--- a/framework/Rid.php
+++ b/framework/Rid.php
@@ -90,4 +90,13 @@ public static function createObject($config)
return new $class($config);
}
+ public static function setDefault(&$array, $defaults)
+ {
+ if (!is_array($array)) $array = [$array];
+ foreach ($defaults as $key => $default) {
+ if (!array_key_exists($key, $array)) {
+ $array[$key] = $default;
+ }
+ }
+ }
}
diff --git a/framework/View/Conversion.php b/framework/View/Conversion.php
index 8ead24d..5b0baa7 100644
--- a/framework/View/Conversion.php
+++ b/framework/View/Conversion.php
@@ -40,7 +40,7 @@ public static function setDefault(&$array, $defaults)
public function format_bytes($var)
{
- self::setDefault($var, ['precision' => 2, 'separator' => ' ']);
+ \Rid::setDefault($var, ['precision' => 2, 'separator' => ' ']);
$bytes = array_shift($var);
$units = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
@@ -56,19 +56,19 @@ public function format_bytes($var)
public function format_bytes_compact($var)
{
- self::setDefault($var, ['precision' => 2, 'separator' => '
']);
+ \Rid::setDefault($var, ['precision' => 2, 'separator' => '
']);
return $this->format_bytes($var);
}
public function format_bytes_loose($var)
{
- self::setDefault($var, ['precision' => 2, 'separator' => ' ']);
+ \Rid::setDefault($var, ['precision' => 2, 'separator' => ' ']);
return $this->format_bytes($var);
}
public function format_ubbcode($var)
{
- self::setDefault($var, ['escapeHtml' => true]);
+ \Rid::setDefault($var, ['escapeHtml' => true]);
$string = array_shift($var);
$code = new Decoda($string, $var,'Cache:post:' . md5($string));