Ticket #2223: 2223_6.patch
File 2223_6.patch, 11.2 KB (added by , 16 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 } … … 468 467 if ($categories) { 469 468 $appendString = ""; 470 469 foreach ($categories as $cat=>$val) { 470 $args = ''; 471 if( $val == 'RTENOTITLE' ){ 472 $args .= '_fcknotitle="true" '; 473 $val = $cat; 474 } 471 475 if ($val != $title->mTextform) { 472 $appendString .= "<a href=\"Category:" . $cat ."\">" . $val ."</a> ";476 $appendString .= "<a ".$args."href=\"Category:" . $cat ."\">" . $val ."</a> "; 473 477 } 474 478 else { 475 $appendString .= "<a href=\"Category:" . $cat ."\">Category:" . $cat ."</a> ";479 $appendString .= "<a ".$args."href=\"Category:" . $cat ."\">Category:" . $cat ."</a> "; 476 480 } 477 481 } 478 482 $parserOutput->setText($parserOutput->getText() . $appendString); -
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; 223 263 } 224 264 225 265 //$u = $nt->escapeLocalURL( $query ); 226 $u = $nt->getFullText(); 266 $u = $nt->getFullText(); 267 //#Updating links tables -> #Updating_links_tables 268 $u = str_replace("#".$nt->getFragment(), $nt->getFragmentForURL(), $u); 227 269 228 270 if ( $nt->getFragment() != '' ) { 229 271 if( $nt->getPrefixedDbkey() == '' ) { … … 249 291 } 250 292 251 293 list( $inside, $trail ) = Linker::splitTrail( $trail ); 252 $r = "<a href=\"{$u}\">{$prefix}{$text}{$inside}</a>{$trail}"; 294 $title = "{$prefix}{$text}{$inside}"; 295 296 $u = preg_replace("/^RTECOLON/", ":", $u); //change 'RTECOLON' => ':' 297 if( substr($text, 0, 10) == 'RTENOTITLE' ){ //starts with RTENOTITLE 298 $args .= '_fcknotitle="true" '; 299 $title = $u; 300 $trail = substr($text, 10).$trail; 301 } 302 303 $r = "<a {$args}href=\"{$u}\">{$title}</a>{$trail}"; 253 304 wfProfileOut( $fname ); 254 305 return $r; 255 306 } … … 260 311 # throw new MWException(); 261 312 return "<!-- ERROR -->{$prefix}{$text}{$trail}"; 262 313 } 314 $args = ''; 263 315 264 316 $fname = 'FCKeditorSkin::makeBrokenLinkObj'; 265 317 wfProfileIn( $fname ); 266 318 267 $u = $nt->getFullText(); 319 $u = $nt->getFullText(); 320 //[[Main page]] -> [[Main_page]] 321 $u = str_replace($nt->getText(), $nt->getDBkey(), $u); 322 //#Updating links tables -> #Updating_links_tables 323 $u = str_replace("#".$nt->getFragment(), $nt->getFragmentForURL(), $u); 268 324 269 325 if ( '' == $text ) { 270 326 $text = htmlspecialchars( $nt->getPrefixedText() ); … … 274 330 } 275 331 276 332 list( $inside, $trail ) = Linker::splitTrail( $trail ); 277 $ s = "<a href=\"{$u}\">{$prefix}{$text}{$inside}</a>{$trail}";333 $title = "{$prefix}{$text}{$inside}"; 278 334 335 $u = preg_replace("/^RTECOLON/", ":", $u); //change 'RTECOLON' => ':' 336 if( substr($text, 0, 10) == 'RTENOTITLE' ){ //starts with RTENOTITLE 337 $args .= '_fcknotitle="true" '; 338 $title = $u; 339 $trail = substr($text, 10).$trail; 340 } 341 $s = "<a {$args}href=\"{$u}\">{$title}</a>{$trail}"; 342 279 343 wfProfileOut( $fname ); 280 344 return $s; 281 345 } 282 346 347 function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { 348 $args = ''; 349 if ( '' == $text ) { 350 $text = $nt->mDbkeyform; 351 } 352 list( $inside, $trail ) = Linker::splitTrail( $trail ); 353 $title = "{$prefix}{$text}"; 354 if( $text == 'RTENOTITLE' ){ //2223 355 $args .= '_fcknotitle="true" '; 356 $title = $nt->mDbkeyform; 357 } 358 return "<a {$args}href=\"".$nt->mDbkeyform."\" class=\"selflink\">{$title}</a>{$inside}{$trail}"; 359 } 360 283 361 /** 284 362 * Create a direct link to a given uploaded file. 285 363 * … … 295 373 ### HOTFIX. Instead of breaking, return empty string. 296 374 return $text; 297 375 } else { 376 $args = ''; 298 377 $orginal = $title->getPartialURL(); 299 378 // Mediawiki 1.11 300 379 if ( function_exists('wfFindFile') ) { … … 324 403 if( $text == '' ) { 325 404 $text = $alt; 326 405 } 327 $u = htmlspecialchars( $url ); 328 return "<a href=\"{$orginal}\" class=\"$class\" _fck_mw_filename=\"{$orginal}\" _fck_mw_type=\"media\" title=\"{$alt}\">{$text}</a>"; 406 $orginal = preg_replace("/^RTECOLON/", ":", $orginal); //change 'RTECOLON' => ':' 407 if( $text == 'RTENOTITLE' ){ //2223 408 $args .= '_fcknotitle="true" '; 409 $text = $orginal; 410 $alt = $orginal; 411 } 412 return "<a href=\"{$orginal}\" class=\"$class\" {$args} _fck_mw_filename=\"{$orginal}\" _fck_mw_type=\"media\" title=\"{$alt}\">{$text}</a>"; 329 413 } 330 414 } 331 415 … … 334 418 if( $escape ) { 335 419 $text = htmlspecialchars( $text ); 336 420 } 421 $url = preg_replace("/^RTECOLON/", ":", $url); //change 'RTECOLON' => ':' 337 422 if ($linktype == 'autonumber') { 338 423 return '<a href="'.$url.'">[n]</a>'; 339 424 } 340 return '<a href="'.$url.'">'.$text.'</a>'; 425 $args = ''; 426 if( $text == 'RTENOTITLE' ){ //2223 427 $args .= '_fcknotitle="true" '; 428 $text = $url; 429 } 430 return '<a '.$args.'href="'.$url.'">'.$text.'</a>'; 341 431 } 342 432 343 433 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 } … … 469 468 if ($categories) { 470 469 $appendString = ""; 471 470 foreach ($categories as $cat=>$val) { 471 $args = ''; 472 if( $val == 'RTENOTITLE' ){ 473 $args .= '_fcknotitle="true" '; 474 $val = $cat; 475 } 472 476 if ($val != $title->mTextform) { 473 $appendString .= "<a href=\"Category:" . $cat ."\">" . $val ."</a> ";477 $appendString .= "<a ".$args."href=\"Category:" . $cat ."\">" . $val ."</a> "; 474 478 } 475 479 else { 476 $appendString .= "<a href=\"Category:" . $cat ."\">Category:" . $cat ."</a> ";480 $appendString .= "<a ".$args."href=\"Category:" . $cat ."\">Category:" . $cat ."</a> "; 477 481 } 478 482 } 479 483 $parserOutput->setText($parserOutput->getText() . $appendString); -
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 if (href.toLowerCase().StartsWith( 'category:' )) testInner = 'Category:'+testInner; 374 testInner = testInner.replace(/&/, "&") 375 if ( testInner == FCKConfig.ProtectedSource.Revert(href, 0) ) pipeline = false; 374 376 } 375 377 if (href.toLowerCase().StartsWith( 'rtecolon' )) //change 'rtecolon=' => ':' in links 376 378 {