| @@ -156,12 +156,9 @@ | ||
| 156 | 156 | * |
| 157 | 157 | * @access public |
| 158 | 158 | */ |
| 159 | 159 | public function enqueueScripts() { |
| 160 | - wp_register_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); | |
| 161 | - wp_register_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true ); | |
| 162 | 160 | wp_register_script( 'visualizer-customization', $this->get_user_customization_js(), array(), null, true ); |
| 163 | - wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'visualizer-google-jsapi-old', 'jquery', 'visualizer-customization' ), Visualizer_Plugin::VERSION, true ); | |
| 164 | 161 | wp_register_script( 'visualizer-clipboardjs', VISUALIZER_ABSURL . 'js/lib/clipboardjs/clipboard.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true ); |
| 165 | 162 | wp_register_style( 'visualizer-front', VISUALIZER_ABSURL . 'css/front.css', array(), Visualizer_Plugin::VERSION ); |
| 166 | 163 | do_action( 'visualizer_pro_frontend_load_resources' ); |
| 167 | 164 | } |
| @@ -213,9 +210,11 @@ | ||
| 213 | 210 | $class = ! empty( $class ) ? ' class="' . trim( $class ) . '"' : ''; |
| 214 | 211 | |
| 215 | 212 | $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); |
| 216 | 213 | |
| 217 | - // faetch and update settings | |
| 214 | + $chart = apply_filters( 'visualizer_schedule_refresh_chart', $chart, $chart->ID, false ); | |
| 215 | + | |
| 216 | + // fetch and update settings | |
| 218 | 217 | $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); |
| 219 | 218 | if ( empty( $settings['height'] ) ) { |
| 220 | 219 | $settings['height'] = '400'; |
| 221 | 220 | } |
| @@ -236,17 +235,17 @@ | ||
| 236 | 235 | if ( ! empty( $atts['data'] ) ) { |
| 237 | 236 | $data = apply_filters( $atts['data'], $data, $chart->ID, $type ); |
| 238 | 237 | } |
| 239 | 238 | |
| 240 | - $id = $id . '-' . rand(); | |
| 241 | - $arguments = array( '', $id, $settings ); | |
| 242 | 239 | $css = ''; |
| 243 | - apply_filters_ref_array( 'visualizer_pro_inline_css', array( &$arguments ) ); | |
| 240 | + $arguments = $this->get_inline_custom_css( $id, $settings ); | |
| 244 | 241 | if ( ! empty( $arguments ) ) { |
| 245 | 242 | $css = $arguments[0]; |
| 246 | - $settings = $arguments[2]; | |
| 243 | + $settings = $arguments[1]; | |
| 247 | 244 | } |
| 248 | 245 | |
| 246 | + $library = $this->load_chart_type( $chart->ID ); | |
| 247 | + | |
| 249 | 248 | // add chart to the array |
| 250 | 249 | $this->_charts[ $id ] = array( |
| 251 | 250 | 'type' => $type, |
| 252 | 251 | 'series' => $series, |
| @@ -251,23 +250,32 @@ | ||
| 251 | 250 | 'type' => $type, |
| 252 | 251 | 'series' => $series, |
| 253 | 252 | 'settings' => $settings, |
| 254 | 253 | 'data' => $data, |
| 254 | + 'library' => $library, | |
| 255 | 255 | ); |
| 256 | 256 | |
| 257 | - // enqueue visualizer render and update render localizations | |
| 258 | - wp_enqueue_script( 'visualizer-render' ); | |
| 257 | + wp_register_script( | |
| 258 | + "visualizer-render-$library", | |
| 259 | + VISUALIZER_ABSURL . 'js/render-facade.js', | |
| 260 | + apply_filters( 'visualizer_assets_render', array( 'jquery', 'visualizer-customization' ), true ), | |
| 261 | + Visualizer_Plugin::VERSION, | |
| 262 | + true | |
| 263 | + ); | |
| 264 | + | |
| 265 | + wp_enqueue_script( "visualizer-render-$library" ); | |
| 259 | 266 | wp_localize_script( |
| 260 | - 'visualizer-render', | |
| 267 | + "visualizer-render-$library", | |
| 261 | 268 | 'visualizer', |
| 262 | 269 | array( |
| 263 | 270 | 'charts' => $this->_charts, |
| 264 | - 'language' => $this->get_language(), | |
| 271 | + 'language' => $this->get_language(), | |
| 265 | 272 | 'map_api_key' => get_option( 'visualizer-map-api-key' ), |
| 266 | 273 | 'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '', |
| 267 | 274 | 'i10n' => array( |
| 268 | 275 | 'copied' => __( 'Copied!', 'visualizer' ), |
| 269 | 276 | ), |
| 277 | + 'page_type' => 'frontend', | |
| 270 | 278 | ) |
| 271 | 279 | ); |
| 272 | 280 | wp_enqueue_style( 'visualizer-front' ); |
| 273 | 281 | |