1 | <?php |
||
12 | final class MapsHooks { |
||
13 | /** |
||
14 | * Helper flag indicating whether the page has been purged. |
||
15 | * @var bool |
||
16 | * |
||
17 | * TODO: Figure out a better way to do this, not requiring this flag and make sure it works with |
||
18 | * later MW versions (purging mechanism got changed somewhat around 1.18). |
||
19 | */ |
||
20 | static $purgedBeforeStore = false; |
||
21 | |||
22 | /** |
||
23 | * Adds a link to Admin Links page. |
||
24 | * |
||
25 | * @since 0.7 |
||
26 | * |
||
27 | * @param ALTree $admin_links_tree |
||
28 | * |
||
29 | * @return boolean |
||
30 | */ |
||
31 | public static function addToAdminLinks( ALTree &$admin_links_tree ) { |
||
46 | |||
47 | /** |
||
48 | * Intercept pages in the Layer namespace to handle them correctly. |
||
49 | * |
||
50 | * @param $title: Title |
||
51 | * @param $article: Article or null |
||
52 | * |
||
53 | * @return boolean |
||
54 | */ |
||
55 | public static function onArticleFromTitle( Title &$title, /* Article */ &$article ) { |
||
62 | |||
63 | /** |
||
64 | * Adds global JavaScript variables. |
||
65 | * |
||
66 | * @since 1.0 |
||
67 | * @see http://www.mediawiki.org/wiki/Manual:Hooks/MakeGlobalVariablesScript |
||
68 | * @param array &$vars Variables to be added into the output |
||
69 | * @param OutputPage $outputPage OutputPage instance calling the hook |
||
70 | * @return boolean true in all cases |
||
71 | */ |
||
72 | public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $outputPage ) { |
||
82 | |||
83 | /** |
||
84 | * @since 0.7 |
||
85 | * |
||
86 | * @param array $list |
||
87 | * |
||
88 | * @return boolean |
||
89 | */ |
||
90 | public static function onCanonicalNamespaces( array &$list ) { |
||
95 | |||
96 | /** |
||
97 | * This will setup database tables for layer functionality. |
||
98 | * |
||
99 | * @since 3.0 |
||
100 | * |
||
101 | * @param DatabaseUpdater $updater |
||
102 | * |
||
103 | * @return true |
||
104 | */ |
||
105 | public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) { |
||
118 | |||
119 | /** |
||
120 | * Make sure layer data will be stored into database when purging the page |
||
121 | * |
||
122 | * @since 3.0 |
||
123 | * |
||
124 | * @param $article WikiPage|Article (depending on MW version, WikiPage in 1.18+) |
||
125 | * @return type |
||
126 | */ |
||
127 | public static function onArticlePurge( &$article ) { |
||
131 | |||
132 | /** |
||
133 | * At the end of article parsing, in case of layer page, save layers to database |
||
134 | * |
||
135 | * @since 3.0 |
||
136 | * |
||
137 | * @param Parser &$parser |
||
138 | * @param string &$text |
||
139 | * |
||
140 | * @return true |
||
141 | */ |
||
142 | public static function onParserAfterTidy( Parser &$parser, &$text ) { |
||
160 | |||
161 | /** |
||
162 | * After article was edited and parsed, in case of layer page, save layers to database |
||
163 | * |
||
164 | * @since 3.0 |
||
165 | * |
||
166 | * @param LinksUpdate &$linksUpdate |
||
167 | * |
||
168 | * @return true |
||
169 | */ |
||
170 | public static function onLinksUpdateConstructed( LinksUpdate &$linksUpdate ) { |
||
177 | |||
178 | /** |
||
179 | * Checks whether the parser output has some layer data which should be stored of the |
||
180 | * given title and performs the task. |
||
181 | * |
||
182 | * @since 3.0 |
||
183 | * |
||
184 | * @param ParserOutput $parserOutput |
||
185 | * @param Title $title |
||
186 | */ |
||
187 | protected static function processLayersStoreCandidate( ParserOutput $parserOutput, Title $title ) { |
||
203 | |||
204 | /** |
||
205 | * If a new parser process is getting started, clear collected layer data of the |
||
206 | * previous one. |
||
207 | * |
||
208 | * @since 3.0 |
||
209 | * |
||
210 | * @param Parser $parser |
||
211 | * |
||
212 | * @return true |
||
213 | */ |
||
214 | public static function onParserClearState( Parser &$parser ) { |
||
218 | } |
||
219 | |||
220 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.