3 function wfSpecialAllmessages()
5 global $wgOut, $wgAllMessagesEn, $wgRequest, $wgMessageCache, $wgTitle;
7 $fname = "wfSpecialAllMessages";
10 wfProfileIn( "$fname-setup");
11 $ot = $wgRequest->getText( 'ot' );
12 $mwMsg =& MagicWord
::get( MAG_MSG
);
14 $navText = wfMsg( 'allmessagestext', $mwMsg->getSynonym( 0 ) );
16 $sortedArray = $wgAllMessagesEn;
17 ksort( $sortedArray );
19 $wgMessageCache->disableTransform();
20 foreach ( $sortedArray as $key => $enMsg ) {
21 $messages[$key]['enmsg'] = $enMsg;
22 $messages[$key]['statmsg'] = wfMsgNoDb( $key );
23 $messages[$key]['msg'] = wfMsg ( $key );
25 wfProfileOut( "$fname-setup" );
27 wfProfileIn( "$fname-output" );
29 $wgOut->addHTML( '<a href="'.$wgTitle->escapeLocalUrl('ot=php').'">PHP</a> | HTML' );
30 $wgOut->addWikiText( $navText );
31 $wgOut->addHTML( makeHTMLText( $messages ) );
33 $navText .= makePhp($messages);
34 $wgOut->addHTML('PHP | <a href="'.$wgTitle->escapeLocalUrl('ot=html').'">HTML</a><pre>'.htmlspecialchars($navText).'</pre>');
36 wfProfileOut( "$fname-output" );
38 wfProfileOut( $fname );
41 function makePhp($messages) {
42 global $wgLanguageCode;
43 $txt = "\n\n".'$wgAllMessages'.ucfirst($wgLanguageCode).' = array('."\n";
44 foreach( $messages as $key => $m ) {
45 if(strtolower($wgLanguageCode) != 'en' and $m['msg'] == $m['enmsg'] ) {
46 if (strstr($m['msg'],"\n")) {
53 } elseif ($m['msg'] == '<'.$key.'>'){
59 $txt .= "'".$key."' => \"".str_replace('"','\"',$m['msg'])."\",$comment\n";
65 function makeHTMLText( $messages ) {
66 global $wgLang, $wgUser;
67 $fname = "makeHTMLText";
68 wfProfileIn( $fname );
70 $sk =& $wgUser->getSkin();
71 $talk = $wgLang->getNsText( NS_TALK
);
72 $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI
);
73 $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK
);
76 <table border='1' cellspacing='0' width='100%'>
77 <tr bgcolor='#b2b2ff'>
83 wfProfileIn( "$fname-check" );
84 # This is a nasty hack to avoid doing independent existence checks
85 # without sending the links and table through the slow wiki parser.
87 NS_MEDIAWIKI
=> array(),
88 NS_MEDIAWIKI_TALK
=> array()
90 $sql = "SELECT cur_namespace,cur_title FROM cur WHERE cur_namespace IN (" . NS_MEDIAWIKI
. ", " . NS_MEDIAWIKI_TALK
. ")";
91 $dbr =& wfGetDB( DB_SLAVE
);
92 $res = $dbr->query( $sql );
93 while( $s = $dbr->fetchObject( $res ) ) {
94 $pageExists[$s->cur_namespace
][$s->cur_title
] = true;
96 $dbr->freeResult( $res );
97 wfProfileOut( "$fname-check" );
99 wfProfileIn( "$fname-output" );
100 foreach( $messages as $key => $m ) {
101 $title = $wgLang->ucfirst( $key );
102 $titleObj =& Title
::makeTitle( NS_MEDIAWIKI
, $title );
103 $talkPage =& Title
::makeTitle( NS_MEDIAWIKI_TALK
, $title );
105 $colorIt = ($m['statmsg'] == $m['msg']) ?
" bgcolor=\"#f0f0ff\"" : " bgcolor=\"#ffe2e2\"";
106 $message = htmlspecialchars( $m['statmsg'] );
107 $mw = htmlspecialchars( $m['msg'] );
109 #$pageLink = $sk->makeLinkObj( $titleObj, htmlspecialchars( $key ) );
110 #$talkLink = $sk->makeLinkObj( $talkPage, htmlspecialchars( $talk ) );
111 if( isset( $pageExists[NS_MEDIAWIKI
][$title] ) ) {
112 $pageLink = $sk->makeKnownLinkObj( $titleObj, htmlspecialchars( $key ) );
114 $pageLink = $sk->makeBrokenLinkObj( $titleObj, htmlspecialchars( $key ) );
116 if( isset( $pageExists[NS_MEDIAWIKI_TALK
][$title] ) ) {
117 $talkLink = $sk->makeKnownLinkObj( $talkPage, htmlspecialchars( $talk ) );
119 $talkLink = $sk->makeBrokenLinkObj( $talkPage, htmlspecialchars( $talk ) );
133 wfProfileOut( "$fname-output" );
135 wfProfileOut( $fname );