本文整理汇总了PHP中Skin::makeInternalOrExternalUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::makeInternalOrExternalUrl方法的具体用法?PHP Skin::makeInternalOrExternalUrl怎么用?PHP Skin::makeInternalOrExternalUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::makeInternalOrExternalUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTermsLink
/**
* Returns HTML of terms of use link or null if it shouldn't be displayed
* Note: This is called by a hook in the WikimediaMessages extension.
*
* @param Skin $sk
* @param string $urlMsgKey Key of i18n message containing terms of use URL (optional)
* @return null|string
*/
public static function getTermsLink($sk, $urlMsgKey = 'mobile-frontend-terms-url')
{
$urlMsg = $sk->msg($urlMsgKey)->inContentLanguage();
if ($urlMsg->isDisabled()) {
return null;
}
$url = $urlMsg->plain();
return Html::element('a', array('href' => Skin::makeInternalOrExternalUrl($url)), $sk->msg('mobile-frontend-terms-text')->text());
}
示例2: showStandardInputs
protected function showStandardInputs(&$tabindex = 2)
{
global $wgOut;
$wgOut->addHTML("<div class='editOptions'>\n");
if ($this->section != 'new') {
$this->showSummaryInput(false, $this->summary);
$wgOut->addHTML($this->getSummaryPreview(false, $this->summary));
}
$checkboxes = $this->getCheckboxes($tabindex, array('minor' => $this->minoredit, 'watch' => $this->watchthis));
// wikia change begin, @author eloy
wfRunHooks('EditPage::showEditForm:checkboxes', array(&$this, &$checkboxes));
// wikia change end
$wgOut->addHTML("<div class='editCheckboxes'>" . implode($checkboxes, "\n") . "</div>\n");
$wgOut->addHTML("<div class='editButtons'>\n");
$wgOut->addHTML(implode($this->getEditButtons($tabindex), "\n") . "\n");
$cancel = $this->getCancelLink();
if ($cancel !== '') {
$cancel .= wfMsgExt('pipe-separator', 'escapenoentities');
}
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
$edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow'));
$wgOut->addHTML("\t<span class='editHelp'>{$cancel}{$edithelp}</span>\n");
$wgOut->addHTML("</div><!-- editButtons -->\n</div><!-- editOptions -->\n");
}
示例3: showStandardInputs
protected function showStandardInputs(&$tabindex = 2)
{
global $wgOut, $wgUseMediaWikiUIEverywhere;
$wgOut->addHTML("<div class='editOptions'>\n");
if ($this->section != 'new') {
$this->showSummaryInput(false, $this->summary);
$wgOut->addHTML($this->getSummaryPreview(false, $this->summary));
}
$checkboxes = $this->getCheckboxes($tabindex, array('minor' => $this->minoredit, 'watch' => $this->watchthis));
$wgOut->addHTML("<div class='editCheckboxes'>" . implode($checkboxes, "\n") . "</div>\n");
// Show copyright warning.
$wgOut->addWikiText($this->getCopywarn());
$wgOut->addHTML($this->editFormTextAfterWarn);
$wgOut->addHTML("<div class='editButtons'>\n");
$wgOut->addHTML(implode($this->getEditButtons($tabindex), "\n") . "\n");
$cancel = $this->getCancelLink();
if ($cancel !== '') {
$cancel .= Html::element('span', array('class' => 'mw-editButtons-pipe-separator'), wfMessage('pipe-separator')->text());
}
$message = wfMessage('edithelppage')->inContentLanguage()->text();
$edithelpurl = Skin::makeInternalOrExternalUrl($message);
$attrs = array('target' => 'helpwindow', 'href' => $edithelpurl);
if ($wgUseMediaWikiUIEverywhere) {
$attrs['class'] = 'mw-ui-button mw-ui-quiet';
}
$edithelp = Html::element('a', $attrs, wfMessage('edithelp')->text()) . wfMessage('word-separator')->escaped() . wfMessage('newwindow')->parse();
$wgOut->addHTML("\t<span class='cancelLink'>{$cancel}</span>\n");
$wgOut->addHTML("\t<span class='editHelp'>{$edithelp}</span>\n");
$wgOut->addHTML("</div><!-- editButtons -->\n");
wfRunHooks('EditPage::showStandardInputs:options', array($this, $wgOut, &$tabindex));
$wgOut->addHTML("</div><!-- editOptions -->\n");
}
示例4: execute
//.........这里部分代码省略.........
$this->msg( 'userlogin-yourpassword' );
if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
echo ' ' . Linker::link(
SpecialPage::getTitleFor( 'PasswordReset' ),
$this->getMsg( 'userlogin-resetpassword-link' )->parse(),
array( 'class' => 'mw-ui-flush-right' )
);
}
?>
</label>
<?php
echo Html::input( 'wpPassword', null, 'password', array(
'class' => 'loginPassword',
'id' => 'wpPassword1',
'tabindex' => '2',
'size' => '20',
// Set focus to this field if username is filled in.
'autofocus' => (bool)$this->data['name'],
'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
) );
?>
</div>
<?php
if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
$doms = "";
foreach ( $this->data['domainnames'] as $dom ) {
$doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
}
?>
<div id="mw-user-domain-section">
<label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
<select name="wpDomain" value="<?php $this->text( 'domain' ); ?>" tabindex="3">
<?php echo $doms; ?>
</select>
</div>
<?php } ?>
<?php
if ( $this->haveData( 'extrafields' ) ) {
echo $this->data['extrafields'];
}
?>
<div>
<?php if ( $this->data['canremember'] ) { ?>
<label class="mw-ui-checkbox-label">
<input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
<?php if ( $this->data['remember'] ) {
echo 'checked="checked"';
} ?>
>
<?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?>
</label>
<?php } ?>
</div>
<div>
<?php
echo Html::input( 'wpLoginAttempt', $this->getMsg( 'login' )->text(), 'submit', array(
'id' => 'wpLoginAttempt',
'tabindex' => '6',
'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary'
) );
?>
</div>
<div id="mw-userlogin-help">
<?php
echo Html::element(
'a',
array(
'href' => Skin::makeInternalOrExternalUrl(
wfMessage( 'helplogin-url' )->inContentLanguage()->text()
),
),
$this->getMsg( 'userlogin-helplink2' )->text()
);
?>
</div>
<?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
<?php if ( $this->data['loggedin'] ) { ?>
<div id="mw-createaccount-another">
<h3 id="mw-userloginlink"><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a></h3>
</div>
<?php } else { ?>
<div id="mw-createaccount-cta">
<h3 id="mw-userloginlink"><?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button mw-ui-constructive"><?php $this->msg( 'userlogin-joinproject' ); ?></a></h3>
</div>
<?php } ?>
<?php } ?>
<?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
<?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
<?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
</form>
</div>
</div>
<?php
}
示例5: showStandardInputs
protected function showStandardInputs(&$tabindex = 2)
{
global $wgOut;
$wgOut->addHTML("<div class='editOptions'>\n");
if ($this->section != 'new') {
$this->showSummaryInput(false, $this->summary);
$wgOut->addHTML($this->getSummaryPreview(false, $this->summary));
}
$checkboxes = $this->getCheckboxes($tabindex, array('minor' => $this->minoredit, 'watch' => $this->watchthis));
$wgOut->addHTML("<div class='editCheckboxes'>" . implode($checkboxes, "\n") . "</div>\n");
// Show copyright warning.
$wgOut->addWikiText($this->getCopywarn());
$wgOut->addHTML($this->editFormTextAfterWarn);
$wgOut->addHTML("<div class='editButtons'>\n");
$wgOut->addHTML(implode($this->getEditButtons($tabindex), "\n") . "\n");
$cancel = $this->getCancelLink();
if ($cancel !== '') {
$cancel .= wfMessage('pipe-separator')->text();
}
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMessage('edithelppage')->inContentLanguage()->text());
$edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . wfMessage('edithelp')->escaped() . '</a> ' . wfMessage('newwindow')->parse();
$wgOut->addHTML("\t<span class='cancelLink'>{$cancel}</span>\n");
$wgOut->addHTML("\t<span class='editHelp'>{$edithelp}</span>\n");
$wgOut->addHTML("</div><!-- editButtons -->\n");
wfRunHooks('EditPage::showStandardInputs:options', array($this, $wgOut, &$tabindex));
$wgOut->addHTML("</div><!-- editOptions -->\n");
}
示例6: showEditForm
//.........这里部分代码省略.........
}
$wgOut->wrapWikiMsg($notice, array('cascadeprotectedwarning', count($cascadeSources)));
}
if (!$this->mTitle->exists() && $this->mTitle->getRestrictions('create') != array()) {
$wgOut->addWikiMsg('titleprotectedwarning');
}
if ($this->kblength === false) {
$this->kblength = (int) (strlen($this->textbox1) / 1024);
}
if ($this->tooBig || $this->kblength > $wgMaxArticleSize) {
$wgOut->addWikiMsg('longpageerror', $wgLang->formatNum($this->kblength), $wgMaxArticleSize);
} elseif ($this->kblength > 29) {
$wgOut->addWikiMsg('longpagewarning', $wgLang->formatNum($this->kblength));
}
#need to parse the preview early so that we know which templates are used,
#otherwise users with "show preview after edit box" will get a blank list
if ($this->formtype == 'preview') {
$previewOutput = $this->getPreviewText();
}
$rows = $wgUser->getIntOption('rows');
$cols = $wgUser->getIntOption('cols');
$ew = $wgUser->getOption('editwidth');
if ($ew) {
$ew = " style=\"width:100%\"";
} else {
$ew = '';
}
$q = 'action=submit';
#if ( "no" == $redirect ) { $q .= "&redirect=no"; }
$action = $wgTitle->escapeLocalURL($q);
$summary = wfMsg('summary');
$subject = wfMsg('subject');
$cancel = $sk->makeKnownLink($wgTitle->getPrefixedText(), wfMsgExt('cancel', array('parseinline')));
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
$edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow'));
global $wgRightsText;
if ($wgRightsText) {
$copywarnMsg = array('copyrightwarning', '[[' . wfMsgForContent('copyrightpage') . ']]', $wgRightsText);
} else {
$copywarnMsg = array('copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]');
}
if ($wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage) {
# prepare toolbar for edit buttons
$toolbar = $this->getEditToolbar();
} else {
$toolbar = '';
}
// activate checkboxes if user wants them to be always active
if (!$this->preview && !$this->diff) {
# Sort out the "watch" checkbox
if ($wgUser->getOption('watchdefault')) {
# Watch all edits
$this->watchthis = true;
} elseif ($wgUser->getOption('watchcreations') && !$this->mTitle->exists()) {
# Watch creations
$this->watchthis = true;
} elseif ($this->mTitle->userIsWatching()) {
# Already watched
$this->watchthis = true;
}
if ($wgUser->getOption('minordefault')) {
$this->minoredit = true;
}
}
$wgOut->addHTML($this->editFormPageTop);
if ($wgUser->getOption('previewontop')) {
示例7: efIcon_Render
function efIcon_Render(&$parser, $img, $alt = null, $width = null, $page = null)
{
$ititle = Title::newFromText($img);
// this really shouldn't happen... not much we can do here.
if (!is_object($ititle)) {
return '';
}
// add to parser image collection so it this shows up on the image's links/what links here voodoo
$parser->mOutput->addImage($ititle->getDBkey());
// check if we are dealing with an InterWiki link
if ($ititle->isLocal()) {
$image = wfFindFile($img);
if (!$image) {
return '[[Image:' . $img . ']]';
}
$iURL = $image->getURL();
} else {
$iURL = $ititle->getFullURL();
}
// Optional parameters
if (empty($alt)) {
$alt = '';
} else {
$alt = htmlspecialchars($alt);
}
if (!empty($width)) {
$width = intval($width);
if ($width > 0) {
$thumb = $image->transform(array('width' => $width));
if ($thumb->isError()) {
$imageString = wfMsgHtml('icon-badimage');
} else {
$imageString = $thumb->toHtml(array('alt' => $alt, 'title' => $alt));
}
} else {
$imageString = wfMsgHtml('icon-badwidth');
}
} else {
$imageString = "<img class='iconimg' style=\"vertical-align: middle;\" src='{$iURL}' alt=\"{$alt}\" title=\"{$alt}\" />";
}
$output = $imageString;
if (!empty($page)) {
if (preg_match('/^(?:' . wfUrlProtocols() . ')/', $page)) {
$tURL = Skin::makeInternalOrExternalUrl($page);
$aClass = 'class="plainlinks iconlink"';
$output = "<a " . $aClass . " href='{$tURL}'>{$imageString}</a>";
} else {
$ptitle = Title::newFromText($page);
// this might happen in templates...
if (is_object($ptitle)) {
if ($ptitle->isLocal()) {
$tURL = $ptitle->getLocalUrl();
$aClass = 'class="iconlink"';
} else {
$tURL = $ptitle->getFullURL();
$aClass = 'class="extiw iconlink"';
}
$output = "<a " . $aClass . " href='{$tURL}'>{$imageString}</a>";
}
}
}
return $parser->insertStripItem($output, $parser->mStripState);
}
示例8: execute
public function execute()
{
global $wgVisualEditorNamespaces, $wgVisualEditorParsoidURL, $wgVisualEditorParsoidTimeout, $wgDevelEnvironment;
$user = $this->getUser();
$params = $this->extractRequestParams();
$page = Title::newFromText($params['page']);
if (!$page) {
$this->dieUsageMsg('invalidtitle', $params['page']);
}
if (!in_array($page->getNamespace(), $wgVisualEditorNamespaces)) {
$this->dieUsage("VisualEditor is not enabled in namespace " . $page->getNamespace(), 'novenamespace');
}
$parserParams = array();
if (isset($params['oldwt'])) {
$parserParams['oldwt'] = $params['oldwt'];
} else {
if (isset($params['oldid'])) {
$parserParams['oldid'] = $params['oldid'];
}
}
switch ($params['paction']) {
case 'parsewt':
// FIXME: Perhaps requestParsoid method should be used here
$postData = array('wt' => $params['wikitext']);
$content = Http::post($wgVisualEditorParsoidURL . '/' . urlencode($this->getApiSource()) . '/' . urlencode($page->getPrefixedDBkey()), array('postData' => $postData, 'timeout' => $wgVisualEditorParsoidTimeout, 'noProxy' => !empty($wgDevelEnvironment)));
$result = array('result' => 'success', 'content' => $content);
break;
case 'parse':
$parsed = $this->getHTML($page, $parserParams);
// Dirty hack to provide the correct context for edit notices
global $wgTitle;
// FIXME NOOOOOOOOES
$wgTitle = $page;
RequestContext::getMain()->setTitle($page);
// TODO: In MW 1.19.7 method getEditNotices does not exist so for now fallback to just an empty
// but in future figure out what's the proper backward compatibility solution.
// #back-compat
// $notices = $page->getEditNotices();
$notices = array();
$anoneditwarning = false;
$anoneditwarningMessage = $this->msg('VisualEditor-anoneditwarning');
if ($user->isAnon() && $anoneditwarningMessage->exists()) {
$notices[] = $anoneditwarningMessage->parseAsBlock();
$anoneditwarning = true;
}
if ($parsed && $parsed['restoring']) {
$notices[] = $this->msg('editingold')->parseAsBlock();
}
// Creating new page
if (!$page->exists()) {
$notices[] = $this->msg($user->isLoggedIn() ? 'newarticletext' : 'newarticletextanon', Skin::makeInternalOrExternalUrl($this->msg('helppage')->inContentLanguage()->text()))->parseAsBlock();
// Page protected from creation
if ($page->getRestrictions('create')) {
$notices[] = $this->msg('titleprotectedwarning')->parseAsBlock();
}
}
// Look at protection status to set up notices + surface class(es)
$protectedClasses = array();
if (MWNamespace::getRestrictionLevels($page->getNamespace()) !== array('')) {
// Page protected from editing
if ($page->isProtected('edit')) {
# Is the title semi-protected?
if ($page->isSemiProtected()) {
$protectedClasses[] = 'mw-textarea-sprotected';
$noticeMsg = 'semiprotectedpagewarning';
} else {
$protectedClasses[] = 'mw-textarea-protected';
# Then it must be protected based on static groups (regular)
$noticeMsg = 'protectedpagewarning';
}
$notices[] = $this->msg($noticeMsg)->parseAsBlock();
}
// Deal with cascading edit protection
list($sources, $restrictions) = $page->getCascadeProtectionSources();
if (isset($restrictions['edit'])) {
$protectedClasses[] = ' mw-textarea-cprotected';
$notice = $this->msg('cascadeprotectedwarning')->parseAsBlock() . '<ul>';
// Unfortunately there's no nice way to get only the pages which cause
// editing to be restricted
foreach ($sources as $source) {
$notice .= "<li>" . Linker::link($source) . "</li>";
}
$notice .= '</ul>';
$notices[] = $notice;
}
}
// Show notice when editing user / user talk page of a user that doesn't exist
// or who is blocked
// HACK of course this code is partly duplicated from EditPage.php :(
if ($page->getNamespace() == NS_USER || $page->getNamespace() == NS_USER_TALK) {
$parts = explode('/', $page->getText(), 2);
$targetUsername = $parts[0];
$targetUser = User::newFromName($targetUsername, false);
if (!($targetUser && $targetUser->isLoggedIn()) && !User::isIP($targetUsername)) {
// User does not exist
$notices[] = "<div class=\"mw-userpage-userdoesnotexist error\">\n" . $this->msg('userpage-userdoesnotexist', wfEscapeWikiText($targetUsername)) . "\n</div>";
}
// Some upstream code is deleted from here, more information:
// https://github.com/Wikia/app/commit/d54b481d3f6e5b092b212a2c98b2cb5452bee26c
// https://github.com/Wikia/app/commit/681e7437078206460f7c0cb1837095e656d8ba85
//.........这里部分代码省略.........
示例9: execute
//.........这里部分代码省略.........
<button type="submit" class="button search"><?php
echo wfMessage('search')->text();
?>
</button>
</div>
</div>
</form>
</li>
<li class="divider show-for-small"></li>
<li class="has-dropdown active"><a href="#"><i class="fa fa-cogs"></i></a>
<ul id="toolbox-dropdown" class="dropdown">
<?php
foreach ($this->getToolbox() as $key => $item) {
echo $this->makeListItem($key, $item);
}
?>
<?php
if ($wgForegroundFeatures['showRecentChangesUnderTools']) {
?>
<li id="n-recentchanges"><?php
echo Linker::specialLink('Recentchanges');
?>
</li><?php
}
?>
<?php
if ($wgForegroundFeatures['showHelpUnderTools']) {
?>
<li id="n-help" <?php
echo Linker::tooltip('help');
?>
><a href="<?php
echo Skin::makeInternalOrExternalUrl(wfMessage('helppage')->inContentLanguage()->text());
?>
"><?php
echo wfMessage('help')->text();
?>
</a></li><?php
}
?>
</ul>
</li>
<li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="fa fa-user"></i></a>
<ul class="dropdown">
<?php
foreach ($this->getPersonalTools() as $key => $item) {
echo $this->makeListItem($key, $item);
}
?>
</ul>
</li>
</ul>
</section>
</nav>
<?php
if ($wgForegroundFeatures['NavWrapperType'] != '0') {
echo "</div>";
}
?>
<div id="page-content">
<div class="row">
示例10: showEditForm
//.........这里部分代码省略.........
$this->showPreview($previewOutput);
} else {
$wgOut->addHTML('<div id="wikiPreview_' . htmlspecialchars($this->mvd_id) . '"></div>');
}
if ('diff' == $this->formtype) {
$this->showDiff();
}
}
$wgOut->addHTML($this->basic_html);
$wgOut->addHTML('<div style="display:inline" class="mv_advanced_edit"><br>');
// $rows = $wgUser->getIntOption( 'rows' );
// $cols = $wgUser->getIntOption( 'cols' );
// for ajax short edit area:
$rows = 3;
$cols = 40;
$ew = $wgUser->getOption('editwidth');
if ($ew) {
$ew = " style=\"width:100%\"";
} else {
$ew = '';
}
// do ajax action:
// $q = 'action=ajax';
# if ( "no" == $redirect ) { $q .= "&redirect=no"; }
// $action = $this->mTitle->escapeLocalURL( $q );
if ($editFormType == 'seq') {
$summary = wfMsg('mv_seq_summary');
} else {
$summary = wfMsg('summary');
}
$subject = wfMsg('subject');
if ($this->mvd_id == 'seq') {
$cancel = $sk->makeKnownLinkObj($this->mTitle, wfMsgExt('cancel', array('parseinline')));
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('mv_edithelpsequence'));
} else {
$cancel = '<a href="javascript:mv_disp_mvd(\'' . $this->mTitle->getDBkey() . '\',\'' . $this->mvd_id . '\');">' . wfMsgExt('cancel', array('parseinline')) . '</a>';
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
}
$edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow'));
global $wgRightsText;
// copy right here is too verbose for a ajax window
/*$copywarn = "<div id=\"editpage-copywarn\">\n" .
wfMsg( $wgRightsText ? 'copyrightwarning' : 'copyrightwarning2',
'[[' . wfMsgForContent( 'copyrightpage' ) . ']]',
$wgRightsText ) . "\n</div>";
*/
if ($wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage) {
# prepare toolbar for edit buttons
$toolbar = EditPage::getEditToolbar();
} else {
$toolbar = '';
}
// activate checkboxes if user wants them to be always active
if (!$this->preview && !$this->diff) {
# Sort out the "watch" checkbox
if ($wgUser->getOption('watchdefault')) {
# Watch all edits
$this->watchthis = true;
} elseif ($wgUser->getOption('watchcreations') && !$this->mTitle->exists()) {
# Watch creations
$this->watchthis = true;
} elseif ($this->mTitle->userIsWatching()) {
# Already watched
$this->watchthis = true;
}
if ($wgUser->getOption('minordefault')) {
示例11: GetThisWiki
/**
* Return array of links (href, text, id) for this wiki box
* Author: Inez Korczynski (inez at wikia.com)
* @return array
*/
public static final function GetThisWiki()
{
wfProfileIn(__METHOD__);
global $wgWikiaUsePHPBB;
$data = array();
$data['header'] = self::Translate('this_wiki');
$data['home']['url'] = Skin::makeMainPageUrl();
$data['home']['text'] = self::Translate('home');
if (!empty($wgWikiaUsePHPBB)) {
$data['forum']['url'] = '/forum/';
$data['forum']['text'] = self::Translate('forum');
} else {
$data['forum']['url'] = Skin::makeInternalOrExternalUrl(wfMsgForContent('forum-url'));
$data['forum']['text'] = self::Translate('forum');
}
$data['randompage']['url'] = Skin::makeSpecialUrl('Randompage');
$data['randompage']['text'] = self::Translate('randompage');
$data['help']['url'] = 'http://www.wikia.com/wiki/Help:Tutorial_1';
$data['help']['text'] = self::Translate('helpfaq');
$data['joinnow']['url'] = Skin::makeSpecialUrl('Userlogin', "type=signup");
$data['joinnow']['text'] = self::Translate('joinnow');
wfProfileOut(__METHOD__);
return $data;
}
示例12: execute
//.........这里部分代码省略.........
<?php
}
?>
<?php
if ($this->haveData('extrafields')) {
echo $this->data['extrafields'];
}
?>
<div class="mw-ui-vform-field">
<?php
if ($this->data['canremember']) {
?>
<div class="mw-ui-checkbox">
<input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
<?php
if ($this->data['remember']) {
echo 'checked="checked"';
}
?>
><label for="wpRemember">
<?php
echo $this->getMsg('userlogin-remembermypassword')->numParams($expirationDays)->escaped();
?>
</label>
</div>
<?php
}
?>
</div>
<div class="mw-ui-vform-field">
<?php
$attrs = ['id' => 'wpLoginAttempt', 'name' => 'wpLoginAttempt', 'tabindex' => '6'];
$modifiers = ['mw-ui-progressive'];
echo Html::submitButton($this->getMsg('pt-login-button')->text(), $attrs, $modifiers);
?>
</div>
<div class="mw-ui-vform-field mw-form-related-link-container" id="mw-userlogin-help">
<?php
echo Html::element('a', ['href' => Skin::makeInternalOrExternalUrl(wfMessage('helplogin-url')->inContentLanguage()->text())], $this->getMsg('userlogin-helplink2')->text());
?>
</div>
<?php
if ($this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true) {
echo Html::rawElement('div', ['class' => 'mw-ui-vform-field mw-form-related-link-container'], Linker::link(SpecialPage::getTitleFor('PasswordReset'), $this->getMsg('userlogin-resetpassword-link')->escaped()));
}
if ($this->haveData('createOrLoginHref')) {
if ($this->data['loggedin']) {
?>
<div class="mw-form-related-link-container mw-ui-vform-field">
<a href="<?php
$this->text('createOrLoginHref');
?>
" id="mw-createaccount-join" tabindex="7"><?php
$this->msg('userlogin-createanother');
?>
</a>
</div>
<?php
} else {
?>
<div id="mw-createaccount-cta" class="mw-ui-vform-field">
<?php
$this->msg('userlogin-noaccount');
?>
<a href="<?php
$this->text('createOrLoginHref');
?>
" id="mw-createaccount-join" tabindex="7" class="mw-ui-button"><?php
$this->msg('userlogin-joinproject');
?>
</a>
</div>
<?php
}
}
// Hidden fields
$fields = '';
if ($this->haveData('uselang')) {
$fields .= Html::hidden('uselang', $this->data['uselang']);
}
if ($this->haveData('token')) {
$fields .= Html::hidden('wpLoginToken', $this->data['token']);
}
if ($this->data['cansecurelogin']) {
$fields .= Html::hidden('wpForceHttps', $this->data['stickhttps']);
}
if ($this->data['cansecurelogin'] && $this->haveData('fromhttp')) {
$fields .= Html::hidden('wpFromhttp', $this->data['fromhttp']);
}
echo $fields;
?>
</form>
</div>
</div>
<?php
}
示例13: showEditForm
//.........这里部分代码省略.........
}
if (wfReadOnly()) {
$wgOut->addHTML("<strong>" . wfMsg("readonlywarning") . "</strong>");
} elseif ($isCssJsSubpage and "preview" != $formtype) {
$wgOut->addHTML(wfMsg("usercssjsyoucanpreview"));
}
if (!$newArticle && $this->mTitle->isProtected('edit')) {
if ($this->mTitle->isSemiProtected()) {
$notice = wfMsg('semiprotectedpagewarning');
if (wfEmptyMsg('semiprotectedpagewarning', $notice) || $notice == '-') {
$notice = '';
}
} else {
$notice = wfMsg('protectedpagewarning');
}
$wgOut->addHTML("<div class='article_inner'>\n ");
$wgOut->addWikiText($notice);
$wgOut->addHTML("</div>\n");
}
$q = "action=submit2&override=yes";
#if ( "no" == $redirect ) { $q .= "&redirect=no"; }
$action = $this->mTitle->escapeLocalURL($q);
if ($newArticle) {
$main = str_replace(' ', '-', wfMsg('mainpage'));
$action = str_replace("&title=" . $main, "", $action);
}
$summary = wfMsg("summary");
$subject = wfMsg("subject");
$minor = wfMsg("minoredit");
$watchthis = wfMsg("watchthis");
$save = wfMsg("savearticle");
$prev = wfMsg("showpreview");
$cancel = $sk->makeKnownLink($this->mTitle->getPrefixedText(), wfMsg("cancel"));
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
$edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow'));
$copywarn = wfMsg("copyrightwarning", $sk->makeKnownLink(wfMsg("copyrightpage")));
$minoredithtml = '';
if ($wgUser->isAllowed('minoredit')) {
$minoredithtml = "<input tabindex='11' type='checkbox' value='1' name='wpMinoredit'" . ($this->minoredit ? " checked='checked'" : "") . " accesskey='" . wfMsg('accesskey-minoredit') . "' id='wpMinoredit' />\n" . "<label for='wpMinoredit' title='" . wfMsg('tooltip-minoredit') . "'>{$minor}</label>\n";
}
$watchhtml = '';
if ($wgUser->isLoggedIn()) {
$watchhtml = "<input tabindex='12' type='checkbox' name='wpWatchthis'" . ($this->watchthis ? " checked='checked'" : "") . " accesskey=\"" . htmlspecialchars(wfMsg('accesskey-watch')) . "\" id='wpWatchthis' />\n" . "<label for='wpWatchthis' title=\"" . htmlspecialchars(wfMsg('tooltip-watch')) . "\">{$watchthis}</label>\n";
}
$checkboxhtml = $minoredithtml . $watchhtml;
$tabindex = 14;
$buttons = $this->getEditButtons($tabindex);
$footerbuttons = "";
$buttons['preview'] = "<span id='gatGuidedPreview'>{$buttons['preview']}</span>";
if ($wgUser->getOption('hidepersistantsavebar', 0) == 0) {
$footerbuttons .= "<span id='gatPSBSave'>{$buttons['save']}</span>";
$footerbuttons .= "<span id='gatPSBPreview'>{$buttons['preview']}</span>";
}
$saveBtn = str_replace('accesskey="s"', "", $buttons['save']);
$buttons['save'] = "<span id='gatGuidedSave'>{$saveBtn}</span>";
$buttonshtml = implode($buttons, "\n");
# if this is a comment, show a subject line at the top, which is also the edit summary.
# Otherwise, show a summary field at the bottom
$summarytext = htmlspecialchars($wgLang->recodeForEdit($this->summary));
# FIXME
$editsummary1 = "";
if ($wgRequest->getVal('suggestion')) {
$summarytext .= ($summarytext == "" ? "" : ", ") . wfMsg('suggestion_edit_summary');
}
if ($this->section == "new") {
$commentsubject = "{$subject}: <input tabindex='1' type='text' value=\"{$summarytext}\" name=\"wpSummary\" id='wpSummary' maxlength='200' size='60' />";
示例14: showEditForm
//.........这里部分代码省略.........
$cascadeSourcesCount = count($cascadeSources);
if ($cascadeSourcesCount > 0) {
# Explain, and list the titles responsible
foreach ($cascadeSources as $page) {
$notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
}
}
$notice .= '</div>';
$wgOut->wrapWikiMsg($notice, array('cascadeprotectedwarning', $cascadeSourcesCount));
}
if (!$this->mTitle->exists() && $this->mTitle->getRestrictions('create')) {
$wgOut->wrapWikiMsg('<div class="mw-titleprotectedwarning">$1</div>', 'titleprotectedwarning');
}
if ($this->kblength === false) {
# MeanEditor: the length will probably be different in HTML
$this->kblength = (int) (strlen($this->textbox1) / 1024);
}
if ($this->tooBig || $this->kblength > $wgMaxArticleSize) {
$wgOut->addHTML("<div class='error' id='mw-edit-longpageerror'>\n");
$wgOut->addWikiMsg('longpageerror', $wgLang->formatNum($this->kblength), $wgLang->formatNum($wgMaxArticleSize));
$wgOut->addHTML("</div>\n");
} elseif ($this->kblength > 29) {
$wgOut->addHTML("<div id='mw-edit-longpagewarning'>\n");
$wgOut->addWikiMsg('longpagewarning', $wgLang->formatNum($this->kblength));
$wgOut->addHTML("</div>\n");
}
$q = 'action=' . $this->action;
#if ( "no" == $redirect ) { $q .= "&redirect=no"; }
$action = $wgTitle->escapeLocalURL($q);
$summary = wfMsg('summary');
$subject = wfMsg('subject');
$cancel = $sk->makeKnownLink($wgTitle->getPrefixedText(), wfMsgExt('cancel', array('parseinline')));
$separator = wfMsgExt('pipe-separator', 'escapenoentities');
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
$edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow'));
global $wgRightsText;
if ($wgRightsText) {
$copywarnMsg = array('copyrightwarning', '[[' . wfMsgForContent('copyrightpage') . ']]', $wgRightsText);
} else {
$copywarnMsg = array('copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]');
}
/* MeanEditor: always disable the toolbar */
if ($wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage) {
# prepare toolbar for edit buttons
$toolbar = '';
} else {
$toolbar = '';
}
// activate checkboxes if user wants them to be always active
if (!$this->preview && !$this->diff) {
# Sort out the "watch" checkbox
if ($wgUser->getOption('watchdefault')) {
# Watch all edits
$this->watchthis = true;
} elseif ($wgUser->getOption('watchcreations') && !$this->mTitle->exists()) {
# Watch creations
$this->watchthis = true;
} elseif ($this->mTitle->userIsWatching()) {
# Already watched
$this->watchthis = true;
}
# May be overriden by request parameters
if ($wgRequest->getBool('watchthis')) {
$this->watchthis = true;
}
if ($wgUser->getOption('minordefault')) {
示例15: getFieldDefinitions
/**
* Create a HTMLForm descriptor for the core login fields.
* @param FakeAuthTemplate $template B/C data (not used but needed by getBCFieldDefinitions)
* @return array
*/
protected function getFieldDefinitions($template)
{
global $wgEmailConfirmToEdit, $wgLoginLanguageSelector;
$isLoggedIn = $this->getUser()->isLoggedIn();
$continuePart = $this->isContinued() ? 'continue-' : '';
$anotherPart = $isLoggedIn ? 'another-' : '';
$expiration = $this->getRequest()->getSession()->getProvider()->getRememberUserDuration();
$expirationDays = ceil($expiration / (3600 * 24));
$secureLoginLink = '';
if ($this->mSecureLoginUrl) {
$secureLoginLink = Html::element('a', ['href' => $this->mSecureLoginUrl, 'class' => 'mw-ui-flush-right mw-secure'], $this->msg('userlogin-signwithsecure')->text());
}
$usernameHelpLink = '';
if (!$this->msg('createacct-helpusername')->isDisabled()) {
$usernameHelpLink = Html::rawElement('span', ['class' => 'mw-ui-flush-right'], $this->msg('createacct-helpusername')->parse());
}
if ($this->isSignup()) {
$fieldDefinitions = ['statusarea' => ['type' => 'info', 'raw' => true, 'default' => Html::element('div', ['id' => 'mw-createacct-status-area']), 'weight' => -105], 'username' => ['label-raw' => $this->msg('userlogin-yourname')->escaped() . $usernameHelpLink, 'id' => 'wpName2', 'placeholder-message' => $isLoggedIn ? 'createacct-another-username-ph' : 'userlogin-yourname-ph'], 'mailpassword' => ['type' => 'check', 'label-message' => 'createaccountmail', 'name' => 'wpCreateaccountMail', 'id' => 'wpCreateaccountMail'], 'password' => ['id' => 'wpPassword2', 'placeholder-message' => 'createacct-yourpassword-ph', 'hide-if' => ['===', 'wpCreateaccountMail', '1']], 'domain' => [], 'retype' => ['baseField' => 'password', 'type' => 'password', 'label-message' => 'createacct-yourpasswordagain', 'id' => 'wpRetype', 'cssclass' => 'loginPassword', 'size' => 20, 'validation-callback' => function ($value, $alldata) {
if (empty($alldata['mailpassword']) && !empty($alldata['password'])) {
if (!$value) {
return $this->msg('htmlform-required');
} elseif ($value !== $alldata['password']) {
return $this->msg('badretype');
}
}
return true;
}, 'hide-if' => ['===', 'wpCreateaccountMail', '1'], 'placeholder-message' => 'createacct-yourpasswordagain-ph'], 'email' => ['type' => 'email', 'label-message' => $wgEmailConfirmToEdit ? 'createacct-emailrequired' : 'createacct-emailoptional', 'id' => 'wpEmail', 'cssclass' => 'loginText', 'size' => '20', 'required' => $wgEmailConfirmToEdit, 'validation-callback' => function ($value, $alldata) {
global $wgEmailConfirmToEdit;
// AuthManager will check most of these, but that will make the auth
// session fail and this won't, so nicer to do it this way
if (!$value && $wgEmailConfirmToEdit) {
// no point in allowing registration without email when email is
// required to edit
return $this->msg('noemailtitle');
} elseif (!$value && !empty($alldata['mailpassword'])) {
// cannot send password via email when there is no email address
return $this->msg('noemailcreate');
} elseif ($value && !Sanitizer::validateEmail($value)) {
return $this->msg('invalidemailaddress');
}
return true;
}, 'placeholder-message' => 'createacct-' . $anotherPart . 'email-ph'], 'realname' => ['type' => 'text', 'help-message' => $isLoggedIn ? 'createacct-another-realname-tip' : 'prefs-help-realname', 'label-message' => 'createacct-realname', 'cssclass' => 'loginText', 'size' => 20, 'id' => 'wpRealName'], 'reason' => ['type' => 'text', 'label-message' => 'createacct-reason', 'cssclass' => 'loginText', 'id' => 'wpReason', 'size' => '20', 'placeholder-message' => 'createacct-reason-ph'], 'extrainput' => [], 'createaccount' => ['type' => 'submit', 'default' => $this->msg('createacct-' . $anotherPart . $continuePart . 'submit')->text(), 'name' => 'wpCreateaccount', 'id' => 'wpCreateaccount', 'weight' => 100]];
} else {
$fieldDefinitions = ['username' => ['label-raw' => $this->msg('userlogin-yourname')->escaped() . $secureLoginLink, 'id' => 'wpName1', 'placeholder-message' => 'userlogin-yourname-ph'], 'password' => ['id' => 'wpPassword1', 'placeholder-message' => 'userlogin-yourpassword-ph'], 'domain' => [], 'extrainput' => [], 'rememberMe' => ['type' => 'check', 'name' => 'wpRemember', 'label-message' => $this->msg('userlogin-remembermypassword')->numParams($expirationDays), 'id' => 'wpRemember'], 'loginattempt' => ['type' => 'submit', 'default' => $this->msg('pt-login-' . $continuePart . 'button')->text(), 'id' => 'wpLoginAttempt', 'weight' => 100], 'linkcontainer' => ['type' => 'info', 'cssclass' => 'mw-form-related-link-container mw-userlogin-help', 'raw' => true, 'default' => Html::element('a', ['href' => Skin::makeInternalOrExternalUrl(wfMessage('helplogin-url')->inContentLanguage()->text())], $this->msg('userlogin-helplink2')->text()), 'weight' => 200], 'skipReset' => ['weight' => 110, 'flags' => []]];
}
$fieldDefinitions['username'] += ['type' => 'text', 'name' => 'wpName', 'cssclass' => 'loginText', 'size' => 20];
$fieldDefinitions['password'] += ['type' => 'password', 'name' => 'wpPassword', 'cssclass' => 'loginPassword', 'size' => 20];
if ($template->get('header') || $template->get('formheader')) {
// B/C for old extensions that haven't been converted to AuthManager (or have been
// but somebody is using the old version) and still use templates via the
// UserCreateForm/UserLoginForm hook.
// 'header' used by ConfirmEdit, CondfirmAccount, Persona, WikimediaIncubator, SemanticSignup
// 'formheader' used by MobileFrontend
$fieldDefinitions['header'] = ['type' => 'info', 'raw' => true, 'default' => $template->get('header') ?: $template->get('formheader'), 'weight' => -110];
}
if ($this->mEntryError) {
$fieldDefinitions['entryError'] = ['type' => 'info', 'default' => Html::rawElement('div', ['class' => $this->mEntryErrorType . 'box'], $this->mEntryError), 'raw' => true, 'rawrow' => true, 'weight' => -100];
}
if (!$this->showExtraInformation()) {
unset($fieldDefinitions['linkcontainer'], $fieldDefinitions['signupend']);
}
if ($this->isSignup() && $this->showExtraInformation()) {
// blank signup footer for site customization
// uses signupend-https for HTTPS requests if it's not blank, signupend otherwise
$signupendMsg = $this->msg('signupend');
$signupendHttpsMsg = $this->msg('signupend-https');
if (!$signupendMsg->isDisabled()) {
$usingHTTPS = $this->getRequest()->getProtocol() === 'https';
$signupendText = $usingHTTPS && !$signupendHttpsMsg->isBlank() ? $signupendHttpsMsg->parse() : $signupendMsg->parse();
$fieldDefinitions['signupend'] = ['type' => 'info', 'raw' => true, 'default' => Html::rawElement('div', ['id' => 'signupend'], $signupendText), 'weight' => 225];
}
}
if (!$this->isSignup() && $this->showExtraInformation()) {
$passwordReset = new PasswordReset($this->getConfig(), AuthManager::singleton());
if ($passwordReset->isAllowed($this->getUser())->isGood()) {
$fieldDefinitions['passwordReset'] = ['type' => 'info', 'raw' => true, 'cssclass' => 'mw-form-related-link-container', 'default' => Linker::link(SpecialPage::getTitleFor('PasswordReset'), $this->msg('userlogin-resetpassword-link')->escaped()), 'weight' => 230];
}
// Don't show a "create account" link if the user can't.
if ($this->showCreateAccountLink()) {
// link to the other action
$linkTitle = $this->getTitleFor($this->isSignup() ? 'Userlogin' : 'CreateAccount');
$linkq = $this->getReturnToQueryStringFragment();
// Pass any language selection on to the mode switch link
if ($wgLoginLanguageSelector && $this->mLanguage) {
$linkq .= '&uselang=' . $this->mLanguage;
}
$loggedIn = $this->getUser()->isLoggedIn();
$fieldDefinitions['createOrLogin'] = ['type' => 'info', 'raw' => true, 'linkQuery' => $linkq, 'default' => function ($params) use($loggedIn, $linkTitle) {
return Html::rawElement('div', ['id' => 'mw-createaccount' . (!$loggedIn ? '-cta' : ''), 'class' => $loggedIn ? 'mw-form-related-link-container' : 'mw-ui-vform-field'], ($loggedIn ? '' : $this->msg('userlogin-noaccount')->escaped()) . Html::element('a', ['id' => 'mw-createaccount-join' . ($loggedIn ? '-loggedin' : ''), 'href' => $linkTitle->getLocalURL($params['linkQuery']), 'class' => $loggedIn ? '' : 'mw-ui-button', 'tabindex' => 100], $this->msg($loggedIn ? 'userlogin-createanother' : 'userlogin-joinproject')->escaped()));
}, 'weight' => 235];
}
}
$fieldDefinitions = $this->getBCFieldDefinitions($fieldDefinitions, $template);
$fieldDefinitions = array_filter($fieldDefinitions);
return $fieldDefinitions;
//.........这里部分代码省略.........