本文整理汇总了PHP中OutputPage::canUseWikiPage方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::canUseWikiPage方法的具体用法?PHP OutputPage::canUseWikiPage怎么用?PHP OutputPage::canUseWikiPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPage
的用法示例。
在下文中一共展示了OutputPage::canUseWikiPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DOMParse
/**
* Transforms content to be mobile friendly version.
* Filters out various elements and runs the MobileFormatter.
* @param OutputPage $out
* @param string $mode mobile mode, i.e. stable or beta
*
* @return string
*/
public static function DOMParse(OutputPage $out, $text = null, $isBeta = false)
{
$html = $text ? $text : $out->getHTML();
$context = MobileContext::singleton();
$formatter = MobileFormatter::newFromContext($context, $html);
Hooks::run('MobileFrontendBeforeDOM', array($context, $formatter));
$title = $out->getTitle();
$isSpecialPage = $title->isSpecialPage();
$formatter->enableExpandableSections($out->canUseWikiPage() && $out->getWikiPage()->getContentModel() == CONTENT_MODEL_WIKITEXT && array_search($title->getNamespace(), $context->getMFConfig()->get('MFNamespacesWithoutCollapsibleSections')) === false && $context->getRequest()->getText('action', 'view') == 'view');
if ($context->getContentTransformations()) {
// Remove images if they're disabled from special pages, but don't transform otherwise
$formatter->filterContent(!$isSpecialPage);
}
$contentHtml = $formatter->getText();
// If the page is a user page which has not been created, then let the
// user know about it with pretty graphics and different texts depending
// on whether the user is the owner of the page or not.
if ($isBeta && $title->inNamespace(NS_USER) && !$title->isSubpage()) {
$pageUserId = User::idFromName($title->getText());
if ($pageUserId && !$title->exists()) {
$pageUser = User::newFromId($pageUserId);
$contentHtml = ExtMobileFrontend::getUserPageContent($out, $pageUser);
}
}
return $contentHtml;
}
示例2: DOMParse
/**
* Transforms content to be mobile friendly version.
* Filters out various elements and runs the MobileFormatter.
* @param OutputPage $out
*
* @return string
*/
public static function DOMParse(OutputPage $out)
{
$html = $out->getHTML();
$context = MobileContext::singleton();
$formatter = MobileFormatter::newFromContext($context, $html);
Hooks::run('MobileFrontendBeforeDOM', array($context, $formatter));
$title = $out->getTitle();
$isSpecialPage = $title->isSpecialPage();
$formatter->enableExpandableSections($out->canUseWikiPage() && $out->getWikiPage()->getContentModel() == CONTENT_MODEL_WIKITEXT && array_search($title->getNamespace(), $context->getMFConfig()->get('MFNamespacesWithoutCollapsibleSections')) === false && $context->getRequest()->getText('action', 'view') == 'view');
if ($context->getContentTransformations()) {
// Remove images if they're disabled from special pages, but don't transform otherwise
$formatter->filterContent(!$isSpecialPage);
}
$contentHtml = $formatter->getText();
return $contentHtml;
}