Index: trunk/extensions/SharedCssJs/SharedCssJs.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | 'path' => __FILE__, |
22 | 22 | 'name' => 'SharedCssJs', |
23 | 23 | 'author' => array( "Tim Weyer" ), |
24 | | - 'version' => '1.0', |
| 24 | + 'version' => '1.0.1', |
25 | 25 | 'url' => 'https://www.mediawiki.org/wiki/Extension:SharedCssJs', |
26 | 26 | 'descriptionmsg' => 'sharedcssjs-desc', |
27 | 27 | ); |
— | — | @@ -30,8 +30,7 @@ |
31 | 31 | $wgExtensionMessagesFiles['SharedCssJs'] = $dir . 'SharedCssJs.i18n.php'; |
32 | 32 | |
33 | 33 | // Loading page protector |
34 | | -$dir = dirname( __FILE__ ) . '/'; |
35 | | -require_once ( "$dir/SharedCssJsProtector.php" ); |
| 34 | +require_once ( $dir . 'SharedCssJsProtector.php' ); |
36 | 35 | |
37 | 36 | // Hooks |
38 | 37 | $wgHooks['SkinTemplateSetupPageCss'][] = 'wfSharedCSS'; |
— | — | @@ -39,7 +38,7 @@ |
40 | 39 | $wgHooks['BeforePageDisplay'][] = 'wfSharedJS'; |
41 | 40 | $wgHooks['BeforePageDisplay'][] = 'wfSharedUserJS'; |
42 | 41 | |
43 | | -function wfSharedCSS( &$out ) { |
| 42 | +function wfSharedCSS( &$globalcss ) { |
44 | 43 | global $wgDisableSharedCSS, $wgSharedCssJsUrl; |
45 | 44 | if( !empty( $wgDisableSharedCSS ) ) { |
46 | 45 | return true; |
— | — | @@ -47,12 +46,12 @@ |
48 | 47 | |
49 | 48 | if ($wgSharedCssJsUrl) { |
50 | 49 | $url = $wgSharedCssJsUrl; |
51 | | - $out .= "@import \"{$url}?title=MediaWiki:Global.css&action=raw&ctype=text/css&smaxage=0\";"; |
| 50 | + $globalcss .= "@import \"{$url}?title=MediaWiki:Global.css&action=raw&ctype=text/css&smaxage=0\";"; |
52 | 51 | } |
53 | 52 | return true; |
54 | 53 | } |
55 | 54 | |
56 | | -function wfSharedJS( &$out ) { |
| 55 | +function wfSharedJS( &$globaljs ) { |
57 | 56 | global $wgDisableSharedJS, $wgJsMimeType, $wgSharedCssJsUrl; |
58 | 57 | if( !empty( $wgDisableSharedJS ) ) { |
59 | 58 | return true; |
— | — | @@ -60,12 +59,12 @@ |
61 | 60 | |
62 | 61 | if ($wgSharedCssJsUrl) { |
63 | 62 | $url = $wgSharedCssJsUrl; |
64 | | - $out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$url}?title=MediaWiki:Global.js&action=raw&ctype={$wgJsMimeType}\"></script>"); |
| 63 | + $globaljs->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$url}?title=MediaWiki:Global.js&action=raw&ctype={$wgJsMimeType}\"></script>"); |
65 | 64 | } |
66 | 65 | return true; |
67 | 66 | } |
68 | 67 | |
69 | | -function wfSharedUserCSS( &$out ) { |
| 68 | +function wfSharedUserCSS( &$globalusercss ) { |
70 | 69 | global $wgDisableSharedUserCSS, $wgSharedCssJsUrl, $wgUser; |
71 | 70 | if( !empty( $wgDisableSharedUserCSS ) || !isset( $wgSharedCssJsUrl ) ) { |
72 | 71 | return true; |
— | — | @@ -74,12 +73,12 @@ |
75 | 74 | if (!$wgUser->isAnon()) { |
76 | 75 | $url = $wgSharedCssJsUrl; |
77 | 76 | $userName = str_replace(' ', '_', $wgUser->getName()); |
78 | | - $out .= "@import \"{$url}?title=User:{$userName}/global.css&action=raw&ctype=text/css&smaxage=0\";"; |
| 77 | + $globalusercss .= "@import \"{$url}?title=User:{$userName}/global.css&action=raw&ctype=text/css&smaxage=0\";"; |
79 | 78 | } |
80 | 79 | return true; |
81 | 80 | } |
82 | 81 | |
83 | | -function wfSharedUserJS( &$out ) { |
| 82 | +function wfSharedUserJS( &$globaluserjs ) { |
84 | 83 | global $wgDisableSharedUserJS, $wgJsMimeType, $wgSharedCssJsUrl, $wgUser; |
85 | 84 | if( !empty( $wgDisableSharedUserJS ) || !isset( $wgSharedCssJsUrl ) ) { |
86 | 85 | return true; |
— | — | @@ -88,7 +87,7 @@ |
89 | 88 | if (!$wgUser->isAnon()) { |
90 | 89 | $url = $wgSharedCssJsUrl; |
91 | 90 | $userName = str_replace(' ', '_', $wgUser->getName()); |
92 | | - $out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$url}?title=User:{$userName}/global.js&action=raw&ctype={$wgJsMimeType}\"></script>"); |
| 91 | + $globaluserjs->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$url}?title=User:{$userName}/global.js&action=raw&ctype={$wgJsMimeType}\"></script>"); |
93 | 92 | } |
94 | 93 | return true; |
95 | 94 | } |