From 396b28f3d881f5debd888ba9bb9b47c2d478a76f Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 15 Dec 2008 18:02:47 +0100 Subject: update to Mediawiki 1.13.3; some cleanups --- includes/SpecialAllmessages.php | 219 ---------------------------------------- 1 file changed, 219 deletions(-) delete mode 100644 includes/SpecialAllmessages.php (limited to 'includes/SpecialAllmessages.php') diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php deleted file mode 100644 index ee97b48e..00000000 --- a/includes/SpecialAllmessages.php +++ /dev/null @@ -1,219 +0,0 @@ -addWikiMsg( 'allmessagesnotsupportedDB' ); - return; - } - - wfProfileIn( __METHOD__ ); - - wfProfileIn( __METHOD__ . '-setup' ); - $ot = $wgRequest->getText( 'ot' ); - - $navText = wfMsg( 'allmessagestext' ); - - # Make sure all extension messages are available - - $wgMessageCache->loadAllMessages(); - - $sortedArray = array_merge( Language::getMessagesFor( 'en' ), $wgMessageCache->getExtensionMessagesFor( 'en' ) ); - ksort( $sortedArray ); - $messages = array(); - $wgMessageCache->disableTransform(); - - foreach ( $sortedArray as $key => $value ) { - $messages[$key]['enmsg'] = $value; - $messages[$key]['statmsg'] = wfMsgNoDb( $key ); - $messages[$key]['msg'] = wfMsg ( $key ); - } - - $wgMessageCache->enableTransform(); - wfProfileOut( __METHOD__ . '-setup' ); - - wfProfileIn( __METHOD__ . '-output' ); - if ( $ot == 'php' ) { - $navText .= wfAllMessagesMakePhp( $messages ); - $wgOut->addHTML( 'PHP | HTML | ' . - 'XML' . - '
' . htmlspecialchars( $navText ) . '
' ); - } else if ( $ot == 'xml' ) { - $wgOut->disable(); - header( 'Content-type: text/xml' ); - echo wfAllMessagesMakeXml( $messages ); - } else { - $wgOut->addHTML( 'PHP | ' . - 'HTML | XML' ); - $wgOut->addWikiText( $navText ); - $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) ); - } - wfProfileOut( __METHOD__ . '-output' ); - - wfProfileOut( __METHOD__ ); -} - -function wfAllMessagesMakeXml( $messages ) { - global $wgLang; - $lang = $wgLang->getCode(); - $txt = "\n"; - $txt .= "\n"; - foreach( $messages as $key => $m ) { - $txt .= "\t" . Xml::element( 'message', array( 'name' => $key ), $m['msg'] ) . "\n"; - } - $txt .= ""; - return $txt; -} - -/** - * Create the messages array, formatted in PHP to copy to language files. - * @param $messages Messages array. - * @return The PHP messages array. - * @todo Make suitable for language files. - */ -function wfAllMessagesMakePhp( $messages ) { - global $wgLang; - $txt = "\n\n\$messages = array(\n"; - foreach( $messages as $key => $m ) { - if( $wgLang->getCode() != 'en' && $m['msg'] == $m['enmsg'] ) { - continue; - } else if ( wfEmptyMsg( $key, $m['msg'] ) ) { - $m['msg'] = ''; - $comment = ' #empty'; - } else { - $comment = ''; - } - $txt .= "'$key' => '" . preg_replace( '/(?getSkin(); - $talk = wfMsg( 'talkpagelinktext' ); - - $input = wfElement( 'input', array( - 'type' => 'text', - 'id' => 'allmessagesinput', - 'onkeyup' => 'allmessagesfilter()' - ), '' ); - $checkbox = wfElement( 'input', array( - 'type' => 'button', - 'value' => wfMsgHtml( 'allmessagesmodified' ), - 'id' => 'allmessagescheckbox', - 'onclick' => 'allmessagesmodified()' - ), '' ); - - $txt = ''; - - $txt .= ' - - - - - - - - '; - - wfProfileIn( __METHOD__ . "-check" ); - - # This is a nasty hack to avoid doing independent existence checks - # without sending the links and table through the slow wiki parser. - $pageExists = array( - NS_MEDIAWIKI => array(), - NS_MEDIAWIKI_TALK => array() - ); - $dbr = wfGetDB( DB_SLAVE ); - $page = $dbr->tableName( 'page' ); - $sql = "SELECT page_namespace,page_title FROM $page WHERE page_namespace IN (" . NS_MEDIAWIKI . ", " . NS_MEDIAWIKI_TALK . ")"; - $res = $dbr->query( $sql ); - while( $s = $dbr->fetchObject( $res ) ) { - $pageExists[$s->page_namespace][$s->page_title] = true; - } - $dbr->freeResult( $res ); - wfProfileOut( __METHOD__ . "-check" ); - - wfProfileIn( __METHOD__ . "-output" ); - - $i = 0; - - foreach( $messages as $key => $m ) { - $title = $wgLang->ucfirst( $key ); - if( $wgLang->getCode() != $wgContLang->getCode() ) { - $title .= '/' . $wgLang->getCode(); - } - - $titleObj =& Title::makeTitle( NS_MEDIAWIKI, $title ); - $talkPage =& Title::makeTitle( NS_MEDIAWIKI_TALK, $title ); - - $changed = ( $m['statmsg'] != $m['msg'] ); - $message = htmlspecialchars( $m['statmsg'] ); - $mw = htmlspecialchars( $m['msg'] ); - - if( isset( $pageExists[NS_MEDIAWIKI][$title] ) ) { - $pageLink = $sk->makeKnownLinkObj( $titleObj, "" . htmlspecialchars( $key ) . '' ); - } else { - $pageLink = $sk->makeBrokenLinkObj( $titleObj, "" . htmlspecialchars( $key ) . '' ); - } - if( isset( $pageExists[NS_MEDIAWIKI_TALK][$title] ) ) { - $talkLink = $sk->makeKnownLinkObj( $talkPage, htmlspecialchars( $talk ) ); - } else { - $talkLink = $sk->makeBrokenLinkObj( $talkPage, htmlspecialchars( $talk ) ); - } - - $anchor = 'msg_' . htmlspecialchars( strtolower( $title ) ); - $anchor = ""; - - if( $changed ) { - $txt .= " - - - - - "; - } else { - $txt .= " - - - "; - } - $i++; - } - $txt .= '
' . wfMsgHtml( 'allmessagesname' ) . '' . wfMsgHtml( 'allmessagesdefault' ) . '
' . wfMsgHtml( 'allmessagescurrent' ) . '
- $anchor$pageLink
$talkLink -
-$message -
-$mw -
- $anchor$pageLink
$talkLink -
-$mw -
'; - wfProfileOut( __METHOD__ . '-output' ); - - wfProfileOut( __METHOD__ ); - return $txt; -} - - -- cgit v1.2.3-54-g00ecf