. * * @package Redux_Field * @subpackage Border * @version 3.0.0 */ // Exit if accessed directly if( !defined( 'ABSPATH' ) ) exit; // Don't duplicate me! if( class_exists( 'ReduxFramework_border' ) ) return; class ReduxFramework_border extends ReduxFramework { /** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field = array(), $value ='', $parent){ //parent::__construct( $parent->sections, $parent->args ); $this->parent = $parent; $this->field = $field; $this->value = $value; }//function /** * Field Render Function. * * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render(){ // No errors please $defaults = array( 'top' => true, 'bottom' => true, 'all' => true, 'style' => true, 'color' => true, 'left' => true, 'right' => true, ); $this->field = wp_parse_args( $this->field, $defaults ); $defaults = array( 'top'=>'', 'right'=>'', 'bottom'=>'', 'left'=>'', 'color'=>'', 'style'=>'', ); $this->value = wp_parse_args( $this->value, $defaults ); $value = array( 'top' => isset( $this->value['border-top'] ) ? filter_var($this->value['border-top'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : filter_var($this->value['top'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 'right' => isset( $this->value['border-right'] ) ? filter_var($this->value['border-right'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : filter_var($this->value['right'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 'bottom' => isset( $this->value['border-bottom'] ) ? filter_var($this->value['border-bottom'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : filter_var($this->value['bottom'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 'left' => isset( $this->value['border-left'] ) ? filter_var($this->value['border-left'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : filter_var($this->value['left'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 'color' => isset( $this->value['border-color'] ) ? $this->value['border-color'] : $this->value['color'], 'style' => isset( $this->value['border-style'] ) ? $this->value['border-style'] : $this->value['style'] ); if ( ( isset( $this->value['width'] ) || isset( $this->value['border-width'] ) ) ) { if ( isset( $this->value['border-width'] ) && !empty( $this->value['border-width'] ) ) { $this->value['width'] = $this->value['border-width']; } $value['top'] = $this->value['width']; $value['right'] = $this->value['width']; $value['bottom'] = $this->value['width']; $value['left'] = $this->value['width']; } $this->value = $value; $defaults = array( 'top'=>'', 'right'=>'', 'bottom'=>'', 'left'=>'', ); $this->value = wp_parse_args( $this->value, $defaults ); echo ''; if ( isset( $this->field['all'] ) && $this->field['all'] == true ) { echo '