Index: trunk/extensions/WikiObjectModel/includes/WOM_Setup.php |
— | — | @@ -2,6 +2,8 @@ |
3 | 3 | |
4 | 4 | global $wgOMIP, $wgAutoloadClasses; |
5 | 5 | |
| 6 | +$wgAutoloadClasses['WOMProcessor'] = $wgOMIP . '/includes/WOM_Processor.php'; |
| 7 | + |
6 | 8 | // POM Type |
7 | 9 | $wgAutoloadClasses['WikiObjectModelFactory'] = $wgOMIP . '/includes/models/WOMFactory.php'; |
8 | 10 | $wgAutoloadClasses['WikiObjectModel'] = $wgOMIP . '/includes/models/WikiObjectModel.php'; |
Index: trunk/extensions/WikiObjectModel/includes/WOM_Initialize.php |
— | — | @@ -8,83 +8,47 @@ |
9 | 9 | |
10 | 10 | define( 'WOM_VERSION', '1.0' ); |
11 | 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 | + |
12 | 21 | $wgOMIP = $IP . '/extensions/WikiObjectModel'; |
13 | 22 | $wgOMScriptPath = $wgScriptPath . '/extensions/WikiObjectModel'; |
14 | 23 | |
15 | | -global $wgExtensionFunctions; |
16 | | -$wgExtensionFunctions[] = 'wgOMSetupExtension'; |
| 24 | +$wgExtensionFunctions[] = 'smwfOMInitLanguage'; |
| 25 | +$wgExtensionMessagesFiles['WikiObjectModel'] = $wgOMIP . '/languages/Messages.php'; |
17 | 26 | |
18 | 27 | require_once( $wgOMIP . '/includes/WOM_Setup.php' ); |
19 | 28 | |
| 29 | +function smwfOMInitLanguageObject( $langcode, $fallback = null ) { |
| 30 | + global $wgOMIP; |
20 | 31 | |
21 | | -function smwfOMInitContentLanguage( $langcode ) { |
22 | | - global $wgOMIP, $wgOMContLang; |
23 | | - if ( !empty( $wgOMContLang ) ) { return; } |
| 32 | + $langClass = 'WOMLanguage' . str_replace( '-', '_', ucfirst( $langcode ) ); |
24 | 33 | |
25 | | - $mwContLangClass = 'WOMLanguage' . str_replace( '-', '_', ucfirst( $langcode ) ); |
26 | | - |
27 | | - if ( file_exists( $wgOMIP . '/languages/' . $mwContLangClass . '.php' ) ) { |
28 | | - include_once( $wgOMIP . '/languages/' . $mwContLangClass . '.php' ); |
| 34 | + if ( file_exists( $wgOMIP . '/languages/' . $langClass . '.php' ) ) { |
| 35 | + include_once( $wgOMIP . '/languages/' . $langClass . '.php' ); |
29 | 36 | } |
30 | 37 | |
31 | 38 | // fallback if language not supported |
32 | | - if ( !class_exists( $mwContLangClass ) ) { |
| 39 | + if ( !class_exists( $langClass ) ) { |
| 40 | + if ( $fallback ) { |
| 41 | + return $fallback; |
| 42 | + } |
33 | 43 | include_once( $wgOMIP . '/languages/WOMLanguageEn.php' ); |
34 | | - $mwContLangClass = 'WOMLanguageEn'; |
| 44 | + $langClass = 'WOMLanguageEn'; |
35 | 45 | } |
36 | | - $wgOMContLang = new $mwContLangClass(); |
| 46 | + return new $langClass(); |
37 | 47 | } |
38 | 48 | |
39 | | -function smwfOMInitMessages() { |
40 | | - global $wgOMMessagesInitialized; |
41 | | - if ( isset( $wgOMMessagesInitialized ) ) return; // prevent double init |
| 49 | +function smwfOMInitLanguage() { |
| 50 | + global $wgLanguageCode, $wgLang; |
| 51 | + global $wgOMContLang, $wgOMLang; |
42 | 52 | |
43 | | - wfOMInitUserMessages(); // lazy init for ajax calls |
44 | | - |
45 | | - $wgOMMessagesInitialized = true; |
| 53 | + $wgOMContLang = smwfOMInitLanguageObject( $wgLanguageCode ); |
| 54 | + $wgOMLang = smwfOMInitLanguageObject( $wgLang->getCode(), $wgOMContLang ); |
46 | 55 | } |
47 | | -function wfOMInitUserMessages() { |
48 | | - global $wgMessageCache, $wgOMContLang, $wgLanguageCode; |
49 | | - smwfOMInitContentLanguage( $wgLanguageCode ); |
50 | | - |
51 | | - global $wgOMIP, $wgOMLang; |
52 | | - if ( !empty( $wgOMLang ) ) { return; } |
53 | | - global $wgMessageCache, $wgLang; |
54 | | - $mwLangClass = 'WOMLanguage' . str_replace( '-', '_', ucfirst( $wgLang->getCode() ) ); |
55 | | - |
56 | | - if ( file_exists( $wgOMIP . '/languages/' . $mwLangClass . '.php' ) ) { |
57 | | - include_once( $wgOMIP . '/languages/' . $mwLangClass . '.php' ); |
58 | | - } |
59 | | - // fallback if language not supported |
60 | | - if ( !class_exists( $mwLangClass ) ) { |
61 | | - global $wgOMContLang; |
62 | | - $wgOMLang = $wgOMContLang; |
63 | | - } else { |
64 | | - $wgOMLang = new $mwLangClass(); |
65 | | - } |
66 | | - |
67 | | - $wgMessageCache->addMessages( $wgOMLang->getUserMsgArray(), $wgLang->getCode() ); |
68 | | -} |
69 | | - |
70 | | - |
71 | | -/** |
72 | | - * Intializes Semantic ObjectModel Extension. |
73 | | - * Called from WOM during initialization. |
74 | | - */ |
75 | | -function wgOMSetupExtension() { |
76 | | - global $wgOMIP, $wgHooks, $wgExtensionCredits, $wgAvailableRights; |
77 | | - global $wgAutoloadClasses, $wgSpecialPages, $wgSpecialPageGroups; |
78 | | - |
79 | | - smwfOMInitMessages(); |
80 | | - |
81 | | - $wgAutoloadClasses['WOMProcessor'] = $wgOMIP . '/includes/WOM_Processor.php'; |
82 | | - |
83 | | - // Register Credits |
84 | | - $wgExtensionCredits['parserhook'][] = array( |
85 | | - 'name' => 'Wiki ObjectModel Extension', 'version' => WOM_VERSION, |
86 | | - '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.]", |
87 | | - 'url' => 'http://wiking.vulcan.com/dev', |
88 | | - 'description' => 'Easy Page Object Model for wiki user.' ); |
89 | | - |
90 | | - return true; |
91 | | -} |
Index: trunk/extensions/WikiObjectModel/languages/WOMLanguageEn.php |
— | — | @@ -11,16 +11,6 @@ |
12 | 12 | |
13 | 13 | class WOMLanguageEn extends WOMLanguage { |
14 | 14 | |
15 | | - protected $wContentMessages = array( |
16 | | - |
17 | | - ); |
18 | | - |
19 | | - protected $wUserMessages = array( |
20 | | - /*Messages for Object Model*/ |
21 | | - 'objecteditor' => 'Object Editor', |
22 | | - 'wom_editor' => 'Object Model', |
23 | | - ); |
24 | | - |
25 | 15 | protected $wWOMTypeLabels = array( |
26 | 16 | '_cat' => 'Category', // Category |
27 | 17 | '_wpg' => 'Page', // Page |
Index: trunk/extensions/WikiObjectModel/languages/WOMLanguage.php |
— | — | @@ -9,8 +9,6 @@ |
10 | 10 | abstract class WOMLanguage { |
11 | 11 | |
12 | 12 | // the message arrays ... |
13 | | - protected $wContentMessages; |
14 | | - protected $wUserMessages; |
15 | 13 | protected $wWOMTypeLabels; |
16 | 14 | |
17 | 15 | function geWOMTypeLabels() { |
— | — | @@ -25,20 +23,4 @@ |
26 | 24 | function findWOMTypeMsgID( $label ) { |
27 | 25 | return array_search( $label, $this->wWOMTypeLabels ); |
28 | 26 | } |
29 | | - |
30 | | - /** |
31 | | - * Function that returns all content messages (those that are stored |
32 | | - * in wome article, and can thus not be translated to individual users). |
33 | | - */ |
34 | | - function getContentMsgArray() { |
35 | | - return $this->wContentMessages; |
36 | | - } |
37 | | - |
38 | | - /** |
39 | | - * Function that returns all user messages (those that are given only to |
40 | | - * the current user, and can thus be given in the individual user language). |
41 | | - */ |
42 | | - function getUserMsgArray() { |
43 | | - return $this->wUserMessages; |
44 | | - } |
45 | | -} |
\ No newline at end of file |
| 27 | +} |
Index: trunk/extensions/WikiObjectModel/languages/Messages.php |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$messages = array(); |
| 5 | + |
| 6 | +$messages['en'] = array( |
| 7 | + 'objecteditor' => 'Object Editor', |
| 8 | + 'wom_editor' => 'Object Model', |
| 9 | + 'wom-desc' => 'Easy Page Object Model for wiki user', |
| 10 | +); |
Property changes on: trunk/extensions/WikiObjectModel/languages/Messages.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |