Index: trunk/extensions/LogoFunctions/LogoFunction.i18n.php |
— | — | @@ -0,0 +1,27 @@ |
| 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 | +$messages = array(); |
| 16 | + |
| 17 | +/** English |
| 18 | + */ |
| 19 | +$messages['en'] = array( |
| 20 | + 'logofunction-desc' => 'Add Paser hooks about wiki\'s logo.', |
| 21 | +); |
| 22 | + |
| 23 | +/** Korean (한국어) |
| 24 | + * @author Devunt |
| 25 | + */ |
| 26 | +$messages['ko'] = array( |
| 27 | + 'logofunction-desc' => '위키의 로고에 관한 파서 훅을 추가합니다.', |
| 28 | +); |
Property changes on: trunk/extensions/LogoFunctions/LogoFunction.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 29 | + native |
Index: trunk/extensions/LogoFunctions/LogoFunction.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/LogoFunction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 50 | + native |