__( 'Widget' , 'layerswp' ), 'icon_class' => '' ); $header = (object) wp_parse_args( $args, $defaults ); ?>

title ); ?>

title ); ?> 'section' ); $panel_title = (object) wp_parse_args( $args, $defaults ); ?>

title ); ?>

'date', 'order' => 'desc' ) ) ] = __( 'Newest First' , 'layerswp' ); $options[ json_encode( array( 'orderby' => 'date', 'order' => 'asc' ) ) ] = __( 'Oldest First' , 'layerswp' ); $options[ json_encode( array( 'orderby' => 'rand', 'order' => 'desc' ) ) ] = __( 'Random' , 'layerswp' ); $options[ json_encode( array( 'orderby' => 'title', 'order' => 'asc' ) ) ] = __( 'Titles A-Z' , 'layerswp' ); $options[ json_encode( array( 'orderby' => 'title', 'order' => 'desc' ) ) ] = __( 'Titles Z-A' , 'layerswp' ); $options[ json_encode( array( 'orderby' => 'comment_count', 'order' => 'desc' ) ) ] = __( 'Most Comments' , 'layerswp' ); $options[ json_encode( array( 'orderby' => 'menu_order', 'order' => 'desc' ) ) ] = __( 'Custom Order' , 'layerswp' ); return $options; } /** * Load input HTML * * @param array $array() Existing option array if exists (optional) * @return array $array Array of options, all standard DOM input options */ public function input( $args = array() ) { global $wp_customize; $defaults = array( 'type' => 'text', 'name' => NULL , 'id' => NULL , 'placeholder' => NULL, 'data' => NULL, 'value' => NULL , 'class' => NULL, 'options' => array(), 'sync_setting' => NULL, 'mimic_setting' => NULL, ); // Convert 'choices' to 'options' - so you can use same naming as the controls which use 'options'. if ( isset( $args['choices'] ) && ! empty( $args['choices'] ) && ! isset ( $args['options'] ) ) { $args['options'] = $args['choices']; unset( $args['choices'] ); } // Turn $args into their own variables $input = (object) wp_parse_args( $args, $defaults ); // If the value of this element is in fact a collection of inputs, turn it into an object, it's nicer to work with if( NULL != $input->value && is_array( $input->value ) ) $input->value = (object) $input->value; if( !is_object( $input->value ) ) $input->value = stripslashes( $input->value ); // Create the input attributes $input_props = array(); $input_props['id'] = ( NULL != $input->id && 'select-icons' != $input->type ) ? 'id="' . $input->id . '"' : NULL ; $input_props['name'] = ( NULL != $input->name ) ? 'name="' . $input->name . '"' : NULL ; $input_props['placeholder'] = ( NULL !== $input->placeholder ) ? 'placeholder="' . esc_attr( $input->placeholder ) . '"' : NULL ; $input_props['class'] = ( NULL != $input->class ) ? 'class="' . $input->class . '"' : NULL ; $input_props['disabled'] = isset( $input->disabled ) ? 'disabled="disabled"' : NULL ; $input_props['sync-setting'] = isset( $input->sync_setting ) ? 'data-sync-setting="' . $input->sync_setting . '"' : NULL ; $input_props['mimic-setting'] = isset( $input->mimic_setting ) ? 'data-mimic-setting="' . $input->mimic_setting . '"' : NULL ; if( NULL != $input->data ) { foreach( $input->data as $data_key => $data_value ){ $input_props[ 'data-' . $data_key ] = 'data-' . $data_key . '="' . esc_attr( $data_value ) . '"'; } } // Switch our input type switch( $input->type ) { case 'text' : ?> value="value ); ?>" /> min ) ) ? 'min="' . $input->min . '"' : NULL ; $input_props['max'] = ( isset( $input->max ) ) ? 'max="' . $input->max . '"' : NULL ; $input_props['step'] = ( isset( $input->step ) ) ? 'step="' . $input->step . '"' : NULL ; ?> value="value; ?>" /> step ) ) ? 'step="' . $input->step . '"' : NULL ; $range_input_props['min'] = ( NULL !== $input->min ) ? 'min="' . $input->min . '"' : NULL ; $range_input_props['max'] = ( NULL !== $input->max ) ? 'max="' . $input->max . '"' : NULL ; $range_input_props['step'] = ( NULL !== $input->step ) ? 'step="' . $input->step . '"' : NULL ; $range_input_props['placeholder'] = ( NULL !== $input->placeholder ) ? 'placeholder="' . $input->placeholder . '"' : NULL ; if ( isset( $input->value ) && '' !== $input->value ) $range_input_props['value'] = 'value="' . $input->value . '"'; elseif ( isset( $input->placeholder ) ) $range_input_props['value'] = 'value="' . $input->placeholder . '"'; // Add the disabled to the number field if a placeholder is set and it's the same as the value. // the javascript does this too so it will be live applied when the range slider is dragged. if ( isset( $input->placeholder ) && $input->placeholder == $input->value ) $number_input_props['class'] = 'class="layers-range-disabled"'; ?>
/>
value="value; ?>" />
value , 'on' ); ?>/> label ) ) { ?> $val ) { if ( 0 === strpos( $val, 'id=' ) ) $duplicate_input_props[$key] = rtrim( $val, '"' ) . '-CHECKBOX"'; else if ( 0 === strpos( $val, 'name=' ) ) $duplicate_input_props[$key] = rtrim( $val, ']"' ) . '-CHECKBOX]"'; else $duplicate_input_props[$key] = $val; } ?> /> options as $value => $label ) { ?> /> value; ?> input_type ) ){ $input_type = $input->input_type; } else { $input_type = ( 1 == count( $input->options ) ) ? 'checkbox' : 'radio'; } ?>
options as $key => $value ) { if ( is_array( $value ) ) { $name = ( isset( $value['name'] ) ? $value['name'] : '' ); $class = ( isset( $value['class'] ) ? $value['class'] : '' ); $data_string = ''; if ( ! empty( $value['data'] ) ) { foreach ( $value['data'] as $data_key => $data_value) { $data_string .= 'data-' . esc_attr( $data_key ) . '="' . $data_value . '" '; } } } else { $name = $value; $class = "icon-{$key}"; $data_string = ''; } $data_string .= 'data-value="' . $input->value . '" '; // Allow for setting of a default selection. $checked = FALSE; if ( $input->value && $input->value == $key ) $checked = TRUE; // elseif ( ! $input->value && isset( $input->default ) && $input->default == $key ) $checked = TRUE; // Not Using Anymore ?>
allow_tags ) && is_array( $input->allow_tags ) ? implode( ',' , $input->allow_tags ) : array() ); // Add custom button support $default_allowed_buttons = array( 'bold', 'italic', 'underline', 'strikeThrough', 'insertLink', 'formatOL', 'formatUL', 'clearFormatting', 'html' ); $allow_buttons = ( isset( $input->allow_buttons ) && is_array( $input->allow_buttons ) ? $input->allow_buttons : $default_allowed_buttons ); // Check for disabling of standard buttons if( isset( $input->disallow_buttons ) && is_array( $input->disallow_buttons ) ) { foreach( $allow_buttons as $button_key => $button_value ){ if( in_array( $button_value , $input->disallow_buttons ) ){ unset( $allow_buttons[ $button_key ] ); } } } ?> value ) && '' !== $input->value && NULL != $input->value ); ?>
value, 'medium' ); ?> ="" />
button_label ) ? $input->button_label : __( 'Choose Media' , 'layerswp' ) ); ?> input( array( 'type' => 'hidden', 'name' => $input->name, 'id' => $input->id, 'value' => ( $has_image ) ? $input->value : NULL, 'data' => ( NULL != $input->data ) ? $input->data : NULL, ) ); ?>
value ) ) echo wp_basename( wp_get_attachment_url( $input->value ) , true ); ?> button_label ) ? $input->button_label : __( 'Choose File' , 'layerswp' ) ); ?> value="value; ?>" />
value->type ) ) $input_type = 'image'; else $input_type = $input->value->type; ?>
input( array( 'type' => 'hidden', 'name' => $input->name . '[type]' , 'id' => $input->id . '-type', 'value' => ( isset( $input->value->type ) ) ? $input->value->type : 'image' ) ); ?>

