Ran stylize.php, manually fixed documentation, etc.

Change-Id: I8e684d00bf5142eff70d45d64e4c29cfc380749d
This commit is contained in:
Jack Phoenix 2014-09-21 20:00:51 +03:00
parent 89abe6bffb
commit 7678ee7c4b
4 changed files with 78 additions and 69 deletions

View file

@ -24,7 +24,7 @@ class SpecialTopRatings extends IncludableSpecialPage {
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the special page or null
* @param mixed|null $par Parameter passed to the special page or null
*/
public function execute( $par ) {
// Set the page title, robot policies, etc.

View file

@ -14,7 +14,7 @@ class Vote {
/**
* Constructor
*
* @param $pageID Integer: article ID number
* @param int $pageID Article ID number
*/
public function __construct( $pageID ) {
global $wgUser;
@ -28,7 +28,7 @@ class Vote {
* Counts all votes, fetching the data from memcached if available
* or from the database if memcached isn't available
*
* @return Integer: amount of votes
* @return int Amount of votes
*/
function count() {
global $wgMemc;
@ -61,7 +61,8 @@ class Vote {
/**
* Gets the average score of all votes
* @return Integer: formatted average number of votes (something like 3.50)
*
* @return int Formatted average number of votes (something like 3.50)
*/
function getAverageVote() {
global $wgMemc;
@ -142,7 +143,8 @@ class Vote {
/**
* Inserts a new vote into the Vote database table
* @param $voteValue
*
* @param int $voteValue
*/
function insert( $voteValue ) {
global $wgRequest;
@ -179,7 +181,7 @@ class Vote {
/**
* Checks if a user has already voted
*
* @return Boolean|Integer: false if s/he hasn't, otherwise returns the
* @return bool|int False if s/he hasn't, otherwise returns the
* value of 'vote_value' column from Vote DB table
*/
function UserAlreadyVoted() {
@ -202,7 +204,8 @@ class Vote {
/**
* Displays the green voting box
* @return Mixed: HTML output
*
* @return string HTML output
*/
function display() {
global $wgUser;
@ -254,8 +257,8 @@ class VoteStars extends Vote {
/**
* Displays voting stars
*
* @param $voted Boolean: has the user already voted? False by default
* @return Mixed: HTML output
* @param bool $voted Has the user already voted? False by default
* @return string HTML output
*/
function display( $voted = false ) {
global $wgUser;
@ -302,10 +305,11 @@ class VoteStars extends Vote {
/**
* Displays the actual star images, depending on the state of the user's mouse
* @param $id Integer: ID of the rating (div) element
* @param $rating Integer: average rating
* @param $voted Integer
* @return Mixed: generated <img> tag
*
* @param int $id ID of the rating (div) element
* @param int $rating Average rating
* @param int $voted
* @return string Generated <img> tag
*/
function displayStars( $id, $rating, $voted ) {
global $wgExtensionAssetsPath;
@ -353,6 +357,8 @@ class VoteStars extends Vote {
/**
* Displays the average score for the current page
* and the total amount of votes.
*
* @return string
*/
function displayScore() {
$count = $this->count();

View file

@ -10,8 +10,8 @@ class VoteHooks {
/**
* Set up the <vote> parser hook.
*
* @param $parser Parser: instance of Parser
* @return Boolean: true
* @param Parser $parser
* @return bool
*/
public static function registerParserHook( &$parser ) {
$parser->setHook( 'vote', array( 'VoteHooks', 'renderVote' ) );
@ -21,10 +21,10 @@ class VoteHooks {
/**
* Callback function for registerParserHook.
*
* @param $input String: user-supplied input, unused
* @param $args Array: user-supplied arguments, unused
* @param $parser Parser: instance of Parser, unused
* @return String: HTML
* @param string $input User-supplied input, unused
* @param array $args User-supplied arguments
* @param Parser $parser Instance of Parser, unused
* @return string HTML
*/
public static function renderVote( $input, $args, $parser ) {
global $wgOut;
@ -54,7 +54,6 @@ class VoteHooks {
$output = null;
$title = $wgOut->getTitle();
if ( $title ) {
$articleID = $title->getArticleID();
switch( $type ) {
case 0:
@ -78,8 +77,8 @@ class VoteHooks {
/**
* For the Renameuser extension.
*
* @param $renameUserSQL
* @return Boolean: true
* @param RenameuserSQL $renameUserSQL
* @return bool
*/
public static function onUserRename( $renameUserSQL ) {
$renameUserSQL->tables['Vote'] = array( 'username', 'vote_user_id' );
@ -90,11 +89,11 @@ class VoteHooks {
* Assign a value to {{NUMBEROFVOTES}}. First we try memcached and if that
* fails, we fetch it directly from the database and cache it for 24 hours.
*
* @param $parser Parser
* @param Parser $parser
* @param $cache
* @param $magicWordId String: magic word ID
* @param $ret Integer: return value (number of votes)
* @return Boolean: true
* @param string $magicWordId Magic word ID
* @param int $ret Return value (number of votes)
* @return bool
*/
public static function assignValueToMagicWord( &$parser, &$cache, &$magicWordId, &$ret ) {
global $wgMemc;
@ -135,11 +134,13 @@ class VoteHooks {
/**
* Main function to get the number of votes for a specific page
* @param Title $title: page to get votes for
* @return integer: number of votes for the given page
*
* @param Title $title Page to get votes for
* @return int Number of votes for the given page
*/
public static function getNumberOfVotesPage( Title $title ) {
global $wgMemc;
$id = $title->getArticleID();
$key = wfMemcKey( 'vote', 'magic-word-page', $id );
@ -165,9 +166,10 @@ class VoteHooks {
/**
* Hook for parser function {{NUMBEROFVOTESPAGE:<page>}}
*
* @param Parser $parser
* @param string $pagename
* @return integer
* @param string $pagename Page name
* @return int Amount of votes for the given page
*/
static function getNumberOfVotesPageParser( $parser, $pagename ) {
$title = Title::newFromText( $pagename );
@ -182,8 +184,8 @@ class VoteHooks {
/**
* Register the magic word ID for {{NUMBEROFVOTES}} and {{NUMBEROFVOTESPAGE}}
*
* @param $variableIds Array: array of pre-existing variable IDs
* @return Boolean: true
* @param array $variableIds Array of pre-existing variable IDs
* @return bool
*/
public static function registerVariableId( &$variableIds ) {
$variableIds[] = 'NUMBEROFVOTES';
@ -193,8 +195,9 @@ class VoteHooks {
/**
* Hook to setup parser function {{NUMBEROFVOTESPAGE:<page>}}
*
* @param Parser $parser
* @return boolean
* @return bool
*/
static function setupNumberOfVotesPageParser( &$parser ) {
$parser->setFunctionHook( 'NUMBEROFVOTESPAGE', 'VoteHooks::getNumberOfVotesPageParser', SFH_NO_HASH );
@ -205,12 +208,12 @@ class VoteHooks {
* Creates the necessary database table when the user runs
* maintenance/update.php.
*
* @param $updater DatabaseUpdater
* @return Boolean: true
* @param DatabaseUpdater $updater
* @return bool
*/
public static function addTable( $updater ) {
$dbt = $updater->getDB()->getType();
$file = dirname( __FILE__ ) . "/vote.$dbt";
$file = __DIR__ . "/vote.$dbt";
if ( file_exists( $file ) ) {
$updater->addExtensionUpdate( array( 'addTable', 'Vote', $file, true ) );
} else {