WPSEO_Admin::__construct()publicYoast 1.0

Class constructor.

Метод класса: WPSEO_Admin{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPSEO_Admin = new WPSEO_Admin();
$WPSEO_Admin->__construct();

Код WPSEO_Admin::__construct() Yoast 22.4

public function __construct() {
	$integrations = [];

	global $pagenow;

	$wpseo_menu = new WPSEO_Menu();
	$wpseo_menu->register_hooks();

	if ( is_multisite() ) {
		WPSEO_Options::maybe_set_multisite_defaults( false );
	}

	if ( WPSEO_Options::get( 'stripcategorybase' ) === true ) {
		add_action( 'created_category', [ $this, 'schedule_rewrite_flush' ] );
		add_action( 'edited_category', [ $this, 'schedule_rewrite_flush' ] );
		add_action( 'delete_category', [ $this, 'schedule_rewrite_flush' ] );
	}

	if ( WPSEO_Options::get( 'disable-attachment' ) === true ) {
		add_filter( 'wpseo_accessible_post_types', [ 'WPSEO_Post_Type', 'filter_attachment_post_type' ] );
	}

	add_filter( 'plugin_action_links_' . WPSEO_BASENAME, [ $this, 'add_action_link' ], 10, 2 );
	add_filter( 'network_admin_plugin_action_links_' . WPSEO_BASENAME, [ $this, 'add_action_link' ], 10, 2 );

	add_action( 'admin_enqueue_scripts', [ $this, 'config_page_scripts' ] );
	add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_global_style' ] );

	add_filter( 'user_contactmethods', [ $this, 'update_contactmethods' ], 10, 1 );

	add_action( 'after_switch_theme', [ $this, 'switch_theme' ] );
	add_action( 'switch_theme', [ $this, 'switch_theme' ] );

	add_filter( 'set-screen-option', [ $this, 'save_bulk_edit_options' ], 10, 3 );

	add_action( 'admin_init', [ 'WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts' ], 10, 1 );

	add_action( 'admin_init', [ $this, 'map_manage_options_cap' ] );

	WPSEO_Sitemaps_Cache::register_clear_on_option_update( 'wpseo' );
	WPSEO_Sitemaps_Cache::register_clear_on_option_update( 'home' );

	if ( YoastSEO()->helpers->current_page->is_yoast_seo_page() ) {
		add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
	}

	$this->set_upsell_notice();

	$this->initialize_cornerstone_content();

	if ( WPSEO_Utils::is_plugin_network_active() ) {
		$integrations[] = new Yoast_Network_Admin();
	}

	$this->admin_features = [
		'dashboard_widget'         => new Yoast_Dashboard_Widget(),
		'wincher_dashboard_widget' => new Wincher_Dashboard_Widget(),
	];

	if ( WPSEO_Metabox::is_post_overview( $pagenow ) || WPSEO_Metabox::is_post_edit( $pagenow ) ) {
		$this->admin_features['primary_category'] = new WPSEO_Primary_Term_Admin();
	}

	$integrations[] = new WPSEO_Yoast_Columns();
	$integrations[] = new WPSEO_Statistic_Integration();
	$integrations[] = new WPSEO_Capability_Manager_Integration( WPSEO_Capability_Manager_Factory::get() );
	$integrations[] = new WPSEO_Admin_Gutenberg_Compatibility_Notification();
	$integrations[] = new WPSEO_Expose_Shortlinks();
	$integrations[] = new WPSEO_MyYoast_Proxy();
	$integrations[] = new WPSEO_Schema_Person_Upgrade_Notification();
	$integrations[] = new WPSEO_Tracking( 'https://tracking.yoast.com/stats', ( WEEK_IN_SECONDS * 2 ) );
	$integrations[] = new WPSEO_Admin_Settings_Changed_Listener();

	$integrations = array_merge(
		$integrations,
		$this->get_admin_features(),
		$this->initialize_cornerstone_content()
	);

	foreach ( $integrations as $integration ) {
		$integration->register_hooks();
	}
}