Permalink
Browse files

innitial import

git-svn-id: http://www.kaltura.org/kalorg/html5video/trunk/mwEmbed@544 b58a29cf-3064-46da-94c6-1c29cc75c8e5
  • Loading branch information...
0 parents commit d748bfc8a23030c03b7fffe83781a5ba791483a2 @KalturaGitBot KalturaGitBot committed May 20, 2010
Showing with 34,504 additions and 0 deletions.
  1. +22 −0 .project
  2. +34 −0 README
  3. BIN includes/cache/4/4c/4c7d9a0165c2c2c82ea2f21814a14307.js.gz
  4. +10 −0 includes/cache/README
  5. BIN includes/cache/a/a8/a8f0a455036cd3f6e015cec28d34aff4.js.gz
  6. BIN includes/cache/b/bb/bbdf18d80ddcbf402d756d7df73e9542.js.gz
  7. BIN includes/cache/c/c1/c1fd3c2649db598c87fb320140b3d169.js.gz
  8. BIN includes/cache/c/cc/cc9ea2703d05f63d30aa184801cb2992.js.gz
  9. BIN includes/cache/e/e5/e58861e2d547be5a5f168851f3c16247.js.gz
  10. BIN includes/cache/f/f0/f009fb1da183e420ca75c2605b9dc857.js.gz
  11. BIN includes/cache/f/fb/fb5b645ec3f7cd11c9d83aa784fbcd77.js.gz
  12. +304 −0 includes/jsClassLoader.php
  13. +80 −0 includes/library/CSS.php
  14. +250 −0 includes/library/CSS/Compressor.php
  15. +270 −0 includes/library/CSS/UriRewriter.php
  16. +90 −0 includes/library/CommentPreserver.php
  17. +289 −0 includes/library/JSMin.php
  18. +57 −0 includes/maintenance/clearMwEmbedVars.php
  19. +238 −0 includes/maintenance/mergeJavascriptMsg.php
  20. +93 −0 includes/maintenance/moveMsgToModule.php
  21. +264 −0 includes/noMediaWikiConfig.php
  22. +1,197 −0 jsScriptLoader.php
  23. +10 −0 languages/README
  24. +10 −0 languages/classes/LanguageAm.js
  25. +40 −0 languages/classes/LanguageAr.js
  26. +22 −0 languages/classes/LanguageBat_smg.js
  27. +33 −0 languages/classes/LanguageBe.js
  28. +40 −0 languages/classes/LanguageBe_tarask.js
  29. +14 −0 languages/classes/LanguageBh.js
  30. +23 −0 languages/classes/LanguageBs.js
  31. +29 −0 languages/classes/LanguageCs.js
  32. +20 −0 languages/classes/LanguageCu.js
  33. +22 −0 languages/classes/LanguageCy.js
  34. +20 −0 languages/classes/LanguageDsb.js
  35. +14 −0 languages/classes/LanguageFr.js
  36. +22 −0 languages/classes/LanguageGa.js
  37. +33 −0 languages/classes/LanguageGd.js
  38. +25 −0 languages/classes/LanguageGv.js
  39. +34 −0 languages/classes/LanguageHe.js
  40. +14 −0 languages/classes/LanguageHi.js
  41. +25 −0 languages/classes/LanguageHr.js
  42. +18 −0 languages/classes/LanguageHsb.js
  43. +15 −0 languages/classes/LanguageHy.js
  44. +24 −0 languages/classes/LanguageKsh.js
  45. +16 −0 languages/classes/LanguageLn.js
  46. +30 −0 languages/classes/LanguageLt.js
  47. +31 −0 languages/classes/LanguageLv.js
  48. +14 −0 languages/classes/LanguageMg.js
  49. +19 −0 languages/classes/LanguageMk.js
  50. +21 −0 languages/classes/LanguageMo.js
  51. +24 −0 languages/classes/LanguageMt.js
  52. +14 −0 languages/classes/LanguageNso.js
  53. +22 −0 languages/classes/LanguagePl.js
  54. +15 −0 languages/classes/LanguagePt_br.js
  55. +21 −0 languages/classes/LanguageRo.js
  56. +48 −0 languages/classes/LanguageRu.js
  57. +21 −0 languages/classes/LanguageSe.js
  58. +27 −0 languages/classes/LanguageSh.js
  59. +19 −0 languages/classes/LanguageSk.js
  60. +24 −0 languages/classes/LanguageSl.js
  61. +21 −0 languages/classes/LanguageSma.js
  62. +24 −0 languages/classes/LanguageSr.js
  63. +18 −0 languages/classes/LanguageSr_ec.js
  64. +24 −0 languages/classes/LanguageSr_el.js
  65. +14 −0 languages/classes/LanguageTi.js
  66. +14 −0 languages/classes/LanguageTl.js
  67. +29 −0 languages/classes/LanguageUk.js
  68. +16 −0 languages/classes/LanguageWa.js
  69. +1,008 −0 languages/mw.Language.js
  70. +6,244 −0 libraries/jquery/jquery-1.4.2.js
  71. +30 −0 libraries/jquery/jquery.ui/AUTHORS.txt
  72. +278 −0 libraries/jquery/jquery.ui/GPL-LICENSE.txt
  73. +25 −0 libraries/jquery/jquery.ui/MIT-LICENSE.txt
  74. +20 −0 libraries/jquery/jquery.ui/external/bgiframe/ChangeLog.txt
  75. +32 −0 libraries/jquery/jquery.ui/external/bgiframe/META.json
  76. +7 −0 libraries/jquery/jquery.ui/external/bgiframe/docs/fonts-min.css
  77. +113 −0 libraries/jquery/jquery.ui/external/bgiframe/docs/index.html
  78. +7 −0 libraries/jquery/jquery.ui/external/bgiframe/docs/reset-min.css
  79. +100 −0 libraries/jquery/jquery.ui/external/bgiframe/jquery.bgiframe.js
  80. +10 −0 libraries/jquery/jquery.ui/external/bgiframe/jquery.bgiframe.min.js
  81. +10 −0 libraries/jquery/jquery.ui/external/bgiframe/jquery.bgiframe.pack.js
  82. +197 −0 libraries/jquery/jquery.ui/external/bgiframe/test/index.html
  83. +10 −0 libraries/jquery/jquery.ui/external/cookie/jquery.cookie.min.js
  84. +10 −0 libraries/jquery/jquery.ui/external/cookie/jquery.cookie.pack.js
  85. BIN libraries/jquery/jquery.ui/external/cookie/jquery.cookie.zip
  86. +159 −0 libraries/jquery/jquery.ui/external/jsdiff/jsdiff.js
  87. +780 −0 libraries/jquery/jquery.ui/external/qunit/testrunner.js
  88. +120 −0 libraries/jquery/jquery.ui/external/qunit/testsuite.css
  89. +152 −0 libraries/jquery/jquery.ui/external/simulate/jquery.simulate.js
  90. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_diagonals-thick_20_666666_40x40.png
  91. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  92. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  93. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  94. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  95. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  96. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_glass_75_ffffff_1x400.png
  97. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  98. BIN libraries/jquery/jquery.ui/themes/base/images/ui-bg_inset-soft_95_fef1ec_1x100.png
  99. BIN libraries/jquery/jquery.ui/themes/base/images/ui-icons_222222_256x240.png
  100. BIN libraries/jquery/jquery.ui/themes/base/images/ui-icons_2e83ff_256x240.png
  101. BIN libraries/jquery/jquery.ui/themes/base/images/ui-icons_454545_256x240.png
  102. BIN libraries/jquery/jquery.ui/themes/base/images/ui-icons_888888_256x240.png
  103. BIN libraries/jquery/jquery.ui/themes/base/images/ui-icons_cd0a0a_256x240.png
  104. +287 −0 libraries/jquery/jquery.ui/themes/base/jquery-ui-1.7.1.custom.css
  105. +9 −0 libraries/jquery/jquery.ui/themes/base/ui.accordion.css
  106. +2 −0 libraries/jquery/jquery.ui/themes/base/ui.all.css
  107. +8 −0 libraries/jquery/jquery.ui/themes/base/ui.base.css
  108. +37 −0 libraries/jquery/jquery.ui/themes/base/ui.core.css
  109. +62 −0 libraries/jquery/jquery.ui/themes/base/ui.datepicker.css
  110. +13 −0 libraries/jquery/jquery.ui/themes/base/ui.dialog.css
  111. +4 −0 libraries/jquery/jquery.ui/themes/base/ui.progressbar.css
  112. +13 −0 libraries/jquery/jquery.ui/themes/base/ui.resizable.css
  113. +17 −0 libraries/jquery/jquery.ui/themes/base/ui.slider.css
  114. +11 −0 libraries/jquery/jquery.ui/themes/base/ui.tabs.css
  115. +243 −0 libraries/jquery/jquery.ui/themes/base/ui.theme.css
  116. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png
  117. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_flat_55_fbec88_40x100.png
  118. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png
  119. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png
  120. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_glass_95_fef1ec_1x400.png
  121. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png
  122. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png
  123. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png
  124. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-icons_217bc0_256x240.png
  125. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-icons_2e83ff_256x240.png
  126. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-icons_469bdd_256x240.png
  127. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-icons_6da8d5_256x240.png
  128. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-icons_cd0a0a_256x240.png
  129. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-icons_d8e7f3_256x240.png
  130. BIN libraries/jquery/jquery.ui/themes/redmond/images/ui-icons_f9bd01_256x240.png
  131. +404 −0 libraries/jquery/jquery.ui/themes/redmond/jquery-ui-1.7.1.custom.css
  132. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_diagonals-thick_20_666666_40x40.png
  133. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
  134. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
  135. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
  136. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
  137. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png
  138. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
  139. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
  140. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  141. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-icons_222222_256x240.png
  142. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png
  143. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-icons_454545_256x240.png
  144. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-icons_888888_256x240.png
  145. BIN libraries/jquery/jquery.ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png
  146. +404 −0 libraries/jquery/jquery.ui/themes/smoothness/jquery-ui-1.7.1.custom.css
  147. +9 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.accordion.css
  148. +2 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.all.css
  149. +8 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.base.css
  150. +37 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.core.css
  151. +62 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.datepicker.css
  152. +13 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.dialog.css
  153. +4 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.progressbar.css
  154. +13 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.resizable.css
  155. +17 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.slider.css
  156. +11 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.tabs.css
  157. +245 −0 libraries/jquery/jquery.ui/themes/smoothness/ui.theme.css
  158. +49 −0 libraries/jquery/jquery.ui/ui/effects.blind.js
  159. +78 −0 libraries/jquery/jquery.ui/ui/effects.bounce.js
  160. +54 −0 libraries/jquery/jquery.ui/ui/effects.clip.js
  161. +543 −0 libraries/jquery/jquery.ui/ui/effects.core.js
  162. +50 −0 libraries/jquery/jquery.ui/ui/effects.drop.js
  163. +79 −0 libraries/jquery/jquery.ui/ui/effects.explode.js
  164. +56 −0 libraries/jquery/jquery.ui/ui/effects.fold.js
  165. +48 −0 libraries/jquery/jquery.ui/ui/effects.highlight.js
  166. +56 −0 libraries/jquery/jquery.ui/ui/effects.pulsate.js
  167. +180 −0 libraries/jquery/jquery.ui/ui/effects.scale.js
  168. +57 −0 libraries/jquery/jquery.ui/ui/effects.shake.js
  169. +50 −0 libraries/jquery/jquery.ui/ui/effects.slide.js
  170. +45 −0 libraries/jquery/jquery.ui/ui/effects.transfer.js
  171. +771 −0 libraries/jquery/jquery.ui/ui/i18n/jquery-ui-i18n.js
  172. +20 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-ar.js
  173. +20 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-bg.js
  174. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-ca.js
  175. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-cs.js
  176. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-da.js
  177. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-de.js
  178. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-el.js
  179. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-eo.js
  180. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-es.js
  181. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-fa.js
  182. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-fi.js
  183. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-fr.js
  184. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-he.js
  185. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-hr.js
  186. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-hu.js
  187. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-hy.js
  188. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-id.js
  189. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-is.js
  190. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-it.js
  191. +20 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-ja.js
  192. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-ko.js
  193. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-lt.js
  194. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-lv.js
  195. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-ms.js
  196. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-nl.js
  197. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-no.js
  198. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-pl.js
  199. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-pt-BR.js
  200. +22 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-ro.js
  201. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-ru.js
  202. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-sk.js
  203. +20 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-sl.js
  204. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-sq.js
  205. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-sr-SR.js
  206. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-sr.js
  207. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-sv.js
  208. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-th.js
  209. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-tr.js
  210. +25 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-uk.js
  211. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-zh-CN.js
  212. +19 −0 libraries/jquery/jquery.ui/ui/i18n/ui.datepicker-zh-TW.js
  213. +9,074 −0 libraries/jquery/jquery.ui/ui/jquery-ui-1.7.1.custom.js
  214. +477 −0 libraries/jquery/jquery.ui/ui/ui.accordion.js
  215. +519 −0 libraries/jquery/jquery.ui/ui/ui.core.js
  216. +1,630 −0 libraries/jquery/jquery.ui/ui/ui.datepicker.js
  217. +650 −0 libraries/jquery/jquery.ui/ui/ui.dialog.js
  218. +766 −0 libraries/jquery/jquery.ui/ui/ui.draggable.js
  219. +282 −0 libraries/jquery/jquery.ui/ui/ui.droppable.js
  220. +112 −0 libraries/jquery/jquery.ui/ui/ui.progressbar.js
  221. +800 −0 libraries/jquery/jquery.ui/ui/ui.resizable.js
  222. +257 −0 libraries/jquery/jquery.ui/ui/ui.selectable.js
  223. +532 −0 libraries/jquery/jquery.ui/ui/ui.slider.js
  224. +1,019 −0 libraries/jquery/jquery.ui/ui/ui.sortable.js
