Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/controls.tar

custom-controls/radio-image/class-hestia-customize-control-radio-image.php000066600000012371151143725270023057 0ustar00<?php
/**
 * The radio image customize control extends the WP_Customize_Control class.  This class allows
 * developers to create a list of image radio inputs.
 *
 * Note, the `$choices` array is slightly different than normal and should be in the form of
 * `array(
 *  $value => array( 'url' => $image_url, 'label' => $text_label ),
 *  $value => array( 'url' => $image_url, 'label' => $text_label ),
 * )`
 *
 * @package Hestia
 * @since Hestia 1.1.24
 * @author     Justin Tadlock <justin@justintadlock.com>
 * @copyright  Copyright (c) 2008 - 2015, Justin Tadlock
 * @link       http://themehybrid.com/hybrid-core
 * @license    http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */

/**
 * Class Hestia_Customize_Control_Radio_Image
 */
class Hestia_Customize_Control_Radio_Image extends WP_Customize_Control {

	/**
	 * The type of customize control being rendered.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $type = 'radio-image';

	/**
	 * Flag to tell that this control is a tab
	 *
	 * @since 1.1.72
	 * @var   bool
	 */
	public $is_tab = false;

	/**
	 * Flag to tell that this control is a sub-tab in a tab
	 *
	 * @since 1.1.72
	 * @var   bool
	 */
	public $is_subtab = false;

	/**
	 * Controls in tabs.
	 *
	 * @since 1.1.72
	 * @var   array
	 */
	public $controls;

	/**
	 * Control data (tabs, names, icons, images)
	 *
	 * @since 1.1.72
	 * @var   array
	 */
	public $choices;

	/**
	 * Hestia_Customize_Control_Radio_Image constructor.
	 *
	 * @param WP_Customize_Manager $manager Customizer manager object.
	 * @param string               $id Control id.
	 * @param array                $args Control arguments.
	 */
	public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
		parent::__construct( $manager, $id, apply_filters( $id . '_filter_args', apply_filters( $id . '_filter_args', $args ) ) );

		if ( ! empty( $args['is_tab'] ) && $args['is_tab'] === true ) {
			$this->is_tab = $args['is_tab'];
			if ( ! empty( $args['is_subtab'] ) && $args['is_subtab'] === true ) {
				$this->is_subtab = $args['is_subtab'];
			}

			if ( ! empty( $this->choices ) ) {
				foreach ( $this->choices as $value => $args ) {
					$this->controls[ $value ] = $args['controls'];
				}
			}
		}

	}

	/**
	 * Loads the jQuery UI Button script and custom scripts/styles.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	public function enqueue() {
		wp_enqueue_script( 'jquery-ui-button' );
		wp_enqueue_script( 'hestia-radio-customize-controls', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/radio-image/script.js', array( 'jquery' ) );
		wp_enqueue_style( 'hestia-radio-customize-controls', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/radio-image/style.css' );
	}

	/**
	 * Add custom JSON parameters to use in the JS template.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return array
	 */
	public function json() {
		$json = parent::json();

		$json['is_tab']    = $this->is_tab;
		$json['is_subtab'] = $this->is_subtab;
		if ( $json['is_tab'] === true ) {
			$json['controls'] = $this->controls;
		}
		// We need to make sure we have the correct image URL.
		$json['choices'] = $this->choices;
		$json['id']      = $this->id;
		$json['link']    = $this->get_link();
		$json['value']   = $this->value();

		return $json;
	}

	/**
	 * Underscore JS template to handle the control's output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	public function content_template() {
		?>
		<#
				if ( ! data.choices ) {
				return;
				}
				#>
			<# if( !data.is_tab) {#>
				<# if ( data.label ) { #>
					<span class="customize-control-title">{{ data.label }}</span>
					<# } #>

						<# if ( data.description ) { #>
							<span class="description customize-control-description">{{{ data.description }}}</span>
							<# } #>
								<#}#>



									<div class="buttonset <# if( data.is_tab) {#>customizer-tab <#}#> <# if( data.is_subtab) {#>customizer-subtab <#}#>">

										<# for ( key in data.choices ) { #>

											<input <# if( data.is_tab) {#>data-controls="{{data.controls[key]}}"<#}#> type="radio" value="{{ key }}" name="_customize-{{ data.type }}-{{ data.id }}" id="{{ data.id }}-{{ key }}" {{{ data.link }}} <# if ( key === data.value && ( !data.is_tab || data.is_subtab) ) { #> checked="checked" <# } #> />
															<label for="{{ data.id }}-{{ key }}">
																<# if( !data.is_tab) {#>
																	<span class="screen-reader-text">{{ data.choices[ key ]['label'] }}</span>
																	<img src="{{ data.choices[ key ]['url'] }}" alt="{{ data.choices[ key ]['label'] }}" />
																	<# } else { #>
																		<# if( data.choices[ key ]['icon'] ){ #>
																			<i class="fa fa-{{ data.choices[ key ]['icon'] }}"></i>
																			<# }
																					if( data.choices[ key ]['url'] ){
																					#>
																				<img src="{{ data.choices[ key ]['url'] }}" alt="{{ data.choices[ key ]['label'] }}" />
																				<# }
																						if(data.choices[ key ]['label']){ #>
																					<span class="tab-label">{{ data.choices[ key ]['label'] }}</span>
																					<# } #>
																						<# } #>
															</label>
															<# } #>

									</div>
		<?php
	}
}
custom-controls/radio-image/script.js000066600000010334151143725270013753 0ustar00jQuery( document ).ready( function() {

    // Use buttonset() for radio images.
    jQuery( '.customize-control-radio-image .buttonset' ).buttonset();

    jQuery.hestiaTab = {

        'init': function () {
            var firstTabControlName = this.initTabDefault();
            this.handleClick(firstTabControlName);
        },

        'handleClick':function (parentTabName) {
            var self = this;
            jQuery( '.customize-control-radio-image .buttonset.customizer-tab input:radio' ).click( function() {

                var controlsToShow = jQuery(this).data('controls');

                var controlsToShowArray = controlsToShow.split(',');
                var activeTabControlName = jQuery(this).parent().parent().attr('id').replace('customize-control-','');
                var currentSection = jQuery(this).parent().parent().parent();
                var allControlsToShow = controlsToShowArray;


                controlsToShowArray.forEach(function(controlId){
                    if( typeof wp.customize.control(controlId) !== 'undefined' ){
                        if( typeof wp.customize.control(controlId).params.is_tab !== 'undefined'){
                            var grandChildToShow = self.getControlsToShow(controlId);
                            allControlsToShow = allControlsToShow.concat(grandChildToShow);
                        }
                    }
                });

                allControlsToShow.push(activeTabControlName);
                allControlsToShow.push(parentTabName);

                self.hideControlExcept(currentSection, allControlsToShow);
            } );
        },

        'initTabDefault': function () {

            var section = jQuery('ul.accordion-section');

            //First tab control in section
            var firstTabControl = section.find('.customizer-tab').first();
            var currentSection = firstTabControl.parent().parent();
            var firstTabControlName = firstTabControl.parent().attr('id').replace('customize-control-','');
            var firstTab = firstTabControl.children('input').first();
            firstTabControl.children('label').removeClass('ui-state-active');
            firstTabControl.children('label').first().addClass('ui-state-active');
            var controlsToShow = firstTab.data('controls');
            var controlsToShowArray = controlsToShow.split(',');
            var allControlsToShow = controlsToShowArray;

            /**
             * Beside the controls that are defined in tab, we must check if there is another tab in this tab and
             * to show its controls.
             */
            var self = this;
            controlsToShowArray.forEach(function(controlId){
                if ( typeof wp.customize.control( controlId ) !== 'undefined' ) {
                    var is_tab = wp.customize.control(controlId).params.is_tab;
                    if( typeof is_tab !== 'undefined' && is_tab === true ){
                        var grandChildToShow = self.getControlsToShow(controlId);
                        allControlsToShow = allControlsToShow.concat(grandChildToShow);
                    }
                }
            });
            allControlsToShow.push(firstTabControlName);


            this.hideControlExcept(currentSection, allControlsToShow);
            return firstTabControlName;

        },
        'getControlsToShow': function (controlId) {
            var firstTabControl = jQuery('#customize-control-'+controlId).find('.customizer-tab').first();
            var firstTab = firstTabControl.children('input:checked');
            var controlsToShow = firstTab.data('controls');
            if( typeof controlsToShow !== 'undefined' ){
                return controlsToShow.split(',');
            }
            return [];
        },
        'hideControlExcept':function (section, controls) {
            jQuery(section).find('.customize-control').hide();
            for( var i in controls ){
                if( controls[i] === 'widgets' ){
                    jQuery( section ).children( 'li[class*="widget"]' ).css( 'display', 'list-item' );
                } else {
                    jQuery(section).find('#customize-control-'+controls[i]).show();
                }
            }
        }
    };
    // jQuery.hestiaTab.init();

} );custom-controls/radio-image/style.css000066600000004276151143725270013773 0ustar00.customize-control-radio-image .ui-buttonset {
    text-align: center;
}
.customize-control-radio-image label {
    display: inline-block;
    max-width: 33.3%;
    padding: 3px;
    font-size: inherit;
    line-height: inherit;
    height: auto;
    cursor: pointer;
    border-width: 0;
    -webkit-appearance: none;
    -webkit-border-radius: 0;
    border-radius: 0;
    white-space: nowrap;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    color: inherit;
    background: none;
    -webkit-box-shadow: none;
    box-shadow: none;
    vertical-align: inherit;
}
.customize-control-radio-image label:first-of-type {
    float: left;
}
.customize-control-radio-image label:nth-of-type(n + 3){
    float: right;
}
.customize-control-radio-image label:hover {
    background: none;
    border-color: inherit;
    color: inherit;
}
.customize-control-radio-image label:active {
    background: none;
    border-color: inherit;
    -webkit-box-shadow: none;
    box-shadow: none;
    -webkit-transform: none;
    -ms-transform: none;
    transform: none;
}
.customize-control-radio-image img { border: 1px solid transparent; }
.customize-control-radio-image .ui-state-active img {
    border-color: #00b6ff;
    -webkit-box-shadow: 0 0 1px #3ec8ff;
    box-shadow: 0 0 5px #3EC8FE;
}

#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;
}custom-controls/customizer-page-editor/class-hestia-customizer-page-editor-helper.php000066600000015663151143725270025315 0ustar00<?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_action( 'save_post', array( $this, 'trigger_sync_from_page' ), 10 );
		add_action( 'customize_save', array( $this, 'trigger_sync_from_customizer' ), 10 );
		add_action( 'after_setup_theme', array( $this, 'sync_controls' ) );
		add_action( 'wp_ajax_hestiaUpdateFrontPageChange', array( $this, 'update_frontpage_change' ) );

		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(
					'textarea_rows' => 55,
					'editor_height' => 260,
				);
				wp_editor( '', 'wpeditorwidget', $settings );
				?>
			</div>
		</div>
		<?php
	}

	/**
	 * When the frontpage is edited, we set a flag with 'sync_customizer' value to know that we should update
	 * hestia_page_editor and hestia_feature_thumbnail customizer controls.
	 *
	 * @param int $post_id ID of the post that we need to update.
	 *
	 * @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.
	 *
	 * @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.
	 *
	 * @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/contact.jpg' );
					if ( $thumbnail === get_template_directory_uri() . '/assets/img/contact.jpg' ) {
						$featured_image = get_template_directory_uri() . '/assets/img/contact.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/contact.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.
	 */
	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/contact.jpg' );
			if ( $thumbnail === get_template_directory_uri() . '/assets/img/contact.jpg' ) {
				$featured_image = get_template_directory_uri() . '/assets/img/contact.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() {
		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' );
	}
}
custom-controls/customizer-page-editor/class-hestia-page-editor.php000066600000005206151143725270021626 0ustar00<?php
/**
 * Page editor control
 *
 * @package Hestia
 * @since Hestia 1.1.3
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return null;
}

/**
 * Class to create a custom tags control
 */
class Hestia_Page_Editor extends WP_Customize_Control {

	/**
	 * Flag to include sync scripts if needed
	 *
	 * @var bool|mixed
	 */
	private $needsync = false;

	/**
	 * 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 );
		if ( ! empty( $args['needsync'] ) ) {
			$this->needsync = $args['needsync'];
		}
	}

	/**
	 * Enqueue scripts
	 *
	 * @since   1.1.0
	 * @access  public
	 * @updated Changed wp_enqueue_scripts order and dependencies.
	 */
	public function enqueue() {
		wp_enqueue_style( 'hestia_text_editor_css', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/customizer-page-editor/css/hestia-page-editor.css', array(), HESTIA_VERSION );
		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',
				'customize-preview',
			), HESTIA_VERSION, false
		);
		if ( $this->needsync === true ) {
			wp_enqueue_script( 'hestia_controls_script', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/customizer-page-editor/js/hestia-update-controls.js', array( 'jquery', 'hestia_text_editor' ), HESTIA_VERSION, true );
			wp_localize_script(
				'hestia_controls_script', 'requestpost', array(
					'ajaxurl'           => admin_url( 'admin-ajax.php' ),
					'thumbnail_control' => 'hestia_feature_thumbnail', // name of image control that needs sync
					'editor_control'    => 'hestia_page_editor', // name of control (theme_mod) that needs sync
					'thumbnail_label'   => esc_html__( 'About background', 'hestia' ), // name of thumbnail control
				)
			);
		}
	}

	/**
	 * 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"><?php _e( '(Edit)', 'hestia' ); ?></button>
		</label>
		<?php
	}
}
custom-controls/customizer-page-editor/js/hestia-text-editor.js000066600000007406151143725270021040 0ustar00/**
 * 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 ).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);
		}
	});

	/**
	 * Toggle editor when the user clicks on customizer shortcut.
	 */
	var customize = wp.customize;
	customize.previewer.bind(
		'trigger-open-editor', function( data ) {
            if( typeof data !== 'undefined'){
				editor = WPEditorWidget.init(data);
				WPEditorWidget.run(editor);
            }
		}
	);

	/**
	 * 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();
			}
		}
	);

	/**
	 * Focus menu when the user clicks on customizer shortcut of the menu.
	 */
	customize.previewer.bind(
		'trigger-focus-menu', function() {
			wp.customize.section( 'menu_locations' ).focus();
		}
	);
});
custom-controls/customizer-page-editor/js/hestia-update-controls.js000066600000006063151143725270021711 0ustar00/**
 * Update controls
 *
 * @package Hestia
 */

/* global requestpost */
/* global wp */
/* global WPEditorWidget */

