| 10 | | * @param Title $nt |
| 11 | | * @param unknown_type $label |
| 12 | | * @param unknown_type $alt |
| 13 | | * @param unknown_type $align |
| 14 | | * @param unknown_type $params |
| 15 | | * @param unknown_type $framed |
| 16 | | * @param unknown_type $thumb |
| 17 | | * @param unknown_type $manual_thumb |
| 18 | | * @param unknown_type $valign |
| 19 | | * @return unknown |
| | 10 | * @param Title $nt |
| | 11 | * @param string $label label text |
| | 12 | * @param string $alt alt text |
| | 13 | * @param string $align horizontal alignment: none, left, center, right) |
| | 14 | * @param array $params Parameters to be passed to the media handler |
| | 15 | * @param boolean $framed shows image in original size in a frame |
| | 16 | * @param boolean $thumb shows image as thumbnail in a frame |
| | 17 | * @param string $manual_thumb image name for the manual thumbnail |
| | 18 | * @param string $valign vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom |
| | 19 | * @return string * |
| 94 | | |
| | 94 | |
| | 95 | $ret .= "/>"; |
| | 96 | |
| | 97 | return $ret; |
| | 98 | } |
| | 99 | |
| | 100 | /** |
| | 101 | * Make an image link in Mediawiki 1.11 |
| | 102 | * @param Title $title Title object |
| | 103 | * @param File $file File object, or false if it doesn't exist |
| | 104 | * |
| | 105 | * @param array $frameParams Associative array of parameters external to the media handler. |
| | 106 | * Boolean parameters are indicated by presence or absence, the value is arbitrary and |
| | 107 | * will often be false. |
| | 108 | * thumbnail If present, downscale and frame |
| | 109 | * manualthumb Image name to use as a thumbnail, instead of automatic scaling |
| | 110 | * framed Shows image in original size in a frame |
| | 111 | * frameless Downscale but don't frame |
| | 112 | * upright If present, tweak default sizes for portrait orientation |
| | 113 | * upright_factor Fudge factor for "upright" tweak (default 0.75) |
| | 114 | * border If present, show a border around the image |
| | 115 | * align Horizontal alignment (left, right, center, none) |
| | 116 | * valign Vertical alignment (baseline, sub, super, top, text-top, middle, |
| | 117 | * bottom, text-bottom) |
| | 118 | * alt Alternate text for image (i.e. alt attribute). Plain text. |
| | 119 | * caption HTML for image caption. |
| | 120 | * |
| | 121 | * @param array $handlerParams Associative array of media handler parameters, to be passed |
| | 122 | * to transform(). Typical keys are "width" and "page". |
| | 123 | */ |
| | 124 | function makeImageLink2( Title $nt, $file, $frameParams = array(), $handlerParams = array() ) { |
| | 125 | $orginal = $nt->getText(); |
| | 126 | $img = new Image( $nt ); |
| | 127 | $imgName = $img->getName(); |
| | 128 | $found = $img->getURL(); |
| | 129 | |
| | 130 | if ($found) { |
| | 131 | $originalLink = Linker::makeImageLink2( $nt, $file, $frameParams, $handlerParams); |
| | 132 | |
| | 133 | if (false !== strpos($originalLink, "src=\"")) { |
| | 134 | $srcPart = substr($originalLink, strpos($originalLink, "src=")+ 5); |
| | 135 | $url = strtok($srcPart, '"'); |
| | 136 | } |
| | 137 | $srcPart = substr($originalLink, strpos($originalLink, "src=")+ 5); |
| | 138 | $url = strtok($srcPart, '"'); |
| | 139 | } |
| | 140 | |
| | 141 | // Shortcuts |
| | 142 | $fp =& $frameParams; |
| | 143 | $hp =& $handlerParams; |
| | 144 | |
| | 145 | if (!isset($fp['align'])) { |
| | 146 | $fp['align'] = ''; |
| | 147 | } |
| | 148 | |
| | 149 | $ret = "<img "; |
| | 150 | |
| | 151 | if ($found) { |
| | 152 | $ret .= "src=\"{$url}\" "; |
| | 153 | } |
| | 154 | else { |
| | 155 | $ret .= "_fck_mw_valid=\"false"."\" "; |
| | 156 | } |
| | 157 | $ret .= "_fck_mw_filename=\"{$orginal}\" "; |
| | 158 | |
| | 159 | if ($fp['align']) { |
| | 160 | $ret .= "_fck_mw_location=\"".strtolower($fp['align'])."\" "; |
| | 161 | } |
| | 162 | if (!empty($hp)) { |
| | 163 | if (isset($hp['width'])) { |
| | 164 | $ret .= "_fck_mw_width=\"".$hp['width']."\" "; |
| | 165 | } |
| | 166 | if (isset($hp['height'])) { |
| | 167 | $ret .= "_fck_mw_height=\"".$hp['height']."\" "; |
| | 168 | } |
| | 169 | } |
| | 170 | $class = ""; |
| | 171 | if (isset($fp['thumbnail'])) { |
| | 172 | $ret .= "_fck_mw_type=\"thumb"."\" "; |
| | 173 | $class .= "fck_mw_frame"; |
| | 174 | } |
| | 175 | else if (isset($fp['framed'])) { |
| | 176 | $ret .= "_fck_mw_type=\"frame"."\" "; |
| | 177 | $class .= "fck_mw_frame"; |
| | 178 | } |
| | 179 | |
| | 180 | if ($fp['align'] == "right") { |
| | 181 | $class .= ($class?" ":"") . "fck_mw_right"; |
| | 182 | } |
| | 183 | else if($fp['align'] == "center") { |
| | 184 | $class .= ($class?" ":"") . "fck_mw_center"; |
| | 185 | } |
| | 186 | else if($fp['align'] == "left") { |
| | 187 | $class .= ($class?" ":"") . "fck_mw_left"; |
| | 188 | } |
| | 189 | else if(isset($fp['framed']) || isset($fp['thumbnail'])) { |
| | 190 | $class .= ($class?" ":"") . "fck_mw_right"; |
| | 191 | } |
| | 192 | |
| | 193 | if (!$found) { |
| | 194 | $class .= ($class?" ":"") . "fck_mw_notfound"; |
| | 195 | } |
| | 196 | |
| | 197 | if (isset($fp['alt']) && !empty($fp['alt']) && false !== strpos(FCKeditorParser::$fkc_mw_makeImage_options, $fp['alt']) && $fp['alt'] != "Image:" . $orginal) { |
| | 198 | $ret .= "alt=\"".htmlspecialchars($fp['alt'])."\" "; |
| | 199 | } |
| | 200 | else { |
| | 201 | $ret .= "alt=\"\" "; |
| | 202 | } |
| | 203 | |
| | 204 | if ($class) { |
| | 205 | $ret .= "class=\"$class\" "; |
| | 206 | } |
| | 207 | |