Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
ParserOutputFlags | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
cases | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Registry of flags used with ParserOutput::setOutputFlag() within |
5 | * MediaWiki core. |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; if not, write to the Free Software Foundation, Inc., |
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | * http://www.gnu.org/copyleft/gpl.html |
21 | * |
22 | * @since 1.38 |
23 | * |
24 | * @file |
25 | * @ingroup Parser |
26 | */ |
27 | |
28 | namespace MediaWiki\Parser; |
29 | |
30 | /** |
31 | * Registry of flags used with ParserOutput::{get,set}OutputFlag() within |
32 | * MediaWiki core. |
33 | * |
34 | * All flags used should be defined in this class. |
35 | * |
36 | * It is recommended that new flag names in core should begin with 'mw-' |
37 | * in order to prevent namespace conflicts with legacy flags. |
38 | * |
39 | * @package MediaWiki\Parser |
40 | */ |
41 | class ParserOutputFlags { |
42 | |
43 | // These flags are currently stored as ParserOutput properties |
44 | |
45 | /** |
46 | * @var string No gallery on category page? (__NOGALLERY__). |
47 | * @see ParserOutput::getNoGallery() |
48 | * @see ParserOutput::setNoGallery() |
49 | */ |
50 | public const NO_GALLERY = 'mw-NoGallery'; |
51 | |
52 | /** |
53 | * @var string Whether OOUI should be enabled. |
54 | * @see ParserOutput::getEnableOOUI() |
55 | * @see ParserOutput::setEnableOOUI() |
56 | */ |
57 | public const ENABLE_OOUI = 'mw-EnableOOUI'; |
58 | |
59 | /** |
60 | * @var string Force index policy to be 'index' |
61 | * @see ParserOutput::getIndexPolicy() |
62 | * @see ParserOutput::setIndexPolicy() |
63 | */ |
64 | public const INDEX_POLICY = 'mw-IndexPolicy'; |
65 | |
66 | /** |
67 | * @var string Force index policy to be 'noindex' |
68 | * @see ParserOutput::getIndexPolicy() |
69 | * @see ParserOutput::setIndexPolicy() |
70 | */ |
71 | public const NO_INDEX_POLICY = 'mw-NoIndexPolicy'; |
72 | |
73 | /** |
74 | * @var string Show a new section link? |
75 | * @see ParserOutput::getNewSection() |
76 | * @see ParserOutput::setNewSection() |
77 | */ |
78 | public const NEW_SECTION = 'mw-NewSection'; |
79 | |
80 | /** |
81 | * @var string Hide the new section link? |
82 | * @see ParserOutput::getHideNewSection() |
83 | * @see ParserOutput::setHideNewSection() |
84 | */ |
85 | public const HIDE_NEW_SECTION = 'mw-HideNewSection'; |
86 | |
87 | /** |
88 | * @var string The prevent-clickjacking flag |
89 | * @see ParserOutput::getPreventClickjacking() |
90 | * @see ParserOutput::setPreventClickjacking() |
91 | */ |
92 | public const PREVENT_CLICKJACKING = 'mw-PreventClickjacking'; |
93 | |
94 | // These flags are stored in the ParserOutput::$mFlags array |
95 | |
96 | /** |
97 | * @var string Show the table of contents in the skin? This is |
98 | * a /suggestion/ based on whether the TOC is "large enough" |
99 | * and other factors, and is intended mostly for skins which |
100 | * want to match the behavior of the traditional inline ToC. |
101 | */ |
102 | public const SHOW_TOC = 'show-toc'; |
103 | |
104 | /** |
105 | * @var string Suppress the table of contents in the skin? |
106 | * This reflects the use of the __NOTOC__ magic word in the |
107 | * article (possibly modified by __TOC__ or __FORCETOC__), |
108 | * and represents an explicit request from the author to |
109 | * hide the TOC. |
110 | */ |
111 | public const NO_TOC = 'no-toc'; |
112 | |
113 | /** |
114 | * @var string Suppress the section edit links? |
115 | * This reflects the ParserOptions::getSuppressSectionEditLinks() |
116 | * flag and affects the default value of `enableSectionEditLinks` |
117 | * in ParserOutput::getText(). |
118 | */ |
119 | public const NO_SECTION_EDIT_LINKS = 'no-section-edit-links'; |
120 | |
121 | /** |
122 | * @var string Wrap section contents to allow collapsing them? |
123 | * This reflects the ParserOptions::getCollapsibleSections() |
124 | * flag. |
125 | */ |
126 | public const COLLAPSIBLE_SECTIONS = 'collapsible-sections'; |
127 | |
128 | /** |
129 | * @var string |
130 | */ |
131 | public const VARY_REVISION = 'vary-revision'; |
132 | |
133 | /** |
134 | * @var string Similar to VARY_REVISION, but used if we didn't |
135 | * guess the ID correctly. Informs the edit saving system that |
136 | * getting the canonical output after revision insertion requires |
137 | * a parse that used that exact revision ID. |
138 | */ |
139 | public const VARY_REVISION_ID = 'vary-revision-id'; |
140 | |
141 | /** |
142 | * @var string Similar to VARY_REVISION, but used if we didn't |
143 | * guess the timestamp correctly. Informs the edit saving system |
144 | * that getting the canonical output after revision insertion |
145 | * requires a parse that used an actual revision timestamp. |
146 | */ |
147 | public const VARY_REVISION_TIMESTAMP = 'vary-revision-timestamp'; |
148 | |
149 | /** |
150 | * @var string Similar to VARY_REVISION, but used if we didn't guess the |
151 | * content correctly. |
152 | */ |
153 | public const VARY_REVISION_SHA1 = 'vary-revision-sha1'; |
154 | |
155 | /** |
156 | * @var string Similar to VARY_REVISION |
157 | */ |
158 | public const VARY_REVISION_EXISTS = 'vary-revision-exists'; |
159 | |
160 | /** |
161 | * @var string Similar to VARY_REVISION, but used if we didn't guess the |
162 | * page id correctly. Informs the edit saving system that getting the |
163 | * canonical output after page insertion requires a parse that used that |
164 | * exact page id. |
165 | */ |
166 | public const VARY_PAGE_ID = 'vary-page-id'; |
167 | |
168 | /** |
169 | * @var string Similar to VARY_REVISION. Informs the edit saving |
170 | * system that getting the canonical output after revision |
171 | * insertion requires a parse that used the actual user ID. |
172 | */ |
173 | public const VARY_USER = 'vary-user'; |
174 | |
175 | /** |
176 | * @var string Used to avoid extremely stale user signature timestamps |
177 | * (T84843). Set if the signature wikitext contains another '~~~~' or |
178 | * similar (T230652). |
179 | */ |
180 | public const USER_SIGNATURE = 'user-signature'; |
181 | |
182 | /** |
183 | * @var string Set when the parse is done in "preview mode", in which |
184 | * case various shortcuts are taken to work around the fact that the |
185 | * parsed text does not yet have an actual revision ID, revision time, |
186 | * etc. |
187 | * @see ParserOptions::getIsPreview() |
188 | */ |
189 | public const IS_PREVIEW = 'is-preview'; |
190 | |
191 | public static function cases(): array { |
192 | return [ |
193 | self::NO_GALLERY, |
194 | self::ENABLE_OOUI, |
195 | self::INDEX_POLICY, |
196 | self::NO_INDEX_POLICY, |
197 | self::NEW_SECTION, |
198 | self::HIDE_NEW_SECTION, |
199 | self::SHOW_TOC, |
200 | self::NO_TOC, |
201 | self::NO_SECTION_EDIT_LINKS, |
202 | self::COLLAPSIBLE_SECTIONS, |
203 | self::PREVENT_CLICKJACKING, |
204 | self::VARY_REVISION, |
205 | self::VARY_REVISION_ID, |
206 | self::VARY_REVISION_TIMESTAMP, |
207 | self::VARY_REVISION_SHA1, |
208 | self::VARY_REVISION_EXISTS, |
209 | self::VARY_PAGE_ID, |
210 | self::VARY_USER, |
211 | self::USER_SIGNATURE, |
212 | self::IS_PREVIEW, |
213 | ]; |
214 | } |
215 | } |