PluginProbe
WP-Members Membership Plugin / trunk
WP-Members Membership Plugin vtrunk
trunk 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.4.2 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.4.9.1 3.4.9.2 3.4.9.3 3.4.9.4 3.4.9.5 3.4.9.6 3.4.9.7 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 All 34 releases
wp-members / includes / admin / admin.php

admin.php in WP-Members Membership Plugin trunk, at includes/admin/admin.php

146 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WP-Members Admin Functions
4 *
5 * Functions to manage administration.
6 *
7 * This file is part of the WP-Members plugin by Chad Butler
8 * You can find out more about this plugin at https://rocketgeek.com
9 * Copyright (c) 2006-2026 Chad Butler
10 * WP-Members(tm) is a trademark of butlerblog.com
11 *
12 * @package WP-Members
13 * @author Chad Butler
14 * @copyright 2006-2026
15 *
16 * Functions included:
17 * - wpmem_admin
18 * - wpmem_admin_do_tab
19 * - wpmem_admin_tabs
20 * - wpmem_admin_action
21 * - wpmem_admin_add_new_user
22 */
23
24 // Exit if accessed directly.
25 if ( ! defined( 'ABSPATH' ) ) {
26 exit();
27 }
28
29 /**
30 * Primary admin function.
31 *
32 * @since 2.1.0
33 * @since 3.1.0 Added WP_Members_Admin_API.
34 *
35 * @global object $wpmem The WP_Members object.
36 */
37 function wpmem_admin() {
38
39 $did_update = ( isset( $_POST['wpmem_admin_a'] ) ) ? wpmem_admin_action( sanitize_text_field( $_POST['wpmem_admin_a'] ) ) : false;
40
41 global $wpmem;
42
43 add_filter( 'wpmem_admin_tabs', array( 'WP_Members_Admin_Tab_About', 'add_tab' ), 99 );
44
45 if ( $wpmem->captcha ) {
46 add_filter( 'wpmem_admin_tabs', array( 'WP_Members_Admin_Tab_Captcha', 'add_tab' ) );
47 add_action( 'wpmem_admin_do_tab', array( 'WP_Members_Admin_Tab_Captcha', 'do_tab' ), 1, 1 );
48 }
49 if ( $wpmem->dropins ) {
50 add_filter( 'wpmem_admin_tabs', array( 'WP_Members_Admin_Tab_Dropins', 'add_tab' ) );
51 add_action( 'wpmem_admin_do_tab', array( 'WP_Members_Admin_Tab_Dropins', 'do_tab' ), 1, 1 );
52 }
53
54 // @todo Adds tab for updating filesystem if /wpmembers/user_files/ exists.
55 $uploads = wp_upload_dir();
56 $deprecated_folder = trailingslashit( $uploads['basedir'] ) . 'wpmembers/user_files';
57 if ( is_dir( $deprecated_folder ) ) {
58 include_once $wpmem->path . 'includes/admin/tabs/class-wp-members-admin-tab-filesystem-upgrade.php';
59 add_filter( 'wpmem_admin_tabs', array( 'WP_Members_Admin_Filesystem_Upgrade', 'add_tab' ), 98 );
60 add_action( 'wpmem_admin_do_tab', array( 'WP_Members_Admin_Filesystem_Upgrade', 'do_tab' ), 98 );
61 }
62
63 ?>
64
65 <div class="wrap">
66 <?php
67 $tab = sanitize_text_field( wpmem_get( 'tab', 'options', 'get' ) );
68
69 // Render the tab being displayed.
70 $wpmem->admin->do_tabs( $tab );
71
72 // Render any warning messages.
73 wpmem_a_do_warnings( $did_update );
74
75 /**
76 * Fires at the end of creating an admin panel tab.
77 *
78 * This action is part of the plugin's admin panel API for adding
79 * additional admin tabs. This action is for adding content for
80 * a custom tab.
81 *
82 * @since 2.8.0
83 *
84 * @param string $tab The tab being generated.
85 */
86 do_action( 'wpmem_admin_do_tab', $tab );
87 ?>
88 </div><!-- .wrap --><?php
89
90 return;
91 }
92
93
94 /**
95 * Handles the various update actions for the default tabs.
96 *
97 * @since 2.8.0
98 *
99 * @param string $action The action that is being done.
100 * @return string $did_update The update message result.
101 */
102 function wpmem_admin_action( $action ) {
103
104 $did_update = ''; // makes sure $did_update is defined
105 switch ( $action ) {
106
107 case 'update_settings':
108 case 'update_cpts':
109 $did_update = WP_Members_Admin_Tab_Options::update( $action );
110 break;
111
112 case 'update_dialogs':
113 $did_update = WP_Members_Admin_Tab_Dialogs::update();
114 break;
115
116 case 'update_emails':
117 $did_update = WP_Members_Admin_Tab_Emails::update();
118 break;
119
120 case 'update_captcha':
121 $did_update = WP_Members_Admin_Tab_Captcha::update();
122 break;
123
124 case 'update_shortcodes':
125 $did_update = WP_Members_Admin_Tab_Shortcodes::update();
126 break;
127 }
128
129 return $did_update;
130 }
131
132 /**
133 * Wrapper for WP_Members_Admin_Tab_Options::page_list()
134 *
135 * This function gets used by extensions outside of WP-Members, so it needs to stay (for now).
136 *
137 * @since 3.3.0
138 *
139 * @param string $val
140 * @param boolean $show_custom_url
141 */
142 function wpmem_admin_page_list( $val, $show_custom_url = true ) {
143 return WP_Members_Admin_Tab_Options::page_list( $val, $show_custom_url );
144 }
145
146 // End of File.