| @@ -257,8 +257,11 @@ | ||
| 257 | 257 | /** |
| 258 | 258 | * Handle data and settings page |
| 259 | 259 | */ |
| 260 | 260 | private function _handleDataAndSettingsPage() { |
| 261 | + if ( isset( $_POST['map_api_key'] ) ) { | |
| 262 | + update_option( 'visualizer-map-api-key', $_POST['map_api_key'] ); | |
| 263 | + } | |
| 261 | 264 | if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'] ) ) { |
| 262 | 265 | if ( $this->_chart->post_status == 'auto-draft' ) { |
| 263 | 266 | $this->_chart->post_status = 'publish'; |
| 264 | 267 | wp_update_post( $this->_chart->to_array() ); |
| @@ -296,8 +299,9 @@ | ||
| 296 | 299 | ), |
| 297 | 300 | 'charts' => array( |
| 298 | 301 | 'canvas' => $data, |
| 299 | 302 | ), |
| 303 | + 'map_api_key' => get_option( 'visualizer-map-api-key' ), | |
| 300 | 304 | ) ); |
| 301 | 305 | $render = new Visualizer_Render_Page_Data(); |
| 302 | 306 | $render->chart = $this->_chart; |
| 303 | 307 | $render->type = $data['type']; |
| @@ -374,8 +378,9 @@ | ||
| 374 | 378 | * |
| 375 | 379 | * @access public |
| 376 | 380 | */ |
| 377 | 381 | public function uploadData() { |
| 382 | + error_log( 'in uploadData ' . print_r( $_GET,true ) . print_r( $_POST,true ) ); | |
| 378 | 383 | // validate nonce |
| 379 | 384 | // do not use filter_input as it does not work for phpunit test cases, use filter_var instead |
| 380 | 385 | if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'] ) ) { |
| 381 | 386 | status_header( 403 ); |
| @@ -419,9 +424,11 @@ | ||
| 419 | 424 | $render->message = esc_html__( 'CSV file is broken or invalid. Please, try again.', 'visualizer' ); |
| 420 | 425 | } |
| 421 | 426 | } |
| 422 | 427 | $render->render(); |
| 423 | - defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); | |
| 428 | + if ( ! ( defined( 'VISUALIZER_DO_NOT_DIE' ) && VISUALIZER_DO_NOT_DIE ) ) { | |
| 429 | + defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); | |
| 430 | + } | |
| 424 | 431 | } |
| 425 | 432 | |
| 426 | 433 | /** |
| 427 | 434 | * Clones the chart. |