File manager - Edit - /home/theblueo/tv/fb4e3b/core.tar
Back
class-astra-enqueue-scripts.php 0000666 00000022104 15210370260 0012623 0 ustar 00 <?php /** * Loader Functions * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Theme Enqueue Scripts */ if ( ! class_exists( 'Astra_Enqueue_Scripts' ) ) { /** * Theme Enqueue Scripts */ class Astra_Enqueue_Scripts { /** * Class styles. * * @access public * @var $styles Enqueued styles. */ public static $styles; /** * Class scripts. * * @access public * @var $scripts Enqueued scripts. */ public static $scripts; /** * Constructor */ public function __construct() { add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 ); add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_assets' ) ); add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) ); add_action( 'wp_print_footer_scripts', array( $this, 'astra_skip_link_focus_fix' ) ); } /** * Fix skip link focus in IE11. * * This does not enqueue the script because it is tiny and because it is only for IE11, * thus it does not warrant having an entire dedicated blocking script being loaded. * * @link https://git.io/vWdr2 * @link https://github.com/WordPress/twentynineteen/pull/47/files * @link https://github.com/ampproject/amphtml/issues/18671 */ public function astra_skip_link_focus_fix() { // Skip printing script on AMP content, since accessibility fix is covered by AMP framework. if ( astra_is_amp_endpoint() ) { return; } // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`. ?> <script> /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1); </script> <?php } /** * Admin body classes. * * Body classes to be added to <body> tag in admin page * * @param String $classes body classes returned from the filter. * @return String body classes to be added to <body> tag in admin page */ public function admin_body_class( $classes ) { $content_layout = astra_get_content_layout(); if ( 'content-boxed-container' == $content_layout ) { $classes .= ' ast-separate-container'; } elseif ( 'boxed-container' == $content_layout ) { $classes .= ' ast-separate-container ast-two-container'; } elseif ( 'page-builder' == $content_layout ) { $classes .= ' ast-page-builder-template'; } elseif ( 'plain-container' == $content_layout ) { $classes .= ' ast-plain-container'; } $classes .= ' ast-' . astra_page_layout(); return $classes; } /** * List of all assets. * * @return array assets array. */ public static function theme_assets() { $default_assets = array( // handle => location ( in /assets/js/ ) ( without .js ext). 'js' => array( 'astra-theme-js' => 'style', ), // handle => location ( in /assets/css/ ) ( without .css ext). 'css' => array( 'astra-theme-css' => 'style', ), ); return apply_filters( 'astra_theme_assets', $default_assets ); } /** * Add Fonts */ public function add_fonts() { $font_family = astra_get_option( 'body-font-family' ); $font_weight = astra_get_option( 'body-font-weight' ); $font_variant = astra_get_option( 'body-font-variant' ); Astra_Fonts::add_font( $font_family, $font_weight ); Astra_Fonts::add_font( $font_family, $font_variant ); // Render headings font. $heading_font_family = astra_get_option( 'headings-font-family' ); $heading_font_weight = astra_get_option( 'headings-font-weight' ); $heading_font_variant = astra_get_option( 'headings-font-variant' ); Astra_Fonts::add_font( $heading_font_family, $heading_font_weight ); Astra_Fonts::add_font( $heading_font_family, $heading_font_variant ); } /** * Enqueue Scripts */ public function enqueue_scripts() { if ( false === self::enqueue_theme_assets() ) { return; } /* Directory and Extension */ $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $js_uri = ASTRA_THEME_URI . 'assets/js/' . $dir_name . '/'; $css_uri = ASTRA_THEME_URI . 'assets/css/' . $dir_name . '/'; /** * IE Only Js and CSS Files. */ // Flexibility.js for flexbox IE10 support. wp_enqueue_script( 'astra-flexibility', $js_uri . 'flexibility' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false ); wp_add_inline_script( 'astra-flexibility', 'flexibility(document.documentElement);' ); wp_script_add_data( 'astra-flexibility', 'conditional', 'IE' ); // Polyfill for CustomEvent for IE. wp_register_script( 'astra-customevent', $js_uri . 'custom-events-polyfill' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false ); // All assets. $all_assets = self::theme_assets(); $styles = $all_assets['css']; $scripts = $all_assets['js']; if ( is_array( $styles ) && ! empty( $styles ) ) { // Register & Enqueue Styles. foreach ( $styles as $key => $style ) { $dependency = array(); // Add dynamic CSS dependency for all styles except for theme's style.css. if ( 'astra-theme-css' !== $key && class_exists( 'Astra_Cache_Base' ) ) { if ( ! Astra_Cache_Base::inline_assets() ) { $dependency[] = 'astra-theme-dynamic'; } } // Generate CSS URL. $css_file = $css_uri . $style . $file_prefix . '.css'; // Register. wp_register_style( $key, $css_file, $dependency, ASTRA_THEME_VERSION, 'all' ); // Enqueue. wp_enqueue_style( $key ); // RTL support. wp_style_add_data( $key, 'rtl', 'replace' ); } } // Fonts - Render Fonts. Astra_Fonts::render_fonts(); /** * Inline styles */ add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_output' ) ); add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_meta_output' ) ); // Submenu Container Animation. $menu_animation = astra_get_option( 'header-main-submenu-container-animation' ); $rtl = ( is_rtl() ) ? '-rtl' : ''; if ( ! empty( $menu_animation ) ) { if ( class_exists( 'Astra_Cache' ) ) { Astra_Cache::add_css_file( ASTRA_THEME_DIR . 'assets/css/' . $dir_name . '/menu-animation' . $rtl . $file_prefix . '.css' ); } else { wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation' . $file_prefix . '.css', null, ASTRA_THEME_VERSION, 'all' ); wp_enqueue_style( 'astra-menu-animation' ); } } if ( ! class_exists( 'Astra_Cache' ) ) { $theme_css_data = apply_filters( 'astra_dynamic_theme_css', '' ); wp_add_inline_style( 'astra-theme-css', $theme_css_data ); } if ( astra_is_amp_endpoint() ) { return; } // Comment assets. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_array( $scripts ) && ! empty( $scripts ) ) { // Register & Enqueue Scripts. foreach ( $scripts as $key => $script ) { // Register. wp_register_script( $key, $js_uri . $script . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, true ); // Enqueue. wp_enqueue_script( $key ); } } $astra_localize = array( 'break_point' => astra_header_break_point(), // Header Break Point. 'isRtl' => is_rtl(), ); wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) ); } /** * Trim CSS * * @since 1.0.0 * @param string $css CSS content to trim. * @return string */ public static function trim_css( $css = '' ) { // Trim white space for faster page loading. if ( ! empty( $css ) ) { $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css ); $css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), '', $css ); $css = str_replace( ', ', ',', $css ); } return $css; } /** * Enqueue Gutenberg assets. * * @since 1.5.2 * * @return void */ public function gutenberg_assets() { /* Directory and Extension */ $rtl = ''; if ( is_rtl() ) { $rtl = '-rtl'; } $css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css'; wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' ); // Render fonts in Gutenberg layout. Astra_Fonts::render_fonts(); wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_Editor_CSS::get_css() ) ); } /** * Function to check if enqueuing of Astra assets are disabled. * * @since 2.1.0 * @return boolean */ public static function enqueue_theme_assets() { return apply_filters( 'astra_enqueue_theme_assets', true ); } } new Astra_Enqueue_Scripts(); } class-astra-theme-options.php 0000666 00000033636 15210370260 0012276 0 ustar 00 <?php /** * Astra Theme Options * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Theme Options */ if ( ! class_exists( 'Astra_Theme_Options' ) ) { /** * Theme Options */ class Astra_Theme_Options { /** * Class instance. * * @access private * @var $instance Class instance. */ private static $instance; /** * Post id. * * @var $instance Post id. */ public static $post_id = null; /** * A static option variable. * * @since 1.0.0 * @access private * @var mixed $db_options */ private static $db_options; /** * A static option variable. * * @since 1.0.0 * @access private * @var mixed $db_options */ private static $db_options_no_defaults; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { // Refresh options variables after customizer save. add_action( 'after_setup_theme', array( $this, 'refresh' ) ); } /** * Set default theme option values * * @since 1.0.0 * @return default values of the theme. */ public static function defaults() { // Defaults list of options. return apply_filters( 'astra_theme_defaults', array( // Blog Single. 'blog-single-post-structure' => array( 'single-image', 'single-title-meta', ), 'blog-single-width' => 'default', 'blog-single-max-width' => 1200, 'blog-single-meta' => array( 'comments', 'category', 'author', ), // Blog. 'blog-post-structure' => array( 'image', 'title-meta', ), 'blog-width' => 'default', 'blog-max-width' => 1200, 'blog-post-content' => 'excerpt', 'blog-meta' => array( 'comments', 'category', 'author', ), // Colors. 'text-color' => '#3a3a3a', 'link-color' => '#0274be', 'theme-color' => '#0274be', 'link-h-color' => '#3a3a3a', // Footer Colors. 'footer-bg-obj' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', ), 'footer-color' => '', 'footer-link-color' => '', 'footer-link-h-color' => '', // Footer Widgets. 'footer-adv-bg-obj' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', ), 'footer-adv-text-color' => '', 'footer-adv-link-color' => '', 'footer-adv-link-h-color' => '', 'footer-adv-wgt-title-color' => '', // Buttons. 'button-color' => '', 'button-h-color' => '', 'button-bg-color' => '', 'button-bg-h-color' => '', 'theme-button-padding' => array( 'desktop' => array( 'top' => 10, 'right' => 40, 'bottom' => 10, 'left' => 40, ), 'tablet' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'mobile' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'button-radius' => 2, 'theme-button-border-group-border-size' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), // Footer - Small. 'footer-sml-layout' => 'footer-sml-layout-1', 'footer-sml-section-1' => 'custom', 'footer-sml-section-1-credit' => __( 'Copyright © [current_year] [site_title] | Powered by [theme_author]', 'astra' ), 'footer-sml-section-2' => '', 'footer-sml-section-2-credit' => __( 'Copyright © [current_year] [site_title] | Powered by [theme_author]', 'astra' ), 'footer-sml-dist-equal-align' => true, 'footer-sml-divider' => 1, 'footer-sml-divider-color' => '#7a7a7a', 'footer-layout-width' => 'content', // General. 'ast-header-retina-logo' => '', 'ast-header-logo-width' => '', 'ast-header-responsive-logo-width' => array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ), 'display-site-title' => 1, 'display-site-tagline' => 0, 'logo-title-inline' => 1, // Header - Primary. 'disable-primary-nav' => false, 'header-layouts' => 'header-main-layout-1', 'header-main-rt-section' => 'none', 'header-display-outside-menu' => false, 'header-main-rt-section-html' => '<button>' . __( 'Contact Us', 'astra' ) . '</button>', 'header-main-rt-section-button-text' => __( 'Button', 'astra' ), 'header-main-rt-section-button-link' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ), 'header-main-rt-section-button-link-option' => array( 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ), 'new_tab' => false, 'link_rel' => '', ), 'header-main-rt-section-button-style' => 'theme-button', 'header-main-rt-section-button-text-color' => '', 'header-main-rt-section-button-back-color' => '', 'header-main-rt-section-button-text-h-color' => '', 'header-main-rt-section-button-back-h-color' => '', 'header-main-rt-section-button-padding' => array( 'desktop' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'tablet' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'mobile' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), ), 'header-main-rt-section-button-border-size' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'header-main-sep' => 1, 'header-main-sep-color' => '', 'header-main-layout-width' => 'content', // Header - Sub menu Border. 'primary-submenu-border' => array( 'top' => '2', 'right' => '0', 'bottom' => '0', 'left' => '0', ), 'primary-submenu-item-border' => false, 'primary-submenu-b-color' => '', 'primary-submenu-item-b-color' => '', 'header-main-menu-label' => '', 'header-main-menu-align' => 'inline', 'header-main-submenu-container-animation' => 'fade', 'mobile-header-breakpoint' => '', 'mobile-header-logo' => '', 'mobile-header-logo-width' => '', // Site Layout. 'site-layout' => 'ast-full-width-layout', 'site-content-width' => 1200, 'site-layout-outside-bg-obj-responsive' => array( 'desktop' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', ), 'tablet' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', ), 'mobile' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', ), ), // Container. 'site-content-layout' => 'content-boxed-container', 'single-page-content-layout' => 'default', 'single-post-content-layout' => 'default', 'archive-post-content-layout' => 'default', // Typography. 'body-font-family' => 'inherit', 'body-font-variant' => '', 'body-font-weight' => 'inherit', 'font-size-body' => array( 'desktop' => 15, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'body-line-height' => '', 'para-margin-bottom' => '', 'body-text-transform' => '', 'headings-font-family' => 'inherit', 'headings-font-weight' => 'inherit', 'headings-text-transform' => '', 'headings-line-height' => '', 'font-size-site-title' => array( 'desktop' => 35, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-site-tagline' => array( 'desktop' => 15, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-entry-title' => array( 'desktop' => 30, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-archive-summary-title' => array( 'desktop' => 40, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-page-title' => array( 'desktop' => 40, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-h1' => array( 'desktop' => 40, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-h2' => array( 'desktop' => 30, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-h3' => array( 'desktop' => 25, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-h4' => array( 'desktop' => 20, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-h5' => array( 'desktop' => 18, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), 'font-size-h6' => array( 'desktop' => 15, 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ), // Sidebar. 'site-sidebar-layout' => 'right-sidebar', 'site-sidebar-width' => 30, 'single-page-sidebar-layout' => 'default', 'single-post-sidebar-layout' => 'default', 'archive-post-sidebar-layout' => 'default', // Sidebar. 'footer-adv' => 'disabled', 'footer-adv-border-width' => '', 'footer-adv-border-color' => '#7a7a7a', // toogle menu style. 'mobile-header-toggle-btn-style' => 'minimal', 'hide-custom-menu-mobile' => 1, // toogle menu target. 'mobile-header-toggle-target' => 'icon', ) ); } /** * Get theme options from static array() * * @return array Return array of theme options. */ public static function get_options() { return self::$db_options; } /** * Update theme static option array. */ public static function refresh() { self::$db_options = wp_parse_args( self::get_db_options(), self::defaults() ); } /** * Get theme options from static array() from database * * @return array Return array of theme options from database. */ public static function get_db_options() { self::$db_options_no_defaults = get_option( ASTRA_THEME_SETTINGS ); return self::$db_options_no_defaults; } } } /** * Kicking this off by calling 'get_instance()' method */ Astra_Theme_Options::get_instance(); class-astra-attr.php 0000666 00000005321 15210370260 0010443 0 ustar 00 <?php /** * Astra Attributes Class. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.6.2 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } if ( ! class_exists( 'Astra_Attr' ) ) : /** * Class Astra_Attr */ class Astra_Attr { /** * Store Instance on Current Class. * * @var object instance */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Initialuze the Class. * * @since 1.6.2 */ private function __construct() {} /** * Build list of attributes into a string and apply contextual filter on string. * * The contextual filter is of the form `astra_attr_{context}_output`. * * @since 1.6.2 * * @param string $context The context, to build filter name. * @param array $attributes Optional. Extra attributes to merge with defaults. * @param array $args Optional. Custom data to pass to filter. * @return string String of HTML attributes and values. */ public function astra_attr( $context, $attributes = array(), $args = array() ) { $attributes = $this->astra_parse_attr( $context, $attributes, $args ); $output = ''; // Cycle through attributes, build tag attribute string. foreach ( $attributes as $key => $value ) { if ( ! $value ) { continue; } if ( true === $value ) { $output .= esc_html( $key ) . ' '; } else { $output .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) ); } } $output = apply_filters( "astra_attr_{$context}_output", $output, $attributes, $context, $args ); return trim( $output ); } /** * Merge array of attributes with defaults, and apply contextual filter on array. * * The contextual filter is of the form `astra_attr_{context}`. * * @since 1.6.2 * * @param string $context The context, to build filter name. * @param array $attributes Optional. Extra attributes to merge with defaults. * @param array $args Optional. Custom data to pass to filter. * @return array Merged and filtered attributes. */ public function astra_parse_attr( $context, $attributes = array(), $args = array() ) { $defaults = array( 'class' => sanitize_html_class( $context ), ); $attributes = wp_parse_args( $attributes, $defaults ); // Contextual filter. return apply_filters( "astra_attr_{$context}", $attributes, $context, $args ); } } endif; /** * Kicking this off by calling 'get_instance()' method */ Astra_Attr::get_instance(); theme-hooks.php 0000666 00000021276 15210370260 0007510 0 ustar 00 <?php /** * Theme Hook Alliance hook stub list. * * @see https://github.com/zamoose/themehookalliance * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Themes and Plugins can check for astra_hooks using current_theme_supports( 'astra_hooks', $hook ) * to determine whether a theme declares itself to support this specific hook type. * * Example: * <code> * // Declare support for all hook types * add_theme_support( 'astra_hooks', array( 'all' ) ); * * // Declare support for certain hook types only * add_theme_support( 'astra_hooks', array( 'header', 'content', 'footer' ) ); * </code> */ add_theme_support( 'astra_hooks', array( /** * As a Theme developer, use the 'all' parameter, to declare support for all * hook types. * Please make sure you then actually reference all the hooks in this file, * Plugin developers depend on it! */ 'all', /** * Themes can also choose to only support certain hook types. * Please make sure you then actually reference all the hooks in this type * family. * * When the 'all' parameter was set, specific hook types do not need to be * added explicitly. */ 'html', 'body', 'head', 'header', 'content', 'entry', 'comments', 'sidebars', 'sidebar', 'footer', /** * If/when WordPress Core implements similar methodology, Themes and Plugins * will be able to check whether the version of THA supplied by the theme * supports Core hooks. */ ) ); /** * Determines, whether the specific hook type is actually supported. * * Plugin developers should always check for the support of a <strong>specific</strong> * hook type before hooking a callback function to a hook of this type. * * Example: * <code> * if ( current_theme_supports( 'astra_hooks', 'header' ) ) * add_action( 'astra_head_top', 'prefix_header_top' ); * </code> * * @param bool $bool true. * @param array $args The hook type being checked. * @param array $registered All registered hook types. * * @return bool */ function astra_current_theme_supports( $bool, $args, $registered ) { return in_array( $args[0], $registered[0] ) || in_array( 'all', $registered[0] ); } add_filter( 'current_theme_supports-astra_hooks', 'astra_current_theme_supports', 10, 3 ); /** * HTML <html> hook * Special case, useful for <DOCTYPE>, etc. * $astra_supports[] = 'html; */ function astra_html_before() { do_action( 'astra_html_before' ); } /** * HTML <body> hooks * $astra_supports[] = 'body'; */ function astra_body_top() { do_action( 'astra_body_top' ); } /** * Body Bottom */ function astra_body_bottom() { do_action( 'astra_body_bottom' ); } /** * HTML <head> hooks * * $astra_supports[] = 'head'; */ function astra_head_top() { do_action( 'astra_head_top' ); } /** * Head Bottom */ function astra_head_bottom() { do_action( 'astra_head_bottom' ); } /** * Semantic <header> hooks * * $astra_supports[] = 'header'; */ function astra_header_before() { do_action( 'astra_header_before' ); } /** * Site Header */ function astra_header() { do_action( 'astra_header' ); } /** * Masthead Top */ function astra_masthead_top() { do_action( 'astra_masthead_top' ); } /** * Masthead */ function astra_masthead() { do_action( 'astra_masthead' ); } /** * Masthead Bottom */ function astra_masthead_bottom() { do_action( 'astra_masthead_bottom' ); } /** * Header After */ function astra_header_after() { do_action( 'astra_header_after' ); } /** * Main Header bar top */ function astra_main_header_bar_top() { do_action( 'astra_main_header_bar_top' ); } /** * Main Header bar bottom */ function astra_main_header_bar_bottom() { do_action( 'astra_main_header_bar_bottom' ); } /** * Main Header Content */ function astra_masthead_content() { do_action( 'astra_masthead_content' ); } /** * Main toggle button before */ function astra_masthead_toggle_buttons_before() { do_action( 'astra_masthead_toggle_buttons_before' ); } /** * Main toggle buttons */ function astra_masthead_toggle_buttons() { do_action( 'astra_masthead_toggle_buttons' ); } /** * Main toggle button after */ function astra_masthead_toggle_buttons_after() { do_action( 'astra_masthead_toggle_buttons_after' ); } /** * Semantic <content> hooks * * $astra_supports[] = 'content'; */ function astra_content_before() { do_action( 'astra_content_before' ); } /** * Content after */ function astra_content_after() { do_action( 'astra_content_after' ); } /** * Content top */ function astra_content_top() { do_action( 'astra_content_top' ); } /** * Content bottom */ function astra_content_bottom() { do_action( 'astra_content_bottom' ); } /** * Content while before */ function astra_content_while_before() { do_action( 'astra_content_while_before' ); } /** * Content loop */ function astra_content_loop() { do_action( 'astra_content_loop' ); } /** * Conten Page Loop. * * Called from page.php */ function astra_content_page_loop() { do_action( 'astra_content_page_loop' ); } /** * Content while after */ function astra_content_while_after() { do_action( 'astra_content_while_after' ); } /** * Semantic <entry> hooks * * $astra_supports[] = 'entry'; */ function astra_entry_before() { do_action( 'astra_entry_before' ); } /** * Entry after */ function astra_entry_after() { do_action( 'astra_entry_after' ); } /** * Entry content before */ function astra_entry_content_before() { do_action( 'astra_entry_content_before' ); } /** * Entry content after */ function astra_entry_content_after() { do_action( 'astra_entry_content_after' ); } /** * Entry Top */ function astra_entry_top() { do_action( 'astra_entry_top' ); } /** * Entry bottom */ function astra_entry_bottom() { do_action( 'astra_entry_bottom' ); } /** * Single Post Header Before */ function astra_single_header_before() { do_action( 'astra_single_header_before' ); } /** * Single Post Header After */ function astra_single_header_after() { do_action( 'astra_single_header_after' ); } /** * Single Post Header Top */ function astra_single_header_top() { do_action( 'astra_single_header_top' ); } /** * Single Post Header Bottom */ function astra_single_header_bottom() { do_action( 'astra_single_header_bottom' ); } /** * Comments block hooks * * $astra_supports[] = 'comments'; */ function astra_comments_before() { do_action( 'astra_comments_before' ); } /** * Comments after. */ function astra_comments_after() { do_action( 'astra_comments_after' ); } /** * Semantic <sidebar> hooks * * $astra_supports[] = 'sidebar'; */ function astra_sidebars_before() { do_action( 'astra_sidebars_before' ); } /** * Sidebars after */ function astra_sidebars_after() { do_action( 'astra_sidebars_after' ); } /** * Semantic <footer> hooks * * $astra_supports[] = 'footer'; */ function astra_footer() { do_action( 'astra_footer' ); } /** * Footer before */ function astra_footer_before() { do_action( 'astra_footer_before' ); } /** * Footer after */ function astra_footer_after() { do_action( 'astra_footer_after' ); } /** * Footer top */ function astra_footer_content_top() { do_action( 'astra_footer_content_top' ); } /** * Footer */ function astra_footer_content() { do_action( 'astra_footer_content' ); } /** * Footer bottom */ function astra_footer_content_bottom() { do_action( 'astra_footer_content_bottom' ); } /** * Archive header */ function astra_archive_header() { do_action( 'astra_archive_header' ); } /** * Pagination */ function astra_pagination() { do_action( 'astra_pagination' ); } /** * Entry content single */ function astra_entry_content_single() { do_action( 'astra_entry_content_single' ); } /** * 404 */ function astra_entry_content_404_page() { do_action( 'astra_entry_content_404_page' ); } /** * Entry content blog */ function astra_entry_content_blog() { do_action( 'astra_entry_content_blog' ); } /** * Blog featured post section */ function astra_blog_post_featured_format() { do_action( 'astra_blog_post_featured_format' ); } /** * Primary Content Top */ function astra_primary_content_top() { do_action( 'astra_primary_content_top' ); } /** * Primary Content Bottom */ function astra_primary_content_bottom() { do_action( 'astra_primary_content_bottom' ); } /** * 404 Page content template action. */ function astra_404_content_template() { do_action( 'astra_404_content_template' ); } if ( ! function_exists( 'wp_body_open' ) ) { /** * Fire the wp_body_open action. * Adds backward compatibility for WordPress versions < 5.2 * * @since 1.8.7 */ function wp_body_open() { do_action( 'wp_body_open' ); } } view-general.php 0000666 00000002171 15210370260 0007643 0 ustar 00 <?php /** * View General * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } ?> <div class="ast-container ast-welcome"> <div id="poststuff"> <div id="post-body" class="columns-2"> <div id="post-body-content"> <!-- All WordPress Notices below header --> <h1 class="screen-reader-text"> <?php esc_html_e( 'Astra', 'astra' ); ?> </h1> <?php do_action( 'astra_welcome_page_content_before' ); ?> <?php do_action( 'astra_welcome_page_content' ); ?> <?php do_action( 'astra_welcome_page_content_after' ); ?> </div> <div class="postbox-container ast-sidebar" id="postbox-container-1"> <div id="side-sortables"> <?php do_action( 'astra_welcome_page_right_sidebar_before' ); ?> <?php do_action( 'astra_welcome_page_right_sidebar_content' ); ?> <?php do_action( 'astra_welcome_page_right_sidebar_after' ); ?> </div> </div> </div> <!-- /post-body --> <br class="clear"> </div> </div> class-theme-strings.php 0000666 00000011343 15210370260 0011153 0 ustar 00 <?php /** * Astra Theme Strings * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Default Strings */ if ( ! function_exists( 'astra_default_strings' ) ) { /** * Default Strings * * @since 1.0.0 * @param string $key String key. * @param boolean $echo Print string. * @return mixed Return string or nothing. */ function astra_default_strings( $key, $echo = true ) { $defaults = apply_filters( 'astra_default_strings', array( // Header. 'string-header-skip-link' => __( 'Skip to content', 'astra' ), // 404 Page Strings. 'string-404-sub-title' => __( 'It looks like the link pointing here was faulty. Maybe try searching?', 'astra' ), // Search Page Strings. 'string-search-nothing-found' => __( 'Nothing Found', 'astra' ), 'string-search-nothing-found-message' => __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'astra' ), 'string-full-width-search-message' => __( 'Start typing and press enter to search', 'astra' ), 'string-full-width-search-placeholder' => __( 'Search …', 'astra' ), 'string-header-cover-search-placeholder' => __( 'Search …', 'astra' ), 'string-search-input-placeholder' => __( 'Search …', 'astra' ), // Comment Template Strings. 'string-comment-reply-link' => __( 'Reply', 'astra' ), 'string-comment-edit-link' => __( 'Edit', 'astra' ), 'string-comment-awaiting-moderation' => __( 'Your comment is awaiting moderation.', 'astra' ), 'string-comment-title-reply' => __( 'Leave a Comment', 'astra' ), 'string-comment-cancel-reply-link' => __( 'Cancel Reply', 'astra' ), 'string-comment-label-submit' => __( 'Post Comment »', 'astra' ), 'string-comment-label-message' => __( 'Type here..', 'astra' ), 'string-comment-label-name' => __( 'Name*', 'astra' ), 'string-comment-label-email' => __( 'Email*', 'astra' ), 'string-comment-label-website' => __( 'Website', 'astra' ), 'string-comment-closed' => __( 'Comments are closed.', 'astra' ), 'string-comment-navigation-title' => __( 'Comment navigation', 'astra' ), 'string-comment-navigation-next' => __( 'Newer Comments', 'astra' ), 'string-comment-navigation-previous' => __( 'Older Comments', 'astra' ), // Blog Default Strings. 'string-blog-page-links-before' => __( 'Pages:', 'astra' ), 'string-blog-meta-author-by' => __( 'By ', 'astra' ), 'string-blog-meta-leave-a-comment' => __( 'Leave a Comment', 'astra' ), 'string-blog-meta-one-comment' => __( '1 Comment', 'astra' ), 'string-blog-meta-multiple-comment' => __( '% Comments', 'astra' ), 'string-blog-navigation-next' => __( 'Next Page', 'astra' ) . ' <span class="ast-right-arrow">→</span>', 'string-blog-navigation-previous' => '<span class="ast-left-arrow">←</span> ' . __( 'Previous Page', 'astra' ), // Single Post Default Strings. 'string-single-page-links-before' => __( 'Pages:', 'astra' ), /* translators: 1: Post type label */ 'string-single-navigation-next' => __( 'Next %s', 'astra' ) . ' <span class="ast-right-arrow">→</span>', /* translators: 1: Post type label */ 'string-single-navigation-previous' => '<span class="ast-left-arrow">←</span> ' . __( 'Previous %s', 'astra' ), // Content None. 'string-content-nothing-found-message' => __( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'astra' ), ) ); if ( is_rtl() ) { $defaults['string-blog-navigation-next'] = __( 'Next Page', 'astra' ) . ' <span class="ast-left-arrow">←</span>'; $defaults['string-blog-navigation-previous'] = '<span class="ast-right-arrow">→</span> ' . __( 'Previous Page', 'astra' ); /* translators: 1: Post type label */ $defaults['string-single-navigation-next'] = __( 'Next %s', 'astra' ) . ' <span class="ast-left-arrow">←</span>'; /* translators: 1: Post type label */ $defaults['string-single-navigation-previous'] = '<span class="ast-right-arrow">→</span> ' . __( 'Previous %s', 'astra' ); } $output = isset( $defaults[ $key ] ) ? $defaults[ $key ] : ''; /** * Print or return */ if ( $echo ) { echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $output; } } } class-gutenberg-editor-css.php 0000666 00000076175 15210370260 0012434 0 ustar 00 <?php /** * Gutenberg Editor CSS * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link http://wpastra.com/ * @since Astra 1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } if ( ! class_exists( 'Gutenberg_Editor_CSS' ) ) : /** * Admin Helper */ class Gutenberg_Editor_CSS { /** * Get dynamic CSS required for the block editor to make editing experience similar to how it looks on frontend. * * @return String CSS to be loaded in the editor interface. */ public static function get_css() { $site_content_width = astra_get_option( 'site-content-width', 1200 ) + 56; $headings_font_family = astra_get_option( 'headings-font-family' ); $headings_font_weight = astra_get_option( 'headings-font-weight' ); $headings_text_transform = astra_get_option( 'headings-text-transform' ); $headings_line_height = astra_get_option( 'headings-line-height' ); $single_post_title_font_size = astra_get_option( 'font-size-entry-title' ); $body_font_family = astra_body_font_family(); $para_margin_bottom = astra_get_option( 'para-margin-bottom' ); $theme_color = astra_get_option( 'theme-color' ); $link_color = astra_get_option( 'link-color', $theme_color ); $heading_base_color = astra_get_option( 'heading-base-color' ); $highlight_link_color = astra_get_foreground_color( $link_color ); $highlight_theme_color = astra_get_foreground_color( $theme_color ); $body_font_weight = astra_get_option( 'body-font-weight' ); $body_font_size = astra_get_option( 'font-size-body' ); $body_line_height = astra_get_option( 'body-line-height' ); $body_text_transform = astra_get_option( 'body-text-transform' ); $box_bg_obj = astra_get_option( 'site-layout-outside-bg-obj-responsive' ); $text_color = astra_get_option( 'text-color' ); $heading_h1_font_size = astra_get_option( 'font-size-h1' ); $heading_h2_font_size = astra_get_option( 'font-size-h2' ); $heading_h3_font_size = astra_get_option( 'font-size-h3' ); $heading_h4_font_size = astra_get_option( 'font-size-h4' ); $heading_h5_font_size = astra_get_option( 'font-size-h5' ); $heading_h6_font_size = astra_get_option( 'font-size-h6' ); /** * WooCommerce Grid Products compatibility. */ $link_h_color = astra_get_option( 'link-h-color' ); $btn_color = astra_get_option( 'button-color' ); $btn_bg_color = astra_get_option( 'button-bg-color', '', $theme_color ); $btn_h_color = astra_get_option( 'button-h-color' ); $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color ); $btn_border_radius = astra_get_option( 'button-radius' ); $theme_btn_padding = astra_get_option( 'theme-button-padding' ); /** * Button theme compatibility. */ $global_custom_button_border_size = astra_get_option( 'theme-button-border-group-border-size' ); $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' ); $btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' ); /** * Theme Button Typography */ $theme_btn_font_family = astra_get_option( 'font-family-button' ); $theme_btn_font_size = astra_get_option( 'font-size-button' ); $theme_btn_font_weight = astra_get_option( 'font-weight-button' ); $theme_btn_text_transform = astra_get_option( 'text-transform-button' ); $theme_btn_line_height = astra_get_option( 'theme-btn-line-height' ); $theme_btn_letter_spacing = astra_get_option( 'theme-btn-letter-spacing' ); $h1_font_family = astra_get_option( 'font-family-h1' ); $h1_font_weight = astra_get_option( 'font-weight-h1' ); $h1_line_height = astra_get_option( 'line-height-h1' ); $h1_text_transform = astra_get_option( 'text-transform-h1' ); $h2_font_family = astra_get_option( 'font-family-h2' ); $h2_font_weight = astra_get_option( 'font-weight-h2' ); $h2_line_height = astra_get_option( 'line-height-h2' ); $h2_text_transform = astra_get_option( 'text-transform-h2' ); $h3_font_family = astra_get_option( 'font-family-h3' ); $h3_font_weight = astra_get_option( 'font-weight-h3' ); $h3_line_height = astra_get_option( 'line-height-h3' ); $h3_text_transform = astra_get_option( 'text-transform-h3' ); // Fallback for H1 - headings typography. if ( 'inherit' == $h1_font_family ) { $h1_font_family = $headings_font_family; } if ( 'normal' == $h1_font_weight ) { $h1_font_weight = $headings_font_weight; } if ( '' == $h1_text_transform ) { $h1_text_transform = $headings_text_transform; } if ( '' == $h1_line_height ) { $h1_line_height = $headings_line_height; } // Fallback for H2 - headings typography. if ( 'inherit' == $h2_font_family ) { $h2_font_family = $headings_font_family; } if ( 'normal' == $h2_font_weight ) { $h2_font_weight = $headings_font_weight; } if ( '' == $h2_text_transform ) { $h2_text_transform = $headings_text_transform; } if ( '' == $h2_line_height ) { $h2_line_height = $headings_line_height; } // Fallback for H3 - headings typography. if ( 'inherit' == $h3_font_family ) { $h3_font_family = $headings_font_family; } if ( 'normal' == $h3_font_weight ) { $h3_font_weight = $headings_font_weight; } if ( '' == $h3_text_transform ) { $h3_text_transform = $headings_text_transform; } if ( '' == $h3_line_height ) { $h3_line_height = $headings_line_height; } // Fallback for H4 - headings typography. $h4_line_height = $headings_line_height; $h4_line_height = $headings_line_height; // Fallback for H5 - headings typography. $h4_line_height = $headings_line_height; $h5_line_height = $headings_line_height; // Fallback for H6 - headings typography. $h4_line_height = $headings_line_height; $h6_line_height = $headings_line_height; if ( empty( $btn_color ) ) { $btn_color = astra_get_foreground_color( $theme_color ); } if ( empty( $btn_h_color ) ) { $btn_h_color = astra_get_foreground_color( $link_h_color ); } $container_layout = get_post_meta( get_the_id(), 'site-content-layout', true ); if ( 'default' === $container_layout || '' === $container_layout ) { $container_layout = astra_get_option( 'single-' . get_post_type() . '-content-layout' ); if ( 'default' === $container_layout ) { $container_layout = astra_get_option( 'site-content-layout' ); } } if ( is_array( $body_font_size ) ) { $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15; } else { $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15; } $css = ''; $desktop_css = array( 'html' => array( 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ), ), 'a' => array( 'color' => esc_attr( $link_color ), ), // Global selection CSS. '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit:before' => array( 'background-color' => esc_attr( $theme_color ), ), '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit' => array( 'color' => esc_attr( $highlight_theme_color ), ), '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ), '.editor-post-title__block,.editor-default-block-appender,.block-editor-block-list__block' => array( 'max-width' => astra_get_css_value( $site_content_width, 'px' ), ), '.block-editor-block-list__block[data-align=wide]' => array( 'max-width' => astra_get_css_value( $site_content_width + 200, 'px' ), ), '.editor-post-title__block .editor-post-title__input, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6' => array( 'font-family' => astra_get_css_value( $headings_font_family, 'font' ), 'font-weight' => astra_get_css_value( $headings_font_weight, 'font' ), 'text-transform' => esc_attr( $headings_text_transform ), ), '.edit-post-visual-editor h1, .edit-post-visual-editor h2, .edit-post-visual-editor h3, .edit-post-visual-editor h4, .edit-post-visual-editor h5, .edit-post-visual-editor h6' => array( 'line-height' => esc_attr( $headings_line_height ), ), '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .block-editor-block-list__layout, .editor-post-title' => array( 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ), ), '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .wp-block-latest-posts a,.editor-default-block-appender textarea.editor-default-block-appender__content, .block-editor-block-list__block, .block-editor-block-list__block h1, .block-editor-block-list__block h2, .block-editor-block-list__block h3, .block-editor-block-list__block h4, .block-editor-block-list__block h5, .block-editor-block-list__block h6' => array( 'font-family' => astra_get_font_family( $body_font_family ), 'font-weight' => esc_attr( $body_font_weight ), 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ), 'line-height' => esc_attr( $body_line_height ), 'text-transform' => esc_attr( $body_text_transform ), 'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ), ), '.editor-post-title__block .editor-post-title__input' => array( 'font-family' => ( 'inherit' === $headings_font_family ) ? astra_get_font_family( $body_font_family ) : astra_get_font_family( $headings_font_family ), 'font-size' => astra_responsive_font( $single_post_title_font_size, 'desktop' ), 'font-weight' => 'normal', ), '.block-editor-block-list__block' => array( 'color' => esc_attr( $text_color ), ), /** * Content base heading color. */ '.editor-post-title__block .editor-post-title__input, .wc-block-grid__product-title, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6, .edit-post-visual-editor .wp-block-heading, .edit-post-visual-editor .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor .wp-block-uagb-advanced-heading h6' => array( 'color' => esc_attr( $heading_base_color ), ), // Blockquote Text Color. 'blockquote' => array( 'color' => astra_adjust_brightness( $text_color, 75, 'darken' ), ), 'blockquote .editor-rich-text__tinymce a' => array( 'color' => astra_hex_to_rgba( $link_color, 1 ), ), 'blockquote' => array( 'border-color' => astra_hex_to_rgba( $link_color, 0.05 ), ), '.block-editor-block-list__block .wp-block-quote:not(.is-large):not(.is-style-large), .edit-post-visual-editor .wp-block-pullquote blockquote' => array( 'border-color' => astra_hex_to_rgba( $link_color, 0.15 ), ), // Heading H1 - H6 font size. '.edit-post-visual-editor .block-editor-block-list__block h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array( 'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h1_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ), 'line-height' => esc_attr( $h1_line_height ), 'text-transform' => esc_attr( $h1_text_transform ), ), '.edit-post-visual-editor .block-editor-block-list__block h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array( 'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h2_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ), 'line-height' => esc_attr( $h2_line_height ), 'text-transform' => esc_attr( $h2_text_transform ), ), '.edit-post-visual-editor .block-editor-block-list__block h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array( 'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h3_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ), 'line-height' => esc_attr( $h3_line_height ), 'text-transform' => esc_attr( $h3_text_transform ), ), '.edit-post-visual-editor .block-editor-block-list__block h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array( 'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ), 'line-height' => esc_attr( $h4_line_height ), ), '.edit-post-visual-editor .block-editor-block-list__block h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array( 'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ), 'line-height' => esc_attr( $h5_line_height ), ), '.edit-post-visual-editor .block-editor-block-list__block h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array( 'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ), 'line-height' => esc_attr( $h6_line_height ), ), /** * WooCommerce Grid Products compatibility. */ '.wc-block-grid__product-title' => array( 'color' => esc_attr( $text_color ), ), '.wc-block-grid__product .wc-block-grid__product-onsale' => array( 'background-color' => $theme_color, 'color' => astra_get_foreground_color( $theme_color ), ), '.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wp-block-button__link, .wc-block-grid__product-onsale' => array( 'color' => $btn_color, 'border-color' => $btn_bg_color, 'background-color' => $btn_bg_color, ), '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array( 'color' => $btn_h_color, 'border-color' => $btn_bg_h_color, 'background-color' => $btn_bg_h_color, ), '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array( 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ), ), ); $css .= astra_parse_css( $desktop_css ); /** * Global button CSS - Tablet. */ $css_prod_button_tablet = array( '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array( 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ), ), ); $css .= astra_parse_css( $css_prod_button_tablet, '', astra_get_tablet_breakpoint() ); /** * Global button CSS - Mobile. */ $css_prod_button_mobile = array( '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array( 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ), ), ); $css .= astra_parse_css( $css_prod_button_mobile, '', astra_get_mobile_breakpoint() ); if ( Astra_Dynamic_CSS::page_builder_button_style_css() ) { $button_desktop_css = array( /** * Gutenberg button compatibility for default styling. */ '.wp-block-button .wp-block-button__link' => array( 'border-style' => 'solid', 'border-top-width' => ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '1px', 'border-right-width' => ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '1px', 'border-left-width' => ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '1px', 'border-bottom-width' => ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '1px', 'color' => esc_attr( $btn_color ), 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ), 'background-color' => esc_attr( $btn_bg_color ), 'font-family' => astra_get_font_family( $theme_btn_font_family ), 'font-weight' => esc_attr( $theme_btn_font_weight ), 'line-height' => esc_attr( $theme_btn_line_height ), 'text-transform' => esc_attr( $theme_btn_text_transform ), 'letter-spacing' => astra_get_css_value( $theme_btn_letter_spacing, 'px' ), 'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ), 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ), ), '.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' => array( 'color' => esc_attr( $btn_h_color ), 'background-color' => esc_attr( $btn_bg_h_color ), 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ), ), ); $css .= astra_parse_css( $button_desktop_css ); /** * Global button CSS - Tablet. */ $css_global_button_tablet = array( '.wp-block-button .wp-block-button__link' => array( 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ), ), ); $css .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() ); /** * Global button CSS - Mobile. */ $css_global_button_mobile = array( '.wp-block-button .wp-block-button__link' => array( 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ), ), ); $css .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() ); } $tablet_css = array( '.editor-post-title__block .editor-post-title__input' => array( 'font-size' => astra_responsive_font( $single_post_title_font_size, 'tablet', 30 ), ), // Heading H1 - H6 font size. '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array( 'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', 30 ), ), '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array( 'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', 25 ), ), '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array( 'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', 20 ), ), '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array( 'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ), ), '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array( 'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ), ), '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array( 'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ), ), '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'tablet' ), ); $css .= astra_parse_css( $tablet_css, '', astra_get_tablet_breakpoint() ); $mobile_css = array( '.editor-post-title__block .editor-post-title__input' => array( 'font-size' => astra_responsive_font( $single_post_title_font_size, 'mobile', 30 ), ), // Heading H1 - H6 font size. '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array( 'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', 30 ), ), '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array( 'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', 25 ), ), '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array( 'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', 20 ), ), '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array( 'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ), ), '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array( 'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ), ), '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array( 'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ), ), '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'mobile' ), ); $css .= astra_parse_css( $mobile_css, '', astra_get_mobile_breakpoint() ); if ( 'page-builder' === $container_layout ) { $page_builder_css = array( '.editor-post-title__block, .editor-default-block-appender, .block-editor-block-list__block' => array( 'width' => '100%', 'max-width' => '100%', ), '.block-editor-block-list__layout' => array( 'padding-left' => 0, 'padding-right' => 0, ), '.editor-block-list__block-edit .editor-block-list__block-edit' => array( 'padding-left' => '0', 'padding-right' => '0', ), '.edit-post-visual-editor .block-editor-block-list__block' => array( 'padding-left' => '20px', 'padding-right' => '20px', ), '.edit-post-visual-editor .wp-block .block-editor-block-list__block' => array( 'padding-left' => '0', 'padding-right' => '0', ), ); $css .= astra_parse_css( $page_builder_css ); } if ( 'page-builder' === $container_layout || 'plain-container' === $container_layout ) { $aligned_full_content_css = array( '.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array( 'margin-left' => '0', 'margin-right' => '0', ), '.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"]' => array( 'margin-left' => '0', 'margin-right' => '0', ), ); $css .= astra_parse_css( $aligned_full_content_css ); } if ( 'page-builder' === $container_layout ) { $full_width_streched_css = array( '.block-editor-block-list__layout' => array( 'margin-left' => '60px', 'margin-right' => '60px', ), // WordPress 5.4 compatibility CSS. '.wp-block .block-editor-block-list__layout' => array( 'margin-left' => '0px', 'margin-right' => '0px', ), ); $css .= astra_parse_css( $full_width_streched_css ); } if ( 'content-boxed-container' === $container_layout || 'boxed-container' === $container_layout ) { $boxed_container = array( '.block-editor-writing-flow' => array( 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ), 'margin' => '0 auto', 'background-color' => '#fff', ), '.gutenberg__editor' => array( 'background-color' => '#f5f5f5', ), '.block-editor-block-list__layout, .editor-post-title' => array( 'padding-top' => 'calc( 5.34em - 19px)', 'padding-bottom' => '5.34em', 'padding-left' => 'calc( 6.67em - 28px )', 'padding-right' => 'calc( 6.67em - 28px )', ), '.block-editor-block-list__layout' => array( 'padding-top' => '0', ), '.editor-post-title' => array( 'padding-bottom' => '0', ), '.block-editor-block-list__block' => array( 'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)', ), '.block-editor-block-list__block[data-align=wide]' => array( 'margin-left' => '-20px', 'margin-right' => '-20px', ), '.block-editor-block-list__block[data-align=full]' => array( 'margin-left' => '-6.67em', 'margin-right' => '-6.67em', ), '.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .editor-block-list__block-edit' => array( 'margin-left' => '0', 'margin-right' => '0', ), ); $css .= astra_parse_css( $boxed_container ); } return $css; } } endif; common-functions.php 0000666 00000117423 15210370260 0010563 0 ustar 00 <?php /** * Functions for Astra Theme. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Foreground Color */ if ( ! function_exists( 'astra_get_foreground_color' ) ) { /** * Foreground Color * * @param string $hex Color code in HEX format. * @return string Return foreground color depend on input HEX color. */ function astra_get_foreground_color( $hex ) { // bail early if color's not set. if ( 'transparent' == $hex || 'false' == $hex || '#' == $hex || empty( $hex ) ) { return 'transparent'; } // Get clean hex code. $hex = str_replace( '#', '', $hex ); if ( 3 == strlen( $hex ) ) { $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 ); } // Get r, g & b codes from hex code. $r = hexdec( substr( $hex, 0, 2 ) ); $g = hexdec( substr( $hex, 2, 2 ) ); $b = hexdec( substr( $hex, 4, 2 ) ); $hex = ( ( $r * 299 ) + ( $g * 587 ) + ( $b * 114 ) ) / 1000; return 128 <= $hex ? '#000000' : '#ffffff'; } } /** * Generate CSS */ if ( ! function_exists( 'astra_css' ) ) { /** * Generate CSS * * @param mixed $value CSS value. * @param string $css_property CSS property. * @param string $selector CSS selector. * @param string $unit CSS property unit. * @return void Echo generated CSS. */ function astra_css( $value = '', $css_property = '', $selector = '', $unit = '' ) { if ( $selector ) { if ( $css_property && $value ) { if ( '' != $unit ) { $value .= $unit; } $css = $selector; $css .= '{'; $css .= ' ' . $css_property . ': ' . $value . ';'; $css .= '}'; echo $css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } } } /** * Get Font Size value */ if ( ! function_exists( 'astra_responsive_font' ) ) { /** * Get Font CSS value * * @param array $font CSS value. * @param string $device CSS device. * @param string $default Default value. * @return mixed */ function astra_responsive_font( $font, $device = 'desktop', $default = '' ) { $css_val = ''; if ( isset( $font[ $device ] ) && isset( $font[ $device . '-unit' ] ) ) { if ( '' != $default ) { $font_size = astra_get_css_value( $font[ $device ], $font[ $device . '-unit' ], $default ); } else { $font_size = astra_get_font_css_value( $font[ $device ], $font[ $device . '-unit' ] ); } } elseif ( is_numeric( $font ) ) { $font_size = astra_get_css_value( $font ); } else { $font_size = ( ! is_array( $font ) ) ? $font : ''; } return $font_size; } } /** * Get Font Size value */ if ( ! function_exists( 'astra_get_font_css_value' ) ) { /** * Get Font CSS value * * Syntax: * * astra_get_font_css_value( VALUE, DEVICE, UNIT ); * * E.g. * * astra_get_css_value( VALUE, 'desktop', '%' ); * astra_get_css_value( VALUE, 'tablet' ); * astra_get_css_value( VALUE, 'mobile' ); * * @param string $value CSS value. * @param string $unit CSS unit. * @param string $device CSS device. * @return mixed CSS value depends on $unit & $device */ function astra_get_font_css_value( $value, $unit = 'px', $device = 'desktop' ) { // If value is empty or 0 then return blank. if ( '' == $value || 0 == $value ) { return ''; } $css_val = ''; switch ( $unit ) { case 'em': case '%': $css_val = esc_attr( $value ) . $unit; break; case 'px': if ( is_numeric( $value ) || strpos( $value, 'px' ) ) { $value = intval( $value ); $fonts = array(); $body_font_size = astra_get_option( 'font-size-body' ); $fonts['desktop'] = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15; $fonts['tablet'] = ( isset( $body_font_size['tablet'] ) && '' != $body_font_size['tablet'] ) ? $body_font_size['tablet'] : $fonts['desktop']; $fonts['mobile'] = ( isset( $body_font_size['mobile'] ) && '' != $body_font_size['mobile'] ) ? $body_font_size['mobile'] : $fonts['tablet']; if ( $fonts[ $device ] ) { $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $fonts[ $device ] ) ) . 'rem'; } } else { $css_val = esc_attr( $value ); } } return $css_val; } } /** * Get Font family */ if ( ! function_exists( 'astra_get_font_family' ) ) { /** * Get Font family * * Syntax: * * astra_get_font_family( VALUE, DEFAULT ); * * E.g. * astra_get_font_family( VALUE, '' ); * * @since 1.0.19 * * @param string $value CSS value. * @return mixed CSS value depends on $unit */ function astra_get_font_family( $value = '' ) { $system_fonts = Astra_Font_Families::get_system_fonts(); if ( isset( $system_fonts[ $value ] ) && isset( $system_fonts[ $value ]['fallback'] ) ) { $value .= ',' . $system_fonts[ $value ]['fallback']; } return $value; } } /** * Get CSS value */ if ( ! function_exists( 'astra_get_css_value' ) ) { /** * Get CSS value * * Syntax: * * astra_get_css_value( VALUE, UNIT ); * * E.g. * * astra_get_css_value( VALUE, 'url' ); * astra_get_css_value( VALUE, 'px' ); * astra_get_css_value( VALUE, 'em' ); * * @param string $value CSS value. * @param string $unit CSS unit. * @param string $default CSS default font. * @return mixed CSS value depends on $unit */ function astra_get_css_value( $value = '', $unit = 'px', $default = '' ) { if ( '' == $value && '' == $default ) { return $value; } $css_val = ''; switch ( $unit ) { case 'font': if ( 'inherit' != $value ) { $value = astra_get_font_family( $value ); $css_val = $value; } elseif ( '' != $default ) { $css_val = $default; } else { $css_val = ''; } break; case 'px': case '%': if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) { return $value; } $value = ( '' != $value ) ? $value : $default; $css_val = esc_attr( $value ) . $unit; break; case 'url': $css_val = $unit . '(' . esc_url( $value ) . ')'; break; case 'rem': if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) { return $value; } if ( is_numeric( $value ) || strpos( $value, 'px' ) ) { $value = intval( $value ); $body_font_size = astra_get_option( 'font-size-body' ); if ( is_array( $body_font_size ) ) { $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15; } else { $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15; } if ( $body_font_size_desktop ) { $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $body_font_size_desktop ) ) . $unit; } } else { $css_val = esc_attr( $value ); } break; default: $value = ( '' != $value ) ? $value : $default; if ( '' != $value ) { $css_val = esc_attr( $value ) . $unit; } } return $css_val; } } /** * Adjust the background obj. */ if ( ! function_exists( 'astra_get_background_obj' ) ) { /** * Adjust Brightness * * @param array $bg_obj Color code in HEX. * * @return array Color code in HEX. */ function astra_get_background_obj( $bg_obj ) { $gen_bg_css = array(); $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : ''; $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color ) { $gen_bg_css = array( 'background-color' => 'unset', 'background-image' => 'linear-gradient(to right, ' . esc_attr( $bg_color ) . ', ' . esc_attr( $bg_color ) . '), url(' . esc_url( $bg_img ) . ')', ); } elseif ( '' !== $bg_img ) { $gen_bg_css = array( 'background-image' => 'url(' . esc_url( $bg_img ) . ')' ); } elseif ( '' !== $bg_color ) { $gen_bg_css = array( 'background-color' => esc_attr( $bg_color ) ); } if ( '' !== $bg_img ) { if ( isset( $bg_obj['background-repeat'] ) ) { $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] ); } if ( isset( $bg_obj['background-position'] ) ) { $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] ); } if ( isset( $bg_obj['background-size'] ) ) { $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] ); } if ( isset( $bg_obj['background-attachment'] ) ) { $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] ); } } return $gen_bg_css; } } /** * Parse CSS */ if ( ! function_exists( 'astra_parse_css' ) ) { /** * Parse CSS * * @param array $css_output Array of CSS. * @param string $min_media Min Media breakpoint. * @param string $max_media Max Media breakpoint. * @return string Generated CSS. */ function astra_parse_css( $css_output = array(), $min_media = '', $max_media = '' ) { $parse_css = ''; if ( is_array( $css_output ) && count( $css_output ) > 0 ) { foreach ( $css_output as $selector => $properties ) { if ( null === $properties ) { break; } if ( ! count( $properties ) ) { continue; } $temp_parse_css = $selector . '{'; $properties_added = 0; foreach ( $properties as $property => $value ) { if ( '' === $value ) { continue; } $properties_added++; $temp_parse_css .= $property . ':' . $value . ';'; } $temp_parse_css .= '}'; if ( $properties_added > 0 ) { $parse_css .= $temp_parse_css; } } if ( '' != $parse_css && ( '' !== $min_media || '' !== $max_media ) ) { $media_css = '@media '; $min_media_css = ''; $max_media_css = ''; $media_separator = ''; if ( '' !== $min_media ) { $min_media_css = '(min-width:' . $min_media . 'px)'; } if ( '' !== $max_media ) { $max_media_css = '(max-width:' . $max_media . 'px)'; } if ( '' !== $min_media && '' !== $max_media ) { $media_separator = ' and '; } $media_css .= $min_media_css . $media_separator . $max_media_css . '{' . $parse_css . '}'; return $media_css; } } return $parse_css; } } /** * Return Theme options. */ if ( ! function_exists( 'astra_get_option' ) ) { /** * Return Theme options. * * @param string $option Option key. * @param string $default Option default value. * @param string $deprecated Option default value. * @return Mixed Return option value. */ function astra_get_option( $option, $default = '', $deprecated = '' ) { if ( '' != $deprecated ) { $default = $deprecated; } $theme_options = Astra_Theme_Options::get_options(); /** * Filter the options array for Astra Settings. * * @since 1.0.20 * @var Array */ $theme_options = apply_filters( 'astra_get_option_array', $theme_options, $option, $default ); $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default; /** * Dynamic filter astra_get_option_$option. * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme. * * @since 1.0.20 * @var Mixed. */ return apply_filters( "astra_get_option_{$option}", $value, $option, $default ); } } if ( ! function_exists( 'astra_update_option' ) ) { /** * Update Theme options. * * @param string $option option key. * @param Mixed $value option value. * @return void */ function astra_update_option( $option, $value ) { do_action( "astra_before_update_option_{$option}", $value, $option ); // Get all customizer options. $theme_options = get_option( ASTRA_THEME_SETTINGS ); // Update value in options array. $theme_options[ $option ] = $value; update_option( ASTRA_THEME_SETTINGS, $theme_options ); do_action( "astra_after_update_option_{$option}", $value, $option ); } } if ( ! function_exists( 'astra_delete_option' ) ) { /** * Update Theme options. * * @param string $option option key. * @return void */ function astra_delete_option( $option ) { do_action( "astra_before_delete_option_{$option}", $option ); // Get all customizer options. $theme_options = get_option( ASTRA_THEME_SETTINGS ); // Update value in options array. unset( $theme_options[ $option ] ); update_option( ASTRA_THEME_SETTINGS, $theme_options ); do_action( "astra_after_delete_option_{$option}", $option ); } } /** * Return Theme options from postmeta. */ if ( ! function_exists( 'astra_get_option_meta' ) ) { /** * Return Theme options from postmeta. * * @param string $option_id Option ID. * @param string $default Option default value. * @param boolean $only_meta Get only meta value. * @param string $extension Is value from extension. * @param string $post_id Get value from specific post by post ID. * @return Mixed Return option value. */ function astra_get_option_meta( $option_id, $default = '', $only_meta = false, $extension = '', $post_id = '' ) { $post_id = ( '' != $post_id ) ? $post_id : astra_get_post_id(); $value = astra_get_option( $option_id, $default ); // Get value from option 'post-meta'. if ( is_singular() || ( is_home() && ! is_front_page() ) ) { $value = get_post_meta( $post_id, $option_id, true ); if ( empty( $value ) || 'default' == $value ) { if ( true == $only_meta ) { return false; } $value = astra_get_option( $option_id, $default ); } } /** * Dynamic filter astra_get_option_meta_$option. * $option_id is the name of the Astra Meta Setting. * * @since 1.0.20 * @var Mixed. */ return apply_filters( "astra_get_option_meta_{$option_id}", $value, $default, $default ); } } /** * Helper function to get the current post id. */ if ( ! function_exists( 'astra_get_post_id' ) ) { /** * Get post ID. * * @param string $post_id_override Get override post ID. * @return number Post ID. */ function astra_get_post_id( $post_id_override = '' ) { if ( null == Astra_Theme_Options::$post_id ) { global $post; $post_id = 0; if ( is_home() ) { $post_id = get_option( 'page_for_posts' ); } elseif ( is_archive() ) { global $wp_query; $post_id = $wp_query->get_queried_object_id(); } elseif ( isset( $post->ID ) && ! is_search() && ! is_category() ) { $post_id = $post->ID; } Astra_Theme_Options::$post_id = $post_id; } return apply_filters( 'astra_get_post_id', Astra_Theme_Options::$post_id, $post_id_override ); } } /** * Display classes for primary div */ if ( ! function_exists( 'astra_primary_class' ) ) { /** * Display classes for primary div * * @param string|array $class One or more classes to add to the class list. * @return void Echo classes. */ function astra_primary_class( $class = '' ) { // Separates classes with a single space, collates classes for body element. echo 'class="' . esc_attr( join( ' ', astra_get_primary_class( $class ) ) ) . '"'; } } /** * Retrieve the classes for the primary element as an array. */ if ( ! function_exists( 'astra_get_primary_class' ) ) { /** * Retrieve the classes for the primary element as an array. * * @param string|array $class One or more classes to add to the class list. * @return array Return array of classes. */ function astra_get_primary_class( $class = '' ) { // array of class names. $classes = array(); // default class for content area. $classes[] = 'content-area'; // primary base class. $classes[] = 'primary'; if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { // Ensure that we always coerce class to being an array. $class = array(); } // Filter primary div class names. $classes = apply_filters( 'astra_primary_class', $classes, $class ); $classes = array_map( 'sanitize_html_class', $classes ); return array_unique( $classes ); } } /** * Display classes for secondary div */ if ( ! function_exists( 'astra_secondary_class' ) ) { /** * Retrieve the classes for the secondary element as an array. * * @param string|array $class One or more classes to add to the class list. * @return void echo classes. */ function astra_secondary_class( $class = '' ) { // Separates classes with a single space, collates classes for body element. echo 'class="' . esc_attr( join( ' ', astra_get_secondary_class( $class ) ) ) . '"'; } } /** * Retrieve the classes for the secondary element as an array. */ if ( ! function_exists( 'astra_get_secondary_class' ) ) { /** * Retrieve the classes for the secondary element as an array. * * @param string|array $class One or more classes to add to the class list. * @return array Return array of classes. */ function astra_get_secondary_class( $class = '' ) { // array of class names. $classes = array(); // default class from widget area. $classes[] = 'widget-area'; // secondary base class. $classes[] = 'secondary'; if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { // Ensure that we always coerce class to being an array. $class = array(); } // Filter secondary div class names. $classes = apply_filters( 'astra_secondary_class', $classes, $class ); $classes = array_map( 'sanitize_html_class', $classes ); return array_unique( $classes ); } } /** * Get post format */ if ( ! function_exists( 'astra_get_post_format' ) ) { /** * Get post format * * @param string $post_format_override Override post formate. * @return string Return post format. */ function astra_get_post_format( $post_format_override = '' ) { if ( ( is_home() ) || is_archive() ) { $post_format = 'blog'; } else { $post_format = get_post_format(); } return apply_filters( 'astra_get_post_format', $post_format, $post_format_override ); } } /** * Wrapper function for get_the_title() for blog post. */ if ( ! function_exists( 'astra_the_post_title' ) ) { /** * Wrapper function for get_the_title() for blog post. * * Displays title only if the page title bar is disabled. * * @since 1.0.15 * @param string $before Optional. Content to prepend to the title. * @param string $after Optional. Content to append to the title. * @param int $post_id Optional, default to 0. Post id. * @param bool $echo Optional, default to true.Whether to display or return. * @return string|void String if $echo parameter is false. */ function astra_the_post_title( $before = '', $after = '', $post_id = 0, $echo = true ) { $enabled = apply_filters( 'astra_the_post_title_enabled', true ); if ( $enabled ) { $title = astra_get_the_title( $post_id ); $before = apply_filters( 'astra_the_post_title_before', $before ); $after = apply_filters( 'astra_the_post_title_after', $after ); // This will work same as `the_title` function but with Custom Title if exits. if ( $echo ) { echo $before . $title . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $before . $title . $after; } } } } /** * Wrapper function for the_title() */ if ( ! function_exists( 'astra_the_title' ) ) { /** * Wrapper function for the_title() * * Displays title only if the page title bar is disabled. * * @param string $before Optional. Content to prepend to the title. * @param string $after Optional. Content to append to the title. * @param int $post_id Optional, default to 0. Post id. * @param bool $echo Optional, default to true.Whether to display or return. * @return string|void String if $echo parameter is false. */ function astra_the_title( $before = '', $after = '', $post_id = 0, $echo = true ) { $title = ''; $blog_post_title = astra_get_option( 'blog-post-structure' ); $single_post_title = astra_get_option( 'blog-single-post-structure' ); if ( ( ( ! is_singular() && in_array( 'title-meta', $blog_post_title ) ) || ( is_single() && in_array( 'single-title-meta', $single_post_title ) ) || is_page() ) ) { if ( apply_filters( 'astra_the_title_enabled', true ) ) { $title = astra_get_the_title( $post_id ); $before = apply_filters( 'astra_the_title_before', $before ); $after = apply_filters( 'astra_the_title_after', $after ); $title = $before . $title . $after; } } // This will work same as `the_title` function but with Custom Title if exits. if ( $echo ) { echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $title; } } } /** * Wrapper function for get_the_title() */ if ( ! function_exists( 'astra_get_the_title' ) ) { /** * Wrapper function for get_the_title() * * Return title for Title Bar and Normal Title. * * @param int $post_id Optional, default to 0. Post id. * @param bool $echo Optional, default to false. Whether to display or return. * @return string|void String if $echo parameter is false. */ function astra_get_the_title( $post_id = 0, $echo = false ) { $title = ''; if ( $post_id || is_singular() ) { $title = get_the_title( $post_id ); } else { if ( is_front_page() && is_home() ) { // Default homepage. $title = apply_filters( 'astra_the_default_home_page_title', esc_html__( 'Home', 'astra' ) ); } elseif ( is_home() ) { // blog page. $title = apply_filters( 'astra_the_blog_home_page_title', get_the_title( get_option( 'page_for_posts', true ) ) ); } elseif ( is_404() ) { // for 404 page - title always display. $title = apply_filters( 'astra_the_404_page_title', esc_html__( 'This page doesn\'t seem to exist.', 'astra' ) ); // for search page - title always display. } elseif ( is_search() ) { /* translators: 1: search string */ $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) ); } elseif ( class_exists( 'WooCommerce' ) && is_shop() ) { $title = woocommerce_page_title( false ); } elseif ( is_archive() ) { $title = get_the_archive_title(); } } $title = apply_filters( 'astra_the_title', $title, $post_id ); // This will work same as `get_the_title` function but with Custom Title if exits. if ( $echo ) { echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $title; } } } /** * Archive Page Title */ if ( ! function_exists( 'astra_archive_page_info' ) ) { /** * Wrapper function for the_title() * * Displays title only if the page title bar is disabled. */ function astra_archive_page_info() { if ( apply_filters( 'astra_the_title_enabled', true ) ) { // Author. if ( is_author() ) { ?> <section class="ast-author-box ast-archive-description"> <div class="ast-author-bio"> <?php do_action( 'astra_before_archive_title' ); ?> <h1 class='page-title ast-archive-title'><?php echo get_the_author(); ?></h1> <?php do_action( 'astra_after_archive_title' ); ?> <p><?php echo wp_kses_post( get_the_author_meta( 'description' ) ); ?></p> <?php do_action( 'astra_after_archive_description' ); ?> </div> <div class="ast-author-avatar"> <?php echo get_avatar( get_the_author_meta( 'email' ), 120 ); ?> </div> </section> <?php // Category. } elseif ( is_category() ) { ?> <section class="ast-archive-description"> <?php do_action( 'astra_before_archive_title' ); ?> <h1 class="page-title ast-archive-title"><?php echo single_cat_title(); ?></h1> <?php do_action( 'astra_after_archive_title' ); ?> <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?> <?php do_action( 'astra_after_archive_description' ); ?> </section> <?php // Tag. } elseif ( is_tag() ) { ?> <section class="ast-archive-description"> <?php do_action( 'astra_before_archive_title' ); ?> <h1 class="page-title ast-archive-title"><?php echo single_tag_title(); ?></h1> <?php do_action( 'astra_after_archive_title' ); ?> <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?> <?php do_action( 'astra_after_archive_description' ); ?> </section> <?php // Search. } elseif ( is_search() ) { ?> <section class="ast-archive-description"> <?php do_action( 'astra_before_archive_title' ); ?> <?php /* translators: 1: search string */ $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) ); ?> <h1 class="page-title ast-archive-title"> <?php echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </h1> <?php do_action( 'astra_after_archive_title' ); ?> </section> <?php // Other. } else { ?> <section class="ast-archive-description"> <?php do_action( 'astra_before_archive_title' ); ?> <?php the_archive_title( '<h1 class="page-title ast-archive-title">', '</h1>' ); ?> <?php do_action( 'astra_after_archive_title' ); ?> <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?> <?php do_action( 'astra_after_archive_description' ); ?> </section> <?php } } } add_action( 'astra_archive_header', 'astra_archive_page_info' ); } /** * Adjust the HEX color brightness */ if ( ! function_exists( 'astra_adjust_brightness' ) ) { /** * Adjust Brightness * * @param string $hex Color code in HEX. * @param number $steps brightness value. * @param string $type brightness is reverse or default. * @return string Color code in HEX. */ function astra_adjust_brightness( $hex, $steps, $type ) { // Get rgb vars. $hex = str_replace( '#', '', $hex ); $shortcode_atts = array( 'r' => hexdec( substr( $hex, 0, 2 ) ), 'g' => hexdec( substr( $hex, 2, 2 ) ), 'b' => hexdec( substr( $hex, 4, 2 ) ), ); // Should we darken the color? if ( 'reverse' == $type && $shortcode_atts['r'] + $shortcode_atts['g'] + $shortcode_atts['b'] > 382 ) { $steps = -$steps; } elseif ( 'darken' == $type ) { $steps = -$steps; } // Build the new color. $steps = max( -255, min( 255, $steps ) ); $shortcode_atts['r'] = max( 0, min( 255, $shortcode_atts['r'] + $steps ) ); $shortcode_atts['g'] = max( 0, min( 255, $shortcode_atts['g'] + $steps ) ); $shortcode_atts['b'] = max( 0, min( 255, $shortcode_atts['b'] + $steps ) ); $r_hex = str_pad( dechex( $shortcode_atts['r'] ), 2, '0', STR_PAD_LEFT ); $g_hex = str_pad( dechex( $shortcode_atts['g'] ), 2, '0', STR_PAD_LEFT ); $b_hex = str_pad( dechex( $shortcode_atts['b'] ), 2, '0', STR_PAD_LEFT ); return '#' . $r_hex . $g_hex . $b_hex; } } // End if. /** * Convert colors from HEX to RGBA */ if ( ! function_exists( 'astra_hex_to_rgba' ) ) : /** * Convert colors from HEX to RGBA * * @param string $color Color code in HEX. * @param boolean $opacity Color code opacity. * @return string Color code in RGB or RGBA. */ function astra_hex_to_rgba( $color, $opacity = false ) { $default = 'rgb(0,0,0)'; // Return default if no color provided. if ( empty( $color ) ) { return $default; } // Sanitize $color if "#" is provided. if ( '#' == $color[0] ) { $color = substr( $color, 1 ); } // Check if color has 6 or 3 characters and get values. if ( 6 == strlen( $color ) ) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( 3 == strlen( $color ) ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } // Convert HEX to RGB. $rgb = array_map( 'hexdec', $hex ); // Check if opacity is set(RGBA or RGB). if ( $opacity ) { if ( 1 < abs( $opacity ) ) { $opacity = 1.0; } $output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')'; } else { $output = 'rgb(' . implode( ',', $rgb ) . ')'; } // Return RGB(a) color string. return $output; } endif; if ( ! function_exists( 'astra_enable_page_builder_compatibility' ) ) : /** * Allow filter to enable/disable page builder compatibility. * * @see https://wpastra.com/docs/recommended-settings-beaver-builder-astra/ * @see https://wpastra.com/docs/recommended-settings-for-elementor/ * * @since 1.2.2 * @return bool True - If the page builder compatibility is enabled. False - IF the page builder compatibility is disabled. */ function astra_enable_page_builder_compatibility() { return apply_filters( 'astra_enable_page_builder_compatibility', true ); } endif; if ( ! function_exists( 'astra_get_pro_url' ) ) : /** * Returns an URL with utm tags * the admin settings page. * * @param string $url URL fo the site. * @param string $source utm source. * @param string $medium utm medium. * @param string $campaign utm campaign. * @return mixed */ function astra_get_pro_url( $url, $source = '', $medium = '', $campaign = '' ) { $astra_pro_url = trailingslashit( $url ); // Set up our URL if we have a source. if ( isset( $source ) ) { $astra_pro_url = add_query_arg( 'utm_source', sanitize_text_field( $source ), $url ); } // Set up our URL if we have a medium. if ( isset( $medium ) ) { $astra_pro_url = add_query_arg( 'utm_medium', sanitize_text_field( $medium ), $url ); } // Set up our URL if we have a campaign. if ( isset( $campaign ) ) { $astra_pro_url = add_query_arg( 'utm_campaign', sanitize_text_field( $campaign ), $url ); } return esc_url( apply_filters( 'astra_get_pro_url', $astra_pro_url, $url ) ); } endif; /** * Search Form */ if ( ! function_exists( 'astra_get_search_form' ) ) : /** * Display search form. * * @param bool $echo Default to echo and not return the form. * @return string|void String when $echo is false. */ function astra_get_search_form( $echo = true ) { $form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '"> <label> <span class="screen-reader-text">' . _x( 'Search for:', 'label', 'astra' ) . '</span> <input type="search" class="search-field" ' . apply_filters( 'astra_search_field_toggle_data_attrs', '' ) . ' placeholder="' . apply_filters( 'astra_search_field_placeholder', esc_attr_x( 'Search …', 'placeholder', 'astra' ) ) . '" value="' . get_search_query() . '" name="s" role="search" tabindex="-1"/> </label> <button type="submit" class="search-submit" value="' . esc_attr__( 'Search', 'astra' ) . '" aria-label="search submit"><i class="astra-search-icon"></i></button> </form>'; /** * Filters the HTML output of the search form. * * @param string $form The search form HTML output. */ $result = apply_filters( 'astra_get_search_form', $form ); if ( null === $result ) { $result = $form; } if ( $echo ) { echo $result; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $result; } } endif; /** * Check if we're being delivered AMP * * @return bool */ function astra_is_amp_endpoint() { return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint(); } /* * Get Responsive Spacing */ if ( ! function_exists( 'astra_responsive_spacing' ) ) { /** * Get Spacing value * * @param array $option CSS value. * @param string $side top | bottom | left | right. * @param string $device CSS device. * @param string $default Default value. * @param string $prefix Prefix value. * @return mixed */ function astra_responsive_spacing( $option, $side = '', $device = 'desktop', $default = '', $prefix = '' ) { if ( isset( $option[ $device ][ $side ] ) && isset( $option[ $device . '-unit' ] ) ) { $spacing = astra_get_css_value( $option[ $device ][ $side ], $option[ $device . '-unit' ], $default ); } elseif ( is_numeric( $option ) ) { $spacing = astra_get_css_value( $option ); } else { $spacing = ( ! is_array( $option ) ) ? $option : ''; } if ( '' !== $prefix && '' !== $spacing ) { return $prefix . $spacing; } return $spacing; } } /** * Get the tablet breakpoint value. * * @param string $min min. * @param string $max max. * * @since 2.4.0 * * @return number $breakpoint. */ function astra_get_tablet_breakpoint( $min = '', $max = '' ) { $update_breakpoint = astra_get_option( 'can-update-theme-tablet-breakpoint', true ); // Change default for new users. $default = ( true === $update_breakpoint ) ? 921 : 768; $header_breakpoint = apply_filters( 'astra_tablet_breakpoint', $default ); if ( '' !== $min ) { $header_breakpoint = $header_breakpoint - $min; } elseif ( '' !== $max ) { $header_breakpoint = $header_breakpoint + $max; } return absint( $header_breakpoint ); } /** * Get the mobile breakpoint value. * * @param string $min min. * @param string $max max. * * @since 2.4.0 * * @return number header_breakpoint. */ function astra_get_mobile_breakpoint( $min = '', $max = '' ) { $header_breakpoint = apply_filters( 'astra_mobile_breakpoint', 544 ); if ( '' !== $min ) { $header_breakpoint = $header_breakpoint - $min; } elseif ( '' !== $max ) { $header_breakpoint = $header_breakpoint + $max; } return absint( $header_breakpoint ); } /* * Apply CSS for the element */ if ( ! function_exists( 'astra_color_responsive_css' ) ) { /** * Astra Responsive Colors * * @param array $setting Responsive colors. * @param string $css_property CSS property. * @param string $selector CSS selector. * @return string Dynamic responsive CSS. */ function astra_color_responsive_css( $setting, $css_property, $selector ) { $css = ''; if ( isset( $setting['desktop'] ) && ! empty( $setting['desktop'] ) ) { $css .= $selector . '{' . $css_property . ':' . esc_attr( $setting['desktop'] ) . ';}'; } if ( isset( $setting['tablet'] ) && ! empty( $setting['tablet'] ) ) { $css .= '@media (max-width:' . astra_get_tablet_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['tablet'] ) . ';} }'; } if ( isset( $setting['mobile'] ) && ! empty( $setting['mobile'] ) ) { $css .= '@media (max-width:' . astra_get_mobile_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['mobile'] ) . ';} }'; } return $css; } } if ( ! function_exists( 'astra_check_is_bb_themer_layout' ) ) : /** * Check if layout is bb themer's layout */ function astra_check_is_bb_themer_layout() { $is_layout = false; $post_type = get_post_type(); $post_id = get_the_ID(); if ( 'fl-theme-layout' === $post_type && $post_id ) { $is_layout = true; } return $is_layout; } endif; if ( ! function_exists( 'astra_is_white_labelled' ) ) : /** * Check if white label option is enabled in astra pro plugin */ function astra_is_white_labelled() { if ( is_callable( 'Astra_Ext_White_Label_Markup::show_branding' ) && ! Astra_Ext_White_Label_Markup::show_branding() ) { return apply_filters( 'astra_is_white_labelled', true ); } return apply_filters( 'astra_is_white_labelled', false ); } endif; /** * Get the value for font-display property. * * @since 1.8.6 * @return string */ function astra_get_fonts_display_property() { return apply_filters( 'astra_fonts_display_property', 'fallback' ); } /** * Return Theme options from database. * * @param string $option Option key. * @param string $default Option default value. * @param string $deprecated Option default value. * @return Mixed Return option value. */ function astra_get_db_option( $option, $default = '', $deprecated = '' ) { if ( '' != $deprecated ) { $default = $deprecated; } $theme_options = Astra_Theme_Options::get_db_options(); /** * Filter the options array for Astra Settings. * * @since 1.0.20 * @var Array */ $theme_options = apply_filters( 'astra_get_db_option_array', $theme_options, $option, $default ); $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default; /** * Dynamic filter astra_get_option_$option. * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme. * * @since 1.0.20 * @var Mixed. */ return apply_filters( "astra_get_db_option_{$option}", $value, $option, $default ); } /** * Add Responsive bacground CSS * * @param array $bg_obj_res Color array. * @param array $device Device name. * * @return array Color code in HEX. */ function astra_get_responsive_background_obj( $bg_obj_res, $device ) { $gen_bg_css = array(); if ( ! is_array( $bg_obj_res ) ) { return; } $bg_obj = $bg_obj_res[ $device ]; $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : ''; $bg_tab_img = isset( $bg_obj_res['tablet']['background-image'] ) ? $bg_obj_res['tablet']['background-image'] : ''; $bg_desk_img = isset( $bg_obj_res['desktop']['background-image'] ) ? $bg_obj_res['desktop']['background-image'] : ''; $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : ''; $tablet_css = ( isset( $bg_obj_res['tablet']['background-image'] ) && $bg_obj_res['tablet']['background-image'] ) ? true : false; $desktop_css = ( isset( $bg_obj_res['desktop']['background-image'] ) && $bg_obj_res['desktop']['background-image'] ) ? true : false; if ( '' !== $bg_img && '' !== $bg_color ) { $gen_bg_css = array( 'background-image' => 'linear-gradient(to right, ' . esc_attr( $bg_color ) . ', ' . esc_attr( $bg_color ) . '), url(' . esc_url( $bg_img ) . ')', ); } elseif ( '' !== $bg_img ) { $gen_bg_css = array( 'background-image' => 'url(' . esc_url( $bg_img ) . ')' ); } elseif ( '' !== $bg_color ) { if ( 'mobile' === $device ) { if ( true == $desktop_css && true == $tablet_css ) { $gen_bg_css = array( 'background-image' => 'linear-gradient(to right, ' . esc_attr( $bg_color ) . ', ' . esc_attr( $bg_color ) . '), url(' . esc_attr( $bg_tab_img ) . ')' ); } elseif ( true == $desktop_css ) { $gen_bg_css = array( 'background-image' => 'linear-gradient(to right, ' . esc_attr( $bg_color ) . ', ' . esc_attr( $bg_color ) . '), url(' . esc_attr( $bg_desk_img ) . ')' ); } elseif ( true == $tablet_css ) { $gen_bg_css = array( 'background-image' => 'linear-gradient(to right, ' . esc_attr( $bg_color ) . ', ' . esc_attr( $bg_color ) . '), url(' . esc_attr( $bg_tab_img ) . ')' ); } else { $gen_bg_css = array( 'background-color' => esc_attr( $bg_color ), 'background-image' => 'none', ); } } elseif ( 'tablet' === $device ) { if ( true == $desktop_css ) { $gen_bg_css = array( 'background-image' => 'linear-gradient(to right, ' . esc_attr( $bg_color ) . ', ' . esc_attr( $bg_color ) . '), url(' . esc_attr( $bg_desk_img ) . ')' ); } else { $gen_bg_css = array( 'background-color' => esc_attr( $bg_color ), 'background-image' => 'none', ); } } else { $gen_bg_css = array( 'background-color' => esc_attr( $bg_color ), 'background-image' => 'none', ); } } if ( '' !== $bg_img ) { if ( isset( $bg_obj['background-repeat'] ) ) { $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] ); } if ( isset( $bg_obj['background-position'] ) ) { $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] ); } if ( isset( $bg_obj['background-size'] ) ) { $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] ); } if ( isset( $bg_obj['background-attachment'] ) ) { $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] ); } } return $gen_bg_css; } class-astra-walker-page.php 0000666 00000004201 15210370260 0011664 0 ustar 00 <?php /** * Navigation Menu customizations. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.5.4 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Custom wp_nav_menu walker. * * @package Astra WordPress theme */ if ( ! class_exists( 'Astra_Walker_Page' ) ) { /** * Astra custom navigation walker. * * @since 1.5.4 */ class Astra_Walker_Page extends Walker_Page { /** * Outputs the beginning of the current level in the tree before elements are output. * * @since 1.5.4 * * @see Walker::start_lvl() * * @param string $output Used to append additional content (passed by reference). * @param int $depth Optional. Depth of page. Used for padding. Default 0. * @param array $args Optional. Arguments for outputting the next level. * Default empty array. */ public function start_lvl( &$output, $depth = 0, $args = array() ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $indent = str_repeat( $t, $depth ); $output .= "{$n}{$indent}<ul class='children sub-menu'>{$n}"; $output = apply_filters( 'astra_caret_wrap_filter', $output, $args['sort_column'] ); } /** * Outputs the beginning of the current element in the tree. * * @see Walker::start_el() * @since 1.7.2 * * @param string $output Used to append additional content. Passed by reference. * @param WP_Post $page Page data object. * @param int $depth Optional. Depth of page. Used for padding. Default 0. * @param array $args Optional. Array of arguments. Default empty array. * @param int $current_page Optional. Page ID. Default 0. */ public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { parent::start_el( $output, $page, $depth, $args, $current_page ); $output = apply_filters( 'astra_walker_nav_menu_start_el', $output, $page, $depth, $args ); } } } deprecated/deprecated-hooks.php 0000666 00000002110 15210370260 0012570 0 ustar 00 <?php /** * Deprecated Hooks of Astra Theme. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.23 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! function_exists( 'astra_do_action_deprecated' ) ) { /** * Astra Filter Deprecated * * @since 1.1.1 * @param string $tag The name of the filter hook. * @param array $args Array of additional function arguments to be passed to apply_filters(). * @param string $version The version of WordPress that deprecated the hook. * @param string $replacement Optional. The hook that should have been used. Default false. * @param string $message Optional. A message regarding the change. Default null. */ function astra_do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) { if ( function_exists( 'do_action_deprecated' ) ) { /* WP >= 4.6 */ do_action_deprecated( $tag, $args, $version, $replacement, $message ); } else { do_action_ref_array( $tag, $args ); } } } deprecated/deprecated-functions.php 0000666 00000007673 15210370260 0013500 0 ustar 00 <?php /** * Deprecated Functions of Astra Theme. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.23 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! function_exists( 'astra_blog_post_thumbnai_and_title_order' ) ) : /** * Blog post thumbnail & title order * * @since 1.4.9 * @deprecated 1.4.9 Use astra_blog_post_thumbnail_and_title_order() * @see astra_blog_post_thumbnail_and_title_order() * * @return void */ function astra_blog_post_thumbnai_and_title_order() { _deprecated_function( __FUNCTION__, '1.4.9', 'astra_blog_post_thumbnail_and_title_order()' ); astra_blog_post_thumbnail_and_title_order(); } endif; if ( ! function_exists( 'get_astra_secondary_class' ) ) : /** * Retrieve the classes for the secondary element as an array. * * @since 1.5.2 * @deprecated 1.5.2 Use astra_get_secondary_class() * @param string|array $class One or more classes to add to the class list. * @see astra_get_secondary_class() * * @return array */ function get_astra_secondary_class( $class = '' ) { _deprecated_function( __FUNCTION__, '1.5.2', 'astra_get_secondary_class()' ); return astra_get_secondary_class( $class ); } endif; if ( ! function_exists( 'deprecated_astra_color_palette' ) ) : /** * Depreciating astra_color_palletes filter. * * @since 1.5.2 * @deprecated 1.5.2 Use astra_deprecated_color_palette() * @param array $color_palette customizer color palettes. * @see astra_deprecated_color_palette() * * @return array */ function deprecated_astra_color_palette( $color_palette ) { _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_color_palette()' ); return astra_deprecated_color_palette( $color_palette ); } endif; if ( ! function_exists( 'deprecated_astra_sigle_post_navigation_enabled' ) ) : /** * Deprecating astra_sigle_post_navigation_enabled filter. * * @since 1.5.2 * @deprecated 1.5.2 Use astra_deprecated_sigle_post_navigation_enabled() * @param boolean $post_nav true | false. * @see astra_deprecated_sigle_post_navigation_enabled() * * @return array */ function deprecated_astra_sigle_post_navigation_enabled( $post_nav ) { _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_sigle_post_navigation_enabled()' ); return astra_deprecated_sigle_post_navigation_enabled( $post_nav ); } endif; if ( ! function_exists( 'deprecated_astra_primary_header_main_rt_section' ) ) : /** * Deprecating astra_primary_header_main_rt_section filter. * * @since 1.5.2 * @deprecated 1.5.2 Use astra_deprecated_primary_header_main_rt_section() * @param array $elements List of elements. * @param string $header Header section type. * @see astra_deprecated_primary_header_main_rt_section() * * @return array */ function deprecated_astra_primary_header_main_rt_section( $elements, $header ) { _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_primary_header_main_rt_section()' ); return astra_deprecated_primary_header_main_rt_section( $elements, $header ); } endif; if ( ! function_exists( 'astar' ) ) : /** * Get a specific property of an array without needing to check if that property exists. * * @since 1.5.2 * @deprecated 1.5.2 Use astra_get_prop() * @param array $array Array from which the property's value should be retrieved. * @param string $prop Name of the property to be retrieved. * @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null. * @see astra_get_prop() * * @return null|string|mixed The value */ function astar( $array, $prop, $default = null ) { return astra_get_prop( $array, $prop, $default ); } endif; /** * Check if we're being delivered AMP. * * @return bool */ function astra_is_emp_endpoint() { _deprecated_function( __FUNCTION__, '2.0.1', 'astra_is_amp_endpoint()' ); return astra_is_amp_endpoint(); } deprecated/deprecated-filters.php 0000666 00000005447 15210370260 0013135 0 ustar 00 <?php /** * Deprecated Filters of Astra Theme. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.23 */ if ( ! defined( 'ABSPATH' ) ) { exit; } // Depreciating astra_color_palletes filter. add_filter( 'astra_color_palettes', 'astra_deprecated_color_palette', 10, 1 ); /** * Astra Color Palettes * * @since 1.0.23 * @param array $color_palette customizer color palettes. * @return array $color_palette updated customizer color palettes. */ function astra_deprecated_color_palette( $color_palette ) { $color_palette = astra_apply_filters_deprecated( 'astra_color_palletes', array( $color_palette ), '1.0.22', 'astra_color_palettes', '' ); return $color_palette; } // Deprecating astra_sigle_post_navigation_enabled filter. add_filter( 'astra_single_post_navigation_enabled', 'astra_deprecated_sigle_post_navigation_enabled', 10, 1 ); /** * Astra Single Post Navigation * * @since 1.0.27 * @param boolean $post_nav true | false. * @return boolean $post_nav true for enabled | false for disable. */ function astra_deprecated_sigle_post_navigation_enabled( $post_nav ) { $post_nav = astra_apply_filters_deprecated( 'astra_sigle_post_navigation_enabled', array( $post_nav ), '1.0.27', 'astra_single_post_navigation_enabled', '' ); return $post_nav; } // Deprecating astra_primary_header_main_rt_section filter. add_filter( 'astra_header_section_elements', 'astra_deprecated_primary_header_main_rt_section', 10, 2 ); /** * Astra Header elements. * * @since 1.2.2 * @param array $elements List of elements. * @param string $header Header section type. * @return array */ function astra_deprecated_primary_header_main_rt_section( $elements, $header ) { $elements = astra_apply_filters_deprecated( 'astra_primary_header_main_rt_section', array( $elements, $header ), '1.2.2', 'astra_header_section_elements', '' ); return $elements; } if ( ! function_exists( 'astra_apply_filters_deprecated' ) ) { /** * Astra Filter Deprecated * * @since 1.1.1 * @param string $tag The name of the filter hook. * @param array $args Array of additional function arguments to be passed to apply_filters(). * @param string $version The version of WordPress that deprecated the hook. * @param string $replacement Optional. The hook that should have been used. Default false. * @param string $message Optional. A message regarding the change. Default null. */ function astra_apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) { if ( function_exists( 'apply_filters_deprecated' ) ) { /* WP >= 4.6 */ return apply_filters_deprecated( $tag, $args, $version, $replacement, $message ); } else { return apply_filters_ref_array( $tag, $args ); } } } index.php 0000666 00000000157 15210370260 0006367 0 ustar 00 <?php /** * Index file * * @package Astra * @since Astra 1.0.0 */ /* Silence is golden, and we agree. */ sidebar-manager.php 0000666 00000003643 15210370260 0010304 0 ustar 00 <?php /** * Sidebar Manager functions * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Site Sidebar */ if ( ! function_exists( 'astra_page_layout' ) ) { /** * Site Sidebar * * Default 'right sidebar' for overall site. */ function astra_page_layout() { if ( is_singular() ) { // If post meta value is empty, // Then get the POST_TYPE sidebar. $layout = astra_get_option_meta( 'site-sidebar-layout', '', true ); if ( empty( $layout ) ) { $post_type = get_post_type(); if ( 'post' === $post_type || 'page' === $post_type || 'product' === $post_type ) { $layout = astra_get_option( 'single-' . get_post_type() . '-sidebar-layout' ); } if ( 'default' == $layout || empty( $layout ) ) { // Get the global sidebar value. // NOTE: Here not used `true` in the below function call. $layout = astra_get_option( 'site-sidebar-layout' ); } } } else { if ( is_search() ) { // Check only post type archive option value. $layout = astra_get_option( 'archive-post-sidebar-layout' ); if ( 'default' == $layout || empty( $layout ) ) { // Get the global sidebar value. // NOTE: Here not used `true` in the below function call. $layout = astra_get_option( 'site-sidebar-layout' ); } } else { $post_type = get_post_type(); $layout = ''; if ( 'post' === $post_type ) { $layout = astra_get_option( 'archive-' . get_post_type() . '-sidebar-layout' ); } if ( 'default' == $layout || empty( $layout ) ) { // Get the global sidebar value. // NOTE: Here not used `true` in the below function call. $layout = astra_get_option( 'site-sidebar-layout' ); } } } return apply_filters( 'astra_page_layout', $layout ); } } class-astra-admin-settings.php 0000666 00000167552 15210370260 0012436 0 ustar 00 <?php /** * Admin settings helper * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Admin_Settings' ) ) { /** * Astra Admin Settings */ class Astra_Admin_Settings { /** * Menu page title * * @since 1.0 * @var array $menu_page_title */ public static $menu_page_title = 'Astra Theme'; /** * Page title * * @since 1.0 * @var array $page_title */ public static $page_title = 'Astra'; /** * Plugin slug * * @since 1.0 * @var array $plugin_slug */ public static $plugin_slug = 'astra'; /** * Default Menu position * * @since 1.0 * @var array $default_menu_position */ public static $default_menu_position = 'themes.php'; /** * Parent Page Slug * * @since 1.0 * @var array $parent_page_slug */ public static $parent_page_slug = 'general'; /** * Current Slug * * @since 1.0 * @var array $current_slug */ public static $current_slug = 'general'; /** * Starter Templates Slug * * @since 2.3.2 * @var array $starter_templates_slug */ public static $starter_templates_slug = 'astra-sites'; /** * Constructor */ public function __construct() { if ( ! is_admin() ) { return; } self::get_starter_templates_slug(); add_action( 'after_setup_theme', __CLASS__ . '::init_admin_settings', 99 ); } /** * Admin settings init */ public static function init_admin_settings() { self::$menu_page_title = apply_filters( 'astra_menu_page_title', __( 'Astra Options', 'astra' ) ); self::$page_title = apply_filters( 'astra_page_title', __( 'Astra', 'astra' ) ); self::$plugin_slug = self::get_theme_page_slug(); add_action( 'admin_enqueue_scripts', __CLASS__ . '::register_scripts' ); if ( isset( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], self::$plugin_slug ) !== false ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' ); // Let extensions hook into saving. do_action( 'astra_admin_settings_scripts' ); self::save_settings(); } add_action( 'customize_controls_enqueue_scripts', __CLASS__ . '::customizer_scripts' ); add_action( 'admin_menu', __CLASS__ . '::add_admin_menu', 99 ); add_action( 'astra_menu_general_action', __CLASS__ . '::general_page' ); add_action( 'astra_header_right_section', __CLASS__ . '::top_header_right_section' ); add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::astra_welcome_page_starter_sites_section', 10 ); add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::astra_welcome_page_knowledge_base_scetion', 11 ); add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::astra_welcome_page_community_scetion', 12 ); add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::astra_welcome_page_five_star_scetion', 13 ); add_action( 'astra_welcome_page_content', __CLASS__ . '::astra_welcome_page_content' ); add_action( 'astra_welcome_page_content', __class__ . '::astra_available_plugins', 30 ); // AJAX. add_action( 'wp_ajax_astra-sites-plugin-activate', __CLASS__ . '::required_plugin_activate' ); add_action( 'wp_ajax_astra-sites-plugin-deactivate', __CLASS__ . '::required_plugin_deactivate' ); add_action( 'admin_notices', __CLASS__ . '::register_notices' ); add_action( 'astra_notice_before_markup', __CLASS__ . '::notice_assets' ); add_action( 'admin_notices', __CLASS__ . '::minimum_addon_version_notice' ); } /** * Theme options page Slug getter including White Label string. * * @since 2.1.0 * @return string Theme Options Page Slug. */ public static function get_theme_page_slug() { return apply_filters( 'astra_theme_page_slug', self::$plugin_slug ); } /** * Ask Theme Rating * * @since 1.4.0 */ public static function register_notices() { if ( class_exists( 'Astra_Ext_White_Label_Markup' ) ) { if ( ! empty( Astra_Ext_White_Label_Markup::$branding['astra']['name'] ) ) { return; } } if ( false === get_option( 'astra-theme-old-setup' ) ) { set_transient( 'astra-theme-first-rating', true, MONTH_IN_SECONDS ); update_option( 'astra-theme-old-setup', true ); } elseif ( false === get_transient( 'astra-theme-first-rating' ) && current_user_can( 'install_plugins' ) ) { $image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg'; Astra_Notices::add_notice( array( 'id' => 'astra-theme-rating', 'type' => '', 'message' => sprintf( '<div class="notice-image"> <img src="%1$s" class="custom-logo" alt="Astra" itemprop="logo"></div> <div class="notice-content"> <div class="notice-heading"> %2$s </div> %3$s<br /> <div class="astra-review-notice-container"> <a href="%4$s" class="astra-notice-close astra-review-notice button-primary" target="_blank"> %5$s </a> <span class="dashicons dashicons-calendar"></span> <a href="#" data-repeat-notice-after="%6$s" class="astra-notice-close astra-review-notice"> %7$s </a> <span class="dashicons dashicons-smiley"></span> <a href="#" class="astra-notice-close astra-review-notice"> %8$s </a> </div> </div>', $image_path, __( 'Hello! Seems like you have used Astra theme to build this website — Thanks a ton!', 'astra' ), __( 'Could you please do us a BIG favor and give it a 5-star rating on WordPress? This would boost our motivation and help other users make a comfortable decision while choosing the Astra theme.', 'astra' ), 'https://wordpress.org/support/theme/astra/reviews/?filter=5#new-post', __( 'Ok, you deserve it', 'astra' ), MONTH_IN_SECONDS, __( 'Nope, maybe later', 'astra' ), __( 'I already did', 'astra' ) ), 'repeat-notice-after' => MONTH_IN_SECONDS, 'priority' => 10, 'display-with-other-notices' => false, 'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true, ) ); } // Force Astra welcome notice on theme activation. if ( current_user_can( 'install_plugins' ) && ! defined( 'ASTRA_SITES_NAME' ) && '1' == get_option( 'fresh_site' ) ) { wp_enqueue_script( 'astra-admin-settings' ); $image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg'; $ast_sites_notice_btn = self::astra_sites_notice_button(); if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' ); $ast_sites_notice_btn['class'] .= ' button button-primary button-hero'; } elseif ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' ); $ast_sites_notice_btn['class'] .= ' button button-primary button-hero'; // Astra Premium Sites - Active. } elseif ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) ) { $ast_sites_notice_btn['class'] = ' button button-primary button-hero astra-notice-close'; } else { $ast_sites_notice_btn['class'] = ' button button-primary button-hero astra-notice-close'; } $astra_sites_notice_args = array( 'id' => 'astra-sites-on-active', 'type' => 'info', 'message' => sprintf( '<div class="notice-image"> <img src="%1$s" class="custom-logo" alt="Astra" itemprop="logo"></div> <div class="notice-content"> <h2 class="notice-heading"> %2$s </h2> <p>%3$s</p> <div class="astra-review-notice-container"> <a class="%4$s" %5$s %6$s %7$s %8$s %9$s %10$s> %11$s </a> </div> </div>', $image_path, __( 'Thank you for installing Astra!', 'astra' ), __( 'Did you know Astra comes with dozens of ready-to-use <a href="https://wpastra.com/ready-websites/?utm_source=install-notice">starter templates</a>? 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(); // Astra Sites - Installed but Inactive. // Astra Premium Sites - Inactive. if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-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-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' ) . '…'; // Astra Sites - Not Installed. // Astra Premium Sites - Inactive. } elseif ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( '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' ); } else { $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'; } } /** * Save All admin settings here */ public static function save_settings() { // Only admins can save settings. if ( ! current_user_can( 'manage_options' ) ) { return; } // Let extensions hook into saving. do_action( 'astra_admin_settings_save' ); } /** * 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 ) { $js_prefix = '.min.js'; $css_prefix = '.min.css'; $dir = 'minified'; if ( SCRIPT_DEBUG ) { $js_prefix = '.js'; $css_prefix = '.css'; $dir = 'unminified'; } if ( is_rtl() ) { $css_prefix = '-rtl.min.css'; if ( SCRIPT_DEBUG ) { $css_prefix = '-rtl.css'; } } /** * Filters the Admin JavaScript handles added * * @since v1.4.10 * * @param array array of the javascript handles. */ $js_handle = apply_filters( 'astra_admin_script_handles', array( 'jquery', 'wp-color-picker' ) ); // Add customize-base handle only for the Customizer Preview Screen. if ( true === is_customize_preview() ) { $js_handle[] = 'customize-base'; } wp_register_script( 'astra-color-alpha', ASTRA_THEME_URI . 'assets/js/' . $dir . '/wp-color-picker-alpha' . $js_prefix, $js_handle, ASTRA_THEME_VERSION, true ); 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 '<style class="astra-meta-box-style"> .block-editor-page #side-sortables #astra_settings_meta_box select { min-width: 84%; padding: 3px 24px 3px 8px; height: 20px; } .block-editor-page #normal-sortables #astra_settings_meta_box select { min-width: 200px; } .block-editor-page .edit-post-meta-boxes-area #poststuff #astra_settings_meta_box h2.hndle { border-bottom: 0; } .block-editor-page #astra_settings_meta_box .components-base-control__field, .block-editor-page #astra_settings_meta_box .block-editor-page .transparent-header-wrapper, .block-editor-page #astra_settings_meta_box .adv-header-wrapper, .block-editor-page #astra_settings_meta_box .stick-header-wrapper, .block-editor-page #astra_settings_meta_box .disable-section-meta div { margin-bottom: 8px; } .block-editor-page #astra_settings_meta_box .disable-section-meta div label { vertical-align: inherit; } .block-editor-page #astra_settings_meta_box .post-attributes-label-wrapper { margin-bottom: 4px; } #side-sortables #astra_settings_meta_box select { min-width: 100%; } #normal-sortables #astra_settings_meta_box select { min-width: 200px; } </style>'; } } /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */ if ( ! is_customize_preview() ) { echo '<style class="astra-menu-appearance-style"> #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; } </style>'; 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' ), ); 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 ); } 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' ), ); 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'] ) ? esc_attr( $_GET['action'] ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $active_tab = str_replace( '_', '-', $current_slug ); $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 ) ); ?> <div class="ast-menu-page-wrapper wrap ast-clear <?php echo esc_attr( implode( ' ', $ast_wrapper_class ) ); ?>"> <div class="ast-theme-page-header"> <div class="ast-container ast-flex"> <div class="ast-theme-title"> <a href="<?php echo esc_url( $ast_visit_site_url ); ?>" target="_blank" rel="noopener" > <?php if ( $ast_icon ) { ?> <img src="<?php echo esc_url( ASTRA_THEME_URI . 'inc/assets/images/astra.svg' ); ?>" class="ast-theme-icon" alt="<?php echo esc_attr( self::$page_title ); ?> " > <span class="astra-theme-version"><?php echo esc_html( ASTRA_THEME_VERSION ); ?></span> <?php } ?> <?php do_action( 'astra_welcome_page_header_title' ); ?> </a> </div> <?php do_action( 'astra_header_right_section' ); ?> </div> </div> <?php do_action( 'astra_menu_' . esc_attr( $current_slug ) . '_action' ); ?> </div> <?php } /** * Include general page * * @since 1.0 */ public static function general_page() { require_once ASTRA_THEME_DIR . 'inc/core/view-general.php'; } /** * Include Welcome page right starter sites content * * @since 1.2.4 */ public static function astra_welcome_page_starter_sites_section() { if ( astra_is_white_labelled() ) { return; } ?> <div class="postbox"> <h2 class="hndle ast-normal-cusror"> <span class="dashicons dashicons-admin-customizer"></span> <span><?php echo esc_html( apply_filters( 'astra_sites_menu_page_title', __( 'Import Starter Template', 'astra' ) ) ); ?></span> </h2> <img class="ast-starter-sites-img" src="<?php echo esc_url( ASTRA_THEME_URI . 'assets/images/astra-starter-sites.jpg' ); ?>"> <div class="inside"> <p> <?php $astra_starter_sites_doc_link = apply_filters( 'astra_starter_sites_documentation_link', astra_get_pro_url( 'https://wpastra.com/docs/installing-importing-astra-sites', 'astra-dashboard', 'how-astra-sites-works', 'welcome-page' ) ); $astra_starter_sites_doc_link_text = apply_filters( 'astra_starter_sites_doc_link_text', __( 'Starter Templates?', 'astra' ) ); printf( /* translators: %1$s: Starter site link. */ esc_html__( 'Did you know %1$s offers a free library of %2$s ', 'astra' ), self::$page_title, ! empty( $astra_starter_sites_doc_link ) ? '<a href=' . esc_url( $astra_starter_sites_doc_link ) . ' target="_blank" rel="noopener">' . esc_html( $astra_starter_sites_doc_link_text ) . '</a>' : esc_html( $astra_starter_sites_doc_link_text ) ); ?> </p> <p> <?php esc_html_e( 'Import your favorite site in one click and start your project with style!', 'astra' ); ?> </p> <?php $ast_sites_notice_btn = self::astra_sites_notice_button(); printf( '<a class="%1$s" %2$s %3$s %4$s %5$s %6$s %7$s> %8$s </a>', 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( '<a class="%1$s" %2$s target="_blank" rel="noopener"> %3$s </a>', 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 ); ?> <div> </div> </div> </div> <?php } /** * Include Welcome page right side knowledge base content * * @since 1.2.4 */ public static function astra_welcome_page_knowledge_base_scetion() { if ( astra_is_white_labelled() ) { return; } ?> <div class="postbox"> <h2 class="hndle ast-normal-cusror"> <span class="dashicons dashicons-book"></span> <span><?php esc_html_e( 'Knowledge Base', 'astra' ); ?></span> </h2> <div class="inside"> <p> <?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'astra' ); ?> </p> <?php $astra_knowledge_base_doc_link = apply_filters( 'astra_knowledge_base_documentation_link', astra_get_pro_url( 'https://wpastra.com/docs/', 'astra-dashboard', 'visit-documentation', 'welcome-page' ) ); $astra_knowledge_base_doc_link_text = apply_filters( 'astra_knowledge_base_documentation_link_text', __( 'Visit Knowledge Base »', 'astra' ) ); printf( /* translators: %1$s: Astra Knowledge doc link. */ '%1$s', ! empty( $astra_knowledge_base_doc_link ) ? '<a href=' . esc_url( $astra_knowledge_base_doc_link ) . ' target="_blank" rel="noopener">' . esc_html( $astra_knowledge_base_doc_link_text ) . '</a>' : esc_html( $astra_knowledge_base_doc_link_text ) ); ?> </div> </div> <?php } /** * Include Welcome page right side Astra community content * * @since 1.2.4 */ public static function astra_welcome_page_community_scetion() { if ( astra_is_white_labelled() ) { return; } ?> <div class="postbox"> <h2 class="hndle ast-normal-cusror"> <span class="dashicons dashicons-groups"></span> <span> <?php printf( /* translators: %1$s: Astra Theme name. */ esc_html__( '%1$s Community', 'astra' ), esc_html( self::$page_title ) ); ?> </h2> <div class="inside"> <p> <?php printf( /* translators: %1$s: Astra Theme name. */ esc_html__( 'Join the community of super helpful %1$s users. Say hello, ask questions, give feedback and help each other!', 'astra' ), esc_html( self::$page_title ) ); ?> </p> <?php $astra_community_group_link = apply_filters( 'astra_community_group_link', 'https://www.facebook.com/groups/wpastra' ); $astra_community_group_link_text = apply_filters( 'astra_community_group_link_text', __( 'Join Our Facebook Group »', 'astra' ) ); printf( /* translators: %1$s: Astra Knowledge doc link. */ '%1$s', ! empty( $astra_community_group_link ) ? '<a href=' . esc_url( $astra_community_group_link ) . ' target="_blank" rel="noopener">' . esc_html( $astra_community_group_link_text ) . '</a>' : esc_html( $astra_community_group_link_text ) ); ?> </div> </div> <?php } /** * Include Welcome page right side Five Star Support * * @since 1.2.4 */ public static function astra_welcome_page_five_star_scetion() { if ( astra_is_white_labelled() ) { return; } ?> <div class="postbox"> <h2 class="hndle ast-normal-cusror"> <span class="dashicons dashicons-sos"></span> <span><?php esc_html_e( 'Five Star Support', 'astra' ); ?></span> </h2> <div class="inside"> <p> <?php printf( /* translators: %1$s: Astra Theme name. */ esc_html__( 'Got a question? Get in touch with %1$s developers. We\'re happy to help!', 'astra' ), esc_html( self::$page_title ) ); ?> </p> <?php $astra_support_link = apply_filters( 'astra_support_link', astra_get_pro_url( 'https://wpastra.com/contact/', 'astra-dashboard', 'submit-a-ticket', 'welcome-page' ) ); $astra_support_link_text = apply_filters( 'astra_support_link_text', __( 'Submit a Ticket »', 'astra' ) ); printf( /* translators: %1$s: Astra Knowledge doc link. */ '%1$s', ! empty( $astra_support_link ) ? '<a href=' . esc_url( $astra_support_link ) . ' target="_blank" rel="noopener">' . esc_html( $astra_support_link_text ) . '</a>' : esc_html( $astra_support_link_text ) ); ?> </div> </div> <?php } /** * Include Welcome page content * * @since 1.2.4 */ public static function astra_welcome_page_content() { $astra_addon_tagline = apply_filters( 'astra_addon_list_tagline', __( 'More Options Available with Astra Pro!', 'astra' ) ); // Quick settings. $quick_settings = apply_filters( 'astra_quick_settings', array( 'logo-favicon' => array( 'title' => __( 'Upload Logo', 'astra' ), 'dashicon' => 'dashicons-format-image', 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ), ), 'colors' => array( 'title' => __( 'Set Colors', 'astra' ), 'dashicon' => 'dashicons-admin-customizer', 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ), ), 'typography' => array( 'title' => __( 'Customize Fonts', 'astra' ), 'dashicon' => 'dashicons-editor-textcolor', 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ), ), 'layout' => array( 'title' => __( 'Layout Options', 'astra' ), 'dashicon' => 'dashicons-layout', 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ), ), 'header' => array( 'title' => __( 'Header Options', 'astra' ), 'dashicon' => 'dashicons-align-center', 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ), ), 'blog-layout' => array( 'title' => __( 'Blog Layouts', 'astra' ), 'dashicon' => 'dashicons-welcome-write-blog', 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ), ), 'footer' => array( 'title' => __( 'Footer Settings', 'astra' ), 'dashicon' => 'dashicons-admin-generic', 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-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/how-to-white-label-astra/', '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', '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, ), ), ), ) ); ?> <div class="postbox"> <h2 class="hndle ast-normal-cusror"><span><?php esc_html_e( 'Links to Customizer Settings:', 'astra' ); ?></span></h2> <div class="ast-quick-setting-section"> <?php if ( ! empty( $quick_settings ) ) : ?> <div class="ast-quick-links"> <ul class="ast-flex"> <?php foreach ( (array) $quick_settings as $key => $link ) { echo '<li class=""><span class="dashicons ' . esc_attr( $link['dashicon'] ) . '"></span><a class="ast-quick-setting-title" href="' . esc_url( $link['quick_url'] ) . '" target="_blank" rel="noopener">' . esc_html( $link['title'] ) . '</a></li>'; } ?> </ul> </div> <?php endif; ?> </div> </div> <!-- Notice for Older version of Astra Addon --> <?php self::min_addon_version_message(); ?> <div class="postbox"> <h2 class="hndle ast-normal-cusror ast-addon-heading ast-flex"><span><?php echo esc_html( $astra_addon_tagline ); ?></span> <?php do_action( 'astra_addon_bulk_action' ); ?> </h2> <div class="ast-addon-list-section"> <?php if ( ! empty( $extensions ) ) : ?> <div> <ul class="ast-addon-list"> <?php foreach ( (array) $extensions as $addon => $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 '<li id="' . esc_attr( $addon ) . '" class="' . esc_attr( $info['class'] ) . '"><a class="ast-addon-title"' . $title_url . $anchor_target . ' >' . esc_html( $info['title'] ) . '</a><div class="ast-addon-link-wrapper">'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped foreach ( $info['links'] as $key => $link ) { printf( '<a class="%1$s" %2$s %3$s> %4$s </a>', esc_attr( $link['link_class'] ), isset( $link['link_url'] ) ? 'href="' . esc_url( $link['link_url'] ) . '"' : '', ( isset( $link['target_blank'] ) && $link['target_blank'] ) ? 'target="_blank" rel="noopener"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped esc_html( $link['link_text'] ) ); } echo '</div></li>'; } ?> </ul> </div> <?php endif; ?> </div> </div> <?php } /** * Include Welcome page content * * @since 1.2.4 */ public static function astra_available_plugins() { if ( astra_is_white_labelled() ) { return; } $astra_addon_tagline = apply_filters( 'astra_available_plugins', sprintf( /* translators: %1s Astra Theme */ __( 'Extend %1s with free plugins!', 'astra' ), astra_get_theme_name() ) ); $recommended_plugins = apply_filters( 'astra_recommended_plugins', array( 'astra-import-export' => array( 'plugin-name' => 'Import / Export Customizer Settings', 'plugin-init' => 'astra-import-export/astra-import-export.php', 'settings-link' => '', 'settings-link-text' => 'Settings', ), 'reset-astra-customizer' => array( 'plugin-name' => 'Astra Customizer Reset', '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', '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', 'plugin-init' => 'astra-bulk-edit/astra-bulk-edit.php', 'settings-link' => '', 'settings-link-text' => 'Settings', ), 'astra-widgets' => array( 'plugin-name' => 'Astra Widgets', 'plugin-init' => 'astra-widgets/astra-widgets.php', 'settings-link' => admin_url( 'widgets.php' ), 'settings-link-text' => 'Settings', ), 'custom-fonts' => array( 'plugin-name' => 'Custom Fonts', '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', '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', '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', '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 ) ) { ?> <div class="postbox"> <h2 class="hndle ast-normal-cusror ast-addon-heading ast-flex"><span><?php echo esc_html( $astra_addon_tagline ); ?></span> </h2> <div class="ast-addon-list-section"> <?php if ( ! empty( $recommended_plugins ) ) : ?> <div> <ul class="ast-addon-list"> <?php foreach ( $recommended_plugins as $slug => $plugin ) { // If display condition for the plugin does not meet, skip the plugin from displaying. if ( isset( $plugin['display'] ) && false === $plugin['display'] ) { continue; } $plugin_active_status = ''; if ( is_plugin_active( $plugin['plugin-init'] ) ) { $plugin_active_status = ' active'; } echo '<li ' . astra_attr( 'astra-recommended-plugin-' . esc_attr( $slug ), array( 'id' => esc_attr( $slug ), 'class' => 'astra-recommended-plugin' . $plugin_active_status, 'data-slug' => $slug, ) ) . '>'; echo '<a href="' . esc_url( self::build_worg_plugin_link( $slug ) ) . '" target="_blank">'; echo esc_html( $plugin['plugin-name'] ); echo '</a>'; echo '<div class="ast-addon-link-wrapper">'; if ( ! is_plugin_active( $plugin['plugin-init'] ) ) { if ( file_exists( WP_CONTENT_DIR . '/plugins/' . $plugin['plugin-init'] ) ) { echo '<a ' . astra_attr( 'astra-activate-recommended-plugin', array( 'data-slug' => $slug, 'href' => '#', 'data-init' => $plugin['plugin-init'], 'data-settings-link' => esc_url( $plugin['settings-link'] ), 'data-settings-link-text' => $plugin['settings-link-text'], ) ) . '>'; esc_html_e( 'Activate', 'astra' ); echo '</a>'; } else { echo '<a ' . astra_attr( 'astra-install-recommended-plugin', array( 'data-slug' => $slug, 'href' => '#', 'data-init' => $plugin['plugin-init'], 'data-settings-link' => esc_url( $plugin['settings-link'] ), 'data-settings-link-text' => $plugin['settings-link-text'], ) ) . '>'; esc_html_e( 'Activate', 'astra' ); echo '</a>'; } } else { echo '<a ' . astra_attr( 'astra-deactivate-recommended-plugin', array( 'data-slug' => $slug, 'href' => '#', 'data-init' => $plugin['plugin-init'], 'data-settings-link' => esc_url( $plugin['settings-link'] ), 'data-settings-link-text' => $plugin['settings-link-text'], ) ) . '>'; esc_html_e( 'Deactivate', 'astra' ); echo '</a>'; if ( '' !== $plugin['settings-link'] ) { echo '<a ' . astra_attr( 'astra-recommended-plugin-links', array( 'data-slug' => $slug, 'href' => $plugin['settings-link'], ) ) . '>'; echo esc_html( $plugin['settings-link-text'] ); echo '</a>'; } } echo '</div>'; echo '</li>'; } ?> </ul> </div> <?php endif; ?> </div> </div> <?php } } /** * Build plugin's page URL on WordPress.org * https://wordpress.org/plugins/{plugin-slug} * * @since 1.6.9 * @param String $slug plugin slug. * @return String Plugin URL on WordPress.org */ private static function build_worg_plugin_link( $slug ) { return esc_url( trailingslashit( 'https://wordpress.org/plugins/' . $slug ) ); } /** * Required Plugin Activate * * @since 1.2.4 */ public static function required_plugin_activate() { if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing wp_send_json_error( array( 'success' => false, 'message' => __( 'No plugin specified', 'astra' ), ) ); } $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing $activate = activate_plugin( $plugin_init, '', false, true ); if ( '/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() { if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing wp_send_json_error( array( 'success' => false, 'message' => __( 'No plugin specified', 'astra' ), ) ); } $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing $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' ), ) ); } /** * Check compatible theme version. * * @since 1.2.4 */ public static function min_addon_version_message() { $astra_global_options = get_option( 'astra-settings' ); if ( isset( $astra_global_options['astra-addon-auto-version'] ) && defined( 'ASTRA_EXT_VER' ) ) { if ( version_compare( $astra_global_options['astra-addon-auto-version'], '1.2.1' ) < 0 ) { // If addon is not updated & White Label for Addon is added then show the white labelewd pro name. $astra_addon_name = astra_get_addon_name(); $update_astra_addon_link = astra_get_pro_url( 'https://wpastra.com/?p=25258', 'astra-dashboard', 'update-to-astra-pro', 'welcome-page' ); if ( class_exists( 'Astra_Ext_White_Label_Markup' ) ) { $plugin_data = Astra_Ext_White_Label_Markup::$branding; if ( ! empty( $plugin_data['astra-pro']['name'] ) ) { $update_astra_addon_link = ''; } } $class = 'ast-notice ast-notice-error'; $message = sprintf( /* translators: %1$1s: Addon Name, %2$2s: Minimum Required version of the Astra Addon */ __( 'Update to the latest version of %1$2s to make changes in settings below.', 'astra' ), ( ! empty( $update_astra_addon_link ) ) ? '<a href=' . esc_url( $update_astra_addon_link ) . ' target="_blank" rel="noopener">' . $astra_addon_name . '</a>' : $astra_addon_name ); printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); } } } /** * Astra Header Right Section Links * * @since 1.2.4 */ public static function top_header_right_section() { $allowed_html = array( 'svg' => array( 'width' => array(), 'height' => array(), 'xmlns' => array(), 'viewBox' => array(), ), 'path' => array( 'fill' => array(), 'd' => array(), ), ); $top_links = apply_filters( 'astra_header_top_links', array( 'astra-theme-info' => array( 'title' => '<img src=" ' . ASTRA_THEME_URI . 'inc/assets/images/lightning-speed.svg" class="astra-lightning-icon" alt="Astra Lightning Speed">' . __( ' Lightning Fast & Fully Customizable WordPress theme!', 'astra' ), ), ) ); if ( ! empty( $top_links ) ) { ?> <div class="ast-top-links"> <ul> <?php foreach ( (array) $top_links as $key => $info ) { /* translators: %1$s: Top Link URL wrapper, %2$s: Top Link URL, %3$s: Top Link URL target attribute */ printf( '<li><%1$s %2$s %3$s > %4$s </%1$s>', isset( $info['url'] ) ? 'a' : 'span', isset( $info['url'] ) ? 'href="' . esc_url( $info['url'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped isset( $info['url'] ) ? 'target="_blank" rel="noopener"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $info['title']// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } ?> </ul> </div> <?php } } } new Astra_Admin_Settings(); } class-astra-admin-helper.php 0000666 00000004215 15210370260 0012037 0 ustar 00 <?php /** * Admin settings helper * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } if ( ! class_exists( 'Astra_Admin_Helper' ) ) : /** * Admin Helper */ final class Astra_Admin_Helper { /** * Returns an option from the database for * the admin settings page. * * @param string $key The option key. * @param boolean $network Whether to allow the network admin setting to be overridden on subsites. * @return string Return the option value */ public static function get_admin_settings_option( $key, $network = false ) { // Get the site-wide option if we're in the network admin. if ( $network && is_multisite() ) { $value = get_site_option( $key ); } else { $value = get_option( $key ); } return $value; } /** * Updates an option from the admin settings page. * * @param string $key The option key. * @param mixed $value The value to update. * @param bool $network Whether to allow the network admin setting to be overridden on subsites. * @return mixed */ public static function update_admin_settings_option( $key, $value, $network = false ) { // Update the site-wide option since we're in the network admin. if ( $network && is_multisite() ) { update_site_option( $key, $value ); } else { update_option( $key, $value ); } } /** * Returns an option from the database for * the admin settings page. * * @param string $key The option key. * @param bool $network Whether to allow the network admin setting to be overridden on subsites. * @return mixed */ public static function delete_admin_settings_option( $key, $network = false ) { // Get the site-wide option if we're in the network admin. if ( $network && is_multisite() ) { $value = delete_site_option( $key ); } else { $value = delete_option( $key ); } return $value; } } endif;
| ver. 1.4 |
Github
|
.
| PHP 7.0.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings