| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: wpDataTables - Tables & Table Charts |
| 4 |
Plugin URI: https://wpdatatables.com |
| 5 |
Description: Create responsive, sortable tables & charts from Excel, CSV or PHP. Add tables & charts to any post in minutes with DataTables. |
| 6 |
Version: 6.5.1.6 |
| 7 |
Author: Melograno Ventures |
| 8 |
Author URI: https://melograno.io |
| 9 |
Text Domain: wpdatatables |
| 10 |
Domain Path: /languages |
| 11 |
*/ |
| 12 |
|
| 13 |
?> |
| 14 |
<?php |
| 15 |
|
| 16 |
defined('ABSPATH') or die("Cannot access pages directly."); |
| 17 |
|
| 18 |
/****************************** |
| 19 |
* Includes and configuration * |
| 20 |
******************************/ |
| 21 |
|
| 22 |
define('WDT_ROOT_PATH', plugin_dir_path(__FILE__)); // full path to the wpDataTables root directory |
| 23 |
define('WDT_ROOT_URL', plugin_dir_url(__FILE__)); // URL of wpDataTables plugin |
| 24 |
if (!defined('WDT_BASENAME')) { |
| 25 |
define('WDT_BASENAME', plugin_basename(__FILE__)); |
| 26 |
} |
| 27 |
if (!defined('WDTMCP_VERSION')) { |
| 28 |
define('WDTMCP_VERSION', '1.0.0'); |
| 29 |
} |
| 30 |
if (!defined('WDTMCP_MIN_WP_VERSION')) { |
| 31 |
define('WDTMCP_MIN_WP_VERSION', '6.9'); |
| 32 |
} |
| 33 |
// Config file |
| 34 |
require_once(WDT_ROOT_PATH . 'config/config.inc.php'); |
| 35 |
|
| 36 |
// Check PHP version |
| 37 |
if (version_compare(WDT_PHP_SERVER_VERSION, WDT_REQUIRED_PHP_VERSION, '<')) { |
| 38 |
|
| 39 |
if (!function_exists('is_plugin_active')) { |
| 40 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 41 |
} |
| 42 |
|
| 43 |
if (is_plugin_active(WDT_BASENAME)) { |
| 44 |
deactivate_plugins(WDT_BASENAME); |
| 45 |
} |
| 46 |
add_action('admin_notices', |
| 47 |
function () { |
| 48 |
$message = sprintf( |
| 49 |
esc_attr__('Our plugin requires %1$s PHP Version or higher. Your Version: %2$s. See %3$s for details.', 'wpdatatables'), |
| 50 |
WDT_REQUIRED_PHP_VERSION, |
| 51 |
WDT_PHP_SERVER_VERSION, |
| 52 |
'<a href="https://wordpress.org/about/requirements/" target="_blank">' . esc_html__('WordPress Requirements', 'wpdatatables') . '</a>' |
| 53 |
); |
| 54 |
?> |
| 55 |
<div class="notice notice-error"> |
| 56 |
<p> |
| 57 |
<strong> <?php esc_html_e('Warning:', 'wpdatatables') ?></strong> |
| 58 |
<?php |
| 59 |
esc_html_e('Your site is running an insecure version of PHP that is no longer supported.', 'wpdatatables') |
| 60 |
?> |
| 61 |
<br><br> |
| 62 |
<?php |
| 63 |
echo $message; |
| 64 |
?> |
| 65 |
<br><br><strong> <?php esc_html_e('Note:', 'wpdatatables') ?></strong> |
| 66 |
<?php |
| 67 |
esc_html_e('The wpDataTables plugin is disabled on your site until you fix the issue.', 'wpdatatables') |
| 68 |
?> |
| 69 |
</p> |
| 70 |
</div> |
| 71 |
<?php |
| 72 |
}); |
| 73 |
return; |
| 74 |
} |
| 75 |
|
| 76 |
// Plugin functions |
| 77 |
require_once(WDT_ROOT_PATH . 'controllers/wdt_functions.php'); |
| 78 |
|
| 79 |
// Load dependencies |
| 80 |
require_once WDT_ROOT_PATH . 'lib/autoload.php'; |
| 81 |
|
| 82 |
use Melograno\UsageTracker\Collectors\Plugin\WpDataTablesCollector; |
| 83 |
use Melograno\UsageTracker\Core\UsageTracker; |
| 84 |
|
| 85 |
if (!defined('MELOGRANO_BI_GATE_URL')) { |
| 86 |
define('MELOGRANO_BI_GATE_URL', 'https://bi.melograno.io'); |
| 87 |
} |
| 88 |
|
| 89 |
function wpdatatables_load() |
| 90 |
{ |
| 91 |
if (is_admin()) { |
| 92 |
// Admin panel controller |
| 93 |
require_once(WDT_ROOT_PATH . 'controllers/wdt_admin.php'); |
| 94 |
// Admin panel AJAX actions |
| 95 |
require_once(WDT_ROOT_PATH . 'controllers/wdt_admin_ajax_actions.php'); |
| 96 |
|
| 97 |
} |
| 98 |
require_once(WDT_ROOT_PATH . 'source/class.wdttools.php'); |
| 99 |
require_once(WDT_ROOT_PATH . 'source/class.wdtconfigcontroller.php'); |
| 100 |
require_once(WDT_ROOT_PATH . 'source/class.wdtsettingscontroller.php'); |
| 101 |
require_once(WDT_ROOT_PATH . 'source/class.wdtexception.php'); |
| 102 |
require_once(WDT_ROOT_PATH . 'source/class.sql.php'); |
| 103 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatatable.php'); |
| 104 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatacolumn.php'); |
| 105 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatatablerows.php'); |
| 106 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatatablecache.php'); |
| 107 |
require_once(WDT_ROOT_PATH . 'source/class.wdtnestedjson.php'); |
| 108 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatachart.php'); |
| 109 |
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsetable.php'); |
| 110 |
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsechartstable.php'); |
| 111 |
require_once(WDT_ROOT_PATH . 'source/class.feedback.php'); |
| 112 |
require_once(WDT_ROOT_PATH . 'source/class.permissions.admin.php'); |
| 113 |
require_once(WDT_ROOT_PATH . 'source/class.permissions.enforcer.php'); |
| 114 |
require_once(WDT_ROOT_PATH . 'integrations/page_builders/gutenberg/WDTGutenbergBlocks.php'); |
| 115 |
require_once(WDT_ROOT_PATH . 'integrations/page_builders/elementor/class.wdtelementorblock.php'); |
| 116 |
require_once(WDT_ROOT_PATH . 'integrations/page_builders/divi-wpdt/divi-wpdt.php'); |
| 117 |
require_once(WDT_ROOT_PATH . 'integrations/page_builders/avada/class.wdtavadaelements.php'); |
| 118 |
require_once(WDT_ROOT_PATH . 'integrations/page_builders/wpbakery/wdtBakeryBlock.php'); |
| 119 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatatablestemplates.php'); |
| 120 |
require_once(WDT_ROOT_PATH . 'integrations/ivyforms/ivyforms-integration.php'); |
| 121 |
|
| 122 |
add_action('plugins_loaded', 'wdtLoadTextdomain'); |
| 123 |
|
| 124 |
add_action('plugins_loaded', static function () { |
| 125 |
UsageTracker::init(new WpDataTablesCollector(), __FILE__); |
| 126 |
}); |
| 127 |
|
| 128 |
if (is_admin()) { |
| 129 |
|
| 130 |
if (WDT_CURRENT_VERSION !== get_option('wdtVersion')) { |
| 131 |
if (!function_exists('is_plugin_active_for_network')) { |
| 132 |
include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
| 133 |
} |
| 134 |
|
| 135 |
wdtActivation(is_plugin_active_for_network(__FILE__)); |
| 136 |
update_option('wdtVersion', WDT_CURRENT_VERSION); |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
/******** |
| 144 |
* Hooks * |
| 145 |
********/ |
| 146 |
register_activation_hook(__FILE__, 'wdtActivation'); |
| 147 |
register_deactivation_hook(__FILE__, 'wdtDeactivation'); |
| 148 |
register_uninstall_hook(__FILE__, 'wdtUninstall'); |
| 149 |
|
| 150 |
add_shortcode('wpdatatable', 'wdtWpDataTableShortcodeHandler'); |
| 151 |
add_shortcode('wpdatachart', 'wdtWpDataChartShortcodeHandler'); |
| 152 |
add_shortcode('wpdatatable_cell', 'wdtWpDataTableCellShortcodeHandler'); |
| 153 |
|
| 154 |
wpdatatables_load(); |
| 155 |
|
| 156 |
require_once WDT_ROOT_PATH . 'Infrastructure/WP/MCP/WdtmcpAdapterCompatibility.php'; |
| 157 |
require_once WDT_ROOT_PATH . 'Infrastructure/WP/MCP/WdtmcpBootstrap.php'; |
| 158 |
|
| 159 |
\WDTMCP\Infrastructure\WP\MCP\WdtmcpBootstrap::load(); |
| 160 |
?> |
| 161 |
|