forked from alicolville/Weight-Tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
weight-loss-tracker.php
executable file
·179 lines (159 loc) · 10 KB
/
weight-loss-tracker.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
<?php
defined('ABSPATH') or die('Jog on!');
/**
* Plugin Name: Weight Tracker
* Description: Allow your users to track their weight, body measurements, photos and other pieces of custom data. Display in charts, tables, shortcodes and widgets. Manage their data, issue awards, email notifications, etc! Provide advanced data on Body Mass Index (BMI), Basal Metabolic Rate (BMR), Calorie intake, Harris Benedict Formula, Macronutrients Calculator and more.
* Version: 9.1.1
* Requires at least: 5.2
* Tested up to: 5.8
* Requires PHP: 7.2
* Author: Ali Colville
* Author URI: https://www.YeKen.uk
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: weight-loss-tracker
* Domain Path: /includes/languages
*/
define( 'WS_LS_ABSPATH', plugin_dir_path( __FILE__ ) );
define( 'WE_LS_CURRENT_VERSION', '9.1.1' );
define( 'WE_LS_DB_VERSION', '9.1' );
define( 'WE_LS_TITLE', 'Weight Tracker' );
define( 'WE_LS_SLUG', 'weight-loss-tracker' );
define( 'WE_LS_LICENSE_TYPES_URL', 'https://docs.yeken.uk/features.html' );
define( 'WE_LS_CALCULATIONS_URL', ' https://docs.yeken.uk/calculations.html' );
define( 'WE_LS_UPGRADE_TO_PRO_URL', 'https://shop.yeken.uk/product/weight-tracker-pro/' );
define( 'WE_LS_UPGRADE_TO_PRO_PLUS_URL', 'https://shop.yeken.uk/product/weight-tracker-pro-plus/' );
define( 'WE_LS_FREE_TRIAL_URL', 'https://shop.yeken.uk/get-a-trial-license/' );
define( 'WE_LS_CDN_CHART_JS', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.2.0/chart.min.js' );
define( 'WE_LS_CDN_FONT_AWESOME_CSS', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' );
define( 'WE_LS_PRO_PRICE', 50.00 );
define( 'WE_LS_PRO_PLUS_PRICE', 100.00 );
global $form_number; // This is used to keep track of multiple forms on a page allowing us to pass messages to each
global $save_response; // This is used to keep track of form posts responses
// -----------------------------------------------------------------------------------------
// AC: Activate / Deactivate / Uninstall Hooks
// ------------------------------------------------------------------------------------------
register_activation_hook( __FILE__, 'ws_ls_activate' );
register_deactivation_hook( __FILE__, 'ws_ls_deactivate' );
// -----------------------------------------------------------------------------------------
// AC: Check if valid pro license (if valid license)
// ----------------------------------------------------------------------------------------
include WS_LS_ABSPATH . 'includes/license.php';
$license_type = ws_ls_has_a_valid_license();
// Standard Pro license?
if( true === in_array( $license_type, [ 'pro', 'pro-old', 'pro-plus' ] ) ){
define( 'WS_LS_IS_PRO', true );
} else {
define( 'WS_LS_IS_PRO', false );
}
// Pro Plus license?
if( 'pro-plus' === $license_type ){
define( 'WS_LS_IS_PRO_PLUS', true );
} else {
define( 'WS_LS_IS_PRO_PLUS', false );
}
// -----------------------------------------------------------------------------------------
// AC: Include all relevant PHP files
// -----------------------------------------------------------------------------------------
require_once( WS_LS_ABSPATH . 'includes/caching.php' );
require_once( WS_LS_ABSPATH . 'includes/db.php' );
require_once( WS_LS_ABSPATH . 'includes/activate.php' );
require_once( WS_LS_ABSPATH . 'includes/hooks.php' );
require_once( WS_LS_ABSPATH . 'includes/cron.php' );
require_once( WS_LS_ABSPATH . 'includes/functions.php' );
require_once( WS_LS_ABSPATH . 'includes/converters.php' );
require_once( WS_LS_ABSPATH . 'includes/core.php' );
require_once( WS_LS_ABSPATH . 'includes/core-forms.php' );
require_once( WS_LS_ABSPATH . 'includes/core-tables.php' );
require_once( WS_LS_ABSPATH . 'includes/core-charting.php' );
require_once( WS_LS_ABSPATH . 'includes/ajax.php' );
require_once( WS_LS_ABSPATH . 'includes/setup-wizard.php' );
require_once( WS_LS_ABSPATH . 'includes/shortcode-weight-tracker.php' );
require_once( WS_LS_ABSPATH . 'includes/shortcode-various.php' );
require_once( WS_LS_ABSPATH . 'includes/form-handler.php' );
require_once( WS_LS_ABSPATH . 'includes/email-manager.php' );
require_once( WS_LS_ABSPATH . 'includes/meal-tracker.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/settings/page-settings.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/settings/page-settings-generic.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/settings/page-settings-groups.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/settings/page-settings-email-manager.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-groups.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/page-help.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/page-license.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/page-setup-wizard.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/meta-fields/page-meta-fields.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/meta-fields/page-meta-fields-add-update.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/meta-fields/page-meta-fields-list.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/meta-fields/page-meta-fields-groups.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/awards/page-awards.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/awards/page-awards-list.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/awards/page-awards-add-update.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/meta-fields/activate.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/meta-fields/db.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/meta-fields/hooks.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/meta-fields/functions.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/meta-fields/functions-photos.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/meta-fields/functions-slider.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/meta-fields/shortcodes.php' );
require_once( WS_LS_ABSPATH . 'pro-features/feature-list.php' );
require_once( WS_LS_ABSPATH . 'pro-features/functions.php' );
require_once( WS_LS_ABSPATH . 'pro-features/functions-pages.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-home.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-summary.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-view-all.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-add-edit-entry.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-edit-target.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-user.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-user-edit-settings.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-search-results.php' );
require_once( WS_LS_ABSPATH . 'includes/admin-pages/user-data/data-photos.php' );
require_once( WS_LS_ABSPATH . 'pro-features/user-groups.php' );
require_once( WS_LS_ABSPATH . 'pro-features/user-birthdays.php' );
require_once( WS_LS_ABSPATH . 'pro-features/user-preferences.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-chart.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-form.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-footable.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-various.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-stats.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-reminders.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-progress-bar.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-messages.php' );
require_once( WS_LS_ABSPATH . 'pro-features/shortcode-if.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/shortcode.wlt.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/photos.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/photos-gallery.php' );
require_once( WS_LS_ABSPATH . 'pro-features/widget-chart.php' );
require_once( WS_LS_ABSPATH . 'pro-features/widget-form.php' );
require_once( WS_LS_ABSPATH . 'pro-features/widget-progress.php' );
require_once( WS_LS_ABSPATH . 'pro-features/footable.php' );
require_once( WS_LS_ABSPATH . 'pro-features/db.php' );
require_once( WS_LS_ABSPATH . 'pro-features/functions-stats.php' );
require_once( WS_LS_ABSPATH . 'pro-features/hooks.php' );
if ( true === WS_LS_IS_PRO ) {
require_once( WS_LS_ABSPATH . 'pro-features/gamification.php' );
}
require_once( WS_LS_ABSPATH . 'pro-features/plus/awards/activate.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/awards/functions.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/awards/db.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/awards/hooks.php' );
require_once( WS_LS_ABSPATH . 'pro-features/email-notifications.php' );
require_once( WS_LS_ABSPATH . 'pro-features/web-hooks.php' );
if ( true === ws_ls_settings_challenges_enabled() ) {
require_once( WS_LS_ABSPATH . 'pro-features/plus/challenge/inc.php' );
}
require_once( WS_LS_ABSPATH . 'pro-features/plus/bmr.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/harris-benedict.php' );
require_once( WS_LS_ABSPATH . 'pro-features/plus/macronutrient-calculator.php' );
require_once( WS_LS_ABSPATH . 'pro-features/export/inc.php' );
// Gravity Forms
if ( true === WS_LS_IS_PRO && 'yes' == get_option( 'ws-ls-gf-enable', 'yes' ) ) {
require_once( WS_LS_ABSPATH . 'pro-features/hook-gravity-forms.php' );
}
require_once( WS_LS_ABSPATH . 'includes/deprecated.php' );
// -----------------------------------------------------------------------------------------
// AC: Load relevant language files (https://wpallinfo.com/complete-list-of-wordpress-locale-codes/)
// -----------------------------------------------------------------------------------------
function ws_ls_load_textdomain() {
load_plugin_textdomain( WE_LS_SLUG, false, dirname( plugin_basename( __FILE__ ) ) . '/includes/languages/' );
}
add_action('plugins_loaded', 'ws_ls_load_textdomain');