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