本文整理汇总了PHP中Manager::getCurrentManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::getCurrentManager方法的具体用法?PHP Manager::getCurrentManager怎么用?PHP Manager::getCurrentManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager::getCurrentManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onRichtextWriteTagForIdentifier
public function onRichtextWriteTagForIdentifier($sTagName, $aParameters, $oIdentifier, $sTagContent, $oLink)
{
if (Manager::getCurrentManager() instanceof BackendManager || $oIdentifier->getName() !== 'external_link' || !StringUtil::startsWith($aParameters[0]['href'], 'subs://') || !$oLink instanceof Link) {
return;
}
$aParameters[0]['href'] = EXT_WEB_DIR_FE . '/' . substr($aParameters[0]['href'], strlen('subs://'));
$aParameters[0]['class'] = 'internal_link subsite';
$aParameters[0]['rel'] = 'internal';
}
示例2: getLanguageChooser
/**
* @param main template
* description:
* - @see config.yml section language_chooser
* - use parameter replaced in method
* @return Template The rendered language chooser
*/
public static function getLanguageChooser($oMainTemplate)
{
$oTemplate = new Template(TemplateIdentifier::constructIdentifier('languages'), null, true);
$oLanguageTemplate = new Template(Settings::getSetting("language_chooser", 'template', 'language'), array(DIRNAME_TEMPLATES, DIRNAME_NAVIGATION));
$sLinkSeparator = Settings::getSetting("language_chooser", 'link_separator', ' | ');
$oLanguageActiveTemplate = null;
$bShowActiveLanguage = Settings::getSetting("language_chooser", 'show_active_language', false);
$bIsPreview = Manager::getCurrentManager() instanceof PreviewManager;
if ($bShowActiveLanguage) {
if (Settings::getSetting("language_chooser", 'template_active', false) !== false) {
$oLanguageActiveTemplate = new Template(Settings::getSetting("language_chooser", 'template_active', 'language_active'), array(DIRNAME_TEMPLATES, DIRNAME_NAVIGATION));
} else {
$oLanguageActiveTemplate = clone $oLanguageTemplate;
}
}
// Find request variables
$aParameters = array_diff_assoc($_REQUEST, $_COOKIE);
unset($aParameters['path']);
unset($aParameters['content_language']);
// Check whether manager needs language to be included
$bCurrentPathIncludesLanguage = call_user_func(array(Manager::getManagerClassNormalized(null), 'shouldIncludeLanguageInLink'));
$aRequestPath = explode("/", Manager::getRequestedPath());
$aLanguages = LanguageQuery::create()->filterByIsActive(true)->exclude($bShowActiveLanguage ? false : ($bIsPreview ? 'edit' : 'current'))->orderBySort()->find();
foreach ($aLanguages as $i => $oLanguage) {
$oLangTemplate = null;
$oPageString = null;
if ($oLanguage->getId() === Session::language()) {
$oLangTemplate = $oLanguageActiveTemplate;
$oLangTemplate->replaceIdentifier('class', 'active');
} else {
$oPageString = PageStringQuery::create()->filterByPage(FrontendManager::$CURRENT_PAGE)->filterByLanguageId($oLanguage->getId())->filterByIsInactive(false)->findOne();
if ($oPageString === null) {
continue;
}
$oLangTemplate = clone $oLanguageTemplate;
}
// If language is included, replace it by language id and set include_language param to false
if ($bCurrentPathIncludesLanguage) {
$aRequestPath[0] = $oLanguage->getPathPrefix();
$sLink = LinkUtil::link($aRequestPath, null, $aParameters, false);
} else {
$sLink = LinkUtil::link($aRequestPath, null, array_merge($aParameters, array('content_language' => $oLanguage->getId())));
}
$oLangTemplate->replaceIdentifier('link', $sLink);
// Add alternate language links
if ($oPageString) {
ResourceIncluder::metaIncluder()->addCustomResource(array('template' => 'link', 'rel' => 'alternate', 'lang' => $oLanguage->getId(), 'location' => $sLink, 'title' => $oPageString->getPageTitle()));
}
$oLangTemplate->replaceIdentifier('id', $oLanguage->getId());
$oLangTemplate->replaceIdentifier('name', $oLanguage->getLanguageName($oLanguage->getId()));
$oLangTemplate->replaceIdentifier('name_in_current_lang', $oLanguage->getLanguageName());
$oTemplate->replaceIdentifierMultiple('languages', $oLangTemplate, null, Template::NO_NEWLINE);
if ($i + 1 < count($aLanguages)) {
$oTemplate->replaceIdentifierMultiple('languages', $sLinkSeparator, null, Template::NO_HTML_ESCAPE | Template::NO_NEWLINE);
}
}
return $oTemplate;
}
示例3: setTemporaryManager
public static function setTemporaryManager($sManager = null)
{
if ($sManager === null) {
$sManager = get_class();
}
self::$PREVIOUS_MANAGER = Manager::getCurrentManager();
self::$CURRENT_MANAGER = $sManager;
}