mediawiki-voteny/VoteNY.php
Jack Phoenix 33f5015197 Version 2.7: various JS fixes and stuff
* CSS and JS are now separate RL modules
* JS rewritten to use jQuery instead of sajax
* Fixed a scoping bug from the previous patchset
* Fixed other scoping bugs so that you can revoke your vote w/o reloading the page, no matter what
* JS module is not loaded for users w/o the 'voteny' user right
* JS is not loaded on Special:TopRatings anymore, it was only loaded there ever back when this extension had inline JS to prevent over 9000 JS errors, plus it wouldn't have worked because wgArticleId is 0 for special pages
* Special page alias file added

Change-Id: I6668238a0ab6272b0a7b3b167832ebb2d3abe2c2
2015-05-14 00:00:34 +03:00

71 lines
2.6 KiB
PHP

<?php
/**
* Vote extension - JavaScript-based voting with the <vote> tag
*
* @file
* @ingroup Extensions
* @author Aaron Wright <aaron.wright@gmail.com>
* @author David Pean <david.pean@gmail.com>
* @author Jack Phoenix <jack@countervandalism.net>
* @link https://www.mediawiki.org/wiki/Extension:VoteNY Documentation
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*/
// Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Vote',
'version' => '2.7',
'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ),
'descriptionmsg' => 'voteny-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:VoteNY'
);
// Path to Vote extension files
$wgVoteDirectory = "$IP/extensions/VoteNY";
// New user right
$wgAvailableRights[] = 'voteny';
$wgGroupPermissions['*']['voteny'] = false; // Anonymous users cannot vote
$wgGroupPermissions['user']['voteny'] = true; // Registered users can vote
// AJAX functions needed by this extension
require_once 'Vote_AjaxFunctions.php';
// Autoload classes and set up i18n
$wgMessagesDirs['VoteNY'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['VoteNYAlias'] = __DIR__ . '/VoteNY.alias.php';
$wgExtensionMessagesFiles['VoteNYMagic'] = __DIR__ . '/VoteNY.i18n.magic.php';
$wgAutoloadClasses['Vote'] = __DIR__ . '/VoteClass.php';
$wgAutoloadClasses['VoteStars'] = __DIR__ . '/VoteClass.php';
// Set up the new special page, Special:TopRatings, which shows top rated pages
// based on given criteria
$wgAutoloadClasses['SpecialTopRatings'] = __DIR__ . '/SpecialTopRatings.php';
$wgSpecialPages['TopRatings'] = 'SpecialTopRatings';
// Hooked functions
$wgAutoloadClasses['VoteHooks'] = __DIR__ . '/VoteHooks.php';
$wgHooks['ParserFirstCallInit'][] = 'VoteHooks::registerParserHook';
$wgHooks['RenameUserSQL'][] = 'VoteHooks::onUserRename';
$wgHooks['ParserGetVariableValueSwitch'][] = 'VoteHooks::assignValueToMagicWord';
$wgHooks['MagicWordwgVariableIDs'][] = 'VoteHooks::registerVariableId';
$wgHooks['ParserFirstCallInit'][] = 'VoteHooks::setupNumberOfVotesPageParser';
$wgHooks['LoadExtensionSchemaUpdates'][] = 'VoteHooks::addTable';
// ResourceLoader support for MediaWiki 1.17+
$wgResourceModules['ext.voteNY.styles'] = array(
'styles' => 'Vote.css',
'localBasePath' => __DIR__,
'remoteExtPath' => 'VoteNY',
'position' => 'top' // available since r85616
);
$wgResourceModules['ext.voteNY.scripts'] = array(
'scripts' => 'Vote.js',
'messages' => array( 'voteny-link', 'voteny-unvote-link' ),
'localBasePath' => __DIR__,
'remoteExtPath' => 'VoteNY'
);