本文整理汇总了PHP中Linker::makeImageLinkObj方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::makeImageLinkObj方法的具体用法?PHP Linker::makeImageLinkObj怎么用?PHP Linker::makeImageLinkObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::makeImageLinkObj方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 = new Image($nt);
$imgName = $img->getName();
$found = $img->getURL();
if (!is_null($alt) && $alt == 'RTENOTITLE') {
// 2223
$alt = '';
}
if ($found) {
// trick to get real URL for image:
$originalLink = strip_tags(Linker::makeImageLinkObj($nt, $label, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign), '<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";
} else {
if ($framed) {
$ret .= "_fck_mw_type=\"frame" . "\" ";
$class .= "fck_mw_frame";
}
}
if ($align == 'right') {
$class .= ($class ? ' ' : '') . 'fck_mw_right';
} else {
if ($align == 'center') {
$class .= ($class ? ' ' : '') . 'fck_mw_center';
} else {
if ($align == 'left') {
$class .= ($class ? ' ' : '') . 'fck_mw_left';
} else {
if ($framed || $thumb) {
$class .= ($class ? ' ' : '') . 'fck_mw_right';
}
}
}
}
if (!$found) {
$class .= ($class ? ' ' : '') . 'fck_mw_notfound';
}
if (!is_null($alt) && !empty($alt) && false !== strpos(CKeditorParser::$fkc_mw_makeImage_options, $alt) && $alt != 'Image:' . $orginal) {
$ret .= "alt=\"" . htmlspecialchars($alt) . "\" ";
} else {
$ret .= "alt=\"\" ";
}
if ($class) {
$ret .= "class=\"{$class}\" ";
}
$ret .= '/>';
return $ret;
}