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


PHP Sanitizer::escapeClass方法代码示例

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


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

示例1: onImagePageAfterImageLinks

 /**
  * Show a global usage section on the image page
  *
  * @param object $imagePage The ImagePage
  * @param string $html HTML to add to the image page as global usage section
  * @return bool
  */
 public static function onImagePageAfterImageLinks($imagePage, &$html)
 {
     if (!self::hasResults($imagePage)) {
         return true;
     }
     $title = $imagePage->getFile()->getTitle();
     $targetName = $title->getText();
     $query = self::getImagePageQuery($title);
     $guHtml = '';
     foreach ($query->getSingleImageResult() as $wiki => $result) {
         $wikiName = WikiMap::getWikiName($wiki);
         $escWikiName = Sanitizer::escapeClass($wikiName);
         /* Wikia change begin */
         wfRunHooks('GlobalUsageImagePageWikiLink', array(&$wikiName));
         /* Wikia change end */
         $guHtml .= "<li class='mw-gu-onwiki-{$escWikiName}'>" . wfMsgExt('globalusage-on-wiki', 'parseinline', $targetName, $wikiName) . "\n<ul>";
         foreach ($result as $item) {
             $guHtml .= "\t<li>" . SpecialGlobalUsage::formatItem($item) . "</li>\n";
         }
         $guHtml .= "</ul></li>\n";
     }
     if ($guHtml) {
         $html .= '<h2 id="globalusage">' . wfMsgHtml('globalusage') . "</h2>\n" . '<div id="mw-imagepage-section-globalusage">' . wfMsgExt('globalusage-of-file', 'parse') . "<ul>\n" . $guHtml . "</ul>\n";
         if ($query->hasMore()) {
             $html .= wfMsgExt('globalusage-more', 'parse', $targetName);
         }
         $html .= '</div>';
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:37,代码来源:GlobalUsageImagePageHooks.php

示例2: recentChangesLine

 /**
  * Format a line using the old system (aka without any javascript).
  *
  * @param RecentChange $rc Passed by reference
  * @param bool $watched (default false)
  * @param int $linenumber (default null)
  *
  * @return string|bool
  */
 public function recentChangesLine(&$rc, $watched = false, $linenumber = null)
 {
     $classes = array();
     // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
     if ($linenumber) {
         if ($linenumber & 1) {
             $classes[] = 'mw-line-odd';
         } else {
             $classes[] = 'mw-line-even';
         }
     }
     // Indicate watched status on the line to allow for more
     // comprehensive styling.
     $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
     $html = $this->formatChangeLine($rc, $classes, $watched);
     if ($this->watchlist) {
         $classes[] = Sanitizer::escapeClass('watchlist-' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title']);
     }
     if (!Hooks::run('OldChangesListRecentChangesLine', array(&$this, &$html, $rc, &$classes))) {
         return false;
     }
     $dateheader = '';
     // $html now contains only <li>...</li>, for hooks' convenience.
     $this->insertDateHeader($dateheader, $rc->mAttribs['rc_timestamp']);
     return "{$dateheader}<li class=\"" . implode(' ', $classes) . "\">" . $html . "</li>\n";
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:35,代码来源:OldChangesList.php

示例3: formatSummaryRow

 /**
  * Creates HTML for the given tags
  *
  * @param string $tags Comma-separated list of tags
  * @param string $page A label for the type of action which is being displayed,
  *   for example: 'history', 'contributions' or 'newpages'
  * @return array Array with two items: (html, classes)
  *   - html: String: HTML for displaying the tags (empty string when param $tags is empty)
  *   - classes: Array of strings: CSS classes used in the generated html, one class for each tag
  */
 public static function formatSummaryRow($tags, $page)
 {
     global $wgLang;
     if (!$tags) {
         return array('', array());
     }
     $classes = array();
     $tags = explode(',', $tags);
     $displayTags = array();
     foreach ($tags as $tag) {
         if (!$tag) {
             continue;
         }
         $description = self::tagDescription($tag);
         if ($description === false) {
             continue;
         }
         $displayTags[] = Xml::tags('span', array('class' => 'mw-tag-marker ' . Sanitizer::escapeClass("mw-tag-marker-{$tag}")), $description);
         $classes[] = Sanitizer::escapeClass("mw-tag-{$tag}");
     }
     if (!$displayTags) {
         return array('', array());
     }
     $markers = wfMessage('tag-list-wrapper')->numParams(count($displayTags))->rawParams($wgLang->commaList($displayTags))->parse();
     $markers = Xml::tags('span', array('class' => 'mw-tag-markers'), $markers);
     return array($markers, $classes);
 }
开发者ID:agothro,项目名称:mediawiki,代码行数:37,代码来源:ChangeTags.php

示例4: formatSummaryRow

 /**
  * Creates HTML for the given tags
  *
  * @param string $tags Comma-separated list of tags
  * @param string $page A label for the type of action which is being displayed,
  *   for example: 'history', 'contributions' or 'newpages'
  * @param IContextSource|null $context
  * @note Even though it takes null as a valid argument, an IContextSource is preferred
  *       in a new code, as the null value is subject to change in the future
  * @return array Array with two items: (html, classes)
  *   - html: String: HTML for displaying the tags (empty string when param $tags is empty)
  *   - classes: Array of strings: CSS classes used in the generated html, one class for each tag
  */
 public static function formatSummaryRow($tags, $page, IContextSource $context = null)
 {
     if (!$tags) {
         return array('', array());
     }
     if (!$context) {
         $context = RequestContext::getMain();
     }
     $classes = array();
     $tags = explode(',', $tags);
     $displayTags = array();
     foreach ($tags as $tag) {
         if (!$tag) {
             continue;
         }
         $description = self::tagDescription($tag);
         if ($description === false) {
             continue;
         }
         $displayTags[] = Xml::tags('span', array('class' => 'mw-tag-marker ' . Sanitizer::escapeClass("mw-tag-marker-{$tag}")), $description);
         $classes[] = Sanitizer::escapeClass("mw-tag-{$tag}");
     }
     if (!$displayTags) {
         return array('', array());
     }
     $markers = $context->msg('tag-list-wrapper')->numParams(count($displayTags))->rawParams($context->getLanguage()->commaList($displayTags))->parse();
     $markers = Xml::tags('span', array('class' => 'mw-tag-markers'), $markers);
     return array($markers, $classes);
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:42,代码来源:ChangeTags.php

示例5: formatSummaryRow

 static function formatSummaryRow($tags, $page)
 {
     if (!$tags) {
         return array('', array());
     }
     $classes = array();
     $tags = explode(',', $tags);
     $displayTags = array();
     foreach ($tags as $tag) {
         $displayTags[] = Xml::tags('span', array('class' => 'mw-tag-marker ' . Sanitizer::escapeClass("mw-tag-marker-{$tag}")), self::tagDescription($tag));
         $classes[] = Sanitizer::escapeClass("mw-tag-{$tag}");
     }
     $markers = '(' . implode(', ', $displayTags) . ')';
     $markers = Xml::tags('span', array('class' => 'mw-tag-markers'), $markers);
     return array($markers, $classes);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:16,代码来源:ChangeTags.php

示例6: makeIcon

 /**
  * Generate an in icon using a canned CK icon
  * @param $icon string icon id or random seed
  * @param $size int intended height/width for rendered icon in px
  * @param $fallback string what to do for no icon; allowed values are 'random', 'none', or a valid icon id
  * @return string html
  */
 public static function makeIcon($icon, $size = 50, $colour, $background = 'transparent')
 {
     $iconsPreset = CollaborationKitIcon::getCannedIcons();
     if (in_array($icon, $iconsPreset)) {
         $iconClass = Sanitizer::escapeClass($icon);
     } else {
         // Random time
         // Choose class name using $icon value as seed
         $iconClass = $iconsPreset[hexdec(sha1($icon)[0]) % 27];
     }
     if (!isset($colour) || $colour == 'black') {
         $colorSuffix = '';
     } else {
         $colorSuffix = '-' . $colour;
     }
     return Html::element('div', ['class' => ['mw-ck-icon', 'mw-ck-icon-' . $iconClass . $colorSuffix], 'css' => "height: {$size}px; width: {$size}px; background-color: {$background};"]);
 }
开发者ID:wikimedia,项目名称:mediawiki-extensions-CollaborationKit,代码行数:24,代码来源:CollaborationKitIcon.php

示例7: formatSummaryRow

 /**
  * Creates HTML for the given tags
  *
  * @param string $tags Comma-separated list of tags
  * @param string $page A label for the type of action which is being displayed,
  *                     for example: 'history', 'contributions' or 'newpages'
  *
  * @return Array with two items: (html, classes)
  *            - html: String: HTML for displaying the tags (empty string when param $tags is empty)
  *            - classes: Array of strings: CSS classes used in the generated html, one class for each tag
  *
  */
 static function formatSummaryRow($tags, $page)
 {
     global $wgLang;
     if (!$tags) {
         return array('', array());
     }
     $classes = array();
     $tags = explode(',', $tags);
     $displayTags = array();
     foreach ($tags as $tag) {
         $displayTags[] = Xml::tags('span', array('class' => 'mw-tag-marker ' . Sanitizer::escapeClass("mw-tag-marker-{$tag}")), self::tagDescription($tag));
         $classes[] = Sanitizer::escapeClass("mw-tag-{$tag}");
     }
     $markers = wfMessage('parentheses')->rawParams($wgLang->commaList($displayTags))->text();
     $markers = Xml::tags('span', array('class' => 'mw-tag-markers'), $markers);
     return array($markers, $classes);
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:29,代码来源:ChangeTags.php

示例8: recentChangesLine

 /**
  * Format a line using the old system (aka without any javascript).
  *
  * @param RecentChange $rc Passed by reference
  * @param bool $watched (default false)
  * @param int $linenumber (default null)
  *
  * @return string|bool
  */
 public function recentChangesLine(&$rc, $watched = false, $linenumber = null)
 {
     $classes = $this->getHTMLClasses($rc, $watched);
     // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
     if ($linenumber) {
         if ($linenumber & 1) {
             $classes[] = 'mw-line-odd';
         } else {
             $classes[] = 'mw-line-even';
         }
     }
     $html = $this->formatChangeLine($rc, $classes, $watched);
     if ($this->watchlist) {
         $classes[] = Sanitizer::escapeClass('watchlist-' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title']);
     }
     if (!Hooks::run('OldChangesListRecentChangesLine', [&$this, &$html, $rc, &$classes])) {
         return false;
     }
     $dateheader = '';
     // $html now contains only <li>...</li>, for hooks' convenience.
     $this->insertDateHeader($dateheader, $rc->mAttribs['rc_timestamp']);
     return "{$dateheader}<li class=\"" . implode(' ', $classes) . "\">" . $html . "</li>\n";
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:32,代码来源:OldChangesList.php

示例9: outputPage

 /**
  * initialize various variables and generate the template
  *
  * @param $out OutputPage
  */
 function outputPage(OutputPage $out)
 {
     global $wgUser, $wgLang, $wgContLang;
     global $wgScript, $wgStylePath;
     global $wgMimeType, $wgJsMimeType, $wgRequest;
     global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
     global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
     global $wgMaxCredits, $wgShowCreditsIfMax;
     global $wgPageShowWatchingUsers;
     global $wgUseTrackbacks, $wgUseSiteJs, $wgDebugComments;
     global $wgArticlePath, $wgScriptPath, $wgServer;
     wfProfileIn(__METHOD__);
     Profiler::instance()->setTemplated(true);
     $oldid = $wgRequest->getVal('oldid');
     $diff = $wgRequest->getVal('diff');
     $action = $wgRequest->getVal('action', 'view');
     wfProfileIn(__METHOD__ . '-init');
     $this->initPage($out);
     $tpl = $this->setupTemplate($this->template, 'skins');
     wfProfileOut(__METHOD__ . '-init');
     wfProfileIn(__METHOD__ . '-stuff');
     $this->thispage = $this->getTitle()->getPrefixedDBkey();
     $this->userpage = $wgUser->getUserPage()->getPrefixedText();
     $query = array();
     if (!$wgRequest->wasPosted()) {
         $query = $wgRequest->getValues();
         unset($query['title']);
         unset($query['returnto']);
         unset($query['returntoquery']);
     }
     $this->thisquery = wfArrayToCGI($query);
     $this->loggedin = $wgUser->isLoggedIn();
     $this->iscontent = $this->getTitle()->getNamespace() != NS_SPECIAL;
     $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit'));
     $this->username = $wgUser->getName();
     if ($wgUser->isLoggedIn() || $this->showIPinHeader()) {
         $this->userpageUrlDetails = self::makeUrlDetails($this->userpage);
     } else {
         # This won't be used in the standard skins, but we define it to preserve the interface
         # To save time, we check for existence
         $this->userpageUrlDetails = self::makeKnownUrlDetails($this->userpage);
     }
     $this->titletxt = $this->getTitle()->getPrefixedText();
     wfProfileOut(__METHOD__ . '-stuff');
     wfProfileIn(__METHOD__ . '-stuff-head');
     if ($this->useHeadElement) {
         $pagecss = $this->setupPageCss();
         if ($pagecss) {
             $out->addInlineStyle($pagecss);
         }
     } else {
         $this->setupUserCss($out);
         $tpl->set('pagecss', $this->setupPageCss());
         $tpl->set('usercss', false);
         $this->userjs = $this->userjsprev = false;
         # @todo FIXME: This is the only use of OutputPage::isUserJsAllowed() anywhere; can we
         # get rid of it?  For that matter, why is any of this here at all?
         $this->setupUserJs($out->isUserJsAllowed());
         $tpl->setRef('userjs', $this->userjs);
         $tpl->setRef('userjsprev', $this->userjsprev);
         if ($wgUseSiteJs) {
             $jsCache = $this->loggedin ? '&smaxage=0' : '';
             $tpl->set('jsvarurl', self::makeUrl('-', "action=raw{$jsCache}&gen=js&useskin=" . urlencode($this->getSkinName())));
         } else {
             $tpl->set('jsvarurl', false);
         }
         $tpl->setRef('xhtmldefaultnamespace', $wgXhtmlDefaultNamespace);
         $tpl->set('xhtmlnamespaces', $wgXhtmlNamespaces);
         $tpl->set('html5version', $wgHtml5Version);
         $tpl->set('headlinks', $out->getHeadLinks($this));
         $tpl->set('csslinks', $out->buildCssLinks($this));
         if ($wgUseTrackbacks && $out->isArticleRelated()) {
             $tpl->set('trackbackhtml', $out->getTitle()->trackbackRDF());
         } else {
             $tpl->set('trackbackhtml', null);
         }
     }
     wfProfileOut(__METHOD__ . '-stuff-head');
     wfProfileIn(__METHOD__ . '-stuff2');
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     $tpl->set('displaytitle', $out->mPageLinkTitle);
     $tpl->set('pageclass', $this->getPageClasses($this->getTitle()));
     $tpl->set('skinnameclass', 'skin-' . Sanitizer::escapeClass($this->getSkinName()));
     $nsname = MWNamespace::exists($this->getTitle()->getNamespace()) ? MWNamespace::getCanonicalName($this->getTitle()->getNamespace()) : $this->getTitle()->getNsText();
     $tpl->set('nscanonical', $nsname);
     $tpl->set('nsnumber', $this->getTitle()->getNamespace());
     $tpl->set('titleprefixeddbkey', $this->getTitle()->getPrefixedDBKey());
     $tpl->set('titletext', $this->getTitle()->getText());
     $tpl->set('articleid', $this->getTitle()->getArticleId());
     $tpl->set('currevisionid', $this->getTitle()->getLatestRevID());
     $tpl->set('isarticle', $out->isArticle());
     $tpl->setRef('thispage', $this->thispage);
     $subpagestr = $this->subPageSubtitle();
     $tpl->set('subtitle', !empty($subpagestr) ? '<span class="subpages">' . $subpagestr . '</span>' . $out->getSubtitle() : $out->getSubtitle());
//.........这里部分代码省略.........
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:101,代码来源:SkinTemplate.php

示例10: htmlspecialchars

<table class="mw-collapsible mw-collapsed mw-enhanced-rc <?php 
echo Sanitizer::escapeClass('mw-changeslist-ns' . $title->getNamespace() . '-' . $title->getText());
?>
">
	<tr>
		<td>
			<span class="mw-collapsible-toggle">
				<span class="mw-rc-openarrow">
					<a title="<?php 
echo htmlspecialchars(wfMsg('rc-enhanced-expand'));
?>
" href="#">
						<img width="12" height="12" title="<?php 
echo htmlspecialchars(wfMsg('rc-enhanced-expand'));
?>
" alt="+" src="<?php 
echo $wgStylePath;
?>
/common/images/Arr_r.png">
					</a>
				</span>
				<span class="mw-rc-closearrow">
					<a title="<?php 
echo htmlspecialchars(wfMsg('rc-enhanced-hide'));
?>
" href="#">
						<img width="12" height="12" title="<?php 
echo htmlspecialchars(wfMsg('rc-enhanced-hide'));
?>
" alt="-" src="<?php 
echo $wgStylePath;
开发者ID:yusufchang,项目名称:app,代码行数:31,代码来源:RecentChangesHeaderBlock.tmpl.php

示例11: formatReviewSummaryRow

 /**
  * Insert the tags of the given change
  */
 private function formatReviewSummaryRow($rc, $page)
 {
     global $wgRequest;
     $s = '';
     if (!$rc) {
         return $s;
     }
     $attr = $rc->mAttribs;
     $tagRows = $attr['collabwatchlist_tags'];
     $classes = array();
     $displayTags = array();
     foreach ($tagRows as $tagRow) {
         $tag = $tagRow['ct_tag'];
         $collabwatchlistTag = Xml::tags('span', array('class' => 'mw-collabwatchlist-tag-marker ' . Sanitizer::escapeClass("mw-collabwatchlist-tag-marker-{$tag}"), 'title' => $tagRow['rrt_comment']), ChangeTags::tagDescription($tag));
         $classes[] = Sanitizer::escapeClass("mw-collabwatchlist-tag-{$tag}");
         /** Insert links to user page, user talk page and eventually a blocking link */
         $userLink = $this->skin->userLink($tagRow['user_id'], $tagRow['user_name']);
         $delTagTarget = CollabWatchlistEditor::getUnsetTagUrl($wgRequest->getFullRequestURL(), $attr['rc_title'], $tagRow['cw_id'], $tag, $attr['rc_id']);
         $delTagLink = Xml::element('a', array('href' => $delTagTarget, 'class' => 'mw-collabwatchlist-unsettag-' . $tag), wfMsg('collabwatchlist-unset-tag'));
         $displayTags[] = $collabwatchlistTag . ' ' . $delTagLink . ' ' . $userLink;
     }
     $markers = '(' . implode(', ', $displayTags) . ')';
     $markers = Xml::tags('span', array('class' => 'mw-collabwatchlist-tag-markers'), $markers);
     return array($markers, $classes);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:28,代码来源:CollabWatchlistChangesList.php

示例12: recentChangesBlockLine

 /**
  * Enhanced RC ungrouped line.
  * @return String: a HTML formated line (generated using $r)
  */
 protected function recentChangesBlockLine($rcObj)
 {
     global $wgRCShowChangedSize;
     wfProfileIn(__METHOD__);
     # Extract fields from DB into the function scope (rc_xxxx variables)
     // FIXME: Would be good to replace this extract() call with something
     // that explicitly initializes variables.
     // TODO implement
     extract($rcObj->mAttribs);
     $query['curid'] = $rc_cur_id;
     if ($rc_log_type) {
         # Log entry
         $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass('mw-changeslist-log-' . $rc_log_type . '-' . $rcObj->mAttribs['rc_title']);
     } else {
         $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass('mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title']);
     }
     $r = Html::openElement('table', array('class' => $classes)) . Html::openElement('tr');
     $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow() . '&#160;';
     # Flag and Timestamp
     if ($rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
         $r .= '&#160;&#160;&#160;&#160;';
         // 4 flags -> 4 spaces
     } else {
         $r .= $this->recentChangesFlags($rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&#160;', $rc_bot);
     }
     $r .= '&#160;' . $rcObj->timestamp . '&#160;</td><td style="padding:0px;">';
     # Article or log link
     if ($rc_log_type) {
         $logtitle = Title::newFromText("Log/{$rc_log_type}", NS_SPECIAL);
         $logname = LogPage::logName($rc_log_type);
         $r .= '(' . $this->skin->link($logtitle, $logname, array(), array(), array('known', 'noclasses')) . ')';
     } else {
         $this->insertArticleLink($r, $rcObj, $rcObj->unpatrolled, $rcObj->watched);
     }
     # Diff and hist links
     if ($rc_type != RC_LOG) {
         $r .= ' (' . $rcObj->difflink . $this->message['pipe-separator'];
         $query['action'] = 'history';
         $r .= $this->skin->link($rcObj->getTitle(), $this->message['hist'], array(), $query, array('known', 'noclasses')) . ')';
     }
     $r .= ' . . ';
     # Character diff
     if ($wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference())) {
         $r .= "{$cd} . . ";
     }
     # User/talk
     $r .= ' ' . $rcObj->userlink . $rcObj->usertalklink;
     # Log action (if any)
     if ($rc_log_type) {
         if ($this->isDeleted($rcObj, LogPage::DELETED_ACTION)) {
             $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
         } else {
             $r .= ' ' . LogPage::actionText($rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin, LogPage::extractParams($rc_params), true, true);
         }
     }
     $this->insertComment($r, $rcObj);
     $this->insertRollback($r, $rcObj);
     # Tags
     $classes = explode(' ', $classes);
     $this->insertTags($r, $rcObj, $classes);
     # Show how many people are watching this if enabled
     $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
     $r .= "</td></tr></table>\n";
     wfProfileOut(__METHOD__);
     return $r;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:70,代码来源:ChangesList.php

示例13: getPageClasses

 /**
  * TODO: document
  * @param $title Title
  * @return String
  */
 function getPageClasses($title)
 {
     $numeric = 'ns-' . $title->getNamespace();
     if ($title->isSpecialPage()) {
         $type = 'ns-special';
         // bug 23315: provide a class based on the canonical special page name without subpages
         list($canonicalName) = SpecialPageFactory::resolveAlias($title->getDBkey());
         if ($canonicalName) {
             $type .= ' ' . Sanitizer::escapeClass("mw-special-{$canonicalName}");
         } else {
             $type .= ' mw-invalidspecialpage';
         }
     } elseif ($title->isTalkPage()) {
         $type = 'ns-talk';
     } else {
         $type = 'ns-subject';
     }
     $name = Sanitizer::escapeClass('page-' . $title->getPrefixedText());
     return "{$numeric} {$type} {$name}";
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:25,代码来源:Skin.php

示例14: recentChangesBlockLine

 /**
  * Enhanced RC ungrouped line.
  *
  * @param $rcObj RecentChange
  * @return String: a HTML formatted line (generated using $r)
  */
 protected function recentChangesBlockLine($rcObj)
 {
     global $wgRCShowChangedSize;
     wfProfileIn(__METHOD__);
     $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
     $type = $rcObj->mAttribs['rc_type'];
     $logType = $rcObj->mAttribs['rc_log_type'];
     if ($logType) {
         # Log entry
         $classes = Sanitizer::escapeClass('mw-changeslist-log-' . $logType);
     } else {
         $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass('mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title']);
     }
     $r = Html::openElement('table', array('class' => $classes)) . Html::openElement('tr');
     $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow();
     # Flag and Timestamp
     if ($type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT) {
         $r .= '&#160;&#160;&#160;&#160;';
         // 4 flags -> 4 spaces
     } else {
         $r .= $this->recentChangesFlags(array('newpage' => $type == RC_NEW, 'minor' => $rcObj->mAttribs['rc_minor'], 'unpatrolled' => $rcObj->unpatrolled, 'bot' => $rcObj->mAttribs['rc_bot']));
     }
     $r .= '&#160;' . $rcObj->timestamp . '&#160;</td><td>';
     # Article or log link
     if ($logType) {
         $logtitle = SpecialPage::getTitleFor('Log', $logType);
         $logname = LogPage::logName($logType);
         $r .= '(' . Linker::linkKnown($logtitle, htmlspecialchars($logname)) . ')';
     } else {
         $this->insertArticleLink($r, $rcObj, $rcObj->unpatrolled, $rcObj->watched);
     }
     # Diff and hist links
     if ($type != RC_LOG) {
         $r .= ' (' . $rcObj->difflink . $this->message['pipe-separator'];
         $query['action'] = 'history';
         $r .= Linker::linkKnown($rcObj->getTitle(), $this->message['hist'], array(), $query) . ')';
     }
     $r .= ' . . ';
     # Character diff
     if ($wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference())) {
         $r .= "{$cd} . . ";
     }
     if ($type == RC_LOG) {
         $r .= $this->insertLogEntry($rcObj);
     } else {
         $r .= ' ' . $rcObj->userlink . $rcObj->usertalklink;
         $r .= $this->insertComment($rcObj);
         $r .= $this->insertRollback($r, $rcObj);
     }
     # Tags
     $classes = explode(' ', $classes);
     $this->insertTags($r, $rcObj, $classes);
     # Show how many people are watching this if enabled
     $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
     $r .= "</td></tr></table>\n";
     wfProfileOut(__METHOD__);
     return $r;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:64,代码来源:ChangesList.php

示例15: recentChangesBlockLine

 /**
  * Enhanced RC ungrouped line.
  *
  * @param RecentChange|RCCacheEntry $rcObj
  * @return string A HTML formatted line (generated using $r)
  */
 protected function recentChangesBlockLine($rcObj)
 {
     $data = array();
     $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
     $type = $rcObj->mAttribs['rc_type'];
     $logType = $rcObj->mAttribs['rc_log_type'];
     $classes = array('mw-enhanced-rc');
     if ($logType) {
         # Log entry
         $classes[] = Sanitizer::escapeClass('mw-changeslist-log-' . $logType);
     } else {
         $classes[] = Sanitizer::escapeClass('mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title']);
     }
     $classes[] = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
     # Flag and Timestamp
     $data['recentChangesFlags'] = array('newpage' => $type == RC_NEW, 'minor' => $rcObj->mAttribs['rc_minor'], 'unpatrolled' => $rcObj->unpatrolled, 'bot' => $rcObj->mAttribs['rc_bot']);
     // timestamp is not really a link here, but is called timestampLink
     // for consistency with EnhancedChangesListModifyLineData
     $data['timestampLink'] = $rcObj->timestamp;
     # Article or log link
     if ($logType) {
         $logPage = new LogPage($logType);
         $logTitle = SpecialPage::getTitleFor('Log', $logType);
         $logName = $logPage->getName()->escaped();
         $data['logLink'] = $this->msg('parentheses')->rawParams(Linker::linkKnown($logTitle, $logName))->escaped();
     } else {
         $data['articleLink'] = $this->getArticleLink($rcObj, $rcObj->unpatrolled, $rcObj->watched);
     }
     # Diff and hist links
     if ($type != RC_LOG) {
         $query['action'] = 'history';
         $data['historyLink'] = ' ' . $this->msg('parentheses')->rawParams($rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown($rcObj->getTitle(), $this->message['hist'], array(), $query))->escaped();
     }
     $data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator">. .</span> ';
     # Character diff
     if ($this->getConfig()->get('RCShowChangedSize')) {
         $cd = $this->formatCharacterDifference($rcObj);
         if ($cd !== '') {
             $data['characterDiff'] = $cd;
             $data['separatorAftercharacterDiff'] = ' <span class="mw-changeslist-separator">. .</span> ';
         }
     }
     if ($type == RC_LOG) {
         $data['logEntry'] = $this->insertLogEntry($rcObj);
     } else {
         $data['userLink'] = $rcObj->userlink;
         $data['userTalkLink'] = $rcObj->usertalklink;
         $data['comment'] = $this->insertComment($rcObj);
         $data['rollback'] = $this->getRollback($rcObj);
     }
     # Tags
     $data['tags'] = $this->getTags($rcObj, $classes);
     # Show how many people are watching this if enabled
     $data['watchingUsers'] = $this->numberofWatchingusers($rcObj->numberofWatchingusers);
     // give the hook a chance to modify the data
     $success = Hooks::run('EnhancedChangesListModifyBlockLineData', array($this, &$data, $rcObj));
     if (!$success) {
         // skip entry if hook aborted it
         return '';
     }
     $line = Html::openElement('table', array('class' => $classes)) . Html::openElement('tr');
     $line .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
     if (isset($data['recentChangesFlags'])) {
         $line .= $this->recentChangesFlags($data['recentChangesFlags']);
         unset($data['recentChangesFlags']);
     }
     if (isset($data['timestampLink'])) {
         $line .= '&#160;' . $data['timestampLink'];
         unset($data['timestampLink']);
     }
     $line .= '&#160;</td><td>';
     // everything else: makes it easier for extensions to add or remove data
     $line .= implode('', $data);
     $line .= "</td></tr></table>\n";
     return $line;
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:82,代码来源:EnhancedChangesList.php


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