Changeset 3399935
- Timestamp:
- 11/20/2025 05:38:17 PM (4 months ago)
- Location:
- donation-thermometer/trunk
- Files:
-
- 4 edited
-
donation_therm.php (modified) (1 diff)
-
includes/therm_shortcode.php (modified) (23 diffs)
-
includes/therm_svg.php (modified) (40 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
donation-thermometer/trunk/donation_therm.php
r3169971 r3399935 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. 66 Version: 2.2.7 7 7 Author: Henry Patton 8 8 Text Domain: donation-thermometer -
donation-thermometer/trunk/includes/therm_shortcode.php
r2967764 r3399935 2 2 /////////////////////////////// shortcode stuff... 3 3 4 function 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 } 4 9 function thermometer_graphic($atts){ 5 10 $atts = (shortcode_atts( … … 40 45 //thermometer alignment (vertical/horizontal) 41 46 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']); 46 51 } 47 52 … … 53 58 54 59 if (!empty($atts['width'])){ 55 $thermProperties['width'] = $atts['width'];60 $thermProperties['width'] = esc_attr($atts['width']); 56 61 $thermProperties['height'] = ''; 57 62 } … … 63 68 //height 64 69 if (!empty($atts['height'])){ 65 $thermProperties['height'] = $atts['height'];70 $thermProperties['height'] = esc_attr($atts['height']); 66 71 $thermProperties['width'] = ''; 67 72 } 68 73 elseif(empty($atts['height']) && !empty($atts['width'])){ 69 $thermProperties['width'] = $atts['width'];74 $thermProperties['width'] = esc_attr($atts['width']); 70 75 $thermProperties['height'] = ''; 71 76 } … … 76 81 //currency value to use 77 82 if (empty($atts['currency'])){ 78 $thermProperties['currency'] = $options['currency'];83 $thermProperties['currency'] = esc_attr($options['currency']); 79 84 } 80 85 elseif(strtolower($atts['currency']) == 'null'){ //get user to enter null for no value … … 82 87 } 83 88 else{ 84 $thermProperties['currency'] = $atts['currency']; //set currency to default or shortcode value89 $thermProperties['currency'] = esc_attr($atts['currency']); //set currency to default or shortcode value 85 90 } 86 91 87 92 //decimal separator 88 93 if(!empty($atts['decsep'])){ 89 $thermProperties['decsep'] = $atts['decsep'];94 $thermProperties['decsep'] = esc_attr($atts['decsep']); 90 95 } 91 96 else{ … … 96 101 //target value 97 102 if ($atts['target'] == '' && !empty($options['target_string'])){ 98 $thermProperties['target'] = $options['target_string'];103 $thermProperties['target'] = esc_attr($options['target_string']); 99 104 } 100 105 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']))); 105 115 } 106 116 … … 123 133 //raised value 124 134 if ($atts['raised'] == '' && !empty($options['raised_string'])){ 125 $thermProperties['raised'] = $options['raised_string'];135 $thermProperties['raised'] = esc_attr($options['raised_string']); 126 136 } 127 137 else{ … … 131 141 $atts['raised'] = do_shortcode( $shortcode); 132 142 } 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']))); 134 144 } 135 145 … … 142 152 } 143 153 elseif (!empty($atts['align'])){ 144 $thermProperties['align'] = 'display:block; float:'.strtolower( $atts['align']).';';154 $thermProperties['align'] = 'display:block; float:'.strtolower(esc_attr($atts['align'])).';'; 145 155 } 146 156 else{ … … 151 161 //thousands separator 152 162 if(!empty($atts['sep'])){ 153 $thermProperties['sep'] = $atts['sep'];163 $thermProperties['sep'] = esc_attr($atts['sep']); 154 164 } 155 165 else{ … … 161 171 } 162 172 else{ 163 $thermProperties['sep'] = substr( $options['thousands'],0,1);173 $thermProperties['sep'] = substr(esc_attr($options['thousands']),0,1); 164 174 } 165 175 } … … 167 177 //decimal places 168 178 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']); 173 183 } 174 184 175 185 // 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']); 181 191 } 182 192 … … 184 194 if(!empty($atts['filltype'])){ 185 195 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']); 188 198 } 189 199 else{ 190 $thermProperties['fill2'] = $atts['fill2'];200 $thermProperties['fill2'] = esc_attr($options['colour_picker6']); 191 201 } 192 202 } 193 203 else{ 194 $thermProperties['fill2'] = $thermProperties['fill'];204 $thermProperties['fill2'] = esc_attr($thermProperties['fill']); 195 205 } 196 206 } 197 207 else{ 198 208 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']); 201 211 } 202 212 else{ 203 $thermProperties['fill2'] = $atts['fill2'];213 $thermProperties['fill2'] = esc_attr($options['colour_picker6']); 204 214 } 205 215 } 206 216 else{ 207 $thermProperties['fill2'] = $thermProperties['fill'];217 $thermProperties['fill2'] = esc_attr($thermProperties['fill']); 208 218 } 209 219 } … … 225 235 //title text 226 236 if (!empty($atts['alt'])){ 227 $thermProperties['title'] = $atts['alt'];237 $thermProperties['title'] = esc_attr($atts['alt']); 228 238 } 229 239 else{ … … 233 243 //legend 234 244 if(!empty($atts['legend'])){ 235 $thermProperties['legend'] = $atts['legend'];245 $thermProperties['legend'] = esc_attr($atts['legend']); 236 246 } 237 247 else{ … … 241 251 //tick alignment 242 252 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']); 247 257 } 248 258 249 259 // color ramp 250 260 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']); 255 265 } 256 266 … … 287 297 } 288 298 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']); 293 303 //print_r($thermProperties); 294 304 //print_r($atts); … … 308 318 global $thermDefaults; 309 319 $options = wp_parse_args( get_option('thermometer_options',$thermDefaults), $thermDefaults); 310 $raisedA = explode(';', $options['raised_string']);320 $raisedA = explode(';',esc_attr($options['raised_string'])); 311 321 312 322 if($options['thousands'] == ' (space)'){ … … 317 327 } 318 328 else{ 319 $sep = substr( $options['thousands'],0,1);329 $sep = substr(esc_attr($options['thousands']),0,1); 320 330 } 321 331 $decsep = ($options['decsep'] == ', (comma)') ? ',' : '.'; 322 $decimals = $options['decimals'];332 $decimals = esc_attr($options['decimals']); 323 333 324 334 if (end($raisedA) == 'off'){ … … 351 361 global $thermDefaults; 352 362 $options = wp_parse_args( get_option('thermometer_options',$thermDefaults), $thermDefaults); 353 $target = $options['target_string'];363 $target = esc_attr($options['target_string']); 354 364 if($options['thousands'] == ' (space)'){ 355 365 $sep = ' '; … … 359 369 } 360 370 else{ 361 $sep = substr( $options['thousands'],0,1);371 $sep = substr(esc_attr($options['thousands']),0,1); 362 372 } 363 373 $decsep = ($options['decsep'] == ', (comma)') ? ',' : '.'; 364 $decimals = $options['decimals'];374 $decimals = esc_attr($options['decimals']); 365 375 if ($target != ''){ 366 376 $targetA = explode(';',$target); … … 392 402 $raised = therm_raised(); 393 403 $options = wp_parse_args( get_option('thermometer_options',$thermDefaults), $thermDefaults); 394 $decimals = $options['decimals'];404 $decimals = esc_attr($options['decimals']); 395 405 $div = (float) str_replace(',', '', $raised) / (float) str_replace(',', '', $target); 396 406 return ($target > 0) ? number_format(($div * 100),$decimals).'%' : __('unknown %','donation-thermometer'); -
donation-thermometer/trunk/includes/therm_svg.php
r3169971 r3399935 13 13 $optionsCSS = wp_parse_args( get_option('thermometer_style',$thermDefaultStyle), $thermDefaultStyle); 14 14 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']).'} 29 29 </style>'; 30 30 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 31 40 // thermometer values and units 32 $raisedA = explode(';', $thermProperties['raised']);41 $raisedA = explode(';',esc_attr($thermProperties['raised'])); 33 42 if (end($raisedA) == 'off'){ 34 43 $showRaised = 0; … … 36 45 } 37 46 else{ 38 $showRaised = $thermProperties['showRaised'];39 } 40 41 if ($ thermProperties['decsep']== ','){47 $showRaised = esc_attr($thermProperties['showRaised']); 48 } 49 50 if ($decsep == ','){ 42 51 foreach($raisedA as &$item) { 43 52 $item = floatval(str_replace(',', '.', str_replace('.', '', strval($item)))); … … 51 60 $raisedTotal = array_sum($raisedA); 52 61 53 $targetA = explode(';', $thermProperties['target']);54 if ($ thermProperties['decsep']== ','){62 $targetA = explode(';',esc_attr($thermProperties['target'])); 63 if ($decsep == ','){ 55 64 foreach($targetA as &$item) { 56 65 $item = floatval(str_replace(',', '.', str_replace('.', '', strval($item)))); … … 67 76 } 68 77 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']); 73 82 $targetTotal = max(0,end($targetA)); 74 83 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 = ($t hermProperties['trailing'] == 'true') ? number_format($raisedTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']).$currency : $currency.number_format($raisedTotal,$decimals,$thermProperties['decsep'],$thermProperties['sep']);79 $targetValue = ($t hermProperties['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; 81 90 end($targetA); // move pointer to end of array 82 91 if ($showSubTargets == 1){ 83 $subTargetValue = ($t hermProperties['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); 84 93 } 85 94 else{ … … 88 97 89 98 // 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']); 99 108 $gradient = '<linearGradient id="'.$gradID.'" x1="0" x2="1" y1="0" y2="0"> 100 109 <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%" /> 102 111 </linearGradient>'; 103 112 } 104 113 else{ 105 $gradID = 'ThermGrad_'. $thermProperties['fill2']. '_' . esc_html(trim($colorListA[0]));114 $gradID = 'ThermGrad_'. esc_attr($thermProperties['fill2']) . '_' . esc_html(trim($colorListA[0])); 106 115 $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%" /> 108 117 <stop style="stop-color: ' . esc_html(trim($colorListA[0])) . '" offset="100%" /> 109 118 </linearGradient>'; 110 119 } 111 120 112 $legend = rtrim( $thermProperties['legend'],';'); // trim last semicolon if added121 $legend = rtrim(esc_attr($thermProperties['legend']),';'); // trim last semicolon if added 113 122 $legendA = explode(';',$legend); 114 123 $legendA = array_slice($legendA,0,count($raisedA)); // shorten legend entries to match raised value count 115 124 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)' : ''; 121 130 122 131 // 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; 125 134 $tickStep = 42; 126 $leftM = ($ thermProperties['orientation']== 'landscape') ? 23.5 : 20; // Y : X127 $rightM = ($ thermProperties['orientation']== 'landscape') ? 59.5 : 56; // Y : X128 $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; 129 138 $markerSize = 5; 130 139 $legendStep = 15; 131 140 132 if($ thermProperties['orientation']== 'landscape'){141 if($orientation == 'landscape'){ 133 142 $transformY = 0; 134 143 } … … 137 146 } 138 147 $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'){ 142 151 if (mb_strlen($targetValue)<8){ 143 152 $targetAnchorPoint = $maxH; … … 152 161 $targetLen = mb_strlen($tValue); 153 162 if ($tickM === $rightM){ // left or right ticks 154 if($ thermProperties['orientation']!= 'landscape'){163 if($orientation != 'landscape'){ 155 164 $viewboxX1 = ($targetLen > 7) ? ($targetLen * -2.5) + 7 : 0; 156 165 } … … 161 170 $minorTickL = $rightM - 6; 162 171 $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; 166 175 $raisedAnchor = 'start'; 167 176 } 168 177 else{ 169 178 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; 174 183 } 175 184 … … 177 186 $minorTickL = $leftM + 6; 178 187 $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; 182 191 $raisedAnchor = 'end'; 183 192 } 184 193 185 if($ thermProperties['orientation']!= 'landscape'){194 if($orientation != 'landscape'){ 186 195 if (count($targetA) > 1){ 187 $viewboxX2 = 76 + m b_strlen($subTargetValue)*8; // expand right196 $viewboxX2 = 76 + max(mb_strlen($raisedValue), mb_strlen($subTargetValue))*8; // expand right 188 197 $viewboxX2 = ($targetLen > 7) ? $viewboxX2 + ($targetLen * 2.5) - 9 : $viewboxX2; 189 198 } … … 197 206 //count chars 198 207 $maxRaised = max(array_map('stringLength',$raisedA, $legendA)) 199 + mb_strlen( $thermProperties['currency'])208 + mb_strlen(esc_attr($thermProperties['currency'])) 200 209 + 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); 203 212 } 204 213 if ($decimals > 0){ … … 206 215 } 207 216 208 if($ thermProperties['orientation']== 'landscape'){217 if($orientation == 'landscape'){ 209 218 $transformY = ($transformY - ($maxRaised*6.25)); // expand left 210 219 $viewboxY = ($viewboxY + ($maxRaised*6.25)); // expand right … … 219 228 220 229 // title/alt attribute 221 if (strtolower( $thermProperties['title']) == 'off'){230 if (strtolower(esc_attr($thermProperties['title'])) == 'off'){ 222 231 $title = ''; 223 232 } 224 elseif(!empty( $thermProperties['title'])){225 $title = $thermProperties['title'];233 elseif(!empty(esc_attr($thermProperties['title']))){ 234 $title = esc_attr($thermProperties['title']); 226 235 } 227 236 else{ … … 233 242 $aspectRatio = $viewboxX2/$viewboxY; // width/height 234 243 $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.'%'; 243 252 $workAround = 'yesW'; 244 253 } 245 254 } 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; 253 262 $workAround = 'yesH'; 254 263 } … … 262 271 263 272 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'])).'">'; 266 275 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">'; 267 276 } 268 277 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'])).'">'; 270 279 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">'; 271 280 } … … 273 282 elseif ($workAround == 'yesH'){ 274 283 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']).'">'; 277 286 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">'; 278 287 } … … 284 293 } 285 294 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'){ 288 297 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">'; 289 298 } … … 315 324 316 325 // outline overlay with shadow 317 if ($ thermProperties['shadow']== 1){318 if ($ thermProperties['orientation']== 'landscape'){326 if ($shadow == 1){ 327 if ($orientation == 'landscape'){ 319 328 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>'; 320 329 } … … 326 335 // target 327 336 if ($showTarget == 1){ 328 if($ thermProperties['orientation']== 'landscape'){337 if($orientation == 'landscape'){ 329 338 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>'; 330 339 } … … 336 345 337 346 // background fill with a transparent border 338 if($ thermProperties['orientation']== 'landscape'){347 if($orientation == 'landscape'){ 339 348 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>'; 340 349 } … … 343 352 } 344 353 345 if ($ thermProperties['shadow']== 1){ // shadows only under fill346 if($ thermProperties['orientation']== 'landscape'){354 if ($shadow == 1){ // shadows only under fill 355 if($orientation == 'landscape'){ 347 356 //major 348 357 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.'"/>'; … … 363 372 $oldThermLevel = $minH; 364 373 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)); 366 375 } 367 376 else{ … … 373 382 $raisedAr = array_reverse($raisedA); 374 383 375 $rValue = ($ thermProperties['swapValues']== 0) ? $raisedValue : $targetValue;376 377 378 if($ thermProperties['orientation']== 'landscape'){379 if($ thermProperties['shadow']== 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill384 $rValue = ($swap == 0) ? $raisedValue : $targetValue; 385 386 387 if($orientation == 'landscape'){ 388 if($shadow == 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill 380 389 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>'; 381 390 } 382 elseif($ thermProperties['shadow']== 1 & $raisedTotal > $targetTotal){ // extra shadow for fill391 elseif($shadow == 1 & $raisedTotal > $targetTotal){ // extra shadow for fill 383 392 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>'; 384 393 } … … 400 409 } 401 410 else{ 402 ##$fill = ($i > count($colorListA)-1) ? $thermProperties['fill']: trim($colorListA[$i]); // if not enough colours in list -> transparent411 ##$fill = ($i > count($colorListA)-1) ? esc_attr($thermProperties['fill']) : trim($colorListA[$i]); // if not enough colours in list -> transparent 403 412 $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent 404 413 $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal)); … … 422 431 423 432 else{ /// portrait 424 if($ thermProperties['shadow']== 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill433 if($shadow == 1 & $raisedTotal <= $targetTotal){ // extra shadow for fill 425 434 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>'; 426 435 } 427 elseif($ thermProperties['shadow']== 1 & $raisedTotal > $targetTotal){ // extra shadow for fill436 elseif($shadow == 1 & $raisedTotal > $targetTotal){ // extra shadow for fill 428 437 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.'"/>'; 429 438 } … … 446 455 } 447 456 else{ 448 ##$fill = ($i > count($colorListA)-1) ? $thermProperties['fill']: trim($colorListA[$i]); // if not enough colours in list -> transparent457 ##$fill = ($i > count($colorListA)-1) ? esc_attr($thermProperties['fill']) : trim($colorListA[$i]); // if not enough colours in list -> transparent 449 458 $fill = ($i > count($colorListA)-1) ? 'url(#'.$gradID.')' : trim($colorListA[$i]); // if not enough colours in list -> transparent 450 459 $newThermLevel = ($raisedTotal > $targetTotal) ? $oldThermLevel - (($minH - $maxH) * ($r/$raisedTotal)) : $oldThermLevel - (($minH - $maxH) * ($r/$targetTotal)); … … 470 479 // raised value & ticks 471 480 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'){ 475 484 if ( $tickM == $rightM ){ 476 485 echo '<path d="M '.$rValueLevel.' '.$markerMargin.', '.($rValueLevel-$markerSize).' '.($markerMargin+$markerSize).', '.($rValueLevel+$markerSize).' '.($markerMargin+$markerSize).' Z" class="therm_arrow"/>'; … … 481 490 482 491 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){ 484 493 echo '<path d="M'.$rValueLevel.' '.$leftM.' L '.$rValueLevel.' '.$rightM.'" class="therm_subTargetLevel"/>'; 485 494 } … … 493 502 echo '<path d="M '.$markerMargin.' '.$rValueLevel.', '.($markerMargin-$markerSize).' '.($rValueLevel+$markerSize).', '.($markerMargin-$markerSize).' '.($rValueLevel-$markerSize).' Z" class="therm_arrow" />'; 494 503 } 495 if ( $thermProperties['ticks']== 'right'){504 if (esc_attr($thermProperties['ticks']) == 'right'){ 496 505 echo '<text x="'.$raisedMargin.'" y="'.$rValueLevel.'" class="therm_raised" text-anchor="start" dominant-baseline="central" fill="'.esc_html($raisedColor).'">'.esc_html($rValue).'</text>'; 497 506 } … … 499 508 echo '<text x="'.$raisedMargin.'" y="'.$rValueLevel.'" class="therm_raised" text-anchor="end" dominant-baseline="central" fill="'.esc_html($raisedColor).'">'.esc_html($rValue).'</text>'; 500 509 } 501 if ($ thermProperties['swapValues']== 1){510 if ($swap == 1){ 502 511 echo '<path d="M'.$leftM.' '.$rValueLevel.' L '.$rightM.' '.$rValueLevel.'" class="therm_subTargetLevel"/>'; 503 512 } … … 514 523 $targetLevel = $minH - (($minH - $maxH) * ($t/0.01)); 515 524 } 516 if ($ thermProperties['orientation']== 'portrait'){ // horizontal markers525 if ($orientation == 'portrait'){ // horizontal markers 517 526 echo '<path d="M'.$leftM.' '.$targetLevel.' L '.$rightM.' '.$targetLevel.'" class="therm_subTargetLevel"/>'; 518 527 } … … 522 531 if ($raisedTotal <= $t*0.9 or $raisedTotal >= $t*1.1 or $showRaised == 0){ // within 10% but only when not reached the subtotal 523 532 if ($showSubTargets == 1){ 524 $t = ($t hermProperties['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'){ 526 535 if ( $tickM == $rightM ){ 527 536 echo '<path d="M '.$markerMargin.' '.$targetLevel.', '.($markerMargin+$markerSize).' '.($targetLevel-$markerSize).', '.($markerMargin+$markerSize).' '.($targetLevel+$markerSize).' Z" class="therm_subTargetArrow"/>'; … … 533 542 echo '<text x="'.$raisedMargin.'" y="'.$targetLevel.'" fill="'.$subTargetColor.'" class="therm_subTarget" text-anchor="'.$raisedAnchor.'" dominant-baseline="central">'.$t.'</text>'; 534 543 } 535 elseif($ thermProperties['orientation']== 'landscape'){544 elseif($orientation == 'landscape'){ 536 545 if ( $tickM == $rightM ){ 537 546 echo '<path d="M '.$targetLevel.' '.$subMarkerMargin.', '.($targetLevel+$markerSize).' '.($subMarkerMargin-$markerSize).', '.($targetLevel-$markerSize).' '.($subMarkerMargin-$markerSize).' Z" class="therm_subTargetArrow"/>'; … … 549 558 550 559 551 if($ thermProperties['orientation']== 'landscape'){560 if($orientation == 'landscape'){ 552 561 //major 553 562 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"/>'; … … 564 573 565 574 // outline overlay // title needs to be a child element to display as tooltip 566 if($ thermProperties['orientation']== 'landscape'){575 if($orientation == 'landscape'){ 567 576 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>'; 568 577 } … … 572 581 573 582 // 574 /*if ($ thermProperties['shadow']== 1){583 /*if ($shadow == 1){ 575 584 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)"/>'; 576 585 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)"/>'; … … 579 588 580 589 // percentage 581 if ( $thermProperties['showPercent']== 1){590 if (esc_attr($thermProperties['showPercent']) == 1){ 582 591 if (mb_strlen($raisedPercent) < 3){ 583 592 $fontS_percent = 17; … … 593 602 } 594 603 595 if($ thermProperties['orientation']== 'landscape'){604 if($orientation == 'landscape'){ 596 605 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>'; 597 606 } … … 609 618 $j = 0; 610 619 611 if($ thermProperties['orientation']== 'landscape'){620 if($orientation == 'landscape'){ 612 621 $legendLevel = 10; 613 622 echo '<text class="therm_legend" x="'.($legendLevel-10).'" y="'.max(0,(41.5-((($legendStep+6)*count($legendAr))/2))).'" text-anchor="end" dominant-baseline="central">'; … … 623 632 } 624 633 $legendColor = (array_key_exists($i, $colorListA)) ? trim($colorListA[$i]) : 'black'; 625 if($ thermProperties['orientation']== 'landscape'){634 if($orientation == 'landscape'){ 626 635 echo '<tspan x="'.($legendLevel-10).'" dy="'.$legendStep.'" fill="'.$legendColor.'" text-anchor="end" alignment-baseline="central">'.esc_html($legendAr[$j]); 627 636 } … … 630 639 } 631 640 if (count($raisedA) >= 1){ 632 echo ($t hermProperties['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>'; 633 642 } 634 643 -
donation-thermometer/trunk/readme.txt
r3285212 r3399935 5 5 Requires at least: 4.6 6 6 Tested up to: 6.8 7 Stable tag: 2.2. 67 Stable tag: 2.2.7 8 8 Requires PHP: 5.2 9 9 License: GPL3 … … 17 17 18 18 <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.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 bandwidth for users. 20 20 21 21 <strong>Automatic updating of values supported</strong> … … 80 80 81 81 == 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. 82 87 83 88 = 2.2.6 =
Note: See TracChangeset
for help on using the changeset viewer.