value->image ) ) echo 'class="l_admin-hide"'; ?>> select a file.' ); ?>

input( array( 'type' => 'hidden', 'name' => $input->name . '[image]' , 'id' => $input->id . '-image', 'value' => ( isset( $input->value->image ) ) ? $input->value->image : NULL ) ); ?> value->image ) ) { $img = wp_get_attachment_image_src( $input->value->image , 'thumbnail' );?>

input( array( 'type' => 'color', 'name' => $input->name . '[image_color]' , 'id' => $input->id . 'image-color', 'value' => ( isset( $input->value->image_color ) ) ? $input->value->image_color : NULL, ) ); ?>

  • input( array( 'type' => 'checkbox', 'name' => $input->name . '[darken]' , 'id' => $input->id . '-darken', 'value' => ( isset( $input->value->darken ) ) ? $input->value->darken : NULL, 'label' => __( 'Darken to improve readability' , 'layerswp' ) ) ); ?>
  • input( array( 'type' => 'checkbox', 'name' => $input->name . '[tile_background]' , 'id' => $input->id . '-tile_background', 'value' => ( isset( $input->value->tile_background ) ) ? $input->value->tile_background : NULL, 'label' => __( 'Tile Background' , 'layerswp' ) ) ); ?>
  • input( array( 'type' => 'checkbox', 'name' => $input->name . '[fixed_background]' , 'id' => $input->id . '-fixed_background', 'value' => ( isset( $input->value->fixed_background ) ) ? $input->value->fixed_background : NULL, 'label' => __( 'Fixed Background' , 'layerswp' ) ) ); ?>

input( array( 'type' => 'upload', 'name' => $input->name . '[mp4]' , 'id' => $input->id . '-mp4', 'value' => ( isset( $input->value->mp4 ) ) ? $input->value->mp4 : NULL ) ); ?>

input( array( 'type' => 'upload', 'name' => $input->name . '[ogv]' , 'id' => $input->id . '-ogv', 'value' => ( isset( $input->value->ogv ) ) ? $input->value->ogv : NULL ) ); ?>

input( array( 'type' => 'color', 'name' => $input->name . '[video_color]' , 'id' => $input->id . '-video-color', 'value' => ( isset( $input->value->video_color ) ) ? $input->value->video_color : NULL, ) ); ?>

  • input( array( 'type' => 'checkbox', 'name' => $input->name . '[video_darken]' , 'id' => $input->id . '-video_darken', 'value' => ( isset( $input->value->video_darken ) ) ? $input->value->video_darken : NULL, 'label' => __( 'Darken to improve readability' , 'layerswp' ) ) ); ?>
  • input( array( 'type' => 'checkbox', 'name' => $input->name . '[video_tile_background]' , 'id' => $input->id . '-video_tile_background', 'value' => ( isset( $input->value->video_tile_background ) ) ? $input->value->video_tile_background : NULL, 'label' => __( 'Tile Background' , 'layerswp' ) ) ); ?>
  • input( array( 'type' => 'checkbox', 'name' => $input->name . '[video_fixed_background]' , 'id' => $input->id . '-video_fixed_background', 'value' => ( isset( $input->value->video_fixed_background ) ) ? $input->value->video_fixed_background : NULL, 'label' => __( 'Fixed Background' , 'layerswp' ) ) ); ?>
value="value; ?>" class="layers-color-selector" /> tag ) &&'' != $input->tag ) ? $input->tag : 'button'; $href = ( isset( $input->href ) && '' != $input->href ) ? 'href="' . $input->href . '"' : ''; ?> < data-button_text="label ); ?>"> label ); ?> > __( 'Top' , 'layerswp' ), 'right' => __( 'Right' , 'layerswp' ), 'bottom' => __( 'Bottom' , 'layerswp' ), 'left' => __( 'Left' , 'layerswp' ), ); ?> array( 'top' => 'Top (px)' ) one field 'top' with cusotmized label 'Top (px)'. // (2) 'fields' => array( 'top' ) one field 'top' with standard label 'Top'. if( ! empty( $input->fields ) ) { $new_fields = array(); foreach ( $input->fields as $key => $value ) { if ( is_numeric( $key ) ) { // Array element type: [ 'bottom' ] if ( isset( $fields[$value] ) ){ // Make sure that what the user spcified is avalid field of TRBL. $new_fields[$value] = $fields[$value]; } } else { // Array element type: [ 'bottom' => 'Bottom (px)' ] $new_fields[$key] = $value; } } $fields = $new_fields; // If the fields chosen were incorrect then bail. if ( empty( $fields ) ) return; } // Calculate column span based on the number of resulting fields. $field_span = ( 12 / count( $fields ) ); ?>
$label ) : ?>
input( array( 'type' => 'number', 'name' => ( isset( $input->name ) ) ? "{$input->name}[$key]" : '', 'id' => "{$input->id}-{$key}", 'value' => ( isset( $input->value->$key ) ) ? $input->value->$key : NULL, 'class' => 'l_admin-hide-controls', 'data' => array( 'customize-setting-link' => "{$input->id}-{$key}", ), ) ); ?>
html; ?>
value="value; ?>" />