forked from Awesome-Support/Awesome-Support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
awesome-support.php
701 lines (601 loc) · 23.8 KB
/
awesome-support.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
<?php
/**
* @package Awesome Support
* @author Awesome Support Team <[email protected]>
* @license GPL-2.0+
* @link https://getawesomesupport.com
* @copyright 2014-2017 AwesomeSupport
*
* @wordpress-plugin
* Plugin Name: Awesome Support
* Plugin URI: https://getawesomesupport.com
* Description: Awesome Support is a great ticketing system that will help you improve your customer satisfaction by providing a unique customer support experience.
* Version: 6.2.2
* Author: Awesome Support Team
* Author URI: https://getawesomesupport.com
* Text Domain: awesome-support
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Check to see if we're even allowed to load Awesome Support
$load_allowed = apply_filters( 'wpas_allow_loading', true ) ;
if ( ! $load_allowed ) {
die;
}
// Check to see if we're allowed to load Awesome Support.
// With this filter we allow other scripts to run by returning instead of
// dieing.
$soft_load_allowed = apply_filters( 'wpas_allow_soft_loading', true ) ;
if ( ! $soft_load_allowed ) {
return;
}
if ( ! class_exists( 'Awesome_Support' ) ):
/**
* Main Awesome Support class
*
* This class is the one and only instance of the plugin. It is used
* to load the core and all its components.
*
* @since 3.2.5
*/
final class Awesome_Support {
/**
* @var Awesome_Support Holds the unique instance of Awesome Support
* @since 3.2.5
*/
private static $instance;
/**
* Possible error message.
*
* @since 3.3
* @var null|WP_Error
*/
protected $error = null;
/**
* Minimum version of WordPress required ot run the plugin
*
* @since 3.3
* @var string
*/
public $wordpress_version_required = '3.8';
/**
* Required version of PHP.
*
* Follow WordPress latest requirements and require
* PHP version 5.2 at least.
*
* @since 3.3
* @var string
*/
public $php_version_required = '7.1';
/**
* Holds the WPAS_Custom_Fields instance
*
* @since 3.3
* @var WPAS_Custom_Fields
*/
public $custom_fields;
/**
* List of registered addons
*
* @since 3.3
* @var array
*/
public $addons = array();
/**
* Admin Notices object
*
* @var object AS_Admin_Notices
* @since 3.1.5
*/
public $admin_notices;
/**
* Session object
*
* @since 3.2.6
* @var WPAS_Session $session
*/
public $session;
/**
* Products synchronization object
*
* Only used if there is a compatible e-commerce plugin active
*
* @since 3.3
* @var null|WPAS_Product_Sync
*/
public $products_sync;
/**
* Instantiate and return the unique Awesome Support object
*
* @since 3.2.5
* @return object Awesome_Support Unique instance of Awesome Support
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Awesome_Support ) ) {
self::$instance = new Awesome_Support;
self::$instance->init();
}
return self::$instance;
}
/**
* Instantiate the plugin
*
* @since 3.3
* @return void
*/
private function init() {
// First of all we need the constants
self::$instance->setup_constants();
// Make sure the WordPress version is recent enough
if ( ! self::$instance->is_version_compatible() ) {
self::$instance->add_error( sprintf( esc_html__( 'Awesome Support requires WordPress version %s or above. Please update WordPress to run this plugin.', 'awesome-support' ), self::$instance->wordpress_version_required ) );
}
// Make sure we have a version of PHP that's not too old
if ( ! self::$instance->is_php_version_enough() ) {
self::$instance->add_error( sprintf( esc_html__( 'Awesome Support requires PHP version %s or above. Read more information about ', 'awesome-support' ).'<a %s>'. esc_html__( 'how you can update', 'awesome-support' ).'</a>.', self::$instance->php_version_required, 'href="http://www.wpupdatephp.com/update/" target="_blank"' ) );
}
// Check that the vendor directory is present
if ( ! self::$instance->dependencies_loaded() ) {
self::$instance->add_error( sprintf( esc_html__( 'Awesome Support dependencies are missing. The plugin can’t be loaded properly. Please run %s before anything else. If you don’t know what this is you should','awesome-support').' <a href="%s" class="thickbox">'.esc_html__('install the production version', 'awesome-support' ).'</a>'.esc_html__(' of this plugin instead.', 'awesome-support' ), '<a href="https://getcomposer.org/doc/00-intro.md#using-composer" target="_blank"><code>composer install</code></a>', esc_url( add_query_arg( array(
'tab' => 'plugin-information',
'plugin' => 'awesome-support',
'TB_iframe' => 'true',
'width' => '772',
'height' => '935'
), admin_url( 'plugin-install.php' ) ) ) ) );
}
// If we have any error, don't load the plugin
if ( is_a( self::$instance->error, 'WP_Error' ) ) {
add_action( 'admin_notices', array( self::$instance, 'display_error' ), 10, 0 );
return;
}
self::$instance->includes();
self::$instance->session = new WPAS_Session();
self::$instance->custom_fields = new WPAS_Custom_Fields;
self::$instance->maybe_setup();
if ( is_admin() ) {
self::$instance->includes_admin();
self::$instance->admin_notices = new AS_Admin_Notices();
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
add_action( 'plugins_loaded', array( 'WPAS_Upgrade', 'get_instance' ), 11, 0 );
add_action( 'plugins_loaded', array( 'WPAS_Tickets_List', 'get_instance' ), 11, 0 );
add_action( 'plugins_loaded', array( 'WPAS_User', 'get_instance' ), 11, 0 );
add_action( 'plugins_loaded', array( 'WPAS_Gas', 'get_instance' ), 11, 0 );
add_action( 'plugins_loaded', array( 'WPAS_Help', 'get_instance' ), 11, 0 );
/* User stats tracking from the Wisdom plugin */
add_action( 'plugins_loaded', array( self::$instance, 'awesome_support_start_plugin_tracking' ), 11, 0);
add_filter( 'wisdom_notice_text_' . basename( __FILE__, '.php' ), array( self::$instance, 'awesome_support_tracking_notification_text' ) );
add_filter( 'wisdom_delay_notification_' . basename( __FILE__, '.php' ), array( self::$instance, 'awesome_support_tracking_delay_notification' ) );
}
}
add_action( 'plugins_loaded', array( 'WPAS_File_Upload', 'get_instance' ), 11, 0 );
add_action( 'plugins_loaded', array( 'WPAS_Privacy_Option', 'get_instance' ), 11, 0 );
add_action( 'plugins_loaded', array( 'WPAS_GDPR_User_Profile', 'get_instance' ), 11, 0 );
add_action( 'plugins_loaded', array( self::$instance, 'load_plugin_textdomain' ) );
add_action( 'init', array( self::$instance, 'load_theme_functions' ) );
add_action( 'plugins_loaded', array( self::$instance, 'remote_notifications' ), 15, 0 );
}
/**
* Throw error on object clone
*
* The whole idea of the singleton design pattern is that there is a single
* object therefore, we don't want the object to be cloned.
*
* @since 3.2.5
* @return void
*/
public function __clone() {
// Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'awesome-support' ), '3.2.5' );
}
/**
* Disable unserializing of the class
*
* @since 3.2.5
* @return void
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'awesome-support' ), '3.2.5' );
}
/**
* Setup all plugin constants
*
* @since 3.2.5
* @return void
*/
private function setup_constants() {
define( 'WPAS_VERSION', '6.2.2' );
define( 'WPAS_DB_VERSION', '1' );
define( 'WPAS_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'WPAS_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'WPAS_ROOT', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
define( 'WPAS_TEMPLATE_PATH', 'awesome-support/' );
define( 'WPAS_ADMIN_ASSETS_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'assets/admin/' ) );
define( 'WPAS_ADMIN_ASSETS_PATH', trailingslashit( plugin_dir_path( __FILE__ ) . 'assets/admin/' ) );
define( 'WPAS_PLUGIN_FILE', __FILE__ );
define( 'WPAS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
}
/**
* Check if plugin dependencies are present.
*
* @since 3.0.2
* @return boolean True of dependencies are here, false otherwise
*/
private function dependencies_loaded() {
if ( ! is_dir( WPAS_PATH . 'vendor' ) ) {
return false;
}
return true;
}
/**
* Check if the core version is compatible with this addon.
*
* @since 3.3
* @return boolean
*/
private function is_version_compatible() {
if ( empty( self::$instance->wordpress_version_required ) ) {
return true;
}
if ( version_compare( get_bloginfo( 'version' ), self::$instance->wordpress_version_required, '<' ) ) {
return false;
}
return true;
}
/**
* Check if the version of PHP is compatible with this addon.
*
* @since 3.3
* @return boolean
*/
private function is_php_version_enough() {
/**
* No version set, we assume everything is fine.
*/
if ( empty( self::$instance->php_version_required ) ) {
return true;
}
if ( version_compare( phpversion(), self::$instance->php_version_required, '<' ) ) {
return false;
}
return true;
}
/**
* Add error.
*
* Add a new error to the WP_Error object
* and create the object if it doesn't exist yet.
*
* @since 3.3
*
* @param string $message Error message to add
*
* @return void
*/
private function add_error( $message ) {
if ( ! is_object( $this->error ) || ! is_a( $this->error, 'WP_Error' ) ) {
$this->error = new WP_Error();
}
$this->error->add( 'addon_error', $message );
}
/**
* Display error.
*
* Get all the error messages and display them
* in the admin notices.
*
* @since 3.3
* @return void
*/
public function display_error() {
if ( ! is_a( $this->error, 'WP_Error' ) ) {
return;
}
$message = self::$instance->error->get_error_messages(); ?>
<div class="error">
<p>
<?php
if ( count( $message ) > 1 ) {
echo '<ul>';
foreach ( $message as $msg ) {
echo '<li>' . wp_kses_post($msg) . '</li>';
}
echo '</ul>';
} else {
echo wp_kses_post($message[0]);
}
?>
</p>
</div>
<?php
}
/**
* Include all files used sitewide
*
* @since 3.2.5
* @return void
*/
private function includes() {
require( WPAS_PATH . 'includes/functions-fallback.php' );
require( WPAS_PATH . 'includes/class-logger.php' );
require( WPAS_PATH . 'includes/integrations/ecommerce.php' );
require( WPAS_PATH . 'includes/scripts.php' );
require( WPAS_PATH . 'includes/shortcodes/shortcode-tickets.php' );
require( WPAS_PATH . 'includes/shortcodes/shortcode-submit.php' );
require( WPAS_PATH . 'includes/file-uploader/class-file-uploader.php' );
require( WPAS_PATH . 'includes/class-mailgun-email-check.php' );
require( WPAS_PATH . 'includes/custom-fields/class-custom-field.php' );
require( WPAS_PATH . 'includes/custom-fields/class-custom-fields.php' );
require( WPAS_PATH . 'includes/custom-fields/functions-custom-fields.php' );
require( WPAS_PATH . 'includes/gdpr-integration/gdpr-privacy-options.php' );
require( WPAS_PATH . 'includes/gdpr-integration/gdpr-user-profile.php' );
require( WPAS_PATH . 'includes/functions-actions.php' );
require( WPAS_PATH . 'includes/functions-post.php' );
require( WPAS_PATH . 'includes/functions-user.php' );
require( WPAS_PATH . 'includes/functions-addons.php' );
require( WPAS_PATH . 'includes/functions-deprecated.php' );
require( WPAS_PATH . 'includes/class-log-history.php' );
require( WPAS_PATH . 'includes/class-email-notifications.php' );
require( WPAS_PATH . 'includes/class-user-email-notification.php' );
require( WPAS_PATH . 'includes/functions-general.php' );
require( WPAS_PATH . 'includes/functions-error.php' );
require( WPAS_PATH . 'includes/functions-notification.php' );
require( WPAS_PATH . 'includes/functions-email-notifications.php' );
require( WPAS_PATH . 'includes/functions-templating.php' );
require( WPAS_PATH . 'includes/functions-post-type.php' );
require( WPAS_PATH . 'includes/class-product-sync.php' );
require( WPAS_PATH . 'includes/class-gist.php' );
require( WPAS_PATH . 'includes/class-wpas-editor-ajax.php' );
require( WPAS_PATH . 'includes/class-member-query.php' );
require( WPAS_PATH . 'includes/class-member.php' );
require( WPAS_PATH . 'includes/class-member-agent.php' );
require( WPAS_PATH . 'includes/class-member-user.php' );
require( WPAS_PATH . 'includes/class-wpas-session.php' );
require( WPAS_PATH . 'includes/functions-reply.php' );
require( WPAS_PATH . 'includes/functions-channels.php' );
require( WPAS_PATH . 'includes/functions-ticket-type.php' );
require( WPAS_PATH . 'includes/functions-priority.php' );
require( WPAS_PATH . 'includes/admin/settings/functions-settings.php' );
require( WPAS_PATH . 'includes/install.php' );
/* Composer autoload */
require( WPAS_PATH . 'vendor/autoload.php' );
// GAS Framework
require( WPAS_PATH . 'includes/gas-framework/gas-framework.php' );
/* Load Rest API */
require( WPAS_PATH . 'includes/rest-api/awesome-support-api.php' );
/* Simple WooCommerce Integration */
require( WPAS_PATH . 'includes/integrations/wc-account.php' );
/* myCRED Integration */
require( WPAS_PATH . 'includes/integrations/my-cred/my-cred.php' );
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
require( WPAS_PATH . 'includes/functions-admin-bar.php' );
// Compatibility functions
require( 'includes/compatibility/sensei.php' );
require( 'includes/compatibility/acf-pro.php' );
require( 'includes/compatibility/wpml.php' );
require( 'includes/compatibility/divi.php' );
require( 'includes/compatibility/wc.php' );
}
}
/**
* Include all files used in admin only
*
* @since 3.2.5
* @return void
*/
private function includes_admin() {
require( WPAS_PATH . 'includes/admin/functions-notices.php' );
require( WPAS_PATH . 'includes/admin/functions-ajax.php' );
require( WPAS_PATH . 'includes/admin/functions-log-viewer.php' );
require( WPAS_PATH . 'includes/admin/functions-admin-ticket-detail-toolbars.php' );
require( WPAS_PATH . 'includes/admin/functions-toolbar.php' );
if ( ! class_exists( 'TAV_Remote_Notification_Client' ) ) {
if ( ! defined( 'WPAS_REMOTE_NOTIFICATIONS_OFF' ) || true !== WPAS_REMOTE_NOTIFICATIONS_OFF ) {
require( WPAS_PATH . 'includes/class-remote-notification-client.php' );
}
}
// We don't need all this during Ajax processing
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
require( WPAS_PATH . 'includes/admin/functions-menu.php' );
require( WPAS_PATH . 'includes/admin/functions-post.php' );
require( WPAS_PATH . 'includes/admin/functions-tools.php' );
require( WPAS_PATH . 'includes/admin/functions-list-table.php' );
require( WPAS_PATH . 'includes/admin/functions-metaboxes.php' );
require( WPAS_PATH . 'includes/admin/functions-user-profile.php' );
require( WPAS_PATH . 'includes/admin/functions-admin-actions.php' );
require( WPAS_PATH . 'includes/admin/functions-misc.php' );
require( WPAS_PATH . 'includes/admin/functions-editor.php' );
require( WPAS_PATH . 'includes/admin/functions-agent-chat.php' );
require( WPAS_PATH . 'includes/admin/class-admin-tickets-list.php' );
require( WPAS_PATH . 'includes/admin/class-admin-user.php' );
require( WPAS_PATH . 'includes/admin/class-as-admin-setup-wizard.php' );
require( WPAS_PATH . 'includes/admin/class-admin-gas.php' );
require( WPAS_PATH . 'includes/admin/class-admin-help.php' );
require( WPAS_PATH . 'includes/admin/upgrade/class-upgrade.php' );
/* Load settings files */
require( WPAS_PATH . 'includes/admin/settings/settings-general.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-registration.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-moderated-registration.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-privacy.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-fields.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-permissions.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-style.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-notifications.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-advanced.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-licenses.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-products-management.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-basic-time-tracking.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-language.php' );
require( WPAS_PATH . 'includes/admin/settings/settings-integration.php' );
/* Load Gutenberg related files */
require( WPAS_PATH . 'includes/admin/gutenberg/functions-gutenberg-post-type.php' );
require( WPAS_PATH . 'includes/admin/gutenberg/functions-gutenberg.php' );
/* Wisdom Tracking */
require( WPAS_PATH . '/tracking/class-plugin-usage-tracker.php' );
}
}
/**
* Plugin setup.
*
* If the plugin has just been installed we need to set a couple of things.
* We will automatically create the "special" pages: tickets list and
* ticket submission.
*/
private function maybe_setup() {
if ( 'pending' === get_option( 'wpas_setup', false ) ) {
add_action( 'admin_init', 'wpas_create_pages', 11, 0 );
add_action( 'admin_init', 'wpas_flush_rewrite_rules', 11, 0 );
add_action( 'admin_init', 'wpas_install_default_email_templates', 11, 0 );
}
/**
* Ask for setup plugin using Setup wizard.
* Proceed only if both 'wpas_plugin_setup' & 'wpas_skip_wizard_setup' = false
* 'wpas_plugin_setup' will be added at the end of wizard steps
* 'wpas_skip_wizard_setup' will be set to true if user choose to skip wizrd from admin notice
*/
if ( ! get_option( 'wpas_plugin_setup', false ) && ! get_option( 'wpas_skip_wizard_setup', false ) ) {
add_action( 'admin_notices', 'wpas_ask_setup_wizard', 1 );
}
}
/**
* Load the plugin text domain for translation.
*
* With the introduction of plugins language packs in WordPress loading the textdomain is slightly more complex.
*
* We now have 3 steps:
*
* 1. Check for the language pack in the WordPress core directory
* 2. Check for the translation file in the plugin's language directory
* 3. Fallback to loading the textdomain the classic way
*
* @since 1.0.0
* @return boolean True if the language file was loaded, false otherwise
*/
public function load_plugin_textdomain() {
$lang_dir = WPAS_ROOT . 'languages/';
$lang_path = WPAS_PATH . 'languages/';
$locale = apply_filters( 'plugin_locale', get_locale(), 'awesome-support' );
$mofile = "awesome-support-$locale.mo";
$glotpress_file = WP_LANG_DIR . '/plugins/awesome-support/' . $mofile;
// Look for the GlotPress language pack first of all
if ( file_exists( $glotpress_file ) ) {
$language = load_textdomain( 'awesome-support', $glotpress_file );
} elseif ( file_exists( $lang_path . $mofile ) ) {
$language = load_textdomain( 'awesome-support', $lang_path . $mofile );
} else {
$language = load_plugin_textdomain( 'awesome-support', false, $lang_dir );
}
return $language;
}
/**
* Load Awesome Support's theme functions if any
*
* @since 3.2.0
* @return void
*/
public function load_theme_functions() {
wpas_get_template( 'functions' );
}
/**
* Check for remote notifications.
*
* Use the Remote Dashboard Notifications plugin
* to check for possible notifications from
* http://getawesomesupport.com
*
* @since 3.0.0
* @link https://wordpress.org/plugins/remote-dashboard-notifications/
* @return void
*/
public function remote_notifications() {
if ( wpas_is_asadmin() && function_exists( 'rdnc_add_notification' ) && ( ! defined( 'WPAS_REMOTE_NOTIFICATIONS_OFF' ) || true !== WPAS_REMOTE_NOTIFICATIONS_OFF ) ) {
rdnc_add_notification( 2, '77a8b884c6e778b4', 'https://notifications.getawesomesupport.com' );
}
}
/**
* Start application statistics tracking
*
* Use the WISDOM Tracking plugin to track
* application usage.
* https://wisdomplugin.com/support/#getting-started
*
* Filter: plugins_loaded
*
* @since 4.4.0
* @return void
*/
public function awesome_support_start_plugin_tracking() {
$wisdom = new Plugin_Usage_Tracker(
__FILE__,
'https://tracking.getawesomesupport.com',
array(),
true,
true,
1
);
}
/**
* Application statistics tracking opt-in text
*
* We use the WISDOM Tracking plugin to track
* application usage. This allows us to set the
* opt-in text shown to the user when they activate the plugin.
*
* https://wisdomplugin.com/support/#getting-started
*
* Filter: wisdom_notice_text_
*
* @param text default notice text.
*
* @since 4.4.0
*
* @return text the notice text to be shown to the user
*/
function awesome_support_tracking_notification_text( $notice_text ) {
$notice_text = '<b>'.esc_html__( 'Would you like a discount on your next Awesome Support purchase?', 'awesome-support').'</b>'. esc_html__('Help us make a better product for you by allowing us to collect some system statistics and adding you to our email list for important updates. We won’t record any sensitive data, only information regarding the WordPress environment and product settings, which we will use to help us make improvements to the product. ', 'awesome-support').'<b>'. esc_html__('Tracking is completely optional', 'awesome-support').'</b>'. esc_html__('. To show our appreciation for helping make Awesome Support better,', 'awesome-support').' <b>'. esc_html__('when you opt-in we will send you a discount code good towards your next purchase', 'awesome-support').'</b>'. esc_html__('. And, opting in would allow us to send you any critical security related information directly - which, in most instances, would be much faster than receiving it from other sources.', 'awesome-support' );
$notice_text = $notice_text . sprintf( ' <a %s>'. esc_html__('Find out more about what data we collect and how its used.' , 'awesome-support').'</a> <a %s>'.esc_html__('View our privacy policy.','awesome-support').'</a>', 'a href="https://getawesomesupport.com/legal/tracking-statistics/" target="_blank"', 'a href="https://getawesomesupport.com/legal/privacy-policy/" target="_blank"' );
return $notice_text;
}
/**
* Application statistics tracking opt-in text
*
* We use the WISDOM Tracking plugin to track
* application usage. This allows us to set the
* time delay before the opt-in notice shows up.
*
* https://wisdomplugin.com/support/#getting-started
*
* Filter: wisdom_delay_notification_
*
* @param text default notice text.
*
* @since 4.4.0
*
* @return text the notice text to be shown to the user
*/
function awesome_support_tracking_delay_notification( $delay ) {
return 900; // 15 mins
}
}
endif;
/**
* The main function responsible for returning the unique Awesome Support instance
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* @since 3.1.5
* @return object Awesome_Support
*/
function WPAS() {
return Awesome_Support::instance();
}
// Get Awesome Support Running
WPAS();