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


PHP Sanitizer::escapeHtmlAllowEntities方法代码示例

本文整理汇总了PHP中Sanitizer::escapeHtmlAllowEntities方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitizer::escapeHtmlAllowEntities方法的具体用法?PHP Sanitizer::escapeHtmlAllowEntities怎么用?PHP Sanitizer::escapeHtmlAllowEntities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanitizer的用法示例。


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

示例1: formatValue

 function formatValue($field, $value)
 {
     global $wgLang;
     switch ($field) {
         case 'am_title':
             $title = Title::makeTitle(NS_MEDIAWIKI, $value . $this->suffix);
             $talk = Title::makeTitle(NS_MEDIAWIKI_TALK, $value . $this->suffix);
             if ($this->mCurrentRow->am_customised) {
                 $title = Linker::linkKnown($title, $wgLang->lcfirst($value));
             } else {
                 $title = Linker::link($title, $wgLang->lcfirst($value), array(), array(), array('broken'));
             }
             if ($this->mCurrentRow->am_talk_exists) {
                 $talk = Linker::linkKnown($talk, $this->talk);
             } else {
                 $talk = Linker::link($talk, $this->talk, array(), array(), array('broken'));
             }
             return $title . ' (' . $talk . ')';
         case 'am_default':
         case 'am_actual':
             return Sanitizer::escapeHtmlAllowEntities($value, ENT_QUOTES);
     }
     return '';
 }
开发者ID:namrenni,项目名称:mediawiki,代码行数:24,代码来源:SpecialAllmessages.php

示例2: formatComment

 /**
  * This function is called by all recent changes variants, by the page history,
  * and by the user contributions list. It is responsible for formatting edit
  * summaries. It escapes any HTML in the summary, but adds some CSS to format
  * auto-generated comments (from section editing) and formats [[wikilinks]].
  *
  * @author Erik Moeller <moeller@scireview.de>
  *
  * Note: there's not always a title to pass to this function.
  * Since you can't set a default parameter for a reference, I've turned it
  * temporarily to a value pass. Should be adjusted further. --brion
  *
  * @param string $comment
  * @param Title|null $title Title object (to generate link to the section in autocomment)
  *  or null
  * @param bool $local Whether section links should refer to local page
  * @param string|null $wikiId Id (as used by WikiMap) of the wiki to generate links to.
  *  For use with external changes.
  *
  * @return mixed|string
  */
 public static function formatComment($comment, $title = null, $local = false, $wikiId = null)
 {
     # Sanitize text a bit:
     $comment = str_replace("\n", " ", $comment);
     # Allow HTML entities (for bug 13815)
     $comment = Sanitizer::escapeHtmlAllowEntities($comment);
     # Render autocomments and make links:
     $comment = self::formatAutocomments($comment, $title, $local, $wikiId);
     $comment = self::formatLinksInComment($comment, $title, $local, $wikiId);
     return $comment;
 }
开发者ID:paladox,项目名称:2,代码行数:32,代码来源:Linker.php

