PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.2.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | classes/Visualizer/Module/Frontend.php +11 -26 3.0.52.2.0 View file →
@@ -76,9 +76,9 @@
76 76 register_rest_route(
77 77 'visualizer/v' . VISUALIZER_REST_VERSION,
78 78 '/action/(?P<chart>\d+)/(?P<type>.+)/',
79 79 array(
80 - 'methods' => array( 'GET', 'POST' ),
80 + 'methods' => 'GET',
81 81 'callback' => array( $this, 'perform_action' ),
82 82 )
83 83 );
84 84 }
@@ -129,9 +129,9 @@
129 129 case 'xls':
130 130 $data = $this->_getDataAs( $chart_id, 'xls' );
131 131 break;
132 132 default:
133 - $data = apply_filters( 'visualizer_action_data', $data, $chart_id, $type, $params, $this );
133 + $data = apply_filters( 'visualizer_action_data', $data, $chart_id, $type );
134 134 break;
135 135 }
136 136
137 137 return new WP_REST_Response( array( 'data' => $data ) );
@@ -150,10 +150,8 @@
150 150 wp_register_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true );
151 151 wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'visualizer-google-jsapi-old', 'jquery' ), Visualizer_Plugin::VERSION, true );
152 152 wp_register_script( 'visualizer-clipboardjs', VISUALIZER_ABSURL . 'js/lib/clipboardjs/clipboard.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true );
153 153 wp_enqueue_script( 'visualizer-clipboardjs' );
154 - wp_register_style( 'visualizer-front', VISUALIZER_ABSURL . 'css/front.css', array(), Visualizer_Plugin::VERSION );
155 - do_action( 'visualizer_pro_frontend_load_resources' );
156 154 }
157 155
158 156 /**
159 157 * Returns placeholder for chart according to visualizer shortcode attributes.
@@ -168,16 +166,15 @@
168 166 * @access public
169 167 * @param array $atts The array of shortcode attributes.
170 168 */
171 169 public function renderChart( $atts ) {
172 - global $wp_version;
173 170 $atts = shortcode_atts(
174 171 array(
175 172 'id' => false, // chart id
176 - 'class' => false, // chart class
177 - 'series' => false, // series filter hook
178 - 'data' => false, // data filter hook
179 - 'settings' => false, // data filter hook
173 + 'class' => false, // chart class
174 + 'series' => false, // series filter hook
175 + 'data' => false, // data filter hook
176 + 'settings' => false, // data filter hook
180 177 ), $atts
181 178 );
182 179
183 180 // if empty id or chart does not exists, then return empty string
@@ -184,12 +181,8 @@
184 181 if ( ! $atts['id'] || ! ( $chart = get_post( $atts['id'] ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
185 182 return '';
186 183 }
187 184
188 - if ( ! apply_filters( 'visualizer_pro_show_chart', true, $atts['id'] ) ) {
189 - return '';
190 - }
191 -
192 185 $id = 'visualizer-' . $atts['id'];
193 186 $defaultClass = 'visualizer-front';
194 187 $class = apply_filters( Visualizer_Plugin::FILTER_CHART_WRAPPER_CLASS, $atts['class'], $atts['id'] );
195 188 $class = $defaultClass . ' ' . $class . ' ' . 'visualizer-front-' . $atts['id'];
@@ -219,13 +212,9 @@
219 212 if ( ! empty( $atts['data'] ) ) {
220 213 $data = apply_filters( $atts['data'], $data, $chart->ID, $type );
221 214 }
222 215
223 - $id = $id . '-' . rand();
224 - $arguments = array( '', $id, $settings );
225 - apply_filters_ref_array( 'visualizer_pro_inline_css', array( &$arguments ) );
226 - $css = $arguments[0];
227 - $settings = $arguments[2];
216 + $id = $id . '-' . rand();
228 217
229 218 // add chart to the array
230 219 $this->_charts[ $id ] = array(
231 220 'type' => $type,
@@ -239,22 +228,20 @@
239 228 wp_localize_script(
240 229 'visualizer-render', 'visualizer', array(
241 230 'charts' => $this->_charts,
242 231 'map_api_key' => get_option( 'visualizer-map-api-key' ),
243 - 'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '',
232 + 'rest_url' => rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ),
244 233 'i10n' => array(
245 234 'copied' => __( 'Copied!', 'visualizer' ),
246 235 ),
247 236 )
248 237 );
249 - wp_enqueue_style( 'visualizer-front' );
250 238
251 239 $actions_div = '';
252 - $actions_visible = apply_filters( 'visualizer_pro_add_actions', isset( $settings['actions'] ) ? $settings['actions'] : array(), $atts['id'] );
253 - if ( ! empty( $actions_visible ) ) {
240 + if ( ! empty( $settings['actions'] ) ) {
254 241 $actions = $this->get_actions();
255 242 $actions_div = '<div class="visualizer-actions">';
256 - foreach ( $actions_visible as $action_type ) {
243 + foreach ( $settings['actions'] as $action_type ) {
257 244 $key = $action_type;
258 245 $mime = '';
259 246 if ( strpos( $action_type, ';' ) !== false ) {
260 247 $array = explode( ';', $action_type );
@@ -274,11 +261,9 @@
274 261 }
275 262
276 263 $actions_div .= '</div>';
277 264 }
278 -
279 - $actions_div .= $css;
280 -
281 265 // return placeholder div
282 266 return $actions_div . '<div id="' . $id . '"' . $class . '></div>';
283 267 }
268 +
284 269 }