Index: trunk/extensions/LogoFunctions/LogoFunction.php |
— | — | @@ -1,48 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * LogoFunction |
5 | | - * |
6 | | - * Add PaserFunctions about wiki's logo |
7 | | - * |
8 | | - * @link http://www.mediawiki.org/wiki/Extension:LogoFunction |
9 | | - * |
10 | | - * @author Devunt <devunt@devunt.kr> |
11 | | - * @authorlink http://www.mediawiki.org/wiki/User:Devunt |
12 | | - * @copyright Copyright © 2010 Devunt (Bae June Hyeon). |
13 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
14 | | - */ |
15 | | - |
16 | | -if ( !defined( 'MEDIAWIKI' ) ) die('define error!'); |
17 | | - |
18 | | -$wgExtensionCredits[ 'parserhook' ][] = array( |
19 | | - 'name' => 'LogoFunction', |
20 | | - 'author' => 'Devunt (Bae June Hyeon)', |
21 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:LogoFunction', |
22 | | - 'descriptionmsg' => 'logofunction-desc', |
23 | | - 'version' => '0.9', |
24 | | -); |
25 | | - |
26 | | -$wgHooks['ParserFirstCallInit'][] = 'efLogoFunction_Setup'; |
27 | | -$wgHooks['LanguageGetMagic'][] = 'efLogoFunction_Magic'; |
28 | | - |
29 | | -function efLogoFunction_Setup( &$parser ) { |
30 | | - $parser->setFunctionHook( 'setlogo', 'efSetLogo_Render' ); |
31 | | - return true; |
32 | | -} |
33 | | - |
34 | | -function efLogoFunction_Magic( &$magicWords, $langCode ) { |
35 | | - $magicWords['setlogo'] = array( 0, 'setlogo' ); |
36 | | - return true; |
37 | | -} |
38 | | - |
39 | | -function efSetLogo_Render( $parser, $logo = '') { |
40 | | - global $wgLogo; |
41 | | - $imageobj = wfFindFile($logo); |
42 | | - if ($imageobj == null) return "<strong class=\"error\">File not exist error: [[File:$logo]] is not exist</strong>"; |
43 | | - $thumb_arr = array( |
44 | | - 'width' => 135, |
45 | | - 'height' => 135 |
46 | | - ); |
47 | | - $thumb = $imageobj->transform($thumb_arr); |
48 | | - $wgLogo = $thumb->getUrl(); |
49 | | -} |
\ No newline at end of file |
Index: trunk/extensions/LogoFunctions/LogoFunctions.php |
— | — | @@ -0,0 +1,48 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * LogoFunction |
| 5 | + * |
| 6 | + * Add PaserFunctions about wiki's logo |
| 7 | + * |
| 8 | + * @link http://www.mediawiki.org/wiki/Extension:LogoFunction |
| 9 | + * |
| 10 | + * @author Devunt <devunt@devunt.kr> |
| 11 | + * @authorlink http://www.mediawiki.org/wiki/User:Devunt |
| 12 | + * @copyright Copyright © 2010 Devunt (Bae June Hyeon). |
| 13 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 14 | + */ |
| 15 | + |
| 16 | +if ( !defined( 'MEDIAWIKI' ) ) die('define error!'); |
| 17 | + |
| 18 | +$wgExtensionCredits[ 'parserhook' ][] = array( |
| 19 | + 'name' => 'LogoFunction', |
| 20 | + 'author' => 'Devunt (Bae June Hyeon)', |
| 21 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:LogoFunction', |
| 22 | + 'descriptionmsg' => 'logofunction-desc', |
| 23 | + 'version' => '0.9', |
| 24 | +); |
| 25 | + |
| 26 | +$wgHooks['ParserFirstCallInit'][] = 'efLogoFunction_Setup'; |
| 27 | +$wgHooks['LanguageGetMagic'][] = 'efLogoFunction_Magic'; |
| 28 | + |
| 29 | +function efLogoFunction_Setup( &$parser ) { |
| 30 | + $parser->setFunctionHook( 'setlogo', 'efSetLogo_Render' ); |
| 31 | + return true; |
| 32 | +} |
| 33 | + |
| 34 | +function efLogoFunction_Magic( &$magicWords, $langCode ) { |
| 35 | + $magicWords['setlogo'] = array( 0, 'setlogo' ); |
| 36 | + return true; |
| 37 | +} |
| 38 | + |
| 39 | +function efSetLogo_Render( $parser, $logo = '') { |
| 40 | + global $wgLogo; |
| 41 | + $imageobj = wfFindFile($logo); |
| 42 | + if ($imageobj == null) return "<strong class=\"error\">File not exist error: [[File:$logo]] is not exist</strong>"; |
| 43 | + $thumb_arr = array( |
| 44 | + 'width' => 135, |
| 45 | + 'height' => 135 |
| 46 | + ); |
| 47 | + $thumb = $imageobj->transform($thumb_arr); |
| 48 | + $wgLogo = $thumb->getUrl(); |
| 49 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/LogoFunctions/LogoFunctions.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 50 | + native |