http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89284

Revision: 89284
Author:   kaldari
Date:     2011-06-01 20:32:56 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
changing some var names to reflect current naming, fixing some tabs, adding 
some comments

Modified Paths:
--------------
    trunk/extensions/CentralNotice/CentralNotice.db.php
    trunk/extensions/CentralNotice/SpecialBannerListLoader.php
    trunk/extensions/CentralNotice/SpecialCentralNotice.php

Modified: trunk/extensions/CentralNotice/CentralNotice.db.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.db.php 2011-06-01 20:29:22 UTC 
(rev 89283)
+++ trunk/extensions/CentralNotice/CentralNotice.db.php 2011-06-01 20:32:56 UTC 
(rev 89284)
@@ -11,6 +11,7 @@
        /*
         * Return campaigns in the system within given constraints
         * By default returns enabled campaigns, if $enabled set to false, 
returns both enabled and disabled campaigns
+        * @return an array of ids
         */
        static function getCampaigns( $project = false, $language = false, 
$date = false, $enabled = true, $preferred = false, $location = false ) {
                global $wgCentralDBname;
@@ -120,6 +121,8 @@
 
        /*
         * Given one or more campaign ids, return all banners bound to them
+        * @param $campaigns An array of id numbers
+        * @return a 2D array of banners with associated weights and settings
         */
        static function selectBannersAssigned( $campaigns ) {
                global $wgCentralDBname;

Modified: trunk/extensions/CentralNotice/SpecialBannerListLoader.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerListLoader.php  2011-06-01 
20:29:22 UTC (rev 89283)
+++ trunk/extensions/CentralNotice/SpecialBannerListLoader.php  2011-06-01 
20:32:56 UTC (rev 89284)
@@ -56,24 +56,24 @@
         * Generate JSON for the specified site
         */
        function getJsonList() {
-               $templates = array();
+               $banners = array();
                
                // See if we have any preferred campaigns for this language and 
project
-               $notices = CentralNoticeDB::getCampaigns( $this->project, 
$this->language, null, 1, 1, $this->location );
+               $campaigns = CentralNoticeDB::getCampaigns( $this->project, 
$this->language, null, 1, 1, $this->location );
                
                // Quick short circuit to show preferred campaigns
-               if ( $notices ) {
+               if ( $campaigns ) {
                        // Pull banners
-                       $templates = CentralNoticeDB::selectBannersAssigned( 
$notices );
+                       $banners = CentralNoticeDB::selectBannersAssigned( 
$campaigns );
                }
 
                // Didn't find any preferred banners so do an old style lookup
-               if ( !$templates )  {
-                       $templates = CentralNotice::selectNoticeTemplates( 
+               if ( !$banners )  {
+                       $banners = CentralNotice::selectNoticeTemplates( 
                                $this->project, $this->language, 
$this->location );
                }
                
-               return FormatJson::encode( $templates );
+               return FormatJson::encode( $banners );
        }
        
 }

Modified: trunk/extensions/CentralNotice/SpecialCentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialCentralNotice.php     2011-06-01 
20:29:22 UTC (rev 89283)
+++ trunk/extensions/CentralNotice/SpecialCentralNotice.php     2011-06-01 
20:32:56 UTC (rev 89284)
@@ -1069,7 +1069,7 @@
         * Lookup function for active banners under a given 
language/project/location. This function is 
         * called by SpecialBannerListLoader::getJsonList() in order to build 
the banner list JSON for
         * each project.
-        * @return A 2D array of running banners with associated weights and 
settings
+        * @return a 2D array of running banners with associated weights and 
settings
         */
        static function selectNoticeTemplates( $project, $language, $location = 
null ) {
                global $wgCentralDBname;
@@ -1285,14 +1285,14 @@
         * Lookup the ID for a campaign based on the campaign name
         */
        public static function getNoticeId( $noticeName ) {
-                $dbr = wfGetDB( DB_SLAVE );
-                $eNoticeName = htmlspecialchars( $noticeName );
-                $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 
'not_name' => $eNoticeName ) );
-                if ( $row ) {
-                       return $row->not_id;
-                } else {
-                       return null;
-                }
+               $dbr = wfGetDB( DB_SLAVE );
+               $eNoticeName = htmlspecialchars( $noticeName );
+               $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 
'not_name' => $eNoticeName ) );
+               if ( $row ) {
+                       return $row->not_id;
+               } else {
+                       return null;
+               }
        }
        
        function getNoticeProjects( $noticeName ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to