當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。