Changeset 2967794
- Timestamp:
- 09/16/2023 01:21:34 PM (3 years ago)
- Location:
- donation-thermometer/trunk
- Files:
-
- 3 edited
-
donation_therm.php (modified) (1 diff)
-
includes/therm_svg.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
donation-thermometer/trunk/donation_therm.php
r2967769 r2967794 4 4 Plugin URI: https://rhewlif.xyz/thermometer 5 5 Description: Displays customisable thermometers for tracking donations using the shortcode <code>[thermometer raised=?? target=??]</code>. Shortcodes for raised/target/percentage text values are also available for posts/pages/text widgets: <code>[therm_r]</code> / <code>[therm_t]</code> / <code>[therm_%]</code>. 6 Version: 2.2. 36 Version: 2.2.4 7 7 Author: Henry Patton 8 8 Text Domain: donation-thermometer -
donation-thermometer/trunk/includes/therm_svg.php
r2967769 r2967794 93 93 $colorListA = array($thermProperties['fill']); 94 94 } 95 95 96 if($thermProperties['orientation'] == 'landscape') { 96 $gradient = '<linearGradient id="ThermGradient" x1="0" x2="1" y1="0" y2="0"> 97 $gradID = 'ThermGrad_'. esc_html(trim($colorListA[0])) . '_' . $thermProperties['fill2']; 98 $gradient = '<linearGradient id="'.$gradID.'" x1="0" x2="1" y1="0" y2="0"> 97 99 <stop style="stop-color: ' . esc_html(trim($colorListA[0])) . '" offset="0%" /> 98 100 <stop style="stop-color: ' . $thermProperties['fill2'] . '" offset="100%" /> … … 100 102 } 101 103 else{ 102 $gradient = '<linearGradient id="ThermGradient" x1="0" x2="0" y1="0" y2="1"> 104 $gradID = 'ThermGrad_'. $thermProperties['fill2'] . '_' . esc_html(trim($colorListA[0])); 105 $gradient = '<linearGradient id="'.$gradID.'" x1="0" x2="0" y1="0" y2="1"> 103 106 <stop style="stop-color: ' . $thermProperties['fill2'] . '" offset="0%" /> 104 107 <stop style="stop-color: ' . esc_html(trim($colorListA[0])) . '" offset="100%" /> … … 378 381 if($raisedTotal > $targetTotal){ 379 382 #echo '<path d="M 280 41.5 C 280 51.5 275.5 59.5 269.5 59.5 L 54.5 59.5 C 50.5 64 43.5 66.5 37.5 66.5 C 23.5 66.5 12.5 55.5 12.5 41.5 C 12.5 27.5 23.5 16.5 37.5 16.5 C 43.5 16.5 50.5 19.5 54.5 23.5 L 269.5 23.5 C 275.5 23.5 280 31.5 280 41.5" style="stroke-width: 0;" fill="'.esc_html(trim($colorListA[$i])).'"/>'; 380 echo '<path d="M 280 41.5 C 280 51.5 275.5 59.5 269.5 59.5 L 54.5 59.5 C 50.5 64 43.5 66.5 37.5 66.5 C 23.5 66.5 12.5 55.5 12.5 41.5 C 12.5 27.5 23.5 16.5 37.5 16.5 C 43.5 16.5 50.5 19.5 54.5 23.5 L 269.5 23.5 C 275.5 23.5 280 31.5 280 41.5" style="stroke-width: 0;" fill="url(# ThermGradient)"/>';383 echo '<path d="M 280 41.5 C 280 51.5 275.5 59.5 269.5 59.5 L 54.5 59.5 C 50.5 64 43.5 66.5 37.5 66.5 C 23.5 66.5 12.5 55.5 12.5 41.5 C 12.5 27.5 23.5 16.5 37.5 16.5 C 43.5 16.5 50.5 19.5 54.5 23.5 L 269.5 23.5 C 275.5 23.5 280 31.5 280 41.5" style="stroke-width: 0;" fill="url(#'.$gradID.')"/>'; 381 384 } 382 385 else{ 383 386 #echo '<path d="M '.$newThermLevel.' '.$rightM.' L 54.5 '.$rightM.' C 50.5 64 43.5 66.5 37.5 66.5 C 23.5 66.5 12.5 55.5 12.5 41.5 C 12.5 27.5 23.5 16.5 37.5 16.5 C 43.5 16.5 50.5 19.5 54.5 '.$leftM.' L '.$newThermLevel.' '.$leftM.' L '.$newThermLevel.' '.$rightM.'" style="stroke-width: 0;" fill="'.esc_html(trim($colorListA[$i])).'"/>'; 384 echo '<path d="M '.$newThermLevel.' '.$rightM.' L 54.5 '.$rightM.' C 50.5 64 43.5 66.5 37.5 66.5 C 23.5 66.5 12.5 55.5 12.5 41.5 C 12.5 27.5 23.5 16.5 37.5 16.5 C 43.5 16.5 50.5 19.5 54.5 '.$leftM.' L '.$newThermLevel.' '.$leftM.' L '.$newThermLevel.' '.$rightM.'" style="stroke-width: 0;" fill="url(# ThermGradient)"/>';387 echo '<path d="M '.$newThermLevel.' '.$rightM.' L 54.5 '.$rightM.' C 50.5 64 43.5 66.5 37.5 66.5 C 23.5 66.5 12.5 55.5 12.5 41.5 C 12.5 27.5 23.5 16.5 37.5 16.5 C 43.5 16.5 50.5 19.5 54.5 '.$leftM.' L '.$newThermLevel.' '.$leftM.' L '.$newThermLevel.' '.$rightM.'" style="stroke-width: 0;" fill="url(#'.$gradID.')"/>'; 385 388 } 386 389 … … 391 394 else{ 392 395 ##$fill = ($i > count($colorListA)-1) ? $thermProperties['fill'] : trim($colorListA[$i]); // if not enough colours in list -> transparent 393 $fill = ($i > count($colorListA)-1) ? 'url(# ThermGradient)' : trim($colorListA[$i]); // if not enough colours in list -> transparent396 $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent 394 397 $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal)); 395 398 if ($raisedTotal > $targetTotal & $i == $raisedN){ … … 424 427 if($raisedTotal > $targetTotal){ 425 428 #echo '<path d="M'.$leftM.' '.$newThermLevel.' L '.$leftM.' 251 C 15.5 255, 13 262, 13 268 C 13 282, 24 293, 38 293 C 52 293, 63 282, 63 268 C 63 262, 60 255, '.$rightM.' 251 L '.$rightM.' '.$newThermLevel.' C '.$rightM.' 30, 48 25.5, 38 25.5 C 28 25.5, 20 30, '.$leftM.' '.$newThermLevel.'" style="stroke-width: 0;" fill="'.esc_html(trim($colorListA[$i])).'"/>'; 426 echo '<path d="M'.$leftM.' '.$newThermLevel.' L '.$leftM.' 251 C 15.5 255, 13 262, 13 268 C 13 282, 24 293, 38 293 C 52 293, 63 282, 63 268 C 63 262, 60 255, '.$rightM.' 251 L '.$rightM.' '.$newThermLevel.' C '.$rightM.' 30, 48 25.5, 38 25.5 C 28 25.5, 20 30, '.$leftM.' '.$newThermLevel.'" style="stroke-width: 0;" fill="url(# ThermGradient)"/>';429 echo '<path d="M'.$leftM.' '.$newThermLevel.' L '.$leftM.' 251 C 15.5 255, 13 262, 13 268 C 13 282, 24 293, 38 293 C 52 293, 63 282, 63 268 C 63 262, 60 255, '.$rightM.' 251 L '.$rightM.' '.$newThermLevel.' C '.$rightM.' 30, 48 25.5, 38 25.5 C 28 25.5, 20 30, '.$leftM.' '.$newThermLevel.'" style="stroke-width: 0;" fill="url(#'.$gradID.')"/>'; 427 430 } 428 431 else{ 429 432 #echo '<path d="M'.$leftM.' '.$newThermLevel.' L '.$leftM.' 251 C 15.5 255, 13 262, 13 268 C 13 282, 24 293, 38 293 C 52 293, 63 282, 63 268 C 63 262, 60 255, '.$rightM.' 251 L '.$rightM.' '.$newThermLevel.' L '.$leftM.' '.$newThermLevel.'" style="stroke-width: 0;" fill="'.esc_html(trim($colorListA[$i])).'"/>'; 430 echo '<path d="M'.$leftM.' '.$newThermLevel.' L '.$leftM.' 251 C 15.5 255, 13 262, 13 268 C 13 282, 24 293, 38 293 C 52 293, 63 282, 63 268 C 63 262, 60 255, '.$rightM.' 251 L '.$rightM.' '.$newThermLevel.' L '.$leftM.' '.$newThermLevel.'" style="stroke-width: 0;" fill="url(# ThermGradient)"/>';433 echo '<path d="M'.$leftM.' '.$newThermLevel.' L '.$leftM.' 251 C 15.5 255, 13 262, 13 268 C 13 282, 24 293, 38 293 C 52 293, 63 282, 63 268 C 63 262, 60 255, '.$rightM.' 251 L '.$rightM.' '.$newThermLevel.' L '.$leftM.' '.$newThermLevel.'" style="stroke-width: 0;" fill="url(#'.$gradID.')"/>'; 431 434 } 432 435 … … 437 440 else{ 438 441 ##$fill = ($i > count($colorListA)-1) ? $thermProperties['fill'] : trim($colorListA[$i]); // if not enough colours in list -> transparent 439 $fill = ($i > count($colorListA)-1) ? 'url(# ThermGradient)' : trim($colorListA[$i]); // if not enough colours in list -> transparent442 $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent 440 443 $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal)); 441 444 if ($raisedTotal > $targetTotal & $i == $raisedN){ -
donation-thermometer/trunk/readme.txt
r2967769 r2967794 5 5 Requires at least: 4.6 6 6 Tested up to: 6.3.1 7 Stable tag: 2.2. 37 Stable tag: 2.2.4 8 8 Requires PHP: 5.2 9 9 License: GPL3 … … 80 80 81 81 == Changelog == 82 83 = 2.2.4 = 84 * Fixed a bug when using different filltypes across multiple thermometers on the same page. 82 85 83 86 = 2.2.3 =
Note: See TracChangeset
for help on using the changeset viewer.