PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.16.18
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.16.18
4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / RegisterScripts.php
wp-user-avatar / src Last commit date
Admin 4 weeks ago AdminBarDashboardAccess 3 years ago Classes 1 week ago ContentProtection 1 month ago Functions 4 months ago Integrations 1 year ago Membership 1 week ago NavigationMenuLinks 2 years ago RegisterActivation 9 months ago ShortcodeParser 3 weeks ago Themes 2 months ago Widgets 10 months ago lib 3 years ago templates 1 month ago Base.php 2 months ago Cron.php 2 years ago DBTables.php 3 years ago DBUpdates.php 1 month ago LoginRedirect.php 9 months ago RegisterScripts.php 4 months ago eu-vat-rates.json 10 months ago
RegisterScripts.php
240 lines
1 <?php
2
3 namespace ProfilePress\Core;
4
5 use ProfilePress\Core\Membership\Services\TaxService;
6
7 class RegisterScripts
8 {
9 public function __construct()
10 {
11 add_action('wp_enqueue_scripts', [$this, 'public_css']);
12 add_action('admin_enqueue_scripts', [$this, 'admin_css']);
13 add_action('wp_enqueue_scripts', [$this, 'public_js']);
14 add_action('admin_enqueue_scripts', [$this, 'admin_js'], 999999);
15 }
16
17 public static function asset_suffix()
18 {
19 return (defined('W3GUY_LOCAL') && W3GUY_LOCAL) || (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
20 }
21
22 function admin_css()
23 {
24 wp_enqueue_style('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.css', [], PPRESS_VERSION_NUMBER);
25 wp_enqueue_style('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.css', false, PPRESS_VERSION_NUMBER);
26
27 wp_enqueue_style('wp-color-picker');
28
29 wp_enqueue_style('ppress-admin', PPRESS_ASSETS_URL . '/css/admin.min.css', [], PPRESS_VERSION_NUMBER);
30
31 // only load in profilepress settings pages.
32 if ( ! ppress_is_admin_page()) return;
33
34 wp_enqueue_style('ppress-hint-tooltip', PPRESS_ASSETS_URL . "/css/hint.min.css", false, PPRESS_VERSION_NUMBER);
35
36 wp_enqueue_style('ppress-form-builder-styles', PPRESS_ASSETS_URL . '/css/form-builder.css', [], PPRESS_VERSION_NUMBER);
37
38 wp_enqueue_style('ppress-jbox', PPRESS_ASSETS_URL . '/jbox/jBox.all.min.css', [], PPRESS_VERSION_NUMBER);
39 }
40
41 function public_css()
42 {
43 $suffix = self::asset_suffix();
44 wp_enqueue_style('ppress-frontend', PPRESS_ASSETS_URL . "/css/frontend{$suffix}.css", false, PPRESS_VERSION_NUMBER);
45 wp_enqueue_style('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.css', false, PPRESS_VERSION_NUMBER);
46 wp_enqueue_style('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.css');
47 }
48
49 private function is_tax_enabled_in_checkout()
50 {
51 if (TaxService::init()->is_tax_enabled()) {
52 if (
53 TaxService::init()->is_eu_vat_enabled() ||
54 ! empty(TaxService::init()->get_tax_rates()) ||
55 ! empty(TaxService::init()->get_fallback_tax_rate())
56 ) {
57 return true;
58 }
59 }
60
61 return false;
62 }
63
64 function public_js()
65 {
66 $suffix = self::asset_suffix();
67
68 $is_ajax_mode_disabled = ppress_get_setting('disable_ajax_mode') == 'yes' ? 'true' : 'false';
69
70 wp_enqueue_script('jquery');
71
72 if (isset($_GET['pp_preview_form']) ||
73 ppress_post_content_has_shortcode('profilepress-registration') ||
74 ppress_post_content_has_shortcode('profilepress-password-reset') ||
75 ppress_post_content_has_shortcode('profilepress-edit-profile') ||
76 ppress_post_content_has_shortcode('profilepress-my-account')
77 ) {
78 wp_enqueue_script('password-strength-meter');
79
80 // wp automatically localize pwsL10n object on the frontend for usage if password strength meter is enqueued.
81 wp_localize_script('password-strength-meter', 'myacPwsL10n', [
82 'disable_enforcement' => apply_filters('ppress_myac_password_meter_enforce_disable', 'false')
83 ]);
84 }
85
86 wp_enqueue_script('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.js', array('jquery'), PPRESS_VERSION_NUMBER);
87
88 wp_enqueue_script('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.js', array('jquery'), PPRESS_VERSION_NUMBER);
89
90 $frontend_dependencies = ['jquery', 'ppress-flatpickr', 'ppress-select2'];
91 if (ppress_is_my_account_page()) {
92 $frontend_dependencies[] = 'wp-util';
93 }
94
95 $frontend_dependencies = apply_filters('ppress_public_js_dependencies', $frontend_dependencies);
96
97 wp_enqueue_script('ppress-frontend-script', PPRESS_ASSETS_URL . "/js/frontend.min.js", $frontend_dependencies, PPRESS_VERSION_NUMBER, true);
98
99 wp_localize_script('ppress-frontend-script', 'pp_ajax_form', [
100 'ajaxurl' => admin_url('admin-ajax.php'),
101 'confirm_delete' => esc_html__('Are you sure?', 'wp-user-avatar'),
102 'deleting_text' => esc_html__('Deleting...', 'wp-user-avatar'),
103 'deleting_error' => esc_html__('An error occurred. Please try again.', 'wp-user-avatar'),
104 'nonce' => wp_create_nonce('ppress-frontend-nonce'),
105 'disable_ajax_form' => apply_filters('ppress_disable_ajax_form', (string)$is_ajax_mode_disabled),
106 'is_checkout' => ppress_is_checkout() ? '1' : '0',
107 'is_checkout_tax_enabled' => $this->is_tax_enabled_in_checkout() ? '1' : '0',
108 'is_checkout_autoscroll_enabled' => apply_filters('ppress_is_checkout_autoscroll_enabled', 'true')
109 ]);
110
111 if (isset($_GET['pp_preview_form']) || ppress_post_content_has_shortcode('profilepress-member-directory')) {
112
113 wp_enqueue_script(
114 'ppress-member-directory',
115 PPRESS_ASSETS_URL . "/js/member-directory{$suffix}.js",
116 [
117 'jquery',
118 'jquery-masonry',
119 'ppress-select2',
120 'ppress-flatpickr'
121 ],
122 PPRESS_VERSION_NUMBER,
123 true
124 );
125 }
126
127 do_action('ppress_enqueue_public_js');
128 }
129
130 function admin_js($hook)
131 {
132 global $pagenow, $ppress_customer_page;
133
134 wp_enqueue_script('jquery');
135 wp_enqueue_script('backbone');
136 wp_enqueue_script('underscore');
137 wp_enqueue_script('jquery-ui-core');
138 wp_enqueue_script('jquery-ui-sortable');
139 wp_enqueue_script('jquery-ui-draggable');
140 wp_enqueue_script('wp-util');
141
142 wp_enqueue_script('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.js', array('jquery'), PPRESS_VERSION_NUMBER);
143
144 if (in_array($pagenow, ['user-edit.php', 'profile.php']) || ppress_is_admin_page()) {
145 wp_enqueue_script('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.js', array('jquery'), PPRESS_VERSION_NUMBER);
146 }
147
148 if ( ! ppress_is_admin_page()) return;
149
150 wp_enqueue_script('postbox');
151
152 if ($ppress_customer_page == $hook) {
153 // Load the password show/hide feature and strength meter.
154 wp_enqueue_script('user-profile');
155 }
156
157 wp_enqueue_script('ppress-chartjs', PPRESS_ASSETS_URL . '/js/admin/chart.min.js', array('jquery'), PPRESS_VERSION_NUMBER);
158 wp_enqueue_script('ppress-reports', PPRESS_ASSETS_URL . '/js/admin/reports.js', ['jquery', 'ppress-chartjs'], PPRESS_VERSION_NUMBER);
159
160 wp_enqueue_media();
161
162 wp_enqueue_script('ppress-jbox', PPRESS_ASSETS_URL . '/jbox/jBox.all.min.js', array('jquery'), PPRESS_VERSION_NUMBER);
163 wp_enqueue_script('ppress-jbox-init', PPRESS_ASSETS_URL . '/jbox/init.js', array('ppress-jbox'), PPRESS_VERSION_NUMBER);
164
165 wp_enqueue_script('ppress-clipboardjs', PPRESS_ASSETS_URL . '/js/clipboard.min.js', [], PPRESS_VERSION_NUMBER);
166
167 wp_enqueue_script('ppress-admin-scripts', PPRESS_ASSETS_URL . '/js/admin.js', ['jquery', 'jquery-ui-sortable'], PPRESS_VERSION_NUMBER);
168
169 wp_localize_script('ppress-admin-scripts', 'ppress_admin_globals', [
170 'nonce' => wp_create_nonce('ppress-admin-nonce')
171 ]);
172
173 if (ppressGET_var('section') == 'checkout-fields') {
174 wp_enqueue_script('ppress-checkout-field-manager', PPRESS_ASSETS_URL . '/js/checkout-fields-manager.js', [], PPRESS_VERSION_NUMBER);
175 }
176
177 if (ppressGET_var('page') == PPRESS_MEMBERSHIP_PLANS_SETTINGS_SLUG) {
178 wp_enqueue_script(
179 'ppress-digital-files-chooser',
180 PPRESS_ASSETS_URL . '/js/admin/digital-files-chooser.js',
181 ['wp-util', 'jquery-ui-sortable'],
182 PPRESS_VERSION_NUMBER
183 );
184 }
185
186 wp_enqueue_script('ppress-create-form', PPRESS_ASSETS_URL . '/js/create-form.js', array('jquery'), PPRESS_VERSION_NUMBER);
187 wp_enqueue_script('ppress-content-control', PPRESS_ASSETS_URL . '/js/content-control.js', array('jquery'), PPRESS_VERSION_NUMBER);
188 wp_enqueue_script(
189 'ppress-form-builder',
190 PPRESS_ASSETS_URL . '/js/builder/app.min.js',
191 [
192 'jquery',
193 'backbone',
194 'wp-util',
195 'jquery-ui-draggable',
196 'jquery-ui-core',
197 'jquery-ui-sortable',
198 'wp-color-picker'
199 ],
200 PPRESS_VERSION_NUMBER
201 );
202
203 wp_localize_script('ppress-form-builder', 'pp_form_builder', [
204 'confirm_delete' => apply_filters('ppress_confirm_delete_message', esc_html__('Are you sure?', 'wp-user-avatar'))
205 ]);
206
207 wp_enqueue_script('ppress-jquery-blockui', PPRESS_ASSETS_URL . '/js/jquery.blockUI.js', array('jquery'), PPRESS_VERSION_NUMBER);
208
209 /** @see https://make.wordpress.org/core/2017/10/22/code-editing-improvements-in-wordpress-4-9/ */
210 // ensures even if user disable syntax highlight, it still works.
211 add_filter('get_user_metadata', function ($val, $object_id, $meta_key) {
212 if ($meta_key == 'syntax_highlighting') return true;
213
214 return $val;
215
216 }, 10, 3);
217
218 $settings = wp_enqueue_code_editor([
219 'type' => 'text/html',
220 'codemirror' => ['lint' => false]
221 ]);
222
223 wp_localize_script('code-editor', 'ppressCodeEditor', ['settings' => $settings]);
224 }
225
226 /**
227 * @return self
228 */
229 public static function get_instance()
230 {
231 static $instance = null;
232
233 if (is_null($instance)) {
234 $instance = new self();
235 }
236
237 return $instance;
238 }
239 }
240