Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Purge.php #2

Merged
merged 3 commits into from
Mar 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion Purge.php
Original file line number Diff line number Diff line change
@@ -1 +1,54 @@
<?php/** * An extension that adds a purge tab on each page * * @author Ævar Arnfjörð Bjarmason <[email protected]> * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later * * This is a fork of the original see https://www.mediawiki.org/wiki/Extension:Purge * Updated by Tom Hutchison to use proper i18n json files * Changed extension hook to SkinTemplateNavigation * Fixed ExtensionCredits to use the preferred descriptionmg * version 1.0.0 */if( !defined( 'MEDIAWIKI' ) ) { echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); die( 1 );}$wgExtensionCredits['other'][] = array( 'path' => __FILE__, 'name' => 'Purge', 'author' => 'Tom Hutchison', 'url' => 'https://github.com/Hutchy68/Purge', 'descriptionmsg' => 'descriptionmsg', 'version' => '1.0.0', 'license-name' => "License", // Short name of the license, links LICENSE or COPYING file if existing - string, added in 1.23.0);$wgMessagesDirs['Purge'] = __DIR__ . '/i18n';$wgExtensionMessagesFiles['Purge'] = __DIR__ . '/Purge.i18n.php';$wgHooks['SkinTemplateNavigation'][] = 'PurgeActionExtension::contentHook';class PurgeActionExtension{ public static function contentHook( $skin, array &$content_actions ) { global $wgRequest, $wgUser; // Use getRelevantTitle if present so that this will work on some special pages $title = method_exists( $skin, 'getRelevantTitle' ) ? $skin->getRelevantTitle() : $skin->getTitle(); if ( $title->getNamespace() !== NS_SPECIAL && $wgUser->isAllowed( 'purge' ) ) { $action = $wgRequest->getText( 'action' ); $content_actions['actions']['purge'] = array( 'class' => $action === 'purge' ? 'selected' : false, 'text' => wfMsg( 'purge' ), 'href' => $title->getLocalUrl( 'action=purge' ) ); } return true; } }
<?php
/**
* An extension that adds a purge tab on each page
*
* @author Ævar Arnfjörð Bjarmason <[email protected]>
* @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*
* This is a fork of the original see https://www.mediawiki.org/wiki/Extension:Purge
* Updated by Tom Hutchison to use proper i18n json files
* Changed extension hook to SkinTemplateNavigation
* Fixed ExtensionCredits to use the preferred descriptionmg
* version 1.0.0
*/

if( !defined( 'MEDIAWIKI' ) ) {
echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
die( 1 );
}

$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => 'Purge',
'author' => 'Tom Hutchison',
'url' => 'https://github.com/Hutchy68/Purge',
'descriptionmsg' => 'descriptionmsg',
'version' => '1.0.0',
'license-name' => "GPL-2.0+",
);

$wgMessagesDirs['Purge'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['Purge'] = __DIR__ . '/Purge.i18n.php';

$wgHooks['SkinTemplateNavigation'][] = 'PurgeActionExtension::contentHook';

class PurgeActionExtension{
public static function contentHook( $skin, array &$content_actions ) {
global $wgRequest, $wgUser;
// Use getRelevantTitle if present so that this will work on some special pages
$title = method_exists( $skin, 'getRelevantTitle' ) ?
$skin->getRelevantTitle() : $skin->getTitle();
if ( $title->getNamespace() !== NS_SPECIAL && $wgUser->isAllowed( 'purge' ) ) {
$action = $wgRequest->getText( 'action' );

$content_actions['actions']['purge'] = array(
'class' => $action === 'purge' ? 'selected' : false,
'text' => wfMessage( 'purge' )->text(),
'href' => $title->getLocalUrl( 'action=purge' )
);
}

return true;
}
}