PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.58
Timetics – Appointment Booking Calendar & Scheduling v1.0.58
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
timetics / utils / pro-awareness / pro-awareness.php

pro-awareness.php in Timetics – Appointment Booking Calendar & Scheduling 1.0.58, at utils/pro-awareness/pro-awareness.php

470 lines 17.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wpmet\Libs;
4 use Etn\Utils\Helper;
5 defined('ABSPATH') || exit;
6
7 if(!class_exists('\Wpmet\Libs\Pro_Awareness')) :
8
9 class Pro_Awareness
10 {
11
12 private static $instance;
13
14 private $text_domain;
15 private $plugin_file;
16 private $parent_menu_slug;
17 private $menu_slug = '_get_help';
18 private $default_grid_link = 'https://themewinter.com/support/';
19 private $default_grid_title = 'Documentation';
20 private $default_grid_thumbnail = '';
21 private $default_grid_desc = '';
22 private $pro_link_conf = [];
23
24 private $grids = [];
25 private $action_links = [];
26 private $row_meta_links = [];
27 private $parent_menu_text = 'Get Help';
28
29
30 protected $script_version = '1.0.3';
31
32 /**
33 * Get version of this script
34 *
35 * @return string Version name
36 */
37 public function get_version() {
38 return $this->script_version;
39 }
40
41 /**
42 * Get current directory path
43 *
44 * @return string
45 */
46 public function get_script_location() {
47 return __FILE__;
48 }
49
50
51 public static function instance($text_domain) {
52
53 self::$instance = new self();
54
55 return self::$instance->set_text_domain($text_domain);
56 }
57
58 protected function set_text_domain($val) {
59
60 $this->text_domain = $val;
61
62 return $this;
63 }
64
65 private function default_grid() {
66
67 return [
68 'url' => $this->default_grid_link,
69 'title' => $this->default_grid_title,
70 'thumbnail' => $this->default_grid_thumbnail,
71 'description' => $this->default_grid_desc,
72 ];
73 }
74
75 public function set_parent_menu_text($text) {
76
77 $this->parent_menu_text = $text;
78
79 return $this;
80 }
81
82 public function set_default_grid_link($url) {
83
84 $this->default_grid_link = $url;
85
86 return $this;
87 }
88
89 public function set_default_grid_title($title) {
90
91 $this->default_grid_title = $title;
92
93 return $this;
94 }
95
96 public function set_default_grid_desc($title) {
97
98 $this->default_grid_desc = $title;
99
100 return $this;
101 }
102
103 public function set_default_grid_thumbnail($thumbnail) {
104
105 $this->default_grid_thumbnail = $thumbnail;
106
107 return $this;
108 }
109
110 public function set_parent_menu_slug($slug) {
111
112 $this->parent_menu_slug = $slug;
113
114 return $this;
115 }
116
117
118 public function set_menu_slug($slug) {
119
120 $this->menu_slug = $slug;
121
122 return $this;
123 }
124
125 public function set_plugin_file($plugin_file) {
126
127 $this->plugin_file = $plugin_file;
128
129 return $this;
130 }
131
132 public function set_pro_link($url, $conf = []) {
133
134 if($url == '') {
135 return $this;
136 }
137
138 $this->pro_link_conf[] = [
139 'url' => $url,
140 'anchor' => empty($conf['anchor']) ? '<span style="color: #FCB214;" class="pro_aware pro">Go Pro</span>' : $conf['anchor'],
141 'permission' => empty($conf['permission']) ? 'manage_options' : $conf['permission'],
142 ];
143
144 return $this;
145 }
146
147 /**
148 * Set page grid
149 */
150 public function set_page_grid($conf = []) {
151
152 if(!empty($conf['url'])) {
153
154 $this->grids[] = [
155 'url' => $conf['url'],
156 'title' => empty($conf['title']) ? esc_html__('Default Title', 'timetics') : $conf['title'],
157 'thumbnail' => empty($conf['thumbnail']) ? '' : esc_url($conf['thumbnail']),
158 'description' => empty($conf['description']) ? '' : $conf['description'],
159 ];
160 }
161
162 return $this;
163 }
164
165 /**
166 * @deprecated This method will be removed
167 */
168 public function set_grid($conf = []) {
169 $this->set_page_grid($conf);
170
171 return $this;
172 }
173
174 protected function prepare_pro_links() {
175
176 if(!empty($this->pro_link_conf)) {
177
178 foreach($this->pro_link_conf as $conf) {
179
180 add_submenu_page($this->parent_menu_slug, $conf['anchor'], $conf['anchor'], $conf['permission'], $conf['url'], '');
181 }
182 }
183 }
184
185 protected function prepare_grid_links() {
186
187 if(!empty($this->grids)) {
188
189 add_submenu_page($this->parent_menu_slug, $this->parent_menu_text, $this->parent_menu_text, 'manage_options', $this->text_domain . $this->menu_slug, [$this, 'generate_grids']);
190 }
191 }
192
193
194 public function generate_grids() {
195
196 // Include plugin page header
197 include_once( TIMETICS_PLUGIN_DIR . "templates/layout/header.php" );
198
199 /**
200 * Adding default grid at first position
201 */
202 array_unshift($this->grids, $this->default_grid());
203 ?>
204 <!-- Welcome section -->
205 <div class="tw-help-section tw-setup-widgard-area">
206 <div class="tw-help-hero">
207 <h2><?php echo esc_html__( 'Setup Wizard', 'timetics' );?></h2>
208 <p><?php echo esc_html__( 'To know the eventin starting guide, run the setup wizard. Your existing settings will not change.', 'timetics' );?></p>
209 <a class="etn-btn" href="<?php echo esc_url(admin_url('admin.php?page=etn-wizard')) ?>"><?php echo esc_html__('Start Now', 'timetics'); ?></a>
210 </div>
211 </div>
212 <!-- Welcome section end -->
213 <!-- Welcome section -->
214 <div class="tw-help-section">
215 <div class="tw-help-hero">
216 <h2><?php echo esc_html__( 'Help Center', 'timetics' );?></h2>
217 <p><?php echo esc_html__( 'To help you to get started, we put together the documentation, support link, videos and FAQs here.', 'timetics' );?></p>
218 </div>
219 </div>
220 <!-- Welcome section end -->
221 <!-- Box grid section start -->
222 <div class="pro_aware grid_container tw-help-section">
223 <?php
224 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- kept re-usable for other plugins
225 do_action($this->text_domain.'/pro_awareness/before_grid_contents'); ?>
226 <div class="tw-grid-row">
227 <?php
228 foreach($this->grids as $grid) {
229 ?>
230 <div class="grid tw-grid-item">
231 <div class="wpmet_pro_a-grid-inner">
232 <a target="_blank" href="<?php echo esc_url($grid['url']); ?>"
233 class="wpmet_pro_a_wrapper tw-grid-item-inner" title="<?php echo esc_attr($grid['title']); ?>"
234 title="<?php echo esc_attr($grid['title']); ?>">
235 <div class="wpmet_pro_a_thumb">
236 <img src="<?php echo esc_attr($grid['thumbnail']); ?>" alt="Thumbnail">
237 </div>
238 <!-- // thumbnail -->
239
240 <h4 class="wpmet_pro_a_grid_title tw-grid-title"><?php echo esc_attr($grid['title']); ?></h4>
241 <?php if(!empty($grid['description'])) { ?>
242 <p class="wpmet_pro_a_description tw-grid-button"><?php echo esc_html($grid['description']); ?></p>
243 <!-- // description -->
244 <?php } ?>
245 <!-- // title -->
246 </a>
247 </div>
248 </div>
249 <?php
250 } ?>
251 </div>
252
253 <?php
254 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- kept re-usable for other plugins
255 do_action($this->text_domain.'/pro_awareness/after_grid_contents'); ?>
256 </div>
257 <!-- Box grid section end -->
258 <!-- Commmon FAQ wrapper start -->
259 <div class="tw-help-section">
260 <div class="tw-faq-wrapper">
261 <h3 class="tw-section-title"><?php echo esc_html__('Common FAQs', 'timetics');?></h3>
262 <div class="etn-row">
263 <div class="etn-col-md-6">
264 <div class="tw-accordion-wrapper">
265 <div class="tw-accordion-item">
266 <div class="tw-accordion-content-wrapper">
267 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
268 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
269 </svg>
270 <div class="tw-accordion-content">
271 <h3 class="tw-accordion-title">
272 <?php echo esc_html__('How to create zoom event?', 'timetics'); ?>
273 </h3>
274 <div class="tw-accordion-cotent">
275 <p><?php echo esc_html__('You have to give valid connection details in Eventin=>Settings=>User data.', 'timetics'); ?></p>
276 <p><?php echo esc_html__('After fill up “Api key”, “Secret key” enter “Save changes” and then check connection. After successful connection navigate to Eventin=>Zoom to create a meeting.', 'timetics'); ?></p>
277 <p><?php echo esc_html__('Note: You must have successful connection to zoom api).You will get meeting id from zoom. Place your meeting id to shortcode (For instance: [etn_zoom_api_link meeting_id =’123456789′ link_only=’no’]', 'timetics'); ?></p>
278 <p><?php echo esc_html__('You can also create meeting and display from elementor widget.', 'timetics'); ?></p>
279 </div>
280 </div>
281 </div>
282 </div>
283 <div class="tw-accordion-item">
284 <div class="tw-accordion-content-wrapper">
285 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
286 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
287 </svg>
288 <div class="tw-accordion-content">
289 <h3 class="tw-accordion-title">
290 <?php echo esc_html__('How can I translate event content into my own language?', 'timetics'); ?>
291 </h3>
292 <div class="tw-accordion-cotent">
293 <p><?php echo Helper::kses('If you want to translate in a single language then you can use the <a href="https://wordpress.org/plugins/loco-translate/" target="_blank">Loco Translate</a> plugin. For multi-language translation, you can use the <a href="https://wpml.org/" target="_blank">WPML</a> translator plugin. Simply install the plugin and activate it. After that, please complete the basic settings and you are good to go.', 'timetics'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
294 <p><?php echo Helper::kses('For “Loco Translate”, you can check this <a href="https://youtu.be/6qLkdl97PU0" target="_blank">video tutorial</a> and <a href="https://localise.biz/wordpress/plugin/beginners" target="_blank">documentation</a>. Also, for the WPML multi-language translation, here is the <a href="https://www.youtube.com/watch?v=O7zrroWtrpQ&list=PLs3PkRpIy7BwP5uGV7H2uX34E3MWgdAsH" target="_blank">video</a> and <a href="https://wpml.org/documentation/" target="_blank">documentation</a> link.', 'timetics'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
295 </div>
296 </div>
297 </div>
298 </div>
299 <div class="tw-accordion-item">
300 <div class="tw-accordion-content-wrapper">
301 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
302 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
303 </svg>
304 <div class="tw-accordion-content">
305 <h3 class="tw-accordion-title">
306 <?php echo esc_html__('How to upgrade to Eventin PRO?', 'timetics'); ?>
307 </h3>
308 <div class="tw-accordion-cotent">
309 <p><?php echo Helper::kses('If you buy the plugin from CodeCanyon then you do not need license key activation. Just use the Envato Marketplace plugin to get regular updates. If you buy the plugin from <a href="https://themewinter.com/eventin/" target="_blank">Themewinter website</a> then follow our <a href="https://support.themewinter.com/docs/plugins/plugin-docs/general-settings-eventin/license/" target="_blank">documentation here</a> for activating the PRO license.', 'timetics'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
310 </div>
311 </div>
312 </div>
313 </div>
314 </div>
315 </div>
316 <div class="etn-col-md-6">
317 <div class="tw-accordion-wrapper">
318 <div class="tw-accordion-item">
319 <div class="tw-accordion-content-wrapper">
320 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
321 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
322 </svg>
323 <div class="tw-accordion-content">
324 <h3 class="tw-accordion-title">
325 <?php echo esc_html__('How can I skip adding the price for the ticket?', 'timetics'); ?>
326 </h3>
327 <div class="tw-accordion-cotent">
328 <p><?php echo esc_html__('If you want to host an event without selling tickets, you can arrange it with WPEventin. Woocommerce is not mandatory in this scenario. In that case, simply skip enabling the “Sell on Woocommerce” option. On the other hand, you can enable selling tickets and put the event ticket price as zero(0), then it will act as a free event and your customers don\'t have to pay for that event. In this way, you can skip the price of the tickets.', 'timetics'); ?></p>
329 </div>
330 </div>
331 </div>
332 </div>
333 <div class="tw-accordion-item">
334 <div class="tw-accordion-content-wrapper">
335 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
336 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
337 </svg>
338 <div class="tw-accordion-content">
339 <h3 class="tw-accordion-title">
340 <?php echo esc_html__('I am getting a 404 error. What to do now?', 'timetics'); ?>
341 </h3>
342 <div class="tw-accordion-cotent">
343 <p><?php echo esc_html__('You can get a 404 Not Found error for many reasons in WordPress. However, the most common reason for the 404 error is page permalink. In order to solve the permalink error, please login to your WordPress dashboard and click on settings. Then from permalink, select “ Post name” as permalink structure and save the settings. Solution key wp-admin -> settings -> permalink -> Post name -> Save Changes.', 'timetics'); ?></p>
344 </div>
345 </div>
346 </div>
347 </div>
348 <div class="tw-accordion-item">
349 <div class="tw-accordion-content-wrapper">
350 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
351 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
352 </svg>
353 <div class="tw-accordion-content">
354 <h3 class="tw-accordion-title">
355 <?php echo esc_html__('Does Eventin support different page builders?', 'timetics'); ?>
356 </h3>
357 <div class="tw-accordion-cotent">
358 <p><?php echo esc_html__('Yes. Eventin supports different page builders like DIVI builder, Visual Composer and Elementor page builder. You can use a shortcode for DIVI builder and Visual Composer. And the plugin has 15+ dedicated widgets for the Elementor page builder. Most of the widgets are FREE to use. However, <a href="https://themewinter.com/eventin/" target="_blank">Eventin PRO</a> will be required for a few specific widgets.', 'timetics'); ?></p>
359 </div>
360 </div>
361 </div>
362 </div>
363 </div>
364 </div>
365 </div>
366 </div>
367 </div>
368 <!-- Commmon FAQ wrapper end -->
369 <?php
370 }
371
372 public static function enqueue_scripts( $handle ) {
373 if ( 'toplevel_page_timetics' !== $handle ) {
374 return;
375 }
376 }
377
378 public function insert_plugin_links($links) {
379
380 foreach($this->action_links as $action_link) {
381
382 if(!empty($action_link['link']) && !empty($action_link['text'])) {
383
384 $attributes = '';
385
386 if(!empty($action_link['attr'])) {
387
388 foreach($action_link['attr'] as $key => $val) {
389
390 $attributes .= $key.'="'.esc_attr($val).'" ';
391 }
392 }
393
394 $links[] = sprintf('<a href="%s" ' . $attributes . ' > %s </a>', $action_link['link'], esc_html($action_link['text']));
395 }
396 }
397
398
399 return $links;
400 }
401
402 public function insert_plugin_row_meta($links, $file) {
403 if($file == $this->plugin_file) {
404
405 foreach($this->row_meta_links as $meta) {
406
407 if(!empty($meta['link']) && !empty($meta['text'])) {
408
409 $attributes = '';
410
411 if(!empty($meta['attr'])) {
412
413 foreach($meta['attr'] as $key => $val) {
414
415 $attributes .= $key.'="'.esc_attr($val).'" ';
416 }
417 }
418
419 $links[] = sprintf('<a href="%s" %s > %s </a>', $meta['link'], $attributes, esc_html($meta['text']));
420 }
421 }
422
423 }
424
425 return $links;
426 }
427
428 public function set_plugin_action_link($text, $link, $attr = []) {
429
430 $this->action_links[] = [
431 'text' => $text,
432 'link' => $link,
433 'attr' => $attr,
434 ];
435
436 return $this;
437 }
438
439 public function set_plugin_row_meta($text, $link, $attr = []) {
440
441 $this->row_meta_links[] = [
442 'text' => $text,
443 'link' => $link,
444 'attr' => $attr,
445 ];
446
447 return $this;
448 }
449
450 public function generate_menus() {
451 add_filter('plugin_action_links_' . $this->plugin_file, [$this, 'insert_plugin_links']);
452 add_filter('plugin_row_meta', [$this, 'insert_plugin_row_meta'], 10, 2);
453
454 if(!empty($this->parent_menu_slug)) {
455 $this->prepare_grid_links();
456 $this->prepare_pro_links();
457 }
458 }
459
460 public static function init() {
461 add_action('admin_enqueue_scripts', [__CLASS__, 'enqueue_scripts' ]);
462 }
463
464 public function call() {
465 add_action('admin_menu', [$this, 'generate_menus'], 99999);
466 }
467 }
468
469 endif;
470