PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.38
Timetics – Appointment Booking Calendar & Scheduling v1.0.38
1.0.62 1.0.63 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 All 64 releases
← All changes | timetics.php +108 -74 1.0.11.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.1
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 *
@@ -51,8 +50,17 @@
51 50 */
52 51 private static $instance;
53 52
54 53 /**
54 + * Plugin Current Production Version
55 + *
56 + * @return string
57 + */
58 + public static function get_version() {
59 + return '1.0.38';
60 + }
61 +
62 + /**
55 63 * Requirements Array
56 64 *
57 65 * @since 1.0.0
58 66 * @var array
@@ -80,11 +88,10 @@
80 88 * Singleton Instance
81 89 *
82 90 * @return Timetics
83 91 */
84 - public static function get_instance()
85 - {
86 - if (null === self::$instance) {
92 + public static function get_instance() {
93 + if ( null === self::$instance ) {
87 94 self::$instance = new self();
88 95 }
89 96
90 97 return self::$instance;
@@ -94,12 +101,11 @@
94 101 * Setup Plugin Requirements
95 102 *
96 103 * @since 1.0.0
97 104 */
98 - private function __construct()
99 - {
105 + private function __construct() {
100 106 // Always load translation.
101 - add_action('plugins_loaded', array($this, 'load_text_domain'));
107 + add_action( 'init', array( $this, 'load_text_domain' ) );
102 108
103 109 // Initialize plugin functionalities or quit.
104 110 $this->requirements_met() ? $this->initialize_modules() : $this->quit();
105 111 }
@@ -109,15 +115,14 @@
109 115 *
110 116 * @since 1.0
111 117 * @return void
112 118 */
113 - public function load_text_domain()
114 - {
115 - $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' );
116 121
117 - unload_textdomain('timetics');
118 - load_textdomain('timetics', WP_LANG_DIR . '/timetics/timetics-' . $locale . '.mo');
119 - 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/' );
120 125 }
121 126
122 127 /**
123 128 * Initialize Plugin Modules
@@ -124,28 +129,38 @@
124 129 *
125 130 * @since 1.0.0
126 131 * @return void
127 132 */
128 - private function initialize_modules()
129 - {
130 - require_once dirname(__FILE__) . '/autoloader.php';
131 - 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';
132 136
133 - require_once dirname(__FILE__) . '/utils/global-helper.php';
137 + require_once dirname( __FILE__ ) . '/utils/global-helper.php';
134 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 +
135 144 // Include the bootstrap file if not loaded.
136 - if (!class_exists('Timetics\Bootstrap')) {
145 + if ( ! class_exists( 'Timetics\Bootstrap' ) ) {
137 146 require_once self::get_plugin_dir() . 'bootstrap.php';
138 147 }
139 148
149 + // init notice class.
150 + \Oxaim\Libs\Notice::init();
151 +
152 + // init pro menu class.
153 + \Wpmet\Libs\Pro_Awareness::init();
154 +
140 155 // Initialize the bootstraper if exists.
141 - if (class_exists('Timetics\Bootstrap')) {
156 + if ( class_exists( 'Timetics\Bootstrap' ) ) {
142 157
143 158 // Initialize all modules through plugins_loaded.
144 - add_action('plugins_loaded', array($this, 'init'));
159 + add_action( 'plugins_loaded', array( $this, 'init' ) );
145 160
146 - register_activation_hook(self::get_plugin_file(), array($this, 'activate'));
147 - 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' ) );
148 163 }
149 164 }
150 165
151 166 /**
@@ -152,17 +167,16 @@
152 167 * Check If All Requirements Are Fulfilled
153 168 *
154 169 * @return boolean
155 170 */
156 - private function requirements_met()
157 - {
171 + private function requirements_met() {
158 172 $this->prepare_requirement_versions();
159 173
160 174 $passed = true;
161 - $to_meet = wp_list_pluck($this->requirements, 'met');
175 + $to_meet = wp_list_pluck( $this->requirements, 'met' );
162 176
163 - foreach ($to_meet as $met) {
164 - if (empty($met)) {
177 + foreach ( $to_meet as $met ) {
178 + if ( empty( $met ) ) {
165 179 $passed = false;
166 180 continue;
167 181 }
168 182 }
@@ -176,26 +190,25 @@
176 190 * @since 1.0.0
177 191 *
178 192 * @return void
179 193 */
180 - private function prepare_requirement_versions()
181 - {
182 - foreach ($this->requirements as $dependency => $config) {
183 - switch ($dependency) {
184 - case 'php':
185 - $version = phpversion();
186 - break;
187 - case 'wp':
188 - $version = get_bloginfo('version');
189 - break;
190 - default:
191 - $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;
192 205 }
193 206
194 - if (!empty($version)) {
207 + if ( ! empty( $version ) ) {
195 208 $this->requirements[$dependency]['current'] = $version;
196 209 $this->requirements[$dependency]['checked'] = true;
197 - $this->requirements[$dependency]['met'] = version_compare($version, $config['minimum'], '>=');
210 + $this->requirements[$dependency]['met'] = version_compare( $version, $config['minimum'], '>=' );
198 211 }
199 212 }
200 213 }
201 214
@@ -205,11 +218,27 @@
205 218 * @since 1.0.0
206 219 *
207 220 * @return void
208 221 */
209 - public function init()
210 - {
211 - 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 + }
212 241 }
213 242
214 243 /**
215 244 * Called Only Once While Activation
@@ -215,15 +244,35 @@
215 244 * Called Only Once While Activation
216 245 *
217 246 * @return void
218 247 */
219 - public function activate()
220 - {
248 + public function activate() {
221 249 // Insert new role.
222 250 Timetics\Base\Role::instance()->init();
223 251
224 252 // Update default settings.
225 253 timetics_update_default_settings();
254 +
255 + // Register cron
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 + }
226 275 }
227 276
228 277 /**
229 278 * Called Only Once While Deactivation
@@ -229,10 +278,9 @@
229 278 * Called Only Once While Deactivation
230 279 *
231 280 * @return void
232 281 */
233 - public function deactivate()
234 - {
282 + public function deactivate() {
235 283 }
236 284
237 285 /**
238 286 * Quit Plugin Execution
@@ -238,11 +286,10 @@
238 286 * Quit Plugin Execution
239 287 *
240 288 * @return void
241 289 */
242 - private function quit()
243 - {
244 - 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' ) );
245 292 }
246 293
247 294 /**
248 295 * Show Error Notice For Missing Requirements
@@ -248,30 +295,18 @@
248 295 * Show Error Notice For Missing Requirements
249 296 *
250 297 * @return void
251 298 */
252 - public function show_plugin_requirements_not_met_notice()
253 - {
254 - 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>' );
255 301 }
256 302
257 303 /**
258 - * Plugin Current Production Version
259 - *
260 - * @return string
261 - */
262 - public static function get_version()
263 - {
264 - return '1.0.0';
265 - }
266 -
267 - /**
268 304 * Plugin Main File
269 305 *
270 306 * @return string
271 307 */
272 - public static function get_plugin_file()
273 - {
308 + public static function get_plugin_file() {
274 309 return __FILE__;
275 310 }
276 311
277 312 /**
@@ -278,11 +313,10 @@
278 313 * Plugin Base Directory Path
279 314 *
280 315 * @return string
281 316 */
282 - public static function get_plugin_dir()
283 - {
284 - 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() ) );
285 319 }
286 320 }
287 321
288 322 Timetics::get_instance();