"ultimate_boxshadow", * "heading" => __("Box Shadow", "ultimate_vc"), * "param_name" => "img_box_shadow", * "unit" => "px", // [required] px,em,%,all Default all * "positions" => array( * __("Horizontal","ultimate_vc") => "", * __("Vertical","ultimate_vc") => "", * __("Blur","ultimate_vc") => "", * __("Spread","ultimate_vc") => "" * ), * "label_color" => __("Shadow Color","ultimate_vc"), * //"label_style" => __("Style","ultimate_vc"), * "dependency" => Array("element" => "img_box_shadow_type", "value" => "on" ), * ), * */ if(!class_exists('Ultimate_BoxShadow')) { class Ultimate_BoxShadow { function __construct() { if(defined('WPB_VC_VERSION') && version_compare(WPB_VC_VERSION, 4.8) >= 0) { if(function_exists('vc_add_shortcode_param')) { vc_add_shortcode_param('ultimate_boxshadow', array($this, 'ultimate_boxshadow_callback'), UAVC_URL.'admin/vc_extend/js/vc-box-shadow-param.js'); } } else { if(function_exists('add_shortcode_param')) { add_shortcode_param('ultimate_boxshadow', array($this, 'ultimate_boxshadow_callback'), UAVC_URL.'admin/vc_extend/js/vc-box-shadow-param.js'); } } add_action( 'admin_enqueue_scripts', array( $this, 'ultimate_boxshadow_param_scripts' ) ); } function ultimate_boxshadow_callback($settings, $value) { $dependency = ''; $positions = $settings['positions']; $enable_color = isset($settings['enable_color']) ? $settings['enable_color'] : true; //$enable_radius = isset($settings['enable_radius']) ? $settings['enable_radius'] : true ; $unit = isset($settings['unit']) ? $settings['unit'] : 'px'; $uid = 'ultimate-boxshadow-'. rand(1000, 9999); //$settings['param_name']; //$uid = uniqid('ultimate-boxshadow-'. $settings['param_name'] .'-'. rand()); $html = '
'; // Box Shadow - Style $label = "Shadow Style"; if(isset($settings['label_style']) && $settings['label_style']!='' ) { $label = $settings['label_style']; } $html .= '
'; $html .= '
'; //$html .= '
'; //$html .= $label; //$html .= '
'; $html .= ' '; $html .= '
'; $html .= '
'; // BORDER - WIDTH $html .= '
'; foreach($positions as $key => $default_value) { switch ($key) { case 'Horizontal': $dashicon = 'dashicons dashicons-leftright'; $html .= $this->ultimate_boxshadow_param_item($dashicon, $unit, $default_value, $key); break; case 'Vertical': $dashicon = 'dashicons dashicons-sort'; $html .= $this->ultimate_boxshadow_param_item($dashicon, $unit, $default_value, $key); break; case 'Blur': $dashicon = 'dashicons dashicons-visibility'; $html .= $this->ultimate_boxshadow_param_item($dashicon, $unit, $default_value, $key); break; case 'Spread': $dashicon = 'dashicons dashicons-location'; $html .= $this->ultimate_boxshadow_param_item($dashicon, $unit, $default_value, $key); break; } } $html .= $this->get_units($unit); $html .= '
'; // Box Shadow - Color if($enable_color) { $label = "Box Shadow 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_boxshadow_param_item($dashicon, /*$mode,*/ $unit,/* $default_value,*/$default_value, $key) { $html = '
'; $html .= ' '; $html .= ' '.esc_html( $key ).''; $html .= ' '; $html .= ' '; $html .= ' '; $html .= '
'; return $html; } function get_units($unit) { // set units - px, em, % $html = '
'; $html .= ' '; $html .= '
'; return $html; } function ultimate_boxshadow_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_enqueue_style( 'wp-color-picker' ); wp_register_style( 'ultimate_boxshadow_param_css', UAVC_URL.'admin/vc_extend/css/vc_param_boxshadow.css'); wp_enqueue_style( 'ultimate_boxshadow_param_css'); //wp_register_script('ultimate_boxshadow_param_js',plugins_url( '../admin/vc_extend/js/vc-box-shadow-param.js', __FILE__ )); //wp_enqueue_style( 'ultimate_boxshadow_param_choosen_css', plugins_url('../admin/vc_extend/css/chosen.css', __FILE__ )); //wp_enqueue_script('ultimate_boxshadow_param_choosen_js',plugins_url( '../admin/vc_extend/js/chosen.js', __FILE__ )); } } } } } if(class_exists('Ultimate_BoxShadow')) { $Ultimate_BoxShadow = new Ultimate_BoxShadow(); }