X-Git-Url: https://projects.mako.cc/source/editimage_extension/blobdiff_plain/7750a6d88ec2890d3d4a936c2a8c0dc7f2f8c617..HEAD:/EditImage.php diff --git a/EditImage.php b/EditImage.php index e945b7f..e3b7ba6 100644 --- a/EditImage.php +++ b/EditImage.php @@ -1,4 +1,19 @@ + This file is part of the EditImage Mediawiki Extension. + + EditImage is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at + your option) any later version. + + Foobar is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Foobar. If not, see . */ # Alert the user that this is not a valid entry point to MediaWiki if # they try to access the special pages file directly. @@ -15,6 +30,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 +53,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; +} ?>