PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.14
Timetics – Appointment Booking Calendar & Scheduling v1.0.14
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.14, at utils/pro-awareness/pro-awareness.php

693 lines 21.7 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 do_action($this->text_domain.'/pro_awareness/before_grid_contents'); ?>
224 <div class="tw-grid-row">
225 <?php
226 foreach($this->grids as $grid) {
227 ?>
228 <div class="grid tw-grid-item">
229 <div class="wpmet_pro_a-grid-inner">
230 <a target="_blank" href="<?php echo esc_url($grid['url']); ?>"
231 class="wpmet_pro_a_wrapper tw-grid-item-inner" title="<?php echo esc_attr($grid['title']); ?>"
232 title="<?php echo esc_attr($grid['title']); ?>">
233 <div class="wpmet_pro_a_thumb">
234 <img src="<?php echo esc_attr($grid['thumbnail']); ?>" alt="Thumbnail">
235 </div>
236 <!-- // thumbnail -->
237
238 <h4 class="wpmet_pro_a_grid_title tw-grid-title"><?php echo esc_attr($grid['title']); ?></h4>
239 <?php if(!empty($grid['description'])) { ?>
240 <p class="wpmet_pro_a_description tw-grid-button"><?php echo esc_html($grid['description']); ?></p>
241 <!-- // description -->
242 <?php } ?>
243 <!-- // title -->
244 </a>
245 </div>
246 </div>
247 <?php
248 } ?>
249 </div>
250
251 <?php do_action($this->text_domain.'/pro_awareness/after_grid_contents'); ?>
252 </div>
253 <!-- Box grid section end -->
254 <!-- Commmon FAQ wrapper start -->
255 <div class="tw-help-section">
256 <div class="tw-faq-wrapper">
257 <h3 class="tw-section-title"><?php echo esc_html('Common FAQs', 'eventin');?></h3>
258 <div class="etn-row">
259 <div class="etn-col-md-6">
260 <div class="tw-accordion-wrapper">
261 <div class="tw-accordion-item">
262 <div class="tw-accordion-content-wrapper">
263 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
264 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
265 </svg>
266 <div class="tw-accordion-content">
267 <h3 class="tw-accordion-title">
268 <?php echo esc_html__('How to create zoom event?', 'timetics'); ?>
269 </h3>
270 <div class="tw-accordion-cotent">
271 <p><?php echo esc_html__('You have to give valid connection details in Eventin=>Settings=>User data.', 'timetics'); ?></p>
272 <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>
273 <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>
274 <p><?php echo esc_html__('You can also create meeting and display from elementor widget.', 'timetics'); ?></p>
275 </div>
276 </div>
277 </div>
278 </div>
279 <div class="tw-accordion-item">
280 <div class="tw-accordion-content-wrapper">
281 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
282 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
283 </svg>
284 <div class="tw-accordion-content">
285 <h3 class="tw-accordion-title">
286 <?php echo esc_html__('How can I translate event content into my own language?', 'timetics'); ?>
287 </h3>
288 <div class="tw-accordion-cotent">
289 <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.', 'eventin'); ?></p>
290 <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.', 'eventin'); ?></p>
291 </div>
292 </div>
293 </div>
294 </div>
295 <div class="tw-accordion-item">
296 <div class="tw-accordion-content-wrapper">
297 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
298 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
299 </svg>
300 <div class="tw-accordion-content">
301 <h3 class="tw-accordion-title">
302 <?php echo esc_html__('How to upgrade to Eventin PRO?', 'timetics'); ?>
303 </h3>
304 <div class="tw-accordion-cotent">
305 <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.', 'eventin'); ?></p>
306 </div>
307 </div>
308 </div>
309 </div>
310 </div>
311 </div>
312 <div class="etn-col-md-6">
313 <div class="tw-accordion-wrapper">
314 <div class="tw-accordion-item">
315 <div class="tw-accordion-content-wrapper">
316 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
317 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
318 </svg>
319 <div class="tw-accordion-content">
320 <h3 class="tw-accordion-title">
321 <?php echo esc_html__('How can I skip adding the price for the ticket?', 'timetics'); ?>
322 </h3>
323 <div class="tw-accordion-cotent">
324 <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>
325 </div>
326 </div>
327 </div>
328 </div>
329 <div class="tw-accordion-item">
330 <div class="tw-accordion-content-wrapper">
331 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
332 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
333 </svg>
334 <div class="tw-accordion-content">
335 <h3 class="tw-accordion-title">
336 <?php echo esc_html__('I am getting a 404 error. What to do now?', 'timetics'); ?>
337 </h3>
338 <div class="tw-accordion-cotent">
339 <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>
340 </div>
341 </div>
342 </div>
343 </div>
344 <div class="tw-accordion-item">
345 <div class="tw-accordion-content-wrapper">
346 <svg width="16" height="10" viewBox="0 0 16 10" fill="none" xmlns="http://www.w3.org/2000/svg">
347 <path d="M14 2L8 8L2 2" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
348 </svg>
349 <div class="tw-accordion-content">
350 <h3 class="tw-accordion-title">
351 <?php echo esc_html__('Does Eventin support different page builders?', 'timetics'); ?>
352 </h3>
353 <div class="tw-accordion-cotent">
354 <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>
355 </div>
356 </div>
357 </div>
358 </div>
359 </div>
360 </div>
361 </div>
362 </div>
363 </div>
364 <!-- Commmon FAQ wrapper end -->
365 <?php
366 }
367
368 public static function enqueue_scripts() {
369 $tw_welcome_image = TIMETICS_PLUGIN_URL . 'utils/pro-awareness/assets/welcome_image.png';
370 $tw_setup_image = TIMETICS_PLUGIN_URL . 'utils/pro-awareness/assets/setup_wizard.png';
371 echo "
372 <script>
373
374 </script>
375
376 <style>
377 .wpmet_pro_a-grid-container {
378 max-width: 1140px;
379 width: 100%;
380 padding-right: 15px;
381 padding-left: 15px;
382 box-sizing: border-box;
383 margin-top: 50px;
384 }
385 .wpmet_pro_a-row {
386 display: -webkit-box;
387 display: -ms-flexbox;
388 display: flex;
389 -ms-flex-wrap: wrap;
390 flex-wrap: wrap;
391 margin-right: -15px;
392 margin-left: -15px;
393 box-sizing: border-box;
394 }
395
396 .wpmet_pro_a-grid {
397 padding-right: 15px;
398 padding-left: 15px;
399 position: relative;
400 width: 100%;
401 min-height: 1px;
402 box-sizing: border-box;
403 }
404
405 .wpmet_pro_a_thumb {
406 min-height: unset;
407 margin-bottom: 35px;
408 display: block;
409 border-radius: inherit;
410 }
411
412
413 .wp-submenu > li > a{
414 position: relative;
415 }
416
417
418 /* Themewinter sections style */
419 .tw-grid-row {
420 display: grid;
421 grid-template-columns: 1fr;
422 gap: 30px;
423 }
424 .tw-help-section {
425 max-width: 100%;
426 padding: 0 40px 0 20px;
427 }
428 .tw-help-hero {
429 padding: 30px 67% 30px 40px;
430 background-color: #fff;
431 background-image: none;
432 border-radius: 6px;
433 margin: 40px 0;
434 background-size: 60%;
435 background-repeat: no-repeat;
436 background-position: 100% 100%;
437 }
438 .tw-setup-widgard-area .tw-help-hero {
439 padding: 50px 65% 50px 40px;
440 }
441
442 .tw-help-hero h2 {
443 font-size: 30px;
444 line-height: 1;
445 color: #000000;
446 margin: 0;
447 }
448 .tw-help-hero p {
449 font-size: 1rem;
450 color: #71787C;
451 }
452 .tw-grid-item-inner {
453 padding: 40px;
454 display: block;
455 text-align: left;
456 background-color: #fff;
457 border-radius: 8px;
458 text-decoration: none;
459 min-height: 270px;
460 box-sizing: border-box;
461 }
462 .tw-grid-title {
463 font-size: 20px;
464 margin: 0;
465 color: #000;
466 display: block;
467 line-height: 24px;
468 }
469 .tw-grid-button {
470 margin-bottom: 0;
471 display: inline-block;
472 border: 2px solid #E3106E;
473 border-radius: 6px;
474 padding: 9px 16px;
475 font-size: 15px;
476 font-weight: 600;
477 color: #E3106E;
478 margin-top: 20px;
479 line-height: 1;
480 transition: .3s ease;
481 }
482 .tw-grid-button:hover {
483 transform: translateY(-5px);
484 background-color: #E3106E;
485 color: #ffffff;
486 }
487 .tw-faq-wrapper {
488 background: #fff;
489 padding: 40px;
490 margin-top: 30px;
491 border-radius: 8px;
492 }
493 .tw-accordion-content-wrapper {
494 border: 1px solid #E4E6EB;
495 border-radius: 8px;
496 padding: 20px;
497 display: flex;
498 align-items: baseline;
499 }
500 .tw-accordion-content {
501 padding-left: 20px;
502 flex: 0 0 95%;
503 }
504 .tw-accordion-content-wrapper svg {
505 transition: all .3s ease;
506 flex: 0 0 20px;
507 }
508 .tw-accordion-content-wrapper.item-active {
509 background-color: #F7F8FB;
510 }
511 .tw-accordion-content-wrapper.item-active svg {
512 transform: rotate(180deg);
513 }
514 .tw-section-title {
515 margin: 0 0 30px;
516 font-size: 24px;
517 font-weight: 600;
518 line-height: 28px;
519 }
520 .tw-accordion-title {
521 margin: 0;
522 cursor: pointer;
523 font-size: 18px;
524 font-weight: 700;
525 }
526
527
528 .tw-accordion-item {
529 margin-bottom: 20px;
530 }
531 .tw-accordion-cotent {
532 display: none;
533 padding-top: 10px;
534 }
535 .tw-accordion-cotent p {
536 margin: 0;
537 font-size: 1rem;
538 color: #44464B;
539 }
540 .tw-accordion-cotent p:not(:last-child) {
541 margin-bottom: 10px;
542 }
543 @media (min-width: 991px) {
544 .tw-grid-row {
545 grid-template-columns: repeat(3, 1fr);
546 }
547 .tw-help-hero {
548 background-image: url($tw_welcome_image);
549 }
550 .tw-setup-widgard-area .tw-help-hero p {
551 margin-bottom: 25px;
552 }
553 .tw-setup-widgard-area .tw-help-hero {
554 background-image: url($tw_setup_image);
555 background-position: 95% 100%;
556 background-size: contain;
557 }
558 .tw-accordion-content-wrapper {
559 padding: 25px 30px;
560 }
561 .tw-help-hero h2 {
562 font-size: 36px;
563 }
564
565 }
566 @media (min-width: 1366px) {
567 .tw-grid-row {
568 grid-template-columns: repeat(4, 1fr);
569 }
570 .tw-help-hero {
571 background-position: 95% 100%;
572 background-size: 35%;
573 }
574 .tw-accordion-wrapper {
575 grid-template-columns: repeat(2, 1fr);
576 }
577 }
578 @media (max-width: 1024px) and (min-width: 768px) {
579 .tw-grid-row {
580 grid-template-columns: repeat(2, 1fr);
581 }
582 .tw-help-hero,
583 .tw-setup-widgard-area .tw-help-hero {
584 background-position: 154% 0px;
585 background-size: 74%;
586 }
587 }
588 @media (max-width: 991px) {
589 .tw-help-hero,
590 .tw-setup-widgard-area .tw-help-hero {
591 padding: 30px;
592 }
593 .tw-faq-wrapper {
594 padding: 30px;
595 }
596 }
597 </style>
598 ";
599 }
600
601 public function insert_plugin_links($links) {
602
603 foreach($this->action_links as $action_link) {
604
605 if(!empty($action_link['link']) && !empty($action_link['text'])) {
606
607 $attributes = '';
608
609 if(!empty($action_link['attr'])) {
610
611 foreach($action_link['attr'] as $key => $val) {
612
613 $attributes .= $key.'="'.esc_attr($val).'" ';
614 }
615 }
616
617 $links[] = sprintf('<a href="%s" ' . $attributes . ' > %s </a>', $action_link['link'], esc_html($action_link['text']));
618 }
619 }
620
621
622 return $links;
623 }
624
625 public function insert_plugin_row_meta($links, $file) {
626 if($file == $this->plugin_file) {
627
628 foreach($this->row_meta_links as $meta) {
629
630 if(!empty($meta['link']) && !empty($meta['text'])) {
631
632 $attributes = '';
633
634 if(!empty($meta['attr'])) {
635
636 foreach($meta['attr'] as $key => $val) {
637
638 $attributes .= $key.'="'.esc_attr($val).'" ';
639 }
640 }
641
642 $links[] = sprintf('<a href="%s" %s > %s </a>', $meta['link'], $attributes, esc_html($meta['text']));
643 }
644 }
645
646 }
647
648 return $links;
649 }
650
651 public function set_plugin_action_link($text, $link, $attr = []) {
652
653 $this->action_links[] = [
654 'text' => $text,
655 'link' => $link,
656 'attr' => $attr,
657 ];
658
659 return $this;
660 }
661
662 public function set_plugin_row_meta($text, $link, $attr = []) {
663
664 $this->row_meta_links[] = [
665 'text' => $text,
666 'link' => $link,
667 'attr' => $attr,
668 ];
669
670 return $this;
671 }
672
673 public function generate_menus() {
674 add_filter('plugin_action_links_' . $this->plugin_file, [$this, 'insert_plugin_links']);
675 add_filter('plugin_row_meta', [$this, 'insert_plugin_row_meta'], 10, 2);
676
677 if(!empty($this->parent_menu_slug)) {
678 $this->prepare_grid_links();
679 $this->prepare_pro_links();
680 }
681 }
682
683 public static function init() {
684 add_action('admin_head', [__CLASS__, 'enqueue_scripts']);
685 }
686
687 public function call() {
688 add_action('admin_menu', [$this, 'generate_menus'], 99999);
689 }
690 }
691
692 endif;
693