-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwp-table-builder.php
202 lines (160 loc) · 5.58 KB
/
wp-table-builder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link http://wptablebuilder.com/
* @since 1.0.0
* @package WP_Table_Builder
*
* @wordpress-plugin
* Plugin Name: WP Table Builder
* Plugin URI: https://wptablebuilder.com/
* Description: Drag and Drop Responsive Table Builder Plugin for WordPress.
* Version: 1.6.5
* Author: WP Table Builder
* Author URI: https://wptablebuilder.com//
* License: GPL-3.0+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
* Text Domain: wp-table-builder
* Domain Path: /languages
*/
namespace {
/**
* Inline render a table to DOM.
*
* @param integer $table_id table id
*/
function wptb_render_table($table_id) {
echo do_shortcode("[wptb id={$table_id}]");
}
}
namespace WP_Table_Builder {
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
if (!function_exists('wptb_fs')) {
// Create a helper function for easy SDK access.
function wptb_fs() {
global $wptb_fs;
if (!isset($wptb_fs)) {
// Include Freemius SDK.
require_once dirname(__FILE__) . '/inc/core/freemius/start.php';
$wptb_fs = fs_dynamic_init(array(
'id' => '6602',
'slug' => 'wp-table-builder',
'type' => 'plugin',
'public_key' => 'pk_6bf7fb67d8b8bcce83459fd46432e',
'is_premium' => false,
'has_addons' => true,
'has_paid_plans' => false,
'is_org_compliant' => false,
'menu' => array(
'slug' => 'wptb-overview',
'first-path' => 'admin.php?page=wp-table-builder-welcome',
'account' => true,
'contact' => false,
'support' => false,
),
));
}
return $wptb_fs;
}
// Init Freemius.
wptb_fs();
// Signal that SDK was initiated.
do_action('wptb_fs_loaded');
}
/**
* Define Constants
*/
$current_version = '1.6.5';
define(__NAMESPACE__ . '\NS', __NAMESPACE__ . '\\');
define(NS . 'WP_TABLE_BUILDER', 'wp-table-builder');
define(NS . 'PLUGIN_VERSION', $current_version);
define(NS . 'WP_TABLE_BUILDER_DIR', plugin_dir_path(__FILE__));
define(NS . 'WP_TABLE_BUILDER_URL', plugin_dir_url(__FILE__));
define(NS . 'PLUGIN_BASENAME', plugin_basename(__FILE__));
define(NS . 'PLUGIN_TEXT_DOMAIN', 'wp-table-builder');
define(NS . 'PLUGIN__FILE__', __FILE__);
/**
* Autoload Classes
*/
require_once(WP_TABLE_BUILDER_DIR . 'inc/libraries/autoloader.php');
require_once(WP_TABLE_BUILDER_DIR . "vendor/autoload.php");
/**
* Helper Functions
*/
/**
* Register Activation and Deactivation Hooks
* This action is documented in inc/core/class-activator.php
*/
register_activation_hook(__FILE__, array(NS . 'Inc\Core\Activator', 'activate'));
/**
* The code that runs during plugin deactivation.
* This action is documented inc/core/class-deactivator.php
*/
register_deactivation_hook(__FILE__, array(NS . 'Inc\Core\Deactivator', 'deactivate'));
if (!function_exists('wptb_safe_welcome_redirect')) {
// call welcome screen after freemius initialization
add_action('wptb_fs_loaded', 'WP_Table_Builder\wptb_safe_welcome_redirect');
function wptb_safe_welcome_redirect() {
if (!get_transient('_welcome_redirect_wptb')) {
return;
}
delete_transient('_welcome_redirect_wptb');
if (is_network_admin() || isset($_GET['activate-multi'])) {
return;
}
wp_safe_redirect(add_query_arg(
array(
'page' => 'wp-table-builder-welcome'
),
admin_url('admin.php')
));
}
}
/**
* Plugin Singleton Container
*
* Maintains a single copy of the plugin app object
*
* @since 1.0.0
*/
class WP_Table_Builder {
/**
* The instance of the plugin.
*
* @since 1.0.0
* @var Init $init Instance of the plugin.
*/
public static $init;
public function __construct() {
self::$init = Inc\Core\Init::instance();
self::$init->run();
}
}
/**
* Begins execution of the plugin
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* Also returns copy of the app object so 3rd party developers
* can interact with the plugin's hooks contained within.
**/
function wp_table_builder_init() {
new WP_Table_Builder();
}
$min_php = '7.4';
// Check the minimum required PHP version and run the plugin.
if (version_compare(PHP_VERSION, $min_php, '>=')) {
wp_table_builder_init();
}
}