From 69c17f9c1942fd0d6a5ea941636e87723b8a6fe2 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 21 Jul 2021 16:19:29 -0500 Subject: dos2unix on all .php files, begin paring down admin page and site branding. --- inc/core/class-astra-admin-settings.php | 2385 ++++++++++++------------------- 1 file changed, 918 insertions(+), 1467 deletions(-) (limited to 'inc/core/class-astra-admin-settings.php') diff --git a/inc/core/class-astra-admin-settings.php b/inc/core/class-astra-admin-settings.php index bcdab75..c966042 100644 --- a/inc/core/class-astra-admin-settings.php +++ b/inc/core/class-astra-admin-settings.php @@ -1,1467 +1,918 @@ - 'astra-sites-on-active', - 'type' => 'info', - 'message' => sprintf( - '
-
-
-

- %2$s -

-

%3$s

- -
', - $image_path, - __( 'Thank you for installing Astra!', 'astra' ), - __( 'Did you know Astra comes with dozens of ready-to-use starter templates? Install the Starter Templates plugin to get started.', 'astra' ), - esc_attr( $ast_sites_notice_btn['class'] ), - 'href="' . astra_get_prop( $ast_sites_notice_btn, 'link', '' ) . '"', - 'data-slug="' . astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) . '"', - 'data-init="' . astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) . '"', - 'data-settings-link-text="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) . '"', - 'data-settings-link="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) . '"', - 'data-activating-text="' . astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) . '"', - esc_html( $ast_sites_notice_btn['button_text'] ) - ), - 'priority' => 5, - 'display-with-other-notices' => false, - 'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true, - ); - - Astra_Notices::add_notice( - $astra_sites_notice_args - ); - } - } - - /** - * Display notice for minimun version for Astra addon. - * - * @since 2.0.0 - */ - public static function minimum_addon_version_notice() { - - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - return; - } - - if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) { - - $message = sprintf( - /* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the addon */ - __( 'Please update the %1$1s to version %2$2s or higher. Ignore if already updated.', 'astra' ), - astra_get_addon_name(), - ASTRA_EXT_MIN_VER - ); - - $min_version = get_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', true ); - - if ( ! $min_version ) { - update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER ); - } - - if ( version_compare( $min_version, ASTRA_EXT_MIN_VER, '!=' ) ) { - delete_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice' ); - update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER ); - } - - $notice_args = array( - 'id' => 'ast-minimum-addon-version-notice', - 'type' => 'warning', - 'message' => $message, - 'show_if' => true, - 'repeat-notice-after' => false, - 'priority' => 18, - 'display-with-other-notices' => true, - ); - - Astra_Notices::add_notice( $notice_args ); - } - } - - /** - * Enqueue Astra Notices CSS. - * - * @since 2.0.0 - * - * @return void - */ - public static function notice_assets() { - if ( is_rtl() ) { - wp_enqueue_style( 'astra-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION ); - } else { - wp_enqueue_style( 'astra-notices', ASTRA_THEME_URI . 'inc/assets/css/astra-notices.css', array(), ASTRA_THEME_VERSION ); - } - } - - /** - * Render button for Astra Site notices - * - * @since 1.6.5 - * @return array $ast_sites_notice_btn Rendered button - */ - public static function astra_sites_notice_button() { - - $ast_sites_notice_btn = array(); - - // Any of the Starter Templtes plugin - Active. - if ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) || is_plugin_active( 'astra-sites/astra-sites.php' ) ) { - $ast_sites_notice_btn['class'] = 'active'; - $ast_sites_notice_btn['button_text'] = __( 'See Library »', 'astra' ); - $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); - - return $ast_sites_notice_btn; - } - - // Starter Templates PRO Plugin - Installed but Inactive. - if ( file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { - $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin'; - $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' ); - $ast_sites_notice_btn['data_slug'] = 'astra-pro-sites'; - $ast_sites_notice_btn['data_init'] = '/astra-pro-sites/astra-pro-sites.php'; - $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); - $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); - $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…'; - - return $ast_sites_notice_btn; - } - - // Starter Templates FREE Plugin - Installed but Inactive. - if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) ) { - $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin'; - $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' ); - $ast_sites_notice_btn['data_slug'] = 'astra-sites'; - $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php'; - $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); - $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); - $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…'; - - return $ast_sites_notice_btn; - } - - // Any of the Starter Templates plugin not available. - if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) || ! file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) ) { - $ast_sites_notice_btn['class'] = 'astra-install-recommended-plugin'; - $ast_sites_notice_btn['button_text'] = __( 'Install Importer Plugin', 'astra' ); - $ast_sites_notice_btn['data_slug'] = 'astra-sites'; - $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php'; - $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); - $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); - $ast_sites_notice_btn['detail_link_class'] = 'plugin-detail thickbox open-plugin-details-modal astra-starter-sites-detail-link'; - $ast_sites_notice_btn['detail_link'] = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=astra-sites&TB_iframe=true&width=772&height=400' ); - $ast_sites_notice_btn['detail_link_text'] = __( 'Details »', 'astra' ); - - return $ast_sites_notice_btn; - } - - $ast_sites_notice_btn['class'] = 'active'; - $ast_sites_notice_btn['button_text'] = __( 'See Library »', 'astra' ); - $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); - - return $ast_sites_notice_btn; - } - - /** - * Check if installed Starter Sites plugin is new. - * - * @since 2.3.2 - */ - public static function get_starter_templates_slug() { - - if ( defined( 'ASTRA_PRO_SITES_VER' ) && version_compare( ASTRA_PRO_SITES_VER, '2.0.0', '>=' ) ) { - self::$starter_templates_slug = 'starter-templates'; - } - - if ( defined( 'ASTRA_SITES_VER' ) && version_compare( ASTRA_SITES_VER, '2.0.0', '>=' ) ) { - self::$starter_templates_slug = 'starter-templates'; - } - } - - /** - * Load the scripts and styles in the customizer controls. - * - * @since 1.2.1 - */ - public static function customizer_scripts() { - $color_palettes = wp_json_encode( astra_color_palette() ); - wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $color_palettes . ';' ); - } - - /** - * Register admin scripts. - * - * @param String $hook Screen name where the hook is fired. - * @return void - */ - public static function register_scripts( $hook ) { - - if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) { - $post_types = get_post_types( array( 'public' => true ) ); - $screen = get_current_screen(); - $post_type = $screen->id; - - if ( in_array( $post_type, (array) $post_types ) ) { - - echo ''; - } - } - /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */ - - if ( ! is_customize_preview() ) { - - if ( ! current_user_can( 'manage_options' ) ) { - return; - } - - wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); - - $localize = array( - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), - 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', - 'astraSitesLink' => admin_url( 'themes.php?page=' ), - 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), - 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', - 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', - 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), - 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), - 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), - 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), - ); - - wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); - } - } - - /** - * Enqueues the needed CSS/JS for the builder's admin settings page. - * - * @since 1.0 - */ - public static function styles_scripts() { - - // Styles. - if ( is_rtl() ) { - wp_enqueue_style( 'astra-admin-settings-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings-rtl.css', array(), ASTRA_THEME_VERSION ); - } else { - wp_enqueue_style( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings.css', array(), ASTRA_THEME_VERSION ); - } - - if ( ! current_user_can( 'manage_options' ) ) { - return; - } - - wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); - - $localize = array( - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), - 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', - 'astraSitesLink' => admin_url( 'themes.php?page=' ), - 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), - 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', - 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', - 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), - 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), - 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), - 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), - 'ajax_nonce' => wp_create_nonce( 'astra-builder-module-nonce' ), - 'old_header_footer' => __( 'Use Old Header/Footer', 'astra' ), - 'migrate_to_builder' => __( 'Use New Header/Footer Builder', 'astra' ), - ); - wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); - - // Script. - wp_enqueue_script( 'astra-admin-settings' ); - - if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { - // For starter site plugin popup detail "Details »" on Astra Options page. - wp_enqueue_script( 'plugin-install' ); - wp_enqueue_script( 'thickbox' ); - wp_enqueue_style( 'thickbox' ); - } - } - - - /** - * Get and return page URL - * - * @param string $menu_slug Menu name. - * @since 1.0 - * @return string page url - */ - public static function get_page_url( $menu_slug ) { - - $parent_page = self::$default_menu_position; - - if ( strpos( $parent_page, '?' ) !== false ) { - $query_var = '&page=' . self::$plugin_slug; - } else { - $query_var = '?page=' . self::$plugin_slug; - } - - $parent_page_url = admin_url( $parent_page . $query_var ); - - $url = $parent_page_url . '&action=' . $menu_slug; - - return esc_url( $url ); - } - - /** - * Add main menu - * - * @since 1.0 - */ - public static function add_admin_menu() { - - $parent_page = self::$default_menu_position; - $page_title = self::$menu_page_title; - $capability = 'manage_options'; - $page_menu_slug = self::$plugin_slug; - $page_menu_func = __CLASS__ . '::menu_callback'; - - if ( apply_filters( 'astra_dashboard_admin_menu', true ) ) { - add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func ); - } else { - do_action( 'asta_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func ); - } - } - - /** - * Menu callback - * - * @since 1.0 - */ - public static function menu_callback() { - - $current_slug = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended - - $current_slug = str_replace( '-', '_', $current_slug ); - - $ast_icon = apply_filters( 'astra_page_top_icon', true ); - $ast_visit_site_url = apply_filters( 'astra_site_url', 'https://wpastra.com' ); - $ast_wrapper_class = apply_filters( 'astra_welcome_wrapper_class', array( $current_slug ) ); - - ?> -
-
-
- - - - -
-
- - -
- - -
-

- -

-
- -
-
- - - -
-

- - -

- Starter Templates -
-

- ' . esc_html( $astra_starter_sites_doc_link_text ) . '' : - esc_html( $astra_starter_sites_doc_link_text ) - ); - ?> -

-

- -

- %8$s ', - esc_attr( $ast_sites_notice_btn['class'] ), - 'href="' . esc_url( astra_get_prop( $ast_sites_notice_btn, 'link', '' ) ) . '"', - 'data-slug="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) ) . '"', - 'data-init="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) ) . '"', - 'data-settings-link-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) ) . '"', - 'data-settings-link="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) ) . '"', - 'data-activating-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) ) . '"', - esc_html( $ast_sites_notice_btn['button_text'] ) - ); - printf( - ' %3$s ', - isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_attr( $ast_sites_notice_btn['detail_link_class'] ) : '', - isset( $ast_sites_notice_btn['detail_link'] ) ? 'href="' . esc_url( $ast_sites_notice_btn['detail_link'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_html( $ast_sites_notice_btn['detail_link_text'] ) : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - ); - ?> -
-
-
-
- - array( - 'title' => __( 'Header Options', 'astra' ), - 'dashicon' => 'dashicons-align-center', - 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ), - ), - 'logo-favicon' => array( - 'title' => __( 'Upload Logo', 'astra' ), - 'dashicon' => 'dashicons-format-image', - 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ), - ), - 'footer' => array( - 'title' => __( 'Footer Settings', 'astra' ), - 'dashicon' => 'dashicons-align-wide', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ), - ), - 'colors' => array( - 'title' => __( 'Set Colors', 'astra' ), - 'dashicon' => 'dashicons-admin-customizer', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ), - ), - 'layout' => array( - 'title' => __( 'Layout Options', 'astra' ), - 'dashicon' => 'dashicons-layout', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ), - ), - 'typography' => array( - 'title' => __( 'Customize Fonts', 'astra' ), - 'dashicon' => 'dashicons-editor-textcolor', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ), - ), - 'blog-layout' => array( - 'title' => __( 'Blog Layouts', 'astra' ), - 'dashicon' => 'dashicons-welcome-write-blog', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ), - ), - 'sidebars' => array( - 'title' => __( 'Sidebar Options', 'astra' ), - 'dashicon' => 'dashicons-align-left', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-sidebars' ), - ), - ) - ); - - $extensions = apply_filters( - 'astra_addon_list', - array( - 'colors-and-background' => array( - 'title' => __( 'Colors & Background', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'typography' => array( - 'title' => __( 'Typography', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'spacing' => array( - 'title' => __( 'Spacing', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'blog-pro' => array( - 'title' => __( 'Blog Pro', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'mobile-header' => array( - 'title' => __( 'Mobile Header', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'header-sections' => array( - 'title' => __( 'Header Sections', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'nav-menu' => array( - 'title' => __( 'Nav Menu', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'sticky-header' => array( - 'title' => __( 'Sticky Header', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'advanced-headers' => array( - 'title' => __( 'Page Headers', 'astra' ), - 'description' => __( 'Make your header layouts look more appealing and sexy!', 'astra' ), - 'manage_settings' => true, - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'advanced-hooks' => array( - 'title' => __( 'Custom Layouts', 'astra' ), - // 'icon' => ASTRA_THEME_URI . 'assets/img/astra-advanced-hooks.png', - 'description' => __( 'Add content conditionally in the various hook areas of the theme.', 'astra' ), - 'manage_settings' => true, - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'site-layouts' => array( - 'title' => __( 'Site Layouts', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'advanced-footer' => array( - 'title' => __( 'Footer Widgets', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'scroll-to-top' => array( - 'title' => __( 'Scroll To Top', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'woocommerce' => array( - 'title' => __( 'WooCommerce', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'edd' => array( - 'title' => __( 'Easy Digital Downloads', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'learndash' => array( - 'title' => __( 'LearnDash', 'astra' ), - 'description' => __( 'Supercharge your LearnDash website with amazing design features.', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'lifterlms' => array( - 'title' => __( 'LifterLMS', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'white-label' => array( - 'title' => __( 'White Label', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - ) - ); - ?> -
-

-
- - - -
-
- -
-

- -

-
- -
-
    - $info ) { - $title_url = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? 'href="' . esc_url( $info['title_url'] ) . '"' : ''; - $anchor_target = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? "target='_blank' rel='noopener'" : ''; - - echo '
  • ' . esc_html( $info['title'] ) . '
  • '; - } - ?> -
-
- -
-
- - - array( - 'plugin-name' => __( 'Import / Export Customizer Settings', 'astra' ), - 'plugin-init' => 'astra-import-export/astra-import-export.php', - 'settings-link' => '', - 'settings-link-text' => 'Settings', - ), - 'reset-astra-customizer' => - array( - 'plugin-name' => __( 'Astra Customizer Reset', 'astra' ), - 'plugin-init' => 'reset-astra-customizer/class-astra-theme-customizer-reset.php', - 'settings-link' => admin_url( 'customize.php' ), - 'settings-link-text' => 'Settings', - ), - - 'customizer-search' => - array( - 'plugin-name' => __( 'Customizer Search', 'astra' ), - 'plugin-init' => 'customizer-search/customizer-search.php', - 'settings-link' => admin_url( 'customize.php' ), - 'settings-link-text' => 'Settings', - ), - - 'astra-bulk-edit' => - array( - 'plugin-name' => __( 'Astra Bulk Edit', 'astra' ), - 'plugin-init' => 'astra-bulk-edit/astra-bulk-edit.php', - 'settings-link' => '', - 'settings-link-text' => 'Settings', - ), - - 'astra-widgets' => - array( - 'plugin-name' => __( 'Astra Widgets', 'astra' ), - 'plugin-init' => 'astra-widgets/astra-widgets.php', - 'settings-link' => admin_url( 'widgets.php' ), - 'settings-link-text' => 'Settings', - ), - - 'custom-fonts' => - array( - 'plugin-name' => __( 'Custom Fonts', 'astra' ), - 'plugin-init' => 'custom-fonts/custom-fonts.php', - 'settings-link' => admin_url( 'edit-tags.php?taxonomy=bsf_custom_fonts' ), - 'settings-link-text' => 'Settings', - ), - - 'custom-typekit-fonts' => - array( - 'plugin-name' => __( 'Custom Typekit Fonts', 'astra' ), - 'plugin-init' => 'custom-typekit-fonts/custom-typekit-fonts.php', - 'settings-link' => admin_url( 'themes.php?page=custom-typekit-fonts' ), - 'settings-link-text' => 'Settings', - ), - - 'sidebar-manager' => - array( - 'plugin-name' => __( 'Sidebar Manager', 'astra' ), - 'plugin-init' => 'sidebar-manager/sidebar-manager.php', - 'settings-link' => admin_url( 'edit.php?post_type=bsf-sidebar' ), - 'settings-link-text' => 'Settings', - ), - - 'ultimate-addons-for-gutenberg' => - array( - 'plugin-name' => __( 'Ultimate Addons for Gutenberg', 'astra' ), - 'plugin-init' => 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php', - 'settings-link' => admin_url( 'options-general.php?page=uag' ), - 'settings-link-text' => 'Settings', - 'display' => function_exists( 'register_block_type' ), - ), - ) - ); - - if ( apply_filters( 'astra_show_free_extend_plugins', true ) ) { - ?> - -
-

-

-
- -
- -
- -
-
- - false, - 'message' => __( 'No plugin specified', 'astra' ), - ) - ); - } - - $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; - - $activate = activate_plugin( $plugin_init, '', false, true ); - - if ( '/astra-pro-sites/astra-pro-sites.php' === $plugin_init || '/astra-sites/astra-sites.php' === $plugin_init ) { - self::get_starter_templates_slug(); - } - - if ( is_wp_error( $activate ) ) { - wp_send_json_error( - array( - 'success' => false, - 'message' => $activate->get_error_message(), - 'starter_template_slug' => self::$starter_templates_slug, - ) - ); - } - - wp_send_json_success( - array( - 'success' => true, - 'message' => __( 'Plugin Successfully Activated', 'astra' ), - 'starter_template_slug' => self::$starter_templates_slug, - ) - ); - } - - /** - * Required Plugin Activate - * - * @since 1.2.4 - */ - public static function required_plugin_deactivate() { - - $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : ''; - - if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) { - wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) ); - } - - if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) { - wp_send_json_error( - array( - 'success' => false, - 'message' => __( 'No plugin specified', 'astra' ), - ) - ); - } - - $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; - - $deactivate = deactivate_plugins( $plugin_init, '', false ); - - if ( is_wp_error( $deactivate ) ) { - wp_send_json_error( - array( - 'success' => false, - 'message' => $deactivate->get_error_message(), - ) - ); - } - - wp_send_json_success( - array( - 'success' => true, - 'message' => __( 'Plugin Successfully Deactivated', 'astra' ), - ) - ); - - } - - /** - * Astra Header Right Section Links - * - * @since 1.2.4 - */ - public static function top_header_right_section() { - - $top_links = apply_filters( - 'astra_header_top_links', - array( - 'astra-theme-info' => array( - 'title' => 'Astra Lightning Speed' . __( ' Lightning Fast & Fully Customizable WordPress theme!', 'astra' ), - ), - ) - ); - - if ( ! empty( $top_links ) ) { - ?> - - - #menu-appearance a[href^="edit.php?post_type=astra-"]:before, - #menu-appearance a[href^="themes.php?page=astra-"]:before, - #menu-appearance a[href^="edit.php?post_type=astra_"]:before, - #menu-appearance a[href^="edit-tags.php?taxonomy=bsf_custom_fonts"]:before, - #menu-appearance a[href^="themes.php?page=custom-typekit-fonts"]:before, - #menu-appearance a[href^="edit.php?post_type=bsf-sidebar"]:before { - content: "\21B3"; - margin-right: 0.5em; - opacity: 0.5; - } - '; - - } - } - - new Astra_Admin_Settings(); -} + 'astra-sites-on-active', + 'type' => 'info', + 'message' => sprintf( + '
+
+
+

+ %2$s +

+

%3$s

+ +
', + $image_path, + __( 'Thank you for installing Adélie Linux WordPress Theme!', 'astra' ), + __( 'Did you know Astra comes with dozens of ready-to-use starter templates? Install the Starter Templates plugin to get started.', 'astra' ), + esc_attr( $ast_sites_notice_btn['class'] ), + 'href="' . astra_get_prop( $ast_sites_notice_btn, 'link', '' ) . '"', + 'data-slug="' . astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) . '"', + 'data-init="' . astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) . '"', + 'data-settings-link-text="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) . '"', + 'data-settings-link="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) . '"', + 'data-activating-text="' . astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) . '"', + esc_html( $ast_sites_notice_btn['button_text'] ) + ), + 'priority' => 5, + 'display-with-other-notices' => false, + 'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true, + ); + + Astra_Notices::add_notice( + $astra_sites_notice_args + ); + } + } + + /** + * Display notice for minimun version for Astra addon. + * + * @since 2.0.0 + */ + public static function minimum_addon_version_notice() { + + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + return; + } + + if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) { + + $message = sprintf( + /* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the addon */ + __( 'Please update the %1$1s to version %2$2s or higher. Ignore if already updated.', 'astra' ), + astra_get_addon_name(), + ASTRA_EXT_MIN_VER + ); + + $min_version = get_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', true ); + + if ( ! $min_version ) { + update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER ); + } + + if ( version_compare( $min_version, ASTRA_EXT_MIN_VER, '!=' ) ) { + delete_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice' ); + update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER ); + } + + $notice_args = array( + 'id' => 'ast-minimum-addon-version-notice', + 'type' => 'warning', + 'message' => $message, + 'show_if' => true, + 'repeat-notice-after' => false, + 'priority' => 18, + 'display-with-other-notices' => true, + ); + + Astra_Notices::add_notice( $notice_args ); + } + } + + /** + * Enqueue Astra Notices CSS. + * + * @since 2.0.0 + * + * @return void + */ + public static function notice_assets() { + if ( is_rtl() ) { + wp_enqueue_style( 'astra-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION ); + } else { + wp_enqueue_style( 'astra-notices', ASTRA_THEME_URI . 'inc/assets/css/astra-notices.css', array(), ASTRA_THEME_VERSION ); + } + } + + /** + * Render button for Astra Site notices + * + * @since 1.6.5 + * @return array $ast_sites_notice_btn Rendered button + */ + public static function astra_sites_notice_button() { + + $ast_sites_notice_btn = array(); + + // Any of the Starter Templtes plugin - Active. + if ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) || is_plugin_active( 'astra-sites/astra-sites.php' ) ) { + $ast_sites_notice_btn['class'] = 'active'; + $ast_sites_notice_btn['button_text'] = __( 'See Library »', 'astra' ); + $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); + + return $ast_sites_notice_btn; + } + + // Starter Templates PRO Plugin - Installed but Inactive. + if ( file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { + $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin'; + $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' ); + $ast_sites_notice_btn['data_slug'] = 'astra-pro-sites'; + $ast_sites_notice_btn['data_init'] = '/astra-pro-sites/astra-pro-sites.php'; + $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); + $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); + $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…'; + + return $ast_sites_notice_btn; + } + + // Starter Templates FREE Plugin - Installed but Inactive. + if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) ) { + $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin'; + $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' ); + $ast_sites_notice_btn['data_slug'] = 'astra-sites'; + $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php'; + $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); + $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); + $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…'; + + return $ast_sites_notice_btn; + } + + // Any of the Starter Templates plugin not available. + if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) || ! file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) ) { + $ast_sites_notice_btn['class'] = 'astra-install-recommended-plugin'; + $ast_sites_notice_btn['button_text'] = __( 'Install Importer Plugin', 'astra' ); + $ast_sites_notice_btn['data_slug'] = 'astra-sites'; + $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php'; + $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); + $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); + $ast_sites_notice_btn['detail_link_class'] = 'plugin-detail thickbox open-plugin-details-modal astra-starter-sites-detail-link'; + $ast_sites_notice_btn['detail_link'] = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=astra-sites&TB_iframe=true&width=772&height=400' ); + $ast_sites_notice_btn['detail_link_text'] = __( 'Details »', 'astra' ); + + return $ast_sites_notice_btn; + } + + $ast_sites_notice_btn['class'] = 'active'; + $ast_sites_notice_btn['button_text'] = __( 'See Library »', 'astra' ); + $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); + + return $ast_sites_notice_btn; + } + + /** + * Check if installed Starter Sites plugin is new. + * + * @since 2.3.2 + */ + public static function get_starter_templates_slug() { + + if ( defined( 'ASTRA_PRO_SITES_VER' ) && version_compare( ASTRA_PRO_SITES_VER, '2.0.0', '>=' ) ) { + self::$starter_templates_slug = 'starter-templates'; + } + + if ( defined( 'ASTRA_SITES_VER' ) && version_compare( ASTRA_SITES_VER, '2.0.0', '>=' ) ) { + self::$starter_templates_slug = 'starter-templates'; + } + } + + /** + * Load the scripts and styles in the customizer controls. + * + * @since 1.2.1 + */ + public static function customizer_scripts() { + $color_palettes = wp_json_encode( astra_color_palette() ); + wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $color_palettes . ';' ); + } + + /** + * Register admin scripts. + * + * @param String $hook Screen name where the hook is fired. + * @return void + */ + public static function register_scripts( $hook ) { + + if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) { + $post_types = get_post_types( array( 'public' => true ) ); + $screen = get_current_screen(); + $post_type = $screen->id; + + if ( in_array( $post_type, (array) $post_types ) ) { + + echo ''; + } + } + /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */ + + if ( ! is_customize_preview() ) { + + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); + + $localize = array( + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), + 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', + 'astraSitesLink' => admin_url( 'themes.php?page=' ), + 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), + 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', + 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', + 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), + 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), + 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), + 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), + ); + + wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); + } + } + + /** + * Enqueues the needed CSS/JS for the builder's admin settings page. + * + * @since 1.0 + */ + public static function styles_scripts() { + + // Styles. + if ( is_rtl() ) { + wp_enqueue_style( 'astra-admin-settings-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings-rtl.css', array(), ASTRA_THEME_VERSION ); + } else { + wp_enqueue_style( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings.css', array(), ASTRA_THEME_VERSION ); + } + + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); + + $localize = array( + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), + 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', + 'astraSitesLink' => admin_url( 'themes.php?page=' ), + 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), + 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', + 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', + 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), + 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), + 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), + 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), + 'ajax_nonce' => wp_create_nonce( 'astra-builder-module-nonce' ), + 'old_header_footer' => __( 'Use Old Header/Footer', 'astra' ), + 'migrate_to_builder' => __( 'Use New Header/Footer Builder', 'astra' ), + ); + wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); + + // Script. + wp_enqueue_script( 'astra-admin-settings' ); + + if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { + // For starter site plugin popup detail "Details »" on Astra Options page. + wp_enqueue_script( 'plugin-install' ); + wp_enqueue_script( 'thickbox' ); + wp_enqueue_style( 'thickbox' ); + } + } + + + /** + * Get and return page URL + * + * @param string $menu_slug Menu name. + * @since 1.0 + * @return string page url + */ + public static function get_page_url( $menu_slug ) { + + $parent_page = self::$default_menu_position; + + if ( strpos( $parent_page, '?' ) !== false ) { + $query_var = '&page=' . self::$plugin_slug; + } else { + $query_var = '?page=' . self::$plugin_slug; + } + + $parent_page_url = admin_url( $parent_page . $query_var ); + + $url = $parent_page_url . '&action=' . $menu_slug; + + return esc_url( $url ); + } + + /** + * Add main menu + * + * @since 1.0 + */ + public static function add_admin_menu() { + + $parent_page = self::$default_menu_position; + $page_title = self::$menu_page_title; + $capability = 'manage_options'; + $page_menu_slug = self::$plugin_slug; + $page_menu_func = __CLASS__ . '::menu_callback'; + + if ( apply_filters( 'astra_dashboard_admin_menu', true ) ) { + add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func ); + } else { + do_action( 'asta_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func ); + } + } + + /** + * Menu callback + * + * @since 1.0 + */ + public static function menu_callback() { + + $current_slug = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended + + $current_slug = str_replace( '-', '_', $current_slug ); + + $ast_icon = apply_filters( 'astra_page_top_icon', true ); + $ast_visit_site_url = apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ); + $ast_wrapper_class = apply_filters( 'astra_welcome_wrapper_class', array( $current_slug ) ); + + ?> +
+
+
+ + + + +
+
+ + +
+ + +
+

+ +

+
+ +
+
+ + array( + 'title' => __( 'Header Options', 'astra' ), + 'dashicon' => 'dashicons-align-center', + 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ), + ), + 'logo-favicon' => array( + 'title' => __( 'Upload Logo', 'astra' ), + 'dashicon' => 'dashicons-format-image', + 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ), + ), + 'footer' => array( + 'title' => __( 'Footer Settings', 'astra' ), + 'dashicon' => 'dashicons-align-wide', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ), + ), + 'colors' => array( + 'title' => __( 'Set Colors', 'astra' ), + 'dashicon' => 'dashicons-admin-customizer', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ), + ), + 'layout' => array( + 'title' => __( 'Layout Options', 'astra' ), + 'dashicon' => 'dashicons-layout', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ), + ), + 'typography' => array( + 'title' => __( 'Customize Fonts', 'astra' ), + 'dashicon' => 'dashicons-editor-textcolor', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ), + ), + 'blog-layout' => array( + 'title' => __( 'Blog Layouts', 'astra' ), + 'dashicon' => 'dashicons-welcome-write-blog', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ), + ), + 'sidebars' => array( + 'title' => __( 'Sidebar Options', 'astra' ), + 'dashicon' => 'dashicons-align-left', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-sidebars' ), + ), + ) + ); + + $extensions = apply_filters( + 'astra_addon_list', + array( + ) + ); + ?> +
+

+
+ + + +
+
+ + false, + 'message' => __( 'No plugin specified', 'astra' ), + ) + ); + } + + $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; + + $activate = activate_plugin( $plugin_init, '', false, true ); + + if ( '/astra-pro-sites/astra-pro-sites.php' === $plugin_init || '/astra-sites/astra-sites.php' === $plugin_init ) { + self::get_starter_templates_slug(); + } + + if ( is_wp_error( $activate ) ) { + wp_send_json_error( + array( + 'success' => false, + 'message' => $activate->get_error_message(), + 'starter_template_slug' => self::$starter_templates_slug, + ) + ); + } + + wp_send_json_success( + array( + 'success' => true, + 'message' => __( 'Plugin Successfully Activated', 'astra' ), + 'starter_template_slug' => self::$starter_templates_slug, + ) + ); + } + + /** + * Required Plugin Activate + * + * @since 1.2.4 + */ + public static function required_plugin_deactivate() { + + $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : ''; + + if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) { + wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) ); + } + + if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) { + wp_send_json_error( + array( + 'success' => false, + 'message' => __( 'No plugin specified', 'astra' ), + ) + ); + } + + $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; + + $deactivate = deactivate_plugins( $plugin_init, '', false ); + + if ( is_wp_error( $deactivate ) ) { + wp_send_json_error( + array( + 'success' => false, + 'message' => $deactivate->get_error_message(), + ) + ); + } + + wp_send_json_success( + array( + 'success' => true, + 'message' => __( 'Plugin Successfully Deactivated', 'astra' ), + ) + ); + + } + + /** + * Astra Header Right Section Links + * + * @since 1.2.4 + */ + public static function top_header_right_section() { + + if ( ! empty( $top_links ) ) { + ?> + + + #menu-appearance a[href^="edit.php?post_type=astra-"]:before, + #menu-appearance a[href^="themes.php?page=astra-"]:before, + #menu-appearance a[href^="edit.php?post_type=astra_"]:before, + #menu-appearance a[href^="edit-tags.php?taxonomy=bsf_custom_fonts"]:before, + #menu-appearance a[href^="themes.php?page=custom-typekit-fonts"]:before, + #menu-appearance a[href^="edit.php?post_type=bsf-sidebar"]:before { + content: "\21B3"; + margin-right: 0.5em; + opacity: 0.5; + } + '; + + } + } + + new Astra_Admin_Settings(); +} -- cgit v1.2.3-70-g09d2