示例3: view

	/**
	 * View page action handler.
	 */
	public function view() {
		global $wgOut, $wgUser, $wgContLang, $wgFeed, $wgWikilogFeedClasses;

		# Get skin
		$skin = $wgUser->getSkin();

		if ( $this->mItem ) {
			$params = $this->mItem->getMsgParams( true );

			# Set page subtitle
			$subtitleTxt = wfMsgExt( 'wikilog-entry-sub',
				array( 'parsemag', 'content' ),
				$params
			);
			if ( !empty( $subtitleTxt ) ) {
				$wgOut->setSubtitle( $wgOut->parse( $subtitleTxt ) );
			}

			# Display draft notice.
			if ( !$this->mItem->getIsPublished() ) {
				$wgOut->wrapWikiMsg( '<div class="mw-warning">$1</div>', array( 'wikilog-reading-draft' ) );
			}

			# Item page header.
			$headerTxt = wfMsgExt( 'wikilog-entry-header',
				array( 'parse', 'content' ),
				$params
			);
			if ( !empty( $headerTxt ) ) {
				$wgOut->addHtml( WikilogUtils::wrapDiv( 'wl-entry-header', $headerTxt ) );
			}

			# Display article.
			parent::view();

			# Override page title.
			# NOTE (MW1.16+): Must come after parent::view().
			$fullPageTitle = wfMsg( 'wikilog-title-item-full',
					$this->mItem->mName,
					$this->mItem->mParentTitle->getPrefixedText()
			);
			$wgOut->setPageTitle( Sanitizer::escapeHtmlAllowEntities( $this->mItem->mName ) );
			$wgOut->setHTMLTitle( wfMsg( 'pagetitle', $fullPageTitle ) );

			# Item page footer.
			$footerTxt = wfMsgExt( 'wikilog-entry-footer',
				array( 'parse', 'content' ),
				$params
			);
			if ( !empty( $footerTxt ) ) {
				$wgOut->addHtml( WikilogUtils::wrapDiv( 'wl-entry-footer', $footerTxt ) );
			}

			# Add feed links.
			$links = array();
			if ( $wgFeed ) {
				foreach ( $wgWikilogFeedClasses as $format => $class ) {
					$wgOut->addLink( array(
						'rel' => 'alternate',
						'type' => "application/{$format}+xml",
						'title' => wfMsgExt(
							"page-{$format}-feed",
							array( 'content', 'parsemag' ),
							$this->mItem->mParentTitle->getPrefixedText()
						),
						'href' => $this->mItem->mParentTitle->getLocalUrl( "feed={$format}" )
					) );
				}
			}
		} else {
			# Display article.
			parent::view();
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:77,代码来源:WikilogItemPage.php

示例4: wfMsgExt

/**
 * Returns message in the requested format
 * @param $key String: key of the message
 * @param $options Array: processing rules. Can take the following options:
 *   <i>parse</i>: parses wikitext to HTML
 *   <i>parseinline</i>: parses wikitext to HTML and removes the surrounding
 *       p's added by parser or tidy
 *   <i>escape</i>: filters message through htmlspecialchars
 *   <i>escapenoentities</i>: same, but allows entity references like &#160; through
 *   <i>replaceafter</i>: parameters are substituted after parsing or escaping
 *   <i>parsemag</i>: transform the message using magic phrases
 *   <i>content</i>: fetch message for content language instead of interface
 * Also can accept a single associative argument, of the form 'language' => 'xx':
 *   <i>language</i>: Language object or language code to fetch message for
 *       (overriden by <i>content</i>).
 * Behavior for conflicting options (e.g., parse+parseinline) is undefined.
 *
 * @return String
 */
function wfMsgExt($key, $options)
{
    $args = func_get_args();
    array_shift($args);
    array_shift($args);
    $options = (array) $options;
    foreach ($options as $arrayKey => $option) {
        if (!preg_match('/^[0-9]+|language$/', $arrayKey)) {
            # An unknown index, neither numeric nor "language"
            wfWarn("wfMsgExt called with incorrect parameter key {$arrayKey}", 1, E_USER_WARNING);
        } elseif (preg_match('/^[0-9]+$/', $arrayKey) && !in_array($option, array('parse', 'parseinline', 'escape', 'escapenoentities', 'replaceafter', 'parsemag', 'content'))) {
            # A numeric index with unknown value
            wfWarn("wfMsgExt called with incorrect parameter {$option}", 1, E_USER_WARNING);
        }
    }
    if (in_array('content', $options, true)) {
        $forContent = true;
        $langCode = true;
        $langCodeObj = null;
    } elseif (array_key_exists('language', $options)) {
        $forContent = false;
        $langCode = wfGetLangObj($options['language']);
        $langCodeObj = $langCode;
    } else {
        $forContent = false;
        $langCode = false;
        $langCodeObj = null;
    }
    $string = wfMsgGetKey($key, true, $langCode, false);
    if (!in_array('replaceafter', $options, true)) {
        $string = wfMsgReplaceArgs($string, $args);
    }
    $messageCache = MessageCache::singleton();
    if (in_array('parse', $options, true)) {
        $string = $messageCache->parse($string, null, true, !$forContent, $langCodeObj)->getText();
    } elseif (in_array('parseinline', $options, true)) {
        $string = $messageCache->parse($string, null, true, !$forContent, $langCodeObj)->getText();
        $m = array();
        if (preg_match('/^<p>(.*)\\n?<\\/p>\\n?$/sU', $string, $m)) {
            $string = $m[1];
        }
    } elseif (in_array('parsemag', $options, true)) {
        $string = $messageCache->transform($string, !$forContent, $langCodeObj);
    }
    if (in_array('escape', $options, true)) {
        $string = htmlspecialchars($string);
    } elseif (in_array('escapenoentities', $options, true)) {
        $string = Sanitizer::escapeHtmlAllowEntities($string);
    }
    if (in_array('replaceafter', $options, true)) {
        $string = wfMsgReplaceArgs($string, $args);
    }
    return $string;
}
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:73,代码来源:GlobalFunctions.php

示例5: foreach

">
				<?php 
    foreach ($categoriesSet as $category) {
        ?>
						<label>
							<input type="checkbox"
								value="<?php 
        echo Sanitizer::encodeAttribute($category['id']);
        ?>
"
								data-short="<?php 
        echo Sanitizer::encodeAttribute($category['short']);
        ?>
">
							<span><?php 
        echo Sanitizer::escapeHtmlAllowEntities($category['name']);
        ?>
</span>
						</label>
				<?php 
    }
    ?>
					</div>
			<?php 
}
?>
				</div>

				<nav class="back-controls">
					<input type="button" value="<?php 
echo wfMessage('cnw-back')->escaped();
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:CreateNewWiki_Index.php

示例6: formatValue

 function formatValue($field, $value)
 {
     switch ($field) {
         case 'am_title':
             $title = Title::makeTitle(NS_MEDIAWIKI, $value . $this->suffix);
             $talk = Title::makeTitle(NS_MEDIAWIKI_TALK, $value . $this->suffix);
             $translation = Linker::makeExternalLink('https://translatewiki.net/w/i.php?' . wfArrayToCgi(array('title' => 'Special:SearchTranslations', 'group' => 'mediawiki', 'grouppath' => 'mediawiki', 'query' => 'language:' . $this->getLanguage()->getCode() . '^25 ' . 'messageid:"MediaWiki:' . $value . '"^10 "' . $this->msg($value)->inLanguage('en')->plain() . '"')), $this->msg('allmessages-filter-translate')->text());
             if ($this->mCurrentRow->am_customised) {
                 $title = Linker::linkKnown($title, $this->getLanguage()->lcfirst($value));
             } else {
                 $title = Linker::link($title, $this->getLanguage()->lcfirst($value), array(), array(), array('broken'));
             }
             if ($this->mCurrentRow->am_talk_exists) {
                 $talk = Linker::linkKnown($talk, $this->talk);
             } else {
                 $talk = Linker::link($talk, $this->talk, array(), array(), array('broken'));
             }
             return $title . ' ' . $this->msg('parentheses')->rawParams($talk)->escaped() . ' ' . $this->msg('parentheses')->rawParams($translation)->escaped();
         case 'am_default':
         case 'am_actual':
             return Sanitizer::escapeHtmlAllowEntities($value, ENT_QUOTES);
     }
     return '';
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:24,代码来源:SpecialAllMessages.php

示例7: getProfileTop

    /**
     * Get the header for the social profile page, which includes the user's
     * points and user level (if enabled in the site configuration) and lots
     * more.
     *
     * @param $user_id Integer: user ID
     * @param $user_name String: user name
     */
    function getProfileTop($user_id, $user_name)
    {
        global $wgOut, $wgUser, $wgLang;
        global $wgUserLevels;
        $stats = new UserStats($user_id, $user_name);
        $stats_data = $stats->getUserStats();
        $user_level = new UserLevel($stats_data['points']);
        $level_link = Title::makeTitle(NS_HELP, wfMessage('user-profile-userlevels-link')->inContentLanguage()->text());
        $this->initializeProfileData($user_name);
        $profile_data = $this->profile_data;
        // Variables and other crap
        $page_title = $this->getTitle()->getText();
        $title_parts = explode('/', $page_title);
        $user = $title_parts[0];
        $id = User::idFromName($user);
        $user_safe = urlencode($user);
        // Safe urls
        $add_relationship = SpecialPage::getTitleFor('AddRelationship');
        $remove_relationship = SpecialPage::getTitleFor('RemoveRelationship');
        $give_gift = SpecialPage::getTitleFor('GiveGift');
        $send_board_blast = SpecialPage::getTitleFor('SendBoardBlast');
        $update_profile = SpecialPage::getTitleFor('UpdateProfile');
        $watchlist = SpecialPage::getTitleFor('Watchlist');
        $contributions = SpecialPage::getTitleFor('Contributions', $user);
        $send_message = SpecialPage::getTitleFor('UserBoard');
        $upload_avatar = SpecialPage::getTitleFor('UploadAvatar');
        $user_page = Title::makeTitle(NS_USER, $user);
        $user_social_profile = Title::makeTitle(NS_USER_PROFILE, $user);
        $user_wiki = Title::makeTitle(NS_USER_WIKI, $user);
        $us = new UserStatus($this->user);
        $city = $us->getCity();
        $city = Sanitizer::escapeHtmlAllowEntities($city);
        $birthday = $us->getBirthday();
        $status = $us->getStatus();
        $status = Sanitizer::escapeHtmlAllowEntities($status);
        $gender = $us->getGender();
        if ($gender == 'male') {
            $genderIcon = '♂';
            $gendertext = '他';
        } elseif ($gender == 'female') {
            $genderIcon = '♀';
            $gendertext = '她';
        } else {
            $genderIcon = '♂/♀';
            $gendertext = 'TA';
        }
        if ($this->isOwner()) {
            $gendertext = '你';
        }
        if ($id != 0) {
            $relationship = UserRelationship::getUserRelationshipByID($id, $wgUser->getID());
        }
        $avatar = new wAvatar($this->user_id, 'l');
        wfDebug('profile type: ' . $profile_data['user_page_type'] . "\n");
        $output = '';
        //get more
        $target = SpecialPage::getTitleFor('ShowFollowedSites');
        $query = array('user_id' => $wgUser->getId(), 'target_user_id' => $this->user_id);
        $mailVerify = $wgUser->getEmailAuthenticationTimestamp();
        if ($mailVerify == NULL) {
            $href = "/wiki/Special:ConfirmEmail";
        } else {
            $href = "/wiki/Special:UploadAvatar";
        }
        $output .= '<div id="profile-right" class="col-md-6 col-sm-12 col-xs-12">';
        $output .= '<div id="profile-title-container">
				<h1 id="profile-title">
				<div id="profile-image">' . ($this->isOwner() ? '<div class="profile-image-container crop-headimg" id="crop-avatar"><div class="avatar-view upload-tool" title="上传头像">' . $avatar->getOwnerAvatarURL() . '</div>' . $this->cropModal() . '</div>' : $avatar->getAvatarURL()) . '</div>' . $user_name . '</h1></div>';
        $output .= '<div class="modal fade watch-url" tabindex="-1" role="dialog" aria-labelledby="mySmModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-sm">
                        <div class="modal-content">
                          <div class="modal-header">
                              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                              <h4 class="modal-title" id="gridSystemModalLabel">' . $gendertext . '关注的wiki</h4>
                          </div>
                            <div class="modal-body">
	                            <div class="list-group">
								</div>
								' . Linker::LinkKnown($target, '<i class="fa fa-arrows-alt"></i> 全部', array('type' => 'button', 'class' => 'btn btn-default'), $query) . '
							</div>
                        </div>
                      </div>
                    </div>';
        // Show the user's level and the amount of points they have if
        // UserLevels has been configured contributions
        $notice = SpecialPage::getTitleFor('ViewFollows');
        $contributions = SpecialPage::getTitleFor('Contributions');
        $output .= '<div>
					    <ul class="user-follow-msg">
					        <li><h5>编辑</h5>' . Linker::link($contributions, $stats_data['edits'], array(), array('target' => $user, 'contribs' => 'user')) . '</li>
					        <li><h4>|</h4></li>
					        <li><h5>关注</h5>' . Linker::link($notice, UserUserFollow::getFollowingCount(User::newFromName($user)), array('id' => 'user-following-count'), array('user' => $user, 'rel_type' => 1)) . '</li>
//.........这里部分代码省略.........
开发者ID:volvor,项目名称:SocialProfile,代码行数:101,代码来源:UserProfilePage.php

示例8: formatSubject

 static function formatSubject($s)
 {
     # Sanitize text a bit:
     $s = str_replace("\n", " ", $s);
     # Allow HTML entities
     $s = Sanitizer::escapeHtmlAllowEntities($s);
     # Render links:
     return Linker::formatLinksInComment($s, null, false);
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:9,代码来源:View.php

示例9: formatBlockStatus

 /**
  * @param $row
  * @return String
  */
 private function formatBlockStatus($row)
 {
     $additionalHtml = '';
     if (isset($row['blocked']) && $row['blocked']) {
         $flags = array();
         foreach (array('anononly', 'nocreate', 'noautoblock', 'noemail', 'nousertalk') as $option) {
             if ($row['block-' . $option]) {
                 $flags[] = $option;
             }
         }
         $flags = implode(',', $flags);
         $optionMessage = BlockLogFormatter::formatBlockFlags($flags, $this->getLanguage());
         if ($row['block-expiry'] == 'infinity') {
             $text = $this->msg('centralauth-admin-blocked2-indef')->parse();
         } else {
             $expiry = $this->getLanguage()->timeanddate($row['block-expiry'], true);
             $expiryd = $this->getLanguage()->date($row['block-expiry'], true);
             $expiryt = $this->getLanguage()->time($row['block-expiry'], true);
             $text = $this->msg('centralauth-admin-blocked2', $expiry, $expiryd, $expiryt)->parse();
         }
         if ($flags) {
             $additionalHtml .= ' ' . $optionMessage;
         }
         if ($row['block-reason']) {
             $reason = Sanitizer::escapeHtmlAllowEntities($row['block-reason']);
             $reason = Linker::formatLinksInComment($reason, null, false, $row['wiki']);
             $msg = $this->msg('centralauth-admin-blocked-reason');
             $msg->rawParams('<span class="plainlinks">' . $reason . '</span>');
             $additionalHtml .= ' ' . $msg->parse();
         }
     } else {
         $text = $this->msg('centralauth-admin-notblocked')->parse();
     }
     return self::foreignLink($row['wiki'], 'Special:Log/block', $text, $this->msg('centralauth-admin-blocklog')->text(), 'page=User:' . urlencode($this->mUserName)) . $additionalHtml;
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:39,代码来源:SpecialCentralAuth.php

示例10: testEscapeHtmlAllowEntities

 /**
  * @dataProvider provideEscapeHtmlAllowEntities
  * @covers Sanitizer::escapeHtmlAllowEntities
  */
 public function testEscapeHtmlAllowEntities($expected, $html)
 {
     $this->assertEquals($expected, Sanitizer::escapeHtmlAllowEntities($html));
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:8,代码来源:SanitizerTest.php

示例11: formatValue

	function formatValue( $name, $value ) {
		global $wgContLang;

		switch ( $name ) {
			case 'wlp_pubdate':
				$s = $wgContLang->timeanddate( $value, true );
				if ( !$this->mCurrentRow->wlp_publish ) {
					$s = Xml::wrapClass( $s, 'wl-draft-inline' );
				}
				return $s;

			case 'wlp_updated':
				return $value;

			case 'wlp_authors':
				return $this->authorList( $this->mCurrentItem->mAuthors );

			case 'wlw_title':
				$page = $this->mCurrentItem->mParentTitle;
				$text = Sanitizer::escapeHtmlAllowEntities( $this->mCurrentItem->mParentName );
				return $this->getSkin()->link( $page, $text, array(), array(),
					array( 'known', 'noclasses' ) );

			case 'wlp_title':
				$page = $this->mCurrentItem->mTitle;
				$text = Sanitizer::escapeHtmlAllowEntities( $this->mCurrentItem->mName );
				$s = $this->getSkin()->link( $page, $text, array(), array(),
					array( 'known', 'noclasses' ) );
				if ( !$this->mCurrentRow->wlp_publish ) {
					$draft = wfMsg( 'wikilog-draft-title-mark' );
					$s = Xml::wrapClass( "$s $draft", 'wl-draft-inline' );
				}
				return $s;

			case 'wlp_num_comments':
				$page = $this->mCurrentItem->mTitle->getTalkPage();
				$text = $this->mCurrentItem->getNumComments();
				return $this->getSkin()->link( $page, $text, array(), array(),
					array( 'known', 'noclasses' ) );

			case '_wl_actions':
				if ( $this->mCurrentItem->mTitle->quickUserCan( 'edit' ) ) {
					return $this->doEditLink( $this->mCurrentItem->mTitle, $this->mCurrentItem->mName );
				} else {
					return '';
				}

			default:
				return htmlentities( $value );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:51,代码来源:WikilogItemPager.php

示例12: formatSubject

 static function formatSubject($s)
 {
     wfProfileIn(__METHOD__);
     $linker = class_exists('DummyLinker') ? new DummyLinker() : new Linker();
     # Sanitize text a bit:
     $s = str_replace("\n", " ", $s);
     # Allow HTML entities
     $s = Sanitizer::escapeHtmlAllowEntities($s);
     # Render links:
     $s = $linker->formatLinksInComment($s, null, false);
     wfProfileOut(__METHOD__);
     return $s;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:13,代码来源:View.php

示例13: foreach

					<span class="wam-vertical"><?php 
    echo $sWikiVerticalName;
    ?>
</span>
				</a>
			<?php 
}
?>
		</div>
	</div>
	<ol class="wam-top-gainers-list">
		<?php 
foreach ($visualizationWikis as $k => $wiki) {
    ?>
			<li class="wam-top-gainers-list-item"><?php 
    echo Sanitizer::escapeHtmlAllowEntities($wiki['title']);
    ?>
</li>
		<?php 
}
?>
	</ol>
</div>

<div class="wam-content">
	<div class="wam-content-logo"></div>
	<div class="wam-content-text">
		<h2><?php 
echo wfMessage('wampage-header-wam')->escaped();
?>
</h2>
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:WAMPageController_index.php

示例14: wfMsgExt

/**
 * Returns message in the requested format
 *
 * @deprecated since 1.18
 *
 * @param string $key Key of the message
 * @param array $options Processing rules.
 *   Can take the following options:
 *     parse: parses wikitext to HTML
 *     parseinline: parses wikitext to HTML and removes the surrounding
 *       p's added by parser or tidy
 *     escape: filters message through htmlspecialchars
 *     escapenoentities: same, but allows entity references like &#160; through
 *     replaceafter: parameters are substituted after parsing or escaping
 *     parsemag: transform the message using magic phrases
 *     content: fetch message for content language instead of interface
 *   Also can accept a single associative argument, of the form 'language' => 'xx':
 *     language: Language object or language code to fetch message for
 *       (overridden by content).
 * Behavior for conflicting options (e.g., parse+parseinline) is undefined.
 *
 * @return string
 */
function wfMsgExt($key, $options)
{
    wfDeprecated(__METHOD__, '1.21');
    $args = func_get_args();
    array_shift($args);
    array_shift($args);
    $options = (array) $options;
    $validOptions = array('parse', 'parseinline', 'escape', 'escapenoentities', 'replaceafter', 'parsemag', 'content');
    foreach ($options as $arrayKey => $option) {
        if (!preg_match('/^[0-9]+|language$/', $arrayKey)) {
            // An unknown index, neither numeric nor "language"
            wfWarn("wfMsgExt called with incorrect parameter key {$arrayKey}", 1, E_USER_WARNING);
        } elseif (preg_match('/^[0-9]+$/', $arrayKey) && !in_array($option, $validOptions)) {
            // A numeric index with unknown value
            wfWarn("wfMsgExt called with incorrect parameter {$option}", 1, E_USER_WARNING);
        }
    }
    if (in_array('content', $options, true)) {
        $forContent = true;
        $langCode = true;
        $langCodeObj = null;
    } elseif (array_key_exists('language', $options)) {
        $forContent = false;
        $langCode = wfGetLangObj($options['language']);
        $langCodeObj = $langCode;
    } else {
        $forContent = false;
        $langCode = false;
        $langCodeObj = null;
    }
    $string = wfMsgGetKey($key, true, $langCode, false);
    if (!in_array('replaceafter', $options, true)) {
        $string = wfMsgReplaceArgs($string, $args);
    }
    $messageCache = MessageCache::singleton();
    $parseInline = in_array('parseinline', $options, true);
    if (in_array('parse', $options, true) || $parseInline) {
        $string = $messageCache->parse($string, null, true, !$forContent, $langCodeObj);
        if ($string instanceof ParserOutput) {
            $string = $string->getText();
        }
        if ($parseInline) {
            $string = Parser::stripOuterParagraph($string);
        }
    } elseif (in_array('parsemag', $options, true)) {
        $string = $messageCache->transform($string, !$forContent, $langCodeObj);
    }
    if (in_array('escape', $options, true)) {
        $string = htmlspecialchars($string);
    } elseif (in_array('escapenoentities', $options, true)) {
        $string = Sanitizer::escapeHtmlAllowEntities($string);
    }
    if (in_array('replaceafter', $options, true)) {
        $string = wfMsgReplaceArgs($string, $args);
    }
    return $string;
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:80,代码来源:GlobalFunctions.php

示例15:

<!-- s:<?php 
echo __FILE__;
?>
 -->
<!-- MAIN-PAGE -->

<p id="sponsorship-dashboard-nodata"><?php 
echo Sanitizer::escapeHtmlAllowEntities($emptyChartMsg);
?>
</p>

<!-- END OF MAIN-PAGE -->
<!-- e:<?php 
echo __FILE__;
?>
 -->
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:chart_empty.tmpl.php


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