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


PHP Linker::makeImageLink2方法代码示例

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


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

示例1: makeLogo

	/**
	 * Small convenience function to display a (clickable) logo
	 * @param $project Project name
	 * @return String
	 */
	public function makeLogo( $project, $clickable = true, $width = 25, $height = '', $url = '', $args = array() ) {
		$projectForFile = preg_replace('/ /', '-', strtolower( $project ) );
		$imageobj = wfFindFile( wfMsg( 'wminc-logo-' . $projectForFile ) );
		$useUrl = $url ? $url : IncubatorTest::getSubdomain( 'www', IncubatorTest::getProject( $project, false, true ) );
		if ( !$imageobj ) { # image not found
			if( !$clickable ) {
				return $logo; // FIXME: $logo is undefined
			}
			return Linker::makeExternalLink( $useUrl, $project, false );
		}
		if( $clickable ) {
			$args['link-url'] = $useUrl;
		} else {
			$args['no-link'] = true;
		}
		$handlerParams['width'] = $width;
		if( $height ) {
			$handlerParams['height'] = $height;
		}
		return Linker::makeImageLink2( $this->mTitle, $imageobj,
			array( 'alt' => $project, 'caption' => $project ) + $args, $handlerParams
		);
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:28,代码来源:InfoPage.php

示例2: makeImage


//.........这里部分代码省略.........
                             break;
                         case 'link':
                             $chars = self::EXT_LINK_URL_CLASS;
                             $prots = $this->mUrlProtocols;
                             if ($value === '') {
                                 $paramName = 'no-link';
                                 $value = true;
                                 $validated = true;
                             } elseif (preg_match("/^{$prots}/", $value)) {
                                 if (preg_match("/^({$prots}){$chars}+\$/", $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));
     # Linker does the rest
     $ret = Linker::makeImageLink2($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:eFFemeer,项目名称:seizamcore,代码行数:101,代码来源:Parser.php

示例3: makeImageLinkObj

 /**
  * Create image link in MediaWiki 1.10
  *
  * @param Title $nt
  * @param string $label label text
  * @param string $alt alt text
  * @param string $align horizontal alignment: none, left, center, right)
  * @param array $params Parameters to be passed to the media handler
  * @param boolean $framed shows image in original size in a frame
  * @param boolean $thumb shows image as thumbnail in a frame
  * @param string $manual_thumb image name for the manual thumbnail
  * @param string $valign vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom
  * @return string     *
  */
 function makeImageLinkObj($nt, $label, $alt, $align = '', $params = array(), $framed = false, $thumb = false, $manual_thumb = '', $valign = '')
 {
     $orginal = $nt->getText();
     $img = wfFindFile($nt);
     $found = $img->getURL();
     if (!is_null($alt) && $alt == 'RTENOTITLE') {
         // 2223
         $alt = '';
     }
     if ($found) {
         // trick to get real URL for image:
         $frameParams = array('alt' => $alt, 'caption' => $label, 'align' => $align, 'framed' => $framed, 'thumbnail' => $thumb, 'manualthumb' => $manual_thumb, 'valign' => $valign);
         $originalLink = strip_tags(Linker::makeImageLink2($nt, $img, $frameParams, $params), '<img>');
         $srcPart = substr($originalLink, strpos($originalLink, "src=") + 5);
         $url = strtok($srcPart, '"');
     }
     $ret = '<img ';
     if ($found) {
         $ret .= "src=\"{$url}\" ";
     } else {
         $ret .= "_fck_mw_valid=\"false" . "\" ";
     }
     $ret .= "_fck_mw_filename=\"{$orginal}\" ";
     if ($align) {
         $ret .= "_fck_mw_location=\"" . strtolower($align) . "\" ";
     }
     if (!empty($params)) {
         if (isset($params['width'])) {
             $ret .= "_fck_mw_width=\"" . $params['width'] . "\" ";
         }
         if (isset($params['height'])) {
             $ret .= "_fck_mw_height=\"" . $params['height'] . "\" ";
         }
     }
     $class = '';
     if ($thumb) {
         $ret .= "_fck_mw_type=\"thumb" . "\" ";
         $class .= "fck_mw_frame";
     } elseif ($framed) {
         $ret .= "_fck_mw_type=\"frame" . "\" ";
         $class .= "fck_mw_frame";
     }
     if ($align == 'right') {
         $class .= ($class ? ' ' : '') . 'fck_mw_right';
     } elseif ($align == 'center') {
         $class .= ($class ? ' ' : '') . 'fck_mw_center';
     } elseif ($align == 'left') {
         $class .= ($class ? ' ' : '') . 'fck_mw_left';
     } elseif ($framed || $thumb) {
         $class .= ($class ? ' ' : '') . 'fck_mw_right';
     }
     if (!$found) {
         $class .= ($class ? ' ' : '') . 'fck_mw_notfound';
     }
     if (!is_null($alt) && !empty($alt) && false !== strpos(FCKeditorParser::$fkc_mw_makeImage_options, $alt) && $alt != 'Image:' . $orginal) {
         $ret .= "alt=\"" . htmlspecialchars($alt) . "\" ";
     } else {
         $ret .= "alt=\"\" ";
     }
     if ($class) {
         $ret .= "class=\"{$class}\" ";
     }
     $ret .= '/>';
     return $ret;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:79,代码来源:FCKeditorSkin.body.php

示例4: makeImageLink2

 function makeImageLink2(Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "")
 {
     if (!$file || !$file->exists()) {
         return "";
     }
     // remove none bitmap links
     if ($file->getMediaType() != "BITMAP" && $file->getMediaType() != "DRAWING" || preg_match('/\\.djvu$/', $title)) {
         return "";
     }
     $html = Linker::makeImageLink2($title, $file, $frameParams, $handlerParams, $time, $query);
     // remove image links, the test is a trick to avoid doing that for imagemap pictures
     $trace = debug_backtrace();
     $caller = $trace[2];
     if ($caller['class'] == 'ParserOriginal' || $caller['class'] == 'Parser') {
         preg_match_all('/<a [^>]*>(.*?<img.*?)<\\/a>/s', $html, $matches);
         if (count($matches)) {
             $html = str_replace($matches[0], $matches[1], $html);
         }
     }
     return $html;
 }
开发者ID:kiwix,项目名称:tools,代码行数:21,代码来源:KiwixBaseSkin.php

示例5: array

 /**
  * Make an image link in MediaWiki 1.11
  * @param Title $title Title object
  * @param File $file File object, or false if it doesn't exist
  *
  * @param array $frameParams Associative array of parameters external to the media handler.
  *     Boolean parameters are indicated by presence or absence, the value is arbitrary and
  *     will often be false.
  *          thumbnail       If present, downscale and frame
  *          manualthumb     Image name to use as a thumbnail, instead of automatic scaling
  *          framed          Shows image in original size in a frame
  *          frameless       Downscale but don't frame
  *          upright         If present, tweak default sizes for portrait orientation
  *          upright_factor  Fudge factor for "upright" tweak (default 0.75)
  *          border          If present, show a border around the image
  *          align           Horizontal alignment (left, right, center, none)
  *          valign          Vertical alignment (baseline, sub, super, top, text-top, middle,
  *                          bottom, text-bottom)
  *          alt             Alternate text for image (i.e. alt attribute). Plain text.
  *          caption         HTML for image caption.
  *
  * @param array $handlerParams Associative array of media handler parameters, to be passed
  *       to transform(). Typical keys are "width" and "page".
  */
 function makeImageLink2(Title $nt, $file, $frameParams = array(), $handlerParams = array())
 {
     $orginal = $nt->getText();
     $img = new Image($nt);
     $imgName = $img->getName();
     $found = $img->getURL();
     if (!empty($frameParams['alt']) && $frameParams['alt'] == 'RTENOTITLE') {
         // 2223
         $frameParams['alt'] = '';
     }
     if ($found) {
         $linker = new Linker();
         $originalLink = $linker->makeImageLink2($nt, $file, $frameParams, $handlerParams);
         if (false !== strpos($originalLink, "src=\"")) {
             $srcPart = substr($originalLink, strpos($originalLink, "src=") + 5);
             $url = strtok($srcPart, '"');
         }
         $srcPart = substr($originalLink, strpos($originalLink, "src=") + 5);
         $url = strtok($srcPart, '"');
     }
     // Shortcuts
     $fp =& $frameParams;
     $hp =& $handlerParams;
     if (!isset($fp['align'])) {
         $fp['align'] = '';
     }
     $ret = '<img ';
     if ($found) {
         $ret .= "src=\"{$url}\" ";
     } else {
         $ret .= "_fck_mw_valid=\"false" . "\" ";
     }
     $ret .= "_fck_mw_filename=\"{$orginal}\" ";
     if ($fp['align']) {
         $ret .= "_fck_mw_location=\"" . strtolower($fp['align']) . "\" ";
     }
     if (!empty($hp)) {
         if (isset($hp['width'])) {
             $ret .= "_fck_mw_width=\"" . $hp['width'] . "\" ";
         }
         if (isset($hp['height'])) {
             $ret .= "_fck_mw_height=\"" . $hp['height'] . "\" ";
         }
     }
     $class = '';
     if (isset($fp['thumbnail'])) {
         $ret .= "_fck_mw_type=\"thumb" . "\" ";
         $class .= 'fck_mw_frame';
     } else {
         if (isset($fp['border'])) {
             $ret .= "_fck_mw_type=\"border" . "\" ";
             $class .= 'fck_mw_border';
         } else {
             if (isset($fp['framed'])) {
                 $ret .= "_fck_mw_type=\"frame" . "\" ";
                 $class .= 'fck_mw_frame';
             }
         }
     }
     if ($fp['align'] == 'right') {
         $class .= ($class ? ' ' : '') . 'fck_mw_right';
     } else {
         if ($fp['align'] == 'center') {
             $class .= ($class ? ' ' : '') . 'fck_mw_center';
         } else {
             if ($fp['align'] == 'left') {
                 $class .= ($class ? ' ' : '') . 'fck_mw_left';
             } else {
                 if (isset($fp['framed']) || isset($fp['thumbnail'])) {
                     $class .= ($class ? ' ' : '') . 'fck_mw_right';
                 }
             }
         }
     }
     if (!$found) {
         $class .= ($class ? ' ' : '') . 'fck_mw_notfound';
//.........这里部分代码省略.........
开发者ID:AbedSHP,项目名称:WYSIWYG-CKeditor,代码行数:101,代码来源:CKeditorSkin.body.php


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