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


PHP Linker::makeImageLink方法代码示例

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


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

示例1: makeImage


//.........这里部分代码省略.........
                         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']);
     }
     if ($params['vertAlign']) {
         $params['frame']['valign'] = key($params['vertAlign']);
     }
     $params['frame']['caption'] = $caption;
     # Will the image be presented in a frame, with the caption below?
     $imageIsFramed = isset($params['frame']['frame']) || isset($params['frame']['framed']) || isset($params['frame']['thumbnail']) || isset($params['frame']['manualthumb']);
     # In the old days, [[Image:Foo|text...]] would set alt text.  Later it
     # came to also set the caption, ordinary text after the image -- which
     # makes no sense, because that just repeats the text multiple times in
     # screen readers.  It *also* came to set the title attribute.
     #
     # Now that we have an alt attribute, we should not set the alt text to
     # equal the caption: that's worse than useless, it just repeats the
     # text.  This is the framed/thumbnail case.  If there's no caption, we
     # use the unnamed parameter for alt text as well, just for the time be-
     # ing, if the unnamed param is set and the alt param is not.
     #
     # For the future, we need to figure out if we want to tweak this more,
     # e.g., introducing a title= parameter for the title; ignoring the un-
     # named parameter entirely for images without a caption; adding an ex-
     # plicit caption= parameter and preserving the old magic unnamed para-
     # meter for BC; ...
     if ($imageIsFramed) {
         # Framed image
         if ($caption === '' && !isset($params['frame']['alt'])) {
             # No caption or alt text, add the filename as the alt text so
             # that screen readers at least get some description of the image
             $params['frame']['alt'] = $title->getText();
         }
         # Do not set $params['frame']['title'] because tooltips don't make sense
         # for framed images
     } else {
         # Inline image
         if (!isset($params['frame']['alt'])) {
             # No alt text, use the "caption" for the alt text
             if ($caption !== '') {
                 $params['frame']['alt'] = $this->stripAltText($caption, $holders);
             } else {
                 # No caption, fall back to using the filename for the
                 # alt text
                 $params['frame']['alt'] = $title->getText();
             }
         }
         # Use the "caption" for the tooltip text
         $params['frame']['title'] = $this->stripAltText($caption, $holders);
     }
     wfRunHooks('ParserMakeImageParams', array($title, $file, &$params, $this));
     # Linker does the rest
     $time = isset($options['time']) ? $options['time'] : false;
     $ret = Linker::makeImageLink($this, $title, $file, $params['frame'], $params['handler'], $time, $descQuery, $this->mOptions->getThumbSize());
     # Give the handler a chance to modify the parser object
     if ($handler) {
         $handler->parserTransformHook($this, $file);
     }
     return $ret;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:Parser.php

示例2: makeImageLink

 public function makeImageLink(Parser $parser, Title $title, $file, $frameParams = [], $handlerParams = [], $time = false, $query = "", $widthOption = null)
 {
     return Linker::makeImageLink($parser, $title, $file, $frameParams, $handlerParams, $time, $query, $widthOption);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:4,代码来源:DummyLinker.php


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