PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.6.2
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.6.2
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
← All changes | includes/CampaignShortcode.php +7 -11 trunk2.6.2 View file →
@@ -29,17 +29,10 @@
29 29 function init()
30 30 {
31 31 add_shortcode( 'hurrytimer', [ $this, 'content' ] );
32 32 add_filter( 'pre_do_shortcode_tag', [ $this, 'maybe_display' ], 10, 3 );
33 - add_filter( 'shortcode_atts_hurrytimer', [$this, 'translate_shortcode_id' ] );
34 -
35 33 }
36 34
37 - function translate_shortcode_id($out){
38 - $out['id'] = apply_filters( 'wpml_object_id', $out['id'], HURRYT_POST_TYPE, true );
39 -
40 - return $out;
41 - }
42 35 /**
43 36 *
44 37 * @param $return
45 38 * @param $tag
@@ -52,17 +45,19 @@
52 45 if ( $tag !== 'hurrytimer' ) {
53 46 return $return;
54 47 }
55 48
56 - $attrs = shortcode_atts($this->default_attrs, $attrs, 'hurrytimer');
49 +
50 + $attrs = wp_parse_args( $attrs, $this->default_attrs );
51 +
57 52 $attrs = filter_var_array( $attrs, $this->attrs_filter_def );
58 53
59 54 if ( empty( $attrs[ 'id' ] ) ) {
60 - return 'HurryTimer: ' . __( 'Invalid campaign ID.', 'hurrytimer' );
55 + return __( 'HurryTimer: Invalid campaign ID.', 'hurrytimer' );
61 56 }
62 57
63 58 if ( !get_post( $attrs[ 'id' ] ) ) {
64 - return 'HurryTimer: ' . __( 'Invalid campaign ID.', 'hurrytimer' );
59 + return __( 'HurryTimer: Invalid campaign ID.', 'hurrytimer' );
65 60 }
66 61
67 62 $campaign = hurryt_get_campaign( $attrs[ 'id' ] );
68 63
@@ -94,9 +89,10 @@
94 89 */
95 90 public function content( $attrs )
96 91 {
97 92
98 - $attrs = shortcode_atts($this->default_attrs, $attrs, 'hurrytimer');
93 + $attrs = wp_parse_args( $attrs, $this->default_attrs );
94 +
99 95 $attrs = filter_var_array( $attrs, $this->attrs_filter_def );
100 96
101 97 $campaign = hurryt_get_campaign( absint( $attrs[ 'id' ] ) );
102 98