| @@ -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 | |