@@ -109,8 +109,8 @@ function _mpt_load_files( $dir, $files, $prefix = '' ) {
109109
110110// Plugin admin classes
111111if ( is_admin () ) {
112- _mpt_load_files ( MPT_DIR . 'classes/admin/ ' , array ( 'content-permissions ' , 'export ' , ' main ' , 'post-type ' , 'taxonomy ' , ' import ' , 'settings-main ' , 'users-to-members ' , 'welcome-message ' ), 'class- ' );
113-
112+ _mpt_load_files ( 'classes/admin/ ' , array ( 'content-permissions ' , 'main ' , 'post-type ' , 'taxonomy ' , 'settings-main ' , 'users-to-members ' , 'welcome-message ' ), 'class- ' );
113+
114114 // Load class for API settings
115115 if ( ! class_exists ( 'WeDevs_Settings_API ' ) ) {
116116 require_once ( MPT_DIR . 'libraries/wordpress-settings-api-class/class.settings-api.php ' );
@@ -140,17 +140,28 @@ function init_mpt_plugin() {
140140 new MPT_Shortcode ();
141141 new MPT_Security ();
142142
143- // Admin
144- if ( is_admin () ) {
145- // Class admin
146- new MPT_Admin_Content_Permissions ();
147- new MPT_Admin_Main ();
148- new MPT_Admin_Post_Type ();
149- new MPT_Admin_Taxonomy ();
150- new MPT_Admin_Import ();
151- new MPT_Admin_Export ();
152- new MPT_Admin_Users_To_Members ();
153- new MPT_Admin_Welcome_Message ();
143+ // Class admin
144+ new MPT_Admin_Content_Permissions ();
145+ new MPT_Admin_Main ();
146+ new MPT_Admin_Post_Type ();
147+ new MPT_Admin_Taxonomy ();
148+ new MPT_Admin_Users_To_Members ();
149+ new MPT_Admin_Welcome_Message ();
150+
151+ /**
152+ * Handle import/export feature
153+ *
154+ * @since 0.6.0
155+ * @author Maxime CULEA
156+ */
157+ foreach ( array ( 'import ' , 'export ' ) as $ feature ) {
158+ if ( ! apply_filters ( 'mpt_admin_use_ ' . $ feature , true ) ) {
159+ continue ;
160+ }
161+ _mpt_load_files ( 'classes/admin/ ' , array ( $ feature ), 'class- ' );
162+
163+ $ class = 'MPT_Admin_ ' . ucfirst ( $ feature );
164+ new $ class ;
154165 }
155166
156167 // Widget
0 commit comments