| @@ -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 | /** |
| @@ -34,9 +36,10 @@ | ||
| 34 | 36 | // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. |
| 35 | 37 | |
| 36 | 38 | parent::setup( $action, $data ); |
| 37 | 39 | |
| 38 | - $this->admin_page->enqueue_script( 'options' ); | |
| 40 | + TablePress::enqueue_script( 'common', array( 'jquery-core', 'postbox' ) ); | |
| 41 | + TablePress::enqueue_script( 'options' ); | |
| 39 | 42 | |
| 40 | 43 | $this->process_action_messages( array( |
| 41 | 44 | 'success_save' => __( 'Options saved successfully.', 'tablepress' ), |
| 42 | 45 | 'success_save_error_custom_css' => __( 'Options saved successfully, but “Custom CSS” was not saved to file.', 'tablepress' ), |
| @@ -48,13 +51,16 @@ | ||
| 48 | 51 | // Enqueue WordPress copy of CodeMirror, with CSS linting, etc., for the "Custom CSS" textarea, which is only shown to admins. |
| 49 | 52 | $codemirror_settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) ); |
| 50 | 53 | if ( ! empty( $codemirror_settings ) ) { |
| 51 | 54 | // Load CSS adjustments for CodeMirror and the added vertical resizing. |
| 52 | - $this->admin_page->enqueue_style( 'codemirror', array( 'code-editor' ) ); | |
| 53 | - $this->admin_page->enqueue_script( 'codemirror' ); | |
| 55 | + TablePress::enqueue_style( 'codemirror', array( 'code-editor' ) ); | |
| 56 | + TablePress::enqueue_script( 'codemirror' ); | |
| 54 | 57 | } |
| 55 | 58 | |
| 56 | - $this->add_meta_box( 'default-style', sprintf( __( 'Default Styling %s', 'tablepress' ), '<span class="beta-label">' . ( tb_tp_fs()->is_free_plan() ? __( 'Premium', 'tablepress' ) : __( 'beta', 'tablepress' ) ) . '</span>' ), array( $this, 'postbox_default_style_customizer_screen' ), 'normal' ); | |
| 59 | + if ( ! TABLEPRESS_IS_PLAYGROUND_PREVIEW ) { | |
| 60 | + /* translators: %s: Premium badge HTML or empty string */ | |
| 61 | + $this->add_meta_box( 'default-style', sprintf( __( 'Default Styling %s', 'tablepress' ), tb_tp_fs()->is_free_plan() ? '<span class="pill-label">' . __( 'Premium', 'tablepress' ) . '</span>' : '' ), array( $this, 'postbox_default_style_customizer_screen' ), 'normal' ); | |
| 62 | + } | |
| 57 | 63 | $this->add_meta_box( 'frontend-options', __( 'Custom Styling', 'tablepress' ), array( $this, 'postbox_frontend_options' ), 'normal' ); |
| 58 | 64 | } |
| 59 | 65 | $this->add_meta_box( 'user-options', __( 'User Options', 'tablepress' ), array( $this, 'postbox_user_options' ), 'normal' ); |
| 60 | 66 | $this->add_text_box( 'submit', array( $this, 'textbox_submit_button' ), 'submit' ); |
| @@ -123,9 +129,9 @@ | ||
| 123 | 129 | ?> |
| 124 | 130 | <table class="tablepress-postbox-table fixed"> |
| 125 | 131 | <tr> |
| 126 | 132 | <th class="column-1" scope="row"><label for="option-custom-css"><?php _e( 'Custom CSS', 'tablepress' ); ?></label>:</th> |
| 127 | - <td class="column-2"><label for="option-use-custom-css"><input type="checkbox" id="option-use-custom-css" name="options[use_custom_css]" value="true"<?php checked( $data['frontend_options']['use_custom_css'] ); ?>> <?php _e( 'Load this “Custom CSS” code to change the table styling:', 'tablepress' ); ?></label> | |
| 133 | + <td class="column-2"><label><input type="checkbox" id="option-use-custom-css" name="options[use_custom_css]" value="true"<?php checked( $data['frontend_options']['use_custom_css'] ); ?>> <?php _e( 'Load this “Custom CSS” code to change the table styling:', 'tablepress' ); ?></label> | |
| 128 | 134 | </td> |
| 129 | 135 | </tr> |
| 130 | 136 | <tr> |
| 131 | 137 | <td class="column-1"></td> |
| @@ -205,9 +211,9 @@ | ||
| 205 | 211 | #[\Override] |
| 206 | 212 | public function textbox_submit_button( array $data, array $box ): void { |
| 207 | 213 | ?> |
| 208 | 214 | <p class="submit"> |
| 209 | - <input type="submit" id="tablepress-options-save-changes" class="button button-primary button-large button-save-changes" value="<?php esc_attr_e( 'Save Changes', 'tablepress' ); ?>" data-shortcut="<?php echo esc_attr( _x( '%1$sS', 'keyboard shortcut for Save Changes', 'tablepress' ) ); ?>"> | |
| 215 | + <input type="submit" id="tablepress-options-save-changes" class="components-button is-primary button-save-changes" value="<?php esc_attr_e( 'Save Changes', 'tablepress' ); ?>" data-shortcut="<?php echo esc_attr( _x( '%1$sS', 'keyboard shortcut for Save Changes', 'tablepress' ) ); ?>"> | |
| 210 | 216 | </p> |
| 211 | 217 | <?php |
| 212 | 218 | } |
| 213 | 219 | |
| @@ -229,9 +235,9 @@ | ||
| 229 | 235 | . __( 'You will manually need to remove the plugin’s files from the plugin folder afterwards.', 'tablepress' ) . '<br>' |
| 230 | 236 | . __( 'Be very careful with this and only click the button if you know what you are doing!', 'tablepress' ); |
| 231 | 237 | ?> |
| 232 | 238 | </p> |
| 233 | - <p><a href="<?php echo TablePress::url( array( 'action' => 'uninstall_tablepress' ), true, 'admin-post.php' ); ?>" id="uninstall-tablepress" class="button"><?php _e( 'Uninstall TablePress', 'tablepress' ); ?></a></p> | |
| 239 | + <p><a href="<?php echo TablePress::url( array( 'action' => 'uninstall_tablepress' ), true, 'admin-post.php' ); ?>" id="uninstall-tablepress" class="components-button is-secondary is-destructive"><?php _e( 'Uninstall TablePress', 'tablepress' ); ?></a></p> | |
| 234 | 240 | <?php |
| 235 | 241 | } |
| 236 | 242 | |
| 237 | 243 | } // class TablePress_Options_View |