| @@ -1,5 +1,5 @@ | ||
| 1 | -<?php // phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 1 | +<?php | |
| 2 | 2 | /** |
| 3 | 3 | * This file contains some code which is necessary to use class WP_List_Table in the public area. Part of the code is |
| 4 | 4 | * fake (added to documentation) and is only loaded if the WordPress code needed to handle WP_List_Table is not |
| 5 | 5 | * available (which is the case in the public area). List tables are available in the public area with limitations. |
| @@ -16,8 +16,17 @@ | ||
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Fake class to make WPDA_List_Table available in the public area |
| 19 | 19 | */ |
| 20 | + | |
| 21 | +if ( ! defined( 'WPINC' ) ) { | |
| 22 | + die; | |
| 23 | +} | |
| 24 | + | |
| 25 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 26 | + exit; | |
| 27 | +} | |
| 28 | + | |
| 20 | 29 | class WPDADIEHARD_Screen { |
| 21 | 30 | /** |
| 22 | 31 | * Placeholder to prevent runtime errors |
| 23 | 32 | * |
| @@ -67,9 +76,9 @@ | ||
| 67 | 76 | * Fake function |
| 68 | 77 | * |
| 69 | 78 | * @return array |
| 70 | 79 | */ |
| 71 | - function get_column_headers() { | |
| 80 | + function get_column_headers() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound | |
| 72 | 81 | return array(); // Class WPDA_List_Table will fill this array. |
| 73 | 82 | } |
| 74 | 83 | } |
| 75 | 84 | |
| @@ -98,9 +107,9 @@ | ||
| 98 | 107 | * @return string |
| 99 | 108 | */ |
| 100 | 109 | function wpdadiehard_get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) { |
| 101 | 110 | if ( ! is_array( $type ) ) { |
| 102 | - $type = explode( ' ', (string) $type );//phpcs:ignore - 8.1 proof | |
| 111 | + $type = explode( ' ', (string) $type ); // phpcs:ignore -- 8.1 proof | |
| 103 | 112 | } |
| 104 | 113 | |
| 105 | 114 | $button_shorthand = array( 'primary', 'small', 'large' ); |
| 106 | 115 | $classes = array( 'button' ); |
| @@ -107,14 +116,14 @@ | ||
| 107 | 116 | foreach ( $type as $t ) { |
| 108 | 117 | if ( 'secondary' === $t || 'button-secondary' === $t ) { |
| 109 | 118 | continue; |
| 110 | 119 | } |
| 111 | - $classes[] = in_array( $t, $button_shorthand, true ) ? 'button-' . $t : $t;//phpcs:ignore - 8.1 proof | |
| 120 | + $classes[] = in_array( $t, $button_shorthand, true ) ? 'button-' . $t : $t; // phpcs:ignore -- 8.1 proof | |
| 112 | 121 | } |
| 113 | 122 | // Remove empty items, remove duplicate items, and finally build a string. |
| 114 | - $class = implode( ' ', array_unique( array_filter( $classes ) ) ); //phpcs:ignore - 8.1 proof | |
| 123 | + $class = implode( ' ', array_unique( array_filter( $classes ) ) ); // phpcs:ignore -- 8.1 proof | |
| 115 | 124 | |
| 116 | - $text = $text ? $text : __( 'Save Changes' ); | |
| 125 | + $text = $text ? $text : __( 'Save Changes', 'wp-data-access' ); | |
| 117 | 126 | |
| 118 | 127 | // Default the id attribute to $name unless an id was specifically provided in $other_attributes. |
| 119 | 128 | $id = $name; |
| 120 | 129 | if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) { |