| @@ -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 | /** |
| @@ -43,8 +45,10 @@ | ||
| 43 | 45 | parent::setup( $action, $data ); |
| 44 | 46 | |
| 45 | 47 | TablePress::enqueue_script( 'list' ); |
| 46 | 48 | |
| 49 | + $milestone_period_ended = ( strtotime( '2026-10-10' ) < strtotime( 'today' ) ); | |
| 50 | + | |
| 47 | 51 | if ( $data['messages']['superseded_extensions'] ) { |
| 48 | 52 | $superseded_extensions = array( |
| 49 | 53 | 'tablepress-advanced-access-rights/tablepress-advanced-access-rights.php' => array( |
| 50 | 54 | 'name' => 'TablePress Extension: Advanced Access Rights', |
| @@ -144,9 +148,9 @@ | ||
| 144 | 148 | |
| 145 | 149 | $notice_css_classes = 'not-dismissible'; |
| 146 | 150 | |
| 147 | 151 | if ( ! empty( $active_incompatible_superseded_extensions ) ) { |
| 148 | - $notice_css_classes .= ' is-error'; | |
| 152 | + $notice_css_classes .= ' is-error notice-error'; | |
| 149 | 153 | |
| 150 | 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>'; |
| 151 | 155 | $message .= '<ul style="list-style:disc;margin:0.5em 1em;font-size:16px;">'; |
| 152 | 156 | foreach ( $active_incompatible_superseded_extensions as $extension ) { |
| @@ -168,9 +172,9 @@ | ||
| 168 | 172 | } |
| 169 | 173 | $message .= '</ul>'; |
| 170 | 174 | } |
| 171 | 175 | } elseif ( ! empty( $active_compatible_superseded_extensions ) && tb_tp_fs()->is_free_plan() ) { |
| 172 | - $notice_css_classes .= ' is-warning'; | |
| 176 | + $notice_css_classes .= ' is-warning notice-warning'; | |
| 173 | 177 | |
| 174 | 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>'; |
| 175 | 179 | $message .= '<ul style="list-style:disc;margin:0.5em 1em;">'; |
| 176 | 180 | foreach ( $active_compatible_superseded_extensions as $extension ) { |
| @@ -200,9 +204,9 @@ | ||
| 200 | 204 | $this->add_header_message( $message, $notice_css_classes, $title ); |
| 201 | 205 | } |
| 202 | 206 | } |
| 203 | 207 | |
| 204 | - if ( $data['messages']['first_visit'] ) { | |
| 208 | + if ( $data['messages']['first_visit'] && ( ! $data['messages']['plugin_update'] || $milestone_period_ended ) ) { | |
| 205 | 209 | $message = '<p style="font-size:14px;"><strong>' . __( 'Thank you for choosing TablePress, the most popular table plugin for WordPress!', 'tablepress' ) . '</strong></p>'; |
| 206 | 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 | |
| @@ -216,10 +220,10 @@ | ||
| 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’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 ) { |
| 225 | 229 | /* translators: %s: Number of tables */ |
| @@ -231,28 +235,46 @@ | ||
| 231 | 235 | $message .= '</p>'; |
| 232 | 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>' |
| 233 | 237 | . __( 'The available Pro and Max plans offer user support and many exciting and helpful features for your tables.', 'tablepress' ) . '</strong></p>'; |
| 234 | 238 | $message .= '<p style="font-size:14px;">' . __( 'Sincerely, Tobias', 'tablepress' ) . '</p>'; |
| 235 | - $message .= '<p style="margin-top:1em;">' . sprintf( '<a href="%s" class="components-button is-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' ) ) | |
| 236 | 240 | . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '</p>'; |
| 237 | 241 | |
| 238 | 242 | $title = '<em>' . __( 'TablePress has more to offer!', 'tablepress' ) . '</em>'; |
| 239 | 243 | |
| 240 | - $this->add_header_message( $message, 'is-success not-dismissible', $title ); | |
| 244 | + $this->add_header_message( $message, 'notice-success not-dismissible', $title ); | |
| 241 | 245 | } |
| 242 | 246 | |
| 243 | 247 | if ( $data['messages']['plugin_update'] ) { |
| 244 | - $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>'; | |
| 245 | 250 | |
| 246 | - if ( tb_tp_fs()->is_free_plan() ) { | |
| 247 | - $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 %</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 %' : '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'; | |
| 248 | 272 | } |
| 249 | 273 | |
| 250 | 274 | $message .= '<p style="margin-top:1em;">' . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'plugin_update', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '</p>'; |
| 251 | 275 | |
| 252 | - $title = '<em>' . sprintf( __( 'Thank you for updating to TablePress %s!', 'tablepress' ), TablePress::version ) . '</em>'; | |
| 253 | - | |
| 254 | - $this->add_header_message( $message, 'notice-info not-dismissible', $title ); | |
| 276 | + $this->add_header_message( $message, $class, $title ); | |
| 255 | 277 | } |
| 256 | 278 | |
| 257 | 279 | $this->process_action_messages( array( |
| 258 | 280 | 'success_delete' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress' ), |
| @@ -260,9 +282,9 @@ | ||
| 260 | 282 | 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ), |
| 261 | 283 | 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) |
| 262 | 284 | . ( ( false !== $data['table_id'] ) |
| 263 | 285 | ? ' ' . ( current_user_can( 'tablepress_edit_table', $data['table_id'] ) |
| 264 | - ? 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'] ) ) ), $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'] ) ) | |
| 265 | 287 | : sprintf( __( 'The copied table has the table ID “%s”.', 'tablepress' ), esc_html( $data['table_id'] ) ) ) |
| 266 | 288 | : '' |
| 267 | 289 | ), |
| 268 | 290 | 'success_copy_plural' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 2, 'tablepress' ), |
| @@ -301,8 +323,9 @@ | ||
| 301 | 323 | $this->print_nav_tab_menu(); |
| 302 | 324 | ?> |
| 303 | 325 | <div id="tablepress-body"> |
| 304 | 326 | <hr class="wp-header-end"> |
| 327 | + <script>document.querySelectorAll('.notice:has(~#tablepress-page)').forEach(e=>document.querySelector('.wp-header-end').after(e));</script> | |
| 305 | 328 | <?php |
| 306 | 329 | // Print all header messages. |
| 307 | 330 | foreach ( $this->header_messages as $message ) { |
| 308 | 331 | echo $message; |