[
MAINHACK SHELL
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: classes.tar
class-bsf-core-rest.php 0000644 00000004760 15147762167 0011062 0 ustar 00 <?php /** * BSF Core REST API * * @package bsf-core */ /** * License Activation/Deactivation REST API. */ class Bsf_Core_Rest { /** * Member Variable * * @var instance */ private static $instance; /** * The namespace of this controller's route. * * @var string */ public $namespace; /** * The base of this controller's route. * * @var string */ public $rest_base; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor. */ public function __construct() { $this->namespace = 'bsf-core/v1'; $this->rest_base = '/license'; add_action( 'rest_api_init', array( $this, 'register_routes' ) ); } /** * Register the routes for the objects of the controller. */ public function register_routes() { register_rest_route( $this->namespace, $this->rest_base . '/activate', array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'activate_license' ), 'permission_callback' => array( $this, 'get_items_permissions_check' ), 'args' => array( 'product-id' => array( 'type' => 'string', 'required' => true, 'sanitize_callback' => 'sanitize_text_field', ), 'license-key' => array( 'type' => 'string', 'required' => true, 'sanitize_callback' => 'sanitize_text_field', ), ), ) ); } /** * Check if a given request has access to activate license. * * @param WP_REST_Request $request Full details about the request. * @return WP_Error|boolean */ public function get_items_permissions_check( $request ) { if ( current_user_can( 'manage_options' ) ) { return true; } return false; } /** * Activate License Key. * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response Rest Response with access key. */ public function activate_license( $request ) { $product_id = $request->get_param( 'product-id' ); $license_key = $request->get_param( 'license-key' ); $data = array( 'privacy_consent' => true, 'terms_conditions_consent' => true, 'product_id' => $product_id, 'license_key' => $license_key, ); return rest_ensure_response( BSF_License_Manager::instance()->bsf_process_license_activation( $data ) ); } } Bsf_Core_Rest::get_instance(); class-bsf-core-update.php 0000644 00000004234 15147762167 0011363 0 ustar 00 <?php /** * BSF Core Update * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link http://wpastra.com/ * @since Astra 1.0.0 */ if ( ! class_exists( 'BSF_Core_Update' ) ) { /** * BSF_Core_Update initial setup * * @since 1.0.0 */ class BSF_Core_Update { /** * Class instance. * * @access private * @var $instance Class instance. */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { // Theme Updates. add_action( 'admin_init', __CLASS__ . '::init', 0 ); add_filter( 'all_plugins', array( $this, 'update_products_slug' ), 10, 1 ); } /** * Implement theme update logic. * * @since 1.0.0 */ public static function init() { do_action( 'astra_update_before' ); // Get auto saved version number. $saved_version = get_option( 'bsf-updater-version', false ); // If equals then return. if ( version_compare( $saved_version, BSF_UPDATER_VERSION, '=' ) ) { return; } // // Update auto saved version number. update_option( 'bsf-updater-version', BSF_UPDATER_VERSION ); do_action( 'astra_update_after' ); } /** * Update bsf product slug in WP installed plugins data which will be used in enable/disablestaged updates products. * * @param array $plugins All installed plugins. * * @return array */ public function update_products_slug( $plugins ) { $bsf_products = bsf_get_brainstorm_products( true ); foreach ( $bsf_products as $product => $data ) { $plugin_file = isset( $data['template'] ) ? sanitize_text_field( $data['template'] ) : ''; if ( isset( $plugins[ $plugin_file ] ) && ! empty( $data['slug'] ) ) { $plugins[ $plugin_file ]['slug'] = $data['slug']; } } return $plugins; } } } /** * Kicking this off by calling 'get_instance()' method */ BSF_Core_Update::get_instance(); class-bsf-extension-installer.php 0000644 00000004143 15147762167 0013161 0 ustar 00 <?php /** * BSF extension installer class file. * * @package bsf-core */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * BSF_Extension_Installer Extension installer. */ class BSF_Extension_Installer { /** * Constructor */ public function __construct() { add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) ); add_action( 'wp_ajax_bsf-extention-activate', array( $this, 'activate_plugin' ) ); } /** * Load scripts needed for extension installer. * * @param hook $hook current page hook. * @return void */ public function load_scripts( $hook ) { $bsf_ext_inst = apply_filters( 'bsf_extension_installer_screens', array( 'bsf-extensions' ), $hook ); foreach ( $bsf_ext_inst as $key => $value ) { if ( false !== strpos( $hook, $value ) ) { wp_register_script( 'bsf-extension-installer', bsf_core_url( '/assets/js/extension-installer.js' ), array( 'jquery', 'wp-util', 'updates' ), BSF_UPDATER_VERSION, true ); wp_enqueue_script( 'bsf-extension-installer' ); } } } /** * Activates plugin. * * @return void */ public function activate_plugin() { if ( ! wp_verify_nonce( $_POST['security'], 'bsf_activate_extension_nonce' ) ) { wp_send_json_error( array( 'success' => false, 'message' => __( 'You are not authorized to perform this action.', 'bsf' ), ) ); } if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) { wp_send_json_error( array( 'success' => false, 'message' => __( 'No plugin specified', 'bsf' ), ) ); } $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : ''; $activate = activate_plugin( $plugin_init, '', false, true ); if ( is_wp_error( $activate ) ) { wp_send_json_error( array( 'success' => false, 'message' => $activate->get_error_message(), ) ); } wp_send_json_success( array( 'success' => true, 'message' => __( 'Plugin Activated', 'bsf' ), ) ); } } new BSF_Extension_Installer(); class-bsf-rollback-version.php 0000644 00000014261 15147762167 0012430 0 ustar 00 <?php /** * BSF Rollback Version * * @package bsf-core * @author Brainstorm Force * @link http://wpastra.com/ */ /** * BSF_Core_Update initial setup */ class BSF_Rollback_Version { /** * Package URL. * * Holds the package URL. * This will be the actual download URL od zip file. * * @access protected * * @var string Package URL. */ protected $package_url; /** * Product URL. * * @access protected * @var string Product URL. */ protected $product_url; /** * Version. * * Holds the version. * * @access protected * * @var string Package URL. */ protected $version; /** * Plugin name. * * Holds the plugin name. * * @access protected * * @var string Plugin name. */ protected $plugin_name; /** * Plugin slug. * * Holds the plugin slug. * * @access protected * * @var string Plugin slug. */ protected $plugin_slug; /** * Product Title. * * Holds the Product Title. * * @access protected * * @var string Plugin Title. */ protected $product_title; /** * HOlds the Product ID. * * @access protected * @var string Product ID. */ protected $product_id; /** * * Initializing Rollback. * * @access public * * @param array $args Optional.Rollback arguments. Default is an empty array. */ public function __construct( $args = array() ) { foreach ( $args as $key => $value ) { $this->{$key} = $value; } } /** * Apply package. * * @since 1.0.0 * @access protected */ protected function apply_package() { $update_products = get_site_transient( 'update_plugins' ); if ( ! is_object( $update_products ) ) { $update_products = new stdClass(); } $product_info = new stdClass(); $product_info->new_version = $this->version; $product_info->slug = $this->plugin_slug; $product_info->package = $this->package_url; // This will be the actual download URL of zip file.. $product_info->url = $this->product_url; $update_products->response[ $this->plugin_name ] = $product_info; set_site_transient( 'update_plugins', $update_products ); } /** * Upgrade. * * Run WordPress upgrade to Rollback to previous version. * * @since 1.0.0 * @access protected */ protected function upgrade() { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader_args = array( 'url' => 'update.php?action=upgrade-plugin&plugin=' . rawurlencode( $this->plugin_name ), 'plugin' => $this->plugin_name, 'nonce' => 'upgrade-plugin_' . $this->plugin_name, 'title' => apply_filters( 'bsf_rollback_' . $this->product_id . '_title', '<h1>Rollback ' . bsf_get_white_lable_product_name( $this->product_id, $this->product_title ) . ' to version ' . $this->version . ' </h1>' ), ); $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( $upgrader_args ) ); $upgrader->upgrade( $this->plugin_name ); } /** * * Rollback to previous versions. * * @since 1.0.0 * @access public */ public function run() { $this->apply_package(); $this->upgrade(); } /** * Get All versions of product. * * @param string $product_id Product ID. */ public static function bsf_get_product_versions( $product_id ) { if ( empty( $product_id ) ) { return array(); } // Check is transient is expire or User has Enalbed/Disabled the beta version. $versions_transient = get_site_transient( 'bsf-product-versions-' . $product_id ); if ( false !== $versions_transient && false === self::is_beta_enabled_rollback( $product_id ) ) { return $versions_transient; } $per_page = apply_filters( 'bsf_show_versions_to_rollback_' . $product_id, 10 ); $path = bsf_get_api_site( false, true ) . 'versions/' . $product_id . '?per_page=' . $per_page; if ( BSF_Update_Manager::bsf_allow_beta_updates( $product_id ) ) { $path = add_query_arg( 'include_beta', 'true', $path ); } $response = wp_remote_get( $path, array( 'timeout' => '10', ) ); if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) { return array(); } $response_versions = json_decode( wp_remote_retrieve_body( $response ), true ); // Cache product version for 24 hrs. set_site_transient( 'bsf-product-versions-' . $product_id, $response_versions, 24 * HOUR_IN_SECONDS ); return $response_versions; } /** * This will filter the versions and return the versions less than current installed version. * * @param array $version_arr array of versions. * @param string $current_version Current install version. * * @return array */ public static function sort_product_versions( $version_arr, $current_version ) { $rollback_versions = array(); foreach ( $version_arr as $version ) { if ( version_compare( $version, $current_version, '>=' ) ) { continue; } $rollback_versions[] = $version; } return $rollback_versions; } /** * This function is added to update the trasient data of product version on beta update enabled/disabled action. * This will set the flag in db options that should beta versions include/removed in the rollback versions list based on enabled/disabled beta updates for the product. * * @param string $product_id Product ID. * * @return bool */ public static function is_beta_enabled_rollback( $product_id ) { $allow_beta_update = BSF_Update_Manager::bsf_allow_beta_updates( $product_id ); $is_beta_enable = ( false === $allow_beta_update ) ? '0' : '1'; // Set the initial flag for is beta enelbled/ disabled. if ( false === get_option( 'is_beta_enable_rollback_' . $product_id ) ) { update_option( 'is_beta_enable_rollback_' . $product_id, $is_beta_enable ); return false; } // If user has enalbed/ disabled beta update then upadate the rollback version transient data. if ( get_option( 'is_beta_enable_rollback_' . $product_id ) !== $is_beta_enable ) { update_option( 'is_beta_enable_rollback_' . $product_id, $is_beta_enable ); return true; } return false; } } builder/assets/css/minified/style-rtl.min.css 0000644 00000015007 15150261777 0015321 0 ustar 00 .ast-hb-account-login-wrapper .ast-hb-account-login{position:fixed;right:50%;top:50%;padding:35px;max-height:550px;width:340px;margin:0 -170px 0 0;background-color:#f1f1f1;z-index:1000011;box-shadow:0 3px 6px rgba(0,0,0,.3)}.ast-hb-account-login-wrapper .ast-hb-account-login-bg{position:fixed;top:0;bottom:0;right:0;left:0;background:#000;opacity:.7;z-index:1000010;transition:all .3s}.ast-hb-account-login-wrapper .ast-hb-login-header .ast-hb-login-close{background:100% 0;border:0;font-size:24px;line-height:1;padding:.4em;color:inherit;-js-display:flex;display:flex;box-shadow:none}.ast-hb-account-login-wrapper #loginform input[type=password],.ast-hb-account-login-wrapper #loginform input[type=text]{width:100%;max-width:100%;margin-top:10px;border:1px solid;background-color:transparent;vertical-align:middle}.ast-hb-account-login-form-footer a.ast-header-account-footer-link:not(:last-child) span:after{content:"|";margin:0 .4em}.ast-header-account-wrap .ast-header-account-link{pointer-events:none}.ast-header-account-link.ast-account-action-link,.ast-header-account-link.ast-account-action-login,.ast-header-account-link.ast-account-action-login.customize-unpreviewable,.ast-header-break-point .ast-header-account-link{cursor:pointer;pointer-events:all}.ast-header-break-point .ast-hf-account-menu-wrap{display:none}.ast-header-account{-js-display:flex;display:flex}.ast-header-account-wrap .ast-hb-account-login-wrapper{visibility:hidden}.ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-login-header{-js-display:flex;position:absolute;left:0;top:0;display:flex;justify-content:flex-end;min-height:calc(1.2em + 24px)}.ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-account-login{transform:scale(.7);opacity:0;transition:all .3s;overflow:auto}.ast-header-account-wrap .ast-hb-account-login-wrapper.show{visibility:visible}.ast-header-account-wrap .ast-hb-account-login-wrapper.show .ast-hb-account-login{transform:scale(1) translateY(-50%);opacity:1}.ast-hb-login-body{height:100%;position:relative;line-height:1.5}.ast-desktop .ast-hf-account-menu-wrap.ast-main-header-bar-alignment{position:relative}.ast-desktop .main-header-bar .main-header-bar-navigation .ast-account-nav-menu{line-height:1.45}.ast-desktop .ast-account-nav-menu{width:240px;background:#fff;right:-999em;position:absolute;top:0;z-index:99999;list-style:none;margin:0;padding-right:0;border:0;box-shadow:0 4px 10px -2px rgba(0,0,0,.1)}.ast-desktop .ast-account-nav-menu .sub-menu{left:auto;top:0;margin-right:0}.ast-desktop .ast-account-nav-menu .menu-item.focus>.sub-menu,.ast-desktop .ast-account-nav-menu .menu-item:hover>.sub-menu{right:100%}.ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item.focus>.sub-menu,.ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item:hover>.sub-menu{right:-100%}.ast-desktop .ast-account-nav-menu .menu-item .menu-link{padding:.9em 1em}.ast-desktop .ast-account-nav-menu .menu-item{border-style:none}.ast-desktop .ast-account-nav-menu .menu-item.menu-item-has-children>.menu-link:after{position:absolute;left:1em;top:50%;transform:translate(0,-50%) rotate(-270deg)}.ast-desktop .ast-above-header-bar .main-header-menu.ast-account-nav-menu>.menu-item,.ast-desktop .ast-below-header-bar .main-header-menu.ast-account-nav-menu>.menu-item,.ast-desktop .ast-primary-header-bar .main-header-menu.ast-account-nav-menu>.menu-item{height:auto;line-height:unset;bottom:-5px}.site-header-section-left .ast-header-account-wrap.focus .ast-account-nav-menu,.site-header-section-left .ast-header-account-wrap:hover .ast-account-nav-menu{right:-100%;left:auto}.ast-header-account-wrap.focus .ast-account-nav-menu,.ast-header-account-wrap:hover .ast-account-nav-menu{left:-100%;right:auto}.ast-header-account-wrap .woocommerce-MyAccount-navigation-link.is-active a{background:unset}.ast-header-account-wrap .menu-item:last-child>.menu-link{border-style:none}.ast-divider-wrapper{border:0}.ast-mobile-popup-content .ast-header-divider-element{justify-content:center}.ast-header-divider-element{position:relative}.ast-fb-divider-layout-vertical{position:relative}.ast-hb-divider-layout-vertical.ast-header-divider-element{height:100%}.ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element),.ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element){padding:15px 20px}.footer-widget-area .ast-footer-divider-element{position:relative;align-items:center}.footer-widget-area .ast-divider-wrapper{display:inline-block}.ast-builder-footer-grid-columns .ast-fb-divider-layout-horizontal{-js-display:inline-flex;display:inline-flex;vertical-align:middle}[data-section*=section-fb-button-] .ast-builder-button-size-xs .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-xs .ast-custom-button{font-size:13px;padding:8px 20px}[data-section*=section-fb-button-] .ast-builder-button-size-sm .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-sm .ast-custom-button{font-size:15px;padding:10px 40px}[data-section*=section-fb-button-] .ast-builder-button-size-md .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-md .ast-custom-button{font-size:17px;padding:15px 45px}[data-section*=section-fb-button-] .ast-builder-button-size-lg .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-lg .ast-custom-button{font-size:19px;padding:20px 50px}[data-section*=section-fb-button-] .ast-builder-button-size-xl .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-xl .ast-custom-button{font-size:21px;padding:25px 55px}.ast-fb-divider-layout-vertical{-js-display:flex;display:flex}.site-footer-section{position:relative}.ast-builder-language-switcher .ast-builder-language-switcher-menu{list-style:none;margin:0;padding:0;line-height:normal;-webkit-tap-highlight-color:transparent}.ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher{display:block}.ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher-menu{display:block}.ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher{-js-display:flex;display:flex}.ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu{-js-display:flex;display:flex;flex-wrap:wrap}.ast-builder-language-switcher a{-js-display:flex;display:flex;align-items:center}.ast-lswitcher-item-footer,.ast-lswitcher-item-header{-js-display:inline-flex;display:inline-flex}span.ast-lswitcher-item-footer:last-child,span.ast-lswitcher-item-header:last-child{margin-left:0} builder/assets/css/minified/style.min.css 0000644 00000015001 15150261777 0014514 0 ustar 00 .ast-hb-account-login-wrapper .ast-hb-account-login{position:fixed;left:50%;top:50%;padding:35px;max-height:550px;width:340px;margin:0 0 0 -170px;background-color:#f1f1f1;z-index:1000011;box-shadow:0 3px 6px rgba(0,0,0,.3)}.ast-hb-account-login-wrapper .ast-hb-account-login-bg{position:fixed;top:0;bottom:0;left:0;right:0;background:#000;opacity:.7;z-index:1000010;transition:all .3s}.ast-hb-account-login-wrapper .ast-hb-login-header .ast-hb-login-close{background:0 0;border:0;font-size:24px;line-height:1;padding:.4em;color:inherit;-js-display:flex;display:flex;box-shadow:none}.ast-hb-account-login-wrapper #loginform input[type=password],.ast-hb-account-login-wrapper #loginform input[type=text]{width:100%;max-width:100%;margin-top:10px;border:1px solid;background-color:transparent;vertical-align:middle}.ast-hb-account-login-form-footer a.ast-header-account-footer-link:not(:last-child) span:after{content:"|";margin:0 .4em}.ast-header-account-wrap .ast-header-account-link{pointer-events:none}.ast-header-account-link.ast-account-action-link,.ast-header-account-link.ast-account-action-login,.ast-header-account-link.ast-account-action-login.customize-unpreviewable,.ast-header-break-point .ast-header-account-link{cursor:pointer;pointer-events:all}.ast-header-break-point .ast-hf-account-menu-wrap{display:none}.ast-header-account{-js-display:flex;display:flex}.ast-header-account-wrap .ast-hb-account-login-wrapper{visibility:hidden}.ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-login-header{-js-display:flex;position:absolute;right:0;top:0;display:flex;justify-content:flex-end;min-height:calc(1.2em + 24px)}.ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-account-login{transform:scale(.7);opacity:0;transition:all .3s;overflow:auto}.ast-header-account-wrap .ast-hb-account-login-wrapper.show{visibility:visible}.ast-header-account-wrap .ast-hb-account-login-wrapper.show .ast-hb-account-login{transform:scale(1) translateY(-50%);opacity:1}.ast-hb-login-body{height:100%;position:relative;line-height:1.5}.ast-desktop .ast-hf-account-menu-wrap.ast-main-header-bar-alignment{position:relative}.ast-desktop .main-header-bar .main-header-bar-navigation .ast-account-nav-menu{line-height:1.45}.ast-desktop .ast-account-nav-menu{width:240px;background:#fff;left:-999em;position:absolute;top:0;z-index:99999;list-style:none;margin:0;padding-left:0;border:0;box-shadow:0 4px 10px -2px rgba(0,0,0,.1)}.ast-desktop .ast-account-nav-menu .sub-menu{right:auto;top:0;margin-left:0}.ast-desktop .ast-account-nav-menu .menu-item.focus>.sub-menu,.ast-desktop .ast-account-nav-menu .menu-item:hover>.sub-menu{left:100%}.ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item.focus>.sub-menu,.ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item:hover>.sub-menu{left:-100%}.ast-desktop .ast-account-nav-menu .menu-item .menu-link{padding:.9em 1em}.ast-desktop .ast-account-nav-menu .menu-item{border-style:none}.ast-desktop .ast-account-nav-menu .menu-item.menu-item-has-children>.menu-link:after{position:absolute;right:1em;top:50%;transform:translate(0,-50%) rotate(270deg)}.ast-desktop .ast-above-header-bar .main-header-menu.ast-account-nav-menu>.menu-item,.ast-desktop .ast-below-header-bar .main-header-menu.ast-account-nav-menu>.menu-item,.ast-desktop .ast-primary-header-bar .main-header-menu.ast-account-nav-menu>.menu-item{height:auto;line-height:unset;bottom:-5px}.site-header-section-left .ast-header-account-wrap.focus .ast-account-nav-menu,.site-header-section-left .ast-header-account-wrap:hover .ast-account-nav-menu{left:-100%;right:auto}.ast-header-account-wrap.focus .ast-account-nav-menu,.ast-header-account-wrap:hover .ast-account-nav-menu{right:-100%;left:auto}.ast-header-account-wrap .woocommerce-MyAccount-navigation-link.is-active a{background:unset}.ast-header-account-wrap .menu-item:last-child>.menu-link{border-style:none}.ast-divider-wrapper{border:0}.ast-mobile-popup-content .ast-header-divider-element{justify-content:center}.ast-header-divider-element{position:relative}.ast-fb-divider-layout-vertical{position:relative}.ast-hb-divider-layout-vertical.ast-header-divider-element{height:100%}.ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element),.ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element){padding:15px 20px}.footer-widget-area .ast-footer-divider-element{position:relative;align-items:center}.footer-widget-area .ast-divider-wrapper{display:inline-block}.ast-builder-footer-grid-columns .ast-fb-divider-layout-horizontal{-js-display:inline-flex;display:inline-flex;vertical-align:middle}[data-section*=section-fb-button-] .ast-builder-button-size-xs .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-xs .ast-custom-button{font-size:13px;padding:8px 20px}[data-section*=section-fb-button-] .ast-builder-button-size-sm .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-sm .ast-custom-button{font-size:15px;padding:10px 40px}[data-section*=section-fb-button-] .ast-builder-button-size-md .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-md .ast-custom-button{font-size:17px;padding:15px 45px}[data-section*=section-fb-button-] .ast-builder-button-size-lg .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-lg .ast-custom-button{font-size:19px;padding:20px 50px}[data-section*=section-fb-button-] .ast-builder-button-size-xl .ast-custom-button,[data-section*=section-hb-button-] .ast-builder-button-size-xl .ast-custom-button{font-size:21px;padding:25px 55px}.ast-fb-divider-layout-vertical{-js-display:flex;display:flex}.site-footer-section{position:relative}.ast-builder-language-switcher .ast-builder-language-switcher-menu{list-style:none;margin:0;padding:0;line-height:normal;-webkit-tap-highlight-color:transparent}.ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher{display:block}.ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher-menu{display:block}.ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher{-js-display:flex;display:flex}.ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu{-js-display:flex;display:flex;flex-wrap:wrap}.ast-builder-language-switcher a{-js-display:flex;display:flex;align-items:center}.ast-lswitcher-item-footer,.ast-lswitcher-item-header{-js-display:inline-flex;display:inline-flex}span.ast-lswitcher-item-footer:last-child,span.ast-lswitcher-item-header:last-child{margin-right:0} builder/assets/css/unminified/style-rtl.css 0000644 00000017527 15150261777 0015113 0 ustar 00 .ast-hb-account-login-wrapper .ast-hb-account-login { position: fixed; right: 50%; top: 50%; padding: 35px; max-height: 550px; width: 340px; margin: 0 -170px 0 0; background-color: #f1f1f1; z-index: 1000011; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); } .ast-hb-account-login-wrapper .ast-hb-account-login-bg { position: fixed; top: 0; bottom: 0; right: 0; left: 0; background: #000; opacity: .7; z-index: 1000010; transition: all 0.3s; } .ast-hb-account-login-wrapper .ast-hb-login-header .ast-hb-login-close { background: 100% 0; border: 0; font-size: 24px; line-height: 1; padding: .4em; color: inherit; -js-display: flex; display: flex; box-shadow: none; } .ast-hb-account-login-wrapper #loginform input[type=text], .ast-hb-account-login-wrapper #loginform input[type=password] { width: 100%; max-width: 100%; margin-top: 10px; border: 1px solid; background-color: transparent; vertical-align: middle; } .ast-hb-account-login-form-footer a.ast-header-account-footer-link:not(:last-child) span:after { content: "|"; margin: 0 0.4em; } .ast-header-account-wrap .ast-header-account-link { pointer-events: none; } .ast-header-account-link.ast-account-action-link, .ast-header-break-point .ast-header-account-link, .ast-header-account-link.ast-account-action-login, .ast-header-account-link.ast-account-action-login.customize-unpreviewable { cursor: pointer; pointer-events: all; } .ast-header-break-point .ast-hf-account-menu-wrap { display: none; } .ast-header-account { -js-display: flex; display: flex; } .ast-header-account-wrap .ast-hb-account-login-wrapper { visibility: hidden; } .ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-login-header { -js-display: flex; position: absolute; left: 0; top: 0; display: flex; justify-content: flex-end; min-height: calc(1.2em + 24px); } .ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-account-login { transform: scale(0.7); opacity: 0; transition: all 0.3s; overflow: auto; } .ast-header-account-wrap .ast-hb-account-login-wrapper.show { visibility: visible; } .ast-header-account-wrap .ast-hb-account-login-wrapper.show .ast-hb-account-login { transform: scale(1) translateY(-50%); opacity: 1; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } .ast-hb-login-body { height: 100%; position: relative; line-height: 1.5; } /* menu */ .ast-desktop .ast-hf-account-menu-wrap.ast-main-header-bar-alignment { position: relative; } .ast-desktop .main-header-bar .main-header-bar-navigation .ast-account-nav-menu { line-height: 1.45; } .ast-desktop .ast-account-nav-menu { width: 240px; background: #fff; right: -999em; position: absolute; top: 0px; z-index: 99999; list-style: none; margin: 0; padding-right: 0; border: 0; box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.1); } .ast-desktop .ast-account-nav-menu .sub-menu { left: auto; top: 0; margin-right: 0; } .ast-desktop .ast-account-nav-menu .menu-item.focus > .sub-menu, .ast-desktop .ast-account-nav-menu .menu-item:hover > .sub-menu { right: 100%; } .ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item.focus > .sub-menu, .ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item:hover > .sub-menu { right: -100%; } .ast-desktop .ast-account-nav-menu .menu-item .menu-link { padding: .9em 1em; } .ast-desktop .ast-account-nav-menu .menu-item { border-style: none; } .ast-desktop .ast-account-nav-menu .menu-item.menu-item-has-children > .menu-link:after { position: absolute; left: 1em; top: 50%; transform: translate(0, -50%) rotate(-270deg); } .ast-desktop .ast-primary-header-bar .main-header-menu.ast-account-nav-menu > .menu-item, .ast-desktop .ast-above-header-bar .main-header-menu.ast-account-nav-menu > .menu-item, .ast-desktop .ast-below-header-bar .main-header-menu.ast-account-nav-menu > .menu-item { height: auto; line-height: unset; bottom: -5px; } .site-header-section-left .ast-header-account-wrap.focus .ast-account-nav-menu, .site-header-section-left .ast-header-account-wrap:hover .ast-account-nav-menu { right: -100%; left: auto; } .ast-header-account-wrap.focus .ast-account-nav-menu, .ast-header-account-wrap:hover .ast-account-nav-menu { left: -100%; right: auto; } .ast-header-account-wrap .woocommerce-MyAccount-navigation-link.is-active a { background: unset; } .ast-header-account-wrap .menu-item:last-child > .menu-link { border-style: none; } .ast-divider-wrapper { border: 0; } .ast-mobile-popup-content .ast-header-divider-element { justify-content: center; } .ast-header-divider-element { position: relative; } .ast-fb-divider-layout-vertical { position: relative; } .ast-hb-divider-layout-vertical.ast-header-divider-element { height: 100%; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { padding: 15px 20px; } .footer-widget-area .ast-footer-divider-element { position: relative; align-items: center; } .footer-widget-area .ast-divider-wrapper { display: inline-block; } .ast-builder-footer-grid-columns .ast-fb-divider-layout-horizontal { -js-display: inline-flex; display: inline-flex; vertical-align: middle; } /** * Button. */ [data-section*="section-hb-button-"] .ast-builder-button-size-xs .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-xs .ast-custom-button { font-size: 13px; padding: 8px 20px; } [data-section*="section-hb-button-"] .ast-builder-button-size-sm .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-sm .ast-custom-button { font-size: 15px; padding: 10px 40px; } [data-section*="section-hb-button-"] .ast-builder-button-size-md .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-md .ast-custom-button { font-size: 17px; padding: 15px 45px; } [data-section*="section-hb-button-"] .ast-builder-button-size-lg .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-lg .ast-custom-button { font-size: 19px; padding: 20px 50px; } [data-section*="section-hb-button-"] .ast-builder-button-size-xl .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-xl .ast-custom-button { font-size: 21px; padding: 25px 55px; } .ast-fb-divider-layout-vertical { -js-display: flex; display: flex; } .site-footer-section { position: relative; } .ast-builder-language-switcher .ast-builder-language-switcher-menu { list-style: none; margin: 0; padding: 0; line-height: normal; -webkit-tap-highlight-color: transparent; } .ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher { display: block; } .ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher-menu { display: block; } .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher { -js-display: flex; display: flex; } .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu { -js-display: flex; display: flex; flex-wrap: wrap; } .ast-builder-language-switcher a { -js-display: flex; display: flex; align-items: center; } .ast-lswitcher-item-header, .ast-lswitcher-item-footer { -js-display: inline-flex; display: inline-flex; } span.ast-lswitcher-item-footer:last-child, span.ast-lswitcher-item-header:last-child { margin-left: 0px; } builder/assets/css/unminified/style.css 0000644 00000017521 15150261777 0014306 0 ustar 00 .ast-hb-account-login-wrapper .ast-hb-account-login { position: fixed; left: 50%; top: 50%; padding: 35px; max-height: 550px; width: 340px; margin: 0 0 0 -170px; background-color: #f1f1f1; z-index: 1000011; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); } .ast-hb-account-login-wrapper .ast-hb-account-login-bg { position: fixed; top: 0; bottom: 0; left: 0; right: 0; background: #000; opacity: .7; z-index: 1000010; transition: all 0.3s; } .ast-hb-account-login-wrapper .ast-hb-login-header .ast-hb-login-close { background: 0 0; border: 0; font-size: 24px; line-height: 1; padding: .4em; color: inherit; -js-display: flex; display: flex; box-shadow: none; } .ast-hb-account-login-wrapper #loginform input[type=text], .ast-hb-account-login-wrapper #loginform input[type=password] { width: 100%; max-width: 100%; margin-top: 10px; border: 1px solid; background-color: transparent; vertical-align: middle; } .ast-hb-account-login-form-footer a.ast-header-account-footer-link:not(:last-child) span:after { content: "|"; margin: 0 0.4em; } .ast-header-account-wrap .ast-header-account-link { pointer-events: none; } .ast-header-account-link.ast-account-action-link, .ast-header-break-point .ast-header-account-link, .ast-header-account-link.ast-account-action-login, .ast-header-account-link.ast-account-action-login.customize-unpreviewable { cursor: pointer; pointer-events: all; } .ast-header-break-point .ast-hf-account-menu-wrap { display: none; } .ast-header-account { -js-display: flex; display: flex; } .ast-header-account-wrap .ast-hb-account-login-wrapper { visibility: hidden; } .ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-login-header { -js-display: flex; position: absolute; right: 0; top: 0; display: flex; justify-content: flex-end; min-height: calc(1.2em + 24px); } .ast-header-account-wrap .ast-hb-account-login-wrapper .ast-hb-account-login { transform: scale(0.7); opacity: 0; transition: all 0.3s; overflow: auto; } .ast-header-account-wrap .ast-hb-account-login-wrapper.show { visibility: visible; } .ast-header-account-wrap .ast-hb-account-login-wrapper.show .ast-hb-account-login { transform: scale(1) translateY(-50%); opacity: 1; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } .ast-hb-login-body { height: 100%; position: relative; line-height: 1.5; } /* menu */ .ast-desktop .ast-hf-account-menu-wrap.ast-main-header-bar-alignment { position: relative; } .ast-desktop .main-header-bar .main-header-bar-navigation .ast-account-nav-menu { line-height: 1.45; } .ast-desktop .ast-account-nav-menu { width: 240px; background: #fff; left: -999em; position: absolute; top: 0px; z-index: 99999; list-style: none; margin: 0; padding-left: 0; border: 0; box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.1); } .ast-desktop .ast-account-nav-menu .sub-menu { right: auto; top: 0; margin-left: 0; } .ast-desktop .ast-account-nav-menu .menu-item.focus > .sub-menu, .ast-desktop .ast-account-nav-menu .menu-item:hover > .sub-menu { left: 100%; } .ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item.focus > .sub-menu, .ast-desktop .ast-account-nav-menu .ast-left-align-sub-menu.menu-item:hover > .sub-menu { left: -100%; } .ast-desktop .ast-account-nav-menu .menu-item .menu-link { padding: .9em 1em; } .ast-desktop .ast-account-nav-menu .menu-item { border-style: none; } .ast-desktop .ast-account-nav-menu .menu-item.menu-item-has-children > .menu-link:after { position: absolute; right: 1em; top: 50%; transform: translate(0, -50%) rotate(270deg); } .ast-desktop .ast-primary-header-bar .main-header-menu.ast-account-nav-menu > .menu-item, .ast-desktop .ast-above-header-bar .main-header-menu.ast-account-nav-menu > .menu-item, .ast-desktop .ast-below-header-bar .main-header-menu.ast-account-nav-menu > .menu-item { height: auto; line-height: unset; bottom: -5px; } .site-header-section-left .ast-header-account-wrap.focus .ast-account-nav-menu, .site-header-section-left .ast-header-account-wrap:hover .ast-account-nav-menu { left: -100%; right: auto; } .ast-header-account-wrap.focus .ast-account-nav-menu, .ast-header-account-wrap:hover .ast-account-nav-menu { right: -100%; left: auto; } .ast-header-account-wrap .woocommerce-MyAccount-navigation-link.is-active a { background: unset; } .ast-header-account-wrap .menu-item:last-child > .menu-link { border-style: none; } .ast-divider-wrapper { border: 0; } .ast-mobile-popup-content .ast-header-divider-element { justify-content: center; } .ast-header-divider-element { position: relative; } .ast-fb-divider-layout-vertical { position: relative; } .ast-hb-divider-layout-vertical.ast-header-divider-element { height: 100%; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { padding: 15px 20px; } .footer-widget-area .ast-footer-divider-element { position: relative; align-items: center; } .footer-widget-area .ast-divider-wrapper { display: inline-block; } .ast-builder-footer-grid-columns .ast-fb-divider-layout-horizontal { -js-display: inline-flex; display: inline-flex; vertical-align: middle; } /** * Button. */ [data-section*="section-hb-button-"] .ast-builder-button-size-xs .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-xs .ast-custom-button { font-size: 13px; padding: 8px 20px; } [data-section*="section-hb-button-"] .ast-builder-button-size-sm .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-sm .ast-custom-button { font-size: 15px; padding: 10px 40px; } [data-section*="section-hb-button-"] .ast-builder-button-size-md .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-md .ast-custom-button { font-size: 17px; padding: 15px 45px; } [data-section*="section-hb-button-"] .ast-builder-button-size-lg .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-lg .ast-custom-button { font-size: 19px; padding: 20px 50px; } [data-section*="section-hb-button-"] .ast-builder-button-size-xl .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-xl .ast-custom-button { font-size: 21px; padding: 25px 55px; } .ast-fb-divider-layout-vertical { -js-display: flex; display: flex; } .site-footer-section { position: relative; } .ast-builder-language-switcher .ast-builder-language-switcher-menu { list-style: none; margin: 0; padding: 0; line-height: normal; -webkit-tap-highlight-color: transparent; } .ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher { display: block; } .ast-builder-language-switcher-layout-vertical .ast-builder-language-switcher-menu { display: block; } .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher { -js-display: flex; display: flex; } .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu { -js-display: flex; display: flex; flex-wrap: wrap; } .ast-builder-language-switcher a { -js-display: flex; display: flex; align-items: center; } .ast-lswitcher-item-header, .ast-lswitcher-item-footer { -js-display: inline-flex; display: inline-flex; } span.ast-lswitcher-item-footer:last-child, span.ast-lswitcher-item-header:last-child { margin-right: 0px; } builder/assets/scss/style.scss 0000644 00000017355 15150261777 0012532 0 ustar 00 .ast-hb-account-login-wrapper { .ast-hb-account-login { position: fixed; left: 50%; top: 50%; padding: 35px; max-height: 550px; width: 340px; margin: 0 0 0 -170px; background-color: #f1f1f1; z-index: 1000011; box-shadow: 0 3px 6px rgba(0,0,0,.3); } .ast-hb-account-login-bg { position: fixed; top: 0; bottom: 0; left: 0; right: 0; background: #000; opacity: .7; z-index: 1000010; transition: all 0.3s; } .ast-hb-login-header { .ast-hb-login-close { background: 0 0; border: 0; font-size: 24px; line-height: 1; padding: .4em; color: inherit; display: flex; box-shadow: none; } } #loginform { input[type=text], input[type=password] { width: 100%; max-width: 100%; margin-top: 10px; border: 1px solid; background-color: transparent; vertical-align: middle; } } } .ast-hb-account-login-form-footer { a.ast-header-account-footer-link:not(:last-child) { span:after { content: "|"; margin: 0 0.4em; } } } .ast-header-account-wrap .ast-header-account-link { pointer-events: none; } .ast-header-account-link.ast-account-action-link, .ast-header-break-point .ast-header-account-link, .ast-header-account-link.ast-account-action-login, .ast-header-account-link.ast-account-action-login.customize-unpreviewable { cursor: pointer; pointer-events: all; } .ast-header-break-point { .ast-hf-account-menu-wrap { display: none; } } .ast-header-account { display: flex; } .ast-header-account-wrap { .ast-hb-account-login-wrapper { visibility: hidden; .ast-hb-login-header { -js-display: flex; position: absolute; right: 0; top: 0; display: flex; justify-content: flex-end; min-height: calc(1.2em + 24px); } .ast-hb-account-login { transform: scale(0.7); opacity: 0; transition: all 0.3s; overflow: auto; } &.show { visibility: visible; .ast-hb-account-login { transform: scale(1)translateY(-50%); opacity: 1; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } } } } .ast-hb-login-body { height: 100%; position: relative; line-height: 1.5; } /* menu */ .ast-desktop { .ast-hf-account-menu-wrap.ast-main-header-bar-alignment { position: relative; } .main-header-bar { .main-header-bar-navigation { .ast-account-nav-menu { line-height: 1.45; } } } .ast-account-nav-menu { width: 240px; background: #fff; left: -999em; position: absolute; top: 0px; z-index: 99999; list-style: none; margin: 0; padding-left: 0; border: 0; box-shadow: 0 4px 10px -2px rgba(0,0,0,.1); .sub-menu { right: auto; top: 0; margin-left: 0; } .menu-item.focus, .menu-item:hover { > .sub-menu { left: 100%; } } .ast-left-align-sub-menu.menu-item.focus, .ast-left-align-sub-menu.menu-item:hover { > .sub-menu { left: -100%; } } .menu-item { .menu-link { padding: .9em 1em; } } .menu-item { border-style: none; } .menu-item.menu-item-has-children>.menu-link:after { position: absolute; right: 1em; top: 50%; transform: translate(0,-50%) rotate(270deg); } } .ast-primary-header-bar, .ast-above-header-bar, .ast-below-header-bar { .main-header-menu.ast-account-nav-menu { > .menu-item { height: auto; line-height: unset; bottom:-5px; } } } } .site-header-section-left { .ast-header-account-wrap.focus, .ast-header-account-wrap:hover { .ast-account-nav-menu { left: -100%; right: auto; } } } .ast-header-account-wrap { &.focus, &:hover { .ast-account-nav-menu { right: -100%; left: auto; } } .woocommerce-MyAccount-navigation-link.is-active { a { background: unset; } } .menu-item:last-child > .menu-link { border-style: none; } } // Divider CSS. .ast-divider-wrapper { border: 0; } .ast-mobile-popup-content { .ast-header-divider-element { justify-content: center; } } .ast-header-divider-element { position: relative; } .ast-fb-divider-layout-vertical { position: relative; } .ast-hb-divider-layout-vertical { &.ast-header-divider-element{ height: 100%; } } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content, .ast-mobile-header-content { .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { padding: 15px 20px; } } .footer-widget-area { .ast-footer-divider-element { position: relative; align-items: center; } .ast-divider-wrapper { display: inline-block; } } .ast-builder-footer-grid-columns { .ast-fb-divider-layout-horizontal { display: inline-flex; vertical-align: middle; } } /** * Button. */ [data-section*="section-hb-button-"] .ast-builder-button-size-xs .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-xs .ast-custom-button { font-size: 13px; padding: 8px 20px; } [data-section*="section-hb-button-"] .ast-builder-button-size-sm .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-sm .ast-custom-button { font-size: 15px; padding: 10px 40px; } [data-section*="section-hb-button-"] .ast-builder-button-size-md .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-md .ast-custom-button { font-size: 17px; padding: 15px 45px; } [data-section*="section-hb-button-"] .ast-builder-button-size-lg .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-lg .ast-custom-button { font-size: 19px; padding: 20px 50px; } [data-section*="section-hb-button-"] .ast-builder-button-size-xl .ast-custom-button, [data-section*="section-fb-button-"] .ast-builder-button-size-xl .ast-custom-button { font-size: 21px; padding: 25px 55px; } .ast-fb-divider-layout-vertical { display: flex; } .site-footer-section { position: relative; } // Language Switcher CSS. .ast-builder-language-switcher { .ast-builder-language-switcher-menu { list-style: none; margin: 0; padding: 0; line-height: normal; -webkit-tap-highlight-color: transparent; } } .ast-builder-language-switcher-layout-vertical { .ast-builder-language-switcher { display: block; } .ast-builder-language-switcher-menu { display: block; } } .ast-builder-language-switcher-layout-horizontal { .ast-builder-language-switcher { display: flex; } .ast-builder-language-switcher-menu { display: flex; flex-wrap: wrap; } } .ast-builder-language-switcher a { display: flex; align-items: center; } .ast-lswitcher-item-header, .ast-lswitcher-item-footer { display: inline-flex; } span.ast-lswitcher-item-footer, span.ast-lswitcher-item-header { &:last-child { margin-right: 0px; } } builder/markup/class-astra-addon-builder-footer.php 0000644 00000004056 15150261777 0016442 0 ustar 00 <?php /** * Astra Builder Loader. * * @package astra-builder */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Addon_Builder_Footer' ) ) { /** * Class Astra_Addon_Builder_Footer. */ final class Astra_Addon_Builder_Footer { /** * Member Variable * * @var instance */ private static $instance = null; /** * Dynamic Methods. * * @var dynamic methods */ private static $methods = array(); /** * Initiator */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { add_action( 'astra_footer_divider_' . $index, array( $this, 'footer_divider_' . $index ) ); self::$methods[] = 'footer_divider_' . $index; } add_action( 'astra_footer_language_switcher', array( $this, 'footer_language_switcher' ) ); } /** * Callback when method not exists. * * @param string $func function name. * @param array $params function parameters. */ public function __call( $func, $params ) { if ( in_array( $func, self::$methods, true ) ) { if ( 0 === strpos( $func, 'footer_divider_' ) ) { $index = (int) substr( $func, strrpos( $func, '_' ) + 1 ); if ( $index ) { Astra_Addon_Builder_UI_Controller::render_divider_markup( str_replace( '_', '-', $func ) ); } } } } /** * Render language switcher. */ public function footer_language_switcher() { Astra_Addon_Builder_UI_Controller::render_language_switcher_markup( 'footer-language-switcher', 'footer' ); } } /** * Prepare if class 'Astra_Addon_Builder_Footer' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Addon_Builder_Footer::get_instance(); } builder/markup/class-astra-addon-builder-header.php 0000644 00000005203 15150261777 0016367 0 ustar 00 <?php /** * Astra Addon Builder Loader. * * @package astra-builder */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Addon_Builder_Header' ) ) { /** * Class Astra_Addon_Builder_Header. */ final class Astra_Addon_Builder_Header { /** * Member Variable * * @var instance */ private static $instance = null; /** * Dynamic Methods. * * @var dynamic methods */ private static $methods = array(); /** * Initiator */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { if ( true === astra_addon_builder_helper()->is_header_footer_builder_active ) { $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { add_action( 'astra_header_divider_' . $index, array( $this, 'header_divider_' . $index ) ); self::$methods[] = 'header_divider_' . $index; } add_action( 'astra_header_language_switcher', array( $this, 'header_language_switcher' ) ); add_action( 'astra_desktop_header_content', array( $this, 'render_desktop_column' ), 10, 2 ); add_action( 'astra_render_desktop_popup', array( $this, 'render_desktop_column' ), 10, 2 ); } } /** * Callback when method not exists. * * @param string $func function name. * @param array $params function parameters. */ public function __call( $func, $params ) { if ( in_array( $func, self::$methods, true ) ) { if ( 0 === strpos( $func, 'header_divider_' ) ) { $index = (int) substr( $func, strrpos( $func, '_' ) + 1 ); if ( $index ) { Astra_Addon_Builder_UI_Controller::render_divider_markup( str_replace( '_', '-', $func ) ); } } } } /** * Render language switcher. */ public function header_language_switcher() { Astra_Addon_Builder_UI_Controller::render_language_switcher_markup( 'header-language-switcher', 'header' ); } /** * Call desktop component header UI. * * @since 3.3.0 * @param string $row row. * @param string $column column. */ public function render_desktop_column( $row, $column ) { Astra_Builder_Helper::render_builder_markup( $row, $column, 'desktop', 'header' ); } } /** * Prepare if class 'Astra_Addon_Builder_Header' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Addon_Builder_Header::get_instance(); } builder/type/base/assets/js/customizer-preview.js 0000644 00000056663 15150261777 0016257 0 ustar 00 /** * Divider Component CSS. * * @param string builder_type Builder Type. * @param string divider_count HTML Count. * @since x.x.x * */ function astra_builder_divider_css( builder_type = 'header', divider_count ) { var tablet_break_point = astraBuilderPreview.tablet_break_point || 768, mobile_break_point = astraBuilderPreview.mobile_break_point || 544; for ( var index = 1; index <= divider_count; index++ ) { let selector = ( 'header' === builder_type ) ? '.ast-header-divider-' + index : '.ast-builder-grid-row-container-inner .footer-widget-area[data-section="section-fb-divider-' + index + '"]'; let section = ( 'header' === builder_type ) ? 'section-hb-divider-' + index : 'section-fb-divider-' + index; // Advanced Visibility CSS Generation. astra_builder_visibility_css( section, selector ); ( function ( index ) { astra_css( 'astra-settings[' + builder_type + '-divider-' + index + '-style]', 'border-style', selector + ' .ast-divider-wrapper' ); wp.customize( 'astra-settings[' + builder_type + '-divider-' + index + '-color]', function( setting ) { setting.bind( function( color ) { var dynamicStyle = '', borderStyle = (typeof ( wp.customize._value['astra-settings[' + builder_type + '-divider-' + index + '-style]'] ) != 'undefined') ? wp.customize._value['astra-settings[' + builder_type + '-divider-' + index + '-style]']._value : ''; dynamicStyle += selector + ' .ast-divider-wrapper, .ast-mobile-popup-content ' + selector + ' .ast-divider-wrapper {'; dynamicStyle += 'border-style: ' + borderStyle + ';'; dynamicStyle += 'border-color: ' + color + ';'; dynamicStyle += '} '; astra_add_dynamic_css( builder_type + '-divider-' + index + '-color', dynamicStyle ); } ); } ); wp.customize( 'astra-settings[' + builder_type + '-divider-' + index + '-layout]', function ( value ) { value.bind( function ( newval ) { var context = ( 'header' === builder_type ) ? 'hb' : 'fb'; var side_class = 'ast-' + context + '-divider-layout-' + newval; jQuery( '.ast-' + builder_type + '-divider-' + index ).removeClass( 'ast-' + context + '-divider-layout-horizontal' ); jQuery( '.ast-' + builder_type + '-divider-' + index ).removeClass( 'ast-' + context + '-divider-layout-vertical' ); jQuery( '.ast-' + builder_type + '-divider-' + index ).addClass( side_class ); } ); } ); // Divider Thickness. wp.customize( 'astra-settings[' + builder_type + '-divider-' + index + '-thickness]', function( value ) { value.bind( function( size ) { if( size.desktop != '' || size.tablet != '' || size.mobile != '' ) { let layout = wp.customize( 'astra-settings[' + builder_type + '-divider-' + index + '-layout]' ).get(); var dynamicStyle = ''; if ( 'horizontal' === layout ) { dynamicStyle += selector + ' .ast-divider-layout-horizontal {'; dynamicStyle += 'border-top-width: ' + size.desktop + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + ' .ast-divider-layout-horizontal {'; dynamicStyle += 'border-top-width: ' + size.tablet + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + ' .ast-divider-layout-horizontal {'; dynamicStyle += 'border-top-width: ' + size.mobile + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } else { dynamicStyle += selector + ' .ast-divider-layout-vertical {'; dynamicStyle += 'border-right-width: ' + size.desktop + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + ' .ast-divider-layout-vertical {'; dynamicStyle += 'border-right-width: ' + size.tablet + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + ' .ast-divider-layout-vertical {'; dynamicStyle += 'border-right-width: ' + size.mobile + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( builder_type + '-divider-' + index + '-thickness', dynamicStyle ); } } ); } ); // Divider Size. wp.customize( 'astra-settings[' + builder_type + '-divider-' + index + '-size]', function( value ) { value.bind( function( size ) { if( size.desktop != '' || size.tablet != '' || size.mobile != '' ) { var dynamicStyle = ''; if ( 'footer' === builder_type ) { dynamicStyle += selector + '.ast-fb-divider-layout-horizontal .ast-divider-layout-horizontal {'; dynamicStyle += 'width: ' + size.desktop + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + '.ast-fb-divider-layout-horizontal .ast-divider-layout-horizontal {'; dynamicStyle += 'width: ' + size.tablet + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + '.ast-fb-divider-layout-horizontal .ast-divider-layout-horizontal {'; dynamicStyle += 'width: ' + size.mobile + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } else { dynamicStyle += selector + '.ast-hb-divider-layout-vertical .ast-divider-layout-vertical {'; dynamicStyle += 'height: ' + size.desktop + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + '.ast-hb-divider-layout-vertical .ast-divider-layout-vertical {'; dynamicStyle += 'height: ' + size.tablet + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + '.ast-hb-divider-layout-vertical .ast-divider-layout-vertical {'; dynamicStyle += 'height: ' + size.mobile + '%' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( builder_type + '-divider-' + index + '-size', dynamicStyle ); } } ); } ); // Footer Vertical Divider Size. wp.customize( 'astra-settings[footer-vertical-divider-' + index + '-size]', function( value ) { value.bind( function( size ) { var dynamicStyle = ''; if( size.desktop != '' || size.tablet != '' || size.mobile != '' ) { dynamicStyle += selector + '.ast-fb-divider-layout-vertical .ast-divider-layout-vertical {'; dynamicStyle += 'height: ' + size.desktop + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + '.ast-fb-divider-layout-vertical .ast-divider-layout-vertical {'; dynamicStyle += 'height: ' + size.tablet + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + '.ast-fb-divider-layout-vertical .ast-divider-layout-vertical {'; dynamicStyle += 'height: ' + size.mobile + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( builder_type + '-vertical-divider-' + index + '-size', dynamicStyle ); } ); } ); // Header Horizontal Divider Size. wp.customize( 'astra-settings[header-horizontal-divider-' + index + '-size]', function( value ) { value.bind( function( size ) { var dynamicStyle = ''; if( size.desktop != '' || size.tablet != '' || size.mobile != '' ) { dynamicStyle += selector + '.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal {'; dynamicStyle += 'width: ' + size.desktop + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + '.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal {'; dynamicStyle += 'width: ' + size.tablet + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + '.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal {'; dynamicStyle += 'width: ' + size.mobile + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( builder_type + '-horizontal-divider-' + index + '-size', dynamicStyle ); } ); } ); // Margin. wp.customize( 'astra-settings[' + section + '-margin]', function( value ) { value.bind( function( margin ) { if( margin.desktop.bottom != '' || margin.desktop.top != '' || margin.desktop.left != '' || margin.desktop.right != '' || margin.tablet.bottom != '' || margin.tablet.top != '' || margin.tablet.left != '' || margin.tablet.right != '' || margin.mobile.bottom != '' || margin.mobile.top != '' || margin.mobile.left != '' || margin.mobile.right != '' ) { var dynamicStyle = ''; dynamicStyle += selector + ' {'; dynamicStyle += 'margin-left: ' + margin['desktop']['left'] + margin['desktop-unit'] + ';'; dynamicStyle += 'margin-right: ' + margin['desktop']['right'] + margin['desktop-unit'] + ';'; dynamicStyle += 'margin-top: ' + margin['desktop']['top'] + margin['desktop-unit'] + ';'; dynamicStyle += 'margin-bottom: ' + margin['desktop']['bottom'] + margin['desktop-unit'] + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + ' {'; dynamicStyle += 'margin-left: ' + margin['tablet']['left'] + margin['tablet-unit'] + ';'; dynamicStyle += 'margin-right: ' + margin['tablet']['right'] + margin['tablet-unit'] + ';'; dynamicStyle += 'margin-top: ' + margin['tablet']['top'] + margin['desktop-unit'] + ';'; dynamicStyle += 'margin-bottom: ' + margin['tablet']['bottom'] + margin['desktop-unit'] + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + ' {'; dynamicStyle += 'margin-left: ' + margin['mobile']['left'] + margin['mobile-unit'] + ';'; dynamicStyle += 'margin-right: ' + margin['mobile']['right'] + margin['mobile-unit'] + ';'; dynamicStyle += 'margin-top: ' + margin['mobile']['top'] + margin['desktop-unit'] + ';'; dynamicStyle += 'margin-bottom: ' + margin['mobile']['bottom'] + margin['desktop-unit'] + ';'; dynamicStyle += '} '; dynamicStyle += '} '; astra_add_dynamic_css( section + '-margin', dynamicStyle ); } } ); } ); })(index); } } /** * Generate spacing preview CSS based on stack-on device option. */ function astra_generate_spacing_preview_social_css( index, builder_type, stack_on, spacing ) { let selector = '.ast-' + builder_type + '-social-' + index + '-wrap'; var tablet_break_point = astraBuilderPreview.tablet_break_point || 768, mobile_break_point = astraBuilderPreview.mobile_break_point || 544; var space = ''; var dynamicStyle = ''; if ( 'desktop' === stack_on ) { space = spacing.desktop/2; dynamicStyle += selector + ' .ast-social-stack-desktop .ast-builder-social-element {'; dynamicStyle += 'display: flex;'; dynamicStyle += 'margin-top: ' + space + 'px;'; dynamicStyle += 'margin-bottom: ' + space + 'px;'; dynamicStyle += 'margin-left: unset;'; dynamicStyle += 'margin-right: unset;'; dynamicStyle += '} '; space = spacing.tablet/2; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + ' .ast-social-stack-desktop .ast-builder-social-element {'; dynamicStyle += 'display: flex;'; dynamicStyle += 'margin-top: ' + space + 'px;'; dynamicStyle += 'margin-bottom: ' + space + 'px;'; dynamicStyle += 'margin-left: unset;'; dynamicStyle += 'margin-right: unset;'; dynamicStyle += '} '; dynamicStyle += '} '; space = spacing.mobile/2; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + ' .ast-social-stack-desktop .ast-builder-social-element {'; dynamicStyle += 'display: flex;'; dynamicStyle += 'margin-top: ' + space + 'px;'; dynamicStyle += 'margin-bottom: ' + space + 'px;'; dynamicStyle += 'margin-left: unset;'; dynamicStyle += 'margin-right: unset;'; dynamicStyle += '} '; dynamicStyle += '} '; } if ( 'tablet' === stack_on ) { space = spacing.tablet/2; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + ' .ast-social-stack-tablet .ast-builder-social-element {'; dynamicStyle += 'display: flex;'; dynamicStyle += 'margin-top: ' + space + 'px;'; dynamicStyle += 'margin-bottom: ' + space + 'px;'; dynamicStyle += 'margin-left: unset;'; dynamicStyle += 'margin-right: unset;'; dynamicStyle += '} '; dynamicStyle += '} '; space = spacing.mobile/2; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + ' .ast-social-stack-tablet .ast-builder-social-element {'; dynamicStyle += 'display: flex;'; dynamicStyle += 'margin-top: ' + space + 'px;'; dynamicStyle += 'margin-bottom: ' + space + 'px;'; dynamicStyle += 'margin-left: unset;'; dynamicStyle += 'margin-right: unset;'; dynamicStyle += '} '; dynamicStyle += '} '; } if ( 'mobile' === stack_on ) { space = spacing.mobile/2; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + ' .ast-social-stack-mobile .ast-builder-social-element {'; dynamicStyle += 'display: flex;'; dynamicStyle += 'margin-top: ' + space + 'px;'; dynamicStyle += 'margin-bottom: ' + space + 'px;'; dynamicStyle += 'margin-left: unset;'; dynamicStyle += 'margin-right: unset;'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( builder_type + '-social-icons-' + index + '-icon-space', dynamicStyle ); } /** * Social Component CSS. * * @param string builder_type Builder Type. * @param string social_count HTML Count. * @since x.x.x */ function astra_builder_addon_social_css( builder_type = 'header', social_count ) { for ( var index = 1; index <= social_count; index++ ) { ( function ( index ) { // Margin. wp.customize( 'astra-settings[' + builder_type + '-social-' + index + '-stack]', function( value ) { value.bind( function( value ) { jQuery('.ast-' + builder_type + '-social-' + index + '-wrap .' + builder_type + '-social-inner-wrap').removeClass( 'ast-social-stack-tablet' ); jQuery('.ast-' + builder_type + '-social-' + index + '-wrap .' + builder_type + '-social-inner-wrap').removeClass( 'ast-social-stack-mobile' ); jQuery('.ast-' + builder_type + '-social-' + index + '-wrap .' + builder_type + '-social-inner-wrap').removeClass( 'ast-social-stack-desktop' ); jQuery('.ast-' + builder_type + '-social-' + index + '-wrap .' + builder_type + '-social-inner-wrap').removeClass( 'ast-social-stack-none' ); jQuery('.ast-' + builder_type + '-social-' + index + '-wrap .' + builder_type + '-social-inner-wrap').addClass( 'ast-social-stack-' + value ); let spacing = wp.customize( 'astra-settings[' + builder_type + '-social-' + index + '-space]' ).get(); astra_generate_spacing_preview_social_css( index, builder_type, value, spacing ); } ); } ); // Icon Space. wp.customize( 'astra-settings[' + builder_type + '-social-' + index + '-space]', function( value ) { value.bind( function( spacing ) { let stack_on = wp.customize( 'astra-settings[' + builder_type + '-social-' + index + '-stack]' ).get(); astra_generate_spacing_preview_social_css( index, builder_type, stack_on, spacing ); } ); } ); })( index ); } } /** * language Switcher Component CSS. * * @param string builder_type Builder Type. * @param string lswitcher_count HTML Count. * @since x.x.x * */ function astra_builder_language_switcher_css( builder_type = 'header' ) { var tablet_break_point = astraBuilderPreview.tablet_break_point || 768, mobile_break_point = astraBuilderPreview.mobile_break_point || 544; let selector = ( 'header' === builder_type ) ? '.ast-header-language-switcher' : '.ast-footer-language-switcher-element[data-section="section-fb-language-switcher"]'; let section = ( 'header' === builder_type ) ? 'section-hb-language-switcher' : 'section-fb-language-switcher'; // Advanced Visibility CSS Generation. astra_builder_visibility_css( section, selector ); // Flag spacing. wp.customize( 'astra-settings[' + section + '-flag-spacing]', function( value ) { value.bind( function( size ) { var dynamicStyle = ''; if( size.desktop != '' || size.desktop != '' || size.desktop != '' || size.desktop != '' || size.tablet != '' || size.tablet != '' || size.tablet != '' || size.tablet != '' || size.mobile != '' || size.mobile != '' || size.mobile != '' || size.mobile != '' ) { dynamicStyle += 'span.ast-lswitcher-item-' + builder_type + ' {'; dynamicStyle += 'margin-right: ' + size.desktop + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += 'span.ast-lswitcher-item-' + builder_type + ' {'; dynamicStyle += 'margin-right: ' + size.tablet + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += 'span.ast-lswitcher-item-' + builder_type + ' {'; dynamicStyle += 'margin-right: ' + size.mobile + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( section + '-flag-spacing', dynamicStyle ); } ); } ); // Flag Thickness. wp.customize( 'astra-settings[' + section + '-flag-size]', function( value ) { value.bind( function( size ) { var dynamicStyle = ''; if( size.desktop !== '' || size.tablet !== '' || size.mobile !== '' ) { dynamicStyle += '.ast-lswitcher-item-' + builder_type + ' img {'; dynamicStyle += 'width: ' + size.desktop + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '.ast-lswitcher-item-' + builder_type + ' svg {'; dynamicStyle += 'height: ' + size.desktop + 'px' + ';'; dynamicStyle += 'width: ' + size.desktop + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += '.ast-lswitcher-item-' + builder_type + ' img {'; dynamicStyle += 'width: ' + size.tablet + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '.ast-lswitcher-item-' + builder_type + ' svg {'; dynamicStyle += 'height: ' + size.tablet + 'px' + ';'; dynamicStyle += 'width: ' + size.tablet + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += '.ast-lswitcher-item-' + builder_type + ' img {'; dynamicStyle += 'width: ' + size.mobile + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '.ast-lswitcher-item-' + builder_type + ' svg {'; dynamicStyle += 'height: ' + size.mobile + 'px' + ';'; dynamicStyle += 'width: ' + size.mobile + 'px' + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( section + '-flag-size', dynamicStyle ); } ); } ); } /** * Box Shadow CSS. * * @param string prefix Controls prefix. * @param string selector Builder selector. * */ function astra_addon_box_shadow_css( prefix, selector ) { wp.customize( 'astra-settings[' + prefix + '-box-shadow-control]', function( value ) { value.bind( function( shadow ) { var dynamicStyle = ''; if( shadow.x != '' && shadow.y != '' && shadow.blur != '' && shadow.spread != '' ) { var position = wp.customize( 'astra-settings[' + prefix + '-box-shadow-position]' ).get(); var color = wp.customize( 'astra-settings[' + prefix + '-box-shadow-color]' ).get(); dynamicStyle = astra_addon_get_box_shadow_css( selector, shadow, position, color ); } astra_add_dynamic_css( prefix + '-box-shadow-control', dynamicStyle ); } ); } ); /** * Box Shadow Color. */ wp.customize( 'astra-settings[' + prefix + '-box-shadow-color]', function( value ) { value.bind( function( color ) { var dynamicStyle = ''; if( '' != color ) { var shadow = wp.customize( 'astra-settings[' + prefix + '-box-shadow-control]' ).get(); var position = wp.customize( 'astra-settings[' + prefix + '-box-shadow-position]' ).get(); dynamicStyle = astra_addon_get_box_shadow_css( selector, shadow, position, color ); } astra_add_dynamic_css( prefix + '-box-shadow-control', dynamicStyle ); } ); } ); /** * Box Shadow Position. */ wp.customize( 'astra-settings[' + prefix + '-box-shadow-position]', function( value ) { value.bind( function( position ) { var dynamicStyle = ''; if( '' != position ) { var shadow = wp.customize( 'astra-settings[' + prefix + '-box-shadow-control]' ).get(); var color = wp.customize( 'astra-settings[' + prefix + '-box-shadow-color]' ).get(); dynamicStyle = astra_addon_get_box_shadow_css( selector, shadow, position, color ); } astra_add_dynamic_css( prefix + '-box-shadow-control', dynamicStyle ); } ); } ); } /** * Button Component CSS. * * @param string builder_type Builder Type. * @param string button_count Button Count. * */ function astra_addon_button_css( builder_type = 'header', button_count ) { for ( var index = 1; index <= button_count; index++ ) { (function (index) { var selector = '.ast-' + builder_type + '-button-' + index + ' .ast-builder-button-wrap .ast-custom-button'; // Box Shadow CSS Generation. astra_addon_box_shadow_css( builder_type + '-button' + index, selector ); astra_font_extras_css( builder_type + '-button' + index + '-font-extras', selector ); })(index); } } /** * Button Component CSS. * * @param string builder_type Builder Type. * @param string button_count Button Count. * */ function astra_addon_get_box_shadow_css( selector, shadow, position, color ) { var dynamicStyle = ''; if( shadow.x != '' && shadow.y != '' && shadow.blur != '' && shadow.spread != '' ) { var box_shadow_color = ( '' !== color ) ? color + ' ' : 'rgba(0,0,0,0.5) '; var shadow_position = ( 'undefined' != typeof position && 'inset' == position ) ? 'inset' : ''; var x_val = ( '' !== shadow.x ) ? ( shadow.x + 'px ' ) : '0px '; var y_val = ( '' !== shadow.y ) ? ( shadow.y + 'px ' ) : '0px '; var blur_val = ( '' !== shadow.blur ) ? ( shadow.blur + 'px ' ) : '0px '; var spread_val = ( '' !== shadow.spread ) ? ( shadow.spread + 'px ' ) : '0px '; dynamicStyle = selector + ' {'; dynamicStyle += 'box-shadow:' + x_val + y_val + blur_val + spread_val + box_shadow_color + shadow_position + ';'; dynamicStyle += '}'; } return dynamicStyle; } builder/type/base/configurations/class-astra-addon-base-configs.php 0000644 00000006234 15150261777 0021506 0 ustar 00 <?php /** * Astra Addon Base Configuration. * * @package astra-builder */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class Astra_Addon_Base_Configs. */ class Astra_Addon_Base_Configs { /** * Prepare Box Shadow options. * * @param string $_section section id. * @param string $_prefix Control Prefix. * @param integer $priority Priority. * @since 3.3.0 * @return array */ public static function prepare_box_shadow_tab( $_section, $_prefix, $priority = 90 ) { $configs = array( // Option Group: Box shadow Group. array( 'name' => ASTRA_THEME_SETTINGS . '[' . $_prefix . '-shadow-group]', 'type' => 'control', 'control' => 'ast-settings-group', 'title' => __( 'Box Shadow', 'astra-addon' ), 'section' => $_section, 'transport' => 'postMessage', 'priority' => $priority, 'context' => astra_addon_builder_helper()->design_tab, 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), /** * Option: box shadow */ array( 'name' => $_prefix . '-box-shadow-control', 'default' => astra_get_option( $_prefix . '-box-shadow-control' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $_prefix . '-shadow-group]', 'type' => 'sub-control', 'transport' => 'postMessage', 'control' => 'ast-box-shadow', 'section' => $_section, 'sanitize_callback' => array( 'Astra_Addon_Customizer', 'sanitize_box_shadow' ), 'priority' => 1, 'title' => __( 'Value', 'astra-addon' ), 'choices' => array( 'x' => __( 'X', 'astra-addon' ), 'y' => __( 'Y', 'astra-addon' ), 'blur' => __( 'Blur', 'astra-addon' ), 'spread' => __( 'Spread', 'astra-addon' ), ), 'context' => astra_addon_builder_helper()->general_tab, ), array( 'name' => $_prefix . '-box-shadow-position', 'default' => astra_get_option( $_prefix . '-box-shadow-position' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $_prefix . '-shadow-group]', 'type' => 'sub-control', 'section' => $_section, 'transport' => 'postMessage', 'control' => 'ast-select', 'title' => __( 'Position', 'astra-addon' ), 'choices' => array( 'outline' => __( 'Outline', 'astra-addon' ), 'inset' => __( 'Inset', 'astra-addon' ), ), 'priority' => 2, 'context' => astra_addon_builder_helper()->general_tab, ), array( 'name' => $_prefix . '-box-shadow-color', 'default' => astra_get_option( $_prefix . '-box-shadow-color' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $_prefix . '-shadow-group]', 'type' => 'sub-control', 'section' => $_section, 'transport' => 'postMessage', 'control' => 'ast-color', 'title' => __( 'Color', 'astra-addon' ), 'rgba' => true, 'priority' => 3, 'context' => astra_addon_builder_helper()->general_tab, ), ); return $configs; } } new Astra_Addon_Base_Configs(); builder/type/base/configurations/class-astra-addon-button-component-configs.php 0000644 00000005514 15150261777 0024107 0 ustar 00 <?php /** * Astra Addon Customizer Configuration Button. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Register Button Customizer Configurations. * * @since 3.1.0 */ class Astra_Addon_Button_Component_Configs { /** * Register Button Customizer Configurations. * * @param Array $configurations Configurations. * @param string $builder_type Builder Type. * @param string $section Section. * * @since 3.1.0 * @return Array Astra Customizer Configurations with updated configurations. */ public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-button-' ) { $class_obj = ''; if ( 'footer' === $builder_type && class_exists( 'Astra_Builder_Footer' ) ) { $class_obj = Astra_Builder_Footer::get_instance(); } elseif ( 'header' === $builder_type && class_exists( 'Astra_Builder_Header' ) ) { $class_obj = Astra_Builder_Header::get_instance(); } $html_config = array(); $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $_section = $section . $index; $_prefix = 'button' . $index; $_configs = array( array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-size]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-size' ), 'type' => 'control', 'control' => 'ast-select', 'section' => $_section, 'priority' => 30, 'title' => __( 'Size', 'astra-addon' ), 'choices' => array( 'xs' => __( 'Extra Small', 'astra-addon' ), 'sm' => __( 'Small', 'astra-addon' ), 'md' => __( 'Medium', 'astra-addon' ), 'lg' => __( 'Large', 'astra-addon' ), 'xl' => __( 'Extra Large', 'astra-addon' ), ), 'transport' => 'postMessage', 'context' => astra_addon_builder_helper()->general_tab, 'partial' => array( 'selector' => '.ast-' . $builder_type . '-button-' . $index, 'container_inclusive' => false, 'render_callback' => array( $class_obj, 'button_' . $index ), 'fallback_refresh' => false, ), 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), ); $html_config[] = Astra_Addon_Base_Configs::prepare_box_shadow_tab( $_section, $builder_type . '-' . $_prefix, 99 ); $html_config[] = $_configs; } $html_config = call_user_func_array( 'array_merge', $html_config + array( array() ) ); return array_merge( $configurations, $html_config ); } } /** * Kicking this off by creating object of this class. */ new Astra_Addon_Button_Component_Configs(); builder/type/base/configurations/class-astra-divider-component-configs.php 0000644 00000032163 15150261777 0023137 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer config divider base class is already present. if ( class_exists( 'Astra_Divider_Component_Configs' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Divider_Component_Configs { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Configurations. * @param string $builder_type Builder Type. * @param string $section Section. * * @since 3.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-divider-' ) { $divider_config = array(); if ( 'footer' === $builder_type ) { $class_obj = Astra_Addon_Builder_Footer::get_instance(); $number_of_divider = astra_addon_builder_helper()->num_of_footer_divider; $divider_size_layout = 'horizontal'; } else { $class_obj = Astra_Addon_Builder_Header::get_instance(); $number_of_divider = astra_addon_builder_helper()->num_of_header_divider; $divider_size_layout = 'vertical'; } $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $_section = $section . $index; $_prefix = 'divider' . $index; /** * These options are related to Header Section - divider. * Prefix hs represents - Header Section. */ $_configs = array( /** * Option: Header Builder Tabs */ array( 'name' => $_section . '-ast-context-tabs', 'section' => $_section, 'type' => 'control', 'control' => 'ast-builder-header-control', 'priority' => 0, 'description' => '', ), /* * Header Builder section - divider Component Configs. */ array( 'name' => $_section, 'type' => 'section', 'priority' => 50, /* translators: %s Index */ 'title' => ( 1 === $number_of_divider ) ? __( 'Divider', 'astra-addon' ) : sprintf( __( 'Divider %s', 'astra-addon' ), $index ), 'panel' => 'panel-' . $builder_type . '-builder-group', 'clone_index' => $index, 'clone_type' => $builder_type . '-divider', ), /** * Option: Position */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-layout]', 'default' => astra_get_option( $builder_type . '-divider-' . $index . '-layout' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'priority' => 30, 'title' => __( 'Layout', 'astra-addon' ), 'choices' => array( 'horizontal' => __( 'Horizontal', 'astra-addon' ), 'vertical' => __( 'Vertical', 'astra-addon' ), ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-' . $builder_type . '-divider-' . $index, 'render_callback' => array( $class_obj, $builder_type . '_divider_' . $index ), ), 'responsive' => false, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-section-spacing' ), ), // Vertical divider notice. array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-description]', 'type' => 'control', 'control' => 'ast-description', 'section' => $_section, 'priority' => 30, 'label' => '', /* translators: %1$s builder type param */ 'help' => sprintf( __( 'If the Divider don\'t seem to be visible please check if elements are added in the current %1$s row.', 'astra-addon' ), $builder_type ), 'context' => array( astra_addon_builder_helper()->general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-layout]', 'operator' => '==', 'value' => 'vertical', ), ), ), /** * Option: Divider Style */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-style]', 'default' => astra_get_option( $builder_type . '-divider-' . $index . '-style' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'priority' => 30, 'title' => __( 'Style', 'astra-addon' ), 'choices' => array( 'solid' => __( 'Solid', 'astra-addon' ), 'dashed' => __( 'Dashed', 'astra-addon' ), 'dotted' => __( 'Dotted', 'astra-addon' ), 'double' => __( 'Double', 'astra-addon' ), ), 'transport' => 'postMessage', 'responsive' => false, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), // Section: Above Footer Border. array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-thickness]', 'section' => $_section, 'priority' => 40, 'transport' => 'postMessage', 'default' => astra_get_option( $builder_type . '-divider-' . $index . '-thickness' ), 'title' => __( 'Thickness', 'astra-addon' ), 'type' => 'control', 'control' => 'ast-responsive-slider', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 60, ), 'divider' => array( 'ast_class' => 'ast-bottom-section-divider' ), 'suffix' => 'px', 'context' => astra_addon_builder_helper()->design_tab, ), // Section: Above Footer Border. array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-size]', 'section' => $_section, 'priority' => 40, 'transport' => 'postMessage', 'default' => astra_get_option( $builder_type . '-divider-' . $index . '-size' ), 'title' => __( 'Size', 'astra-addon' ), 'type' => 'control', 'control' => 'ast-responsive-slider', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 100, ), 'suffix' => '%', 'context' => array( astra_addon_builder_helper()->design_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-layout]', 'operator' => '==', 'value' => $divider_size_layout, ), ), ), /** * Option: divider Color. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-color]', 'default' => astra_get_option( $builder_type . '-divider-' . $index . '-color' ), 'type' => 'control', 'section' => $_section, 'priority' => 8, 'transport' => 'postMessage', 'control' => 'ast-color', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), 'title' => __( 'Color', 'astra-addon' ), 'context' => astra_addon_builder_helper()->design_tab, 'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-section-divider' ), ), /** * Option: Divider */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $_section . '-margin-divider]', 'section' => $_section, 'title' => __( 'Spacing', 'astra-addon' ), 'type' => 'control', 'control' => 'ast-heading', 'priority' => 99, 'settings' => array(), 'context' => astra_addon_builder_helper()->design_tab, 'divider' => array( 'ast_class' => 'ast-section-spacing' ), ), /** * Option: Margin Space */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $_section . '-margin]', 'default' => astra_get_option( $_section . '-margin' ), 'type' => 'control', 'control' => 'ast-responsive-spacing', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), 'section' => $_section, 'transport' => 'postMessage', 'priority' => 99, 'title' => __( 'Margin', 'astra-addon' ), 'linked_choices' => true, 'unit_choices' => array( 'px', 'em', '%' ), 'choices' => array( 'top' => __( 'Top', 'astra-addon' ), 'right' => __( 'Right', 'astra-addon' ), 'bottom' => __( 'Bottom', 'astra-addon' ), 'left' => __( 'Left', 'astra-addon' ), ), 'context' => astra_addon_builder_helper()->design_tab, 'divider' => array( 'ast_class' => 'ast-section-spacing' ), ), ); if ( 'footer' === $builder_type ) { $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[footer-divider-' . $index . '-alignment]', 'default' => astra_get_option( 'footer-divider-' . $index . '-alignment' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'priority' => 35, 'title' => __( 'Alignment', 'astra-addon' ), 'choices' => array( 'flex-start' => __( 'Left', 'astra-addon' ), 'center' => __( 'Center', 'astra-addon' ), 'flex-end' => __( 'Right', 'astra-addon' ), ), 'transport' => 'postMessage', 'responsive' => true, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ); // Footer vertical divider size. $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[footer-vertical-divider-' . $index . '-size]', 'section' => $_section, 'priority' => 40, 'transport' => 'postMessage', 'default' => astra_get_option( 'footer-vertical-divider-' . $index . '-size' ), 'title' => __( 'Size', 'astra-addon' ), 'type' => 'control', 'control' => 'ast-responsive-slider', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 1000, ), 'suffix' => 'px', 'context' => array( astra_addon_builder_helper()->design_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-layout]', 'operator' => '==', 'value' => 'vertical', ), ), ); } if ( 'header' === $builder_type ) { // Header horizontal divider size. $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[header-horizontal-divider-' . $index . '-size]', 'section' => $_section, 'priority' => 40, 'transport' => 'postMessage', 'default' => astra_get_option( 'header-horizontal-divider-' . $index . '-size' ), 'title' => __( 'Size', 'astra-addon' ), 'type' => 'control', 'control' => 'ast-responsive-slider', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 1000, ), 'suffix' => 'px', 'context' => array( astra_addon_builder_helper()->design_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-divider-' . $index . '-layout]', 'operator' => '==', 'value' => 'horizontal', ), ), ); } if ( class_exists( 'Astra_Builder_Base_Configuration' ) && method_exists( 'Astra_Builder_Base_Configuration', 'prepare_visibility_tab' ) ) { $divider_config[] = Astra_Builder_Base_Configuration::prepare_visibility_tab( $_section, $builder_type ); } $divider_config[] = $_configs; } $divider_config = call_user_func_array( 'array_merge', $divider_config + array( array() ) ); $configurations = array_merge( $configurations, $divider_config ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Divider_Component_Configs(); builder/type/base/configurations/class-astra-language-switcher-component-configs.php 0000644 00000025716 15150261777 0025130 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer config language_switcher base class is already present. if ( class_exists( 'Astra_Language_Switcher_Component_Configs' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Language_Switcher_Component_Configs { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Configurations. * @param string $builder_type Builder Type. * @param string $_section Section. * * @since 3.1.0 * @return Array Astra Customizer Configurations with updated configurations. */ public static function register_configuration( $configurations, $builder_type = 'header', $_section = 'section-hb-language-switcher' ) { $lang_config = array(); if ( 'footer' === $builder_type ) { $class_obj = Astra_Addon_Builder_Footer::get_instance(); } else { $class_obj = Astra_Addon_Builder_Header::get_instance(); } $language_choices = array( 'custom' => __( 'Custom', 'astra-addon' ), ); if ( class_exists( 'SitePress' ) ) { $language_choices['wpml'] = __( 'WPML', 'astra-addon' ); } $type_context = astra_addon_builder_helper()->general_tab; if ( count( $language_choices ) > 1 ) { $type_context = array( array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-type]', 'operator' => '==', 'value' => 'custom', ), astra_addon_builder_helper()->general_tab_config, ); } /** * These options are related to Header Section - language switcher. */ $_configs = array( /** * Option: Header Builder Tabs */ array( 'name' => $_section . '-ast-context-tabs', 'section' => $_section, 'type' => 'control', 'control' => 'ast-builder-header-control', 'priority' => 0, 'description' => '', ), array( 'name' => $_section, 'type' => 'section', 'priority' => 1, 'title' => __( 'Language Switcher', 'astra-addon' ), 'panel' => 'panel-' . $builder_type . '-builder-group', ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-options]', 'section' => $_section, 'type' => 'control', 'control' => 'ast-language-selector', 'title' => __( 'Select Languages', 'astra-addon' ), 'transport' => 'postMessage', 'priority' => 2, 'default' => astra_get_option( $builder_type . '-language-switcher-options' ), 'partial' => array( 'selector' => '.ast-' . $builder_type . '-language-switcher', 'render_callback' => array( $class_obj, $builder_type . '_language_switcher' ), ), 'context' => $type_context, ), /** * Option: Position */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-layout]', 'default' => astra_get_option( $builder_type . '-language-switcher-layout' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'priority' => 3, 'title' => __( 'Layout', 'astra-addon' ), 'choices' => array( 'horizontal' => __( 'Horizontal', 'astra-addon' ), 'vertical' => __( 'Vertical', 'astra-addon' ), ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-' . $builder_type . '-language-switcher', 'render_callback' => array( $class_obj, $builder_type . '_language_switcher' ), ), 'context' => astra_addon_builder_helper()->general_tab, 'responsive' => false, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-top-section-divider ast-bottom-section-divider' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-show-flag]', 'default' => astra_get_option( $builder_type . '-language-switcher-show-flag' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$switch_control, 'section' => $_section, 'priority' => 3, 'title' => __( 'Show Country Flag', 'astra-addon' ), 'partial' => array( 'selector' => '.ast-' . $builder_type . '-language-switcher', 'render_callback' => array( $class_obj, $builder_type . '_language_switcher' ), ), 'transport' => 'postMessage', 'context' => astra_addon_builder_helper()->general_tab, ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-show-name]', 'default' => astra_get_option( $builder_type . '-language-switcher-show-name' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$switch_control, 'section' => $_section, 'priority' => 3, 'title' => __( 'Show Name', 'astra-addon' ), 'partial' => array( 'selector' => '.ast-' . $builder_type . '-language-switcher', 'render_callback' => array( $class_obj, $builder_type . '_language_switcher' ), ), 'transport' => 'postMessage', 'context' => astra_addon_builder_helper()->general_tab, ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-show-tname]', 'default' => astra_get_option( $builder_type . '-language-switcher-show-tname' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$switch_control, 'section' => $_section, 'priority' => 3, 'title' => __( 'Show Translated Name', 'astra-addon' ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-' . $builder_type . '-language-switcher', 'render_callback' => array( $class_obj, $builder_type . '_language_switcher' ), ), 'context' => array( array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-type]', 'operator' => '==', 'value' => 'wpml', ), astra_addon_builder_helper()->general_tab_config, ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-show-code]', 'default' => astra_get_option( $builder_type . '-language-switcher-show-code' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$switch_control, 'section' => $_section, 'priority' => 3, 'title' => __( 'Show Language Code', 'astra-addon' ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-' . $builder_type . '-language-switcher', 'render_callback' => array( $class_obj, $builder_type . '_language_switcher' ), ), 'context' => array( array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-type]', 'operator' => '==', 'value' => 'wpml', ), astra_addon_builder_helper()->general_tab_config, ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $_section . '-flag-size]', 'section' => $_section, 'priority' => 2, 'transport' => 'postMessage', 'default' => astra_get_option( $_section . '-flag-size' ), 'title' => __( 'Flag Size', 'astra-addon' ), 'type' => 'control', 'control' => 'ast-responsive-slider', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 50, ), 'divider' => array( 'ast_class' => 'ast-bottom-section-divider' ), 'suffix' => 'px', 'context' => array( array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-show-flag]', 'operator' => '==', 'value' => true, ), astra_addon_builder_helper()->design_tab_config, ), ), // Section: Above Footer Border. array( 'name' => ASTRA_THEME_SETTINGS . '[' . $_section . '-flag-spacing]', 'section' => $_section, 'priority' => 2, 'transport' => 'postMessage', 'default' => astra_get_option( $_section . '-flag-spacing' ), 'title' => __( 'Flag & Text Spacing', 'astra-addon' ), 'type' => 'control', 'suffix' => 'px', 'control' => 'ast-responsive-slider', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 60, ), 'context' => array( array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-show-name]', 'operator' => '==', 'value' => true, ), astra_addon_builder_helper()->design_tab_config, ), ), ); if ( count( $language_choices ) > 1 ) { $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-language-switcher-type]', 'default' => astra_get_option( $builder_type . '-language-switcher-type' ), 'type' => 'control', 'control' => 'ast-select', 'section' => $_section, 'priority' => 1, 'title' => __( 'Type', 'astra-addon' ), 'choices' => $language_choices, 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-' . $builder_type . '-language-switcher', 'render_callback' => array( $class_obj, $builder_type . '_language_switcher' ), ), ); } if ( 'footer' === $builder_type ) { $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[footer-language-switcher-alignment]', 'default' => astra_get_option( 'footer-language-switcher-alignment' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'priority' => 35, 'title' => __( 'Alignment', 'astra-addon' ), 'context' => astra_addon_builder_helper()->general_tab, 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), 'transport' => 'postMessage', 'responsive' => true, 'choices' => array( 'flex-start' => 'align-left', 'center' => 'align-center', 'flex-end' => 'align-right', ), ); } if ( is_callable( 'Astra_Builder_Base_Configuration::prepare_visibility_tab' ) ) { $lang_config[] = Astra_Builder_Base_Configuration::prepare_visibility_tab( $_section, $builder_type ); } $lang_config[] = $_configs; $lang_config = call_user_func_array( 'array_merge', $lang_config + array( array() ) ); $configurations = array_merge( $configurations, $lang_config ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Language_Switcher_Component_Configs(); builder/type/base/configurations/class-astra-social-component-configs.php 0000644 00000005233 15150261777 0022761 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Register Builder Customizer Configurations. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Social_Component_Configs { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Configurations. * @param string $builder_type Builder Type. * @param string $section Section slug. * @since 3.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-social-icons-' ) { $social_configs = array(); $class_obj = Astra_Addon_Builder_Header::get_instance(); $number_of_social_icons = astra_addon_builder_helper()->num_of_header_social_icons; if ( 'footer' === $builder_type ) { $class_obj = Astra_Addon_Builder_Footer::get_instance(); $number_of_social_icons = astra_addon_builder_helper()->num_of_footer_social_icons; } for ( $index = 1; $index <= $number_of_social_icons; $index++ ) { $_section = $section . $index; $_configs = array( array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-stack]', 'default' => astra_get_option( $builder_type . '-social-' . $index . '-stack' ), 'section' => $_section, 'type' => 'control', 'control' => 'ast-selector', 'title' => __( 'Stack On', 'astra-addon' ), 'priority' => 3, 'choices' => array( 'desktop' => __( 'Desktop', 'astra-addon' ), 'tablet' => __( 'Tablet', 'astra-addon' ), 'mobile' => __( 'Mobile', 'astra-addon' ), 'none' => __( 'None', 'astra-addon' ), ), 'transport' => 'postMessage', 'context' => astra_addon_builder_helper()->general_tab, 'renderAs' => 'text', 'responsive' => false, 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), ); $social_configs[] = $_configs; } $social_configs = call_user_func_array( 'array_merge', $social_configs + array( array() ) ); $configurations = array_merge( $configurations, $social_configs ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Social_Component_Configs(); builder/type/base/controllers/class-astra-addon-builder-ui-controller.php 0000644 00000020173 15150261777 0022702 0 ustar 00 <?php /** * Astra Builder UI Controller. * * @package astra-builder */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Addon_Builder_UI_Controller' ) ) { /** * Class Astra_Addon_Builder_UI_Controller. */ final class Astra_Addon_Builder_UI_Controller { /** * Astra Flags SVGs. * * @var ast_flags */ private static $ast_flags = null; /** * Prepare divider Markup. * * @param string $index Key of the divider Control. */ public static function render_divider_markup( $index = 'header-divider-1' ) { $layout = astra_get_option( $index . '-layout' ); ?> <div class="ast-divider-wrapper ast-divider-layout-<?php echo esc_attr( $layout ); ?>"> <?php if ( is_customize_preview() ) { self::render_customizer_edit_button(); } ?> <div class="ast-builder-divider-element"></div> </div> <?php } /** * Prepare language switcher Markup. * * @param string $index Key of the language switcher Control. * @param string $builder_type builder type. */ public static function render_language_switcher_markup( $index = 'header-language-switcher', $builder_type = 'header' ) { $lang_type = astra_get_option( $index . '-type' ); $layout = astra_get_option( $index . '-layout' ); $show_flag = astra_get_option( $index . '-show-flag' ); $show_label = astra_get_option( $index . '-show-name' ); ?> <div class="ast-builder-language-switcher-wrapper ast-builder-language-switcher-layout-<?php echo esc_attr( $layout ); ?>"> <?php if ( is_customize_preview() ) { self::render_customizer_edit_button(); } ?> <div class="ast-builder-language-switcher-element"> <?php if ( 'wpml' === $lang_type ) { $show_tname = astra_get_option( $index . '-show-tname' ); $show_code = astra_get_option( $index . '-show-code' ); $languages = apply_filters( 'wpml_active_languages', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound null, array( 'skip_missing' => 0, ) ); if ( ! empty( $languages ) ) { ?> <nav class="ast-builder-language-switcher"><ul class="ast-builder-language-switcher-menu"> <?php foreach ( $languages as $language ) { ?> <li class="ast-builder-language-switcher-menu-item-<?php echo esc_attr( $builder_type ); ?>"> <?php if ( isset( $language['active'] ) && '1' === $language['active'] ) { ?> <a href="<?php echo esc_url( $language['url'] ); ?>" class="ast-builder-language-switcher-item ast-builder-language-switcher-item__active"> <?php } else { ?> <a href="<?php echo esc_url( $language['url'] ); ?>" class="ast-builder-language-switcher-item"> <?php } ?> <?php if ( $show_flag ) { ?> <span class="ast-lswitcher-item-<?php echo esc_attr( $builder_type ); ?>"><img src="<?php echo esc_url( $language['country_flag_url'] ); ?>" alt="<?php echo esc_attr( $language['language_code'] ); ?>" width="18" height="12" /></span> <?php } ?> <?php if ( $show_label ) { ?> <span class="ast-lswitcher-item-<?php echo esc_attr( $builder_type ); ?> ast-builder-language-switcher-native-name"><?php echo esc_html( $language['native_name'] ); ?></span> <?php } ?> <?php if ( $show_tname ) { ?> <span class="ast-lswitcher-item-<?php echo esc_attr( $builder_type ); ?> ast-builder-language-switcher-translated-name"><?php echo esc_html( $language['translated_name'] ); ?></span> <?php } ?> <?php if ( $show_code ) { ?> <span class="ast-lswitcher-item-<?php echo esc_attr( $builder_type ); ?> ast-builder-language-switcher-language-code"><?php echo '('; ?><?php echo esc_html( $language['language_code'] ); ?><?php echo ')'; ?></span> <?php } ?> </a> </li> <?php } ?> </ul></nav> <?php } } else { $items = astra_get_option( $index . '-options' ); $items = isset( $items['items'] ) ? $items['items'] : array(); $image_link = ''; if ( is_array( $items ) && ! empty( $items ) ) { ?> <nav class="ast-builder-language-switcher"><ul class="ast-builder-language-switcher-menu"> <?php foreach ( $items as $item ) { if ( $item['enabled'] ) { $link = ( '' !== $item['url'] ) ? $item['url'] : ''; ?> <li class="ast-builder-language-switcher-menu-item-<?php echo esc_attr( $builder_type ); ?>"> <a href="<?php echo esc_url( $link ); ?>" aria-label="<?php echo esc_attr( $item['label'] ); ?>" class="ast-builder-language-switcher-item"> <?php if ( $show_flag && 'zz-other' !== $item['id'] ) { ?> <span class="ast-lswitcher-item-<?php echo esc_attr( $builder_type ); ?>"> <?php echo wp_kses( self::fetch_flags_svg( $item['id'] ), Astra_Addon_Kses::astra_addon_svg_kses_protocols() ); ?> </span> <?php } ?> <?php if ( $show_label ) { ?> <span class="ast-lswitcher-item-<?php echo esc_attr( $builder_type ); ?> ast-builder-language-switcher-native-name"> <?php echo esc_html( $item['label'] ); ?></span> <?php } ?> </a> </li> <?php } } ?> </ul></nav> <?php } } ?> </div> </div> <?php } /** * Prepare Edit icon inside customizer. */ public static function render_customizer_edit_button() { if ( ! is_callable( 'Astra_Builder_UI_Controller::fetch_svg_icon' ) ) { return; } ?> <div class="customize-partial-edit-shortcut" data-id="ahfb"> <button aria-label="<?php esc_attr_e( 'Click to edit this element.', 'astra-addon' ); ?>" title="<?php esc_attr_e( 'Click to edit this element.', 'astra-addon' ); ?>" class="customize-partial-edit-shortcut-button item-customizer-focus"> <?php echo wp_kses( Astra_Builder_UI_Controller::fetch_svg_icon( 'edit' ), array( 'svg' => array( 'xmlns:xlink' => array(), 'version' => array(), 'x' => array(), 'y' => array(), 'enable-background' => array(), 'xml:space' => array(), 'class' => array(), 'aria-hidden' => array(), 'aria-labelledby' => array(), 'role' => array(), 'xmlns' => array(), 'width' => array(), 'fill' => array(), 'height' => array(), 'viewbox' => array(), ), 'g' => array( 'fill' => array(), 'clip-path' => array(), ), 'title' => array( 'title' => array() ), 'path' => array( 'd' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), ), ) ); ?> </button> </div> <?php } /** * Get an SVG Icon * * @param string $icon the icon name. * @param bool $base if the baseline class should be added. */ public static function fetch_flags_svg( $icon = '', $base = true ) { $output = '<span class="ahfb-svg-iconset ast-inline-flex' . ( $base ? ' svg-baseline' : '' ) . '">'; if ( ! self::$ast_flags ) { ob_start(); include_once ASTRA_EXT_DIR . 'assets/flags/svgs.json'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound self::$ast_flags = json_decode( ob_get_clean(), true ); self::$ast_flags = apply_filters( 'astra_addon_flags_svg', self::$ast_flags ); self::$ast_flags = self::$ast_flags; } $output .= isset( self::$ast_flags[ $icon ] ) ? self::$ast_flags[ $icon ] : ''; $output .= '</span>'; return $output; } } } builder/type/base/dynamic-css/button/class-astra-addon-button-component-dynamic-css.php 0000644 00000002740 15150261777 0025362 0 ustar 00 <?php /** * Astra Addon Button Component Dynamic CSS. * * @package astra-builder * @link https://wpastra.com/ * @since 3.3.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Register Builder Dynamic CSS. * * @since 3.3.0 */ class Astra_Addon_Button_Component_Dynamic_CSS { /** * Dynamic CSS * * @param string $builder_type Builder Type. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.3.0 */ public static function astra_ext_button_dynamic_css( $builder_type = 'header' ) { $dynamic_css = ''; $number_of_button = ( 'header' === $builder_type ) ? astra_addon_builder_helper()->num_of_header_button : astra_addon_builder_helper()->num_of_footer_button; for ( $index = 1; $index <= $number_of_button; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'button-' . $index, $builder_type ) ) { continue; } $_section = ( 'header' === $builder_type ) ? 'section-hb-button-' . $index : 'section-fb-button-' . $index; $_prefix = 'button' . $index; $selector = '.ast-' . $builder_type . '-button-' . $index . ' .ast-custom-button'; $dynamic_css .= Astra_Addon_Base_Dynamic_CSS::prepare_box_shadow_dynamic_css( $builder_type . '-button' . $index, $selector ); } return $dynamic_css; } } /** * Kicking this off by creating object of this class. */ new Astra_Addon_Button_Component_Dynamic_CSS(); builder/type/base/dynamic-css/divider/class-astra-divider-component-dynamic-css.php 0000644 00000023722 15150261777 0024530 0 ustar 00 <?php /** * Astra Divider Component Dynamic CSS. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer divider dynamic CSS class is already present. if ( class_exists( 'Astra_Divider_Component_Dynamic_CSS' ) ) { return; } /** * Register Builder Dynamic CSS. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Divider_Component_Dynamic_CSS { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Dynamic CSS * * @param string $builder_type Builder Type. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.0.0 */ public static function astra_divider_dynamic_css( $builder_type = 'header' ) { $generated_css = ''; $number_of_divider = ( 'header' === $builder_type ) ? astra_addon_builder_helper()->num_of_header_divider : astra_addon_builder_helper()->num_of_footer_divider; for ( $index = 1; $index <= $number_of_divider; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'divider-' . $index, $builder_type ) ) { continue; } $_section = ( 'header' === $builder_type ) ? 'section-hb-divider-' . $index : 'section-fb-divider-' . $index; $selector = ( 'header' === $builder_type ) ? '.ast-header-divider-' . $index : '.ast-builder-grid-row-container-inner .footer-widget-area[data-section="section-fb-divider-' . $index . '"]'; $divider_style = astra_get_option( $builder_type . '-divider-' . $index . '-style' ); $divider_color = astra_get_option( $builder_type . '-divider-' . $index . '-color' ); $divider_thickness = astra_get_option( $builder_type . '-divider-' . $index . '-thickness' ); $divider_size = astra_get_option( $builder_type . '-divider-' . $index . '-size' ); $footer_vertical_divider_size = astra_get_option( 'footer-vertical-divider-' . $index . '-size' ); $header_horizontal_divider_size = astra_get_option( 'header-horizontal-divider-' . $index . '-size' ); $margin = astra_get_option( $_section . '-margin' ); $footer_vertical_divider_size_desktop = ( isset( $footer_vertical_divider_size['desktop'] ) ) ? (int) $footer_vertical_divider_size['desktop'] : ''; $footer_vertical_divider_size_tablet = ( isset( $footer_vertical_divider_size['tablet'] ) ) ? (int) $footer_vertical_divider_size['tablet'] : ''; $footer_vertical_divider_size_mobile = ( isset( $footer_vertical_divider_size['mobile'] ) ) ? (int) $footer_vertical_divider_size['mobile'] : ''; /** * Desktop CSS. */ $css_output_desktop = array( /** * Button Colors. */ $selector . ' .ast-divider-wrapper' => array( 'border-style' => $divider_style, 'border-color' => astra_get_option( $builder_type . '-divider-' . $index . '-color' ), ), $selector . ' .ast-divider-layout-vertical' => array( 'border-right-width' => astra_get_css_value( $divider_thickness['desktop'], 'px' ), ), $selector . '.ast-hb-divider-layout-vertical .ast-divider-layout-vertical' => array( 'height' => astra_get_css_value( $divider_size['desktop'], '%' ), ), $selector . '.ast-fb-divider-layout-vertical .ast-divider-layout-vertical' => array( 'height' => astra_get_css_value( $footer_vertical_divider_size_desktop, 'px' ), ), $selector . ' .ast-divider-layout-horizontal' => array( 'border-top-width' => astra_get_css_value( $divider_thickness['desktop'], 'px' ), ), $selector . '.ast-fb-divider-layout-horizontal .ast-divider-layout-horizontal' => array( 'width' => astra_get_css_value( $divider_size['desktop'], '%' ), ), $selector . '.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal' => array( 'width' => astra_get_css_value( $header_horizontal_divider_size['desktop'], 'px' ), ), $selector => array( // Margin. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'desktop' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'desktop' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'desktop' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'desktop' ), ), '.ast-container[data-section="section-above-header-builder"],.ast-container[data-section="section-primary-header-builder"],.ast-container[data-section="section-below-header-builder"],.ast-container[data-section="section-above-header-builder"] .site-header-above-section-left,.ast-container[data-section="section-above-header-builder"] .site-header-above-section-center,.ast-container[data-section="section-above-header-builder"] .site-header-above-section-right,.ast-container[data-section="section-primary-header-builder"] .site-header-primary-section-left,.ast-container[data-section="section-primary-header-builder"] .site-header-primary-section-center,.ast-container[data-section="section-primary-header-builder"] .site-header-primary-section-right,.ast-container[data-section="section-below-header-builder"] .site-header-below-section-left,.ast-container[data-section="section-below-header-builder"] .site-header-below-section-center,.ast-container[data-section="section-below-header-builder"] .site-header-below-section-right' => array( 'position' => 'relative', ), ); /** * Tablet CSS. */ $css_output_tablet = array( /** * Button Colors. */ $selector . ' .ast-divider-wrapper' => array( 'border-style' => $divider_style, 'border-color' => astra_get_option( $builder_type . '-divider-' . $index . '-color' ), ), '.ast-mobile-popup-content ' . $selector . ' .ast-divider-wrapper' => array( 'border-color' => astra_get_option( $builder_type . '-divider-' . $index . '-color' ), ), $selector . ' .ast-divider-layout-vertical' => array( 'border-right-width' => astra_get_css_value( $divider_thickness['tablet'], 'px' ), ), $selector . '.ast-hb-divider-layout-vertical .ast-divider-layout-vertical' => array( 'height' => astra_get_css_value( $divider_size['tablet'], '%' ), ), $selector . '.ast-fb-divider-layout-vertical .ast-divider-layout-vertical' => array( 'height' => astra_get_css_value( $footer_vertical_divider_size_tablet, 'px' ), ), $selector . ' .ast-divider-layout-horizontal' => array( 'border-top-width' => astra_get_css_value( $divider_thickness['tablet'], 'px' ), ), $selector . '.ast-fb-divider-layout-horizontal .ast-divider-layout-horizontal' => array( 'width' => astra_get_css_value( $divider_size['tablet'], '%' ), ), $selector . '.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal' => array( 'width' => astra_get_css_value( $header_horizontal_divider_size['tablet'], 'px' ), ), $selector => array( // Margin CSS. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'tablet' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'tablet' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'tablet' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'tablet' ), ), ); /** * Tablet CSS. */ $css_output_mobile = array( /** * Button Colors. */ $selector . ' .ast-divider-wrapper' => array( 'border-style' => $divider_style, 'border-color' => astra_get_option( $builder_type . '-divider-' . $index . '-color' ), ), '.ast-mobile-popup-content ' . $selector . ' .ast-divider-wrapper' => array( 'border-color' => astra_get_option( $builder_type . '-divider-' . $index . '-color' ), ), $selector . ' .ast-divider-layout-vertical' => array( 'border-right-width' => astra_get_css_value( $divider_thickness['mobile'], 'px' ), ), $selector . '.ast-hb-divider-layout-vertical .ast-divider-layout-vertical' => array( 'height' => astra_get_css_value( $divider_size['mobile'], '%' ), ), $selector . '.ast-fb-divider-layout-vertical .ast-divider-layout-vertical' => array( 'height' => astra_get_css_value( $footer_vertical_divider_size_mobile, 'px' ), ), $selector . ' .ast-divider-layout-horizontal' => array( 'border-top-width' => astra_get_css_value( $divider_thickness['mobile'], 'px' ), ), $selector . '.ast-fb-divider-layout-horizontal .ast-divider-layout-horizontal' => array( 'width' => astra_get_css_value( $divider_size['mobile'], '%' ), ), $selector . '.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal' => array( 'width' => astra_get_css_value( $header_horizontal_divider_size['mobile'], 'px' ), ), $selector => array( // Margin CSS. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'mobile' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'mobile' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'mobile' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'mobile' ), ), ); /* Parse CSS from array() */ $css_output = astra_parse_css( $css_output_desktop ); $css_output .= astra_parse_css( $css_output_tablet, '', astra_addon_get_tablet_breakpoint() ); $css_output .= astra_parse_css( $css_output_mobile, '', astra_addon_get_mobile_breakpoint() ); $generated_css .= $css_output; if ( class_exists( 'Astra_Builder_Base_Dynamic_CSS' ) && method_exists( 'Astra_Builder_Base_Dynamic_CSS', 'prepare_visibility_css' ) ) { $generated_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, $selector ); } } return $generated_css; } } /** * Kicking this off by creating object of this class. */ new Astra_Divider_Component_Dynamic_CSS(); type/base/dynamic-css/language-switcher/class-astra-language-switcher-component-dynamic-css.php 0000644 00000010430 15150261777 0030407 0 ustar 00 builder <?php /** * Astra language switcher Component Dynamic CSS. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer divider dynamic CSS class is already present. if ( class_exists( 'Astra_Language_Switcher_Component_Dynamic_CSS' ) ) { return; } /** * Register Builder Dynamic CSS. * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Language_Switcher_Component_Dynamic_CSS { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Dynamic CSS * * @param string $builder_type Builder Type. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.1.0 */ public static function astra_language_switcher_dynamic_css( $builder_type = 'header' ) { $generated_css = ''; if ( false === Astra_Ext_Extension::is_active( 'spacing' ) ) { $generated_css = '.ast-builder-language-switcher-menu-item-header:not(:last-child), .ast-builder-language-switcher-menu-item-footer:not(:last-child) { margin-right: 10px; }'; } $_section = ( 'header' === $builder_type ) ? 'section-hb-language-switcher' : 'section-fb-language-switcher'; $selector = ( 'header' === $builder_type ) ? '.ast-header-language-switcher' : '.ast-footer-language-switcher-element[data-section="section-fb-language-switcher"]'; $flag_spacing = astra_get_option( $_section . '-flag-spacing' ); $flag_spacing_desktop = isset( $flag_spacing['desktop'] ) ? $flag_spacing['desktop'] : ''; $flag_spacing_tablet = isset( $flag_spacing['tablet'] ) ? $flag_spacing['tablet'] : ''; $flag_spacing_mobile = isset( $flag_spacing['mobile'] ) ? $flag_spacing['mobile'] : ''; $flag_size = astra_get_option( $_section . '-flag-size' ); $flag_size_desktop = isset( $flag_size['desktop'] ) ? $flag_size['desktop'] : ''; $flag_size_tablet = isset( $flag_size['tablet'] ) ? $flag_size['tablet'] : ''; $flag_size_mobile = isset( $flag_size['mobile'] ) ? $flag_size['mobile'] : ''; /** * Desktop CSS. */ $css_output_desktop = array( '.ast-lswitcher-item-' . $builder_type => array( 'margin-right' => astra_get_css_value( $flag_spacing_desktop, 'px' ), ), '.ast-lswitcher-item-' . $builder_type . ' img' => array( 'width' => astra_get_css_value( $flag_size_desktop, 'px' ), ), '.ast-lswitcher-item-' . $builder_type . ' svg' => array( 'width' => astra_get_css_value( $flag_size_desktop, 'px' ), 'height' => astra_get_css_value( $flag_size_desktop, 'px' ), ), ); /** * Tablet CSS. */ $css_output_tablet = array( '.ast-lswitcher-item-' . $builder_type => array( 'margin-right' => astra_get_css_value( $flag_spacing_tablet, 'px' ), ), '.ast-lswitcher-item-' . $builder_type . ' img' => array( 'width' => astra_get_css_value( $flag_size_tablet, 'px' ), ), '.ast-lswitcher-item-' . $builder_type . ' svg' => array( 'width' => astra_get_css_value( $flag_size_tablet, 'px' ), 'height' => astra_get_css_value( $flag_size_tablet, 'px' ), ), ); /** * Tablet CSS. */ $css_output_mobile = array( '.ast-lswitcher-item-' . $builder_type => array( 'margin-right' => astra_get_css_value( $flag_spacing_mobile, 'px' ), ), '.ast-lswitcher-item-' . $builder_type . ' img' => array( 'width' => astra_get_css_value( $flag_size_mobile, 'px' ), ), '.ast-lswitcher-item-' . $builder_type . ' svg' => array( 'width' => astra_get_css_value( $flag_size_mobile, 'px' ), 'height' => astra_get_css_value( $flag_size_mobile, 'px' ), ), ); /* Parse CSS from array() */ $css_output = astra_parse_css( $css_output_desktop ); $css_output .= astra_parse_css( $css_output_tablet, '', astra_addon_get_tablet_breakpoint() ); $css_output .= astra_parse_css( $css_output_mobile, '', astra_addon_get_mobile_breakpoint() ); $generated_css .= $css_output; $generated_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, $selector ); return $generated_css; } } /** * Kicking this off by creating object of this class. */ new Astra_Language_Switcher_Component_Dynamic_CSS(); builder/type/base/dynamic-css/social-icon/class-astra-social-icon-component-dynamic-css.php 0000644 00000011267 15150261777 0026055 0 ustar 00 <?php /** * Astra Social Component Dynamic CSS. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Register Builder Dynamic CSS. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Social_Icon_Component_Dynamic_CSS { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Dynamic CSS * * @param string $builder_type Builder Type. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.0.0 */ public static function astra_social_dynamic_css( $builder_type = 'header' ) { $generated_css = ''; $number_of_social_icons = ( 'header' === $builder_type ) ? astra_addon_builder_helper()->num_of_header_social_icons : astra_addon_builder_helper()->num_of_footer_social_icons; for ( $index = 1; $index <= $number_of_social_icons; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'social-icons-' . $index, $builder_type ) ) { continue; } $selector = '.ast-' . $builder_type . '-social-' . $index . '-wrap'; $icon_spacing = astra_get_option( $builder_type . '-social-' . $index . '-space' ); $social_stack_on = astra_get_option( $builder_type . '-social-' . $index . '-stack', 'none' ); $icon_spacing_desktop = ( isset( $icon_spacing['desktop'] ) && '' !== $icon_spacing['desktop'] ) ? (int) $icon_spacing['desktop'] / 2 : ''; $icon_spacing_tablet = ( isset( $icon_spacing['tablet'] ) && '' !== $icon_spacing['tablet'] ) ? (int) $icon_spacing['tablet'] / 2 : ''; $icon_spacing_mobile = ( isset( $icon_spacing['mobile'] ) && '' !== $icon_spacing['mobile'] ) ? (int) $icon_spacing['mobile'] / 2 : ''; /** * Social Icon CSS. */ $css_output_desktop = array(); $css_output_tablet = array(); $css_output_mobile = array(); if ( 'desktop' === $social_stack_on ) { $css_output_desktop = array( $selector . ' .ast-social-stack-desktop .ast-builder-social-element' => array( 'display' => 'flex', // Icon Spacing. 'margin-left' => 'unset', 'margin-right' => 'unset', 'margin-top' => astra_get_css_value( $icon_spacing_desktop, 'px' ), 'margin-bottom' => astra_get_css_value( $icon_spacing_desktop, 'px' ), ), ); $css_output_tablet[ $selector . ' .ast-social-stack-desktop .ast-builder-social-element' ] = array( 'margin-top' => astra_get_css_value( $icon_spacing_tablet, 'px' ), 'margin-bottom' => astra_get_css_value( $icon_spacing_tablet, 'px' ), ); $css_output_mobile[ $selector . ' .ast-social-stack-desktop .ast-builder-social-element' ] = array( 'margin-top' => astra_get_css_value( $icon_spacing_mobile, 'px' ), 'margin-bottom' => astra_get_css_value( $icon_spacing_mobile, 'px' ), ); } /** * Social_icons tablet CSS. */ if ( 'tablet' === $social_stack_on ) { $css_output_tablet = array( $selector . ' .ast-social-stack-tablet .ast-builder-social-element' => array( 'display' => 'flex', // Icon Spacing. 'margin-left' => 'unset', 'margin-right' => 'unset', 'margin-top' => astra_get_css_value( $icon_spacing_tablet, 'px' ), 'margin-bottom' => astra_get_css_value( $icon_spacing_tablet, 'px' ), ), ); $css_output_mobile[ $selector . ' .ast-social-stack-tablet .ast-builder-social-element' ] = array( 'margin-top' => astra_get_css_value( $icon_spacing_mobile, 'px' ), 'margin-bottom' => astra_get_css_value( $icon_spacing_mobile, 'px' ), ); } /** * Social_icons mobile CSS. */ if ( 'mobile' === $social_stack_on ) { $css_output_mobile = array( $selector . ' .ast-social-stack-mobile .ast-builder-social-element' => array( 'display' => 'flex', // Icon Spacing. 'margin-left' => 'unset', 'margin-right' => 'unset', 'margin-top' => astra_get_css_value( $icon_spacing_mobile, 'px' ), 'margin-bottom' => astra_get_css_value( $icon_spacing_mobile, 'px' ), ), ); } /* Parse CSS from array() */ $css_output = astra_parse_css( $css_output_desktop ); $css_output .= astra_parse_css( $css_output_tablet, '', astra_addon_get_tablet_breakpoint() ); $css_output .= astra_parse_css( $css_output_mobile, '', astra_addon_get_mobile_breakpoint() ); $generated_css .= $css_output; } return $generated_css; } } /** * Kicking this off by creating object of this class. */ new Astra_Social_Icon_Component_Dynamic_CSS(); builder/type/base/dynamic-css/class-astra-addon-base-dynamic-css.php 0000644 00000004114 15150261777 0021443 0 ustar 00 <?php /** * Astra Addon Base Dynamic CSS. * * @since 3.3.0 * @package astra-addon */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class Astra_Addon_Base_Dynamic_CSS. */ class Astra_Addon_Base_Dynamic_CSS { /** * Dynamic CSS * * @param string $prefix control prefix. * @param string $selector control CSS selector. * @return String Generated dynamic CSS for Box Shadow. * * @since 3.3.0 */ public static function prepare_box_shadow_dynamic_css( $prefix, $selector ) { $dynamic_css = ''; $box_shadow = astra_get_option( $prefix . '-box-shadow-control' ); $box_shadow_color = astra_get_option( $prefix . '-box-shadow-color' ); $position = astra_get_option( $prefix . '-box-shadow-position' ); $is_shadow = isset( $box_shadow ); // Box Shadow. $box_shadow_x = ( $is_shadow && isset( $box_shadow['x'] ) && '' !== $box_shadow['x'] ) ? ( $box_shadow['x'] . 'px ' ) : '0px '; $box_shadow_y = ( $is_shadow && isset( $box_shadow['y'] ) && '' !== $box_shadow['y'] ) ? ( $box_shadow['y'] . 'px ' ) : '0px '; $box_shadow_blur = ( $is_shadow && isset( $box_shadow['blur'] ) && '' !== $box_shadow['blur'] ) ? ( $box_shadow['blur'] . 'px ' ) : '0px '; $box_shadow_spread = ( $is_shadow && isset( $box_shadow['spread'] ) && '' !== $box_shadow['spread'] ) ? ( $box_shadow['spread'] . 'px ' ) : '0px '; $shadow_position = ( $is_shadow && isset( $position ) && 'inset' === $position ) ? ' inset' : ''; $shadow_color = ( isset( $box_shadow_color ) ? $box_shadow_color : 'rgba(0,0,0,0.5)' ); $css_output = array( $selector => array( // box shadow. 'box-shadow' => $box_shadow_x . $box_shadow_y . $box_shadow_blur . $box_shadow_spread . $shadow_color . $shadow_position, ), ); /* Parse CSS from array() */ $dynamic_css .= astra_parse_css( $css_output ); return $dynamic_css; } } /** * Prepare if class 'Astra_Addon_Base_Dynamic_CSS' exist. * Kicking this off by calling 'get_instance()' method */ new Astra_Addon_Base_Dynamic_CSS(); builder/type/footer/button/assets/js/minified/customizer-preview.min.js 0000644 00000000123 15150261777 0022500 0 ustar 00 jQuery,astra_addon_button_css("footer",AstraAddonFooterButtonData.component_limit); builder/type/footer/button/assets/js/unminified/customizer-preview.js 0000644 00000000737 15150261777 0022274 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { astra_addon_button_css( 'footer', AstraAddonFooterButtonData.component_limit ); } )( jQuery ); builder/type/footer/button/classes/class-astra-ext-footer-button-component-loader.php 0000644 00000004603 15150261777 0025234 0 ustar 00 <?php /** * Button Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Ext_Footer_Button_Component_Loader { // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.1.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.1.0 */ public function theme_defaults( $defaults ) { // Button footer defaults. $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $_prefix = 'button' . $index; $defaults[ 'footer-' . $_prefix . '-size' ] = 'sm'; $defaults[ 'footer-' . $_prefix . '-box-shadow-control' ] = array( 'x' => '0', 'y' => '0', 'blur' => '0', 'spread' => '0', ); $defaults[ 'footer-' . $_prefix . '-box-shadow-color' ] = 'rgba(0,0,0,0.1)'; $defaults[ 'footer-' . $_prefix . '-box-shadow-position' ] = 'outline'; } return $defaults; } /** * Customizer Preview * * @since 3.3.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-ext-footer-button-customizer-preview-js', ASTRA_ADDON_EXT_FOOTER_BUTTON_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); // Localize variables for button JS. wp_localize_script( 'astra-ext-footer-button-customizer-preview-js', 'AstraAddonFooterButtonData', array( 'component_limit' => astra_addon_builder_helper()->component_limit, ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Ext_Footer_Button_Component_Loader(); builder/type/footer/button/dynamic-css/dynamic.css.php 0000644 00000001363 15150261777 0017140 0 ustar 00 <?php /** * Footer Button - Dynamic CSS * * @package Astra Builder * @since 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Footer Buttons */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_footer_button_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Footer Buttons. * * @since 3.3.0 */ function astra_addon_footer_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $dynamic_css .= Astra_Addon_Button_Component_Dynamic_CSS::astra_ext_button_dynamic_css( 'footer' ); return $dynamic_css; } builder/type/footer/button/class-astra-ext-footer-button-component-configs.php 0000644 00000002340 15150261777 0023755 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Footer Button. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Ext_Footer_Button_Component_Configs extends Astra_Customizer_Config_Base { // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.1.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Addon_Button_Component_Configs::register_configuration( $configurations, 'footer', 'section-fb-button-' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Ext_Footer_Button_Component_Configs(); builder/type/footer/button/class-astra-ext-footer-button-component.php 0000644 00000002541 15150261777 0022332 0 ustar 00 <?php /** * Footer Button component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_EXT_FOOTER_BUTTON_DIR', ASTRA_EXT_DIR . 'classes/builder/type/footer/button/' ); define( 'ASTRA_ADDON_EXT_FOOTER_BUTTON_URI', ASTRA_EXT_URI . 'classes/builder/type/footer/button/' ); /** * Button Initial Setup * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Ext_Footer_Button_Component { // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_EXT_FOOTER_BUTTON_DIR . 'classes/class-astra-ext-footer-button-component-loader.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_EXT_FOOTER_BUTTON_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Ext_Footer_Button_Component(); builder/type/footer/divider/assets/js/minified/customizer-preview.min.js 0000644 00000001550 15150261777 0022620 0 ustar 00 !function(){var a=AstraBuilderDividerData.tablet_break_point||768,o=AstraBuilderDividerData.mobile_break_point||544;astra_builder_divider_css("footer",AstraBuilderDividerData.component_limit);for(var t=1;t<=AstraBuilderDividerData.component_limit;t++)!function(e){wp.customize("astra-settings[footer-divider-"+e+"-alignment]",function(t){t.bind(function(t){var i="";""==t.desktop&&""==t.tablet&&""==t.mobile||(i=(i=(i=(i=(i=(i+='.footer-widget-area[data-section="section-fb-divider-'+e+'"] {')+"justify-content: "+t.desktop+";} ")+"@media (max-width: "+a+'px) {.footer-widget-area[data-section="section-fb-divider-'+e+'"] {')+"justify-content: "+t.tablet+";} ")+"} @media (max-width: "+o+"px) {")+'.footer-widget-area[data-section="section-fb-divider-'+e+'"] {justify-content: '+t.mobile+";} } "),astra_add_dynamic_css("footer-divider-"+e+"-alignment",i)})})}(t)}(jQuery); builder/type/footer/divider/assets/js/unminified/customizer-preview.js 0000644 00000004376 15150261777 0022412 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { var tablet_break_point = AstraBuilderDividerData.tablet_break_point || 768, mobile_break_point = AstraBuilderDividerData.mobile_break_point || 544; astra_builder_divider_css( 'footer', AstraBuilderDividerData.component_limit ); for( var index = 1; index <= AstraBuilderDividerData.component_limit ; index++ ) { (function( index ) { wp.customize( 'astra-settings[footer-divider-'+ index +'-alignment]', function( value ) { value.bind( function( alignment ) { var dynamicStyle = ''; if( alignment.desktop != '' || alignment.tablet != '' || alignment.mobile != '' ) { dynamicStyle += '.footer-widget-area[data-section="section-fb-divider-'+ index +'"] {'; dynamicStyle += 'justify-content: ' + alignment['desktop'] + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += '.footer-widget-area[data-section="section-fb-divider-'+ index +'"] {'; dynamicStyle += 'justify-content: ' + alignment['tablet'] + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += '.footer-widget-area[data-section="section-fb-divider-'+ index +'"] {'; dynamicStyle += 'justify-content: ' + alignment['mobile'] + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( 'footer-divider-'+ index +'-alignment', dynamicStyle ); } ); } ); })( index ); } } )( jQuery ); builder/type/footer/divider/classes/class-astra-footer-divider-component-loader.php 0000644 00000005726 15150261777 0024673 0 ustar 00 <?php /** * Divider Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Divider_Component_Loader { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.0.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.0.0 */ public function theme_defaults( $defaults ) { // Divider Footer defaults. $num_of_footer_divider = astra_addon_builder_helper()->num_of_footer_divider; for ( $index = 1; $index <= $num_of_footer_divider; $index++ ) { $defaults[ 'footer-divider-' . $index . '-layout' ] = 'horizontal'; $defaults[ 'footer-divider-' . $index . '-style' ] = 'solid'; $defaults[ 'footer-divider-' . $index . '-color' ] = ''; $defaults[ 'footer-divider-' . $index . '-size' ] = array( 'desktop' => '50', 'tablet' => '50', 'mobile' => '50', ); $defaults[ 'footer-vertical-divider-' . $index . '-size' ] = array( 'desktop' => '50', 'tablet' => '50', 'mobile' => '50', ); $defaults[ 'footer-divider-' . $index . '-thickness' ] = array( 'desktop' => '1', 'tablet' => '1', 'mobile' => '1', ); $defaults[ 'footer-divider-' . $index . '-alignment' ] = array( 'desktop' => 'center', 'tablet' => 'center', 'mobile' => 'center', ); } return $defaults; } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-footer-divider-customizer-preview-js', ASTRA_ADDON_FOOTER_DIVIDER_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_EXT_VER, true ); // Localize variables for divider JS. wp_localize_script( 'astra-footer-divider-customizer-preview-js', 'AstraBuilderDividerData', array( 'component_limit' => astra_addon_builder_helper()->component_limit, 'tablet_break_point' => astra_addon_get_tablet_breakpoint(), 'mobile_break_point' => astra_addon_get_mobile_breakpoint(), ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Footer_Divider_Component_Loader(); builder/type/footer/divider/dynamic-css/dynamic.css.php 0000644 00000006313 15150261777 0017253 0 ustar 00 <?php /** * Divider control - Dynamic CSS * * @package Astra Builder * @since 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Heading Colors */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_footer_divider_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.0.0 */ function astra_addon_footer_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $dynamic_css .= Astra_Divider_Component_Dynamic_CSS::astra_divider_dynamic_css( 'footer' ); $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'divider-' . $index, 'footer' ) ) { continue; } $_section = 'section-fb-divider-' . $index; $selector = '.footer-widget-area[data-section="section-fb-divider-' . $index . '"]'; $alignment = astra_get_option( 'footer-divider-' . $index . '-alignment' ); $desktop_alignment = ( isset( $alignment['desktop'] ) ) ? $alignment['desktop'] : 'center'; $tablet_alignment = ( isset( $alignment['tablet'] ) ) ? $alignment['tablet'] : ''; $mobile_alignment = ( isset( $alignment['mobile'] ) ) ? $alignment['mobile'] : ''; $margin = astra_get_option( $_section . '-margin' ); /** * Copyright CSS. */ $css_output_desktop = array( $selector => array( 'justify-content' => $desktop_alignment, 'margin-top' => astra_responsive_spacing( $margin, 'top', 'desktop' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'desktop' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'desktop' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'desktop' ), ), ); $css_output_tablet = array( $selector => array( 'justify-content' => $tablet_alignment, // Margin CSS. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'tablet' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'tablet' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'tablet' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'tablet' ), ), ); $css_output_mobile = array( $selector => array( 'justify-content' => $mobile_alignment, // Margin CSS. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'mobile' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'mobile' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'mobile' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'mobile' ), ), ); /* Parse CSS from array() */ $css_output = astra_parse_css( $css_output_desktop ); $css_output .= astra_parse_css( $css_output_tablet, '', astra_addon_get_tablet_breakpoint() ); $css_output .= astra_parse_css( $css_output_mobile, '', astra_addon_get_mobile_breakpoint() ); $dynamic_css .= $css_output; } return $dynamic_css; } builder/type/footer/divider/class-astra-footer-divider-component-configs.php 0000644 00000002445 15150261777 0023413 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Divider_Component_Configs extends Astra_Customizer_Config_Base { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Divider_Component_Configs::register_configuration( $configurations, 'footer', 'section-fb-divider-' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Footer_Divider_Component_Configs(); builder/type/footer/divider/class-astra-footer-divider-component.php 0000644 00000002477 15150261777 0021772 0 ustar 00 <?php /** * Divider component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_FOOTER_DIVIDER_DIR', ASTRA_EXT_DIR . 'classes/builder/type/footer/divider/' ); define( 'ASTRA_ADDON_FOOTER_DIVIDER_URI', ASTRA_EXT_URI . 'classes/builder/type/footer/divider/' ); /** * Divider Initial Setup * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Divider_Component { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_FOOTER_DIVIDER_DIR . 'classes/class-astra-footer-divider-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_FOOTER_DIVIDER_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Footer_Divider_Component(); builder/type/footer/language-switcher/assets/js/customizer-preview.js 0000644 00000004435 15150261777 0022242 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { var tablet_break_point = AstraBuilderFooterButtonData.tablet_break_point || 768, mobile_break_point = AstraBuilderFooterButtonData.mobile_break_point || 544; astra_builder_language_switcher_css( 'footer' ); wp.customize( 'astra-settings[footer-language-switcher-alignment]', function( value ) { value.bind( function( alignment ) { var dynamicStyle = ''; if( alignment.desktop != '' || alignment.tablet != '' || alignment.mobile != '' ) { dynamicStyle += '.ast-footer-language-switcher[data-section="section-fb-language-switcher"], .ast-footer-language-switcher .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu {'; dynamicStyle += 'justify-content: ' + alignment['desktop'] + ';'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += '.ast-footer-language-switcher[data-section="section-fb-language-switcher"], .ast-footer-language-switcher .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu {'; dynamicStyle += 'justify-content: ' + alignment['tablet'] + ';'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += '.ast-footer-language-switcher[data-section="section-fb-language-switcher"], .ast-footer-language-switcher .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu {'; dynamicStyle += 'justify-content: ' + alignment['mobile'] + ';'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( 'footer-language-switcher-alignment', dynamicStyle ); } ); } ); } )( jQuery ); type/footer/language-switcher/classes/class-astra-footer-language-switcher-component-loader.php 0000644 00000005445 15150261777 0030560 0 ustar 00 builder <?php /** * Language Switcher Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Language_Switcher_Component_Loader { // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.1.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.1.0 */ public function theme_defaults( $defaults ) { // Language Switcher footer defaults. $defaults['footer-language-switcher-type'] = 'custom'; $defaults['footer-language-switcher-layout'] = 'vertical'; $defaults['footer-language-switcher-show-flag'] = true; $defaults['footer-language-switcher-show-name'] = true; $defaults['footer-language-switcher-show-tname'] = false; $defaults['footer-language-switcher-show-code'] = false; $defaults['section-fb-language-switcher-flag-spacing'] = array( 'desktop' => '5', 'tablet' => '', 'mobile' => '', ); $defaults['section-fb-language-switcher-flag-size'] = array( 'desktop' => '20', 'tablet' => '', 'mobile' => '', ); $defaults['footer-language-switcher-options'] = array( 'items' => array( array( 'id' => 'gb', 'enabled' => true, 'url' => '', 'label' => __( 'English', 'astra-addon' ), ), ), ); $defaults['footer-language-switcher-alignment'] = array( 'desktop' => 'flex-start', 'tablet' => 'flex-start', 'mobile' => 'flex-start', ); $defaults['section-fb-language-switcher-margin'] = astra_addon_builder_helper()->default_responsive_spacing; return $defaults; } /** * Customizer Preview * * @since 3.1.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-footer-language-switcher-customizer-preview-js', ASTRA_ADDON_FOOTER_LANGUAGE_SWITCHER_URI . '/assets/js/customizer-preview.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Footer_Language_Switcher_Component_Loader(); builder/type/footer/language-switcher/dynamic-css/dynamic.css.php 0000644 00000004166 15150261777 0021242 0 ustar 00 <?php /** * Language_Switcher control - Dynamic CSS * * @package Astra Builder * @since 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Language Switcher Colors */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_footer_lang_switcher_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.1.0 */ function astra_addon_footer_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { if ( Astra_Addon_Builder_Helper::is_component_loaded( 'language-switcher', 'footer' ) ) { $dynamic_css .= Astra_Language_Switcher_Component_Dynamic_CSS::astra_language_switcher_dynamic_css( 'footer' ); $selector = '.ast-footer-language-switcher-element[data-section="section-fb-language-switcher"], .ast-footer-language-switcher .ast-builder-language-switcher-layout-horizontal .ast-builder-language-switcher-menu'; $alignment = astra_get_option( 'footer-language-switcher-alignment' ); $desktop_alignment = ( isset( $alignment['desktop'] ) ) ? $alignment['desktop'] : ''; $tablet_alignment = ( isset( $alignment['tablet'] ) ) ? $alignment['tablet'] : ''; $mobile_alignment = ( isset( $alignment['mobile'] ) ) ? $alignment['mobile'] : ''; /** * Copyright CSS. */ $css_output_desktop = array( $selector => array( 'justify-content' => $desktop_alignment, ), ); $css_output_tablet = array( $selector => array( 'justify-content' => $tablet_alignment, ), ); $css_output_mobile = array( $selector => array( 'justify-content' => $mobile_alignment, ), ); /* Parse CSS from array() */ $css_output = astra_parse_css( $css_output_desktop ); $css_output .= astra_parse_css( $css_output_tablet, '', astra_addon_get_tablet_breakpoint() ); $css_output .= astra_parse_css( $css_output_mobile, '', astra_addon_get_mobile_breakpoint() ); $dynamic_css .= $css_output; } return $dynamic_css; } builder/type/footer/language-switcher/class-astra-footer-language-switcher-component.php 0000644 00000002503 15150261777 0025726 0 ustar 00 <?php /** * HTML component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_FOOTER_LANGUAGE_SWITCHER_DIR', ASTRA_EXT_DIR . 'classes/builder/type/footer/language-switcher/' ); define( 'ASTRA_ADDON_FOOTER_LANGUAGE_SWITCHER_URI', ASTRA_EXT_URI . 'classes/builder/type/footer/language-switcher/' ); /** * Heading Initial Setup * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Language_Switcher_Component { // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_FOOTER_LANGUAGE_SWITCHER_DIR . 'classes/class-astra-footer-language-switcher-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_FOOTER_LANGUAGE_SWITCHER_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Footer_Language_Switcher_Component(); builder/type/footer/language-switcher/class-astra-footer-language-switcher-configs.php 0000644 00000002343 15150261777 0025356 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Language_Switcher_Configs extends Astra_Customizer_Config_Base { // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.1.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Language_Switcher_Component_Configs::register_configuration( $configurations, 'footer', 'section-fb-language-switcher' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Footer_Language_Switcher_Configs(); builder/type/footer/social-icon/assets/css/minified/style-rtl.min.css 0000644 00000001212 15150261777 0021771 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element{justify-content:center}.ast-header-divider-element{position:relative}.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal{width:100%}.ast-fb-divider-layout-vertical .ast-divider-layout-horizontal,.ast-fb-divider-layout-vertical .ast-divider-layout-vertical{position:absolute}.ast-hb-divider-layout-vertical.ast-header-divider-element{height:100%}.ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element),.ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element){margin:15px 20px} builder/type/footer/social-icon/assets/css/minified/style.min.css 0000644 00000001212 15150261777 0021172 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element{justify-content:center}.ast-header-divider-element{position:relative}.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal{width:100%}.ast-fb-divider-layout-vertical .ast-divider-layout-horizontal,.ast-fb-divider-layout-vertical .ast-divider-layout-vertical{position:absolute}.ast-hb-divider-layout-vertical.ast-header-divider-element{height:100%}.ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element),.ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element){margin:15px 20px} builder/type/footer/social-icon/assets/css/unminified/style-rtl.css 0000644 00000001431 15150261777 0021555 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element { justify-content: center; } .ast-header-divider-element { position: relative; } .ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal { width: 100%; } .ast-fb-divider-layout-vertical .ast-divider-layout-vertical, .ast-fb-divider-layout-vertical .ast-divider-layout-horizontal { position: absolute; } .ast-hb-divider-layout-vertical.ast-header-divider-element { height: 100%; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { margin: 15px 20px; } builder/type/footer/social-icon/assets/css/unminified/style.css 0000644 00000001431 15150261777 0020756 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element { justify-content: center; } .ast-header-divider-element { position: relative; } .ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal { width: 100%; } .ast-fb-divider-layout-vertical .ast-divider-layout-vertical, .ast-fb-divider-layout-vertical .ast-divider-layout-horizontal { position: absolute; } .ast-hb-divider-layout-vertical.ast-header-divider-element { height: 100%; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { margin: 15px 20px; } builder/type/footer/social-icon/assets/js/customizer-preview.js 0000644 00000000751 15150261777 0021026 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { astra_builder_addon_social_css( 'footer', AstraBuilderSocialData.footer_social_count ); } )( jQuery ); builder/type/footer/social-icon/assets/scss/style.scss 0000644 00000000000 15150261777 0017164 0 ustar 00 builder/type/footer/social-icon/classes/class-astra-footer-social-component-loader.php 0000644 00000004175 15150261777 0025266 0 ustar 00 <?php /** * Social Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Social_Component_Loader { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.0.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.0.0 */ public function theme_defaults( $defaults ) { $num_of_footer_social_icons = astra_addon_builder_helper()->num_of_footer_social_icons; // Divider footer defaults. for ( $index = 1; $index <= $num_of_footer_social_icons; $index++ ) { $defaults[ 'footer-social-' . $index . '-stack' ] = 'none'; } return $defaults; } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-social-icon-addon-footer-customizer-preview-js', ASTRA_ADDON_FOOTER_SOCIAL_URI . '/assets/js/customizer-preview.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); // Localize variables for divider JS. wp_localize_script( 'astra-social-icon-addon-footer-customizer-preview-js', 'AstraBuilderSocialData', array( 'footer_social_count' => astra_addon_builder_helper()->num_of_footer_social_icons, ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Footer_Social_Component_Loader(); builder/type/footer/social-icon/dynamic-css/dynamic.css.php 0000644 00000001360 15150261777 0020022 0 ustar 00 <?php /** * Divider control - Dynamic CSS * * @package Astra Builder * @since 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Heading Colors */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_footer_social_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.0.0 */ function astra_addon_footer_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $dynamic_css .= Astra_Social_Icon_Component_Dynamic_CSS::astra_social_dynamic_css( 'footer' ); return $dynamic_css; } builder/type/footer/social-icon/class-astra-footer-social-component-configs.php 0000644 00000002447 15150261777 0024013 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Social_Component_Configs extends Astra_Customizer_Config_Base { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.1.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Social_Component_Configs::register_configuration( $configurations, 'footer', 'section-fb-social-icons-' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Footer_Social_Component_Configs(); builder/type/footer/social-icon/class-astra-footer-social-component.php 0000644 00000002477 15150261777 0022370 0 ustar 00 <?php /** * HTML component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_FOOTER_SOCIAL_DIR', ASTRA_EXT_DIR . 'classes/builder/type/footer/social-icon/' ); define( 'ASTRA_ADDON_FOOTER_SOCIAL_URI', ASTRA_EXT_URI . 'classes/builder/type/footer/social-icon/' ); /** * Heading Initial Setup * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Footer_Social_Component { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_FOOTER_SOCIAL_DIR . 'classes/class-astra-footer-social-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_FOOTER_SOCIAL_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Footer_Social_Component(); builder/type/header/account/classes/class-astra-ext-header-account-component-loader.php 0000644 00000002121 15150261777 0025353 0 ustar 00 <?php /** * Account Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Ext_Header_Account_Component_Loader { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.0.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.0.0 */ public function theme_defaults( $defaults ) { // Account header defaults. $defaults['header-account-icon-type'] = 'account-1'; return $defaults; } } /** * Kicking this off by creating the object of the class. */ new Astra_Ext_Header_Account_Component_Loader(); builder/type/header/account/class-astra-ext-header-account-component-configs.php 0000644 00000027456 15150261777 0024122 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Ext_Header_Account_Component_Configs extends Astra_Customizer_Config_Base { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $_section = 'section-header-account'; $account_choices = array( 'default' => __( 'Default', 'astra-addon' ), ); if ( class_exists( 'LifterLMS' ) && get_permalink( llms_get_page_id( 'myaccount' ) ) ) { $account_choices['lifterlms'] = __( 'LifterLMS', 'astra-addon' ); } if ( class_exists( 'WooCommerce' ) && get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ) { $account_choices['woocommerce'] = __( 'WooCommerce', 'astra-addon' ); } $register_option = ''; if ( get_option( 'users_can_register' ) ) { $register_option = array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-login-register]', 'default' => astra_get_option( 'header-account-login-register' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$switch_control, 'section' => $_section, 'priority' => 205, 'title' => __( 'Register', 'astra-addon' ), 'context' => array( astra_addon_builder_helper()->general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-action]', 'operator' => '==', 'value' => 'login', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]', 'operator' => '!=', 'value' => 'none', ), ), 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), 'transport' => 'postMessage', ); } $_configs = array( /** * Option: Profile Link type */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-action-type]', 'default' => astra_get_option( 'header-account-action-type' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'title' => __( 'Profile Action', 'astra-addon' ), 'priority' => 4, 'choices' => array( 'link' => __( 'Link', 'astra-addon' ), 'menu' => __( 'Menu', 'astra-addon' ), ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), 'responsive' => false, 'renderAs' => 'text', ), /** * Option: Profile Link type */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-link-type]', 'default' => astra_get_option( 'header-account-link-type' ), 'type' => 'control', 'control' => 'ast-select', 'section' => $_section, 'priority' => 5, 'title' => __( 'Link Type', 'astra-addon' ), 'choices' => array( 'default' => __( 'Default', 'astra-addon' ), 'custom' => __( 'Custom', 'astra-addon' ), ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), 'context' => array( astra_addon_builder_helper()->general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-type]', 'operator' => '!=', 'value' => 'default', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]', 'operator' => '!=', 'value' => 'menu', ), ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-woo-menu]', 'default' => astra_get_option( 'header-account-woo-menu' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$switch_control, 'section' => $_section, 'priority' => 7, 'title' => __( 'Use WooCommerce Account Menu', 'astra-addon' ), 'context' => array( array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-type]', 'operator' => '==', 'value' => 'woocommerce', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]', 'operator' => '==', 'value' => 'menu', ), astra_addon_builder_helper()->general_tab_config, ), 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), 'transport' => 'postMessage', ), /** * Option: Theme Menu create link */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-create-menu-link]', 'default' => astra_get_option( 'header-account-create-menu-link' ), 'type' => 'control', 'control' => 'ast-customizer-link', 'section' => $_section, 'link_type' => 'section', 'linked' => 'menu_locations', 'link_text' => __( 'Configure Menu from Here.', 'astra-addon' ), 'priority' => 7, 'context' => array( astra_addon_builder_helper()->general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]', 'operator' => '==', 'value' => 'menu', ), ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-menu-link-notice]', 'type' => 'control', 'control' => 'ast-description', 'section' => $_section, 'priority' => 7, 'label' => '', 'help' => $this->get_help_text_notice(), 'context' => array( astra_addon_builder_helper()->general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]', 'operator' => '==', 'value' => 'menu', ), ), ), /** * Option: Click action type */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-logout-action]', 'default' => astra_get_option( 'header-account-logout-action' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'title' => __( 'Click Action', 'astra-addon' ), 'choices' => array( 'link' => __( 'Link', 'astra-addon' ), 'login' => __( 'Login Popup', 'astra-addon' ), ), 'transport' => 'postMessage', 'priority' => 204, 'context' => array( array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]', 'operator' => '!=', 'value' => 'none', ), astra_addon_builder_helper()->general_tab_config, ), 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), 'responsive' => false, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), ), $register_option, array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-login-lostpass]', 'default' => astra_get_option( 'header-account-login-lostpass' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$switch_control, 'section' => $_section, 'priority' => 205, 'title' => __( 'Lost your password?', 'astra-addon' ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), 'context' => array( astra_addon_builder_helper()->general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-action]', 'operator' => '==', 'value' => 'login', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]', 'operator' => '!=', 'value' => 'none', ), ), 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), 'transport' => 'postMessage', ), array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-icon-type]', 'default' => astra_get_option( 'header-account-icon-type' ), 'type' => 'control', 'control' => Astra_Theme_Extension::$selector_control, 'section' => $_section, 'priority' => 3, 'title' => __( 'Select Icon', 'astra-addon' ), 'choices' => array( 'account-1' => 'account-1', 'account-2' => 'account-2', 'account-3' => 'account-3', 'account-4' => 'account-4', ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), 'context' => array( astra_addon_builder_helper()->design_tab_config, array( 'relation' => 'OR', array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]', 'operator' => '==', 'value' => 'icon', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]', 'operator' => '==', 'value' => 'icon', ), ), ), 'responsive' => false, 'divider' => array( 'ast_class' => 'ast-bottom-dotted-divider' ), ), ); if ( count( $account_choices ) > 1 ) { $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[header-account-type]', 'default' => astra_get_option( 'header-account-type' ), 'type' => 'control', 'control' => 'ast-select', 'divider' => array( 'ast_class' => 'ast-bottom-dotted-divider ast-section-spacing' ), 'section' => $_section, 'priority' => 1, 'title' => __( 'Select Account', 'astra-addon' ), 'choices' => $account_choices, 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-header-account', 'render_callback' => array( 'Astra_Builder_UI_Controller', 'render_account' ), ), ); } $configurations = array_merge( $configurations, $_configs ); return $configurations; } /** * Help notice message to be displayed when the Link type set as Menu. * * @since 3.5.9 * @return String HTML Markup for the help notice. */ private function get_help_text_notice() { if ( class_exists( 'WooCommerce' ) ) { $notice = __( '<b>Note:</b> For responsive devices, the menu will be replaced with the WooCommerce "My Account" link.', 'astra-addon' ); } elseif ( class_exists( 'LifterLMS' ) ) { $notice = __( '<b>Note:</b> For responsive devices, the menu will be replaced with the LifterLMS "My Account" link.', 'astra-addon' ); } else { $notice = __( '<b>Note:</b> For responsive devices, the menu will be replaced with the Link provided in the Link Tab.', 'astra-addon' ); } return $notice; } } /** * Kicking this off by creating object of this class. */ new Astra_Ext_Header_Account_Component_Configs(); builder/type/header/account/class-astra-ext-header-account-component.php 0000644 00000002135 15150261777 0022457 0 ustar 00 <?php /** * HTML component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_EXT_HEADER_ACCOUNT_DIR', ASTRA_EXT_DIR . 'classes/builder/type/header/account/' ); /** * Heading Initial Setup * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Ext_Header_Account_Component { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_EXT_HEADER_ACCOUNT_DIR . 'classes/class-astra-ext-header-account-component-loader.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Ext_Header_Account_Component(); builder/type/header/button/assets/js/minified/customizer-preview.min.js 0000644 00000000123 15150261777 0022432 0 ustar 00 jQuery,astra_addon_button_css("header",AstraAddonHeaderButtonData.component_limit); builder/type/header/button/assets/js/unminified/customizer-preview.js 0000644 00000000737 15150261777 0022226 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { astra_addon_button_css( 'header', AstraAddonHeaderButtonData.component_limit ); } )( jQuery ); builder/type/header/button/classes/class-astra-addon-header-button-component-loader.php 0000644 00000004506 15150261777 0025407 0 ustar 00 <?php /** * Button Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.1.0 */ class Astra_Addon_Header_Button_Component_Loader { /** * Constructor * * @since 3.1.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.1.0 */ public function theme_defaults( $defaults ) { // Button header defaults. $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $_prefix = 'button' . $index; $defaults[ 'header-' . $_prefix . '-size' ] = 'sm'; $defaults[ 'header-' . $_prefix . '-box-shadow-control' ] = array( 'x' => '0', 'y' => '0', 'blur' => '0', 'spread' => '0', ); $defaults[ 'header-' . $_prefix . '-box-shadow-color' ] = 'rgba(0,0,0,0.1)'; $defaults[ 'header-' . $_prefix . '-box-shadow-position' ] = 'outline'; } return $defaults; } /** * Customizer Preview * * @since 3.3.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-ext-header-button-customizer-preview-js', ASTRA_ADDON_HEADER_BUTTON_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); // Localize variables for button JS. wp_localize_script( 'astra-ext-header-button-customizer-preview-js', 'AstraAddonHeaderButtonData', array( 'component_limit' => astra_addon_builder_helper()->component_limit, ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Addon_Header_Button_Component_Loader(); builder/type/header/button/dynamic-css/dynamic.css.php 0000644 00000001362 15150261777 0017071 0 ustar 00 <?php /** * Header Button Element - Dynamic CSS * * @package Astra Builder * @since 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Header Button Dynamic CSS */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_header_button_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return string Generated dynamic CSS * * @since 3.3.0 */ function astra_addon_header_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $dynamic_css .= Astra_Addon_Button_Component_Dynamic_CSS::astra_ext_button_dynamic_css( 'header' ); return $dynamic_css; } builder/type/header/button/class-astra-addon-header-button-component-configs.php 0000644 00000002237 15150261777 0024133 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.1.0 */ class Astra_Addon_Header_Button_Component_Configs extends Astra_Customizer_Config_Base { /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.1.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Addon_Button_Component_Configs::register_configuration( $configurations, 'header', 'section-hb-button-' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Addon_Header_Button_Component_Configs(); builder/type/header/button/class-astra-addon-header-button-component.php 0000644 00000002421 15150261777 0022500 0 ustar 00 <?php /** * Button component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_HEADER_BUTTON_DIR', ASTRA_EXT_DIR . 'classes/builder/type/header/button/' ); define( 'ASTRA_ADDON_HEADER_BUTTON_URI', ASTRA_EXT_URI . 'classes/builder/type/header/button/' ); /** * Button Initial Setup * * @since 3.1.0 */ class Astra_Addon_Header_Button_Component { /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_HEADER_BUTTON_DIR . 'classes/class-astra-addon-header-button-component-loader.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_HEADER_BUTTON_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Addon_Header_Button_Component(); builder/type/header/divider/assets/js/minified/customizer-preview.min.js 0000644 00000000123 15150261777 0022545 0 ustar 00 jQuery,astra_builder_divider_css("header",AstraBuilderDividerData.component_limit); builder/type/header/divider/assets/js/unminified/customizer-preview.js 0000644 00000000727 15150261777 0022340 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { astra_builder_divider_css( 'header', AstraBuilderDividerData.component_limit ); } )( jQuery ); builder/type/header/divider/classes/class-astra-header-divider-component-loader.php 0000644 00000005254 15150261777 0024553 0 ustar 00 <?php /** * Divider Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Header_Divider_Component_Loader { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.0.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.0.0 */ public function theme_defaults( $defaults ) { // Divider header defaults. $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $defaults[ 'header-divider-' . $index . '-layout' ] = 'vertical'; $defaults[ 'header-divider-' . $index . '-style' ] = 'solid'; $defaults[ 'header-divider-' . $index . '-color' ] = '#000000'; $defaults[ 'header-divider-' . $index . '-size' ] = array( 'desktop' => '50', 'tablet' => '50', 'mobile' => '50', ); $defaults[ 'header-horizontal-divider-' . $index . '-size' ] = array( 'desktop' => '50', 'tablet' => '50', 'mobile' => '50', ); $defaults[ 'header-divider-' . $index . '-thickness' ] = array( 'desktop' => '1', 'tablet' => '1', 'mobile' => '1', ); } return $defaults; } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-heading-divider-customizer-preview-js', ASTRA_ADDON_HEADER_DIVIDER_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); // Localize variables for divider JS. wp_localize_script( 'astra-heading-divider-customizer-preview-js', 'AstraBuilderDividerData', array( 'component_limit' => astra_addon_builder_helper()->component_limit, ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Header_Divider_Component_Loader(); builder/type/header/divider/dynamic-css/dynamic.css.php 0000644 00000001357 15150261777 0017210 0 ustar 00 <?php /** * Divider control - Dynamic CSS * * @package Astra Builder * @since 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Heading Colors */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_header_divider_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.0.0 */ function astra_addon_header_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $dynamic_css .= Astra_Divider_Component_Dynamic_CSS::astra_divider_dynamic_css( 'header' ); return $dynamic_css; } builder/type/header/divider/class-astra-header-divider-component-configs.php 0000644 00000002445 15150261777 0023277 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Header_Divider_Component_Configs extends Astra_Customizer_Config_Base { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Divider_Component_Configs::register_configuration( $configurations, 'header', 'section-hb-divider-' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Header_Divider_Component_Configs(); builder/type/header/divider/class-astra-header-divider-component.php 0000644 00000002476 15150261777 0021655 0 ustar 00 <?php /** * HTML component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_HEADER_DIVIDER_DIR', ASTRA_EXT_DIR . 'classes/builder/type/header/divider/' ); define( 'ASTRA_ADDON_HEADER_DIVIDER_URI', ASTRA_EXT_URI . 'classes/builder/type/header/divider/' ); /** * Heading Initial Setup * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Header_Divider_Component { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_HEADER_DIVIDER_DIR . 'classes/class-astra-header-divider-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_HEADER_DIVIDER_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Header_Divider_Component(); builder/type/header/language-switcher/assets/js/customizer-preview.js 0000644 00000000702 15150261777 0022165 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { astra_builder_language_switcher_css( 'header' ); } )( jQuery ); type/header/language-switcher/classes/class-astra-header-language-switcher-component-loader.php 0000644 00000005252 15150261777 0030440 0 ustar 00 builder <?php /** * Language Switcher Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Header_Language_Switcher_Component_Loader { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.1.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.1.0 */ public function theme_defaults( $defaults ) { $defaults['header-language-switcher-type'] = 'custom'; $defaults['header-language-switcher-layout'] = 'horizontal'; $defaults['header-language-switcher-show-flag'] = true; $defaults['header-language-switcher-show-name'] = true; $defaults['header-language-switcher-show-tname'] = false; $defaults['header-language-switcher-show-code'] = false; $defaults['section-hb-language-switcher-flag-spacing'] = array( 'desktop' => '5', 'tablet' => '', 'mobile' => '', ); $defaults['section-hb-language-switcher-flag-size'] = array( 'desktop' => '20', 'tablet' => '', 'mobile' => '', ); $defaults['header-language-switcher-options'] = array( 'items' => array( array( 'id' => 'gb', 'enabled' => true, 'url' => '', 'label' => __( 'English', 'astra-addon' ), ), ), ); $defaults['section-hb-language-switcher-margin'] = astra_addon_builder_helper()->default_responsive_spacing; return $defaults; } /** * Customizer Preview * * @since 3.1.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-heading-language-switcher-customizer-preview-js', ASTRA_ADDON_HEADER_LANGUAGE_SWITCHER_URI . '/assets/js/customizer-preview.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Header_Language_Switcher_Component_Loader(); builder/type/header/language-switcher/dynamic-css/dynamic.css.php 0000644 00000001604 15150261777 0021166 0 ustar 00 <?php /** * Language_Switcher control - Dynamic CSS * * @package Astra Builder * @since 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Language Switcher Colors */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_header_lang_switcher_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.1.0 */ function astra_addon_header_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { if ( Astra_Addon_Builder_Helper::is_component_loaded( 'language-switcher', 'header' ) ) { $dynamic_css .= Astra_Language_Switcher_Component_Dynamic_CSS::astra_language_switcher_dynamic_css( 'header' ); } return $dynamic_css; } builder/type/header/language-switcher/class-astra-header-language-switcher-component.php 0000644 00000002630 15150261777 0025613 0 ustar 00 <?php /** * HTML component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_HEADER_LANGUAGE_SWITCHER_DIR', ASTRA_EXT_DIR . 'classes/builder/type/header/language-switcher/' ); define( 'ASTRA_ADDON_HEADER_LANGUAGE_SWITCHER_URI', ASTRA_EXT_URI . 'classes/builder/type/header/language-switcher/' ); /** * Heading Initial Setup * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Header_Language_Switcher_Component { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_HEADER_LANGUAGE_SWITCHER_DIR . 'classes/class-astra-header-language-switcher-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_HEADER_LANGUAGE_SWITCHER_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Header_Language_Switcher_Component(); builder/type/header/language-switcher/class-astra-header-language-switcher-configs.php 0000644 00000002470 15150261777 0025243 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.1.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.1.0 */ // @codingStandardsIgnoreStart class Astra_Header_Language_Switcher_Configs extends Astra_Customizer_Config_Base { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.1.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Language_Switcher_Component_Configs::register_configuration( $configurations, 'header', 'section-hb-language-switcher' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Header_Language_Switcher_Configs(); builder/type/header/menu/assets/js/minified/customizer-preview.min.js 0000644 00000000631 15150261777 0022067 0 ustar 00 !function(){for(var e=1;e<=AstraAddonMenuData.component_limit;e++)astra_addon_box_shadow_css("header-menu"+e,".ast-desktop .ast-mega-menu-enabled .ast-builder-menu-"+e+" div:not( .astra-full-megamenu-wrapper) .sub-menu, .ast-builder-menu-"+e+" .inline-on-mobile .sub-menu, .ast-desktop .ast-builder-menu-"+e+" .astra-full-megamenu-wrapper, .ast-desktop .ast-builder-menu-"+e+" .menu-item .sub-menu")}(jQuery); builder/type/header/menu/assets/js/unminified/customizer-preview.js 0000644 00000001764 15150261777 0021660 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Addon * @since x.x.x */ ( function( $ ) { for ( var index = 1; index <= AstraAddonMenuData.component_limit; index++ ) { /** * Box Shadow */ (function (index) { var selector = '.ast-desktop .ast-mega-menu-enabled .ast-builder-menu-' + index + ' div:not( .astra-full-megamenu-wrapper) .sub-menu, .ast-builder-menu-' + index + ' .inline-on-mobile .sub-menu, .ast-desktop .ast-builder-menu-' + index + ' .astra-full-megamenu-wrapper, .ast-desktop .ast-builder-menu-' + index + ' .menu-item .sub-menu'; // Box Shadow CSS Generation. astra_addon_box_shadow_css( 'header-menu' + index, selector ); })(index); } } )( jQuery ); builder/type/header/menu/classes/class-astra-addon-header-menu-component-loader.php 0000644 00000004324 15150261777 0024467 0 ustar 00 <?php /** * Menu Styling Loader for Astra Addon. * * @package Astra Addon * @link https://www.brainstormforce.com * @since Astra 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.3.0 */ class Astra_Addon_Header_Menu_Component_Loader { /** * Constructor * * @since 3.3.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.3.0 */ public function theme_defaults( $defaults ) { // Menu - Box Shadow defaults. $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $_prefix = 'menu' . $index; $defaults[ 'header-' . $_prefix . '-box-shadow-control' ] = array( 'x' => '0', 'y' => '4', 'blur' => '10', 'spread' => '-2', ); $defaults[ 'header-' . $_prefix . '-box-shadow-color' ] = 'rgba(0,0,0,0.1)'; $defaults[ 'header-' . $_prefix . '-box-shadow-position' ] = 'outline'; } return $defaults; } /** * Customizer Preview * * @since 3.3.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-ext-header-menu-customizer-preview-js', ASTRA_ADDON_HEADER_MENU_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-addon-customizer-preview-js' ), ASTRA_EXT_VER, true ); // Localize variables for menu JS. wp_localize_script( 'astra-ext-header-menu-customizer-preview-js', 'AstraAddonMenuData', array( 'component_limit' => astra_addon_builder_helper()->component_limit, ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Addon_Header_Menu_Component_Loader(); builder/type/header/menu/dynamic-css/dynamic.css.php 0000644 00000002565 15150261777 0016530 0 ustar 00 <?php /** * Menu Element - Dynamic CSS * * @package Astra Addon * @since 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Menu Box - Dynamic CSS */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_header_menu_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.3.0 */ function astra_addon_header_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'menu-' . $index, 'header' ) ) { continue; } $_prefix = 'menu' . $index; $selector = '.ast-desktop .ast-mega-menu-enabled .ast-builder-menu-' . $index . ' div:not( .astra-full-megamenu-wrapper) .sub-menu, .ast-builder-menu-' . $index . ' .inline-on-mobile .sub-menu, .ast-desktop .ast-builder-menu-' . $index . ' .astra-full-megamenu-wrapper, .ast-desktop .ast-builder-menu-' . $index . ' .menu-item .sub-menu'; $dynamic_css .= Astra_Addon_Base_Dynamic_CSS::prepare_box_shadow_dynamic_css( 'header-' . $_prefix, $selector ); } return $dynamic_css; } builder/type/header/menu/class-astra-addon-header-menu-component-configs.php 0000644 00000002730 15150261777 0023213 0 ustar 00 <?php /** * Astra Addon Customizer Configuration for Menu. * * @package Astra Addon * @link https://wpastra.com/ * @since 3.3.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Register Builder Customizer Configurations. * * @since 3.3.0 */ class Astra_Addon_Header_Menu_Component_Configs extends Astra_Customizer_Config_Base { /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.3.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $html_config = array(); $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $_section = 'section-hb-menu-' . $index; $_prefix = 'menu' . $index; $html_config[] = Astra_Addon_Base_Configs::prepare_box_shadow_tab( $_section, 'header-' . $_prefix, 100 ); } $html_config = call_user_func_array( 'array_merge', $html_config + array( array() ) ); $configurations = array_merge( $configurations, $html_config ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Addon_Header_Menu_Component_Configs(); builder/type/header/menu/class-astra-addon-header-menu-component.php 0000644 00000002232 15150261777 0021562 0 ustar 00 <?php /** * Menu Element. * * @package Astra Addon * @link https://www.brainstormforce.com * @since Astra 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_HEADER_MENU_DIR', ASTRA_EXT_DIR . 'classes/builder/type/header/menu/' ); define( 'ASTRA_ADDON_HEADER_MENU_URI', ASTRA_EXT_URI . 'classes/builder/type/header/menu/' ); /** * Menu Initial Setup * * @since 3.3.0 */ class Astra_Addon_Header_Menu_Component { /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_HEADER_MENU_DIR . 'classes/class-astra-addon-header-menu-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_HEADER_MENU_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Addon_Header_Menu_Component(); builder/type/header/off-canvas/assets/js/minified/customizer-preview.min.js 0000644 00000001216 15150261777 0023146 0 ustar 00 jQuery,wp.customize("astra-settings[off-canvas-width]",function(a){a.bind(function(a){var e=astraBuilderPreview.tablet_break_point||768,t=astraBuilderPreview.mobile_break_point||544,i="";""!==a.desktop&&(i=(i+=".ast-desktop .ast-mobile-popup-drawer.active .ast-mobile-popup-inner {")+"max-width: "+a.desktop+"%;} "),""!==a.tablet&&(i=(i+="@media (max-width: "+e+"px) {")+".ast-mobile-popup-drawer.active .ast-mobile-popup-inner {max-width: "+a.tablet+"%;} } "),""!==a.mobile&&(i=(i+="@media (max-width: "+t+"px) {")+".ast-mobile-popup-drawer.active .ast-mobile-popup-inner {max-width: "+a.mobile+"%;} } "),astra_add_dynamic_css("off-canvas-width",i)})}); builder/type/header/off-canvas/assets/js/unminified/customizer-preview.js 0000644 00000003520 15150261777 0022727 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Addon * @since x.x.x */ ( function( $ ) { wp.customize( 'astra-settings[off-canvas-width]', function ( value ) { value.bind( function ( newval ) { var tablet_break_point = astraBuilderPreview.tablet_break_point || 768, mobile_break_point = astraBuilderPreview.mobile_break_point || 544, dynamicStyle = ''; if ( '' !== newval.desktop ) { dynamicStyle += '.ast-desktop .ast-mobile-popup-drawer.active .ast-mobile-popup-inner {'; dynamicStyle += 'max-width: ' + newval.desktop + '%;'; dynamicStyle += '} '; } if ( '' !== newval.tablet ) { dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += '.ast-mobile-popup-drawer.active .ast-mobile-popup-inner {'; dynamicStyle += 'max-width: ' + newval.tablet + '%;'; dynamicStyle += '} '; dynamicStyle += '} '; } if ( '' !== newval.mobile ) { dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += '.ast-mobile-popup-drawer.active .ast-mobile-popup-inner {'; dynamicStyle += 'max-width: ' + newval.mobile + '%;'; dynamicStyle += '} '; dynamicStyle += '} '; } astra_add_dynamic_css( 'off-canvas-width', dynamicStyle ); } ); } ); } )( jQuery ); builder/type/header/off-canvas/classes/class-astra-addon-offcanvas-component-loader.php 0000644 00000045012 15150261777 0025321 0 ustar 00 <?php /** * Button Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.3.0 */ class Astra_Addon_Offcanvas_Component_Loader { /** * Constructor * * @since 3.3.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_filter( 'astra_theme_dynamic_css', array( $this, 'dynamic_css' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Dynamic CSS for Toggle Button on desktop. * * @param string $dynamic_css Dynmamically generated CSS string. * * @since 3.3.0 * @return string $dynamic_css Appended dynamic CSS. */ public function dynamic_css( $dynamic_css ) { if ( Astra_Addon_Builder_Helper::is_component_loaded( 'mobile-trigger', 'header', 'desktop' ) || is_customize_preview() ) { $dynamic_css .= Astra_Enqueue_Scripts::trim_css( self::load_toggle_for_desktop_static_css() ); } return $dynamic_css; } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.3.0 */ public function theme_defaults( $defaults ) { $defaults['off-canvas-width'] = array( 'desktop' => 35, 'tablet' => 90, 'mobile' => 90, ); return $defaults; } /** * Load static Toggle for Desktop CSS. * * @since 3.3.0 * @return string static css for Toggle for Desktop. */ public static function load_toggle_for_desktop_static_css() { if ( false === Astra_Icons::is_svg_icons() ) { $toggle_for_desktop_static_css = '.ast-desktop-header-content .ast-builder-menu-mobile .main-navigation ul.sub-menu .menu-item .menu-link:before, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation ul.sub-menu .menu-item .menu-link:before { content: "\e900"; font-family: "Astra"; font-size: .65em; text-decoration: inherit; display: inline-block; transform: translate(0, -2px) rotateZ(270deg); margin-right: 5px; } .ast-desktop-header-content .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle::before { font-weight: bold; content: "\e900"; font-family: "Astra"; text-decoration: inherit; display: inline-block; }'; } else { $toggle_for_desktop_static_css = ' .ast-desktop-popup-content .menu-link > .menu-text + .icon-arrow, .ast-desktop-popup-content .menu-link > .dropdown-menu-toggle, .ast-desktop-header-content .menu-link > .menu-text + .icon-arrow, .ast-desktop-header-content .menu-link > .dropdown-menu-toggle { display: none; } .ast-desktop-popup-content .sub-menu .menu-link > .icon-arrow:first-of-type, .ast-desktop-header-content .sub-menu .menu-link > .icon-arrow:first-of-type { display: inline-block; margin-right: 5px; } .ast-desktop-popup-content .sub-menu .menu-link > .icon-arrow:first-of-type svg, .ast-desktop-header-content .sub-menu .menu-link > .icon-arrow:first-of-type svg { top: .2em; margin-top: 0px; margin-left: 0px; width: .65em; transform: translate(0,-2px) rotateZ( 270deg ); } .ast-desktop-popup-content .main-header-menu .sub-menu .menu-item:not(.menu-item-has-children) .menu-link .icon-arrow:first-of-type, .ast-desktop-header-content .main-header-menu .sub-menu .menu-item:not(.menu-item-has-children) .menu-link .icon-arrow:first-of-type { display: inline-block; } .ast-desktop-popup-content .ast-submenu-expanded > .ast-menu-toggle, .ast-desktop-header-content .ast-submenu-expanded > .ast-menu-toggle { transform: rotateX( 180deg ); } #ast-desktop-header .ast-desktop-header-content .main-header-menu .sub-menu .menu-item.menu-item-has-children > .menu-link .icon-arrow svg { position: relative; right: 0; top: 0; transform: translate(0, 0%) rotate( 270deg ); }'; } $toggle_for_desktop_static_css .= ' /** Toggle on Desktop Feature */ .ast-desktop-header-content .ast-builder-menu-mobile .ast-builder-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-builder-menu { width: 100%; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-main-header-bar-alignment, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-main-header-bar-alignment { display: block; width: 100%; flex: auto; order: 4; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation { width: 100%; margin: 0; line-height: 3; flex: auto; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation { display: block; width: 100%; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-flex.main-header-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-flex.main-header-menu { flex-wrap: wrap; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-menu { border-top-width: 1px; border-style: solid; border-color: var(--ast-border-color); } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation li.menu-item, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation li.menu-item { width: 100%; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation .menu-item .menu-link, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation .menu-item .menu-link { border-bottom-width: 1px; border-color: var(--ast-border-color); border-style: solid; } .ast-builder-menu-mobile .main-navigation ul .menu-item .menu-link, .ast-builder-menu-mobile .main-navigation ul .menu-item .menu-link { padding: 0 20px; display: inline-block; width: 100%; border: 0; border-bottom-width: 1px; border-style: solid; border-color: var(--ast-border-color); } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle { display: inline-block; position: absolute; font-size: inherit; top: 0px; right: 20px; cursor: pointer; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; padding: 0 0.907em; font-weight: normal; line-height: inherit; transition: all .2s; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children .sub-menu { display: none; } .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .toggled .menu-item-has-children .sub-menu { display: block; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-nav-menu .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-nav-menu .sub-menu { line-height: 3; } .ast-desktop-header-content .ast-builder-menu-mobile .submenu-with-border .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .submenu-with-border .sub-menu { border: 0; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-menu .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-menu .sub-menu { position: static; opacity: 1; visibility: visible; border: 0; width: auto; left: auto; right: auto; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .menu-link:after, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .menu-link:after { display: none; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-submenu-expanded.menu-item .sub-menu, .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .toggled .menu-item-has-children .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-submenu-expanded.menu-item .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .toggled .menu-item-has-children .sub-menu, .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .toggled .astra-full-megamenu-wrapper, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-submenu-expanded .astra-full-megamenu-wrapper { box-shadow: unset; opacity: 1; visibility: visible; transition: none; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .menu-link, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .menu-link { padding-left: 30px; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .sub-menu .menu-link, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .sub-menu .menu-link { padding-left: 40px; } .ast-desktop .main-header-menu > .menu-item .sub-menu:before, .ast-desktop .main-header-menu > .menu-item .astra-full-megamenu-wrapper:before { position: absolute; content: ""; top: 0; left: 0; width: 100%; transform: translateY(-100%); } .menu-toggle .ast-close-svg { display: none; } .menu-toggle.toggled .ast-mobile-svg { display: none; } .menu-toggle.toggled .ast-close-svg { display: block; } /** Desktop Off-Canvas CSS */ .ast-desktop .ast-mobile-popup-drawer .ast-mobile-popup-inner { max-width: 20%; } .ast-desktop .ast-mobile-popup-drawer.ast-mobile-popup-full-width .ast-mobile-popup-inner { width: 100%; max-width: 100%; } .ast-desktop .ast-mobile-popup-drawer .ast-mobile-popup-overlay { visibility: hidden; opacity: 0; } .ast-off-canvas-active body.ast-main-header-nav-open.ast-desktop { overflow: auto; } body.admin-bar.ast-desktop .ast-mobile-popup-drawer .ast-mobile-popup-inner { top: 32px; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-desktop-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-desktop-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { padding: 15px 20px; } .ast-header-break-point .main-navigation .menu-link { border: 0; }'; if ( is_rtl() ) { $toggle_for_desktop_static_css .= ' /** Toggle on Desktop Feature */ .ast-desktop-header-content .ast-builder-menu-mobile .ast-builder-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-builder-menu { width: 100%; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-main-header-bar-alignment, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-main-header-bar-alignment { display: block; width: 100%; flex: auto; order: 4; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation { width: 100%; margin: 0; line-height: 3; flex: auto; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation { display: block; width: 100%; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-flex.main-header-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-flex.main-header-menu { flex-wrap: wrap; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-menu { border-top-width: 1px; border-style: solid; border-color: var(--ast-border-color); } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation li.menu-item, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation li.menu-item { width: 100%; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation .menu-item .menu-link, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation .menu-item .menu-link { border-bottom-width: 1px; border-color: var(--ast-border-color); border-style: solid; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation ul .menu-item .menu-link, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation ul .menu-item .menu-link { padding: 0 20px; display: inline-block; width: 100%; border: 0; border-bottom-width: 1px; border-style: solid; border-color: var(--ast-border-color); } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle { display: inline-block; position: absolute; font-size: inherit; top: 0px; left: 20px; cursor: pointer; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; padding: 0 0.907em; font-weight: normal; line-height: inherit; transition: all .2s; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children .sub-menu { display: none; } .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .toggled .menu-item-has-children .sub-menu { display: block; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-nav-menu .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-nav-menu .sub-menu { line-height: 3; } .ast-desktop-header-content .ast-builder-menu-mobile .submenu-with-border .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .submenu-with-border .sub-menu { border: 0; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-menu .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-menu .sub-menu { position: static; opacity: 1; visibility: visible; border: 0; width: auto; right: auto; left: auto; } .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .menu-link:after, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .menu-item-has-children > .menu-link:after { display: none; } .ast-desktop-header-content .ast-builder-menu-mobile .ast-submenu-expanded.menu-item .sub-menu, .ast-desktop-header-content .ast-builder-menu-mobile .main-header-bar-navigation .toggled .menu-item-has-children .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .ast-submenu-expanded.menu-item .sub-menu, .ast-desktop-popup-content .ast-builder-menu-mobile .main-header-bar-navigation .toggled .menu-item-has-children .sub-menu { box-shadow: unset; opacity: 1; visibility: visible; transition: none; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .menu-link, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .menu-link { padding-right: 30px; } .ast-desktop-header-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .sub-menu .menu-link, .ast-desktop-popup-content .ast-builder-menu-mobile .main-navigation .sub-menu .menu-item .sub-menu .menu-link { padding-right: 40px; } .ast-desktop .main-header-menu > .menu-item .sub-menu:before, .ast-desktop .main-header-menu > .menu-item .astra-full-megamenu-wrapper:before { position: absolute; content: ""; top: 0; right: 0; width: 100%; transform: translateY(-100%); } .menu-toggle .ast-close-svg { display: none; } .menu-toggle.toggled .ast-mobile-svg { display: none; } .menu-toggle.toggled .ast-close-svg { display: block; } /** Desktop Off-Canvas CSS */ .ast-desktop .ast-mobile-popup-drawer .ast-mobile-popup-inner { max-width: 20%; } .ast-desktop .ast-mobile-popup-drawer.ast-mobile-popup-full-width .ast-mobile-popup-inner { width: 100%; max-width: 100%; } .ast-desktop .ast-mobile-popup-drawer .ast-mobile-popup-overlay { visibility: hidden; opacity: 0; } .ast-off-canvas-active body.ast-main-header-nav-open.ast-desktop { overflow: auto; } body.admin-bar.ast-desktop .ast-mobile-popup-drawer .ast-mobile-popup-inner { top: 32px; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-desktop-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-desktop-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { margin: 15px 20px; } .ast-header-break-point .main-navigation .menu-link { border: 0; }'; } return $toggle_for_desktop_static_css; } /** * Customizer Preview * * @since 3.3.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-addon-offcanvas-customizer-preview-js', ASTRA_ADDON_OFFCANVAS_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Addon_Offcanvas_Component_Loader(); builder/type/header/off-canvas/dynamic-css/dynamic.css.php 0000644 00000003730 15150261777 0017602 0 ustar 00 <?php /** * Off Canvas control - Dynamic CSS * * @package Astra Addon * @since 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Off Canvas Colors */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_offcanvas_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.3.0 */ function astra_addon_offcanvas_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $selector = '.ast-mobile-popup-drawer.active'; $popup_width = astra_get_option( 'off-canvas-width' ); $popup_width_desktop = ( isset( $popup_width['desktop'] ) && ! empty( $popup_width['desktop'] ) ) ? $popup_width['desktop'] : ''; $popup_width_tablet = ( isset( $popup_width['tablet'] ) && ! empty( $popup_width['tablet'] ) ) ? $popup_width['tablet'] : ''; $popup_width_mobile = ( isset( $popup_width['mobile'] ) && ! empty( $popup_width['mobile'] ) ) ? $popup_width['mobile'] : ''; $css_output = array(); $css_output_tablet = array(); $css_output_mobile = array(); if ( ! empty( $popup_width_desktop ) ) { $css_output[ '.ast-desktop ' . $selector . ' .ast-mobile-popup-inner' ]['max-width'] = $popup_width_desktop . '%'; } if ( ! empty( $popup_width_tablet ) ) { $css_output_tablet[ $selector . ' .ast-mobile-popup-inner' ]['max-width'] = $popup_width_tablet . '%'; } if ( ! empty( $popup_width_mobile ) ) { $css_output_mobile[ $selector . ' .ast-mobile-popup-inner' ]['max-width'] = $popup_width_mobile . '%'; } $css_output = astra_parse_css( $css_output ); $css_output .= astra_parse_css( $css_output_tablet, '', astra_addon_get_tablet_breakpoint() ); $css_output .= astra_parse_css( $css_output_mobile, '', astra_addon_get_mobile_breakpoint() ); $dynamic_css .= $css_output; return $dynamic_css; } builder/type/header/off-canvas/class-astra-addon-offcanvas-component.php 0000644 00000002241 15150261777 0022415 0 ustar 00 <?php /** * Off Canvas component. * * @package Astra Addon * @link https://www.brainstormforce.com * @since Astra 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_OFFCANVAS_DIR', ASTRA_EXT_DIR . 'classes/builder/type/header/off-canvas/' ); define( 'ASTRA_ADDON_OFFCANVAS_URI', ASTRA_EXT_URI . 'classes/builder/type/header/off-canvas/' ); /** * Heading Initial Setup * * @since 3.3.0 */ class Astra_Addon_Offcanvas_Component { /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_OFFCANVAS_DIR . 'classes/class-astra-addon-offcanvas-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_OFFCANVAS_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Addon_Offcanvas_Component(); builder/type/header/off-canvas/class-astra-addon-offcanvas-configs.php 0000644 00000003452 15150261777 0022050 0 ustar 00 <?php /** * Astra Addon Customizer Configuration Off Canvas. * * @package astra-addon * @link https://wpastra.com/ * @since 3.3.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Register Off Canvas Customizer Configurations. * * @since 3.3.0 */ class Astra_Addon_Offcanvas_Configs extends Astra_Customizer_Config_Base { /** * Register Builder Above Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.3.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $_section = 'section-popup-header-builder'; $_configs = array( /** * Option: Popup Width. */ array( 'name' => ASTRA_THEME_SETTINGS . '[off-canvas-width]', 'section' => $_section, 'priority' => 32, 'transport' => 'postMessage', 'default' => astra_get_option( 'off-canvas-width' ), 'title' => __( 'Popup Width ( % )', 'astra-addon' ), 'type' => 'control', 'control' => 'ast-responsive-slider', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 100, ), 'context' => array( astra_addon_builder_helper()->general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[mobile-header-type]', 'operator' => '==', 'value' => 'off-canvas', ), ), ), ); return array_merge( $configurations, $_configs ); } } /** * Kicking this off by creating object of this class. */ new Astra_Addon_Offcanvas_Configs(); builder/type/header/social-icon/assets/css/minified/style-rtl.min.css 0000644 00000001212 15150261777 0021723 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element{justify-content:center}.ast-header-divider-element{position:relative}.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal{width:100%}.ast-fb-divider-layout-vertical .ast-divider-layout-horizontal,.ast-fb-divider-layout-vertical .ast-divider-layout-vertical{position:absolute}.ast-hb-divider-layout-vertical.ast-header-divider-element{height:100%}.ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element),.ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element){margin:15px 20px} builder/type/header/social-icon/assets/css/minified/style.min.css 0000644 00000001212 15150261777 0021124 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element{justify-content:center}.ast-header-divider-element{position:relative}.ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal{width:100%}.ast-fb-divider-layout-vertical .ast-divider-layout-horizontal,.ast-fb-divider-layout-vertical .ast-divider-layout-vertical{position:absolute}.ast-hb-divider-layout-vertical.ast-header-divider-element{height:100%}.ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element),.ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element){margin:15px 20px} builder/type/header/social-icon/assets/css/unminified/style-rtl.css 0000644 00000001431 15150261777 0021507 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element { justify-content: center; } .ast-header-divider-element { position: relative; } .ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal { width: 100%; } .ast-fb-divider-layout-vertical .ast-divider-layout-vertical, .ast-fb-divider-layout-vertical .ast-divider-layout-horizontal { position: absolute; } .ast-hb-divider-layout-vertical.ast-header-divider-element { height: 100%; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { margin: 15px 20px; } builder/type/header/social-icon/assets/css/unminified/style.css 0000644 00000001431 15150261777 0020710 0 ustar 00 .ast-mobile-popup-content .ast-header-divider-element { justify-content: center; } .ast-header-divider-element { position: relative; } .ast-hb-divider-layout-horizontal .ast-divider-layout-horizontal { width: 100%; } .ast-fb-divider-layout-vertical .ast-divider-layout-vertical, .ast-fb-divider-layout-vertical .ast-divider-layout-horizontal { position: absolute; } .ast-hb-divider-layout-vertical.ast-header-divider-element { height: 100%; } /** Default Spacing for Mobile Header elements except Menu */ .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element), .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) { margin: 15px 20px; } builder/type/header/social-icon/assets/js/customizer-preview.js 0000644 00000000751 15150261777 0020760 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra Builder * @since x.x.x */ ( function( $ ) { astra_builder_addon_social_css( 'header', AstraBuilderSocialData.header_social_count ); } )( jQuery ); builder/type/header/social-icon/assets/scss/style.scss 0000644 00000000000 15150261777 0017116 0 ustar 00 builder/type/header/social-icon/classes/class-astra-header-social-component-loader.php 0000644 00000004175 15150261777 0025152 0 ustar 00 <?php /** * Social Styling Loader for Astra theme. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Header_Social_Component_Loader { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor * * @since 3.0.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Default customizer configs. * * @param array $defaults Astra options default value array. * * @since 3.0.0 */ public function theme_defaults( $defaults ) { $num_of_header_social_icons = astra_addon_builder_helper()->num_of_header_social_icons; // Divider header defaults. for ( $index = 1; $index <= $num_of_header_social_icons; $index++ ) { $defaults[ 'header-social-' . $index . '-stack' ] = 'none'; } return $defaults; } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-social-icon-addon-header-customizer-preview-js', ASTRA_ADDON_HEADER_SOCIAL_URI . '/assets/js/customizer-preview.js', array( 'customize-preview', 'ahfb-addon-base-customizer-preview' ), ASTRA_EXT_VER, true ); // Localize variables for divider JS. wp_localize_script( 'astra-social-icon-addon-header-customizer-preview-js', 'AstraBuilderSocialData', array( 'header_social_count' => astra_addon_builder_helper()->num_of_header_social_icons, ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Header_Social_Component_Loader(); builder/type/header/social-icon/dynamic-css/dynamic.css.php 0000644 00000001360 15150261777 0017754 0 ustar 00 <?php /** * Divider control - Dynamic CSS * * @package Astra Builder * @since 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Heading Colors */ add_filter( 'astra_dynamic_theme_css', 'astra_addon_header_social_dynamic_css' ); /** * Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Heading Colors. * * @since 3.0.0 */ function astra_addon_header_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $dynamic_css .= Astra_Social_Icon_Component_Dynamic_CSS::astra_social_dynamic_css( 'header' ); return $dynamic_css; } builder/type/header/social-icon/class-astra-header-social-component-configs.php 0000644 00000002447 15150261777 0023677 0 ustar 00 <?php /** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Builder Customizer Configurations. * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Header_Social_Component_Configs extends Astra_Customizer_Config_Base { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register Builder Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 3.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $configurations = Astra_Social_Component_Configs::register_configuration( $configurations, 'header', 'section-hb-social-icons-' ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Header_Social_Component_Configs(); builder/type/header/social-icon/class-astra-header-social-component.php 0000644 00000002477 15150261777 0022254 0 ustar 00 <?php /** * HTML component. * * @package Astra Builder * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_ADDON_HEADER_SOCIAL_DIR', ASTRA_EXT_DIR . 'classes/builder/type/header/social-icon/' ); define( 'ASTRA_ADDON_HEADER_SOCIAL_URI', ASTRA_EXT_URI . 'classes/builder/type/header/social-icon/' ); /** * Heading Initial Setup * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Header_Social_Component { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_ADDON_HEADER_SOCIAL_DIR . 'classes/class-astra-header-social-component-loader.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_ADDON_HEADER_SOCIAL_DIR . 'dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Header_Social_Component(); builder/class-astra-addon-builder-customizer.php 0000644 00000021253 15150261777 0016047 0 ustar 00 <?php /** * Astra Addon Builder Controller. * * @package astra-builder * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class Astra_Addon_Builder_Customizer. * * Customizer Configuration for Header Footer Builder. * * @since 3.0.0 */ final class Astra_Addon_Builder_Customizer { /** * Constructor * * @since 3.0.0 */ public function __construct() { add_action( 'customize_preview_init', array( $this, 'enqueue_customizer_preview_scripts' ) ); if ( false === astra_addon_builder_helper()->is_header_footer_builder_active ) { return; } add_action( 'astra_addon_get_css_files', array( $this, 'add_styles' ) ); $this->load_base_components(); add_action( 'customize_register', array( $this, 'header_configs' ), 5 ); add_action( 'customize_register', array( $this, 'footer_configs' ), 5 ); add_filter( 'astra_flags_svgs', array( $this, 'astra_addon_flag_svgs' ), 1, 10 ); } /** * Register Base Components for Builder. */ public function load_base_components() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound // Base Config Files. require_once ASTRA_EXT_DIR . 'classes/builder/type/base/configurations/class-astra-addon-base-configs.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/configurations/class-astra-divider-component-configs.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/configurations/class-astra-addon-button-component-configs.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/configurations/class-astra-social-component-configs.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/configurations/class-astra-language-switcher-component-configs.php'; // Base Dynamic CSS Files. require_once ASTRA_EXT_DIR . 'classes/builder/type/base/dynamic-css/divider/class-astra-divider-component-dynamic-css.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/dynamic-css/language-switcher/class-astra-language-switcher-component-dynamic-css.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/dynamic-css/social-icon/class-astra-social-icon-component-dynamic-css.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/dynamic-css/button/class-astra-addon-button-component-dynamic-css.php'; $this->load_header_components(); $this->load_footer_components(); // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Register controls for Header Builder. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * @since 3.0.0 */ public function header_configs( $wp_customize ) { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound $header_config_path = ASTRA_EXT_DIR . 'classes/builder/type/header'; require_once $header_config_path . '/divider/class-astra-header-divider-component-configs.php'; require_once $header_config_path . '/account/class-astra-ext-header-account-component-configs.php'; require_once $header_config_path . '/menu/class-astra-addon-header-menu-component-configs.php'; require_once $header_config_path . '/button/class-astra-addon-header-button-component-configs.php'; require_once $header_config_path . '/social-icon/class-astra-header-social-component-configs.php'; require_once $header_config_path . '/language-switcher/class-astra-header-language-switcher-configs.php'; require_once $header_config_path . '/off-canvas/class-astra-addon-offcanvas-configs.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Register controls for Footer Builder. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * @since 3.0.0 */ public function footer_configs( $wp_customize ) { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound $footer_config_path = ASTRA_EXT_DIR . 'classes/builder/type/footer'; require_once $footer_config_path . '/divider/class-astra-footer-divider-component-configs.php'; require_once $footer_config_path . '/button/class-astra-ext-footer-button-component-configs.php'; require_once $footer_config_path . '/social-icon/class-astra-footer-social-component-configs.php'; require_once $footer_config_path . '/language-switcher/class-astra-footer-language-switcher-configs.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Register Components for Header Builder. * * @since 3.0.0 */ public function load_header_components() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound $header_components_path = ASTRA_EXT_DIR . 'classes/builder/type/header'; if ( ! class_exists( 'Astra_Header_Divider_Component' ) ) { require_once $header_components_path . '/divider/class-astra-header-divider-component.php'; } require_once $header_components_path . '/button/class-astra-addon-header-button-component.php'; require_once $header_components_path . '/account/class-astra-ext-header-account-component.php'; require_once $header_components_path . '/menu/class-astra-addon-header-menu-component.php'; require_once $header_components_path . '/social-icon/class-astra-header-social-component.php'; require_once $header_components_path . '/language-switcher/class-astra-header-language-switcher-component.php'; require_once $header_components_path . '/off-canvas/class-astra-addon-offcanvas-component.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Register Components for Footer Builder. * * @since 3.0.0 */ public function load_footer_components() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound $footer_components_path = ASTRA_EXT_DIR . 'classes/builder/type/footer'; if ( ! class_exists( 'Astra_Footer_Divider_Component' ) ) { require_once $footer_components_path . '/divider/class-astra-footer-divider-component.php'; } require_once $footer_components_path . '/button/class-astra-ext-footer-button-component.php'; require_once $footer_components_path . '/social-icon/class-astra-footer-social-component.php'; require_once $footer_components_path . '/language-switcher/class-astra-footer-language-switcher-component.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Add Customizer preview script. * * @since 3.0.0 */ public function enqueue_customizer_preview_scripts() { // Base Dynamic CSS. wp_enqueue_script( 'ahfb-addon-base-customizer-preview', ASTRA_EXT_URI . 'classes/builder/type/base/assets/js/customizer-preview.js', array( 'customize-preview' ), ASTRA_EXT_VER, true ); // Localize variables for Astra Breakpoints JS. wp_localize_script( 'ahfb-addon-base-customizer-preview', 'astraBuilderPreview', array( 'tablet_break_point' => astra_addon_get_tablet_breakpoint(), 'mobile_break_point' => astra_addon_get_mobile_breakpoint(), ) ); } /** * Add Styles Callback * * @since 3.1.0 */ public function add_styles() { /*** Start Path Logic */ /* Define Variables */ $uri = ASTRA_EXT_URI . 'classes/builder/assets/css/'; $path = ASTRA_EXT_DIR . 'classes/builder/assets/css/'; $rtl = ''; if ( is_rtl() ) { $rtl = '-rtl'; } /* Directory and Extension */ $file_prefix = $rtl . '.min'; $dir_name = 'minified'; if ( SCRIPT_DEBUG ) { $file_prefix = $rtl; $dir_name = 'unminified'; } $css_uri = $uri . $dir_name . '/'; $css_dir = $path . $dir_name . '/'; if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) { $gen_path = $css_uri; } else { $gen_path = $css_dir; } /*** End Path Logic */ /* Add style.css */ Astra_Minify::add_css( $gen_path . 'style' . $file_prefix . '.css' ); } /** * Load Flags SVG Icon array from the JSON file. * * @param Array $svg_arr Array of svg icons. * @since 3.1.0 * @return Array addon svg icons. */ public function astra_addon_flag_svgs( $svg_arr = array() ) { ob_start(); // Include SVGs Json file. include_once ASTRA_EXT_DIR . 'assets/flags/svgs.json'; $svg_icon_arr = json_decode( ob_get_clean(), true ); $ast_flag_svgs = array_merge( $svg_arr, $svg_icon_arr ); return $ast_flag_svgs; } } /** * Prepare if class 'Astra_Addon_Builder_Customizer' exist. * Kicking this off by creating new object of the class. */ new Astra_Addon_Builder_Customizer(); builder/class-astra-addon-builder-helper.php 0000644 00000021123 15150261777 0015116 0 ustar 00 <?php /** * Astra Addon Builder Helper. * * @since 3.0.0 * @package astra-builder */ /** * Class Astra_Addon_Builder_Helper. * * @since 3.0.0 */ final class Astra_Addon_Builder_Helper { /** * Member Variable * * @since 3.0.0 * @var instance */ private static $instance = null; /** * Cached Helper Variable. * * @since 3.0.0 * @var instance */ private static $cached_properties = null; /** * No. Of. Component count array. * * @var int */ public static $component_count_array = array(); /** * No. Of. Component Limit. * * @var int */ public static $component_limit = 10; /** * No. Of. Header Dividers. * * @since 3.0.0 * @var int */ public static $num_of_header_divider; /** * No. Of. Footer Dividers. * * @since 3.0.0 * @var int */ public static $num_of_footer_divider; /** * Initiator * * @since 3.0.0 */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor * * @since 3.0.0 */ public function __construct() { add_filter( 'astra_builder_elements_count', __CLASS__ . '::elements_count', 10 ); $component_count_by_key = self::elements_count(); self::$num_of_header_divider = $component_count_by_key['header-divider']; self::$num_of_footer_divider = $component_count_by_key['footer-divider']; } /** * Update the count of elements in HF Builder. * * @param array $elements array of elements having key as slug and value as count. * @return array $elements */ public static function elements_count( $elements = array() ) { $db_elements = get_option( 'astra-settings' ); $db_elements = isset( $db_elements['cloned-component-track'] ) ? $db_elements['cloned-component-track'] : array(); if ( ! empty( $db_elements ) ) { return $db_elements; } $elements['header-button'] = 2; $elements['footer-button'] = 2; $elements['header-html'] = 3; $elements['footer-html'] = 2; $elements['header-menu'] = 3; $elements['header-widget'] = 4; $elements['footer-widget'] = 6; $elements['header-social-icons'] = 1; $elements['footer-social-icons'] = 1; $elements['header-divider'] = 3; $elements['footer-divider'] = 3; $elements['removed-items'] = array(); return $elements; } /** * Callback of external properties. * * @param string $property_name property name. * @return false */ public function __get( $property_name ) { if ( isset( self::$cached_properties[ $property_name ] ) ) { return self::$cached_properties[ $property_name ]; } if ( property_exists( 'Astra_Addon_Builder_Helper', $property_name ) ) { // Directly override theme helper properties. $return_value = self::astra_addon_get_addon_helper_static( $property_name ); } else { $return_value = property_exists( 'Astra_Builder_Helper', $property_name ) ? self::astra_addon_get_theme_helper_static( $property_name ) : false; } self::$cached_properties[ $property_name ] = $return_value; return $return_value; } /** * Callback to get theme's static property. * * @param string $prop_name function name. * @return mixed */ public static function astra_addon_get_theme_helper_static( $prop_name ) { $theme_static_sets = array( 'general_tab' => Astra_Builder_Helper::$general_tab, 'general_tab_config' => Astra_Builder_Helper::$general_tab_config, 'design_tab' => Astra_Builder_Helper::$design_tab, 'design_tab_config' => Astra_Builder_Helper::$design_tab_config, 'tablet_device' => Astra_Builder_Helper::$tablet_device, 'mobile_device' => Astra_Builder_Helper::$mobile_device, 'responsive_devices' => Astra_Builder_Helper::$responsive_devices, 'responsive_general_tab' => Astra_Builder_Helper::$responsive_general_tab, 'desktop_general_tab' => Astra_Builder_Helper::$desktop_general_tab, 'default_responsive_spacing' => Astra_Builder_Helper::$default_responsive_spacing, 'default_button_responsive_spacing' => isset( Astra_Builder_Helper::$default_button_responsive_spacing ) ? Astra_Builder_Helper::$default_button_responsive_spacing : Astra_Builder_Helper::$default_responsive_spacing, 'tablet_general_tab' => Astra_Builder_Helper::$tablet_general_tab, 'mobile_general_tab' => Astra_Builder_Helper::$mobile_general_tab, 'component_limit' => Astra_Builder_Helper::$component_limit, 'component_count_array' => Astra_Builder_Helper::$component_count_array, 'num_of_footer_widgets' => Astra_Builder_Helper::$num_of_footer_widgets, 'num_of_footer_html' => Astra_Builder_Helper::$num_of_footer_html, 'num_of_header_widgets' => Astra_Builder_Helper::$num_of_header_widgets, 'num_of_header_menu' => Astra_Builder_Helper::$num_of_header_menu, 'num_of_header_button' => Astra_Builder_Helper::$num_of_header_button, 'num_of_footer_button' => Astra_Builder_Helper::$num_of_footer_button, 'num_of_header_html' => Astra_Builder_Helper::$num_of_header_html, 'num_of_footer_columns' => Astra_Builder_Helper::$num_of_footer_columns, 'num_of_header_social_icons' => Astra_Builder_Helper::$num_of_header_social_icons, 'num_of_footer_social_icons' => Astra_Builder_Helper::$num_of_footer_social_icons, 'num_of_header_divider' => Astra_Builder_Helper::$num_of_header_divider, 'num_of_footer_divider' => Astra_Builder_Helper::$num_of_footer_divider, 'is_header_footer_builder_active' => Astra_Builder_Helper::$is_header_footer_builder_active, 'footer_row_layouts' => Astra_Builder_Helper::$footer_row_layouts, 'header_desktop_items' => Astra_Builder_Helper::$header_desktop_items, 'footer_desktop_items' => Astra_Builder_Helper::$footer_desktop_items, 'header_mobile_items' => Astra_Builder_Helper::$header_mobile_items, 'loaded_grid' => Astra_Builder_Helper::$loaded_grid, 'grid_size_mapping' => Astra_Builder_Helper::$grid_size_mapping, ); return isset( $theme_static_sets[ $prop_name ] ) ? $theme_static_sets[ $prop_name ] : $prop_name; } /** * Callback to get addon's static property. * * @param string $prop_name function name. * @return mixed */ public static function astra_addon_get_addon_helper_static( $prop_name ) { $addon_static_sets = array( 'component_count_array' => self::$component_count_array, 'component_limit' => self::$component_limit, 'num_of_header_divider' => self::$num_of_header_divider, 'num_of_footer_divider' => self::$num_of_footer_divider, ); return isset( $addon_static_sets[ $prop_name ] ) ? $addon_static_sets[ $prop_name ] : $prop_name; } /** * Callback exception for static methods. * * @param string $function_name function name. * @param array $function_agrs function arguments. * @return false|mixed */ public static function __callStatic( $function_name, $function_agrs ) { $key = md5( $function_name ) . md5( maybe_serialize( $function_agrs ) ); if ( isset( self::$cached_properties[ $key ] ) ) { return self::$cached_properties[ $key ]; } if ( method_exists( 'Astra_Addon_Builder_Helper', $function_name ) ) { // Check if self method exists. $class_name = 'Astra_Addon_Builder_Helper'; } elseif ( method_exists( 'Astra_Builder_Helper', $function_name ) ) { // if self method doesnot exists then check for theme helper. $class_name = 'Astra_Builder_Helper'; } else { // If not found anything then return false directly. return false; } $return_value = call_user_func_array( array( $class_name, $function_name ), $function_agrs ); self::$cached_properties[ $key ] = $return_value; return $return_value; } } /** * Prepare if class 'Astra_Addon_Builder_Helper' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Addon_Builder_Helper::get_instance(); /** * Get instance to call properties and methods. * * @return Astra_Addon_Builder_Helper|instance|null */ function astra_addon_builder_helper() { return Astra_Addon_Builder_Helper::get_instance(); } cache/class-astra-addon-cache.php 0000644 00000005643 15150261777 0012704 0 ustar 00 <?php /** * Astra Addon Cache * * @package Astra * @link https://www.brainstormforce.com * @since Astra 2.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } // bail if Astra Cache is not available. if ( ! class_exists( 'Astra_Cache_Base' ) ) { return; } /** * Astra_Addon_Cache */ class Astra_Addon_Cache extends Astra_Cache_Base { /** * Member Variable * * @var array instance */ private static $dynamic_css_files = array(); /** * Cache directory. * * @since 2.1.0 * @var String */ private $cache_dir; /** * Constructor * * @since 2.1.0 * @param String $cache_dir Base cache directory in the uploads directory. */ public function __construct( $cache_dir ) { $this->cache_dir = $cache_dir; $this->asset_priority = 10; parent::__construct( $cache_dir ); // Triggers on click on refresh/ recheck button. add_action( 'wp_ajax_astra_refresh_assets_files', array( $this, 'addon_refresh_assets' ) ); add_action( 'save_post', array( $this, 'astra_refresh_assets' ) ); add_action( 'post_updated', array( $this, 'astra_refresh_assets' ) ); add_action( 'customize_save', array( $this, 'astra_refresh_assets' ) ); } /** * Create an array of all the files that needs to be merged in dynamic CSS file. * * @since 2.1.0 * @param array $file file path. * @return void */ public static function add_css_file( $file ) { self::$dynamic_css_files = array_merge( self::$dynamic_css_files, $file ); } /** * Get dynamic CSS * * @since 2.1.0 * @return String Dynamic CSS */ protected function get_dynamic_css() { $astra_addon_css_data = apply_filters( 'astra_addon_dynamic_css', '' ); $astra_addon_css_data .= $this->get_css_from_files( self::$dynamic_css_files ); return Astra_Enqueue_Scripts::trim_css( $astra_addon_css_data ); } /** * Fetch theme CSS data to be added in the dynamic CSS file. * * @since 2.1.0 * @return void */ public function setup_cache() { $assets_info = $this->get_asset_info( 'addon' ); if ( array_key_exists( 'path', $assets_info ) && ! file_exists( $assets_info['path'] ) && ! self::inline_assets() ) { $astra_addon_css_data = $this->get_dynamic_css(); // Return if there is no data to add in the css file. if ( empty( $astra_addon_css_data ) ) { return; } $this->write_assets( $astra_addon_css_data, 'addon' ); } // Call enqueue styles function. $this->enqueue_styles( 'addon' ); } /** * Refresh Assets. * * @since 2.1.0 * @return void */ public function astra_refresh_assets() { parent::refresh_assets( $this->cache_dir ); } /** * Refresh Assets, called through ajax * * @since 2.1.0 * @return void */ public function addon_refresh_assets() { parent::ajax_refresh_assets( $this->cache_dir ); } } new Astra_Addon_Cache( 'astra-addon' ); cache/class-astra-cache-base.php 0000644 00000031774 15150261777 0012535 0 ustar 00 <?php /** * Astra Cache * * @package Astra * @link https://www.brainstormforce.com * @since Astra 2.1.0 */ /** * Class Astra_Cache_Base. */ // @codingStandardsIgnoreStart class Astra_Cache_Base { // @codingStandardsIgnoreEnd /** * Member Variable * * @var array instance */ private static $dynamic_css_files = array(); /** * Asset slug for filename. * * @since 2.1.0 * @var string */ private $asset_slug = ''; /** * Check if we are on a single or archive query page. * * @since 2.1.0 * @var string */ private $asset_query_var = ''; /** * Asset Type - archive/post * * @since 2.1.0 * @var string */ private $asset_type = ''; /** * Uploads directory. * * @since 2.1.0 * @var array */ private $uploads_dir = array(); /** * Cache directory from uploads folder. * * @since 2.1.0 * @var String */ private $cache_dir; /** * Set priority for add_action call for action `wp_enqueue_scripts` * * @since 2.1.0 * @var string */ protected $asset_priority = ''; /** * Constructor * * @since 2.1.0 * @param String $cache_dir Base cache directory in the uploads directory. */ public function __construct( $cache_dir ) { if ( true === is_admin() ) { return false; } $this->cache_dir = $cache_dir; add_action( 'wp', array( $this, 'init_cache' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'setup_cache' ), $this->asset_priority ); } /** * Setup class variables. * * @since 2.1.0 * @return void */ public function init_cache() { $this->asset_type = $this->asset_type(); $this->asset_query_var = $this->asset_query_var(); $this->asset_slug = $this->asset_slug(); $this->uploads_dir = astra_addon_filesystem()->get_uploads_dir( $this->cache_dir ); // Create uploads directory. astra_addon_filesystem()->maybe_create_uploads_dir( $this->uploads_dir['path'] ); } /** * Get Current query type. single|archive. * * @since 2.1.0 * @return String */ private function asset_query_var() { if ( 'post' === $this->asset_type || 'home' === $this->asset_type || 'frontpage' === $this->asset_type ) { $slug = 'single'; } else { $slug = 'archive'; } return apply_filters( 'astra_addon_cache_asset_query_var', $slug ); } /** * Get current asset slug. * * @since 2.1.0 * @return String */ private function asset_slug() { if ( 'home' === $this->asset_type || 'frontpage' === $this->asset_type ) { return $this->asset_type; } else { return $this->asset_type . $this->cache_key_suffix(); } } /** * Append queried object ID to cache if it is not `0` * * @since 2.1.0 * @return Mixed queried object id if that is not 0; else false. */ private function cache_key_suffix() { return get_queried_object_id() !== 0 ? '-' . get_queried_object_id() : false; } /** * Get the archive title. * * @since 2.1.0 * @return $title Returns the archive title. */ private function asset_type() { $title = 'post'; if ( is_category() ) { $title = 'category'; } elseif ( is_tag() ) { $title = 'tag'; } elseif ( is_author() ) { $title = 'author'; } elseif ( is_year() ) { $title = 'year-' . get_query_var( 'year' ); } elseif ( is_month() ) { $title = 'month-' . get_query_var( 'monthnum' ); } elseif ( is_day() ) { $title = 'day-' . get_query_var( 'day' ); } elseif ( is_tax( 'post_format' ) ) { if ( is_tax( 'post_format', 'post-format-aside' ) ) { $title = 'asides'; } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { $title = 'galleries'; } elseif ( is_tax( 'post_format', 'post-format-image' ) ) { $title = 'images'; } elseif ( is_tax( 'post_format', 'post-format-video' ) ) { $title = 'videos'; } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) { $title = 'quotes'; } elseif ( is_tax( 'post_format', 'post-format-link' ) ) { $title = 'links'; } elseif ( is_tax( 'post_format', 'post-format-status' ) ) { $title = 'statuses'; } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) { $title = 'audio'; } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { $title = 'chats'; } } elseif ( is_post_type_archive() ) { $title = 'archives'; } elseif ( is_tax() ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); $title = sanitize_key( $tax->name ); } if ( is_search() ) { $title = 'search'; } if ( is_404() ) { $title = '404'; } if ( is_front_page() ) { $title = 'post'; } if ( is_home() ) { $title = 'home'; } return apply_filters( 'astra_addon_cache_asset_type', $title ); } /** * Create an array of all the files that needs to be merged in dynamic CSS file. * * @since 2.1.0 * @param array $file file path. * @return void */ public static function add_css_file( $file ) {} /** * Append CSS style to the theme dynamic css. * * @since 2.1.0 * @param Array $dynamic_css_files Array of file paths to be to be added to minify cache. * @return String CSS from the CSS files passed. */ public function get_css_from_files( $dynamic_css_files ) { $dynamic_css_data = ''; foreach ( $dynamic_css_files as $key => $value ) { // Get file contents. $get_contents = astra_addon_filesystem()->get_contents( $value ); if ( $get_contents ) { $dynamic_css_data .= $get_contents; } } return $dynamic_css_data; } /** * Refresh Assets, called through ajax * * @since 2.1.0 * @param String $cache_dir dirname of the cache. * @return void */ public function ajax_refresh_assets( $cache_dir ) { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die(); } check_ajax_referer( 'astra_addon_update_admin_setting', 'security' ); $this->init_cache(); astra_addon_filesystem()->reset_filesystem_access_status(); $this->delete_cache_files( $cache_dir ); } /** * Refresh Assets * * @since 2.1.0 * @param String $cache_dir dirname of the cache. * @return void */ public function refresh_assets( $cache_dir ) { if ( ! current_user_can( 'edit_theme_options' ) ) { return; } $this->init_cache(); astra_addon_filesystem()->reset_filesystem_access_status(); $this->delete_cache_files( $cache_dir ); } /** * Deletes cache files * * @since 2.1.0 * @param String $cache_dir dirname of the cache. * @return void */ private function delete_cache_files( $cache_dir ) { $cache_dir = astra_addon_filesystem()->get_uploads_dir( $cache_dir ); $cache_files = astra_addon_filesystem()->get_filesystem()->dirlist( $cache_dir['path'], false, true ); if ( is_array( $cache_files ) ) { foreach ( $cache_files as $file ) { // don't delete index.php file. if ( 'index.php' === $file['name'] ) { continue; } // Delete only dynamic CSS files. if ( false === strpos( $file['name'], 'dynamic-css' ) ) { continue; } astra_addon_filesystem()->delete( trailingslashit( $cache_dir['path'] ) . $file['name'], true, 'f' ); } } } /** * Fetch theme CSS data to be added in the dynamic CSS file. * * @since 2.1.0 * @return void */ public function setup_cache() {} /** * Write dynamic asset files. * * @param String $style_data Dynamic CSS. * @param String $type Asset type. * @return void */ protected function write_assets( $style_data, $type ) { $allow_file_generation = get_option( '_astra_file_generation', 'disable' ); if ( 'disable' === $allow_file_generation || is_customize_preview() ) { return; } $assets_info = $this->get_asset_info( $type ); $post_timestamp = $this->get_post_timestamp( $assets_info ); // Check if we need to create a new file or override the current file. if ( ! empty( $style_data ) && true === $post_timestamp['create_new_file'] ) { $this->file_write( $style_data, $post_timestamp['timestamp'], $assets_info ); } } /** * Get Dynamic CSS. * * @since 2.1.0 * @return void */ protected function get_dynamic_css() { } /** * Enqueue CSS files. * * @param string $type Gets the type theme/addon. * @since 2.1.0 * @return void */ public function enqueue_styles( $type ) { if ( self::inline_assets() ) { wp_add_inline_style( 'astra-' . $type . '-css', $this->get_dynamic_css() ); } else { $assets_info = $this->get_asset_info( $type ); $post_timestamp = $this->get_post_timestamp( $assets_info ); if ( isset( $this->uploads_dir['url'] ) ) { wp_enqueue_style( 'astra-' . $type . '-dynamic', $this->uploads_dir['url'] . 'astra-' . $type . '-dynamic-css-' . $this->asset_slug . '.css', array( 'astra-' . $type . '-css' ), $post_timestamp['timestamp'] ); } } } /** * Enqueue the assets inline. * * @since 2.1.0 * @return boolean */ public static function inline_assets() { $inline = false; $allow_file_generation = get_option( '_astra_file_generation', 'disable' ); if ( ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || ! astra_addon_filesystem()->can_access_filesystem() || 'disable' === $allow_file_generation || is_customize_preview() ) { $inline = true; } return apply_filters( 'astra_addon_load_dynamic_css_inline', $inline ); } /** * Returns the current Post Meta/ Option Timestamp. * * @since 2.1.0 * @param string $assets_info Gets the assets path info. * @return array $timestamp_data. */ public function get_post_timestamp( $assets_info ) { // Check if current page is a post/ archive page. false states that the current page is a post. if ( 'single' === $this->asset_query_var ) { $post_timestamp = get_post_meta( get_the_ID(), 'astra_style_timestamp_css', true ); } else { $post_timestamp = get_option( 'astra_get_dynamic_css' ); } $timestamp_data = $this->maybe_get_new_timestamp( $post_timestamp, $assets_info ); return $timestamp_data; } /** * Gets the current timestamp. * * @since 2.1.0 * @return string $timestamp Timestamp. */ private function get_current_timestamp() { $date = new DateTime(); $timestamp = $date->getTimestamp(); return $timestamp; } /** * Returns the current Post Meta/ Option Timestamp or creates a new timestamp. * * @since 2.1.0 * @param string $post_timestamp Timestamp of the post meta/ option. * @param string $assets_info Gets the assets path info. * @return array $data. */ public function maybe_get_new_timestamp( $post_timestamp, $assets_info ) { // Creates a new timestamp if the file does not exists or the timestamp is empty. // If post_timestamp is empty that means it is an new post or the post is updated and a new file needs to be created. // If a file does not exists then we need to create a new file. if ( '' == $post_timestamp || ! file_exists( $assets_info['path'] ) ) { $timestamp = $this->get_current_timestamp(); $data = array( 'create_new_file' => true, 'timestamp' => $timestamp, ); } else { $timestamp = $post_timestamp; $data = array( 'create_new_file' => false, 'timestamp' => $timestamp, ); } return $data; } /** * Returns an array of paths for the CSS assets * of the current post. * * @param string $type Gets the type theme/addon. * @since 2.1.0 * @return array */ public function get_asset_info( $type ) { $css_suffix = 'astra-' . $type . '-dynamic-css'; $css_suffix = 'astra-' . $type . '-dynamic-css'; $info = array(); if ( ! isset( $this->uploads_dir['path'] ) || ! isset( $this->uploads_dir['url'] ) ) { return $info; } $info['path'] = $this->uploads_dir['path'] . $css_suffix . '-' . $this->asset_slug . '.css'; $info['css_url'] = $this->uploads_dir['url'] . $css_suffix . '-' . $this->asset_slug . '.css'; return $info; } /** * Updates the Post Meta/ Option Timestamp. * * @param string $timestamp Gets the current timestamp. * @since 2.1.0 * @return void */ public function update_timestamp( $timestamp ) { // Check if current page is a post/ archive page. false states that the current page is a post. if ( 'single' === $this->asset_query_var ) { update_post_meta( get_the_ID(), 'astra_style_timestamp_css', $timestamp ); } else { update_option( 'astra_get_dynamic_css', $timestamp ); } } /** * Creates CSS files. * * @param string $style_data Gets the CSS for the current Page. * @param string $timestamp Gets the current timestamp. * @param string $assets_info Gets the assets path info. * @since 2.1.0 * @return void */ public function file_write( $style_data, $timestamp, $assets_info ) { astra_addon_filesystem()->put_contents( $assets_info['path'], $style_data ); $this->update_timestamp( $timestamp ); } } cache/class-astra-cache.php 0000644 00000005672 15150261777 0011623 0 ustar 00 <?php /** * Astra Addon Cache * * @package Astra * @link https://www.brainstormforce.com * @since Astra 2.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Astra_Cache */ // @codingStandardsIgnoreStart class Astra_Cache extends Astra_Cache_Base { // @codingStandardsIgnoreEnd /** * Member Variable * * @var array instance */ private static $dynamic_css_files = array(); /** * Cache directory. * * @since 2.1.0 * @var String */ private $cache_dir; /** * Constructor * * @since 2.1.0 * @param String $cache_dir Base cache directory in the uploads directory. */ public function __construct( $cache_dir ) { $this->cache_dir = $cache_dir; $this->asset_priority = 2; parent::__construct( $cache_dir ); // Triggers on click on refresh/ recheck button. add_action( 'wp_ajax_astra_refresh_assets_files', array( $this, 'addon_refresh_assets' ) ); add_action( 'save_post', array( $this, 'astra_refresh_assets' ) ); add_action( 'post_updated', array( $this, 'astra_refresh_assets' ) ); add_action( 'customize_save', array( $this, 'astra_refresh_assets' ) ); } /** * Create an array of all the files that needs to be merged in dynamic CSS file. * * @since 2.1.0 * @param array $file file path. * @return void */ public static function add_css_file( $file ) { self::$dynamic_css_files[] = $file; } /** * Get dynamic CSS * * @since 2.1.0 * @return String Dynamic CSS */ protected function get_dynamic_css() { $theme_css_data = apply_filters( 'astra_dynamic_theme_css', '' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $theme_css_data .= $this->get_css_from_files( self::$dynamic_css_files ); return Astra_Enqueue_Scripts::trim_css( $theme_css_data ); } /** * Fetch theme CSS data to be added in the dynamic CSS file. * * @since 2.1.0 * @return void */ public function setup_cache() { $assets_info = $this->get_asset_info( 'theme' ); if ( array_key_exists( 'path', $assets_info ) && ! file_exists( $assets_info['path'] ) && ! self::inline_assets() ) { $theme_css_data = $this->get_dynamic_css(); // Return if there is no data to add in the css file. if ( empty( $theme_css_data ) ) { return; } $this->write_assets( $theme_css_data, 'theme' ); } if ( true === Astra_Enqueue_Scripts::enqueue_theme_assets() ) { // Call enqueue styles function. $this->enqueue_styles( 'theme' ); } } /** * Refresh Assets. * * @since 2.1.0 * @return void */ public function astra_refresh_assets() { parent::refresh_assets( $this->cache_dir ); } /** * Refresh Assets, called through ajax * * @since 2.1.0 * @return void */ public function addon_refresh_assets() { parent::ajax_refresh_assets( $this->cache_dir ); } } new Astra_Cache( 'astra' ); compatibility/class-astra-addon-amp-compatibility.php 0000644 00000016127 15150261777 0017072 0 ustar 00 <?php /** * AMP Compatibility. * * @package Astra Addon * @since 1.7.0 */ /** * Customizer Initialization * * @since 1.7.0 */ class Astra_Addon_AMP_Compatibility { /** * Constructor */ public function __construct() { add_action( 'wp', array( $this, 'disable_addon_features' ) ); } /** * Disable features from Astra Pro when AMP endpoint is enabled. * * @return void */ public function disable_addon_features() { // If AMP endpoint is not active, bail as we don't need to change anything here. if ( true !== astra_addon_is_amp_endpoint() ) { return; } // Bail if AMP support is disabled by the user. if ( false === apply_filters( 'astra_amp_support', true ) ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return; } add_filter( 'astra_addon_cache_asset_type', array( $this, 'cache_add_amp_prefix' ) ); if ( is_callable( 'Astra_Minify::get_instance' ) ) { // Prioritize Astra Addon's CSS in AMP layouts. remove_action( 'wp_enqueue_scripts', array( Astra_Minify::get_instance(), 'enqueue_scripts' ) ); add_action( 'wp_enqueue_scripts', array( Astra_Minify::get_instance(), 'enqueue_scripts' ), 7 ); } // Sticky Header. if ( true === Astra_Ext_Extension::is_active( 'sticky-header' ) && is_callable( 'Astra_Ext_Sticky_Header_Markup::get_instance' ) ) { remove_action( 'astra_addon_get_css_files', array( Astra_Ext_Sticky_Header_Markup::get_instance(), 'add_styles' ) ); remove_action( 'astra_addon_get_js_files', array( Astra_Ext_Sticky_Header_Markup::get_instance(), 'add_scripts' ) ); remove_filter( 'astra_addon_js_localize', array( Astra_Ext_Sticky_Header_Markup::get_instance(), 'localize_variables' ) ); remove_action( 'body_class', array( Astra_Ext_Sticky_Header_Markup::get_instance(), 'add_body_class' ) ); remove_action( 'astra_header', array( Astra_Ext_Sticky_Header_Markup::get_instance(), 'none_header_markup' ), 5 ); remove_action( 'astra_header', array( Astra_Ext_Sticky_Header_Markup::get_instance(), 'fixed_header_markup' ), 11 ); remove_filter( 'astra_addon_dynamic_css', 'astra_ext_sticky_header_dynamic_css', 30 ); remove_filter( 'astra_addon_dynamic_css', 'astra_ext_above_header_sections_dynamic_css', 30 ); remove_filter( 'astra_addon_dynamic_css', 'astra_ext_below_header_sections_dynamic_css', 30 ); remove_filter( 'astra_addon_dynamic_css', 'astra_ext_sticky_header_with_site_layouts_dynamic_css' ); } // Nav Menu Addon. if ( true === Astra_Ext_Extension::is_active( 'nav-menu' ) && is_callable( 'Astra_Ext_Nav_Menu_Loader::get_instance' ) ) { remove_action( 'astra_addon_get_css_files', array( Astra_Ext_Nav_Menu_Loader::get_instance(), 'add_styles' ) ); remove_filter( 'wp_nav_menu_args', array( Astra_Ext_Nav_Menu_Loader::get_instance(), 'modify_nav_menu_args' ) ); remove_filter( 'astra_addon_dynamic_css', 'astra_addon_mega_menu_dynamic_css' ); } // Page Header Addon. if ( true === Astra_Ext_Extension::is_active( 'advanced-headers' ) && is_callable( 'Astra_Ext_Advanced_Headers_Markup::get_instance' ) ) { remove_action( 'wp_enqueue_scripts', array( Astra_Ext_Advanced_Headers_Markup::get_instance(), 'add_scripts' ), 9 ); add_action( 'wp_enqueue_scripts', array( Astra_Ext_Advanced_Headers_Markup::get_instance(), 'add_scripts' ), 6 ); } // Blog Pro Addon. if ( true === Astra_Ext_Extension::is_active( 'blog-pro' ) && is_callable( 'Astra_Ext_Blog_Pro_Markup::get_instance' ) ) { // Remove Auto Load Previous Posts option. remove_action( 'init', array( Astra_Ext_Blog_Pro_Markup::get_instance(), 'init_action' ) ); add_filter( 'astra_get_option_ast-auto-prev-post', '__return_false' ); // Remove Infinite Scroll option. remove_filter( 'astra_theme_js_localize', array( Astra_Ext_Blog_Pro_Markup::get_instance(), 'blog_js_localize' ) ); remove_filter( 'astra_pagination_markup', array( Astra_Ext_Blog_Pro_Markup::get_instance(), 'astra_blog_pagination' ) ); add_filter( 'astra_get_option_blog-pagination', array( $this, 'return_number_pagination' ) ); } if ( true === Astra_Ext_Extension::is_active( 'advanced-search' ) ) { add_filter( 'astra_get_option_header-main-rt-section-search-box-type', array( $this, 'return_slide_search' ) ); } if ( true === Astra_Ext_Extension::is_active( 'header-sections' ) ) { add_filter( 'astra_get_option_above-header-layout', array( $this, 'return_disabled' ) ); add_filter( 'astra_get_option_below-header-layout', array( $this, 'return_disabled' ) ); } if ( true === Astra_Ext_Extension::is_active( 'mobile-header' ) ) { add_filter( 'astra_get_option_mobile-menu-style', array( $this, 'return_default' ) ); } if ( true === Astra_Ext_Extension::is_active( 'colors-and-background' ) ) { add_filter( 'astra_addon_colors_dynamic_css_desktop', array( $this, 'css_replace_breakpoint_to_amp' ) ); add_filter( 'astra_addon_colors_dynamic_css_tablet', array( $this, 'css_replace_breakpoint_to_amp' ) ); add_filter( 'astra_addon_colors_dynamic_css_mobile', array( $this, 'css_replace_breakpoint_to_amp' ) ); } add_filter( 'astra_addon_render_custom_layout_content', array( $this, 'custom_layout_disable_on_amp' ), 10, 2 ); } /** * Add prefix to Assets cache key if on AMP endpoint. * * @param String $asset_type Asset type. * @return String Asset type with AMP Prefix. */ public function cache_add_amp_prefix( $asset_type ) { return 'amp-' . $asset_type; } /** * Disable Custom Layout on frontend if it is disabled on AMP. * * @since 1.7.0 * @param boolean $status Status true if layout is tobe displayed on the frontend. False is it should not be rendered. * @param int $post_id Post ID which is to be rendered from the Custom Layout. * @return boolean. */ public function custom_layout_disable_on_amp( $status, $post_id ) { $amp_status = get_post_meta( $post_id, 'amp_status', true ); if ( 'enabled' === $amp_status || '' === $amp_status ) { $status = true; } else { $status = false; } return $status; } /** * Change the breakpoint CSS class to ast-amp for AMP specific CSS. * * @since 1.7.0 * * @param String $css compiled css. * @return String */ public function css_replace_breakpoint_to_amp( $css ) { return str_replace( 'ast-header-break-point', 'ast-amp', $css ); } /** * FReturn `slide-search` string. * * @since 1.7.0 * * @return String */ public function return_slide_search() { return 'slide-search'; } /** * Return `disabled` string. * * @since 1.7.0 * * @return String */ public function return_disabled() { return 'disabled'; } /** * Return `default` string. * * @since 1.7.0 * * @return String */ public function return_default() { return 'default'; } /** * Return number string. * * @since 1.7.0 * * @return String */ public function return_number_pagination() { return 'number'; } } /** * Kicking this off by calling 'get_instance()' method */ new Astra_Addon_AMP_Compatibility(); compatibility/class-astra-addon-beaver-builder-compatibility.php 0000644 00000003302 15150261777 0021174 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.6.0 */ if ( ! class_exists( 'Astra_Addon_Beaver_Builder_Compatibility' ) ) : /** * Astra Addon Page Builder Compatibility base class * * @since 1.6.0 */ class Astra_Addon_Beaver_Builder_Compatibility extends Astra_Addon_Page_Builder_Compatibility { /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Render content for post. * * @param int $post_id Post id. * * @since 1.6.0 */ public function render_content( $post_id ) { if ( ! apply_filters( 'astra_addon_bb_render_content_by_id', false ) ) { if ( is_callable( 'FLBuilderShortcodes::insert_layout' ) ) { echo do_shortcode( FLBuilderShortcodes::insert_layout( array( // WPCS: XSS OK. 'id' => $post_id, ) ) ); } } else { FLBuilder::render_content_by_id( $post_id, 'div', array() ); } } /** * Load styles and scripts for the BB layout. * * @param int $post_id Post id. * * @since 1.6.0 */ public function enqueue_scripts( $post_id ) { if ( is_callable( 'FLBuilder::enqueue_layout_styles_scripts_by_id' ) ) { // Enqueue styles and scripts for this post. FLBuilder::enqueue_layout_styles_scripts_by_id( $post_id ); } } } endif; compatibility/class-astra-addon-brizy-compatibility.php 0000644 00000007730 15150261777 0017454 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.6.0 */ if ( ! class_exists( 'Astra_Addon_Brizy_Compatibility' ) ) : /** * Astra Addon Page Builder Compatibility base class * * @since 1.6.0 */ class Astra_Addon_Brizy_Compatibility extends Astra_Addon_Page_Builder_Compatibility { /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_filter( 'brizy_supported_post_types', array( $this, 'support_astra_advanced_hook' ) ); } /** * Support astra advanced hook. * * @param array $posts posts. * * @since 1.6.12 */ public function support_astra_advanced_hook( $posts ) { $posts[] = 'astra-advanced-hook'; return $posts; } /** * Render content for post. * * @param int $post_id Post id. * * @since 1.6.0 */ public function render_content( $post_id ) { $post = Brizy_Editor_Post::get( $post_id ); if ( $post && $post->uses_editor() ) { $content = apply_filters( 'brizy_content', $post->get_compiled_html(), Brizy_Editor_Project::get(), $post->get_wp_post() ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound echo do_shortcode( $content ); } } /** * Load styles and scripts. * * @param int $post_id Post id. * * @since 1.6.0 */ public function enqueue_scripts( $post_id ) { $prefix = method_exists( 'Brizy_Editor', 'prefix' ) ? Brizy_Editor::prefix() : 'brizy'; if ( isset( $_GET[ "{$prefix}-edit-iframe" ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return; } try { $post = Brizy_Editor_Post::get( $post_id ); $main = method_exists( 'Brizy_Public_Main', 'get' ) ? Brizy_Public_Main::get( $post ) : new Brizy_Public_Main( $post ); } catch ( Exception $e ) { return; } $needs_compile = ! $post->isCompiledWithCurrentVersion() || $post->get_needs_compile(); if ( $needs_compile ) { try { $post->compile_page(); $post->saveStorage(); $post->savePost(); } catch ( Exception $e ) { return; } } // Add page CSS. add_filter( 'body_class', array( $main, 'body_class_frontend' ) ); add_action( 'wp_enqueue_scripts', function() use ( $main ) { if ( ! wp_script_is( 'brizy-preview' ) ) { add_action( 'wp_enqueue_scripts', array( $main, '_action_enqueue_preview_assets' ), 10001 ); } }, 10000 ); add_action( 'wp_head', function() use ( $post ) { $html = new Brizy_Editor_CompiledHtml( $post->get_compiled_html() ); echo do_shortcode( $html->get_head() ); } ); if ( $post && $post->uses_editor() ) { // Add page admin edit menu. add_action( 'admin_bar_menu', function( $wp_admin_bar ) use ( $post ) { $wp_post_id = $post->get_wp_post()->ID; $args = array( 'id' => 'brizy_Edit_page_' . $wp_post_id . '_link', /* translators: %s is the page title */ 'title' => sprintf( __( 'Edit %1$s with %2$s', 'astra-addon' ), get_the_title( $wp_post_id ), is_callable( 'Brizy_Editor::get' ) ? Brizy_Editor::get()->get_name() : 'Brizy' ), 'href' => $post->edit_url(), 'meta' => array(), ); if ( true === $wp_admin_bar->get_node( 'brizy_Edit_page_link' ) ) { $args['parent'] = 'brizy_Edit_page_link'; } $wp_admin_bar->add_node( $args ); }, 1000 ); } } } endif; // Add support for Advannced Hooks. Astra_Addon_Brizy_Compatibility::get_instance(); compatibility/class-astra-addon-divi-compatibility.php 0000644 00000006127 15150261777 0017247 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.6.0 */ if ( ! class_exists( 'Astra_Addon_Divi_Compatibility' ) ) : /** * Astra Addon Page Builder Compatibility base class * * @since 1.6.0 */ class Astra_Addon_Divi_Compatibility extends Astra_Addon_Page_Builder_Compatibility { /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Render content for post. * * @param int $post_id Post id. * * @since 1.6.0 */ public function render_content( $post_id ) { $current_post = get_post( $post_id, OBJECT ); wp( 'p=' . $post_id ); $current_post->post_content = self::add_divi_wrap( $current_post->post_content ); $current_post->post_content = apply_filters( 'the_content', $current_post->post_content );// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( strpos( $current_post->post_content, '<div id="et-boc" class="et-boc">' ) === false ) { $current_post->post_content = self::add_main_divi_wrapper( $current_post->post_content ); } echo do_shortcode( $current_post->post_content ); wp_reset_postdata(); } /** * Adds Divi wrapper container to post content. * * @since 1.3.3 * * @param string $content Post content. * @return string Post content. */ public static function add_divi_wrap( $content ) { $outer_class = apply_filters( 'et_builder_outer_content_class', array( 'et_builder_outer_content' ) );// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $outer_classes = implode( ' ', $outer_class ); $outer_id = apply_filters( 'et_builder_outer_content_id', 'et_builder_outer_content' );// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $inner_class = apply_filters( 'et_builder_inner_content_class', array( 'et_builder_inner_content' ) );// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $inner_classes = implode( ' ', $inner_class ); $content = sprintf( '<div class="%2$s" id="%4$s"> <div class="%3$s"> %1$s </div> </div>', $content, esc_attr( $outer_classes ), esc_attr( $inner_classes ), esc_attr( $outer_id ) ); return $content; } /** * Adds Divi main wrapper container to post content. * * @since v1.6.14 * * @param string $content Post content. * @return string Post content. */ public static function add_main_divi_wrapper( $content ) { $content = sprintf( '<div id="%2$s" class="%2$s"> %1$s </div>', $content, esc_attr( 'et-boc' ), esc_attr( 'et-boc' ) ); return $content; } } endif; compatibility/class-astra-addon-elementor-compatibility.php 0000644 00000003101 15150261777 0020273 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.6.0 */ if ( ! class_exists( 'Astra_Addon_Elementor_Compatibility' ) ) : /** * Astra Addon Page Builder Compatibility base class * * @since 1.6.0 */ class Astra_Addon_Elementor_Compatibility extends Astra_Addon_Page_Builder_Compatibility { /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Render content for post. * * @param int $post_id Post id. * * @since 1.6.0 */ public function render_content( $post_id ) { // set post to glabal post. $elementor_instance = Elementor\Plugin::instance(); echo do_shortcode( $elementor_instance->frontend->get_builder_content_for_display( $post_id ) ); } /** * Load styles and scripts. * * @param int $post_id Post id. * * @since 1.6.0 */ public function enqueue_scripts( $post_id ) { if ( '' !== $post_id ) { if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $css_file = new \Elementor\Core\Files\CSS\Post( $post_id ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { $css_file = new \Elementor\Post_CSS_File( $post_id ); } $css_file->enqueue(); } } } endif; compatibility/class-astra-addon-gutenberg-compatibility.php 0000644 00000013731 15150261777 0020275 0 ustar 00 <?php /** * Astra Addon Gutenberg Compatibility class * * @package Astra Addon * @since 2.5.1 */ /** * Astra Addon Gutenberg Builder Compatibility class * * @since 2.5.1 */ class Astra_Addon_Gutenberg_Compatibility extends Astra_Addon_Page_Builder_Compatibility { /** * Render Blocks content for post. * * @param int $post_id Post id. * * @since 2.5.1 */ public function render_content( $post_id ) { $output = ''; $current_post = get_post( $post_id, OBJECT ); if ( has_blocks( $current_post ) ) { $blocks = parse_blocks( $current_post->post_content ); foreach ( $blocks as $block ) { $output .= render_block( $block ); } } else { $output = $current_post->post_content; } ob_start(); echo do_shortcode( $output ); echo do_shortcode( ob_get_clean() ); } /** * Load Gutenberg Blocks styles & scripts. * * @param int $post_id Post id. * * @since 2.5.1 */ public function enqueue_blocks_assets( $post_id ) { wp_enqueue_style( 'wp-block-library' ); if ( defined( 'UAGB_VER' ) ) { if ( version_compare( UAGB_VER, '1.23.0', '>=' ) && class_exists( 'UAGB_Post_Assets' ) ) { $post_assets = new UAGB_Post_Assets( $post_id ); $post_assets->enqueue_scripts(); } else { /** * We can keep this compatibility for some releases and after few releases we need to remove it. * * @since 3.5.0 */ if ( class_exists( 'UAGB_Helper' ) && class_exists( 'UAGB_Config' ) ) { /** * Load UAG styles and scripts assets. * * @since 2.5.1 */ if ( version_compare( UAGB_VER, '1.14.11', '>=' ) ) { $uag_post_meta = get_post_meta( $post_id, 'uag_style_timestamp-css', true ); } else { $uag_post_meta = get_post_meta( $post_id, 'uagb_style_timestamp-css', true ); } /** * Set flag to load UAG assets. * * Resolving this to manage "UAG styles not load in some cases for Custom Layouts". * * @since 2.6.0 */ $uag_is_active = false; $current_post = get_post( $post_id, OBJECT ); $uagb_helper_instance = UAGB_Helper::get_instance(); if ( $uag_post_meta ) { $uag_is_active = true; } else { $uag_helper_parse_func = array( $uagb_helper_instance, 'parse' ); $uag_helper_get_assets_func = array( $uagb_helper_instance, 'get_assets' ); if ( is_callable( $uag_helper_parse_func ) && is_callable( $uag_helper_get_assets_func ) ) { $post_blocks = $uagb_helper_instance->parse( $current_post->post_content ); $post_uag_assets = $uagb_helper_instance->get_assets( $post_blocks ); if ( ! empty( $post_uag_assets['css'] ) ) { $uag_is_active = true; $active_gutenberg_blocks = parse_blocks( $current_post->post_content ); $used_uag_elements = $this->get_active_uag_blocks( $active_gutenberg_blocks ); if ( ! empty( $used_uag_elements ) ) { add_action( 'wp_enqueue_scripts', function() use ( $current_post, $used_uag_elements ) { if ( has_blocks( $current_post ) ) { $uag_blocks = UAGB_Config::get_block_attributes(); $uag_block_assets = UAGB_Config::get_block_assets(); foreach ( $used_uag_elements as $key => $curr_block_name ) { $js_assets = ( isset( $uag_blocks[ $curr_block_name ]['js_assets'] ) ) ? $uag_blocks[ $curr_block_name ]['js_assets'] : array(); $css_assets = ( isset( $uag_blocks[ $curr_block_name ]['css_assets'] ) ) ? $uag_blocks[ $curr_block_name ]['css_assets'] : array(); // Script Assets. foreach ( $js_assets as $asset_handle => $val ) { wp_register_script( $val, // Handle. $uag_block_assets[ $val ]['src'], $uag_block_assets[ $val ]['dep'], UAGB_VER, true ); wp_enqueue_script( $val ); } // Style Assets. foreach ( $css_assets as $asset_handle => $val ) { wp_register_style( $val, // Handle. $uag_block_assets[ $val ]['src'], $uag_block_assets[ $val ]['dep'], UAGB_VER ); wp_enqueue_style( $val ); } } } }, 11 ); } } } } if ( $uag_is_active ) { $uag_generated_stylesheet_func = array( $uagb_helper_instance, 'get_generated_stylesheet' ); /** * As per UAG Team discussion they are going to keep this stylesheet for upcoming few updates, after their stable release UAGB_VER = v1.23.0. Later they are going to deprecate it. * * @since 3.5.0 */ wp_enqueue_style( 'uagb-block-css', // UAG-Handle. UAGB_URL . 'dist/blocks.style.css', // Block style CSS. array(), UAGB_VER ); if ( is_callable( $uag_generated_stylesheet_func ) ) { $uagb_helper_instance->get_generated_stylesheet( $current_post ); } } } } } } /** * Get all UAG specific blocks from current Custom Layout. * * @param array $active_gutenberg_blocks has all gutenberg blocks used in this Custom Layout. * @return array $uag_block_names having all UAG block names * @since 2.6.0 */ public function get_active_uag_blocks( array $active_gutenberg_blocks ) { $uag_block_names = array(); foreach ( $active_gutenberg_blocks as $key => $curr_block_name ) { if ( 'blockName' === $key && strpos( $curr_block_name, 'uagb/' ) !== false ) { $uag_block_names[] = $curr_block_name; } if ( is_array( $curr_block_name ) ) { $uag_block_names = array_merge( $uag_block_names, $this->get_active_uag_blocks( $curr_block_name ) ); } } return $uag_block_names; } } compatibility/class-astra-addon-nginx-helper-compatibility.php 0000644 00000002025 15150261777 0020705 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 2.0.0 */ /** * Astra Addon Page Builder Compatibility base class * * @since 2.0.0 */ class Astra_Addon_Nginx_Helper_Compatibility { /** * Setup the class */ public function __construct() { add_action( 'astra_addon_assets_refreshed', array( $this, 'refresh_nginx_helper_cache' ) ); } /** * Purge Nginx Helper's Cache. * * @since 2.0.0 * @return void */ public function refresh_nginx_helper_cache() { // Nginx FastCGI using Nginx Helper. do_action( 'rt_nginx_helper_purge_all' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } } /** * Conditionally Initialize Nginx_Helper compatibility. * * @since 2.1.0 * @return void */ function astra_addon_nginx_helper_compatibility() { if ( class_exists( 'Nginx_Helper' ) ) { new Astra_Addon_Nginx_Helper_Compatibility(); } } add_action( 'plugins_loaded', 'astra_addon_nginx_helper_compatibility' ); compatibility/class-astra-addon-page-builder-compatibility.php 0000644 00000010153 15150261777 0020646 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.6.0 */ if ( ! class_exists( 'Astra_Addon_Page_Builder_Compatibility' ) ) : /** * Astra Addon Page Builder Compatibility base class * * @since 1.6.0 */ class Astra_Addon_Page_Builder_Compatibility { /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Returns instance for active page builder. * * @param int $post_id Post id. * * @since 1.6.0 */ public function get_active_page_builder( $post_id ) { global $wp_post_types; $post = get_post( $post_id ); $post_type = get_post_type( $post_id ); if ( class_exists( '\Elementor\Plugin' ) ) { $document = Elementor\Plugin::$instance->documents->get( $post_id ); // phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound if ( $document ) { $deprecated_handle = $document->is_built_with_elementor(); } else { $deprecated_handle = false; } if ( ( version_compare( ELEMENTOR_VERSION, '1.5.0', '<' ) && 'builder' === Elementor\Plugin::$instance->db->get_edit_mode( $post_id ) ) || $deprecated_handle ) { return Astra_Addon_Elementor_Compatibility::get_instance(); } } if ( defined( 'TVE_VERSION' ) && get_post_meta( $post_id, 'tcb_editor_enabled', true ) ) { return Astra_Addon_Thrive_Compatibility::get_instance(); } if ( class_exists( 'FLBuilderModel' ) && apply_filters( 'fl_builder_do_render_content', true, FLBuilderModel::get_post_id() ) && get_post_meta( $post_id, '_fl_builder_enabled', true ) ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return Astra_Addon_Beaver_Builder_Compatibility::get_instance(); } $vc_active = get_post_meta( $post_id, '_wpb_vc_js_status', true ); if ( class_exists( 'Vc_Manager' ) && ( 'true' == $vc_active || has_shortcode( $post->post_content, 'vc_row' ) ) ) { return Astra_Addon_Visual_Composer_Compatibility::get_instance(); } if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) { return Astra_Addon_Divi_Compatibility::get_instance(); } if ( class_exists( 'Brizy_Editor_Post' ) ) { try { $post = Brizy_Editor_Post::get( $post_id ); if ( $post ) { return Astra_Addon_Brizy_Compatibility::get_instance(); } } catch ( Exception $exception ) { // The post type is not supported by Brizy hence Brizy should not be used render the post. return; } } $has_rest_support = isset( $wp_post_types[ $post_type ]->show_in_rest ) ? $wp_post_types[ $post_type ]->show_in_rest : false; if ( $has_rest_support ) { return new Astra_Addon_Gutenberg_Compatibility(); } return self::get_instance(); } /** * Render content for post. * * @param int $post_id Post id. * * @since 1.6.0 */ public function render_content( $post_id ) { $current_post = get_post( $post_id, OBJECT ); ob_start(); echo do_shortcode( $current_post->post_content ); echo do_shortcode( ob_get_clean() ); } /** * Check is a post is built using WPBakery Page Builder. * * @since 1.6.0 * @param int $post_id Post ID of a Post to be checked for. * @return boolean */ public static function is_vc_activated( $post_id ) { $post = get_post( $post_id ); $vc_active = get_post_meta( $post_id, '_wpb_vc_js_status', true ); if ( class_exists( 'Vc_Manager' ) && ( 'true' == $vc_active || has_shortcode( $post->post_content, 'vc_row' ) ) ) { return true; } return false; } } /** * Initialize class object with 'get_instance()' method */ Astra_Addon_Page_Builder_Compatibility::get_instance(); endif; compatibility/class-astra-addon-run-cloud-helper-compatibility.php 0000644 00000002036 15150261777 0021474 0 ustar 00 <?php /** * Astra Addon RunCloud Compatibility * * @package Astra Addon * @since 2.5.0 */ /** * Astra Addon Runcloud Helper Class * * @since 2.5.0 */ class Astra_Addon_Run_Cloud_Helper_Compatibility { /** * Constructor * * @since 2.5.0 */ public function __construct() { add_action( 'astra_addon_assets_refreshed', array( $this, 'refresh_runcloud_helper_cache' ) ); } /** * Purge RunCloud Cache. * * @since 2.5.0 * @return void */ public function refresh_runcloud_helper_cache() { if ( is_callable( 'RunCache_Purger::flush_home' ) ) { // Function to purge RunCloud cache. RunCache_Purger::flush_home( true ); } } } /** * Conditionally Initialize RunCloud Cache compatibility. * * @since 2.5.0 * @return void */ function astra_addon_run_cloud_helper_compatibility() { if ( class_exists( 'RunCache_Purger' ) ) { new Astra_Addon_Run_Cloud_Helper_Compatibility(); } } add_action( 'plugins_loaded', 'astra_addon_run_cloud_helper_compatibility' ); compatibility/class-astra-addon-thrive-compatibility.php 0000644 00000005641 15150261777 0017615 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.6.0 */ if ( ! class_exists( 'Astra_Addon_Thrive_Compatibility' ) ) : /** * Astra Addon Page Builder Compatibility base class * * @since 1.6.0 */ class Astra_Addon_Thrive_Compatibility extends Astra_Addon_Page_Builder_Compatibility { /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Render content for post. * * @param int $post_id Post id. * * @since 1.6.0 */ public function render_content( $post_id ) { if ( true === $this->is_thrive_builder_page( $post_id ) ) { return; } $current_post = get_post( $post_id, OBJECT ); // set the main wp query for the post. wp( 'p=' . $post_id ); $tve_content = apply_filters( 'the_content', $current_post->post_content ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( isset( $_REQUEST[ TVE_EDITOR_FLAG ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $tve_content = str_replace( 'id="tve_editor"', '', $tve_content ); } echo do_shortcode( $tve_content ); wp_reset_postdata(); } /** * Load styles and scripts. * * @param int $post_id Post id. * * @since 1.6.0 */ public function enqueue_scripts( $post_id ) { if ( true === $this->is_thrive_builder_page( $post_id ) ) { return; } if ( tve_get_post_meta( $post_id, 'thrive_icon_pack' ) && ! wp_style_is( 'thrive_icon_pack', 'enqueued' ) ) { TCB_Icon_Manager::enqueue_icon_pack(); } tve_enqueue_extra_resources( $post_id ); tve_enqueue_style_family( $post_id ); tve_enqueue_custom_fonts( $post_id, true ); tve_load_custom_css( $post_id ); add_filter( 'tcb_enqueue_resources', '__return_true' ); tve_frontend_enqueue_scripts(); remove_filter( 'tcb_enqueue_resources', '__return_true' ); } /** * Check if the page being rendered is the main ID on the editor page. * * @since 1.6.2 * @param String $post_id Post ID which is to be rendered. * @return boolean True if current if is being rendered is not being edited. */ private function is_thrive_builder_page( $post_id ) { $tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $post = isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended return ( true == $tve && $post_id !== $post ); } } endif; compatibility/class-astra-addon-visual-composer-compatibility.php 0000644 00000002014 15150261777 0021433 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.6.0 */ if ( ! class_exists( 'Astra_Addon_Visual_Composer_Compatibility' ) ) : /** * Astra Addon Page Builder Compatibility base class * * @since 1.6.0 */ class Astra_Addon_Visual_Composer_Compatibility extends Astra_Addon_Page_Builder_Compatibility { /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Render content for post. * * @param int $post_id Post id. * * @since 1.6.0 */ public function render_content( $post_id ) { $current_post = get_post( $post_id, OBJECT ); echo do_shortcode( $current_post->post_content ); } } endif; customizer/assets/css/customizer.css 0000644 00000000414 15150261777 0013772 0 ustar 00 .ast-customizer-notice { margin: -20px -12px 5px -12px; padding: 15px; font-size: 14px; background-color: #0085ba; color: #fff; border-bottom: 1px solid #006799; } .ast-customizer-notice a { color: white; font-weight: bold; } customizer/assets/js/custom-controls.min.js 0000644 00000200113 15150261777 0015171 0 ustar 00 !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=16)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.React}()},function(e,t,n){var o=n(6),r=n(7),a=n(8),i=n(10);e.exports=function(e,t){return o(e)||r(e,t)||a(e,t)||i()}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){e.exports=n(11)()},function(e,t,n){var o=S(n(13)),r=n(1),a=r.Children,i=r.cloneElement,l=r.Component,s=r.createElement,c=r.createRef,u=S(n(14)),d=n(15),f=S(d);t.Sortable=f;var p=d.Direction;t.Direction=p;var h=d.DOMRect;t.DOMRect=h;var v=d.GroupOptions;t.GroupOptions=v;var g=d.MoveEvent;t.MoveEvent=g;var m=d.Options;t.Options=m;var b=d.PullResult;t.PullResult=b;var y=d.PutResult;t.PutResult=y;var w=d.SortableEvent;t.SortableEvent=w;var E=d.SortableOptions;t.SortableOptions=E;var O=d.Utils;function S(e){return e&&e.__esModule?e.default:e}function D(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e){null!==e.parentElement&&e.parentElement.removeChild(e)}function T(e){e.forEach((function(e){return I(e.element)}))}function j(e){e.forEach((function(e){var t,n,o,r;t=e.parentElement,n=e.element,o=e.oldIndex,r=t.children[o]||null,t.insertBefore(n,r)}))}function M(e,t){var n=N(e),o={parentElement:e.from},r=[];switch(n){case"normal":r=[{element:e.item,newIndex:e.newIndex,oldIndex:e.oldIndex,parentElement:e.from}];break;case"swap":r=[x({element:e.item,oldIndex:e.oldIndex,newIndex:e.newIndex},o),x({element:e.swapItem,oldIndex:e.newIndex,newIndex:e.oldIndex},o)];break;case"multidrag":r=e.oldIndicies.map((function(t,n){return x({element:t.multiDragElement,oldIndex:t.index,newIndex:e.newIndicies[n].index},o)}))}return function(e,t){return e.map((function(e){return x(x({},e),{},{item:t[e.oldIndex]})})).sort((function(e,t){return e.oldIndex-t.oldIndex}))}(r,t)}function A(e,t){var n=D(t);return e.concat().reverse().forEach((function(e){return n.splice(e.oldIndex,1)})),n}function k(e,t,n,o){var r=D(t);return e.forEach((function(e){var t=o&&n&&o(e.item,n);r.splice(e.newIndex,0,t||e.item)})),r}function N(e){return e.oldIndicies&&e.oldIndicies.length>0?"multidrag":e.swapItem?"swap":"normal"}function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function L(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach((function(t){W(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function H(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t){return!t||"object"!==R(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.Utils=O;var K={dragging:null},G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}(d,l);var t,n,r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=z(e);if(t){var r=z(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return F(this,n)}}(d);function d(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),(t=r.call(this,e)).ref=c();var n=e.list.map((function(e){return Y(Y({},e),{},{chosen:!1,selected:!1})}));return e.setList(n,t.sortable,K),o(!e.plugins,'\nPlugins prop is no longer supported.\nInstead, mount it with "Sortable.mount(new MultiDrag())"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n '),t}return t=d,(n=[{key:"componentDidMount",value:function(){if(null!==this.ref.current){var e=this.makeOptions();f.create(this.ref.current,e)}}},{key:"render",value:function(){var e=this.props,t=e.tag,n={style:e.style,className:e.className,id:e.id};return s(t&&null!==t?t:"div",Y({ref:this.ref},n),this.getChildren())}},{key:"getChildren",value:function(){var e=this.props,t=e.children,n=e.dataIdAttr,o=e.selectedClass,r=void 0===o?"sortable-selected":o,l=e.chosenClass,s=void 0===l?"sortable-chosen":l,c=(e.dragClass,e.fallbackClass,e.ghostClass,e.swapClass,e.filter),d=void 0===c?"sortable-filter":c,f=e.list;if(!t||null==t)return null;var p=n||"data-id";return a.map(t,(function(e,t){var n,o,a=f[t],l=e.props.className,c="string"==typeof d&&W({},d.replace(".",""),!!a.filtered),h=u(l,Y((W(n={},r,a.selected),W(n,s,a.chosen),n),c));return i(e,(W(o={},p,e.key),W(o,"className",h),o))}))}},{key:"makeOptions",value:function(){var e,t=this,n=((e=this.props).list,e.setList,e.children,e.tag,e.style,e.className,e.clone,e.onAdd,e.onChange,e.onChoose,e.onClone,e.onEnd,e.onFilter,e.onRemove,e.onSort,e.onStart,e.onUnchoose,e.onUpdate,e.onMove,e.onSpill,e.onSelect,e.onDeselect,function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["list","setList","children","tag","style","className","clone","onAdd","onChange","onChoose","onClone","onEnd","onFilter","onRemove","onSort","onStart","onUnchoose","onUpdate","onMove","onSpill","onSelect","onDeselect"]));return["onAdd","onChoose","onDeselect","onEnd","onRemove","onSelect","onSpill","onStart","onUnchoose","onUpdate"].forEach((function(e){return n[e]=t.prepareOnHandlerPropAndDOM(e)})),["onChange","onClone","onFilter","onSort"].forEach((function(e){return n[e]=t.prepareOnHandlerProp(e)})),Y(Y({},n),{},{onMove:function(e,n){var o=t.props.onMove,r=e.willInsertAfter||-1;if(!o)return r;var a=o(e,n,t.sortable,K);return void 0!==a&&a}})}},{key:"prepareOnHandlerPropAndDOM",value:function(e){var t=this;return function(n){t.callOnHandlerProp(n,e),t[e](n)}}},{key:"prepareOnHandlerProp",value:function(e){var t=this;return function(n){t.callOnHandlerProp(n,e)}}},{key:"callOnHandlerProp",value:function(e,t){var n=this.props[t];n&&n(e,this.sortable,K)}},{key:"onAdd",value:function(e){var t=this.props,n=t.list,o=t.setList,r=t.clone,a=M(e,L(K.dragging.props.list));T(a),o(k(a,n,e,r).map((function(e){return Y(Y({},e),{},{selected:!1})})),this.sortable,K)}},{key:"onRemove",value:function(e){var t=this,n=this.props,r=n.list,a=n.setList,i=N(e),l=M(e,r);j(l);var s=L(r);if("clone"!==e.pullMode)s=A(l,s);else{var c=l;switch(i){case"multidrag":c=l.map((function(t,n){return Y(Y({},t),{},{element:e.clones[n]})}));break;case"normal":c=l.map((function(t){return Y(Y({},t),{},{element:e.clone})}));break;case"swap":default:o(!0,'mode "'.concat(i,'" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "').concat(i,'" plugin'))}T(c),l.forEach((function(n){var o=n.oldIndex,r=t.props.clone(n.item,e);s.splice(o,1,r)}))}a(s=s.map((function(e){return Y(Y({},e),{},{selected:!1})})),this.sortable,K)}},{key:"onUpdate",value:function(e){var t=this.props,n=t.list,o=t.setList,r=M(e,n);return T(r),j(r),o(function(e,t){return k(e,A(e,t))}(r,n),this.sortable,K)}},{key:"onStart",value:function(){K.dragging=this}},{key:"onEnd",value:function(){K.dragging=null}},{key:"onChoose",value:function(e){var t=this.props,n=t.list;(0,t.setList)(n.map((function(t,n){return n===e.oldIndex?Y(Y({},t),{},{chosen:!0}):t})),this.sortable,K)}},{key:"onUnchoose",value:function(e){var t=this.props,n=t.list;(0,t.setList)(n.map((function(t,n){return n===e.oldIndex?Y(Y({},t),{},{chosen:!1}):t})),this.sortable,K)}},{key:"onSpill",value:function(e){var t=this.props,n=t.removeOnSpill,o=t.revertOnSpill;n&&!o&&I(e.item)}},{key:"onSelect",value:function(e){var t=this.props,n=t.list,o=t.setList,r=n.map((function(e){return Y(Y({},e),{},{selected:!1})}));e.newIndicies.forEach((function(t){var n=t.index;if(-1===n)return console.log('"'.concat(e.type,'" had indice of "').concat(t.index,"\", which is probably -1 and doesn't usually happen here.")),void console.log(e);r[n].selected=!0})),o(r,this.sortable,K)}},{key:"onDeselect",value:function(e){var t=this.props,n=t.list,o=t.setList,r=n.map((function(e){return Y(Y({},e),{},{selected:!1})}));e.newIndicies.forEach((function(e){var t=e.index;-1!==t&&(r[t].selected=!0)})),o(r,this.sortable,K)}},{key:"sortable",get:function(){var e=this.ref.current;if(null===e)return null;var t=Object.keys(e).find((function(e){return e.includes("Sortable")}));return t?e[t]:null}}])&&H(t.prototype,n),d}();t.ReactSortable=G,W(G,"defaultProps",{clone:function(e){return e}})},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],o=!0,r=!1,a=void 0;try{for(var i,l=e[Symbol.iterator]();!(o=(i=l.next()).done)&&(n.push(i.value),!t||n.length!==t);o=!0);}catch(e){r=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(r)throw a}}return n}}},function(e,t,n){var o=n(9);e.exports=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){"use strict";var o=n(12);function r(){}function a(){}a.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,a,i){if(i!==o){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);t.default=function(e,t){if(!e)throw new Error("Invariant failed")}},function(e,t,n){var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)&&o.length){var i=r.apply(null,o);i&&e.push(i)}else if("object"===a)for(var l in o)n.call(o,l)&&o[l]&&e.push(l)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},function(e,t,n){"use strict";function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function r(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}n.r(t),n.d(t,"Sortable",(function(){return Ne}));var a=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),i=r(/Edge/i),l=r(/firefox/i),s=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),c=r(/iP(ad|od|hone)/i),u=r(/chrome/i)&&r(/android/i),d={capture:!1,passive:!1};function f(e,t,n){e.addEventListener(t,n,!a&&d)}function p(e,t,n){e.removeEventListener(t,n,!a&&d)}function h(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function v(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function g(e,t,n,o){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&h(e,t):h(e,t))||o&&e===n)return e;if(e===n)break}while(e=v(e))}return null}var m,b=/\s+/g;function y(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var o=(" "+e.className+" ").replace(b," ").replace(" "+t+" "," ");e.className=(o+(n?" "+t:"")).replace(b," ")}}function w(e,t,n){var o=e&&e.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in o||-1!==t.indexOf("webkit")||(t="-webkit-"+t),o[t]=n+("string"==typeof n?"":"px")}}function E(e,t){var n="";if("string"==typeof e)n=e;else do{var o=w(e,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function O(e,t,n){if(e){var o=e.getElementsByTagName(t),r=0,a=o.length;if(n)for(;r<a;r++)n(o[r],r);return o}return[]}function S(){return document.scrollingElement||document.documentElement}function D(e,t,n,o,r){if(e.getBoundingClientRect||e===window){var i,l,s,c,u,d,f;if(e!==window&&e!==S()?(l=(i=e.getBoundingClientRect()).top,s=i.left,c=i.bottom,u=i.right,d=i.height,f=i.width):(l=0,s=0,c=window.innerHeight,u=window.innerWidth,d=window.innerHeight,f=window.innerWidth),(t||n)&&e!==window&&(r=r||e.parentNode,!a))do{if(r&&r.getBoundingClientRect&&("none"!==w(r,"transform")||n&&"static"!==w(r,"position"))){var p=r.getBoundingClientRect();l-=p.top+parseInt(w(r,"border-top-width")),s-=p.left+parseInt(w(r,"border-left-width")),c=l+i.height,u=s+i.width;break}}while(r=r.parentNode);if(o&&e!==window){var h=E(r||e),v=h&&h.a,g=h&&h.d;h&&(c=(l/=g)+(d/=g),u=(s/=v)+(f/=v))}return{top:l,left:s,bottom:c,right:u,width:f,height:d}}}function C(e,t,n){for(var o=T(e,!0),r=D(e)[t];o;){var a=D(o)[n];if(!("top"===n||"left"===n?r>=a:r<=a))return o;if(o===S())break;o=T(o,!1)}return!1}function _(e,t,n){for(var o=0,r=0,a=e.children;r<a.length;){if("none"!==a[r].style.display&&a[r]!==Ne.ghost&&a[r]!==Ne.dragged&&g(a[r],n.draggable,e,!1)){if(o===t)return a[r];o++}r++}return null}function x(e,t){for(var n=e.lastElementChild;n&&(n===Ne.ghost||"none"===w(n,"display")||t&&!h(n,t));)n=n.previousElementSibling;return n||null}function P(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Ne.clone||t&&!h(e,t)||n++;return n}function I(e){var t=0,n=0,o=S();if(e)do{var r=E(e);t+=e.scrollLeft*r.a,n+=e.scrollTop*r.d}while(e!==o&&(e=e.parentNode));return[t,n]}function T(e,t){if(!e||!e.getBoundingClientRect)return S();var n=e,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var r=w(n);if(n.clientWidth<n.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!n.getBoundingClientRect||n===document.body)return S();if(o||t)return n;o=!0}}}while(n=n.parentNode);return S()}function j(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function M(e,t){return function(){if(!m){var n=arguments,o=this;1===n.length?e.call(o,n[0]):e.apply(o,n),m=setTimeout((function(){m=void 0}),t)}}}function A(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function k(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function N(e,t){w(e,"position","absolute"),w(e,"top",t.top),w(e,"left",t.left),w(e,"width",t.width),w(e,"height",t.height)}function R(e){w(e,"position",""),w(e,"top",""),w(e,"left",""),w(e,"width",""),w(e,"height","")}var L="Sortable"+(new Date).getTime(),B=[],X={initializeByDefault:!0},Y={mount:function(e){for(var t in X)X.hasOwnProperty(t)&&!(t in e)&&(e[t]=X[t]);B.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var a=e+"Global";B.forEach((function(r){t[r.pluginName]&&(t[r.pluginName][a]&&t[r.pluginName][a](o({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](o({sortable:t},n)))}))},initializePlugins:function(e,t,n,o){for(var r in B.forEach((function(o){var r=o.pluginName;if(e.options[r]||o.initializeByDefault){var a=new o(e,t,e.options);a.sortable=e,a.options=e.options,e[r]=a,Object.assign(n,a.defaults)}})),e.options)if(e.options.hasOwnProperty(r)){var a=this.modifyOption(e,r,e.options[r]);void 0!==a&&(e.options[r]=a)}},getEventProperties:function(e,t){var n={};return B.forEach((function(o){"function"==typeof o.eventProperties&&Object.assign(n,o.eventProperties.call(t[o.pluginName],e))})),n},modifyOption:function(e,t,n){var o;return B.forEach((function(r){e[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[t]&&(o=r.optionListeners[t].call(e[r.pluginName],n))})),o}};function H(e){var t=e.sortable,n=e.rootEl,r=e.name,l=e.targetEl,s=e.cloneEl,c=e.toEl,u=e.fromEl,d=e.oldIndex,f=e.newIndex,p=e.oldDraggableIndex,h=e.newDraggableIndex,v=e.originalEvent,g=e.putSortable,m=e.extraEventProperties;if(t=t||n&&n[L]){var b,y=t.options,w="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||a||i?(b=document.createEvent("Event")).initEvent(r,!0,!0):b=new CustomEvent(r,{bubbles:!0,cancelable:!0}),b.to=c||n,b.from=u||n,b.item=l||n,b.clone=s,b.oldIndex=d,b.newIndex=f,b.oldDraggableIndex=p,b.newDraggableIndex=h,b.originalEvent=v,b.pullMode=g?g.lastPutMode:void 0;var E=o({},m,Y.getEventProperties(r,t));for(var O in E)b[O]=E[O];n&&n.dispatchEvent(b),y[w]&&y[w].call(t,b)}}var U=function(e,t,n){var r=void 0===n?{}:n,a=r.evt,i=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)t.indexOf(n=a[o])>=0||(r[n]=e[n]);return r}(r,["evt"]);Y.pluginEvent.bind(Ne)(e,t,o({dragEl:z,parentEl:W,ghostEl:K,rootEl:G,nextEl:q,lastDownEl:V,cloneEl:$,cloneHidden:Z,dragStarted:ue,putSortable:oe,activeSortable:Ne.active,originalEvent:a,oldIndex:J,oldDraggableIndex:ee,newIndex:Q,newDraggableIndex:te,hideGhostForTarget:Te,unhideGhostForTarget:je,cloneNowHidden:function(){Z=!0},cloneNowShown:function(){Z=!1},dispatchSortableEvent:function(e){F({sortable:t,name:e,originalEvent:a})}},i))};function F(e){H(o({putSortable:oe,cloneEl:$,targetEl:z,rootEl:G,oldIndex:J,oldDraggableIndex:ee,newIndex:Q,newDraggableIndex:te},e))}var z,W,K,G,q,V,$,Z,J,Q,ee,te,ne,oe,re,ae,ie,le,se,ce,ue,de,fe,pe,he,ve=!1,ge=!1,me=[],be=!1,ye=!1,we=[],Ee=!1,Oe=[],Se="undefined"!=typeof document,De=c,Ce=i||a?"cssFloat":"float",_e=Se&&!u&&!c&&"draggable"in document.createElement("div"),xe=function(){if(Se){if(a)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Pe=function(e,t){var n=w(e),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=_(e,0,t),a=_(e,1,t),i=r&&w(r),l=a&&w(a),s=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+D(r).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+D(a).width;return"flex"===n.display?"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal":"grid"===n.display?n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal":r&&i.float&&"none"!==i.float?!a||"both"!==l.clear&&l.clear!==("left"===i.float?"left":"right")?"horizontal":"vertical":r&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||s>=o&&"none"===n[Ce]||a&&"none"===n[Ce]&&s+c>o)?"vertical":"horizontal"},Ie=function(e){function t(e,n){return function(o,r,a,i){if(null==e&&(n||o.options.group.name&&r.options.group.name&&o.options.group.name===r.options.group.name))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(o,r,a,i),n)(o,r,a,i);var l=(n?o:r).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},o=e.group;o&&"object"==typeof o||(o={name:o}),n.name=o.name,n.checkPull=t(o.pull,!0),n.checkPut=t(o.put),n.revertClone=o.revertClone,e.group=n},Te=function(){!xe&&K&&w(K,"display","none")},je=function(){!xe&&K&&w(K,"display","")};Se&&document.addEventListener("click",(function(e){if(ge)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ge=!1,!1}),!0);var Me,Ae=function(e){if(z){var t=(r=(e=e.touches?e.touches[0]:e).clientX,a=e.clientY,me.some((function(e){if(!x(e)){var t=D(e),n=e[L].options.emptyInsertThreshold;return n&&r>=t.left-n&&r<=t.right+n&&a>=t.top-n&&a<=t.bottom+n?i=e:void 0}})),i);if(t){var n={};for(var o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[L]._onDragOver(n)}}var r,a,i},ke=function(e){z&&z.parentNode[L]._isOutsideThisEl(e.target)};function Ne(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not "+{}.toString.call(e);this.el=e,this.options=t=Object.assign({},t),e[L]=this;var n,r,a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Pe(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Ne.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var i in Y.initializePlugins(this,e,a),a)!(i in t)&&(t[i]=a[i]);for(var l in Ie(t),this)"_"===l.charAt(0)&&"function"==typeof this[l]&&(this[l]=this[l].bind(this));this.nativeDraggable=!t.forceFallback&&_e,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?f(e,"pointerdown",this._onTapStart):(f(e,"mousedown",this._onTapStart),f(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(f(e,"dragover",this),f(e,"dragenter",this)),me.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),Object.assign(this,(r=[],{captureAnimationState:function(){r=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==w(e,"display")&&void 0!==e){r.push({target:e,rect:D(e)});var t=o({},r[r.length-1].rect);if(e.thisAnimationDuration){var n=E(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){r.push(e)},removeAnimationState:function(e){r.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var o in t)if(t.hasOwnProperty(o)&&t[o]===e[n][o])return Number(n);return-1}(r,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var o=!1,a=0;r.forEach((function(e){var n=0,r=e.target,i=r.fromRect,l=D(r),s=r.prevFromRect,c=r.prevToRect,u=e.rect,d=E(r,!0);d&&(l.top-=d.f,l.left-=d.e),r.toRect=l,r.thisAnimationDuration&&j(s,l)&&!j(i,l)&&(u.top-l.top)/(u.left-l.left)==(i.top-l.top)/(i.left-l.left)&&(n=function(e,t,n,o){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*o.animation}(u,s,c,t.options)),j(l,i)||(r.prevFromRect=i,r.prevToRect=l,n||(n=t.options.animation),t.animate(r,u,l,n)),n&&(o=!0,a=Math.max(a,n),clearTimeout(r.animationResetTimer),r.animationResetTimer=setTimeout((function(){r.animationTime=0,r.prevFromRect=null,r.fromRect=null,r.prevToRect=null,r.thisAnimationDuration=null}),n),r.thisAnimationDuration=n)})),clearTimeout(n),o?n=setTimeout((function(){"function"==typeof e&&e()}),a):"function"==typeof e&&e(),r=[]},animate:function(e,t,n,o){if(o){w(e,"transition",""),w(e,"transform","");var r=E(this.el),a=(t.left-n.left)/(r&&r.a||1),i=(t.top-n.top)/(r&&r.d||1);e.animatingX=!!a,e.animatingY=!!i,w(e,"transform","translate3d("+a+"px,"+i+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),w(e,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),w(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){w(e,"transition",""),w(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),o)}}}))}function Re(e,t,n,o,r,l,s,c){var u,d,f=e[L],p=f.options.onMove;return!window.CustomEvent||a||i?(u=document.createEvent("Event")).initEvent("move",!0,!0):u=new CustomEvent("move",{bubbles:!0,cancelable:!0}),u.to=t,u.from=e,u.dragged=n,u.draggedRect=o,u.related=r||t,u.relatedRect=l||D(t),u.willInsertAfter=c,u.originalEvent=s,e.dispatchEvent(u),p&&(d=p.call(f,u,s)),d}function Le(e){e.draggable=!1}function Be(){Ee=!1}function Xe(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,o=0;n--;)o+=t.charCodeAt(n);return o.toString(36)}function Ye(e){return setTimeout(e,0)}function He(e){return clearTimeout(e)}Ne.prototype={constructor:Ne,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(de=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,z):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,o=this.options,r=o.preventOnFilter,a=e.type,i=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(i||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,u=o.filter;if(function(e){Oe.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var o=t[n];o.checked&&Oe.push(o)}}(n),!z&&!(/mousedown|pointerdown/.test(a)&&0!==e.button||o.disabled)&&!c.isContentEditable&&(this.nativeDraggable||!s||!l||"SELECT"!==l.tagName.toUpperCase())&&!((l=g(l,o.draggable,n,!1))&&l.animated||V===l)){if(J=P(l),ee=P(l,o.draggable),"function"==typeof u){if(u.call(this,e,l,this))return F({sortable:t,rootEl:c,name:"filter",targetEl:l,toEl:n,fromEl:n}),U("filter",t,{evt:e}),void(r&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(o){if(o=g(c,o.trim(),n,!1))return F({sortable:t,rootEl:o,name:"filter",targetEl:l,fromEl:n,toEl:n}),U("filter",t,{evt:e}),!0}))))return void(r&&e.cancelable&&e.preventDefault());o.handle&&!g(c,o.handle,n,!1)||this._prepareDragStart(e,i,l)}}},_prepareDragStart:function(e,t,n){var o,r=this,s=r.el,c=r.options,u=s.ownerDocument;if(n&&!z&&n.parentNode===s){var d=D(n);if(G=s,W=(z=n).parentNode,q=z.nextSibling,V=n,ne=c.group,Ne.dragged=z,se=(re={target:z,clientX:(t||e).clientX,clientY:(t||e).clientY}).clientX-d.left,ce=re.clientY-d.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,z.style["will-change"]="all",o=function(){U("delayEnded",r,{evt:e}),Ne.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!l&&r.nativeDraggable&&(z.draggable=!0),r._triggerDragStart(e,t),F({sortable:r,name:"choose",originalEvent:e}),y(z,c.chosenClass,!0))},c.ignore.split(",").forEach((function(e){O(z,e.trim(),Le)})),f(u,"dragover",Ae),f(u,"mousemove",Ae),f(u,"touchmove",Ae),f(u,"mouseup",r._onDrop),f(u,"touchend",r._onDrop),f(u,"touchcancel",r._onDrop),l&&this.nativeDraggable&&(this.options.touchStartThreshold=4,z.draggable=!0),U("delayStart",this,{evt:e}),!c.delay||c.delayOnTouchOnly&&!t||this.nativeDraggable&&(i||a))o();else{if(Ne.eventCanceled)return void this._onDrop();f(u,"mouseup",r._disableDelayedDrag),f(u,"touchend",r._disableDelayedDrag),f(u,"touchcancel",r._disableDelayedDrag),f(u,"mousemove",r._delayedDragTouchMoveHandler),f(u,"touchmove",r._delayedDragTouchMoveHandler),c.supportPointer&&f(u,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(o,c.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){z&&Le(z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;p(e,"mouseup",this._disableDelayedDrag),p(e,"touchend",this._disableDelayedDrag),p(e,"touchcancel",this._disableDelayedDrag),p(e,"mousemove",this._delayedDragTouchMoveHandler),p(e,"touchmove",this._delayedDragTouchMoveHandler),p(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?f(document,this.options.supportPointer?"pointermove":t?"touchmove":"mousemove",this._onTouchMove):(f(z,"dragend",this),f(G,"dragstart",this._onDragStart));try{document.selection?Ye((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(ve=!1,G&&z){U("dragStarted",this,{evt:t}),this.nativeDraggable&&f(document,"dragover",ke);var n=this.options;!e&&y(z,n.dragClass,!1),y(z,n.ghostClass,!0),Ne.active=this,e&&this._appendGhost(),F({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(ae){this._lastX=ae.clientX,this._lastY=ae.clientY,Te();for(var e=document.elementFromPoint(ae.clientX,ae.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ae.clientX,ae.clientY))!==t;)t=e;if(z.parentNode[L]._isOutsideThisEl(e),t)do{if(t[L]&&t[L]._onDragOver({clientX:ae.clientX,clientY:ae.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);je()}},_onTouchMove:function(e){if(re){var t=this.options,n=t.fallbackTolerance,o=t.fallbackOffset,r=e.touches?e.touches[0]:e,a=K&&E(K,!0),i=K&&a&&a.a,l=K&&a&&a.d,s=De&&he&&I(he),c=(r.clientX-re.clientX+o.x)/(i||1)+(s?s[0]-we[0]:0)/(i||1),u=(r.clientY-re.clientY+o.y)/(l||1)+(s?s[1]-we[1]:0)/(l||1);if(!Ne.active&&!ve){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(K){a?(a.e+=c-(ie||0),a.f+=u-(le||0)):a={a:1,b:0,c:0,d:1,e:c,f:u};var d="matrix("+a.a+","+a.b+","+a.c+","+a.d+","+a.e+","+a.f+")";w(K,"webkitTransform",d),w(K,"mozTransform",d),w(K,"msTransform",d),w(K,"transform",d),ie=c,le=u,ae=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!K){var e=this.options.fallbackOnBody?document.body:G,t=D(z,!0,De,!0,e),n=this.options;if(De){for(he=e;"static"===w(he,"position")&&"none"===w(he,"transform")&&he!==document;)he=he.parentNode;he!==document.body&&he!==document.documentElement?(he===document&&(he=S()),t.top+=he.scrollTop,t.left+=he.scrollLeft):he=S(),we=I(he)}y(K=z.cloneNode(!0),n.ghostClass,!1),y(K,n.fallbackClass,!0),y(K,n.dragClass,!0),w(K,"transition",""),w(K,"transform",""),w(K,"box-sizing","border-box"),w(K,"margin",0),w(K,"top",t.top),w(K,"left",t.left),w(K,"width",t.width),w(K,"height",t.height),w(K,"opacity","0.8"),w(K,"position",De?"absolute":"fixed"),w(K,"zIndex","100000"),w(K,"pointerEvents","none"),Ne.ghost=K,e.appendChild(K),w(K,"transform-origin",se/parseInt(K.style.width)*100+"% "+ce/parseInt(K.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,o=e.dataTransfer,r=n.options;U("dragStart",this,{evt:e}),Ne.eventCanceled?this._onDrop():(U("setupClone",this),Ne.eventCanceled||(($=k(z)).draggable=!1,$.style["will-change"]="",this._hideClone(),y($,this.options.chosenClass,!1),Ne.clone=$),n.cloneId=Ye((function(){U("clone",n),Ne.eventCanceled||(n.options.removeCloneOnHide||G.insertBefore($,z),n._hideClone(),F({sortable:n,name:"clone"}))})),!t&&y(z,r.dragClass,!0),t?(ge=!0,n._loopId=setInterval(n._emulateDragOver,50)):(p(document,"mouseup",n._onDrop),p(document,"touchend",n._onDrop),p(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",r.setData&&r.setData.call(n,o,z)),f(document,"drop",n),w(z,"transform","translateZ(0)")),ve=!0,n._dragStartId=Ye(n._dragStarted.bind(n,t,e)),f(document,"selectstart",n),ue=!0,s&&w(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,r,a,i=this.el,l=e.target,s=this.options,c=s.group,u=Ne.active,d=ne===c,f=s.sort,p=oe||u,h=this,v=!1;if(!Ee){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),l=g(l,s.draggable,i,!0),B("dragOver"),Ne.eventCanceled)return v;if(z.contains(e.target)||l.animated&&l.animatingX&&l.animatingY||h._ignoreWhileAnimating===l)return Y(!1);if(ge=!1,u&&!s.disabled&&(d?f||(r=!G.contains(z)):oe===this||(this.lastPutMode=ne.checkPull(this,u,z,e))&&c.checkPut(this,u,z,e))){if(a="vertical"===this._getDirection(e,l),t=D(z),B("dragOverValid"),Ne.eventCanceled)return v;if(r)return W=G,X(),this._hideClone(),B("revert"),Ne.eventCanceled||(q?G.insertBefore(z,q):G.appendChild(z)),Y(!0);var m=x(i,s.draggable);if(!m||function(e,t,n){var o=D(x(n.el,n.options.draggable));return t?e.clientX>o.right+10||e.clientX<=o.right&&e.clientY>o.bottom&&e.clientX>=o.left:e.clientX>o.right&&e.clientY>o.top||e.clientX<=o.right&&e.clientY>o.bottom+10}(e,a,this)&&!m.animated){if(m===z)return Y(!1);if(m&&i===e.target&&(l=m),l&&(n=D(l)),!1!==Re(G,i,z,t,l,n,e,!!l))return X(),i.appendChild(z),W=i,H(),Y(!0)}else if(l.parentNode===i){n=D(l);var b,E,O,S=z.parentNode!==i,_=!function(e,t,n){var o=n?e.left:e.top,r=n?t.left:t.top;return o===r||(n?e.right:e.bottom)===(n?t.right:t.bottom)||o+(n?e.width:e.height)/2===r+(n?t.width:t.height)/2}(z.animated&&z.toRect||t,l.animated&&l.toRect||n,a),I=a?"top":"left",T=C(l,"top","top")||C(z,"top","top"),j=T?T.scrollTop:void 0;if(de!==l&&(E=n[I],be=!1,ye=!_&&s.invertSwap||S),0!==(b=function(e,t,n,o,r,a,i,l){var s=o?e.clientY:e.clientX,c=o?n.height:n.width,u=o?n.top:n.left,d=o?n.bottom:n.right,f=!1;if(!i)if(l&&pe<c*r){if(!be&&(1===fe?s>u+c*a/2:s<d-c*a/2)&&(be=!0),be)f=!0;else if(1===fe?s<u+pe:s>d-pe)return-fe}else if(s>u+c*(1-r)/2&&s<d-c*(1-r)/2)return function(e){return P(z)<P(e)?1:-1}(t);return(f=f||i)&&(s<u+c*a/2||s>d-c*a/2)?s>u+c/2?1:-1:0}(e,l,n,a,_?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,ye,de===l))){var M=P(z);do{O=W.children[M-=b]}while(O&&("none"===w(O,"display")||O===K))}if(0===b||O===l)return Y(!1);de=l,fe=b;var k=l.nextElementSibling,N=!1,R=Re(G,i,z,t,l,n,e,N=1===b);if(!1!==R)return 1!==R&&-1!==R||(N=1===R),Ee=!0,setTimeout(Be,30),X(),N&&!k?i.appendChild(z):l.parentNode.insertBefore(z,N?k:l),T&&A(T,0,j-T.scrollTop),W=z.parentNode,void 0===E||ye||(pe=Math.abs(E-D(l)[I])),H(),Y(!0)}if(i.contains(z))return Y(!1)}return!1}function B(s,c){U(s,h,o({evt:e,isOwner:d,axis:a?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:f,fromSortable:p,target:l,completed:Y,onMove:function(n,o){return Re(G,i,z,t,n,D(n),e,o)},changed:H},c))}function X(){B("dragOverAnimationCapture"),h.captureAnimationState(),h!==p&&p.captureAnimationState()}function Y(t){return B("dragOverCompleted",{insertion:t}),t&&(d?u._hideClone():u._showClone(h),h!==p&&(y(z,oe?oe.options.ghostClass:u.options.ghostClass,!1),y(z,s.ghostClass,!0)),oe!==h&&h!==Ne.active?oe=h:h===Ne.active&&oe&&(oe=null),p===h&&(h._ignoreWhileAnimating=l),h.animateAll((function(){B("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(l===z&&!z.animated||l===i&&!l.animated)&&(de=null),s.dragoverBubble||e.rootEl||l===document||(z.parentNode[L]._isOutsideThisEl(e.target),!t&&Ae(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),v=!0}function H(){Q=P(z),te=P(z,s.draggable),F({sortable:h,name:"change",toEl:i,newIndex:Q,newDraggableIndex:te,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){p(document,"mousemove",this._onTouchMove),p(document,"touchmove",this._onTouchMove),p(document,"pointermove",this._onTouchMove),p(document,"dragover",Ae),p(document,"mousemove",Ae),p(document,"touchmove",Ae)},_offUpEvents:function(){var e=this.el.ownerDocument;p(e,"mouseup",this._onDrop),p(e,"touchend",this._onDrop),p(e,"pointerup",this._onDrop),p(e,"touchcancel",this._onDrop),p(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;Q=P(z),te=P(z,n.draggable),U("drop",this,{evt:e}),W=z&&z.parentNode,Q=P(z),te=P(z,n.draggable),Ne.eventCanceled||(ve=!1,ye=!1,be=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),He(this.cloneId),He(this._dragStartId),this.nativeDraggable&&(p(document,"drop",this),p(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),s&&w(document.body,"user-select",""),w(z,"transform",""),e&&(ue&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),K&&K.parentNode&&K.parentNode.removeChild(K),(G===W||oe&&"clone"!==oe.lastPutMode)&&$&&$.parentNode&&$.parentNode.removeChild($),z&&(this.nativeDraggable&&p(z,"dragend",this),Le(z),z.style["will-change"]="",ue&&!ve&&y(z,oe?oe.options.ghostClass:this.options.ghostClass,!1),y(z,this.options.chosenClass,!1),F({sortable:this,name:"unchoose",toEl:W,newIndex:null,newDraggableIndex:null,originalEvent:e}),G!==W?(Q>=0&&(F({rootEl:W,name:"add",toEl:W,fromEl:G,originalEvent:e}),F({sortable:this,name:"remove",toEl:W,originalEvent:e}),F({rootEl:W,name:"sort",toEl:W,fromEl:G,originalEvent:e}),F({sortable:this,name:"sort",toEl:W,originalEvent:e})),oe&&oe.save()):Q!==J&&Q>=0&&(F({sortable:this,name:"update",toEl:W,originalEvent:e}),F({sortable:this,name:"sort",toEl:W,originalEvent:e})),Ne.active&&(null!=Q&&-1!==Q||(Q=J,te=ee),F({sortable:this,name:"end",toEl:W,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){U("nulling",this),G=z=W=K=q=$=V=Z=re=ae=ue=Q=te=J=ee=de=fe=oe=ne=Ne.dragged=Ne.ghost=Ne.clone=Ne.active=null,Oe.forEach((function(e){e.checked=!0})),Oe.length=ie=le=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":z&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,o=0,r=n.length,a=this.options;o<r;o++)g(e=n[o],a.draggable,this.el,!1)&&t.push(e.getAttribute(a.dataIdAttr)||Xe(e));return t},sort:function(e){var t={},n=this.el;this.toArray().forEach((function(e,o){var r=n.children[o];g(r,this.options.draggable,n,!1)&&(t[e]=r)}),this),e.forEach((function(e){t[e]&&(n.removeChild(t[e]),n.appendChild(t[e]))}))},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return g(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var o=Y.modifyOption(this,e,t);n[e]=void 0!==o?o:t,"group"===e&&Ie(n)},destroy:function(){U("destroy",this);var e=this.el;e[L]=null,p(e,"mousedown",this._onTapStart),p(e,"touchstart",this._onTapStart),p(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(p(e,"dragover",this),p(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),me.splice(me.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Z){if(U("hideClone",this),Ne.eventCanceled)return;w($,"display","none"),this.options.removeCloneOnHide&&$.parentNode&&$.parentNode.removeChild($),Z=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Z){if(U("showClone",this),Ne.eventCanceled)return;z.parentNode!=G||this.options.group.revertClone?q?G.insertBefore($,q):G.appendChild($):G.insertBefore($,z),this.options.group.revertClone&&this.animate(z,$),w($,"display",""),Z=!1}}else this._hideClone()}},Se&&f(document,"touchmove",(function(e){(Ne.active||ve)&&e.cancelable&&e.preventDefault()})),Ne.utils={on:f,off:p,css:w,find:O,is:function(e,t){return!!g(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:M,closest:g,toggleClass:y,clone:k,index:P,nextTick:Ye,cancelNextTick:He,detectDirection:Pe,getChild:_},Ne.get=function(e){return e[L]},Ne.mount=function(){var e=[].slice.call(arguments);e[0].constructor===Array&&(e=e[0]),e.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not "+{}.toString.call(e);e.utils&&(Ne.utils=o({},Ne.utils,e.utils)),Y.mount(e)}))},Ne.create=function(e,t){return new Ne(e,t)},Ne.version="1.12.0";var Ue,Fe,ze,We,Ke,Ge=[],qe=[],Ve=!1,$e=!1,Ze=!1;function Je(e,t){qe.forEach((function(n,o){var r=t.children[n.sortableIndex+(e?Number(o):0)];r?t.insertBefore(n,r):t.appendChild(n)}))}function Qe(){Ge.forEach((function(e){e!==ze&&e.parentNode&&e.parentNode.removeChild(e)}))}var et=function(e){var t=e.originalEvent,n=e.putSortable,o=e.dragEl,r=e.dispatchSortableEvent,a=e.unhideGhostForTarget;if(t){var i=n||e.activeSortable;(0,e.hideGhostForTarget)();var l=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,s=document.elementFromPoint(l.clientX,l.clientY);a(),i&&!i.el.contains(s)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function tt(){}function nt(){}tt.prototype={startIndex:null,dragStart:function(e){this.startIndex=e.oldDraggableIndex},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=_(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(t,o):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:et},Object.assign(tt,{pluginName:"revertOnSpill"}),nt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:et},Object.assign(nt,{pluginName:"removeOnSpill"});var ot,rt,at,it,lt,st,ct=[],ut=!1;function dt(){ct.forEach((function(e){clearInterval(e.pid)})),ct=[]}function ft(){clearInterval(st)}var pt=M((function(e,t,n,o){if(t.scroll){var r,a=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,l=t.scrollSensitivity,s=t.scrollSpeed,c=S(),u=!1;rt!==n&&(rt=n,dt(),r=t.scrollFn,!0===(ot=t.scroll)&&(ot=T(n,!0)));var d=0,f=ot;do{var p=f,h=D(p),v=h.top,g=h.bottom,m=h.left,b=h.right,y=h.width,E=h.height,O=void 0,C=void 0,_=p.scrollWidth,x=p.scrollHeight,P=w(p),I=p.scrollLeft,j=p.scrollTop;p===c?(O=y<_&&("auto"===P.overflowX||"scroll"===P.overflowX||"visible"===P.overflowX),C=E<x&&("auto"===P.overflowY||"scroll"===P.overflowY||"visible"===P.overflowY)):(O=y<_&&("auto"===P.overflowX||"scroll"===P.overflowX),C=E<x&&("auto"===P.overflowY||"scroll"===P.overflowY));var M=O&&(Math.abs(b-a)<=l&&I+y<_)-(Math.abs(m-a)<=l&&!!I),k=C&&(Math.abs(g-i)<=l&&j+E<x)-(Math.abs(v-i)<=l&&!!j);if(!ct[d])for(var N=0;N<=d;N++)ct[N]||(ct[N]={});ct[d].vx==M&&ct[d].vy==k&&ct[d].el===p||(ct[d].el=p,ct[d].vx=M,ct[d].vy=k,clearInterval(ct[d].pid),0==M&&0==k||(u=!0,ct[d].pid=setInterval(function(){o&&0===this.layer&&Ne.active._onTouchMove(lt);var t=ct[this.layer].vy?ct[this.layer].vy*s:0,n=ct[this.layer].vx?ct[this.layer].vx*s:0;"function"==typeof r&&"continue"!==r.call(Ne.dragged.parentNode[L],n,t,e,lt,ct[this.layer].el)||A(ct[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==c&&(f=T(f,!1)));ut=u}}),30);Ne.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?f(document,"dragover",this._handleAutoScroll):f(document,this.options.supportPointer?"pointermove":t.touches?"touchmove":"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?p(document,"dragover",this._handleAutoScroll):(p(document,"pointermove",this._handleFallbackAutoScroll),p(document,"touchmove",this._handleFallbackAutoScroll),p(document,"mousemove",this._handleFallbackAutoScroll)),ft(),dt(),clearTimeout(m),m=void 0},nulling:function(){lt=rt=ot=ut=st=at=it=null,ct.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,o=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,l=document.elementFromPoint(o,r);if(lt=e,t||i||a||s){pt(e,this.options,l,t);var c=T(l,!0);!ut||st&&o===at&&r===it||(st&&ft(),st=setInterval((function(){var a=T(document.elementFromPoint(o,r),!0);a!==c&&(c=a,dt()),pt(e,n.options,a,t)}),10),at=o,it=r)}else{if(!this.options.bubbleScroll||T(l,!0)===S())return void dt();pt(e,this.options,T(l,!1),!1)}}},Object.assign(e,{pluginName:"scroll",initializeByDefault:!0})}),Ne.mount(nt,tt),Ne.mount(new function(){function e(){this.defaults={swapClass:"sortable-swap-highlight"}}return e.prototype={dragStart:function(e){Me=e.dragEl},dragOverValid:function(e){var t=e.completed,n=e.target,o=e.changed,r=e.cancel;if(e.activeSortable.options.swap){var a=this.options;if(n&&n!==this.sortable.el){var i=Me;!1!==(0,e.onMove)(n)?(y(n,a.swapClass,!0),Me=n):Me=null,i&&i!==Me&&y(i,a.swapClass,!1)}o(),t(!0),r()}},drop:function(e){var t,n,o,r,a,i,l=e.activeSortable,s=e.putSortable,c=e.dragEl,u=s||this.sortable,d=this.options;Me&&y(Me,d.swapClass,!1),Me&&(d.swap||s&&s.options.swap)&&c!==Me&&(u.captureAnimationState(),u!==l&&l.captureAnimationState(),i=(n=Me).parentNode,(a=(t=c).parentNode)&&i&&!a.isEqualNode(n)&&!i.isEqualNode(t)&&(o=P(t),r=P(n),a.isEqualNode(i)&&o<r&&r++,a.insertBefore(n,a.children[o]),i.insertBefore(t,i.children[r])),u.animateAll(),u!==l&&l.animateAll())},nulling:function(){Me=null}},Object.assign(e,{pluginName:"swap",eventProperties:function(){return{swapItem:Me}}})}),Ne.mount(new function(){function e(e){for(var t in this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this));e.options.supportPointer?f(document,"pointerup",this._deselectMultiDrag):(f(document,"mouseup",this._deselectMultiDrag),f(document,"touchend",this._deselectMultiDrag)),f(document,"keydown",this._checkKeyDown),f(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,setData:function(t,n){var o="";Ge.length&&Fe===e?Ge.forEach((function(e,t){o+=(t?", ":"")+e.textContent})):o=n.textContent,t.setData("Text",o)}}}return e.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal:function(e){ze=e.dragEl},delayEnded:function(){this.isMultiDrag=~Ge.indexOf(ze)},setupClone:function(e){var t=e.sortable,n=e.cancel;if(this.isMultiDrag){for(var o=0;o<Ge.length;o++)qe.push(k(Ge[o])),qe[o].sortableIndex=Ge[o].sortableIndex,qe[o].draggable=!1,qe[o].style["will-change"]="",y(qe[o],this.options.selectedClass,!1),Ge[o]===ze&&y(qe[o],this.options.chosenClass,!1);t._hideClone(),n()}},clone:function(e){var t=e.dispatchSortableEvent,n=e.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||Ge.length&&Fe===e.sortable&&(Je(!0,e.rootEl),t("clone"),n()))},showClone:function(e){var t=e.cloneNowShown,n=e.cancel;this.isMultiDrag&&(Je(!1,e.rootEl),qe.forEach((function(e){w(e,"display","")})),t(),Ke=!1,n())},hideClone:function(e){var t=this,n=e.cloneNowHidden,o=e.cancel;this.isMultiDrag&&(qe.forEach((function(e){w(e,"display","none"),t.options.removeCloneOnHide&&e.parentNode&&e.parentNode.removeChild(e)})),n(),Ke=!0,o())},dragStartGlobal:function(e){!this.isMultiDrag&&Fe&&Fe.multiDrag._deselectMultiDrag(),Ge.forEach((function(e){e.sortableIndex=P(e)})),Ge=Ge.sort((function(e,t){return e.sortableIndex-t.sortableIndex})),Ze=!0},dragStarted:function(e){var t=this,n=e.sortable;if(this.isMultiDrag){if(this.options.sort&&(n.captureAnimationState(),this.options.animation)){Ge.forEach((function(e){e!==ze&&w(e,"position","absolute")}));var o=D(ze,!1,!0,!0);Ge.forEach((function(e){e!==ze&&N(e,o)})),$e=!0,Ve=!0}n.animateAll((function(){$e=!1,Ve=!1,t.options.animation&&Ge.forEach((function(e){R(e)})),t.options.sort&&Qe()}))}},dragOver:function(e){var t=e.completed,n=e.cancel;$e&&~Ge.indexOf(e.target)&&(t(!1),n())},revert:function(e){var t=e.fromSortable,n=e.rootEl,o=e.sortable,r=e.dragRect;Ge.length>1&&(Ge.forEach((function(e){o.addAnimationState({target:e,rect:$e?D(e):r}),R(e),e.fromRect=r,t.removeAnimationState(e)})),$e=!1,function(e,t){Ge.forEach((function(n,o){var r=t.children[n.sortableIndex+(e?Number(o):0)];r?t.insertBefore(n,r):t.appendChild(n)}))}(!this.options.removeCloneOnHide,n))},dragOverCompleted:function(e){var t=e.sortable,n=e.isOwner,o=e.activeSortable,r=e.parentEl,a=e.putSortable,i=this.options;if(e.insertion){if(n&&o._hideClone(),Ve=!1,i.animation&&Ge.length>1&&($e||!n&&!o.options.sort&&!a)){var l=D(ze,!1,!0,!0);Ge.forEach((function(e){e!==ze&&(N(e,l),r.appendChild(e))})),$e=!0}if(!n)if($e||Qe(),Ge.length>1){var s=Ke;o._showClone(t),o.options.animation&&!Ke&&s&&qe.forEach((function(e){o.addAnimationState({target:e,rect:We}),e.fromRect=We,e.thisAnimationDuration=null}))}else o._showClone(t)}},dragOverAnimationCapture:function(e){var t=e.dragRect,n=e.isOwner,o=e.activeSortable;if(Ge.forEach((function(e){e.thisAnimationDuration=null})),o.options.animation&&!n&&o.multiDrag.isMultiDrag){We=Object.assign({},t);var r=E(ze,!0);We.top-=r.f,We.left-=r.e}},dragOverAnimationComplete:function(){$e&&($e=!1,Qe())},drop:function(e){var t=e.originalEvent,n=e.rootEl,o=e.parentEl,r=e.sortable,a=e.dispatchSortableEvent,i=e.oldIndex,l=e.putSortable,s=l||this.sortable;if(t){var c=this.options,u=o.children;if(!Ze)if(c.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),y(ze,c.selectedClass,!~Ge.indexOf(ze)),~Ge.indexOf(ze))Ge.splice(Ge.indexOf(ze),1),Ue=null,H({sortable:r,rootEl:n,name:"deselect",targetEl:ze,originalEvt:t});else{if(Ge.push(ze),H({sortable:r,rootEl:n,name:"select",targetEl:ze,originalEvt:t}),t.shiftKey&&Ue&&r.el.contains(Ue)){var d,f,p=P(Ue),h=P(ze);if(~p&&~h&&p!==h)for(h>p?(f=p,d=h):(f=h,d=p+1);f<d;f++)~Ge.indexOf(u[f])||(y(u[f],c.selectedClass,!0),Ge.push(u[f]),H({sortable:r,rootEl:n,name:"select",targetEl:u[f],originalEvt:t}))}else Ue=ze;Fe=s}if(Ze&&this.isMultiDrag){if((o[L].options.sort||o!==n)&&Ge.length>1){var v=D(ze),g=P(ze,":not(."+this.options.selectedClass+")");if(!Ve&&c.animation&&(ze.thisAnimationDuration=null),s.captureAnimationState(),!Ve&&(c.animation&&(ze.fromRect=v,Ge.forEach((function(e){if(e.thisAnimationDuration=null,e!==ze){var t=$e?D(e):v;e.fromRect=t,s.addAnimationState({target:e,rect:t})}}))),Qe(),Ge.forEach((function(e){u[g]?o.insertBefore(e,u[g]):o.appendChild(e),g++})),i===P(ze))){var m=!1;Ge.forEach((function(e){e.sortableIndex===P(e)||(m=!0)})),m&&a("update")}Ge.forEach((function(e){R(e)})),s.animateAll()}Fe=s}(n===o||l&&"clone"!==l.lastPutMode)&&qe.forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)}))}},nullingGlobal:function(){this.isMultiDrag=Ze=!1,qe.length=0},destroyGlobal:function(){this._deselectMultiDrag(),p(document,"pointerup",this._deselectMultiDrag),p(document,"mouseup",this._deselectMultiDrag),p(document,"touchend",this._deselectMultiDrag),p(document,"keydown",this._checkKeyDown),p(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(void 0!==Ze&&Ze||Fe!==this.sortable||e&&g(e.target,this.options.draggable,this.sortable.el,!1)||e&&0!==e.button))for(;Ge.length;){var t=Ge[0];y(t,this.options.selectedClass,!1),Ge.shift(),H({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:t,originalEvt:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},Object.assign(e,{pluginName:"multiDrag",utils:{select:function(e){var t=e.parentNode[L];t&&t.options.multiDrag&&!~Ge.indexOf(e)&&(Fe&&Fe!==t&&(Fe.multiDrag._deselectMultiDrag(),Fe=t),y(e,t.options.selectedClass,!0),Ge.push(e))},deselect:function(e){var t=e.parentNode[L],n=Ge.indexOf(e);t&&t.options.multiDrag&&~n&&(y(e,t.options.selectedClass,!1),Ge.splice(n,1))}},eventProperties:function(){var e=this,t=[],n=[];return Ge.forEach((function(o){var r;t.push({multiDragElement:o,index:o.sortableIndex}),r=$e&&o!==ze?-1:$e?P(o,":not(."+e.options.selectedClass+")"):P(o),n.push({multiDragElement:o,index:r})})),{items:[].concat(Ge),clones:[].concat(qe),oldIndicies:t,newIndicies:n}},optionListeners:{multiDragKey:function(e){return"ctrl"===(e=e.toLowerCase())?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}),t.default=Ne},function(e,t,n){"use strict";n.r(t);var o=n(0),r=n(2),a=n.n(r),i=n(3),l=n.n(i),s=n(4),c=n.n(s),u=n(5),d=n(1);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){l()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var h=wp.i18n.__,v=wp.components,g=v.Dashicon,m=v.TextControl,b=v.Button,y=function(e){window.svgIcons;var t=Object(d.useState)({open:!1}),n=a()(t,2),r=n[0],i=n[1],l=Object(o.createElement)("span",{className:"description customize-control-description"},h("Enter alternative URL which provides above selected language translation of your site.","astra-addon"));return Object(o.createElement)("div",{className:"ahfb-sorter-item","data-id":e.item.id,key:e.item.id},Object(o.createElement)("div",{className:"ahfb-sorter-item-panel-header",onClick:function(){i((function(e){return p(p({},e),{},{open:!r.open})}))}},Object(o.createElement)("span",{className:"ahfb-sorter-title"},void 0!==e.item.label&&""!==e.item.label?e.item.label:h("Language Item","astra-addon")),Object(o.createElement)(b,{className:"ahfb-sorter-item-expand ".concat(e.item.enabled?"item-is-visible":"item-is-hidden"),onClick:function(t){t.stopPropagation(),e.toggleEnabled(!e.item.enabled,e.index)}},Object(o.createElement)(g,{icon:"visibility"})),Object(o.createElement)(b,{className:"ahfb-sorter-item-remove",isDestructive:!0,onClick:function(){e.removeItem(e.index)}},Object(o.createElement)(g,{icon:"no-alt"}))),r.open&&Object(o.createElement)("div",{className:"ahfb-sorter-item-panel-content"},Object(o.createElement)(m,{label:h("Label","astra-addon"),value:e.item.label?e.item.label:"",onChange:function(t){e.onChangeLabel(t,e.index)}}),Object(o.createElement)(m,{label:h("URL","astra-addon"),value:e.item.url?e.item.url:"",onChange:function(t){e.onChangeURL(t,e.index)}}),l))};function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){l()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var O=wp.i18n.__,S=wp.components,D=S.Button,C=S.SelectControl,_=function(e){var t=e.control.setting.get(),n={items:[{id:"gb",enabled:!0,url:"",label:O("English","astra-addon")}]},r=e.control.params.default?E(E({},n),e.control.params.default):n;t=t?E(E({},r),t):r;var i={group:"language_selector_group",options:[{label:O("Albanian","astra-addon"),value:"al"},{label:O("Arabic","astra-addon"),value:"sa"},{label:O("Bengali","astra-addon"),value:"bd"},{label:O("Bulgarian","astra-addon"),value:"bg"},{label:O("Chinese","astra-addon"),value:"cn"},{label:O("Croatian","astra-addon"),value:"hr"},{label:O("Czech","astra-addon"),value:"cz"},{label:O("English","astra-addon"),value:"gb"},{label:O("French","astra-addon"),value:"fr"},{label:O("German","astra-addon"),value:"de"},{label:O("Greek","astra-addon"),value:"gr"},{label:O("Hebrew","astra-addon"),value:"il"},{label:O("Hindi","astra-addon"),value:"in"},{label:O("Hungarian","astra-addon"),value:"hu"},{label:O("Icelandic","astra-addon"),value:"is"},{label:O("Indonesian","astra-addon"),value:"id"},{label:O("Italian","astra-addon"),value:"it"},{label:O("Japanese","astra-addon"),value:"jp"},{label:O("Korean","astra-addon"),value:"kr"},{label:O("Latvian","astra-addon"),value:"lv"},{label:O("Lithuanian","astra-addon"),value:"lt"},{label:O("Macedonian","astra-addon"),value:"mk"},{label:O("Malay","astra-addon"),value:"my"},{label:O("Maltese","astra-addon"),value:"mt"},{label:O("Mongolian","astra-addon"),value:"mn"},{label:O("Nepali","astra-addon"),value:"np"},{label:O("Dutch","astra-addon"),value:"nl"},{label:O("Norwegian Bokmål","astra-addon"),value:"no"},{label:O("Persian","astra-addon"),value:"ir"},{label:O("Polish","astra-addon"),value:"pl"},{label:O("Portuguese, Portugal","astra-addon"),value:"pt"},{label:O("Romanian","astra-addon"),value:"ro"},{label:O("Russian","astra-addon"),value:"ru"},{label:O("Serbian","astra-addon"),value:"rs"},{label:O("Slovak","astra-addon"),value:"sk"},{label:O("Slovenian","astra-addon"),value:"si"},{label:O("Somali","astra-addon"),value:"so"},{label:O("Spanish","astra-addon"),value:"es"},{label:O("Swedish","astra-addon"),value:"se"},{label:O("Tamil","astra-addon"),value:"lk"},{label:O("Thai","astra-addon"),value:"th"},{label:O("Turkish","astra-addon"),value:"tr"},{label:O("Ukrainian","astra-addon"),value:"ua"},{label:O("Urdu","astra-addon"),value:"pk"},{label:O("Uzbek","astra-addon"),value:"uz"},{label:O("Vietnamese","astra-addon"),value:"vn"},{label:O("Zulu","astra-addon"),value:"za"},{label:O("Other","astra-addon"),value:"zz-other"}].sort((function(e,t){return e.label<t.label?-1:e.label>t.label?1:0}))},l=e.control.params.input_attrs?E(E({},i),e.control.params.input_attrs):i,s=[];l.options.map((function(e){t.items.some((function(t){return t.id===e.value}))||s.push(e)}));var c=Object(d.useState)({value:t,isVisible:!1,control:void 0!==s[0]&&void 0!==s[0].value?s[0].value:""}),f=a()(c,2),p=f[0],h=f[1];Object(d.useEffect)((function(){h((function(t){return E(E({},t),{},{value:e.control.setting.get()})}))}),[e]);var v=function(t){e.control.setting.set(E(E(E({},e.control.setting.get()),t),{},{flag:!e.control.setting.get().flag}))},g=function(){var e,t=document.querySelectorAll(".ahfb-builder-area");for(e=0;e<t.length;++e)t[e].classList.remove("ahfb-dragging-dropzones")},m=function(e,t){var n=p.value,o=n.items.map((function(n,o){return t===o&&(n=E(E({},n),e)),n}));n.items=o,h((function(e){return E(E({},e),{},{value:n})})),v(n)},b=function(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!=t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0},w=void 0!==p.value&&null!=p.value.items&&null!=p.value.items.length&&p.value.items.length>0?p.value.items:[],S=[];w.length>0&&w.map((function(e){S.push({id:e.id})})),l.options.map((function(e){S.some((function(t){return t.id===e.value}))||s.push(e)}));return Object(o.createElement)("div",{className:"ahfb-control-field ahfb-sorter-items"},Object(o.createElement)("div",{className:"ahfb-sorter-row"},Object(o.createElement)(u.ReactSortable,{animation:100,onStart:function(){return g()},onEnd:function(){return g()},group:l.group,className:"ahfb-sorter-drop ahfb-sorter-sortable-panel ahfb-sorter-drop-".concat(l.group),handle:".ahfb-sorter-item-panel-header",list:S,setList:function(e){return t=e,n=p.value,o=n.items,r=[],t.length>0&&t.map((function(e){o.filter((function(t){t.id===e.id&&r.push(t)}))})),void(b(o,r)||(o.items=r,n.items=r,h((function(e){return E(E({},e),{},{value:n})})),v(n)));var t,n,o,r}},w.length>0&&w.map((function(e,t){return Object(o.createElement)(y,{removeItem:function(e){return t=e,n=p.value,o=n.items,r=[],o.length>0&&o.map((function(e,n){t!==n&&r.push(e)})),n.items=r,h((function(e){return E(E({},e),{},{value:n})})),void v(n);var t,n,o,r},toggleEnabled:function(e,t){return function(e,t){m({enabled:e},t)}(e,t)},onChangeLabel:function(e,t){return function(e,t){m({label:e},t)}(e,t)},onChangeURL:function(e,t){return function(e,t){m({url:e},t)}(e,t)},key:e.id,index:t,item:e,controlParams:l})})))),void 0!==s[0]&&void 0!==s[0].value&&Object(o.createElement)("div",{className:"ahfb-language-selector-add-area"},Object(o.createElement)(C,{value:p.control,options:s,onChange:function(e){h((function(t){return E(E({},t),{},{control:e})}))}}),Object(o.createElement)(D,{className:"ahfb-sorter-add-item",isPrimary:!0,onClick:function(){!function(){var e=p.control;if(h((function(e){return E(E({},e),{},{isVisible:!1})})),e){var t=p.value,n=t.items,o=l.options.filter((function(t){return t.value===e})),r={id:e,enabled:!0,url:"",label:o[0].label};n.push(r),t.items=n;var a=[];l.options.map((function(e){n.some((function(t){return t.id===e.value}))||a.push(e)})),h((function(e){return E(E({},e),{},{control:void 0!==a[0]&&void 0!==a[0].value?a[0].value:""})})),h((function(e){return E(E({},e),{},{value:t})})),v(t)}}()}},O("Add Language","astra-addon"))))};_.propTypes={control:c.a.object.isRequired};var x=_,P=wp.customize.Control.extend({renderContent:function(){ReactDOM.render(Object(o.createElement)(x,{control:this}),this.container[0])}});wp.customize.controlConstructor["ast-language-selector"]=P}]); customizer/controls/class-astra-control-customizer-refresh.php 0000644 00000003323 15150261777 0021071 0 ustar 00 <?php /** * Customizer Control: Customizer Refresh * * @package Astra * @link https://wpastra.com/ * @since 1.5.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Field overrides. */ if ( ! class_exists( 'Astra_Control_Customizer_Refresh' ) && class_exists( 'WP_Customize_Control' ) ) : /** * Color control (alpha). */ // @codingStandardsIgnoreStart class Astra_Control_Customizer_Refresh extends WP_Customize_Control { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * The control type. * * @var string */ public $type = 'ast-customizer-refresh'; /** * The color with opacity rgba type. * * @var string */ public $class = ''; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['class'] = $this->class; } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <a class="button {{{ data.class }}}" onclick="wp.customize.previewer.refresh();" href="#">{{{ data.label }}}</a> <?php } /** * Render the control's content. * * @see WP_Customize_Control::render_content() */ protected function render_content() {} } endif; customizer/extend-controls/build/index.js 0000644 00000200113 15150261777 0014654 0 ustar 00 !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=16)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.React}()},function(e,t,n){var o=n(6),r=n(7),a=n(8),i=n(10);e.exports=function(e,t){return o(e)||r(e,t)||a(e,t)||i()}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){e.exports=n(11)()},function(e,t,n){var o=S(n(13)),r=n(1),a=r.Children,i=r.cloneElement,l=r.Component,s=r.createElement,c=r.createRef,u=S(n(14)),d=n(15),f=S(d);t.Sortable=f;var p=d.Direction;t.Direction=p;var h=d.DOMRect;t.DOMRect=h;var v=d.GroupOptions;t.GroupOptions=v;var g=d.MoveEvent;t.MoveEvent=g;var m=d.Options;t.Options=m;var b=d.PullResult;t.PullResult=b;var y=d.PutResult;t.PutResult=y;var w=d.SortableEvent;t.SortableEvent=w;var E=d.SortableOptions;t.SortableOptions=E;var O=d.Utils;function S(e){return e&&e.__esModule?e.default:e}function D(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e){null!==e.parentElement&&e.parentElement.removeChild(e)}function T(e){e.forEach((function(e){return I(e.element)}))}function j(e){e.forEach((function(e){var t,n,o,r;t=e.parentElement,n=e.element,o=e.oldIndex,r=t.children[o]||null,t.insertBefore(n,r)}))}function M(e,t){var n=N(e),o={parentElement:e.from},r=[];switch(n){case"normal":r=[{element:e.item,newIndex:e.newIndex,oldIndex:e.oldIndex,parentElement:e.from}];break;case"swap":r=[x({element:e.item,oldIndex:e.oldIndex,newIndex:e.newIndex},o),x({element:e.swapItem,oldIndex:e.newIndex,newIndex:e.oldIndex},o)];break;case"multidrag":r=e.oldIndicies.map((function(t,n){return x({element:t.multiDragElement,oldIndex:t.index,newIndex:e.newIndicies[n].index},o)}))}return function(e,t){return e.map((function(e){return x(x({},e),{},{item:t[e.oldIndex]})})).sort((function(e,t){return e.oldIndex-t.oldIndex}))}(r,t)}function A(e,t){var n=D(t);return e.concat().reverse().forEach((function(e){return n.splice(e.oldIndex,1)})),n}function k(e,t,n,o){var r=D(t);return e.forEach((function(e){var t=o&&n&&o(e.item,n);r.splice(e.newIndex,0,t||e.item)})),r}function N(e){return e.oldIndicies&&e.oldIndicies.length>0?"multidrag":e.swapItem?"swap":"normal"}function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function L(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach((function(t){W(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function H(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t){return!t||"object"!==R(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.Utils=O;var K={dragging:null},G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}(d,l);var t,n,r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=z(e);if(t){var r=z(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return F(this,n)}}(d);function d(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),(t=r.call(this,e)).ref=c();var n=e.list.map((function(e){return Y(Y({},e),{},{chosen:!1,selected:!1})}));return e.setList(n,t.sortable,K),o(!e.plugins,'\nPlugins prop is no longer supported.\nInstead, mount it with "Sortable.mount(new MultiDrag())"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n '),t}return t=d,(n=[{key:"componentDidMount",value:function(){if(null!==this.ref.current){var e=this.makeOptions();f.create(this.ref.current,e)}}},{key:"render",value:function(){var e=this.props,t=e.tag,n={style:e.style,className:e.className,id:e.id};return s(t&&null!==t?t:"div",Y({ref:this.ref},n),this.getChildren())}},{key:"getChildren",value:function(){var e=this.props,t=e.children,n=e.dataIdAttr,o=e.selectedClass,r=void 0===o?"sortable-selected":o,l=e.chosenClass,s=void 0===l?"sortable-chosen":l,c=(e.dragClass,e.fallbackClass,e.ghostClass,e.swapClass,e.filter),d=void 0===c?"sortable-filter":c,f=e.list;if(!t||null==t)return null;var p=n||"data-id";return a.map(t,(function(e,t){var n,o,a=f[t],l=e.props.className,c="string"==typeof d&&W({},d.replace(".",""),!!a.filtered),h=u(l,Y((W(n={},r,a.selected),W(n,s,a.chosen),n),c));return i(e,(W(o={},p,e.key),W(o,"className",h),o))}))}},{key:"makeOptions",value:function(){var e,t=this,n=((e=this.props).list,e.setList,e.children,e.tag,e.style,e.className,e.clone,e.onAdd,e.onChange,e.onChoose,e.onClone,e.onEnd,e.onFilter,e.onRemove,e.onSort,e.onStart,e.onUnchoose,e.onUpdate,e.onMove,e.onSpill,e.onSelect,e.onDeselect,function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["list","setList","children","tag","style","className","clone","onAdd","onChange","onChoose","onClone","onEnd","onFilter","onRemove","onSort","onStart","onUnchoose","onUpdate","onMove","onSpill","onSelect","onDeselect"]));return["onAdd","onChoose","onDeselect","onEnd","onRemove","onSelect","onSpill","onStart","onUnchoose","onUpdate"].forEach((function(e){return n[e]=t.prepareOnHandlerPropAndDOM(e)})),["onChange","onClone","onFilter","onSort"].forEach((function(e){return n[e]=t.prepareOnHandlerProp(e)})),Y(Y({},n),{},{onMove:function(e,n){var o=t.props.onMove,r=e.willInsertAfter||-1;if(!o)return r;var a=o(e,n,t.sortable,K);return void 0!==a&&a}})}},{key:"prepareOnHandlerPropAndDOM",value:function(e){var t=this;return function(n){t.callOnHandlerProp(n,e),t[e](n)}}},{key:"prepareOnHandlerProp",value:function(e){var t=this;return function(n){t.callOnHandlerProp(n,e)}}},{key:"callOnHandlerProp",value:function(e,t){var n=this.props[t];n&&n(e,this.sortable,K)}},{key:"onAdd",value:function(e){var t=this.props,n=t.list,o=t.setList,r=t.clone,a=M(e,L(K.dragging.props.list));T(a),o(k(a,n,e,r).map((function(e){return Y(Y({},e),{},{selected:!1})})),this.sortable,K)}},{key:"onRemove",value:function(e){var t=this,n=this.props,r=n.list,a=n.setList,i=N(e),l=M(e,r);j(l);var s=L(r);if("clone"!==e.pullMode)s=A(l,s);else{var c=l;switch(i){case"multidrag":c=l.map((function(t,n){return Y(Y({},t),{},{element:e.clones[n]})}));break;case"normal":c=l.map((function(t){return Y(Y({},t),{},{element:e.clone})}));break;case"swap":default:o(!0,'mode "'.concat(i,'" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "').concat(i,'" plugin'))}T(c),l.forEach((function(n){var o=n.oldIndex,r=t.props.clone(n.item,e);s.splice(o,1,r)}))}a(s=s.map((function(e){return Y(Y({},e),{},{selected:!1})})),this.sortable,K)}},{key:"onUpdate",value:function(e){var t=this.props,n=t.list,o=t.setList,r=M(e,n);return T(r),j(r),o(function(e,t){return k(e,A(e,t))}(r,n),this.sortable,K)}},{key:"onStart",value:function(){K.dragging=this}},{key:"onEnd",value:function(){K.dragging=null}},{key:"onChoose",value:function(e){var t=this.props,n=t.list;(0,t.setList)(n.map((function(t,n){return n===e.oldIndex?Y(Y({},t),{},{chosen:!0}):t})),this.sortable,K)}},{key:"onUnchoose",value:function(e){var t=this.props,n=t.list;(0,t.setList)(n.map((function(t,n){return n===e.oldIndex?Y(Y({},t),{},{chosen:!1}):t})),this.sortable,K)}},{key:"onSpill",value:function(e){var t=this.props,n=t.removeOnSpill,o=t.revertOnSpill;n&&!o&&I(e.item)}},{key:"onSelect",value:function(e){var t=this.props,n=t.list,o=t.setList,r=n.map((function(e){return Y(Y({},e),{},{selected:!1})}));e.newIndicies.forEach((function(t){var n=t.index;if(-1===n)return console.log('"'.concat(e.type,'" had indice of "').concat(t.index,"\", which is probably -1 and doesn't usually happen here.")),void console.log(e);r[n].selected=!0})),o(r,this.sortable,K)}},{key:"onDeselect",value:function(e){var t=this.props,n=t.list,o=t.setList,r=n.map((function(e){return Y(Y({},e),{},{selected:!1})}));e.newIndicies.forEach((function(e){var t=e.index;-1!==t&&(r[t].selected=!0)})),o(r,this.sortable,K)}},{key:"sortable",get:function(){var e=this.ref.current;if(null===e)return null;var t=Object.keys(e).find((function(e){return e.includes("Sortable")}));return t?e[t]:null}}])&&H(t.prototype,n),d}();t.ReactSortable=G,W(G,"defaultProps",{clone:function(e){return e}})},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],o=!0,r=!1,a=void 0;try{for(var i,l=e[Symbol.iterator]();!(o=(i=l.next()).done)&&(n.push(i.value),!t||n.length!==t);o=!0);}catch(e){r=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(r)throw a}}return n}}},function(e,t,n){var o=n(9);e.exports=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){"use strict";var o=n(12);function r(){}function a(){}a.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,a,i){if(i!==o){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);t.default=function(e,t){if(!e)throw new Error("Invariant failed")}},function(e,t,n){var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)&&o.length){var i=r.apply(null,o);i&&e.push(i)}else if("object"===a)for(var l in o)n.call(o,l)&&o[l]&&e.push(l)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},function(e,t,n){"use strict";function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function r(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}n.r(t),n.d(t,"Sortable",(function(){return Ne}));var a=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),i=r(/Edge/i),l=r(/firefox/i),s=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),c=r(/iP(ad|od|hone)/i),u=r(/chrome/i)&&r(/android/i),d={capture:!1,passive:!1};function f(e,t,n){e.addEventListener(t,n,!a&&d)}function p(e,t,n){e.removeEventListener(t,n,!a&&d)}function h(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function v(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function g(e,t,n,o){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&h(e,t):h(e,t))||o&&e===n)return e;if(e===n)break}while(e=v(e))}return null}var m,b=/\s+/g;function y(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var o=(" "+e.className+" ").replace(b," ").replace(" "+t+" "," ");e.className=(o+(n?" "+t:"")).replace(b," ")}}function w(e,t,n){var o=e&&e.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in o||-1!==t.indexOf("webkit")||(t="-webkit-"+t),o[t]=n+("string"==typeof n?"":"px")}}function E(e,t){var n="";if("string"==typeof e)n=e;else do{var o=w(e,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function O(e,t,n){if(e){var o=e.getElementsByTagName(t),r=0,a=o.length;if(n)for(;r<a;r++)n(o[r],r);return o}return[]}function S(){return document.scrollingElement||document.documentElement}function D(e,t,n,o,r){if(e.getBoundingClientRect||e===window){var i,l,s,c,u,d,f;if(e!==window&&e!==S()?(l=(i=e.getBoundingClientRect()).top,s=i.left,c=i.bottom,u=i.right,d=i.height,f=i.width):(l=0,s=0,c=window.innerHeight,u=window.innerWidth,d=window.innerHeight,f=window.innerWidth),(t||n)&&e!==window&&(r=r||e.parentNode,!a))do{if(r&&r.getBoundingClientRect&&("none"!==w(r,"transform")||n&&"static"!==w(r,"position"))){var p=r.getBoundingClientRect();l-=p.top+parseInt(w(r,"border-top-width")),s-=p.left+parseInt(w(r,"border-left-width")),c=l+i.height,u=s+i.width;break}}while(r=r.parentNode);if(o&&e!==window){var h=E(r||e),v=h&&h.a,g=h&&h.d;h&&(c=(l/=g)+(d/=g),u=(s/=v)+(f/=v))}return{top:l,left:s,bottom:c,right:u,width:f,height:d}}}function C(e,t,n){for(var o=T(e,!0),r=D(e)[t];o;){var a=D(o)[n];if(!("top"===n||"left"===n?r>=a:r<=a))return o;if(o===S())break;o=T(o,!1)}return!1}function _(e,t,n){for(var o=0,r=0,a=e.children;r<a.length;){if("none"!==a[r].style.display&&a[r]!==Ne.ghost&&a[r]!==Ne.dragged&&g(a[r],n.draggable,e,!1)){if(o===t)return a[r];o++}r++}return null}function x(e,t){for(var n=e.lastElementChild;n&&(n===Ne.ghost||"none"===w(n,"display")||t&&!h(n,t));)n=n.previousElementSibling;return n||null}function P(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Ne.clone||t&&!h(e,t)||n++;return n}function I(e){var t=0,n=0,o=S();if(e)do{var r=E(e);t+=e.scrollLeft*r.a,n+=e.scrollTop*r.d}while(e!==o&&(e=e.parentNode));return[t,n]}function T(e,t){if(!e||!e.getBoundingClientRect)return S();var n=e,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var r=w(n);if(n.clientWidth<n.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!n.getBoundingClientRect||n===document.body)return S();if(o||t)return n;o=!0}}}while(n=n.parentNode);return S()}function j(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function M(e,t){return function(){if(!m){var n=arguments,o=this;1===n.length?e.call(o,n[0]):e.apply(o,n),m=setTimeout((function(){m=void 0}),t)}}}function A(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function k(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function N(e,t){w(e,"position","absolute"),w(e,"top",t.top),w(e,"left",t.left),w(e,"width",t.width),w(e,"height",t.height)}function R(e){w(e,"position",""),w(e,"top",""),w(e,"left",""),w(e,"width",""),w(e,"height","")}var L="Sortable"+(new Date).getTime(),B=[],X={initializeByDefault:!0},Y={mount:function(e){for(var t in X)X.hasOwnProperty(t)&&!(t in e)&&(e[t]=X[t]);B.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var a=e+"Global";B.forEach((function(r){t[r.pluginName]&&(t[r.pluginName][a]&&t[r.pluginName][a](o({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](o({sortable:t},n)))}))},initializePlugins:function(e,t,n,o){for(var r in B.forEach((function(o){var r=o.pluginName;if(e.options[r]||o.initializeByDefault){var a=new o(e,t,e.options);a.sortable=e,a.options=e.options,e[r]=a,Object.assign(n,a.defaults)}})),e.options)if(e.options.hasOwnProperty(r)){var a=this.modifyOption(e,r,e.options[r]);void 0!==a&&(e.options[r]=a)}},getEventProperties:function(e,t){var n={};return B.forEach((function(o){"function"==typeof o.eventProperties&&Object.assign(n,o.eventProperties.call(t[o.pluginName],e))})),n},modifyOption:function(e,t,n){var o;return B.forEach((function(r){e[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[t]&&(o=r.optionListeners[t].call(e[r.pluginName],n))})),o}};function H(e){var t=e.sortable,n=e.rootEl,r=e.name,l=e.targetEl,s=e.cloneEl,c=e.toEl,u=e.fromEl,d=e.oldIndex,f=e.newIndex,p=e.oldDraggableIndex,h=e.newDraggableIndex,v=e.originalEvent,g=e.putSortable,m=e.extraEventProperties;if(t=t||n&&n[L]){var b,y=t.options,w="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||a||i?(b=document.createEvent("Event")).initEvent(r,!0,!0):b=new CustomEvent(r,{bubbles:!0,cancelable:!0}),b.to=c||n,b.from=u||n,b.item=l||n,b.clone=s,b.oldIndex=d,b.newIndex=f,b.oldDraggableIndex=p,b.newDraggableIndex=h,b.originalEvent=v,b.pullMode=g?g.lastPutMode:void 0;var E=o({},m,Y.getEventProperties(r,t));for(var O in E)b[O]=E[O];n&&n.dispatchEvent(b),y[w]&&y[w].call(t,b)}}var U=function(e,t,n){var r=void 0===n?{}:n,a=r.evt,i=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)t.indexOf(n=a[o])>=0||(r[n]=e[n]);return r}(r,["evt"]);Y.pluginEvent.bind(Ne)(e,t,o({dragEl:z,parentEl:W,ghostEl:K,rootEl:G,nextEl:q,lastDownEl:V,cloneEl:$,cloneHidden:Z,dragStarted:ue,putSortable:oe,activeSortable:Ne.active,originalEvent:a,oldIndex:J,oldDraggableIndex:ee,newIndex:Q,newDraggableIndex:te,hideGhostForTarget:Te,unhideGhostForTarget:je,cloneNowHidden:function(){Z=!0},cloneNowShown:function(){Z=!1},dispatchSortableEvent:function(e){F({sortable:t,name:e,originalEvent:a})}},i))};function F(e){H(o({putSortable:oe,cloneEl:$,targetEl:z,rootEl:G,oldIndex:J,oldDraggableIndex:ee,newIndex:Q,newDraggableIndex:te},e))}var z,W,K,G,q,V,$,Z,J,Q,ee,te,ne,oe,re,ae,ie,le,se,ce,ue,de,fe,pe,he,ve=!1,ge=!1,me=[],be=!1,ye=!1,we=[],Ee=!1,Oe=[],Se="undefined"!=typeof document,De=c,Ce=i||a?"cssFloat":"float",_e=Se&&!u&&!c&&"draggable"in document.createElement("div"),xe=function(){if(Se){if(a)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Pe=function(e,t){var n=w(e),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=_(e,0,t),a=_(e,1,t),i=r&&w(r),l=a&&w(a),s=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+D(r).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+D(a).width;return"flex"===n.display?"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal":"grid"===n.display?n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal":r&&i.float&&"none"!==i.float?!a||"both"!==l.clear&&l.clear!==("left"===i.float?"left":"right")?"horizontal":"vertical":r&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||s>=o&&"none"===n[Ce]||a&&"none"===n[Ce]&&s+c>o)?"vertical":"horizontal"},Ie=function(e){function t(e,n){return function(o,r,a,i){if(null==e&&(n||o.options.group.name&&r.options.group.name&&o.options.group.name===r.options.group.name))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(o,r,a,i),n)(o,r,a,i);var l=(n?o:r).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},o=e.group;o&&"object"==typeof o||(o={name:o}),n.name=o.name,n.checkPull=t(o.pull,!0),n.checkPut=t(o.put),n.revertClone=o.revertClone,e.group=n},Te=function(){!xe&&K&&w(K,"display","none")},je=function(){!xe&&K&&w(K,"display","")};Se&&document.addEventListener("click",(function(e){if(ge)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ge=!1,!1}),!0);var Me,Ae=function(e){if(z){var t=(r=(e=e.touches?e.touches[0]:e).clientX,a=e.clientY,me.some((function(e){if(!x(e)){var t=D(e),n=e[L].options.emptyInsertThreshold;return n&&r>=t.left-n&&r<=t.right+n&&a>=t.top-n&&a<=t.bottom+n?i=e:void 0}})),i);if(t){var n={};for(var o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[L]._onDragOver(n)}}var r,a,i},ke=function(e){z&&z.parentNode[L]._isOutsideThisEl(e.target)};function Ne(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not "+{}.toString.call(e);this.el=e,this.options=t=Object.assign({},t),e[L]=this;var n,r,a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Pe(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Ne.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var i in Y.initializePlugins(this,e,a),a)!(i in t)&&(t[i]=a[i]);for(var l in Ie(t),this)"_"===l.charAt(0)&&"function"==typeof this[l]&&(this[l]=this[l].bind(this));this.nativeDraggable=!t.forceFallback&&_e,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?f(e,"pointerdown",this._onTapStart):(f(e,"mousedown",this._onTapStart),f(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(f(e,"dragover",this),f(e,"dragenter",this)),me.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),Object.assign(this,(r=[],{captureAnimationState:function(){r=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==w(e,"display")&&void 0!==e){r.push({target:e,rect:D(e)});var t=o({},r[r.length-1].rect);if(e.thisAnimationDuration){var n=E(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){r.push(e)},removeAnimationState:function(e){r.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var o in t)if(t.hasOwnProperty(o)&&t[o]===e[n][o])return Number(n);return-1}(r,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var o=!1,a=0;r.forEach((function(e){var n=0,r=e.target,i=r.fromRect,l=D(r),s=r.prevFromRect,c=r.prevToRect,u=e.rect,d=E(r,!0);d&&(l.top-=d.f,l.left-=d.e),r.toRect=l,r.thisAnimationDuration&&j(s,l)&&!j(i,l)&&(u.top-l.top)/(u.left-l.left)==(i.top-l.top)/(i.left-l.left)&&(n=function(e,t,n,o){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*o.animation}(u,s,c,t.options)),j(l,i)||(r.prevFromRect=i,r.prevToRect=l,n||(n=t.options.animation),t.animate(r,u,l,n)),n&&(o=!0,a=Math.max(a,n),clearTimeout(r.animationResetTimer),r.animationResetTimer=setTimeout((function(){r.animationTime=0,r.prevFromRect=null,r.fromRect=null,r.prevToRect=null,r.thisAnimationDuration=null}),n),r.thisAnimationDuration=n)})),clearTimeout(n),o?n=setTimeout((function(){"function"==typeof e&&e()}),a):"function"==typeof e&&e(),r=[]},animate:function(e,t,n,o){if(o){w(e,"transition",""),w(e,"transform","");var r=E(this.el),a=(t.left-n.left)/(r&&r.a||1),i=(t.top-n.top)/(r&&r.d||1);e.animatingX=!!a,e.animatingY=!!i,w(e,"transform","translate3d("+a+"px,"+i+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),w(e,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),w(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){w(e,"transition",""),w(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),o)}}}))}function Re(e,t,n,o,r,l,s,c){var u,d,f=e[L],p=f.options.onMove;return!window.CustomEvent||a||i?(u=document.createEvent("Event")).initEvent("move",!0,!0):u=new CustomEvent("move",{bubbles:!0,cancelable:!0}),u.to=t,u.from=e,u.dragged=n,u.draggedRect=o,u.related=r||t,u.relatedRect=l||D(t),u.willInsertAfter=c,u.originalEvent=s,e.dispatchEvent(u),p&&(d=p.call(f,u,s)),d}function Le(e){e.draggable=!1}function Be(){Ee=!1}function Xe(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,o=0;n--;)o+=t.charCodeAt(n);return o.toString(36)}function Ye(e){return setTimeout(e,0)}function He(e){return clearTimeout(e)}Ne.prototype={constructor:Ne,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(de=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,z):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,o=this.options,r=o.preventOnFilter,a=e.type,i=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(i||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,u=o.filter;if(function(e){Oe.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var o=t[n];o.checked&&Oe.push(o)}}(n),!z&&!(/mousedown|pointerdown/.test(a)&&0!==e.button||o.disabled)&&!c.isContentEditable&&(this.nativeDraggable||!s||!l||"SELECT"!==l.tagName.toUpperCase())&&!((l=g(l,o.draggable,n,!1))&&l.animated||V===l)){if(J=P(l),ee=P(l,o.draggable),"function"==typeof u){if(u.call(this,e,l,this))return F({sortable:t,rootEl:c,name:"filter",targetEl:l,toEl:n,fromEl:n}),U("filter",t,{evt:e}),void(r&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(o){if(o=g(c,o.trim(),n,!1))return F({sortable:t,rootEl:o,name:"filter",targetEl:l,fromEl:n,toEl:n}),U("filter",t,{evt:e}),!0}))))return void(r&&e.cancelable&&e.preventDefault());o.handle&&!g(c,o.handle,n,!1)||this._prepareDragStart(e,i,l)}}},_prepareDragStart:function(e,t,n){var o,r=this,s=r.el,c=r.options,u=s.ownerDocument;if(n&&!z&&n.parentNode===s){var d=D(n);if(G=s,W=(z=n).parentNode,q=z.nextSibling,V=n,ne=c.group,Ne.dragged=z,se=(re={target:z,clientX:(t||e).clientX,clientY:(t||e).clientY}).clientX-d.left,ce=re.clientY-d.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,z.style["will-change"]="all",o=function(){U("delayEnded",r,{evt:e}),Ne.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!l&&r.nativeDraggable&&(z.draggable=!0),r._triggerDragStart(e,t),F({sortable:r,name:"choose",originalEvent:e}),y(z,c.chosenClass,!0))},c.ignore.split(",").forEach((function(e){O(z,e.trim(),Le)})),f(u,"dragover",Ae),f(u,"mousemove",Ae),f(u,"touchmove",Ae),f(u,"mouseup",r._onDrop),f(u,"touchend",r._onDrop),f(u,"touchcancel",r._onDrop),l&&this.nativeDraggable&&(this.options.touchStartThreshold=4,z.draggable=!0),U("delayStart",this,{evt:e}),!c.delay||c.delayOnTouchOnly&&!t||this.nativeDraggable&&(i||a))o();else{if(Ne.eventCanceled)return void this._onDrop();f(u,"mouseup",r._disableDelayedDrag),f(u,"touchend",r._disableDelayedDrag),f(u,"touchcancel",r._disableDelayedDrag),f(u,"mousemove",r._delayedDragTouchMoveHandler),f(u,"touchmove",r._delayedDragTouchMoveHandler),c.supportPointer&&f(u,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(o,c.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){z&&Le(z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;p(e,"mouseup",this._disableDelayedDrag),p(e,"touchend",this._disableDelayedDrag),p(e,"touchcancel",this._disableDelayedDrag),p(e,"mousemove",this._delayedDragTouchMoveHandler),p(e,"touchmove",this._delayedDragTouchMoveHandler),p(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?f(document,this.options.supportPointer?"pointermove":t?"touchmove":"mousemove",this._onTouchMove):(f(z,"dragend",this),f(G,"dragstart",this._onDragStart));try{document.selection?Ye((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(ve=!1,G&&z){U("dragStarted",this,{evt:t}),this.nativeDraggable&&f(document,"dragover",ke);var n=this.options;!e&&y(z,n.dragClass,!1),y(z,n.ghostClass,!0),Ne.active=this,e&&this._appendGhost(),F({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(ae){this._lastX=ae.clientX,this._lastY=ae.clientY,Te();for(var e=document.elementFromPoint(ae.clientX,ae.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ae.clientX,ae.clientY))!==t;)t=e;if(z.parentNode[L]._isOutsideThisEl(e),t)do{if(t[L]&&t[L]._onDragOver({clientX:ae.clientX,clientY:ae.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);je()}},_onTouchMove:function(e){if(re){var t=this.options,n=t.fallbackTolerance,o=t.fallbackOffset,r=e.touches?e.touches[0]:e,a=K&&E(K,!0),i=K&&a&&a.a,l=K&&a&&a.d,s=De&&he&&I(he),c=(r.clientX-re.clientX+o.x)/(i||1)+(s?s[0]-we[0]:0)/(i||1),u=(r.clientY-re.clientY+o.y)/(l||1)+(s?s[1]-we[1]:0)/(l||1);if(!Ne.active&&!ve){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(K){a?(a.e+=c-(ie||0),a.f+=u-(le||0)):a={a:1,b:0,c:0,d:1,e:c,f:u};var d="matrix("+a.a+","+a.b+","+a.c+","+a.d+","+a.e+","+a.f+")";w(K,"webkitTransform",d),w(K,"mozTransform",d),w(K,"msTransform",d),w(K,"transform",d),ie=c,le=u,ae=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!K){var e=this.options.fallbackOnBody?document.body:G,t=D(z,!0,De,!0,e),n=this.options;if(De){for(he=e;"static"===w(he,"position")&&"none"===w(he,"transform")&&he!==document;)he=he.parentNode;he!==document.body&&he!==document.documentElement?(he===document&&(he=S()),t.top+=he.scrollTop,t.left+=he.scrollLeft):he=S(),we=I(he)}y(K=z.cloneNode(!0),n.ghostClass,!1),y(K,n.fallbackClass,!0),y(K,n.dragClass,!0),w(K,"transition",""),w(K,"transform",""),w(K,"box-sizing","border-box"),w(K,"margin",0),w(K,"top",t.top),w(K,"left",t.left),w(K,"width",t.width),w(K,"height",t.height),w(K,"opacity","0.8"),w(K,"position",De?"absolute":"fixed"),w(K,"zIndex","100000"),w(K,"pointerEvents","none"),Ne.ghost=K,e.appendChild(K),w(K,"transform-origin",se/parseInt(K.style.width)*100+"% "+ce/parseInt(K.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,o=e.dataTransfer,r=n.options;U("dragStart",this,{evt:e}),Ne.eventCanceled?this._onDrop():(U("setupClone",this),Ne.eventCanceled||(($=k(z)).draggable=!1,$.style["will-change"]="",this._hideClone(),y($,this.options.chosenClass,!1),Ne.clone=$),n.cloneId=Ye((function(){U("clone",n),Ne.eventCanceled||(n.options.removeCloneOnHide||G.insertBefore($,z),n._hideClone(),F({sortable:n,name:"clone"}))})),!t&&y(z,r.dragClass,!0),t?(ge=!0,n._loopId=setInterval(n._emulateDragOver,50)):(p(document,"mouseup",n._onDrop),p(document,"touchend",n._onDrop),p(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",r.setData&&r.setData.call(n,o,z)),f(document,"drop",n),w(z,"transform","translateZ(0)")),ve=!0,n._dragStartId=Ye(n._dragStarted.bind(n,t,e)),f(document,"selectstart",n),ue=!0,s&&w(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,r,a,i=this.el,l=e.target,s=this.options,c=s.group,u=Ne.active,d=ne===c,f=s.sort,p=oe||u,h=this,v=!1;if(!Ee){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),l=g(l,s.draggable,i,!0),B("dragOver"),Ne.eventCanceled)return v;if(z.contains(e.target)||l.animated&&l.animatingX&&l.animatingY||h._ignoreWhileAnimating===l)return Y(!1);if(ge=!1,u&&!s.disabled&&(d?f||(r=!G.contains(z)):oe===this||(this.lastPutMode=ne.checkPull(this,u,z,e))&&c.checkPut(this,u,z,e))){if(a="vertical"===this._getDirection(e,l),t=D(z),B("dragOverValid"),Ne.eventCanceled)return v;if(r)return W=G,X(),this._hideClone(),B("revert"),Ne.eventCanceled||(q?G.insertBefore(z,q):G.appendChild(z)),Y(!0);var m=x(i,s.draggable);if(!m||function(e,t,n){var o=D(x(n.el,n.options.draggable));return t?e.clientX>o.right+10||e.clientX<=o.right&&e.clientY>o.bottom&&e.clientX>=o.left:e.clientX>o.right&&e.clientY>o.top||e.clientX<=o.right&&e.clientY>o.bottom+10}(e,a,this)&&!m.animated){if(m===z)return Y(!1);if(m&&i===e.target&&(l=m),l&&(n=D(l)),!1!==Re(G,i,z,t,l,n,e,!!l))return X(),i.appendChild(z),W=i,H(),Y(!0)}else if(l.parentNode===i){n=D(l);var b,E,O,S=z.parentNode!==i,_=!function(e,t,n){var o=n?e.left:e.top,r=n?t.left:t.top;return o===r||(n?e.right:e.bottom)===(n?t.right:t.bottom)||o+(n?e.width:e.height)/2===r+(n?t.width:t.height)/2}(z.animated&&z.toRect||t,l.animated&&l.toRect||n,a),I=a?"top":"left",T=C(l,"top","top")||C(z,"top","top"),j=T?T.scrollTop:void 0;if(de!==l&&(E=n[I],be=!1,ye=!_&&s.invertSwap||S),0!==(b=function(e,t,n,o,r,a,i,l){var s=o?e.clientY:e.clientX,c=o?n.height:n.width,u=o?n.top:n.left,d=o?n.bottom:n.right,f=!1;if(!i)if(l&&pe<c*r){if(!be&&(1===fe?s>u+c*a/2:s<d-c*a/2)&&(be=!0),be)f=!0;else if(1===fe?s<u+pe:s>d-pe)return-fe}else if(s>u+c*(1-r)/2&&s<d-c*(1-r)/2)return function(e){return P(z)<P(e)?1:-1}(t);return(f=f||i)&&(s<u+c*a/2||s>d-c*a/2)?s>u+c/2?1:-1:0}(e,l,n,a,_?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,ye,de===l))){var M=P(z);do{O=W.children[M-=b]}while(O&&("none"===w(O,"display")||O===K))}if(0===b||O===l)return Y(!1);de=l,fe=b;var k=l.nextElementSibling,N=!1,R=Re(G,i,z,t,l,n,e,N=1===b);if(!1!==R)return 1!==R&&-1!==R||(N=1===R),Ee=!0,setTimeout(Be,30),X(),N&&!k?i.appendChild(z):l.parentNode.insertBefore(z,N?k:l),T&&A(T,0,j-T.scrollTop),W=z.parentNode,void 0===E||ye||(pe=Math.abs(E-D(l)[I])),H(),Y(!0)}if(i.contains(z))return Y(!1)}return!1}function B(s,c){U(s,h,o({evt:e,isOwner:d,axis:a?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:f,fromSortable:p,target:l,completed:Y,onMove:function(n,o){return Re(G,i,z,t,n,D(n),e,o)},changed:H},c))}function X(){B("dragOverAnimationCapture"),h.captureAnimationState(),h!==p&&p.captureAnimationState()}function Y(t){return B("dragOverCompleted",{insertion:t}),t&&(d?u._hideClone():u._showClone(h),h!==p&&(y(z,oe?oe.options.ghostClass:u.options.ghostClass,!1),y(z,s.ghostClass,!0)),oe!==h&&h!==Ne.active?oe=h:h===Ne.active&&oe&&(oe=null),p===h&&(h._ignoreWhileAnimating=l),h.animateAll((function(){B("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(l===z&&!z.animated||l===i&&!l.animated)&&(de=null),s.dragoverBubble||e.rootEl||l===document||(z.parentNode[L]._isOutsideThisEl(e.target),!t&&Ae(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),v=!0}function H(){Q=P(z),te=P(z,s.draggable),F({sortable:h,name:"change",toEl:i,newIndex:Q,newDraggableIndex:te,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){p(document,"mousemove",this._onTouchMove),p(document,"touchmove",this._onTouchMove),p(document,"pointermove",this._onTouchMove),p(document,"dragover",Ae),p(document,"mousemove",Ae),p(document,"touchmove",Ae)},_offUpEvents:function(){var e=this.el.ownerDocument;p(e,"mouseup",this._onDrop),p(e,"touchend",this._onDrop),p(e,"pointerup",this._onDrop),p(e,"touchcancel",this._onDrop),p(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;Q=P(z),te=P(z,n.draggable),U("drop",this,{evt:e}),W=z&&z.parentNode,Q=P(z),te=P(z,n.draggable),Ne.eventCanceled||(ve=!1,ye=!1,be=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),He(this.cloneId),He(this._dragStartId),this.nativeDraggable&&(p(document,"drop",this),p(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),s&&w(document.body,"user-select",""),w(z,"transform",""),e&&(ue&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),K&&K.parentNode&&K.parentNode.removeChild(K),(G===W||oe&&"clone"!==oe.lastPutMode)&&$&&$.parentNode&&$.parentNode.removeChild($),z&&(this.nativeDraggable&&p(z,"dragend",this),Le(z),z.style["will-change"]="",ue&&!ve&&y(z,oe?oe.options.ghostClass:this.options.ghostClass,!1),y(z,this.options.chosenClass,!1),F({sortable:this,name:"unchoose",toEl:W,newIndex:null,newDraggableIndex:null,originalEvent:e}),G!==W?(Q>=0&&(F({rootEl:W,name:"add",toEl:W,fromEl:G,originalEvent:e}),F({sortable:this,name:"remove",toEl:W,originalEvent:e}),F({rootEl:W,name:"sort",toEl:W,fromEl:G,originalEvent:e}),F({sortable:this,name:"sort",toEl:W,originalEvent:e})),oe&&oe.save()):Q!==J&&Q>=0&&(F({sortable:this,name:"update",toEl:W,originalEvent:e}),F({sortable:this,name:"sort",toEl:W,originalEvent:e})),Ne.active&&(null!=Q&&-1!==Q||(Q=J,te=ee),F({sortable:this,name:"end",toEl:W,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){U("nulling",this),G=z=W=K=q=$=V=Z=re=ae=ue=Q=te=J=ee=de=fe=oe=ne=Ne.dragged=Ne.ghost=Ne.clone=Ne.active=null,Oe.forEach((function(e){e.checked=!0})),Oe.length=ie=le=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":z&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,o=0,r=n.length,a=this.options;o<r;o++)g(e=n[o],a.draggable,this.el,!1)&&t.push(e.getAttribute(a.dataIdAttr)||Xe(e));return t},sort:function(e){var t={},n=this.el;this.toArray().forEach((function(e,o){var r=n.children[o];g(r,this.options.draggable,n,!1)&&(t[e]=r)}),this),e.forEach((function(e){t[e]&&(n.removeChild(t[e]),n.appendChild(t[e]))}))},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return g(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var o=Y.modifyOption(this,e,t);n[e]=void 0!==o?o:t,"group"===e&&Ie(n)},destroy:function(){U("destroy",this);var e=this.el;e[L]=null,p(e,"mousedown",this._onTapStart),p(e,"touchstart",this._onTapStart),p(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(p(e,"dragover",this),p(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),me.splice(me.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Z){if(U("hideClone",this),Ne.eventCanceled)return;w($,"display","none"),this.options.removeCloneOnHide&&$.parentNode&&$.parentNode.removeChild($),Z=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Z){if(U("showClone",this),Ne.eventCanceled)return;z.parentNode!=G||this.options.group.revertClone?q?G.insertBefore($,q):G.appendChild($):G.insertBefore($,z),this.options.group.revertClone&&this.animate(z,$),w($,"display",""),Z=!1}}else this._hideClone()}},Se&&f(document,"touchmove",(function(e){(Ne.active||ve)&&e.cancelable&&e.preventDefault()})),Ne.utils={on:f,off:p,css:w,find:O,is:function(e,t){return!!g(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:M,closest:g,toggleClass:y,clone:k,index:P,nextTick:Ye,cancelNextTick:He,detectDirection:Pe,getChild:_},Ne.get=function(e){return e[L]},Ne.mount=function(){var e=[].slice.call(arguments);e[0].constructor===Array&&(e=e[0]),e.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not "+{}.toString.call(e);e.utils&&(Ne.utils=o({},Ne.utils,e.utils)),Y.mount(e)}))},Ne.create=function(e,t){return new Ne(e,t)},Ne.version="1.12.0";var Ue,Fe,ze,We,Ke,Ge=[],qe=[],Ve=!1,$e=!1,Ze=!1;function Je(e,t){qe.forEach((function(n,o){var r=t.children[n.sortableIndex+(e?Number(o):0)];r?t.insertBefore(n,r):t.appendChild(n)}))}function Qe(){Ge.forEach((function(e){e!==ze&&e.parentNode&&e.parentNode.removeChild(e)}))}var et=function(e){var t=e.originalEvent,n=e.putSortable,o=e.dragEl,r=e.dispatchSortableEvent,a=e.unhideGhostForTarget;if(t){var i=n||e.activeSortable;(0,e.hideGhostForTarget)();var l=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,s=document.elementFromPoint(l.clientX,l.clientY);a(),i&&!i.el.contains(s)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function tt(){}function nt(){}tt.prototype={startIndex:null,dragStart:function(e){this.startIndex=e.oldDraggableIndex},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=_(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(t,o):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:et},Object.assign(tt,{pluginName:"revertOnSpill"}),nt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:et},Object.assign(nt,{pluginName:"removeOnSpill"});var ot,rt,at,it,lt,st,ct=[],ut=!1;function dt(){ct.forEach((function(e){clearInterval(e.pid)})),ct=[]}function ft(){clearInterval(st)}var pt=M((function(e,t,n,o){if(t.scroll){var r,a=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,l=t.scrollSensitivity,s=t.scrollSpeed,c=S(),u=!1;rt!==n&&(rt=n,dt(),r=t.scrollFn,!0===(ot=t.scroll)&&(ot=T(n,!0)));var d=0,f=ot;do{var p=f,h=D(p),v=h.top,g=h.bottom,m=h.left,b=h.right,y=h.width,E=h.height,O=void 0,C=void 0,_=p.scrollWidth,x=p.scrollHeight,P=w(p),I=p.scrollLeft,j=p.scrollTop;p===c?(O=y<_&&("auto"===P.overflowX||"scroll"===P.overflowX||"visible"===P.overflowX),C=E<x&&("auto"===P.overflowY||"scroll"===P.overflowY||"visible"===P.overflowY)):(O=y<_&&("auto"===P.overflowX||"scroll"===P.overflowX),C=E<x&&("auto"===P.overflowY||"scroll"===P.overflowY));var M=O&&(Math.abs(b-a)<=l&&I+y<_)-(Math.abs(m-a)<=l&&!!I),k=C&&(Math.abs(g-i)<=l&&j+E<x)-(Math.abs(v-i)<=l&&!!j);if(!ct[d])for(var N=0;N<=d;N++)ct[N]||(ct[N]={});ct[d].vx==M&&ct[d].vy==k&&ct[d].el===p||(ct[d].el=p,ct[d].vx=M,ct[d].vy=k,clearInterval(ct[d].pid),0==M&&0==k||(u=!0,ct[d].pid=setInterval(function(){o&&0===this.layer&&Ne.active._onTouchMove(lt);var t=ct[this.layer].vy?ct[this.layer].vy*s:0,n=ct[this.layer].vx?ct[this.layer].vx*s:0;"function"==typeof r&&"continue"!==r.call(Ne.dragged.parentNode[L],n,t,e,lt,ct[this.layer].el)||A(ct[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==c&&(f=T(f,!1)));ut=u}}),30);Ne.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?f(document,"dragover",this._handleAutoScroll):f(document,this.options.supportPointer?"pointermove":t.touches?"touchmove":"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?p(document,"dragover",this._handleAutoScroll):(p(document,"pointermove",this._handleFallbackAutoScroll),p(document,"touchmove",this._handleFallbackAutoScroll),p(document,"mousemove",this._handleFallbackAutoScroll)),ft(),dt(),clearTimeout(m),m=void 0},nulling:function(){lt=rt=ot=ut=st=at=it=null,ct.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,o=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,l=document.elementFromPoint(o,r);if(lt=e,t||i||a||s){pt(e,this.options,l,t);var c=T(l,!0);!ut||st&&o===at&&r===it||(st&&ft(),st=setInterval((function(){var a=T(document.elementFromPoint(o,r),!0);a!==c&&(c=a,dt()),pt(e,n.options,a,t)}),10),at=o,it=r)}else{if(!this.options.bubbleScroll||T(l,!0)===S())return void dt();pt(e,this.options,T(l,!1),!1)}}},Object.assign(e,{pluginName:"scroll",initializeByDefault:!0})}),Ne.mount(nt,tt),Ne.mount(new function(){function e(){this.defaults={swapClass:"sortable-swap-highlight"}}return e.prototype={dragStart:function(e){Me=e.dragEl},dragOverValid:function(e){var t=e.completed,n=e.target,o=e.changed,r=e.cancel;if(e.activeSortable.options.swap){var a=this.options;if(n&&n!==this.sortable.el){var i=Me;!1!==(0,e.onMove)(n)?(y(n,a.swapClass,!0),Me=n):Me=null,i&&i!==Me&&y(i,a.swapClass,!1)}o(),t(!0),r()}},drop:function(e){var t,n,o,r,a,i,l=e.activeSortable,s=e.putSortable,c=e.dragEl,u=s||this.sortable,d=this.options;Me&&y(Me,d.swapClass,!1),Me&&(d.swap||s&&s.options.swap)&&c!==Me&&(u.captureAnimationState(),u!==l&&l.captureAnimationState(),i=(n=Me).parentNode,(a=(t=c).parentNode)&&i&&!a.isEqualNode(n)&&!i.isEqualNode(t)&&(o=P(t),r=P(n),a.isEqualNode(i)&&o<r&&r++,a.insertBefore(n,a.children[o]),i.insertBefore(t,i.children[r])),u.animateAll(),u!==l&&l.animateAll())},nulling:function(){Me=null}},Object.assign(e,{pluginName:"swap",eventProperties:function(){return{swapItem:Me}}})}),Ne.mount(new function(){function e(e){for(var t in this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this));e.options.supportPointer?f(document,"pointerup",this._deselectMultiDrag):(f(document,"mouseup",this._deselectMultiDrag),f(document,"touchend",this._deselectMultiDrag)),f(document,"keydown",this._checkKeyDown),f(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,setData:function(t,n){var o="";Ge.length&&Fe===e?Ge.forEach((function(e,t){o+=(t?", ":"")+e.textContent})):o=n.textContent,t.setData("Text",o)}}}return e.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal:function(e){ze=e.dragEl},delayEnded:function(){this.isMultiDrag=~Ge.indexOf(ze)},setupClone:function(e){var t=e.sortable,n=e.cancel;if(this.isMultiDrag){for(var o=0;o<Ge.length;o++)qe.push(k(Ge[o])),qe[o].sortableIndex=Ge[o].sortableIndex,qe[o].draggable=!1,qe[o].style["will-change"]="",y(qe[o],this.options.selectedClass,!1),Ge[o]===ze&&y(qe[o],this.options.chosenClass,!1);t._hideClone(),n()}},clone:function(e){var t=e.dispatchSortableEvent,n=e.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||Ge.length&&Fe===e.sortable&&(Je(!0,e.rootEl),t("clone"),n()))},showClone:function(e){var t=e.cloneNowShown,n=e.cancel;this.isMultiDrag&&(Je(!1,e.rootEl),qe.forEach((function(e){w(e,"display","")})),t(),Ke=!1,n())},hideClone:function(e){var t=this,n=e.cloneNowHidden,o=e.cancel;this.isMultiDrag&&(qe.forEach((function(e){w(e,"display","none"),t.options.removeCloneOnHide&&e.parentNode&&e.parentNode.removeChild(e)})),n(),Ke=!0,o())},dragStartGlobal:function(e){!this.isMultiDrag&&Fe&&Fe.multiDrag._deselectMultiDrag(),Ge.forEach((function(e){e.sortableIndex=P(e)})),Ge=Ge.sort((function(e,t){return e.sortableIndex-t.sortableIndex})),Ze=!0},dragStarted:function(e){var t=this,n=e.sortable;if(this.isMultiDrag){if(this.options.sort&&(n.captureAnimationState(),this.options.animation)){Ge.forEach((function(e){e!==ze&&w(e,"position","absolute")}));var o=D(ze,!1,!0,!0);Ge.forEach((function(e){e!==ze&&N(e,o)})),$e=!0,Ve=!0}n.animateAll((function(){$e=!1,Ve=!1,t.options.animation&&Ge.forEach((function(e){R(e)})),t.options.sort&&Qe()}))}},dragOver:function(e){var t=e.completed,n=e.cancel;$e&&~Ge.indexOf(e.target)&&(t(!1),n())},revert:function(e){var t=e.fromSortable,n=e.rootEl,o=e.sortable,r=e.dragRect;Ge.length>1&&(Ge.forEach((function(e){o.addAnimationState({target:e,rect:$e?D(e):r}),R(e),e.fromRect=r,t.removeAnimationState(e)})),$e=!1,function(e,t){Ge.forEach((function(n,o){var r=t.children[n.sortableIndex+(e?Number(o):0)];r?t.insertBefore(n,r):t.appendChild(n)}))}(!this.options.removeCloneOnHide,n))},dragOverCompleted:function(e){var t=e.sortable,n=e.isOwner,o=e.activeSortable,r=e.parentEl,a=e.putSortable,i=this.options;if(e.insertion){if(n&&o._hideClone(),Ve=!1,i.animation&&Ge.length>1&&($e||!n&&!o.options.sort&&!a)){var l=D(ze,!1,!0,!0);Ge.forEach((function(e){e!==ze&&(N(e,l),r.appendChild(e))})),$e=!0}if(!n)if($e||Qe(),Ge.length>1){var s=Ke;o._showClone(t),o.options.animation&&!Ke&&s&&qe.forEach((function(e){o.addAnimationState({target:e,rect:We}),e.fromRect=We,e.thisAnimationDuration=null}))}else o._showClone(t)}},dragOverAnimationCapture:function(e){var t=e.dragRect,n=e.isOwner,o=e.activeSortable;if(Ge.forEach((function(e){e.thisAnimationDuration=null})),o.options.animation&&!n&&o.multiDrag.isMultiDrag){We=Object.assign({},t);var r=E(ze,!0);We.top-=r.f,We.left-=r.e}},dragOverAnimationComplete:function(){$e&&($e=!1,Qe())},drop:function(e){var t=e.originalEvent,n=e.rootEl,o=e.parentEl,r=e.sortable,a=e.dispatchSortableEvent,i=e.oldIndex,l=e.putSortable,s=l||this.sortable;if(t){var c=this.options,u=o.children;if(!Ze)if(c.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),y(ze,c.selectedClass,!~Ge.indexOf(ze)),~Ge.indexOf(ze))Ge.splice(Ge.indexOf(ze),1),Ue=null,H({sortable:r,rootEl:n,name:"deselect",targetEl:ze,originalEvt:t});else{if(Ge.push(ze),H({sortable:r,rootEl:n,name:"select",targetEl:ze,originalEvt:t}),t.shiftKey&&Ue&&r.el.contains(Ue)){var d,f,p=P(Ue),h=P(ze);if(~p&&~h&&p!==h)for(h>p?(f=p,d=h):(f=h,d=p+1);f<d;f++)~Ge.indexOf(u[f])||(y(u[f],c.selectedClass,!0),Ge.push(u[f]),H({sortable:r,rootEl:n,name:"select",targetEl:u[f],originalEvt:t}))}else Ue=ze;Fe=s}if(Ze&&this.isMultiDrag){if((o[L].options.sort||o!==n)&&Ge.length>1){var v=D(ze),g=P(ze,":not(."+this.options.selectedClass+")");if(!Ve&&c.animation&&(ze.thisAnimationDuration=null),s.captureAnimationState(),!Ve&&(c.animation&&(ze.fromRect=v,Ge.forEach((function(e){if(e.thisAnimationDuration=null,e!==ze){var t=$e?D(e):v;e.fromRect=t,s.addAnimationState({target:e,rect:t})}}))),Qe(),Ge.forEach((function(e){u[g]?o.insertBefore(e,u[g]):o.appendChild(e),g++})),i===P(ze))){var m=!1;Ge.forEach((function(e){e.sortableIndex===P(e)||(m=!0)})),m&&a("update")}Ge.forEach((function(e){R(e)})),s.animateAll()}Fe=s}(n===o||l&&"clone"!==l.lastPutMode)&&qe.forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)}))}},nullingGlobal:function(){this.isMultiDrag=Ze=!1,qe.length=0},destroyGlobal:function(){this._deselectMultiDrag(),p(document,"pointerup",this._deselectMultiDrag),p(document,"mouseup",this._deselectMultiDrag),p(document,"touchend",this._deselectMultiDrag),p(document,"keydown",this._checkKeyDown),p(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(void 0!==Ze&&Ze||Fe!==this.sortable||e&&g(e.target,this.options.draggable,this.sortable.el,!1)||e&&0!==e.button))for(;Ge.length;){var t=Ge[0];y(t,this.options.selectedClass,!1),Ge.shift(),H({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:t,originalEvt:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},Object.assign(e,{pluginName:"multiDrag",utils:{select:function(e){var t=e.parentNode[L];t&&t.options.multiDrag&&!~Ge.indexOf(e)&&(Fe&&Fe!==t&&(Fe.multiDrag._deselectMultiDrag(),Fe=t),y(e,t.options.selectedClass,!0),Ge.push(e))},deselect:function(e){var t=e.parentNode[L],n=Ge.indexOf(e);t&&t.options.multiDrag&&~n&&(y(e,t.options.selectedClass,!1),Ge.splice(n,1))}},eventProperties:function(){var e=this,t=[],n=[];return Ge.forEach((function(o){var r;t.push({multiDragElement:o,index:o.sortableIndex}),r=$e&&o!==ze?-1:$e?P(o,":not(."+e.options.selectedClass+")"):P(o),n.push({multiDragElement:o,index:r})})),{items:[].concat(Ge),clones:[].concat(qe),oldIndicies:t,newIndicies:n}},optionListeners:{multiDragKey:function(e){return"ctrl"===(e=e.toLowerCase())?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}),t.default=Ne},function(e,t,n){"use strict";n.r(t);var o=n(0),r=n(2),a=n.n(r),i=n(3),l=n.n(i),s=n(4),c=n.n(s),u=n(5),d=n(1);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){l()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var h=wp.i18n.__,v=wp.components,g=v.Dashicon,m=v.TextControl,b=v.Button,y=function(e){window.svgIcons;var t=Object(d.useState)({open:!1}),n=a()(t,2),r=n[0],i=n[1],l=Object(o.createElement)("span",{className:"description customize-control-description"},h("Enter alternative URL which provides above selected language translation of your site.","astra-addon"));return Object(o.createElement)("div",{className:"ahfb-sorter-item","data-id":e.item.id,key:e.item.id},Object(o.createElement)("div",{className:"ahfb-sorter-item-panel-header",onClick:function(){i((function(e){return p(p({},e),{},{open:!r.open})}))}},Object(o.createElement)("span",{className:"ahfb-sorter-title"},void 0!==e.item.label&&""!==e.item.label?e.item.label:h("Language Item","astra-addon")),Object(o.createElement)(b,{className:"ahfb-sorter-item-expand ".concat(e.item.enabled?"item-is-visible":"item-is-hidden"),onClick:function(t){t.stopPropagation(),e.toggleEnabled(!e.item.enabled,e.index)}},Object(o.createElement)(g,{icon:"visibility"})),Object(o.createElement)(b,{className:"ahfb-sorter-item-remove",isDestructive:!0,onClick:function(){e.removeItem(e.index)}},Object(o.createElement)(g,{icon:"no-alt"}))),r.open&&Object(o.createElement)("div",{className:"ahfb-sorter-item-panel-content"},Object(o.createElement)(m,{label:h("Label","astra-addon"),value:e.item.label?e.item.label:"",onChange:function(t){e.onChangeLabel(t,e.index)}}),Object(o.createElement)(m,{label:h("URL","astra-addon"),value:e.item.url?e.item.url:"",onChange:function(t){e.onChangeURL(t,e.index)}}),l))};function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){l()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var O=wp.i18n.__,S=wp.components,D=S.Button,C=S.SelectControl,_=function(e){var t=e.control.setting.get(),n={items:[{id:"gb",enabled:!0,url:"",label:O("English","astra-addon")}]},r=e.control.params.default?E(E({},n),e.control.params.default):n;t=t?E(E({},r),t):r;var i={group:"language_selector_group",options:[{label:O("Albanian","astra-addon"),value:"al"},{label:O("Arabic","astra-addon"),value:"sa"},{label:O("Bengali","astra-addon"),value:"bd"},{label:O("Bulgarian","astra-addon"),value:"bg"},{label:O("Chinese","astra-addon"),value:"cn"},{label:O("Croatian","astra-addon"),value:"hr"},{label:O("Czech","astra-addon"),value:"cz"},{label:O("English","astra-addon"),value:"gb"},{label:O("French","astra-addon"),value:"fr"},{label:O("German","astra-addon"),value:"de"},{label:O("Greek","astra-addon"),value:"gr"},{label:O("Hebrew","astra-addon"),value:"il"},{label:O("Hindi","astra-addon"),value:"in"},{label:O("Hungarian","astra-addon"),value:"hu"},{label:O("Icelandic","astra-addon"),value:"is"},{label:O("Indonesian","astra-addon"),value:"id"},{label:O("Italian","astra-addon"),value:"it"},{label:O("Japanese","astra-addon"),value:"jp"},{label:O("Korean","astra-addon"),value:"kr"},{label:O("Latvian","astra-addon"),value:"lv"},{label:O("Lithuanian","astra-addon"),value:"lt"},{label:O("Macedonian","astra-addon"),value:"mk"},{label:O("Malay","astra-addon"),value:"my"},{label:O("Maltese","astra-addon"),value:"mt"},{label:O("Mongolian","astra-addon"),value:"mn"},{label:O("Nepali","astra-addon"),value:"np"},{label:O("Dutch","astra-addon"),value:"nl"},{label:O("Norwegian Bokmål","astra-addon"),value:"no"},{label:O("Persian","astra-addon"),value:"ir"},{label:O("Polish","astra-addon"),value:"pl"},{label:O("Portuguese, Portugal","astra-addon"),value:"pt"},{label:O("Romanian","astra-addon"),value:"ro"},{label:O("Russian","astra-addon"),value:"ru"},{label:O("Serbian","astra-addon"),value:"rs"},{label:O("Slovak","astra-addon"),value:"sk"},{label:O("Slovenian","astra-addon"),value:"si"},{label:O("Somali","astra-addon"),value:"so"},{label:O("Spanish","astra-addon"),value:"es"},{label:O("Swedish","astra-addon"),value:"se"},{label:O("Tamil","astra-addon"),value:"lk"},{label:O("Thai","astra-addon"),value:"th"},{label:O("Turkish","astra-addon"),value:"tr"},{label:O("Ukrainian","astra-addon"),value:"ua"},{label:O("Urdu","astra-addon"),value:"pk"},{label:O("Uzbek","astra-addon"),value:"uz"},{label:O("Vietnamese","astra-addon"),value:"vn"},{label:O("Zulu","astra-addon"),value:"za"},{label:O("Other","astra-addon"),value:"zz-other"}].sort((function(e,t){return e.label<t.label?-1:e.label>t.label?1:0}))},l=e.control.params.input_attrs?E(E({},i),e.control.params.input_attrs):i,s=[];l.options.map((function(e){t.items.some((function(t){return t.id===e.value}))||s.push(e)}));var c=Object(d.useState)({value:t,isVisible:!1,control:void 0!==s[0]&&void 0!==s[0].value?s[0].value:""}),f=a()(c,2),p=f[0],h=f[1];Object(d.useEffect)((function(){h((function(t){return E(E({},t),{},{value:e.control.setting.get()})}))}),[e]);var v=function(t){e.control.setting.set(E(E(E({},e.control.setting.get()),t),{},{flag:!e.control.setting.get().flag}))},g=function(){var e,t=document.querySelectorAll(".ahfb-builder-area");for(e=0;e<t.length;++e)t[e].classList.remove("ahfb-dragging-dropzones")},m=function(e,t){var n=p.value,o=n.items.map((function(n,o){return t===o&&(n=E(E({},n),e)),n}));n.items=o,h((function(e){return E(E({},e),{},{value:n})})),v(n)},b=function(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!=t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0},w=void 0!==p.value&&null!=p.value.items&&null!=p.value.items.length&&p.value.items.length>0?p.value.items:[],S=[];w.length>0&&w.map((function(e){S.push({id:e.id})})),l.options.map((function(e){S.some((function(t){return t.id===e.value}))||s.push(e)}));return Object(o.createElement)("div",{className:"ahfb-control-field ahfb-sorter-items"},Object(o.createElement)("div",{className:"ahfb-sorter-row"},Object(o.createElement)(u.ReactSortable,{animation:100,onStart:function(){return g()},onEnd:function(){return g()},group:l.group,className:"ahfb-sorter-drop ahfb-sorter-sortable-panel ahfb-sorter-drop-".concat(l.group),handle:".ahfb-sorter-item-panel-header",list:S,setList:function(e){return t=e,n=p.value,o=n.items,r=[],t.length>0&&t.map((function(e){o.filter((function(t){t.id===e.id&&r.push(t)}))})),void(b(o,r)||(o.items=r,n.items=r,h((function(e){return E(E({},e),{},{value:n})})),v(n)));var t,n,o,r}},w.length>0&&w.map((function(e,t){return Object(o.createElement)(y,{removeItem:function(e){return t=e,n=p.value,o=n.items,r=[],o.length>0&&o.map((function(e,n){t!==n&&r.push(e)})),n.items=r,h((function(e){return E(E({},e),{},{value:n})})),void v(n);var t,n,o,r},toggleEnabled:function(e,t){return function(e,t){m({enabled:e},t)}(e,t)},onChangeLabel:function(e,t){return function(e,t){m({label:e},t)}(e,t)},onChangeURL:function(e,t){return function(e,t){m({url:e},t)}(e,t)},key:e.id,index:t,item:e,controlParams:l})})))),void 0!==s[0]&&void 0!==s[0].value&&Object(o.createElement)("div",{className:"ahfb-language-selector-add-area"},Object(o.createElement)(C,{value:p.control,options:s,onChange:function(e){h((function(t){return E(E({},t),{},{control:e})}))}}),Object(o.createElement)(D,{className:"ahfb-sorter-add-item",isPrimary:!0,onClick:function(){!function(){var e=p.control;if(h((function(e){return E(E({},e),{},{isVisible:!1})})),e){var t=p.value,n=t.items,o=l.options.filter((function(t){return t.value===e})),r={id:e,enabled:!0,url:"",label:o[0].label};n.push(r),t.items=n;var a=[];l.options.map((function(e){n.some((function(t){return t.id===e.value}))||a.push(e)})),h((function(e){return E(E({},e),{},{control:void 0!==a[0]&&void 0!==a[0].value?a[0].value:""})})),h((function(e){return E(E({},e),{},{value:t})})),v(t)}}()}},O("Add Language","astra-addon"))))};_.propTypes={control:c.a.object.isRequired};var x=_,P=wp.customize.Control.extend({renderContent:function(){ReactDOM.render(Object(o.createElement)(x,{control:this}),this.container[0])}});wp.customize.controlConstructor["ast-language-selector"]=P}]); customizer/class-astra-addon-customizer.php 0000644 00000017654 15150261777 0015213 0 ustar 00 <?php /** * Astra Addon Customizer * * @package Astra Addon * @since 1.0.0 */ if ( ! class_exists( 'Astra_Addon_Customizer' ) ) : /** * Astra_Addon_Customizer * * @since 1.0.0 */ class Astra_Addon_Customizer { /** * Instance * * @since 1.0.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.0.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor * * @since 1.4.0 */ public function __construct() { add_action( 'customize_register', array( $this, 'customize_register' ) ); add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'customize_register', array( $this, 'customize_register_new' ), 3 ); } /** * Register custom section and panel. * * @since 1.0.0 * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ public function customize_register_new( $wp_customize ) { require ASTRA_EXT_DIR . 'classes/customizer/class-astra-customizer-notices-configs.php'; } /** * Register custom section and panel. * * @since 1.0.0 * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ public function customize_register( $wp_customize ) { // if Customizer Control base class exist. if ( class_exists( 'Astra_Customizer_Control_Base' ) ) { /** * Add Controls */ Astra_Customizer_Control_Base::add_control( 'ast-customizer-refresh', array( 'callback' => 'Astra_Control_Customizer_refresh', 'sanitize_callback' => '', ) ); } // Control Class files. require ASTRA_EXT_DIR . 'classes/customizer/controls/class-astra-control-customizer-refresh.php'; } /** * Sanitize Alpha color * * @param string $color setting input. * @return string setting input value. */ public static function sanitize_alpha_color( $color ) { if ( '' === $color ) { return ''; } if ( false === strpos( $color, 'rgba' ) ) { /* Hex sanitize */ return Astra_Customizer_Sanitizes::sanitize_hex_color( $color ); } /* rgba sanitize */ $color = str_replace( ' ', '', $color ); sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')'; } /** * Sanitize background obj * * @param array $bg_obj Background object. * @return array Background object. */ public static function sanitize_background_obj( $bg_obj ) { if ( is_callable( 'Astra_Customizer_Sanitizes::sanitize_background_obj' ) ) { return Astra_Customizer_Sanitizes::sanitize_background_obj( $bg_obj ); } return $bg_obj; } /** * Sanitize Border * * @param array $border Background object. * @return array Background object. */ public static function sanitize_border( $border ) { if ( is_callable( 'Astra_Customizer_Sanitizes::sanitize_border' ) ) { return Astra_Customizer_Sanitizes::sanitize_border( $border ); } return $border; } /** * Sanitize Responsive Background Image * * @param array $bg_obj Background object. * @return array Background object. */ public static function sanitize_responsive_background( $bg_obj ) { if ( is_callable( 'Astra_Customizer_Sanitizes::sanitize_responsive_background' ) ) { return Astra_Customizer_Sanitizes::sanitize_responsive_background( $bg_obj ); } // Default Responsive Background Image. $defaults = 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', ), ); // Merge responsive background object and default object into $out_bg_obj array. $out_bg_obj = wp_parse_args( $bg_obj, $defaults ); foreach ( $out_bg_obj as $device => $bg ) { foreach ( $bg as $key => $value ) { if ( 'background-image' === $key ) { $out_bg_obj[ $device ] [ $key ] = esc_url_raw( $value ); } else { $out_bg_obj[ $device ] [ $key ] = esc_attr( $value ); } } } return $out_bg_obj; } /** * Sanitize Box Shadow control * * @since 3.3.0 * @param array|number $val Customizer setting input number. * @return array Return number. */ public static function sanitize_box_shadow( $val ) { $box_shadow = array( 'x' => '', 'y' => '', 'blur' => '', 'spread' => '', ); if ( is_array( $val ) ) { $box_shadow['x'] = is_numeric( $val['x'] ) ? $val['x'] : ''; $box_shadow['y'] = is_numeric( $val['y'] ) ? $val['y'] : ''; $box_shadow['blur'] = is_numeric( $val['blur'] ) ? $val['blur'] : ''; $box_shadow['spread'] = is_numeric( $val['spread'] ) ? $val['spread'] : ''; } return $box_shadow; } /** * Sanitize Responsive Color * * @param array $color_obj color object. * @return array color object. */ public static function sanitize_responsive_color( $color_obj ) { // Default Responsive Background Image. $defaults = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); // Merge responsive color object and default object into $out_color_obj array. $out_color_obj = wp_parse_args( $color_obj, $defaults ); foreach ( $out_color_obj as $device => $color ) { $out_color_obj[ $device ] = Astra_Customizer_Sanitizes::sanitize_alpha_color( $color ); } return $out_color_obj; } /** * Enqueue Admin Scripts * * @since 3.1.0 */ public function enqueue_scripts() { $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; $js_uri = ASTRA_EXT_URI . 'classes/customizer/assets/js/'; wp_enqueue_style( 'ast-ext-admin-settings', ASTRA_EXT_URI . 'admin/assets/css/customizer-controls.css', array(), ASTRA_EXT_VER ); if ( ! SCRIPT_DEBUG ) { // Enqueue Customizer script. $custom_controls_deps = array( 'jquery', 'customize-base', 'jquery-ui-tabs', 'jquery-ui-sortable', 'wp-i18n', 'wp-components', 'wp-element', 'wp-media-utils', 'wp-block-editor', ); wp_enqueue_script( 'astra-addon-custom-control-script', $js_uri . 'custom-controls.min.js', $custom_controls_deps, ASTRA_EXT_VER, true ); } else { // Enqueue Customizer React.JS script. $custom_controls_react_deps = array( 'astra-custom-control-plain-script', 'wp-i18n', 'wp-components', 'wp-element', 'wp-media-utils', 'wp-block-editor', ); wp_enqueue_script( 'astra-addon-custom-control-react-script', ASTRA_EXT_URI . 'classes/customizer/extend-controls/build/index.js', $custom_controls_react_deps, ASTRA_EXT_VER, true ); } } } /** * Initialize class object with 'get_instance()' method */ Astra_Addon_Customizer::get_instance(); endif; customizer/class-astra-customizer-notices-configs.php 0000644 00000017612 15150261777 0017212 0 ustar 00 <?php /** * Customizer Notices Class. * Display Relavant notices in the customizer panels and sections to improve UX. * * @package Astra Addon * @link https://www.brainstormforce.com * @since 1.4.0 */ // Block direct access to the file. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer config base class does not exist. if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } if ( ! class_exists( 'Astra_Customizer_Notices_Configs' ) ) : /** * The Customizer class. */ // @codingStandardsIgnoreStart class Astra_Customizer_Notices_Configs extends Astra_Customizer_Config_Base { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Register General Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 1.4.3 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { // Add controls only if Advanced Hooks addon is active. if ( defined( 'ASTRA_ADVANCED_HOOKS_POST_TYPE' ) ) { $_configs = array(); if ( true === astra_addon_builder_helper()->is_header_footer_builder_active ) { $_configs = array( /** * Notice for custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[ast-callback-notice-custom-layout]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'section-header-builder-layout', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), ); } else { $_configs = array( /** * Notice for Above header created using custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-custom-layout-above-header]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'section-above-header', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), /** * Notice for Below header created using custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-custom-layout-below-header]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'section-below-header', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), /** * Notice for Primary header created using custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-custom-layout-header]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'section-header', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), /** * Notice for Sticky header created using custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-custom-layout-sticky-header]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'section-sticky-header', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), /** * Notice for Transparent header created using custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-custom-layout-transparent-header]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'section-transparent-header', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), /** * Notice for Colors - Primary header created using custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-custom-color-primary-header]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'section-colors-primary-menu', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), /** * Notice for Title & Tagline section when header is created using custom layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[header-custom-title_tagline]', 'type' => 'control', 'control' => 'ast-description', 'section' => 'title_tagline', 'priority' => 1, 'active_callback' => array( $this, 'is_custom_layout_header' ), 'help' => $this->get_help_text_notice( 'custom-header' ), ), ); } $configurations = array_merge( $configurations, $_configs ); } return $configurations; } /** * Help notice message to be displayed when the page that is being previewed has header built using Custom Layout. * * @since 1.4.0 * @param String $context Type of notice message to be returned. * @return String HTML Markup for the help notice. */ private function get_help_text_notice( $context ) { switch ( $context ) { case 'custom-header': $notice = '<div class="ast-customizer-notice wp-ui-highlight"><p>The header on the page you are previewing is built using Custom Layouts. Options given below will not work here.</p><p> <a href="' . $this->get_custom_layout_edit_link() . '" target="_blank">Click here</a> to modify the header on this page.<p></div>'; break; default: $notice = ''; break; } return $notice; } /** * Return post edit page url for Custom Layouts post type. * * @return String Admin URL for Custom Layouts post edit screen. */ private function get_custom_layout_edit_link() { return admin_url( 'edit.php?post_type=astra-advanced-hook' ); } /** * Decide if Notice for Header Built using Custom Layout should be displayed. * This runs teh target rules to check if the page neing previewed has a header built using Custom Layout. * * @return boolean True - If the notice should be displayed, False - If the notice should be hidden. */ public function is_custom_layout_header() { $option = array( 'location' => 'ast-advanced-hook-location', 'exclusion' => 'ast-advanced-hook-exclusion', 'users' => 'ast-advanced-hook-users', ); $advanced_hooks = Astra_Target_Rules_Fields::get_instance()->get_posts_by_conditions( ASTRA_ADVANCED_HOOKS_POST_TYPE, $option ); foreach ( $advanced_hooks as $post_id => $post_data ) { $custom_post_enable = get_post_meta( $post_id, 'ast-advanced-hook-enabled', true ); $layout = get_post_meta( $post_id, 'ast-advanced-hook-layout', false ); if ( isset( $layout[0] ) && 'header' === $layout[0] && 'no' !== $custom_post_enable ) { return true; } } return false; } } endif; new Astra_Customizer_Notices_Configs(); deprecated/deprecated-actions.php 0000644 00000003761 15150261777 0013135 0 ustar 00 <?php /** * Deprecated Actions of Astra Addon. * * @package Astra * @link https://wpastra.com/ * @since Astra 3.5.7 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( function_exists( 'astra_do_action_deprecated' ) ) { /** * Depreciating Astra AJAX pgination actions. * * @since 3.5.7 */ astra_do_action_deprecated( 'astra_shop_pagination_infinite', array(), '3.5.7' ); astra_do_action_deprecated( 'astra_pagination_infinite', array(), '3.5.7' ); } // Depreciating astra_get_css_files hook. add_action( 'astra_addon_get_css_files', 'astra_deprecated_astra_get_css_files_hook' ); /** * Depreciating 'astra_get_css_files' action & replacing with 'astra_addon_get_css_files'. * * @since 3.6.2 */ function astra_deprecated_astra_get_css_files_hook() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound astra_do_action_deprecated( 'astra_get_css_files', array(), '3.6.2', 'astra_addon_get_css_files' ); } // Depreciating astra_get_js_files hook. add_action( 'astra_addon_get_js_files', 'astra_deprecated_astra_get_js_files_hook' ); /** * Depreciating 'astra_get_js_files' action & replacing with 'astra_addon_get_js_files'. * * @since 3.6.2 */ function astra_deprecated_astra_get_js_files_hook() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound astra_do_action_deprecated( 'astra_get_js_files', array(), '3.6.2', 'astra_addon_get_js_files' ); } // Depreciating astra_after_render_js hook. add_action( 'astra_addon_after_render_js', 'astra_deprecated_astra_after_render_js_hook' ); /** * Depreciating 'astra_after_render_js' action & replacing with 'astra_addon_after_render_js'. * * @since 3.6.2 */ function astra_deprecated_astra_after_render_js_hook() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound astra_do_action_deprecated( 'astra_after_render_js', array(), '3.6.2', 'astra_addon_after_render_js' ); } deprecated/deprecated-filters.php 0000644 00000041303 15150261777 0013137 0 ustar 00 <?php /** * Deprecated Filters of Astra Addon. * * @package Astra * @link https://wpastra.com/ * @since Astra 3.5.7 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( function_exists( 'astra_apply_filters_deprecated' ) ) { /** * Astra search results post type filter added for AJAX action * * @since 3.5.7 */ $astra_addon_post_type_condition = 'any'; astra_apply_filters_deprecated( 'astra_infinite_pagination_post_type', array( $astra_addon_post_type_condition ), '3.5.7' ); } // Deprecating astra_bb_render_content_by_id filter. add_filter( 'astra_addon_bb_render_content_by_id', 'astra_deprecated_astra_bb_render_content_by_id_filter', 10, 1 ); /** * Render Beaver Builder content by ID. * * @since 3.6.2 * @param boolean $render_content true | false. * @return boolean true for enabled | false for disable. * * @see astra_addon_bb_render_content_by_id */ function astra_deprecated_astra_bb_render_content_by_id_filter( $render_content ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_bb_render_content_by_id', array( $render_content ), '3.6.2', 'astra_addon_bb_render_content_by_id', '' ); } // Deprecating astra_get_assets_uploads_dir filter. add_filter( 'astra_addon_get_assets_uploads_dir', 'astra_deprecated_astra_get_assets_uploads_dir_filter', 10, 1 ); /** * Uplods astra assets dir data * * @since 3.6.2 * @param string $assets_dir directory name to be created in the WordPress uploads directory. * @return array Includes path & url. * * @see astra_addon_get_assets_uploads_dir */ function astra_deprecated_astra_get_assets_uploads_dir_filter( $assets_dir ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_get_assets_uploads_dir', array( $assets_dir ), '3.6.2', 'astra_addon_get_assets_uploads_dir', '' ); } // Deprecating astra_pro_show_branding filter. add_filter( 'astra_addon_show_branding', 'astra_deprecated_astra_pro_show_branding_filter', 10, 1 ); /** * Whitelabel branding markup. * * @since 3.6.2 * @param boolean $show_branding true | false. * @return boolean true for showing | false for hiding branding markup. * * @see astra_addon_show_branding */ function astra_deprecated_astra_pro_show_branding_filter( $show_branding ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_pro_show_branding', array( $show_branding ), '3.6.2', 'astra_addon_show_branding', '' ); } // Deprecating astra_dynamic_css filter. add_filter( 'astra_addon_dynamic_css', 'astra_deprecated_astra_dynamic_css_filter', 10, 1 ); /** * Dynamic CSS to be enqueue. * * @since 3.6.2 * @param string $dynamic_css Parsed CSS. * @return string * * @see astra_addon_dynamic_css */ function astra_deprecated_astra_dynamic_css_filter( $dynamic_css ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_dynamic_css', array( $dynamic_css ), '3.6.2', 'astra_addon_dynamic_css', '' ); } // Deprecating astra_add_css_file filter. add_filter( 'astra_addon_add_css_file', 'astra_deprecated_astra_add_css_file_filter', 10, 1 ); /** * Ading custom CSS file privilege. * * @since 3.6.2 * @param array $css_files All stylesheets. * * @see astra_addon_add_css_file */ function astra_deprecated_astra_add_css_file_filter( $css_files ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_add_css_file', array( $css_files ), '3.6.2', 'astra_addon_add_css_file', '' ); } // Deprecating astra_add_js_file filter. add_filter( 'astra_addon_add_js_file', 'astra_deprecated_astra_add_js_file_filter', 10, 1 ); /** * Ading custom JS file privilege. * * @since 3.6.2 * @param array $js_files All scripts. * * @see astra_addon_add_js_file */ function astra_deprecated_astra_add_js_file_filter( $js_files ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_add_js_file', array( $js_files ), '3.6.2', 'astra_addon_add_js_file', '' ); } // Deprecating astra_add_dependent_js_file filter. add_filter( 'astra_addon_add_dependent_js_file', 'astra_deprecated_astra_add_dependent_js_file_filter', 10, 1 ); /** * Get dependent JS files to generate. * * @since 3.6.2 * @param array $dependent_js_files Dependent script array. * * @see astra_addon_add_dependent_js_file */ function astra_deprecated_astra_add_dependent_js_file_filter( $dependent_js_files ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_add_dependent_js_file', array( $dependent_js_files ), '3.6.2', 'astra_addon_add_dependent_js_file', '' ); } // Deprecating astra_render_css filter. add_filter( 'astra_addon_render_css', 'astra_deprecated_astra_render_css_filter', 10, 1 ); /** * To be render dynamic CSS. * * @since 3.6.2 * @param array $css Dynamic CSS. * * @see astra_addon_render_css */ function astra_deprecated_astra_render_css_filter( $css ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_render_css', array( $css ), '3.6.2', 'astra_addon_render_css', '' ); } // Deprecating astra_render_js filter. add_filter( 'astra_addon_render_js', 'astra_deprecated_astra_render_js_filter', 10, 1 ); /** * To be render dynamic JS. * * @since 3.6.2 * @param array $js Dynamic JS. * * @see astra_addon_render_js */ function astra_deprecated_astra_render_js_filter( $js ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_render_js', array( $js ), '3.6.2', 'astra_addon_render_js', '' ); } // Deprecating astra_languages_directory filter. add_filter( 'astra_addon_languages_directory', 'astra_deprecated_astra_languages_directory_filter', 10, 1 ); /** * Plugin language directory. * * @since 3.6.2 * @param string $lang_dir The languages directory path. * @return string $lang_dir The languages directory path. * * @see astra_addon_languages_directory */ function astra_deprecated_astra_languages_directory_filter( $lang_dir ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_languages_directory', array( $lang_dir ), '3.6.2', 'astra_addon_languages_directory', '' ); } // Deprecating astra_ext_default_addons filter. add_filter( 'astra_addon_ext_default_addons', 'astra_deprecated_astra_ext_default_addons_filter', 10, 1 ); /** * Default addon list in Astra Addon. * * @since 3.6.2 * @param array $default_addons Default extensions from Astra Pro. * * @see astra_addon_ext_default_addons */ function astra_deprecated_astra_ext_default_addons_filter( $default_addons ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_ext_default_addons', array( $default_addons ), '3.6.2', 'astra_addon_ext_default_addons', '' ); } // Deprecating astra_get_addons filter. add_filter( 'astra_addon_get_addons', 'astra_deprecated_astra_get_addons_filter', 10, 1 ); /** * Astra addon's all modules list. * * @since 3.6.2 * @param array $extensions All Astra Pro's extensions. * * @see astra_addon_get_addons */ function astra_deprecated_astra_get_addons_filter( $extensions ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_get_addons', array( $extensions ), '3.6.2', 'astra_addon_get_addons', '' ); } // Deprecating astra_ext_enabled_extensions filter. add_filter( 'astra_addon_enabled_extensions', 'astra_deprecated_astra_ext_enabled_extensions_filter', 10, 1 ); /** * Astra addon's all active extensions. * * @since 3.6.2 * @param array $active_addons Astra Pro's active extensions. * * @see astra_addon_enabled_extensions */ function astra_deprecated_astra_ext_enabled_extensions_filter( $active_addons ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_ext_enabled_extensions', array( $active_addons ), '3.6.2', 'astra_addon_enabled_extensions', '' ); } // Deprecating astra_custom_404_options filter. add_filter( 'astra_addon_custom_404_options', 'astra_deprecated_astra_custom_404_options_filter', 10, 1 ); /** * Provide Custom 404 data array(). * * @since 3.6.2 * @param array $options 404 layout options. * * @see astra_addon_custom_404_options */ function astra_deprecated_astra_custom_404_options_filter( $options ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_custom_404_options', array( $options ), '3.6.2', 'astra_addon_custom_404_options', '' ); } // Deprecating astra_cache_asset_query_var filter. add_filter( 'astra_addon_cache_asset_query_var', 'astra_deprecated_astra_cache_asset_query_var_filter', 10, 1 ); /** * Get Current query type. * * @since 3.6.2 * @param string $slug single|archive. * * @see astra_addon_cache_asset_query_var */ function astra_deprecated_astra_cache_asset_query_var_filter( $slug ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_cache_asset_query_var', array( $slug ), '3.6.2', 'astra_addon_cache_asset_query_var', '' ); } // Deprecating astra_cache_asset_type filter. add_filter( 'astra_addon_cache_asset_type', 'astra_deprecated_astra_cache_asset_type_filter', 10, 1 ); /** * Get the archive title. * * @since 3.6.2 * @param string $title archive title. * @return string $title Returns the archive title. * * @see astra_addon_cache_asset_type */ function astra_deprecated_astra_cache_asset_type_filter( $title ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_cache_asset_type', array( $title ), '3.6.2', 'astra_addon_cache_asset_type', '' ); } // Deprecating astra_load_dynamic_css_inline filter. add_filter( 'astra_addon_load_dynamic_css_inline', 'astra_deprecated_astra_load_dynamic_css_inline_filter', 10, 1 ); /** * Enqueue the assets inline. * * @since 3.6.2 * @param bool $load_inline True|False. * * @see astra_addon_load_dynamic_css_inline */ function astra_deprecated_astra_load_dynamic_css_inline_filter( $load_inline ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_load_dynamic_css_inline', array( $load_inline ), '3.6.2', 'astra_addon_load_dynamic_css_inline', '' ); } // Deprecating astra_flags_svg filter. add_filter( 'astra_addon_flags_svg', 'astra_deprecated_astra_flags_svg_filter', 10, 1 ); /** * Builder components SVG icons. * * @since 3.6.2 * @param bool $svg_icons Component's SVG icons. * * @see astra_addon_flags_svg */ function astra_deprecated_astra_flags_svg_filter( $svg_icons ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_flags_svg', array( $svg_icons ), '3.6.2', 'astra_addon_flags_svg', '' ); } // Deprecating astra_display_on_list filter. add_filter( 'astra_addon_display_on_list', 'astra_deprecated_astra_display_on_list_filter', 10, 1 ); /** * Filter options displayed in the display conditions select field of Display conditions. * * @since 3.6.2 * @param array $selection_options Display conditions. * * @see astra_addon_display_on_list */ function astra_deprecated_astra_display_on_list_filter( $selection_options ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_display_on_list', array( $selection_options ), '3.6.2', 'astra_addon_display_on_list', '' ); } // Deprecating astra_location_rule_post_types filter. add_filter( 'astra_addon_location_rule_post_types', 'astra_deprecated_astra_location_rule_post_types_filter', 10, 1 ); /** * Get location selection post types. * * @since 3.6.2 * @param array $post_types Post tyoes based on to be targeted locations. * * @see astra_addon_location_rule_post_types */ function astra_deprecated_astra_location_rule_post_types_filter( $post_types ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_location_rule_post_types', array( $post_types ), '3.6.2', 'astra_addon_location_rule_post_types', '' ); } // Deprecating astra_user_roles_list filter. add_filter( 'astra_addon_user_roles_list', 'astra_deprecated_astra_user_roles_list_filter', 10, 1 ); /** * Filter options displayed in the user select field of Display conditions. * * @since 3.6.2 * @param array $selection_options User list options. * * @see astra_addon_user_roles_list */ function astra_deprecated_astra_user_roles_list_filter( $selection_options ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_user_roles_list', array( $selection_options ), '3.6.2', 'astra_addon_user_roles_list', '' ); } // Deprecating astra_target_page_settings filter. add_filter( 'astra_addon_target_page_settings', 'astra_deprecated_astra_target_page_settings_filter', 10, 2 ); /** * Targeted page|rule setting. * * @since 3.6.2 * @param array $current_layout Active custom layout. * @param array $layout_id Current layout ID. * * @return int|boolean If the current layout is to be displayed it will be returned back else a boolean will be passed. * * @see astra_addon_target_page_settings */ function astra_deprecated_astra_target_page_settings_filter( $current_layout, $layout_id ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_target_page_settings', array( $current_layout, $layout_id ), '3.6.2', 'astra_addon_target_page_settings', '' ); } // Deprecating astra_get_display_posts_by_conditions filter. add_filter( 'astra_addon_get_display_posts_by_conditions', 'astra_deprecated_astra_get_display_posts_by_conditions_filter', 10, 2 ); /** * Get posts by conditions * * @since 3.6.2 * @param array $current_page_data Passed query data. * @param string $post_type Post Type. * * @return object Posts. * * @see astra_addon_get_display_posts_by_conditions */ function astra_deprecated_astra_get_display_posts_by_conditions_filter( $current_page_data, $post_type ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_get_display_posts_by_conditions', array( $current_page_data, $post_type ), '3.6.2', 'astra_addon_get_display_posts_by_conditions', '' ); } // Deprecating astra_meta_args_post_by_condition filter. add_filter( 'astra_addon_meta_args_post_by_condition', 'astra_deprecated_astra_meta_args_post_by_condition_filter', 10, 3 ); /** * Get posts by conditions * * @since 3.6.2 * @param array $meta_args Metadata of custom layout. * @param array $q_obj Passed query object. * @param string $current_post_id Current Post Type. * * @return object Posts. * * @see astra_addon_meta_args_post_by_condition */ function astra_deprecated_astra_meta_args_post_by_condition_filter( $meta_args, $q_obj, $current_post_id ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_meta_args_post_by_condition', array( $meta_args, $q_obj, $current_post_id ), '3.6.2', 'astra_addon_meta_args_post_by_condition', '' ); } // Deprecating astra_pro_white_label_add_form filter. add_filter( 'astra_addon_white_label_add_form', 'astra_deprecated_astra_pro_white_label_add_form_filter', 10, 1 ); /** * Provide White Label structure markup. * * @since 3.6.2 * @param array $markup form markup. * * @return array Brading array * * @see astra_addon_white_label_add_form */ function astra_deprecated_astra_pro_white_label_add_form_filter( $markup ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound return astra_apply_filters_deprecated( 'astra_pro_white_label_add_form', array( $markup ), '3.6.2', 'astra_addon_white_label_add_form', '' ); } deprecated/deprecated-functions.php 0000644 00000060431 15150261777 0013502 0 ustar 00 <?php /** * Deprecated Functions of Astra Addon. * * @package Astra * @link https://wpastra.com/ * @since Astra 1.6.2 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! function_exists( 'astra_pagination_infinite' ) ) : /** * Deprecating astra_pagination_infinite function. * * @since 3.5.7 * @deprecated 3.5.7 */ function astra_pagination_infinite() { _deprecated_function( __FUNCTION__, '3.5.7' ); } endif; if ( ! function_exists( 'astra_shop_pagination_infinite' ) ) : /** * Deprecating astra_shop_pagination_infinite function. * * @since 3.5.7 * @deprecated 3.5.7 */ function astra_shop_pagination_infinite() { _deprecated_function( __FUNCTION__, '3.5.7' ); } endif; if ( ! function_exists( 'astra_addon_clear_assets_cache' ) ) : /** * Deprecating astra_addon_clear_assets_cache function. * * @since 3.5.9 * @deprecated 3.5.9 */ function astra_addon_clear_assets_cache() { _deprecated_function( __FUNCTION__, '3.5.9' ); } endif; /** * Deprecating astra_get_supported_posts function. * * Getting Astra theme name. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_get_supported_posts() * @param boolean $with_tax Post has taxonomy. * * @see astra_addon_get_supported_posts() * * @return string */ function astra_get_supported_posts( $with_tax ) { _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_get_supported_posts()' ); return astra_addon_get_supported_posts( $with_tax ); } /** * Deprecating astra_rgba2hex function. * * Getting Astra theme name. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_rgba2hex() * @param string $string Color code in RGBA / RGB format. * @param string $include_alpha Color code in RGBA / RGB format. * * @see astra_addon_rgba2hex() * * @return string Return HEX color code. */ function astra_rgba2hex( $string, $include_alpha = false ) { _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_rgba2hex()' ); return astra_addon_rgba2hex( $string, $include_alpha = false ); } /** * Deprecating astra_check_is_hex function. * * Getting Astra theme name. * * @since 3.6.2 * @param string $string Color code any format. * * @see astra_addon_check_is_hex() * * @return boolean Return true | false. */ function astra_check_is_hex( $string ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_check_is_hex()' ); return astra_addon_check_is_hex( $string ); } /** * Deprecating is_support_swap_mobile_below_header_sections function. * * Checking backward flag to support swapping of sections in mobile-below header. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_swap_mobile_below_header_sections() * @see astra_addon_swap_mobile_below_header_sections() * * @return bool true|false */ function is_support_swap_mobile_below_header_sections() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_swap_mobile_below_header_sections()' ); return astra_addon_swap_mobile_below_header_sections(); } /** * Deprecating sticky_header_default_site_title_tagline_css_comp function. * * Sticky header's title-tagline CSS compatibility backward check. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_sticky_site_title_tagline_css_comp() * @see astra_addon_sticky_site_title_tagline_css_comp() * * @return bool true|false */ function sticky_header_default_site_title_tagline_css_comp() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_sticky_site_title_tagline_css_comp()' ); return astra_addon_sticky_site_title_tagline_css_comp(); } /** * Deprecating is_support_swap_mobile_above_header_sections function. * * Checking backward flag to support swapping of sections in mobile-above header. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_support_swap_mobile_above_header_sections() * @see astra_addon_support_swap_mobile_above_header_sections() * * @return bool true|false */ function is_support_swap_mobile_above_header_sections() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_support_swap_mobile_above_header_sections()' ); return astra_addon_support_swap_mobile_above_header_sections(); } /** * Deprecating astra_return_content_layout_page_builder function. * * Getting 'page-builder' layout. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_return_content_layout_page_builder() * @see astra_addon_return_content_layout_page_builder() * * @return string page-builder string used for filter `astra_get_content_layout` */ function astra_return_content_layout_page_builder() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_return_content_layout_page_builder()' ); return astra_addon_return_content_layout_page_builder(); } /** * Deprecating astra_return_page_layout_no_sidebar function. * * Getting 'no-sidebar' layout option. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_return_page_layout_no_sidebar() * @see astra_addon_return_page_layout_no_sidebar() * * @return string page-builder string used for filter `astra_get_content_layout` */ function astra_return_page_layout_no_sidebar() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_return_page_layout_no_sidebar()' ); return astra_addon_return_page_layout_no_sidebar(); } /** * Deprecating astra_pro_is_emp_endpoint function. * * Checking if AMP is setup or not. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_is_amp_endpoint() * @see astra_addon_is_amp_endpoint() * * @return string page-builder string used for filter `astra_get_content_layout` */ function astra_pro_is_emp_endpoint() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_is_amp_endpoint()' ); return astra_addon_is_amp_endpoint(); } /** * Deprecating is_astra_breadcrumb_trail function. * * Checking if breadcrumb with trail. * * @since 3.6.2 * @param string $echo Whether to echo or return. * * @see astra_addon_is_breadcrumb_trail() * * @return string breadcrumb markup */ function is_astra_breadcrumb_trail( $echo ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_is_breadcrumb_trail()' ); return astra_addon_is_breadcrumb_trail( $echo ); } /** * Deprecating astra_breadcrumb_shortcode function. * * Breadcrumb markup shortcode based. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_breadcrumb_shortcode() * @see astra_addon_breadcrumb_shortcode() * * @return string */ function astra_breadcrumb_shortcode() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_breadcrumb_shortcode()' ); return astra_addon_breadcrumb_shortcode(); } /** * Deprecating astra_get_template function. * * Getting Astra Pro's template. * * @since 3.6.2 * @param string $template_name template path. E.g. (directory / template.php). * @param array $args (default: array()). * @param string $template_path (default: ''). * @param string $default_path (default: ''). * * @see astra_addon_get_template() * * @return callback */ function astra_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_get_template()' ); return astra_addon_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ); } /** * Deprecating astra_locate_template function. * * Locate Astra Pro's template. * * @since 3.6.2 * @param string $template_name template path. E.g. (directory / template.php). * @param string $template_path (default: ''). * @param string $default_path (default: ''). * * @see astra_addon_locate_template() * * @return string return the template path which is maybe filtered. */ function astra_locate_template( $template_name, $template_path = '', $default_path = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_locate_template()' ); return astra_addon_locate_template( $template_name, $template_path = '', $default_path = '' ); } /** * Deprecating astra_ext_adv_search_dynamic_css function. * * Advanced search's dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_adv_search_dynamic_css() * * @return string */ function astra_ext_adv_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_adv_search_dynamic_css()' ); return astra_addon_adv_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_advanced_search_dynamic_css function. * * Advanced search's dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_advanced_search_dynamic_css() * * @return string */ function astra_ext_advanced_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_advanced_search_dynamic_css()' ); return astra_addon_advanced_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_header_builder_sections_colors_dynamic_css function. * * Astra builder sections advanced color & background specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_builder_sections_colors_dynamic_css() * * @return string */ function astra_ext_header_builder_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_builder_sections_colors_dynamic_css()' ); return astra_addon_header_builder_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_header_sections_colors_dynamic_css function. * * Astra's old header sections dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_sections_colors_dynamic_css() * * @return string */ function astra_ext_header_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_sections_colors_dynamic_css()' ); return astra_addon_header_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ldrv3_dynamic_css function. * * Learndash extension specific dynamic CSS. * * @since 3.6.2 * * @see astra_addon_ldrv3_dynamic_css() * * @return string */ function astra_ldrv3_dynamic_css() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_ldrv3_dynamic_css()' ); return astra_addon_ldrv3_dynamic_css(); } /** * Deprecating astra_learndash_dynamic_css function. * * Learndash extension specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_learndash_dynamic_css() * * @return string */ function astra_learndash_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_learndash_dynamic_css()' ); return astra_addon_learndash_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_above_header_dynamic_css function. * * Astra's old header mobile layout specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_above_header_dynamic_css() * * @return string */ function astra_ext_mobile_above_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_above_header_dynamic_css()' ); return astra_addon_mobile_above_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_below_header_dynamic_css function. * * Astra's old header mobile layout specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_below_header_dynamic_css() * * @return string */ function astra_ext_mobile_below_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_below_header_dynamic_css()' ); return astra_addon_mobile_below_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_header_colors_background_dynamic_css function. * * Astra's old header mobile layout colors-background specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_header_colors_background_dynamic_css() * * @return string */ function astra_ext_mobile_header_colors_background_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_header_colors_background_dynamic_css()' ); return astra_addon_mobile_header_colors_background_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_header_spacing_dynamic_css function. * * Astra's old header mobile layout spacing specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_header_spacing_dynamic_css() * * @return string */ function astra_ext_mobile_header_spacing_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_header_spacing_dynamic_css()' ); return astra_addon_mobile_header_spacing_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_header_dynamic_css function. * * Astra's old header mobile layout specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_header_dynamic_css() * * @return string */ function astra_ext_mobile_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_header_dynamic_css()' ); return astra_addon_mobile_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mega_menu_dynamic_css function. * * Megamenu dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mega_menu_dynamic_css() * * @return string */ function astra_ext_mega_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mega_menu_dynamic_css()' ); return astra_addon_mega_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_scroll_to_top_dynamic_css function. * * Scroll to top ext dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_scroll_to_top_dynamic_css() * * @return string */ function astra_ext_scroll_to_top_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_scroll_to_top_dynamic_css()' ); return astra_addon_scroll_to_top_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_fb_button_dynamic_css function. * * Footer builder - Button dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_button_dynamic_css() * * @return string */ function astra_ext_fb_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_button_dynamic_css()' ); return astra_addon_footer_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_fb_divider_dynamic_css function. * * Footer builder - Divider dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_divider_dynamic_css() * * @return string */ function astra_fb_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_divider_dynamic_css()' ); return astra_addon_footer_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_fb_lang_switcher_dynamic_css function. * * Footer builder - Language switcher dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_lang_switcher_dynamic_css() * * @return string */ function astra_fb_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_lang_switcher_dynamic_css()' ); return astra_addon_footer_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_footer_social_dynamic_css function. * * Footer builder - Social dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_social_dynamic_css() * * @return string */ function astra_footer_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_social_dynamic_css()' ); return astra_addon_footer_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_hb_divider_dynamic_css function. * * Header builder - Divider dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_divider_dynamic_css() * * @return string */ function astra_hb_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_divider_dynamic_css()' ); return astra_addon_header_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_hb_button_dynamic_css function. * * Footer builder - Social dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_button_dynamic_css() * * @return string */ function astra_ext_hb_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_button_dynamic_css()' ); return astra_addon_header_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_hb_lang_switcher_dynamic_css function. * * Header builder - Language switcher dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_lang_switcher_dynamic_css() * * @return string */ function astra_hb_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_lang_switcher_dynamic_css()' ); return astra_addon_header_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_hb_menu_dynamic_css function. * * Header builder - Menu dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_menu_dynamic_css() * * @return string */ function astra_ext_hb_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_menu_dynamic_css()' ); return astra_addon_header_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_header_social_dynamic_css function. * * Header builder - Social dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_social_dynamic_css() * * @return string */ function astra_header_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_social_dynamic_css()' ); return astra_addon_header_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } library/batch-processing/class-wp-background-process-astra-addon.php 0000644 00000002704 15150261777 0021707 0 ustar 00 <?php /** * Database Background Process * * @package Astra * @since 2.1.3 */ if ( class_exists( 'WP_Background_Process' ) ) : /** * Database Background Process * * @since 2.1.3 */ class WP_Background_Process_Astra_Addon extends WP_Background_Process { /** * Database Process * * @var string */ protected $action = 'addon_database_migration'; /** * Task * * Override this method to perform any actions required on each * queue item. Return the modified item for further processing * in the next pass through. Or, return false to remove the * item from the queue. * * @since 2.1.3 * * @param object $process Queue item object. * @return mixed */ protected function task( $process ) { do_action( 'astra_addon_batch_process_task' . '-' . $process, $process ); if ( function_exists( $process ) ) { call_user_func( $process ); } if ( 'update_db_version' === $process ) { Astra_Addon_Background_Updater::update_db_version(); } return false; } /** * Complete * * Override if applicable, but ensure that the below actions are * performed, or, call parent::complete(). * * @since 2.1.3 */ protected function complete() { error_log( 'Astra Addon: Batch Process Completed!' ); do_action( 'astra_addon_database_migration_complete' ); parent::complete(); } } endif; library/batch-processing/wp-async-request.php 0000644 00000005614 15150261777 0015424 0 ustar 00 <?php /** * WP Async Request * * @package WP-Background-Processing */ if ( ! class_exists( 'WP_Async_Request' ) ) { /** * Abstract WP_Async_Request class. * * @abstract */ abstract class WP_Async_Request { /** * Prefix * * (default value: 'wp') * * @var string */ protected $prefix = 'wp'; /** * Action * * (default value: 'async_request') * * @var string */ protected $action = 'async_request'; /** * Identifier * * @var mixed */ protected $identifier; /** * Data * * (default value: array()) * * @var array */ protected $data = array(); /** * Initiate new async request */ public function __construct() { $this->identifier = $this->prefix . '_' . $this->action; add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) ); add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) ); } /** * Set data used during the request * * @param array $data Data. * * @return $this */ public function data( $data ) { $this->data = $data; return $this; } /** * Dispatch the async request * * @return array|WP_Error */ public function dispatch() { $url = add_query_arg( $this->get_query_args(), $this->get_query_url() ); $args = $this->get_post_args(); return wp_remote_post( esc_url_raw( $url ), $args ); } /** * Get query args * * @return array */ protected function get_query_args() { if ( property_exists( $this, 'query_args' ) ) { return $this->query_args; } return array( 'action' => $this->identifier, 'nonce' => wp_create_nonce( $this->identifier ), ); } /** * Get query URL * * @return string */ protected function get_query_url() { if ( property_exists( $this, 'query_url' ) ) { return $this->query_url; } return admin_url( 'admin-ajax.php' ); } /** * Get post args * * @return array */ protected function get_post_args() { if ( property_exists( $this, 'post_args' ) ) { return $this->post_args; } return array( 'timeout' => 0.01, 'blocking' => false, 'body' => $this->data, 'cookies' => $_COOKIE, 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), ); } /** * Maybe handle * * Check for correct nonce and pass to handler. */ public function maybe_handle() { // Don't lock up other requests while processing session_write_close(); check_ajax_referer( $this->identifier, 'nonce' ); $this->handle(); wp_die(); } /** * Handle * * Override this method to perform any actions required * during the async request. */ abstract protected function handle(); } } library/batch-processing/wp-background-process.php 0000644 00000026256 15150261777 0016421 0 ustar 00 <?php /** * WP Background Process * * @package WP-Background-Processing */ if ( ! class_exists( 'WP_Background_Process' ) ) { /** * Abstract WP_Background_Process class. * * @abstract * @extends WP_Async_Request */ abstract class WP_Background_Process extends WP_Async_Request { /** * Action * * (default value: 'background_process') * * @var string */ protected $action = 'background_process'; /** * Start time of current process. * * (default value: 0) * * @var int */ protected $start_time = 0; /** * Cron_hook_identifier * * @var mixed */ protected $cron_hook_identifier; /** * Cron_interval_identifier * * @var mixed */ protected $cron_interval_identifier; /** * Initiate new background process */ public function __construct() { parent::__construct(); $this->cron_hook_identifier = $this->identifier . '_cron'; $this->cron_interval_identifier = $this->identifier . '_cron_interval'; add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) ); add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) ); } /** * Dispatch * * @return void */ public function dispatch() { // Schedule the cron healthcheck. $this->schedule_event(); // Perform remote post. return parent::dispatch(); } /** * Push to queue * * @param mixed $data Data. * * @return $this */ public function push_to_queue( $data ) { $this->data[] = $data; return $this; } /** * Save queue * * @return $this */ public function save() { $key = $this->generate_key(); if ( ! empty( $this->data ) ) { update_site_option( $key, $this->data ); } return $this; } /** * Update queue * * @param string $key Key. * @param array $data Data. * * @return $this */ public function update( $key, $data ) { if ( ! empty( $data ) ) { update_site_option( $key, $data ); } return $this; } /** * Delete queue * * @param string $key Key. * * @return $this */ public function delete( $key ) { delete_site_option( $key ); return $this; } /** * Generate key * * Generates a unique key based on microtime. Queue items are * given a unique key so that they can be merged upon save. * * @param int $length Length. * * @return string */ protected function generate_key( $length = 64 ) { $unique = md5( microtime() . rand() ); $prepend = $this->identifier . '_batch_'; return substr( $prepend . $unique, 0, $length ); } /** * Maybe process queue * * Checks whether data exists within the queue and that * the process is not already running. */ public function maybe_handle() { // Don't lock up other requests while processing session_write_close(); if ( $this->is_process_running() ) { // Background process already running. wp_die(); } if ( $this->is_queue_empty() ) { // No data to process. wp_die(); } check_ajax_referer( $this->identifier, 'nonce' ); $this->handle(); wp_die(); } /** * Is queue empty * * @return bool */ protected function is_queue_empty() { global $wpdb; $wpdb->ast_db_table = $wpdb->options; $wpdb->ast_db_column = 'option_name'; if ( is_multisite() ) { $wpdb->ast_db_table = $wpdb->sitemeta; $wpdb->ast_db_column = 'meta_key'; } $key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%'; $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->ast_db_table} WHERE {$wpdb->ast_db_column} LIKE %s ", $key ) ); return ( $count > 0 ) ? false : true; } /** * Is process running * * Check whether the current process is already running * in a background process. */ protected function is_process_running() { if ( get_site_transient( $this->identifier . '_process_lock' ) ) { // Process already running. return true; } return false; } /** * Lock process * * Lock the process so that multiple instances can't run simultaneously. * Override if applicable, but the duration should be greater than that * defined in the time_exceeded() method. */ protected function lock_process() { $this->start_time = time(); // Set start time of current process. $lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute $lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration ); set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration ); } /** * Unlock process * * Unlock the process so that other instances can spawn. * * @return $this */ protected function unlock_process() { delete_site_transient( $this->identifier . '_process_lock' ); return $this; } /** * Get batch * * @return stdClass Return the first batch from the queue */ protected function get_batch() { global $wpdb; $wpdb->ast_db_table = $wpdb->options; $wpdb->ast_db_column = 'option_name'; $wpdb->ast_db_key_column = 'option_id'; $value_column = 'option_value'; if ( is_multisite() ) { $wpdb->ast_db_table = $wpdb->sitemeta; $wpdb->ast_db_column = 'meta_key'; $wpdb->ast_db_key_column = 'meta_id'; $value_column = 'meta_value'; } $key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%'; $query = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->ast_db_table} WHERE {$wpdb->ast_db_column} LIKE %s ORDER BY {$wpdb->ast_db_key_column} ASC LIMIT 1", $key ) ); $batch = new stdClass(); $batch->key = $query->{$wpdb->ast_db_column}; $batch->data = maybe_unserialize( $query->$value_column ); return $batch; } /** * Handle * * Pass each queue item to the task handler, while remaining * within server memory and time limit constraints. */ protected function handle() { $this->lock_process(); do { $batch = $this->get_batch(); foreach ( $batch->data as $key => $value ) { $task = $this->task( $value ); if ( false !== $task ) { $batch->data[ $key ] = $task; } else { unset( $batch->data[ $key ] ); } if ( $this->time_exceeded() || $this->memory_exceeded() ) { // Batch limits reached. break; } } // Update or delete current batch. if ( ! empty( $batch->data ) ) { $this->update( $batch->key, $batch->data ); } else { $this->delete( $batch->key ); } } while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() ); $this->unlock_process(); // Start next batch or complete process. if ( ! $this->is_queue_empty() ) { $this->dispatch(); } else { $this->complete(); } wp_die(); } /** * Memory exceeded * * Ensures the batch process never exceeds 90% * of the maximum WordPress memory. * * @return bool */ protected function memory_exceeded() { $memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory $current_memory = memory_get_usage( true ); $return = false; if ( $current_memory >= $memory_limit ) { $return = true; } return apply_filters( $this->identifier . '_memory_exceeded', $return ); } /** * Get memory limit * * @return int */ protected function get_memory_limit() { if ( function_exists( 'ini_get' ) ) { $memory_limit = ini_get( 'memory_limit' ); } else { // Sensible default. $memory_limit = '128M'; } if ( ! $memory_limit || -1 === intval( $memory_limit ) ) { // Unlimited, set to 32GB. $memory_limit = '32000M'; } return intval( $memory_limit ) * 1024 * 1024; } /** * Time exceeded. * * Ensures the batch never exceeds a sensible time limit. * A timeout limit of 30s is common on shared hosting. * * @return bool */ protected function time_exceeded() { $finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds $return = false; if ( time() >= $finish ) { $return = true; } return apply_filters( $this->identifier . '_time_exceeded', $return ); } /** * Complete. * * Override if applicable, but ensure that the below actions are * performed, or, call parent::complete(). */ protected function complete() { // Unschedule the cron healthcheck. $this->clear_scheduled_event(); } /** * Schedule cron healthcheck * * @param mixed $schedules Schedules. * @return mixed */ public function schedule_cron_healthcheck( $schedules ) { $interval = apply_filters( $this->identifier . '_cron_interval', 5 ); if ( property_exists( $this, 'cron_interval' ) ) { $interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval ); } // Adds every 5 minutes to the existing schedules. $schedules[ $this->identifier . '_cron_interval' ] = array( 'interval' => MINUTE_IN_SECONDS * $interval, 'display' => sprintf( /* translators: %d Time interval */ __( 'Every %d Minutes' ), $interval ), ); return $schedules; } /** * Handle cron healthcheck * * Restart the background process if not already running * and data exists in the queue. */ public function handle_cron_healthcheck() { if ( $this->is_process_running() ) { // Background process already running. exit; } if ( $this->is_queue_empty() ) { // No data to process. $this->clear_scheduled_event(); exit; } $this->handle(); exit; } /** * Schedule event */ protected function schedule_event() { if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) { wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier ); } } /** * Clear scheduled event */ protected function clear_scheduled_event() { $timestamp = wp_next_scheduled( $this->cron_hook_identifier ); if ( $timestamp ) { wp_unschedule_event( $timestamp, $this->cron_hook_identifier ); } } /** * Cancel Process * * Stop processing queue items, clear cronjob and delete batch. */ public function cancel_process() { if ( ! $this->is_queue_empty() ) { $batch = $this->get_batch(); $this->delete( $batch->key ); wp_clear_scheduled_hook( $this->cron_hook_identifier ); } } /** * Task * * Override this method to perform any actions required on each * queue item. Return the modified item for further processing * in the next pass through. Or, return false to remove the * item from the queue. * * @param mixed $item Queue item to iterate over. * * @return mixed */ abstract protected function task( $item ); } } library/image-processing-queue/includes/class-image-processing-queue.php 0000644 00000016524 15150261777 0022611 0 ustar 00 <?php /** * Image Processing Queue * * @package Image-Processing-Queue */ if ( ! class_exists( 'Image_Processing_Queue' ) ) { /** * Image Processing Queue */ class Image_Processing_Queue { /** * Singleton * * @var Image_Processing_Queue|null */ protected static $instance = null; /** * Whether or not we're updating the backup sizes * * @var bool */ private $is_updating_backup_sizes = false; /** * Instance of the background process class * * @var IPQ_Process|null */ public $process = null; /** * Singleton * * @return Image_Processing_Queue|null */ public static function instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Image_Processing_Queue constructor. */ public function __construct() { $this->process = new IPQ_Process(); add_filter( 'update_post_metadata', array( $this, 'filter_update_post_metadata' ), 10, 5 ); } /** * Filter the post meta data for backup sizes * * Unfortunately WordPress core is lacking hooks in its image resizing functions so we are reduced * to this hackery to detect when images are resized and previous versions are relegated to backup sizes. * * @param bool $check * @param int $object_id * @param string $meta_key * @param mixed $meta_value * @param mixed $prev_value * @return bool */ public function filter_update_post_metadata( $check, $object_id, $meta_key, $meta_value, $prev_value ) { if ( '_wp_attachment_backup_sizes' !== $meta_key ) { return $check; } $current_value = get_post_meta( $object_id, $meta_key, true ); if ( ! $current_value ) { $current_value = array(); } $diff = array_diff_key( $meta_value, $current_value ); if ( ! $diff ) { return $check; } $key = key( $diff ); $suffix = substr( $key, strrpos( $key, '-' ) + 1 ); $image_meta = self::get_image_meta( $object_id ); foreach ( $image_meta['sizes'] as $size_name => $size ) { if ( 0 !== strpos( $size_name, 'ipq-' ) ) { continue; } $meta_value[ $size_name . '-' . $suffix ] = $size; unset( $image_meta['sizes'][ $size_name ] ); } if ( ! $this->is_updating_backup_sizes ) { $this->is_updating_backup_sizes = true; update_post_meta( $object_id, '_wp_attachment_backup_sizes', $meta_value ); wp_update_attachment_metadata( $object_id, $image_meta ); return true; } $this->is_updating_backup_sizes = false; return $check; } /** * Check if the image sizes exist and push them to the queue if not. * * @param int $post_id * @param array $sizes */ protected function process_image( $post_id, $sizes ) { $new_item = false; foreach ( $sizes as $size ) { if ( self::does_size_already_exist_for_image( $post_id, $size ) ) { continue; } if ( self::is_size_larger_than_original( $post_id, $size ) ) { continue; } $item = array( 'post_id' => $post_id, 'width' => $size[0], 'height' => $size[1], 'crop' => $size[2], ); $this->process->push_to_queue( $item ); $new_item = true; } if ( $new_item ) { $this->process->save()->dispatch(); } } /** * Get image HTML for a specific context in a theme, specifying the exact sizes * for the image. The first image size is always used as the `src` and the other * sizes are used in the `srcset` if they're the same aspect ratio as the original * image. If any of the image sizes don't currently exist, they are queued for * creation by a background process. Example: * * For echoing - echo ipq_get_theme_image( 1353, array( * array( 600, 400, false ), * array( 1280, 720, false ), * array( 1600, 1067, false ), * ), * array( * 'class' => 'header-banner' * ) * ); * * @param int $post_id Image attachment ID. * @param array $sizes Array of arrays of sizes in the format array(width,height,crop). * @param string $attr Optional. Attributes for the image markup. Default empty. * @return string HTML img element or empty string on failure. */ public function get_image( $post_id, $sizes, $attr = '' ) { $this->process_image( $post_id, $sizes ); return wp_get_attachment_image( $post_id, array( $sizes[0][0], $sizes[0][1] ), false, $attr ); } /** * Get image URL for a specific context in a theme, specifying the exact size * for the image. If the image size does not currently exist, it is queued for * creation by a background process. Example: * * For echoing - echo ipq_get_theme_image_url( 1353, array( 600, 400, false ) ); * * @param int $post_id * @param array $size * * @return string */ public function get_image_url( $post_id, $size ) { $this->process_image( $post_id, array( $size ) ); $size = self::get_size_name( $size ); $src = wp_get_attachment_image_src( $post_id, $size ); if ( isset( $src[0] ) ) { return $src[0]; } return ''; } /** * Get array index name for image size. * * @param array $size array in format array(width,height,crop). * @return string Image size name. */ public static function get_size_name( $size ) { $crop = $size[2] ? 'true' : 'false'; return 'ipq-' . $size[0] . 'x' . $size[1] . '-' . $crop; } /** * Get an image's file path. * * @param int $post_id ID of the image post. * @return false|string */ public static function get_image_path( $post_id ) { return get_attached_file( $post_id ); } /** * Get an image's post meta data. * * @param int $post_id ID of the image post. * @return mixed Post meta field. False on failure. */ public static function get_image_meta( $post_id ) { return wp_get_attachment_metadata( $post_id ); } /** * Update meta data for an image * * @param int $post_id Image ID. * @param array $data Image data. * @return bool|int False if $post is invalid. */ public static function update_image_meta( $post_id, $data ) { return wp_update_attachment_metadata( $post_id, $data ); } /** * Checks if an image size already exists for an image * * @param int $post_id Image ID. * @param array $size array in format array(width,height,crop). * @return bool */ public static function does_size_already_exist_for_image( $post_id, $size ) { $image_meta = self::get_image_meta( $post_id ); $size_name = self::get_size_name( $size ); return isset( $image_meta['sizes'][ $size_name ] ); } /** * Check if an image size is larger than the original. * * @param int $post_id Image ID. * @param array $size array in format array(width,height,crop). * * @return bool */ public static function is_size_larger_than_original( $post_id, $size ) { $image_meta = self::get_image_meta( $post_id ); if ( ! isset( $image_meta['width'] ) || ! isset( $image_meta['height'] ) ) { return true; } if ( $size[0] > $image_meta['width'] || $size[1] > $image_meta['height'] ) { return true; } return false; } } } library/image-processing-queue/includes/class-ipq-process.php 0000644 00000005161 15150261777 0020473 0 ustar 00 <?php /** * Background Process for Image Processing Queue * * @package Image-Processing-Queue */ if ( ! class_exists( 'IPQ_Process' ) ) { /** * Custom exception class for IPQ background processing */ class IPQ_Process_Exception extends Exception {} /** * Extends the background processing library and implements image processing routines */ class IPQ_Process extends WP_Background_Process { /** * Action * * @var string */ protected $action = 'image_processing_queue'; /** * Background task to resizes images * * @param mixed $item Image data. * @return bool * @throws IPQ_Process_Exception On error. */ protected function task( $item ) { $defaults = array( 'post_id' => 0, 'width' => 0, 'height' => 0, 'crop' => false, ); $item = wp_parse_args( $item, $defaults ); $post_id = $item['post_id']; $width = $item['width']; $height = $item['height']; $crop = $item['crop']; if ( ! $width && ! $height ) { throw new IPQ_Process_Exception( "Invalid dimensions '{$width}x{$height}'" ); } if ( Image_Processing_Queue::does_size_already_exist_for_image( $post_id, array( $width, $height, $crop ) ) ) { return false; } $image_meta = Image_Processing_Queue::get_image_meta( $post_id ); if ( ! $image_meta ) { return false; } add_filter( 'as3cf_get_attached_file_copy_back_to_local', '__return_true' ); $img_path = Image_Processing_Queue::get_image_path( $post_id ); if ( ! $img_path ) { return false; } $editor = wp_get_image_editor( $img_path ); if ( is_wp_error( $editor ) ) { throw new IPQ_Process_Exception( 'Unable to get WP_Image_Editor for file "' . $img_path . '": ' . $editor->get_error_message() . ' (is GD or ImageMagick installed?)' ); } if ( is_wp_error( $editor->resize( $width, $height, $crop ) ) ) { throw new IPQ_Process_Exception( 'Error resizing image: ' . $editor->get_error_message() ); } $resized_file = $editor->save(); if ( is_wp_error( $resized_file ) ) { throw new IPQ_Process_Exception( 'Unable to save resized image file: ' . $editor->get_error_message() ); } $size_name = Image_Processing_Queue::get_size_name( array( $width, $height, $crop ) ); $image_meta['sizes'][ $size_name ] = array( 'file' => $resized_file['file'], 'width' => $resized_file['width'], 'height' => $resized_file['height'], 'mime-type' => $resized_file['mime-type'], ); wp_update_attachment_metadata( $post_id, $image_meta ); return false; } } } library/image-processing-queue/includes/ipq-template-functions.php 0000644 00000003364 15150261777 0021536 0 ustar 00 <?php if ( ! function_exists( 'ipq_get_theme_image' ) ) { /** * Get image HTML for a specific context in a theme, specifying the exact sizes * for the image. The first image size is always used as the `src` and the other * sizes are used in the `srcset` if they're the same aspect ratio as the original * image. If any of the image sizes don't currently exist, they are queued for * creation by a background process. Example: * * For echoing - echo ipq_get_theme_image( 1353, array( * array( 600, 400, false ), * array( 1280, 720, false ), * array( 1600, 1067, false ), * ), * array( * 'class' => 'header-banner' * ) * ); * * @param int $post_id Image attachment ID. * @param array $sizes Array of arrays of sizes in the format array(width,height,crop). * @param string $attr Optional. Attributes for the image markup. Default empty. * * @return string HTML img element or empty string on failure. */ function ipq_get_theme_image( $post_id, $sizes, $attr = '' ) { return Image_Processing_Queue::instance()->get_image( $post_id, $sizes, $attr ); } } if ( ! function_exists( 'ipq_get_theme_image_url' ) ) { /** * Get image URL for a specific context in a theme, specifying the exact size * for the image. If the image size does not currently exist, it is queued for * creation by a background process. Example: * * For echoing - echo ipq_get_theme_image_url( 1353, array( 600, 400, false ) ); * * @param int $post_id * @param array $size * * @return string Img URL */ function ipq_get_theme_image_url( $post_id, $size ) { return Image_Processing_Queue::instance()->get_image_url( $post_id, $size ); } } library/image-processing-queue/image-processing-queue.php 0000644 00000001354 15150261777 0017673 0 ustar 00 <?php /* * Copyright (c) 2020 Delicious Brains. All rights reserved. * * Released under the GPL license * https://www.opensource.org/licenses/gpl-license.php */ defined( 'WPINC' ) || die; require_once ASTRA_EXT_DIR . 'classes/library/batch-processing/wp-async-request.php'; require_once ASTRA_EXT_DIR . 'classes/library/batch-processing/wp-background-process.php'; require_once ASTRA_EXT_DIR . 'classes/library/image-processing-queue/includes/class-ipq-process.php'; require_once ASTRA_EXT_DIR . 'classes/library/image-processing-queue/includes/class-image-processing-queue.php'; require_once ASTRA_EXT_DIR . 'classes/library/image-processing-queue/includes/ipq-template-functions.php'; Image_Processing_Queue::instance(); modules/menu-sidebar/assets/js/minified/common-sidebar-and-menu.min.js 0000644 00000022543 15150261777 0022033 0 ustar 00 !function(n){n.fn.isInViewport=function(){var e=n(this).offset().top,a=e+n(this).outerHeight(),s=n(window).scrollTop(),t=s+n(window).height();return s<a&&e<t},AstraMenu={init:function(){this._bind(),document.querySelector("body").addEventListener("astraMenuHashLinkClicked",function(e){AstraMenu._close_fullscreen(e),AstraMenu._close_offcanvas(e)})},_bind:function(){astraAddon.off_canvas_enable||""?(n(document).on("click","."+astraAddon.off_canvas_trigger_class,{class:"ast-off-canvas-overlay"},AstraMenu._enable_offcanvas_overlay),n(document).on("click touchstart",".astra-off-canvas-sidebar-wrapper, .astra-off-canvas-sidebar-wrapper .ast-shop-filter-close",{class:"ast-off-canvas-overlay"},AstraMenu._close_offcanvas)):astraAddon.off_canvas_trigger_class&&n(document).on("click","."+astraAddon.off_canvas_trigger_class,AstraMenu._enable_collapsible_slider),n(document).on("click",".ast-flyout-above-menu-enable .ast-above-header .menu-toggle",AstraMenu._open_above_offcanvas),n(document).on("click touchstart",".ast-flyout-above-menu-overlay .ast-above-header-navigation-wrap, .ast-flyout-above-menu-overlay .ast-above-header .ast-nav-close",AstraMenu._close_above_offcanvas),n(document).on("click",".ast-flyout-below-menu-enable .ast-below-header .menu-toggle",AstraMenu._open_below_offcanvas),n(document).on("click touchstart",".ast-flyout-below-menu-overlay .ast-below-header-navigation-wrap, .ast-flyout-below-menu-overlay .ast-below-header .ast-nav-close",AstraMenu._close_below_offcanvas),n(document).on("click",".ast-fullscreen-below-menu-enable .ast-below-header .menu-toggle",AstraMenu._open_below_fullscreen),n(document).on("click",".ast-fullscreen-below-menu-overlay .ast-below-header .close",AstraMenu._close_below_fullscreen),n(document).on("click",".ast-fullscreen-above-menu-enable .ast-above-header .menu-toggle",AstraMenu._open_above_fullscreen),n(document).on("click",".ast-fullscreen-above-menu-overlay .ast-above-header .close",AstraMenu._close_above_fullscreen),n(document).on("click",".ast-flyout-menu-enable .main-header-bar .menu-toggle",{class:"ast-flyout-menu-overlay"},AstraMenu._enable_primary_menu_overlay),n(document).on("click",".ast-flyout-menu-overlay .main-header-bar-navigation, .ast-flyout-menu-overlay .main-header-bar .ast-nav-close",{class:"ast-flyout-menu-overlay"},AstraMenu._close_offcanvas),n(document).on("click",".ast-flyout-menu-overlay .main-header-bar-navigation",{class:"toggled"},AstraMenu._toggle_menu),n(document).on("click",".ast-fullscreen-menu-enable .main-header-bar .menu-toggle",AstraMenu._open_fullscreen),n(document).on("click",".ast-fullscreen-menu-overlay .main-header-bar .close",AstraMenu._close_fullscreen),n(document).on("click",".ast-fullscreen-menu-overlay .main-header-bar .close",{class:"toggled"},AstraMenu._toggle_menu),n(document).on("ready",AstraMenu._wp_admin_bar_visible),n(window).on("scroll",AstraMenu._wp_admin_bar_visible)},_open_above_fullscreen:function(e){e.preventDefault();var e=n("html").innerWidth(),a=(n("html").css("overflow","hidden"),n("html").innerWidth());n("html").css("margin-right",a-e),n("html").addClass("ast-fullscreen-above-menu-overlay"),n(".ast-above-header-navigation-wrap .close").length||(n(".ast-above-header-navigation-wrap").prepend('<span class="close">'+astraAddon.svgIconClose+"</span>"),n(".ast-above-header-navigation-wrap .close").css("right",a-e))},_open_below_fullscreen:function(e){e.preventDefault();var e=n("html").innerWidth(),a=(n("html").css("overflow","hidden"),n("html").innerWidth());n("html").css("margin-right",a-e),n("html").addClass("ast-fullscreen-below-menu-overlay"),n(".ast-below-header-navigation-wrap .close").length||(n(".ast-below-header-navigation-wrap").prepend('<span class="close">'+astraAddon.svgIconClose+"</span>"),n(".ast-below-header-navigation-wrap .close").css("right",a-e))},_open_fullscreen:function(e){e.preventDefault();var e=n("html").innerWidth(),a=(n("html").css("overflow","hidden"),n("html").innerWidth());n("html").css("margin-right",a-e),n("html").addClass("ast-fullscreen-menu-overlay"),n("html").addClass("ast-fullscreen-active"),n(".main-header-bar nav .close").length||(n(".main-header-bar nav").prepend('<span class="close">'+astraAddon.svgIconClose+"</span>"),n(".main-header-bar nav .close").css("right",a-e)),n(".ast-primary-menu-disabled .ast-header-custom-item .close").length||n(".ast-primary-menu-disabled .ast-header-custom-item .ast-merge-header-navigation-wrap").prepend('<span class="close">'+astraAddon.svgIconClose+"</span>")},_enable_offcanvas_overlay:function(e){e.preventDefault(),n(this).addClass("active");var a=n("html").innerWidth(),s=(n("html").css("overflow","hidden"),n("html").innerWidth());n("html").css("margin-right",s-a),n("html").addClass(e.data.class),setTimeout(function(){n("#cart-accessibility").focus()},100);const t=n(".ast-filter-wrap");t.hasClass("ast-accordion-layout")&&AstraMenu._accordion_initial_height()},_enable_collapsible_slider:function(e){e.preventDefault(),n(this).toggleClass("active"),n("body").hasClass("ast-header-break-point")&&!astraAddon.off_canvas_enable&&n(this).hasClass("active")&&n("html, body").animate({scrollTop:n(".ast-woocommerce-container").offset().top},500),n(".ast-collapse-filter").slideToggle();const a=n(".ast-filter-wrap");a.hasClass("ast-accordion-layout")&&AstraMenu._accordion_initial_height()},_enable_primary_menu_overlay:function(e){e.preventDefault(),n(".main-header-bar-navigation .close").length||n(".main-navigation").before('<span class="ast-nav-close close">'+astraAddon.svgIconClose+"</span>"),n(".ast-merge-header-navigation-wrap .close").length||n(".ast-merge-header-navigation-wrap").append('<span class="ast-nav-close close">'+astraAddon.svgIconClose+"</span>"),n("div.ast-masthead-custom-menu-items .close").length||n("div.ast-masthead-custom-menu-items").append('<span class="ast-nav-close close">'+astraAddon.svgIconClose+"</span>"),astraAddon.sticky_active&&n("html").css("overflow","hidden"),n("html").addClass(e.data.class),n("html").addClass("ast-offcanvas-active")},_open_above_offcanvas:function(e){e.preventDefault(),n(".ast-above-header-section .close").length||n(".ast-above-header-navigation").prepend('<span class="ast-nav-close close">'+astraAddon.svgIconClose+"</span>"),astraAddon.sticky_active&&n("html").css("overflow","hidden"),n("html").addClass("ast-flyout-above-menu-overlay")},_close_above_offcanvas:function(e){e.target.parentNode.parentNode===this&&(n("html").removeClass("ast-flyout-above-menu-overlay"),n(".ast-above-header .menu-toggle").removeClass("toggled"),n(".ast-above-header").removeClass("toggle-on"),astraAddon.sticky_active&&n("html").css("overflow",""))},_open_below_offcanvas:function(e){e.preventDefault(),n(".ast-below-header-actual-nav .close").length||n(".ast-below-header-actual-nav").prepend('<span class="ast-nav-close close">'+astraAddon.svgIconClose+"</span>"),astraAddon.sticky_active&&n("html").css("overflow","hidden"),n("html").addClass("ast-flyout-below-menu-overlay")},_close_below_offcanvas:function(e){e.target.parentNode.parentNode===this&&(n("html").removeClass("ast-flyout-below-menu-overlay"),n(".ast-below-header .menu-toggle").removeClass("toggled"),n(".ast-below-header").removeClass("toggle-on"),astraAddon.sticky_active&&n("html").css("overflow",""))},_close_offcanvas:function(e){const a=n(".astra-off-canvas-sidebar");var s=e.target.parentNode.parentNode===this||"astraMenuHashLinkClicked"===e.type;if(a.length?s||!a.is(e.target)&&0===a.has(e.target).length:s){e.data=e.data||{},e.data.class=e.data.class||"ast-flyout-menu-overlay ast-offcanvas-active",n("html").css({overflow:"","margin-left":"","margin-right":""}),n("html").removeClass(e.data.class);const t=n(".astra-shop-filter-button");t.hasClass("active")&&t.removeClass("active"),setTimeout(function(){n("html").removeClass("ast-offcanvas-active")},300)}},_close_above_fullscreen:function(e){n("html").css({overflow:"","margin-right":""}),n("html").removeClass("ast-fullscreen-above-menu-overlay"),n(".ast-above-header-navigation").removeClass("toggle-on").hide(),n(".ast-above-header .menu-toggle").hasClass("toggled")&&n(".ast-above-header .menu-toggle").removeClass("toggled")},_close_below_fullscreen:function(e){n("html").css({overflow:"","margin-right":""}),n("html").removeClass("ast-fullscreen-below-menu-overlay"),n(".ast-below-header .menu-toggle").hasClass("toggled")&&n(".ast-below-header .menu-toggle").removeClass("toggled")},_close_fullscreen:function(e){n("html").css({overflow:"","margin-right":""}),n("html").removeClass("ast-fullscreen-menu-overlay"),setTimeout(function(){n("html").removeClass("ast-fullscreen-active")},500),n(".main-header-bar-navigation").removeClass("toggle-on").hide()},_toggle_menu:function(e){n(".main-header-bar .menu-toggle").hasClass(e.data.class)&&n(".main-header-bar .menu-toggle").removeClass(e.data.class),n("html").hasClass("ast-fullscreen-active")&&setTimeout(function(){n("html").removeClass("ast-fullscreen-active")},500)},_toggle_above_menu:function(e){n(".ast-above-header .menu-toggle").hasClass(e.data.class)&&n(".ast-above-header .menu-toggle").removeClass(e.data.class)},_wp_admin_bar_visible:function(e){var a=n("#wpadminbar");a.length&&(a.isInViewport()?n("body").hasClass("ast-admin-bar-visible")||n("body").addClass("ast-admin-bar-visible"):n("body").hasClass("ast-admin-bar-visible")&&n("body").removeClass("ast-admin-bar-visible"))},_accordion_initial_height:function(e){n(".ast-filter-content").each(function(e,a){var s=n(this).innerHeight();n(a).css("max-height",s+"px")})}},n(function(){AstraMenu.init()})}(jQuery); modules/menu-sidebar/assets/js/unminified/common-sidebar-and-menu.js 0000644 00000031466 15150261777 0021620 0 ustar 00 (function($){ // Detecting if an element is in the Viewport. $.fn.isInViewport = function() { var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop && elementTop < viewportBottom; }; AstraMenu = { /** * Init */ init: function() { this._bind(); var body = document.querySelector('body'); body.addEventListener( 'astraMenuHashLinkClicked', function ( event ) { AstraMenu._close_fullscreen(event); AstraMenu._close_offcanvas(event); }); }, /** * Binds events */ _bind: function() { var canvasEnable = astraAddon.off_canvas_enable || ''; if ( canvasEnable ) { $(document).on( 'click', '.' + astraAddon.off_canvas_trigger_class, {class: "ast-off-canvas-overlay"}, AstraMenu._enable_offcanvas_overlay ); $(document).on( 'click touchstart', '.astra-off-canvas-sidebar-wrapper, .astra-off-canvas-sidebar-wrapper .ast-shop-filter-close',{class: "ast-off-canvas-overlay"}, AstraMenu._close_offcanvas ); } else { if( astraAddon.off_canvas_trigger_class ) { $(document).on( 'click', '.' + astraAddon.off_canvas_trigger_class, AstraMenu._enable_collapsible_slider ); } } // Flyout above header menu. $(document).on( 'click', '.ast-flyout-above-menu-enable .ast-above-header .menu-toggle', AstraMenu._open_above_offcanvas ); $(document).on( 'click touchstart', '.ast-flyout-above-menu-overlay .ast-above-header-navigation-wrap, .ast-flyout-above-menu-overlay .ast-above-header .ast-nav-close', AstraMenu._close_above_offcanvas ); // Flyout above header menu. $(document).on( 'click', '.ast-flyout-below-menu-enable .ast-below-header .menu-toggle', AstraMenu._open_below_offcanvas ); $(document).on( 'click touchstart', '.ast-flyout-below-menu-overlay .ast-below-header-navigation-wrap, .ast-flyout-below-menu-overlay .ast-below-header .ast-nav-close', AstraMenu._close_below_offcanvas ); // Full Screen Below Header menu. $(document).on( 'click', '.ast-fullscreen-below-menu-enable .ast-below-header .menu-toggle', AstraMenu._open_below_fullscreen ); $(document).on( 'click', '.ast-fullscreen-below-menu-overlay .ast-below-header .close', AstraMenu._close_below_fullscreen ); // Full Screen menu. $(document).on( 'click', '.ast-fullscreen-above-menu-enable .ast-above-header .menu-toggle', AstraMenu._open_above_fullscreen ); $(document).on( 'click', '.ast-fullscreen-above-menu-overlay .ast-above-header .close', AstraMenu._close_above_fullscreen ); // Flyout menu. $(document).on( 'click', '.ast-flyout-menu-enable .main-header-bar .menu-toggle', { class: 'ast-flyout-menu-overlay'}, AstraMenu._enable_primary_menu_overlay ); $(document).on( 'click', '.ast-flyout-menu-overlay .main-header-bar-navigation, .ast-flyout-menu-overlay .main-header-bar .ast-nav-close', { class: 'ast-flyout-menu-overlay' }, AstraMenu._close_offcanvas ); $(document).on( 'click', '.ast-flyout-menu-overlay .main-header-bar-navigation', { class: "toggled" }, AstraMenu._toggle_menu ); // Full Screen menu. $(document).on( 'click', '.ast-fullscreen-menu-enable .main-header-bar .menu-toggle', AstraMenu._open_fullscreen ); $(document).on( 'click', '.ast-fullscreen-menu-overlay .main-header-bar .close', AstraMenu._close_fullscreen ); $(document).on( 'click', '.ast-fullscreen-menu-overlay .main-header-bar .close', { class: "toggled" }, AstraMenu._toggle_menu ); $(document).on( 'ready', AstraMenu._wp_admin_bar_visible ); $(window).on( 'scroll', AstraMenu._wp_admin_bar_visible ); }, _open_above_fullscreen: function(e) { e.preventDefault(); var innerWidth = $('html').innerWidth(); $('html').css( 'overflow', 'hidden' ); var hiddenInnerWidth = $('html').innerWidth(); $('html').css( 'margin-right', hiddenInnerWidth - innerWidth ); $('html').addClass( 'ast-fullscreen-above-menu-overlay' ); if( ! $('.ast-above-header-navigation-wrap .close').length ) { $('.ast-above-header-navigation-wrap').prepend('<span class="close">' + astraAddon.svgIconClose + '</span>'); $('.ast-above-header-navigation-wrap .close').css( 'right', hiddenInnerWidth - innerWidth ); } }, _open_below_fullscreen: function(e) { e.preventDefault(); var innerWidth = $('html').innerWidth(); $('html').css( 'overflow', 'hidden' ); var hiddenInnerWidth = $('html').innerWidth(); $('html').css( 'margin-right', hiddenInnerWidth - innerWidth ); $('html').addClass( 'ast-fullscreen-below-menu-overlay' ); if( ! $('.ast-below-header-navigation-wrap .close').length ) { $('.ast-below-header-navigation-wrap').prepend('<span class="close">' + astraAddon.svgIconClose + '</span>'); $('.ast-below-header-navigation-wrap .close').css( 'right', hiddenInnerWidth - innerWidth ); } }, _open_fullscreen: function(e) { e.preventDefault(); var innerWidth = $('html').innerWidth(); $('html').css( 'overflow', 'hidden' ); var hiddenInnerWidth = $('html').innerWidth(); $('html').css( 'margin-right', hiddenInnerWidth - innerWidth ); $('html').addClass( 'ast-fullscreen-menu-overlay' ); $('html').addClass( 'ast-fullscreen-active' ); if( ! $('.main-header-bar nav .close').length ) { $('.main-header-bar nav').prepend('<span class="close">' + astraAddon.svgIconClose + '</span>'); $('.main-header-bar nav .close').css( 'right', hiddenInnerWidth - innerWidth ); } if( ! $( '.ast-primary-menu-disabled .ast-header-custom-item .close').length ) { $( ".ast-primary-menu-disabled .ast-header-custom-item .ast-merge-header-navigation-wrap" ).prepend( '<span class="close">' + astraAddon.svgIconClose + '</span>' ); } }, _enable_offcanvas_overlay: function(e) { e.preventDefault(); $(this).addClass( 'active' ); var innerWidth = $('html').innerWidth(); $('html').css( 'overflow', 'hidden' ); var hiddenInnerWidth = $('html').innerWidth(); $('html').css( 'margin-right', hiddenInnerWidth - innerWidth ); $('html').addClass( e.data.class ); // Added for accessibility issue. setTimeout(function(){ $('#cart-accessibility').focus() }, 100); const isAccordionActive = $( '.ast-filter-wrap' ); if( isAccordionActive.hasClass( 'ast-accordion-layout' ) ) { AstraMenu._accordion_initial_height(); } }, _enable_collapsible_slider: function(e) { e.preventDefault(); $(this).toggleClass( 'active' ); if( $('body').hasClass( 'ast-header-break-point' ) && ! astraAddon.off_canvas_enable && $(this).hasClass('active') ) { $('html, body').animate({ scrollTop: $(".ast-woocommerce-container").offset().top }, 500); } $('.ast-collapse-filter').slideToggle(); const isAccordionActive = $( '.ast-filter-wrap' ); if( isAccordionActive.hasClass( 'ast-accordion-layout' ) ) { AstraMenu._accordion_initial_height(); } }, _enable_primary_menu_overlay: function(e) { e.preventDefault(); if( ! $( '.main-header-bar-navigation .close' ).length ) { $( ".main-navigation" ).before( '<span class="ast-nav-close close">' + astraAddon.svgIconClose + '</span>' ); } if( ! $( '.ast-merge-header-navigation-wrap .close' ).length ) { $( ".ast-merge-header-navigation-wrap" ).append( '<span class="ast-nav-close close">' + astraAddon.svgIconClose + '</span>' ); } if( ! $( 'div.ast-masthead-custom-menu-items .close' ).length ) { $( "div.ast-masthead-custom-menu-items" ).append( '<span class="ast-nav-close close">' + astraAddon.svgIconClose + '</span>' ); } if( astraAddon.sticky_active ) { $( 'html' ).css( 'overflow', 'hidden' ); } $('html').addClass( e.data.class ); $('html').addClass( 'ast-offcanvas-active' ); }, _open_above_offcanvas: function(e) { e.preventDefault(); if( ! $( '.ast-above-header-section .close' ).length ) { $( ".ast-above-header-navigation" ).prepend( '<span class="ast-nav-close close">' + astraAddon.svgIconClose + '</span>' ); } if( astraAddon.sticky_active ) { $( 'html' ).css( 'overflow', 'hidden' ); } $('html').addClass( 'ast-flyout-above-menu-overlay' ); }, _close_above_offcanvas: function(e) { if ( e.target.parentNode.parentNode === this ) { $('html').removeClass( 'ast-flyout-above-menu-overlay' ); $( '.ast-above-header .menu-toggle' ).removeClass( 'toggled' ); $( '.ast-above-header' ).removeClass( 'toggle-on' ); if( astraAddon.sticky_active ) { $( 'html' ).css( 'overflow', '' ); } } }, _open_below_offcanvas: function(e) { e.preventDefault(); if( ! $( '.ast-below-header-actual-nav .close' ).length ) { $( ".ast-below-header-actual-nav" ).prepend( '<span class="ast-nav-close close">' + astraAddon.svgIconClose + '</span>' ); } if( astraAddon.sticky_active ) { $( 'html' ).css( 'overflow', 'hidden' ); } $('html').addClass( 'ast-flyout-below-menu-overlay' ); }, _close_below_offcanvas: function(e) { if ( e.target.parentNode.parentNode === this ) { $('html').removeClass( 'ast-flyout-below-menu-overlay' ); $( '.ast-below-header .menu-toggle' ).removeClass( 'toggled' ); $( '.ast-below-header' ).removeClass( 'toggle-on' ); if( astraAddon.sticky_active ) { $( 'html' ).css( 'overflow', '' ); } } }, _close_offcanvas: function(e) { const offCanvasWrap = $( ".astra-off-canvas-sidebar" ); const commonCondition = e.target.parentNode.parentNode === this || e.type === 'astraMenuHashLinkClicked'; const condition = offCanvasWrap.length ? commonCondition || ( ! offCanvasWrap.is(e.target) && offCanvasWrap.has(e.target).length === 0 ) : commonCondition; if ( condition ) { e.data = e.data || {}; e.data.class = e.data.class || "ast-flyout-menu-overlay ast-offcanvas-active"; $("html").css({ overflow: "", "margin-left": "", "margin-right": "" }); $("html").removeClass(e.data.class); const filterButton = $(".astra-shop-filter-button"); if( filterButton.hasClass( 'active' ) ) { filterButton.removeClass( 'active' ); } setTimeout(function() { $("html").removeClass("ast-offcanvas-active"); }, 300); } }, _close_above_fullscreen: function(e) { $('html').css({ 'overflow': '', 'margin-right': '' }); $('html').removeClass( 'ast-fullscreen-above-menu-overlay' ); $('.ast-above-header-navigation').removeClass('toggle-on').hide(); if ( $( '.ast-above-header .menu-toggle' ).hasClass( 'toggled' ) ) { $( '.ast-above-header .menu-toggle' ).removeClass( 'toggled' ); } }, _close_below_fullscreen: function(e) { $('html').css({ 'overflow': '', 'margin-right': '' }); $('html').removeClass( 'ast-fullscreen-below-menu-overlay' ); if ( $( '.ast-below-header .menu-toggle' ).hasClass( 'toggled' ) ) { $( '.ast-below-header .menu-toggle' ).removeClass( 'toggled' ); } }, _close_fullscreen: function(e) { $('html').css({ 'overflow': '', 'margin-right': '' }); $('html').removeClass( 'ast-fullscreen-menu-overlay' ); setTimeout(function(){ $('html').removeClass( 'ast-fullscreen-active' ); }, 500); $('.main-header-bar-navigation').removeClass('toggle-on').hide(); }, _toggle_menu: function(e) { if ( $( '.main-header-bar .menu-toggle' ).hasClass( e.data.class ) ) { $( '.main-header-bar .menu-toggle' ).removeClass( e.data.class ); } if ( $( 'html' ).hasClass( 'ast-fullscreen-active' ) ) { setTimeout(function(){ $('html').removeClass( 'ast-fullscreen-active' ); }, 500); } }, _toggle_above_menu: function(e) { if ( $( '.ast-above-header .menu-toggle' ).hasClass( e.data.class ) ) { $( '.ast-above-header .menu-toggle' ).removeClass( e.data.class ); } }, _wp_admin_bar_visible: function(e) { var adminBar = $("#wpadminbar"); if ( adminBar.length ) { if ( adminBar.isInViewport() ) { if ( ! $('body').hasClass('ast-admin-bar-visible') ) { $('body').addClass('ast-admin-bar-visible'); } } else{ if ( $('body').hasClass('ast-admin-bar-visible') ) { $('body').removeClass('ast-admin-bar-visible'); } } } }, _accordion_initial_height: function(e) { // Adds dynamic heights so that slide transitions become smooth. $( '.ast-filter-content' ).each( function( i, obj ) { const currentHeight = $( this ).innerHeight(); $( obj ).css( 'max-height', currentHeight + 'px' ); } ); } }; /** * Initialization */ $(function(){ AstraMenu.init(); }); })(jQuery); modules/menu-sidebar/class-astra-menu-sidebar-animation.php 0000644 00000012574 15150261777 0020067 0 ustar 00 <?php /** * Astra Common Modules Like Off Canvas Sidebar / Flyout Menu * * @package Astra Addon */ define( 'ASTRA_ADDON_EXT_MENU_SIDEBAR_DIR', ASTRA_EXT_DIR . 'classes/modules/menu-sidebar/' ); define( 'ASTRA_ADDON_EXT_MENU_SIDEBAR_URI', ASTRA_EXT_URI . 'classes/modules/menu-sidebar/' ); if ( ! class_exists( 'Astra_Menu_Sidebar_Animation' ) ) { /** * Astra_Menu_Sidebar_Animation initial setup * * @since 1.4.0 */ // @codingStandardsIgnoreStart class Astra_Menu_Sidebar_Animation { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Member Variable * * @var instance */ private static $instance; /** * Member Variable * * @var options */ public static $options; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_action( 'astra_addon_get_js_files', array( $this, 'add_scripts' ) ); add_filter( 'astra_addon_js_localize', array( $this, 'localize_variables' ) ); } /** * Add common js scripts for Flyout, Canvas Sidebar, Fullscreen menu. * * @since 1.4.0 * @return void */ public function add_scripts() { /*** Start Path Logic */ /* Define Variables */ $uri = ASTRA_ADDON_EXT_MENU_SIDEBAR_URI . 'assets/js/'; $path = ASTRA_ADDON_EXT_MENU_SIDEBAR_DIR . 'assets/js/'; /* Directory and Extension */ $file_prefix = '.min'; $dir_name = 'minified'; if ( SCRIPT_DEBUG ) { $file_prefix = ''; $dir_name = 'unminified'; } $js_uri = $uri . $dir_name . '/'; $js_dir = $path . $dir_name . '/'; if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) { $gen_path = $js_uri; } else { $gen_path = $js_dir; } /*** End Path Logic */ $canvas_trigger_type = astra_get_option( 'shop-off-canvas-trigger-type' ); $mobile_menu_style = astra_get_option( 'mobile-menu-style' ); $mobile_above_menu_style = astra_get_option( 'mobile-above-header-menu-style' ); $mobile_below_menu_style = astra_get_option( 'mobile-below-header-menu-style' ); if ( in_array( 'filters', astra_get_option( 'shop-toolbar-structure', array() ) ) || 'flyout' == $mobile_menu_style || 'fullscreen' == $mobile_menu_style || 'flyout' == $mobile_above_menu_style || 'fullscreen' == $mobile_above_menu_style || 'flyout' == $mobile_below_menu_style || 'fullscreen' == $mobile_below_menu_style ) { Astra_Minify::add_dependent_js( 'jquery' ); Astra_Minify::add_js( $gen_path . 'common-sidebar-and-menu' . $file_prefix . '.js' ); } } /** * Add Localize variables * * @since 1.4.0 * @param array $localize_vars Localize variables array. * @return array */ public function localize_variables( $localize_vars ) { $mobile_menu_style = astra_get_option( 'mobile-menu-style' ); $mobile_menu_flyout = astra_get_option( 'flyout-mobile-menu-alignment' ); $above_mobile_menu_style = astra_get_option( 'mobile-above-header-menu-style' ); $above_mobile_menu_flyout = astra_get_option( 'flyout-mobile-above-header-menu-alignment' ); $below_mobile_menu_style = astra_get_option( 'mobile-below-header-menu-style' ); $below_mobile_menu_flyout = astra_get_option( 'flyout-mobile-below-header-menu-alignment' ); // If plugin - 'WooCommerce' not exist then return. if ( class_exists( 'WooCommerce' ) ) { $canvas_trigger_type = astra_get_option( 'shop-off-canvas-trigger-type' ); $canvas_enable = false; $canvas_trigger_class = 'astra-shop-filter-button'; if ( 'shop-filter-flyout' === astra_get_option( 'shop-filter-position' ) && ( is_shop() || is_product_taxonomy() ) ) { $canvas_enable = true; } if ( 'custom-class' == $canvas_trigger_type && '' != $canvas_trigger_class ) { $canvas_trigger_class = astra_get_option( 'shop-filter-trigger-custom-class' ); } if ( in_array( 'filters', astra_get_option( 'shop-toolbar-structure', array() ) ) ) { $localize_vars['off_canvas_trigger_class'] = $canvas_trigger_class; $localize_vars['off_canvas_enable'] = $canvas_enable; } if ( 'flyout' == $mobile_menu_style ) { $localize_vars['main_menu_flyout_alignment'] = $mobile_menu_flyout; } if ( 'flyout' == $above_mobile_menu_style ) { $localize_vars['above_menu_flyout_alignment'] = $above_mobile_menu_flyout; } if ( 'flyout' == $below_mobile_menu_style ) { $localize_vars['below_menu_flyout_alignment'] = $below_mobile_menu_flyout; } } $above_header = astra_get_option( 'header-above-stick' ); $main_header = astra_get_option( 'header-main-stick' ); $below_header = astra_get_option( 'header-below-stick' ); if ( $above_header || $main_header || $below_header ) { $localize_vars['sticky_active'] = true; } else { $localize_vars['sticky_active'] = false; } $localize_vars['svgIconClose'] = Astra_Icons::get_icons( 'close' ); return $localize_vars; } } } /** * Prepare if class 'Astra_Customizer_Loader' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Menu_Sidebar_Animation::get_instance(); modules/target-rule/i18n/af.js 0000644 00000001520 15150261777 0012163 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Verwyders asseblief "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Voer asseblief "+t+" of meer karakters";return n},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var t="Kies asseblief net "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ar.js 0000644 00000001546 15150261777 0012207 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum;return"الرجاء حذف "+t+" عناصر"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"الرجاء إضافة "+t+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){return"تستطيع إختيار "+e.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/az.js 0000644 00000001277 15150261777 0012220 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/bg.js 0000644 00000001614 15150261777 0012171 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/bs.js 0000644 00000001656 15150261777 0012213 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bs",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ca.js 0000644 00000001556 15150261777 0012171 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/cs.js 0000644 00000002346 15150261777 0012211 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadejte o jeden znak méně.":n<=4?"Prosím, zadejte o "+e(n,!0)+" znaky méně.":"Prosím, zadejte o "+n+" znaků méně."},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadejte ještě jeden znak.":n<=4?"Prosím, zadejte ještě další "+e(n,!0)+" znaky.":"Prosím, zadejte ještě dalších "+n+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku.":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky.":"Můžete zvolit maximálně "+n+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/da.js 0000644 00000001452 15150261777 0012165 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Angiv venligst "+t+" tegn mindre"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Angiv venligst "+t+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/de.js 0000644 00000001527 15150261777 0012174 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/dsb.js 0000644 00000001771 15150261777 0012355 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/dsb",[],function(){var e=["znamuško","znamušce","znamuška","znamuškow"],t=["zapisk","zapiska","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Pšosym lašuj "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Pšosym zapódaj nanejmjenjej "+r+" "+n(r,e)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(e){return"Móžoš jano "+e.maximum+" "+n(e.maximum,t)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/el.js 0000644 00000002156 15150261777 0012203 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/en.js 0000644 00000001475 15150261777 0012210 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/es.js 0000644 00000001576 15150261777 0012217 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/et.js 0000644 00000001411 15150261777 0012204 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/eu.js 0000644 00000001516 15150261777 0012213 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/fa.js 0000644 00000001756 15150261777 0012176 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها میتوانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجهای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/fi.js 0000644 00000001420 15150261777 0012172 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/fr.js 0000644 00000001565 15150261777 0012215 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Supprimez "+t+" caractère"+(t>1)?"s":""},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Saisissez au moins "+t+" caractère"+(t>1)?"s":""},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1)?"s":""},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/gl.js 0000644 00000001570 15150261777 0012204 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var t=e.input.length-e.maximum;return t===1?"Elimine un carácter":"Elimine "+t+" caracteres"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t===1?"Engada un carácter":"Engada "+t+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return e.maximum===1?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/he.js 0000644 00000001671 15150261777 0012200 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/hi.js 0000644 00000002147 15150261777 0012203 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/hr.js 0000644 00000001511 15150261777 0012206 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/hsb.js 0000644 00000001772 15150261777 0012362 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hsb",[],function(){var e=["znamješko","znamješce","znamješka","znamješkow"],t=["zapisk","zapiskaj","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Prošu zhašej "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Prošu zapodaj znajmjeńša "+r+" "+n(r,e)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(e){return"Móžeš jenož "+e.maximum+" "+n(e.maximum,t)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/hu.js 0000644 00000001444 15150261777 0012216 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/hy.js 0000644 00000001757 15150261777 0012231 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Խնդրում ենք հեռացնել "+t+" նշան";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Խնդրում ենք մուտքագրել "+t+" կամ ավել նշաններ";return n},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(e){var t="Դուք կարող եք ընտրել առավելագույնը "+e.maximum+" կետ";return t},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/id.js 0000644 00000001362 15150261777 0012175 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/is.js 0000644 00000001407 15150261777 0012214 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/it.js 0000644 00000001556 15150261777 0012222 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ja.js 0000644 00000001522 15150261777 0012171 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/km.js 0000644 00000002053 15150261777 0012206 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ko.js 0000644 00000001530 15150261777 0012207 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/lt.js 0000644 00000001623 15150261777 0012220 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/lv.js 0000644 00000001552 15150261777 0012223 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/mk.js 0000644 00000001725 15150261777 0012213 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ms.js 0000644 00000001431 15150261777 0012215 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/nb.js 0000644 00000001411 15150261777 0012173 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn "+t+" tegn til";return n+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/nl.js 0000644 00000001602 15150261777 0012207 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/pl.js 0000644 00000001637 15150261777 0012221 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ps.js 0000644 00000001775 15150261777 0012233 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="د مهربانۍ لمخي "+t+" توری ړنګ کړئ";return t!=1&&(n=n.replace("توری","توري")),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لږ تر لږه "+t+" يا ډېر توري وليکئ";return n},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(e){var t="تاسو يوازي "+e.maximum+" قلم په نښه کولای سی";return e.maximum!=1&&(t=t.replace("قلم","قلمونه")),t},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/pt-BR.js 0000644 00000001527 15150261777 0012530 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/pt.js 0000644 00000001535 15150261777 0012226 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"caractere",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ro.js 0000644 00000001620 15150261777 0012216 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+" sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/ru.js 0000644 00000002151 15150261777 0012224 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/sk.js 0000644 00000002364 15150261777 0012221 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/sl.js 0000644 00000001574 15150261777 0012224 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Prosim zbrišite "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Prosim vpišite še "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var t="Označite lahko največ "+e.maximum+" predmet";return e.maximum==2?t+="a":e.maximum!=1&&(t+="e"),t},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/sr-Cyrl.js 0000644 00000002055 15150261777 0013134 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/sr.js 0000644 00000001654 15150261777 0012231 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/sv.js 0000644 00000001424 15150261777 0012230 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/th.js 0000644 00000002032 15150261777 0012207 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/tr.js 0000644 00000001407 15150261777 0012226 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/uk.js 0000644 00000002137 15150261777 0012221 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/vi.js 0000644 00000001442 15150261777 0012216 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+" ký tự";return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/zh-CN.js 0000644 00000001403 15150261777 0012514 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/i18n/zh-TW.js 0000644 00000001306 15150261777 0012550 0 ustar 00 /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})(); modules/target-rule/class-astra-target-rules-fields.php 0000644 00000153654 15150261777 0017306 0 ustar 00 <?php /** * Astra Advanced Headers Bar Post Meta Box * * @package Astra Pro */ /** * Meta Boxes setup */ if ( ! class_exists( 'Astra_Target_Rules_Fields' ) ) { /** * Meta Boxes setup */ // @codingStandardsIgnoreStart class Astra_Target_Rules_Fields { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Instance * * @since 1.0.0 * * @var $instance */ private static $instance; /** * Meta Option * * @since 1.0.0 * * @var $meta_option */ private static $meta_option; /** * Current page type * * @since 1.0.0 * * @var $current_page_type */ private static $current_page_type = null; /** * CUrrent page data * * @since 1.0.0 * * @var $current_page_data */ private static $current_page_data = array(); /** * User Selection Option * * @since 1.0.0 * * @var $user_selection */ private static $user_selection; /** * Location Selection Option * * @since 1.0.0 * * @var $location_selection */ private static $location_selection; /** * Initiator * * @since 1.0.0 */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor * * @since 1.0.0 */ public function __construct() { add_action( 'admin_action_edit', array( $this, 'initialize_options' ) ); add_action( 'wp_ajax_astra_get_posts_by_query', array( $this, 'astra_get_posts_by_query' ) ); } /** * Initialize member variables. * * @return void */ public function initialize_options() { self::$user_selection = self::get_user_selections(); self::$location_selection = self::get_location_selections(); } /** * Get location selection options. * * @return array */ public static function get_location_selections() { $args = array( 'public' => true, '_builtin' => true, ); $post_types = get_post_types( $args, 'objects' ); unset( $post_types['attachment'] ); $args['_builtin'] = false; $custom_post_type = get_post_types( $args, 'objects' ); $post_types = apply_filters( 'astra_addon_location_rule_post_types', array_merge( $post_types, $custom_post_type ) ); $special_pages = array( 'special-404' => __( '404 Page', 'astra-addon' ), 'special-search' => __( 'Search Page', 'astra-addon' ), 'special-blog' => __( 'Blog / Posts Page', 'astra-addon' ), 'special-front' => __( 'Front Page', 'astra-addon' ), 'special-date' => __( 'Date Archive', 'astra-addon' ), 'special-author' => __( 'Author Archive', 'astra-addon' ), ); if ( class_exists( 'WooCommerce' ) ) { $special_pages['special-woo-shop'] = __( 'WooCommerce Shop Page', 'astra-addon' ); } $selection_options = array( 'basic' => array( 'label' => __( 'Basic', 'astra-addon' ), 'value' => array( 'basic-global' => __( 'Entire Website', 'astra-addon' ), 'basic-singulars' => __( 'All Singulars', 'astra-addon' ), 'basic-archives' => __( 'All Archives', 'astra-addon' ), ), ), 'special-pages' => array( 'label' => __( 'Special Pages', 'astra-addon' ), 'value' => $special_pages, ), ); $args = array( 'public' => true, ); $taxonomies = get_taxonomies( $args, 'objects' ); if ( ! empty( $taxonomies ) ) { foreach ( $taxonomies as $taxonomy ) { // skip post format taxonomy. if ( 'post_format' == $taxonomy->name ) { continue; } foreach ( $post_types as $post_type ) { $post_opt = self::get_post_target_rule_options( $post_type, $taxonomy ); if ( isset( $selection_options[ $post_opt['post_key'] ] ) ) { if ( ! empty( $post_opt['value'] ) && is_array( $post_opt['value'] ) ) { foreach ( $post_opt['value'] as $key => $value ) { if ( ! in_array( $value, $selection_options[ $post_opt['post_key'] ]['value'] ) ) { $selection_options[ $post_opt['post_key'] ]['value'][ $key ] = $value; } } } } else { $selection_options[ $post_opt['post_key'] ] = array( 'label' => $post_opt['label'], 'value' => $post_opt['value'], ); } } } } $selection_options['specific-target'] = array( 'label' => __( 'Specific Target', 'astra-addon' ), 'value' => array( 'specifics' => __( 'Specific Pages / Posts / Taxonomies, etc.', 'astra-addon' ), ), ); /** * Filter options displayed in the display conditions select field of Display conditions. * * @since 1.5.0 */ return apply_filters( 'astra_addon_display_on_list', $selection_options ); } /** * Get user selection options. * * @return array */ public static function get_user_selections() { $selection_options = array( 'basic' => array( 'label' => __( 'Basic', 'astra-addon' ), 'value' => array( 'all' => __( 'All', 'astra-addon' ), 'logged-in' => __( 'Logged In', 'astra-addon' ), 'logged-out' => __( 'Logged Out', 'astra-addon' ), ), ), 'advanced' => array( 'label' => __( 'Advanced', 'astra-addon' ), 'value' => array(), ), ); /* User roles */ $roles = get_editable_roles(); foreach ( $roles as $slug => $data ) { $selection_options['advanced']['value'][ $slug ] = $data['name']; } /** * Filter options displayed in the user select field of Display conditions. * * @since 1.5.0 */ return apply_filters( 'astra_addon_user_roles_list', $selection_options ); } /** * Get location label by key. * * @param string $key Location option key. * @return string */ public static function get_location_by_key( $key ) { if ( ! isset( self::$location_selection ) || empty( self::$location_selection ) ) { self::$location_selection = self::get_location_selections(); } $location_selection = self::$location_selection; foreach ( $location_selection as $location_grp ) { if ( isset( $location_grp['value'][ $key ] ) ) { return $location_grp['value'][ $key ]; } } if ( strpos( $key, 'post-' ) !== false ) { $post_id = (int) str_replace( 'post-', '', $key ); return get_the_title( $post_id ); } // taxonomy options. if ( strpos( $key, 'tax-' ) !== false ) { $tax_id = (int) str_replace( 'tax-', '', $key ); $term = get_term( $tax_id ); if ( ! is_wp_error( $term ) ) { $term_taxonomy = ucfirst( str_replace( '_', ' ', $term->taxonomy ) ); return $term->name . ' - ' . $term_taxonomy; } else { return ''; } } return $key; } /** * Get user label by key. * * @param string $key User option key. * @return string */ public static function get_user_by_key( $key ) { if ( ! isset( self::$user_selection ) || empty( self::$user_selection ) ) { self::$user_selection = self::get_user_selections(); } $user_selection = self::$user_selection; if ( isset( $user_selection['basic']['value'][ $key ] ) ) { return $user_selection['basic']['value'][ $key ]; } elseif ( $user_selection['advanced']['value'][ $key ] ) { return $user_selection['advanced']['value'][ $key ]; } return $key; } /** * Ajax handeler to return the posts based on the search query. * When searching for the post/pages only titles are searched for. * * @since 1.0.0 */ public function astra_get_posts_by_query() { check_ajax_referer( 'astra-addon-get-posts-by-query', 'nonce' ); $search_string = isset( $_POST['q'] ) ? sanitize_text_field( $_POST['q'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing $data = array(); $result = array(); $args = array( 'public' => true, '_builtin' => false, ); $output = 'names'; // names or objects, note names is the default. $operator = 'and'; // also supports 'or'. $post_types = get_post_types( $args, $output, $operator ); $post_types['Posts'] = 'post'; $post_types['Pages'] = 'page'; foreach ( $post_types as $key => $post_type ) { $data = array(); add_filter( 'posts_search', array( $this, 'search_only_titles' ), 10, 2 ); $query = new WP_Query( array( 's' => $search_string, 'post_type' => $post_type, 'posts_per_page' => - 1, ) ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); $title = get_the_title(); $title .= ( 0 != $query->post->post_parent ) ? ' (' . get_the_title( $query->post->post_parent ) . ')' : ''; $id = get_the_id(); $data[] = array( 'id' => 'post-' . $id, 'text' => $title, ); } } if ( is_array( $data ) && ! empty( $data ) ) { $result[] = array( 'text' => $key, 'children' => $data, ); } } $data = array(); wp_reset_postdata(); $args = array( 'public' => true, ); $output = 'objects'; // names or objects, note names is the default. $operator = 'and'; // also supports 'or'. $taxonomies = get_taxonomies( $args, $output, $operator ); foreach ( $taxonomies as $taxonomy ) { $terms = get_terms( $taxonomy->name, array( 'orderby' => 'count', 'hide_empty' => 0, 'name__like' => $search_string, ) ); $data = array(); $label = ucwords( $taxonomy->label ); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { $term_taxonomy_name = ucfirst( str_replace( '_', ' ', $taxonomy->name ) ); $data[] = array( 'id' => 'tax-' . $term->term_id, 'text' => $term->name . ' archive page', ); $data[] = array( 'id' => 'tax-' . $term->term_id . '-single-' . $taxonomy->name, 'text' => 'All singulars from ' . $term->name, ); } } if ( is_array( $data ) && ! empty( $data ) ) { $result[] = array( 'text' => $label, 'children' => $data, ); } } // return the result in json. wp_send_json( $result ); } /** * Return search results only by post title. * This is only run from astra_get_posts_by_query() * * @param (string) $search Search SQL for WHERE clause. * @param (WP_Query) $wp_query The current WP_Query object. * * @return (string) The Modified Search SQL for WHERE clause. */ public function search_only_titles( $search, $wp_query ) { if ( ! empty( $search ) && ! empty( $wp_query->query_vars['search_terms'] ) ) { global $wpdb; $q = $wp_query->query_vars; $n = ! empty( $q['exact'] ) ? '' : '%'; $search = array(); foreach ( (array) $q['search_terms'] as $term ) { $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $n . $wpdb->esc_like( $term ) . $n ); } if ( ! is_user_logged_in() ) { $search[] = "$wpdb->posts.post_password = ''"; } $search = ' AND ' . implode( ' AND ', $search ); } return $search; } /** * Function Name: admin_styles. * Function Description: admin_styles. */ public function admin_styles() { wp_enqueue_script( 'astra-select2', ASTRA_EXT_URI . 'classes/modules/target-rule/select2.js', array( 'jquery' ), ASTRA_EXT_VER, true ); $wp_lang = get_locale(); $ast_lang = ''; if ( '' !== $wp_lang ) { $select2_lang = array( '' => 'en', 'hi_IN' => 'hi', 'mr' => 'mr', 'af' => 'af', 'ar' => 'ar', 'ary' => 'ar', 'as' => 'as', 'azb' => 'az', 'az' => 'az', 'bel' => 'be', 'bg_BG' => 'bg', 'bn_BD' => 'bn', 'bo' => 'bo', 'bs_BA' => 'bs', 'ca' => 'ca', 'ceb' => 'ceb', 'cs_CZ' => 'cs', 'cy' => 'cy', 'da_DK' => 'da', 'de_CH' => 'de', 'de_DE' => 'de', 'de_DE_formal' => 'de', 'de_CH_informal' => 'de', 'dzo' => 'dz', 'el' => 'el', 'en_CA' => 'en', 'en_GB' => 'en', 'en_AU' => 'en', 'en_NZ' => 'en', 'en_ZA' => 'en', 'eo' => 'eo', 'es_MX' => 'es', 'es_VE' => 'es', 'es_CR' => 'es', 'es_CO' => 'es', 'es_GT' => 'es', 'es_ES' => 'es', 'es_CL' => 'es', 'es_PE' => 'es', 'es_AR' => 'es', 'et' => 'et', 'eu' => 'eu', 'fa_IR' => 'fa', 'fi' => 'fi', 'fr_BE' => 'fr', 'fr_FR' => 'fr', 'fr_CA' => 'fr', 'gd' => 'gd', 'gl_ES' => 'gl', 'gu' => 'gu', 'haz' => 'haz', 'he_IL' => 'he', 'hr' => 'hr', 'hu_HU' => 'hu', 'hy' => 'hy', 'id_ID' => 'id', 'is_IS' => 'is', 'it_IT' => 'it', 'ja' => 'ja', 'jv_ID' => 'jv', 'ka_GE' => 'ka', 'kab' => 'kab', 'km' => 'km', 'ko_KR' => 'ko', 'ckb' => 'ku', 'lo' => 'lo', 'lt_LT' => 'lt', 'lv' => 'lv', 'mk_MK' => 'mk', 'ml_IN' => 'ml', 'mn' => 'mn', 'ms_MY' => 'ms', 'my_MM' => 'my', 'nb_NO' => 'nb', 'ne_NP' => 'ne', 'nl_NL' => 'nl', 'nl_NL_formal' => 'nl', 'nl_BE' => 'nl', 'nn_NO' => 'nn', 'oci' => 'oc', 'pa_IN' => 'pa', 'pl_PL' => 'pl', 'ps' => 'ps', 'pt_BR' => 'pt', 'pt_PT_ao90' => 'pt', 'pt_PT' => 'pt', 'rhg' => 'rhg', 'ro_RO' => 'ro', 'ru_RU' => 'ru', 'sah' => 'sah', 'si_LK' => 'si', 'sk_SK' => 'sk', 'sl_SI' => 'sl', 'sq' => 'sq', 'sr_RS' => 'sr', 'sv_SE' => 'sv', 'szl' => 'szl', 'ta_IN' => 'ta', 'te' => 'te', 'th' => 'th', 'tl' => 'tl', 'tr_TR' => 'tr', 'tt_RU' => 'tt', 'tah' => 'ty', 'ug_CN' => 'ug', 'uk' => 'uk', 'ur' => 'ur', 'uz_UZ' => 'uz', 'vi' => 'vi', 'zh_CN' => 'zh', 'zh_TW' => 'zh', 'zh_HK' => 'zh', ); if ( isset( $select2_lang[ $wp_lang ] ) && file_exists( ASTRA_EXT_DIR . 'classes/modules/target-rule/i18n/' . $select2_lang[ $wp_lang ] . '.js' ) ) { $ast_lang = $select2_lang[ $wp_lang ]; wp_enqueue_script( 'astra-select2-lang', ASTRA_EXT_URI . 'classes/modules/target-rule/i18n/' . $select2_lang[ $wp_lang ] . '.js', array( 'jquery', 'astra-select2', ), ASTRA_EXT_VER, true ); } } wp_enqueue_script( 'astra-target-rule', ASTRA_EXT_URI . 'classes/modules/target-rule/target-rule.js', array( 'jquery', 'astra-select2', ), ASTRA_EXT_VER, true ); wp_enqueue_script( 'astra-user-role', ASTRA_EXT_URI . 'classes/modules/target-rule/user-role.js', array( 'jquery', ), ASTRA_EXT_VER, true ); wp_enqueue_style( 'astra-select2', ASTRA_EXT_URI . 'classes/modules/target-rule/select2.css', '', ASTRA_EXT_VER ); wp_enqueue_style( 'astra-target-rule', ASTRA_EXT_URI . 'classes/modules/target-rule/target-rule.css', '', ASTRA_EXT_VER ); /** * Registered localize vars */ $localize_vars = array( 'ast_lang' => $ast_lang, 'please_enter' => __( 'Please enter', 'astra-addon' ), 'please_delete' => __( 'Please delete', 'astra-addon' ), 'more_char' => __( 'or more characters', 'astra-addon' ), 'character' => __( 'character', 'astra-addon' ), 'loading' => __( 'Loading more results…', 'astra-addon' ), 'only_select' => __( 'You can only select', 'astra-addon' ), 'item' => __( 'item', 'astra-addon' ), 'char_s' => __( 's', 'astra-addon' ), 'no_result' => __( 'No results found', 'astra-addon' ), 'searching' => __( 'Searching…', 'astra-addon' ), 'not_loader' => __( 'The results could not be loaded.', 'astra-addon' ), 'search' => __( 'Search pages / post / categories', 'astra-addon' ), 'ajax_nonce' => wp_create_nonce( 'astra-addon-get-posts-by-query' ), ); wp_localize_script( 'astra-select2', 'astRules', $localize_vars ); } /** * Function Name: target_rule_settings_field. * Function Description: Function to handle new input type. * * @param string $name string parameter. * @param string $settings string parameter. * @param string $value string parameter. */ public static function target_rule_settings_field( $name, $settings, $value ) { $input_name = $name; $type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule'; $class = isset( $settings['class'] ) ? $settings['class'] : ''; $rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule'; $add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', 'astra-addon' ); $saved_values = $value; $output = ''; if ( isset( self::$location_selection ) || empty( self::$location_selection ) ) { self::$location_selection = self::get_location_selections(); } $selection_options = self::$location_selection; /* WP Template Format */ $output .= '<script type="text/html" id="tmpl-astra-target-rule-' . $rule_type . '-condition">'; $output .= '<div class="astra-target-rule-condition ast-target-rule-{{data.id}}" data-rule="{{data.id}}" >'; $output .= '<span class="target_rule-condition-delete dashicons dashicons-dismiss"></span>'; /* Condition Selection */ $output .= '<div class="target_rule-condition-wrap" >'; $output .= '<select name="' . esc_attr( $input_name ) . '[rule][{{data.id}}]" class="target_rule-condition form-control ast-input">'; $output .= '<option value="">' . __( 'Select', 'astra-addon' ) . '</option>'; foreach ( $selection_options as $group => $group_data ) { $output .= '<optgroup label="' . $group_data['label'] . '">'; foreach ( $group_data['value'] as $opt_key => $opt_value ) { $output .= '<option value="' . $opt_key . '">' . $opt_value . '</option>'; } $output .= '</optgroup>'; } $output .= '</select>'; $output .= '</div>'; $output .= '</div> <!-- astra-target-rule-condition -->'; /* Specific page selection */ $output .= '<div class="target_rule-specific-page-wrap" style="display:none">'; $output .= '<select name="' . esc_attr( $input_name ) . '[specific][]" class="target-rule-select2 target_rule-specific-page form-control ast-input " multiple="multiple">'; $output .= '</select>'; $output .= '</div>'; $output .= '</script>'; /* Wrapper Start */ $output .= '<div class="ast-target-rule-wrapper ast-target-rule-' . $rule_type . '-on-wrap" data-type="' . $rule_type . '">'; $output .= '<div class="ast-target-rule-selector-wrapper ast-target-rule-' . $rule_type . '-on">'; $output .= self::generate_target_rule_selector( $rule_type, $selection_options, $input_name, $saved_values, $add_rule_label ); $output .= '</div>'; /* Wrapper end */ $output .= '</div>'; echo wp_kses( $output, array( 'select' => array( 'class' => array(), 'name' => array(), 'multiple' => array(), ), 'script' => array( 'type' => array(), 'id' => array(), ), 'span' => array( 'class' => array(), ), 'a' => array( 'href' => array(), 'class' => array(), 'data-rule-id' => array(), 'data-rule-type' => array(), ), 'option' => array( 'class' => array(), 'value' => array(), 'selected' => array(), ), 'optgroup' => array( 'class' => array(), 'label' => array(), ), 'div' => array( 'class' => array(), 'style' => array(), 'data-type' => array(), 'data-rule' => array(), ), ) ); } /** * Get target rules for generating the markup for rule selector. * * @since 1.0.0 * * @param object $post_type post type parameter. * @param object $taxonomy taxonomy for creating the target rule markup. */ public static function get_post_target_rule_options( $post_type, $taxonomy ) { $post_key = str_replace( ' ', '-', strtolower( $post_type->label ) ); $post_label = ucwords( $post_type->label ); $post_name = $post_type->name; $post_option = array(); /* translators: %s post label */ $all_posts = sprintf( __( 'All %s', 'astra-addon' ), $post_label ); $post_option[ $post_name . '|all' ] = $all_posts; if ( 'pages' != $post_key ) { /* translators: %s post label */ $all_archive = sprintf( __( 'All %s Archive', 'astra-addon' ), $post_label ); $post_option[ $post_name . '|all|archive' ] = $all_archive; } if ( in_array( $post_type->name, $taxonomy->object_type ) ) { $tax_label = ucwords( $taxonomy->label ); $tax_name = $taxonomy->name; /* translators: %s taxonomy label */ $tax_archive = sprintf( __( 'All %s Archive', 'astra-addon' ), $tax_label ); $post_option[ $post_name . '|all|taxarchive|' . $tax_name ] = $tax_archive; } $post_output['post_key'] = $post_key; $post_output['label'] = $post_label; $post_output['value'] = $post_option; return $post_output; } /** * Generate markup for rendering the location selction. * * @since 1.0.0 * @param String $type Rule type display|exclude. * @param Array $selection_options Array for available selection fields. * @param String $input_name Input name for the settings. * @param Array $saved_values Array of saved valued. * @param String $add_rule_label Label for the Add rule button. * * @return HTML Markup for for the location settings. */ public static function generate_target_rule_selector( $type, $selection_options, $input_name, $saved_values, $add_rule_label ) { $output = '<div class="target_rule-builder-wrap">'; if ( ! is_array( $saved_values ) || ( is_array( $saved_values ) && empty( $saved_values ) ) ) { $saved_values = array(); $saved_values['rule'][0] = ''; $saved_values['specific'][0] = ''; } $index = 0; foreach ( $saved_values['rule'] as $index => $data ) { $output .= '<div class="astra-target-rule-condition ast-target-rule-' . $index . '" data-rule="' . $index . '" >'; /* Condition Selection */ $output .= '<span class="target_rule-condition-delete dashicons dashicons-dismiss"></span>'; $output .= '<div class="target_rule-condition-wrap" >'; $output .= '<select name="' . esc_attr( $input_name ) . '[rule][' . $index . ']" class="target_rule-condition form-control ast-input">'; $output .= '<option value="">' . __( 'Select', 'astra-addon' ) . '</option>'; foreach ( $selection_options as $group => $group_data ) { $output .= '<optgroup label="' . $group_data['label'] . '">'; foreach ( $group_data['value'] as $opt_key => $opt_value ) { // specific rules. $selected = ''; if ( $data == $opt_key ) { $selected = 'selected="selected"'; } $output .= '<option value="' . $opt_key . '" ' . $selected . '>' . $opt_value . '</option>'; } $output .= '</optgroup>'; } $output .= '</select>'; $output .= '</div>'; $output .= '</div>'; /* Specific page selection */ $output .= '<div class="target_rule-specific-page-wrap" style="display:none">'; $output .= '<select name="' . esc_attr( $input_name ) . '[specific][]" class="target-rule-select2 target_rule-specific-page form-control ast-input " multiple="multiple">'; if ( 'specifics' == $data && isset( $saved_values['specific'] ) && null != $saved_values['specific'] && is_array( $saved_values['specific'] ) ) { foreach ( $saved_values['specific'] as $data_key => $sel_value ) { // posts. if ( strpos( $sel_value, 'post-' ) !== false ) { $post_id = (int) str_replace( 'post-', '', $sel_value ); $post_title = get_the_title( $post_id ); $output .= '<option value="post-' . $post_id . '" selected="selected" >' . $post_title . '</option>'; } // taxonomy options. if ( strpos( $sel_value, 'tax-' ) !== false ) { $tax_data = explode( '-', $sel_value ); $tax_id = (int) str_replace( 'tax-', '', $sel_value ); $term = get_term( $tax_id ); $term_name = ''; if ( ! is_wp_error( $term ) ) { $term_taxonomy = ucfirst( str_replace( '_', ' ', $term->taxonomy ) ); if ( isset( $tax_data[2] ) && 'single' === $tax_data[2] ) { $term_name = 'All singulars from ' . $term->name; } else { $term_name = $term->name . ' - ' . $term_taxonomy; } } $output .= '<option value="' . $sel_value . '" selected="selected" >' . $term_name . '</option>'; } } } $output .= '</select>'; $output .= '</div>'; } $output .= '</div>'; /* Add new rule */ $output .= '<div class="target_rule-add-rule-wrap">'; $output .= '<a href="#" class="button" data-rule-id="' . absint( $index ) . '" data-rule-type="' . $type . '">' . $add_rule_label . '</a>'; $output .= '</div>'; if ( 'display' == $type ) { /* Add new rule */ $output .= '<div class="target_rule-add-exclusion-rule">'; $output .= '<a href="#" class="button">' . __( 'Add Exclusion Rule', 'astra-addon' ) . '</a>'; $output .= '</div>'; } return $output; } /** * Get current layout. * Checks of the passed post id of the layout is to be displayed in the page. * * @param int $layout_id Layout ID. * @param string $option Option prefix. * * @return int|boolean If the current layout is to be displayed it will be returned back else a boolean will be passed. */ public function get_current_layout( $layout_id, $option ) { $post_id = ( ! is_404() && ! is_search() && ! is_archive() && ! is_home() ) ? get_the_id() : false; $current_layout = false; $is_exclude = false; $is_user_role = false; $display_on = get_post_meta( $layout_id, $option . '-location', true ); $exclude_on = get_post_meta( $layout_id, $option . '-exclusion', true ); $user_roles = get_post_meta( $layout_id, $option . '-users', true ); /* Parse Display On Condition */ $is_display = $this->parse_layout_display_condition( $post_id, $display_on ); if ( true == $is_display ) { /* Parse Exclude On Condition */ $is_exclude = $this->parse_layout_display_condition( $post_id, $exclude_on ); /* Parse User Role Condition */ $is_user_role = $this->parse_user_role_condition( $post_id, $user_roles ); } if ( $is_display && ! $is_exclude && $is_user_role ) { $current_layout = $layout_id; } // filter target page settings. $current_layout = apply_filters( 'astra_addon_target_page_settings', $current_layout, $layout_id ); return $current_layout; } /** * Checks for the display condition for the current page/ * * @param int $post_id Current post ID. * @param array $rules Array of rules Display on | Exclude on. * * @return boolean Returns true or false depending on if the $rules match for the current page and the layout is to be displayed. */ public function parse_layout_display_condition( $post_id, $rules ) { $display = false; $current_post_type = get_post_type( $post_id ); if ( isset( $rules['rule'] ) && is_array( $rules['rule'] ) && ! empty( $rules['rule'] ) ) { foreach ( $rules['rule'] as $key => $rule ) { if ( ! empty( $rule ) ) { if ( strrpos( $rule, 'all' ) !== false ) { $rule_case = 'all'; } else { $rule_case = $rule; } switch ( $rule_case ) { case 'basic-global': $display = true; break; case 'basic-singulars': if ( is_singular() ) { $display = true; } break; case 'basic-archives': if ( is_archive() ) { $display = true; } break; case 'special-404': if ( is_404() ) { $display = true; } break; case 'special-search': if ( is_search() ) { $display = true; } break; case 'special-blog': if ( is_home() ) { $display = true; } break; case 'special-front': if ( is_front_page() ) { $display = true; } break; case 'special-date': if ( is_date() ) { $display = true; } break; case 'special-author': if ( is_author() ) { $display = true; } break; case 'special-woo-shop': if ( function_exists( 'is_shop' ) && is_shop() ) { $display = true; } break; case 'all': $rule_data = explode( '|', $rule ); $post_type = isset( $rule_data[0] ) ? $rule_data[0] : false; $archieve_type = isset( $rule_data[2] ) ? $rule_data[2] : false; $taxonomy = isset( $rule_data[3] ) ? $rule_data[3] : false; if ( false === $archieve_type ) { $current_post_type = get_post_type( $post_id ); if ( false !== $post_id && $current_post_type == $post_type ) { $display = true; } } else { if ( is_archive() ) { $current_post_type = get_post_type(); if ( $current_post_type == $post_type ) { if ( 'archive' == $archieve_type ) { $display = true; } elseif ( 'taxarchive' == $archieve_type ) { $obj = get_queried_object(); $current_taxonomy = ''; if ( '' !== $obj && null !== $obj ) { $current_taxonomy = $obj->taxonomy; } if ( $current_taxonomy == $taxonomy ) { $display = true; } } } } } break; case 'specifics': if ( isset( $rules['specific'] ) && is_array( $rules['specific'] ) ) { foreach ( $rules['specific'] as $specific_page ) { $specific_data = explode( '-', $specific_page ); $specific_post_type = isset( $specific_data[0] ) ? $specific_data[0] : false; $specific_post_id = isset( $specific_data[1] ) ? $specific_data[1] : false; if ( 'post' == $specific_post_type ) { if ( $specific_post_id == $post_id ) { $display = true; } } elseif ( isset( $specific_data[2] ) && ( 'single' == $specific_data[2] ) && 'tax' == $specific_post_type ) { if ( is_singular() ) { $term_details = get_term( $specific_post_id ); if ( isset( $term_details->taxonomy ) ) { $has_term = has_term( (int) $specific_post_id, $term_details->taxonomy, $post_id ); if ( $has_term ) { $display = true; } } } } elseif ( 'tax' == $specific_post_type ) { $tax_id = get_queried_object_id(); if ( $specific_post_id == $tax_id ) { $display = true; } } } } break; default: break; } } if ( $display ) { break; } } } return $display; } /** * Function Name: target_user_role_settings_field. * Function Description: Function to handle new input type. * * @param string $name string parameter. * @param string $settings string parameter. * @param string $value string parameter. */ public static function target_user_role_settings_field( $name, $settings, $value ) { $input_name = $name; $type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule'; $class = isset( $settings['class'] ) ? $settings['class'] : ''; $rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule'; $add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', 'astra-addon' ); $saved_values = $value; $output = ''; if ( ! isset( self::$user_selection ) || empty( self::$user_selection ) ) { self::$user_selection = self::get_user_selections(); } $selection_options = self::$user_selection; /* WP Template Format */ $output .= '<script type="text/html" id="tmpl-astra-user-role-condition">'; $output .= '<div class="astra-user-role-condition ast-user-role-{{data.id}}" data-rule="{{data.id}}" >'; $output .= '<span class="user_role-condition-delete dashicons dashicons-dismiss"></span>'; /* Condition Selection */ $output .= '<div class="user_role-condition-wrap" >'; $output .= '<select name="' . esc_attr( $input_name ) . '[{{data.id}}]" class="user_role-condition form-control ast-input">'; $output .= '<option value="">' . __( 'Select', 'astra-addon' ) . '</option>'; foreach ( $selection_options as $group => $group_data ) { $output .= '<optgroup label="' . $group_data['label'] . '">'; foreach ( $group_data['value'] as $opt_key => $opt_value ) { $output .= '<option value="' . $opt_key . '">' . $opt_value . '</option>'; } $output .= '</optgroup>'; } $output .= '</select>'; $output .= '</div>'; $output .= '</div> <!-- astra-user-role-condition -->'; $output .= '</script>'; if ( ! is_array( $saved_values ) || ( is_array( $saved_values ) && empty( $saved_values ) ) ) { $saved_values = array(); $saved_values[0] = ''; } $index = 0; $output .= '<div class="ast-user-role-wrapper ast-user-role-display-on-wrap" data-type="display">'; $output .= '<div class="ast-user-role-selector-wrapper ast-user-role-display-on">'; $output .= '<div class="user_role-builder-wrap">'; foreach ( $saved_values as $index => $data ) { $output .= '<div class="astra-user-role-condition ast-user-role-' . $index . '" data-rule="' . $index . '" >'; $output .= '<span class="user_role-condition-delete dashicons dashicons-dismiss"></span>'; /* Condition Selection */ $output .= '<div class="user_role-condition-wrap" >'; $output .= '<select name="' . esc_attr( $input_name ) . '[' . $index . ']" class="user_role-condition form-control ast-input">'; $output .= '<option value="">' . __( 'Select', 'astra-addon' ) . '</option>'; foreach ( $selection_options as $group => $group_data ) { $output .= '<optgroup label="' . $group_data['label'] . '">'; foreach ( $group_data['value'] as $opt_key => $opt_value ) { $output .= '<option value="' . $opt_key . '" ' . selected( $data, $opt_key, false ) . '>' . $opt_value . '</option>'; } $output .= '</optgroup>'; } $output .= '</select>'; $output .= '</div>'; $output .= '</div> <!-- astra-user-role-condition -->'; } $output .= '</div>'; /* Add new rule */ $output .= '<div class="user_role-add-rule-wrap">'; $output .= '<a href="#" class="button" data-rule-id="' . absint( $index ) . '">' . $add_rule_label . '</a>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; echo wp_kses( $output, array( 'select' => array( 'class' => array(), 'name' => array(), 'multiple' => array(), ), 'script' => array( 'type' => array(), 'id' => array(), ), 'span' => array( 'class' => array(), ), 'a' => array( 'href' => array(), 'class' => array(), 'data-rule-id' => array(), 'data-rule-type' => array(), ), 'option' => array( 'class' => array(), 'value' => array(), 'selected' => array(), ), 'optgroup' => array( 'class' => array(), 'label' => array(), ), 'div' => array( 'class' => array(), 'style' => array(), 'data-type' => array(), 'data-rule' => array(), ), ) ); } /** * Parse user role condition. * * @since 1.0.0 * @param int $post_id Post ID. * @param Array $rules Current user rules. * * @return boolean True = user condition passes. False = User condition does not pass. */ public function parse_user_role_condition( $post_id, $rules ) { $show_popup = true; if ( is_array( $rules ) && ! empty( $rules ) ) { $show_popup = false; foreach ( $rules as $i => $rule ) { switch ( $rule ) { case '': case 'all': $show_popup = true; break; case 'logged-in': if ( is_user_logged_in() ) { $show_popup = true; } break; case 'logged-out': if ( ! is_user_logged_in() ) { $show_popup = true; } break; default: if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); if ( isset( $current_user->roles ) && is_array( $current_user->roles ) && in_array( $rule, $current_user->roles ) ) { $show_popup = true; } } break; } if ( $show_popup ) { break; } } } return $show_popup; } /** * Get current page type * * @since 1.0.0 * * @return string Page Type. */ public function get_current_page_type() { if ( null === self::$current_page_type ) { $page_type = ''; $current_id = false; if ( is_404() ) { $page_type = 'is_404'; } elseif ( is_search() ) { $page_type = 'is_search'; } elseif ( is_archive() ) { $page_type = 'is_archive'; if ( is_category() || is_tag() || is_tax() ) { $page_type = 'is_tax'; } elseif ( is_date() ) { $page_type = 'is_date'; } elseif ( is_author() ) { $page_type = 'is_author'; } elseif ( function_exists( 'is_shop' ) && is_shop() ) { $page_type = 'is_woo_shop_page'; } } elseif ( is_home() ) { $page_type = 'is_home'; } elseif ( is_front_page() ) { $page_type = 'is_front_page'; $current_id = get_the_id(); } elseif ( is_singular() ) { $page_type = 'is_singular'; $current_id = get_the_id(); } else { $current_id = get_the_id(); } self::$current_page_data['ID'] = $current_id; self::$current_page_type = $page_type; } return self::$current_page_type; } /** * Get posts by conditions * * @since 1.0.0 * @param string $post_type Post Type. * @param array $option meta option name. * * @return object Posts. */ public function get_posts_by_conditions( $post_type, $option ) { global $wpdb; global $post; $post_type = $post_type ? esc_sql( $post_type ) : esc_sql( $post->post_type ); if ( is_array( self::$current_page_data ) && isset( self::$current_page_data[ $post_type ] ) ) { return apply_filters( 'astra_addon_get_display_posts_by_conditions', self::$current_page_data[ $post_type ], $post_type ); } $current_page_type = $this->get_current_page_type(); self::$current_page_data[ $post_type ] = array(); $option['current_post_id'] = self::$current_page_data['ID']; $meta_header = self::get_meta_option_post( $post_type, $option ); /* Meta option is enabled */ if ( false === $meta_header ) { $current_post_type = esc_sql( get_post_type() ); $current_post_id = false; $q_obj = get_queried_object(); $location = isset( $option['location'] ) ? esc_sql( $option['location'] ) : ''; $wpml_translate_query = ''; $wpml_translate_query_condition = ''; $check_wpml = false; if ( class_exists( 'SitePress' ) ) { global $sitepress; $cpt_translation_mode = apply_filters( 'wpml_sub_setting', false, 'custom_posts_sync_option', 'astra-advanced-hook' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( false != $cpt_translation_mode ) { $check_wpml = true; $current_language = $sitepress->get_current_language(); $wpml_translate_query = "INNER JOIN {$wpdb->prefix}icl_translations as icl ON pm.post_id = icl.element_id"; $wpml_translate_query_condition = "AND icl.language_code = '{$current_language}'"; } } /* Entire Website */ $meta_args = "pm.meta_value LIKE '%\"basic-global\"%'"; $meta_args = apply_filters( 'astra_addon_meta_args_post_by_condition', $meta_args, $q_obj, $current_post_id ); switch ( $current_page_type ) { case 'is_404': $meta_args .= " OR pm.meta_value LIKE '%\"special-404\"%'"; break; case 'is_search': $meta_args .= " OR pm.meta_value LIKE '%\"special-search\"%'"; break; case 'is_archive': case 'is_tax': case 'is_date': case 'is_author': $meta_args .= " OR pm.meta_value LIKE '%\"basic-archives\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|archive\"%'"; if ( 'is_tax' == $current_page_type && ( is_category() || is_tag() || is_tax() ) ) { if ( is_object( $q_obj ) ) { $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|taxarchive|{$q_obj->taxonomy}\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$q_obj->term_id}\"%'"; } } elseif ( 'is_date' == $current_page_type ) { $meta_args .= " OR pm.meta_value LIKE '%\"special-date\"%'"; } elseif ( 'is_author' == $current_page_type ) { $meta_args .= " OR pm.meta_value LIKE '%\"special-author\"%'"; } break; case 'is_home': $meta_args .= " OR pm.meta_value LIKE '%\"special-blog\"%'"; break; case 'is_front_page': $current_id = esc_sql( get_the_id() ); $current_post_id = $current_id; $meta_args .= " OR pm.meta_value LIKE '%\"special-front\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'"; break; case 'is_singular': $current_id = esc_sql( get_the_id() ); if ( $check_wpml ) { $current_id = icl_object_id( $current_id, $current_post_type, true, $current_language ); } $current_post_id = $current_id; $meta_args .= " OR pm.meta_value LIKE '%\"basic-singulars\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'"; if ( is_object( $q_obj ) ) { $taxonomies = get_object_taxonomies( $q_obj->post_type ); $terms = wp_get_post_terms( $q_obj->ID, $taxonomies ); foreach ( $terms as $key => $term ) { $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$term->term_id}-single-{$term->taxonomy}\"%'"; } } break; case 'is_woo_shop_page': $meta_args .= " OR pm.meta_value LIKE '%\"special-woo-shop\"%'"; break; case '': $current_post_id = get_the_id(); break; } $wpdb->ast_meta_args = $meta_args; $wpdb->ast_wpml_translate_query = $wpml_translate_query; $wpdb->ast_wpml_translate_query_condition = $wpml_translate_query_condition; $posts = $wpdb->get_results( $wpdb->prepare( "SELECT p.ID, pm.meta_value FROM {$wpdb->postmeta} as pm INNER JOIN {$wpdb->posts} as p ON pm.post_id = p.ID {$wpdb->ast_wpml_translate_query} WHERE pm.meta_key = ('%1s') AND p.post_type = ('%2s') {$wpdb->ast_wpml_translate_query_condition} AND p.post_status = 'publish' AND ({$wpdb->ast_meta_args}) ORDER BY p.post_date DESC", $location, $post_type ) ); foreach ( $posts as $local_post ) { self::$current_page_data[ $post_type ][ $local_post->ID ] = array( 'id' => $local_post->ID, 'location' => maybe_unserialize( $local_post->meta_value ), ); } $option['current_post_id'] = $current_post_id; $this->remove_exclusion_rule_posts( $post_type, $option ); $this->remove_user_rule_posts( $post_type, $option ); } return apply_filters( 'astra_addon_get_display_posts_by_conditions', self::$current_page_data[ $post_type ], $post_type ); } /** * Remove exclusion rule posts. * * @since 1.0.0 * @param string $post_type Post Type. * @param array $option meta option name. */ public function remove_exclusion_rule_posts( $post_type, $option ) { $exclusion = isset( $option['exclusion'] ) ? $option['exclusion'] : ''; $current_post_id = isset( $option['current_post_id'] ) ? $option['current_post_id'] : false; foreach ( self::$current_page_data[ $post_type ] as $c_post_id => $c_data ) { $exclusion_rules = get_post_meta( $c_post_id, $exclusion, true ); $is_exclude = $this->parse_layout_display_condition( $current_post_id, $exclusion_rules ); if ( $is_exclude ) { unset( self::$current_page_data[ $post_type ][ $c_post_id ] ); } } } /** * Remove user rule posts. * * @since 1.0.0 * @param int $post_type Post Type. * @param array $option meta option name. */ public function remove_user_rule_posts( $post_type, $option ) { $users = isset( $option['users'] ) ? $option['users'] : ''; $current_post_id = isset( $option['current_post_id'] ) ? $option['current_post_id'] : false; foreach ( self::$current_page_data[ $post_type ] as $c_post_id => $c_data ) { $user_rules = get_post_meta( $c_post_id, $users, true ); $is_user = $this->parse_user_role_condition( $current_post_id, $user_rules ); if ( ! $is_user ) { unset( self::$current_page_data[ $post_type ][ $c_post_id ] ); } } } /** * Same display_on notice. * * @since 1.0.0 * @param int $post_type Post Type. * @param array $option meta option name. */ public static function same_display_on_notice( $post_type, $option ) { global $wpdb; global $post; $all_rules = array(); $already_set_rule = array(); $location = isset( $option['location'] ) ? $option['location'] : ''; $all_headers = $wpdb->get_results( $wpdb->prepare( "SELECT p.ID, p.post_title, pm.meta_value FROM {$wpdb->postmeta} as pm INNER JOIN {$wpdb->posts} as p ON pm.post_id = p.ID WHERE pm.meta_key = %s AND p.post_type = %s AND p.post_status = 'publish'", $location, $post_type ) ); foreach ( $all_headers as $header ) { $location_rules = maybe_unserialize( $header->meta_value ); if ( is_array( $location_rules ) && isset( $location_rules['rule'] ) ) { foreach ( $location_rules['rule'] as $key => $rule ) { if ( ! isset( $all_rules[ $rule ] ) ) { $all_rules[ $rule ] = array(); } if ( 'specifics' == $rule && isset( $location_rules['specific'] ) && is_array( $location_rules['specific'] ) ) { foreach ( $location_rules['specific'] as $s_index => $s_value ) { $all_rules[ $rule ][ $s_value ][ $header->ID ] = array( 'ID' => $header->ID, 'name' => $header->post_title, ); } } else { $all_rules[ $rule ][ $header->ID ] = array( 'ID' => $header->ID, 'name' => $header->post_title, ); } } } } if ( empty( $post ) ) { return; } $current_post_data = get_post_meta( $post->ID, $location, true ); if ( is_array( $current_post_data ) && isset( $current_post_data['rule'] ) ) { foreach ( $current_post_data['rule'] as $c_key => $c_rule ) { if ( ! isset( $all_rules[ $c_rule ] ) ) { continue; } if ( 'specifics' === $c_rule ) { foreach ( $current_post_data['specific'] as $s_index => $s_id ) { if ( ! isset( $all_rules[ $c_rule ][ $s_id ] ) ) { continue; } foreach ( $all_rules[ $c_rule ][ $s_id ] as $p_id => $data ) { if ( $p_id == $post->ID ) { continue; } $already_set_rule[] = $data['name']; } } } else { foreach ( $all_rules[ $c_rule ] as $p_id => $data ) { if ( $p_id == $post->ID ) { continue; } $already_set_rule[] = $data['name']; } } } } if ( ! empty( $already_set_rule ) ) { add_action( 'admin_notices', function() use ( $already_set_rule ) { $rule_set_titles = '<strong>' . implode( ',', $already_set_rule ) . '</strong>'; /* translators: %s post title. */ $notice = sprintf( __( 'The same display setting is already exist in %s post/s.', 'astra-addon' ), $rule_set_titles ); echo '<div class="notice notice-warning is-dismissible">'; echo '<p>' . wp_kses( $notice, array( 'strong' => true ) ) . '</p>'; echo '</div>'; } ); } } /** * Meta option post. * * @since 1.0.0 * @param string $post_type Post Type. * @param array $option meta option name. * * @return false | object */ public static function get_meta_option_post( $post_type, $option ) { $page_meta = ( isset( $option['page_meta'] ) && '' != $option['page_meta'] ) ? $option['page_meta'] : false; if ( false !== $page_meta ) { $current_post_id = isset( $option['current_post_id'] ) ? $option['current_post_id'] : false; $meta_id = get_post_meta( $current_post_id, $option['page_meta'], true ); if ( false !== $meta_id && '' != $meta_id ) { self::$current_page_data[ $post_type ][ $meta_id ] = array( 'id' => $meta_id, 'location' => '', ); return self::$current_page_data[ $post_type ]; } } return false; } /** * Get post selection. * * @since 1.0.0 * @param string $post_type Post Type. * * @return object Posts. */ public static function get_post_selection( $post_type ) { $query_args = array( 'post_type' => $post_type, 'posts_per_page' => -1, 'post_status' => 'publish', ); $all_headers = get_posts( $query_args ); $headers = array(); if ( ! empty( $all_headers ) ) { $headers = array( '' => __( 'Select', 'astra-addon' ), ); foreach ( $all_headers as $i => $data ) { $headers[ $data->ID ] = $data->post_title; } } return $headers; } /** * Formated rule meta value to save. * * @since 1.0.0 * @param array $save_data PostData. * @param string $key varaible key. * * @return array Rule data. */ public static function get_format_rule_value( $save_data, $key ) { $meta_value = array(); if ( isset( $save_data[ $key ]['rule'] ) ) { $save_data[ $key ]['rule'] = array_unique( $save_data[ $key ]['rule'] ); if ( isset( $save_data[ $key ]['specific'] ) ) { $save_data[ $key ]['specific'] = array_unique( $save_data[ $key ]['specific'] ); } // Unset the specifics from rule. This will be readded conditionally in next condition. $index = array_search( '', $save_data[ $key ]['rule'] ); if ( false !== $index ) { unset( $save_data[ $key ]['rule'][ $index ] ); } $index = array_search( 'specifics', $save_data[ $key ]['rule'] ); if ( false !== $index ) { unset( $save_data[ $key ]['rule'][ $index ] ); // Only re-add the specifics key if there are specific rules added. if ( isset( $save_data[ $key ]['specific'] ) && is_array( $save_data[ $key ]['specific'] ) ) { array_push( $save_data[ $key ]['rule'], 'specifics' ); } } foreach ( $save_data[ $key ] as $meta_key => $value ) { if ( ! empty( $value ) ) { $meta_value[ $meta_key ] = array_map( 'esc_attr', $value ); } } if ( ! isset( $meta_value['rule'] ) || ! in_array( 'specifics', $meta_value['rule'] ) ) { $meta_value['specific'] = array(); } if ( empty( $meta_value['rule'] ) ) { $meta_value = array(); } } return $meta_value; } } } /** * Kicking this off by calling 'get_instance()' method */ Astra_Target_Rules_Fields::get_instance(); modules/target-rule/select2.css 0000644 00000035535 15150261777 0012550 0 ustar 00 .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} modules/target-rule/select2.js 0000644 00000444111 15150261777 0012366 0 ustar 00 /*! * Select2 4.0.5 * https://select2.github.io * * Released under the MIT license * https://github.com/select2/select2/blob/master/LICENSE.md */ (function (factory) { /* Whenever you update select2 script please add astselect2 handler */ /* select2 handler changed to astselect2 */ var existingVersion = jQuery.fn.select2 || null; if (existingVersion) { delete jQuery.fn.select2; } if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof module === 'object' && module.exports) { // Node/CommonJS module.exports = function (root, jQuery) { if (jQuery === undefined) { // require('jQuery') returns a factory that requires window to // build a jQuery instance, we normalize how we use modules // that require this pattern but the window provided is a noop // if it's defined (how jquery works) if (typeof window !== 'undefined') { jQuery = require('jquery'); } else { jQuery = require('jquery')(root); } } factory(jQuery); return jQuery; }; } else { // Browser globals factory(jQuery); } jQuery.fn.astselect2 = jQuery.fn.select2; if (existingVersion) { delete jQuery.fn.select2; jQuery.fn.select2 = existingVersion; } /* select2 handler changed to astselect2 code end */ } (function (jQuery) { // This is needed so we can catch the AMD loader configuration and use it // The inner file should be wrapped (by `banner.start.js`) in a function that // returns the AMD loader references. var S2 =(function () { // Restore the Select2 AMD loader so it can be used // Needed mostly in the language files, where the loader is not inserted if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { var S2 = jQuery.fn.select2.amd; } var S2;(function () { if (!S2 || !S2.requirejs) { if (!S2) { S2 = {}; } else { require = S2; } /** * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. * Released under MIT license, http://github.com/requirejs/almond/LICENSE */ //Going sloppy to avoid 'use strict' string cost, but strict practices should //be followed. /*global setTimeout: false */ var requirejs, require, define; (function (undef) { var main, req, makeMap, handlers, defined = {}, waiting = {}, config = {}, defining = {}, hasOwn = Object.prototype.hasOwnProperty, aps = [].slice, jsSuffixRegExp = /\.js$/; function hasProp(obj, prop) { return hasOwn.call(obj, prop); } /** * Given a relative module name, like ./something, normalize it to * a real name that can be mapped to a path. * @param {String} name the relative name * @param {String} baseName a real name that the name arg is relative * to. * @returns {String} normalized name */ function normalize(name, baseName) { var nameParts, nameSegment, mapValue, foundMap, lastIndex, foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, baseParts = baseName && baseName.split("/"), map = config.map, starMap = (map && map['*']) || {}; //Adjust any relative paths. if (name) { name = name.split('/'); lastIndex = name.length - 1; // If wanting node ID compatibility, strip .js from end // of IDs. Have to do this here, and not in nameToUrl // because node allows either .js or non .js to map // to same file. if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); } // Starts with a '.' so need the baseName if (name[0].charAt(0) === '.' && baseParts) { //Convert baseName to array, and lop off the last part, //so that . matches that 'directory' and not name of the baseName's //module. For instance, baseName of 'one/two/three', maps to //'one/two/three.js', but we want the directory, 'one/two' for //this normalization. normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); name = normalizedBaseParts.concat(name); } //start trimDots for (i = 0; i < name.length; i++) { part = name[i]; if (part === '.') { name.splice(i, 1); i -= 1; } else if (part === '..') { // If at the start, or previous value is still .., // keep them so that when converted to a path it may // still work when converted to a path, even though // as an ID it is less than ideal. In larger point // releases, may be better to just kick out an error. if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { continue; } else if (i > 0) { name.splice(i - 1, 2); i -= 2; } } } //end trimDots name = name.join('/'); } //Apply map config if available. if ((baseParts || starMap) && map) { nameParts = name.split('/'); for (i = nameParts.length; i > 0; i -= 1) { nameSegment = nameParts.slice(0, i).join("/"); if (baseParts) { //Find the longest baseName segment match in the config. //So, do joins on the biggest to smallest lengths of baseParts. for (j = baseParts.length; j > 0; j -= 1) { mapValue = map[baseParts.slice(0, j).join('/')]; //baseName segment has config, find if it has one for //this name. if (mapValue) { mapValue = mapValue[nameSegment]; if (mapValue) { //Match, update name to the new value. foundMap = mapValue; foundI = i; break; } } } } if (foundMap) { break; } //Check for a star map match, but just hold on to it, //if there is a shorter segment match later in a matching //config, then favor over this star map. if (!foundStarMap && starMap && starMap[nameSegment]) { foundStarMap = starMap[nameSegment]; starI = i; } } if (!foundMap && foundStarMap) { foundMap = foundStarMap; foundI = starI; } if (foundMap) { nameParts.splice(0, foundI, foundMap); name = nameParts.join('/'); } } return name; } function makeRequire(relName, forceSync) { return function () { //A version of a require function that passes a moduleName //value for items that may need to //look up paths relative to the moduleName var args = aps.call(arguments, 0); //If first arg is not require('string'), and there is only //one arg, it is the array form without a callback. Insert //a null so that the following concat is correct. if (typeof args[0] !== 'string' && args.length === 1) { args.push(null); } return req.apply(undef, args.concat([relName, forceSync])); }; } function makeNormalize(relName) { return function (name) { return normalize(name, relName); }; } function makeLoad(depName) { return function (value) { defined[depName] = value; }; } function callDep(name) { if (hasProp(waiting, name)) { var args = waiting[name]; delete waiting[name]; defining[name] = true; main.apply(undef, args); } if (!hasProp(defined, name) && !hasProp(defining, name)) { throw new Error('No ' + name); } return defined[name]; } //Turns a plugin!resource to [plugin, resource] //with the plugin being undefined if the name //did not have a plugin prefix. function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; } //Creates a parts array for a relName where first part is plugin ID, //second part is resource ID. Assumes relName has already been normalized. function makeRelParts(relName) { return relName ? splitPrefix(relName) : []; } /** * Makes a name map, normalizing the name, and using a plugin * for normalization if necessary. Grabs a ref to plugin * too, as an optimization. */ makeMap = function (name, relParts) { var plugin, parts = splitPrefix(name), prefix = parts[0], relResourceName = relParts[1]; name = parts[1]; if (prefix) { prefix = normalize(prefix, relResourceName); plugin = callDep(prefix); } //Normalize according if (prefix) { if (plugin && plugin.normalize) { name = plugin.normalize(name, makeNormalize(relResourceName)); } else { name = normalize(name, relResourceName); } } else { name = normalize(name, relResourceName); parts = splitPrefix(name); prefix = parts[0]; name = parts[1]; if (prefix) { plugin = callDep(prefix); } } //Using ridiculous property names for space reasons return { f: prefix ? prefix + '!' + name : name, //fullName n: name, pr: prefix, p: plugin }; }; function makeConfig(name) { return function () { return (config && config.config && config.config[name]) || {}; }; } handlers = { require: function (name) { return makeRequire(name); }, exports: function (name) { var e = defined[name]; if (typeof e !== 'undefined') { return e; } else { return (defined[name] = {}); } }, module: function (name) { return { id: name, uri: '', exports: defined[name], config: makeConfig(name) }; } }; main = function (name, deps, callback, relName) { var cjsModule, depName, ret, map, i, relParts, args = [], callbackType = typeof callback, usingExports; //Use name if no relName relName = relName || name; relParts = makeRelParts(relName); //Call the callback to define the module, if necessary. if (callbackType === 'undefined' || callbackType === 'function') { //Pull out the defined dependencies and pass the ordered //values to the callback. //Default to [require, exports, module] if no deps deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; for (i = 0; i < deps.length; i += 1) { map = makeMap(deps[i], relParts); depName = map.f; //Fast path CommonJS standard dependencies. if (depName === "require") { args[i] = handlers.require(name); } else if (depName === "exports") { //CommonJS module spec 1.1 args[i] = handlers.exports(name); usingExports = true; } else if (depName === "module") { //CommonJS module spec 1.1 cjsModule = args[i] = handlers.module(name); } else if (hasProp(defined, depName) || hasProp(waiting, depName) || hasProp(defining, depName)) { args[i] = callDep(depName); } else if (map.p) { map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); args[i] = defined[depName]; } else { throw new Error(name + ' missing ' + depName); } } ret = callback ? callback.apply(defined[name], args) : undefined; if (name) { //If setting exports via "module" is in play, //favor that over return value and exports. After that, //favor a non-undefined return value over exports use. if (cjsModule && cjsModule.exports !== undef && cjsModule.exports !== defined[name]) { defined[name] = cjsModule.exports; } else if (ret !== undef || !usingExports) { //Use the return value from the function. defined[name] = ret; } } } else if (name) { //May just be an object definition for the module. Only //worry about defining if have a module name. defined[name] = callback; } }; requirejs = require = req = function (deps, callback, relName, forceSync, alt) { if (typeof deps === "string") { if (handlers[deps]) { //callback in this case is really relName return handlers[deps](callback); } //Just return the module wanted. In this scenario, the //deps arg is the module name, and second arg (if passed) //is just the relName. //Normalize module name, if it contains . or .. return callDep(makeMap(deps, makeRelParts(callback)).f); } else if (!deps.splice) { //deps is a config object, not an array. config = deps; if (config.deps) { req(config.deps, config.callback); } if (!callback) { return; } if (callback.splice) { //callback is an array, which means it is a dependency list. //Adjust args if there are dependencies deps = callback; callback = relName; relName = null; } else { deps = undef; } } //Support require(['a']) callback = callback || function () {}; //If relName is a function, it is an errback handler, //so remove it. if (typeof relName === 'function') { relName = forceSync; forceSync = alt; } //Simulate async callback; if (forceSync) { main(undef, deps, callback, relName); } else { //Using a non-zero value because of concern for what old browsers //do, and latest browsers "upgrade" to 4 if lower value is used: //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: //If want a value immediately, use require('id') instead -- something //that works in almond on the global level, but not guaranteed and //unlikely to work in other AMD implementations. setTimeout(function () { main(undef, deps, callback, relName); }, 4); } return req; }; /** * Just drops the config on the floor, but returns req in case * the config return value is used. */ req.config = function (cfg) { return req(cfg); }; /** * Expose module registry for debugging and tooling */ requirejs._defined = defined; define = function (name, deps, callback) { if (typeof name !== 'string') { throw new Error('See almond README: incorrect module build, no module name'); } //This module may not have dependencies if (!deps.splice) { //deps is not an array, so probably means //an object literal or factory function for //the value. Adjust args. callback = deps; deps = []; } if (!hasProp(defined, name) && !hasProp(waiting, name)) { waiting[name] = [name, deps, callback]; } }; define.amd = { jQuery: true }; }()); S2.requirejs = requirejs;S2.require = require;S2.define = define; } }()); S2.define("almond", function(){}); /* global jQuery:false, $:false */ S2.define('jquery',[],function () { var _$ = jQuery || $; if (_$ == null && console && console.error) { console.error( 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 'found. Make sure that you are including jQuery before Select2 on your ' + 'web page.' ); } return _$; }); S2.define('select2/utils',[ 'jquery' ], function ($) { var Utils = {}; Utils.Extend = function (ChildClass, SuperClass) { var __hasProp = {}.hasOwnProperty; function BaseConstructor () { this.constructor = ChildClass; } for (var key in SuperClass) { if (__hasProp.call(SuperClass, key)) { ChildClass[key] = SuperClass[key]; } } BaseConstructor.prototype = SuperClass.prototype; ChildClass.prototype = new BaseConstructor(); ChildClass.__super__ = SuperClass.prototype; return ChildClass; }; function getMethods (theClass) { var proto = theClass.prototype; var methods = []; for (var methodName in proto) { var m = proto[methodName]; if (typeof m !== 'function') { continue; } if (methodName === 'constructor') { continue; } methods.push(methodName); } return methods; } Utils.Decorate = function (SuperClass, DecoratorClass) { var decoratedMethods = getMethods(DecoratorClass); var superMethods = getMethods(SuperClass); function DecoratedClass () { var unshift = Array.prototype.unshift; var argCount = DecoratorClass.prototype.constructor.length; var calledConstructor = SuperClass.prototype.constructor; if (argCount > 0) { unshift.call(arguments, SuperClass.prototype.constructor); calledConstructor = DecoratorClass.prototype.constructor; } calledConstructor.apply(this, arguments); } DecoratorClass.displayName = SuperClass.displayName; function ctr () { this.constructor = DecoratedClass; } DecoratedClass.prototype = new ctr(); for (var m = 0; m < superMethods.length; m++) { var superMethod = superMethods[m]; DecoratedClass.prototype[superMethod] = SuperClass.prototype[superMethod]; } var calledMethod = function (methodName) { // Stub out the original method if it's not decorating an actual method var originalMethod = function () {}; if (methodName in DecoratedClass.prototype) { originalMethod = DecoratedClass.prototype[methodName]; } var decoratedMethod = DecoratorClass.prototype[methodName]; return function () { var unshift = Array.prototype.unshift; unshift.call(arguments, originalMethod); return decoratedMethod.apply(this, arguments); }; }; for (var d = 0; d < decoratedMethods.length; d++) { var decoratedMethod = decoratedMethods[d]; DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); } return DecoratedClass; }; var Observable = function () { this.listeners = {}; }; Observable.prototype.on = function (event, callback) { this.listeners = this.listeners || {}; if (event in this.listeners) { this.listeners[event].push(callback); } else { this.listeners[event] = [callback]; } }; Observable.prototype.trigger = function (event) { var slice = Array.prototype.slice; var params = slice.call(arguments, 1); this.listeners = this.listeners || {}; // Params should always come in as an array if (params == null) { params = []; } // If there are no arguments to the event, use a temporary object if (params.length === 0) { params.push({}); } // Set the `_type` of the first object to the event params[0]._type = event; if (event in this.listeners) { this.invoke(this.listeners[event], slice.call(arguments, 1)); } if ('*' in this.listeners) { this.invoke(this.listeners['*'], arguments); } }; Observable.prototype.invoke = function (listeners, params) { for (var i = 0, len = listeners.length; i < len; i++) { listeners[i].apply(this, params); } }; Utils.Observable = Observable; Utils.generateChars = function (length) { var chars = ''; for (var i = 0; i < length; i++) { var randomChar = Math.floor(Math.random() * 36); chars += randomChar.toString(36); } return chars; }; Utils.bind = function (func, context) { return function () { func.apply(context, arguments); }; }; Utils._convertData = function (data) { for (var originalKey in data) { var keys = originalKey.split('-'); var dataLevel = data; if (keys.length === 1) { continue; } for (var k = 0; k < keys.length; k++) { var key = keys[k]; // Lowercase the first letter // By default, dash-separated becomes camelCase key = key.substring(0, 1).toLowerCase() + key.substring(1); if (!(key in dataLevel)) { dataLevel[key] = {}; } if (k == keys.length - 1) { dataLevel[key] = data[originalKey]; } dataLevel = dataLevel[key]; } delete data[originalKey]; } return data; }; Utils.hasScroll = function (index, el) { // Adapted from the function created by @ShadowScripter // and adapted by @BillBarry on the Stack Exchange Code Review website. // The original code can be found at // http://codereview.stackexchange.com/q/13338 // and was designed to be used with the Sizzle selector engine. var $el = $(el); var overflowX = el.style.overflowX; var overflowY = el.style.overflowY; //Check both x and y declarations if (overflowX === overflowY && (overflowY === 'hidden' || overflowY === 'visible')) { return false; } if (overflowX === 'scroll' || overflowY === 'scroll') { return true; } return ($el.innerHeight() < el.scrollHeight || $el.innerWidth() < el.scrollWidth); }; Utils.escapeMarkup = function (markup) { var replaceMap = { '\\': '\', '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', '/': '/' }; // Do not try to escape the markup if it's not a string if (typeof markup !== 'string') { return markup; } // Regex to replace special characters with string. return String(markup).replace(/[&<>"'\/\\]/g, function (match) { return replaceMap[match]; }); }; Utils.entityDecode = function(html) { var txt = document.createElement("textarea"); txt.innerHTML = html; return txt.value; } // Append an array of jQuery nodes to a given element. Utils.appendMany = function ($element, $nodes) { // jQuery 1.7.x does not support $.fn.append() with an array // Fall back to a jQuery object collection using $.fn.add() if ($.fn.jquery.substr(0, 3) === '1.7') { var $jqNodes = $(); $.map($nodes, function (node) { $jqNodes = $jqNodes.add(node); }); $nodes = $jqNodes; } $element.append($nodes); }; return Utils; }); S2.define('select2/results',[ 'jquery', './utils' ], function ($, Utils) { function Results ($element, options, dataAdapter) { this.$element = $element; this.data = dataAdapter; this.options = options; Results.__super__.constructor.call(this); } Utils.Extend(Results, Utils.Observable); Results.prototype.render = function () { var $results = $( '<ul class="select2-results__options" role="tree"></ul>' ); if (this.options.get('multiple')) { $results.attr('aria-multiselectable', 'true'); } this.$results = $results; return $results; }; Results.prototype.clear = function () { this.$results.empty(); }; Results.prototype.displayMessage = function (params) { var escapeMarkup = this.options.get('escapeMarkup'); this.clear(); this.hideLoading(); var $message = $( '<li role="treeitem" aria-live="assertive"' + ' class="select2-results__option"></li>' ); var message = this.options.get('translations').get(params.message); $message.append( escapeMarkup( message(params.args) ) ); $message[0].className += ' select2-results__message'; this.$results.append($message); }; Results.prototype.hideMessages = function () { this.$results.find('.select2-results__message').remove(); }; Results.prototype.append = function (data) { this.hideLoading(); var $options = []; if (data.results == null || data.results.length === 0) { if (this.$results.children().length === 0) { this.trigger('results:message', { message: 'noResults' }); } return; } data.results = this.sort(data.results); for (var d = 0; d < data.results.length; d++) { var item = data.results[d]; var $option = this.option(item); $options.push($option); } this.$results.append($options); }; Results.prototype.position = function ($results, $dropdown) { var $resultsContainer = $dropdown.find('.select2-results'); $resultsContainer.append($results); }; Results.prototype.sort = function (data) { var sorter = this.options.get('sorter'); return sorter(data); }; Results.prototype.highlightFirstItem = function () { var $options = this.$results .find('.select2-results__option[aria-selected]'); var $selected = $options.filter('[aria-selected=true]'); // Check if there are any selected options if ($selected.length > 0) { // If there are selected options, highlight the first $selected.first().trigger('mouseenter'); } else { // If there are no selected options, highlight the first option // in the dropdown $options.first().trigger('mouseenter'); } this.ensureHighlightVisible(); }; Results.prototype.setClasses = function () { var self = this; this.data.current(function (selected) { var selectedIds = $.map(selected, function (s) { return s.id.toString(); }); var $options = self.$results .find('.select2-results__option[aria-selected]'); $options.each(function () { var $option = $(this); var item = $.data(this, 'data'); // id needs to be converted to a string when comparing var id = '' + item.id; if ((item.element != null && item.element.selected) || (item.element == null && $.inArray(id, selectedIds) > -1)) { $option.attr('aria-selected', 'true'); } else { $option.attr('aria-selected', 'false'); } }); }); }; Results.prototype.showLoading = function (params) { this.hideLoading(); var loadingMore = this.options.get('translations').get('searching'); var loading = { disabled: true, loading: true, text: loadingMore(params) }; var $loading = this.option(loading); $loading.className += ' loading-results'; this.$results.prepend($loading); }; Results.prototype.hideLoading = function () { this.$results.find('.loading-results').remove(); }; Results.prototype.option = function (data) { var option = document.createElement('li'); option.className = 'select2-results__option'; var attrs = { 'role': 'treeitem', 'aria-selected': 'false' }; if (data.disabled) { delete attrs['aria-selected']; attrs['aria-disabled'] = 'true'; } if (data.id == null) { delete attrs['aria-selected']; } if (data._resultId != null) { option.id = data._resultId; } if (data.title) { option.title = data.title; } if (data.children) { attrs.role = 'group'; attrs['aria-label'] = data.text; delete attrs['aria-selected']; } for (var attr in attrs) { var val = attrs[attr]; option.setAttribute(attr, val); } if (data.children) { var $option = $(option); var label = document.createElement('strong'); label.className = 'select2-results__group'; var $label = $(label); this.template(data, label); var $children = []; for (var c = 0; c < data.children.length; c++) { var child = data.children[c]; var $child = this.option(child); $children.push($child); } var $childrenContainer = $('<ul></ul>', { 'class': 'select2-results__options select2-results__options--nested' }); $childrenContainer.append($children); $option.append(label); $option.append($childrenContainer); } else { this.template(data, option); } $.data(option, 'data', data); return option; }; Results.prototype.bind = function (container, $container) { var self = this; var id = container.id + '-results'; this.$results.attr('id', id); container.on('results:all', function (params) { self.clear(); self.append(params.data); if (container.isOpen()) { self.setClasses(); self.highlightFirstItem(); } }); container.on('results:append', function (params) { self.append(params.data); if (container.isOpen()) { self.setClasses(); } }); container.on('query', function (params) { self.hideMessages(); self.showLoading(params); }); container.on('select', function () { if (!container.isOpen()) { return; } self.setClasses(); self.highlightFirstItem(); }); container.on('unselect', function () { if (!container.isOpen()) { return; } self.setClasses(); self.highlightFirstItem(); }); container.on('open', function () { // When the dropdown is open, aria-expended="true" self.$results.attr('aria-expanded', 'true'); self.$results.attr('aria-hidden', 'false'); self.setClasses(); self.ensureHighlightVisible(); }); container.on('close', function () { // When the dropdown is closed, aria-expended="false" self.$results.attr('aria-expanded', 'false'); self.$results.attr('aria-hidden', 'true'); self.$results.removeAttr('aria-activedescendant'); }); container.on('results:toggle', function () { var $highlighted = self.getHighlightedResults(); if ($highlighted.length === 0) { return; } $highlighted.trigger('mouseup'); }); container.on('results:select', function () { var $highlighted = self.getHighlightedResults(); if ($highlighted.length === 0) { return; } var data = $highlighted.data('data'); if ($highlighted.attr('aria-selected') == 'true') { self.trigger('close', {}); } else { self.trigger('select', { data: data }); } }); container.on('results:previous', function () { var $highlighted = self.getHighlightedResults(); var $options = self.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); // If we are already at te top, don't move further if (currentIndex === 0) { return; } var nextIndex = currentIndex - 1; // If none are highlighted, highlight the first if ($highlighted.length === 0) { nextIndex = 0; } var $next = $options.eq(nextIndex); $next.trigger('mouseenter'); var currentOffset = self.$results.offset().top; var nextTop = $next.offset().top; var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); if (nextIndex === 0) { self.$results.scrollTop(0); } else if (nextTop - currentOffset < 0) { self.$results.scrollTop(nextOffset); } }); container.on('results:next', function () { var $highlighted = self.getHighlightedResults(); var $options = self.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); var nextIndex = currentIndex + 1; // If we are at the last option, stay there if (nextIndex >= $options.length) { return; } var $next = $options.eq(nextIndex); $next.trigger('mouseenter'); var currentOffset = self.$results.offset().top + self.$results.outerHeight(false); var nextBottom = $next.offset().top + $next.outerHeight(false); var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; if (nextIndex === 0) { self.$results.scrollTop(0); } else if (nextBottom > currentOffset) { self.$results.scrollTop(nextOffset); } }); container.on('results:focus', function (params) { params.element.addClass('select2-results__option--highlighted'); }); container.on('results:message', function (params) { self.displayMessage(params); }); if ($.fn.mousewheel) { this.$results.on('mousewheel', function (e) { var top = self.$results.scrollTop(); var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); if (isAtTop) { self.$results.scrollTop(0); e.preventDefault(); e.stopPropagation(); } else if (isAtBottom) { self.$results.scrollTop( self.$results.get(0).scrollHeight - self.$results.height() ); e.preventDefault(); e.stopPropagation(); } }); } this.$results.on('mouseup', '.select2-results__option[aria-selected]', function (evt) { var $this = $(this); var data = $this.data('data'); if ($this.attr('aria-selected') === 'true') { if (self.options.get('multiple')) { self.trigger('unselect', { originalEvent: evt, data: data }); } else { self.trigger('close', {}); } return; } self.trigger('select', { originalEvent: evt, data: data }); }); this.$results.on('mouseenter', '.select2-results__option[aria-selected]', function (evt) { var data = $(this).data('data'); self.getHighlightedResults() .removeClass('select2-results__option--highlighted'); self.trigger('results:focus', { data: data, element: $(this) }); }); }; Results.prototype.getHighlightedResults = function () { var $highlighted = this.$results .find('.select2-results__option--highlighted'); return $highlighted; }; Results.prototype.destroy = function () { this.$results.remove(); }; Results.prototype.ensureHighlightVisible = function () { var $highlighted = this.getHighlightedResults(); if ($highlighted.length === 0) { return; } var $options = this.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); var currentOffset = this.$results.offset().top; var nextTop = $highlighted.offset().top; var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); var offsetDelta = nextTop - currentOffset; nextOffset -= $highlighted.outerHeight(false) * 2; if (currentIndex <= 2) { this.$results.scrollTop(0); } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { this.$results.scrollTop(nextOffset); } }; Results.prototype.template = function (result, container) { var template = this.options.get('templateResult'); var escapeMarkup = this.options.get('escapeMarkup'); var content = template(result, container); if (content == null) { container.style.display = 'none'; } else if (typeof content === 'string') { container.innerHTML = escapeMarkup(content); } else { $(container).append(content); } }; return Results; }); S2.define('select2/keys',[ ], function () { var KEYS = { BACKSPACE: 8, TAB: 9, ENTER: 13, SHIFT: 16, CTRL: 17, ALT: 18, ESC: 27, SPACE: 32, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, DELETE: 46 }; return KEYS; }); S2.define('select2/selection/base',[ 'jquery', '../utils', '../keys' ], function ($, Utils, KEYS) { function BaseSelection ($element, options) { this.$element = $element; this.options = options; BaseSelection.__super__.constructor.call(this); } Utils.Extend(BaseSelection, Utils.Observable); BaseSelection.prototype.render = function () { var $selection = $( '<span class="select2-selection" role="combobox" ' + ' aria-haspopup="true" aria-expanded="false">' + '</span>' ); this._tabindex = 0; if (this.$element.data('old-tabindex') != null) { this._tabindex = this.$element.data('old-tabindex'); } else if (this.$element.attr('tabindex') != null) { this._tabindex = this.$element.attr('tabindex'); } $selection.attr('title', this.$element.attr('title')); $selection.attr('tabindex', this._tabindex); this.$selection = $selection; return $selection; }; BaseSelection.prototype.bind = function (container, $container) { var self = this; var id = container.id + '-container'; var resultsId = container.id + '-results'; this.container = container; this.$selection.on('focus', function (evt) { self.trigger('focus', evt); }); this.$selection.on('blur', function (evt) { self._handleBlur(evt); }); this.$selection.on('keydown', function (evt) { self.trigger('keypress', evt); if (evt.which === KEYS.SPACE) { evt.preventDefault(); } }); container.on('results:focus', function (params) { self.$selection.attr('aria-activedescendant', params.data._resultId); }); container.on('selection:update', function (params) { self.update(params.data); }); container.on('open', function () { // When the dropdown is open, aria-expanded="true" self.$selection.attr('aria-expanded', 'true'); self.$selection.attr('aria-owns', resultsId); self._attachCloseHandler(container); }); container.on('close', function () { // When the dropdown is closed, aria-expanded="false" self.$selection.attr('aria-expanded', 'false'); self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-owns'); self.$selection.focus(); self._detachCloseHandler(container); }); container.on('enable', function () { self.$selection.attr('tabindex', self._tabindex); }); container.on('disable', function () { self.$selection.attr('tabindex', '-1'); }); }; BaseSelection.prototype._handleBlur = function (evt) { var self = this; // This needs to be delayed as the active element is the body when the tab // key is pressed, possibly along with others. window.setTimeout(function () { // Don't trigger `blur` if the focus is still in the selection if ( (document.activeElement == self.$selection[0]) || ($.contains(self.$selection[0], document.activeElement)) ) { return; } self.trigger('blur', evt); }, 1); }; BaseSelection.prototype._attachCloseHandler = function (container) { var self = this; $(document.body).on('mousedown.select2.' + container.id, function (e) { var $target = $(e.target); var $select = $target.closest('.select2'); var $all = $('.select2.select2-container--open'); $all.each(function () { var $this = $(this); if (this == $select[0]) { return; } var $element = $this.data('element'); $element.select2('close'); }); }); }; BaseSelection.prototype._detachCloseHandler = function (container) { $(document.body).off('mousedown.select2.' + container.id); }; BaseSelection.prototype.position = function ($selection, $container) { var $selectionContainer = $container.find('.selection'); $selectionContainer.append($selection); }; BaseSelection.prototype.destroy = function () { this._detachCloseHandler(this.container); }; BaseSelection.prototype.update = function (data) { throw new Error('The `update` method must be defined in child classes.'); }; return BaseSelection; }); S2.define('select2/selection/single',[ 'jquery', './base', '../utils', '../keys' ], function ($, BaseSelection, Utils, KEYS) { function SingleSelection () { SingleSelection.__super__.constructor.apply(this, arguments); } Utils.Extend(SingleSelection, BaseSelection); SingleSelection.prototype.render = function () { var $selection = SingleSelection.__super__.render.call(this); $selection.addClass('select2-selection--single'); $selection.html( '<span class="select2-selection__rendered"></span>' + '<span class="select2-selection__arrow" role="presentation">' + '<b role="presentation"></b>' + '</span>' ); return $selection; }; SingleSelection.prototype.bind = function (container, $container) { var self = this; SingleSelection.__super__.bind.apply(this, arguments); var id = container.id + '-container'; this.$selection.find('.select2-selection__rendered').attr('id', id); this.$selection.attr('aria-labelledby', id); this.$selection.on('mousedown', function (evt) { // Only respond to left clicks if (evt.which !== 1) { return; } self.trigger('toggle', { originalEvent: evt }); }); this.$selection.on('focus', function (evt) { // User focuses on the container }); this.$selection.on('blur', function (evt) { // User exits the container }); container.on('focus', function (evt) { if (!container.isOpen()) { self.$selection.focus(); } }); container.on('selection:update', function (params) { self.update(params.data); }); }; SingleSelection.prototype.clear = function () { this.$selection.find('.select2-selection__rendered').empty(); }; SingleSelection.prototype.display = function (data, container) { var template = this.options.get('templateSelection'); var escapeMarkup = this.options.get('escapeMarkup'); return escapeMarkup(template(data, container)); }; SingleSelection.prototype.selectionContainer = function () { return $('<span></span>'); }; SingleSelection.prototype.update = function (data) { if (data.length === 0) { this.clear(); return; } var selection = data[0]; var $rendered = this.$selection.find('.select2-selection__rendered'); var formatted = Utils.entityDecode(this.display(selection, $rendered)); $rendered.empty().text(formatted); $rendered.prop('title', selection.title || selection.text); }; return SingleSelection; }); S2.define('select2/selection/multiple',[ 'jquery', './base', '../utils' ], function ($, BaseSelection, Utils) { function MultipleSelection ($element, options) { MultipleSelection.__super__.constructor.apply(this, arguments); } Utils.Extend(MultipleSelection, BaseSelection); MultipleSelection.prototype.render = function () { var $selection = MultipleSelection.__super__.render.call(this); $selection.addClass('select2-selection--multiple'); $selection.html( '<ul class="select2-selection__rendered"></ul>' ); return $selection; }; MultipleSelection.prototype.bind = function (container, $container) { var self = this; MultipleSelection.__super__.bind.apply(this, arguments); this.$selection.on('click', function (evt) { self.trigger('toggle', { originalEvent: evt }); }); this.$selection.on( 'click', '.select2-selection__choice__remove', function (evt) { // Ignore the event if it is disabled if (self.options.get('disabled')) { return; } var $remove = $(this); var $selection = $remove.parent(); var data = $selection.data('data'); self.trigger('unselect', { originalEvent: evt, data: data }); } ); }; MultipleSelection.prototype.clear = function () { this.$selection.find('.select2-selection__rendered').empty(); }; MultipleSelection.prototype.display = function (data, container) { var template = this.options.get('templateSelection'); var escapeMarkup = this.options.get('escapeMarkup'); return escapeMarkup(template(data, container)); }; MultipleSelection.prototype.selectionContainer = function () { var $container = $( '<li class="select2-selection__choice">' + '<span class="select2-selection__choice__remove" role="presentation">' + '×' + '</span>' + '</li>' ); return $container; }; MultipleSelection.prototype.update = function (data) { this.clear(); if (data.length === 0) { return; } var $selections = []; for (var d = 0; d < data.length; d++) { var selection = data[d]; var $selection = this.selectionContainer(); var formatted = this.display(selection, $selection); $selection.append(formatted); $selection.prop('title', selection.title || selection.text); $selection.data('data', selection); $selections.push($selection); } var $rendered = this.$selection.find('.select2-selection__rendered'); Utils.appendMany($rendered, $selections); }; return MultipleSelection; }); S2.define('select2/selection/placeholder',[ '../utils' ], function (Utils) { function Placeholder (decorated, $element, options) { this.placeholder = this.normalizePlaceholder(options.get('placeholder')); decorated.call(this, $element, options); } Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { if (typeof placeholder === 'string') { placeholder = { id: '', text: placeholder }; } return placeholder; }; Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { var $placeholder = this.selectionContainer(); $placeholder.text(Utils.entityDecode(this.display(placeholder))); $placeholder.addClass('select2-selection__placeholder') .removeClass('select2-selection__choice'); return $placeholder; }; Placeholder.prototype.update = function (decorated, data) { var singlePlaceholder = ( data.length == 1 && data[0].id != this.placeholder.id ); var multipleSelections = data.length > 1; if (multipleSelections || singlePlaceholder) { return decorated.call(this, data); } this.clear(); var $placeholder = this.createPlaceholder(this.placeholder); this.$selection.find('.select2-selection__rendered').append($placeholder); }; return Placeholder; }); S2.define('select2/selection/allowClear',[ 'jquery', '../keys' ], function ($, KEYS) { function AllowClear () { } AllowClear.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); if (this.placeholder == null) { if (this.options.get('debug') && window.console && console.error) { console.error( 'Select2: The `allowClear` option should be used in combination ' + 'with the `placeholder` option.' ); } } this.$selection.on('mousedown', '.select2-selection__clear', function (evt) { self._handleClear(evt); }); container.on('keypress', function (evt) { self._handleKeyboardClear(evt, container); }); }; AllowClear.prototype._handleClear = function (_, evt) { // Ignore the event if it is disabled if (this.options.get('disabled')) { return; } var $clear = this.$selection.find('.select2-selection__clear'); // Ignore the event if nothing has been selected if ($clear.length === 0) { return; } evt.stopPropagation(); var data = $clear.data('data'); for (var d = 0; d < data.length; d++) { var unselectData = { data: data[d] }; // Trigger the `unselect` event, so people can prevent it from being // cleared. this.trigger('unselect', unselectData); // If the event was prevented, don't clear it out. if (unselectData.prevented) { return; } } this.$element.val(this.placeholder.id).trigger('change'); this.trigger('toggle', {}); }; AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { if (container.isOpen()) { return; } if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { this._handleClear(evt); } }; AllowClear.prototype.update = function (decorated, data) { decorated.call(this, data); if (this.$selection.find('.select2-selection__placeholder').length > 0 || data.length === 0) { return; } var $remove = $( '<span class="select2-selection__clear">' + '×' + '</span>' ); $remove.data('data', data); this.$selection.find('.select2-selection__rendered').prepend($remove); }; return AllowClear; }); S2.define('select2/selection/search',[ 'jquery', '../utils', '../keys' ], function ($, Utils, KEYS) { function Search (decorated, $element, options) { decorated.call(this, $element, options); } Search.prototype.render = function (decorated) { var $search = $( '<li class="select2-search select2-search--inline">' + '<input class="select2-search__field" type="search" tabindex="-1"' + ' autocomplete="off" autocorrect="off" autocapitalize="none"' + ' spellcheck="false" role="textbox" aria-autocomplete="list" />' + '</li>' ); this.$searchContainer = $search; this.$search = $search.find('input'); var $rendered = decorated.call(this); this._transferTabIndex(); return $rendered; }; Search.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('open', function () { self.$search.trigger('focus'); }); container.on('close', function () { self.$search.val(''); self.$search.removeAttr('aria-activedescendant'); self.$search.trigger('focus'); }); container.on('enable', function () { self.$search.prop('disabled', false); self._transferTabIndex(); }); container.on('disable', function () { self.$search.prop('disabled', true); }); container.on('focus', function (evt) { self.$search.trigger('focus'); }); container.on('results:focus', function (params) { self.$search.attr('aria-activedescendant', params.id); }); this.$selection.on('focusin', '.select2-search--inline', function (evt) { self.trigger('focus', evt); }); this.$selection.on('focusout', '.select2-search--inline', function (evt) { self._handleBlur(evt); }); this.$selection.on('keydown', '.select2-search--inline', function (evt) { evt.stopPropagation(); self.trigger('keypress', evt); self._keyUpPrevented = evt.isDefaultPrevented(); var key = evt.which; if (key === KEYS.BACKSPACE && self.$search.val() === '') { var $previousChoice = self.$searchContainer .prev('.select2-selection__choice'); if ($previousChoice.length > 0) { var item = $previousChoice.data('data'); self.searchRemoveChoice(item); evt.preventDefault(); } } }); // Try to detect the IE version should the `documentMode` property that // is stored on the document. This is only implemented in IE and is // slightly cleaner than doing a user agent check. // This property is not available in Edge, but Edge also doesn't have // this bug. var msie = document.documentMode; var disableInputEvents = msie && msie <= 11; // Workaround for browsers which do not support the `input` event // This will prevent double-triggering of events for browsers which support // both the `keyup` and `input` events. this.$selection.on( 'input.searchcheck', '.select2-search--inline', function (evt) { // IE will trigger the `input` event when a placeholder is used on a // search box. To get around this issue, we are forced to ignore all // `input` events in IE and keep using `keyup`. if (disableInputEvents) { self.$selection.off('input.search input.searchcheck'); return; } // Unbind the duplicated `keyup` event self.$selection.off('keyup.search'); } ); this.$selection.on( 'keyup.search input.search', '.select2-search--inline', function (evt) { // IE will trigger the `input` event when a placeholder is used on a // search box. To get around this issue, we are forced to ignore all // `input` events in IE and keep using `keyup`. if (disableInputEvents && evt.type === 'input') { self.$selection.off('input.search input.searchcheck'); return; } var key = evt.which; // We can freely ignore events from modifier keys if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { return; } // Tabbing will be handled during the `keydown` phase if (key == KEYS.TAB) { return; } self.handleSearch(evt); } ); }; /** * This method will transfer the tabindex attribute from the rendered * selection to the search box. This allows for the search box to be used as * the primary focus instead of the selection container. * * @private */ Search.prototype._transferTabIndex = function (decorated) { this.$search.attr('tabindex', this.$selection.attr('tabindex')); this.$selection.attr('tabindex', '-1'); }; Search.prototype.createPlaceholder = function (decorated, placeholder) { this.$search.attr('placeholder', placeholder.text); }; Search.prototype.update = function (decorated, data) { var searchHadFocus = this.$search[0] == document.activeElement; this.$search.attr('placeholder', ''); decorated.call(this, data); this.$selection.find('.select2-selection__rendered') .append(this.$searchContainer); this.resizeSearch(); if (searchHadFocus) { this.$search.focus(); } }; Search.prototype.handleSearch = function () { this.resizeSearch(); if (!this._keyUpPrevented) { var input = this.$search.val(); this.trigger('query', { term: input }); } this._keyUpPrevented = false; }; Search.prototype.searchRemoveChoice = function (decorated, item) { this.trigger('unselect', { data: item }); this.$search.val(item.text); this.handleSearch(); }; Search.prototype.resizeSearch = function () { this.$search.css('width', '25px'); var width = ''; if (this.$search.attr('placeholder') !== '') { width = this.$selection.find('.select2-selection__rendered').innerWidth(); } else { var minimumWidth = this.$search.val().length + 1; width = (minimumWidth * 0.75) + 'em'; } this.$search.css('width', width); }; return Search; }); S2.define('select2/selection/eventRelay',[ 'jquery' ], function ($) { function EventRelay () { } EventRelay.prototype.bind = function (decorated, container, $container) { var self = this; var relayEvents = [ 'open', 'opening', 'close', 'closing', 'select', 'selecting', 'unselect', 'unselecting' ]; var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; decorated.call(this, container, $container); container.on('*', function (name, params) { // Ignore events that should not be relayed if ($.inArray(name, relayEvents) === -1) { return; } // The parameters should always be an object params = params || {}; // Generate the jQuery event for the Select2 event var evt = $.Event('select2:' + name, { params: params }); self.$element.trigger(evt); // Only handle preventable events if it was one if ($.inArray(name, preventableEvents) === -1) { return; } params.prevented = evt.isDefaultPrevented(); }); }; return EventRelay; }); S2.define('select2/translation',[ 'jquery', 'require' ], function ($, require) { function Translation (dict) { this.dict = dict || {}; } Translation.prototype.all = function () { return this.dict; }; Translation.prototype.get = function (key) { return this.dict[key]; }; Translation.prototype.extend = function (translation) { this.dict = $.extend({}, translation.all(), this.dict); }; // Static functions Translation._cache = {}; Translation.loadPath = function (path) { if (!(path in Translation._cache)) { var translations = require(path); Translation._cache[path] = translations; } return new Translation(Translation._cache[path]); }; return Translation; }); S2.define('select2/diacritics',[ ], function () { var diacritics = { '\u24B6': 'A', '\uFF21': 'A', '\u00C0': 'A', '\u00C1': 'A', '\u00C2': 'A', '\u1EA6': 'A', '\u1EA4': 'A', '\u1EAA': 'A', '\u1EA8': 'A', '\u00C3': 'A', '\u0100': 'A', '\u0102': 'A', '\u1EB0': 'A', '\u1EAE': 'A', '\u1EB4': 'A', '\u1EB2': 'A', '\u0226': 'A', '\u01E0': 'A', '\u00C4': 'A', '\u01DE': 'A', '\u1EA2': 'A', '\u00C5': 'A', '\u01FA': 'A', '\u01CD': 'A', '\u0200': 'A', '\u0202': 'A', '\u1EA0': 'A', '\u1EAC': 'A', '\u1EB6': 'A', '\u1E00': 'A', '\u0104': 'A', '\u023A': 'A', '\u2C6F': 'A', '\uA732': 'AA', '\u00C6': 'AE', '\u01FC': 'AE', '\u01E2': 'AE', '\uA734': 'AO', '\uA736': 'AU', '\uA738': 'AV', '\uA73A': 'AV', '\uA73C': 'AY', '\u24B7': 'B', '\uFF22': 'B', '\u1E02': 'B', '\u1E04': 'B', '\u1E06': 'B', '\u0243': 'B', '\u0182': 'B', '\u0181': 'B', '\u24B8': 'C', '\uFF23': 'C', '\u0106': 'C', '\u0108': 'C', '\u010A': 'C', '\u010C': 'C', '\u00C7': 'C', '\u1E08': 'C', '\u0187': 'C', '\u023B': 'C', '\uA73E': 'C', '\u24B9': 'D', '\uFF24': 'D', '\u1E0A': 'D', '\u010E': 'D', '\u1E0C': 'D', '\u1E10': 'D', '\u1E12': 'D', '\u1E0E': 'D', '\u0110': 'D', '\u018B': 'D', '\u018A': 'D', '\u0189': 'D', '\uA779': 'D', '\u01F1': 'DZ', '\u01C4': 'DZ', '\u01F2': 'Dz', '\u01C5': 'Dz', '\u24BA': 'E', '\uFF25': 'E', '\u00C8': 'E', '\u00C9': 'E', '\u00CA': 'E', '\u1EC0': 'E', '\u1EBE': 'E', '\u1EC4': 'E', '\u1EC2': 'E', '\u1EBC': 'E', '\u0112': 'E', '\u1E14': 'E', '\u1E16': 'E', '\u0114': 'E', '\u0116': 'E', '\u00CB': 'E', '\u1EBA': 'E', '\u011A': 'E', '\u0204': 'E', '\u0206': 'E', '\u1EB8': 'E', '\u1EC6': 'E', '\u0228': 'E', '\u1E1C': 'E', '\u0118': 'E', '\u1E18': 'E', '\u1E1A': 'E', '\u0190': 'E', '\u018E': 'E', '\u24BB': 'F', '\uFF26': 'F', '\u1E1E': 'F', '\u0191': 'F', '\uA77B': 'F', '\u24BC': 'G', '\uFF27': 'G', '\u01F4': 'G', '\u011C': 'G', '\u1E20': 'G', '\u011E': 'G', '\u0120': 'G', '\u01E6': 'G', '\u0122': 'G', '\u01E4': 'G', '\u0193': 'G', '\uA7A0': 'G', '\uA77D': 'G', '\uA77E': 'G', '\u24BD': 'H', '\uFF28': 'H', '\u0124': 'H', '\u1E22': 'H', '\u1E26': 'H', '\u021E': 'H', '\u1E24': 'H', '\u1E28': 'H', '\u1E2A': 'H', '\u0126': 'H', '\u2C67': 'H', '\u2C75': 'H', '\uA78D': 'H', '\u24BE': 'I', '\uFF29': 'I', '\u00CC': 'I', '\u00CD': 'I', '\u00CE': 'I', '\u0128': 'I', '\u012A': 'I', '\u012C': 'I', '\u0130': 'I', '\u00CF': 'I', '\u1E2E': 'I', '\u1EC8': 'I', '\u01CF': 'I', '\u0208': 'I', '\u020A': 'I', '\u1ECA': 'I', '\u012E': 'I', '\u1E2C': 'I', '\u0197': 'I', '\u24BF': 'J', '\uFF2A': 'J', '\u0134': 'J', '\u0248': 'J', '\u24C0': 'K', '\uFF2B': 'K', '\u1E30': 'K', '\u01E8': 'K', '\u1E32': 'K', '\u0136': 'K', '\u1E34': 'K', '\u0198': 'K', '\u2C69': 'K', '\uA740': 'K', '\uA742': 'K', '\uA744': 'K', '\uA7A2': 'K', '\u24C1': 'L', '\uFF2C': 'L', '\u013F': 'L', '\u0139': 'L', '\u013D': 'L', '\u1E36': 'L', '\u1E38': 'L', '\u013B': 'L', '\u1E3C': 'L', '\u1E3A': 'L', '\u0141': 'L', '\u023D': 'L', '\u2C62': 'L', '\u2C60': 'L', '\uA748': 'L', '\uA746': 'L', '\uA780': 'L', '\u01C7': 'LJ', '\u01C8': 'Lj', '\u24C2': 'M', '\uFF2D': 'M', '\u1E3E': 'M', '\u1E40': 'M', '\u1E42': 'M', '\u2C6E': 'M', '\u019C': 'M', '\u24C3': 'N', '\uFF2E': 'N', '\u01F8': 'N', '\u0143': 'N', '\u00D1': 'N', '\u1E44': 'N', '\u0147': 'N', '\u1E46': 'N', '\u0145': 'N', '\u1E4A': 'N', '\u1E48': 'N', '\u0220': 'N', '\u019D': 'N', '\uA790': 'N', '\uA7A4': 'N', '\u01CA': 'NJ', '\u01CB': 'Nj', '\u24C4': 'O', '\uFF2F': 'O', '\u00D2': 'O', '\u00D3': 'O', '\u00D4': 'O', '\u1ED2': 'O', '\u1ED0': 'O', '\u1ED6': 'O', '\u1ED4': 'O', '\u00D5': 'O', '\u1E4C': 'O', '\u022C': 'O', '\u1E4E': 'O', '\u014C': 'O', '\u1E50': 'O', '\u1E52': 'O', '\u014E': 'O', '\u022E': 'O', '\u0230': 'O', '\u00D6': 'O', '\u022A': 'O', '\u1ECE': 'O', '\u0150': 'O', '\u01D1': 'O', '\u020C': 'O', '\u020E': 'O', '\u01A0': 'O', '\u1EDC': 'O', '\u1EDA': 'O', '\u1EE0': 'O', '\u1EDE': 'O', '\u1EE2': 'O', '\u1ECC': 'O', '\u1ED8': 'O', '\u01EA': 'O', '\u01EC': 'O', '\u00D8': 'O', '\u01FE': 'O', '\u0186': 'O', '\u019F': 'O', '\uA74A': 'O', '\uA74C': 'O', '\u01A2': 'OI', '\uA74E': 'OO', '\u0222': 'OU', '\u24C5': 'P', '\uFF30': 'P', '\u1E54': 'P', '\u1E56': 'P', '\u01A4': 'P', '\u2C63': 'P', '\uA750': 'P', '\uA752': 'P', '\uA754': 'P', '\u24C6': 'Q', '\uFF31': 'Q', '\uA756': 'Q', '\uA758': 'Q', '\u024A': 'Q', '\u24C7': 'R', '\uFF32': 'R', '\u0154': 'R', '\u1E58': 'R', '\u0158': 'R', '\u0210': 'R', '\u0212': 'R', '\u1E5A': 'R', '\u1E5C': 'R', '\u0156': 'R', '\u1E5E': 'R', '\u024C': 'R', '\u2C64': 'R', '\uA75A': 'R', '\uA7A6': 'R', '\uA782': 'R', '\u24C8': 'S', '\uFF33': 'S', '\u1E9E': 'S', '\u015A': 'S', '\u1E64': 'S', '\u015C': 'S', '\u1E60': 'S', '\u0160': 'S', '\u1E66': 'S', '\u1E62': 'S', '\u1E68': 'S', '\u0218': 'S', '\u015E': 'S', '\u2C7E': 'S', '\uA7A8': 'S', '\uA784': 'S', '\u24C9': 'T', '\uFF34': 'T', '\u1E6A': 'T', '\u0164': 'T', '\u1E6C': 'T', '\u021A': 'T', '\u0162': 'T', '\u1E70': 'T', '\u1E6E': 'T', '\u0166': 'T', '\u01AC': 'T', '\u01AE': 'T', '\u023E': 'T', '\uA786': 'T', '\uA728': 'TZ', '\u24CA': 'U', '\uFF35': 'U', '\u00D9': 'U', '\u00DA': 'U', '\u00DB': 'U', '\u0168': 'U', '\u1E78': 'U', '\u016A': 'U', '\u1E7A': 'U', '\u016C': 'U', '\u00DC': 'U', '\u01DB': 'U', '\u01D7': 'U', '\u01D5': 'U', '\u01D9': 'U', '\u1EE6': 'U', '\u016E': 'U', '\u0170': 'U', '\u01D3': 'U', '\u0214': 'U', '\u0216': 'U', '\u01AF': 'U', '\u1EEA': 'U', '\u1EE8': 'U', '\u1EEE': 'U', '\u1EEC': 'U', '\u1EF0': 'U', '\u1EE4': 'U', '\u1E72': 'U', '\u0172': 'U', '\u1E76': 'U', '\u1E74': 'U', '\u0244': 'U', '\u24CB': 'V', '\uFF36': 'V', '\u1E7C': 'V', '\u1E7E': 'V', '\u01B2': 'V', '\uA75E': 'V', '\u0245': 'V', '\uA760': 'VY', '\u24CC': 'W', '\uFF37': 'W', '\u1E80': 'W', '\u1E82': 'W', '\u0174': 'W', '\u1E86': 'W', '\u1E84': 'W', '\u1E88': 'W', '\u2C72': 'W', '\u24CD': 'X', '\uFF38': 'X', '\u1E8A': 'X', '\u1E8C': 'X', '\u24CE': 'Y', '\uFF39': 'Y', '\u1EF2': 'Y', '\u00DD': 'Y', '\u0176': 'Y', '\u1EF8': 'Y', '\u0232': 'Y', '\u1E8E': 'Y', '\u0178': 'Y', '\u1EF6': 'Y', '\u1EF4': 'Y', '\u01B3': 'Y', '\u024E': 'Y', '\u1EFE': 'Y', '\u24CF': 'Z', '\uFF3A': 'Z', '\u0179': 'Z', '\u1E90': 'Z', '\u017B': 'Z', '\u017D': 'Z', '\u1E92': 'Z', '\u1E94': 'Z', '\u01B5': 'Z', '\u0224': 'Z', '\u2C7F': 'Z', '\u2C6B': 'Z', '\uA762': 'Z', '\u24D0': 'a', '\uFF41': 'a', '\u1E9A': 'a', '\u00E0': 'a', '\u00E1': 'a', '\u00E2': 'a', '\u1EA7': 'a', '\u1EA5': 'a', '\u1EAB': 'a', '\u1EA9': 'a', '\u00E3': 'a', '\u0101': 'a', '\u0103': 'a', '\u1EB1': 'a', '\u1EAF': 'a', '\u1EB5': 'a', '\u1EB3': 'a', '\u0227': 'a', '\u01E1': 'a', '\u00E4': 'a', '\u01DF': 'a', '\u1EA3': 'a', '\u00E5': 'a', '\u01FB': 'a', '\u01CE': 'a', '\u0201': 'a', '\u0203': 'a', '\u1EA1': 'a', '\u1EAD': 'a', '\u1EB7': 'a', '\u1E01': 'a', '\u0105': 'a', '\u2C65': 'a', '\u0250': 'a', '\uA733': 'aa', '\u00E6': 'ae', '\u01FD': 'ae', '\u01E3': 'ae', '\uA735': 'ao', '\uA737': 'au', '\uA739': 'av', '\uA73B': 'av', '\uA73D': 'ay', '\u24D1': 'b', '\uFF42': 'b', '\u1E03': 'b', '\u1E05': 'b', '\u1E07': 'b', '\u0180': 'b', '\u0183': 'b', '\u0253': 'b', '\u24D2': 'c', '\uFF43': 'c', '\u0107': 'c', '\u0109': 'c', '\u010B': 'c', '\u010D': 'c', '\u00E7': 'c', '\u1E09': 'c', '\u0188': 'c', '\u023C': 'c', '\uA73F': 'c', '\u2184': 'c', '\u24D3': 'd', '\uFF44': 'd', '\u1E0B': 'd', '\u010F': 'd', '\u1E0D': 'd', '\u1E11': 'd', '\u1E13': 'd', '\u1E0F': 'd', '\u0111': 'd', '\u018C': 'd', '\u0256': 'd', '\u0257': 'd', '\uA77A': 'd', '\u01F3': 'dz', '\u01C6': 'dz', '\u24D4': 'e', '\uFF45': 'e', '\u00E8': 'e', '\u00E9': 'e', '\u00EA': 'e', '\u1EC1': 'e', '\u1EBF': 'e', '\u1EC5': 'e', '\u1EC3': 'e', '\u1EBD': 'e', '\u0113': 'e', '\u1E15': 'e', '\u1E17': 'e', '\u0115': 'e', '\u0117': 'e', '\u00EB': 'e', '\u1EBB': 'e', '\u011B': 'e', '\u0205': 'e', '\u0207': 'e', '\u1EB9': 'e', '\u1EC7': 'e', '\u0229': 'e', '\u1E1D': 'e', '\u0119': 'e', '\u1E19': 'e', '\u1E1B': 'e', '\u0247': 'e', '\u025B': 'e', '\u01DD': 'e', '\u24D5': 'f', '\uFF46': 'f', '\u1E1F': 'f', '\u0192': 'f', '\uA77C': 'f', '\u24D6': 'g', '\uFF47': 'g', '\u01F5': 'g', '\u011D': 'g', '\u1E21': 'g', '\u011F': 'g', '\u0121': 'g', '\u01E7': 'g', '\u0123': 'g', '\u01E5': 'g', '\u0260': 'g', '\uA7A1': 'g', '\u1D79': 'g', '\uA77F': 'g', '\u24D7': 'h', '\uFF48': 'h', '\u0125': 'h', '\u1E23': 'h', '\u1E27': 'h', '\u021F': 'h', '\u1E25': 'h', '\u1E29': 'h', '\u1E2B': 'h', '\u1E96': 'h', '\u0127': 'h', '\u2C68': 'h', '\u2C76': 'h', '\u0265': 'h', '\u0195': 'hv', '\u24D8': 'i', '\uFF49': 'i', '\u00EC': 'i', '\u00ED': 'i', '\u00EE': 'i', '\u0129': 'i', '\u012B': 'i', '\u012D': 'i', '\u00EF': 'i', '\u1E2F': 'i', '\u1EC9': 'i', '\u01D0': 'i', '\u0209': 'i', '\u020B': 'i', '\u1ECB': 'i', '\u012F': 'i', '\u1E2D': 'i', '\u0268': 'i', '\u0131': 'i', '\u24D9': 'j', '\uFF4A': 'j', '\u0135': 'j', '\u01F0': 'j', '\u0249': 'j', '\u24DA': 'k', '\uFF4B': 'k', '\u1E31': 'k', '\u01E9': 'k', '\u1E33': 'k', '\u0137': 'k', '\u1E35': 'k', '\u0199': 'k', '\u2C6A': 'k', '\uA741': 'k', '\uA743': 'k', '\uA745': 'k', '\uA7A3': 'k', '\u24DB': 'l', '\uFF4C': 'l', '\u0140': 'l', '\u013A': 'l', '\u013E': 'l', '\u1E37': 'l', '\u1E39': 'l', '\u013C': 'l', '\u1E3D': 'l', '\u1E3B': 'l', '\u017F': 'l', '\u0142': 'l', '\u019A': 'l', '\u026B': 'l', '\u2C61': 'l', '\uA749': 'l', '\uA781': 'l', '\uA747': 'l', '\u01C9': 'lj', '\u24DC': 'm', '\uFF4D': 'm', '\u1E3F': 'm', '\u1E41': 'm', '\u1E43': 'm', '\u0271': 'm', '\u026F': 'm', '\u24DD': 'n', '\uFF4E': 'n', '\u01F9': 'n', '\u0144': 'n', '\u00F1': 'n', '\u1E45': 'n', '\u0148': 'n', '\u1E47': 'n', '\u0146': 'n', '\u1E4B': 'n', '\u1E49': 'n', '\u019E': 'n', '\u0272': 'n', '\u0149': 'n', '\uA791': 'n', '\uA7A5': 'n', '\u01CC': 'nj', '\u24DE': 'o', '\uFF4F': 'o', '\u00F2': 'o', '\u00F3': 'o', '\u00F4': 'o', '\u1ED3': 'o', '\u1ED1': 'o', '\u1ED7': 'o', '\u1ED5': 'o', '\u00F5': 'o', '\u1E4D': 'o', '\u022D': 'o', '\u1E4F': 'o', '\u014D': 'o', '\u1E51': 'o', '\u1E53': 'o', '\u014F': 'o', '\u022F': 'o', '\u0231': 'o', '\u00F6': 'o', '\u022B': 'o', '\u1ECF': 'o', '\u0151': 'o', '\u01D2': 'o', '\u020D': 'o', '\u020F': 'o', '\u01A1': 'o', '\u1EDD': 'o', '\u1EDB': 'o', '\u1EE1': 'o', '\u1EDF': 'o', '\u1EE3': 'o', '\u1ECD': 'o', '\u1ED9': 'o', '\u01EB': 'o', '\u01ED': 'o', '\u00F8': 'o', '\u01FF': 'o', '\u0254': 'o', '\uA74B': 'o', '\uA74D': 'o', '\u0275': 'o', '\u01A3': 'oi', '\u0223': 'ou', '\uA74F': 'oo', '\u24DF': 'p', '\uFF50': 'p', '\u1E55': 'p', '\u1E57': 'p', '\u01A5': 'p', '\u1D7D': 'p', '\uA751': 'p', '\uA753': 'p', '\uA755': 'p', '\u24E0': 'q', '\uFF51': 'q', '\u024B': 'q', '\uA757': 'q', '\uA759': 'q', '\u24E1': 'r', '\uFF52': 'r', '\u0155': 'r', '\u1E59': 'r', '\u0159': 'r', '\u0211': 'r', '\u0213': 'r', '\u1E5B': 'r', '\u1E5D': 'r', '\u0157': 'r', '\u1E5F': 'r', '\u024D': 'r', '\u027D': 'r', '\uA75B': 'r', '\uA7A7': 'r', '\uA783': 'r', '\u24E2': 's', '\uFF53': 's', '\u00DF': 's', '\u015B': 's', '\u1E65': 's', '\u015D': 's', '\u1E61': 's', '\u0161': 's', '\u1E67': 's', '\u1E63': 's', '\u1E69': 's', '\u0219': 's', '\u015F': 's', '\u023F': 's', '\uA7A9': 's', '\uA785': 's', '\u1E9B': 's', '\u24E3': 't', '\uFF54': 't', '\u1E6B': 't', '\u1E97': 't', '\u0165': 't', '\u1E6D': 't', '\u021B': 't', '\u0163': 't', '\u1E71': 't', '\u1E6F': 't', '\u0167': 't', '\u01AD': 't', '\u0288': 't', '\u2C66': 't', '\uA787': 't', '\uA729': 'tz', '\u24E4': 'u', '\uFF55': 'u', '\u00F9': 'u', '\u00FA': 'u', '\u00FB': 'u', '\u0169': 'u', '\u1E79': 'u', '\u016B': 'u', '\u1E7B': 'u', '\u016D': 'u', '\u00FC': 'u', '\u01DC': 'u', '\u01D8': 'u', '\u01D6': 'u', '\u01DA': 'u', '\u1EE7': 'u', '\u016F': 'u', '\u0171': 'u', '\u01D4': 'u', '\u0215': 'u', '\u0217': 'u', '\u01B0': 'u', '\u1EEB': 'u', '\u1EE9': 'u', '\u1EEF': 'u', '\u1EED': 'u', '\u1EF1': 'u', '\u1EE5': 'u', '\u1E73': 'u', '\u0173': 'u', '\u1E77': 'u', '\u1E75': 'u', '\u0289': 'u', '\u24E5': 'v', '\uFF56': 'v', '\u1E7D': 'v', '\u1E7F': 'v', '\u028B': 'v', '\uA75F': 'v', '\u028C': 'v', '\uA761': 'vy', '\u24E6': 'w', '\uFF57': 'w', '\u1E81': 'w', '\u1E83': 'w', '\u0175': 'w', '\u1E87': 'w', '\u1E85': 'w', '\u1E98': 'w', '\u1E89': 'w', '\u2C73': 'w', '\u24E7': 'x', '\uFF58': 'x', '\u1E8B': 'x', '\u1E8D': 'x', '\u24E8': 'y', '\uFF59': 'y', '\u1EF3': 'y', '\u00FD': 'y', '\u0177': 'y', '\u1EF9': 'y', '\u0233': 'y', '\u1E8F': 'y', '\u00FF': 'y', '\u1EF7': 'y', '\u1E99': 'y', '\u1EF5': 'y', '\u01B4': 'y', '\u024F': 'y', '\u1EFF': 'y', '\u24E9': 'z', '\uFF5A': 'z', '\u017A': 'z', '\u1E91': 'z', '\u017C': 'z', '\u017E': 'z', '\u1E93': 'z', '\u1E95': 'z', '\u01B6': 'z', '\u0225': 'z', '\u0240': 'z', '\u2C6C': 'z', '\uA763': 'z', '\u0386': '\u0391', '\u0388': '\u0395', '\u0389': '\u0397', '\u038A': '\u0399', '\u03AA': '\u0399', '\u038C': '\u039F', '\u038E': '\u03A5', '\u03AB': '\u03A5', '\u038F': '\u03A9', '\u03AC': '\u03B1', '\u03AD': '\u03B5', '\u03AE': '\u03B7', '\u03AF': '\u03B9', '\u03CA': '\u03B9', '\u0390': '\u03B9', '\u03CC': '\u03BF', '\u03CD': '\u03C5', '\u03CB': '\u03C5', '\u03B0': '\u03C5', '\u03C9': '\u03C9', '\u03C2': '\u03C3' }; return diacritics; }); S2.define('select2/data/base',[ '../utils' ], function (Utils) { function BaseAdapter ($element, options) { BaseAdapter.__super__.constructor.call(this); } Utils.Extend(BaseAdapter, Utils.Observable); BaseAdapter.prototype.current = function (callback) { throw new Error('The `current` method must be defined in child classes.'); }; BaseAdapter.prototype.query = function (params, callback) { throw new Error('The `query` method must be defined in child classes.'); }; BaseAdapter.prototype.bind = function (container, $container) { // Can be implemented in subclasses }; BaseAdapter.prototype.destroy = function () { // Can be implemented in subclasses }; BaseAdapter.prototype.generateResultId = function (container, data) { var id = container.id + '-result-'; id += Utils.generateChars(4); if (data.id != null) { id += '-' + data.id.toString(); } else { id += '-' + Utils.generateChars(4); } return id; }; return BaseAdapter; }); S2.define('select2/data/select',[ './base', '../utils', 'jquery' ], function (BaseAdapter, Utils, $) { function SelectAdapter ($element, options) { this.$element = $element; this.options = options; SelectAdapter.__super__.constructor.call(this); } Utils.Extend(SelectAdapter, BaseAdapter); SelectAdapter.prototype.current = function (callback) { var data = []; var self = this; this.$element.find(':selected').each(function () { var $option = $(this); var option = self.item($option); data.push(option); }); callback(data); }; SelectAdapter.prototype.select = function (data) { var self = this; data.selected = true; // If data.element is a DOM node, use it instead if ($(data.element).is('option')) { data.element.selected = true; this.$element.trigger('change'); return; } if (this.$element.prop('multiple')) { this.current(function (currentData) { var val = []; data = [data]; data.push.apply(data, currentData); for (var d = 0; d < data.length; d++) { var id = data[d].id; if ($.inArray(id, val) === -1) { val.push(id); } } self.$element.val(val); self.$element.trigger('change'); }); } else { var val = data.id; this.$element.val(val); this.$element.trigger('change'); } }; SelectAdapter.prototype.unselect = function (data) { var self = this; if (!this.$element.prop('multiple')) { return; } data.selected = false; if ($(data.element).is('option')) { data.element.selected = false; this.$element.trigger('change'); return; } this.current(function (currentData) { var val = []; for (var d = 0; d < currentData.length; d++) { var id = currentData[d].id; if (id !== data.id && $.inArray(id, val) === -1) { val.push(id); } } self.$element.val(val); self.$element.trigger('change'); }); }; SelectAdapter.prototype.bind = function (container, $container) { var self = this; this.container = container; container.on('select', function (params) { self.select(params.data); }); container.on('unselect', function (params) { self.unselect(params.data); }); }; SelectAdapter.prototype.destroy = function () { // Remove anything added to child elements this.$element.find('*').each(function () { // Remove any custom data set by Select2 $.removeData(this, 'data'); }); }; SelectAdapter.prototype.query = function (params, callback) { var data = []; var self = this; var $options = this.$element.children(); $options.each(function () { var $option = $(this); if (!$option.is('option') && !$option.is('optgroup')) { return; } var option = self.item($option); var matches = self.matches(params, option); if (matches !== null) { data.push(matches); } }); callback({ results: data }); }; SelectAdapter.prototype.addOptions = function ($options) { Utils.appendMany(this.$element, $options); }; SelectAdapter.prototype.option = function (data) { var option; if (data.children) { option = document.createElement('optgroup'); option.label = data.text; } else { option = document.createElement('option'); if (option.textContent !== undefined) { option.textContent = data.text; } else { option.innerText = data.text; } } if (data.id !== undefined) { option.value = data.id; } if (data.disabled) { option.disabled = true; } if (data.selected) { option.selected = true; } if (data.title) { option.title = data.title; } var $option = $(option); var normalizedData = this._normalizeItem(data); normalizedData.element = option; // Override the option's data with the combined data $.data(option, 'data', normalizedData); return $option; }; SelectAdapter.prototype.item = function ($option) { var data = {}; data = $.data($option[0], 'data'); if (data != null) { return data; } if ($option.is('option')) { data = { id: $option.val(), text: $option.text(), disabled: $option.prop('disabled'), selected: $option.prop('selected'), title: $option.prop('title') }; } else if ($option.is('optgroup')) { data = { text: $option.prop('label'), children: [], title: $option.prop('title') }; var $children = $option.children('option'); var children = []; for (var c = 0; c < $children.length; c++) { var $child = $($children[c]); var child = this.item($child); children.push(child); } data.children = children; } data = this._normalizeItem(data); data.element = $option[0]; $.data($option[0], 'data', data); return data; }; SelectAdapter.prototype._normalizeItem = function (item) { if (!$.isPlainObject(item)) { item = { id: item, text: item }; } item = $.extend({}, { text: '' }, item); var defaults = { selected: false, disabled: false }; if (item.id != null) { item.id = item.id.toString(); } if (item.text != null) { item.text = item.text.toString(); } if (item._resultId == null && item.id && this.container != null) { item._resultId = this.generateResultId(this.container, item); } return $.extend({}, defaults, item); }; SelectAdapter.prototype.matches = function (params, data) { var matcher = this.options.get('matcher'); return matcher(params, data); }; return SelectAdapter; }); S2.define('select2/data/array',[ './select', '../utils', 'jquery' ], function (SelectAdapter, Utils, $) { function ArrayAdapter ($element, options) { var data = options.get('data') || []; ArrayAdapter.__super__.constructor.call(this, $element, options); this.addOptions(this.convertToOptions(data)); } Utils.Extend(ArrayAdapter, SelectAdapter); ArrayAdapter.prototype.select = function (data) { var $option = this.$element.find('option').filter(function (i, elm) { return elm.value == data.id.toString(); }); if ($option.length === 0) { $option = this.option(data); this.addOptions($option); } ArrayAdapter.__super__.select.call(this, data); }; ArrayAdapter.prototype.convertToOptions = function (data) { var self = this; var $existing = this.$element.find('option'); var existingIds = $existing.map(function () { return self.item($(this)).id; }).get(); var $options = []; // Filter out all items except for the one passed in the argument function onlyItem (item) { return function () { return $(this).val() == item.id; }; } for (var d = 0; d < data.length; d++) { var item = this._normalizeItem(data[d]); // Skip items which were pre-loaded, only merge the data if ($.inArray(item.id, existingIds) >= 0) { var $existingOption = $existing.filter(onlyItem(item)); var existingData = this.item($existingOption); var newData = $.extend(true, {}, item, existingData); var $newOption = this.option(newData); $existingOption.replaceWith($newOption); continue; } var $option = this.option(item); if (item.children) { var $children = this.convertToOptions(item.children); Utils.appendMany($option, $children); } $options.push($option); } return $options; }; return ArrayAdapter; }); S2.define('select2/data/ajax',[ './array', '../utils', 'jquery' ], function (ArrayAdapter, Utils, $) { function AjaxAdapter ($element, options) { this.ajaxOptions = this._applyDefaults(options.get('ajax')); if (this.ajaxOptions.processResults != null) { this.processResults = this.ajaxOptions.processResults; } AjaxAdapter.__super__.constructor.call(this, $element, options); } Utils.Extend(AjaxAdapter, ArrayAdapter); AjaxAdapter.prototype._applyDefaults = function (options) { var defaults = { data: function (params) { return $.extend({}, params, { q: params.term }); }, transport: function (params, success, failure) { var $request = $.ajax(params); $request.then(success); $request.fail(failure); return $request; } }; return $.extend({}, defaults, options, true); }; AjaxAdapter.prototype.processResults = function (results) { return results; }; AjaxAdapter.prototype.query = function (params, callback) { var matches = []; var self = this; if (this._request != null) { // JSONP requests cannot always be aborted if ($.isFunction(this._request.abort)) { this._request.abort(); } this._request = null; } var options = $.extend({ type: 'GET' }, this.ajaxOptions); if (typeof options.url === 'function') { options.url = options.url.call(this.$element, params); } if (typeof options.data === 'function') { options.data = options.data.call(this.$element, params); } function request () { var $request = options.transport(options, function (data) { var results = self.processResults(data, params); if (self.options.get('debug') && window.console && console.error) { // Check to make sure that the response included a `results` key. if (!results || !results.results || !Array.isArray(results.results)) { console.error( 'Select2: The AJAX results did not return an array in the ' + '`results` key of the response.' ); } } callback(results); }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property if ($request.status && $request.status === '0') { return; } self.trigger('results:message', { message: 'errorLoading' }); }); self._request = $request; } if (this.ajaxOptions.delay && params.term != null) { if (this._queryTimeout) { window.clearTimeout(this._queryTimeout); } this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); } else { request(); } }; return AjaxAdapter; }); S2.define('select2/data/tags',[ 'jquery' ], function ($) { function Tags (decorated, $element, options) { var tags = options.get('tags'); var createTag = options.get('createTag'); if (createTag !== undefined) { this.createTag = createTag; } var insertTag = options.get('insertTag'); if (insertTag !== undefined) { this.insertTag = insertTag; } decorated.call(this, $element, options); if (Array.isArray(tags)) { for (var t = 0; t < tags.length; t++) { var tag = tags[t]; var item = this._normalizeItem(tag); var $option = this.option(item); this.$element.append($option); } } } Tags.prototype.query = function (decorated, params, callback) { var self = this; this._removeOldTags(); if (params.term == null || params.page != null) { decorated.call(this, params, callback); return; } function wrapper (obj, child) { var data = obj.results; for (var i = 0; i < data.length; i++) { var option = data[i]; var checkChildren = ( option.children != null && !wrapper({ results: option.children }, true) ); var optionText = (option.text || '').toUpperCase(); var paramsTerm = (params.term || '').toUpperCase(); var checkText = optionText === paramsTerm; if (checkText || checkChildren) { if (child) { return false; } obj.data = data; callback(obj); return; } } if (child) { return true; } var tag = self.createTag(params); if (tag != null) { var $option = self.option(tag); $option.attr('data-select2-tag', true); self.addOptions([$option]); self.insertTag(data, tag); } obj.results = data; callback(obj); } decorated.call(this, params, wrapper); }; Tags.prototype.createTag = function (decorated, params) { var term = $.trim(params.term); if (term === '') { return null; } return { id: term, text: term }; }; Tags.prototype.insertTag = function (_, data, tag) { data.unshift(tag); }; Tags.prototype._removeOldTags = function (_) { var tag = this._lastTag; var $options = this.$element.find('option[data-select2-tag]'); $options.each(function () { if (this.selected) { return; } $(this).remove(); }); }; return Tags; }); S2.define('select2/data/tokenizer',[ 'jquery' ], function ($) { function Tokenizer (decorated, $element, options) { var tokenizer = options.get('tokenizer'); if (tokenizer !== undefined) { this.tokenizer = tokenizer; } decorated.call(this, $element, options); } Tokenizer.prototype.bind = function (decorated, container, $container) { decorated.call(this, container, $container); this.$search = container.dropdown.$search || container.selection.$search || $container.find('.select2-search__field'); }; Tokenizer.prototype.query = function (decorated, params, callback) { var self = this; function createAndSelect (data) { // Normalize the data object so we can use it for checks var item = self._normalizeItem(data); // Check if the data object already exists as a tag // Select it if it doesn't var $existingOptions = self.$element.find('option').filter(function () { return $(this).val() === item.id; }); // If an existing option wasn't found for it, create the option if (!$existingOptions.length) { var $option = self.option(item); $option.attr('data-select2-tag', true); self._removeOldTags(); self.addOptions([$option]); } // Select the item, now that we know there is an option for it select(item); } function select (data) { self.trigger('select', { data: data }); } params.term = params.term || ''; var tokenData = this.tokenizer(params, this.options, createAndSelect); if (tokenData.term !== params.term) { // Replace the search term if we have the search box if (this.$search.length) { this.$search.val(tokenData.term); this.$search.focus(); } params.term = tokenData.term; } decorated.call(this, params, callback); }; Tokenizer.prototype.tokenizer = function (_, params, options, callback) { var separators = options.get('tokenSeparators') || []; var term = params.term; var i = 0; var createTag = this.createTag || function (params) { return { id: params.term, text: params.term }; }; while (i < term.length) { var termChar = term[i]; if ($.inArray(termChar, separators) === -1) { i++; continue; } var part = term.substr(0, i); var partParams = $.extend({}, params, { term: part }); var data = createTag(partParams); if (data == null) { i++; continue; } callback(data); // Reset the term to not include the tokenized portion term = term.substr(i + 1) || ''; i = 0; } return { term: term }; }; return Tokenizer; }); S2.define('select2/data/minimumInputLength',[ ], function () { function MinimumInputLength (decorated, $e, options) { this.minimumInputLength = options.get('minimumInputLength'); decorated.call(this, $e, options); } MinimumInputLength.prototype.query = function (decorated, params, callback) { params.term = params.term || ''; if (params.term.length < this.minimumInputLength) { this.trigger('results:message', { message: 'inputTooShort', args: { minimum: this.minimumInputLength, input: params.term, params: params } }); return; } decorated.call(this, params, callback); }; return MinimumInputLength; }); S2.define('select2/data/maximumInputLength',[ ], function () { function MaximumInputLength (decorated, $e, options) { this.maximumInputLength = options.get('maximumInputLength'); decorated.call(this, $e, options); } MaximumInputLength.prototype.query = function (decorated, params, callback) { params.term = params.term || ''; if (this.maximumInputLength > 0 && params.term.length > this.maximumInputLength) { this.trigger('results:message', { message: 'inputTooLong', args: { maximum: this.maximumInputLength, input: params.term, params: params } }); return; } decorated.call(this, params, callback); }; return MaximumInputLength; }); S2.define('select2/data/maximumSelectionLength',[ ], function (){ function MaximumSelectionLength (decorated, $e, options) { this.maximumSelectionLength = options.get('maximumSelectionLength'); decorated.call(this, $e, options); } MaximumSelectionLength.prototype.query = function (decorated, params, callback) { var self = this; this.current(function (currentData) { var count = currentData != null ? currentData.length : 0; if (self.maximumSelectionLength > 0 && count >= self.maximumSelectionLength) { self.trigger('results:message', { message: 'maximumSelected', args: { maximum: self.maximumSelectionLength } }); return; } decorated.call(self, params, callback); }); }; return MaximumSelectionLength; }); S2.define('select2/dropdown',[ 'jquery', './utils' ], function ($, Utils) { function Dropdown ($element, options) { this.$element = $element; this.options = options; Dropdown.__super__.constructor.call(this); } Utils.Extend(Dropdown, Utils.Observable); Dropdown.prototype.render = function () { var $dropdown = $( '<span class="select2-dropdown">' + '<span class="select2-results"></span>' + '</span>' ); $dropdown.attr('dir', this.options.get('dir')); this.$dropdown = $dropdown; return $dropdown; }; Dropdown.prototype.bind = function () { // Should be implemented in subclasses }; Dropdown.prototype.position = function ($dropdown, $container) { // Should be implmented in subclasses }; Dropdown.prototype.destroy = function () { // Remove the dropdown from the DOM this.$dropdown.remove(); }; return Dropdown; }); S2.define('select2/dropdown/search',[ 'jquery', '../utils' ], function ($, Utils) { function Search () { } Search.prototype.render = function (decorated) { var $rendered = decorated.call(this); var $search = $( '<span class="select2-search select2-search--dropdown">' + '<input class="select2-search__field" type="search" tabindex="-1"' + ' autocomplete="off" autocorrect="off" autocapitalize="none"' + ' spellcheck="false" role="textbox" />' + '</span>' ); this.$searchContainer = $search; this.$search = $search.find('input'); $rendered.prepend($search); return $rendered; }; Search.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); this.$search.on('keydown', function (evt) { self.trigger('keypress', evt); self._keyUpPrevented = evt.isDefaultPrevented(); }); // Workaround for browsers which do not support the `input` event // This will prevent double-triggering of events for browsers which support // both the `keyup` and `input` events. this.$search.on('input', function (evt) { // Unbind the duplicated `keyup` event $(this).off('keyup'); }); this.$search.on('keyup input', function (evt) { self.handleSearch(evt); }); container.on('open', function () { self.$search.attr('tabindex', 0); self.$search.focus(); window.setTimeout(function () { self.$search.focus(); }, 0); }); container.on('close', function () { self.$search.attr('tabindex', -1); self.$search.val(''); }); container.on('focus', function () { if (!container.isOpen()) { self.$search.focus(); } }); container.on('results:all', function (params) { if (params.query.term == null || params.query.term === '') { var showSearch = self.showSearch(params); if (showSearch) { self.$searchContainer.removeClass('select2-search--hide'); } else { self.$searchContainer.addClass('select2-search--hide'); } } }); }; Search.prototype.handleSearch = function (evt) { if (!this._keyUpPrevented) { var input = this.$search.val(); this.trigger('query', { term: input }); } this._keyUpPrevented = false; }; Search.prototype.showSearch = function (_, params) { return true; }; return Search; }); S2.define('select2/dropdown/hidePlaceholder',[ ], function () { function HidePlaceholder (decorated, $element, options, dataAdapter) { this.placeholder = this.normalizePlaceholder(options.get('placeholder')); decorated.call(this, $element, options, dataAdapter); } HidePlaceholder.prototype.append = function (decorated, data) { data.results = this.removePlaceholder(data.results); decorated.call(this, data); }; HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { if (typeof placeholder === 'string') { placeholder = { id: '', text: placeholder }; } return placeholder; }; HidePlaceholder.prototype.removePlaceholder = function (_, data) { var modifiedData = data.slice(0); for (var d = data.length - 1; d >= 0; d--) { var item = data[d]; if (this.placeholder.id === item.id) { modifiedData.splice(d, 1); } } return modifiedData; }; return HidePlaceholder; }); S2.define('select2/dropdown/infiniteScroll',[ 'jquery' ], function ($) { function InfiniteScroll (decorated, $element, options, dataAdapter) { this.lastParams = {}; decorated.call(this, $element, options, dataAdapter); this.$loadingMore = this.createLoadingMore(); this.loading = false; } InfiniteScroll.prototype.append = function (decorated, data) { this.$loadingMore.remove(); this.loading = false; decorated.call(this, data); if (this.showLoadingMore(data)) { this.$results.append(this.$loadingMore); } }; InfiniteScroll.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('query', function (params) { self.lastParams = params; self.loading = true; }); container.on('query:append', function (params) { self.lastParams = params; self.loading = true; }); this.$results.on('scroll', function () { var isLoadMoreVisible = $.contains( document.documentElement, self.$loadingMore[0] ); if (self.loading || !isLoadMoreVisible) { return; } var currentOffset = self.$results.offset().top + self.$results.outerHeight(false); var loadingMoreOffset = self.$loadingMore.offset().top + self.$loadingMore.outerHeight(false); if (currentOffset + 50 >= loadingMoreOffset) { self.loadMore(); } }); }; InfiniteScroll.prototype.loadMore = function () { this.loading = true; var params = $.extend({}, {page: 1}, this.lastParams); params.page++; this.trigger('query:append', params); }; InfiniteScroll.prototype.showLoadingMore = function (_, data) { return data.pagination && data.pagination.more; }; InfiniteScroll.prototype.createLoadingMore = function () { var $option = $( '<li ' + 'class="select2-results__option select2-results__option--load-more"' + 'role="treeitem" aria-disabled="true"></li>' ); var message = this.options.get('translations').get('loadingMore'); $option.html(message(this.lastParams)); return $option; }; return InfiniteScroll; }); S2.define('select2/dropdown/attachBody',[ 'jquery', '../utils' ], function ($, Utils) { function AttachBody (decorated, $element, options) { this.$dropdownParent = options.get('dropdownParent') || $(document.body); decorated.call(this, $element, options); } AttachBody.prototype.bind = function (decorated, container, $container) { var self = this; var setupResultsEvents = false; decorated.call(this, container, $container); container.on('open', function () { self._showDropdown(); self._attachPositioningHandler(container); if (!setupResultsEvents) { setupResultsEvents = true; container.on('results:all', function () { self._positionDropdown(); self._resizeDropdown(); }); container.on('results:append', function () { self._positionDropdown(); self._resizeDropdown(); }); } }); container.on('close', function () { self._hideDropdown(); self._detachPositioningHandler(container); }); this.$dropdownContainer.on('mousedown', function (evt) { evt.stopPropagation(); }); }; AttachBody.prototype.destroy = function (decorated) { decorated.call(this); this.$dropdownContainer.remove(); }; AttachBody.prototype.position = function (decorated, $dropdown, $container) { // Clone all of the container classes $dropdown.attr('class', $container.attr('class')); $dropdown.removeClass('select2'); $dropdown.addClass('select2-container--open'); $dropdown.css({ position: 'absolute', top: -999999 }); this.$container = $container; }; AttachBody.prototype.render = function (decorated) { var $container = $('<span></span>'); var $dropdown = decorated.call(this); $container.append($dropdown); this.$dropdownContainer = $container; return $container; }; AttachBody.prototype._hideDropdown = function (decorated) { this.$dropdownContainer.detach(); }; AttachBody.prototype._attachPositioningHandler = function (decorated, container) { var self = this; var scrollEvent = 'scroll.select2.' + container.id; var resizeEvent = 'resize.select2.' + container.id; var orientationEvent = 'orientationchange.select2.' + container.id; var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.each(function () { $(this).data('select2-scroll-position', { x: $(this).scrollLeft(), y: $(this).scrollTop() }); }); $watchers.on(scrollEvent, function (ev) { var position = $(this).data('select2-scroll-position'); $(this).scrollTop(position.y); }); $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, function (e) { self._positionDropdown(); self._resizeDropdown(); }); }; AttachBody.prototype._detachPositioningHandler = function (decorated, container) { var scrollEvent = 'scroll.select2.' + container.id; var resizeEvent = 'resize.select2.' + container.id; var orientationEvent = 'orientationchange.select2.' + container.id; var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.off(scrollEvent); $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); }; AttachBody.prototype._positionDropdown = function () { var $window = $(window); var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); var newDirection = null; var offset = this.$container.offset(); offset.bottom = offset.top + this.$container.outerHeight(false); var container = { height: this.$container.outerHeight(false) }; container.top = offset.top; container.bottom = offset.top + container.height; var dropdown = { height: this.$dropdown.outerHeight(false) }; var viewport = { top: $window.scrollTop(), bottom: $window.scrollTop() + $window.height() }; var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); var css = { left: offset.left, top: container.bottom }; // Determine what the parent element is to use for calciulating the offset var $offsetParent = this.$dropdownParent; // For statically positoned elements, we need to get the element // that is determining the offset if ($offsetParent.css('position') === 'static') { $offsetParent = $offsetParent.offsetParent(); } var parentOffset = $offsetParent.offset(); css.top -= parentOffset.top; css.left -= parentOffset.left; if (!isCurrentlyAbove && !isCurrentlyBelow) { newDirection = 'below'; } if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { newDirection = 'above'; } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { newDirection = 'below'; } if (newDirection == 'above' || (isCurrentlyAbove && newDirection !== 'below')) { css.top = container.top - parentOffset.top - dropdown.height; } if (newDirection != null) { this.$dropdown .removeClass('select2-dropdown--below select2-dropdown--above') .addClass('select2-dropdown--' + newDirection); this.$container .removeClass('select2-container--below select2-container--above') .addClass('select2-container--' + newDirection); } this.$dropdownContainer.css(css); }; AttachBody.prototype._resizeDropdown = function () { var css = { width: this.$container.outerWidth(false) + 'px' }; if (this.options.get('dropdownAutoWidth')) { css.minWidth = css.width; css.position = 'relative'; css.width = 'auto'; } this.$dropdown.css(css); }; AttachBody.prototype._showDropdown = function (decorated) { this.$dropdownContainer.appendTo(this.$dropdownParent); this._positionDropdown(); this._resizeDropdown(); }; return AttachBody; }); S2.define('select2/dropdown/minimumResultsForSearch',[ ], function () { function countResults (data) { var count = 0; for (var d = 0; d < data.length; d++) { var item = data[d]; if (item.children) { count += countResults(item.children); } else { count++; } } return count; } function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { this.minimumResultsForSearch = options.get('minimumResultsForSearch'); if (this.minimumResultsForSearch < 0) { this.minimumResultsForSearch = Infinity; } decorated.call(this, $element, options, dataAdapter); } MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { if (countResults(params.data.results) < this.minimumResultsForSearch) { return false; } return decorated.call(this, params); }; return MinimumResultsForSearch; }); S2.define('select2/dropdown/selectOnClose',[ ], function () { function SelectOnClose () { } SelectOnClose.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('close', function (params) { self._handleSelectOnClose(params); }); }; SelectOnClose.prototype._handleSelectOnClose = function (_, params) { if (params && params.originalSelect2Event != null) { var event = params.originalSelect2Event; // Don't select an item if the close event was triggered from a select or // unselect event if (event._type === 'select' || event._type === 'unselect') { return; } } var $highlightedResults = this.getHighlightedResults(); // Only select highlighted results if ($highlightedResults.length < 1) { return; } var data = $highlightedResults.data('data'); // Don't re-select already selected resulte if ( (data.element != null && data.element.selected) || (data.element == null && data.selected) ) { return; } this.trigger('select', { data: data }); }; return SelectOnClose; }); S2.define('select2/dropdown/closeOnSelect',[ ], function () { function CloseOnSelect () { } CloseOnSelect.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('select', function (evt) { self._selectTriggered(evt); }); container.on('unselect', function (evt) { self._selectTriggered(evt); }); }; CloseOnSelect.prototype._selectTriggered = function (_, evt) { var originalEvent = evt.originalEvent; // Don't close if the control key is being held if (originalEvent && originalEvent.ctrlKey) { return; } this.trigger('close', { originalEvent: originalEvent, originalSelect2Event: evt }); }; return CloseOnSelect; }); S2.define('select2/i18n/en',[],function () { // English return { errorLoading: function () { return 'The results could not be loaded.'; }, inputTooLong: function (args) { var overChars = args.input.length - args.maximum; var message = 'Please delete ' + overChars + ' character'; if (overChars != 1) { message += 's'; } return message; }, inputTooShort: function (args) { var remainingChars = args.minimum - args.input.length; var message = 'Please enter ' + remainingChars + ' or more characters'; return message; }, loadingMore: function () { return 'Loading more results…'; }, maximumSelected: function (args) { var message = 'You can only select ' + args.maximum + ' item'; if (args.maximum != 1) { message += 's'; } return message; }, noResults: function () { return 'No results found'; }, searching: function () { return 'Searching…'; } }; }); S2.define('select2/defaults',[ 'jquery', 'require', './results', './selection/single', './selection/multiple', './selection/placeholder', './selection/allowClear', './selection/search', './selection/eventRelay', './utils', './translation', './diacritics', './data/select', './data/array', './data/ajax', './data/tags', './data/tokenizer', './data/minimumInputLength', './data/maximumInputLength', './data/maximumSelectionLength', './dropdown', './dropdown/search', './dropdown/hidePlaceholder', './dropdown/infiniteScroll', './dropdown/attachBody', './dropdown/minimumResultsForSearch', './dropdown/selectOnClose', './dropdown/closeOnSelect', './i18n/en' ], function ($, require, ResultsList, SingleSelection, MultipleSelection, Placeholder, AllowClear, SelectionSearch, EventRelay, Utils, Translation, DIACRITICS, SelectData, ArrayData, AjaxData, Tags, Tokenizer, MinimumInputLength, MaximumInputLength, MaximumSelectionLength, Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, EnglishTranslation) { function Defaults () { this.reset(); } Defaults.prototype.apply = function (options) { options = $.extend(true, {}, this.defaults, options); if (options.dataAdapter == null) { if (options.ajax != null) { options.dataAdapter = AjaxData; } else if (options.data != null) { options.dataAdapter = ArrayData; } else { options.dataAdapter = SelectData; } if (options.minimumInputLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MinimumInputLength ); } if (options.maximumInputLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MaximumInputLength ); } if (options.maximumSelectionLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MaximumSelectionLength ); } if (options.tags) { options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); } if (options.tokenSeparators != null || options.tokenizer != null) { options.dataAdapter = Utils.Decorate( options.dataAdapter, Tokenizer ); } if (options.query != null) { var Query = require(options.amdBase + 'compat/query'); options.dataAdapter = Utils.Decorate( options.dataAdapter, Query ); } if (options.initSelection != null) { var InitSelection = require(options.amdBase + 'compat/initSelection'); options.dataAdapter = Utils.Decorate( options.dataAdapter, InitSelection ); } } if (options.resultsAdapter == null) { options.resultsAdapter = ResultsList; if (options.ajax != null) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, InfiniteScroll ); } if (options.placeholder != null) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, HidePlaceholder ); } if (options.selectOnClose) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, SelectOnClose ); } } if (options.dropdownAdapter == null) { if (options.multiple) { options.dropdownAdapter = Dropdown; } else { var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); options.dropdownAdapter = SearchableDropdown; } if (options.minimumResultsForSearch !== 0) { options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, MinimumResultsForSearch ); } if (options.closeOnSelect) { options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, CloseOnSelect ); } if ( options.dropdownCssClass != null || options.dropdownCss != null || options.adaptDropdownCssClass != null ) { var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, DropdownCSS ); } options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, AttachBody ); } if (options.selectionAdapter == null) { if (options.multiple) { options.selectionAdapter = MultipleSelection; } else { options.selectionAdapter = SingleSelection; } // Add the placeholder mixin if a placeholder was specified if (options.placeholder != null) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, Placeholder ); } if (options.allowClear) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, AllowClear ); } if (options.multiple) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, SelectionSearch ); } if ( options.containerCssClass != null || options.containerCss != null || options.adaptContainerCssClass != null ) { var ContainerCSS = require(options.amdBase + 'compat/containerCss'); options.selectionAdapter = Utils.Decorate( options.selectionAdapter, ContainerCSS ); } options.selectionAdapter = Utils.Decorate( options.selectionAdapter, EventRelay ); } if (typeof options.language === 'string') { // Check if the language is specified with a region if (options.language.indexOf('-') > 0) { // Extract the region information if it is included var languageParts = options.language.split('-'); var baseLanguage = languageParts[0]; options.language = [options.language, baseLanguage]; } else { options.language = [options.language]; } } if (Array.isArray(options.language)) { var languages = new Translation(); options.language.push('en'); var languageNames = options.language; for (var l = 0; l < languageNames.length; l++) { var name = languageNames[l]; var language = {}; try { // Try to load it with the original name language = Translation.loadPath(name); } catch (e) { try { // If we couldn't load it, check if it wasn't the full path name = this.defaults.amdLanguageBase + name; language = Translation.loadPath(name); } catch (ex) { // The translation could not be loaded at all. Sometimes this is // because of a configuration problem, other times this can be // because of how Select2 helps load all possible translation files. if (options.debug && window.console && console.warn) { console.warn( 'Select2: The language file for "' + name + '" could not be ' + 'automatically loaded. A fallback will be used instead.' ); } continue; } } languages.extend(language); } options.translations = languages; } else { var baseTranslation = Translation.loadPath( this.defaults.amdLanguageBase + 'en' ); var customTranslation = new Translation(options.language); customTranslation.extend(baseTranslation); options.translations = customTranslation; } return options; }; Defaults.prototype.reset = function () { function stripDiacritics (text) { // Used 'uni range + named function' from http://jsperf.com/diacritics/18 function match(a) { return DIACRITICS[a] || a; } // Regex to replace unicode range with match. return text.replace(/[^\u0000-\u007E]/g, match); } function matcher (params, data) { // Always return the object if there is nothing to compare if ($.trim(params.term) === '') { return data; } // Do a recursive check for options with children if (data.children && data.children.length > 0) { // Clone the data object if there are children // This is required as we modify the object to remove any non-matches var match = $.extend(true, {}, data); // Check each child of the option for (var c = data.children.length - 1; c >= 0; c--) { var child = data.children[c]; var matches = matcher(params, child); // If there wasn't a match, remove the object in the array if (matches == null) { match.children.splice(c, 1); } } // If any children matched, return the new object if (match.children.length > 0) { return match; } // If there were no matching children, check just the plain object return matcher(params, match); } var original = stripDiacritics(data.text).toUpperCase(); var term = stripDiacritics(params.term).toUpperCase(); // Check if the text contains the term if (original.indexOf(term) > -1) { return data; } // If it doesn't contain the term, don't return anything return null; } this.defaults = { amdBase: './', amdLanguageBase: './i18n/', closeOnSelect: true, debug: false, dropdownAutoWidth: false, escapeMarkup: Utils.escapeMarkup, language: EnglishTranslation, matcher: matcher, minimumInputLength: 0, maximumInputLength: 0, maximumSelectionLength: 0, minimumResultsForSearch: 0, selectOnClose: false, sorter: function (data) { return data; }, templateResult: function (result) { return result.text; }, templateSelection: function (selection) { return selection.text; }, theme: 'default', width: 'resolve' }; }; Defaults.prototype.set = function (key, value) { var camelKey = $.camelCase(key); var data = {}; data[camelKey] = value; var convertedData = Utils._convertData(data); $.extend(this.defaults, convertedData); }; var defaults = new Defaults(); return defaults; }); S2.define('select2/options',[ 'require', 'jquery', './defaults', './utils' ], function (require, $, Defaults, Utils) { function Options (options, $element) { this.options = options; if ($element != null) { this.fromElement($element); } this.options = Defaults.apply(this.options); if ($element && $element.is('input')) { var InputCompat = require(this.get('amdBase') + 'compat/inputData'); this.options.dataAdapter = Utils.Decorate( this.options.dataAdapter, InputCompat ); } } Options.prototype.fromElement = function ($e) { var excludedData = ['select2']; if (this.options.multiple == null) { this.options.multiple = $e.prop('multiple'); } if (this.options.disabled == null) { this.options.disabled = $e.prop('disabled'); } if (this.options.language == null) { if ($e.prop('lang')) { this.options.language = $e.prop('lang').toLowerCase(); } else if ($e.closest('[lang]').prop('lang')) { this.options.language = $e.closest('[lang]').prop('lang'); } } if (this.options.dir == null) { if ($e.prop('dir')) { this.options.dir = $e.prop('dir'); } else if ($e.closest('[dir]').prop('dir')) { this.options.dir = $e.closest('[dir]').prop('dir'); } else { this.options.dir = 'ltr'; } } $e.prop('disabled', this.options.disabled); $e.prop('multiple', this.options.multiple); if ($e.data('select2Tags')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-select2-tags` attribute has been changed to ' + 'use the `data-data` and `data-tags="true"` attributes and will be ' + 'removed in future versions of Select2.' ); } $e.data('data', $e.data('select2Tags')); $e.data('tags', true); } if ($e.data('ajaxUrl')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-ajax-url` attribute has been changed to ' + '`data-ajax--url` and support for the old attribute will be removed' + ' in future versions of Select2.' ); } $e.attr('ajax--url', $e.data('ajaxUrl')); $e.data('ajax--url', $e.data('ajaxUrl')); } var dataset = {}; // Prefer the element's `dataset` attribute if it exists // jQuery 1.x does not correctly handle data attributes with multiple dashes if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { dataset = $.extend(true, {}, $e[0].dataset, $e.data()); } else { dataset = $e.data(); } var data = $.extend(true, {}, dataset); data = Utils._convertData(data); for (var key in data) { if ($.inArray(key, excludedData) > -1) { continue; } if ($.isPlainObject(this.options[key])) { $.extend(this.options[key], data[key]); } else { this.options[key] = data[key]; } } return this; }; Options.prototype.get = function (key) { return this.options[key]; }; Options.prototype.set = function (key, val) { this.options[key] = val; }; return Options; }); S2.define('select2/core',[ 'jquery', './options', './utils', './keys' ], function ($, Options, Utils, KEYS) { var Select2 = function ($element, options) { if ($element.data('select2') != null) { $element.data('select2').destroy(); } this.$element = $element; this.id = this._generateId($element); options = options || {}; this.options = new Options(options, $element); Select2.__super__.constructor.call(this); // Set up the tabindex var tabindex = $element.attr('tabindex') || 0; $element.data('old-tabindex', tabindex); $element.attr('tabindex', '-1'); // Set up containers and adapters var DataAdapter = this.options.get('dataAdapter'); this.dataAdapter = new DataAdapter($element, this.options); var $container = this.render(); this._placeContainer($container); var SelectionAdapter = this.options.get('selectionAdapter'); this.selection = new SelectionAdapter($element, this.options); this.$selection = this.selection.render(); this.selection.position(this.$selection, $container); var DropdownAdapter = this.options.get('dropdownAdapter'); this.dropdown = new DropdownAdapter($element, this.options); this.$dropdown = this.dropdown.render(); this.dropdown.position(this.$dropdown, $container); var ResultsAdapter = this.options.get('resultsAdapter'); this.results = new ResultsAdapter($element, this.options, this.dataAdapter); this.$results = this.results.render(); this.results.position(this.$results, this.$dropdown); // Bind events var self = this; // Bind the container to all of the adapters this._bindAdapters(); // Register any DOM event handlers this._registerDomEvents(); // Register any internal event handlers this._registerDataEvents(); this._registerSelectionEvents(); this._registerDropdownEvents(); this._registerResultsEvents(); this._registerEvents(); // Set the initial state this.dataAdapter.current(function (initialData) { self.trigger('selection:update', { data: initialData }); }); // Hide the original select $element.addClass('select2-hidden-accessible'); $element.attr('aria-hidden', 'true'); // Synchronize any monitored attributes this._syncAttributes(); $element.data('select2', this); }; Utils.Extend(Select2, Utils.Observable); Select2.prototype._generateId = function ($element) { var id = ''; if ($element.attr('id') != null) { id = $element.attr('id'); } else if ($element.attr('name') != null) { id = $element.attr('name') + '-' + Utils.generateChars(2); } else { id = Utils.generateChars(4); } // Regex to replace special characters with empty string. id = id.replace(/(:|\.|\[|\]|,)/g, ''); id = 'select2-' + id; return id; }; Select2.prototype._placeContainer = function ($container) { $container.insertAfter(this.$element); var width = this._resolveWidth(this.$element, this.options.get('width')); if (width != null) { $container.css('width', width); } }; Select2.prototype._resolveWidth = function ($element, method) { var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; if (method == 'resolve') { var styleWidth = this._resolveWidth($element, 'style'); if (styleWidth != null) { return styleWidth; } return this._resolveWidth($element, 'element'); } if (method == 'element') { var elementWidth = $element.outerWidth(false); if (elementWidth <= 0) { return 'auto'; } return elementWidth + 'px'; } if (method == 'style') { var style = $element.attr('style'); if (typeof(style) !== 'string') { return null; } var attrs = style.split(';'); for (var i = 0, l = attrs.length; i < l; i = i + 1) { // Regex to replace whitespace character with empty string. var attr = attrs[i].replace(/\s/g, ''); var matches = attr.match(WIDTH); if (matches !== null && matches.length >= 1) { return matches[1]; } } return null; } return method; }; Select2.prototype._bindAdapters = function () { this.dataAdapter.bind(this, this.$container); this.selection.bind(this, this.$container); this.dropdown.bind(this, this.$container); this.results.bind(this, this.$container); }; Select2.prototype._registerDomEvents = function () { var self = this; this.$element.on('change.select2', function () { self.dataAdapter.current(function (data) { self.trigger('selection:update', { data: data }); }); }); this.$element.on('focus.select2', function (evt) { self.trigger('focus', evt); }); this._syncA = Utils.bind(this._syncAttributes, this); this._syncS = Utils.bind(this._syncSubtree, this); if (this.$element[0].attachEvent) { this.$element[0].attachEvent('onpropertychange', this._syncA); } var observer = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver ; if (observer != null) { this._observer = new observer(function (mutations) { $.each(mutations, self._syncA); $.each(mutations, self._syncS); }); this._observer.observe(this.$element[0], { attributes: true, childList: true, subtree: false }); } else if (this.$element[0].addEventListener) { this.$element[0].addEventListener( 'DOMAttrModified', self._syncA, false ); this.$element[0].addEventListener( 'DOMNodeInserted', self._syncS, false ); this.$element[0].addEventListener( 'DOMNodeRemoved', self._syncS, false ); } }; Select2.prototype._registerDataEvents = function () { var self = this; this.dataAdapter.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerSelectionEvents = function () { var self = this; var nonRelayEvents = ['toggle', 'focus']; this.selection.on('toggle', function () { self.toggleDropdown(); }); this.selection.on('focus', function (params) { self.focus(params); }); this.selection.on('*', function (name, params) { if ($.inArray(name, nonRelayEvents) !== -1) { return; } self.trigger(name, params); }); }; Select2.prototype._registerDropdownEvents = function () { var self = this; this.dropdown.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerResultsEvents = function () { var self = this; this.results.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerEvents = function () { var self = this; this.on('open', function () { self.$container.addClass('select2-container--open'); }); this.on('close', function () { self.$container.removeClass('select2-container--open'); }); this.on('enable', function () { self.$container.removeClass('select2-container--disabled'); }); this.on('disable', function () { self.$container.addClass('select2-container--disabled'); }); this.on('blur', function () { self.$container.removeClass('select2-container--focus'); }); this.on('query', function (params) { if (!self.isOpen()) { self.trigger('open', {}); } this.dataAdapter.query(params, function (data) { self.trigger('results:all', { data: data, query: params }); }); }); this.on('query:append', function (params) { this.dataAdapter.query(params, function (data) { self.trigger('results:append', { data: data, query: params }); }); }); this.on('keypress', function (evt) { var key = evt.which; if (self.isOpen()) { if (key === KEYS.ESC || key === KEYS.TAB || (key === KEYS.UP && evt.altKey)) { self.close(); evt.preventDefault(); } else if (key === KEYS.ENTER) { self.trigger('results:select', {}); evt.preventDefault(); } else if ((key === KEYS.SPACE && evt.ctrlKey)) { self.trigger('results:toggle', {}); evt.preventDefault(); } else if (key === KEYS.UP) { self.trigger('results:previous', {}); evt.preventDefault(); } else if (key === KEYS.DOWN) { self.trigger('results:next', {}); evt.preventDefault(); } } else { if (key === KEYS.ENTER || key === KEYS.SPACE || (key === KEYS.DOWN && evt.altKey)) { self.open(); evt.preventDefault(); } } }); }; Select2.prototype._syncAttributes = function () { this.options.set('disabled', this.$element.prop('disabled')); if (this.options.get('disabled')) { if (this.isOpen()) { this.close(); } this.trigger('disable', {}); } else { this.trigger('enable', {}); } }; Select2.prototype._syncSubtree = function (evt, mutations) { var changed = false; var self = this; // Ignore any mutation events raised for elements that aren't options or // optgroups. This handles the case when the select element is destroyed if ( evt && evt.target && ( evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' ) ) { return; } if (!mutations) { // If mutation events aren't supported, then we can only assume that the // change affected the selections changed = true; } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { for (var n = 0; n < mutations.addedNodes.length; n++) { var node = mutations.addedNodes[n]; if (node.selected) { changed = true; } } } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { changed = true; } // Only re-pull the data if we think there is a change if (changed) { this.dataAdapter.current(function (currentData) { self.trigger('selection:update', { data: currentData }); }); } }; /** * Override the trigger method to automatically trigger pre-events when * there are events that can be prevented. */ Select2.prototype.trigger = function (name, args) { var actualTrigger = Select2.__super__.trigger; var preTriggerMap = { 'open': 'opening', 'close': 'closing', 'select': 'selecting', 'unselect': 'unselecting' }; if (args === undefined) { args = {}; } if (name in preTriggerMap) { var preTriggerName = preTriggerMap[name]; var preTriggerArgs = { prevented: false, name: name, args: args }; actualTrigger.call(this, preTriggerName, preTriggerArgs); if (preTriggerArgs.prevented) { args.prevented = true; return; } } actualTrigger.call(this, name, args); }; Select2.prototype.toggleDropdown = function () { if (this.options.get('disabled')) { return; } if (this.isOpen()) { this.close(); } else { this.open(); } }; Select2.prototype.open = function () { if (this.isOpen()) { return; } this.trigger('query', {}); }; Select2.prototype.close = function () { if (!this.isOpen()) { return; } this.trigger('close', {}); }; Select2.prototype.isOpen = function () { return this.$container.hasClass('select2-container--open'); }; Select2.prototype.hasFocus = function () { return this.$container.hasClass('select2-container--focus'); }; Select2.prototype.focus = function (data) { // No need to re-trigger focus events if we are already focused if (this.hasFocus()) { return; } this.$container.addClass('select2-container--focus'); this.trigger('focus', {}); }; Select2.prototype.enable = function (args) { if (this.options.get('debug') && window.console && console.warn) { console.warn( 'Select2: The `select2("enable")` method has been deprecated and will' + ' be removed in later Select2 versions. Use $element.prop("disabled")' + ' instead.' ); } if (args == null || args.length === 0) { args = [true]; } var disabled = !args[0]; this.$element.prop('disabled', disabled); }; Select2.prototype.data = function () { if (this.options.get('debug') && arguments.length > 0 && window.console && console.warn) { console.warn( 'Select2: Data can no longer be set using `select2("data")`. You ' + 'should consider setting the value instead using `$element.val()`.' ); } var data = []; this.dataAdapter.current(function (currentData) { data = currentData; }); return data; }; Select2.prototype.val = function (args) { if (this.options.get('debug') && window.console && console.warn) { console.warn( 'Select2: The `select2("val")` method has been deprecated and will be' + ' removed in later Select2 versions. Use $element.val() instead.' ); } if (args == null || args.length === 0) { return this.$element.val(); } var newVal = args[0]; if (Array.isArray(newVal)) { newVal = $.map(newVal, function (obj) { return obj.toString(); }); } this.$element.val(newVal).trigger('change'); }; Select2.prototype.destroy = function () { this.$container.remove(); if (this.$element[0].detachEvent) { this.$element[0].detachEvent('onpropertychange', this._syncA); } if (this._observer != null) { this._observer.disconnect(); this._observer = null; } else if (this.$element[0].removeEventListener) { this.$element[0] .removeEventListener('DOMAttrModified', this._syncA, false); this.$element[0] .removeEventListener('DOMNodeInserted', this._syncS, false); this.$element[0] .removeEventListener('DOMNodeRemoved', this._syncS, false); } this._syncA = null; this._syncS = null; this.$element.off('.select2'); this.$element.attr('tabindex', this.$element.data('old-tabindex')); this.$element.removeClass('select2-hidden-accessible'); this.$element.attr('aria-hidden', 'false'); this.$element.removeData('select2'); this.dataAdapter.destroy(); this.selection.destroy(); this.dropdown.destroy(); this.results.destroy(); this.dataAdapter = null; this.selection = null; this.dropdown = null; this.results = null; }; Select2.prototype.render = function () { var $container = $( '<span class="select2 select2-container">' + '<span class="selection"></span>' + '<span class="dropdown-wrapper" aria-hidden="true"></span>' + '</span>' ); $container.attr('dir', this.options.get('dir')); this.$container = $container; this.$container.addClass('select2-container--' + this.options.get('theme')); $container.data('element', this.$element); return $container; }; return Select2; }); S2.define('jquery-mousewheel',[ 'jquery' ], function ($) { // Used to shim jQuery.mousewheel for non-full builds. return $; }); S2.define('jquery.select2',[ 'jquery', 'jquery-mousewheel', './select2/core', './select2/defaults' ], function ($, _, Select2, Defaults) { if ($.fn.select2 == null) { // All methods that should return the element var thisMethods = ['open', 'close', 'destroy']; $.fn.select2 = function (options) { options = options || {}; if (typeof options === 'object') { this.each(function () { var instanceOptions = $.extend(true, {}, options); var instance = new Select2($(this), instanceOptions); }); return this; } else if (typeof options === 'string') { var ret; var args = Array.prototype.slice.call(arguments, 1); this.each(function () { var instance = $(this).data('select2'); if (instance == null && window.console && console.error) { console.error( 'The select2(\'' + options + '\') method was called on an ' + 'element that is not using Select2.' ); } ret = instance[options].apply(instance, args); }); // Check if we should be returning `this` if ($.inArray(options, thisMethods) > -1) { return this; } return ret; } else { throw new Error('Invalid arguments for Select2: ' + options); } }; } if ($.fn.select2.defaults == null) { $.fn.select2.defaults = Defaults; } return Select2; }); // Return the AMD loader configuration so it can be used outside of this file return { define: S2.define, require: S2.require }; }()); // Autoload the jQuery bindings // We know that all of the modules exist above this, so we're safe var select2 = S2.require('jquery.select2'); // Hold the AMD module references on the jQuery function that was just loaded // This allows Select2 to use the internal loader outside of this file, such // as in the language files. jQuery.fn.select2.amd = S2; // Return the Select2 instance for anyone who is importing it. return select2; })); modules/target-rule/target-rule.css 0000644 00000005346 15150261777 0013437 0 ustar 00 /* Select2 */ .post-type-astra_adv_header span.select2.select2-container.select2-container--default, .post-type-astra-advanced-hook span.select2.select2-container.select2-container--default { margin-top: 0; } .post-type-astra_adv_header li.select2-results__option.select2-results__message, .post-type-astra-advanced-hook li.select2-results__option.select2-results__message { background: #ecebeb; margin-bottom: 0; } .ast-target-rule-wrapper .select2-container { display: inline-block; position: relative; vertical-align: middle; width: 100% !important; } .ast-target-rule-wrapper .select2-container--default.select2-container--focus .select2-selection--multiple, .ast-target-rule-wrapper .select2-container--default .select2-selection--multiple { border: 1px solid #ddd; margin-top: 10px; } .ast-target-rule-wrapper .select2-container .select2-search--inline, .ast-target-rule-wrapper .select2-container--default .select2-search--inline .select2-search__field { width: 100% !important; } /* Target Rule field */ .astra-target-rule-condition, .astra-user-role-condition { position: relative; padding: 0 30px 0 0; margin-top: 10px; } .target_rule-specific-page-wrap { position: relative; padding: 0 30px 0 0; } .user_role-add-rule-wrap, .target_rule-add-rule-wrap, .target_rule-add-exclusion-rule, .user_role-add-rule-wrap { margin-top: 15px; } .ast-target-rule-display-on, .ast-target-rule-exclude-on { margin-bottom: 10px; } .target_rule-condition-delete, .user_role-condition-delete { position: absolute; color: #999; right: 0px; top: 0px; font-size: 18px; line-height: 18px; width: 18px; height: 18px; display: inline-block; cursor: pointer; top: 50%; transform: translateY(-50%); } .target_rule-condition-delete:hover { color: #d54e21; } .target_rule-add-rule-wrap { display: inline-block; } .target_rule-add-exclusion-rule { display: inline-block; margin-left: 10px; } .configure-content [data-element="exclude_from"], .configure-content [data-element="exclusive_on"] { padding-bottom: 0; } .configure-content .ast-allow-specific-posts input, .configure-content .ast-post-types { margin-right: 3px; } .hide-on-devices input[type=checkbox] { margin-right: 5px; } .search-panel.search-close-icon { pointer-events: auto; cursor: pointer; } .ast-hidden { display: none !important; } .select2-selection .select2-selection__choice__remove { float: right; margin: 0px 2px 2px 3px; } .select2-container--default .select2-selection--multiple .select2-selection__choice{ padding: 0 3px 0 5px; } modules/target-rule/target-rule.js 0000644 00000017404 15150261777 0013261 0 ustar 00 ;(function ( $, window, undefined ) { var init_target_rule_select2 = function( selector ) { $(selector).astselect2({ placeholder: astRules.search, ajax: { url: ajaxurl, dataType: 'json', method: 'post', delay: 250, data: function (params) { return { q: params.term, // search term page: params.page, action: 'astra_get_posts_by_query', 'nonce': astRules.ajax_nonce, }; }, processResults: function (data) { // console.log(data); // console.log("inside"); // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to // alter the remote JSON data return { results: data }; }, cache: true }, minimumInputLength: 2, language: astRules.ast_lang }); }; var update_target_rule_input = function(wrapper) { var rule_input = wrapper.find('.ast-target_rule-input'); var old_value = rule_input.val(); var new_value = []; wrapper.find('.astra-target-rule-condition').each(function(i) { var $this = $(this); var temp_obj = {}; var rule_condition = $this.find('select.target_rule-condition'); var specific_page = $this.find('select.target_rule-specific-page'); var rule_condition_val = rule_condition.val(); var specific_page_val = specific_page.val(); if ( '' != rule_condition_val ) { temp_obj = { type : rule_condition_val, specific: specific_page_val } new_value.push( temp_obj ); }; }) var rules_string = JSON.stringify( new_value ); rule_input.val( rules_string ); }; var update_close_button = function(wrapper) { type = wrapper.closest('.ast-target-rule-wrapper').attr('data-type'); rules = wrapper.find('.astra-target-rule-condition'); show_close = false; if ( 'display' == type ) { if ( rules.length > 1 ) { show_close = true; } }else{ show_close = true; } rules.each(function() { if ( show_close ) { jQuery(this).find('.target_rule-condition-delete').removeClass('ast-hidden'); }else{ jQuery(this).find('.target_rule-condition-delete').addClass('ast-hidden'); } }); }; var update_exclusion_button = function( force_show, force_hide ) { var display_on = $('.ast-target-rule-display-on-wrap'); var exclude_on = $('.ast-target-rule-exclude-on-wrap'); var exclude_field_wrap = exclude_on.closest('tr'); var add_exclude_block = display_on.find('.target_rule-add-exclusion-rule'); var exclude_conditions = exclude_on.find('.astra-target-rule-condition'); if ( true == force_hide ) { exclude_field_wrap.addClass( 'ast-hidden' ); add_exclude_block.removeClass( 'ast-hidden' ); }else if( true == force_show ){ exclude_field_wrap.removeClass( 'ast-hidden' ); add_exclude_block.addClass( 'ast-hidden' ); }else{ if ( 1 == exclude_conditions.length && '' == $(exclude_conditions[0]).find('select.target_rule-condition').val() ) { exclude_field_wrap.addClass( 'ast-hidden' ); add_exclude_block.removeClass( 'ast-hidden' ); }else{ exclude_field_wrap.removeClass( 'ast-hidden' ); add_exclude_block.addClass( 'ast-hidden' ); } } }; $(document).ready(function($) { jQuery( '.astra-target-rule-condition' ).each( function() { var $this = $( this ), condition = $this.find('select.target_rule-condition'), condition_val = condition.val(), specific_page = $this.next( '.target_rule-specific-page-wrap' ); if( 'specifics' == condition_val ) { specific_page.slideDown( 300 ); } } ); jQuery('select.target-rule-select2').each(function(index, el) { init_target_rule_select2( el ); }); jQuery('.ast-target-rule-selector-wrapper').each(function() { update_close_button( jQuery(this) ); }) /* Show hide exclusion button */ update_exclusion_button(); jQuery( document ).on( 'change', '.astra-target-rule-condition select.target_rule-condition' , function( e ) { var $this = jQuery(this), this_val = $this.val(), field_wrap = $this.closest('.ast-target-rule-wrapper'); if( 'specifics' == this_val ) { $this.closest( '.astra-target-rule-condition' ).next( '.target_rule-specific-page-wrap' ).slideDown( 300 ); } else { $this.closest( '.astra-target-rule-condition' ).next( '.target_rule-specific-page-wrap' ).slideUp( 300 ); } update_target_rule_input( field_wrap ); } ); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'change', '.target-rule-select2', function(e) { var $this = jQuery( this ), field_wrap = $this.closest('.ast-target-rule-wrapper'); update_target_rule_input( field_wrap ); }); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'click', '.target_rule-add-rule-wrap a', function(e) { e.preventDefault(); e.stopPropagation(); var $this = jQuery( this ), id = $this.attr( 'data-rule-id' ), new_id = parseInt(id) + 1, type = $this.attr( 'data-rule-type' ), rule_wrap = $this.closest('.ast-target-rule-selector-wrapper').find('.target_rule-builder-wrap'), template = wp.template( 'astra-target-rule-' + type + '-condition' ), field_wrap = $this.closest('.ast-target-rule-wrapper'); rule_wrap.append( template( { id : new_id, type : type } ) ); init_target_rule_select2( '.ast-target-rule-'+type+'-on .target-rule-select2' ); $this.attr( 'data-rule-id', new_id ); update_close_button( field_wrap ); }); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'click', '.target_rule-condition-delete', function(e) { var $this = jQuery( this ), rule_condition = $this.closest('.astra-target-rule-condition'), field_wrap = $this.closest('.ast-target-rule-wrapper'); cnt = 0, data_type = field_wrap.attr( 'data-type' ), optionVal = $this.siblings('.target_rule-condition-wrap').children('.target_rule-condition').val(); if ( 'exclude' == data_type ) { if ( 1 === field_wrap.find('.target_rule-condition').length ) { field_wrap.find('.target_rule-condition').val(''); field_wrap.find('.target_rule-specific-page').val(''); field_wrap.find('.target_rule-condition').trigger('change'); update_exclusion_button( false, true ); }else{ $this.parent('.astra-target-rule-condition').next('.target_rule-specific-page-wrap').remove(); rule_condition.remove(); } } else { $this.parent('.astra-target-rule-condition').next('.target_rule-specific-page-wrap').remove(); rule_condition.remove(); } field_wrap.find('.astra-target-rule-condition').each(function(i) { var condition = jQuery( this ), old_rule_id = condition.attr('data-rule'), select_location = condition.find('.target_rule-condition'), select_specific = condition.find('.target_rule-specific-page'), location_name = select_location.attr( 'name' ); condition.attr( 'data-rule', i ); select_location.attr( 'name', location_name.replace('['+old_rule_id+']', '['+i+']') ); condition.removeClass('ast-target-rule-'+old_rule_id).addClass('ast-target-rule-'+i); cnt = i; }); field_wrap.find('.target_rule-add-rule-wrap a').attr( 'data-rule-id', cnt ) update_close_button( field_wrap ); update_target_rule_input( field_wrap ); }); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'click', '.target_rule-add-exclusion-rule a', function(e) { e.preventDefault(); e.stopPropagation(); update_exclusion_button( true ); }); }); }(jQuery, window)); modules/target-rule/user-role.js 0000644 00000004752 15150261777 0012745 0 ustar 00 ;(function ( $, window, undefined ) { var user_role_update_close_button = function(wrapper) { type = wrapper.closest('.ast-user-role-wrapper').attr('data-type'); rules = wrapper.find('.astra-user-role-condition'); show_close = false; if ( rules.length > 1 ) { show_close = true; } rules.each(function() { if ( show_close ) { jQuery(this).find('.user_role-condition-delete').removeClass('ast-hidden'); }else{ jQuery(this).find('.user_role-condition-delete').addClass('ast-hidden'); } }); }; $(document).ready(function($) { jQuery('.ast-user-role-selector-wrapper').each(function() { user_role_update_close_button( jQuery(this) ); }) jQuery( '.ast-user-role-selector-wrapper' ).on( 'click', '.user_role-add-rule-wrap a', function(e) { e.preventDefault(); e.stopPropagation(); var $this = jQuery( this ), id = $this.attr( 'data-rule-id' ), new_id = parseInt(id) + 1, rule_wrap = $this.closest('.ast-user-role-selector-wrapper').find('.user_role-builder-wrap'), template = wp.template( 'astra-user-role-condition' ), field_wrap = $this.closest('.ast-user-role-wrapper'); rule_wrap.append( template( { id : new_id } ) ); $this.attr( 'data-rule-id', new_id ); user_role_update_close_button( field_wrap ); }); jQuery( '.ast-user-role-selector-wrapper' ).on( 'click', '.user_role-condition-delete', function(e) { var $this = jQuery( this ), rule_condition = $this.closest('.astra-user-role-condition'), field_wrap = $this.closest('.ast-user-role-wrapper'); cnt = 0, data_type = field_wrap.attr( 'data-type' ), optionVal = $this.siblings('.user_role-condition-wrap').children('.user_role-condition').val(); rule_condition.remove(); field_wrap.find('.astra-user-role-condition').each(function(i) { var condition = jQuery( this ), old_rule_id = condition.attr('data-rule'), select_location = condition.find('.user_role-condition'), location_name = select_location.attr( 'name' ); condition.attr( 'data-rule', i ); select_location.attr( 'name', location_name.replace('['+old_rule_id+']', '['+i+']') ); condition.removeClass('ast-user-role-'+old_rule_id).addClass('ast-user-role-'+i); cnt = i; }); field_wrap.find('.user_role-add-rule-wrap a').attr( 'data-rule-id', cnt ) user_role_update_close_button( field_wrap ); }); }); }(jQuery, window)); astra-addon-extended-functionality.php 0000644 00000005777 15150261777 0014171 0 ustar 00 <?php /** * Astra Addon BSF & WP-Com package extended functionality. * * In this file as per WooCommerce.com standards we manipulated following things - * 1. Deprecation of Code editor due to usage of * i) eval() * ii) echo $php_snippet; * 2. Removed modern checkout layout's easy login due to $_POST['password'] sanitization case. * * @package Astra Addon * @since 4.1.1 */ /** * Check if code editor custom layout enabled. * * @param int $post_id Post Id. * @return boolean * @since 4.1.5 */ function astra_addon_is_code_editor_layout( $post_id ) { $php_enabled = get_post_meta( $post_id, 'editor_type', true ); if ( 'code_editor' === $php_enabled ) { return true; } return false; } /** * Get PHP snippet if enabled. * * @param int $post_id Post Id. * @return boolean|html * @since 4.1.1 */ function astra_addon_get_php_snippet( $post_id ) { $code = get_post_meta( $post_id, 'ast-advanced-hook-php-code', true ); if ( defined( 'ASTRA_ADVANCED_HOOKS_DISABLE_PHP' ) ) { return $code; } ob_start(); // @codingStandardsIgnoreStart eval( '?>' . $code . '<?php ' ); // phpcs:ignore Squiz.PHP.Eval.Discouraged -- Ignored PHP standards to execute PHP code snipett. // @codingStandardsIgnoreEnd return ob_get_clean(); } /** * Echo PHP snippet if enabled. * * @param int $post_id Post Id. * @since 4.1.1 */ function astra_addon_echo_php_snippet( $post_id ) { if ( astra_addon_is_code_editor_layout( $post_id ) ) { $php_snippet = astra_addon_get_php_snippet( $post_id ); echo $php_snippet; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } /** * Check email exist. * * @since 3.9.0 */ function astra_addon_woocommerce_login_user() { check_ajax_referer( 'woocommerce-login', 'security' ); $response = array( 'success' => false, ); $user_name_email = isset( $_POST['user_name_email'] ) ? sanitize_text_field( wp_unslash( $_POST['user_name_email'] ) ) : false; $password = isset( $_POST['password'] ) ? wp_unslash( $_POST['password'] ) : false; // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $selected_user_name_email = ''; if ( filter_var( $user_name_email, FILTER_VALIDATE_EMAIL ) ) { $selected_user_name_email = sanitize_email( $user_name_email ); } else { $selected_user_name_email = $user_name_email; } $creds = array( 'user_login' => $selected_user_name_email, 'user_password' => $password, 'remember' => false, ); $user = wp_signon( $creds, false ); if ( ! is_wp_error( $user ) ) { $response = array( 'success' => true, ); } else { $response['error'] = wp_kses_post( $user->get_error_message() ); } wp_send_json_success( $response ); } // Login user on modern checkout layout. add_action( 'wp_ajax_astra_woocommerce_login_user', 'astra_addon_woocommerce_login_user' ); add_action( 'wp_ajax_nopriv_astra_woocommerce_login_user', 'astra_addon_woocommerce_login_user' ); astra-addon-update-functions.php 0000644 00000057655 15150261777 0012775 0 ustar 00 <?php /** * Astra Addon Updates * * Functions for updating data, used by the background updater. * * @package Astra Addon * @version 2.1.3 */ defined( 'ABSPATH' ) || exit; /** * Do not apply new default colors to the Elementor & Gutenberg Buttons for existing users. * * @since 2.1.4 * * @return void */ function astra_addon_page_builder_button_color_compatibility() { $theme_options = get_option( 'astra-settings', array() ); // Set flag to not load button specific CSS. if ( ! isset( $theme_options['pb-button-color-compatibility-addon'] ) ) { $theme_options['pb-button-color-compatibility-addon'] = false; error_log( 'Astra Addon: Page Builder button compatibility: false' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log update_option( 'astra-settings', $theme_options ); } } /** * Apply Desktop + Mobile to parallax device. * * @since 2.3.0 * * @return bool */ function astra_addon_page_header_parallax_device() { $posts = get_posts( array( 'post_type' => 'astra_adv_header', 'numberposts' => -1, ) ); foreach ( $posts as $post ) { $ids = $post->ID; if ( false == $ids ) { return false; } $settings = get_post_meta( $ids, 'ast-advanced-headers-design', true ); if ( isset( $settings['parallax'] ) && $settings['parallax'] ) { $settings['parallax-device'] = 'both'; } else { $settings['parallax-device'] = 'none'; } update_post_meta( $ids, 'ast-advanced-headers-design', $settings ); } } /** * Migrate option data from Content background option to its desktop counterpart. * * @since 2.4.0 * * @return void */ function astra_responsive_content_background_option() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $theme_options = get_option( 'astra-settings', array() ); if ( false === get_option( 'content-bg-obj-responsive', false ) && isset( $theme_options['content-bg-obj'] ) ) { $theme_options['content-bg-obj-responsive']['desktop'] = $theme_options['content-bg-obj']; $theme_options['content-bg-obj-responsive']['tablet'] = array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', ); $theme_options['content-bg-obj-responsive']['mobile'] = array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', ); } update_option( 'astra-settings', $theme_options ); } /** * Migrate multisite css file generation option to sites indiviually. * * @since 2.3.3 * * @return void */ function astra_addon_css_gen_multi_site_fix() { if ( is_multisite() ) { $is_css_gen_enabled = get_site_option( '_astra_file_generation', 'disable' ); if ( 'enable' === $is_css_gen_enabled ) { update_option( '_astra_file_generation', $is_css_gen_enabled ); error_log( 'Astra Addon: CSS file generation: enable' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log } } } /** * Check if we need to change the default value for tablet breakpoint. * * @since 2.4.0 * @return void */ function astra_addon_update_theme_tablet_breakpoint() { $theme_options = get_option( 'astra-settings' ); if ( ! isset( $theme_options['can-update-addon-tablet-breakpoint'] ) ) { // Set a flag to check if we need to change the addon tablet breakpoint value. $theme_options['can-update-addon-tablet-breakpoint'] = false; } update_option( 'astra-settings', $theme_options ); } /** * Apply missing editor_type post meta to having code enabled custom layout posts. * * @since 2.5.0 * * @return bool */ function custom_layout_compatibility_having_code_posts() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $posts = get_posts( array( 'post_type' => 'astra-advanced-hook', 'numberposts' => -1, ) ); foreach ( $posts as $post ) { $post_id = $post->ID; if ( ! $post_id ) { return; } $post_with_code_editor = get_post_meta( $post_id, 'ast-advanced-hook-with-php', true ); if ( isset( $post_with_code_editor ) && 'enabled' === $post_with_code_editor ) { update_post_meta( $post_id, 'editor_type', 'code_editor' ); } else { update_post_meta( $post_id, 'editor_type', 'wordpress_editor' ); } } } /** * Added new submenu color options for Page Headers. * * @since 2.5.0 * * @return bool */ function astra_addon_page_header_submenu_color_options() { $posts = get_posts( array( 'post_type' => 'astra_adv_header', 'numberposts' => -1, ) ); foreach ( $posts as $post ) { $id = $post->ID; if ( false == $id ) { return false; } $settings = get_post_meta( $id, 'ast-advanced-headers-design', true ); if ( ( isset( $settings['primary-menu-h-color'] ) && $settings['primary-menu-h-color'] ) && ! isset( $settings['primary-menu-a-color'] ) ) { $settings['primary-menu-a-color'] = $settings['primary-menu-h-color']; } if ( ( isset( $settings['above-header-h-color'] ) && $settings['above-header-h-color'] ) && ! isset( $settings['above-header-a-color'] ) ) { $settings['above-header-a-color'] = $settings['above-header-h-color']; } if ( ( isset( $settings['below-header-h-color'] ) && $settings['below-header-h-color'] ) && ! isset( $settings['below-header-a-color'] ) ) { $settings['below-header-a-color'] = $settings['below-header-h-color']; } update_post_meta( $id, 'ast-advanced-headers-design', $settings ); } } /** * Manage flags & run backward compatibility process for following cases. * * 1. Sticky header inheriting colors in normal headers as well. * * @since 2.6.0 * @return void */ function astra_addon_header_css_optimizations() { $theme_options = get_option( 'astra-settings' ); if ( ! isset( $theme_options['can-inherit-sticky-colors-in-header'] ) && ( ( isset( $theme_options['header-above-stick'] ) && $theme_options['header-above-stick'] ) || ( isset( $theme_options['header-main-stick'] ) && $theme_options['header-main-stick'] ) || ( isset( $theme_options['header-below-stick'] ) && $theme_options['header-below-stick'] ) ) && ( ( ( isset( $theme_options['sticky-above-header-megamenu-heading-color'] ) && '' !== $theme_options['sticky-above-header-megamenu-heading-color'] ) || ( isset( $theme_options['sticky-above-header-megamenu-heading-h-color'] ) && '' !== $theme_options['sticky-above-header-megamenu-heading-h-color'] ) ) || ( ( isset( $theme_options['sticky-primary-header-megamenu-heading-color'] ) && '' !== $theme_options['sticky-primary-header-megamenu-heading-color'] ) || ( isset( $theme_options['sticky-primary-header-megamenu-heading-h-color'] ) && '' !== $theme_options['sticky-primary-header-megamenu-heading-h-color'] ) ) || ( ( isset( $theme_options['sticky-below-header-megamenu-heading-color'] ) && '' !== $theme_options['sticky-below-header-megamenu-heading-color'] ) || ( isset( $theme_options['sticky-below-header-megamenu-heading-h-color'] ) && '' !== $theme_options['sticky-below-header-megamenu-heading-h-color'] ) ) ) ) { // Set a flag to inherit sticky colors in the normal header as well. $theme_options['can-inherit-sticky-colors-in-header'] = true; } update_option( 'astra-settings', $theme_options ); } /** * Page Header's color options compatibility with new Header builder layout. * * @since 3.5.0 * @return void */ function astra_addon_page_headers_support_to_builder_layout() { $theme_options = get_option( 'astra-settings' ); if ( ! isset( $theme_options['can-update-page-header-compatibility-to-header-builder'] ) ) { // Set a flag to avoid direct changes on frontend. $theme_options['can-update-page-header-compatibility-to-header-builder'] = true; } update_option( 'astra-settings', $theme_options ); } /** * Do not apply new font-weight heading support CSS in editor/frontend directly. * * 1. Adding Font-weight support to widget titles. * 2. Customizer font CSS not supporting in editor. * * @since 3.5.1 * * @return void */ function astra_addon_headings_font_support() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['can-support-widget-and-editor-fonts'] ) ) { $theme_options['can-support-widget-and-editor-fonts'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Cart color not working in old header > cart widget. As this change can reflect on frontend directly, adding this backward compatibility. * * @since 3.5.1 * @return void */ function astra_addon_cart_color_not_working_in_old_header() { $theme_options = get_option( 'astra-settings' ); if ( ! isset( $theme_options['can-reflect-cart-color-in-old-header'] ) ) { // Set a flag to avoid direct changes on frontend. $theme_options['can-reflect-cart-color-in-old-header'] = false; } update_option( 'astra-settings', $theme_options ); } /** * Till now "Header Sections" addon has dependency conflict with new header builder, unless & until this addon activate dynamic CSS does load for new header layouts. * As we deprecate "Header Sections" for new header builder layout, conflict appears here. * * Adding backward compatibility as changes can directly reflect on frontend. * * @since 3.5.7 * @return void */ function astra_addon_remove_header_sections_deps_new_builder() { $theme_options = get_option( 'astra-settings' ); if ( ! isset( $theme_options['remove-header-sections-deps-in-new-header'] ) ) { // Set a flag to avoid direct changes on frontend. $theme_options['remove-header-sections-deps-in-new-header'] = false; } update_option( 'astra-settings', $theme_options ); } /** * In old header for Cart widget we have background: #ffffff; for outline cart, whereas this CSS missed in new HFB > Cart element. Adding it now as per support requests. This case is only for new header builder > WooCommerce cart. * * @since 3.5.7 * @return void */ function astra_addon_outline_cart_bg_color_support() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['add-outline-cart-bg-new-header'] ) ) { $theme_options['add-outline-cart-bg-new-header'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Swap section on Mobile Device not working in old header. As this change can reflect on frontend directly, adding this backward compatibility. * * @since 3.5.7 * @return void */ function astra_addon_swap_section_not_working_in_old_header() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['support-swap-mobile-header-sections'] ) ) { $theme_options['support-swap-mobile-header-sections'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Do not apply default header site title and tag line color to sticky header for existing users. * * @since 3.5.8 * * @return void */ function astra_sticky_header_site_title_tagline_css() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['sticky-header-default-site-title-tagline-css'] ) ) { $theme_options['sticky-header-default-site-title-tagline-css'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Migrating Builder > Account > resonsive menu color options to single color options. * Because we do not show menu on resonsive devices, whereas we trigger login link on responsive devices instead of showing menu. * * @since 3.5.9 * * @return void */ function astra_addon_remove_responsive_account_menu_colors_support() { $theme_options = get_option( 'astra-settings', array() ); $account_menu_colors = array( 'header-account-menu-color', // Menu color. 'header-account-menu-h-color', // Menu hover color. 'header-account-menu-a-color', // Menu active color. 'header-account-menu-bg-obj', // Menu background color. 'header-account-menu-h-bg-color', // Menu background hover color. 'header-account-menu-a-bg-color', // Menu background active color. 'sticky-header-account-menu-color', // Sticky menu color. 'sticky-header-account-menu-h-color', // Sticky menu hover color. 'sticky-header-account-menu-a-color', // Sticky menu active color. 'sticky-header-account-menu-bg-obj', // Sticky menu background color. 'sticky-header-account-menu-h-bg-color', // Sticky menu background hover color. 'sticky-header-account-menu-a-bg-color', // Sticky menu background active color. ); foreach ( $account_menu_colors as $color_option ) { if ( ! isset( $theme_options[ $color_option ] ) && isset( $theme_options[ $color_option . '-responsive' ]['desktop'] ) ) { $theme_options[ $color_option ] = $theme_options[ $color_option . '-responsive' ]['desktop']; } } update_option( 'astra-settings', $theme_options ); } /** * Check if old user and keep the existing product gallery layouts. * * @since 3.9.0 * @return void */ function astra_addon_update_product_gallery_layout() { $theme_options = get_option( 'astra-settings' ); if ( ! isset( $theme_options['astra-product-gallery-layout-flag'] ) ) { $theme_options['astra-product-gallery-layout-flag'] = false; } update_option( 'astra-settings', $theme_options ); } /** * Migrate old user data to new responsive format for shop's cart button padding. * * @since 3.9.0 * @return void */ function astra_addon_responsive_shop_button_padding() { $theme_options = get_option( 'astra-settings', array() ); $vertical_button_padding = isset( $theme_options['shop-button-v-padding'] ) ? $theme_options['shop-button-v-padding'] : ''; $horizontal_button_padding = isset( $theme_options['shop-button-h-padding'] ) ? $theme_options['shop-button-h-padding'] : ''; if ( ! isset( $theme_options['shop-button-padding'] ) ) { $theme_options['shop-button-padding'] = array( 'desktop' => array( 'top' => $vertical_button_padding, 'right' => $horizontal_button_padding, 'bottom' => $vertical_button_padding, 'left' => $horizontal_button_padding, ), 'tablet' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'mobile' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ); update_option( 'astra-settings', $theme_options ); } } /** * Migrate old box shadow user data to new simplyfy box-shadow controls shop items shadow. * * @since 3.9.0 * @return void */ function astra_addon_shop_box_shadow_migration() { // For shop products box-shadow. $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['shop-item-box-shadow-control'] ) && isset( $theme_options['shop-product-shadow'] ) ) { $normal_shadow_x = ''; $normal_shadow_y = ''; $normal_shadow_blur = ''; $normal_shadow_spread = ''; $normal_shadow_color = 'rgba(0,0,0,.1)'; switch ( $theme_options['shop-product-shadow'] ) { case 1: $normal_shadow_x = '0'; $normal_shadow_y = '1'; $normal_shadow_blur = '3'; $normal_shadow_spread = '-2'; break; case 2: $normal_shadow_x = '0'; $normal_shadow_y = '3'; $normal_shadow_blur = '6'; $normal_shadow_spread = '-5'; break; case 3: $normal_shadow_x = '0'; $normal_shadow_y = '10'; $normal_shadow_blur = '20'; $normal_shadow_spread = ''; break; case 4: $normal_shadow_x = '0'; $normal_shadow_y = '14'; $normal_shadow_blur = '28'; $normal_shadow_spread = ''; break; case 5: $normal_shadow_x = '0'; $normal_shadow_y = '20'; $normal_shadow_blur = '30'; $normal_shadow_spread = '0'; break; default: break; } $theme_options['shop-item-box-shadow-control'] = array( 'x' => $normal_shadow_x, 'y' => $normal_shadow_y, 'blur' => $normal_shadow_blur, 'spread' => $normal_shadow_spread, ); $theme_options['shop-item-box-shadow-position'] = 'outline'; $theme_options['shop-item-box-shadow-color'] = $normal_shadow_color; update_option( 'astra-settings', $theme_options ); } // For shop products hover box-shadow. $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['shop-item-hover-box-shadow-control'] ) && isset( $theme_options['shop-product-shadow-hover'] ) ) { $normal_shadow_x = ''; $normal_shadow_y = ''; $normal_shadow_blur = ''; $normal_shadow_spread = ''; $normal_shadow_color = 'rgba(0,0,0,.1)'; switch ( $theme_options['shop-product-shadow-hover'] ) { case 1: $normal_shadow_x = '0'; $normal_shadow_y = '1'; $normal_shadow_blur = '3'; $normal_shadow_spread = '-2'; break; case 2: $normal_shadow_x = '0'; $normal_shadow_y = '3'; $normal_shadow_blur = '6'; $normal_shadow_spread = '-5'; break; case 3: $normal_shadow_x = '0'; $normal_shadow_y = '10'; $normal_shadow_blur = '20'; $normal_shadow_spread = ''; break; case 4: $normal_shadow_x = '0'; $normal_shadow_y = '14'; $normal_shadow_blur = '28'; $normal_shadow_spread = ''; break; case 5: $normal_shadow_x = '0'; $normal_shadow_y = '20'; $normal_shadow_blur = '30'; $normal_shadow_spread = '0'; break; default: break; } $theme_options['shop-item-hover-box-shadow-control'] = array( 'x' => $normal_shadow_x, 'y' => $normal_shadow_y, 'blur' => $normal_shadow_blur, 'spread' => $normal_shadow_spread, ); $theme_options['shop-item-hover-box-shadow-position'] = 'outline'; $theme_options['shop-item-hover-box-shadow-color'] = $normal_shadow_color; update_option( 'astra-settings', $theme_options ); } } /** * If old user then it keeps then default cart icon. * * @since 3.9.0 * @return void */ function astra_addon_update_woocommerce_cart_icons() { $theme_options = get_option( 'astra-settings' ); if ( ! isset( $theme_options['astra-woocommerce-cart-icons-flag'] ) ) { $theme_options['astra-woocommerce-cart-icons-flag'] = false; update_option( 'astra-settings', $theme_options ); } } /** * If old user then it keeps then default cart icon. * * @since 3.9.0 * @return void */ function astra_addon_update_toolbar_seperations() { $theme_options = get_option( 'astra-settings' ); $shop_toolbar_display = isset( $theme_options['shop-toolbar-display'] ) ? $theme_options['shop-toolbar-display'] : true; if ( ! isset( $theme_options['shop-toolbar-structure'] ) ) { if ( true === $shop_toolbar_display ) { if ( isset( $theme_options['shop-off-canvas-trigger-type'] ) && 'disable' !== $theme_options['shop-off-canvas-trigger-type'] && 'custom-class' !== $theme_options['shop-off-canvas-trigger-type'] ) { $theme_options['shop-toolbar-structure'] = array( 'filters', 'results', 'sorting', ); $theme_options['shop-toolbar-structure-with-hiddenset'] = array( 'filters' => true, 'results' => true, 'sorting' => true, 'easy_view' => false, ); } else { $theme_options['shop-toolbar-structure'] = array( 'results', 'sorting', ); $theme_options['shop-toolbar-structure-with-hiddenset'] = array( 'results' => true, 'filters' => false, 'sorting' => true, 'easy_view' => false, ); } } else { if ( isset( $theme_options['shop-off-canvas-trigger-type'] ) && 'disable' !== $theme_options['shop-off-canvas-trigger-type'] && 'custom-class' !== $theme_options['shop-off-canvas-trigger-type'] ) { $theme_options['shop-toolbar-structure'] = array( 'filters', ); $theme_options['shop-toolbar-structure-with-hiddenset'] = array( 'filters' => true, 'results' => false, 'sorting' => false, 'easy_view' => false, ); } else { $theme_options['shop-toolbar-structure'] = array(); $theme_options['shop-toolbar-structure-with-hiddenset'] = array( 'results' => false, 'filters' => false, 'sorting' => false, 'easy_view' => false, ); } } update_option( 'astra-settings', $theme_options ); } } /** * Restrict direct changes on users end so make it filterable. * * @since 3.9.0 * @return void */ function astra_addon_apply_modern_ecommerce_setup() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['modern-ecommerce-setup'] ) ) { $theme_options['modern-ecommerce-setup'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Improve active/selected variant for WooCommerce single product. * * @since 3.9.3 * @return void */ function astra_addon_update_variant_active_state() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['can-update-variant-active-style'] ) ) { $theme_options['can-update-variant-active-style'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Version 4.0.0 backward handle. * * 1. Migrating Post Structure & Meta options in title area meta parts. * 2. Migrate existing setting & do required onboarding for new admin dashboard v4.0.0 app. * * @since 4.0.0 * @return void */ function astra_addon_background_updater_4_0_0() { // Dynamic customizer migration setup starts here. $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['addon-dynamic-customizer-support'] ) ) { $theme_options['addon-dynamic-customizer-support'] = true; update_option( 'astra-settings', $theme_options ); } // Admin dashboard migration starts here. $admin_dashboard_settings = get_option( 'astra_admin_settings', array() ); if ( ! isset( $admin_dashboard_settings['addon-setup-admin-migrated'] ) ) { // Insert fallback whitelabel icon for agency users to maintain their branding. if ( is_multisite() ) { $branding = get_site_option( '_astra_ext_white_label' ); } else { $branding = get_option( '_astra_ext_white_label' ); } if ( ( isset( $branding['astra-agency']['hide_branding'] ) && true === (bool) $branding['astra-agency']['hide_branding'] ) && ! isset( $branding['astra']['icon'] ) ) { $branding['astra']['icon'] = ASTRA_EXT_URI . 'admin/core/assets/images/whitelabel-branding.svg'; if ( is_multisite() ) { update_site_option( '_astra_ext_white_label', $branding ); } else { update_option( '_astra_ext_white_label', $branding ); } } // Consider admin part from addon side migrated. $admin_dashboard_settings['addon-setup-admin-migrated'] = true; update_option( 'astra_admin_settings', $admin_dashboard_settings ); } } /** * Backward handle for 4.1.0 * * @since 4.1.0 * @return void */ function astra_addon_background_updater_4_1_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['single-product-add-to-cart-action'] ) && isset( $theme_options['single-product-ajax-add-to-cart'] ) ) { $theme_options['single-product-add-to-cart-action'] = 'rt_add_to_cart'; update_option( 'astra-settings', $theme_options ); } } astra-common-dynamic-css.php 0000644 00000054157 15150261777 0012114 0 ustar 00 <?php /** * Astra Addon Common dynamic CSS. * * @package Astra Addon */ if ( Astra_Ext_Extension::is_active( 'blog-pro' ) ) { add_filter( 'astra_addon_dynamic_css', 'astra_addon_blog_pro_dynamic_css', 9 ); } /** * Dynamic CSS for Single Post Author Info-box * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return string */ function astra_addon_blog_pro_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { /** * - Variable Declaration. */ $is_site_rtl = is_rtl(); $css_output = ''; $theme_color = astra_get_option( 'theme-color' ); $link_color = astra_get_option( 'link-color', $theme_color ); $desktop_max_css = array( // Updated before content value to fix the masonry layout issue. '#content:before' => array( 'content' => '"' . astra_addon_get_tablet_breakpoint() . '"', 'position' => 'absolute', 'overflow' => 'hidden', 'opacity' => '0', 'visibility' => 'hidden', ), '.single .ast-author-details .author-title' => array( 'color' => esc_attr( $link_color ), ), ); if ( true === astra_get_option( 'customizer-default-layout-update', true ) ) { $desktop_max_css['.single.ast-page-builder-template .ast-single-author-box'] = array( 'padding' => '2em 20px', ); $desktop_max_css['.single.ast-separate-container .ast-author-meta'] = array( 'padding' => '3em', ); } /* Parse CSS from array() */ $css_output .= astra_parse_css( $desktop_max_css ); $tablet_max_css = array( // Single Post author info. '.single.ast-separate-container .ast-author-meta' => array( 'padding' => '1.5em 2.14em', ), '.single .ast-author-meta .post-author-avatar' => array( 'margin-bottom' => '1em', ), '.ast-separate-container .ast-grid-2 .ast-article-post, .ast-separate-container .ast-grid-3 .ast-article-post, .ast-separate-container .ast-grid-4 .ast-article-post' => array( 'width' => '100%', ), '.blog-layout-1 .post-content, .blog-layout-1 .ast-blog-featured-section' => array( 'float' => 'none', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .square .posted-on' => array( 'margin-top' => 0, ), '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on' => array( 'margin-top' => '1em', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content' => array( 'margin-top' => '-1.5em', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content' => array( 'margin-left' => '-2.14em', 'margin-right' => '-2.14em', ), '.ast-separate-container .ast-article-single.remove-featured-img-padding .single-layout-1 .entry-header .post-thumb-img-content:first-child' => array( 'margin-top' => '-1.5em', ), '.ast-separate-container .ast-article-single.remove-featured-img-padding .single-layout-1 .post-thumb-img-content' => array( 'margin-left' => '-2.14em', 'margin-right' => '-2.14em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on' => array( 'margin-left' => '-1.5em', 'margin-right' => '-1.5em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on' => array( 'margin-left' => '-0.5em', 'margin-right' => '-0.5em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .square .posted-on, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .square .posted-on, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .square .posted-on' => array( 'margin-top' => 0, ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on' => array( 'margin-top' => '1em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content' => array( 'margin-top' => '-1.5em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content' => array( 'margin-left' => '-1.5em', 'margin-right' => '-1.5em', ), '.blog-layout-2' => array( 'display' => 'flex', 'flex-direction' => 'column-reverse', ), '.ast-separate-container .blog-layout-3, .ast-separate-container .blog-layout-1' => array( 'display' => 'block', ), '.ast-plain-container .ast-grid-2 .ast-article-post, .ast-plain-container .ast-grid-3 .ast-article-post, .ast-plain-container .ast-grid-4 .ast-article-post, .ast-page-builder-template .ast-grid-2 .ast-article-post, .ast-page-builder-template .ast-grid-3 .ast-article-post, .ast-page-builder-template .ast-grid-4 .ast-article-post' => array( 'width' => '100%', ), ); /* Parse CSS from array() -> max-width: (tablet-breakpoint)px */ $css_output .= astra_parse_css( $tablet_max_css, '', astra_addon_get_tablet_breakpoint() ); if ( $is_site_rtl ) { $tablet_max_lang_direction_css = array( '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on' => array( 'margin-top' => 0, 'margin-right' => '-2.14em', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on' => array( 'margin-top' => 0, 'margin-right' => '-1.14em', ), ); } else { $tablet_max_lang_direction_css = array( '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on' => array( 'margin-top' => 0, 'margin-left' => '-2.14em', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on' => array( 'margin-top' => 0, 'margin-left' => '-1.14em', ), ); } /* Parse CSS from array() -> max-width: (tablet-breakpoint)px */ $css_output .= astra_parse_css( $tablet_max_lang_direction_css, '', astra_addon_get_tablet_breakpoint() ); /** * Normal blog multiple column layout creates extra spacing around category title, whereas this '-1em' needed when "Add Space Between Posts" optionn is enabled. * * @since 3.5.7 */ $margin_space = astra_get_option( 'blog-space-bet-posts' ) ? '-1em' : '0'; $tablet_min_css = array( '.ast-separate-container.ast-blog-grid-2 .ast-archive-description, .ast-separate-container.ast-blog-grid-3 .ast-archive-description, .ast-separate-container.ast-blog-grid-4 .ast-archive-description' => array( 'margin-bottom' => '1.33333em', ), '.blog-layout-2.ast-no-thumb .post-content, .blog-layout-3.ast-no-thumb .post-content' => array( 'width' => 'calc(100% - 5.714285714em)', ), '.blog-layout-2.ast-no-thumb.ast-no-date-box .post-content, .blog-layout-3.ast-no-thumb.ast-no-date-box .post-content' => array( 'width' => '100%', ), '.ast-separate-container .ast-grid-2 .ast-article-post.ast-separate-posts, .ast-separate-container .ast-grid-3 .ast-article-post.ast-separate-posts, .ast-separate-container .ast-grid-4 .ast-article-post.ast-separate-posts' => array( 'border-bottom' => 0, ), '.ast-separate-container .ast-grid-2 > .site-main > .ast-row, .ast-separate-container .ast-grid-3 > .site-main > .ast-row, .ast-separate-container .ast-grid-4 > .site-main > .ast-row' => array( 'margin-left' => esc_attr( $margin_space ), 'margin-right' => esc_attr( $margin_space ), 'display' => 'flex', 'flex-flow' => 'row wrap', 'align-items' => 'stretch', ), '.ast-separate-container .ast-grid-2 > .site-main > .ast-row:before, .ast-separate-container .ast-grid-2 > .site-main > .ast-row:after, .ast-separate-container .ast-grid-3 > .site-main > .ast-row:before, .ast-separate-container .ast-grid-3 > .site-main > .ast-row:after, .ast-separate-container .ast-grid-4 > .site-main > .ast-row:before, .ast-separate-container .ast-grid-4 > .site-main > .ast-row:after' => array( 'flex-basis' => 0, 'width' => 0, ), '.ast-separate-container .ast-grid-2 .ast-article-post, .ast-separate-container .ast-grid-3 .ast-article-post, .ast-separate-container .ast-grid-4 .ast-article-post' => array( 'display' => 'flex', 'padding' => 0, ), '.ast-plain-container .ast-grid-2 > .site-main > .ast-row, .ast-plain-container .ast-grid-3 > .site-main > .ast-row, .ast-plain-container .ast-grid-4 > .site-main > .ast-row, .ast-page-builder-template .ast-grid-2 > .site-main > .ast-row, .ast-page-builder-template .ast-grid-3 > .site-main > .ast-row, .ast-page-builder-template .ast-grid-4 > .site-main > .ast-row' => array( 'margin-left' => '-1em', 'margin-right' => '-1em', 'display' => 'flex', 'flex-flow' => 'row wrap', 'align-items' => 'stretch', ), '.ast-plain-container .ast-grid-2 > .site-main > .ast-row:before, .ast-plain-container .ast-grid-2 > .site-main > .ast-row:after, .ast-plain-container .ast-grid-3 > .site-main > .ast-row:before, .ast-plain-container .ast-grid-3 > .site-main > .ast-row:after, .ast-plain-container .ast-grid-4 > .site-main > .ast-row:before, .ast-plain-container .ast-grid-4 > .site-main > .ast-row:after, .ast-page-builder-template .ast-grid-2 > .site-main > .ast-row:before, .ast-page-builder-template .ast-grid-2 > .site-main > .ast-row:after, .ast-page-builder-template .ast-grid-3 > .site-main > .ast-row:before, .ast-page-builder-template .ast-grid-3 > .site-main > .ast-row:after, .ast-page-builder-template .ast-grid-4 > .site-main > .ast-row:before, .ast-page-builder-template .ast-grid-4 > .site-main > .ast-row:after' => array( 'flex-basis' => 0, 'width' => 0, ), '.ast-plain-container .ast-grid-2 .ast-article-post, .ast-plain-container .ast-grid-3 .ast-article-post, .ast-plain-container .ast-grid-4 .ast-article-post, .ast-page-builder-template .ast-grid-2 .ast-article-post, .ast-page-builder-template .ast-grid-3 .ast-article-post, .ast-page-builder-template .ast-grid-4 .ast-article-post' => array( 'display' => 'flex', ), '.ast-plain-container .ast-grid-2 .ast-article-post:last-child, .ast-plain-container .ast-grid-3 .ast-article-post:last-child, .ast-plain-container .ast-grid-4 .ast-article-post:last-child, .ast-page-builder-template .ast-grid-2 .ast-article-post:last-child, .ast-page-builder-template .ast-grid-3 .ast-article-post:last-child, .ast-page-builder-template .ast-grid-4 .ast-article-post:last-child' => array( 'margin-bottom' => '2.5em', ), ); if ( true === astra_get_option( 'customizer-default-layout-update', true ) ) { $tablet_min_css['.single .ast-author-meta .ast-author-details'] = array( 'display' => 'flex', 'align-items' => 'center', ); $tablet_min_css['.post-author-bio .author-title'] = array( 'margin-bottom' => '10px', ); } else { $tablet_min_css['.single .ast-author-meta .ast-author-details'] = array( 'display' => 'flex', ); } /* Parse CSS from array() -> min-width: (tablet-breakpoint + 1)px */ $css_output .= astra_parse_css( $tablet_min_css, astra_addon_get_tablet_breakpoint( '', 1 ) ); if ( $is_site_rtl ) { $tablet_min_lang_direction_css = array( '.single .post-author-avatar, .single .post-author-bio' => array( 'float' => 'right', 'clear' => 'left', ), '.single .ast-author-meta .post-author-avatar' => array( 'margin-left' => '1.33333em', ), '.single .ast-author-meta .about-author-title-wrapper, .single .ast-author-meta .post-author-bio' => array( 'text-align' => 'right', ), '.blog-layout-2 .post-content' => array( 'padding-left' => '2em', ), '.blog-layout-2.ast-no-date-box.ast-no-thumb .post-content' => array( 'padding-left' => 0, ), '.blog-layout-3 .post-content' => array( 'padding-right' => '2em', ), '.blog-layout-3.ast-no-date-box.ast-no-thumb .post-content' => array( 'padding-right' => 0, ), '.ast-separate-container .ast-grid-2 .ast-article-post.ast-separate-posts:nth-child(2n+0), .ast-separate-container .ast-grid-2 .ast-article-post.ast-separate-posts:nth-child(2n+1), .ast-separate-container .ast-grid-3 .ast-article-post.ast-separate-posts:nth-child(2n+0), .ast-separate-container .ast-grid-3 .ast-article-post.ast-separate-posts:nth-child(2n+1), .ast-separate-container .ast-grid-4 .ast-article-post.ast-separate-posts:nth-child(2n+0), .ast-separate-container .ast-grid-4 .ast-article-post.ast-separate-posts:nth-child(2n+1)' => array( 'padding' => '0 0 0 1em', ), ); } else { $tablet_min_lang_direction_css = array( '.single .post-author-avatar, .single .post-author-bio' => array( 'float' => 'left', 'clear' => 'right', ), '.single .ast-author-meta .post-author-avatar' => array( 'margin-right' => '1.33333em', ), '.single .ast-author-meta .about-author-title-wrapper, .single .ast-author-meta .post-author-bio' => array( 'text-align' => 'left', ), '.blog-layout-2 .post-content' => array( 'padding-right' => '2em', ), '.blog-layout-2.ast-no-date-box.ast-no-thumb .post-content' => array( 'padding-right' => 0, ), '.blog-layout-3 .post-content' => array( 'padding-left' => '2em', ), '.blog-layout-3.ast-no-date-box.ast-no-thumb .post-content' => array( 'padding-left' => 0, ), '.ast-separate-container .ast-grid-2 .ast-article-post.ast-separate-posts:nth-child(2n+0), .ast-separate-container .ast-grid-2 .ast-article-post.ast-separate-posts:nth-child(2n+1), .ast-separate-container .ast-grid-3 .ast-article-post.ast-separate-posts:nth-child(2n+0), .ast-separate-container .ast-grid-3 .ast-article-post.ast-separate-posts:nth-child(2n+1), .ast-separate-container .ast-grid-4 .ast-article-post.ast-separate-posts:nth-child(2n+0), .ast-separate-container .ast-grid-4 .ast-article-post.ast-separate-posts:nth-child(2n+1)' => array( 'padding' => '0 1em 0', ), ); } /* Parse CSS from array() -> min-width: (tablet-breakpoint + 1)px */ $css_output .= astra_parse_css( $tablet_min_lang_direction_css, astra_addon_get_tablet_breakpoint( '', 1 ) ); $mobile_css = array( '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on' => array( 'margin-top' => '0.5em', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content, .ast-separate-container .ast-article-single.remove-featured-img-padding .single-layout-1 .post-thumb-img-content, .ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on' => array( 'margin-left' => '-1em', 'margin-right' => '-1em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on' => array( 'margin-left' => '-0.5em', 'margin-right' => '-0.5em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section:first-child .circle .posted-on' => array( 'margin-top' => '0.5em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content' => array( 'margin-top' => '-1.33333em', ), '.ast-separate-container.ast-blog-grid-2 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content, .ast-separate-container.ast-blog-grid-3 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content, .ast-separate-container.ast-blog-grid-4 .ast-article-post.remove-featured-img-padding .blog-layout-1 .post-thumb-img-content' => array( 'margin-left' => '-1em', 'margin-right' => '-1em', ), '.ast-separate-container .ast-grid-2 .ast-article-post .blog-layout-1, .ast-separate-container .ast-grid-2 .ast-article-post .blog-layout-2, .ast-separate-container .ast-grid-2 .ast-article-post .blog-layout-3' => array( 'padding' => '1.33333em 1em', ), '.ast-separate-container .ast-grid-3 .ast-article-post .blog-layout-1, .ast-separate-container .ast-grid-4 .ast-article-post .blog-layout-1' => array( 'padding' => '1.33333em 1em', ), '.single.ast-separate-container .ast-author-meta' => array( 'padding' => '1.5em 1em', ), ); /* Parse CSS from array() -> max-width: (mobile-breakpoint)px */ $css_output .= astra_parse_css( $mobile_css, '', astra_addon_get_mobile_breakpoint() ); if ( $is_site_rtl ) { $mobile_max_direction_css = array( '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on' => array( 'margin-right' => '-1em', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on' => array( 'margin-right' => '-0.5em', ), ); } else { $mobile_max_direction_css = array( '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .square .posted-on' => array( 'margin-left' => '-1em', ), '.ast-separate-container .ast-article-post.remove-featured-img-padding.has-post-thumbnail .blog-layout-1 .post-content .ast-blog-featured-section .circle .posted-on' => array( 'margin-left' => '-0.5em', ), ); } /* Parse CSS from array() -> max-width: (mobile-breakpoint)px */ $css_output .= astra_parse_css( $mobile_max_direction_css, '', astra_addon_get_mobile_breakpoint() ); return $dynamic_css . $css_output; } astra-common-functions.php 0000644 00000046201 15150261777 0011701 0 ustar 00 <?php /** * Astra Theme & Addon Common function. * * @package Astra Addon */ /** * 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 ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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_addon_get_tablet_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['tablet'] ) . ';} }'; } if ( isset( $setting['mobile'] ) && ! empty( $setting['mobile'] ) ) { $css .= '@media (max-width:' . astra_addon_get_mobile_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['mobile'] ) . ';} }'; } return $css; } } /** * 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 = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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; } } if ( function_exists( 'astra_do_action_deprecated' ) ) { // Depreciating astra_woo_qv_product_summary filter. add_action( 'astra_woo_quick_view_product_summary', 'astra_addon_deprecated_astra_woo_quick_view_product_summary_action', 10 ); /** * Astra Color Palettes * * @since 1.1.2 */ function astra_addon_deprecated_astra_woo_quick_view_product_summary_action() { astra_do_action_deprecated( 'astra_woo_qv_product_summary', array(), '1.0.22', 'astra_woo_quick_view_product_summary', '' ); } } /** * 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 = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound 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 calc Responsive Spacing */ if ( ! function_exists( 'astra_calc_spacing' ) ) { /** * Get Spacing value * * @param array $value Responsive spacing value with unit. * @param string $operation + | - | * | /. * @param string $from Perform operation from the value. * @param string $from_unit Perform operation from the value of unit. * @return mixed */ function astra_calc_spacing( $value, $operation = '', $from = '', $from_unit = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $css = ''; if ( ! empty( $value ) ) { $css = $value; if ( ! empty( $operation ) && ! empty( $from ) ) { if ( ! empty( $from_unit ) ) { $css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . $from_unit . ' )'; } if ( '*' === $operation || '/' === $operation ) { $css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . ' )'; } } } return $css; } } /** * 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 ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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'] : ''; $bg_type = isset( $bg_obj['background-type'] ) ? $bg_obj['background-type'] : ''; if ( '' !== $bg_type ) { switch ( $bg_type ) { case 'color': if ( '' !== $bg_img && '' !== $bg_color ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');'; } elseif ( '' === $bg_img ) { $gen_bg_css['background-color'] = $bg_color . ';'; } break; case 'image': $overlay_type = isset( $bg_obj['overlay-type'] ) ? $bg_obj['overlay-type'] : 'none'; $overlay_color = isset( $bg_obj['overlay-color'] ) ? $bg_obj['overlay-color'] : ''; $overlay_grad = isset( $bg_obj['overlay-gradient'] ) ? $bg_obj['overlay-gradient'] : ''; if ( '' !== $bg_img ) { if ( 'none' !== $overlay_type ) { if ( 'classic' === $overlay_type && '' !== $overlay_color ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $overlay_color . ', ' . $overlay_color . '), url(' . $bg_img . ');'; } elseif ( 'gradient' === $overlay_type && '' !== $overlay_grad ) { $gen_bg_css['background-image'] = $overlay_grad . ', url(' . $bg_img . ');'; } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } break; case 'gradient': if ( isset( $bg_color ) ) { $gen_bg_css['background-image'] = $bg_color . ';'; } break; default: break; } } elseif ( '' !== $bg_color ) { $gen_bg_css['background-color'] = $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; } } /** * Adjust the background obj. */ if ( ! function_exists( 'astra_get_responsive_background_obj' ) ) { /** * 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 ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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; $bg_type = ( isset( $bg_obj['background-type'] ) && $bg_obj['background-type'] ) ? $bg_obj['background-type'] : ''; if ( '' !== $bg_type ) { switch ( $bg_type ) { case 'color': if ( '' !== $bg_img && '' !== $bg_color ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');'; } elseif ( 'mobile' === $device ) { if ( $desktop_css ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');'; } elseif ( $tablet_css ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_tab_img . ');'; } else { $gen_bg_css['background-color'] = $bg_color . ';'; $gen_bg_css['background-image'] = 'none;'; } } elseif ( 'tablet' === $device ) { if ( $desktop_css ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');'; } else { $gen_bg_css['background-color'] = $bg_color . ';'; $gen_bg_css['background-image'] = 'none;'; } } elseif ( '' === $bg_img ) { $gen_bg_css['background-color'] = $bg_color . ';'; $gen_bg_css['background-image'] = 'none;'; } break; case 'image': /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $overlay_type = isset( $bg_obj['overlay-type'] ) ? $bg_obj['overlay-type'] : 'none'; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $overlay_color = isset( $bg_obj['overlay-color'] ) ? $bg_obj['overlay-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $overlay_grad = isset( $bg_obj['overlay-gradient'] ) ? $bg_obj['overlay-gradient'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( '' !== $bg_img ) { if ( 'none' !== $overlay_type ) { if ( 'classic' === $overlay_type && '' !== $overlay_color ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $overlay_color . ', ' . $overlay_color . '), url(' . $bg_img . ');'; } elseif ( 'gradient' === $overlay_type && '' !== $overlay_grad ) { $gen_bg_css['background-image'] = $overlay_grad . ', url(' . $bg_img . ');'; } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } break; case 'gradient': if ( isset( $bg_color ) ) { $gen_bg_css['background-image'] = $bg_color . ';'; } break; default: break; } } elseif ( '' !== $bg_color ) { $gen_bg_css['background-color'] = $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; } } /** * Search Form */ if ( ! function_exists( 'astra_addon_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_addon_get_search_form( $echo = true ) { // get customizer placeholder field value. $astra_search_input_placeholder = isset( $args['input_placeholder'] ) ? $args['input_placeholder'] : astra_default_strings( 'string-search-input-placeholder', false ); $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-addon' ) . '</span> <input type="search" class="search-field" placeholder="' . esc_attr( $astra_search_input_placeholder ) . '" value="' . get_search_query() . '" name="s" /> </label> <button type="submit" class="search-submit" value="' . esc_attr__( 'Search', 'astra-addon' ) . '" aria-label= "' . esc_attr__( 'Search', 'astra-addon' ) . '"><i class="astra-search-icon"> ' . Astra_Icons::get_icons( 'search' ) . ' </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 ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( null === $result ) { $result = $form; } if ( $echo ) { echo wp_kses( $result, Astra_Addon_Kses::astra_addon_form_with_post_kses_protocols() ); } else { return $result; } } endif; /** * Get instance of WP_Filesystem. * * @since 2.6.4 * * @return WP_Filesystem */ function astra_addon_filesystem() { return astra_addon_filesystem::instance(); } /** * Check the WordPress version. * * @since 2.7.0 * @param string $version WordPress version to compare with the current version. * @param string $compare Comparison value i.e > or < etc. * @return bool True/False based on the $version and $compare value. */ function astra_addon_wp_version_compare( $version, $compare ) { return version_compare( get_bloginfo( 'version' ), $version, $compare ); } /** * Adjust Brightness * * @param array $bg_obj Color code in HEX. * * @return array Color code in HEX. * * @since 2.7.1 */ function astra_addon_get_megamenu_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-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; } /** * Calculate Astra Mega-menu spacing. * * @param array $spacing_obj - Spacing dimensions with their values. * * @return array parsed CSS. * * @since 3.0.0 */ function astra_addon_get_megamenu_spacing_css( $spacing_obj ) { $gen_spacing_css = array(); foreach ( $spacing_obj as $property => $value ) { if ( '' == $value && 0 !== $value ) { continue; } $gen_spacing_css[ $property ] = esc_attr( $spacing_obj[ $property ] ) . 'px'; } return $gen_spacing_css; } /** * Check whether blogs post structure title & meta is disabled or not. * * @since 4.0.0 * @return bool True if blogs post structure title & meta is disabled else false. */ function astra_addon_is_blog_title_meta_disabled() { $blog_title_meta = astra_get_option( 'blog-post-structure' ); if ( is_array( $blog_title_meta ) && ! in_array( 'title-meta', $blog_title_meta ) ) { return true; } return false; } /** * Function which will return CSS for font-extras control. * It includes - line-height, letter-spacing, text-decoration, font-style. * * @param array $config contains extra font settings. * @param string $setting basis on this setting will return. * @param mixed $unit Unit. * * @since 4.0.0 */ function astra_addon_get_font_extras( $config, $setting, $unit = false ) { $css = isset( $config[ $setting ] ) ? $config[ $setting ] : ''; if ( $unit && $css ) { $css .= isset( $config[ $unit ] ) ? $config[ $unit ] : ''; } return $css; } /** * Function which will return CSS array for font specific props for further parsing CSS. * It includes - font-family, font-weight, font-size, line-height, text-transform, letter-spacing, text-decoration, color (optional). * * @param string $font_family Font family. * @param string $font_weight Font weight. * @param array $font_size Font size. * @param string $font_extras contains all font controls. * @param string $color In most of cases color is also added, so included optional param here. * * @return array * * @since 4.0.0 */ function astra_addon_get_font_array_css( $font_family, $font_weight, $font_size, $font_extras, $color = '' ) { $font_extras_ast_option = astra_get_option( $font_extras ); return array( 'color' => esc_attr( $color ), 'font-family' => astra_get_css_value( $font_family, 'font' ), 'font-weight' => astra_get_css_value( $font_weight, 'font' ), 'font-size' => ! empty( $font_size ) ? astra_responsive_font( $font_size, 'desktop' ) : '', 'line-height' => astra_addon_get_font_extras( $font_extras_ast_option, 'line-height', 'line-height-unit' ), 'text-transform' => astra_addon_get_font_extras( $font_extras_ast_option, 'text-transform' ), 'letter-spacing' => astra_addon_get_font_extras( $font_extras_ast_option, 'letter-spacing', 'letter-spacing-unit' ), 'text-decoration' => astra_addon_get_font_extras( $font_extras_ast_option, 'text-decoration' ), ); } astra-theme-compatibility-functions.php 0000644 00000001023 15150261777 0014353 0 ustar 00 <?php /** * Astra Theme Extension * * @package Astra Addon */ if ( ! function_exists( 'astra_get_theme_name' ) ) : /** * Get theme name. * * @return string Theme Name. */ function astra_get_theme_name() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $theme_name = __( 'Astra', 'astra-addon' ); return apply_filters( 'astra_theme_name', $theme_name ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } endif; class-addon-gutenberg-editor-css.php 0000644 00000032407 15150261777 0013520 0 ustar 00 <?php /** * Astra Addon - Gutenberg Editor CSS * * @package Astra Addon */ if ( ! class_exists( 'Addon_Gutenberg_Editor_CSS' ) ) { /** * Addon_Gutenberg_Editor_CSS initial setup * * @since 1.6.2 */ // @codingStandardsIgnoreStart class Addon_Gutenberg_Editor_CSS { // @codingStandardsIgnoreEnd /** * Class instance. * * @var $instance Class instance. */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { if ( Astra_Ext_Extension::is_active( 'colors-and-background' ) ) { add_filter( 'astra_block_editor_dynamic_css', array( $this, 'colors_and_background_addon_gutenberg_dynamic_css' ) ); } if ( Astra_Ext_Extension::is_active( 'spacing' ) ) { add_filter( 'astra_block_editor_dynamic_css', array( $this, 'spacing_addon_gutenberg_dynamic_css' ) ); } if ( Astra_Ext_Extension::is_active( 'woocommerce' ) ) { add_filter( 'astra_block_editor_dynamic_css', array( $this, 'woo_gb_blocks_dynamic_css' ) ); } } /** * Dynamic CSS - Colors and Background * * @since 1.6.2 * @param string $dynamic_css Astra Gutenberg Dynamic CSS. * @param string $dynamic_css_filtered Astra Gutenberg Dynamic CSS Filters. * @return string */ public function colors_and_background_addon_gutenberg_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $h1_color = astra_get_option( 'h1-color' ); $h2_color = astra_get_option( 'h2-color' ); $h3_color = astra_get_option( 'h3-color' ); $h4_color = astra_get_option( 'h4-color' ); $h5_color = astra_get_option( 'h5-color' ); $h6_color = astra_get_option( 'h6-color' ); $single_post_title_color = astra_get_option( 'ast-dynamic-single-' . esc_attr( strval( get_post_type() ) ) . '-banner-title-color' ); $parse_css = ''; /** * Colors and Background */ $colors_and_background_output = array( /** * Content <h1> to <h6> headings */ '.editor-styles-wrapper .block-editor-block-list__block h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-post-title__block .editor-post-title__input, .edit-post-visual-editor h1.block-editor-block-list__block' => array( 'color' => esc_attr( $h1_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h2, .wp-block-heading h2.editor-rich-text__tinymce, .edit-post-visual-editor h2.block-editor-block-list__block' => array( 'color' => esc_attr( $h2_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h3, .wp-block-heading h3.editor-rich-text__tinymce, .edit-post-visual-editor h3.block-editor-block-list__block' => array( 'color' => esc_attr( $h3_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h4, .wp-block-heading h4.editor-rich-text__tinymce, .edit-post-visual-editor h4.block-editor-block-list__block' => array( 'color' => esc_attr( $h4_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h5, .wp-block-heading h5.editor-rich-text__tinymce, .edit-post-visual-editor h5.block-editor-block-list__block' => array( 'color' => esc_attr( $h5_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h6, .wp-block-heading h6.editor-rich-text__tinymce, .edit-post-visual-editor h6.block-editor-block-list__block' => array( 'color' => esc_attr( $h6_color ), ), ); if ( 'post' === get_post_type() ) { $colors_and_background_output['.editor-post-title__block .editor-post-title__input'] = array( 'color' => esc_attr( $single_post_title_color ), ); } $parse_css .= astra_parse_css( $colors_and_background_output ); $boxed_container = array(); $boxed_container_tablet = array(); $boxed_container_mobile = array(); $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 ( isset( $container_layout ) ) { $content_bg_obj = astra_get_option( 'content-bg-obj-responsive' ); // Setting up "Full-Width / Stretched" layout transparent but not for "Full-Width / Contained" in case of Max-Width site layout. // Because we showcase container with "Full-Width / Contained" layout, so it should be visible as it looks on frontend with their content background styles. $boxed_container = array( '.ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow' => array( 'padding' => '20px', ), ); $boxed_container_tablet = array( '.ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow' => array( 'padding' => '20px', ), ); $boxed_container_mobile = array( '.ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow' => array( 'padding' => '20px', ), ); } $parse_css .= astra_parse_css( $boxed_container ); $parse_css .= astra_parse_css( $boxed_container_tablet, '', astra_addon_get_tablet_breakpoint() ); $parse_css .= astra_parse_css( $boxed_container_mobile, '', astra_addon_get_mobile_breakpoint() ); return $dynamic_css . $parse_css; } /** * Dynamic CSS - Spacing Addon * * @since 1.6.2 * @param string $dynamic_css Astra Gutenberg Dynamic CSS. * @param string $dynamic_css_filtered Astra Gutenberg Dynamic CSS Filters. * @return string */ public function spacing_addon_gutenberg_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { if ( 'custom' === astra_get_option( 'wp-blocks-ui', 'custom' ) ) { return $dynamic_css; } $container_layout = get_post_meta( get_the_id(), 'site-content-layout', true ); if ( 'default' === $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' ); } } $boxed_container = array(); if ( 'content-boxed-container' === $container_layout || 'boxed-container' === $container_layout ) { $continer_inside_spacing = astra_get_option( 'container-inside-spacing' ); $site_content_width = astra_get_option( 'site-content-width', 1200 ); $boxed_container = array( '.block-editor-block-list__layout, .editor-post-title' => array( 'padding-top' => astra_responsive_spacing( $continer_inside_spacing, 'top', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $continer_inside_spacing, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ), 'padding-right' => astra_responsive_spacing( $continer_inside_spacing, 'right', 'desktop' ), ), '.block-editor-writing-flow .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' ) . ' - ' . astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) . ')', ), '.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .editor-block-list__block-edit' => array( 'margin-left' => - (int) astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) . 'px', 'margin-right' => - (int) astra_responsive_spacing( $continer_inside_spacing, 'right', 'desktop' ) . 'px', ), '.block-editor-block-list__block[data-align=wide]' => array( 'margin-left' => '-' . ( 15 - (int) astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) ) . 'px', 'margin-right' => '-' . ( 15 - (int) astra_responsive_spacing( $continer_inside_spacing, 'right', 'desktop' ) ) . 'px', ), ); if ( '' !== astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) ) { $boxed_container['.edit-post-visual-editor .block-editor-block-list__block .editor-block-list__block-edit, .editor-post-title__block .editor-post-title__input'] = array( 'padding-left' => 0, 'padding-right' => 0, ); } } $parse_css = astra_parse_css( $boxed_container ); return $dynamic_css . $parse_css; } /** * Dynamic CSS - WooCommerce Blocks * * @since 2.1.2 * @param string $dynamic_css Astra Gutenberg Dynamic CSS. * @param string $dynamic_css_filtered Astra Gutenberg Dynamic CSS Filters. * @return string */ public function woo_gb_blocks_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // Shop Typo. $shop_product_title_font_size = astra_get_option( 'font-size-shop-product-title' ); // Shop Product Title color. $shop_product_title_color = astra_get_option( 'shop-product-title-color' ); $shop_product_price_font_size = astra_get_option( 'font-size-shop-product-price' ); // Shop Product Price color. $shop_product_price_color = astra_get_option( 'shop-product-price-color' ); $theme_color = astra_get_option( 'theme-color' ); $link_color = astra_get_option( 'link-color', $theme_color ); $product_sale_style = astra_get_option( 'product-sale-style' ); /** * Set font sizes */ $css_output = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-title' => astra_addon_get_font_array_css( astra_get_option( 'font-family-shop-product-title' ), astra_get_option( 'font-weight-shop-product-title' ), $shop_product_title_font_size, 'font-extras-shop-product-title', $shop_product_title_color ), '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-price' => astra_addon_get_font_array_css( astra_get_option( 'font-family-shop-product-price' ), astra_get_option( 'font-weight-shop-product-price' ), $shop_product_price_font_size, 'font-extras-shop-product-price', $shop_product_price_color ), ); /* Parse CSS from array() */ $css_output = astra_parse_css( $css_output ); $tablet_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-title' => array( 'font-size' => astra_responsive_font( $shop_product_title_font_size, 'tablet' ), ), '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-price' => array( 'font-size' => astra_responsive_font( $shop_product_price_font_size, 'tablet' ), ), ); $css_output .= astra_parse_css( $tablet_css, '', astra_addon_get_tablet_breakpoint() ); $mobile_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-title' => array( 'font-size' => astra_responsive_font( $shop_product_title_font_size, 'mobile' ), ), '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-price' => array( 'font-size' => astra_responsive_font( $shop_product_price_font_size, 'mobile' ), ), ); /** * Sale bubble color */ if ( 'circle-outline' == $product_sale_style ) { /** * Sale bubble color - Circle Outline */ $sale_style_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-onsale' => array( 'line-height' => '2.7', 'background' => '#ffffff', 'border' => '2px solid ' . $link_color, 'color' => $link_color, ), ); $css_output .= astra_parse_css( $sale_style_css ); } elseif ( 'square' == $product_sale_style ) { /** * Sale bubble color - Square */ $sale_style_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-onsale' => array( 'border-radius' => '0', 'line-height' => '3', ), ); $css_output .= astra_parse_css( $sale_style_css ); } elseif ( 'square-outline' == $product_sale_style ) { /** * Sale bubble color - Square Outline */ $sale_style_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-onsale' => array( 'line-height' => '3', 'background' => '#ffffff', 'border' => '2px solid ' . $link_color, 'color' => $link_color, 'border-radius' => '0', ), ); $css_output .= astra_parse_css( $sale_style_css ); } $css_output .= astra_parse_css( $mobile_css, '', astra_addon_get_mobile_breakpoint() ); return $dynamic_css . $css_output; } } } /** * Kicking this off by calling 'get_instance()' method */ Addon_Gutenberg_Editor_CSS::get_instance(); class-astra-addon-background-updater.php 0000644 00000030457 15150261777 0014360 0 ustar 00 <?php /** * Astra Addon Batch Update * * @package Astra Addon * @since 2.1.3 */ if ( ! class_exists( 'Astra_Addon_Background_Updater' ) ) { /** * Astra_Addon_Background_Updater Class. */ class Astra_Addon_Background_Updater { /** * Background update class. * * @var object */ private static $background_updater; /** * DB updates and callbacks that need to be run per version. * * @var array */ private static $db_updates = array( '2.2.0' => array( 'astra_addon_page_builder_button_color_compatibility', ), '2.3.0' => array( 'astra_addon_page_header_parallax_device', ), '2.3.3' => array( 'astra_addon_css_gen_multi_site_fix', ), '2.4.0' => array( 'astra_responsive_content_background_option', 'astra_addon_update_theme_tablet_breakpoint', ), '2.5.0' => array( 'custom_layout_compatibility_having_code_posts', 'astra_addon_page_header_submenu_color_options', ), '2.6.0' => array( 'astra_addon_header_css_optimizations', ), '3.5.0' => array( 'astra_addon_page_headers_support_to_builder_layout', ), '3.5.1' => array( 'astra_addon_headings_font_support', 'astra_addon_cart_color_not_working_in_old_header', ), '3.5.7' => array( 'astra_addon_outline_cart_bg_color_support', 'astra_addon_remove_header_sections_deps_new_builder', 'astra_addon_swap_section_not_working_in_old_header', ), '3.5.8' => array( 'astra_sticky_header_site_title_tagline_css', ), '3.5.9' => array( 'astra_addon_remove_responsive_account_menu_colors_support', ), '3.9.0' => array( 'astra_addon_responsive_shop_button_padding', 'astra_addon_shop_box_shadow_migration', 'astra_addon_update_product_gallery_layout', 'astra_addon_update_woocommerce_cart_icons', 'astra_addon_update_toolbar_seperations', 'astra_addon_apply_modern_ecommerce_setup', ), '3.9.3' => array( 'astra_addon_update_variant_active_state', ), '4.0.0' => array( 'astra_addon_background_updater_4_0_0', ), '4.1.0' => array( 'astra_addon_background_updater_4_1_0', ), ); /** * Constructor */ public function __construct() { // Addon Updates. if ( is_admin() ) { add_action( 'admin_init', array( $this, 'install_actions' ) ); } else { add_action( 'wp', array( $this, 'install_actions' ) ); } // Core Helpers - Batch Processing. require_once ASTRA_EXT_DIR . 'classes/library/batch-processing/wp-async-request.php'; require_once ASTRA_EXT_DIR . 'classes/library/batch-processing/wp-background-process.php'; require_once ASTRA_EXT_DIR . 'classes/library/batch-processing/class-wp-background-process-astra-addon.php'; self::$background_updater = new WP_Background_Process_Astra_Addon(); } /** * Check if database is migrated * * @since 2.3.2 * * @return true If the database migration should not be run through CRON. */ public function check_if_data_migrated() { $fallback = false; $is_db_version_updated = $this->is_db_version_updated(); if ( ! $is_db_version_updated ) { $db_migrated = get_transient( 'astra-addon-db-migrated' ); if ( ! $db_migrated ) { $db_migrated = array(); } array_push( $db_migrated, $is_db_version_updated ); set_transient( 'astra-addon-db-migrated', $db_migrated, 3600 ); $db_migrate_count = count( $db_migrated ); if ( $db_migrate_count >= 5 ) { $customizer_options = get_option( 'astra-settings' ); // Get all customizer options. $version_array = array( 'is_astra_addon_queue_running' => false, ); // Merge customizer options with version. $astra_options = wp_parse_args( $version_array, $customizer_options ); update_option( 'astra-settings', $astra_options ); $fallback = true; } } return $fallback; } /** * Checks if astra addon version is updated in the database * * @since 2.3.2 * * @return true if astra addon version is updated. */ public function is_db_version_updated() { // Get auto saved version number. $saved_version = Astra_Addon_Update::astra_addon_stored_version(); return version_compare( $saved_version, ASTRA_EXT_VER, '=' ); } /** * Check Cron Status * * Gets the current cron status by performing a test spawn. Cached for one hour when all is well. * * @since 2.3.0 * * @return true if there is a problem spawning a call to Wp-Cron system. */ public function test_cron() { global $wp_version; if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) { return true; } if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) { return true; } $cached_status = get_transient( 'astra-addon-cron-test-ok' ); if ( $cached_status ) { return false; } $sslverify = version_compare( $wp_version, 4.0, '<' ); $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); $cron_request = apply_filters( 'cron_request', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound array( 'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ), 'args' => array( 'timeout' => 3, 'blocking' => true, 'sslverify' => apply_filters( 'https_local_ssl_verify', $sslverify ), // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound ), ) ); $result = wp_remote_post( $cron_request['url'], $cron_request['args'] ); if ( wp_remote_retrieve_response_code( $result ) >= 300 ) { return true; } else { set_transient( 'astra-addon-cron-test-ok', 1, 3600 ); return false; } return $migration_fallback; } /** * Install actions when a update button is clicked within the admin area. * * This function is hooked into admin_init to affect admin and wp to affect the frontend. * * @since 2.1.3 * @return void */ public function install_actions() { if ( true === $this->is_new_install() ) { self::update_db_version(); return; } $customizer_options = get_option( 'astra-settings' ); $fallback = $this->test_cron(); $db_migrated = $this->check_if_data_migrated(); $is_queue_running = ( isset( $customizer_options['is_astra_addon_queue_running'] ) && '' !== $customizer_options['is_astra_addon_queue_running'] ) ? $customizer_options['is_astra_addon_queue_running'] : false; $fallback = ( $db_migrated ) ? $db_migrated : $fallback; if ( $this->needs_db_update() && ! $is_queue_running ) { $this->update( $fallback ); } else { if ( ! $is_queue_running ) { self::update_db_version(); } } } /** * Is this a brand new addon install? * * @since 2.1.3 * @return boolean */ private function is_new_install() { // Get auto saved version number. $saved_version = Astra_Addon_Update::astra_addon_stored_version(); if ( false === $saved_version ) { return true; } else { return false; } } /** * Is a DB update needed? * * @since 2.1.3 * @return boolean */ private function needs_db_update() { $updates = $this->get_db_update_callbacks(); if ( empty( $updates ) ) { return false; } $customizer_options = get_option( 'astra-settings' ); $addon_auto_version = ( isset( $customizer_options['astra-addon-auto-version'] ) && '' !== $customizer_options['astra-addon-auto-version'] ) ? $customizer_options['astra-addon-auto-version'] : null; return ! is_null( $addon_auto_version ) && version_compare( $addon_auto_version, max( array_keys( $updates ) ), '<' ); } /** * Get list of DB update callbacks. * * @since 2.1.3 * @return array */ public function get_db_update_callbacks() { return self::$db_updates; } /** * Push all needed DB updates to the queue for processing. * * @param bool $fallback Fallback migration. */ private function update( $fallback ) { $current_db_version = Astra_Addon_Update::astra_addon_stored_version(); error_log( 'Astra Addon: Batch Process Started!' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log if ( count( $this->get_db_update_callbacks() ) > 0 ) { foreach ( $this->get_db_update_callbacks() as $version => $update_callbacks ) { if ( version_compare( $current_db_version, $version, '<' ) ) { foreach ( $update_callbacks as $update_callback ) { if ( $fallback ) { call_user_func( $update_callback ); } else { error_log( sprintf( 'Astra Addon: Queuing %s - %s', $version, $update_callback ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log self::$background_updater->push_to_queue( $update_callback ); } } } } if ( $fallback ) { error_log( 'Astra Addon: Running migration without batch processing.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log self::update_db_version(); } else { $customizer_options = get_option( 'astra-settings' ); // Get all customizer options. $version_array = array( 'is_astra_addon_queue_running' => true, ); // Merge customizer options with version. $astra_options = wp_parse_args( $version_array, $customizer_options ); update_option( 'astra-settings', $astra_options ); self::$background_updater->push_to_queue( 'update_db_version' ); } } else { self::$background_updater->push_to_queue( 'update_db_version' ); } self::$background_updater->save()->dispatch(); } /** * Update DB version to current. * * @param string|null $version New Astra addon version or null. */ public static function update_db_version( $version = null ) { do_action( 'astra_addon_update_before' ); // Get auto saved version number. $saved_version = Astra_Addon_Update::astra_addon_stored_version(); $astra_addon_version = ASTRA_EXT_VER; if ( false === $saved_version ) { // Get all customizer options. $customizer_options = get_option( 'astra-settings' ); // Get all customizer options. /* Add Current version constant "ASTRA_EXT_VER" here after 1.0.0-rc.9 update */ $version_array = array( 'astra-addon-auto-version' => ASTRA_EXT_VER, ); $saved_version = ASTRA_EXT_VER; // Merge customizer options with version. $astra_options = wp_parse_args( $version_array, $customizer_options ); // Update auto saved version number. update_option( 'astra-settings', $astra_options ); } // If equals then return. if ( version_compare( $saved_version, ASTRA_EXT_VER, '=' ) ) { // Get all customizer options. $customizer_options = get_option( 'astra-settings' ); // Get all customizer options. $options_array = array( 'is_astra_addon_queue_running' => false, ); // Merge customizer options with version. $astra_options = wp_parse_args( $options_array, $customizer_options ); // Update auto saved version number. update_option( 'astra-settings', $astra_options ); return; } $astra_addon_version = ASTRA_EXT_VER; // Get all customizer options. $customizer_options = get_option( 'astra-settings' ); // Get all customizer options. $options_array = array( 'astra-addon-auto-version' => $astra_addon_version, 'is_astra_addon_queue_running' => false, ); // Merge customizer options with version. $astra_options = wp_parse_args( $options_array, $customizer_options ); // Update auto saved version number. update_option( 'astra-settings', $astra_options ); error_log( 'Astra Addon: DB version updated!' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log // Update variables. Astra_Theme_Options::refresh(); // Refresh Astra Addon CSS and JS Files on update. Astra_Minify::refresh_assets(); delete_transient( 'astra-addon-db-migrated' ); do_action( 'astra_addon_update_after' ); } } } /** * Kicking this off by creating a new instance */ new Astra_Addon_Background_Updater(); class-astra-addon-builder-loader.php 0000644 00000003477 15150261777 0013473 0 ustar 00 <?php /** * Astra Addon Builder Loader. * * @package astra-builder */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Addon_Builder_Loader' ) ) { /** * Class Astra_Addon_Builder_Loader. */ final class Astra_Addon_Builder_Loader { /** * Member Variable * * @var instance */ private static $instance = null; /** * Initiator */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); do_action( 'astra_addon_builder_loaded' ); } return self::$instance; } /** * Constructor */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_EXT_DIR . 'classes/class-astra-addon-builder-loader.php'; /** * Builder - Header & Footer Markup. */ require_once ASTRA_EXT_DIR . 'classes/builder/markup/class-astra-addon-builder-header.php'; if ( true === astra_addon_builder_helper()->is_header_footer_builder_active ) { require_once ASTRA_EXT_DIR . 'classes/builder/markup/class-astra-addon-builder-footer.php'; } /** * Builder Controllers. */ require_once ASTRA_EXT_DIR . 'classes/builder/type/base/controllers/class-astra-addon-builder-ui-controller.php'; /** * Customizer - Configs. */ require_once ASTRA_EXT_DIR . 'classes/builder/class-astra-addon-builder-customizer.php'; require_once ASTRA_EXT_DIR . 'classes/builder/type/base/dynamic-css/class-astra-addon-base-dynamic-css.php'; } } /** * Prepare if class 'Astra_Addon_Builder_Loader' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Addon_Builder_Loader::get_instance(); } class-astra-addon-filesystem.php 0000644 00000013402 15150261777 0012752 0 ustar 00 <?php /** * Astra Addon Helper. * * @package Astra Addon */ /** * Class Astra_Addon_Filesystem. */ class Astra_Addon_Filesystem { /** * Store instance of Astra_Addon_Filesystem * * @since 2.6.4. * @var Astra_Addon_Filesystem */ protected static $instance = null; /** * Get instance of Astra_Addon_Filesystem * * @since 2.6.4 * @return Astra_Addon_Filesystem */ public static function instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Get WP_Filesystem instance. * * @since 2.6.4 * @return WP_Filesystem */ public function get_filesystem() { global $wp_filesystem; if ( ! $wp_filesystem ) { require_once ABSPATH . '/wp-admin/includes/file.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound $context = apply_filters( 'request_filesystem_credentials_context', false ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound add_filter( 'request_filesystem_credentials', array( $this, 'request_filesystem_credentials' ) ); $creds = request_filesystem_credentials( site_url(), '', false, $context, null ); WP_Filesystem( $creds, $context ); remove_filter( 'request_filesystem_credentials', array( $this, 'request_filesystem_credentials' ) ); } // Set the permission constants if not already set. if ( ! defined( 'FS_CHMOD_DIR' ) ) { define( 'FS_CHMOD_DIR', 0755 ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound } if ( ! defined( 'FS_CHMOD_FILE' ) ) { define( 'FS_CHMOD_FILE', 0644 ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound } return $wp_filesystem; } /** * Sets credentials to true. * * @since 2.6.4 */ public function request_filesystem_credentials() { return true; } /** * Checks to see if the site has SSL enabled or not. * * @since 2.6.4 * @return bool */ public function is_ssl() { if ( is_ssl() ) { return true; } elseif ( 0 === stripos( get_option( 'siteurl' ), 'https://' ) ) { return true; } elseif ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { return true; } return false; } /** * Create uploads directory if it does not exist. * * @since 2.6.4 * @param String $dir directory path to be created. * @return boolean True of the directory is created. False if directory is not created. */ public function maybe_create_uploads_dir( $dir ) { // Create the upload dir if it doesn't exist. if ( ! file_exists( $dir ) ) { // Create the directory. $status = astra_addon_filesystem()->get_filesystem()->mkdir( $dir ); // IF a directory cannot be created, return with false status. if ( false === $status ) { astra_addon_filesystem()->update_filesystem_access_status( $status ); return false; } // Add an index file for security. astra_addon_filesystem()->get_filesystem()->put_contents( $dir . 'index.php', '' ); } return true; } /** * Update Filesystem status. * * @since 2.6.4 * @param boolean $status status for filesystem access. * @return void */ public function update_filesystem_access_status( $status ) { astra_update_option( 'file-write-access', $status ); } /** * Check if filesystem has write access. * * @since 2.6.4 * @return boolean True if filesystem has access, false if does not have access. */ public function can_access_filesystem() { return (bool) astra_get_option( 'file-write-access', true ); } /** * Reset filesystem access status. * * @since 2.6.4 * @return void */ public function reset_filesystem_access_status() { astra_delete_option( 'file-write-access' ); } /** * Returns an array of paths for the upload directory * of the current site. * * @since 2.6.4 * @param String $assets_dir directory name to be created in the WordPress uploads directory. * @return array */ public function get_uploads_dir( $assets_dir ) { $wp_info = wp_upload_dir( null, false ); // SSL workaround. if ( $this->is_ssl() ) { $wp_info['baseurl'] = str_ireplace( 'http://', 'https://', $wp_info['baseurl'] ); } // Build the paths. $dir_info = array( 'path' => $wp_info['basedir'] . '/' . $assets_dir . '/', 'url' => $wp_info['baseurl'] . '/' . $assets_dir . '/', ); return apply_filters( 'astra_addon_get_assets_uploads_dir', $dir_info ); } /** * Delete file from the filesystem. * * @since 2.6.4 * @param String $file Path to the file or directory. * @param boolean $recursive If set to true, changes file group recursively. * @param boolean $type Type of resource. 'f' for file, 'd' for directory. * @return void */ public function delete( $file, $recursive = false, $type = false ) { astra_addon_filesystem()->get_filesystem()->delete( $file, $recursive, $type ); } /** * Adds contents to the file. * * @param string $file_path Gets the assets path info. * @param string $style_data Gets the CSS data. * @since 2.6.4 * @return bool $put_content returns false if file write is not successful. */ public function put_contents( $file_path, $style_data ) { return astra_addon_filesystem()->get_filesystem()->put_contents( $file_path, $style_data ); } /** * Get contents of the file. * * @param string $file_path Gets the assets path info. * @since 2.6.4 * @return bool $get_contents Gets te file contents. */ public function get_contents( $file_path ) { return astra_addon_filesystem()->get_filesystem()->get_contents( $file_path ); } } class-astra-addon-kses.php 0000644 00000014741 15150261777 0011542 0 ustar 00 <?php /** * Admin settings helper * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Astra Addon * @link https://wpastra.com/ * @since Astra 4.1.1 */ /** * Astra Addon kses for data process. */ class Astra_Addon_Kses { /** * Echo kses code based on SVG type. * * @since 4.1.1 * * @return array Return the array for allowed SVG protocols. */ public static function astra_addon_svg_kses_protocols() { return array( 'a' => array( 'class' => array(), 'href' => array(), 'rel' => array(), 'data-quantity' => array(), 'data-product_id' => array(), 'data-product_sku' => array(), 'aria-label' => array(), 'rev' => true, 'name' => true, 'target' => true, 'download' => array( 'valueless' => 'y', ), 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, 'data-*' => true, 'dir' => true, 'id' => true, 'lang' => true, 'style' => true, 'title' => true, 'role' => true, 'xml:lang' => true, ), 'i' => array( 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, 'data-*' => true, 'dir' => true, 'id' => true, 'lang' => true, 'style' => true, 'title' => true, 'role' => true, 'xml:lang' => true, ), 'span' => array( 'data-product_id' => array(), 'align' => true, 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, 'data-*' => true, 'dir' => true, 'id' => true, 'lang' => true, 'style' => true, 'title' => true, 'role' => true, 'xml:lang' => true, ), 'svg' => array( 'xmlns:xlink' => array(), 'version' => array(), 'x' => array(), 'y' => array(), 'enable-background' => array(), 'xml:space' => array(), 'class' => array(), 'data-*' => true, 'aria-hidden' => array(), 'aria-labelledby' => array(), 'role' => array(), 'xmlns' => array(), 'width' => array(), 'fill' => array(), 'height' => array(), 'viewbox' => array(), ), 'g' => array( 'fill' => array(), 'stroke-width' => array(), 'transform' => array(), 'stroke' => array(), 'id' => array(), 'clip-path' => array(), ), 'use' => array( 'xlink:href' => array(), 'clip-path' => array(), 'stroke-width' => array(), 'id' => array(), 'stroke' => array(), 'fill' => array(), 'transform' => array(), ), 'polyline' => array( 'fill' => array(), 'points' => array(), 'transform' => array(), 'id' => array(), ), 'clippath' => array( 'id' => array() ), 'title' => array( 'title' => array() ), 'path' => array( 'd' => array(), 'fill' => array(), 'id' => array(), 'clip-path' => array(), 'stroke' => array(), 'transform' => array(), 'stroke-width' => array(), ), 'circle' => array( 'cx' => array(), 'cy' => array(), 'r' => array(), 'fill' => array(), 'fill' => array(), 'style' => array(), 'transform' => array(), ), 'rect' => array( 'y' => array(), 'x' => array(), 'r' => array(), 'style' => array(), 'id' => array(), 'fill' => array(), 'width' => array(), 'height' => array(), ), 'polygon' => array( 'style' => array(), 'points' => array(), 'fill' => array(), 'transform' => array(), ), ); } /** * Echo kses post allowed HTML protocols along with above SVG protocols. * * @since 4.1.1 * * @return array Return the array for allowed protocols. */ public static function astra_addon_svg_with_post_kses_protocols() { return apply_filters( 'astra_addon_all_kses_protocols', array_merge( wp_kses_allowed_html( 'post' ), self::astra_addon_svg_kses_protocols() ) ); } /** * Echo kses allowed 'post' kses protocols along with 'form' tag. * * @since 4.1.1 * * @return array Return the array for allowed protocols. */ public static function astra_addon_form_with_post_kses_protocols() { return apply_filters( 'astra_addon_form_post_kses_protocols', array_merge( array( 'div' => array( 'class' => array(), 'id' => array(), 'style' => array(), 'data-*' => true, 'align' => array(), ), 'form' => array( 'class' => array(), 'id' => array(), 'action' => array(), 'role' => array(), 'data-*' => true, 'accept' => array(), 'accept-charset' => array(), 'enctype' => array(), 'method' => array(), 'name' => array(), 'target' => array(), ), 'input' => array( 'class' => array(), 'placeholder' => array(), 'data-*' => true, 'type' => array(), 'role' => array(), 'value' => array(), 'name' => array(), 'autocomplete' => array(), ), 'button' => array( 'class' => array(), 'data-*' => true, 'aria-label' => array(), 'value' => array(), 'type' => array(), ), ), self::astra_addon_svg_kses_protocols() ) ); } } class-astra-addon-update-filter-function.php 0000644 00000010630 15150261777 0015156 0 ustar 00 <?php /** * Supportive class for checking batch based option functions & filters. * * @package Astra Addon * @since 3.5.7 */ /** * Astra_Addon_Update_Filter_Function initial setup. * * @since 3.5.7 */ class Astra_Addon_Update_Filter_Function { /** * Check backwards compatibility to not load default CSS for the button styling of Page Builders. * * @since 2.2.0 * @return boolean true if button style CSS should be loaded, False if not. */ public static function page_builder_addon_button_style_css() { return apply_filters( 'astra_addon_page_builder_button_style_css', astra_get_option( 'pb-button-color-compatibility-addon', true ) ); } /** * Font CSS support for widget-title heading fonts & fonts which are not working in editor. * * 1. Adding Font-weight support to widget titles. * 2. Customizer font CSS not supporting in editor. * * @since 3.5.1 * @return boolean false if it is an existing user, true if not. */ public static function support_addon_font_css_to_widget_and_in_editor() { $astra_settings = get_option( ASTRA_THEME_SETTINGS ); $astra_settings['can-support-widget-and-editor-fonts'] = isset( $astra_settings['can-support-widget-and-editor-fonts'] ) ? false : true; return apply_filters( 'astra_heading_fonts_typo_support', $astra_settings['can-support-widget-and-editor-fonts'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } /** * Support cart color setting to default cart icon, till now with other cart icons have this color comaptibility but default one don't have this. * This case is only for old header layout. * * @since 3.5.1 * @return boolean false if it is an existing user, true if not. */ public static function astra_cart_color_default_icon_old_header() { $astra_settings = get_option( ASTRA_THEME_SETTINGS ); $astra_settings['can-reflect-cart-color-in-old-header'] = isset( $astra_settings['can-reflect-cart-color-in-old-header'] ) ? false : true; return apply_filters( 'astra_support_default_cart_color_in_old_header', $astra_settings['can-reflect-cart-color-in-old-header'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } /** * In old header for Cart widget we have background: #ffffff; for outline cart, whereas this CSS missed in new HFB > Cart element. Adding it now as per support requests. * This case is only for new header builder > WooCommerce cart. * * @since 3.5.7 * @return boolean false if it is an existing user, true if not. */ public static function astra_add_bg_color_outline_cart_header_builder() { $astra_settings = get_option( ASTRA_THEME_SETTINGS ); $astra_settings['add-outline-cart-bg-new-header'] = isset( $astra_settings['add-outline-cart-bg-new-header'] ) ? false : true; return apply_filters( 'astra_apply_background_to_outline_cart_builder_element', $astra_settings['add-outline-cart-bg-new-header'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } /** * Remove 'Header Sections' addon dependency * * @since 3.5.7 * @return boolean false if it is an existing user, true if not. */ public static function astra_remove_header_sections_deps_header_builder() { $astra_settings = get_option( ASTRA_THEME_SETTINGS ); $astra_settings['remove-header-sections-deps-in-new-header'] = isset( $astra_settings['remove-header-sections-deps-in-new-header'] ) ? false : true; return apply_filters( 'astra_remove_header_sections_dependency', $astra_settings['remove-header-sections-deps-in-new-header'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } /** * Check whether to update variant selected style or not. * * @since 3.9.3 * @return boolean false if it is an existing user, true if not. */ public static function astra_addon_update_variant_active_style() { $astra_settings = get_option( ASTRA_THEME_SETTINGS ); $astra_settings['can-update-variant-active-style'] = isset( $astra_settings['can-update-variant-active-style'] ) ? false : true; return apply_filters( 'astra_addon_update_wc_variant_style', $astra_settings['can-update-variant-active-style'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } } class-astra-addon-update.php 0000644 00000003234 15150261777 0012052 0 ustar 00 <?php /** * Astra Addon Update * * @package Astra Addon */ if ( ! class_exists( 'Astra_Addon_Update' ) ) { /** * Astra_Addon_Update initial setup * * @since 1.0.0 */ class Astra_Addon_Update { /** * Class instance. * * @var $instance Class instance. */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { // Theme Updates. add_action( 'astra_update_before', __CLASS__ . '::init' ); } /** * Implement addon update logic. * * @since 1.0.0 * @return void */ public static function init() { do_action( 'astra_addon_update_before' ); // Get auto saved version number. $saved_version = self::astra_addon_stored_version(); // If there is no saved version in the database then return. if ( false === $saved_version ) { return; } // If equals then return. if ( version_compare( $saved_version, ASTRA_EXT_VER, '=' ) ) { return; } } /** * Return Astra Addon saved version. */ public static function astra_addon_stored_version() { $theme_options = get_option( 'astra-settings' ); $value = ( isset( $theme_options['astra-addon-auto-version'] ) && '' !== $theme_options['astra-addon-auto-version'] ) ? $theme_options['astra-addon-auto-version'] : false; return $value; } } } /** * Kicking this off by calling 'get_instance()' method */ Astra_Addon_Update::get_instance(); class-astra-admin-helper.php 0000644 00000004645 15150261777 0012061 0 ustar 00 <?php /** * Admin settings helper * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Astra Addon * @link https://wpastra.com/ * @since Astra 1.0 */ if ( ! class_exists( 'Astra_Admin_Helper' ) ) : /** * Admin Helper */ // @codingStandardsIgnoreStart final class Astra_Admin_Helper { // @codingStandardsIgnoreEnd /** * Returns an option from the database for * the admin settings page. * * @since 1.0.0 * @since 1.5.1 Added $default parameter which can be passed to get_option|get_site_option functions. * * @param string $key The option key. * @param boolean $network Whether to allow the network admin setting to be overridden on subsites. * @param mixed $default Default value to be passed to get_option|get_site_option functions. * @return string Return the option value */ public static function get_admin_settings_option( $key, $network = false, $default = false ) { // Get the site-wide option if we're in the network admin. if ( $network && is_multisite() ) { $value = get_site_option( $key, $default ); } else { $value = get_option( $key, $default ); } 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; class-astra-builder.php 0000644 00000032626 15150261777 0011142 0 ustar 00 <?php /** * Astra Builder * * @package Astra Addon */ if ( ! class_exists( 'Astra_Builder' ) ) { /** * Astra_Builder initial setup * * @since 3.0.0 */ // @codingStandardsIgnoreStart class Astra_Builder { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound // @codingStandardsIgnoreEnd /** * Member Variable * * @var instance */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_filter( 'astra_footer_row_layout', function( $layout ) { // Modify Layouts here. return $layout; } ); add_filter( 'astra_header_desktop_items', array( $this, 'update_header_builder_desktop_items' ) ); add_filter( 'astra_header_mobile_items', array( $this, 'update_header_builder_mobile_items' ) ); add_filter( 'astra_footer_desktop_items', array( $this, 'update_footer_builder_desktop_items' ) ); add_action( 'astra_render_header_components', array( $this, 'render_header_components' ), 10, 2 ); add_action( 'astra_render_footer_components', array( $this, 'render_footer_dynamic_components' ) ); } /** * Update default header builder's desktop components. * * @param array $header_items array of header elements which will load in customizer builder layout. * @return array Array of desktop components. * * @since 3.0.0 */ public function update_header_builder_desktop_items( $header_items ) { $cloned_component_track = astra_addon_builder_helper()->component_count_array; $num_of_header_divider = astra_addon_builder_helper()->num_of_header_divider; for ( $index = 1; $index <= $num_of_header_divider; $index++ ) { $header_divider_section = 'section-hb-divider-' . $index; if ( isset( $cloned_component_track['removed-items'] ) && in_array( $header_divider_section, $cloned_component_track['removed-items'], true ) ) { continue; } $header_items[ 'divider-' . $index ] = array( 'name' => ( 1 === $num_of_header_divider ) ? 'Divider' : 'Divider ' . $index, 'icon' => 'minus', 'section' => $header_divider_section, 'clone' => true, 'type' => 'divider', 'builder' => 'header', ); } $header_items['language-switcher'] = array( 'name' => __( 'Language Switcher', 'astra-addon' ), 'icon' => 'translation', 'section' => 'section-hb-language-switcher', ); if ( version_compare( ASTRA_THEME_VERSION, '3.2.0', '>' ) ) { $header_items['mobile-trigger'] = array( 'name' => __( 'Toggle Button', 'astra-addon' ), 'icon' => 'menu-alt', 'section' => 'section-header-mobile-trigger', ); } $header_items['mobile-menu'] = array( 'name' => __( 'Off-Canvas Menu', 'astra-addon' ), 'icon' => 'menu-alt', 'section' => 'section-header-mobile-menu', ); return $header_items; } /** * Update default header builder's mobile components. * * @param array $mobile_items array of mobile elements which will load in customizer builder layout. * @return array Array of mobile components. * * @since 3.0.0 */ public function update_header_builder_mobile_items( $mobile_items ) { $cloned_component_track = astra_addon_builder_helper()->component_count_array; $num_of_header_divider = astra_addon_builder_helper()->num_of_header_divider; for ( $index = 1; $index <= $num_of_header_divider; $index++ ) { $header_mobile_divider_section = 'section-hb-divider-' . $index; if ( isset( $cloned_component_track['removed-items'] ) && in_array( $header_mobile_divider_section, $cloned_component_track['removed-items'], true ) ) { continue; } $mobile_items[ 'divider-' . $index ] = array( 'name' => ( 1 === $num_of_header_divider ) ? 'Divider' : 'Divider ' . $index, 'icon' => 'minus', 'section' => $header_mobile_divider_section, 'clone' => true, 'type' => 'divider', 'builder' => 'header', ); } $mobile_items['language-switcher'] = array( 'name' => __( 'Language Switcher', 'astra-addon' ), 'icon' => 'translation', 'section' => 'section-hb-language-switcher', ); return $mobile_items; } /** * Update default footer builder's components. * * @param array $footer_items array of footer elements which will load in customizer builder layout. * @return array Array of footer components. * * @since 3.0.0 */ public function update_footer_builder_desktop_items( $footer_items ) { $cloned_component_track = astra_addon_builder_helper()->component_count_array; $num_of_footer_divider = astra_addon_builder_helper()->num_of_footer_divider; for ( $index = 1; $index <= $num_of_footer_divider; $index++ ) { $footer_divider_section = 'section-fb-divider-' . $index; if ( isset( $cloned_component_track['removed-items'] ) && in_array( $footer_divider_section, $cloned_component_track['removed-items'], true ) ) { continue; } $footer_items[ 'divider-' . $index ] = array( 'name' => ( 1 === $num_of_footer_divider ) ? 'Divider' : 'Divider ' . $index, 'icon' => 'minus', 'section' => $footer_divider_section, 'clone' => true, 'type' => 'divider', 'builder' => 'footer', ); } $footer_items['language-switcher'] = array( 'name' => __( 'Language Switcher', 'astra-addon' ), 'icon' => 'translation', 'section' => 'section-fb-language-switcher', ); return $footer_items; } /** * Render header component. * * @param string $slug component slug. * @param string $device device. */ public function render_header_components( $slug, $device = '' ) { $this->render_header_dynamic_components( $slug, $device ); } /** * Render header dynamic components. * * @param string $slug slug. * @param string $device device. */ public function render_header_dynamic_components( $slug, $device ) { if ( 0 === strpos( $slug, 'html' ) ) { ?> <div class="ast-builder-layout-element site-header-focus-item ast-header-<?php echo esc_attr( $slug ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_header_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'button' ) ) { ?> <div class="ast-builder-layout-element site-header-focus-item ast-header-<?php echo esc_attr( $slug ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_header_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'widget' ) ) { ?> <aside <?php echo wp_kses_post( astra_attr( 'header-widget-area-inner', array( 'class' => 'header-widget-area widget-area site-header-focus-item', 'data-section' => 'sidebar-widgets-header-' . esc_attr( $slug ), ) ) ); ?> > <?php if ( is_customize_preview() && class_exists( 'Astra_Builder_UI_Controller' ) ) { Astra_Builder_UI_Controller::render_customizer_edit_button(); } if ( function_exists( 'astra_markup_open' ) ) { astra_markup_open( 'header-widget-div', array( 'echo' => true ) ); } else { ?> <div class="header-widget-area-inner site-info-inner"> <?php } astra_get_sidebar( 'header-' . str_replace( '_', '-', $slug ) ); if ( function_exists( 'astra_markup_close' ) ) { astra_markup_close( 'header-widget-div', array( 'echo' => true ) ); } else { ?> </div> <?php } ?> </aside> <?php } elseif ( 0 === strpos( $slug, 'menu' ) ) { ?> <div class="ast-builder-<?php echo esc_attr( $slug ); ?> ast-builder-menu ast-builder-<?php echo esc_attr( $slug ); ?>-focus-item ast-builder-layout-element site-header-focus-item" data-section="section-hb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_header_' . str_replace( '-', '_', $slug ); do_action( $action_name, $device ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'social-icons' ) ) { $index = str_replace( 'social-icons-', '', $slug ); ?> <div class="ast-builder-layout-element site-header-focus-item" data-section="section-hb-social-icons-<?php echo esc_attr( $index ); ?>"> <?php $action_name = 'astra_header_social_' . $index; do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'divider' ) ) { $layout_class = astra_get_option( 'header-' . $slug . '-layout' ); ?> <div class="ast-builder-layout-element site-header-focus-item ast-header-divider-element ast-header-<?php echo esc_attr( $slug ); ?> ast-hb-divider-layout-<?php echo esc_attr( $layout_class ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_header_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'language-switcher' ) ) { $layout_class = astra_get_option( 'header-' . $slug . '-layout' ); ?> <div class="ast-builder-layout-element site-header-focus-item ast-header-language-switcher-element ast-header-<?php echo esc_attr( $slug ); ?> ast-hb-language-switcher-layout-<?php echo esc_attr( $layout_class ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_header_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } } /** * Render footer dynamic components. * * @param string $slug slug. */ public function render_footer_dynamic_components( $slug ) { if ( 0 === strpos( $slug, 'html' ) ) { ?> <div class="footer-widget-area widget-area site-footer-focus-item ast-footer-<?php echo esc_attr( $slug ); ?>" data-section="section-fb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_footer_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'button' ) ) { ?> <div class="ast-builder-layout-element site-footer-focus-item ast-footer-<?php echo esc_attr( $slug ); ?>" data-section="section-fb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_footer_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'widget' ) ) { ?> <aside <?php echo wp_kses_post( astra_attr( 'footer-widget-area-inner', array( 'class' => 'footer-widget-area widget-area site-footer-focus-item', 'data-section' => 'sidebar-widgets-footer-' . esc_attr( $slug ), ) ) ); ?> > <?php if ( function_exists( 'astra_markup_open' ) ) { astra_markup_open( 'footer-widget-div', array( 'echo' => true ) ); } else { ?> <div class="footer-widget-area-inner site-info-inner"> <?php } astra_get_sidebar( 'footer-' . str_replace( '_', '-', $slug ) ); if ( function_exists( 'astra_markup_close' ) ) { astra_markup_close( 'footer-widget-div', array( 'echo' => true ) ); } else { ?> </div> <?php } ?> </aside> <?php } elseif ( 0 === strpos( $slug, 'social-icons' ) ) { $index = str_replace( 'social-icons-', '', $slug ); ?> <div class="ast-builder-layout-element site-footer-focus-item" data-section="section-fb-social-icons-<?php echo esc_attr( $index ); ?>"> <?php $action_name = 'astra_footer_social_' . $index; do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'divider' ) ) { $layout_class = astra_get_option( 'footer-' . $slug . '-layout' ); ?> <div class="footer-widget-area widget-area site-footer-focus-item ast-footer-divider-element ast-footer-<?php echo esc_attr( $slug ); ?> ast-fb-divider-layout-<?php echo esc_attr( $layout_class ); ?>" data-section="section-fb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_footer_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } elseif ( 0 === strpos( $slug, 'language-switcher' ) ) { $layout_class = astra_get_option( 'footer-' . $slug . '-layout' ); ?> <div class="ast-builder-layout-element site-footer-focus-item ast-footer-language-switcher-element ast-footer-<?php echo esc_attr( $slug ); ?> ast-fb-language-switcher-layout-<?php echo esc_attr( $layout_class ); ?>" data-section="section-fb-<?php echo esc_attr( $slug ); ?>"> <?php $action_name = 'astra_footer_' . str_replace( '-', '_', $slug ); do_action( $action_name ); ?> </div> <?php } } } } /** * Prepare if class 'Astra_Builder' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Builder::get_instance(); class-astra-ext-extension.php 0000644 00000006645 15150261777 0012330 0 ustar 00 <?php /** * Astra Extension Class * * @package Astra Addon */ /** * Provide Extension related data. * * @since 1.0 */ // @codingStandardsIgnoreStart final class Astra_Ext_Extension { // @codingStandardsIgnoreEnd /** * Default Extensions * * @since 1.4.8 * @return array */ public static function get_default_addons() { return apply_filters( 'astra_addon_ext_default_addons', array( 'advanced-search' => 'advanced-search', ) ); } /** * Provide Extension array(). * * @return array() * @since 1.0 */ public static function get_addons() { $extensions = array( 'advanced-hooks' => array(), 'blog-pro' => array(), 'colors-and-background' => array(), 'advanced-footer' => array(), 'mobile-header' => array(), 'header-sections' => array(), 'lifterlms' => array(), 'learndash' => array(), 'advanced-headers' => array(), 'site-layouts' => array(), 'spacing' => array(), 'sticky-header' => array(), 'transparent-header' => array(), 'typography' => array(), 'woocommerce' => array(), 'edd' => array(), 'nav-menu' => array(), ); return apply_filters( 'astra_addon_get_addons', $extensions ); } /** * Provide Enable Extension array(). * * @return array() * @since 1.0 */ public static function get_enabled_addons() { $enabled_data = array(); $extensions = self::get_addons(); $enabled_extensions = Astra_Admin_Helper::get_admin_settings_option( '_astra_ext_enabled_extensions' ); if ( empty( $enabled_extensions ) ) { foreach ( $extensions as $slug => $data ) { $enabled_data[ $slug ] = ( isset( $data['default'] ) ) ? $data['default'] : false; } $enabled_data['all'] = 'all'; } else { $enabled_data = $enabled_extensions; if ( isset( $enabled_extensions['all'] ) && false != $enabled_extensions['all'] ) { // add new key. foreach ( $extensions as $slug => $data ) { if ( ! array_key_exists( $slug, $enabled_extensions ) ) { $enabled_data[ $slug ] = ( isset( $data['default'] ) ) ? $data['default'] : false; } } } } return apply_filters( 'astra_addon_enabled_extensions', $enabled_data ); } /** * Check extension status * * @param string $key Key to find in Extensions Array. * @param boolean $default Default if Key not exist in Extensions Array. * @return boolean * @since 1.0 */ public static function is_active( $key, $default = false ) { $extensions = array_merge( self::get_enabled_addons(), self::get_default_addons() ); if ( array_key_exists( $key, $extensions ) && $extensions[ $key ] ) { return true; } else { return $default; } } /** * Provide Custom 404 array(). * * @return array() * @since 1.0 */ public static function get_custom_404() { $custom_404_default = array( 'enable_404' => false, 'page_404' => '', 'page_404_id' => '', ); $custom_404 = Astra_Admin_Helper::get_admin_settings_option( '_astra_ext_custom_404' ); if ( empty( $custom_404 ) ) { $custom_404 = $custom_404_default; } $custom_404 = apply_filters( 'astra_addon_custom_404_options', $custom_404_default ); return $custom_404; } } class-astra-ext-model.php 0000644 00000022356 15150261777 0011411 0 ustar 00 <?php /** * Astra Extension Model Class * * @package Astra Addon */ /** * Provide Extension related data. * * @since 1.0 */ // @codingStandardsIgnoreStart final class Astra_Ext_Model { // @codingStandardsIgnoreEnd /** * Construct */ public function __construct() { if ( class_exists( 'Astra_Customizer' ) ) { $this->load_extensions(); } if ( Astra_Ext_Extension::is_active( 'advanced-headers' ) || Astra_Ext_Extension::is_active( 'advanced-hooks' ) ) { add_action( 'admin_bar_menu', array( $this, 'add_admin_menu' ), 90 ); add_action( 'wp_head', array( $this, 'print_style' ) ); } } /** * Load Extensions * * @return void */ public function load_extensions() { $enabled_extension = Astra_Ext_Extension::get_enabled_addons(); $default_extensions = Astra_Ext_Extension::get_default_addons(); $enabled_extension = $enabled_extension + $default_extensions; if ( 0 < count( $enabled_extension ) ) { if ( isset( $enabled_extension['all'] ) ) { unset( $enabled_extension['all'] ); } foreach ( $enabled_extension as $slug => $value ) { if ( false == $value ) { continue; } $extension_path = ASTRA_EXT_DIR . 'addons/' . esc_attr( $slug ) . '/class-astra-ext-' . esc_attr( $slug ) . '.php'; $extension_path = apply_filters( 'astra_addon_path', $extension_path, $slug ); // Check for the extension. if ( file_exists( $extension_path ) ) { require_once $extension_path; } } } } /** * Add Admin menu item * * @param object WP_Admin_Bar $admin_bar Admin bar. * @return void * @since 4.0.0 */ public function add_admin_menu( $admin_bar ) { if ( is_admin() ) { return; } // Check if current user can have edit access. if ( ! current_user_can( 'edit_posts' ) ) { return; } $custom_layout_addon_active = Astra_Ext_Extension::is_active( 'advanced-hooks' ) ? true : false; $page_headers_addon_active = Astra_Ext_Extension::is_active( 'advanced-headers' ) ? true : false; $post_id = get_the_ID() ? get_the_ID() : 0; $current_post = $post_id ? get_post( $post_id, OBJECT ) : false; $has_shortcode = ( is_object( $current_post ) && has_shortcode( $current_post->post_content, 'astra_custom_layout' ) ) ? true : false; if ( $custom_layout_addon_active || $page_headers_addon_active || $has_shortcode ) { $custom_layouts = false; if ( $custom_layout_addon_active ) { $option = array( 'location' => 'ast-advanced-hook-location', 'exclusion' => 'ast-advanced-hook-exclusion', 'users' => 'ast-advanced-hook-users', ); $custom_layouts = Astra_Target_Rules_Fields::get_instance()->get_posts_by_conditions( ASTRA_ADVANCED_HOOKS_POST_TYPE, $option ); } $page_headers = false; if ( $page_headers_addon_active ) { $option = array( 'location' => 'ast-advanced-headers-location', 'exclusion' => 'ast-advanced-headers-exclusion', 'users' => 'ast-advanced-headers-users', 'page_meta' => 'adv-header-id-meta', ); $page_headers = Astra_Target_Rules_Fields::get_instance()->get_posts_by_conditions( 'astra_adv_header', $option ); } if ( $custom_layouts || $page_headers || $has_shortcode ) { $admin_bar->add_node( array( 'id' => 'astra-advanced-layouts', 'title' => '<span class="ab-item astra-admin-logo"></span>', ) ); } if ( is_array( $custom_layouts ) && ! empty( $custom_layouts ) ) { $admin_bar->add_group( array( 'id' => 'ast_custom_layouts_group', 'parent' => 'astra-advanced-layouts', ) ); $admin_bar->add_node( array( 'id' => 'custom-layout-title', 'parent' => 'ast_custom_layouts_group', 'title' => esc_html__( 'Edit Custom Layout', 'astra-addon' ), ) ); // Add dynamic layouts assigned on current location. foreach ( $custom_layouts as $post_id => $post_data ) { $post_type = get_post_type(); if ( ASTRA_ADVANCED_HOOKS_POST_TYPE != $post_type ) { $layout_title = get_the_title( $post_id ); $admin_bar->add_node( array( 'id' => 'edit-custom-layout-' . esc_attr( $post_id ), 'href' => esc_url( get_edit_post_link( $post_id ) ), 'title' => esc_attr( $layout_title ), 'parent' => 'ast_custom_layouts_group', ) ); } } } if ( is_array( $page_headers ) && ! empty( $page_headers ) ) { $admin_bar->add_group( array( 'id' => 'ast_page_headers_group', 'parent' => 'astra-advanced-layouts', ) ); $admin_bar->add_node( array( 'id' => 'page-headers-title', 'parent' => 'ast_page_headers_group', 'title' => esc_html__( 'Edit Page Header', 'astra-addon' ), ) ); // Add dynamic headers assigned on current location. foreach ( $page_headers as $post_id => $post_data ) { $post_type = get_post_type(); if ( 'astra_adv_header' != $post_type ) { $layout_title = get_the_title( $post_id ); $admin_bar->add_node( array( 'id' => 'edit-page-header-' . esc_attr( $post_id ), 'href' => esc_url( get_edit_post_link( $post_id ) ), 'title' => esc_attr( $layout_title ), 'parent' => 'ast_page_headers_group', ) ); } } } if ( $has_shortcode ) { $pattern = get_shortcode_regex( array( 'astra_custom_layout' ) ); if ( preg_match_all( '/' . $pattern . '/s', $current_post->post_content, $matches ) ) { $output = array(); foreach ( $matches[0] as $key => $value ) { $as_string = str_replace( ' ', '&', trim( $matches[3][ $key ] ) ); // $matches[3] return the shortcode attribute as string & replace space with '&' for parse_str() function. $as_string = str_replace( '"', '', $as_string ); parse_str( $as_string, $sub_attrs ); $output[] = $sub_attrs; // Get all shortcode attribute keys. } if ( ! empty( $output ) ) { $admin_bar->add_group( array( 'id' => 'ast_cl_shortcode_group', 'parent' => 'astra-advanced-layouts', ) ); $admin_bar->add_node( array( 'id' => 'cl-shortcode-title', 'parent' => 'ast_cl_shortcode_group', 'title' => esc_html__( 'Edit Shortcode Layouts', 'astra-addon' ), ) ); foreach ( $output as $key => $value ) { foreach ( $value as $attr_key => $attr_val ) { $cl_layout_id = absint( $attr_val ); $layout_title = get_the_title( $cl_layout_id ); $admin_bar->add_node( array( 'id' => 'edit-cl-shortcode-layout-' . esc_attr( $cl_layout_id ), 'href' => esc_url( get_edit_post_link( $cl_layout_id ) ), 'title' => esc_attr( $layout_title ), 'parent' => 'ast_cl_shortcode_group', ) ); } } } } } } } /** * Print style. * * Adds custom CSS to the HEAD html tag. The CSS for admin bar Astra's trigger. * * Fired by `wp_head` filter. * * @since 4.0.0 */ public function print_style() { $branding_logo = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0iI2E3YWFhZCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik05IDE4QzEzLjk3MDcgMTggMTggMTMuOTcwNyAxOCA5QzE4IDQuMDI5MyAxMy45NzA3IDAgOSAwQzQuMDI5MyAwIDAgNC4wMjkzIDAgOUMwIDEzLjk3MDcgNC4wMjkzIDE4IDkgMThaTTQgMTIuOTk4TDguMzk2IDRMOS40NDE0MSA2LjAzMTI1TDUuODgzNzkgMTIuOTk4SDRaTTguNTM0NjcgMTEuMzc1TDEwLjM0OTEgNy43MjA3TDEzIDEzSDEwLjk3NzFMMTAuMjc5MyAxMS40NDM0SDguNTM0NjdIOC41TDguNTM0NjcgMTEuMzc1WiIgZmlsbD0iI2E3YWFhZCIvPgo8L3N2Zz4K'; if ( false !== Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra', 'icon' ) ) { $branding_logo = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra', 'icon' ); } ?> <style> #wp-admin-bar-astra-advanced-layouts .astra-admin-logo { float: left; width: 20px; height: 100%; cursor: pointer; background-repeat: no-repeat; background-position: center; background-size: 16px auto; color: #a7aaad; background-image: url( <?php echo esc_attr( $branding_logo ); ?> ); } #wpadminbar .quicklinks #wp-admin-bar-astra-advanced-layouts .ab-empty-item { padding: 0 5px; } #wpadminbar #wp-admin-bar-astra-advanced-layouts .ab-submenu { padding: 5px 10px; } #wpadminbar .quicklinks #wp-admin-bar-astra-advanced-layouts li { clear: both; } #wp-admin-bar-ast_page_headers_group:before { border-bottom: 1px solid hsla(0,0%,100%,.2); display: block; float: left; content: ""; margin-bottom: 10px; width: 100%; } #wpadminbar #wp-admin-bar-ast_custom_layouts_group li a:before, #wpadminbar #wp-admin-bar-ast_cl_shortcode_group li a:before, #wpadminbar #wp-admin-bar-ast_page_headers_group li a:before { content: "\21B3"; margin-right: 0.5em; opacity: 0.5; font-size: 13px; } </style> <?php } } new Astra_Ext_Model(); class-astra-ext-white-label-markup.php 0000644 00000062624 15150261777 0014005 0 ustar 00 <?php /** * White Label Markup * * @package Astra Pro */ if ( ! class_exists( 'Astra_Ext_White_Label_Markup' ) ) { /** * White Label Markup Initial Setup * * @since 1.0.0 */ // @codingStandardsIgnoreStart class Astra_Ext_White_Label_Markup { // @codingStandardsIgnoreEnd /** * Member Variable * * @var object instance */ private static $instance; /** * Member Variable * * @var array instance * @deprecated 1.6.15 */ public static $branding; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_filter( 'astra_theme_author', array( $this, 'theme_author_callback' ) ); if ( is_admin() ) { add_filter( 'all_plugins', array( $this, 'plugins_page' ) ); add_filter( 'wp_prepare_themes_for_js', array( $this, 'themes_page' ) ); add_filter( 'all_themes', array( $this, 'network_themes_page' ) ); add_filter( 'update_right_now_text', array( $this, 'admin_dashboard_page' ) ); add_action( 'customize_render_section', array( $this, 'theme_customizer' ) ); // Change menu page title. add_filter( 'astra_menu_page_title', array( $this, 'menu_page_title' ), 10, 1 ); add_filter( 'astra_theme_name', array( $this, 'menu_page_title' ), 10, 1 ); add_filter( 'astra_addon_name', array( $this, 'addon_page_name' ), 10, 1 ); // Theme welcome Page right sections filter. add_filter( 'astra_support_link', array( $this, 'agency_author_link' ), 10, 1 ); add_filter( 'astra_community_group_link', array( $this, 'agency_author_link' ), 10, 1 ); add_filter( 'astra_knowledge_base_documentation_link', array( $this, 'agency_author_link' ), 10, 1 ); add_filter( 'astra_starter_sites_documentation_link', array( $this, 'agency_author_link' ), 10, 1 ); add_filter( 'astra_site_url', array( $this, 'agency_author_link' ), 10, 1 ); if ( false !== self::get_whitelabel_string( 'astra', 'name', false ) ) { // Gettext filter. add_filter( 'gettext', array( $this, 'theme_gettext' ), 20, 3 ); } if ( false !== self::astra_pro_whitelabel_name() ) { add_filter( 'gettext', array( $this, 'plugin_gettext' ), 20, 3 ); } // Add menu item. if ( ! self::show_branding() ) { // Remove Action Heading if white label is enabled. add_filter( 'astra_advanced_hooks_list_action_column_headings', array( $this, 'remove_white_label_action' ), 10, 1 ); // Remove Action Description. add_filter( 'astra_custom_layouts_hooks', array( $this, 'remove_description_custom_layouts' ), 10, 1 ); // Rename custom layout post url slug. add_filter( 'astra_advanced_hooks_rewrite_slug', array( $this, 'change_custom_hook_url_slug' ), 20, 2 ); // Hide Themes section in the customizer as the theme name cannot be edited in it. add_action( 'customize_register', array( $this, 'remove_themes_section' ), 30 ); add_filter( 'bsf_product_changelog_astra-addon', '__return_empty_string' ); add_filter( 'bsf_white_label_options', array( $this, 'astra_bsf_analytics_white_label' ) ); } // Add menu item. add_filter( 'astra_addon_licence_url', array( $this, 'addon_licence_url' ), 10, 1 ); // Change the theme page slug only if the value if added by user. $theme_whitelabelled_name = self::get_whitelabel_string( 'astra', 'name', false ); if ( false !== $theme_whitelabelled_name && ! empty( $theme_whitelabelled_name ) ) { add_filter( 'astra_theme_page_slug', array( $this, 'astra_whitelabelled_slug' ) ); add_filter( 'admin_body_class', array( $this, 'astra_page_admin_classes' ) ); } } add_action( 'admin_enqueue_scripts', array( $this, 'updates_core_page' ) ); // White Label graupi updates screen. add_filter( 'bsf_product_name_astra-addon', array( $this, 'astra_pro_whitelabel_name' ) ); add_filter( 'bsf_product_description_astra-addon', array( $this, 'astra_pro_whitelabel_description' ) ); add_filter( 'bsf_product_author_astra-addon', array( $this, 'astra_pro_whitelabel_author' ) ); add_filter( 'bsf_product_homepage_astra-addon', array( $this, 'astra_pro_whitelabel_author_url' ) ); if ( false !== self::get_whitelabel_string( 'astra', 'screenshot' ) ) { add_filter( 'bsf_product_icons_astra-addon', array( $this, 'astra_pro_branded_icons' ) ); } if ( false !== self::get_whitelabel_string( 'astra', 'icon' ) ) { add_filter( 'astra_admin_menu_icon', array( $this, 'update_admin_brand_logo' ) ); } } /** * Add admin page class to Astra Options page. * * @since 1.6.14 * @param String $classes CSS class names for thee body attribute. * @return String SS class names for thee body attribute with new CSS classes for Astra Options page. */ public function astra_page_admin_classes( $classes ) { $current_screen = get_current_screen(); if ( 'toplevel_page_' . $this->astra_whitelabelled_slug( 'astra' ) === $current_screen->base ) { $classes = $classes . ' toplevel_page_astra'; } return $classes; } /** * Provide White Label array(). * * @return array() * @since 1.0 */ public static function get_white_labels() { $branding_default = apply_filters( 'astra_addon_branding_options', array( 'astra-agency' => array( 'author' => '', 'author_url' => '', 'licence' => '', 'hide_branding' => false, ), 'astra' => array( 'name' => '', 'description' => '', 'screenshot' => '', 'icon' => '', ), 'astra-pro' => array( 'name' => '', 'description' => '', ), ) ); $branding = Astra_Admin_Helper::get_admin_settings_option( '_astra_ext_white_label', true ); $branding = wp_parse_args( $branding, $branding_default ); return apply_filters( 'astra_addon_get_white_labels', $branding ); } /** * Get individual whitelabel setting. * * @param String $product Product Slug for which whitelabel value is to be received. * @param String $key whitelabel key to be received from the database. * @param mixed $default default value to be returned if the whitelabel value is not set by user. * * @return mixed. */ public static function get_whitelabel_string( $product, $key, $default = false ) { $constant = self::branding_key_to_constant( $product, $key ); if ( defined( $constant ) ) { return constant( $constant ); } $whitelabel_settings = self::get_white_labels(); if ( isset( $whitelabel_settings[ $product ][ $key ] ) && '' !== $whitelabel_settings[ $product ][ $key ] ) { return $whitelabel_settings[ $product ][ $key ]; } return $default; } /** * Convert brainding key to a constant. * Adds a prefix of 'AST_WL_' to all the constants followed by uppercase of the product and uppercased key. * Agency Name will be converted to AST_WL_ASTRA_AGENCY_NAME * * @param String $product Product Slug for which whitelabel value is to be received. * @param String $key whitelabel key to be received from the database. * @return String constantified whitelabel key. */ public static function branding_key_to_constant( $product, $key ) { return 'AST_WL_' . strtoupper( str_replace( '-', '_', $product ) . '_' . str_replace( '-', '_', $key ) ); } /** * Show white label tab. * * @since 1.0 * @return bool true | false */ public static function show_branding() { $show_branding = true; if ( true === (bool) self::get_whitelabel_string( 'astra-agency', 'hide_branding', false ) ) { $show_branding = false; } if ( defined( 'WP_ASTRA_WHITE_LABEL' ) && WP_ASTRA_WHITE_LABEL ) { $show_branding = false; } return apply_filters( 'astra_addon_show_branding', $show_branding ); } /** * Get white label setting. * * @since 1.0 * @since 1.6.14 depracated method in favour of self::get_whitelabel_string(). * * @param array $option option name. * @param array $sub_option sub option name. * @return array() */ public static function get_white_label( $option = '', $sub_option = '' ) { // Officially depracate function in the version 1.6.15. // _deprecated_function( __METHOD__, '1.6.15', 'Astra_Ext_White_Label_Markup::get_whitelabel_string()' );. return self::get_whitelabel_string( $option, $sub_option ); } /** * White labels the plugins page. * * @param array $plugins Plugins Array. * @return array */ public function plugins_page( $plugins ) { $key = plugin_basename( ASTRA_EXT_DIR . 'astra-addon.php' ); if ( isset( $plugins[ $key ] ) && false !== self::astra_pro_whitelabel_name() ) { $plugins[ $key ]['Name'] = self::astra_pro_whitelabel_name(); $plugins[ $key ]['Description'] = self::astra_pro_whitelabel_description(); } $author = self::astra_pro_whitelabel_author(); $author_uri = self::astra_pro_whitelabel_author_url(); if ( ! empty( $author ) ) { $plugins[ $key ]['Author'] = $author; $plugins[ $key ]['AuthorName'] = $author; } if ( ! empty( $author_uri ) ) { $plugins[ $key ]['AuthorURI'] = $author_uri; $plugins[ $key ]['PluginURI'] = $author_uri; } return $plugins; } /** * White labels the theme on the themes page. * * @param array $themes Themes Array. * @return array */ public function themes_page( $themes ) { $astra_key = 'astra'; if ( isset( $themes[ $astra_key ] ) ) { if ( false !== self::get_whitelabel_string( 'astra', 'name', false ) ) { $themes[ $astra_key ]['name'] = self::get_whitelabel_string( 'astra', 'name', false ); foreach ( $themes as $key => $theme ) { if ( isset( $theme['parent'] ) && 'Astra' == $theme['parent'] ) { $themes[ $key ]['parent'] = self::get_whitelabel_string( 'astra', 'name', false ); } } } if ( false !== self::get_whitelabel_string( 'astra', 'description', false ) ) { $themes[ $astra_key ]['description'] = self::get_whitelabel_string( 'astra', 'description', false ); } if ( false !== self::get_whitelabel_string( 'astra-agency', 'author', false ) ) { $author_url = ( '' === self::get_whitelabel_string( 'astra-agency', 'author_url', '' ) ) ? '#' : self::get_whitelabel_string( 'astra-agency', 'author_url', '' ); $themes[ $astra_key ]['author'] = self::get_whitelabel_string( 'astra-agency', 'author', false ); $themes[ $astra_key ]['authorAndUri'] = '<a href="' . esc_url( $author_url ) . '">' . self::get_whitelabel_string( 'astra-agency', 'author', false ) . '</a>'; } if ( false !== self::get_whitelabel_string( 'astra', 'screenshot', false ) ) { $themes[ $astra_key ]['screenshot'] = array( self::get_whitelabel_string( 'astra', 'screenshot', false ) ); } // Change link and theme name from the heme popup for the update notification. if ( isset( $themes[ $astra_key ]['update'] ) ) { // Replace Theme name with whitelabel theme name. $themes[ $astra_key ]['update'] = str_replace( 'Astra', self::get_whitelabel_string( 'astra', 'name' ), $themes[ $astra_key ]['update'] ); // Replace Theme URL with Agency URL. $themes[ $astra_key ]['update'] = str_replace( 'https://wordpress.org/themes/astra/?TB_iframe=true&width=1024&height=800', esc_url_raw( add_query_arg( array( 'TB_iframe' => true, 'hight' => '800', 'width' => '1024', ), self::get_whitelabel_string( 'astra-agency', 'author_url', 'https://wordpress.org/themes/astra/?TB_iframe=true&width=1024&height=800' ) ) ), $themes[ $astra_key ]['update'] ); } } return $themes; } /** * White labels the theme on the network admin themes page. * * @param array $themes Themes Array. * @return array */ public function network_themes_page( $themes ) { $astra_key = 'astra'; if ( isset( $themes[ $astra_key ] ) && is_network_admin() ) { $network_theme_data = array(); if ( false !== self::get_whitelabel_string( 'astra', 'name', false ) ) { $network_theme_data['Name'] = self::get_whitelabel_string( 'astra', 'name', false ); foreach ( $themes as $theme_key => $theme ) { if ( isset( $theme['parent'] ) && 'Astra' == $theme['parent'] ) { $themes[ $theme_key ]['parent'] = self::get_whitelabel_string( 'astra', 'name', false ); } } } if ( false !== self::get_whitelabel_string( 'astra', 'description', false ) ) { $network_theme_data['Description'] = self::get_whitelabel_string( 'astra', 'description', false ); } if ( false !== self::get_whitelabel_string( 'astra-agency', 'author', false ) ) { $author_url = ( '' === self::get_whitelabel_string( 'astra-agency', 'author_url', '' ) ) ? '#' : self::get_whitelabel_string( 'astra-agency', 'author_url', '' ); $network_theme_data['Author'] = self::get_whitelabel_string( 'astra-agency', 'author', false ); $network_theme_data['AuthorURI'] = $author_url; $network_theme_data['ThemeURI'] = $author_url; } if ( count( $network_theme_data ) > 0 ) { $reflection_object = new ReflectionObject( $themes[ $astra_key ] ); $headers = $reflection_object->getProperty( 'headers' ); $headers->setAccessible( true ); $headers_sanitized = $reflection_object->getProperty( 'headers_sanitized' ); $headers_sanitized->setAccessible( true ); // Set white labeled theme data. $headers->setValue( $themes[ $astra_key ], $network_theme_data ); $headers_sanitized->setValue( $themes[ $astra_key ], $network_theme_data ); // Reset back to private. $headers->setAccessible( false ); $headers_sanitized->setAccessible( false ); } } return $themes; } /** * White labels the theme on the dashboard 'At a Glance' metabox * * @param mixed $content Content. * @return array */ public function admin_dashboard_page( $content ) { if ( is_admin() && 'Astra' == wp_get_theme() && false !== self::get_whitelabel_string( 'astra', 'name', false ) ) { return sprintf( $content, get_bloginfo( 'version', 'display' ), '<a href="themes.php">' . self::get_whitelabel_string( 'astra', 'name', false ) . '</a>' ); } return $content; } /** * White labels the theme using the gettext filter * to cover areas that we can't access like the Customizer. * * @param string $text Translated text. * @param string $original Text to translate. * @param string $domain Text domain. Unique identifier for retrieving translated strings. * @return string */ public function theme_gettext( $text, $original, $domain ) { if ( 'Astra' == $original ) { $text = self::get_whitelabel_string( 'astra', 'name', false ); } return $text; } /** * White labels the plugin using the gettext filter * to cover areas that we can't access. * * @param string $text Translated text. * @param string $original Text to translate. * @param string $domain Text domain. Unique identifier for retrieving translated strings. * @return string */ public function plugin_gettext( $text, $original, $domain ) { if ( 'Astra Pro' == $original ) { $text = self::astra_pro_whitelabel_name(); } return $text; } /** * White labels the builder theme using the `customize_render_section` hook * to cover areas that we can't access like the Customizer. * * @param object $instance Astra Object. * @return string Only return if theme branding has been filled up. */ public function theme_customizer( $instance ) { if ( 'Astra' == $instance->title ) { if ( false !== self::get_whitelabel_string( 'astra', 'name', false ) ) { $instance->title = self::get_whitelabel_string( 'astra', 'name', false ); return $instance->title; } } } /** * Allow to remove the theme switch in the customizer as the theme name cannot be edited * * @since 1.6.12 * @param object $wp_customize customizer object. */ public static function remove_themes_section( $wp_customize ) { $wp_customize->remove_panel( 'themes' ); } /** * Filter to update Theme Author Link * * @param array $args Theme Author Detail Array. * @return array */ public function theme_author_callback( $args ) { if ( false !== self::get_whitelabel_string( 'astra', 'name', false ) ) { $args['theme_name'] = self::get_whitelabel_string( 'astra', 'name', false ); } if ( false !== self::astra_pro_whitelabel_author_url() ) { $args['theme_author_url'] = self::astra_pro_whitelabel_author_url(); } return $args; } /** * Menu Page Title * * @param string $title Page Title. * @return string */ public function menu_page_title( $title ) { if ( false !== self::get_whitelabel_string( 'astra', 'name', false ) ) { $title = self::get_whitelabel_string( 'astra', 'name', false ); } return $title; } /** * Astra Pro plugin Title * * @param string $title Page Title. * @return string */ public function addon_page_name( $title ) { if ( false !== self::get_whitelabel_string( 'astra-pro', 'name', false ) ) { $title = self::get_whitelabel_string( 'astra-pro', 'name', false ); } return $title; } /** * Licence Url * * @param string $purchase_url Actions. * @return string */ public function addon_licence_url( $purchase_url ) { if ( false !== self::get_whitelabel_string( 'astra-agency', 'licence', false ) ) { $purchase_url = self::get_whitelabel_string( 'astra-agency', 'licence', false ); } return $purchase_url; } /** * Astra Theme Url * * @param string $url Author Url if given. * @return string */ public function agency_author_link( $url ) { if ( false !== self::astra_pro_whitelabel_author_url() ) { $url = self::astra_pro_whitelabel_author_url(); } return $url; } /** * Get Astra Pro whitelabelled name. * * @since 1.6.10 * @param String $name Original Product name from Graupi. * * @return String Astra Pro's whitelabelled name. */ public function astra_pro_whitelabel_name( $name = false ) { return self::get_whitelabel_string( 'astra-pro', 'name', $name ); } /** * Get Astra Pro whitelabelled description. * * @since 1.6.10 * @param String $description Original Product descriptionn from Graupi. * * @return String Astra Pro's whitelabelled description. */ public function astra_pro_whitelabel_description( $description = false ) { return self::get_whitelabel_string( 'astra-pro', 'description', $description ); } /** * Get Astra Pro whitelabelled author. * * @since 1.6.10 * @param String $author Original Product author from Graupi. * * @return String Astra Pro's whitelabelled author. */ public function astra_pro_whitelabel_author( $author = false ) { return self::get_whitelabel_string( 'astra-agency', 'author', $author ); } /** * Get Astra Pro whitelabelled author URL. * * @since 1.6.10 * @param String $author_url Original Product author URL from Graupi. * * @return String Astra Pro's whitelabelled author URL. */ public function astra_pro_whitelabel_author_url( $author_url = false ) { return self::get_whitelabel_string( 'astra-agency', 'author_url', $author_url ); } /** * Update Plugin icon to be whitelabelled. * * @since 1.6.14 * @return Array Default plugin using Theme screenshot image for Astra Pro. */ public function astra_pro_branded_icons() { return array( 'default' => self::get_whitelabel_string( 'astra', 'screenshot' ), ); } /** * Get whitelabelled icon for admin dashboard. * * @since 4.0.0 * @param string $admin_logo Default Astra icon. * @return string URL for updated whitelabelled icon. */ public function update_admin_brand_logo( $admin_logo ) { $admin_logo = self::get_whitelabel_string( 'astra', 'icon' ); // Dark version logo support for white admin canvas. if ( false !== strpos( $admin_logo, 'whitelabel-branding.svg' ) ) { $admin_logo = ASTRA_EXT_URI . 'admin/core/assets/images/whitelabel-branding-dark.svg'; } return esc_url( $admin_logo ); } /** * Remove White Label Actions. * * @param array $columns Custom layout actions. * @return array $columns Custom layout actions. */ public function remove_white_label_action( $columns ) { unset( $columns['advanced_hook_action'] ); return $columns; } /** * Remove custom layouts description. * * @param array $hooks Custom layout data. * @return array $hooks Custom layout data. */ public function remove_description_custom_layouts( $hooks = array() ) { if ( $hooks ) { foreach ( $hooks as $key => $hook_group ) { if ( array_key_exists( 'hooks', $hook_group ) ) { foreach ( $hook_group['hooks'] as $hook_group_key => $hook ) { if ( array_key_exists( 'description', $hook ) ) { unset( $hooks[ $key ]['hooks'][ $hook_group_key ]['description'] ); } } } } } return $hooks; } /** * Rewrite custom layouts slug. * * @param array $slug Custom layout slug. * @return array $slug Custom layout slug. */ public function change_custom_hook_url_slug( $slug ) { $theme_whitelabelled_name = self::get_whitelabel_string( 'astra', 'name', false ); // Get white label theme name. $theme_name = strtolower( self::astra_pro_whitelabel_name() ); $theme_name = str_replace( ' ', '-', $theme_name ); if ( false !== $theme_whitelabelled_name ) { $slug = str_replace( ' ', '-', $theme_whitelabelled_name ) . '-advanced-hook'; } return $slug; } /** * Get whitelabelled slug. * User entered display name of the plugin is converted to slug. * * @since 1.6.14 * @param String $name Default slug. * @return String slugified product name. */ public function astra_whitelabelled_slug( $name ) { return sanitize_key( rawurlencode( self::get_whitelabel_string( 'astra', 'name', $name ) ) ); } /** * Update strings on the update-core.php page. * * @since 1.6.14 * @return void */ public function updates_core_page() { global $pagenow; if ( false !== self::get_whitelabel_string( 'astra', 'icon' ) ) { echo '<style> #toplevel_page_' . esc_attr( $this->astra_whitelabelled_slug( 'astra' ) ) . ' .wp-menu-image { background-image: url( ' . esc_url( self::get_whitelabel_string( 'astra', 'icon' ) ) . ' ) !important; opacity: 0.6; background-size: 20px 34px; background-repeat: no-repeat; background-position: center; } #toplevel_page_' . esc_attr( $this->astra_whitelabelled_slug( 'astra' ) ) . '.wp-menu-open .wp-menu-image, #toplevel_page_' . esc_attr( $this->astra_whitelabelled_slug( 'astra' ) ) . ' .wp-has-current-submenu .wp-menu-image { opacity: 1; } </style>'; } if ( 'update-core.php' == $pagenow ) { $default_screenshot = sprintf( '%s/astra/screenshot.jpg?ver=%s', get_theme_root_uri(), ASTRA_THEME_VERSION ); $branded_screenshot = self::get_whitelabel_string( 'astra', 'screenshot', false ); $default_name = 'Astra'; $branded_name = self::get_whitelabel_string( 'astra', 'name', false ); if ( false !== $branded_screenshot ) { wp_add_inline_script( 'updates', " var _ast_default_ss = '$default_screenshot', _ast_branded_ss = '$branded_screenshot'; document.querySelectorAll( '#update-themes-table .plugin-title .updates-table-screenshot' ).forEach(function(theme) { if( _ast_default_ss === theme.src ) { theme.src = _ast_branded_ss; } });" ); } if ( false !== $branded_name ) { wp_add_inline_script( 'updates', " var _ast_default_name = '$default_name', _ast_branded_name = '" . esc_js( $branded_name ) . "'; document.querySelectorAll( '#update-themes-table .plugin-title strong' ) .forEach(function(plugin) { if( _ast_default_name === plugin.innerText ) { plugin.innerText = _ast_branded_name; } });" ); } } } /** * Return White Label status to BSF Analytics. * Return true if the White Label is enabled from Astra Addon to the BSF Analytics library. * * @since 2.4.1 * @param array $bsf_analytics_wl_arr BSF Analytics White Label products statuses array. * @return array product name with white label status. */ public function astra_bsf_analytics_white_label( $bsf_analytics_wl_arr ) { if ( ! isset( $bsf_analytics_wl_arr['astra_addon'] ) ) { $bsf_analytics_wl_arr['astra_addon'] = true; } return $bsf_analytics_wl_arr; } } } /** * Kicking this off by calling 'get_instance()' method */ Astra_Ext_White_Label_Markup::get_instance(); class-astra-icons.php 0000644 00000031075 15150261777 0010624 0 ustar 00 <?php /** * Icons for Astra Addon. * * @package Astra Addon * @link https://www.brainstormforce.com * @since Astra Addon 3.3.0 */ if ( ! class_exists( 'Astra_Icons' ) ) { /** * Icons Initial Setup * * @since 3.3.0 */ // @codingStandardsIgnoreStart class Astra_Icons { // @codingStandardsIgnoreEnd /** * Constructor function that initializes required actions and hooks */ public function __construct() { // Remove astra.woff and other format of Astra font files when SVG is enabled. if ( self::is_svg_icons() ) { add_filter( 'astra_enable_default_fonts', '__return_false' ); } } /** * Check if we need to load icons as SVG or fonts. * Returns true if SVG false if font. * * @since 3.3.0 * * @return boolean should be svg or font. */ public static function is_svg_icons() { $astra_settings = get_option( ASTRA_THEME_SETTINGS ); $astra_settings['can-update-astra-icons-svg'] = ( isset( $astra_settings['can-update-astra-icons-svg'] ) && false === $astra_settings['can-update-astra-icons-svg'] ) ? false : true; if ( version_compare( ASTRA_THEME_VERSION, '3.3.0', '>=' ) ) { return apply_filters( 'astra_is_svg_icons', $astra_settings['can-update-astra-icons-svg'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } return false; } /** * Get SVG icons. * Returns the SVG icon you want to display. * * @since 3.3.0 * * @param string $icon Key for the SVG you want to load. * @param boolean $is_echo whether to echo the output or return. * @param boolean $replace load close markup for SVG. * @param string $menu_location Creates dynamic filter for passed parameter. * * @return string SVG for passed key. */ public static function get_icons( $icon, $is_echo = false, $replace = false, $menu_location = 'main' ) { $output = ''; if ( true === self::is_svg_icons() ) { switch ( $icon ) { case 'menu-bars': $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="20px" height="20px" viewBox="57 41.229 26 18.806" enable-background="new 57 41.229 26 18.806" xml:space="preserve"> <path d="M82.5,41.724h-25v3.448h25V41.724z M57.5,48.907h25v3.448h-25V48.907z M82.5,56.092h-25v3.448h25V56.092z"/> </svg>'; break; case 'close': $output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18px" height="18px"> <path d="M71.029 71.029c9.373-9.372 24.569-9.372 33.942 0L256 222.059l151.029-151.03c9.373-9.372 24.569-9.372 33.942 0 9.372 9.373 9.372 24.569 0 33.942L289.941 256l151.03 151.029c9.372 9.373 9.372 24.569 0 33.942-9.373 9.372-24.569 9.372-33.942 0L256 289.941l-151.029 151.03c-9.373 9.372-24.569 9.372-33.942 0-9.372-9.373-9.372-24.569 0-33.942L222.059 256 71.029 104.971c-9.372-9.373-9.372-24.569 0-33.942z" /> </svg>'; break; case 'search': $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="-888 480 142 142" enable-background="new -888 480 142 142" xml:space="preserve"> <path d="M-787.4,568.7h-6.3l-2.4-2.4c7.9-8.7,12.6-20.5,12.6-33.1c0-28.4-22.9-51.3-51.3-51.3 c-28.4,0-51.3,22.9-51.3,51.3c0,28.4,22.9,51.3,51.3,51.3c12.6,0,24.4-4.7,33.1-12.6l2.4,2.4v6.3l39.4,39.4l11.8-11.8L-787.4,568.7 L-787.4,568.7z M-834.7,568.7c-19.7,0-35.5-15.8-35.5-35.5c0-19.7,15.8-35.5,35.5-35.5c19.7,0,35.5,15.8,35.5,35.5 C-799.3,553-815,568.7-834.7,568.7L-834.7,568.7z"/> </svg>'; break; case 'arrow': $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="26px" height="16.043px" viewBox="57 35.171 26 16.043" enable-background="new 57 35.171 26 16.043" xml:space="preserve"> <path d="M57.5,38.193l12.5,12.5l12.5-12.5l-2.5-2.5l-10,10l-10-10L57.5,38.193z"/> </svg>'; break; case 'cart': $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="20px" height="20px" viewBox="826 837.5 140 121" enable-background="new 826 837.5 140 121" xml:space="preserve"> <path d="M878.77,943.611c0,2.75-1.005,5.131-3.015,7.141c-2.009,2.01-4.389,3.014-7.139,3.014c-2.75,0-5.13-1.004-7.139-3.014 c-2.01-2.01-3.015-4.391-3.015-7.141c0-2.749,1.005-5.129,3.015-7.138c2.009-2.011,4.389-3.016,7.139-3.016 c2.75,0,5.13,1.005,7.139,3.016C877.765,938.482,878.77,940.862,878.77,943.611z M949.846,943.611c0,2.75-1.005,5.131-3.015,7.141 s-4.39,3.014-7.141,3.014c-2.748,0-5.129-1.004-7.138-3.014c-2.01-2.01-3.015-4.391-3.015-7.141c0-2.749,1.005-5.129,3.015-7.138 c2.009-2.011,4.39-3.016,7.138-3.016c2.751,0,5.131,1.005,7.141,3.016C948.841,938.482,949.846,940.862,949.846,943.611z M960,857.306v40.615c0,1.27-0.438,2.393-1.311,3.371s-1.943,1.548-3.212,1.705l-82.815,9.678c0.687,3.174,1.031,5.024,1.031,5.554 c0,0.846-0.635,2.539-1.904,5.076h72.979c1.375,0,2.564,0.503,3.569,1.508c1.006,1.005,1.508,2.194,1.508,3.569 c0,1.376-0.502,2.564-1.508,3.569c-1.005,1.005-2.194,1.507-3.569,1.507H863.54c-1.375,0-2.565-0.502-3.57-1.507 s-1.507-2.193-1.507-3.569c0-0.581,0.212-1.415,0.634-2.498c0.424-1.085,0.847-2.036,1.27-2.855c0.423-0.82,0.992-1.878,1.706-3.174 s1.124-2.076,1.23-2.34l-14.041-65.285h-16.183c-1.375,0-2.564-0.502-3.569-1.507c-1.005-1.005-1.508-2.195-1.508-3.57 c0-1.375,0.502-2.565,1.508-3.57c1.004-1.004,2.194-1.507,3.569-1.507h20.308c0.846,0,1.6,0.172,2.261,0.516 s1.177,0.754,1.547,1.229c0.37,0.476,0.714,1.124,1.032,1.944c0.316,0.819,0.528,1.507,0.634,2.062 c0.106,0.556,0.252,1.336,0.437,2.34c0.185,1.005,0.304,1.692,0.357,2.063h95.271c1.375,0,2.563,0.502,3.57,1.507 C959.497,854.741,960,855.931,960,857.306z"/> </svg>'; break; case 'bag': $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100" height="100" viewBox="826 826 140 140" enable-background="new 826 826 140 140" xml:space="preserve"> <path d="M960.758,934.509l2.632,23.541c0.15,1.403-0.25,2.657-1.203,3.761c-0.953,1.053-2.156,1.579-3.61,1.579H833.424 c-1.454,0-2.657-0.526-3.61-1.579c-0.952-1.104-1.354-2.357-1.203-3.761l2.632-23.541H960.758z M953.763,871.405l6.468,58.29H831.77 l6.468-58.29c0.15-1.203,0.677-2.218,1.58-3.045c0.903-0.827,1.981-1.241,3.234-1.241h19.254v9.627c0,2.658,0.94,4.927,2.82,6.807 s4.149,2.82,6.807,2.82c2.658,0,4.926-0.94,6.807-2.82s2.821-4.149,2.821-6.807v-9.627h28.882v9.627 c0,2.658,0.939,4.927,2.819,6.807c1.881,1.88,4.149,2.82,6.807,2.82s4.927-0.94,6.808-2.82c1.879-1.88,2.82-4.149,2.82-6.807v-9.627 h19.253c1.255,0,2.332,0.414,3.235,1.241C953.086,869.187,953.612,870.202,953.763,871.405z M924.881,857.492v19.254 c0,1.304-0.476,2.432-1.429,3.385s-2.08,1.429-3.385,1.429c-1.303,0-2.432-0.477-3.384-1.429c-0.953-0.953-1.43-2.081-1.43-3.385 v-19.254c0-5.315-1.881-9.853-5.641-13.613c-3.76-3.761-8.298-5.641-13.613-5.641s-9.853,1.88-13.613,5.641 c-3.761,3.76-5.641,8.298-5.641,13.613v19.254c0,1.304-0.476,2.432-1.429,3.385c-0.953,0.953-2.081,1.429-3.385,1.429 c-1.303,0-2.432-0.477-3.384-1.429c-0.953-0.953-1.429-2.081-1.429-3.385v-19.254c0-7.973,2.821-14.779,8.461-20.42 c5.641-5.641,12.448-8.461,20.42-8.461c7.973,0,14.779,2.82,20.42,8.461C922.062,842.712,924.881,849.519,924.881,857.492z"/> </svg>'; break; case 'basket': $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100" height="100" viewBox="826 826 140 140" enable-background="new 826 826 140 140" xml:space="preserve"> <path d="M955.418,887.512c2.344,0,4.343,0.829,6.002,2.486c1.657,1.659,2.486,3.659,2.486,6.002c0,2.343-0.829,4.344-2.486,6.001 c-1.659,1.658-3.658,2.487-6.002,2.487h-0.994l-7.627,43.9c-0.354,2.033-1.326,3.713-2.917,5.04 c-1.593,1.326-3.405,1.989-5.438,1.989h-84.883c-2.033,0-3.846-0.663-5.438-1.989c-1.591-1.327-2.564-3.007-2.918-5.04l-7.626-43.9 h-0.995c-2.343,0-4.344-0.829-6.001-2.487c-1.658-1.657-2.487-3.658-2.487-6.001c0-2.343,0.829-4.343,2.487-6.002 c1.658-1.658,3.659-2.486,6.001-2.486H955.418z M860.256,940.563c1.149-0.089,2.111-0.585,2.885-1.491 c0.773-0.907,1.116-1.936,1.028-3.085l-2.122-27.586c-0.088-1.15-0.585-2.111-1.492-2.885c-0.906-0.774-1.934-1.117-3.083-1.028 c-1.149,0.088-2.111,0.586-2.885,1.492s-1.116,1.934-1.028,3.083l2.122,27.587c0.088,1.105,0.542,2.034,1.359,2.785 c0.818,0.752,1.78,1.128,2.885,1.128H860.256z M887.512,936.319v-27.587c0-1.149-0.42-2.144-1.26-2.984 c-0.84-0.84-1.834-1.26-2.984-1.26s-2.144,0.42-2.984,1.26c-0.84,0.841-1.26,1.835-1.26,2.984v27.587c0,1.149,0.42,2.145,1.26,2.984 c0.84,0.84,1.835,1.26,2.984,1.26s2.144-0.42,2.984-1.26C887.092,938.464,887.512,937.469,887.512,936.319z M912.977,936.319 v-27.587c0-1.149-0.42-2.144-1.26-2.984c-0.841-0.84-1.835-1.26-2.984-1.26s-2.145,0.42-2.984,1.26 c-0.84,0.841-1.26,1.835-1.26,2.984v27.587c0,1.149,0.42,2.145,1.26,2.984s1.835,1.26,2.984,1.26s2.144-0.42,2.984-1.26 C912.557,938.464,912.977,937.469,912.977,936.319z M936.319,936.65l2.122-27.587c0.088-1.149-0.254-2.177-1.027-3.083 s-1.735-1.404-2.885-1.492c-1.15-0.089-2.178,0.254-3.084,1.028c-0.906,0.773-1.404,1.734-1.492,2.885l-2.122,27.586 c-0.088,1.149,0.254,2.178,1.027,3.085c0.774,0.906,1.736,1.402,2.885,1.491h0.332c1.105,0,2.066-0.376,2.885-1.128 C935.777,938.685,936.23,937.756,936.319,936.65z M859.66,855.946l-6.167,27.322h-8.753l6.698-29.245 c0.84-3.89,2.807-7.062,5.902-9.516c3.095-2.453,6.632-3.68,10.611-3.68h11.074c0-1.149,0.42-2.144,1.26-2.984 c0.84-0.84,1.835-1.26,2.984-1.26h25.465c1.149,0,2.144,0.42,2.984,1.26c0.84,0.84,1.26,1.834,1.26,2.984h11.074 c3.979,0,7.516,1.227,10.611,3.68c3.094,2.454,5.062,5.626,5.901,9.516l6.697,29.245h-8.753l-6.168-27.322 c-0.486-1.945-1.491-3.537-3.017-4.774c-1.525-1.238-3.282-1.857-5.272-1.857h-11.074c0,1.15-0.42,2.144-1.26,2.984 c-0.841,0.84-1.835,1.26-2.984,1.26h-25.465c-1.149,0-2.144-0.42-2.984-1.26c-0.84-0.84-1.26-1.834-1.26-2.984h-11.074 c-1.99,0-3.747,0.619-5.272,1.857C861.152,852.409,860.146,854,859.66,855.946z"/> </svg>'; break; default: $output = ''; break; } if ( $replace ) { $output .= '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="18px" height="18px" viewBox="-63 -63 140 140" enable-background="new -63 -63 140 140" xml:space="preserve"> <path d="M75.133-47.507L61.502-61.133L7-6.625l-54.507-54.507l-13.625,13.625L-6.625,7l-54.507,54.503l13.625,13.63 L7,20.631l54.502,54.502l13.631-13.63L20.63,7L75.133-47.507z"/></svg>'; } } else { if ( 'menu-bars' === $icon ) { $menu_icon = apply_filters( 'astra_' . $menu_location . '_menu_toggle_icon', 'menu-toggle-icon' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $output = '<span class="' . esc_attr( $menu_icon ) . '"></span>'; } } $output = apply_filters( 'astra_svg_icon_element', $output, $icon ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $classes = array( 'ast-icon', 'icon-' . $icon, ); $output = apply_filters( 'astra_svg_icon', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound sprintf( '<span class="%1$s">%2$s</span>', implode( ' ', $classes ), $output ), $icon ); if ( ! $is_echo ) { return $output; } echo wp_kses( $output, array( 'span' => array( 'class' => array() ), 'svg' => array( 'xmlns:xlink' => array(), 'version' => array(), 'id' => array(), 'x' => array(), 'y' => array(), 'enable-background' => array(), 'xml:space' => array(), 'class' => array(), 'aria-hidden' => array(), 'aria-labelledby' => array(), 'role' => array(), 'xmlns' => array(), 'width' => array(), 'height' => array(), 'viewbox' => array(), ), 'g' => array( 'fill' => array() ), 'title' => array( 'title' => array() ), 'path' => array( 'd' => array(), 'fill' => array(), ), ) ); } } new Astra_Icons(); } class-astra-minify.php 0000644 00000060667 15150261777 0011015 0 ustar 00 <?php /** * Minify Loader Class * * @package Astra * @link https://www.brainstormforce.com * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Minify' ) ) { /** * Astra_Minify */ // @codingStandardsIgnoreStart class Astra_Minify { // @codingStandardsIgnoreEnd /** * WordPress Filesystem * * @since 1.0 * @var bool $_in_customizer_preview */ private static $astra_addon_filesystem = null; /** * Directory Info * * @since 1.0 * @var bool $_dir_info */ private static $_dir_info = null; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore /** * A flag for whether or not we're in a Customizer * preview or not. * * @since 1.0 * @var bool $_in_customizer_preview */ private static $_in_customizer_preview = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore /** * The prefix for the option that is stored in the * database for the cached CSS file key. * * @since 1.0 * @var string $_css_key */ private static $_css_key = 'astra_theme_css_key'; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore /** * The prefix for the option that is stored in the * database for the cached JS file key. * * @since 1.0 * @var string $_js_key */ private static $_js_key = 'astra_theme_js_key'; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore /** * Additional CSS to enqueue. * * @since 1.0 * @var array $css */ private static $css_files = array(); /** * Additional JS to enqueue. * * @since 1.0 * @var array $js */ private static $js_files = array(); /** * Additional dependent JS to enqueue. * * @since 1.0 * @var array $js */ private static $dependent_js_files = array(); /** * Instance * * @since 1.6.0 * * @var object Class object. */ private static $instance; /** * Initiator * * @since 1.6.0 * * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Construct */ public function __construct() { add_action( 'customize_preview_init', __CLASS__ . '::preview_init', 11 ); add_action( 'customize_save_after', __CLASS__ . '::refresh_assets', 11 ); add_action( 'astra_addon_activated', __CLASS__ . '::refresh_assets', 11 ); add_action( 'astra_addon_deactivated', __CLASS__ . '::refresh_assets', 11 ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); if ( version_compare( ASTRA_THEME_VERSION, '3.6.8', '>' ) ) { add_action( 'astra_addon_get_js_files', array( $this, 'add_fronted_pro_script' ) ); } } /** * Enqueue Scripts */ public function enqueue_scripts() { /** * Filters to disable all the styles and scripts added from addon. * * @since 1.5.0 * * @param bool true | false enable/disable all styels,scripts of astra addon. */ if ( apply_filters( 'astra_addon_enqueue_assets', true ) ) { $css_url = self::get_css_url(); $js_url = self::get_js_url(); if ( false != $css_url ) { wp_enqueue_style( 'astra-addon-css', $css_url, array(), ASTRA_EXT_VER, 'all' ); } // Scripts - Register & Enqueue. if ( false != $js_url ) { wp_enqueue_script( 'astra-addon-js', $js_url, self::get_dependent_js(), ASTRA_EXT_VER, true ); } if ( ! function_exists( 'astra_addon_filesystem' ) ) { wp_add_inline_style( 'astra-addon-css', apply_filters( 'astra_addon_dynamic_css', '' ) ); } wp_localize_script( 'astra-addon-js', 'astraAddon', apply_filters( 'astra_addon_js_localize', array() ) ); } } /** * Load WordPress filesystem * * @since 1.0 * @return void */ public static function load_filesystem() { if ( null === self::$astra_addon_filesystem ) { global $wp_filesystem; if ( empty( $wp_filesystem ) ) { require_once ABSPATH . '/wp-admin/includes/file.php'; WP_Filesystem(); } self::$astra_addon_filesystem = $wp_filesystem; } } /** * Used to add enqueue frontend styles. * * @since 1.0 * @param string $src Source URL. * @param boolean $handle Script handle. * @return void */ public static function add_css( $src = null, $handle = false ) { if ( false != $handle ) { self::$css_files[ $handle ] = $src; } else { self::$css_files[] = $src; } } /** * Used to enqueue frontend scripts. * * @since 1.0 * @param string $src Source URL. * @param boolean $handle Script handle. * @return void */ public static function add_js( $src = null, $handle = false ) { if ( false != $handle ) { self::$js_files[ $handle ] = $src; } else { self::$js_files[] = $src; } } /** * Used to enqueue dependent js frontend scripts. * * @since 1.0 * @param boolean $handle Script handle. * @param string $src Source URL. * @return void */ public static function add_dependent_js( $handle, $src = null ) { self::$dependent_js_files[ $handle ] = $src; } /** * Get css files to HTTP/2. * * @since 1.0 * @return array() */ public static function get_http2_css_files() { // Get the css key. $css_slug = self::_asset_slug(); $css_files = get_option( self::$_css_key . '-files-' . $css_slug, array() ); // No css files, recompile the files. if ( ! $css_files ) { self::render_http2_css(); return self::get_http2_css_files(); } // Return the url. return $css_files; } /** * Get css files to generate. * * @since 1.0 * @return array() */ public static function get_css_files() { if ( 1 > count( self::$css_files ) ) { do_action( 'astra_addon_get_css_files' ); } return apply_filters( 'astra_addon_add_css_file', self::$css_files ); } /** * Get CSS files to HTTP/2. * * @since 1.0 * @return array() */ public static function get_http2_js_files() { // Get the js key. $js_slug = self::_asset_slug(); $js_files = get_option( self::$_js_key . '-files-' . $js_slug, array() ); self::$dependent_js_files = get_option( self::$_js_key . '-dep-' . $js_slug ); // No js files, recompile the js files. if ( ! $js_files ) { self::render_http2_js(); return self::get_http2_js_files(); } // Return the files array(). return $js_files; } /** * Get JS files to generate. * * @since 1.0 * @return array() */ public static function get_js_files() { if ( 1 > count( self::$js_files ) ) { do_action( 'astra_addon_get_js_files' ); } return apply_filters( 'astra_addon_add_js_file', self::$js_files ); } /** * Get dependent JS files to generate. * * @since 1.0 * @return array() */ public static function get_dependent_js_files() { return apply_filters( 'astra_addon_add_dependent_js_file', self::$dependent_js_files ); } /** * Checks to see if the current site is being accessed over SSL. * * @since 1.0 * @return bool */ public static function astra_is_ssl() { if ( is_ssl() ) { return true; } elseif ( 0 === stripos( get_option( 'siteurl' ), 'https://' ) ) { return true; } elseif ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { return true; } return false; } /** * Returns an array with the path and URL for the cache directory. * * @since 1.0 * @return array */ public static function get_cache_dir() { if ( null != self::$_dir_info ) { return self::$_dir_info; } $dir_name = 'astra-addon'; $wp_info = wp_upload_dir(); // SSL workaround. if ( self::astra_is_ssl() ) { $wp_info['baseurl'] = str_ireplace( 'http://', 'https://', $wp_info['baseurl'] ); } // Build the paths. $dir_info = array( 'path' => $wp_info['basedir'] . '/' . $dir_name . '/', 'url' => $wp_info['baseurl'] . '/' . $dir_name . '/', ); // Create the cache dir if it doesn't exist. if ( ! file_exists( $dir_info['path'] ) ) { wp_mkdir_p( $dir_info['path'] ); } self::$_dir_info = $dir_info; return self::$_dir_info; } /** * Checks to see if this is a Customizer preview or not. * * @since 1.0 * @return bool */ public static function is_customizer_preview() { return self::$_in_customizer_preview; } /** * Returns the prefix slug for the CSS cache file. * * @since 1.0 * @return string */ private static function _asset_slug() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore if ( self::is_customizer_preview() ) { $slug = 'ast-customizer'; } else { $slug = 'astra-addon'; } return $slug; } /** * Clears and rebuilds the cached CSS file. * * @since 1.0 * @return void */ public static function refresh_assets() { self::clear_assets_cache(); self::render_assets(); do_action( 'astra_addon_assets_refreshed' ); } /** * Deletes cached CSS files based on the current * context (live, preview or customizer) or all if * $all is set to true. * * @since 1.0 * @return boolean Returns True if files were successfull deleted, False If files could not be deleted. */ public static function clear_assets_cache() { // Make sure the filesystem is loaded. self::load_filesystem(); $dir_name = 'astra-addon'; $cache_dir = self::get_cache_dir(); $asset_slug = self::_asset_slug(); /* Delete CSS Keys */ delete_option( self::$_css_key . '-' . $asset_slug ); delete_option( self::$_css_key . '-files-' . $asset_slug ); /* Delete JS Keys */ delete_option( self::$_js_key . '-' . $asset_slug ); delete_option( self::$_js_key . '-files-' . $asset_slug ); delete_option( self::$_js_key . '-dep-' . $asset_slug ); if ( ! empty( $cache_dir['path'] ) && stristr( $cache_dir['path'], $dir_name ) ) { $directory = trailingslashit( $cache_dir['path'] ); $filelist = (array) self::$astra_addon_filesystem->dirlist( $directory, true ); $delete_status = true; foreach ( $filelist as $file ) { // don't delete dynamic css files. // @TODO: use Astra_Cache to generate and manage CSS files. if ( false !== strpos( $file['name'], 'dynamic-css' ) ) { continue; } // Skip astra-addon css/js files if customizer preview. Whenever customizer was refreshed, astra-addon used to regenerate. If HTML cache is enabled on the frontend then just visiting the customizer regenerates the astra-addon assets and gives 404 not found error for astra-addon assets on frontend. if ( self::is_customizer_preview() && ( false !== strpos( $file['name'], 'astra-addon-' ) ) ) { continue; } $file = $directory . $file['name']; if ( is_file( $file ) && file_exists( $file ) ) { $delete_status = self::$astra_addon_filesystem->delete( $file ); } } // If the file was not correctly deleted. if ( false == $delete_status ) { // Set status CSS status True. This will load the CSS as inline. update_option( 'ast-theme-css-status', true ); update_option( 'astra-addon-js-status', true ); return false; } } return true; } /** * Renders the CSS and JS assets. * * @since 1.0 * @return void */ public static function render_assets() { if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) { self::render_http2_css(); self::render_http2_js(); } else { self::render_css(); self::render_js(); } } /** * Returns a URL for the cached CSS file. * * @since 1.0 * @return string */ public static function get_css_url() { if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) { self::enqueue_http2_css(); return false; } elseif ( ! get_option( 'ast-theme-css-status' ) ) { // Get the cache dir and css key. $cache_dir = self::get_cache_dir(); $css_slug = self::_asset_slug(); $css_key = get_option( self::$_css_key . '-' . $css_slug ); $css_path = $cache_dir['path'] . $css_slug . '-' . $css_key . '.css'; $css_url = $cache_dir['url'] . $css_slug . '-' . $css_key . '.css'; if ( ! $css_key ) { self::render_css(); return self::get_css_url(); } // Check to see if the file exists. if ( ! file_exists( $css_path ) ) { self::render_fallback_css(); return false; } // Return the url. return $css_url; } else { self::render_fallback_css(); return false; } } /** * Returns a HTTP/2 Dynamic CSS data. * * @since 1.0 * @return string */ public static function get_http2_dynamic_css() { // Get the css key. $css_slug = self::_asset_slug(); // No css data, recompile the css. if ( ! $css_data ) { self::render_http2_css(); return self::get_http2_dynamic_css(); } // Return the url. return $css_data; } /** * Returns a Dynamic CSS data. * * @since 1.0 * @return string */ public static function get_dynamic_css() { // Get the cache dir and css key. $cache_dir = self::get_cache_dir(); $css_slug = self::_asset_slug(); // No css data, recompile the css. if ( ! $css_data ) { self::render_css(); return self::get_dynamic_css(); } // Return the url. return $css_data; } /** * Returns a URL for the cached JS file. * * @since 1.0 * @return string */ public static function get_js_url() { if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) { self::enqueue_http2_js(); return false; } elseif ( ! get_option( 'astra-addon-js-status' ) ) { // Get the cache dir and js key. $cache_dir = self::get_cache_dir(); $js_slug = self::_asset_slug(); $js_key = get_option( self::$_js_key . '-' . $js_slug ); $js_path = $cache_dir['path'] . $js_slug . '-' . $js_key . '.js'; $js_url = $cache_dir['url'] . $js_slug . '-' . $js_key . '.js'; if ( ! $js_key ) { self::render_js(); return self::get_js_url(); } // Get dependent js added from addon modules. self::$dependent_js_files = get_option( self::$_js_key . '-dep-' . $js_slug ); // Check to see if the file exists. if ( ! file_exists( $js_path ) ) { self::render_fallback_js(); return false; } // Return the url. return $js_url; } else { self::render_fallback_js(); return false; } } /** * Enqueue dependent JS * * @since 1.0 * @return void */ public static function enqueue_dependent_js() { $dependent_js_files = self::get_dependent_js_files(); if ( is_array( $dependent_js_files ) && ! empty( $dependent_js_files ) && ( count( $dependent_js_files ) > 0 ) ) { foreach ( $dependent_js_files as $handle => $src ) { if ( '' != $src ) { wp_enqueue_script( $handle, $src, array(), ASTRA_EXT_VER, true ); } else { wp_enqueue_script( $handle ); } } } } /** * Get dependent JS * * @since 1.0 * @return array() */ public static function get_dependent_js() { $dependent_js_files = self::get_dependent_js_files(); $js_files_arr = array(); if ( is_array( $dependent_js_files ) && count( $dependent_js_files ) > 0 ) { foreach ( $dependent_js_files as $handle => $src ) { if ( '' != $src ) { wp_register_script( $handle, $src, array(), ASTRA_EXT_VER, true ); $js_files_arr[] = $handle; } else { $js_files_arr[] = $handle; } } } return $js_files_arr; } /** * Compiles the cached CSS file. * * @since 1.0 * @return void */ private static function render_http2_css() { $css_slug = self::_asset_slug(); $css_files = self::get_css_files(); /* Update Dynamic css in DB */ update_option( self::$_css_key . '-files-' . $css_slug, $css_files ); } /** * Compiles the cached CSS file. * * @since 1.0 * @return void|false Checks early if cache directory was emptied before generating the new files */ private static function render_css() { self::load_filesystem(); if ( ! defined( 'FS_CHMOD_FILE' ) ) { define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound } if ( get_option( 'ast-theme-css-status' ) ) { $assets_status = self::clear_assets_cache(); if ( false == $assets_status ) { return false; } } $cache_dir = self::get_cache_dir(); $new_css_key = str_replace( '.', '-', uniqid( '', true ) ); $css_slug = self::_asset_slug(); $css_files = self::get_css_files(); $css = ''; $css_min = ''; $filepath = $cache_dir['path'] . $css_slug . '-' . $new_css_key . '.css'; if ( count( $css_files ) > 0 ) { foreach ( $css_files as $k => $file ) { if ( ! empty( $file ) && file_exists( $file ) ) { $css .= self::$astra_addon_filesystem->get_contents( $file, FS_CHMOD_FILE ); } } } $css = apply_filters( 'astra_addon_render_css', $css ); $status = self::$astra_addon_filesystem->put_contents( $filepath, $css, FS_CHMOD_FILE ); $status = ! $status; // Save the new css key. update_option( 'ast-theme-css-status', $status ); update_option( self::$_css_key . '-' . $css_slug, $new_css_key ); } /** * Render HTTP/2 CSS : enqueue individual CSS file. * * @since 1.0 * @return void */ private static function enqueue_http2_css() { $css_files = self::get_http2_css_files(); $files_count = count( $css_files ); if ( $files_count > 0 ) { foreach ( $css_files as $k => $file ) { if ( $files_count == $k + 1 ) { $handle = 'astra-addon-css'; } else { $handle = 'astra-addon-css-' . $k; } wp_enqueue_style( $handle, $file, array(), ASTRA_EXT_VER, 'all' ); } } } /** * Fallback to enqueue individual CSS file. * * @since 1.0 * @return void */ private static function render_fallback_css() { $css_files = self::get_css_files(); $files_count = count( $css_files ); if ( $files_count > 0 ) { foreach ( $css_files as $index => $file_path ) { if ( ! file_exists( $file_path ) ) { continue; } $new_file = plugins_url( str_replace( plugin_dir_path( ASTRA_EXT_FILE ), '', $file_path ), ASTRA_EXT_FILE ); if ( $files_count == $index + 1 ) { $handle = 'astra-addon-css'; } else { $handle = 'astra-addon-css-' . $index; } wp_enqueue_style( $handle, $new_file, array(), ASTRA_EXT_VER, 'all' ); } } } /** * Renders HTTP/2 js. * * @since 1.0 * @return void */ public static function render_http2_js() { $js_slug = self::_asset_slug(); $js_files = self::get_js_files(); $dep_js_files = self::$dependent_js_files; update_option( self::$_js_key . '-files-' . $js_slug, $js_files ); update_option( self::$_js_key . '-dep-' . $js_slug, $dep_js_files ); } /** * Renders and caches the JavaScript * * @since 1.0 * @return void|false Checks early if cache directory was emptied before generating the new files */ public static function render_js() { self::load_filesystem(); if ( ! defined( 'FS_CHMOD_FILE' ) ) { define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound } if ( get_option( 'astra-addon-js-status' ) ) { $assets_status = self::clear_assets_cache(); if ( false == $assets_status ) { return false; } } $cache_dir = self::get_cache_dir(); $new_js_key = str_replace( '.', '-', uniqid( '', true ) ); $js_slug = self::_asset_slug(); $js_files = self::get_js_files(); $dep_js_files = self::$dependent_js_files; $js = ''; $js_min = ''; $filepath = $cache_dir['path'] . $js_slug . '-' . $new_js_key . '.js'; if ( count( $js_files ) > 0 ) { foreach ( $js_files as $k => $file ) { if ( ! empty( $file ) && file_exists( $file ) ) { $js .= self::$astra_addon_filesystem->get_contents( $file, FS_CHMOD_FILE ); } } } $js = apply_filters( 'astra_addon_render_js', $js ); $status = self::$astra_addon_filesystem->put_contents( $filepath, $js, FS_CHMOD_FILE ); $status = ! $status; // Save the new css key. update_option( 'astra-addon-js-status', $status ); update_option( self::$_js_key . '-dep-' . $js_slug, $dep_js_files ); update_option( self::$_js_key . '-' . $js_slug, $new_js_key ); do_action( 'astra_addon_after_render_js' ); } /** * HTTP/2 individual JS file. * * @since 1.0 * @return void */ public static function enqueue_http2_js() { $js_files = self::get_http2_js_files(); $files_count = count( $js_files ); if ( 0 < $files_count ) { $dep_files = self::get_dependent_js(); if ( ! is_array( $dep_files ) ) { $dep_files = array(); } foreach ( $js_files as $k => $file ) { if ( 0 == $k ) { $handle = 'astra-addon-js'; } else { $handle = 'astra-addon-js-' . $k; } wp_enqueue_script( $handle, $file, $dep_files, ASTRA_EXT_VER, true ); } } } /** * Render Fallback JS * * @since 1.0 * @return void */ public static function render_fallback_js() { $js_files = self::get_js_files(); $files_count = count( $js_files ); if ( 0 < $files_count ) { self::enqueue_dependent_js(); foreach ( $js_files as $index => $file_path ) { if ( ! file_exists( $file_path ) ) { continue; } $new_file = plugins_url( str_replace( plugin_dir_path( ASTRA_EXT_FILE ), '', $file_path ), ASTRA_EXT_FILE ); if ( 0 == $index ) { $handle = 'astra-addon-js'; } else { $handle = 'astra-addon-js-' . $index; } wp_enqueue_script( $handle, $new_file, array(), ASTRA_EXT_VER, true ); } } } /** * Called by the customize_preview_init action to initialize * a Customizer preview. * * @since 1.0 * @return void */ public static function preview_init() { self::$_in_customizer_preview = true; self::refresh_assets(); } /** * Trim CSS * * @since 1.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; } /** * Load Addon ddependent JS related to toggle navigation menu. * * @since 3.5.9 */ public static function add_fronted_pro_script() { /* Define Variables */ $uri = ASTRA_EXT_URI . 'assets/js/'; $path = ASTRA_EXT_DIR . 'assets/js/'; /* Directory and Extension */ $file_prefix = '.min'; $dir_name = 'minified'; if ( SCRIPT_DEBUG ) { $file_prefix = ''; $dir_name = 'unminified'; } $js_uri = $uri . $dir_name . '/'; $js_dir = $path . $dir_name . '/'; if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) { $gen_path = $js_uri; } else { $gen_path = $js_dir; } /*** End Path Logic */ self::add_js( $gen_path . 'frontend-pro' . $file_prefix . '.js' ); } } Astra_Minify::get_instance(); } class-astra-templates.php 0000644 00000006511 15150261777 0011504 0 ustar 00 <?php /** * Astra Templates * * @package Astra pro * @since 1.0.0 */ /** * Astra get template. */ if ( ! function_exists( 'astra_addon_get_template' ) ) { /** * Get other templates (e.g. blog layout 2/3, advanced footer layout 1/2/3/etc) passing attributes and including the file. * * @param string $template_name template path. E.g. (directory / template.php). * @param array $args (default: array()). * @param string $template_path (default: ''). * @param string $default_path (default: ''). * @since 1.0.0 * @return void */ function astra_addon_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { $located = astra_addon_locate_template( $template_name, $template_path, $default_path ); if ( ! file_exists( $located ) ) { /* translators: 1: file location */ _doing_it_wrong( __FUNCTION__, esc_html( sprintf( __( '%s does not exist.', 'astra-addon' ), '<code>' . $located . '</code>' ) ), '1.0.0' ); return; } // Allow 3rd party plugin filter template file from their plugin. $located = apply_filters( 'astra_addon_get_template', $located, $template_name, $args, $template_path, $default_path ); do_action( 'astra_addon_before_template_part', $template_name, $template_path, $located, $args ); include $located; do_action( 'astra_addon_after_template_part', $template_name, $template_path, $located, $args ); } } /** * Astra locate template. */ if ( ! function_exists( 'astra_addon_locate_template' ) ) { /** * Locate a template and return the path for inclusion. * * This is the load order: * * yourtheme / $template_path / $template_name * yourtheme / $template_name * $default_path / $template_name * * @param string $template_name template path. E.g. (directory / template.php). * @param string $template_path (default: ''). * @param string $default_path (default: ''). * @since 1.0.0 * @return string return the template path which is maybe filtered. */ function astra_addon_locate_template( $template_name, $template_path = '', $default_path = '' ) { if ( ! $template_path ) { $template_path = 'astra-addon/'; } if ( ! $default_path ) { $default_path = ASTRA_EXT_DIR . 'addons/'; } /** * Look within passed path within the theme - this is priority. * * Note: Avoided directories '/addons/' and '/template/'. * * E.g. * * 1) Override Footer Widgets - Template 1. * Addon: {astra-addon}/addons/advanced-footer/template/layout-1.php * Theme: {child-theme}/astra-addon/advanced-footer/layout-1.php * * 2) Override Blog Pro - Template 2. * Addon: {astra-addon}/addons/blog-pro/template/blog-layout-2.php * Theme: {child-theme}/astra-addon/blog-pro/blog-layout-2.php. */ $theme_template_name = str_replace( 'template/', '', $template_name ); $template = locate_template( array( trailingslashit( $template_path ) . $theme_template_name, $theme_template_name, ) ); // Get default template. if ( ! $template || ASTRA_EXT_TEMPLATE_DEBUG_MODE ) { $template = $default_path . $template_name; } // Return what we found. return apply_filters( 'astra_addon_locate_template', $template, $template_name, $template_path ); } } class-astra-theme-extension.php 0000644 00000073217 15150261777 0012631 0 ustar 00 <?php /** * Astra Theme Extension * * @package Astra Addon */ if ( ! class_exists( 'Astra_Theme_Extension' ) ) { /** * Astra_Theme_Extension initial setup * * @since 1.0.0 */ // @codingStandardsIgnoreStart class Astra_Theme_Extension { // @codingStandardsIgnoreEnd /** * Member Variable * * @var instance */ private static $instance; /** * Member Variable * * @var options */ public static $options; /** * Control Value to use Checkbox | Toggle control in WP_Customize * * @var const control */ public static $switch_control; /** * Control Value to use Setting Group | Color Group in WP_Customize * * @var const control */ public static $group_control; /** * Control Value to use Selector control in WP_Customize * * @var const control */ public static $selector_control; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { // Activation hook. register_activation_hook( ASTRA_EXT_FILE, array( $this, 'activation_reset' ) ); // deActivation hook. register_deactivation_hook( ASTRA_EXT_FILE, array( $this, 'deactivation_reset' ) ); // Includes Required Files. $this->includes(); if ( is_admin() ) { add_action( 'admin_init', array( $this, 'min_theme_version__error' ) ); // Admin enqueue script alpha color picker. add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_color_picker_scripts' ) ); } add_action( 'init', array( $this, 'addons_action_hooks' ), 1 ); add_action( 'after_setup_theme', array( $this, 'setup' ) ); add_action( 'customize_controls_enqueue_scripts', array( $this, 'controls_scripts' ) ); add_action( 'customize_register', array( $this, 'customize_register_before_theme' ), 5 ); add_action( 'customize_register', array( $this, 'addon_customize_register' ), 99 ); add_action( 'customize_preview_init', array( $this, 'preview_init' ), 1 ); add_filter( 'body_class', array( $this, 'body_classes' ), 11, 1 ); // Load textdomain. add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); add_action( 'plugins_loaded', array( $this, 'common_plugin_dependent_files' ) ); add_action( 'wpml_loaded', array( $this, 'wpml_compatibility' ) ); // add compatibility for custom layouts with polylang plugin. add_action( 'pll_init', array( $this, 'wpml_compatibility' ) ); // Astra Addon List filter. add_filter( 'astra_addon_list', array( $this, 'astra_addon_list' ) ); add_action( 'plugin_action_links_' . ASTRA_EXT_BASE, array( $this, 'action_links' ) ); // Redirect if old addon screen rendered. add_action( 'admin_init', array( $this, 'redirect_addon_listing_page' ) ); add_action( 'enqueue_block_editor_assets', array( $this, 'addon_gutenberg_assets' ), 11 ); add_filter( 'astra_svg_icons', array( $this, 'astra_addon_svg_icons' ), 1, 10 ); add_filter( 'bsf_show_versions_to_rollback_astra-addon', array( $this, 'astra_addon_rollback_versions_limit' ), 1, 10 ); } /** * Astra Addon action hooks * * @return void */ public function addons_action_hooks() { $activate_transient = get_transient( 'astra_addon_activated_transient' ); $deactivate_transient = get_transient( 'astra_addon_deactivated_transient' ); if ( false != $activate_transient ) { do_action( 'astra_addon_activated', $activate_transient ); delete_transient( 'astra_addon_activated_transient' ); } if ( false != $deactivate_transient ) { do_action( 'astra_addon_deactivated', $deactivate_transient ); delete_transient( 'astra_addon_deactivated_transient' ); } } /** * Add Body Classes * * @param array $classes Body Class Array. * @return array */ public function body_classes( $classes ) { // Current Astra Addon version. $classes[] = esc_attr( 'astra-addon-' . ASTRA_EXT_VER ); return $classes; } /** * Load Astra Pro Text Domain. * This will load the translation textdomain depending on the file priorities. * 1. Global Languages /wp-content/languages/astra-addon/ folder * 2. Local dorectory /wp-content/plugins/astra-addon/languages/ folder * * @since 1.0.0 * @return void */ public function load_textdomain() { // Default languages directory for Astra Pro. $lang_dir = ASTRA_EXT_DIR . 'languages/'; /** * Filters the languages directory path to use for Astra Addon. * * @param string $lang_dir The languages directory path. */ $lang_dir = apply_filters( 'astra_addon_languages_directory', $lang_dir ); // Traditional WordPress plugin locale filter. global $wp_version; $get_locale = get_locale(); if ( $wp_version >= 4.7 ) { $get_locale = get_user_locale(); } /** * Language Locale for Astra Pro * * @var $get_locale The locale to use. Uses get_user_locale()` in WordPress 4.7 or greater, * otherwise uses `get_locale()`. */ $locale = apply_filters( 'plugin_locale', $get_locale, 'astra-addon' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $mofile = sprintf( '%1$s-%2$s.mo', 'astra-addon', $locale ); // Setup paths to current locale file. $mofile_local = $lang_dir . $mofile; $mofile_global = WP_LANG_DIR . '/plugins/' . $mofile; if ( file_exists( $mofile_global ) ) { // Look in global /wp-content/languages/astra-addon/ folder. load_textdomain( 'astra-addon', $mofile_global ); } elseif ( file_exists( $mofile_local ) ) { // Look in local /wp-content/plugins/astra-addon/languages/ folder. load_textdomain( 'astra-addon', $mofile_local ); } else { // Load the default language files. load_plugin_textdomain( 'astra-addon', false, 'astra-addon/languages' ); } } /** * Show action links on the plugin screen. * * @param mixed $links Plugin Action links. * @return array */ public function action_links( $links = array() ) { $slug = 'astra'; $theme_whitelabelled_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra', 'name', false ); if ( false !== $theme_whitelabelled_name && ! empty( $theme_whitelabelled_name ) ) { $slug = Astra_Ext_White_Label_Markup::get_instance()->astra_whitelabelled_slug( 'astra' ); } $admin_base = is_callable( 'Astra_Menu::get_theme_page_slug' ) ? 'admin.php' : 'themes.php'; $action_links = array( 'settings' => '<a href="' . esc_url( admin_url( $admin_base . '?page=' . $slug ) ) . '" aria-label="' . esc_attr__( 'View Astra Pro settings', 'astra-addon' ) . '">' . esc_html__( 'Settings', 'astra-addon' ) . '</a>', ); return array_merge( $action_links, $links ); } /** * Activation Reset */ public function activation_reset() { add_rewrite_endpoint( 'partial', EP_PERMALINK ); // flush rewrite rules. flush_rewrite_rules(); //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules -- Used for specific cases and kept to minimal use. // Force check graupi bundled products. update_site_option( 'bsf_force_check_extensions', true ); if ( is_multisite() ) { $branding = get_site_option( '_astra_ext_white_label' ); } else { $branding = get_option( '_astra_ext_white_label' ); } if ( isset( $branding['astra-agency']['hide_branding'] ) && false != $branding['astra-agency']['hide_branding'] ) { $branding['astra-agency']['hide_branding'] = false; if ( is_multisite() ) { update_site_option( '_astra_ext_white_label', $branding ); } else { update_option( '_astra_ext_white_label', $branding ); } } do_action( 'astra_addon_activate' ); } /** * Deactivation Reset */ public function deactivation_reset() { // flush rewrite rules. flush_rewrite_rules(); //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules -- Used for specific cases and kept to minimal use. } /** * Includes */ public function includes() { require_once ASTRA_EXT_DIR . 'classes/helper-functions.php'; require_once ASTRA_EXT_DIR . 'classes/class-astra-admin-helper.php'; require_once ASTRA_EXT_DIR . 'classes/astra-theme-compatibility-functions.php'; require_once ASTRA_EXT_DIR . 'classes/customizer/class-astra-addon-customizer.php'; require_once ASTRA_EXT_DIR . 'classes/modules/target-rule/class-astra-target-rules-fields.php'; require_once ASTRA_EXT_DIR . 'classes/modules/menu-sidebar/class-astra-menu-sidebar-animation.php'; require_once ASTRA_EXT_DIR . 'classes/class-astra-ext-extension.php'; require_once ASTRA_EXT_DIR . 'classes/class-astra-templates.php'; // White Lebel. require_once ASTRA_EXT_DIR . 'classes/class-astra-ext-white-label-markup.php'; // Page Builder compatibility base class. require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-page-builder-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-beaver-builder-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-divi-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-elementor-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-thrive-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-visual-composer-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-brizy-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-nginx-helper-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-run-cloud-helper-compatibility.php'; require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-gutenberg-compatibility.php'; // AMP Compatibility. require_once ASTRA_EXT_DIR . 'classes/compatibility/class-astra-addon-amp-compatibility.php'; if ( ASTRA_ADDON_BSF_PACKAGE ) { require_once ASTRA_EXT_DIR . 'admin/astra-rollback/class-astra-rollback-version.php'; require_once ASTRA_EXT_DIR . 'admin/astra-rollback/class-astra-rollback-version-manager.php'; } } /** * After Setup Theme */ public function setup() { if ( ! defined( 'ASTRA_THEME_VERSION' ) ) { return; } require_once ASTRA_EXT_DIR . 'classes/class-astra-icons.php'; if ( version_compare( ASTRA_THEME_VERSION, '3.1.0', '>=' ) ) { self::$switch_control = 'ast-toggle-control'; self::$group_control = 'ast-color-group'; self::$selector_control = 'ast-selector'; } else { self::$switch_control = 'checkbox'; self::$group_control = 'ast-settings-group'; self::$selector_control = 'select'; } require_once ASTRA_EXT_DIR . 'classes/class-astra-addon-builder-loader.php'; /** * Load deprecated filters. */ require_once ASTRA_EXT_DIR . 'classes/deprecated/deprecated-filters.php'; /** * Load deprecated actions. */ require_once ASTRA_EXT_DIR . 'classes/deprecated/deprecated-actions.php'; require_once ASTRA_EXT_DIR . 'classes/astra-common-functions.php'; require_once ASTRA_EXT_DIR . 'classes/class-astra-addon-update-filter-function.php'; require_once ASTRA_EXT_DIR . 'classes/astra-common-dynamic-css.php'; if ( function_exists( 'astra_addon_filesystem' ) ) { require_once ASTRA_EXT_DIR . 'classes/cache/class-astra-cache-base.php'; require_once ASTRA_EXT_DIR . 'classes/cache/class-astra-cache.php'; } require_once ASTRA_EXT_DIR . 'classes/class-astra-minify.php'; if ( function_exists( 'astra_addon_filesystem' ) ) { require_once ASTRA_EXT_DIR . 'classes/cache/class-astra-addon-cache.php'; } require_once ASTRA_EXT_DIR . 'classes/class-astra-ext-model.php'; } /** * Load Gutenberg assets */ public function addon_gutenberg_assets() { if ( ! defined( 'ASTRA_THEME_VERSION' ) ) { return; } $white_labelled_icon = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra', 'icon' ); if ( false !== $white_labelled_icon ) { $dark_active_variation = $white_labelled_icon; if ( false !== strpos( $white_labelled_icon, 'whitelabel-branding.svg' ) ) { $white_labelled_icon = ASTRA_EXT_URI . 'admin/core/assets/images/whitelabel-branding-dark.svg'; } wp_add_inline_style( 'astra-meta-box', '.components-button svg[data-ast-logo] * { display: none; } .components-button svg[data-ast-logo] { background-image: url( ' . esc_url( $white_labelled_icon ) . ' ) !important; background-size: 24px 24px; background-repeat: no-repeat; background-position: center; } button.components-button.is-pressed svg[data-ast-logo] { background-image: url( ' . esc_url( $dark_active_variation ) . ' ) !important; }' ); } // Gutenberg dynamic css for Astra Addon. require_once ASTRA_EXT_DIR . 'classes/class-addon-gutenberg-editor-css.php'; } /** * Enqueues the needed CSS/JS for the customizer. * * @since 1.0 * @return void */ public function controls_scripts() { // Enqueue Customizer React.JS script. $custom_controls_react_deps = array( 'astra-custom-control-plain-script', 'wp-i18n', 'wp-components', 'wp-element', 'wp-media-utils', 'wp-block-editor', ); wp_enqueue_script( 'astra-ext-custom-control-react-script', ASTRA_EXT_URI . 'classes/customizer/extend-controls/build/index.js', $custom_controls_react_deps, ASTRA_EXT_VER, true ); } /** * Customizer Preview Init * * @since 1.0.0 * @return void */ public function preview_init() { if ( SCRIPT_DEBUG ) { $js_path = 'assets/js/unminified/ast-addon-customizer-preview.js'; } else { $js_path = 'assets/js/minified/ast-addon-customizer-preview.min.js'; } $addons = Astra_Ext_Extension::get_enabled_addons(); wp_enqueue_script( 'astra-addon-customizer-preview-js', ASTRA_EXT_URI . $js_path, array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_EXT_VER, true ); wp_localize_script( 'astra-addon-customizer-preview-js', 'ast_enabled_addons', $addons ); } /** * Base on addon activation section registered. * * @since 1.0.0 * @param object $wp_customize customizer object. * @return void */ public function customize_register_before_theme( $wp_customize ) { if ( ! defined( 'ASTRA_THEME_VERSION' ) ) { return; } if ( ! class_exists( 'Astra_WP_Customize_Section' ) ) { wp_die( 'You are using an older version of the Astra theme. Please update the Astra theme to the latest version.' ); } $addons = Astra_Ext_Extension::get_enabled_addons(); // Update the Customizer Sections under Layout. if ( false != $addons['header-sections'] ) { $wp_customize->add_section( new Astra_WP_Customize_Section( $wp_customize, 'section-mobile-primary-header-layout', array( 'title' => __( 'Primary Header', 'astra-addon' ), 'section' => 'section-mobile-header', 'priority' => 10, ) ) ); } // Update the Customizer Sections under Typography. if ( false != $addons['typography'] ) { $wp_customize->add_section( new Astra_WP_Customize_Section( $wp_customize, 'section-header-typo-group', array( 'title' => __( 'Header', 'astra-addon' ), 'panel' => 'panel-typography', 'priority' => 20, ) ) ); add_filter( 'astra_customizer_primary_header_typo', function( $header_arr ) { $header_arr['section'] = 'section-header-typo-group'; return $header_arr; } ); } } /** * Register Customizer Control. * * @since 1.0.2 * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ public function addon_customize_register( $wp_customize ) { if ( function_exists( 'WP_Customize_Themes_Panel' ) ) { $wp_customize->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array( 'title' => astra_get_theme_name(), 'description' => ( '<p>' . __( 'Looking for a theme? You can search or browse the WordPress.org theme directory, install and preview themes, then activate them right here.', 'astra-addon' ) . '</p>' . '<p>' . __( 'While previewing a new theme, you can continue to tailor things like widgets and menus, and explore theme-specific options.', 'astra-addon' ) . '</p>' ), 'capability' => 'switch_themes', 'priority' => 0, ) ) ); } } /** * WPML Compatibility. * * @since 1.1.0 */ public function wpml_compatibility() { require_once ASTRA_EXT_DIR . 'compatibility/class-astra-wpml-compatibility.php'; } /** * Common plugin dependent file which dependd on other plugins. * * @since 1.1.0 */ public function common_plugin_dependent_files() { // If plugin - 'Ubermenu' not exist then return. if ( class_exists( 'UberMenu' ) ) { require_once ASTRA_EXT_DIR . 'compatibility/class-astra-ubermenu-pro.php'; } } /** * Check compatible theme version. * * @since 1.2.0 */ public function min_theme_version__error() { $astra_global_options = get_option( 'astra-settings' ); if ( isset( $astra_global_options['theme-auto-version'] ) && ( version_compare( $astra_global_options['theme-auto-version'], ASTRA_THEME_MIN_VER ) < 0 ) && ( false !== get_theme_update_available( wp_get_theme( get_template() ) ) ) ) { $astra_theme_name = 'Astra'; if ( function_exists( 'astra_get_theme_name' ) ) { $astra_theme_name = astra_get_theme_name(); } $message = sprintf( /* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the Astra Theme */ __( 'Please update %1$1s Theme to version %2$2s or higher. Ignore if already updated.', 'astra-addon' ), $astra_theme_name, ASTRA_THEME_MIN_VER ); $min_version = get_user_meta( get_current_user_id(), 'theme-min-version-notice-min-ver', true ); if ( ! $min_version ) { update_user_meta( get_current_user_id(), 'theme-min-version-notice-min-ver', ASTRA_THEME_MIN_VER ); } if ( version_compare( $min_version, ASTRA_THEME_MIN_VER, '!=' ) ) { delete_user_meta( get_current_user_id(), 'theme-min-version-notice' ); update_user_meta( get_current_user_id(), 'theme-min-version-notice-min-ver', ASTRA_THEME_MIN_VER ); } if ( class_exists( 'Astra_Notices' ) ) { Astra_Notices::add_notice( array( 'id' => 'theme-min-version-notice', 'type' => 'warning', 'message' => $message, 'show_if' => true, 'repeat-notice-after' => false, 'priority' => 20, 'display-with-other-notices' => true, ) ); } } } /** * Modified Astra Addon List * * @since 1.2.1 * @param array $addons Astra addon list. * @return array $addons Updated Astra addon list. */ public function astra_addon_list( $addons = array() ) { $enabled_extensions = Astra_Ext_Extension::get_addons(); $extension_slugs = array_keys( $enabled_extensions ); $extension_slugs[] = 'white-label'; $whitelabelled = Astra_Ext_White_Label_Markup::show_branding(); foreach ( $addons as $addon_slug => $value ) { if ( ! in_array( $addon_slug, $extension_slugs ) ) { continue; } $class = 'deactive'; $links = isset( $addons[ $addon_slug ]['links'] ) ? $addons[ $addon_slug ]['links'] : array(); $links = $whitelabelled ? $links : array(); switch ( $addon_slug ) { case 'colors-and-background': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-colors-background' ), ); break; case 'typography': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-typography' ), ); break; case 'spacing': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php' ), ); break; case 'blog-pro': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-blog-group' ), ); break; case 'mobile-header': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[panel]=panel-header-group' ), ); break; case 'header-sections': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[panel]=panel-header-group' ), ); break; case 'sticky-header': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-sticky-header' ), ); break; case 'site-layouts': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-container-layout' ), ); break; case 'advanced-footer': $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-footer-group' ), ); break; case 'advanced-hooks': $links[] = array( 'link_class' => 'advanced-module', 'link_text' => ! $whitelabelled ? __( 'Settings', 'astra-addon' ) : __( ' | Settings', 'astra-addon' ), 'link_url' => admin_url( '/edit.php?post_type=astra-advanced-hook' ), ); break; case 'advanced-headers': $links[] = array( 'link_class' => 'advanced-module', 'link_text' => ! $whitelabelled ? __( 'Settings', 'astra-addon' ) : __( ' | Settings', 'astra-addon' ), 'link_url' => admin_url( '/edit.php?post_type=astra_adv_header' ), ); break; case 'nav-menu': $class .= ' nav-menu'; $links[] = array( 'link_class' => 'advanced-module', 'link_text' => ! $whitelabelled ? __( 'Settings', 'astra-addon' ) : __( ' | Settings', 'astra-addon' ), 'link_url' => admin_url( '/nav-menus.php' ), ); break; case 'white-label': $class = 'white-label'; $links = isset( $addons[ $addon_slug ]['links'] ) ? $addons[ $addon_slug ]['links'] : array(); $links[] = array( 'link_class' => 'advanced-module', 'link_text' => ! $whitelabelled ? __( 'Settings', 'astra-addon' ) : __( ' | Settings', 'astra-addon' ), 'link_url' => is_callable( 'Astra_Menu::get_theme_page_slug' ) ? admin_url( 'admin.php?page=' . Astra_Menu::get_theme_page_slug() . '&path=settings&settings=white-label' ) : '#', 'target_blank' => false, ); break; case 'woocommerce': $class .= ' woocommerce'; $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[panel]=woocommerce' ), ); break; case 'learndash': $class .= ' learndash'; $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-learndash' ), ); break; case 'lifterlms': $class .= ' lifterlms'; $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-lifterlms' ), ); break; case 'edd': $class .= ' edd'; $links[] = array( 'link_class' => 'customize-module', 'link_text' => ! $whitelabelled ? __( 'Customize', 'astra-addon' ) : __( ' | Customize', 'astra-addon' ), 'link_url' => admin_url( '/customize.php?autofocus[section]=section-edd-group' ), ); break; } $addons[ $addon_slug ]['links'] = $links; $addons[ $addon_slug ]['class'] = $class; // Don't show White Label tab if white label branding is hidden. if ( ! Astra_Ext_White_Label_Markup::show_branding() ) { unset( $addons['white-label'] ); } } return $addons; } /** * Astra Header Top Right info * * @since 1.2.1 */ public function astra_header_top_right_content() { $top_links = apply_filters( 'astra_header_top_links', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound array( 'astra-theme-info' => array( 'title' => __( 'Stylish, Lightning Fast & Easily Customizable!', 'astra-addon' ), ), ) ); } /** * Redirect to astra welcome page if visited old Astra Addon Listing page * * @since 1.2.1 * @return void */ public function redirect_addon_listing_page() { global $pagenow; /* Check current admin page. */ if ( 'themes.php' == $pagenow && isset( $_GET['action'] ) && 'addons' == $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended wp_safe_redirect( admin_url( '/themes.php?page=astra' ), 301 ); exit; } } /** * Register Scripts & Styles on admin_enqueue_scripts hook. * As we moved to React customizer so registering the 'astra-color-alpha' script in addon as there is no use of that script in theme (apperently it removed from theme). * * @since 2.7.0 */ public function enqueue_color_picker_scripts() { wp_register_script( 'astra-color-alpha', ASTRA_EXT_URI . 'admin/assets/js/wp-color-picker-alpha.js', array( 'jquery', 'wp-color-picker' ), ASTRA_EXT_VER, true ); /** * Localize wp-color-picker & wpColorPickerL10n. * * This is only needed in WordPress version >= 5.5 because wpColorPickerL10n has been removed. * * @see https://github.com/WordPress/WordPress/commit/7e7b70cd1ae5772229abb769d0823411112c748b * * This is should be removed once the issue is fixed from wp-color-picker-alpha repo. * @see https://github.com/kallookoo/wp-color-picker-alpha/issues/35 * * @since 2.7.0 */ if ( function_exists( 'astra_addon_wp_version_compare' ) && astra_addon_wp_version_compare( '5.4.99', '>=' ) ) { // Localizing variables. wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array( 'clear' => __( 'Clear', 'astra-addon' ), 'clearAriaLabel' => __( 'Clear color', 'astra-addon' ), 'defaultString' => __( 'Default', 'astra-addon' ), 'defaultAriaLabel' => __( 'Select default color', 'astra-addon' ), 'pick' => __( 'Select Color', 'astra-addon' ), 'defaultLabel' => __( 'Color value', 'astra-addon' ), ) ); } } /** * Load SVG Icon array from the JSON file. * * @param Array $svg_arr Array of svg icons. * @since 3.0.0 * @return Array addon svg icons. */ public function astra_addon_svg_icons( $svg_arr = array() ) { ob_start(); // Include SVGs Json file. include_once ASTRA_EXT_DIR . 'assets/svg/svgs.json'; $svg_icon_arr = json_decode( ob_get_clean(), true ); $ast_svg_icons = array_merge( $svg_arr, $svg_icon_arr ); return $ast_svg_icons; } /** * Add limit to show number of versions to rollback. * * @param integer $per_page per page count. * @return integer */ public function astra_addon_rollback_versions_limit( $per_page ) { return 6; } } } /** * Prepare if class 'Astra_Customizer_Loader' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Theme_Extension::get_instance(); helper-functions.php 0000644 00000033056 15150261777 0010564 0 ustar 00 <?php /** * Astra Theme Extension * * @package Astra Addon */ /** * Contrasting Color */ if ( ! function_exists( 'astra_addon_contrasting_color' ) ) : /** * Contrasting Color * * @since 1.0.0 * @param string $hexcolor Color code in HEX format. * @param string $dark Darker color in HEX format. * @param string $light Light color in HEX format. * @return string Contrasting Color. */ function astra_addon_contrasting_color( $hexcolor, $dark = '#000000', $light = '#FFFFFF' ) { return ( hexdec( $hexcolor ) > 0xffffff / 2 ) ? $dark : $light; } endif; /** * Color conversion from HEX to RGB or RGBA. */ if ( ! function_exists( 'astra_addon_hex2rgba' ) ) : /** * Color conversion from HEX to RGB or RGBA. * * @since 1.0.0 * @param string $hex Color code in HEX format. * @param string $alpha Color code alpha value for RGBA conversion. * @return string Return RGB or RGBA color code. */ function astra_addon_hex2rgba( $hex, $alpha = '' ) { $hex = str_replace( '#', '', $hex ); if ( strlen( $hex ) == 3 ) { $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); } else { $r = hexdec( substr( $hex, 0, 2 ) ); $g = hexdec( substr( $hex, 2, 2 ) ); $b = hexdec( substr( $hex, 4, 2 ) ); } $rgb = $r . ',' . $g . ',' . $b; if ( '' === $alpha ) { return 'rgb(' . $rgb . ')'; } else { $alpha = floatval( $alpha ); return 'rgba(' . $rgb . ',' . $alpha . ')'; } } endif; /** * 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 ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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; /** * Function to get Supported Custom Posts */ if ( ! function_exists( 'astra_addon_get_supported_posts' ) ) : /** * Function to get Supported Custom Posts * * @param boolean $with_tax Post has taxonomy. * @return array */ function astra_addon_get_supported_posts( $with_tax = false ) { /** * Dynamic Sidebars * * Generate dynamic sidebar for each post type. */ $post_types = get_post_types( array( 'public' => true, ), 'objects' ); $supported_types = array(); $supported_types_tax = array(); foreach ( $post_types as $slug => $post_type ) { // Avoid post types. if ( 'attachment' === $slug || 'page' === $slug || 'post' === $slug ) { continue; } // Add to supported post type. $supported_types[ $slug ] = $post_type->label; // Add the taxonomies for the post type. $taxonomies = get_object_taxonomies( $slug, 'objects' ); $another = array(); foreach ( $taxonomies as $taxonomy_slug => $taxonomy ) { if ( ! $taxonomy->public || ! $taxonomy->show_ui || 'post_format' == $taxonomy_slug ) { continue; } $another[] = $taxonomy->label; } // Add to supported post type. if ( count( $another ) ) { $supported_types_tax[] = $slug; } } if ( $with_tax ) { return $supported_types_tax; } else { return $supported_types; } } endif; /** * Function to check if it is Internet Explorer */ if ( ! function_exists( 'astra_check_is_ie' ) ) : /** * Function to check if it is Internet Explorer. * * @return true | false boolean */ function astra_check_is_ie() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $is_ie = false; $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) : false; $ua = htmlentities( $user_agent, ENT_QUOTES, 'UTF-8' ); if ( strpos( $ua, 'Trident/7.0' ) !== false ) { $is_ie = true; } return $is_ie; } endif; if ( ! function_exists( 'astra_check_is_bb_themer_layout' ) ) : /** * Check if layout is bb themer's layout */ function astra_check_is_bb_themer_layout() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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_addon_rgba2hex' ) ) : /** * Color conversion from RGBA / RGB to HEX. * * @since 1.0.0 * @param string $string Color code in RGBA / RGB format. * @param string $include_alpha Color code in RGBA / RGB format. * @return string Return HEX color code. */ function astra_addon_rgba2hex( $string, $include_alpha = false ) { $hex_color = $string; if ( ! astra_addon_check_is_hex( $string ) ) { $rgba = array(); $regex = '#\((([^()]+|(?R))*)\)#'; if ( preg_match_all( $regex, $string, $matches ) ) { $rgba = explode( ',', implode( ' ', $matches[1] ) ); } else { $rgba = explode( ',', $string ); } $rr = dechex( $rgba['0'] ); $gg = dechex( $rgba['1'] ); $bb = dechex( $rgba['2'] ); $aa = ''; if ( $include_alpha && array_key_exists( '3', $rgba ) ) { $aa = dechex( $rgba['3'] * 255 ); } $hex_color = strtoupper( "#$aa$rr$gg$bb" ); } return $hex_color; } endif; if ( ! function_exists( 'astra_addon_check_is_hex' ) ) : /** * Check if color code is HEX. * * @since 1.0.0 * @param string $string Color code any format. * @return boolean Return true | false. */ function astra_addon_check_is_hex( $string ) { $is_hex = false; $regex = '/^#(?:[0-9a-fA-F]{3}){1,2}$/'; if ( preg_match_all( $regex, $string, $matches ) ) { $is_hex = true; } return $is_hex; } endif; if ( ! function_exists( 'astra_get_addon_name' ) ) : /** * Get addon name. * * @return string Addon Name. */ function astra_get_addon_name() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $addon_name = __( 'Astra Pro', 'astra-addon' ); return apply_filters( 'astra_addon_name', $addon_name ); } endif; if ( ! function_exists( 'astra_addon_return_content_layout_page_builder' ) ) : /** * String for content layout - page-builder * * @since 1.2.1 * @return String page-builder string used for filter `astra_get_content_layout` */ function astra_addon_return_content_layout_page_builder() { return 'page-builder'; } endif; if ( ! function_exists( 'astra_addon_return_page_layout_no_sidebar' ) ) : /** * String for sidebar Layout - no-sidebar * * @since 1.2.1 * @return String no-sidebar string used for filter `astra_page_layout` */ function astra_addon_return_page_layout_no_sidebar() { return 'no-sidebar'; } endif; if ( ! function_exists( 'astra_get_prop' ) ) : /** * Get a specific property of an array without needing to check if that property exists. * * Provide a default value if you want to return a specific value if the property is not set. * * @since 1.4.0 * @link https://www.gravityforms.com/ * * @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. * * @return null|string|mixed The value */ function astra_get_prop( $array, $prop, $default = null ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) { return $default; } if ( ( isset( $array[ $prop ] ) && false === $array[ $prop ] ) ) { return false; } if ( isset( $array[ $prop ] ) ) { $value = $array[ $prop ]; } else { $value = ''; } return empty( $value ) && null !== $default ? $default : $value; } endif; /** * Check if we're being delivered AMP * * @return bool */ function astra_addon_is_amp_endpoint() { return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint(); } /** * Function astra_addon_is_breadcrumb_trail checks if the Theme has the updated version with function 'astra_breadcrumb_trail'. * We will fallback to older version of breadcrumb function 'astra_breadcrumb'. * * @param string $echo Whether to echo or return. * @since 1.8.0 */ function astra_addon_is_breadcrumb_trail( $echo = true ) { if ( function_exists( 'astra_get_breadcrumb' ) ) { return astra_get_breadcrumb( $echo ); } require ASTRA_EXT_DIR . '/addons/advanced-headers/classes/astra-breadcrumbs.php'; if ( ! $echo ) { ob_start(); astra_breadcrumb(); return ob_get_clean(); } echo wp_kses_post( astra_breadcrumb() ); } /** * Add shortcode for Breadcrumb using Theme * * @return string * @since 1.8.0 */ function astra_addon_breadcrumb_shortcode() { return astra_addon_is_breadcrumb_trail( false ); } add_shortcode( 'astra_breadcrumb', 'astra_addon_breadcrumb_shortcode' ); /** * Get the tablet breakpoint value. * * @param string $min min. * @param string $max max. * * @since 2.4.0 * * @return string $breakpoint. */ function astra_addon_get_tablet_breakpoint( $min = '', $max = '' ) { $update_breakpoint = astra_get_option( 'can-update-addon-tablet-breakpoint', true ); // Change default for new users. $default = ( true === $update_breakpoint ) ? 921 : 768; $header_breakpoint = apply_filters( 'astra_tablet_breakpoint', $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( '' !== $min ) { $header_breakpoint = $header_breakpoint - $min; } elseif ( '' !== $max ) { $header_breakpoint = $header_breakpoint + $max; } return $header_breakpoint; } /** * Get the mobile breakpoint value. * * @param string $min min. * @param string $max max. * * @since 2.4.0 * * @return string header_breakpoint. */ function astra_addon_get_mobile_breakpoint( $min = '', $max = '' ) { $header_breakpoint = apply_filters( 'astra_mobile_breakpoint', 544 ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( '' !== $min ) { $header_breakpoint = $header_breakpoint - $min; } elseif ( '' !== $max ) { $header_breakpoint = $header_breakpoint + $max; } return absint( $header_breakpoint ); } /** * Is Astra Addon existing header footer configs enable. * * @since 2.7.0 * * @return boolean true/false. */ function astra_addon_existing_header_footer_configs() { return apply_filters( 'astra_addon_existing_header_footer_configs', true ); } /** * Check is WordPress version is greater than or equal to 5.8 version. * * @since 3.5.5 * @return boolean */ function astra_addon_has_widgets_block_editor() { if ( function_exists( 'astra_has_widgets_block_editor' ) ) { return astra_has_widgets_block_editor(); } return false; } /** * Check whther to display or hide sticky header widget design options. * * @since 3.5.8 * @return boolean */ function astra_addon_remove_widget_design_options() { if ( function_exists( 'astra_remove_widget_design_options' ) ) { return astra_remove_widget_design_options(); } return false; } /** * Regenerate Theme and Addon cache files. * * @since 3.5.9 * @return void */ function astra_addon_clear_cache_assets() { // Clear Addon static CSS asset cache. Astra_Minify::refresh_assets(); // This will clear addon dynamic CSS cache file which is generated using File generation option. $astra_cache_base_instance = new Astra_Cache_Base( 'astra-addon' ); $astra_cache_base_instance->refresh_assets( 'astra-addon' ); // Clear Theme assets cache. $astra_cache_base_instance = new Astra_Cache_Base( 'astra' ); $astra_cache_base_instance->refresh_assets( 'astra' ); } add_action( 'astra_addon_update_after', 'astra_addon_clear_cache_assets', 10 ); /** * Check is Elementor Pro version is greater than or equal to beta 3.5 version. * * @since 3.6.3 * @return boolean */ function astra_addon_check_elementor_pro_3_5_version() { if ( defined( 'ELEMENTOR_PRO_VERSION' ) && version_compare( ELEMENTOR_PRO_VERSION, '3.5', '>=' ) ) { return true; } return false; } index.php 0000644 00000000170 15150261777 0006375 0 ustar 00 <?php /** * Index file * * @package Astra * @since Astra 1.0.0 */ /* Silence is golden, and we agree. */ class-astra-sites-admin.php 0000644 00000013270 15150262111 0011702 0 ustar 00 <?php /** * Admin Notices * * @since 2.3.7 * @package Astra Sites */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Astra_Sites_Admin' ) ) : /** * Admin */ class Astra_Sites_Admin { /** * Instance of Astra_Sites_Admin * * @since 2.3.7 * @var (Object) Astra_Sites_Admin */ private static $instance = null; /** * Instance of Astra_Sites_Admin. * * @since 2.3.7 * * @return object Class object. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor. * * @since 2.3.7 */ private function __construct() { add_action( 'admin_notices', array( $this, 'admin_notices' ) ); add_action( 'astra_notice_before_markup', array( $this, 'notice_assets' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) ); add_action( 'astra_sites_after_site_grid', array( $this, 'custom_upgrade_cta' ) ); add_filter( 'astra_sites_quick_links', array( $this, 'change_quick_links' ) ); } /** * Change quick links * * @since 2.6.18 * @param array $links All quick links. * @return array */ public function change_quick_links( $links = array() ) { if ( ! isset( $links['links']['upgrade'] ) ) { return $links; } // Change default call to action link. $links['links']['upgrade']['url'] = Astra_Sites::get_instance()->get_cta_link( 'quick-links-corner' ); return $links; } /** * Admin Assets */ public function admin_assets() { $current_screen = get_current_screen(); if ( 'appearance_page_starter-templates' !== $current_screen->id ) { return; } if ( Astra_Sites_White_Label::get_instance()->is_white_labeled() ) { return; } wp_enqueue_style( 'astra-sites-admin-page', ASTRA_SITES_URI . 'assets/css/admin.css', ASTRA_SITES_VER, true ); wp_enqueue_script( 'astra-sites-admin-js', ASTRA_SITES_URI . 'assets/js/admin.js', array( 'astra-sites-admin-page', 'jquery' ), ASTRA_SITES_VER, true ); } /** * Add Custom CTA Infobar. */ public function custom_upgrade_cta() { $current_screen = get_current_screen(); if ( 'appearance_page_starter-templates' !== $current_screen->id ) { return; } if ( Astra_Sites_White_Label::get_instance()->is_white_labeled() ) { return; } $custom_cta_content_data = apply_filters( 'astra_sites_custom_cta_vars', array( 'text' => __( 'Get unlimited access to all premium Starter Templates and more, at a single low cost!', 'astra-sites' ), 'button_text' => __( 'Get Essential Toolkit', 'astra-sites' ), 'cta_link' => Astra_Sites::get_instance()->get_cta_link(), ) ); $html = '<div class="astra-sites-custom-cta-wrap">'; $html .= '<span class="astra-sites-cta-title">' . esc_html( $custom_cta_content_data['text'] ) . '</span>'; $html .= '<span class="astra-sites-cta-btn">'; $html .= '<a class="astra-sites-cta-link" href="' . esc_url( $custom_cta_content_data['cta_link'] ) . '" target="_blank" >' . esc_html( $custom_cta_content_data['button_text'] ) . '</a>'; $html .= '</span>'; $html .= '</div>'; echo wp_kses_post( $html ); } /** * Admin Notices * * @since 2.3.7 * @return void */ public function admin_notices() { $image_path = esc_url( ASTRA_SITES_URI . 'inc/assets/images/logo.svg' ); $complete = get_option( 'astra_sites_import_complete', '' ); Astra_Notices::add_notice( array( 'id' => 'astra-sites-5-start-notice', 'type' => 'info', 'class' => 'astra-sites-5-star', 'show_if' => ( 'yes' === $complete && false === Astra_Sites_White_Label::get_instance()->is_white_labeled() ), /* translators: %1$s white label plugin name and %2$s deactivation link */ 'message' => sprintf( '<div class="notice-image" style="display: flex;"> <img src="%1$s" class="custom-logo" alt="Starter Templates" itemprop="logo" style="max-width: 90px;"></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 Starter Templates to build this website — Thanks a ton!', 'astra-sites' ), __( '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 Starter Templates.', 'astra-sites' ), 'https://wordpress.org/support/plugin/astra-sites/reviews/?filter=5#new-post', __( 'Ok, you deserve it', 'astra-sites' ), MONTH_IN_SECONDS, __( 'Nope, maybe later', 'astra-sites' ), __( 'I already did', 'astra-sites' ) ), ) ); } /** * Enqueue Astra Notices CSS. * * @since 2.3.7 * * @return void */ public static function notice_assets() { $file = is_rtl() ? 'astra-notices-rtl.css' : 'astra-notices.css'; wp_enqueue_style( 'astra-sites-notices', ASTRA_SITES_URI . 'assets/css/' . $file, array(), ASTRA_SITES_VER ); } } /** * Kicking this off by calling 'get_instance()' method */ Astra_Sites_Admin::get_instance(); endif;
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server.isorus.org
Server IP: 159.223.142.74
PHP Version: 7.4.33
Server Software: Apache
System: Linux server.isorus.org 4.18.0-477.27.2.el8_8.x86_64 #1 SMP Fri Sep 29 08:21:01 EDT 2023 x86_64
HDD Total: 319.99 GB
HDD Free: 212.36 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
Off
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: inceptionblue
User ID (UID): 1042
Group ID (GID): 1043
Script Owner UID:
Current Dir Owner: 1042