PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
← All changes | views/view-options_custom_css.php +32 -22 2.1.8 → 3.4 View file →
@@ -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 /**
@@ -25,26 +27,28 @@
25 27 * Set up the view with data and do things that are specific for this view.
26 28 *
27 29 * @since 1.0.0
28 30 *
29 - * @param string $action Action for this view.
30 - * @param array $data Data for this view.
31 + * @param string $action Action for this view.
32 + * @param array<string, mixed> $data Data for this view.
31 33 */
32 - public function setup( $action, array $data ) {
34 + #[\Override]
35 + public function setup( /* string */ $action, array $data ) /* : void */ {
36 + // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
37 +
33 38 // Set action manually here, to get correct page title and nav bar entries.
34 39 $this->action = 'options';
35 40 $this->data = $data;
36 41
37 42 // Set page title.
38 - $GLOBALS['title'] = sprintf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), $this->data['view_actions'][ $this->action ]['page_title'], 'TablePress' );
43 + /* translators: %1$s: Page title, %2$s: Plugin name */
44 + $GLOBALS['title'] = sprintf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), $this->data['view_actions'][ $this->action ]['page_title'], 'TablePress' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
39 45
40 - $this->add_header_message( '<strong>' . __( 'Attention: Further action is required to save the changes to your &#8220;Custom CSS&#8221;!', 'tablepress' ) . '</strong>', 'notice-success' );
46 + add_filter( 'admin_footer_text', array( $this, 'add_admin_footer_text' ) );
41 47
42 - // Admin page helpers, like script/style loading, could be moved to view.
43 - $this->admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' );
44 - $this->admin_page->enqueue_style( 'common' );
48 + $this->add_header_message( '<strong>' . __( 'Attention: Further action is required to save the changes to your &#8220;Custom CSS&#8221;!', 'tablepress' ) . '</strong>', 'is-warning notice-warning' );
45 49
46 - $this->admin_page->add_admin_footer_text();
50 + TablePress::enqueue_style( 'common', array( 'wp-components' ) );
47 51
48 52 $this->add_text_box( 'explanation-text', array( $this, 'textbox_explanation_text' ), 'normal' );
49 53 $this->add_text_box( 'credentials-form', array( $this, 'textbox_credentials_form' ), 'normal' );
50 54 $this->add_text_box( 'proceed-no-file-saving', array( $this, 'textbox_proceed_no_file_saving' ), 'submit' );
@@ -54,9 +58,10 @@
54 58 * Render the current view (in this view: without form tag).
55 59 *
56 60 * @since 1.0.0
57 61 */
58 - public function render() {
62 + #[\Override]
63 + public function render(): void {
59 64 ?>
60 65 <div id="tablepress-page" class="wrap">
61 66 <?php
62 67 $this->print_nav_tab_menu();
@@ -61,8 +66,10 @@
61 66 <?php
62 67 $this->print_nav_tab_menu();
63 68 ?>
64 69 <div id="tablepress-body">
70 + <hr class="wp-header-end">
71 + <script>document.querySelectorAll('.notice:has(~#tablepress-page)').forEach(e=>document.querySelector('.wp-header-end').after(e));</script>
65 72 <?php
66 73 // Print all header messages.
67 74 foreach ( $this->header_messages as $message ) {
68 75 echo $message;
@@ -91,9 +98,9 @@
91 98 $this->do_meta_boxes( 'side' );
92 99 ?>
93 100 </div>
94 101 </div>
95 - <br class="clear" />
102 + <br class="clear">
96 103 </div>
97 104 </div>
98 105 </div>
99 106 <?php
@@ -103,16 +110,19 @@
103 110 * Print the content of the "Explanation" text box.
104 111 *
105 112 * @since 1.0.0
106 113 *
107 - * @param array $data Data for this screen.
108 - * @param array $box Information about the text box.
114 + * @param array<string, mixed> $data Data for this screen.
115 + * @param array<string, mixed> $box Information about the text box.
109 116 */
110 - public function textbox_explanation_text( array $data, array $box ) {
117 + public function textbox_explanation_text( array $data, array $box ): void {
111 118 ?>
112 119 <p>
113 120 <?php _e( 'Due to the configuration of your server, TablePress was not able to automatically save your &#8220;Custom CSS&#8221; to a file.', 'tablepress' ); ?>
114 - <?php printf( __( 'To try again with the same method that you use for updating plugins or themes, please fill out the &#8220;%s&#8221; form below.', 'tablepress' ), __( 'Connection Information', 'default' ) ); ?>
121 + <?php
122 + /* translators: %s: Connection information form label */
123 + printf( __( 'To try again with the same method that you use for updating plugins or themes, please fill out the &#8220;%s&#8221; form below.', 'tablepress' ), __( 'Connection Information', 'default' ) );
124 + ?>
115 125 </p>
116 126 <?php
117 127 }
118 128
@@ -120,12 +130,12 @@
120 130 * Print the content of the "Credentials" text box.
121 131 *
122 132 * @since 1.0.0
123 133 *
124 - * @param array $data Data for this screen.
125 - * @param array $box Information about the text box.
134 + * @param array<string, mixed> $data Data for this screen.
135 + * @param array<string, mixed> $box Information about the text box.
126 136 */
127 - public function textbox_credentials_form( array $data, array $box ) {
137 + public function textbox_credentials_form( array $data, array $box ): void {
128 138 echo $data['credentials_form'];
129 139 }
130 140
131 141 /**
@@ -132,12 +142,12 @@
132 142 * Print the content of the "Cancel Saving" text box.
133 143 *
134 144 * @since 1.0.0
135 145 *
136 - * @param array $data Data for this screen.
137 - * @param array $box Information about the text box.
146 + * @param array<string, mixed> $data Data for this screen.
147 + * @param array<string, mixed> $box Information about the text box.
138 148 */
139 - public function textbox_proceed_no_file_saving( array $data, array $box ) {
149 + public function textbox_proceed_no_file_saving( array $data, array $box ): void {
140 150 ?>
141 151 <h2><?php _e( 'Proceed without saving a file', 'tablepress' ); ?></h2>
142 152 <p>
143 153 <?php _e( 'To proceed without trying to save the &#8220;Custom CSS&#8221; to a file, click the button below.', 'tablepress' ); ?>
@@ -142,9 +152,9 @@
142 152 <p>
143 153 <?php _e( 'To proceed without trying to save the &#8220;Custom CSS&#8221; to a file, click the button below.', 'tablepress' ); ?>
144 154 <?php _e( 'Your &#8220;Custom CSS&#8221; will then be loaded inline.', 'tablepress' ); ?>
145 155 </p><p>
146 - <a href="<?php echo TablePress::url( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) ); ?>" class="button button-large"><?php _e( 'Proceed without saving &#8220;Custom CSS&#8221; to a file', 'tablepress' ); ?></a>
156 + <a href="<?php echo TablePress::url( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) ); ?>" class="components-button is-secondary"><?php _e( 'Proceed without saving &#8220;Custom CSS&#8221; to a file', 'tablepress' ); ?></a>
147 157 </p>
148 158 <?php
149 159 }
150 160