Plugin Directory

Changeset 3399935


Ignore:
Timestamp:
11/20/2025 05:38:17 PM (4 months ago)
Author:
henryp
Message:
  • Allowed shortcodes for the target value(s).
  • Fixed bug related to svg margins when displaying multiple targets.
  • Security fixes.
Location:
donation-thermometer/trunk
Files:
4 edited

Legend:

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

    r3169971 r3399935  
    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.6
     6Version: 2.2.7
    77Author: Henry Patton
    88Text Domain: donation-thermometer
  • donation-thermometer/trunk/includes/therm_shortcode.php

    r2967764 r3399935  
    22/////////////////////////////// shortcode stuff...
    33
     4function is_hex_color($color) {
     5    $color = trim($color);
     6    // Regex: ^# followed by exactly 3 or 6 hex digits
     7    return (bool) preg_match('/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/', $color);
     8}
    49function thermometer_graphic($atts){
    510    $atts = (shortcode_atts(
     
    4045    //thermometer alignment (vertical/horizontal)
    4146    if(!empty($atts['orientation'])){
    42         $thermProperties['orientation'] = $atts['orientation'];
    43     }
    44     else{
    45         $thermProperties['orientation'] = $options['therm_orientation'];
     47        $thermProperties['orientation'] = esc_attr($atts['orientation']);
     48    }
     49    else{
     50        $thermProperties['orientation'] = esc_attr($options['therm_orientation']);
    4651    }
    4752
     
    5358
    5459    if (!empty($atts['width'])){
    55         $thermProperties['width'] = $atts['width'];
     60        $thermProperties['width'] = esc_attr($atts['width']);
    5661        $thermProperties['height'] = '';
    5762    }
     
    6368    //height
    6469    if (!empty($atts['height'])){
    65         $thermProperties['height'] = $atts['height'];
     70        $thermProperties['height'] = esc_attr($atts['height']);
    6671        $thermProperties['width'] = '';
    6772    }
    6873    elseif(empty($atts['height']) && !empty($atts['width'])){
    69         $thermProperties['width'] = $atts['width'];
     74        $thermProperties['width'] = esc_attr($atts['width']);
    7075        $thermProperties['height'] = '';
    7176    }
     
    7681    //currency value to use
    7782    if (empty($atts['currency'])){
    78         $thermProperties['currency'] = $options['currency'];
     83        $thermProperties['currency'] = esc_attr($options['currency']);
    7984    }
    8085    elseif(strtolower($atts['currency']) == 'null'){ //get user to enter null for no value
     
    8287    }
    8388    else{
    84         $thermProperties['currency'] = $atts['currency']; //set currency to default or shortcode value
     89        $thermProperties['currency'] = esc_attr($atts['currency']); //set currency to default or shortcode value
    8590    }
    8691
    8792    //decimal separator
    8893    if(!empty($atts['decsep'])){
    89         $thermProperties['decsep'] = $atts['decsep'];
     94        $thermProperties['decsep'] = esc_attr($atts['decsep']);
    9095    }
    9196    else{
     
    96101    //target value
    97102    if ($atts['target'] == '' && !empty($options['target_string'])){
    98         $thermProperties['target'] = $options['target_string'];
     103        $thermProperties['target'] = esc_attr($options['target_string']);
    99104    }
    100105    elseif($atts['target'] == 'off'){
    101         $thermProperties['target'] = $options['target_string'].';'.strval($atts['target']);
    102     }
    103     else{
    104         $thermProperties['target'] = preg_replace('/[^A-Za-z0-9\-\\'.$sep.'\;]/', '',strval($atts['target']));
     106        $thermProperties['target'] = esc_attr($options['target_string']).';'.strval(esc_attr($atts['target']));
     107    }
     108    else{
     109        // if shortcode present
     110        if (!is_numeric(str_replace(",", ".", $atts['target'])) && (strpos($atts['target'], ';') === false) && !is_numeric(str_replace(',','',$atts['target']))) {
     111            $shortcode = "[".strval($atts['target'])."]";
     112            $atts['target'] = do_shortcode( $shortcode);
     113        }
     114        $thermProperties['target'] = preg_replace('/[^A-Za-z0-9\-\\'.$sep.'\;]/', '',strval(esc_attr($atts['target'])));
    105115    }
    106116
     
    123133    //raised value
    124134    if ($atts['raised'] == '' && !empty($options['raised_string'])){
    125         $thermProperties['raised'] = $options['raised_string'];
     135        $thermProperties['raised'] = esc_attr($options['raised_string']);
    126136    }
    127137    else{
     
    131141            $atts['raised'] = do_shortcode( $shortcode);
    132142        }
    133         $thermProperties['raised'] = preg_replace('/[^A-Za-z0-9\-\\'.$sep.'\;]/', '',strval($atts['raised']));
     143        $thermProperties['raised'] = preg_replace('/[^A-Za-z0-9\-\\'.$sep.'\;]/', '',strval(esc_attr($atts['raised'])));
    134144    }
    135145
     
    142152    }
    143153    elseif (!empty($atts['align'])){
    144         $thermProperties['align'] = 'display:block; float:'.strtolower($atts['align']).';';
     154        $thermProperties['align'] = 'display:block; float:'.strtolower(esc_attr($atts['align'])).';';
    145155    }
    146156    else{
     
    151161    //thousands separator
    152162    if(!empty($atts['sep'])){
    153         $thermProperties['sep'] = $atts['sep'];
     163        $thermProperties['sep'] = esc_attr($atts['sep']);
    154164    }
    155165    else{
     
    161171        }
    162172        else{
    163             $thermProperties['sep'] = substr($options['thousands'],0,1);
     173            $thermProperties['sep'] = substr(esc_attr($options['thousands']),0,1);
    164174        }
    165175    }
     
    167177    //decimal places
    168178    if(is_numeric($atts['decimals'])){
    169         $thermProperties['decimals'] = $atts['decimals'];
    170     }
    171     else{
    172         $thermProperties['decimals'] = $options['decimals'];
     179        $thermProperties['decimals'] = esc_attr($atts['decimals']);
     180    }
     181    else{
     182        $thermProperties['decimals'] = esc_attr($options['decimals']);
    173183    }
    174184
    175185    // fill colour and gradient
    176     if(empty($atts['fill'])){
    177         $thermProperties['fill'] = $options['colour_picker1'];
    178     }
    179     else{
    180         $thermProperties['fill'] = $atts['fill'];
     186    if (!empty($atts['fill']) and is_hex_color($atts['fill'])){
     187        $thermProperties['fill'] = esc_attr($atts['fill']);
     188    }
     189    else{
     190        $thermProperties['fill'] = esc_attr($options['colour_picker1']);
    181191    }
    182192
     
    184194    if(!empty($atts['filltype'])){
    185195        if ($atts['filltype'] == 'gradient'){
    186             if(empty($atts['fill2'])){
    187                 $thermProperties['fill2'] = $options['colour_picker6'];
     196            if(!empty($atts['fill2']) and is_hex_color($atts['fill2'])){
     197                $thermProperties['fill2'] = esc_attr($atts['fill2']);
    188198            }
    189199            else{
    190                 $thermProperties['fill2'] = $atts['fill2'];
     200                $thermProperties['fill2'] = esc_attr($options['colour_picker6']);
    191201            }
    192202        }
    193203        else{
    194             $thermProperties['fill2'] = $thermProperties['fill'];
     204            $thermProperties['fill2'] = esc_attr($thermProperties['fill']);
    195205        }
    196206    }
    197207    else{
    198208        if ($options['therm_filltype'] == 'gradient'){
    199             if(empty($atts['fill2'])){
    200                 $thermProperties['fill2'] = $options['colour_picker6'];
     209            if(!empty($atts['fill2']) and is_hex_color($atts['fill2'])){
     210                $thermProperties['fill2'] = esc_attr($atts['fill2']);
    201211            }
    202212            else{
    203                 $thermProperties['fill2'] = $atts['fill2'];
     213                $thermProperties['fill2'] = esc_attr($options['colour_picker6']);
    204214            }
    205215        }
    206216        else{
    207             $thermProperties['fill2'] = $thermProperties['fill'];
     217            $thermProperties['fill2'] = esc_attr($thermProperties['fill']);
    208218        }
    209219    }
     
    225235    //title text
    226236    if (!empty($atts['alt'])){
    227         $thermProperties['title'] = $atts['alt'];
     237        $thermProperties['title'] = esc_attr($atts['alt']);
    228238    }
    229239    else{
     
    233243    //legend
    234244    if(!empty($atts['legend'])){
    235         $thermProperties['legend'] = $atts['legend'];
     245        $thermProperties['legend'] = esc_attr($atts['legend']);
    236246    }
    237247    else{
     
    241251    //tick alignment
    242252    if(!empty($atts['ticks'])){
    243         $thermProperties['ticks'] = $atts['ticks'];
    244     }
    245     else{
    246         $thermProperties['ticks'] = $options['tick_align'];
     253        $thermProperties['ticks'] = esc_attr($atts['ticks']);
     254    }
     255    else{
     256        $thermProperties['ticks'] = esc_attr($options['tick_align']);
    247257    }
    248258
    249259    // color ramp
    250260    if(!empty($atts['colorramp'])){
    251         $thermProperties['colorList'] = $atts['colorramp'];
    252     }
    253     else{
    254         $thermProperties['colorList'] = $options['color_ramp'];
     261        $thermProperties['colorList'] = esc_attr($atts['colorramp']);
     262    }
     263    else{
     264        $thermProperties['colorList'] = esc_attr($options['color_ramp']);
    255265    }
    256266
     
    287297    }
    288298
    289     $thermProperties['percentageColor'] = (empty($atts['percentcolor'])) ? $options['colour_picker2'] : $atts['percentcolor'];
    290     $thermProperties['targetColor'] = (empty($atts['targetcolor'])) ? $options['colour_picker3'] : $atts['targetcolor'];
    291     $thermProperties['raisedColor'] = (empty($atts['raisedcolor'])) ? $options['colour_picker4'] : $atts['raisedcolor'];
    292     $thermProperties['subtargetColor'] = (empty($atts['subtargetcolor'])) ? $options['colour_picker5'] : $atts['subtargetcolor'];
     299    $thermProperties['percentageColor'] = (empty($atts['percentcolor'])) ? esc_attr($options['colour_picker2']) : esc_attr($atts['percentcolor']);
     300    $thermProperties['targetColor'] = (empty($atts['targetcolor'])) ? esc_attr($options['colour_picker3']) : esc_attr($atts['targetcolor']);
     301    $thermProperties['raisedColor'] = (empty($atts['raisedcolor'])) ? esc_attr($options['colour_picker4']) : esc_attr($atts['raisedcolor']);
     302    $thermProperties['subtargetColor'] = (empty($atts['subtargetcolor'])) ? esc_attr($options['colour_picker5']) : esc_attr($atts['subtargetcolor']);
    293303    //print_r($thermProperties);
    294304    //print_r($atts);
     
    308318    global $thermDefaults;
    309319    $options = wp_parse_args( get_option('thermometer_options',$thermDefaults), $thermDefaults);
    310     $raisedA = explode(';',$options['raised_string']);
     320    $raisedA = explode(';',esc_attr($options['raised_string']));
    311321
    312322    if($options['thousands'] == ' (space)'){
     
    317327    }
    318328    else{
    319         $sep = substr($options['thousands'],0,1);
     329        $sep = substr(esc_attr($options['thousands']),0,1);
    320330    }
    321331    $decsep = ($options['decsep'] == ', (comma)') ? ',' : '.';
    322     $decimals = $options['decimals'];
     332    $decimals = esc_attr($options['decimals']);
    323333
    324334    if (end($raisedA) == 'off'){
     
    351361    global $thermDefaults;
    352362    $options = wp_parse_args( get_option('thermometer_options',$thermDefaults), $thermDefaults);
    353     $target = $options['target_string'];
     363    $target = esc_attr($options['target_string']);
    354364    if($options['thousands'] == ' (space)'){
    355365        $sep = ' ';
     
    359369    }
    360370    else{
    361         $sep = substr($options['thousands'],0,1);
     371        $sep = substr(esc_attr($options['thousands']),0,1);
    362372    }
    363373    $decsep = ($options['decsep'] == ', (comma)') ? ',' : '.';
    364     $decimals = $options['decimals'];
     374    $decimals = esc_attr($options['decimals']);
    365375    if ($target != ''){
    366376        $targetA = explode(';',$target);
     
    392402    $raised = therm_raised();
    393403    $options = wp_parse_args( get_option('thermometer_options',$thermDefaults), $thermDefaults);
    394     $decimals = $options['decimals'];
     404    $decimals = esc_attr($options['decimals']);
    395405    $div = (float) str_replace(',', '', $raised) / (float) str_replace(',', '', $target);
    396406    return ($target > 0) ? number_format(($div * 100),$decimals).'%' : __('unknown %','donation-thermometer');
  • donation-thermometer/trunk/includes/therm_svg.php

    r3169971 r3399935  
    1313    $optionsCSS = wp_parse_args( get_option('thermometer_style',$thermDefaultStyle), $thermDefaultStyle);
    1414    echo '<style>
    15     .thermometer_svg{'.$optionsCSS['thermometer_svg'].'}
    16     .therm_target{'.$optionsCSS['therm_target_style'].'}
    17     .therm_raised{'.$optionsCSS['therm_raised_style'].'}
    18     .therm_percent{'.$optionsCSS['therm_percent_style'].'}
    19     .therm_subTarget{'.$optionsCSS['therm_subTarget_style'].'}
    20     .therm_legend{'.$optionsCSS['therm_legend_style'].'}
    21     .therm_majorTick{'.$optionsCSS['therm_majorTick_style'].'}
    22     .therm_minorTick{'.$optionsCSS['therm_minorTick_style'].'}
    23     .therm_border{'.$optionsCSS['therm_border_style'].'}
    24     .therm_subTargetArrow{'.$optionsCSS['therm_subArrow_style'].'}
    25     .therm_raisedLevel{'.$optionsCSS['therm_raisedLevel_style'].'}
    26     .therm_subRaisedLevel{'.$optionsCSS['therm_subRaisedLevel_style'].'}
    27     .therm_arrow{'.$optionsCSS['therm_arrow_style'].'}
    28     .therm_subTargetLevel{'.$optionsCSS['therm_subTargetLevel_style'].'}
     15    .thermometer_svg{'.esc_attr($optionsCSS['thermometer_svg']).'}
     16    .therm_target{'.esc_attr($optionsCSS['therm_target_style']).'}
     17    .therm_raised{'.esc_attr($optionsCSS['therm_raised_style']).'}
     18    .therm_percent{'.esc_attr($optionsCSS['therm_percent_style']).'}
     19    .therm_subTarget{'.esc_attr($optionsCSS['therm_subTarget_style']).'}
     20    .therm_legend{'.esc_attr($optionsCSS['therm_legend_style']).'}
     21    .therm_majorTick{'.esc_attr($optionsCSS['therm_majorTick_style']).'}
     22    .therm_minorTick{'.esc_attr($optionsCSS['therm_minorTick_style']).'}
     23    .therm_border{'.esc_attr($optionsCSS['therm_border_style']).'}
     24    .therm_subTargetArrow{'.esc_attr($optionsCSS['therm_subArrow_style']).'}
     25    .therm_raisedLevel{'.esc_attr($optionsCSS['therm_raisedLevel_style']).'}
     26    .therm_subRaisedLevel{'.esc_attr($optionsCSS['therm_subRaisedLevel_style']).'}
     27    .therm_arrow{'.esc_attr($optionsCSS['therm_arrow_style']).'}
     28    .therm_subTargetLevel{'.esc_attr($optionsCSS['therm_subTargetLevel_style']).'}
    2929    </style>';
    3030
     31    $decsep = esc_attr($thermProperties['decsep']);
     32    $sep = esc_attr($thermProperties['sep']);
     33    $orientation = esc_attr($thermProperties['orientation']);
     34    $width_tp = esc_attr($thermProperties['width']);
     35    $height_tp = esc_attr($thermProperties['height']);
     36    $trailing = esc_attr($thermProperties['trailing']);
     37    $shadow = esc_attr($thermProperties['shadow']);
     38    $swap = esc_attr($thermProperties['swapValues']);
     39
    3140    // thermometer values and units
    32     $raisedA = explode(';',$thermProperties['raised']);
     41    $raisedA = explode(';',esc_attr($thermProperties['raised']));
    3342    if (end($raisedA) == 'off'){
    3443        $showRaised = 0;
     
    3645    }
    3746    else{
    38         $showRaised = $thermProperties['showRaised'];
    39     }
    40 
    41     if ($thermProperties['decsep'] == ','){
     47        $showRaised = esc_attr($thermProperties['showRaised']);
     48    }
     49
     50    if ($decsep == ','){
    4251        foreach($raisedA as &$item) {
    4352            $item = floatval(str_replace(',', '.', str_replace('.', '', strval($item))));
     
    5160    $raisedTotal = array_sum($raisedA);
    5261
    53     $targetA = explode(';',$thermProperties['target']);
    54     if ($thermProperties['decsep'] == ','){
     62    $targetA = explode(';',esc_attr($thermProperties['target']));
     63    if ($decsep == ','){
    5564        foreach($targetA as &$item) {
    5665            $item = floatval(str_replace(',', '.', str_replace('.', '', strval($item))));
     
    6776    }
    6877    else{
    69         $showTarget = $thermProperties['showTarget'];
    70     }
    71 
    72     $showSubTargets = $thermProperties['targetlabels'];
     78        $showTarget = esc_attr($thermProperties['showTarget']);
     79    }
     80
     81    $showSubTargets = esc_attr($thermProperties['targetlabels']);
    7382    $targetTotal = max(0,end($targetA));
    7483
    75     $currency = $thermProperties['currency'];
    76     $decimals = $thermProperties['decimals'];
    77     $raisedPercent = ($targetTotal > 0) ? number_format(($raisedTotal/$targetTotal * 100),$decimals,$thermProperties['decsep'],$thermProperties['sep']) : 100;
    78     $raisedValue = ($thermProperties['trailing'] == 'true') ? number_format($raisedTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']).$currency : $currency.number_format($raisedTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']);
    79     $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;
     84    $currency = esc_attr($thermProperties['currency']);
     85    $decimals = esc_attr($thermProperties['decimals']);
     86    $raisedPercent = ($targetTotal > 0) ? number_format(($raisedTotal/$targetTotal * 100),$decimals,$decsep,$sep) : 100;
     87    $raisedValue = ($trailing == 'true') ? number_format($raisedTotal,$decimals,$decsep,$sep).$currency : $currency.number_format($raisedTotal,$decimals,$decsep,$sep);
     88    $targetValue = ($trailing == 'true') ? number_format($targetTotal,$decimals,$decsep,$sep).$currency : $currency.number_format($targetTotal,$decimals,$decsep,$sep);
     89    $tValue = ($swap == 1) ? $raisedValue : $targetValue;
    8190    end($targetA); // move pointer to end of array
    8291    if ($showSubTargets == 1){
    83         $subTargetValue = ($thermProperties['trailing'] == 'true') ? number_format(prev($targetA),$decimals,$thermProperties['decsep'],$thermProperties['sep']).$currency : $currency.number_format(prev($targetA),$decimals,$thermProperties['decsep'],$thermProperties['sep']);
     92        $subTargetValue = ($trailing == 'true') ? number_format(prev($targetA),$decimals,$decsep,$sep).$currency : $currency.number_format(prev($targetA),$decimals,$decsep,$sep);
    8493    }
    8594    else{
     
    8897
    8998    // colours & legend
    90     if (sizeof($raisedA) > 1 && !empty($thermProperties['colorList'])){
    91         $colorListA = explode(';',rtrim($thermProperties['colorList'],';'));
    92     }
    93     else{
    94         $colorListA = array($thermProperties['fill']);
    95     }
    96 
    97     if($thermProperties['orientation'] == 'landscape') {
    98         $gradID = 'ThermGrad_'. esc_html(trim($colorListA[0])) . '_' . $thermProperties['fill2'];
     99    if (sizeof($raisedA) > 1 && !empty(esc_attr($thermProperties['colorList']))){
     100        $colorListA = explode(';',rtrim(esc_attr($thermProperties['colorList']),';'));
     101    }
     102    else{
     103        $colorListA = array(esc_attr($thermProperties['fill']));
     104    }
     105
     106    if($orientation == 'landscape') {
     107        $gradID = 'ThermGrad_'. esc_html(trim($colorListA[0])) . '_' . esc_attr($thermProperties['fill2']);
    99108        $gradient = '<linearGradient id="'.$gradID.'" x1="0" x2="1" y1="0" y2="0">
    100109          <stop style="stop-color: ' . esc_html(trim($colorListA[0])) . '" offset="0%" />
    101           <stop style="stop-color: ' . $thermProperties['fill2'] . '" offset="100%" />
     110          <stop style="stop-color: ' . esc_attr($thermProperties['fill2']) . '" offset="100%" />
    102111        </linearGradient>';
    103112    }
    104113    else{
    105         $gradID = 'ThermGrad_'. $thermProperties['fill2'] . '_' . esc_html(trim($colorListA[0]));
     114        $gradID = 'ThermGrad_'. esc_attr($thermProperties['fill2']) . '_' . esc_html(trim($colorListA[0]));
    106115        $gradient = '<linearGradient id="'.$gradID.'" x1="0" x2="0" y1="0" y2="1">
    107           <stop style="stop-color: ' . $thermProperties['fill2'] . '" offset="0%" />
     116          <stop style="stop-color: ' . esc_attr($thermProperties['fill2']) . '" offset="0%" />
    108117          <stop style="stop-color: ' . esc_html(trim($colorListA[0])) . '" offset="100%" />
    109118        </linearGradient>';
    110119    }
    111120
    112     $legend = rtrim($thermProperties['legend'],';'); // trim last semicolon if added
     121    $legend = rtrim(esc_attr($thermProperties['legend']),';'); // trim last semicolon if added
    113122    $legendA = explode(';',$legend);
    114123    $legendA = array_slice($legendA,0,count($raisedA)); // shorten legend entries to match raised value count
    115124
    116     $percentageColor = $thermProperties['percentageColor'];
    117     $targetColor = $thermProperties['targetColor'];
    118     $raisedColor = $thermProperties['raisedColor'];
    119     $subTargetColor = $thermProperties['subtargetColor'];
    120     $basicShadow = ($thermProperties['shadow'] == 1) ? 'url(#f1)' : '';
     125    $percentageColor = esc_attr($thermProperties['percentageColor']);
     126    $targetColor = esc_attr($thermProperties['targetColor']);
     127    $raisedColor = esc_attr($thermProperties['raisedColor']);
     128    $subTargetColor = esc_attr($thermProperties['subtargetColor']);
     129    $basicShadow = ($shadow == 1) ? 'url(#f1)' : '';
    121130
    122131    // basic properties of the thermometer
    123     $minH = ($thermProperties['orientation'] == 'landscape') ? 59.5 : 246;
    124     $maxH = ($thermProperties['orientation'] == 'landscape') ? 269.5 : 36;
     132    $minH = ($orientation == 'landscape') ? 59.5 : 246;
     133    $maxH = ($orientation == 'landscape') ? 269.5 : 36;
    125134    $tickStep = 42;
    126     $leftM = ($thermProperties['orientation'] == 'landscape') ? 23.5 : 20; // Y : X
    127     $rightM = ($thermProperties['orientation'] == 'landscape') ? 59.5 : 56; // Y : X
    128     $tickM = ($thermProperties['ticks'] == 'left' || $thermProperties['ticks'] == 'top') ? $leftM : $rightM;
     135    $leftM = ($orientation == 'landscape') ? 23.5 : 20; // Y : X
     136    $rightM = ($orientation == 'landscape') ? 59.5 : 56; // Y : X
     137    $tickM = (esc_attr($thermProperties['ticks']) == 'left' || esc_attr($thermProperties['ticks']) == 'top') ? $leftM : $rightM;
    129138    $markerSize = 5;
    130139    $legendStep = 15;
    131140
    132     if($thermProperties['orientation'] == 'landscape'){
     141    if($orientation == 'landscape'){
    133142        $transformY = 0;
    134143    }
     
    137146    }
    138147    $viewboxY = ($showTarget == '1') ? 305 : 287;
    139     $viewboxX2 = ($thermProperties['orientation'] == 'landscape') ? 90 : 76;
    140 
    141     if($thermProperties['orientation'] == 'landscape'){
     148    $viewboxX2 = ($orientation == 'landscape') ? 90 : 76;
     149
     150    if($orientation == 'landscape'){
    142151        if (mb_strlen($targetValue)<8){
    143152            $targetAnchorPoint = $maxH;
     
    152161    $targetLen = mb_strlen($tValue);
    153162    if ($tickM === $rightM){    // left or right ticks
    154         if($thermProperties['orientation'] != 'landscape'){
     163        if($orientation != 'landscape'){
    155164            $viewboxX1 = ($targetLen > 7) ? ($targetLen * -2.5) + 7 : 0;
    156165        }
     
    161170        $minorTickL = $rightM - 6;
    162171        $markerMargin = $rightM + 2;
    163         $subMarkerMargin = ($thermProperties['orientation'] == 'landscape') ? $leftM - 2 : $rightM + 2;
    164         $raisedMargin = ($thermProperties['orientation'] == 'landscape') ? $rightM + 15 : $rightM + 10;
    165         $subTargetMargin = ($thermProperties['orientation'] == 'landscape') ? $leftM - 15 : $rightM + 10;
     172        $subMarkerMargin = ($orientation == 'landscape') ? $leftM - 2 : $rightM + 2;
     173        $raisedMargin = ($orientation == 'landscape') ? $rightM + 15 : $rightM + 10;
     174        $subTargetMargin = ($orientation == 'landscape') ? $leftM - 15 : $rightM + 10;
    166175        $raisedAnchor = 'start';
    167176    }
    168177    else{
    169178        if(count($targetA) > 1){
    170             $viewboxX1 = ($thermProperties['orientation'] == 'landscape') ? 0 : mb_strlen($subTargetValue)*-7;
    171         }
    172         else{
    173             $viewboxX1 = ($thermProperties['orientation'] == 'landscape') ? 0 : mb_strlen($raisedValue)*-7;
     179            $viewboxX1 = ($orientation == 'landscape') ? 0 : mb_strlen($subTargetValue)*-7;
     180        }
     181        else{
     182            $viewboxX1 = ($orientation == 'landscape') ? 0 : mb_strlen($raisedValue)*-7;
    174183        }
    175184
     
    177186        $minorTickL = $leftM + 6;
    178187        $markerMargin = $leftM - 2;
    179         $subMarkerMargin = ($thermProperties['orientation'] == 'landscape') ? $rightM + 2 : $leftM - 2;
    180         $raisedMargin = ($thermProperties['orientation'] == 'landscape') ? $leftM - 15 : $leftM - 10;
    181         $subTargetMargin = ($thermProperties['orientation'] == 'landscape') ? $rightM + 15 : $leftM - 10;
     188        $subMarkerMargin = ($orientation == 'landscape') ? $rightM + 2 : $leftM - 2;
     189        $raisedMargin = ($orientation == 'landscape') ? $leftM - 15 : $leftM - 10;
     190        $subTargetMargin = ($orientation == 'landscape') ? $rightM + 15 : $leftM - 10;
    182191        $raisedAnchor = 'end';
    183192    }
    184193
    185     if($thermProperties['orientation'] != 'landscape'){
     194    if($orientation != 'landscape'){
    186195        if (count($targetA) > 1){
    187             $viewboxX2 = 76 + mb_strlen($subTargetValue)*8; // expand right
     196            $viewboxX2 = 76 + max(mb_strlen($raisedValue), mb_strlen($subTargetValue))*8; // expand right
    188197            $viewboxX2 = ($targetLen > 7) ? $viewboxX2 + ($targetLen * 2.5) - 9 : $viewboxX2;
    189198        }
     
    197206        //count chars
    198207        $maxRaised = max(array_map('stringLength',$raisedA, $legendA))
    199             + mb_strlen($thermProperties['currency'])
     208            + mb_strlen(esc_attr($thermProperties['currency']))
    200209            + 3; // max legend width incl. space & ()
    201         if ($thermProperties['sep'] != ''){
    202             $maxRaised = $maxRaised + substr_count(number_format(max($raisedA),$decimals,$thermProperties['decsep'],$thermProperties['sep']), $thermProperties['sep']);
     210        if ($sep != ''){
     211            $maxRaised = $maxRaised + substr_count(number_format(max($raisedA),$decimals,$decsep,$sep), $sep);
    203212        }
    204213        if ($decimals > 0){
     
    206215        }
    207216
    208         if($thermProperties['orientation'] == 'landscape'){
     217        if($orientation == 'landscape'){
    209218            $transformY = ($transformY - ($maxRaised*6.25)); // expand left
    210219            $viewboxY = ($viewboxY + ($maxRaised*6.25)); // expand right
     
    219228
    220229    // title/alt attribute
    221     if (strtolower($thermProperties['title']) == 'off'){
     230    if (strtolower(esc_attr($thermProperties['title'])) == 'off'){
    222231        $title = '';
    223232    }
    224     elseif(!empty($thermProperties['title'])){
    225         $title = $thermProperties['title'];
     233    elseif(!empty(esc_attr($thermProperties['title']))){
     234        $title = esc_attr($thermProperties['title']);
    226235    }
    227236    else{
     
    233242    $aspectRatio = $viewboxX2/$viewboxY; // width/height
    234243    $workAround = 'n';
    235     if (!empty($thermProperties['width'])){
    236         if (is_numeric(substr($thermProperties['width'],-1)) or substr($thermProperties['width'], -2) == 'px'){
    237             $width = preg_replace("/[^0-9]/", "", $thermProperties['width'] );
    238             $height = ($thermProperties['orientation'] == 'landscape') ? $width * $aspectRatio : $width / $aspectRatio;
    239         }
    240         elseif (substr($thermProperties['width'],-1) == '%'){
    241             $width = $thermProperties['width'];
    242             $height = intval($thermProperties['width'])/$aspectRatio.'%';
     244    if (!empty($width_tp)){
     245        if (is_numeric(substr($width_tp,-1)) or substr($width_tp, -2) == 'px'){
     246            $width = preg_replace("/[^0-9]/", "", $width_tp );
     247            $height = ($orientation == 'landscape') ? $width * $aspectRatio : $width / $aspectRatio;
     248        }
     249        elseif (substr($width_tp,-1) == '%'){
     250            $width = $width_tp;
     251            $height = intval($width_tp)/$aspectRatio.'%';
    243252            $workAround = 'yesW';
    244253        }
    245254    }
    246     elseif (!empty($thermProperties['height'])){
    247         if (is_numeric(substr($thermProperties['height'],-1)) or substr($thermProperties['height'], -2) == 'px'){
    248             $height = preg_replace("/[^0-9]/", "", $thermProperties['height'] );
    249             $width = ($thermProperties['orientation'] == 'landscape') ? $height/$aspectRatio : $height * $aspectRatio;
    250         }
    251         elseif (substr($thermProperties['height'],-1) == '%'){
    252             $height = $thermProperties['height'];
     255    elseif (!empty($height_tp)){
     256        if (is_numeric(substr($height_tp,-1)) or substr($height_tp, -2) == 'px'){
     257            $height = preg_replace("/[^0-9]/", "", $height_tp );
     258            $width = ($orientation == 'landscape') ? $height/$aspectRatio : $height * $aspectRatio;
     259        }
     260        elseif (substr($height_tp,-1) == '%'){
     261            $height = $height_tp;
    253262            $workAround = 'yesH';
    254263        }
     
    262271
    263272    if ($workAround == 'yesW'){
    264         if($thermProperties['orientation'] == 'landscape'){
    265             echo '<div style="margin-bottom: 1.5em; height: auto; width: '.esc_html($width).'; '.esc_html($thermProperties['align']).'">';
     273        if($orientation == 'landscape'){
     274            echo '<div style="margin-bottom: 1.5em; height: auto; width: '.esc_html($width).'; '.esc_html(esc_attr($thermProperties['align'])).'">';
    266275            echo '<svg xmlns="http://www.w3.org/tr/svg" version="2" viewbox="'.$transformY.' '.$viewboxX1.' '.$viewboxY.' '.$viewboxX2.'"       alt="'.esc_html($title).'" style="width: 100%;" preserveAspectRatio="" class="thermometer_svg">';
    267276        }
    268277        else{
    269             echo '<div style="margin-bottom: 1.5em; height: auto; width: '.esc_html($width).'; '.esc_html($thermProperties['align']).'">';
     278            echo '<div style="margin-bottom: 1.5em; height: auto; width: '.esc_html($width).'; '.esc_html(esc_attr($thermProperties['align'])).'">';
    270279            echo '<svg xmlns="http://www.w3.org/tr/svg" version="2" viewbox="'.$viewboxX1.' '.$transformY.' '.$viewboxX2.' '.$viewboxY.'"       alt="'.esc_html($title).'" preserveAspectRatio="xMidYMid" class="thermometer_svg">';
    271280        }
     
    273282    elseif ($workAround == 'yesH'){
    274283
    275         if($thermProperties['orientation'] == 'landscape'){
    276             echo '<div style="margin-bottom: 1.5em; width: auto; height: '.esc_html($height).'; '.$thermProperties['align'].'">';
     284        if($orientation == 'landscape'){
     285            echo '<div style="margin-bottom: 1.5em; width: auto; height: '.esc_html($height).'; '.esc_attr($thermProperties['align']).'">';
    277286            echo '<svg xmlns="http://www.w3.org/tr/svg" version="2" viewbox="'.$transformY.' '.$viewboxX1.' '.$viewboxY.' '.$viewboxX2.'"       alt="'.esc_html($title).'" style="width: 100%;" preserveAspectRatio="" class="thermometer_svg">';
    278287        }
     
    284293    }
    285294    else{
    286         echo '<div style="margin-bottom: 1.5em; height: '.esc_html($height).'px; width: '.esc_html($width).'px; '.esc_html($thermProperties['align']).'">';
    287         if($thermProperties['orientation'] == 'landscape'){
     295        echo '<div style="margin-bottom: 1.5em; height: '.esc_html($height).'px; width: '.esc_html($width).'px; '.esc_html(esc_attr($thermProperties['align'])).'">';
     296        if($orientation == 'landscape'){
    288297            echo '<svg xmlns="http://www.w3.org/tr/svg" version="2" x="0" y="0" width="'.esc_html($width).'" height="'.esc_html($height).'" viewbox="'.$transformY.' '.$viewboxX1.' '.($viewboxY).' '.$viewboxX2.'" alt="'.esc_html($title).'" class="thermometer_svg" style="display: block;" preserveAspectRatio="xMidYMid">';
    289298        }
     
    315324
    316325    // outline overlay with shadow
    317     if ($thermProperties['shadow'] == 1){
    318         if ($thermProperties['orientation'] == 'landscape'){
     326    if ($shadow == 1){
     327        if ($orientation == 'landscape'){
    319328            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" class="therm_border" filter="'.$basicShadow.'" ></path>';
    320329        }
     
    326335    // target
    327336    if ($showTarget == 1){
    328         if($thermProperties['orientation'] == 'landscape'){
     337        if($orientation == 'landscape'){
    329338            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>';
    330339        }
     
    336345
    337346    // background fill with a transparent border
    338     if($thermProperties['orientation'] == 'landscape'){
     347    if($orientation == 'landscape'){
    339348        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="'.$optionsCSS['therm_fill_style'].'; stroke-opacity: 0!important;"><title>'.esc_html($title).'</title></path>';
    340349    }
     
    343352    }
    344353
    345     if ($thermProperties['shadow'] == 1){ // shadows only under fill
    346         if($thermProperties['orientation'] == 'landscape'){
     354    if ($shadow == 1){ // shadows only under fill
     355        if($orientation == 'landscape'){
    347356            //major
    348357            echo '<path d="M '.$maxH.' '.$tickM.' L '.$maxH.' '.$majorTickL.' M  '.($maxH-($tickStep)).' '.$tickM.' L '.($maxH-($tickStep)).' '.$majorTickL.' M '.($maxH-($tickStep*2)).' '.$tickM.' L '.($maxH-($tickStep*2)).' '.$majorTickL.' M'.($maxH-($tickStep*3)).' '.$tickM.' L '.($maxH-($tickStep*3)).' '.$majorTickL.' M '.($maxH-($tickStep*4)).' '.$tickM.' L '.($maxH-($tickStep*4)).' '.$majorTickL.' M '.$minH.' '.$tickM.' L '.$minH.' '.$majorTickL.'" class="therm_majorTick" filter="'.$basicShadow.'"/>';
     
    363372    $oldThermLevel = $minH;
    364373    if ($targetTotal > 0){
    365         $maxLevel = ($thermProperties['swapValues'] == 0) ? $minH - (($minH - $maxH) * ($raisedTotal/$targetTotal)) : $minH - (($minH - $maxH) * ($targetTotal/$raisedTotal));
     374        $maxLevel = ($swap == 0) ? $minH - (($minH - $maxH) * ($raisedTotal/$targetTotal)) : $minH - (($minH - $maxH) * ($targetTotal/$raisedTotal));
    366375    }
    367376    else{
     
    373382    $raisedAr = array_reverse($raisedA);
    374383
    375     $rValue = ($thermProperties['swapValues'] == 0) ? $raisedValue : $targetValue;
    376 
    377 
    378     if($thermProperties['orientation'] == 'landscape'){
    379         if($thermProperties['shadow'] == 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill
     384    $rValue = ($swap == 0) ? $raisedValue : $targetValue;
     385
     386
     387    if($orientation == 'landscape'){
     388        if($shadow == 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill
    380389            echo '<path d="M '.$maxLevel.' 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 '.$maxLevel.' 23.5 L '.$maxLevel.' 59.5" style="stroke-width: 0;" filter="'.$basicShadow.'"></path>';
    381390        }
    382         elseif($thermProperties['shadow'] == 1 & $raisedTotal > $targetTotal){ // extra shadow for fill
     391        elseif($shadow == 1 & $raisedTotal > $targetTotal){ // extra shadow for fill
    383392            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;"  filter="'.$basicShadow.'"></path>';
    384393        }
     
    400409            }
    401410            else{
    402                 ##$fill = ($i > count($colorListA)-1) ? $thermProperties['fill'] : trim($colorListA[$i]); // if not enough colours in list -> transparent
     411                ##$fill = ($i > count($colorListA)-1) ? esc_attr($thermProperties['fill']) : trim($colorListA[$i]); // if not enough colours in list -> transparent
    403412                $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent
    404413                $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal));
     
    422431
    423432    else{ /// portrait
    424         if($thermProperties['shadow'] == 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill
     433        if($shadow == 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill
    425434            echo '<path d="M'.$leftM.' '.$maxLevel.' 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.' '.$maxLevel.' L '.$leftM.' '.$maxLevel.'" style="stroke-width: 0;" filter="'.$basicShadow.'"></path>';
    426435        }
    427         elseif($thermProperties['shadow'] == 1 & $raisedTotal > $targetTotal){ // extra shadow for fill
     436        elseif($shadow == 1 & $raisedTotal > $targetTotal){ // extra shadow for fill
    428437            echo '<path d="M'.$leftM.' '.$maxH.' 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.' '.$maxH.' C '.$rightM.' 30, 48 25.5, 38 25.5 C 28 25.5, 20 30, '.$leftM.' '.$maxH.'" style="stroke-width: 0;" filter="'.$basicShadow.'"/>';
    429438        }
     
    446455            }
    447456            else{
    448                 ##$fill = ($i > count($colorListA)-1) ? $thermProperties['fill'] : trim($colorListA[$i]); // if not enough colours in list -> transparent
     457                ##$fill = ($i > count($colorListA)-1) ? esc_attr($thermProperties['fill']) : trim($colorListA[$i]); // if not enough colours in list -> transparent
    449458                $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent
    450459                $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal));
     
    470479    // raised value & ticks
    471480    if ( !empty($raisedValue) && $showRaised == 1 ){
    472         $rValue = ($thermProperties['swapValues'] == 0) ? $raisedValue : $targetValue;
    473         $rValueLevel = ($thermProperties['swapValues'] == 0) ? $newThermLevel : $minH - (($minH - $maxH) * ($targetTotal/$raisedTotal));
    474         if($thermProperties['orientation'] == 'landscape'){
     481        $rValue = ($swap == 0) ? $raisedValue : $targetValue;
     482        $rValueLevel = ($swap == 0) ? $newThermLevel : $minH - (($minH - $maxH) * ($targetTotal/$raisedTotal));
     483        if($orientation == 'landscape'){
    475484            if ( $tickM == $rightM ){
    476485                echo '<path d="M '.$rValueLevel.' '.$markerMargin.', '.($rValueLevel-$markerSize).' '.($markerMargin+$markerSize).', '.($rValueLevel+$markerSize).' '.($markerMargin+$markerSize).' Z" class="therm_arrow"/>';
     
    481490
    482491            echo '<text x="'.$rValueLevel.'" y="'.($raisedMargin).'" class="therm_raised" text-anchor="middle" dominant-baseline="central" fill="'.esc_html($raisedColor).'">'.esc_html($rValue).'</text>';
    483             if ($thermProperties['swapValues'] == 1){
     492            if ($swap == 1){
    484493                echo '<path d="M'.$rValueLevel.' '.$leftM.' L '.$rValueLevel.' '.$rightM.'" class="therm_subTargetLevel"/>';
    485494            }
     
    493502                echo '<path d="M '.$markerMargin.' '.$rValueLevel.', '.($markerMargin-$markerSize).' '.($rValueLevel+$markerSize).', '.($markerMargin-$markerSize).' '.($rValueLevel-$markerSize).' Z" class="therm_arrow" />';
    494503            }
    495             if ($thermProperties['ticks'] == 'right'){
     504            if (esc_attr($thermProperties['ticks']) == 'right'){
    496505                echo '<text x="'.$raisedMargin.'" y="'.$rValueLevel.'" class="therm_raised" text-anchor="start" dominant-baseline="central" fill="'.esc_html($raisedColor).'">'.esc_html($rValue).'</text>';
    497506            }
     
    499508                echo '<text x="'.$raisedMargin.'" y="'.$rValueLevel.'" class="therm_raised" text-anchor="end" dominant-baseline="central" fill="'.esc_html($raisedColor).'">'.esc_html($rValue).'</text>';
    500509            }
    501             if ($thermProperties['swapValues'] == 1){
     510            if ($swap == 1){
    502511                echo '<path d="M'.$leftM.' '.$rValueLevel.' L '.$rightM.' '.$rValueLevel.'" class="therm_subTargetLevel"/>';
    503512            }
     
    514523                $targetLevel = $minH - (($minH - $maxH) * ($t/0.01));
    515524            }
    516             if ($thermProperties['orientation'] == 'portrait'){ // horizontal markers
     525            if ($orientation == 'portrait'){ // horizontal markers
    517526                echo '<path d="M'.$leftM.' '.$targetLevel.' L '.$rightM.' '.$targetLevel.'" class="therm_subTargetLevel"/>';
    518527            }
     
    522531            if ($raisedTotal <= $t*0.9 or $raisedTotal >= $t*1.1 or $showRaised == 0){ // within 10% but only when not reached the subtotal
    523532                if ($showSubTargets == 1){
    524                     $t = ($thermProperties['trailing'] == 'true') ? esc_html(number_format($t,$decimals,$thermProperties['decsep'],$thermProperties['sep']).$currency) : esc_html($currency.number_format($t,$decimals,$thermProperties['decsep'],$thermProperties['sep']));
    525                     if ($thermProperties['orientation'] == 'portrait'){
     533                    $t = ($trailing == 'true') ? esc_html(number_format($t,$decimals,$decsep,$sep).$currency) : esc_html($currency.number_format($t,$decimals,$decsep,$sep));
     534                    if ($orientation == 'portrait'){
    526535                        if ( $tickM == $rightM ){
    527536                            echo '<path d="M '.$markerMargin.' '.$targetLevel.', '.($markerMargin+$markerSize).' '.($targetLevel-$markerSize).', '.($markerMargin+$markerSize).' '.($targetLevel+$markerSize).' Z" class="therm_subTargetArrow"/>';
     
    533542                        echo '<text x="'.$raisedMargin.'" y="'.$targetLevel.'" fill="'.$subTargetColor.'" class="therm_subTarget" text-anchor="'.$raisedAnchor.'" dominant-baseline="central">'.$t.'</text>';
    534543                    }
    535                     elseif($thermProperties['orientation'] == 'landscape'){
     544                    elseif($orientation == 'landscape'){
    536545                        if ( $tickM == $rightM ){
    537546                            echo '<path d="M '.$targetLevel.' '.$subMarkerMargin.', '.($targetLevel+$markerSize).' '.($subMarkerMargin-$markerSize).', '.($targetLevel-$markerSize).' '.($subMarkerMargin-$markerSize).' Z" class="therm_subTargetArrow"/>';
     
    549558
    550559
    551     if($thermProperties['orientation'] == 'landscape'){
     560    if($orientation == 'landscape'){
    552561        //major
    553562        echo '<path d="M '.$maxH.' '.$tickM.' L '.$maxH.' '.$majorTickL.' M  '.($maxH-($tickStep)).' '.$tickM.' L '.($maxH-($tickStep)).' '.$majorTickL.' M '.($maxH-($tickStep*2)).' '.$tickM.' L '.($maxH-($tickStep*2)).' '.$majorTickL.' M'.($maxH-($tickStep*3)).' '.$tickM.' L '.($maxH-($tickStep*3)).' '.$majorTickL.' M '.($maxH-($tickStep*4)).' '.$tickM.' L '.($maxH-($tickStep*4)).' '.$majorTickL.' M '.$minH.' '.$tickM.' L '.$minH.' '.$majorTickL.'" class="therm_majorTick"/>';
     
    564573
    565574    // outline overlay  // title needs to be a child element to display as tooltip
    566     if($thermProperties['orientation'] == 'landscape'){
     575    if($orientation == 'landscape'){
    567576        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" class="therm_border"><title>'.esc_html($title).'</title></path>';
    568577    }
     
    572581
    573582    //
    574     /*if ($thermProperties['shadow'] == 1){
     583    /*if ($shadow == 1){
    575584        echo '<path d="M '.($leftM+5).' '.($maxH+2).' L '.($leftM+5).' 253 C 20.5 257, 18 264, 18 268 C 18 282, 29 288, 38 288 C 47 288, 50 285, 53 282" style="stroke-width: 6px; stroke: #ffffffad; fill:transparent;" filter="url(#blurFilter)"/>';
    576585        echo '<path d="M '.($leftM+5).' '.($maxH+2).' L '.($leftM+5).' 253 C 20.5 257, 18 264, 18 268 C 18 282, 29 288, 38 288 C 47 288, 50 285, 53 282" style="stroke-width: 1.5px; stroke: #f6eaea30; fill:transparent;" filter="url(#blurFilter2)"/>';
     
    579588
    580589    // percentage
    581     if ($thermProperties['showPercent'] == 1){
     590    if (esc_attr($thermProperties['showPercent']) == 1){
    582591        if (mb_strlen($raisedPercent) < 3){
    583592            $fontS_percent = 17;
     
    593602        }
    594603
    595         if($thermProperties['orientation'] == 'landscape'){
     604        if($orientation == 'landscape'){
    596605            echo '<text x="37.5" y="41.5" class="therm_percent" style="text-anchor:middle;font-size: '.$fontS_percent.'px" dominant-baseline="central"  fill="'.esc_html($percentageColor).'">'.esc_html($raisedPercent).'%</text>';
    597606        }
     
    609618        $j = 0;
    610619
    611         if($thermProperties['orientation'] == 'landscape'){
     620        if($orientation == 'landscape'){
    612621            $legendLevel = 10;
    613622            echo '<text class="therm_legend" x="'.($legendLevel-10).'" y="'.max(0,(41.5-((($legendStep+6)*count($legendAr))/2))).'" text-anchor="end" dominant-baseline="central">';
     
    623632            }
    624633            $legendColor = (array_key_exists($i, $colorListA)) ? trim($colorListA[$i]) : 'black';
    625             if($thermProperties['orientation'] == 'landscape'){
     634            if($orientation == 'landscape'){
    626635                echo '<tspan x="'.($legendLevel-10).'" dy="'.$legendStep.'" fill="'.$legendColor.'" text-anchor="end" alignment-baseline="central">'.esc_html($legendAr[$j]);
    627636            }
     
    630639            }
    631640            if (count($raisedA) >= 1){
    632                 echo ($thermProperties['trailing'] == 'true') ? esc_html(' ('.trim(number_format($r,$decimals,$thermProperties['decsep'],$thermProperties['sep'])).$currency.')') : esc_html(' ('.$currency.trim(number_format($r,$decimals,$thermProperties['decsep'],$thermProperties['sep']))).')</tspan>';
     641                echo ($trailing == 'true') ? esc_html(' ('.trim(number_format($r,$decimals,$decsep,$sep)).$currency.')') : esc_html(' ('.$currency.trim(number_format($r,$decimals,$decsep,$sep))).')</tspan>';
    633642            }
    634643
  • donation-thermometer/trunk/readme.txt

    r3285212 r3399935  
    55Requires at least: 4.6
    66Tested up to: 6.8
    7 Stable tag: 2.2.6
     7Stable tag: 2.2.7
    88Requires PHP: 5.2
    99License: GPL3
     
    1717
    1818<strong>Fully customisable</strong>
    19 Unlimited thermometers can be made, each fully customisable to blend seamlessly with your site's theme. Thermometers are rendered as vector-based images (SVG) that produce a visually sharp graphic. Since the plugin does not load any remote image files your page-load times will remain fast and save bandwith for users.
     19Unlimited thermometers can be made, each fully customisable to blend seamlessly with your site's theme. Thermometers are rendered as vector-based images (SVG) that produce a visually sharp graphic. Since the plugin does not load any remote image files, your page-load times will remain fast and save bandwidth for users.
    2020
    2121<strong>Automatic updating of values supported</strong>
     
    8080
    8181== Changelog ==
     82
     83= 2.2.7 =
     84* Allowed shortcodes for the target value(s).
     85* Fixed bug related to svg margins when displaying multiple targets.
     86* Security fixes.
    8287
    8388= 2.2.6 =
Note: See TracChangeset for help on using the changeset viewer.