= 0) { if(function_exists('vc_add_shortcode_param')) { vc_add_shortcode_param('ultimate_spacing', array($this, 'ultimate_spacing_callback'), UAVC_URL.'admin/vc_extend/js/ultimate-spacing.js'); } } else { if(function_exists('add_shortcode_param')) { add_shortcode_param('ultimate_spacing', array($this, 'ultimate_spacing_callback'), UAVC_URL.'admin/vc_extend/js/ultimate-spacing.js'); } } } function ultimate_spacing_callback($settings, $value) { $dependency = ''; $positions = $settings['positions']; $mode = $settings['mode']; $uid = 'ultimate-spacing-'. rand(1000, 9999); if(isset($settings['unit'])) { $unit = $settings['unit']; } else { $unit = ''; } $html = '
'; // Expand / Collapse $html .= '
'; $html .= ' Expand / Collapse'; $html .= ' '; $html .= '
'; $html .= '
'; foreach($positions as $key => $default_value) { switch ($key) { case 'Top': // add '-width' if mode equals 'spacing' $dashicon = 'dashicons dashicons-arrow-up-alt'; $html .= $this->ultimate_spacing_param_item($dashicon, $mode, $unit, /*$default_value,*/$default_value, $key); break; case 'Right': $dashicon = 'dashicons dashicons-arrow-right-alt'; $html .= $this->ultimate_spacing_param_item($dashicon, $mode, $unit, /*$default_value,*/$default_value, $key); break; case 'Bottom': $dashicon = 'dashicons dashicons-arrow-down-alt'; $html .= $this->ultimate_spacing_param_item($dashicon, $mode, $unit, /*$default_value,*/$default_value, $key); break; case 'Left': $dashicon = 'dashicons dashicons-arrow-left-alt'; $html .= $this->ultimate_spacing_param_item($dashicon, $mode, $unit, /*$default_value,*/$default_value, $key); break; } } $html .= '
'; $html .= $this->get_units($unit); $html .= '
'; $html .= ' '; $html .= '
'; return $html; } function ultimate_spacing_param_item($dashicon, $mode, $unit,/* $default_value,*/$default_value, $key) { $html = '
'; $html .= ' '; $html .= ' '; $html .= ' '; $html .= ' '; $html .= '
'; return $html; } function get_units($unit) { // set units - px, em, % $html = '
'; //$html .= ' '; $html .= ' '; $html .= '
'; return $html; } function ultimate_spacing_param_scripts($hook) { if($hook == "post.php" || $hook == "post-new.php"){ $bsf_dev_mode = bsf_get_option('dev_mode'); if($bsf_dev_mode === 'enable') { wp_register_style( 'ultimate_spacing_css', UAVC_URL.'admin/vc_extend/css/ultimate_spacing.css'); wp_enqueue_style( 'ultimate_spacing_css'); } } } } } if(class_exists('Ult_Spacing')) { $Ult_Spacing = new Ult_Spacing(); }