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

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

199 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The public-facing functionality of the plugin.
5 *
6 * @link http://wpgeodirectory.com
7 * @since 1.0.0
8 *
9 * @package userswp
10 * @subpackage userswp/public
11 */
12
13 /**
14 * The public-facing functionality of the plugin.
15 *
16 * Defines the plugin name, version, and two examples hooks for how to
17 * enqueue the admin-specific stylesheet and JavaScript.
18 *
19 * @package userswp
20 * @subpackage userswp/public
21 * @author GeoDirectory Team <info@wpgeodirectory.com>
22 */
23 class UsersWP_Public {
24
25
26 /**
27 * Register the stylesheets for the public-facing side of the site.
28 *
29 * @since 1.0.0
30 */
31 public function enqueue_styles() {
32
33 /**
34 * An instance of this class should be passed to the run() function
35 * defined in UsersWP_Loader as all of the hooks are defined
36 * in that particular class.
37 *
38 * The UsersWP_Loader will then create the relationship
39 * between the defined hooks and the functions defined in this
40 * class.
41 */
42 if (is_uwp_page()) {
43 // include only in uwp pages
44 wp_register_style('jquery-ui', plugin_dir_url(dirname(__FILE__)) . 'public/assets/css/jquery-ui.css');
45 wp_enqueue_style( 'jquery-ui' );
46 }
47
48 if (is_uwp_current_user_profile_page()) {
49 // include only profile pages
50 wp_enqueue_style( 'jcrop' );
51
52 if (is_user_logged_in()) {
53 wp_enqueue_media();
54 }
55 }
56
57 $enable_timepicker_in_register = false;
58 $enable_timepicker_in_account = false;
59
60 $enable_chosen_in_register = false;
61 $enable_chosen_in_account = false;
62
63 if (is_uwp_register_page() || is_uwp_account_page()) {
64 if (is_uwp_register_page()) {
65 $fields = get_register_form_fields();
66 } else {
67 // account page
68 $fields = get_account_form_fields();
69 }
70 if (!empty($fields)) {
71 foreach ($fields as $field) {
72 if ($field->field_type == 'time') {
73 $enable_timepicker_in_register = true;
74 }
75
76 if ($field->field_type == 'multiselect') {
77 $enable_chosen_in_register = true;
78 }
79 }
80 }
81 }
82
83
84 if ($enable_timepicker_in_register || $enable_timepicker_in_account) {
85 // time fields available only in register and account pages
86 wp_enqueue_style( "uwp_timepicker_css", plugin_dir_url( __FILE__ ) . 'assets/css/jquery.ui.timepicker.css', array(), null, 'all' );
87 }
88
89
90 if ($enable_chosen_in_register || $enable_chosen_in_account) {
91 // chosen fields (multiselect) available only in register and account pages
92 wp_enqueue_style( "uwp_chosen_css", plugin_dir_url( __FILE__ ) . 'assets/css/chosen.css', array(), null, 'all' );
93 }
94
95
96 if (is_uwp_page()) {
97 // include only in uwp pages
98 uwp_load_font_awesome();
99 }
100
101 wp_enqueue_style( USERSWP_NAME, plugin_dir_url( __FILE__ ) . 'assets/css/users-wp.css', array(), null, 'all' );
102 //widget styles for all pages
103 wp_enqueue_style( "uwp_widget_css", plugin_dir_url( __FILE__ ) . 'assets/css/widgets.css', array(), null, 'all' );
104
105 }
106
107 /**
108 * Register the JavaScript for the public-facing side of the site.
109 *
110 * @since 1.0.0
111 */
112 public function enqueue_scripts() {
113
114 /**
115 * An instance of this class should be passed to the run() function
116 * defined in UsersWP_Loader as all of the hooks are defined
117 * in that particular class.
118 *
119 * The UsersWP_Loader will then create the relationship
120 * between the defined hooks and the functions defined in this
121 * class.
122 */
123 if (is_uwp_page()) {
124 // include only in uwp pages
125 wp_enqueue_script( 'jquery-ui-core', array( 'jquery' ) );
126 }
127
128 if (is_uwp_current_user_profile_page()) {
129 // include only profile pages
130 wp_enqueue_script( 'jcrop', array( 'jquery' ) );
131 }
132
133 $enable_timepicker_in_register = false;
134 $enable_timepicker_in_account = false;
135
136 $enable_datepicker_in_register = false;
137 $enable_datepicker_in_account = false;
138
139 $enable_chosen_in_register = false;
140 $enable_chosen_in_account = false;
141
142 if (is_uwp_register_page() || is_uwp_account_page()) {
143 if (is_uwp_register_page()) {
144 $fields = get_register_form_fields();
145 } else {
146 // account page
147 $fields = get_account_form_fields();
148 }
149
150 if (!empty($fields)) {
151 foreach ($fields as $field) {
152 if ($field->field_type == 'time') {
153 $enable_timepicker_in_register = true;
154 }
155
156 if ($field->field_type == 'datepicker') {
157 $enable_datepicker_in_register = true;
158 }
159
160 if ($field->field_type == 'multiselect') {
161 $enable_chosen_in_register = true;
162 }
163 }
164 }
165 }
166
167 if ($enable_timepicker_in_register || $enable_timepicker_in_account) {
168 // time fields available only in register and account pages
169 wp_enqueue_script( "uwp_timepicker", plugin_dir_url( __FILE__ ) . 'assets/js/jquery.ui.timepicker.min.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-core' ), null, false );
170 }
171
172
173 if ($enable_datepicker_in_register || $enable_datepicker_in_account) {
174 // date fields available only in register and account pages
175 wp_enqueue_script( 'jquery-ui-datepicker', array( 'jquery' ) );
176 }
177
178 if (is_uwp_profile_page() ) {
179 wp_enqueue_script( 'jquery-ui-progressbar', array( 'jquery' ) );
180 }
181
182 if ($enable_chosen_in_register || $enable_chosen_in_account) {
183 // chosen fields (multiselect) available only in register and account pages
184 wp_dequeue_script('chosen');
185 wp_enqueue_script( "uwp_chosen", plugin_dir_url( __FILE__ ) . 'assets/js/chosen.jquery.js', array( 'jquery' ), null, false );
186 }
187
188 // include only in uwp pages
189 wp_enqueue_script( USERSWP_NAME, plugin_dir_url( __FILE__ ) . 'assets/js/users-wp.min.js', array( 'jquery' ), null, false );
190
191 //load CountrySelect
192 wp_enqueue_script( "country-select", plugin_dir_url(dirname(__FILE__)) . 'public/assets/js/countrySelect.min.js', array( 'jquery' ), null, false );
193
194 $country_data = uwp_get_country_data();
195 wp_localize_script(USERSWP_NAME, 'uwp_country_data', $country_data);
196
197 }
198
199 }