本文整理汇总了PHP中Linker类的典型用法代码示例。如果您正苦于以下问题:PHP Linker类的具体用法?PHP Linker怎么用?PHP Linker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Linker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createFeedItem
private function createFeedItem($row)
{
global $wgOut;
$thread = Thread::newFromRow($row);
$linker = new Linker();
$titleStr = $thread->subject();
$completeText = $thread->root()->getContent();
$completeText = $wgOut->parse($completeText);
$threadTitle = clone $thread->topmostThread()->title();
$threadTitle->setFragment('#' . $thread->getAnchorName());
$titleUrl = $threadTitle->getFullURL();
$timestamp = $thread->created();
$user = $thread->author()->getName();
// Grab the title for the superthread, if one exists.
$stTitle = null;
if ($thread->hasSuperThread()) {
$stTitle = clone $thread->topmostThread()->title();
$stTitle->setFragment('#' . $thread->superthread()->getAnchorName());
}
// Prefix content with a quick description
$userLink = $linker->userLink($thread->author()->getId(), $user);
$talkpageLink = $linker->link($thread->getTitle());
$superthreadLink = $linker->link($stTitle);
$description = wfMsgExt($thread->hasSuperThread() ? 'lqt-feed-reply-intro' : 'lqt-feed-new-thread-intro', array('parse', 'replaceafter'), array($talkpageLink, $userLink, $superthreadLink));
$completeText = $description . $completeText;
return new FeedItem($titleStr, $completeText, $titleUrl, $timestamp, $user);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:27,代码来源:ApiFeedLQTThreads.php
示例2: wfSajaxSearch
function wfSajaxSearch($term)
{
global $wgContLang, $wgOut;
$limit = 16;
$l = new Linker();
$term = str_replace(' ', '_', $wgContLang->ucfirst($wgContLang->checkTitleEncoding($wgContLang->recodeInput(js_unescape($term)))));
if (strlen(str_replace('_', '', $term)) < 3) {
return;
}
$db =& wfGetDB(DB_SLAVE);
$res = $db->select('page', 'page_title', array('page_namespace' => 0, "page_title LIKE '" . $db->strencode($term) . "%'"), "wfSajaxSearch", array('LIMIT' => $limit + 1));
$r = "";
$i = 0;
while (($row = $db->fetchObject($res)) && ++$i <= $limit) {
$nt = Title::newFromDBkey($row->page_title);
$r .= '<li>' . $l->makeKnownLinkObj($nt) . "</li>\n";
}
if ($i > $limit) {
$more = '<i>' . $l->makeKnownLink($wgContLang->specialPage("Allpages"), wfMsg('moredotdotdot'), "namespace=0&from=" . wfUrlEncode($term)) . '</i>';
} else {
$more = '';
}
$subtitlemsg = Title::newFromText($term) ? 'searchsubtitle' : 'searchsubtitleinvalid';
$subtitle = $wgOut->parse(wfMsg($subtitlemsg, wfEscapeWikiText($term)));
#FIXME: parser is missing mTitle !
$term = htmlspecialchars($term);
$html = '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">' . wfMsg('hideresults') . '</a></div>' . '<h1 class="firstHeading">' . wfMsg('search') . '</h1><div id="contentSub">' . $subtitle . '</div><ul><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchcontaining', $term), "search={$term}&fulltext=Search") . '</li><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchnamed', $term), "search={$term}&go=Go") . "</li></ul><h2>" . wfMsg('articletitles', $term) . "</h2>" . '<ul>' . $r . '</ul>' . $more;
$response = new AjaxResponse($html);
$response->setCacheDuration(30 * 60);
return $response;
}
开发者ID:negabaro,项目名称:alfresco,代码行数:31,代码来源:AjaxFunctions.php
示例3: addPage
function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
// From CategoryViewer::addPage
global $wgContLang;
$this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) );
// Customization
global $wgPeopleCategories;
$name = $title->getText();
if( in_array( $this->title->getText(), $wgPeopleCategories ) && strpos( $name, ' ' ) ) {
$first = substr( $name, 0, strrpos( $name, ' ' ) );
$last = substr( $name, strrpos( $name, ' ' ) + 1 );
$name = $last . ', ' . $first;
}
if( $title->getNamespace() !== NS_MAIN ) {
$name = $title->getNsText() . ':' . $name;
}
$linker = new Linker;
if( $isRedirect ) {
$this->articles[] =
'<span class="redirect-in-category">' .
$linker->link( $title, $name ) .
'</span>';
} else {
$this->articles[] = $linker->link( $title, $name );
}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:PeopleCategories.body.php
示例4: formatLog
/**
* a StaffLog::formatRow hook
*
* Formats a log entry to be displayed on Special:StaffLog
*/
public static function formatLog($type, $result, $time, $linker, &$out)
{
if ('spamwiki' == $type) {
$l = new Linker();
$out = "{$time} {$type} - user {$l->userLink($result->slog_user, $result->slog_user_name)} {$result->slog_comment}.";
}
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:13,代码来源:SpecialSpamWikisController.class.php
示例5: genContributionScoreTable
/**
* Function generates Contribution Scores tables in HTML format (not wikiText)
*
* @param $days int Days in the past to run report for
* @param $limit int Maximum number of users to return (default 50)
* @param $title Title (default null)
* @param $options array of options (default none; nosort/notools)
* @return Html Table representing the requested Contribution Scores.
*/
function genContributionScoreTable($days, $limit, $title = null, $options = 'none')
{
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName;
$opts = explode(',', strtolower($options));
$dbr = wfGetDB(DB_SLAVE);
$userTable = $dbr->tableName('user');
$userGroupTable = $dbr->tableName('user_groups');
$revTable = $dbr->tableName('revision');
$ipBlocksTable = $dbr->tableName('ipblocks');
$sqlWhere = "";
$nextPrefix = "WHERE";
if ($days > 0) {
$date = time() - 60 * 60 * 24 * $days;
$dateString = $dbr->timestamp($date);
$sqlWhere .= " {$nextPrefix} rev_timestamp > '{$dateString}'";
$nextPrefix = "AND";
}
if ($wgContribScoreIgnoreBlockedUsers) {
$sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ipb_user FROM {$ipBlocksTable} WHERE ipb_user <> 0)";
$nextPrefix = "AND";
}
if ($wgContribScoreIgnoreBots) {
$sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ug_user FROM {$userGroupTable} WHERE ug_group='bot')";
}
$sqlMostPages = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY page_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
$sqlMostRevs = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY rev_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
$sql = "SELECT user_id, " . "user_name, " . "user_real_name, " . "page_count, " . "rev_count, " . "page_count+SQRT(rev_count-page_count)*2 AS wiki_rank " . "FROM {$userTable} u JOIN (({$sqlMostPages}) UNION ({$sqlMostRevs})) s ON (user_id=rev_user) " . "ORDER BY wiki_rank DESC " . "LIMIT {$limit}";
$res = $dbr->query($sql);
$sortable = in_array('nosort', $opts) ? '' : ' sortable';
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" . "<tr class='header'>\n" . Html::element('th', array(), $this->msg('contributionscores-score')->text()) . Html::element('th', array(), $this->msg('contributionscores-pages')->text()) . Html::element('th', array(), $this->msg('contributionscores-changes')->text()) . Html::element('th', array(), $this->msg('contributionscores-username')->text());
$altrow = '';
$lang = $this->getLanguage();
foreach ($res as $row) {
// Use real name if option used and real name present.
if ($wgContribScoresUseRealName && $row->user_real_name !== '') {
$userLink = Linker::userLink($row->user_id, $row->user_name, $row->user_real_name);
} else {
$userLink = Linker::userLink($row->user_id, $row->user_name);
}
$output .= Html::closeElement('tr');
$output .= "<tr class='{$altrow}'>\n<td class='content'>" . $lang->formatNum(round($row->wiki_rank, 0)) . "\n</td><td class='content'>" . $lang->formatNum($row->page_count) . "\n</td><td class='content'>" . $lang->formatNum($row->rev_count) . "\n</td><td class='content'>" . $userLink;
# Option to not display user tools
if (!in_array('notools', $opts)) {
$output .= Linker::userToolLinks($row->user_id, $row->user_name);
}
$output .= Html::closeElement('td') . "\n";
if ($altrow == '' && empty($sortable)) {
$altrow = 'odd ';
} else {
$altrow = '';
}
}
$output .= Html::closeElement('tr');
$output .= Html::closeElement('table');
$dbr->freeResult($res);
if (!empty($title)) {
$output = Html::rawElement('table', array('style' => 'border-spacing: 0; padding: 0', 'class' => 'contributionscores-wrapper', 'lang' => htmlspecialchars($lang->getCode()), 'dir' => $lang->getDir()), "\n" . "<tr>\n" . "<td style='padding: 0px;'>{$title}</td>\n" . "</tr>\n" . "<tr>\n" . "<td style='padding: 0px;'>{$output}</td>\n" . "</tr>\n");
}
return $output;
}
开发者ID:seedbank,项目名称:old-repo,代码行数:69,代码来源:ContributionScores_body.php
示例6: getFormattedValue
/**
* (non-PHPdoc)
* @see EPPager::getFormattedValue()
*/
protected function getFormattedValue($name, $value)
{
switch ($name) {
case 'id':
$value = Linker::linkKnown(SpecialPage::getTitleFor('Student', $value), htmlspecialchars($this->getLanguage()->formatNum($value, true)));
break;
case 'user_id':
$user = User::newFromId($value);
$name = $user->getRealName() === '' ? $user->getName() : $user->getRealName();
$value = Linker::userLink($value, $name) . Linker::userToolLinks($value, $name);
break;
case 'first_enroll':
case 'last_active':
$value = htmlspecialchars($this->getLanguage()->date($value));
break;
case 'active_enroll':
$value = wfMsgHtml($value === '1' ? 'epstudentpager-yes' : 'epstudentpager-no');
break;
case '_courses_current':
$value = $this->getLanguage()->pipeList(array_map(function (EPCourse $course) {
return $course->getLink();
}, $this->currentObject->getCoursesWithState('current', 'name')));
break;
}
return $value;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:EPStudentPager.php
示例7: formatRow
function formatRow($row)
{
$time = htmlspecialchars($this->getLanguage()->userDate($row->log_timestamp, $this->getUser()));
$paramsSerialized = unserialize($row->log_params);
$paramsOldFormat = null;
// If the params aren't serialized, it's an older log format
if ($paramsSerialized === false) {
$paramsOldFormat = explode("\n", $row->log_params);
}
$targetName = $paramsSerialized === false ? $paramsOldFormat[0] : $paramsSerialized['4::target'];
$logPageId = (int) $row->log_page;
$currentTitle = $logPageId && $logPageId !== 0 ? Title::newFromID($logPageId) : null;
$targetTitleObj = Title::newFromText($targetName);
// Make sure the target is NS_MAIN
if ($targetTitleObj->getNamespace() !== NS_MAIN) {
return false;
}
$originalNameDisplay = '';
if ($currentTitle && $targetName !== $currentTitle->getFullText()) {
$originalNameDisplay = ' ' . $this->msg('newarticles-original-title')->params($targetName);
}
$pageLink = Linker::link($originalNameDisplay ? $currentTitle : $targetTitleObj);
$articleTypeDisplay = '';
if (isset($row->pp_value) && $row->pp_value === 'portal') {
$pageLink = Html::rawElement('strong', [], $pageLink);
$articleTypeReadable = WRArticleType::getReadableArticleTypeFromCode($row->pp_value);
$articleTypeDisplay = $this->msg('newarticles-articletype')->params($articleTypeReadable)->text();
$articleTypeDisplay = ' ' . $articleTypeDisplay;
}
$formattedRow = Html::rawElement('li', [], "{$time}: {$pageLink}{$articleTypeDisplay}{$originalNameDisplay}") . "\n";
return $formattedRow;
}
开发者ID:kolzchut,项目名称:mediawiki-extensions-WRNewArticles,代码行数:32,代码来源:SpecialNewArticles.php
示例8: formatLogEntry
static function formatLogEntry($type, $action, $title, $sk, $parameters)
{
$msg = "lqt-log-action-{$action}";
switch ($action) {
case 'merge':
if ($parameters[0]) {
$msg = 'lqt-log-action-merge-across';
} else {
$msg = 'lqt-log-action-merge-down';
}
break;
case 'move':
$smt = new SpecialMoveThread();
$rightsCheck = $smt->checkUserRights($parameters[1] instanceof Title ? $parameters[1] : Title::newFromText($parameters[1]), $parameters[0] instanceof Title ? $parameters[0] : Title::newFromText($parameters[0]));
if ($rightsCheck === true) {
$parameters[] = Message::rawParam(Linker::link(SpecialPage::getTitleFor('MoveThread', $title), wfMessage('revertmove')->text(), array(), array('dest' => $parameters[0])));
} else {
$parameters[] = '';
}
break;
default:
// Give grep a chance to find the usages:
// lqt-log-action-move, lqt-log-action-split, lqt-log-action-subjectedit,
// lqt-log-action-resort, lqt-log-action-signatureedit
$msg = "lqt-log-action-{$action}";
break;
}
array_unshift($parameters, $title->getPrefixedText());
$html = wfMessage($msg, $parameters);
if ($sk === null) {
return StringUtils::delimiterReplace('<', '>', '', $html->inContentLanguage()->parse());
}
return $html->parse();
}
开发者ID:Rikuforever,项目名称:wiki,代码行数:34,代码来源:LogFormatter.php
示例9: formatResult
/**
* @param $skin Skin
* @param $result
* @return string
*/
function formatResult($skin, $result)
{
$title = Title::makeTitleSafe($result->namespace, $result->title);
$count = $this->msg('ncategories')->numParams($result->value)->escaped();
$link = Linker::link($title);
return $this->getLanguage()->specialList($link, $count);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:SpecialMostcategories.php
示例10: formatValue
function formatValue($name, $value)
{
global $wgContLang;
switch ($name) {
case 'article_title':
$articleId = $this->mCurrentRow->article_id;
$title = Title::newFromID($articleId);
return $title ? Linker::link($title) : '(unknown, id: ' . $articleId . ')';
break;
case 'page_ns':
return ($value != 0 ? $wgContLang->getNsText($value) : $this->mainNamespaceText) . " [{$value}]";
break;
case 'average_time':
case 'minimum_time':
case 'maximum_time':
return $value . " s";
break;
case 'wikitext_size':
case 'html_size':
return sprintf("%.1f kb", $value / 1000);
break;
default:
return $value;
}
}
开发者ID:yusufchang,项目名称:app,代码行数:25,代码来源:ParserSpeedTablePager.class.php
示例11: formatResult
/**
* @param Skin $skin
* @param object $result Result row
* @return string
*/
function formatResult($skin, $result)
{
$title = Title::makeTitle(NS_TEMPLATE, $result->title);
$pageLink = Linker::linkKnown($title, null, array(), array('redirect' => 'no'));
$wlhLink = Linker::linkKnown(SpecialPage::getTitleFor('Whatlinkshere', $title->getPrefixedText()), $this->msg('unusedtemplateswlh')->escaped());
return $this->getLanguage()->specialList($pageLink, $wlhLink);
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:12,代码来源:SpecialUnusedtemplates.php
示例12: doTagRow
function doTagRow($tag, $hitcount)
{
static $doneTags = array();
if (in_array($tag, $doneTags)) {
return '';
}
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('code', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' ';
$editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped());
$disp .= $this->msg('parentheses')->rawParams($editLink)->escaped();
$newRow .= Xml::tags('td', null, $disp);
$msg = $this->msg("tag-{$tag}-description");
$desc = !$msg->exists() ? '' : $msg->parse();
$desc .= ' ';
$editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped());
$desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped();
$newRow .= Xml::tags('td', null, $desc);
$hitcount = $this->msg('tags-hitcount')->numParams($hitcount)->escaped();
$hitcount = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}
开发者ID:seedbank,项目名称:old-repo,代码行数:25,代码来源:SpecialTags.php
示例13: formatRow
public function formatRow($row)
{
$title = Title::makeTitle($row->page_namespace, $row->page_title);
// Link to page
$link = Linker::link($title);
// Helpful utility links
$utilLinks = array();
$utilLinks[] = Linker::link($title, wfMsgHtml('stablepages-config'), array(), array('action' => 'protect'), 'known');
$utilLinks[] = Linker::link($title, wfMsgHtml('history'), array(), array('action' => 'history'), 'known');
$utilLinks[] = Linker::link(SpecialPage::getTitleFor('Log', 'stable'), wfMsgHtml('stable-logpage'), array(), array('page' => $title->getPrefixedText()), 'known');
// Autoreview/review restriction level
$restr = '';
if ($row->fpc_level != '') {
$restr = 'autoreview=' . htmlspecialchars($row->fpc_level);
$restr = "[{$restr}]";
}
// When these configuration settings expire
if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) {
$expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")";
} else {
$expiry_description = "";
}
$utilLinks = $this->getLang()->pipeList($utilLinks);
return "<li>{$link} ({$utilLinks}) {$restr}<i>{$expiry_description}</i></li>";
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:25,代码来源:StablePages_body.php
示例14: getHTML
/**
* @return string A HTML <li> element representing this revision, showing
* change tags and everything
*/
public function getHTML()
{
$date = htmlspecialchars($this->list->getLanguage()->userTimeAndDate($this->row->log_timestamp, $this->list->getUser()));
$title = Title::makeTitle($this->row->log_namespace, $this->row->log_title);
$formatter = LogFormatter::newFromRow($this->row);
$formatter->setContext($this->list->getContext());
$formatter->setAudience(LogFormatter::FOR_THIS_USER);
// Log link for this page
$loglink = Linker::link(SpecialPage::getTitleFor('Log'), $this->list->msg('log')->escaped(), array(), array('page' => $title->getPrefixedText()));
$loglink = $this->list->msg('parentheses')->rawParams($loglink)->escaped();
// User links and action text
$action = $formatter->getActionText();
// Comment
$comment = $this->list->getLanguage()->getDirMark() . $formatter->getComment();
if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
$content = "{$loglink} {$date} {$action} {$comment}";
$attribs = array();
$tags = $this->getTags();
if ($tags) {
list($tagSummary, $classes) = ChangeTags::formatSummaryRow($tags, 'edittags', $this->list->getContext());
$content .= " {$tagSummary}";
$attribs['class'] = implode(' ', $classes);
}
return Xml::tags('li', $attribs, $content);
}
开发者ID:OrBin,项目名称:mediawiki,代码行数:31,代码来源:ChangeTagsLogItem.php
示例15: getButtons
function getButtons()
{
$buttons = '';
if ($this->mShowSubmit) {
$attribs = array();
if (isset($this->mSubmitID)) {
$attribs['id'] = $this->mSubmitID;
}
if (isset($this->mSubmitName)) {
$attribs['name'] = $this->mSubmitName;
}
if (isset($this->mSubmitTooltip)) {
$attribs += Linker::tooltipAndAccesskeyAttribs($this->mSubmitTooltip);
}
$attribs['class'] = array('mw-htmlform-submit', 'mw-ui-button mw-ui-big mw-ui-block', $this->mSubmitModifierClass);
$buttons .= Xml::submitButton($this->getSubmitText(), $attribs) . "\n";
}
if ($this->mShowReset) {
$buttons .= Html::element('input', array('type' => 'reset', 'value' => $this->msg('htmlform-reset')->text(), 'class' => 'mw-ui-button mw-ui-big mw-ui-block')) . "\n";
}
foreach ($this->mButtons as $button) {
$attrs = array('type' => 'submit', 'name' => $button['name'], 'value' => $button['value']);
if ($button['attribs']) {
$attrs += $button['attribs'];
}
if (isset($button['id'])) {
$attrs['id'] = $button['id'];
}
$attrs['class'] = isset($attrs['class']) ? (array) $attrs['class'] : array();
$attrs['class'][] = 'mw-ui-button mw-ui-big mw-ui-block';
$buttons .= Html::element('input', $attrs) . "\n";
}
$html = Html::rawElement('div', array('class' => 'mw-htmlform-submit-buttons'), "\n{$buttons}") . "\n";
return $html;
}
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:35,代码来源:VFormHTMLForm.php
示例16: formatRow
public function formatRow($row)
{
$title = Title::newFromRow($row);
# Link to page
$link = Linker::link($title);
# Link to page configuration
$config = Linker::linkKnown(SpecialPage::getTitleFor('Stabilization'), wfMsgHtml('configuredpages-config'), array(), 'page=' . $title->getPrefixedUrl());
# Show which version is the default (stable or draft)
if (intval($row->fpc_override)) {
$default = wfMsgHtml('configuredpages-def-stable');
} else {
$default = wfMsgHtml('configuredpages-def-draft');
}
# Autoreview/review restriction level
$restr = '';
if ($row->fpc_level != '') {
$restr = 'autoreview=' . htmlspecialchars($row->fpc_level);
$restr = "[{$restr}]";
}
# When these configuration settings expire
if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) {
$expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")";
} else {
$expiry_description = "";
}
return "<li>{$link} ({$config}) <b>[{$default}]</b> " . "{$restr}<i>{$expiry_description}</i></li>";
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:ConfiguredPages_body.php
示例17: createFeedItem
private function createFeedItem($row)
{
$thread = Thread::newFromRow($row);
$titleStr = $thread->subject();
$completeText = $thread->root()->getContent();
$completeText = $this->getOutput()->parse($completeText);
$threadTitle = clone $thread->topmostThread()->title();
$threadTitle->setFragment('#' . $thread->getAnchorName());
$titleUrl = $threadTitle->getFullURL();
$timestamp = $thread->created();
$user = $thread->author()->getName();
// Prefix content with a quick description
$userLink = Linker::userLink($thread->author()->getId(), $user);
$talkpageLink = Linker::link($thread->getTitle());
if ($thread->hasSuperThread()) {
$stTitle = clone $thread->topmostThread()->title();
$stTitle->setFragment('#' . $thread->superthread()->getAnchorName());
$superthreadLink = Linker::link($stTitle);
$description = wfMessage('lqt-feed-reply-intro')->rawParams($talkpageLink, $userLink, $superthreadLink)->params($user)->parseAsBlock();
} else {
// Third param is unused
$description = wfMessage('lqt-feed-new-thread-intro')->rawParams($talkpageLink, $userLink, '')->params($user)->parseAsBlock();
}
$completeText = $description . $completeText;
return new FeedItem($titleStr, $completeText, $titleUrl, $timestamp, $user);
}
开发者ID:Rikuforever,项目名称:wiki,代码行数:26,代码来源:ApiFeedLQTThreads.php
示例18: getLinkFor
public static function getLinkFor($identifierValue, $action = 'view', $html = null, $customAttribs = array(), $query = array())
{
if ($action !== 'view') {
$query['action'] = $action;
}
return Linker::linkKnown(self::getTitleFor($identifierValue, $action), is_null($html) ? htmlspecialchars($identifierValue) : $html, $customAttribs, $query);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:7,代码来源:EPPageObject.php
示例19: getLicense
/**
* Returns HTML of license link or empty string
* For example:
* "<a title="Wikipedia:Copyright" href="/index.php/Wikipedia:Copyright">CC BY</a>"
*
* @param string $context The context in which the license link appears, e.g. footer,
* editor, talk, or upload.
* @param array $attribs An associative array of extra HTML attributes to add to the link
* @return string
*/
public static function getLicense($context, $attribs = array())
{
$config = MobileContext::singleton()->getConfig();
$rightsPage = $config->get('RightsPage');
$rightsUrl = $config->get('RightsUrl');
$rightsText = $config->get('RightsText');
// Construct the link to the licensing terms
if ($rightsText) {
// Use shorter text for some common licensing strings. See Installer.i18n.php
// for the currently offered strings. Unfortunately, there is no good way to
// comprehensively support localized licensing strings since the license (as
// stored in LocalSettings.php) is just freeform text, not an i18n key.
$commonLicenses = array('Creative Commons Attribution-Share Alike 3.0' => 'CC BY-SA 3.0', 'Creative Commons Attribution Share Alike' => 'CC BY-SA', 'Creative Commons Attribution 3.0' => 'CC BY 3.0', 'Creative Commons Attribution 2.5' => 'CC BY 2.5', 'Creative Commons Attribution' => 'CC BY', 'Creative Commons Attribution Non-Commercial Share Alike' => 'CC BY-NC-SA', 'Creative Commons Zero (Public Domain)' => 'CC0 (Public Domain)', 'GNU Free Documentation License 1.3 or later' => 'GFDL 1.3 or later');
if (isset($commonLicenses[$rightsText])) {
$rightsText = $commonLicenses[$rightsText];
}
if ($rightsPage) {
$title = Title::newFromText($rightsPage);
$link = Linker::linkKnown($title, $rightsText, $attribs);
} elseif ($rightsUrl) {
$link = Linker::makeExternalLink($rightsUrl, $rightsText, true, '', $attribs);
} else {
$link = $rightsText;
}
} else {
$link = '';
}
// Allow other extensions (for example, WikimediaMessages) to override
$msg = 'mobile-frontend-copyright';
Hooks::run('MobileLicenseLink', array(&$link, $context, $attribs, &$msg));
return array('msg' => $msg, 'link' => $link, 'plural' => self::getPluralLicenseInfo($link));
}
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:42,代码来源:MobileFrontend.skin.hooks.php
示例20: 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";
}
开发者ID:mangowi,项目名称:mediawiki,代码行数:32,代码来源:SpecialProtectedtitles.php
注:本文中的Linker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论