mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 15:22:15 +09:00
Replace FileHandler calls and other paths in Rhymix Framework
This commit is contained in:
parent
89bd526a13
commit
740de5caf3
9 changed files with 39 additions and 37 deletions
|
|
@ -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 = '<?php' . "\n" . '// Rhymix System Configuration' . "\n" . 'return ' . self::serialize(self::$_config) . ';' . "\n";
|
||||
$result = \FileHandler::writeFile(RX_BASEDIR . self::$config_filename, $buff) ? true : false;
|
||||
$result = Storage::write(\RX_BASEDIR . self::$config_filename, $buff) ? true : false;
|
||||
//if (!$result) return false;
|
||||
|
||||
// Save XE-compatible config files.
|
||||
|
|
@ -144,9 +144,9 @@ class Config
|
|||
$db_info_without_ftp = clone $db_info;
|
||||
unset($db_info_without_ftp->ftp_info);
|
||||
$buff = '<?php' . "\n" . '$db_info = ' . self::serialize($db_info_without_ftp) . ';' . "\n";
|
||||
\FileHandler::writeFile(RX_BASEDIR . self::$old_db_config_filename, $buff);
|
||||
Storage::write(\RX_BASEDIR . self::$old_db_config_filename, $buff);
|
||||
$buff = '<?php' . "\n" . '$ftp_info = ' . self::serialize($ftp_info) . ';' . "\n";
|
||||
\FileHandler::writeFile(RX_BASEDIR . self::$old_ftp_config_filename, $buff);
|
||||
Storage::write(\RX_BASEDIR . self::$old_ftp_config_filename, $buff);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@ class Debug
|
|||
|
||||
// Rewrite the error message with relative paths.
|
||||
$message = str_replace(array(
|
||||
' called in ' . RX_BASEDIR,
|
||||
' defined in ' . RX_BASEDIR,
|
||||
' called in ' . \RX_BASEDIR,
|
||||
' defined in ' . \RX_BASEDIR,
|
||||
), array(
|
||||
' called in ',
|
||||
' defined in ',
|
||||
|
|
@ -485,7 +485,7 @@ class Debug
|
|||
{
|
||||
// Collect debug information.
|
||||
$data = (object)array(
|
||||
'timestamp' => 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() . ')') : ''),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue