本文整理汇总了PHP中Wikia::isContentNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::isContentNamespace方法的具体用法?PHP Wikia::isContentNamespace怎么用?PHP Wikia::isContentNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikia
的用法示例。
在下文中一共展示了Wikia::isContentNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfMakeGlobalVariablesScript
/**
* @param array $vars JS variables to be added at the bottom of the page
* @param OutputPage $out
* @return bool return true - it's a hook
*/
function wfMakeGlobalVariablesScript(array &$vars, OutputPage $out)
{
wfProfileIn(__METHOD__);
global $wgMemc, $wgEnableAjaxLogin, $wgPrivateTracker, $wgExtensionsPath, $wgArticle, $wgStyleVersion, $wgSitename, $wgDisableAnonymousEditing, $wgGroupPermissions, $wgBlankImgUrl, $wgCookieDomain, $wgCookiePath, $wgResourceBasePath;
$skin = $out->getSkin();
$title = $out->getTitle();
// MW1.19 - ResourceLoaderStartUpModule class adds more variables
$cats = wfGetBreadCrumb();
$idx = count($cats) - 2;
if (isset($cats[$idx])) {
$vars['wgCatId'] = $cats[$idx]['id'];
$vars['wgParentCatId'] = $cats[$idx]['parentId'];
} else {
$vars['wgCatId'] = 0;
$vars['wgParentCatId'] = 0;
}
$skinName = get_class($skin);
if (is_array($wgEnableAjaxLogin) && in_array($skinName, $wgEnableAjaxLogin)) {
$vars['wgEnableAjaxLogin'] = true;
}
$vars['wgBlankImgUrl'] = $wgBlankImgUrl;
if (!empty($wgPrivateTracker)) {
$vars['wgPrivateTracker'] = true;
}
// TODO: load it on-demand using JSMessages
if ($vars['wgIsArticle'] == false && !empty($vars['wgEnableAjaxLogin'])) {
$vars['ajaxLogin1'] = wfMsg('ajaxLogin1');
$vars['ajaxLogin2'] = wfMsg('ajaxLogin2');
}
// TODO: use wgMainPageTitle instead?
$vars['wgMainpage'] = wfMsgForContent('mainpage');
if (Wikia::isMainPage()) {
$vars['wgIsMainpage'] = true;
}
if (Wikia::isContentNamespace()) {
$vars['wgIsContentNamespace'] = true;
}
$vars['wgStyleVersion'] = isset($wgStyleVersion) ? $wgStyleVersion : '';
// TODO: is this one really needed?
if (isset($skin->themename)) {
$vars['themename'] = $skin->themename;
}
$vars['wgExtensionsPath'] = $wgExtensionsPath;
$vars['wgResourceBasePath'] = $wgResourceBasePath;
$vars['wgSitename'] = $wgSitename;
// Set the JavaScript variable which is used by AJAX request to make data caching possible - Inez
$vars['wgMWrevId'] = $wgMemc->get(wfMemcKey('wgMWrevId'));
// macbre: get revision ID of current article
if (($title->isContentPage() || $title->isTalkPage()) && !is_null($wgArticle)) {
$vars['wgRevisionId'] = !empty($wgArticle->mRevision) ? $wgArticle->mRevision->getId() : intval($wgArticle->mLatest);
}
// is anon editing disabled?
if ($wgDisableAnonymousEditing || $wgGroupPermissions['user']['edit'] === false) {
$vars['wgDisableAnonymousEditing'] = true;
}
// moved from Interstitial.php
$vars['wgCookieDomain'] = $wgCookieDomain;
$vars['wgCookiePath'] = $wgCookiePath;
wfProfileOut(__METHOD__);
return true;
}
示例2: shouldDisplayFlags
/**
* Checks if flags should be displayed on a page
* @return bool
*/
public function shouldDisplayFlags()
{
global $wgTitle;
return $wgTitle->exists() && \Wikia::isContentNamespace();
}
示例3: wfMakeGlobalVariablesScript
/**
* MW1.19 - ResourceLoaderStartUpModule class adds more variables
* @param array $vars JS variables to be added at the bottom of the page
* @param OutputPage $out
* @return bool return true - it's a hook
*/
function wfMakeGlobalVariablesScript(array &$vars, OutputPage $out)
{
wfProfileIn(__METHOD__);
global $wgMemc, $wgPrivateTracker, $wgExtensionsPath, $wgArticle, $wgSitename, $wgDisableAnonymousEditing, $wgCityId, $wgGroupPermissions, $wgBlankImgUrl, $wgCookieDomain, $wgCookiePath, $wgResourceBasePath;
$skin = $out->getSkin();
$title = $out->getTitle();
// FIXME: This needs to be converted to getVerticalId when the data is available (PLATFORM-267)
$hubService = WikiFactoryHub::getInstance();
$catId = $hubService->getCategoryId($wgCityId);
if (isset($catId)) {
$vars['wgCatId'] = $catId;
} else {
$vars['wgCatId'] = 0;
}
$vars['wgBlankImgUrl'] = $wgBlankImgUrl;
if (!empty($wgPrivateTracker)) {
$vars['wgPrivateTracker'] = true;
}
// TODO: use wgMainPageTitle instead?
$vars['wgMainpage'] = wfMsgForContent('mainpage');
if (Wikia::isMainPage()) {
$vars['wgIsMainpage'] = true;
}
if (Wikia::isContentNamespace()) {
$vars['wgIsContentNamespace'] = true;
}
// TODO: is this one really needed?
if (isset($skin->themename)) {
$vars['themename'] = $skin->themename;
}
$vars['wgExtensionsPath'] = $wgExtensionsPath;
$vars['wgResourceBasePath'] = $wgResourceBasePath;
$vars['wgSitename'] = $wgSitename;
// Set the JavaScript variable which is used by AJAX request to make data caching possible - Inez
$vars['wgMWrevId'] = $wgMemc->get(wfMemcKey('wgMWrevId'));
// macbre: get revision ID of current article
if (($title->isContentPage() || $title->isTalkPage()) && !is_null($wgArticle)) {
$vars['wgRevisionId'] = !empty($wgArticle->mRevision) ? $wgArticle->mRevision->getId() : intval($wgArticle->mLatest);
}
// is anon editing disabled?
if ($wgDisableAnonymousEditing || $wgGroupPermissions['user']['edit'] === false) {
$vars['wgDisableAnonymousEditing'] = true;
}
// moved from Interstitial.php
$vars['wgCookieDomain'] = $wgCookieDomain;
$vars['wgCookiePath'] = $wgCookiePath;
wfProfileOut(__METHOD__);
return true;
}