| @@ -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 | /** |
| @@ -28,8 +30,9 @@ | ||
| 28 | 30 | * |
| 29 | 31 | * @param string $action Action for this view. |
| 30 | 32 | * @param array<string, mixed> $data Data for this view. |
| 31 | 33 | */ |
| 34 | + #[\Override] | |
| 32 | 35 | public function setup( /* string */ $action, array $data ) /* : void */ { |
| 33 | 36 | // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. |
| 34 | 37 | |
| 35 | 38 | // Set action manually here, to get correct page title and nav bar entries. |
| @@ -36,17 +39,16 @@ | ||
| 36 | 39 | $this->action = 'options'; |
| 37 | 40 | $this->data = $data; |
| 38 | 41 | |
| 39 | 42 | // Set page title. |
| 43 | + /* translators: %1$s: Page title, %2$s: Plugin name */ | |
| 40 | 44 | $GLOBALS['title'] = sprintf( __( '%1$s ‹ %2$s', 'tablepress' ), $this->data['view_actions'][ $this->action ]['page_title'], 'TablePress' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 41 | 45 | |
| 42 | - $this->add_header_message( '<strong>' . __( 'Attention: Further action is required to save the changes to your “Custom CSS”!', 'tablepress' ) . '</strong>', 'notice-success' ); | |
| 46 | + add_filter( 'admin_footer_text', array( $this, 'add_admin_footer_text' ) ); | |
| 43 | 47 | |
| 44 | - // Admin page helpers, like script/style loading, could be moved to view. | |
| 45 | - $this->admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' ); | |
| 46 | - $this->admin_page->enqueue_style( 'common' ); | |
| 48 | + $this->add_header_message( '<strong>' . __( 'Attention: Further action is required to save the changes to your “Custom CSS”!', 'tablepress' ) . '</strong>', 'is-warning notice-warning' ); | |
| 47 | 49 | |
| 48 | - $this->admin_page->add_admin_footer_text(); | |
| 50 | + TablePress::enqueue_style( 'common', array( 'wp-components' ) ); | |
| 49 | 51 | |
| 50 | 52 | $this->add_text_box( 'explanation-text', array( $this, 'textbox_explanation_text' ), 'normal' ); |
| 51 | 53 | $this->add_text_box( 'credentials-form', array( $this, 'textbox_credentials_form' ), 'normal' ); |
| 52 | 54 | $this->add_text_box( 'proceed-no-file-saving', array( $this, 'textbox_proceed_no_file_saving' ), 'submit' ); |
| @@ -56,8 +58,9 @@ | ||
| 56 | 58 | * Render the current view (in this view: without form tag). |
| 57 | 59 | * |
| 58 | 60 | * @since 1.0.0 |
| 59 | 61 | */ |
| 62 | + #[\Override] | |
| 60 | 63 | public function render(): void { |
| 61 | 64 | ?> |
| 62 | 65 | <div id="tablepress-page" class="wrap"> |
| 63 | 66 | <?php |
| @@ -63,8 +66,10 @@ | ||
| 63 | 66 | <?php |
| 64 | 67 | $this->print_nav_tab_menu(); |
| 65 | 68 | ?> |
| 66 | 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> | |
| 67 | 72 | <?php |
| 68 | 73 | // Print all header messages. |
| 69 | 74 | foreach ( $this->header_messages as $message ) { |
| 70 | 75 | echo $message; |
| @@ -93,9 +98,9 @@ | ||
| 93 | 98 | $this->do_meta_boxes( 'side' ); |
| 94 | 99 | ?> |
| 95 | 100 | </div> |
| 96 | 101 | </div> |
| 97 | - <br class="clear" /> | |
| 102 | + <br class="clear"> | |
| 98 | 103 | </div> |
| 99 | 104 | </div> |
| 100 | 105 | </div> |
| 101 | 106 | <?php |
| @@ -112,9 +117,12 @@ | ||
| 112 | 117 | public function textbox_explanation_text( array $data, array $box ): void { |
| 113 | 118 | ?> |
| 114 | 119 | <p> |
| 115 | 120 | <?php _e( 'Due to the configuration of your server, TablePress was not able to automatically save your “Custom CSS” to a file.', 'tablepress' ); ?> |
| 116 | - <?php printf( __( 'To try again with the same method that you use for updating plugins or themes, please fill out the “%s” 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 “%s” form below.', 'tablepress' ), __( 'Connection Information', 'default' ) ); | |
| 124 | + ?> | |
| 117 | 125 | </p> |
| 118 | 126 | <?php |
| 119 | 127 | } |
| 120 | 128 | |
| @@ -144,9 +152,9 @@ | ||
| 144 | 152 | <p> |
| 145 | 153 | <?php _e( 'To proceed without trying to save the “Custom CSS” to a file, click the button below.', 'tablepress' ); ?> |
| 146 | 154 | <?php _e( 'Your “Custom CSS” will then be loaded inline.', 'tablepress' ); ?> |
| 147 | 155 | </p><p> |
| 148 | - <a href="<?php echo TablePress::url( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) ); ?>" class="button button-large"><?php _e( 'Proceed without saving “Custom CSS” 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 “Custom CSS” to a file', 'tablepress' ); ?></a> | |
| 149 | 157 | </p> |
| 150 | 158 | <?php |
| 151 | 159 | } |
| 152 | 160 | |