Merge "mediawiki.router: Move hashchange handler to a real method"
[mediawiki.git] / includes / parser / ParserOutputFlags.php
blob2e4584ccdb2b61c0ff4ba51c92fb576aa1865c5b
1 <?php
3 /**
4 * Registry of flags used with ParserOutput::setOutputFlag() within
5 * MediaWiki core.
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.
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.
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
22 * @since 1.38
24 * @file
25 * @ingroup Parser
28 namespace MediaWiki\Parser;
30 /**
31 * Registry of flags used with ParserOutput::{get,set}OutputFlag() within
32 * MediaWiki core.
34 * All flags used should be defined in this class.
36 * It is recommended that new flag names in core should begin with 'mw-'
37 * in order to prevent namespace conflicts with legacy flags.
39 * @package MediaWiki\Parser
41 class ParserOutputFlags {
43 // These flags are currently stored as ParserOutput properties
45 /**
46 * @var string No gallery on category page? (__NOGALLERY__).
47 * @see ParserOutput::getNoGallery()
48 * @see ParserOutput::setNoGallery()
50 public const NO_GALLERY = 'mw-NoGallery';
52 /**
53 * @var string Whether OOUI should be enabled.
54 * @see ParserOutput::getEnableOOUI()
55 * @see ParserOutput::setEnableOOUI()
57 public const ENABLE_OOUI = 'mw-EnableOOUI';
59 /**
60 * @var string Force index policy to be 'index'
61 * @see ParserOutput::getIndexPolicy()
62 * @see ParserOutput::setIndexPolicy()
64 public const INDEX_POLICY = 'mw-IndexPolicy';
66 /**
67 * @var string Force index policy to be 'noindex'
68 * @see ParserOutput::getIndexPolicy()
69 * @see ParserOutput::setIndexPolicy()
71 public const NO_INDEX_POLICY = 'mw-NoIndexPolicy';
73 /**
74 * @var string Show a new section link?
75 * @see ParserOutput::getNewSection()
76 * @see ParserOutput::setNewSection()
78 public const NEW_SECTION = 'mw-NewSection';
80 /**
81 * @var string Hide the new section link?
82 * @see ParserOutput::getHideNewSection()
83 * @see ParserOutput::setHideNewSection()
85 public const HIDE_NEW_SECTION = 'mw-HideNewSection';
87 /**
88 * @var string The prevent-clickjacking flag
89 * @see ParserOutput::getPreventClickjacking()
90 * @see ParserOutput::setPreventClickjacking()
92 public const PREVENT_CLICKJACKING = 'mw-PreventClickjacking';
94 // These flags are stored in the ParserOutput::$mFlags array
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.
102 public const SHOW_TOC = 'show-toc';
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.
111 public const NO_TOC = 'no-toc';
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().
119 public const NO_SECTION_EDIT_LINKS = 'no-section-edit-links';
122 * @var string Wrap section contents to allow collapsing them?
123 * This reflects the ParserOptions::getCollapsibleSections()
124 * flag.
126 public const COLLAPSIBLE_SECTIONS = 'collapsible-sections';
129 * @var string
131 public const VARY_REVISION = 'vary-revision';
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.
139 public const VARY_REVISION_ID = 'vary-revision-id';
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.
147 public const VARY_REVISION_TIMESTAMP = 'vary-revision-timestamp';
150 * @var string Similar to VARY_REVISION, but used if we didn't guess the
151 * content correctly.
153 public const VARY_REVISION_SHA1 = 'vary-revision-sha1';
156 * @var string Similar to VARY_REVISION
158 public const VARY_REVISION_EXISTS = 'vary-revision-exists';
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.
166 public const VARY_PAGE_ID = 'vary-page-id';
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.
173 public const VARY_USER = 'vary-user';
176 * @var string Used to avoid extremely stale user signature timestamps
177 * (T84843). Set if the signature wikitext contains another '~~~~' or
178 * similar (T230652).
180 public const USER_SIGNATURE = 'user-signature';
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()
189 public const IS_PREVIEW = 'is-preview';
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,