Index: trunk/extensions/SemanticMediaWiki/SemanticMediaWiki.hooks.php |
— | — | @@ -218,8 +218,7 @@ |
219 | 219 | * Special:Browse. The links has the CSS id "t-smwbrowselink" so that it can be |
220 | 220 | * skinned or hidden with all standard mechanisms (also by individual users |
221 | 221 | * with custom CSS). |
222 | | - * @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateToolboxEnd |
223 | | - * |
| 222 | + * |
224 | 223 | * @since 1.7.1 |
225 | 224 | * |
226 | 225 | * @param $skintemplate |
— | — | @@ -235,25 +234,4 @@ |
236 | 235 | return true; |
237 | 236 | } |
238 | 237 | |
239 | | - /** |
240 | | - * For extensions adding their own namespaces or altering the defaults. |
241 | | - * @see https://www.mediawiki.org/wiki/Manual:Hooks/CanonicalNamespaces |
242 | | - * |
243 | | - * @since 1.7.1 |
244 | | - * |
245 | | - * @param array $list |
246 | | - * |
247 | | - * @return true |
248 | | - */ |
249 | | - public static function onCanonicalNamespaces( array &$list ) { |
250 | | - $list[SMW_NS_PROPERTY] = 'Property'; |
251 | | - $list[SMW_NS_PROPERTY_TALK] = 'Property_talk'; |
252 | | - $list[SMW_NS_TYPE] = 'Type'; |
253 | | - $list[SMW_NS_TYPE_TALK] = 'Type_talk'; |
254 | | - $list[SMW_NS_CONCEPT] = 'Concept'; |
255 | | - $list[SMW_NS_CONCEPT_TALK] = 'Concept_talk'; |
256 | | - |
257 | | - return true; |
258 | | - } |
259 | | - |
260 | 238 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php |
— | — | @@ -33,7 +33,6 @@ |
34 | 34 | $wgExtensionMessagesFiles['SemanticMediaWiki'] = $smwgIP . 'languages/SMW_Messages.php'; |
35 | 35 | $wgExtensionMessagesFiles['SemanticMediaWikiAlias'] = $smwgIP . 'languages/SMW_Aliases.php'; |
36 | 36 | $wgExtensionMessagesFiles['SemanticMediaWikiMagic'] = $smwgIP . 'languages/SMW_Magic.php'; |
37 | | - $wgExtensionMessagesFiles['SemanticMediaWikiNS'] = $smwgIP . 'languages/SMW_Namespaces.php'; |
38 | 37 | |
39 | 38 | smwfRegisterHooks(); |
40 | 39 | smwfRegisterResourceLoaderModules(); |
— | — | @@ -100,7 +99,6 @@ |
101 | 100 | |
102 | 101 | $wgHooks['SkinAfterContent'][] = 'SMWFactbox::onSkinAfterContent'; // draw Factbox below categories |
103 | 102 | $wgHooks['SkinGetPoweredBy'][] = 'SMWHooks::addPoweredBySMW'; |
104 | | - $wgHooks['CanonicalNamespaces'][] = 'SMWHooks::onCanonicalNamespaces'; |
105 | 103 | |
106 | 104 | if ( version_compare( $wgVersion, '1.17alpha', '>=' ) ) { |
107 | 105 | // For MediaWiki 1.17 alpha and later. |
— | — | @@ -464,6 +462,8 @@ |
465 | 463 | if ( !is_array( $wgExtraNamespaces ) ) { |
466 | 464 | $wgExtraNamespaces = array(); |
467 | 465 | } |
| 466 | + $wgExtraNamespaces = $wgExtraNamespaces + $smwgContLang->getNamespaces(); |
| 467 | + $wgNamespaceAliases = $wgNamespaceAliases + $smwgContLang->getNamespaceAliases(); |
468 | 468 | |
469 | 469 | // Support subpages only for talk pages by default |
470 | 470 | $wgNamespacesWithSubpages = $wgNamespacesWithSubpages + array( |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Namespaces.php |
— | — | @@ -1,24 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Namespace internationalization for the Semantic MediaWiki extension. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SMW_Namespaces.php |
10 | | - * @ingroup SMWLanguage |
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 | | - SMW_NS_PROPERTY => 'Property', |
20 | | - SMW_NS_PROPERTY_TALK => 'Property_talk', |
21 | | - SMW_NS_TYPE => 'Type', |
22 | | - SMW_NS_TYPE_TALK => 'Type_talk', |
23 | | - SMW_NS_CONCEPT => 'Concept', |
24 | | - SMW_NS_CONCEPT_TALK => 'Concept_talk', |
25 | | -); |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php |
— | — | @@ -95,7 +95,43 @@ |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
| 99 | + |
99 | 100 | /** |
| 101 | + * Function that returns an array of namespace identifiers. |
| 102 | + */ |
| 103 | + function getNamespaces() { |
| 104 | + global $smwgHistoricTypeNamespace; |
| 105 | + $namespaces = $this->m_Namespaces; |
| 106 | + if ( !$smwgHistoricTypeNamespace ) { |
| 107 | + unset( $namespaces[SMW_NS_TYPE] ); |
| 108 | + unset( $namespaces[SMW_NS_TYPE_TALK] ); |
| 109 | + } |
| 110 | + return $namespaces; |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * Function that returns an array of namespace aliases, if any. |
| 115 | + */ |
| 116 | + function getNamespaceAliases() { |
| 117 | + global $smwgHistoricTypeNamespace; |
| 118 | + |
| 119 | + $namespaceAliases = $this->m_NamespaceAliases; |
| 120 | + if ( $this->m_useEnDefaultAliases ) { |
| 121 | + $namespaceAliases = $namespaceAliases + SMWLanguage::$enNamespaceAliases; |
| 122 | + } |
| 123 | + |
| 124 | + if ( !$smwgHistoricTypeNamespace ) { |
| 125 | + foreach ($namespaceAliases as $alias => $namespace) { |
| 126 | + if ( $namespace == SMW_NS_TYPE || $namespace == SMW_NS_TYPE_TALK ) { |
| 127 | + unset( $namespaceAliases[$alias] ); |
| 128 | + } |
| 129 | + } |
| 130 | + } |
| 131 | + |
| 132 | + return $namespaceAliases; |
| 133 | + } |
| 134 | + |
| 135 | + /** |
100 | 136 | * Return all labels that are available as names for built-in datatypes. Those |
101 | 137 | * are the types that users can access via [[has type::...]] (more built-in |
102 | 138 | * types may exist for internal purposes but the user won't need to |