| @@ -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\WPDA; |
| 7 | 7 | /** |
| @@ -234,17 +234,12 @@ | ||
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | 236 | public static function widget() { |
| 237 | 237 | $panel_name = ( isset( $_REQUEST['wpda_panel_name'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_panel_name'] ) ) : '' ); |
| 238 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 239 | 238 | $panel_dbms = ( isset( $_REQUEST['wpda_panel_dbms'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_panel_dbms'] ) ) : '' ); |
| 240 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 241 | 239 | $panel_column = ( isset( $_REQUEST['wpda_panel_column'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_panel_column'] ) ) : '1' ); |
| 242 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 243 | 240 | $column_position = ( isset( $_REQUEST['wpda_column_position'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_column_position'] ) ) : 'prepend' ); |
| 244 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 245 | 241 | $widget_sequence_nr = ( isset( $_REQUEST['wpda_widget_sequence_nr'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_widget_sequence_nr'] ) ) : '1' ); |
| 246 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 247 | 242 | $wdg = new WPDA_Widget_Dbms(array( |
| 248 | 243 | 'name' => $panel_name, |
| 249 | 244 | 'schema_name' => $panel_dbms, |
| 250 | 245 | 'column' => $panel_column, |
| @@ -251,10 +246,11 @@ | ||
| 251 | 246 | 'position' => $column_position, |
| 252 | 247 | 'widget_id' => $widget_sequence_nr, |
| 253 | 248 | )); |
| 254 | 249 | WPDA::sent_header( 'text/html; charset=UTF-8' ); |
| 250 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 255 | 251 | echo $wdg->container(); |
| 256 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 252 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 257 | 253 | wp_die(); |
| 258 | 254 | } |
| 259 | 255 | |
| 260 | 256 | /** |
| @@ -269,11 +265,11 @@ | ||
| 269 | 265 | if ( !$is_header_send ) { |
| 270 | 266 | WPDA::sent_header( 'application/json' ); |
| 271 | 267 | } |
| 272 | 268 | if ( !isset( $_REQUEST['wpda_action'] ) ) { |
| 273 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 269 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 274 | 270 | echo static::msg( 'ERROR', 'Invalid arguments' ); |
| 275 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 271 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 276 | 272 | wp_die(); |
| 277 | 273 | } |
| 278 | 274 | if ( null === $schema_name ) { |
| 279 | 275 | $widgets = get_user_meta( WPDA::get_current_user_id(), WPDA_Dashboard::USER_DASHBOARD ); |
| @@ -284,15 +280,15 @@ | ||
| 284 | 280 | $widget_found = true; |
| 285 | 281 | } |
| 286 | 282 | } |
| 287 | 283 | if ( !$widget_found ) { |
| 284 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 288 | 285 | echo static::msg( 'ERROR', 'Invalid arguments' ); |
| 289 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 286 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 290 | 287 | wp_die(); |
| 291 | 288 | } |
| 292 | 289 | } |
| 293 | 290 | switch ( $_REQUEST['wpda_action'] ) { |
| 294 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 295 | 291 | case 'vars': |
| 296 | 292 | static::get_vars( $schema_name ); |
| 297 | 293 | break; |
| 298 | 294 | case 'status': |
| @@ -301,10 +297,11 @@ | ||
| 301 | 297 | case 'info': |
| 302 | 298 | static::get_info( $schema_name ); |
| 303 | 299 | break; |
| 304 | 300 | default: |
| 301 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 305 | 302 | echo static::msg( 'ERROR', 'Invalid arguments' ); |
| 306 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 303 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 307 | 304 | wp_die(); |
| 308 | 305 | } |
| 309 | 306 | } |
| 310 | 307 | |
| @@ -348,9 +345,9 @@ | ||
| 348 | 345 | foreach ( $vars as $var ) { |
| 349 | 346 | $json[$var[0]] = $var[1]; |
| 350 | 347 | } |
| 351 | 348 | echo json_encode( $json ); |
| 352 | - // phpcs:ignore - 8.1 proof | |
| 349 | + // phpcs:ignore | |
| 353 | 350 | wp_die(); |
| 354 | 351 | } |
| 355 | 352 | |
| 356 | 353 | /** |
| @@ -365,9 +362,9 @@ | ||
| 365 | 362 | foreach ( $vars as $var ) { |
| 366 | 363 | $json[$var[0]] = $var[1]; |
| 367 | 364 | } |
| 368 | 365 | echo json_encode( $json ); |
| 369 | - // phpcs:ignore - 8.1 proof | |
| 366 | + // phpcs:ignore | |
| 370 | 367 | wp_die(); |
| 371 | 368 | } |
| 372 | 369 | |
| 373 | 370 | /**\ |
| @@ -376,12 +373,14 @@ | ||
| 376 | 373 | * @param string $schema_name Database schema name. |
| 377 | 374 | * @return void |
| 378 | 375 | */ |
| 379 | 376 | protected static function get_info( $schema_name ) { |
| 377 | + // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 380 | 378 | $schema_name = sanitize_text_field( wp_unslash( $_REQUEST['wpda_schemaname'] ) ); |
| 381 | - // phpcs:ignore - 8.1 proof | |
| 382 | 379 | echo json_encode( static::get_data( $schema_name ) ); |
| 383 | - // phpcs:ignore - 8.1 proof | |
| 380 | + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 384 | 381 | wp_die(); |
| 385 | 382 | } |
| 386 | 383 | |
| 387 | 384 | } |
| 385 | + | |
| 386 | +// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |