PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
← All changes | admin/advanced-settings/includes/shortcodes/compare.php +15 -10 3.9.9 → 4.0.3 View file →
@@ -1,18 +1,23 @@
1 1 <?php
2 +// Exit if accessed directly
3 +if ( ! defined( 'ABSPATH' ) ) exit;
2 4
3 5 add_shortcode( 'compare', 'wppb_toolbox_compare_shortcode' );
4 6 function wppb_toolbox_compare_shortcode( $atts, $content ){
5 - extract(
6 - $out = shortcode_atts( array( 'val1' => '', 'val2' => '', 'operator' => ''), $atts )
7 - );
8 7
9 - foreach($out as $key => $value){
10 - $out[$key] = str_replace('&#8221;', '', $value );
8 + $atts = shortcode_atts( array(
9 + 'val1' => '',
10 + 'val2' => '',
11 + 'operator' => '',
12 + ), $atts, 'compare' );
13 +
14 + foreach($atts as $key => $value){
15 + $atts[$key] = str_replace('&#8221;', '', $value );
11 16 }
12 17
13 - $l = $out['val1'];
14 - $r = $out['val2'];
18 + $l = $atts['val1'];
19 + $r = $atts['val2'];
15 20
16 21 $operators = array(
17 22 '==' => function($l, $r) {
18 23 return $l == $r;
@@ -39,12 +44,12 @@
39 44 return $l == $r;
40 45 },
41 46 );
42 47
43 - if ( !array_key_exists($out['operator'], $operators ) )
44 - return '<p>The compare operator <strong style="padding:0 10px;">' . $out["operator"] . '</strong> is not recognized. Please try: == , ===, !=, <, >, <=, >=';
48 + if ( !array_key_exists($atts['operator'], $operators ) )
49 + return '<p>The compare operator <strong style="padding:0 10px;">' . esc_html( $atts["operator"] ) . '</strong> is not recognized. Please try: == , ===, !=, <, >, <=, >=';
45 50
46 - $bool = $operators[$out['operator']]($l, $r);
51 + $bool = $operators[$atts['operator']]($l, $r);
47 52
48 53 if( $bool )
49 54 return do_shortcode( $content );
50 55 }