PluginProbe
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on / 1.1
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on v1.1
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
import-users / index.php

index.php in Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on 1.1, at index.php

262 lines 9.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*******************************************************************************
3 * Plugin Name: Import Users
4 * Description: Seamlessly create users and import from your CSV data with ease.
5 * Version: 1.1
6 * Author: smackcoders
7 * Text Domain: Import-Users
8 * Domain Path: /languages/
9 */
10
11 /*******************************************************************************
12 * Import Users is a Tool for importing CSV for the Wordpress
13 * plugin developed by Smackcoders. Copyright (C) 2017 Smackcoders.
14 *
15 * Import Users is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Affero General Public License version 3
17 * as published by the Free Software Foundation with the addition of the
18 * following permission added to Section 15 as permitted in Section 7(a): FOR
19 * ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY Import Users,
20 Import Users DISCLAIMS THE WARRANTY OF NON
21 * INFRINGEMENT OF THIRD PARTY RIGHTS.
22 *
23 * Import Users is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
26 * License for more details.
27 *
28 * You should have received a copy of the GNU Affero General Public License
29 * along with this program; if not, see http://www.gnu.org/licenses or write
30 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 * Boston, MA 02110-1301 USA.
32 *
33 * You can contact Smackcoders at email address info@smackcoders.com.
34 *
35 * The interactive user interfaces in original and modified versions
36 * of this program must display Appropriate Legal Notices, as required under
37 * Section 5 of the GNU Affero General Public License version 3.
38 *
39 * In accordance with Section 7(b) of the GNU Affero General Public License
40 * version 3, these Appropriate Legal Notices must retain the display of the
41 * Import Users copyright notice. If the display of the logo is
42 * not reasonably feasible for technical reasons, the Appropriate Legal
43 * Notices must display the words
44 * "Copyright Smackcoders. 2017. All rights reserved".
45 ********************************************************************************/
46
47 if ( ! defined( 'ABSPATH' ) )
48 exit; // Exit if accessed directly
49
50 if ( ! class_exists( 'UserSmCSVHandler' ) ) :
51 /**
52 * Main WPUltimateCSVImporter Class.
53 *
54 * @class WPUltimateCSVImporter Class
55 * @version 5.0
56 */
57 class UserSmCSVHandler {
58
59 public $version = '1.1';
60
61 /**
62 * The single instance of the class.
63 *
64 * @var $_instance
65 * @since 5.0
66 */
67 protected static $_instance = null;
68
69 /**
70 * Main WPUltimateCSVImporter Instance.
71 *
72 * Ensures only one instance of WPUltimateCSVImporter is loaded or can be loaded.
73 *
74 * @since 5.0
75 * @static
76 * @see WC()
77 * @return UserSmCSVHandler - Main instance.
78 */
79 public static function instance() {
80 if ( is_null( self::$_instance ) ) {
81 self::$_instance = new self();
82 }
83 return self::$_instance;
84 }
85
86 /**
87 * UserSmCSVHandler Constructor.
88 */
89 public function __construct() {
90 include_once ( 'includes/class-uci-install.php' );
91 //include_once ( 'uninstall.php' );
92
93 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 );
96
97 if ( ! function_exists( 'is_plugin_active' ) ) {
98 require_once ABSPATH . 'wp-admin/includes/plugin.php';
99 }
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 // }
107
108 //add_action('in_plugin_update_message-import-users/index.php', array('SmUCIUserInstall', 'showUpgradeNotification'), 10, 2);
109
110 //add_filter('cron_schedules', array('SmUCIUserInstall', 'cron_schedules'));
111 $this->define_constants();
112 $this->includes();
113 $this->init_hooks();
114 }
115
116 /**
117 * Hook into actions and filters.
118 * @since 5.0
119 */
120 private function init_hooks() {
121 //register_activation_hook( __FILE__, array( 'SmUCIUserInstall', 'install' ) );
122 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' );
141 }
142
143 /**
144 * Define SmUCIUser Constants.
145 */
146 public function define_constants() {
147 $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');
170 }
171
172 /**
173 * Define constant if not already set.
174 *
175 * @param string $name
176 * @param string|bool $value
177 */
178 public function define( $name, $value ) {
179 if ( ! defined( $name ) ) {
180 define( $name, $value );
181 }
182 }
183
184 /**
185 * Include required core files used in admin and on the frontend.
186 */
187 public function includes() {
188 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' );
193 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();
197 }
198
199
200 /**
201 * Init UserSmCSVHandlerPro when WordPress Initialises.
202 */
203 public function init() {
204 if(is_admin()) :
205 // Init action.
206 do_action( 'uci_init' );
207 if(is_admin()) {
208 #$this->includes();
209 //SmUCIUserAdminAjax::smuci_ajax_events();
210 # Removed: De-Register the media sizes
211 }
212 endif;
213 }
214
215 /**
216 * Get the plugin url.
217 * @return string
218 */
219 public function plugin_url() {
220 return untrailingslashit( plugins_url( '/', __FILE__ ) );
221 }
222
223 /**
224 * Get the plugin path.
225 * @return string
226 */
227 public function plugin_path() {
228 return untrailingslashit( plugin_dir_path( __FILE__ ) );
229 }
230
231 /**
232 * Get Ajax URL.
233 * @return string
234 */
235 public function ajax_url() {
236 return admin_url( 'admin-ajax.php', 'relative' );
237 }
238
239 /**
240 * Email Class.
241 * @return SM_UCIUSER_Emails
242 */
243 public function mailer() {
244 return SM_UCIUSER_Emails::instance();
245 }
246 }
247 endif;
248
249
250 /**
251 * Main instance of WPUltimateCSVImporterPro.
252 *
253 * Returns the main instance of WC to prevent the need to use globals.
254 *
255 * @since 5.0
256 * @return WPUltimateCSVImporterPro
257 */
258 function SmUCIUser() {
259 return UserSmCSVHandler::instance();
260 }
261 // Global for backwards compatibility.
262 $GLOBALS['wp_ultimate_csv_importer'] = SmUCIUser();