PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.0.23
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.0.23
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 / admin / class-admin.php

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

217 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The admin-specific functionality of the plugin.
4 *
5 * @link http://wpgeodirectory.com
6 * @since 1.0.0
7 *
8 * @package userswp
9 * @subpackage userswp/admin
10 */
11
12 /**
13 * The admin-specific functionality of the plugin.
14 *
15 * Defines the plugin name, version, and two examples hooks for how to
16 * enqueue the admin-specific stylesheet and JavaScript.
17 *
18 * @package userswp
19 * @subpackage userswp/admin
20 * @author GeoDirectory Team <info@wpgeodirectory.com>
21 */
22 class UsersWP_Admin {
23
24 protected $admin_settings;
25 /**
26 * Register all of the hooks related to the admin area functionality
27 * of the plugin.
28 *
29 * @since 1.0.0
30 */
31 public function __construct($admin_settings) {
32
33 $this->admin_settings = $admin_settings;
34 }
35
36
37 /**
38 * Register the stylesheets for the admin area.
39 *
40 * @since 1.0.0
41 * @param $hook_suffix
42 */
43 public function enqueue_styles($hook_suffix) {
44
45 if ($hook_suffix == 'profile.php' || $hook_suffix == 'user-edit.php') {
46 wp_register_style('jquery-ui', plugin_dir_url(dirname(__FILE__)) . 'public/assets/css/jquery-ui.css');
47 wp_enqueue_style( 'jquery-ui' );
48 wp_enqueue_style( 'jcrop' );
49 wp_enqueue_style( "userswp", plugin_dir_url(dirname(__FILE__)) . 'public/assets/css/users-wp.css', array(), null, 'all' );
50 wp_enqueue_style( "uwp_timepicker_css", plugin_dir_url( dirname(__FILE__) ) . 'public/assets/css/jquery.ui.timepicker.css', array(), null, 'all' );
51 }
52 if ($hook_suffix == 'userswp_page_uwp_tools') {
53 wp_enqueue_style( "userswp", plugin_dir_url(dirname(__FILE__)) . 'public/assets/css/users-wp.css', array(), null, 'all' );
54 }
55 wp_enqueue_style( "userswp_admin_css", plugin_dir_url( __FILE__ ) . 'assets/css/users-wp-admin.css', array(), USERSWP_VERSION, 'all' );
56 wp_enqueue_style( "uwp_chosen_css", plugin_dir_url(dirname(__FILE__)) . 'public/assets/css/chosen.css', array(), USERSWP_VERSION, 'all' );
57
58 }
59
60 /**
61 * Register the JavaScript for the admin area.
62 *
63 * @since 1.0.0
64 * @param $hook_suffix
65 */
66 public function enqueue_scripts($hook_suffix) {
67
68 if ($hook_suffix == 'profile.php' || $hook_suffix == 'user-edit.php') {
69
70 wp_enqueue_script( 'jquery-ui-datepicker', array( 'jquery' ) );
71 wp_enqueue_script( "uwp_timepicker", plugin_dir_url( dirname(__FILE__) ) . 'public/assets/js/jquery.ui.timepicker.min.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-core' ), null, false );
72 wp_enqueue_script( "userswp", plugin_dir_url(dirname(__FILE__)) . 'public/assets/js/users-wp.min.js', array( 'jquery' ), null, false );
73 $uwp_localize_data = uwp_get_localize_data();
74 wp_localize_script('userswp', 'uwp_localize_data', $uwp_localize_data);
75 wp_enqueue_script( 'jquery-ui-progressbar', array( 'jquery' ) );
76 wp_enqueue_script( 'jcrop', array( 'jquery' ) );
77 wp_enqueue_script( "country-select", plugin_dir_url(dirname(__FILE__)) . 'public/assets/js/countrySelect.min.js', array( 'jquery' ), null, false );
78
79
80 }
81 if ($hook_suffix == 'userswp_page_uwp_tools') {
82 wp_enqueue_script( 'jquery-ui-progressbar', array( 'jquery' ) );
83 }
84 wp_enqueue_script('jquery-ui-sortable');
85 wp_enqueue_script( "userswp_admin", plugin_dir_url( __FILE__ ) . 'assets/js/users-wp-admin.min.js', array( 'jquery' ), null, false );
86 wp_enqueue_script( "uwp_chosen", plugin_dir_url(dirname(__FILE__)) . 'public/assets/js/chosen.jquery.js', array( 'jquery' ), USERSWP_VERSION, false );
87 wp_enqueue_script( "uwp_chosen_order", plugin_dir_url( __FILE__ ) . 'assets/js/chosen.order.jquery.min.js', array( 'jquery' ), USERSWP_VERSION, false );
88
89 if ($hook_suffix == 'userswp_page_uwp_status') {
90 wp_enqueue_script( "uwp_status", USERSWP_PLUGIN_URL . '/admin/assets/js/system-status.js', array( 'jquery' ), USERSWP_VERSION, true );
91 }
92
93 $ajax_cons_data = array(
94 'url' => admin_url('admin-ajax.php'),
95 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'userswp'),
96 'custom_field_options_not_blank_var' => __('Option Values must not be blank', 'userswp'),
97 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'userswp'),
98 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'userswp'),
99 'custom_field_delete' => __('Are you sure you wish to delete this field?', 'userswp'),
100 'custom_field_id_required' => __('This field is required.', 'userswp'),
101 );
102 wp_localize_script("userswp_admin", 'uwp_admin_ajax', $ajax_cons_data);
103
104 $country_data = uwp_get_country_data();
105 wp_localize_script(USERSWP_NAME, 'uwp_country_data', $country_data);
106
107 }
108
109 public function setup_admin_menus() {
110
111 $install_type = uwp_get_installation_type();
112
113 // Proceed if main site or pages on all sites or specific blog id
114 $proceed = false;
115 $show_builder = false;
116 switch ($install_type) {
117 case "single":
118 $proceed = true;
119 $show_builder = true;
120 break;
121 case "multi_na_all":
122 $proceed = true;
123 $show_builder = true;
124 break;
125 case "multi_na_site_id":
126 if (defined('UWP_ROOT_PAGES')) {
127 $blog_id = UWP_ROOT_PAGES;
128 } else {
129 $blog_id = null;
130 }
131 $current_blog_id = get_current_blog_id();
132 if (!is_int($blog_id)) {
133 $proceed = false;
134 } else {
135 if ($blog_id == $current_blog_id) {
136 $proceed = true;
137 $show_builder = true;
138 } else {
139 $proceed = false;
140 }
141 }
142 break;
143 case "multi_na_default":
144 $is_main_site = is_main_site();
145 if ($is_main_site) {
146 $proceed = true;
147 $show_builder = true;
148 }
149 break;
150 case "multi_not_na":
151 $proceed = true;
152 $show_builder = true;
153 break;
154 default:
155 $proceed = false;
156
157 }
158
159 if (!$proceed) {
160 return;
161 }
162
163
164 add_menu_page(
165 __( 'UsersWP Settings', 'userswp' ),
166 __( 'UsersWP', 'userswp' ),
167 'manage_options',
168 'userswp',
169 array( $this->admin_settings, 'uwp_settings_page' ),
170 'dashicons-groups',
171 70
172 );
173
174 if ($show_builder) {
175 add_submenu_page(
176 "userswp",
177 __( 'Form Builder', 'userswp' ),
178 __( 'Form Builder', 'userswp' ),
179 'manage_options',
180 'uwp_form_builder',
181 array($this->admin_settings, 'uwp_settings_page')
182 );
183
184 add_submenu_page(
185 "userswp",
186 __( 'Notifications', 'userswp' ),
187 __( 'Notifications', 'userswp' ),
188 'manage_options',
189 'uwp_notifications',
190 array($this->admin_settings, 'uwp_settings_page')
191 );
192
193 $settings_page = array($this->admin_settings, 'uwp_settings_page');
194 do_action('uwp_admin_sub_menus', $settings_page, $this->admin_settings);
195 }
196 }
197
198 /**
199 * Adds UsersWP css to admin area
200 *
201 * @since 1.0.0
202 * @package userswp
203 *
204 * @return void
205 */
206 function uwp_admin_only_css() {
207 ?>
208 <style type="text/css">
209 .uwp_page .uwp-bs-modal input[type="submit"].button,
210 .uwp_page .uwp-bs-modal button.button {
211 padding: 0 10px 1px;
212 }
213 </style>
214 <?php
215 }
216
217 }