PluginProbe
Easy Bootstrap Shortcode / trunk
Easy Bootstrap Shortcode vtrunk
trunk 2.4.0 2.5 3.4 3.5 3.6 3.7 4.0.0 4.4 4.5 4.5.4 5.0.0 5.0.1 5.0.2
easy-bootstrap-shortcodes / shortcode / wpcolumns / plugin_shortcode.php

plugin_shortcode.php in Easy Bootstrap Shortcode trunk, at shortcode/wpcolumns/plugin_shortcode.php

619 lines 16.7 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;
4 }
5 use EBS\Security\Sanitizer;
6
7 /* * *********************************************************
8 * Row
9 * ********************************************************* */
10
11 function osc_theme_row($params, $content = null) {
12 $atts = shortcode_atts(array(
13 'class' => ''
14 ), $params);
15 $class = Sanitizer::class_list( $atts['class'] );
16 $result = '<div class="row ' . $class . EBS_CONTAINER_CLASS . '">';
17 $content = str_replace("]<br />", ']', $content);
18 $content = str_replace("<br />\n[", '[', $content);
19 $result .= do_shortcode($content);
20 $result .= '</div>';
21
22 return $result;
23 }
24
25 ebs_backward_compatibility_callback('row', 'osc_theme_row');
26 /* * *********************************************************
27 * TWO
28 * ********************************************************* */
29
30 function osc_theme_column($params, $content = null) {
31 $atts = shortcode_atts(array(
32 'md' => '',
33 'sm' => '',
34 'xs' => '',
35 'lg' => '',
36 'mdoff' => '',
37 'smoff' => '',
38 'xsoff' => '',
39 'lgoff' => '',
40 'mdhide' => '',
41 'smhide' => '',
42 'xshide' => '',
43 'lghide' => '',
44 'mdclear' => '',
45 'smclear' => '',
46 'xsclear' => '',
47 'lgclear' => '',
48 'off' => ''
49 ), $params);
50
51 $arr = array('md', 'xs', 'sm');
52 $classes = array();
53 foreach ($arr as $k => $aa) {
54 $val = $atts[$aa];
55 if ($val == 12 || $val == '') {
56 $classes[] = 'col-' . $aa . '-12';
57 } else {
58 $classes[] = 'col-' . $aa . '-' . Sanitizer::int( $val );
59 }
60 }
61 $arr2 = array('mdoff', 'smoff', 'xsoff', 'lgoff');
62 foreach ($arr2 as $k => $aa) {
63 $nn = str_replace('off', '', $aa);
64 $val = $atts[$aa];
65 if ($val == 0 || $val == '') {
66 //$classes[] = '';
67 } else {
68 $classes[] = 'col-' . $nn . '-offset-' . Sanitizer::int( $val );
69 }
70 }
71 $arr2 = array('mdhide', 'smhide', 'xshide', 'lghide');
72 foreach ($arr2 as $k => $aa) {
73 $nn = str_replace('hide', '', $aa);
74 if ($atts[$aa] == 'yes') {
75 $classes[] = 'hidden-' . $nn;
76 }
77 }
78 $arr2 = array('mdclear', 'smclear', 'xsclear', 'lgclear');
79 foreach ($arr2 as $k => $aa) {
80 $nn = str_replace('clear', '', $aa);
81 if ($atts[$aa] == 'yes') {
82 $classes[] = 'clear-' . $nn;
83 }
84 }
85 $off = Sanitizer::int( $atts['off'] );
86 if ($off !== 0) {
87 $classes[] = 'col-lg-offset-' . $off;
88 }
89
90 $lg = Sanitizer::int( $atts['lg'] );
91 $result = '<div class="col-lg-' . $lg . ' ' . implode(' ', $classes) . EBS_CONTAINER_CLASS . '">';
92 $result .= do_shortcode($content);
93 $result .= '</div>';
94
95 return $result;
96 }
97
98 ebs_backward_compatibility_callback('column', 'osc_theme_column');
99
100
101 function osc_theme_one_half($params, $content = null) {
102 $atts = shortcode_atts(array(
103 'md' => '',
104 'sm' => '',
105 'xs' => '',
106 'off' => ''
107 ), $params);
108 $md = $atts['md'];
109 $sm = $atts['sm'];
110 $xs = $atts['xs'];
111 if ($md == 12) {
112 $mds = '';
113 } else {
114 $mds = 'col-md-' . Sanitizer::int( $md );
115 }
116 if ($sm == 12) {
117 $sms = '';
118 } else {
119 $sms = 'col-sm-' . Sanitizer::int( $sm );
120 }
121 if ($xs == 12) {
122 $xss = '';
123 } else {
124 $xss = 'col-xs-' . Sanitizer::int( $xs );
125 }
126 $result = '<div class="col-lg-6 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-half">';
127 $result .= do_shortcode($content);
128 $result .= '</div>';
129
130 return $result;
131 }
132
133 ebs_backward_compatibility_callback('one_half', 'osc_theme_one_half');
134
135 function osc_theme_one_half_last($params, $content = null) {
136 $atts = shortcode_atts(array(
137 'md' => '',
138 'sm' => '',
139 'xs' => '',
140 'off' => ''
141 ), $params);
142 $md = $atts['md'];
143 $sm = $atts['sm'];
144 $xs = $atts['xs'];
145 if ($md == 12) {
146 $mds = '';
147 } else {
148 $mds = 'col-md-' . Sanitizer::int( $md );
149 }
150 if ($sm == 12) {
151 $sms = '';
152 } else {
153 $sms = 'col-sm-' . Sanitizer::int( $sm );
154 }
155 if ($xs == 12) {
156 $xss = '';
157 } else {
158 $xss = 'col-xs-' . Sanitizer::int( $xs );
159 }
160 $result = '<div class="col-lg-6 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-half-last">';
161 $result .= do_shortcode($content);
162 $result .= '</div>';
163
164 return $result;
165 }
166
167 ebs_backward_compatibility_callback('one_half_last', 'osc_theme_one_half_last');
168
169 /* * *********************************************************
170 * THIRD
171 * ********************************************************* */
172
173 function osc_theme_one_third($params, $content = null) {
174 $atts = shortcode_atts(array(
175 'md' => '',
176 'sm' => '',
177 'xs' => '',
178 'off' => ''
179 ), $params);
180 $md = $atts['md'];
181 $sm = $atts['sm'];
182 $xs = $atts['xs'];
183 if ($md == 12) {
184 $mds = '';
185 } else {
186 $mds = 'col-md-' . Sanitizer::int( $md );
187 }
188 if ($sm == 12) {
189 $sms = '';
190 } else {
191 $sms = 'col-sm-' . Sanitizer::int( $sm );
192 }
193 if ($xs == 12) {
194 $xss = '';
195 } else {
196 $xss = 'col-xs-' . Sanitizer::int( $xs );
197 }
198 $result = '<div class="sc-column col-lg-4 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' ">';
199 $result .= do_shortcode($content);
200 $result .= '</div>';
201
202 return $result;
203 }
204
205 ebs_backward_compatibility_callback('one_third', 'osc_theme_one_third');
206
207 function osc_theme_one_third_last($params, $content = null) {
208 $atts = shortcode_atts(array(
209 'md' => '',
210 'sm' => '',
211 'xs' => '',
212 'off' => ''
213 ), $params);
214 $md = $atts['md'];
215 $sm = $atts['sm'];
216 $xs = $atts['xs'];
217 if ($md == 12) {
218 $mds = '';
219 } else {
220 $mds = 'col-md-' . Sanitizer::int( $md );
221 }
222 if ($sm == 12) {
223 $sms = '';
224 } else {
225 $sms = 'col-sm-' . Sanitizer::int( $sm );
226 }
227 if ($xs == 12) {
228 $xss = '';
229 } else {
230 $xss = 'col-xs-' . Sanitizer::int( $xs );
231 }
232 $result = '<div class="col-lg-4 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' column-last">';
233 $result .= do_shortcode($content);
234 $result .= '</div>';
235
236 return $result;
237 }
238
239 ebs_backward_compatibility_callback('one_third_last', 'osc_theme_one_third_last');
240
241 function osc_theme_two_third($params, $content = null) {
242 $atts = shortcode_atts(array(
243 'md' => '',
244 'sm' => '',
245 'xs' => '',
246 'off' => ''
247 ), $params);
248 $md = $atts['md'];
249 $sm = $atts['sm'];
250 $xs = $atts['xs'];
251 if ($md == 12) {
252 $mds = '';
253 } else {
254 $mds = 'col-md-' . Sanitizer::int( $md );
255 }
256 if ($sm == 12) {
257 $sms = '';
258 } else {
259 $sms = 'col-sm-' . Sanitizer::int( $sm );
260 }
261 if ($xs == 12) {
262 $xss = '';
263 } else {
264 $xss = 'col-xs-' . Sanitizer::int( $xs );
265 }
266 $result = '<div class=" col-lg-8 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' ">';
267 $result .= do_shortcode($content);
268 $result .= '</div>';
269
270 return $result;
271 }
272
273 ebs_backward_compatibility_callback('two_third', 'osc_theme_two_third');
274
275 function osc_theme_two_third_last($params, $content = null) {
276 $atts = shortcode_atts(array(
277 'md' => '',
278 'sm' => '',
279 'xs' => '',
280 'off' => ''
281 ), $params);
282 $md = $atts['md'];
283 $sm = $atts['sm'];
284 $xs = $atts['xs'];
285 if ($md == 12) {
286 $mds = '';
287 } else {
288 $mds = 'col-md-' . Sanitizer::int( $md );
289 }
290 if ($sm == 12) {
291 $sms = '';
292 } else {
293 $sms = 'col-sm-' . Sanitizer::int( $sm );
294 }
295 if ($xs == 12) {
296 $xss = '';
297 } else {
298 $xss = 'col-xs-' . Sanitizer::int( $xs );
299 }
300 $result = '<div class="col-lg-8 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' column-last ">';
301 $result .= do_shortcode($content);
302 $result .= '</div>';
303
304 return $result;
305 }
306
307 ebs_backward_compatibility_callback('two_third_last', 'osc_theme_two_third_last');
308
309 /* * *********************************************************
310 * FOURTH
311 * ********************************************************* */
312
313 function osc_theme_one_fourth($params, $content = null) {
314 $atts = shortcode_atts(array(
315 'md' => '',
316 'sm' => '',
317 'xs' => '',
318 'off' => ''
319 ), $params);
320 $md = $atts['md'];
321 $sm = $atts['sm'];
322 $xs = $atts['xs'];
323 if ($md == 12) {
324 $mds = '';
325 } else {
326 $mds = 'col-md-' . Sanitizer::int( $md );
327 }
328 if ($sm == 12) {
329 $sms = '';
330 } else {
331 $sms = 'col-sm-' . Sanitizer::int( $sm );
332 }
333 if ($xs == 12) {
334 $xss = '';
335 } else {
336 $xss = 'col-xs-' . Sanitizer::int( $xs );
337 }
338 $result = '<div class="col-lg-3 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-fourth">';
339 $result .= do_shortcode($content);
340 $result .= '</div>';
341
342 return $result;
343 }
344
345 ebs_backward_compatibility_callback('one_fourth', 'osc_theme_one_fourth');
346
347 function osc_theme_one_fourth_last($params, $content = null) {
348 $atts = shortcode_atts(array(
349 'md' => '',
350 'sm' => '',
351 'xs' => '',
352 'off' => ''
353 ), $params);
354 $md = $atts['md'];
355 $sm = $atts['sm'];
356 $xs = $atts['xs'];
357 if ($md == 12) {
358 $mds = '';
359 } else {
360 $mds = 'col-md-' . Sanitizer::int( $md );
361 }
362 if ($sm == 12) {
363 $sms = '';
364 } else {
365 $sms = 'col-sm-' . Sanitizer::int( $sm );
366 }
367 if ($xs == 12) {
368 $xss = '';
369 } else {
370 $xss = 'col-xs-' . Sanitizer::int( $xs );
371 }
372 $result = '<div class="col-lg-3 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' column-last one-fourth-last">';
373 $result .= do_shortcode($content);
374 $result .= '</div>';
375
376 return $result;
377 }
378
379 ebs_backward_compatibility_callback('one_fourth_last', 'osc_theme_one_fourth_last');
380
381 function osc_theme_three_fourth($params, $content = null) {
382 $atts = shortcode_atts(array(
383 'md' => '',
384 'sm' => '',
385 'xs' => '',
386 'off' => ''
387 ), $params);
388 $md = $atts['md'];
389 $sm = $atts['sm'];
390 $xs = $atts['xs'];
391 if ($md == 12) {
392 $mds = '';
393 } else {
394 $mds = 'col-md-' . Sanitizer::int( $md );
395 }
396 if ($sm == 12) {
397 $sms = '';
398 } else {
399 $sms = 'col-sm-' . Sanitizer::int( $sm );
400 }
401 if ($xs == 12) {
402 $xss = '';
403 } else {
404 $xss = 'col-xs-' . Sanitizer::int( $xs );
405 }
406 $result = '<div class="col-lg-3 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' three-fourth">';
407 $result .= do_shortcode($content);
408 $result .= '</div>';
409
410 return $result;
411 }
412
413 ebs_backward_compatibility_callback('three_fourth', 'osc_theme_three_fourth');
414
415 function osc_theme_three_fourth_last($params, $content = null) {
416 $atts = shortcode_atts(array(
417 'md' => '',
418 'sm' => '',
419 'xs' => '',
420 'off' => ''
421 ), $params);
422 $md = $atts['md'];
423 $sm = $atts['sm'];
424 $xs = $atts['xs'];
425 if ($md == 12) {
426 $mds = '';
427 } else {
428 $mds = 'col-md-' . Sanitizer::int( $md );
429 }
430 if ($sm == 12) {
431 $sms = '';
432 } else {
433 $sms = 'col-sm-' . Sanitizer::int( $sm );
434 }
435 if ($xs == 12) {
436 $xss = '';
437 } else {
438 $xss = 'col-xs-' . Sanitizer::int( $xs );
439 }
440 $result = '<div class="col-lg-6 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' column-last three-fourth-last">';
441 $result .= do_shortcode($content);
442 $result .= '</div>';
443
444 return $result;
445 }
446
447 ebs_backward_compatibility_callback('three_fourth_last', 'osc_theme_three_fourth_last');
448
449 function osc_theme_one_fourth_second($params, $content = null) {
450 $atts = shortcode_atts(array(
451 'md' => '',
452 'sm' => '',
453 'xs' => '',
454 'off' => ''
455 ), $params);
456 $md = $atts['md'];
457 $sm = $atts['sm'];
458 $xs = $atts['xs'];
459 if ($md == 12) {
460 $mds = '';
461 } else {
462 $mds = 'col-md-' . Sanitizer::int( $md );
463 }
464 if ($sm == 12) {
465 $sms = '';
466 } else {
467 $sms = 'col-sm-' . Sanitizer::int( $sm );
468 }
469 if ($xs == 12) {
470 $xss = '';
471 } else {
472 $xss = 'col-xs-' . Sanitizer::int( $xs );
473 }
474 $result = '<div class="col-lg-3 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-fourth-second">';
475 $result .= do_shortcode($content);
476 $result .= '</div>';
477
478 return $result;
479 }
480
481 ebs_backward_compatibility_callback('one_fourth_second', 'osc_theme_one_fourth_second');
482
483 function osc_theme_one_fourth_third($params, $content = null) {
484 $atts = shortcode_atts(array(
485 'md' => '',
486 'sm' => '',
487 'xs' => '',
488 'off' => ''
489 ), $params);
490 $md = $atts['md'];
491 $sm = $atts['sm'];
492 $xs = $atts['xs'];
493 if ($md == 12) {
494 $mds = '';
495 } else {
496 $mds = 'col-md-' . Sanitizer::int( $md );
497 }
498 if ($sm == 12) {
499 $sms = '';
500 } else {
501 $sms = 'col-sm-' . Sanitizer::int( $sm );
502 }
503 if ($xs == 12) {
504 $xss = '';
505 } else {
506 $xss = 'col-xs-' . Sanitizer::int( $xs );
507 }
508
509 $result = '<div class="col-lg-3 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-fourth-third">';
510 $result .= do_shortcode($content);
511 $result .= '</div>';
512
513 return $result;
514 }
515
516 ebs_backward_compatibility_callback('one_fourth_third', 'osc_theme_one_fourth_third');
517
518 function osc_theme_one_half_second($params, $content = null) {
519 $atts = shortcode_atts(array(
520 'md' => '',
521 'sm' => '',
522 'xs' => '',
523 'off' => ''
524 ), $params);
525 $md = $atts['md'];
526 $sm = $atts['sm'];
527 $xs = $atts['xs'];
528 if ($md == 12) {
529 $mds = '';
530 } else {
531 $mds = 'col-md-' . Sanitizer::int( $md );
532 }
533 if ($sm == 12) {
534 $sms = '';
535 } else {
536 $sms = 'col-sm-' . Sanitizer::int( $sm );
537 }
538 if ($xs == 12) {
539 $xss = '';
540 } else {
541 $xss = 'col-xs-' . Sanitizer::int( $xs );
542 }
543 $result = '<div class="col-lg-6 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-half-second">';
544 $result .= do_shortcode($content);
545 $result .= '</div>';
546
547 return $result;
548 }
549
550 ebs_backward_compatibility_callback('one_half_second', 'osc_theme_one_half_second');
551
552 function osc_theme_one_third_second($params, $content = null) {
553 $atts = shortcode_atts(array(
554 'md' => '',
555 'sm' => '',
556 'xs' => '',
557 'off' => ''
558 ), $params);
559 $md = $atts['md'];
560 $sm = $atts['sm'];
561 $xs = $atts['xs'];
562 if ($md == 12) {
563 $mds = '';
564 } else {
565 $mds = 'col-md-' . Sanitizer::int( $md );
566 }
567 if ($sm == 12) {
568 $sms = '';
569 } else {
570 $sms = 'col-sm-' . Sanitizer::int( $sm );
571 }
572 if ($xs == 12) {
573 $xss = '';
574 } else {
575 $xss = 'col-xs-' . Sanitizer::int( $xs );
576 }
577 $result = '<div class="col-lg-4 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-third-second">';
578 $result .= do_shortcode($content);
579 $result .= '</div>';
580
581 return $result;
582 }
583
584 ebs_backward_compatibility_callback('one_third_second', 'osc_theme_one_third_second');
585
586 function osc_theme_one_column($params, $content = null) {
587 $atts = shortcode_atts(array(
588 'md' => '',
589 'sm' => '',
590 'xs' => '',
591 'off' => ''
592 ), $params);
593 $md = $atts['md'];
594 $sm = $atts['sm'];
595 $xs = $atts['xs'];
596 if ($md == 12) {
597 $mds = '';
598 } else {
599 $mds = 'col-md-' . Sanitizer::int( $md );
600 }
601 if ($sm == 12) {
602 $sms = '';
603 } else {
604 $sms = 'col-sm-' . Sanitizer::int( $sm );
605 }
606 if ($xs == 12) {
607 $xss = '';
608 } else {
609 $xss = 'col-xs-' . Sanitizer::int( $xs );
610 }
611 $result = '<div class="col-lg-12 ' . $mds . ' ' . $sms . ' ' . $xss . ' col-lg-offset-' . Sanitizer::int( $atts['off'] ) . EBS_CONTAINER_CLASS . ' one-column">';
612 $result .= do_shortcode($content);
613 $result .= '</div>';
614
615 return $result;
616 }
617
618 ebs_backward_compatibility_callback('one_column', 'osc_theme_one_column');
619