Plugin Directory

Changeset 2967794


Ignore:
Timestamp:
09/16/2023 01:21:34 PM (3 years ago)
Author:
henryp
Message:
  • Fixed a bug when using different filltypes across multiple thermometers on the same page.
Location:
donation-thermometer/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • donation-thermometer/trunk/donation_therm.php

    r2967769 r2967794  
    44Plugin URI: https://rhewlif.xyz/thermometer
    55Description: 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.3
     6Version: 2.2.4
    77Author: Henry Patton
    88Text Domain: donation-thermometer
  • donation-thermometer/trunk/includes/therm_svg.php

    r2967769 r2967794  
    9393        $colorListA = array($thermProperties['fill']);
    9494    }
     95
    9596    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">
    9799          <stop style="stop-color: ' . esc_html(trim($colorListA[0])) . '" offset="0%" />
    98100          <stop style="stop-color: ' . $thermProperties['fill2'] . '" offset="100%" />
     
    100102    }
    101103    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">
    103106          <stop style="stop-color: ' . $thermProperties['fill2'] . '" offset="0%" />
    104107          <stop style="stop-color: ' . esc_html(trim($colorListA[0])) . '" offset="100%" />
     
    378381                if($raisedTotal > $targetTotal){
    379382                    #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.')"/>';
    381384                }
    382385                else{
    383386                    #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.')"/>';
    385388                }
    386389
     
    391394            else{
    392395                ##$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 -> transparent
     396                $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent
    394397                $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal));
    395398                if ($raisedTotal > $targetTotal & $i == $raisedN){
     
    424427                if($raisedTotal > $targetTotal){
    425428                    #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.')"/>';
    427430                }
    428431                else{
    429432                    #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.')"/>';
    431434                }
    432435
     
    437440            else{
    438441                ##$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 -> transparent
     442                $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent
    440443                $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal));
    441444                if ($raisedTotal > $targetTotal & $i == $raisedN){
  • donation-thermometer/trunk/readme.txt

    r2967769 r2967794  
    55Requires at least: 4.6
    66Tested up to: 6.3.1
    7 Stable tag: 2.2.3
     7Stable tag: 2.2.4
    88Requires PHP: 5.2
    99License: GPL3
     
    8080
    8181== Changelog ==
     82
     83= 2.2.4 =
     84* Fixed a bug when using different filltypes across multiple thermometers on the same page.
    8285
    8386= 2.2.3 =
Note: See TracChangeset for help on using the changeset viewer.