# wp-coder/3.0/classes/Admin/AdminInitializer.php

WP Coder – Insert &amp; Manage Code Snippets, version 3.0. 72 lines.

- Page: https://pluginprobe.com/plugins/wp-coder/3.0/code/classes/Admin/AdminInitializer.php
- Raw: https://pluginprobe.com/plugins/wp-coder/3.0/raw/classes/Admin/AdminInitializer.php
- Modified: 2023-08-07T12:40:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-coder/3.0/code/classes/Admin/AdminInitializer.php#L10-L20`.

```php
<?php

namespace WPCoder\Admin;

defined( 'ABSPATH' ) || exit;

// Exit if accessed directly.
use WPCoder\WOW_Plugin;

class AdminInitializer {

	public static function init(): void {
		add_filter( 'plugin_action_links', [ __CLASS__, 'settings_link' ], 10, 2 );
		add_filter( 'admin_footer_text', [ __CLASS__, 'footer_text' ] );
		add_action( 'admin_menu', [ __CLASS__, 'add_admin_page' ] );
		add_action( 'admin_enqueue_scripts', [ __CLASS__, 'admin_scripts' ] );
		new AdminNotices;
		new AdminActions;
	}

	public static function settings_link( $links, $file ) {
		if ( false === strpos( $file, WOW_Plugin::basename() ) ) {
			return $links;
		}
		$link          = admin_url( 'admin.php?page=' . WOW_Plugin::SLUG );
		$text          = esc_attr__( 'Settings', 'wpcoder' );
		$settings_link = '<a href="' . esc_url( $link ) . '">' . esc_attr( $text ) . '</a>';
		array_unshift( $links, $settings_link );

		return $links;
	}

	public static function footer_text( $footer_text ) {
		global $pagenow;

		if ( $pagenow === 'admin.php' && ( isset( $_GET['page'] ) && $_GET['page'] === WOW_Plugin::SLUG ) ) {
			$text = sprintf(
				__( 'Thank you for using <b>%2$s</b>! Please <a href="%1$s" target="_blank">rate us</a>', 'wpcoder' ),
				esc_url( WOW_Plugin::PluginURL ),
				esc_attr( WOW_Plugin::NAME )
			);

			return str_replace( '</span>', '', $footer_text ) . ' | ' . $text . '</span>';
		}

		return $footer_text;
	}

	public static function add_admin_page(): void {
		$parent     = 'wow-company';
		$title      = WOW_Plugin::NAME . ' version ' . WOW_Plugin::VERSION;
		$menu_title = WOW_Plugin::NAME;
		$capability = 'manage_options';
		$slug       = WOW_Plugin::SLUG;
		add_submenu_page( $parent, $title, $menu_title, $capability, $slug, [ __CLASS__, 'plugin_page' ] );
	}

	public static function plugin_page(): void {
		do_action( WOW_Plugin::PREFIX . '_admin_page' );
	}

	public static function admin_scripts( $hook ): void {
		$page = 'wow-plugins_page_' . WOW_Plugin::SLUG;

		if ( $page !== $hook ) {
			return;
		}

		do_action( WOW_Plugin::PREFIX . '_admin_load_styles_scripts' );
	}

}
```
