PluginProbe
Visual Slider / trunk
Visual Slider vtrunk
visual-slider / layer / text.php

text.php in Visual Slider trunk, at layer/text.php

454 lines 14.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly.
4 }
5 /*****************************************************************************************************************************************************
6 ******************************************************************************************************************************************************
7
8 Slider Text Options
9
10 */////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
11 if (is_admin()){
12 if ( !function_exists ( "vs_text_options" )){
13
14 add_filter('vs_layer_element_options', 'vs_text_options');
15 function vs_text_options( $element ) {
16 $option = array();
17
18
19
20
21
22 $item = array(
23 'name' => __('Text','visual-slider'),
24 'id' => 'text',
25 'img' => VISUALSLIDER_DIR .'admin/assets/image/layer_text.png'
26
27 );
28
29 include VISUALSLIDER_PATH . 'layer/mini/position_size.php';
30
31
32 $option[]= array(
33 "name" => __('Text','visual-slider'),
34 "default" => __('Lorem ipsum dolor sit amet, consectetur adipiscing elit','visual-slider'),
35 "id" => "text",
36 "type" => "textarea",
37 "warp_width" => "100%",
38
39 "group" => __('Content','visual-slider'),
40 );
41
42
43 $option[]= array(
44 "name" => __('Link','visual-slider'),
45 "id" => "text_link",
46 "type" => "text",
47 "placeholder" => "http://",
48 "warp_width" => "100%",
49 "width" => "100%",
50 "group" => __('Content','visual-slider'),
51 );
52
53 $option[] = array(
54 "name" => __('Open in a new window','visual-slider'),
55 "id" => "text_widows",
56 "type" => "checkbox",
57 "group" => __('Content','visual-slider'),
58 );
59
60
61
62 $option[]= array(
63 "name" => __('HTML Tag','visual-slider'),
64 "id" => "text_html_tag",
65 "group" => __('Content','visual-slider'),
66 "type" => "select",
67 "default" => '',
68 "options" =>
69 array(
70 "" => __('Default','visual-slider'),
71 "h1" => 'H1',
72 "h2" => 'H2',
73 "h3" => 'H3',
74 "h4" => 'H4',
75 "h4" => 'H5',
76 "h6" => 'H6',
77 "div" => 'div',
78 "span" => 'span',
79 "p" => 'p',
80 ),
81 );
82
83
84
85
86 $option[]= array(
87 "responsive" => "desktop",
88
89 "name" => __('Alignment','visual-slider'),
90 "id" => "text_align",
91 "type" => "radio_image",
92 "default" => 'center',
93 "group" => __('Content','visual-slider'),
94 "options" => array(
95 'left' => VISUALSLIDER_DIR.'admin/assets/image/left.jpg',
96 'center' => VISUALSLIDER_DIR.'admin/assets/image/center.jpg',
97 'right' => VISUALSLIDER_DIR.'admin/assets/image/right.jpg',
98 ),
99
100 );
101
102
103 if(!empty(wp_unslash(filter_input( INPUT_POST, 'vs_tablet', FILTER_VALIDATE_BOOLEAN )))){
104 $option[]= array(
105 "responsive" => "tablet",
106 "name" => __('Responsive on tablet','visual-slider'),
107 "group" => __('Content','visual-slider'),
108 "id" => "tablet_text_align_heading",
109 "type" => "heading",
110 );
111
112 $option[]= array(
113 "responsive" => "tablet",
114 "name" => __('Alignment on Tablet','visual-slider'),
115 "id" => "tablet_text_align",
116 "type" => "radio_image",
117 "default" => '',
118 "group" => __('Content','visual-slider'),
119 "options" => array(
120 '' => VISUALSLIDER_DIR.'admin/assets/image/none.jpg',
121 'left' => VISUALSLIDER_DIR.'admin/assets/image/left.jpg',
122 'center' => VISUALSLIDER_DIR.'admin/assets/image/center.jpg',
123 'right' => VISUALSLIDER_DIR.'admin/assets/image/right.jpg',
124 ),
125
126 );
127
128
129
130 }
131 if(!empty(wp_unslash(filter_input( INPUT_POST, 'vs_mobile', FILTER_VALIDATE_BOOLEAN )))){
132
133
134 $option[]= array(
135 "responsive" => "mobile",
136 "name" => __('Responsive on Mobile','visual-slider'),
137 "group" => __('Content','visual-slider'),
138 "id" => "tablet_text_align_heading",
139 "type" => "heading",
140 );
141
142 $option[]= array(
143 "responsive" => "mobile",
144
145 "name" => __('Alignment on Mobile','visual-slider'),
146 "id" => "mobile_text_align",
147 "type" => "radio_image",
148 "default" => '',
149 "group" => __('Content','visual-slider'),
150 "options" => array(
151 '' => VISUALSLIDER_DIR.'admin/assets/image/none.jpg',
152 'left' => VISUALSLIDER_DIR.'admin/assets/image/left.jpg',
153 'center' => VISUALSLIDER_DIR.'admin/assets/image/center.jpg',
154 'right' => VISUALSLIDER_DIR.'admin/assets/image/right.jpg',
155 ),
156 );
157
158
159 }
160
161
162
163
164 /// *********************** Text*************************************************************************************/
165 $option[]= array(
166 "name" => __('Icon','visual-slider'),
167 "id" => "icon",
168 "type" => "icon",
169 "group" => __('Icon','visual-slider'),
170 );
171 $option[]= array(
172 "name" => __('Icon Alignment','visual-slider'),
173 "id" => "icon_align",
174 "fold" => array(
175 true => 'icon',
176 ),
177 "type" => "radio_image",
178 "group" => __('Icon','visual-slider'),
179 "options" => array(
180
181 'left' => VISUALSLIDER_DIR.'admin/assets/image/left.jpg',
182 'right' => VISUALSLIDER_DIR.'admin/assets/image/right.jpg',
183
184 ),
185
186 );
187
188 $option[]= array(
189 "name" => __('Hover','visual-slider'),
190 "id" => "icon_effects",
191 "group" => __('Icon','visual-slider'),
192 "type" => "hover",
193 "fold" => array(
194 true => 'icon',
195 ) ,
196 "options" => array(
197 'normal' => __('NORMAL','visual-slider'),
198 'hover' => __('HOVER','visual-slider'),
199 ),
200 );
201
202 $option[]= array(
203 "name" => __('Icon Color','visual-slider'),
204 "id" => "icon_color",
205 "fold" => array(
206 'normal' => 'icon_effects',
207 ),
208
209 "group" => __('Icon','visual-slider'),
210 "type" => "multi_options",
211 "options" => array(
212 array(
213 "id" => "first",
214 "type" => "color_rgba",
215 ),
216 ),
217 );
218 $option[]= array(
219 "name" => __('Icon Hover Color','visual-slider'),
220 "id" => "icon_hover_color",
221 "fold" => array(
222 'hover' => 'icon_effects',
223
224 ),
225 "group" => __('Icon','visual-slider'),
226 "type" => "multi_options",
227 "options" => array(
228 array(
229 "id" => "first",
230 "type" => "color_rgba",
231 ),
232 ),
233 );
234
235
236
237
238 $option[]= array(
239 "name" => __('Hover','visual-slider'),
240 "id" => "text_effects",
241 "group" => __('Style','visual-slider'),
242 "type" => "hover",
243 "options" => array(
244 'normal' => __('NORMAL','visual-slider'),
245 'hover' => __('HOVER','visual-slider'),
246 ),
247 );
248
249
250 $option[]= array(
251 "name" => __('Text Color','visual-slider'),
252 "id" => "text_color",
253 "fold" => array(
254 'normal' => 'text_effects',
255 ) ,
256 "group" => __('Style','visual-slider'),
257 "type" => "multi_options",
258 "options" => array(
259 array(
260 "id" => "first",
261 "type" => "color_rgba",
262 ),
263 ),
264 );
265
266 $option[]= array(
267 "name" => __('Text Hover Color','visual-slider'),
268 "id" => "text_hover_color",
269 "fold" => array(
270 'hover' => 'text_effects',
271 ) ,
272 "group" => __('Style','visual-slider'),
273 "type" => "multi_options",
274 "options" => array(
275 array(
276 "id" => "first",
277 "type" => "color_rgba",
278 ),
279 ),
280 );
281
282 $option[]= array(
283 "name" => __('Text Shadow','visual-slider'),
284 "id" => "text_shadow",
285 "fold" => array(
286 'normal' => 'text_effects',
287 ) ,
288 "group" => __('Style','visual-slider'),
289 "type" => "multi_options",
290 "options" => vs_multi_array_options('text_shadow'),
291
292 );
293
294
295 $option[]= array(
296 "name" => __('Text Hover Shadow','visual-slider'),
297 "id" => "text_hover_shadow",
298 "fold" => array(
299 'hover' => 'text_effects',
300 ) ,
301 "group" => __('Style','visual-slider'),
302 "type" => "multi_options",
303 "options" => vs_multi_array_options('text_shadow'),
304
305 );
306
307 /***********************************boxed************************************************************************************/
308 $boxed='text';
309 include VISUALSLIDER_PATH . 'layer/mini/boxed.php';
310 include VISUALSLIDER_PATH . 'layer/mini/text_typography.php';
311
312 include VISUALSLIDER_PATH . 'layer/mini/effect.php';
313
314 $item['options']=$option;
315 $element[]=$item;
316 return $element;
317 }
318 }
319 }
320 /*****************************************************************************************************************************************************
321 ******************************************************************************************************************************************************
322
323 Slider Text Config
324
325 */////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
326 if ( !function_exists ( "vs_text_perview" )){
327
328 add_filter('vs_layer_perview_text', 'vs_text_perview');
329 function vs_text_perview( $value ) {
330 $key= $value['key'];
331
332
333
334 echo '<aside id="vs_perview_layer_'.esc_attr($key).'" class="vs_draggable vs-layer-item " data-key="'.esc_attr($key).'" >';
335 echo '<div class="vs-text vs-layer-content" >';
336
337 echo '</div>';
338 echo '<div class="vs-layer-style"></div>';
339
340 echo '</aside>';
341 ////////////////////////////////////////////////////////////End////////////////////////////////////////////////////////////////////////////////////////
342
343
344
345
346 }
347 }
348 if ( !function_exists ( "vs_text_config" )){
349
350 add_filter('vs_layer_text', 'vs_text_config');
351 function vs_text_config( $value ) {
352 $option= $value['option'];
353 $key= $value['key'];
354 $global_key= $value['global_key'];
355 $slide_key= $value['slide_key'];
356
357 $text_html_tag = !empty($option['text_html_tag'])?$option['text_html_tag']:'div';
358 $text_boxed = !empty($option['text_boxed'])?$option['text_boxed']:'';
359 if($text_boxed=='boxed'){
360 $boxed ='vs-text-boxed';
361 }else{
362 $boxed ='vs-text-none';
363 }
364 $icon_align = !empty($option['icon_align'])?'vs-icon-'.vs_rtl_has($option['icon_align']).' ':'';
365
366
367 //text Css
368 echo '<aside class="vs-layer-'.esc_attr($key).' vs-layer-item '.esc_attr(vs_layer_effect_class($option)).' vs-layer-text">';
369
370 echo wp_kses('<'.$text_html_tag.' class="vs-text vs-layer-content '.$boxed.' '.$icon_align.'">',vs_kses());
371 if(!empty($option['text_link'])){
372 $target = !empty($option['text_widows']) ? 'target="_blank"' : '';
373
374 echo wp_kses('<a href="'.$option['text_link'].'" '.$target.' >',vs_kses());
375 }
376 if(!empty($option['icon'])){
377 vs_icon_fontfamily($option['icon']);
378 echo '<i class="'.esc_attr($option['icon']).'"></i>';
379 }
380 if(!empty($option['text'])){
381 echo wp_kses($option['text'],vs_kses());
382 }
383 if(!empty($option['text_link'])){
384 echo '</a>';
385 }
386 echo wp_kses( '</'.$text_html_tag.'>',vs_kses());
387
388
389
390 $css=vs_layer_position( $option);
391
392 $css.= vs_slider_var_align( 'txt-ag',$option,'text_align' );
393 $css.= vs_slider_var_align( 'tab-txt-ag',$option,'tablet_text_align' );
394 $css.= vs_slider_var_align( 'mob-txt-ag',$option,'mobile_text_align' );
395
396 $css.= vs_slider_var_2( 'txt-cr',$option,'text_color','first');
397 $css.= vs_slider_var_2( 'txt-hv-cr',$option,'text_hover_color','first');
398 $css.= vs_slider_var_text_shadow( 'txt',$option,'text_shadow');
399 $css.= vs_slider_var_text_shadow( 'txt-hv',$option,'text_hover_shadow','first');
400 $css.= vs_slider_var_2( 'icn-cr',$option,'icon_color','first');
401 $css.= vs_slider_var_2( 'icn-hv-cr',$option,'icon_hover_color','first');
402
403
404 if($text_boxed=='boxed'){
405 $css.=vs_slider_var_padding( 'txt-box-pd',$option,'text_boxed_padding');
406 $css.= vs_slider_var_gradient_background_color( 'txt-box',$option,'text_boxed_background');
407 $css.= vs_slider_var_gradient_background_color( 'txt-box-hv',$option,'text_boxed_hover_background');
408 $css.= vs_slider_var_border( 'txt-box',$option,'text_boxed_border');
409 $css.= vs_slider_var_border( 'txt-box-hv',$option,'text_boxed_hover_border');
410 $css.= vs_slider_var_shadow( 'txt-box',$option,'text_boxed_shadow');
411 $css.= vs_slider_var_shadow( 'txt-box-hv',$option,'text_boxed_hover_shadow');
412 $css.= vs_slider_var_radius( 'txt-box',$option,'text_boxed_radius');
413 }
414 $css.=vs_slider_var( 'txt-fn-fm',$option,'text_fontfamily');
415
416 $css.=vs_slider_var_unit( 'txt-fn-sz',$option,'text_font_size','px');
417 $css.=vs_slider_var_unit( 'txt-li-ht',$option,'text_line_height','em');
418 $css.=vs_slider_var( 'txt-fn-wt',$option,'text_font_weight');
419 $css.=vs_slider_var( 'txt-fn-de',$option,'text_font_decoration');
420 $css.=vs_slider_var( 'txt-fn-tf',$option,'text_font_transform');
421 $css.=vs_slider_var_unit( 'txt-lt-sp',$option,'text_spacing','px');
422 $css.=vs_slider_var( 'txt-fn-st',$option,'text_font_style');
423
424 $css.=vs_slider_var_unit( 'tab-txt-fn-sz',$option,'tablet_text_font_size','px');
425 $css.=vs_slider_var_unit( 'tab-txt-li-ht',$option,'tablet_text_line_height','em');
426
427
428 $css.=vs_slider_var_unit( 'mob-txt-fn-sz',$option,'mobile_text_font_size','px');
429 $css.=vs_slider_var_unit( 'mob-txt-li-ht',$option,'mobile_text_line_height','em');
430
431
432 $css.=vs_layer_effect( $option);
433 $fontface = vs_slider_fontface($option,'text_fontfamily','text_font_weight');
434 if(!is_rtl()){
435 vs_slider_fonts_family($option,'text_fontfamily','text_font_weight');
436 }
437 $item='';
438 if(!empty($global_key)){
439 $item.='.vs-global-'.$global_key.' ';
440 }
441 if(!empty($slide_key)){
442 $item.='.vs-slide-'.$slide_key.' ';
443 }
444 if(!empty($key)){
445 $item.='.vs-layer-'.$key.' ';
446 }
447
448 echo '<style>'.wp_kses(vs_slider_item_css( $css,$item).$fontface,vs_kses()).'</style>';
449
450 echo '</aside>';
451
452 }
453 }
454