← All changes
|
WPDataAccess/Dashboard/WPDA_Widget_Google_Chart.php
+16
-16
5.5.3
→
5.5.85
View file →
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -// phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 3 | +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- verified on page | |
| 4 | 4 | namespace WPDataAccess\Dashboard; |
| 5 | 5 | |
| 6 | 6 | use WPDataAccess\Connection\WPDADB; |
| 7 | 7 | use WPDataAccess\WPDA; |
| @@ -82,8 +82,10 @@ | ||
| 82 | 82 | * @var mixed|null |
| 83 | 83 | */ |
| 84 | 84 | protected $options = null; |
| 85 | 85 | |
| 86 | + private $sonse = null; | |
| 87 | + | |
| 86 | 88 | /** |
| 87 | 89 | * Constructor |
| 88 | 90 | * |
| 89 | 91 | * @param array $args Constructor arguments. |
| @@ -122,12 +124,12 @@ | ||
| 122 | 124 | * |
| 123 | 125 | * @return void |
| 124 | 126 | */ |
| 125 | 127 | public function edit_chart() { |
| 128 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 126 | 129 | echo $this->html(); |
| 127 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 128 | 130 | echo $this->js( 300 ); |
| 129 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 131 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 130 | 132 | } |
| 131 | 133 | |
| 132 | 134 | /** |
| 133 | 135 | * Chart javascript code |
| @@ -311,19 +313,13 @@ | ||
| 311 | 313 | * @return void |
| 312 | 314 | */ |
| 313 | 315 | public static function widget() { |
| 314 | 316 | $panel_name = ( isset( $_REQUEST['wpda_panel_name'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_panel_name'] ) ) : '' ); |
| 315 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 316 | 317 | $panel_dbs = ( isset( $_REQUEST['wpda_panel_dbs'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_panel_dbs'] ) ) : '' ); |
| 317 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 318 | 318 | $panel_query = ( isset( $_REQUEST['wpda_panel_query'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_panel_query'] ) ) : '' ); |
| 319 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 320 | 319 | $panel_column = ( isset( $_REQUEST['wpda_panel_column'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_panel_column'] ) ) : '1' ); |
| 321 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 322 | 320 | $column_position = ( isset( $_REQUEST['wpda_column_position'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_column_position'] ) ) : 'prepend' ); |
| 323 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 324 | 321 | $widget_sequence_nr = ( isset( $_REQUEST['wpda_widget_sequence_nr'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_widget_sequence_nr'] ) ) : '1' ); |
| 325 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 326 | 322 | $wdg = new WPDA_Widget_Google_Chart(array( |
| 327 | 323 | 'outputtype' => array('Table'), |
| 328 | 324 | 'name' => $panel_name, |
| 329 | 325 | 'dbs' => $panel_dbs, |
| @@ -332,10 +328,11 @@ | ||
| 332 | 328 | 'position' => $column_position, |
| 333 | 329 | 'widget_id' => $widget_sequence_nr, |
| 334 | 330 | )); |
| 335 | 331 | WPDA::sent_header( 'text/html; charset=UTF-8' ); |
| 332 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 336 | 333 | echo $wdg->container(); |
| 337 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 334 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 338 | 335 | wp_die(); |
| 339 | 336 | } |
| 340 | 337 | |
| 341 | 338 | /** |
| @@ -351,11 +348,11 @@ | ||
| 351 | 348 | if ( !$is_header_send ) { |
| 352 | 349 | WPDA::sent_header( 'application/json' ); |
| 353 | 350 | } |
| 354 | 351 | if ( !isset( $_REQUEST['wpda_action'] ) ) { |
| 355 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 352 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 356 | 353 | echo static::msg( 'ERROR', 'Invalid arguments' ); |
| 357 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 354 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 358 | 355 | wp_die(); |
| 359 | 356 | } |
| 360 | 357 | if ( null === $dbs || null === $query ) { |
| 361 | 358 | $widgets = get_user_meta( WPDA::get_current_user_id(), WPDA_Dashboard::USER_DASHBOARD ); |
| @@ -367,15 +364,15 @@ | ||
| 367 | 364 | $widget_found = true; |
| 368 | 365 | } |
| 369 | 366 | } |
| 370 | 367 | if ( !$widget_found ) { |
| 368 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 371 | 369 | echo static::msg( 'ERROR', 'Invalid arguments' ); |
| 372 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 370 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 373 | 371 | wp_die(); |
| 374 | 372 | } |
| 375 | 373 | } |
| 376 | 374 | switch ( $_REQUEST['wpda_action'] ) { |
| 377 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 378 | 375 | case 'get_data': |
| 379 | 376 | echo wp_json_encode( static::get_data( $dbs, $query ) ); |
| 380 | 377 | wp_die(); |
| 381 | 378 | break; |
| @@ -383,10 +380,11 @@ | ||
| 383 | 380 | // TODO ??? |
| 384 | 381 | wp_die(); |
| 385 | 382 | break; |
| 386 | 383 | default: |
| 384 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 387 | 385 | echo static::msg( 'ERROR', 'Invalid arguments' ); |
| 388 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 386 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 389 | 387 | wp_die(); |
| 390 | 388 | } |
| 391 | 389 | } |
| 392 | 390 | |
| @@ -397,9 +395,9 @@ | ||
| 397 | 395 | * @return string |
| 398 | 396 | */ |
| 399 | 397 | public static function google_charts_type( $data_type ) { |
| 400 | 398 | $type = explode( '(', (string) $data_type ); |
| 401 | - //phpcs:ignore - 8.1 proof | |
| 399 | + // phpcs:ignore -- 8.1 proof | |
| 402 | 400 | switch ( $type[0] ) { |
| 403 | 401 | case 'tinyint': |
| 404 | 402 | case 'smallint': |
| 405 | 403 | case 'mediumint': |
| @@ -425,4 +423,6 @@ | ||
| 425 | 423 | } |
| 426 | 424 | } |
| 427 | 425 | |
| 428 | 426 | } |
| 427 | + | |
| 428 | +// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |