| @@ -72,16 +72,14 @@ | ||
| 72 | 72 | public function getCharts() { |
| 73 | 73 | $query_args = array( |
| 74 | 74 | 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, |
| 75 | 75 | 'posts_per_page' => 9, |
| 76 | - 'paged' => filter_input( | |
| 77 | - INPUT_GET, 'page', FILTER_VALIDATE_INT, array( | |
| 78 | - 'options' => array( | |
| 79 | - 'min_range' => 1, | |
| 80 | - 'default' => 1, | |
| 81 | - ), | |
| 82 | - ) | |
| 83 | - ), | |
| 76 | + 'paged' => filter_input( INPUT_GET, 'page', FILTER_VALIDATE_INT, array( | |
| 77 | + 'options' => array( | |
| 78 | + 'min_range' => 1, | |
| 79 | + 'default' => 1, | |
| 80 | + ), | |
| 81 | + ) ), | |
| 84 | 82 | ); |
| 85 | 83 | $filter = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING ); |
| 86 | 84 | if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) { |
| 87 | 85 | $query_args['meta_query'] = array( |
| @@ -99,15 +97,13 @@ | ||
| 99 | 97 | $chart_data = $this->_getChartArray( $chart ); |
| 100 | 98 | $chart_data['id'] = $chart->ID; |
| 101 | 99 | $charts[] = $chart_data; |
| 102 | 100 | } |
| 103 | - self::_sendResponse( | |
| 104 | - array( | |
| 105 | - 'success' => true, | |
| 106 | - 'data' => $charts, | |
| 107 | - 'total' => $query->max_num_pages, | |
| 108 | - ) | |
| 109 | - ); | |
| 101 | + self::_sendResponse( array( | |
| 102 | + 'success' => true, | |
| 103 | + 'data' => $charts, | |
| 104 | + 'total' => $query->max_num_pages, | |
| 105 | + ) ); | |
| 110 | 106 | } |
| 111 | 107 | |
| 112 | 108 | /** |
| 113 | 109 | * Returns chart data required for rendering. |
| @@ -166,15 +162,13 @@ | ||
| 166 | 162 | $chart_id = $success = false; |
| 167 | 163 | $nonce = wp_verify_nonce( filter_input( $input_method, 'nonce' ) ); |
| 168 | 164 | $capable = current_user_can( 'delete_posts' ); |
| 169 | 165 | if ( $nonce && $capable ) { |
| 170 | - $chart_id = filter_input( | |
| 171 | - $input_method, 'chart', FILTER_VALIDATE_INT, array( | |
| 172 | - 'options' => array( | |
| 173 | - 'min_range' => 1, | |
| 174 | - ), | |
| 175 | - ) | |
| 176 | - ); | |
| 166 | + $chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( | |
| 167 | + 'options' => array( | |
| 168 | + 'min_range' => 1, | |
| 169 | + ), | |
| 170 | + ) ); | |
| 177 | 171 | if ( $chart_id ) { |
| 178 | 172 | $chart = get_post( $chart_id ); |
| 179 | 173 | $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER; |
| 180 | 174 | } |
| @@ -182,13 +176,11 @@ | ||
| 182 | 176 | if ( $success ) { |
| 183 | 177 | wp_delete_post( $chart_id, true ); |
| 184 | 178 | } |
| 185 | 179 | if ( $is_post ) { |
| 186 | - self::_sendResponse( | |
| 187 | - array( | |
| 188 | - 'success' => $success, | |
| 189 | - ) | |
| 190 | - ); | |
| 180 | + self::_sendResponse( array( | |
| 181 | + 'success' => $success, | |
| 182 | + ) ); | |
| 191 | 183 | } |
| 192 | 184 | wp_redirect( wp_get_referer() ); |
| 193 | 185 | exit; |
| 194 | 186 | } |
| @@ -208,53 +200,41 @@ | ||
| 208 | 200 | if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) { |
| 209 | 201 | $default_type = 'line'; |
| 210 | 202 | $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' ); |
| 211 | 203 | $source->fetch(); |
| 212 | - $chart_id = wp_insert_post( | |
| 213 | - array( | |
| 214 | - 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, | |
| 215 | - 'post_title' => 'Visualization', | |
| 216 | - 'post_author' => get_current_user_id(), | |
| 217 | - 'post_status' => 'auto-draft', | |
| 218 | - 'post_content' => $source->getData(), | |
| 219 | - ) | |
| 220 | - ); | |
| 204 | + $chart_id = wp_insert_post( array( | |
| 205 | + 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, | |
| 206 | + 'post_title' => 'Visualization', | |
| 207 | + 'post_author' => get_current_user_id(), | |
| 208 | + 'post_status' => 'auto-draft', | |
| 209 | + 'post_content' => $source->getData(), | |
| 210 | + ) ); | |
| 221 | 211 | if ( $chart_id && ! is_wp_error( $chart_id ) ) { |
| 222 | 212 | add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type ); |
| 223 | 213 | add_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 ); |
| 224 | 214 | add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); |
| 225 | 215 | add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); |
| 226 | - add_post_meta( | |
| 227 | - $chart_id, Visualizer_Plugin::CF_SETTINGS, array( | |
| 228 | - 'focusTarget' => 'datum', | |
| 229 | - ) | |
| 230 | - ); | |
| 231 | - do_action( 'visualizer_pro_new_chart_defaults', $chart_id ); | |
| 216 | + add_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, array( | |
| 217 | + 'focusTarget' => 'datum', | |
| 218 | + ) ); | |
| 232 | 219 | } |
| 233 | 220 | wp_redirect( add_query_arg( 'chart', (int) $chart_id ) ); |
| 234 | 221 | defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); |
| 235 | 222 | } |
| 236 | 223 | // enqueue and register scripts and styles |
| 237 | - wp_register_script( 'visualizer-chosen', VISUALIZER_ABSURL . 'js/lib/chosen.jquery.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION ); | |
| 238 | - wp_register_style( 'visualizer-chosen', VISUALIZER_ABSURL . 'css/lib/chosen.min.css', array(), Visualizer_Plugin::VERSION ); | |
| 239 | - | |
| 240 | - wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION ); | |
| 241 | - wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION, true ); | |
| 224 | + wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array(), Visualizer_Plugin::VERSION ); | |
| 225 | + wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true ); | |
| 242 | 226 | wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 243 | 227 | wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); |
| 244 | - wp_register_script( | |
| 245 | - 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( | |
| 246 | - 'google-jsapi-old', | |
| 247 | - 'google-jsapi-new', | |
| 248 | - 'visualizer-frame', | |
| 249 | - ), Visualizer_Plugin::VERSION, true | |
| 250 | - ); | |
| 251 | - wp_register_script( | |
| 252 | - 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array( | |
| 253 | - 'wp-color-picker', | |
| 254 | - 'visualizer-render', | |
| 255 | - ), Visualizer_Plugin::VERSION, true | |
| 256 | - ); | |
| 228 | + wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( | |
| 229 | + 'google-jsapi-old', | |
| 230 | + 'google-jsapi-new', | |
| 231 | + 'visualizer-frame', | |
| 232 | + ), Visualizer_Plugin::VERSION, true ); | |
| 233 | + wp_register_script( 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array( | |
| 234 | + 'wp-color-picker', | |
| 235 | + 'visualizer-render', | |
| 236 | + ), Visualizer_Plugin::VERSION, true ); | |
| 257 | 237 | // added by Ash/Upwork |
| 258 | 238 | if ( VISUALIZER_PRO ) { |
| 259 | 239 | global $Visualizer_Pro; |
| 260 | 240 | $Visualizer_Pro->_addScriptsAndStyles(); |
| @@ -260,21 +240,17 @@ | ||
| 260 | 240 | $Visualizer_Pro->_addScriptsAndStyles(); |
| 261 | 241 | } |
| 262 | 242 | // dispatch pages |
| 263 | 243 | $this->_chart = get_post( $chart_id ); |
| 264 | - $tab = isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'visualizer'; | |
| 265 | - switch ( $tab ) { | |
| 244 | + switch ( isset( $_GET['tab'] ) ? $_GET['tab'] : '' ) { | |
| 266 | 245 | case 'settings': |
| 267 | 246 | // changed by Ash/Upwork |
| 268 | 247 | $this->_handleDataAndSettingsPage(); |
| 269 | 248 | break; |
| 270 | - case 'type': // fall through. | |
| 271 | - case 'visualizer': // fall through. | |
| 249 | + case 'type': | |
| 250 | + default: | |
| 272 | 251 | $this->_handleTypesPage(); |
| 273 | 252 | break; |
| 274 | - default: | |
| 275 | - do_action( 'visualizer_pro_handle_tab', $tab, $this->_chart ); | |
| 276 | - break; | |
| 277 | 253 | } |
| 278 | 254 | defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); |
| 279 | 255 | } |
| 280 | 256 | |
| @@ -316,29 +292,17 @@ | ||
| 316 | 292 | wp_enqueue_style( 'wp-color-picker' ); |
| 317 | 293 | wp_enqueue_style( 'visualizer-frame' ); |
| 318 | 294 | wp_enqueue_script( 'visualizer-preview' ); |
| 319 | 295 | wp_enqueue_script( 'visualizer-render' ); |
| 320 | - wp_localize_script( | |
| 321 | - 'visualizer-render', 'visualizer', array( | |
| 322 | - 'l10n' => array( | |
| 323 | - 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 324 | - 'loading' => esc_html__( 'Loading...', 'visualizer' ), | |
| 325 | - ), | |
| 326 | - 'charts' => array( | |
| 327 | - 'canvas' => $data, | |
| 328 | - ), | |
| 329 | - 'map_api_key' => get_option( 'visualizer-map-api-key' ), | |
| 330 | - 'ajax' => array( | |
| 331 | - 'url' => admin_url( 'admin-ajax.php' ), | |
| 332 | - 'nonces' => array( | |
| 333 | - 'permissions' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_PERMISSIONS_DATA ), | |
| 334 | - ), | |
| 335 | - 'actions' => array( | |
| 336 | - 'permissions' => Visualizer_Plugin::ACTION_FETCH_PERMISSIONS_DATA, | |
| 337 | - ), | |
| 338 | - ), | |
| 339 | - ) | |
| 340 | - ); | |
| 296 | + wp_localize_script( 'visualizer-render', 'visualizer', array( | |
| 297 | + 'l10n' => array( | |
| 298 | + 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 299 | + ), | |
| 300 | + 'charts' => array( | |
| 301 | + 'canvas' => $data, | |
| 302 | + ), | |
| 303 | + 'map_api_key' => get_option( 'visualizer-map-api-key' ), | |
| 304 | + ) ); | |
| 341 | 305 | $render = new Visualizer_Render_Page_Data(); |
| 342 | 306 | $render->chart = $this->_chart; |
| 343 | 307 | $render->type = $data['type']; |
| 344 | 308 | $render->sidebar = $sidebar; |
| @@ -429,14 +393,8 @@ | ||
| 429 | 393 | } |
| 430 | 394 | if ( ! isset( $_POST['vz-import-time'] ) ) { |
| 431 | 395 | apply_filters( 'visualizer_pro_remove_schedule', $chart_id ); |
| 432 | 396 | } |
| 433 | - | |
| 434 | - if ( ! isset( $_POST['chart_data_src'] ) || Visualizer_Plugin::CF_SOURCE_FILTER !== $_POST['chart_data_src'] ) { | |
| 435 | - // delete the filters in case this chart is being uploaded from other data sources | |
| 436 | - delete_post_meta( $chart_id, 'visualizer-filter-config' ); | |
| 437 | - } | |
| 438 | - | |
| 439 | 397 | $source = null; |
| 440 | 398 | $render = new Visualizer_Render_Page_Update(); |
| 441 | 399 | if ( isset( $_POST['remote_data'] ) && filter_var( $_POST['remote_data'], FILTER_VALIDATE_URL ) ) { |
| 442 | 400 | $source = new Visualizer_Source_Csv_Remote( $_POST['remote_data'] ); |
| @@ -482,15 +440,13 @@ | ||
| 482 | 440 | $chart_id = $success = false; |
| 483 | 441 | $nonce = wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART ); |
| 484 | 442 | $capable = current_user_can( 'edit_posts' ); |
| 485 | 443 | if ( $nonce && $capable ) { |
| 486 | - $chart_id = filter_input( | |
| 487 | - INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( | |
| 488 | - 'options' => array( | |
| 489 | - 'min_range' => 1, | |
| 490 | - ), | |
| 491 | - ) | |
| 492 | - ); | |
| 444 | + $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( | |
| 445 | + 'options' => array( | |
| 446 | + 'min_range' => 1, | |
| 447 | + ), | |
| 448 | + ) ); | |
| 493 | 449 | if ( $chart_id ) { |
| 494 | 450 | $chart = get_post( $chart_id ); |
| 495 | 451 | $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER; |
| 496 | 452 | } |
| @@ -496,17 +452,15 @@ | ||
| 496 | 452 | } |
| 497 | 453 | } |
| 498 | 454 | $redirect = wp_get_referer(); |
| 499 | 455 | if ( $success ) { |
| 500 | - $new_chart_id = wp_insert_post( | |
| 501 | - array( | |
| 502 | - 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, | |
| 503 | - 'post_title' => 'Visualization', | |
| 504 | - 'post_author' => get_current_user_id(), | |
| 505 | - 'post_status' => $chart->post_status, | |
| 506 | - 'post_content' => $chart->post_content, | |
| 507 | - ) | |
| 508 | - ); | |
| 456 | + $new_chart_id = wp_insert_post( array( | |
| 457 | + 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, | |
| 458 | + 'post_title' => 'Visualization', | |
| 459 | + 'post_author' => get_current_user_id(), | |
| 460 | + 'post_status' => $chart->post_status, | |
| 461 | + 'post_content' => $chart->post_content, | |
| 462 | + ) ); | |
| 509 | 463 | if ( $new_chart_id && ! is_wp_error( $new_chart_id ) ) { |
| 510 | 464 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_CHART_TYPE, get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true ) ); |
| 511 | 465 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, get_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ) ); |
| 512 | 466 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SOURCE, get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) ); |
| @@ -511,14 +465,12 @@ | ||
| 511 | 465 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, get_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ) ); |
| 512 | 466 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SOURCE, get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) ); |
| 513 | 467 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SERIES, get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ) ); |
| 514 | 468 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SETTINGS, get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ) ); |
| 515 | - $redirect = add_query_arg( | |
| 516 | - array( | |
| 517 | - 'page' => 'visualizer', | |
| 518 | - 'type' => filter_input( INPUT_GET, 'type' ), | |
| 519 | - ), admin_url( 'upload.php' ) | |
| 520 | - ); | |
| 469 | + $redirect = add_query_arg( array( | |
| 470 | + 'page' => 'visualizer', | |
| 471 | + 'type' => filter_input( INPUT_GET, 'type' ), | |
| 472 | + ), admin_url( 'upload.php' ) ); | |
| 521 | 473 | } |
| 522 | 474 | } |
| 523 | 475 | wp_redirect( $redirect ); |
| 524 | 476 | exit; |
| @@ -532,25 +484,81 @@ | ||
| 532 | 484 | * @access public |
| 533 | 485 | */ |
| 534 | 486 | public function exportData() { |
| 535 | 487 | check_ajax_referer( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION, 'security' ); |
| 488 | + $chart_id = $success = false; | |
| 536 | 489 | $capable = current_user_can( 'edit_posts' ); |
| 537 | 490 | if ( $capable ) { |
| 538 | - $chart_id = isset( $_GET['chart'] ) ? filter_var( | |
| 539 | - $_GET['chart'], FILTER_VALIDATE_INT, array( | |
| 540 | - 'options' => array( | |
| 541 | - 'min_range' => 1, | |
| 542 | - ), | |
| 543 | - ) | |
| 544 | - ) : ''; | |
| 491 | + $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT, array( | |
| 492 | + 'options' => array( | |
| 493 | + 'min_range' => 1, | |
| 494 | + ), | |
| 495 | + ) ) : ''; | |
| 545 | 496 | if ( $chart_id ) { |
| 546 | - $data = $this->_getDataAs( $chart_id, 'csv' ); | |
| 547 | - if ( $data ) { | |
| 548 | - echo wp_send_json_success( $data ); | |
| 497 | + $chart = get_post( $chart_id ); | |
| 498 | + $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER; | |
| 499 | + } | |
| 500 | + } | |
| 501 | + if ( $success ) { | |
| 502 | + $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ); | |
| 503 | + $filename = isset( $settings['title'] ) ? $settings['title'] : ''; | |
| 504 | + if ( empty( $filename ) ) { | |
| 505 | + $filename = 'export.csv'; | |
| 506 | + } else { | |
| 507 | + $filename .= '.csv'; | |
| 508 | + } | |
| 509 | + $rows = array(); | |
| 510 | + $series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ); | |
| 511 | + $data = unserialize( $chart->post_content ); | |
| 512 | + if ( ! empty( $series ) ) { | |
| 513 | + $row = array(); | |
| 514 | + foreach ( $series as $array ) { | |
| 515 | + $row[] = $array['label']; | |
| 549 | 516 | } |
| 517 | + $rows[] = $row; | |
| 518 | + $row = array(); | |
| 519 | + foreach ( $series as $array ) { | |
| 520 | + $row[] = $array['type']; | |
| 521 | + } | |
| 522 | + $rows[] = $row; | |
| 550 | 523 | } |
| 551 | - } | |
| 552 | - | |
| 524 | + if ( ! empty( $data ) ) { | |
| 525 | + foreach ( $data as $array ) { | |
| 526 | + // ignore strings | |
| 527 | + if ( ! is_array( $array ) ) { | |
| 528 | + continue; | |
| 529 | + } | |
| 530 | + // if this is an array of arrays... | |
| 531 | + if ( is_array( $array[0] ) ) { | |
| 532 | + foreach ( $array as $arr ) { | |
| 533 | + $rows[] = $arr; | |
| 534 | + } | |
| 535 | + } else { | |
| 536 | + // just an array | |
| 537 | + $rows[] = $array; | |
| 538 | + } | |
| 539 | + } | |
| 540 | + } | |
| 541 | + $fp = tmpfile(); | |
| 542 | + // support for MS Excel | |
| 543 | + fprintf( $fp, $bom = ( chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF ) ) ); | |
| 544 | + foreach ( $rows as $row ) { | |
| 545 | + fputcsv( $fp, $row ); | |
| 546 | + } | |
| 547 | + rewind( $fp ); | |
| 548 | + $csv = ''; | |
| 549 | + while ( ( $array = fgetcsv( $fp ) ) !== false ) { | |
| 550 | + if ( strlen( $csv ) > 0 ) { | |
| 551 | + $csv .= PHP_EOL; | |
| 552 | + } | |
| 553 | + $csv .= implode( ',', $array ); | |
| 554 | + } | |
| 555 | + fclose( $fp ); | |
| 556 | + echo wp_send_json_success( array( | |
| 557 | + 'csv' => $csv, | |
| 558 | + 'name' => $filename, | |
| 559 | + ) ); | |
| 560 | + }// End if(). | |
| 553 | 561 | defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); |
| 554 | 562 | } |
| 555 | 563 | |
| 556 | 564 | /** |
| @@ -567,19 +575,16 @@ | ||
| 567 | 575 | $render->type = $data['type']; |
| 568 | 576 | unset( $data['settings']['width'], $data['settings']['height'] ); |
| 569 | 577 | wp_enqueue_style( 'visualizer-frame' ); |
| 570 | 578 | wp_enqueue_script( 'visualizer-render' ); |
| 571 | - wp_localize_script( | |
| 572 | - 'visualizer-render', 'visualizer', array( | |
| 573 | - 'l10n' => array( | |
| 574 | - 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 575 | - 'loading' => esc_html__( 'Loading...', 'visualizer' ), | |
| 576 | - ), | |
| 577 | - 'charts' => array( | |
| 578 | - 'canvas' => $data, | |
| 579 | - ), | |
| 580 | - ) | |
| 581 | - ); | |
| 579 | + wp_localize_script( 'visualizer-render', 'visualizer', array( | |
| 580 | + 'l10n' => array( | |
| 581 | + 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 582 | + ), | |
| 583 | + 'charts' => array( | |
| 584 | + 'canvas' => $data, | |
| 585 | + ), | |
| 586 | + ) ); | |
| 582 | 587 | // Added by Ash/Upwork |
| 583 | 588 | if ( VISUALIZER_PRO ) { |
| 584 | 589 | global $Visualizer_Pro; |
| 585 | 590 | $Visualizer_Pro->_enqueueScriptsAndStyles( $data ); |