field, array( 'top_icon' => '', 'left_icon' => '', 'bottom_icon' => '', 'right_icon' => '', 'all_icon' => '', 'radius_icon' => '', 'top_placeholder' => esc_html__( 'top', 'darkify' ), 'right_placeholder' => esc_html__( 'right', 'darkify' ), 'bottom_placeholder' => esc_html__( 'bottom', 'darkify' ), 'left_placeholder' => esc_html__( 'left', 'darkify' ), 'all_placeholder' => esc_html__( 'all', 'darkify' ), 'top' => true, 'left' => true, 'bottom' => true, 'right' => true, 'all' => false, 'radius' => false, 'color' => true, 'color2' => true, 'color3' => true, 'style' => true, 'unit' => 'px', ) ); $default_value = array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', 'color' => '', 'style' => 'solid', 'all' => '', 'radius' => '', ); $border_props = array( 'solid' => esc_html__( 'Solid', 'darkify' ), 'dashed' => esc_html__( 'Dashed', 'darkify' ), 'dotted' => esc_html__( 'Dotted', 'darkify' ), 'double' => esc_html__( 'Double', 'darkify' ), 'inset' => esc_html__( 'Inset', 'darkify' ), 'outset' => esc_html__( 'Outset', 'darkify' ), 'groove' => esc_html__( 'Groove', 'darkify' ), 'ridge' => esc_html__( 'ridge', 'darkify' ), 'none' => esc_html__( 'None', 'darkify' ), ); $default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value; $value = wp_parse_args( $this->value, $default_value ); echo wp_kses_post( $this->field_before() ); echo '
'; if ( ! empty( $args['all'] ) ) { $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : ''; echo '
'; echo '
Width
'; echo ( ! empty( $args['all_icon'] ) ) ? '' . wp_kses_post( $args['all_icon'] ) . '' : ''; echo ''; echo ( ! empty( $args['unit'] ) ) ? '' . esc_html( $args['unit'] ) . '' : ''; echo '
'; } else { $properties = array(); foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) { if ( ! empty( $args[ $prop ] ) ) { $properties[] = $prop; } } $properties = ( array( 'right', 'left' ) === $properties ) ? array_reverse( $properties ) : $properties; foreach ( $properties as $property ) { $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : ''; echo '
'; echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '' . wp_kses_post( $args[ $property . '_icon' ] ) . '' : ''; echo '
width
'; echo ''; echo ( ! empty( $args['unit'] ) ) ? '' . esc_html( $args['unit'] ) . '' : ''; echo '
'; } } if ( ! empty( $args['style'] ) ) { echo '
'; echo '
' . esc_html__( 'Style', 'darkify' ) . '
'; echo ''; echo '
'; } echo '
'; if ( ! empty( $args['color'] ) ) { $default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="' . $default_value['color'] . '"' : ''; echo '
'; echo '
' . esc_html__( 'Light Color', 'darkify' ) . '
'; echo ''; echo '
'; } if ( ! empty( $args['color2'] ) ) { $default_color_attr = ( ! empty( $default_value['color2'] ) ) ? ' data-default-color="' . $default_value['color'] . '"' : ''; echo '
'; echo '
' . esc_html__( 'Active', 'darkify' ) . '
'; echo ''; echo '
'; } if ( ! empty( $args['color3'] ) ) { $default_color_attr = ( ! empty( $default_value['color3'] ) ) ? ' data-default-color="' . $default_value['color3'] . '"' : ''; echo '
'; echo '
' . esc_html__( 'Dark Color', 'darkify' ) . '
'; echo ''; echo '
'; } if ( ! empty( $args['radius'] ) ) { $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : ''; echo '
'; echo '
' . esc_html__( 'Radius', 'darkify' ) . '
'; echo ( ! empty( $args['all_icon'] ) ) ? '' . wp_kses_post( $args['radius_icon'] ) . '' : ''; echo ''; echo ( ! empty( $args['unit'] ) ) ? '' . esc_html( $args['unit'] ) . '' : ''; echo '
'; } echo '
'; echo wp_kses_post( $this->field_after() ); } /** * Output * * @return statement */ public function output() { $output = ''; $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px'; $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : ''; $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output']; // properties. $top = ( isset( $this->value['top'] ) && '' !== $this->value['top'] ) ? $this->value['top'] : ''; $right = ( isset( $this->value['right'] ) && '' !== $this->value['right'] ) ? $this->value['right'] : ''; $bottom = ( isset( $this->value['bottom'] ) && '' !== $this->value['bottom'] ) ? $this->value['bottom'] : ''; $left = ( isset( $this->value['left'] ) && '' !== $this->value['left'] ) ? $this->value['left'] : ''; $style = ( isset( $this->value['style'] ) && '' !== $this->value['style'] ) ? $this->value['style'] : ''; $color = ( isset( $this->value['color'] ) && '' !== $this->value['color'] ) ? $this->value['color'] : ''; $all = ( isset( $this->value['all'] ) && '' !== $this->value['all'] ) ? $this->value['all'] : ''; if ( ! empty( $this->field['all'] ) && ( '' !== $all || '' !== $color ) ) { $output = $element . '{'; $output .= ( '' !== $all ) ? 'border-width:' . $all . $unit . $important . ';' : ''; $output .= ( '' !== $color ) ? 'border-color:' . $color . $important . ';' : ''; $output .= ( '' !== $style ) ? 'border-style:' . $style . $important . ';' : ''; $output .= '}'; } elseif ( '' !== $top || '' !== $right || '' !== $bottom || '' !== $left || '' !== $color ) { $output = $element . '{'; $output .= ( '' !== $top ) ? 'border-top-width:' . $top . $unit . $important . ';' : ''; $output .= ( '' !== $right ) ? 'border-right-width:' . $right . $unit . $important . ';' : ''; $output .= ( '' !== $bottom ) ? 'border-bottom-width:' . $bottom . $unit . $important . ';' : ''; $output .= ( '' !== $left ) ? 'border-left-width:' . $left . $unit . $important . ';' : ''; $output .= ( '' !== $color ) ? 'border-color:' . $color . $important . ';' : ''; $output .= ( '' !== $style ) ? 'border-style:' . $style . $important . ';' : ''; $output .= '}'; } $this->parent->output_css .= $output; return $output; } } }