Ticket #2223: 2223_5.patch
File 2223_5.patch, 9.3 KB (added by , 15 years ago) |
---|
-
FCKeditorParser.body.php
305 305 } 306 306 307 307 function replaceInternalLinks( $text ) { 308 $text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "[[ RTENOTITLE$1|$1]]", $text); //#2223: [[()]] => [[RTENOTITLE%1|%1]]308 $text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "[[$1|RTENOTITLE]]", $text); //#2223: [[()]] => [[%1|RTENOTITLE]] 309 309 $text = preg_replace("/\[\[:(.*?)\]\]/", "[[RTECOLON$1]]", $text); //change ':' => 'RTECOLON' in links 310 310 $text = parent::replaceInternalLinks($text); 311 $text = preg_replace("/<strong class=\"selflink\">(.*?)<\/strong>/", "<a href=\"".$this->mTitle->mDbkeyform."\" class=\"selflink\">$1</a>", $text); // #2075 312 $text = preg_replace("/\[\[RTENOTITLE(.*?)\|/", "[[", $text); // remove unused RTENOTITLE 311 $text = preg_replace("/\|RTENOTITLE\]\]/", "]]", $text); // remove unused RTENOTITLE 313 312 314 313 return $text; 315 314 } -
FCKeditorSkin.body.php
24 24 $imgName = $img->getName(); 25 25 $found = $img->getURL(); 26 26 27 if (!is_null($alt) && ( $alt == 'RTENOTITLE' )) { //2223 28 $alt = ''; 29 } 30 27 31 if ($found) { 28 32 //trick to get real Url for image: 29 33 $originalLink = strip_tags(Linker::makeImageLinkObj($nt, $label, $alt, $align , $params , $framed , $thumb , $manual_thumb , $valign ), "<img>"); … … 125 129 $imgName = $img->getName(); 126 130 $found = $img->getURL(); 127 131 132 if( $frameParams['alt'] == 'RTENOTITLE' ){ //2223 133 $frameParams['alt'] = ''; 134 } 128 135 if ($found) { 129 136 $linker = new Linker(); 130 137 $originalLink = $linker->makeImageLink2( $nt, $file, $frameParams, $handlerParams); … … 212 219 213 220 return $ret; 214 221 } 222 223 function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) { 224 global $wgUser; 225 226 wfProfileIn( __METHOD__ ); 227 if ( $nt->isExternal() ) { 228 $args = ''; 229 $u = $nt->getFullURL(); 230 $link = $nt->getPrefixedURL(); 231 if ( '' == $text ) { $text = $nt->getPrefixedText(); } 232 $style = $this->getInterwikiLinkAttributes( $link, $text, 'extiw' ); 215 233 234 $inside = ''; 235 if ( '' != $trail ) { 236 $m = array(); 237 if ( preg_match( '/^([a-z]+)(.*)$$/sD', $trail, $m ) ) { 238 $inside = $m[1]; 239 $trail = $m[2]; 240 } 241 } 242 if( $text == 'RTENOTITLE' ) { //2223 243 $text = $u; 244 $args .= '_fcknotitle="true" '; 245 } 246 $t = "<a {$args}href=\"{$u}\"{$style}>{$text}{$inside}</a>"; 247 248 wfProfileOut( __METHOD__ ); 249 return $t; 250 } 251 252 return Linker::makeLinkObj($nt, $text, $query, $trail, $prefix); 253 254 } 216 255 function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) { 217 256 $fname = 'FCKeditorSkin::makeKnownLinkObj'; 218 257 wfProfileIn( $fname ); 219 258 259 $args = ''; 220 260 if ( !is_object( $nt ) ) { 221 261 wfProfileOut( $fname ); 222 262 return $text; … … 249 289 } 250 290 251 291 list( $inside, $trail ) = Linker::splitTrail( $trail ); 252 $r = "<a href=\"{$u}\">{$prefix}{$text}{$inside}</a>{$trail}"; 292 $title = "{$prefix}{$text}{$inside}"; 293 294 $u = preg_replace("/^RTECOLON/", ":", $u); //change 'RTECOLON' => ':' 295 if( $text == 'RTENOTITLE' ){ 296 $args .= '_fcknotitle="true" '; 297 $title = $u; 298 } 299 300 $r = "<a {$args}href=\"{$u}\">{$title}</a>{$trail}"; 253 301 wfProfileOut( $fname ); 254 302 return $r; 255 303 } … … 260 308 # throw new MWException(); 261 309 return "<!-- ERROR -->{$prefix}{$text}{$trail}"; 262 310 } 311 $args = ''; 263 312 264 313 $fname = 'FCKeditorSkin::makeBrokenLinkObj'; 265 314 wfProfileIn( $fname ); … … 274 323 } 275 324 276 325 list( $inside, $trail ) = Linker::splitTrail( $trail ); 277 $ s = "<a href=\"{$u}\">{$prefix}{$text}{$inside}</a>{$trail}";326 $title = "{$prefix}{$text}{$inside}"; 278 327 328 $u = preg_replace("/^RTECOLON/", ":", $u); //change 'RTECOLON' => ':' 329 if( $text == 'RTENOTITLE' ){ 330 $args .= '_fcknotitle="true" '; 331 $title = $u; 332 } 333 334 $s = "<a {$args}href=\"{$u}\">{$title}</a>{$trail}"; 335 279 336 wfProfileOut( $fname ); 280 337 return $s; 281 338 } 282 339 340 function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { 341 if ( '' == $text ) { 342 $text = $nt->mDbkeyform; 343 } 344 list( $inside, $trail ) = Linker::splitTrail( $trail ); 345 $title = "{$prefix}{$text}{$inside}"; 346 if( $text == 'RTENOTITLE' ){ //2223 347 $args .= '_fcknotitle="true" '; 348 $title = $nt->mDbkeyform; 349 } 350 return "<a {$args}href=\"".$nt->mDbkeyform."\" class=\"selflink\">{$title}</a>{$trail}"; 351 } 352 283 353 /** 284 354 * Create a direct link to a given uploaded file. 285 355 * … … 295 365 ### HOTFIX. Instead of breaking, return empty string. 296 366 return $text; 297 367 } else { 368 $args = ''; 298 369 $orginal = $title->getPartialURL(); 299 370 // Mediawiki 1.11 300 371 if ( function_exists('wfFindFile') ) { … … 324 395 if( $text == '' ) { 325 396 $text = $alt; 326 397 } 327 $u = htmlspecialchars( $url ); 328 return "<a href=\"{$orginal}\" class=\"$class\" _fck_mw_filename=\"{$orginal}\" _fck_mw_type=\"media\" title=\"{$alt}\">{$text}</a>"; 398 $orginal = preg_replace("/^RTECOLON/", ":", $orginal); //change 'RTECOLON' => ':' 399 if( $text == 'RTENOTITLE' ){ //2223 400 $args .= '_fcknotitle="true" '; 401 $text = $orginal; 402 $alt = $orginal; 403 } 404 return "<a href=\"{$orginal}\" class=\"$class\" {$args} _fck_mw_filename=\"{$orginal}\" _fck_mw_type=\"media\" title=\"{$alt}\">{$text}</a>"; 329 405 } 330 406 } 331 407 … … 334 410 if( $escape ) { 335 411 $text = htmlspecialchars( $text ); 336 412 } 413 $url = preg_replace("/^RTECOLON/", ":", $url); //change 'RTECOLON' => ':' 337 414 if ($linktype == 'autonumber') { 338 415 return '<a href="'.$url.'">[n]</a>'; 339 416 } 340 return '<a href="'.$url.'">'.$text.'</a>'; 417 $args = ''; 418 if( $text == 'RTENOTITLE' ){ //2223 419 $args .= '_fcknotitle="true" '; 420 $text = $url; 421 } 422 return '<a '.$args.'href="'.$url.'">'.$text.'</a>'; 341 423 } 342 424 343 425 function __call( $m, $a) { -
mw12/FCKeditorParser_OldPP.body.php
306 306 } 307 307 308 308 function replaceInternalLinks( $text ) { 309 $text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "[[ RTENOTITLE$1|$1]]", $text); //#2223: [[()]] => [[RTENOTITLE%1|%1]]309 $text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "[[$1|RTENOTITLE]]", $text); //#2223: [[()]] => [[%1|RTENOTITLE]] 310 310 $text = preg_replace("/\[\[:(.*?)\]\]/", "[[RTECOLON$1]]", $text); //change ':' => 'RTECOLON' in links 311 311 $text = parent::replaceInternalLinks($text); 312 $text = preg_replace("/<strong class=\"selflink\">(.*?)<\/strong>/", "<a href=\"".$this->mTitle->mDbkeyform."\" class=\"selflink\">$1</a>", $text); // #2075 313 $text = preg_replace("/\[\[RTENOTITLE(.*?)\|/", "[[", $text); // remove unused RTENOTITLE 312 $text = preg_replace("/\|RTENOTITLE\]\]/", "]]", $text); // remove unused RTENOTITLE 314 313 315 314 return $text; 316 315 } 317 316 317 318 318 function makeImage( $nt, $options ) { 319 319 FCKeditorParser::$fkc_mw_makeImage_options = $options; 320 320 return parent::makeImage( $nt, $options ); … … 496 496 } 497 497 $parserOutput->setText($text); 498 498 } 499 499 500 500 if (!empty($parserOutput->mLanguageLinks)) { 501 501 foreach ($parserOutput->mLanguageLinks as $l) { 502 502 $parserOutput->setText($parserOutput->getText() . "\n" . "<a href=\"".$l."\">".$l."</a>") ; -
plugins/mediawiki/dialogs/link.html
70 70 sHRef = oLink.getAttribute( 'href' , 2 ) || '' ; 71 71 72 72 sHRef = FCKConfig.ProtectedSource.Revert(sHRef, 0); //#2509 73 if (sHRef.toLowerCase().StartsWith( 'rtenotitle' ) )74 {75 sHRef = sHRef.substring(10);76 bLinkEqualsName = true;77 }78 73 79 74 if ( sHRef == oLink.innerHTML ) 80 75 bLinkEqualsName = true ; … … 189 184 var sUri = GetE('txtUrl').value ; 190 185 sUri = FCKConfig.ProtectedSource.Protect(sUri); //#2509 191 186 var realUri = sUri; 192 if ( bLinkEqualsName ) {193 sUri = 'RTENOTITLE'+ sUri;194 }195 187 if (sUri.StartsWith( ':' ) ) 196 188 sUri = sUri.replace(/:/, "rtecolon"); 197 189 var sInnerHtml ; -
plugins/mediawiki/fckplugin.js
367 367 stringBuilder.push( isWikiUrl ? '[[' : '[' ) ; 368 368 } 369 369 //#2223 370 if (h ref.toLowerCase().StartsWith( 'rtenotitle' ))370 if (htmlNode.getAttribute( '_fcknotitle' ) && htmlNode.getAttribute( '_fcknotitle' ) == "true") 371 371 { 372 href = href.substring(10); 373 if ( FCKConfig.ProtectedSource.Revert(htmlNode.innerHTML, 0) == FCKConfig.ProtectedSource.Revert(href, 0) ) pipeline = false; 372 var testInner = FCKConfig.ProtectedSource.Revert(htmlNode.innerHTML, 0); 373 testInner = testInner.replace(/&/, "&") 374 if ( testInner == FCKConfig.ProtectedSource.Revert(href, 0) ) pipeline = false; 374 375 } 375 376 if (href.toLowerCase().StartsWith( 'rtecolon' )) //change 'rtecolon=' => ':' in links 376 377 {