Use new code style

This commit is contained in:
David Stone
2025-02-07 19:02:33 -07:00
parent 0181024ae1
commit 8433379d90
672 changed files with 37107 additions and 45249 deletions

View File

@ -12,7 +12,7 @@ namespace WP_Ultimo\Admin_Pages\Customer_Panel;
// Exit if accessed directly
defined('ABSPATH') || exit;
use \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
use WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
/**
* WP Multisite WaaS My_Account Admin Page.
@ -103,12 +103,9 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
$this->register_page_settings();
if ($this->current_site->get_type() === 'customer_owned') {
parent::__construct();
} // end if;
} // end __construct;
}
}
/**
* Loads the current site and membership.
@ -123,8 +120,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
$this->current_membership = $this->current_site->get_membership();
$this->add_notices();
} // end page_loaded;
}
/**
* Adds notices after a membership is changed.
@ -139,16 +135,13 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
$update_type = wu_request('updated');
if (empty($update_type)) {
return;
} // end if;
}
$update_message = apply_filters('wu_account_update_message', __('Your account was successfully updated.', 'wp-ultimo'), $update_type);
WP_Ultimo()->notices->add($update_message);
} // end add_notices;
}
/**
* Allow child classes to add hooks to be run once the page is loaded.
@ -157,7 +150,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
public function hooks() {} // end hooks;
public function hooks() {}
/**
* Allow child classes to add screen options; Useful for pages that have list tables.
@ -165,7 +158,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
public function screen_options() {} // end screen_options;
public function screen_options() {}
/**
* Allow child classes to register widgets, if they need them.
@ -194,8 +187,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
\WP_Ultimo\UI\Current_Site_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes', array('show_admin_link' => false));
} // end register_widgets;
}
/**
* Returns the title of the page.
@ -206,8 +198,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_title() {
return __('Account', 'wp-ultimo');
} // end get_title;
}
/**
* Returns the title of menu for this page.
@ -218,8 +209,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_menu_title() {
return __('Account', 'wp-ultimo');
} // end get_menu_title;
}
/**
* Allows admins to rename the sub-menu (first item) for a top-level page.
@ -230,8 +220,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_submenu_title() {
return __('Account', 'wp-ultimo');
} // end get_submenu_title;
}
/**
* Every child class should implement the output method to display the contents of the page.
@ -243,12 +232,13 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template('base/dash', array(
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
));
} // end output;
} // end class Account_Admin_Page;
wu_get_template(
'base/dash',
array(
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
)
);
}
}

View File

@ -12,7 +12,7 @@ namespace WP_Ultimo\Admin_Pages\Customer_Panel;
// Exit if accessed directly
defined('ABSPATH') || exit;
use \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
use WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
/**
* WP Multisite WaaS Add New Site Admin Page.
@ -20,10 +20,10 @@ use \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
/**
* Holds the ID for this page, this is also used as the page slug.
*
* @var string
*/
* Holds the ID for this page, this is also used as the page slug.
*
* @var string
*/
protected $id = 'add-new-site';
/**
@ -127,12 +127,9 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
$this->register_page_settings();
if ($this->current_site->get_type() === 'customer_owned') {
parent::__construct();
} // end if;
} // end __construct;
}
}
/**
* Loads the current site and membership.
@ -143,8 +140,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function page_loaded() {
$this->customer = wu_get_current_customer();
} // end page_loaded;
}
/**
* Allow child classes to add hooks to be run once the page is loaded.
@ -153,7 +149,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
public function hooks() {} // end hooks;
public function hooks() {}
/**
* Force the screen options so our customize options show up.
@ -164,18 +160,18 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function force_screen_options() {
if (get_current_screen()->id !== 'toplevel_page_sites') {
return;
} // end if;
}
// Forces Screen options so we can add our links.
add_screen_option('wu_fix', array(
'option' => 'test',
'value' => true,
));
} // end force_screen_options;
add_screen_option(
'wu_fix',
array(
'option' => 'test',
'value' => true,
)
);
}
/**
* Allow child classes to add screen options; Useful for pages that have list tables.
@ -183,7 +179,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
public function screen_options() {} // end screen_options;
public function screen_options() {}
/**
* Allow child classes to register widgets, if they need them.
@ -195,12 +191,15 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
\WP_Ultimo\UI\Checkout_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes', array(
'slug' => 'wu-add-new-site',
'membership_limitations' => array('sites'),
));
} // end register_widgets;
\WP_Ultimo\UI\Checkout_Element::get_instance()->as_inline_content(
get_current_screen()->id,
'wu_dash_before_metaboxes',
array(
'slug' => 'wu-add-new-site',
'membership_limitations' => array('sites'),
)
);
}
/**
* Returns the title of the page.
@ -211,8 +210,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_title() {
return __('Add New Site', 'wp-ultimo');
} // end get_title;
}
/**
* Returns the title of menu for this page.
@ -223,8 +221,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_menu_title() {
return __('Add New Site', 'wp-ultimo');
} // end get_menu_title;
}
/**
* Allows admins to rename the sub-menu (first item) for a top-level page.
@ -235,8 +232,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_submenu_title() {
return __('Add New Site', 'wp-ultimo');
} // end get_submenu_title;
}
/**
* Every child class should implement the output method to display the contents of the page.
@ -248,12 +244,13 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template('base/dash', array(
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
));
} // end output;
} // end class Add_New_Site_Admin_Page;
wu_get_template(
'base/dash',
array(
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
)
);
}
}

View File

@ -96,8 +96,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
public function get_title() {
return sprintf(__('Checkout', 'wp-ultimo'));
} // end get_title;
}
/**
* Returns the title of menu for this page.
@ -108,8 +107,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
public function get_menu_title() {
return __('Checkout', 'wp-ultimo');
} // end get_menu_title;
}
/**
* Registers the necessary scripts.
@ -120,8 +118,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
public function register_scripts() {
do_action('wu_checkout_scripts', null, null);
} // end register_scripts;
}
/**
* Overrides the page loaded method.
@ -134,8 +131,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
do_action('wu_setup_checkout', null);
parent::page_loaded();
} // end page_loaded;
}
/**
* Returns the sections for this Wizard.
@ -153,8 +149,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
);
return $sections;
} // end get_sections;
}
/**
* Displays the content of the activation section.
@ -166,13 +161,15 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
/*
* 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;
wu_get_template(
'base/centered',
array(
'screen' => get_current_screen(),
'page' => $this,
'content' => do_shortcode('[wu_checkout slug="wu-checkout"]'),
)
);
}
/**
* Allow child classes to register widgets, if they need them.
@ -185,7 +182,5 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
\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;
}
}

View File

@ -12,7 +12,7 @@ namespace WP_Ultimo\Admin_Pages\Customer_Panel;
// Exit if accessed directly
defined('ABSPATH') || exit;
use \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
use WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
/**
* WP Multisite WaaS My Sites Admin Page.
@ -20,10 +20,10 @@ use \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Admin_Page;
class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
/**
* Holds the ID for this page, this is also used as the page slug.
*
* @var string
*/
* Holds the ID for this page, this is also used as the page slug.
*
* @var string
*/
protected $id = 'sites';
/**
@ -111,7 +111,6 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
$this->register_page_settings();
if ($this->current_site->get_type() === 'customer_owned') {
parent::__construct();
add_action('admin_menu', array($this, 'unset_default_my_sites_menu'));
@ -119,10 +118,8 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
add_action('admin_bar_menu', array($this, 'change_my_sites_link'), 90);
add_action('current_screen', array($this, 'force_screen_options'));
} // end if;
} // end __construct;
}
}
/**
* Loads the current site and membership.
@ -133,8 +130,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function page_loaded() {
$this->customer = wu_get_current_customer();
} // end page_loaded;
}
/**
* Allow child classes to add hooks to be run once the page is loaded.
@ -143,7 +139,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
public function hooks() {} // end hooks;
public function hooks() {}
/**
* Remove the default my sites link.
@ -156,8 +152,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
global $submenu;
unset($submenu['index.php'][5]);
} // end unset_default_my_sites_menu;
}
/**
* Update the my sites link on the top-bar.
@ -172,10 +167,8 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
$my_sites = $wp_admin_bar->get_node('my-sites');
if (empty($my_sites)) {
return;
} // end if;
}
$args = array(
'page' => 'sites',
@ -184,8 +177,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
$my_sites->href = add_query_arg($args, admin_url('admin.php'));
$wp_admin_bar->add_node($my_sites);
} // end change_my_sites_link;
}
/**
* Force the screen options so our customize options show up.
@ -196,18 +188,18 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function force_screen_options() {
if (get_current_screen()->id !== 'toplevel_page_sites') {
return;
} // end if;
}
// Forces Screen options so we can add our links.
add_screen_option('wu_fix', array(
'option' => 'test',
'value' => true,
));
} // end force_screen_options;
add_screen_option(
'wu_fix',
array(
'option' => 'test',
'value' => true,
)
);
}
/**
* Allow child classes to add screen options; Useful for pages that have list tables.
@ -215,7 +207,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
public function screen_options() {} // end screen_options;
public function screen_options() {}
/**
* Allow child classes to register widgets, if they need them.
@ -230,8 +222,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
\WP_Ultimo\UI\My_Sites_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
} // end register_widgets;
}
/**
* Returns the title of the page.
@ -242,8 +233,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_title() {
return __('My Sites', 'wp-ultimo');
} // end get_title;
}
/**
* Returns the title of menu for this page.
@ -254,8 +244,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_menu_title() {
return __('My Sites', 'wp-ultimo');
} // end get_menu_title;
}
/**
* Allows admins to rename the sub-menu (first item) for a top-level page.
@ -266,8 +255,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
public function get_submenu_title() {
return __('My Sites', 'wp-ultimo');
} // end get_submenu_title;
}
/**
* Every child class should implement the output method to display the contents of the page.
@ -279,12 +267,13 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template('base/dash', array(
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
));
} // end output;
} // end class My_Sites_Admin_Page;
wu_get_template(
'base/dash',
array(
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
)
);
}
}

View File

@ -104,8 +104,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
public function get_title() {
return __('Switch Template', 'wp-ultimo');
} // end get_title;
}
/**
* Returns the title of menu for this page.
@ -116,8 +115,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
public function get_menu_title() {
return __('Switch Template', 'wp-ultimo');
} // end get_menu_title;
}
/**
* Registers the necessary scripts.
@ -128,8 +126,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
public function register_scripts() {
do_action('wu_template_switching_admin_page_scripts', null, null);
} // end register_scripts;
}
/**
* Overrides the page loaded method.
@ -142,8 +139,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
do_action('wu_template_switching_admin_page', null);
parent::page_loaded();
} // end page_loaded;
}
/**
* Displays the content of the activation section.
@ -155,16 +151,18 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
/*
* 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' => '',
'labels' => array(
'updated_message' => __('Template switched successfully!', 'wp-ultimo')
wu_get_template(
'base/centered',
array(
'screen' => get_current_screen(),
'page' => $this,
'content' => '',
'labels' => array(
'updated_message' => __('Template switched successfully!', 'wp-ultimo'),
),
)
));
} // end output;
);
}
/**
* Allow child classes to register widgets, if they need them.
@ -175,7 +173,5 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
public function register_widgets() {
\WP_Ultimo\UI\Template_Switching_Element::get_instance()->as_metabox(get_current_screen()->id);
} // end register_widgets;
} // end class Template_Switching_Admin_Page;
}
}