本文整理汇总了PHP中rex::isSafeMode方法的典型用法代码示例。如果您正苦于以下问题:PHP rex::isSafeMode方法的具体用法?PHP rex::isSafeMode怎么用?PHP rex::isSafeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex
的用法示例。
在下文中一共展示了rex::isSafeMode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleException
/**
* Handles the given Exception.
*
* @param Throwable|Exception $exception The Exception to handle
* @param bool $showTrace
*/
public static function handleException($exception, $showTrace = true)
{
rex_logger::logException($exception);
while (ob_get_level()) {
ob_end_clean();
}
$status = rex_response::HTTP_INTERNAL_ERROR;
if ($exception instanceof rex_http_exception && $exception->getHttpCode()) {
$status = $exception->getHttpCode();
}
rex_response::setStatus($status);
if (rex::isSetup() || rex::isDebugMode() || ($user = rex_backend_login::createUser()) && $user->isAdmin()) {
// TODO add a beautiful error page with usefull debugging info
$buf = '';
$buf .= '<pre>';
$buf .= '"' . get_class($exception) . '" thrown in ' . $exception->getFile() . ' on line ' . $exception->getLine() . "\n";
if ($exception->getMessage()) {
$buf .= '<b>' . ($exception instanceof ErrorException ? self::getErrorType($exception->getSeverity()) . ': ' : '') . $exception->getMessage() . "</b>\n";
}
$cause = $exception->getPrevious();
while ($cause) {
$buf .= "\n";
$buf .= 'caused by ' . get_class($cause) . ' in ' . $cause->getFile() . ' on line ' . $cause->getLine() . "\n";
if ($cause->getMessage()) {
$buf .= '<b>' . ($cause instanceof ErrorException ? self::getErrorType($cause->getSeverity()) . ': ' : '') . $cause->getMessage() . "</b>\n";
}
$cause = $cause->getPrevious();
}
if ($showTrace) {
$buf .= "\n";
$buf .= $exception->getTraceAsString();
}
if (!rex::isSetup() && rex::isBackend() && !rex::isSafeMode()) {
$buf .= "\n\n";
$buf .= '<a href="' . rex_url::backendPage('packages', ['safemode' => 1]) . '">activate safe mode</a>';
}
$buf .= '</pre>';
} else {
// TODO small error page, without debug infos
$buf = 'Oooops, an internal error occured!';
}
rex_response::sendContent($buf);
exit;
}
示例2: getSystemPlugins
/**
* {@inheritdoc}
*/
public function getSystemPlugins()
{
if (rex::isSetup() || rex::isSafeMode()) {
// in setup and safemode this method is called before the package .lang files are added to rex_i18n
// so don't use getProperty(), to avoid loading all properties without translations
$properties = rex_file::getConfig($this->getPath(parent::FILE_PACKAGE));
$systemPlugins = isset($properties['system_plugins']) ? (array) $properties['system_plugins'] : [];
} else {
$systemPlugins = (array) $this->getProperty('system_plugins', []);
}
$plugins = [];
foreach ($systemPlugins as $plugin) {
if ($this->pluginExists($plugin)) {
$plugins[$plugin] = $this->getPlugin($plugin);
}
}
return $plugins;
}
示例3:
<?php
/**
* Packages loading.
*
* @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')) {
示例4: appendPackagePages
public static function appendPackagePages()
{
$insertPages = [];
$addons = rex::isSafeMode() ? rex_addon::getSetupAddons() : rex_addon::getAvailableAddons();
foreach ($addons as $addon) {
$mainPage = self::pageCreate($addon->getProperty('page'), $addon, true);
if (is_array($pages = $addon->getProperty('pages'))) {
foreach ($pages as $key => $page) {
if (strpos($key, '/') !== false) {
$insertPages[$key] = [$addon, $page];
} else {
self::pageCreate($page, $addon, false, $mainPage, $key, true);
}
}
}
// handle plugins
$plugins = rex::isSafeMode() ? $addon->getSystemPlugins() : $addon->getAvailablePlugins();
foreach ($plugins as $plugin) {
self::pageCreate($plugin->getProperty('page'), $plugin, false, $mainPage);
if (is_array($pages = $plugin->getProperty('pages'))) {
foreach ($pages as $key => $page) {
if (strpos($key, '/') !== false) {
$insertPages[$key] = [$plugin, $page];
} else {
self::pageCreate($page, $plugin, false, $mainPage, $key, true);
}
}
}
}
}
foreach ($insertPages as $key => $packagePage) {
list($package, $page) = $packagePage;
$key = explode('/', $key);
if (!isset(self::$pages[$key[0]])) {
continue;
}
$parentPage = self::$pages[$key[0]];
for ($i = 1, $count = count($key) - 1; $i < $count && $parentPage; ++$i) {
$parentPage = $parentPage->getSubpage($key[$i]);
}
if ($parentPage) {
self::pageCreate($page, $package, false, $parentPage, $key[$i], strtr($parentPage->getFullKey(), '/', '.') . '.' . $key[$i] . '.');
}
}
}
示例5: rex_extension_point
$body_attr['class'][] = 'rex-is-popup';
}
// ----- EXTENSION POINT
$body_attr = rex_extension::registerPoint(new rex_extension_point('PAGE_BODY_ATTR', $body_attr));
$body = '';
foreach ($body_attr as $k => $v) {
$body .= ' ' . $k . '="';
if (is_array($v)) {
$body .= rex_string::normalize(implode(' ', $v), '-', ' ');
}
$body .= '"';
}
$hasNavigation = $curPage->hasNavigation();
$meta_items = [];
if (rex::getUser() && $hasNavigation) {
if (rex::isSafeMode()) {
$item = [];
$item['title'] = rex_i18n::msg('safemode_deactivate');
$item['href'] = rex_url::backendController(['safemode' => 0]);
$meta_items[] = $item;
unset($item);
}
$user_name = rex::getUser()->getValue('name') != '' ? rex::getUser()->getValue('name') : rex::getUser()->getValue('login');
$item = [];
$item['title'] = '<span class="text-muted">' . rex_i18n::msg('logged_in_as') . '</span> <a class="rex-username" href="' . rex_url::backendPage('profile') . '" title="' . rex_i18n::msg('profile_title') . '"><i class="rex-icon rex-icon-user"></i> ' . htmlspecialchars($user_name) . '</a>';
$meta_items[] = $item;
unset($item);
$item = [];
$item['title'] = '<i class="rex-icon rex-icon-sign-out"></i> ' . rex_i18n::msg('logout');
$item['href'] = rex_url::backendController(['rex_logout' => 1]);
$item['attributes'] = 'class="rex-logout"' . rex::getAccesskey(rex_i18n::msg('logout'), 'logout');
示例6:
<?php
if (rex_addon::get('cronjob')->isAvailable() && !rex::isSafeMode()) {
rex_cronjob_manager::registerType('rex_cronjob_export');
}