Plugin Directory

source: tablepress/trunk/views/view-about.php

Last change on this file was 3350024, checked in by TobiasBg, 7 months ago

Update to version 3.2 from GitHub

File size: 13.4 KB
Line 
1<?php
2/**
3 * About TablePress 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.
12defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
13
14/**
15 * About TablePress View class
16 *
17 * @package TablePress
18 * @subpackage Views
19 * @author Tobias Bäthge
20 * @since 1.0.0
21 */
22class TablePress_About_View extends TablePress_View {
23
24        /**
25         * Number of screen columns for post boxes on this screen.
26         *
27         * @since 1.0.0
28         */
29        protected int $screen_columns = 2;
30
31        /**
32         * Set up the view with data and do things that are specific for this view.
33         *
34         * @since 1.0.0
35         *
36         * @param string               $action Action for this view.
37         * @param array<string, mixed> $data   Data for this view.
38         */
39        #[\Override]
40        public function setup( /* string */ $action, array $data ) /* : void */ {
41                // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
42
43                parent::setup( $action, $data );
44
45                $this->add_text_box( 'spacer', array( $this, 'textbox_spacer' ), 'normal' );
46                $this->add_text_box( 'spacer', array( $this, 'textbox_spacer' ), 'side' );
47                $this->add_meta_box( 'plugin-purpose', __( 'Plugin Purpose', 'tablepress' ), array( $this, 'postbox_plugin_purpose' ), 'normal' );
48                $this->add_meta_box( 'usage', __( 'Usage', 'tablepress' ), array( $this, 'postbox_usage' ), 'normal' );
49                $this->add_meta_box( 'more-information', __( 'More Information and Documentation', 'tablepress' ), array( $this, 'postbox_more_information' ), 'normal' );
50                $this->add_meta_box( 'help-support', __( 'Help and Support', 'tablepress' ), array( $this, 'postbox_help_support' ), 'normal' );
51                $this->add_meta_box( 'author-license', __( 'Author and License', 'tablepress' ), array( $this, 'postbox_author_license' ), 'side' );
52                $this->add_meta_box( 'credits-thanks', __( 'Credits and Thanks', 'tablepress' ), array( $this, 'postbox_credits_thanks' ), 'side' );
53                $this->add_meta_box( 'debug-version-information', __( 'Debug and Version Information', 'tablepress' ), array( $this, 'postbox_debug_version_information' ), 'side' );
54        }
55
56        /**
57         * Prints the screen head spacer.
58         *
59         * @since 2.0.0
60         *
61         * @param array<string, mixed> $data Data for this screen.
62         * @param array<string, mixed> $box  Information about the text box.
63         */
64        public function textbox_spacer( array $data, array $box ): void {
65                echo '<p></p>';
66        }
67
68        /**
69         * Print the content of the "Plugin Purpose" post meta box.
70         *
71         * @since 1.0.0
72         *
73         * @param array<string, mixed> $data Data for this screen.
74         * @param array<string, mixed> $box  Information about the meta box.
75         */
76        public function postbox_plugin_purpose( array $data, array $box ): void {
77                ?>
78        <p>
79                <?php _e( 'TablePress allows you to create and manage tables in the admin area of WordPress.', 'tablepress' ); ?>
80                <?php _e( 'Tables may contain text, numbers, formulas, and even HTML code (e.g. to include images or links).', 'tablepress' ); ?>
81                <?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' ); ?>
82        </p>
83                <?php
84        }
85
86        /**
87         * Print the content of the "Usage" post meta box.
88         *
89         * @since 1.0.0
90         *
91         * @param array<string, mixed> $data Data for this screen.
92         * @param array<string, mixed> $box  Information about the meta box.
93         */
94        public function postbox_usage( array $data, array $box ): void {
95                ?>
96        <p>
97                <?php _e( 'At first, you should add or import a table.', 'tablepress' ); ?>
98                <?php _e( 'This means that you either let the plugin create an empty table for you or that you load an existing table from either a CSV, HTML, JSON, XLS, or XLSX file.', 'tablepress' ); ?>
99        </p>
100        <p>
101                <?php _e( 'Then, you can edit your data or change the structure of your table (e.g. by inserting, deleting, moving, or swapping rows or columns or sorting them) and select specific table features like alternating row colors or whether to print the name or description, if you want.', 'tablepress' ); ?>
102                <?php _e( 'To easily add a link or an image to a cell, use the provided buttons.', 'tablepress' ); ?>
103                <?php _e( 'Those will ask you for the necessary information and corresponding HTML code will be added to the cell automatically.', 'tablepress' ); ?>
104        </p>
105        <p>
106                <?php
107                // Show the instructions string depending on whether the Block Editor is used on the site or not.
108                if ( 'block' === $data['site_used_editor'] ) {
109                        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' ) );
110                } elseif ( 'elementor' === $data['site_used_editor'] ) {
111                        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' ) );
112                } else {
113                        _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' );
114                        echo ' ';
115                        _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' );
116                }
117                ?>
118        </p>
119        <p>
120                <?php _e( 'Tables can be styled by changing and adding CSS commands.', 'tablepress' ); ?>
121                <?php _e( 'The plugin ships with default CSS stylesheets, which can be customized with own code or replaced with other stylesheets.', 'tablepress' ); ?>
122                <?php _e( 'For this, each table is given certain CSS classes that can be used as CSS selectors.', 'tablepress' ); ?>
123                <?php printf( __( 'Please see the <a href="%s">Documentation</a> for a list of these selectors and for styling examples.', 'tablepress' ), 'https://tablepress.org/documentation/' ); ?>
124        </p>
125                <?php
126        }
127
128        /**
129         * Print the content of the "More Information and Documentation" post meta box.
130         *
131         * @since 1.0.0
132         *
133         * @param array<string, mixed> $data Data for this screen.
134         * @param array<string, mixed> $box  Information about the meta box.
135         */
136        public function postbox_more_information( array $data, array $box ): void {
137                ?>
138        <p>
139                <?php printf( __( 'More information about TablePress can be found on the <a href="%1$s">plugin website</a> or on its page in the <a href="%2$s">WordPress Plugin Directory</a>.', 'tablepress' ), 'https://tablepress.org/', 'https://wordpress.org/plugins/tablepress/' ); ?>
140                <?php printf( __( 'For technical information, please see the <a href="%s">Documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' ); ?>
141                <?php printf( __( 'Common questions are answered in the <a href="%s">FAQ</a>.', 'tablepress' ), 'https://tablepress.org/faq/' ); ?>
142        </p>
143                <?php
144        }
145
146        /**
147         * Print the content of the "Author and License" post meta box.
148         *
149         * @since 1.0.0
150         *
151         * @param array<string, mixed> $data Data for this screen.
152         * @param array<string, mixed> $box  Information about the meta box.
153         */
154        public function postbox_author_license( array $data, array $box ): void {
155                ?>
156        <p>
157                <?php
158                /* translators: %s: Author's website URL */
159                printf( __( 'This plugin was written and developed by <a href="%s">Tobias Bäthge</a>.', 'tablepress' ), 'https://tobias.baethge.com/' );
160                ?>
161                <?php _e( 'It is licensed as Free Software under GNU General Public License 2 (GPL 2).', 'tablepress' ); ?>
162        </p>
163        <p>
164                <?php
165                /* translators: %s: WordPress Plugin Directory URL */
166                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' );
167                ?>
168        </p>
169                <?php
170                if ( tb_tp_fs()->is_free_plan() ) {
171                        /* translators: %s: TablePress Premium website URL */
172                        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' ) . ' '
173                        . __( 'The available Pro and Max plans offer user support and many exciting and helpful features for your tables.', 'tablepress' ) . '</strong></p>';
174                }
175                ?>
176                <?php
177        }
178
179        /**
180         * Print the content of the "Help and Support" post meta box.
181         *
182         * @since 1.0.0
183         *
184         * @param array<string, mixed> $data Data for this screen.
185         * @param array<string, mixed> $box  Information about the meta box.
186         */
187        public function postbox_help_support( array $data, array $box ): void {
188                if ( tb_tp_fs()->is_free_plan() ) {
189                        ?>
190                <h4><?php _e( 'Premium Support', 'tablepress' ); ?></h4>
191                <p>
192                        <?php _e( 'Users with a valid TablePress Premium license plan are eligible for Priority Email Support, directly from the plugin developer!', 'tablepress' ); ?>
193                        <strong><?php printf( __( '<a href="%s">Find out more!</a>', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=about-screen' ); ?></strong>
194                </p>
195                <h4><?php _e( 'Community Support for users of the Free version', 'tablepress' ); ?></h4>
196                <p>
197                        <?php printf( __( '<a href="%1$s">Support</a> is provided through the <a href="%2$s">WordPress Support Forums</a>.', 'tablepress' ), 'https://tablepress.org/support/', 'https://wordpress.org/support/plugin/tablepress' ); ?>
198                        <?php printf( __( 'Before asking for support, please carefully read the <a href="%s">Frequently Asked Questions</a>, where you will find answers to the most common questions, and search through the forums.', 'tablepress' ), 'https://tablepress.org/faq/' ); ?>
199                        <?php printf( __( 'If you do not find an answer there, please <a href="%s">open a new thread</a> in the WordPress Support Forums.', 'tablepress' ), 'https://wordpress.org/support/plugin/tablepress' ); ?>
200                </p>
201                        <?php
202                }
203        }
204
205        /**
206         * Print the content of the "Debug and Version Information" post meta box.
207         *
208         * @since 1.0.0
209         *
210         * @param array<string, mixed> $data Data for this screen.
211         * @param array<string, mixed> $box  Information about the meta box.
212         */
213        public function postbox_debug_version_information( array $data, array $box ): void {
214                ?>
215                <p>
216                        <strong><?php _e( 'Please provide this information in bug reports and support requests.', 'tablepress' ); ?></strong>
217                </p>
218                <ul>
219                        <li>Website: <?php echo site_url(); ?></li>
220                        <li>Block Theme: <?php echo wp_is_block_theme() ? 'yes' : 'no'; ?></li>
221                        <li>TablePress: <?php echo TablePress::version; ?></li>
222                        <li>TablePress (DB): <?php echo TablePress::db_version; ?></li>
223                        <li>TablePress table scheme: <?php echo TablePress::table_scheme_version; ?></li>
224                        <li>Plan: Free</li>
225                        <li>Plugin installed: <?php echo wp_date( 'Y/m/d H:i:s', $data['first_activation'] ); ?></li>
226                        <li>WordPress: <?php echo $GLOBALS['wp_version']; ?></li>
227                        <li>Multisite: <?php echo is_multisite() ? 'yes' : 'no'; ?></li>
228                        <li>PHP: <?php echo PHP_VERSION; ?></li>
229                        <li>mySQL (Server): <?php echo ( isset( $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>
230                        <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>
231                        <li>mbstring: <?php echo extension_loaded( 'mbstring' ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li>
232                        <li>ZipArchive: <?php echo class_exists( 'ZipArchive', false ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li>
233                        <li>DOMDocument: <?php echo class_exists( 'DOMDocument', false ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li>
234                        <li>simplexml_load_string: <?php echo function_exists( 'simplexml_load_string' ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li>
235                        <li>libxml_disable_entity_loader: <?php echo function_exists( 'libxml_disable_entity_loader' ) ? 'yes' : '<span style="color:#800000;font-weight:bold;">no</span>'; ?></li>
236                        <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>
237                        <li>WP Memory Limit: <?php echo WP_MEMORY_LIMIT; ?></li>
238                        <li>Server Memory Limit: <?php echo esc_html( @ini_get( 'memory_limit' ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged ?></li>
239                        <li>WP_DEBUG: <?php echo WP_DEBUG ? 'true' : 'false'; ?></li>
240                        <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>
241                </ul>
242                <?php
243        }
244
245        /**
246         * Print the content of the "Credits and Thanks" post meta box.
247         *
248         * @since 1.0.0
249         *
250         * @param array<string, mixed> $data Data for this screen.
251         * @param array<string, mixed> $box  Information about the meta box.
252         */
253        public function postbox_credits_thanks( array $data, array $box ): void {
254                ?>
255                <p>
256                        <?php _e( 'Special Thanks go to:', 'tablepress' ); ?>
257                </p>
258                <ul>
259                        <li><?php printf( __( 'Allan Jardine for <a href="%s">DataTables</a>,', 'tablepress' ), 'https://datatables.net/' ); ?></li>
260                        <li><?php printf( __( 'the translators in the <a href="%s">Plugin Directory</a>,', 'tablepress' ), 'https://translate.wordpress.org/projects/wp-plugins/tablepress/' ); ?></li>
261                        <li><?php _e( 'all customers, donors, contributors, supporters, reviewers, and users of the plugin!', 'tablepress' ); ?></li>
262                </ul>
263                <?php
264        }
265
266} // class TablePress_About_View
Note: See TracBrowser for help on using the repository browser.