本文整理汇总了PHP中LogPage::validTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP LogPage::validTypes方法的具体用法?PHP LogPage::validTypes怎么用?PHP LogPage::validTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogPage
的用法示例。
在下文中一共展示了LogPage::validTypes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTypeSelector
/**
* Returns log page selector.
* @return XmlSelect
* @since 1.19
*/
public function getTypeSelector()
{
$typesByName = array();
// Temporary array
// First pass to load the log names
foreach (LogPage::validTypes() as $type) {
$page = new LogPage($type);
$restriction = $page->getRestriction();
if ($this->getUser()->isAllowed($restriction)) {
$typesByName[$type] = $page->getName()->text();
}
}
// Second pass to sort by name
asort($typesByName);
// Always put "All public logs" on top
$public = $typesByName[''];
unset($typesByName['']);
$typesByName = array('' => $public) + $typesByName;
$select = new XmlSelect('type');
foreach ($typesByName as $type => $name) {
$select->addOption($name, $type);
}
return $select;
}
示例2: isLogType
/**
* Is $type a valid log type
*
* @param $type String: log type to check
* @return Boolean
*/
public static function isLogType($type)
{
return in_array($type, LogPage::validTypes());
}
示例3: getTypeMenu
/**
* @param $queryTypes Array
* @return String: Formatted HTML
*/
private function getTypeMenu($queryTypes)
{
global $wgLogRestrictions, $wgUser;
$html = "<select name='type'>\n";
$validTypes = LogPage::validTypes();
$typesByName = array();
// Temporary array
// First pass to load the log names
foreach ($validTypes as $type) {
$text = LogPage::logName($type);
$typesByName[$type] = $text;
}
// Second pass to sort by name
asort($typesByName);
// Note the query type
$queryType = count($queryTypes) == 1 ? $queryTypes[0] : '';
// Always put "All public logs" on top
if (isset($typesByName[''])) {
$all = $typesByName[''];
unset($typesByName['']);
$typesByName = array('' => $all) + $typesByName;
}
// Third pass generates sorted XHTML content
foreach ($typesByName as $type => $text) {
$selected = $type == $queryType;
// Restricted types
if (isset($wgLogRestrictions[$type])) {
if ($wgUser->isAllowed($wgLogRestrictions[$type])) {
$html .= Xml::option($text, $type, $selected) . "\n";
}
} else {
$html .= Xml::option($text, $type, $selected) . "\n";
}
}
$html .= '</select>';
return $html;
}
示例4: getTypeMenu
/**
* @return string Formatted HTML
* @private
*/
function getTypeMenu()
{
$out = "<select name='type'>\n";
$validTypes = LogPage::validTypes();
$m = array();
// Temporary array
// First pass to load the log names
foreach ($validTypes as $type) {
$text = LogPage::logName($type);
$m[$text] = $type;
}
// Second pass to sort by name
ksort($m);
// Third pass generates sorted XHTML content
foreach ($m as $text => $type) {
$selected = $type == $this->reader->queryType();
$out .= Xml::option($text, $type, $selected) . "\n";
}
$out .= '</select>';
return $out;
}
示例5: foreach
<?php
/**
* @todo document
* @addtogroup Maintenance
*/
/** */
require_once "commandLine.inc";
require_once "importLogs.inc";
#print $text;
#exit();
foreach (LogPage::validTypes() as $type) {
if ($type == '') {
continue;
}
$page = LogPage::logName($type);
$log = new Article(Title::makeTitleSafe(NS_PROJECT, $page));
$text = $log->fetchContent();
$importer = new LogImporter($type);
$importer->dummy = true;
$importer->importText($text);
}
示例6: getTypeMenu
/**
* @return string Formatted HTML
* @private
*/
function getTypeMenu()
{
$out = "<select name='type'>\n";
foreach (LogPage::validTypes() as $type) {
$text = htmlspecialchars(LogPage::logName($type));
$selected = $type == $this->reader->queryType() ? ' selected="selected"' : '';
$out .= "<option value=\"{$type}\"{$selected}>{$text}</option>\n";
}
$out .= "</select>\n";
return $out;
}
示例7: getTypeMenu
/**
* @param $queryType String
* @return String: Formatted HTML
*/
private function getTypeMenu($queryType)
{
global $wgLogRestrictions, $wgUser;
$html = "<select name='type'>\n";
$validTypes = LogPage::validTypes();
$typesByName = array();
// Temporary array
// First pass to load the log names
foreach ($validTypes as $type) {
$text = LogPage::logName($type);
$typesByName[$text] = $type;
}
// Second pass to sort by name
ksort($typesByName);
// Third pass generates sorted XHTML content
foreach ($typesByName as $text => $type) {
$selected = $type == $queryType;
// Restricted types
if (isset($wgLogRestrictions[$type])) {
if ($wgUser->isAllowed($wgLogRestrictions[$type])) {
$html .= Xml::option($text, $type, $selected) . "\n";
}
} else {
$html .= Xml::option($text, $type, $selected) . "\n";
}
}
$html .= '</select>';
return $html;
}