X-Git-Url: https://projects.mako.cc/source/editimage_extension/blobdiff_plain/7750a6d88ec2890d3d4a936c2a8c0dc7f2f8c617..9f6e0b9a934719634098793907c4cf5a86b5cfd5:/EditImage.php diff --git a/EditImage.php b/EditImage.php index e945b7f..10e51e0 100644 --- a/EditImage.php +++ b/EditImage.php @@ -15,6 +15,8 @@ $wgAutoloadClasses['EditImage'] = $dir . 'EditImage_body.php'; $wgExtensionMessagesFiles['EditImage'] = $dir . 'EditImage.i18n.php'; $wgSpecialPages['EditImage'] = 'EditImage'; # $wgHooks['LanguageGetSpecialPageAliases'][] = 'EditImageLocalizedPageName'; +$wgHooks['SkinTemplateContentActions'][] = 'wfAddactionContentHook'; +#$wgHooks['UnknownAction'][] = 'wfAddactActionHook'; function myExtensionLocalizedPageName(&$specialPageArray, $code) { # The localized title of the special page is among the messages of the extension: @@ -36,6 +38,23 @@ $wgExtensionCredits['specialpage'][] = array( 'description' => 'This extension provides a way for Mediawiki users to edit images from the web.' ); +function wfAddActionContentHook( &$content_actions ) { + global $wgRequest, $wgRequest, $wgTitle; + + $action = $wgRequest->getText( 'action' ); + if ( $wgTitle->getNamespace() == NS_IMAGE ) { + + $editimage_page = SpecialPage::getTitleFor( 'EditImage');; + + $content_actions['editimage'] = array( + 'class' => $action == 'editimage' ? 'selected' : false, + 'text' => "Crop Image", // the wfMsg was not working... + 'href' => $editimage_page->getLocalURL("image={$wgTitle->getPrefixedURL()}") + ); + } + + return true; +} ?>