noted the new URL for git repository
[editimage_extension] / EditImage.php
index e945b7f487c0de0884acdebc9a93b7e0ac3ac943..e3b7ba6818a90ffc55e3b05020b374c2940b8abb 100644 (file)
@@ -1,4 +1,19 @@
 <?php   
 <?php   
+/* Copyright (c) 2008 Benjamin Mako Hill <mako@atdot.cc>
+   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 <http://www.gnu.org/licenses/>.  */
 
 # Alert the user that this is not a valid entry point to MediaWiki if
 # they try to access the special pages file directly.
 
 # 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';
 $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:
 
 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.'
 );
 
     '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;
+}
 
 
 ?>
 
 
 ?>

Benjamin Mako Hill || Want to submit a patch?