= 0) { if(function_exists('vc_add_shortcode_param')) { vc_add_shortcode_param('ultimate_border', array($this, 'ultimate_border_callback'), UAVC_URL.'admin/vc_extend/js/ultimate-border.js'); } } else { if(function_exists('add_shortcode_param')) { add_shortcode_param('ultimate_border', array($this, 'ultimate_border_callback'), UAVC_URL.'admin/vc_extend/js/ultimate-border.js'); } } } function ultimate_border_callback($settings, $value) { $dependency = ''; $positions = $settings['positions']; $enable_radius = isset($settings['enable_radius']) ? $settings['enable_radius'] : true ; $label = isset($settings['label_border']) ? $settings['label_border'] : 'Border Style'; $unit = isset($settings['unit']) ? $settings['unit'] : 'px'; $uid = 'ultimate-border-'. rand(1000, 9999); //$settings['param_name']; //$uid = uniqid('ultimate-border-'. $settings['param_name'] .'-'. rand()); $html = '
'; /** BORDER - {STYLE} *---------------------------------------------------*/ $html .= '
'; //$html .= '
'; //$html .= $label; //$html .= '
'; $html .= '
'; $html .= ' '; $html .= '
'; $html .= '
'; /** BORDER - {WIDTH} *---------------------------------------------------*/ $label = "Border Width"; if(isset($settings['label_width']) && $settings['label_width']!='' ) { $label = $settings['label_width']; } $html .= '
'; $html .= '
'; $html .= esc_html( $label ); $html .= '
'; $html .= '
Expand / Collapse
'; foreach($positions as $key => $default_value) { switch ($key) { case 'Top': $id = 'border-' .strtolower($key). '-width'; $dashicon = 'dashicons dashicons-arrow-up-alt'; $html .= $this->ultimate_border_param_item($dashicon, /*$mode,*/ $unit, /*$default_value,*/$default_value, $key, $id); break; case 'Right': $id = 'border-' .strtolower($key). '-width'; $dashicon = 'dashicons dashicons-arrow-right-alt'; $html .= $this->ultimate_border_param_item($dashicon, /*$mode,*/ $unit, /*$default_value,*/$default_value, $key, $id); break; case 'Bottom': $id = 'border-' .strtolower($key). '-width'; $dashicon = 'dashicons dashicons-arrow-down-alt'; $html .= $this->ultimate_border_param_item($dashicon, /*$mode,*/ $unit, /*$default_value,*/$default_value, $key, $id); break; case 'Left': $id = 'border-' .strtolower($key). '-width'; $dashicon = 'dashicons dashicons-arrow-left-alt'; $html .= $this->ultimate_border_param_item($dashicon, /*$mode,*/ $unit, /*$default_value,*/$default_value, $key, $id); break; } } // {all} - border width $html .= '
'; $html .= ' '; $html .= ' '; $html .= ' '; $html .= ' '; $html .= '
'; // set units - px, em, % $html .= '
'; //$html .= ' '; $html .= ' '; $html .= '
'; $html .= '
'; /** BORDER - {RADIUS} *---------------------------------------------------*/ if($enable_radius) : $label = "Border Radius"; if(isset($settings['label_radius']) && $settings['label_radius']!='' ) { $label = $settings['label_radius']; } $html .= '
'; $html .= '
'; $html .= esc_html( $label ); $html .= '
'; $html .= '
Expand / Collapse
'; $radius = $settings['radius']; foreach($radius as $key => $default_value) { switch ($key) { case 'Top Left': $key = 'top-left-radius'; $dashicon = 'dashicons dashicons-arrow-up-alt'; $placeholder = 'T. Left'; $html .= $this->ultimate_border_radius_item($dashicon, /*$mode,*/ $unit, $default_value, /*$default_value,*//*$default_value,*/ $key, $placeholder); break; case 'Top Right': $key = 'top-right-radius'; $dashicon = 'dashicons dashicons-arrow-right-alt'; $placeholder = 'T. Right'; $html .= $this->ultimate_border_radius_item($dashicon, /*$mode,*/ $unit, $default_value, /*$default_value,*//*$default_value,*/ $key, $placeholder); break; case 'Bottom Right': $key = 'bottom-right-radius'; $dashicon = 'dashicons dashicons-arrow-down-alt'; $placeholder = 'B. Right'; $html .= $this->ultimate_border_radius_item($dashicon, /*$mode,*/ $unit, $default_value, /*$default_value,*//*$default_value,*/ $key, $placeholder); break; case 'Bottom Left': $key = 'bottom-left-radius'; $dashicon = 'dashicons dashicons-arrow-left-alt'; $placeholder = 'B. Left'; $html .= $this->ultimate_border_radius_item($dashicon, /*$mode,*/ $unit, $default_value, /*$default_value,*//*$default_value,*/ $key, $placeholder); break; } } // {all} - border radius $html .= '
'; $html .= ' '; $html .= ' '; $html .= ' '; $html .= ' '; $html .= '
'; // set units - px, em, % $html .= '
'; //$html .= ' '; $html .= ' '; $html .= '
'; $html .= '
'; endif; // add color picker $label = "Border Color"; if(isset($settings['label_color']) && $settings['label_color']!='' ) { $label = $settings['label_color']; } $html .= '
'; $html .= '
'; $html .= esc_html( $label ); $html .= '
'; $html .= '
'; $html .= ' '; $html .= '
'; $html .= '
'; $html .= ' '; $html .= '
'; return $html; } function ultimate_border_radius_item($dashicon, /*$mode,*/ $unit,/* $default_value,*/$default_value, $key, $placeholder) { $html = '
'; $html .= ' '; $html .= ' '; $html .= ' '; $html .= ' '; $html .= '
'; return $html; } function ultimate_border_param_item($dashicon, /*$mode,*/ $unit,/* $default_value,*/$default_value, $key, $id) { $html = '
'; $html .= ' '; $html .= ' '; $html .= ' '; $html .= ' '; $html .= '
'; return $html; } function ultimate_border_param_scripts($hook) { wp_register_style("ultimate-border-style", UAVC_URL.'admin/vc_extend/css/ultimate_border.css'); if($hook == "post.php" || $hook == "post-new.php"){ $bsf_dev_mode = bsf_get_option('dev_mode'); if( $bsf_dev_mode === 'enable' ) { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'ultimate-border-style'); wp_enqueue_style( 'ultimate-chosen-style'); wp_enqueue_script('ultimate-chosen-script'); } } } } } if(class_exists('Ultimate_Border')) { $Ultimate_Border = new Ultimate_Border(); }