Changeset 571748
- Timestamp:
- 07/13/2012 01:25:23 PM (14 years ago)
- Location:
- olimometer
- Files:
-
- 64 added
- 4 edited
-
tags/2.31 (added)
-
tags/2.31/LiberationSans-Regular.ttf (added)
-
tags/2.31/jscolor (added)
-
tags/2.31/jscolor/arrow.gif (added)
-
tags/2.31/jscolor/cross.gif (added)
-
tags/2.31/jscolor/demo.html (added)
-
tags/2.31/jscolor/hs.png (added)
-
tags/2.31/jscolor/hv.png (added)
-
tags/2.31/jscolor/jscolor.js (added)
-
tags/2.31/olimometer-class.php (added)
-
tags/2.31/olimometer.php (added)
-
tags/2.31/readme.txt (added)
-
tags/2.31/screenshot-1.jpg (added)
-
tags/2.31/screenshot-2.jpg (added)
-
tags/2.31/screenshot-3.jpg (added)
-
tags/2.31/screenshot-4.jpg (added)
-
tags/2.31/skins (added)
-
tags/2.31/skins.php (added)
-
tags/2.31/skins.xml (added)
-
tags/2.31/skins/oli-bold-chunky (added)
-
tags/2.31/skins/oli-bold-chunky/bold-chunky-bar.png (added)
-
tags/2.31/skins/oli-bold-chunky/bold-chunky-bottom.png (added)
-
tags/2.31/skins/oli-bold-chunky/bold-chunky-top.png (added)
-
tags/2.31/skins/oli-default (added)
-
tags/2.31/skins/oli-default/therm_bar_empty.png (added)
-
tags/2.31/skins/oli-default/therm_bulb.png (added)
-
tags/2.31/skins/oli-default/therm_top.png (added)
-
tags/2.31/skins/oli-ourprogress-blue (added)
-
tags/2.31/skins/oli-ourprogress-blue/therm_bar_empty.png (added)
-
tags/2.31/skins/oli-ourprogress-blue/therm_bulb.png (added)
-
tags/2.31/skins/oli-ourprogress-blue/therm_top.png (added)
-
tags/2.31/skins/oli-ourprogress-green (added)
-
tags/2.31/skins/oli-ourprogress-green/therm_bar_empty.png (added)
-
tags/2.31/skins/oli-ourprogress-green/therm_bulb.png (added)
-
tags/2.31/skins/oli-ourprogress-green/therm_top.png (added)
-
tags/2.31/skins/oli-ourprogress-red (added)
-
tags/2.31/skins/oli-ourprogress-red/therm_bar_empty.png (added)
-
tags/2.31/skins/oli-ourprogress-red/therm_bulb.png (added)
-
tags/2.31/skins/oli-ourprogress-red/therm_top.png (added)
-
tags/2.31/skins/oli-progpress-black (added)
-
tags/2.31/skins/oli-progpress-black/left.png (added)
-
tags/2.31/skins/oli-progpress-black/middle.png (added)
-
tags/2.31/skins/oli-progpress-black/right.png (added)
-
tags/2.31/skins/oli-rounded (added)
-
tags/2.31/skins/oli-rounded/rounded_bar.png (added)
-
tags/2.31/skins/oli-rounded/rounded_bottom.png (added)
-
tags/2.31/skins/oli-rounded/rounded_top.png (added)
-
tags/2.31/skins/oli-thinblackhorizontal (added)
-
tags/2.31/skins/oli-thinblackhorizontal/left.png (added)
-
tags/2.31/skins/oli-thinblackhorizontal/middle.png (added)
-
tags/2.31/skins/oli-thinblackhorizontal/right.png (added)
-
tags/2.31/skins/oli-thinbluehorizontal (added)
-
tags/2.31/skins/oli-thinbluehorizontal/left.png (added)
-
tags/2.31/skins/oli-thinbluehorizontal/middle.png (added)
-
tags/2.31/skins/oli-thinbluehorizontal/right.png (added)
-
tags/2.31/skins/oli-thinredhorizontal (added)
-
tags/2.31/skins/oli-thinredhorizontal/left.png (added)
-
tags/2.31/skins/oli-thinredhorizontal/middle.png (added)
-
tags/2.31/skins/oli-thinredhorizontal/right.png (added)
-
tags/2.31/skins/oli-watermaster (added)
-
tags/2.31/skins/oli-watermaster/watermaster-bar.png (added)
-
tags/2.31/skins/oli-watermaster/watermaster-bottom.png (added)
-
tags/2.31/skins/oli-watermaster/watermaster-top.png (added)
-
tags/2.31/thermometer.php (added)
-
trunk/olimometer-class.php (modified) (5 diffs)
-
trunk/olimometer.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/thermometer.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
olimometer/trunk/olimometer-class.php
r571083 r571748 32 32 public $olimometer_paypal_signature; 33 33 public $olimometer_paypal_extra_value = 0.00; 34 public $olimometer_number_format = 0; 34 35 35 36 private $olimometer_table_name = "olimometer_olimometers"; … … 65 66 $this->olimometer_paypal_signature = $query_results['olimometer_paypal_signature']; 66 67 $this->olimometer_paypal_extra_value = $query_results['olimometer_paypal_extra_value']; 68 $this->olimometer_number_format = $query_results['olimometer_number_format']; 67 69 68 70 } … … 108 110 'olimometer_paypal_password' => $this->olimometer_paypal_password, 109 111 'olimometer_paypal_signature' => $this->olimometer_paypal_signature, 110 'olimometer_paypal_extra_value' => $this->olimometer_paypal_extra_value ) ); 112 'olimometer_paypal_extra_value' => $this->olimometer_paypal_extra_value, 113 'olimometer_number_format' => $this->olimometer_number_format 114 ) ); 111 115 112 116 // Find out the olimometer_id of the record just created and save it to the object. … … 135 139 'olimometer_paypal_password' => $this->olimometer_paypal_password, 136 140 'olimometer_paypal_signature' => $this->olimometer_paypal_signature, 137 'olimometer_paypal_extra_value' => $this->olimometer_paypal_extra_value 141 'olimometer_paypal_extra_value' => $this->olimometer_paypal_extra_value, 142 'olimometer_number_format' => $this->olimometer_number_format 138 143 ), 139 144 array( 'olimometer_id' => $this->olimometer_id ) … … 180 185 $the_olimometer_text = $the_olimometer_text." class='".$css_class."'"; 181 186 } 182 $the_olimometer_text = $the_olimometer_text." alt='Olimometer 2.3 1'>";187 $the_olimometer_text = $the_olimometer_text." alt='Olimometer 2.32'>"; 183 188 184 189 return $the_olimometer_text; -
olimometer/trunk/olimometer.php
r571083 r571748 6 6 Author: Oliver Shingler 7 7 Author URI: http://www.olivershingler.co.uk 8 Version: 2.3 18 Version: 2.32 9 9 */ 10 10 … … 124 124 $an_olimometer = new Olimometer(); 125 125 $an_olimometer->olimometer_id = $current_olimometer_id; 126 127 128 129 126 130 127 131 // Get values from form and dump in to the object … … 146 150 $an_olimometer->olimometer_paypal_signature = $_REQUEST['olimometer_paypal_signature']; 147 151 $an_olimometer->olimometer_paypal_extra_value = $_REQUEST['olimometer_paypal_extra_value']; 152 $an_olimometer->olimometer_number_format = $_REQUEST['olimometer_number_format']; 148 153 149 154 // Save it … … 417 422 ?>" size="40" aria-required="true" /> 418 423 <p><span class="description">Input the total amount you would like to raise.</span></p></td> 424 </tr> 425 426 <tr class="form-field form-required"> 427 <th scope="row" valign="top"><label for="name">Number Format</label></th> 428 <td> 429 <select name="olimometer_number_format"> 430 <option value="0" <?php if($current_olimometer->olimometer_number_format==0) { echo "SELECTED"; } ?>>1000</option> 431 <option value="1" <?php if($current_olimometer->olimometer_number_format==1) { echo "SELECTED"; } ?>>1,000</option> 432 <option value="2" <?php if($current_olimometer->olimometer_number_format==2) { echo "SELECTED"; } ?>>1000.00</option> 433 <option value="3" <?php if($current_olimometer->olimometer_number_format==3) { echo "SELECTED"; } ?>>1,000.00</option> 434 </select> 435 <p><span class="description">Please choose a display format for your values.</span></p></td> 419 436 </tr> 420 437 … … 974 991 ************************/ 975 992 global $olimometer_db_version; 976 $olimometer_db_version = "2.3 0";993 $olimometer_db_version = "2.32"; 977 994 978 995 function olimometer_install() { … … 1004 1021 olimometer_paypal_password VARCHAR(255), 1005 1022 olimometer_paypal_signature VARCHAR(255), 1023 olimometer_number_format tinyint, 1006 1024 UNIQUE KEY olimometer_id (olimometer_id) 1007 1025 );"; … … 1030 1048 // Yes it has! 1031 1049 // If currently installed database version is less than current version required for this plugin, then we need to upgrade 1032 $required_db_version = 2.3 0;1050 $required_db_version = 2.32; 1033 1051 $installed_db_version = get_option("olimometer_db_version"); 1034 1052 if($installed_db_version < $required_db_version) { -
olimometer/trunk/readme.txt
r571083 r571748 105 105 == Changelog == 106 106 107 = 2.32 = 108 * Values can be formatted, for example with decimal places and a comma to delimit thousands. See the Number Format option on the settings page. 109 107 110 = 2.31 = 108 111 * Fixed bug causing image creation failure on some systems (literal path requirements) … … 205 208 == Upgrade Notice == 206 209 210 = 2.32 = 211 * Values can be formatted, for example with decimal places and a comma to delimit thousands. See the Number Format option on the settings page. 212 207 213 = 2.31 = 208 214 * Fixed bug causing image creation failure on some systems (literal path requirements) -
olimometer/trunk/thermometer.php
r571083 r571748 65 65 $font_height = $olimometer_to_display->olimometer_font_height; 66 66 $suffix = $olimometer_to_display->olimometer_suffix; 67 68 // Value layout array: 69 70 // No dp, no thousands 71 $olimometer_display_array[0][0] = 0; 72 $olimometer_display_array[0][1] = ''; 73 // no dp, thousands marker 74 $olimometer_display_array[1][0] = 0; 75 $olimometer_display_array[1][1] = ','; 76 // 2dp, no thousands 77 $olimometer_display_array[2][0] = 2; 78 $olimometer_display_array[2][1] = ''; 79 // 2dp, thousands marker 80 $olimometer_display_array[3][0] = 2; 81 $olimometer_display_array[3][1] = ','; 82 83 // Display converted values: 84 $olimometer_display_dp = $olimometer_display_array[$olimometer_to_display->olimometer_number_format][0]; 85 $olimometer_display_thousands = $olimometer_display_array[$olimometer_to_display->olimometer_number_format][1]; 86 //$olimometer_display_dp = 2; 87 //$olimometer_display_thousands = ','; 88 $display_total_value = number_format($total_value,$olimometer_display_dp,'.',$olimometer_display_thousands); 89 $display_progress_value = number_format($progress_value,$olimometer_display_dp,'.',$olimometer_display_thousands); 90 $display_zero = number_format(0,$olimometer_display_dp,'.',$olimometer_display_thousands); 91 67 92 68 93 … … 153 178 // Are we showing the target labels? 154 179 if($show_target == 1) { 155 $the_box = calculateTextBox($currency_symbol.$ total_value.$suffix_symbol, $font_name, $font_height, 0);180 $the_box = calculateTextBox($currency_symbol.$display_total_value.$suffix_symbol, $font_name, $font_height, 0); 156 181 //$the_box = imagettfbboxextended($font_height, 0, $font_name, $currency_symbol.$total_value.$suffix_symbol); 157 182 $top_text_width = $the_box["width"]; … … 164 189 if($show_progress == 1) { 165 190 // Calculate the width of it 166 $the_box2 = calculateTextBox($progress_label.' '.$currency_symbol.$ progress_value.$suffix_symbol, $font_name, $font_height, 0);191 $the_box2 = calculateTextBox($progress_label.' '.$currency_symbol.$display_progress_value.$suffix_symbol, $font_name, $font_height, 0); 167 192 //$the_box2 = imagettfbboxextended($font_height, 0, $font_name, $progress_label.' '.$currency_symbol.$progress_value.$suffix_symbol); 168 193 $progress_text_width = $the_box2["width"] + 2; … … 217 242 // - Add value labels to the right of the thermometer 218 243 if($show_target == 1) { 219 imagettftext($new_image, $font_height, 0, 0, $font_height+2, $text_colour_rgb, $font_name, $currency_symbol. '0'.$suffix_symbol);220 imagettftext($new_image, $font_height, 0, $image_height-$top_text_width, $font_height+2, $text_colour_rgb, $font_name, $currency_symbol.$ total_value.$suffix_symbol);244 imagettftext($new_image, $font_height, 0, 0, $font_height+2, $text_colour_rgb, $font_name, $currency_symbol.$display_zero.$suffix_symbol); 245 imagettftext($new_image, $font_height, 0, $image_height-$top_text_width, $font_height+2, $text_colour_rgb, $font_name, $currency_symbol.$display_total_value.$suffix_symbol); 221 246 } 222 247 // - If the Progress label is needed, show it! … … 231 256 $progress_label_x = ($new_image_width-$progress_text_width)/2; 232 257 } 233 imagettftext($new_image, $font_height, 0, $progress_label_x, $therm_bulb_height+$top_of_therm+$font_height+5, $text_colour_rgb, $font_name, $progress_label.' '.$currency_symbol.$ progress_value.$suffix_symbol);258 imagettftext($new_image, $font_height, 0, $progress_label_x, $therm_bulb_height+$top_of_therm+$font_height+5, $text_colour_rgb, $font_name, $progress_label.' '.$currency_symbol.$display_progress_value.$suffix_symbol); 234 259 //imagettftext($new_image, $font_height, 0, 30, $therm_bulb_height+4, $text_colour_rgb, $font_name, "Testing"); 235 260 } … … 320 345 // Are we showing the target labels? 321 346 if($show_target == 1) { 322 $the_box = calculateTextBox($currency_symbol.$ total_value.$suffix_symbol, $font_name, $font_height, 0);347 $the_box = calculateTextBox($currency_symbol.$display_total_value.$suffix_symbol, $font_name, $font_height, 0); 323 348 //$the_box = imagettfbboxextended($font_height, 0, $font_name, $currency_symbol.$total_value.$suffix_symbol); 324 349 $top_text_width = $the_box["width"]; … … 331 356 if($show_progress == 1) { 332 357 // Calculate the width of it 333 $the_box2 = calculateTextBox($progress_label.' '.$currency_symbol.$ progress_value.$suffix_symbol, $font_name, $font_height, 0);358 $the_box2 = calculateTextBox($progress_label.' '.$currency_symbol.$display_progress_value.$suffix_symbol, $font_name, $font_height, 0); 334 359 //$the_box2 = imagettfbboxextended($font_height, 0, $font_name, $progress_label.' '.$currency_symbol.$progress_value.$suffix_symbol); 335 360 $progress_text_width = $the_box2["width"] + 2; … … 368 393 // - Add value labels to the right of the thermometer 369 394 if($show_target == 1) { 370 imagettftext($new_image, $font_height, 0, $therm_text_xpos, $font_height*1.2, $text_colour_rgb, $font_name, $currency_symbol.$ total_value.$suffix_symbol);371 imagettftext($new_image, $font_height, 0, $therm_text_xpos, $bulb_ypos+10, $text_colour_rgb, $font_name, $currency_symbol. '0'.$suffix_symbol);395 imagettftext($new_image, $font_height, 0, $therm_text_xpos, $font_height*1.2, $text_colour_rgb, $font_name, $currency_symbol.$display_total_value.$suffix_symbol); 396 imagettftext($new_image, $font_height, 0, $therm_text_xpos, $bulb_ypos+10, $text_colour_rgb, $font_name, $currency_symbol.$display_zero.$suffix_symbol); 372 397 } 373 398 // - If the Progress label is needed, show it! 374 399 if($show_progress == 1) { 375 imagettftext($new_image, $font_height, 0, 0, $image_height-(ceil($font_height/2)), $text_colour_rgb, $font_name, $progress_label.' '.$currency_symbol.$ progress_value.$suffix_symbol);400 imagettftext($new_image, $font_height, 0, 0, $image_height-(ceil($font_height/2)), $text_colour_rgb, $font_name, $progress_label.' '.$currency_symbol.$display_progress_value.$suffix_symbol); 376 401 } 377 402 // - Set transparancy if required using supplied background colour as mask
Note: See TracChangeset
for help on using the changeset viewer.