PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.38
Timetics – Appointment Booking Calendar & Scheduling v1.0.38
1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 All 62 releases
← All changes | timetics.php +98 -67 1.0.21.0.38 View file →
@@ -3,9 +3,9 @@
3 3 /**
4 4 * Plugin Name: Timetics
5 5 * Plugin URI: https://arraytics.com/timetics/
6 6 * Description: Schedule, Appointment and Seat Booking plugin.
7 - * Version: 1.0.2
7 + * Version: 1.0.38
8 8 * Requires at least: 5.2
9 9 * Requires PHP: 7.3
10 10 * Author: Arraytics
11 11 * Author URI: https://arraytics.com/
@@ -29,13 +29,13 @@
29 29 *
30 30 * @package Timetics
31 31 * @category Core
32 32 * @author Arraytics
33 - * @version 1.0.0
33 + * @version 1.0.10
34 34 */
35 35
36 36 // Exit if accessed directly.
37 -defined('ABSPATH') || exit;
37 +defined( 'ABSPATH' ) || exit;
38 38
39 39 /**
40 40 * The Main Plugin Requirements Checker
41 41 *
@@ -40,10 +40,9 @@
40 40 * The Main Plugin Requirements Checker
41 41 *
42 42 * @since 1.0.0
43 43 */
44 -final class Timetics
45 -{
44 +final class Timetics {
46 45
47 46 /**
48 47 * Static Property To Hold Singleton Instance
49 48 *
@@ -55,11 +54,10 @@
55 54 * Plugin Current Production Version
56 55 *
57 56 * @return string
58 57 */
59 - public static function get_version()
60 - {
61 - return '1.0.2';
58 + public static function get_version() {
59 + return '1.0.38';
62 60 }
63 61
64 62 /**
65 63 * Requirements Array
@@ -90,11 +88,10 @@
90 88 * Singleton Instance
91 89 *
92 90 * @return Timetics
93 91 */
94 - public static function get_instance()
95 - {
96 - if (null === self::$instance) {
92 + public static function get_instance() {
93 + if ( null === self::$instance ) {
97 94 self::$instance = new self();
98 95 }
99 96
100 97 return self::$instance;
@@ -104,12 +101,11 @@
104 101 * Setup Plugin Requirements
105 102 *
106 103 * @since 1.0.0
107 104 */
108 - private function __construct()
109 - {
105 + private function __construct() {
110 106 // Always load translation.
111 - add_action('plugins_loaded', array($this, 'load_text_domain'));
107 + add_action( 'init', array( $this, 'load_text_domain' ) );
112 108
113 109 // Initialize plugin functionalities or quit.
114 110 $this->requirements_met() ? $this->initialize_modules() : $this->quit();
115 111 }
@@ -119,15 +115,14 @@
119 115 *
120 116 * @since 1.0
121 117 * @return void
122 118 */
123 - public function load_text_domain()
124 - {
125 - $locale = apply_filters('plugin_locale', get_user_locale(), 'timetics');
119 + public function load_text_domain() {
120 + $locale = apply_filters( 'plugin_locale', get_user_locale(), 'timetics' );
126 121
127 - unload_textdomain('timetics');
128 - load_textdomain('timetics', WP_LANG_DIR . '/timetics/timetics-' . $locale . '.mo');
129 - load_plugin_textdomain('timetics', false, self::get_plugin_dir() . 'languages/');
122 + unload_textdomain( 'timetics' );
123 + load_textdomain( 'timetics', WP_LANG_DIR . '/timetics/timetics-' . $locale . '.mo' );
124 + load_plugin_textdomain( 'timetics', false, self::get_plugin_dir() . 'languages/' );
130 125 }
131 126
132 127 /**
133 128 * Initialize Plugin Modules
@@ -134,28 +129,38 @@
134 129 *
135 130 * @since 1.0.0
136 131 * @return void
137 132 */
138 - private function initialize_modules()
139 - {
140 - require_once dirname(__FILE__) . '/autoloader.php';
141 - require_once dirname(__FILE__) . '/core/settings/settings.php';
133 + private function initialize_modules() {
134 + require_once dirname( __FILE__ ) . '/autoloader.php';
135 + require_once dirname( __FILE__ ) . '/core/settings/settings.php';
142 136
143 - require_once dirname(__FILE__) . '/utils/global-helper.php';
137 + require_once dirname( __FILE__ ) . '/utils/global-helper.php';
144 138
139 + // block for showing banner.
140 + require_once plugin_dir_path( __FILE__ ) . '/utils/notice/notice.php';
141 + require_once plugin_dir_path( __FILE__ ) . '/utils/banner/banner.php';
142 + require_once plugin_dir_path( __FILE__ ) . '/utils/pro-awareness/pro-awareness.php';
143 +
145 144 // Include the bootstrap file if not loaded.
146 - if (!class_exists('Timetics\Bootstrap')) {
145 + if ( ! class_exists( 'Timetics\Bootstrap' ) ) {
147 146 require_once self::get_plugin_dir() . 'bootstrap.php';
148 147 }
149 148
149 + // init notice class.
150 + \Oxaim\Libs\Notice::init();
151 +
152 + // init pro menu class.
153 + \Wpmet\Libs\Pro_Awareness::init();
154 +
150 155 // Initialize the bootstraper if exists.
151 - if (class_exists('Timetics\Bootstrap')) {
156 + if ( class_exists( 'Timetics\Bootstrap' ) ) {
152 157
153 158 // Initialize all modules through plugins_loaded.
154 - add_action('plugins_loaded', array($this, 'init'));
159 + add_action( 'plugins_loaded', array( $this, 'init' ) );
155 160
156 - register_activation_hook(self::get_plugin_file(), array($this, 'activate'));
157 - register_deactivation_hook(self::get_plugin_file(), array($this, 'deactivate'));
161 + register_activation_hook( self::get_plugin_file(), array( $this, 'activate' ) );
162 + register_deactivation_hook( self::get_plugin_file(), array( $this, 'deactivate' ) );
158 163 }
159 164 }
160 165
161 166 /**
@@ -162,17 +167,16 @@
162 167 * Check If All Requirements Are Fulfilled
163 168 *
164 169 * @return boolean
165 170 */
166 - private function requirements_met()
167 - {
171 + private function requirements_met() {
168 172 $this->prepare_requirement_versions();
169 173
170 174 $passed = true;
171 - $to_meet = wp_list_pluck($this->requirements, 'met');
175 + $to_meet = wp_list_pluck( $this->requirements, 'met' );
172 176
173 - foreach ($to_meet as $met) {
174 - if (empty($met)) {
177 + foreach ( $to_meet as $met ) {
178 + if ( empty( $met ) ) {
175 179 $passed = false;
176 180 continue;
177 181 }
178 182 }
@@ -186,26 +190,25 @@
186 190 * @since 1.0.0
187 191 *
188 192 * @return void
189 193 */
190 - private function prepare_requirement_versions()
191 - {
192 - foreach ($this->requirements as $dependency => $config) {
193 - switch ($dependency) {
194 - case 'php':
195 - $version = phpversion();
196 - break;
197 - case 'wp':
198 - $version = get_bloginfo('version');
199 - break;
200 - default:
201 - $version = false;
194 + private function prepare_requirement_versions() {
195 + foreach ( $this->requirements as $dependency => $config ) {
196 + switch ( $dependency ) {
197 + case 'php':
198 + $version = phpversion();
199 + break;
200 + case 'wp':
201 + $version = get_bloginfo( 'version' );
202 + break;
203 + default:
204 + $version = false;
202 205 }
203 206
204 - if (!empty($version)) {
207 + if ( ! empty( $version ) ) {
205 208 $this->requirements[$dependency]['current'] = $version;
206 209 $this->requirements[$dependency]['checked'] = true;
207 - $this->requirements[$dependency]['met'] = version_compare($version, $config['minimum'], '>=');
210 + $this->requirements[$dependency]['met'] = version_compare( $version, $config['minimum'], '>=' );
208 211 }
209 212 }
210 213 }
211 214
@@ -215,11 +218,27 @@
215 218 * @since 1.0.0
216 219 *
217 220 * @return void
218 221 */
219 - public function init()
220 - {
221 - Timetics\Bootstrap::instantiate(self::get_plugin_file());
222 + public function init() {
223 + Timetics\Bootstrap::instantiate( self::get_plugin_file() );
224 +
225 + // Add autoload from composer for integrating uninstallation form
226 + if (file_exists(plugin_dir_path( __FILE__ ) . '/vendor/autoload.php')) {
227 + require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload.php';
228 + }
229 +
230 + if ( class_exists( 'UninstallerForm\UninstallerForm' ) ) {
231 + $uninstaller_form = new \UninstallerForm\UninstallerForm();
232 + $uninstaller_form->init(
233 + 'Timetics', // Plugin name
234 + 'timetics', // Plugin Slug
235 + __FILE__,
236 + 'timetics', // Text Domain Name
237 + 'timetics-feedback-modal', // plugins-admin-script-handler
238 + 'https://arraytics.com/?fluentcrm=1&route=contact&hash=13cce8a6-c038-4997-91e7-4a2326cc1124'
239 + );
240 + }
222 241 }
223 242
224 243 /**
225 244 * Called Only Once While Activation
@@ -225,10 +244,9 @@
225 244 * Called Only Once While Activation
226 245 *
227 246 * @return void
228 247 */
229 - public function activate()
230 - {
248 + public function activate() {
231 249 // Insert new role.
232 250 Timetics\Base\Role::instance()->init();
233 251
234 252 // Update default settings.
@@ -235,8 +253,26 @@
235 253 timetics_update_default_settings();
236 254
237 255 // Register cron
238 256 timetics_register_cron();
257 +
258 + // Create new woocommerce product category for timetics meeting
259 + timetics_add_woocommerce_product_cat();
260 +
261 + // Update option for onboard settings.
262 + $timetics_onboard_setup = get_option( 'timetics_onboard_setup' );
263 +
264 + $timetics_demo_data = get_option( 'timetics_demo_data' );
265 +
266 + if ( ! $timetics_demo_data ) {
267 + $dummy_data_generator = new Timetics\Core\DummyData\Dummy_Data_Generator();
268 + $dummy_data_generator->generate();
269 + update_option( 'timetics_demo_data', true );
270 + }
271 +
272 + if ( ! $timetics_onboard_setup ) {
273 + update_option( 'timetics_onboard_settings', true );
274 + }
239 275 }
240 276
241 277 /**
242 278 * Called Only Once While Deactivation
@@ -242,10 +278,9 @@
242 278 * Called Only Once While Deactivation
243 279 *
244 280 * @return void
245 281 */
246 - public function deactivate()
247 - {
282 + public function deactivate() {
248 283 }
249 284
250 285 /**
251 286 * Quit Plugin Execution
@@ -251,11 +286,10 @@
251 286 * Quit Plugin Execution
252 287 *
253 288 * @return void
254 289 */
255 - private function quit()
256 - {
257 - add_action('admin_head', array($this, 'show_plugin_requirements_not_met_notice'));
290 + private function quit() {
291 + add_action( 'admin_head', array( $this, 'show_plugin_requirements_not_met_notice' ) );
258 292 }
259 293
260 294 /**
261 295 * Show Error Notice For Missing Requirements
@@ -261,11 +295,10 @@
261 295 * Show Error Notice For Missing Requirements
262 296 *
263 297 * @return void
264 298 */
265 - public function show_plugin_requirements_not_met_notice()
266 - {
267 - printf('<div>Minimum requirements for Timetics are not met. Please update requirements to continue.</div>');
299 + public function show_plugin_requirements_not_met_notice() {
300 + printf( '<div>Minimum requirements for Timetics are not met. Please update requirements to continue.</div>' );
268 301 }
269 302
270 303 /**
271 304 * Plugin Main File
@@ -271,10 +304,9 @@
271 304 * Plugin Main File
272 305 *
273 306 * @return string
274 307 */
275 - public static function get_plugin_file()
276 - {
308 + public static function get_plugin_file() {
277 309 return __FILE__;
278 310 }
279 311
280 312 /**
@@ -281,11 +313,10 @@
281 313 * Plugin Base Directory Path
282 314 *
283 315 * @return string
284 316 */
285 - public static function get_plugin_dir()
286 - {
287 - return trailingslashit(plugin_dir_path(self::get_plugin_file()));
317 + public static function get_plugin_dir() {
318 + return trailingslashit( plugin_dir_path( self::get_plugin_file() ) );
288 319 }
289 320 }
290 321
291 322 Timetics::get_instance();