PluginProbe
Awesome Support – WordPress HelpDesk & Support Plugin / trunk
Awesome Support – WordPress HelpDesk & Support Plugin vtrunk
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 trunk, at awesome-support.php

704 lines 24.1 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.4.0
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.4.0' );
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/functions-term-order.php' );
430 require( WPAS_PATH . 'includes/admin/settings/functions-settings.php' );
431 require( WPAS_PATH . 'includes/install.php' );
432
433 /* Composer autoload */
434 require( WPAS_PATH . 'vendor/autoload.php' );
435
436 // GAS Framework
437 require( WPAS_PATH . 'includes/gas-framework/gas-framework.php' );
438
439 /* Load Rest API */
440 require( WPAS_PATH . 'includes/rest-api/awesome-support-api.php' );
441
442 /* Simple WooCommerce Integration */
443 require( WPAS_PATH . 'includes/integrations/wc-account.php' );
444
445 /* myCRED Integration */
446 require( WPAS_PATH . 'includes/integrations/my-cred/my-cred.php' );
447
448 if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
449
450 require( WPAS_PATH . 'includes/functions-admin-bar.php' );
451
452 // Compatibility functions
453 require( 'includes/compatibility/sensei.php' );
454 require( 'includes/compatibility/acf-pro.php' );
455 require( 'includes/compatibility/wpml.php' );
456 require( 'includes/compatibility/divi.php' );
457 require( 'includes/compatibility/wc.php' );
458
459 }
460
461 }
462
463 /**
464 * Include all files used in admin only
465 *
466 * @since 3.2.5
467 * @return void
468 */
469 private function includes_admin() {
470
471 require( WPAS_PATH . 'includes/admin/functions-notices.php' );
472 require( WPAS_PATH . 'includes/admin/functions-ajax.php' );
473 require( WPAS_PATH . 'includes/admin/functions-log-viewer.php' );
474 require( WPAS_PATH . 'includes/admin/functions-admin-ticket-detail-toolbars.php' );
475 require( WPAS_PATH . 'includes/admin/functions-toolbar.php' );
476
477 if ( ! class_exists( 'TAV_Remote_Notification_Client' ) ) {
478 if ( ! defined( 'WPAS_REMOTE_NOTIFICATIONS_OFF' ) || true !== WPAS_REMOTE_NOTIFICATIONS_OFF ) {
479 require( WPAS_PATH . 'includes/class-remote-notification-client.php' );
480 }
481 }
482
483 // We don't need all this during Ajax processing
484 if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
485
486 require( WPAS_PATH . 'includes/admin/functions-menu.php' );
487 require( WPAS_PATH . 'includes/admin/functions-post.php' );
488 require( WPAS_PATH . 'includes/admin/functions-tools.php' );
489 require( WPAS_PATH . 'includes/admin/functions-list-table.php' );
490 require( WPAS_PATH . 'includes/admin/functions-metaboxes.php' );
491 require( WPAS_PATH . 'includes/admin/functions-user-profile.php' );
492 require( WPAS_PATH . 'includes/admin/functions-admin-actions.php' );
493 require( WPAS_PATH . 'includes/admin/functions-misc.php' );
494 require( WPAS_PATH . 'includes/admin/functions-editor.php' );
495 require( WPAS_PATH . 'includes/admin/functions-agent-chat.php' );
496 require( WPAS_PATH . 'includes/admin/class-admin-tickets-list.php' );
497 require( WPAS_PATH . 'includes/admin/class-admin-user.php' );
498 require( WPAS_PATH . 'includes/admin/class-as-admin-setup-wizard.php' );
499 require( WPAS_PATH . 'includes/admin/class-admin-gas.php' );
500 require( WPAS_PATH . 'includes/admin/class-admin-help.php' );
501 require( WPAS_PATH . 'includes/admin/upgrade/class-upgrade.php' );
502
503 /* Load settings files */
504 require( WPAS_PATH . 'includes/admin/settings/settings-general.php' );
505 require( WPAS_PATH . 'includes/admin/settings/settings-registration.php' );
506 require( WPAS_PATH . 'includes/admin/settings/settings-moderated-registration.php' );
507 require( WPAS_PATH . 'includes/admin/settings/settings-privacy.php' );
508 require( WPAS_PATH . 'includes/admin/settings/settings-fields.php' );
509 require( WPAS_PATH . 'includes/admin/settings/settings-permissions.php' );
510 require( WPAS_PATH . 'includes/admin/settings/settings-style.php' );
511 require( WPAS_PATH . 'includes/admin/settings/settings-notifications.php' );
512 require( WPAS_PATH . 'includes/admin/settings/settings-advanced.php' );
513 require( WPAS_PATH . 'includes/admin/settings/settings-licenses.php' );
514 require( WPAS_PATH . 'includes/admin/settings/settings-products-management.php' );
515 require( WPAS_PATH . 'includes/admin/settings/settings-basic-time-tracking.php' );
516 require( WPAS_PATH . 'includes/admin/settings/settings-language.php' );
517 require( WPAS_PATH . 'includes/admin/settings/settings-integration.php' );
518
519 /* Load Gutenberg related files */
520 require( WPAS_PATH . 'includes/admin/gutenberg/functions-gutenberg-post-type.php' );
521 require( WPAS_PATH . 'includes/admin/gutenberg/functions-gutenberg.php' );
522 }
523
524 /* Wisdom Tracking */
525 require( WPAS_PATH . '/tracking/class-plugin-usage-tracker.php' );
526
527 }
528
529 /**
530 * Plugin setup.
531 *
532 * If the plugin has just been installed we need to set a couple of things.
533 * We will automatically create the "special" pages: tickets list and
534 * ticket submission.
535 */
536 private function maybe_setup() {
537
538 if ( 'pending' === get_option( 'wpas_setup', false ) ) {
539
540 add_action( 'admin_init', 'wpas_create_pages', 11, 0 );
541 add_action( 'admin_init', 'wpas_flush_rewrite_rules', 11, 0 );
542 add_action( 'admin_init', 'wpas_install_default_email_templates', 11, 0 );
543 }
544
545 /**
546 * Ask for setup plugin using Setup wizard.
547 * Proceed only if both 'wpas_plugin_setup' & 'wpas_skip_wizard_setup' = false
548 * 'wpas_plugin_setup' will be added at the end of wizard steps
549 * 'wpas_skip_wizard_setup' will be set to true if user choose to skip wizrd from admin notice
550 */
551 if ( ! get_option( 'wpas_plugin_setup', false ) && ! get_option( 'wpas_skip_wizard_setup', false ) ) {
552 add_action( 'admin_notices', 'wpas_ask_setup_wizard', 1 );
553 }
554
555 }
556
557 /**
558 * Load the plugin text domain for translation.
559 *
560 * With the introduction of plugins language packs in WordPress loading the textdomain is slightly more complex.
561 *
562 * We now have 3 steps:
563 *
564 * 1. Check for the language pack in the WordPress core directory
565 * 2. Check for the translation file in the plugin's language directory
566 * 3. Fallback to loading the textdomain the classic way
567 *
568 * @since 1.0.0
569 * @return boolean True if the language file was loaded, false otherwise
570 */
571 public function load_plugin_textdomain() {
572
573 $lang_dir = WPAS_ROOT . 'languages/';
574 $lang_path = WPAS_PATH . 'languages/';
575 $locale = apply_filters( 'plugin_locale', get_locale(), 'awesome-support' );
576 $mofile = "awesome-support-$locale.mo";
577 $glotpress_file = WP_LANG_DIR . '/plugins/awesome-support/' . $mofile;
578
579 // Look for the GlotPress language pack first of all
580 if ( file_exists( $glotpress_file ) ) {
581 $language = load_textdomain( 'awesome-support', $glotpress_file );
582 } elseif ( file_exists( $lang_path . $mofile ) ) {
583 $language = load_textdomain( 'awesome-support', $lang_path . $mofile );
584 } else {
585 $language = load_plugin_textdomain( 'awesome-support', false, $lang_dir );
586 }
587
588 return $language;
589
590 }
591
592 /**
593 * Load Awesome Support's theme functions if any
594 *
595 * @since 3.2.0
596 * @return void
597 */
598 public function load_theme_functions() {
599 wpas_get_template( 'functions' );
600 }
601
602 /**
603 * Check for remote notifications.
604 *
605 * Use the Remote Dashboard Notifications plugin
606 * to check for possible notifications from
607 * http://getawesomesupport.com
608 *
609 * @since 3.0.0
610 * @link https://wordpress.org/plugins/remote-dashboard-notifications/
611 * @return void
612 */
613 public function remote_notifications() {
614 if ( wpas_is_asadmin() && function_exists( 'rdnc_add_notification' ) && ( ! defined( 'WPAS_REMOTE_NOTIFICATIONS_OFF' ) || true !== WPAS_REMOTE_NOTIFICATIONS_OFF ) ) {
615 rdnc_add_notification( 2, '77a8b884c6e778b4', 'https://notifications.getawesomesupport.com' );
616 }
617 }
618
619 /**
620 * Start application statistics tracking
621 *
622 * Use the WISDOM Tracking plugin to track
623 * application usage.
624 * https://wisdomplugin.com/support/#getting-started
625 *
626 * Filter: plugins_loaded
627 *
628 * @since 4.4.0
629 * @return void
630 */
631 public function awesome_support_start_plugin_tracking() {
632 $wisdom = new Plugin_Usage_Tracker(
633 __FILE__,
634 'https://tracking.getawesomesupport.com',
635 array(),
636 true,
637 true,
638 1
639 );
640 }
641
642 /**
643 * Application statistics tracking opt-in text
644 *
645 * We use the WISDOM Tracking plugin to track
646 * application usage. This allows us to set the
647 * opt-in text shown to the user when they activate the plugin.
648 *
649 * https://wisdomplugin.com/support/#getting-started
650 *
651 * Filter: wisdom_notice_text_
652 *
653 * @param text default notice text.
654 *
655 * @since 4.4.0
656 *
657 * @return text the notice text to be shown to the user
658 */
659 function awesome_support_tracking_notification_text( $notice_text ) {
660 $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' );
661 $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"' );
662 return $notice_text;
663 }
664
665 /**
666 * Application statistics tracking opt-in text
667 *
668 * We use the WISDOM Tracking plugin to track
669 * application usage. This allows us to set the
670 * time delay before the opt-in notice shows up.
671 *
672 * https://wisdomplugin.com/support/#getting-started
673 *
674 * Filter: wisdom_delay_notification_
675 *
676 * @param text default notice text.
677 *
678 * @since 4.4.0
679 *
680 * @return text the notice text to be shown to the user
681 */
682 function awesome_support_tracking_delay_notification( $delay ) {
683 return 900; // 15 mins
684 }
685
686 }
687
688 endif;
689
690 /**
691 * The main function responsible for returning the unique Awesome Support instance
692 *
693 * Use this function like you would a global variable, except without needing
694 * to declare the global.
695 *
696 * @since 3.1.5
697 * @return object Awesome_Support
698 */
699 function WPAS() {
700 return Awesome_Support::instance();
701 }
702
703 // Get Awesome Support Running
704 WPAS();