本文整理汇总了PHP中Frontend::getRootPageFromUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Frontend::getRootPageFromUrl方法的具体用法?PHP Frontend::getRootPageFromUrl怎么用?PHP Frontend::getRootPageFromUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frontend
的用法示例。
在下文中一共展示了Frontend::getRootPageFromUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* Get all youtube setting, considering root page and content element & module config
*
* @return array the settings
*/
public function getData()
{
$arrData = array();
$objRoot = \Frontend::getRootPageFromUrl();
if ($objRoot === null) {
return $arrData;
}
if (!is_array($this->arrData)) {
$this->arrData = array();
}
$arrRootPageData = \HeimrichHannot\Haste\Util\Arrays::filterByPrefixes($objRoot->row(), self::$arrayKeyPrefixes);
// array_filter() : do not overwrite empty values
$arrData = array_merge(array_filter($arrRootPageData, 'strval'), array_filter($this->arrData, 'strval'));
return $arrData;
}
示例2: getPageIdFromUrlHook
public static function getPageIdFromUrlHook($arrFragments)
{
$objParticipation = ParticipationModel::findPublishedByAlias(\Environment::get('request'));
if ($objParticipation !== null) {
$blnAddParticipation = true;
// only one participation per alias is supported yet
if ($objParticipation instanceof \Model\Collection) {
$objParticipation = $objParticipation->current();
}
$objArchive = $objParticipation->getRelated('pid');
if ($objArchive === null) {
$blnAddParticipation = false;
}
// check if current page is in defined root
if ($objArchive->defineRoot && $objArchive->rootPage > 0) {
$objCurrentRootPage = \Frontend::getRootPageFromUrl();
$objRootPage = \PageModel::findByPk($objArchive->rootPage);
if ($objRootPage !== null && $objCurrentRootPage !== null) {
if ($objRootPage->domain != $objCurrentRootPage->domain) {
$blnAddParticipation = false;
ParticipationController::removeActiveParticipation();
}
}
}
if ($blnAddParticipation) {
ParticipationController::setActiveParticipation($objParticipation);
if ($objArchive->addInfoMessage && $objArchive->infoMessageWith !== '') {
ParticipationMessage::addInfo(\String::parseSimpleTokens($objArchive->infoMessageWith, array('participation' => ParticipationController::getParticipationLabel($objParticipation, '', true))), PARTICIPATION_MESSAGEKEY_ACTIVE);
}
}
if (($objConfig = ParticipationController::findParticipationDataConfigClass($objParticipation)) !== null) {
global $objPage;
$objJumpTo = $objConfig->getJumpToPage();
// redirect first, otherwise participation process will run twice
if ($objJumpTo !== null && $objPage->id != $objJumpTo->id) {
\Controller::redirect(\Controller::generateFrontendUrl($objJumpTo->row()));
}
}
}
return $arrFragments;
}