当前位置: 首页>>代码示例>>PHP>>正文


PHP Wikia::isContentNamespace方法代码示例

本文整理汇总了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;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:66,代码来源:JSVariables.php

示例2: shouldDisplayFlags

 /**
  * Checks if flags should be displayed on a page
  * @return bool
  */
 public function shouldDisplayFlags()
 {
     global $wgTitle;
     return $wgTitle->exists() && \Wikia::isContentNamespace();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:9,代码来源:FlagsHelper.class.php

示例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;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:55,代码来源:JSVariables.php


注:本文中的Wikia::isContentNamespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。