PluginProbe
Awesome Support – WordPress HelpDesk & Support Plugin / 6.3.6
Awesome Support – WordPress HelpDesk & Support Plugin v6.3.6
6.4.0 trunk 3.0.0 3.0.1 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 All 95 releases
awesome-support / awesome-support.php

awesome-support.php in Awesome Support – WordPress HelpDesk & Support Plugin 6.3.6, at awesome-support.php

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