0) { $id = $matches[0]; } } else { preg_match("/(?<=channel\=)\d$/", $config['tabbar']['list'][$index]['path'], $matches); if (count($matches) > 0) { $id = $matches[0]; } } } return $id; } public static function render($config) { if (isset($config['tabbar']['list']) && is_array($config['tabbar']['list'])) { $url = url('/', '', false, true); $url = preg_replace("/\/([\w]+)\.php\//i", "/", $url); $url = rtrim($url, "/"); foreach ($config['tabbar']['list'] as $index => &$item) { $item['image'] = preg_match("/^\/assets\/addons/", $item['image']) ? $url . $item['image'] : cdnurl($item['image'], true); $item['selectedImage'] = preg_match("/^\/assets\/addons/", $item['selectedImage']) ? $url . $item['selectedImage'] : cdnurl($item['selectedImage'], true); } } return $config; } public static function set($config, $overwrite = false) { self::$config = $overwrite ? $config : array_merge(self::$config, $config); file_put_contents(self::getConfigFile(), json_encode(self::$config, JSON_UNESCAPED_UNICODE)); return self::$config; } public static function getConfigFile() { return ADDON_PATH . 'cms' . DS . 'data' . DS . 'theme.json'; } }