| 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 |
protected $profile; |
| 23 |
public $forms; |
| 24 |
protected $i18n; |
| 25 |
protected $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->i18n = new UsersWP_i18n(); |
| 63 |
$this->notices = new UsersWP_Notices(); |
| 64 |
$this->assets = new UsersWP_Public(); |
| 65 |
$this->form_builder = new UsersWP_Form_Builder(); |
| 66 |
$this->menus = new UsersWP_Menus(); |
| 67 |
$this->tools = new UsersWP_Tools(); |
| 68 |
$this->tables = new UsersWP_Tables(); |
| 69 |
$this->admin = new UsersWP_Admin(); |
| 70 |
$this->admin_menus = new UsersWP_Admin_Menus(); |
| 71 |
$this->ajax = new UsersWP_Ajax($this->form_builder); |
| 72 |
$this->files = new UsersWP_Files(); |
| 73 |
$this->notifications = new UsersWP_Notifications(); |
| 74 |
|
| 75 |
|
| 76 |
// actions and filters |
| 77 |
$this->load_assets_actions_and_filters($this->assets); |
| 78 |
$this->load_meta_actions_and_filters($this->meta); |
| 79 |
$this->load_ajax_actions_and_filters($this->ajax); |
| 80 |
$this->load_files_actions_and_filters($this->files); |
| 81 |
$this->load_forms_actions_and_filters($this->forms); |
| 82 |
$this->load_i18n_actions_and_filters($this->i18n); |
| 83 |
$this->load_notices_actions_and_filters($this->notices); |
| 84 |
$this->load_pages_actions_and_filters($this->pages); |
| 85 |
$this->load_profile_actions_and_filters($this->profile); |
| 86 |
$this->load_tables_actions_and_filters($this->tables); |
| 87 |
$this->load_templates_actions_and_filters($this->templates); |
| 88 |
$this->load_tools_actions_and_filters($this->tools); |
| 89 |
$this->load_notifications_actions_and_filters($this->notifications); |
| 90 |
|
| 91 |
//admin |
| 92 |
$this->load_form_builder_actions_and_filters($this->form_builder); |
| 93 |
$this->load_menus_actions_and_filters($this->menus); |
| 94 |
$this->load_admin_actions_and_filters($this->admin); |
| 95 |
|
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Hook into actions and filters. |
| 100 |
*/ |
| 101 |
private function init_hooks() { |
| 102 |
register_activation_hook( USERSWP_PLUGIN_FILE, array( 'UsersWP_Activator', 'activate' ) ); |
| 103 |
register_deactivation_hook( USERSWP_PLUGIN_FILE, array( 'UsersWP_Deactivator', 'deactivate' ) ); |
| 104 |
add_action( 'admin_init', array('UsersWP_Activator', 'uwp_automatic_upgrade') ); |
| 105 |
add_action( 'init', array( 'UsersWP_Activator', 'init_background_updater' ), 5 ); |
| 106 |
add_action( 'widgets_init', array( $this, 'register_widgets' ) ); |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
public function load_assets_actions_and_filters($instance) { |
| 111 |
add_action( 'wp_enqueue_scripts', array($instance, 'enqueue_styles') ); |
| 112 |
add_action( 'wp_enqueue_scripts', array($instance, 'enqueue_scripts') ); |
| 113 |
} |
| 114 |
|
| 115 |
public function load_meta_actions_and_filters($instance) { |
| 116 |
add_action('user_register', array($instance, 'sync_usermeta'), 10, 1); |
| 117 |
add_action('delete_user', array($instance, 'delete_usermeta_for_user'), 10, 1); |
| 118 |
add_action('remove_user_from_blog', array($instance, 'remove_user_from_blog'), 10, 2); |
| 119 |
add_action('wp_login', array($instance, 'save_user_ip_on_login') ,10,2); |
| 120 |
add_filter('uwp_before_extra_fields_save', array($instance, 'save_user_ip_on_register'), 10, 3); |
| 121 |
add_filter('uwp_update_usermeta', array($instance, 'modify_datepicker_value_on_update'), 10, 3); |
| 122 |
add_filter('uwp_get_usermeta', array($instance, 'modify_datepicker_value_on_get'), 10, 4); |
| 123 |
add_filter('user_row_actions', array($instance, 'uwp_user_row_actions'), 10, 2); |
| 124 |
add_action('bulk_actions-users', array($instance, 'uwp_users_bulk_actions')); |
| 125 |
add_action('handle_bulk_actions-users', array($instance, 'uwp_handle_users_bulk_actions'), 10, 3); |
| 126 |
add_filter('init', array($instance, 'uwp_process_user_actions')); |
| 127 |
add_action('admin_notices', array($instance, 'uwp_show_update_messages')); |
| 128 |
} |
| 129 |
|
| 130 |
public function load_ajax_actions_and_filters($instance) { |
| 131 |
add_action('wp_ajax_uwp_ajax_action', array($instance, 'handler')); |
| 132 |
} |
| 133 |
|
| 134 |
public function load_files_actions_and_filters($instance) { |
| 135 |
if($instance->uwp_doing_upload()){ |
| 136 |
add_filter( 'wp_handle_upload_prefilter', array($instance, 'uwp_wp_media_restrict_file_types') ); |
| 137 |
} |
| 138 |
add_filter('uwp_get_max_upload_size', array($instance, 'uwp_modify_get_max_upload_size'), 10, 2); |
| 139 |
} |
| 140 |
|
| 141 |
public function load_forms_actions_and_filters($instance) { |
| 142 |
// general |
| 143 |
add_action('init', array($instance, 'init_notices'), 1); |
| 144 |
add_action('uwp_loaded', array($instance, 'handler')); |
| 145 |
add_action('init', array($instance, 'uwp_privacy_submit_handler')); |
| 146 |
add_action('uwp_template_display_notices', array($instance, 'display_notices'), 10, 1); |
| 147 |
add_action('wp_ajax_uwp_upload_file_remove', array($instance, 'uwp_upload_file_remove')); |
| 148 |
//User search form |
| 149 |
add_action('uwp_users_page_search_form_inner', array($instance, 'uwp_users_search_form_text_field'), 10, 1); |
| 150 |
add_action('uwp_users_page_search_form_inner', array($instance, 'uwp_users_search_form_submit'), 50, 1); |
| 151 |
add_action('personal_options_update', array($instance, 'update_profile_extra_admin_edit'), 10, 1); |
| 152 |
add_action('edit_user_profile_update', array($instance, 'update_profile_extra_admin_edit'), 10, 1); |
| 153 |
add_action('user_edit_form_tag', array($instance, 'add_multipart_to_admin_edit_form')); |
| 154 |
add_action('uwp_template_form_title_after', array($instance, 'uwp_display_username_in_account'), 10, 1); |
| 155 |
add_action('init', array($instance, 'process_login')); |
| 156 |
add_action('init', array($instance, 'process_register')); |
| 157 |
add_action('init', array($instance, 'process_account')); |
| 158 |
add_action('init', array($instance, 'process_forgot')); |
| 159 |
add_action('init', array($instance, 'process_change')); |
| 160 |
add_action('init', array($instance, 'process_reset')); |
| 161 |
|
| 162 |
// Forms |
| 163 |
add_filter('uwp_form_input_html_datepicker', array($instance, 'uwp_form_input_datepicker'), 10, 4); |
| 164 |
add_filter('uwp_form_input_html_time', array($instance, 'uwp_form_input_time'), 10, 4); |
| 165 |
add_filter('uwp_form_input_html_select', array($instance, 'uwp_form_input_select'), 10, 4); |
| 166 |
add_filter('uwp_form_input_html_multiselect', array($instance, 'uwp_form_input_multiselect'), 10, 4); |
| 167 |
add_filter('uwp_form_input_html_text', array($instance, 'uwp_form_input_text'), 10, 4); |
| 168 |
add_filter('uwp_form_input_html_textarea', array($instance, 'uwp_form_input_textarea'), 10, 4); |
| 169 |
add_filter('uwp_form_input_html_fieldset', array($instance, 'uwp_form_input_fieldset'), 10, 4); |
| 170 |
add_filter('uwp_form_input_html_file', array($instance, 'uwp_form_input_file'), 10, 4); |
| 171 |
add_filter('uwp_form_input_html_checkbox', array($instance, 'uwp_form_input_checkbox'), 10, 4); |
| 172 |
add_filter('uwp_form_input_html_radio', array($instance, 'uwp_form_input_radio'), 10, 4); |
| 173 |
add_filter('uwp_form_input_html_url', array($instance, 'uwp_form_input_url'), 10, 4); |
| 174 |
add_filter('uwp_form_input_html_email', array($instance, 'uwp_form_input_email'), 10, 4); |
| 175 |
add_filter('uwp_form_input_html_password', array($instance, 'uwp_form_input_password'), 10, 4); |
| 176 |
// Country select |
| 177 |
add_filter('uwp_form_input_html_select_country', array($instance, 'uwp_form_input_select_country'), 10, 4); |
| 178 |
add_filter('uwp_form_input_email_uwp_account_email_after', array($instance, 'uwp_register_confirm_email_field'), 10, 4); |
| 179 |
add_filter('uwp_form_input_password_uwp_account_password_after', array($instance, 'uwp_register_confirm_password_field'), 10, 4); |
| 180 |
|
| 181 |
// Emails |
| 182 |
add_filter('uwp_send_mail_extras', array($instance, 'init_mail_extras'), 10, 3); |
| 183 |
add_filter('uwp_send_admin_mail_extras', array($instance, 'init_admin_mail_extras'), 10, 3); |
| 184 |
|
| 185 |
} |
| 186 |
|
| 187 |
public function load_i18n_actions_and_filters($instance) { |
| 188 |
add_action( 'init', array($instance, 'load_plugin_textdomain')); |
| 189 |
} |
| 190 |
|
| 191 |
public function load_notices_actions_and_filters($instance) { |
| 192 |
add_action('uwp_template_display_notices', array($instance, 'display_registration_disabled_notice')); |
| 193 |
add_action('uwp_template_display_notices', array($instance, 'form_notice_by_key')); |
| 194 |
add_action( 'admin_notices', array( $instance, 'show_admin_notices' ) ); |
| 195 |
add_action( 'admin_notices', array($instance, 'uwp_admin_notices') ); |
| 196 |
} |
| 197 |
|
| 198 |
public function load_pages_actions_and_filters($instance) { |
| 199 |
add_action( 'wpmu_new_blog', array($instance, 'wpmu_generate_default_pages_on_new_site'), 10, 6 ); |
| 200 |
add_filter( 'display_post_states', array( $instance, 'add_display_post_states' ), 10, 2 ); |
| 201 |
} |
| 202 |
|
| 203 |
public function load_profile_actions_and_filters($instance) { |
| 204 |
add_action( 'template_redirect', array($instance, 'uwp_redirect_author_page') , 10 , 2 ); |
| 205 |
//profile page |
| 206 |
add_filter('query_vars', array($instance, 'profile_query_vars'), 10, 1 ); |
| 207 |
add_action('init', array($instance, 'rewrite_profile_link') , 10, 1 ); |
| 208 |
add_filter( 'author_link', array($instance, 'get_profile_link'), 10, 2 ); |
| 209 |
add_filter( 'edit_profile_url', array($instance, 'uwp_modify_admin_bar_edit_profile_url'), 10, 3); |
| 210 |
add_filter( 'the_title', array($instance, 'modify_profile_page_title'), 10, 2 ); |
| 211 |
add_filter( 'get_comment_author_link', array($instance, 'uwp_get_comment_author_link') , 10 , 2 ); |
| 212 |
add_action( 'uwp_profile_header', array($instance, 'get_profile_header'), 10, 4 ); |
| 213 |
add_action( 'uwp_users_profile_header', array($instance, 'get_profile_header'), 10, 1 ); |
| 214 |
add_action( 'uwp_user_title', array($instance, 'get_profile_title'), 10, 2 ); |
| 215 |
add_action( 'uwp_profile_social', array($instance, 'get_profile_social'), 10, 2 ); |
| 216 |
add_action( 'get_avatar_url', array($instance, 'get_avatar_url'), 99, 3 ); |
| 217 |
|
| 218 |
//Fields as tabs |
| 219 |
add_action( 'uwp_available_tab_items', array($instance, 'uwp_extra_fields_available_tab_items'), 10, 1 ); |
| 220 |
add_action( 'uwp_profile_tabs', array($instance, 'uwp_extra_fields_as_tabs'), 10, 3 ); |
| 221 |
|
| 222 |
// Popup and crop functions |
| 223 |
add_filter( 'ajax_query_attachments_args', array($instance, 'uwp_restrict_attachment_display') ); |
| 224 |
|
| 225 |
add_action( 'uwp_handle_file_upload_error_checks', array($instance, 'uwp_handle_file_upload_error_checks'), 10, 4 ); |
| 226 |
add_action( 'wp_ajax_uwp_avatar_banner_upload', array($instance, 'uwp_ajax_avatar_banner_upload') ); |
| 227 |
//add_action( 'wp_ajax_uwp_ajax_image_crop_popup', array($instance, 'uwp_ajax_image_crop_popup') ); |
| 228 |
add_action( 'wp_ajax_uwp_ajax_image_crop_popup_form', array($instance, 'uwp_ajax_image_crop_popup_form') ); |
| 229 |
add_action( 'wp_head', array($instance, 'uwp_define_ajaxurl') ); |
| 230 |
add_action( 'uwp_profile_header', array($instance, 'uwp_image_crop_init'), 10, 1 ); |
| 231 |
add_action( 'uwp_admin_profile_edit', array($instance, 'uwp_image_crop_init'), 10, 1 ); |
| 232 |
|
| 233 |
// Profile Tabs |
| 234 |
add_action( 'uwp_profile_body', array($instance, 'get_profile_body'), 10, 1 ); |
| 235 |
add_action( 'uwp_profile_content', array($instance, 'get_profile_tabs_content'), 10, 1 ); |
| 236 |
add_action( 'uwp_profile_more_info_tab_content', array($instance, 'get_profile_more_info'), 10, 1); |
| 237 |
add_action( 'uwp_profile_posts_tab_content', array($instance, 'get_profile_posts'), 10, 1); |
| 238 |
add_action( 'uwp_profile_comments_tab_content', array($instance, 'get_profile_comments'), 10, 1); |
| 239 |
add_action( 'uwp_profile_tab_content', array($instance, 'uwp_extra_fields_as_tab_values'), 10, 2 ); |
| 240 |
|
| 241 |
// Profile Pagination |
| 242 |
add_action( 'uwp_profile_pagination', array($instance, 'get_profile_pagination')); |
| 243 |
|
| 244 |
// Users |
| 245 |
add_action( 'uwp_users_list_body', array($instance, 'get_users_list_body')); |
| 246 |
add_action( 'uwp_users_search', array($instance, 'uwp_users_search')); |
| 247 |
add_action( 'uwp_users_loop_actions', array($instance, 'uwp_users_views')); |
| 248 |
add_action( 'uwp_users_loop_actions', array($instance, 'uwp_users_sortby')); |
| 249 |
add_action( 'uwp_output_location', array($instance, 'show_output_location_data'), 10, 2); |
| 250 |
add_action( 'wpdiscuz_profile_url', array($instance, 'uwp_wpdiscuz_profile_url'), 10, 2); |
| 251 |
|
| 252 |
// User, allow subscribers to upload profile and banner pictures |
| 253 |
add_filter( 'plupload_default_params', array($instance, 'add_uwp_plupload_param'), 10, 1 ); |
| 254 |
add_filter( 'user_has_cap', array($instance, 'allow_all_users_profile_uploads'), 10, 4 ); |
| 255 |
} |
| 256 |
|
| 257 |
public function load_tables_actions_and_filters($instance) { |
| 258 |
add_filter( 'wpmu_drop_tables', array($instance, 'drop_tables_on_delete_blog')); |
| 259 |
} |
| 260 |
|
| 261 |
public function load_templates_actions_and_filters($instance) { |
| 262 |
|
| 263 |
add_action( 'template_redirect', array($instance, 'change_default_password_redirect') ); |
| 264 |
add_action( 'uwp_template_fields', array($instance, 'uwp_template_fields'), 10, 1 ); |
| 265 |
add_action( 'uwp_template_fields', array($instance, 'uwp_template_extra_fields'), 10, 1 ); |
| 266 |
add_action( 'uwp_account_form_display', array($instance, 'uwp_account_edit_form_display'), 10, 1 ); |
| 267 |
add_action( 'wp_logout', array($instance, 'logout_redirect')); |
| 268 |
add_action( 'init', array($instance, 'wp_login_redirect')); |
| 269 |
add_action( 'init', array($instance, 'wp_register_redirect')); |
| 270 |
add_action( 'admin_init', array($instance, 'uwp_activation_redirect')); |
| 271 |
// Redirect functions |
| 272 |
add_action( 'template_redirect', array($instance, 'profile_redirect'), 10); |
| 273 |
add_action( 'template_redirect', array($instance, 'access_checks'), 20); |
| 274 |
// Admin user edit page |
| 275 |
add_action( 'edit_user_profile', array($instance, 'get_profile_extra_admin_edit'), 10, 1 ); |
| 276 |
add_action( 'show_user_profile', array($instance, 'get_profile_extra_admin_edit'), 10, 1 ); |
| 277 |
|
| 278 |
|
| 279 |
add_filter( 'wp_setup_nav_menu_item', array($instance, 'uwp_setup_nav_menu_item'), 10, 1 ); |
| 280 |
add_filter( 'the_content', array($instance, 'uwp_author_page_content'), 10, 1 ); |
| 281 |
add_filter( 'the_content', array($instance, 'uwp_author_box_page_content'), 10, 1 ); |
| 282 |
add_filter( 'the_content', array($instance, 'setup_singular_page_content'), 10, 1 ); |
| 283 |
add_filter( 'body_class', array($instance, 'uwp_add_body_class'), 10, 1 ); |
| 284 |
|
| 285 |
// filter the login and register url |
| 286 |
add_filter( 'login_url', array($instance, 'wp_login_url'), 10, 3 ); |
| 287 |
add_filter( 'register_url', array($instance, 'wp_register_url'), 10, 1 ); |
| 288 |
add_filter( 'lostpassword_url', array($instance, 'wp_lostpassword_url'), 10, 1 ); |
| 289 |
} |
| 290 |
|
| 291 |
public function load_tools_actions_and_filters($instance) { |
| 292 |
add_action('uwp_admin_sub_menus', array($instance, 'uwp_add_admin_tools_sub_menu'), 100, 1); |
| 293 |
add_action('uwp_tools_settings_main_tab_content', array($instance, 'uwp_tools_main_tab_content')); |
| 294 |
add_action('wp_ajax_uwp_process_diagnosis', array($instance, 'uwp_process_diagnosis_ajax')); |
| 295 |
} |
| 296 |
|
| 297 |
public function load_notifications_actions_and_filters($instance){ |
| 298 |
add_action('uwp_account_form_display', array($instance, 'uwp_user_notifications_form_front'), 10, 1); |
| 299 |
add_action('init', array($instance, 'uwp_notification_submit_handler')); |
| 300 |
} |
| 301 |
|
| 302 |
public function load_form_builder_actions_and_filters($instance) { |
| 303 |
// Actions |
| 304 |
add_action('admin_init', array($instance, 'uwp_form_builder_dummy_fields')); |
| 305 |
add_action('uwp_manage_available_fields_predefined', array($instance, 'uwp_manage_available_fields_predefined')); |
| 306 |
add_action('uwp_manage_available_fields_custom', array($instance, 'uwp_manage_available_fields_custom')); |
| 307 |
add_action('uwp_manage_available_fields', array($instance, 'uwp_manage_available_fields')); |
| 308 |
add_action('uwp_manage_selected_fields', array($instance, 'uwp_manage_selected_fields')); |
| 309 |
add_action('uwp_admin_extra_custom_fields', array($instance, 'uwp_advance_admin_custom_fields'), 10, 2); |
| 310 |
add_action('wp_ajax_uwp_ajax_register_action', array($instance, 'uwp_register_ajax_handler')); |
| 311 |
add_action('uwp_form_builder_tabs_content', array($instance, 'uwp_form_builder')); |
| 312 |
|
| 313 |
// Filters |
| 314 |
add_filter('uwp_builder_extra_fields_multiselect', array($instance, 'uwp_builder_extra_fields_smr'), 10, 4); |
| 315 |
add_filter('uwp_builder_extra_fields_select', array($instance, 'uwp_builder_extra_fields_smr'), 10, 4); |
| 316 |
add_filter('uwp_builder_extra_fields_radio', array($instance, 'uwp_builder_extra_fields_smr'), 10, 4); |
| 317 |
add_filter('uwp_builder_extra_fields_datepicker', array($instance, 'uwp_builder_extra_fields_datepicker'), 10, 4); |
| 318 |
add_filter('uwp_builder_extra_fields_password', array($instance, 'uwp_builder_extra_fields_password'), 10, 4); |
| 319 |
add_filter('uwp_builder_extra_fields_email', array($instance, 'uwp_builder_extra_fields_email'), 10, 4); |
| 320 |
add_filter('uwp_builder_extra_fields_file', array($instance, 'uwp_builder_extra_fields_file'), 10, 4); |
| 321 |
add_filter('uwp_builder_data_type_text', array($instance, 'uwp_builder_data_type_text'), 10, 4); |
| 322 |
add_filter('uwp_form_builder_available_fields_head', array($instance, 'uwp_register_available_fields_head'), 10, 2); |
| 323 |
add_filter('uwp_form_builder_available_fields_note', array($instance, 'uwp_register_available_fields_note'), 10, 2); |
| 324 |
add_filter('uwp_form_builder_selected_fields_head', array($instance, 'uwp_register_selected_fields_head'), 10, 2); |
| 325 |
add_filter('uwp_form_builder_selected_fields_note', array($instance, 'uwp_register_selected_fields_note'), 10, 2); |
| 326 |
// htmlvar not needed for taxonomy |
| 327 |
add_filter('uwp_builder_htmlvar_name_taxonomy',array($instance, 'uwp_return_empty_string'),10,4); |
| 328 |
// default_value not needed for textarea, html, file, fieldset |
| 329 |
add_filter('uwp_builder_default_value_textarea',array($instance, 'uwp_return_empty_string'),10,4); |
| 330 |
add_filter('uwp_builder_default_value_html',array($instance, 'uwp_return_empty_string'),10,4); |
| 331 |
add_filter('uwp_builder_default_value_file',array($instance, 'uwp_return_empty_string'),10,4); |
| 332 |
add_filter('uwp_builder_default_value_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 333 |
// is_required not needed for fieldset |
| 334 |
add_filter('uwp_builder_is_required_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 335 |
add_filter('uwp_builder_required_msg_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 336 |
// field_icon not needed for fieldset |
| 337 |
add_filter('uwp_builder_css_class_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 338 |
// filters for which is_public not required |
| 339 |
add_filter('uwp_builder_is_public_password',array($instance, 'uwp_return_empty_string'),10,4); |
| 340 |
} |
| 341 |
|
| 342 |
public function load_menus_actions_and_filters($instance) { |
| 343 |
add_action( 'load-nav-menus.php', array($instance, 'users_wp_admin_menu_metabox') ); |
| 344 |
add_action( 'admin_bar_menu', array($instance, 'admin_bar_menu'), 51 ); |
| 345 |
} |
| 346 |
|
| 347 |
public function load_admin_actions_and_filters($instance) { |
| 348 |
add_action( 'admin_enqueue_scripts', array($instance, 'enqueue_styles') ); |
| 349 |
add_action( 'admin_enqueue_scripts', array($instance, 'enqueue_scripts') ); |
| 350 |
add_action('admin_head', array($instance, 'uwp_admin_only_css')); |
| 351 |
} |
| 352 |
|
| 353 |
public function register_widgets(){ |
| 354 |
register_widget("UWP_Register_Widget"); |
| 355 |
register_widget("UWP_Forgot_Widget"); |
| 356 |
register_widget("UWP_Login_Widget"); |
| 357 |
register_widget("UWP_Change_Widget"); |
| 358 |
register_widget("UWP_Reset_Widget"); |
| 359 |
register_widget("UWP_Users_Widget"); |
| 360 |
register_widget("UWP_Account_Widget"); |
| 361 |
register_widget("UWP_Profile_Widget"); |
| 362 |
|
| 363 |
register_widget("UWP_Profile_Header_Widget"); |
| 364 |
register_widget("UWP_Profile_Social_Widget"); |
| 365 |
register_widget("UWP_Profile_Tabs_Widget"); |
| 366 |
register_widget("UWP_Profile_Actions_Widget"); |
| 367 |
register_widget("UWP_Profile_Section_Widget"); |
| 368 |
|
| 369 |
register_widget("UWP_User_Title_Widget"); |
| 370 |
register_widget("UWP_User_Avatar_Widget"); |
| 371 |
register_widget("UWP_User_Meta_Widget"); |
| 372 |
register_widget("UWP_Users_Search_Widget"); |
| 373 |
register_widget("UWP_Users_Loop_Actions"); |
| 374 |
register_widget("UWP_Users_Loop_Widget"); |
| 375 |
register_widget("UWP_User_Actions_Widget"); |
| 376 |
register_widget("UWP_Output_Location_Widget"); |
| 377 |
register_widget("UWP_Author_Box_Widget"); |
| 378 |
} |
| 379 |
|
| 380 |
/** |
| 381 |
* The name of the plugin used to uniquely identify it within the context of |
| 382 |
* WordPress and to define internationalization functionality. |
| 383 |
* |
| 384 |
* @since 1.0.0 |
| 385 |
* @return string The name of the plugin. |
| 386 |
*/ |
| 387 |
public function get_plugin_name() { |
| 388 |
return $this->plugin_name; |
| 389 |
} |
| 390 |
|
| 391 |
/** |
| 392 |
* Retrieve the version number of the plugin. |
| 393 |
* |
| 394 |
* @since 1.0.0 |
| 395 |
* @return string The version number of the plugin. |
| 396 |
*/ |
| 397 |
public function get_version() { |
| 398 |
return $this->version; |
| 399 |
} |
| 400 |
|
| 401 |
/** |
| 402 |
* Load the required dependencies for this plugin. |
| 403 |
* |
| 404 |
* @since 1.0.0 |
| 405 |
* @access private |
| 406 |
*/ |
| 407 |
private function load_dependencies() { |
| 408 |
global $uwp_options; |
| 409 |
|
| 410 |
if ( ! function_exists( 'is_plugin_active' ) ) { |
| 411 |
/** |
| 412 |
* Load all plugin functions from WordPress. |
| 413 |
*/ |
| 414 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
| 415 |
} |
| 416 |
|
| 417 |
/** |
| 418 |
* The class responsible for defining internationalization functionality |
| 419 |
* of the plugin. |
| 420 |
*/ |
| 421 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-i18n.php'; |
| 422 |
|
| 423 |
require_once dirname(dirname( __FILE__ )) . '/admin/settings/functions.php'; |
| 424 |
|
| 425 |
$uwp_options = uwp_get_settings(); |
| 426 |
|
| 427 |
/** |
| 428 |
* The class responsible for activation functionality |
| 429 |
* of the plugin. |
| 430 |
*/ |
| 431 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-activator.php'; |
| 432 |
|
| 433 |
/** |
| 434 |
* The class responsible for deactivation functionality |
| 435 |
* of the plugin. |
| 436 |
*/ |
| 437 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-deactivator.php'; |
| 438 |
|
| 439 |
/** |
| 440 |
* The libraries required. |
| 441 |
*/ |
| 442 |
require_once dirname(dirname( __FILE__ )) . '/vendor/autoload.php'; |
| 443 |
|
| 444 |
/** |
| 445 |
* The class responsible for sending emails |
| 446 |
* of the plugin. |
| 447 |
*/ |
| 448 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-emails.php'; |
| 449 |
|
| 450 |
/** |
| 451 |
* The class responsible for reading and updating meta |
| 452 |
* of the plugin. |
| 453 |
*/ |
| 454 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-meta.php'; |
| 455 |
|
| 456 |
/** |
| 457 |
* The class responsible for userswp dates |
| 458 |
* of the plugin. |
| 459 |
*/ |
| 460 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-date.php'; |
| 461 |
|
| 462 |
/** |
| 463 |
* The class responsible for userswp pages |
| 464 |
* of the plugin. |
| 465 |
*/ |
| 466 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-pages.php'; |
| 467 |
|
| 468 |
/** |
| 469 |
* The class responsible for uploading files |
| 470 |
* of the plugin. |
| 471 |
*/ |
| 472 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-files.php'; |
| 473 |
|
| 474 |
/** |
| 475 |
* The class responsible for defining form handler functionality |
| 476 |
* of the plugin. |
| 477 |
*/ |
| 478 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-forms.php'; |
| 479 |
|
| 480 |
/** |
| 481 |
* The class responsible for form validation |
| 482 |
* of the plugin. |
| 483 |
*/ |
| 484 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-validation.php'; |
| 485 |
|
| 486 |
/** |
| 487 |
* Country helpers |
| 488 |
*/ |
| 489 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-countries.php'; |
| 490 |
|
| 491 |
/** |
| 492 |
* The class responsible for defining ajax handler functionality |
| 493 |
* of the plugin. |
| 494 |
*/ |
| 495 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-ajax.php'; |
| 496 |
|
| 497 |
/** |
| 498 |
* The class responsible for defining all shortcodes |
| 499 |
*/ |
| 500 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-templates.php'; |
| 501 |
|
| 502 |
/** |
| 503 |
* The class responsible for defining profile content |
| 504 |
*/ |
| 505 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-profile.php'; |
| 506 |
|
| 507 |
/** |
| 508 |
* The class responsible for defining all menus items. |
| 509 |
*/ |
| 510 |
require_once dirname(dirname( __FILE__ )) . '/admin/menus/class-checklist.php'; |
| 511 |
|
| 512 |
/** |
| 513 |
* The class responsible for defining all menus in the admin area. |
| 514 |
*/ |
| 515 |
require_once dirname(dirname( __FILE__ )) . '/admin/menus/class-menus.php'; |
| 516 |
|
| 517 |
/** |
| 518 |
* The class responsible for defining all actions that occur in the admin area. |
| 519 |
*/ |
| 520 |
require_once dirname(dirname( __FILE__ )) . '/admin/class-admin.php'; |
| 521 |
|
| 522 |
/** |
| 523 |
* The class responsible for defining all menus in the admin area. |
| 524 |
*/ |
| 525 |
require_once dirname(dirname( __FILE__ )) . '/admin/class-uwp-admin-menus.php'; |
| 526 |
|
| 527 |
/** |
| 528 |
* The class responsible for defining all admin area settings. |
| 529 |
*/ |
| 530 |
require_once dirname(dirname( __FILE__ )) . '/admin/settings/class-settings.php'; |
| 531 |
|
| 532 |
/** |
| 533 |
* The class responsible for default content. |
| 534 |
*/ |
| 535 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-uwp-defaults.php'; |
| 536 |
|
| 537 |
/** |
| 538 |
* The class responsible for defining all actions that occur in the public-facing |
| 539 |
* side of the site. |
| 540 |
*/ |
| 541 |
require_once dirname(dirname( __FILE__ )) . '/public/class-public.php'; |
| 542 |
|
| 543 |
/** |
| 544 |
* The class responsible for table functions |
| 545 |
*/ |
| 546 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-tables.php'; |
| 547 |
|
| 548 |
/** |
| 549 |
* The class responsible for admin settings functions |
| 550 |
*/ |
| 551 |
include_once dirname(dirname( __FILE__ )) . '/admin/settings/class-uwp-settings-page.php'; |
| 552 |
|
| 553 |
/** |
| 554 |
* The class responsible for adding fields in forms |
| 555 |
*/ |
| 556 |
require_once dirname(dirname( __FILE__ )) . '/admin/settings/class-formbuilder.php'; |
| 557 |
|
| 558 |
/** |
| 559 |
* The class responsible for adding tools functions |
| 560 |
*/ |
| 561 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-tools.php'; |
| 562 |
|
| 563 |
/** |
| 564 |
* The class responsible for displaying notices |
| 565 |
*/ |
| 566 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-notices.php'; |
| 567 |
|
| 568 |
/** |
| 569 |
* contents helpers files and functions. |
| 570 |
*/ |
| 571 |
require_once( dirname(dirname( __FILE__ )) .'/includes/helpers.php' ); |
| 572 |
|
| 573 |
/** |
| 574 |
* The class for login widget. |
| 575 |
*/ |
| 576 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/login.php' ); |
| 577 |
|
| 578 |
/** |
| 579 |
* The class for register widget. |
| 580 |
*/ |
| 581 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/register.php' ); |
| 582 |
|
| 583 |
/** |
| 584 |
* The class for forgot password widget. |
| 585 |
*/ |
| 586 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/forgot.php' ); |
| 587 |
|
| 588 |
/** |
| 589 |
* The class for reset password widget. |
| 590 |
*/ |
| 591 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/reset.php' ); |
| 592 |
|
| 593 |
/** |
| 594 |
* The class for change password widget. |
| 595 |
*/ |
| 596 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/change.php' ); |
| 597 |
|
| 598 |
/** |
| 599 |
* The class for users widget. |
| 600 |
*/ |
| 601 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/users.php' ); |
| 602 |
|
| 603 |
/** |
| 604 |
* The class for account widget. |
| 605 |
*/ |
| 606 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/account.php' ); |
| 607 |
|
| 608 |
/** |
| 609 |
* The class for profile widget. |
| 610 |
*/ |
| 611 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/profile.php' ); |
| 612 |
|
| 613 |
/** |
| 614 |
* The class for profile sections widget. |
| 615 |
*/ |
| 616 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-section.php' ); |
| 617 |
|
| 618 |
/** |
| 619 |
* The class profile header widget |
| 620 |
*/ |
| 621 |
require_once dirname(dirname( __FILE__ )) . '/widgets/profile-header.php'; |
| 622 |
|
| 623 |
/** |
| 624 |
* The class for user title widget. |
| 625 |
*/ |
| 626 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/user-title.php' ); |
| 627 |
|
| 628 |
/** |
| 629 |
* The class for user avatar widget. |
| 630 |
*/ |
| 631 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/user-avatar.php' ); |
| 632 |
|
| 633 |
/** |
| 634 |
* The class for profile social fields widget. |
| 635 |
*/ |
| 636 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-social.php' ); |
| 637 |
|
| 638 |
/** |
| 639 |
* The class for profile action buttons fields widget. |
| 640 |
*/ |
| 641 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-actions.php' ); |
| 642 |
|
| 643 |
/** |
| 644 |
* The class for profile buttons fields widget. |
| 645 |
*/ |
| 646 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/user-actions.php' ); |
| 647 |
|
| 648 |
/** |
| 649 |
* The class for profile content widget. |
| 650 |
*/ |
| 651 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/profile-tabs.php' ); |
| 652 |
|
| 653 |
/** |
| 654 |
* The class for user meta widget. |
| 655 |
*/ |
| 656 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/user-meta.php' ); |
| 657 |
|
| 658 |
/** |
| 659 |
* The class for users search widget. |
| 660 |
*/ |
| 661 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/users-search.php' ); |
| 662 |
|
| 663 |
/** |
| 664 |
* The class for user list sorting widget. |
| 665 |
*/ |
| 666 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/users-loop-actions.php' ); |
| 667 |
|
| 668 |
/** |
| 669 |
* The class for users list widget. |
| 670 |
*/ |
| 671 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/users-loop.php' ); |
| 672 |
|
| 673 |
/** |
| 674 |
* The class for output location widget. |
| 675 |
*/ |
| 676 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/output-location.php' ); |
| 677 |
|
| 678 |
/** |
| 679 |
* The class for author box widget. |
| 680 |
*/ |
| 681 |
require_once( dirname(dirname( __FILE__ )) .'/widgets/authorbox.php' ); |
| 682 |
|
| 683 |
/** |
| 684 |
* The class responsible for displaying notices |
| 685 |
*/ |
| 686 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-import-export.php'; |
| 687 |
|
| 688 |
/** |
| 689 |
* The class responsible for displaying notices |
| 690 |
*/ |
| 691 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-user-notifications.php'; |
| 692 |
|
| 693 |
/** |
| 694 |
* The class responsible for adding tools functions |
| 695 |
*/ |
| 696 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-status.php'; |
| 697 |
|
| 698 |
/** |
| 699 |
* The class responsible for extensions screen functions on admin side |
| 700 |
*/ |
| 701 |
require_once dirname(dirname( __FILE__ )) . '/includes/libraries/class-ayecode-addons.php'; |
| 702 |
|
| 703 |
/** |
| 704 |
* The class responsible for extensions screen functions on admin side |
| 705 |
*/ |
| 706 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-addons.php'; |
| 707 |
|
| 708 |
/** |
| 709 |
* The class responsible for privacy policy functions |
| 710 |
*/ |
| 711 |
require_once dirname(dirname( __FILE__ )) . '/includes/abstract-uwp-privacy.php'; |
| 712 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-uwp-privacy.php'; |
| 713 |
|
| 714 |
if ( is_plugin_active( 'uwp_geodirectory/uwp_geodirectory.php' ) ) { |
| 715 |
deactivate_plugins( 'uwp_geodirectory/uwp_geodirectory.php' ); |
| 716 |
} |
| 717 |
|
| 718 |
if ( is_plugin_active( 'geodirectory/geodirectory.php' ) || class_exists('GeoDirectory') ) { |
| 719 |
/** |
| 720 |
* The class responsible for displaying notices |
| 721 |
* |
| 722 |
* @since 1.0.12 |
| 723 |
*/ |
| 724 |
require_once dirname(dirname( __FILE__ )) . '/includes/libraries/class-geodirectory-plugin.php'; |
| 725 |
} |
| 726 |
|
| 727 |
if ( class_exists('WPInv_Invoice') ) { |
| 728 |
/** |
| 729 |
* The class responsible for displaying notices |
| 730 |
* |
| 731 |
* @since 1.0.12 |
| 732 |
*/ |
| 733 |
require_once dirname(dirname( __FILE__ )) . '/includes/libraries/class-invoicing-plugin.php'; |
| 734 |
} |
| 735 |
} |
| 736 |
|
| 737 |
} |