addWikiText( wfMsg( 'allmessagesnotsupportedDB' ) ); return; } $fname = "wfSpecialAllMessages"; wfProfileIn( $fname ); wfProfileIn( "$fname-setup"); $ot = $wgRequest->getText( 'ot' ); $navText = wfMsg( 'allmessagestext' ); # Make sure all extension messages are available wfLoadAllExtensions(); $first = true; $sortedArray = array_merge( $wgAllMessagesEn, $wgMessageCache->mExtensionMessages ); ksort( $sortedArray ); $messages = array(); $wgMessageCache->disableTransform(); foreach ( $sortedArray as $key => $value ) { $messages[$key]['enmsg'] = is_array( $value ) ? $value['en'] : $value; $messages[$key]['statmsg'] = wfMsgNoDb( $key ); $messages[$key]['msg'] = wfMsg ( $key ); } $wgMessageCache->enableTransform(); wfProfileOut( "$fname-setup" ); wfProfileIn( "$fname-output" ); if ($ot == 'php') { $navText .= makePhp($messages); $wgOut->addHTML('PHP | HTML
'.htmlspecialchars($navText).'
'); } else { $wgOut->addHTML( 'PHP | HTML' ); $wgOut->addWikiText( $navText ); $wgOut->addHTML( makeHTMLText( $messages ) ); } wfProfileOut( "$fname-output" ); wfProfileOut( $fname ); } /** * */ function makePhp($messages) { global $wgLanguageCode; $txt = "\n\n".'$wgAllMessages'.ucfirst($wgLanguageCode).' = array('."\n"; foreach( $messages as $key => $m ) { if(strtolower($wgLanguageCode) != 'en' and $m['msg'] == $m['enmsg'] ) { //if (strstr($m['msg'],"\n")) { // $txt.='/* '; // $comment=' */'; //} else { // $txt .= '#'; // $comment = ''; //} continue; } elseif ($m['msg'] == '<'.$key.'>'){ $m['msg'] = ''; $comment = ' #empty'; } else { $comment = ''; } $txt .= "'$key' => '" . preg_replace( "/(?getSkin(); $talk = $wgLang->getNsText( NS_TALK ); $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI ); $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK ); $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( "$fname-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( "$fname-check" ); wfProfileIn( "$fname-output" ); $i = 0; foreach( $messages as $key => $m ) { $title = $wgLang->ucfirst( $key ); if($wgLanguageCode != $wgContLanguageCode) $title.="/$wgLanguageCode"; $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'] ); #$pageLink = $sk->makeLinkObj( $titleObj, htmlspecialchars( $key ) ); #$talkLink = $sk->makeLinkObj( $talkPage, htmlspecialchars( $talk ) ); 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( "$fname-output" ); wfProfileOut( $fname ); return $txt; } ?>