| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | * @author Tobias Bäthge |
| 8 | 8 | * @since 1.0.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +declare(strict_types=1); | |
| 12 | + | |
| 11 | 13 | // Prohibit direct script loading. |
| 12 | 14 | defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 13 | 15 | |
| 14 | 16 | /** |
| @@ -24,11 +26,10 @@ | ||
| 24 | 26 | /** |
| 25 | 27 | * Object for the Editor Button Thickbox List Table. |
| 26 | 28 | * |
| 27 | 29 | * @since 1.0.0 |
| 28 | - * @var TablePress_Editor_Button_Thickbox_List_Table | |
| 29 | 30 | */ |
| 30 | - protected $wp_list_table; | |
| 31 | + protected \TablePress_Editor_Button_Thickbox_List_Table $wp_list_table; | |
| 31 | 32 | |
| 32 | 33 | /** |
| 33 | 34 | * Initializes the View class. |
| 34 | 35 | * |
| @@ -42,12 +43,15 @@ | ||
| 42 | 43 | * Sets up the view with data and do things that are specific for this view. |
| 43 | 44 | * |
| 44 | 45 | * @since 1.0.0 |
| 45 | 46 | * |
| 46 | - * @param string $action Action for this view. | |
| 47 | - * @param array $data Data for this view. | |
| 47 | + * @param string $action Action for this view. | |
| 48 | + * @param array<string, mixed> $data Data for this view. | |
| 48 | 49 | */ |
| 49 | - public function setup( $action, array $data ) { | |
| 50 | + #[\Override] | |
| 51 | + public function setup( /* string */ $action, array $data ) /* : void */ { | |
| 52 | + // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. | |
| 53 | + | |
| 50 | 54 | $this->action = $action; |
| 51 | 55 | $this->data = $data; |
| 52 | 56 | |
| 53 | 57 | $this->wp_list_table = TablePress::load_class( 'TablePress_Editor_Button_Thickbox_List_Table', 'class-editor-button-thickbox-list-table.php', 'views' ); |
| @@ -60,15 +64,16 @@ | ||
| 60 | 64 | * Renders the current view. |
| 61 | 65 | * |
| 62 | 66 | * @since 1.0.0 |
| 63 | 67 | */ |
| 64 | - public function render() { | |
| 68 | + #[\Override] | |
| 69 | + public function render(): void { | |
| 65 | 70 | _wp_admin_html_begin(); |
| 66 | 71 | |
| 67 | 72 | wp_print_styles( 'colors' ); |
| 68 | 73 | wp_print_scripts( 'jquery-core' ); |
| 69 | 74 | ?> |
| 70 | -<title><?php printf( __( '%1$s ‹ %2$s', 'tablepress' ), __( 'List of Tables', 'tablepress' ), 'TablePress' ); ?></title> | |
| 75 | +<title><?php /* translators: %1$s: Page title, %2$s: Plugin name */ printf( __( '%1$s ‹ %2$s', 'tablepress' ), __( 'List of Tables', 'tablepress' ), 'TablePress' ); ?></title> | |
| 71 | 76 | <style> |
| 72 | 77 | /* Account for .wp-toolbar. */ |
| 73 | 78 | html { |
| 74 | 79 | padding-top: 0 !important; |
| @@ -109,11 +114,11 @@ | ||
| 109 | 114 | } |
| 110 | 115 | <?php endif; ?> |
| 111 | 116 | </style> |
| 112 | 117 | </head> |
| 113 | -<body class="wp-admin wp-core-ui js iframe<?php echo is_rtl() ? ' rtl' : ''; ?>"> | |
| 118 | +<body class="wp-admin wp-core-ui js iframe <?php echo 'admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'modern' ) . ( is_rtl() ? ' rtl' : '' ); ?>"> | |
| 114 | 119 | <div id="tablepress-page" class="wrap"> |
| 115 | -<h1><?php printf( __( '%1$s ‹ %2$s', 'tablepress' ), __( 'List of Tables', 'tablepress' ), 'TablePress' ); ?></h1> | |
| 120 | +<h1><?php /* translators: %1$s: Page title, %2$s: Plugin name */ printf( __( '%1$s ‹ %2$s', 'tablepress' ), __( 'List of Tables', 'tablepress' ), 'TablePress' ); ?></h1> | |
| 116 | 121 | <div id="poststuff"> |
| 117 | 122 | <p><?php _e( 'This is a list of your tables.', 'tablepress' ); ?> <?php _e( 'You may insert a table into a post or page here.', 'tablepress' ); ?></p> |
| 118 | 123 | <p><?php printf( __( 'Click the “%1$s” button for the desired table to automatically insert its Shortcode into the editor.', 'tablepress' ), __( 'Insert Shortcode', 'tablepress' ) ); ?></p> |
| 119 | 124 | <?php |
| @@ -120,10 +125,10 @@ | ||
| 120 | 125 | if ( ! empty( $_GET['s'] ) ) { |
| 121 | 126 | printf( '<span class="subtitle">' . __( 'Search results for “%s”', 'tablepress' ) . '</span>', esc_html( wp_unslash( $_GET['s'] ) ) ); |
| 122 | 127 | } |
| 123 | 128 | ?> |
| 124 | -<form method="get" action=""> | |
| 125 | - <input type="hidden" name="action" value="tablepress_<?php echo $this->action; ?>" /> | |
| 129 | +<form method="get"> | |
| 130 | + <input type="hidden" name="action" value="tablepress_<?php echo $this->action; ?>"> | |
| 126 | 131 | <?php |
| 127 | 132 | wp_nonce_field( TablePress::nonce( $this->action ), '_wpnonce', false ); |
| 128 | 133 | $this->wp_list_table->search_box( __( 'Search Tables', 'tablepress' ), 'tables_search' ); |
| 129 | 134 | ?> |