r97901 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97900‎ | r97901 | r97902 >
Date:10:09, 23 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
moved entry point to match mediawiki conventions
Modified paths:
  • /trunk/extensions/WikiObjectModel/INSTALL (modified) (history)
  • /trunk/extensions/WikiObjectModel/WikiObjectModel.php (added) (history)
  • /trunk/extensions/WikiObjectModel/includes/WOM_Initialize.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiObjectModel/WikiObjectModel.php
@@ -0,0 +1,54 @@
 2+<?php
 3+/*
 4+ * Created on 22.11.2010
 5+ *
 6+ * Author: ning
 7+ */
 8+if ( !defined( 'MEDIAWIKI' ) ) die;
 9+
 10+define( 'WOM_VERSION', '1.0.1 alpha' );
 11+
 12+$wgExtensionCredits['parserhook'][] = array(
 13+ 'path' => __FILE__,
 14+ 'name' => 'Wiki ObjectModel Extension',
 15+ 'version' => WOM_VERSION,
 16+ 'author' => "Ning Hu, Justin Zhang, [http://smwforum.ontoprise.com/smwforum/index.php/Jesse_Wang Jesse Wang], sponsored by [http://projecthalo.com Project Halo], [http://www.vulcan.com Vulcan Inc.]",
 17+ 'url' => 'http://wiking.vulcan.com/dev',
 18+ 'descriptionmsg' => 'wom-desc'
 19+);
 20+
 21+$wgOMIP = $IP . '/extensions/WikiObjectModel';
 22+$wgOMScriptPath = $wgScriptPath . '/extensions/WikiObjectModel';
 23+
 24+$wgExtensionFunctions[] = 'smwfOMInitLanguage';
 25+$wgExtensionMessagesFiles['WikiObjectModel'] = $wgOMIP . '/languages/Messages.php';
 26+
 27+require_once( $wgOMIP . '/includes/WOM_Setup.php' );
 28+
 29+function smwfOMInitLanguageObject( $langcode, $fallback = null ) {
 30+ global $wgOMIP;
 31+
 32+ $langClass = 'WOMLanguage' . str_replace( '-', '_', ucfirst( $langcode ) );
 33+
 34+ if ( file_exists( $wgOMIP . '/languages/' . $langClass . '.php' ) ) {
 35+ include_once( $wgOMIP . '/languages/' . $langClass . '.php' );
 36+ }
 37+
 38+ // fallback if language not supported
 39+ if ( !class_exists( $langClass ) ) {
 40+ if ( $fallback ) {
 41+ return $fallback;
 42+ }
 43+ include_once( $wgOMIP . '/languages/WOMLanguageEn.php' );
 44+ $langClass = 'WOMLanguageEn';
 45+ }
 46+ return new $langClass();
 47+}
 48+
 49+function smwfOMInitLanguage() {
 50+ global $wgLanguageCode, $wgLang;
 51+ global $wgOMContLang, $wgOMLang;
 52+
 53+ $wgOMContLang = smwfOMInitLanguageObject( $wgLanguageCode );
 54+ $wgOMLang = smwfOMInitLanguageObject( $wgLang->getCode(), $wgOMContLang );
 55+}
Property changes on: trunk/extensions/WikiObjectModel/WikiObjectModel.php
___________________________________________________________________
Added: svn:eol-style
156 + native
Index: trunk/extensions/WikiObjectModel/INSTALL
@@ -1,7 +1,7 @@
22 == Requirements ==
33
44 * MediaWiki 1.13.5
5 -* Semantic MediaWiki 1.4.3 (optional)
 5+* Semantic MediaWiki >1.4.3 and < 1.6 (optional)
66 * PHP 5.x or greater installed and working
77 * MySQL >= 4.0.14 (version required by MediaWiki)
88
@@ -9,4 +9,4 @@
1010
1111 Edit $IP/LocalSettings.php and add:
1212
13 - include_once('extensions/WikiObjectModel/includes/WOM_Initialize.php');
 13+ include_once('extensions/WikiObjectModel/WikiObjectModel.php');
Index: trunk/extensions/WikiObjectModel/includes/WOM_Initialize.php
@@ -1,54 +1,7 @@
22 <?php
3 -/*
4 - * Created on 22.11.2010
5 - *
6 - * Author: ning
 3+
 4+/**
 5+ * Deprecated entry point, use WikiObjectModel/WikiObjectModel.php instead.
76 */
8 -if ( !defined( 'MEDIAWIKI' ) ) die;
97
10 -define( 'WOM_VERSION', '1.0' );
11 -
12 -$wgExtensionCredits['parserhook'][] = array(
13 - 'path' => __FILE__,
14 - 'name' => 'Wiki ObjectModel Extension',
15 - 'version' => WOM_VERSION,
16 - 'author' => "Ning Hu, Justin Zhang, [http://smwforum.ontoprise.com/smwforum/index.php/Jesse_Wang Jesse Wang], sponsored by [http://projecthalo.com Project Halo], [http://www.vulcan.com Vulcan Inc.]",
17 - 'url' => 'http://wiking.vulcan.com/dev',
18 - 'descriptionmsg' => 'wom-desc'
19 -);
20 -
21 -$wgOMIP = $IP . '/extensions/WikiObjectModel';
22 -$wgOMScriptPath = $wgScriptPath . '/extensions/WikiObjectModel';
23 -
24 -$wgExtensionFunctions[] = 'smwfOMInitLanguage';
25 -$wgExtensionMessagesFiles['WikiObjectModel'] = $wgOMIP . '/languages/Messages.php';
26 -
27 -require_once( $wgOMIP . '/includes/WOM_Setup.php' );
28 -
29 -function smwfOMInitLanguageObject( $langcode, $fallback = null ) {
30 - global $wgOMIP;
31 -
32 - $langClass = 'WOMLanguage' . str_replace( '-', '_', ucfirst( $langcode ) );
33 -
34 - if ( file_exists( $wgOMIP . '/languages/' . $langClass . '.php' ) ) {
35 - include_once( $wgOMIP . '/languages/' . $langClass . '.php' );
36 - }
37 -
38 - // fallback if language not supported
39 - if ( !class_exists( $langClass ) ) {
40 - if ( $fallback ) {
41 - return $fallback;
42 - }
43 - include_once( $wgOMIP . '/languages/WOMLanguageEn.php' );
44 - $langClass = 'WOMLanguageEn';
45 - }
46 - return new $langClass();
47 -}
48 -
49 -function smwfOMInitLanguage() {
50 - global $wgLanguageCode, $wgLang;
51 - global $wgOMContLang, $wgOMLang;
52 -
53 - $wgOMContLang = smwfOMInitLanguageObject( $wgLanguageCode );
54 - $wgOMLang = smwfOMInitLanguageObject( $wgLang->getCode(), $wgOMContLang );
55 -}
 8+include_once '../WikiObjectModel.php';
\ No newline at end of file

Status & tagging log