| 1 |
<?php |
| 2 |
/** |
| 3 |
* Handles the settings screen. |
| 4 |
* |
| 5 |
* @package Members |
| 6 |
* @subpackage Admin |
| 7 |
* @author The MemberPress Team |
| 8 |
* @copyright Copyright (c) 2009 - 2018, The MemberPress Team |
| 9 |
* @link https://members-plugin.com/ |
| 10 |
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 11 |
*/ |
| 12 |
namespace Members\Admin; |
| 13 |
|
| 14 |
defined('ABSPATH') || exit; |
| 15 |
/** |
| 16 |
* Sets up and handles the plugin settings screen. |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
* @access public |
| 20 |
*/ |
| 21 |
final class Settings_Page { |
| 22 |
|
| 23 |
/** |
| 24 |
* Admin page name/ID. |
| 25 |
* |
| 26 |
* @since 2.0.0 |
| 27 |
* @access public |
| 28 |
* @var string |
| 29 |
*/ |
| 30 |
public $name = 'members-settings'; |
| 31 |
|
| 32 |
/** |
| 33 |
* Admin page names. |
| 34 |
* |
| 35 |
* @since 1.0.0 |
| 36 |
* @access public |
| 37 |
* @var array |
| 38 |
*/ |
| 39 |
public $admin_pages = array(); |
| 40 |
|
| 41 |
/** |
| 42 |
* About page name. |
| 43 |
* |
| 44 |
* @since 1.0.0 |
| 45 |
* @access public |
| 46 |
* @var string |
| 47 |
*/ |
| 48 |
public $about_page = ''; |
| 49 |
|
| 50 |
/** |
| 51 |
* Addons page name. |
| 52 |
* |
| 53 |
* @since 1.0.0 |
| 54 |
* @access public |
| 55 |
* @var string |
| 56 |
*/ |
| 57 |
public $addons_page = ''; |
| 58 |
|
| 59 |
/** |
| 60 |
* Payments page name. |
| 61 |
* |
| 62 |
* @since 1.0.0 |
| 63 |
* @access public |
| 64 |
* @var string |
| 65 |
*/ |
| 66 |
public $payments_page = ''; |
| 67 |
|
| 68 |
/** |
| 69 |
* Settings page name. |
| 70 |
* |
| 71 |
* @since 1.0.0 |
| 72 |
* @access public |
| 73 |
* @var string |
| 74 |
*/ |
| 75 |
public $settings_page = ''; |
| 76 |
|
| 77 |
/** |
| 78 |
* Holds an array the settings page views. |
| 79 |
* |
| 80 |
* @since 2.0.0 |
| 81 |
* @access public |
| 82 |
* @var array |
| 83 |
*/ |
| 84 |
public $views = array(); |
| 85 |
|
| 86 |
/** |
| 87 |
* Returns the instance. |
| 88 |
* |
| 89 |
* @since 1.0.0 |
| 90 |
* @access public |
| 91 |
* @return object |
| 92 |
*/ |
| 93 |
public static function get_instance() { |
| 94 |
|
| 95 |
static $instance = null; |
| 96 |
|
| 97 |
if ( is_null( $instance ) ) { |
| 98 |
$instance = new self; |
| 99 |
$instance->includes(); |
| 100 |
$instance->setup_actions(); |
| 101 |
} |
| 102 |
|
| 103 |
return $instance; |
| 104 |
} |
| 105 |
|
| 106 |
/** |
| 107 |
* Constructor method. |
| 108 |
* |
| 109 |
* @since 1.0.0 |
| 110 |
* @access public |
| 111 |
* @return void |
| 112 |
*/ |
| 113 |
private function __construct() {} |
| 114 |
|
| 115 |
/** |
| 116 |
* Loads settings files. |
| 117 |
* |
| 118 |
* @since 2.0.0 |
| 119 |
* @access private |
| 120 |
* @return void |
| 121 |
*/ |
| 122 |
private function includes() { |
| 123 |
|
| 124 |
// Include the settings functions. |
| 125 |
require_once( members_plugin()->dir . 'admin/functions-settings.php' ); |
| 126 |
|
| 127 |
// Load settings view classes. |
| 128 |
require_once( members_plugin()->dir . 'admin/views/class-view.php' ); |
| 129 |
require_once( members_plugin()->dir . 'admin/views/class-view-general.php' ); |
| 130 |
require_once( members_plugin()->dir . 'admin/views/class-view-addons.php' ); |
| 131 |
} |
| 132 |
|
| 133 |
/** |
| 134 |
* Sets up initial actions. |
| 135 |
* |
| 136 |
* @since 2.0.0 |
| 137 |
* @access private |
| 138 |
* @return void |
| 139 |
*/ |
| 140 |
private function setup_actions() { |
| 141 |
|
| 142 |
add_action( 'admin_menu', array( $this, 'admin_menu' ), 25 ); |
| 143 |
add_action( 'wp_ajax_mbrs_toggle_addon', array( $this, 'toggle_addon' ) ); |
| 144 |
} |
| 145 |
|
| 146 |
/** |
| 147 |
* AJAX call to toggle an addon off and on |
| 148 |
* |
| 149 |
* @return void |
| 150 |
*/ |
| 151 |
public function toggle_addon() { |
| 152 |
|
| 153 |
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'mbrs_toggle_addon' ) ) { |
| 154 |
die(); |
| 155 |
} |
| 156 |
if ( ! current_user_can( 'manage_options' ) ) { |
| 157 |
wp_send_json_error( array( |
| 158 |
'msg' => esc_html__( 'You are not allowed to make these changes.', 'members' ) |
| 159 |
) ); |
| 160 |
} |
| 161 |
$addon = ! empty( $_POST['addon'] ) ? sanitize_text_field( $_POST['addon'] ) : false; |
| 162 |
|
| 163 |
if ( false === $addon ) { |
| 164 |
wp_send_json_error( array( |
| 165 |
'msg' => esc_html__( 'No add-on provided.', 'members' ) |
| 166 |
) ); |
| 167 |
} |
| 168 |
|
| 169 |
// Grab the currently active add-ons |
| 170 |
$active_addons = get_option( 'members_active_addons', array() ); |
| 171 |
|
| 172 |
if ( ! in_array( $addon, $active_addons ) ) { // Activate the addon |
| 173 |
$active_addons[] = $addon; |
| 174 |
$response = array( |
| 175 |
'status' => 'active', |
| 176 |
'action_label' => esc_html__( 'Active', 'members' ), |
| 177 |
'msg' => esc_html__( 'Add-on activated', 'members' ) |
| 178 |
); |
| 179 |
|
| 180 |
// Run the add-on's activation hook |
| 181 |
members_plugin()->run_addon_activator( $addon ); |
| 182 |
|
| 183 |
} else { // Deactivate the addon |
| 184 |
$key = array_search( $addon, $active_addons ); |
| 185 |
unset( $active_addons[$key] ); |
| 186 |
$response = array( |
| 187 |
'status' => 'inactive', |
| 188 |
'action_label' => esc_html__( 'Activate', 'members' ), |
| 189 |
'msg' => esc_html__( 'Add-on deactivated', 'members' ) |
| 190 |
); |
| 191 |
} |
| 192 |
|
| 193 |
update_option( 'members_active_addons', $active_addons ); |
| 194 |
|
| 195 |
wp_send_json_success( $response ); |
| 196 |
} |
| 197 |
|
| 198 |
/** |
| 199 |
* Register a view. |
| 200 |
* |
| 201 |
* @since 2.0.0 |
| 202 |
* @access public |
| 203 |
* @param object $view |
| 204 |
* @return void |
| 205 |
*/ |
| 206 |
public function register_view( $view ) { |
| 207 |
|
| 208 |
if ( ! $this->view_exists( $view->name ) ) |
| 209 |
$this->views[ $view->name ] = $view; |
| 210 |
} |
| 211 |
|
| 212 |
/** |
| 213 |
* Unregister a view. |
| 214 |
* |
| 215 |
* @since 2.0.0 |
| 216 |
* @access public |
| 217 |
* @param string $name |
| 218 |
* @return void |
| 219 |
*/ |
| 220 |
public function unregister_view( $name ) { |
| 221 |
|
| 222 |
if ( $this->view_exists( $name ) ) |
| 223 |
unset( $this->views[ $name ] ); |
| 224 |
} |
| 225 |
|
| 226 |
/** |
| 227 |
* Get a view object |
| 228 |
* |
| 229 |
* @since 2.0.0 |
| 230 |
* @access public |
| 231 |
* @param string $name |
| 232 |
* @return object |
| 233 |
*/ |
| 234 |
public function get_view( $name ) { |
| 235 |
|
| 236 |
return $this->view_exists( $name ) ? $this->views[ $name ] : false; |
| 237 |
} |
| 238 |
|
| 239 |
/** |
| 240 |
* Check if a view exists. |
| 241 |
* |
| 242 |
* @since 2.0.0 |
| 243 |
* @access public |
| 244 |
* @param string $name |
| 245 |
* @return bool |
| 246 |
*/ |
| 247 |
public function view_exists( $name ) { |
| 248 |
|
| 249 |
return isset( $this->views[ $name ] ); |
| 250 |
} |
| 251 |
|
| 252 |
/** |
| 253 |
* Sets up custom admin menus. |
| 254 |
* |
| 255 |
* @since 1.0.0 |
| 256 |
* @access public |
| 257 |
* @return void |
| 258 |
*/ |
| 259 |
public function admin_menu() { |
| 260 |
|
| 261 |
// Create the settings pages. |
| 262 |
$this->admin_pages = array( 'toplevel_page_members', 'members_page_roles' ); |
| 263 |
$this->settings_page = add_submenu_page( 'members', esc_html_x( 'Settings', 'admin screen', 'members' ), esc_html_x( 'Settings', 'admin screen', 'members' ), apply_filters( 'members_settings_capability', 'manage_options' ), 'members-settings', array( $this, 'settings_page' ) ); |
| 264 |
$this->admin_pages[] = $this->settings_page; |
| 265 |
$this->addons_page = add_submenu_page( 'members', esc_html_x( 'Add-Ons', 'admin screen', 'members' ), _x( '<span style="color: #8CBD5A;">Add-Ons</span>', 'admin screen', 'members' ), apply_filters( 'members_settings_capability', 'manage_options' ), 'members-settings&view=add-ons', array( $this, 'settings_page' ) ); |
| 266 |
$this->admin_pages[] = $this->addons_page; |
| 267 |
if ( ! members_is_memberpress_active() ) { // MemberPress not active |
| 268 |
$this->payments_page = add_submenu_page( 'members', esc_html_x( 'Payments', 'admin screen', 'members' ), esc_html_x( 'Payments', 'admin screen', 'members' ), apply_filters( 'members_settings_capability', 'manage_options' ), 'members-payments', array( $this, 'payments_page' ) ); |
| 269 |
$this->admin_pages[] = $this->payments_page; |
| 270 |
} |
| 271 |
$this->about_page = add_submenu_page( 'members', esc_html_x( 'About Us', 'admin screen', 'members' ), esc_html_x( 'About Us', 'admin screen', 'members' ), apply_filters( 'members_settings_capability', 'manage_options' ), 'members-about', array( $this, 'about_page' ) ); |
| 272 |
$this->admin_pages[] = $this->about_page; |
| 273 |
|
| 274 |
if ( $this->settings_page ) { |
| 275 |
|
| 276 |
do_action( 'members_register_settings_views', $this ); |
| 277 |
|
| 278 |
uasort( $this->views, 'members_priority_sort' ); |
| 279 |
|
| 280 |
// Register setings. |
| 281 |
add_action( 'admin_init', array( $this, 'register_settings' ) ); |
| 282 |
|
| 283 |
// Page load callback. |
| 284 |
add_action( "load-{$this->settings_page}", array( $this, 'load' ) ); |
| 285 |
|
| 286 |
// Enqueue scripts/styles. |
| 287 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
/** |
| 292 |
* Runs on page load. |
| 293 |
* |
| 294 |
* @since 2.0.0 |
| 295 |
* @access public |
| 296 |
* @return void |
| 297 |
*/ |
| 298 |
public function load() { |
| 299 |
|
| 300 |
// Print custom styles. |
| 301 |
add_action( 'admin_head', array( $this, 'print_styles' ) ); |
| 302 |
|
| 303 |
// Add help tabs for the current view. |
| 304 |
$view = $this->get_view( members_get_current_settings_view() ); |
| 305 |
|
| 306 |
if ( $view ) { |
| 307 |
$view->load(); |
| 308 |
$view->add_help_tabs(); |
| 309 |
} |
| 310 |
} |
| 311 |
|
| 312 |
/** |
| 313 |
* Print styles to the header. |
| 314 |
* |
| 315 |
* @since 2.0.0 |
| 316 |
* @access public |
| 317 |
* @return void |
| 318 |
*/ |
| 319 |
public function print_styles() { ?> |
| 320 |
|
| 321 |
<style type="text/css"> |
| 322 |
|
| 323 |
</style> |
| 324 |
<?php } |
| 325 |
|
| 326 |
/** |
| 327 |
* Enqueue scripts/styles. |
| 328 |
* |
| 329 |
* @since 1.0.0 |
| 330 |
* @access public |
| 331 |
* @param string $hook_suffix |
| 332 |
* @return void |
| 333 |
*/ |
| 334 |
public function enqueue( $hook_suffix ) { |
| 335 |
|
| 336 |
if ( ! members_is_admin_page() ) |
| 337 |
return; |
| 338 |
|
| 339 |
$view = $this->get_view( members_get_current_settings_view() ); |
| 340 |
|
| 341 |
wp_enqueue_style( 'members-admin' ); |
| 342 |
|
| 343 |
if ( $view ) |
| 344 |
$view->enqueue(); |
| 345 |
} |
| 346 |
|
| 347 |
/** |
| 348 |
* Registers the plugin settings. |
| 349 |
* |
| 350 |
* @since 1.0.0 |
| 351 |
* @access public |
| 352 |
* @return void |
| 353 |
*/ |
| 354 |
function register_settings() { |
| 355 |
|
| 356 |
foreach ( $this->views as $view ) |
| 357 |
$view->register_settings(); |
| 358 |
} |
| 359 |
|
| 360 |
/** |
| 361 |
* Renders the settings page. |
| 362 |
* |
| 363 |
* @since 1.0.0 |
| 364 |
* @access public |
| 365 |
* @return void |
| 366 |
*/ |
| 367 |
public function settings_page() { ?> |
| 368 |
|
| 369 |
<div class="wrap"> |
| 370 |
<h1><?php echo esc_html_x( 'Members', 'admin screen', 'members' ); ?></h1> |
| 371 |
<div class="wp-filter"> |
| 372 |
<?php echo $this->filter_links(); ?> |
| 373 |
</div> |
| 374 |
<?php $this->get_view( members_get_current_settings_view() )->template(); ?> |
| 375 |
</div><!-- wrap --> |
| 376 |
<?php } |
| 377 |
|
| 378 |
/** |
| 379 |
* Renders the payments page. |
| 380 |
* |
| 381 |
* @since 1.0.0 |
| 382 |
* @access public |
| 383 |
* @return void |
| 384 |
*/ |
| 385 |
public function payments_page() { |
| 386 |
|
| 387 |
wp_enqueue_style( 'members-admin' ); |
| 388 |
wp_enqueue_script( 'members-settings' ); |
| 389 |
|
| 390 |
?> |
| 391 |
|
| 392 |
<div class="wrap"> |
| 393 |
<h1><?php echo esc_html_x( 'Payments', 'admin screen', 'members' ); ?></h1> |
| 394 |
<div class="mepr-upgrade-table"> |
| 395 |
<?php members_memberpress_upgrade( 'https://memberpress.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=payments&utm_content=payments_page' ); ?> |
| 396 |
<table class="wp-list-table widefat fixed striped mepr_dummy_txns"> |
| 397 |
<thead> |
| 398 |
<tr> |
| 399 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Id</span></a></th> |
| 400 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Transaction</span></a></th> |
| 401 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Subscription</span></a></th> |
| 402 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Status</span></a></th> |
| 403 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Membership</span></a></th> |
| 404 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Net</span></a></th> |
| 405 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Tax</span></a></th> |
| 406 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Total</span></a></th> |
| 407 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Name</span></a></th> |
| 408 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>User</span></a></th> |
| 409 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Gateway</span></a></th> |
| 410 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Created On</span></a></th> |
| 411 |
<th scope="col" class="manage-column column-col_id column-primary"><a href=""><span>Expires On</span></a></th> |
| 412 |
</tr> |
| 413 |
</thead> |
| 414 |
<tbody id="the-list"> |
| 415 |
<tr class="alternate"> |
| 416 |
<td class="col_id column-col_id">1</td> |
| 417 |
<td class="col_trans_num column-col_trans_num"> |
| 418 |
<a href="">1</a> |
| 419 |
</td> |
| 420 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 421 |
<td class="col_status column-col_status"> |
| 422 |
<div class="status_initial"> |
| 423 |
<a href="" title="Change transaction's status">Complete</a> |
| 424 |
</div> |
| 425 |
</td> |
| 426 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 427 |
<td class="col_net column-col_net">$20.00</td> |
| 428 |
<td class="col_tax column-col_tax">$0.00</td> |
| 429 |
<td class="col_total column-col_total">$20.00</td> |
| 430 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 431 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 432 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 433 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 434 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 435 |
</tr> |
| 436 |
<tr class=""> |
| 437 |
<td class="col_id column-col_id">2</td> |
| 438 |
<td class="col_trans_num column-col_trans_num"> |
| 439 |
<a href="">2</a> |
| 440 |
</td> |
| 441 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 442 |
<td class="col_status column-col_status"> |
| 443 |
<div class="status_initial"> |
| 444 |
<a href="" title="Change transaction's status">Complete</a> |
| 445 |
</div> |
| 446 |
</td> |
| 447 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 448 |
<td class="col_net column-col_net">$20.00</td> |
| 449 |
<td class="col_tax column-col_tax">$0.00</td> |
| 450 |
<td class="col_total column-col_total">$20.00</td> |
| 451 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 452 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 453 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 454 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 455 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 456 |
</tr> |
| 457 |
<tr class="alternate"> |
| 458 |
<td class="col_id column-col_id">3</td> |
| 459 |
<td class="col_trans_num column-col_trans_num"> |
| 460 |
<a href="">3</a> |
| 461 |
</td> |
| 462 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 463 |
<td class="col_status column-col_status"> |
| 464 |
<div class="status_initial"> |
| 465 |
<a href="" title="Change transaction's status">Complete</a> |
| 466 |
</div> |
| 467 |
</td> |
| 468 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 469 |
<td class="col_net column-col_net">$20.00</td> |
| 470 |
<td class="col_tax column-col_tax">$0.00</td> |
| 471 |
<td class="col_total column-col_total">$20.00</td> |
| 472 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 473 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 474 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 475 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 476 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 477 |
</tr> |
| 478 |
<tr class=""> |
| 479 |
<td class="col_id column-col_id">4</td> |
| 480 |
<td class="col_trans_num column-col_trans_num"> |
| 481 |
<a href="">4</a> |
| 482 |
</td> |
| 483 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 484 |
<td class="col_status column-col_status"> |
| 485 |
<div class="status_initial"> |
| 486 |
<a href="" title="Change transaction's status">Complete</a> |
| 487 |
</div> |
| 488 |
</td> |
| 489 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 490 |
<td class="col_net column-col_net">$20.00</td> |
| 491 |
<td class="col_tax column-col_tax">$0.00</td> |
| 492 |
<td class="col_total column-col_total">$20.00</td> |
| 493 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 494 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 495 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 496 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 497 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 498 |
</tr> |
| 499 |
<tr class="alternate"> |
| 500 |
<td class="col_id column-col_id">5</td> |
| 501 |
<td class="col_trans_num column-col_trans_num"> |
| 502 |
<a href="">5</a> |
| 503 |
</td> |
| 504 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 505 |
<td class="col_status column-col_status"> |
| 506 |
<div class="status_initial"> |
| 507 |
<a href="" title="Change transaction's status">Complete</a> |
| 508 |
</div> |
| 509 |
</td> |
| 510 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 511 |
<td class="col_net column-col_net">$20.00</td> |
| 512 |
<td class="col_tax column-col_tax">$0.00</td> |
| 513 |
<td class="col_total column-col_total">$20.00</td> |
| 514 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 515 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 516 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 517 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 518 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 519 |
</tr> |
| 520 |
<tr class=""> |
| 521 |
<td class="col_id column-col_id">6</td> |
| 522 |
<td class="col_trans_num column-col_trans_num"> |
| 523 |
<a href="">6</a> |
| 524 |
</td> |
| 525 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 526 |
<td class="col_status column-col_status"> |
| 527 |
<div class="status_initial"> |
| 528 |
<a href="" title="Change transaction's status">Complete</a> |
| 529 |
</div> |
| 530 |
</td> |
| 531 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 532 |
<td class="col_net column-col_net">$20.00</td> |
| 533 |
<td class="col_tax column-col_tax">$0.00</td> |
| 534 |
<td class="col_total column-col_total">$20.00</td> |
| 535 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 536 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 537 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 538 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 539 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 540 |
</tr> |
| 541 |
<tr class="alternate"> |
| 542 |
<td class="col_id column-col_id">7</td> |
| 543 |
<td class="col_trans_num column-col_trans_num"> |
| 544 |
<a href="">7</a> |
| 545 |
</td> |
| 546 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 547 |
<td class="col_status column-col_status"> |
| 548 |
<div class="status_initial"> |
| 549 |
<a href="" title="Change transaction's status">Complete</a> |
| 550 |
</div> |
| 551 |
</td> |
| 552 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 553 |
<td class="col_net column-col_net">$20.00</td> |
| 554 |
<td class="col_tax column-col_tax">$0.00</td> |
| 555 |
<td class="col_total column-col_total">$20.00</td> |
| 556 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 557 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 558 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 559 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 560 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 561 |
</tr> |
| 562 |
<tr class=""> |
| 563 |
<td class="col_id column-col_id">8</td> |
| 564 |
<td class="col_trans_num column-col_trans_num"> |
| 565 |
<a href="">8</a> |
| 566 |
</td> |
| 567 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 568 |
<td class="col_status column-col_status"> |
| 569 |
<div class="status_initial"> |
| 570 |
<a href="" title="Change transaction's status">Complete</a> |
| 571 |
</div> |
| 572 |
</td> |
| 573 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 574 |
<td class="col_net column-col_net">$20.00</td> |
| 575 |
<td class="col_tax column-col_tax">$0.00</td> |
| 576 |
<td class="col_total column-col_total">$20.00</td> |
| 577 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 578 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 579 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 580 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 581 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 582 |
</tr> |
| 583 |
<tr class="alternate"> |
| 584 |
<td class="col_id column-col_id">9</td> |
| 585 |
<td class="col_trans_num column-col_trans_num"> |
| 586 |
<a href="">9</a> |
| 587 |
</td> |
| 588 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 589 |
<td class="col_status column-col_status"> |
| 590 |
<div class="status_initial"> |
| 591 |
<a href="" title="Change transaction's status">Complete</a> |
| 592 |
</div> |
| 593 |
</td> |
| 594 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 595 |
<td class="col_net column-col_net">$20.00</td> |
| 596 |
<td class="col_tax column-col_tax">$0.00</td> |
| 597 |
<td class="col_total column-col_total">$20.00</td> |
| 598 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 599 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 600 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 601 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 602 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 603 |
</tr> |
| 604 |
<tr class=""> |
| 605 |
<td class="col_id column-col_id">10</td> |
| 606 |
<td class="col_trans_num column-col_trans_num"> |
| 607 |
<a href="">10</a> |
| 608 |
</td> |
| 609 |
<td class="col_subscr_id column-col_subscr_id">None</td> |
| 610 |
<td class="col_status column-col_status"> |
| 611 |
<div class="status_initial"> |
| 612 |
<a href="" title="Change transaction's status">Complete</a> |
| 613 |
</div> |
| 614 |
</td> |
| 615 |
<td class="col_product column-col_product"><a href="">Your Membership</a></td> |
| 616 |
<td class="col_net column-col_net">$20.00</td> |
| 617 |
<td class="col_tax column-col_tax">$0.00</td> |
| 618 |
<td class="col_total column-col_total">$20.00</td> |
| 619 |
<td class="col_propername column-col_propername">Your Customer</td> |
| 620 |
<td class="col_user_login column-col_user_login"><a href="#" title="View member's profile">user</a></td> |
| 621 |
<td class="col_payment_system column-col_payment_system">Payment Method</td> |
| 622 |
<td class="col_created_at column-col_created_at">January 27, 2020</td> |
| 623 |
<td class="col_expires_at column-col_expires_at">Never</td> |
| 624 |
</tr> |
| 625 |
</tbody> |
| 626 |
|
| 627 |
</table> |
| 628 |
</div> |
| 629 |
</div><!-- wrap --> |
| 630 |
<?php } |
| 631 |
|
| 632 |
/** |
| 633 |
* Renders the about page. |
| 634 |
* |
| 635 |
* @since 1.0.0 |
| 636 |
* @access public |
| 637 |
* @return void |
| 638 |
*/ |
| 639 |
public function about_page() { |
| 640 |
|
| 641 |
$installed_plugins = get_plugins(); |
| 642 |
|
| 643 |
wp_enqueue_style( 'members-admin' ); |
| 644 |
wp_enqueue_script( 'members-settings' ); |
| 645 |
|
| 646 |
$products = array( |
| 647 |
array( |
| 648 |
'slug' => 'memberpress', |
| 649 |
'name' => 'MemberPress', |
| 650 |
'icon' => 'mp-icon-RGB.jpg', |
| 651 |
'description' => 'Build astounding WordPress membership sites, accept payments securely, and control who sees your content — without the difficult setup.', |
| 652 |
'plugin_file' => 'memberpress/memberpress.php', |
| 653 |
'is_active' => members_is_memberpress_active(), |
| 654 |
'url_title' => 'https://memberpress.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=memberpress_icon_title', |
| 655 |
'url_learn' => 'https://memberpress.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=memberpress_learn_more', |
| 656 |
'url_install' => 'https://memberpress.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=memberpress_install', |
| 657 |
), |
| 658 |
array( |
| 659 |
'slug' => 'pretty-links', |
| 660 |
'name' => 'Pretty Links', |
| 661 |
'icon' => 'pl-icon-RGB.jpg', |
| 662 |
'description' => 'Monetize your content effortlessly. Pretty Links helps you unlock more affiliate revenue from the content you already have.', |
| 663 |
'plugin_file' => 'pretty-link/pretty-link.php', |
| 664 |
'is_active' => is_plugin_active( 'pretty-link/pretty-link.php' ), |
| 665 |
'url_title' => 'https://prettylinks.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=prettylinks_icon_title', |
| 666 |
'url_learn' => 'https://prettylinks.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=prettylinks_learn_more', |
| 667 |
'url_install' => 'https://prettylinks.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=prettylinks_install', |
| 668 |
), |
| 669 |
array( |
| 670 |
'slug' => 'easy-affiliate', |
| 671 |
'name' => 'Easy Affiliate', |
| 672 |
'icon' => 'bee.png', |
| 673 |
'description' => 'A full-featured affiliate program plugin for WordPress. Launch your own program to drive traffic, attention, and sales.', |
| 674 |
'plugin_file' => 'affiliate-royale/affiliate-royale.php', |
| 675 |
'is_active' => is_plugin_active( 'affiliate-royale/affiliate-royale.php' ), |
| 676 |
'url_title' => 'https://easyaffiliate.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=easyaffiliate_icon_title', |
| 677 |
'url_learn' => 'https://easyaffiliate.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=easyaffiliate_learn_more', |
| 678 |
'url_install' => 'https://easyaffiliate.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=easyaffiliate_install', |
| 679 |
), |
| 680 |
); |
| 681 |
|
| 682 |
$plugin_uri = members_plugin()->uri; |
| 683 |
|
| 684 |
?> |
| 685 |
|
| 686 |
<link rel="preconnect" href="https://fonts.googleapis.com"> |
| 687 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 688 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet"> |
| 689 |
|
| 690 |
<div class="wrap members-about"> |
| 691 |
<h1 class="screen-reader-text"><?php echo esc_html_x( 'About Us', 'admin screen', 'members' ); ?></h1> |
| 692 |
|
| 693 |
<article class="members-about__hero"> |
| 694 |
<header class="members-about__hero-head"> |
| 695 |
<span class="members-about__eyebrow">About · <?php echo esc_html( date( 'Y' ) ); ?></span> |
| 696 |
<h2 class="members-about__title"> |
| 697 |
Hello & <em>welcome</em> |
| 698 |
<br>to Members<span class="members-about__title-dot">.</span> |
| 699 |
</h2> |
| 700 |
</header> |
| 701 |
|
| 702 |
<div class="members-about__body"> |
| 703 |
<p class="members-about__lead"> |
| 704 |
The simplest WordPress membership and role editor plugin — built by the team at <a href="https://memberpress.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=link_1" target="_blank" rel="noopener">MemberPress</a>. |
| 705 |
</p> |
| 706 |
<p>Over the years we found that most WordPress membership plugins were bloated, buggy, slow, hard to use — and expensive. So we started with a simple goal: build a plugin that's both easy <em>and</em> powerful.</p> |
| 707 |
<p>Our goal is to take the pain out of creating membership sites and make it easy.</p> |
| 708 |
<p>Members is brought to you by the same team behind <a href="https://memberpress.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=link_2" target="_blank" rel="noopener">MemberPress</a>, <a href="https://easyaffiliate.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=link_3" target="_blank" rel="noopener">Easy Affiliate</a>, and <a href="https://prettylinks.com/?utm_source=members_plugin&utm_medium=link&utm_campaign=about_us&utm_content=link_4" target="_blank" rel="noopener">Pretty Links</a>.</p> |
| 709 |
<p>So — you can see we know a thing or two about building products that customers love.</p> |
| 710 |
</div> |
| 711 |
|
| 712 |
<aside class="members-about__mark"> |
| 713 |
<a href="https://memberpress.com/?utm_source=members_plugin&utm_medium=banner&utm_campaign=about_us&utm_content=memberpress_logo_large" target="_blank" rel="noopener"> |
| 714 |
<img src="<?php echo esc_url( $plugin_uri . 'img/mp-logo-stacked-RGB.jpg' ); ?>" alt="MemberPress"> |
| 715 |
</a> |
| 716 |
</aside> |
| 717 |
</article> |
| 718 |
|
| 719 |
<section class="members-about__products" aria-label="More from our team"> |
| 720 |
<header class="members-about__products-head"> |
| 721 |
<h3>From our team</h3> |
| 722 |
</header> |
| 723 |
|
| 724 |
<div class="members-about__grid"> |
| 725 |
<?php foreach ( $products as $p ) : |
| 726 |
$is_installed = array_key_exists( $p['plugin_file'], $installed_plugins ); |
| 727 |
if ( $p['is_active'] ) { |
| 728 |
$status_label = 'Active'; |
| 729 |
$status_class = 'is-active'; |
| 730 |
$cta_label = 'Learn More'; |
| 731 |
$cta_href = $p['url_learn']; |
| 732 |
$cta_class = 'is-secondary'; |
| 733 |
$cta_target = '_blank'; |
| 734 |
} elseif ( $is_installed ) { |
| 735 |
$status_label = 'Inactive'; |
| 736 |
$status_class = 'is-inactive'; |
| 737 |
$cta_label = 'Activate'; |
| 738 |
$cta_href = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $p['plugin_file'] ), 'activate-plugin_' . $p['plugin_file'] ); |
| 739 |
$cta_class = 'is-secondary'; |
| 740 |
$cta_target = '_self'; |
| 741 |
} else { |
| 742 |
$status_label = 'Not installed'; |
| 743 |
$status_class = 'is-missing'; |
| 744 |
$cta_label = 'Install Plugin'; |
| 745 |
$cta_href = $p['url_install']; |
| 746 |
$cta_class = 'is-primary'; |
| 747 |
$cta_target = '_blank'; |
| 748 |
} |
| 749 |
?> |
| 750 |
<article class="members-about__card" data-slug="<?php echo esc_attr( $p['slug'] ); ?>"> |
| 751 |
<header class="members-about__card-head"> |
| 752 |
<span class="members-about__card-icon"> |
| 753 |
<img src="<?php echo esc_url( $plugin_uri . 'img/' . $p['icon'] ); ?>" alt=""> |
| 754 |
</span> |
| 755 |
<h4 class="members-about__card-title"> |
| 756 |
<a href="<?php echo esc_url( $p['url_title'] ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html( $p['name'] ); ?></a> |
| 757 |
</h4> |
| 758 |
</header> |
| 759 |
<p class="members-about__card-desc"><?php echo esc_html( $p['description'] ); ?></p> |
| 760 |
<footer class="members-about__card-foot"> |
| 761 |
<span class="members-about__status <?php echo esc_attr( $status_class ); ?>"><?php echo esc_html( $status_label ); ?></span> |
| 762 |
<a class="members-about__cta <?php echo esc_attr( $cta_class ); ?>" href="<?php echo esc_url( $cta_href ); ?>"<?php echo $cta_target === '_blank' ? ' target="_blank" rel="noopener"' : ''; ?>> |
| 763 |
<?php echo esc_html( $cta_label ); ?> |
| 764 |
<svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M2 8L8 2M8 2H3.5M8 2V6.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg> |
| 765 |
</a> |
| 766 |
</footer> |
| 767 |
</article> |
| 768 |
<?php endforeach; ?> |
| 769 |
</div> |
| 770 |
</section> |
| 771 |
</div><!-- wrap --> |
| 772 |
<?php } |
| 773 |
|
| 774 |
/** |
| 775 |
* Outputs the list of views. |
| 776 |
* |
| 777 |
* @since 2.0.0 |
| 778 |
* @access public |
| 779 |
* @return void |
| 780 |
*/ |
| 781 |
private function filter_links() { ?> |
| 782 |
|
| 783 |
<ul class="filter-links"> |
| 784 |
|
| 785 |
<?php foreach ( $this->views as $view ) : |
| 786 |
|
| 787 |
// Determine current class. |
| 788 |
$class = $view->name === members_get_current_settings_view() ? 'class="current"' : ''; |
| 789 |
|
| 790 |
// Get the URL. |
| 791 |
$url = members_get_settings_view_url( $view->name ); |
| 792 |
|
| 793 |
if ( 'general' === $view->name ) |
| 794 |
$url = remove_query_arg( 'view', $url ); ?> |
| 795 |
|
| 796 |
<li class="<?php echo sanitize_html_class( $view->name ); ?>"> |
| 797 |
<a href="<?php echo esc_url( $url ); ?>" <?php echo $class; ?>><?php echo esc_html( $view->label ); ?></a> |
| 798 |
</li> |
| 799 |
|
| 800 |
<?php endforeach; ?> |
| 801 |
|
| 802 |
</ul> |
| 803 |
<?php } |
| 804 |
|
| 805 |
/** |
| 806 |
* Adds help tabs. |
| 807 |
* |
| 808 |
* @since 1.0.0 |
| 809 |
* @deprecated 2.0.0 |
| 810 |
* @access public |
| 811 |
* @return void |
| 812 |
*/ |
| 813 |
public function add_help_tabs() {} |
| 814 |
} |
| 815 |
|
| 816 |
Settings_Page::get_instance(); |
| 817 |
|