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 | classes/class-view.php +34 -16 3.3.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 /**
@@ -96,9 +98,9 @@
96 98 $common_content .= sprintf( __( 'Common questions are answered in the <a href="%s">FAQ</a>.', 'tablepress' ), 'https://tablepress.org/faq/' ) . '</p>';
97 99
98 100 if ( tb_tp_fs()->is_free_plan() ) {
99 101 $common_content .= '<p>'
100 - . sprintf( __( '<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' )
102 + . sprintf( __( '<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/' )
101 103 . ' '
102 104 . sprintf( __( '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/' )
103 105 . '</p>';
104 106 $common_content .= '<p><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=help-tab' ) . '</strong></p>';
@@ -123,19 +125,23 @@
123 125 * Changes the value of the user option "screen_layout_{$screen->id}" through a filter.
124 126 *
125 127 * @since 1.0.0
126 128 *
127 - * @param int|false $result Current value of the user option.
129 + * @param string|int|false $result Current value of the user option.
128 130 * @return int New value for the user option.
129 131 */
130 - public function set_current_screen_layout_columns( /* int|false */ $result ): int {
132 + public function set_current_screen_layout_columns( /* string|int|false */ $result ): int {
131 133 if ( false === $result ) {
132 134 // The user option does not yet exist.
133 - $result = $this->screen_columns;
134 - } elseif ( $result > $this->screen_columns ) {
135 + return $this->screen_columns;
136 + }
137 +
138 + $result = (int) $result;
139 + if ( $result > $this->screen_columns ) {
135 140 // The value of the user option is bigger than what is possible on this screen (e.g. because the number of columns was reduced in an update).
136 141 $result = $this->screen_columns;
137 142 }
143 +
138 144 return $result;
139 145 }
140 146
141 147 /**
@@ -180,9 +186,9 @@
180 186 * @param string $text Text for the header message.
181 187 * @param string $css_class Optional. Additional CSS class for the header message.
182 188 * @param string $title Optional. Text for the header title.
183 189 */
184 - protected function add_header_message( string $text, string $css_class = 'is-success', string $title = '' ): void {
190 + protected function add_header_message( string $text, string $css_class = 'is-success notice-success', string $title = '' ): void {
185 191 if ( ! str_contains( $css_class, 'not-dismissible' ) ) {
186 192 $css_class .= ' is-dismissible';
187 193 }
188 194 if ( '' !== $title ) {
@@ -203,9 +209,9 @@
203 209 * @param array<string, string> $action_messages Action messages for the screen.
204 210 */
205 211 protected function process_action_messages( array $action_messages ): void {
206 212 if ( $this->data['message'] && isset( $action_messages[ $this->data['message'] ] ) ) {
207 - $class = ( str_starts_with( $this->data['message'], 'error' ) ) ? 'is-error' : 'is-success';
213 + $class = ( str_starts_with( $this->data['message'], 'error' ) ) ? 'is-error notice-error' : 'is-success notice-success';
208 214
209 215 if ( '' !== $this->data['error_details'] ) {
210 216 $this->data['error_details'] = '</p><p>' . sprintf( __( 'Error code: %s', 'tablepress' ), '<code>' . esc_html( $this->data['error_details'] ) . '</code>' );
211 217 }
@@ -348,8 +354,9 @@
348 354 $this->print_nav_tab_menu();
349 355 ?>
350 356 <div id="tablepress-body">
351 357 <hr class="wp-header-end">
358 + <script>document.querySelectorAll('.notice:has(~#tablepress-page)').forEach(e=>document.querySelector('.wp-header-end').after(e));</script>
352 359 <?php
353 360 // Print all header messages.
354 361 foreach ( $this->header_messages as $message ) {
355 362 echo $message;
@@ -397,8 +404,9 @@
397 404 *
398 405 * @since 1.0.0
399 406 */
400 407 protected function print_nav_tab_menu(): void {
408 + $milestone_period_ended = ( strtotime( '2026-10-10' ) < strtotime( 'today' ) );
401 409 $name = __( 'TablePress', 'tablepress' );
402 410 $filename = 'admin/img/tablepress.svg';
403 411 ?>
404 412 <div id="tablepress-header" class="header">
@@ -405,15 +413,25 @@
405 413 <h1 class="name">
406 414 <img src="<?php echo plugins_url( $filename, TABLEPRESS__FILE__ ); ?>" alt="<?php esc_attr_e( 'TablePress plugin logo', 'tablepress' ); ?>">
407 415 <span class="screen-reader-text"><?php echo $name; ?></span>
408 416 </h1>
409 - <?php if ( ! TABLEPRESS_IS_PLAYGROUND_PREVIEW && tb_tp_fs()->is_free_plan() ) : ?>
410 - <div class="buttons">
411 - <a href="<?php echo esc_url( tb_tp_fs()->pricing_url( WP_FS__PERIOD_ANNUALLY, false ) ); ?>" class="tablepress-button">
412 - <span><?php _e( 'Upgrade to Premium', 'tablepress' ); ?></span>
413 - <span class="dashicons dashicons-arrow-right-alt"></span>
414 - </a>
415 - </div>
417 + <?php if ( 'list' !== $this->action || ! $this->data['messages']['plugin_update'] || $milestone_period_ended ) : ?>
418 + <?php if ( ! TABLEPRESS_IS_PLAYGROUND_PREVIEW && tb_tp_fs()->is_free_plan() ) : ?>
419 + <div class="buttons">
420 + <a href="<?php echo $milestone_period_ended ? esc_url( tb_tp_fs()->pricing_url( WP_FS__PERIOD_ANNUALLY, false ) ) : 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=header&utm_campaign=upgrade-message340&utm_content=button'; ?>" class="tablepress-button">
421 + <span>
422 + <?php
423 + if ( $milestone_period_ended ) {
424 + _e( 'Upgrade to Premium', 'tablepress' );
425 + } else {
426 + echo in_array( get_user_locale(), array( 'de_DE', 'de_AT', 'de_CH' ), true ) ? 'Premium: Spare jetzt 25&#8239;%' : 'Premium: Get 25% off now';
427 + }
428 + ?>
429 + </span>
430 + <span class="dashicons dashicons-arrow-right-alt"></span>
431 + </a>
432 + </div>
433 + <?php endif; ?>
416 434 <?php endif; ?>
417 435 </div>
418 436 <nav id="tablepress-nav">
419 437 <ul class="nav-menu">
@@ -446,9 +464,9 @@
446 464 * @param array<string, mixed> $box Information about the text box.
447 465 */
448 466 public function textbox_no_javascript( array $data, array $box ): void {
449 467 ?>
450 - <div class="notice components-notice is-error hide-if-js">
468 + <div class="notice components-notice is-error notice-error hide-if-js">
451 469 <div class="components-notice__content">
452 470 <h3><em>
453 471 <?php _e( 'Attention: Unfortunately, there is a problem!', 'tablepress' ); ?>
454 472 </em></h3>
@@ -631,9 +649,9 @@
631 649 $( this ).pointer( { 'disabled': true } );
632 650 },
633 651 };
634 652
635 - $( () => $( '<?php echo $selector; ?>' ).pointer( options ).pointer( 'open' ) );
653 + $( () => setTimeout( () => $( '<?php echo $selector; ?>' ).pointer( options ).pointer( 'open' ), 1 ) );
636 654
637 655 $( document ).on( 'screen:options:open screen:options:close', () => {
638 656 setTimeout( () => $( '<?php echo $selector; ?>' ).pointer( 'reposition' ), 210 );
639 657 } );