( function( $ ) {
	'use strict';
	wp.customize(
		'page_on_front', function( value ) {

			value.bind(
				function( newval ) {

					$.ajax(
						{
							url: requestpost.ajaxurl,
							type: 'post',
							data: {
								action: 'hestiaUpdateFrontPageChange',
								pid: newval
							},
							success: function (result) {
								if (result !== '' && result !== 'undefined' ) {

									result      = JSON.parse( result );
									var html, content = result.post_content;
									jQuery( '#hestia_page_editor' ).val( content );
									WPEditorWidget.setEditorContent( 'hestia_page_editor' );

									if (result.post_thumbnail !== '' && result.post_thumbnail !== 'undefined') {
										wp.customize.instance( requestpost.thumbnail_control ).set( result.post_thumbnail );
										html = '<label for="hestia_feature_thumbnail-button">' +
										'<span class="customize-control-title">' + requestpost.thumbnail_label + '</span>' +
										'</label>' +
										'<div class="attachment-media-view attachment-media-view-image landscape">' +
										'<div class="thumbnail thumbnail-image">' +
										'<img class="attachment-thumb" src="' + result.post_thumbnail + '" draggable="false" alt=""> ' +
										'</div>' +
										'<div class="actions">' +
										'<button type="button" class="button remove-button">Remove</button>' +
										'<button type="button" class="button upload-button control-focus" id="hestia_feature_thumbnail-button">Change Image</button> ' +
										'<div style="clear:both"></div>' +
										'</div>' +
										'</div>';
									} else {
                                        wp.customize.instance( requestpost.thumbnail_control ).set( '' );
										html = '<label class="customize-control-title" for="customize-media-control-button-105">About background</label>' +
                                            '<div class="customize-control-notifications-container" style="display: none;"><ul></ul></div>' +
                                            '<div class="attachment-media-view">\n' +
                                            '<div class="placeholder">' +
                                            'No image selected' +
                                            '</div>' +
                                            '<div class="actions">' +
                                            '<button type="button" class="button default-button">Default</button>' +
                                            '<button type="button" class="button upload-button" id="customize-media-control-button-105">Select image</button>' +
                                            '</div>' +
                                            '</div>';
									}
                                    wp.customize.control( requestpost.thumbnail_control ).container['0'].innerHTML = html;
									wp.customize.instance( requestpost.editor_control ).previewer.refresh();
								}
							}
						}
					);

				}
			);
		}
	);
} )( jQuery );
custom-controls/customizer-page-editor/css/hestia-page-editor.css000066600000002771151143725270021320 0ustar00/*EDIT CONTENT CONTROL*/
.edit-content-button{  margin-bottom: 10px;}
.edit-content-button:before{content: "\f464";opacity: 0.6;background-color: #ddd;padding: 4px 5px;margin-left: -10px;margin-right: 7px;font-size: 18px;vertical-align: top;border-radius: 2px 0 0 2px;font-family: 'dashicons';}

/*--------------------------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;}
custom-controls/repeater/icon-picker/icon-picker.css000066600000004457151143725270016673 0ustar00.iconpicker .iconpicker-items,.iconpicker .iconpicker-items:after,.iconpicker-popover .popover-footer:after,.iconpicker:after{clear:both}.iconpicker-popover.popover{position:absolute;padding:1px;text-align:left;background:#e5e5e5;z-index:999;display:none;margin-left:-10px;width:254px}.iconpicker,.iconpicker-popover.popover.iconpicker-visible{display:block}.iconpicker-popover.popover .popover-title{padding:5px;font-size:5px;line-height:16px;border-bottom:1px solid #ebebeb;background-color:#e5e5e5}.iconpicker-popover.popover .popover-title input[type=search].iconpicker-search{margin:0 0 2px}.iconpicker-popover.popover .popover-title-text~input[type=search].iconpicker-search{margin-top:14px}.iconpicker-popover.popover .popover-content{padding:0;text-align:center}.iconpicker-popover.popover>.arrow,.iconpicker-popover.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.iconpicker *,.icp-container{position:relative}.iconpicker-popover.popover>.arrow{border-width:11px}.iconpicker-popover.popover>.arrow:after{border-width:10px;content:""}.iconpicker-popover.popover.bottomLeft>.arrow{border-top-width:0;border-bottom-color:#e5e5e5;top:-11px}.iconpicker-popover.popover.bottomLeft>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#e5e5e5}.iconpicker-popover.popover.bottomLeft>.arrow{left:14px;margin-left:0}.iconpicker,.iconpicker .iconpicker-items{position:relative;margin:0;overflow:hidden}.iconpicker{text-align:left;text-shadow:none;line-height:0}.iconpicker .iconpicker-items:after,.iconpicker .iconpicker-items:before,.iconpicker:after,.iconpicker:before{content:" ";display:table}.iconpicker *{box-sizing:content-box}.iconpicker .iconpicker-items{float:none;padding:5px 0 0 5px;background:#fff;overflow-y:auto;min-height:55px;max-height:275px}.iconpicker .iconpicker-items i{float:left;width:32px;height:32px;line-height:32px;margin:0 7px 7px 0;text-align:center;cursor:pointer;border-radius:3px;font-size:18px;color:#444;box-shadow:0 0 0 1px #ddd;transition:transform .2s ease}.iconpicker .iconpicker-items i:nth-child(6n){margin-right:0}.iconpicker .iconpicker-items i:hover{transform:scale(1.4);color:#008ec2;box-shadow:none}.icp{padding-left:30px}.icp-container .input-group-addon{position:absolute;top:1px;left:5px;padding:3px}custom-controls/repeater/icon-picker/icon-picker.js000066600000003647151143725270016517 0ustar00/**
 * Fontawesome iconpicker control in the repeater
 *
 * @package Hestia
 */
(function ($) {
	'use strict';
	wp.customizerRepeater = {

		init: function () {
			$( '.iconpicker-items>i' ).on(
				'click', function () {
					var iconClass  = $( this ).attr( 'class' ).slice( 3 );
					var classInput = $( this ).parents( '.iconpicker-popover' ).prev().find( '.icp' );
					classInput.val( iconClass );
					classInput.attr( 'value', iconClass );

					var iconPreview = classInput.next( '.input-group-addon' );
					var iconElement = '<i class="fa '.concat( iconClass, '"><\/i>' );
					iconPreview.empty();
					iconPreview.append( iconElement );
					classInput.trigger( 'change' );
					return false;
				}
			);
		},
		search: function ($searchField) {
			var itemsList  = $searchField.parent().next().find( '.iconpicker-items' );
			var searchTerm = $searchField.val().toLowerCase();
			if (searchTerm.length > 0) {
				itemsList.children().each(
					function () {
						if ($( this ).filter( '[title*='.concat( searchTerm ).concat( ']' ) ).length > 0 || searchTerm.length < 1) {
							$( this ).show();
						} else {
							$( this ).hide();
						}
					}
				);
			} else {
				itemsList.children().show();
			}
		},
		iconPickerToggle: function ($input) {
			var iconPicker = $input.parent().next();
			iconPicker.addClass( 'iconpicker-visible' );
		}
	};

	$( document ).ready(
		function () {
			wp.customizerRepeater.init();

			$( '.iconpicker-search' ).on(
				'keyup', function () {
					wp.customizerRepeater.search( $( this ) );
				}
			);

			$( '.icp-auto' ).on(
				'click', function () {
					wp.customizerRepeater.iconPickerToggle( $( this ) );
				}
			);

			$( document ).mouseup(
				function (e) {
					var container = $( '.iconpicker-popover' );

					if ( ! container.is( e.target )	&& container.has( e.target ).length === 0) {
						container.removeClass( 'iconpicker-visible' );
					}
				}
			);

		}
	);

})( jQuery );
custom-controls/repeater/icon-picker/icons.php000066600000015131151143725270015571 0ustar00<?php
/**
 * The list of icons
 *
 * @package Hestia
 */
?>
<div class="iconpicker-popover popover bottomLeft">
	<div class="arrow"></div>
	<div class="popover-title">
		<input type="search" class="form-control iconpicker-search" placeholder="Type to filter">
	</div>
	<div class="popover-content">
		<div class="iconpicker">
			<div class="iconpicker-items">

				<i data-type="iconpicker-item" title=".fa-behance" class="fa fa-behance"></i>
				<i data-type="iconpicker-item" title=".fa-behance-square" class="fa fa-behance-square"></i>
				<i data-type="iconpicker-item" title=".fa-facebook" class="fa fa-facebook"></i>
				<i data-type="iconpicker-item" title=".fa-facebook-square" class="fa fa-facebook-square"></i>
				<i data-type="iconpicker-item" title=".fa-google-plus" class="fa fa-google-plus"></i>
				<i data-type="iconpicker-item" title=".fa-google-plus-square" class="fa fa-google-plus-square"></i>
				<i data-type="iconpicker-item" title=".fa-linkedin" class="fa fa-linkedin"></i>
				<i data-type="iconpicker-item" title=".fa-linkedin-square" class="fa fa-linkedin-square"></i>
				<i data-type="iconpicker-item" title=".fa-twitter" class="fa fa-twitter"></i>
				<i data-type="iconpicker-item" title=".fa-twitter-square" class="fa fa-twitter-square"></i>
				<i data-type="iconpicker-item" title=".fa-vimeo" class="fa fa-vimeo"></i>
				<i data-type="iconpicker-item" title=".fa-vimeo-square" class="fa fa-vimeo-square"></i>
				<i data-type="iconpicker-item" title=".fa-youtube" class="fa fa-youtube"></i>
				<i data-type="iconpicker-item" title=".fa-youtube-square" class="fa fa-youtube-square"></i>
				<i data-type="iconpicker-item" title=".fa-ambulance" class="fa fa-ambulance"></i>
				<i data-type="iconpicker-item" title=".fa-american-sign-language-interpreting" class="fa fa-american-sign-language-interpreting"></i>
				<i data-type="iconpicker-item" title=".fa-anchor" class="fa fa-anchor"></i>
				<i data-type="iconpicker-item" title=".fa-android" class="fa fa-android"></i>
				<i data-type="iconpicker-item" title=".fa-apple" class="fa fa-apple"></i>
				<i data-type="iconpicker-item" title=".fa-archive" class="fa fa-archive"></i>
				<i data-type="iconpicker-item" title=".fa-area-chart" class="fa fa-area-chart"></i>
				<i data-type="iconpicker-item" title=".fa-asterisk" class="fa fa-asterisk"></i>
				<i data-type="iconpicker-item" title=".fa-automobile" class="fa fa-automobile"></i>
				<i data-type="iconpicker-item" title=".fa-balance-scale" class="fa fa-balance-scale"></i>
				<i data-type="iconpicker-item" title=".fa-ban" class="fa fa-ban"></i>
				<i data-type="iconpicker-item" title=".fa-bank" class="fa fa-bank"></i>
				<i data-type="iconpicker-item" title=".fa-bicycle" class="fa fa-bicycle"></i>
				<i data-type="iconpicker-item" title=".fa-birthday-cake" class="fa fa-birthday-cake"></i>
				<i data-type="iconpicker-item" title=".fa-btc" class="fa fa-btc"></i>
				<i data-type="iconpicker-item" title=".fa-black-tie" class="fa fa-black-tie"></i>
				<i data-type="iconpicker-item" title=".fa-bookmark" class="fa fa-bookmark"></i>
				<i data-type="iconpicker-item" title=".fa-briefcase" class="fa fa-briefcase"></i>
				<i data-type="iconpicker-item" title=".fa-bus" class="fa fa-bus"></i>
				<i data-type="iconpicker-item" title=".fa-cab" class="fa fa-cab"></i>
				<i data-type="iconpicker-item" title=".fa-camera" class="fa fa-camera"></i>
				<i data-type="iconpicker-item" title=".fa-check" class="fa fa-check"></i>
				<i data-type="iconpicker-item" title=".fa-child" class="fa fa-child"></i>
				<i data-type="iconpicker-item" title=".fa-code" class="fa fa-code"></i>
				<i data-type="iconpicker-item" title=".fa-coffee" class="fa fa-coffee"></i>
				<i data-type="iconpicker-item" title=".fa-cog" class="fa fa-cog"></i>
				<i data-type="iconpicker-item" title=".fa-commenting" class="fa fa-commenting"></i>
				<i data-type="iconpicker-item" title=".fa-cube" class="fa fa-cube"></i>
				<i data-type="iconpicker-item" title=".fa-dollar" class="fa fa-dollar"></i>
				<i data-type="iconpicker-item" title=".fa-diamond" class="fa fa-diamond"></i>
				<i data-type="iconpicker-item" title=".fa-envelope" class="fa fa-envelope"></i>
				<i data-type="iconpicker-item" title=".fa-female" class="fa fa-female"></i>
				<i data-type="iconpicker-item" title=".fa-fire-extinguisher" class="fa fa-fire-extinguisher"></i>
				<i data-type="iconpicker-item" title=".fa-glass" class="fa fa-glass"></i>
				<i data-type="iconpicker-item" title=".fa-globe" class="fa fa-globe"></i>
				<i data-type="iconpicker-item" title=".fa-graduation-cap" class="fa fa-graduation-cap"></i>
				<i data-type="iconpicker-item" title=".fa-heartbeat" class="fa fa-heartbeat"></i>
				<i data-type="iconpicker-item" title=".fa-heart" class="fa fa-heart"></i>
				<i data-type="iconpicker-item" title=".fa-hotel" class="fa fa-hotel"></i>
				<i data-type="iconpicker-item" title=".fa-hourglass" class="fa fa-hourglass"></i>
				<i data-type="iconpicker-item" title=".fa-home" class="fa fa-home"></i>
				<i data-type="iconpicker-item" title=".fa-hourglass" class="fa fa-hourglass"></i>
				<i data-type="iconpicker-item" title=".fa-legal" class="fa fa-legal"></i>
				<i data-type="iconpicker-item" title=".fa-lock" class="fa fa-lock"></i>
				<i data-type="iconpicker-item" title=".fa-map-signs" class="fa fa-map-signs"></i>
				<i data-type="iconpicker-item" title=".fa-paint-brush" class="fa fa-paint-brush"></i>
				<i data-type="iconpicker-item" title=".fa-plane" class="fa fa-plane"></i>
				<i data-type="iconpicker-item" title=".fa-rocket" class="fa fa-rocket"></i>
				<i data-type="iconpicker-item" title=".fa-puzzle-piece" class="fa fa-puzzle-piece"></i>
				<i data-type="iconpicker-item" title=".fa-shield" class="fa fa-shield"></i>
				<i data-type="iconpicker-item" title=".fa-tag" class="fa fa-tag"></i>
				<i data-type="iconpicker-item" title=".fa-times" class="fa fa-times"></i>
				<i data-type="iconpicker-item" title=".fa-unlock" class="fa fa-unlock"></i>
				<i data-type="iconpicker-item" title=".fa-user" class="fa fa-user"></i>
				<i data-type="iconpicker-item" title=".fa-user" class="fa fa-user"></i>
				<i data-type="iconpicker-item" title=".fa-user-md" class="fa fa-user-md"></i>
				<i data-type="iconpicker-item" title=".fa-video-camera" class="fa fa-video-camera"></i>
				<i data-type="iconpicker-item" title=".fa-wordpress" class="fa fa-wordpress"></i>
				<i data-type="iconpicker-item" title=".fa-wrench" class="fa fa-wrench"></i>
				<i data-type="iconpicker-item" title=".fa-youtube-play" class="fa fa-youtube-play"></i>

			</div> <!-- /.iconpicker-items -->
		</div> <!-- /.iconpicker -->
	</div> <!-- /.popover-content -->
</div> <!-- /.iconpicker-popover -->
custom-controls/repeater/class-hestia-repeater.php000066600000073442151143725270016451 0ustar00<?php
/**
 * Repeater functionality in customize
 *
 * @package Hestia
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return null;
}

/**
 * Class Hestia_Repeater
 */
class Hestia_Repeater extends WP_Customize_Control {

	/**
	 * ID of the field
	 *
	 * @var string
	 */
	public $id;

	/**
	 * Repeater box title
	 *
	 * @var array
	 */
	private $boxtitle = array();

	/**
	 * Repeater Add field button label
	 *
	 * @var array
	 */
	private $add_field_label = array();

	/**
	 * Repeater Icon container
	 *
	 * @var string
	 */
	private $customizer_icon_container = '';

	/**
	 * Repeater Allowed HTML tags
	 *
	 * @var array
	 */
	private $allowed_html = array();

	/**
	 * Check if image control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_image_control = false;

	/**
	 * Check if icon control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_icon_control = false;

	/**
	 * Check if color control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_color_control = false;

	/**
	 * Check if second color control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_color2_control = false;

	/**
	 * Check if title control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_title_control = false;

	/**
	 * Check if subtitle control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_subtitle_control = false;

	/**
	 * Check if text control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_text_control = false;

	/**
	 * Check if link control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_link_control = false;

	/**
	 * Check if second text control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_text2_control = false;

	/**
	 * Check if second link control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_link2_control = false;

	/**
	 * Check if shortcode control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_shortcode_control = false;

	/**
	 * Check if internal repeater control is added in the repetear
	 *
	 * @var bool
	 */
	public $customizer_repeater_repeater_control = false;


	/**
	 * Class constructor
	 */
	public function __construct( $manager, $id, $args = array() ) {
		parent::__construct( $manager, $id, $args );
		/*Get options from customizer.php*/
		$this->add_field_label = esc_html__( 'Add new field', 'hestia' );
		if ( ! empty( $args['add_field_label'] ) ) {
			$this->add_field_label = $args['add_field_label'];
		}

		$this->boxtitle = esc_html__( 'Customizer Repeater', 'hestia' );
		if ( ! empty( $args['item_name'] ) ) {
			$this->boxtitle = $args['item_name'];
		} elseif ( ! empty( $this->label ) ) {
			$this->boxtitle = $this->label;
		}

		if ( ! empty( $args['customizer_repeater_image_control'] ) ) {
			$this->customizer_repeater_image_control = $args['customizer_repeater_image_control'];
		}

		if ( ! empty( $args['customizer_repeater_icon_control'] ) ) {
			$this->customizer_repeater_icon_control = $args['customizer_repeater_icon_control'];
		}

		if ( ! empty( $args['customizer_repeater_color_control'] ) ) {
			$this->customizer_repeater_color_control = $args['customizer_repeater_color_control'];
		}

		if ( ! empty( $args['customizer_repeater_color2_control'] ) ) {
			$this->customizer_repeater_color2_control = $args['customizer_repeater_color2_control'];
		}

		if ( ! empty( $args['customizer_repeater_title_control'] ) ) {
			$this->customizer_repeater_title_control = $args['customizer_repeater_title_control'];
		}

		if ( ! empty( $args['customizer_repeater_subtitle_control'] ) ) {
			$this->customizer_repeater_subtitle_control = $args['customizer_repeater_subtitle_control'];
		}

		if ( ! empty( $args['customizer_repeater_text_control'] ) ) {
			$this->customizer_repeater_text_control = $args['customizer_repeater_text_control'];
		}

		if ( ! empty( $args['customizer_repeater_link_control'] ) ) {
			$this->customizer_repeater_link_control = $args['customizer_repeater_link_control'];
		}

		if ( ! empty( $args['customizer_repeater_text2_control'] ) ) {
			$this->customizer_repeater_text2_control = $args['customizer_repeater_text2_control'];
		}

		if ( ! empty( $args['customizer_repeater_link2_control'] ) ) {
			$this->customizer_repeater_link2_control = $args['customizer_repeater_link2_control'];
		}

		if ( ! empty( $args['customizer_repeater_shortcode_control'] ) ) {
			$this->customizer_repeater_shortcode_control = $args['customizer_repeater_shortcode_control'];
		}

		if ( ! empty( $args['customizer_repeater_repeater_control'] ) ) {
			$this->customizer_repeater_repeater_control = $args['customizer_repeater_repeater_control'];
		}

		if ( ! empty( $id ) ) {
			$this->id = $id;
		}

		if ( file_exists( get_template_directory() . '/inc/customizer/controls/custom-controls/repeater/icon-picker/icons.php' ) ) {
			$this->customizer_icon_container = '/inc/customizer/controls/custom-controls/repeater/icon-picker/icons';
		}

		$allowed_array1 = wp_kses_allowed_html( 'post' );
		$allowed_array2 = array(
			'input' => array(
				'type'        => array(),
				'class'       => array(),
				'placeholder' => array(),
			),
		);

		$this->allowed_html = array_merge( $allowed_array1, $allowed_array2 );
	}

	/**
	 * Enqueue resources for the control
	 */
	public function enqueue() {
		wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/font-awesome/css/font-awesome.min.css', array(), HESTIA_VENDOR_VERSION );

		wp_enqueue_style( 'hestia_customizer-repeater-admin-stylesheet', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/repeater/style.css', array(), HESTIA_VERSION );

		wp_enqueue_style( 'wp-color-picker' );

		wp_enqueue_script( 'hestia_customizer-repeater-script', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/repeater/script.js', array( 'jquery', 'jquery-ui-draggable', 'wp-color-picker' ), HESTIA_VERSION, true );

		wp_enqueue_script( 'hestia_customizer-repeater-fontawesome-iconpicker', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/repeater/icon-picker/icon-picker.js', array( 'jquery' ), HESTIA_VERSION, true );

		wp_enqueue_style( 'hestia_customizer-repeater-fontawesome-iconpicker-script', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/repeater/icon-picker/icon-picker.css', array(), HESTIA_VERSION );
	}

	/**
	 * Render the control
	 */
	public function render_content() {

		/*Get default options*/
		$this_default = json_decode( $this->setting->default );

		/*Get values (json format)*/
		$values = $this->value();

		/*Decode values*/
		$json = json_decode( $values );

		if ( ! is_array( $json ) ) {
			$json = array( $values );
		} ?>

		<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
		<div class="customizer-repeater-general-control-repeater customizer-repeater-general-control-droppable">
			<?php
			if ( ( count( $json ) == 1 && '' === $json[0] ) || empty( $json ) ) {
				if ( ! empty( $this_default ) ) {
					$this->iterate_array( $this_default );
					?>
					<input type="hidden" id="customizer-repeater-<?php echo esc_attr( $this->id ); ?>-colector" <?php esc_attr( $this->link() ); ?> class="customizer-repeater-colector" value="<?php echo esc_textarea( json_encode( $this_default ) ); ?>"/>
					<?php
				} else {
					$this->iterate_array();
					?>
					<input type="hidden" id="customizer-repeater-<?php echo esc_attr( $this->id ); ?>-colector" <?php esc_attr( $this->link() ); ?> class="customizer-repeater-colector"/>
					<?php
				}
			} else {
				$this->iterate_array( $json );
				?>
				<input type="hidden" id="customizer-repeater-<?php echo esc_attr( $this->id ); ?>-colector" <?php esc_attr( $this->link() ); ?> class="customizer-repeater-colector" value="<?php echo esc_textarea( $this->value() ); ?>"/>
				<?php
			}
			?>
			</div>
		<button type="button" class="button add_field customizer-repeater-new-field">
			<?php echo esc_html( $this->add_field_label ); ?>
		</button>
		<?php
	}

	/**
	 * Iterate array
	 *
	 * @param array $array Array to iterate.
	 */
	private function iterate_array( $array = array() ) {
		/*Counter that helps checking if the box is first and should have the delete button disabled*/
		$it = 0;
		if ( ! empty( $array ) ) {
			foreach ( $array as $icon ) {
				?>
				<div class="customizer-repeater-general-control-repeater-container customizer-repeater-draggable">
					<div class="customizer-repeater-customize-control-title">
						<?php echo esc_html( $this->boxtitle ); ?>
					</div>
					<div class="customizer-repeater-box-content-hidden">
						<?php
						$choice = '';
						if ( $this->id === 'hestia_features_content' ) {
							$choice = 'customizer_repeater_icon';
						}

						$image_url  = '';
						$icon_value = '';
						$title      = '';
						$subtitle   = '';
						$text       = '';
						$text2      = '';
						$link2      = '';
						$link       = '';
						$shortcode  = '';
						$repeater   = '';
						$color      = '';
						$color2     = '';

						if ( ! empty( $icon->id ) ) {
							$id = $icon->id;
						}

						if ( ! empty( $icon->choice ) ) {
							$choice = $icon->choice;
						}

						if ( ! empty( $icon->image_url ) ) {
							$image_url = $icon->image_url;
						}

						if ( ! empty( $icon->icon_value ) ) {
							$icon_value = $icon->icon_value;
						}

						if ( ! empty( $icon->color ) ) {
							$color = $icon->color;
						}

						if ( ! empty( $icon->color2 ) ) {
							$color2 = $icon->color2;
						}

						if ( ! empty( $icon->title ) ) {
							$title = $icon->title;
						}

						if ( ! empty( $icon->subtitle ) ) {
							$subtitle = $icon->subtitle;
						}

						if ( ! empty( $icon->text ) ) {
							$text = $icon->text;
						}

						if ( ! empty( $icon->link ) ) {
							$link = $icon->link;
						}

						if ( ! empty( $icon->text2 ) ) {
							$text2 = $icon->text2;
						}

						if ( ! empty( $icon->link2 ) ) {
							$link2 = $icon->link2;
						}

						if ( ! empty( $icon->shortcode ) ) {
							$shortcode = $icon->shortcode;
						}

						if ( ! empty( $icon->social_repeater ) ) {
							$repeater = $icon->social_repeater;
						}

						if ( $this->customizer_repeater_image_control == true && $this->customizer_repeater_icon_control == true ) {
							$this->icon_type_choice( $choice );
						}

						if ( $this->customizer_repeater_image_control == true ) {
							$this->image_control( $image_url, $choice );
						}

						if ( $this->customizer_repeater_icon_control == true ) {
							$this->icon_picker_control( $icon_value, $choice );
						}

						if ( $this->customizer_repeater_color_control == true ) {
							$this->input_control(
								array(
									'label'             => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Color', 'hestia' ), $this->id, 'customizer_repeater_color_control' ),
									'class'             => 'customizer-repeater-color-control',
									'type'              => apply_filters( 'hestia_repeater_input_types_filter', 'color', $this->id, 'customizer_repeater_color_control' ),
									'sanitize_callback' => 'sanitize_hex_color',
									'choice'            => $choice,
								), $color
							);
						}
						if ( $this->customizer_repeater_color2_control == true ) {
							$this->input_control(
								array(
									'label'             => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Color', 'hestia' ), $this->id, 'customizer_repeater_color2_control' ),
									'class'             => 'customizer-repeater-color2-control',
									'type'              => apply_filters( 'hestia_repeater_input_types_filter', 'color', $this->id, 'customizer_repeater_color2_control' ),
									'sanitize_callback' => 'sanitize_hex_color',
								), $color2
							);
						}
						if ( $this->customizer_repeater_title_control == true ) {
							$this->input_control(
								array(
									'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Title', 'hestia' ), $this->id, 'customizer_repeater_title_control' ),
									'class' => 'customizer-repeater-title-control',
									'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_title_control' ),
								), $title
							);
						}
						if ( $this->customizer_repeater_subtitle_control == true ) {
							$this->input_control(
								array(
									'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Subtitle', 'hestia' ), $this->id, 'customizer_repeater_subtitle_control' ),
									'class' => 'customizer-repeater-subtitle-control',
									'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_subtitle_control' ),
								), $subtitle
							);
						}
						if ( $this->customizer_repeater_text_control == true ) {
							$this->input_control(
								array(
									'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Text', 'hestia' ), $this->id, 'customizer_repeater_text_control' ),
									'class' => 'customizer-repeater-text-control',
									'type'  => apply_filters( 'hestia_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_text_control' ),
								), $text
							);
						}
						if ( $this->customizer_repeater_link_control ) {
							$this->input_control(
								array(
									'label'             => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Link', 'hestia' ), $this->id, 'customizer_repeater_link_control' ),
									'class'             => 'customizer-repeater-link-control',
									'sanitize_callback' => 'esc_url_raw',
									'type'              => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link_control' ),
								), $link
							);
						}
						if ( $this->customizer_repeater_text2_control == true ) {
							$this->input_control(
								array(
									'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Text', 'hestia' ), $this->id, 'customizer_repeater_text2_control' ),
									'class' => 'customizer-repeater-text2-control',
									'type'  => apply_filters( 'hestia_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_text2_control' ),
								), $text2
							);
						}
						if ( $this->customizer_repeater_link2_control ) {
							$this->input_control(
								array(
									'label'             => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Link', 'hestia' ), $this->id, 'customizer_repeater_link2_control' ),
									'class'             => 'customizer-repeater-link2-control',
									'sanitize_callback' => 'esc_url_raw',
									'type'              => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link2_control' ),
								), $link2
							);
						}
						if ( $this->customizer_repeater_shortcode_control == true ) {
							$this->input_control(
								array(
									'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Shortcode', 'hestia' ), $this->id, 'customizer_repeater_shortcode_control' ),
									'class' => 'customizer-repeater-shortcode-control',
									'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_shortcode_control' ),
								), $shortcode
							);
						}
						if ( $this->customizer_repeater_repeater_control == true ) {
							$this->repeater_control( $repeater );
						}
						echo '<input type="hidden" class="social-repeater-box-id" value="';
						if ( ! empty( $id ) ) {
							echo esc_attr( $id );
						}
						echo '">';
						echo '<button type="button" class="social-repeater-general-control-remove-field"';
						if ( $it == 0 ) {
							echo 'style="display:none;"';
						}
						echo '>';
						esc_html_e( 'Delete field', 'hestia' );
						?>
						</button>

					</div>
				</div>

				<?php
				$it++;
			}
		} else {
			?>
			<div class="customizer-repeater-general-control-repeater-container">
				<div class="customizer-repeater-customize-control-title">
					<?php echo esc_html( $this->boxtitle ); ?>
				</div>
				<div class="customizer-repeater-box-content-hidden">
					<?php
					if ( $this->customizer_repeater_image_control == true && $this->customizer_repeater_icon_control == true ) {
						$this->icon_type_choice();
					}
					if ( $this->customizer_repeater_image_control == true ) {
						$this->image_control();
					}
					if ( $this->customizer_repeater_icon_control == true ) {
						$this->icon_picker_control();
					}
					if ( $this->customizer_repeater_color_control == true ) {
						$this->input_control(
							array(
								'label'             => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Color', 'hestia' ), $this->id, 'customizer_repeater_color_control' ),
								'class'             => 'customizer-repeater-color-control',
								'type'              => apply_filters( 'hestia_repeater_input_types_filter', 'color', $this->id, 'customizer_repeater_color_control' ),
								'sanitize_callback' => 'sanitize_hex_color',
							)
						);
					}
					if ( $this->customizer_repeater_color2_control == true ) {
						$this->input_control(
							array(
								'label'             => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Color', 'hestia' ), $this->id, 'customizer_repeater_color2_control' ),
								'class'             => 'customizer-repeater-color2-control',
								'type'              => apply_filters( 'hestia_repeater_input_types_filter', 'color', $this->id, 'customizer_repeater_color2_control' ),
								'sanitize_callback' => 'sanitize_hex_color',
							)
						);
					}
					if ( $this->customizer_repeater_title_control == true ) {
						$this->input_control(
							array(
								'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Title', 'hestia' ), $this->id, 'customizer_repeater_title_control' ),
								'class' => 'customizer-repeater-title-control',
								'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_title_control' ),
							)
						);
					}
					if ( $this->customizer_repeater_subtitle_control == true ) {
						$this->input_control(
							array(
								'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Subtitle', 'hestia' ), $this->id, 'customizer_repeater_subtitle_control' ),
								'class' => 'customizer-repeater-subtitle-control',
								'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_subtitle_control' ),
							)
						);
					}
					if ( $this->customizer_repeater_text_control == true ) {
						$this->input_control(
							array(
								'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Text', 'hestia' ), $this->id, 'customizer_repeater_text_control' ),
								'class' => 'customizer-repeater-text-control',
								'type'  => apply_filters( 'hestia_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_text_control' ),
							)
						);
					}
					if ( $this->customizer_repeater_link_control == true ) {
						$this->input_control(
							array(
								'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Link', 'hestia' ), $this->id, 'customizer_repeater_link_control' ),
								'class' => 'customizer-repeater-link-control',
								'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link_control' ),
							)
						);
					}
					if ( $this->customizer_repeater_text2_control == true ) {
						$this->input_control(
							array(
								'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Text', 'hestia' ), $this->id, 'customizer_repeater_text2_control' ),
								'class' => 'customizer-repeater-text2-control',
								'type'  => apply_filters( 'hestia_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_text2_control' ),
							)
						);
					}
					if ( $this->customizer_repeater_link2_control == true ) {
						$this->input_control(
							array(
								'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Link', 'hestia' ), $this->id, 'customizer_repeater_link2_control' ),
								'class' => 'customizer-repeater-link2-control',
								'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link2_control' ),
							)
						);
					}
					if ( $this->customizer_repeater_shortcode_control == true ) {
						$this->input_control(
							array(
								'label' => apply_filters( 'repeater_input_labels_filter', esc_html__( 'Shortcode', 'hestia' ), $this->id, 'customizer_repeater_shortcode_control' ),
								'class' => 'customizer-repeater-shortcode-control',
								'type'  => apply_filters( 'hestia_repeater_input_types_filter', '', $this->id, 'customizer_repeater_shortcode_control' ),
							)
						);
					}
					if ( $this->customizer_repeater_repeater_control == true ) {
						$this->repeater_control();
					}
					?>
					<input type="hidden" class="social-repeater-box-id">
					<button type="button" class="social-repeater-general-control-remove-field button" style="display:none;">
						<?php esc_html_e( 'Delete field', 'hestia' ); ?>
					</button>
				</div>
			</div>
			<?php
		}
	}

	/**
	 * Input control
	 *
	 * @param array  $options Options.
	 * @param string $value Value.
	 */
	private function input_control( $options, $value = '' ) {
		?>

		<?php
		if ( ! empty( $options['type'] ) ) {
			switch ( $options['type'] ) {
				case 'textarea':
					?>
					<span class="customize-control-title"><?php echo esc_html( $options['label'] ); ?></span>
					<textarea class="<?php echo esc_attr( $options['class'] ); ?>" placeholder="<?php echo esc_attr( $options['label'] ); ?>"><?php echo ( ! empty( $options['sanitize_callback'] ) ? call_user_func_array( $options['sanitize_callback'], array( $value ) ) : esc_attr( $value ) ); ?></textarea>
					<?php
					break;
				case 'color':
					$style_to_add = '';
					if ( $this->id === 'hestia_features_content' && $options['choice'] !== 'customizer_repeater_icon' ) {
						$style_to_add = 'display:none';
					}
					?>
					<span class="customize-control-title" 
					<?php
					if ( ! empty( $style_to_add ) ) {
						echo 'style="' . esc_attr( $style_to_add ) . '"';}
					?>
						><?php echo esc_html( $options['label'] ); ?></span>
					<div class="<?php echo esc_attr( $options['class'] ); ?>" 
											<?php
											if ( ! empty( $style_to_add ) ) {
												echo 'style="' . esc_attr( $style_to_add ) . '"';}
											?>
						>
						<input type="text" value="<?php echo ( ! empty( $options['sanitize_callback'] ) ? call_user_func_array( $options['sanitize_callback'], array( $value ) ) : esc_attr( $value ) ); ?>" class="<?php echo esc_attr( $options['class'] ); ?>" />
					</div>
					<?php
					break;
			}
		} else {
			?>
			<span class="customize-control-title"><?php echo esc_html( $options['label'] ); ?></span>
			<input type="text" value="<?php echo ( ! empty( $options['sanitize_callback'] ) ? call_user_func_array( $options['sanitize_callback'], array( $value ) ) : esc_attr( $value ) ); ?>" class="<?php echo esc_attr( $options['class'] ); ?>" placeholder="<?php echo esc_attr( $options['label'] ); ?>"/>
			<?php
		}
	}

	/**
	 * Icon picker control
	 *
	 * @param string $value Value.
	 * @param string $show Show or not.
	 */
	private function icon_picker_control( $value = '', $show = '' ) {
		?>
		<div class="social-repeater-general-control-icon" 
		<?php
		if ( $show === 'customizer_repeater_image' || $show === 'customizer_repeater_none' ) {
			echo 'style="display:none;"'; }
		?>
			>
			<span class="customize-control-title">
				<?php esc_html_e( 'Icon', 'hestia' ); ?>
			</span>
			<span class="description customize-control-description">
				<?php
				echo sprintf(
					/* translators: Fontawesome link with full list of icons available */
					esc_html__( 'Note: Some icons may not be displayed here. You can see the full list of icons at %1$s.', 'hestia' ),
					/* translators: Fontawesome link with full list of icons available */
					sprintf( '<a href="http://fontawesome.io/icons/" rel="nofollow">%s</a>', esc_html__( 'http://fontawesome.io/icons/', 'hestia' ) )
				);
				?>
			</span>
			<div class="input-group icp-container">
				<?php
				echo '<input data-placement="bottomRight" class="icp icp-auto" value="';
				if ( ! empty( $value ) ) {
					echo esc_attr( $value );
				}
				echo '" type="text">';
				?>
				<span class="input-group-addon">
					<i class="fa <?php echo esc_attr( $value ); ?>"></i>
				</span>
			</div>
			<?php get_template_part( $this->customizer_icon_container ); ?>
		</div>
		<?php
	}

	/**
	 * Image control
	 *
	 * @param string $value Value.
	 * @param string $show Show or not.
	 */
	private function image_control( $value = '', $show = '' ) {
		?>
		<div class="customizer-repeater-image-control" 
		<?php
		if ( $show === 'customizer_repeater_icon' || $show === 'customizer_repeater_none' || ( $this->id === 'hestia_features_content' && empty( $show ) ) ) {
			echo 'style="display:none;"'; }
		?>
			>
			<span class="customize-control-title">
				<?php esc_html_e( 'Image', 'hestia' ); ?>
			</span>
			<input type="text" class="widefat custom-media-url" value="<?php echo esc_attr( $value ); ?>">
			<input type="button" class="button button-secondary customizer-repeater-custom-media-button" value="<?php esc_attr_e( 'Upload Image', 'hestia' ); ?>" />
		</div>
		<?php
	}

	/**
	 * Icon/Image/None select control
	 *
	 * @param string $value Select control type.
	 */
	private function icon_type_choice( $value = 'customizer_repeater_icon' ) {
		?>
		<span class="customize-control-title">
			<?php esc_html_e( 'Image type', 'hestia' ); ?>
		</span>
		<select class="customizer-repeater-image-choice">
			<option value="customizer_repeater_icon" <?php selected( $value, 'customizer_repeater_icon' ); ?>><?php esc_html_e( 'Icon', 'hestia' ); ?></option>
			<option value="customizer_repeater_image" <?php selected( $value, 'customizer_repeater_image' ); ?>><?php esc_html_e( 'Image', 'hestia' ); ?></option>
			<option value="customizer_repeater_none" <?php selected( $value, 'customizer_repeater_none' ); ?>><?php esc_html_e( 'None', 'hestia' ); ?></option>
		</select>
		<?php
	}

	/**
	 * Repeater control
	 *
	 * @param string $value Value.
	 */
	private function repeater_control( $value = '' ) {
		$social_repeater = array();
		$show_del        = 0;
		?>
		<span class="customize-control-title"><?php esc_html_e( 'Social icons', 'hestia' ); ?></span>
		<?php
		echo '<span class="description customize-control-description">';
		echo sprintf(
			/* translators: Fontawesome link with full list of icons available */
			esc_html__( 'Note: Some icons may not be displayed here. You can see the full list of icons at %1$s.', 'hestia' ),
			/* translators: Fontawesome link with full list of icons available */
			sprintf( '<a href="http://fontawesome.io/icons/" rel="nofollow">%s</a>', esc_html__( 'http://fontawesome.io/icons/', 'hestia' ) )
		);
		echo '</span>';
		if ( ! empty( $value ) ) {
			$social_repeater = json_decode( html_entity_decode( $value ), true );
		}
		if ( ( count( $social_repeater ) == 1 && '' === $social_repeater[0] ) || empty( $social_repeater ) ) {
			?>
			<div class="customizer-repeater-social-repeater">
				<div class="customizer-repeater-social-repeater-container">
					<div class="customizer-repeater-rc input-group icp-container">
						<?php
						echo '<input data-placement="bottomRight" class="icp icp-auto" value="';
						if ( ! empty( $value ) ) {
							echo esc_attr( $value );
						}
						echo '" type="text">';
						?>
						<span class="input-group-addon"></span>
					</div>
					<?php get_template_part( $this->customizer_icon_container ); ?>
					<input type="text" class="customizer-repeater-social-repeater-link" placeholder="<?php esc_attr_e( 'Link', 'hestia' ); ?>">
					<input type="hidden" class="customizer-repeater-social-repeater-id" value="">
					<button class="social-repeater-remove-social-item" style="display:none">
						<?php esc_html_e( 'Remove Icon', 'hestia' ); ?>
					</button>
				</div>
				<input type="hidden" id="social-repeater-socials-repeater-colector" class="social-repeater-socials-repeater-colector" value=""/>
			</div>
			<button class="social-repeater-add-social-item button-secondary"><?php esc_html_e( 'Add Icon', 'hestia' ); ?></button>
			<?php
		} else {
			?>
			<div class="customizer-repeater-social-repeater">
				<?php
				foreach ( $social_repeater as $social_icon ) {
					$show_del ++;
					echo '<div class="customizer-repeater-social-repeater-container">';
						echo '<div class="customizer-repeater-rc input-group icp-container">';
							echo '<input data-placement="bottomRight" class="icp icp-auto" value="';
					if ( ! empty( $social_icon['icon'] ) ) {
						echo esc_attr( $social_icon['icon'] );
					}
							echo '" type="text">';
							echo '<span class="input-group-addon"><i class="fa ' . esc_attr( $social_icon['icon'] ) . '"></i></span>';
						echo '</div>';
						get_template_part( $this->customizer_icon_container );
						echo '<input type="text" class="customizer-repeater-social-repeater-link" placeholder="' . esc_attr__( 'Link', 'hestia' ) . '" value="';
					if ( ! empty( $social_icon['link'] ) ) {
						echo esc_url( $social_icon['link'] );
					}
						echo '">';
						echo '<input type="hidden" class="customizer-repeater-social-repeater-id" value="';
					if ( ! empty( $social_icon['id'] ) ) {
						echo esc_attr( $social_icon['id'] );
					}
						echo '">';
						echo '<button class="social-repeater-remove-social-item" style="';
					if ( $show_del == 1 ) {
						echo 'display:none';
					}
						echo '">' . esc_html__( 'Remove Icon', 'hestia' ) . '</button>';
					echo '</div>';
				}
				?>
				<input type="hidden" id="social-repeater-socials-repeater-colector" class="social-repeater-socials-repeater-colector" value="<?php echo esc_textarea( html_entity_decode( $value ) ); ?>" />
			</div>
			<button class="social-repeater-add-social-item button-secondary"><?php esc_html_e( 'Add Icon', 'hestia' ); ?></button>
			<?php
		}
	}
}
custom-controls/repeater/script.js000066600000037673151143725270013423 0ustar00/**
 * 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' );
		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(){
				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();
			}
		);

		jQuery( 'input.customizer-repeater-color-control' ).wpColorPicker( color_options );
		jQuery( 'input.customizer-repeater-color2-control' ).wpColorPicker( color_options );

		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 = {
	'&': '&amp;',
	'<': '&lt;',
	'>': '&gt;',
	'"': '&quot;',
	'\'': '&#39;',
	'/': '&#x2F;'
};

function escapeHtml(string) {
	'use strict';
	// noinspection JSUnresolvedFunction
	string = String( string ).replace( new RegExp( '\r?\n', 'g' ), '<br />' );
	string = String( string ).replace( /\\/g, '&#92;' );
	return String( string ).replace(
		/[&<>"'\/]/g, function (s) {
			return entityMap[s];
		}
	);

}
custom-controls/repeater/style.css000066600000011020151143725270013405 0ustar00.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%;
}
custom-controls/alpha-color-picker/style.css000066600000011324151143725270015261 0ustar00/**
 * 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;
	}
}
custom-controls/alpha-color-picker/script.js000066600000021421151143725270015250 0ustar00/**
 * Alpha Color Picker JS
 *
 * This file includes several helper functions and the core control JS.
 *
 * @package Hestia
 */

