Index: trunk/extensions/SemanticForms/SemanticForms.php |
— | — | @@ -91,6 +91,7 @@ |
92 | 92 | $wgHooks['MakeGlobalVariablesScript'][] = 'SFFormUtils::setGlobalJSVariables'; |
93 | 93 | $wgHooks['PageSchemasRegisterHandlers'][] = 'SFPageSchemas::registerClass'; |
94 | 94 | $wgHooks['EditPage::importFormData'][] = 'SFUtils::showFormPreview'; |
| 95 | +$wgHooks['CanonicalNamespaces'][] = 'SFUtils::onCanonicalNamespaces'; |
95 | 96 | |
96 | 97 | $wgAPIModules['sfautocomplete'] = 'SFAutocompleteAPI'; |
97 | 98 | $wgAPIModules['sfautoedit'] = 'SFAutoeditAPI'; |
— | — | @@ -172,6 +173,8 @@ |
173 | 174 | $wgExtensionMessagesFiles['SemanticForms'] = $sfgIP . '/languages/SF_Messages.php'; |
174 | 175 | $wgExtensionMessagesFiles['SemanticFormsAlias'] = $sfgIP . '/languages/SF_Aliases.php'; |
175 | 176 | $wgExtensionMessagesFiles['SemanticFormsMagic'] = $sfgIP . '/languages/SF_Magic.php'; |
| 177 | +$wgExtensionMessagesFiles['SemanticFormsNS'] = $sfgIP . '/languages/SF_Namespaces.php'; |
| 178 | + |
176 | 179 | // Allow for popup windows for file upload |
177 | 180 | $wgEditPageFrameOptions = 'SAMEORIGIN'; |
178 | 181 | |
Index: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php |
— | — | @@ -30,12 +30,14 @@ |
31 | 31 | $form_tag = "[[" . $specprops[SF_SP_HAS_DEFAULT_FORM] . "::$default_form]]"; |
32 | 32 | $text = wfMsgForContent( 'sf_category_hasdefaultform', $form_tag ); |
33 | 33 | } |
| 34 | + |
34 | 35 | if ( $parent_category !== '' ) { |
35 | 36 | global $wgContLang; |
36 | 37 | $namespace_labels = $wgContLang->getNamespaces(); |
37 | 38 | $category_namespace = $namespace_labels[NS_CATEGORY]; |
38 | 39 | $text .= "\n\n[[$category_namespace:$parent_category]]"; |
39 | 40 | } |
| 41 | + |
40 | 42 | return $text; |
41 | 43 | } |
42 | 44 | |
Index: trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php |
— | — | @@ -30,15 +30,10 @@ |
31 | 31 | * greater or equal to 100. |
32 | 32 | */ |
33 | 33 | function sffInitNamespaces() { |
34 | | - global $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespacesWithSubpages, $wgLanguageCode, $sfgContLang; |
| 34 | + global $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 | | - |
43 | 38 | // Support subpages only for talk pages by default |
44 | 39 | $wgNamespacesWithSubpages = $wgNamespacesWithSubpages + array( |
45 | 40 | 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 $sfgContLang; |
422 | | - $namespace_labels = $sfgContLang->getNamespaces(); |
| 421 | + global $wgContLang; |
| 422 | + $namespace_labels = $wgContLang->getNamespaces(); |
423 | 423 | $form_label = $namespace_labels[SF_NS_FORM]; |
424 | 424 | $form_names = SFUtils::getAllForms(); |
425 | 425 | $select_body = "\n"; |
— | — | @@ -1082,4 +1082,21 @@ |
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 | + |
1086 | 1103 | } |
Index: trunk/extensions/SemanticForms/languages/SF_Namespaces.php |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Namespace internationalizationfor the Semantic Forms extension. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file SF_Namespaces.php |
| 10 | + * @ingroup SemanticForms |
| 11 | + * |
| 12 | + * @licence GNU GPL v3+ |
| 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,7 +15,6 @@ |
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; |
20 | 19 | |
21 | 20 | // By default, every language has English-language aliases for |
22 | 21 | // special properties and namespaces |
— | — | @@ -25,26 +24,7 @@ |
26 | 25 | 'Creates pages with form' => SF_SP_CREATES_PAGES_WITH_FORM, |
27 | 26 | ); |
28 | 27 | |
29 | | - protected $m_NamespaceAliases = array( |
30 | | - 'Form' => SF_NS_FORM, |
31 | | - 'Form_talk' => SF_NS_FORM_TALK |
32 | | - ); |
33 | | - |
34 | 28 | /** |
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 | | - /** |
49 | 29 | * Function that returns the labels for the special properties. |
50 | 30 | */ |
51 | 31 | function getPropertyLabels() { |