refactor: run Rector NAMING setlist

This commit is contained in:
Ben Goldsworthy 2021-05-02 21:04:31 +01:00
parent c60f6265c1
commit 667d8dada9
4 changed files with 27 additions and 27 deletions

View file

@ -43,7 +43,7 @@ class Init {
*
* @since 1.5.0
*/
private Settings $settings_page;
private Settings $settings;
/**
* Initializes all WordPress hooks for the Plugin Settings.
@ -64,7 +64,7 @@ class Init {
) {
$this->load_dependencies();
$this->settings_page = new Settings( $this->plugin_name );
$this->settings = new Settings( $this->plugin_name );
// Register hooks/actions.
add_action(
@ -123,7 +123,7 @@ class Init {
*/
public function initialize_settings(): void {
Includes\Settings::instance()->register_settings();
$this->settings_page->register_sections();
$this->settings->register_sections();
}
/**
@ -139,9 +139,9 @@ class Init {
\footnotes\includes\Config::PLUGIN_PUBLIC_NAME,
'manage_options',
self::MAIN_MENU_SLUG,
fn() => $this->settings_page->display_content()
fn() => $this->settings->display_content()
);
$this->settings_page->register_sub_page();
$this->settings->register_sub_page();
}
// phpcs:disable WordPress.Security.NonceVerification.Missing

View file

@ -1231,7 +1231,7 @@ class Settings extends Engine {
* @todo Review in light of admin/public split.
*/
public function help(): void {
$footnotes = new General\General( $this->plugin_name, 'foo' );
$general = new General\General( $this->plugin_name, 'foo' );
// Load footnotes starting and end tag.
$footnote_starting_tag = $this->load_setting( \footnotes\includes\Settings::FOOTNOTES_SHORT_CODE_START );
@ -1268,7 +1268,7 @@ class Settings extends Engine {
'end' => $footnote_ending_tag['value'],
'example-code' => $example,
'example-string' => '<br/>' . __( 'will be displayed as:', 'footnotes' ),
'example' => $footnotes->task->exec( $example, true ),
'example' => $general->task->exec( $example, true ),
// Translators: %1$s, %2$s: anchor element with hyperlink to the Support Forum.
'information' => sprintf( __( 'For further information please check out our %1$sSupport Forum%2$s on WordPress.org.', 'footnotes' ), '<a href="https://wordpress.org/support/plugin/footnotes" target="_blank" class="footnote_plugin">', '</a>' ),
)
@ -1282,7 +1282,7 @@ class Settings extends Engine {
* the name of the filtered function.
* When this callback function was renamed, this call went unnoticed.
*/
$footnotes->task->footnotes_output_head();
$general->task->footnotes_output_head();
// Display template with replaced placeholders.
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped

View file

@ -168,9 +168,9 @@ class Core {
*/
private function set_locale() {
$plugin_i18n = new i18n();
$i18n = new i18n();
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
$this->loader->add_action( 'plugins_loaded', $i18n, 'load_plugin_textdomain' );
}
@ -186,23 +186,23 @@ class Core {
*/
private function define_admin_hooks() {
$plugin_admin = new Admin\Admin( $this->get_plugin_name(), $this->get_version() );
$admin = new Admin\Admin( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
$this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_scripts' );
$this->loader->add_filter( 'plugin_action_links_footnotes/footnotes.php', $plugin_admin, 'action_links' );
$this->loader->add_filter( 'plugin_action_links_footnotes/footnotes.php', $admin, 'action_links' );
$this->loader->add_filter( 'mce_buttons', $plugin_admin->wysiwyg, 'new_visual_editor_button' );
$this->loader->add_action( 'admin_print_footer_scripts', $plugin_admin->wysiwyg, 'new_plain_text_editor_button' );
$this->loader->add_filter( 'mce_buttons', $admin->wysiwyg, 'new_visual_editor_button' );
$this->loader->add_action( 'admin_print_footer_scripts', $admin->wysiwyg, 'new_plain_text_editor_button' );
$this->loader->add_filter( 'mce_external_plugins', $plugin_admin->wysiwyg, 'include_scripts' );
$this->loader->add_filter( 'mce_external_plugins', $admin->wysiwyg, 'include_scripts' );
// phpcs:disable
// 'footnotes_getTags' must match its instance in wysiwyg-editor.js.
// 'footnotes_getTags' must match its instance in editor-button.html.
$this->loader->add_action( 'wp_ajax_nopriv_footnotes_getTags', $plugin_admin->wysiwyg, 'ajax_callback' );
$this->loader->add_action( 'wp_ajax_footnotes_getTags', $plugin_admin->wysiwyg, 'ajax_callback' );
$this->loader->add_action( 'wp_ajax_nopriv_footnotes_getTags', $admin->wysiwyg, 'ajax_callback' );
$this->loader->add_action( 'wp_ajax_footnotes_getTags', $admin->wysiwyg, 'ajax_callback' );
// phpcs:enable
}
@ -217,12 +217,12 @@ class Core {
*/
private function define_public_hooks() {
$plugin_public = new General\General( $this->get_plugin_name(), $this->get_version() );
$general = new General\General( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
$this->loader->add_action( 'wp_enqueue_scripts', $general, 'enqueue_styles' );
$this->loader->add_action( 'wp_enqueue_scripts', $general, 'enqueue_scripts' );
$this->loader->add_action( 'widgets_init', $plugin_public, 'register_widgets' );
$this->loader->add_action( 'widgets_init', $general, 'register_widgets' );
}
/**

View file

@ -137,12 +137,12 @@ class Loader {
*/
public function run() {
foreach ( $this->filters as $hook ) {
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
foreach ( $this->filters as $filter ) {
add_filter( $filter['hook'], array( $filter['component'], $filter['callback'] ), $filter['priority'], $filter['accepted_args'] );
}
foreach ( $this->actions as $hook ) {
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
foreach ( $this->actions as $action ) {
add_action( $action['hook'], array( $action['component'], $action['callback'] ), $action['priority'], $action['accepted_args'] );
}
}