PluginProbe
TablePress – Tables in WordPress made easy / 3.3.1
TablePress – Tables in WordPress made easy v3.3.1
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 2.4.4 All 44 releases
tablepress / views / view-preview_table.php

view-preview_table.php in TablePress – Tables in WordPress made easy 3.3.1, at views/view-preview_table.php

95 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Table Preview View
4 *
5 * @package TablePress
6 * @subpackage Views
7 * @author Tobias Bäthge
8 * @since 1.0.0
9 */
10
11 // Prohibit direct script loading.
12 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
13
14 /**
15 * Table Preview View class
16 *
17 * @package TablePress
18 * @subpackage Views
19 * @author Tobias Bäthge
20 * @since 1.0.0
21 */
22 class TablePress_Preview_Table_View extends TablePress_View {
23
24 /**
25 * Initialize the View class.
26 *
27 * @since 1.0.0
28 */
29 public function __construct() {
30 // Intentionally left empty, to void code from parent::__construct().
31 }
32
33 /**
34 * Set up the view with data and do things that are specific for this view.
35 *
36 * @since 1.0.0
37 *
38 * @param string $action Action for this view.
39 * @param array<string, mixed> $data Data for this view.
40 */
41 #[\Override]
42 public function setup( /* string */ $action, array $data ) /* : void */ {
43 // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
44
45 $this->action = $action;
46 $this->data = $data;
47 }
48
49 /**
50 * Render the current view.
51 *
52 * @since 1.0.0
53 */
54 #[\Override]
55 public function render(): void {
56 _wp_admin_html_begin();
57 ?>
58 <title>
59 <?php
60 /* translators: %1$s: Page title (Preview), %2$s: Plugin name (TablePress) */
61 printf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), __( 'Preview', 'tablepress' ), 'TablePress' );
62 ?>
63 </title>
64 <?php echo $this->data['head_html']; ?>
65 </head>
66 <body>
67 <div id="tablepress-page">
68 <p>
69 <?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>
70 <?php
71 // Show the instructions string depending on whether the Block Editor is used on the site or not.
72 if ( 'block' === $this->data['site_used_editor'] ) {
73 /* translators: %1$s: Block name (TablePress table) */
74 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' ) );
75 } elseif ( 'elementor' === $this->data['site_used_editor'] ) {
76 /* translators: %1$s: Widget name (TablePress table) */
77 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' ) );
78 } else {
79 _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' );
80 echo ' ';
81 _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' );
82 }
83 ?>
84 </p>
85 <div class="preview">
86 <?php echo $this->data['body_html']; ?>
87 </div>
88 </div>
89 </body>
90 </html>
91 <?php
92 }
93
94 } // class TablePress_Preview_Table_View
95