PluginProbe ʕ •ᴥ•ʔ
Advanced Import / 1.3.2
Advanced Import v1.3.2
trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 2.0.0
advanced-import / includes / class-advanced-import.php
advanced-import / includes Last commit date
theme-template-library 5 years ago class-advanced-import-activator.php 5 years ago class-advanced-import-deactivator.php 5 years ago class-advanced-import-i18n.php 5 years ago class-advanced-import-loader.php 5 years ago class-advanced-import.php 5 years ago class-theme-template-library-base.php 5 years ago functions-advanced-import.php 5 years ago index.php 5 years ago
class-advanced-import.php
294 lines
1 <?php
2
3 /**
4 * The file that defines the core plugin class
5 *
6 * A class definition that includes attributes and functions used across both the
7 * public-facing side of the site and the admin area.
8 *
9 * @link https://addonspress.com/
10 * @since 1.0.0
11 *
12 * @package Advanced_Import
13 * @subpackage Advanced_Import/includes
14 */
15
16 /**
17 * The core plugin class.
18 *
19 * This is used to define internationalization, admin-specific hooks, and
20 * public-facing site hooks.
21 *
22 * Also maintains the unique identifier of this plugin as well as the current
23 * version of the plugin.
24 *
25 * @since 1.0.0
26 * @package Advanced_Import
27 * @subpackage Advanced_Import/includes
28 * @author Addons Press <addonspress.com>
29 */
30 class Advanced_Import {
31
32 /**
33 * The loader that's responsible for maintaining and registering all hooks that power
34 * the plugin.
35 *
36 * @since 1.0.0
37 * @access protected
38 * @var Advanced_Import_Loader $loader Maintains and registers all hooks for the plugin.
39 */
40 protected $loader;
41
42 /**
43 * The unique identifier of this plugin.
44 *
45 * @since 1.0.0
46 * @access protected
47 * @var string $plugin_name The string used to uniquely identify this plugin.
48 */
49 protected $plugin_name;
50
51 /**
52 * The current version of the plugin.
53 *
54 * @since 1.0.0
55 * @access protected
56 * @var string $version The current version of the plugin.
57 */
58 protected $version;
59
60 /**
61 * The admin class object of the plugin.
62 *
63 * @since 1.0.0
64 * @access public
65 * @var object Advanced_Import_Admin $admin
66 */
67 public $admin;
68
69 /**
70 * The language object of the plugin.
71 *
72 * @since 1.0.0
73 * @access public
74 * @var object Advanced_Import_i18n $plugin_i18n
75 */
76 public $plugin_i18n;
77
78 /**
79 * Main Advanced_Import Instance
80 *
81 * Insures that only one instance of Advanced_Import exists in memory at any one
82 * time. Also prevents needing to define globals all over the place.
83 *
84 * @since 1.0.0
85 * @access public
86 *
87 * @uses Advanced_Import::setup_globals() Setup the globals needed
88 * @uses Advanced_Import::load_dependencies() Include the required files
89 * @uses Advanced_Import::set_locale() Setup language
90 * @uses Advanced_Import::define_admin_hooks() Setup admin hooks and actions
91 * @uses Advanced_Import::run() run
92 * @return object
93 */
94 public static function instance() {
95
96 // Store the instance locally to avoid private static replication
97 static $instance = null;
98
99 // Only run these methods if they haven't been ran previously
100 if ( null === $instance ) {
101 $instance = new Advanced_Import();
102
103 $instance->setup_globals();
104 $instance->load_dependencies();
105 $instance->set_locale();
106 $instance->define_admin_hooks();
107 $instance->run();
108 }
109
110 // Always return the instance
111 return $instance;
112 }
113
114 /**
115 * Empty construct
116 *
117 * @since 1.0.0
118 */
119 public function __construct() { }
120 /**
121 * Define the locale for this plugin for internationalization.
122 *
123 * Uses the Advanced_Import_i18n class in order to set the domain and to register the hook
124 * with WordPress.
125 *
126 * @since 1.0.0
127 * @access private
128 */
129 private function setup_globals() {
130
131 $this->version = defined( 'ADVANCED_IMPORT_VERSION' ) ? ADVANCED_IMPORT_VERSION : '1.0.0';
132 $this->plugin_name = ADVANCED_IMPORT_PLUGIN_NAME;
133
134 // The array of actions and filters registered with this plugins.
135 $this->actions = array();
136 $this->filters = array();
137
138 // Misc
139 $this->domain = 'advanced-import'; // Unique identifier for retrieving translated strings
140 $this->errors = new WP_Error(); // errors
141 }
142
143 /**
144 * Load the required dependencies for this plugin.
145 *
146 * Include the following files that make up the plugin:
147 *
148 * - Advanced_Import_Loader. Orchestrates the hooks of the plugin.
149 * - Advanced_Import_i18n. Defines internationalization functionality.
150 * - Advanced_Import_Admin. Defines all hooks for the admin area.
151 * - Advanced_Import_Public. Defines all hooks for the public side of the site.
152 *
153 * Create an instance of the loader which will be used to register the hooks
154 * with WordPress.
155 *
156 * @since 1.0.0
157 * @access private
158 */
159 private function load_dependencies() {
160
161 /**
162 * The class responsible for orchestrating the actions and filters of the
163 * core plugin.
164 */
165 require_once ADVANCED_IMPORT_PATH . 'includes/class-advanced-import-loader.php';
166
167 /**
168 * The class responsible for defining internationalization functionality
169 * of the plugin.
170 */
171 require_once ADVANCED_IMPORT_PATH . 'includes/class-advanced-import-i18n.php';
172
173 /**
174 * The class responsible for defining common functions
175 * of the plugin.
176 */
177 require_once ADVANCED_IMPORT_PATH . 'includes/functions-advanced-import.php';
178
179 /**
180 * The class responsible for defining all actions that occur in the admin area.
181 */
182 require_once ADVANCED_IMPORT_PATH . 'admin/class-advanced-import-admin.php';
183 require_once ADVANCED_IMPORT_PATH . 'admin/class-elementor-import.php';
184
185 /**
186 * The class responsible for WordPress rset
187 */
188 require_once ADVANCED_IMPORT_PATH . 'admin/class-reset.php';
189
190 /*Theme Specific Setting*/
191 require_once ADVANCED_IMPORT_PATH . 'includes/class-theme-template-library-base.php';
192
193 require_once ADVANCED_IMPORT_PATH . 'includes/theme-template-library/cosmoswp.php'; /*cosmoswp*/
194 require_once ADVANCED_IMPORT_PATH . 'includes/theme-template-library/acmethemes.php'; /*acmethemes*/
195
196 $this->loader = new Advanced_Import_Loader();
197
198 }
199
200 /**
201 * Define the locale for this plugin for internationalization.
202 *
203 * Uses the Advanced_Import_i18n class in order to set the domain and to register the hook
204 * with WordPress.
205 *
206 * @since 1.0.0
207 * @access private
208 */
209 private function set_locale() {
210
211 $this->plugin_i18n = new Advanced_Import_i18n();
212
213 $this->loader->add_action( 'plugins_loaded', $this->plugin_i18n, 'load_plugin_textdomain' );
214
215 }
216
217 /**
218 * Register all of the hooks related to the admin area functionality
219 * of the plugin.
220 *
221 * @since 1.0.0
222 * @access private
223 */
224 private function define_admin_hooks() {
225
226 $this->admin = advanced_import_admin();
227
228 $this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'enqueue_styles' );
229 $this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'enqueue_scripts' );
230
231 /*add mime types*/
232 $this->loader->add_action( 'mime_types', $this->admin, 'mime_types' );
233
234 /*add menu*/
235 $this->loader->add_action( 'admin_menu', $this->admin, 'import_menu' );
236 $this->loader->add_action( 'current_screen', $this->admin, 'help_tabs' );
237
238 /*ajax process*/
239 $this->loader->add_action( 'wp_ajax_advanced_import_ajax_setup', $this->admin, 'upload_zip' );
240 $this->loader->add_action( 'wp_ajax_demo_download_and_unzip', $this->admin, 'demo_download_and_unzip' );
241 $this->loader->add_action( 'wp_ajax_plugin_screen', $this->admin, 'plugin_screen' );
242 $this->loader->add_action( 'wp_ajax_install_plugin', $this->admin, 'install_plugin' );
243 $this->loader->add_action( 'wp_ajax_content_screen', $this->admin, 'content_screen' );
244 $this->loader->add_action( 'wp_ajax_import_content', $this->admin, 'import_content' );
245 $this->loader->add_action( 'wp_ajax_complete_screen', $this->admin, 'complete_screen' );
246
247 /*Reset Process*/
248 $this->loader->add_action( 'wp_loaded', advanced_import_reset_wordpress(), 'hide_reset_notice', -1 );
249 $this->loader->add_action( 'admin_init', advanced_import_reset_wordpress(), 'reset_wizard_actions', -1 );
250 $this->loader->add_action( 'admin_notices', advanced_import_reset_wordpress(), 'reset_wizard_notice', -1 );
251
252 }
253
254 /**
255 * Run the loader to execute all of the hooks with WordPress.
256 *
257 * @since 1.0.0
258 */
259 public function run() {
260 $this->loader->run();
261 }
262
263 /**
264 * The name of the plugin used to uniquely identify it within the context of
265 * WordPress and to define internationalization functionality.
266 *
267 * @since 1.0.0
268 * @return string The name of the plugin.
269 */
270 public function get_plugin_name() {
271 return $this->plugin_name;
272 }
273
274 /**
275 * The reference to the class that orchestrates the hooks with the plugin.
276 *
277 * @since 1.0.0
278 * @return Advanced_Import_Loader Orchestrates the hooks of the plugin.
279 */
280 public function get_loader() {
281 return $this->loader;
282 }
283
284 /**
285 * Retrieve the version number of the plugin.
286 *
287 * @since 1.0.0
288 * @return string The version number of the plugin.
289 */
290 public function get_version() {
291 return $this->version;
292 }
293 }
294