* */ $wgExtensionFunctions[] = 'wfUserContentActions'; $wgExtensionCredits['other'][] = array( 'name' => 'UserContentActions', 'version' => '2006/04/01', 'author' => 'Austin Che', 'url' => 'http://openwetware.org/wiki/User:Austin/Extensions/UserContentActions', 'description' => 'Allows users to add actions tabs to each page', ); function wfUserContentActions() { global $wgHooks, $wgMessageCache; $wgMessageCache->addMessages(array('contentactions' => 'Extra page content actions')); $wgHooks['SkinTemplateContentActions'][] = 'wfAddUserContentActions'; if (function_exists("wfAddPreferences")) { wfAddPreferences(array(array('name' => "contentactions", 'section' => "prefs-misc", 'type' => PREF_TEXT_T, 'size' => 25))); } } function wfAddUserContentActions(&$content_actions) { global $wgRequest, $wgTitle, $wgUser; if (! $wgUser->getOption("contentactions")) return true; $contentactions = $wgUser->getOption("contentactions"); $curaction = $wgRequest->getText('action'); if ( $wgTitle->getNamespace() != NS_SPECIAL ) { $useractions = preg_split( '/\s*,\s*/', trim($contentactions)); foreach ($useractions as $action) { $content_actions[$action] = array('class' => $curaction == $action ? 'selected' : false, 'text' => $action, 'href' => $wgTitle->getLocalUrl("action=$action") ); } } return true; } ?>