| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Registry of flags used with ParserOutput::{get,append}OutputString() |
| 5 | * within 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.41 |
| 23 | * |
| 24 | * @file |
| 25 | * @ingroup Parser |
| 26 | */ |
| 27 | |
| 28 | namespace MediaWiki\Parser; |
| 29 | |
| 30 | /** |
| 31 | * Registry of string sets used with ParserOutput::{get,append}OutputString() |
| 32 | * within MediaWiki core. |
| 33 | * |
| 34 | * All string sets used should be defined in this class. |
| 35 | * |
| 36 | * @package MediaWiki\Parser |
| 37 | */ |
| 38 | class ParserOutputStringSets { |
| 39 | |
| 40 | // These flags are currently stored as ParserOutput properties |
| 41 | |
| 42 | /** |
| 43 | * @var string ResourceLoader modules to load. |
| 44 | * @see \MediaWiki\Output\OutputPage::addModules |
| 45 | * @see ParserOutput::addModules |
| 46 | * @see ParserOutput::getModules |
| 47 | */ |
| 48 | public const MODULE = 'mw-Module'; |
| 49 | |
| 50 | /** |
| 51 | * @var string Style-only ResourceLoader modules to load. |
| 52 | * @see \MediaWiki\Output\OutputPage::addModuleStyles |
| 53 | * @see ParserOutput::addModuleStyles |
| 54 | * @see ParserOutput::getModuleStyles |
| 55 | */ |
| 56 | public const MODULE_STYLE = 'mw-ModuleStyle'; |
| 57 | |
| 58 | /** |
| 59 | * @var string Extra values for the Content-Security-Policy default-src |
| 60 | * directive. |
| 61 | * @see ParserOutput::addExtraCSPDefaultSrc |
| 62 | * @see ParserOutput::getExtraCSPDefaultSrcs |
| 63 | */ |
| 64 | public const EXTRA_CSP_DEFAULT_SRC = 'mw-ExtraCSPDefaultSrc'; |
| 65 | |
| 66 | /** |
| 67 | * @var string Extra values for the Content-Security-Policy script-src |
| 68 | * directive. |
| 69 | * @see ParserOutput::addExtraCSPScriptSrc |
| 70 | * @see ParserOutput::getExtraCSPScriptSrcs |
| 71 | */ |
| 72 | public const EXTRA_CSP_SCRIPT_SRC = 'mw-ExtraCspScriptSrc'; |
| 73 | |
| 74 | /** |
| 75 | * @var string Extra values for the Content-Security-Policy style-src |
| 76 | * directive. |
| 77 | * @see ParserOutput::addExtraCSPStyleSrc |
| 78 | * @see ParserOutput::getExtraCSPStyleSrcs |
| 79 | */ |
| 80 | public const EXTRA_CSP_STYLE_SRC = 'mw-ExtraCspStyleSrc'; |
| 81 | |
| 82 | public static function cases(): array { |
| 83 | return [ |
| 84 | self::MODULE, |
| 85 | self::MODULE_STYLE, |
| 86 | self::EXTRA_CSP_DEFAULT_SRC, |
| 87 | self::EXTRA_CSP_SCRIPT_SRC, |
| 88 | self::EXTRA_CSP_STYLE_SRC, |
| 89 | ]; |
| 90 | } |
| 91 | } |