当前位置: 首页>>代码示例>>PHP>>正文


PHP wfEscapeWikiText函数代码示例

本文整理汇总了PHP中wfEscapeWikiText函数的典型用法代码示例。如果您正苦于以下问题:PHP wfEscapeWikiText函数的具体用法?PHP wfEscapeWikiText怎么用?PHP wfEscapeWikiText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wfEscapeWikiText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute($par)
 {
     $this->checkPermissions();
     $this->checkReadOnly();
     list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $this->getRequest());
     $this->block = Block::newFromTarget($this->target);
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('unblockip'));
     $out->addModules('mediawiki.special');
     $form = new HTMLForm($this->getFields(), $this->getContext());
     $form->setWrapperLegendMsg('unblockip');
     $form->setSubmitCallback(array(__CLASS__, 'processUIUnblock'));
     $form->setSubmitTextMsg('ipusubmit');
     $form->addPreText($this->msg('unblockiptext')->parseAsBlock());
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_USER:
             case Block::TYPE_IP:
                 $out->addWikiMsg('unblocked', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_RANGE:
                 $out->addWikiMsg('unblocked-range', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_ID:
             case Block::TYPE_AUTO:
                 $out->addWikiMsg('unblocked-id', wfEscapeWikiText($this->target));
                 break;
         }
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:32,代码来源:SpecialUnblock.php

示例2: __construct

 function __construct(IContextSource $context, $userName = null, $search = '', $including = false, $showAll = false)
 {
     $this->setContext($context);
     $this->mIncluding = $including;
     $this->mShowAll = $showAll;
     if ($userName !== null && $userName !== '') {
         $nt = Title::newFromText($userName, NS_USER);
         $user = User::newFromName($userName, false);
         if (!is_null($nt)) {
             $this->mUserName = $nt->getText();
         }
         if (!$user || $user->isAnon() && !User::isIP($user->getName())) {
             $this->getOutput()->wrapWikiMsg("<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>", array('listfiles-userdoesnotexist', wfEscapeWikiText($userName)));
         }
     }
     if ($search !== '' && !$this->getConfig()->get('MiserMode')) {
         $this->mSearch = $search;
         $nt = Title::newFromURL($this->mSearch);
         if ($nt) {
             $dbr = wfGetDB(DB_SLAVE);
             $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike($dbr->anyString(), strtolower($nt->getDBkey()), $dbr->anyString());
         }
     }
     if (!$including) {
         if ($this->getRequest()->getText('sort', 'img_date') == 'img_date') {
             $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
         } else {
             $this->mDefaultDirection = IndexPager::DIR_ASCENDING;
         }
     } else {
         $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
     }
     parent::__construct($context);
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:34,代码来源:SpecialListfiles.php

示例3: execute

 function execute()
 {
     global $wgOut, $wgUser;
     $wgOut->setPagetitle(wfMsgHtml("mergehistory"));
     if ($this->mTargetID && $this->mDestID && $this->mAction == "submit" && $this->mMerge) {
         return $this->merge();
     }
     if (!$this->mSubmitted) {
         $this->showMergeForm();
         return;
     }
     $errors = array();
     if (!$this->mTargetObj instanceof Title) {
         $errors[] = wfMsgExt('mergehistory-invalid-source', array('parse'));
     } elseif (!$this->mTargetObj->exists()) {
         $errors[] = wfMsgExt('mergehistory-no-source', array('parse'), wfEscapeWikiText($this->mTargetObj->getPrefixedText()));
     }
     if (!$this->mDestObj instanceof Title) {
         $errors[] = wfMsgExt('mergehistory-invalid-destination', array('parse'));
     } elseif (!$this->mDestObj->exists()) {
         $errors[] = wfMsgExt('mergehistory-no-destination', array('parse'), wfEscapeWikiText($this->mDestObj->getPrefixedText()));
     }
     if ($this->mTargetObj->equals($this->mDestObj)) {
         $errors[] = wfMsgExt('mergehistory-same-destination', array('parse'));
     }
     if (count($errors)) {
         $this->showMergeForm();
         $wgOut->addHTML(implode("\n", $errors));
     } else {
         $this->showHistory();
     }
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:32,代码来源:SpecialMergeHistory.php

示例4: Html5SetSpamMessage

function Html5SetSpamMessage($match = false)
{
    Html5editor::$spam_message = wfMsg('spamprotectiontext');
    if ($match) {
        Html5editor::$spam_message .= wfMsgExt('spamprotectionmatch', 'parse', wfEscapeWikiText($match));
    }
    return true;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:8,代码来源:Html5editor.php

示例5: makeSafe

 /**
  * This function limits the possible charactes passed as template keys and
  * values to letters, numbers, hypens and underscores. The function also
  * performs standard escaping of the passed values.
  *
  * @param $string The unsafe string to escape and check for invalid characters
  * @return mixed|String A string matching the regex or an empty string
  */
 function makeSafe($string)
 {
     $num = preg_match('([a-zA-Z0-9_-]+)', $string, $matches);
     if ($num == 1) {
         # theoretically this is overkill, but better safe than sorry
         return wfEscapeWikiText(htmlspecialchars($matches[0]));
     }
     return '';
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:17,代码来源:FundraiserLandingPage.body.php

示例6: execute

 function execute($params = null)
 {
     global $IP, $wgWikiaLocalSettingsPath;
     /*  go with each supplied wiki and delete the supplied article
     			load all configs for particular wikis before doing so
     			(from wikifactory, not by _obsolete_ maintenance scripts
     			and from LocalSettings as worked on fps)
     		 */
     $this->mTaskID = $params->task_id;
     $oUser = User::newFromId($params->task_user_id);
     if ($oUser instanceof User) {
         $oUser->load();
         $this->mUser = $oUser->getName();
     } else {
         $this->log("Invalid user - id: " . $params->task_user_id);
         return true;
     }
     $data = unserialize($params->task_arguments);
     foreach ($data['page_list'] as $imageData) {
         $retval = "";
         list($wikiId, $imageId) = $imageData;
         $dbname = WikiFactory::getWikiByID($wikiId);
         if (!$dbname) {
             continue;
         }
         $title = GlobalTitle::newFromId($imageId, $wikiId);
         if (!is_object($title)) {
             $this->log('Apparently the article does not exist anymore');
             continue;
         }
         $city_url = WikiFactory::getVarValueByName("wgServer", $wikiId);
         if (empty($city_url)) {
             continue;
         }
         $city_path = WikiFactory::getVarValueByName("wgScript", $wikiId);
         $city_lang = WikiFactory::getVarValueByName("wgLanguageCode", $wikiId);
         $reason = wfMsgExt('imagereview-reason', array('language' => $city_lang));
         $sCommand = "perl /usr/wikia/backend/bin/run_maintenance --id={$wikiId} --script=wikia/deleteOn.php ";
         $sCommand .= "-- ";
         $sCommand .= "-u " . escapeshellarg($this->mUser) . " ";
         $sCommand .= "-t " . escapeshellarg($title->getPrefixedText()) . " ";
         if ($reason) {
             $sCommand .= "-r " . escapeshellarg($reason) . " ";
         }
         $actual_title = wfShellExec($sCommand, $retval);
         if ($retval) {
             $this->addLog('Article deleting error! (' . $city_url . '). Error code returned: ' . $retval . ' Error was: ' . $actual_title);
         } else {
             $this->addLog('Removed: <a href="' . $city_url . $city_path . '?title=' . wfEscapeWikiText($actual_title) . '">' . $city_url . $city_path . '?title=' . $actual_title . '</a>');
         }
         $this->flagUser($imageId, $wikiId);
         $this->flagWiki($wikiId);
     }
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:55,代码来源:ImageReviewTask.php

示例7: wfSpecialImport

/**
 * Constructor
 */
function wfSpecialImport($page = '')
{
    global $wgUser, $wgOut, $wgLang, $wgRequest, $wgTitle;
    global $wgImportSources;
    ###
    #	$wgOut->addWikiText( "Special:Import is not ready for this beta release, sorry." );
    #	return;
    ###
    if ($wgRequest->wasPosted() && $wgRequest->getVal('action') == 'submit') {
        switch ($wgRequest->getVal("source")) {
            case "upload":
                if ($wgUser->isAllowed('importupload')) {
                    $source = ImportStreamSource::newFromUpload("xmlimport");
                } else {
                    return $wgOut->permissionRequired('importupload');
                }
                break;
            case "interwiki":
                $source = ImportStreamSource::newFromInterwiki($wgRequest->getVal("interwiki"), $wgRequest->getText("frompage"));
                break;
            default:
                $source = new WikiError("Unknown import source type");
        }
        if (WikiError::isError($source)) {
            $wgOut->addWikiText(wfEscapeWikiText($source->getMessage()));
        } else {
            $importer = new WikiImporter($source);
            $result = $importer->doImport();
            if (WikiError::isError($result)) {
                $wgOut->addWikiText(wfMsg("importfailed", wfEscapeWikiText($result->getMessage())));
            } else {
                # Success!
                $wgOut->addWikiText(wfMsg("importsuccess"));
            }
        }
    }
    $action = $wgTitle->escapeLocalUrl('action=submit');
    if ($wgUser->isAllowed('importupload')) {
        $wgOut->addWikiText(wfMsg("importtext"));
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('upload') . "</legend>\n\t<form enctype='multipart/form-data' method='post' action=\"{$action}\">\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='upload' />\n\t\t<input type='hidden' name='MAX_FILE_SIZE' value='2000000' />\n\t\t<input type='file' name='xmlimport' value='' size='30' />\n\t\t<input type='submit' value='" . wfMsgHtml("uploadbtn") . "'/>\n\t</form>\n</fieldset>\n");
    } else {
        if (empty($wgImportSources)) {
            $wgOut->addWikiText(wfMsg('importnosources'));
        }
    }
    if (!empty($wgImportSources)) {
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('importinterwiki') . "</legend>\n\t<form method='post' action=\"{$action}\">\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='interwiki' />\n\t\t<select name='interwiki'>\n");
        foreach ($wgImportSources as $interwiki) {
            $iw = htmlspecialchars($interwiki);
            $wgOut->addHTML("<option value=\"{$iw}\">{$iw}</option>\n");
        }
        $wgOut->addHTML("\n\t\t</select>\n\t\t<input name='frompage' />\n\t\t<input type='submit' />\n\t</form>\n</fieldset>\n");
    }
}
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:57,代码来源:SpecialImport.php

示例8: format

 /**
  * @see ValueFormatter::format
  *
  * @param MonolingualTextValue $value
  *
  * @throws InvalidArgumentException
  * @return string HTML
  */
 public function format($value)
 {
     if (!$value instanceof MonolingualTextValue) {
         throw new InvalidArgumentException('Data value type mismatch. Expected a MonolingualTextValue.');
     }
     $text = $value->getText();
     $languageCode = $value->getLanguageCode();
     $languageName = $this->languageNameLookup->getName($languageCode);
     $msg = wfMessage('wikibase-monolingualtext')->params(wfEscapeWikiText($text), wfEscapeWikiText($languageCode), wfEscapeWikiText($languageName));
     return $msg->parse();
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:19,代码来源:MonolingualHtmlFormatter.php

示例9: execute

 /**
  * Main execution function
  *
  * @param $par Mixed: Parameters passed to the page
  */
 public function execute($par)
 {
     $out = $this->getOutput();
     $title = ShortUrlUtils::decodeURL($par);
     if ($title !== false) {
         $out->redirect($title->getFullURL(), '301');
     } else {
         $parEsc = wfEscapeWikiText($par);
         $out->showErrorPage('shorturl-not-found-title', 'shorturl-not-found-message', array($parEsc));
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:16,代码来源:SpecialShortUrl.php

示例10: formatSnak

 /**
  * @see SnakFormatter::format
  *
  * Formats the given Snak as an wikitext link to an authoritative resource.
  * The URL of that link is determined using a SnakUrlExpander.
  * If the snak could not be expanded into a URL, the identifier is returned as simple text.
  *
  * @param Snak $snak
  *
  * @throws ParameterTypeException if $snak is not a PropertyValueSnak, or if $snak->getDataValue()
  * does not return a StringValue.
  * @return string Wikitext
  */
 public function formatSnak(Snak $snak)
 {
     Assert::parameterType('Wikibase\\DataModel\\Snak\\PropertyValueSnak', $snak, '$snak');
     /** @var PropertyValueSnak $snak */
     $id = $snak->getDataValue()->getValue();
     $url = $this->urlExpander->expandUrl($snak);
     if ($url === null) {
         return wfEscapeWikiText($id);
     } else {
         return '[' . $this->escapeWikitextInUrl($url) . ' ' . wfEscapeWikiText($id) . ']';
     }
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:25,代码来源:WikitextExternalIdentifierFormatter.php

示例11: delete

 public function delete($pageList, $suppress = false)
 {
     global $IP;
     $user = \User::newFromId($this->createdBy);
     $userName = $user->getName();
     $articlesDeleted = 0;
     foreach ($pageList as $imageData) {
         list($wikiId, $imageId) = $imageData;
         if (!\WikiFactory::isPublic($wikiId)) {
             $this->notice('wiki has been disabled', ['wiki_id' => $wikiId]);
             continue;
         }
         $dbname = \WikiFactory::getWikiByID($wikiId);
         if (!$dbname) {
             $this->warning('did not find database', ['wiki_id' => $wikiId]);
             continue;
         }
         $cityUrl = \WikiFactory::getVarValueByName('wgServer', $wikiId);
         if (empty($cityUrl)) {
             $this->warning('could not determine city url', ['wiki_id' => $wikiId]);
             continue;
         }
         $cityLang = \WikiFactory::getVarValueByName('wgLanguageCode', $wikiId);
         $reason = wfMsgExt('imagereview-reason', ['language' => $cityLang]);
         $command = "SERVER_ID={$wikiId} php {$IP}/maintenance/wikia/deleteOn.php" . ' -u ' . escapeshellarg($userName) . ' --id ' . $imageId;
         if ($reason) {
             $command .= ' -r ' . escapeshellarg($reason);
         }
         if ($suppress) {
             $command .= ' -s';
         }
         $title = wfShellExec($command, $exitStatus);
         if ($exitStatus !== 0) {
             $this->error('article deletion error', ['city_url' => $cityUrl, 'exit_status' => $exitStatus, 'error' => $title]);
             continue;
         }
         $cityPath = \WikiFactory::getVarValueByName('wgScript', $wikiId);
         $escapedTitle = wfEscapeWikiText($title);
         $this->info('removed image', ['link' => "{$cityUrl}{$cityPath}?title={$escapedTitle}", 'title' => $escapedTitle]);
         ++$articlesDeleted;
     }
     $success = $articlesDeleted == count($pageList);
     if (!$success) {
         $this->sendNotification();
     }
     return $success;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:47,代码来源:ImageReviewTask.class.php

示例12: show

 function show()
 {
     global $wgOut;
     $wgOut->setRobotpolicy('noindex,nofollow');
     if (is_null($this->mTitle) || !$this->mTitle->exists() || $this->mTitle->getNamespace() == NS_MEDIAWIKI) {
         $wgOut->showFatalError(wfMsg('badarticleerror'));
         return;
     }
     if ($this->save()) {
         $wgOut->redirect($this->mTitle->getFullUrl());
         return;
     }
     $wgOut->setPageTitle(wfMsg('confirmprotect'));
     $wgOut->setSubtitle(wfMsg('protectsub', $this->mTitle->getPrefixedText()));
     $wgOut->addWikiText(wfMsg($this->disabled ? "protect-viewtext" : "protect-text", wfEscapeWikiText($this->mTitle->getPrefixedText())));
     $wgOut->addHTML($this->buildForm());
     $this->showLogExtract($wgOut);
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:18,代码来源:ProtectionForm.php

示例13: listForm

 function listForm($username, $reason)
 {
     global $wgUser, $wgOut, $wgLang;
     $pages = $this->getNewPages($username);
     $escapedName = wfEscapeWikiText($username);
     if (count($pages) == 0) {
         $wgOut->addWikiText(wfMsg('nuke-nopages', $escapedName));
         return $this->promptForm();
     }
     $wgOut->addWikiText(wfMsg('nuke-list', $escapedName));
     $nuke = Title::makeTitle(NS_SPECIAL, 'Nuke');
     $submit = wfElement('input', array('type' => 'submit', 'value' => wfMsgHtml('nuke-submit-delete')));
     $wgOut->addHTML(wfElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post'), null) . "\n<div>" . wfMsgHtml('deletecomment') . ': ' . wfElement('input', array('name' => 'wpReason', 'value' => $reason, 'size' => 60)) . "</div><br />" . $submit . wfElement('input', array('type' => 'hidden', 'name' => 'wpEditToken', 'value' => $wgUser->editToken())) . "\n<ul>\n");
     $sk =& $wgUser->getSkin();
     foreach ($pages as $info) {
         list($title, $edits) = $info;
         $wgOut->addHTML('<li>' . wfElement('input', array('type' => 'checkbox', 'name' => "pages[]", 'value' => $title->getPrefixedDbKey(), 'checked' => 'checked')) . '&nbsp;' . $sk->makeKnownLinkObj($title) . '&nbsp;(' . $sk->makeKnownLinkObj($title, wfMsgExt('nchanges', array('parsemag'), $wgLang->formatNum($edits)), 'action=history') . ")</li>\n");
     }
     $wgOut->addHTML("</ul>\n{$submit}</form>");
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:20,代码来源:SpecialNuke.php

示例14: execute

 public function execute($par)
 {
     $this->checkPermissions();
     $this->checkReadOnly();
     list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $this->getRequest());
     $this->block = Block::newFromTarget($this->target);
     if ($this->target instanceof User) {
         # Set the 'relevant user' in the skin, so it displays links like Contributions,
         # User logs, UserRights, etc.
         $this->getSkin()->setRelevantUser($this->target);
     }
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('unblockip'));
     $out->addModules(['mediawiki.special', 'mediawiki.userSuggest']);
     $form = new HTMLForm($this->getFields(), $this->getContext());
     $form->setWrapperLegendMsg('unblockip');
     $form->setSubmitCallback([__CLASS__, 'processUIUnblock']);
     $form->setSubmitTextMsg('ipusubmit');
     $form->addPreText($this->msg('unblockiptext')->parseAsBlock());
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_IP:
                 $out->addWikiMsg('unblocked-ip', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_USER:
                 $out->addWikiMsg('unblocked', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_RANGE:
                 $out->addWikiMsg('unblocked-range', wfEscapeWikiText($this->target));
                 break;
             case Block::TYPE_ID:
             case Block::TYPE_AUTO:
                 $out->addWikiMsg('unblocked-id', wfEscapeWikiText($this->target));
                 break;
         }
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:39,代码来源:SpecialUnblock.php

示例15: showCurrent

 private function showCurrent()
 {
     global $wgOut, $wgMemc;
     $wgOut->addHTML("<fieldset>\n");
     $wgOut->addHTML("<legend>CurrentValue</legend>\n");
     $sysopId = $wgMemc->get(wfMemcKey("last-sysop-id"));
     if ($sysopId) {
         $this->mSysop = User::newFromId($sysopId);
         $sysopName = wfEscapeWikiText($this->mSysop->getName());
         $groups = $this->mSysop->getEffectiveGroups();
         $wgOut->addHTML("ID: <code>" . $sysopId . "</code><br/>");
         $wgOut->addHTML("Name: <code>" . $sysopName . "</code><br/>");
         $wgOut->addHTML("Groups: <code>" . implode(", ", $groups) . "</code><br/>");
         $action_url = $this->mTitle->getFullURL();
         $wgOut->addHTML("<form action='{$action_url}' method='post'>\n");
         $wgOut->addHTML("<input type='hidden' name='method' value='clear' />\n");
         $wgOut->addHTML("<input type='submit' value='clear' />\n");
         $wgOut->addHTML("</form>\n");
     } else {
         $wgOut->addHTML("<i>n/a</i>");
     }
     $wgOut->addHTML("</fieldset>\n");
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:HAWelcomeEdit.body.php


注:本文中的wfEscapeWikiText函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。