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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
<?php /* * Add-on Name: Image Separator */ if(!class_exists('Ultimate_Image_Separator')) { class Ultimate_Image_Separator{ function __construct(){ if ( Ultimate_VC_Addons::$uavc_editor_enable ) { add_action('init',array($this,'ultimate_img_separator_init')); } add_shortcode('ultimate_img_separator',array($this,'ultimate_img_separator_shortcode')); add_action('wp_enqueue_scripts', array($this, 'register_easy_separator_assets'),1); } function register_easy_separator_assets() { Ultimate_VC_Addons::ultimate_register_style( 'ult-easy-separator-style', 'image-separator' ); Ultimate_VC_Addons::ultimate_register_script( 'ult-easy-separator-script', 'image-separator', false, array( 'jquery' ), ULTIMATE_VERSION, false ); } function ultimate_img_separator_init(){ if(function_exists('vc_map')) { vc_map( array( "name" => __("Image Separator","ultimate_vc"), "base" => "ultimate_img_separator", "class" => "vc_img_separator_icon", "icon" => "vc_icon_img_separator", "category" => "Ultimate VC Addons", "description" => __("Add image as row seperator","ultimate_vc"), "params" => array( array( 'type' => 'ult_img_single', 'heading' => __('Image','ultimate_vc'), 'param_name' => 'img_separator', ), array( "type" => "animator", "class" => "", "heading" => __("Animation","ultimate_vc"), "param_name" => "animation", "value" => "", "group" => "Animation" //"description" => __("","smile"), ), array( "type" => "number", "class" => "", "heading" => __("Animation Duration","ultimate_vc"), "param_name" => "animation_duration", "value" => 3, "min" => 1, "max" => 100, "suffix" => "s", "description" => __("How long the animation effect should last. Decides the speed of effect.","ultimate_vc"), "group" => "Animation",
), array( "type" => "number", "class" => "", "heading" => __("Animation Delay","ultimate_vc"), "param_name" => "animation_delay", "value" => 0, "min" => 1, "max" => 100, "suffix" => "s", "description" => __("Delays the animation effect for seconds you enter above.","ultimate_vc"), "group" => "Animation" ), array( "type" => "number", "class" => "", "heading" => __("Animation Repeat Count","ultimate_vc"), "param_name" => "animation_iteration_count", "value" => 1, "min" => 0, "max" => 100, "suffix" => "", "description" => __("The animation effect will repeat to the count you enter above. Enter 0 if you want to repeat it infinitely.","ultimate_vc"), "group" => "Animation" ), array( "type" => "number", "class" => "", "heading" => __("Viewport Position", "ultimate_vc"), "param_name" => "opacity_start_effect", "suffix" => "%", //"admin_label" => true, "value" => "90", "description" => __("The area of screen from top where animation effects will start working.", "ultimate_vc"), "group" => "Animation" ),
array( 'type' => 'ultimate_responsive', 'heading' => __('Image Size (px)','ultimate_vc'), 'unit' => 'px', // use '%' or 'px' 'media' => array( 'Desktop' => '', // Here '28' is default value set for 'Desktop' 'Tablet' => '', 'Tablet Portrait' => '', 'Mobile Landscape' => '', 'Mobile' => '', ), 'param_name' => 'img_separator_width' ), array( 'type' => 'dropdown', 'heading' => __('Image Position','ultimate_vc'), 'param_name' => 'img_separator_position', 'value' => array( __('Top','ultimate_vc') => 'ult-top-easy-separator', __('Bottom','ultimate_vc') => 'ult-bottom-easy-separator', ) ), array( 'type' => 'number', 'heading' => __('Gutter','ultimate_vc'), 'param_name' => 'img_separator_gutter', 'suffix' => '%', 'description' => __('50% is default. Increase to push the image outside or decrease to pull the image inside.','ultimate_vc') ), array( 'type' => 'dropdown', 'heading' => __('Image Alignment','ultimate_vc'), 'param_name' => 'img_separator_alignment', 'value' => array( __('Center','ultimate_vc') => 'ult-center-img', __('Left','ultimate_vc') => 'ult-left-img', __('Right','ultimate_vc') => 'ult-right-img', ) ), array( 'type' => 'number', 'heading' => __('Image Position from Left','ultimate_vc'), 'param_name' => 'img_position_left', 'suffix' => '%', // 'description' => __('50% is default. Increase to push the image outside or decrease to pull the image inside.','ultimate_vc') "dependency"=>Array("element"=>"img_separator_alignment","value"=>array("ult-left-img")), ), array( 'type' => 'number', 'heading' => __('Image Position from right','ultimate_vc'), 'param_name' => 'img_position_right', 'suffix' => '%', // 'description' => __('50% is default. Increase to push the image outside or decrease to pull the image inside.','ultimate_vc') "dependency"=>Array("element"=>"img_separator_alignment","value"=>array("ult-right-img")), ), array( "type" => "vc_link", "heading" => __("Link ","ultimate_vc"), "param_name" => "sep_link", "value" => "", "description" => __("Add a custom link or select existing page. You can remove existing link as well.","ultimate_vc") ), ), ) ); } } // Shortcode handler function for stats banner function ultimate_img_separator_shortcode($atts, $content) { $output = $wrapper_class = $custom_position = $opacity_start_effect_data = $animation_style = $animation_el_class = $animation_data = $href = $url = $link_title = $target = $target = $link_title = $rel = ''; $is_animation = false; extract(shortcode_atts( array( 'img_separator' => '', 'animation' => '', 'img_separator_width' => '', 'img_separator_position' => 'ult-top-easy-separator', 'img_separator_alignment' => 'ult-center-img', 'img_separator_gutter' => '', 'img_position_left' => '', 'img_position_right' => '', 'opacity' => 'set', 'opacity_start_effect' => '', 'animation_duration' => '', 'animation_delay' => '', 'animation_iteration_count' => '', 'sep_link' => '' ),$atts));
$ultimate_custom_vc_row = get_option('ultimate_custom_vc_row'); if($ultimate_custom_vc_row == '') $ultimate_custom_vc_row = 'wpb_row';
$img = apply_filters('ult_get_img_single', $img_separator, 'url'); $alt = apply_filters('ult_get_img_single', $img_separator, 'alt');
$id = 'ult-easy-separator-'.uniqid(rand());
if( $sep_link !='' ){ $href = vc_build_link($sep_link); $url = ( isset( $href['url'] ) && $href['url'] !== '' ) ? $href['url'] : ''; $target = ( isset( $href['target'] ) && $href['target'] !== '' ) ? esc_attr( trim( $href['target'] ) ) : ''; $link_title = ( isset( $href['title'] ) && $href['title'] !== '' ) ? esc_attr($href['title']) : ''; $rel = ( isset( $href['rel'] ) && $href['rel'] !== '' ) ? esc_attr($href['rel']) : ''; }
$args = array( 'target' => '#'.$id, // set targeted element e.g. unique class/id etc. 'media_sizes' => array( 'width' => $img_separator_width ), ); $data_list = get_ultimate_vc_responsive_media_css($args);
$trans = '-50%'; if ( is_rtl() ) { $trans = '50%'; } if( $img_separator_alignment == 'ult-left-img' || $img_separator_alignment == 'ult-right-img' ){ $trans = '0'; }
if($img_separator_gutter != '') { $wrapper_class = 'ult-easy-separator-no-default'; if($img_separator_position == 'ult-top-easy-separator' ) { $img_separator_gutter = '-'.$img_separator_gutter; //$custom_position = 'top:'.$img_separator_gutter.'%;'; $custom_position .= 'transform: translate('. $trans .','.$img_separator_gutter.'%)!important;'; $custom_position .= '-ms-transform: translate('. $trans .','.$img_separator_gutter.'%)!important;'; $custom_position .= '-webkit-transform: translate('. $trans .','.$img_separator_gutter.'%)!important;';
} else if($img_separator_position == 'ult-bottom-easy-separator' ) { //$custom_position = 'bottom:'.$img_separator_gutter.'%;'; $custom_position .= 'transform: translate('. $trans .','.$img_separator_gutter.'%)!important;'; $custom_position .= '-ms-transform: translate('. $trans .','.$img_separator_gutter.'%)!important;'; $custom_position .= '-webkit-transform: translate('. $trans .','.$img_separator_gutter.'%)!important;'; } }
$img_alignment = ''; if($img_separator_alignment == 'ult-left-img' && ! wp_is_mobile() ) { $img_alignment = 'ult-left-img'; } else if($img_separator_alignment == 'ult-right-img' && ! wp_is_mobile() ) { $img_alignment = 'ult-right-img'; } else { $img_alignment = ''; }
$img_alignment_position = $img_separator_gutter_value = ''; if($img_separator_gutter != ''){ $img_separator_gutter_value = esc_attr($img_separator_gutter); } else { $img_separator_gutter_value = '50'; }
if($img_separator_alignment == 'ult-left-img' && $img_position_left != '' && ! wp_is_mobile() ) { $img_alignment_position = 'left:'.$img_position_left.'%;'; $img_alignment_position .= 'transform: translate(-'.$img_position_left.'%,'.$img_separator_gutter_value.'%);'; $img_alignment_position .= '-ms-transform: translate(-'.$img_position_left.'%,'.$img_separator_gutter_value.'%);'; $img_alignment_position .= '-webkit-transform: translate(-'.$img_position_left.'%,'.$img_separator_gutter_value.'%);'; } else if($img_separator_alignment == 'ult-right-img' && $img_position_right != '' && ! wp_is_mobile() ){ $img_alignment_position = 'right:'.$img_position_right.'%;'; $img_alignment_position .= 'transform: translate('.$img_position_right.'%,'.$img_separator_gutter_value.'%);'; $img_alignment_position .= '-ms-transform: translate('.$img_position_right.'%,'.$img_separator_gutter_value.'%);'; $img_alignment_position .= '-webkit-transform: translate('.$img_position_right.'%,'.$img_separator_gutter_value.'%);'; } else{ $img_alignment_position = ''; }
$animation_style .= 'opacity:0;'; if( strtolower($animation) !== strtolower('No Animation')) { $is_animation = true; $inifinite_arr = array("InfiniteRotate", "InfiniteDangle","InfiniteSwing","InfinitePulse","InfiniteHorizontalShake","InfiniteBounce","InfiniteFlash","InfiniteTADA"); if($animation_iteration_count == 0 || in_array($animation,$inifinite_arr)){ $animation_iteration_count = 'infinite'; $animation = 'infinite '.$animation; } if($opacity == "set"){ $animation_el_class .= ' ult-animation ult-animate-viewport '; $opacity_start_effect_data = 'data-opacity_start_effect="'.esc_attr($opacity_start_effect).'"'; } $animation_data .= ' data-animate="'.esc_attr($animation).'" '; $animation_data .= ' data-animation-delay="'.esc_attr($animation_delay).'" '; $animation_data .= ' data-animation-duration="'.esc_attr($animation_duration).'" '; $animation_data .= ' data-animation-iteration="'.esc_attr($animation_iteration_count).'" '; } else $animation_el_class .= 'ult-no-animation';
$output = '<div id="'.esc_attr($id).'" class="ult-easy-separator-wrapper ult-responsive '.esc_attr($img_separator_position).' '.esc_attr($wrapper_class).' '.esc_attr($img_alignment).'" style="'.esc_attr($custom_position).''.esc_attr($img_alignment_position).'" data-vc-row="'.esc_attr($ultimate_custom_vc_row).'" '.$data_list.'>'; $output .= '<div class="ult-easy-separator-inner-wrapper">'; $output .= '<div class="'.esc_attr($animation_el_class).'" style="'.esc_attr($animation_style).'" '.$animation_data.' '.$opacity_start_effect_data.'>'; $output .= '<img class="ult-easy-separator-img" alt="'.esc_attr($alt).'" src="'.esc_url(apply_filters('ultimate_images', $img)).'" />'; if($url != '') { $output .= '<a '. Ultimate_VC_Addons::uavc_link_init($url, $target, $link_title, $rel ).'></a>'; } $output .= '</div>'; $output .= '</div>'; $output .= '</div>';
return $output; } } } if(class_exists('Ultimate_Image_Separator')) { $Ultimate_Image_Separator = new Ultimate_Image_Separator; }
?>
|