| 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 |
class UsersWP { |
| 12 |
|
| 13 |
/** |
| 14 |
* The loader that's responsible for maintaining and registering all hooks that power |
| 15 |
* the plugin. |
| 16 |
* |
| 17 |
* @since 1.0.0 |
| 18 |
* @access protected |
| 19 |
* @var UsersWP_Loader $loader Maintains and registers all hooks for the plugin. |
| 20 |
*/ |
| 21 |
protected $loader; |
| 22 |
|
| 23 |
|
| 24 |
/** |
| 25 |
* The current version of the plugin. |
| 26 |
* |
| 27 |
* @since 1.0.0 |
| 28 |
* @access protected |
| 29 |
* @var string $version The current version of the plugin. |
| 30 |
*/ |
| 31 |
protected $version; |
| 32 |
|
| 33 |
protected $profile; |
| 34 |
protected $forms; |
| 35 |
protected $i18n; |
| 36 |
protected $notices; |
| 37 |
protected $templates; |
| 38 |
protected $meta; |
| 39 |
protected $pages; |
| 40 |
protected $files; |
| 41 |
protected $shortcodes; |
| 42 |
protected $assets; |
| 43 |
protected $admin; |
| 44 |
protected $admin_settings; |
| 45 |
protected $menus; |
| 46 |
protected $form_builder; |
| 47 |
protected $ajax; |
| 48 |
protected $tools; |
| 49 |
protected $tables; |
| 50 |
|
| 51 |
/** |
| 52 |
* Define the core functionality of the plugin. |
| 53 |
* |
| 54 |
* Set the plugin name and the plugin version that can be used throughout the plugin. |
| 55 |
* Load the dependencies, define the locale, and set the hooks for the admin area and |
| 56 |
* the public-facing side of the site. |
| 57 |
* |
| 58 |
* @since 1.0.0 |
| 59 |
*/ |
| 60 |
public function __construct() { |
| 61 |
|
| 62 |
$this->plugin_name = USERSWP_NAME; |
| 63 |
$this->version = USERSWP_VERSION; |
| 64 |
|
| 65 |
|
| 66 |
$this->load_dependencies(); |
| 67 |
$this->loader = new UsersWP_Loader(); |
| 68 |
$this->meta = new UsersWP_Meta(); |
| 69 |
$this->pages = new UsersWP_Pages(); |
| 70 |
$this->profile = new UsersWP_Profile(); |
| 71 |
$this->forms = new UsersWP_Forms(); |
| 72 |
$this->templates = new UsersWP_Templates(); |
| 73 |
$this->i18n = new UsersWP_i18n(); |
| 74 |
$this->notices = new UsersWP_Notices(); |
| 75 |
$this->assets = new UsersWP_Public(); |
| 76 |
$this->form_builder = new UsersWP_Form_Builder(); |
| 77 |
$this->menus = new UsersWP_Menus(); |
| 78 |
$this->tools = new UsersWP_Tools(); |
| 79 |
$this->tables = new UsersWP_Tables(); |
| 80 |
|
| 81 |
$this->shortcodes = new UsersWP_Shortcodes($this->templates); |
| 82 |
$this->admin_settings = new UsersWP_Admin_Settings($this->form_builder); |
| 83 |
$this->admin = new UsersWP_Admin($this->admin_settings); |
| 84 |
$this->ajax = new UsersWP_Ajax($this->form_builder); |
| 85 |
$this->files = new UsersWP_Files(); |
| 86 |
|
| 87 |
|
| 88 |
// actions and filters |
| 89 |
$this->load_assets_actions_and_filters($this->assets); |
| 90 |
$this->load_meta_actions_and_filters($this->meta); |
| 91 |
$this->load_ajax_actions_and_filters($this->ajax); |
| 92 |
$this->load_files_actions_and_filters($this->files); |
| 93 |
$this->load_forms_actions_and_filters($this->forms); |
| 94 |
$this->load_i18n_actions_and_filters($this->i18n); |
| 95 |
$this->load_notices_actions_and_filters($this->notices); |
| 96 |
$this->load_pages_actions_and_filters($this->pages); |
| 97 |
$this->load_profile_actions_and_filters($this->profile); |
| 98 |
$this->load_shortcodes_actions_and_filters($this->shortcodes); |
| 99 |
$this->load_tables_actions_and_filters($this->tables); |
| 100 |
$this->load_templates_actions_and_filters($this->templates); |
| 101 |
$this->load_tools_actions_and_filters($this->tools); |
| 102 |
|
| 103 |
//admin |
| 104 |
$this->load_form_builder_actions_and_filters($this->form_builder); |
| 105 |
$this->load_menus_actions_and_filters($this->menus); |
| 106 |
$this->load_admin_actions_and_filters($this->admin); |
| 107 |
$this->load_admin_settings_actions_and_filters($this->admin_settings); |
| 108 |
|
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
public function load_assets_actions_and_filters($instance) { |
| 113 |
add_action( 'wp_enqueue_scripts', array($instance, 'enqueue_styles') ); |
| 114 |
add_action( 'wp_enqueue_scripts', array($instance, 'enqueue_scripts') ); |
| 115 |
} |
| 116 |
|
| 117 |
public function load_meta_actions_and_filters($instance) { |
| 118 |
add_action('user_register', array($instance, 'sync_usermeta'), 10, 1); |
| 119 |
add_action('delete_user', array($instance, 'delete_usermeta_for_user')); |
| 120 |
add_action('wp_login', array($instance, 'save_user_ip_on_login') ,10,2); |
| 121 |
add_filter('uwp_before_extra_fields_save', array($instance, 'save_user_ip_on_register'), 10, 3); |
| 122 |
add_filter('uwp_update_usermeta', array($instance, 'modify_privacy_value_on_update'), 10, 4); |
| 123 |
add_filter('uwp_get_usermeta', array($instance, 'modify_privacy_value_on_get'), 10, 5); |
| 124 |
add_filter('uwp_update_usermeta', array($instance, 'modify_datepicker_value_on_update'), 10, 3); |
| 125 |
add_filter('uwp_get_usermeta', array($instance, 'modify_datepicker_value_on_get'), 10, 5); |
| 126 |
} |
| 127 |
|
| 128 |
public function load_ajax_actions_and_filters($instance) { |
| 129 |
add_action('wp_ajax_uwp_ajax_action', array($instance, 'handler')); |
| 130 |
} |
| 131 |
|
| 132 |
public function load_files_actions_and_filters($instance) { |
| 133 |
if($instance->uwp_doing_upload()){ |
| 134 |
add_filter( 'wp_handle_upload_prefilter', array($instance, 'uwp_wp_media_restrict_file_types') ); |
| 135 |
} |
| 136 |
add_filter('uwp_get_max_upload_size', array($instance, 'uwp_modify_get_max_upload_size'), 10, 2); |
| 137 |
} |
| 138 |
|
| 139 |
public function load_forms_actions_and_filters($instance) { |
| 140 |
add_action('init', array($instance, 'init_notices'), 1); |
| 141 |
add_action('init', array($instance, 'handler')); |
| 142 |
add_action('init', array($instance, 'uwp_privacy_submit_handler')); |
| 143 |
add_action('uwp_template_display_notices', array($instance, 'display_notices'), 10, 1); |
| 144 |
add_action('wp_ajax_uwp_upload_file_remove', array($instance, 'uwp_upload_file_remove')); |
| 145 |
//User search form |
| 146 |
add_action('uwp_users_page_search_form_inner', array($instance, 'uwp_users_search_form_text_field'), 10, 1); |
| 147 |
add_action('uwp_users_page_search_form_inner', array($instance, 'uwp_users_search_form_submit'), 50, 1); |
| 148 |
add_action('personal_options_update', array($instance, 'update_profile_extra_admin_edit'), 10, 1); |
| 149 |
add_action('edit_user_profile_update', array($instance, 'update_profile_extra_admin_edit'), 10, 1); |
| 150 |
add_action('user_edit_form_tag', array($instance, 'add_multipart_to_admin_edit_form')); |
| 151 |
add_action('uwp_template_form_title_after', array($instance, 'uwp_display_username_in_account'), 10, 1); |
| 152 |
|
| 153 |
|
| 154 |
// Forms |
| 155 |
add_filter('uwp_form_input_html_datepicker', array($instance, 'uwp_form_input_datepicker'), 10, 4); |
| 156 |
add_filter('uwp_form_input_html_time', array($instance, 'uwp_form_input_time'), 10, 4); |
| 157 |
add_filter('uwp_form_input_html_select', array($instance, 'uwp_form_input_select'), 10, 4); |
| 158 |
add_filter('uwp_form_input_html_multiselect', array($instance, 'uwp_form_input_multiselect'), 10, 4); |
| 159 |
add_filter('uwp_form_input_html_text', array($instance, 'uwp_form_input_text'), 10, 4); |
| 160 |
add_filter('uwp_form_input_html_textarea', array($instance, 'uwp_form_input_textarea'), 10, 4); |
| 161 |
add_filter('uwp_form_input_html_fieldset', array($instance, 'uwp_form_input_fieldset'), 10, 4); |
| 162 |
add_filter('uwp_form_input_html_file', array($instance, 'uwp_form_input_file'), 10, 4); |
| 163 |
add_filter('uwp_form_input_html_checkbox', array($instance, 'uwp_form_input_checkbox'), 10, 4); |
| 164 |
add_filter('uwp_form_input_html_radio', array($instance, 'uwp_form_input_radio'), 10, 4); |
| 165 |
add_filter('uwp_form_input_html_url', array($instance, 'uwp_form_input_url'), 10, 4); |
| 166 |
add_filter('uwp_form_input_html_email', array($instance, 'uwp_form_input_email'), 10, 4); |
| 167 |
add_filter('uwp_form_input_html_password', array($instance, 'uwp_form_input_password'), 10, 4); |
| 168 |
// Country select |
| 169 |
add_filter('uwp_form_input_html_select_country', array($instance, 'uwp_form_input_select_country'), 10, 4); |
| 170 |
add_filter('uwp_forms_check_for_send_mail_errors', array($instance, 'uwp_forms_check_for_send_mail_errors'), 10, 3); |
| 171 |
add_filter('uwp_form_input_email_uwp_account_email_after', array($instance, 'uwp_register_confirm_email_field'), 10, 4); |
| 172 |
add_filter('uwp_form_input_password_uwp_account_password_after', array($instance, 'uwp_register_confirm_password_field'), 10, 4); |
| 173 |
|
| 174 |
// Emails |
| 175 |
add_filter('uwp_send_mail_subject', array($instance, 'init_mail_subject'), 10, 2); |
| 176 |
add_filter('uwp_send_mail_message', array($instance, 'init_mail_content'), 10, 2); |
| 177 |
add_filter('uwp_send_mail_extras', array($instance, 'init_mail_extras'), 10, 3); |
| 178 |
|
| 179 |
add_filter('uwp_send_admin_mail_subject', array($instance, 'init_admin_mail_subject'), 10, 2); |
| 180 |
add_filter('uwp_send_admin_mail_message', array($instance, 'init_admin_mail_content'), 10, 2); |
| 181 |
add_filter('uwp_send_admin_mail_extras', array($instance, 'init_admin_mail_extras'), 10, 3); |
| 182 |
|
| 183 |
} |
| 184 |
|
| 185 |
public function load_i18n_actions_and_filters($instance) { |
| 186 |
add_action( 'init', array($instance, 'load_plugin_textdomain')); |
| 187 |
} |
| 188 |
|
| 189 |
public function load_notices_actions_and_filters($instance) { |
| 190 |
add_action('uwp_template_display_notices', array($instance, 'display_registration_disabled_notice')); |
| 191 |
add_action('uwp_template_display_notices', array($instance, 'form_notice_by_key')); |
| 192 |
add_action( 'admin_notices', array( $instance, 'show_admin_notices' ) ); |
| 193 |
add_action( 'admin_notices', array($instance, 'uwp_admin_notices') ); |
| 194 |
} |
| 195 |
|
| 196 |
public function load_pages_actions_and_filters($instance) { |
| 197 |
add_action( 'wpmu_new_blog', array($instance, 'wpmu_generate_default_pages_on_new_site'), 10, 6 ); |
| 198 |
} |
| 199 |
|
| 200 |
public function load_profile_actions_and_filters($instance) { |
| 201 |
add_action( 'template_redirect', array($instance, 'uwp_redirect_author_page') , 10 , 2 ); |
| 202 |
//profile page |
| 203 |
add_filter('query_vars', array($instance, 'profile_query_vars'), 10, 1 ); |
| 204 |
add_action('init', array($instance, 'rewrite_profile_link') , 10, 1 ); |
| 205 |
add_filter( 'uwp_profile_link', array($instance, 'get_profile_link'), 10, 2 ); |
| 206 |
add_filter( 'edit_profile_url', array($instance, 'uwp_modify_admin_bar_edit_profile_url'), 10, 3); |
| 207 |
add_filter( 'the_title', array($instance, 'modify_profile_page_title'), 10, 2 ); |
| 208 |
remove_all_filters('get_avatar'); |
| 209 |
add_filter( 'get_avatar', array($instance, 'uwp_modify_get_avatar') , 1 , 5 ); |
| 210 |
add_filter( 'get_comment_author_link', array($instance, 'uwp_get_comment_author_link') , 10 , 2 ); |
| 211 |
add_action( 'uwp_profile_header', array($instance, 'get_profile_header'), 10, 1 ); |
| 212 |
add_action( 'uwp_users_profile_header', array($instance, 'get_profile_header'), 10, 1 ); |
| 213 |
add_action( 'uwp_profile_title', array($instance, 'get_profile_title'), 10, 1 ); |
| 214 |
//add_action( 'uwp_profile_bio', array($instance, 'get_profile_bio'), 10, 1 ); |
| 215 |
add_action( 'uwp_profile_social', array($instance, 'get_profile_social'), 10, 1 ); |
| 216 |
|
| 217 |
//Fields as tabs |
| 218 |
add_action( 'uwp_profile_tabs', array($instance, 'uwp_extra_fields_as_tabs'), 10, 2 ); |
| 219 |
|
| 220 |
// Popup and crop functions |
| 221 |
add_filter( 'ajax_query_attachments_args', array($instance, 'uwp_restrict_attachment_display') ); |
| 222 |
|
| 223 |
add_action( 'uwp_handle_file_upload_error_checks', array($instance, 'uwp_handle_file_upload_error_checks'), 10, 4 ); |
| 224 |
add_action( 'wp_ajax_uwp_avatar_banner_upload', array($instance, 'uwp_ajax_avatar_banner_upload') ); |
| 225 |
//add_action( 'wp_ajax_uwp_ajax_image_crop_popup', array($instance, 'uwp_ajax_image_crop_popup') ); |
| 226 |
add_action( 'wp_ajax_uwp_ajax_image_crop_popup_form', array($instance, 'uwp_ajax_image_crop_popup_form') ); |
| 227 |
add_action( 'wp_head', array($instance, 'uwp_define_ajaxurl') ); |
| 228 |
add_action( 'uwp_profile_header', array($instance, 'uwp_image_crop_init'), 10, 1 ); |
| 229 |
add_action( 'uwp_admin_profile_edit', array($instance, 'uwp_image_crop_init'), 10, 1 ); |
| 230 |
|
| 231 |
// Profile Tabs |
| 232 |
add_action( 'uwp_profile_content', array($instance, 'get_profile_tabs_content'), 10, 1 ); |
| 233 |
add_action( 'uwp_profile_more_info_tab_content', array($instance, 'get_profile_more_info'), 10, 1); |
| 234 |
add_action( 'uwp_profile_posts_tab_content', array($instance, 'get_profile_posts'), 10, 1); |
| 235 |
add_action( 'uwp_profile_comments_tab_content', array($instance, 'get_profile_comments'), 10, 1); |
| 236 |
add_action( 'uwp_profile_tab_content', array($instance, 'uwp_extra_fields_as_tab_values'), 10, 2 ); |
| 237 |
|
| 238 |
// Profile Pagination |
| 239 |
add_action( 'uwp_profile_pagination', array($instance, 'get_profile_pagination')); |
| 240 |
|
| 241 |
// Users |
| 242 |
add_action( 'uwp_users_search', array($instance, 'uwp_users_search')); |
| 243 |
add_action( 'uwp_users_list', array($instance, 'uwp_users_list')); |
| 244 |
add_action( 'uwp_users_extra', array($instance, 'get_users_extra')); |
| 245 |
add_action( 'uwp_profile_bio', array($instance, 'get_profile_side_extra')); |
| 246 |
|
| 247 |
|
| 248 |
// User, allow subscribers to upload profile and banner pictures |
| 249 |
add_filter( 'plupload_default_params', array($instance, 'add_uwp_plupload_param'), 10, 1 ); |
| 250 |
add_filter( 'user_has_cap', array($instance, 'allow_all_users_profile_uploads'), 10, 4 ); |
| 251 |
} |
| 252 |
|
| 253 |
public function load_shortcodes_actions_and_filters($instance) { |
| 254 |
add_shortcode( 'uwp_register', array($instance, 'register')); |
| 255 |
add_shortcode( 'uwp_login', array($instance, 'login')); |
| 256 |
add_shortcode( 'uwp_forgot', array($instance, 'forgot')); |
| 257 |
add_shortcode( 'uwp_change', array($instance, 'change')); |
| 258 |
add_shortcode( 'uwp_reset', array($instance, 'reset')); |
| 259 |
add_shortcode( 'uwp_account', array($instance, 'account')); |
| 260 |
add_shortcode( 'uwp_profile', array($instance, 'profile')); |
| 261 |
add_shortcode( 'uwp_users', array($instance, 'users')); |
| 262 |
} |
| 263 |
|
| 264 |
public function load_tables_actions_and_filters($instance) { |
| 265 |
add_filter( 'wpmu_drop_tables', array($instance, 'drop_tables_on_delete_blog')); |
| 266 |
} |
| 267 |
|
| 268 |
public function load_templates_actions_and_filters($instance) { |
| 269 |
add_action( 'template_redirect', array($instance, 'change_default_password_redirect') ); |
| 270 |
add_action( 'uwp_template_fields', array($instance, 'uwp_template_fields'), 10, 1 ); |
| 271 |
add_action( 'uwp_account_form_display', array($instance, 'uwp_account_edit_form_display'), 10, 1 ); |
| 272 |
add_action( 'wp_logout', array($instance, 'logout_redirect')); |
| 273 |
add_action( 'init', array($instance, 'wp_login_redirect')); |
| 274 |
add_action( 'admin_init', array($instance, 'uwp_activation_redirect')); |
| 275 |
// Redirect functions |
| 276 |
add_action( 'template_redirect', array($instance, 'profile_redirect'), 10); |
| 277 |
add_action( 'template_redirect', array($instance, 'access_checks'), 20); |
| 278 |
// Admin user edit page |
| 279 |
add_action( 'edit_user_profile', array($instance, 'get_profile_extra_admin_edit'), 10, 1 ); |
| 280 |
add_action( 'show_user_profile', array($instance, 'get_profile_extra_admin_edit'), 10, 1 ); |
| 281 |
|
| 282 |
|
| 283 |
add_filter( 'wp_setup_nav_menu_item', array($instance, 'uwp_setup_nav_menu_item'), 10, 1 ); |
| 284 |
add_filter( 'the_content', array($instance, 'uwp_author_page_content'), 10, 1 ); |
| 285 |
add_filter('body_class', array($instance, 'uwp_add_body_class'), 10, 1 ); |
| 286 |
} |
| 287 |
|
| 288 |
public function load_tools_actions_and_filters($instance) { |
| 289 |
add_action('admin_init', array($instance, 'uwp_tools_process_dummy_users')); |
| 290 |
add_action('uwp_admin_sub_menus', array($instance, 'uwp_add_admin_tools_sub_menu'), 100, 1); |
| 291 |
add_action('uwp_tools_settings_main_tab_content', array($instance, 'uwp_tools_main_tab_content')); |
| 292 |
add_action('wp_ajax_uwp_process_diagnosis', array($instance, 'uwp_process_diagnosis_ajax')); |
| 293 |
} |
| 294 |
|
| 295 |
public function load_form_builder_actions_and_filters($instance) { |
| 296 |
// Actions |
| 297 |
add_action('admin_init', array($instance, 'uwp_form_builder_dummy_fields')); |
| 298 |
add_action('uwp_manage_available_fields_predefined', array($instance, 'uwp_manage_available_fields_predefined')); |
| 299 |
add_action('uwp_manage_available_fields_custom', array($instance, 'uwp_manage_available_fields_custom')); |
| 300 |
add_action('uwp_manage_available_fields', array($instance, 'uwp_manage_available_fields')); |
| 301 |
add_action('uwp_manage_selected_fields', array($instance, 'uwp_manage_selected_fields')); |
| 302 |
add_action('uwp_admin_extra_custom_fields', array($instance, 'uwp_advance_admin_custom_fields'), 10, 2); |
| 303 |
add_action('uwp_manage_available_fields', array($instance, 'uwp_manage_register_available_fields'), 10, 1); |
| 304 |
add_action('uwp_manage_selected_fields', array($instance, 'uwp_manage_register_selected_fields'), 10, 1); |
| 305 |
add_action('wp_ajax_uwp_ajax_register_action', array($instance, 'uwp_register_ajax_handler')); |
| 306 |
|
| 307 |
|
| 308 |
// Filters |
| 309 |
add_filter('uwp_builder_extra_fields_multiselect', array($instance, 'uwp_builder_extra_fields_smr'), 10, 4); |
| 310 |
add_filter('uwp_builder_extra_fields_select', array($instance, 'uwp_builder_extra_fields_smr'), 10, 4); |
| 311 |
add_filter('uwp_builder_extra_fields_radio', array($instance, 'uwp_builder_extra_fields_smr'), 10, 4); |
| 312 |
add_filter('uwp_builder_extra_fields_datepicker', array($instance, 'uwp_builder_extra_fields_datepicker'), 10, 4); |
| 313 |
add_filter('uwp_builder_extra_fields_password', array($instance, 'uwp_builder_extra_fields_password'), 10, 4); |
| 314 |
add_filter('uwp_builder_extra_fields_email', array($instance, 'uwp_builder_extra_fields_email'), 10, 4); |
| 315 |
add_filter('uwp_builder_extra_fields_file', array($instance, 'uwp_builder_extra_fields_file'), 10, 4); |
| 316 |
add_filter('uwp_builder_data_type_text', array($instance, 'uwp_builder_data_type_text'), 10, 4); |
| 317 |
add_filter('uwp_form_builder_available_fields_head', array($instance, 'uwp_register_available_fields_head'), 10, 2); |
| 318 |
add_filter('uwp_form_builder_available_fields_note', array($instance, 'uwp_register_available_fields_note'), 10, 2); |
| 319 |
add_filter('uwp_form_builder_selected_fields_head', array($instance, 'uwp_register_selected_fields_head'), 10, 2); |
| 320 |
add_filter('uwp_form_builder_selected_fields_note', array($instance, 'uwp_register_selected_fields_note'), 10, 2); |
| 321 |
add_filter('uwp_register_fields', array($instance, 'uwp_register_extra_fields'), 10, 2); |
| 322 |
// htmlvar not needed for taxonomy |
| 323 |
add_filter('uwp_builder_htmlvar_name_taxonomy',array($instance, 'uwp_return_empty_string'),10,4); |
| 324 |
// default_value not needed for textarea, html, file, fieldset |
| 325 |
add_filter('uwp_builder_default_value_textarea',array($instance, 'uwp_return_empty_string'),10,4); |
| 326 |
add_filter('uwp_builder_default_value_html',array($instance, 'uwp_return_empty_string'),10,4); |
| 327 |
add_filter('uwp_builder_default_value_file',array($instance, 'uwp_return_empty_string'),10,4); |
| 328 |
add_filter('uwp_builder_default_value_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 329 |
// is_required not needed for fieldset |
| 330 |
add_filter('uwp_builder_is_required_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 331 |
add_filter('uwp_builder_required_msg_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 332 |
// field_icon not needed for fieldset |
| 333 |
add_filter('uwp_builder_field_icon_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 334 |
add_filter('uwp_builder_css_class_fieldset',array($instance, 'uwp_return_empty_string'),10,4); |
| 335 |
} |
| 336 |
|
| 337 |
public function load_menus_actions_and_filters($instance) { |
| 338 |
add_action( 'load-nav-menus.php', array($instance, 'users_wp_admin_menu_metabox') ); |
| 339 |
} |
| 340 |
|
| 341 |
public function load_admin_actions_and_filters($instance) { |
| 342 |
add_action( 'admin_enqueue_scripts', array($instance, 'enqueue_styles') ); |
| 343 |
add_action( 'admin_enqueue_scripts', array($instance, 'enqueue_scripts') ); |
| 344 |
add_action( 'admin_menu', array($instance, 'setup_admin_menus') ); |
| 345 |
add_action('admin_head', array($instance, 'uwp_admin_only_css')); |
| 346 |
} |
| 347 |
|
| 348 |
public function load_admin_settings_actions_and_filters($instance) { |
| 349 |
$instance->init_settings(); |
| 350 |
|
| 351 |
add_action( 'admin_init', array($instance, 'uwp_register_settings') ); |
| 352 |
//register settings |
| 353 |
add_action( 'userswp_settings_main_tab_content', array($instance, 'get_general_content') ); |
| 354 |
add_action( 'userswp_settings_register_tab_content', array($instance, 'generic_display_form') ); |
| 355 |
add_action( 'userswp_settings_login_tab_content', array($instance, 'generic_display_form') ); |
| 356 |
add_action( 'userswp_settings_account_tab_content', array($instance, 'generic_display_form') ); |
| 357 |
add_action( 'userswp_settings_profile_tab_content', array($instance, 'generic_display_form') ); |
| 358 |
add_action( 'userswp_settings_users_tab_content', array($instance, 'generic_display_form') ); |
| 359 |
add_action( 'userswp_settings_change_tab_content', array($instance, 'generic_display_form') ); |
| 360 |
add_action( 'userswp_settings_uninstall_tab_content', array($instance, 'generic_display_form') ); |
| 361 |
|
| 362 |
add_action( 'uwp_form_builder_settings_main_tab_content_before', array($instance, 'get_form_builder_tabs') ); |
| 363 |
add_action( 'uwp_form_builder_settings_main_tab_content', array($instance, 'get_form_builder_content') ); |
| 364 |
add_filter( 'uwp_display_form_title', array($instance, 'display_form_title'), 10, 3 ); |
| 365 |
add_action( 'uwp_notifications_settings_main_tab_content', array($instance, 'get_notifications_content') ); |
| 366 |
add_action( 'uwp_notifications_settings_admin_tab_content', array($instance, 'generic_display_form') ); |
| 367 |
} |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
/** |
| 372 |
* Run the loader to execute all of the hooks with WordPress. |
| 373 |
* |
| 374 |
* @since 1.0.0 |
| 375 |
*/ |
| 376 |
public function run() { |
| 377 |
$this->loader->run(); |
| 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 |
* The reference to the class that orchestrates the hooks with the plugin. |
| 393 |
* |
| 394 |
* @since 1.0.0 |
| 395 |
* @return UsersWP_Loader Orchestrates the hooks of the plugin. |
| 396 |
*/ |
| 397 |
public function get_loader() { |
| 398 |
return $this->loader; |
| 399 |
} |
| 400 |
|
| 401 |
/** |
| 402 |
* Retrieve the version number of the plugin. |
| 403 |
* |
| 404 |
* @since 1.0.0 |
| 405 |
* @return string The version number of the plugin. |
| 406 |
*/ |
| 407 |
public function get_version() { |
| 408 |
return $this->version; |
| 409 |
} |
| 410 |
|
| 411 |
/** |
| 412 |
* Load the required dependencies for this plugin. |
| 413 |
* |
| 414 |
* @since 1.0.0 |
| 415 |
* @access private |
| 416 |
*/ |
| 417 |
private function load_dependencies() { |
| 418 |
/** |
| 419 |
* The class responsible for orchestrating the actions and filters of the |
| 420 |
* core plugin. |
| 421 |
*/ |
| 422 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-loader.php'; |
| 423 |
|
| 424 |
/** |
| 425 |
* The class responsible for defining internationalization functionality |
| 426 |
* of the plugin. |
| 427 |
*/ |
| 428 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-i18n.php'; |
| 429 |
|
| 430 |
/** |
| 431 |
* The class responsible for sending emails |
| 432 |
* of the plugin. |
| 433 |
*/ |
| 434 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-emails.php'; |
| 435 |
|
| 436 |
/** |
| 437 |
* The class responsible for reading and updating meta |
| 438 |
* of the plugin. |
| 439 |
*/ |
| 440 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-meta.php'; |
| 441 |
|
| 442 |
/** |
| 443 |
* The class responsible for userswp dates |
| 444 |
* of the plugin. |
| 445 |
*/ |
| 446 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-date.php'; |
| 447 |
|
| 448 |
/** |
| 449 |
* The class responsible for userswp pages |
| 450 |
* of the plugin. |
| 451 |
*/ |
| 452 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-pages.php'; |
| 453 |
|
| 454 |
/** |
| 455 |
* The class responsible for uploading files |
| 456 |
* of the plugin. |
| 457 |
*/ |
| 458 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-files.php'; |
| 459 |
|
| 460 |
/** |
| 461 |
* The class responsible for defining form handler functionality |
| 462 |
* of the plugin. |
| 463 |
*/ |
| 464 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-forms.php'; |
| 465 |
|
| 466 |
/** |
| 467 |
* The class responsible for form validation |
| 468 |
* of the plugin. |
| 469 |
*/ |
| 470 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-validation.php'; |
| 471 |
|
| 472 |
/** |
| 473 |
* Country helpers |
| 474 |
*/ |
| 475 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-countries.php'; |
| 476 |
|
| 477 |
/** |
| 478 |
* The class responsible for defining ajax handler functionality |
| 479 |
* of the plugin. |
| 480 |
*/ |
| 481 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-ajax.php'; |
| 482 |
|
| 483 |
/** |
| 484 |
* The class responsible for defining all shortcodes |
| 485 |
*/ |
| 486 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-templates.php'; |
| 487 |
|
| 488 |
/** |
| 489 |
* The class responsible for defining profile content |
| 490 |
*/ |
| 491 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-profile.php'; |
| 492 |
|
| 493 |
/** |
| 494 |
* The class responsible for defining all shortcodes |
| 495 |
*/ |
| 496 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-shortcodes.php'; |
| 497 |
|
| 498 |
/** |
| 499 |
* The class responsible for defining all menus items. |
| 500 |
*/ |
| 501 |
require_once dirname(dirname( __FILE__ )) . '/admin/menus/class-checklist.php'; |
| 502 |
|
| 503 |
/** |
| 504 |
* The class responsible for defining all menus in the admin area. |
| 505 |
*/ |
| 506 |
require_once dirname(dirname( __FILE__ )) . '/admin/menus/class-menus.php'; |
| 507 |
|
| 508 |
/** |
| 509 |
* The class responsible for defining all actions that occur in the admin area. |
| 510 |
*/ |
| 511 |
require_once dirname(dirname( __FILE__ )) . '/admin/class-admin.php'; |
| 512 |
|
| 513 |
/** |
| 514 |
* The class responsible for defining all admin area settings. |
| 515 |
*/ |
| 516 |
require_once dirname(dirname( __FILE__ )) . '/admin/settings/class-settings.php'; |
| 517 |
|
| 518 |
/** |
| 519 |
* The class responsible for defining all actions that occur in the public-facing |
| 520 |
* side of the site. |
| 521 |
*/ |
| 522 |
require_once dirname(dirname( __FILE__ )) . '/public/class-public.php'; |
| 523 |
|
| 524 |
/** |
| 525 |
* The class responsible for table functions |
| 526 |
*/ |
| 527 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-tables.php'; |
| 528 |
|
| 529 |
/** |
| 530 |
* The class responsible for adding fields in forms |
| 531 |
*/ |
| 532 |
require_once dirname(dirname( __FILE__ )) . '/admin/settings/class-formbuilder.php'; |
| 533 |
|
| 534 |
/** |
| 535 |
* The class responsible for setting field callbacks |
| 536 |
*/ |
| 537 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-callback.php'; |
| 538 |
|
| 539 |
/** |
| 540 |
* The class responsible for adding tools functions |
| 541 |
*/ |
| 542 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-tools.php'; |
| 543 |
|
| 544 |
/** |
| 545 |
* The class responsible for displaying notices |
| 546 |
*/ |
| 547 |
require_once dirname(dirname( __FILE__ )) . '/includes/class-notices.php'; |
| 548 |
|
| 549 |
|
| 550 |
} |
| 551 |
|
| 552 |
} |