本文整理汇总了PHP中WikiFactory::getCityIDsFromVarValue方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::getCityIDsFromVarValue方法的具体用法?PHP WikiFactory::getCityIDsFromVarValue怎么用?PHP WikiFactory::getCityIDsFromVarValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::getCityIDsFromVarValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: getWikisList
public function getWikisList()
{
$this->wf->profileIn(__METHOD__);
$cacheKey = $this->getGlobalCacheKey(self::MEMCACHE_GLOBAL_KEY_TOKEN);
$ret = $this->loadFromCache($cacheKey);
if (empty($ret)) {
$ret = array();
$wikiFactoryRecommendVar = WikiFactory::getVarByName(self::WF_SWITCH_NAME, null);
if (!empty($wikiFactoryRecommendVar)) {
$gamesIds = WikiFactory::getCityIDsFromVarValue($wikiFactoryRecommendVar->cv_variable_id, true, '=');
foreach ($gamesIds as $wikiId) {
$game = $this->getSettings($wikiId);
if (!empty($game)) {
$wikiName = WikiFactory::getVarValueByName('wgSitename', $wikiId);
$wikiThemeSettings = WikiFactory::getVarValueByName('wgOasisThemeSettings', $wikiId);
$game->name = !empty($wikiThemeSettings['wordmark-text']) ? $wikiThemeSettings['wordmark-text'] : $wikiName;
$game->id = WikiFactory::IDtoDB($wikiId);
$game->domain = str_replace('http://', '', WikiFactory::getVarValueByName('wgServer', $wikiId));
$ret[$game->id] = $game;
}
}
} else {
$this->wf->profileOut(__METHOD__);
throw new WikiaException('WikiFactory variable \'' . self::WF_SWITCH_NAME . '\' not found');
}
$this->storeInCache($cacheKey, $ret);
}
$this->app->wf->profileOut(__METHOD__);
return $ret;
}
示例3: wgUploadDirectoryExists
/**
* Check if the given upload directory name is available for use.
*
* @access public
* @author Michał Roszka <michal@wikia-inc.com>
*
* @param $sDirectoryName the path to check
*/
public static function wgUploadDirectoryExists($sDirectoryName)
{
wfProfileIn(__METHOD__);
$iVarId = WikiFactory::getVarIdByName('wgUploadDirectory');
// Crash immediately if $iVarId is not a positive integer!
\Wikia\Util\Assert::true($iVarId);
$aCityIds = WikiFactory::getCityIDsFromVarValue($iVarId, $sDirectoryName, '=');
wfProfileOut(__METHOD__);
return !empty($aCityIds);
}
示例4: axWFactorySaveVariable
/**
* axWFactorySaveVariable
*
* ajax method, save variable from form
*
* @author Krzysztof Krzyżaniak (eloy) <eloy@wikia-inc.com>
* @access public
*
* @return string encoded in JSON format
*/
function axWFactorySaveVariable()
{
global $wgUser, $wgRequest;
$error = 0;
$return = "";
if (!$wgUser->isAllowed('wikifactory')) {
$error++;
$return = Wikia::errormsg("You are not allowed to change variable value");
} else {
$cv_id = $wgRequest->getVal('varId');
$city_id = $wgRequest->getVal('cityid');
$cv_name = $wgRequest->getVal('varName');
$cv_value = $wgRequest->getVal('varValue');
$cv_variable_type = $wgRequest->getVal('varType');
$reason = $wgRequest->getVal('reason', null);
$tag_name = $wgRequest->getVal('tagName');
$tag_wiki_count = 0;
$form_id = $wgRequest->getVal("formId", null);
#--- check if variable is valid
switch ($cv_variable_type) {
case "boolean":
if ((bool) $cv_value != $cv_value) {
$error++;
$return = Wikia::errormsg("Syntax error: value is not boolean. Variable not saved.");
} else {
$return = Wikia::successmsg("Parse OK, variable saved");
$cv_value = (bool) $cv_value;
}
break;
case "integer":
if ((int) $cv_value != $cv_value) {
$error++;
$return = Wikia::errormsg("Syntax error: value is not integer. Variable not saved.");
} else {
$return = Wikia::successmsg("Parse OK, variable saved.");
$cv_value = (int) $cv_value;
}
break;
case "string":
$return = Wikia::successmsg("Parse OK, variable saved.");
break;
default:
$tEval = "\$__var_value = {$cv_value};";
/**
* catch parse errors
*/
ob_start();
if (eval($tEval) === FALSE) {
$error++;
$return = Wikia::errormsg("Syntax error, value is not valid PHP structure. Variable not saved.");
} else {
$cv_value = $__var_value;
/**
* now check if it's actually array when we want array)
*/
if (in_array($cv_variable_type, array("array", "struct", "hash"))) {
if (is_array($cv_value)) {
$return = Wikia::successmsg("Syntax OK (array), variable saved.");
} else {
$error++;
$return = Wikia::errormsg("Syntax error: value is not array. Variable not saved.");
}
} else {
$return = Wikia::successmsg("Parse OK, variable saved.");
}
}
ob_end_clean();
#--- puts parse error to /dev/null
}
if (empty($error)) {
$varInfo = WikiFactory::getVarById($cv_id, $city_id);
if ($varInfo->cv_is_unique) {
$wikis = WikiFactory::getCityIDsFromVarValue($cv_id, $cv_value, '=');
$count = count($wikis);
if ($count == 1 && $wikis[0] != $city_id || $count > 1) {
$return = Wikia::errormsg("Value of this variable need to be unique.");
$error++;
}
}
}
wfRunHooks('WikiFactoryVarSave::AfterErrorDetection', array($cv_id, $city_id, $cv_name, $cv_value, &$return, &$error));
# Save to DB, but only if no errors occurred
if (empty($error)) {
if (!WikiFactory::setVarByID($cv_id, $city_id, $cv_value, $reason)) {
$error++;
$return = Wikia::errormsg("Variable not saved because of problems with database. Try again.");
} else {
/* the one "set" that used this is now disabled, so disabling the call until needed again
$tied = WikiFactory::getTiedVariables( $cv_name );
if( $tied ) {
//.........这里部分代码省略.........