PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
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 1 month ago EmailSettings 1 year ago Membership 1 month ago AbstractSettingsPage.php 2 years ago AddNewForm.php 1 year ago AdminFooter.php 4 years ago ExtensionsSettingsPage.php 1 year ago FormList.php 4 months ago Forms.php 1 year ago FuseWP.php 3 years ago GeneralSettings.php 9 months ago IDUserColumn.php 5 years ago LicenseUpgrader.php 3 years ago MailOptin.php 3 years ago MemberDirectories.php 1 year ago MembersDirectoryList.php 4 years ago ToolsSettingsPage.php 4 years ago index.php 3 years ago
AbstractSettingsPage.php
325 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_DASHBOARD_SETTINGS_SLUG,
30 '',
31 $this->getMenuIcon(),
32 '45.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 add_filter('list_pages', function ($title, $page) {
40 return sprintf('%s (ID: %s)', $title, $page->ID);
41 }, 10, 2);
42 }
43
44 /** --------------------------------------------------------------- */
45
46 // commented out to prevent any fatal error
47 //abstract function default_header_menu();
48
49 public function header_menu_tabs()
50 {
51 return [];
52 }
53
54 public function header_submenu_tabs()
55 {
56 return [];
57 }
58
59 public function settings_page_header($active_menu, $active_submenu)
60 {
61 $logo_url = PPRESS_ASSETS_URL . '/images/profilepress-logo.svg';
62 $submenus_count = count($this->header_menu_tabs());
63 ?>
64 <div class="ppress-admin-wrap">
65 <div class="ppress-admin-banner<?= ExtensionManager::is_premium() ? ' ppress-pro' : ' ppress-not-pro' ?><?= $submenus_count < 2 ? ' ppress-no-submenu' : '' ?>">
66 <div class="ppress-admin-banner__logo">
67 <img src="<?= $logo_url ?>" alt="">
68 </div>
69 <div class="ppress-admin-banner__helplinks">
70 <span><a rel="noopener" href="<?= PPRESS_EXTENSIONS_SETTINGS_PAGE ?>">
71 <span class="dashicons dashicons-star-filled"></span> <?= __('Addons', 'wp-user-avatar'); ?>
72 </a></span>
73 <?php if (ExtensionManager::is_premium()) : ?>
74 <span><a rel="noopener" href="https://profilepress.com/submit-ticket/" target="_blank">
75 <span class="dashicons dashicons-admin-users"></span> <?= __('Support', 'wp-user-avatar'); ?>
76 </a></span>
77 <?php else : ?>
78 <span><a class="ppress-active" rel="noopener" href="<?php echo ppress_upgrade_urls_affilify('https://profilepress.com/pricing/?utm_source=wp_dashboard&utm_medium=upgrade&utm_campaign=ppress_header_topright_menu'); ?>" target="_blank">
79 <span class="dashicons dashicons-info"></span> <?= __('Pro Upgrade', 'wp-user-avatar'); ?>
80 </a></span>
81 <?php endif; ?>
82 <span><a rel="noopener" href="https://profilepress.com/docs/" target="_blank">
83 <span class="dashicons dashicons-book"></span> <?= __('Docs', 'wp-user-avatar'); ?>
84 </a></span>
85 </div>
86 <div class="clear"></div>
87 <?php $this->settings_page_header_menus($active_menu); ?>
88 </div>
89 <?php
90
91 $submenus = $this->header_submenu_tabs();
92
93 if ( ! empty($submenus) && count($submenus) > 1) {
94 $this->settings_page_header_sub_menus($active_menu, $active_submenu);
95 }
96
97 ?>
98 </div>
99 <?php
100 do_action('ppress_settings_page_header', $active_menu, $active_submenu);
101 }
102
103 public function settings_page_header_menus($active_menu)
104 {
105 $menus = $this->header_menu_tabs();
106
107 if (count($menus) < 2) return;
108 ?>
109 <div class="ppress-header-menus">
110 <nav class="ppress-nav-tab-wrapper nav-tab-wrapper">
111 <?php foreach ($menus as $menu) : ?>
112 <?php
113 $id = sanitize_text_field(ppress_var($menu, 'id', ''));
114 $url = esc_url_raw(! empty($menu['url']) ? $menu['url'] : add_query_arg('view', $id));
115 self::$parent_menu_url_map[$id] = $url;
116 ?>
117 <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' : '' ?>">
118 <?php echo esc_html($menu['label']) ?>
119 </a>
120 <?php endforeach; ?>
121 </nav>
122 </div>
123 <?php
124 }
125
126 public function settings_page_header_sub_menus($active_menu, $active_submenu)
127 {
128 $submenus = $this->header_submenu_tabs();
129
130 if (count($submenus) < 2) return;
131
132 $active_menu_url = self::$parent_menu_url_map[$active_menu];
133
134 $submenus = wp_list_filter($submenus, ['parent' => $active_menu]);
135
136 echo '<ul class="subsubsub">';
137
138 foreach ($submenus as $submenu) {
139
140 printf(
141 '<li><a href="%s"%s>%s</a></li>',
142 esc_url(add_query_arg('section', $submenu['id'], $active_menu_url)),
143 $active_submenu == $submenu['id'] ? ' class="ppress-current"' : '',
144 $submenu['label']
145 );
146 }
147 echo '</ul>';
148 }
149
150 public function active_menu_tab()
151 {
152 if (strpos(ppressGET_var('page'), 'pp') !== false) {
153 return isset($_GET['view']) ? sanitize_text_field($_GET['view']) : $this->default_header_menu();
154 }
155
156 return false;
157 }
158
159 public function active_submenu_tab()
160 {
161 if (strpos(ppressGET_var('page'), 'pp') !== false) {
162
163 $active_menu = $this->active_menu_tab();
164
165 $submenu_tabs = wp_list_filter($this->header_submenu_tabs(), ['parent' => $active_menu]);
166 $first_submenu_tab = '';
167 if ( ! empty($submenu_tabs)) {
168 $first_submenu_tab = array_values($submenu_tabs)[0]['id'];
169 }
170
171 return isset($_GET['section']) && ppressGET_var('view', 'general', true) == $active_menu ? sanitize_text_field($_GET['section']) : $first_submenu_tab;
172 }
173
174 return false;
175 }
176
177 public function admin_page_callback()
178 {
179 $active_menu = $this->active_menu_tab();
180
181 $active_submenu = $this->active_submenu_tab();
182
183 $this->settings_page_header($active_menu, $active_submenu);
184
185 do_action('ppress_admin_settings_page_' . $active_menu);
186
187 do_action('ppress_admin_settings_submenu_page_' . $active_menu . '_' . $active_submenu);
188 }
189 /** --------------------------------------------------------------- */
190
191 /**
192 * Register core settings.
193 *
194 * @param Custom_Settings_Page_Api $instance
195 * @param bool $remove_sidebar
196 */
197 public static function register_core_settings(Custom_Settings_Page_Api $instance, $remove_sidebar = false)
198 {
199 if ( ! $remove_sidebar) {
200 $instance->sidebar(self::sidebar_args());
201 }
202 }
203
204 public static function sidebar_args()
205 {
206 $sidebar_args = [
207 [
208 'section_title' => esc_html__('Need Support?', 'wp-user-avatar'),
209 'content' => self::sidebar_support_docs(),
210 ],
211 [
212 'section_title' => esc_html__('Check out MailOptin', 'wp-user-avatar'),
213 'content' => self::mailoptin_ad_block(),
214 ]
215 ];
216
217 if (defined('MAILOPTIN_DETACH_LIBSODIUM')) {
218 unset($sidebar_args[1]);
219 }
220
221 return $sidebar_args;
222 }
223
224 public static function sidebar_support_docs()
225 {
226 $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>';
227
228 $content = '<p>';
229
230 $support_url = 'https://wordpress.org/support/plugin/wp-user-avatar/';
231
232 if (ExtensionManager::is_premium()) {
233 $support_url = 'https://profilepress.com/submit-ticket/';
234 }
235
236 $content .= sprintf(
237 esc_html__('Whether you need help or have a new feature request, let us know. %sRequest Support%s', 'wp-user-avatar'),
238 '<a class="ppress-link" href="' . $support_url . '" target="_blank">', $link_icon . '</a>'
239 );
240
241 $content .= '</p>';
242
243 $content .= '<p>';
244 $content .= sprintf(
245 esc_html__('Detailed documentation is also available on the plugin website. %sView Knowledge Base%s', 'wp-user-avatar'),
246 '<a class="ppress-link" href="https://profilepress.com/docs/" target="_blank">', $link_icon . '</a>'
247 );
248
249 $content .= '</p>';
250
251 $content .= '<p>';
252 $content .= sprintf(
253 esc_html__('If you are enjoying ProfilePress and find it useful, please consider leaving a �
254
255
256
257
258 review on WordPress.org. %sLeave a Review%s', 'wp-user-avatar'),
259 '<a class="ppress-link" href="https://wordpress.org/support/plugin/wp-user-avatar/reviews/?filter=5#new-post" target="_blank">', $link_icon . '</a>'
260 );
261 $content .= '</p>';
262
263 return $content;
264 }
265
266 public static function mailoptin_ad_block()
267 {
268 $content = '<p>';
269 $content .= sprintf(
270 esc_html__('Use the coupon code %s10PERCENTOFF%s to save %s off MailOptin.', 'wp-user-avatar'),
271 '<code>', '</code>', '10%'
272 );
273
274 $content .= '</p>';
275
276 $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>';
277
278 return $content;
279 }
280
281 public static function page_dropdown($id, $appends = [], $args = ['skip_append_default_select' => false])
282 {
283 $default_args = [
284 'name' => PPRESS_SETTINGS_DB_OPTION_NAME . "[$id]",
285 'show_option_none' => esc_html__('Select...', 'wp-user-avatar'),
286 'selected' => ppress_get_setting($id, ''),
287 'echo' => false
288 ];
289
290 if ( ! empty($appends)) {
291 unset($default_args['show_option_none']);
292 }
293
294 $html = wp_dropdown_pages(
295 array_replace($default_args, $args)
296 );
297
298 if ( ! empty($appends)) {
299 $addition = '';
300
301 if (ppress_var($args, 'skip_append_default_select') === false) {
302 $addition .= '<option value="">' . esc_html__('Select...', 'wp-user-avatar') . '</option>';
303 }
304
305 foreach ($appends as $append) {
306 $key = $append['key'];
307 $label = $append['label'];
308 $disabled_attr = ppress_var($append, 'disabled') === true ? ' disabled' : '';
309 $addition .= "<option value=\"$key\"" . selected(ppress_get_setting($id), $key, false) . $disabled_attr . '>' . $label . '</option>';
310 }
311
312 $html = ppress_append_option_to_select($addition, $html);
313 }
314
315 return $html;
316 }
317
318 protected function custom_text_input($id, $placeholder = '')
319 {
320 $placeholder = ! empty($placeholder) ? $placeholder : esc_html__('Custom URL Here', 'wp-user-avatar');
321 $value = ppress_get_setting($id, '');
322
323 return "<input placeholder=\"$placeholder\" name=\"" . PPRESS_SETTINGS_DB_OPTION_NAME . "[$id]\" type=\"text\" class=\"regular-text code\" value=\"$value\">";
324 }
325 }