Index: trunk/extensions/SemanticForms/SemanticForms.php |
— | — | @@ -91,7 +91,6 @@ |
92 | 92 | $wgHooks['MakeGlobalVariablesScript'][] = 'SFFormUtils::setGlobalJSVariables'; |
93 | 93 | $wgHooks['PageSchemasRegisterHandlers'][] = 'SFPageSchemas::registerClass'; |
94 | 94 | $wgHooks['EditPage::importFormData'][] = 'SFUtils::showFormPreview'; |
95 | | -$wgHooks['CanonicalNamespaces'][] = 'SFUtils::onCanonicalNamespaces'; |
96 | 95 | |
97 | 96 | $wgAPIModules['sfautocomplete'] = 'SFAutocompleteAPI'; |
98 | 97 | $wgAPIModules['sfautoedit'] = 'SFAutoeditAPI'; |
— | — | @@ -173,8 +172,6 @@ |
174 | 173 | $wgExtensionMessagesFiles['SemanticForms'] = $sfgIP . '/languages/SF_Messages.php'; |
175 | 174 | $wgExtensionMessagesFiles['SemanticFormsAlias'] = $sfgIP . '/languages/SF_Aliases.php'; |
176 | 175 | $wgExtensionMessagesFiles['SemanticFormsMagic'] = $sfgIP . '/languages/SF_Magic.php'; |
177 | | -$wgExtensionMessagesFiles['SemanticFormsNS'] = $sfgIP . '/languages/SF_Namespaces.php'; |
178 | | - |
179 | 176 | // Allow for popup windows for file upload |
180 | 177 | $wgEditPageFrameOptions = 'SAMEORIGIN'; |
181 | 178 | |
Index: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php |
— | — | @@ -30,14 +30,12 @@ |
31 | 31 | $form_tag = "[[" . $specprops[SF_SP_HAS_DEFAULT_FORM] . "::$default_form]]"; |
32 | 32 | $text = wfMsgForContent( 'sf_category_hasdefaultform', $form_tag ); |
33 | 33 | } |
34 | | - |
35 | 34 | if ( $parent_category !== '' ) { |
36 | 35 | global $wgContLang; |
37 | 36 | $namespace_labels = $wgContLang->getNamespaces(); |
38 | 37 | $category_namespace = $namespace_labels[NS_CATEGORY]; |
39 | 38 | $text .= "\n\n[[$category_namespace:$parent_category]]"; |
40 | 39 | } |
41 | | - |
42 | 40 | return $text; |
43 | 41 | } |
44 | 42 | |
Index: trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php |
— | — | @@ -30,10 +30,15 @@ |
31 | 31 | * greater or equal to 100. |
32 | 32 | */ |
33 | 33 | function sffInitNamespaces() { |
34 | | - global $wgNamespacesWithSubpages, $wgLanguageCode, $sfgContLang; |
| 34 | + global $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespacesWithSubpages, $wgLanguageCode, $sfgContLang; |
35 | 35 | |
36 | 36 | sffInitContentLanguage( $wgLanguageCode ); |
37 | 37 | |
| 38 | + // Register namespace identifiers |
| 39 | + if ( !is_array( $wgExtraNamespaces ) ) { $wgExtraNamespaces = array(); } |
| 40 | + $wgExtraNamespaces = $wgExtraNamespaces + $sfgContLang->getNamespaces(); |
| 41 | + $wgNamespaceAliases = $wgNamespaceAliases + $sfgContLang->getNamespaceAliases(); |
| 42 | + |
38 | 43 | // Support subpages only for talk pages by default |
39 | 44 | $wgNamespacesWithSubpages = $wgNamespacesWithSubpages + array( |
40 | 45 | SF_NS_FORM_TALK => true |
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php |
— | — | @@ -417,8 +417,8 @@ |
418 | 418 | |
419 | 419 | public static function formDropdownHTML() { |
420 | 420 | // create a dropdown of possible form names |
421 | | - global $wgContLang; |
422 | | - $namespace_labels = $wgContLang->getNamespaces(); |
| 421 | + global $sfgContLang; |
| 422 | + $namespace_labels = $sfgContLang->getNamespaces(); |
423 | 423 | $form_label = $namespace_labels[SF_NS_FORM]; |
424 | 424 | $form_names = SFUtils::getAllForms(); |
425 | 425 | $select_body = "\n"; |
— | — | @@ -1082,21 +1082,4 @@ |
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | |
1086 | | - /** |
1087 | | - * For extensions adding their own namespaces or altering the defaults. |
1088 | | - * @see https://www.mediawiki.org/wiki/Manual:Hooks/CanonicalNamespaces |
1089 | | - * |
1090 | | - * @since 2.4.1 |
1091 | | - * |
1092 | | - * @param array $list |
1093 | | - * |
1094 | | - * @return true |
1095 | | - */ |
1096 | | - public static function onCanonicalNamespaces( array &$list ) { |
1097 | | - $list[SF_NS_FORM] = 'Form'; |
1098 | | - $list[SF_NS_FORM_TALK] = 'Form_talk'; |
1099 | | - |
1100 | | - return true; |
1101 | | - } |
1102 | | - |
1103 | 1086 | } |
Index: trunk/extensions/SemanticForms/languages/SF_Namespaces.php |
— | — | @@ -1,20 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Namespace internationalization for the Semantic Forms extension. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SF_Namespaces.php |
10 | | - * @ingroup SemanticForms |
11 | | - * |
12 | | - * @licence GNU GPL v2+ |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | - |
16 | | -$namespaceNames = array(); |
17 | | - |
18 | | -$namespaceNames['en'] = array( |
19 | | - SF_NS_FORM => 'Form', |
20 | | - SF_NS_FORM_TALK => 'Form_talk', |
21 | | -); |
Index: trunk/extensions/SemanticForms/languages/SF_Language.php |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | // arrays for the names of special properties and namespaces - |
17 | 17 | // all messages are stored in SF_Messages.php |
18 | 18 | protected $m_SpecialProperties; |
| 19 | + protected $m_Namespaces; |
19 | 20 | |
20 | 21 | // By default, every language has English-language aliases for |
21 | 22 | // special properties and namespaces |
— | — | @@ -24,7 +25,26 @@ |
25 | 26 | 'Creates pages with form' => SF_SP_CREATES_PAGES_WITH_FORM, |
26 | 27 | ); |
27 | 28 | |
| 29 | + protected $m_NamespaceAliases = array( |
| 30 | + 'Form' => SF_NS_FORM, |
| 31 | + 'Form_talk' => SF_NS_FORM_TALK |
| 32 | + ); |
| 33 | + |
28 | 34 | /** |
| 35 | + * Function that returns an array of namespace identifiers. |
| 36 | + */ |
| 37 | + function getNamespaces() { |
| 38 | + return $this->m_Namespaces; |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Function that returns an array of namespace aliases, if any. |
| 43 | + */ |
| 44 | + function getNamespaceAliases() { |
| 45 | + return $this->m_NamespaceAliases; |
| 46 | + } |
| 47 | + |
| 48 | + /** |
29 | 49 | * Function that returns the labels for the special properties. |
30 | 50 | */ |
31 | 51 | function getPropertyLabels() { |