id = 'wpdadiehard'; return $screen; } /** * Fake function * * @return WPDADIEHARD_Screen */ function wpdadiehard_get_current_screen() { $screen = new WPDADIEHARD_Screen(); $screen->id = 'wpdadiehard'; return $screen; } if ( ! function_exists( 'get_column_headers' ) ) { /** * Fake function * * @return array */ function get_column_headers() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return array(); // Class WPDA_List_Table will fill this array. } } /** * Duplicated from: wp-admin/includes/template.php (24-07-2020) * * @param mixed $text Text. * @param mixed $type Type. * @param mixed $name Name. * @param mixed $wrap Wrap. * @param mixed $other_attributes Attr. * @return void */ function wpdadiehard_submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) { echo wpdadiehard_get_submit_button( $text, $type, $name, $wrap, $other_attributes ); // phpcs:ignore WordPress.Security.EscapeOutput } /** * Duplicated from: wp-admin/includes/template.php (24-07-2020) * * @param mixed $text Text. * @param mixed $type Type. * @param mixed $name Name. * @param mixed $wrap Wrap. * @param mixed $other_attributes Attr. * @return string */ function wpdadiehard_get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) { if ( ! is_array( $type ) ) { $type = explode( ' ', (string) $type ); // phpcs:ignore -- 8.1 proof } $button_shorthand = array( 'primary', 'small', 'large' ); $classes = array( 'button' ); foreach ( $type as $t ) { if ( 'secondary' === $t || 'button-secondary' === $t ) { continue; } $classes[] = in_array( $t, $button_shorthand, true ) ? 'button-' . $t : $t; // phpcs:ignore -- 8.1 proof } // Remove empty items, remove duplicate items, and finally build a string. $class = implode( ' ', array_unique( array_filter( $classes ) ) ); // phpcs:ignore -- 8.1 proof $text = $text ? $text : __( 'Save Changes', 'wp-data-access' ); // Default the id attribute to $name unless an id was specifically provided in $other_attributes. $id = $name; if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) { $id = $other_attributes['id']; unset( $other_attributes['id'] ); } $attributes = ''; if ( is_array( $other_attributes ) ) { foreach ( $other_attributes as $attribute => $value ) { $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important. } } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string. $attributes = $other_attributes; } // Don't output empty name and id attributes. $name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : ''; $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $button = ''; if ( $wrap ) { $button = '
' . $button . '
'; } return $button; }