updated theme GeneratePress version 3.0.2

This commit is contained in:
2020-10-20 15:16:18 +00:00
committed by Gitium
parent dcc1a6ca18
commit 1047e0b29f
129 changed files with 16624 additions and 8924 deletions

View File

@ -12,9 +12,13 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customize_Width_Slider_Control' ) ) {
/**
* Create our container width slider control
*
* @deprecated 1.3.47
*/
class Generate_Customize_Width_Slider_Control extends WP_Customize_Control {
/**
* Render content.
*/
public function render_content() {}
}
}
@ -22,10 +26,14 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customi
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'GenerateLabelControl' ) ) {
/**
* Heading area
*
* @since 0.1
* @depreceted 1.3.41
**/
class GenerateLabelControl extends WP_Customize_Control {
class GenerateLabelControl extends WP_Customize_Control { // phpcs:ignore
/**
* Render content.
*/
public function render_content() {}
}
}
@ -34,14 +42,25 @@ if ( ! class_exists( 'Generate_Google_Font_Dropdown_Custom_Control' ) ) {
/**
* A class to create a dropdown for all google fonts
*/
class Generate_Google_Font_Dropdown_Custom_Control extends WP_Customize_Control {
class Generate_Google_Font_Dropdown_Custom_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Set type.
*
* @var $type
*/
public $type = 'gp-customizer-fonts';
/**
* Enqueue scripts.
*/
public function enqueue() {
wp_enqueue_script( 'generatepress-customizer-fonts', trailingslashit( get_template_directory_uri() ) . 'inc/js/typography-controls.js', array( 'customize-controls' ), GENERATE_VERSION, true );
wp_localize_script( 'generatepress-customizer-fonts', 'gp_customize', array( 'nonce' => wp_create_nonce( 'gp_customize_nonce' ) ) );
}
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
@ -50,11 +69,14 @@ if ( ! class_exists( 'Generate_Google_Font_Dropdown_Custom_Control' ) ) {
$this->json['value'] = $this->value();
$this->json['default_fonts_title'] = __( 'Default fonts', 'generatepress' );
$this->json['google_fonts_title'] = __( 'Google fonts', 'generatepress' );
$this->json['description'] = __( 'Font family','generatepress' );
$this->json['description'] = __( 'Font family', 'generatepress' );
$this->json['google_fonts'] = apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) );
$this->json['default_fonts'] = generate_typography_default_fonts();
}
/**
* Render content.
*/
public function content_template() {
?>
<label>
@ -83,10 +105,24 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
/**
* A class to create a dropdown for font weight
*/
class Generate_Select_Control extends WP_Customize_Control {
class Generate_Select_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Set type.
*
* @var $type
*/
public $type = 'gp-typography-select';
/**
* Set choices.
*
* @var $choices
*/
public $choices = array();
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
@ -100,6 +136,9 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
}
/**
* Render content.
*/
public function content_template() {
?>
<# if ( ! data.choices )
@ -122,13 +161,26 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
/**
* Create our hidden input control
* Create our hidden input control
*/
class Generate_Hidden_Input_Control extends WP_Customize_Control {
// Setup control type
class Generate_Hidden_Input_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Set type.
*
* @var $type
*/
public $type = 'gp-hidden-input';
/**
* Set ID
*
* @var $id
*/
public $id = '';
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
$this->json['link'] = $this->get_link();
@ -136,6 +188,9 @@ if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
$this->json['id'] = $this->id;
}
/**
* Render content.
*/
public function content_template() {
?>
<input name="{{ data.id }}" type="text" {{{ data.link }}} value="{{{ data.value }}}" class="gp-hidden-input" />
@ -147,84 +202,102 @@ if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
if ( ! class_exists( 'Generate_Font_Weight_Custom_Control' ) ) {
/**
* A class to create a dropdown for font weight
*
* @deprecated since 1.3.40
*/
class Generate_Font_Weight_Custom_Control extends WP_Customize_Control {
public function __construct( $manager, $id, $args = array(), $options = array() ) {
parent::__construct( $manager, $id, $args );
}
class Generate_Font_Weight_Custom_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Render the content of the category dropdown
* Construct.
*
* @return HTML
* @param object $manager The manager.
* @param int $id The ID.
* @param array $args The args.
* @param array $options The options.
*/
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf('<option value="%s" %s>%s</option>', 'normal', selected($this->value(), 'normal', false), 'normal');
printf('<option value="%s" %s>%s</option>', 'bold', selected($this->value(), 'bold', false), 'bold');
printf('<option value="%s" %s>%s</option>', '100', selected($this->value(), '100', false), '100');
printf('<option value="%s" %s>%s</option>', '200', selected($this->value(), '200', false), '200');
printf('<option value="%s" %s>%s</option>', '300', selected($this->value(), '300', false), '300');
printf('<option value="%s" %s>%s</option>', '400', selected($this->value(), '400', false), '400');
printf('<option value="%s" %s>%s</option>', '500', selected($this->value(), '500', false), '500');
printf('<option value="%s" %s>%s</option>', '600', selected($this->value(), '600', false), '600');
printf('<option value="%s" %s>%s</option>', '700', selected($this->value(), '700', false), '700');
printf('<option value="%s" %s>%s</option>', '800', selected($this->value(), '800', false), '800');
printf('<option value="%s" %s>%s</option>', '900', selected($this->value(), '900', false), '900');
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Text_Transform_Custom_Control' ) ) {
/**
* A class to create a dropdown for text-transform
* @deprecated since 1.3.40
*/
class Generate_Text_Transform_Custom_Control extends WP_Customize_Control {
public function __construct( $manager, $id, $args = array(), $options = array() ) {
parent::__construct( $manager, $id, $args );
}
/**
* Render the content of the category dropdown
*
* @return HTML
*/
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf('<option value="%s" %s>%s</option>', 'none', selected($this->value(), 'none', false), 'none');
printf('<option value="%s" %s>%s</option>', 'capitalize', selected($this->value(), 'capitalize', false), 'capitalize');
printf('<option value="%s" %s>%s</option>', 'uppercase', selected($this->value(), 'uppercase', false), 'uppercase');
printf('<option value="%s" %s>%s</option>', 'lowercase', selected($this->value(), 'lowercase', false), 'lowercase');
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf( '<option value="%s" %s>%s</option>', 'normal', selected( $this->value(), 'normal', false ), 'normal' );
printf( '<option value="%s" %s>%s</option>', 'bold', selected( $this->value(), 'bold', false ), 'bold' );
printf( '<option value="%s" %s>%s</option>', '100', selected( $this->value(), '100', false ), '100' );
printf( '<option value="%s" %s>%s</option>', '200', selected( $this->value(), '200', false ), '200' );
printf( '<option value="%s" %s>%s</option>', '300', selected( $this->value(), '300', false ), '300' );
printf( '<option value="%s" %s>%s</option>', '400', selected( $this->value(), '400', false ), '400' );
printf( '<option value="%s" %s>%s</option>', '500', selected( $this->value(), '500', false ), '500' );
printf( '<option value="%s" %s>%s</option>', '600', selected( $this->value(), '600', false ), '600' );
printf( '<option value="%s" %s>%s</option>', '700', selected( $this->value(), '700', false ), '700' );
printf( '<option value="%s" %s>%s</option>', '800', selected( $this->value(), '800', false ), '800' );
printf( '<option value="%s" %s>%s</option>', '900', selected( $this->value(), '900', false ), '900' );
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Text_Transform_Custom_Control' ) ) {
/**
* A class to create a dropdown for text-transform
*
* @deprecated since 1.3.40
*/
class Generate_Text_Transform_Custom_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Construct.
*
* @param object $manager The manager.
* @param int $id The ID.
* @param array $args The args.
* @param array $options The options.
*/
public function __construct( $manager, $id, $args = array(), $options = array() ) {
parent::__construct( $manager, $id, $args );
}
/**
* Render the content of the category dropdown
*/
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf( '<option value="%s" %s>%s</option>', 'none', selected( $this->value(), 'none', false ), 'none' );
printf( '<option value="%s" %s>%s</option>', 'capitalize', selected( $this->value(), 'capitalize', false ), 'capitalize' );
printf( '<option value="%s" %s>%s</option>', 'uppercase', selected( $this->value(), 'uppercase', false ), 'uppercase' );
printf( '<option value="%s" %s>%s</option>', 'lowercase', selected( $this->value(), 'lowercase', false ), 'lowercase' );
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Customize_Slider_Control' ) ) {
/**
* Create our container width slider control
*
* @deprecated 1.3.47
*/
class Generate_Customize_Slider_Control extends WP_Customize_Control {
class Generate_Customize_Slider_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Render content.
*/
public function render_content() {}
}
}

View File

@ -25,9 +25,22 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
*/
public $type = 'generatepress-range-slider';
/**
* The control description.
*
* @access public
* @var string
*/
public $description = '';
/**
* The control sub-description.
*
* @access public
* @var string
*/
public $sub_description = '';
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
@ -36,7 +49,7 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
public function to_json() {
parent::to_json();
$devices = array( 'desktop','tablet','mobile' );
$devices = array( 'desktop', 'tablet', 'mobile' );
foreach ( $devices as $device ) {
$this->json['choices'][ $device ]['min'] = ( isset( $this->choices[ $device ]['min'] ) ) ? $this->choices[ $device ]['min'] : '0';
$this->json['choices'][ $device ]['max'] = ( isset( $this->choices[ $device ]['max'] ) ) ? $this->choices[ $device ]['max'] : '100';
@ -53,10 +66,10 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
);
}
$this->json['desktop_label'] = __( 'Desktop','generatepress' );
$this->json['tablet_label'] = __( 'Tablet','generatepress' );
$this->json['mobile_label'] = __( 'Mobile','generatepress' );
$this->json['reset_label'] = __( 'Reset','generatepress' );
$this->json['desktop_label'] = __( 'Desktop', 'generatepress' );
$this->json['tablet_label'] = __( 'Tablet', 'generatepress' );
$this->json['mobile_label'] = __( 'Mobile', 'generatepress' );
$this->json['reset_label'] = __( 'Reset', 'generatepress' );
$this->json['description'] = $this->description;
$this->json['sub_description'] = $this->sub_description;
@ -68,8 +81,24 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
* @access public
*/
public function enqueue() {
wp_enqueue_script( 'generatepress-range-slider', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/slider-control.js', array( 'jquery', 'customize-base', 'jquery-ui-slider' ), false, true );
wp_enqueue_style( 'generatepress-range-slider-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/slider-customizer.css', null );
wp_enqueue_script(
'generatepress-range-slider',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/slider-control.js',
array(
'jquery',
'customize-base',
'jquery-ui-slider',
),
GENERATE_VERSION,
true
);
wp_enqueue_style(
'generatepress-range-slider-css',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/slider-customizer.css',
array(),
GENERATE_VERSION
);
}
/**

View File

@ -16,16 +16,57 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
* @since 2.0
*/
class Generate_Typography_Customize_Control extends WP_Customize_Control {
/**
* Set the type.
*
* @var string $type
*/
public $type = 'gp-customizer-typography';
/**
* Enqueue scripts.
*/
public function enqueue() {
wp_enqueue_script( 'generatepress-typography-selectWoo', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/selectWoo.min.js', array( 'customize-controls', 'jquery' ), GENERATE_VERSION, true );
wp_enqueue_style( 'generatepress-typography-selectWoo', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/selectWoo.min.css', array(), GENERATE_VERSION );
wp_enqueue_script(
'generatepress-typography-selectWoo',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/selectWoo.min.js',
array(
'customize-controls',
'jquery',
),
GENERATE_VERSION,
true
);
wp_enqueue_script( 'generatepress-typography-customizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/typography-customizer.js', array( 'customize-controls', 'generatepress-typography-selectWoo' ), GENERATE_VERSION, true );
wp_enqueue_style( 'generatepress-typography-customizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/typography-customizer.css', array(), GENERATE_VERSION );
wp_enqueue_style(
'generatepress-typography-selectWoo',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/selectWoo.min.css',
array(),
GENERATE_VERSION
);
wp_enqueue_script(
'generatepress-typography-customizer',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/typography-customizer.js',
array(
'customize-controls',
'generatepress-typography-selectWoo',
),
GENERATE_VERSION,
true
);
wp_enqueue_style(
'generatepress-typography-customizer',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/typography-customizer.css',
array(),
GENERATE_VERSION
);
}
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
@ -43,7 +84,7 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
'link' => $this->get_link( $setting_key ),
'value' => $this->value( $setting_key ),
'default' => isset( $setting_id->default ) ? $setting_id->default : '',
'id' => isset( $setting_id->id ) ? $setting_id->id : ''
'id' => isset( $setting_id->id ) ? $setting_id->id : '',
);
if ( 'weight' === $setting_key ) {
@ -56,6 +97,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
}
}
/**
* Render content.
*/
public function content_template() {
?>
<# if ( '' !== data.label ) { #>
@ -165,6 +209,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
<?php
}
/**
* Build font weight choices.
*/
public function get_font_weight_choices() {
return array(
'normal' => esc_html( 'normal' ),
@ -181,6 +228,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
);
}
/**
* Build text transform choices.
*/
public function get_font_transform_choices() {
return array(
'none' => esc_html( 'none' ),

View File

@ -17,20 +17,57 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customi
* @since 0.1
*/
class Generate_Customize_Misc_Control extends WP_Customize_Control {
/**
* Set description.
*
* @var public $description
*/
public $description = '';
/**
* Set URL.
*
* @var public $url
*/
public $url = '';
/**
* Set type.
*
* @var public $type
*/
public $type = 'addon';
/**
* Set label.
*
* @var public $label
*/
public $label = '';
/**
* Enqueue scripts.
*/
public function enqueue() {
wp_enqueue_style( 'generate-customizer-controls-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css', array(), GENERATE_VERSION );
wp_enqueue_style(
'generate-customizer-controls-css',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css',
array(),
GENERATE_VERSION
);
}
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
$this->json['url'] = esc_url( $this->url );
}
/**
* Render content.
*/
public function content_template() {
?>
<p class="description" style="margin-top: 5px;">{{{ data.description }}}</p>

View File

@ -17,11 +17,37 @@ if ( class_exists( 'WP_Customize_Section' ) && ! class_exists( 'GeneratePress_Up
* @since unknown
*/
class GeneratePress_Upsell_Section extends WP_Customize_Section {
/**
* Set type.
*
* @var public $type
*/
public $type = 'gp-upsell-section';
/**
* Set pro URL.
*
* @var public $pro_url
*/
public $pro_url = '';
/**
* Set pro text.
*
* @var public $pro_text
*/
public $pro_text = '';
/**
* Set ID.
*
* @var public $id
*/
public $id = '';
/**
* Send variables to json.
*/
public function json() {
$json = parent::json();
$json['pro_text'] = $this->pro_text;
@ -30,6 +56,9 @@ if ( class_exists( 'WP_Customize_Section' ) && ! class_exists( 'GeneratePress_Up
return $json;
}
/**
* Render content.
*/
protected function render_template() {
?>
<li id="accordion-section-{{ data.id }}" class="generate-upsell-accordion-section control-section-{{ data.type }} cannot-expand accordion-section">
@ -48,7 +77,19 @@ if ( ! function_exists( 'generate_customizer_controls_css' ) ) {
* @since 1.3.41
*/
function generate_customizer_controls_css() {
wp_enqueue_style( 'generate-customizer-controls-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css', array(), GENERATE_VERSION );
wp_enqueue_script( 'generatepress-upsell', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/upsell-control.js', array( 'customize-controls' ), false, true );
wp_enqueue_style(
'generate-customizer-controls-css',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css',
array(),
GENERATE_VERSION
);
wp_enqueue_script(
'generatepress-upsell',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/upsell-control.js',
array( 'customize-controls' ),
GENERATE_VERSION,
true
);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,142 +1,142 @@
.customize-control-generatepress-range-slider .generatepress-slider {
position: relative;
width: calc(100% - 60px);
height: 6px;
background-color: rgba(0,0,0,.10);
cursor: pointer;
-webkit-transition: background .5s;
-moz-transition: background .5s;
transition: background .5s;
}
.customize-control-generatepress-range-slider .has-unit .generatepress-slider {
width: calc(100% - 90px);
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value {
display: none;
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value + .generatepress-slider {
width: 100%;
}
.customize-control-generatepress-range-slider .generatepress-slider .ui-slider-handle {
height: 16px;
width: 16px;
background-color: #3498D9;
display: inline-block;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%) translateX(-4px);
transform: translateY(-50%) translateX(-4px);
border-radius: 50%;
cursor: pointer;
}
.gp-range-title-area {
display: flex;
}
.gp-range-slider-controls {
margin-left: auto;
}
.customize-control-generatepress-range-slider .wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.customize-control-generatepress-range-slider .gp_range_value {
font-size: 14px;
padding: 0;
font-weight: 400;
width: 50px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value {
width: 80px;
}
.customize-control-generatepress-range-slider .gp_range_value span.value {
font-size: 12px;
width: calc(100% - 2px);
text-align: center;
min-height: 30px;
background: #FFF;
line-height: 30px;
border: 1px solid #DDD;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value span.value {
width: calc(100% - 32px);
display: block;
}
.customize-control-generatepress-range-slider .gp_range_value .unit {
width: 29px;
text-align: center;
font-size: 12px;
line-height: 30px;
background: #fff;
border: 1px solid #ddd;
margin-left: 1px;
}
.customize-control-generatepress-range-slider .generatepress-range-slider-reset span {
font-size: 16px;
line-height: 22px;
}
.customize-control-generatepress-range-slider .gp_range_value input {
font-size: 12px;
padding: 0px;
text-align: center;
min-height: 30px;
height: auto;
border-radius: 0;
border-color: #ddd;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value input {
width: calc(100% - 30px);
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons {
cursor: pointer;
font-size: 11px;
width: 20px;
height: 20px;
line-height: 20px;
color: #222;
text-align: center;
position: relative;
top: 2px;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons:hover {
background: #fafafa;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons.selected {
background: #fff;
color: #222;
}
.customize-control-generatepress-range-slider .gp-device-controls > span:first-child:last-child {
display: none;
}
.customize-control-generatepress-range-slider .sub-description {
margin-top: 10px;
}
.customize-control-generatepress-range-slider .generatepress-slider {
position: relative;
width: calc(100% - 60px);
height: 6px;
background-color: rgba(0,0,0,.10);
cursor: pointer;
-webkit-transition: background .5s;
-moz-transition: background .5s;
transition: background .5s;
}
.customize-control-generatepress-range-slider .has-unit .generatepress-slider {
width: calc(100% - 90px);
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value {
display: none;
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value + .generatepress-slider {
width: 100%;
}
.customize-control-generatepress-range-slider .generatepress-slider .ui-slider-handle {
height: 16px;
width: 16px;
background-color: #3498D9;
display: inline-block;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%) translateX(-4px);
transform: translateY(-50%) translateX(-4px);
border-radius: 50%;
cursor: pointer;
}
.gp-range-title-area {
display: flex;
}
.gp-range-slider-controls {
margin-left: auto;
}
.customize-control-generatepress-range-slider .wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.customize-control-generatepress-range-slider .gp_range_value {
font-size: 14px;
padding: 0;
font-weight: 400;
width: 50px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value {
width: 80px;
}
.customize-control-generatepress-range-slider .gp_range_value span.value {
font-size: 12px;
width: calc(100% - 2px);
text-align: center;
min-height: 30px;
background: #FFF;
line-height: 30px;
border: 1px solid #DDD;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value span.value {
width: calc(100% - 32px);
display: block;
}
.customize-control-generatepress-range-slider .gp_range_value .unit {
width: 29px;
text-align: center;
font-size: 12px;
line-height: 30px;
background: #fff;
border: 1px solid #ddd;
margin-left: 1px;
}
.customize-control-generatepress-range-slider .generatepress-range-slider-reset span {
font-size: 16px;
line-height: 22px;
}
.customize-control-generatepress-range-slider .gp_range_value input {
font-size: 12px;
padding: 0px;
text-align: center;
min-height: 30px;
height: auto;
border-radius: 0;
border-color: #ddd;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value input {
width: calc(100% - 30px);
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons {
cursor: pointer;
font-size: 11px;
width: 20px;
height: 20px;
line-height: 20px;
color: #222;
text-align: center;
position: relative;
top: 2px;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons:hover {
background: #fafafa;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons.selected {
background: #fff;
color: #222;
}
.customize-control-generatepress-range-slider .gp-device-controls > span:first-child:last-child {
display: none;
}
.customize-control-generatepress-range-slider .sub-description {
margin-top: 10px;
}

View File

@ -1,47 +1,47 @@
.generatepress-font-family {
margin-bottom: 12px;
}
.generatepress-weight-transform-wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.generatepress-font-weight,
.generatepress-font-transform {
width: calc(50% - 5px);
}
span.select2-container.select2-container--default.select2-container--open li.select2-results__option {
margin:0;
}
span.select2-container.select2-container--default.select2-container--open{
z-index:999999;
}
.select2-selection__rendered li {
margin-bottom: 0;
}
.select2-container--default .select2-selection--single,
.select2-container--default.select2-container .select2-selection--multiple,
.select2-dropdown,
.select2-container--default .select2-selection--multiple .select2-selection__choice {
border-color: #ddd;
border-radius: 0;
}
.select2-container--default .select2-results__option[aria-selected=true] {
color: rgba(0,0,0,0.4);
}
#customize-control-font_heading_1_control,
#customize-control-font_heading_2_control,
#customize-control-font_heading_3_control {
margin-top: 20px;
}
.generatepress-font-family {
margin-bottom: 12px;
}
.generatepress-weight-transform-wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.generatepress-font-weight,
.generatepress-font-transform {
width: calc(50% - 5px);
}
span.select2-container.select2-container--default.select2-container--open li.select2-results__option {
margin:0;
}
span.select2-container.select2-container--default.select2-container--open{
z-index:999999;
}
.select2-selection__rendered li {
margin-bottom: 0;
}
.select2-container--default .select2-selection--single,
.select2-container--default.select2-container .select2-selection--multiple,
.select2-dropdown,
.select2-container--default .select2-selection--multiple .select2-selection__choice {
border-color: #ddd;
border-radius: 0;
}
.select2-container--default .select2-results__option[aria-selected=true] {
color: rgba(0,0,0,0.4);
}
#customize-control-font_heading_1_control,
#customize-control-font_heading_2_control,
#customize-control-font_heading_3_control {
margin-top: 20px;
}

View File

@ -44,11 +44,11 @@ li#accordion-section-generatepress_upsell_section {
border: none;
background: none;
font: normal 20px/1 dashicons;
speak: none;
speak: never;
display: block;
padding: 0;
text-indent: 0;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}

View File

@ -3,7 +3,7 @@
// Add callback for when the header_textcolor setting exists.
api( 'generate_settings[nav_position_setting]', function( setting ) {
var isNavFloated, linkSettingValueToControlActiveState;
var isNavFloated, isNavAlignable, setNavDropPointActiveState, setNavAlignmentsActiveState;
/**
* Determine whether the navigation is floating.
@ -18,12 +18,31 @@
return false;
};
/**
* Determine whether the navigation is align-able.
*
* @returns {boolean} Is floating?
*/
isNavAlignable = function() {
if ( 'nav-float-right' === setting.get() || 'nav-float-left' === setting.get() ) {
var navAsHeader = api.instance( 'generate_menu_plus_settings[navigation_as_header]' );
if ( navAsHeader && navAsHeader.get() ) {
return true;
}
return false;
}
return true;
};
/**
* Update a control's active state according to the navigation location setting's value.
*
* @param {wp.customize.Control} control
*/
linkSettingValueToControlActiveState = function( control ) {
setNavDropPointActiveState = function( control ) {
var setActiveState = function() {
control.active.set( isNavFloated() );
};
@ -49,33 +68,96 @@
setting.bind( setActiveState );
};
// Call linkSettingValueToControlActiveState on the navigation dropdown point.
api.control( 'generate_settings[nav_drop_point]', linkSettingValueToControlActiveState );
/**
* Update a control's active state according to the navigation location setting's value.
*
* @param {wp.customize.Control} control
*/
setNavAlignmentsActiveState = function( control ) {
var setActiveState = function() {
control.active.set( isNavAlignable() );
};
// FYI: With the following we can eliminate all of our PHP active_callback code.
control.active.validate = isNavAlignable;
// Set initial active state.
setActiveState();
/*
* Update activate state whenever the setting is changed.
* Even when the setting does have a refresh transport where the
* server-side active callback will manage the active state upon
* refresh, having this JS management of the active state will
* ensure that controls will have their visibility toggled
* immediately instead of waiting for the preview to load.
* This is especially important if the setting has a postMessage
* transport where changing the setting wouldn't normally cause
* the preview to refresh and thus the server-side active_callbacks
* would not get invoked.
*/
setting.bind( setActiveState );
};
api.control( 'generate_settings[nav_drop_point]', setNavDropPointActiveState );
api.control( 'generate_settings[nav_layout_setting]', setNavAlignmentsActiveState );
api.control( 'generate_settings[nav_inner_width]', setNavAlignmentsActiveState );
api.control( 'generate_settings[nav_alignment_setting]', setNavAlignmentsActiveState );
} );
var setOption = function( headerAlignment, navLocation, navAlignment ) {
if ( headerAlignment ) {
api.control( 'generate_settings[header_alignment_setting]' ).setting.set( headerAlignment );
var setOption = function( options ) {
if ( options.headerAlignment ) {
api.instance( 'generate_settings[header_alignment_setting]' ).set( options.headerAlignment );
}
if ( navLocation ) {
api.control( 'generate_settings[nav_position_setting]' ).setting.set( navLocation );
if ( options.navLocation ) {
api.instance( 'generate_settings[nav_position_setting]' ).set( options.navLocation );
}
if ( navAlignment ) {
api.control( 'generate_settings[nav_alignment_setting]' ).setting.set( navAlignment );
if ( options.navAlignment ) {
api.instance( 'generate_settings[nav_alignment_setting]' ).set( options.navAlignment );
}
if ( options.boxAlignment ) {
api.instance( 'generate_settings[container_alignment]' ).set( options.boxAlignment );
}
if ( options.siteTitleFontSize ) {
api.instance( 'generate_settings[site_title_font_size]' ).set( options.siteTitleFontSize );
}
if ( 'undefined' !== typeof options.hideSiteTagline ) {
api.instance( 'generate_settings[hide_tagline]' ).set( options.hideSiteTagline );
}
if ( options.headerPaddingTop ) {
api.instance( 'generate_spacing_settings[header_top]' ).set( options.headerPaddingTop );
}
if ( options.headerPaddingBottom ) {
api.instance( 'generate_spacing_settings[header_bottom]' ).set( options.headerPaddingBottom );
}
};
api( 'generate_header_helper', function( value ) {
var headerAlignment = false,
navLocation = false,
navAlignment = false;
navAlignment = false,
boxAlignment = false,
siteTitleFontSize = false,
hideSiteTagline = false,
headerPaddingTop = false,
headerPaddingBottom = false;
value.bind( function( newval ) {
var headerAlignmentSetting = api.control( 'generate_settings[header_alignment_setting]' ).setting;
var navLocationSetting = api.control( 'generate_settings[nav_position_setting]' ).setting;
var navAlignmentSetting = api.control( 'generate_settings[nav_alignment_setting]' ).setting;
var headerAlignmentSetting = api.instance( 'generate_settings[header_alignment_setting]' );
var navLocationSetting = api.instance( 'generate_settings[nav_position_setting]' );
var navAlignmentSetting = api.instance( 'generate_settings[nav_alignment_setting]' );
var boxAlignmentSetting = api.instance( 'generate_settings[container_alignment]' );
var siteTitleFontSizeSetting = api.instance( 'generate_settings[site_title_font_size]' );
var hideSiteTaglineSetting = api.instance( 'generate_settings[hide_tagline]' );
var headerPaddingTopSetting = api.instance( 'generate_spacing_settings[header_top]' );
var headerPaddingBottomSetting = api.instance( 'generate_spacing_settings[header_bottom]' );
if ( ! headerAlignmentSetting._dirty ) {
headerAlignment = headerAlignmentSetting.get();
@ -89,28 +171,109 @@
navAlignment = navAlignmentSetting.get();
}
if ( ! boxAlignmentSetting._dirty ) {
boxAlignment = boxAlignmentSetting.get();
}
if ( ! siteTitleFontSizeSetting._dirty ) {
siteTitleFontSize = siteTitleFontSizeSetting.get();
}
if ( ! hideSiteTaglineSetting._dirty ) {
hideSiteTagline = hideSiteTaglineSetting.get();
}
if ( ! headerPaddingTopSetting._dirty ) {
headerPaddingTop = headerPaddingTopSetting.get();
}
if ( ! headerPaddingBottomSetting._dirty ) {
headerPaddingBottom = headerPaddingBottomSetting.get();
}
var options = {
headerAlignment: generatepress_defaults.header_alignment_setting,
navLocation: generatepress_defaults.nav_position_setting,
navAlignment: generatepress_defaults.nav_alignment_setting,
boxAlignment: generatepress_defaults.container_alignment,
siteTitleFontSize: generatepress_typography_defaults.site_title_font_size,
hideSiteTagline: generatepress_defaults.hide_tagline,
headerPaddingTop: generatepress_spacing_defaults.header_top,
headerPaddingBottom: generatepress_spacing_defaults.header_bottom,
};
if ( 'current' === newval ) {
setOption( headerAlignment, navLocation, navAlignment );
options = {
headerAlignment: headerAlignment,
navLocation: navLocation,
navAlignment: navAlignment,
boxAlignment: boxAlignment,
siteTitleFontSize: siteTitleFontSize,
hideSiteTagline: hideSiteTagline,
headerPaddingTop: headerPaddingTop,
headerPaddingBottom: headerPaddingBottom,
};
setOption( options );
}
if ( 'default' === newval ) {
setOption( generatepress_defaults.header_alignment_setting, generatepress_defaults.nav_position_setting, generatepress_defaults.nav_alignment_setting );
setOption( options );
}
if ( 'classic' === newval ) {
var options = {
headerAlignment: 'left',
navLocation: 'nav-below-header',
navAlignment: 'left',
boxAlignment: 'boxes',
siteTitleFontSize: '45',
hideSiteTagline: '',
headerPaddingTop: '40',
headerPaddingBottom: '40',
};
setOption( options );
}
if ( 'nav-before' === newval ) {
options['headerAlignment'] = 'left';
options['navLocation'] = 'nav-above-header';
options['navAlignment'] = 'left';
setOption( options );
}
if ( 'nav-after' === newval ) {
options['headerAlignment'] = 'left';
options['navLocation'] = 'nav-below-header';
options['navAlignment'] = 'left';
setOption( options );
}
if ( 'nav-before-centered' === newval ) {
setOption( 'center', 'nav-above-header', 'center' );
options['headerAlignment'] = 'center';
options['navLocation'] = 'nav-above-header';
options['navAlignment'] = 'center';
setOption( options );
}
if ( 'nav-after-centered' === newval ) {
setOption( 'center', 'nav-below-header', 'center' );
}
options['headerAlignment'] = 'center';
options['navLocation'] = 'nav-below-header';
options['navAlignment'] = 'center';
if ( 'nav-right' === newval ) {
setOption( 'left', 'nav-float-right', 'left' );
setOption( options );
}
if ( 'nav-left' === newval ) {
setOption( 'right', 'nav-float-left', 'right' );
options['headerAlignment'] = 'left';
options['navLocation'] = 'nav-float-left';
options['navAlignment'] = 'right';
setOption( options );
}
} );
} );
@ -231,24 +394,24 @@
subMenuCurrentTextColorSetting.set( generatepress_color_defaults.subnavigation_text_current_color );
}
if ( 'white' === newval ) {
backgroundColorSetting.set( '#ffffff' );
textColorSetting.set( '#000000' );
if ( 'classic' === newval ) {
backgroundColorSetting.set( '#222222' );
textColorSetting.set( '#ffffff' );
backgroundColorHoverSetting.set( '#ffffff' );
textColorHoverSetting.set( '#8f919e' );
backgroundColorHoverSetting.set( '#3f3f3f' );
textColorHoverSetting.set( '#ffffff' );
currentBackgroundColorSetting.set( '#ffffff' );
currentTextColorSetting.set( '#8f919e' );
currentBackgroundColorSetting.set( '#3f3f3f' );
currentTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorSetting.set( '#f6f9fc' );
subMenuTextColorSetting.set( '#000000' );
subMenuBackgroundColorSetting.set( '#3f3f3f' );
subMenuTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorHoverSetting.set( '#f6f9fc' );
subMenuTextColorHoverSetting.set( '#8f919e' );
subMenuBackgroundColorHoverSetting.set( '#4f4f4f' );
subMenuTextColorHoverSetting.set( '#ffffff' );
subMenuCurrentBackgroundColorSetting.set( '#f6f9fc' );
subMenuCurrentTextColorSetting.set( '#8f919e' );
subMenuCurrentBackgroundColorSetting.set( '#4f4f4f' );
subMenuCurrentTextColorSetting.set( '#ffffff' );
}
if ( 'grey' === newval ) {

View File

@ -348,11 +348,6 @@ function generatepress_typography_live_update( id, selector, property, unit, med
generatepress_typography_live_update( 'heading_3_line_height', 'h3', 'line-height', 'em' );
}
/**
* Content layout
*/
generatepress_classes_live_update( 'content_layout_setting', [ 'one-container', 'separate-containers' ], 'body' );
/**
* Top bar width
*/
@ -432,18 +427,25 @@ function generatepress_typography_live_update( id, selector, property, unit, med
*/
wp.customize( 'generate_settings[nav_layout_setting]', function( value ) {
value.bind( function( newval ) {
var navLocation = wp.customize.value('generate_settings[nav_position_setting]')();
if ( $( 'body' ).hasClass( 'sticky-enabled' ) ) {
wp.customize.preview.send( 'refresh' );
} else {
var mainNavigation = $( '.main-navigation' );
if ( 'fluid-nav' == newval ) {
$( '.main-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
mainNavigation.removeClass( 'grid-container' ).removeClass( 'grid-parent' );
if ( 'full-width' !== wp.customize.value('generate_settings[nav_inner_width]')() ) {
$( '.main-navigation .inside-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
}
if ( 'contained-nav' == newval ) {
$( '.main-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
$( '.main-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
if ( ! mainNavigation.hasClass( 'has-branding' ) && generatepress_live_preview.isFlex && ( 'nav-float-right' === navLocation || 'nav-float-left' === navLocation ) ) {
return;
}
mainNavigation.addClass( 'grid-container' ).addClass( 'grid-parent' );
}
}
} );
@ -464,78 +466,33 @@ function generatepress_typography_live_update( id, selector, property, unit, med
} );
/**
* Navigation position
* Navigation alignment
*/
wp.customize( 'generate_settings[nav_position_setting]', function( value ) {
wp.customize( 'generate_settings[nav_alignment_setting]', function( value ) {
value.bind( function( newval ) {
$( 'body' ).trigger( 'generate_navigation_location_updated' );
var classes = [ 'left', 'center', 'right' ];
var selector = 'body';
var prefix = 'nav-aligned-';
// Update navigation alignment settings.
$( 'body' ).removeClass( 'nav-aligned-center' );
$( 'body' ).removeClass( 'nav-aligned-left' );
$( 'body' ).removeClass( 'nav-aligned-right' );
$( 'body' ).addClass( 'nav-aligned-' + wp.customize.value('generate_settings[nav_alignment_setting]')() );
if ( $( '.gen-sidebar-nav' ).length ) {
wp.customize.preview.send( 'refresh' );
return false;
}
if ( 'nav-left-sidebar' == newval ) {
wp.customize.preview.send( 'refresh' );
return false;
}
if ( 'nav-right-sidebar' == newval ) {
wp.customize.preview.send( 'refresh' );
return false;
if ( generatepress_live_preview.isFlex ) {
selector = '.main-navigation:not(.slideout-navigation)';
prefix = 'nav-align-';
}
if ( '' !== wp.customize.value('generate_settings[nav_drop_point]')() ) {
wp.customize.preview.send( 'refresh' );
return false;
}
jQuery.each( classes, function( i, v ) {
jQuery( selector ).removeClass( prefix + v );
});
var classes = [ 'nav-below-header', 'nav-above-header', 'nav-float-right', 'nav-float-left', 'nav-left-sidebar', 'nav-right-sidebar' ];
if ( 'nav-left-sidebar' !== newval && 'nav-right-sidebar' !== newval ) {
$.each( classes, function( i, v ) {
$( 'body' ).removeClass( v );
});
}
$( 'body' ).addClass( newval );
if ( 'nav-below-header' == newval ) {
$( '#site-navigation:first' ).insertAfter( '.site-header' ).show();
}
if ( 'nav-above-header' == newval ) {
if ( $( '.top-bar:not(.secondary-navigation .top-bar)' ).length ) {
$( '#site-navigation:first' ).insertAfter( '.top-bar' ).show();
} else {
$( '#site-navigation:first' ).prependTo( 'body' ).show();
}
}
if ( 'nav-float-right' == newval ) {
if ( ! $( 'body' ).hasClass( 'using-floats' ) && $( '.header-widget' ).length ) {
$( '#site-navigation:first' ).insertBefore( '.header-widget' ).show();
} else {
$( '#site-navigation:first' ).appendTo( '.inside-header' ).show();
}
}
if ( 'nav-float-left' == newval ) {
$( '#site-navigation:first' ).appendTo( '.inside-header' ).show();
}
if ( '' == newval ) {
if ( $( '.gen-sidebar-nav' ).length ) {
wp.customize.preview.send( 'refresh' );
} else {
$( '#site-navigation:first' ).hide();
if ( generatepress_live_preview.isFlex && generatepress_live_preview.isRTL ) {
jQuery( selector ).addClass( prefix + newval );
} else {
if ( 'nav-align-left' !== prefix + newval ) {
jQuery( selector ).addClass( prefix + newval );
}
}
} );
} );
/**
* Navigation alignment
*/
generatepress_classes_live_update( 'nav_alignment_setting', [ 'left', 'center', 'right' ], 'body', 'nav-aligned-' );
/**
* Footer width
*/
@ -582,10 +539,11 @@ function generatepress_typography_live_update( id, selector, property, unit, med
jQuery( 'body' ).on( 'generate_spacing_updated', function() {
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' ).get(),
containerWidth = wp.customize( 'generate_settings[container_width]' ).get(),
containerLayout = wp.customize( 'generate_settings[content_layout_setting]' ).get(),
contentLeft = generatepress_live_preview.contentLeft,
contentRight = generatepress_live_preview.contentRight;
if ( 'text' === containerAlignment ) {
if ( ! generatepress_live_preview.isFlex && 'text' === containerAlignment ) {
if ( typeof wp.customize( 'generate_spacing_settings[content_left]' ) !== 'undefined' ) {
contentLeft = wp.customize( 'generate_spacing_settings[content_left]' ).get();
}
@ -597,13 +555,110 @@ function generatepress_typography_live_update( id, selector, property, unit, med
var newContainerWidth = Number( containerWidth ) + Number( contentLeft ) + Number( contentRight );
if ( jQuery( 'style#wide_container_width' ).length ) {
jQuery( 'style#wide_container_width' ).html( '#page{max-width:' + newContainerWidth + 'px;}' );
jQuery( 'style#wide_container_width' ).html( 'body:not(.full-width-content) #page{max-width:' + newContainerWidth + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="wide_container_width">#page{max-width:' + newContainerWidth + 'px;}</style>' );
jQuery( 'head' ).append( '<style id="wide_container_width">body:not(.full-width-content) #page{max-width:' + newContainerWidth + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#wide_container_width' ).not( ':last' ).remove();
}, 100);
}
}
if ( generatepress_live_preview.isFlex && 'boxes' === containerAlignment ) {
var topBarPaddingLeft = jQuery( '.inside-top-bar' ).css( 'padding-left' ),
topBarPaddingRight = jQuery( '.inside-top-bar' ).css( 'padding-right' ),
headerPaddingLeft = jQuery( '.inside-header' ).css( 'padding-left' ),
headerPaddingRight = jQuery( '.inside-header' ).css( 'padding-right' ),
footerWidgetPaddingLeft = jQuery( '.footer-widgets-container' ).css( 'padding-left' ),
footerWidgetPaddingRight = jQuery( '.footer-widgets-container' ).css( 'padding-right' ),
footerBarPaddingLeft = jQuery( '.inside-footer-bar' ).css( 'padding-left' ),
footerBarPaddingRight = jQuery( '.inside-footer-bar' ).css( 'padding-right' );
if ( typeof wp.customize( 'generate_spacing_settings[top_bar_left]' ) !== 'undefined' ) {
topBarPaddingLeft = wp.customize( 'generate_spacing_settings[top_bar_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[top_bar_right]' ) !== 'undefined' ) {
topBarPaddingRight = wp.customize( 'generate_spacing_settings[top_bar_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[header_left]' ) !== 'undefined' ) {
headerPaddingLeft = wp.customize( 'generate_spacing_settings[header_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[header_right]' ) !== 'undefined' ) {
headerPaddingRight = wp.customize( 'generate_spacing_settings[header_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_widget_container_left]' ) !== 'undefined' ) {
footerWidgetPaddingLeft = wp.customize( 'generate_spacing_settings[footer_widget_container_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_widget_container_right]' ) !== 'undefined' ) {
footerWidgetPaddingRight = wp.customize( 'generate_spacing_settings[footer_widget_container_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_left]' ) !== 'undefined' ) {
footerBarPaddingLeft = wp.customize( 'generate_spacing_settings[footer_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_right]' ) !== 'undefined' ) {
footerBarPaddingRight = wp.customize( 'generate_spacing_settings[footer_right]' ).get() + 'px';
}
var newTopBarWidth = parseFloat( containerWidth ) + parseFloat( topBarPaddingLeft ) + parseFloat( topBarPaddingRight ),
newHeaderWidth = parseFloat( containerWidth ) + parseFloat( headerPaddingLeft ) + parseFloat( headerPaddingRight ),
newFooterWidgetWidth = parseFloat( containerWidth ) + parseFloat( footerWidgetPaddingLeft ) + parseFloat( footerWidgetPaddingRight ),
newFooterBarWidth = parseFloat( containerWidth ) + parseFloat( footerBarPaddingLeft ) + parseFloat( footerBarPaddingRight );
if ( jQuery( 'style#box_sizing_widths' ).length ) {
jQuery( 'style#box_sizing_widths' ).html( '.inside-top-bar.grid-container{max-width:' + newTopBarWidth + 'px;}.inside-header.grid-container{max-width:' + newHeaderWidth + 'px;}.footer-widgets-container.grid-container{max-width:' + newFooterWidgetWidth + 'px;}.inside-site-info.grid-container{max-width:' + newFooterBarWidth + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="box_sizing_widths">.inside-top-bar.grid-container{max-width:' + newTopBarWidth + 'px;}.inside-header.grid-container{max-width:' + newHeaderWidth + 'px;}.footer-widgets-container.grid-container{max-width:' + newFooterWidgetWidth + 'px;}.inside-site-info.grid-container{max-width:' + newFooterBarWidth + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#box_sizing_widths' ).not( ':last' ).remove();
}, 100);
}
}
if ( generatepress_live_preview.isFlex && 'text' === containerAlignment ) {
var headerPaddingLeft = jQuery( '.inside-header' ).css( 'padding-left' ),
headerPaddingRight = jQuery( '.inside-header' ).css( 'padding-right' ),
menuItemPadding = jQuery( '.main-navigation .main-nav ul li a' ).css( 'padding-left' ),
secondaryMenuItemPadding = jQuery( '.secondary-navigation .main-nav ul li a' ).css( 'padding-left' );
if ( typeof wp.customize( 'generate_spacing_settings[header_left]' ) !== 'undefined' ) {
headerPaddingLeft = wp.customize( 'generate_spacing_settings[header_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[header_right]' ) !== 'undefined' ) {
headerPaddingRight = wp.customize( 'generate_spacing_settings[header_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[menu_item]' ) !== 'undefined' ) {
menuItemPadding = wp.customize( 'generate_spacing_settings[menu_item]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[secondary_menu_item]' ) !== 'undefined' ) {
secondaryMenuItemPadding = wp.customize( 'generate_spacing_settings[secondary_menu_item]' ).get() + 'px';
}
var newNavPaddingLeft = parseFloat( headerPaddingLeft ) - parseFloat( menuItemPadding ),
newNavPaddingRight = parseFloat( headerPaddingRight ) - parseFloat( menuItemPadding ),
newSecondaryNavPaddingLeft = parseFloat( headerPaddingLeft ) - parseFloat( secondaryMenuItemPadding ),
newSecondaryNavPaddingRight = parseFloat( headerPaddingRight ) - parseFloat( secondaryMenuItemPadding );
if ( jQuery( 'style#navigation_padding' ).length ) {
jQuery( 'style#navigation_padding' ).html( '.nav-below-header .main-navigation .inside-navigation.grid-container, .nav-above-header .main-navigation .inside-navigation.grid-container{padding: 0 ' + newNavPaddingRight + 'px 0 ' + newNavPaddingLeft + 'px;}' );
jQuery( 'style#secondary_navigation_padding' ).html( '.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container{padding: 0 ' + newSecondaryNavPaddingRight + 'px 0 ' + newSecondaryNavPaddingLeft + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="navigation_padding">.nav-below-header .main-navigation .inside-navigation.grid-container, .nav-above-header .main-navigation .inside-navigation.grid-container{padding: 0 ' + newNavPaddingRight + 'px 0 ' + newNavPaddingLeft + 'px;}</style>' );
jQuery( 'head' ).append( '<style id="secondary_navigation_padding">.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container{padding: 0 ' + newSecondaryNavPaddingRight + 'px 0 ' + newSecondaryNavPaddingLeft + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#navigation_padding' ).not( ':last' ).remove();
jQuery( 'style#secondary_navigation_padding' ).not( ':last' ).remove();
}, 100);
}
}
} );
} )( jQuery );

File diff suppressed because one or more lines are too long

View File

@ -1,154 +1,154 @@
( function( api ) {
api.controlConstructor['gp-customizer-typography'] = api.Control.extend( {
ready: function() {
var control = this;
control.container.on( 'change', '.generatepress-font-family select',
function() {
var _this = jQuery( this ),
_value = _this.val(),
_categoryID = _this.attr( 'data-category' ),
_variantsID = _this.attr( 'data-variants' );
// Set our font family
control.settings['family'].set( _this.val() );
// Bail if our controls don't exist
if ( 'undefined' == typeof control.settings['category'] || 'undefined' == typeof control.settings['variant'] ) {
return;
}
setTimeout( function() {
// Send our request to the generate_get_all_google_fonts_ajax function
var response = jQuery.getJSON({
type: 'POST',
url: ajaxurl,
data: {
action: 'generate_get_all_google_fonts_ajax',
gp_customize_nonce: gp_customize.nonce
},
async: false,
dataType: 'json',
});
// Get our response
var fonts = response.responseJSON;
// Create an ID from our selected font
var id = _value.split(' ').join('_').toLowerCase();
// Set our values if we have them
if ( id in fonts ) {
// Get existing variants if this font is already selected
var got_variants = false;
jQuery( '.generatepress-font-family select' ).not( _this ).each( function( key, select ) {
var parent = jQuery( this ).closest( '.generatepress-font-family' );
if ( _value == jQuery( select ).val() && _this.data( 'category' ) !== jQuery( select ).data( 'category' ) ) {
if ( ! got_variants ) {
updated_variants = jQuery( parent.next( '.generatepress-font-variant' ).find( 'select' ) ).val();
got_variants = true;
}
}
} );
// We're using a Google font, so show the variants field
_this.closest( '.generatepress-font-family' ).next( 'div' ).show();
// Remove existing variants
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
// Populate our select input with available variants
jQuery.each( fonts[ id ].variants, function( key, value ) {
jQuery( 'select[name="' + _variantsID + '"]' ).append( jQuery( '<option></option>' ).attr( 'value', value ).text( value ) );
} );
// Set our variants
if ( ! got_variants ) {
control.settings[ 'variant' ].set( fonts[ id ].variants );
} else {
control.settings[ 'variant' ].set( updated_variants );
}
// Set our font category
control.settings[ 'category' ].set( fonts[ id ].category );
jQuery( 'input[name="' + _categoryID + '"' ).val( fonts[ id ].category );
} else {
_this.closest( '.generatepress-font-family' ).next( 'div' ).hide();
control.settings[ 'category' ].set( '' )
control.settings[ 'variant' ].set( '' )
jQuery( 'input[name="' + _categoryID + '"' ).val( '' );
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
}
}, 25 );
}
);
control.container.on( 'change', '.generatepress-font-variant select',
function() {
var _this = jQuery( this );
var variants = _this.val();
control.settings['variant'].set( variants );
jQuery( '.generatepress-font-variant select' ).each( function( key, value ) {
var this_control = jQuery( this ).closest( 'li' ).attr( 'id' ).replace( 'customize-control-', '' );
var parent = jQuery( this ).closest( '.generatepress-font-variant' );
var font_val = api.control( this_control ).settings['family'].get();
if ( font_val == control.settings['family'].get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
jQuery( parent.find( 'select' ) ).not( _this ).val( variants ).triggerHandler( 'change' );
api.control( this_control ).settings['variant'].set( variants );
}
} );
}
);
control.container.on( 'change', '.generatepress-font-category input',
function() {
control.settings['category'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-weight select',
function() {
control.settings['weight'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-transform select',
function() {
control.settings['transform'].set( jQuery( this ).val() );
}
);
}
} );
} )( wp.customize );
jQuery( document ).ready( function( $ ) {
$( '.generatepress-font-family select' ).select2();
$( '.generatepress-font-variant' ).each( function( key, value ) {
var _this = $( this );
var value = _this.data( 'saved-value' );
if ( value ) {
value = value.toString().split( ',' );
}
_this.find( 'select' ).select2().val( value ).trigger( 'change.select2' );
} );
$( ".generatepress-font-family" ).each( function( key, value ) {
var _this = $( this );
if ( $.inArray( _this.find( 'select' ).val(), typography_defaults ) !== -1 ) {
_this.next( '.generatepress-font-variant' ).hide();
}
} );
} );
( function( api ) {
api.controlConstructor['gp-customizer-typography'] = api.Control.extend( {
ready: function() {
var control = this;
control.container.on( 'change', '.generatepress-font-family select',
function() {
var _this = jQuery( this ),
_value = _this.val(),
_categoryID = _this.attr( 'data-category' ),
_variantsID = _this.attr( 'data-variants' );
// Set our font family
control.settings['family'].set( _this.val() );
// Bail if our controls don't exist
if ( 'undefined' == typeof control.settings['category'] || 'undefined' == typeof control.settings['variant'] ) {
return;
}
setTimeout( function() {
// Send our request to the generate_get_all_google_fonts_ajax function
var response = jQuery.getJSON({
type: 'POST',
url: ajaxurl,
data: {
action: 'generate_get_all_google_fonts_ajax',
gp_customize_nonce: gp_customize.nonce
},
async: false,
dataType: 'json',
});
// Get our response
var fonts = response.responseJSON;
// Create an ID from our selected font
var id = _value.split(' ').join('_').toLowerCase();
// Set our values if we have them
if ( id in fonts ) {
// Get existing variants if this font is already selected
var got_variants = false;
jQuery( '.generatepress-font-family select' ).not( _this ).each( function( key, select ) {
var parent = jQuery( this ).closest( '.generatepress-font-family' );
if ( _value == jQuery( select ).val() && _this.data( 'category' ) !== jQuery( select ).data( 'category' ) ) {
if ( ! got_variants ) {
updated_variants = jQuery( parent.next( '.generatepress-font-variant' ).find( 'select' ) ).val();
got_variants = true;
}
}
} );
// We're using a Google font, so show the variants field
_this.closest( '.generatepress-font-family' ).next( 'div' ).show();
// Remove existing variants
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
// Populate our select input with available variants
jQuery.each( fonts[ id ].variants, function( key, value ) {
jQuery( 'select[name="' + _variantsID + '"]' ).append( jQuery( '<option></option>' ).attr( 'value', value ).text( value ) );
} );
// Set our variants
if ( ! got_variants ) {
control.settings[ 'variant' ].set( fonts[ id ].variants );
} else {
control.settings[ 'variant' ].set( updated_variants );
}
// Set our font category
control.settings[ 'category' ].set( fonts[ id ].category );
jQuery( 'input[name="' + _categoryID + '"' ).val( fonts[ id ].category );
} else {
_this.closest( '.generatepress-font-family' ).next( 'div' ).hide();
control.settings[ 'category' ].set( '' )
control.settings[ 'variant' ].set( '' )
jQuery( 'input[name="' + _categoryID + '"' ).val( '' );
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
}
}, 25 );
}
);
control.container.on( 'change', '.generatepress-font-variant select',
function() {
var _this = jQuery( this );
var variants = _this.val();
control.settings['variant'].set( variants );
jQuery( '.generatepress-font-variant select' ).each( function( key, value ) {
var this_control = jQuery( this ).closest( 'li' ).attr( 'id' ).replace( 'customize-control-', '' );
var parent = jQuery( this ).closest( '.generatepress-font-variant' );
var font_val = api.control( this_control ).settings['family'].get();
if ( font_val == control.settings['family'].get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
jQuery( parent.find( 'select' ) ).not( _this ).val( variants ).triggerHandler( 'change' );
api.control( this_control ).settings['variant'].set( variants );
}
} );
}
);
control.container.on( 'change', '.generatepress-font-category input',
function() {
control.settings['category'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-weight select',
function() {
control.settings['weight'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-transform select',
function() {
control.settings['transform'].set( jQuery( this ).val() );
}
);
}
} );
} )( wp.customize );
jQuery( document ).ready( function( $ ) {
$( '.generatepress-font-family select' ).select2();
$( '.generatepress-font-variant' ).each( function( key, value ) {
var _this = $( this );
var value = _this.data( 'saved-value' );
if ( value ) {
value = value.toString().split( ',' );
}
_this.find( 'select' ).select2().val( value ).trigger( 'change.select2' );
} );
$( ".generatepress-font-family" ).each( function( key, value ) {
var _this = $( this );
if ( $.inArray( _this.find( 'select' ).val(), typography_defaults ) !== -1 ) {
_this.next( '.generatepress-font-variant' ).hide();
}
} );
} );

View File

@ -9,15 +9,15 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Controls
// Controls.
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-range-control.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-typography-control.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-section.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-control.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-deprecated.php';
// Helper functions
// Helper functions.
require_once trailingslashit( dirname( __FILE__ ) ) . 'helpers.php';
// Deprecated
// Deprecated.
require_once trailingslashit( dirname( __FILE__ ) ) . 'deprecated.php';

View File

@ -15,24 +15,25 @@ if ( ! function_exists( 'generate_sanitize_typography' ) ) {
*
* @since 1.1.10
* @deprecated 1.3.45
* @param string $input The value to check.
*/
function generate_sanitize_typography( $input ) {
// Grab all of our fonts
// Grab all of our fonts.
$fonts = generate_get_all_google_fonts();
// Loop through all of them and grab their names
// Loop through all of them and grab their names.
$font_names = array();
foreach ( $fonts as $k => $fam ) {
$font_names[] = $fam['name'];
}
// Get all non-Google font names
// Get all non-Google font names.
$not_google = generate_typography_default_fonts();
// Merge them both into one array
// Merge them both into one array.
$valid = array_merge( $font_names, $not_google );
// Sanitize
// Sanitize.
if ( in_array( $input, $valid ) ) {
return $input;
} else {
@ -47,6 +48,7 @@ if ( ! function_exists( 'generate_sanitize_font_weight' ) ) {
*
* @since 1.1.10
* @deprecated 1.3.40
* @param string $input The value to check.
*/
function generate_sanitize_font_weight( $input ) {
@ -78,6 +80,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
*
* @since 1.1.10
* @deprecated 1.3.40
* @param string $input The value to check.
*/
function generate_sanitize_text_transform( $input ) {
@ -86,7 +89,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
'capitalize',
'uppercase',
'lowercase',
);
);
if ( in_array( $input, $valid ) ) {
return $input;
@ -99,6 +102,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
if ( ! function_exists( 'generate_typography_customize_preview_css' ) ) {
/**
* Hide the hidden input control
*
* @since 1.3.40
*/
function generate_typography_customize_preview_css() {
@ -109,3 +113,21 @@ if ( ! function_exists( 'generate_typography_customize_preview_css' ) ) {
<?php
}
}
if ( ! function_exists( 'generate_hidden_navigation' ) && function_exists( 'is_customize_preview' ) ) {
/**
* Adds a hidden navigation if no navigation is set
* This allows us to use postMessage to position the navigation when it doesn't exist
*
* @since 1.3.40
*/
function generate_hidden_navigation() {
if ( is_customize_preview() && function_exists( 'generate_navigation_position' ) ) {
?>
<div style="display:none;">
<?php generate_navigation_position(); ?>
</div>
<?php
}
}
}

View File

@ -43,25 +43,6 @@ if ( ! function_exists( 'generate_is_top_bar_active' ) ) {
}
}
if ( ! function_exists( 'generate_hidden_navigation' ) && function_exists( 'is_customize_preview' ) ) {
add_action( 'wp_footer', 'generate_hidden_navigation' );
/**
* Adds a hidden navigation if no navigation is set
* This allows us to use postMessage to position the navigation when it doesn't exist
*
* @since 1.3.40
*/
function generate_hidden_navigation() {
if ( is_customize_preview() && function_exists( 'generate_navigation_position' ) ) {
?>
<div style="display:none;">
<?php generate_navigation_position(); ?>
</div>
<?php
}
}
}
if ( ! function_exists( 'generate_customize_partial_blogname' ) ) {
/**
* Render the site title for the selective refresh partial.
@ -92,16 +73,16 @@ if ( ! function_exists( 'generate_enqueue_color_palettes' ) ) {
* @since 1.3.42
*/
function generate_enqueue_color_palettes() {
// Old versions of WP don't get nice things
// Old versions of WP don't get nice things.
if ( ! function_exists( 'wp_add_inline_script' ) ) {
return;
}
// Grab our palette array and turn it into JS
$palettes = json_encode( generate_get_default_color_palettes() );
// Grab our palette array and turn it into JS.
$palettes = wp_json_encode( generate_get_default_color_palettes() );
// Add our custom palettes
// json_encode takes care of escaping
// Add our custom palettes.
// json_encode takes care of escaping.
wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' );
}
}
@ -111,6 +92,7 @@ if ( ! function_exists( 'generate_sanitize_integer' ) ) {
* Sanitize integers.
*
* @since 1.0.8
* @param string $input The value to check.
*/
function generate_sanitize_integer( $input ) {
return absint( $input );
@ -122,6 +104,7 @@ if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
* Sanitize integers that can use decimals.
*
* @since 1.3.41
* @param string $input The value to check.
*/
function generate_sanitize_decimal_integer( $input ) {
return abs( floatval( $input ) );
@ -132,8 +115,10 @@ if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
* Sanitize a positive number, but allow an empty value.
*
* @since 2.2
* @param string $input The value to check.
*/
function generate_sanitize_empty_absint( $input ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
if ( '' == $input ) {
return '';
}
@ -146,8 +131,10 @@ if ( ! function_exists( 'generate_sanitize_checkbox' ) ) {
* Sanitize checkbox values.
*
* @since 1.0.8
* @param string $checked The value to check.
*/
function generate_sanitize_checkbox( $checked ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
return ( ( isset( $checked ) && true == $checked ) ? true : false );
}
}
@ -158,19 +145,20 @@ if ( ! function_exists( 'generate_sanitize_blog_excerpt' ) ) {
* Needed because GP Premium calls the control ID which is different from the settings ID.
*
* @since 1.0.8
* @param string $input The value to check.
*/
function generate_sanitize_blog_excerpt( $input ) {
$valid = array(
'full',
'excerpt'
);
function generate_sanitize_blog_excerpt( $input ) {
$valid = array(
'full',
'excerpt',
);
if ( in_array( $input, $valid ) ) {
return $input;
} else {
return 'full';
}
}
if ( in_array( $input, $valid ) ) {
return $input;
} else {
return 'full';
}
}
}
if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
@ -179,25 +167,28 @@ if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
* Allow blank value.
*
* @since 1.2.9.6
* @param string $color The color to check.
*/
function generate_sanitize_hex_color( $color ) {
if ( '' === $color ) {
return '';
}
function generate_sanitize_hex_color( $color ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
if ( '' === $color ) {
return '';
}
// 3 or 6 hex digits, or the empty string.
if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
return $color;
}
// 3 or 6 hex digits, or the empty string.
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
return $color;
}
return '';
}
return '';
}
}
/**
* Sanitize RGBA colors.
*
* @since 2.2
* @param string $color The color to check.
*/
function generate_sanitize_rgba_color( $color ) {
if ( '' === $color ) {
@ -211,7 +202,7 @@ function generate_sanitize_rgba_color( $color ) {
$color = str_replace( ' ', '', $color );
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
return 'rgba('.$red.','.$green.','.$blue.','.$alpha.')';
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
}
if ( ! function_exists( 'generate_sanitize_choices' ) ) {
@ -219,17 +210,19 @@ if ( ! function_exists( 'generate_sanitize_choices' ) ) {
* Sanitize choices.
*
* @since 1.3.24
* @param string $input The value to check.
* @param object $setting The setting object.
*/
function generate_sanitize_choices( $input, $setting ) {
// Ensure input is a slug
// Ensure input is a slug.
$input = sanitize_key( $input );
// Get list of choices from the control
// associated with the setting
// Get list of choices from the control.
// associated with the setting.
$choices = $setting->manager->get_control( $setting->id )->choices;
// If the input is a valid key, return it;
// otherwise, return the default
// If the input is a valid key, return it.
// otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
}
@ -238,6 +231,7 @@ if ( ! function_exists( 'generate_sanitize_choices' ) ) {
* Sanitize our Google Font variants
*
* @since 2.0
* @param string $input The value to check.
*/
function generate_sanitize_variants( $input ) {
if ( is_array( $input ) ) {
@ -256,9 +250,11 @@ add_action( 'customize_controls_enqueue_scripts', 'generate_do_control_inline_sc
* @since 2.0
*/
function generate_do_control_inline_scripts() {
wp_localize_script( 'generatepress-typography-customizer', 'gp_customize',
wp_localize_script(
'generatepress-typography-customizer',
'gp_customize',
array(
'nonce' => wp_create_nonce( 'gp_customize_nonce' )
'nonce' => wp_create_nonce( 'gp_customize_nonce' ),
)
);
@ -268,7 +264,7 @@ function generate_do_control_inline_scripts() {
'generatepress-typography-customizer',
'generatePressTypography',
array(
'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) )
'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) ),
)
);
@ -277,6 +273,8 @@ function generate_do_control_inline_scripts() {
wp_enqueue_script( 'generatepress-customizer-controls', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-controls.js', array( 'customize-controls', 'jquery' ), GENERATE_VERSION, true );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_defaults', generate_get_defaults() );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_color_defaults', generate_get_color_defaults() );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_typography_defaults', generate_get_default_fonts() );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_spacing_defaults', generate_spacing_get_defaults() );
}
if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
@ -294,13 +292,19 @@ if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
wp_enqueue_script( 'generate-themecustomizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-live-preview.js', array( 'customize-preview' ), GENERATE_VERSION, true );
wp_localize_script( 'generate-themecustomizer', 'generatepress_live_preview', array(
'mobile' => generate_get_media_query( 'mobile' ),
'tablet' => generate_get_media_query( 'tablet' ),
'desktop' => generate_get_media_query( 'desktop' ),
'contentLeft' => absint( $spacing_settings['content_left'] ),
'contentRight' => absint( $spacing_settings['content_right'] ),
) );
wp_localize_script(
'generate-themecustomizer',
'generatepress_live_preview',
array(
'mobile' => generate_get_media_query( 'mobile' ),
'tablet' => generate_get_media_query( 'tablet' ),
'desktop' => generate_get_media_query( 'desktop' ),
'contentLeft' => absint( $spacing_settings['content_left'] ),
'contentRight' => absint( $spacing_settings['content_right'] ),
'isFlex' => generate_is_using_flexbox(),
'isRTL' => is_rtl(),
)
);
}
}
@ -325,6 +329,20 @@ function generate_has_custom_logo_callback() {
*
* @since 2.2
*/
function generate_sanitize_preset_layout( $input ) {
function generate_sanitize_preset_layout() {
return 'current';
}
/**
* Display options if we're using the Floats structure.
*/
function generate_is_using_floats_callback() {
return 'floats' === generate_get_option( 'structure' );
}
/**
* Callback to determine whether to show the inline logo option.
*/
function generate_show_inline_logo_callback() {
return 'floats' === generate_get_option( 'structure' ) && generate_has_logo_site_branding();
}