| Index: trunk/phase3/includes/EditPage.php |
| — | — | @@ -231,93 +231,87 @@ |
| 232 | 232 | * and set $wgMetadataWhitelist to the *full* title of the template whitelist |
| 233 | 233 | */ |
| 234 | 234 | function extractMetaDataFromArticle () { |
| 235 | | - global $wgUseMetadataEdit , $wgMetadataWhitelist , $wgLang ; |
| 236 | | - $this->mMetaData = '' ; |
| 237 | | - if ( !$wgUseMetadataEdit ) return ; |
| 238 | | - if ( $wgMetadataWhitelist == '' ) return ; |
| 239 | | - $s = '' ; |
| | 235 | + global $wgUseMetadataEdit, $wgMetadataWhitelist, $wgContLang; |
| | 236 | + $this->mMetaData = ''; |
| | 237 | + if ( !$wgUseMetadataEdit ) return; |
| | 238 | + if ( $wgMetadataWhitelist == '' ) return; |
| | 239 | + $s = ''; |
| 240 | 240 | $t = $this->getContent(); |
| 241 | 241 | |
| 242 | 242 | # MISSING : <nowiki> filtering |
| 243 | 243 | |
| 244 | 244 | # Categories and language links |
| 245 | | - $t = explode ( "\n" , $t ) ; |
| 246 | | - $catlow = strtolower ( $wgLang->getNsText ( NS_CATEGORY ) ) ; |
| 247 | | - $cat = $ll = array() ; |
| 248 | | - foreach ( $t AS $key => $x ) |
| 249 | | - { |
| 250 | | - $y = trim ( strtolower ( $x ) ) ; |
| 251 | | - while ( substr ( $y , 0 , 2 ) == '[[' ) |
| 252 | | - { |
| 253 | | - $y = explode ( ']]' , trim ( $x ) ) ; |
| 254 | | - $first = array_shift ( $y ) ; |
| 255 | | - $first = explode ( ':' , $first ) ; |
| 256 | | - $ns = array_shift ( $first ) ; |
| 257 | | - $ns = trim ( str_replace ( '[' , '' , $ns ) ) ; |
| 258 | | - if ( strlen ( $ns ) == 2 OR strtolower ( $ns ) == $catlow ) |
| 259 | | - { |
| 260 | | - $add = '[[' . $ns . ':' . implode ( ':' , $first ) . ']]' ; |
| 261 | | - if ( strtolower ( $ns ) == $catlow ) $cat[] = $add ; |
| 262 | | - else $ll[] = $add ; |
| 263 | | - $x = implode ( ']]' , $y ) ; |
| 264 | | - $t[$key] = $x ; |
| 265 | | - $y = trim ( strtolower ( $x ) ) ; |
| | 245 | + $t = explode ( "\n" , $t ); |
| | 246 | + $catlow = strtolower ( $wgContLang->getNsText( NS_CATEGORY ) ); |
| | 247 | + $cat = $ll = array(); |
| | 248 | + foreach ( $t AS $key => $x ) { |
| | 249 | + $y = trim ( strtolower ( $x ) ); |
| | 250 | + while ( substr ( $y , 0 , 2 ) == '[[' ) { |
| | 251 | + $y = explode ( ']]' , trim ( $x ) ); |
| | 252 | + $first = array_shift ( $y ); |
| | 253 | + $first = explode ( ':' , $first ); |
| | 254 | + $ns = array_shift ( $first ); |
| | 255 | + $ns = trim ( str_replace ( '[' , '' , $ns ) ); |
| | 256 | + if ( $wgContLang->getLanguageName( $ns ) || strtolower ( $ns ) == $catlow ) { |
| | 257 | + $add = '[[' . $ns . ':' . implode ( ':' , $first ) . ']]'; |
| | 258 | + if ( strtolower ( $ns ) == $catlow ) $cat[] = $add; |
| | 259 | + else $ll[] = $add; |
| | 260 | + $x = implode ( ']]' , $y ); |
| | 261 | + $t[$key] = $x; |
| | 262 | + $y = trim ( strtolower ( $x ) ); |
| | 263 | + } else { |
| | 264 | + $x = implode ( ']]' , $y ); |
| | 265 | + $y = trim ( strtolower ( $x ) ); |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | | - if ( count ( $cat ) ) $s .= implode ( ' ' , $cat ) . "\n" ; |
| 270 | | - if ( count ( $ll ) ) $s .= implode ( ' ' , $ll ) . "\n" ; |
| 271 | | - $t = implode ( "\n" , $t ) ; |
| | 269 | + if ( count ( $cat ) ) $s .= implode ( ' ' , $cat ) . "\n"; |
| | 270 | + if ( count ( $ll ) ) $s .= implode ( ' ' , $ll ) . "\n"; |
| | 271 | + $t = implode ( "\n" , $t ); |
| 272 | 272 | |
| 273 | 273 | # Load whitelist |
| 274 | 274 | $sat = array () ; # stand-alone-templates; must be lowercase |
| 275 | | - $wl_title = Title::newFromText ( $wgMetadataWhitelist ) ; |
| 276 | | - $wl_article = new Article ( $wl_title ) ; |
| 277 | | - $wl = explode ( "\n" , $wl_article->getContent() ) ; |
| 278 | | - foreach ( $wl AS $x ) |
| 279 | | - { |
| 280 | | - $isentry = false ; |
| 281 | | - $x = trim ( $x ) ; |
| 282 | | - while ( substr ( $x , 0 , 1 ) == '*' ) |
| 283 | | - { |
| 284 | | - $isentry = true ; |
| 285 | | - $x = trim ( substr ( $x , 1 ) ) ; |
| | 275 | + $wl_title = Title::newFromText ( $wgMetadataWhitelist ); |
| | 276 | + $wl_article = new Article ( $wl_title ); |
| | 277 | + $wl = explode ( "\n" , $wl_article->getContent() ); |
| | 278 | + foreach ( $wl AS $x ) { |
| | 279 | + $isentry = false; |
| | 280 | + $x = trim ( $x ); |
| | 281 | + while ( substr ( $x , 0 , 1 ) == '*' ) { |
| | 282 | + $isentry = true; |
| | 283 | + $x = trim ( substr ( $x , 1 ) ); |
| 286 | 284 | } |
| 287 | | - if ( $isentry ) |
| 288 | | - { |
| 289 | | - $sat[] = strtolower ( $x ) ; |
| | 285 | + if ( $isentry ) { |
| | 286 | + $sat[] = strtolower ( $x ); |
| 290 | 287 | } |
| 291 | 288 | |
| 292 | 289 | } |
| 293 | 290 | |
| 294 | 291 | # Templates, but only some |
| 295 | | - $t = explode ( '{{' , $t ) ; |
| | 292 | + $t = explode ( '{{' , $t ); |
| 296 | 293 | $tl = array () ; |
| 297 | | - foreach ( $t AS $key => $x ) |
| 298 | | - { |
| 299 | | - $y = explode ( '}}' , $x , 2 ) ; |
| 300 | | - if ( count ( $y ) == 2 ) |
| 301 | | - { |
| 302 | | - $z = $y[0] ; |
| 303 | | - $z = explode ( '|' , $z ) ; |
| 304 | | - $tn = array_shift ( $z ) ; |
| 305 | | - if ( in_array ( strtolower ( $tn ) , $sat ) ) |
| 306 | | - { |
| 307 | | - $tl[] = '{{' . $y[0] . '}}' ; |
| 308 | | - $t[$key] = $y[1] ; |
| 309 | | - $y = explode ( '}}' , $y[1] , 2 ) ; |
| | 294 | + foreach ( $t AS $key => $x ) { |
| | 295 | + $y = explode ( '}}' , $x , 2 ); |
| | 296 | + if ( count ( $y ) == 2 ) { |
| | 297 | + $z = $y[0]; |
| | 298 | + $z = explode ( '|' , $z ); |
| | 299 | + $tn = array_shift ( $z ); |
| | 300 | + if ( in_array ( strtolower ( $tn ) , $sat ) ) { |
| | 301 | + $tl[] = '{{' . $y[0] . '}}'; |
| | 302 | + $t[$key] = $y[1]; |
| | 303 | + $y = explode ( '}}' , $y[1] , 2 ); |
| 310 | 304 | } |
| 311 | | - else $t[$key] = '{{' . $x ; |
| | 305 | + else $t[$key] = '{{' . $x; |
| 312 | 306 | } |
| 313 | | - else if ( $key != 0 ) $t[$key] = '{{' . $x ; |
| 314 | | - else $t[$key] = $x ; |
| | 307 | + else if ( $key != 0 ) $t[$key] = '{{' . $x; |
| | 308 | + else $t[$key] = $x; |
| 315 | 309 | } |
| 316 | | - if ( count ( $tl ) ) $s .= implode ( ' ' , $tl ) ; |
| 317 | | - $t = implode ( '' , $t ) ; |
| | 310 | + if ( count ( $tl ) ) $s .= implode ( ' ' , $tl ); |
| | 311 | + $t = implode ( '' , $t ); |
| 318 | 312 | |
| 319 | | - $t = str_replace ( "\n\n\n" , "\n" , $t ) ; |
| 320 | | - $this->mArticle->mContent = $t ; |
| 321 | | - $this->mMetaData = $s ; |
| | 313 | + $t = str_replace ( "\n\n\n" , "\n" , $t ); |
| | 314 | + $this->mArticle->mContent = $t; |
| | 315 | + $this->mMetaData = $s; |
| 322 | 316 | } |
| 323 | 317 | |
| 324 | 318 | /* |
| — | — | @@ -952,7 +946,7 @@ |
| 953 | 947 | } |
| 954 | 948 | |
| 955 | 949 | # Handle the user preference to force summaries here, but not for null edits |
| 956 | | - if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp($oldtext, $text) && |
| | 950 | + if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp($oldtext, $text) && |
| 957 | 951 | !is_object( Title::newFromRedirect( $text ) ) # check if it's not a redirect |
| 958 | 952 | ) { |
| 959 | 953 | if ( md5( $this->summary ) == $this->autoSumm ) { |
| — | — | @@ -1346,6 +1340,7 @@ |
| 1347 | 1341 | $ew = $wgUser->getOption( 'editwidth' ); |
| 1348 | 1342 | if ( $ew ) $ew = " style=\"width:100%\""; |
| 1349 | 1343 | else $ew = ''; |
| | 1344 | + $cols = $wgUser->getIntOption( 'cols' ); |
| 1350 | 1345 | /* /ToDo */ |
| 1351 | 1346 | $metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>" ; |
| 1352 | 1347 | } |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -2027,11 +2027,23 @@ |
| 2028 | 2028 | $wgRC2UDPPrefix = ''; |
| 2029 | 2029 | $wgRC2UDPOmitBots = false; |
| 2030 | 2030 | |
| 2031 | | -# Enable user search in Special:Newpages |
| 2032 | | -# This is really a temporary hack around an index install bug on some Wikipedias. |
| 2033 | | -# Kill it once fixed. |
| | 2031 | +/** |
| | 2032 | + * Enable user search in Special:Newpages |
| | 2033 | + * This is really a temporary hack around an index install bug on some Wikipedias. |
| | 2034 | + * Kill it once fixed. |
| | 2035 | + */ |
| 2034 | 2036 | $wgEnableNewpagesUserFilter = true; |
| 2035 | 2037 | |
| | 2038 | +/** |
| | 2039 | + * Whether to use metadata edition |
| | 2040 | + * This will put categories, language links and allowed templates in a separate text box |
| | 2041 | + * while editing pages |
| | 2042 | + * EXPERIMENTAL |
| | 2043 | + */ |
| | 2044 | +$wgUseMetadataEdit = false; |
| | 2045 | +/** Full name (including namespace) of the page containing templates names that will be allowed as metadata */ |
| | 2046 | +$wgMetadataWhitelist = ''; |
| | 2047 | + |
| 2036 | 2048 | # |
| 2037 | 2049 | # Copyright and credits settings |
| 2038 | 2050 | # |