/**
 * Override the stock color.js toString() method to add support for
 * outputting RGBa or Hex.
 */
Color.prototype.toString = function( flag ) {

	// If our no-alpha flag has been passed in, output RGBa value with 100% opacity.
	// This is used to set the background color on the opacity slider during color changes.
	if ( 'no-alpha' == flag ) {
		return this.toCSS( 'rgba', '1' ).replace( /\s+/g, '' );
	}

	// If we have a proper opacity value, output RGBa.
	if ( 1 > this._alpha ) {
		return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
	}

	// Proceed with stock color.js hex output.
	var hex = parseInt( this._color, 10 ).toString( 16 );
	if ( this.error ) {
		return ''; }
	if ( hex.length < 6 ) {
		for ( var i = 6 - hex.length - 1; i >= 0; i-- ) {
			hex = '0' + hex;
		}
	}

	return '#' + hex;
};

/**
 * Given an RGBa, RGB, or hex color value, return the alpha channel value.
 */
function acp_get_alpha_value_from_color( value ) {
	var alphaVal;

	// Remove all spaces from the passed in value to help our RGBa regex.
	value = value.replace( / /g, '' );

	if ( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ ) ) {
		alphaVal = parseFloat( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ )[1] ).toFixed( 2 ) * 100;
		alphaVal = parseInt( alphaVal );
	} else {
		alphaVal = 100;
	}

	return alphaVal;
}

