PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.2
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.2
1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.23 All 172 releases
userswp / includes / class-userswp.php

class-userswp.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.2.2, at includes/class-userswp.php

905 lines 36.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The file that defines the core plugin class
4 *
5 * A class definition that includes attributes and functions used across both the
6 * public-facing side of the site and the admin area.
7 *
8 * @since 1.0.0
9 * @author GeoDirectory Team <info@wpgeodirectory.com>
10 */
11 final class UsersWP {
12
13 /**
14 * The current version of the plugin.
15 *
16 * @since 1.0.0
17 * @access protected
18 * @var string $version The current version of the plugin.
19 */
20 protected $version;
21
22 public $profile;
23 public $forms;
24 protected $i18n;
25 public $notices;
26 protected $templates;
27 protected $meta;
28 protected $pages;
29 protected $files;
30 protected $shortcodes;
31 protected $assets;
32 protected $admin;
33 protected $menus;
34 protected $form_builder;
35 protected $ajax;
36 protected $tools;
37 protected $tables;
38
39 /**
40 * Define the core functionality of the plugin.
41 *
42 * Set the plugin name and the plugin version that can be used throughout the plugin.
43 * Load the dependencies, define the locale, and set the hooks for the admin area and
44 * the public-facing side of the site.
45 *
46 * @since 1.0.0
47 */
48 public function __construct() {
49
50 $this->plugin_name = USERSWP_NAME;
51 $this->version = USERSWP_VERSION;
52
53
54 $this->load_dependencies();
55 $this->init_hooks();
56
57 $this->meta = new UsersWP_Meta();
58 $this->pages = new UsersWP_Pages();
59 $this->profile = new UsersWP_Profile();
60 $this->forms = new UsersWP_Forms();
61 $this->templates = new UsersWP_Templates();
62 $this->notices = new UsersWP_Notices();
63 $this->assets = new UsersWP_Public();
64 $this->form_builder = new UsersWP_Form_Builder();
65 $this->menus = new UsersWP_Menus();
66 $this->tools = new UsersWP_Tools();
67 $this->tables = new UsersWP_Tables();
68 $this->admin = new UsersWP_Admin();
69 $this->admin_menus = new UsersWP_Admin_Menus();
70 $this->ajax = new UsersWP_Ajax();
71 $this->files = new UsersWP_Files();
72 $this->notifications = new UsersWP_Notifications();
73
74
75 // actions and filters
76 $this->load_assets_actions_and_filters($this->assets);
77 $this->load_meta_actions_and_filters($this->meta);
78 $this->load_ajax_actions_and_filters($this->ajax);
79 $this->load_files_actions_and_filters($this->files);
80 $this->load_forms_actions_and_filters($this->forms);
81 $this->load_notices_actions_and_filters($this->notices);
82 $this->load_pages_actions_and_filters($this->pages);
83 $this->load_profile_actions_and_filters($this->profile);
84 $this->load_tables_actions_and_filters($this->tables);
85 $this->load_templates_actions_and_filters($this->templates);
86 $this->load_tools_actions_and_filters($this->tools);
87 $this->load_notifications_actions_and_filters($this->notifications);
88
89 //admin
90 $this->load_form_builder_actions_and_filters($this->form_builder);
91 $this->load_menus_actions_and_filters($this->menus);
92 $this->load_admin_actions_and_filters($this->admin);
93
94 }
95
96 /**
97 * Hook into actions and filters.
98 */
99 private function init_hooks() {
100 register_activation_hook( USERSWP_PLUGIN_FILE, array( 'UsersWP_Activator', 'activate' ) );
101 register_deactivation_hook( USERSWP_PLUGIN_FILE, array( 'UsersWP_Deactivator', 'deactivate' ) );
102 add_action( 'admin_init', array('UsersWP_Activator', 'automatic_upgrade') );
103 add_action( 'init', array( 'UsersWP_Activator', 'init_background_updater' ), 5 );
104 add_action( 'widgets_init', array( $this, 'register_widgets' ) );
105 add_action( 'init', array($this, 'load_plugin_textdomain'));
106 add_action( 'uwp_flush_rewrite_rules', array($this, 'flush_rewrite_rules'));
107 add_action( 'uwp_language_file_add_string', array($this, 'register_string'), 10, 1);
108 }
109
110 /**
111 * Actions for assets
112 *
113 * @param $instance
114 */
115 public function load_assets_actions_and_filters($instance) {
116 add_action( 'wp_enqueue_scripts', array($instance, 'enqueue_styles') );
117 add_action( 'wp_enqueue_scripts', array($instance, 'enqueue_scripts') );
118 }
119
120 /**
121 * Actions for meta data
122 *
123 * @param $instance
124 */
125 public function load_meta_actions_and_filters($instance) {
126 add_action('user_register', array($instance, 'sync_usermeta'), 10, 1);
127 add_action('delete_user', array($instance, 'delete_usermeta_for_user'), 10, 1);
128 add_action('remove_user_from_blog', array($instance, 'remove_user_from_blog'), 10, 2);
129 add_action('wp_login', array($instance, 'save_user_ip_on_login') ,10,2);
130 add_filter('uwp_before_extra_fields_save', array($instance, 'save_user_ip_on_register'), 10, 3);
131 add_filter('uwp_update_usermeta', array($instance, 'modify_datepicker_value_on_update'), 10, 3);
132 add_filter('uwp_get_usermeta', array($instance, 'modify_datepicker_value_on_get'), 10, 4);
133 add_filter('user_row_actions', array($instance, 'user_row_actions'), 10, 2);
134 add_action('bulk_actions-users', array($instance, 'users_bulk_actions'));
135 add_action('handle_bulk_actions-users', array($instance, 'handle_users_bulk_actions'), 10, 3);
136 add_filter('init', array($instance, 'process_user_actions'));
137 add_action('admin_notices', array($instance, 'show_update_messages'));
138 }
139
140 /**
141 * Actions for AJAX
142 *
143 * @param $instance
144 */
145 public function load_ajax_actions_and_filters($instance) {
146
147 }
148
149 public function load_files_actions_and_filters($instance) {
150 if($instance->doing_upload()){
151 add_filter( 'wp_handle_upload_prefilter', array($instance, 'wp_media_restrict_file_types') );
152 }
153 add_filter('uwp_get_max_upload_size', array($instance, 'uwp_modify_get_max_upload_size'), 10, 2);
154 }
155
156 /**
157 * Actions for forms
158 *
159 * @param $instance
160 */
161 public function load_forms_actions_and_filters($instance) {
162
163 // login
164 add_action('wp_ajax_nopriv_uwp_ajax_login_form', array($instance, 'ajax_login_form'));
165 add_action('wp_ajax_nopriv_uwp_ajax_login', array($instance, 'process_login'));
166
167 // register
168 add_action('wp_ajax_nopriv_uwp_ajax_register_form', array($instance, 'ajax_register_form'));
169 add_action('wp_ajax_nopriv_uwp_ajax_register', array($instance, 'process_register'));
170
171 // forgot
172 add_action('wp_ajax_nopriv_uwp_ajax_forgot_password_form', array($instance, 'ajax_forgot_password_form'));
173 add_action('wp_ajax_nopriv_uwp_ajax_forgot_password', array($instance, 'process_forgot'));
174
175 // general
176 add_action('init', array($instance, 'init_notices'), 1);
177 add_action('uwp_loaded', array($instance, 'handler'));
178 add_action('init', array($instance, 'privacy_submit_handler'));
179 add_action('uwp_template_display_notices', array($instance, 'display_notices'), 10, 1);
180 add_action('wp_ajax_uwp_upload_file_remove', array($instance, 'upload_file_remove'));
181 //User search form
182 add_action('personal_options_update', array($instance, 'update_profile_extra_admin_edit'), 10, 1);
183 add_action('edit_user_profile_update', array($instance, 'update_profile_extra_admin_edit'), 10, 1);
184 add_action('user_edit_form_tag', array($instance, 'add_multipart_to_admin_edit_form'));
185 add_action('uwp_template_form_title_after', array($instance, 'display_username_in_account'), 10, 1);
186 add_action('template_redirect', array($instance, 'process_login'));
187 add_action('template_redirect', array($instance, 'process_register'));
188 add_action('template_redirect', array($instance, 'process_account'));
189 add_action('template_redirect', array($instance, 'process_forgot'));
190 add_action('template_redirect', array($instance, 'process_change'));
191 add_action('template_redirect', array($instance, 'process_reset'));
192
193 // Forms
194 add_filter('uwp_form_input_html_datepicker', array($instance, 'form_input_datepicker'), 10, 4);
195 add_filter('uwp_form_input_html_time', array($instance, 'form_input_time'), 10, 4);
196 add_filter('uwp_form_input_html_select', array($instance, 'form_input_select'), 10, 4);
197 add_filter('uwp_form_input_html_multiselect', array($instance, 'form_input_multiselect'), 10, 4);
198 add_filter('uwp_form_input_html_text', array($instance, 'form_input_text'), 10, 4);
199 add_filter('uwp_form_input_html_textarea', array($instance, 'form_input_textarea'), 10, 4);
200 add_filter('uwp_form_input_html_fieldset', array($instance, 'form_input_fieldset'), 10, 4);
201 add_filter('uwp_form_input_html_file', array($instance, 'form_input_file'), 10, 4);
202 add_filter('uwp_form_input_html_checkbox', array($instance, 'form_input_checkbox'), 10, 4);
203 add_filter('uwp_form_input_html_radio', array($instance, 'form_input_radio'), 10, 4);
204 add_filter('uwp_form_input_html_url', array($instance, 'form_input_url'), 10, 4);
205 add_filter('uwp_form_input_html_email', array($instance, 'form_input_email'), 10, 4);
206 add_filter('uwp_form_input_html_password', array($instance, 'form_input_password'), 10, 4);
207 // Country select
208 add_filter('uwp_form_input_html_select_uwp_country', array($instance, 'form_input_select_country'), 10, 4);
209 add_filter('uwp_form_input_html_phone', array($instance, 'form_input_phone'), 10, 4);
210 add_filter('uwp_form_input_email_email_after', array($instance, 'register_confirm_email_field'), 10, 4);
211 add_filter('uwp_form_input_password_password_after', array($instance, 'register_confirm_password_field'), 10, 4);
212
213 // Emails
214 add_filter('uwp_send_mail_form_fields', array($instance, 'init_mail_form_fields'), 10, 3);
215 }
216
217 /**
218 * Actions for notices
219 *
220 * @param $instance
221 */
222 public function load_notices_actions_and_filters($instance) {
223 add_action('uwp_template_display_notices', array($instance, 'display_registration_disabled_notice'));
224 add_action('uwp_template_display_notices', array($instance, 'form_notice_by_key'));
225 add_action( 'admin_notices', array( $instance, 'show_admin_notices' ) );
226 add_action( 'admin_notices', array($instance, 'try_bootstrap') );
227 add_action( 'admin_notices', array($instance, 'yoast_user_archives_disabled') );
228 }
229
230 /**
231 * Actions for pages
232 *
233 * @param $instance
234 */
235 public function load_pages_actions_and_filters($instance) {
236 add_action( 'wpmu_new_blog', array($instance, 'wpmu_generate_default_pages_on_new_site'), 10, 6 );
237 add_filter( 'display_post_states', array( $instance, 'add_display_post_states' ), 10, 2 );
238 }
239
240 /**
241 * Actions for user profile
242 *
243 * @param $instance
244 */
245 public function load_profile_actions_and_filters($instance) {
246 add_action( 'template_redirect', array($instance, 'redirect_author_page') , 10 , 2 );
247 //profile page
248 add_filter('query_vars', array($instance, 'profile_query_vars'), 10, 1 );
249 add_action('init', array($instance, 'rewrite_profile_link') , 10, 1 );
250 add_filter( 'author_link', array($instance, 'get_author_link'), 10, 2 );
251 add_filter( 'edit_profile_url', array($instance, 'modify_admin_bar_edit_profile_url'), 10, 3);
252 add_filter( 'the_title', array($instance, 'modify_profile_page_title'), 10, 2 );
253 add_filter( 'get_comment_author_link', array($instance, 'get_comment_author_link') , 10 , 2 );
254 // add_action( 'uwp_profile_header', array($instance, 'get_profile_header'), 10, 4 );
255 add_action( 'uwp_users_profile_header', array($instance, 'get_profile_header'), 10, 1 );
256 add_action( 'uwp_user_title', array($instance, 'get_profile_title'), 10, 2 );
257 add_action( 'uwp_profile_social', array($instance, 'get_profile_social'), 10, 2 );
258 add_filter( 'get_avatar_url', array($instance, 'get_avatar_url'), 99, 3 );
259 add_action( 'uwp_profile_pagination' ,array($instance,'list_view_js'));
260
261 //Fields as tabs
262 add_action( 'uwp_available_tab_items', array($instance, 'extra_fields_available_tab_items'), 10, 1 );
263 add_action( 'uwp_profile_tabs', array($instance, 'extra_fields_as_tabs'), 10, 3 );
264
265 // Popup and crop functions
266 add_filter( 'ajax_query_attachments_args', array($instance, 'restrict_attachment_display') );
267
268 add_action( 'uwp_handle_file_upload_error_checks', array($instance, 'handle_file_upload_error_checks'), 10, 4 );
269 add_action( 'wp_ajax_uwp_avatar_banner_upload', array($instance, 'ajax_avatar_banner_upload') );
270 //add_action( 'wp_ajax_uwp_ajax_image_crop_popup', array($instance, 'uwp_ajax_image_crop_popup') );
271 add_action( 'wp_ajax_uwp_ajax_image_crop_popup_form', array($instance, 'ajax_image_crop_popup_form') );
272 add_action( 'wp_head', array($instance, 'define_ajaxurl') );
273 add_action( 'uwp_profile_header', array($instance, 'image_crop_init'), 10, 1 );
274 add_action( 'uwp_admin_profile_edit', array($instance, 'image_crop_init'), 10, 1 );
275
276 // Profile Tabs
277 add_action( 'uwp_profile_body', array($instance, 'get_profile_body'), 10, 1 );
278 add_action( 'uwp_profile_content', array($instance, 'get_profile_tabs_content'), 10, 1 );
279 add_action( 'uwp_profile_more_info_tab_content', array($instance, 'get_profile_more_info'), 10, 1);
280 add_action( 'uwp_profile_posts_tab_content', array($instance, 'get_profile_posts'), 10, 1);
281 add_action( 'uwp_profile_tab_icon', array($instance, 'get_profile_tab_icon'), 10, 3);
282 add_action( 'uwp_profile_comments_tab_content', array($instance, 'get_profile_comments'), 10, 1);
283 //add_action( 'uwp_profile_tab_content', array($instance, 'uwp_extra_fields_as_tab_values'), 10, 2 );
284
285 // Profile Pagination
286 add_action( 'uwp_profile_pagination', array($instance, 'get_profile_pagination'));
287
288 // Profile title
289 add_action( 'uwp_profile_after_title',array($instance, 'edit_profile_button'));
290
291 // Users
292 add_action( 'uwp_output_location', array($instance, 'show_output_location_data'), 10, 2);
293 add_action( 'wpdiscuz_profile_url', array($instance, 'wpdiscuz_profile_url'), 10, 2);
294
295 // User, allow subscribers to upload profile and banner pictures
296 add_filter( 'plupload_default_params', array($instance, 'add_uwp_plupload_param'), 10, 1 );
297 add_filter( 'user_has_cap', array($instance, 'allow_all_users_profile_uploads'), 10, 4 );
298 }
299
300 /**
301 * Actions for database tables
302 *
303 * @param $instance
304 */
305 public function load_tables_actions_and_filters($instance) {
306 add_filter( 'wpmu_drop_tables', array($instance, 'drop_tables_on_delete_blog'));
307 }
308
309 /**
310 * Actions for templates
311 *
312 * @param $instance
313 */
314 public function load_templates_actions_and_filters($instance) {
315
316 add_action( 'template_redirect', array($instance, 'change_default_password_redirect') );
317 add_action( 'uwp_template_fields', array($instance, 'template_fields'), 10, 1 );
318 add_action( 'uwp_template_fields', array($instance, 'template_extra_fields'), 10, 1 );
319 add_action( 'uwp_template_fields', array($instance, 'add_template_fields_terms_check'), 100, 1 );
320 //add_action( 'uwp_account_form_display', array($instance, 'account_edit_form_display'), 10, 1 );
321 add_action( 'uwp_account_form_display', array($instance, 'privacy_edit_form_display'), 10, 1 );
322 add_action( 'wp_logout', array($instance, 'logout_redirect'));
323 add_action( 'init', array($instance, 'wp_login_redirect'));
324 add_action( 'init', array($instance, 'wp_register_redirect'));
325 add_action( 'admin_init', array($instance, 'activation_redirect'));
326 // Redirect functions
327 add_action( 'template_redirect', array($instance, 'profile_redirect'), 10);
328 add_action( 'template_redirect', array($instance, 'access_checks'), 20);
329 add_action( 'wp', array($instance, 'redirect_templates_sub_pages'));
330 // Admin user edit page
331 add_action( 'edit_user_profile', array($instance, 'get_profile_extra_admin_edit'), 10, 1 );
332 add_action( 'show_user_profile', array($instance, 'get_profile_extra_admin_edit'), 10, 1 );
333 add_action('wp_login', array($instance, 'unconfirmed_login_redirect'), 10, 2);
334
335 add_filter( 'wp_setup_nav_menu_item', array($instance, 'setup_nav_menu_item'), 10, 1 );
336 add_filter( 'the_content', array($instance, 'author_page_content'), 10, 1 );
337 add_filter( 'the_content', array($instance, 'author_box_page_content'), 10, 1 );
338 add_filter( 'the_content', array($instance, 'setup_singular_page_content'), 10, 1 );
339 add_filter( 'body_class', array($instance, 'add_body_class'), 10, 1 );
340
341 // filter the login and register url
342 add_filter( 'login_url', array($instance, 'wp_login_url'), 10, 3 );
343 add_filter( 'register_url', array($instance, 'wp_register_url'), 10, 1 );
344 add_filter( 'lostpassword_url', array($instance, 'wp_lostpassword_url'), 10, 1 );
345
346 }
347
348 /**
349 * Actions for tools
350 *
351 * @param $instance
352 */
353 public function load_tools_actions_and_filters($instance) {
354 add_action('uwp_admin_sub_menus', array($instance, 'uwp_add_admin_tools_sub_menu'), 100, 1);
355 add_action('uwp_tools_settings_main_tab_content', array($instance, 'uwp_tools_main_tab_content'));
356 add_action('wp_ajax_uwp_process_diagnosis', array($instance, 'uwp_process_diagnosis_ajax'));
357 }
358
359 /**
360 * Actions for notifications
361 *
362 * @param $instance
363 */
364 public function load_notifications_actions_and_filters($instance){
365 add_action('uwp_account_form_display', array($instance, 'user_notifications_form_front'), 10, 1);
366 add_action('init', array($instance, 'notification_submit_handler'));
367 }
368
369 /**
370 * Actions for form builder
371 *
372 * @param $instance
373 */
374 public function load_form_builder_actions_and_filters($instance) {
375 // Actions
376 add_action('uwp_manage_available_fields_predefined', array($instance, 'manage_available_fields_predefined'));
377 add_action('uwp_manage_available_fields_custom', array($instance, 'manage_available_fields_custom'));
378 add_action('uwp_manage_available_fields', array($instance, 'manage_available_fields'));
379 add_action('uwp_manage_selected_fields', array($instance, 'manage_selected_fields'));
380 add_action('uwp_admin_extra_custom_fields', array($instance, 'advance_admin_custom_fields'), 10, 2);
381 add_action('wp_ajax_uwp_ajax_register_action', array($instance, 'register_ajax_handler'));
382 add_action('wp_ajax_uwp_ajax_action', array($instance, 'create_field'));
383 add_action('uwp_form_builder_tabs_content', array($instance, 'uwp_form_builder'));
384
385 // Filters
386 add_filter('uwp_builder_extra_fields_multiselect', array($instance, 'builder_extra_fields_smr'), 10, 4);
387 add_filter('uwp_builder_extra_fields_select', array($instance, 'builder_extra_fields_smr'), 10, 4);
388 add_filter('uwp_builder_extra_fields_radio', array($instance, 'builder_extra_fields_smr'), 10, 4);
389 add_filter('uwp_builder_extra_fields_datepicker', array($instance, 'builder_extra_fields_datepicker'), 10, 4);
390 add_filter('uwp_builder_extra_fields_password', array($instance, 'builder_extra_fields_password'), 10, 4);
391 add_filter('uwp_builder_extra_fields_email', array($instance, 'builder_extra_fields_email'), 10, 4);
392 add_filter('uwp_builder_extra_fields_file', array($instance, 'builder_extra_fields_file'), 10, 4);
393 add_filter('uwp_builder_data_type_text', array($instance, 'builder_data_type_text'), 10, 4);
394 add_filter('uwp_form_builder_available_fields_head', array($instance, 'register_available_fields_head'), 10, 2);
395 add_filter('uwp_form_builder_available_fields_note', array($instance, 'register_available_fields_note'), 10, 2);
396 add_filter('uwp_form_builder_selected_fields_head', array($instance, 'register_selected_fields_head'), 10, 2);
397 add_filter('uwp_form_builder_selected_fields_note', array($instance, 'register_selected_fields_note'), 10, 2);
398 // htmlvar not needed for taxonomy
399 add_filter('uwp_builder_htmlvar_name_taxonomy',array($instance, 'return_empty_string'),10,4);
400 // default_value not needed for textarea, html, file, fieldset
401 add_filter('uwp_builder_default_value_textarea',array($instance, 'return_empty_string'),10,4);
402 add_filter('uwp_builder_default_value_html',array($instance, 'return_empty_string'),10,4);
403 add_filter('uwp_builder_default_value_file',array($instance, 'return_empty_string'),10,4);
404 add_filter('uwp_builder_default_value_fieldset',array($instance, 'return_empty_string'),10,4);
405 // is_required not needed for fieldset
406 add_filter('uwp_builder_is_required_fieldset',array($instance, 'return_empty_string'),10,4);
407 add_filter('uwp_builder_required_msg_fieldset',array($instance, 'return_empty_string'),10,4);
408 // field_icon not needed for fieldset
409 add_filter('uwp_builder_css_class_fieldset',array($instance, 'return_empty_string'),10,4);
410 // filters for which is_public not required
411 add_filter('uwp_builder_is_public_password',array($instance, 'return_empty_string'),10,4);
412 }
413
414 /**
415 * Actions for admin menus
416 *
417 * @param $instance
418 */
419 public function load_menus_actions_and_filters($instance) {
420 add_action( 'load-nav-menus.php', array($instance, 'users_wp_admin_menu_metabox') );
421 add_action( 'admin_bar_menu', array($instance, 'admin_bar_menu'), 51 );
422 }
423
424 /**
425 * Actions for admin
426 *
427 * @param $instance
428 */
429 public function load_admin_actions_and_filters($instance) {
430 add_action( 'admin_enqueue_scripts', array($instance, 'enqueue_styles') );
431 add_action( 'admin_enqueue_scripts', array($instance, 'enqueue_scripts') );
432 add_action('admin_head', array($instance, 'admin_only_css'));
433 add_action('admin_footer', array($instance, 'admin_only_script'));
434 add_action('user_profile_picture_description', array($instance, 'user_profile_picture_description'));
435 add_action('show_user_profile', array($instance, 'edit_profile_banner_fields'));
436 add_action('edit_user_profile', array($instance, 'edit_profile_banner_fields'));
437 add_action('admin_body_class', array($instance, 'admin_body_class'));
438 }
439
440 /**
441 * Register widgets
442 *
443 */
444 public function register_widgets(){
445 register_widget("UWP_Register_Widget");
446 register_widget("UWP_Forgot_Widget");
447 register_widget("UWP_Login_Widget");
448 register_widget("UWP_Change_Widget");
449 register_widget("UWP_Reset_Widget");
450 register_widget("UWP_Users_Widget");
451 register_widget("UWP_Users_Item_Widget");
452 register_widget("UWP_Account_Widget");
453 register_widget("UWP_Profile_Widget");
454
455 register_widget("UWP_Profile_Header_Widget");
456 register_widget("UWP_Profile_Social_Widget");
457 register_widget("UWP_Profile_Tabs_Widget");
458 register_widget("UWP_Profile_Actions_Widget");
459 register_widget("UWP_Profile_Section_Widget");
460
461 register_widget("UWP_User_Title_Widget");
462 register_widget("UWP_User_Avatar_Widget");
463 register_widget("UWP_User_Meta_Widget");
464 register_widget("UWP_Users_Search_Widget");
465 register_widget("UWP_Users_Loop_Actions");
466 register_widget("UWP_Users_Loop_Widget");
467 register_widget("UWP_User_Actions_Widget");
468 register_widget("UWP_Output_Location_Widget");
469 register_widget("UWP_Author_Box_Widget");
470 register_widget("UWP_Button_Group_Widget");
471 }
472
473 /**
474 * The name of the plugin used to uniquely identify it within the context of
475 * WordPress and to define internationalization functionality.
476 *
477 * @since 1.0.0
478 * @return string The name of the plugin.
479 */
480 public function get_plugin_name() {
481 return $this->plugin_name;
482 }
483
484 /**
485 * Retrieve the version number of the plugin.
486 *
487 * @since 1.0.0
488 * @return string The version number of the plugin.
489 */
490 public function get_version() {
491 return $this->version;
492 }
493
494 /**
495 * Load the required dependencies for this plugin.
496 *
497 * @since 1.0.0
498 * @access private
499 */
500 private function load_dependencies() {
501 global $uwp_options;
502
503 if ( ! function_exists( 'is_plugin_active' ) ) {
504 /**
505 * Load all plugin functions from WordPress.
506 */
507 require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
508 }
509
510 require_once dirname(dirname( __FILE__ )) . '/admin/settings/functions.php';
511
512 $uwp_options = uwp_get_settings();
513
514
515 require_once( dirname(dirname( __FILE__ )) . '/upgrade.php' );
516
517 /**
518 * The class responsible for activation functionality
519 * of the plugin.
520 */
521 require_once dirname(dirname( __FILE__ )) . '/includes/class-activator.php';
522
523 /**
524 * The class responsible for deactivation functionality
525 * of the plugin.
526 */
527 require_once dirname(dirname( __FILE__ )) . '/includes/class-deactivator.php';
528
529 /**
530 * The libraries required.
531 */
532 require_once dirname(dirname( __FILE__ )) . '/vendor/autoload.php';
533
534 /**
535 * Contains functions for templates.
536 */
537 require_once( dirname(dirname( __FILE__ )) .'/includes/template-functions.php' );
538
539 /**
540 * The class responsible for sending emails
541 * of the plugin.
542 */
543 require_once dirname(dirname( __FILE__ )) . '/includes/class-emails.php';
544
545 /**
546 * The class responsible for reading and updating meta
547 * of the plugin.
548 */
549 require_once dirname(dirname( __FILE__ )) . '/includes/class-meta.php';
550
551 /**
552 * The class responsible for userswp dates
553 * of the plugin.
554 */
555 require_once dirname(dirname( __FILE__ )) . '/includes/class-date.php';
556
557 /**
558 * The class responsible for userswp pages
559 * of the plugin.
560 */
561 require_once dirname(dirname( __FILE__ )) . '/includes/class-pages.php';
562
563 /**
564 * The class responsible for uploading files
565 * of the plugin.
566 */
567 require_once dirname(dirname( __FILE__ )) . '/includes/class-files.php';
568
569 /**
570 * The class responsible for defining form handler functionality
571 * of the plugin.
572 */
573 require_once dirname(dirname( __FILE__ )) . '/includes/class-forms.php';
574
575 /**
576 * The class responsible for form validation
577 * of the plugin.
578 */
579 require_once dirname(dirname( __FILE__ )) . '/includes/class-validation.php';
580
581 /**
582 * Country helpers
583 */
584 require_once dirname(dirname( __FILE__ )) . '/includes/class-countries.php';
585
586 /**
587 * The class responsible for defining ajax handler functionality
588 * of the plugin.
589 */
590 require_once dirname(dirname( __FILE__ )) . '/includes/class-ajax.php';
591
592 /**
593 * The class responsible for defining all shortcodes
594 */
595 require_once dirname(dirname( __FILE__ )) . '/includes/class-templates.php';
596
597 /**
598 * The class responsible for defining profile content
599 */
600 require_once dirname(dirname( __FILE__ )) . '/includes/class-profile.php';
601
602 /**
603 * The class responsible for defining all menus items.
604 */
605 require_once dirname(dirname( __FILE__ )) . '/admin/menus/class-checklist.php';
606
607 /**
608 * The class responsible for defining all menus in the admin area.
609 */
610 require_once dirname(dirname( __FILE__ )) . '/admin/menus/class-menus.php';
611
612 /**
613 * The class responsible for defining all actions that occur in the admin area.
614 */
615 require_once dirname(dirname( __FILE__ )) . '/admin/class-admin.php';
616
617 /**
618 * The class responsible for defining all actions that occur for setup wizard.
619 */
620 if ( isset( $_GET['page'] ) && 'uwp-setup' == $_GET['page'] ) {
621 require_once dirname( dirname( __FILE__ ) ) . '/admin/class-admin-setup-wizard.php';
622 }
623
624 /**
625 * The class responsible for defining all actions help screen.
626 */
627 require_once dirname(dirname( __FILE__ )) . '/admin/class-uwp-admin-help.php';
628
629 /**
630 * The class responsible for defining all menus in the admin area.
631 */
632 require_once dirname(dirname( __FILE__ )) . '/admin/class-uwp-admin-menus.php';
633
634 /**
635 * The class responsible for defining all admin area settings.
636 */
637 require_once dirname(dirname( __FILE__ )) . '/admin/settings/class-settings.php';
638
639 /**
640 * The class responsible for default content.
641 */
642 require_once dirname(dirname( __FILE__ )) . '/includes/class-uwp-defaults.php';
643
644 /**
645 * The class responsible for defining all actions that occur in the public-facing
646 * side of the site.
647 */
648 require_once dirname(dirname( __FILE__ )) . '/public/class-public.php';
649
650 /**
651 * The class responsible for table functions
652 */
653 require_once dirname(dirname( __FILE__ )) . '/includes/class-tables.php';
654
655 /**
656 * The class responsible for admin settings functions
657 */
658 include_once dirname(dirname( __FILE__ )) . '/admin/settings/class-uwp-settings-page.php';
659
660 /**
661 * The class responsible for adding fields in forms
662 */
663 require_once dirname(dirname( __FILE__ )) . '/admin/settings/class-formbuilder.php';
664
665 /**
666 * The class responsible for defining all admin area settings.
667 */
668 require_once dirname(dirname( __FILE__ )) . '/admin/settings/class-uwp-settings-profile-tabs.php';
669
670 /**
671 * The class responsible for adding tools functions
672 */
673 require_once dirname(dirname( __FILE__ )) . '/includes/class-tools.php';
674
675 /**
676 * The class responsible for displaying notices
677 */
678 require_once dirname(dirname( __FILE__ )) . '/includes/class-notices.php';
679
680 /**
681 * contents helpers files and functions.
682 */
683 require_once( dirname(dirname( __FILE__ )) .'/includes/helpers.php' );
684
685 /**
686 * The class for login widget.
687 */
688 require_once( dirname(dirname( __FILE__ )) .'/widgets/login.php' );
689
690 /**
691 * The class for register widget.
692 */
693 require_once( dirname(dirname( __FILE__ )) .'/widgets/register.php' );
694
695 /**
696 * The class for forgot password widget.
697 */
698 require_once( dirname(dirname( __FILE__ )) .'/widgets/forgot.php' );
699
700 /**
701 * The class for reset password widget.
702 */
703 require_once( dirname(dirname( __FILE__ )) .'/widgets/reset.php' );
704
705 /**
706 * The class for change password widget.
707 */
708 require_once( dirname(dirname( __FILE__ )) .'/widgets/change.php' );
709
710 /**
711 * The class for users widget.
712 */
713 require_once( dirname(dirname( __FILE__ )) .'/widgets/users.php' );
714
715 /**
716 * The class for users item widget.
717 */
718 require_once( dirname(dirname( __FILE__ )) .'/widgets/users-item.php' );
719
720 /**
721 * The class for account widget.
722 */
723 require_once( dirname(dirname( __FILE__ )) .'/widgets/account.php' );
724
725 /**
726 * The class for profile widget.
727 */
728 require_once( dirname(dirname( __FILE__ )) .'/widgets/profile.php' );
729
730 /**
731 * The class for profile sections widget.
732 */
733 require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-section.php' );
734
735 /**
736 * The class profile header widget
737 */
738 require_once dirname(dirname( __FILE__ )) . '/widgets/profile-header.php';
739
740 /**
741 * The class for user title widget.
742 */
743 require_once( dirname(dirname( __FILE__ )) .'/widgets/user-title.php' );
744
745 /**
746 * The class for user avatar widget.
747 */
748 require_once( dirname(dirname( __FILE__ )) .'/widgets/user-avatar.php' );
749
750 /**
751 * The class for profile social fields widget.
752 */
753 require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-social.php' );
754
755 /**
756 * The class for profile action buttons fields widget.
757 */
758 require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-actions.php' );
759
760 /**
761 * The class for profile buttons fields widget.
762 */
763 require_once( dirname(dirname( __FILE__ )) .'/widgets/user-actions.php' );
764
765 /**
766 * The class for profile content widget.
767 */
768 require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-tabs.php' );
769
770 /**
771 * The class for user meta widget.
772 */
773 require_once( dirname(dirname( __FILE__ )) .'/widgets/user-meta.php' );
774
775 /**
776 * The class for users search widget.
777 */
778 require_once( dirname(dirname( __FILE__ )) .'/widgets/users-search.php' );
779
780 /**
781 * The class for user list sorting widget.
782 */
783 require_once( dirname(dirname( __FILE__ )) .'/widgets/users-loop-actions.php' );
784
785 /**
786 * The class for users list widget.
787 */
788 require_once( dirname(dirname( __FILE__ )) .'/widgets/users-loop.php' );
789
790 /**
791 * The class for output location widget.
792 */
793 require_once( dirname(dirname( __FILE__ )) .'/widgets/output-location.php' );
794
795 /**
796 * The class for author box widget.
797 */
798 require_once( dirname(dirname( __FILE__ )) .'/widgets/authorbox.php' );
799
800 /**
801 * The class for button group widget.
802 */
803 require_once( dirname(dirname( __FILE__ )) .'/widgets/button-group.php' );
804
805 /**
806 * The class responsible for displaying notices
807 */
808 require_once dirname(dirname( __FILE__ )) . '/includes/class-import-export.php';
809
810 /**
811 * The class responsible for displaying notices
812 */
813 require_once dirname(dirname( __FILE__ )) . '/includes/class-user-notifications.php';
814
815 /**
816 * The class responsible for account handling
817 */
818 require_once dirname(dirname( __FILE__ )) . '/includes/class-account.php';
819
820 /**
821 * The class responsible for adding tools functions
822 */
823 require_once dirname(dirname( __FILE__ )) . '/includes/class-status.php';
824
825 /**
826 * The class responsible for extensions screen functions on admin side
827 */
828 require_once dirname(dirname( __FILE__ )) . '/includes/libraries/class-ayecode-addons.php';
829
830 /**
831 * The class responsible for extensions screen functions on admin side
832 */
833 require_once dirname(dirname( __FILE__ )) . '/includes/class-addons.php';
834
835 /**
836 * The file is responsible for defining deprecated functions.
837 */
838 require_once dirname(dirname( __FILE__ )) . '/includes/deprecated-functions.php';
839
840 /**
841 * The class responsible for privacy policy functions
842 */
843 require_once dirname(dirname( __FILE__ )) . '/includes/abstract-uwp-privacy.php';
844 require_once dirname(dirname( __FILE__ )) . '/includes/class-uwp-privacy.php';
845
846 if ( is_plugin_active( 'uwp_geodirectory/uwp_geodirectory.php' ) ) {
847 deactivate_plugins( 'uwp_geodirectory/uwp_geodirectory.php' );
848 }
849
850 if ( is_plugin_active( 'geodirectory/geodirectory.php' ) || class_exists('GeoDirectory') ) {
851 /**
852 * The class responsible for displaying notices
853 *
854 * @since 1.0.12
855 */
856 require_once dirname(dirname( __FILE__ )) . '/includes/libraries/class-geodirectory-plugin.php';
857 }
858
859 if ( class_exists('WPInv_Invoice') ) {
860 /**
861 * The class responsible for displaying notices
862 *
863 * @since 1.0.12
864 */
865 require_once dirname(dirname( __FILE__ )) . '/includes/libraries/class-invoicing-plugin.php';
866 }
867 }
868
869 /**
870 * Load the plugin text domain for translation.
871 *
872 * @since 1.0.0
873 * @package userswp
874 * @return void
875 */
876 public function load_plugin_textdomain() {
877
878 load_plugin_textdomain( 'userswp', false, basename( dirname (dirname( __FILE__ ) ) ) . '/languages' );
879
880 do_action('uwp_loaded');
881
882 }
883
884 /**
885 * Flush rewrite rules.
886 *
887 * @return void
888 */
889 public function flush_rewrite_rules(){
890 flush_rewrite_rules();
891 }
892
893 /**
894 * Registers an individual text string for WPML translation.
895 *
896 * @since 1.2.2
897 *
898 * @param string $string The string that needs to be translated.
899 * @param string $domain The plugin domain. Default userswp.
900 * @param string $name The name of the string which helps to know what's being translated.
901 */
902 public static function register_string( $string, $domain = 'userswp', $name = '' ) {
903 do_action( 'wpml_register_single_string', $domain, $name, $string );
904 }
905 }