本文整理汇总了PHP中Linker::getInvalidTitleDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::getInvalidTitleDescription方法的具体用法?PHP Linker::getInvalidTitleDescription怎么用?PHP Linker::getInvalidTitleDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::getInvalidTitleDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatRow
/**
* Callback function to output a restriction
*
* @param object $row Database row
* @return string
*/
function formatRow($row)
{
wfProfileIn(__METHOD__);
static $infinity = null;
if (is_null($infinity)) {
$infinity = wfGetDB(DB_SLAVE)->getInfinity();
}
$title = Title::makeTitleSafe($row->pt_namespace, $row->pt_title);
if (!$title) {
wfProfileOut(__METHOD__);
return Html::rawElement('li', array(), Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $row->pt_namespace, $row->pt_title))) . "\n";
}
$link = Linker::link($title);
$description_items = array();
$protType = $this->msg('restriction-level-' . $row->pt_create_perm)->escaped();
$description_items[] = $protType;
$lang = $this->getLanguage();
$expiry = strlen($row->pt_expiry) ? $lang->formatExpiry($row->pt_expiry, TS_MW) : $infinity;
if ($expiry != $infinity) {
$user = $this->getUser();
$description_items[] = $this->msg('protect-expiring-local', $lang->userTimeAndDate($expiry, $user), $lang->userDate($expiry, $user), $lang->userTime($expiry, $user))->escaped();
}
wfProfileOut(__METHOD__);
// @todo i18n: This should use a comma separator instead of a hard coded comma, right?
return '<li>' . $lang->specialList($link, implode($description_items, ', ')) . "</li>\n";
}
示例2: formatResult
/**
* Make links to the page corresponding to the item,
* and the "what links here" page for it
*
* @param Skin $skin Skin to be used
* @param object $result Result row
* @return string
*/
function formatResult($skin, $result)
{
$title = Title::makeTitleSafe($result->namespace, $result->title);
if (!$title) {
return Html::element('span', ['class' => 'mw-invalidtitle'], Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
}
$link = Linker::link($title);
$wlh = $this->makeWlhLink($title, $this->msg('nlinks')->numParams($result->value)->escaped());
return $this->getLanguage()->specialList($link, $wlh);
}
示例3: formatResult
/**
* Format the result as a simple link to the page
*
* @param Skin $skin
* @param object $row Result row
* @return string
*/
public function formatResult($skin, $row)
{
global $wgContLang;
$title = Title::makeTitleSafe($row->namespace, $row->title);
if ($title instanceof Title) {
$text = $wgContLang->convert($title->getPrefixedText());
return Linker::link($title, htmlspecialchars($text));
} else {
return Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $row->namespace, $row->title));
}
}
示例4: formatResult
/**
* @param $skin Skin
* @param $result
* @return string
*/
function formatResult($skin, $result)
{
global $wgContLang;
$title = Title::makeTitleSafe($result->namespace, $result->title);
if (!$title) {
return Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
}
$link = Linker::linkKnown($title, htmlspecialchars($wgContLang->convert($title->getPrefixedText())));
$nv = $this->msg('nviews')->numParams($result->value)->escaped();
return $this->getLanguage()->specialList($link, $nv);
}
示例5: formatResult
/**
* @param $skin Skin
* @param $result
* @return string
*/
function formatResult($skin, $result)
{
global $wgContLang;
$nt = Title::makeTitleSafe(NS_CATEGORY, $result->title);
if (!$nt) {
return Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), NS_CATEGORY, $result->title));
}
$text = $wgContLang->convert($nt->getText());
$plink = Linker::link($nt, htmlspecialchars($text));
$nlinks = $this->msg('nmembers')->numParams($result->value)->escaped();
return $this->getLanguage()->specialList($plink, $nlinks);
}
示例6: formatResult
/**
* @param Skin $skin
* @param object $result Result row
* @return string
*/
function formatResult($skin, $result)
{
global $wgContLang;
$nt = Title::makeTitleSafe($result->namespace, $result->title);
if (!$nt) {
return Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
}
$text = $wgContLang->convert($nt->getPrefixedText());
$plink = Linker::linkKnown($nt, htmlspecialchars($text));
$wlink = Linker::linkKnown($nt, $this->msg('watch')->escaped(), array('class' => 'mw-watch-link'), array('action' => 'watch'));
return $this->getLanguage()->specialList($plink, $wlink);
}
示例7: formatResult
/**
* @param Skin $skin
* @param object $result Result row
* @return string
*/
function formatResult($skin, $result)
{
$title = Title::makeTitleSafe($result->namespace, $result->title);
if (!$title) {
return Html::element('span', ['class' => 'mw-invalidtitle'], Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
}
if ($this->isCached()) {
$link = Linker::link($title);
} else {
$link = Linker::linkKnown($title);
}
$count = $this->msg('ncategories')->numParams($result->value)->escaped();
return $this->getLanguage()->specialList($link, $count);
}
示例8: formatResult
/**
* @param Skin $skin
* @param object $result Database row
* @return string
*/
function formatResult($skin, $result)
{
global $wgContLang;
$nt = Title::makeTitleSafe($result->namespace, $result->title);
if (!$nt) {
return Html::element('span', ['class' => 'mw-invalidtitle'], Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
}
$text = htmlspecialchars($wgContLang->convert($nt->getPrefixedText()));
$plink = Linker::linkKnown($nt, $text);
$nl = $this->msg('nrevisions')->numParams($result->value)->escaped();
$redirect = isset($result->redirect) && $result->redirect ? ' - ' . $this->msg('isredirect')->escaped() : '';
$nlink = Linker::linkKnown($nt, $nl, [], ['action' => 'history']) . $redirect;
return $this->getLanguage()->specialList($plink, $nlink);
}
示例9: formatResult
/**
* @param Skin $skin
* @param object $result Result row
* @return string
*/
function formatResult($skin, $result)
{
$dm = $this->getLanguage()->getDirMark();
$title = Title::makeTitleSafe($result->namespace, $result->title);
if (!$title) {
return Html::element('span', ['class' => 'mw-invalidtitle'], Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
}
$hlink = Linker::linkKnown($title, $this->msg('hist')->escaped(), [], ['action' => 'history']);
$hlinkInParentheses = $this->msg('parentheses')->rawParams($hlink)->escaped();
if ($this->isCached()) {
$plink = Linker::link($title);
$exists = $title->exists();
} else {
$plink = Linker::linkKnown($title);
$exists = true;
}
$size = $this->msg('nbytes')->numParams($result->value)->escaped();
return $exists ? "{$hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]" : "<del>{$hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]</del>";
}
示例10: formatRow
/**
* Callback function to output a restriction
*
* @param object $row Database row
* @return string
*/
function formatRow($row)
{
$title = Title::makeTitleSafe($row->pt_namespace, $row->pt_title);
if (!$title) {
return Html::rawElement('li', [], Html::element('span', ['class' => 'mw-invalidtitle'], Linker::getInvalidTitleDescription($this->getContext(), $row->pt_namespace, $row->pt_title))) . "\n";
}
$link = Linker::link($title);
$description_items = [];
// Messages: restriction-level-sysop, restriction-level-autoconfirmed
$protType = $this->msg('restriction-level-' . $row->pt_create_perm)->escaped();
$description_items[] = $protType;
$lang = $this->getLanguage();
$expiry = strlen($row->pt_expiry) ? $lang->formatExpiry($row->pt_expiry, TS_MW) : 'infinity';
if ($expiry !== 'infinity') {
$user = $this->getUser();
$description_items[] = $this->msg('protect-expiring-local', $lang->userTimeAndDate($expiry, $user), $lang->userDate($expiry, $user), $lang->userTime($expiry, $user))->escaped();
}
// @todo i18n: This should use a comma separator instead of a hard coded comma, right?
return '<li>' . $lang->specialList($link, implode($description_items, ', ')) . "</li>\n";
}
示例11: formatRow
/**
* Callback function to output a restriction
* @param Title $row Protected title
* @return string Formatted "<li>" element
*/
public function formatRow($row)
{
wfProfileIn(__METHOD__);
static $infinity = null;
if (is_null($infinity)) {
$infinity = wfGetDB(DB_SLAVE)->getInfinity();
}
$title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
if (!$title) {
wfProfileOut(__METHOD__);
return Html::rawElement('li', array(), Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $row->page_namespace, $row->page_title))) . "\n";
}
$link = Linker::link($title);
$description_items = array();
$protType = $this->msg('restriction-level-' . $row->pr_level)->escaped();
$description_items[] = $protType;
if ($row->pr_cascade) {
$description_items[] = $this->msg('protect-summary-cascade')->text();
}
$stxt = '';
$lang = $this->getLanguage();
$expiry = $lang->formatExpiry($row->pr_expiry, TS_MW);
if ($expiry != $infinity) {
$user = $this->getUser();
$description_items[] = $this->msg('protect-expiring-local', $lang->userTimeAndDate($expiry, $user), $lang->userDate($expiry, $user), $lang->userTime($expiry, $user))->escaped();
}
if (!is_null($size = $row->page_len)) {
$stxt = $lang->getDirMark() . ' ' . Linker::formatRevisionSize($size);
}
# Show a link to the change protection form for allowed users otherwise
# a link to the protection log
if ($this->getUser()->isAllowed('protect')) {
$changeProtection = Linker::linkKnown($title, $this->msg('protect_change')->escaped(), array(), array('action' => 'unprotect'));
} else {
$ltitle = SpecialPage::getTitleFor('Log');
$changeProtection = Linker::linkKnown($ltitle, $this->msg('protectlogpage')->escaped(), array(), array('type' => 'protect', 'page' => $title->getPrefixedText()));
}
$changeProtection = ' ' . $this->msg('parentheses')->rawParams($changeProtection)->escaped();
wfProfileOut(__METHOD__);
return Html::rawElement('li', array(), $lang->specialList($link . $stxt, $lang->commaList($description_items), false) . $changeProtection) . "\n";
}
示例12: formatValue
/**
* @param string $field
* @param string $value
* @return string HTML
* @throws MWException
*/
function formatValue($field, $value)
{
/** @var $row object */
$row = $this->mCurrentRow;
$formatted = '';
switch ($field) {
case 'log_timestamp':
// when timestamp is null, this is a old protection row
if ($value === null) {
$formatted = Html::rawElement('span', array('class' => 'mw-protectedpages-unknown'), $this->msg('protectedpages-unknown-timestamp')->escaped());
} else {
$formatted = htmlspecialchars($this->getLanguage()->userTimeAndDate($value, $this->getUser()));
}
break;
case 'pr_page':
$title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
if (!$title) {
$formatted = Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $row->page_namespace, $row->page_title));
} else {
$formatted = Linker::link($title);
}
if (!is_null($row->page_len)) {
$formatted .= $this->getLanguage()->getDirMark() . ' ' . Html::rawElement('span', array('class' => 'mw-protectedpages-length'), Linker::formatRevisionSize($row->page_len));
}
break;
case 'pr_expiry':
$formatted = htmlspecialchars($this->getLanguage()->formatExpiry($value, true));
$title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
if ($this->getUser()->isAllowed('protect') && $title) {
$changeProtection = Linker::linkKnown($title, $this->msg('protect_change')->escaped(), array(), array('action' => 'unprotect'));
$formatted .= ' ' . Html::rawElement('span', array('class' => 'mw-protectedpages-actions'), $this->msg('parentheses')->rawParams($changeProtection)->escaped());
}
break;
case 'log_user':
// when timestamp is null, this is a old protection row
if ($row->log_timestamp === null) {
$formatted = Html::rawElement('span', array('class' => 'mw-protectedpages-unknown'), $this->msg('protectedpages-unknown-performer')->escaped());
} else {
$username = UserCache::singleton()->getProp($value, 'name');
if (LogEventsList::userCanBitfield($row->log_deleted, LogPage::DELETED_USER, $this->getUser())) {
if ($username === false) {
$formatted = htmlspecialchars($value);
} else {
$formatted = Linker::userLink($value, $username) . Linker::userToolLinks($value, $username);
}
} else {
$formatted = $this->msg('rev-deleted-user')->escaped();
}
if (LogEventsList::isDeleted($row, LogPage::DELETED_USER)) {
$formatted = '<span class="history-deleted">' . $formatted . '</span>';
}
}
break;
case 'pr_params':
$params = array();
// Messages: restriction-level-sysop, restriction-level-autoconfirmed
$params[] = $this->msg('restriction-level-' . $row->pr_level)->escaped();
if ($row->pr_cascade) {
$params[] = $this->msg('protect-summary-cascade')->escaped();
}
$formatted = $this->getLanguage()->commaList($params);
break;
case 'log_comment':
// when timestamp is null, this is an old protection row
if ($row->log_timestamp === null) {
$formatted = Html::rawElement('span', array('class' => 'mw-protectedpages-unknown'), $this->msg('protectedpages-unknown-reason')->escaped());
} else {
if (LogEventsList::userCanBitfield($row->log_deleted, LogPage::DELETED_COMMENT, $this->getUser())) {
$formatted = Linker::formatComment($value !== null ? $value : '');
} else {
$formatted = $this->msg('rev-deleted-comment')->escaped();
}
if (LogEventsList::isDeleted($row, LogPage::DELETED_COMMENT)) {
$formatted = '<span class="history-deleted">' . $formatted . '</span>';
}
}
break;
default:
throw new MWException("Unknown field '{$field}'");
}
return $formatted;
}
示例13: showList
/**
* Generic list of deleted pages
*
* @param ResultWrapper $result
* @return bool
*/
private function showList($result)
{
$out = $this->getOutput();
if ($result->numRows() == 0) {
$out->addWikiMsg('undelete-no-results');
return false;
}
$out->addWikiMsg('undeletepagetext', $this->getLanguage()->formatNum($result->numRows()));
$undelete = $this->getPageTitle();
$out->addHTML("<ul>\n");
foreach ($result as $row) {
$title = Title::makeTitleSafe($row->ar_namespace, $row->ar_title);
if ($title !== null) {
$item = Linker::linkKnown($undelete, htmlspecialchars($title->getPrefixedText()), array(), array('target' => $title->getPrefixedText()));
} else {
// The title is no longer valid, show as text
$item = Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $row->ar_namespace, $row->ar_title));
}
$revs = $this->msg('undeleterevisions')->numParams($row->count)->parse();
$out->addHTML("<li>{$item} ({$revs})</li>\n");
}
$result->free();
$out->addHTML("</ul>\n");
return true;
}
示例14: getInvalidTitleDescription
public function getInvalidTitleDescription(IContextSource $context, $namespace, $title)
{
return Linker::getInvalidTitleDescription($context, $namespace, $title);
}
示例15: formatResult
/**
* Format a result row
*
* @param $skin Skin to use for UI elements
* @param $result Result row
* @return String
*/
public function formatResult($skin, $result)
{
$title = Title::makeTitleSafe($result->namespace, $result->title);
if (!$title) {
return Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
}
return $this->getLanguage()->specialList(Linker::link($title), $this->makeWlhLink($title, $result));
}