r48182 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48181‎ | r48182 | r48183 >
Date:20:05, 8 March 2009
Author:ashley
Status:deferred
Tags:
Comment:
SystemGifts: cleanup & XHTML fixes
Modified paths:
  • /trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManager.php
@@ -15,10 +15,10 @@
1616 * @param $par Mixed: parameter passed to the page or null
1717 */
1818 public function execute( $par ){
19 - global $wgUser, $wgOut, $wgRequest, $wgSiteView, $IP, $wgScriptPath;
20 - wfLoadExtensionMessages('SystemGifts');
 19+ global $wgUser, $wgOut, $wgRequest, $wgScriptPath;
 20+ wfLoadExtensionMessages( 'SystemGifts' );
2121
22 - $wgOut->setPageTitle( wfMsg('systemgiftmanager') );
 22+ $wgOut->setPageTitle( wfMsg( 'systemgiftmanager' ) );
2323
2424 # If the user doesn't have the required 'awardsmanage' permission, display an error
2525 if( !$wgUser->isAllowed( 'awardsmanage' ) ) {
@@ -42,33 +42,33 @@
4343 .view-form { font-weight:800; font-size:12px; font-color:#666666; }
4444 .view-status { font-weight:800; font-size:12px; background-color:#FFFB9B; color:#666666; padding:5px; margin-bottom:5px; }
4545 </style>";
46 - $wgOut->addHTML($css);
 46+ $wgOut->addHTML( $css );
4747
4848 if( $wgRequest->wasPosted() ){
4949 $g = new SystemGifts();
5050
5151 if( !( $_POST['id'] ) ){
5252 $gift_id = $g->addGift(
53 - $wgRequest->getVal('gift_name'), $wgRequest->getVal('gift_description'),
54 - $wgRequest->getVal('gift_category'), $wgRequest->getVal('gift_threshold')
 53+ $wgRequest->getVal( 'gift_name' ), $wgRequest->getVal( 'gift_description' ),
 54+ $wgRequest->getVal( 'gift_category' ), $wgRequest->getVal( 'gift_threshold' )
5555 );
56 - $wgOut->addHTML('<span class="view-status">'.wfMsg('ga-created').'</span><br /><br />');
 56+ $wgOut->addHTML( '<span class="view-status">'.wfMsg( 'ga-created' ).'</span><br /><br />' );
5757 } else {
58 - $gift_id = $wgRequest->getVal('id');
59 - $g->updateGift($gift_id,
60 - $wgRequest->getVal('gift_name'), $wgRequest->getVal('gift_description'),
61 - $wgRequest->getVal('gift_category'), $wgRequest->getVal('gift_threshold')
 58+ $gift_id = $wgRequest->getVal( 'id' );
 59+ $g->updateGift( $gift_id,
 60+ $wgRequest->getVal( 'gift_name' ), $wgRequest->getVal( 'gift_description' ),
 61+ $wgRequest->getVal( 'gift_category' ), $wgRequest->getVal( 'gift_threshold' )
6262 );
63 - $wgOut->addHTML('<span class="view-status">'.wfMsg('ga-saved').'</span><br /><br />');
 63+ $wgOut->addHTML( '<span class="view-status">'.wfMsg( 'ga-saved' ).'</span><br /><br />' );
6464 }
6565 $g->update_system_gifts();
66 - $wgOut->addHTML( $this->displayForm($gift_id) );
 66+ $wgOut->addHTML( $this->displayForm( $gift_id ) );
6767 } else {
6868 $gift_id = $wgRequest->getVal( 'id' );
6969 if( $gift_id || $wgRequest->getVal( 'method' ) == 'edit' ){
70 - $wgOut->addHTML( $this->displayForm($gift_id) );
 70+ $wgOut->addHTML( $this->displayForm( $gift_id ) );
7171 } else {
72 - $wgOut->addHTML('<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:SystemGiftManager&method=edit">'.wfMsg('ga-addnew').'</a></b></div><p>');
 72+ $wgOut->addHTML( '<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:SystemGiftManager&method=edit">'.wfMsg( 'ga-addnew' ).'</a></b></div><p>' );
7373 $wgOut->addHTML( $this->displayGiftList() );
7474 }
7575 }
@@ -78,7 +78,7 @@
7979 global $wgScriptPath;
8080 $output = ''; // Prevent E_NOTICE
8181 $per_page = 10;
82 - $gifts = SystemGifts::getGiftList($per_page, $page);
 82+ $gifts = SystemGifts::getGiftList( $per_page, $page );
8383 if( $gifts ){
8484 foreach( $gifts as $gift ) {
8585 $output .= '<div class="Item">
@@ -92,42 +92,42 @@
9393 function displayForm( $gift_id ){
9494 global $wgUploadPath, $wgScriptPath;
9595
96 - $form = '<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:SystemGiftManager">'.wfMsg('ga-viewlist').'</a></b></div><p>';
 96+ $form = '<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:SystemGiftManager">'.wfMsg( 'ga-viewlist' ).'</a></b></div><p>';
9797
98 - if( $gift_id ) $gift = SystemGifts::getGift($gift_id);
 98+ if( $gift_id ) $gift = SystemGifts::getGift( $gift_id );
9999
100 - $form .= '<form action="" method="POST" enctype="multipart/form-data" name="gift">';
 100+ $form .= '<form action="" method="post" enctype="multipart/form-data" name="gift">';
101101 $form .= '<table border="0" cellpadding="5" cellspacing="0" width="500">';
102102 $form .= '<tr>
103 - <td width="200" class="view-form">'.wfMsg('ga-giftname').'</td>
 103+ <td width="200" class="view-form">'.wfMsg( 'ga-giftname' ).'</td>
104104 <td width="695"><input type="text" size="45" class="createbox" name="gift_name" value="'. $gift['gift_name'] . '"/></td>
105105 </tr>
106106 <tr>
107 - <td width="200" class="view-form" valign="top">'.wfMsg('ga-giftdesc').'</td>
 107+ <td width="200" class="view-form" valign="top">'.wfMsg( 'ga-giftdesc' ).'</td>
108108 <td width="695"><textarea class="createbox" name="gift_description" rows="2" cols="30">'. $gift['gift_description'] . '</textarea></td>
109109 </tr>
110110 <tr>
111 - <td width="200" class="view-form">'.wfMsg('ga-gifttype').'</td>
 111+ <td width="200" class="view-form">'.wfMsg( 'ga-gifttype' ).'</td>
112112 <td width="695">
113113 <select name="gift_category">';
114114 $g = new SystemGifts();
115115 foreach( $g->categories as $category => $id ){
116 - $form .= '<option ' . ( ( $gift['gift_category'] == $id ) ? 'selected' : '' ) . " value=\"{$id}\">{$category}</option>";
 116+ $form .= '<option' . ( ( $gift['gift_category'] == $id ) ? ' selected="selected"' : '' ) . " value=\"{$id}\">{$category}</option>";
117117 }
118118 $form .= '</select>
119119 <tr>
120 - <td width="200" class="view-form">'.wfMsg('ga-threshold').'</td>
 120+ <td width="200" class="view-form">'.wfMsg( 'ga-threshold' ).'</td>
121121 <td width="695"><input type="text" size="25" class="createbox" name="gift_threshold" value="'. $gift['gift_threshold'] . '"/></td>
122122 </tr>
123123 <tr>';
124124
125125 if( $gift_id ){
126 - $gift_image = "<img src=\"{$wgUploadPath}/awards/" . SystemGifts::getGiftImage( $gift_id, 'l' ) . "\" border=\"0\" alt=\"gift\" />";
 126+ $gift_image = '<img src="'. $wgUploadPath .'/awards/' . SystemGifts::getGiftImage( $gift_id, 'l' ) . '" border="0" alt="gift" />';
127127 $form .= '<tr>
128128 <td width="200" class="view-form" valign="top">'.wfMsg('ga-giftimage').'</td>
129129 <td width="695">' . $gift_image . '
130130 <p>
131 - <a href="'.$wgScriptPath.'/index.php?title=Special:SystemGiftManagerLogo&gift_id=' . $gift_id . '">'.wfMsg('ga-img').'</a>
 131+ <a href="'.$wgScriptPath.'/index.php?title=Special:SystemGiftManagerLogo&gift_id=' . $gift_id . '">'.wfMsg( 'ga-img' ).'</a>
132132 </td>
133133 </tr>';
134134 }
@@ -135,8 +135,8 @@
136136 $form .= '<tr>
137137 <td colspan="2">
138138 <input type="hidden" name="id" value="' . $gift['gift_id'] . '">
139 - <input type="button" class="createbox" value="' . ( ( $gift['gift_id'] ) ? wfMsg('edit') : wfMsg('ga-create-gift') ) . '" size="20" onclick="document.gift.submit()" />
140 - <input type="button" class="createbox" value="'.wfMsg('cancel').'" size="20" onclick="history.go(-1)" />
 139+ <input type="button" class="createbox" value="' . ( ( $gift['gift_id'] ) ? wfMsg( 'edit' ) : wfMsg( 'ga-create-gift' ) ) . '" size="20" onclick="document.gift.submit()" />
 140+ <input type="button" class="createbox" value="'.wfMsg( 'cancel' ).'" size="20" onclick="history.go(-1)" />
141141 </td>
142142 </tr>
143143 </table>

Status & tagging log