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


PHP Sanitizer::stripAllTags方法代码示例

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


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

示例1: StripMarkupExtension

function StripMarkupExtension($text, $param = array(), $parser = null)
{
    $text = preg_replace('~\\[\\[(.+)(|.+)?\\]\\]~i', '$1', $text);
    $text = $parser->recursiveTagParse($text);
    // echo $text;
    //echo $text; exit;
    //echo  Sanitizer::stripAllTags( $text ); //exit;
    return trim(Sanitizer::stripAllTags($text));
}
开发者ID:seedbank,项目名称:old-repo,代码行数:9,代码来源:StripMarkup.php

示例2: setHeaders

 public function setHeaders()
 {
     // Overwritten the parent because it sucks!
     // We want to set <title> but not <h1>
     $out = $this->getOutput();
     $out->setArticleRelated(false);
     $out->setRobotPolicy('noindex,nofollow');
     $name = $this->msg('searchtranslations');
     $name = Sanitizer::stripAllTags($name);
     $out->setHTMLTitle($this->msg('pagetitle')->rawParams($name));
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:11,代码来源:SpecialSearchTranslations.php

示例3: formatComment

 /**
  * Formats an edit comment
  * @param string $comment The raw comment text
  * @param Title $title The title of the page that was edited
  * @fixme: Duplication with SpecialMobileWatchlist
  *
  * @return string HTML code
  */
 protected function formatComment($comment, $title)
 {
     if ($comment === '') {
         $comment = $this->msg('mobile-frontend-changeslist-nocomment')->plain();
     } else {
         $comment = Linker::formatComment($comment, $title);
         // flatten back to text
         $comment = Sanitizer::stripAllTags($comment);
     }
     return $comment;
 }
开发者ID:negati-ve,项目名称:openshift-mediawiki,代码行数:19,代码来源:MobileSpecialPageFeed.php

示例4: __construct

 /**
  * Exception constructor
  *
  * The input message is a HTTP status message. Because an exception with the
  * message 'Not Found' is not very clear it this message is tranformed to a
  * more descriptive text. The original message is available using the
  * {@link getStatusMessage} method.
  *
  * @param string $statusMessage
  * @param int|null $code
  */
 public function __construct($statusMessage, $code = null, $body = null)
 {
     $this->_statusMessage = $statusMessage;
     $message = 'Solr HTTP error: ' . $statusMessage;
     if (null !== $code) {
         $message .= ' (' . $code . ')';
     }
     if (null !== $body) {
         $message .= html_entity_decode(Sanitizer::stripAllTags($body));
     }
     parent::__construct($message, $code);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:HttpException.php

示例5: extractHeadingBeforeFirstHeading

 /**
  * Get text before first heading.
  * @param string $text
  * @return string|null
  */
 private function extractHeadingBeforeFirstHeading($text)
 {
     $matches = [];
     if (!preg_match('/<h[123456]>/', $text, $matches, PREG_OFFSET_CAPTURE)) {
         // There isn't a first heading so we interpret this as the article
         // being entirely without heading.
         return null;
     }
     $text = substr($text, 0, $matches[0][1]);
     if (!$text) {
         // There isn't any text before the first heading so we declare there isn't
         // a first heading.
         return null;
     }
     $formatter = new HtmlFormatter($text);
     $formatter->remove($this->excludedElementSelectors);
     $formatter->remove($this->auxiliaryElementSelectors);
     $formatter->filterContent();
     $text = trim(Sanitizer::stripAllTags($formatter->getText()));
     if (!$text) {
         // There isn't any text after filtering before the first heading so we declare
         // that there isn't a first heading.
         return null;
     }
     return $text;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:31,代码来源:WikiTextStructure.php

示例6: setPageTitle

 /**
  * "Page title" means the contents of \<h1\>. It is stored as a valid HTML fragment.
  * This function allows good tags like \<sup\> in the \<h1\> tag, but not bad tags like \<script\>.
  * This function automatically sets \<title\> to the same content as \<h1\> but with all tags removed.
  * Bad tags that were escaped in \<h1\> will still be escaped in \<title\>, and good tags like \<i\> will be dropped entirely.
  *
  * @param $name string
  */
 public function setPageTitle($name)
 {
     # change "<script>foo&bar</script>" to "&lt;script&gt;foo&amp;bar&lt;/script&gt;"
     # but leave "<i>foobar</i>" alone
     $nameWithTags = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($name));
     $this->mPagetitle = $nameWithTags;
     # change "<i>foo&amp;bar</i>" to "foo&bar"
     $this->setHTMLTitle(wfMsg('pagetitle', Sanitizer::stripAllTags($nameWithTags)));
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:17,代码来源:OutputPage.php

示例7: displaytitle

 /**
  * Override the title of the page when viewed, provided we've been given a
  * title which will normalise to the canonical title
  *
  * @param $parser Parser: parent parser
  * @param string $text desired title text
  * @return String
  */
 static function displaytitle($parser, $text = '')
 {
     global $wgRestrictDisplayTitle;
     #parse a limited subset of wiki markup (just the single quote items)
     $text = $parser->doQuotes($text);
     #remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
     $text = preg_replace('/' . preg_quote($parser->uniqPrefix(), '/') . '.*?' . preg_quote(Parser::MARKER_SUFFIX, '/') . '/', '', $text);
     #list of disallowed tags for DISPLAYTITLE
     #these will be escaped even though they are allowed in normal wiki text
     $bad = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr', 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rp', 'br');
     #only requested titles that normalize to the actual title are allowed through
     #if $wgRestrictDisplayTitle is true (it is by default)
     #mimic the escaping process that occurs in OutputPage::setPageTitle
     $text = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($text, null, array(), array(), $bad));
     $title = Title::newFromText(Sanitizer::stripAllTags($text));
     if (!$wgRestrictDisplayTitle) {
         $parser->mOutput->setDisplayTitle($text);
     } elseif ($title instanceof Title && $title->getFragment() == '' && $title->equals($parser->mTitle)) {
         $parser->mOutput->setDisplayTitle($text);
     }
     return '';
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:30,代码来源:CoreParserFunctions.php

示例8: makeImage

 /**
  * Parse image options text and use it to make an image
  */
 function makeImage($title, $options)
 {
     # @TODO: let the MediaHandler specify its transform parameters
     #
     # Check if the options text is of the form "options|alt text"
     # Options are:
     #  * thumbnail       	make a thumbnail with enlarge-icon and caption, alignment depends on lang
     #  * left		no resizing, just left align. label is used for alt= only
     #  * right		same, but right aligned
     #  * none		same, but not aligned
     #  * ___px		scale to ___ pixels width, no aligning. e.g. use in taxobox
     #  * center		center the image
     #  * framed		Keep original image size, no magnify-button.
     #  * frameless		like 'thumb' but without a frame. Keeps user preferences for width
     #  * upright		reduce width for upright images, rounded to full __0 px
     #  * border		draw a 1px border around the image
     # vertical-align values (no % or length right now):
     #  * baseline
     #  * sub
     #  * super
     #  * top
     #  * text-top
     #  * middle
     #  * bottom
     #  * text-bottom
     $parts = array_map('trim', explode('|', $options));
     $sk = $this->mOptions->getSkin();
     # Give extensions a chance to select the file revision for us
     $skip = $time = false;
     wfRunHooks('BeforeParserMakeImageLinkObj', array(&$this, &$title, &$skip, &$time));
     if ($skip) {
         return $sk->makeLinkObj($title);
     }
     # Get parameter map
     $file = wfFindFile($title, $time);
     $handler = $file ? $file->getHandler() : false;
     list($paramMap, $mwArray) = $this->getImageParams($handler);
     # Process the input parameters
     $caption = '';
     $params = array('frame' => array(), 'handler' => array(), 'horizAlign' => array(), 'vertAlign' => array());
     foreach ($parts as $part) {
         list($magicName, $value) = $mwArray->matchVariableStartToEnd($part);
         if (isset($paramMap[$magicName])) {
             list($type, $paramName) = $paramMap[$magicName];
             $params[$type][$paramName] = $value;
             // Special case; width and height come in one variable together
             if ($type == 'handler' && $paramName == 'width') {
                 $m = array();
                 if (preg_match('/^([0-9]*)x([0-9]*)$/', $value, $m)) {
                     $params[$type]['width'] = intval($m[1]);
                     $params[$type]['height'] = intval($m[2]);
                 } else {
                     $params[$type]['width'] = intval($value);
                 }
             }
         } else {
             $caption = $part;
         }
     }
     # Process alignment parameters
     if ($params['horizAlign']) {
         $params['frame']['align'] = key($params['horizAlign']);
     }
     if ($params['vertAlign']) {
         $params['frame']['valign'] = key($params['vertAlign']);
     }
     # Validate the handler parameters
     if ($handler) {
         foreach ($params['handler'] as $name => $value) {
             if (!$handler->validateParam($name, $value)) {
                 unset($params['handler'][$name]);
             }
         }
     }
     # Strip bad stuff out of the alt text
     $alt = $this->replaceLinkHoldersText($caption);
     # make sure there are no placeholders in thumbnail attributes
     # that are later expanded to html- so expand them now and
     # remove the tags
     $alt = $this->mStripState->unstripBoth($alt);
     $alt = Sanitizer::stripAllTags($alt);
     $params['frame']['alt'] = $alt;
     $params['frame']['caption'] = $caption;
     # Linker does the rest
     $ret = $sk->makeImageLink2($title, $file, $params['frame'], $params['handler']);
     # Give the handler a chance to modify the parser object
     if ($handler) {
         $handler->parserTransformHook($this, $file);
     }
     return $ret;
 }
开发者ID:renemilk,项目名称:spring-website,代码行数:94,代码来源:Parser.php

示例9: displaytitle

 /**
  * Override the title of the page when viewed, provided we've been given a
  * title which will normalise to the canonical title
  *
  * @param Parser $parser Parent parser
  * @param string $text Desired title text
  * @param string $uarg
  * @return string
  */
 public static function displaytitle($parser, $text = '', $uarg = '')
 {
     global $wgRestrictDisplayTitle;
     static $magicWords = null;
     if (is_null($magicWords)) {
         $magicWords = new MagicWordArray(['displaytitle_noerror', 'displaytitle_noreplace']);
     }
     $arg = $magicWords->matchStartToEnd($uarg);
     // parse a limited subset of wiki markup (just the single quote items)
     $text = $parser->doQuotes($text);
     // remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
     $text = $parser->killMarkers($text);
     // list of disallowed tags for DISPLAYTITLE
     // these will be escaped even though they are allowed in normal wiki text
     $bad = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr', 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rtc', 'rp', 'br'];
     // disallow some styles that could be used to bypass $wgRestrictDisplayTitle
     if ($wgRestrictDisplayTitle) {
         $htmlTagsCallback = function (&$params) {
             $decoded = Sanitizer::decodeTagAttributes($params);
             if (isset($decoded['style'])) {
                 // this is called later anyway, but we need it right now for the regexes below to be safe
                 // calling it twice doesn't hurt
                 $decoded['style'] = Sanitizer::checkCss($decoded['style']);
                 if (preg_match('/(display|user-select|visibility)\\s*:/i', $decoded['style'])) {
                     $decoded['style'] = '/* attempt to bypass $wgRestrictDisplayTitle */';
                 }
             }
             $params = Sanitizer::safeEncodeTagAttributes($decoded);
         };
     } else {
         $htmlTagsCallback = null;
     }
     // only requested titles that normalize to the actual title are allowed through
     // if $wgRestrictDisplayTitle is true (it is by default)
     // mimic the escaping process that occurs in OutputPage::setPageTitle
     $text = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($text, $htmlTagsCallback, [], [], $bad));
     $title = Title::newFromText(Sanitizer::stripAllTags($text));
     if (!$wgRestrictDisplayTitle || $title instanceof Title && !$title->hasFragment() && $title->equals($parser->mTitle)) {
         $old = $parser->mOutput->getProperty('displaytitle');
         if ($old === false || $arg !== 'displaytitle_noreplace') {
             $parser->mOutput->setDisplayTitle($text);
         }
         if ($old !== false && $old !== $text && !$arg) {
             $converter = $parser->getConverterLanguage()->getConverter();
             return '<span class="error">' . wfMessage('duplicate-displaytitle', $converter->markNoConversion(wfEscapeWikiText($old)), $converter->markNoConversion(wfEscapeWikiText($text)))->inContentLanguage()->text() . '</span>';
         } else {
             return '';
         }
     } else {
         $parser->addTrackingCategory('restricted-displaytitle-ignored');
         $converter = $parser->getConverterLanguage()->getConverter();
         return '<span class="error">' . wfMessage('restricted-displaytitle', $converter->markNoConversion(wfEscapeWikiText($text)))->inContentLanguage()->text() . '</span>';
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:63,代码来源:CoreParserFunctions.php

示例10: formatComment

 /**
  * Formats a comment of revision via Linker:formatComment and Sanitizer::stripAllTags
  * @param string $comment the comment
  * @param string $title the title object of comments page
  * @return string formatted comment
  */
 protected function formatComment($comment, $title)
 {
     if ($comment !== '') {
         $comment = Linker::formatComment($comment, $title);
         // flatten back to text
         $comment = Sanitizer::stripAllTags($comment);
     }
     return $comment;
 }
开发者ID:GoProjectOwner,项目名称:mediawiki-extensions-MobileFrontend,代码行数:15,代码来源:SpecialMobileWatchlist.php

示例11: getCustomList


//.........这里部分代码省略.........
             }
             $aObjectList[] = $row;
             $iCount++;
         }
         $dbr->freeResult($res);
     } elseif ($aArgs['mode'] == 'whatlinkshere') {
         //PW(25.02.2015) TODO:
         //There could be filters - see Special:Whatlinkshere
         $oTargetTitle = empty($aArgs['target']) ? $this->getContext()->getTitle() : Title::newFromText($aArgs['target']);
         if (is_null($oTargetTitle)) {
             $oErrorListView->addItem(new ViewTagError(wfMessage('bs-smartlist-invalid-target')->text()));
             return $oErrorListView->execute();
         }
         $dbr = wfGetDB(DB_SLAVE);
         $aTables = array('pagelinks', 'page');
         $aFields = array('title' => 'page_title', 'namespace' => 'page_namespace');
         $aConditions = array("page_id = pl_from", "pl_namespace = {$oTargetTitle->getNamespace()}", "pl_from NOT IN ({$oTargetTitle->getArticleID()})", "pl_title = '{$oTargetTitle->getDBkey()}'");
         $aOptions = array();
         try {
             $aNamespaceIds = BsNamespaceHelper::getNamespaceIdsFromAmbiguousCSVString($aArgs['namespaces']);
             $aConditions['page_namespace'] = $aNamespaceIds;
         } catch (BsInvalidNamespaceException $ex) {
             $sInvalidNamespaces = implode(', ', $ex->getListOfInvalidNamespaces());
             $oErrorListView->addItem(new ViewTagError(wfMessage('bs-smartlist-invalid-namespaces')->numParams(count($ex->getListOfInvalidNamespaces()))->params($sInvalidNamespaces)->text()));
             return $oErrorListView->execute();
         }
         $this->makeCategoriesFilterCondition($aConditions, $aArgs, 'page_id');
         //Default: time
         $aOptions['ORDER BY'] = $aArgs['sort'] == 'title' ? 'page_title' : 'page_id';
         //Default DESC
         $aOptions['ORDER BY'] .= $aArgs['order'] == 'ASC' ? ' ASC' : ' DESC';
         $res = $dbr->select($aTables, $aFields, $aConditions, __METHOD__, $aOptions);
         $iCount = 0;
         foreach ($res as $row) {
             if ($iCount == $aArgs['count']) {
                 break;
             }
             $oTitle = Title::makeTitleSafe($row->namespace, $row->title);
             if (!$oTitle || !$oTitle->quickUserCan('read')) {
                 continue;
             }
             $aObjectList[] = $row;
             $iCount++;
         }
         $dbr->freeResult($res);
     } else {
         wfRunHooks('BSSmartListCustomMode', array(&$aObjectList, $aArgs, $this));
     }
     if ($oErrorListView->hasEntries()) {
         return $oErrorListView->execute();
     }
     $oSmartListListView = new ViewBaseElement();
     $oSmartListListView->setAutoElement(false);
     $iItems = 1;
     if (count($aObjectList)) {
         foreach ($aObjectList as $row) {
             $oTitle = Title::makeTitleSafe($row->namespace, $row->title);
             // Security here: only show pages the user can read.
             $sText = '';
             $sMeta = '';
             $sComment = '';
             $sTitle = $oTitle->getText();
             if (BsConfig::get('MW::SmartList::Comments')) {
                 $sComment = strlen($row->comment) > 50 ? substr($row->comment, 0, 50) . '...' : $row->comment;
                 $sComment = wfMessage('bs-smartlist-comment')->params($sComment)->escaped();
             }
             if (isset($aArgs['meta']) && $aArgs['meta'] == true) {
                 $sMeta = ' - <i>(' . $row->username . ', ' . $this->getLanguage()->date($row->time, true, true) . ')</i>';
             }
             $oSmartListListEntryView = new ViewBaseElement();
             if ($aArgs['showtext'] && $iItems <= $aArgs['numwithtext']) {
                 $oSmartListListEntryView->setTemplate('*[[:{NAMESPACE}:{TITLE}|{DISPLAYTITLE}]]{META}<br/>{TEXT}' . "\n");
                 $sText = BsPageContentProvider::getInstance()->getContentFromTitle($oTitle);
                 $sText = Sanitizer::stripAllTags($sText);
                 $sText = BsStringHelper::shorten($sText, array('max-length' => $aArgs['trimtext'], 'position' => 'end'));
                 $sText = '<nowiki>' . $sText . '</nowiki>';
             } else {
                 $oSmartListListEntryView->setTemplate('*[[:{NAMESPACE}:{TITLE}|{DISPLAYTITLE}]] {COMMENT} {META}' . "\n");
             }
             if ($aArgs['showns'] == true) {
                 $sDisplayTitle = $oTitle->getFullText();
             } else {
                 $sDisplayTitle = $oTitle->getText();
             }
             $sDisplayTitle = BsStringHelper::shorten($sDisplayTitle, array('max-length' => $aArgs['trim'], 'position' => 'middle'));
             $sNamespaceText = '';
             if ($row->namespace > 0 && $row->namespace != null) {
                 $sNamespaceText = MWNamespace::getCanonicalName($row->namespace);
             }
             $aData = array('NAMESPACE' => $sNamespaceText, 'TITLE' => $sTitle, 'DISPLAYTITLE' => $sDisplayTitle, 'COMMENT' => $sComment, 'META' => $sMeta, 'TEXT' => $sText);
             wfRunHooks('BSSmartListBeforeEntryViewAddData', array(&$aData, $aArgs, $oSmartListListEntryView, $row));
             $oSmartListListEntryView->addData($aData);
             $oSmartListListView->addItem($oSmartListListEntryView);
             $iItems++;
         }
     } else {
         return '';
     }
     return $this->mCore->parseWikiText($oSmartListListView->execute(), $this->getTitle());
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:101,代码来源:SmartList.class.php

