當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ParserOptions::getThumbSize方法代碼示例

本文整理匯總了PHP中ParserOptions::getThumbSize方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParserOptions::getThumbSize方法的具體用法?PHP ParserOptions::getThumbSize怎麽用?PHP ParserOptions::getThumbSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ParserOptions的用法示例。


在下文中一共展示了ParserOptions::getThumbSize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的ParserOptions::getThumbSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。