本文整理汇总了PHP中OutputPage::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::getTitle方法的具体用法?PHP OutputPage::getTitle怎么用?PHP OutputPage::getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPage
的用法示例。
在下文中一共展示了OutputPage::getTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModulesForArticle
/**
* Handler for BeforePageDisplay hook
* Add JavaScript to the page when an image is on it
* and the user has enabled the feature if BetaFeatures is installed
* @param OutputPage $out
* @param Skin $skin
* @return bool
*/
public static function getModulesForArticle(&$out, &$skin)
{
if (count($out->getFileSearchOptions()) > 0 || $out->getTitle()->inNamespace(NS_FILE)) {
return self::getModules($out);
}
return true;
}
示例2: addModules
/**
* Hook: BeforePageDisplay
*/
public static function addModules(OutputPage $out, Skin $skin)
{
global $wgContentTranslationEventLogging, $wgContentTranslationCampaigns;
$title = $out->getTitle();
$user = $out->getUser();
// Check if CX is available for current user.
if (!self::isEnabledForUser($user)) {
if (!$title->exists() && $wgContentTranslationCampaigns['newarticle'] && !$out->getRequest()->getCookie('cx_campaign_newarticle_hide', '') && !$user->isAnon()) {
$out->addModules('ext.cx.campaigns.newarticle.veloader');
if ($wgContentTranslationEventLogging) {
$out->addModules('ext.cx.eventlogging');
}
}
return;
}
// If EventLogging integration is enabled, load the event logging functions module
if ($wgContentTranslationEventLogging) {
$out->addModules('ext.cx.eventlogging');
}
if ($title->inNamespace(NS_MAIN) && Action::getActionName($out->getContext()) === 'view' && $title->exists()) {
$out->addModules('ext.cx.interlanguagelink');
}
// Add a hover menu for the contributions link in personal toolbar
$out->addModules('ext.cx.campaigns.contributionsmenu');
// The current guided tours are only for the user namespace,
// so load the module only there.
// In the future there may be guided tours in other namespaces,
// and then this condition should be changed.
if (class_exists('GuidedTourHooks') && $title->inNamespace(NS_USER)) {
$out->addModules('ext.guidedTour');
}
}
示例3: onBeforePageDisplay
public static function onBeforePageDisplay(\OutputPage &$output, \Skin &$skin)
{
$title = $output->getTitle();
// Disallow commenting on pages without article id
if ($title->getArticleID() == 0) {
return true;
}
if ($title->isSpecialPage()) {
return true;
}
// These could be explicitly allowed in later version
if (!$title->canTalk()) {
return true;
}
if ($title->isTalkPage()) {
return true;
}
if ($title->isMainPage()) {
return true;
}
// Do not display when printing
if ($output->isPrintable()) {
return true;
}
// Disable if not viewing
if ($skin->getRequest()->getVal('action', 'view') != 'view') {
return true;
}
// Blacklist several namespace
if (in_array($title->getNamespace(), array(NS_MEDIAWIKI, NS_TEMPLATE, NS_CATEGORY, NS_FILE, NS_USER))) {
return true;
}
$output->addModules('ext.pagerating');
return true;
}
示例4: 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;
}
示例5: efOpenGraphMetaPageHook
function efOpenGraphMetaPageHook(OutputPage &$out, &$sk)
{
global $wgLogo, $wgSitename, $wgXhtmlNamespaces, $egFacebookAppId, $egFacebookAdmins;
$wgXhtmlNamespaces["og"] = "http://opengraphprotocol.org/schema/";
$title = $out->getTitle();
$isMainpage = $title->isMainPage();
$meta = array();
if ($isMainpage) {
$meta["og:type"] = "website";
$meta["og:title"] = $wgSitename;
} else {
$meta["og:type"] = "article";
$meta["og:site_name"] = $wgSitename;
// Try to chose the most appropriate title for showing in news feeds.
if (defined('NS_BLOG_ARTICLE') && $title->getNamespace() == NS_BLOG_ARTICLE || defined('NS_BLOG_ARTICLE_TALK') && $title->getNamespace() == NS_BLOG_ARTICLE_TALK) {
$meta["og:title"] = $title->getSubpageText();
} else {
$meta["og:title"] = $title->getText();
}
}
if (isset($out->mMainImage) && $out->mMainImage !== false) {
if (is_object($out->mMainImage)) {
$meta["og:image"] = wfExpandUrl($out->mMainImage->createThumb(100 * 3, 100));
} else {
// In some edge-cases we won't have defined an object but rather a full URL.
$meta["og:image"] = $out->mMainImage;
}
} elseif ($isMainpage) {
$meta["og:image"] = wfExpandUrl($wgLogo);
}
if (isset($out->mDescription)) {
// set by Description2 extension, install it if you want proper og:description support
$meta["og:description"] = $out->mDescription;
}
$meta["og:url"] = $title->getFullURL();
if ($egFacebookAppId) {
/* begin wikia change */
// $meta["fb:app_id"] = $egFacebookAppId;
// fb:app_id needs a prefix property declaring the namespace, so just add it directly
$out->addHeadItem("meta:property:fb:app_id", "\t" . Html::element('meta', array('property' => 'fb:app_id', 'content' => $egFacebookAppId, 'prefix' => "fb: http://www.facebook.com/2008/fbml")) . "\n");
/* end wikia change */
}
if ($egFacebookAdmins) {
$meta["fb:admins"] = $egFacebookAdmins;
}
/* begin wikia change */
wfRunHooks('OpenGraphMetaHeaders', array("meta" => &$meta, "title" => $title));
/* end wikia change */
foreach ($meta as $property => $value) {
if ($value) {
if (isset(OutputPage::$metaAttrPrefixes) && isset(OutputPage::$metaAttrPrefixes['property'])) {
$out->addMeta("property:{$property}", $value);
} else {
$out->addHeadItem("meta:property:{$property}", "\t" . Html::element('meta', array('property' => $property, 'content' => $value)) . "\n");
}
}
}
return true;
}
示例6: onBeforePageDisplay
/**
* Hook-Handler for MediaWiki 'BeforePageDisplay' hook. Sets context if needed.
* @param OutputPage $oOutputPage
* @param Skin $oSkin
* @return bool
*/
public function onBeforePageDisplay(&$oOutputPage, &$oSkin)
{
if (!SpecialPage::getTitleFor('Preferences')->equals($oOutputPage->getTitle())) {
return true;
}
$oOutputPage->addModules('ext.bluespice.userpreferences');
return true;
}
示例7: onBeforePageDisplay
/**
* Adds module
* @param OutputPage $out
* @param SkinTemplate $skin
* @return boolean
*/
public static function onBeforePageDisplay(&$out, &$skin)
{
if (!$out->getTitle()->equals($out->getUser()->getUserPage())) {
return true;
}
$out->addModules("ext.bluespice.avatars.js");
return true;
}
示例8: hookOutputPageBeforeHTML
function hookOutputPageBeforeHTML(OutputPage &$out, &$text)
{
if ($out->getTitle()->getNamespace() == 6) {
//6 is the File Namespace
$out->includeJQuery();
$out->addModules('ext.SemanticImageAnnotator');
}
return true;
}
示例9: onBeforePageDisplay
public static function onBeforePageDisplay(OutputPage $out, Skin $sk)
{
wfProfileIn(__METHOD__);
$title = $out->getTitle();
if ($title instanceof Title && $title->isContentPage()) {
$storage = PlaceStorage::newFromTitle($out->getTitle());
$model = $storage->getModel();
/* @var $model PlaceModel */
if ($model instanceof PlaceModel && !$model->isEmpty()) {
$out->addMeta('geo.position', implode(',', $model->getLatLon()));
}
}
if ($title instanceof Title && $title->getNamespace() == NS_CATEGORY) {
$out->addScript('<script src="' . F::app()->wg->extensionsPath . '/wikia/Places/js/GeoEnableButton.js"></script>');
$out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Places/css/GeoEnableButton.scss'));
}
wfProfileOut(__METHOD__);
return true;
}
示例10: onEditPage
/**
* Parser hook registering the GUI module only in edit pages.
*
* @param EditPage $editPage
* @param OutputPage $output
* @return bool
*/
public static function onEditPage($editPage, $output)
{
global $wgTemplateDataUseGUI;
if ($wgTemplateDataUseGUI) {
if ($output->getTitle()->getNamespace() === NS_TEMPLATE) {
$output->addModules('ext.templateDataGenerator.editPage');
}
}
return true;
}
示例11: onBeforePageDisplay
/**
* This function adds additional modules containing CSS before the page is displayed
*/
public function onBeforePageDisplay(OutputPage &$out, Skin &$ski)
{
$title_object = $out->getTitle();
$page_title = $title_object->getPrefixedURL();
if ($page_title === 'Special:UserPage' || $page_title === 'Special:AllCollections' || $page_title === 'Special:SingleManuscriptPages' || $page_title === 'Special:AllCollations' || $page_title === 'Special:RecentManuscriptPages' || $page_title === 'Special:AllStylometricAnalysis') {
$out->addModuleStyles(array('ext.userpagecss', 'ext.manuscriptdeskbasecss'));
$out->addModules("ext.javascriptloaderdots");
}
return true;
}
示例12: onBeforePageDisplay
/**
*
* @param OutputPage $oOutputPage
* @param SkinTemplate $oSkinTemplate
* @return boolean
*/
public function onBeforePageDisplay($oOutputPage, $oSkinTemplate)
{
$oTitle = $oOutputPage->getTitle();
$sHideTitlePageProp = BsArticleHelper::getInstance($oTitle)->getPageProp('bs_hidetitle');
if ($sHideTitlePageProp === '') {
$oOutputPage->mPagetitle = '';
$oOutputPage->addInlineScript("\$('.firstHeading').remove()");
}
return true;
}
示例13: onBeforePageDisplay
public static function onBeforePageDisplay(OutputPage $out, SkinTemplate $sk)
{
$config = $out->getConfig();
if (self::canOutputHreflang($config)) {
# Generate hreflang tags
$languageLinks = $out->getLanguageLinks();
if (empty($languageLinks)) {
// shortcut - if we don't have any language links, don't bother
return;
}
$addedLink = false;
$pages = $config->get("HreflangPages");
if (!$pages) {
$pages = array();
$foundPage = true;
} else {
$pages = array_flip($pages);
$pageName = $out->getLanguage()->getHtmlCode() . ":" . $out->getTitle()->getBaseText();
$foundPage = isset($pages[$pageName]);
}
foreach ($languageLinks as $languageLinkText) {
$languageLinkTitle = Title::newFromText($languageLinkText);
if (!$languageLinkTitle) {
continue;
}
$ilInterwikiCode = $languageLinkTitle->getInterwiki();
if (!Language::isKnownLanguageTag($ilInterwikiCode)) {
continue;
}
$foundPage = $foundPage || isset($pages[$languageLinkText]);
$tags[] = Html::element('link', array('rel' => 'alternate', 'hreflang' => wfBCP47($ilInterwikiCode), 'href' => $languageLinkTitle->getFullURL()));
$addedLink = true;
}
// Only add current language link if we had any other links
if ($addedLink) {
$tags[] = Html::element('link', array('rel' => 'alternate', 'hreflang' => $out->getLanguage()->getHtmlCode(), 'href' => $out->getTitle()->getFullURL()));
}
}
if ($foundPage && $tags) {
$out->addHeadItem("hreflang:tags", join("\n", $tags));
}
}
示例14: onBeforePageDisplay
/**
* BeofrePageDislpay hook. Load additional modules containing CSS before the page is displayed
*/
public function onBeforePageDisplay(OutputPage &$out, Skin &$ski)
{
$page_title_with_namespace = $out->getTitle()->getPrefixedURL();
if ($page_title_with_namespace === 'Special:HelperScripts') {
$css_modules = array('ext.manuscriptdeskbasecss');
$javascript_modules = array('ext.javascriptloader');
$out->addModuleStyles($css_modules);
$out->addModules($javascript_modules);
}
return true;
}
示例15: beforePageDisplay
/**
* Adds feeds to the page header
*
* @param OutputPage $out
* @return bool
*/
public static function beforePageDisplay(OutputPage &$out)
{
global $wgAdvertisedFeedTypes;
if ($out->getTitle()->isMainPage()) {
foreach (self::getFeeds($out->getLanguage()->getCode()) as $feed) {
foreach ($wgAdvertisedFeedTypes as $type) {
$out->addLink(array('rel' => 'alternate', 'type' => "application/{$type}+xml", 'title' => $feed->title, 'href' => $feed->getURL($type)));
}
}
}
return true;
}