3 # Alert the user that this is not a valid entry point to MediaWiki if
4 # they try to access the special pages file directly.
5 if (!defined('MEDIAWIKI')) {
7 To install my extension, put the following line in LocalSettings.php:
8 require_once( "\$IP/extensions/EditImage/EditImage.php" );
13 $dir = dirname(__FILE__) . '/';
14 $wgAutoloadClasses['EditImage'] = $dir . 'EditImage_body.php';
15 $wgExtensionMessagesFiles['EditImage'] = $dir . 'EditImage.i18n.php';
16 $wgSpecialPages['EditImage'] = 'EditImage';
17 # $wgHooks['LanguageGetSpecialPageAliases'][] = 'EditImageLocalizedPageName';
18 $wgHooks['SkinTemplateContentActions'][] = 'wfAddactionContentHook';
19 #$wgHooks['UnknownAction'][] = 'wfAddactActionHook';
21 function myExtensionLocalizedPageName(&$specialPageArray, $code) {
22 # The localized title of the special page is among the messages of the extension:
23 wfLoadExtensionMessages('EditImage');
24 $text = wfMsg('editimage');
26 # Convert from title in text form to DBKey and put it into the alias array:
27 $title = Title::newFromText($text);
28 $specialPageArray['EditImage'][] = $title->getDBKey();
33 $wgExtensionCredits['specialpage'][] = array(
34 'name' => 'EditImage',
36 'author' => 'Benjamin Mako Hill',
37 'url' => 'http://www.mediawiki.org/wiki/User:Benjamin_Mako_Hill',
38 'description' => 'This extension provides a way for Mediawiki users to edit images from the web.'
41 function wfAddActionContentHook( &$content_actions ) {
42 global $wgRequest, $wgRequest, $wgTitle;
44 $action = $wgRequest->getText( 'action' );
45 if ( $wgTitle->getNamespace() == NS_IMAGE ) {
47 $editimage_page = SpecialPage::getTitleFor( 'EditImage');;
49 $content_actions['editimage'] = array(
50 'class' => $action == 'editimage' ? 'selected' : false,
51 'text' => "Crop Image", // the wfMsg was not working...
52 'href' => $editimage_page->getLocalURL("image={$wgTitle->getPrefixedURL()}")