| @@ -23,10 +23,9 @@ | ||
| 23 | 23 | * Register actions and filters. |
| 24 | 24 | * |
| 25 | 25 | * @since 3.0.0 |
| 26 | 26 | */ |
| 27 | - public static function init() { | |
| 28 | - add_shortcode( 'wpupg-grid-limit', array( __CLASS__, 'grid_limit_shortcode' ) ); | |
| 27 | + public static function init() { | |
| 29 | 28 | add_shortcode( 'wpupg-grid-with-filters', array( __CLASS__, 'grid_with_filters_shortcode' ) ); |
| 30 | 29 | add_shortcode( 'wpupg-grid', array( __CLASS__, 'grid_shortcode' ) ); |
| 31 | 30 | add_shortcode( 'wpupg-filter', array( __CLASS__, 'filter_shortcode' ) ); |
| 32 | 31 | } |
| @@ -31,23 +30,8 @@ | ||
| 31 | 30 | add_shortcode( 'wpupg-filter', array( __CLASS__, 'filter_shortcode' ) ); |
| 32 | 31 | } |
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | - * Output the grid limit shortcode. | |
| 36 | - * | |
| 37 | - * @since 3.9.0 | |
| 38 | - * @param mixed $atts Shortcode attributes. | |
| 39 | - */ | |
| 40 | - public static function grid_limit_shortcode( $atts ) { | |
| 41 | - $atts = shortcode_atts( array( | |
| 42 | - 'id' => '', | |
| 43 | - ), $atts, 'wpupg_grid_limit' ); | |
| 44 | - | |
| 45 | - // Just output empty. Grid Limit Rules class will handle the rest based on the shortcode attributes. | |
| 46 | - return ''; | |
| 47 | - } | |
| 48 | - | |
| 49 | - /** | |
| 50 | 34 | * Output the entire grid shortcode. |
| 51 | 35 | * |
| 52 | 36 | * @since 3.0.0 |
| 53 | 37 | * @param mixed $atts Shortcode attributes. |
| @@ -68,9 +52,9 @@ | ||
| 68 | 52 | if ( $grid ) { |
| 69 | 53 | WPUPG_Assets::load(); |
| 70 | 54 | |
| 71 | 55 | $output = WPUPG_Grid_Output::entire( $grid, $atts ); |
| 72 | - WPUPG_Assets::add_js_data( 'wpupg_grid_args_' . $grid->id(), $grid->get_javascript_args() ); | |
| 56 | + wp_localize_script( 'wpupg-public', 'wpupg_grid_args_' . $grid->id(), $grid->get_javascript_args() ); | |
| 73 | 57 | } |
| 74 | 58 | |
| 75 | 59 | return $output; |
| 76 | 60 | } |
| @@ -97,9 +81,9 @@ | ||
| 97 | 81 | if ( $grid ) { |
| 98 | 82 | WPUPG_Assets::load(); |
| 99 | 83 | |
| 100 | 84 | $output = WPUPG_Grid_Output::grid( $grid, $atts ); |
| 101 | - WPUPG_Assets::add_js_data( 'wpupg_grid_args_' . $grid->id(), $grid->get_javascript_args() ); | |
| 85 | + wp_localize_script( 'wpupg-public', 'wpupg_grid_args_' . $grid->id(), $grid->get_javascript_args() ); | |
| 102 | 86 | } |
| 103 | 87 | |
| 104 | 88 | return $output; |
| 105 | 89 | } |
| @@ -138,47 +122,8 @@ | ||
| 138 | 122 | } |
| 139 | 123 | } |
| 140 | 124 | |
| 141 | 125 | return $output; |
| 142 | - } | |
| 143 | - | |
| 144 | - /** | |
| 145 | - * Sanitize HTML in shortcode for output. | |
| 146 | - * | |
| 147 | - * @since 3.9.0 | |
| 148 | - */ | |
| 149 | - public static function sanitize_html( $text ) { | |
| 150 | - if ( $text ) { | |
| 151 | - $text = str_replace( '"', '"', $text ); | |
| 152 | - $text = wp_kses_post( $text ); | |
| 153 | - } | |
| 154 | - | |
| 155 | - return $text; | |
| 156 | - } | |
| 157 | - | |
| 158 | - /** | |
| 159 | - * Sanitize HTML element in shortcode for output. | |
| 160 | - * | |
| 161 | - * @since 3.9.2 | |
| 162 | - */ | |
| 163 | - public static function sanitize_html_element( $tag ) { | |
| 164 | - $allowed = array( | |
| 165 | - 'p' => 'p', | |
| 166 | - 'span' => 'span', | |
| 167 | - 'div' => 'div', | |
| 168 | - 'h1' => 'h1', | |
| 169 | - 'h2' => 'h2', | |
| 170 | - 'h3' => 'h3', | |
| 171 | - 'h4' => 'h4', | |
| 172 | - 'h5' => 'h5', | |
| 173 | - 'h6' => 'h6', | |
| 174 | - ); | |
| 175 | - | |
| 176 | - if ( ! isset( $allowed[ $tag ] ) ) { | |
| 177 | - $tag = 'span'; | |
| 178 | - } | |
| 179 | - | |
| 180 | - return $tag; | |
| 181 | 126 | } |
| 182 | 127 | } |
| 183 | 128 | |
| 184 | 129 | WPUPG_Shortcode::init(); |