PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 3.5.4
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v3.5.4
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
← All changes | supportcandy.php +181 -115 2.3.1 → 3.5.4 View file →
@@ -1,129 +1,195 @@
1 -<?php
1 +<?php // phpcs:ignore
2 2 /**
3 3 * Plugin Name: SupportCandy
4 - * Plugin URI: https://wordpress.org/plugins/supportcandy/
4 + * Plugin URI: https://supportcandy.net/
5 5 * Description: Easy & Powerful support ticket system for WordPress
6 - * Version: 2.3.1
7 - * Author: SupportCandy Team
8 - * Author URI: https://supportcandy.net/
9 - * Requires at least: 4.4
10 - * Tested up to: 6.0
6 + * Version: 3.5.4
7 + * Author: SupportCandy
8 + * Author URI: https://wordpress.org/plugins/supportcandy/
9 + * Requires at least: 5.6
10 + * Requires PHP: 7.4
11 + * Tested up to: 7.1
11 12 * Text Domain: supportcandy
12 - * Domain Path: /lang
13 + * Domain Path: /i18n
14 + * License: GPLv3 or later
15 + * License URI: https://www.gnu.org/licenses/gpl-3.0.html
13 16 */
14 17
18 +if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) {
19 + return;
20 +}
21 +
15 22 if ( ! defined( 'ABSPATH' ) ) {
16 - exit; // Exit if accessed directly
23 + exit; // Exit if accessed directly!
17 24 }
18 25
19 -if ( ! class_exists( 'Support_Candy' ) ) :
20 -
21 - final class Support_Candy {
22 -
23 - public $version = '2.3.1';
24 - public $db_version = '2.0';
25 -
26 - public function __construct() {
27 -
28 - // define global constants
29 - $this->define_constants();
30 -
31 - // Include required files and classes
32 - $this->includes();
26 +if ( ! class_exists( 'PSM_Support_Candy' ) ) :
33 27
34 - add_action( 'init', array($this,'load_textdomain') );
35 -
36 - /*
37 - * Cron setup
38 - */
39 - add_filter('cron_schedules',array( $this, 'wpsc_cron_schedule'));
40 - add_action( 'wpsc_cron_job_schedules', array( $this, 'wpsc_cron_job'));
41 - if (!wp_next_scheduled('wpsc_cron_job_schedules')) {
42 - wp_schedule_event(time(), 'wpsc5min', 'wpsc_cron_job_schedules');
43 - }
44 -
45 - /**
46 - * Attachment restructure
47 - */
48 - $restuct_attach = get_option('wpsc_restructured_attach_completed', 0);
49 - if( !$restuct_attach ){
50 - if (! wp_next_scheduled ( 'wpsc_attachment_restructure')) {
51 - wp_schedule_event( time(), 'hourly', 'wpsc_attachment_restructure');
52 - }
53 - include( WPSC_ABSPATH.'includes/class-wpsc-attachment-restructure.php' );
54 - }
55 - }
56 -
57 - function define_constants() {
58 - $this->define('WPSC_STORE_URL', 'https://supportcandy.net');
59 - $this->define('WPSC_PLUGIN_FILE', __FILE__);
60 - $this->define('WPSC_ABSPATH', dirname(__FILE__) . '/');
61 - $this->define('WPSC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
62 - $this->define('WPSC_PLUGIN_BASENAME', plugin_basename(__FILE__));
63 - $this->define('WPSC_VERSION', $this->version);
64 - $this->define('WPSC_DB_VERSION', $this->db_version);
65 - }
66 -
67 - function load_textdomain(){
68 - $locale = apply_filters( 'plugin_locale', get_locale(), 'supportcandy' );
69 - load_textdomain( 'supportcandy', WP_LANG_DIR . '/supportcandy/supportcandy-' . $locale . '.mo' );
70 - load_plugin_textdomain( 'supportcandy', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' );
71 - }
72 -
73 - public function includes() {
74 - include_once( WPSC_ABSPATH . 'includes/class-wpsc-install.php' );
75 - include_once( WPSC_ABSPATH . 'includes/class-wpsc-ajax.php' );
76 - include_once( WPSC_ABSPATH . 'includes/class-wpsc-functions.php' );
77 - include_once( WPSC_ABSPATH . 'includes/class-wpsc-actions.php' );
78 - include_once( WPSC_ABSPATH . 'includes/rest_api/class-rest-child.php' );
79 - include_once( WPSC_ABSPATH . 'includes/rest_api/v1/class-rest-v1-helper.php' );
80 - if ($this->is_request('admin')) {
81 - include_once( WPSC_ABSPATH . 'includes/class-wpsc-admin.php' );
82 - }
83 - if ($this->is_request('frontend')) {
84 - include_once( WPSC_ABSPATH . 'includes/class-wpsc-frontend.php' );
85 - }
86 - if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
87 - include_once( WPSC_ABSPATH . 'includes/EDD_SL_Plugin_Updater.php' );
88 - }
89 - if( get_option('wpsc_rest_api') ) {
90 - include_once( WPSC_ABSPATH . 'includes/rest_api/class-wpsc-rest-api-v1.php' );
28 + final class PSM_Support_Candy {
29 +
30 + /**
31 + * Plugin version
32 + *
33 + * @var string
34 + */
35 + public static $version = '3.5.4';
36 +
37 + /**
38 + * Database version
39 + *
40 + * @var string
41 + */
42 + public static $db_version = '3.0';
43 +
44 + /**
45 + * Constructor for main class
46 + */
47 + public static function init() {
48 +
49 + self::define_constants();
50 + self::load_files();
51 + }
52 +
53 + /**
54 + * Defines global constants that can be availabel anywhere in WordPress
55 + *
56 + * @return void
57 + */
58 + public static function define_constants() {
59 +
60 + self::define( 'WPSC_STORE_URL', 'https://supportcandy.net' );
61 + self::define( 'WPSC_PLUGIN_FILE', __FILE__ );
62 + self::define( 'WPSC_ABSPATH', __DIR__ . '/' );
63 + self::define( 'WPSC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
64 + self::define( 'WPSC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
65 + self::define( 'WPSC_VERSION', self::$version );
66 + self::define( 'WPSC_DB_VERSION', self::$db_version );
67 + }
68 +
69 + /**
70 + * Load all classes
71 + *
72 + * @return void
73 + */
74 + private static function load_files() {
75 +
76 + // Load installation.
77 + include_once WPSC_ABSPATH . 'class-wpsc-installation.php';
78 + include_once WPSC_ABSPATH . 'global-functions.php';
79 +
80 + // Return if installation is in progress.
81 + if ( defined( 'WPSC_INSTALLING' ) ) {
82 + return;
83 + }
84 +
85 + // Database upgrade functionality.
86 + if ( defined( 'WPSC_DB_UPGRADING' ) ) {
87 +
88 + include_once WPSC_ABSPATH . 'includes/class-wpsc-sc-upgrade.php';
89 +
90 + switch ( WPSC_Installation::$current_db_version ) {
91 +
92 + case '1.0':
93 + include_once WPSC_ABSPATH . 'upgrade/class-wpsc-upgrade-db-v1.php';
94 + break;
95 +
96 + case '2.0':
97 + include_once WPSC_ABSPATH . 'upgrade/class-wpsc-upgrade-db-v2.php';
98 + break;
91 99 }
92 -
93 - }
94 -
95 - private function define($name, $value) {
96 - if (!defined($name)) {
97 - define($name, $value);
98 - }
99 - }
100 -
101 - private function is_request($type) {
102 - switch ($type) {
103 - case 'admin' :
104 - return is_admin();
105 - case 'frontend' :
106 - return (!is_admin() || defined('DOING_AJAX') ) && !defined('DOING_CRON');
107 - }
108 - }
109 -
110 - function wpsc_cron_schedule($schedules){
111 - if(!isset($schedules["wpsc5min"])){
112 - $schedules["wpsc5min"] = array(
113 - 'interval' => 5*60,
114 - 'display' => 'Once every 5 minute',
115 - );
116 - }
117 - return $schedules;
118 - }
119 100
120 - function wpsc_cron_job() {
121 -
122 - do_action('wpsc_cron');
123 - }
124 -
125 - }
126 -
101 + // do not load further files.
102 + return;
103 + }
104 +
105 + $advanced = get_option( 'wpsc-ms-advanced-settings' );
106 +
107 + // Load common classes.
108 + foreach ( glob( WPSC_ABSPATH . 'includes/*.php' ) as $filename ) {
109 + include_once $filename;
110 + }
111 +
112 + // Load custom field types.
113 + foreach ( glob( WPSC_ABSPATH . 'includes/custom-field-types/*.php' ) as $filename ) {
114 + include_once $filename;
115 + }
116 +
117 + // Load models.
118 + foreach ( glob( WPSC_ABSPATH . 'includes/models/*.php' ) as $filename ) {
119 + include_once $filename;
120 + }
121 +
122 + // Load rest api classes.
123 + if ( $advanced['rest-api'] ) {
124 + foreach ( glob( WPSC_ABSPATH . 'includes/rest-api/*.php' ) as $filename ) {
125 + include_once $filename;
126 + }
127 + }
128 +
129 + // Load framework.
130 + if ( ! ( defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) ) {
131 + foreach ( glob( WPSC_ABSPATH . 'framework/*.php' ) as $filename ) {
132 + include_once $filename;
133 + }
134 + }
135 +
136 + // Load classes that is related to admin section.
137 + foreach ( glob( WPSC_ABSPATH . 'includes/admin/*.php' ) as $filename ) {
138 + include_once $filename;
139 + }
140 +
141 + // Load classes that is related to frontend section.
142 + foreach ( glob( WPSC_ABSPATH . 'includes/frontend/*.php' ) as $filename ) {
143 + include_once $filename;
144 + }
145 +
146 + // load deactivation feedback class.
147 + self::init_deactivation_feedback();
148 + }
149 +
150 + /**
151 + * Define constants
152 + *
153 + * @param string $name - name of global constant.
154 + * @param string $value - value of constant.
155 + * @return void
156 + */
157 + private static function define( $name, $value ) {
158 +
159 + if ( ! defined( $name ) ) {
160 + define( $name, $value );
161 + }
162 + }
163 +
164 +
165 +
166 + /**
167 + * Initialize deactivation feedback system.
168 + *
169 + * @return void
170 + */
171 + public static function init_deactivation_feedback() {
172 + require_once WPSC_ABSPATH . 'deactivation-feedback/class-psm-dfr.php';
173 + PSM_DFR::init(
174 + array(
175 + 'plugin_file' => plugin_basename( __FILE__ ),
176 + 'plugin_name' => 'SupportCandy',
177 + 'plugin_version' => WPSC_VERSION,
178 + 'endpoint' => 'https://feedback.psmplugins.com/wp-json/psm/v1/feedback',
179 + 'api_key' => 'b8p-MO>d}!aq<bY6nx]mRG~&ndXO=3jwIi{iX<YAt2#Z!>n-[.Q9](OZ--}#@C|',
180 + 'reasons' => array(
181 + 'too_complex' => 'Too complicated to set up',
182 + 'testing' => 'Just testing / comparing plugins',
183 + 'found_alternative' => 'Found a better plugin',
184 + 'missing_features' => 'Missing a feature I need',
185 + 'bugs_errors' => 'Bugs or errors',
186 + 'temporary' => 'Temporary deactivation',
187 + 'other' => 'Other',
188 + ),
189 + )
190 + );
191 + }
192 + }
127 193 endif;
128 194
129 -new Support_Candy();
195 +PSM_Support_Candy::init();