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-list.php +59 -25 2.4 → 3.4 View file →
@@ -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 * Object for the All Tables List Table.
26 28 *
27 29 * @since 1.0.0
28 - * @var TablePress_All_Tables_List_Table
29 30 */
30 - protected $wp_list_table;
31 + protected \TablePress_All_Tables_List_Table $wp_list_table;
31 32
32 33 /**
33 34 * Set up the view with data and do things that are specific for this view.
34 35 *
@@ -39,13 +40,15 @@
39 40 */
40 41 #[\Override]
41 42 public function setup( /* string */ $action, array $data ) /* : void */ {
42 43 // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
44 +
43 45 parent::setup( $action, $data );
44 46
45 - add_thickbox(); // For the table preview.
46 - $this->admin_page->enqueue_script( 'list' );
47 + TablePress::enqueue_script( 'list' );
47 48
49 + $milestone_period_ended = ( strtotime( '2026-10-10' ) < strtotime( 'today' ) );
50 +
48 51 if ( $data['messages']['superseded_extensions'] ) {
49 52 $superseded_extensions = array(
50 53 'tablepress-advanced-access-rights/tablepress-advanced-access-rights.php' => array(
51 54 'name' => 'TablePress Extension: Advanced Access Rights',
@@ -86,8 +89,12 @@
86 89 'tablepress-datatables-fixedheader/tablepress-datatables-fixedheader.php' => array(
87 90 'name' => 'TablePress Extension: DataTables FixedHeader',
88 91 'compatible' => true,
89 92 ),
93 + 'tablepress-datatables-inverted-filter/tablepress-datatables-inverted-filter.php' => array(
94 + 'name' => 'TablePress Extension: DataTables Inverted Filter',
95 + 'compatible' => false,
96 + ),
90 97 'tablepress-datatables-row-details/tablepress-datatables-row-details.php' => array(
91 98 'name' => 'TablePress Extension: DataTables Row Details',
92 99 'compatible' => false,
93 100 ),
@@ -141,11 +148,11 @@
141 148
142 149 $notice_css_classes = 'not-dismissible';
143 150
144 151 if ( ! empty( $active_incompatible_superseded_extensions ) ) {
145 - $notice_css_classes .= ' notice-error notice-large';
152 + $notice_css_classes .= ' is-error notice-error';
146 153
147 - $message .= '<p style="font-size:16px;">' . __( 'You are using <strong>TablePress Extension plugins</strong> on this website that have been retired more than 2 years ago.', 'tablepress' ) . '<br>' . __( 'For technical reasons, some or all features of these outdated plugins <strong>will stop working with TablePress 3</strong> later this year:', 'tablepress' ) . '</p>';
154 + $message .= '<p style="font-size:16px;">' . __( 'You are using <strong>TablePress Extension plugins</strong> on this website that have been retired many years ago.', 'tablepress' ) . '<br>' . __( 'For technical reasons, some or all features of these outdated plugins <strong>do no longer work</strong>:', 'tablepress' ) . '</p>';
148 155 $message .= '<ul style="list-style:disc;margin:0.5em 1em;font-size:16px;">';
149 156 foreach ( $active_incompatible_superseded_extensions as $extension ) {
150 157 $message .= '<li>' . esc_html( $extension ) . '</li>';
151 158 }
@@ -154,10 +161,8 @@
154 161
155 162 if ( tb_tp_fs()->is_free_plan() ) {
156 163 $message .= '<p style="font-size:16px;"><strong>' . sprintf( __( 'To continue using these features, <a href="%s">upgrade to a TablePress Premium license plan</a>!', 'tablepress' ), 'https://tablepress.org/upgrade-extensions/?utm_source=plugin&utm_medium=textlink&utm_content=superseded-extensions-message' ) . '</strong><br>'
157 164 . __( 'TablePress Pro and TablePress Max come with updated and heavily improved versions of these features and include direct priority email support.', 'tablepress' ) . '</p>';
158 - } else {
159 - $message .= '<p style="font-size:16px;"><strong>' . sprintf( __( 'To continue using these features, please deactivate the listed Extensions on the <a href="%1$s">“Plugins” screen</a> and activate the corresponding feature module of your TablePress Premium license on the <a href="%2$s">“Modules” screen</a>.', 'tablepress' ), esc_url( admin_url( 'plugins.php' ) ), esc_url( TablePress::url( array( 'action' => 'modules' ) ) ) ) . '</strong></p>';
160 165 }
161 166
162 167 if ( ! empty( $active_compatible_superseded_extensions ) && tb_tp_fs()->is_free_plan() ) {
163 168 $message .= '<p style="margin-top:1em;font-size:14px;">' . __( 'In addition, these TablePress Extension plugins have been retired and might become incompatible in the future as well:', 'tablepress' ) . '</strong></p>';
@@ -167,9 +172,9 @@
167 172 }
168 173 $message .= '</ul>';
169 174 }
170 175 } elseif ( ! empty( $active_compatible_superseded_extensions ) && tb_tp_fs()->is_free_plan() ) {
171 - $notice_css_classes .= ' notice-warning notice-alt';
176 + $notice_css_classes .= ' is-warning notice-warning';
172 177
173 178 $message .= '<p style="font-size:14px;"><strong>' . __( 'You are using TablePress Extension plugins on this website that have been retired and will no longer receive updates or support:', 'tablepress' ) . '</strong></p>';
174 179 $message .= '<ul style="list-style:disc;margin:0.5em 1em;">';
175 180 foreach ( $active_compatible_superseded_extensions as $extension ) {
@@ -188,12 +193,10 @@
188 193 $message .= '<li>' . __( 'Direct integration into the user interface!', 'tablepress' ) . '</li>';
189 194 $message .= '<li>' . __( 'Regular updates that ensure compatibility with WordPress!', 'tablepress' ) . '</li>';
190 195 $message .= '<li>' . __( 'Priority email support!', 'tablepress' ) . '</li>';
191 196 $message .= '</ul>';
192 - $message .= '<p style="font-size:16px;"><strong>' . sprintf( __( 'And the best: %s', 'tablepress' ), sprintf( __( 'Use the promo code %1$s during the checkout process and save %2$s now!', 'tablepress' ), '<code>THANKYOU30</code>', '30%' ) ) . '</strong></p>';
193 - $message .= '<p style="margin-top:2em;">' . sprintf( '<a href="%s" class="button button-primary" style="font-size:14px;margin-right:3em;background:linear-gradient(135deg,#00d184 0%%,#0791e3 100%%);border:none;font-weight:bold;">%s<span class="dashicons dashicons-arrow-right-alt" style="vertical-align:middle;margin:0 0 4px 4px"></span></a>', 'https://tablepress.org/upgrade-extensions/?utm_source=plugin&utm_medium=button&utm_content=superseded-extensions-message', __( 'Upgrade to a TablePress Premium version now!', 'tablepress' ) );
194 - } else {
195 - $message .= '<p style="margin-top:2em;">';
197 + $message .= '<p style="font-size:16px;"><strong>' . sprintf( __( 'And the best: %s', 'tablepress' ), sprintf( __( 'Use the promo code %1$s during the checkout process for a special offer!', 'tablepress' ), '<code>UPGRADE</code>' ) ) . '</strong></p>';
198 + $message .= '<p style="margin-top:2em;">' . sprintf( '<a href="%s" class="components-button is-primary" style="font-size:14px;margin-right:3em;background:linear-gradient(135deg,#00d184 0%%,#0791e3 100%%);border:none;font-weight:bold;">%s<span class="dashicons dashicons-arrow-right-alt" style="vertical-align:middle;margin:0 0 4px 4px"></span></a>', 'https://tablepress.org/upgrade-extensions/?utm_source=plugin&utm_medium=button&utm_content=superseded-extensions-message', __( 'Upgrade to a TablePress Premium version now!', 'tablepress' ) );
196 199 }
197 200 $message .= $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'superseded_extensions', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '</p>';
198 201
199 202 $title = '<em>' . __( 'Important Notice!', 'tablepress' ) . '</em>';
@@ -201,10 +204,11 @@
201 204 $this->add_header_message( $message, $notice_css_classes, $title );
202 205 }
203 206 }
204 207
205 - if ( $data['messages']['first_visit'] ) {
208 + if ( $data['messages']['first_visit'] && ( ! $data['messages']['plugin_update'] || $milestone_period_ended ) ) {
206 209 $message = '<p style="font-size:14px;"><strong>' . __( 'Thank you for choosing TablePress, the most popular table plugin for WordPress!', 'tablepress' ) . '</strong></p>';
210 + /* translators: %1$s: URL to FAQ, %2$s: URL to Documentation, %3$s: URL to Support, %4$s: URL to plugin website */
207 211 $message .= '<p>' . sprintf( __( 'If you encounter any questions or problems, please visit the <a href="%1$s">FAQ</a>, the <a href="%2$s">Documentation</a>, and the <a href="%3$s">Support</a> section on the <a href="%4$s">plugin website</a>.', 'tablepress' ), 'https://tablepress.org/faq/', 'https://tablepress.org/documentation/', 'https://tablepress.org/support/', 'https://tablepress.org/' ) . '</p>';
208 212
209 213 if ( tb_tp_fs()->is_free_plan() ) {
210 214 $message .= '<p style="font-size:14px;"><strong>' . sprintf( __( 'More great features for you and your site’s visitors and priority email support are available with a Premium license plan of TablePress. <a href="%s">Go check them out!</a>', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=first-visit-message' ) . '</strong></p>';
@@ -216,15 +220,17 @@
216 220
217 221 $this->add_header_message( $message, 'notice-info not-dismissible', $title );
218 222 }
219 223
220 - if ( $data['messages']['donation_nag'] ) {
221 - $message = '<p style="font-size:14px;"><img alt="' . esc_attr__( 'Tobias Bäthge, developer of TablePress', 'tablepress' ) . '" src="https://secure.gravatar.com/avatar/50f1cff2e27a1f522b18ce229c057bc5?s=300" height="150" width="150" style="float:left;margin:2px 15px 30px 0;">'
224 + if ( $data['messages']['donation_nag'] && ( ! $data['messages']['plugin_update'] || $milestone_period_ended ) ) {
225 + $message = '<p style="font-size:14px;"><img alt="' . esc_attr__( 'Tobias Bäthge, developer of TablePress', 'tablepress' ) . '" src="https://secure.gravatar.com/avatar/50f1cff2e27a1f522b18ce229c057bc5?s=250" height="125" width="125" style="float:left;margin:2px 15px 30px 0;border-radius:5px;">'
222 226 . __( 'Hi, my name is Tobias, I&#8217;m the developer of the TablePress plugin.', 'tablepress' ) . '</p>';
223 227 $message .= '<p style="font-size:14px;">' . __( 'Thank you for using it!', 'tablepress' ) . ' ';
224 228 if ( $data['table_count'] > 0 ) {
229 + /* translators: %s: Number of tables */
225 230 $message .= sprintf( _n( 'I hope that everything works and that you are satisfied with the results of managing your %s table.', 'I hope that everything works and that you are satisfied with the results of managing your %s tables.', $data['table_count'], 'tablepress' ), $data['table_count'] );
226 231 } else {
232 + /* translators: %s: URL to TablePress website */
227 233 $message .= sprintf( __( 'It looks like you haven’t added a table yet. If you need help to get started, please find more information in the FAQ and Documentation on the <a href="%s">TablePress website</a>.', 'tablepress' ), 'https://tablepress.org/' );
228 234 }
229 235 $message .= '</p>';
230 236 $message .= '<p style="font-size:14px;"><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=upgrade-message' ) . '<br>'
@@ -229,9 +235,9 @@
229 235 $message .= '</p>';
230 236 $message .= '<p style="font-size:14px;"><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=upgrade-message' ) . '<br>'
231 237 . __( 'The available Pro and Max plans offer user support and many exciting and helpful features for your tables.', 'tablepress' ) . '</strong></p>';
232 238 $message .= '<p style="font-size:14px;">' . __( 'Sincerely, Tobias', 'tablepress' ) . '</p>';
233 - $message .= '<p style="margin-top:1em;">' . sprintf( '<a href="%s" class="button button-primary" style="font-size:14px;margin-right:3em;">%s<span class="dashicons dashicons-arrow-right-alt" style="vertical-align:middle;margin:0 0 4px 4px"></span></a>', 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=button&utm_content=upgrade-message', __( 'Tell me more about the Premium features', 'tablepress' ) )
239 + $message .= '<p style="margin-top:1em;">' . sprintf( '<a href="%s" class="components-button is-primary" style="font-size:14px;margin-right:3em;color:#ffffff;">%s<span class="dashicons dashicons-arrow-right-alt" style="margin-inline:8px 0"></span></a>', 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=button&utm_content=upgrade-message', __( 'Tell me more about the Premium features', 'tablepress' ) )
234 240 . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '</p>';
235 241
236 242 $title = '<em>' . __( 'TablePress has more to offer!', 'tablepress' ) . '</em>';
237 243
@@ -238,19 +244,37 @@
238 244 $this->add_header_message( $message, 'notice-success not-dismissible', $title );
239 245 }
240 246
241 247 if ( $data['messages']['plugin_update'] ) {
242 - $message = '<p>' . sprintf( __( 'To find out more about what’s new, please read the <a href="%s"><strong>release announcement</strong></a>.', 'tablepress' ), 'https://tablepress.org/news/?utm_source=plugin&utm_medium=textlink&utm_content=plugin-update-message' ) . '</p>';
248 + if ( $milestone_period_ended ) {
249 + $message = '<p>' . sprintf( __( 'To find out more about what’s new, please read the <a href="%s"><strong>release announcement</strong></a>.', 'tablepress' ), 'https://tablepress.org/news/?utm_source=plugin&utm_medium=textlink&utm_content=plugin-update-message' ) . '</p>';
243 250
244 - if ( tb_tp_fs()->is_free_plan() ) {
245 - $message .= '<p><strong>' . sprintf( __( 'More great features and priority email support are available with a Premium license plan. <a href="%s">Check them out!</a>', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=plugin-update-message' ) . '</strong></p>';
251 + if ( tb_tp_fs()->is_free_plan() ) {
252 + $message .= '<p><strong>' . sprintf( __( 'More great features and priority email support are available with a Premium license plan. <a href="%s">Check them out!</a>', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=plugin-update-message' ) . '</strong></p>';
253 + }
254 +
255 + $title = '<em>' . sprintf( __( 'Thank you for updating to TablePress %s!', 'tablepress' ), TablePress::version ) . '</em>';
256 + $class = 'notice-info not-dismissible';
257 + } else {
258 + $texts_german = in_array( get_user_locale(), array( 'de_DE', 'de_AT', 'de_CH' ), true );
259 + if ( $texts_german ) {
260 + $message = '<p style="font-size:16px;">Wir feiern <strong>25 Millionen Downloads</strong> von TablePress aus dem WordPress-Pluginverzeichnis!<br>Mach mit und <strong>spare 25&#8239;%</strong> beim Upgrade auf TablePress Pro oder TablePress Max!</p>';
261 + } else {
262 + $message = '<p style="font-size:16px;">We’re celebrating <strong>25 million downloads</strong> of TablePress from the WordPress Plugin Directory!<br>Join us and <strong>get 25% off</strong> your TablePress Pro or TablePress Max upgrade!</p>';
263 + }
264 + $url = 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=notice&utm_campaign=upgrade-message340&utm_content=button';
265 + $message .= '<p style="margin-top:1em;margin-bottom:24px;">' . sprintf( '<a href="%s" class="components-button is-primary" target="_blank"><span>%s</span><span class="dashicons dashicons-arrow-right-alt" style="margin-inline:8px 0"></span></a>', $url, $texts_german ? 'Spare jetzt 25&#8239;%' : 'Get 25% off now' ) . '</p>';
266 +
267 + $filename = $texts_german ? 'admin/img/dl-25-period.svg' : 'admin/img/dl-25-comma.svg';
268 + $message .= sprintf( '<img src="%1$s" alt="%2$s">', plugins_url( $filename, TABLEPRESS__FILE__ ), $texts_german ? 'Grafik mit einer Tabelle mit „Downloads“ in der Kopfzeile und der Zahl 25.000.000 im Tabellenkörper' : 'Graphic with a table with “Downloads” in the header and the number 25,000,000 in the body' );
269 +
270 + $title = '';
271 + $class = 'notice-milestone not-dismissible';
246 272 }
247 273
248 274 $message .= '<p style="margin-top:1em;">' . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'plugin_update', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '</p>';
249 275
250 - $title = '<em>' . sprintf( __( 'Thank you for updating to TablePress %s!', 'tablepress' ), TablePress::version ) . '</em>';
251 -
252 - $this->add_header_message( $message, 'notice-info not-dismissible', $title );
276 + $this->add_header_message( $message, $class, $title );
253 277 }
254 278
255 279 $this->process_action_messages( array(
256 280 'success_delete' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress' ),
@@ -255,9 +279,15 @@
255 279 $this->process_action_messages( array(
256 280 'success_delete' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress' ),
257 281 'success_delete_plural' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 2, 'tablepress' ),
258 282 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
259 - 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ( ( false !== $data['table_id'] ) ? ' ' . sprintf( __( 'The copied table has the table ID &#8220;%s&#8221;.', 'tablepress' ), esc_html( $data['table_id'] ) ) : '' ),
283 + 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' )
284 + . ( ( false !== $data['table_id'] )
285 + ? ' ' . ( current_user_can( 'tablepress_edit_table', $data['table_id'] )
286 + ? sprintf( __( 'You can now <a href="%1$s">edit the copied table</a>, which has the table ID “%2$s”.', 'tablepress' ), esc_url( TablePress::url( array( 'action' => 'edit', 'table_id' => $data['table_id'] ) ) ), esc_html( $data['table_id'] ) )
287 + : sprintf( __( 'The copied table has the table ID &#8220;%s&#8221;.', 'tablepress' ), esc_html( $data['table_id'] ) ) )
288 + : ''
289 + ),
260 290 'success_copy_plural' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 2, 'tablepress' ),
261 291 'error_copy' => __( 'Error: The table could not be copied.', 'tablepress' ),
262 292 'error_no_table' => __( 'Error: You did not specify a valid table ID.', 'tablepress' ),
263 293 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ),
@@ -293,8 +323,9 @@
293 323 $this->print_nav_tab_menu();
294 324 ?>
295 325 <div id="tablepress-body">
296 326 <hr class="wp-header-end">
327 + <script>document.querySelectorAll('.notice:has(~#tablepress-page)').forEach(e=>document.querySelector('.wp-header-end').after(e));</script>
297 328 <?php
298 329 // Print all header messages.
299 330 foreach ( $this->header_messages as $message ) {
300 331 echo $message;
@@ -344,10 +375,12 @@
344 375 echo '<p>';
345 376 _e( 'This is a list of your tables.', 'tablepress' );
346 377 echo ' ';
347 378 // Show the instructions string depending on whether the Block Editor is used on the site or not.
348 - if ( $data['site_uses_block_editor'] ) {
379 + if ( 'block' === $data['site_used_editor'] ) {
349 380 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' ) );
381 + } elseif ( 'elementor' === $data['site_used_editor'] ) {
382 + 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' ) );
350 383 } else {
351 384 _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' );
352 385 echo ' ';
353 386 _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' );
@@ -382,8 +415,9 @@
382 415 $this->do_text_boxes( 'header' );
383 416 $this->wp_list_table->display();
384 417 ?>
385 418 </form>
419 +<div id="tablepress-list-screen"></div>
386 420 <?php
387 421 }
388 422
389 423 /**