本文整理汇总了PHP中rex_i18n::addDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_i18n::addDirectory方法的具体用法?PHP rex_i18n::addDirectory怎么用?PHP rex_i18n::addDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_i18n
的用法示例。
在下文中一共展示了rex_i18n::addDirectory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
private static function import($import_sql, $import_archiv = null)
{
$err_msg = '';
if (!is_dir(rex_path::addon('backup'))) {
$err_msg .= rex_i18n::msg('setup_510') . '<br />';
} else {
if (file_exists($import_sql) && ($import_archiv === null || $import_archiv !== null && file_exists($import_archiv))) {
rex_i18n::addDirectory(rex_path::addon('backup', 'lang/'));
// DB Import
$state_db = rex_backup::importDb($import_sql);
if ($state_db['state'] === false) {
$err_msg .= nl2br($state_db['message']) . '<br />';
}
// Archiv optional importieren
if ($state_db['state'] === true && $import_archiv !== null) {
$state_archiv = rex_backup::importFiles($import_archiv);
if ($state_archiv['state'] === false) {
$err_msg .= $state_archiv['message'] . '<br />';
}
}
} else {
$err_msg .= rex_i18n::msg('setup_509') . '<br />';
}
}
return $err_msg;
}
示例2: uninstall
/**
* Uninstalls a package.
*
* @param bool $installDump When TRUE, the sql dump will be importet
*
* @throws rex_functional_exception
*
* @return bool TRUE on success, FALSE on error
*/
public function uninstall($installDump = true)
{
$isActivated = $this->package->isAvailable();
if ($isActivated && !$this->deactivate()) {
return false;
}
try {
$this->package->setProperty('install', false);
// include uninstall.php
if (is_readable($this->package->getPath(rex_package::FILE_UNINSTALL))) {
if (!$isActivated) {
rex_i18n::addDirectory($this->package->getPath('lang'));
}
$this->package->includeFile(rex_package::FILE_UNINSTALL);
if (($instmsg = $this->package->getProperty('installmsg', '')) != '') {
throw new rex_functional_exception($instmsg);
}
if ($this->package->isInstalled()) {
throw new rex_functional_exception($this->i18n('no_reason'));
}
}
// import uninstall.sql
$uninstallSql = $this->package->getPath(rex_package::FILE_UNINSTALL_SQL);
if ($installDump === true && is_readable($uninstallSql)) {
rex_sql_util::importDump($uninstallSql);
}
// delete assets
$assets = $this->package->getAssetsPath();
if (is_dir($assets) && !rex_dir::delete($assets)) {
throw new rex_functional_exception($this->i18n('install_cant_delete_files'));
}
rex_config::removeNamespace($this->package->getPackageId());
$this->saveConfig();
$this->message = $this->i18n('uninstalled', $this->package->getName());
return true;
} catch (rex_functional_exception $e) {
$this->message = $e->getMessage();
} catch (rex_sql_exception $e) {
$this->message = 'SQL error: ' . $e->getMessage();
}
$this->package->setProperty('install', true);
if ($isActivated) {
$this->package->setProperty('status', true);
}
$this->saveConfig();
$this->message = $this->i18n('no_uninstall', $this->package->getName()) . '<br />' . $this->message;
return false;
}
示例3: ini_set
// set arg_separator to get valid html output if session.use_trans_sid is activated
ini_set('arg_separator.output', '&');
require_once __DIR__ . '/lib/util/path.php';
rex_path::init($REX['HTDOCS_PATH'], $REX['BACKEND_FOLDER']);
require_once rex_path::core('lib/autoload.php');
// register core-classes as php-handlers
rex_autoload::register();
// add core base-classpath to autoloader
rex_autoload::addDirectory(rex_path::core('lib'));
rex_url::init($REX['HTDOCS_PATH'], $REX['BACKEND_FOLDER']);
// start timer at the very beginning
rex::setProperty('timer', new rex_timer($_SERVER['REQUEST_TIME_FLOAT']));
// add backend flag to rex
rex::setProperty('redaxo', $REX['REDAXO']);
// add core lang directory to rex_i18n
rex_i18n::addDirectory(rex_path::core('lang'));
// add core base-fragmentpath to fragmentloader
rex_fragment::addDirectory(rex_path::core('fragments/'));
// ----------------- FUNCTIONS
require_once rex_path::core('functions/function_rex_globals.php');
require_once rex_path::core('functions/function_rex_other.php');
// ----------------- VERSION
rex::setProperty('version', '5.0.0-alpha7');
$cacheFile = rex_path::cache('config.yml.cache');
$configFile = rex_path::data('config.yml');
if (file_exists($cacheFile) && file_exists($configFile) && filemtime($cacheFile) >= filemtime($configFile)) {
$config = rex_file::getCache($cacheFile);
} else {
$config = array_merge(rex_file::getConfig(rex_path::core('default.config.yml')), rex_file::getConfig($configFile));
rex_file::putCache($cacheFile, $config);
}
示例4: array_keys
* @package redaxo5
*/
rex_addon::initialize(!rex::isSetup());
if (rex::isSetup() || rex::isSafeMode()) {
$packageOrder = array_keys(rex_package::getSetupPackages());
} else {
$packageOrder = rex::getConfig('package-order', []);
}
// in the first run, we register all folders for class- and fragment-loading,
// so it is transparent in which order the addons are included afterwards.
foreach ($packageOrder as $packageId) {
$package = rex_package::get($packageId);
$folder = $package->getPath();
// add addon path for i18n
if (is_readable($folder . 'lang')) {
rex_i18n::addDirectory($folder . 'lang');
}
// add package path for fragment loading
if (is_readable($folder . 'fragments')) {
rex_fragment::addDirectory($folder . 'fragments' . DIRECTORY_SEPARATOR);
}
// add addon path for class-loading
if (is_readable($folder . 'lib')) {
rex_autoload::addDirectory($folder . 'lib');
}
if (is_readable($folder . 'vendor')) {
rex_autoload::addDirectory($folder . 'vendor');
}
$autoload = $package->getProperty('autoload');
if (is_array($autoload) && isset($autoload['classes']) && is_array($autoload['classes'])) {
foreach ($autoload['classes'] as $dir) {
示例5: rex_request
* @package redaxo5
*/
echo rex_view::title(rex_i18n::msg('addons'), '');
$content = '';
// -------------- RequestVars
$subpage = rex_request('subpage', 'string');
// ----------------- HELPPAGE
if ($subpage == 'help') {
$package = rex_package::get(rex_request('package', 'string'));
$name = $package->getPackageId();
$version = $package->getVersion();
$author = $package->getAuthor();
$supportPage = $package->getSupportPage();
if (is_readable($package->getPath('help.php'))) {
if (!$package->isAvailable() && is_readable($package->getPath('lang'))) {
rex_i18n::addDirectory($package->getPath('lang'));
}
ob_start();
$package->includeFile('help.php');
$content .= ob_get_clean();
} elseif (is_readable($package->getPath('README.md'))) {
$fragment = new rex_fragment();
$fragment->setVar('content', rex_markdown::factory()->parse(rex_file::get($package->getPath('README.md'))), false);
$content .= $fragment->parse('core/page/docs.php');
} else {
$content .= rex_view::info(rex_i18n::msg('package_no_help_file'));
}
$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('package_help') . ' ' . $name, false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');