Astra_Get_Performance::execute( array $args )

Execute the ability.


Description


Parameters

$args

(array) (Required) Input arguments.


Return

(array) Result array.


Source

File: inc/abilities/admin/settings/performance/class-astra-get-performance.php

	public function execute( $args ) {
		if ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) {
			return Astra_Abilities_Response::error(
				__( 'Astra theme is not active.', 'astra' ),
				__( 'Please activate the Astra theme to use this feature.', 'astra' )
			);
		}

		if ( ! class_exists( 'Astra_API_Init' ) ) {
			return Astra_Abilities_Response::error(
				__( 'Astra API not available.', 'astra' ),
				__( 'Please ensure Astra theme is properly loaded.', 'astra' )
			);
		}

		$load_fonts_locally  = Astra_API_Init::get_admin_settings_option( 'self_hosted_gfonts', false );
		$preload_local_fonts = Astra_API_Init::get_admin_settings_option( 'preload_local_fonts', false );

		return Astra_Abilities_Response::success(
			__( 'Retrieved performance settings successfully.', 'astra' ),
			array(
				'load_google_fonts_locally'       => (bool) $load_fonts_locally,
				'load_google_fonts_locally_label' => $load_fonts_locally ? 'Enabled' : 'Disabled',
				'preload_local_fonts'             => (bool) $preload_local_fonts,
				'preload_local_fonts_label'       => $preload_local_fonts ? 'Enabled' : 'Disabled',
				'preload_local_fonts_available'   => (bool) $load_fonts_locally,
			)
		);
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.