PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.8
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.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 3.10.4 All 148 releases
← All changes | classes/Visualizer/Source/Json.php +3 -42 3.10.03.4.8 View file →
@@ -69,18 +69,8 @@
69 69 */
70 70 protected $_headers;
71 71
72 72 /**
73 - * The other headers.
74 - *
75 - * @since 3.4.11
76 - *
77 - * @access protected
78 - * @var array
79 - */
80 - protected $_additional_headers;
81 -
82 - /**
83 73 * The array that contains the definition of the data.
84 74 *
85 75 * @since 1.0.0
86 76 *
@@ -118,11 +108,8 @@
118 108 }
119 109 if ( isset( $this->_args['method'] ) ) {
120 110 $this->_headers['method'] = $this->_args['method'];
121 111 }
122 - if ( isset( $this->_args['additional_headers'] ) ) {
123 - $this->_additional_headers = $this->_args['additional_headers'];
124 - }
125 112 do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Constructor called for params = %s', print_r( $params, true ) ), 'debug', __FILE__, __LINE__ );
126 113 }
127 114
128 115 /**
@@ -403,12 +390,9 @@
403 390 }
404 391
405 392 // this filter can be used to rearrange columns e.g. in candlestick charts
406 393 // or to add additional data to the root.
407 - $bom = pack( 'H*', 'EFBBBF' );
408 - $response_body = wp_remote_retrieve_body( $response );
409 - $response_body = preg_replace( "/^$bom/", '', $response_body );
410 - $array = apply_filters( 'visualizer_json_massage_data', json_decode( $response_body, true ), $url );
394 + $array = apply_filters( 'visualizer_json_massage_data', json_decode( wp_remote_retrieve_body( $response ), true ), $url );
411 395
412 396 do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'JSON array for the endpoint is %s = ', print_r( $array, true ) ), 'debug', __FILE__, __LINE__ );
413 397
414 398 return $array;
@@ -425,13 +409,9 @@
425 409 $args = array( 'method' => 'GET' );
426 410 if ( ! empty( $this->_headers ) ) {
427 411 $args = array( 'method' => strtoupper( $this->_headers['method'] ) );
428 412 if ( array_key_exists( 'auth', $this->_headers ) ) {
429 - if ( ! empty( $this->_headers['auth'] ) ) {
430 - $header_auth = explode( ':', $this->_headers['auth'] );
431 - $header_key = explode( ' ', reset( $header_auth ) );
432 - $args['headers'] = array( 'Authorization' => reset( $header_key ) . ' ' . base64_encode( end( $header_key ) . ':' . end( $header_auth ) ) );
433 - }
413 + $args['headers'] = array( 'Authorization' => $this->_headers['auth'] );
434 414 } elseif ( array_key_exists( 'username', $this->_headers ) && array_key_exists( 'password', $this->_headers ) && ! empty( $this->_headers['username'] ) && ! empty( $this->_headers['password'] ) ) {
435 415 $args['headers'] = array( 'Authorization' => 'Basic ' . base64_encode( $this->_headers['username'] . ':' . $this->_headers['password'] ) );
436 416 }
437 417 }
@@ -436,29 +416,10 @@
436 416 }
437 417 }
438 418
439 419 $args = apply_filters( 'visualizer_json_args', $args, $url );
440 - if ( ! empty( $this->_additional_headers ) ) {
441 - $this->_additional_headers = explode( ',', $this->_additional_headers );
442 - $this->_additional_headers = array_filter( $this->_additional_headers );
443 - if ( ! empty( $this->_additional_headers ) ) {
444 - $this->_additional_headers = array_map(
445 - function( $headers ) {
446 - $headers = explode( ':', $headers );
447 - $headers = array_map( 'trim', $headers );
448 - return $headers;
449 - },
450 - $this->_additional_headers
451 - );
452 - foreach ( $this->_additional_headers as $additional_headers ) {
453 - $header_key = reset( $additional_headers );
454 - $header_value = end( $additional_headers );
455 - $args['headers'][ $header_key ] = $header_value;
456 - }
457 - }
458 - }
420 + do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Connecting to %s with args = %s ', $url, print_r( $args, true ) ), 'debug', __FILE__, __LINE__ );
459 421
460 - do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Connecting to %s with args = %s ', $url, print_r( $args, true ) ), 'debug', __FILE__, __LINE__ );
461 422 return wp_remote_request( $url, $args );
462 423 }
463 424
464 425 /**