本文整理汇总了PHP中Linker::linkKnown方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::linkKnown方法的具体用法?PHP Linker::linkKnown怎么用?PHP Linker::linkKnown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::linkKnown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Main execution point
*
* @param null|string $code Confirmation code passed to the page
*/
function execute( $code ) {
$this->setHeaders();
$this->checkReadOnly();
$this->checkPermissions();
// This could also let someone check the current email address, so
// require both permissions.
if ( !$this->getUser()->isAllowed( 'viewmyprivateinfo' ) ) {
throw new PermissionsError( 'viewmyprivateinfo' );
}
if ( $code === null || $code === '' ) {
if ( $this->getUser()->isLoggedIn() ) {
if ( Sanitizer::validateEmail( $this->getUser()->getEmail() ) ) {
$this->showRequestForm();
} else {
$this->getOutput()->addWikiMsg( 'confirmemail_noemail' );
}
} else {
$llink = Linker::linkKnown(
SpecialPage::getTitleFor( 'Userlogin' ),
$this->msg( 'loginreqlink' )->escaped(),
array(),
array( 'returnto' => $this->getTitle()->getPrefixedText() )
);
$this->getOutput()->addHTML(
$this->msg( 'confirmemail_needlogin' )->rawParams( $llink )->parse()
);
}
} else {
$this->attemptConfirm( $code );
}
}
示例2: getMessageParameters
public function getMessageParameters()
{
$params = parent::getMessageParameters();
$type = $this->entry->getSubtype();
$entry_params = $this->entry->getParameters();
if ($type === 'approve') {
$revid = $entry_params['revid'];
$link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid));
$params[4] = Message::rawParam($link);
} elseif ($type === 'reject') {
$modid = $entry_params['modid'];
$link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid));
$params[4] = Message::rawParam($link);
$userlink = Linker::userLink($entry_params['user'], $entry_params['user_text']);
$params[5] = Message::rawParam($userlink);
} elseif ($type === 'merge') {
$revid = $entry_params['revid'];
$modid = $entry_params['modid'];
$link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid));
$params[4] = Message::rawParam($link);
$link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid));
$params[5] = Message::rawParam($link);
} elseif ($type === 'approveall' || $type === 'rejectall' || $type === 'block' || $type === 'unblock') {
$title = $this->entry->getTarget();
$user_id = User::idFromName($title->getText());
$link = Linker::userLink($user_id, $title->getText());
$params[2] = Message::rawParam($link);
}
return $params;
}
示例3: getActionLinks
public function getActionLinks() {
if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
|| $this->entry->getSubtype() !== 'move'
|| !$this->context->getUser()->isAllowed( 'move' ) )
{
return '';
}
$params = $this->extractParameters();
$destTitle = Title::newFromText( $params[3] );
if ( !$destTitle ) {
return '';
}
$revert = Linker::linkKnown(
SpecialPage::getTitleFor( 'Movepage' ),
$this->msg( 'revertmove' )->escaped(),
array(),
array(
'wpOldTitle' => $destTitle->getPrefixedDBkey(),
'wpNewTitle' => $this->entry->getTarget()->getPrefixedDBkey(),
'wpReason' => $this->msg( 'revertmove' )->inContentLanguage()->text(),
'wpMovetalk' => 0
)
);
return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
}
示例4: execute
public function execute($par)
{
global $wgEnableJavaScriptTest;
$out = $this->getOutput();
$this->setHeaders();
$out->disallowUserJs();
// Abort early if we're disabled
if ($wgEnableJavaScriptTest !== true) {
$out->addWikiMsg('javascripttest-disabled');
return;
}
$out->addModules('mediawiki.special.javaScriptTest');
// Determine framework
$pars = explode('/', $par);
$framework = strtolower($pars[0]);
// No framework specified
if ($par == '') {
$out->setPagetitle(wfMsgHtml('javascripttest'));
$summary = $this->wrapSummaryHtml(wfMsgHtml('javascripttest-pagetext-noframework') . $this->getFrameworkListHtml(), 'noframework');
$out->addHtml($summary);
// Matched! Display proper title and initialize the framework
} elseif (isset(self::$frameworks[$framework])) {
$out->setPagetitle(wfMsgHtml('javascripttest-title', wfMsgHtml("javascripttest-{$framework}-name")));
$out->setSubtitle(wfMessage('javascripttest-backlink')->rawParams(Linker::linkKnown($this->getTitle()))->escaped());
$this->{self::$frameworks[$framework]}();
// Framework not found, display error
} else {
$out->setPagetitle(wfMsgHtml('javascripttest'));
$summary = $this->wrapSummaryHtml('<p class="error">' . wfMsgHtml('javascripttest-pagetext-unknownframework', $par) . '</p>' . $this->getFrameworkListHtml(), 'unknownframework');
$out->addHtml($summary);
}
}
示例5: execute
public function execute($par)
{
$out = $this->getOutput();
$this->setHeaders();
$out->disallowUserJs();
$out->addModules('mediawiki.special.javaScriptTest');
// Determine framework
$pars = explode('/', $par);
$framework = strtolower($pars[0]);
// No framework specified
if ($par == '') {
$out->setPageTitle($this->msg('javascripttest'));
$summary = $this->wrapSummaryHtml($this->msg('javascripttest-pagetext-noframework')->escaped() . $this->getFrameworkListHtml(), 'noframework');
$out->addHtml($summary);
} elseif (isset(self::$frameworks[$framework])) {
// Matched! Display proper title and initialize the framework
$out->setPageTitle($this->msg('javascripttest-title', $this->msg("javascripttest-{$framework}-name")->plain()));
$out->setSubtitle($this->msg('javascripttest-backlink')->rawParams(Linker::linkKnown($this->getPageTitle())));
$this->{self::$frameworks[$framework]}();
} else {
// Framework not found, display error
$out->setPageTitle($this->msg('javascripttest'));
$summary = $this->wrapSummaryHtml('<p class="error">' . $this->msg('javascripttest-pagetext-unknownframework', $par)->escaped() . '</p>' . $this->getFrameworkListHtml(), 'unknownframework');
$out->addHtml($summary);
}
}
示例6: 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));
}
示例7: 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;
}
示例8: 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>";
}
示例9: 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);
}
示例10: 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);
}
示例11: getCentralAuthLink
/**
* @param string $name
* @return array
*/
protected function getCentralAuthLink($name)
{
if ($this->plaintext) {
return Title::newFromText('CentralAuth/' . $name, NS_SPECIAL);
} else {
return Linker::linkKnown(SpecialPage::getTitleFor('CentralAuth', $name), htmlspecialchars($name));
}
}
示例12: formatResult
function formatResult($skin, $result)
{
global $wgContLang;
$d = $this->getLanguage()->userTimeAndDate($result->value, $this->getUser());
$title = Title::makeTitle($result->namespace, $result->title);
$link = Linker::linkKnown($title, htmlspecialchars($wgContLang->convert($title->getPrefixedText())));
return $this->getLanguage()->specialList($link, htmlspecialchars($d));
}
示例13: efLoadLookupUserLink
/**
* Add a link to Special:LookupUser from Special:Contributions/USERNAME
* if the user has 'lookupuser' permission
* @return true
*/
function efLoadLookupUserLink($id, $nt, &$links)
{
global $wgUser;
if ($wgUser->isAllowed('lookupuser')) {
$links[] = Linker::linkKnown(SpecialPage::getTitleFor('LookupUser'), wfMsgHtml('lookupuser'), array(), array('target' => $nt->getText()));
}
return true;
}
示例14: formatResult
/**
* @param $skin Skin
* @param $result
* @return string
*/
function formatResult($skin, $result)
{
global $wgContLang;
$title = Title::makeTitle($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);
}
示例15: getActionLinks
public function getActionLinks()
{
if ($this->entry->isDeleted(LogPage::DELETED_ACTION) || $this->entry->getSubtype() !== 'change' || !$this->context->getUser()->isAllowed('editcontentmodel')) {
return '';
}
$params = $this->extractParameters();
$revert = Linker::linkKnown(SpecialPage::getTitleFor('ChangeContentModel'), $this->msg('logentry-contentmodel-change-revertlink')->escaped(), array(), array('pagetitle' => $this->entry->getTarget()->getPrefixedText(), 'model' => $params[3], 'reason' => $this->msg('logentry-contentmodel-change-revert')->inContentLanguage()->text()));
return $this->msg('parentheses')->rawParams($revert)->escaped();
}