PluginProbe
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on / 1.0
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on v1.0
2.0 1.7.1 1.2.9 1.3 1.4 1.4.1 1.4.2 1.4.3 1.5 1.6 1.7 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8
← All changes | index.php +168 -75 1.11.0 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2 /*******************************************************************************
3 3 * Plugin Name: Import Users
4 4 * Description: Seamlessly create users and import from your CSV data with ease.
5 - * Version: 1.1
5 + * Version: 1.0
6 6 * Author: smackcoders
7 7 * Text Domain: Import-Users
8 8 * Domain Path: /languages/
9 9 */
@@ -42,13 +42,12 @@
42 42 * not reasonably feasible for technical reasons, the Appropriate Legal
43 43 * Notices must display the words
44 44 * "Copyright Smackcoders. 2017. All rights reserved".
45 45 ********************************************************************************/
46 -
47 46 if ( ! defined( 'ABSPATH' ) )
48 47 exit; // Exit if accessed directly
49 48
50 -if ( ! class_exists( 'UserSmCSVHandler' ) ) :
49 +if ( ! class_exists( 'User_SM_WPUltimateCSVImporter' ) ) :
51 50 /**
52 51 * Main WPUltimateCSVImporter Class.
53 52 *
54 53 * @class WPUltimateCSVImporter Class
@@ -53,11 +52,11 @@
53 52 *
54 53 * @class WPUltimateCSVImporter Class
55 54 * @version 5.0
56 55 */
57 - class UserSmCSVHandler {
56 + class User_SM_WPUltimateCSVImporter {
58 57
59 - public $version = '1.1';
58 + public $version = '1.0';
60 59
61 60 /**
62 61 * The single instance of the class.
63 62 *
@@ -73,9 +72,9 @@
73 72 *
74 73 * @since 5.0
75 74 * @static
76 75 * @see WC()
77 - * @return UserSmCSVHandler - Main instance.
76 + * @return SM_WPUltimateCSVImporter - Main instance.
78 77 */
79 78 public static function instance() {
80 79 if ( is_null( self::$_instance ) ) {
81 80 self::$_instance = new self();
@@ -83,32 +82,32 @@
83 82 return self::$_instance;
84 83 }
85 84
86 85 /**
87 - * UserSmCSVHandler Constructor.
86 + * SM_WPUltimateCSVImporter Constructor.
88 87 */
89 88 public function __construct() {
90 89 include_once ( 'includes/class-uci-install.php' );
91 - //include_once ( 'uninstall.php' );
90 + include_once ( 'uninstall.php' );
92 91
93 92 do_action( 'wp_ultimate_csv_importer_loaded' );
94 - add_filter( 'plugin_row_meta', array('SmUCIUserInstall', 'plugin_row_meta'), 10, 2 );
95 - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array('SmUCIUserInstall', 'plugin_row_meta'), 10, 2 );
93 + //add_filter( 'plugin_row_meta', array('User_SmackUCIInstall', 'plugin_row_meta'), 10, 2 );
94 + add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array('User_SmackUCIInstall', 'plugin_row_meta'), 10, 2 );
96 95
97 96 if ( ! function_exists( 'is_plugin_active' ) ) {
98 97 require_once ABSPATH . 'wp-admin/includes/plugin.php';
99 98 }
100 - // if ( is_plugin_active('import-users/index.php') ) {
101 - // // add plugin upgrade notification
102 - // if(get_option('ULTIMATE_CSV_IMP_VERSION') <= 5.0)
103 - // //add_action( 'admin_notices', array('SmUCIUserInstall', 'important_upgrade_notice') );
104 - // //add_action( 'admin_notices', array('SmUCIUserInstall', 'important_cron_notice') );
105 - // //add_action( 'admin_notices', array( 'SmUCIUserInstall', 'wp_ultimate_csv_importer_notice' ) );
106 - // }
99 + if ( is_plugin_active('Import-Users/index.php') ) {
100 + // add plugin upgrade notification
101 + if(get_option('ULTIMATE_CSV_IMP_VERSION') <= 5.0)
102 + add_action( 'admin_notices', array('User_SmackUCIInstall', 'important_upgrade_notice') );
103 + add_action( 'admin_notices', array('User_SmackUCIInstall', 'important_cron_notice') );
104 + add_action( 'admin_notices', array( 'User_SmackUCIInstall', 'wp_ultimate_csv_importer_notice' ) );
105 + }
107 106
108 - //add_action('in_plugin_update_message-import-users/index.php', array('SmUCIUserInstall', 'showUpgradeNotification'), 10, 2);
107 + add_action('in_plugin_update_message-Import-Users/index.php', array('User_SmackUCIInstall', 'showUpgradeNotification'), 10, 2);
109 108
110 - //add_filter('cron_schedules', array('SmUCIUserInstall', 'cron_schedules'));
109 + add_filter('cron_schedules', array('User_SmackUCIInstall', 'cron_schedules'));
111 110 $this->define_constants();
112 111 $this->includes();
113 112 $this->init_hooks();
114 113 }
@@ -117,57 +116,49 @@
117 116 * Hook into actions and filters.
118 117 * @since 5.0
119 118 */
120 119 private function init_hooks() {
121 - //register_activation_hook( __FILE__, array( 'SmUCIUserInstall', 'install' ) );
120 + register_activation_hook( __FILE__, array( 'User_SmackUCIInstall', 'install' ) );
122 121 add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
123 -
124 - add_action('smack_uci_email_scheduler', array('SmUCIUserEmailScheduler', 'send_login_credentials_to_users'));
125 -
126 - function admin_notice_importuser() {
127 - global $pagenow;
128 - $active_plugins = get_option( "active_plugins" );
129 - if ( $pagenow == 'plugins.php' && !in_array('wp-ultimate-csv-importer/index.php', $active_plugins) ) {
130 - ?>
131 - <div class="notice notice-warning is-dismissible" >
132 - <p> Import Users is an addon of <a href="https://goo.gl/fwqMnZ" target="blank" style="cursor: pointer;text-decoration:none">WP Ultimate CSV Importer</a> plugin, kindly install it to continue using import users. </p>
133 - <p>
134 - </div>
135 - <?php
136 - }
137 - }
138 -
139 -
140 - add_action( 'admin_notices', 'admin_notice_importuser' );
122 + add_action( 'init', array( $this, 'smack_uci_enqueue_scripts') );
123 + /* add_action( 'wp_default_scripts', function( $scripts ) {
124 + if ( ! empty( $scripts->registered['jquery'] ) ) {
125 + $scripts->registered['jquery']->deps = array_diff( $scripts->registered['jquery']->deps, array( 'jquery-migrate' ) );
126 + }
127 + } ); */
128 + add_action('wp_dashboard_setup', array($this,'uci_pro_add_dashboard_widgets'));
129 + add_action('smack_uci_email_scheduler', array('User_SmackUCIEmailScheduler', 'send_login_credentials_to_users'));
130 + add_action('smack_uci_image_scheduler', array('User_SmackUCIMediaScheduler', 'populateFeatureImages'));
131 + register_deactivation_hook( __FILE__, array( 'User_SmackUCIUnInstall', 'uninstall' ) );
141 132 }
142 133
143 134 /**
144 - * Define SmUCIUser Constants.
135 + * Define User_SmackUCI Constants.
145 136 */
146 137 public function define_constants() {
147 138 $upload_dir = wp_upload_dir();
148 - $this->define( 'SM_UCIUSER_PLUGIN_FILE', __FILE__ );
149 - $this->define( 'SM_UCIUSER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
150 - $this->define( 'SM_UCIUSER_VERSION', $this->version );
151 - $this->define( 'SM_UCIUSER_DELIMITER', ',' );
152 - $this->define( 'SM_UCIUSER_PRO_DIR', plugin_dir_path(__FILE__));
153 - $this->define( 'SM_UCIUSER_PRO_URL', plugins_url().'/import-users');
154 - $this->define( 'SM_UCIUSER_LOG_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/import_logs/' );
155 - $this->define( 'SM_UCIUSER_DEFAULT_UPLOADS_DIR', $upload_dir['basedir'] );
156 - $this->define( 'SM_UCIUSER_DEFAULT_UPLOADS_URL', $upload_dir['baseurl'] );
157 - $this->define( 'SM_UCIUSER_FILE_MANAGING_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/' );
158 - $this->define( 'SM_UCIUSER_IMPORT_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/imports' );
159 - $this->define( 'SM_UCIUSER_IMPORT_URL', $upload_dir['baseurl'] . '/smack_uci_uploads/imports' );
160 - $this->define( 'SM_UCIUSER_EXPORT_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/exports/' );
161 - $this->define( 'SM_UCIUSER_EXPORT_URL', $upload_dir['baseurl'] . '/smack_uci_uploads/exports/' );
162 - $this->define( 'SM_UCIUSER_ZIP_FILES_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/zip_files/' );
163 - $this->define( 'SM_UCIUSER_INLINE_IMAGE_DIR', $upload_dir['basedir'] . '/smack_inline_images/' );
164 - $this->define( 'SM_UCIUSER_SCREENS_DATA',$upload_dir['basedir'].'/smack_uci_uploads/screens_data');
165 - $this->define( 'SM_UCIUSER_SESSION_CACHE_GROUP', 'smack_uci_session_id' );
166 - $this->define( 'SM_UCIUSER_SETTINGS', 'user-importer-free' );
167 - $this->define( 'SM_UCIUSER_NAME', 'Import Users' );
168 - $this->define( 'SM_UCIUSER_SLUG', 'import-users' );
169 - $this->define( 'SM_UCIUSER_DEBUG_LOG', $upload_dir['basedir'] . '/import-users.log');
139 + $this->define( 'USER_SM_UCI_PLUGIN_FILE', __FILE__ );
140 + $this->define( 'USER_SM_UCI_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
141 + $this->define( 'USER_SM_UCI_VERSION', $this->version );
142 + $this->define( 'USER_SM_UCI_DELIMITER', ',' );
143 + $this->define( 'USER_SM_UCI_PRO_DIR', plugin_dir_path(__FILE__));
144 + $this->define( 'USER_SM_UCI_PRO_URL', plugins_url().'/Import-Users');
145 + $this->define( 'USER_SM_UCI_LOG_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/import_logs/' );
146 + $this->define( 'USER_SM_UCI_DEFAULT_UPLOADS_DIR', $upload_dir['basedir'] );
147 + $this->define( 'USER_SM_UCI_DEFAULT_UPLOADS_URL', $upload_dir['baseurl'] );
148 + $this->define( 'USER_SM_UCI_FILE_MANAGING_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/' );
149 + $this->define( 'USER_SM_UCI_IMPORT_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/imports' );
150 + $this->define( 'USER_SM_UCI_IMPORT_URL', $upload_dir['baseurl'] . '/smack_uci_uploads/imports' );
151 + $this->define( 'USER_SM_UCI_EXPORT_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/exports/' );
152 + $this->define( 'USER_SM_UCI_EXPORT_URL', $upload_dir['baseurl'] . '/smack_uci_uploads/exports/' );
153 + $this->define( 'USER_SM_UCI_ZIP_FILES_DIR', $upload_dir['basedir'] . '/smack_uci_uploads/zip_files/' );
154 + $this->define( 'USER_SM_UCI_INLINE_IMAGE_DIR', $upload_dir['basedir'] . '/smack_inline_images/' );
155 + $this->define( 'USER_SM_UCI_SCREENS_DATA',$upload_dir['basedir'].'/smack_uci_uploads/screens_data');
156 + $this->define( 'USER_SM_UCI_SESSION_CACHE_GROUP', 'smack_uci_session_id' );
157 + $this->define( 'USER_SM_UCI_SETTINGS', 'Import Users' );
158 + $this->define( 'USER_SM_UCI_NAME', 'Import Users' );
159 + $this->define( 'USER_SM_UCI_SLUG', 'Import-Users' );
160 + $this->define( 'USER_SM_UCI_DEBUG_LOG', $upload_dir['basedir'] . '/Import-Users.log');
170 161 }
171 162
172 163 /**
173 164 * Define constant if not already set.
@@ -185,21 +176,97 @@
185 176 * Include required core files used in admin and on the frontend.
186 177 */
187 178 public function includes() {
188 179 include_once ( 'includes/class-uci-helper.php' );
189 - // include_once ('includes/class-uci-exporter.php');
190 - // include_once ( 'libs/parsers/SmackCSVParser.php' );
191 - // include_once ( 'includes/class-uci-admin-ajax.php' );
192 - // include_once ( 'includes/class-uci-event-logging.php' );
180 + include_once ( 'libs/parsers/SmackCSVParser.php' );
181 + include_once ( 'includes/class-uci-admin-ajax.php' );
182 + include_once ( 'includes/class-uci-event-logging.php' );
193 183 include_once ( 'admin/class-uci-admin.php' );
194 - include_once ( 'includes/class-uci-email-scheduler.php' );
195 - // include_once ( 'includes/class-uci-media-scheduler.php' );
196 - #SmUCIUserMediaScheduler::populateFeatureImages();
184 + include_once ( 'includes/class-uci-email-scheduler.php' );
185 + include_once ( 'includes/class-uci-media-scheduler.php' );
186 + #User_SmackUCIMediaScheduler::populateFeatureImages();
197 187 }
198 188
189 + public function smack_uci_enqueue_scripts() {
190 + // Register / Enqueue the plugin scripts & style
191 + $uciPages = array('user-uci-dashboard', 'user-uci-import', 'sm-uci-managers', 'sm-uci-export', 'user-uci-settings', 'user-uci-support');
192 + if (isset($_REQUEST['page']) && in_array(sanitize_text_field($_REQUEST['page']), $uciPages)) {
193 + // Ultimate CSV Importer Styles
194 + wp_enqueue_style( 'ultimate-css', plugins_url( 'assets/css/ultimate-importer.css', __FILE__ ) );
195 + wp_enqueue_style( 'boot.css', plugins_url( 'assets/css/bootstrap.css', __FILE__ ) );
196 + wp_enqueue_style( 'Icomoon Icons', plugins_url( 'assets/css/icomoon.css', __FILE__ ) );
197 + wp_enqueue_style( 'Animate CSS', plugins_url( 'assets/css/animate.css', __FILE__ ) );
198 + wp_enqueue_style( 'jquery-fileupload.css', plugins_url( 'assets/css/jquery.fileupload.css', __FILE__ ) );
199 + wp_enqueue_style( 'jquery-style', plugins_url( 'assets/css/jquery-ui.css', __FILE__ ) );
200 + wp_enqueue_style('icheck', plugins_url('assets/css/icheck/green.css', __FILE__));
201 + wp_enqueue_style( 'bootstrap-datepicker-css', plugins_url('assets/css/bootstrap-datepicker.css', __FILE__ ) );
202 + wp_enqueue_style( 'file-tree-css', plugins_url( 'assets/css/jqueryfiletree.css', __FILE__ ) );
203 + // WaitMe CSS & JS for blur the page and show the progressing loader
204 + wp_enqueue_style('waitme-css', plugins_url('assets/css/waitMe.css', __FILE__));
205 + wp_enqueue_style('sweet-alert-css', plugins_url('assets/css/sweetalert.css', __FILE__));
206 + wp_enqueue_style('custom-style', plugins_url('assets/css/custom-style.css', __FILE__));
207 + //new files include
208 + //wp_enqueue_style('custom-new-style', plugins_url('assets/css/custom-new-style.css', __FILE__));
209 + wp_enqueue_style( 'bootstrap-select-css', plugins_url( 'assets/css/bootstrap-select.css', __FILE__ ));
210 + // Ultimate CSV Importer Scripts
211 + wp_enqueue_script( 'jquery' );
212 + wp_enqueue_script( 'icheck-js', plugins_url( 'assets/js/icheck.min.js', __FILE__ ) );
213 + wp_enqueue_script( 'file-download-js', plugins_url( 'assets/js/jquery.fileDownload.js', __FILE__ ) );
214 + wp_register_script( 'ultimate-importer-js', plugins_url( 'assets/js/ultimate-importer.js', __FILE__ ) );
215 + wp_enqueue_script( 'ultimate-importer-js' );
216 + wp_register_script( 'bootstrap-datepicker-js', plugins_url( 'assets/js/bootstrap-datepicker.js', __FILE__ ) );
217 + wp_enqueue_script( 'bootstrap-datepicker-js' );
218 + wp_enqueue_script( 'jquery-ui-dialog' );
219 + wp_enqueue_script('jquery-ui-draggable');
220 + wp_enqueue_script('jquery-ui-droppable');
221 + wp_enqueue_script('jquery-ui-core');
222 + wp_enqueue_script( 'file-tree', plugins_url( 'assets/js/jqueryfiletree.js', __FILE__ ) );
223 + wp_localize_script( 'ultimate-importer-js', 'uci_importer', array(
224 + 'adminurl' => admin_url(),
225 + 'siteurl' => site_url(),
226 + 'requestpage' => $_REQUEST['page'],
227 + 'db_orphanedMsg' => __('no of Orphaned Post/Page meta has been removed.', 'Import-Users'),
228 + 'db_tagMsg' => __('no of Unassigned tags has been removed.', 'Import-Users'),
229 + 'db_revisionMsg' => __('no of Post/Page revisions has been removed.', 'Import-Users'),
230 + 'db_draftMSg' => __('no of Auto drafted Post/Page has been removed.', 'Import-Users'),
231 + 'db_trashMsg' => __('no of Post/Page in trash has been removed.', 'Import-Users'),
232 + 'db_spamMsg' => __('no of Spam comments has been removed.', 'Import-Users'),
233 + 'db_commentTrashMsg' => __('no of Comments in trash has been removed.', 'Import-Users'),
234 + 'db_unapprovedMsg' => __('no of Unapproved comments has been removed.', 'Import-Users'),
235 + 'db_pingbackMsg' => __('no of Pingback comments has been removed.', 'Import-Users'),
236 + 'db_trackbackMsg' => __('no of Trackback comments has been removed.', 'Import-Users'),
237 + ) );
238 + wp_register_script('bootstrap-js', plugins_url('assets/js/bootstrap.js', __FILE__));
239 + wp_enqueue_script('bootstrap-js');
240 + wp_register_script('bootstrap-select-js', plugins_url('assets/js/bootstrap-select.js', __FILE__));
241 + wp_enqueue_script('bootstrap-select-js');
242 + wp_register_script('stickySidebar-js', plugins_url('assets/js/stickySidebar.js', __FILE__));
243 + wp_enqueue_script('stickySidebar-js');
244 + //new files include close
245 + wp_register_script('waitme-js', plugins_url('assets/js/waitMe.js', __FILE__));
246 + wp_enqueue_script('waitme-js');
247 + // Sweet Alert Js
248 + wp_register_script('sweet-alert-js', plugins_url('assets/js/sweetalert-dev.js', __FILE__));
249 + wp_enqueue_script('sweet-alert-js');
250 + // Tinymce Editor Js
251 + wp_register_script('ckeditor-js', plugins_url('assets/js/ckeditor-js/ckeditor.js', __FILE__));
252 + wp_enqueue_script('ckeditor-js');
253 + //MODAL POP UP JS
254 + wp_enqueue_script('pop-up',plugins_url('assets/js/modal.js',__FILE__));
255 + // Morris chart CSS & JS for dashboard
256 + if(isset($_REQUEST['page']) && sanitize_text_field($_REQUEST['page']) == 'user-uci-dashboard') {
257 + wp_enqueue_script( 'chart-utils-js', plugins_url('assets/js/chart-js/utils.js', __FILE__) );
258 + wp_enqueue_script( 'uci-dashboard', plugins_url('assets/js/chart-js/Chart.bundle.js', __FILE__) );
259 + wp_enqueue_script( 'uci-dashboard-chart', plugins_url( 'assets/js/chart-js/dashchart.js', __FILE__ ) );
260 + }
261 + //new files include
262 + wp_enqueue_style('custom-new-style', plugins_url('assets/css/custom-new-style.css', __FILE__));
263 + }
264 + wp_enqueue_style('style-maintenance', plugins_url('assets/css/style-maintenance.css', __FILE__));
265 + }
199 266
200 267 /**
201 - * Init UserSmCSVHandlerPro when WordPress Initialises.
268 + * Init SM_WPUltimateCSVImporterPro when WordPress Initialises.
202 269 */
203 270 public function init() {
204 271 if(is_admin()) :
205 272 // Init action.
@@ -205,14 +272,33 @@
205 272 // Init action.
206 273 do_action( 'uci_init' );
207 274 if(is_admin()) {
208 275 #$this->includes();
209 - //SmUCIUserAdminAjax::smuci_ajax_events();
276 + User_SmackUCIAdminAjax::smuci_ajax_events();
210 277 # Removed: De-Register the media sizes
211 278 }
212 279 endif;
213 280 }
214 281
282 + public function uci_pro_add_dashboard_widgets(){
283 + wp_enqueue_script( 'chart-utils-js', plugins_url('assets/js/chart-js/utils.js', __FILE__) );
284 + wp_enqueue_script( 'uci-wp-dash-chart-js', plugins_url('assets/js/chart-js/Chart.bundle.js', __FILE__) );
285 + wp_enqueue_script( 'uci-dashboard-chart-widget', plugins_url( 'assets/js/chart-js/dashchart-widget.js', __FILE__ ) );
286 + // Add widget on WordPress Dashboard
287 + $get_current_user = wp_get_current_user();
288 + $role = $get_current_user->roles[0];
289 + if( $role == "administrator" ) {
290 + wp_add_dashboard_widget( 'uci_pro_dashboard_linechart', 'Ultimate-CSV-Importer-Pro-Activity', array(
291 + 'User_SmackUCIAdmin',
292 + 'LineChart'
293 + ), $screen = get_current_screen(), 'advanced', 'high' );
294 + wp_add_dashboard_widget( 'uci_pro_dashboard_piechart', 'Ultimate-CSV-Importer-Pro-Statistics', array(
295 + 'User_SmackUCIAdmin',
296 + 'PieChart'
297 + ), $screen = get_current_screen(), 'advanced', 'high' );
298 + }
299 + }
300 +
215 301 /**
216 302 * Get the plugin url.
217 303 * @return string
218 304 */
@@ -237,17 +323,24 @@
237 323 }
238 324
239 325 /**
240 326 * Email Class.
241 - * @return SM_UCIUSER_Emails
327 + * @return USER_SM_UCI_Emails
242 328 */
243 329 public function mailer() {
244 - return SM_UCIUSER_Emails::instance();
330 + return USER_SM_UCI_Emails::instance();
245 331 }
246 332 }
247 333 endif;
248 334
249 335
336 +add_action('plugins_loaded','UserSmackCSVImporterLoadLanguages');
337 +function UserSmackCSVImporterLoadLanguages(){
338 + $wp_csv_importer_lang_dir = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
339 + load_plugin_textdomain( USER_SM_UCI_SLUG , false, $wp_csv_importer_lang_dir );
340 +}
341 +
342 +
250 343 /**
251 344 * Main instance of WPUltimateCSVImporterPro.
252 345 *
253 346 * Returns the main instance of WC to prevent the need to use globals.
@@ -254,9 +347,9 @@
254 347 *
255 348 * @since 5.0
256 349 * @return WPUltimateCSVImporterPro
257 350 */
258 -function SmUCIUser() {
259 - return UserSmCSVHandler::instance();
351 +function User_SmackUCI() {
352 + return User_SM_WPUltimateCSVImporter::instance();
260 353 }
261 354 // Global for backwards compatibility.
262 -$GLOBALS['wp_ultimate_csv_importer'] = SmUCIUser();
355 +$GLOBALS['wp_ultimate_csv_importer'] = User_SmackUCI();