本文整理汇总了PHP中Manager::getManagerClassNormalized方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::getManagerClassNormalized方法的具体用法?PHP Manager::getManagerClassNormalized怎么用?PHP Manager::getManagerClassNormalized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager::getManagerClassNormalized方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: internalLinkCallback
public static function internalLinkCallback($oIdentifier)
{
$aValue = explode('/', $oIdentifier->getValue());
$iId = array_shift($aValue);
$oPage = PageQuery::create()->findPk($iId);
if ($oPage) {
$mManager = Manager::getManagerClassNormalized();
if ($mManager !== "PreviewManager") {
$mManager = "FrontendManager";
}
$sLink = self::getLink(array_merge($oPage->getFullPathArray(), $aValue), $mManager);
return self::writeTagForIdentifier("a", array('href' => $sLink, 'title' => $oPage->getPageTitle(), 'rel' => 'internal', 'class' => 'internal_link'), $oIdentifier, null, $oPage);
}
}
示例2: link
public static function link($mPath = false, $mManager = null, $aParameters = array(), $mLanguage = null, $bIncludeLanguage = null)
{
if ($mPath === null) {
// Respect null-links
return null;
}
if (!$mPath) {
$mPath = array();
}
if (!is_array($mPath)) {
$mPath = explode("/", $mPath);
}
$mManager = Manager::getManagerClassNormalized($mManager);
$sPrefix = Manager::getPrefixForManager($mManager);
if ($mLanguage === true || $mLanguage === false) {
$bIncludeLanguage = $mLanguage;
$mLanguage = null;
}
if ($bIncludeLanguage === null) {
$bIncludeLanguage = $mManager::shouldIncludeLanguageInLink();
}
if ($bIncludeLanguage) {
if ($mLanguage === null) {
$mLanguage = Session::language(true);
}
if ($mLanguage instanceof Language) {
array_unshift($mPath, $mLanguage->getPathPrefix());
} else {
if (is_string($mLanguage)) {
$mLanguage = LanguageQuery::create()->findPk($mLanguage)->getPathPrefix();
array_unshift($mPath, $mLanguage);
}
}
}
foreach ($mPath as $iKey => $sValue) {
if ($sValue === null || $sValue === "") {
unset($mPath[$iKey]);
} else {
$mPath[$iKey] = rawurlencode($sValue);
}
}
if ($sPrefix !== null && $sPrefix !== "") {
$sPrefix .= "/";
} else {
$sPrefix = '';
}
return MAIN_DIR_FE_PHP . $sPrefix . implode('/', $mPath) . self::prepareLinkParameters($aParameters);
}
示例3: 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;
}