/**
 * Force update the alpha value of the color picker object and maybe the alpha slider.
 */
function acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, update_slider ) {
	var iris, colorPicker, color;

	iris        = $control.data( 'a8cIris' );
	colorPicker = $control.data( 'wpWpColorPicker' );

	// Set the alpha value on the Iris object.
	iris._color._alpha = alpha;

	// Store the new color value.
	color = iris._color.toString();

	// Set the value of the input.
	$control.val( color );

	// Update the background color of the color picker.
	colorPicker.toggler.css(
		{
			'background-color': color
		}
	);

	// Maybe update the alpha slider itself.
	if ( update_slider ) {
		acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
	}

	// Update the color value of the color picker object.
	$control.wpColorPicker( 'color', color );
}

/**
 * Update the slider handle position and label.
 */
function acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ) {
	$alphaSlider.slider( 'value', alpha );
	$alphaSlider.find( '.ui-slider-handle' ).text( alpha.toString() );
}

/**
 * Initialization trigger.
 */
jQuery( document ).ready(
	function( $ ) {

			// Loop over each control and transform it into our color picker.
			$( '.alpha-color-control' ).each(
				function() {

					// Scope the vars.
					var $control, startingColor, paletteInput, showOpacity, defaultColor, palette,
					colorPickerOptions, $container, $alphaSlider, alphaVal, sliderOptions;

					// Store the control instance.
					$control = $( this );

					// Get a clean starting value for the option.
					startingColor = $control.val().replace( /\s+/g, '' );

					// Get some data off the control.
					paletteInput = $control.attr( 'data-palette' );
					showOpacity  = $control.attr( 'data-show-opacity' );
					defaultColor = $control.attr( 'data-default-color' );

					// Process the palette.
					if ( paletteInput.indexOf( '|' ) !== -1 ) {
						palette = paletteInput.split( '|' );
					} else if ( 'false' == paletteInput ) {
						palette = false;
					} else {
						palette = true;
					}

					// Set up the options that we'll pass to wpColorPicker().
					colorPickerOptions = {
						change: function( event, ui ) {
							var key, value, alpha, $transparency;

							key   = $control.attr( 'data-customize-setting-link' );
							value = $control.wpColorPicker( 'color' );

							// Set the opacity value on the slider handle when the default color button is clicked.
							if ( defaultColor == value ) {
								alpha = acp_get_alpha_value_from_color( value );
								$alphaSlider.find( '.ui-slider-handle' ).text( alpha );
							}

							// Send ajax request to wp.customize to trigger the Save action.
							wp.customize(
								key, function( obj ) {
									obj.set( value );
								}
							);

							$transparency = $container.find( '.transparency' );

							// Always show the background color of the opacity slider at 100% opacity.
							$transparency.css( 'background-color', ui.color.toString( 'no-alpha' ) );
						},
						palettes: palette // Use the passed in palette.
					};

					// Create the colorpicker.
					$control.wpColorPicker( colorPickerOptions );

					$container = $control.parents( '.wp-picker-container:first' );

					// Insert our opacity slider.
					$(
						'<div class="alpha-color-picker-container">' +
						'<div class="min-click-zone click-zone"></div>' +
						'<div class="max-click-zone click-zone"></div>' +
						'<div class="alpha-slider"></div>' +
						'<div class="transparency"></div>' +
						'</div>'
					).appendTo( $container.find( '.wp-picker-holder' ) );

					$alphaSlider = $container.find( '.alpha-slider' );

					// If starting value is in format RGBa, grab the alpha channel.
					alphaVal = acp_get_alpha_value_from_color( startingColor );

					// Set up jQuery UI slider() options.
					sliderOptions = {
						create: function( event, ui ) {
							var value = $( this ).slider( 'value' );

							// Set up initial values.
							$( this ).find( '.ui-slider-handle' ).text( value );
							$( this ).siblings( '.transparency ' ).css( 'background-color', startingColor );
						},
						value: alphaVal,
						range: 'max',
						step: 1,
						min: 0,
						max: 100,
						animate: 300
					};

					// Initialize jQuery UI slider with our options.
					$alphaSlider.slider( sliderOptions );

					// Maybe show the opacity on the handle.
					if ( 'true' == showOpacity ) {
						$alphaSlider.find( '.ui-slider-handle' ).addClass( 'show-opacity' );
					}

					// Bind event handlers for the click zones.
					$container.find( '.min-click-zone' ).on(
						'click', function() {
							acp_update_alpha_value_on_color_control( 0, $control, $alphaSlider, true );
						}
					);
					$container.find( '.max-click-zone' ).on(
						'click', function() {
							acp_update_alpha_value_on_color_control( 100, $control, $alphaSlider, true );
						}
					);

					// Bind event handler for clicking on a palette color.
					$container.find( '.iris-palette' ).on(
						'click', function() {
							var color, alpha;

							color = $( this ).css( 'background-color' );
							alpha = acp_get_alpha_value_from_color( color );

							acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );

							// Sometimes Iris doesn't set a perfect background-color on the palette,
							// for example rgba(20, 80, 100, 0.3) becomes rgba(20, 80, 100, 0.298039).
							// To compensante for this we round the opacity value on RGBa colors here
							// and save it a second time to the color picker object.
							if ( alpha != 100 ) {
								color = color.replace( /[^,]+(?=\))/, ( alpha / 100 ).toFixed( 2 ) );
							}

							$control.wpColorPicker( 'color', color );
						}
					);

					// Bind event handler for clicking on the 'Clear' button.
					$container.find( '.button.wp-picker-clear' ).on(
						'click', function() {
							var key = $control.attr( 'data-customize-setting-link' );

							// The #fff color is delibrate here. This sets the color picker to white instead of the
							// defult black, which puts the color picker in a better place to visually represent empty.
							$control.wpColorPicker( 'color', '#ffffff' );

							// Set the actual option value to empty string.
							wp.customize(
								key, function( obj ) {
									obj.set( '' );
								}
							);

							acp_update_alpha_value_on_alpha_slider( 100, $alphaSlider );
						}
					);

					// Bind event handler for clicking on the 'Default' button.
					$container.find( '.button.wp-picker-default' ).on(
						'click', function() {
							var alpha = acp_get_alpha_value_from_color( defaultColor );

							acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
						}
					);

					// Bind event handler for typing or pasting into the input.
					$control.on(
						'input', function() {
							var value = $( this ).val();
							var alpha = acp_get_alpha_value_from_color( value );

							acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
						}
					);

					// Update all the things when the slider is interacted with.
					$alphaSlider.slider().on(
						'slide', function( event, ui ) {
							var alpha = parseFloat( ui.value ) / 100.0;

							acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, false );

							// Change value shown on slider handle.
							$( this ).find( '.ui-slider-handle' ).text( ui.value );
						}
					);

				}
			);
	}
);
custom-controls/alpha-color-picker/class-hestia-customize-alpha-color-control.php000066600000006755151143725270024411 0ustar00<?php
/**
 * Alpha Color Picker Customizer Control
 *
 * This control adds a second slider for opacity to the stock WordPress color picker,
 * and it includes logic to seamlessly convert between RGBa and Hex color values as
 * opacity is added to or removed from a color.
 *
 * This Alpha Color Picker is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this Alpha Color Picker. If not, see <http://www.gnu.org/licenses/>.
 *
 * @package Hestia
 * @since Hestia 1.0
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return null;
}

/**
 * Class Hestia_Customize_Alpha_Color_Control
 */
class Hestia_Customize_Alpha_Color_Control extends WP_Customize_Control {
	/**
	 * Official control name.
	 *
	 * @var string
	 */
	public $type = 'alpha-color';
	/**
	 * Add support for palettes to be passed in.
	 *
	 * Supported palette values are true, false, or an array of RGBa and Hex colors.
	 *
	 * @var bool
	 */
	public $palette;
	/**
	 * Add support for showing the opacity value on the slider handle.
	 *
	 * @var array
	 */
	public $show_opacity;
	/**
	 * Enqueue scripts and styles.
	 *
	 * Ideally these would get registered and given proper paths before this control object
	 * gets initialized, then we could simply enqueue them here, but for completeness as a
	 * stand alone class we'll register and enqueue them here.
	 */
	public function enqueue() {
		wp_enqueue_script(
			'hestia_alpha-color-picker',
			get_template_directory_uri() . '/inc/customizer/controls/custom-controls/alpha-color-picker/script.js',
			array( 'jquery', 'wp-color-picker' ),
			HESTIA_VERSION,
			true
		);
		wp_enqueue_style(
			'hestia_alpha-color-picker',
			get_template_directory_uri() . '/inc/customizer/controls/custom-controls/alpha-color-picker/style.css',
			array( 'wp-color-picker' ),
			HESTIA_VERSION
		);
	}
	/**
	 * Render the control.
	 */
	public function render_content() {
		// Process the palette
		if ( is_array( $this->palette ) ) {
			$palette = implode( '|', $this->palette );
		} else {
			// Default to true.
			$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
		}
		// Support passing show_opacity as string or boolean. Default to true.
		$show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
		// Output the label and description if they were passed in.
		if ( isset( $this->label ) && '' !== $this->label ) {
			echo '<span class="customize-control-title">' . sanitize_text_field( $this->label ) . '</span>';
		}
		if ( isset( $this->description ) && '' !== $this->description ) {
			echo '<span class="description customize-control-description">' . sanitize_text_field( $this->description ) . '</span>';
		}
		?>
		<label>
			<input class="alpha-color-control" type="text" data-show-opacity="<?php echo esc_attr( $show_opacity ); ?>" data-palette="<?php echo esc_attr( $palette ); ?>" data-default-color="<?php echo esc_attr( $this->settings['default']->default ); ?>" <?php esc_attr( $this->link() ); ?>  />
		</label>
		<?php
	}
}
custom-controls/range-value/style.css000066600000007436151143725270014024 0ustar00.range-slider {
	width: 100%;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	flex-wrap: wrap;
	-webkit-align-items: center;
	align-items: center;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	flex-direction: row;
	justify-content: flex-start;
}

