PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.0.3
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.0.3
4.16.19 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 3 years ago AdminBarDashboardAccess 3 years ago Classes 3 years ago ContentProtection 3 years ago Functions 3 years ago Membership 3 years ago NavigationMenuLinks 3 years ago RegisterActivation 3 years ago ShortcodeParser 3 years ago Themes 3 years ago Widgets 3 years ago lib 3 years ago templates 3 years ago Base.php 3 years ago Cron.php 3 years ago DBTables.php 3 years ago DBUpdates.php 3 years ago RegisterScripts.php 3 years ago eu-vat-rates.json 4 years ago
RegisterScripts.php
189 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');
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');
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');
37
38 wp_enqueue_style('ppress-codemirror', PPRESS_ASSETS_URL . '/codemirror/codemirror.css');
39
40 wp_enqueue_style('ppress-jbox', PPRESS_ASSETS_URL . '/jbox/jBox.all.min.css');
41 }
42
43 function public_css()
44 {
45 $suffix = self::asset_suffix();
46 wp_enqueue_style('ppress-frontend', PPRESS_ASSETS_URL . "/css/frontend{$suffix}.css", false, PPRESS_VERSION_NUMBER);
47 wp_enqueue_style('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.css', false, PPRESS_VERSION_NUMBER);
48 wp_enqueue_style('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.css');
49 }
50
51 private function is_tax_enabled_in_checkout()
52 {
53 if (TaxService::init()->is_tax_enabled()) {
54 if (
55 TaxService::init()->is_eu_vat_enabled() ||
56 ! empty(TaxService::init()->get_tax_rates()) ||
57 ! empty(TaxService::init()->get_fallback_tax_rate())
58 ) {
59 return true;
60 }
61 }
62
63 return false;
64 }
65
66 function public_js()
67 {
68 $suffix = self::asset_suffix();
69
70 $is_ajax_mode_disabled = ppress_get_setting('disable_ajax_mode') == 'yes' ? 'true' : 'false';
71
72 wp_enqueue_script('jquery');
73
74 if (isset($_GET['pp_preview_form']) ||
75 ppress_post_content_has_shortcode('profilepress-registration') ||
76 ppress_post_content_has_shortcode('profilepress-password-reset') ||
77 ppress_post_content_has_shortcode('profilepress-edit-profile') ||
78 ppress_post_content_has_shortcode('profilepress-my-account')
79 ) {
80 wp_enqueue_script('password-strength-meter');
81 }
82
83 wp_enqueue_script('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.js', array('jquery'));
84
85 wp_enqueue_script('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.js', array('jquery'));
86
87 $frontend_dependencies = ['jquery', 'ppress-flatpickr', 'ppress-select2'];
88 if (ppress_is_my_account_page()) {
89 $frontend_dependencies[] = 'wp-util';
90 }
91 wp_enqueue_script('ppress-frontend-script', PPRESS_ASSETS_URL . "/js/frontend.min.js", $frontend_dependencies, PPRESS_VERSION_NUMBER, true);
92 wp_localize_script('ppress-frontend-script', 'pp_ajax_form', [
93 'ajaxurl' => admin_url('admin-ajax.php'),
94 'confirm_delete' => esc_html__('Are you sure?', 'wp-user-avatar'),
95 'deleting_text' => esc_html__('Deleting...', 'wp-user-avatar'),
96 'deleting_error' => esc_html__('An error occurred. Please try again.', 'wp-user-avatar'),
97 'nonce' => wp_create_nonce('ppress-frontend-nonce'),
98 'disable_ajax_form' => apply_filters('ppress_disable_ajax_form', (string)$is_ajax_mode_disabled),
99 'is_checkout' => ppress_is_checkout() ? '1' : '0',
100 'is_checkout_tax_enabled' => $this->is_tax_enabled_in_checkout() ? '1' : '0'
101 ]);
102
103 if (isset($_GET['pp_preview_form']) || ppress_post_content_has_shortcode('profilepress-member-directory')) {
104 wp_enqueue_script('ppress-member-directory', PPRESS_ASSETS_URL . "/js/member-directory{$suffix}.js", ['jquery', 'jquery-masonry', 'ppress-select2', 'ppress-flatpickr'], PPRESS_VERSION_NUMBER, true);
105 }
106
107 do_action('ppress_enqueue_public_js');
108 }
109
110 function admin_js($hook)
111 {
112 global $pagenow, $ppress_customer_page;
113
114 wp_enqueue_script('jquery');
115 wp_enqueue_script('backbone');
116 wp_enqueue_script('underscore');
117 wp_enqueue_script('jquery-ui-core');
118 wp_enqueue_script('jquery-ui-sortable');
119 wp_enqueue_script('jquery-ui-draggable');
120 wp_enqueue_script('wp-util');
121
122 wp_enqueue_script('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.js', array('jquery'));
123
124 if (in_array($pagenow, ['user-edit.php', 'profile.php']) || ppress_is_admin_page()) {
125 wp_enqueue_script('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.js', array('jquery'));
126 }
127
128 if ( ! ppress_is_admin_page()) return;
129
130 if ($ppress_customer_page == $hook) {
131 // Load the password show/hide feature and strength meter.
132 wp_enqueue_script('user-profile');
133 }
134
135 wp_enqueue_script('ppress-chartjs', PPRESS_ASSETS_URL . '/js/admin/chart.min.js', array('jquery'));
136 wp_enqueue_script('ppress-reports', PPRESS_ASSETS_URL . '/js/admin/reports.js', array('jquery', 'ppress-chartjs'));
137
138 wp_enqueue_media();
139
140 wp_enqueue_script('ppress-jbox', PPRESS_ASSETS_URL . '/jbox/jBox.all.min.js', array('jquery'));
141 wp_enqueue_script('ppress-jbox-init', PPRESS_ASSETS_URL . '/jbox/init.js', array('ppress-jbox'));
142
143 wp_enqueue_script('ppress-clipboardjs', PPRESS_ASSETS_URL . '/js/clipboard.min.js');
144
145 wp_enqueue_script('ppress-admin-scripts', PPRESS_ASSETS_URL . '/js/admin.js', array('jquery', 'jquery-ui-sortable'));
146
147 wp_localize_script('ppress-admin-scripts', 'ppress_admin_globals', [
148 'nonce' => wp_create_nonce('ppress-admin-nonce')
149 ]);
150
151 if (ppressGET_var('section') == 'checkout-fields') {
152 wp_enqueue_script('ppress-checkout-field-manager', PPRESS_ASSETS_URL . '/js/checkout-fields-manager.js');
153 }
154
155 wp_enqueue_script('ppress-create-form', PPRESS_ASSETS_URL . '/js/create-form.js', array('jquery'));
156 wp_enqueue_script('ppress-content-control', PPRESS_ASSETS_URL . '/js/content-control.js', array('jquery'));
157 wp_enqueue_script(
158 'ppress-form-builder',
159 PPRESS_ASSETS_URL . '/js/builder/app.min.js',
160 ['jquery', 'backbone', 'wp-util', 'jquery-ui-draggable', 'jquery-ui-core', 'jquery-ui-sortable', 'wp-color-picker']
161 );
162
163 wp_localize_script('ppress-form-builder', 'pp_form_builder', [
164 'confirm_delete' => esc_html__('Are you sure?', 'wp-user-avatar')
165 ]);
166
167 wp_enqueue_script('ppress-jquery-blockui', PPRESS_ASSETS_URL . '/js/jquery.blockUI.js', array('jquery'));
168
169 wp_enqueue_script('ppress-codemirror', PPRESS_ASSETS_URL . '/codemirror/codemirror.js');
170 wp_enqueue_script('ppress-codemirror-css', PPRESS_ASSETS_URL . '/codemirror/css.js', ['ppress-codemirror']);
171 wp_enqueue_script('ppress-codemirror-javascript', PPRESS_ASSETS_URL . '/codemirror/javascript.js', ['ppress-codemirror']);
172 wp_enqueue_script('ppress-codemirror-xml', PPRESS_ASSETS_URL . '/codemirror/xml.js', ['ppress-codemirror']);
173 wp_enqueue_script('ppress-codemirror-htmlmixed', PPRESS_ASSETS_URL . '/codemirror/htmlmixed.js', ['ppress-codemirror']);
174 }
175
176 /**
177 * @return self
178 */
179 public static function get_instance()
180 {
181 static $instance = null;
182
183 if (is_null($instance)) {
184 $instance = new self();
185 }
186
187 return $instance;
188 }
189 }