Index: trunk/extensions/WikiBhasha/wikibhasha.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | ********************************************************/ |
8 | 8 | |
9 | 9 | /* |
10 | | -Copyright (c) 2010, Microsoft |
| 10 | +Copyright (c) 2010, Microsoft |
11 | 11 | All rights reserved. |
12 | 12 | */ |
13 | 13 | |
— | — | @@ -23,31 +23,31 @@ |
24 | 24 | |
25 | 25 | $wgExtensionCredits['specialpage'][] = array( |
26 | 26 | 'name' => 'WikiBhasha', |
27 | | - 'author' => 'Microsoft Researh', |
| 27 | + 'author' => 'Microsoft Research', |
28 | 28 | 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiBhasha', |
29 | 29 | 'description' => 'Default description message', |
30 | 30 | 'descriptionmsg' => 'wikibhasha-desc', |
31 | 31 | 'version' => '1.0', |
32 | 32 | ); |
33 | 33 | |
34 | | -//static Paths |
35 | | -$dir = dirname(__FILE__) . '/'; |
| 34 | +// static Paths |
| 35 | +$dir = dirname( __FILE__ ) . '/'; |
36 | 36 | $jsPath = "extensions/WikiBhasha/src/"; |
37 | 37 | |
38 | | -//add a special page |
| 38 | +// add a special page |
39 | 39 | $wgSpecialPages['wikiBhasha'] = 'WikiBhasha'; |
40 | 40 | $wgSpecialPageGroups['wikiBhasha'] = 'wiki'; |
41 | 41 | |
42 | 42 | // Autoloadable classes |
43 | | -$wgAutoloadClasses['wikiBhashaExt'] = $dir . 'wikiBhashaExtClass.php'; |
44 | | -$wgAutoloadClasses['wikiBhasha'] = $dir . 'wikiBhashaSpecial.php'; |
| 43 | +$wgAutoloadClasses['wikiBhashaExt'] = $dir . 'WikiBhashaExtClass.php'; |
| 44 | +$wgAutoloadClasses['wikiBhasha'] = $dir . 'WikiBhashaSpecial.php'; |
45 | 45 | |
46 | | -//initilize wikiBhasha launch class |
| 46 | +// initilize wikiBhasha launch class |
47 | 47 | $wbExtClass = new wikiBhashaExt(); |
48 | 48 | |
49 | | -$wgAutoloadClasses['wikibhasha'] = $dir . 'wikibhasha_body.php'; # Location of the wikibhasha class (Tell MediaWiki to load this file) |
50 | | -$wgExtensionMessagesFiles['wikibhasha'] = $dir . 'wikibhasha.i18n.php'; # Location of a messages file (Tell MediaWiki to load this file) |
51 | | -$wgHooks['MonoBookTemplateToolboxEnd'][] = array( $wbExtClass, 'wikiBhashaToolbox' ); |
| 49 | +$wgAutoloadClasses['wikibhasha'] = $dir . 'WikiBhasha_body.php'; # Location of the wikibhasha class (Tell MediaWiki to load this file) |
| 50 | +$wgExtensionMessagesFiles['WikiBhasha'] = $dir . 'WikiBhasha.i18n.php'; # Location of a messages file (Tell MediaWiki to load this file) |
| 51 | +$wgExtensionAliasesFiles['WikiBhasha'] = $dir . 'WikiBhasha.alias.php'; # Location of a messages file (Tell MediaWiki to load this file) |
| 52 | + |
| 53 | +$wgHooks['MonoBookTemplateToolboxEnd'][] = array( $wbExtClass, 'wikiBhashaToolbox' ); |
52 | 54 | $wgHooks['BeforePageDisplay'][] = array( $wbExtClass, 'wbToolbarIcon' ); |
53 | | - |
54 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/WikiBhasha/wikiBhashaSpecial.php |
— | — | @@ -1,19 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Special:Gadgets, provides a preview of MediaWiki:Gadgets. |
| 4 | + * Special:WikiBhasha |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup SpecialPage |
8 | | - * @author Daniel Kinzler, brightbyte.de |
9 | | - * @copyright © 2007 Daniel Kinzler |
10 | | - * @license GNU General Public License 2.0 or later |
11 | 8 | */ |
12 | 9 | |
13 | | -if( !defined( 'MEDIAWIKI' ) ) { |
14 | | - echo( "not a valid entry point.\n" ); |
15 | | - die( 1 ); |
16 | | -} |
17 | | - |
18 | 10 | /** |
19 | 11 | * |
20 | 12 | */ |
— | — | @@ -33,8 +25,6 @@ |
34 | 26 | function execute( $par ) { |
35 | 27 | global $wgRequest, $wgOut; |
36 | 28 | $this->setHeaders(); |
37 | | - $wgOut->addHTML('<h2>message goes here</h2>'); |
| 29 | + $wgOut->addHTML( '<h2>message goes here</h2>' ); |
38 | 30 | } |
39 | | - |
40 | 31 | } |
41 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/WikiBhasha/wikiBhashaExtClass.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | ********************************************************/ |
8 | 8 | |
9 | 9 | /* |
10 | | -Copyright (c) 2010, Microsoft |
| 10 | +Copyright (c) 2010, Microsoft |
11 | 11 | All rights reserved. |
12 | 12 | */ |
13 | 13 | |
— | — | @@ -20,41 +20,38 @@ |
21 | 21 | // icon to the toolbar for launching WikiBhasha. |
22 | 22 | // 2. inserts a "WikiBhasha" option in the left side toolbox menu. |
23 | 23 | // 3. Looks for "wbAutoLaunch=true" in the URL and launch WikiBhasha. |
24 | | - |
25 | | - |
26 | | -class wikiBhashaExt{ |
| 24 | +class wikiBhashaExt { |
27 | 25 | private $url, $wikiBhashaUrl; |
28 | 26 | function __construct() { |
29 | 27 | global $jsPath; |
30 | 28 | $this->url = $jsPath; |
31 | | - $this->wikiBhashaUrl = 'if(!(document.getElementById("wbBlockParentUI"))){this.baseUrl ="'.$this->url.'";this.targetLanguageCode="en";this.wikiSourceLanguage=typeof(wgUserLanguage)!=="undefined"?wgUserLanguage:"en";wbBookMarkletLinkDiv=document.createElement("div");wbBookMarkletLinkDiv.id="wbLoadDiv";wbBookMarkletLinkDiv.innerHTML="<div style=\"background-color:Black;color:#FFFFFF;position:absolute;text-align:center;font-size:13px;font-weight:bold;left:0px;top:0px;padding:10px 0;z-index:1000;width:100%;border-bottom:3px solid gray;\">Loading...</div>";document.body.appendChild(wbBookMarkletLinkDiv);wbBookMarkletScripts=document.createElement("script");wbBookMarkletScripts.setAttribute("src", "'.$this->url.'js/main.js");document.body.appendChild(wbBookMarkletScripts);}'; |
| 29 | + $this->wikiBhashaUrl = 'if(!(document.getElementById("wbBlockParentUI"))){this.baseUrl ="' . $this->url . '";this.targetLanguageCode="en";this.wikiSourceLanguage=typeof(wgUserLanguage)!=="undefined"?wgUserLanguage:"en";wbBookMarkletLinkDiv=document.createElement("div");wbBookMarkletLinkDiv.id="wbLoadDiv";wbBookMarkletLinkDiv.innerHTML="<div style=\"background-color:Black;color:#FFFFFF;position:absolute;text-align:center;font-size:13px;font-weight:bold;left:0px;top:0px;padding:10px 0;z-index:1000;width:100%;border-bottom:3px solid gray;\">Loading...</div>";document.body.appendChild(wbBookMarkletLinkDiv);wbBookMarkletScripts=document.createElement("script");wbBookMarkletScripts.setAttribute("src", "' . $this->url . 'js/main.js");document.body.appendChild(wbBookMarkletScripts);}'; |
32 | 30 | } |
33 | 31 | |
34 | | - //add wikibhasha link to the wikipedia left bar toolbar box |
| 32 | + // add wikibhasha link to the wikipedia left bar toolbar box |
35 | 33 | public function wikiBhashaToolbox( &$monobook ) { |
36 | 34 | echo "<li><a href='javascript:void(0);' style='color: rgb(0, 36, 255);' onclick='(function(){" . $this->wikiBhashaUrl . "})()' id='wbInstallLinkff'>" . wfMsg( 'wikiBhashaLink' ) . "</a></li>"; |
37 | 35 | return true; |
38 | 36 | } |
39 | | - |
40 | | - //create wikipedia edite page toolbar icon on the edit pages for wikibhasha |
| 37 | + |
| 38 | + // create wikipedia edite page toolbar icon on the edit pages for wikibhasha |
41 | 39 | public function wbToolbarIcon( &$out, &$sk ) { |
42 | 40 | global $wgRequest; |
43 | 41 | $jsAutoLoad = ''; |
44 | 42 | $jsIconScript = ''; |
45 | | - if( $wgRequest->getText( 'action' ) == 'edit' ){ |
46 | | - $imgUrl = $this->url.'images/Square.png'; |
| 43 | + if ( $wgRequest->getText( 'action' ) == 'edit' ) { |
| 44 | + $imgUrl = $this->url . 'images/Square.png'; |
47 | 45 | $jsWBIconScript = " var wbIcon = document.createElement('a'); wbIcon.title = '" . wfMsg( 'wikiBhashaLink' ) . "';wbIcon.href='javascript:(function(){" . addslashes( $this->wikiBhashaUrl ) . "})()'; wbIcon.innerHTML = '<img src=\'" . $imgUrl . "\'>';"; |
48 | 46 | $jsIconScript = $jsWBIconScript . "if(document.getElementById('toolbar')){ var toolbar = document.getElementById('toolbar'); if(toolbar.firstChild) toolbar.appendChild(wbIcon);}"; |
49 | 47 | $jsIconScript .= "if(document.getElementById('wikiEditor-ui-toolbar')){wbIconGroupDiv = document.createElement('div');wbIconGroupDiv.setAttribute('class', 'group group-format');wbIconGroupDiv.appendChild(wbIcon);var toolbar = document.getElementById('wikiEditor-ui-toolbar');if(toolbar.firstChild)toolbar.firstChild.appendChild(wbIconGroupDiv);}"; |
50 | | - |
| 48 | + |
51 | 49 | } |
52 | | - //if the url contain wbAutoLaunch as true launch wikibhasha |
53 | | - if( $wgRequest->getText( 'wbAutoLaunch' ) == "true" ){ |
| 50 | + // if the url contain wbAutoLaunch as true launch wikibhasha |
| 51 | + if ( $wgRequest->getText( 'wbAutoLaunch' ) == "true" ) { |
54 | 52 | $jsAutoLoad = $this->wikiBhashaUrl; |
55 | 53 | } |
56 | 54 | $out->addScript( "<script language='javascript'> window.onload = function(){" . $jsIconScript . $jsAutoLoad . "}</script>" ); |
57 | 55 | return true; |
58 | 56 | } |
59 | 57 | } |
60 | | -?> |
61 | 58 | |
Index: trunk/extensions/WikiBhasha/wikibhasha.alias.php |
— | — | @@ -1,13 +1,12 @@ |
2 | 2 | <?php |
3 | | -$aliases = array(); |
4 | | - |
5 | | -/** English */ |
6 | | -$aliases['en'] = array( |
7 | | - 'wikibhasha' => array( 'Wikibhasha' ), |
| 3 | + |
| 4 | +$specialPageAliases = array(); |
| 5 | + |
| 6 | +$specialPageAliases['en'] = array( |
| 7 | + 'WikiBhasha' => array( 'WikiBhasha' ), |
8 | 8 | ); |
9 | | - |
10 | | -/** German (Deutsch) */ |
11 | | -$aliases['de'] = array( |
12 | | - 'wikibhasha' => array( 'MeineErweiterung', 'Meine Erweiterung' ), |
13 | | -); |
14 | | -?> |
\ No newline at end of file |
| 9 | + |
| 10 | +/** |
| 11 | + * For backwards compatibility with MediaWiki 1.15 and earlier. |
| 12 | + */ |
| 13 | +$aliases =& $specialPageAliases; |
Index: trunk/extensions/WikiBhasha/README.txt |
— | — | @@ -1,7 +1,11 @@ |
2 | | -This directory contains the Javascript and PHP sources and other resources for the WikiBhasha (Beta) extension that is being open sourced by Microsoft Research. WikiBhasha (Beta) is a being open-sourced as a MediaWiki Extension, with the Javascript portions under Apache License 2.0 and the PHP portions under Gnu GPL License 2.0. We plan to work with the community to go thorugh the review process to make this available as an extension. |
| 2 | +This directory contains the Javascript and PHP sources and other resources for |
| 3 | +the WikiBhasha (Beta) extension that is being open sourced by Microsoft |
| 4 | +Research. WikiBhasha (Beta) is a being open-sourced as a MediaWiki Extension, |
| 5 | +with the JavaScript portions under Apache License 2.0 and the PHP portions under |
| 6 | +GNU GPL License 2.0. We plan to work with the community to go through the |
| 7 | +review process to make this available as an extension. |
3 | 8 | |
4 | | -WikiBhasha is aimed at enabling user communities in creating multilingual content in Wikipedia. |
| 9 | +WikiBhasha is aimed at enabling user communities in creating multilingual |
| 10 | +content in Wikipedia. |
5 | 11 | |
6 | 12 | -- WikiBhasha team (17 October 2010) |
7 | | - |
8 | | - |
Index: trunk/extensions/WikiBhasha/wikibhasha_body.php |
— | — | @@ -1,22 +1,21 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | class wikibhasha extends SpecialPage { |
4 | 5 | function __construct() { |
5 | 6 | parent::__construct( 'Wikibhasha' ); |
6 | | - wfLoadExtensionMessages('Wikibhasha'); |
7 | 7 | } |
8 | | - |
| 8 | + |
9 | 9 | function execute( $par ) { |
10 | 10 | global $wgRequest, $wgOut; |
11 | | - |
| 11 | + |
12 | 12 | $this->setHeaders(); |
13 | | - |
| 13 | + |
14 | 14 | # Get request data from, e.g. |
15 | | - $param = $wgRequest->getText('param'); |
16 | | - |
| 15 | + $param = $wgRequest->getText( 'param' ); |
| 16 | + |
17 | 17 | # Do stuff |
18 | 18 | # ... |
19 | | - $output="WikiBhasha"; |
| 19 | + $output = "WikiBhasha"; |
20 | 20 | $wgOut->addWikiText( $output ); |
21 | 21 | } |
22 | 22 | } |
23 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/WikiBhasha/wikibhasha.i18n.php |
— | — | @@ -1,17 +1,21 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | $messages = array(); |
4 | | - |
5 | | -/* *** English *** */ |
| 5 | + |
| 6 | +/** |
| 7 | + * English |
| 8 | + */ |
6 | 9 | $messages['en'] = array( |
7 | 10 | 'wikibhasha' => 'WikiBhasha', |
8 | 11 | 'wikibhasha-desc' => "Extension's description", |
9 | | - 'wikiBhashaLink'=>'WikiBhasha(Beta)' |
| 12 | + 'wikiBhashaLink' => 'WikiBhasha(Beta)' |
10 | 13 | ); |
11 | | - |
12 | | -/* *** German (Deutsch) *** */ |
| 14 | + |
| 15 | +/** |
| 16 | + * German (Deutsch) |
| 17 | + */ |
13 | 18 | $messages['de'] = array( |
14 | 19 | 'wikibhasha' => 'WikiBhasha', |
15 | 20 | 'wikibhasha-desc' => 'Beschreibung der Erweiterung', |
16 | | - 'wikiBhashaLink'=>'WikiBhasha(Beta)' |
| 21 | + 'wikiBhashaLink' => 'WikiBhasha(Beta)' |
17 | 22 | ); |
18 | | -?> |
\ No newline at end of file |