.range-slider__range {
	background-color: rgba(0,0,0,.1);
	height: 5px;
	width: 67%;
	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 {
	width: 21%;
	height: 28px;
	text-align: center;
	margin-left: 2%;
	border-radius: 4px;
	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{
	width: 16px;
	height: 16px;
	font-size: 16px;
	line-height: 1;
}

.customize-control span.range-reset-slider {
	display: inline-block;
	position: relative;
	width: 6%;
	line-height: 1;
	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,
.customize-control-range-value .responsive-switchers{
	display: inline-block;
}

.responsive-switchers{
	display: inline-block;
	vertical-align: middle;
	margin-bottom: 5px;
}

.responsive-switchers .preview-tablet,
.responsive-switchers .preview-mobile{
	display: none;
}

.desktop-range,
.tablet-range,
.mobile-range{
	display: none;
	width:100%;
}

.desktop-range.active,
.tablet-range.active,
.mobile-range.active{
	display: block;
}

.customize-control .responsive-switchers { margin-left: 5px; width: auto; }
.customize-control .responsive-switchers-open li button { display: block; }
.customize-control .responsive-switchers li { float: left; margin: 0; }
.customize-control .responsive-switchers li button { height: 20px; width: 20px; background-color: #a4afb7; cursor: pointer; position: relative; margin-left: 5px; color: #fff; font-size: 10px; text-align: center; border-radius: 50%; padding: 0; border: 0; outline: none; -webkit-transition: background-color .5s; transition: background-color .5s; cursor: pointer; }
.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; }
custom-controls/range-value/script.js000066600000014002151143725270013777 0ustar00/**
 * Range control in customizer
 *
 * @package Hestia
 */

/* global wp */
/* global jQuery */
wp.customize.controlConstructor['range-value'] = wp.customize.Control.extend(
	{

		ready: function(){
			'use strict';

			jQuery.fn.exists = function(){return this.length > 0;};
			var control        = this,
			changeAction;
			var theme_controls = jQuery( '#customize-theme-controls' );

			function syncRangeText( slider, input, from ){
				switch (from) {
					case 'slider':
						var value = slider.val();
						var type  = jQuery( input ).attr( 'type' );
						if (type === 'text') { // inputBox
							if (value >= 0) {
								value = '+' + value;
							}
						}
						input.val( value );
						break;
					case 'input':
						slider.val( input.val() );
						break;
				}
			}

			function updateValues( control ){
				var collector    = control.find( '.range-collector' );
				var values       = getSliderValues( control );
				var have_queries = Object.keys( values ).length > 1;
				if ( have_queries ) {
					collector.val( JSON.stringify( values ) );
				} else {
					collector.val( values.desktop );
				}
				collector.trigger( 'change' );

			}

			function getSliderValues( control ) {
				var values          = {};
				var desktopSelector = control.find( '.range-slider__range[data-query="desktop"]' ),
				tabletSelector      = control.find( '.range-slider__range[data-query="tablet"]' ) ,
				mobileSelector      = control.find( '.range-slider__range[data-query="mobile"]' ),
				desktopValue, tabletValue, mobileValue;

				if ( desktopSelector.exists() ) {
					desktopValue = desktopSelector.val();
					if ( desktopValue !== 'undefined' && desktopValue !== '' ) {
						values.desktop = desktopValue;
					}
				}

				if ( tabletSelector.exists() ) {
					tabletValue = tabletSelector.val();
					if ( tabletValue !== 'undefined' && tabletValue !== '' ) {
						values.tablet = tabletValue;
					}
				}

				if ( mobileSelector.exists() ) {
					mobileValue = mobileSelector.val();
					if ( mobileValue !== 'undefined' && mobileValue !== '' ) {
						values.mobile = mobileValue;
					}
				}

				return values;
			}

			function responsiveSwitcher(){
				// Responsive switchers
				jQuery( '.customize-control .responsive-switchers button' ).on(
					'click', function( event ) {
						event.preventDefault();
						// Set up variables
						var $devices    = jQuery( '.responsive-switchers' ),
						$device         = jQuery( event.currentTarget ).data( 'device' ),
						$body           = jQuery( '.wp-full-overlay' ),
						$footer_devices = jQuery( '.wp-full-overlay-footer .devices' );

						// Button class
						$devices.find( 'button' ).removeClass( 'active' );
						$devices.find( 'button.preview-' + $device ).addClass( 'active' );

						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' );

						// 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 ).trigger('click');

					}
				);

				jQuery( '#customize-footer-actions .devices button' ).on(
					'click', function( event ) {
						event.preventDefault();
						var device  = jQuery( this ).data( 'device' );
						var queries = jQuery( '.responsive-switchers' );
						if( device !== 'desktop'){
                            queries.addClass( 'responsive-switchers-open' );
						} else {
                            queries.removeClass( 'responsive-switchers-open' );
						}

						queries.find( 'button' ).removeClass( 'active' );
						queries.find( 'button.preview-' + device ).addClass( 'active' );

						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' );
					}
				);
			}

			theme_controls.unbind().on(
				'click', '.preview-desktop.active', function () {
					jQuery( '.responsive-switchers' ).toggleClass( 'responsive-switchers-open' );
				}
			);

			theme_controls.on(
				'input', '.range-slider__range', function () {
					var slider  = jQuery( this );
					var input   = jQuery( this ).next();
					var control = jQuery( this ).parent().parent();
					syncRangeText( slider, input, 'slider' );
					updateValues( control );
				}
			);

			theme_controls.on(
				'keyup', '.range-slider-value', function(){
					var control = jQuery( this ).parent().parent();
					updateValues( control );
				}
			);
			theme_controls.on(
				'keydown', '.range-slider-value', function(){
					var slider = jQuery( this ).prev();
					var input  = jQuery( this );
					syncRangeText( slider, input, 'input' );
				}
			);

			theme_controls.on(
				'click', '.range-reset-slider', function (event) {
					event.preventDefault();
					var input        = jQuery( this ).prev();
					var slider       = input.prev();
					var control      = jQuery( this ).parent().parent();
					var defaultValue = slider.data( 'default' );
                    var type  = jQuery( input ).attr( 'type' );
                    if (type === 'text') { // inputBox
                        defaultValue = '+0';
                    }
					input.val( defaultValue );
					slider.val( defaultValue );
					updateValues( control );
				}
			);

			responsiveSwitcher();

			if ( 'postMessage' === control.setting.transport ) {
				changeAction = 'mousemove change';
			} else {
				changeAction = 'change';
			}

			// Change the value
			this.container.on(
				changeAction, '.range-collector', function() {
					control.setting.set( jQuery( this ).val() );
				}
			);
		}
	}
);
custom-controls/range-value/class-hestia-customizer-range-value-control.php000066600000021064151143725270023320 0ustar00<?php
/**
 * The range value customize control extends the WP_Customize_Control class.
 *
 * @package Hestia
 * @since Hestia 1.1.30
 * @author     Justin Tadlock <justin@justintadlock.com>
 * @copyright  Copyright (c) 2016, Soderlind
 * @link       https://github.com/soderlind/class-customizer-range-value-control/blob/master/README.md
 * @license    http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return;
}

/**
 * Class Customizer_Range_Value_Control
 *
 * @since 1.1.31
 * @modified 1.1.38
 * @access public
 */
class Hestia_Customizer_Range_Value_Control extends WP_Customize_Control {

	/**
	 * Control type
	 *
	 * @var string
	 */
	public $type = 'range-value';

	/**
	 * Flag that enables media queries
	 *
	 * @var bool
	 */
	public $media_query = false;

	/**
	 * Settings for range inputs.
	 *
	 * @var array|mixed
	 */
	public $input_attr = array();

	/**
	 * Add/remove from fixed value flag
	 *
	 * @var bool
	 */
	public $sum_type = false;

	/**
	 * Hestia_Customizer_Range_Value_Control constructor.
	 *
	 * @param WP_Customize_Manager $manager Customize manager.
	 * @param string               $id Control id.
	 * @param array                $args Control arguments.
	 */
	public function __construct( $manager, $id, $args = array() ) {
		parent::__construct( $manager, $id, $args );

		if ( ! empty( $args['media_query'] ) ) {
			$this->media_query = (bool) $args['media_query'];
		}

		if ( ! empty( $args['input_attr'] ) ) {
			$this->input_attr = $args['input_attr'];
		}

		if ( ! empty( $args['sum_type'] ) ) {
			$this->sum_type = $args['sum_type'];
		}
	}

	/**
	 * Enqueue scripts/styles.
	 *
	 * @since 1.1.31
	 * @modified 1.1.38
	 * @access public
	 */
	public function enqueue() {
		wp_enqueue_script(
			'customizer-range-value-control', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/range-value/script.js', array(
				'jquery',
				'customize-base',
			), HESTIA_VERSION, true
		);
		wp_enqueue_style( 'customizer-range-value-control', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/range-value/style.css', array(), HESTIA_VERSION );
	}

	/**
	 * Handles input value.
	 *
	 * @since 1.1.38
	 * @return array
	 */
	public function json() {
		$json = parent::json();

		$json['value'] = $this->value();

		$json['default_value'] = ! empty( $this->setting->default ) ? $this->setting->default : '0';

		$json['desktop_value'] = ! $this->is_json( $json['value'] ) ? $json['value'] : $json['default_value'];
		$json['tablet_value']  = $json['default_value'];
		$json['mobile_value']  = $json['default_value'];

		if ( $this->is_json( $json['value'] ) ) {
			$decoded_value         = json_decode( $json['value'], true );
			$json['desktop_value'] = $decoded_value['desktop'];
			$json['tablet_value']  = $decoded_value['tablet'];
			$json['mobile_value']  = $decoded_value['mobile'];
		} else {
			$json['desktop_value'] = $json['value'];
		}
		$json['sum_type']    = $this->sum_type;
		$json['media_query'] = $this->media_query;
		$json['link']        = $this->get_link();
		if ( ! $this->contains_array( $this->input_attr ) ) {
			$json['min']  = ! empty( $this->input_attr['min'] ) ? $this->input_attr['min'] : 0;
			$json['max']  = ! empty( $this->input_attr['max'] ) ? $this->input_attr['max'] : 1;
			$json['step'] = ! empty( $this->input_attr['step'] ) ? $this->input_attr['step'] : 1;
		} else {
			foreach ( $this->input_attr as $device => $value ) {
				$json[ $device ] = $value;
			}
		}

		return $json;
	}

	/**
	 * Check if an array contains another array.
	 *
	 * @since 1.1.53
	 *
	 * @param array $array Array to check.
	 *
	 * @return bool
	 */
	private function contains_array( $array ) {
		foreach ( $array as $value ) {
			if ( is_array( $value ) ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * Check if a string is in json format
	 *
	 * @param  string $string Input.
	 *
	 * @since 1.1.31
	 * @access public
	 * @return bool
	 */
	public function is_json( $string ) {
		return is_string( $string ) && is_array( json_decode( $string, true ) ) ? true : false;
	}

	/**
	 * Render the control's content.
	 *
	 * @since 1.1.31
	 * @modified 1.1.38
	 * @access public
	 */
	protected function content_template() {
		?>
		<# if ( data.label ) { #>
		<span class="customize-control-title">
				<span>{{{ data.label }}}</span>
				<# if ( data.description ) { #>
					<i class="dashicons dashicons-editor-help" style="vertical-align: text-bottom;"
							title="{{{ data.description }}}"></i>
				<# } #>
			</span>
		<# if ( data.media_query ) { #>
		<ul class="responsive-switchers">
			<li class="desktop">
				<button type="button" class="preview-desktop active" data-device="desktop">
					<i class="dashicons dashicons-desktop"></i>
				</button>
			</li>
			<li class="tablet">
				<button type="button" class="preview-tablet" data-device="tablet">
					<i class="dashicons dashicons-tablet"></i>
				</button>
			</li>
			<li class="mobile">
				<button type="button" class="preview-mobile" data-device="mobile">
					<i class="dashicons dashicons-smartphone"></i>
				</button>
			</li>
		</ul>
		<# } #>
		<# }
		var min, max, step, default_value;
		if( data.min ){
		min = data.min;
		}
		if( data.max ){
		max = data.max;
		}
		if( data.step ){
		step = data.step;
		}
		if( data.default_value ){
		default_value = data.default_value;
		}

		if( data.desktop ){
		if ( data.desktop.min ){
		min = data.desktop.min;
		}
		if ( data.desktop.max ){
		max = data.desktop.max;
		}
		if ( data.desktop.step ){
		step = data.desktop.step;
		}
		if ( data.desktop.default_value ){
		default_value = data.desktop.default_value;
		}
		}
		if( data.desktop_value ){
		value = data.desktop_value;
		} else {
		if( default_value ) {
		value = default_value;
		}
		}
		if( data.sum_type === true ){
		input_type = 'text';
		} else {
		input_type = 'number';
		}
		#>
		<div class="range-slider <# if ( data.media_query ) { #>has-media-queries<# }#>">
			<div class="desktop-range active">
				<input type="range" class="range-slider__range" title="{{{data.label}}}" min="{{min}}" max="{{max}}"
						step="{{step}}" data-query="desktop" data-default="{{default_value}}" value="{{ value }}">
				<input type="{{input_type}}" class="range-slider-value" title="{{{data.label}}}" min="{{min}}"
						max="{{max}}" step="{{step}}"
						value="<# if( data.sum_type === true && value >= 0 ){ #> +<# } #>{{ value }}">
				<span class="range-reset-slider"><span class="dashicons dashicons-image-rotate"></span></span>
			</div>
			<# if ( data.media_query ) {

			if( data.tablet ){
			if ( data.tablet.min ){
			min = data.tablet.min;
			}
			if ( data.tablet.max ){
			max = data.tablet.max;
			}
			if ( data.tablet.step ){
			step = data.tablet.step;
			}
			if ( data.tablet.default_value ){
			default_value = data.tablet.default_value;
			}
			}
			if( data.tablet_value ){
			value = data.tablet_value;
			} else {
			if( default_value ) {
			value = default_value;
			}
			}
			#>
			<div class="tablet-range">
				<input type="range" class="range-slider__range" title="{{{data.label}}}" min="{{min}}" max="{{max}}"
						step="{{step}}" data-query="tablet" data-default="{{default_value}}" value="{{ value }}">
				<input type="{{input_type}}" class="range-slider-value" title="{{{data.label}}}" min="{{min}}"
						max="{{max}}" step="{{step}}"
						value="<# if( data.sum_type === true && value >= 0 ){ #> +<# } #>{{ value }}">
				<span class="range-reset-slider"><span class="dashicons dashicons-image-rotate"></span></span>
			</div>
			<# if( data.mobile ){
			if ( data.mobile.min ){
			min = data.mobile.min;
			}
			if ( data.mobile.max ){
			max = data.mobile.max;
			}
			if ( data.mobile.step ){
			step = data.mobile.step;
			}
			if ( data.mobile.default_value ){
			default_value = data.mobile.default_value;
			}
			}
			if( data.mobile_value ){
			value = data.mobile_value;
			} else {
			if( default_value ) {
			value = default_value;
			}
			}#>
			<div class="mobile-range">
				<input type="range" class="range-slider__range" title="{{{data.label}}}" min="{{min}}" max="{{max}}"
						step="{{step}}" data-query="mobile" data-default="{{default_value}}" value="{{ value }}">
				<input type="{{input_type}}" class="range-slider-value" title="{{{data.label}}}" min="{{min}}"
						max="{{max}}" step="{{step}}"
						value="<# if( data.sum_type === true && value >= 0 ){ #> +<# } #>{{ value }}">
				<span class="range-reset-slider"><span class="dashicons dashicons-image-rotate"></span></span>
			</div>
			<# } #>
			<input type="hidden" class="range-collector" title="{{{data.label}}}" value="{{ data.value }}" {{{ data.link
					}}}>
		</div>
		<?php
	}
}
custom-controls/section-hiding/style.css000066600000001124151143725270014506 0ustar00.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
}
custom-controls/section-hiding/script.js000066600000011212151143725270014475 0ustar00/**
 * Scripts file for the Show/Hide frontpage control in customizer
 *
 * @package Hestia
 */

/* global jQuery */
/* global wp */

jQuery( window ).load(
	function() {
		'use strict';

        var controlValue;
		var subscribeSection = jQuery( '#accordion-section-sidebar-widgets-subscribe-widgets' );

        var subscribeSectionHide = wp.customize.control( 'hestia_subscribe_hide' );
        if ( typeof subscribeSectionHide !== 'undefined' ) {
            controlValue = subscribeSectionHide.setting.get();
        }
		var iconClass        = 'dashicons-visibility';
		if (controlValue === true) {
			iconClass = 'dashicons-hidden';
			subscribeSection.find( '.accordion-section-title' ).addClass( 'hestia-section-hidden' ).removeClass( 'hestia-section-visible' );
		} else {
			subscribeSection.find( '.accordion-section-title' ).addClass( 'hestia-section-visible' ).removeClass( 'hestia-section-hidden' );
		}
		subscribeSection.find( '.screen-reader-text' ).after( '<a data-control="hestia_subscribe_hide" class="alignright hestia-toggle-section" href="#"><span class="dashicons' + iconClass + '"></span></a>' );

		var toggleSection = jQuery( '.hestia-toggle-section' );
		/**
	 * Fix for icons when they are in changeset is active
	 */
		toggleSection.each(
			function(){
				var controlName  = jQuery( this ).data( 'control' );
                var controlValue;
				if ( typeof wp.customize.control( controlName ) !== 'undefined' ) {
                    controlValue = wp.customize.control( controlName ).setting.get();
                }
				var parentHeader = jQuery( this ).parent();
				if ( typeof(controlName) !== 'undefined' && controlName !== '' ) {
					var iconClass = 'dashicons-visibility';
					if (controlValue === true) {
						iconClass = 'dashicons-hidden';
						parentHeader.addClass( 'hestia-section-hidden' ).removeClass( 'hestia-section-visible' );
					} else {
						parentHeader.addClass( 'hestia-section-visible' ).removeClass( 'hestia-section-hidden' );
					}
					jQuery( this ).children().attr( 'class','dashicons ' + iconClass );
				}
			}
		);

		toggleSection.on(
			'click',function(e){
				e.stopPropagation();
				var controlName  = jQuery( this ).data( 'control' );
				var parentHeader = jQuery( this ).parent();
				var controlValue = wp.customize.control( controlName ).setting.get();
				if ( typeof(controlName) !== 'undefined' && controlName !== '' ) {
					var iconClass = 'dashicons-visibility';
					/* Compare with false because value already changed when triggered this function */
					if (controlValue === false) {
						iconClass = 'dashicons-hidden';
						parentHeader.addClass( 'hestia-section-hidden' ).removeClass( 'hestia-section-visible' );
					} else {
						parentHeader.addClass( 'hestia-section-visible' ).removeClass( 'hestia-section-hidden' );
					}
					wp.customize.control( controlName ).setting.set( ! controlValue );
					jQuery( this ).children().attr( 'class','dashicons ' + iconClass );
				}
			}
		);

		jQuery( 'ul' ).find( '[data-customize-setting-link]' ).on(
			'click',function(){
				var showHideControls = [
					'hestia_features_hide',
					'hestia_about_hide',
					'hestia_shop_hide',
					'hestia_portfolio_hide',
					'hestia_team_hide',
					'hestia_pricing_hide',
					'hestia_ribbon_hide',
					'hestia_testimonials_hide',
					'hestia_subscribe_hide',
					'hestia_clients_bar_hide',
					'hestia_blog_hide',
					'hestia_contact_hide'
				];
				var controlName  = jQuery( this ).data( 'customize-setting-link' );
				if( showHideControls.indexOf(controlName) <= -1){
					return;
				}
				var sectionName  = jQuery( this ).parent().parent().parent().attr( 'id' );
				sectionName      = sectionName.replace( 'sub-','' );
				var parentHeader = jQuery( '#' + sectionName ).find( '.accordion-section-title' );
				if ( typeof (sectionName) !== 'undefined' && sectionName !== '') {

					if( wp.customize.control( controlName ) && wp.customize.control(controlName).setting ) {
                        var controlValue = wp.customize.control(controlName).setting.get();

                        var iconClass = 'dashicons-visibility';
                        if (controlValue === false) {
                            iconClass = 'dashicons-hidden';
                            parentHeader.addClass('hestia-section-hidden').removeClass('hestia-section-visible');
                        } else {
                            parentHeader.addClass('hestia-section-visible');
                            parentHeader.removeClass('hestia-section-hidden');
                        }
                        parentHeader.find('.hestia-toggle-section').children().attr('class', 'dashicons ' + iconClass);
                    }
				}
			}
		);
	}
);
custom-controls/section-hiding/class-hestia-hiding-section.php000066600000007450151143725270020637 0ustar00<?php
/**
 * Class for sections that are hiding.
 *
 * @since 1.1.47
 * @package hestia
 */

/**
 * Class Hestia_Hiding_Section
 *
 * @since  1.1.49
 * @access public
 */
class Hestia_Hiding_Section extends WP_Customize_Section {

	/**
	 * The type of customize section being rendered.
	 *
	 * @since  1.1.47
	 * @access public
	 * @var    string
	 */
	public $type = 'hiding-section';

	/**
	 * Flag to display icon when entering in customizer
	 *
	 * @since  1.1.47
	 * @access public
	 * @var bool
	 */
	public $visible;

	/**
	 * Name of customizer hiding control.
	 *
	 * @since  1.1.47
	 * @access public
	 * @var bool
	 */
	public $hiding_control;

	/**
	 * Id of customizer hiding control.
	 *
	 * @since  1.1.82
	 * @access public
	 * @var integer
	 */
	public $id;


	/**
	 * Hestia_Hiding_Section constructor.
	 *
	 * @param WP_Customize_Manager $manager Customizer Manager.
	 * @param string               $id Control id.
	 * @param array                $args Arguments.
	 */
	public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
		parent::__construct( $manager, $id, $args );
		add_action( 'customize_controls_init', array( $this, 'enqueue' ) );

		if ( ! empty( $args['hiding_control'] ) ) {
			$this->visible = ! get_theme_mod( $args['hiding_control'] );
		}
	}

	/**
	 * Add custom parameters to pass to the JS via JSON.
	 *
	 * @since  1.1.47
	 * @access public
	 */
	public function json() {
		$json                   = parent::json();
		$json['visible']        = $this->visible;
		$json['hiding_control'] = $this->hiding_control;
		return $json;
	}


	/**
	 * Enqueue function.
	 *
	 * @since  1.1.47
	 * @access public
	 * @return void
	 */
	public function enqueue() {
		wp_enqueue_script( 'hestia-hiding-section', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/section-hiding/script.js', array( 'jquery' ), HESTIA_VERSION, true );
		wp_enqueue_style( 'hestia-hiding-section-style', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/section-hiding/style.css', array(), HESTIA_VERSION );
	}

	/**
	 * Outputs the Underscore.js template.
	 *
	 * @since  1.1.47
	 * @access public
	 * @return void
	 */
	protected function render_template() {
		?>
		<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }}">
			<h3 class="accordion-section-title <# if ( data.visible ) { #> hestia-section-visible <# } else { #> hestia-section-hidden <# }#>" tabindex="0">
				{{ data.title }}
				<# if ( data.visible ) { #>
					<a data-control="{{ data.hiding_control }}" class="hestia-toggle-section" href="#"><span class="dashicons dashicons-visibility"></span></a>
				<# } else { #>
					<a data-control="{{ data.hiding_control }}" class="hestia-toggle-section" href="#"><span class="dashicons dashicons-hidden"></span></a>
				<# } #>
			</h3>
			<ul class="accordion-section-content">
				<li class="customize-section-description-container section-meta <# if ( data.description_hidden ) { #>customize-info<# } #>">
					<div class="customize-section-title">
						<button class="customize-section-back" tabindex="-1">
						</button>
						<h3>
							<span class="customize-action">
								{{{ data.customizeAction }}}
							</span>
							{{ data.title }}
						</h3>
						<# if ( data.description && data.description_hidden ) { #>
							<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"></button>
							<div class="description customize-section-description">
								{{{ data.description }}}
							</div>
							<# } #>
					</div>

					<# if ( data.description && ! data.description_hidden ) { #>
						<div class="description customize-section-description">
							{{{ data.description }}}
						</div>
						<# } #>
				</li>
			</ul>
		</li>
		<?php
	}
}
custom-controls/multi-select/class-hestia-select-multiple.php000066600000005654151143725270020552 0ustar00<?php
/**
 * The multiple select customize control extends the WP_Customize_Control class.  This class allows
 * developers to create a `<select>` form field with the `multiple` attribute within the WordPress
 * theme customizer.
 *
 * @package    hestia
 * @author     Justin Tadlock <justin@justintadlock.com>
 */

/**
 * Multiple select customize control class.
 *
 * @since  1.1.40
 * @access public
 */
class Hestia_Select_Multiple extends WP_Customize_Control {
	/**
	 * The type of customize control being rendered.
	 *
	 * @since  1.1.40
	 * @access public
	 * @var    string
	 */
	public $type = 'select-multiple';

	/**
	 * Custom classes to apply on select.
	 *
	 * @since 1.1.40
	 * @access public
	 * @var string
	 */
	public $custom_class = '';

	/**
	 * Hestia_Select_Multiple constructor.
	 *
	 * @param WP_Customize_Manager $manager Customize manager object.
	 * @param string               $id Control id.
	 * @param array                $args Control arguments.
	 */
	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'] );
		}
	}

	/**
	 * Loads the framework scripts/styles.
	 *
	 * @since  1.1.40
	 * @access public
	 * @return void
	 */
	public function enqueue() {
		wp_enqueue_script( 'hestia-customizer-select-multiple', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/multi-select/script.js', array( 'jquery', 'customize-base' ), HESTIA_VERSION, true );

	}
	/**
	 * Add custom parameters to pass to the JS via JSON.
	 *
	 * @since  1.1.40
	 * @access public
	 * @return array
	 */
	public function json() {
		$json                 = parent::json();
		$json['choices']      = $this->choices;
		$json['link']         = $this->get_link();
		$json['value']        = (array) $this->value();
		$json['id']           = $this->id;
		$json['custom_class'] = $this->custom_class;

		return $json;
	}


	/**
	 * Underscore JS template to handle the control's output.
	 *
	 * @since  1.1.40
	 * @access public
	 * @return void
	 */
	public function content_template() {
		?>
		<#
		if ( ! data.choices ) {
			return;
		} #>

		<label>
			<# if ( data.label ) { #>
				<span class="customize-control-title">{{ data.label }}</span>
			<# } #>

			<# if ( data.description ) { #>
				<span class="description customize-control-description">{{{ data.description }}}</span>
			<# } #>

			<#
			var custom_class = ''
			if ( data.custom_class ) {
				custom_class = 'class='+data.custom_class
			} #>
			<select multiple="multiple" {{{ data.link }}} {{ custom_class }}>
				<# _.each( data.choices, function( label, choice ) {
					var selected = ( data.value.indexOf( choice.toString() ) !== -1 ) ? 'selected="selected"' : ''
					#>
					<option value="{{ choice }}" {{ selected }} >{{ label }}</option>
				<# } ) #>
			</select>
		</label>
		<?php
	}
}
custom-controls/multi-select/script.js000066600000001071151143725270014202 0ustar00/**
 * Multiple select control
 *
 * @package Hestia
 */

/* global jQuery */
/* global wp */
( function( $, api ) {
	'use strict';

	/* === Select Multiple Control === */
	api.controlConstructor['select-multiple'] = api.Control.extend(
		{
			ready: function() {
				var control = this;

				$( 'select', control.container ).change(
					function() {
						var value = $( this ).val();

						if ( null === value ) {
							control.setting.set( '' );
						} else {
							control.setting.set( value );
						}
					}
				);
			}
		}
	);

} )( jQuery, wp.customize );
custom-controls/font-selector/functions.php000066600000000113151143725270015232 0ustar00<?php
/**
 * Fonts functions
 *
 * @package hestia
 * @since 1.1.38
 */



custom-controls/font-selector/style.css000066600000003036151143725270014372 0ustar00#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-right: 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;
}custom-controls/font-selector/class-hestia-font-selector.php000066600000035665151143725270020410 0ustar00<?php
/**
 * Font selector.
 *
 * @package hestia
 * @since 1.1.38
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return;
}

/**
 * Class Hestia_Font_Selector
 */
class Hestia_Font_Selector extends WP_Customize_Control {
	/**
	 * The control type.
	 *
	 * @access public
	 * @var string
	 */
	public $type = 'selector-font';

	/**
	 * Enqueue control related scripts/styles.
	 *
	 * @access public
	 */
	public function enqueue() {
		wp_enqueue_script( 'hestia-select-script', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/font-selector/script.js', array( 'jquery' ), HESTIA_VERSION, true );
		wp_enqueue_style( 'hestia-select-style', get_template_directory_uri() . '/inc/customizer/controls/custom-controls/font-selector/style.css', null, HESTIA_VERSION );
	}

	/**
	 * Render the control's content.
	 * Allows the content to be overriden without having to rewrite the wrapper in $this->render().
	 *
	 * @access protected
	 */
	protected function render_content() {
		$std_fonts    = $this->get_standard_fonts();
		$google_fonts = $this->get_google_fonts();
		$value        = $this->value();
		?>
		<label>
			<?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; ?>
		</label>
		<div class="hestia-ss-wrap">
			<input class="hestia-fs-main-input" type="text"
					name="<?php echo esc_attr( $this->id ); ?>"
					value="<?php echo ( ! empty( $value ) ) ? esc_html( $value ) : __( 'Default', 'hestia' ); ?>"
					readonly>
			<span class="hestia-fs-input-addon"><i class="dashicons dashicons-arrow-down"></i></span>
			<div class="hestia-fs-dropdown">
				<span class="hestia-fs-search">
						<input type="search" placeholder="<?php echo _x( 'Search for:', 'label', 'hestia' ) . '...'; ?>">
				</span>
				<div class="hestia-fs-options-wrapper">
						<span class="hestia-fs-option"
								data-option="<?php esc_html_e( 'Default', 'hestia' ); ?>"><?php esc_html_e( 'Default', 'hestia' ); ?></span>
					<?php
					$this->render_dropdown_options_group( $std_fonts, esc_html__( 'Standard Fonts', 'hestia' ) );
					$this->render_dropdown_options_group( $google_fonts, esc_html__( 'Google Fonts', 'hestia' ) );
					?>
				</div>
			</div>
			<input type="hidden" class="hestia-ss-collector" <?php $this->link(); ?> >
		</div>
		<?php
	}

	/**
	 * Render the dropdown option group.
	 *
	 * @param array  $options Options in group.
	 *
	 * @param string $title Title of options group.
	 */
	protected function render_dropdown_options_group( $options, $title ) {
		if ( ! empty( $options ) ) {
			?>
			<span class="hestia-fs-options-group">
					<span class="hestia-fs-options-heading"><?php echo esc_html( $title ); ?></span>
				<?php foreach ( $options as $option ) { ?>
					<span class="hestia-fs-option"
							data-filter="<?php echo strtolower( esc_html( $option ) ); ?>"
							data-option="<?php echo esc_html( $option ); ?>"><?php echo esc_html( $option ); ?></span>
				<?php } ?>
				</span>
			<?php
		}
	}


	/**
	 * List of standard fonts
	 *
	 * @since 1.1.38
	 */
	function get_standard_fonts() {
		return apply_filters(
			'hestia_standard_fonts_array', array(
				'Arial, Helvetica, sans-serif',
				'Arial Black, Gadget, sans-serif',
				'Bookman Old Style, serif',
				'Comic Sans MS, cursive',
				'Courier, monospace',
				'Georgia, serif',
				'Garamond, serif',
				'Impact, Charcoal, sans-serif',
				'Lucida Console, Monaco, monospace',
				'Lucida Sans Unicode, Lucida Grande, sans-serif',
				'MS Sans Serif, Geneva, sans-serif',
				'MS Serif, New York, sans-serif',
				'Palatino Linotype, Book Antiqua, Palatino, serif',
				'Tahoma, Geneva, sans-serif',
				'Times New Roman, Times, serif',
				'Trebuchet MS, Helvetica, sans-serif',
				'Verdana, Geneva, sans-serif',
				'Paratina Linotype',
				'Trebuchet MS',
			)
		);
	}

	/**
	 * List of All Google fonts
	 *
	 * @since 1.1.38
	 */
	function get_google_fonts() {
		return apply_filters( 'hestia_google_fonts_array', array( 'ABeeZee', 'Abel', 'Abril Fatface', 'Aclonica', 'Acme', 'Actor', 'Adamina', 'Advent Pro', 'Aguafina Script', 'Akronim', 'Aladin', 'Aldrich', 'Alef', 'Alegreya', 'Alegreya SC', 'Alegreya Sans', 'Alegreya Sans SC', 'Alex Brush', 'Alfa Slab One', 'Alice', 'Alike', 'Alike Angular', 'Allan', 'Allerta', 'Allerta Stencil', 'Allura', 'Almendra', 'Almendra Display', 'Almendra SC', 'Amarante', 'Amaranth', 'Amatic SC', 'Amatica SC', 'Amethysta', 'Amiko', 'Amiri', 'Amita', 'Anaheim', 'Andada', 'Andika', 'Angkor', 'Annie Use Your Telescope', 'Anonymous Pro', 'Antic', 'Antic Didone', 'Antic Slab', 'Anton', 'Arapey', 'Arbutus', 'Arbutus Slab', 'Architects Daughter', 'Archivo Black', 'Archivo Narrow', 'Aref Ruqaa', 'Arima Madurai', 'Arimo', 'Arizonia', 'Armata', 'Artifika', 'Arvo', 'Arya', 'Asap', 'Asar', 'Asset', 'Assistant', 'Astloch', 'Asul', 'Athiti', 'Atma', 'Atomic Age', 'Aubrey', 'Audiowide', 'Autour One', 'Average', 'Average Sans', 'Averia Gruesa Libre', 'Averia Libre', 'Averia Sans Libre', 'Averia Serif Libre', 'Bad Script', 'Baloo', 'Baloo Bhai', 'Baloo Da', 'Baloo Thambi', 'Balthazar', 'Bangers', 'Basic', 'Battambang', 'Baumans', 'Bayon', 'Belgrano', 'Belleza', 'BenchNine', 'Bentham', 'Berkshire Swash', 'Bevan', 'Bigelow Rules', 'Bigshot One', 'Bilbo', 'Bilbo Swash Caps', 'BioRhyme', 'BioRhyme Expanded', 'Biryani', 'Bitter', 'Black Ops One', 'Bokor', 'Bonbon', 'Boogaloo', 'Bowlby One', 'Bowlby One SC', 'Brawler', 'Bree Serif', 'Bubblegum Sans', 'Bubbler One', 'Buda', 'Buenard', 'Bungee', 'Bungee Hairline', 'Bungee Inline', 'Bungee Outline', 'Bungee Shade', 'Butcherman', 'Butterfly Kids', 'Cabin', 'Cabin Condensed', 'Cabin Sketch', 'Caesar Dressing', 'Cagliostro', 'Cairo', 'Calligraffitti', 'Cambay', 'Cambo', 'Candal', 'Cantarell', 'Cantata One', 'Cantora One', 'Capriola', 'Cardo', 'Carme', 'Carrois Gothic', 'Carrois Gothic SC', 'Carter One', 'Catamaran', 'Caudex', 'Caveat', 'Caveat Brush', 'Cedarville Cursive', 'Ceviche One', 'Changa', 'Changa One', 'Chango', 'Chathura', 'Chau Philomene One', 'Chela One', 'Chelsea Market', 'Chenla', 'Cherry Cream Soda', 'Cherry Swash', 'Chewy', 'Chicle', 'Chivo', 'Chonburi', 'Cinzel', 'Cinzel Decorative', 'Clicker Script', 'Coda', 'Coda Caption', 'Codystar', 'Coiny', 'Combo', 'Comfortaa', 'Coming Soon', 'Concert One', 'Condiment', 'Content', 'Contrail One', 'Convergence', 'Cookie', 'Copse', 'Corben', 'Cormorant', 'Cormorant Garamond', 'Cormorant Infant', 'Cormorant SC', 'Cormorant Unicase', 'Cormorant Upright', 'Courgette', 'Cousine', 'Coustard', 'Covered By Your Grace', 'Crafty Girls', 'Creepster', 'Crete Round', 'Crimson Text', 'Croissant One', 'Crushed', 'Cuprum', 'Cutive', 'Cutive Mono', 'Damion', 'Dancing Script', 'Dangrek', 'David Libre', 'Dawning of a New Day', 'Days One', 'Dekko', 'Delius', 'Delius Swash Caps', 'Delius Unicase', 'Della Respira', 'Denk One', 'Devonshire', 'Dhurjati', 'Didact Gothic', 'Diplomata', 'Diplomata SC', 'Domine', 'Donegal One', 'Doppio One', 'Dorsa', 'Dosis', 'Dr Sugiyama', 'Droid Sans', 'Droid Sans Mono', 'Droid Serif', 'Duru Sans', 'Dynalight', 'EB Garamond', 'Eagle Lake', 'Eater', 'Economica', 'Eczar', 'Ek Mukta', 'El Messiri', 'Electrolize', 'Elsie', 'Elsie Swash Caps', 'Emblema One', 'Emilys Candy', 'Engagement', 'Englebert', 'Enriqueta', 'Erica One', 'Esteban', 'Euphoria Script', 'Ewert', 'Exo', 'Exo 2', 'Expletus Sans', 'Fanwood Text', 'Farsan', 'Fascinate', 'Fascinate Inline', 'Faster One', 'Fasthand', 'Fauna One', 'Federant', 'Federo', 'Felipa', 'Fenix', 'Finger Paint', 'Fira Mono', 'Fira Sans', 'Fjalla One', 'Fjord One', 'Flamenco', 'Flavors', 'Fondamento', 'Fontdiner Swanky', 'Forum', 'Francois One', 'Frank Ruhl Libre', 'Freckle Face', 'Fredericka the Great', 'Fredoka One', 'Freehand', 'Fresca', 'Frijole', 'Fruktur', 'Fugaz One', 'GFS Didot', 'GFS Neohellenic', 'Gabriela', 'Gafata', 'Galada', 'Galdeano', 'Galindo', 'Gentium Basic', 'Gentium Book Basic', 'Geo', 'Geostar', 'Geostar Fill', 'Germania One', 'Gidugu', 'Gilda Display', 'Give You Glory', 'Glass Antiqua', 'Glegoo', 'Gloria Hallelujah', 'Goblin One', 'Gochi Hand', 'Gorditas', 'Goudy Bookletter 1911', 'Graduate', 'Grand Hotel', 'Gravitas One', 'Great Vibes', 'Griffy', 'Gruppo', 'Gudea', 'Gurajada', 'Habibi', 'Halant', 'Hammersmith One', 'Hanalei', 'Hanalei Fill', 'Handlee', 'Hanuman', 'Happy Monkey', 'Harmattan', 'Headland One', 'Heebo', 'Henny Penny', 'Herr Von Muellerhoff', 'Hind', 'Hind Guntur', 'Hind Madurai', 'Hind Siliguri', 'Hind Vadodara', 'Holtwood One SC', 'Homemade Apple', 'Homenaje', 'IM Fell DW Pica', 'IM Fell DW Pica SC', 'IM Fell Double Pica', 'IM Fell Double Pica SC', 'IM Fell English', 'IM Fell English SC', 'IM Fell French Canon', 'IM Fell French Canon SC', 'IM Fell Great Primer', 'IM Fell Great Primer SC', 'Iceberg', 'Iceland', 'Imprima', 'Inconsolata', 'Inder', 'Indie Flower', 'Inika', 'Inknut Antiqua', 'Irish Grover', 'Istok Web', 'Italiana', 'Italianno', 'Itim', 'Jacques Francois', 'Jacques Francois Shadow', 'Jaldi', 'Jim Nightshade', 'Jockey One', 'Jolly Lodger', 'Jomhuria', 'Josefin Sans', 'Josefin Slab', 'Joti One', 'Judson', 'Julee', 'Julius Sans One', 'Junge', 'Jura', 'Just Another Hand', 'Just Me Again Down Here', 'Kadwa', 'Kalam', 'Kameron', 'Kanit', 'Kantumruy', 'Karla', 'Karma', 'Katibeh', 'Kaushan Script', 'Kavivanar', 'Kavoon', 'Kdam Thmor', 'Keania One', 'Kelly Slab', 'Kenia', 'Khand', 'Khmer', 'Khula', 'Kite One', 'Knewave', 'Kotta One', 'Koulen', 'Kranky', 'Kreon', 'Kristi', 'Krona One', 'Kumar One', 'Kumar One Outline', 'Kurale', 'La Belle Aurore', 'Laila', 'Lakki Reddy', 'Lalezar', 'Lancelot', 'Lateef', 'Lato', 'League Script', 'Leckerli One', 'Ledger', 'Lekton', 'Lemon', 'Lemonada', 'Libre Baskerville', 'Libre Franklin', 'Life Savers', 'Lilita One', 'Lily Script One', 'Limelight', 'Linden Hill', 'Lobster', 'Lobster Two', 'Londrina Outline', 'Londrina Shadow', 'Londrina Sketch', 'Londrina Solid', 'Lora', 'Love Ya Like A Sister', 'Loved by the King', 'Lovers Quarrel', 'Luckiest Guy', 'Lusitana', 'Lustria', 'Macondo', 'Macondo Swash Caps', 'Mada', 'Magra', 'Maiden Orange', 'Maitree', 'Mako', 'Mallanna', 'Mandali', 'Marcellus', 'Marcellus SC', 'Marck Script', 'Margarine', 'Marko One', 'Marmelad', 'Martel', 'Martel Sans', 'Marvel', 'Mate', 'Mate SC', 'Maven Pro', 'McLaren', 'Meddon', 'MedievalSharp', 'Medula One', 'Meera Inimai', 'Megrim', 'Meie Script', 'Merienda', 'Merienda One', 'Merriweather', 'Merriweather Sans', 'Metal', 'Metal Mania', 'Metamorphous', 'Metrophobic', 'Michroma', 'Milonga', 'Miltonian', 'Miltonian Tattoo', 'Miniver', 'Miriam Libre', 'Mirza', 'Miss Fajardose', 'Mitr', 'Modak', 'Modern Antiqua', 'Mogra', 'Molengo', 'Molle', 'Monda', 'Monofett', 'Monoton', 'Monsieur La Doulaise', 'Montaga', 'Montez', 'Montserrat', 'Montserrat Alternates', 'Montserrat Subrayada', 'Moul', 'Moulpali', 'Mountains of Christmas', 'Mouse Memoirs', 'Mr Bedfort', 'Mr Dafoe', 'Mr De Haviland', 'Mrs Saint Delafield', 'Mrs Sheppards', 'Mukta Vaani', 'Muli', 'Mystery Quest', 'NTR', 'Neucha', 'Neuton', 'New Rocker', 'News Cycle', 'Niconne', 'Nixie One', 'Nobile', 'Nokora', 'Norican', 'Nosifer', 'Nothing You Could Do', 'Noticia Text', 'Noto Sans', 'Noto Serif', 'Nova Cut', 'Nova Flat', 'Nova Mono', 'Nova Oval', 'Nova Round', 'Nova Script', 'Nova Slim', 'Nova Square', 'Numans', 'Nunito', 'Odor Mean Chey', 'Offside', 'Old Standard TT', 'Oldenburg', 'Oleo Script', 'Oleo Script Swash Caps', 'Open Sans', 'Open Sans Condensed', 'Oranienbaum', 'Orbitron', 'Oregano', 'Orienta', 'Original Surfer', 'Oswald', 'Over the Rainbow', 'Overlock', 'Overlock SC', 'Ovo', 'Oxygen', 'Oxygen Mono', 'PT Mono', 'PT Sans', 'PT Sans Caption', 'PT Sans Narrow', 'PT Serif', 'PT Serif Caption', 'Pacifico', 'Palanquin', 'Palanquin Dark', 'Paprika', 'Parisienne', 'Passero One', 'Passion One', 'Pathway Gothic One', 'Patrick Hand', 'Patrick Hand SC', 'Pattaya', 'Patua One', 'Pavanam', 'Paytone One', 'Peddana', 'Peralta', 'Permanent Marker', 'Petit Formal Script', 'Petrona', 'Philosopher', 'Piedra', 'Pinyon Script', 'Pirata One', 'Plaster', 'Play', 'Playball', 'Playfair Display', 'Playfair Display SC', 'Podkova', 'Poiret One', 'Poller One', 'Poly', 'Pompiere', 'Pontano Sans', 'Poppins', 'Port Lligat Sans', 'Port Lligat Slab', 'Pragati Narrow', 'Prata', 'Preahvihear', 'Press Start 2P', 'Pridi', 'Princess Sofia', 'Prociono', 'Prompt', 'Prosto One', 'Proza Libre', 'Puritan', 'Purple Purse', 'Quando', 'Quantico', 'Quattrocento', 'Quattrocento Sans', 'Questrial', 'Quicksand', 'Quintessential', 'Qwigley', 'Racing Sans One', 'Radley', 'Rajdhani', 'Rakkas', 'Raleway', 'Raleway Dots', 'Ramabhadra', 'Ramaraja', 'Rambla', 'Rammetto One', 'Ranchers', 'Rancho', 'Ranga', 'Rasa', 'Rationale', 'Ravi Prakash', 'Redressed', 'Reem Kufi', 'Reenie Beanie', 'Revalia', 'Rhodium Libre', 'Ribeye', 'Ribeye Marrow', 'Righteous', 'Risque', 'Roboto', 'Roboto Condensed', 'Roboto Mono', 'Roboto Slab', 'Rochester', 'Rock Salt', 'Rokkitt', 'Romanesco', 'Ropa Sans', 'Rosario', 'Rosarivo', 'Rouge Script', 'Rozha One', 'Rubik', 'Rubik Mono One', 'Rubik One', 'Ruda', 'Rufina', 'Ruge Boogie', 'Ruluko', 'Rum Raisin', 'Ruslan Display', 'Russo One', 'Ruthie', 'Rye', 'Sacramento', 'Sahitya', 'Sail', 'Salsa', 'Sanchez', 'Sancreek', 'Sansita One', 'Sarala', 'Sarina', 'Sarpanch', 'Satisfy', 'Scada', 'Scheherazade', 'Schoolbell', 'Scope One', 'Seaweed Script', 'Secular One', 'Sevillana', 'Seymour One', 'Shadows Into Light', 'Shadows Into Light Two', 'Shanti', 'Share', 'Share Tech', 'Share Tech Mono', 'Shojumaru', 'Short Stack', 'Shrikhand', 'Siemreap', 'Sigmar One', 'Signika', 'Signika Negative', 'Simonetta', 'Sintony', 'Sirin Stencil', 'Six Caps', 'Skranji', 'Slabo 13px', 'Slabo 27px', 'Slackey', 'Smokum', 'Smythe', 'Sniglet', 'Snippet', 'Snowburst One', 'Sofadi One', 'Sofia', 'Sonsie One', 'Sorts Mill Goudy', 'Source Code Pro', 'Source Sans Pro', 'Source Serif Pro', 'Space Mono', 'Special Elite', 'Spicy Rice', 'Spinnaker', 'Spirax', 'Squada One', 'Sree Krushnadevaraya', 'Sriracha', 'Stalemate', 'Stalinist One', 'Stardos Stencil', 'Stint Ultra Condensed', 'Stint Ultra Expanded', 'Stoke', 'Strait', 'Sue Ellen Francisco', 'Suez One', 'Sumana', 'Sunshiney', 'Supermercado One', 'Sura', 'Suranna', 'Suravaram', 'Suwannaphum', 'Swanky and Moo Moo', 'Syncopate', 'Tangerine', 'Taprom', 'Tauri', 'Taviraj', 'Teko', 'Telex', 'Tenali Ramakrishna', 'Tenor Sans', 'Text Me One', 'The Girl Next Door', 'Tienne', 'Tillana', 'Timmana', 'Tinos', 'Titan One', 'Titillium Web', 'Trade Winds', 'Trirong', 'Trocchi', 'Trochut', 'Trykker', 'Tulpen One', 'Ubuntu', 'Ubuntu Condensed', 'Ubuntu Mono', 'Ultra', 'Uncial Antiqua', 'Underdog', 'Unica One', 'UnifrakturCook', 'UnifrakturMaguntia', 'Unkempt', 'Unlock', 'Unna', 'VT323', 'Vampiro One', 'Varela', 'Varela Round', 'Vast Shadow', 'Vesper Libre', 'Vibur', 'Vidaloka', 'Viga', 'Voces', 'Volkhov', 'Vollkorn', 'Voltaire', 'Waiting for the Sunrise', 'Wallpoet', 'Walter Turncoat', 'Warnes', 'Wellfleet', 'Wendy One', 'Wire One', 'Work Sans', 'Yanone Kaffeesatz', 'Yantramanav', 'Yatra One', 'Yellowtail', 'Yeseva One', 'Yesteryear', 'Yrsa', 'Zeyada' ) );
	}

}
custom-controls/font-selector/script.js000066600000003722151143725270014364 0ustar00/**
 * Customizer font selector control.
 *
 * @package Hestia
 */
(function ( $ ) {
	'use strict';
	wp.hestiaSelect = {
		init: function () {
			var self = this;

			$( '.hestia-fs-main-input, .hestia-fs-input-addon' ).on(
				'click', function ( e ) {
					$( this ).parent().toggleClass( 'active' );
					$( '.hestia-ss-wrap.active .hestia-fs-search input' ).focus();
					e.stopPropagation();
					return false;
				}
			);

			$( '.hestia-fs-option' ).on(
				'click', function () {
					var value = $( this ).data( 'option' );
					var mainInput = $( '.hestia-ss-wrap.active input.hestia-fs-main-input' );
					var collector = $( '.hestia-ss-wrap.active .hestia-ss-collector' );
					$( '.hestia-ss-wrap.active' ).removeClass( 'active' );
					mainInput.val( value );
					if ( value === 'Default' ) {
						value = '';
					}
					collector.val( value );
					collector.trigger( 'change' );
					return false;
				}
			);

			$( '.hestia-fs-search input' ).on(
				'keyup', function () {
					self.search( $( this ) );
					return false;
				}
			);

			$( document ).mouseup(
				function ( e ) {
					var container = $( '.hestia-ss-wrap.active .hestia-fs-dropdown' );
					if ( !container.is( e.target ) && container.has( e.target ).length === 0 ) {
						$( '.hestia-ss-wrap.active' ).removeClass( 'active' );
					}
				}
			);
		},

		search: function ( $searchInput ) {
			var itemsList = jQuery( '.hestia-ss-wrap.active .hestia-fs-options-wrapper' );
			var searchTerm = $searchInput.val().toLowerCase();
			if ( searchTerm.length > 0 ) {
				itemsList.children().children( '.hestia-fs-option' ).each(
					function () {
						if ( $( this ).filter( '[data-filter*='.concat( searchTerm ).concat( ']' ) ).length > 0 || searchTerm.length < 1 ) {
							$( this ).show();
						} else {
							$( this ).hide();
						}
					}
				);
			} else {
				itemsList.children().children().show();
			}
		}
	};

	$( document ).ready(
		function () {
			wp.hestiaSelect.init();
		}
	);
})( jQuery );
ui/class-hestia-section-docs.php000066600000003174151143725270012662 0ustar00<?php
/**
 * Documentation link in main customizer.
 *
 * @package Hestia
 */

/**
 * Class Hestia_Section_Docs
 *
 * @since  1.0.0
 * @access public
 */
class Hestia_Section_Docs extends WP_Customize_Section {

	/**
	 * The type of customize section being rendered.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $type = 'hestia-section-docs';

	/**
	 * Upsell title to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $theme_info_title = '';

	/**
	 * Label text to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $label_text = '';

	/**
	 * Label URL.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $label_url = '';

	/**
	 * Add custom parameters to pass to the JS via JSON.
	 *
	 * @since  1.0.0
	 * @access public
	 */
	public function json() {
		$json = parent::json();

		$json['theme_info_title'] = $this->theme_info_title;
		$json['label_text']       = $this->label_text;
		$json['label_url']        = esc_url( $this->label_url );

		return $json;
	}

	/**
	 * Outputs the Underscore.js template.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	protected function render_template() {
		?>

		<li id="accordion-section-{{ data.id }}"
			class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
			<h3 class="accordion-section-title">
				{{data.theme_info_title}}
				<# if ( data.label_text && data.label_url ) { #>
				<a class="button button-secondary alignright" href="{{data.label_url}}" target="_blank">
					{{data.label_text}}
				</a>
				<# } #>
			</h3>
		</li>
		<?php
	}
}
ui/class-hestia-contact-info.php000066600000002775151143725270012662 0ustar00<?php
/**
 * A custom text control for Contact info.
 *
 * @package Hestia
 * @since Hestia 1.1.10
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return null;
}

/**
 * A custom text control for Contact info.
 *
 * @since Hestia 1.0
 */
class Hestia_Contact_Info extends WP_Customize_Control {

	/**
	 * Enqueue function.
	 */
	public function enqueue() {
		Hestia_Plugin_Install_Helper::instance()->enqueue_scripts();
	}

	/**
	 * Render content for the control.
	 *
	 * @since Hestia 1.0
	 */
	public function render_content() {
		if ( defined( 'PIRATE_FORMS_VERSION' ) ) {
			printf(
				/* translators: %s is Path in plugin wrapped */
				esc_html__( 'You should be able to see the form on your front-page. You can configure settings from %s, in your WordPress dashboard.', 'hestia' ),
				/* translators: %s is Path in plugin*/
				sprintf( '<a href="%s" target="_blank">%s</a>', admin_url( 'admin.php?page=pirateforms-admin' ), esc_html__( 'Settings > Pirate Forms', 'hestia' ) )
			);
		} else {
			printf(
				/* translators: %1$s is Plugin name */
				esc_html__( 'In order to add a contact form to this section, you need to install the %s plugin.', 'hestia' ),
				esc_html( 'Pirate Forms' )
			);
			echo $this->create_plugin_install_button( 'pirate-forms' );
		}
	}

	/**
	 * Create plugin install button.
	 *
	 * @param string $slug plugin slug.
	 *
	 * @return bool
	 */
	public function create_plugin_install_button( $slug ) {
		return Hestia_Plugin_Install_Helper::instance()->get_button_html( $slug );
	}
}
ui/customizer-scroll/class-hestia-customizer-scroll-ui.php000066600000003006151143725270020075 0ustar00<?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
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return;
}

/**
 * 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_controls_init', array( $this, 'enqueue' ) );
		add_action( 'customize_preview_init', array( $this, 'helper_script_enqueue' ) );
	}

	/**
	 * The priority of the control.
	 *
	 * @since 1.1.45
	 * @var   string
	 */
	public $priority = 0;

	/**
	 * Loads the customizer script.
	 *
	 * @since  1.1.45
	 * @access public
	 * @return void
	 */
	public function enqueue() {
		wp_enqueue_script( 'hestia-scroller-script', get_template_directory_uri() . '/inc/customizer/controls/ui/customizer-scroll/script.js', array( 'jquery' ), HESTIA_VERSION, true );
	}

	/**
	 * 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 );
	}
}
ui/customizer-scroll/script.js000066600000001266151143725270012543 0ustar00/**
 * Script for the customizer auto scrolling.
 *
 * Sends the section name to the preview.
 *
 * @since    1.1.50
 * @package Hestia
 *
 * @author    ThemeIsle
 */

/* global wp */

var hestia_customize_scroller = function ( $ ) {
	'use strict';

	$(
		function () {
				var customize = wp.customize;

				$( 'ul[id*="hestia_frontpage_sections"] .accordion-section' ).not( '.panel-meta' ).each(
					function () {
						$( this ).on(
							'click', function() {
								var section = $( this ).attr( 'aria-owns' ).split( '_' ).pop();
								customize.previewer.send( 'clicked-customizer-section', section );
							}
						);
					}
				);
		}
	);
};

hestia_customize_scroller( jQuery );
ui/customizer-scroll/helper-script.js000066600000002245151143725270014016 0ustar00/**
 * Script fort the customizer sections scroll function.
 *
 * @since    1.1.43
 * @package Hestia
 *
 * @author    ThemeIsle
 */

/* global wp */

var hestia_customizer_section_scroll = function ( $ ) {
	'use strict';
	$(
		function () {
				var customize = wp.customize;

				customize.preview.bind(
					'clicked-customizer-section', function( data ) {
						var sectionId = '';
						switch (data) {
							case 'shop':
								sectionId = 'section#products';
							break;
							case 'ribbon':
								sectionId = 'section.hestia-ribbon';
							break;
							case 'sub-accordion-section-sidebar-widgets-subscribe-widgets':
								sectionId = 'section#subscribe';
							break;
							case 'bar':
								sectionId = 'section.hestia-clients-bar';
							break;
							case 'slider':
								sectionId = '#carousel-hestia-generic.carousel.slide';
							break;
							default:
								sectionId = 'section#' + data;
							break;
						}
						if ( $( sectionId ).length > 0) {
							$( 'html, body' ).animate(
								{
									scrollTop: $( sectionId ).offset().top - 100
								}, 1000
							);
						}
					}
				);
		}
	);
};

hestia_customizer_section_scroll( jQuery );
ui/class-hestia-section-upsell.php000066600000005471151143725270013240 0ustar00<?php
/**
 * The upsell for the front page sections
 *
 * Pro customizer section.
 *
 * @package Hestia
 */

/**
 * Class Themeisle_Section_Upsell
 */
class Hestia_Section_Upsell extends WP_Customize_Section {

	/**
	 * The type of customize section being rendered.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $type = 'hestia-section-upsell';

	/**
	 * Upsell text to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $upsell_text = '';

	/**
	 * Button text to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $button_text = '';

	/**
	 * Button link to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $button_url = '';

	/**
	 * List of theme options to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    array
	 */
	public $options = array();

	/**
	 * List of additional explanations to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    array
	 */
	public $explained_features = array();


	/**
	 * Label text to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	private $pro_label;

	/**
	 * Hestia_Customizer_Theme_Info_Section constructor.
	 */
	public function __construct( WP_Customize_Manager $manager, $id, array $args ) {
		parent::__construct( $manager, $id, $args );
		$this->pro_label       = esc_html__( 'PRO', 'hestia' );
		$this->active_callback = true;
	}

	/**
	 * Add custom parameters to pass to the JS via JSON.
	 *
	 * @since  1.0.0
	 * @access public
	 */
	public function json() {
		$json                       = parent::json();
		$json['button_text']        = esc_html( $this->button_text );
		$json['button_url']         = esc_url( $this->button_url );
		$json['options']            = $this->options;
		$json['explained_features'] = $this->explained_features;
		$json['pro_label']          = esc_html( $this->pro_label );

		return $json;
	}

	/**
	 * Outputs the Underscore.js template.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	protected function render_template() {
		?>
		<div class="themeisle-upsell themeisle-boxed-section">
			<# if ( data.options.length > 0 ) { #>
			<ul class="themeisle-upsell-features">
				<# for (option in data.options) { #>
				<li><span class="upsell-pro-label">{{ data.pro_label }}</span>{{ data.options[option] }}
				</li>
				<# } #>
			</ul>
			<# } #>

			<# if ( data.button_text && data.button_url ) { #>
			<a target="_blank" href="{{ data.button_url }}" class="button button-primary" target="_blank">{{
				data.button_text }}</a>
			<# } #>

			<# if ( data.explained_features.length > 0 ) { #>
			<hr>
			<ul class="themeisle-upsell-feature-list">
				<# for (feature in data.explained_features) { #>
				<li>* {{ data.explained_features[feature] }}</li>
				<# } #>
			</ul>
			<# } #>
		</div>
		<?php
	}
}
ui/helper-plugin-install/class-hestia-plugin-install-helper.php000066600000012010151143725270020713 0ustar00<?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 '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 '';
		}

		$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' ) . '</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' ) . '</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' ) . '</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
	 */
	private function check_plugin_state( $slug ) {

		$plugin_link_suffix = self::get_plugin_path( $slug );

		if ( file_exists( 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/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' )
		);
	}
}
ui/helper-plugin-install/script.js000066600000007302151143725270013257 0ustar00/**
 * 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();
	}
);ui/class-hestia-main-notice-section.php000066600000007301151143725270014131 0ustar00<?php
/**
 * ThemeIsle Customizer Notification Section Class.
 *
 * @package Hestia
 */

/**
 * Themeisle_Customizer_Notify_Section class
 */
class Hestia_Main_Notice_Section extends Hestia_Generic_Notice_Section {
	/**
	 * The type of customize section being rendered.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $type = 'main-customizer-notice';

	/**
	 * The plugin information requested from plugins api.
	 *
	 * @var array
	 */
	private $plugin_info;

	/**
	 * Slug of recommended plugin.
	 *
	 * @var string
	 */
	public $slug;

	/**
	 * Control options.
	 *
	 * Ex: redirect link after install
	 *
	 * @var array
	 */
	public $options = array();

	/**
	 * Hestia_Main_Notice_Section constructor.
	 *
	 * @param WP_Customize_Manager $manager The customizer object.
	 * @param string               $id The control id.
	 * @param array                $args The control args.
	 */
	public function __construct( $manager, $id, $args = array() ) {
		parent::__construct( $manager, $id, $args );
		if ( empty( $this->slug ) ) {
			return;
		}
		$this->plugin_info = $this->call_plugin_api( $this->slug );
	}

	/**
	 * Call plugin API to get plugins info
	 *
	 * @param plugin-slug $slug The plugin slug.
	 *
	 * @return mixed
	 */
	private function call_plugin_api( $slug ) {
		if ( empty( $slug ) ) {
			return;
		}
		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
		$call_api = get_transient( 'ti_cust_notify_plugin_info_' . $slug );
		if ( false === $call_api ) {
			$call_api = plugins_api(
				'plugin_information', array(
					'slug'   => $slug,
					'fields' => array(
						'downloaded'        => false,
						'rating'            => false,
						'description'       => false,
						'short_description' => true,
						'donate_link'       => false,
						'tags'              => false,
						'sections'          => false,
						'homepage'          => false,
						'added'             => false,
						'last_updated'      => false,
						'compatibility'     => false,
						'tested'            => false,
						'requires'          => false,
						'downloadlink'      => false,
						'icons'             => false,
					),
				)
			);
			set_transient( 'ti_cust_notify_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
		}

		return $call_api;
	}

	/**
	 * Add custom parameters to pass to the JS via JSON.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return array
	 */
	public function json() {
		$json                          = parent::json();
		$json['name']                  = $this->plugin_info->name;
		$json['description']           = $this->description;
		$json['plugin_install_button'] = $this->create_plugin_install_button( $this->slug, $this->options );
		$json['hide_notice']           = $this->hide_notice;

		return $json;

	}

	/**
	 * Outputs the structure for the customizer control
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	protected function render_template() {
		?>
		<# if ( ! data.hide_notice ) { #>
		<li id="accordion-section-{{ data.id }}"
				class="hestia-notice control-section-{{ data.type }} cannot-expand" style="margin-bottom: 1px;">
			<# if ( data.title ) { #>
			<h3 class="accordion-section-title">
				{{{ data.title }}}
			</h3>
			<# } #>
			<div class="notice notice-info" style="position: relative; margin-top:0; margin-bottom: 1px;">
				<button type="button" class="notice-dismiss" style="z-index: 1;"></button>
				<# if ( data.name ) { #>
				<h3 style="padding-right: 36px">
					{{{data.name}}}
				</h3>

				<# } #>
				<# if( data.description ) { #>
				<p>
					{{{ data.description }}}
				</p>
				<# } #>
				<# if ( data.plugin_install_button ) { #>
				{{{data.plugin_install_button}}}
				<# } #>
			</div>
		</li>
		<# } #>
		<?php
	}
}
ui/class-hestia-control-upsell.php000066600000004672151143725270013256 0ustar00<?php
/**
 *  Hestia Upsell Theme Info Class
 *
 * @package Hestia
 */

/**
 * Hestia_Control_Upsell_Theme_Info class.
 */
class Hestia_Control_Upsell extends WP_Customize_Control {

	/**
	 * Control type
	 *
	 * @var string control type
	 */
	public $type = 'hestia-control-upsell';

	/**
	 * Button text
	 *
	 * @var string button text
	 */
	public $button_text = '';

	/**
	 * Button link
	 *
	 * @var string button url
	 */
	public $button_url = '';

	/**
	 * List of features
	 *
	 * @var array theme features / options
	 */
	public $options = array();

	/**
	 * List of explanations
	 *
	 * @var array additional info
	 */
	public $explained_features = array();

	/**
	 * Label text for each feature
	 *
	 * @var string|void label text
	 */
	public $pro_label = '';

	/**
	 * Hestia_Control_Upsell_Theme_Info constructor.
	 *
	 * @param WP_Customize_Manager $manager the customize manager class.
	 * @param string               $id id.
	 * @param array                $args customizer manager parameters.
	 */
	public function __construct( WP_Customize_Manager $manager, $id, array $args ) {
		parent::__construct( $manager, $id, $args );
		$this->button_text;
		$this->pro_label = esc_html__( 'PRO', 'hestia' );
	}

	/**
	 * Json conversion
	 */
	public function to_json() {
		parent::to_json();
		$this->json['button_text']        = $this->button_text;
		$this->json['button_url']         = $this->button_url;
		$this->json['options']            = $this->options;
		$this->json['explained_features'] = $this->explained_features;
		$this->json['pro_label']          = $this->pro_label;
	}

	/**
	 * Render upsell content.
	 */
	public function render_content() {

	}

	/**
	 * Control content
	 */
	public function content_template() {
		?>
		<div class="themeisle-upsell">
			<# if ( data.options ) { #>
			<ul class="themeisle-upsell-features">
				<# for (option in data.options) { #>
				<li><span class="upsell-pro-label">{{ data.pro_label }}</span>{{ data.options[option] }}
				</li>
				<# } #>
			</ul>
			<# } #>

			<# if ( data.button_text && data.button_url ) { #>
			<a target="_blank" href="{{ data.button_url }}" class="button button-primary" target="_blank">{{
				data.button_text }}</a>
			<# } #>
			<hr>

			<# if ( data.explained_features ) { #>
			<ul class="themeisle-upsell-feature-list">
				<# for (requirement in data.explained_features) { #>
				<li>* {{ data.explained_features[requirement] }}</li>
				<# } #>
			</ul>
			<# } #>
		</div>
		<?php
	}
}
ui/class-hestia-button.php000066600000002677151143725270011612 0ustar00<?php
/**
 * Customizer functionality for the Blog settings panel.
 *
 * @package Hestia
 * @since Hestia 1.1.10
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return null;
}

/**
 * A customizer control to display text in customizer.
 *
 * @since Hestia 1.1.42
 */
class Hestia_Button extends WP_Customize_Control {


	/**
	 * Control id
	 *
	 * @var string $id Control id.
	 */
	public $id = '';

	/**
	 * Button class.
	 *
	 * @var mixed|string
	 */
	public $button_class = '';

	/**
	 * Icon class.
	 *
	 * @var mixed|string
	 */
	public $icon_class = '';

	/**
	 * Button text.
	 *
	 * @var mixed|string
	 */
	public $button_text = '';

	/**
	 * Hestia_Button 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 Hestia 1.1.42
	 */
	public function render_content() {
		if ( ! empty( $this->button_text ) ) {
			echo '<button type="button" class="button menu-shortcut ' . esc_attr( $this->button_class ) . '" tabindex="0">';
			if ( ! empty( $this->button_class ) ) {
				echo '<i class="fa ' . esc_attr( $this->icon_class ) . '" style="margin-right: 10px"></i>';
			}
				echo esc_html( $this->button_text );
			echo '</button>';
		}
	}
}
ui/class-hestia-customizer-heading.php000066600000001504151143725270014064 0ustar00<?php
/**
 * Customizer Control: Hestia_Customizer_Heading.
 *
 * @since 1.1.56
 * @package hestia
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Heading control
 */
class Hestia_Customizer_Heading extends WP_Customize_Control {

	/**
	 * The control type.
	 *
	 * @access public
	 * @var string
	 */
	public $type = 'hestia-heading';

	/**
	 * An Underscore (JS) template for this control's content (but not its container).
	 *
	 * Class variables for this control class are available in the `data` JS object;
	 * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
	 *
	 * @see WP_Customize_Control::print_template()
	 *
	 * @access protected
	 */
	protected function content_template() {
		?>
		<h4 class="hestia-customizer-heading">{{{ data.label }}}</h4>
		<?php
	}
}
ui/class-hestia-pagebuilder-button.php000066600000012665151143725270014071 0ustar00<?php
/**
 * This class allows developers to display a button in customizer that links to Elementor live edit if the page
 * that is set as frontpage was previously edited with Elementor. This control replace the text editor control
 * if the page was edited with Elementor.
 *
 * @package Hestia
 */

/**
 * Class Hestia_Elementor_Edit
 *
 * @since  1.1.60
 * @access public
 */
class Hestia_PageBuilder_Button extends WP_Customize_Control {

	/**
	 * The type of customize control being rendered.
	 *
	 * @since  1.1.60
	 * @access public
	 * @var    string
	 */
	public $type = 'page-builder-button';

	/**
	 * The post id of the page that is set as frontpage.
	 *
	 * @since  1.1.60
	 * @access public
	 * @var    string
	 */
	public $pid = '';

	/**
	 * Page Builder pugin
	 *
	 * @since  1.1.63
	 * @access public
	 * @var    string
	 */
	public $page_builder = array();

	/**
	 * Hestia_Elementor_Edit constructor.
	 *
	 * @param WP_Customize_Manager $manager Customize manager object.
	 * @param string               $id Control id.
	 * @param array                $args Control arguments.
	 */
	public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
		parent::__construct( $manager, $id, $args );

		$frontpage_id = get_option( 'page_on_front' );
		if ( ! empty( $frontpage_id ) ) {

			if ( ! empty( $frontpage_id ) ) {
				$this->pid = $frontpage_id;
			}

			$page_edited_with_elementor = false;
			$page_edited_with_beaver    = false;
			$page_edited_with_wpbakery  = false;
			$page_edited_with_so        = false;
			$page_edited_with_divi      = false;

			/**
			 * Elementor and Beaver builder mark if the page was edited with its editors in post meta so we'll have to
			 * check if plugins exists and the page was edited with page builder.
			 */
			$post_meta = ! empty( $frontpage_id ) ? get_post_meta( $frontpage_id ) : '';
			if ( ! empty( $post_meta ) ) {
				$page_edited_with_elementor = ! empty( $post_meta['_elementor_edit_mode'] ) && $post_meta['_elementor_edit_mode'][0] === 'builder' && class_exists( 'Elementor\Plugin' );
				$page_edited_with_beaver    = ! empty( $post_meta['_fl_builder_enabled'] ) && $post_meta['_fl_builder_enabled'][0] === '1' && class_exists( 'FLBuilder' );
				$page_edited_with_so        = ! empty( $post_meta['panels_data'] ) && class_exists( 'SiteOrigin_Panels' );
				$page_edited_with_divi      = ! empty( $post_meta['_et_pb_use_builder'] ) && $post_meta['_et_pb_use_builder'][0] === 'on' && class_exists( 'ET_Builder_Plugin' );
			}

			/**
			 * WP Bakery (former Visual Composer) doesn't store a flag in meta data to say whether or not the page
			 * is edited with it so we have to check post content if it contains shortcodes from plugin.
			 */
			$post_content = get_post_field( 'post_content', $frontpage_id );
			if ( ! empty( $post_content ) ) {
				$page_edited_with_wpbakery = class_exists( 'Vc_Manager' ) && strpos( $post_content, '[vc_' ) !== false;
			}

			$this->page_builder = array(
				'elementor'  => (bool) $page_edited_with_elementor,
				'beaver'     => (bool) $page_edited_with_beaver,
				'wpbakery'   => (bool) $page_edited_with_wpbakery,
				'siteorigin' => (bool) $page_edited_with_so,
				'divi'       => (bool) $page_edited_with_divi,
			);
		}
	}

	/**
	 * Enqueue scripts/styles.
	 *
	 * @since  1.1.60
	 * @access public
	 * @return void
	 */
	public function enqueue() {
	}

	/**
	 * Add custom parameters to pass to the JS via JSON.
	 *
	 * @since  1.1.60
	 * @access public
	 * @return array
	 */
	public function json() {
		$json = parent::json();
		foreach ( $this->page_builder as $builder_name => $builder_value ) {
			if ( $builder_value === true ) {
				switch ( $builder_name ) {
					case 'elementor':
						$json['edit_link']['elementor'] = \Elementor\Utils::get_edit_link( $this->pid );
						break;
					case 'beaver':
						$json['edit_link']['beaver'] = FLBuilderModel::get_edit_url( $this->pid );
						break;
					case 'wpbakery':
						$json['edit_link']['wpbakery'] = Vc_Frontend_Editor::getInlineUrl( '', $this->pid );
						break;
					case 'siteorigin':
						$json['edit_link']['siteorigin'] = add_query_arg( 'so_live_editor', 1, get_edit_post_link( $this->pid ) );
						break;
					case 'divi':
						$json['edit_link']['divi'] = add_query_arg( 'et_fb', 1, get_permalink( $this->pid ) );
						break;
				}
			}
		}
		return $json;
	}

	/**
	 * Don't render the content via PHP.  This control is handled with a JS template.
	 *
	 * @since  1.1.60
	 * @access public
	 * @return void
	 */
	protected function render_content() {}

	/**
	 * Underscore JS template to handle the control's output.
	 *
	 * @since  1.1.60
	 * @access public
	 * @return void
	 */
	public function content_template() {
		?>

		<label>
			<# if ( data.label ) { #>
				<span class="customize-control-title">{{ data.label }}</span>
				<# } #>

					<# if ( data.description ) { #>
						<span class="description customize-control-description">{{ data.description }}</span>
						<# } #>

							<# if( data.edit_link ){ #>
								<# _.each(data.edit_link, function(v, k) { #>
									<!-- wp-playlist-caption class is added to not add customize changeset to this link -->
									<a href="{{{v}}}" class="wp-playlist-caption"><div id="{{k}}-editor-button" class="button button-primary">
											<# if( k === 'elementor') {#>
												<i class="eicon-elementor" aria-hidden="true"></i>
												<# } #>
													Edit with {{k}}
										</div></a>
									<# }) #>
										<# } #>

		</label>
		<?php
	}
}
ui/customizer-tabs/class-hestia-customize-control-tabs.php000066600000005435151143725270020054 0ustar00<?php
/**
 * The tabs customize control extends the WP_Customize_Control class. This class allows
 * developers to create tabs and hide the sections' settings easily.
 *
 * @package    Hestia
 * @since      1.1.45
 * @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
 */


/**
 * Radio image customize control.
 *
 * @since  1.1.45
 * @access public
 */
class Hestia_Customize_Control_Tabs extends WP_Customize_Control {

	/**
	 * The type of customize control being rendered.
	 *
	 * @since 1.1.45
	 * @var   string
	 */
	public $type = 'interface-tabs';

	/**
	 * The tabs with keys of the controls that are under each tab.
	 *
	 * @since 1.1.45
	 * @var array
	 */
	public $tabs;

	/**
	 * Controls from tabs.
	 *
	 * @var array
	 */
	public $controls;


	/**
	 * Hestia_Customize_Control_Tabs constructor.
	 *
	 * @param WP_Customize_Manager $manager wp_customize manager.
	 * @param string               $id      control id.
	 * @param array                $args    public parameters for control.
	 */
	public function __construct( $manager, $id, $args = array() ) {
		parent::__construct( $manager, $id, $args );
	}

	/**
	 * Enqueue styles and scripts.
	 */
	public function enqueue() {
		wp_enqueue_style( 'hestia-tabs-control-style', get_template_directory_uri() . '/inc/customizer/controls/ui/customizer-tabs/style.css', null, HESTIA_VERSION );
		wp_enqueue_script( 'hestia-tabs-control-script', get_template_directory_uri() . '/inc/customizer/controls/ui/customizer-tabs/script.js', array( 'jquery' ), HESTIA_VERSION, true );
	}

	/**
	 * Add custom JSON parameters to use in the JS template.
	 *
	 * @return array
	 */
	public function json() {
		$json             = parent::json();
		$json['tabs']     = $this->tabs;
		$json['controls'] = $this->controls;
		return $json;
	}

	/**
	 * Underscore JS template to handle the control's output.
	 *
	 * @return void
	 */
	public function content_template() {
		?>
		<# if ( ! data.tabs ) { return; } #>

		<div class="hestia-tabs-control" id="">
		<# var i = 1;
			for( tab in data.tabs) { #>
				<#
				var allControlsInTabs = ''
				_.each( data.controls[tab], function( val, key ) {
					allControlsInTabs+= key + ' '
					if(val){
						var allvals = Object.keys(val).map(function(e) {
							return val[e]
						});
						allvals = _.uniq(_.flatten(allvals))
						allvals = allvals.join(' ')
						allControlsInTabs += allvals
					}
				});
				#>
			<div class="hestia-customizer-tab <# if( i === 1 ){#> active <#}#>" data-tab="{{tab}}">
				<label class="{{allControlsInTabs}}">
					<i class="fa fa-{{data.tabs[tab]['icon']}}"></i>
					{{data.tabs[tab]['label']}}
				</label>
			</div>
		<# i++;} #>
		</div>


		<?php
	}
}

ui/customizer-tabs/script.js000066600000014345151143725270012200 0ustar00/**
 * Script for the customizer tabs control interactions.
 *
 * @since    1.1.43
 * @package Hestia
 *
 * @author    ThemeIsle
 */

/* global wp */


wp.customize.controlConstructor['interface-tabs'] = wp.customize.Control.extend({
	ready: function() {

        // Switch tab based on customizer partial edit links.
        wp.customize.previewer.bind(
            'tab-previewer-edit', function( data ) {
                jQuery( data.selector ).trigger( 'click' );
            }
        );

        wp.customize.previewer.bind(
            'focus-control',  function( data ) {
                /**
                 * This timeout is here because in firefox this happens before customizer animation of changing panels.
                 * After it change panels with the input focused, the customizer was moved to right 12px. We have to make sure
                 * that the customizer animation of changing panels in customizer is done before focusing the input.
                 */
                setTimeout( function(){
                    var control = wp.customize.control(data);
                    if( typeof control !== 'undefined'){
                        wp.customize.control(data).focus();
                    }
                } , 100 );
            }
        );

        wp.customize.previewer.bind(
			'focus-section',  function( data ) {
					/**
					  * This timeout is here because in firefox this happens before customizer animation of changing panels.
					  * After it change panels with the input focused, the customizer was moved to right 12px. We have to make sure
					  * that the customizer animation of changing panels in customizer is done before focusing the input.
					  */
						setTimeout( function(){
								wp.customize.section(data).focus();
							} , 100 );
				}
		);

        wp.customize.previewer.bind( 'ready', function () {
			var parts = window.location.search.substr(1).split('&');
			var $_GET = {};
			for (var i = 0; i < parts.length; i++) {
				var temp = parts[i].split('=');
				$_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
			}

			if( typeof $_GET['autofocus[control]'] !== 'undefined' && $_GET['autofocus[control]'] !== ''){
                jQuery( 'li[id^="customize-control-widget"] ,#customize-control-sidebars_widgets-sidebar-big-title, #customize-control-sidebars_widgets-sidebar-top-bar, #customize-control-sidebars_widgets-subscribe-widgets' ).live(
                    'DOMNodeInserted', function () {
                        jQuery('.hestia-customizer-tab > label.' + $_GET['autofocus[control]']).trigger('click');
                    });
			}
        } );

        this.init();
		this.handleClick();
    },

	init: function () {
		var control = this;
		var section = control.section();

        wp.customize.bind('ready',function () {
			control.hideAllControls(section);
			var tab = Object.keys(control.params.controls)[0];
			var controlsToShow = control.params.controls[tab];
			var allControls = [];
			for (var controlName in controlsToShow ){
				if( controlsToShow.hasOwnProperty(controlName)) {
                    if (jQuery.isEmptyObject(controlsToShow[controlName]) === false &&
                        typeof wp.customize.control(controlName) !== 'undefined') {
                        var subTabValue = wp.customize.control(controlName).setting._value;
                        allControls = allControls.concat(controlsToShow[controlName][subTabValue]);
                    }
                    allControls.push(controlName);
                }
			}
            control.showControls(allControls, section);
			var once = 0;
			jQuery( 'li[id^="customize-control-widget"] ,#customize-control-sidebars_widgets-sidebar-big-title, #customize-control-sidebars_widgets-sidebar-top-bar, #customize-control-sidebars_widgets-subscribe-widgets' ).live(
				'DOMNodeInserted', function (e) {
					if ( once > 0 ){
						return false;
					}
					if( typeof e.currentTarget.previousSibling === 'undefined' ) {
						return false;
					}

					if( jQuery(e.currentTarget.previousSibling).hasClass( 'widget-rendered' ) ) {
						return false;
					}

					control.showControls(allControls, section);
					once = 1;
            });
        });

    },

	hideAllControls: function ( section ) {
        var controls = wp.customize.section(section).controls();
        var tabControl = this.id;
        for( var i in controls ){
			var controlId = controls[i].id;
			if( controlId === 'widgets' ){
                var sectionContainer = wp.customize.section(section).container;
                jQuery( sectionContainer ).children( 'li[class*="widget"]' ).css( 'display', 'none' );
			} else {
				if( controlId !== tabControl ){
					var selector = wp.customize.control(controlId).selector;
					jQuery(selector).hide();
				}
			}
		}
    },

    handleClick: function () {
		var control = this;
        var section = control.section();
        var container = control.container;
		jQuery(container).find('.hestia-customizer-tab').on( 'click', function () {
            jQuery( this ).parent().find('.hestia-customizer-tab').removeClass('active');
            jQuery( this ).addClass('active');
			control.hideAllControls(section);
			var tab = jQuery(this).data('tab');
			var controlsToShow = control.params.controls[tab];
			var allControls = [];
			for (var controlName in controlsToShow ){
				if( jQuery.isEmptyObject(controlsToShow[controlName]) === false &&
				    typeof wp.customize.control(controlName) !== 'undefined' ){
					var subTabValue = wp.customize.control(controlName).setting._value;
					allControls = allControls.concat(controlsToShow[controlName][subTabValue]);
				}
				allControls.push(controlName);
			}
			control.showControls(allControls, section);
        } );
    },

    showControls: function (controls, section) {
		for(var i in controls ){
			var controlName = controls[i];
			if( controlName === 'widgets' ) {
                var sectionContainer = wp.customize.section(section).container;
                jQuery( sectionContainer ).children( 'li[class*="widget"]' ).css( 'display', 'list-item' );
            } else {
				if( typeof wp.customize.control(controlName) !== 'undefined' ) {
                    var selector = wp.customize.control(controlName).selector;
                    jQuery(selector).show();
                }
			}
		}
    }
});ui/customizer-tabs/style.css000066600000002250151143725270012200 0ustar00.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;
}

.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;
}
ui/class-hestia-generic-notice-section.php000066600000005011151143725270014615 0ustar00<?php
/**
 * Customizer info main class.
 *
 * @package Hestia
 * @since Hestia 1.0
 */

/**
 * Pro customizer section.
 *
 * @since  1.0.0
 * @access public
 */
class Hestia_Generic_Notice_Section extends WP_Customize_Section {

	/**
	 * The type of customize section being rendered.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $type = 'customizer-notice';

	/**
	 * Label text to output.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $section_text = '';

	/**
	 * Plugin slug for which to create install button.
	 *
	 * @since  1.0.0
	 * @access public
	 * @var    string
	 */
	public $slug = '';

	/**
	 * Hide notice.
	 *
	 * @since  1.1.34
	 * @access public
	 * @var    string
	 */
	public $hide_notice = false;

	/**
	 * Screen reader text on dismiss button.
	 *
	 * @since  1.1.34
	 * @access public
	 * @var    string
	 */
	public $button_screenreader = '';

	/**
	 * Control options.
	 *
	 * Ex: redirect link after install
	 *
	 * @var array
	 */
	public $options = array();

	/**
	 * Enqueue function.
	 */
	public function enqueue() {
		Hestia_Plugin_Install_Helper::instance()->enqueue_scripts();
	}

	/**
	 * Add custom parameters to pass to the JS via JSON.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return array
	 */
	public function json() {
		$json                          = parent::json();
		$json['section_text']          = $this->section_text;
		$json['hide_notice']           = $this->hide_notice;
		$json['plugin_install_button'] = $this->create_plugin_install_button( $this->slug, $this->options );

		return $json;
	}

	/**
	 * Outputs the Underscore.js template.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	protected function render_template() {
		?>
		<# if ( !data.hide_notice ) { #>
		<li id="accordion-section-{{ data.id }}"
				class="hestia-notice accordion-section control-section control-section-{{ data.type }} cannot-expand">
			<button type="button" class="notice-dismiss" style="z-index: 1;"></button>
			<h4 class="accordion-section-title" style="padding-right: 36px">
				<# if ( data.section_text ) { #>
				{{{data.section_text}}}
				<# } #>
				<# if ( data.plugin_install_button ) { #>
				{{{data.plugin_install_button}}}
				<# } #>
			</h4>

		</li>
		<# } #>
		<?php
	}

	/**
	 * Check plugin state.
	 *
	 * @param string $slug plugin slug.
	 *
	 * @return bool
	 */
	public function create_plugin_install_button( $slug, $settings = array() ) {
		return Hestia_Plugin_Install_Helper::instance()->get_button_html( $slug, $settings );
	}
}
ui/subscribe-info/class-hestia-subscribe-info.php000066600000010115151143725270016105 0ustar00<?php
/**
 * Customizer functionality for the Blog settings panel.
 *
 * @package Hestia
 * @since Hestia 1.1.10
 */

if ( ! class_exists( 'WP_Customize_Control' ) ) {
	return null;
}

/**
 * A custom text control for Subscribe info.
 *
 * @since Hestia 1.0
 */
class Hestia_Subscribe_Info extends WP_Customize_Control {

	/**
	 * Control id
	 *
	 * @var string $id Control id.
	 */
	public $id = '';

	/**
	 * Check plugin state.
	 *
	 * @var string $state Plugin state.
	 */
	private $state = '';

	/**
	 * Plugin you want to install;
	 *
	 * @var string $plugin Plugin slug.
	 */
	public $plugin = 'mailin';

	/**
	 * Plugin path.
	 *
	 * @var string $path Plugin path.
	 */
	public $path = 'mailin/sendinblue.php';

	/**
	 * Hestia_Subscribe_Info 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->state = $this->check_plugin_state();
		$this->id    = $id;
	}

	/**
	 * Check plugin state.
	 *
	 * @return string
	 */
	private function check_plugin_state() {
		if ( file_exists( ABSPATH . 'wp-content/plugins/' . $this->path ) ) {
			include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
			if ( is_plugin_active( $this->path ) ) {
				return $this->check_activation();
			}
			return 'activate';
		}
		return 'install';
	}

	/**
	 * This method check if user registered his account for SIB.
	 *
	 * @return string
	 */
	public function check_activation() {
		if ( ! class_exists( 'SIB_Manager' ) ) {
			return 'install';
		}
		if ( SIB_Manager::is_done_validation() == true ) {
			return 'configure';
		}
		return 'create_account';
	}

	/**
	 * Enqueue function
	 */
	public function enqueue() {
		if ( $this->state === 'activate' || $this->state === 'install' ) {
			Hestia_Plugin_Install_Helper::instance()->enqueue_scripts();
		}
	}

	/**
	 * Render content for the control.
	 *
	 * @since Hestia 1.0
	 */
	public function render_content() {

		$text           = '';
		$display_button = false;
		$sib_account    = false;

		if ( $this->state === 'install' || $this->state === 'activate' ) {
			$text           = esc_html__( 'Here is where you must add the "SendinBlue Newsletter" widget. But first, you will need to install SendinBlue plugin.', 'hestia' );
			$display_button = true;
			$sib_account    = false;
		}

		if ( $this->state === 'create_account' ) {
			$text = sprintf(
				/* translators: %s Path in plugin wrapped*/
				esc_html__( 'After installing the plugin, you need to navigate to %s and configure the plugin.', 'hestia' ),
				sprintf(
					/* translators: %s Path in plugin*/
						'<a target="_blank" href="' . admin_url( 'admin.php?page=sib_page_home' ) . '"><b>%s</b></a>',
					esc_html__( 'Sendinblue > Home', 'hestia' )
				)
			);
			$display_button = false;
			$sib_account    = true;
		}

		if ( $this->state === 'configure' ) {
			$text           = sprintf(
				esc_html__( 'Here is where you must add the "SendinBlue Newsletter" widget.', 'hestia' ) . ' %s',
				sprintf(
					'<a target="_blank" href="https://docs.themeisle.com/article/879-how-to-integrate-sendinblue-wordpress-plugin-to-your-website">%s</a>',
					esc_html__( 'Read full documentation', 'hestia' )
				)
			);
			$display_button = false;
			$sib_account    = false;
		}

		if ( ! empty( $text ) ) {
			echo wp_kses_post( $text );
		}

		if ( $display_button === true ) {
			echo $this->create_plugin_install_button( $this->plugin, array( 'redirect' => admin_url( 'customize.php' ) . '?autofocus[control]=' . $this->id ) );
		}

		if ( $sib_account === true ) {
			echo '<br/>';
			echo '<a target="_blank" href="http://bit.ly/sibcwp" class="button" style="margin-top: 8px">' . esc_html( 'Create SendinBlue Account', 'hestia-pro' ) . '</a>';
		}
	}


	/**
	 * Check plugin state.
	 *
	 * @param string $slug slug.
	 *
	 * @return bool
	 */
	public function create_plugin_install_button( $slug, $settings = array() ) {
		return Hestia_Plugin_Install_Helper::instance()->get_button_html( $slug, $settings );
	}
}