C:\xampp\htdocs\landing\wp-content\plugins\Ultimate_VC_Addons\params\Ultimate_BoxShadow.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php

 
/**  # W3Schools
  *               - box-shadow: none|h-shadow v-shadow blur spread color |inset|initial|inherit;
  *
  *   How To?
  *
  *     array(
  *           "type" => "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_VERSION4.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(10009999); //$settings['param_name'];
        //$uid = uniqid('ultimate-boxshadow-'. $settings['param_name'] .'-'. rand());
        
$html  '<div class="ultimate-boxshadow" id="'.esc_attr$uid ).'" data-unit="'.esc_attr$unit ).'" >';

        
//  Box Shadow - Style
        
$label "Shadow Style";
        if(isset(
$settings['label_style']) && $settings['label_style']!='' ) { $label $settings['label_style']; }
        
$html .= '<div class="ultbs-select-block">';
        
$html .= '    <div class="ultbs-select-wrap">';
        
//$html .= '    <div class="label wpb_element_label">';
        //$html .=        $label;
        //$html .= '    </div>';
        
$html .= '        <select class="ultbs-select" >';
        
$html .= '            <option value="none">'.__('None','ultimate_vc').'</option>';
        
$html .= '            <option value="inherit">'.__('Inherit','ultimate_vc').'</option>';
        
$html .= '            <option value="inset">'.__('Inset','ultimate_vc').'</option>';
        
$html .= '            <option value="outset">'.__('Outset','ultimate_vc').'</option>';
        
/*$html .= '            <option value="initial">'.__('Initial','ultimate_vc').'</option>';*/
        
$html .= '        </select>';
        
$html .= '    </div>';
        
$html .= '</div>';

        
//  BORDER - WIDTH
        
$html .= '<div class="ultbs-input-block" >';
        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 .= '</div>';


        
//  Box Shadow - Color
        
if($enable_color) {
          
$label "Box Shadow Color";
          if(isset(
$settings['label_color']) && $settings['label_color']!='' ) { $label $settings['label_color']; }
          
$html .= '  <div class="ultbs-colorpicker-block">';
          
$html .= '    <div class="label wpb_element_label">';
          
$html .=        esc_html$label );
          
$html .= '    </div>';
          
$html .= '    <div class="ultbs-colorpicker-wrap">';
          
$html .= '      <input name="" class="ultbs-colorpicker cs-wp-color-picker" type="text" value="" />';
          
$html .= '    </div>';
          
$html .= '  </div>';
        }

        
$html .= '  <input type="hidden" data-unit="'esc_attr$unit ) .'" name="'esc_attr$settings['param_name'] ).'" class="wpb_vc_param_value ultbs-result-value 'esc_attr$settings['param_name'] ) .' 'esc_attr$settings['type'] ) .'_field" value="'esc_attr$value ) .'" '.$dependency.' />';
        
$html .= '</div>';
      return 
$html;
    }
    function 
ultimate_boxshadow_param_item($dashicon/*$mode,*/ $unit,/* $default_value,*/$default_value$key) {
        
$html  '  <div class="ultbs-input-wrap">';
        
$html .= '    <span class="ultbs-icon">';
        
$html .= '      <span class="ultbs-tooltip">'.esc_html$key ).'</span>';
        
$html .= '      <i class="'.esc_attr($dashicon).'"></i>';
        
$html .= '    </span>';
        
$html .= '    <input type="number" class="ultbs-input" data-unit="'esc_attr$unit ) .'" data-id="'.strtoloweresc_attr$key ) ).'" data-default="'esc_attr$default_value ) .'" placeholder="'esc_attr$key ) .'" />';
        
$html .= '  </div>';
        return 
$html;
    }
    function 
get_units($unit) {
      
//  set units - px, em, %
      
$html  '<div class="ultbs-unit">';
      
$html .= '  <label>'.esc_html$unit ).'</label>';
      
$html .= '</div>';
      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();
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586