示例12: prepareTextForIndex

 /**
  * Generates plain text content of a given wiki page without WikiText or HTML tags
  * @param object $oTitle Title object
  * @return string Plain text content
  */
 public function prepareTextForIndex(Title $oTitle)
 {
     $sText = WikiPage::newFromID($oTitle->getArticleID())->getContent()->getParserOutput($oTitle)->getText();
     $sText = Sanitizer::stripAllTags($sText);
     $sText = str_replace($this->aFragsToBeReplaced, ' ', $sText);
     $sText = html_entity_decode($sText);
     return $sText;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:13,代码来源:BuildIndexMainControl.class.php

示例13: makeImage

 /**
  * Parse image options text and use it to make an image
  */
 function makeImage($nt, $options)
 {
     # @TODO: let the MediaHandler specify its transform parameters
     #
     # Check if the options text is of the form "options|alt text"
     # Options are:
     #  * thumbnail       	make a thumbnail with enlarge-icon and caption, alignment depends on lang
     #  * left		no resizing, just left align. label is used for alt= only
     #  * right		same, but right aligned
     #  * none		same, but not aligned
     #  * ___px		scale to ___ pixels width, no aligning. e.g. use in taxobox
     #  * center		center the image
     #  * framed		Keep original image size, no magnify-button.
     # vertical-align values (no % or length right now):
     #  * baseline
     #  * sub
     #  * super
     #  * top
     #  * text-top
     #  * middle
     #  * bottom
     #  * text-bottom
     $part = array_map('trim', explode('|', $options));
     $mwAlign = array();
     $alignments = array('left', 'right', 'center', 'none', 'baseline', 'sub', 'super', 'top', 'text-top', 'middle', 'bottom', 'text-bottom');
     foreach ($alignments as $alignment) {
         $mwAlign[$alignment] =& MagicWord::get('img_' . $alignment);
     }
     $mwThumb =& MagicWord::get('img_thumbnail');
     $mwManualThumb =& MagicWord::get('img_manualthumb');
     $mwWidth =& MagicWord::get('img_width');
     $mwFramed =& MagicWord::get('img_framed');
     $mwPage =& MagicWord::get('img_page');
     $caption = '';
     $params = array();
     $framed = $thumb = false;
     $manual_thumb = '';
     $align = $valign = '';
     $sk = $this->mOptions->getSkin();
     foreach ($part as $val) {
         if (!is_null($mwThumb->matchVariableStartToEnd($val))) {
             $thumb = true;
         } elseif (!is_null($match = $mwManualThumb->matchVariableStartToEnd($val))) {
             # use manually specified thumbnail
             $thumb = true;
             $manual_thumb = $match;
         } else {
             foreach ($alignments as $alignment) {
                 if (!is_null($mwAlign[$alignment]->matchVariableStartToEnd($val))) {
                     switch ($alignment) {
                         case 'left':
                         case 'right':
                         case 'center':
                         case 'none':
                             $align = $alignment;
                             break;
                         default:
                             $valign = $alignment;
                     }
                     continue 2;
                 }
             }
             if (!is_null($match = $mwPage->matchVariableStartToEnd($val))) {
                 # Select a page in a multipage document
                 $params['page'] = $match;
             } elseif (!isset($params['width']) && !is_null($match = $mwWidth->matchVariableStartToEnd($val))) {
                 wfDebug("img_width match: {$match}\n");
                 # $match is the image width in pixels
                 $m = array();
                 if (preg_match('/^([0-9]*)x([0-9]*)$/', $match, $m)) {
                     $params['width'] = intval($m[1]);
                     $params['height'] = intval($m[2]);
                 } else {
                     $params['width'] = intval($match);
                 }
             } elseif (!is_null($mwFramed->matchVariableStartToEnd($val))) {
                 $framed = true;
             } else {
                 $caption = $val;
             }
         }
     }
     # Strip bad stuff out of the alt text
     $alt = $this->replaceLinkHoldersText($caption);
     # make sure there are no placeholders in thumbnail attributes
     # that are later expanded to html- so expand them now and
     # remove the tags
     $alt = $this->mStripState->unstripBoth($alt);
     $alt = Sanitizer::stripAllTags($alt);
     # Linker does the rest
     return $sk->makeImageLinkObj($nt, $caption, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:95,代码来源:Parser.php

示例14: ArticleEditUpdates

	/**
	 * ArticleEditUpdates hook handler function.
	 * Performs post-edit updates if article is a wikilog article.
	 */
	static function ArticleEditUpdates( &$article, &$editInfo, $changed ) {
		# When editing through MW interface, article is derived from
		# WikilogCommentsPage. In this case, update the comment object.
		if ( $article instanceof WikilogCommentsPage && $changed ) {
			$cmt =& $article->mSingleComment;
			if ( $cmt && !$cmt->isTextChanged() && $changed ) {
				$cmt->mUpdated = wfTimestamp( TS_MW );
				$cmt->saveComment();
			}
		}

		$title = $article->getTitle();
		$wi = Wikilog::getWikilogInfo( $title );

		# Do nothing if not a wikilog article.
		if ( !$wi ) return true;

		if ( $title->isTalkPage() ) {
			# ::WikilogCommentsPage::
			# Invalidate cache of wikilog item page.
			if ( $wi->getItemTitle()->exists() ) {
				$wi->getItemTitle()->invalidateCache();
				$wi->getItemTitle()->purgeSquid();
			}
		} elseif ( $wi->isItem() ) {
			# ::WikilogItemPage::
			$item = WikilogItem::newFromInfo( $wi );
			if ( !$item ) {
				$item = new WikilogItem();
			}

			$item->mName = $wi->getItemName();
			$item->mTitle = $wi->getItemTitle();
			$item->mParentName = $wi->getName();
			$item->mParentTitle = $wi->getTitle();
			$item->mParent = $item->mParentTitle->getArticleId();

			# Override item name if {{DISPLAYTITLE:...}} was used.
			$dtText = $editInfo->output->getDisplayTitle();
			if ( $dtText ) {
				# Tags are stripped on purpose.
				$dtText = Sanitizer::stripAllTags( $dtText );
				$dtParts = explode( '/', $dtText, 2 );
				if ( count( $dtParts ) > 1 ) {
					$item->mName = $dtParts[1];
				}
			}

			$item->resetID( $article->getId() );

			# Check if we have any wikilog metadata available.
			if ( isset( $editInfo->output->mExtWikilog ) ) {
				$output = $editInfo->output->mExtWikilog;

				# Update entry in wikilog_posts table.
				# Entries in wikilog_authors and wikilog_tags are updated
				# during LinksUpdate process.
				$item->mPublish = $output->mPublish;
				$item->mUpdated = wfTimestamp( TS_MW );
				$item->mPubDate = $output->mPublish ? $output->mPubDate : $item->mUpdated;
				$item->mAuthors = $output->mAuthors;
				$item->mTags    = $output->mTags;
				$item->saveData();
			} else {
				# Remove entry from tables. Entries in wikilog_authors and
				# wikilog_tags are removed during LinksUpdate process.
				$item->deleteData();
			}

			# Invalidate cache of parent wikilog page.
			WikilogUtils::updateWikilog( $wi->getTitle() );
		} else {
			# ::WikilogMainPage::
			$dbw = wfGetDB( DB_MASTER );
			$id = $article->getId();

			# Check if we have any wikilog metadata available.
			if ( isset( $editInfo->output->mExtWikilog ) ) {
				$output = $editInfo->output->mExtWikilog;
				$subtitle = $output->mSummary
					? array( 'html', $output->mSummary )
					: '';

				# Update entry in wikilog_wikilogs table. Entries in
				# wikilog_authors and wikilog_tags are updated during
				# LinksUpdate process.
				$dbw->replace(
					'wikilog_wikilogs',
					'wlw_page',
					array(
						'wlw_page' => $id,
						'wlw_subtitle' => serialize( $subtitle ),
						'wlw_icon' => $output->mIcon ? $output->mIcon->getDBKey() : '',
						'wlw_logo' => $output->mLogo ? $output->mLogo->getDBKey() : '',
						'wlw_authors' => serialize( $output->mAuthors ),
						'wlw_updated' => $dbw->timestamp()
//.........这里部分代码省略.........
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:WikilogHooks.php

示例15: appendDebugInfoToApiResult

 /**
  * Append the debug info to given ApiResult
  *
  * @param $context IContextSource
  * @param $result ApiResult
  */
 public static function appendDebugInfoToApiResult(IContextSource $context, ApiResult $result)
 {
     if (!self::$enabled) {
         return;
     }
     // output errors as debug info, when display_errors is on
     // this is necessary for all non html output of the api, because that clears all errors first
     $obContents = ob_get_contents();
     if ($obContents) {
         $obContentArray = explode('<br />', $obContents);
         foreach ($obContentArray as $obContent) {
             if (trim($obContent)) {
                 self::debugMsg(Sanitizer::stripAllTags($obContent));
             }
         }
     }
     MWDebug::log('MWDebug output complete');
     $debugInfo = self::getDebugInfo($context);
     $result->setIndexedTagName($debugInfo, 'debuginfo');
     $result->setIndexedTagName($debugInfo['log'], 'line');
     $result->setIndexedTagName($debugInfo['debugLog'], 'msg');
     $result->setIndexedTagName($debugInfo['queries'], 'query');
     $result->setIndexedTagName($debugInfo['includes'], 'queries');
     $result->addValue(null, 'debuginfo', $debugInfo);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:31,代码来源:Debug.php


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