Initial Commit
This commit is contained in:
191
inc/admin-pages/customer-panel/class-checkout-admin-page.php
Normal file
191
inc/admin-pages/customer-panel/class-checkout-admin-page.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Ultimo Customer Checkout Admin Page.
|
||||
*
|
||||
* @package WP_Ultimo
|
||||
* @subpackage Admin_Pages
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
namespace WP_Ultimo\Admin_Pages\Customer_Panel;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* WP Ultimo Dashboard Admin Page.
|
||||
*/
|
||||
class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page {
|
||||
|
||||
/**
|
||||
* Holds the ID for this page, this is also used as the page slug.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id = 'wu-checkout';
|
||||
|
||||
/**
|
||||
* Is this a top-level menu or a submenu?
|
||||
*
|
||||
* @since 1.8.2
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'submenu';
|
||||
|
||||
/**
|
||||
* Is this a top-level menu or a submenu?
|
||||
*
|
||||
* @since 1.8.2
|
||||
* @var string
|
||||
*/
|
||||
protected $parent = 'none';
|
||||
|
||||
/**
|
||||
* This page has no parent, so we need to highlight another sub-menu.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $highlight_menu_slug = 'account';
|
||||
|
||||
/**
|
||||
* If this number is greater than 0, a badge with the number will be displayed alongside the menu title
|
||||
*
|
||||
* @since 1.8.2
|
||||
* @var integer
|
||||
*/
|
||||
protected $badge_count = 0;
|
||||
|
||||
/**
|
||||
* Holds the admin panels where this page should be displayed, as well as which capability to require.
|
||||
*
|
||||
* To add a page to the regular admin (wp-admin/), use: 'admin_menu' => 'capability_here'
|
||||
* To add a page to the network admin (wp-admin/network), use: 'network_admin_menu' => 'capability_here'
|
||||
* To add a page to the user (wp-admin/user) admin, use: 'user_admin_menu' => 'capability_here'
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
'user_admin_menu' => 'read',
|
||||
'admin_menu' => 'read',
|
||||
);
|
||||
|
||||
/**
|
||||
* Should we hide admin notices on this page?
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var boolean
|
||||
*/
|
||||
protected $hide_admin_notices = true;
|
||||
|
||||
/**
|
||||
* Should we force the admin menu into a folded state?
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var boolean
|
||||
*/
|
||||
protected $fold_menu = true;
|
||||
|
||||
/**
|
||||
* Returns the title of the page.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return string Title of the page.
|
||||
*/
|
||||
public function get_title() {
|
||||
|
||||
return sprintf(__('Checkout', 'wp-ultimo'));
|
||||
|
||||
} // end get_title;
|
||||
|
||||
/**
|
||||
* Returns the title of menu for this page.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return string Menu label of the page.
|
||||
*/
|
||||
public function get_menu_title() {
|
||||
|
||||
return __('Checkout', 'wp-ultimo');
|
||||
|
||||
} // end get_menu_title;
|
||||
|
||||
/**
|
||||
* Registers the necessary scripts.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
|
||||
do_action('wu_checkout_scripts', null, null);
|
||||
|
||||
} // end register_scripts;
|
||||
|
||||
/**
|
||||
* Overrides the page loaded method.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
|
||||
do_action('wu_setup_checkout', null);
|
||||
|
||||
parent::page_loaded();
|
||||
|
||||
} // end page_loaded;
|
||||
|
||||
/**
|
||||
* Returns the sections for this Wizard.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function get_sections() {
|
||||
|
||||
$sections = array(
|
||||
'plan' => array(
|
||||
'title' => __('Change Membership', 'wp-ultimo'),
|
||||
'view' => array($this, 'display_checkout_form'),
|
||||
),
|
||||
);
|
||||
|
||||
return $sections;
|
||||
|
||||
} // end get_sections;
|
||||
|
||||
/**
|
||||
* Displays the content of the activation section.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template('base/centered', array(
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'content' => do_shortcode('[wu_checkout slug="wu-checkout"]'),
|
||||
));
|
||||
|
||||
} // end output;
|
||||
|
||||
/**
|
||||
* Allow child classes to register widgets, if they need them.
|
||||
*
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
|
||||
\WP_Ultimo\UI\Current_Membership_Element::get_instance()->as_metabox(get_current_screen()->id);
|
||||
|
||||
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_centered_right');
|
||||
|
||||
} // end register_widgets;
|
||||
|
||||
} // end class Checkout_Admin_Page;
|
Reference in New Issue
Block a user