PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.2.2
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.2.2
4.17.2 4.17.1 4.17.0 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 / Admin / SettingsPages / AbstractSettingsPage.php
wp-user-avatar / src / Admin / SettingsPages Last commit date
DragDropBuilder 4 years ago EmailSettings 4 years ago AbstractSettingsPage.php 4 years ago AddNewForm.php 4 years ago AdminFooter.php 5 years ago ExtensionsSettingsPage.php 4 years ago FormList.php 5 years ago Forms.php 4 years ago GeneralSettings.php 4 years ago IDUserColumn.php 5 years ago MailOptin.php 4 years ago MemberDirectories.php 4 years ago MembersDirectoryList.php 5 years ago ToolsSettingsPage.php 4 years ago index.php 5 years ago
AbstractSettingsPage.php
324 lines
1 <?php
2
3 namespace ProfilePress\Core\Admin\SettingsPages;
4
5 use ProfilePress\Core\Classes\ExtensionManager;
6 use ProfilePress\Custom_Settings_Page_Api;
7
8 if ( ! defined('ABSPATH')) {
9 exit;
10 }
11
12 abstract class AbstractSettingsPage
13 {
14 protected $option_name;
15
16 public static $parent_menu_url_map = [];
17
18 private function getMenuIcon()
19 {
20 return 'data:image/svg+xml;base64,' . base64_encode('<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" width="150" height="150" viewBox="0 0 11.71 11.71" shape-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" xmlns:v="https://vecta.io/nano"><path d="M5.85.2c3.13 0 5.66 2.53 5.66 5.65 0 3.13-2.53 5.66-5.66 5.66C2.73 11.51.2 8.98.2 5.85A5.65 5.65 0 0 1 5.85.2zM3.17 5.66l2.98-2.98c.24-.24.62-.24.86 0L8.53 4.2c.24.24.24.63 0 .87L6.12 7.48l.53.54a.64.64 0 0 1 0 .92l-.07.07a.64.64 0 0 1-.92 0l-.54-.53L3.44 6.8l-.27-.28c-.24-.23-.24-.62 0-.86zm3.21-1.22L4.93 5.89c-.12.11-.12.29 0 .4.11.11.28.11.39 0l1.46-1.45c.11-.11.11-.29 0-.4h0c-.11-.11-.29-.11-.4 0zM4.93 6.29h0z" fill="#a6aaad"/></svg>');
21 }
22
23 public function register_core_menu()
24 {
25 add_menu_page(
26 esc_html__('ProfilePress - WordPress User Registration & Profile Plugin', 'wp-user-avatar'),
27 'ProfilePress',
28 'manage_options',
29 PPRESS_SETTINGS_SLUG,
30 '',
31 $this->getMenuIcon(),
32 '80.0015'
33 );
34
35 do_action('ppress_register_menu_page_' . $this->active_menu_tab() . '_' . $this->active_submenu_tab());
36
37 do_action('ppress_register_menu_page');
38 }
39
40 /** --------------------------------------------------------------- */
41
42 // commented out to prevent any fatal error
43 //abstract function default_header_menu();
44
45 public function header_menu_tabs()
46 {
47 return [];
48 }
49
50 public function header_submenu_tabs()
51 {
52 return [];
53 }
54
55 public function settings_page_header($active_menu, $active_submenu)
56 {
57 $logo_url = PPRESS_ASSETS_URL . '/images/profilepress-logo.svg';
58 $submenus_count = count($this->header_menu_tabs());
59 ?>
60 <div class="ppress-admin-wrap">
61 <div class="ppress-admin-banner<?= ExtensionManager::is_premium() ? ' ppress-pro' : ' ppress-not-pro' ?><?= $submenus_count < 2 ? ' ppress-no-submenu' : '' ?>">
62 <div class="ppress-admin-banner__logo">
63 <img src="<?= $logo_url ?>" alt="">
64 </div>
65 <div class="ppress-admin-banner__helplinks">
66 <span><a rel="noopener" href="https://wordpress.org/support/plugin/wp-user-avatar/reviews/?filter=5#new-post" target="_blank">
67 <span class="dashicons dashicons-star-filled"></span> <?= __('Review', 'wp-user-avatar'); ?>
68 </a></span>
69 <?php if (ExtensionManager::is_premium()) : ?>
70 <span><a rel="noopener" href="https://profilepress.net/submit-ticket/" target="_blank">
71 <span class="dashicons dashicons-admin-users"></span> <?= __('Support', 'wp-user-avatar'); ?>
72 </a></span>
73 <?php else : ?>
74 <span><a class="ppress-active" rel="noopener" href="https://profilepress.net/pricing/?utm_source=wp_dashboard&utm_medium=upgrade&utm_campaign=ppress_header_topright_menu" target="_blank">
75 <span class="dashicons dashicons-info"></span> <?= __('Pro Upgrade', 'wp-user-avatar'); ?>
76 </a></span>
77 <?php endif; ?>
78 <span><a rel="noopener" href="https://profilepress.net/docs/" target="_blank">
79 <span class="dashicons dashicons-book"></span> <?= __('Docs', 'wp-user-avatar'); ?>
80 </a></span>
81 </div>
82 <div class="clear"></div>
83 <?php $this->settings_page_header_menus($active_menu); ?>
84 </div>
85 <?php
86
87 $submenus = $this->header_submenu_tabs();
88
89 if ( ! empty($submenus) && count($submenus) > 1) {
90 $this->settings_page_header_sub_menus($active_menu, $active_submenu);
91 }
92
93 ?>
94 </div>
95 <?php
96 }
97
98 public function settings_page_header_menus($active_menu)
99 {
100 $menus = $this->header_menu_tabs();
101
102 if (count($menus) < 2) return;
103 ?>
104 <div class="ppress-header-menus">
105 <nav class="ppress-nav-tab-wrapper nav-tab-wrapper">
106 <?php foreach ($menus as $menu) : ?>
107 <?php
108 $id = sanitize_text_field(ppress_var($menu,'id', ''));
109 $url = esc_url_raw(! empty($menu['url']) ? $menu['url'] : add_query_arg('view', $id));
110 self::$parent_menu_url_map[$id] = $url;
111 ?>
112 <a href="<?php echo esc_url(remove_query_arg(wp_removable_query_args(), $url)); ?>" class="ppress-nav-tab nav-tab<?= $id == $active_menu ? ' ppress-nav-active' : '' ?>">
113 <?php echo sanitize_text_field($menu['label']) ?>
114 </a>
115 <?php endforeach; ?>
116 </nav>
117 </div>
118 <?php
119 }
120
121 public function settings_page_header_sub_menus($active_menu, $active_submenu)
122 {
123 $submenus = $this->header_submenu_tabs();
124
125 if (count($submenus) < 2) return;
126
127 $active_menu_url = self::$parent_menu_url_map[$active_menu];
128
129 $submenus = wp_list_filter($submenus, ['parent' => $active_menu]);
130
131 echo '<ul class="subsubsub">';
132
133 foreach ($submenus as $submenu) {
134
135 printf(
136 '<li><a href="%s"%s>%s</a></li>',
137 esc_url(add_query_arg('section', $submenu['id'], $active_menu_url)),
138 $active_submenu == $submenu['id'] ? ' class="ppress-current"' : '',
139 $submenu['label']
140 );
141 }
142 echo '</ul>';
143 }
144
145 public function active_menu_tab()
146 {
147 static $cache = null;
148
149 if (is_null($cache)) {
150 $cache = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : $this->default_header_menu();
151 }
152
153 return $cache;
154 }
155
156 public function active_submenu_tab()
157 {
158 static $cache = null;
159
160 if (is_null($cache)) {
161
162 $active_menu = $this->active_menu_tab();
163
164 $submenu_tabs = wp_list_filter($this->header_submenu_tabs(), ['parent' => $active_menu]);
165 $first_submenu_tab = '';
166 if ( ! empty($submenu_tabs)) {
167 $first_submenu_tab = array_values($submenu_tabs)[0]['id'];
168 }
169
170 $cache = isset($_GET['section']) && ppressGET_var('view', 'general', true) == $active_menu ? sanitize_text_field($_GET['section']) : $first_submenu_tab;
171 }
172
173 return $cache;
174 }
175
176 public function admin_page_callback()
177 {
178 $active_menu = $this->active_menu_tab();
179
180 $active_submenu = $this->active_submenu_tab();
181
182 $this->settings_page_header($active_menu, $active_submenu);
183
184 do_action('ppress_admin_settings_page_' . $active_menu);
185
186 do_action('ppress_admin_settings_submenu_page_' . $active_menu . '_' . $active_submenu);
187 }
188 /** --------------------------------------------------------------- */
189
190 /**
191 * Register core settings.
192 *
193 * @param Custom_Settings_Page_Api $instance
194 * @param bool $remove_sidebar
195 */
196 public static function register_core_settings(Custom_Settings_Page_Api $instance, $remove_sidebar = false)
197 {
198 if ( ! $remove_sidebar) {
199 $instance->sidebar(self::sidebar_args());
200 }
201 }
202
203 public static function sidebar_args()
204 {
205 $sidebar_args = [
206 [
207 'section_title' => esc_html__('Need Support?', 'wp-user-avatar'),
208 'content' => self::sidebar_support_docs(),
209 ],
210 [
211 'section_title' => esc_html__('Check out MailOptin', 'wp-user-avatar'),
212 'content' => self::mailoptin_ad_block(),
213 ]
214 ];
215
216 if (defined('MAILOPTIN_DETACH_LIBSODIUM')) {
217 unset($sidebar_args[1]);
218 }
219
220 return $sidebar_args;
221 }
222
223 public static function sidebar_support_docs()
224 {
225 $link_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" class="linkIcon"><path d="M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"></path></svg>';
226
227 $content = '<p>';
228
229 $support_url = 'https://wordpress.org/support/plugin/wp-user-avatar/';
230
231 if (ExtensionManager::is_premium()) {
232 $support_url = 'https://profilepress.net/submit-ticket/';
233 }
234
235 $content .= sprintf(
236 esc_html__('Whether you need help or have a new feature request, let us know. %sRequest Support%s', 'wp-user-avatar'),
237 '<a class="ppress-link" href="' . $support_url . '" target="_blank">', $link_icon . '</a>'
238 );
239
240 $content .= '</p>';
241
242 $content .= '<p>';
243 $content .= sprintf(
244 esc_html__('Detailed documentation is also available on the plugin website. %sView Knowledge Base%s', 'wp-user-avatar'),
245 '<a class="ppress-link" href="https://profilepress.net/docs/" target="_blank">', $link_icon . '</a>'
246 );
247
248 $content .= '</p>';
249
250 $content .= '<p>';
251 $content .= sprintf(
252 esc_html__('If you are enjoying ProfilePress and find it useful, please consider leaving a �
253
254
255
256
257 review on WordPress.org. %sLeave a Review%s', 'wp-user-avatar'),
258 '<a class="ppress-link" href="https://wordpress.org/support/plugin/wp-user-avatar/reviews/?filter=5#new-post" target="_blank">', $link_icon . '</a>'
259 );
260 $content .= '</p>';
261
262 return $content;
263 }
264
265 public static function mailoptin_ad_block()
266 {
267 $content = '<p>';
268 $content .= sprintf(
269 esc_html__('Use the coupon code %s10PERCENTOFF%s to save %s off MailOptin.', 'wp-user-avatar'),
270 '<code>', '</code>', '10%'
271 );
272
273 $content .= '</p>';
274
275 $content .= '<a href="https://mailoptin.io/?utm_source=wp_dashboard&utm_medium=profilepress-admin-sidebar&utm_campaign=mailoptin" target="_blank"><img style="width: 100%" src="' . PPRESS_ASSETS_URL . '/images/admin/mo-pro-upgrade.jpg"></a>';
276
277 return $content;
278 }
279
280 protected function page_dropdown($id, $appends = [], $args = ['skip_append_default_select' => false])
281 {
282 $default_args = [
283 'name' => PPRESS_SETTINGS_DB_OPTION_NAME . "[$id]",
284 'show_option_none' => esc_html__('Select...', 'wp-user-avatar'),
285 'selected' => ppress_get_setting($id, ''),
286 'echo' => false
287 ];
288
289 if ( ! empty($appends)) {
290 unset($default_args['show_option_none']);
291 }
292
293 $html = wp_dropdown_pages(
294 array_replace($default_args, $args)
295 );
296
297 if ( ! empty($appends)) {
298 $addition = '';
299
300 if (ppress_var($args, 'skip_append_default_select') === false) {
301 $addition .= '<option value="">' . esc_html__('Select...', 'wp-user-avatar') . '</option>';
302 }
303
304 foreach ($appends as $append) {
305 $key = $append['key'];
306 $label = $append['label'];
307 $disabled_attr = ppress_var($append, 'disabled') === true ? ' disabled' : '';
308 $addition .= "<option value=\"$key\"" . selected(ppress_get_setting($id), $key, false) . $disabled_attr . '>' . $label . '</option>';
309 }
310
311 $html = ppress_append_option_to_select($addition, $html);
312 }
313
314 return $html;
315 }
316
317 protected function custom_text_input($id, $placeholder = '')
318 {
319 $placeholder = ! empty($placeholder) ? $placeholder : esc_html__('Custom URL Here', 'wp-user-avatar');
320 $value = ppress_get_setting($id, '');
321
322 return "<input placeholder=\"$placeholder\" name=\"" . PPRESS_SETTINGS_DB_OPTION_NAME . "[$id]\" type=\"text\" class=\"regular-text code\" value=\"$value\">";
323 }
324 }