Index: trunk/extensions/IndexFunction/IndexFunction_body.php |
— | — | @@ -1,36 +1,123 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +/* TODO: |
| 5 | + * Memcached |
| 6 | + * Warnings for API edit |
| 7 | + * Better documentation |
| 8 | +*/ |
| 9 | + |
4 | 10 | class IndexFunction { |
5 | 11 | |
6 | | - // Utility function to get the target pageid for a possible index-title |
7 | | - static function getIndexTarget( Title $title ) { |
8 | | - $ns = $title->getNamespace(); |
9 | | - $t = $title->getDBkey(); |
| 12 | + var $mTo = array(); // An array of titles for pages being indexed |
| 13 | + var $mFrom = null; // A title object representing the index-title |
| 14 | + |
| 15 | + function __construct() {} |
| 16 | + |
| 17 | + // Constructor for a known index-title |
| 18 | + public static function newFromTitle( Title $indextitle ) { |
| 19 | + $ns = $indextitle->getNamespace(); |
| 20 | + $t = $indextitle->getDBkey(); |
10 | 21 | $dbr = wfGetDB( DB_SLAVE ); |
11 | 22 | $res = $dbr->select( 'indexes', 'in_from', |
12 | 23 | array( 'in_namespace' => $ns, 'in_title' => $t ), |
13 | 24 | __METHOD__ |
14 | 25 | ); |
15 | | - return $res; |
| 26 | + if ( !$res->numRows() ) { |
| 27 | + return null; |
| 28 | + } |
| 29 | + $ind = new IndexFunction(); |
| 30 | + $ids = array(); |
| 31 | + foreach ( $res as $row ) { |
| 32 | + $ids[] = $row->in_from; |
| 33 | + } |
| 34 | + $ind->mTo = Title::newFromIDs( $ids ); |
| 35 | + $ind->mFrom = $indextitle; |
| 36 | + return $ind; |
16 | 37 | } |
| 38 | + |
| 39 | + // Constructor for known target |
| 40 | + public static function newFromTarget( Title $target ) { |
| 41 | + $pageid = $target->getArticleID(); |
| 42 | + $dbr = wfGetDB( DB_SLAVE ); |
| 43 | + $res = $dbr->select( 'indexes', array('in_namespace', 'in_title'), |
| 44 | + array( 'in_from' => $pageid ), |
| 45 | + __METHOD__ |
| 46 | + ); |
| 47 | + if ( !$res->numRows() ) { |
| 48 | + return null; |
| 49 | + } |
| 50 | + $ind = new IndexFunction(); |
| 51 | + $row = $res->fetchRow(); |
| 52 | + $ind->mFrom = Title::makeTitle( $row->in_namespace, $row->in_title ); |
| 53 | + return $ind; |
| 54 | + } |
| 55 | + |
| 56 | + public function getIndexTitle() { |
| 57 | + return $this->mFrom; |
| 58 | + } |
| 59 | + |
| 60 | + public function getTargets() { |
| 61 | + if ( $this->mTo ) { |
| 62 | + return $this->mTo; |
| 63 | + } |
| 64 | + $dbr = wfGetDB( DB_SLAVE ); |
| 65 | + $ns = $this->mFrom->getNamespace(); |
| 66 | + $t = $this->mFrom->getDBkey(); |
| 67 | + $res = $dbr->select( 'indexes', 'in_from', |
| 68 | + array( 'in_namespace' => $ns, 'in_title' => $t ), |
| 69 | + __METHOD__ |
| 70 | + ); |
| 71 | + $ids = array(); |
| 72 | + foreach ( $res as $row ) { |
| 73 | + $ids[] = $row->in_from; |
| 74 | + } |
| 75 | + $this->mTo = Title::newFromIDs( $ids ); |
| 76 | + return $this->mTo; |
| 77 | + } |
17 | 78 | |
| 79 | + // Makes an HTML <ul> list of targets |
| 80 | + public function makeTargetList() { |
| 81 | + global $wgUser; |
| 82 | + $sk = $wgUser->getSkin(); |
| 83 | + $targets = $this->getTargets(); |
| 84 | + $list = Xml::openElement( 'ul' ); |
| 85 | + foreach( $targets as $t ) { |
| 86 | + $link = $sk->link( $t, $t->getPrefixedText(), array(), array(), array('known', 'noclasses') ); |
| 87 | + $list.= Xml::tags( 'li', null, $link ); |
| 88 | + } |
| 89 | + $list .= Xml::CloseElement( 'ul' ); |
| 90 | + return $list; |
| 91 | + } |
| 92 | + |
| 93 | + // Returns true if a redirect should go to a special page |
| 94 | + // ie - if there are multiple targets |
| 95 | + public function useSpecialPage() { |
| 96 | + if ( !$this->mTo ) { |
| 97 | + $this->getTargets(); |
| 98 | + } |
| 99 | + return count( $this->mTo) > 1; |
| 100 | + } |
| 101 | +} |
| 102 | + |
| 103 | +class IndexFunctionHooks { |
| 104 | + |
18 | 105 | // Makes "Go" searches for an index title go directly to their target |
19 | 106 | static function redirectSearch( $term, &$title ) { |
20 | 107 | $title = Title::newFromText( $term ); |
21 | 108 | if ( is_null($title) ) { |
22 | 109 | return true; |
23 | 110 | } |
24 | | - $res = self::getIndexTarget( $title ); |
25 | | - if ( $res->numRows() == 0 ) { |
| 111 | + $index = IndexFunction::newFromTitle( $title ); |
| 112 | + if ( !$index ) { |
26 | 113 | return true; |
27 | | - } elseif ( $res->numRows() > 1 ) { |
| 114 | + } elseif ( $index->useSpecialPage() ) { |
28 | 115 | global $wgOut; |
29 | 116 | $title = SpecialPage::getTitleFor( 'Index', $title->getPrefixedText() ); |
30 | 117 | $wgOut->redirect( $title->getLocalURL() ); |
31 | 118 | return true; |
32 | 119 | } |
33 | | - $res = $res->fetchRow(); |
34 | | - $title = Title::newFromId( $res ); |
| 120 | + $targets = $index->getTargets(); |
| 121 | + $title = $targets[0]; |
35 | 122 | return false; |
36 | 123 | } |
37 | 124 | |
— | — | @@ -39,19 +126,17 @@ |
40 | 127 | if ( $article->exists() ) { |
41 | 128 | return true; |
42 | 129 | } |
43 | | - $res = self::getIndexTarget( $title ); |
44 | | - if ( $res->numRows() == 0 ) { |
| 130 | + $index = IndexFunction::newFromTitle( $title ); |
| 131 | + if ( !$index ) { |
45 | 132 | return true; |
46 | | - } elseif ( $res->numRows() > 1 ) { |
| 133 | + } elseif ($index->useSpecialPage() ) { |
47 | 134 | global $wgOut; |
48 | 135 | $t = SpecialPage::getTitleFor( 'Index', $title->getPrefixedText() ); |
49 | 136 | $wgOut->redirect( $t->getLocalURL() ); |
50 | 137 | return true; |
51 | | - } else { |
52 | | - $res = $res->fetchRow(); |
53 | | - $redir = Title::newFromID( $res ); |
54 | | - } |
55 | | - $target = $redir; |
| 138 | + } |
| 139 | + $targets = $index->getTargets(); |
| 140 | + $target = $targets[0]; |
56 | 141 | $article->mIsRedirect = true; |
57 | 142 | $ignoreRedirect = false; |
58 | 143 | return true; |
— | — | @@ -62,8 +147,8 @@ |
63 | 148 | if ( in_array( 'known', $options ) ) { |
64 | 149 | return true; |
65 | 150 | } |
66 | | - $res = self::getIndexTarget( $target ); |
67 | | - if ( $res->numRows() == 0 ) { |
| 151 | + $index = IndexFunction::newFromTitle( $target ); |
| 152 | + if ( !$index ) { |
68 | 153 | return true; |
69 | 154 | } |
70 | 155 | $attribs['class'] = str_replace( 'new', 'mw-index', $attribs['class'] ); |
— | — | @@ -189,23 +274,46 @@ |
190 | 275 | $dbw = wfGetDB( DB_MASTER ); |
191 | 276 | $dbw->delete( 'indexes', |
192 | 277 | array( 'in_namespace'=>$ns, 'in_title'=>$dbkey ), |
193 | | - __METHOD__ ); |
| 278 | + __METHOD__ |
| 279 | + ); |
194 | 280 | return true; |
195 | 281 | } |
196 | 282 | |
197 | 283 | // Show a warning when editing an index-title |
198 | 284 | static function editWarning( $editpage ) { |
199 | 285 | $t = $editpage->mTitle; |
200 | | - $target = self::getIndexTarget( $t ); |
201 | | - if ( $target->numRows() != 1 ) { # FIXME |
| 286 | + $index = IndexFunction::newFromTitle( $t ); |
| 287 | + if (!$index) { |
202 | 288 | return true; |
203 | 289 | } |
204 | | - $target = $target->fetchRow(); |
205 | | - $page = Title::newFromID( $target['in_from'] ); |
206 | 290 | wfLoadExtensionMessages( 'IndexFunction' ); |
207 | | - $warn = wfMsgExt( 'indexfunc-editwarn', array( 'parse' ), $page->getPrefixedText() ); |
208 | | - $editpage->editFormTextBeforeContent .= "<span class='error'>$warn</span>"; |
| 291 | + $list = $index->makeTargetList(); |
| 292 | + $c = count( $index->getTargets() ); |
| 293 | + $warn = wfMsgExt( 'indexfunc-editwarning', array( 'parsemag' ), $list, $c ); |
| 294 | + $editpage->editFormTextTop .= "<span class='error'>$warn</span>"; |
209 | 295 | return true; |
210 | 296 | } |
| 297 | + |
| 298 | + static function afterMove( &$form, &$orig, &$new ) { |
| 299 | + global $wgOut; |
| 300 | + $index = IndexFunction::newFromTitle( $new ); |
| 301 | + if ( !$index ) { |
| 302 | + return true; |
| 303 | + } |
| 304 | + $c = count( $index->getTargets() ); |
| 305 | + $list = $index->makeTargetList(); |
| 306 | + $newns = $new->getNamespace(); |
| 307 | + $newdbk = $new->getDBkey(); |
| 308 | + $dbw = wfGetDB( DB_MASTER ); |
| 309 | + $dbw->delete( 'indexes', |
| 310 | + array( 'in_namespace'=>$newns, 'in_title'=>$newdbk ), |
| 311 | + __METHOD__ |
| 312 | + ); |
| 313 | + $msg = wfMsgExt( 'indexfunc-movewarn', array( 'parsemag' ), $new->getPrefixedText(), $list, $c ); |
| 314 | + $msg = "<span class='error'>$msg</span>"; |
| 315 | + $wgOut->addHTML( $msg ); |
| 316 | + return true; |
| 317 | + } |
| 318 | + |
211 | 319 | } |
212 | 320 | |
Index: trunk/extensions/IndexFunction/IndexFunction.i18n.php |
— | — | @@ -11,13 +11,15 @@ |
12 | 12 | 'indexfunc-desc' => 'Parser function to create automatic redirects and disambiguation pages', |
13 | 13 | |
14 | 14 | 'indexfunc-badtitle' => 'Invalid title: "$1"', |
15 | | - 'indexfunc-editwarn' => 'Warning: This title is an index title for [[$1]]. |
| 15 | + 'indexfunc-editwarning' => 'Warning: This title is an index title for the following {{PLURAL:$2|page|pages}}: |
| 16 | +$1 |
16 | 17 | Be sure the page you are about to create does not already exist under a different title. |
17 | | -If you create this page, remove this title from the <nowiki>{{#index:}}</nowiki> on $1.', |
| 18 | +If you create this page, remove this title from the <nowiki>{{#index:}}</nowiki> on the above {{PLURAL:$2|page|pages}}.', |
18 | 19 | 'indexfunc-index-exists' => 'The page "$1" already exists', |
19 | | - 'indexfunc-index-taken' => '"$1" is already used as an index by "$2"', |
| 20 | + 'indexfunc-movewarn' => 'Warning: "$1" is an index title for the following {{PLURAL:$3|page|pages}}: |
| 21 | +$2 |
| 22 | +Please remove "$1" from the <nowiki>{{#index:}}</nowiki> on the above {{PLURAL:$3|page|pages}}.', |
20 | 23 | |
21 | | - 'index' => 'Index', |
22 | 24 | 'index-legend' => 'Search the index', |
23 | 25 | 'index-search' => 'Search:', |
24 | 26 | 'index-submit' => 'Submit', |
— | — | @@ -34,7 +36,6 @@ |
35 | 37 | */ |
36 | 38 | $messages['qqq'] = array( |
37 | 39 | 'indexfunc-desc' => 'Short description of this extension, shown in [[Special:Version]]. Do not translate or change links or tag names.', |
38 | | - 'index' => 'This is either the name of the parser function, to be used inside the wiki code, or not used, if I got it right. --[[User:Purodha|Purodha Blissenbach]] 00:13, 15 July 2009 (UTC)', |
39 | 40 | 'index-legend' => 'Used in [[Special:Index]].', |
40 | 41 | 'index-search' => '{{Identical|Search}}', |
41 | 42 | 'index-submit' => '{{Identical|Submit}}', |
— | — | @@ -47,12 +48,7 @@ |
48 | 49 | $messages['be-tarask'] = array( |
49 | 50 | 'indexfunc-desc' => 'Функцыя парсэра для стварэньня аўтаматычных перанакіраваньняў і старонак неадназначнасьцяў', |
50 | 51 | 'indexfunc-badtitle' => 'Няслушная назва: «$1»', |
51 | | - 'indexfunc-editwarn' => 'Папярэджаньне: гэтая назва зьяўляецца індэкснай для [[$1]]. |
52 | | -Упэўніцеся, што старонка, якую Вы спрабуеце стварыць, не існуе над іншай назвай. |
53 | | -Калі Вы стварыце гэтую старонку, выдаліце гэтую назву з <nowiki>{{#index:}}</nowiki> на $1.', |
54 | 52 | 'indexfunc-index-exists' => 'Старонка «$1» ужо існуе', |
55 | | - 'indexfunc-index-taken' => '«$1» ужо выкарыстоўваецца як індэкс для «$2»', |
56 | | - 'index' => 'Індэкс', |
57 | 53 | 'index-legend' => 'Пошук у індэксе', |
58 | 54 | 'index-search' => 'Пошук:', |
59 | 55 | 'index-submit' => 'Адправіць', |
— | — | @@ -67,12 +63,7 @@ |
68 | 64 | $messages['bs'] = array( |
69 | 65 | 'indexfunc-desc' => 'Parserska funkcija za pravljenje automatskih preusmjerenja i čvor stranica', |
70 | 66 | 'indexfunc-badtitle' => 'Nevaljan naslov: "$1"', |
71 | | - 'indexfunc-editwarn' => 'Upozorenje: Ovaj naslov je naslov indeksa za [[$1]]. |
72 | | -Provjerite da li stranica koju namjeravate napraviti već ne postoji pod drugim naslovom. |
73 | | -Ako napravite ovu stranicu, uklonite ovaj naslov iz <nowiki>{{#index:}}</nowiki> na $1.', |
74 | 67 | 'indexfunc-index-exists' => 'Stranica "$1" već postoji', |
75 | | - 'indexfunc-index-taken' => '"$1" je već iskorišten kao indeks u "$2"', |
76 | | - 'index' => 'Indeks', |
77 | 68 | 'index-legend' => 'Pretraživanje indeksa', |
78 | 69 | 'index-search' => 'Traži:', |
79 | 70 | 'index-submit' => 'Pošalji', |
— | — | @@ -88,8 +79,6 @@ |
89 | 80 | 'indexfunc-desc' => 'Función analizadora para crear redirecciones y páginas de desambiguación', |
90 | 81 | 'indexfunc-badtitle' => 'Título inválido: "$1"', |
91 | 82 | 'indexfunc-index-exists' => 'La página "$1" ya existe', |
92 | | - 'indexfunc-index-taken' => '"$1" ya es usada como un índice por "$2"', |
93 | | - 'index' => 'Índice', |
94 | 83 | 'index-legend' => 'Buscar el índice', |
95 | 84 | 'index-search' => 'Buscar:', |
96 | 85 | 'index-submit' => 'Enviar', |
— | — | @@ -105,12 +94,7 @@ |
106 | 95 | $messages['fr'] = array( |
107 | 96 | 'indexfunc-desc' => "Fonction du parseur pour créer des pages de redirection et d'homonymie automatiquement", |
108 | 97 | 'indexfunc-badtitle' => 'Titre invalide : « $1»', |
109 | | - 'indexfunc-editwarn' => 'Attention : Ce titre est un titre d’index pour [[$1]]. |
110 | | -Assurez-vous que la page que vous vous apprêtez à créer n’existe pas déjà sous un autre titre. |
111 | | -Si vous créez cette page, supprimez ce titre de la <nowiki>{{#index:}}</nowiki> sur $1.', |
112 | 98 | 'indexfunc-index-exists' => 'La page « $1 » existe déjà', |
113 | | - 'indexfunc-index-taken' => '« $1 » est déjà utilisé comme un index par « $2 »', |
114 | | - 'index' => 'Index', |
115 | 99 | 'index-legend' => 'Rechercher dans l’index', |
116 | 100 | 'index-search' => 'Chercher:', |
117 | 101 | 'index-submit' => 'Envoyer', |
— | — | @@ -125,12 +109,7 @@ |
126 | 110 | $messages['gl'] = array( |
127 | 111 | 'indexfunc-desc' => 'Funcións analíticas para crear redireccións automáticas e páxinas de homónimos', |
128 | 112 | 'indexfunc-badtitle' => 'Título inválido: "$1"', |
129 | | - 'indexfunc-editwarn' => 'Aviso: este título é un título de índice para "[[$1]]". |
130 | | -Asegúrese de que a páxina que está a piques de crear aínda non existe cun título diferente. |
131 | | -Se crea esta páxina, elimine este título de <nowiki>{{#index:}}</nowiki> en "$1".', |
132 | 113 | 'indexfunc-index-exists' => 'A páxina "$1" xa existe', |
133 | | - 'indexfunc-index-taken' => '"$1" xa se usa como índice de "$2"', |
134 | | - 'index' => 'Índice', |
135 | 114 | 'index-legend' => 'Procurar no índice', |
136 | 115 | 'index-search' => 'Procurar:', |
137 | 116 | 'index-submit' => 'Enviar', |
— | — | @@ -145,12 +124,7 @@ |
146 | 125 | $messages['gsw'] = array( |
147 | 126 | 'indexfunc-desc' => 'Parserfunktion go automatischi Wyterleitige un Begriffsklärige aalege', |
148 | 127 | 'indexfunc-badtitle' => 'Nit giltige Titel „$1“', |
149 | | - 'indexfunc-editwarn' => 'Warnig: Dää Titel isch e Verzeichnis-Titel fir [[$1]]. |
150 | | -Stell sicher, ass es die Syte, wu Du grad witt aalege, nit scho unter eme andere Titel git. |
151 | | -Wänn Du die Syte aaleisch, nimm dää Titel us em <nowiki>{{#index:}}</nowiki> uf $1 uuse.', |
152 | 128 | 'indexfunc-index-exists' => 'D Syte „$1“ git s scho.', |
153 | | - 'indexfunc-index-taken' => '„$1“ wird scho as Verzeichnis brucht dur „$2“', |
154 | | - 'index' => 'Verzeichnis', |
155 | 129 | 'index-legend' => 'S Verzeichnis dursueche', |
156 | 130 | 'index-search' => 'Suech:', |
157 | 131 | 'index-submit' => 'Abschicke', |
— | — | @@ -165,12 +139,7 @@ |
166 | 140 | $messages['hsb'] = array( |
167 | 141 | 'indexfunc-desc' => 'Parserowa funkcija za wutworjenje awtomatiskich daleposrědkowanjow a rozjasnjenjow wjacezmyslnosćow', |
168 | 142 | 'indexfunc-badtitle' => 'Njepłaćiwy titul: "$1"', |
169 | | - 'indexfunc-editwarn' => 'Warnowanje: Tutón titul je indeksowy titul za [[$1]]. |
170 | | -Přeswědč so, zo strona, kotruž chceš wutworić, pod druhim titulom njeeksistuje. |
171 | | -Jeli tutu stronu tworiš, wotstroń tutón titul z <nowiki>{{#index:}}</nowiki> na $1.', |
172 | 143 | 'indexfunc-index-exists' => 'Strona "$1" hižo eksistuje', |
173 | | - 'indexfunc-index-taken' => '"$1" so hižo wot "$2" jako indeks wužiwa', |
174 | | - 'index' => 'Indeks', |
175 | 144 | 'index-legend' => 'Indeks přepytać', |
176 | 145 | 'index-search' => 'Pytać:', |
177 | 146 | 'index-submit' => 'Wotpósłać', |
— | — | @@ -185,12 +154,7 @@ |
186 | 155 | $messages['ia'] = array( |
187 | 156 | 'indexfunc-desc' => 'Function del analysator syntactic pro le creation automatic de redirectiones e paginas de disambiguation', |
188 | 157 | 'indexfunc-badtitle' => 'Titulo invalide: "$1"', |
189 | | - 'indexfunc-editwarn' => 'Attention: Iste titulo es un titulo de indice pro [[$1]]. |
190 | | -Assecura te que le pagina que tu va crear non ja existe sub un altere titulo. |
191 | | -Si tu crea iste pagina, remove iste titulo del <nowiki>{{#index:}}</nowiki> in $1.', |
192 | 158 | 'indexfunc-index-exists' => 'Le pagina "$1" ja existe', |
193 | | - 'indexfunc-index-taken' => '"$1" es ja usate como indice per "$2"', |
194 | | - 'index' => 'Indice', |
195 | 159 | 'index-legend' => 'Cercar in le indice', |
196 | 160 | 'index-search' => 'Cerca:', |
197 | 161 | 'index-submit' => 'Submitter', |
— | — | @@ -214,10 +178,7 @@ |
215 | 179 | $messages['ja'] = array( |
216 | 180 | 'indexfunc-desc' => '自動的なリダイレクトや曖昧さ回避ページを作成するためのパーサー関数', |
217 | 181 | 'indexfunc-badtitle' => '不正なタイトル:「$1」', |
218 | | - 'indexfunc-editwarn' => '警告: このタイトルは[[$1]]の索引タイトルです。あなたが作成しようとしているページが既に別のタイトルで存在していないことを確認してください。このページを作成したら、このタイトルを$1の <nowiki>{{#index:}}</nowiki> から除去してください。', |
219 | 182 | 'indexfunc-index-exists' => 'ページ「$1」は既に存在します。', |
220 | | - 'indexfunc-index-taken' => '「$1」は既に索引として「$2」に使われています', |
221 | | - 'index' => '索引', |
222 | 183 | 'index-legend' => '索引の検索', |
223 | 184 | 'index-search' => '検索:', |
224 | 185 | 'index-submit' => '送信', |
— | — | @@ -232,12 +193,7 @@ |
233 | 194 | $messages['ksh'] = array( |
234 | 195 | 'indexfunc-desc' => 'Paaserfunxjuhn för Ömleijdunge un „Watt ėßß datt?“-Sigge automattesch jemaat ze krijje.', |
235 | 196 | 'indexfunc-badtitle' => '„$1“ es ene onjöltije Sigge-Tittel.', |
236 | | - 'indexfunc-editwarn' => 'Opjepaß: Dä Tittel hät en automattesche „Watt ėßß datt?“-Sigg udder en automattesche Ömleijdung op de Sigg „[[$1]]“. |
237 | | -Beß sescher, dat di Sigg, di heh aanlääje wells nit ald onger enem andere Nahme aanjelaat es. |
238 | | -Wann De heh di Sigg aanlääß, donn dä iere Tittel uß dämm <code lang="en"><nowiki>{{#index:}}</nowiki></code> op dä Sigg „$1“ eruß nämme.', |
239 | 197 | 'indexfunc-index-exists' => 'Di Sigg „$1“ jitt et ald.', |
240 | | - 'indexfunc-index-taken' => '„$1“ weed ald als för automattesche „Watt ėßß datt?“-Sigg udder en automattesche Ömleijdung en dä Sigg „$2“ jebruch.', |
241 | | - 'index' => 'index', |
242 | 198 | 'index-legend' => 'Donn en de automatesche Ömleidunge un „Watt ėßß datt?“-Leßte söhke', |
243 | 199 | 'index-search' => 'Söhk noh:', |
244 | 200 | 'index-submit' => 'Lohß Jonn!', |
— | — | @@ -253,8 +209,6 @@ |
254 | 210 | 'indexfunc-desc' => 'Parser-Fonctioun fir Viruleedungen an Homonymie-Säiten automatesch unzeleeën', |
255 | 211 | 'indexfunc-badtitle' => 'Net valabelen Titel: "$1"', |
256 | 212 | 'indexfunc-index-exists' => 'D\'Säit "$1" gëtt et schonn', |
257 | | - 'indexfunc-index-taken' => '"$1" gëtt schonn als Index vum "$2" benotzt', |
258 | | - 'index' => 'Index', |
259 | 213 | 'index-legend' => 'Am Index sichen', |
260 | 214 | 'index-search' => 'Sichen:', |
261 | 215 | 'index-missing-param' => 'Dës Säit kann net ouni Parameter benotzt ginn', |
— | — | @@ -267,12 +221,7 @@ |
268 | 222 | $messages['nl'] = array( |
269 | 223 | 'indexfunc-desc' => "Parserfunctie om automatisch doorverwijzingen en doorverwijspagina's aan te maken", |
270 | 224 | 'indexfunc-badtitle' => 'Ongeldige paginanaam: "$1"', |
271 | | - 'indexfunc-editwarn' => 'Waarschuwing: Deze paginanaam is een indexnaam voor [[$1]]. |
272 | | -Zorg dat de pagina die u aan gaat maken niet al bestaan onder een andere naam. |
273 | | -Als u deze pagina aanmaakt, verwijder deze pagina dan uit de <nowiki>{{#index:}}</nowiki> op $1.', |
274 | 225 | 'indexfunc-index-exists' => 'De pagina "$1" bestaat al', |
275 | | - 'indexfunc-index-taken' => '"$1" wordt al gebruikt als een index bij "$2"', |
276 | | - 'index' => 'Index', |
277 | 226 | 'index-legend' => 'De index doorzoeken', |
278 | 227 | 'index-search' => 'Zoeken:', |
279 | 228 | 'index-submit' => 'OK', |
— | — | @@ -287,12 +236,7 @@ |
288 | 237 | $messages['oc'] = array( |
289 | 238 | 'indexfunc-desc' => "Foncion del parser per crear de paginas de redireccion e d'omonimia automaticament", |
290 | 239 | 'indexfunc-badtitle' => 'Títol invalid : « $1»', |
291 | | - 'indexfunc-editwarn' => 'Atencion : Aqueste títol es un títol d’indèx per [[$1]]. |
292 | | -Asseguratz-vos que la pagina que sètz a mand de crear existís pas ja jos un autre títol. |
293 | | -Se creatz aquesta pagina, suprimissètz aqueste títol de la <nowiki>{{#index:}}</nowiki> sus $1.', |
294 | 240 | 'indexfunc-index-exists' => 'La pagina « $1 » existís ja', |
295 | | - 'indexfunc-index-taken' => '« $1 » ja es utilizat coma un indèx per « $2 »', |
296 | | - 'index' => 'Indèx', |
297 | 241 | 'index-legend' => 'Recercar dins l’indèx', |
298 | 242 | 'index-search' => 'Cercar :', |
299 | 243 | 'index-submit' => 'Mandar', |
— | — | @@ -307,12 +251,7 @@ |
308 | 252 | $messages['ru'] = array( |
309 | 253 | 'indexfunc-desc' => 'Функция парсера для создания автоматических перенаправлений и страниц неоднозначностей', |
310 | 254 | 'indexfunc-badtitle' => 'Ошибочный заголовок «$1»', |
311 | | - 'indexfunc-editwarn' => 'Предупреждение. Это название является индексным названием [[$1]]. |
312 | | -Убедитесь, что страницы, которую вы собираетесь создать, не существует под другим названием. |
313 | | -Если создаёте эту страницу, удалите это название из <nowiki>{{#index:}}</nowiki> на $1.', |
314 | 255 | 'indexfunc-index-exists' => 'Страница «[[$1]]» уже существует', |
315 | | - 'indexfunc-index-taken' => '«$1» уже используется как индекс для «$2»', |
316 | | - 'index' => 'Индекс', |
317 | 256 | 'index-legend' => 'Поиск по индексу', |
318 | 257 | 'index-search' => 'Поиск:', |
319 | 258 | 'index-submit' => 'Отправить', |
— | — | @@ -327,12 +266,7 @@ |
328 | 267 | $messages['sk'] = array( |
329 | 268 | 'indexfunc-desc' => 'Funkcia syntaktického analyzátora na automatickú tvorbu presmerovaní a rozlišovacích stránok', |
330 | 269 | 'indexfunc-badtitle' => 'Neplatný názov: „$1“', |
331 | | - 'indexfunc-editwarn' => 'Upozornenie: Tento názov je indexový názov pre [[$1]]. |
332 | | -Uistite sa, že stránka, ktorú sa chystáte vytvoriť už neexistuje pod iným názvom. |
333 | | -Ak vytvoríte túto stránku, odstráňte tento názov z <nowiki>{{#index:}}</nowiki> na $1.', |
334 | 270 | 'indexfunc-index-exists' => 'Stránka „$1“ už existuje', |
335 | | - 'indexfunc-index-taken' => '„$1“ sa už používa ako index v „$2“', |
336 | | - 'index' => 'Index', |
337 | 271 | 'index-legend' => 'Hľadať v indexe', |
338 | 272 | 'index-search' => 'Hľadať:', |
339 | 273 | 'index-submit' => 'Odoslať', |
Index: trunk/extensions/IndexFunction/IndexFunction.php |
— | — | @@ -13,21 +13,23 @@ |
14 | 14 | |
15 | 15 | # Register function |
16 | 16 | $wgHooks['ParserFirstCallInit'][] = 'efIndexSetup'; |
17 | | -$wgHooks['LanguageGetMagic'][] = 'IndexFunction::addIndexFunction'; |
| 17 | +$wgHooks['LanguageGetMagic'][] = 'IndexFunctionHooks::addIndexFunction'; |
18 | 18 | # Add to database |
19 | | -$wgHooks['OutputPageParserOutput'][] = 'IndexFunction::doIndexes'; |
| 19 | +$wgHooks['OutputPageParserOutput'][] = 'IndexFunctionHooks::doIndexes'; |
20 | 20 | # Make links to indexes blue |
21 | | -$wgHooks['LinkEnd'][] = 'IndexFunction::blueLinkIndexes'; |
| 21 | +$wgHooks['LinkEnd'][] = 'IndexFunctionHooks::blueLinkIndexes'; |
22 | 22 | # Make links to indexes redirect |
23 | | -$wgHooks['InitializeArticleMaybeRedirect'][] = 'IndexFunction::doRedirect'; |
| 23 | +$wgHooks['InitializeArticleMaybeRedirect'][] = 'IndexFunctionHooks::doRedirect'; |
24 | 24 | # Make "go" searches for indexes redirect |
25 | | -$wgHooks['SearchGetNearMatch'][] = 'IndexFunction::redirectSearch'; |
| 25 | +$wgHooks['SearchGetNearMatch'][] = 'IndexFunctionHooks::redirectSearch'; |
26 | 26 | # Remove things from the index table when a page is deleted |
27 | | -$wgHooks['ArticleDeleteComplete'][] = 'IndexFunction::onDelete'; |
| 27 | +$wgHooks['ArticleDeleteComplete'][] = 'IndexFunctionHooks::onDelete'; |
28 | 28 | # Remove things from the index table when creating a new page |
29 | | -$wgHooks['ArticleInsertComplete'][] = 'IndexFunction::onCreate'; |
| 29 | +$wgHooks['ArticleInsertComplete'][] = 'IndexFunctionHooks::onCreate'; |
30 | 30 | # Show a warning when editing an index title |
31 | | -$wgHooks['EditPage::showEditForm:initial'][] = 'IndexFunction::editWarning'; |
| 31 | +$wgHooks['EditPage::showEditForm:initial'][] = 'IndexFunctionHooks::editWarning'; |
| 32 | +# Show a warning after page move, and do some cleanup |
| 33 | +$wgHooks['SpecialMovepageAfterMove'][] = 'IndexFunctionHooks::afterMove'; |
32 | 34 | |
33 | 35 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'efIndexUpdateSchema'; |
34 | 36 | |
— | — | @@ -38,10 +40,11 @@ |
39 | 41 | $wgAutoloadClasses['SpecialIndex'] = $dir . 'SpecialIndex.php'; |
40 | 42 | |
41 | 43 | $wgExtensionMessagesFiles['IndexFunction'] = $dir . 'IndexFunction.i18n.php'; |
| 44 | +$wgAutoloadClasses['IndexFunctionHooks'] = $dir . 'IndexFunction_body.php'; |
42 | 45 | $wgAutoloadClasses['IndexFunction'] = $dir . 'IndexFunction_body.php'; |
43 | 46 | |
44 | 47 | function efIndexSetup( &$parser ) { |
45 | | - $parser->setFunctionHook( 'index-func', array( 'IndexFunction', 'indexRender' ) ); |
| 48 | + $parser->setFunctionHook( 'index-func', array( 'IndexFunctionHooks', 'indexRender' ) ); |
46 | 49 | return true; |
47 | 50 | } |
48 | 51 | |