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


PHP Parser::getTargetLanguage方法代码示例

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


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

示例1: getLang

 /**
  * Determines the correct language to be used for this image gallery
  * @return Language object
  */
 private function getLang()
 {
     global $wgLang;
     return $this->mParser ? $this->mParser->getTargetLanguage() : $wgLang;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:9,代码来源:ImageGallery.php

示例2: makeImageLink


//.........这里部分代码省略.........
         return $res;
     }
     if ($file && !$file->allowInlineDisplay()) {
         wfDebug(__METHOD__ . ': ' . $title->getPrefixedDBkey() . " does not allow inline display\n");
         return self::link($title);
     }
     // Shortcuts
     $fp =& $frameParams;
     $hp =& $handlerParams;
     // Clean up parameters
     $page = isset($hp['page']) ? $hp['page'] : false;
     if (!isset($fp['align'])) {
         $fp['align'] = '';
     }
     if (!isset($fp['alt'])) {
         $fp['alt'] = '';
     }
     if (!isset($fp['title'])) {
         $fp['title'] = '';
     }
     if (!isset($fp['class'])) {
         $fp['class'] = '';
     }
     $prefix = $postfix = '';
     if ('center' == $fp['align']) {
         $prefix = '<div class="center">';
         $postfix = '</div>';
         $fp['align'] = 'none';
     }
     if ($file && !isset($hp['width'])) {
         if (isset($hp['height']) && $file->isVectorized()) {
             // If its a vector image, and user only specifies height
             // we don't want it to be limited by its "normal" width.
             global $wgSVGMaxSize;
             $hp['width'] = $wgSVGMaxSize;
         } else {
             $hp['width'] = $file->getWidth($page);
         }
         if (isset($fp['thumbnail']) || isset($fp['manualthumb']) || isset($fp['framed']) || isset($fp['frameless']) || !$hp['width']) {
             global $wgThumbLimits, $wgThumbUpright;
             if ($widthOption === null || !isset($wgThumbLimits[$widthOption])) {
                 $widthOption = User::getDefaultOption('thumbsize');
             }
             // Reduce width for upright images when parameter 'upright' is used
             if (isset($fp['upright']) && $fp['upright'] == 0) {
                 $fp['upright'] = $wgThumbUpright;
             }
             // For caching health: If width scaled down due to upright
             // parameter, round to full __0 pixel to avoid the creation of a
             // lot of odd thumbs.
             $prefWidth = isset($fp['upright']) ? round($wgThumbLimits[$widthOption] * $fp['upright'], -1) : $wgThumbLimits[$widthOption];
             // Use width which is smaller: real image width or user preference width
             // Unless image is scalable vector.
             if (!isset($hp['height']) && ($hp['width'] <= 0 || $prefWidth < $hp['width'] || $file->isVectorized())) {
                 $hp['width'] = $prefWidth;
             }
         }
     }
     if (isset($fp['thumbnail']) || isset($fp['manualthumb']) || isset($fp['framed'])) {
         # Create a thumbnail. Alignment depends on the writing direction of
         # the page content language (right-aligned for LTR languages,
         # left-aligned for RTL languages)
         # If a thumbnail width has not been provided, it is set
         # to the default user option as specified in Language*.php
         if ($fp['align'] == '') {
             $fp['align'] = $parser->getTargetLanguage()->alignEnd();
         }
         return $prefix . self::makeThumbLink2($title, $file, $fp, $hp, $time, $query) . $postfix;
     }
     if ($file && isset($fp['frameless'])) {
         $srcWidth = $file->getWidth($page);
         # For "frameless" option: do not present an image bigger than the
         # source (for bitmap-style images). This is the same behavior as the
         # "thumb" option does it already.
         if ($srcWidth && !$file->mustRender() && $hp['width'] > $srcWidth) {
             $hp['width'] = $srcWidth;
         }
     }
     if ($file && isset($hp['width'])) {
         # Create a resized image, without the additional thumbnail features
         $thumb = $file->transform($hp);
     } else {
         $thumb = false;
     }
     if (!$thumb) {
         $s = self::makeBrokenImageLinkObj($title, $fp['title'], '', '', '', $time == true);
     } else {
         self::processResponsiveImages($file, $thumb, $hp);
         $params = array('alt' => $fp['alt'], 'title' => $fp['title'], 'valign' => isset($fp['valign']) ? $fp['valign'] : false, 'img-class' => $fp['class']);
         if (isset($fp['border'])) {
             $params['img-class'] .= ($params['img-class'] !== '' ? ' ' : '') . 'thumbborder';
         }
         $params = self::getImageLinkMTOParams($fp, $query, $parser) + $params;
         $s = $thumb->toHtml($params);
     }
     if ($fp['align'] != '') {
         $s = "<div class=\"float{$fp['align']}\">{$s}</div>";
     }
     return str_replace("\n", ' ', $prefix . $s . $postfix);
 }
开发者ID:paladox,项目名称:2,代码行数:101,代码来源:Linker.php

示例3: getRenderLang

	/**
	 * Determines the correct language to be used for this image gallery
	 * @return Language object
	 */
	protected function getRenderLang() {
		return $this->mParser
			? $this->mParser->getTargetLanguage()
			: $this->getLanguage();
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:9,代码来源:ImageGalleryBase.php


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