Sorry, we could not display the entire diff because too many files (714) changed.
22 .project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>mwEmbedStandAlone</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.php.core.ValidationManagerWrapper</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.php.core.PHPNature</nature>
+ </natures>
+</projectDescription>
34 README
@@ -0,0 +1,34 @@
+***********************************************
+*
+* mwEmbed version 1.1
+*
+* For an overview of all mwEmbed files see:
+* http://www.mediawiki.org/wiki/MwEmbed
+*
+* For stand alone usage see:
+* http://kaltura.org/project/HTML5_Media_JavaScript_Library
+*
+* All mwEmbed code is Released under the GPL2 as
+* a stand alone component of mediaWiki
+*
+* Libraries used include their licence info in their included path
+*
+* Copyright (C) 2007 - 2010 Michael Dale <mdale@wikimedia.org>,
+* and many others.
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program; if not, write to the Free Software Foundation, Inc.,
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+* http://www.gnu.org/copyleft/gpl.html
+*
+*********************************************
BIN includes/cache/4/4c/4c7d9a0165c2c2c82ea2f21814a14307.js.gz
Binary file not shown.
10 includes/cache/README
@@ -0,0 +1,10 @@
+This folder holds cached versions of grouped script requests
+
+Be sure to enable write access by your web-server to this directory.
+
+You can empty this directory at any time and should not be a problem.
+
+
+For convenience in releases I include embedPlayerAll.min.js for performance
+static version deployment where you might not have php available.
+
BIN includes/cache/a/a8/a8f0a455036cd3f6e015cec28d34aff4.js.gz
Binary file not shown.
BIN includes/cache/b/bb/bbdf18d80ddcbf402d756d7df73e9542.js.gz
Binary file not shown.
BIN includes/cache/c/c1/c1fd3c2649db598c87fb320140b3d169.js.gz
Binary file not shown.
BIN includes/cache/c/cc/cc9ea2703d05f63d30aa184801cb2992.js.gz
Binary file not shown.
BIN includes/cache/e/e5/e58861e2d547be5a5f168851f3c16247.js.gz
Binary file not shown.
BIN includes/cache/f/f0/f009fb1da183e420ca75c2605b9dc857.js.gz
Binary file not shown.
BIN includes/cache/f/fb/fb5b645ec3f7cd11c9d83aa784fbcd77.js.gz
Binary file not shown.
304 includes/jsClassLoader.php
@@ -0,0 +1,304 @@
+<?php
+/**
+ * The javascript class loader handles loading lists of available
+ * javascript classes into php from their defined locations in javascript.
+ */
+
+if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
+
+class jsClassLoader {
+ // The list of mwEmbed core components that make up the base mwEmbed class
+ private static $coreComponentsList = array();
+
+ // The list of mwEmbed modules that are enabled
+ private static $moduleList = array();
+
+ // Stores the contents of the combined loader.js files
+ private static $combinedLoadersJs = '';
+
+ // Reg Exp that supports extracting classes from loaders
+ private static $classReplaceExp = '/mw\.addClassFilePaths\s*\(\s*{(.*)}\s*\)\s*\;/siU';
+
+ // Flag to specify if the javascript class paths have been loaded.
+ private static $classesLoaded = false;
+
+ // The current directory context. Used in loading javascript modules outside of the mwEmbed folder
+ private static $directoryContext = '';
+
+ // Stores class parent moduleName
+ private static $classParentModuleName = array();
+
+ // The current module name used for callback functions in regular expressions
+ private static $currentModuleName = '';
+
+ /**
+ * Get the javascript class paths from javascript files
+ */
+ public static function loadClassPaths(){
+ global $wgMwEmbedDirectory, $wgExtensionJavascriptModules,
+ $wgScriptLoaderNamedPaths, $wgExtensionMessagesFiles, $IP;
+
+ // Only run once
+ if( self::$classesLoaded ) {
+ return false;
+ }
+ self::$classesLoaded = true;
+
+ // Start the profiler if running
+ $fname = 'jsClassLoader::loadClassPaths';
+ wfProfileIn( $fname );
+
+
+ $mwEmbedAbsolutePath = ( $wgMwEmbedDirectory == '' ) ? $IP : $IP .'/' .$wgMwEmbedDirectory;
+ // Add the mwEmbed localizations
+ $wgExtensionMessagesFiles[ 'mwEmbed' ] = $mwEmbedAbsolutePath . '/mwEmbed.i18n.php';
+
+
+ // Load javascript classes from mwEmbed.js
+ if ( !is_file( $mwEmbedAbsolutePath . '/loader.js' ) ) {
+ // throw error no mwEmbed found
+ throw new MWException( "mwEmbed loader.js missing check \$wgMwEmbedDirectory path\n" );
+ return false;
+ }
+
+ // Proccess the mwEmbed loader file:
+ $fileContent = file_get_contents( $mwEmbedAbsolutePath . '/loader.js' );
+ self::$directoryContext = $wgMwEmbedDirectory;
+ self::proccessLoaderContent( $fileContent , 'mwEmbed' );
+
+ // Get the list of core component into self::$coreComponentsList
+ preg_replace_callback(
+ '/mwCoreComponentList\s*\=\s*\[(.*)\]/siU',
+ 'jsClassLoader::preg_buildComponentList',
+ $fileContent
+ );
+
+ // Get the list of enabled modules into $moduleList
+ preg_replace_callback(
+ '/mwEnabledModuleList\s*\=\s*\[(.*)\]/siU',
+ 'jsClassLoader::preg_buildModuleList',
+ $fileContent
+ );
+
+ // Change to the root mediawiki directory ( loader.js paths are relative to root mediawiki directory )
+ // ( helpful for when running maintenance scripts )
+ if( defined( 'DO_MAINTENANCE' ) ) {
+ $initialPath = getcwd();
+ chdir( $IP );
+ }
+
+ // Get all the classes from the enabled mwEmbed modules folder
+ foreach( self::$moduleList as $na => $moduleName){
+ $relativeSlash = ( $wgMwEmbedDirectory == '' )? '' : '/';
+ $modulePath = $wgMwEmbedDirectory . $relativeSlash . 'modules/' . $moduleName;
+ self::proccessModulePath( $moduleName, $modulePath );
+ }
+
+ // Get all the extension loader paths registered mwEmbed modules
+ foreach( $wgExtensionJavascriptModules as $moduleName => $modulePath ){
+ self::proccessModulePath( $moduleName, $modulePath );
+ }
+
+ if( defined( 'DO_MAINTENANCE' ) ) {
+ chdir( $initialPath );
+ }
+
+ wfProfileOut( $fname );
+ }
+ /**
+ * Process a loader path, passes off to proccessLoaderContent
+ *
+ * @param String $moduleName Name of module to be processed
+ * @param String $modulePath Path to module to be processed
+ */
+ private static function proccessModulePath( $moduleName, $modulePath ){
+ global $wgExtensionMessagesFiles;
+
+ // Get the module name
+ $moduleName = end( explode('/', $modulePath ) );
+
+ // Set the directory context for relative js/css paths
+ self::$directoryContext = $modulePath;
+
+ // Check for the loader.js
+ if( !is_file( $modulePath . '/loader.js' ) ){
+ throw new MWException( "Javascript Module $moduleName missing loader.js file\n" );
+ return false;
+ }
+
+ $fileContent = file_get_contents( $modulePath . '/loader.js');
+ self::proccessLoaderContent( $fileContent, $moduleName );
+
+ $i18nPath = realpath( $modulePath . '/' . $moduleName . '.i18n.php' );
+
+ // Add the module localization file if present:
+ if( is_file( $i18nPath ) ) {
+ $wgExtensionMessagesFiles[ $moduleName ] = $i18nPath;
+ } else {
+ // Module has no message file
+ }
+ }
+
+ /**
+ * Process loader content
+ *
+ * parses the loader files and adds
+ *
+ * @param String $fileContent content of loader.js file
+ */
+ private static function proccessLoaderContent( & $fileContent , $moduleName){
+ // Add the mwEmbed loader js to its global collector:
+ self::$combinedLoadersJs .= $fileContent;
+
+ // Is there a way to pass arguments in preg_replace_callback ?
+ self::$currentModuleName = $moduleName;
+
+ // Run the replace callback:
+ preg_replace_callback(
+ self::$classReplaceExp,
+ 'jsClassLoader::preg_classPathLoader',
+ $fileContent
+ );
+ }
+ /**
+ * Get the language file javascript
+ * @param String $languageJs The language file javascript
+ */
+ public static function getLanguageJs( $langKey = 'en' ){
+ global $wgMwEmbedDirectory;
+ $path = $wgMwEmbedDirectory . '/languages/classes/Language' . ucfirst( $langKey ) . '.js';
+ if( is_file( $path ) ){
+ $languageJs = file_get_contents( $path );
+ return $languageJs;
+ }
+ return '';
+ }
+
+ /**
+ * Get the combined loader javascript
+ *
+ * @return the combined loader jss
+ */
+ public static function getCombinedLoaderJs(){
+ self::loadClassPaths();
+ return self::$combinedLoadersJs;
+ }
+
+ /**
+ * Get the list of enabled modules
+ */
+ public static function getModuleList(){
+ self::loadClassPaths();
+ return self::$moduleList;
+ }
+
+ /**
+ * Get the list of enabled components
+ */
+ public static function getComponentsList(){
+ self::loadClassPaths();
+ return self::$coreComponentsList;
+ }
+
+ /**
+ * Build a list of components to be included with mwEmbed
+ */
+ private static function preg_buildComponentList( $jsvar ){
+ if(! isset( $jsvar[1] )){
+ return false;
+ }
+ $componentSet = explode(',', $jsvar[1] );
+ foreach( $componentSet as $na => $componentName ) {
+ $componentName = str_replace( array( '../', '\'', '"'), '', trim( $componentName ));
+ // Add the component to the $coreComponentsList
+ if( trim( $componentName ) != '' ) {
+ array_push( self::$coreComponentsList, trim( $componentName ) );
+ }
+ }
+ }
+
+ /**
+ * Build the list of modules from the mwEnabledModuleList replace callback
+ * @param String $jsvar Coma delimited list of modules
+ */
+ private static function preg_buildModuleList( $jsvar ){
+ global $IP, $wgMwEmbedDirectory;
+ if(! isset( $jsvar[1] )){
+ return false;
+ }
+ $moduleSet = explode(',', $jsvar[1] );
+
+ $mwEmbedAbsolutePath = ( $wgMwEmbedDirectory == '' )? $IP: $IP .'/' .$wgMwEmbedDirectory;
+
+ foreach( $moduleSet as $na => $moduleName ){
+ // Skip empty module names
+ if(trim( $moduleName ) == '' ){
+ continue;
+ }
+ $moduleName = str_replace( array( '../', '\'', '"'), '', trim( $moduleName ));
+ // Check if there is there are module loader files
+ if( is_file( $mwEmbedAbsolutePath . '/modules/' . $moduleName . '/loader.js' )){
+ array_push( self::$moduleList, $moduleName );
+ } else {
+ // Not valid module ( missing loader.js )
+ throw new MWException( "Missing module: $moduleName \n" );
+ }
+ }
+ }
+ /**
+ * Adds javascript autoloader class names and paths
+ * to $wgScriptLoaderNamedPaths global
+ *
+ * @param string $jvar Json string with class name list
+ */
+ private static function preg_classPathLoader( $jsvar ) {
+ global $wgScriptLoaderNamedPaths;
+ if ( !isset( $jsvar[1] ) ) {
+ return false;
+ }
+
+ $jClassSet = FormatJson::decode( '{' . $jsvar[1] . '}', true );
+ // Check for null json decode:
+ if( $jClassSet == NULL ){
+ return false;
+ }
+
+ foreach ( $jClassSet as $className => $classPath ) {
+ // Strip $ from class (as they are stripped on URL request parameter input)
+ $className = str_replace( '$', '', $className );
+ $classPath = ( self::$directoryContext == '' )? $classPath : self::$directoryContext . '/' . $classPath;
+
+ // Throw an error if we already have defined this class:
+ // This prevents a module from registering a shared class
+ // or multiple modules using the same className
+ if( isset( $wgScriptLoaderNamedPaths[ $className ] ) ){
+
+ // Presently extensions don't register were the named path parent module
+ // so we just have a gnneral extension error.
+ $setInModuleError = ( self::$classParentModuleName [ $className ] )
+ ? " set in module: " . self::$classParentModuleName [ $className ]
+ : " set in an extension ";
+
+ throw new MWException( "Error class $className already $setInModuleError \n" );
+ }
+
+ // Else update the global $wgScriptLoaderNamedPaths ( all scriptloader named paths )
+ $wgScriptLoaderNamedPaths[ $className ] = $classPath;
+
+ // Register the parent module ( javascript module specific )
+ self::$classParentModuleName [ $className ] = self::$currentModuleName ;
+ }
+ }
+ /**
+ * Return the module name for a given class or false if not found
+ * @param $className Class to get the module for
+ */
+ public function getClassModuleName( $className ){
+ if( isset( self::$classParentModuleName [ $className ] ) ){
+ return self::$classParentModuleName [ $className ];
+ } else {
+ return false;
+ }
+ }
+}
+
80 includes/library/CSS.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Class Minify_CSS
+ * @package Minify
+ */
+
+/**
+ * Minify CSS
+ *
+ * This class uses Minify_CSS_Compressor and Minify_CSS_UriRewriter to
+ * minify CSS and rewrite relative URIs.
+ *
+ * @package Minify
+ * @author Stephen Clay <steve@mrclay.org>
+ * @author http://code.google.com/u/1stvamp/ (Issue 64 patch)
+ */
+class Minify_CSS {
+
+ /**
+ * Minify a CSS string
+ *
+ * @param string $css
+ *
+ * @param array $options available options:
+ *
+ * 'preserveComments': (default true) multi-line comments that begin
+ * with "/*!" will be preserved with newlines before and after to
+ * enhance readability.
+ *
+ * 'prependRelativePath': (default null) if given, this string will be
+ * prepended to all relative URIs in import/url declarations
+ *
+ * 'currentDir': (default null) if given, this is assumed to be the
+ * directory of the current CSS file. Using this, minify will rewrite
+ * all relative URIs in import/url declarations to correctly point to
+ * the desired files. For this to work, the files *must* exist and be
+ * visible by the PHP process.
+ *
+ * 'symlinks': (default = array()) If the CSS file is stored in
+ * a symlink-ed directory, provide an array of link paths to
+ * target paths, where the link paths are within the document root. Because
+ * paths need to be normalized for this to work, use "//" to substitute
+ * the doc root in the link paths (the array keys). E.g.:
+ * <code>
+ * array('//symlink' => '/real/target/path') // unix
+ * array('//static' => 'D:\\staticStorage') // Windows
+ * </code>
+ *
+ * @return string
+ */
+ public static function minify($css, $options = array())
+ {
+ if (isset($options['preserveComments'])
+ && !$options['preserveComments']) {
+ $css = Minify_CSS_Compressor::process($css, $options);
+ } else {
+ $css = Minify_CommentPreserver::process(
+ $css
+ ,array('Minify_CSS_Compressor', 'process')
+ ,array($options)
+ );
+ }
+ if (! isset($options['currentDir']) && ! isset($options['prependRelativePath'])) {
+ return $css;
+ }
+ if (isset($options['currentDir'])) {
+ return Minify_CSS_UriRewriter::rewrite(
+ $css
+ ,$options['currentDir']
+ ,isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT']
+ ,isset($options['symlinks']) ? $options['symlinks'] : array()
+ );
+ } else {
+ return Minify_CSS_UriRewriter::prepend(
+ $css
+ ,$options['prependRelativePath']
+ );
+ }
+ }
+}
250 includes/library/CSS/Compressor.php
@@ -0,0 +1,250 @@
+<?php
+/**
+ * Class Minify_CSS_Compressor
+ * @package Minify
+ */
+
+/**
+ * Compress CSS
+ *
+ * This is a heavy regex-based removal of whitespace, unnecessary
+ * comments and tokens, and some CSS value minimization, where practical.
+ * Many steps have been taken to avoid breaking comment-based hacks,
+ * including the ie5/mac filter (and its inversion), but expect tricky
+ * hacks involving comment tokens in 'content' value strings to break
+ * minimization badly. A test suite is available.
+ *
+ * @package Minify
+ * @author Stephen Clay <steve@mrclay.org>
+ * @author http://code.google.com/u/1stvamp/ (Issue 64 patch)
+ */
+class Minify_CSS_Compressor {
+
+ /**
+ * Minify a CSS string
+ *
+ * @param string $css
+ *
+ * @param array $options (currently ignored)
+ *
+ * @return string
+ */
+ public static function process($css, $options = array())
+ {
+ $obj = new Minify_CSS_Compressor($options);
+ return $obj->_process($css);
+ }
+
+ /**
+ * @var array options
+ */
+ protected $_options = null;
+
+ /**
+ * @var bool Are we "in" a hack?
+ *
+ * I.e. are some browsers targetted until the next comment?
+ */
+ protected $_inHack = false;
+
+
+ /**
+ * Constructor
+ *
+ * @param array $options (currently ignored)
+ *
+ * @return null
+ */
+ private function __construct($options) {
+ $this->_options = $options;
+ }
+
+ /**
+ * Minify a CSS string
+ *
+ * @param string $css
+ *
+ * @return string
+ */
+ protected function _process($css)
+ {
+ $css = str_replace("\r\n", "\n", $css);
+
+ // preserve empty comment after '>'
+ // http://www.webdevout.net/css-hacks#in_css-selectors
+ $css = preg_replace('@>/\\*\\s*\\*/@', '>/*keep*/', $css);
+
+ // preserve empty comment between property and value
+ // http://css-discuss.incutio.com/?page=BoxModelHack
+ $css = preg_replace('@/\\*\\s*\\*/\\s*:@', '/*keep*/:', $css);
+ $css = preg_replace('@:\\s*/\\*\\s*\\*/@', ':/*keep*/', $css);
+
+ // apply callback to all valid comments (and strip out surrounding ws
+ $css = preg_replace_callback('@\\s*/\\*([\\s\\S]*?)\\*/\\s*@'
+ ,array($this, '_commentCB'), $css);
+
+ // remove ws around { } and last semicolon in declaration block
+ $css = preg_replace('/\\s*{\\s*/', '{', $css);
+ $css = preg_replace('/;?\\s*}\\s*/', '}', $css);
+
+ // remove ws surrounding semicolons
+ $css = preg_replace('/\\s*;\\s*/', ';', $css);
+
+ // remove ws around urls
+ $css = preg_replace('/
+ url\\( # url(
+ \\s*
+ ([^\\)]+?) # 1 = the URL (really just a bunch of non right parenthesis)
+ \\s*
+ \\) # )
+ /x', 'url($1)', $css);
+
+ // remove ws between rules and colons
+ $css = preg_replace('/
+ \\s*
+ ([{;]) # 1 = beginning of block or rule separator
+ \\s*
+ ([\\*_]?[\\w\\-]+) # 2 = property (and maybe IE filter)
+ \\s*
+ :
+ \\s*
+ (\\b|[#\'"]) # 3 = first character of a value
+ /x', '$1$2:$3', $css);
+
+ // remove ws in selectors
+ $css = preg_replace_callback('/
+ (?: # non-capture
+ \\s*
+ [^~>+,\\s]+ # selector part
+ \\s*
+ [,>+~] # combinators
+ )+
+ \\s*
+ [^~>+,\\s]+ # selector part
+ { # open declaration block
+ /x'
+ ,array($this, '_selectorsCB'), $css);
+
+ // minimize hex colors
+ $css = preg_replace('/([^=])#([a-f\\d])\\2([a-f\\d])\\3([a-f\\d])\\4([\\s;\\}])/i'
+ , '$1#$2$3$4$5', $css);
+
+ // remove spaces between font families
+ $css = preg_replace_callback('/font-family:([^;}]+)([;}])/'
+ ,array($this, '_fontFamilyCB'), $css);
+
+ $css = preg_replace('/@import\\s+url/', '@import url', $css);
+
+ // replace any ws involving newlines with a single newline
+ $css = preg_replace('/[ \\t]*\\n+\\s*/', "\n", $css);
+
+ // separate common descendent selectors w/ newlines (to limit line lengths)
+ $css = preg_replace('/([\\w#\\.\\*]+)\\s+([\\w#\\.\\*]+){/', "$1\n$2{", $css);
+
+ // Use newline after 1st numeric value (to limit line lengths).
+ $css = preg_replace('/
+ ((?:padding|margin|border|outline):\\d+(?:px|em)?) # 1 = prop : 1st numeric value
+ \\s+
+ /x'
+ ,"$1\n", $css);
+
+ // prevent triggering IE6 bug: http://www.crankygeek.com/ie6pebug/
+ $css = preg_replace('/:first-l(etter|ine)\\{/', ':first-l$1 {', $css);
+
+ return trim($css);
+ }
+
+ /**
+ * Replace what looks like a set of selectors
+ *
+ * @param array $m regex matches
+ *
+ * @return string
+ */
+ protected function _selectorsCB($m)
+ {
+ // remove ws around the combinators
+ return preg_replace('/\\s*([,>+~])\\s*/', '$1', $m[0]);
+ }
+
+ /**
+ * Process a comment and return a replacement
+ *
+ * @param array $m regex matches
+ *
+ * @return string
+ */
+ protected function _commentCB($m)
+ {
+ $hasSurroundingWs = (trim($m[0]) !== $m[1]);
+ $m = $m[1];
+ // $m is the comment content w/o the surrounding tokens,
+ // but the return value will replace the entire comment.
+ if ($m === 'keep') {
+ return '/**/';
+ }
+ if ($m === '" "') {
+ // component of http://tantek.com/CSS/Examples/midpass.html
+ return '/*" "*/';
+ }
+ if (preg_match('@";\\}\\s*\\}/\\*\\s+@', $m)) {
+ // component of http://tantek.com/CSS/Examples/midpass.html
+ return '/*";}}/* */';
+ }
+ if ($this->_inHack) {
+ // inversion: feeding only to one browser
+ if (preg_match('@
+ ^/ # comment started like /*/
+ \\s*
+ (\\S[\\s\\S]+?) # has at least some non-ws content
+ \\s*
+ /\\* # ends like /*/ or /**/
+ @x', $m, $n)) {
+ // end hack mode after this comment, but preserve the hack and comment content
+ $this->_inHack = false;
+ return "/*/{$n[1]}/**/";
+ }
+ }
+ if (substr($m, -1) === '\\') { // comment ends like \*/
+ // begin hack mode and preserve hack
+ $this->_inHack = true;
+ return '/*\\*/';
+ }
+ if ($m !== '' && $m[0] === '/') { // comment looks like /*/ foo */
+ // begin hack mode and preserve hack
+ $this->_inHack = true;
+ return '/*/*/';
+ }
+ if ($this->_inHack) {
+ // a regular comment ends hack mode but should be preserved
+ $this->_inHack = false;
+ return '/**/';
+ }
+ // Issue 107: if there's any surrounding whitespace, it may be important, so
+ // replace the comment with a single space
+ return $hasSurroundingWs // remove all other comments
+ ? ' '
+ : '';
+ }
+
+ /**
+ * Process a font-family listing and return a replacement
+ *
+ * @param array $m regex matches
+ *
+ * @return string
+ */
+ protected function _fontFamilyCB($m)
+ {
+ $m[1] = preg_replace('/
+ \\s*
+ (
+ "[^"]+" # 1 = family in double qutoes
+ |\'[^\']+\' # or 1 = family in single quotes
+ |[\\w\\-]+ # or 1 = unquoted family
+ )
+ \\s*
+ /x', '$1', $m[1]);
+ return 'font-family:' . $m[1] . $m[2];
+ }
+}
270 includes/library/CSS/UriRewriter.php
@@ -0,0 +1,270 @@
+<?php
+/**
+ * Class Minify_CSS_UriRewriter
+ * @package Minify
+ */
+
+/**
+ * Rewrite file-relative URIs as root-relative in CSS files
+ *
+ * @package Minify
+ * @author Stephen Clay <steve@mrclay.org>
+ */
+class Minify_CSS_UriRewriter {
+
+ /**
+ * Defines which class to call as part of callbacks, change this
+ * if you extend Minify_CSS_UriRewriter
+ * @var string
+ */
+ protected static $className = 'Minify_CSS_UriRewriter';
+
+ /**
+ * rewrite() and rewriteRelative() append debugging information here
+ * @var string
+ */
+ public static $debugText = '';
+
+ /**
+ * Rewrite file relative URIs as root relative in CSS files
+ *
+ * @param string $css
+ *
+ * @param string $currentDir The directory of the current CSS file.
+ *
+ * @param string $docRoot The document root of the web site in which
+ * the CSS file resides (default = $_SERVER['DOCUMENT_ROOT']).
+ *
+ * @param array $symlinks (default = array()) If the CSS file is stored in
+ * a symlink-ed directory, provide an array of link paths to
+ * target paths, where the link paths are within the document root. Because
+ * paths need to be normalized for this to work, use "//" to substitute
+ * the doc root in the link paths (the array keys). E.g.:
+ * <code>
+ * array('//symlink' => '/real/target/path') // unix
+ * array('//static' => 'D:\\staticStorage') // Windows
+ * </code>
+ *
+ * @return string
+ */
+ public static function rewrite($css, $currentDir, $docRoot = null, $symlinks = array())
+ {
+ self::$_docRoot = self::_realpath(
+ $docRoot ? $docRoot : $_SERVER['DOCUMENT_ROOT']
+ );
+ self::$_currentDir = self::_realpath($currentDir);
+ self::$_symlinks = array();
+
+ // normalize symlinks
+ foreach ($symlinks as $link => $target) {
+ $link = ($link === '//')
+ ? self::$_docRoot
+ : str_replace('//', self::$_docRoot . '/', $link);
+ $link = strtr($link, '/', DIRECTORY_SEPARATOR);
+ self::$_symlinks[$link] = self::_realpath($target);
+ }
+
+ self::$debugText .= "docRoot : " . self::$_docRoot . "\n"
+ . "currentDir : " . self::$_currentDir . "\n";
+ if (self::$_symlinks) {
+ self::$debugText .= "symlinks : " . var_export(self::$_symlinks, 1) . "\n";
+ }
+ self::$debugText .= "\n";
+
+ $css = self::_trimUrls($css);
+
+ // rewrite
+ $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/'
+ ,array(self::$className, '_processUriCB'), $css);
+ $css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
+ ,array(self::$className, '_processUriCB'), $css);
+
+ return $css;
+ }
+
+ /**
+ * Prepend a path to relative URIs in CSS files
+ *
+ * @param string $css
+ *
+ * @param string $path The path to prepend.
+ *
+ * @return string
+ */
+ public static function prepend($css, $path)
+ {
+ self::$_prependPath = $path;
+
+ $css = self::_trimUrls($css);
+
+ // append
+ $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/'
+ ,array(self::$className, '_processUriCB'), $css);
+ $css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
+ ,array(self::$className, '_processUriCB'), $css);
+
+ self::$_prependPath = null;
+ return $css;
+ }
+
+
+ /**
+ * @var string directory of this stylesheet
+ */
+ private static $_currentDir = '';
+
+ /**
+ * @var string DOC_ROOT
+ */
+ private static $_docRoot = '';
+
+ /**
+ * @var array directory replacements to map symlink targets back to their
+ * source (within the document root) E.g. '/var/www/symlink' => '/var/realpath'
+ */
+ private static $_symlinks = array();
+
+ /**
+ * @var string path to prepend
+ */
+ private static $_prependPath = null;
+
+ private static function _trimUrls($css)
+ {
+ return preg_replace('/
+ url\\( # url(
+ \\s*
+ ([^\\)]+?) # 1 = URI (assuming does not contain ")")
+ \\s*
+ \\) # )
+ /x', 'url($1)', $css);
+ }
+
+ private static function _processUriCB($m)
+ {
+ // $m matched either '/@import\\s+([\'"])(.*?)[\'"]/' or '/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
+ $isImport = ($m[0][0] === '@');
+ // determine URI and the quote character (if any)
+ if ($isImport) {
+ $quoteChar = $m[1];
+ $uri = $m[2];
+ } else {
+ // $m[1] is either quoted or not
+ $quoteChar = ($m[1][0] === "'" || $m[1][0] === '"')
+ ? $m[1][0]
+ : '';
+ $uri = ($quoteChar === '')
+ ? $m[1]
+ : substr($m[1], 1, strlen($m[1]) - 2);
+ }
+ // analyze URI
+ if ('/' !== $uri[0] // root-relative
+ && false === strpos($uri, '//') // protocol (non-data)
+ && 0 !== strpos($uri, 'data:') // data protocol
+ ) {
+ // URI is file-relative: rewrite depending on options
+ $uri = (self::$_prependPath !== null)
+ ? (self::$_prependPath . $uri)
+ : self::rewriteRelative($uri, self::$_currentDir, self::$_docRoot, self::$_symlinks);
+ }
+ return $isImport
+ ? "@import {$quoteChar}{$uri}{$quoteChar}"
+ : "url({$quoteChar}{$uri}{$quoteChar})";
+ }
+
+ /**
+ * Rewrite a file relative URI as root relative
+ *
+ * <code>
+ * Minify_CSS_UriRewriter::rewriteRelative(
+ * '../img/hello.gif'
+ * , '/home/user/www/css' // path of CSS file
+ * , '/home/user/www' // doc root
+ * );
+ * // returns '/img/hello.gif'
+ *
+ * // example where static files are stored in a symlinked directory
+ * Minify_CSS_UriRewriter::rewriteRelative(
+ * 'hello.gif'
+ * , '/var/staticFiles/theme'
+ * , '/home/user/www'
+ * , array('/home/user/www/static' => '/var/staticFiles')
+ * );
+ * // returns '/static/theme/hello.gif'
+ * </code>
+ *
+ * @param string $uri file relative URI
+ *
+ * @param string $realCurrentDir realpath of the current file's directory.
+ *
+ * @param string $realDocRoot realpath of the site document root.
+ *
+ * @param array $symlinks (default = array()) If the file is stored in
+ * a symlink-ed directory, provide an array of link paths to
+ * real target paths, where the link paths "appear" to be within the document
+ * root. E.g.:
+ * <code>
+ * array('/home/foo/www/not/real/path' => '/real/target/path') // unix
+ * array('C:\\htdocs\\not\\real' => 'D:\\real\\target\\path') // Windows
+ * </code>
+ *
+ * @return string
+ */
+ public static function rewriteRelative($uri, $realCurrentDir, $realDocRoot, $symlinks = array())
+ {
+ // prepend path with current dir separator (OS-independent)
+ $path = strtr($realCurrentDir, '/', DIRECTORY_SEPARATOR)
+ . DIRECTORY_SEPARATOR . strtr($uri, '/', DIRECTORY_SEPARATOR);
+
+ self::$debugText .= "file-relative URI : {$uri}\n"
+ . "path prepended : {$path}\n";
+
+ // "unresolve" a symlink back to doc root
+ foreach ($symlinks as $link => $target) {
+ if (0 === strpos($path, $target)) {
+ // replace $target with $link
+ $path = $link . substr($path, strlen($target));
+
+ self::$debugText .= "symlink unresolved : {$path}\n";
+
+ break;
+ }
+ }
+ // strip doc root
+ $path = substr($path, strlen($realDocRoot));
+
+ self::$debugText .= "docroot stripped : {$path}\n";
+
+ // fix to root-relative URI
+
+ $uri = strtr($path, '/\\', '//');
+
+ // remove /./ and /../ where possible
+ $uri = str_replace('/./', '/', $uri);
+ // inspired by patch from Oleg Cherniy
+ do {
+ $uri = preg_replace('@/[^/]+/\\.\\./@', '/', $uri, 1, $changed);
+ } while ($changed);
+
+ self::$debugText .= "traversals removed : {$uri}\n\n";
+
+ return $uri;
+ }
+
+ /**
+ * Get realpath with any trailing slash removed. If realpath() fails,
+ * just remove the trailing slash.
+ *
+ * @param string $path
+ *
+ * @return mixed path with no trailing slash
+ */
+ protected static function _realpath($path)
+ {
+ $realPath = realpath($path);
+ if ($realPath !== false) {
+ $path = $realPath;
+ }
+ return rtrim($path, '/\\');
+ }
+}
90 includes/library/CommentPreserver.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * Class Minify_CommentPreserver
+ * @package Minify
+ */
+
+/**
+ * Process a string in pieces preserving C-style comments that begin with "/*!"
+ *
+ * @package Minify
+ * @author Stephen Clay <steve@mrclay.org>
+ */
+class Minify_CommentPreserver {
+
+ /**
+ * String to be prepended to each preserved comment
+ *
+ * @var string
+ */
+ public static $prepend = "\n";
+
+ /**
+ * String to be appended to each preserved comment
+ *
+ * @var string
+ */
+ public static $append = "\n";
+
+ /**
+ * Process a string outside of C-style comments that begin with "/*!"
+ *
+ * On each non-empty string outside these comments, the given processor
+ * function will be called. The first "!" will be removed from the
+ * preserved comments, and the comments will be surrounded by
+ * Minify_CommentPreserver::$preprend and Minify_CommentPreserver::$append.
+ *
+ * @param string $content
+ * @param callback $processor function
+ * @param array $args array of extra arguments to pass to the processor
+ * function (default = array())
+ * @return string
+ */
+ public static function process($content, $processor, $args = array())
+ {
+ $ret = '';
+ while (true) {
+ list($beforeComment, $comment, $afterComment) = self::_nextComment($content);
+ if ('' !== $beforeComment) {
+ $callArgs = $args;
+ array_unshift($callArgs, $beforeComment);
+ $ret .= call_user_func_array($processor, $callArgs);
+ }
+ if (false === $comment) {
+ break;
+ }
+ $ret .= $comment;
+ $content = $afterComment;
+ }
+ return $ret;
+ }
+
+ /**
+ * Extract comments that YUI Compressor preserves.
+ *
+ * @param string $in input
+ *
+ * @return array 3 elements are returned. If a YUI comment is found, the
+ * 2nd element is the comment and the 1st and 2nd are the surrounding
+ * strings. If no comment is found, the entire string is returned as the
+ * 1st element and the other two are false.
+ */
+ private static function _nextComment($in)
+ {
+ if (
+ false === ($start = strpos($in, '/*!'))
+ || false === ($end = strpos($in, '*/', $start + 3))
+ ) {
+ return array($in, false, false);
+ }
+ $ret = array(
+ substr($in, 0, $start)
+ ,self::$prepend . '/*' . substr($in, $start + 3, $end - $start - 1) . self::$append
+ );
+ $endChars = (strlen($in) - $end - 2);
+ $ret[] = (0 === $endChars)
+ ? ''
+ : substr($in, -$endChars);
+ return $ret;
+ }
+}
289 includes/library/JSMin.php
@@ -0,0 +1,289 @@
+<?php
+
+if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
+/**
+ * jsmin.php - PHP implementation of Douglas Crockford's JSMin.
+ *
+ * This is pretty much a direct port of jsmin.c to PHP with just a few
+ * PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and
+ * outputs to stdout, this library accepts a string as input and returns another
+ * string as output.
+ *
+ * PHP 5 or higher is required.
+ *
+ * Permission is hereby granted to use this version of the library under the
+ * same terms as jsmin.c, which has the following license:
+ *
+ * --
+ * Copyright (c) 2002 Douglas Crockford (www.crockford.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * The Software shall be used for Good, not Evil.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ * --
+ *
+ * @package JSMin
+ * @author Ryan Grove <ryan@wonko.com>
+ * @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
+ * @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
+ * @license http://opensource.org/licenses/mit-license.php MIT License
+ * @version 1.1.1 (2008-03-02)
+ * @link http://code.google.com/p/jsmin-php/
+ */
+
+class JSMin {
+ const ORD_LF = 10;
+ const ORD_SPACE = 32;
+
+ protected $a = '';
+ protected $b = '';
+ protected $input = '';
+ protected $inputIndex = 0;
+ protected $inputLength = 0;
+ protected $lookAhead = null;
+ protected $output = '';
+
+ // -- Public Static Methods --------------------------------------------------
+
+ public static function minify( $js ) {
+ $jsmin = new JSMin( $js );
+ return $jsmin->min();
+ }
+
+ // -- Public Instance Methods ------------------------------------------------
+
+ public function __construct( $input ) {
+ $this->input = str_replace( "\r\n", "\n", $input );
+ $this->inputLength = strlen( $this->input );
+ }
+
+ // -- Protected Instance Methods ---------------------------------------------
+
+ protected function action( $d ) {
+ switch( $d ) {
+ case 1:
+ $this->output .= $this->a;
+
+ case 2:
+ $this->a = $this->b;
+
+ if( $this->a === "'" || $this->a === '"' ) {
+ for (;;) {
+ $this->output .= $this->a;
+ $this->a = $this->get();
+
+ if( $this->a === $this->b ) {
+ break;
+ }
+
+ if( ord( $this->a ) <= self::ORD_LF ) {
+ throw new JSMinException( 'Unterminated string literal.' );
+ }
+
+ if( $this->a === '\\' ) {
+ $this->output .= $this->a;
+ $this->a = $this->get();
+ }
+ }
+ }
+
+ case 3:
+ $this->b = $this->next();
+
+ if( $this->b === '/' && (
+ $this->a === '(' || $this->a === ',' || $this->a === '=' ||
+ $this->a === ':' || $this->a === '[' || $this->a === '!' ||
+ $this->a === '&' || $this->a === '|' || $this->a === '?' ) ) {
+
+ $this->output .= $this->a . $this->b;
+
+ for (;;) {
+ $this->a = $this->get();
+
+ if( $this->a === '/' ) {
+ break;
+ } elseif( $this->a === '\\' ) {
+ $this->output .= $this->a;
+ $this->a = $this->get();
+ } elseif( ord( $this->a ) <= self::ORD_LF ) {
+ throw new JSMinException( 'Unterminated regular expression literal.' );
+ }
+
+ $this->output .= $this->a;
+ }
+
+ $this->b = $this->next();
+ }
+ }
+ }
+
+ protected function get() {
+ $c = $this->lookAhead;
+ $this->lookAhead = null;
+
+ if( $c === null ) {
+ if( $this->inputIndex < $this->inputLength ) {
+ $c = $this->input[$this->inputIndex];
+ $this->inputIndex += 1;
+ } else {
+ $c = null;
+ }
+ }
+
+ if( $c === "\r" ) {
+ return "\n";
+ }
+
+ if( $c === null || $c === "\n" || ord( $c ) >= self::ORD_SPACE ) {
+ return $c;
+ }
+
+ return ' ';
+ }
+
+ protected function isAlphaNum( $c ) {
+ return ord( $c ) > 126 || $c === '\\' || preg_match( '/^[\w\$]$/', $c ) === 1;
+ }
+
+ protected function min() {
+ $this->a = "\n";
+ $this->action( 3 );
+
+ while( $this->a !== null ) {
+ switch( $this->a ) {
+ case ' ':
+ if( $this->isAlphaNum( $this->b ) ) {
+ $this->action( 1 );
+ } else {
+ $this->action( 2 );
+ }
+ break;
+
+ case "\n":
+ switch( $this->b ) {
+ case '{':
+ case '[':
+ case '(':
+ case '+':
+ case '-':
+ $this->action( 1 );
+ break;
+
+ case ' ':
+ $this->action( 3 );
+ break;
+
+ default:
+ if( $this->isAlphaNum( $this->b ) ) {
+ $this->action( 1 );
+ } else {
+ $this->action( 2 );
+ }
+ }
+ break;
+
+ default:
+ switch( $this->b ) {
+ case ' ':
+ if( $this->isAlphaNum( $this->a ) ) {
+ $this->action( 1 );
+ break;
+ }
+
+ $this->action( 3 );
+ break;
+
+ case "\n":
+ switch( $this->a ) {
+ case '}':
+ case ']':
+ case ')':
+ case '+':
+ case '-':
+ case '"':
+ case "'":
+ $this->action( 1 );
+ break;
+
+ default:
+ if( $this->isAlphaNum( $this->a ) ) {
+ $this->action( 1 );
+ } else {
+ $this->action( 3 );
+ }
+ }
+ break;
+
+ default:
+ $this->action( 1 );
+ break;
+ }
+ }
+ }
+
+ return $this->output;
+ }
+
+ protected function next() {
+ $c = $this->get();
+
+ if( $c === '/' ) {
+ switch( $this->peek() ) {
+ case '/':
+ for (;;) {
+ $c = $this->get();
+
+ if( ord( $c ) <= self::ORD_LF ) {
+ return $c;
+ }
+ }
+
+ case '*':
+ $this->get();
+
+ for (;;) {
+ switch( $this->get() ) {
+ case '*':
+ if( $this->peek() === '/' ) {
+ $this->get();
+ return ' ';
+ }
+ break;
+
+ case null:
+ throw new JSMinException( 'Unterminated comment.' );
+ }
+ }
+
+ default:
+ return $c;
+ }
+ }
+
+ return $c;
+ }
+
+ protected function peek() {
+ $this->lookAhead = $this->get();
+ return $this->lookAhead;
+ }
+}
+
+// -- Exceptions ---------------------------------------------------------------
+class JSMinException extends Exception {}
57 includes/maintenance/clearMwEmbedVars.php
@@ -0,0 +1,57 @@
+<?php
+if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+ print "This script must be run from the command line\n";
+ exit();
+}
+exit( 'This script has been depreciated' );
+$mwPath = dirname( __FILE__ ) . '/../../languages/mwEmbed.i18n.php' ;
+
+include( $mwPath );
+$saveKeys = array(
+/*
+ * js file: /mwEmbed.js
+ */
+'mwe-loading_txt' => 'Loading ...',
+'mwe-size-gigabytes' => '$1 GB',
+'mwe-size-megabytes' => '$1 MB',
+'mwe-size-kilobytes' => '$1 K',
+'mwe-size-bytes' => '$1 B',
+'mwe-error_load_lib' => 'Error: JavaScript $1 was not retrievable or does not define $2',
+'mwe-apiproxy-setup' => 'Setting up API proxy',
+'mwe-load-drag-item' => 'Loading dragged item',
+'mwe-ok' => 'OK',
+'mwe-cancel' => 'Cancel',
+'mwe-enable-gadget' => 'Enable multimedia beta ( mwEmbed ) for all pages',
+'mwe-enable-gadget-done' => 'multimedia beta gadget has been enabled',
+'mwe-must-login-gadget' => 'To enable gadget you must <a target="_new" href="$1">login</a>',
+'mwe-test-plural' => 'I ran {{PLURAL:$1|$1 test|$1 tests}}',
+);
+
+//output only the $saveKeys
+$s = '<?php
+
+/**
+ * Localization file for mwEmbed.js
+ */
+';
+foreach( $messages as $langKey => $msgSet ){
+ $startLangFlag = false;
+
+ // Check every msg for language keys:
+ foreach( $saveKeys as $mk => $mv ) {
+ if( isset( $messages[$langKey][ $mk ] ) ){
+ if( !$startLangFlag ){
+ $s.= '$messages[\''.$langKey.'\'] = array(' . "\n";
+ $startLangFlag = true;
+ }
+ $s.="\t'{$mk}' => '" . str_replace( '\'', '\\\'', $messages[ $langKey ][$mk] ) . "',\n";
+ }
+ }
+ if( $startLangFlag ){
+ $s.= ");\n";
+ }
+}
+
+file_put_contents( $mwPath , $s);
+
+
238 includes/maintenance/mergeJavascriptMsg.php
@@ -0,0 +1,238 @@
+<?php
+/**
+* Merges in JavaScript with mwEmbed.i18n.php
+*
+* @file
+* @ingroup Maintenance
+*/
+
+# Abort if called from a web server
+if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+ print "This script must be run from the command line\n";
+ exit();
+}
+exit( 'This script has been depreciated' );
+define( 'MEDIAWIKI', true );
+// Get the scriptLoader globals:
+require_once( '../../jsScriptLoader.php' );
+
+$mwSTART_MSG_KEY = '$messages[\'en\'] = array(';
+$mwEND_MSG_KEY = ',
+);';
+
+function print_help(){
+?>
+This script helps merge msgs between javascript and php
+Usage:
+ -j merges javascript msgs into php
+ -p merges php msgs back into javascript
+ -q will disable screen output and wait time
+ --modpath [/path/to/module/folder] path to a module folder to be updated
+<?php
+}
+
+// Get options ( like override JS or override PHP )
+if ( in_array($argv[1], array('--help', '-help', '-h', '-?')) ) {
+ print_help();
+}
+$mergeToPhp = $mergeToJS = false;
+$showInfo = true;
+foreach($argv as $inx => $arg){
+ if($inx == 0)
+ continue;
+ if( $arg == '-j' ){
+ $mergeToPhp = true;
+ }else if( $arg == '-p' ) {
+ $mergeToJS = true;
+ }else if( $arg == '-q'){
+ $showInfo = false;
+ }else if( $arg == '--modpath' ){
+ print_help();
+ }
+}
+
+die();
+
+if($showInfo){
+ if ( $mergeToPhp )
+ print "Will merge *Javascript to PHP* in 3 seconds ";
+
+ if ( $mergeToJS )
+ print "Will merge *PHP to Javascript* in 3 seconds ";
+
+ for ( $i = 0; $i < 3; $i++ ) {
+ print '.';
+ sleep( 1 );
+ }
+ print "\n";
+}
+
+// read in mwEmbed.i18n.php
+$rawLangFile = file_get_contents( $mwLangFilePath );
+
+$startInx = strpos( $rawLangFile, $mwSTART_MSG_KEY ) + strlen( $mwSTART_MSG_KEY );
+$endInx = strpos( $rawLangFile, $mwEND_MSG_KEY ) + 1;
+if ( $startInx === false || $endInx === false ) {
+ if( $showInfo ) {
+ print "Could not find $mwSTART_MSG_KEY or $mwEND_MSG_KEY in mwEmbed.i18n.php\n";
+ }
+ exit();
+}
+
+$preFile = substr( $rawLangFile, 0, $startInx );
+$msgSet = substr( $rawLangFile, $startInx, $endInx - $startInx );
+$postFile = substr( $rawLangFile, $endInx );
+
+// build replacement from all javascript in mwEmbed
+$path = realpath( '../../' );
+
+$curFileName = '';
+// @@todo existing msgSet should be parsed (or we just "include" the file first)
+$msgSet = "";
+
+$objects = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ), RecursiveIteratorIterator::SELF_FIRST );
+foreach ( $objects as $fname => $object ) {
+ if ( substr( $fname, - 3 ) == '.js'
+ && strpos( $fname, '/cache/' ) === false
+ && strpos( $fname, '/tests/' ) === false )
+ {
+
+ $jsFileText = file_get_contents( $fname );
+ $mwPos = strpos( $fname, 'mwEmbed' ) + 7;
+ $curFileName = substr( $fname, $mwPos );
+ // @@todo fix: will break down if someone does }) in their msg text
+ if ( preg_match( '/mw\.addMessages\s*\(\s*{(.*)}\s*\)\s*/siU',
+ $jsFileText,
+ $matches ) )
+ {
+ $msgSet .= doJsonMerge( $matches[1] );
+ }
+ }
+}
+// Rebuild and output to single php file if mergeToPHP is on
+if ( $mergeToPhp ) {
+ if ( file_put_contents( $mwLangFilePath, trim( $preFile ) . "\n\t" . trim( $msgSet ) . "\n" . ltrim( $postFile ) ) ) {
+ if( $showInfo )
+ print "updated $mwLangFilePath file\n";
+ exit();
+ }
+}
+/**
+ * Merges json messages into php file.
+ * @param string $json_txt Json text to be merged
+ */
+function doJsonMerge( $json_txt ) {
+ global $curFileName, $fname, $messages, $mergeToJS, $jsFileText, $showInfo;
+
+ $outPhp = "\n\t/*\n";
+ $outPhp .= "\t * js file: {$curFileName}\n";
+ $outPhp .= "\t */\n";
+
+ $jsMsgAry = array();
+ $doReplaceFlag = false;
+
+ $jmsg = json_decode( '{' . $json_txt . '}', true );
+ if ( count( $jmsg ) != 0 ) {
+
+ foreach ( $jmsg as $k => $v ) {
+ // Check if the existing value is changed and merge and merge ->right
+ if ( isset( $messages['en'][$k] ) ) {
+ if ( $messages['en'][$k] != $v ) {
+ $doReplaceFlag = true;
+ if( $showInfo )
+ print "'$k' does not match:\n" . $messages['en'][$k] . "\n!=\n" . $v . "\n In: {$curFileName} \n";
+ }
+ // add the actual value: (replace new lines (not compatible json)
+ // $jsMsgAry[$k] = str_replace("\n", '\\n', $messages['en'][$k]);
+ $jsMsgAry[$k] = $messages['en'][$k];
+ $doReplaceFlag = true;
+ } ;
+ $outPhp .= "\t'{$k}' => '" . str_replace( '\'', '\\\'', $v ) . "',\n";
+ }
+ // Merge the jsLanguage array back in and wrap the output
+ if ( $mergeToJS && $doReplaceFlag ) {
+ $json = json_encode( $jsMsgAry );
+ $json_txt = jsonReadable( $json );
+ // escape $1 for preg replace:
+ $json_txt = str_replace( '$', '\$', $json_txt );
+ // print "json:\n$json_txt \n";
+ $str = preg_replace ( '/mw.addMessages\s*\(\s*{(.*)}\s*\)\s*/siU',
+ "mw.addMessages(" . $json_txt . ")",
+ $jsFileText );
+
+ if ( file_put_contents( $fname, $str ) ) {
+ if( $showInfo )
+ print "\nupdated $curFileName from php\n\n";
+ } else {
+ die( "Could not write to: " . $fname );
+ }
+ }
+ // Return phpOut for building msgSet in outer function
+ return $outPhp;
+
+ } else {
+ if($showInfo)
+ print "Could not get any json vars from: $curFileName\n";
+ return '';
+ }
+}
+/**
+ * Formats a json string
+ *
+ * @param string $json Json string to be formated
+ */
+function jsonReadable( $json ) {
+ $tabcount = 0;
+ $result = '';
+ $inquote = false;
+ $ignorenext = false;
+
+ $tab = "\t";
+ $newline = "\n";
+
+ for ( $i = 0; $i < strlen( $json ); $i++ ) {
+ $char = $json[$i];
+
+ if ( $ignorenext ) {
+ $result .= $char;
+ $ignorenext = false;
+ } else {
+ switch( $char ) {
+ case '{':
+ $tabcount++;
+ $result .= $char . $newline . str_repeat( $tab, $tabcount );
+ break;
+ case '}':
+ $tabcount--;
+ $result = trim( $result ) . $newline . str_repeat( $tab, $tabcount ) . $char;
+ break;
+ case ',':
+ if ( $inquote ) {
+ $result .= $char;
+ } else {
+ $result .= $char . $newline . str_repeat( $tab, $tabcount );
+ }
+ break;
+ case ':':
+ if ( $inquote ) {
+ $result .= $char;
+ } else {
+ $result .= ' ' . $char . ' ';
+ }
+ break;
+ case '"':
+ $inquote = !$inquote;
+ $result .= $char;
+ break;
+ case '\\':
+ if ( $inquote ) $ignorenext = true;
+ $result .= $char;
+ break;
+ default:
+ $result .= $char;
+ }
+ }
+ }
+
+ return $result;
+}
93 includes/maintenance/moveMsgToModule.php
@@ -0,0 +1,93 @@
+<?php
+if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+ print "This script must be run from the command line\n";
+ exit();
+}
+exit( 'This script has been depreciated' );
+// Merge all the modules msgs into
+
+// First get the big list of translations
+require_once ( '../../languages/mwEmbed.i18n.php' ) ;
+
+$path = realpath( '../../modules' );
+$moduleBuckets = array();
+// For each module folder
+$objects = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ), RecursiveIteratorIterator::SELF_FIRST );
+foreach ( $objects as $fname => $object ) {
+ if ( substr( $fname, - 3 ) == '.js'
+ && strpos( $fname, '/cache/' ) === false
+ && strpos( $fname, '/tests/' ) === false )
+ {
+
+ $jsFileText = file_get_contents( $fname );
+ preg_match( '/modules\/([^\/]*)\//siU', $fname, $fmatches );
+
+ if( !$fmatches[1] )
+ die("error could not get module name");
+
+ $moduleName = $fmatches[1];
+ if( strpos( $jsFileText, 'mw.addMessages') !== false ){
+ preg_match( '/mw\.addMessages\s*\(\s*{(.*)}\s*\)\s*/siU',
+ $jsFileText,
+ $matches );
+
+ if( $matches[1] && $jmsg = json_decode( '{' . $matches[1] . '}', true ) ) {
+ if( ! isset( $moduleBuckets[ $moduleName ] )) {
+ //Output standard header:
+ $moduleBuckets[ $moduleName ] = array();
+ }
+ foreach( $jmsg as $mk=>$mt ){
+ $moduleBuckets[ $moduleName ][$mk] = $mt;
+ }
+ } else {
+ print "COULD NOT PARSE: $fname\n";
+ }
+ }
+ }
+}
+
+// Output to an i18n.php file for each module
+foreach( $moduleBuckets as $moduleName => $msgAry ){
+ $s ='<?php
+/*
+ * Internationalisation for ' . $moduleName . '
+ *
+ * @file
+ * @ingroup Extensions
+ */
+
+$messages = array();
+';
+
+ // Output English msgs on top::
+ $s.= '$messages[\'en\'] = array(' . "\n";
+ foreach( $msgAry as $mk => $mv ) {
+ $s.="\t'{$mk}' => '" . str_replace( '\'', '\\\'', $mv ) . "