#js&&****&……includes/class-astra-api-init.php 0000644 00000010437 15032152105 0013007 0 ustar 00 namespace, $this->rest_base, array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_admin_settings' ), 'permission_callback' => array( $this, 'get_permissions_check' ), 'args' => array(), ), 'schema' => array( $this, 'get_public_item_schema' ), ) ); } /** * Get common settings. * * @param WP_REST_Request $request Full details about the request. * @return array $updated_option defaults + set DB option data. * * @since 4.0.0 */ public function get_admin_settings( $request ) { $db_option = get_option( 'astra_admin_settings', array() ); $defaults = apply_filters( 'astra_dashboard_rest_options', array( 'self_hosted_gfonts' => self::get_admin_settings_option( 'self_hosted_gfonts', false ), 'preload_local_fonts' => self::get_admin_settings_option( 'preload_local_fonts', false ), 'use_old_header_footer' => astra_get_option( 'is-header-footer-builder', false ), 'use_upgrade_notices' => astra_showcase_upgrade_notices(), ) ); $updated_option = wp_parse_args( $db_option, $defaults ); return $updated_option; } /** * Check whether a given request has permission to read notes. * * @param WP_REST_Request $request Full details about the request. * @return WP_Error|boolean * @since 4.0.0 */ public function get_permissions_check( $request ) { if ( ! current_user_can( 'edit_theme_options' ) ) { return new WP_Error( 'astra_rest_cannot_view', esc_html__( 'Sorry, you cannot list resources.', 'astra' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } /** * Returns an value, * based on the settings database option for the admin settings page. * * @param string $key The sub-option key. * @param mixed $default Option default value if option is not available. * @return mixed Return the option value based on provided key * @since 4.0.0 */ public static function get_admin_settings_option( $key, $default = false ) { $value = isset( self::$astra_admin_settings[ $key ] ) ? self::$astra_admin_settings[ $key ] : $default; return $value; } /** * Update an value of a key, * from the settings database option for the admin settings page. * * @param string $key The option key. * @param mixed $value The value to update. * @return mixed Return the option value based on provided key * @since 4.0.0 */ public static function update_admin_settings_option( $key, $value ) { $astra_admin_updated_settings = get_option( self::$option_name, array() ); $astra_admin_updated_settings[ $key ] = $value; update_option( self::$option_name, $astra_admin_updated_settings ); } } Astra_API_Init::get_instance(); includes/class-astra-theme-builder-free.php 0000644 00000013157 15032152107 0014746 0 ustar 00 esc_html__( 'Site Builder', 'astra' ), 'rest_url' => '/wp-json/astra-addon/v1/custom-layouts/', 'new_custom_layout_base_url' => admin_url( 'post-new.php?post_type=astra-advanced-hook' ), 'astra_pricing_page_url' => astra_get_pro_url( '/pricing/', 'free-theme', 'site-builder', 'upgrade' ), 'astra_docs_page_url' => astra_get_pro_url( '/docs/custom-layouts-pro/', 'free-theme', 'site-builder', 'documentation' ), 'admin_url' => admin_url(), ); wp_localize_script( 'astra-theme-builder-script', 'astra_theme_builder', $localized_data ); wp_set_script_translations( 'astra-theme-builder-script', 'astra' ); } /** * Admin Body Classes * * @since 4.5.0 * @param string $classes Space separated class string. */ public function admin_body_class( $classes = '' ) { $theme_builder_class = isset( $_GET['page'] ) && 'theme-builder-free' === $_GET['page'] ? 'ast-theme-builder' : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Fetching a $_GET value, no nonce available to validate. $classes .= ' ' . $theme_builder_class . ' '; return $classes; } /** * Renders the admin settings. * * @since 4.5.0 * @return void */ public function render_theme_builder() { ?>
initialize_hooks(); } /** * Init Hooks. * * @since 4.0.0 * @return void */ public function initialize_hooks() { self::$plugin_slug = self::get_theme_page_slug(); add_action( 'admin_menu', array( $this, 'setup_menu' ) ); add_action( 'admin_init', array( $this, 'settings_admin_scripts' ) ); add_filter( 'install_plugins_tabs', array( $this, 'add_astra_woo_suggestions_link' ), 1 ); add_action( 'install_plugins_pre_astra-woo', array( $this, 'update_plugin_suggestions_tab_link' ) ); } /** * Add Astra~Woo Suggestions plugin tab link. * * @param array $tabs Plugin tabs. * @since 4.7.3 * @return array */ public function add_astra_woo_suggestions_link( $tabs ) { if ( class_exists( 'WooCommerce' ) ) { $tabs['astra-woo'] = esc_html__( 'For ', 'astra' ) . self::$page_title . '~Woo'; } return $tabs; } /** * Update plugin suggestions tab link. * * @since 4.7.3 * @return void */ public function update_plugin_suggestions_tab_link() { // phpcs:disable WordPress.Security.NonceVerification.Recommended if ( ! isset( $_GET['tab'] ) || 'astra-woo' !== $_GET['tab'] ) { return; } // phpcs:enable WordPress.Security.NonceVerification.Recommended $extensions_url = add_query_arg( array( 'page' => self::$plugin_slug, 'path' => 'woocommerce', 'ref' => 'plugins', ), admin_url( 'admin.php' ) ); wp_safe_redirect( $extensions_url ); exit(); } /** * Theme options page Slug getter including White Label string. * * @since 4.0.0 * @return string Theme Options Page Slug. */ public static function get_theme_page_slug() { return apply_filters( 'astra_theme_page_slug', self::$plugin_slug ); } /** * Initialize after Astra gets loaded. * * @since 4.0.0 */ public function settings_admin_scripts() { // Enqueue admin scripts. /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( ! empty( $_GET['page'] ) && ( self::$plugin_slug === $_GET['page'] || false !== strpos( $_GET['page'], self::$plugin_slug . '_' ) ) ) { //phpcs:ignore /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort add_action( 'admin_enqueue_scripts', array( $this, 'styles_scripts' ) ); add_filter( 'admin_footer_text', array( $this, 'astra_admin_footer_link' ), 99 ); } } /** * Add submenu to admin menu. * * @since 4.0.0 */ public function setup_menu() { global $submenu; $capability = 'manage_options'; if ( ! current_user_can( $capability ) ) { return; } self::$page_title = apply_filters( 'astra_page_title', esc_html__( 'Astra', 'astra' ) ); $astra_icon = apply_filters( 'astra_menu_icon', 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzcyIiBoZWlnaHQ9Ijc3MiIgdmlld0JveD0iMCAwIDc3MiA3NzIiIGZpbGw9IiNhN2FhYWQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTM4NiA3NzJDNTk5LjE4MiA3NzIgNzcyIDU5OS4xODIgNzcyIDM4NkM3NzIgMTcyLjgxOCA1OTkuMTgyIDAgMzg2IDBDMTcyLjgxOCAwIDAgMTcyLjgxOCAwIDM4NkMwIDU5OS4xODIgMTcyLjgxOCA3NzIgMzg2IDc3MlpNMjYxLjcxMyAzNDMuODg2TDI2MS42NzUgMzQzLjk2OEMyMjIuNDE3IDQyNi45OTQgMTgzLjE1OSA1MTAuMDE5IDE0My45MDIgNTkyLjk1MkgyNDQuODQ3QzI3Ni42MjcgNTI4LjczOSAzMDguNDA3IDQ2NC40MzQgMzQwLjE4NyA0MDAuMTI4QzM3MS45NjUgMzM1LjgyNyA0MDMuNzQyIDI3MS41MjcgNDM1LjUyIDIwNy4zMkwzNzkuNDQgOTVDMzQwLjE5NyAxNzcuOSAzMDAuOTU1IDI2MC44OTMgMjYxLjcxMyAzNDMuODg2Wk00MzYuNjczIDQwNC4wNzVDNDUyLjkwNiAzNzAuNzQ1IDQ2OS4xMzkgMzM3LjQxNSA0ODUuNDY3IDMwNC4wODVDNTA5LjMwMSAzNTIuMjI5IDUzMy4wNDIgNDAwLjM3NCA1NTYuNzgyIDQ0OC41MThDNTgwLjUyMyA0OTYuNjYzIDYwNC4yNjQgNTQ0LjgwNyA2MjguMDk4IDU5Mi45NTJINTE5LjI0OEM1MTMuMDU0IDU3OC42OTMgNTA2Ljc2NyA1NjQuNTI3IDUwMC40OCA1NTAuMzYyQzQ5NC4xOTMgNTM2LjE5NiA0ODcuOTA2IDUyMi4wMzEgNDgxLjcxMyA1MDcuNzczSDM4NkwzODcuODc3IDUwNC4wNjlDNDA0LjIwNSA0NzAuNzM4IDQyMC40MzkgNDM3LjQwNiA0MzYuNjczIDQwNC4wNzVaIiBmaWxsPSIjYTdhYWFkIi8+DQo8L3N2Zz4=' ); $priority = apply_filters( 'astra_menu_priority', 59 ); add_menu_page( // phpcs:ignore WPThemeReview.PluginTerritory.NoAddAdminPages.add_menu_pages_add_menu_page -- Taken the menu on top level self::$page_title, self::$page_title, $capability, self::$plugin_slug, array( $this, 'render_admin_dashboard' ), $astra_icon, $priority ); // Add Customize submenu. add_submenu_page( // phpcs:ignore WPThemeReview.PluginTerritory.NoAddAdminPages.add_menu_pages_add_submenu_page -- Taken the menu on top level self::$plugin_slug, __( 'Customize', 'astra' ), __( 'Customize', 'astra' ), $capability, 'customize.php' ); // Add Custom Layout submenu. /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $show_custom_layout_submenu = ( defined( 'ASTRA_EXT_VER' ) && ! Astra_Ext_Extension::is_active( 'advanced-hooks' ) ) ? false : true; /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( $show_custom_layout_submenu && defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '4.5.0', '<' ) ) { add_submenu_page( // phpcs:ignore WPThemeReview.PluginTerritory.NoAddAdminPages.add_menu_pages_add_submenu_page -- Taken the menu on top level self::$plugin_slug, __( 'Custom Layouts', 'astra' ), __( 'Custom Layouts', 'astra' ), $capability, /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'advanced-hooks' ) ) ? 'edit.php?post_type=astra-advanced-hook' : 'admin.php?page=' . self::$plugin_slug . '&path=custom-layouts' /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort ); } if ( ! astra_is_white_labelled() ) { // Add Astra~Woo Extensions page or Spectra submenu. /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( ASTRA_THEME_ORG_VERSION && class_exists( 'WooCommerce' ) ) { /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort add_submenu_page( // phpcs:ignore WPThemeReview.PluginTerritory.NoAddAdminPages.add_menu_pages_add_submenu_page -- Taken the menu on top level self::$plugin_slug, 'WooCommerce', 'WooCommerce', $capability, 'admin.php?page=' . self::$plugin_slug . '&path=woocommerce' ); } elseif ( ASTRA_THEME_ORG_VERSION && ! $this->spectra_has_top_level_menu() ) { add_submenu_page( // phpcs:ignore WPThemeReview.PluginTerritory.NoAddAdminPages.add_menu_pages_add_submenu_page -- Taken the menu on top level self::$plugin_slug, 'Spectra', 'Spectra', $capability, $this->get_spectra_page_admin_link() ); } else { // Do nothing. } } // Rename to Home menu. $submenu[ self::$plugin_slug ][0][0] = esc_html__( 'Dashboard', 'astra' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- Required to rename the home menu. } /** * In version 2.4.1 Spectra introduces top level admin menu so there is no meaning to show Spectra submenu from Astra menu. * * @since 4.1.4 * @return bool true|false. */ public function spectra_has_top_level_menu() { return defined( 'UAGB_VER' ) && version_compare( UAGB_VER, '2.4.1', '>=' ) ? true : false; } /** * Provide the Spectra admin page URL. * * @since 4.1.1 * @return string url. */ public function get_spectra_page_admin_link() { $spectra_admin_url = defined( 'UAGB_VER' ) ? ( $this->spectra_has_top_level_menu() ? admin_url( 'admin.php?page=' . UAGB_SLUG ) : admin_url( 'options-general.php?page=' . UAGB_SLUG ) ) : 'admin.php?page=' . self::$plugin_slug . '&path=spectra'; return apply_filters( 'astra_dashboard_spectra_admin_link', $spectra_admin_url ); } /** * Renders the admin settings. * * @since 4.0.0 * @return void */ public function render_admin_dashboard() { $page_action = ''; if ( isset( $_GET['action'] ) ) { //phpcs:ignore /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $page_action = sanitize_text_field( wp_unslash( $_GET['action'] ) ); //phpcs:ignore /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $page_action = str_replace( '_', '-', $page_action ); } ?> user_firstname; /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $astra_addon_locale = ASTRA_THEME_ORG_VERSION ? 'astra-addon/astra-addon.php' : 'astra-pro/astra-pro.php'; /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $localize = array( 'current_user' => ! empty( $user_firstname ) ? ucfirst( $user_firstname ) : ucfirst( wp_get_current_user()->display_name ), 'admin_base_url' => admin_url(), 'plugin_dir' => ASTRA_THEME_URI, 'plugin_ver' => defined( 'ASTRA_EXT_VER' ) ? ASTRA_EXT_VER : '', 'version' => ASTRA_THEME_VERSION, 'pro_available' => defined( 'ASTRA_EXT_VER' ) ? true : false, 'pro_installed_status' => 'installed' === self::get_plugin_status( $astra_addon_locale ) ? true : false, 'astra_addon_locale' => $astra_addon_locale, /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort 'astra_rating_url' => ASTRA_THEME_ORG_VERSION ? 'https://wordpress.org/support/theme/astra/reviews/?rate=5#new-post' : 'https://woo.com/products/astra/#reviews', /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort 'spectra_plugin_status' => self::get_plugin_status( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ), 'theme_name' => astra_get_theme_name(), 'plugin_name' => astra_get_addon_name(), 'quick_settings' => self::astra_get_quick_links(), 'ajax_url' => admin_url( 'admin-ajax.php' ), 'is_whitelabel' => astra_is_white_labelled(), 'show_self_branding' => $show_self_branding, 'admin_url' => admin_url( 'admin.php' ), 'home_slug' => self::$plugin_slug, 'upgrade_url' => astra_get_upgrade_url( 'dashboard' ), 'customize_url' => admin_url( 'customize.php' ), 'astra_base_url' => admin_url( 'admin.php?page=' . self::$plugin_slug ), 'logo_url' => apply_filters( 'astra_admin_menu_icon', ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg' ), 'update_nonce' => wp_create_nonce( 'astra_update_admin_setting' ), 'integrations' => self::astra_get_integrations(), /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort 'show_plugins' => apply_filters( 'astra_show_free_extend_plugins', true ) && ASTRA_THEME_ORG_VERSION ? true : false, // Legacy filter support. /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort 'useful_plugins' => self::astra_get_useful_plugins(), 'extensions' => self::astra_get_pro_extensions(), 'plugin_manager_nonce' => wp_create_nonce( 'astra_plugin_manager_nonce' ), 'plugin_installer_nonce' => wp_create_nonce( 'updates' ), 'free_vs_pro_link' => admin_url( 'admin.php?page=' . self::$plugin_slug . '&path=free-vs-pro' ), 'show_builder_migration' => Astra_Builder_Helper::is_header_footer_builder_active(), 'plugin_installing_text' => esc_html__( 'Installing', 'astra' ), 'plugin_installed_text' => esc_html__( 'Installed', 'astra' ), 'plugin_activating_text' => esc_html__( 'Activating', 'astra' ), 'plugin_activated_text' => esc_html__( 'Activated', 'astra' ), 'plugin_activate_text' => esc_html__( 'Activate', 'astra' ), 'starter_templates_data' => self::get_starter_template_plugin_data(), 'astra_docs_data' => astra_remote_docs_data(), 'upgrade_notice' => astra_showcase_upgrade_notices(), 'show_banner_video' => apply_filters( 'astra_show_banner_video', true ), 'is_woo_active' => class_exists( 'WooCommerce' ) ? true : false, 'woo_extensions' => self::astra_get_woo_extensions( false ), 'astraWebsite' => array( 'baseUrl' => ASTRA_WEBSITE_BASE_URL, 'docsUrl' => astra_get_pro_url( '/docs/', 'free-theme', 'dashboard', 'documentation' ), 'docsCategoryDynamicUrl' => astra_get_pro_url( '/docs-category/{{category}}', 'free-theme', 'dashboard', 'documentation' ), 'vipPrioritySupportUrl' => astra_get_pro_url( '/vip-priority-support/', 'free-theme', 'dashboard', 'vip-priority-support' ), 'templatesUrl' => astra_get_pro_url( '/website-templates/', 'free-theme', 'dashboard', 'starter-templates' ), 'whatsNewFeedUrl' => esc_url( ASTRA_WEBSITE_BASE_URL . '/whats-new/feed/' ), ), /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort 'astra_cta_btn_url' => ASTRA_THEME_ORG_VERSION ? astra_get_pro_url( '/pricing/', 'free-theme', 'dashboard', 'unlock-pro-features-CTA' ) : 'https://woocommerce.com/products/astra-pro/', /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort 'plugin_configuring_text' => esc_html__( 'Configuring', 'astra' ), ); $this->settings_app_scripts( apply_filters( 'astra_react_admin_localize', $localize ) ); } /** * Get customizer quick links for easy navigation. * * @return array * @since 4.0.0 */ public static function astra_get_quick_links() { return apply_filters( 'astra_quick_settings', array( 'logo-favicon' => array( 'title' => __( 'Site Identity', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[control]=site_icon' ), ), 'header' => array( 'title' => __( 'Header Settings', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ), ), 'footer' => array( 'title' => __( 'Footer Settings', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ), ), 'colors' => array( 'title' => __( 'Color', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ), ), 'typography' => array( 'title' => __( 'Typography', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ), ), 'button' => array( 'title' => __( 'Button', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-buttons' ), ), 'blog-options' => array( 'title' => __( 'Blog Options', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ), ), 'layout' => array( 'title' => __( 'Layout', 'astra' ), 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ), ), 'menus' => array( 'title' => __( 'Menus', 'astra' ), 'quick_url' => admin_url( 'nav-menus.php' ), ), ) ); } /** * Check if Starter Templates promotions is being disabled. * * @return bool * @since 4.8.9 */ public static function is_promoting_starter_templates() { /** * Filter to disable Starter Templates promotions. * Used in the Website Learners platform: A popular YouTube channel that has been our partner since 2017. * * @param bool $disable_starter_templates_promotions Whether to disable Starter Templates promotions. * * @since 4.8.9 */ return ! apply_filters( 'astra_disable_starter_templates_promotions', false ); } /** * Get Starter Templates plugin data. * * @return array * @since 4.0.0 */ public static function get_starter_template_plugin_data() { /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $st_data = array( 'title' => is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ? Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name', __( 'Starter Templates', 'astra' ) ) : __( 'Starter Templates', 'astra' ), 'description' => is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ? Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description', __( 'Create professional designed pixel perfect websites in minutes. Get access to 280+ pre-made full website templates for your favorite page builder.', 'astra' ) ) : __( 'Create professional designed pixel perfect websites in minutes. Get access to 280+ pre-made full website templates for your favorite page builder.', 'astra' ), 'is_available' => defined( 'ASTRA_PRO_SITES_VER' ) || defined( 'ASTRA_SITES_VER' ) ? true : false, 'redirection' => admin_url( 'themes.php?page=starter-templates' ), 'icon_path' => 'https://ps.w.org/astra-sites/assets/icon-256x256.gif', 'is_promoting' => self::is_promoting_starter_templates(), ); /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $skip_free_version = false; $pro_plugin_status = self::get_plugin_status( 'astra-pro-sites/astra-pro-sites.php' ); if ( 'installed' === $pro_plugin_status || 'activated' === $pro_plugin_status ) { $skip_free_version = true; $st_data['slug'] = 'astra-pro-sites'; $st_data['status'] = $pro_plugin_status; $st_data['path'] = 'astra-pro-sites/astra-pro-sites.php'; } $free_plugin_status = self::get_plugin_status( 'astra-sites/astra-sites.php' ); if ( ! $skip_free_version ) { $st_data['slug'] = 'astra-sites'; $st_data['status'] = $free_plugin_status; $st_data['path'] = 'astra-sites/astra-sites.php'; } return $st_data; } /** * Method to check plugin configuration status. * * @since 4.8.2 * * @param string $plugin_init_file Plugin init file. * * @return bool Returns true if plugin is configured, false otherwise. */ public static function is_plugin_configured( $plugin_init_file ) { switch ( $plugin_init_file ) { case 'surecart/surecart.php': /** @psalm-suppress UndefinedClass */ return class_exists( '\SureCart\Models\ApiToken' ) && \SureCart\Models\ApiToken::get(); case 'suretriggers/suretriggers.php': if ( class_exists( '\SureTriggers\Controllers\OptionController' ) ) { /** @psalm-suppress UndefinedClass */ $st_key = \SureTriggers\Controllers\OptionController::get_option( 'secret_key' ); return $st_key && $st_key !== 'connection-denied'; } return false; case 'checkout-plugins-stripe-woo/checkout-plugins-stripe-woo.php': // If the setup is not skipped and connected to the Stripe. /** @psalm-suppress UndefinedClass */ return 'skipped' !== get_option( 'cpsw_setup_status', false ) && class_exists( '\CPSW\Admin\Admin_Controller' ) && \CPSW\Admin\Admin_Controller::get_instance()->is_stripe_connected(); case 'checkout-paypal-woo/checkout-paypal-woo.php': if ( ! class_exists( '\CPPW\Gateway\Paypal\Api\Client' ) ) { return false; } $remote_url = 'v1/identity/oauth2/userinfo?schema=paypalv1.1'; try { /** @psalm-suppress UndefinedClass */ $response = \CPPW\Gateway\Paypal\Api\Client::request( $remote_url, array(), 'get' ); if ( ! is_array( $response ) || empty( $response['user_id'] ) ) { return false; } return true; } catch ( \Exception $e ) { // Handle exception silently. } return false; } return true; } /** * Get plugin status * * @since 4.0.0 * * @param string $plugin_init_file Plugin init file. * @return mixed */ public static function get_plugin_status( $plugin_init_file ) { $installed_plugins = get_plugins(); if ( ! isset( $installed_plugins[ $plugin_init_file ] ) ) { return 'install'; } elseif ( is_plugin_active( $plugin_init_file ) ) { if ( ! self::is_plugin_configured( $plugin_init_file ) ) { return 'configure'; } return 'activated'; } else { return 'installed'; } } /** * Get Astra's pro extension list. * * @since 4.0.0 * @return array */ public static function astra_get_pro_extensions() { return apply_filters( 'astra_addon_list', array( 'colors-and-background' => array( 'title' => __( 'Colors & Background', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/colors-background-module/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/colors-background-module/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'typography' => array( 'title' => __( 'Typography', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/typography-module/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/typography-module/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'spacing' => array( 'title' => __( 'Spacing', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/spacing-addon-overview/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/spacing-addon-overview/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'blog-pro' => array( 'title' => __( 'Blog Pro', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/blog-pro-overview/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/blog-pro-overview/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'mobile-header' => array( 'title' => __( 'Mobile Header', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/mobile-header-with-astra/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/mobile-header-with-astra/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'header-sections' => array( 'title' => __( 'Header Sections', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/header-sections-pro/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/header-sections-pro/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'sticky-header' => array( 'title' => __( 'Sticky Header', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/sticky-header-pro/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/sticky-header-pro/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'site-layouts' => array( 'title' => __( 'Site Layouts', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/site-layout-overview/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/site-layout-overview/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'advanced-footer' => array( 'title' => __( 'Footer Widgets', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/footer-widgets-astra-pro/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/footer-widgets-astra-pro/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'nav-menu' => array( 'title' => __( 'Nav Menu', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/nav-menu-addon/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/nav-menu-addon/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'advanced-hooks' => array( 'title' => ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '4.5.0', '<' ) ) ? __( 'Custom Layouts', 'astra' ) : __( 'Site Builder', 'astra' ), '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( '/docs/custom-layouts-pro/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/custom-layouts-pro/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', '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( '/docs/page-headers-overview/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/page-headers-overview/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'woocommerce' => array( 'title' => 'WooCommerce', 'class' => 'ast-addon', 'condition' => defined( 'ASTRA_EXT_VER' ) && class_exists( 'WooCommerce' ) ? true : false, 'title_url' => astra_get_pro_url( '/docs/woocommerce-module-overview/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/woocommerce-module-overview/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'edd' => array( 'title' => 'Easy Digital Downloads', 'class' => 'ast-addon', 'condition' => defined( 'ASTRA_EXT_VER' ) && class_exists( 'Easy_Digital_Downloads' ) ? true : false, 'title_url' => astra_get_pro_url( '/docs/easy-digital-downloads-module-overview/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/easy-digital-downloads-module-overview/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'learndash' => array( 'title' => 'LearnDash', 'condition' => defined( 'ASTRA_EXT_VER' ) && class_exists( 'SFWD_LMS' ) ? true : false, 'description' => __( 'Supercharge your LearnDash website with amazing design features.', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/learndash-integration-in-astra-pro/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/learndash-integration-in-astra-pro/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'lifterlms' => array( 'title' => 'LifterLMS', 'class' => 'ast-addon', 'condition' => defined( 'ASTRA_EXT_VER' ) && class_exists( 'LifterLMS' ) ? true : false, 'title_url' => astra_get_pro_url( '/docs/lifterlms-module-pro/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/lifterlms-module-pro/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), 'white-label' => array( 'title' => __( 'White Label', 'astra' ), 'class' => 'ast-addon', 'title_url' => astra_get_pro_url( '/docs/how-to-white-label-astra/', 'free-theme', 'dashboard', 'documentation' ), 'links' => array( array( 'link_class' => 'ast-learn-more', 'link_url' => astra_get_pro_url( '/docs/how-to-white-label-astra/', 'free-theme', 'dashboard', 'documentation' ), 'link_text' => __( 'Documentation', 'astra' ), 'target_blank' => true, ), ), ), ) ); } /** * Get Astra's recommended WooCommerce extensions. * * @param bool $under_useful_plugins Add under useful plugins or not. * * @since 4.7.3 * @return array */ public static function astra_get_woo_extensions( $under_useful_plugins = true ) { $extensions = array( array( 'title' => 'CartFlows: Create Sales Funnel', 'subtitle' => $under_useful_plugins ? __( '#1 Sales Funnel WordPress Builder.', 'astra' ) : __( 'Build high-converting E-Commerce stores with CartFlows, the ultimate checkout and funnel builder.', 'astra' ), 'status' => self::get_plugin_status( 'cartflows/cartflows.php' ), 'slug' => 'cartflows', 'path' => 'cartflows/cartflows.php', 'redirection' => ( false === get_option( 'wcf_setup_complete', false ) && ! get_option( 'wcf_setup_skipped', false ) ) ? admin_url( 'index.php?page=cartflow-setup' ) : admin_url( 'admin.php?page=cartflows' ), 'ratings' => '(380+)', 'activations' => '200,000+', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/cartflows/assets/icon.svg', ), ), ); if ( ! $under_useful_plugins ) { $extensions[] = array( 'title' => 'SureTriggers: WordPress Automation', 'subtitle' => __( 'Connect your WordPress plugins, WooCommerce sites, apps, and websites for powerful automations.', 'astra' ), 'status' => self::get_plugin_status( 'suretriggers/suretriggers.php' ), 'slug' => 'suretriggers', 'path' => 'suretriggers/suretriggers.php', 'redirection' => admin_url( 'admin.php?page=suretriggers' ), 'ratings' => '(30+)', 'activations' => '50,000+', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/suretriggers/assets/icon-256x256.png', ), ); } $extensions[] = array( 'title' => 'Spectra: Blocks Builder', 'subtitle' => $under_useful_plugins ? __( 'Free WordPress Page Builder.', 'astra' ) : __( 'Power-up block editor with advanced blocks for faster and effortlessly website creation.', 'astra' ), 'status' => self::get_plugin_status( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ), 'slug' => 'ultimate-addons-for-gutenberg', 'path' => 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php', 'redirection' => admin_url( 'options-general.php?page=spectra' ), 'ratings' => '(1400+)', 'activations' => '800,000+', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/ultimate-addons-for-gutenberg/assets/icon.svg', ), ); $extensions[] = array( 'title' => $under_useful_plugins ? 'Stripe Payment' : 'Stripe Payment Gateway for WooCommerce', 'subtitle' => $under_useful_plugins ? __( 'Stripe Payments for WooCommerce.', 'astra' ) : __( 'Stripe Payments for WooCommerce securely accepts credit cards, Apple Pay, and Google Pay.', 'astra' ), 'status' => self::get_plugin_status( 'checkout-plugins-stripe-woo/checkout-plugins-stripe-woo.php' ), 'slug' => 'checkout-plugins-stripe-woo', 'path' => 'checkout-plugins-stripe-woo/checkout-plugins-stripe-woo.php', 'redirection' => ( false === get_option( 'cpsw_setup_status', false ) ) ? admin_url( 'index.php?page=cpsw-onboarding' ) : admin_url( 'admin.php?page=wc-settings&tab=cpsw_api_settings' ), 'ratings' => '(15+)', 'activations' => '100,000+', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/checkout-plugins-stripe-woo/assets/icon-128x128.gif', ), ); if ( ! $under_useful_plugins ) { $extensions[] = array( 'title' => 'PayPal Payments For WooCommerce', 'subtitle' => __( 'PayPal Payments For WooCommerce simplifies and secures PayPal transactions on your store.', 'astra' ), 'status' => self::get_plugin_status( 'checkout-paypal-woo/checkout-paypal-woo.php' ), 'slug' => 'checkout-paypal-woo', 'path' => 'checkout-paypal-woo/checkout-paypal-woo.php', 'redirection' => admin_url( 'admin.php?page=wc-settings&tab=cppw_api_settings' ), 'ratings' => '(2)', 'activations' => '3,000+', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/checkout-paypal-woo/assets/icon-128x128.jpg', ), ); } $extensions[] = array( 'title' => 'Cart Abandonment Recovery', 'subtitle' => $under_useful_plugins ? __( 'Recover lost revenue automatically.', 'astra' ) : __( 'Capture emails at checkout and send follow-up emails to recover lost revenue.', 'astra' ), 'status' => self::get_plugin_status( 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' ), 'slug' => 'woo-cart-abandonment-recovery', 'path' => 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php', 'redirection' => admin_url( 'admin.php?page=woo-cart-abandonment-recovery' ), 'ratings' => '(475+)', 'activations' => '200,000+', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/woo-cart-abandonment-recovery/assets/icon-128x128.png', ), ); if ( ! $under_useful_plugins ) { $extensions[] = array( 'title' => 'Variations Swatches by CartFlows', 'subtitle' => __( 'Convert WooCommerce variation dropdown attributes into attractive swatches instantly.', 'astra' ), 'status' => self::get_plugin_status( 'variation-swatches-woo/variation-swatches-woo.php' ), 'slug' => 'variation-swatches-woo', 'path' => 'variation-swatches-woo/variation-swatches-woo.php', 'redirection' => admin_url( 'admin.php?page=cfvsw_settings' ), 'ratings' => '(30+)', 'activations' => '200,000+', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/variation-swatches-woo/assets/icon.svg', ), ); } return $extensions; } /** * Get Astra's useful plugins. * Extend this in following way - * * // array( * // 'title' => "Plugin Name", * // 'subtitle' => "Plugin description goes here.", * // 'path' => 'plugin-slug/plugin-slug.php', * // 'redirection' => admin_url( 'admin.php?page=sc-dashboard' ), * // 'status' => self::get_plugin_status( 'plugin-slug/plugin-slug.php' ), * // 'logoPath' => array( * // 'internal_icon' => true, // true = will take internal Astra's any icon. false = provide next custom icon link. * // 'icon_path' => "spectra", // If internal_icon false then - example custom SVG URL: ASTRA_THEME_URI . 'inc/assets/images/astra.svg'. * // ), * // ), * * @since 4.0.0 * @return array */ public static function astra_get_useful_plugins() { // Making useful plugin section dynamic. if ( class_exists( 'WooCommerce' ) ) { $useful_plugins = self::astra_get_woo_extensions(); } else { $surecart_status = self::get_plugin_status( 'surecart/surecart.php' ); $surecart_redirection = 'activated' === $surecart_status ? 'sc-dashboard' : 'sc-getting-started'; $useful_plugins = array( array( 'title' => 'SureCart', 'subtitle' => __( 'The new way to sell on WordPress.', 'astra' ), 'status' => $surecart_status, 'slug' => 'surecart', 'path' => 'surecart/surecart.php', 'redirection' => admin_url( 'admin.php?page=' . esc_attr( $surecart_redirection ) ), 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/surecart/assets/icon-128x128.png', ), ), array( 'title' => 'Spectra', 'subtitle' => __( 'Free WordPress Page Builder.', 'astra' ), 'status' => self::get_plugin_status( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ), 'slug' => 'ultimate-addons-for-gutenberg', 'path' => 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php', 'redirection' => admin_url( 'options-general.php?page=spectra' ), 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/ultimate-addons-for-gutenberg/assets/icon.svg', ), ), array( 'title' => 'SureTriggers', 'subtitle' => __( 'Automate your WordPress setup.', 'astra' ), 'isPro' => false, 'status' => self::get_plugin_status( 'suretriggers/suretriggers.php' ), 'slug' => 'suretriggers', 'path' => 'suretriggers/suretriggers.php', 'redirection' => admin_url( 'admin.php?page=suretriggers' ), 'logoPath' => array( 'internal_icon' => true, 'icon_path' => 'suretriggers', ), ), array( 'title' => 'SureForms', 'subtitle' => __( 'A versatile form builder plugin.', 'astra' ), 'status' => self::get_plugin_status( 'sureforms/sureforms.php' ), 'slug' => 'sureforms', 'path' => 'sureforms/sureforms.php', 'redirection' => admin_url( 'admin.php?page=sureforms_menu' ), 'logoPath' => array( 'internal_icon' => true, 'icon_path' => 'sureforms', ), ), array( 'title' => 'Presto Player', 'subtitle' => __( 'Ultimate Video Player For WordPress.', 'astra' ), 'status' => self::get_plugin_status( 'presto-player/presto-player.php' ), 'slug' => 'presto-player', 'path' => 'presto-player/presto-player.php', 'redirection' => admin_url( 'edit.php?post_type=pp_video_block' ), 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/presto-player/assets/icon-128x128.png', ), ), ); } return apply_filters( 'astra_useful_plugins', $useful_plugins ); } /** * Get Astra's recommended integrations. * Extend this in following way - * * // array( * // 'title' => "Plugin Name", * // 'subtitle' => "Plugin description goes here.", * // 'isPro' => false, * // 'status' => self::get_plugin_status( 'plugin-slug/plugin-slug.php' ), * // 'path' => 'plugin-slug/plugin-slug.php', * // 'redirection' => admin_url( 'admin.php?page=sc-dashboard' ), * // 'logoPath' => array( * // 'internal_icon' => true, // true = will take internal Astra's any icon. false = provide next custom icon link. * // 'icon_path' => "spectra", // If internal_icon false then - example custom SVG URL: ASTRA_THEME_URI . 'inc/assets/images/astra.svg'. * // ), * // ), * * @since 4.0.0 * @return array */ public static function astra_get_integrations() { $surecart_status = self::get_plugin_status( 'surecart/surecart.php' ); $surecart_redirection = 'activated' === $surecart_status ? 'sc-dashboard' : 'sc-getting-started'; return apply_filters( 'astra_integrated_plugins', array( array( 'title' => 'Spectra', 'subtitle' => __( 'Free WordPress Page Builder Plugin.', 'astra' ), 'isPro' => false, 'status' => self::get_plugin_status( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ), 'slug' => 'ultimate-addons-for-gutenberg', 'path' => 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php', 'redirection' => admin_url( 'options-general.php?page=spectra' ), 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/ultimate-addons-for-gutenberg/assets/icon.svg', ), ), array( 'title' => 'SureCart', 'subtitle' => __( 'Simplifying selling online with WordPress.', 'astra' ), 'isPro' => false, 'status' => self::get_plugin_status( 'surecart/surecart.php' ), 'redirection' => admin_url( 'admin.php?page=' . esc_attr( $surecart_redirection ) ), 'slug' => 'surecart', 'path' => 'surecart/surecart.php', 'logoPath' => array( 'internal_icon' => false, 'icon_path' => 'https://ps.w.org/surecart/assets/icon-128x128.png', ), ), array( 'title' => 'SureTriggers', 'subtitle' => __( 'Automate your WordPress setup.', 'astra' ), 'isPro' => false, 'status' => self::get_plugin_status( 'suretriggers/suretriggers.php' ), 'slug' => 'suretriggers', 'path' => 'suretriggers/suretriggers.php', 'redirection' => admin_url( 'admin.php?page=suretriggers' ), 'logoPath' => array( 'internal_icon' => true, 'icon_path' => 'suretriggers', ), ), ) ); } /** * Settings app scripts * * @since 4.0.0 * @param array $localize Variable names. */ public function settings_app_scripts( $localize ) { $handle = 'astra-admin-dashboard-app'; $build_path = ASTRA_THEME_ADMIN_DIR . 'assets/build/'; $build_url = ASTRA_THEME_ADMIN_URL . 'assets/build/'; $script_asset_path = $build_path . 'dashboard-app.asset.php'; /** @psalm-suppress MissingFile */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $script_info = file_exists( $script_asset_path ) ? include $script_asset_path : array( // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way. 'dependencies' => array(), 'version' => ASTRA_THEME_VERSION, ); /** @psalm-suppress MissingFile */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $script_dep = array_merge( $script_info['dependencies'], array( 'updates', 'wp-hooks' ) ); wp_register_script( $handle, $build_url . 'dashboard-app.js', $script_dep, $script_info['version'], true ); wp_register_style( $handle, $build_url . 'dashboard-app.css', array(), ASTRA_THEME_VERSION ); wp_enqueue_script( $handle ); wp_set_script_translations( $handle, 'astra' ); wp_enqueue_style( $handle ); wp_style_add_data( $handle, 'rtl', 'replace' ); wp_localize_script( $handle, 'astra_admin', $localize ); } /** * Add footer link. * * @since 4.0.0 */ public function astra_admin_footer_link() { $theme_name = astra_get_theme_name(); /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $rating_url = ASTRA_THEME_ORG_VERSION ? 'https://wordpress.org/support/theme/astra/reviews/?rate=5#new-post' : 'https://woo.com/products/astra/#reviews'; /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( astra_is_white_labelled() ) { $footer_text = ' '; } else { $footer_text = sprintf( /* translators: 1: Astra, 2: Theme rating link */ __( 'Enjoyed %1$s? Please leave us a %2$s rating. We really appreciate your support!', 'astra' ), ' ' ); } return $footer_text; } } Astra_Menu::get_instance(); includes/class-astra-admin-ajax.php 0000644 00000032751 15032152110 0013305 0 ustar 00 errors = array( 'permission' => esc_html__( 'Sorry, you are not allowed to do this operation.', 'astra' ), 'nonce' => esc_html__( 'Nonce validation failed', 'astra' ), 'default' => esc_html__( 'Sorry, something went wrong.', 'astra' ), 'invalid' => esc_html__( 'No post data found!', 'astra' ), ); } ); add_action( 'wp_ajax_ast_disable_pro_notices', array( $this, 'disable_astra_pro_notices' ) ); add_action( 'wp_ajax_astra_recommended_plugin_install', array( $this, 'required_plugin_install' ) ); add_action( 'wp_ajax_ast_migrate_to_builder', array( $this, 'migrate_to_builder' ) ); add_action( 'wp_ajax_astra_update_admin_setting', array( $this, 'astra_update_admin_setting' ) ); add_action( 'wp_ajax_astra_recommended_plugin_activate', array( $this, 'required_plugin_activate' ) ); add_action( 'wp_ajax_astra_recommended_plugin_deactivate', array( $this, 'required_plugin_deactivate' ) ); } /** * Return boolean settings for admin dashboard app. * * @return array * @since 4.0.0 */ public function astra_admin_settings_typewise() { return apply_filters( 'astra_admin_settings_datatypes', array( 'self_hosted_gfonts' => 'bool', 'preload_local_fonts' => 'bool', 'use_old_header_footer' => 'bool', ) ); } /** * Disable pro upgrade notice from all over in Astra. * * @since 4.0.0 */ public function disable_astra_pro_notices() { $response_data = array( 'message' => $this->get_error_msg( 'permission' ) ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( $response_data ); } if ( empty( $_POST ) ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } /** * Nonce verification. */ if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) { $response_data = array( 'message' => $this->get_error_msg( 'nonce' ) ); wp_send_json_error( $response_data ); } if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( esc_html__( 'You don\'t have the access', 'astra' ) ); } /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrate = isset( $_POST['status'] ) ? sanitize_key( $_POST['status'] ) : ''; /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrate = ( 'true' === $migrate ) ? true : false; astra_update_option( 'ast-disable-upgrade-notices', $migrate ); wp_send_json_success(); } /** * Migrate to New Header Builder * * @since 4.0.0 */ public function migrate_to_builder() { $response_data = array( 'message' => $this->get_error_msg( 'permission' ) ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( $response_data ); } if ( empty( $_POST ) ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } /** * Nonce verification. */ if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) { $response_data = array( 'message' => $this->get_error_msg( 'nonce' ) ); wp_send_json_error( $response_data ); } /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrate = isset( $_POST['status'] ) ? sanitize_key( $_POST['status'] ) : ''; /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrate = ( 'true' === $migrate ) ? true : false; /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migration_flag = astra_get_option( 'v3-option-migration', false ); astra_update_option( 'is-header-footer-builder', $migrate ); if ( $migrate && false === $migration_flag ) { require_once ASTRA_THEME_DIR . 'inc/theme-update/astra-builder-migration-updater.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound astra_header_builder_migration(); } wp_send_json_success(); } /** * Save settings. * * @return void * @since 4.0.0 */ public function astra_update_admin_setting() { $response_data = array( 'message' => $this->get_error_msg( 'permission' ) ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( $response_data ); } if ( empty( $_POST ) ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } /** * Nonce verification. */ if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) { $response_data = array( 'message' => $this->get_error_msg( 'nonce' ) ); wp_send_json_error( $response_data ); } $get_bool_settings = $this->astra_admin_settings_typewise(); /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $sub_option_key = isset( $_POST['key'] ) ? sanitize_text_field( wp_unslash( $_POST['key'] ) ) : ''; /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $sub_option_value = ''; // @codingStandardsIgnoreStart if ( isset( $get_bool_settings[ $sub_option_key ] ) ) { if ( 'bool' === $get_bool_settings[ $sub_option_key ] ) { /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $val = isset( $_POST['value'] ) && 'true' === sanitize_text_field( $_POST['value'] ) ? true : false; /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $sub_option_value = $val; } else { /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $val = isset( $_POST['value'] ) ? sanitize_text_field( wp_unslash( $_POST['value'] ) ) : ''; /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $sub_option_value = $val; } } // @codingStandardsIgnoreEnd Astra_API_Init::update_admin_settings_option( $sub_option_key, $sub_option_value ); $response_data = array( 'message' => esc_html__( 'Successfully saved data!', 'astra' ), ); wp_send_json_success( $response_data ); } /** * Get ajax error message. * * @param string $type Message type. * @return string * @since 4.0.0 */ public function get_error_msg( $type ) { if ( ! isset( $this->errors[ $type ] ) ) { $type = 'default'; } return $this->errors[ $type ]; } /** * Handles the installation and saving of required plugins. * * This function is responsible for installing and saving required plugins for the Astra theme. * It checks for the plugin slug in the AJAX request, verifies the nonce, and initiates the plugin installation process. * If the plugin is successfully installed, it schedules a database update to map the plugin slug to a custom key for analytics tracking. * * @since x.x.x */ public function required_plugin_install() { check_ajax_referer( 'updates', '_ajax_nonce' ); // Fetching the plugin slug from the AJAX request. // @psalm-suppress PossiblyInvalidArgument $plugin_slug = isset( $_POST['slug'] ) && is_string( $_POST['slug'] ) ? sanitize_text_field( wp_unslash( $_POST['slug'] ) ) : ''; if ( empty( $plugin_slug ) ) { wp_send_json_error( array( 'message' => __( 'Plugin slug is missing.', 'astra' ) ) ); } // Schedule the database update if the plugin is installed successfully. add_action( 'shutdown', function () use ( $plugin_slug ) { // Iterate through all plugins to check if the installed plugin matches the current plugin slug. $all_plugins = get_plugins(); foreach ( $all_plugins as $plugin_file => $_ ) { if ( is_callable( '\BSF_UTM_Analytics\Inc\Utils::update_referer' ) && strpos( $plugin_file, $plugin_slug . '/' ) === 0 ) { // If the plugin is found and the update_referer function is callable, update the referer with the corresponding product slug. \BSF_UTM_Analytics\Inc\Utils::update_referer( 'astra', $plugin_slug ); return; } } } ); if ( function_exists( 'wp_ajax_install_plugin' ) ) { // @psalm-suppress NoValue wp_ajax_install_plugin(); } else { wp_send_json_error( array( 'message' => __( 'Plugin installation function not found.', 'astra' ) ) ); } } /** * Required Plugin Activate * * @since 1.2.4 */ public function required_plugin_activate() { $response_data = array( 'message' => $this->get_error_msg( 'permission' ) ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( $response_data ); } if ( empty( $_POST ) ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } /** * Nonce verification. */ if ( ! check_ajax_referer( 'astra_plugin_manager_nonce', 'security', false ) ) { $response_data = array( 'message' => $this->get_error_msg( 'nonce' ) ); wp_send_json_error( $response_data ); } /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) { /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_send_json_error( array( 'success' => false, 'message' => esc_html__( 'No plugin specified', 'astra' ), ) ); } /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $activate = activate_plugin( $plugin_init ); if ( is_wp_error( $activate ) ) { /** @psalm-suppress PossiblyNullReference */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_send_json_error( array( 'success' => false, 'message' => $activate->get_error_message(), ) ); /** @psalm-suppress PossiblyNullReference */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort } /** * Added this flag as tracker to track onboarding and funnel stats for SureCart owners. * * @since 4.7.0 */ if ( 'surecart/surecart.php' === $plugin_init ) { update_option( 'surecart_source', 'astra', false ); } wp_send_json_success( array( 'success' => true, 'message' => esc_html__( 'Plugin Successfully Activated', 'astra' ), ) ); } /** * Required Plugin Activate * * @since 1.2.4 */ public function required_plugin_deactivate() { $response_data = array( 'message' => $this->get_error_msg( 'permission' ) ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( $response_data ); } if ( empty( $_POST ) ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } /** * Nonce verification. */ if ( ! check_ajax_referer( 'astra_plugin_manager_nonce', 'security', false ) ) { $response_data = array( 'message' => $this->get_error_msg( 'nonce' ) ); wp_send_json_error( $response_data ); } /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) { /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_send_json_error( array( 'success' => false, 'message' => esc_html__( 'No plugin specified', 'astra' ), ) ); } /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $deactivate = deactivate_plugins( $plugin_init ); 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' => esc_html__( 'Plugin Successfully Deactivated', 'astra' ), ) ); } } Astra_Admin_Ajax::get_instance(); jsconfig.json 0000644 00000001146 15032152110 0007231 0 ustar 00 { "compilerOptions": { "baseUrl": ".", // This makes the root directory of your project the base for relative paths "paths": { "@astra-hooks": [ "assets/hooks/index.js" ], "@astra-hooks/*": [ "assets/hooks/*" ], "@astra-components": [ "assets/components/index.js" ], "@astra-components/*": [ "assets/components/*" ], "@astra-utils/*": [ "assets/utils/*" ], "@DashboardApp/*": [ "assets/src/dashboard-app/*" ], "@Admin/*": [ "assets/src/*" ], "@Utils/*": [ "assets/src/utils/*" ], "@Skeleton/*": [ "assets/src/common/skeleton/*" ], "@Common/*": [ "assets/src/common/*" ] } } } class-astra-admin-loader.php 0000644 00000003603 15032152110 0012014 0 ustar 00 includes(); } /** * Include required classes. * * @since 4.0.0 */ public function includes() { /* Ajax init */ require_once ASTRA_THEME_ADMIN_DIR . 'includes/class-astra-admin-ajax.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way. /* Setup Menu */ require_once ASTRA_THEME_ADMIN_DIR . 'includes/class-astra-menu.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way. require_once ASTRA_THEME_ADMIN_DIR . 'includes/class-astra-theme-builder-free.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way. } } endif; Astra_Admin_Loader::get_instance(); assets/utils/helpers.js 0000644 00000006631 15032152110 0011202 0 ustar 00 import { __ } from "@wordpress/i18n"; import apiFetch from '@wordpress/api-fetch'; /** * Returns the class names. * * @param {...string} classes The class names. * * @return {string} Returns the class names. */ const classNames = (...classes) => classes.filter(Boolean).join(" "); /** * Creates a debounced function that delays its execution until after the specified delay. * * The debounce() function can also be used from lodash.debounce package in future. * * @param {Function} func - The function to debounce. * @param {number} delay - The delay in milliseconds before the function is executed. * * @returns {Function} A debounced function. */ const debounce = ( func, delay ) => { let timer; function debounced( ...args ) { clearTimeout( timer ); timer = setTimeout( () => func( ...args ), delay ); }; // Attach a `cancel` method to clear the timeout. debounced.cancel = () => { clearTimeout( timer ); }; return debounced; }; /** * Returns the Astra Pro title. * * @return {string} Returns the Astra Pro title. */ const getAstraProTitle = () => { return astra_admin.pro_installed_status ? __("Activate Now", "astra") : __("Upgrade Now", "astra"); }; /** * Returns the spinner SVG text. * * @return {string} Returns the spinner SVG text.. */ const getSpinner = () => { return ` `; }; /** * A function to save astra admin settings. * * @function * * @param {string} key - Settings key. * @param {string} value - The data to send. * @param {Function} dispatch - The dispatch function. * @param {Object} abortControllerRef - The ref object with to hold abort controller. * * @return {Promise} Returns a promise representing the processed request. */ const saveSetting = debounce( (key, value, dispatch, abortControllerRef = { current: {} }) => { // Abort any previous request. if (abortControllerRef.current[key]) { abortControllerRef.current[key]?.abort(); } // Create a new AbortController. const abortController = new AbortController(); abortControllerRef.current[key] = abortController; const formData = new window.FormData(); formData.append("action", "astra_update_admin_setting"); formData.append("security", astra_admin.update_nonce); formData.append("key", key); formData.append("value", value); return apiFetch({ url: astra_admin.ajax_url, method: "POST", body: formData, signal: abortControllerRef.current[key]?.signal, // Pass the signal to the fetch request. }) .then(() => { dispatch({ type: "UPDATE_SETTINGS_SAVED_NOTIFICATION", payload: __("Successfully saved!", "astra"), }); }) .catch((error) => { // Ignore if it is intentionally aborted. if (error.name === "AbortError") { return; } console.error("Error during API request:", error); dispatch({ type: "UPDATE_SETTINGS_SAVED_NOTIFICATION", payload: __("An error occurred while saving.", "astra"), }); }); }, 300 ); export { classNames, debounce, getAstraProTitle, getSpinner, saveSetting }; assets/hooks/index.js 0000644 00000000124 15032152110 0010621 0 ustar 00 import useDebounceEffect from "./useDebounceEffect"; export { useDebounceEffect }; assets/hooks/useDebounceEffect.js 0000644 00000001671 15032152110 0013100 0 ustar 00 import { useEffect } from 'react'; import { debounce } from '@astra-utils/helpers'; /** * A hook that wraps a callback function with a debounce effect. * * This hook is designed to delay the execution of a function until after a specified delay. * It's particularly useful for handling events that occur rapidly, such as typing in a text input. * * @param {Function} callback - The function to debounce. * @param {number} delay - The delay in milliseconds before the function is executed. * @param {Array} dependencies - An array of dependencies that trigger the effect. */ function useDebounceEffect( callback, delay, dependencies ) { useEffect( () => { const debouncedCallback = debounce( callback, delay ); debouncedCallback(); // Cleanup on unmount or when dependencies change. return () => debouncedCallback.cancel && debouncedCallback.cancel(); }, [ callback, delay, ...dependencies ] ); } export default useDebounceEffect; assets/components/ProButton.js 0000644 00000003343 15032152111 0012517 0 ustar 00 import { __ } from "@wordpress/i18n"; import apiFetch from "@wordpress/api-fetch"; import DOMPurify from "dompurify"; import { classNames, getAstraProTitle, getSpinner } from "@astra-utils/helpers"; const ProButton = ({ className, isLink = false, url = astra_admin.upgrade_url, children = getAstraProTitle(), disableSpinner = false, }) => { const onGetAstraPro = (e) => { e.preventDefault(); e.stopPropagation(); if (!astra_admin.pro_installed_status) { window.open(url, "_blank"); } e.target.innerHTML = DOMPurify.sanitize( (disableSpinner ? "" : getSpinner()) + astra_admin.plugin_activating_text ); e.target.disabled = true; const formData = new window.FormData(); formData.append("action", "astra_recommended_plugin_activate"); formData.append("security", astra_admin.plugin_manager_nonce); formData.append("init", "astra-addon/astra-addon.php"); apiFetch({ url: astra_admin.ajax_url, method: "POST", body: formData, }) .then((data) => { if (data.success) { window.open(astra_admin.astra_base_url, "_self"); } }) .catch((error) => { e.target.innerText = __( "Activation failed. Please try again.", "astra" ); e.target.disabled = false; console.error("Error during API request:", error); // Optionally, notify the user about the error or handle it appropriately. }); }; const Tag = isLink ? "a" : "button"; const linkProps = isLink && { role: "button", href: url, target: "_blank", rel: "noreferrer", }; return ({description}
)} {/* Card Content */} {children} {/* Card Link */} {linkText && ( {linkText} )}'.concat(t.RSS_View_Instance.formatDate(new Date(n.date)),"
\n\t\t\t\t\t\t\t\t\t").concat(i,"\n\t\t\t\t\t\t\t\t\s*<\/p>/g,""),children:JSON.parse((null===(n=e.querySelector("children"))||void 0===n?void 0:n.innerHTML)||"{}")})})),Ti.setSessionData(JSON.stringify(this.data[t.key]),t.key),[2]}}))})))),[4,Promise.all(t)]);case 1:return n.sent(),[2,this.data]}}))}))},t}(),zi=function(){function t(t){this.RSS=t,this.createTriggerButton(),this.createFlyOut()}return t.prototype.getTriggerButtonID=function(){return"whats-new-rss-btn-".concat(this.RSS.getID())},t.prototype.getFlyoutID=function(){return"whats-new-rss-flyout-".concat(this.RSS.getID())},t.prototype.getFlyoutCloseBtnID=function(){return"whats-new-rss-flyout-close-".concat(this.RSS.getID())},t.prototype.getFlyoutMultiFeedNavID=function(){return"whats-new-rss-flyout-multi-feed-nav-".concat(this.RSS.getID())},t.prototype.setIsLoading=function(t){void 0===t&&(t=!1);var e=document.getElementById(this.getFlyoutID());t?e.classList.add("is-loading"):e.classList.remove("is-loading")},t.prototype.setNotification=function(t){var e=document.querySelector("#".concat(this.getTriggerButtonID()," .whats-new-rss-notification-badge"));t?(this.RSS.isMultiFeedRSS()?(e.innerHTML="",e.classList.add("is-multi-feed")):e.innerHTML=t>9?"9+":t.toString(),e.classList.remove("hide")):e.classList.add("hide")},t.prototype.createTriggerButton=function(){var t,e=this.RSS.getArgs().triggerButton.label;t=e?"\n\t\t\t".concat(this.RSS.getArgs().triggerButton.beforeBtn,'\n\t\t\t\n\t\t\t\t
".concat(o,' ').concat(i.label,"
"):"".concat(o,"
")},t.prototype.listChildrenPosts=function(t){var e=this,n=Object.values(t);if(!n.length)return"";var r=document.createElement("details"),a=document.createElement("summary"),i=document.createElement("div");return n.forEach((function(t){var n=(new DOMParser).parseFromString(t.post_content,"text/html"),r=document.createElement("div");r.classList.add("sub-version-item"),r.innerHTML='\n\t\t\t\tSee More
See Less
',r.appendChild(a),r.appendChild(i),i.classList.add("sub-version-items-wrapper"),r.classList.add("whats-new-rss-sub-version-details"),r.outerHTML},t.prototype.formatDate=function(t){if("function"==typeof this.RSS.getArgs().flyout.formatDate)return this.RSS.getArgs().flyout.formatDate(t);var e=new Date,n=t.getTime(),r=e.getTime()-n,a=36e5,i=24*a,s=7*i,o=30*i;if(r<6e4)return"Just now";if(r1?"s":""," ago")}if(r1?"s":""," ago")}if(r