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-preview_table.php +34 -12 1.14 → 3.4 View file →
@@ -7,13 +7,16 @@
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 /**
15 17 * Table Preview View class
18 + *
16 19 * @package TablePress
17 20 * @subpackage Views
18 21 * @author Tobias Bäthge
19 22 * @since 1.0.0
@@ -33,12 +36,15 @@
33 36 * Set up the view with data and do things that are specific for this view.
34 37 *
35 38 * @since 1.0.0
36 39 *
37 - * @param string $action Action for this view.
38 - * @param array $data Data for this view.
40 + * @param string $action Action for this view.
41 + * @param array<string, mixed> $data Data for this view.
39 42 */
40 - public function setup( $action, array $data ) {
43 + #[\Override]
44 + public function setup( /* string */ $action, array $data ) /* : void */ {
45 + // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
46 +
41 47 $this->action = $action;
42 48 $this->data = $data;
43 49 }
44 50
@@ -46,26 +52,42 @@
46 52 * Render the current view.
47 53 *
48 54 * @since 1.0.0
49 55 */
50 - public function render() {
56 + #[\Override]
57 + public function render(): void {
51 58 _wp_admin_html_begin();
52 59 ?>
53 -<title><?php printf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), __( 'Preview', 'tablepress' ), 'TablePress' ); ?></title>
54 -<style type="text/css">
55 -body {
56 - margin-top: -6px !important;
57 -}
58 -</style>
60 + <title>
61 + <?php
62 + /* translators: %1$s: Page title (Preview), %2$s: Plugin name (TablePress) */
63 + printf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), __( 'Preview', 'tablepress' ), 'TablePress' );
64 + ?>
65 + </title>
59 66 <?php echo $this->data['head_html']; ?>
60 67 </head>
61 68 <body>
62 69 <div id="tablepress-page">
63 70 <p>
64 - <?php _e( 'This is a preview of your table.', 'tablepress' ); ?> <?php _e( 'Because of CSS styling in your theme, the table might look different on your page!', 'tablepress' ); ?> <?php _e( 'The features of the DataTables JavaScript library are also not available or visible in this preview!', 'tablepress' ); ?><br />
65 - <?php printf( __( 'To insert the table into a page, post, or text widget, copy the Shortcode %s and paste it into the editor.', 'tablepress' ), '<input type="text" class="table-shortcode table-shortcode-inline" value="' . esc_attr( '[' . TablePress::$shortcode . " id={$this->data['table_id']} /]" ) . '" readonly="readonly" />' ); ?>
71 + <?php _e( 'This is a preview of your table.', 'tablepress' ); ?> <?php _e( 'Because of CSS styling in your theme, the table might look different on your page!', 'tablepress' ); ?> <?php _e( 'The Table Features for Site Visitors, like sorting, filtering, and pagination, are also not available in this preview!', 'tablepress' ); ?><br>
72 + <?php
73 + // Show the instructions string depending on whether the Block Editor is used on the site or not.
74 + if ( 'block' === $this->data['site_used_editor'] ) {
75 + /* translators: %1$s: Block name (TablePress table) */
76 + 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' ) );
77 + } elseif ( 'elementor' === $this->data['site_used_editor'] ) {
78 + /* translators: %1$s: Widget name (TablePress table) */
79 + 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' ) );
80 + } else {
81 + _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' );
82 + echo ' ';
83 + _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' );
84 + }
85 + ?>
66 86 </p>
87 +<div class="preview">
67 88 <?php echo $this->data['body_html']; ?>
89 +</div>
68 90 </div>
69 91 </body>
70 92 </html>
71 93 <?php