Astra_Addon_Admin_Loader::styles_scripts()
Enqueues the needed CSS/JS for the builder’s admin settings page.
Description
Source
File: admin/core/class-astra-addon-admin-loader.php
public function styles_scripts() {
if ( is_customize_preview() ) {
return;
}
$handle = 'astra-addon-admin-dashboard-app';
$build_path = ASTRA_ADDON_ADMIN_DIR . 'assets/build/';
$build_url = ASTRA_ADDON_ADMIN_URL . 'assets/build/';
$script_asset_path = $build_path . 'dashboard-app.asset.php';
$script_info = file_exists( $script_asset_path ) ? include $script_asset_path : array(
'dependencies' => array(),
'version' => ASTRA_EXT_VER,
);
$script_dep = $script_info['dependencies'];
wp_register_script(
$handle,
$build_url . 'dashboard-app.js',
$script_dep,
$script_info['version'],
true
);
wp_register_style(
$handle,
ASTRA_ADDON_ADMIN_URL . 'assets/css/admin-custom.css',
array(),
ASTRA_EXT_VER
);
wp_enqueue_script( $handle );
wp_set_script_translations( $handle, 'astra-addon' );
wp_enqueue_style( $handle );
wp_style_add_data( $handle, 'rtl', 'replace' );
$product_id = ASTRA_ADDON_BSF_PACKAGE ? bsf_extract_product_id( ASTRA_EXT_DIR ) : '';
$white_label_markup_instance = Astra_Ext_White_Label_Markup::get_instance();
$rollback_version = isset( self::astra_get_rollback_versions( 'astra-addon' )[0] ) ? self::astra_get_rollback_versions( 'astra-addon' )[0] : ''; // phpcs:ignore PHPCompatibility.Syntax.NewFunctionArrayDereferencing.Found
$localize = array(
'theme_versions' => self::astra_get_rollback_versions(),
'addon_versions' => self::astra_get_rollback_versions( 'astra-addon' ),
'addon_rollback_nonce_url' => esc_url( add_query_arg( 'version_no', $rollback_version, wp_nonce_url( admin_url( 'index.php?action=bsf_rollback&product_id=' . $product_id ), 'bsf_rollback' ) ) ),
'addon_rollback_nonce_placeholder_url' => esc_url( wp_nonce_url( admin_url( 'index.php?action=bsf_rollback&version_no=VERSION&product_id=' . $product_id ), 'bsf_rollback' ) ),
'astra_pro_changelog_data' => self::astra_get_addon_changelog_feed_data(),
'addon_name' => astra_get_addon_name(),
'rollback_theme_name' => 'astra',
'rollback_plugin_name' => 'astra-addon',
'theme_rollback_url' => esc_url( admin_url() . 'index.php?action=astra-rollback&version_no=VERSION&_wpnonce=' . wp_create_nonce( 'astra_rollback' ) ),
'addon_rollback_url' => esc_url( admin_url() . 'index.php?action=bsf_rollback&version_no=VERSION&product_id=astra-addon&_wpnonce=' . wp_create_nonce( 'bsf_rollback' ) ),
'license_status' => ASTRA_ADDON_BSF_PACKAGE ? BSF_License_Manager::bsf_is_active_license( $product_id ) : false,
'product' => 'astra-addon',
'bsf_graupi_nonce' => wp_create_nonce( 'bsf_license_activation_deactivation_nonce' ),
'update_nonce' => wp_create_nonce( 'astra_addon_update_admin_setting' ),
'enable_beta' => Astra_Admin_Helper::get_admin_settings_option( '_astra_beta_updates', true, 'disable' ),
'enable_file_generation' => get_option( '_astra_file_generation', 'disable' ),
'pro_extensions' => Astra_Ext_Extension::get_enabled_addons(),
'show_self_branding' => Astra_Ext_White_Label_Markup::show_branding(),
'plugin_description' => $white_label_markup_instance->astra_pro_whitelabel_description(),
'plugin_name' => $white_label_markup_instance->astra_pro_whitelabel_name(),
'theme_screenshot_url' => $white_label_markup_instance::get_whitelabel_string( 'astra', 'screenshot', false ),
'theme_description' => $white_label_markup_instance::get_whitelabel_string( 'astra', 'description', false ),
'theme_name' => $white_label_markup_instance::get_whitelabel_string( 'astra', 'name', false ),
'agency_license_link' => $white_label_markup_instance::get_whitelabel_string( 'astra-agency', 'licence', false ),
'agency_author_url' => $white_label_markup_instance->astra_pro_whitelabel_author_url(),
'agency_author_name' => $white_label_markup_instance->astra_pro_whitelabel_author(),
'theme_icon_url' => $white_label_markup_instance::get_whitelabel_string( 'astra', 'icon', false ),
'st_plugin_name' => $white_label_markup_instance::get_whitelabel_string( 'astra-sites', 'name', false ),
'st_plugin_description' => $white_label_markup_instance::get_whitelabel_string( 'astra-sites', 'description', false ),
'rest_api' => get_rest_url( '', 'astra/v1/admin/settings' ),
'is_bsf_package' => ASTRA_ADDON_BSF_PACKAGE,
);
wp_localize_script( $handle, 'astra_addon_admin', apply_filters( 'astra_addon_react_admin_localize', $localize ) );
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.0.0 | Introduced. |