refactor: upgrade to PHP 7.4

This commit is contained in:
Ben Goldsworthy 2021-05-02 19:55:38 +01:00
parent 70c2954122
commit 4afbb94003
7 changed files with 45 additions and 101 deletions

View file

@ -49,7 +49,7 @@ abstract class Engine {
*
* @since 1.5.0
*/
protected ?string $a_str_sub_page_hook;
protected ?string $a_str_sub_page_hook = null;
/**
* Stores all Sections for the child sub-page.
@ -197,9 +197,7 @@ abstract class Engine {
$this->get_sub_page_title(),
'manage_options',
Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(),
function () {
return $this->display_content();
}
fn() => $this->display_content()
);
}
@ -215,9 +213,7 @@ abstract class Engine {
add_settings_section(
$l_arr_section['id'],
'',
function () {
return $this->description();
},
fn() => $this->description(),
$l_arr_section['id']
);
$this->register_meta_boxes( $l_arr_section['id'] );

View file

@ -73,28 +73,20 @@ class Init {
// Register hooks/actions.
add_action(
'admin_menu',
function () {
return $this->register_options_submenu();
}
fn() => $this->register_options_submenu()
);
add_action(
'admin_init',
function () {
return $this->initialize_settings();
}
fn() => $this->initialize_settings()
);
// Register AJAX callbacks for Plugin information.
add_action(
'wp_ajax_nopriv_footnotes_get_plugin_info',
function () {
return $this->get_plugin_meta_information();
}
fn() => $this->get_plugin_meta_information()
);
add_action(
'wp_ajax_footnotes_get_plugin_info',
function () {
return $this->get_plugin_meta_information();
}
fn() => $this->get_plugin_meta_information()
);
}
@ -151,9 +143,7 @@ class Init {
\footnotes\includes\Config::C_STR_PLUGIN_PUBLIC_NAME,
'manage_options',
self::C_STR_MAIN_MENU_SLUG,
function () {
return $this->settings_page->display_content();
}
fn() => $this->settings_page->display_content()
);
$this->settings_page->register_sub_page();
}