| 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.4.7 |
| 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.0 |
| 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.4.7'; |
| 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 |
|
| 147 |
/** |
| 148 |
* Define constants |
| 149 |
* |
| 150 |
* @param string $name - name of global constant. |
| 151 |
* @param string $value - value of constant. |
| 152 |
* @return void |
| 153 |
*/ |
| 154 |
private static function define( $name, $value ) { |
| 155 |
|
| 156 |
if ( ! defined( $name ) ) { |
| 157 |
define( $name, $value ); |
| 158 |
} |
| 159 |
} |
| 160 |
} |
| 161 |
endif; |
| 162 |
|
| 163 |
PSM_Support_Candy::init(); |
| 164 |
|