本文整理汇总了PHP中rex_path::src方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_path::src方法的具体用法?PHP rex_path::src怎么用?PHP rex_path::src使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_path
的用法示例。
在下文中一共展示了rex_path::src方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkFilesystem
/**
* checks permissions of all required filesystem resources.
*
* @return array An array of error messages
*/
public static function checkFilesystem()
{
// -------------------------- SCHREIBRECHTE
$writables = [rex_path::media(), rex_path::assets(), rex_path::cache(), rex_path::data(), rex_path::src()];
$func = function ($dir) use(&$func) {
if (!rex_dir::isWritable($dir)) {
return ['setup_304' => [$dir]];
}
$res = [];
foreach (rex_finder::factory($dir) as $path => $file) {
if ($file->isDir()) {
$res = array_merge_recursive($res, $func($path));
} elseif (!$file->isWritable()) {
$res['setup_305'][] = $path;
}
}
return $res;
};
$res = [];
foreach ($writables as $dir) {
if (@is_dir($dir)) {
$res = array_merge_recursive($res, $func($dir));
} else {
$res['setup_306'][] = $dir;
}
}
return $res;
}
示例2: foreach
$sel_lang->setSize(1);
$sel_lang->setSelected(rex::getProperty('lang'));
foreach (rex_i18n::getLocales() as $l) {
$sel_lang->addOption($l, $l);
}
if (!empty($error)) {
echo rex_view::error(implode('<br />', $error));
}
if ($info != '') {
echo rex_view::info($info);
}
if ($success != '') {
echo rex_view::success($success);
}
$dbconfig = rex::getProperty('db');
$version = rex_path::src();
if (strlen($version) > 21) {
$version = substr($version, 0, 8) . '..' . substr($version, strlen($version) - 13);
}
$content = [];
$content[] = '
<h3>' . rex_i18n::msg('delete_cache') . '</h3>
<p>' . rex_i18n::msg('delete_cache_description') . '</p>
<p><a class="btn btn-delete" href="' . rex_url::currentBackendPage(['func' => 'generate']) . '">' . rex_i18n::msg('delete_cache') . '</a></p>
<h3>' . rex_i18n::msg('setup') . '</h3>
<p>' . rex_i18n::msg('setup_text') . '</p>
<p><a class="btn btn-setup" href="' . rex_url::currentBackendPage(['func' => 'setup']) . '" data-confirm="' . rex_i18n::msg('setup_restart') . '?" data-pjax="false">' . rex_i18n::msg('setup') . '</a></p>';
$content[] = '
<h3>' . rex_i18n::msg('version') . '</h3>
<dl class="dl-horizontal">
示例3: synchronizeWithFileSystem
/**
* Synchronizes the packages with the file system.
*/
public static function synchronizeWithFileSystem()
{
$config = rex::getConfig('package-config');
$addons = self::readPackageFolder(rex_path::src('addons'));
$registeredAddons = array_keys(rex_addon::getRegisteredAddons());
foreach (array_diff($registeredAddons, $addons) as $addonName) {
$manager = rex_addon_manager::factory(rex_addon::get($addonName));
$manager->_delete(true);
unset($config[$addonName]);
}
foreach ($addons as $addonName) {
if (!rex_addon::exists($addonName)) {
$config[$addonName]['install'] = false;
$config[$addonName]['status'] = false;
$registeredPlugins = [];
} else {
$addon = rex_addon::get($addonName);
$config[$addonName]['install'] = $addon->isInstalled();
$config[$addonName]['status'] = $addon->isAvailable();
$registeredPlugins = array_keys($addon->getRegisteredPlugins());
}
$plugins = self::readPackageFolder(rex_path::addon($addonName, 'plugins'));
foreach (array_diff($registeredPlugins, $plugins) as $pluginName) {
$manager = rex_plugin_manager::factory(rex_plugin::get($addonName, $pluginName));
$manager->_delete(true);
unset($config[$addonName]['plugins'][$pluginName]);
}
foreach ($plugins as $pluginName) {
$plugin = rex_plugin::get($addonName, $pluginName);
$config[$addonName]['plugins'][$pluginName]['install'] = $plugin->isInstalled();
$config[$addonName]['plugins'][$pluginName]['status'] = $plugin->getProperty('status');
}
if (isset($config[$addonName]['plugins']) && is_array($config[$addonName]['plugins'])) {
ksort($config[$addonName]['plugins']);
}
}
ksort($config);
rex::setConfig('package-config', $config);
rex_addon::initialize();
}
示例4: includeCurrentPage
/**
* Includes the current page. A page may be provided by the core, an addon or plugin.
*/
public static function includeCurrentPage()
{
$currentPage = self::getCurrentPageObject();
if (rex_request::isPJAXRequest() && !rex_request::isPJAXContainer('#rex-page')) {
// non-core pjax containers should not have a layout.
// they render their whole response on their own
$currentPage->setHasLayout(false);
}
require rex_path::core('layout/top.php');
$path = $currentPage->getPath();
$pattern = '@' . preg_quote(rex_path::src('addons/'), '@') . '([^/\\\\]+)(?:[/\\\\]plugins[/\\\\]([^/\\\\]+))?@';
if (preg_match($pattern, $path, $matches)) {
$package = rex_addon::get($matches[1]);
if (isset($matches[2])) {
$package = $package->getPlugin($matches[2]);
}
$package->includeFile(str_replace($package->getPath(), '', $path));
} else {
include $path;
}
require rex_path::core('layout/bottom.php');
}
示例5: rex_title
rex_title($I18N->msg('asd_news'), $REX['ADDON']['pages'][rex_asd_news_config::getName()]);
$page = rex_request('page', 'string');
$subpage = rex_request('subpage', 'string');
$func = rex_request('func', 'string');
if (!$subpage) {
$subpage = 'news';
}
$BaseDir = rex_asd_news_config::getBaseUrl();
$baseDirFunc = rex_asd_news_config::getBaseUrl($func);
if (!rex_asd_news_config::getConfig('article')) {
echo rex_warning($I18N->msg('asd_news_no_article_selected'));
}
switch ($subpage) {
case 'news':
case 'rubric':
case 'faq':
$path = rex_path::addon(rex_asd_news_config::getName(), 'pages' . DIRECTORY_SEPARATOR . $subpage . '.php');
break;
case 'settings':
case 'metainfo':
if ($REX['USER']->hasPerm(rex_asd_news_config::getName() . '[' . $subpage . ']') || $REX['USER']->isAdmin()) {
$path = rex_path::addon(rex_asd_news_config::getName(), 'pages' . DIRECTORY_SEPARATOR . $subpage . '.php');
}
break;
default:
$path = rex_path::plugin(rex_asd_news_config::getName(), $subpage, 'pages' . DIRECTORY_SEPARATOR . $subpage . '.php');
break;
}
require $path;
require rex_path::src('layout' . DIRECTORY_SEPARATOR . 'bottom.php');
示例6: includePath
/**
* Includes a path in correct package context.
*
* @param string $path
* @param array $context
*
* @return mixed
*/
private static function includePath($path, array $context = [])
{
$pattern = '@' . preg_quote(rex_path::src('addons/'), '@') . '([^/\\\\]+)(?:[/\\\\]plugins[/\\\\]([^/\\\\]+))?@';
if (!preg_match($pattern, $path, $matches)) {
$__context = $context;
$__path = $path;
unset($context, $path, $pattern, $matches);
extract($__context, EXTR_SKIP);
return include $__path;
}
$package = rex_addon::get($matches[1]);
if (isset($matches[2])) {
$package = $package->getPlugin($matches[2]);
}
return $package->includeFile(str_replace($package->getPath(), '', $path), $context);
}