本文整理汇总了PHP中WikiFactory::getVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::getVariables方法的具体用法?PHP WikiFactory::getVariables怎么用?PHP WikiFactory::getVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::getVariables方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($params)
{
global $wgOut, $wgUser, $wgRequest;
$wgOut->setPageTitle('WikiFactory Reporter');
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->setArticleRelated(false);
if (!$wgUser->isAllowed('wikifactory')) {
$this->displayRestrictionError();
return;
}
$this->varid = $wgRequest->getInt('varid');
$this->disable_limit = $wgRequest->getBool('nolimit');
/***********************************************/
$vars = WikiFactory::getVariables("cv_name", 0, 0);
$select = new XmlSelect('varid', false, $this->varid);
if (!empty($this->varid)) {
//the cast is because the Xml select uses === to detect the default
$select->setDefault((string) $this->varid);
//change the name, using the var name
$variable = WikiFactory::getVarById($this->varid, 0);
$wgOut->setPageTitle('WikiFactory Reporter: ' . $variable->cv_name);
}
foreach ($vars as $variable) {
$select->addOption("{$variable->cv_name} ({$variable->cv_id})", $variable->cv_id);
}
$action = self::getTitle()->getLocalURL();
$wgOut->addHTML("<form action='{$action}' method='get'>\n");
$wgOut->addHTML($select->getHTML());
$wgOut->addHTML("<input type='submit'>\n");
$wgOut->addHTML("</form>\n");
/***********************************************/
if (!empty($this->varid)) {
$wgOut->addHTML($this->getCustomSettings());
}
}
示例2: axWFactoryFilterVariables
/**
* axWFactoryFilterVariables
*
* Ajax call, return filtered group od variables
*
* @access public
* @author eloy@wikia
*
* @return string: json string with array of variables
*/
function axWFactoryFilterVariables()
{
global $wgRequest;
$defined = wfStrToBool($wgRequest->getVal("defined", "false"));
$editable = wfStrToBool($wgRequest->getVal("editable", "false"));
$wiki_id = $wgRequest->getVal("wiki", 0);
$group = $wgRequest->getVal("group", 0);
$string = $wgRequest->getVal("string", false);
#--- cache it?
$Variables = WikiFactory::getVariables("cv_name", $wiki_id, $group, $defined, $editable, $string);
$selector = "";
foreach ($Variables as $Var) {
$selector .= sprintf("<option value=\"%d\">%s</option>\n", $Var->cv_id, $Var->cv_name);
}
return json_encode(array("selector" => $selector));
}
示例3: array
/****************************************************/
$vars['L']['city'] = $wiki->city_id;
$vars['L']['*'] = WikiFactory::getVariables("cv_id", $vars['L']['city'], 0, true);
if ($to && $to == $wiki->city_id) {
$to = null;
print Wikia::errorbox("cant compare to self");
}
#do we still have a R side?
if ($to) {
/****************************************************/
/*
get right stuff
*/
/****************************************************/
$vars['R']['city'] = $to;
$vars['R']['*'] = WikiFactory::getVariables("cv_id", $vars['R']['city'], 0, true);
}
$combined = array();
foreach ($vars as $side => $data) {
foreach ($data['*'] as $item) {
$combined[$item->cv_id]['*'] = $item->cv_name;
$var = WikiFactory::getVarById($item->cv_id, $data['city']);
$combined[$item->cv_id]['type'] = $var->cv_variable_type;
$combined[$item->cv_id]['_'] = true;
$val = unserialize($var->cv_value);
switch ($var->cv_variable_type) {
case "string":
/*use as is*/
break;
case "integer":
/*use as is*/
示例4: chooseVariableToChange
/**
* Quick form for choosing which variable to change.
*
* @author Sean Colombo
* @access private
*
* @param varOverrides array - associative array of values to put into the template. These are assumed
* to have been loaded as a form re-initialization and are given precedence
* over the defaults.
*
* @return HTML to be rendered.
*/
private function chooseVariableToChange($varOverrides = array())
{
$oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
$vars = array("hub" => WikiFactoryHub::getInstance(), "wiki" => $this->mWiki, "title" => $this->mTitle, "groups" => WikiFactory::getGroups(), "cluster" => WikiFactory::getVarValueByName("wgDBcluster", $this->mWiki->city_id), "domains" => WikiFactory::getDomains($this->mWiki->city_id), "statuses" => $this->mStatuses, "variables" => WikiFactory::getVariables(), "variableName" => $this->mVariableName);
$vars = array_merge($vars, $varOverrides);
$oTmpl->set_vars($vars);
return $oTmpl->render("form-variables");
}