| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/customizer.tar |
controls/custom-controls/radio-image/class-hestia-customize-control-radio-image.php 0000666 00000012371 15112345375 0024721 0 ustar 00 <?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
}
}
controls/custom-controls/radio-image/script.js 0000666 00000010334 15112345375 0015615 0 ustar 00 jQuery( 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();
} ); controls/custom-controls/radio-image/style.css 0000666 00000004276 15112345375 0015635 0 ustar 00 .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;
} controls/custom-controls/customizer-page-editor/class-hestia-customizer-page-editor-helper.php 0000666 00000015663 15112345375 0027157 0 ustar 00 <?php
/**
* Page editor helper class.
*
* @package Hestia
* @since Hestia 1.1.3
*/
/**
* Class Hestia_Customizer_Page_Editor_Helper
*/
class Hestia_Customizer_Page_Editor_Helper extends Hestia_Abstract_Main {
/**
* Initialize Customizer Page Editor Helper.
*/
public function init() {
add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_editor' ), 1 );
add_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' );
}
}
controls/custom-controls/customizer-page-editor/class-hestia-page-editor.php 0000666 00000005206 15112345375 0023470 0 ustar 00 <?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
}
}
controls/custom-controls/customizer-page-editor/js/hestia-text-editor.js 0000666 00000007406 15112345375 0022702 0 ustar 00 /**
* Text editor
*
* @package Hestia
*/
/* global tinyMCE */
/* global wp */
/* exported WPEditorWidget */
var WPEditorWidget = {
/**
* Current content id
*
* @var string Current content id.
*/
contentId: '',
/**
* Z index for Overlay
*
* @var int Z index for Overlay.
*/
wpFullOverlayOriginalZIndex: 0,
/**
* Visible or not
*
* @var bool Visible or not.
*/
isVisible: false,
init: function ( contentId ) {
this.contentId = contentId;
return this;
},
run: function ( editorWidget ) {
editorWidget.toggleEditor();
editorWidget.updateTinyMCE();
editorWidget.updateWPEditor();
},
/**
* Show/Hide editor
*/
toggleEditor: function(){
if ( this.isVisible === true ) {
this.hideEditor();
} else {
this.showEditor( this.contentId );
}
},
/**
* Show the editor
*
* @param contentId
*/
showEditor: function(contentId) {
this.isVisible = true;
var overlay = jQuery( '.wp-full-overlay' );
jQuery( 'body.wp-customizer #wp-editor-widget-container' ).fadeIn( 100 ).animate( {'bottom':'0'} );
this.wpFullOverlayOriginalZIndex = parseInt( overlay.css( 'zIndex' ) );
overlay.css( { zIndex: 49000 } );
this.setEditorContent( contentId );
},
/**
* Hide editor
*/
hideEditor: function() {
this.isVisible = false;
jQuery( 'body.wp-customizer #wp-editor-widget-container' ).animate( {'bottom':'-650px'} ).fadeOut();
jQuery( '.wp-full-overlay' ).css( { zIndex: this.wpFullOverlayOriginalZIndex } );
},
/**
* Set editor content
*/
setEditorContent: function(contentId) {
var editor = tinyMCE.get( 'wpeditorwidget' );
var content = jQuery( '#' + contentId ).val();
if (typeof editor === 'object' && editor !== null) {
editor.setContent( content );
}
jQuery( '#wpeditorwidget' ).val( content );
},
updateTinyMCE: function () {
var editor = tinyMCE.get( 'wpeditorwidget' );
var th = this;
if( typeof editor !== 'undefined' && editor) {
editor.on('NodeChange KeyUp', function () {
th.doUpdate(editor);
});
}
},
updateWPEditor: function () {
var editorWidget = document.getElementById( 'wpeditorwidget' );
var th = this;
jQuery(editorWidget).on('keyup', function () {
var newContent = this.value;
var contentField = jQuery( '#' + th.contentId );
contentField.val(newContent);
contentField.trigger('change');
});
},
doUpdate: function ( editor ) {
var content = editor.getContent();
var contentField = jQuery( '#' + this.contentId );
contentField.val( content );
contentField.trigger('change');
}
};
jQuery( window ).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();
}
);
});
controls/custom-controls/customizer-page-editor/js/hestia-update-controls.js 0000666 00000006063 15112345375 0023553 0 ustar 00 /**
* 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 );
controls/custom-controls/customizer-page-editor/css/hestia-page-editor.css 0000666 00000002771 15112345375 0023162 0 ustar 00 /*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;}
controls/custom-controls/repeater/icon-picker/icon-picker.css 0000666 00000004457 15112345375 0020535 0 ustar 00 .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} controls/custom-controls/repeater/icon-picker/icon-picker.js 0000666 00000003647 15112345375 0020361 0 ustar 00 /**
* 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 );
controls/custom-controls/repeater/icon-picker/icons.php 0000666 00000015131 15112345375 0017433 0 ustar 00 <?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 -->
controls/custom-controls/repeater/class-hestia-repeater.php 0000666 00000073442 15112345375 0020313 0 ustar 00 <?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
}
}
}
controls/custom-controls/repeater/script.js 0000666 00000037673 15112345375 0015265 0 ustar 00 /**
* Customizer repeater
*
* @package Hestia
*/
/* global jQuery */
/* global wp */
function media_upload(button_class) {
'use strict';
jQuery( 'body' ).on(
'click', button_class, function () {
var button_id = '#' + jQuery( this ).attr( 'id' );
var display_field = jQuery( this ).parent().children( 'input:text' );
var _custom_media = true;
wp.media.editor.send.attachment = function (props, attachment) {
if (_custom_media) {
if (typeof display_field !== 'undefined') {
switch (props.size) {
case 'full':
display_field.val( attachment.sizes.full.url );
display_field.trigger( 'change' );
break;
case 'medium':
display_field.val( attachment.sizes.medium.url );
display_field.trigger( 'change' );
break;
case 'thumbnail':
display_field.val( attachment.sizes.thumbnail.url );
display_field.trigger( 'change' );
break;
default:
display_field.val( attachment.url );
display_field.trigger( 'change' );
}
}
_custom_media = false;
} else {
return wp.media.editor.send.attachment( button_id, [props, attachment] );
}
};
wp.media.editor.open( button_class );
return false;
}
);
}
/********************************************
* ** Generate unique id ***
*********************************************/
function customizer_repeater_uniqid(prefix, more_entropy) {
'use strict';
if (typeof prefix === 'undefined') {
prefix = '';
}
var retId;
var php_js;
var formatSeed = function (seed, reqWidth) {
seed = parseInt( seed, 10 )
.toString( 16 ); // to hex str
if (reqWidth < seed.length) { // so long we split
return seed.slice( seed.length - reqWidth );
}
if (reqWidth > seed.length) { // so short we pad
return new Array( 1 + (reqWidth - seed.length) )
.join( '0' ) + seed;
}
return seed;
};
// BEGIN REDUNDANT
if ( ! php_js) {
php_js = {};
}
// END REDUNDANT
if ( ! php_js.uniqidSeed) { // init seed with big random int
php_js.uniqidSeed = Math.floor( Math.random() * 0x75bcd15 );
}
php_js.uniqidSeed++;
retId = prefix; // start with prefix, add current milliseconds hex string
retId += formatSeed(
parseInt(
new Date()
.getTime() / 1000, 10
), 8
);
retId += formatSeed( php_js.uniqidSeed, 5 ); // add seed hex string
if (more_entropy) {
// for more entropy we add a float lower to 10
retId += (Math.random() * 10)
.toFixed( 8 )
.toString();
}
return retId;
}
/********************************************
* ** General Repeater ***
*********************************************/
function customizer_repeater_refresh_social_icons(th) {
'use strict';
var icons_repeater_values = [];
th.find( '.customizer-repeater-social-repeater-container' ).each(
function () {
var icon = jQuery( this ).find( '.icp' ).val();
var link = jQuery( this ).find( '.customizer-repeater-social-repeater-link' ).val();
var id = jQuery( this ).find( '.customizer-repeater-social-repeater-id' ).val();
if ( ! id) {
id = 'customizer-repeater-social-repeater-' + customizer_repeater_uniqid();
jQuery( this ).find( '.customizer-repeater-social-repeater-id' ).val( id );
}
if (icon !== '' && link !== '') {
icons_repeater_values.push(
{
'icon': icon,
'link': link,
'id': id
}
);
}
}
);
th.find( '.social-repeater-socials-repeater-colector' ).val( JSON.stringify( icons_repeater_values ) );
customizer_repeater_refresh_general_control_values();
}
function customizer_repeater_refresh_general_control_values() {
'use strict';
jQuery( '.customizer-repeater-general-control-repeater' ).each(
function () {
var values = [];
var th = jQuery( this );
th.find( '.customizer-repeater-general-control-repeater-container' ).each(
function () {
var icon_value = jQuery( this ).find( '.icp' ).val();
var text = jQuery( this ).find( '.customizer-repeater-text-control' ).val();
var link = jQuery( this ).find( '.customizer-repeater-link-control' ).val();
var text2 = jQuery( this ).find( '.customizer-repeater-text2-control' ).val();
var link2 = jQuery( this ).find( '.customizer-repeater-link2-control' ).val();
var color = jQuery( this ).find( 'input.customizer-repeater-color-control' ).val();
var color2 = jQuery( this ).find( 'input.customizer-repeater-color2-control' ).val();
var image_url = jQuery( this ).find( '.custom-media-url' ).val();
var choice = jQuery( this ).find( '.customizer-repeater-image-choice' ).val();
var title = jQuery( this ).find( '.customizer-repeater-title-control' ).val();
var subtitle = jQuery( this ).find( '.customizer-repeater-subtitle-control' ).val();
var id = jQuery( this ).find( '.social-repeater-box-id' ).val();
if ( ! id) {
id = 'social-repeater-' + customizer_repeater_uniqid();
jQuery( this ).find( '.social-repeater-box-id' ).val( id );
}
var social_repeater = jQuery( this ).find( '.social-repeater-socials-repeater-colector' ).val();
var shortcode = jQuery( this ).find( '.customizer-repeater-shortcode-control' ).val();
if (text !== '' || image_url !== '' || title !== '' || subtitle !== '' || icon_value !== '' || link !== '' || choice !== '' || social_repeater !== '' || shortcode !== '' || color !== '') {
values.push(
{
'icon_value': (choice === 'customizer_repeater_none' ? '' : icon_value),
'color': color,
'color2': color2,
'text': escapeHtml( text ),
'link': link,
'text2': escapeHtml( text2 ),
'link2': link2,
'image_url': (choice === 'customizer_repeater_none' ? '' : image_url),
'choice': choice,
'title': escapeHtml( title ),
'subtitle': escapeHtml( subtitle ),
'social_repeater': escapeHtml( social_repeater ),
'id': id,
'shortcode': escapeHtml( shortcode )
}
);
}
}
);
th.find( '.customizer-repeater-colector' ).val( JSON.stringify( values ) );
th.find( '.customizer-repeater-colector' ).trigger( 'change' );
}
);
}
jQuery( document ).ready(
function () {
'use strict';
var theme_conrols = jQuery( '#customize-theme-controls' );
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 = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
'\'': ''',
'/': '/'
};
function escapeHtml(string) {
'use strict';
// noinspection JSUnresolvedFunction
string = String( string ).replace( new RegExp( '\r?\n', 'g' ), '<br />' );
string = String( string ).replace( /\\/g, '\' );
return String( string ).replace(
/[&<>"'\/]/g, function (s) {
return entityMap[s];
}
);
}
controls/custom-controls/repeater/style.css 0000666 00000011020 15112345375 0015247 0 ustar 00 .customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden:after {
content: "";
display: table;
clear: both;
}
.customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden {
display: none;
}
.customizer-repeater-customize-control-title {
margin: 0;
padding: 15px;
font-size: 1em;
line-height: 1;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
display: block;
font-weight: 600;
color: #23282d;
border: 1px solid #e5e5e5;
cursor: move;
}
.customizer-repeater-customize-control-title:hover {
border: 1px solid #999;
}
.customizer-repeater-customize-control-title:after {
content: "\f140";
font-family: dashicons;
font-size: 20px;
height: 13px;
bottom: 3px;
position: relative;
float: right;
}
.customizer-repeater-customize-control-title.repeater-expanded:after {
content: "\f142";
}
.customizer-repeater-box-content-hidden {
border: 1px solid #e5e5e5;
border-top: none;
padding: 1px 10px 10px;
}
.customizer-repeater-box-content-hidden > div {
margin: 1em 0;
}
.customizer-repeater-box-content-hidden .customize-control-title {
font-size: 13px;
line-height: 1.5;
font-weight: normal;
margin-bottom: 0;
margin-top: 1em;
}
.customizer-repeater-box-content-hidden .customize-control-title:after {
content: ":";
}
.customizer-repeater-box-content-hidden span.description {
font-size: 12px;
font-style: normal;
}
.customizer-repeater-general-control-repeater-container, .customizer-repeater-general-control-repeater_container {
border: 1px solid #e5e5e5;
border-top: none;
margin-bottom: 12px;
width: 100%;
float: left;
background: #fff;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}
.customizer-repeater-box-content-hidden .wp-picker-container, .customizer-repeater-box-content-hidden .wp-picker-container .wp-color-result, .icp-container {
margin: 0;
}
.customizer-repeater-box-content-hidden input:not(.icp, .wp-color-picker),
.customizer-repeater-box-content-hidden textarea,
.customizer-repeater-box-content-hidden .wp-picker-container {
margin-bottom: 1em !important;
}
.social-repeater-general-control-remove-field {
cursor: pointer;
color: #a00;
background: none;
border: none;
padding: 0;
margin-top: 10px;
}
.social-repeater-general-control-remove-field:hover {
color: red;
}
.customizer-repeater-box-content-hidden .wp-picker-holder {
position: relative;
left: -10px;
}
.customizer-repeater-box-content-hidden .wp-picker-input-wrap {
margin-left: 10px;
}
.customizer-repeater-box-content-hidden .wp-picker-container .iris-picker {
border-left: none;
border-right: none;
}
button.customizer-repeater-new-field {
float: right;
}
button.customizer-repeater-new-field:before {
content: "\f132";
display: inline-block;
position: relative;
left: -2px;
top: -1px;
font: 400 20px/1 dashicons;
vertical-align: middle;
-webkit-transition: all .2s;
transition: all .2s;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.customizer-repeater-box-content-hidden > div.customizer-repeater-social-repeater {
margin-top: 0;
}
.customizer-repeater-general-control-repeater-container .customizer-repeater-icon-control {
width: 100%;
margin: 0;
padding: 0;
}
#customizer-repeater-new-field {
width: 100%;
}
.customize-control-widget_form .widget-control-save {
display: block !important;
}
.customizer-repeater-box-content-hidden {
background-color: #fff;
}
.customizer-repeater-image-control .customizer-repeater-custom-media-button {
margin-top: 5px;
}
.customizer-icons {
display: inline-block;
padding: 0 10px 0 0;
vertical-align: middle;
}
.social-repeater-remove-social-item {
display: inline-block;
vertical-align: top;
color: #a00;
border: none;
background: none;
cursor: pointer;
padding: 0;
}
.social-repeater-remove-social-item:hover {
color: red;
}
.customizer-repeater-social-repeater > .customizer-repeater-social-repeater-container:not(:first-child) {
margin-top: 25px;
}
.icp-container {
margin-bottom: 10px;
}
.button-secondary.social-repeater-add-social-item:before {
content: "\f132";
display: inline-block;
position: relative;
left: -2px;
top: -1px;
font: 400 20px/1 dashicons;
vertical-align: middle;
-webkit-transition: all .2s;
transition: all .2s;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.button-secondary.social-repeater-add-social-item {
vertical-align: text-top;
float: right;
}
.customizer-repeater-box-content-hidden textarea {
width: 100%;
}
controls/custom-controls/alpha-color-picker/style.css 0000666 00000011324 15112345375 0017123 0 ustar 00 /**
* Alpha Color Picker CSS
*/
.customize-control-alpha-color .wp-picker-container .iris-picker {
border-bottom:none;
}
.customize-control-alpha-color .wp-picker-container {
max-width: 257px;
}
.customize-control-alpha-color .wp-picker-open + .wp-picker-input-wrap {
width: 100%;
}
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
float: left;
width: 195px;
}
.customize-control-alpha-color .wp-picker-input-wrap .button {
margin-left: 0;
float: right;
}
.wp-picker-container .wp-picker-open ~ .wp-picker-holder .alpha-color-picker-container {
display: block;
}
.alpha-color-picker-container {
border: 1px solid #dfdfdf;
border-top: none;
display: none;
background: #FFF;
padding: 0 11px 10px;
position: relative;
}
.alpha-color-picker-container .ui-widget-content,
.alpha-color-picker-container .ui-widget-header,
.alpha-color-picker-wrap .ui-state-focus {
background: transparent;
border: none;
}
.alpha-color-picker-wrap a.iris-square-value:focus {
-webkit-box-shadow: none;
box-shadow: none;
}
.alpha-color-picker-container .ui-slider {
position: relative;
z-index: 1;
height: 24px;
text-align: center;
margin: 0 auto;
width: 88%;
width: calc( 100% - 28px );
}
.alpha-color-picker-container .ui-slider-handle,
.alpha-color-picker-container .ui-widget-content .ui-state-default {
color: #777;
background-color: #FFF;
text-shadow: 0 1px 0 #FFF;
text-decoration: none;
position: absolute;
z-index: 2;
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
border: 1px solid #aaa;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
margin-top: -2px;
top: 0;
height: 26px;
width: 26px;
cursor: ew-resize;
font-size: 0;
padding: 0;
line-height: 27px;
margin-left: -14px;
}
.alpha-color-picker-container .ui-slider-handle.show-opacity {
font-size: 12px;
}
.alpha-color-picker-container .click-zone {
width: 14px;
height: 24px;
display: block;
position: absolute;
left: 10px;
}
.alpha-color-picker-container .max-click-zone {
right: 10px;
left: auto;
}
.alpha-color-picker-container .transparency {
height: 24px;
width: 100%;
background-color: #FFF;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAAYCAQAAAC18BLUAAAF0ElEQVRo3pVa69XrNgwjfLqL1+g2Xandpmt4GaM/4gdFApKbe26+xLYkik8QCv5mMCLu9+f/zuB19Yy43hnnEc91Bq+rDD7P32N+n+7nn+/XTOfO53rE+dzn8bt6PnNcn/bfs+881/XjTPOf7739fvoc1xfz/+Sp81wjjvOVIc+1Fznu68co+TNP0s+ZNPXbr/i3Zy2/f3/Pj1cjGNzj/rZFBCK/MAyJ4HUfwefzPYZl5P2iuPZ+hxiVr3H4juRu93221fFImkdj+Mw0GmkOPDOO6+Y5KHQ0rsW2E6Sr8QQL48vrtyranqtkTcN/cntUg2FzeCaEMBoexVRTKDPWrVflUIqqnIVpq0irs6mYbQY2w3ApXaTMFWm/THIz6Q5lZF6T0hSUso7XaINDvjYz8F2KwkvYPBfCX7WQmPhlSIWOaqvGyEpC2QeH2I3yFKYRw8GJ7j3o/MPHzFEcgM3E41MQ7sRBZ0yrKzdrbrwJEXW04DFl96O8eIh79Q4H86NsiMLctErX2YBP1GDiMJAOmNdDc5+VE/i1MMzr89it66xTfnC/6+8maqDfBFKVhYhF2s30+ljXc6OdNNk5VB1T4yDyBoZYRoom5ZJ1Xxo5wMQybSbrKbvjjj625hpE/IutJbfs5yGSnfdEX4fuhIPJRlRq9BljBBAoqD0++DQGYypThUmgFbKgFRfKYoZFwKj8wTY2YxyRZX7wSFWYmiRQDP0NvY3JT20ZKdowAA+YyPBJGgLERYo7SiCi0atyYRoHo02iKBIrt/Zu1zWH3LY0J0TEHaUKf9ZkQxnma+EgssAsEcKoigYhjpGGYsjs2Rwwcp4JqdJRND/VnXyBcbLHJzOush4nDc6zmzdKOYHLIbYCodxZUl2lQ9oYcOvpJoei46VMd2iIns3kVfIayZB9K0xZ4sJUDqRxgYyL3raWGhReVWZCi2PKpkWnGhgVs/RxHJoHCJVBpnpKLM5mfBT8oDMKZRbBgBUoNVF3iGkmC6NpF2LRdjrAI5jpMFl4nTIo2534RC841EcTASNydjmlO57rNWGKQ12nGkxnKyzQ8wrvo1mkzoVgxJ/8Y9ddWBwVJl939jzd+c53GPH2jt0YCB4Ghu9s1YqBiIPyee4Gzx5nUvqZnkciAVPFPUJWaexnccHzN+pQBenHjXdS9daPKB+77oV5hOa7do2KcVx6O1KUuh6Ok9qFKVpT6XQGnyBYk4qt0aoIBTPKQnKiJX9K+hMFJavq2JEzJ5Cvc9f4wFipiszCC9imbZPMi06NbNBgZSZN1GtBHXGBD4Cjwgkse0BU8D+4TqX+Kc2JIhskNp0fdawOK8L25e/6pUBtolWGoawUYeX7vKymOcbjEJucdn29ZVk3ABhUS/HOSeZhMTiM66vZKNA2luZUAeVzXYF8f3ETDSs/cYkwJy40R0QYukjIlKYgy4rghywTmNLvmTuqadGbAVaVY+GAIOXn3BsmNOrIEffmpvQr/wy1lK2GzZtpLtWdvZaSze11CaUZgU3qPaohGgWU9TmcisDSoB019MJD00XO8D4XydcRLx+7jDFKvzQkIQljTBgPiKM12EYEppLHhPdlSYyM2RkjWkPCDzHjUx4kJ46JZmagkuZQw0FXsddNQGsadAvLeXLRDmPSbUGS9hDsjuKivpy+uoSJhdGwxPs0B3KQbNXaPbTjemIQ5RAjxsQL60X6EBwNCKFgSF0ZuWyCvLlgmxeYCtqhPj63ahwOExS/5aAMDc9F2dgoyWF+BaHoT3Z4NP7kw/vP2M7QMEUUJyVoUL9vIWSl0sphm4MFD6P0d7CVfsbLaikh2jTHSHNB6a/QCCf5Qvblb5R21VcvdM0EpuLBgC3VPiiCHOIMhgOShGBe1bwwlX40HJbgxWNqRTjO+O340IRh2Wy1hqr/qoGO4W+eg//B+erTfdimBQPdRnm2QhE//axVqaOm0oqOIX+Yptmtzhc5RM8F8lC/eRzzSMf7vSDFf67LPR9fAb+7AAAAAElFTkSuQmCC);
box-shadow: 0 0 5px rgba(0,0,0,0.4) inset;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 0;
margin-top: -24px;
}
@media only screen and (max-width: 782px) {
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
width: 184px;
}
}
@media only screen and (max-width: 640px) {
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
width: 172px;
height: 33px;
}
}
controls/custom-controls/alpha-color-picker/script.js 0000666 00000021421 15112345375 0017112 0 ustar 00 /**
* 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 );
}
);
}
);
}
);
controls/custom-controls/alpha-color-picker/class-hestia-customize-alpha-color-control.php 0000666 00000006755 15112345375 0026253 0 ustar 00 <?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
}
}
controls/custom-controls/range-value/style.css 0000666 00000007436 15112345375 0015666 0 ustar 00 .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; }
controls/custom-controls/range-value/script.js 0000666 00000014002 15112345375 0015641 0 ustar 00 /**
* 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() );
}
);
}
}
);
controls/custom-controls/range-value/class-hestia-customizer-range-value-control.php 0000666 00000021064 15112345375 0025162 0 ustar 00 <?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
}
}
controls/custom-controls/section-hiding/style.css 0000666 00000001124 15112345375 0016350 0 ustar 00 .control-section-hiding-section .hestia-toggle-section,
.control-section-sidebar .hestia-toggle-section{
text-decoration: none;
margin-right: 5px;
vertical-align: middle;
}
.control-section-hiding-section .hestia-toggle-section .dashicons,
.control-section-sidebar .hestia-toggle-section .dashicons{
font-size:16px;
vertical-align: middle;
}
.hestia-section-visible .hestia-toggle-section{
color: #929292;
}
#customize-theme-controls .accordion-section-title.hestia-section-hidden,
.hestia-section-hidden .hestia-toggle-section{
color: #dcdcdc;
}
.hestia-toggle-section{
float:left
}
controls/custom-controls/section-hiding/script.js 0000666 00000011212 15112345375 0016337 0 ustar 00 /**
* 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);
}
}
}
);
}
);
controls/custom-controls/section-hiding/class-hestia-hiding-section.php 0000666 00000007450 15112345375 0022501 0 ustar 00 <?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
}
}
controls/custom-controls/multi-select/class-hestia-select-multiple.php 0000666 00000005654 15112345375 0022414 0 ustar 00 <?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
}
}
controls/custom-controls/multi-select/script.js 0000666 00000001071 15112345375 0016044 0 ustar 00 /**
* 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 );
controls/custom-controls/font-selector/functions.php 0000666 00000000113 15112345375 0017074 0 ustar 00 <?php
/**
* Fonts functions
*
* @package hestia
* @since 1.1.38
*/
controls/custom-controls/font-selector/style.css 0000666 00000003036 15112345375 0016234 0 ustar 00 #customize-theme-controls #sub-accordion-section-hestia_typography.customize-pane-child.open {
height: 100%;
}
.hestia-ss-wrap {
position: relative;
box-sizing: border-box;
border: 1px solid #ddd;
}
.hestia-ss-wrap.active {
box-shadow: 0 0 2px rgba(30, 140, 190, .8);
border: 1px solid #5897fb;
}
.customize-control input.hestia-fs-main-input {
width: 90%;
background: #fff;
display: block;
float: left;
box-shadow: none;
cursor: pointer;
box-sizing: border-box;
border-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;
} controls/custom-controls/font-selector/class-hestia-font-selector.php 0000666 00000035665 15112345375 0022252 0 ustar 00 <?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' ) );
}
}
controls/custom-controls/font-selector/script.js 0000666 00000003722 15112345375 0016226 0 ustar 00 /**
* 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 );
controls/ui/class-hestia-section-docs.php 0000666 00000003174 15112345375 0014524 0 ustar 00 <?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
}
}
controls/ui/class-hestia-contact-info.php 0000666 00000002775 15112345375 0014524 0 ustar 00 <?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 );
}
}
controls/ui/customizer-scroll/class-hestia-customizer-scroll-ui.php 0000666 00000003006 15112345375 0021737 0 ustar 00 <?php
/**
* This class allows developers to implement scrolling to sections.
*
* @package Hestia
* @since 1.1.49
* @author Andrei Baicus <andrei@themeisle.com>
* @copyright Copyright (c) 2017, Themeisle
* @link http://themeisle.com/
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
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 );
}
}
controls/ui/customizer-scroll/script.js 0000666 00000001266 15112345375 0014405 0 ustar 00 /**
* 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 );
controls/ui/customizer-scroll/helper-script.js 0000666 00000002245 15112345375 0015660 0 ustar 00 /**
* 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 );
controls/ui/class-hestia-section-upsell.php 0000666 00000005471 15112345375 0015102 0 ustar 00 <?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
}
}
controls/ui/helper-plugin-install/class-hestia-plugin-install-helper.php 0000666 00000012010 15112345375 0022555 0 ustar 00 <?php
/**
* Plugin install helper.
*
* @package Hestia
* @since Hestia 1.1.31
*/
/**
* Class Hestia_Plugin_Install_Helper
*/
class Hestia_Plugin_Install_Helper {
/**
* Instance of class.
*
* @var bool $instance instance variable.
*/
private static $instance;
/**
* Check if instance already exists.
*
* @return Hestia_Plugin_Install_Helper
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Hestia_Plugin_Install_Helper ) ) {
self::$instance = new Hestia_Plugin_Install_Helper;
}
return self::$instance;
}
/**
* Get plugin path based on plugin slug.
*
* @param string $slug Plugin slug.
*
* @return string
*/
public static function get_plugin_path( $slug ) {
switch ( $slug ) {
case 'mailin':
return $slug . '/sendinblue.php';
break;
case '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' )
);
}
}
controls/ui/helper-plugin-install/script.js 0000666 00000007302 15112345375 0015121 0 ustar 00 /**
* Remove activate button and replace with activation in progress button.
*
* @package Hestia
*/
/* global hestia_plugin_helper */
/* global console */
jQuery( document ).ready(
function ( $ ) {
$.pluginInstall = {
'init': function () {
this.handleInstall();
this.handleActivate();
},
'handleInstall': function () {
var self = this;
$( 'body' ).on( 'click', '.hestia-install-plugin', function (e) {
e.preventDefault();
var button = $( this );
var slug = button.attr( 'data-slug' );
var url = button.attr( 'href' );
var redirect = $( button ).attr( 'data-redirect' );
button.text( wp.updates.l10n.installing );
button.addClass('updating-message');
wp.updates.installPlugin(
{
slug: slug,
success: function(){
button.text(hestia_plugin_helper.activating + '...');
self.activatePlugin(url, redirect);
}
}
);
});
},
'activatePlugin': function (url, redirect) {
if (typeof url === 'undefined' || !url) {
return;
}
jQuery.ajax(
{
async: true,
type: 'GET',
url: url,
success: function () {
// Reload the page.
if (typeof(redirect) !== 'undefined' && redirect !== '') {
window.location.replace(redirect);
} else {
location.reload();
}
},
error: function (jqXHR, exception) {
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status === 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status === 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
console.log(msg);
},
}
);
},
'handleActivate': function () {
var self = this;
$( 'body' ).on( 'click', '.activate-now', function (e) {
e.preventDefault();
var button = $( this );
var url = button.attr( 'href' );
var redirect = button.attr( 'data-redirect' );
button.addClass('updating-message');
button.text(hestia_plugin_helper.activating + '...');
self.activatePlugin(url,redirect);
});
},
};
$.pluginInstall.init();
}
); controls/ui/class-hestia-main-notice-section.php 0000666 00000007301 15112345375 0015773 0 ustar 00 <?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
}
}
controls/ui/class-hestia-control-upsell.php 0000666 00000004672 15112345375 0015120 0 ustar 00 <?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
}
}
controls/ui/class-hestia-button.php 0000666 00000002677 15112345375 0013454 0 ustar 00 <?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>';
}
}
}
controls/ui/class-hestia-customizer-heading.php 0000666 00000001504 15112345375 0015726 0 ustar 00 <?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
}
}
controls/ui/class-hestia-pagebuilder-button.php 0000666 00000012665 15112345375 0015733 0 ustar 00 <?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
}
}
controls/ui/customizer-tabs/class-hestia-customize-control-tabs.php 0000666 00000005435 15112345375 0021716 0 ustar 00 <?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
}
}
controls/ui/customizer-tabs/script.js 0000666 00000014345 15112345375 0014042 0 ustar 00 /**
* 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();
}
}
}
}
}); controls/ui/customizer-tabs/style.css 0000666 00000002250 15112345375 0014042 0 ustar 00 .customize-control-interface-tabs {
display: list-item !important;
}
.hestia-tabs-control {
border-bottom: 1px solid #ddd;
width: calc(100% + 28px);
margin: -15px 0 0 -12px;
table-layout: fixed;
display: table;
}
.hestia-tabs-control .hestia-customizer-tab {
border-right: 1px solid #ddd;
display: table-cell;
text-align: center;
width: 100%;
}
.hestia-tabs-control .hestia-customizer-tab:last-child {
border-right: none;
}
.hestia-tabs-control .hestia-customizer-tab label{
text-transform: capitalize;
background: #fff;
box-shadow: inset 0 0 0 0 #0085ba;
transition: all .3s ease;
display: block;
width: 100%;
padding: 10px 0;
text-decoration: none;
font-weight: 600;
color: #333;
}
.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;
}
controls/ui/class-hestia-generic-notice-section.php 0000666 00000005011 15112345375 0016457 0 ustar 00 <?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 );
}
}
controls/ui/subscribe-info/class-hestia-subscribe-info.php 0000666 00000010115 15112345375 0017747 0 ustar 00 <?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 );
}
}
class-hestia-customizer-notices.php 0000666 00000011527 15112345375 0013521 0 ustar 00 <?php
/**
* The customizer notices manager.
*
* @package Hestia
*/
/**
* Class Hestia_Customizer_Notices
*/
class Hestia_Customizer_Notices extends Hestia_Register_Customizer_Controls {
/**
* Initialize.
*/
public function init() {
parent::init();
add_action( 'wp_ajax_dismissed_notice_handler', array( $this, 'ajax_notice_handler' ) );
add_action( 'wp_ajax_nopriv_dismissed_notice_handler', array( $this, 'ajax_notice_handler' ) );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_notices_handler' ), 0 );
}
/**
* AJAX handler to store the state of dismissible notices.
*/
final public function ajax_notice_handler() {
$control_id = sanitize_text_field( wp_unslash( $_POST['control'] ) );
if ( empty( $control_id ) ) {
die();
}
update_option( 'dismissed-' . $control_id, true );
die();
}
/**
* Enqueue the controls script.
*/
public function enqueue_notices_handler() {
wp_register_script( 'hestia-customizer-notices-handler', trailingslashit( get_template_directory_uri() ) . 'assets/js/admin/customizer-notices-handler.js', array( 'customize-controls' ), HESTIA_VERSION );
wp_localize_script(
'hestia-customizer-notices-handler', 'dismissNotices', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'cacat' => 'gigel',
)
);
wp_enqueue_script( 'hestia-customizer-notices-handler' );
}
/**
* Add customizer controls.
*/
public function add_controls() {
$this->register_types();
$this->add_docs_link_section();
$this->maybe_add_woo_notice();
$this->maybe_add_main_notice();
}
/**
* Register customizer controls type.
*/
private function register_types() {
$this->register_type( 'Hestia_Section_Docs', 'section' );
$this->register_type( 'Hestia_Generic_Notice_Section', 'section' );
$this->register_type( 'Hestia_Main_Notice_Section', 'section' );
}
/**
* Add docs link section.
*/
private function add_docs_link_section() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_docs_section',
array(
'theme_info_title' => esc_html__( 'Hestia', 'hestia' ),
'label_url' => esc_url( 'http://docs.themeisle.com/article/569-hestia-documentation' ),
'label_text' => esc_html__( 'Documentation', 'hestia' ),
),
'Hestia_Section_Docs'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_control_to_enable_docs_section',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_docs_section',
'type' => 'hidden',
)
)
);
}
/**
* Maybe add WooCommerce notice.
*/
private function maybe_add_woo_notice() {
if ( class_exists( 'WooCommerce' ) ) {
return;
}
$this->add_section(
new Hestia_Customizer_Section(
'hestia_info_woocommerce',
array(
'section_text' =>
sprintf(
/* translators: %1$s is Plugin Name */
esc_html__( 'To have access to a shop section please install and configure %1$s.', 'hestia' ),
esc_html__( 'WooCommerce plugin', 'hestia' )
),
'slug' => 'woocommerce',
'panel' => 'hestia_frontpage_sections',
'priority' => 451,
'capability' => 'install_plugins',
'hide_notice' => (bool) get_option( 'dismissed-hestia_info_woocommerce', false ),
'options' => array( 'redirect' => admin_url( 'customize.php' ) . '?autofocus[section]=hestia_shop' ),
),
'Hestia_Generic_Notice_Section'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_control_to_enable_woo_recommendation',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_info_woocommerce',
'type' => 'hidden',
)
)
);
}
/**
* Check for OBFX and add main notice if needed.
*/
private function maybe_add_main_notice() {
if ( class_exists( 'Orbit_Fox' ) ) {
return;
}
$this->add_section(
new Hestia_Customizer_Section(
'hestia_info_obfx',
array(
'slug' => 'themeisle-companion',
'priority' => 0,
'capability' => 'install_plugins',
'hide_notice' => (bool) get_option( 'dismissed-hestia_info_obfx', false ),
'title' => __( 'Recommended Plugins', 'hestia' ),
'options' => array( 'redirect' => admin_url( 'customize.php' ) ),
/* translators: Orbit Fox Companion */
'description' => sprintf( esc_html__( 'If you want to take full advantage of the options this theme has to offer, please install and activate %s.', 'hestia' ), sprintf( '<strong>%s</strong>', 'Orbit Fox Companion' ) ),
),
'Hestia_Main_Notice_Section'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_control_to_enable_obfx_recommendation',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_info_obfx',
'type' => 'hidden',
)
)
);
}
}
front-page/class-hestia-about-controls.php 0000666 00000010671 15112345375 0014667 0 ustar 00 <?php
/**
* About controls.
*
* @package Hestia
*/
/**
* Class Hestia_About_Controls
*/
class Hestia_About_Controls extends Hestia_Register_Customizer_Controls {
/**
* Add controls.
*/
public function add_controls() {
$this->add_about_section();
$this->add_hiding_control();
$this->add_content_control();
$this->add_pagebuilder_button_control();
$this->add_background_control();
}
/**
* Add the section.
*/
private function add_about_section() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_about',
array(
'title' => esc_html__( 'About', 'hestia' ),
'panel' => 'hestia_frontpage_sections',
'priority' => apply_filters( 'hestia_section_priority', 15, 'hestia_about' ),
'hiding_control' => 'hestia_about_hide',
),
'Hestia_Hiding_Section'
)
);
}
/**
* Add hiding control.
*/
private function add_hiding_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_about_hide',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => false,
'transport' => $this->selective_refresh,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Disable section', 'hestia' ),
'section' => 'hestia_about',
'priority' => 1,
)
)
);
}
/**
* Add about section content editor control.
*/
private function add_content_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_page_editor',
array(
'default' => $this->get_about_content_default(),
'sanitize_callback' => 'wp_kses_post',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'About Content', 'hestia' ),
'section' => 'hestia_about',
'priority' => 10,
'needsync' => true,
'active_callback' => array( $this, 'should_display_content_editor' ),
),
'Hestia_Page_Editor',
array(
'selector' => '.hestia-about-content',
'settings' => 'hestia_page_editor',
'render_callback' => array( $this, 'about_content_render_callback' ),
)
)
);
}
/**
* Add the page builder button control.
*/
private function add_pagebuilder_button_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_elementor_edit',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'About Content', 'hestia' ),
'section' => 'hestia_about',
'priority' => 14,
'active_callback' => 'hestia_edited_with_pagebuilder',
),
'Hestia_PageBuilder_Button'
)
);
}
/**
* Add the background image control.
*/
private function add_background_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_feature_thumbnail',
array(
'sanitize_callback' => 'esc_url_raw',
'default' => get_template_directory_uri() . '/assets/img/contact.jpg',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'About background', 'hestia' ),
'section' => 'hestia_about',
'priority' => 15,
'active_callback' => array( $this, 'is_static_page' ),
),
'WP_Customize_Image_Control'
)
);
}
/**
* Get default content for page editor control.
*
* @return string
*/
private function get_about_content_default() {
$front_page_id = get_option( 'page_on_front' );
if ( empty( $front_page_id ) ) {
return '';
}
$content = get_post_field( 'post_content', $front_page_id );
return $content;
}
/**
* Callback for About section content editor
*
* @return bool
*/
public function should_display_content_editor() {
if ( 'page' === get_option( 'show_on_front' ) ) {
return ! hestia_edited_with_pagebuilder();
}
return false;
}
/**
* About section content render callback.
*/
public function about_content_render_callback() {
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'frontpage' );
endwhile;
else : // I'm not sure it's possible to have no posts when this page is shown, but WTH
get_template_part( 'template-parts/content', 'none' );
endif;
}
/**
* Page editor control active callback function
*
* @return bool
*/
public function is_static_page() {
return 'page' === get_option( 'show_on_front' );
}
}
front-page/class-hestia-shop-controls.php 0000666 00000003645 15112345375 0014531 0 ustar 00 <?php
/**
* About controls.
*
* @package Hestia
*/
/**
* Class Hestia_About_Controls
*/
class Hestia_Shop_Controls extends Hestia_Front_Page_Section_Controls_Abstract {
/**
* Set the section data for generating the customizer basic settings
*
* @return array | null
*/
protected function set_section_data() {
if ( ! class_exists( 'WooCommerce' ) ) {
return null;
}
return array(
'slug' => 'shop',
'title' => esc_html__( 'Shop', 'hestia' ),
'priority' => 20,
);
}
/**
* Add controls.
*/
public function add_controls() {
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
$this->add_content_controls();
}
/**
* Add about section content editor control.
*/
private function add_content_controls() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_shop_items',
array(
'default' => 4,
'sanitize_callback' => 'absint',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Number of Items', 'hestia' ),
'section' => 'hestia_shop',
'priority' => 15,
'type' => 'number',
),
null,
array(
'selector' => '.hestia-shop .hestia-shop-content',
'render_callback' => array( $this, 'shop_content_render_callback' ),
'container_inclusive' => true,
)
)
);
}
/**
* Shop Content render callback
*/
public function shop_content_render_callback() {
$shop_section = new Hestia_Shop_Section();
$content = $shop_section->shop_content();
return $content;
}
/**
* Change necessary controls.
*
* @return void
*/
public function change_controls() {
$this->change_customizer_object( 'setting', 'hestia_shop_title', 'default', esc_html__( 'Products', 'hestia' ) );
$this->change_customizer_object( 'setting', 'hestia_shop_subtitle', 'default', esc_html__( 'Change this subtitle in the Customizer', 'hestia' ) );
}
}
front-page/class-hestia-contact-controls.php 0000666 00000014367 15112345375 0015216 0 ustar 00 <?php
/**
* Blog section controls.
*
* @package Hestia
*/
/**
* Class Hestia_Blog_Section_Controls
*/
class Hestia_Contact_Controls extends Hestia_Front_Page_Section_Controls_Abstract {
/**
* Add section details
*
* @return array
*/
protected function set_section_data() {
return array(
'slug' => 'contact',
'title' => esc_html__( 'Contact', 'hestia' ),
'priority' => 65,
);
}
/**
* Add controls.
*/
public function add_controls() {
$this->add_tabs();
$this->add_background_control();
$this->add_form_title_control();
$this->add_contact_info();
$this->add_contact_content();
$this->add_contact_shortcode();
}
/**
* Add tabs control
*/
private function add_tabs() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_contact_tabs',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_contact',
'priority' => 1,
'tabs' => array(
'general' => array(
'label' => esc_html__( 'General Settings', 'hestia' ),
'icon' => 'cogs',
),
'contact' => array(
'label' => esc_html__( 'Contact Content', 'hestia' ),
'icon' => 'newspaper-o',
),
),
'controls' => array(
'general' => array(
'hestia_contact_hide' => array(),
'hestia_contact_title' => array(),
'hestia_contact_subtitle' => array(),
'hestia_contact_background' => array(),
'hestia_contact_area_title' => array(),
),
'contact' => array(
'hestia_contact_info' => array(),
'hestia_contact_content_new' => array(),
'hestia_contact_form_shortcode' => array(),
),
),
),
'Hestia_Customize_Control_Tabs'
)
);
}
/**
* Add control for the background image.
*/
private function add_background_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_contact_background',
array(
'default' => apply_filters( 'hestia_contact_background_default', get_template_directory_uri() . '/assets/img/contact.jpg' ),
'sanitize_callback' => 'esc_url_raw',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Background Image', 'hestia' ),
'section' => 'hestia_contact',
'priority' => 5,
),
'WP_Customize_Image_Control'
)
);
}
/**
* Add form title control.
*/
private function add_form_title_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_contact_area_title', array(
'default' => esc_html__( 'Contact Us', 'hestia' ),
'sanitize_callback' => 'sanitize_text_field',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Form Title', 'hestia' ),
'section' => 'hestia_contact',
'priority' => 20,
)
)
);
}
/**
* Add contact info.
*/
private function add_contact_info() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_contact_info',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Instructions', 'hestia' ),
'section' => 'hestia_contact',
'capability' => 'install_plugins',
'priority' => 25,
),
'Hestia_Contact_Info'
)
);
}
/**
* Content control.
*/
private function add_contact_content() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_contact_content_new',
array(
'default' => wp_kses_post( $this->content_default() ),
'sanitize_callback' => 'wp_kses_post',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Contact Content', 'hestia' ),
'section' => 'hestia_contact',
'priority' => 30,
'include_admin_print_footer' => true,
),
'Hestia_Page_Editor',
array(
'selector' => '.contactus .col-md-5 > div.hestia-description',
'settings' => 'hestia_contact_content_new',
'render_callback' => array( $this, 'content_render_callback' ),
)
)
);
}
/**
* Add form shortcode control.
*/
private function add_contact_shortcode() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_contact_form_shortcode',
array(
'default' => '[pirate_forms]',
'sanitize_callback' => 'sanitize_text_field',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Shortcode', 'hestia' ),
'section' => 'hestia_contact',
'priority' => 26,
),
null,
array(
'selector' => '.contactus .card-contact .content',
'settings' => 'hestia_contact_form_shortcode',
'render_callback' => array( $this, 'form_render_callback' ),
)
)
);
}
/**
* Get the contact content control default.
*
* @return string
*/
private function content_default() {
$contact_section = new Hestia_Contact_Section();
return $contact_section->content_default();
}
/**
* Render callback function for contact section content selective refresh
*
* @since 1.1.31
* @access public
* @return string
*/
public function content_render_callback() {
return get_theme_mod( 'hestia_contact_content_new' );
}
/**
* Render callback function for contact form selective refresh
*
* @since 1.1.51
* @access public
* @return void
*/
public function form_render_callback() {
$hestia_contact_form_shortcode_default = '[pirate_forms]';
$hestia_contact_form_shortcode = get_theme_mod( 'hestia_contact_form_shortcode', $hestia_contact_form_shortcode_default );
if ( $hestia_contact_form_shortcode === $hestia_contact_form_shortcode_default || empty( $hestia_contact_form_shortcode ) ) {
echo do_shortcode( '[pirate_forms]' );
} else {
echo do_shortcode( wp_kses_post( $hestia_contact_form_shortcode ) );
}
}
/**
* Change necessary controls.
*
* @return void
*/
public function change_controls() {
$this->change_customizer_object( 'setting', 'hestia_contact_title', 'default', esc_html__( 'Get in Touch', 'hestia' ) );
$this->change_customizer_object( 'setting', 'hestia_contact_subtitle', 'default', esc_html__( 'Change this subtitle in the Customizer', 'hestia' ) );
}
}
front-page/class-hestia-big-title-controls.php 0000666 00000030036 15112345375 0015432 0 ustar 00 <?php
/**
* Big title controls.
*
* @package Hestia
*/
/**
* Class Hestia_Big_Title_Controls
*/
class Hestia_Big_Title_Controls extends Hestia_Register_Customizer_Controls {
/**
* Initialize the control. Add all the hooks necessary.
*/
public function init() {
parent::init();
add_filter( 'customizer_widgets_section_args', array( $this, 'move_widgets_section' ), 10, 3 );
}
/**
* Filter to move widgets section to Fronptage section panel.
*
* @param array $section_args Sections args.
* @param string $section_id Section id.
* @param string $sidebar_id Sidebar id.
*
* @return mixed
*/
public function move_widgets_section( $section_args, $section_id, $sidebar_id ) {
if ( $sidebar_id === 'sidebar-big-title' ) {
$section_args['panel'] = 'hestia_frontpage_sections';
}
return $section_args;
}
/**
* Add controls.
*/
public function add_controls() {
$this->add_section_tabs();
$this->add_general_controls();
$this->add_background_image_control();
$this->add_content_controls();
$this->add_button_controls();
$this->add_parallax_controls();
$this->add_alignment_control();
}
/**
* Change controls.
*/
public function change_controls() {
$this->maybe_add_defaults_for_big_title();
}
/**
* Add drop-down for header type.
*/
private function add_general_controls() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_slider_type',
array(
'sanitize_callback' => 'hestia_sanitize_big_title_type',
'default' => 'image',
),
array(
'type' => 'select',
'priority' => -1,
'section' => 'sidebar-widgets-sidebar-big-title', // Add a default or your own section
'label' => esc_html__( 'Big Title Background', 'hestia' ),
'choices' => array(
'image' => esc_html__( 'Image', 'hestia' ),
'parallax' => esc_html__( 'Parallax', 'hestia' ),
),
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_big_title_widgets_title',
array(
'sanitize_callback' => 'wp_kses',
),
array(
'label' => esc_html__( 'Big Title Section', 'hestia' ) . ' ' . esc_html__( 'Sidebar', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => -1,
),
'Hestia_Customizer_Heading'
)
);
}
/**
* Add background control.
*/
public function add_background_image_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_big_title_background',
array(
'sanitize_callback' => 'esc_url_raw',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Image', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => 10,
),
'WP_Customize_Image_Control',
array(
'selector' => '.big-title-image',
'settings' => 'hestia_big_title_background',
'render_callback' => array( $this, 'background_render_callback' ),
)
)
);
}
/**
* Add title subtitle.
*/
public function add_content_controls() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_big_title_title',
array(
'sanitize_callback' => 'wp_kses_post',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Title', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => 20,
),
null,
array(
'selector' => '.carousel .hestia-title',
'settings' => 'hestia_big_title_title',
'render_callback' => array( $this, 'title_render_callback' ),
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_big_title_text',
array(
'sanitize_callback' => 'wp_kses_post',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Text', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => 25,
),
null,
array(
'selector' => '.carousel .sub-title',
'settings' => 'hestia_big_title_text',
'render_callback' => array( $this, 'text_render_callback' ),
)
)
);
}
/**
* Add button controls.
*/
public function add_button_controls() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_big_title_button_text',
array(
'sanitize_callback' => 'sanitize_text_field',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Button text', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => 30,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_big_title_button_link',
array(
'sanitize_callback' => 'esc_url_raw',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Button URL', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => 35,
)
)
);
$this->add_partial(
new Hestia_Customizer_Partial(
'hestia_big_title_button_text', array(
'selector' => '.carousel .buttons',
'settings' => 'hestia_big_title_button_text',
'render_callback' => array( $this, 'button_render_callback' ),
)
)
);
}
/**
* Add alignment control.
*/
protected function add_alignment_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_slider_alignment',
array(
'default' => 'center',
'sanitize_callback' => 'hestia_sanitize_alignment_options',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Layout', 'hestia' ),
'priority' => -2,
'section' => 'sidebar-widgets-sidebar-big-title',
'choices' => array(
'left' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEX////V1dUAhbo+yP/u9/pRM+FMAAAAZElEQVR42u3WsQ2AIBRFUd0AV3AFV3D/mSwsBI2BRIofPKchobjVK/7EQJZSit+az5/aq/WjVs99AQAjWxs8L4ZL0hqutTcoWt0OSa2orfdVaWl9b/XcqpbWvbXltLQCtwCA3AHhDKjAJvDMEwAAAABJRU5ErkJggg==',
),
'center' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEX///8AhbrV1dU+yP/u9/q7NurVAAAAV0lEQVR42u3SsQ2AMAxFwYBYgA0QK7AC+89EQQOiIIoogn3XWHLxql8IZL1b+m+N5+ftaiVqfbkvACC8YW6iFbg17U0KCVQNTUvr0YK+bFdaWklaAPAXB4dWiADE72glAAAAAElFTkSuQmCC',
),
'right' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEX////V1dUAhbo+yP/u9/pRM+FMAAAAYElEQVR42u3SuQ2AMBBFQaAC3AIt0AL910RAAkICS1xrPJOstMGLfsOPpK0+fqtdPmdXq6LWnfsCAKJJe4+0hhxaVbWmHB9sVStCq7u8Ly2td7aqpXVsXNPSKrAFAOWbASNgr0b3Lh1kAAAAAElFTkSuQmCC',
),
),
),
'Hestia_Customize_Control_Radio_Image',
array(
'selector' => '#carousel-hestia-generic',
'settings' => 'hestia_slider_alignment',
'render_callback' => array( $this, 'alignment_render_callback' ),
)
)
);
}
/**
* Add controls for parallax.
*/
private function add_parallax_controls() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_parallax_layer1',
array(
'sanitize_callback' => 'esc_url_raw',
'default' => apply_filters( 'hestia_parallax_layer1_default', false ),
),
array(
'label' => esc_html__( 'First Layer', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => 10,
),
'WP_Customize_Image_Control'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_parallax_layer2',
array(
'sanitize_callback' => 'esc_url_raw',
'default' => apply_filters( 'hestia_parallax_layer2_default', false ),
),
array(
'label' => esc_html__( 'Second Layer', 'hestia' ),
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => 15,
),
'WP_Customize_Image_Control'
)
);
}
/**
* Add tabs control in hestia_big_title section.
*/
public function add_section_tabs() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_slider_tabs',
array(
'transport' => $this->selective_refresh,
),
array(
'section' => 'sidebar-widgets-sidebar-big-title',
'priority' => -3,
'tabs' => array(
'slider' => array(
'label' => esc_html__( 'Big Title Section', 'hestia' ),
'icon' => 'picture-o',
),
'extra' => array(
'label' => esc_html__( 'Extra', 'hestia' ),
'icon' => 'user-plus',
),
),
'controls' => array(
'slider' => array(
'hestia_slider_type' => array(
'image' => array(
'hestia_big_title_background',
'hestia_big_title_title',
'hestia_big_title_text',
'hestia_big_title_button_text',
'hestia_big_title_button_link',
),
'parallax' => array(
'hestia_parallax_layer1',
'hestia_parallax_layer2',
'hestia_big_title_title',
'hestia_big_title_text',
'hestia_big_title_button_text',
'hestia_big_title_button_link',
),
),
),
'extra' => array(
'hestia_slider_alignment' => array(
'left' => array(
'hestia_big_title_widgets_title',
'widgets',
),
'center' => array(),
'right' => array(
'hestia_big_title_widgets_title',
'widgets',
),
),
),
),
),
'Hestia_Customize_Control_Tabs'
)
);
}
/**
* Maybe throw in some defaults.
*/
private function maybe_add_defaults_for_big_title() {
$hestia_slider_content = get_theme_mod( 'hestia_slider_content' );
if ( ! empty( $hestia_slider_content ) ) {
return;
}
$this->change_customizer_object( 'setting', 'hestia_big_title_background', 'default', esc_url( apply_filters( 'hestia_big_title_background_default', get_template_directory_uri() . '/assets/img/slider2.jpg' ) ) );
$this->change_customizer_object( 'setting', 'hestia_big_title_title', 'default', esc_html__( 'Change in the Customizer', 'hestia' ) );
$this->change_customizer_object( 'setting', 'hestia_big_title_text', 'default', esc_html__( 'Change in the Customizer', 'hestia' ) );
$this->change_customizer_object( 'setting', 'hestia_big_title_button_text', 'default', esc_html__( 'Change in the Customizer', 'hestia' ) );
$this->change_customizer_object( 'setting', 'hestia_big_title_button_link', 'default', esc_url( '#' ) );
}
/**
* Callback for title.
*
* @return string
*/
public function title_render_callback() {
return get_theme_mod( 'hestia_big_title_title' );
}
/**
* Callback for subtitle.
*
* @return string
*/
public function text_render_callback() {
return get_theme_mod( 'hestia_big_title_text' );
}
/**
* Callback for button.
*
* @return bool|string
*/
public function button_render_callback() {
$button_text = get_theme_mod( 'hestia_big_title_button_text' );
$button_link = get_theme_mod( 'hestia_big_title_button_link' );
if ( empty( $button_text ) ) {
return false;
}
if ( empty( $button_link ) ) {
return false;
}
$output = '<a href="' . $button_link . '" title="' . $button_text . '" class="btn btn-primary btn-lg">' . $button_text . '</a>';
return wp_kses_post( $output );
}
/**
* Alignment callback.
*/
public function alignment_render_callback() {
$big_title_section_view = new Hestia_Big_Title_Section();
$big_title_section_view->render_big_title_content();
}
/**
* Background callback.
*/
public function background_render_callback() {
$hestia_parallax_layer1 = get_theme_mod( 'hestia_parallax_layer1' );
$hestia_parallax_layer2 = get_theme_mod( 'hestia_parallax_layer2' );
if ( empty( $hestia_parallax_layer1 ) || empty( $hestia_parallax_layer2 ) ) {
$hestia_big_title_background = get_theme_mod( 'hestia_big_title_background' );
echo '<style class="big-title-image-css">';
echo '#carousel-hestia-generic .header-filter {';
echo ! empty( $hestia_big_title_background ) ? 'background-image: url("' . esc_url( $hestia_big_title_background ) . '") !important;' : 'background-image: none !important;';
echo '}';
echo '</style>';
}
}
}
front-page/class-hestia-subscribe-controls.php 0000666 00000007313 15112345375 0015535 0 ustar 00 <?php
/**
* Subscribe controls.
*
* @package Hestia
*/
/**
* Class Hestia_Subscribe_Controls
*/
class Hestia_Subscribe_Controls extends Hestia_Front_Page_Section_Controls_Abstract {
/**
* Add section details
*
* @return array
*/
protected function set_section_data() {
return array(
'slug' => 'subscribe',
'title' => esc_html__( 'Subscribe', 'hestia' ),
'priority' => 55,
'initially_hidden' => true,
'section' => 'sidebar-widgets-subscribe-widgets',
);
}
/**
* Add controls.
*/
public function add_controls() {
$this->add_tabs();
$this->add_info_control();
$this->add_background_control();
}
/**
* Add section tabs/
*/
private function add_tabs() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_subscribe_tabs',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'sidebar-widgets-subscribe-widgets',
'tabs' => array(
'general' => array(
'label' => esc_html__( 'General Settings', 'hestia' ),
),
'sendinblue' => array(
'label' => esc_html__( 'SendinBlue plugin', 'hestia' ),
),
),
'controls' => array(
'general' => array(
'hestia_subscribe_hide' => array(),
'hestia_subscribe_background' => array(),
'hestia_subscribe_title' => array(),
'hestia_subscribe_subtitle' => array(),
),
'sendinblue' => array(
'hestia_subscribe_info' => array(),
'widgets' => array(),
),
),
),
'Hestia_Customize_Control_Tabs'
)
);
}
/**
* Add background control.
*/
private function add_background_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_subscribe_background',
array(
'default' => get_template_directory_uri() . '/assets/img/about.jpg',
'sanitize_callback' => 'esc_url_raw',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Background Image', 'hestia' ),
'section' => 'sidebar-widgets-subscribe-widgets',
'priority' => 10,
),
'WP_Customize_Image_Control'
)
);
}
/**
* Add the info control.
*/
private function add_info_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_subscribe_info',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Instructions', 'hestia' ),
'section' => 'sidebar-widgets-subscribe-widgets',
'capability' => 'install_plugins',
'priority' => 25,
),
'Hestia_Subscribe_Info'
)
);
}
/**
* Change any controls that may need change.
*
* @return void
*/
public function change_controls() {
$this->change_customizer_object( 'section', 'sidebar-widgets-subscribe-widgets', 'panel', 'hestia_frontpage_sections' );
$this->change_customizer_object( 'section', 'sidebar-widgets-subscribe-widgets', 'priority', apply_filters( 'hestia_section_priority', 55, 'sidebar-widgets-subscribe-widgets' ) );
$this->change_customizer_object( 'setting', 'hestia_subscribe_title', 'default', esc_html__( 'Subscribe to our Newsletter', 'hestia' ) );
$this->change_customizer_object( 'setting', 'hestia_subscribe_subtitle', 'default', esc_html__( 'Change this subtitle in the Customizer', 'hestia' ) );
$controls_to_move = array(
'hestia_subscribe_subtitle',
'hestia_subscribe_title',
'hestia_subscribe_background',
'hestia_subscribe_hide',
'hestia_subscribe_info',
'hestia_subscribe_tabs',
);
foreach ( $controls_to_move as $index => $control_id ) {
$this->change_customizer_object( 'control', $control_id, 'priority', -$index );
}
}
}
front-page/class-hestia-blog-section-controls.php 0000666 00000003454 15112345375 0016143 0 ustar 00 <?php
/**
* Blog section controls.
*
* @package Hestia
*/
/**
* Class Hestia_Blog_Section_Controls
*/
class Hestia_Blog_Section_Controls extends Hestia_Front_Page_Section_Controls_Abstract {
/**
* Implement set_section_data from parent.
* Add section details
*
* @return array
*/
protected function set_section_data() {
return array(
'slug' => 'blog',
'title' => esc_html__( 'Blog', 'hestia' ),
'priority' => 60,
);
}
/**
* Add controls.
*/
public function add_controls() {
$this->add_items_number_control();
}
/**
* Items number control.
*/
private function add_items_number_control() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_blog_items',
array(
'default' => 3,
'sanitize_callback' => 'absint',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Number of Items', 'hestia' ),
'section' => 'hestia_blog',
'priority' => 15,
'type' => 'number',
'input_attrs' => array(
'min' => 1,
),
),
null,
array(
'selector' => '.hestia-blog-content',
'settings' => 'hestia_blog_items',
'render_callback' => array( $this, 'blog_content_callback' ),
)
)
);
}
/**
* Render callback function
*/
public function blog_content_callback() {
$blog_section = new Hestia_Blog_Section();
$blog_section->blog_content();
}
/**
* Change necessary controls.
*
* @return void
*/
public function change_controls() {
$this->change_customizer_object( 'setting', 'hestia_blog_title', 'default', esc_html__( 'Blog', 'hestia' ) );
$this->change_customizer_object( 'setting', 'hestia_blog_subtitle', 'default', esc_html__( 'Change this subtitle in the Customizer', 'hestia' ) );
}
}
class-hestia-customizer-main.php 0000666 00000006114 15112345375 0012775 0 ustar 00 <?php
/**
* The main customizer manager.
*
* @package Hestia
*/
/**
* Class Hestia_Customizer_Main
*/
class Hestia_Customizer_Main extends Hestia_Register_Customizer_Controls {
/**
* Add controls.
*/
public function add_controls() {
$this->register_types();
$this->add_main_panels();
$this->maybe_add_partial_refresh_to_blog_description();
}
/**
* Register customizer controls type.
*/
private function register_types() {
$this->register_type( 'Hestia_Hiding_Section', 'section' );
$this->register_type( 'Hestia_Customizer_Range_Value_Control', 'control' );
$this->register_type( 'Hestia_Customizer_Heading', 'control' );
$this->register_type( 'Hestia_Select_Multiple', 'control' );
$this->register_type( 'Hestia_PageBuilder_Button', 'control' );
$this->register_type( 'Hestia_Customize_Control_Radio_Image', 'control' );
$this->register_type( 'Hestia_Customize_Control_Tabs', 'control' );
}
/**
* Add main panels.
*/
private function add_main_panels() {
$this->add_panel(
new Hestia_Customizer_Panel(
'hestia_appearance_settings',
array(
'priority' => 25,
'title' => esc_html__( 'Appearance Settings', 'hestia' ),
)
)
);
$this->add_panel(
new Hestia_Customizer_Panel(
'hestia_frontpage_sections',
array(
'priority' => 30,
'title' => esc_html__( 'Frontpage Sections', 'hestia' ),
)
)
);
$this->add_panel(
new Hestia_Customizer_Panel(
'hestia_blog_settings',
array(
'priority' => 45,
'title' => esc_html__( 'Blog Settings', 'hestia' ),
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_link_header_background',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'priority' => 25,
'section' => 'background_image',
'button_text' => esc_html__( 'Header Background', 'hestia' ),
'button_class' => 'focus-customizer-header-image',
'icon_class' => 'fa-image',
),
'Hestia_Button'
)
);
}
/**
* Add selective refresh to blog description if that's the case.
*/
private function maybe_add_partial_refresh_to_blog_description() {
if ( ! 'posts' === get_option( 'show_on_front' ) ) {
return;
}
$this->add_partial(
new Hestia_Customizer_Partial(
'blogdescription',
array(
'selector' => '.home.blog .page-header .hestia-title',
'render_callback' => array( $this, 'blog_description_callback' ),
)
)
);
}
/**
* Change controls.
*
* @return void
*/
public function change_controls() {
$this->change_customizer_object( 'section', 'header_image', 'panel', 'hestia_appearance_settings' );
$this->change_customizer_object( 'section', 'header_image', 'description', __return_empty_string() );
$this->change_customizer_object( 'section', 'background_image', 'panel', 'hestia_appearance_settings' );
$this->change_customizer_object( 'setting', 'blogdescription', 'transport', $this->selective_refresh );
}
/**
* Blog description callback function
*/
public function blog_description_callback() {
bloginfo( 'description' );
}
}
general/class-hestia-color-controls.php 0000666 00000002306 15112345375 0014242 0 ustar 00 <?php
/**
* Customizer color controls.
*
* @package Hestia
*/
/**
* Class Hestia_Color_Controls
*/
class Hestia_Color_Controls extends Hestia_Register_Customizer_Controls {
/**
* Add controls
*/
public function add_controls() {
$this->add_control(
new Hestia_Customizer_Control(
'accent_color',
array(
'default' => apply_filters( 'hestia_accent_color_default', '#e91e63' ),
'transport' => $this->selective_refresh,
'sanitize_callback' => 'hestia_sanitize_colors',
),
array(
'label' => esc_html__( 'Accent Color', 'hestia' ),
'section' => 'colors',
'palette' => false,
'priority' => 10,
),
'Hestia_Customize_Alpha_Color_Control'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_gradient_color',
array(
'default' => apply_filters( 'hestia_header_gradient_default', '#a81d84' ),
'transport' => 'postMessage',
'sanitize_callback' => 'hestia_sanitize_colors',
),
array(
'label' => esc_html__( 'Header Gradient', 'hestia' ),
'section' => 'header_image',
'priority' => 30,
),
'WP_Customize_Color_Control'
)
);
}
}
general/class-hestia-general-controls.php 0000666 00000014026 15112345375 0014543 0 ustar 00 <?php
/**
* Customizer general controls.
*
* @package Hestia
*/
/**
* Class Hestia_General_Controls
*/
class Hestia_General_Controls extends Hestia_Register_Customizer_Controls {
/**
* Initialize the controls.
*/
public function init() {
parent::init();
if ( is_rtl() ) {
add_filter( 'hestia_layout_control_image_left', array( $this, 'rtl_layout_control_right_image' ) );
add_filter( 'hestia_layout_control_image_right', array( $this, 'rtl_layout_control_left_image' ) );
}
}
/**
* Add controls
*/
public function add_controls() {
$this->add_general_settings_section();
$this->add_general_settings_section();
$this->add_page_sidebar_layout();
$this->add_blog_sidebar_layout();
$this->add_sharing_icons_toggle();
$this->add_scrolltop_toggle();
$this->add_boxed_layout_toggle();
}
/**
* Add General Settings Section
*/
private function add_general_settings_section() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_general',
array(
'title' => esc_html__( 'General Settings', 'hestia' ),
'panel' => 'hestia_appearance_settings',
'priority' => 20,
)
)
);
}
/**
* Add page sidebar layout
*/
private function add_page_sidebar_layout() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_page_sidebar_layout',
array(
'sanitize_callback' => 'sanitize_key',
'default' => 'full-width',
),
array(
'label' => esc_html__( 'Page Sidebar Layout', 'hestia' ),
'section' => 'hestia_general',
'priority' => 15,
'choices' => $this->get_layout_choices(),
),
'Hestia_Customize_Control_Radio_Image'
)
);
}
/**
* Add blog sidebar layout
*/
private function add_blog_sidebar_layout() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_blog_sidebar_layout', array(
'default' => $this->get_blog_layout_default(),
'sanitize_callback' => 'sanitize_key',
),
array(
'label' => esc_html__( 'Blog Sidebar Layout', 'hestia' ),
'section' => 'hestia_general',
'priority' => 20,
'choices' => $this->get_layout_choices(),
),
'Hestia_Customize_Control_Radio_Image'
)
);
}
/**
* Sharing icons control.
*/
private function add_sharing_icons_toggle() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_enable_sharing_icons', array(
'default' => true,
'sanitize_callback' => 'hestia_sanitize_checkbox',
),
array(
'label' => esc_html__( 'Enable Sharing Icons', 'hestia' ),
'section' => 'hestia_general',
'priority' => 30,
'type' => 'checkbox',
)
)
);
}
/**
* Add scroll to top control.
*/
private function add_scrolltop_toggle() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_enable_scroll_to_top',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
),
array(
'label' => esc_html__( 'Enable Scroll to Top', 'hestia' ),
'section' => 'hestia_general',
'priority' => 40,
'type' => 'checkbox',
)
)
);
}
/**
* ADd the boxed layout control.
*/
private function add_boxed_layout_toggle() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_general_layout',
array(
'default' => 1,
'sanitize_callback' => 'hestia_sanitize_checkbox',
'transport' => 'postMessage',
),
array(
'label' => esc_html__( 'Boxed Layout', 'hestia' ),
'description' => esc_html__( 'If enabled, the theme will use a boxed layout.', 'hestia' ),
'section' => 'hestia_general',
'priority' => 50,
'type' => 'checkbox',
)
)
);
}
/**
* Get layout choices for sidebar layout controls.
*
* @return array
*/
private function get_layout_choices() {
return array(
'full-width' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAQMAAABknzrDAAAABlBMVEX////V1dXUdjOkAAAAPUlEQVRIx2NgGAUkAcb////Y/+d/+P8AdcQoc8vhH/X/5P+j2kG+GA3CCgrwi43aMWrHqB2jdowEO4YpAACyKSE0IzIuBgAAAABJRU5ErkJggg==',
'label' => esc_html__( 'Full Width', 'hestia' ),
),
'sidebar-left' => array(
'url' => apply_filters( 'hestia_layout_control_image_left', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAACVBMVEX///8+yP/V1dXG9YqxAAAAWElEQVR42mNgGAXDE4RCQMDAKONaBQINWqtWrWBatQDIaxg8ygYqQIAOYwC6bwHUmYNH2eBPSMhgBQXKRr0w6oVRL4x6YdQLo14Y9cKoF0a9QCO3jYLhBADvmFlNY69qsQAAAABJRU5ErkJggg==' ),
'label' => esc_html__( 'Left Sidebar', 'hestia' ),
),
'sidebar-right' => array(
'url' => apply_filters( 'hestia_layout_control_image_right', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAACVBMVEX///8+yP/V1dXG9YqxAAAAWUlEQVR42mNgGAUjB4iGgkEIzZStAoEVTECiQWsVkLdiECkboAABOmwBF9BtUGcOImUDEiCkJCQU0ECBslEvjHph1AujXhj1wqgXRr0w6oVRLwyEF0bBUAUAz/FTNXm+R/MAAAAASUVORK5CYII=' ),
'label' => esc_html__( 'Right Sidebar', 'hestia' ),
),
);
}
/**
* Change the right image.
*
* @return string
*/
public function rtl_layout_control_right_image() {
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAACVBMVEX///8+yP/V1dXG9YqxAAAAWUlEQVR42mNgGAUjB4iGgkEIzZStAoEVTECiQWsVkLdiECkboAABOmwBF9BtUGcOImUDEiCkJCQU0ECBslEvjHph1AujXhj1wqgXRr0w6oVRLwyEF0bBUAUAz/FTNXm+R/MAAAAASUVORK5CYII=';
}
/**
* Change the left image.
*
* @return string
*/
public function rtl_layout_control_left_image() {
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAACVBMVEX///8+yP/V1dXG9YqxAAAAWElEQVR42mNgGAXDE4RCQMDAKONaBQINWqtWrWBatQDIaxg8ygYqQIAOYwC6bwHUmYNH2eBPSMhgBQXKRr0w6oVRL4x6YdQLo14Y9cKoF0a9QCO3jYLhBADvmFlNY69qsQAAAABJRU5ErkJggg==';
}
/**
* Get default option for sidebar layout
*
* @return string
*/
private function get_blog_layout_default() {
$sidebar_on_single_post = get_theme_mod( 'hestia_sidebar_on_single_post', false );
$sidebar_on_index = get_theme_mod( 'hestia_sidebar_on_index', false );
return $sidebar_on_single_post && $sidebar_on_index ? 'full-width' : 'sidebar-right';
}
}
general/class-hestia-header-controls.php 0000666 00000022457 15112345375 0014365 0 ustar 00 <?php
/**
* Handle Header Controls.
*
* @package Hestia
*/
/**
* Class Hestia_Header_Controls
*/
class Hestia_Header_Controls extends Hestia_Register_Customizer_Controls {
/**
* Add the customizer controls.
*/
public function add_controls() {
$this->register_type( 'Hestia_Customize_Control_Radio_Image', 'control' );
$this->add_sections();
$this->add_panel(
new Hestia_Customizer_Panel(
'hestia_header_options', array(
'priority' => 35,
'title' => esc_html__( 'Header Options', 'hestia' ),
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_image_sitewide',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => false,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Enable Header Image Sitewide', 'hestia' ),
'section' => 'header_image',
'priority' => 25,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_bar_hide',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => true,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Disable section', 'hestia' ),
'section' => 'hestia_top_bar',
'priority' => 1,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_link_to_top_menu',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'priority' => 25,
'section' => 'hestia_top_bar',
'button_text' => esc_html__( 'Very Top Bar', 'hestia' ) . ' ' . esc_html__( 'Menu', 'hestia' ),
'button_class' => 'hestia-link-to-top-menu',
'icon_class' => 'fa-bars',
),
'Hestia_Button'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_top_menu_hidden',
array(
'sanitize_callback' => 'sanitize_text_field',
'transport' => $this->selective_refresh,
),
array(
'priority' => 25,
'type' => 'hidden',
'section' => 'menu_locations',
),
null,
array(
'selector' => '.top-bar-nav',
'settings' => 'hestia_top_menu_hidden',
'render_callback' => array( $this, 'top_bar_callback' ),
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_search_in_menu',
array(
'sanitize_callback' => 'hestia_sanitize_checkbox',
'default' => false,
),
array(
'type' => 'checkbox',
'label' => esc_html__( 'Enable Search in Menu', 'hestia' ),
'section' => 'hestia_navigation',
'priority' => 5,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_alignment',
array(
'default' => 'left',
'sanitize_callback' => 'hestia_sanitize_alignment_options',
),
array(
'label' => esc_html__( 'Layout', 'hestia' ),
'priority' => 25,
'section' => 'hestia_navigation',
'choices' => array(
'left' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAADFBMVEX////V1dUAhbo+yP8aB7nsAAAARklEQVRYhWNgGEGA/z8EHKC+MqZVq1ah4xGtjOLgHQWjYBSMgmENREOxgoDhp2xkASIDYxgoGwUUACJDdlTZKBgFo2DAAAAZAflVkm2NtwAAAABJRU5ErkJggg==',
),
'center' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAADFBMVEX////V1dUAhbo+yP8aB7nsAAAARElEQVRYR2NgGKngPwT8GVU2BJQNb6C1atUCfHjEKRsFo2BEANFQrCBg+CkbWYDIwBgGykYBBYDIkB1VNgpGwSgYMAAAzIYr4wYj4sEAAAAASUVORK5CYII=',
),
'right' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEX////V1dXF7v8Ahbo+yP+vNfjRAAAAWUlEQVR42u3TsQ2AMAxFQRAswAaIFViB/WeKlI4KgUJMwl3j7lXfA3+xXVvfas3HmZaWVtw/1mrRjmnPnl6tDlsAEcblFq2PtuhLyS1oxbWgjpIL1dICgEYlsKfbvyzuWeMAAAAASUVORK5CYII=',
),
),
),
'Hestia_Customize_Control_Radio_Image'
)
);
/**
* Customize control for header layout.
*/
$sidebar_choices = apply_filters(
'hestia_header_layout_choices', array(
'default' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEU+yP/////Y9P/G7//V1dUbjhlcAAAAW0lEQVR4Ae3SAQmAYAyE0V9NMDCBCQxh/0wKGGCAIJ7vC3DA28ZvkjRVo49vzVujoeYFbF15i32pu4CtlCTVc+Vu2VqPRi9ssWfPnj179uzZs2fPnj179uwzt07LZ+4ImOW7JwAAAABJRU5ErkJggg==',
),
'no-content' => array(
'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAElBMVEU+yP////88SFhjbXl1fonV1dUUDrn8AAAAXElEQVR4Ae3SMQ2AYAyEUSwAYOC3gAJE4N8KCztNKEPT9wm44eUmSZL0b3NeXbeWEaj41noEet/yCVs+cW7jqfjW12ztV6D8Lfbs2bNnz549e/bs2bNnz559060bqAJ8azq5sAYAAAAASUVORK5CYII=',
),
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_layout',
array(
'sanitize_callback' => 'sanitize_key',
'default' => 'default',
),
array(
'label' => esc_html__( 'Layout', 'hestia' ),
'section' => 'header_image',
'priority' => 10,
'choices' => $sidebar_choices,
),
'Hestia_Customize_Control_Radio_Image'
)
);
$this->add_selective_refresh_to_header_items();
}
/**
* Change customizer controls.
*/
public function change_controls() {
$this->move_header_image_section();
$this->move_top_bar_controls();
$this->move_controls_to_navigation_sidebar();
}
/**
* Move controls to nav sidebar.
*/
private function move_controls_to_navigation_sidebar() {
$navigation_sidebar = $this->get_customizer_object( 'section', 'sidebar-widgets-header-sidebar' );
if ( empty( $navigation_sidebar ) ) {
return;
}
$navigation_sidebar->panel = 'hestia_header_options';
$hestia_header_alignment = $this->get_customizer_object( 'control', 'hestia_header_alignment' );
if ( ! empty( $hestia_header_alignment ) ) {
$hestia_header_alignment->section = 'sidebar-widgets-header-sidebar';
$hestia_header_alignment->priority = - 1;
}
$hestia_search_in_menu = $this->get_customizer_object( 'control', 'hestia_search_in_menu' );
if ( ! empty( $hestia_search_in_menu ) ) {
$hestia_search_in_menu->section = 'sidebar-widgets-header-sidebar';
$hestia_search_in_menu->priority = - 1;
}
}
/**
* Add selective refresh to header logo and site name.
*/
private function add_selective_refresh_to_header_items() {
$this->get_customizer_object( 'setting', 'blogname' )->transport = 'postMessage';
$this->add_partial(
new Hestia_Customizer_Partial(
'blogname',
array(
'selector' => '.navbar .navbar-brand p',
'settings' => array( 'blogname' ),
'render_callback' => array( $this, 'blog_name_callback' ),
)
)
);
$this->add_partial(
new Hestia_Customizer_Partial(
'custom_logo',
array(
'selector' => '.navbar-brand',
'settings' => 'custom_logo',
'render_callback' => array( $this, 'logo_callback' ),
)
)
);
}
/**
* Move header image controls.
*/
private function move_header_image_section() {
$this->get_customizer_object( 'setting', 'custom_logo' )->transport = 'postMessage';
$header_image_section = $this->get_customizer_object( 'section', 'header_image' );
if ( ! empty( $header_image_section ) ) {
$header_image_section->title = esc_html__( 'Header Settings', 'hestia' );
$header_image_section->panel = 'hestia_header_options';
$header_image_section->priority = 20;
}
$header_image_control = $this->get_customizer_object( 'control', 'header_image' );
if ( ! empty( $header_image_control ) ) {
$header_image_control->priority = 15;
}
$header_image_data_control = $this->get_customizer_object( 'control', 'header_image_data' );
if ( ! empty( $header_image_data_control ) ) {
$header_image_data_control->priority = 20;
}
}
/**
* Move top bar controls.
*/
private function move_top_bar_controls() {
$top_bar_sidebar = $this->get_customizer_object( 'section', 'sidebar-widgets-sidebar-top-bar' );
if ( ! empty( $top_bar_sidebar ) ) {
$top_bar_sidebar->panel = 'hestia_header_options';
$controls_to_move = array(
'hestia_top_bar_hide',
'hestia_link_to_top_menu',
);
foreach ( $controls_to_move as $control ) {
$hestia_control = $this->get_customizer_object( 'control', $control );
if ( ! empty( $hestia_control ) ) {
$hestia_control->section = 'sidebar-widgets-sidebar-top-bar';
$hestia_control->priority = - 2;
}
}
}
}
/**
* Add sections.
*/
private function add_sections() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_navigation',
array(
'title' => esc_html__( 'Navigation', 'hestia' ),
'panel' => 'hestia_header_options',
'priority' => 15,
)
)
);
$this->add_section(
new Hestia_Customizer_Section(
'hestia_top_bar',
array(
'title' => esc_html__( 'Very Top Bar', 'hestia' ),
'panel' => 'hestia_header_options',
'priority' => 10,
)
)
);
}
/**
* Blog name callback function
*
* @return void
*/
public function blog_name_callback() {
bloginfo( 'name' );
}
/**
* Custom logo callback function.
*
* @return string
*/
public function logo_callback() {
if ( get_theme_mod( 'custom_logo' ) ) {
$logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
$logo = '<img src="' . esc_url( $logo[0] ) . '">';
} else {
$logo = '<p>' . get_bloginfo( 'name' ) . '</p>';
}
return $logo;
}
}
general/class-hestia-blog-settings-controls.php 0000666 00000003112 15112345375 0015701 0 ustar 00 <?php
/**
* Customizer blog settings controls.
*
* @package Hestia
*/
/**
* Class Hestia_Blog_Settings_Controls
*/
class Hestia_Blog_Settings_Controls extends Hestia_Register_Customizer_Controls {
/**
* Add controls
*/
public function add_controls() {
$this->add_blog_settings_section();
$this->add_featured_posts_category_dropdown();
}
/**
* Add blog settings section
*/
private function add_blog_settings_section() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_blog_layout',
array(
'title' => apply_filters( 'hestia_blog_layout_control_label', esc_html__( 'Blog Settings', 'hestia' ) ),
'priority' => 30,
)
)
);
}
/**
* Add category dropdown control
*/
private function add_featured_posts_category_dropdown() {
$options = array(
0 => ' -- ' . esc_html__( 'Disable section', 'hestia' ) . ' -- ',
);
$categories = get_categories();
if ( ! empty( $categories ) ) {
foreach ( $categories as $category ) {
$cat_id = $category->term_id;
$cat_name = $category->name;
$options[ $cat_id ] = $cat_name;
}
}
$this->add_control(
new Hestia_Customizer_Control(
'hestia_featured_posts_category',
array(
'sanitize_callback' => 'hestia_sanitize_array',
'default' => apply_filters( 'hestia_featured_posts_category_default', 0 ),
),
array(
'type' => 'select',
'section' => 'hestia_blog_layout',
'label' => esc_html__( 'Featured Posts', 'hestia' ),
'choices' => $options,
'priority' => 10,
)
)
);
}
}
general/class-hestia-typography-controls.php 0000666 00000027032 15112345375 0015335 0 ustar 00 <?php
/**
* Customizer typography controls.
*
* @package Hestia
*/
/**
* Class Hestia_Typography_Controls
*/
class Hestia_Typography_Controls extends Hestia_Register_Customizer_Controls {
/**
* Initialize the scripts and anything needed.
*/
public function init() {
parent::init();
add_action( 'customize_preview_init', array( $this, 'enqueue_customizer_script' ) );
}
/**
* Add controls
*/
public function add_controls() {
$this->add_typography_section();
$this->add_section_ui_tabs();
$this->add_font_family_selectors();
$this->add_font_subsets_control();
$this->add_section_ui_headings();
$this->add_posts_pages_controls();
$this->add_front_page_controls();
}
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*
* @since 1.1.38
*/
public function enqueue_customizer_script() {
wp_enqueue_script( 'hestia_customizer_typography', get_template_directory_uri() . '/assets/js/admin/typography-customizer-preview.js', array( 'customize-preview' ), HESTIA_VERSION, true );
}
/**
* Add the customizer section.
*/
private function add_typography_section() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_typography', array(
'title' => esc_html__( 'Typography', 'hestia' ),
'panel' => 'hestia_appearance_settings',
'priority' => 25,
)
)
);
}
/**
* Add ui tabs
*/
private function add_section_ui_tabs() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_typography_tabs', array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_typography',
'priority' => 1,
'tabs' => array(
'font_family' => array(
'label' => esc_html__( 'font family', 'hestia' ),
'icon' => 'font',
),
'font_sizes' => array(
'label' => esc_html__( 'font size', 'hestia' ),
'icon' => 'text-height',
),
),
'controls' => array(
'font_family' => array(
'hestia_headings_font' => array(),
'hestia_body_font' => array(),
'hestia_font_subsets' => array(),
),
'font_sizes' => array(
'hestia_posts_and_pages_title' => array(),
'hestia_header_titles_fs' => array(),
'hestia_post_page_headings_fs' => array(),
'hestia_post_page_content_fs' => array(),
'hestia_frontpage_sections_title' => array(),
'hestia_big_title_fs' => array(),
'hestia_section_primary_headings_fs' => array(),
'hestia_section_secondary_headings_fs' => array(),
'hestia_section_content_fs' => array(),
'hestia_generic_title' => array(),
'hestia_menu_fs' => array(),
),
),
),
'Hestia_Customize_Control_Tabs'
)
);
}
/**
*
* ---------------------------------
* 1.a. Headings font family control
* This control allows the user to choose a font family for all Headings used in the theme ( h1 - h6 )
* ---------------------------------
* 1.b. Body font family control
* This control allows the user to choose a font family for all elements in the body tag
* --------------------------------
*/
private function add_font_family_selectors() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_headings_font', array(
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Headings', 'hestia' ) . ' ' . esc_html__( 'font family', 'hestia' ),
'section' => 'hestia_typography',
'priority' => 5,
'type' => 'select',
),
'Hestia_Font_Selector'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_body_font',
array(
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_text_field',
),
array(
'label' => esc_html__( 'Body', 'hestia' ) . ' ' . esc_html__( 'font family', 'hestia' ),
'section' => 'hestia_typography',
'priority' => 10,
'type' => 'select',
),
'Hestia_Font_Selector'
)
);
}
/**
* This control allows the user to choose a subset for the font family ( for e.g. lating, cyrillic etc )
*/
private function add_font_subsets_control() {
/**
* Font Subsets control
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_font_subsets', array(
'sanitize_callback' => 'hestia_sanitize_array',
'default' => array( 'latin' ),
),
array(
'section' => 'hestia_typography',
'label' => esc_html__( 'Font Subsets', 'hestia' ),
'choices' => array(
'latin' => 'latin',
'latin-ext' => 'latin-ext',
'cyrillic' => 'cyrillic',
'cyrillic-ext' => 'cyrillic-ext',
'greek' => 'greek',
'greek-ext' => 'greek-ext',
'vietnamese' => 'vietnamese',
),
'priority' => 45,
),
'Hestia_Select_Multiple'
)
);
}
/**
* Add headings
*/
private function add_section_ui_headings() {
$this->add_control(
new Hestia_Customizer_Control(
'hestia_posts_and_pages_title',
array(
'sanitize_callback' => 'wp_kses',
),
array(
'label' => esc_html__( 'Posts & Pages', 'hestia' ),
'section' => 'hestia_typography',
'priority' => 100,
),
'Hestia_Customizer_Heading'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_frontpage_sections_title',
array(
'sanitize_callback' => 'wp_kses',
),
array(
'label' => esc_html__( 'Frontpage Sections', 'hestia' ),
'section' => 'hestia_typography',
'priority' => 200,
),
'Hestia_Customizer_Heading'
)
);
}
/**
* Font size controls for Posts & Pages
*/
private function add_posts_pages_controls() {
/**
* Title control [Posts & Pages]
* This control allows the user to choose a font size for the main titles
* that appear in the header for pages and posts.
*
* The values area between -25 and +25 px.
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_header_titles_fs', array(
'sanitize_callback' => 'hestia_sanitize_range_value',
'default' => '0',
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Title', 'hestia' ),
'section' => 'hestia_typography',
'type' => 'range-value',
'input_attr' => array(
'min' => - 25,
'max' => 25,
'step' => 1,
),
'priority' => 110,
'media_query' => true,
'sum_type' => true,
),
'Hestia_Customizer_Range_Value_Control'
)
);
/**
* Headings control [Posts & Pages]
*
* This control allows the user to choose a font size for all headings
* ( h1 - h6 ) from pages and posts.
*
* The values area between -25 and +25 px.
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_post_page_headings_fs', array(
'sanitize_callback' => 'hestia_sanitize_range_value',
'default' => 0,
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Headings', 'hestia' ),
'section' => 'hestia_typography',
'type' => 'range-value',
'input_attr' => array(
'min' => -25,
'max' => 25,
'step' => 1,
),
'priority' => 115,
'sum_type' => true,
),
'Hestia_Customizer_Range_Value_Control'
)
);
/**
* Content control [Posts & Pages]
*
* This control allows the user to choose a font size for the main content
* area in pages and posts.
*
* The values area between -25 and +25 px.
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_post_page_content_fs',
array(
'sanitize_callback' => 'hestia_sanitize_range_value',
'default' => 0,
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Content', 'hestia' ),
'section' => 'hestia_typography',
'type' => 'range-value',
'input_attr' => array(
'min' => -25,
'max' => 25,
'step' => 1,
),
'priority' => 120,
'sum_type' => true,
),
'Hestia_Customizer_Range_Value_Control'
)
);
}
/**
* Font size controls for Front Page
*/
private function add_front_page_controls() {
/**
* Big Title Section / Header Slider font size control. [Front Page Sections]
*
* This is changing the big title/slider titles, the
* subtitle and the button in the big title section.
*
* The values are between -25 and +25 px.
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_big_title_fs', array(
'sanitize_callback' => 'hestia_sanitize_range_value',
'default' => '0',
'transport' => $this->selective_refresh,
),
array(
'label' => apply_filters( 'hestia_big_title_fs_label', esc_html__( 'Big Title Section', 'hestia' ) ),
'section' => 'hestia_typography',
'type' => 'range-value',
'input_attr' => array(
'min' => -25,
'max' => 25,
'step' => 1,
),
'priority' => 210,
'sum_type' => true,
),
'Hestia_Customizer_Range_Value_Control'
)
);
/**
* Section Title [Front Page Sections]
*
* This control is changing sections titles and card titles
* The values are between -25 and +25 px.
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_section_primary_headings_fs',
array(
'sanitize_callback' => 'hestia_sanitize_range_value',
'default' => '0',
'transport' => 'postMessage',
),
array(
'label' => esc_html__( 'Section Title', 'hestia' ),
'section' => 'hestia_typography',
'type' => 'range-value',
'input_attr' => array(
'min' => -25,
'max' => 25,
'step' => 1,
),
'priority' => 215,
'sum_type' => true,
),
'Hestia_Customizer_Range_Value_Control'
)
);
/**
* Subtitles control [Front Page Sections]
*
* This control allows the user to choose a font size
* for all Subtitles on Front Page sections.
* The values area between -25 and +25 px.
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_section_secondary_headings_fs',
array(
'sanitize_callback' => 'hestia_sanitize_range_value',
'default' => 0,
'transport' => $this->selective_refresh,
),
array(
'label' => esc_html__( 'Section Subtitle', 'hestia' ),
'section' => 'hestia_typography',
'type' => 'range-value',
'input_attr' => array(
'min' => -25,
'max' => 25,
'step' => 1,
),
'priority' => 220,
'sum_type' => true,
),
'Hestia_Customizer_Range_Value_Control'
)
);
/**
* Content control [Front Page Sections]
*
* This control allows the user to choose a font size
* for the Main content for Frontpage Sections
* The values area between -25 and +25 px.
*/
$this->add_control(
new Hestia_Customizer_Control(
'hestia_section_content_fs',
array(
'sanitize_callback' => 'hestia_sanitize_range_value',
'default' => 0,
'transport' => 'postMessage',
),
array(
'label' => esc_html__( 'Content', 'hestia' ),
'section' => 'hestia_typography',
'type' => 'range-value',
'input_attr' => array(
'min' => -25,
'max' => 25,
'step' => 1,
),
'priority' => 225,
'sum_type' => true,
),
'Hestia_Customizer_Range_Value_Control'
)
);
}
}
general/class-hestia-upsell-manager.php 0000666 00000010442 15112345375 0014177 0 ustar 00 <?php
/**
* Upsell Manager
*
* @package Hestia
*/
/**
* Class Hestia_Upsell_Manager
*/
class Hestia_Upsell_Manager extends Hestia_Register_Customizer_Controls {
/**
* Add the controls.
*/
public function add_controls() {
if ( ! $this->should_display_upsells() ) {
return;
}
$this->register_type( 'Hestia_Section_Upsell', 'section' );
$this->register_type( 'Hestia_Control_Upsell', 'control' );
$this->add_main_upsell();
$this->add_front_page_sections_upsells();
}
/**
* Change controls
*/
public function change_controls() {
$this->change_customizer_object( 'section', 'hestia_front_page_sections_upsell_section', 'active_callback', '__return_true' );
}
/**
* Adds main
*/
private function add_main_upsell() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_upsell_main_section',
array(
'title' => esc_html__( 'View PRO Features', 'hestia' ),
'priority' => 0,
)
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_upsell_main_control',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_upsell_main_section',
'priority' => 100,
'options' => array(
esc_html__( 'Header Slider', 'hestia' ),
esc_html__( 'Fully Customizable Colors', 'hestia' ),
esc_html__( 'Jetpack Portfolio', 'hestia' ),
esc_html__( 'Pricing Plans Section', 'hestia' ),
esc_html__( 'Section Reordering', 'hestia' ),
esc_html__( 'Quality Support', 'hestia' ),
),
'explained_features' => array(
esc_html__( 'You will be able to add more content to your site header with an awesome slider.', 'hestia' ),
esc_html__( 'Change colors for the header overlay, header text and navbar.', 'hestia' ),
esc_html__( 'Portfolio section with two possible layouts.', 'hestia' ),
esc_html__( 'A fully customizable pricing plans section.', 'hestia' ),
esc_html__( 'Drag and drop panels to change the order of sections.', 'hestia' ),
esc_html__( 'The ability to reorganize your Frontpage Sections more easily and quickly.', 'hestia' ),
esc_html__( '24/7 HelpDesk Professional Support', 'hestia' ),
),
'button_url' => esc_url( apply_filters( 'hestia_upgrade_link_from_child_theme_filter', 'https://themeisle.com/themes/hestia-pro/upgrade/' ) ),
'button_text' => esc_html__( 'Get the PRO version!', 'hestia' ),
),
'Hestia_Control_Upsell'
)
);
}
/**
* Add upsell section under Front Page Sections panel.
*/
private function add_front_page_sections_upsells() {
$this->add_section(
new Hestia_Customizer_Section(
'hestia_front_page_sections_upsell_section',
array(
'panel' => 'hestia_frontpage_sections',
'priority' => 500,
'options' => array(
esc_html__( 'Jetpack Portfolio', 'hestia' ),
esc_html__( 'Pricing Plans Section', 'hestia' ),
esc_html__( 'Section Reordering', 'hestia' ),
),
'button_url' => esc_url( apply_filters( 'hestia_upgrade_link_from_child_theme_filter', 'https://themeisle.com/themes/hestia-pro/upgrade/' ) ),
'button_text' => esc_html__( 'Get the PRO version!', 'hestia' ),
'explained_features' => array(
esc_html__( 'Portfolio section with two possible layouts.', 'hestia' ),
esc_html__( 'A fully customizable pricing plans section.', 'hestia' ),
esc_html__( 'The ability to reorganize your Frontpage sections more easily and quickly.', 'hestia' ),
),
),
'Hestia_Section_Upsell'
)
);
$this->add_control(
new Hestia_Customizer_Control(
'hestia_control_to_enable_upsell_section',
array(
'sanitize_callback' => 'sanitize_text_field',
),
array(
'section' => 'hestia_front_page_sections_upsell_section',
'type' => 'hidden',
)
)
);
}
/**
* Check if should display upsell.
*
* @since 1.1.45
* @access public
* @return bool
*/
private function should_display_upsells() {
$current_time = time();
$show_after = 12 * HOUR_IN_SECONDS;
$activation_time = get_option( 'hestia_time_activated' );
if ( empty( $activation_time ) ) {
return false;
}
if ( $current_time < $activation_time + $show_after ) {
return false;
}
return true;
}
}
class-hestia-customizer-panel.php 0000666 00000001067 15113513342 0013142 0 ustar 00 <?php
/**
* Customizer panel type enforcement
*
* @package Hestia
*/
/**
* Class Hestia_Customizer_Panel
*/
class Hestia_Customizer_Panel {
/**
* ID of panel
*
* @var string the control ID.
*/
public $id;
/**
* Args for panel instance.
*
* @var array args passed into panel instance.
*/
public $args = array();
/**
* Hestia_Customizer_Panel constructor.
*
* @param string $id the control id.
* @param array $args the panel args.
*/
public function __construct( $id, $args ) {
$this->id = $id;
$this->args = $args;
}
}
class-hestia-customizer-control.php 0000666 00000002515 15113513342 0013522 0 ustar 00 <?php
/**
* Customizer control type enforcement.
*
* @package Hestia
*/
/**
* Class Hestia_Customizer_Control
*/
class Hestia_Customizer_Control {
/**
* Control ID
*
* @var string the control ID.
*/
public $id;
/**
* Setting arguments.
*
* @var array args passed into settings.
*/
public $setting_args = array();
/**
* Control arguments.
*
* @var array args passed into controls.
*/
public $control_args = array();
/**
* Custom control if applies.
*
* @var null|string
*/
public $custom_control = null;
/**
* The Partials array
*
* @var null|array
*/
public $partial = null;
/**
* Hestia_Customizer_Control constructor.
*
* @param string $id the control id.
* @param array $setting_args the add_setting array.
* @param array $control_args the add_control array.
* @param string $custom_control [optional] this should be added if the control is a custom control.
* @param array $partial [optional] this should be added if the control is a selective refresh control..
*/
public function __construct( $id, $setting_args, $control_args, $custom_control = null, $partial = null ) {
$this->id = $id;
$this->setting_args = $setting_args;
$this->control_args = $control_args;
$this->custom_control = $custom_control;
$this->partial = $partial;
}
}
class-hestia-customizer-partial.php 0000666 00000001221 15113513342 0013467 0 ustar 00 <?php
/**
* Customizer partial type enforcing.
*
* @package Hestia
*/
/**
* Class Hestia_Customizer_Partial
*/
class Hestia_Customizer_Partial {
/**
* ID of control that will be attached to. Also ID of the partial itself.
*
* @var string the control ID.
*/
public $control_id;
/**
* Args for the partial.
*
* @var array args passed into partial.
*/
public $args = array();
/**
* Hestia_Customizer_Partial constructor.
*
* @param string $control_id the control id.
* @param array $args the partial args.
*/
public function __construct( $control_id, $args ) {
$this->id = $control_id;
$this->args = $args;
}
}
class-hestia-customizer-section.php 0000666 00000001565 15113513342 0013512 0 ustar 00 <?php
/**
* Customizer Section type Enforcing.
*
* @package Hestia
*/
/**
* Class Hestia_Customizer_Section
*/
class Hestia_Customizer_Section {
/**
* ID of section
*
* @var string the control ID.
*/
public $id;
/**
* Args for section instance.
*
* @var array args passed into section.
*/
public $args = array();
/**
* Custom section ( string of class name | null)
*
* @var null|string
*/
public $custom_section = null;
/**
* Hestia_Customizer_Section constructor.
*
* @param string $id the control id.
* @param array $args the add_section array.
* @param string $custom_section [optional] this should be added if the section is a custom section.
*/
public function __construct( $id, $args, $custom_section = null ) {
$this->id = $id;
$this->args = $args;
$this->custom_section = $custom_section;
}
}
text_mode_light.svg 0000666 00000002142 15113664215 0010453 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?>
<svg width="150px" height="150px" viewBox="0 0 150 150" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 48.2 (47327) - http://www.bohemiancoding.com/sketch -->
<title>text_mode_light</title>
<desc>Created with Sketch.</desc>
<defs>
<rect id="path-1" x="0" y="0" width="150" height="150" rx="6"></rect>
</defs>
<g id="Desktop" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-230.000000, -416.000000)">
<g id="text_mode_light" transform="translate(230.000000, 416.000000)">
<g id="wrapper">
<use fill="#0085BA" fill-rule="evenodd" xlink:href="#path-1"></use>
<rect stroke="#0085BA" stroke-width="1" x="0.5" y="0.5" width="149" height="149" rx="6"></rect>
</g>
<text id="Text" font-family="AvenirNext-Medium, Avenir Next" font-size="48" font-weight="400" fill="#FFFFFF">
<tspan x="30.476" y="86">Text</tspan>
</text>
</g>
</g>
</svg>