forked from Awesome-Support/Awesome-Support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
awesome-support.php
160 lines (138 loc) · 6.6 KB
/
awesome-support.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* @package Awesome Support
* @author ThemeAvenue <web@themeavenue.net>
* @license GPL-2.0+
* @link http://themeavenue.net
* @copyright 2014 ThemeAvenue
*
* @wordpress-plugin
* Plugin Name: Awesome Support
* Plugin URI: http://getawesomesupport.com
* Description: Awesome Support is a great ticketing system that will help you improve your customer satisfaction by providing a unique customer support experience.
* Version: 3.1.10
* Author: ThemeAvenue
* Author URI: http://themeavenue.net
* Text Domain: wpas
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/*----------------------------------------------------------------------------*
* Shortcuts
*----------------------------------------------------------------------------*/
define( 'WPAS_VERSION', '3.1.10' );
define( 'WPAS_DB_VERSION', '1' );
define( 'WPAS_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'WPAS_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'WPAS_TEMPLATE_PATH', 'awesome-support/' );
define( 'WPAS_ADMIN_ASSETS_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'assets/admin/' ) );
define( 'WPAS_ADMIN_ASSETS_PATH', trailingslashit( plugin_dir_path( __FILE__ ) . 'assets/admin/' ) );
/*----------------------------------------------------------------------------*
* Settings
*----------------------------------------------------------------------------*/
define( 'WPAS_FIELDS_DESC', apply_filters( 'wpas_fields_descriptions', true ) );
/*----------------------------------------------------------------------------*
* Addons
*----------------------------------------------------------------------------*/
/**
* Array of addons to load.
*
* @since 3.1.5
* @var array
*/
$wpas_addons = array();
/*----------------------------------------------------------------------------*
* Shared Functionalities
*----------------------------------------------------------------------------*/
require_once( WPAS_PATH . 'includes/functions-fallback.php' );
require_once( WPAS_PATH . 'includes/class-logger.php' );
require_once( WPAS_PATH . 'class-awesome-support.php' );
/**
* Register hooks that are fired when the plugin is activated or deactivated.
* When the plugin is deleted, the uninstall.php file is loaded.
*/
register_activation_hook( __FILE__, array( 'Awesome_Support', 'activate' ) );
/**
* Get an instance of the plugin
*/
add_action( 'plugins_loaded', array( 'Awesome_Support', 'get_instance' ) );
/**
* Load addons.
*
* A couple of addons are built in the plugin.
* We load them here.
*/
require_once( WPAS_PATH . 'includes/addons/custom-fields/class-custom-fields.php' );
require_once( WPAS_PATH . 'includes/addons/file-uploader/class-file-uploader.php' );
require_once( WPAS_PATH . 'includes/addons/class-mailgun-email-check.php' );
/**
* Call all classes and functions files that are shared
* through the backend and the frontend. The files only used
* by the backend or the frontend are loaded
* by their respective classes.
*/
require_once( WPAS_PATH . 'includes/functions-post.php' ); // All the functions related to opening a ticket and submitting replies
require_once( WPAS_PATH . 'includes/functions-user.php' ); // Everything related to user login, registration and capabilities
require_once( WPAS_PATH . 'includes/functions-addons.php' ); // Addons functions and autoloader
require_once( WPAS_PATH . 'includes/class-log-history.php' ); // Logging class
require_once( WPAS_PATH . 'includes/class-email-notifications.php' ); // E-mail notification class
require_once( WPAS_PATH . 'includes/functions-general.php' ); // Functions that are used both in back-end and front-end
require_once( WPAS_PATH . 'includes/functions-custom-fields.php' ); // Submission form related functions
require_once( WPAS_PATH . 'includes/functions-templating.php' ); // Templating function
require_once( WPAS_PATH . 'includes/class-post-type.php' ); // Register post types and related functions
require_once( WPAS_PATH . 'includes/class-product-sync.php' ); // Keep the product taxonomy in sync with e-commerce products
require_once( WPAS_PATH . 'includes/class-gist.php' ); // Add oEmbed support for Gists
require_once( WPAS_PATH . 'includes/class-wpas-editor-ajax.php' ); // Helper class to load a wp_editor instance via Ajax
/**
* Check if dependencies are loaded.
*
* The plugin uses a certain number of dependencies managed through Composer.
* If those dependencies are not loaded the plugin won't work.
*
* In order to avoid errors we check if dependencies are present. If not we simply
* don't load the plugin.
*
* This problem won't happen with the production version as we have scripts
* doing all the work, but on the development version this can be a problem.
*
* @since 3.0.2
*/
if ( ! Awesome_Support::dependencies_loaded() ) {
add_action( 'admin_notices', 'wpas_missing_dependencied' );
}
/*----------------------------------------------------------------------------*
* Public-Facing Only Functionality
*----------------------------------------------------------------------------*/
if ( ! is_admin() && Awesome_Support::dependencies_loaded() ) {
require_once( WPAS_PATH . 'includes/class-notification.php' ); // Load notifications class
require_once( WPAS_PATH . 'includes/shortcodes/shortcode-tickets.php' ); // The plugin main shortcodes
require_once( WPAS_PATH . 'includes/shortcodes/shortcode-submit.php' ); // The plugin main shortcode-submit
}
/*----------------------------------------------------------------------------*
* Dashboard and Administrative Functionality
*----------------------------------------------------------------------------*/
/**
* The code below is intended to to give the lightest footprint possible.
*/
if ( is_admin() && Awesome_Support::dependencies_loaded() ) {
/* Load main admin class */
require_once( WPAS_PATH . 'includes/admin/class-admin.php' );
add_action( 'plugins_loaded', array( 'Awesome_Support_Admin', 'get_instance' ) );
/* Load the MailGun e-mail check settings */
add_filter( 'wpas_plugin_settings', array( 'WPAS_MailGun_EMail_Check', 'settings' ), 10, 1 );
/**
* Add link ot settings tab
*/
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( 'Awesome_Support_Admin', 'settings_page_link' ) );
}
/**
* Start the session if needed.
*/
if ( ! session_id() && ! headers_sent() ) {
session_start();
}