本文整理汇总了PHP中WikiFactory类的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory类的具体用法?PHP WikiFactory怎么用?PHP WikiFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WikiFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Called from maintenance script only. Send Digest emails for any founders with that preference enabled
*
* @param array $events Events is empty for this type
*/
public function process(array $events)
{
global $wgTitle;
wfProfileIn(__METHOD__);
$founderEmailObj = FounderEmails::getInstance();
$wgTitle = Title::newMainPage();
// Get list of founders with digest mode turned on
$cityList = $founderEmailObj->getFoundersWithPreference('founderemails-views-digest');
$wikiService = new WikiService();
// Gather daily page view stats for each wiki requesting views digest
foreach ($cityList as $cityID) {
$user_ids = $wikiService->getWikiAdminIds($cityID);
$foundingWiki = WikiFactory::getWikiById($cityID);
$page_url = GlobalTitle::newFromText('Createpage', NS_SPECIAL, $cityID)->getFullUrl(array('modal' => 'AddPage'));
$emailParams = array('$WIKINAME' => $foundingWiki->city_title, '$WIKIURL' => $foundingWiki->city_url, '$PAGEURL' => $page_url, '$UNIQUEVIEWS' => $founderEmailObj->getPageViews($cityID));
foreach ($user_ids as $user_id) {
$user = User::newFromId($user_id);
// skip if not enable
if (!$this->enabled($user, $cityID)) {
continue;
}
self::addParamsUser($cityID, $user->getName(), $emailParams);
$langCode = $user->getGlobalPreference('language');
$links = array('$WIKINAME' => $emailParams['$WIKIURL']);
$mailSubject = strtr(wfMsgExt('founderemails-email-views-digest-subject', array('content')), $emailParams);
$mailBody = strtr(wfMsgExt('founderemails-email-views-digest-body', array('content', 'parsemag'), $emailParams['$UNIQUEVIEWS']), $emailParams);
$mailBodyHTML = F::app()->renderView('FounderEmails', 'GeneralUpdate', array_merge($emailParams, array('language' => 'en', 'type' => 'views-digest')));
$mailBodyHTML = strtr($mailBodyHTML, FounderEmails::addLink($emailParams, $links));
$mailCategory = FounderEmailsEvent::CATEGORY_VIEWS_DIGEST . (!empty($langCode) && $langCode == 'en' ? 'EN' : 'INT');
$founderEmailObj->notifyFounder($user, $this, $mailSubject, $mailBody, $mailBodyHTML, $cityID, $mailCategory);
}
}
wfProfileOut(__METHOD__);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:39,代码来源:FounderEmailsViewsDigestEvent.class.php
示例2: 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
示例3: getCityId
public function getCityId()
{
if (empty($this->cityId) and !empty($this->dbName)) {
$this->cityId = WikiFactory::DBtoID($this->dbName);
}
return $this->cityId;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:PromoImage.class.php
示例4: execute
/**
* execute -- main entry point to api method
*
* use secret hash for checking if api is called by proper engine
*
* @access public
*
* @return api result
*/
public function execute()
{
global $wgTheSchwartzSecretToken, $wgCityId, $wgServer, $wgExtensionMessagesFiles;
$params = $this->extractRequestParams();
$status = 0;
if (isset($params["token"]) && $params["token"] === $wgTheSchwartzSecretToken) {
/**
* get creator from param
*/
$founder = User::newFromId($params["user_id"]);
$founder->load();
/**
* get city_founding_user from city_list
*/
if (!$founder) {
$wiki = WikiFactory::getWikiByID($wgCityId);
$founder = User::newFromId($wiki->city_founding_user);
}
Wikia::log(__METHOD__, "user", $founder->getName());
if ($founder && $founder->isEmailConfirmed()) {
if ($founder->sendMail(wfMsg("autocreatewiki-reminder-subject"), wfMsg("autocreatewiki-reminder-body", array($founder->getName(), $wgServer)), null, null, "AutoCreateWikiReminder", wfMsg("autocreatewiki-reminder-body-HTML", array($founder->getName(), $wgServer)))) {
$status = 1;
}
}
} else {
$this->dieUsageMsg(array("sessionfailure"));
}
$result = array("status" => $status);
$this->getResult()->setIndexedTagName($result, 'status');
$this->getResult()->addValue(null, $this->getModuleName(), $result);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:WikiaApiCreatorReminderEmail.php
示例5: WidgetFounderBadge
function WidgetFounderBadge($id, $params)
{
$output = "";
wfProfileIn(__METHOD__);
global $wgMemc;
$key = wfMemcKey("WidgetFounderBadge", "user");
$user = $wgMemc->get($key);
if (is_null($user)) {
global $wgCityId;
$user = WikiFactory::getWikiById($wgCityId)->city_founding_user;
$wgMemc->set($key, $user, 3600);
}
if (0 == $user) {
return wfMsgForContent("widget-founderbadge-notavailable");
}
$key = wfMemcKey("WidgetFounderBadge", "edits");
$edits = $wgMemc->get($key);
if (empty($edits)) {
$edits = AttributionCache::getInstance()->getUserEditPoints($user);
$wgMemc->set($key, $edits, 300);
}
$author = array("user_id" => $user, "user_name" => User::newFromId($user)->getName(), "edits" => $edits);
$output = Answer::getUserBadge($author);
wfProfileOut(__METHOD__);
return $output;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:26,代码来源:WidgetFounderBadge.php
示例6: execute
public function execute($subpage)
{
global $wgOut, $wgRequest, $wgUser, $wgCacheEpoch, $wgCityId;
wfProfileIn(__METHOD__);
$this->setHeaders();
$this->mTitle = SpecialPage::getTitleFor('cacheepoch');
if ($this->isRestricted() && !$this->userCanExecute($wgUser)) {
$this->displayRestrictionError();
wfProfileOut(__METHOD__);
return;
}
//no WikiFactory (internal wikis)
if (empty($wgCityId)) {
$wgOut->addHTML(wfMsg('cacheepoch-no-wf'));
wfProfileOut(__METHOD__);
return;
}
if ($wgRequest->wasPosted()) {
$wgCacheEpoch = wfTimestampNow();
$status = WikiFactory::setVarByName('wgCacheEpoch', $wgCityId, $wgCacheEpoch, wfMsg('cacheepoch-wf-reason'));
if ($status) {
$wgOut->addHTML('<h2>' . wfMsg('cacheepoch-updated', $wgCacheEpoch) . '</h2>');
} else {
$wgOut->addHTML('<h2>' . wfMsg('cacheepoch-not-updated') . '</h2>');
}
} else {
$wgOut->addHTML('<h2>' . wfMsg('cacheepoch-header') . '</h2>');
}
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->mTitle->getFullURL(), 'method' => 'post')));
$wgOut->addHTML(wfMsg('cacheepoch-value', $wgCacheEpoch) . '<br>');
$wgOut->addHTML(Xml::submitButton(wfMsg('cacheepoch-submit')));
$wgOut->addHTML(Xml::closeElement('form'));
wfProfileOut(__METHOD__);
}
开发者ID:yusufchang,项目名称:app,代码行数:34,代码来源:SpecialCacheEpoch.php
示例7: __construct
public function __construct($id = null)
{
parent::__construct();
if (is_null($id)) {
$id = $this->wg->CityId;
}
$this->id = $id;
if ($this->wg->CityId == $id) {
$this->db = wfGetDB(DB_SLAVE);
$this->dbname = $this->wg->DBname;
} else {
// find db name
$dbname = WikiFactory::IDtoDB($this->id);
if (empty($dbname)) {
throw new Exception("Could not find wiki with ID {$this->id}");
}
// open db connection (and check if db really exists)
$db = wfGetDB(DB_SLAVE, array(), $dbname);
if (!is_object($db)) {
throw new Exception("Could not connect to wiki database {$dbname}");
}
$this->db = $db;
$this->dbname = $dbname;
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:WikiDataSource.php
示例8: 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
示例9: 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
示例10: 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
示例11: countNotExternal
function countNotExternal()
{
$dbr = wfGetDB(DB_SLAVE, "dpl");
/**
* get active databases from city_list
*/
$databases = array();
$res = $dbr->select(WikiFactory::table("city_list"), array("city_dbname", "city_id"), array("city_public" => 1), __FUNCTION__);
while ($row = $dbr->fetchObject($res)) {
$databases[$row->city_id] = $row->city_dbname;
}
$dbr->freeResult($res);
foreach ($databases as $city_id => $database) {
$sql = "\n\t\t\tSELECT count(*) as count\n\t\t\tFROM revision r1 FORCE INDEX (PRIMARY), text t2\n\t\t\tWHERE old_id = rev_text_id\n\t\t\tAND old_flags NOT LIKE '%external%'\n\t\t";
$dbr->selectDB($database);
$dbr->begin();
$res = $dbr->query($sql, __FUNCTION__);
$row = $dbr->fetchObject($res);
if (!empty($row->count)) {
printf("Not External rows in %5d %30s = %8d\n", $city_id, $database, $row->count);
}
$dbr->freeResult($res);
$dbr->commit();
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:countNotExternal.php
示例12: initializeBlacklist
/**
* Look for videos that are blacklisted in the wgVideosModuleBlackList variable on community central
*/
protected function initializeBlacklist()
{
$communityBlacklist = \WikiFactory::getVarByName("wgVideosModuleBlackList", \WikiFactory::COMMUNITY_CENTRAL);
if (is_object($communityBlacklist) && !empty($communityBlacklist->cv_value)) {
$this->blacklist = unserialize($communityBlacklist->cv_value);
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:VideosModuleBase.class.php
示例13: 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
示例14: markWikiAsClosed
/**
* Mark given wiki as queued for removal
*
* @param $wikiId integer city ID
* @return bool
*/
private function markWikiAsClosed($wikiId)
{
WikiFactory::setFlags($wikiId, WikiFactory::FLAG_FREE_WIKI_URL | WikiFactory::FLAG_DELETE_DB_IMAGES);
$res = WikiFactory::setPublicStatus(WikiFactory::CLOSE_ACTION, $wikiId, self::REASON);
WikiFactory::clearCache($wikiId);
return $res !== false;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:removeQAWikis.php
示例15: 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
示例16: 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
示例17: execute
public function execute()
{
$this->test = $this->hasOption('test') ? true : false;
$this->verbose = $this->hasOption('verbose') ? true : false;
$this->clear = $this->hasOption('clear') ? true : false;
$this->refresh = $this->hasOption('refresh') ? true : false;
if ($this->test) {
echo "== TEST MODE ==\n";
}
$this->debug("(debugging output enabled)\n");
$startTime = time();
// Clear existing suggestions if we are forcing a rebuild
if ($this->clear) {
$this->clearSuggestions();
}
$this->processVideoList();
$delta = $this->formatDuration(time() - $startTime);
$stats = $this->usageStats();
$wgDBName = WikiFactory::IDtoDB($_ENV['SERVER_ID']);
echo "[{$wgDBName}] Finished in {$delta}.\n";
echo "[{$wgDBName}] Usage Stats: Total videos before swapping videos=" . ($stats['totalVids'] + $stats['swapTypes'][2] + $stats['swapTypes'][3]) . ", ";
echo "Total videos=" . $stats['totalVids'] . " (Videos with suggestions=" . $stats['vidsWithSuggestions'] . "), ";
echo "Total suggestions=" . $stats['numSuggestions'] . ", Avg per video=" . sprintf("%.1f", $stats['avgSuggestions']) . ", ";
echo "Total kept videos=" . $stats['swapTypes'][1] . ", Total swapped videos=" . ($stats['swapTypes'][2] + $stats['swapTypes'][3]) . " (Exact title=" . $stats['swapTypes'][3] . ")\n";
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:lvsUpdateSuggestions.php
示例18: getWikiDataArray
/**
* Returns array with fields values from city_list for provided city_id that are required for ExactTarget updates
* @param int $iCityId
* @return array
*/
public function getWikiDataArray($iCityId)
{
/* Get wikidata from master */
$oWiki = \WikiFactory::getWikiById($iCityId, true);
$aWikiData = ['city_path' => $oWiki->city_path, 'city_dbname' => $oWiki->city_dbname, 'city_sitename' => $oWiki->city_sitename, 'city_url' => $oWiki->city_url, 'city_created' => $oWiki->city_created, 'city_founding_user' => $oWiki->city_founding_user, 'city_adult' => $oWiki->city_adult, 'city_public' => $oWiki->city_public, 'city_title' => $oWiki->city_title, 'city_founding_email' => $oWiki->city_founding_email, 'city_lang' => $oWiki->city_lang, 'city_special' => $oWiki->city_special, 'city_umbrella' => $oWiki->city_umbrella, 'city_ip' => $oWiki->city_ip, 'city_google_analytics' => $oWiki->city_google_analytics, 'city_google_search' => $oWiki->city_google_search, 'city_google_maps' => $oWiki->city_google_maps, 'city_indexed_rev' => $oWiki->city_indexed_rev, 'city_lastdump_timestamp' => $oWiki->city_lastdump_timestamp, 'city_factory_timestamp' => $oWiki->city_factory_timestamp, 'city_useshared' => $oWiki->city_useshared, 'ad_cat' => $oWiki->ad_cat, 'city_flags' => $oWiki->city_flags, 'city_cluster' => $oWiki->city_cluster, 'city_last_timestamp' => $oWiki->city_last_timestamp, 'city_founding_ip' => $oWiki->city_founding_ip, 'city_vertical' => $oWiki->city_vertical];
return $aWikiData;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:ExactTargetWikiTaskHelper.php
示例19: execute
function execute()
{
global $wgOut, $wgUser, $wgRequest, $wgTitle;
$gVar = $wgRequest->getText('var');
$gVal = $wgRequest->getVal('val', 'true');
$gLikeVal = $wgRequest->getVal('likeValue', 'true');
$gTypeVal = $wgRequest->getVal('searchType', 'bool');
$wgOut->SetPageTitle(wfMsg('whereisextension'));
$wgOut->setRobotpolicy('noindex,nofollow');
if (!$wgUser->isAllowed('WhereIsExtension')) {
$this->displayRestrictionError();
return;
}
$this->values = array(0 => array('true', true, '='), 1 => array('false', false, '='), 2 => array('not empty', '', '!='));
$tagName = $wgRequest->getVal('wikiSelectTagName', null);
$tagWikis = $wgRequest->getArray('wikiSelected');
$tagResultInfo = '';
if ($wgRequest->wasPosted() && !empty($tagName) && count($tagWikis)) {
$tagResultInfo = $this->tagSelectedWikis($tagName, $tagWikis);
}
$formData['vars'] = $this->getListOfVars($gVar == '');
$formData['vals'] = $this->values;
$formData['selectedVal'] = $gVal;
$formData['likeValue'] = $gLikeVal;
$formData['searchType'] = $gTypeVal;
$formData['selectedGroup'] = $gVar == '' ? 27 : '';
//default group: extensions (or all groups when looking for variable, rt#16953)
$formData['groups'] = WikiFactory::getGroups();
$formData['actionURL'] = $wgTitle->getFullURL();
// by default, we don't need a paginator
$sPaginator = '';
if (!empty($gVar)) {
$formData['selectedVar'] = $gVar;
// assume an empty result
$formData['count'] = 0;
$formData['wikis'] = array();
if (isset($this->values[$gVal][1]) && isset($this->values[$gVal][2])) {
// check how many wikis meet the conditions
$formData['count'] = WikiFactory::getCountOfWikisWithVar($gVar, $gTypeVal, $this->values[$gVal][2], $this->values[$gVal][1], $gLikeVal);
// if there are any, get the list and create a Paginator
if (0 < $formData['count']) {
// determine the offset (from the requested page)
$iPage = $wgRequest->getVal('page', 1);
$iOffset = ($iPage - 1) * self::ITEMS_PER_PAGE;
// the list
$formData['wikis'] = WikiFactory::getListOfWikisWithVar($gVar, $gTypeVal, $this->values[$gVal][2], $this->values[$gVal][1], $gLikeVal, $iOffset, self::ITEMS_PER_PAGE);
// the Paginator, if we need more than one page
if (self::ITEMS_PER_PAGE < $formData['count']) {
$oPaginator = Paginator::newFromArray(array_fill(0, $formData['count'], ''), self::ITEMS_PER_PAGE, 5);
$oPaginator->setActivePage($iPage - 1);
$sPager = $oPaginator->getBarHTML(sprintf('%s?var=%s&val=%s&likeValue=%s&searchType=%s&page=%%s', $wgTitle->getFullURL(), $gVar, $gVal, $gLikeVal, $gTypeVal));
}
}
}
}
$oTmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
$oTmpl->set_vars(array('formData' => $formData, 'tagResultInfo' => $tagResultInfo, 'sPager' => $sPager));
$wgOut->addHTML($oTmpl->render('list'));
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:59,代码来源:SpecialWhereIsExtension_body.php
示例20: 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
注:本文中的WikiFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论