r111654 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111653‎ | r111654 | r111655 >
Date:17:40, 16 February 2012
Author:jeroendedauw
Status:ok
Tags:
Comment:
revert 111507 since it broke compat w/ 1.16
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/SemanticMediaWiki.hooks.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Namespaces.php (deleted) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/SemanticMediaWiki.hooks.php
@@ -218,8 +218,7 @@
219219 * Special:Browse. The links has the CSS id "t-smwbrowselink" so that it can be
220220 * skinned or hidden with all standard mechanisms (also by individual users
221221 * with custom CSS).
222 - * @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateToolboxEnd
223 - *
 222+ *
224223 * @since 1.7.1
225224 *
226225 * @param $skintemplate
@@ -235,25 +234,4 @@
236235 return true;
237236 }
238237
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 -
260238 }
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php
@@ -33,7 +33,6 @@
3434 $wgExtensionMessagesFiles['SemanticMediaWiki'] = $smwgIP . 'languages/SMW_Messages.php';
3535 $wgExtensionMessagesFiles['SemanticMediaWikiAlias'] = $smwgIP . 'languages/SMW_Aliases.php';
3636 $wgExtensionMessagesFiles['SemanticMediaWikiMagic'] = $smwgIP . 'languages/SMW_Magic.php';
37 - $wgExtensionMessagesFiles['SemanticMediaWikiNS'] = $smwgIP . 'languages/SMW_Namespaces.php';
3837
3938 smwfRegisterHooks();
4039 smwfRegisterResourceLoaderModules();
@@ -100,7 +99,6 @@
101100
102101 $wgHooks['SkinAfterContent'][] = 'SMWFactbox::onSkinAfterContent'; // draw Factbox below categories
103102 $wgHooks['SkinGetPoweredBy'][] = 'SMWHooks::addPoweredBySMW';
104 - $wgHooks['CanonicalNamespaces'][] = 'SMWHooks::onCanonicalNamespaces';
105103
106104 if ( version_compare( $wgVersion, '1.17alpha', '>=' ) ) {
107105 // For MediaWiki 1.17 alpha and later.
@@ -464,6 +462,8 @@
465463 if ( !is_array( $wgExtraNamespaces ) ) {
466464 $wgExtraNamespaces = array();
467465 }
 466+ $wgExtraNamespaces = $wgExtraNamespaces + $smwgContLang->getNamespaces();
 467+ $wgNamespaceAliases = $wgNamespaceAliases + $smwgContLang->getNamespaceAliases();
468468
469469 // Support subpages only for talk pages by default
470470 $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 @@
9696 }
9797 }
9898
 99+
99100 /**
 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+ /**
100136 * Return all labels that are available as names for built-in datatypes. Those
101137 * are the types that users can access via [[has type::...]] (more built-in
102138 * types may exist for internal purposes but the user won't need to

Status & tagging log