| @@ -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 | * Number of screen columns for post boxes on this screen. |
| 26 | 28 | * |
| 27 | 29 | * @since 1.0.0 |
| 28 | - * @var int | |
| 29 | 30 | */ |
| 30 | - protected $screen_columns = 2; | |
| 31 | + protected int $screen_columns = 2; | |
| 31 | 32 | |
| 32 | 33 | /** |
| 33 | 34 | * Set up the view with data and do things that are specific for this view. |
| 34 | 35 | * |
| @@ -42,8 +43,10 @@ | ||
| 42 | 43 | // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. |
| 43 | 44 | |
| 44 | 45 | parent::setup( $action, $data ); |
| 45 | 46 | |
| 47 | + TablePress::enqueue_script( 'common', array( 'jquery-core', 'postbox' ) ); | |
| 48 | + | |
| 46 | 49 | $this->add_text_box( 'spacer', array( $this, 'textbox_spacer' ), 'normal' ); |
| 47 | 50 | $this->add_text_box( 'spacer', array( $this, 'textbox_spacer' ), 'side' ); |
| 48 | 51 | $this->add_meta_box( 'plugin-purpose', __( 'Plugin Purpose', 'tablepress' ), array( $this, 'postbox_plugin_purpose' ), 'normal' ); |
| 49 | 52 | $this->add_meta_box( 'usage', __( 'Usage', 'tablepress' ), array( $this, 'postbox_usage' ), 'normal' ); |
| @@ -62,11 +65,9 @@ | ||
| 62 | 65 | * @param array<string, mixed> $data Data for this screen. |
| 63 | 66 | * @param array<string, mixed> $box Information about the text box. |
| 64 | 67 | */ |
| 65 | 68 | public function textbox_spacer( array $data, array $box ): void { |
| 66 | - ?> | |
| 67 | - <p></p> | |
| 68 | - <?php | |
| 69 | + echo '<p></p>'; | |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | /** |
| 72 | 73 | * Print the content of the "Plugin Purpose" post meta box. |
| @@ -80,9 +81,9 @@ | ||
| 80 | 81 | ?> |
| 81 | 82 | <p> |
| 82 | 83 | <?php _e( 'TablePress allows you to create and manage tables in the admin area of WordPress.', 'tablepress' ); ?> |
| 83 | 84 | <?php _e( 'Tables may contain text, numbers, formulas, and even HTML code (e.g. to include images or links).', 'tablepress' ); ?> |
| 84 | - <?php _e( 'You can embed the tables into posts, pages, or other site areas using a block in the block editor.', 'tablepress' ); ?> | |
| 85 | + <?php _e( 'You can embed the tables into posts, pages, or other site areas using a block in the block editor, a widget in the Elementor page builder, or a Shortcode.', 'tablepress' ); ?> | |
| 85 | 86 | </p> |
| 86 | 87 | <?php |
| 87 | 88 | } |
| 88 | 89 | |
| @@ -107,10 +108,12 @@ | ||
| 107 | 108 | </p> |
| 108 | 109 | <p> |
| 109 | 110 | <?php |
| 110 | 111 | // Show the instructions string depending on whether the Block Editor is used on the site or not. |
| 111 | - if ( $data['site_uses_block_editor'] ) { | |
| 112 | + if ( 'block' === $data['site_used_editor'] ) { | |
| 112 | 113 | printf( __( 'To insert a table into a post or page, add a “%1$s” block in the block editor and select the desired table.', 'tablepress' ), __( 'TablePress table', 'tablepress' ) ); |
| 114 | + } elseif ( 'elementor' === $data['site_used_editor'] ) { | |
| 115 | + printf( __( 'To insert a table into a post or page, add a “%1$s” widget in the Elementor editor and select the desired table.', 'tablepress' ), __( 'TablePress table', 'tablepress' ) ); | |
| 113 | 116 | } else { |
| 114 | 117 | _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' ); |
| 115 | 118 | echo ' '; |
| 116 | 119 | _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' ); |
| @@ -154,16 +157,23 @@ | ||
| 154 | 157 | */ |
| 155 | 158 | public function postbox_author_license( array $data, array $box ): void { |
| 156 | 159 | ?> |
| 157 | 160 | <p> |
| 158 | - <?php printf( __( 'This plugin was written and developed by <a href="%s">Tobias Bäthge</a>.', 'tablepress' ), 'https://tobias.baethge.com/' ); ?> | |
| 161 | + <?php | |
| 162 | + /* translators: %s: Author's website URL */ | |
| 163 | + printf( __( 'This plugin was written and developed by <a href="%s">Tobias Bäthge</a>.', 'tablepress' ), 'https://tobias.baethge.com/' ); | |
| 164 | + ?> | |
| 159 | 165 | <?php _e( 'It is licensed as Free Software under GNU General Public License 2 (GPL 2).', 'tablepress' ); ?> |
| 160 | 166 | </p> |
| 161 | 167 | <p> |
| 162 | - <?php printf( __( 'Please rate and review the plugin in the <a href="%s">WordPress Plugin Directory</a>.', 'tablepress' ), 'https://wordpress.org/support/view/plugin-reviews/tablepress' ); ?> | |
| 168 | + <?php | |
| 169 | + /* translators: %s: WordPress Plugin Directory URL */ | |
| 170 | + printf( __( 'Please rate and review the plugin in the <a href="%s">WordPress Plugin Directory</a>.', 'tablepress' ), 'https://wordpress.org/support/view/plugin-reviews/tablepress' ); | |
| 171 | + ?> | |
| 163 | 172 | </p> |
| 164 | 173 | <?php |
| 165 | 174 | if ( tb_tp_fs()->is_free_plan() ) { |
| 175 | + /* translators: %s: TablePress Premium website URL */ | |
| 166 | 176 | echo '<p><strong>' . sprintf( __( 'I would like to invite you to check out the <a href="%s">Premium versions of TablePress</a>.', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=about-screen' ) . ' ' |
| 167 | 177 | . __( 'The available Pro and Max plans offer user support and many exciting and helpful features for your tables.', 'tablepress' ) . '</strong></p>'; |
| 168 | 178 | } |
| 169 | 179 | ?> |
| @@ -204,33 +214,36 @@ | ||
| 204 | 214 | * @param array<string, mixed> $data Data for this screen. |
| 205 | 215 | * @param array<string, mixed> $box Information about the meta box. |
| 206 | 216 | */ |
| 207 | 217 | public function postbox_debug_version_information( array $data, array $box ): void { |
| 208 | - $mysqli = ( isset( $GLOBALS['wpdb']->use_mysqli, $GLOBALS['wpdb']->dbh ) && $GLOBALS['wpdb']->use_mysqli ); | |
| 209 | 218 | ?> |
| 210 | 219 | <p> |
| 211 | 220 | <strong><?php _e( 'Please provide this information in bug reports and support requests.', 'tablepress' ); ?></strong> |
| 212 | 221 | </p> |
| 213 | - <p class="ltr"> | |
| 214 | - · Website: <?php echo site_url(); ?> | |
| 215 | - <br />· TablePress: <?php echo TablePress::version; ?> | |
| 216 | - <br />· TablePress (DB): <?php echo TablePress::db_version; ?> | |
| 217 | - <br />· TablePress table scheme: <?php echo TablePress::table_scheme_version; ?> | |
| 218 | - <br />· Plan: Free | |
| 219 | - <br />· Plugin installed: <?php echo wp_date( 'Y/m/d H:i:s', $data['first_activation'] ); ?> | |
| 220 | - <br />· WordPress: <?php echo $GLOBALS['wp_version']; ?> | |
| 221 | - <br />· Multisite: <?php echo is_multisite() ? 'yes' : 'no'; ?> | |
| 222 | - <br />· PHP: <?php echo PHP_VERSION; ?> | |
| 223 | - <br />· mysqli Extension: <?php echo $mysqli ? 'true' : 'false'; ?> | |
| 224 | - <br />· mySQL (Server): <?php echo $mysqli ? mysqli_get_server_info( $GLOBALS['wpdb']->dbh ) : '<em>no mysqli</em>'; // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info ?> | |
| 225 | - <br />· mySQL (Client): <?php echo $mysqli ? mysqli_get_client_info() : '<em>no mysqli</em>'; // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_client_info ?> | |
| 226 | - <br />· ZIP support: <?php echo $data['zip_support_available'] ? 'yes' : 'no'; ?> | |
| 227 | - <br />· UTF-8 conversion: <?php echo ( function_exists( 'mb_detect_encoding' ) && function_exists( 'iconv' ) ) ? 'yes' : 'no'; ?> | |
| 228 | - <br />· WP Memory Limit: <?php echo WP_MEMORY_LIMIT; ?> | |
| 229 | - <br />· Server Memory Limit: <?php echo (int) @ini_get( 'memory_limit' ) . 'M'; // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged ?> | |
| 230 | - <br />· WP_DEBUG: <?php echo WP_DEBUG ? 'true' : 'false'; ?> | |
| 231 | - <br />· WP_POST_REVISIONS: <?php echo is_bool( WP_POST_REVISIONS ) ? ( WP_POST_REVISIONS ? 'true' : 'false' ) : WP_POST_REVISIONS; // @phpstan-ignore-line ?> | |
| 232 | - </p> | |
| 222 | + <ul> | |
| 223 | + <li>Website: <?php echo site_url(); ?></li> | |
| 224 | + <li>Block Theme: <?php echo wp_is_block_theme() ? 'yes' : 'no'; ?></li> | |
| 225 | + <li>TablePress: <?php echo TablePress::version; ?></li> | |
| 226 | + <li>TablePress (DB): <?php echo TablePress::db_version; ?></li> | |
| 227 | + <li>TablePress table scheme: <?php echo TablePress::table_scheme_version; ?></li> | |
| 228 | + <li>Plan: Free</li> | |
| 229 | + <li>Plugin installed: <?php echo wp_date( 'Y/m/d H:i:s', $data['first_activation'] ); ?></li> | |
| 230 | + <li>WordPress: <?php echo wp_get_wp_version(); ?></li> | |
| 231 | + <li>Multisite: <?php echo is_multisite() ? 'yes' : 'no'; ?></li> | |
| 232 | + <li>PHP: <?php echo PHP_VERSION; ?></li> | |
| 233 | + <li>mySQL (Server): <?php echo ( isset( $GLOBALS['wpdb']->dbh ) && 'mysqli' === get_class( $GLOBALS['wpdb']->dbh ) && function_exists( 'mysqli_get_server_info' ) ) ? mysqli_get_server_info( $GLOBALS['wpdb']->dbh ) : 'no mySQL server'; // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info ?></li> | |
| 234 | + <li>mySQL (Client): <?php echo function_exists( 'mysqli_get_client_info' ) ? mysqli_get_client_info() : 'no mySQL client'; // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_client_info ?></li> | |
| 235 | + <li>mbstring: <?php echo extension_loaded( 'mbstring' ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li> | |
| 236 | + <li>ZipArchive: <?php echo class_exists( 'ZipArchive', false ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li> | |
| 237 | + <li>DOMDocument: <?php echo class_exists( 'DOMDocument', false ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li> | |
| 238 | + <li>simplexml_load_string: <?php echo function_exists( 'simplexml_load_string' ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li> | |
| 239 | + <li>libxml_disable_entity_loader: <?php echo function_exists( 'libxml_disable_entity_loader' ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li> | |
| 240 | + <li>UTF-8 conversion: <?php echo ( function_exists( 'mb_detect_encoding' ) && function_exists( 'iconv' ) ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li> | |
| 241 | + <li>WP Memory Limit: <?php echo WP_MEMORY_LIMIT; ?></li> | |
| 242 | + <li>Server Memory Limit: <?php echo esc_html( @ini_get( 'memory_limit' ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged ?></li> | |
| 243 | + <li>WP_DEBUG: <?php echo WP_DEBUG ? 'true' : 'false'; ?></li> | |
| 244 | + <li>WP_POST_REVISIONS: <?php echo is_bool( WP_POST_REVISIONS ) ? ( WP_POST_REVISIONS ? 'true' : 'false' ) : WP_POST_REVISIONS; // @phpstan-ignore constant.notFound, phpstanWP.wpConstant.fetch, phpstanWP.wpConstant.fetch, phpstanWP.wpConstant.fetch (The constant is printed for debugging purposes.) ?></li> | |
| 245 | + </ul> | |
| 233 | 246 | <?php |
| 234 | 247 | } |
| 235 | 248 | |
| 236 | 249 | /** |
| @@ -244,12 +257,14 @@ | ||
| 244 | 257 | public function postbox_credits_thanks( array $data, array $box ): void { |
| 245 | 258 | ?> |
| 246 | 259 | <p> |
| 247 | 260 | <?php _e( 'Special Thanks go to:', 'tablepress' ); ?> |
| 248 | - <br />· <?php printf( __( 'Allan Jardine for <a href="%s">DataTables</a>,', 'tablepress' ), 'https://www.datatables.net/' ); ?> | |
| 249 | - <br />· <?php printf( __( 'the translators in the <a href="%s">Plugin Directory</a>,', 'tablepress' ), 'https://translate.wordpress.org/projects/wp-plugins/tablepress/' ); ?> | |
| 250 | - <br />· <?php _e( 'all customers, donors, contributors, supporters, reviewers, and users of the plugin!', 'tablepress' ); ?> | |
| 251 | 261 | </p> |
| 262 | + <ul> | |
| 263 | + <li><?php printf( __( 'Allan Jardine for <a href="%s">DataTables</a>,', 'tablepress' ), 'https://datatables.net/' ); ?></li> | |
| 264 | + <li><?php printf( __( 'the translators in the <a href="%s">Plugin Directory</a>,', 'tablepress' ), 'https://translate.wordpress.org/projects/wp-plugins/tablepress/' ); ?></li> | |
| 265 | + <li><?php _e( 'all customers, donors, contributors, supporters, reviewers, and users of the plugin!', 'tablepress' ); ?></li> | |
| 266 | + </ul> | |
| 252 | 267 | <?php |
| 253 | 268 | } |
| 254 | 269 | |
| 255 | 270 | } // class TablePress_About_View |