← All changes
|
WPDataAccess/Settings/WPDA_Settings_Legacy_DataTables.php
+31
-27
5.5.73
→
5.5.85
View file →
| @@ -114,15 +114,16 @@ | ||
| 114 | 114 | // Security check. |
| 115 | 115 | $wp_nonce = ( isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '' ); |
| 116 | 116 | // input var okay. |
| 117 | 117 | if ( !wp_verify_nonce( $wp_nonce, 'wpda-datatables-settings-' . WPDA::get_current_user_login() ) ) { |
| 118 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 118 | + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 119 | 119 | } |
| 120 | 120 | if ( 'save' === $action ) { |
| 121 | 121 | // Save options. |
| 122 | 122 | if ( isset( $_REQUEST['publication_roles'] ) ) { |
| 123 | + // phpcs:disable WordPress.Security.ValidatedSanitizedInput | |
| 123 | 124 | $publication_roles_request = ( isset( $_REQUEST['publication_roles'] ) ? $_REQUEST['publication_roles'] : null ); |
| 124 | - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput | |
| 125 | + // phpcs:enable WordPress.Security.ValidatedSanitizedInput | |
| 125 | 126 | if ( is_array( $publication_roles_request ) ) { |
| 126 | 127 | $publication_roles = sanitize_text_field( wp_unslash( implode( ',', $publication_roles_request ) ) ); |
| 127 | 128 | } else { |
| 128 | 129 | $publication_roles = ''; |
| @@ -189,9 +190,9 @@ | ||
| 189 | 190 | unset($roles['administrator']); |
| 190 | 191 | $lov_roles = array(); |
| 191 | 192 | foreach ( $wp_roles->roles as $role => $val ) { |
| 192 | 193 | array_push( $lov_roles, $role ); |
| 193 | - //phpcs:ignore - 8.1 proof | |
| 194 | + // phpcs:ignore -- 8.1 proof | |
| 194 | 195 | } |
| 195 | 196 | $publication_roles = WPDA::get_option( WPDA::OPTION_DP_PUBLICATION_ROLES ); |
| 196 | 197 | $publication_style = WPDA::get_option( WPDA::OPTION_DP_STYLE ); |
| 197 | 198 | $json_editing = WPDA::get_option( WPDA::OPTION_DP_JSON_EDITING ); |
| @@ -228,9 +229,9 @@ | ||
| 228 | 229 | ?>&tab=legacy&vtab=datatables"> |
| 229 | 230 | <table class="wpda-table-settings"> |
| 230 | 231 | <tr style="border-top: 1px solid #ccc"> |
| 231 | 232 | <th><?php |
| 232 | - echo __( 'JSON Editing', 'wp-data-access' ); | |
| 233 | + esc_html_e( 'JSON Editing', 'wp-data-access' ); | |
| 233 | 234 | ?></th> |
| 234 | 235 | <td> |
| 235 | 236 | <label> |
| 236 | 237 | <input type="radio" name="json_editing" value="validate" |
| @@ -237,9 +238,9 @@ | ||
| 237 | 238 | <?php |
| 238 | 239 | echo ( 'validate' === $json_editing ? 'checked' : '' ); |
| 239 | 240 | ?> |
| 240 | 241 | ><?php |
| 241 | - echo __( 'Use code editor with JSON validation', 'wp-data-access' ); | |
| 242 | + esc_html_e( 'Use code editor with JSON validation', 'wp-data-access' ); | |
| 242 | 243 | ?> |
| 243 | 244 | </label> |
| 244 | 245 | <br/> |
| 245 | 246 | <label> |
| @@ -247,9 +248,9 @@ | ||
| 247 | 248 | <?php |
| 248 | 249 | echo ( 'text' === $json_editing ? 'checked' : '' ); |
| 249 | 250 | ?> |
| 250 | 251 | ><?php |
| 251 | - echo __( 'Use textarea without JSON validation', 'wp-data-access' ); | |
| 252 | + esc_html_e( 'Use textarea without JSON validation', 'wp-data-access' ); | |
| 252 | 253 | ?> |
| 253 | 254 | </label> |
| 254 | 255 | </td> |
| 255 | 256 | </tr> |
| @@ -258,9 +259,9 @@ | ||
| 258 | 259 | <tr> |
| 259 | 260 | <th>Data Tables Tool Access</th> |
| 260 | 261 | <td><div style="padding-bottom:10px"> |
| 261 | 262 | <?php |
| 262 | - echo __( 'Select WordPress roles allowed to access Data Tables', 'wp-data-access' ); | |
| 263 | + esc_html_e( 'Select WordPress roles allowed to access Data Tables', 'wp-data-access' ); | |
| 263 | 264 | ?> |
| 264 | 265 | </div> |
| 265 | 266 | <select name="publication_roles[]" multiple size="6"> |
| 266 | 267 | <?php |
| @@ -289,14 +290,14 @@ | ||
| 289 | 290 | <th><span class="dashicons dashicons-info" style="float:right;font-size:300%;"></span></th> |
| 290 | 291 | <td> |
| 291 | 292 | <span class="dashicons dashicons-yes"></span> |
| 292 | 293 | <?php |
| 293 | - echo __( 'Users have readonly access to tables to which you have granted access in Front-end Settings only', 'wp-data-access' ); | |
| 294 | + esc_html_e( 'Users have readonly access to tables to which you have granted access in Front-end Settings only', 'wp-data-access' ); | |
| 294 | 295 | ?> |
| 295 | 296 | <br/> |
| 296 | 297 | <span class="dashicons dashicons-yes"></span> |
| 297 | 298 | <?php |
| 298 | - echo __( 'Table access is automatically granted to tables used in Data Tables', 'wp-data-access' ); | |
| 299 | + esc_html_e( 'Table access is automatically granted to tables used in Data Tables', 'wp-data-access' ); | |
| 299 | 300 | ?> |
| 300 | 301 | </td> |
| 301 | 302 | </tr> |
| 302 | 303 | <tr> |
| @@ -303,9 +304,10 @@ | ||
| 303 | 304 | <th>jQuery DataTables</th> |
| 304 | 305 | <td> |
| 305 | 306 | <label> |
| 306 | 307 | <?php |
| 307 | - echo sprintf( __( 'Load jQuery DataTables (version %s) scripts and styles', 'wp-data-access' ), esc_attr( $datatables_version ) ); | |
| 308 | + /* translators: %s = data tables version number */ | |
| 309 | + echo sprintf( esc_attr__( 'Load jQuery DataTables (version %s) scripts and styles', 'wp-data-access' ), esc_attr( $datatables_version ) ); | |
| 308 | 310 | ?> |
| 309 | 311 | </label> |
| 310 | 312 | <div style="height:10px"></div> |
| 311 | 313 | <labeL> |
| @@ -313,9 +315,9 @@ | ||
| 313 | 315 | <?php |
| 314 | 316 | echo ( 'both' === $load_datatables ? 'checked' : '' ); |
| 315 | 317 | ?> |
| 316 | 318 | ><?php |
| 317 | - echo __( 'In WordPress Back-end and Front-end', 'wp-data-access' ); | |
| 319 | + esc_html_e( 'In WordPress Back-end and Front-end', 'wp-data-access' ); | |
| 318 | 320 | ?> |
| 319 | 321 | </labeL> |
| 320 | 322 | <br/> |
| 321 | 323 | <labeL> |
| @@ -323,9 +325,9 @@ | ||
| 323 | 325 | <?php |
| 324 | 326 | echo ( 'be' === $load_datatables ? 'checked' : '' ); |
| 325 | 327 | ?> |
| 326 | 328 | ><?php |
| 327 | - echo __( 'In WordPress Back-end only ', 'wp-data-access' ); | |
| 329 | + esc_html_e( 'In WordPress Back-end only ', 'wp-data-access' ); | |
| 328 | 330 | ?> |
| 329 | 331 | </labeL> |
| 330 | 332 | <br/> |
| 331 | 333 | <labeL> |
| @@ -333,9 +335,9 @@ | ||
| 333 | 335 | <?php |
| 334 | 336 | echo ( 'fe' === $load_datatables ? 'checked' : '' ); |
| 335 | 337 | ?> |
| 336 | 338 | ><?php |
| 337 | - echo __( 'In WordPress Front-end only', 'wp-data-access' ); | |
| 339 | + esc_html_e( 'In WordPress Front-end only', 'wp-data-access' ); | |
| 338 | 340 | ?> |
| 339 | 341 | </labeL> |
| 340 | 342 | <br/> |
| 341 | 343 | <labeL> |
| @@ -343,9 +345,9 @@ | ||
| 343 | 345 | <?php |
| 344 | 346 | echo ( '' === $load_datatables ? 'checked' : '' ); |
| 345 | 347 | ?> |
| 346 | 348 | ><?php |
| 347 | - echo __( 'Do not load jQuery DataTables', 'wp-data-access' ); | |
| 349 | + esc_html_e( 'Do not load jQuery DataTables', 'wp-data-access' ); | |
| 348 | 350 | ?> |
| 349 | 351 | </labeL> |
| 350 | 352 | </td> |
| 351 | 353 | </tr> |
| @@ -353,9 +355,10 @@ | ||
| 353 | 355 | <th>jQuery DataTables Responsive</th> |
| 354 | 356 | <td> |
| 355 | 357 | <label> |
| 356 | 358 | <?php |
| 357 | - echo sprintf( __( 'Load jQuery DataTables Responsive (version %s) scripts and styles', 'wp-data-access' ), esc_attr( $datatables_responsive_version ) ); | |
| 359 | + /* translators: %s = data tables responsive version number */ | |
| 360 | + echo sprintf( esc_attr__( 'Load jQuery DataTables Responsive (version %s) scripts and styles', 'wp-data-access' ), esc_attr( $datatables_responsive_version ) ); | |
| 358 | 361 | ?> |
| 359 | 362 | </label> |
| 360 | 363 | <div style="height:10px"></div> |
| 361 | 364 | <label> |
| @@ -363,9 +366,9 @@ | ||
| 363 | 366 | <?php |
| 364 | 367 | echo ( 'both' === $load_datatables_responsive ? 'checked' : '' ); |
| 365 | 368 | ?> |
| 366 | 369 | ><?php |
| 367 | - echo __( 'In WordPress Back-end and Front-end', 'wp-data-access' ); | |
| 370 | + esc_html_e( 'In WordPress Back-end and Front-end', 'wp-data-access' ); | |
| 368 | 371 | ?> |
| 369 | 372 | </label> |
| 370 | 373 | <br/> |
| 371 | 374 | <label> |
| @@ -373,9 +376,9 @@ | ||
| 373 | 376 | <?php |
| 374 | 377 | echo ( 'be' === $load_datatables_responsive ? 'checked' : '' ); |
| 375 | 378 | ?> |
| 376 | 379 | ><?php |
| 377 | - echo __( 'In WordPress Back-end only ', 'wp-data-access' ); | |
| 380 | + esc_html_e( 'In WordPress Back-end only ', 'wp-data-access' ); | |
| 378 | 381 | ?> |
| 379 | 382 | </label> |
| 380 | 383 | <br/> |
| 381 | 384 | <label> |
| @@ -383,9 +386,9 @@ | ||
| 383 | 386 | <?php |
| 384 | 387 | echo ( 'fe' === $load_datatables_responsive ? 'checked' : '' ); |
| 385 | 388 | ?> |
| 386 | 389 | ><?php |
| 387 | - echo __( 'In WordPress Front-end only', 'wp-data-access' ); | |
| 390 | + esc_html_e( 'In WordPress Front-end only', 'wp-data-access' ); | |
| 388 | 391 | ?> |
| 389 | 392 | </label> |
| 390 | 393 | <br/> |
| 391 | 394 | <label> |
| @@ -393,9 +396,9 @@ | ||
| 393 | 396 | <?php |
| 394 | 397 | echo ( '' === $load_datatables_responsive ? 'checked' : '' ); |
| 395 | 398 | ?> |
| 396 | 399 | ><?php |
| 397 | - echo __( 'Do not load jQuery DataTables Responsive', 'wp-data-access' ); | |
| 400 | + esc_html_e( 'Do not load jQuery DataTables Responsive', 'wp-data-access' ); | |
| 398 | 401 | ?> |
| 399 | 402 | </label> |
| 400 | 403 | </td> |
| 401 | 404 | </tr> |
| @@ -400,9 +403,9 @@ | ||
| 400 | 403 | </td> |
| 401 | 404 | </tr> |
| 402 | 405 | <tr> |
| 403 | 406 | <th><?php |
| 404 | - echo __( 'Front-End Language', 'wp-data-access' ); | |
| 407 | + esc_html_e( 'Front-End Language', 'wp-data-access' ); | |
| 405 | 408 | ?></th> |
| 406 | 409 | <td> |
| 407 | 410 | <select name="language"> |
| 408 | 411 | <?php |
| @@ -407,10 +410,11 @@ | ||
| 407 | 410 | <select name="language"> |
| 408 | 411 | <?php |
| 409 | 412 | foreach ( self::FRONTEND_LANG as $language => $code ) { |
| 410 | 413 | $checked = ( $current_language === $language ? ' selected' : '' ); |
| 414 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 411 | 415 | echo "<option value='{$language}'{$checked}>{$language}</option>"; |
| 412 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 416 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 413 | 417 | } |
| 414 | 418 | ?> |
| 415 | 419 | </select> |
| 416 | 420 | </td> |
| @@ -419,19 +423,19 @@ | ||
| 419 | 423 | <th><span class="dashicons dashicons-info" style="float:right;font-size:300%;"></span></th> |
| 420 | 424 | <td> |
| 421 | 425 | <span class="dashicons dashicons-yes"></span> |
| 422 | 426 | <?php |
| 423 | - echo __( 'jQuery DataTables (+Responsive) is needed in the Front-end to support data tables on your website', 'wp-data-access' ); | |
| 427 | + esc_html_e( 'jQuery DataTables (+Responsive) is needed in the Front-end to support data tables on your website', 'wp-data-access' ); | |
| 424 | 428 | ?> |
| 425 | 429 | <br/> |
| 426 | 430 | <span class="dashicons dashicons-yes"></span> |
| 427 | 431 | <?php |
| 428 | - echo __( 'jQuery DataTables (+Responsive) is needed in the Back-end to test data tables in the WordPress dashboard', 'wp-data-access' ); | |
| 432 | + esc_html_e( 'jQuery DataTables (+Responsive) is needed in the Back-end to test data tables in the WordPress dashboard', 'wp-data-access' ); | |
| 429 | 433 | ?> |
| 430 | 434 | <br/> |
| 431 | 435 | <span class="dashicons dashicons-yes"></span> |
| 432 | 436 | <?php |
| 433 | - echo __( 'If you have already loaded jQuery DataTables for other purposes disable loading them to prevent duplication errors', 'wp-data-access' ); | |
| 437 | + esc_html_e( 'If you have already loaded jQuery DataTables for other purposes disable loading them to prevent duplication errors', 'wp-data-access' ); | |
| 434 | 438 | ?> |
| 435 | 439 | </td> |
| 436 | 440 | </tr> |
| 437 | 441 | </table> |
| @@ -439,14 +443,14 @@ | ||
| 439 | 443 | <input type="hidden" name="action" value="save"/> |
| 440 | 444 | <button type="submit" class="button button-primary"> |
| 441 | 445 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 442 | 446 | <?php |
| 443 | - echo __( 'Save DataTables Settings', 'wp-data-access' ); | |
| 447 | + esc_html_e( 'Save DataTables Settings', 'wp-data-access' ); | |
| 444 | 448 | ?> |
| 445 | 449 | </button> |
| 446 | 450 | <a href="javascript:void(0)" |
| 447 | 451 | onclick="if (confirm('<?php |
| 448 | - echo __( 'Reset to defaults?', 'wp-data-access' ); | |
| 452 | + esc_html_e( 'Reset to defaults?', 'wp-data-access' ); | |
| 449 | 453 | ?>')) { |
| 450 | 454 | jQuery('input[name="action"]').val('setdefaults'); |
| 451 | 455 | jQuery('#wpda_settings_datatables').trigger('submit') |
| 452 | 456 | }" |
| @@ -452,9 +456,9 @@ | ||
| 452 | 456 | }" |
| 453 | 457 | class="button"> |
| 454 | 458 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 455 | 459 | <?php |
| 456 | - echo __( 'Reset DataTables Settings To Defaults', 'wp-data-access' ); | |
| 460 | + esc_html_e( 'Reset DataTables Settings To Defaults', 'wp-data-access' ); | |
| 457 | 461 | ?> |
| 458 | 462 | </a> |
| 459 | 463 | </div> |
| 460 | 464 | <?php |