show_filter)){ $this->json['show_filter'] = $this->show_filter; } } protected function render() { $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id ); $class = 'pagelayer-customize-control customize-control customize-control-' . $this->type; $class .= ' '.$this->li_class; printf( '
  • ', esc_attr( $id ), esc_attr( $class ) ); $this->render_content(); echo '
  • '; } } /** * Padding control to separate general and style controls * */ class Pagelayer_Padding_Control extends Pagelayer_Customize_Control { /** * The type of control being rendered */ public $type = 'pagelayer-padding-control'; public $responsive; public $units; /** * Constructor */ public function __construct( $manager, $id, $args = array(), $options = array() ) { parent::__construct( $manager, $id, $args ); } /** * Render the control in the customizer */ public function render_content() { $units = (array) $this->units; // Output the label and description if they were passed in. if ( isset( $this->label ) && '' !== $this->label ) { echo '' . sanitize_text_field( $this->label ); if(!empty($this->responsive )){ echo ' '; } if(!empty($units)){ ?> link('unit'); ?>> '.$unit.' '; } ?> '; } $settings = array(); foreach ( $this->settings as $key => $setting ){ $key = str_replace(['_mobile', '_tablet'], '', $key); if(in_array($key, $settings)){ continue; } $settings[] = $key; } $screens = array(''); if(!empty($this->responsive)){ $screens = array('', '_tablet', '_mobile'); } echo '
    '; foreach($screens as $screen){ $show_device = ''; if(count($screens) > 1){ $show_device = 'data-show-device="'.(empty($screen) ? '_desktop' : $screen).'"'; } echo '
    '; foreach($settings as $setting){ // Skip units for responsive if($setting == 'unit'){ continue; } $setting_name = $setting.$screen; ?> link($setting_name); ?>>
    '; } echo '
    '; } } /** * Typography control controls * */ class Pagelayer_typo_Control extends Pagelayer_Customize_Control { /** * The type of control being rendered */ public $type = 'pagelayer-typo-control'; public $responsive; public $style; /** * Constructor */ public function __construct( $manager, $id, $args = array(), $options = array() ) { parent::__construct( $manager, $id, $args ); } /** * Render the control in the customizer */ public function render_content() { global $pagelayer; // Output the label and description if they were passed in. if ( isset( $this->label ) && '' !== $this->label ) { echo '' . sanitize_text_field( $this->label ) .''; } $settings = $pagelayer->font_settings; echo '
    '; $global_font = $this->value('global-font'); if(!empty($global_font) && !isset($pagelayer->global_fonts[$global_font])){ $global_font = 'primary'; } echo '
    '; ?>
    link('global-font'); ?> value="" data-key="">
    $sval){ ?>
    1){ $show_device = 'data-show-device="_'.$screen.'"'; $field_name = $sk.($screen == 'desktop' ? '' : '_'.$screen); } $field_val = esc_attr($this->value($field_name)); if(isset($sval['choices'])){ ?> link($field_name); ?> >
    '; } } /** * Alpha Color Picker Custom Control * * @author Braad Martin * @license http://www.gnu.org/licenses/gpl-3.0.html * @link https://github.com/BraadMartin/components/tree/master/customizer/alpha-color-picker */ class Pagelayer_Customize_Alpha_Color_Control extends Pagelayer_Customize_Control { /** * The type of control being rendered */ public $type = 'pagelayer-alpha-color'; /** * Add support for palettes to be passed in. * * Supported palette values are true, false, or an array of RGBa and Hex colors. */ public $palette; /** * Add support for showing the opacity value on the slider handle. */ public $show_opacity; /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' ); } /** * Render the control in the customizer */ public function render_content() { global $pagelayer; $setvalue = $this->value(); // 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 '' . sanitize_text_field( $this->label ) . ''; } if ( isset( $this->description ) && '' !== $this->description ) { echo '' . sanitize_text_field( $this->description ) . ''; } ?>
    Global Colors
    global_colors[$gkey]) ? $gkey : 'primary'; } foreach($pagelayer->global_colors as $cid => $color){ $active_class = ''; if($cid == $gkey){ $active_class = 'pagelayer-global-selected'; } ?>
    link(); ?> /> button_label)){ $this->button_label = __( 'Add New Color', 'pagelayer' ); } } /** * Render the control in the customizer */ public function render_content() { $values = $this->value(); $decode_values = json_decode($values, true); $skip_keys = array('primary', 'secondary', 'text', 'accent'); ?>
    label ) ) { ?> label ); ?> description ) ) { ?> description ); ?> link(); ?>> $val){ ?>
    button_label)){ $this->button_label = __( 'Add New Font', 'pagelayer' ); } } /** * Render the control in the customizer */ public function render_content() { global $pagelayer; $values = $this->value(); $decode_values = (array) json_decode($values, true); $settings = $pagelayer->font_settings; $skip_keys = array('primary', 'secondary', 'text', 'accent'); ?>
    label ) ) { ?> label ); ?> description ) ) { ?> description ); ?> link(); ?>> $val){ ?>
    $sval){ ?>
    1){ $field_name = $sk.'['.$screen.']'; $show_device = 'data-show-device="_'.$screen.'"'; if(is_array($field_val)){ $field_val = (empty($field_val[$screen]) ? '' : $field_val[$screen]); } } if(isset($sval['choices'])){ ?> >
    units; $input_id = '_customize-input-' . $this->id; $description_id = '_customize-description-' . $this->id; $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : ''; switch ( $this->type ) { case 'checkbox': ?> type="checkbox" value="value() ); ?>" link(); ?> value() ); ?> /> description ) ) : ?> description; ?> choices ) ) { return; } $name = '_customize-radio-' . $this->id; ?> label ) ) : ?> label ); ?> description ) ) : ?> description; ?> choices as $value => $label ) : ?> value="" name="" link(); ?> value(), $value ); ?> data-label="" /> '; break; case 'pl_slider': ?>
    label ); ?> responsive )){?> link('unit'); ?>> '.$unit.' '; } ?> responsive)){ $screens = array('desktop' => '_desktop', 'tablet' => '_tablet', 'mobile' => '_mobile'); } foreach($screens as $screen => $_screen){ $show_device = empty($_screen)? '' : 'data-show-device="'.$_screen.'"'; echo '
    '; ?> link($set_link.$_screen); ?> min="input_attrs['min'] ); ?>" max="input_attrs['max'] ); ?>" step="input_attrs['step'] ); ?>"/>
    default; } if ( false === strpos( $input, 'rgba' ) ) { // If string doesn't start with 'rgba' then santize as hex color $input = sanitize_hex_color( $input ); } else { // Sanitize as RGBa color $input = str_replace( ' ', '', $input ); sscanf( $input, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); $input = 'rgba(' . pagelayer_in_range( $red, 0, 255 ) . ',' . pagelayer_in_range( $green, 0, 255 ) . ',' . pagelayer_in_range( $blue, 0, 255 ) . ',' . pagelayer_in_range( $alpha, 0, 1 ) . ')'; } return $input; } } /** * Only allow values between a certain minimum & maxmium range * * @param number Input to be sanitized * @return number Sanitized input */ if ( ! function_exists( 'pagelayer_in_range' ) ) { function pagelayer_in_range( $input, $min, $max ){ if ( $input < $min ) { $input = $min; } if ( $input > $max ) { $input = $max; } return $input; } } // Create font options function pagelayer_create_font_options( $args, $set ){ $options = ''; foreach( $args as $value => $label ){ $_value = $value; if(is_numeric($value)){ $_value = $label; } // Single item if(is_string($label)){ $options .= pagelayer_sel_option( $_value, $label, $set); continue; } if( $value == 'default'){ $options .= pagelayer_sel_option( '', $value, $set); continue; } $options .= ''; $options .= pagelayer_create_font_options($label, $set); $options .= ''; } return $options; }