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


PHP WikiFactory::getVarValueByName方法代码示例

本文整理汇总了PHP中WikiFactory::getVarValueByName方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::getVarValueByName方法的具体用法?PHP WikiFactory::getVarValueByName怎么用?PHP WikiFactory::getVarValueByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WikiFactory的用法示例。


在下文中一共展示了WikiFactory::getVarValueByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPathPrefix

 function getPathPrefix()
 {
     $wikiDbName = $this->repo->getDBName();
     $wikiId = WikiFactory::DBtoID($wikiDbName);
     $wikiUploadPath = WikiFactory::getVarValueByName('wgUploadPath', $wikiId);
     return VignetteRequest::parsePathPrefix($wikiUploadPath);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:WikiaForeignDBFile.class.php

示例2: index

 public function index()
 {
     if (!$this->wg->User->isAllowed('gameguidescontent')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $title = $this->wf->Msg('wikiagameguides-content-title');
     $this->wg->Out->setPageTitle($title);
     $this->wg->Out->setHTMLTitle($title);
     $this->wg->Out->addModules('jquery.autocomplete');
     $assetManager = AssetsManager::getInstance();
     $styles = $assetManager->getUrl('extensions/wikia/GameGuides/css/GameGuidesContentManagmentTool.scss');
     foreach ($styles as $s) {
         $this->wg->Out->addStyle($s);
     }
     $scripts = $assetManager->getURL('extensions/wikia/GameGuides/js/GameGuidesContentManagmentTool.js');
     foreach ($scripts as $s) {
         $this->wg->Out->addScriptFile($s);
     }
     F::build('JSMessages')->enqueuePackage('GameGuidesContentMsg', JSMessages::INLINE);
     $tags = WikiFactory::getVarValueByName('wgWikiaGameGuidesContent', $this->wg->CityId);
     $this->response->setVal('tags', $tags);
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:25,代码来源:GameGuidesSpecialContentController.class.php

示例3: getVariablesValues

 /**
  * Get variables values
  *
  * @return object key / value list variables
  */
 private function getVariablesValues()
 {
     global $wgInstantGlobalsOverride;
     if (!empty($wgInstantGlobalsOverride) && is_array($wgInstantGlobalsOverride)) {
         $override = $wgInstantGlobalsOverride;
     } else {
         $override = [];
     }
     $ret = [];
     $variables = [];
     wfRunHooks('InstantGlobalsGetVariables', [&$variables]);
     foreach ($variables as $name) {
         // Use the value on community but override with the $wgInstantGlobalsOverride
         if (array_key_exists($name, $override)) {
             $value = $override[$name];
         } else {
             $value = WikiFactory::getVarValueByName($name, Wikia::COMMUNITY_WIKI_ID);
         }
         // don't emit "falsy" values
         if (!empty($value)) {
             $ret[$name] = $value;
         }
     }
     return (object) $ret;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:InstantGlobalsModule.class.php

示例4: getTop

 /**
  * Get the top wikis by weekly pageviews optionally filtering by vertical (hub) and/or language
  *
  * @param string $hub [OPTIONAL] The name of the vertical (e.g. Gaming, Entertainment,
  * Lifestyle, etc.) to use as a filter
  * @param string $lang [OPTIONAL] The language code (e.g. en, de, fr, es, it, etc.) to use as a filter
  *
  * @return array A collection of results with id, name, hub, language, topic and domain
  */
 public function getTop($lang = null, $hub = null)
 {
     $this->wf->profileIn(__METHOD__);
     $cacheKey = $this->wf->SharedMemcKey(__METHOD__, self::CACHE_VERSION, $lang, $hub);
     $results = $this->wg->Memc->get($cacheKey);
     if (!is_array($results)) {
         $results = array();
         $wikis = DataMartService::getTopWikisByPageviews(DataMartService::PERIOD_ID_WEEKLY, self::MAX_RESULTS, $lang, $hub, 1);
         foreach ($wikis as $wikiId => $wiki) {
             //fetching data from WikiFactory
             //the table is indexed and values cached separately
             //so making one query for all of them or a few small
             //separate ones doesn't make any big difference while
             //this respects WF's data abstraction layer
             //also: WF data is heavily cached
             $name = WikiFactory::getVarValueByName('wgSitename', $wikiId);
             $hubName = !empty($hub) ? $hub : $this->getVerticalByWikiId($wikiId);
             $langCode = WikiFactory::getVarValueByName('wgLanguageCode', $wikiId);
             $topic = WikiFactory::getVarValueByName('wgWikiTopics', $wikiId);
             $domain = $this->getDomainByWikiId($wikiId);
             $results[] = array('id' => $wikiId, 'name' => !empty($name) ? $name : null, 'hub' => $hubName, 'language' => !empty($langCode) ? $langCode : null, 'topic' => !empty($topic) ? $topic : null, 'domain' => $domain);
         }
         $this->wg->Memc->set($cacheKey, $results, 86400);
     }
     $this->wf->profileOut(__METHOD__);
     return $results;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:36,代码来源:WikisModel.class.php

示例5: newFromWiki

 /**
  * Get storage instance to access uploaded files for a given wiki
  *
  * @param $cityId number|string city ID or wiki name
  * @param $dataCenter string|null name of data center (res, iowa ... )
  * @return SwiftStorage storage instance
  */
 public static function newFromWiki($cityId, $dataCenter = null)
 {
     $wgUploadPath = \WikiFactory::getVarValueByName('wgUploadPath', $cityId);
     $path = trim(parse_url($wgUploadPath, PHP_URL_PATH), '/');
     list($containerName, $prefix) = explode('/', $path, 2);
     return new self($containerName, '/' . $prefix, $dataCenter);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:SwiftStorage.class.php

示例6: getUploadDir

 private function getUploadDir()
 {
     if (!isset($this->uploadDir)) {
         $this->uploadDir = WikiFactory::getVarValueByName('wgUploadPath', $this->mTitle->mCityId);
     }
     return $this->uploadDir;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:GlobalFile.class.php

示例7: execute

 function execute($params = null)
 {
     global $IP, $wgWikiaLocalSettingsPath;
     $this->mTaskID = $params->task_id;
     $oUser = User::newFromId($params->task_user_id);
     $oUser->load();
     $this->mUser = $oUser->getName();
     $data = unserialize($params->task_arguments);
     $articles = $data["articles"];
     $username = escapeshellarg($data["username"]);
     $this->addLog("Starting task.");
     $this->addLog("List of restored articles (by " . $this->mUser . ' as ' . $username . "):");
     for ($i = 0; $i < count($articles); $i++) {
         $titleobj = Title::makeTitle($articles[$i]["namespace"], $articles[$i]["title"]);
         $article_to_do = $titleobj->getText();
         $namespace = intval($articles[$i]["namespace"]);
         $reason = $articles[$i]['reason'] ? ' -r ' . escapeshellarg($articles[$i]['reason']) : '';
         $sCommand = "SERVER_ID=" . $articles[$i]["wikiid"] . " php {$IP}/maintenance/wikia/restoreOn.php -u " . $username . " -t " . escapeshellarg($article_to_do) . " -n " . $namespace . $reason . " --conf " . escapeshellarg($wgWikiaLocalSettingsPath);
         $city_url = WikiFactory::getVarValueByName("wgServer", $articles[$i]["wikiid"]);
         if (empty($city_url)) {
             $city_url = 'wiki id in WikiFactory: ' . $articles[$i]["wikiid"];
         }
         $city_path = WikiFactory::getVarValueByName("wgScript", $articles[$i]["wikiid"]);
         $actual_title = wfShellExec($sCommand, $retval);
         if ($retval) {
             $this->addLog('Article undeleting error! (' . $city_url . '). Error code returned: ' . $retval . ' Error was: ' . $actual_title);
         } else {
             $this->addLog('<a href="' . $city_url . $city_path . '?title=' . $actual_title . '">' . $city_url . $city_path . '?title=' . $actual_title . '</a>');
         }
     }
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:MultiRestoreTask.php

示例8: getWikisList

 public function getWikisList($limit = null, $batch = 1)
 {
     wfProfileIn(__METHOD__);
     $cacheKey = $this->generateCacheKey(__METHOD__);
     $games = $this->loadFromCache($cacheKey);
     if (empty($games)) {
         $games = array();
         $wikiFactoryRecommendVar = WikiFactory::getVarByName(self::WF_WIKI_RECOMMEND_VAR, null);
         if (!empty($wikiFactoryRecommendVar)) {
             $recommendedIds = WikiFactory::getCityIDsFromVarValue($wikiFactoryRecommendVar->cv_variable_id, true, '=');
             foreach ($recommendedIds as $wikiId) {
                 $wikiName = WikiFactory::getVarValueByName('wgSitename', $wikiId);
                 $wikiGames = WikiFactory::getVarValueByName('wgWikiTopics', $wikiId);
                 $wikiDomain = str_replace('http://', '', WikiFactory::getVarValueByName('wgServer', $wikiId));
                 $wikiThemeSettings = WikiFactory::getVarValueByName('wgOasisThemeSettings', $wikiId);
                 $wordmarkUrl = $wikiThemeSettings['wordmark-image-url'];
                 $wordmarkType = $wikiThemeSettings['wordmark-type'];
                 //$wikiLogo = WikiFactory::getVarValueByName( "wgLogo", $wikiId );
                 $games[] = array('name' => !empty($wikiThemeSettings['wordmark-text']) ? $wikiThemeSettings['wordmark-text'] : $wikiName, 'games' => !empty($wikiGames) ? $wikiGames : '', 'color' => !empty($wikiThemeSettings['wordmark-color']) ? $wikiThemeSettings['wordmark-color'] : '#0049C6', 'backgroundColor' => !empty($wikiThemeSettings['color-page']) ? $wikiThemeSettings['color-page'] : '#FFFFFF', 'domain' => $wikiDomain, 'wordmarkUrl' => $wordmarkType == 'graphic' && !empty($wordmarkUrl) ? $wordmarkUrl : '');
             }
         } else {
             wfProfileOut(__METHOD__);
             throw new WikiaException('WikiFactory variable \'' . self::WF_WIKI_RECOMMEND_VAR . '\' not found');
         }
         $this->storeInCache($cacheKey, $games);
     }
     $ret = wfPaginateArray($games, $limit, $batch);
     wfProfileOut(__METHOD__);
     return $ret;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:GameGuidesModel.class.php

示例9: performQueryTest

 /**
  * @param $wikiId
  * @param $query
  * @return float
  */
 public function performQueryTest($wikiId, $query)
 {
     $wgLinkSuggestLimit = 6;
     $dbName = WikiFactory::IDtoDB($wikiId);
     $db = wfGetDB(DB_SLAVE, [], $dbName);
     $namespaces = WikiFactory::getVarValueByName("wgContentNamespaces", $wikiId);
     $namespaces = $namespaces ? $namespaces : [0];
     $query = addslashes($query);
     $queryLower = strtolower($query);
     if (count($namespaces) > 0) {
         $commaJoinedNamespaces = count($namespaces) > 1 ? array_shift($namespaces) . ', ' . implode(', ', $namespaces) : $namespaces[0];
     }
     $pageNamespaceClause = isset($commaJoinedNamespaces) ? 'page_namespace IN (' . $commaJoinedNamespaces . ') AND ' : '';
     $pageTitlePrefilter = "";
     if (strlen($queryLower) >= 2) {
         $pageTitlePrefilter = "(\n\t\t\t\t\t\t\t( page_title " . $db->buildLike(strtoupper($queryLower[0]) . strtolower($queryLower[1]), $db->anyString()) . " ) OR\n\t\t\t\t\t\t\t( page_title " . $db->buildLike(strtoupper($queryLower[0]) . strtoupper($queryLower[1]), $db->anyString()) . " ) ) AND ";
     } else {
         if (strlen($queryLower) >= 1) {
             $pageTitlePrefilter = "( page_title " . $db->buildLike(strtoupper($queryLower[0]), $db->anyString()) . " ) AND ";
         }
     }
     $sql = "SELECT page_len, page_id, page_title, rd_title, page_namespace, page_is_redirect\n\t\t\t\t\t\tFROM page\n\t\t\t\t\t\tLEFT JOIN redirect ON page_is_redirect = 1 AND page_id = rd_from\n\t\t\t\t\t\tLEFT JOIN querycache ON qc_title = page_title AND qc_type = 'BrokenRedirects'\n\t\t\t\t\t\tWHERE  {$pageTitlePrefilter} {$pageNamespaceClause} (LOWER(page_title) LIKE '{$queryLower}%')\n\t\t\t\t\t\t\tAND qc_type IS NULL\n\t\t\t\t\t\tORDER BY page_id\n\t\t\t\t\t\tLIMIT " . $wgLinkSuggestLimit * 3;
     // we fetch 3 times more results to leave out redirects to the same page
     $start = microtime(true);
     $res = $db->query($sql, __METHOD__);
     while ($res->fetchRow()) {
     }
     return microtime(true) - $start;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:Query_B.class.php

示例10: execute

 function execute($par)
 {
     global $wgOut, $wgCityId, $wgSuppressWikiHeader, $wgSuppressPageHeader, $wgShowMyToolsOnly, $wgExtensionsPath, $wgBlankImgUrl, $wgJsMimeType, $wgTitle, $wgUser, $wgRequest;
     wfProfileIn(__METHOD__);
     // redirect to www.wikia.com
     if ($wgCityId == 177) {
         $destServer = WikiFactory::getVarValueByName('wgServer', $this->destCityId);
         $destArticlePath = WikiFactory::getVarValueByName('wgArticlePath', $this->destCityId);
         $wgOut->redirect($destServer . str_replace('$1', 'Special:LandingPage', $destArticlePath));
         return;
     }
     $this->setHeaders();
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/LandingPage/css/LandingPage.scss'));
     // hide wiki and page header
     $wgSuppressWikiHeader = true;
     $wgSuppressPageHeader = true;
     // only shown "My Tools" on floating toolbar
     $wgShowMyToolsOnly = true;
     // parse language links (RT #71622)
     $languageLinks = array();
     $parsedMsg = wfStringToArray(wfMsg('landingpage-language-links'), '*', 10);
     foreach ($parsedMsg as $item) {
         if ($item != '') {
             list($text, $lang) = explode('|', $item);
             $languageLinks[] = array('text' => $text, 'href' => $wgTitle->getLocalUrl("uselang={$lang}"));
         }
     }
     // fetching the landingpage sites
     $landingPageLinks = CorporatePageHelper::parseMsgImg('landingpage-sites', false, false);
     // render HTML
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $template->set_vars(array('imagesPath' => $wgExtensionsPath . '/wikia/LandingPage/images/', 'languageLinks' => $languageLinks, 'wgBlankImgUrl' => $wgBlankImgUrl, 'wgTitle' => $wgTitle, 'landingPageLinks' => $landingPageLinks, 'landingPageSearch' => F::app()->getView("SearchController", "Index", array("placeholder" => "Search Wikia", "fulltext" => "0", "wgBlankImgUrl" => $wgBlankImgUrl, "wgTitle" => $wgTitle))));
     $wgOut->addHTML($template->render('main'));
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:35,代码来源:SpecialLandingPage.class.php

示例11: getRtpCountries

 public static function getRtpCountries()
 {
     static $countries;
     if ($countries) {
         return $countries;
     }
     return $countries = WikiFactory::getVarValueByName(self::RTP_COUNTRIES, WikiFactory::COMMUNITY_CENTRAL);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:8,代码来源:AnalyticsProviderRubiconRTP.php

示例12: execute

 function execute($params = null)
 {
     global $IP, $wgWikiaLocalSettingsPath;
     /*  go with each supplied wiki and delete the supplied article
     			load all configs for particular wikis before doing so
     			(from wikifactory, not by _obsolete_ maintenance scripts
     			and from LocalSettings as worked on fps)
     		 */
     $this->mTaskID = $params->task_id;
     $oUser = User::newFromId($params->task_user_id);
     if ($oUser instanceof User) {
         $oUser->load();
         $this->mUser = $oUser->getName();
     } else {
         $this->log("Invalid user - id: " . $params->task_user_id);
         return true;
     }
     $data = unserialize($params->task_arguments);
     foreach ($data['page_list'] as $imageData) {
         $retval = "";
         list($wikiId, $imageId) = $imageData;
         $dbname = WikiFactory::getWikiByID($wikiId);
         if (!$dbname) {
             continue;
         }
         $title = GlobalTitle::newFromId($imageId, $wikiId);
         if (!is_object($title)) {
             $this->log('Apparently the article does not exist anymore');
             continue;
         }
         $city_url = WikiFactory::getVarValueByName("wgServer", $wikiId);
         if (empty($city_url)) {
             continue;
         }
         $city_path = WikiFactory::getVarValueByName("wgScript", $wikiId);
         $city_lang = WikiFactory::getVarValueByName("wgLanguageCode", $wikiId);
         $reason = wfMsgExt('imagereview-reason', array('language' => $city_lang));
         $sCommand = "perl /usr/wikia/backend/bin/run_maintenance --id={$wikiId} --script=wikia/deleteOn.php ";
         $sCommand .= "-- ";
         $sCommand .= "-u " . escapeshellarg($this->mUser) . " ";
         $sCommand .= "-t " . escapeshellarg($title->getPrefixedText()) . " ";
         if ($reason) {
             $sCommand .= "-r " . escapeshellarg($reason) . " ";
         }
         $actual_title = wfShellExec($sCommand, $retval);
         if ($retval) {
             $this->addLog('Article deleting error! (' . $city_url . '). Error code returned: ' . $retval . ' Error was: ' . $actual_title);
         } else {
             $this->addLog('Removed: <a href="' . $city_url . $city_path . '?title=' . wfEscapeWikiText($actual_title) . '">' . $city_url . $city_path . '?title=' . $actual_title . '</a>');
         }
         $this->flagUser($imageId, $wikiId);
         $this->flagWiki($wikiId);
     }
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:55,代码来源:ImageReviewTask.php

示例13: wfAdEngineSetupJSVars

function wfAdEngineSetupJSVars(array &$vars)
{
    wfProfileIn(__METHOD__);
    global $wgRequest, $wgNoExternals, $wgEnableAdsInContent, $wgEnableOpenXSPC, $wgAdDriverCookieLifetime, $wgHighValueCountries, $wgDartCustomKeyValues, $wgUser, $wgEnableWikiAnswers, $wgAdDriverUseCookie, $wgAdDriverUseExpiryStorage, $wgEnableAdMeldAPIClient, $wgEnableAdMeldAPIClientPixels, $wgLoadAdDriverOnLiftiumInit;
    $wgNoExternals = $wgRequest->getBool('noexternals', $wgNoExternals);
    if (!empty($wgNoExternals)) {
        $vars["wgNoExternals"] = $wgNoExternals;
    }
    if (!empty($wgEnableAdsInContent)) {
        $vars["wgEnableAdsInContent"] = $wgEnableAdsInContent;
    }
    if (!empty($wgEnableAdMeldAPIClient)) {
        $vars["wgEnableAdMeldAPIClient"] = $wgEnableAdMeldAPIClient;
    }
    if (!empty($wgEnableAdMeldAPIClientPixels)) {
        $vars["wgEnableAdMeldAPIClientPixels"] = $wgEnableAdMeldAPIClientPixels;
    }
    // OpenX SPC (init in AdProviderOpenX.js)
    if (!empty($wgEnableOpenXSPC)) {
        $vars["wgEnableOpenXSPC"] = $wgEnableOpenXSPC;
    }
    // AdDriver
    $vars['wgAdDriverCookieLifetime'] = $wgAdDriverCookieLifetime;
    $highValueCountries = WikiFactory::getVarValueByName('wgHighValueCountries', 177);
    // community central
    if (empty($highValueCountries)) {
        $highValueCountries = $wgHighValueCountries;
    }
    $vars['wgHighValueCountries'] = $highValueCountries;
    if (!empty($wgAdDriverUseExpiryStorage)) {
        $vars["wgAdDriverUseExpiryStorage"] = $wgAdDriverUseExpiryStorage;
    }
    if (!empty($wgAdDriverUseCookie)) {
        $vars["wgAdDriverUseCookie"] = $wgAdDriverUseCookie;
    }
    if (!empty($wgLoadAdDriverOnLiftiumInit)) {
        $vars['wgLoadAdDriverOnLiftiumInit'] = $wgLoadAdDriverOnLiftiumInit;
    }
    if ($wgUser->getOption('showAds')) {
        $vars['wgUserShowAds'] = true;
    }
    // Answers sites
    if (!empty($wgEnableWikiAnswers)) {
        $vars['wgEnableWikiAnswers'] = $wgEnableWikiAnswers;
    }
    /*
    // Krux
    if (!empty($wgEnableKruxTargeting) && empty($wgNoExternals)) {
    	$vars['wgEnableKruxTargeting'] = $wgEnableKruxTargeting;
    	$vars['wgKruxCategoryId'] = WikiFactoryHub::getInstance()->getKruxId($cat['id']);
    }
    */
    wfProfileOut(__METHOD__);
    return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:55,代码来源:AdEngine.php

示例14: getHostByDbName

 /**
  * Get domain for a wiki using given database name
  *
  * @param string database name
  * @return string HTTP domain
  */
 private static function getHostByDbName($dbname)
 {
     global $wgDevelEnvironment, $wgDevelEnvironmentName;
     if (!empty($wgDevelEnvironment)) {
         $hostName = "http://{$dbname}.{$wgDevelEnvironmentName}.wikia-dev.com";
     } else {
         $cityId = WikiFactory::DBtoID($dbname);
         $hostName = WikiFactory::getVarValueByName('wgServer', $cityId);
     }
     return rtrim($hostName, '/');
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:17,代码来源:ApiService.class.php

示例15: getFiltered

 public function getFiltered()
 {
     $filtered = $this->filter->getFiltered();
     foreach ($filtered as $key => $wikiData) {
         $wikiId = (int) $wikiData['id'];
         if (WikiFactory::getVarValueByName('wgIsPrivateWiki', $wikiId)) {
             unset($filtered[$key]);
         }
     }
     return $filtered;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:11,代码来源:UserWikisFilterPrivateDecorator.class.php


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