diff --git a/common/framework/config.php b/common/framework/config.php index 659d85363..facacc24d 100644 --- a/common/framework/config.php +++ b/common/framework/config.php @@ -28,9 +28,9 @@ class Config */ public static function init() { - if (file_exists(RX_BASEDIR . self::$config_filename)) + if (file_exists(\RX_BASEDIR . self::$config_filename)) { - self::$_config = (include RX_BASEDIR . self::$config_filename); + self::$_config = (include \RX_BASEDIR . self::$config_filename); } else { @@ -59,7 +59,7 @@ class Config */ public static function getDefaults() { - return (include RX_BASEDIR . self::$default_config_filename); + return (include \RX_BASEDIR . self::$default_config_filename); } /** @@ -135,7 +135,7 @@ class Config // Save the main config file. $buff = 'ftp_info); $buff = ' DateTime::formatTimestamp('Y-m-d H:i:s', RX_TIME), + 'timestamp' => DateTime::formatTimestamp('Y-m-d H:i:s', \RX_TIME), 'url' => getCurrentPageUrl(), 'request' => (object)array( 'method' => $_SERVER['REQUEST_METHOD'] . ($_SERVER['REQUEST_METHOD'] !== \Context::getRequestMethod() ? (' (' . \Context::getRequestMethod() . ')') : ''), diff --git a/common/framework/filters/htmlfilter.php b/common/framework/filters/htmlfilter.php index 4009d940f..fc9010c10 100644 --- a/common/framework/filters/htmlfilter.php +++ b/common/framework/filters/htmlfilter.php @@ -3,6 +3,7 @@ namespace Rhymix\Framework\Filters; use Rhymix\Framework\Security; +use Rhymix\Framework\Storage; /** * The HTML filter class. @@ -126,8 +127,8 @@ class HTMLFilter $config->set('URI.SafeIframeRegexp', MediaFilter::getIframeWhitelistRegex()); // Set the serializer path. - $config->set('Cache.SerializerPath', RX_BASEDIR . 'files/cache/htmlpurifier'); - \FileHandler::makeDir(RX_BASEDIR . 'files/cache/htmlpurifier'); + $config->set('Cache.SerializerPath', \RX_BASEDIR . 'files/cache/htmlpurifier'); + Storage::createDirectory(\RX_BASEDIR . 'files/cache/htmlpurifier'); // Modify the HTML definition to support editor components and widgets. $def = $config->getHTMLDefinition(true); diff --git a/common/framework/filters/ipfilter.php b/common/framework/filters/ipfilter.php index 096ab4b2c..e62443d87 100644 --- a/common/framework/filters/ipfilter.php +++ b/common/framework/filters/ipfilter.php @@ -140,7 +140,7 @@ class IpFilter return false; } - $cloudflare_ranges = (include RX_BASEDIR . 'common/defaults/cloudflare.php'); + $cloudflare_ranges = (include \RX_BASEDIR . 'common/defaults/cloudflare.php'); foreach ($cloudflare_ranges as $cloudflare_range) { if (self::inRange($_SERVER['REMOTE_ADDR'], $cloudflare_range)) diff --git a/common/framework/filters/mediafilter.php b/common/framework/filters/mediafilter.php index 867030dda..11fe04f4e 100644 --- a/common/framework/filters/mediafilter.php +++ b/common/framework/filters/mediafilter.php @@ -198,7 +198,7 @@ class MediaFilter */ protected static function _loadWhitelists($custom_whitelist = array()) { - $default_whitelist = (include RX_BASEDIR . 'common/defaults/whitelist.php'); + $default_whitelist = (include \RX_BASEDIR . 'common/defaults/whitelist.php'); self::$_object_whitelist = array(); self::$_iframe_whitelist = array(); diff --git a/common/framework/formatter.php b/common/framework/formatter.php index 09d4a9b5b..da2e87b9b 100644 --- a/common/framework/formatter.php +++ b/common/framework/formatter.php @@ -199,7 +199,7 @@ class Formatter } // Save the result to the target file. - \FileHandler::writeFile($target_filename, $content); + Storage::write($target_filename, $content); return $result; } @@ -238,7 +238,7 @@ class Formatter } // Save the result to the target file. - \FileHandler::writeFile($target_filename, $content); + Storage::write($target_filename, $content); return $result; } @@ -253,7 +253,7 @@ class Formatter { $minifier = new \MatthiasMullie\Minify\CSS($source_filename); $content = $minifier->execute($target_filename); - \FileHandler::writeFile($target_filename, $content); + Storage::write($target_filename, $content); return strlen($content) ? true : false; } @@ -268,7 +268,7 @@ class Formatter { $minifier = new \MatthiasMullie\Minify\JS($source_filename); $content = $minifier->execute($target_filename); - \FileHandler::writeFile($target_filename, $content); + Storage::write($target_filename, $content); return strlen($content) ? true : false; } diff --git a/common/framework/lang.php b/common/framework/lang.php index e2cfb49be..65e2bb72b 100644 --- a/common/framework/lang.php +++ b/common/framework/lang.php @@ -75,19 +75,19 @@ class Lang if ($name === 'common') { - $this->loadDirectory(RX_BASEDIR . 'common/lang', 'common'); + $this->loadDirectory(\RX_BASEDIR . 'common/lang', 'common'); } - elseif (file_exists(RX_BASEDIR . "plugins/$name/lang")) + elseif (file_exists(\RX_BASEDIR . "plugins/$name/lang")) { - $this->loadDirectory(RX_BASEDIR . "plugins/$name/lang", $name); + $this->loadDirectory(\RX_BASEDIR . "plugins/$name/lang", $name); } - elseif (file_exists(RX_BASEDIR . "modules/$name/lang")) + elseif (file_exists(\RX_BASEDIR . "modules/$name/lang")) { - $this->loadDirectory(RX_BASEDIR . "modules/$name/lang", $name); + $this->loadDirectory(\RX_BASEDIR . "modules/$name/lang", $name); } - elseif (file_exists(RX_BASEDIR . "addons/$name/lang")) + elseif (file_exists(\RX_BASEDIR . "addons/$name/lang")) { - $this->loadDirectory(RX_BASEDIR . "addons/$name/lang", $name); + $this->loadDirectory(\RX_BASEDIR . "addons/$name/lang", $name); } } @@ -181,7 +181,7 @@ class Lang */ public static function getSupportedList() { - return (include RX_BASEDIR . 'common/defaults/lang.php'); + return (include \RX_BASEDIR . 'common/defaults/lang.php'); } /** diff --git a/common/framework/parsers/configparser.php b/common/framework/parsers/configparser.php index ff2ea2b06..51cf3a250 100644 --- a/common/framework/parsers/configparser.php +++ b/common/framework/parsers/configparser.php @@ -19,9 +19,9 @@ class ConfigParser public static function convert() { // Load DB info file. - if (file_exists(RX_BASEDIR . Config::$old_db_config_filename)) + if (file_exists(\RX_BASEDIR . Config::$old_db_config_filename)) { - include RX_BASEDIR . Config::$old_db_config_filename; + include \RX_BASEDIR . Config::$old_db_config_filename; } else { @@ -29,16 +29,16 @@ class ConfigParser } // Load FTP info file. - if (file_exists(RX_BASEDIR . Config::$old_ftp_config_filename)) + if (file_exists(\RX_BASEDIR . Config::$old_ftp_config_filename)) { - include RX_BASEDIR . Config::$old_ftp_config_filename; + include \RX_BASEDIR . Config::$old_ftp_config_filename; } // Load selected language file. - if (file_exists(RX_BASEDIR . Config::$old_lang_config_filename)) + if (file_exists(\RX_BASEDIR . Config::$old_lang_config_filename)) { $lang_selected = array(); - $lang_selected_raw = file_get_contents(RX_BASEDIR . Config::$old_lang_config_filename); + $lang_selected_raw = file_get_contents(\RX_BASEDIR . Config::$old_lang_config_filename); $lang_selected_raw = array_map('trim', explode("\n", $lang_selected_raw)); foreach ($lang_selected_raw as $lang_selected_item) { @@ -59,7 +59,7 @@ class ConfigParser } // Load defaults for the new configuration. - $config = (include RX_BASEDIR . Config::$default_config_filename); + $config = (include \RX_BASEDIR . Config::$default_config_filename); // Convert database configuration. if (!isset($db_info->master_db)) @@ -184,7 +184,7 @@ class ConfigParser { $default_url = \Context::decodeIdna($default_url); } - $config['url']['default'] = $default_url ?: (RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . \RX_BASEURL; + $config['url']['default'] = $default_url ?: (\RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . \RX_BASEURL; $config['url']['http_port'] = $db_info->http_port ?: null; $config['url']['https_port'] = $db_info->https_port ?: null; $config['url']['ssl'] = $db_info->use_ssl ?: 'none'; diff --git a/common/framework/parsers/langparser.php b/common/framework/parsers/langparser.php index 31523abe8..756201fdb 100644 --- a/common/framework/parsers/langparser.php +++ b/common/framework/parsers/langparser.php @@ -3,6 +3,7 @@ namespace Rhymix\Framework\Parsers; use Rhymix\Framework\Lang; +use Rhymix\Framework\Storage; /** * Lang parser class for XE compatibility. @@ -32,7 +33,7 @@ class LangParser foreach ($files as $filename) { $new_filename = preg_replace('/\.lang\.php$/', '.php', str_replace('jp.lang', 'ja.lang', $filename)); - \FileHandler::rename($filename, $new_filename); + Storage::move($filename, $new_filename); } } } @@ -49,7 +50,7 @@ class LangParser // Check if the cache file already exists. if ($output_filename === null) { - $output_filename = RX_BASEDIR . 'files/cache/lang/' . md5($filename) . '.' . $language . '.php'; + $output_filename = \RX_BASEDIR . 'files/cache/lang/' . md5($filename) . '.' . $language . '.php'; if (file_exists($output_filename) && filemtime($output_filename) > filemtime($filename)) { return $output_filename; @@ -60,7 +61,7 @@ class LangParser $xml = @simplexml_load_file($filename); if ($xml === false) { - \FileHandler::writeFile($output_filename, ''); + Storage::write($output_filename, ''); return false; } @@ -95,7 +96,7 @@ class LangParser $buff .= '$lang->' . $key . ' = ' . var_export($value, true) . ";\n"; } } - \FileHandler::writeFile($output_filename, $buff); + Storage::write($output_filename, $buff); return $output_filename; }