http://www.mediawiki.org/wiki/Special:Code/MediaWiki/59107
Revision: 59107 Author: ashley Date: 2009-11-15 18:07:12 +0000 (Sun, 15 Nov 2009) Log Message: ----------- SocialProfile: cleanup to UserWelcome Modified Paths: -------------- trunk/extensions/SocialProfile/UserWelcome/UserWelcome.php Modified: trunk/extensions/SocialProfile/UserWelcome/UserWelcome.php =================================================================== --- trunk/extensions/SocialProfile/UserWelcome/UserWelcome.php 2009-11-15 18:05:39 UTC (rev 59106) +++ trunk/extensions/SocialProfile/UserWelcome/UserWelcome.php 2009-11-15 18:07:12 UTC (rev 59107) @@ -5,28 +5,35 @@ * * @file * @ingroup Extensions - * @author Wikia, Inc. - * @version 1.0 + * @author David Pean <david.p...@gmail.com> + * @author Jack Phoenix <j...@countervandalism.net> + * @version 1.2 * @link http://www.mediawiki.org/wiki/Extension:UserWelcome Documentation * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ -$wgHooks['ParserFirstCallInit'][] = 'wfWelcomeUser'; +if( !defined( 'MEDIAWIKI' ) ) { + die( "This is not a valid entry point.\n" ); +} // Extension credits that show up on Special:Version $wgExtensionCredits['parserhook'][] = array( 'name' => 'UserWelcome', - 'version' => '1.1', - 'author' => 'Wikia New York Team', + 'version' => '1.2', + 'author' => array( 'David Pean', 'Jack Phoenix' ), 'description' => 'Adds <tt><welcomeUser></tt> tag to display user-specific social info to logged-in users', 'description-msg' => 'userwelcome-desc', 'url' => 'http://www.mediawiki.org/wiki/Extension:UserWelcome', ); +$wgHooks['ParserFirstCallInit'][] = 'wfWelcomeUser'; +/** + * Register <welcomeUser /> tag with the parser + * @param $parser Object: instance of Parser + * @return true + */ function wfWelcomeUser( &$parser ) { - global $wgOut, $wgScriptPath; $parser->setHook( 'welcomeUser', 'getWelcomeUser' ); - $wgOut->addStyle( $wgScriptPath . '/extensions/SocialProfile/UserWelcome/UserWelcome.css' ); return true; } @@ -41,9 +48,12 @@ } function getWelcome() { - global $wgUser, $wgUploadPath; + global $wgUser, $wgOut, $wgScriptPath, $wgUploadPath; wfLoadExtensionMessages( 'UserWelcome' ); + // Add CSS + $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/SocialProfile/UserWelcome/UserWelcome.css' ); + // Get stats and user level $stats = new UserStats( $wgUser->getID(), $wgUser->getName() ); $stats_data = $stats->getUserStats(); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs