mirror of
				https://github.com/diocloid/LinkTitles.git
				synced 2025-10-22 05:42:32 +02:00 
			
		
		
		
	Add option
This commit is contained in:
		
							
								
								
									
										6
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								HISTORY
									
									
									
									
									
								
							@@ -1,5 +1,11 @@
 | 
			
		||||
Extension:LinkTitles
 | 
			
		||||
 | 
			
		||||
0.0.5: 2012-05-20
 | 
			
		||||
* Add $wgLinkTitlesMinimumTitleLength configuration variable.
 | 
			
		||||
 | 
			
		||||
0.0.4: 2012-05-20
 | 
			
		||||
* Add $wgLinkTitlesPreferShortTitles configuration variable.
 | 
			
		||||
 | 
			
		||||
0.0.3: 2012-05-20
 | 
			
		||||
* Only look for page titles from 'normal' pages (namespace = 0).
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,10 @@
 | 
			
		||||
		public static function onArticleSave( &$article, &$user, &$text, &$summary,
 | 
			
		||||
				$minor, $watchthis, $sectionanchor, &$flags, &$status ) {
 | 
			
		||||
 | 
			
		||||
			// Configuration variables need to be defined here as globals.
 | 
			
		||||
			global $wgLinkTitlesPreferShortTitles;
 | 
			
		||||
			global $wgLinkTitlesMinimumTitleLength;
 | 
			
		||||
 | 
			
		||||
			// To prevent time-consuming parsing of the page whenever
 | 
			
		||||
			// it is edited and saved, we only parse it if the flag
 | 
			
		||||
			// 'minor edits' is not set.
 | 
			
		||||
@@ -55,9 +59,9 @@
 | 
			
		||||
				$res = $dbr->select( 
 | 
			
		||||
					'page', 
 | 
			
		||||
					'page_title', 
 | 
			
		||||
					'page_namespace = 0', 
 | 
			
		||||
					array( 'page_namespace = 0', 'CHAR_LENGTH(page_title) > ' . $wgLinkTitlesMinimumTitleLength ), 
 | 
			
		||||
					__METHOD__, 
 | 
			
		||||
					array( 'ORDER BY' => 'length(page_title) ' . $sort_order ));
 | 
			
		||||
					array( 'ORDER BY' => 'CHAR_LENGTH(page_title) ' . $sort_order ));
 | 
			
		||||
 | 
			
		||||
				// Iterate through the page titles
 | 
			
		||||
				$new_text = $text;
 | 
			
		||||
@@ -75,7 +79,6 @@
 | 
			
		||||
							// even indexes will text that is not enclosed by brackets
 | 
			
		||||
							$arr[$i] = preg_replace( '/\b(' . $safe_title . ')\b/i', '[[$1]]', $arr[$i] );
 | 
			
		||||
						};
 | 
			
		||||
						dump( $arr );
 | 
			
		||||
						$new_text = implode( '', $arr );
 | 
			
		||||
					}; // if $title != $my_title
 | 
			
		||||
				}; // foreach $res as $row
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,7 @@
 | 
			
		||||
 | 
			
		||||
	// Configuration variables
 | 
			
		||||
	$wgLinkTitlesPreferShortTitles = false;	
 | 
			
		||||
	$wgLinkTitlesMinimumTitleLength = 3;
 | 
			
		||||
		
 | 
			
		||||
	// vim: ts=2:sw=2:noet
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								release/LinkTitles-0.0.4.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								release/LinkTitles-0.0.4.tar.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user