����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
views/front-page/class-hestia-slider-section.php 0000666 00000014351 15220735036 0015771 0 ustar 00 <?php
/**
* The Slider section handler.
*
* @package Hestia
*/
/**
* Class Hestia_Slider_Section
*/
class Hestia_Slider_Section extends Hestia_First_Front_Page_Section {
/**
* Initialize the big title content.
*/
public function init() {
add_action( 'hestia_first_front_page_section_content', array( $this, 'render_slider_content' ) );
add_filter( 'hestia_custom_header_settings', array( $this, 'add_video_support' ) );
add_filter( 'header_video_settings', array( $this, 'video_settings' ) );
}
/**
* The main render function for this section.
*/
public function render_slider_content() {
}
/**
* Get the slide classes.
*
* @param int $counter Slide index.
*
* @return string
*/
private function get_slide_class( $counter ) {
$class = 'item item-' . $counter;
if ( $counter === 1 ) {
$class .= ' active';
}
return $class;
}
/**
* Render slider background images if needed.
*
* @param string $image Background url.
*/
private function maybe_render_slide_background_image( $image ) {
if (
$this->should_display_parallax() ||
$this->should_display_video() ||
empty( $image )
) {
echo '<div class="header-filter"></div>';
return;
}
echo '<div class="header-filter" style="background-image: url(' . esc_url( $image ) . ')"></div>';
return;
}
/**
* Render buttons for slide.
*
* @param array $settings Settings array.
*/
private function render_slide_buttons( $settings ) {
$link = $settings['link'];
$button = $settings['button'];
$color = $settings['color'];
$link2 = $settings['link2'];
$button2 = $settings['button2'];
$color2 = $settings['color2'];
$slide_nb = $settings['counter'];
if (
empty( $link ) &&
empty( $button ) &&
empty( $link2 ) &&
empty( $button2 ) ) {
return;
}
$allowed_tags = array(
'i' => array(
'class' => array(),
),
'span' => array(
'class' => array(),
),
'br' => array(),
'em' => array(),
'strong' => array(),
); ?>
<div class="buttons">
<?php
if ( ! empty( $link ) && ! empty( $button ) ) {
$button = html_entity_decode( $button );
echo '<a href="' . esc_url( $link ) . '" title="' . esc_html( $button ) . '" class="btn btn-primary btn-left ' . ( ! empty( $color ) ? 'has-color' : '' ) . '" ' . hestia_is_external_url( $link ) . '>' . wp_kses( $button, $allowed_tags ) . '</a>';
}
if ( ! empty( $link2 ) && ! empty( $button2 ) ) {
$button2 = html_entity_decode( $button2 );
echo '<a href="' . esc_url( $link2 ) . '" title="' . esc_html( $button2 ) . '" class="btn btn-primary btn-right ' . ( ! empty( $color2 ) ? 'has-color' : '' ) . '" ' . hestia_is_external_url( $link2 ) . '>' . wp_kses( $button2, $allowed_tags ) . '</a>';
}
hestia_big_title_section_buttons_trigger( $slide_nb );
?>
</div>
<?php
}
/**
* Function to style slider button colors.
*
* @param string $color1 string first color.
* @param string $color2 string second color.
* @param string $item_number slide number.
*
* @return string
*/
private function get_button_style(
$color1, $color2, $item_number
) {
if ( empty( $color1 ) && empty( $color2 ) ) {
return '';
}
$hover = get_theme_mod( 'hestia_buttons_hover_effect', 'shadow' );
$colors = array();
if ( ! empty( $color1 ) ) {
$ajusted_color1 = hestia_adjust_brightness( $color1, - 20 );
$colors['.btn-left'] = array( $color1, $ajusted_color1 );
}
if ( ! empty( $color2 ) ) {
$ajusted_color2 = hestia_adjust_brightness( $color2, - 20 );
$colors['.btn-right'] = array( $color2, $ajusted_color2 );
}
if ( empty( $item_number ) ) {
return '';
}
$style = '';
foreach ( $colors as $class => $color ) {
if ( ! empty( $color ) && ! empty( $class ) ) {
if ( ! empty( $color[0] ) ) {
$style .= '
.item.item-' . $item_number . ' .buttons ' . esc_attr( $class ) . '{
background-color:' . $color[0] . ';
-webkit-box-shadow: 0 2px 2px 0 ' . hestia_hex_rgba( $color[0], '0.14' ) . ',0 3px 1px -2px ' . hestia_hex_rgba( $color[0], '0.2' ) . ',0 1px 5px 0 ' . hestia_hex_rgba( $color[0], '0.12' ) . ';
box-shadow: 0 2px 2px 0 ' . hestia_hex_rgba( $color[0], '0.14' ) . ',0 3px 1px -2px ' . hestia_hex_rgba( $color[0], '0.2' ) . ',0 1px 5px 0 ' . hestia_hex_rgba( $color[0], '0.12' ) . ';
}';
$style .= '
.item.item-' . $item_number . ' .buttons ' . esc_attr( $class ) . ':hover {
-webkit-box-shadow: 0 14px 26px -12px' . hestia_hex_rgba( $color[0], '0.42' ) . ',0 4px 23px 0 rgba(0,0,0,0.12),0 8px 10px -5px ' . hestia_hex_rgba( $color[0], '0.2' ) . ';
box-shadow: 0 14px 26px -12px ' . hestia_hex_rgba( $color[0], '0.42' ) . ',0 4px 23px 0 rgba(0,0,0,0.12),0 8px 10px -5px ' . hestia_hex_rgba( $color[0], '0.2' ) . ';
}';
}
if ( $hover === 'color' && ! empty( $color[1] ) ) {
$style .= '
.item.item-' . $item_number . ' .buttons ' . esc_attr( $class ) . ':hover{
background-color:' . $color[1] . ';
box-shadow: none!important;
}';
}
}
}
return '<style>' . hestia_minimize_css( $style ) . '</style>';
}
/**
* Utility to check if we should display video background.
*/
private function should_display_video() {
if ( ! class_exists( 'Hestia_Slider_Controls_Addon' ) ) {
return false;
}
$slider_type = get_theme_mod( 'hestia_slider_type', apply_filters( 'hestia_slider_type_default', 'image' ) );
if ( $slider_type !== 'video' ) {
return false;
}
$external_video = get_theme_mod( 'external_header_video' );
$video_file = get_theme_mod( 'header_video' );
if ( empty( $external_video ) && empty( $video_file ) ) {
return false;
}
return true;
}
/**
* Add support for video header.
*
* @since 1.1.52
*
* @param array $settings Custom header settings.
*
* @return array
*/
public function add_video_support( $settings ) {
$settings['video'] = true;
return $settings;
}
/**
* Function to change video settings.
*
* @param array $settings Video settings.
*
* @since 1.1.52
* @return array
*/
public function video_settings( $settings ) {
$settings['width'] = 5120;
$settings['height'] = 2880;
return $settings;
}
}
controls/ui/customizer-tabs/style.css 0000666 00000006021 15220735036 0014037 0 ustar 00 .customize-control-interface-tabs {
display: list-item !important;
}
.hestia-tabs-control {
border-bottom: 1px solid #ddd;
width: calc(100% + 28px);
margin: -15px 0 0 -12px;
table-layout: fixed;
display: table;
}
.hestia-tabs-control .hestia-customizer-tab {
border-right: 1px solid #ddd;
display: table-cell;
text-align: center;
width: 100%;
}
.hestia-tabs-control .hestia-customizer-tab:last-child {
border-right: none;
}
.hestia-tabs-control .hestia-customizer-tab label{
text-transform: capitalize;
background: #fff;
box-shadow: inset 0 0 0 0 #0085ba;
transition: all .3s ease;
display: block;
width: 100%;
padding: 10px 0;
text-decoration: none;
font-weight: 600;
color: #333;
display: flex;
align-items: center;
font-size: inherit;
line-height: 1;
justify-content: center;
}
.hestia-tabs-control .hestia-customizer-tab label i {
color: #333;
margin-right: 4px;
}
.hestia-tabs-control .hestia-customizer-tab label:hover {
color: #0085ba;
background: #f3f3f5;
}
.hestia-tabs-control .hestia-customizer-tab label:hover i {
color: #333;
}
.hestia-tabs-control .hestia-customizer-tab.active label{
box-shadow: inset 0 -3px 0 0 #0085ba;
color: #0085ba;
background-color: #fff;
}
.hestia-tabs-control input[type="radio"] {
display: none !important;
}
.hestia-tabs-control span.dashicons-lock {
font-size: 12px;
color: #a3a3a3;
width: 12px;
height: 12px;
vertical-align: middle;
}
.hestia-customizer-tab label span:last-child {
margin-left: 5px;
}
.hestia-customizer-tab label span:first-child {
margin-right: 3px;
}
#customize-control-hestia_pricing_upsell_notice ~ li {
opacity: .4;
pointer-events: none;
}
.customize-control.customize-control-checkbox .dashicons-lock,
.customize-control.customize-control-text .dashicons-lock,
.customize-control.customize-control-media .dashicons-lock,
.customize-control.customize-control-textarea .dashicons-lock,
.customize-control.customize-control-radio-image .dashicons-lock {
font-size: 16px;
color: #A3A3A3;
margin-top: 3px;
}
select + span.dashicons-lock:not(.is-pro-option) {
opacity: 0;
}
select.is-pro-option + span.dashicons-lock {
position: absolute;
bottom: -5px;
left: 50px;
font-size: 16px;
color: #A3A3A3;
opacity: 1;
}
#customize-control-hestia_slider_type label {
position: relative;
}
#sub-accordion-section-hestia_big_title:not(.hestia-locked-icon) span.dashicons-lock {
display: none;
}
#sub-accordion-section-hestia_big_title.hestia-locked-icon li#customize-control-hestia_slider_type ~ li {
opacity: .4;
pointer-events: none;
}
#sub-accordion-section-hestia_big_title.hestia-locked-icon #customize-control-hestia_big_title_upsell_notice {
display: block !important;
}
.customize-locked-control {
opacity: .4;
pointer-events: none;
}
#customize-control-hestia_cart_custom_icon:not(.hestia-show-custom-icon) {
display: none;
}
.customize-control-checkbox#customize-control-hestia_cart_icon_status .dashicons-lock {
margin-top: 1px;
}
#customize-control-hestia_cart_icon {
display: none;
} controls/ui/class-hestia-button.php 0000666 00000007635 15220735036 0013450 0 ustar 00 <?php
/**
* Customizer functionality for the Blog settings panel.
*
* @package Hestia
* @since 1.0.0
*/
/**
* A customizer control to display text in customizer.
*
* @since 1.0.0
*/
class Hestia_Button extends WP_Customize_Control {
/**
* Control id
*
* @var string $id Control id.
*/
public $id = '';
/**
* Control label
*
* @var string $id Control id.
*/
public $label;
/**
* Control description
*
* @var string $id Control id.
*/
public $description;
/**
* Button class.
*
* @var mixed|string
*/
public $button_class = '';
/**
* Icon class.
*
* @var mixed|string
*/
public $icon_class = '';
/**
* Button text.
*
* @var mixed|string
*/
public $button_text = '';
/**
* Text before.
*
* @var mixed|string
*/
public $text_before = '';
/**
* Text after.
*
* @var mixed|string
*/
public $text_after = '';
/**
* Is Button.
*
* @var bool
*/
public $is_button = true;
/**
* Control to focus.
*
* @var string
*/
public $focus = '';
/**
* Focus type.
*
* @var string
*/
public $focus_type = 'control';
/**
* Focus type.
*
* @var string
*/
public $new_tab = false;
/**
* Link.
*
* @var string
*/
public $link;
/**
* Shortcut.
*
* @var bool
*/
public $shortcut = false;
/**
* Class for the container of button.
*
* @var string
*/
public $container_class = false;
/**
* Constructor.
*
* @param WP_Customize_Manager $manager Customizer manager.
* @param string $id Control id.
* @param array $args Argument.
*/
public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args );
$this->id = $id;
}
/**
* Render content for the control.
*
* @since 1.0.0
*/
public function render_content() {
if ( empty( $this->button_text ) ) {
return;
}
if ( $this->label ) {
echo '<span class="customize-control-title">';
echo wp_kses_post( $this->label );
echo '</span>';
}
if ( $this->description ) {
echo '<p class="customize-control-description">';
echo wp_kses_post( $this->description );
echo '</span>';
}
$control = $this->is_button ? '<p' : '<span';
if ( $this->container_class ) {
$control .= ' class="' . esc_attr( $this->container_class ) . '"';
}
$control .= '>';
if ( ! empty( $this->text_before ) ) {
$control .= wp_kses_post( $this->text_before ) . ' ';
}
$control .= $this->is_button ? '<button ' : '<a style="cursor: pointer;" ';
if ( $this->link ) {
$control .= $this->is_button ? '' : 'href="' . esc_url( $this->link ) . '" ';
$control .= $this->new_tab ? 'target="_blank" ' : '';
}
if ( $this->focus ) {
$control .= 'data-' . $this->focus_type . '-focus="' . esc_attr( $this->focus ) . '"';
}
$control .= ' class="' . esc_attr( $this->get_button_classes() ) . '"';
$control .= $this->is_button ? ' style="display: flex; align-items: center;"' : '';
$control .= '>';
$control .= $this->get_icon();
$control .= esc_html( $this->button_text );
$control .= $this->is_button ? '</button>' : '</a>';
if ( ! empty( $this->text_after ) ) {
$control .= wp_kses_post( $this->text_after );
}
$control .= $this->is_button ? '</p>' : '</span>';
echo $control; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Get the icon.
*
* @return string
*/
private function get_icon() {
if ( empty( $this->icon_class ) ) {
return '';
}
return '<i class="dashicons dashicons-' . esc_attr( $this->icon_class ) . '" style="margin-right: 10px"></i>';
}
/**
* Get the button classes.
*
* @return string
*/
private function get_button_classes() {
$classes = '';
if ( $this->is_button ) {
$classes .= 'button button-secondary';
}
if ( $this->shortcut ) {
$classes .= ' menu-shortcut ';
}
if ( $this->button_class ) {
$classes .= $this->button_class;
}
return $classes;
}
}
controls/ui/helper-plugin-install/helper-script.js 0000666 00000007302 15220735036 0016373 0 ustar 00 /**
* Remove activate button and replace with activation in progress button.
*
* @package Hestia
*/
/* global hestia_plugin_helper */
/* global console */
jQuery( document ).ready(
function ( $ ) {
$.pluginInstall = {
'init': function () {
this.handleInstall();
this.handleActivate();
},
'handleInstall': function () {
var self = this;
$( 'body' ).on( 'click', '.hestia-install-plugin', function (e) {
e.preventDefault();
var button = $( this );
var slug = button.attr( 'data-slug' );
var url = button.attr( 'href' );
var redirect = $( button ).attr( 'data-redirect' );
button.text( wp.updates.l10n.installing );
button.addClass('updating-message');
wp.updates.installPlugin(
{
slug: slug,
success: function(){
button.text(hestia_plugin_helper.activating + '...');
self.activatePlugin(url, redirect);
}
}
);
});
},
'activatePlugin': function (url, redirect) {
if (typeof url === 'undefined' || !url) {
return;
}
jQuery.ajax(
{
async: true,
type: 'GET',
url: url,
success: function () {
// Reload the page.
if (typeof(redirect) !== 'undefined' && redirect !== '') {
window.location.replace(redirect);
} else {
location.reload();
}
},
error: function (jqXHR, exception) {
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status === 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status === 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
console.log(msg);
},
}
);
},
'handleActivate': function () {
var self = this;
$( 'body' ).on( 'click', '.activate-now', function (e) {
e.preventDefault();
var button = $( this );
var url = button.attr( 'href' );
var redirect = button.attr( 'data-redirect' );
button.addClass('updating-message');
button.text(hestia_plugin_helper.activating + '...');
self.activatePlugin(url,redirect);
});
},
};
$.pluginInstall.init();
}
); controls/ui/helper-plugin-install/class-hestia-plugin-install-helper.php 0000666 00000012551 15220735036 0022564 0 ustar 00 <?php
/**
* Plugin install helper.
*
* @package Hestia
* @since Hestia 1.1.31
*/
/**
* Class Hestia_Plugin_Install_Helper
*/
class Hestia_Plugin_Install_Helper {
/**
* Instance of class.
*
* @var bool $instance instance variable.
*/
private static $instance;
/**
* Check if instance already exists.
*
* @return Hestia_Plugin_Install_Helper
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Hestia_Plugin_Install_Helper ) ) {
self::$instance = new Hestia_Plugin_Install_Helper;
}
return self::$instance;
}
/**
* Get plugin path based on plugin slug.
*
* @param string $slug Plugin slug.
*
* @return string
*/
public static function get_plugin_path( $slug ) {
switch ( $slug ) {
case 'mailin':
return $slug . '/sendinblue.php';
break;
case 'wpforms-lite':
return $slug . '/wpforms.php';
break;
case 'intergeo-maps':
case 'visualizer':
case 'translatepress-multilingual':
return $slug . '/index.php';
break;
case 'beaver-builder-lite-version':
return $slug . '/fl-builder.php';
break;
case 'adblock-notify-by-bweb':
return $slug . '/adblock-notify.php';
break;
default:
return $slug . '/' . $slug . '.php';
}
}
/**
* Generate action button html.
*
* @param string $slug plugin slug.
*
* @return string
*/
public function get_button_html( $slug, $settings = array() ) {
$button = '';
$redirect = '';
if ( ! empty( $settings ) && array_key_exists( 'redirect', $settings ) ) {
$redirect = $settings['redirect'];
}
$state = $this->check_plugin_state( $slug );
if ( empty( $slug ) ) {
return '';
}
$plugin_name = '';
if ( ! empty( $settings ) && array_key_exists( 'plugin_name', $settings ) ) {
$plugin_name = $settings['plugin_name'];
}
$additional = '';
if ( $state === 'deactivate' ) {
$additional = ' action_button active';
}
$button .= '<div class=" plugin-card-' . esc_attr( $slug ) . esc_attr( $additional ) . '" style="padding: 8px 0 5px;">';
$plugin_link_suffix = self::get_plugin_path( $slug );
$nonce = add_query_arg(
array(
'action' => 'activate',
'plugin' => rawurlencode( $plugin_link_suffix ),
'plugin_status' => 'all',
'paged' => '1',
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin_link_suffix ),
),
network_admin_url( 'plugins.php' )
);
switch ( $state ) {
case 'install':
$button .= '<a data-redirect="' . esc_url( $redirect ) . '" data-slug="' . esc_attr( $slug ) . '" class="install-now hestia-install-plugin button " href="' . esc_url( $nonce ) . '" data-name="' . esc_attr( $slug ) . '" aria-label="Install ' . esc_attr( $slug ) . '">' . __( 'Install and activate', 'hestia' ) . ' ' . esc_html( $plugin_name ) . '</a>';
break;
case 'activate':
$button .= '<a data-redirect="' . esc_url( $redirect ) . '" data-slug="' . esc_attr( $slug ) . '" class="activate-now button button-primary" href="' . esc_url( $nonce ) . '" aria-label="Activate ' . esc_attr( $slug ) . '">' . esc_html__( 'Activate', 'hestia' ) . ' ' . esc_html( $plugin_name ) . '</a>';
break;
case 'deactivate':
$nonce = add_query_arg(
array(
'action' => 'deactivate',
'plugin' => rawurlencode( $plugin_link_suffix ),
'plugin_status' => 'all',
'paged' => '1',
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . $plugin_link_suffix ),
),
network_admin_url( 'plugins.php' )
);
$button .= '<a data-redirect="' . esc_url( $redirect ) . '" data-slug="' . esc_attr( $slug ) . '" class="deactivate-now button" href="' . esc_url( $nonce ) . '" data-name="' . esc_attr( $slug ) . '" aria-label="Deactivate ' . esc_attr( $slug ) . '">' . esc_html__( 'Deactivate', 'hestia' ) . ' ' . esc_html( $plugin_name ) . '</a>';
break;
case 'enable_cpt':
$url = admin_url( 'admin.php?page=jetpack#/settings' );
$button .= '<a data-redirect="' . esc_url( $redirect ) . '" class="button" href="' . esc_url( $url ) . '">' . esc_html__( 'Activate', 'hestia' ) . ' ' . esc_html__( 'Jetpack Portfolio', 'hestia' ) . '</a>';
break;
}// End switch().
$button .= '</div>';
return $button;
}
/**
* Check plugin state.
*
* @param string $slug plugin slug.
*
* @return bool
*/
public function check_plugin_state( $slug ) {
$plugin_link_suffix = self::get_plugin_path( $slug );
if ( is_file( ABSPATH . 'wp-content/plugins/' . $plugin_link_suffix ) ) {
$needs = is_plugin_active( $plugin_link_suffix ) ? 'deactivate' : 'activate';
if ( $needs === 'deactivate' && ! post_type_exists( 'portfolio' ) && $slug === 'jetpack' ) {
return 'enable_cpt';
}
return $needs;
} else {
return 'install';
}
}
/**
* Enqueue Function.
*/
public function enqueue_scripts() {
wp_enqueue_script( 'plugin-install' );
wp_enqueue_script( 'updates' );
wp_enqueue_script( 'hestia-plugin-install-helper', get_template_directory_uri() . '/inc/customizer/controls/ui/helper-plugin-install/helper-script.js', array( 'jquery' ), HESTIA_VERSION, true );
wp_localize_script(
'hestia-plugin-install-helper',
'hestia_plugin_helper',
array(
'activating' => esc_html__(
'Activating',
'hestia',
) . ' ',
)
);
wp_localize_script(
'hestia-plugin-install-helper',
'pagenow',
array( 'import' )
);
}
}
controls/ui/customizer-scroll/class-hestia-customizer-scroll-ui.php 0000666 00000002107 15220735036 0021735 0 ustar 00 <?php
/**
* This class allows developers to implement scrolling to sections.
*
* @package Hestia
* @since 1.1.49
* @author Andrei Baicus <andrei@themeisle.com>
* @copyright Copyright (c) 2017, Themeisle
* @link http://themeisle.com/
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
/**
* Scroll to section.
*
* @since 1.1.45
* @access public
*/
class Hestia_Customizer_Scroll_Ui extends Hestia_Abstract_Main {
/**
* Hestia_Customize_Control_Scroll constructor.
*/
public function init() {
add_action( 'customize_preview_init', array( $this, 'helper_script_enqueue' ) );
}
/**
* The priority of the control.
*
* @since 1.1.45
* @var string
*/
public $priority = 0;
/**
* Enqueue the partials handler script that works synchronously with the hestia-scroller-script
*/
public function helper_script_enqueue() {
wp_enqueue_script( 'hestia-scroller-addon-script', get_template_directory_uri() . '/inc/customizer/controls/ui/customizer-scroll/helper-script.js', array( 'jquery' ), HESTIA_VERSION, true );
}
}
controls/custom-controls/dimensions/dimensions.css 0000666 00000003462 15220735036 0016630 0 ustar 00 .customize-control-hestia-dimensions ul {
display: flex;
align-items: center;
}
.customize-control-hestia-dimensions li {
flex-grow: 1;
}
.customize-control-hestia-dimensions .dimension-wrap input,
.customize-control-hestia-dimensions .dimension-wrap button {
font-size: 12px;
width: 100%;
height: 28px;
border: 1px solid #a4afb7;
border-left-width: 0;
border-radius: 0;
text-align: center;
}
.customize-control-hestia-dimensions .dimension-wrap:first-child input {
border-left-width: 1px;
border-radius: 3px 0 0 3px;
}
.customize-control-hestia-dimensions .dimension-wrap .link-dimensions {
background: #fff;
border: 1px solid #a4afb7;
border-left-width: 0;
outline: none;
border-radius: 0 3px 3px 0;
cursor: pointer;
}
.customize-control-hestia-dimensions .dimension-wrap .link-dimensions span {
background: #fff;
padding: 4px 0;
width: 100%;
}
.customize-control-hestia-dimensions .dimension-wrap .link-dimensions .hestia-linked {
background-color: #a4afb7;
color: #fff;
}
.customize-control-hestia-dimensions .dimension-wrap .link-dimensions.unlinked .hestia-unlinked {
display: none;
}
.customize-control-hestia-dimensions .dimension-wrap .link-dimensions.unlinked .hestia-linked {
display: block;
}
.customize-control-hestia-dimensions .dimension-wrap .link-dimensions .hestia-linked {
display: none;
}
.control-wrap {
width: 100%;
}
.has-media-queries .control-wrap {
display: none;
width: 100%;
}
.has-media-queries .control-wrap.active {
display: flex;
}
.customize-control span.reset-dimensions {
display: flex;
justify-content: center;
color: rgba(0, 0, 0, .2);
cursor: pointer;
transition: all .3s ease;
}
.customize-control span.reset-dimensions:hover {
color: #fe5252;
} controls/custom-controls/dimensions/dimensions.js 0000666 00000007134 15220735036 0016454 0 ustar 00 wp.customize.controlConstructor['hestia-dimensions'] = wp.customize.Control.extend({
updateControl: function (value, query) {
var control = this;
var selector = control.selector;
var currentValue = jQuery(selector).find('.dimensions-collector').val();
if( typeof currentValue !== 'undefined' && currentValue !== ''){
var obj = JSON.parse(currentValue);
obj[query] = value;
control.setting.set( JSON.stringify(obj) );
} else {
var returnObject = {};
returnObject[query] = value;
control.setting.set( JSON.stringify(returnObject) );
}
},
ready: function() {
'use strict';
var control = this;
var selector = control.selector;
jQuery(selector).find('.dimensions-reset-container').on( 'click', function () {
var default_value = jQuery(this).data('default');
var dimensions = ['desktop','tablet','mobile'];
dimensions.forEach(function (value) {
if( typeof default_value[value] !== 'undefined' ){
var decodedValue = JSON.parse(default_value[value]);
for (var key in decodedValue) {
var val = decodedValue[key];
jQuery( selector ).find('.'+key).find('input').val(val);
}
control.updateControl(default_value[value],value);
}
});
});
var dimensions = ['desktop','tablet','mobile'];
var types = ['_vertical', '_horizontal', '_top', '_left', '_right', '_bottom'];
dimensions.forEach(function (value) {
control.container.on( 'change keyup paste', '.dimension-'+value+'_vertical, .dimension-'+value+'_horizontal, .dimension-'+value+'_top, .dimension-'+value+'_bottom, .dimension-'+value+'_left, .dimension-'+value+'_right', function() {
var return_value = {};
var family = jQuery( this ).parent().parent();
types.forEach(function (type) {
if( family.find('.dimension-'+value+type).length > 0 ){
return_value[value+type] = family.find('.dimension-'+value+type).val();
}
});
control.updateControl(JSON.stringify(return_value),value);
} );
});
}
});
jQuery( document ).ready( function($) {
// Linked button
$( '.hestia-linked' ).on( 'click', function() {
// Set up variables
var $this = $( this );
// Remove linked class
$this.parent().parent( '.dimension-wrap' ).prevAll().slice(0,4).find( 'input' ).removeClass( 'linked' ).attr( 'data-element', '' );
// Remove class
$this.parent( '.link-dimensions' ).removeClass( 'unlinked' );
} );
// Unlinked button
$( '.hestia-unlinked' ).on( 'click', function() {
// Set up variables
var $this = $( this ),
$element = $this.data( 'element' );
// Add linked class
$this.parent().parent( '.dimension-wrap' ).prevAll().slice(0,4).find( 'input' ).addClass( 'linked' ).attr( 'data-element', $element );
// Add class
$this.parent( '.link-dimensions' ).addClass( 'unlinked' );
} );
// Values linked inputs
$( '.dimension-wrap' ).on( 'input', '.linked', function() {
var $data = $( this ).attr( 'data-element' ),
$val = $( this ).val();
$( '.linked[ data-element="' + $data + '" ]' ).each( function() {
$( this ).val( $val ).change();
} );
} );
} ); controls/custom-controls/alpha-color-picker/style.css 0000666 00000011325 15220735036 0017121 0 ustar 00 /**
* Alpha Color Picker CSS
*/
.customize-control-alpha-color .wp-picker-container .iris-picker {
border-bottom: none;
}
.customize-control-alpha-color .wp-picker-container {
max-width: 257px;
}
.customize-control-alpha-color .wp-picker-open + .wp-picker-input-wrap {
width: 100%;
}
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
float: left;
width: 195px;
}
.customize-control-alpha-color .wp-picker-input-wrap .button {
margin-left: 0;
float: right;
}
.wp-picker-container .wp-picker-open ~ .wp-picker-holder .alpha-color-picker-container {
display: block;
}
.alpha-color-picker-container {
border: 1px solid #dfdfdf;
border-top: none;
display: none;
background: #FFF;
padding: 0 11px 10px;
position: relative;
}
.alpha-color-picker-container .ui-widget-content,
.alpha-color-picker-container .ui-widget-header,
.alpha-color-picker-wrap .ui-state-focus {
background: transparent;
border: none;
}
.alpha-color-picker-wrap a.iris-square-value:focus {
-webkit-box-shadow: none;
box-shadow: none;
}
.alpha-color-picker-container .ui-slider {
position: relative;
z-index: 1;
height: 24px;
text-align: center;
margin: 0 auto;
width: 88%;
width: calc( 100% - 28px );
}
.alpha-color-picker-container .ui-slider-handle,
.alpha-color-picker-container .ui-widget-content .ui-state-default {
color: #777;
background-color: #FFF;
text-shadow: 0 1px 0 #FFF;
text-decoration: none;
position: absolute;
z-index: 2;
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
border: 1px solid #aaa;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
margin-top: -2px;
top: 0;
height: 26px;
width: 26px;
cursor: ew-resize;
font-size: 0;
padding: 0;
line-height: 27px;
margin-left: -14px;
}
.alpha-color-picker-container .ui-slider-handle.show-opacity {
font-size: 12px;
}
.alpha-color-picker-container .click-zone {
width: 14px;
height: 24px;
display: block;
position: absolute;
left: 10px;
}
.alpha-color-picker-container .max-click-zone {
right: 10px;
left: auto;
}
.alpha-color-picker-container .transparency {
height: 24px;
width: 100%;
background-color: #FFF;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAAYCAQAAAC18BLUAAAF0ElEQVRo3pVa69XrNgwjfLqL1+g2Xandpmt4GaM/4gdFApKbe26+xLYkik8QCv5mMCLu9+f/zuB19Yy43hnnEc91Bq+rDD7P32N+n+7nn+/XTOfO53rE+dzn8bt6PnNcn/bfs+881/XjTPOf7739fvoc1xfz/+Sp81wjjvOVIc+1Fznu68co+TNP0s+ZNPXbr/i3Zy2/f3/Pj1cjGNzj/rZFBCK/MAyJ4HUfwefzPYZl5P2iuPZ+hxiVr3H4juRu93221fFImkdj+Mw0GmkOPDOO6+Y5KHQ0rsW2E6Sr8QQL48vrtyranqtkTcN/cntUg2FzeCaEMBoexVRTKDPWrVflUIqqnIVpq0irs6mYbQY2w3ApXaTMFWm/THIz6Q5lZF6T0hSUso7XaINDvjYz8F2KwkvYPBfCX7WQmPhlSIWOaqvGyEpC2QeH2I3yFKYRw8GJ7j3o/MPHzFEcgM3E41MQ7sRBZ0yrKzdrbrwJEXW04DFl96O8eIh79Q4H86NsiMLctErX2YBP1GDiMJAOmNdDc5+VE/i1MMzr89it66xTfnC/6+8maqDfBFKVhYhF2s30+ljXc6OdNNk5VB1T4yDyBoZYRoom5ZJ1Xxo5wMQybSbrKbvjjj625hpE/IutJbfs5yGSnfdEX4fuhIPJRlRq9BljBBAoqD0++DQGYypThUmgFbKgFRfKYoZFwKj8wTY2YxyRZX7wSFWYmiRQDP0NvY3JT20ZKdowAA+YyPBJGgLERYo7SiCi0atyYRoHo02iKBIrt/Zu1zWH3LY0J0TEHaUKf9ZkQxnma+EgssAsEcKoigYhjpGGYsjs2Rwwcp4JqdJRND/VnXyBcbLHJzOush4nDc6zmzdKOYHLIbYCodxZUl2lQ9oYcOvpJoei46VMd2iIns3kVfIayZB9K0xZ4sJUDqRxgYyL3raWGhReVWZCi2PKpkWnGhgVs/RxHJoHCJVBpnpKLM5mfBT8oDMKZRbBgBUoNVF3iGkmC6NpF2LRdjrAI5jpMFl4nTIo2534RC841EcTASNydjmlO57rNWGKQ12nGkxnKyzQ8wrvo1mkzoVgxJ/8Y9ddWBwVJl939jzd+c53GPH2jt0YCB4Ghu9s1YqBiIPyee4Gzx5nUvqZnkciAVPFPUJWaexnccHzN+pQBenHjXdS9daPKB+77oV5hOa7do2KcVx6O1KUuh6Ok9qFKVpT6XQGnyBYk4qt0aoIBTPKQnKiJX9K+hMFJavq2JEzJ5Cvc9f4wFipiszCC9imbZPMi06NbNBgZSZN1GtBHXGBD4Cjwgkse0BU8D+4TqX+Kc2JIhskNp0fdawOK8L25e/6pUBtolWGoawUYeX7vKymOcbjEJucdn29ZVk3ABhUS/HOSeZhMTiM66vZKNA2luZUAeVzXYF8f3ETDSs/cYkwJy40R0QYukjIlKYgy4rghywTmNLvmTuqadGbAVaVY+GAIOXn3BsmNOrIEffmpvQr/wy1lK2GzZtpLtWdvZaSze11CaUZgU3qPaohGgWU9TmcisDSoB019MJD00XO8D4XydcRLx+7jDFKvzQkIQljTBgPiKM12EYEppLHhPdlSYyM2RkjWkPCDzHjUx4kJ46JZmagkuZQw0FXsddNQGsadAvLeXLRDmPSbUGS9hDsjuKivpy+uoSJhdGwxPs0B3KQbNXaPbTjemIQ5RAjxsQL60X6EBwNCKFgSF0ZuWyCvLlgmxeYCtqhPj63ahwOExS/5aAMDc9F2dgoyWF+BaHoT3Z4NP7kw/vP2M7QMEUUJyVoUL9vIWSl0sphm4MFD6P0d7CVfsbLaikh2jTHSHNB6a/QCCf5Qvblb5R21VcvdM0EpuLBgC3VPiiCHOIMhgOShGBe1bwwlX40HJbgxWNqRTjO+O340IRh2Wy1hqr/qoGO4W+eg//B+erTfdimBQPdRnm2QhE//axVqaOm0oqOIX+Yptmtzhc5RM8F8lC/eRzzSMf7vSDFf67LPR9fAb+7AAAAAElFTkSuQmCC);
box-shadow: 0 0 5px rgba(0,0,0,0.4) inset;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 0;
margin-top: -24px;
}
@media only screen and (max-width: 782px) {
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
width: 184px;
}
}
@media only screen and (max-width: 640px) {
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
width: 172px;
height: 33px;
}
}
controls/custom-controls/repeater/script.js 0000666 00000040133 15220735036 0015243 0 ustar 00 /**
* Customizer repeater
*
* @package Hestia
*/
/* global jQuery */
/* global wp */
function media_upload(button_class) {
'use strict';
jQuery( 'body' ).on(
'click', button_class, function () {
var button_id = '#' + jQuery( this ).attr( 'id' );
var display_field = jQuery( this ).parent().children( 'input:text' );
var _custom_media = true;
wp.media.editor.send.attachment = function (props, attachment) {
if (_custom_media) {
if (typeof display_field !== 'undefined') {
switch (props.size) {
case 'full':
display_field.val( attachment.sizes.full.url );
display_field.trigger( 'change' );
break;
case 'medium':
display_field.val( attachment.sizes.medium.url );
display_field.trigger( 'change' );
break;
case 'thumbnail':
display_field.val( attachment.sizes.thumbnail.url );
display_field.trigger( 'change' );
break;
default:
display_field.val( attachment.url );
display_field.trigger( 'change' );
}
}
_custom_media = false;
} else {
return wp.media.editor.send.attachment( button_id, [props, attachment] );
}
};
wp.media.editor.open( button_class );
return false;
}
);
}
/********************************************
* ** Generate unique id ***
*********************************************/
function customizer_repeater_uniqid(prefix, more_entropy) {
'use strict';
if (typeof prefix === 'undefined') {
prefix = '';
}
var retId;
var php_js;
var formatSeed = function (seed, reqWidth) {
seed = parseInt( seed, 10 )
.toString( 16 ); // to hex str
if (reqWidth < seed.length) { // so long we split
return seed.slice( seed.length - reqWidth );
}
if (reqWidth > seed.length) { // so short we pad
return new Array( 1 + (reqWidth - seed.length) )
.join( '0' ) + seed;
}
return seed;
};
// BEGIN REDUNDANT
if ( ! php_js) {
php_js = {};
}
// END REDUNDANT
if ( ! php_js.uniqidSeed) { // init seed with big random int
php_js.uniqidSeed = Math.floor( Math.random() * 0x75bcd15 );
}
php_js.uniqidSeed++;
retId = prefix; // start with prefix, add current milliseconds hex string
retId += formatSeed(
parseInt(
new Date()
.getTime() / 1000, 10
), 8
);
retId += formatSeed( php_js.uniqidSeed, 5 ); // add seed hex string
if (more_entropy) {
// for more entropy we add a float lower to 10
retId += (Math.random() * 10)
.toFixed( 8 )
.toString();
}
return retId;
}
/********************************************
* ** General Repeater ***
*********************************************/
function customizer_repeater_refresh_social_icons(th) {
'use strict';
var icons_repeater_values = [];
th.find( '.customizer-repeater-social-repeater-container' ).each(
function () {
var icon = jQuery( this ).find( '.icp' ).val();
var link = jQuery( this ).find( '.customizer-repeater-social-repeater-link' ).val();
var id = jQuery( this ).find( '.customizer-repeater-social-repeater-id' ).val();
if ( ! id) {
id = 'customizer-repeater-social-repeater-' + customizer_repeater_uniqid();
jQuery( this ).find( '.customizer-repeater-social-repeater-id' ).val( id );
}
if (icon !== '' && link !== '') {
icons_repeater_values.push(
{
'icon': icon,
'link': link,
'id': id
}
);
}
}
);
th.find( '.social-repeater-socials-repeater-colector' ).val( JSON.stringify( icons_repeater_values ) );
customizer_repeater_refresh_general_control_values();
}
function customizer_repeater_refresh_general_control_values() {
'use strict';
jQuery( '.customizer-repeater-general-control-repeater' ).each(
function () {
var values = [];
var th = jQuery( this );
th.find( '.customizer-repeater-general-control-repeater-container' ).each(
function () {
var icon_value = jQuery( this ).find( '.icp' ).val();
var text = jQuery( this ).find( '.customizer-repeater-text-control' ).val();
var link = jQuery( this ).find( '.customizer-repeater-link-control' ).val();
var text2 = jQuery( this ).find( '.customizer-repeater-text2-control' ).val();
var link2 = jQuery( this ).find( '.customizer-repeater-link2-control' ).val();
var color = jQuery( this ).find( 'input.customizer-repeater-color-control' ).val();
var color2 = jQuery( this ).find( 'input.customizer-repeater-color2-control' ).val();
var image_url = jQuery( this ).find( '.custom-media-url' ).val();
var choice = jQuery( this ).find( '.customizer-repeater-image-choice' ).val();
var title = jQuery( this ).find( '.customizer-repeater-title-control' ).val();
var subtitle = jQuery( this ).find( '.customizer-repeater-subtitle-control' ).val();
var id = jQuery( this ).find( '.social-repeater-box-id' ).val();
if ( ! id) {
id = 'social-repeater-' + customizer_repeater_uniqid();
jQuery( this ).find( '.social-repeater-box-id' ).val( id );
}
var social_repeater = jQuery( this ).find( '.social-repeater-socials-repeater-colector' ).val();
var shortcode = jQuery( this ).find( '.customizer-repeater-shortcode-control' ).val();
if (text !== '' || image_url !== '' || title !== '' || subtitle !== '' || icon_value !== '' || link !== '' || choice !== '' || social_repeater !== '' || shortcode !== '' || color !== '') {
values.push(
{
'icon_value': (choice === 'customizer_repeater_none' ? '' : icon_value),
'color': color,
'color2': color2,
'text': escapeHtml( text ),
'link': link,
'text2': escapeHtml( text2 ),
'link2': link2,
'image_url': (choice === 'customizer_repeater_none' ? '' : image_url),
'choice': choice,
'title': escapeHtml( title ),
'subtitle': escapeHtml( subtitle ),
'social_repeater': escapeHtml( social_repeater ),
'id': id,
'shortcode': escapeHtml( shortcode )
}
);
}
}
);
th.find( '.customizer-repeater-colector' ).val( JSON.stringify( values ) );
th.find( '.customizer-repeater-colector' ).trigger( 'change' );
}
);
}
jQuery( document ).ready(
function () {
'use strict';
var theme_conrols = jQuery( '#customize-theme-controls' );
setTimeout(
function() {
jQuery(document).find( 'input.customizer-repeater-color-control' ).wpColorPicker( color_options );
jQuery(document).find( 'input.customizer-repeater-color2-control' ).wpColorPicker( color_options );
},
500
);
theme_conrols.on(
'click', '.customizer-repeater-customize-control-title', function () {
jQuery( this ).next().slideToggle(
'medium', function () {
if (jQuery( this ).is( ':visible' )) {
jQuery( this ).prev().addClass( 'repeater-expanded' );
jQuery( this ).css( 'display', 'block' );
} else {
jQuery( this ).prev().removeClass( 'repeater-expanded' );
}
}
);
}
);
theme_conrols.on(
'change', '.icp',function(){
customizer_repeater_refresh_general_control_values();
return false;
}
);
theme_conrols.on(
'change', '.customizer-repeater-image-choice', function () {
if (jQuery( this ).val() === 'customizer_repeater_image') {
jQuery( this ).parent().parent().find( '.social-repeater-general-control-icon' ).hide();
jQuery( this ).parent().parent().find( '.customizer-repeater-image-control' ).show();
jQuery( this ).parent().parent().find( '.customizer-repeater-color-control' ).prev().prev().hide();
jQuery( this ).parent().parent().find( '.customizer-repeater-color-control' ).hide();
}
if (jQuery( this ).val() === 'customizer_repeater_icon') {
jQuery( this ).parent().parent().find( '.social-repeater-general-control-icon' ).show();
jQuery( this ).parent().parent().find( '.customizer-repeater-image-control' ).hide();
jQuery( this ).parent().parent().find( '.customizer-repeater-color-control' ).prev().prev().show();
jQuery( this ).parent().parent().find( '.customizer-repeater-color-control' ).show();
}
if (jQuery( this ).val() === 'customizer_repeater_none') {
jQuery( this ).parent().parent().find( '.social-repeater-general-control-icon' ).hide();
jQuery( this ).parent().parent().find( '.customizer-repeater-image-control' ).hide();
jQuery( this ).parent().parent().find( '.customizer-repeater-color-control' ).prev().prev().hide();
jQuery( this ).parent().parent().find( '.customizer-repeater-color-control' ).hide();
}
customizer_repeater_refresh_general_control_values();
return false;
}
);
media_upload( '.customizer-repeater-custom-media-button' );
jQuery( '.custom-media-url' ).on(
'change', function () {
customizer_repeater_refresh_general_control_values();
return false;
}
);
var color_options = {
change: function( event, ui ){
jQuery( event.target ).val( ui.color.toString() );
customizer_repeater_refresh_general_control_values();
}
};
/**
* This adds a new box to repeater
*/
theme_conrols.on(
'click', '.customizer-repeater-new-field', function () {
var th = jQuery( this ).parent();
var id = 'customizer-repeater-' + customizer_repeater_uniqid();
if (typeof th !== 'undefined') {
/* Clone the first box*/
var field = th.find( '.customizer-repeater-general-control-repeater-container:first' ).clone( true, true );
if (typeof field !== 'undefined') {
/*Set the default value for choice between image and icon to icon*/
field.find( '.customizer-repeater-image-choice' ).val( 'customizer_repeater_icon' );
/*Show icon selector*/
field.find( '.social-repeater-general-control-icon' ).show();
/*Hide image selector*/
if (field.find( '.social-repeater-general-control-icon' ).length > 0) {
field.find( '.customizer-repeater-image-control' ).hide();
}
/*Show delete box button because it's not the first box*/
field.find( '.social-repeater-general-control-remove-field' ).show();
/* Empty control for icon */
field.find( '.input-group-addon' ).find( '.fa' ).attr( 'class', 'fa' );
/*Remove all repeater fields except first one*/
field.find( '.customizer-repeater-social-repeater' ).find( '.customizer-repeater-social-repeater-container' ).not( ':first' ).remove();
field.find( '.customizer-repeater-social-repeater-link' ).val( '' );
field.find( '.social-repeater-socials-repeater-colector' ).val( '' );
/*Remove value from icon field*/
field.find( '.icp' ).val( '' );
/*Remove value from text field*/
field.find( '.customizer-repeater-text-control' ).val( '' );
/*Remove value from link field*/
field.find( '.customizer-repeater-link-control' ).val( '' );
/*Remove value from text field*/
field.find( '.customizer-repeater-text2-control' ).val( '' );
/*Remove value from link field*/
field.find( '.customizer-repeater-link2-control' ).val( '' );
/*Set box id*/
field.find( '.social-repeater-box-id' ).val( id );
/*Remove value from media field*/
field.find( '.custom-media-url' ).val( '' );
/*Remove value from title field*/
field.find( '.customizer-repeater-title-control' ).val( '' );
/*Remove value from color field*/
field.find( 'div.customizer-repeater-color-control .wp-picker-container' ).replaceWith( '<input type="text" class="customizer-repeater-color-control ' + id + '">' );
field.find( 'input.customizer-repeater-color-control' ).wpColorPicker( color_options );
field.find( 'div.customizer-repeater-color2-control .wp-picker-container' ).replaceWith( '<input type="text" class="customizer-repeater-color2-control ' + id + '">' );
field.find( 'input.customizer-repeater-color2-control' ).wpColorPicker( color_options );
// field.find('.customize-control-notifications-container').remove();
/*Remove value from subtitle field*/
field.find( '.customizer-repeater-subtitle-control' ).val( '' );
/*Remove value from shortcode field*/
field.find( '.customizer-repeater-shortcode-control' ).val( '' );
/*Append new box*/
th.find( '.customizer-repeater-general-control-repeater-container:first' ).parent().append( field );
/*Refresh values*/
customizer_repeater_refresh_general_control_values();
}
}
return false;
}
);
theme_conrols.on(
'click', '.social-repeater-general-control-remove-field', function () {
if (typeof jQuery( this ).parent() !== 'undefined') {
jQuery( this ).parent().hide(
500, function(){
jQuery( this ).parent().remove();
customizer_repeater_refresh_general_control_values();
}
);
}
return false;
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-title-control', function () {
customizer_repeater_refresh_general_control_values();
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-subtitle-control', function () {
customizer_repeater_refresh_general_control_values();
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-shortcode-control', function () {
customizer_repeater_refresh_general_control_values();
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-text-control', function () {
customizer_repeater_refresh_general_control_values();
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-link-control', function () {
customizer_repeater_refresh_general_control_values();
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-text2-control', function () {
customizer_repeater_refresh_general_control_values();
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-link2-control', function () {
customizer_repeater_refresh_general_control_values();
}
);
/*Drag and drop to change icons order*/
jQuery( '.customizer-repeater-general-control-droppable' ).sortable(
{
axis: 'y',
update: function () {
customizer_repeater_refresh_general_control_values();
}
}
);
/*----------------- Socials Repeater ---------------------*/
theme_conrols.on(
'click', '.social-repeater-add-social-item', function (event) {
event.preventDefault();
var th = jQuery( this ).parent();
var id = 'customizer-repeater-social-repeater-' + customizer_repeater_uniqid();
if (typeof th !== 'undefined') {
var field = th.find( '.customizer-repeater-social-repeater-container:first' ).clone( true, true );
if (typeof field !== 'undefined') {
field.find( '.icp' ).val( '' );
field.find( '.input-group-addon' ).find( '.fa' ).attr( 'class','fa' );
field.find( '.social-repeater-remove-social-item' ).show();
field.find( '.customizer-repeater-social-repeater-link' ).val( '' );
field.find( '.customizer-repeater-social-repeater-id' ).val( id );
th.find( '.customizer-repeater-social-repeater-container:first' ).parent().append( field );
}
}
return false;
}
);
theme_conrols.on(
'click', '.social-repeater-remove-social-item', function (event) {
event.preventDefault();
var th = jQuery( this ).parent();
var repeater = jQuery( this ).parent().parent();
th.remove();
customizer_repeater_refresh_social_icons( repeater );
return false;
}
);
theme_conrols.on(
'keyup', '.customizer-repeater-social-repeater-link', function (event) {
event.preventDefault();
var repeater = jQuery( this ).parent().parent();
customizer_repeater_refresh_social_icons( repeater );
return false;
}
);
theme_conrols.on(
'change', '.customizer-repeater-social-repeater-container .icp', function (event) {
event.preventDefault();
var repeater = jQuery( this ).parent().parent().parent();
customizer_repeater_refresh_social_icons( repeater );
return false;
}
);
}
);
var entityMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
'\'': ''',
'/': '/'
};
function escapeHtml(string) {
'use strict';
// noinspection JSUnresolvedFunction
string = String( string ).replace( new RegExp( '\r?\n', 'g' ), '<br />' );
string = String( string ).replace( /\\/g, '\' );
return String( string ).replace(
/[&<>"'\/]/g, function (s) {
return entityMap[s];
}
);
}
controls/custom-controls/repeater/style.css 0000666 00000011020 15220735036 0015244 0 ustar 00 .customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden:after {
content: "";
display: table;
clear: both;
}
.customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden {
display: none;
}
.customizer-repeater-customize-control-title {
margin: 0;
padding: 15px;
font-size: 1em;
line-height: 1;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
display: block;
font-weight: 600;
color: #23282d;
border: 1px solid #e5e5e5;
cursor: move;
}
.customizer-repeater-customize-control-title:hover {
border: 1px solid #999;
}
.customizer-repeater-customize-control-title:after {
content: "\f140";
font-family: dashicons;
font-size: 20px;
height: 13px;
bottom: 3px;
position: relative;
float: right;
}
.customizer-repeater-customize-control-title.repeater-expanded:after {
content: "\f142";
}
.customizer-repeater-box-content-hidden {
border: 1px solid #e5e5e5;
border-top: none;
padding: 1px 10px 10px;
}
.customizer-repeater-box-content-hidden > div {
margin: 1em 0;
}
.customizer-repeater-box-content-hidden .customize-control-title {
font-size: 13px;
line-height: 1.5;
font-weight: normal;
margin-bottom: 0;
margin-top: 1em;
}
.customizer-repeater-box-content-hidden .customize-control-title:after {
content: ":";
}
.customizer-repeater-box-content-hidden span.description {
font-size: 12px;
font-style: normal;
}
.customizer-repeater-general-control-repeater-container, .customizer-repeater-general-control-repeater_container {
border: 1px solid #e5e5e5;
border-top: none;
margin-bottom: 12px;
width: 100%;
float: left;
background: #fff;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}
.customizer-repeater-box-content-hidden .wp-picker-container, .customizer-repeater-box-content-hidden .wp-picker-container .wp-color-result, .icp-container {
margin: 0;
}
.customizer-repeater-box-content-hidden input:not(.icp, .wp-color-picker),
.customizer-repeater-box-content-hidden textarea,
.customizer-repeater-box-content-hidden .wp-picker-container {
margin-bottom: 1em !important;
}
.social-repeater-general-control-remove-field {
cursor: pointer;
color: #a00;
background: none;
border: none;
padding: 0;
margin-top: 10px;
}
.social-repeater-general-control-remove-field:hover {
color: red;
}
.customizer-repeater-box-content-hidden .wp-picker-holder {
position: relative;
left: -10px;
}
.customizer-repeater-box-content-hidden .wp-picker-input-wrap {
margin-left: 10px;
}
.customizer-repeater-box-content-hidden .wp-picker-container .iris-picker {
border-left: none;
border-right: none;
}
button.customizer-repeater-new-field {
float: right;
}
button.customizer-repeater-new-field:before {
content: "\f132";
display: inline-block;
position: relative;
left: -2px;
top: -1px;
font: 400 20px/1 dashicons;
vertical-align: middle;
-webkit-transition: all .2s;
transition: all .2s;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.customizer-repeater-box-content-hidden > div.customizer-repeater-social-repeater {
margin-top: 0;
}
.customizer-repeater-general-control-repeater-container .customizer-repeater-icon-control {
width: 100%;
margin: 0;
padding: 0;
}
#customizer-repeater-new-field {
width: 100%;
}
.customize-control-widget_form .widget-control-save {
display: block !important;
}
.customizer-repeater-box-content-hidden {
background-color: #fff;
}
.customizer-repeater-image-control .customizer-repeater-custom-media-button {
margin-top: 5px;
}
.customizer-icons {
display: inline-block;
padding: 0 10px 0 0;
vertical-align: middle;
}
.social-repeater-remove-social-item {
display: inline-block;
vertical-align: top;
color: #a00;
border: none;
background: none;
cursor: pointer;
padding: 0;
}
.social-repeater-remove-social-item:hover {
color: red;
}
.customizer-repeater-social-repeater > .customizer-repeater-social-repeater-container:not(:first-child) {
margin-top: 25px;
}
.icp-container {
margin-bottom: 10px;
}
.button-secondary.social-repeater-add-social-item:before {
content: "\f132";
display: inline-block;
position: relative;
left: -2px;
top: -1px;
font: 400 20px/1 dashicons;
vertical-align: middle;
-webkit-transition: all .2s;
transition: all .2s;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.button-secondary.social-repeater-add-social-item {
vertical-align: text-top;
float: right;
}
.customizer-repeater-box-content-hidden textarea {
width: 100%;
}
controls/custom-controls/repeater/icon-picker/style.css 0000666 00000001560 15220735036 0017457 0 ustar 00 .iconpicker *,
.icp-container {
position: relative
}
.icp-container .input-group-addon {
position: absolute;
top: 1px;
left: 5px;
padding: 3px
}
input.icp {
padding-left: 30px
}
.iconpicker-popover{
display: none;
border: 1px solid;
padding-bottom: 10px;
}
.iconpicker-popover .popover-title{
padding: 10px;
background: #eeeeee;
}
.iconpicker-popover.iconpicker-visible{
display: block;
}
.iconpicker .iconpicker-items {
display: block;
margin-top: 10px;
max-height: 200px;
overflow-y: scroll;
}
.iconpicker .iconpicker-items i {
display: inline-block;
width: 32px;
height: 32px;
line-height: 32px;
margin: 3px;
text-align: center;
cursor: pointer;
border-radius: 3px;
font-size: 18px;
color: #444;
box-shadow: 0 0 0 1px #ddd;
transition: transform .2s ease
}
controls/custom-controls/common-functionalities/responsive-switchers.js 0000666 00000007074 15220735036 0023033 0 ustar 00 jQuery( document ).ready(
function ($) {
'use strict';
$.responsiveSwitchers = {
'init': function () {
this.manageSwitchers();
this.manageWPDevices();
},
'manageSwitchers': function () {
// Responsive switchers
jQuery( '.customize-control .responsive-switchers button' ).on(
'click', function( event ) {
// Set up variables
var $this = $( this ),
$devices = $( '.responsive-switchers' ),
$device = $( event.currentTarget ).data( 'device' ),
$control = $( '.customize-control.has-switchers' ),
$body = $( '.wp-full-overlay' ),
$footer_devices = $( '.wp-full-overlay-footer .devices' );
// Button class
$devices.find( 'button' ).removeClass( 'active' );
$devices.find( 'button.preview-' + $device ).addClass( 'active' );
// Control class
$control.find( '.control-wrap' ).removeClass( 'active' );
$control.find( '.control-wrap.' + $device ).addClass( 'active' );
$control.removeClass( 'control-device-desktop control-device-tablet control-device-mobile' ).addClass( 'control-device-' + $device );
// Wrapper class
$body.removeClass( 'preview-desktop preview-tablet preview-mobile' ).addClass( 'preview-' + $device );
// Panel footer buttons
$footer_devices.find( 'button' ).removeClass( 'active' ).attr( 'aria-pressed', false );
$footer_devices.find( 'button.preview-' + $device ).addClass( 'active' ).attr( 'aria-pressed', true );
// Open switchers
if ( $this.hasClass( 'preview-desktop' ) ) {
$control.toggleClass( 'responsive-switchers-open' );
}
}
);
},
'manageWPDevices': function () {
// If panel footer buttons clicked
jQuery( '#customize-footer-actions .devices button' ).on(
'click', function( event ) {
event.preventDefault();
var device = jQuery( this ).data( 'device' );
var queries = jQuery( '.responsive-switchers' );
queries.removeClass( 'responsive-switchers-open' );
if( device !== 'desktop'){
queries.addClass( 'responsive-switchers-open' );
}
queries.find( 'button' ).removeClass( 'active' );
queries.find( 'button.preview-' + device ).addClass( 'active' );
queries.find( 'button.preview-' + device ).trigger( 'click' );
var control = jQuery( '.range-slider.has-media-queries' );
control.find( '.desktop-range' ).removeClass( 'active' );
control.find( '.tablet-range' ).removeClass( 'active' );
control.find( '.mobile-range' ).removeClass( 'active' );
control.find( '.' + device + '-range' ).addClass( 'active' );
}
);
}
};
$.responsiveSwitchers.init();
}
);
controls/custom-controls/customizer-page-editor/style.css 0000666 00000002473 15220735036 0020053 0 ustar 00 /*EDIT CONTENT CONTROL*/
.edit-content-button{ display:flex !important; align-items: center; gap: 5px; }
/*--------------------------WIDGETS------------------------------------*/
#wp-editor-widget-container{position:fixed;left:0;right:0;bottom:0;z-index:9999999;background:#f1f1f1;border-top:1px solid #ddd;}
@media screen and (min-width: 800px){
#wp-editor-widget-container{
left:300px;
}
}
@media screen and (min-width: 1667px){
#wp-editor-widget-container{
left:18%;
}
}
#wp-editor-widget-container .close{position:absolute;top:17px;right:7px;width:30px;height:30px;z-index:1000; text-decoration: none; opacity:0.4; text-align: center;}
#wp-editor-widget-container .close{ opacity:0.7;}
#wp-editor-widget-container .icon:after{font: 400 22px/45px dashicons; content: "\f335";color: #888;text-decoration: none!important; line-height: 30px}
#wp-editor-widget-container .close:active{outline:0}
#wp-editor-widget-container .editor{margin:50px}
#available-widgets [class*=wp_editor_widget] .widget-title:before{content:"\f478"}
body.wp-customizer #wp-editor-widget-container{ bottom:-650px;}
body.wp-customizer #wp-editor-widget-container.editoron{ bottom:0;}
body.wp-customizer #wp-editor-widget-container .editor {margin: 10px; margin-top: 55px;}
body.widgets_access .widget-position table tr:nth-child(3) {display: none;}
controls/custom-controls/customizer-page-editor/js/hestia-text-editor.js 0000666 00000007645 15220735036 0022704 0 ustar 00 /**
* Text editor
*
* @package Hestia
*/
/* global tinyMCE */
/* global wp */
/* exported WPEditorWidget */
var WPEditorWidget = {
/**
* Current content id
*
* @var string Current content id.
*/
contentId: '',
/**
* Z index for Overlay
*
* @var int Z index for Overlay.
*/
wpFullOverlayOriginalZIndex: 0,
/**
* Visible or not
*
* @var bool Visible or not.
*/
isVisible: false,
init: function ( contentId ) {
this.contentId = contentId;
return this;
},
run: function ( editorWidget ) {
editorWidget.toggleEditor();
editorWidget.updateTinyMCE();
editorWidget.updateWPEditor();
},
/**
* Show/Hide editor
*/
toggleEditor: function(){
if ( this.isVisible === true ) {
this.hideEditor();
} else {
this.showEditor( this.contentId );
}
},
/**
* Show the editor
*
* @param contentId
*/
showEditor: function(contentId) {
this.isVisible = true;
var overlay = jQuery( '.wp-full-overlay' );
jQuery( 'body.wp-customizer #wp-editor-widget-container' ).fadeIn( 100 ).animate( {'bottom':'0'} );
this.wpFullOverlayOriginalZIndex = parseInt( overlay.css( 'zIndex' ) );
overlay.css( { zIndex: 49000 } );
this.setEditorContent( contentId );
},
/**
* Hide editor
*/
hideEditor: function() {
this.isVisible = false;
jQuery( 'body.wp-customizer #wp-editor-widget-container' ).animate( {'bottom':'-650px'} ).fadeOut();
jQuery( '.wp-full-overlay' ).css( { zIndex: this.wpFullOverlayOriginalZIndex } );
},
/**
* Set editor content
*/
setEditorContent: function(contentId) {
var editor = tinyMCE.get( 'wpeditorwidget' );
var content = jQuery( '#' + contentId ).val();
if (typeof editor === 'object' && editor !== null) {
editor.setContent( content );
}
jQuery( '#wpeditorwidget' ).val( content );
},
updateTinyMCE: function () {
var editor = tinyMCE.get( 'wpeditorwidget' );
var th = this;
if( typeof editor !== 'undefined' && editor) {
editor.on('NodeChange KeyUp', function () {
th.doUpdate(editor);
});
}
},
updateWPEditor: function () {
var editorWidget = document.getElementById( 'wpeditorwidget' );
var th = this;
jQuery(editorWidget).on('keyup', function () {
var newContent = this.value;
var contentField = jQuery( '#' + th.contentId );
contentField.val(newContent);
contentField.trigger('change');
});
},
doUpdate: function ( editor ) {
var content = editor.getContent();
var contentField = jQuery( '#' + this.contentId );
contentField.val( content );
contentField.trigger('change');
}
};
jQuery( window ).on( 'load', function () {
var editor;
/**
* This handles the click form customizer control.
*/
jQuery(document).on('click','.edit-content-button',function (event) {
event.preventDefault();
var editorId = jQuery(this).data('editor-id');
if( typeof editorId !== 'undefined' ) {
editor = WPEditorWidget.init(editorId);
WPEditorWidget.run(editor);
}
});
var customize = wp.customize;
if( typeof customize !== 'undefined' && customize.hasOwnProperty('previewer') ) {
/**
* Toggle editor when the user clicks on customizer shortcut.
*/
customize.previewer.bind(
'trigger-open-editor', function (data) {
if (typeof data !== 'undefined') {
editor = WPEditorWidget.init(data);
WPEditorWidget.run(editor);
}
}
);
/**
* Close editor when the user clicks on customizer shortcut.
*/
customize.previewer.bind( 'trigger-close-editor', function () {
WPEditorWidget.hideEditor();
} );
}
/**
* Hide the editor if the user clicks on back button to exit about panel.
*/
jQuery( '.customize-section-back' ).on(
'click',function(){
if( typeof editor !== 'undefined' ){
editor.hideEditor();
}
}
);
});
controls/custom-controls/customizer-page-editor/class-hestia-page-editor.php 0000666 00000003052 15220735036 0023462 0 ustar 00 <?php
/**
* Page editor control
*
* @package Hestia
* @since Hestia 1.1.3
*/
/**
* Class to create a custom tags control
*/
class Hestia_Page_Editor extends WP_Customize_Control {
/**
* Hestia_Page_Editor constructor.
*
* @param WP_Customize_Manager $manager Manager.
* @param string $id Id.
* @param array $args Constructor args.
*/
public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args );
}
/**
* Enqueue scripts
*
* @since 1.1.0
* @access public
* @updated Changed wp_enqueue_scripts order and dependencies.
*/
public function enqueue() {
wp_enqueue_script(
'hestia_text_editor',
get_template_directory_uri() . '/inc/customizer/controls/custom-controls/customizer-page-editor/js/hestia-text-editor.js',
array(
'jquery',
),
HESTIA_VERSION,
false
);
}
/**
* Render the content on the theme customizer page
*/
public function render_content() {
?>
<label>
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif; ?>
<input type="hidden" <?php $this->link(); ?> value="<?php echo esc_textarea( $this->value() ); ?>" id="<?php echo esc_attr( $this->id ); ?>" class="editorfield">
<button data-editor-id="<?php echo esc_attr( $this->id ); ?>" class="button edit-content-button">
<span class="dashicons dashicons-edit"></span>
<span><?php _e( '(Edit)', 'hestia' ); ?></span>
</button>
</label>
<?php
}
}
controls/custom-controls/customizer-page-editor/class-hestia-customizer-page-editor-helper.php 0000666 00000021236 15220735036 0027145 0 ustar 00 <?php
/**
* Page editor helper class.
*
* @package Hestia
* @since Hestia 1.1.3
*/
/**
* Class Hestia_Customizer_Page_Editor_Helper
*/
class Hestia_Customizer_Page_Editor_Helper extends Hestia_Abstract_Main {
/**
* Initialize Customizer Page Editor Helper.
*/
public function init() {
add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_editor' ), 1 );
add_filter( 'tiny_mce_before_init', array( $this, 'override_tinymce_options' ) );
add_filter( 'wp_default_editor', array( $this, 'change_editor_mode_to_html' ) );
$this->filter_content();
}
/**
* Display editor for page editor control.
*
* @since 1.1.51
*/
public function customize_editor() {
?>
<div id="wp-editor-widget-container" style="display: none;">
<a class="close" href="javascript:WPEditorWidget.hideEditor();"><span class="icon"></span></a>
<div class="editor">
<?php
$settings = array(
'tinymce' => array(
'content_style' => $this->get_editor_style(),
'rows' => 55,
'setup' => "function (editor) {
editor.onInit.add(function(){
var iframe = document.getElementById('wpeditorwidget_ifr');
iframe.style.height = '260px';
});
}",
),
);
wp_editor( '', 'wpeditorwidget', $settings );
?>
</div>
</div>
<?php
}
/**
* Add custom inline style for editor.
*
* @return string
*/
public function get_editor_style() {
$accent_color = get_theme_mod( 'accent_color', apply_filters( 'hestia_accent_color_default', '#e91e63' ) );
$headings_font = get_theme_mod( 'hestia_headings_font' );
$body_font = get_theme_mod( 'hestia_body_font' );
$custom_css = '';
// Load google font.
if ( ! empty( $body_font ) ) {
$body_font_url = hestia_get_local_webfont_url( 'https://fonts.googleapis.com/css?family=' . esc_attr( $body_font ) );
$custom_css .= '@import url(' . $body_font_url . ');';
}
if ( ! empty( $headings_font ) ) {
$headings_font_url = hestia_get_local_webfont_url( 'https://fonts.googleapis.com/css?family=' . esc_attr( $headings_font ) );
$custom_css .= '@import url(' . $headings_font_url . ');';
}
// Check if accent color is exists.
if ( ! empty( $accent_color ) ) {
$custom_css .= 'body.wpeditorwidget.mce-content-body a { color: ' . esc_attr( $accent_color ) . '; }';
}
// Check if font family for body exists.
if ( ! empty( $body_font ) ) {
$custom_css .= 'body.wpeditorwidget, body.wpeditorwidget p { font-family: ' . esc_attr( $body_font ) . ' !important; }';
}
// Check if font family for headings exists.
if ( ! empty( $headings_font ) ) {
$custom_css .= 'body.wpeditorwidget h1, body.wpeditorwidget h2, body.wpeditorwidget h3, body.wpeditorwidget h4, body.wpeditorwidget h5, body.wpeditorwidget h6 { font-family: ' . esc_attr( $headings_font ) . ' !important; }';
}
return $custom_css;
}
/**
* When the frontpage is edited, we set a flag with 'sync_customizer' value to know that we should update
* hestia_feature_thumbnail control.
*
* @param int $post_id ID of the post that we need to update.
*
* @deprecated 2.0.9
* @since 1.1.60
*/
public function trigger_sync_from_page( $post_id ) {
$frontpage_id = get_option( 'page_on_front' );
if ( empty( $frontpage_id ) ) {
return;
}
if ( intval( $post_id ) === intval( $frontpage_id ) ) {
update_option( 'hestia_sync_needed', 'sync_customizer' );
};
}
/**
* When customizer is saved, we set the flag to 'sync_page' value to know that we should update the frontpage
* content and feature image.
*
* @deprecated 2.0.9
* @since 1.1.60
*/
function trigger_sync_from_customizer() {
$frontpage_id = get_option( 'page_on_front' );
if ( ! empty( $frontpage_id ) ) {
update_option( 'hestia_sync_needed', 'sync_page' );
}
}
/**
* Based on 'hestia_sync_needed' option value, update either page or customizer controls and then we update
* the flag as false to know that we don't need to update anything.
*
* @deprecated 2.0.9
* @since 1.1.60
*/
function sync_controls() {
$should_sync = get_option( 'hestia_sync_needed' );
if ( $should_sync === false ) {
return;
}
$frontpage_id = get_option( 'page_on_front' );
if ( empty( $frontpage_id ) ) {
return;
}
switch ( $should_sync ) {
// Synchronize customizer controls with page content
case 'sync_customizer':
$content = get_post_field( 'post_content', $frontpage_id );
set_theme_mod( 'hestia_page_editor', $content );
$featured_image = '';
if ( has_post_thumbnail( $frontpage_id ) ) {
$featured_image = get_the_post_thumbnail_url( $frontpage_id );
} else {
$thumbnail = get_theme_mod( 'hestia_feature_thumbnail', get_template_directory_uri() . '/assets/img/slider1.jpg' );
if ( $thumbnail === get_template_directory_uri() . '/assets/img/slider1.jpg' ) {
$featured_image = get_template_directory_uri() . '/assets/img/slider1.jpg';
}
}
set_theme_mod( 'hestia_feature_thumbnail', $featured_image );
break;
// Synchronize frontpage content with customizer values.
case 'sync_page':
$content = get_theme_mod( 'hestia_page_editor' );
if ( ! empty( $frontpage_id ) ) {
if ( ! wp_is_post_revision( $frontpage_id ) ) {
// update the post, which calls save_post again
$post = array(
'ID' => $frontpage_id,
'post_content' => wp_kses_post( $content ),
);
wp_update_post( $post );
}
}
$thumbnail = get_theme_mod( 'hestia_feature_thumbnail', get_template_directory_uri() . '/assets/img/slider1.jpg' );
$thumbnail_id = attachment_url_to_postid( $thumbnail );
update_post_meta( $frontpage_id, '_thumbnail_id', $thumbnail_id );
break;
}
update_option( 'hestia_sync_needed', false );
}
/**
* This function updates controls from customizer (about content and featured background) when you change your
* frontpage.
*
* @deprecated 2.0.9
*/
public function update_frontpage_change() {
$pid = $_POST['pid'];
$return_value = array();
$content = get_post_field( 'post_content', $pid );
set_theme_mod( 'hestia_page_editor', $content );
$featured_image = '';
if ( has_post_thumbnail( $pid ) ) {
$featured_image = get_the_post_thumbnail_url( $pid );
} else {
$thumbnail = get_theme_mod( 'hestia_feature_thumbnail', get_template_directory_uri() . '/assets/img/slider1.jpg' );
if ( $thumbnail === get_template_directory_uri() . '/assets/img/slider1.jpg' ) {
$featured_image = get_template_directory_uri() . '/assets/img/slider1.jpg';
}
}
set_theme_mod( 'hestia_feature_thumbnail', $featured_image );
$return_value['post_content'] = $content;
$return_value['post_thumbnail'] = $featured_image;
echo json_encode( $return_value );
die();
}
/**
* Hestia allow all HTML tags in TinyMce editor.
*
* @param array $init_array TinyMce settings.
*
* @return array
*/
public function override_tinymce_options( $init_array ) {
$opts = '*[*]';
$init_array['valid_elements'] = $opts;
$init_array['extended_valid_elements'] = $opts;
return $init_array;
}
/**
* Change the default mode of the editor to html when using the tinyMce editor in customizer.
*
* @param string $editor_mode The current mode of the default editor.
*
* @return string The new mode (visual or html) of the editor, if we are in the customizer page.
*/
public function change_editor_mode_to_html( $editor_mode ) {
if ( is_customize_preview() && function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen();
if ( ! isset( $screen->id ) ) {
return $editor_mode;
}
if ( $screen->id === 'customize' ) {
return 'tmce';
}
}
return $editor_mode;
}
/**
* This filter is used to filter the content of the post after it is retrieved from the database and before it is
* printed to the screen.
* Initial we've applied 'the_content' filter but that was wrong because it relies on the global $post being set.
* Otherwise, it can break plugins. See https://github.com/Codeinwp/hestia-pro/issues/309 for the issue.
* For more explanations check this link https://themehybrid.com/weblog/how-to-apply-content-filters
*/
private function filter_content() {
global $wp_embed;
add_filter( 'hestia_text', 'wptexturize' );
add_filter( 'hestia_text', 'convert_smilies' );
add_filter( 'hestia_text', 'convert_chars' );
add_filter( 'hestia_text', 'wpautop' );
add_filter( 'hestia_text', 'shortcode_unautop' );
add_filter( 'hestia_text', 'do_shortcode' );
add_filter( 'hestia_text', array( $wp_embed, 'run_shortcode' ) );
add_filter( 'hestia_text', array( $wp_embed, 'autoembed' ) );
}
}
controls/custom-controls/section-hiding/style.css 0000666 00000001124 15220735036 0016345 0 ustar 00 .control-section-hiding-section .hestia-toggle-section,
.control-section-sidebar .hestia-toggle-section{
text-decoration: none;
margin-right: 5px;
vertical-align: middle;
}
.control-section-hiding-section .hestia-toggle-section .dashicons,
.control-section-sidebar .hestia-toggle-section .dashicons{
font-size:16px;
vertical-align: middle;
}
.hestia-section-visible .hestia-toggle-section{
color: #929292;
}
#customize-theme-controls .accordion-section-title.hestia-section-hidden,
.hestia-section-hidden .hestia-toggle-section{
color: #dcdcdc;
}
.hestia-toggle-section{
float:left
}
controls/custom-controls/subcontrols-allowing/style.css 0000666 00000001730 15220735036 0017633 0 ustar 00 #customize-control-header_video, #customize-control-external_header_video{
display: none;
}
/**
* Tab styling
*/
.customizer-tab:not(.customizer-subtab){
display: table;
width: calc(100% + 28px);
margin: -15px 0 0 -12px;
}
.customizer-tab:not(.customizer-subtab) label{
border-right: 1px solid #ddd;
display: inherit;
width: 50%;
vertical-align: top;
max-width: 100%;
text-transform: capitalize;
background: #fff;
padding: 10px 0;
text-decoration: none;
font-weight: 600;
transition: all .3s ease;
color: #333;
}
.customizer-tab:not(.customizer-subtab) label i{
color: #333;
margin-right: 4px;
}
.customizer-tab:not(.customizer-subtab) label.ui-state-active{
box-shadow: inset 0 -3px 0 0 #0085ba;
color: #0085ba;
background-color: #fff;
}
.customizer-tab:not(.customizer-subtab) label:last-child{
border:none;
}
.pro-feature{
position: relative;
}
.pro-feature img{
opacity: 0.5;
}
controls/custom-controls/subcontrols-allowing/script.js 0000666 00000012304 15220735036 0017622 0 ustar 00 ( function( $, api ) {
var control = api.Control.extend( {
ready: function() {
var control = this;
control.container.find('.buttonset').buttonset();
api.bind('ready',function () {
api(control.id, function (value) {
var func = function (newval) {
var i, j, k, controlName, selector,
currentControl, currentControl2,
selector2, subControlsToShow, controlName2;
var controls = control.params.subcontrols;
var sectionName = control.section();
var sectionContainer = wp.customize.section(sectionName).container;
var currentValue = newval;
var controlsToShow = controls[currentValue];
if( typeof control.params.parent !== 'undefined' ){
var parentName = control.params.parent;
var parentControl = wp.customize.control(parentName);
if( typeof parentControl !== 'undefined' ){
var parentValue = parentControl.setting._value;
var parentOptions = parentControl.params.subcontrols[parentValue];
if( typeof parentOptions !== 'undefined' && parentOptions.length === 0 ){
controlsToShow = [];
}
}
}
var allControlsArray = Object.values(controls);
allControlsArray = [].concat.apply([], allControlsArray);
for ( i in allControlsArray) {
controlName = allControlsArray[i];
if (controlName === 'widgets') {
jQuery(sectionContainer).children('li[class*="widget"]').css('display', 'none');
} else {
currentControl = wp.customize.control(controlName);
if( typeof currentControl.params.subcontrols !== 'undefined' ){
for ( j in currentControl.params.subcontrols ){
for( k in currentControl.params.subcontrols[j] ){
selector = api.control(currentControl.params.subcontrols[j][k]).selector;
jQuery(selector).hide();
}
}
}
if (typeof currentControl !== 'undefined') {
selector = currentControl.selector;
jQuery(selector).hide();
}
}
}
for( i in controlsToShow ){
controlName = controlsToShow[i];
if( controlName === 'widgets' ){
jQuery( sectionContainer ).children( 'li[class*="widget"]' ).css( 'display', 'list-item' );
} else {
currentControl = wp.customize.control(controlName);
if( typeof currentControl !== 'undefined' ){
selector = currentControl.selector;
jQuery(selector).show();
currentValue = currentControl.setting._value;
if( typeof wp.customize.control(controlName).params.subcontrols !== 'undefined' ){
subControlsToShow = wp.customize.control(controlName).params.subcontrols[currentValue];
for( j in subControlsToShow ){
controlName2 = subControlsToShow[j];
currentControl2 = wp.customize.control(controlName2);
if( typeof currentControl2 !== 'undefined' ){
selector2 = currentControl2.selector;
jQuery(selector2).show();
}
}
}
}
}
}
};
func(value.get());
value.bind(func);
}
);
});
}
} );
api.controlConstructor['radio-image'] = control;
api.controlConstructor['select-hiding'] = control;
} )( jQuery, wp.customize ); controls/custom-controls/range-value/style.css 0000666 00000007362 15220735036 0015661 0 ustar 00 .range-slider {
width: 100%;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.range-slider .control-wrap {
display: none;
align-items: center;
gap: 5px;
}
.range-slider .control-wrap.active {
display: flex;
}
.range-slider__range {
background-color: rgba(0, 0, 0, .1);
height: 5px;
flex-grow: 1;
padding: 0;
cursor: pointer;
outline: none;
-webkit-transition: background .5s;
-moz-transition: background .5s;
transition: background .5s;
-webkit-appearance: none;
}
.range-slider__range::-webkit-slider-thumb {
-webkit-appearance: none;
width: 15px;
height: 15px;
border: none;
border-radius: 15px;
background-color: #2e86b9;
}
.range-slider__range::-webkit-slider-thumb:hover {
background: #0085ba;
}
.range-slider__range:active::-webkit-slider-thumb {
background: #0085ba;
}
.range-slider__range::-moz-range-thumb {
width: 20px;
height: 20px;
border: 0;
border-radius: 50%;
background: #0085ba;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider__range::-moz-range-thumb:hover {
background: #0085ba;
}
.range-slider__range:active::-moz-range-thumb {
background: #0085ba;
}
.customize-control input[type=number].range-slider-value,
.customize-control input[type=text].range-slider-value {
height: 28px;
width: 30%;
border: 1px solid #a4afb7;
text-align: center;
margin-left: 2%;
border-radius: 3px;
padding: 3px;
font-size: 12px;
font-weight: 600;
color: #555;
-moz-appearance: textfield;
}
.customize-control input[type=number].range-slider-value::-webkit-outer-spin-button,
.customize-control input[type=number].range-slider-value::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.customize-control input[type=number].range-slider-value {
-moz-appearance: textfield;
}
.range-reset-slider .dashicons {
line-height: 1;
}
.customize-control span.range-reset-slider {
flex-grow: 1;
width: 30%;
color: rgba(0, 0, 0, .2);
cursor: pointer;
text-align: center;
transition: all .3s ease;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
-ms-transition: all .3s ease;
}
.customize-control span.range-reset-slider:hover {
color: #fe5252;
}
::-moz-range-track {
background: #d7dcdf;
border: 0;
}
input::-moz-focus-inner, input::-moz-focus-outer {
border: 0;
}
.customize-control-range-value .customize-control-title {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
border-top: 1px solid #e5e5e5;
padding-top: 10px;
}
.responsive-switchers {
gap: 5px;
}
.responsive-switchers:not(.responsive-switchers-open) .preview-tablet,
.responsive-switchers:not(.responsive-switchers-open) .preview-mobile {
display: none;
}
.customize-control .responsive-switchers {
display: flex;
}
.customize-control .responsive-switchers li {
margin: 0;
}
.customize-control .responsive-switchers li button {
display: flex;
align-items: center;
justify-content: center;
height: 20px;
width: 20px;
background-color: #a4afb7;
cursor: pointer;
color: #fff;
font-size: 10px;
text-align: center;
border-radius: 50%;
padding: 0;
border: 0;
outline: none;
transition: background-color .2s;
}
.customize-control .responsive-switchers li button:hover {
background-color: #c2cbd2;
}
.customize-control .responsive-switchers li button.active {
background-color: #13aff0;
}
.customize-control .responsive-switchers li button i {
width: auto;
height: auto;
font-size: inherit;
line-height: 18px;
}
controls/custom-controls/sortable-elements/class-hestia-sortable-elements.php 0000666 00000012771 15220735036 0023742 0 ustar 00 <?php
/**
* Sortable Elements Control
*
* A WordPress Customizer control for sorting and toggling visibility of elements.
*
* @package Hestia
* @since 1.0.0
*/
if ( ! class_exists( 'WP_Customize_Control' ) ) {
return;
}
/**
* Sortable Elements Customizer Control
*/
class Hestia_Sortable_Elements extends WP_Customize_Control {
/**
* Control type.
*
* @var string
*/
public $type = 'sortable-elements';
/**
* Additional CSS class for the control.
*
* @var string
*/
public $custom_class = '';
/**
* Toggle label for visibility toggle.
*
* @var string
*/
public $toggle_label = '';
/**
* Elements to display in the control.
*
* @var array
*/
public $elements = array();
/**
* Constructor.
*
* @param WP_Customize_Manager $manager Customize manager instance.
* @param string $id Control ID.
* @param array $args Optional. Arguments to override class property defaults.
*/
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
parent::__construct( $manager, $id, $args );
if ( array_key_exists( 'custom_class', $args ) ) {
$this->custom_class = esc_attr( $args['custom_class'] );
}
if ( array_key_exists( 'toggle_label', $args ) ) {
$this->toggle_label = $args['toggle_label'];
}
}
/**
* Enqueue control related scripts and styles.
*/
public function enqueue() {
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script(
'hestia-customizer-sortable-elements',
get_template_directory_uri() . '/inc/customizer/controls/custom-controls/sortable-elements/sortable-elements.js',
array( 'jquery', 'jquery-ui-sortable', 'customize-base' ),
HESTIA_VERSION,
true
);
wp_enqueue_style(
'hestia-customizer-sortable-elements',
get_template_directory_uri() . '/inc/customizer/controls/custom-controls/sortable-elements/sortable-elements.css',
array(),
HESTIA_VERSION
);
}
/**
* Render the control's content.
*/
protected function render_content() {
if ( empty( $this->elements ) ) {
return;
}
$value = $this->value();
if ( is_string( $value ) ) {
$decoded = json_decode( $value, true );
if ( json_last_error() === JSON_ERROR_NONE && is_array( $decoded ) ) {
$value = $decoded;
}
}
if ( ! is_array( $value ) || ! isset( $value['order'] ) || ! isset( $value['visibility'] ) ) {
$value = array(
'order' => array_keys( $this->elements ),
'visibility' => array_fill_keys( array_keys( $this->elements ), true ),
);
}
$ordered_elements = array();
$processed_ids = array();
// Add elements in saved order.
if ( ! empty( $value['order'] ) && is_array( $value['order'] ) ) {
foreach ( $value['order'] as $element_id ) {
if ( isset( $this->elements[ $element_id ] ) ) {
$ordered_elements[] = array(
'id' => $element_id,
'label' => $this->elements[ $element_id ],
'visible' => isset( $value['visibility'][ $element_id ] ) ? $value['visibility'][ $element_id ] : true,
);
$processed_ids[] = $element_id;
}
}
}
foreach ( $this->elements as $element_id => $label ) {
if ( ! in_array( $element_id, $processed_ids, true ) ) {
$ordered_elements[] = array(
'id' => $element_id,
'label' => $label,
'visible' => isset( $value['visibility'][ $element_id ] ) ? $value['visibility'][ $element_id ] : true,
);
}
}
$custom_class = ! empty( $this->custom_class ) ? ' ' . esc_attr( $this->custom_class ) : '';
$json_value = wp_json_encode( $value );
?>
<label class="hestia-sortable-elements-control">
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif; ?>
<?php if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
<?php endif; ?>
<div class="hestia-sortable-wrapper<?php echo $custom_class; ?>">
<input type="hidden" value="<?php echo esc_attr( $json_value ); ?>" <?php $this->link(); ?> />
<ul class="hestia-sortable-list">
<?php foreach ( $ordered_elements as $element ) : ?>
<li class="hestia-sortable-item<?php echo ! $element['visible'] ? ' hestia-item-hidden' : ''; ?>"
data-element-id="<?php echo esc_attr( $element['id'] ); ?>">
<div class="hestia-item-inner">
<div class="hestia-item-handle">
<span class="dashicons dashicons-menu" aria-hidden="true"></span>
</div>
<div class="hestia-item-content">
<span class="hestia-item-label"><?php echo esc_html( $element['label'] ); ?></span>
</div>
<div class="hestia-item-visibility">
<a type="button"
class="hestia-visibility-toggle"
aria-label="<?php echo esc_attr( $this->toggle_label ); ?>"
data-visible="<?php echo $element['visible'] ? 'true' : 'false'; ?>"
tabindex="-1">
<?php if ( $element['visible'] ) : ?>
<span class="dashicons dashicons-visibility" aria-hidden="true"></span>
<?php else : ?>
<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
<?php endif; ?>
</a>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
</label>
<?php
}
/**
* An Underscore (JS) template for this control's content.
*
* This is intentionally empty as we're using PHP rendering.
*/
protected function content_template() {}
}
controls/custom-controls/sortable-elements/sortable-elements.js 0000666 00000024144 15220735036 0021206 0 ustar 00 /**
* Sortable Elements Control JavaScript - Improved Version
*
* @package Hestia
*/
/* global wp */
( function( $, api ) {
'use strict';
const CONSTANTS = {
SELECTORS: {
SORTABLE_LIST: '.hestia-sortable-list',
SORTABLE_ITEM: '.hestia-sortable-item',
VISIBILITY_TOGGLE: '.hestia-visibility-toggle',
HIDDEN_INPUT: 'input[type="hidden"]',
ITEM_HANDLE: '.hestia-item-handle',
DASHICONS: '.dashicons'
},
CLASSES: {
SORTING: 'hestia-item-sorting',
HIDDEN: 'hestia-item-hidden',
PLACEHOLDER: 'hestia-sortable-placeholder',
VISIBILITY_ICON: 'dashicons-visibility',
HIDDEN_ICON: 'dashicons-hidden'
},
DELAYS: {
PREVIEW_UPDATE: 300
},
SORTABLE_OPTIONS: {
OPACITY: 0.8,
REVERT: 150,
TOLERANCE: 'pointer'
}
};
/**
* Sortable Elements Control
*/
api.controlConstructor['sortable-elements'] = api.Control.extend({
/**
* Initialize the control.
*/
ready: function() {
const control = this;
control.cacheElements();
// Initialize/validate the setting value first.
control.initializeValue();
// Setup functionality.
control.setupSortable();
control.setupLivePreview();
control.initVisibilityToggler();
// Bind cleanup on control destruction.
control.bindCleanupEvents();
},
/**
* Cache DOM elements for better performance
*/
cacheElements: function() {
const control = this;
control.sortableList = control.container.find(CONSTANTS.SELECTORS.SORTABLE_LIST);
control.hiddenInput = control.container.find(CONSTANTS.SELECTORS.HIDDEN_INPUT);
control.sortableItems = control.container.find(CONSTANTS.SELECTORS.SORTABLE_ITEM);
},
/**
* Initialize and validate the control value.
*/
initializeValue: function() {
const control = this;
let currentValue = control.setting.get();
try {
if (typeof currentValue === 'string') {
currentValue = JSON.parse(currentValue);
}
if (!control.isValidStructure(currentValue)) {
throw new Error('Invalid structure detected');
}
} catch (error) {
console.warn('Sortable Elements: Invalid data detected, rebuilding from DOM:', error.message);
currentValue = control.rebuildFromDOM();
}
if (!currentValue) {
currentValue = control.getDefaultValue();
}
// Save the validated structure.
control.setting.set(currentValue);
control.updateHiddenInput(currentValue);
},
/**
* Validate the structure of the value object.
*/
isValidStructure: function(value) {
return value &&
typeof value === 'object' &&
Array.isArray(value.order) &&
typeof value.visibility === 'object' &&
value.order.length > 0;
},
/**
* Get default value structure
*/
getDefaultValue: function() {
return {
order: [],
visibility: {}
};
},
/**
* Rebuild data structure from DOM elements
*/
rebuildFromDOM: function() {
const control = this;
const elements = {};
const order = [];
// Extract data from DOM elements.
control.sortableItems.each(function() {
const $item = $(this);
const elementId = $item.data('element-id');
if (!elementId) {
console.warn('Sortable item missing element-id attribute');
return;
}
const toggleBtn = $item.find(CONSTANTS.SELECTORS.VISIBILITY_TOGGLE);
const isVisible = toggleBtn.length > 0 ?
toggleBtn.attr('data-visible') === 'true' : true;
order.push(elementId);
elements[elementId] = isVisible;
});
return {
order: order,
visibility: elements
};
},
/**
* Setup jQuery UI Sortable functionality.
*/
setupSortable: function() {
const control = this;
if (!control.sortableList.length) {
console.warn('Sortable list element not found');
return;
}
// Initialize jQuery UI Sortable.
control.sortableList.sortable({
items: CONSTANTS.SELECTORS.SORTABLE_ITEM,
handle: CONSTANTS.SELECTORS.ITEM_HANDLE,
axis: 'y',
placeholder: CONSTANTS.CLASSES.PLACEHOLDER,
helper: 'clone',
opacity: CONSTANTS.SORTABLE_OPTIONS.OPACITY,
tolerance: CONSTANTS.SORTABLE_OPTIONS.TOLERANCE,
cursor: 'move',
revert: CONSTANTS.SORTABLE_OPTIONS.REVERT,
cancel: CONSTANTS.SELECTORS.VISIBILITY_TOGGLE + ', .hestia-item-label',
start: function( event, ui ) {
ui.item.addClass(CONSTANTS.CLASSES.SORTING);
ui.placeholder.height(ui.item.height());
},
stop: function( event, ui ) {
ui.item.removeClass(CONSTANTS.CLASSES.SORTING);
control.saveElementsState();
control.triggerPreviewUpdate();
},
});
// Disable text selection on sortable items.
control.sortableList.disableSelection();
},
/**
* Setup live preview functionality.
*/
setupLivePreview: function() {
const control = this;
// Listen for setting changes and update preview
control.setting.bind( function( newValue ) {
try {
// Validate before sending to preview.
if (!control.isValidStructure(newValue)) {
console.warn('Invalid structure, skipping preview update');
return;
}
// Send message to preview frame.
api.previewer.send( 'hestia-sortable-elements-changed', {
setting: control.id,
value: newValue
});
} catch (error) {
console.error('Error updating preview:', error);
}
});
},
/**
* Trigger preview update with debouncing.
*/
triggerPreviewUpdate: function() {
const control = this;
if ( control.previewUpdateTimeout ) {
clearTimeout( control.previewUpdateTimeout );
}
// Set a new timeout to batch updates
control.previewUpdateTimeout = setTimeout( function() {
try {
// Force refresh of the preview
api.previewer.refresh();
// Also trigger selective refresh if supported
if ( api.selectiveRefresh ) {
api.selectiveRefresh.requestFullRefresh();
}
} catch (error) {
console.error('Error refreshing preview:', error);
}
}, CONSTANTS.DELAYS.PREVIEW_UPDATE );
},
/**
* Initialize visibility toggler functionality.
*/
initVisibilityToggler: function() {
const control = this;
control.container.on('click', CONSTANTS.SELECTORS.VISIBILITY_TOGGLE, function(event) {
event.preventDefault();
event.stopPropagation();
const toggleBtn = $(this);
const itemElem = toggleBtn.closest(CONSTANTS.SELECTORS.SORTABLE_ITEM);
if (!itemElem.length) {
console.warn('Could not find parent sortable item');
return;
}
control.toggleItemVisibility(toggleBtn, itemElem);
});
},
/**
* Toggle visibility of a single item
*/
toggleItemVisibility: function(toggleBtn, itemElem) {
const control = this;
try {
const currentVisibility = toggleBtn.attr('data-visible') === 'true';
const newVisibility = !currentVisibility;
toggleBtn.attr('data-visible', newVisibility.toString());
const iconElem = toggleBtn.find(CONSTANTS.SELECTORS.DASHICONS);
if (iconElem.length) {
iconElem
.removeClass(CONSTANTS.CLASSES.HIDDEN_ICON + ' ' + CONSTANTS.CLASSES.VISIBILITY_ICON)
.addClass(newVisibility ? CONSTANTS.CLASSES.VISIBILITY_ICON : CONSTANTS.CLASSES.HIDDEN_ICON);
}
itemElem.toggleClass(CONSTANTS.CLASSES.HIDDEN, !newVisibility);
// Update ARIA attributes for accessibility.
toggleBtn.attr('aria-pressed', newVisibility.toString());
itemElem.attr('aria-hidden', (!newVisibility).toString());
control.saveElementsState();
control.triggerPreviewUpdate();
} catch (error) {
console.error('Error toggling item visibility:', error);
}
},
/**
* Save the current elements state.
*/
saveElementsState: function() {
const control = this;
try {
const state = {
order: [],
visibility: {}
};
// Collect current state.
control.container.find(CONSTANTS.SELECTORS.SORTABLE_ITEM).each(function() {
const $item = $(this);
const elementId = $item.data('element-id');
if (!elementId) {
console.warn('Sortable item missing element-id, skipping');
return;
}
const toggleBtn = $item.find(CONSTANTS.SELECTORS.VISIBILITY_TOGGLE);
const isVisible = toggleBtn.length > 0 ?
toggleBtn.attr('data-visible') === 'true' : true;
state.order.push(elementId);
state.visibility[elementId] = isVisible;
});
// Validate before saving.
if (!control.isValidStructure(state)) {
throw new Error('Generated invalid state structure');
}
// Update both the hidden input and the setting.
control.updateHiddenInput(state);
control.setting.set(state);
} catch (error) {
console.error('Error saving elements state:', error);
}
},
/**
* Update the hidden input with JSON string
*/
updateHiddenInput: function(state) {
const control = this;
try {
const jsonString = JSON.stringify(state);
if (control.hiddenInput.length) {
control.hiddenInput.val(jsonString);
} else {
console.warn('Hidden input not found');
}
} catch (error) {
console.error('Error updating hidden input:', error);
}
},
/**
* Bind cleanup events for proper resource management.
*/
bindCleanupEvents: function() {
const control = this;
// Cleanup when control is removed or page is unloaded.
$(window).on('beforeunload', function() {
control.cleanup();
});
},
/**
* Cleanup the memory.
*/
cleanup: function() {
const control = this;
// Clear any pending timeouts
if (control.previewUpdateTimeout) {
clearTimeout(control.previewUpdateTimeout);
control.previewUpdateTimeout = null;
}
// Destroy sortable if it exists.
if (control.sortableList && control.sortableList.length) {
try {
control.sortableList.sortable('destroy');
} catch (error) {
console.warn('Error destroying sortable:', error);
}
}
// Remove event listeners
control.container.off('click', CONSTANTS.SELECTORS.VISIBILITY_TOGGLE);
// Clear cached elements.
control.sortableList = null;
control.hiddenInput = null;
control.sortableItems = null;
}
});
})( jQuery, wp.customize ); controls/custom-controls/sortable-elements/sortable-elements.css 0000666 00000006545 15220735036 0021367 0 ustar 00 /**
* Sortable Elements Control Styles
*
* @package Hestia
*/
/* Control Container */
.hestia-sortable-elements-control {
margin-bottom: 12px;
}
.hestia-sortable-wrapper {
margin-top: 12px;
}
/* Elements List */
.hestia-sortable-list {
margin: 0;
padding: 0;
list-style: none;
}
/* Element Item */
.hestia-sortable-item {
margin: 0 0 8px 0;
background: #fff;
border: 1px solid #ccd0d4;
border-radius: 4px;
transition: all 0.15s ease-in-out;
}
.hestia-sortable-item:last-child {
margin-bottom: 0;
}
.hestia-sortable-item:hover {
border-color: #8c8f94;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.hestia-sortable-item.hestia-item-hidden {
opacity: 0.6;
transition: opacity 0.2s ease-in-out;
}
.hestia-sortable-item.hestia-item-sorting {
z-index: 1000;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
transform: rotate(2deg);
}
/* Sortable Placeholder */
.hestia-sortable-placeholder {
background: #f0f0f1;
border: 2px dashed #8c8f94;
border-radius: 4px;
margin: 0 0 8px 0;
visibility: visible !important;
opacity: 0.7;
}
/* Element Wrapper */
.hestia-item-inner {
display: flex;
align-items: center;
min-height: 48px;
}
/* Drag Handle */
.hestia-item-handle {
padding: 0 12px;
color: #787c82;
cursor: grab;
flex-shrink: 0;
user-select: none;
}
.hestia-item-handle:active {
cursor: grabbing;
}
.hestia-item-handle .dashicons {
font-size: 20px;
width: 20px;
height: 20px;
}
/* Element Content */
.hestia-item-content {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 8px;
min-width: 0;
}
/* Element Label */
.hestia-item-label {
font-size: 13px;
line-height: 1.5;
color: #1d2327;
font-weight: 600;
margin-right: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
user-select: none;
}
/* Visibility Toggle */
.hestia-item-visibility {
padding: 0 12px;
border-left: 1px solid #e0e0e0;
flex-shrink: 0;
}
.hestia-visibility-toggle {
background: transparent;
border: none;
color: #2271b1;
cursor: pointer;
height: 36px;
width: 36px;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.15s ease-in-out;
border-radius: 50%;
}
.hestia-visibility-toggle:hover {
background: #f0f6fc;
color: #135e96;
}
.hestia-visibility-toggle[data-visible="false"] {
color: #787c82;
}
.hestia-visibility-toggle[data-visible="false"]:hover {
background: #f0f0f1;
color: #50575e;
}
.hestia-visibility-toggle .dashicons {
font-size: 20px;
width: 20px;
height: 20px;
}
.hestia-visibility-toggle:active {
transform: scale(0.9);
}
/* Focus States */
.hestia-visibility-toggle:focus {
outline: 2px solid #2271b1;
outline-offset: 2px;
}
.hestia-visibility-toggle:focus:not(:focus-visible) {
outline: none;
}
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
.hestia-sortable-item,
.hestia-visibility-toggle {
transition: none;
}
.hestia-sortable-item.hestia-item-sorting {
transform: none;
}
}
/* Responsive Design */
@media screen and (max-width: 782px) {
.hestia-item-label {
font-size: 14px;
}
.hestia-item-inner {
min-height: 52px;
}
.hestia-item-content {
padding: 10px 6px;
}
.hestia-item-visibility {
padding: 0 10px;
}
}
/* High Contrast Mode Support */
@media (prefers-contrast: high) {
.hestia-sortable-item {
border-width: 2px;
}
.hestia-item-button:disabled {
opacity: 0.5;
}
} controls/custom-controls/font-selector/style.css 0000666 00000003121 15220735036 0016224 0 ustar 00 #customize-theme-controls #sub-accordion-section-hestia_typography.customize-pane-child.open {
height: 100%;
}
.hestia-ss-wrap {
position: relative;
box-sizing: border-box;
border: 1px solid #ddd;
}
.hestia-ss-wrap.active {
box-shadow: 0 0 2px rgba(30, 140, 190, .8);
border: 1px solid #5897fb;
}
.customize-control input.hestia-fs-main-input {
width: 90%;
background: #fff;
display: block;
float: left;
box-shadow: none;
cursor: pointer;
box-sizing: border-box;
border: 1px solid #ddd;
border-right: 0;
border-radius: 0;
height: 35px;
}
.customize-control input.hestia-fs-main-input:focus {
border-color: #ddd;
}
.hestia-fs-input-addon {
width: 10%;
background: #fff;
box-sizing: border-box;
padding: 7px 0;
line-height: 18px;
display: inline-block;
border: 1px solid #ddd;
text-align: center;
border-left: 0;
height: 35px;
}
.hestia-fs-options-wrapper {
max-height: 300px;
overflow-y: scroll;
}
.hestia-fs-options-group {
display: block;
}
.hestia-fs-search {
padding: 7px;
display: block;
border-bottom: 1px solid #ddd;
}
.hestia-fs-option, .hestia-fs-options-heading {
display: block;
padding: 3px 5px;
line-height: 18px;
}
.hestia-fs-option {
cursor: pointer;
}
.hestia-fs-options-heading {
font-weight: 600;
color: #777;
background: #eee;
}
.hestia-fs-option:hover {
background: #5897fb;
color: #fff;
}
.hestia-ss-wrap.active .hestia-fs-dropdown {
display: block;
width: 100%;
z-index: 1000;
}
.hestia-fs-dropdown {
background: #fff;
border: 1px solid #ddd;
border-top: 0;
display: none;
position: absolute;
}
general/class-hestia-header-controls.php 0000666 00000055050 15220735036 0014355 0 ustar 00 <?php
/**
* Handle Header Controls.
*
* @package Hestia
*/
/**
* Class Hestia_Header_Controls
*/
class Hestia_Header_Controls extends Hestia_Register_Customizer_Controls {
/**
* Actions needed to run before the controls are added.
*/
public function before_add_controls() {
$this->register_type( 'Hestia_Customize_Control_Radio_Image', 'control' );
}
/**
* Add the customizer controls.
*/
public function add_controls() {
$this->add_main_panel();
$this->add_top_bar_options();
$this->add_navigation_options();
$this->add_header_options();
$this->add_mobile_menu_icon_options();
}
/**
* Add main panel for Header controls.
*/
private function add_main_panel() {
$this->add_panel(
new Hestia_Customizer_Panel(
'hestia_header_options',
array(
'priority' => 35,
'title' => esc_html__( 'Header Options', 'hestia' ),
)
)
);
}
/**
* Add customizer controls for the top bar area.
*/
private function add_top_bar_options() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_top_bar',
array(
'title' => esc_html__( 'Website', 'hestia' ) . ' - ' . esc_html__( 'Very Top Bar', 'hestia' ),
'panel' => 'hestia_header_options',
'priority' => 10,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_bar_hide',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => true,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Disable section', 'hestia' ),
'section' => 'hestia_top_bar',
'priority' => 5,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_link_to_top_menu',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'container_class' => 'quick-links',
'text_before' => '<span class="dashicons dashicons-info" style="margin-right: 3px"></span>' . __( 'Customize the Very Top Bar Menu', 'hestia' ),
'text_after' => '.',
'button_text' => __( 'here', 'hestia' ),
'is_button' => false,
'focus_type' => 'section',
'focus' => 'menu_locations',
'shortcut' => true,
'section' => 'hestia_top_bar',
'priority' => 1000,
),
'Hestia_Button'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_link_to_top_widgets',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'container_class' => 'quick-links',
'text_before' => '<span class="dashicons dashicons-info" style="margin-right: 3px"></span>' . __( 'Edit the Very Top Bar Widgets', 'hestia' ),
'text_after' => '.',
'button_text' => __( 'here', 'hestia' ),
'is_button' => false,
'focus_type' => 'section',
'focus' => 'sidebar-widgets-sidebar-top-bar',
'shortcut' => true,
'section' => 'hestia_top_bar',
'priority' => 1000,
),
'Hestia_Button'
)
);
if ( ! class_exists( 'Hestia_Addon_Manager' ) ) {
$this->add_top_bar_options_upsell();
}
}
/**
* Add top bar options upsell.
*
* @return void
*/
private function add_top_bar_options_upsell() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_very_top_bar_tabs',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_top_bar',
'priority' => 1,
'tabs' => array(
'general' => array(
'label' => esc_html__( 'General Settings', 'hestia' ),
),
'appearance' => array(
'label' => esc_html__( 'Appearance Settings', 'hestia' ),
),
),
'controls' => array(
'general' => array(
'hestia_top_bar_hide' => array(),
'hestia_link_to_top_text_upgrade' => array(),
'hestia_top_bar_alignment_upsell' => array(),
'hestia_link_to_top_menu' => array(),
'hestia_link_to_top_widgets' => array(),
),
'appearance' => array(
'hestia_link_to_top_text_upgrade' => array(),
'hestia_top_bar_text_color_upsell' => array(),
'hestia_top_bar_link_color_upsell' => array(),
'hestia_top_bar_link_color_hover_upsell' => array(),
'hestia_top_bar_background_color_upsell' => array(),
),
),
),
'Hestia_Customize_Control_Tabs'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_bar_alignment_upsell',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Layout', 'hestia' ),
'priority' => 25,
'section' => 'hestia_top_bar',
'choices' => array(
'left' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqCAMAAABpj1iyAAAAM1BMVEX///8Ahbojjr5mqMzU5O/f6/Pq8vf1+fs9l8NToMiGuNWjyN681ueVwNp3sNGwz+LI3evMEc51AAABPUlEQVR4Ae3RuYojSxhE4Ti5L1nL+z/tVdISNFwYY5hWy4jPCPjLOlTKzMzMzMzMzMzMzMzMzP61WvSJAllbjvETsxLof464fvUR8ysr6ylVSZGph5L1B3z3F/dL41KFuSdD0mq0A6QjECJR9QSOfba4Socwfz5r0rXYQxOkDDRAN7QAUZ12wvzKGpzjHVkFygmUwRSkSSgaoMEpBWKGlQZdkandeJX681nqXCGMx1AEaRClBF8VkXizvT7cAcJ6Q9YicN4Eup5/q+oATVq+IWa4UrqSIkPKZXX6G7IqsBT2CFKG0AHlwBbVCbFx64C2Qhsn4w1ZOqFq7BEkrQAdpHzEIzJUI3BWlQZzAL3oDUrKz1FKVVKuNSXpPNIFSw9J2nJ5zi+62XrVh0kzjktmZmZmZmZmZmZmZmZm9s1/51AJDRsfaTQAAAAASUVORK5CYII=',
'label' => esc_html__( 'Left Sidebar', 'hestia' ),
),
'right' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqCAMAAABpj1iyAAAAM1BMVEX///8Ahbojjr5mqMzU5O/f6/Pq8vf1+fs9l8NToMiGuNWjyN681ueVwNp3sNGwz+LI3evMEc51AAABO0lEQVR4Ae3RuWodQRhE4Tq9Lz3L+z+tb6MrMFZm0EhBfUHBP9FhWmZmZmZmZmZmZmZmZmb2Uot+o0DWlmP8jVkJ9MUR148+Yv7MynpLVVJk6qVkPaBxqcLckyFpNdoB0hEIkah6Asc+W1ylQ5j6B3/7j/urSddiD02QMtAA3dACRHXaCfMja3COJ7IKlBMogylIk1A0QINTCsQMKw26IlO78Sr1+7PUuUIYr6EI0iBKCT4qIvFm+/xwBwjrgaxF4LwJdL3/VtUBmrR8Q8xwpXQlRYaUy+r0B7IqsBT2CFKG0AHlwBbVCbFx64C2Qhsn44EsnVA19giSVoAOUj7iERmqETirSoM5gF6eyCopv0cpVUm51pSk80gXLL0kacvlPT/oZutVv0yacVwyMzMzMzMzMzMzMzMzs+/yB9eOCQ0dpl58AAAAAElFTkSuQmCC',
'label' => esc_html__( 'Right Sidebar', 'hestia' ),
),
),
),
'Hestia_Customize_Control_Radio_Image',
array(
'selector' => '.hestia-top-bar',
'settings' => array( 'hestia_top_bar_alignment' ),
'render_callback' => array( $this, 'top_bar_callback' ),
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_bar_background_color_upsell',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Background color', 'hestia' ),
'section' => 'hestia_top_bar',
'priority' => 7,
),
'WP_Customize_Color_Control'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_bar_text_color_upsell',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Text', 'hestia' ) . ' ' . esc_html__( 'Color', 'hestia' ),
'section' => 'hestia_top_bar',
'priority' => 10,
),
'WP_Customize_Color_Control'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_bar_link_color_upsell',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Link', 'hestia' ) . ' ' . esc_html__( 'Color', 'hestia' ),
'section' => 'hestia_top_bar',
'priority' => 15,
),
'WP_Customize_Color_Control'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_bar_link_color_hover_upsell',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Link color on hover', 'hestia' ),
'section' => 'hestia_top_bar',
'priority' => 20,
),
'WP_Customize_Color_Control'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_link_to_top_text_upgrade',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'container_class' => 'upgrade-links',
'text_before' => sprintf(
/* translators: %1$s is the Learn more link, %2$s is the section title */
__( 'More Options Available for %1$s in the Pro version.', 'hestia' ),
esc_html__( 'Very Top Bar', 'hestia' )
),
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/hestia/upgrade/', 'very-top-bar' ), 'query' ),
'button_text' => __( 'Upgrade Now', 'hestia' ),
'new_tab' => true,
'is_button' => false,
'shortcut' => false,
'section' => 'hestia_top_bar',
'focus_type' => '',
'priority' => 6,
'button_class' => 'button button-primary',
),
'Hestia_Button'
)
);
}
/**
* Add customizer controls for the navigation.
*/
private function add_navigation_options() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_navigation',
array(
'title' => esc_html__( 'Website', 'hestia' ) . ' - ' . esc_html__( 'Header', 'hestia' ),
'panel' => 'hestia_header_options',
'priority' => 15,
)
)
);
if ( ! class_exists( '\Hestia_Addon_Manager' ) ) {
$description = sprintf(
/* translators: %1$s is the Learn more link, %2$s is the section title */
__( 'More Options Available for %1$s in the PRO version. %2$s', 'hestia' ),
esc_html__( 'Navigation', 'hestia' ),
/* translators: %s is the Learn more label*/
sprintf(
'<a class="button button-primary" target="_blank" href="' . tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/hestia/upgrade/', 'navigation' ), 'query' ) . '" style="display: block; clear: both; width: fit-content; margin: 15px 0;">%s</a>',
__( 'Upgrade to Unlock', 'hestia' )
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_navigation_upsell_notice',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_navigation',
'description' => $description . '<hr style="margin-left: 0px; border-bottom: none;">',
'priority' => 1,
'type' => 'hidden',
)
)
);
}
$this->add_control(
new Hestia_Customizer_Control(
'hestia_navbar_transparent',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => apply_filters( 'hestia_navbar_transparent_default', true ),
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Transparent Navbar', 'hestia' ),
'section' => 'hestia_navigation',
'priority' => 15,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_link_to_add_icon',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'container_class' => 'quick-links',
'text_before' => '<span class="dashicons dashicons-info" style="margin-right: 3px"></span>' . __( 'Add new', 'hestia' ) . ' ' . __( 'Transparent Header Logo', 'hestia' ),
'text_after' => '.',
'button_text' => __( 'here', 'hestia' ),
'is_button' => false,
'focus_type' => 'section',
'focus' => 'title_tagline',
'shortcut' => true,
'section' => 'hestia_navigation',
'priority' => 15,
),
'Hestia_Button'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_navbar_sticky',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => apply_filters( 'hestia_navbar_sticky_default', true ),
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Sticky Navbar', 'hestia' ),
'section' => 'hestia_navigation',
'priority' => 16,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_search_in_menu',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => false,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Enable Search in Menu', 'hestia' ),
'section' => 'hestia_navigation',
'priority' => 5,
)
)
);
if ( class_exists( '\WooCommerce', false ) ) {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_cart_icon_status',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => false,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Customize Mini Cart', 'hestia' ),
'section' => 'hestia_navigation',
'priority' => 20,
)
)
);
}
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_alignment',
array(
'default' => apply_filters( 'hestia_header_alignment_default', 'left' ),
'sanitize_callback' => 'hestia_sanitize_alignment_options',
),
array(
'label' => esc_html__( 'Layout', 'hestia' ),
'priority' => 45,
'section' => 'hestia_navigation',
'choices' => apply_filters(
'hestia_nav_layout_choices',
array(
'left' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAADFBMVEX////V1dUAhbo+yP8aB7nsAAAARklEQVRYhWNgGEGA/z8EHKC+MqZVq1ah4xGtjOLgHQWjYBSMgmENREOxgoDhp2xkASIDYxgoGwUUACJDdlTZKBgFo2DAAAAZAflVkm2NtwAAAABJRU5ErkJggg==',
),
'center' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAADFBMVEX////V1dUAhbo+yP8aB7nsAAAARElEQVRYR2NgGKngPwT8GVU2BJQNb6C1atUCfHjEKRsFo2BEANFQrCBg+CkbWYDIwBgGykYBBYDIkB1VNgpGwSgYMAAAzIYr4wYj4sEAAAAASUVORK5CYII=',
),
'right' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEX////V1dXF7v8Ahbo+yP+vNfjRAAAAWUlEQVR42u3TsQ2AMAxFQRAswAaIFViB/WeKlI4KgUJMwl3j7lXfA3+xXVvfas3HmZaWVtw/1mrRjmnPnl6tDlsAEcblFq2PtuhLyS1oxbWgjpIL1dICgEYlsKfbvyzuWeMAAAAASUVORK5CYII=',
),
)
),
),
'Hestia_Customize_Control_Radio_Image'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_link_to_nav_widgets',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'container_class' => 'quick-links',
'text_before' => '<span class="dashicons dashicons-info" style="margin-right: 3px"></span>' . __( 'Edit the Navigation Widgets', 'hestia' ),
'text_after' => '.',
'button_text' => __( 'here', 'hestia' ),
'is_button' => false,
'focus_type' => 'section',
'focus' => 'sidebar-widgets-header-sidebar',
'shortcut' => true,
'section' => 'hestia_navigation',
'priority' => 1000,
),
'Hestia_Button'
)
);
}
/**
* Add customizer controls for the header area.
*/
private function add_header_options() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_image_sitewide',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => false,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Enable Header Image Sitewide', 'hestia' ),
'section' => 'header_image',
'priority' => 25,
)
)
);
$sidebar_choices = apply_filters(
'hestia_header_layout_choices',
array(
'default' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEU+yP/////Y9P/G7//V1dUbjhlcAAAAW0lEQVR4Ae3SAQmAYAyE0V9NMDCBCQxh/0wKGGCAIJ7vC3DA28ZvkjRVo49vzVujoeYFbF15i32pu4CtlCTVc+Vu2VqPRi9ssWfPnj179uzZs2fPnj179uwzt07LZ+4ImOW7JwAAAABJRU5ErkJggg==',
),
'no-content' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAElBMVEU+yP////88SFhjbXl1fonV1dUUDrn8AAAAXElEQVR4Ae3SMQ2AYAyEUSwAYOC3gAJE4N8KCztNKEPT9wm44eUmSZL0b3NeXbeWEaj41noEet/yCVs+cW7jqfjW12ztV6D8Lfbs2bNnz549e/bs2bNnz559060bqAJ8azq5sAYAAAAASUVORK5CYII=',
),
'classic-blog' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAElBMVEX///88SFhjbXl1fok+yP/V1dWks4cUAAAAXElEQVR4Ae3SMQ2AQBBE0QNAwFlAASKwgH8rNNSwCdfs5j0BU/xMo6ypByTfmveAxmd7Wz5xLP2Rf4tf1jPAli1btl7YsmWL7QoYuoX22lelvfbaa6892mufifbcjgr1IbRYbwEAAAAASUVORK5CYII=',
),
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_layout',
array(
'sanitize_callback' => 'sanitize_key',
'default' => 'default',
),
array(
'label' => esc_html__( 'Posts/Pages Layout', 'hestia' ),
'section' => 'header_image',
'priority' => 10,
'choices' => $sidebar_choices,
),
'Hestia_Customize_Control_Radio_Image'
)
);
$this->add_selective_refresh_to_header_items();
$product_layout_choices = array(
'no-content' => array(
'url' => 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAADFBMVEXV1dX///8+yP88SFiChfYKAAAAf0lEQVR42u2VwQ2AIAxF8cBeLOESLuEqnN3HUTwrpk0viKnaxFT/u4DNy8NwIUwaMjRo0O5ofYsB2rmWAjOuzGyhaQ+VmFVt2Q2Tmq1WNsIfa0SjJuNaS0dj1F6oRZae1/xqgl+tfNeg5rqm1Oi1tdJs/+3SvXW0RB5Dg/YBbQNZMbMYOvhmhQAAAABJRU5ErkJggg==',
),
'classic-blog' => array(
'url' => 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAACVBMVEX////V1dU8SFgcXJ18AAAAZElEQVR42mNgGAVDD4iGQoHWKihooIYyEi1tYKCWaQsIKyPSNOoqgzOwahk1bdS0wW5awCDNWfRUNpwK/FC8KWTUtCFkGpEAUttSS9kApt4QCBVAoHwbVTaqbFTZyFE2CgY/AADFX3Gl4BVG6wAAAABJRU5ErkJggg==',
),
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_product_layout',
array(
'sanitize_callback' => array( $this, 'sanitize_product_layout' ),
'default' => 'no-content',
),
array(
'label' => esc_html__( 'Products', 'hestia' ) . ' ' . esc_html__( 'Layout', 'hestia' ),
'section' => 'header_image',
'priority' => 12,
'choices' => $product_layout_choices,
'active_callback' => array( $this, 'check_if_woo' ),
),
'Hestia_Customize_Control_Radio_Image'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_logo_display',
array(
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_text_field',
'default' => 'only-logo',
),
array(
'type' => 'select',
'label' => esc_html__( 'Display', 'hestia' ),
'section' => 'title_tagline',
'priority' => 7,
'choices' => array(
'only-logo' => esc_html__( 'Only Logo', 'hestia' ),
'right-text' => esc_html__( 'Logo With Right Text', 'hestia' ),
'left-text' => esc_html__( 'Logo With Left Text', 'hestia' ),
'bottom-text' => esc_html__( 'Logo With Bottom Text', 'hestia' ),
),
),
'Hestia_Customize_Control_Radio_Image'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_transparent_header_logo',
array(
'sanitize_callback' => 'absint',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Transparent Header Logo', 'hestia' ),
'section' => 'title_tagline',
'priority' => 9,
'active_callback' => array( $this, 'hestia_transparent_header_logo_callback' ),
'flex_width' => true,
'flex_height' => true,
'height' => 100,
),
'WP_Customize_Cropped_Image_Control'
)
);
}
/**
* Add selective refresh to header logo and site name.
*/
private function add_selective_refresh_to_header_items() {
$this->get_customizer_object( 'setting', 'blogname' )->transport = 'postMessage';
$this->add_partial(
new Hestia_Customizer_Partial(
'blogname',
array(
'selector' => '.navbar .navbar-brand p',
'settings' => array( 'blogname' ),
'render_callback' => array( $this, 'blog_name_callback' ),
)
)
);
$this->add_partial(
new Hestia_Customizer_Partial(
'custom_logo',
array(
'selector' => '.navbar-brand',
'settings' => 'custom_logo',
'render_callback' => array( $this, 'logo_callback' ),
)
)
);
$this->add_partial(
new Hestia_Customizer_Partial(
'hestia_transparent_header_logo',
array(
'selector' => '.navbar-brand',
'settings' => 'hestia_transparent_header_logo',
'render_callback' => array( $this, 'logo_callback' ),
)
)
);
}
/**
* Change customizer controls.
*/
public function change_controls() {
$header_image_section = $this->get_customizer_object( 'section', 'header_image' );
if ( ! empty( $header_image_section ) ) {
$header_image_section->title = esc_html__( 'Posts & Pages', 'hestia' ) . ' - ' . esc_html__( 'Header', 'hestia' );
$header_image_section->panel = 'hestia_header_options';
$header_image_section->priority = 20;
}
$this->get_customizer_object( 'setting', 'custom_logo' )->transport = 'postMessage';
$header_image_control = $this->get_customizer_object( 'control', 'header_image' );
if ( ! empty( $header_image_control ) ) {
$header_image_control->priority = 15;
}
$header_image_data_control = $this->get_customizer_object( 'control', 'header_image_data' );
if ( ! empty( $header_image_data_control ) ) {
$header_image_data_control->priority = 20;
}
$this->change_customizer_object( 'section', 'title_tagline', 'panel', 'hestia_header_options' );
$this->change_customizer_object( 'section', 'title_tagline', 'priority', 5 );
}
/**
* Blog name callback function
*
* @return void
*/
public function blog_name_callback() {
bloginfo( 'name' );
}
/**
* Custom logo callback function.
*
* @return string
*/
public function logo_callback() {
return Hestia_Header::logo();
}
/**
* Check if WooCommerce is installed.
*
* @return bool
*/
public function check_if_woo() {
return class_exists( 'WooCommerce', false );
}
/**
* Sanitize product page layout.
*
* @param string $layout Product page layout.
*
* @return string
*/
public function sanitize_product_layout( $layout ) {
$allowed_values = array( 'no-content', 'classic-blog' );
if ( ! in_array( $layout, $allowed_values, true ) ) {
return 'no-content';
}
return $layout;
}
/**
* Active callback for the transparent logo
*/
public function hestia_transparent_header_logo_callback() {
$transparent_navbar = get_theme_mod( 'hestia_navbar_transparent' );
return $transparent_navbar === true;
}
/**
* Add mobile menu icon options.
*/
public function add_mobile_menu_icon_options() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_mobile_menu_icon_status',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => false,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Enable Mobile Menu Icon', 'hestia' ),
'section' => 'hestia_navigation',
'priority' => 35,
)
)
);
}
}