Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -68,10 +68,10 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'admin_menu' => 'exist',
|
||||
'user_admin_menu' => 'exist',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* The current site instance.
|
||||
@ -113,7 +113,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
$this->current_site = wu_get_current_site();
|
||||
|
||||
@ -166,7 +166,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Current_Membership_Element::get_instance()->as_metabox(get_current_screen()->id);
|
||||
|
||||
@ -186,7 +186,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));
|
||||
\WP_Ultimo\UI\Current_Site_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes', ['show_admin_link' => false]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,17 +228,17 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* 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,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -84,10 +84,10 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'admin_menu' => 'exist',
|
||||
'user_admin_menu' => 'exist',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* The current customer instance.
|
||||
@ -137,7 +137,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
$this->customer = wu_get_current_customer();
|
||||
}
|
||||
@ -157,7 +157,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function force_screen_options() {
|
||||
public function force_screen_options(): void {
|
||||
|
||||
if (get_current_screen()->id !== 'toplevel_page_sites') {
|
||||
return;
|
||||
@ -166,10 +166,10 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
// Forces Screen options so we can add our links.
|
||||
add_screen_option(
|
||||
'wu_fix',
|
||||
array(
|
||||
[
|
||||
'option' => 'test',
|
||||
'value' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -187,17 +187,17 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\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'),
|
||||
)
|
||||
'membership_limitations' => ['sites'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -240,17 +240,17 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* 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,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'user_admin_menu' => 'read',
|
||||
'admin_menu' => 'read',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Should we hide admin notices on this page?
|
||||
@ -115,7 +115,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
do_action('wu_checkout_scripts', null, null);
|
||||
}
|
||||
@ -126,7 +126,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
do_action('wu_setup_checkout', null);
|
||||
|
||||
@ -141,12 +141,12 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
*/
|
||||
public function get_sections() {
|
||||
|
||||
$sections = array(
|
||||
'plan' => array(
|
||||
$sections = [
|
||||
'plan' => [
|
||||
'title' => __('Change Membership', 'wp-ultimo'),
|
||||
'view' => array($this, 'display_checkout_form'),
|
||||
),
|
||||
);
|
||||
'view' => [$this, 'display_checkout_form'],
|
||||
],
|
||||
];
|
||||
|
||||
return $sections;
|
||||
}
|
||||
@ -157,17 +157,17 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* 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"]'),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Current_Membership_Element::get_instance()->as_metabox(get_current_screen()->id);
|
||||
|
||||
|
@ -68,10 +68,10 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'admin_menu' => 'exist',
|
||||
'user_admin_menu' => 'exist',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* The current customer instance.
|
||||
@ -113,11 +113,11 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
if ($this->current_site->get_type() === 'customer_owned') {
|
||||
parent::__construct();
|
||||
|
||||
add_action('admin_menu', array($this, 'unset_default_my_sites_menu'));
|
||||
add_action('admin_menu', [$this, 'unset_default_my_sites_menu']);
|
||||
|
||||
add_action('admin_bar_menu', array($this, 'change_my_sites_link'), 90);
|
||||
add_action('admin_bar_menu', [$this, 'change_my_sites_link'], 90);
|
||||
|
||||
add_action('current_screen', array($this, 'force_screen_options'));
|
||||
add_action('current_screen', [$this, 'force_screen_options']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
$this->customer = wu_get_current_customer();
|
||||
}
|
||||
@ -147,7 +147,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function unset_default_my_sites_menu() {
|
||||
public function unset_default_my_sites_menu(): void {
|
||||
|
||||
global $submenu;
|
||||
|
||||
@ -162,7 +162,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @param object $wp_admin_bar The admin bar object.
|
||||
* @return void
|
||||
*/
|
||||
public function change_my_sites_link($wp_admin_bar) {
|
||||
public function change_my_sites_link($wp_admin_bar): void {
|
||||
|
||||
$my_sites = $wp_admin_bar->get_node('my-sites');
|
||||
|
||||
@ -170,9 +170,9 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
return;
|
||||
}
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'page' => 'sites',
|
||||
);
|
||||
];
|
||||
|
||||
$my_sites->href = add_query_arg($args, admin_url('admin.php'));
|
||||
|
||||
@ -185,7 +185,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function force_screen_options() {
|
||||
public function force_screen_options(): void {
|
||||
|
||||
if (get_current_screen()->id !== 'toplevel_page_sites') {
|
||||
return;
|
||||
@ -194,10 +194,10 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
// Forces Screen options so we can add our links.
|
||||
add_screen_option(
|
||||
'wu_fix',
|
||||
array(
|
||||
[
|
||||
'option' => 'test',
|
||||
'value' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Login_Form_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
|
||||
|
||||
@ -263,17 +263,17 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* 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,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'user_admin_menu' => 'read',
|
||||
'admin_menu' => 'read',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Should we hide admin notices on this page?
|
||||
@ -123,7 +123,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
do_action('wu_template_switching_admin_page_scripts', null, null);
|
||||
}
|
||||
@ -134,7 +134,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
do_action('wu_template_switching_admin_page', null);
|
||||
|
||||
@ -147,20 +147,20 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* 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(
|
||||
'labels' => [
|
||||
'updated_message' => __('Template switched successfully!', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Template_Switching_Element::get_instance()->as_metabox(get_current_screen()->id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user