| @@ -3,25 +3,25 @@ | ||
| 3 | 3 | * WordPress plugin "TablePress" main file, responsible for initiating the plugin. |
| 4 | 4 | * |
| 5 | 5 | * @package TablePress |
| 6 | 6 | * @author Tobias Bäthge |
| 7 | - * @version 2.0.4 | |
| 7 | + * @version 3.2 | |
| 8 | 8 | * |
| 9 | 9 | * |
| 10 | 10 | * Plugin Name: TablePress |
| 11 | 11 | * Plugin URI: https://tablepress.org/ |
| 12 | - * Description: Embed beautiful and feature-rich tables into your posts and pages, without having to write code. | |
| 13 | - * Version: 2.0.4 | |
| 14 | - * Requires at least: 5.8 | |
| 15 | - * Requires PHP: 5.6.20 | |
| 12 | + * Description: Embed beautiful and interactive tables into your WordPress website’s posts and pages, without having to write code! | |
| 13 | + * Version: 3.2 | |
| 14 | + * Requires at least: 6.2 | |
| 15 | + * Requires PHP: 7.4 | |
| 16 | 16 | * Author: Tobias Bäthge |
| 17 | - * Author URI: https://tobias.baethge.com/ | |
| 17 | + * Author URI: https://tablepress.org/ | |
| 18 | 18 | * Author email: wordpress@tobias.baethge.com |
| 19 | 19 | * License: GPL 2 |
| 20 | 20 | * Donate URI: https://tablepress.org/donate/ |
| 21 | 21 | * |
| 22 | 22 | * |
| 23 | - * Copyright 2012-2023 Tobias Bäthge | |
| 23 | + * Copyright 2012-2025 Tobias Bäthge | |
| 24 | 24 | * |
| 25 | 25 | * TablePress is free software: you can redistribute it and/or modify |
| 26 | 26 | * it under the terms of the GNU General Public License, version 2, as published by |
| 27 | 27 | * the Free Software Foundation. |
| @@ -32,80 +32,72 @@ | ||
| 32 | 32 | * GNU General Public License for more details. |
| 33 | 33 | * |
| 34 | 34 | * You should have received a copy of the GNU General Public License |
| 35 | 35 | * along with WordPress. If not, see https://www.gnu.org/licenses/gpl-2.0.html. |
| 36 | + * | |
| 37 | + * Note: This file must not contain PHP code that does not run on PHP < 7.4! | |
| 36 | 38 | */ |
| 37 | 39 | |
| 38 | 40 | // Prohibit direct script loading. |
| 39 | 41 | defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 40 | 42 | |
| 43 | +if ( ! defined( 'TABLEPRESS_IS_PLAYGROUND_PREVIEW' ) ) { | |
| 44 | + define( 'TABLEPRESS_IS_PLAYGROUND_PREVIEW', false ); | |
| 45 | +} | |
| 46 | + | |
| 41 | 47 | if ( function_exists( 'tb_tp_fs' ) ) { |
| 42 | - tb_tp_fs()->set_basename( false, __FILE__ ); | |
| 48 | + tb_tp_fs()->set_basename( false, __FILE__ ); // @phpstan-ignore argument.type (Wrong variable type in Freemius function docblock.) | |
| 43 | 49 | } else { |
| 44 | - if ( ! function_exists( 'tb_tp_fs' ) ) { | |
| 45 | - /** | |
| 46 | - * Helper function for easier Freemius SDK access. | |
| 47 | - * | |
| 48 | - * @since 2.0.0 | |
| 49 | - * | |
| 50 | - * @return Freemius Freemius SDK instance. | |
| 51 | - */ | |
| 52 | - function tb_tp_fs() { | |
| 53 | - global $tb_tp_fs; | |
| 50 | + /** | |
| 51 | + * Helper function for easier Freemius SDK access. | |
| 52 | + * | |
| 53 | + * @since 2.0.0 | |
| 54 | + * | |
| 55 | + * @return Freemius Freemius SDK instance. | |
| 56 | + */ | |
| 57 | + function tb_tp_fs() /* No return type declaration, due to required PHP compatibility of this file! */ { | |
| 58 | + global $tb_tp_fs; | |
| 54 | 59 | |
| 55 | - if ( ! isset( $tb_tp_fs ) ) { | |
| 56 | - // Include Freemius SDK. | |
| 57 | - require_once __DIR__ . '/libraries/freemius/start.php'; | |
| 60 | + if ( ! isset( $tb_tp_fs ) ) { | |
| 61 | + // Include Freemius SDK. | |
| 62 | + require_once __DIR__ . '/libraries/freemius/start.php'; | |
| 58 | 63 | |
| 59 | - $tb_tp_fs = fs_dynamic_init( array( | |
| 60 | - 'id' => '10340', | |
| 61 | - 'slug' => 'tablepress', | |
| 62 | - 'type' => 'plugin', | |
| 63 | - 'public_key' => 'pk_b215ca1bb4041cf43ed137ae7665b', | |
| 64 | - 'is_premium' => false, | |
| 65 | - 'has_addons' => false, | |
| 66 | - 'has_paid_plans' => true, | |
| 67 | - 'menu' => array( | |
| 68 | - 'slug' => 'tablepress', | |
| 69 | - 'contact' => false, | |
| 70 | - 'support' => false, | |
| 71 | - 'account' => false, | |
| 72 | - 'pricing' => false, | |
| 73 | - ), | |
| 74 | - 'is_live' => true, | |
| 75 | - ) ); | |
| 76 | - } | |
| 77 | - | |
| 78 | - return $tb_tp_fs; | |
| 64 | + $tb_tp_fs = fs_dynamic_init( array( | |
| 65 | + 'id' => '10340', | |
| 66 | + 'slug' => 'tablepress', | |
| 67 | + 'type' => 'plugin', | |
| 68 | + 'public_key' => 'pk_b215ca1bb4041cf43ed137ae7665b', | |
| 69 | + 'is_premium' => false, | |
| 70 | + 'has_addons' => false, | |
| 71 | + 'has_paid_plans' => true, | |
| 72 | + 'menu' => array( | |
| 73 | + 'slug' => 'tablepress', | |
| 74 | + 'contact' => false, | |
| 75 | + 'support' => false, | |
| 76 | + 'account' => false, | |
| 77 | + ), | |
| 78 | + 'opt_in_moderation' => array( | |
| 79 | + 'new' => true, | |
| 80 | + 'updates' => false, | |
| 81 | + 'localhost' => false, | |
| 82 | + ), | |
| 83 | + 'is_live' => true, | |
| 84 | + 'anonymous_mode' => TABLEPRESS_IS_PLAYGROUND_PREVIEW, | |
| 85 | + ) ); | |
| 79 | 86 | } |
| 80 | 87 | |
| 81 | - // Init Freemius. | |
| 82 | - tb_tp_fs(); | |
| 88 | + return $tb_tp_fs; | |
| 89 | + } | |
| 83 | 90 | |
| 84 | - // Load the TablePress plugin icon for the Freemius opt-in/activation screen. | |
| 85 | - tb_tp_fs()->add_filter( | |
| 86 | - 'plugin_icon', | |
| 87 | - static function() { | |
| 88 | - return __DIR__ . '/admin/img/tablepress.png'; | |
| 89 | - } | |
| 90 | - ); | |
| 91 | + // Init Freemius. | |
| 92 | + tb_tp_fs(); | |
| 91 | 93 | |
| 92 | - // Hide the tabs navigation on Freemius screens. | |
| 93 | - tb_tp_fs()->add_filter( 'hide_account_tabs', '__return_true' ); | |
| 94 | + // Register Freemius plugin filter hooks. | |
| 95 | + require_once __DIR__ . '/controllers/freemius-filters.php'; | |
| 94 | 96 | |
| 95 | - // Hide the Powered by Freemius tab from generated pages, like "Upgrade" or "Pricing". | |
| 96 | - tb_tp_fs()->add_filter( 'hide_freemius_powered_by', '__return_true' ); | |
| 97 | + // Signal that the SDK was initiated. | |
| 98 | + do_action( 'tb_tp_fs_loaded' ); | |
| 97 | 99 | |
| 98 | - // Use different arrow icons in the admin menu. | |
| 99 | - tb_tp_fs()->override_i18n( array( | |
| 100 | - 'symbol_arrow-left' => '←', | |
| 101 | - 'symbol_arrow-right' => '→', | |
| 102 | - ) ); | |
| 103 | - | |
| 104 | - // Signal that SDK was initiated. | |
| 105 | - do_action( 'tb_tp_fs_loaded' ); | |
| 106 | - } | |
| 107 | - | |
| 108 | 100 | /* |
| 109 | 101 | * Define certain plugin variables as constants. |
| 110 | 102 | */ |
| 111 | 103 | if ( ! defined( 'TABLEPRESS_ABSPATH' ) ) { |
| @@ -119,8 +111,15 @@ | ||
| 119 | 111 | } |
| 120 | 112 | if ( ! defined( 'TABLEPRESS_JSON_OPTIONS' ) ) { |
| 121 | 113 | // JSON_UNESCAPED_SLASHES: Don't escape slashes, e.g. to make search/replace of URLs in the database easier. |
| 122 | 114 | define( 'TABLEPRESS_JSON_OPTIONS', JSON_UNESCAPED_SLASHES ); |
| 115 | + } | |
| 116 | + | |
| 117 | + /* | |
| 118 | + * Check if the site environment fulfills the minimum requirements. | |
| 119 | + */ | |
| 120 | + if ( ! require_once TABLEPRESS_ABSPATH . 'controllers/environment-checks.php' ) { | |
| 121 | + return; // Exit early if the return value from the file is false. | |
| 123 | 122 | } |
| 124 | 123 | |
| 125 | 124 | /* |
| 126 | 125 | * Load TablePress class, which holds common functions and variables. |