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


PHP ParserOutput::addExternalLink方法代码示例

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


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

示例1: testGetExternalLinks

 public function testGetExternalLinks()
 {
     $parserOutput = new ParserOutput();
     $parserOutput->addExternalLink('https://foo');
     $parserOutput->addExternalLink('https://bar');
     $searchDataExtractor = new ParserOutputSearchDataExtractor();
     $this->assertEquals(['https://foo', 'https://bar'], $searchDataExtractor->getExternalLinks($parserOutput));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:ParserOutputSearchDataExtractorTest.php

示例2: makeImage


//.........这里部分代码省略.........
                     $height = $parsedWidthParam['height'];
                     if ($handler->validateParam('height', $height)) {
                         $params[$type]['height'] = $height;
                         $validated = true;
                     }
                 }
                 # else no validation -- bug 13436
             } else {
                 if ($type === 'handler') {
                     # Validate handler parameter
                     $validated = $handler->validateParam($paramName, $value);
                 } else {
                     # Validate internal parameters
                     switch ($paramName) {
                         case 'manualthumb':
                         case 'alt':
                         case 'class':
                             # @todo FIXME: Possibly check validity here for
                             # manualthumb? downstream behavior seems odd with
                             # missing manual thumbs.
                             $validated = true;
                             $value = $this->stripAltText($value, $holders);
                             break;
                         case 'link':
                             $chars = self::EXT_LINK_URL_CLASS;
                             $prots = $this->mUrlProtocols;
                             if ($value === '') {
                                 $paramName = 'no-link';
                                 $value = true;
                                 $validated = true;
                             } elseif (preg_match("/^(?i){$prots}/", $value)) {
                                 if (preg_match("/^((?i){$prots}){$chars}+\$/u", $value, $m)) {
                                     $paramName = 'link-url';
                                     $this->mOutput->addExternalLink($value);
                                     if ($this->mOptions->getExternalLinkTarget()) {
                                         $params[$type]['link-target'] = $this->mOptions->getExternalLinkTarget();
                                     }
                                     $validated = true;
                                 }
                             } else {
                                 $linkTitle = Title::newFromText($value);
                                 if ($linkTitle) {
                                     $paramName = 'link-title';
                                     $value = $linkTitle;
                                     $this->mOutput->addLink($linkTitle);
                                     $validated = true;
                                 }
                             }
                             break;
                         default:
                             # Most other things appear to be empty or numeric...
                             $validated = $value === false || is_numeric(trim($value));
                     }
                 }
                 if ($validated) {
                     $params[$type][$paramName] = $value;
                 }
             }
         }
         if (!$validated) {
             $caption = $part;
         }
     }
     # Process alignment parameters
     if ($params['horizAlign']) {
         $params['frame']['align'] = key($params['horizAlign']);
开发者ID:Tarendai,项目名称:spring-website,代码行数:67,代码来源:Parser.php


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