Plugin Directory

Changeset 3018257


Ignore:
Timestamp:
01/06/2024 06:20:03 PM (2 years ago)
Author:
henryp
Message:

Fixed a bug where very large target values would get cut off in the SVG with the default font-size.

Location:
donation-thermometer/trunk
Files:
3 edited

Legend:

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

    r2967794 r3018257  
    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.4
     6Version: 2.2.5
    77Author: Henry Patton
    88Text Domain: donation-thermometer
     
    1010License: GPL3
    1111
    12 Copyright 2018  Henry Patton  (email : hp@rhewlif.xyz)
     12Copyright 2024  Henry Patton  (email : hp@rhewlif.xyz)
    1313
    1414    This program is free software: you can redistribute it and/or modify
  • donation-thermometer/trunk/includes/therm_svg.php

    r2967794 r3018257  
    7878    $raisedValue = ($thermProperties['trailing'] == 'true') ? number_format($raisedTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']).$currency : $currency.number_format($raisedTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']);
    7979    $targetValue = ($thermProperties['trailing'] == 'true') ? number_format($targetTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']).$currency : $currency.number_format($targetTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']);
     80    $tValue = ($thermProperties['swapValues'] == 1) ? $raisedValue : $targetValue;
    8081    end($targetA); // move pointer to end of array
    8182    if ($showSubTargets == 1){
     
    150151    }
    151152
     153    $targetLen = mb_strlen($tValue);
    152154    if (!empty($tickM) && $tickM == $rightM){   // left or right ticks
    153         $viewboxX1 = 0;
     155        if($thermProperties['orientation'] != 'landscape'){
     156            $viewboxX1 = ($targetLen > 7) ? ($targetLen * -2.5) + 7 : 0;
     157        }
     158        else{
     159            $viewboxX1 = -4;
     160        }
    154161        $majorTickL = $rightM - 13;
    155162        $minorTickL = $rightM - 6;
     
    180187        if (count($targetA) > 1){
    181188            $viewboxX2 = 76 + mb_strlen($subTargetValue)*8; // expand right
     189            $viewboxX2 = ($targetLen > 7) ? $viewboxX2 + ($targetLen * 2.5) - 9 : $viewboxX2;
    182190        }
    183191        elseif (!empty($raisedValue)){
    184192            $viewboxX2 = 76 + mb_strlen($raisedValue)*8; // expand right
     193            $viewboxX2 = ($targetLen > 7) ? $viewboxX2 + ($targetLen * 2.5) - 9: $viewboxX2;
    185194        }
    186195    }
     
    318327    // target
    319328    if ($showTarget == 1){
    320         $tValue = ($thermProperties['swapValues'] == 1) ? $raisedValue : $targetValue;
    321329        if($thermProperties['orientation'] == 'landscape'){
    322330            echo '<text x="'.$targetAnchorPoint.'" y="'.$subTargetMargin.'" class="therm_target" fill="'.esc_html($targetColor).'" dominant-baseline="central" style="text-anchor:'.$targetAnchor.'!important">'.esc_html($tValue).'</text>';
  • donation-thermometer/trunk/readme.txt

    r2967794 r3018257  
    44Tags: donate, donation, thermometer, progress, tracker, fundraising, funds, gift, aid, money, charity, non-profit, counter, meter, goal, custom
    55Requires at least: 4.6
    6 Tested up to: 6.3.1
    7 Stable tag: 2.2.4
     6Tested up to: 6.4.2
     7Stable tag: 2.2.5
    88Requires PHP: 5.2
    99License: GPL3
     
    8080
    8181== Changelog ==
     82
     83= 2.2.5 =
     84* Fixed a bug where very large target values would get cut off in the SVG with the default font-size.
    8285
    8386= 2.2.4 =
Note: See TracChangeset for help on using the changeset viewer.