| 1 |
<?php // phpcs:ignore |
| 2 |
/** |
| 3 |
* Plugin Name: SupportCandy |
| 4 |
* Plugin URI: https://supportcandy.net/ |
| 5 |
* Description: Easy & Powerful support ticket system for WordPress |
| 6 |
* Version: 3.5.3 |
| 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 |
| 12 |
* Text Domain: supportcandy |
| 13 |
* Domain Path: /i18n |
| 14 |
* License: GPLv3 or later |
| 15 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 16 |
*/ |
| 17 |
|
| 18 |
if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) { |
| 19 |
return; |
| 20 |
} |
| 21 |
|
| 22 |
if ( ! defined( 'ABSPATH' ) ) { |
| 23 |
exit; // Exit if accessed directly! |
| 24 |
} |
| 25 |
|
| 26 |
if ( ! class_exists( 'PSM_Support_Candy' ) ) : |
| 27 |
|
| 28 |
final class PSM_Support_Candy { |
| 29 |
|
| 30 |
/** |
| 31 |
* Plugin version |
| 32 |
* |
| 33 |
* @var string |
| 34 |
*/ |
| 35 |
public static $version = '3.5.3'; |
| 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; |
| 99 |
} |
| 100 |
|
| 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 |
} |
| 193 |
endif; |
| 194 |
|
| 195 |
PSM_Support_Candy::init(); |
| 196 |
|