Shortcodes by Angie Makes - Version 2.06

Version Description

Download this release

Release Info

Developer cbaldelomar
Plugin Icon wp plugin Shortcodes by Angie Makes
Version 2.06
Comparing to
See all releases

Code changes from version 2.05 to 2.06

README.md CHANGED
@@ -66,6 +66,10 @@ Use the shortcode manager in the TinyMCE text editor
66
 
67
  ## Changelog ##
68
 
 
 
 
 
69
  ### Version 2.05
70
 
71
  * minor style update
66
 
67
  ## Changelog ##
68
 
69
+ ### Version 2.06
70
+
71
+ * sanitized, escaped, and validated all POST calls
72
+
73
  ### Version 2.05
74
 
75
  * minor style update
includes/classes/sanitize.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sanitize Class
4
+ */
5
+ class WCShortcodes_Sanitize {
6
+ static public function bool( $value ) {
7
+ if ( 'true' == $value ) {
8
+ return true;
9
+ }
10
+ else if ( 'false' == $value ) {
11
+ return false;
12
+ }
13
+
14
+ return (bool) $value;
15
+ }
16
+
17
+ static public function text_field( $value ) {
18
+ return trim( sanitize_text_field( $value ) );
19
+ }
20
+
21
+ static public function int_float( $value ) {
22
+ $value = filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
23
+
24
+ return $value;
25
+ }
26
+
27
+ static public function positive_number( $value ) {
28
+ $value = preg_replace("/[^0-9\-]/", "",$value);
29
+ $value = intval( $value );
30
+
31
+ if ( empty( $value ) )
32
+ $value = 0;
33
+
34
+ if ( 0 > $value )
35
+ $value = 0;
36
+
37
+ return $value;
38
+ }
39
+
40
+ static public function number( $value ) {
41
+ $value = preg_replace("/[^0-9\-]/", "",$value);
42
+ $value = intval( $value );
43
+
44
+ if ( empty( $value ) )
45
+ $value = '0';
46
+
47
+ return $value;
48
+ }
49
+
50
+ static public function pixel( $value ) {
51
+ if ( '' == $value )
52
+ return $value;
53
+
54
+ $value = preg_replace("/[^0-9\-]/", "",$value);
55
+ $value = intval( $value );
56
+
57
+ if ( empty( $value ) )
58
+ $value = '0';
59
+
60
+ return $value."px";
61
+ }
62
+
63
+ static public function css_unit( $value, $css_unit = 'px' ) {
64
+ if ( '' == $value )
65
+ return $value;
66
+
67
+ $value = trim( $value );
68
+ if ( preg_match( '/(px|em|rem)$/', $value, $match ) ) {
69
+ $css_unit = $match[1];
70
+ }
71
+ $value = filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
72
+
73
+ if ( empty( $value ) )
74
+ $value = '0';
75
+
76
+ return $value . $css_unit;
77
+ }
78
+
79
+ static public function hex_color( $color ) {
80
+ if ( '' === $color )
81
+ return '';
82
+
83
+ // 3 or 6 hex digits, or the empty string.
84
+ if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
85
+ return $color;
86
+
87
+ return '';
88
+ }
89
+
90
+ static public function heading_type( $value, $default = 'h2' ) {
91
+ $whitelist = array(
92
+ 'h1',
93
+ 'h2',
94
+ 'h3',
95
+ 'h4',
96
+ 'h5',
97
+ 'h6',
98
+ 'p',
99
+ 'strong',
100
+ 'span',
101
+ );
102
+
103
+ if ( in_array( $value, $whitelist ) )
104
+ return $value;
105
+
106
+ return $default;
107
+ }
108
+
109
+ }
includes/shortcode-functions.php CHANGED
@@ -83,28 +83,10 @@ function wc_shortcodes_fullwidth( $atts, $content = null ) {
83
 
84
  wp_enqueue_script('wc-shortcodes-fullwidth');
85
 
86
- return '<div class="wc-shortcodes-full-width wc-shortcodes-content" data-selector="' . esc_attr($selector) . '">' . do_shortcode( $content ) . '</div>';
87
  }
88
 
89
 
90
- // /*
91
- // * Fix Shortcodes
92
- // * @since v1.0
93
- // */
94
- // if( !function_exists('wc_shortcodes_fix') ) {
95
- // function wc_shortcodes_fix($content){
96
- // $array = array (
97
- // '<p>[' => '[',
98
- // ']</p>' => ']',
99
- // ']<br />' => ']'
100
- // );
101
- // $content = strtr($content, $array);
102
- // return $content;
103
- // }
104
- // add_filter('the_content', 'wc_shortcodes_fix');
105
- // }
106
-
107
-
108
  /**
109
  * Easily Display HTML in post
110
  *
@@ -124,8 +106,8 @@ function wc_shortcodes_displayhtml( $atts, $content = null ) {
124
  'name' => ''
125
  ), $atts));
126
 
127
-
128
- $name = trim( $name );
129
  $name = preg_replace( '/^_/', '', $name );
130
 
131
  if ( empty( $name ) )
@@ -174,7 +156,13 @@ function wc_shortcodes_displaypre( $atts, $content = null ) {
174
  'wrap' => 0,
175
  ), $atts));
176
 
177
- $name = trim( $name );
 
 
 
 
 
 
178
  $class = array();
179
  if ( (int) $color ) {
180
  $class[] = 'prettyprint';
@@ -199,7 +187,7 @@ function wc_shortcodes_displaypre( $atts, $content = null ) {
199
  wp_enqueue_script('wc-shortcodes-prettify');
200
  wp_enqueue_script('wc-shortcodes-pre');
201
  //$code = preg_replace( '/[ ]{4,}|[\t]/', ' ', $code );
202
- $html .= '<pre id="prettycode-'.$instance.'" class="'.$class.'">';
203
  $html .= htmlspecialchars( $code );
204
  $html .= '</pre>';
205
  }
@@ -221,45 +209,6 @@ if( !function_exists('wc_shortcodes_clear_floats') ) {
221
  }
222
 
223
 
224
- /*
225
- * Skillbars
226
- * @since v1.4
227
- */
228
- if( !function_exists('wc_shortcodes_callout') ) {
229
- function wc_shortcodes_callout( $atts, $content = NULL ) {
230
- extract( shortcode_atts( array(
231
- 'caption' => '',
232
- 'button_text' => '',
233
- 'button_color' => 'blue',
234
- 'button_url' => 'http://www.wpexplorer.com',
235
- 'button_rel' => 'nofollow',
236
- 'button_target' => 'blank',
237
- 'button_border_radius' => '',
238
- 'class' => '',
239
- 'icon_left' => '',
240
- 'icon_right' => ''
241
- ), $atts ) );
242
-
243
- $border_radius_style = ( $button_border_radius ) ? 'style="border-radius:'. $button_border_radius .'"' : NULL;
244
- $output = '<div class="wc-shortcodes-callout wc-shortcodes-clearfix '. $class .'">';
245
- $output .= '<div class="wc-shortcodes-callout-caption">';
246
- if ( $icon_left ) $output .= '<span class="wc-shortcodes-callout-icon-left icon-'. $icon_left .'"></span>';
247
- $output .= do_shortcode ( $content );
248
- if ( $icon_right ) $output .= '<span class="wc-shortcodes-callout-icon-right icon-'. $icon_right .'"></span>';
249
- $output .= '</div>';
250
- if ( $button_text !== '' ) {
251
- $output .= '<div class="wc-shortcodes-callout-button">';
252
- $output .='<a href="'. $button_url .'" title="'. $button_text .'" target="_'. $button_target .'" class="wc-shortcodes-button '.$button_color .'" '. $border_radius_style .'><span class="wc-shortcodes-button-inner">'. $button_text .'</span></a>';
253
- $output .='</div>';
254
- }
255
- $output .= '</div>';
256
-
257
- return $output;
258
- }
259
- add_shortcode( 'wc_callout', 'wc_shortcodes_callout' );
260
- }
261
-
262
-
263
  /*
264
  * Skillbars
265
  * @since v1.3
@@ -273,15 +222,20 @@ if( !function_exists('wc_shortcodes_skillbar') ) {
273
  'class' => '',
274
  'show_percent' => 'true'
275
  ), $atts ) );
 
 
 
 
 
276
 
277
  // Enque scripts
278
  wp_enqueue_script('wc-shortcodes-skillbar');
279
 
280
  // Display the accordion ';
281
- $output = '<div class="wc-shortcodes-skillbar wc-shortcodes-item wc-shortcodes-clearfix '. $class .'" data-percent="'. $percentage .'%">';
282
- if ( $title !== '' ) $output .= '<div class="wc-shortcodes-skillbar-title" style="background: '. $color .';"><span>'. $title .'</span></div>';
283
- $output .= '<div class="wc-shortcodes-skillbar-bar" style="background: '. $color .';"></div>';
284
- if ( $show_percent == 'true' ) {
285
  $output .= '<div class="wc-shortcodes-skill-bar-percent">'.$percentage.'%</div>';
286
  }
287
  $output .= '</div>';
@@ -301,9 +255,12 @@ if( !function_exists('wc_shortcodes_spacing') ) {
301
  extract( shortcode_atts( array(
302
  'size' => '20px',
303
  'class' => '',
304
- ),
305
- $atts ) );
306
- return '<hr class="wc-shortcodes-spacing '. $class .'" style="height: '. $size .'" />';
 
 
 
307
  }
308
  add_shortcode( 'wc_spacing', 'wc_shortcodes_spacing' );
309
  }
@@ -322,6 +279,7 @@ if( !function_exists('wc_shortcodes_social_icons') ) {
322
  'maxheight' => '0',
323
  ), $atts));
324
 
 
325
  $maxheight = (int) $maxheight;
326
 
327
  if ( empty( $maxheight ) ) {
@@ -358,8 +316,8 @@ if( !function_exists('wc_shortcodes_social_icons') ) {
358
 
359
  $first = true;
360
 
361
- $html = '<div class="' . $class . '">';
362
- $html .= '<ul class="'.implode( ' ', $classes ).'">';
363
  foreach ( $order as $key => $value ) {
364
  $link_option_name = WC_SHORTCODES_PREFIX . $key . '_link';
365
  $image_icon_option_name = WC_SHORTCODES_PREFIX . $key . '_icon';
@@ -374,18 +332,18 @@ if( !function_exists('wc_shortcodes_social_icons') ) {
374
  if ( $show_image ) {
375
  $icon_url = get_option( $image_icon_option_name );
376
 
377
- $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . $key . $first_class . '">';
378
- $html .='<a target="_blank" href="'.$social_link.'">';
379
- $html .= '<img src="'.$icon_url.'" alt="'.$value.'">';
380
  $html .= '</a>';
381
  $html .= '</li>';
382
  }
383
  else {
384
  $icon_class = get_option( $font_icon_option_name );
385
 
386
- $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . $key . $first_class . '">';
387
- $html .='<a target="_blank" href="'.$social_link.'">';
388
- $html .= '<i class="fa '.$icon_class.'"></i>';
389
  $html .= '</a>';
390
  $html .= '</li>';
391
  }
@@ -407,9 +365,9 @@ if ( !function_exists( 'wc_shortcodes_highlight' ) ) {
407
  extract( shortcode_atts( array(
408
  'color' => 'yellow',
409
  'class' => '',
410
- ),
411
- $atts ) );
412
- return '<span class="wc-shortcodes-highlight wc-shortcodes-highlight-'. $color .' '. $class .'">' . do_shortcode( $content ) . '</span>';
413
 
414
  }
415
  add_shortcode( 'wc_highlight', 'wc_shortcodes_highlight' );
@@ -435,10 +393,11 @@ if( !function_exists('wc_shortcodes_button') ) {
435
  'class' => '',
436
  ), $atts ) );
437
 
 
 
 
438
  $custom_class = sanitize_title( $class );
439
 
440
- $whitelist = array( 'center', 'left', 'right' );
441
-
442
  // $border_radius_style = ( $border_radius ) ? 'style="border-radius:'. $border_radius .'"' : NULL;
443
  $rel = ( $rel ) ? 'rel="'.$rel.'"' : NULL;
444
  $type = 'wc-shortcodes-button-' . $type;
@@ -450,15 +409,20 @@ if( !function_exists('wc_shortcodes_button') ) {
450
  if ( ! empty( $custom_class ) )
451
  $class[] = $custom_class;
452
 
453
- $button = NULL;
454
- $button .= '<a href="' . $url . '" class="'.implode( ' ', $class ).'" target="_'.$target.'" title="'. $title .'" '. $rel .'>';
455
  $button .= '<span class="wc-shortcodes-button-inner">';
456
- if ( $icon_left ) $button .= '<span class="wc-shortcodes-button-icon-left icon-'. $icon_left .'"></span>';
457
- $button .= $content;
458
- if ( $icon_right ) $button .= '<span class="wc-shortcodes-button-icon-right icon-'. $icon_right .'"></span>';
 
 
 
 
459
  $button .= '</span>';
460
  $button .= '</a>';
461
 
 
462
  if ( in_array( $position, $whitelist ) ) {
463
  $button = '<div class="wc-shortcodes-item wc-shortcodes-button-'.$position.'">'. $button .'</div>';
464
  }
@@ -485,6 +449,9 @@ if( !function_exists('wc_shortcodes_box') ) {
485
  'class' => '',
486
  ), $atts ) );
487
 
 
 
 
488
  $style_attr = '';
489
 
490
  if( $margin_bottom ) {
@@ -495,8 +462,10 @@ if( !function_exists('wc_shortcodes_box') ) {
495
  }
496
 
497
  $alert_content = '';
498
- $alert_content .= '<div class="wc-shortcodes-box wc-shortcodes-item wc-shortcodes-content wc-shortcodes-clearfix wc-shortcodes-box-' . $color . ' '. $class .'" style="text-align:'. $text_align .';'. $style_attr .'">';
 
499
  $alert_content .= ' '. do_shortcode($content) .'</div>';
 
500
  return $alert_content;
501
  }
502
  }
@@ -518,15 +487,15 @@ if( !function_exists('wc_shortcodes_testimonial') ) {
518
  ), $atts ) );
519
 
520
  if ( ! empty( $url ) ) {
521
- $url = esc_url( $url );
522
- $by = '<a href="' . $url . '">' . $by . '</a>';
523
  }
524
 
525
  $testimonial_content = '';
526
- $testimonial_content .= '<div class="wc-shortcodes-testimonial wc-shortcodes-item wc-shortcodes-clearfix wc-shortcodes-testimonial-'.$position.' '. $class .'"><div class="wc-shortcodes-testimonial-content wc-shortcodes-content">';
527
  $testimonial_content .= $content;
528
  $testimonial_content .= '</div><div class="wc-shortcodes-testimonial-author">';
529
  $testimonial_content .= $by .'</div></div>';
 
530
  return $testimonial_content;
531
  }
532
  }
@@ -544,12 +513,14 @@ if( !function_exists('wc_shortcodes_center') ) {
544
  'max_width' => '500px',
545
  'text_align' => 'center',
546
  'class' => '',
547
- ), $atts ) );
 
 
548
 
549
  // $append_clearfix = '<div class="wc-shortcodes-clear-floats"></div>';
550
- $style = empty( $max_width ) ? '' : ' style="max-width:'.$max_width.';"';
551
 
552
- return '<div class="wc-shortcodes-center wc-shortcodes-item wc-shortcodes-content wc-shortcodes-clearfix wc-shortcodes-center-inner-align-'. $text_align .' '. $class .'"' . $style . '>' . do_shortcode($content) . '</div>';
553
  }
554
  }
555
 
@@ -567,21 +538,21 @@ if( !function_exists('wc_shortcodes_column') ) {
567
  'position' =>'',
568
  'class' => '',
569
  'text_align'=> '',
570
- ), $atts ) );
571
 
572
  $style = '';
573
  if ( $text_align ) {
574
  if ( 'left' == $text_align )
575
- $style = ' style="text-align: '.$text_align.';"';
576
  if ( 'center' == $text_align )
577
- $style = ' style="text-align: '.$text_align.';"';
578
  if ( 'right' == $text_align )
579
- $style = ' style="text-align: '.$text_align.';"';
580
  }
581
 
582
  $append_clearfix = 'last' == $position ? '<div class="wc-shortcodes-clear-floats"></div>' : '';
583
 
584
- return '<div'.$style.' class="wc-shortcodes-column wc-shortcodes-content wc-shortcodes-' . $size . ' wc-shortcodes-column-'.$position.' '. $class .'">' . do_shortcode($content) . '</div>';
585
  }
586
  }
587
 
@@ -615,6 +586,8 @@ if( !function_exists('wc_shortcodes_toggle') ) {
615
  'layout' => 'box',
616
  ), $atts ) );
617
 
 
 
618
  $classes = array();
619
 
620
  $classes[] = 'wc-shortcodes-toggle';
@@ -641,7 +614,7 @@ if( !function_exists('wc_shortcodes_toggle') ) {
641
  wp_enqueue_script('wc-shortcodes-toggle');
642
 
643
  // Display the Toggle
644
- return '<div class="'. $class .'"><div class="wc-shortcodes-toggle-trigger"><a href="#">'. $title .'</a></div><div style="'.$style.'" class="wc-shortcodes-toggle-container wc-shortcodes-content">' . do_shortcode($content) . '</div></div>';
645
  }
646
  }
647
 
@@ -663,18 +636,21 @@ if( !function_exists('wc_shortcodes_accordion_main') ) {
663
  'layout' => 'box',
664
  ), $atts ) );
665
 
 
 
 
666
  $classes = array();
667
 
668
  $classes[] = 'wc-shortcodes-accordion';
669
  $classes[] = 'wc-shortcodes-item';
670
 
671
  $behavior = 'autoclose';
672
- if ( (int) $leaveopen ) {
673
  $behavior = 'leaveopen';
674
  }
675
 
676
  $state = 'default';
677
- if ( (int) $collapse ) {
678
  $classes[] = 'wc-shortcodes-accordion-collapse';
679
  $state = 'collapse';
680
  }
@@ -694,7 +670,7 @@ if( !function_exists('wc_shortcodes_accordion_main') ) {
694
  wp_enqueue_script('wc-shortcodes-accordion');
695
 
696
  // Display the accordion
697
- return '<div class="'. $class .'" data-behavior="'.$behavior.'" data-start-state="'.$state.'">' . do_shortcode($content) . '</div>';
698
  }
699
  }
700
 
@@ -707,7 +683,7 @@ if( !function_exists('wc_shortcodes_accordion_section') ) {
707
  'class' => '',
708
  ), $atts ) );
709
 
710
- return '<div class="wc-shortcodes-accordion-trigger '. $class .'"><a href="#">'. $title .'</a></div><div class="wc-shortcodes-accordion-content wc-shortcodes-content">' . do_shortcode($content) . '</div>';
711
  }
712
 
713
  }
@@ -751,7 +727,7 @@ if (!function_exists('wc_shortcodes_tabgroup')) {
751
  if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
752
  $output = '';
753
  if( count($tab_titles) ){
754
- $output .= '<div id="wc-shortcodes-tab-'. $instance .'" class="'.$class.'">';
755
  $output .= '<ul class="wcs-tabs-nav wc-shortcodes-clearfix">';
756
  $i = 0;
757
  foreach( $tab_titles as $tab ){
@@ -780,7 +756,7 @@ if (!function_exists('wc_shortcodes_tab')) {
780
 
781
  $class = implode( ' ', $classes );
782
 
783
- return '<div id="wc-shortcodes-tab-'. sanitize_title( $title ) .'" class="'. $class .'">'. do_shortcode( $content ) .'</div>';
784
  }
785
  }
786
 
@@ -792,7 +768,6 @@ if (!function_exists('wc_shortcodes_tab')) {
792
  * @since v1.0
793
  *
794
  */
795
-
796
  /*section*/
797
  if( !function_exists('wc_shortcodes_pricing') ) {
798
  function wc_shortcodes_pricing( $atts, $content = null ) {
@@ -811,16 +786,16 @@ if( !function_exists('wc_shortcodes_pricing') ) {
811
 
812
  //start content
813
  $pricing_content ='';
814
- $pricing_content .= '<div class="wc-shortcodes-pricing wc-shortcodes-pricing-type-'. $type .' '. $class .'">';
815
  $pricing_content .= '<div class="wc-shortcodes-pricing-header">';
816
- $pricing_content .= '<h5>'. $plan. '</h5>';
817
- $pricing_content .= '<div class="wc-shortcodes-pricing-cost">'. $cost .'</div><div class="wc-shortcodes-pricing-per">'. $per .'</div>';
818
  $pricing_content .= '</div>';
819
  $pricing_content .= '<div class="wc-shortcodes-pricing-content">';
820
  $pricing_content .= ''. $content. '';
821
  $pricing_content .= '</div>';
822
  if( $button_url ) {
823
- $pricing_content .= '<div class="wc-shortcodes-pricing-button"><a href="'. $button_url .'" class="wc-shortcodes-button wc-shortcodes-button-'.$type.'" target="_'. $button_target .'" rel="'. $button_rel .'"><span class="wc-shortcodes-button-inner">'. $button_text .'</span></a></div>';
824
  }
825
  $pricing_content .= '</div>';
826
  return $pricing_content;
@@ -849,6 +824,8 @@ if( !function_exists('wc_shortcodes_heading') ) {
849
  'icon_spacing' => '',
850
  ), $atts ) );
851
 
 
 
852
  $style_attr = '';
853
 
854
  if ( $font_size ) {
@@ -873,15 +850,15 @@ if( !function_exists('wc_shortcodes_heading') ) {
873
  if ( 'h1' == $type )
874
  $class = trim( 'entry-title ' . $class );
875
 
876
- $output = '<'.$type.' class="wc-shortcodes-heading '. $text_align .' '. $class .'" style="'.$style_attr.'"><span>';
877
 
878
  if ( $icon_left )
879
- $output .= '<i class="wc-shortcodes-button-icon-left fa fa-'. $icon_left .'" style="margin-right:'.$icon_spacing.'"></i>';
880
 
881
- $output .= $title;
882
 
883
  if ( $icon_right )
884
- $output .= '<i class="wc-shortcodes-button-icon-right fa fa-'. $icon_right .'" style="margin-left:'.$icon_spacing.'"></i>';
885
 
886
  $output .= '</span></'.$type.'>';
887
 
@@ -904,14 +881,17 @@ if (! function_exists( 'wc_shortcodes_googlemaps' ) ) :
904
  $instance++;
905
 
906
  extract(shortcode_atts(array(
907
- 'title' => '', // content inside the info window
908
- 'title_on_load' => 'no', // should the info window display on map load
909
- 'location' => '', // Enter a valid address that Google can geocode.
910
- 'height' => '300', // set the height of your google map in pixels
911
- 'zoom' => 8, // the lower the zoom, the farther away the map appears
912
- 'class' => '', // add a custom class to your google map
913
  ), $atts));
914
 
 
 
 
915
  $title_on_load = 'yes' == $title_on_load ? 1 : 0;
916
 
917
  // load scripts
@@ -922,9 +902,9 @@ if (! function_exists( 'wc_shortcodes_googlemaps' ) ) :
922
  $class[] = 'googlemap';
923
  $class[] = 'wc-shortcodes-item';
924
 
925
- $output = '<div id="map_canvas_'.$instance.'" class="' . implode( ' ', $class ) . '" style="height:'.$height.'px;width:100%">';
926
- $output .= (!empty($title)) ? '<input class="title" type="hidden" value="'.$title.'" />' : '';
927
- $output .= '<input class="location" type="hidden" value="'.$location.'" />';
928
  $output .= '<input class="zoom" type="hidden" value="'.$zoom.'" />';
929
  $output .= '<input class="title-on-load" type="hidden" value="'.$title_on_load.'" />';
930
  $output .= '<div class="map_canvas"></div>';
@@ -951,6 +931,9 @@ if( !function_exists('wc_shortcodes_divider') ) {
951
  'class' => '',
952
  ), $atts ) );
953
 
 
 
 
954
  $style_attr = array();
955
 
956
  if ( $margin_top && $margin_bottom ) {
@@ -962,13 +945,13 @@ if( !function_exists('wc_shortcodes_divider') ) {
962
  }
963
 
964
  if ( ! empty ( $style_attr ) ) {
965
- $style_attr = 'style="' . implode( '', $style_attr ) . '"';
966
  }
967
  else {
968
  $style_attr = '';
969
  }
970
 
971
- return '<hr class="wc-shortcodes-divider wc-shortcodes-item wc-shortcodes-divider-line-'.$line.' wc-shortcodes-divider-style-'. $style .' '. $class .'" '.$style_attr.' />';
972
  }
973
  add_shortcode( 'wc_divider', 'wc_shortcodes_divider' );
974
  }
@@ -1018,7 +1001,7 @@ if( !function_exists('wc_shortcodes_rsvp') ) {
1018
 
1019
  wp_enqueue_script('wc-shortcodes-rsvp');
1020
 
1021
- $columns = (int) $columns;
1022
  $columns = 3 == $columns ? $columns : 1;
1023
 
1024
  $html = '';
@@ -1304,7 +1287,7 @@ if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1304
  }
1305
 
1306
  $html .= '<div class="wc-shortcodes-posts-wrapper">';
1307
- $html .= '<div id="wc-shortcodes-posts-'.$instance.'" data-gutter-space="'.$display["gutter_space"].'" data-columns="'.$display["columns"].'" class="' . implode( ' ', $class ) . '">';
1308
 
1309
  while( $wc_shortcodes_posts_query->have_posts() ) :
1310
  $wc_shortcodes_posts_query->the_post();
@@ -1565,7 +1548,7 @@ if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1565
  $class[] = 'wc-shortcodes-posts-template-' . $display['template'];
1566
 
1567
  $html .= '<div id="" class="wc-shortcodes-post-slider-wrapper">';
1568
- $html .= '<div id="wc-shortcodes-post-slider-'.$instance.'" class="' . implode( ' ', $class ) . '" data-mode="' . $display['slider_mode'] . '" data-pause="' . $display['slider_pause'] . '" data-auto="' . $display['slider_auto'] . '">';
1569
 
1570
  while( $wc_shortcodes_posts_query->have_posts() ) {
1571
  $wc_shortcodes_posts_query->the_post();
@@ -1620,11 +1603,14 @@ if( !function_exists('wc_shortcodes_image') ) {
1620
  'class' => '',
1621
  ), $atts ) );
1622
 
 
 
 
1623
  // function options
1624
  $div_wrapper = false;
1625
 
1626
  // sanitize
1627
- $attachment_id = (int) $attachment_id;
1628
 
1629
  // classes
1630
  $classes = array();
@@ -1650,7 +1636,7 @@ if( !function_exists('wc_shortcodes_image') ) {
1650
  return '<p>Please insert a valid image</p>';
1651
  }
1652
 
1653
- $html = '<img alt="' . $alt . '" title="' . $title . '" src="' . $src . '" class="' . esc_attr( implode( ' ', $classes ) ) . '" />';
1654
 
1655
  // insert flag
1656
  if ( ! empty( $flag ) ) {
@@ -1667,29 +1653,29 @@ if( !function_exists('wc_shortcodes_image') ) {
1667
  $style[] = 'background-color:' . $background_color;
1668
  if ( ! empty( $text_color ) )
1669
  $style[] = 'color:' . $text_color;
1670
- if ( is_numeric( $font_size ) )
1671
- $style[] = 'font-size:' . (int) $font_size . 'px';
1672
  if ( in_array( $text_align, $whitelist ) )
1673
  $style[] = 'text-align:' . $text_align;
1674
- if ( is_numeric( $flag_width ) && ! empty( $flag_width ) )
1675
- $style[] = 'width:' . (int) $flag_width . 'px';
1676
 
1677
 
1678
- $html .= '<span style="' . implode( ';', $style ) . '" class="wc-shortcodes-image-flag-bg"><span class="wc-shortcodes-image-flag-text">' . esc_html( $flag ) . '</span></span>';
1679
  $div_wrapper = true;
1680
 
1681
  }
1682
 
1683
  // check link_to
1684
- if ( ! empty( $url ) )
1685
- $url = esc_url( $url );
1686
- else if ( 'file' == $link_to )
1687
- $url = wp_get_attachment_url( $attachment_id );
1688
- else if ( 'post' == $link_to )
1689
- $url = get_attachment_link( $attachment_id );
1690
 
1691
  if ( 'none' != $link_to )
1692
- $html = '<a class="wc-shortcodes-image-anchor" href="' . $url . '">' . $html . '</a>';
1693
 
1694
  // insert caption
1695
  if ( ! empty( $caption ) ) {
@@ -1700,7 +1686,7 @@ if( !function_exists('wc_shortcodes_image') ) {
1700
  // do we need a div wrapper?
1701
  if ( $div_wrapper ) {
1702
  $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
1703
- $html = '<div id="attachment_' . $attachment_id . '" class="wc-shortcodes-image-wrapper wc-shortcodes-item wp-caption align' . $align . '" style="width:' . $width . 'px">' . $html . '</div>';
1704
  }
1705
  else if ( in_array( $align, array( 'none', 'center' ) ) ) {
1706
  $html = '<p>' . $html . '</p>';
@@ -1723,6 +1709,9 @@ if( !function_exists('wc_shortcodes_fa') ) {
1723
  'class' => '',
1724
  ), $atts ) );
1725
 
 
 
 
1726
  if ( empty( $icon ) )
1727
  return '';
1728
 
@@ -1744,7 +1733,7 @@ if( !function_exists('wc_shortcodes_fa') ) {
1744
  $style_attr .= 'margin-left: '. $margin_left .';';
1745
  }
1746
 
1747
- $html = '<i class="' . implode( ' ', $classes ) . '" style="'.$style_attr.'"></i>';
1748
 
1749
  return $html;
1750
  }
@@ -1781,7 +1770,7 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1781
 
1782
  $first = true;
1783
 
1784
- $html = '<div class="' . implode( ' ', $classes ) . '" style="'.$style_attr.'">';
1785
  $html .= '<ul class="wc-shortcodes-clearfix">';
1786
  foreach ( $share_buttons as $key => $name ) {
1787
  $icon_option_name = WC_SHORTCODES_PREFIX . $key . '_share_icon';
@@ -1801,13 +1790,13 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1801
  $html .='<a href="javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;https://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());">';
1802
  switch ( $format ) {
1803
  case 'image' :
1804
- $html .= '<img src="'.$icon_url.'" alt="'.$icon_text.'">';
1805
  break;
1806
  case 'icon' :
1807
- $html .= '<i class="fa '.$icon_class.'"></i>';
1808
  break;
1809
  default :
1810
- $html .= '<i class="fa '.$icon_class.'"></i><span class="wc-share-button-'.$key.'">'.$icon_text.'</span>';
1811
  break;
1812
  }
1813
  $html .= '</a>';
@@ -1818,13 +1807,13 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1818
  $html .='<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u='.get_permalink().'&amp;t='.rawurlencode( html_entity_decode( get_the_title(), ENT_QUOTES, $charset ) ).'">';
1819
  switch ( $format ) {
1820
  case 'image' :
1821
- $html .= '<img src="'.$icon_url.'" alt="'.$icon_text.'">';
1822
  break;
1823
  case 'icon' :
1824
- $html .= '<i class="fa '.$icon_class.'"></i>';
1825
  break;
1826
  default :
1827
- $html .= '<i class="fa '.$icon_class.'"></i><span class="wc-share-button-'.$key.'">'.$icon_text.'</span>';
1828
  break;
1829
  }
1830
  $html .= '</a>';
@@ -1835,13 +1824,13 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1835
  $html .='<a target="_blank" href="https://twitter.com/share?text='.rawurlencode( html_entity_decode( get_the_title(), ENT_QUOTES, $charset ) ).'&amp;url='.get_permalink().'" class="share-button-twitter" data-lang="en">';
1836
  switch ( $format ) {
1837
  case 'image' :
1838
- $html .= '<img src="'.$icon_url.'" alt="'.$icon_text.'">';
1839
  break;
1840
  case 'icon' :
1841
- $html .= '<i class="fa '.$icon_class.'"></i>';
1842
  break;
1843
  default :
1844
- $html .= '<i class="fa '.$icon_class.'"></i><span class="wc-share-button-'.$key.'">'.$icon_text.'</span>';
1845
  break;
1846
  }
1847
  $html .= '</a>';
@@ -1852,13 +1841,13 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1852
  $html .='<a title="Share by Email" href="mailto:?subject='.rawurlencode( html_entity_decode( get_the_title(), ENT_QUOTES, $charset ) ).'&amp;body='.get_permalink().'">';
1853
  switch ( $format ) {
1854
  case 'image' :
1855
- $html .= '<img src="'.$icon_url.'" alt="'.$icon_text.'">';
1856
  break;
1857
  case 'icon' :
1858
- $html .= '<i class="fa '.$icon_class.'"></i>';
1859
  break;
1860
  default :
1861
- $html .= '<i class="fa '.$icon_class.'"></i><span class="wc-share-button-'.$key.'">'.$icon_text.'</span>';
1862
  break;
1863
  }
1864
  $html .= '</a>';
@@ -1869,13 +1858,13 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1869
  $html .='<a target="_blank" href="https://plus.google.com/share?url='.get_permalink().'">';
1870
  switch ( $format ) {
1871
  case 'image' :
1872
- $html .= '<img src="'.$icon_url.'" alt="'.$icon_text.'">';
1873
  break;
1874
  case 'icon' :
1875
- $html .= '<i class="fa '.$icon_class.'"></i>';
1876
  break;
1877
  default :
1878
- $html .= '<i class="fa '.$icon_class.'"></i><span class="wc-share-button-'.$key.'">'.$icon_text.'</span>';
1879
  break;
1880
  }
1881
  $html .= '</a>';
@@ -1891,13 +1880,13 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1891
  }
1892
  switch ( $format ) {
1893
  case 'image' :
1894
- $html .= '<img src="'.$icon_url.'" alt="'.$icon_text.'">';
1895
  break;
1896
  case 'icon' :
1897
- $html .= '<i class="fa '.$icon_class.'"></i>';
1898
  break;
1899
  default :
1900
- $html .= '<i class="fa '.$icon_class.'"></i><span class="wc-share-button-'.$key.'">'.$icon_text.'</span>';
1901
  break;
1902
  }
1903
  $html .= '</a>';
@@ -1912,6 +1901,7 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1912
  }
1913
  add_shortcode( 'wc_share', 'wc_shortcodes_share_buttons' );
1914
  }
 
1915
  if ( ! function_exists('wc_shortcodes_get_share_buttons') ) {
1916
  function wc_shortcodes_get_share_buttons() {
1917
  $html = null;
83
 
84
  wp_enqueue_script('wc-shortcodes-fullwidth');
85
 
86
+ return '<div class="wc-shortcodes-full-width wc-shortcodes-content" data-selector="' . esc_attr( $selector ) . '">' . do_shortcode( $content ) . '</div>';
87
  }
88
 
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  /**
91
  * Easily Display HTML in post
92
  *
106
  'name' => ''
107
  ), $atts));
108
 
109
+ // sanitize
110
+ $name = WCShortcodes_Sanitize::text_field( $name );
111
  $name = preg_replace( '/^_/', '', $name );
112
 
113
  if ( empty( $name ) )
156
  'wrap' => 0,
157
  ), $atts));
158
 
159
+ // sanitize
160
+ $scrollable = WCShortcodes_Sanitize::bool( $scrollable );
161
+ $color = WCShortcodes_Sanitize::bool( $color );
162
+ $linenums = WCShortcodes_Sanitize::bool( $linenums );
163
+ $wrap = WCShortcodes_Sanitize::bool( $wrap );
164
+ $name = WCShortcodes_Sanitize::text_field( $name );
165
+
166
  $class = array();
167
  if ( (int) $color ) {
168
  $class[] = 'prettyprint';
187
  wp_enqueue_script('wc-shortcodes-prettify');
188
  wp_enqueue_script('wc-shortcodes-pre');
189
  //$code = preg_replace( '/[ ]{4,}|[\t]/', ' ', $code );
190
+ $html .= '<pre id="prettycode-'.$instance.'" class="'.esc_attr( $class ).'">';
191
  $html .= htmlspecialchars( $code );
192
  $html .= '</pre>';
193
  }
209
  }
210
 
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  /*
213
  * Skillbars
214
  * @since v1.3
222
  'class' => '',
223
  'show_percent' => 'true'
224
  ), $atts ) );
225
+
226
+ // sanitize
227
+ $percentage = WCShortcodes_Sanitize::int_float( $percentage );
228
+ $color = WCShortcodes_Sanitize::hex_color( $color );
229
+ $show_percent = WCShortcodes_Sanitize::bool( $show_percent );
230
 
231
  // Enque scripts
232
  wp_enqueue_script('wc-shortcodes-skillbar');
233
 
234
  // Display the accordion ';
235
+ $output = '<div class="wc-shortcodes-skillbar wc-shortcodes-item wc-shortcodes-clearfix '. esc_attr( $class ) .'" data-percent="'. esc_attr( $percentage ) .'%">';
236
+ if ( $title !== '' ) $output .= '<div class="wc-shortcodes-skillbar-title" style="background: '. esc_attr( $color ) .';"><span>'. esc_html( $title ) .'</span></div>';
237
+ $output .= '<div class="wc-shortcodes-skillbar-bar" style="background: '. esc_attr( $color ) .';"></div>';
238
+ if ( $show_percent ) {
239
  $output .= '<div class="wc-shortcodes-skill-bar-percent">'.$percentage.'%</div>';
240
  }
241
  $output .= '</div>';
255
  extract( shortcode_atts( array(
256
  'size' => '20px',
257
  'class' => '',
258
+ ), $atts ) );
259
+
260
+ // sanitize
261
+ $size = WCShortcodes_Sanitize::css_unit( $size );
262
+
263
+ return '<hr class="wc-shortcodes-spacing '. esc_attr( $class ) .'" style="height: '. esc_attr( $size ) .'" />';
264
  }
265
  add_shortcode( 'wc_spacing', 'wc_shortcodes_spacing' );
266
  }
279
  'maxheight' => '0',
280
  ), $atts));
281
 
282
+ // sanitize
283
  $maxheight = (int) $maxheight;
284
 
285
  if ( empty( $maxheight ) ) {
316
 
317
  $first = true;
318
 
319
+ $html = '<div class="' . esc_attr( $class ) . '">';
320
+ $html .= '<ul class="'.esc_attr( implode( ' ', $classes ) ).'">';
321
  foreach ( $order as $key => $value ) {
322
  $link_option_name = WC_SHORTCODES_PREFIX . $key . '_link';
323
  $image_icon_option_name = WC_SHORTCODES_PREFIX . $key . '_icon';
332
  if ( $show_image ) {
333
  $icon_url = get_option( $image_icon_option_name );
334
 
335
+ $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . esc_attr( $key . $first_class ) . '">';
336
+ $html .='<a target="_blank" href="'.esc_url( $social_link ).'">';
337
+ $html .= '<img src="'.esc_url( $icon_url ).'" alt="'.esc_attr( $value ).'">';
338
  $html .= '</a>';
339
  $html .= '</li>';
340
  }
341
  else {
342
  $icon_class = get_option( $font_icon_option_name );
343
 
344
+ $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . esc_attr( $key . $first_class ) . '">';
345
+ $html .='<a target="_blank" href="'.esc_url( $social_link ).'">';
346
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i>';
347
  $html .= '</a>';
348
  $html .= '</li>';
349
  }
365
  extract( shortcode_atts( array(
366
  'color' => 'yellow',
367
  'class' => '',
368
+ ), $atts ) );
369
+
370
+ return '<span class="wc-shortcodes-highlight wc-shortcodes-highlight-'. esc_attr( $color ) .' '. esc_attr( $class ) .'">' . do_shortcode( $content ) . '</span>';
371
 
372
  }
373
  add_shortcode( 'wc_highlight', 'wc_shortcodes_highlight' );
393
  'class' => '',
394
  ), $atts ) );
395
 
396
+ // sanitize
397
+ $border_radius = WCShortcodes_Sanitize::css_unit( $border_radius );
398
+
399
  $custom_class = sanitize_title( $class );
400
 
 
 
401
  // $border_radius_style = ( $border_radius ) ? 'style="border-radius:'. $border_radius .'"' : NULL;
402
  $rel = ( $rel ) ? 'rel="'.$rel.'"' : NULL;
403
  $type = 'wc-shortcodes-button-' . $type;
409
  if ( ! empty( $custom_class ) )
410
  $class[] = $custom_class;
411
 
412
+ $button = null;
413
+ $button .= '<a href="' . esc_url( $url ) . '" class="'.esc_attr( implode( ' ', $class ) ).'" target="_'.esc_attr( $target ).'" title="'. esc_attr( $title ) .'" rel="'. esc_attr( $rel ) .'">';
414
  $button .= '<span class="wc-shortcodes-button-inner">';
415
+ if ( $icon_left ) {
416
+ $button .= '<span class="wc-shortcodes-button-icon-left icon-'. esc_attr( $icon_left ) .'"></span>';
417
+ }
418
+ $button .= $content;
419
+ if ( $icon_right ) {
420
+ $button .= '<span class="wc-shortcodes-button-icon-right icon-'. esc_attr( $icon_right ) .'"></span>';
421
+ }
422
  $button .= '</span>';
423
  $button .= '</a>';
424
 
425
+ $whitelist = array( 'center', 'left', 'right' );
426
  if ( in_array( $position, $whitelist ) ) {
427
  $button = '<div class="wc-shortcodes-item wc-shortcodes-button-'.$position.'">'. $button .'</div>';
428
  }
449
  'class' => '',
450
  ), $atts ) );
451
 
452
+ $margin_top = WCShortcodes_Sanitize::css_unit( $margin_top );
453
+ $margin_bottom = WCShortcodes_Sanitize::css_unit( $margin_bottom );
454
+
455
  $style_attr = '';
456
 
457
  if( $margin_bottom ) {
462
  }
463
 
464
  $alert_content = '';
465
+ $alert_content .= '<div class="wc-shortcodes-box wc-shortcodes-item wc-shortcodes-content wc-shortcodes-clearfix wc-shortcodes-box-' . esc_attr( $color ) . ' '. esc_attr( $class ) .'" style="text-align:'. esc_attr( $text_align ) .';'. esc_attr( $style_attr ) .'">';
466
+
467
  $alert_content .= ' '. do_shortcode($content) .'</div>';
468
+
469
  return $alert_content;
470
  }
471
  }
487
  ), $atts ) );
488
 
489
  if ( ! empty( $url ) ) {
490
+ $by = '<a href="' . esc_url( $url ) . '">' . $by . '</a>';
 
491
  }
492
 
493
  $testimonial_content = '';
494
+ $testimonial_content .= '<div class="wc-shortcodes-testimonial wc-shortcodes-item wc-shortcodes-clearfix wc-shortcodes-testimonial-'.esc_attr( $position ).' '. esc_attr( $class ) .'"><div class="wc-shortcodes-testimonial-content wc-shortcodes-content">';
495
  $testimonial_content .= $content;
496
  $testimonial_content .= '</div><div class="wc-shortcodes-testimonial-author">';
497
  $testimonial_content .= $by .'</div></div>';
498
+
499
  return $testimonial_content;
500
  }
501
  }
513
  'max_width' => '500px',
514
  'text_align' => 'center',
515
  'class' => '',
516
+ ), $atts ) );
517
+
518
+ $max_width = WCShortcodes_Sanitize::css_unit( $max_width );
519
 
520
  // $append_clearfix = '<div class="wc-shortcodes-clear-floats"></div>';
521
+ $style = empty( $max_width ) ? '' : ' style="max-width:'.esc_attr( $max_width ).';"';
522
 
523
+ return '<div class="wc-shortcodes-center wc-shortcodes-item wc-shortcodes-content wc-shortcodes-clearfix wc-shortcodes-center-inner-align-'. esc_attr( $text_align ) .' '. esc_attr( $class ) .'"' . $style . '>' . do_shortcode($content) . '</div>';
524
  }
525
  }
526
 
538
  'position' =>'',
539
  'class' => '',
540
  'text_align'=> '',
541
+ ), $atts ) );
542
 
543
  $style = '';
544
  if ( $text_align ) {
545
  if ( 'left' == $text_align )
546
+ $style = ' style="text-align: '.esc_attr( $text_align ).';"';
547
  if ( 'center' == $text_align )
548
+ $style = ' style="text-align: '.esc_attr( $text_align ).';"';
549
  if ( 'right' == $text_align )
550
+ $style = ' style="text-align: '.esc_attr( $text_align ).';"';
551
  }
552
 
553
  $append_clearfix = 'last' == $position ? '<div class="wc-shortcodes-clear-floats"></div>' : '';
554
 
555
+ return '<div'.$style.' class="wc-shortcodes-column wc-shortcodes-content wc-shortcodes-' . esc_attr( $size ) . ' wc-shortcodes-column-'.esc_attr( $position ).' '. esc_attr( $class ) .'">' . do_shortcode($content) . '</div>';
556
  }
557
  }
558
 
586
  'layout' => 'box',
587
  ), $atts ) );
588
 
589
+ $padding = WCShortcodes_Sanitize::css_unit( $padding );
590
+
591
  $classes = array();
592
 
593
  $classes[] = 'wc-shortcodes-toggle';
614
  wp_enqueue_script('wc-shortcodes-toggle');
615
 
616
  // Display the Toggle
617
+ return '<div class="'. esc_attr( $class ) .'"><div class="wc-shortcodes-toggle-trigger"><a href="#">'. esc_html( $title ) .'</a></div><div style="'.esc_attr( $style ).'" class="wc-shortcodes-toggle-container wc-shortcodes-content">' . do_shortcode($content) . '</div></div>';
618
  }
619
  }
620
 
636
  'layout' => 'box',
637
  ), $atts ) );
638
 
639
+ $collapse = WCShortcodes_Sanitize::bool( $collapse );
640
+ $leaveopen = WCShortcodes_Sanitize::bool( $leaveopen );
641
+
642
  $classes = array();
643
 
644
  $classes[] = 'wc-shortcodes-accordion';
645
  $classes[] = 'wc-shortcodes-item';
646
 
647
  $behavior = 'autoclose';
648
+ if ( $leaveopen ) {
649
  $behavior = 'leaveopen';
650
  }
651
 
652
  $state = 'default';
653
+ if ( $collapse ) {
654
  $classes[] = 'wc-shortcodes-accordion-collapse';
655
  $state = 'collapse';
656
  }
670
  wp_enqueue_script('wc-shortcodes-accordion');
671
 
672
  // Display the accordion
673
+ return '<div class="'. esc_attr( $class ) .'" data-behavior="'.esc_attr( $behavior ).'" data-start-state="'.esc_attr( $state ).'">' . do_shortcode($content) . '</div>';
674
  }
675
  }
676
 
683
  'class' => '',
684
  ), $atts ) );
685
 
686
+ return '<div class="wc-shortcodes-accordion-trigger '. esc_attr( $class ) .'"><a href="#">'. esc_html( $title ) .'</a></div><div class="wc-shortcodes-accordion-content wc-shortcodes-content">' . do_shortcode($content) . '</div>';
687
  }
688
 
689
  }
727
  if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
728
  $output = '';
729
  if( count($tab_titles) ){
730
+ $output .= '<div id="wc-shortcodes-tab-'. esc_attr( $instance ) .'" class="'.esc_attr( $class ).'">';
731
  $output .= '<ul class="wcs-tabs-nav wc-shortcodes-clearfix">';
732
  $i = 0;
733
  foreach( $tab_titles as $tab ){
756
 
757
  $class = implode( ' ', $classes );
758
 
759
+ return '<div id="wc-shortcodes-tab-'. sanitize_title( $title ) .'" class="'. esc_attr( $class ) .'">'. do_shortcode( $content ) .'</div>';
760
  }
761
  }
762
 
768
  * @since v1.0
769
  *
770
  */
 
771
  /*section*/
772
  if( !function_exists('wc_shortcodes_pricing') ) {
773
  function wc_shortcodes_pricing( $atts, $content = null ) {
786
 
787
  //start content
788
  $pricing_content ='';
789
+ $pricing_content .= '<div class="wc-shortcodes-pricing wc-shortcodes-pricing-type-'. esc_attr( $type ) .' '. esc_attr( $class ) .'">';
790
  $pricing_content .= '<div class="wc-shortcodes-pricing-header">';
791
+ $pricing_content .= '<h5>'. esc_html( $plan ). '</h5>';
792
+ $pricing_content .= '<div class="wc-shortcodes-pricing-cost">'. esc_html( $cost ) .'</div><div class="wc-shortcodes-pricing-per">'. esc_html( $per ) .'</div>';
793
  $pricing_content .= '</div>';
794
  $pricing_content .= '<div class="wc-shortcodes-pricing-content">';
795
  $pricing_content .= ''. $content. '';
796
  $pricing_content .= '</div>';
797
  if( $button_url ) {
798
+ $pricing_content .= '<div class="wc-shortcodes-pricing-button"><a href="'. esc_url( $button_url ) .'" class="wc-shortcodes-button wc-shortcodes-button-'.esc_attr( $type ).'" target="_'. esc_attr( $button_target ) .'" rel="'. esc_attr( $button_rel ) .'"><span class="wc-shortcodes-button-inner">'. esc_html( $button_text ) .'</span></a></div>';
799
  }
800
  $pricing_content .= '</div>';
801
  return $pricing_content;
824
  'icon_spacing' => '',
825
  ), $atts ) );
826
 
827
+ $type = WCShortcodes_Sanitize::heading_type( $type );
828
+
829
  $style_attr = '';
830
 
831
  if ( $font_size ) {
850
  if ( 'h1' == $type )
851
  $class = trim( 'entry-title ' . $class );
852
 
853
+ $output = '<'.$type.' class="wc-shortcodes-heading '. esc_attr( $text_align ) .' '. esc_attr( $class ) .'" style="'.esc_attr( $style_attr ).'"><span>';
854
 
855
  if ( $icon_left )
856
+ $output .= '<i class="wc-shortcodes-button-icon-left fa fa-'. esc_attr( $icon_left ) .'" style="margin-right:'.esc_attr( $icon_spacing ).'"></i>';
857
 
858
+ $output .= esc_html( $title );
859
 
860
  if ( $icon_right )
861
+ $output .= '<i class="wc-shortcodes-button-icon-right fa fa-'. esc_attr( $icon_right ) .'" style="margin-left:'.esc_attr( $icon_spacing ).'"></i>';
862
 
863
  $output .= '</span></'.$type.'>';
864
 
881
  $instance++;
882
 
883
  extract(shortcode_atts(array(
884
+ 'title' => '', // content inside the info window
885
+ 'title_on_load' => 'no', // should the info window display on map load
886
+ 'location' => '', // Enter a valid address that Google can geocode.
887
+ 'height' => '300', // set the height of your google map in pixels
888
+ 'zoom' => 8, // the lower the zoom, the farther away the map appears
889
+ 'class' => '', // add a custom class to your google map
890
  ), $atts));
891
 
892
+ $height = WCShortcodes_Sanitize::pixel( $height );
893
+ $zoom = WCShortcodes_Sanitize::number( $zoom );
894
+
895
  $title_on_load = 'yes' == $title_on_load ? 1 : 0;
896
 
897
  // load scripts
902
  $class[] = 'googlemap';
903
  $class[] = 'wc-shortcodes-item';
904
 
905
+ $output = '<div id="map_canvas_'.$instance.'" class="' . esc_attr( implode( ' ', $class ) ) . '" style="height:'.$height.';width:100%">';
906
+ $output .= (!empty($title)) ? '<input class="title" type="hidden" value="'.esc_html( $title ).'" />' : '';
907
+ $output .= '<input class="location" type="hidden" value="'.esc_attr( $location ).'" />';
908
  $output .= '<input class="zoom" type="hidden" value="'.$zoom.'" />';
909
  $output .= '<input class="title-on-load" type="hidden" value="'.$title_on_load.'" />';
910
  $output .= '<div class="map_canvas"></div>';
931
  'class' => '',
932
  ), $atts ) );
933
 
934
+ $margin_top = WCShortcodes_Sanitize::css_unit( $margin_top );
935
+ $margin_bottom = WCShortcodes_Sanitize::css_unit( $margin_bottom );
936
+
937
  $style_attr = array();
938
 
939
  if ( $margin_top && $margin_bottom ) {
945
  }
946
 
947
  if ( ! empty ( $style_attr ) ) {
948
+ $style_attr = 'style="' . esc_attr( implode( '', $style_attr ) ) . '"';
949
  }
950
  else {
951
  $style_attr = '';
952
  }
953
 
954
+ return '<hr class="wc-shortcodes-divider wc-shortcodes-item wc-shortcodes-divider-line-'.esc_attr( $line ).' wc-shortcodes-divider-style-'. esc_attr( $style ) .' '. esc_attr( $class ) .'" '.$style_attr.' />';
955
  }
956
  add_shortcode( 'wc_divider', 'wc_shortcodes_divider' );
957
  }
1001
 
1002
  wp_enqueue_script('wc-shortcodes-rsvp');
1003
 
1004
+ $columns = WCShortcodes_Sanitize::positive_number( $columns );
1005
  $columns = 3 == $columns ? $columns : 1;
1006
 
1007
  $html = '';
1287
  }
1288
 
1289
  $html .= '<div class="wc-shortcodes-posts-wrapper">';
1290
+ $html .= '<div id="wc-shortcodes-posts-'.$instance.'" data-gutter-space="'.esc_attr( $display["gutter_space"] ).'" data-columns="'.esc_attr( $display["columns"] ).'" class="' . esc_attr( implode( ' ', $class ) ) . '">';
1291
 
1292
  while( $wc_shortcodes_posts_query->have_posts() ) :
1293
  $wc_shortcodes_posts_query->the_post();
1548
  $class[] = 'wc-shortcodes-posts-template-' . $display['template'];
1549
 
1550
  $html .= '<div id="" class="wc-shortcodes-post-slider-wrapper">';
1551
+ $html .= '<div id="wc-shortcodes-post-slider-'.$instance.'" class="' . esc_attr( implode( ' ', $class ) ) . '" data-mode="' . esc_attr( $display['slider_mode'] ) . '" data-pause="' . esc_attr( $display['slider_pause'] ) . '" data-auto="' . esc_attr( $display['slider_auto'] ) . '">';
1552
 
1553
  while( $wc_shortcodes_posts_query->have_posts() ) {
1554
  $wc_shortcodes_posts_query->the_post();
1603
  'class' => '',
1604
  ), $atts ) );
1605
 
1606
+ $font_size = WCShortcodes_Sanitize::css_unit( $font_size );
1607
+ $flag_width = WCShortcodes_Sanitize::css_unit( $flag_width );
1608
+
1609
  // function options
1610
  $div_wrapper = false;
1611
 
1612
  // sanitize
1613
+ $attachment_id = WCShortcodes_Sanitize::number( $attachment_id );
1614
 
1615
  // classes
1616
  $classes = array();
1636
  return '<p>Please insert a valid image</p>';
1637
  }
1638
 
1639
+ $html = '<img alt="' . esc_attr( $alt ) . '" title="' . esc_attr( $title ) . '" src="' . esc_url( $src ) . '" class="' . esc_attr( implode( ' ', $classes ) ) . '" />';
1640
 
1641
  // insert flag
1642
  if ( ! empty( $flag ) ) {
1653
  $style[] = 'background-color:' . $background_color;
1654
  if ( ! empty( $text_color ) )
1655
  $style[] = 'color:' . $text_color;
1656
+ if ( ! empty( $font_size ) )
1657
+ $style[] = 'font-size:' . $font_size;
1658
  if ( in_array( $text_align, $whitelist ) )
1659
  $style[] = 'text-align:' . $text_align;
1660
+ if ( ! empty( $flag_width ) )
1661
+ $style[] = 'width:' . $flag_width;
1662
 
1663
 
1664
+ $html .= '<span style="' . esc_attr( implode( ';', $style ) ) . '" class="wc-shortcodes-image-flag-bg"><span class="wc-shortcodes-image-flag-text">' . esc_html( $flag ) . '</span></span>';
1665
  $div_wrapper = true;
1666
 
1667
  }
1668
 
1669
  // check link_to
1670
+ if ( empty( $url ) ) {
1671
+ if ( 'file' == $link_to )
1672
+ $url = wp_get_attachment_url( $attachment_id );
1673
+ else if ( 'post' == $link_to )
1674
+ $url = get_attachment_link( $attachment_id );
1675
+ }
1676
 
1677
  if ( 'none' != $link_to )
1678
+ $html = '<a class="wc-shortcodes-image-anchor" href="' . esc_url( $url ) . '">' . $html . '</a>';
1679
 
1680
  // insert caption
1681
  if ( ! empty( $caption ) ) {
1686
  // do we need a div wrapper?
1687
  if ( $div_wrapper ) {
1688
  $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
1689
+ $html = '<div id="attachment_' . esc_attr( $attachment_id ) . '" class="wc-shortcodes-image-wrapper wc-shortcodes-item wp-caption align' . esc_attr( $align ) . '" style="width:' . $width . 'px">' . $html . '</div>';
1690
  }
1691
  else if ( in_array( $align, array( 'none', 'center' ) ) ) {
1692
  $html = '<p>' . $html . '</p>';
1709
  'class' => '',
1710
  ), $atts ) );
1711
 
1712
+ $margin_right = WCShortcodes_Sanitize::css_unit( $margin_right );
1713
+ $margin_left = WCShortcodes_Sanitize::css_unit( $margin_left );
1714
+
1715
  if ( empty( $icon ) )
1716
  return '';
1717
 
1733
  $style_attr .= 'margin-left: '. $margin_left .';';
1734
  }
1735
 
1736
+ $html = '<i class="' . esc_attr( implode( ' ', $classes ) ) . '" style="'.esc_attr( $style_attr ).'"></i>';
1737
 
1738
  return $html;
1739
  }
1770
 
1771
  $first = true;
1772
 
1773
+ $html = '<div class="' . esc_attr( implode( ' ', $classes ) ) . '" style="'.esc_attr( $style_attr ).'">';
1774
  $html .= '<ul class="wc-shortcodes-clearfix">';
1775
  foreach ( $share_buttons as $key => $name ) {
1776
  $icon_option_name = WC_SHORTCODES_PREFIX . $key . '_share_icon';
1790
  $html .='<a href="javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;https://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());">';
1791
  switch ( $format ) {
1792
  case 'image' :
1793
+ $html .= '<img src="'.esc_url( $icon_url ).'" alt="'.esc_attr( $icon_text ).'">';
1794
  break;
1795
  case 'icon' :
1796
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i>';
1797
  break;
1798
  default :
1799
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i><span class="wc-share-button-'.$key.'">'.esc_html( $icon_text ).'</span>';
1800
  break;
1801
  }
1802
  $html .= '</a>';
1807
  $html .='<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u='.get_permalink().'&amp;t='.rawurlencode( html_entity_decode( get_the_title(), ENT_QUOTES, $charset ) ).'">';
1808
  switch ( $format ) {
1809
  case 'image' :
1810
+ $html .= '<img src="'.esc_url( $icon_url ).'" alt="'.esc_attr( $icon_text ).'">';
1811
  break;
1812
  case 'icon' :
1813
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i>';
1814
  break;
1815
  default :
1816
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i><span class="wc-share-button-'.$key.'">'.esc_html( $icon_text ).'</span>';
1817
  break;
1818
  }
1819
  $html .= '</a>';
1824
  $html .='<a target="_blank" href="https://twitter.com/share?text='.rawurlencode( html_entity_decode( get_the_title(), ENT_QUOTES, $charset ) ).'&amp;url='.get_permalink().'" class="share-button-twitter" data-lang="en">';
1825
  switch ( $format ) {
1826
  case 'image' :
1827
+ $html .= '<img src="'.esc_url( $icon_url ).'" alt="'.esc_attr( $icon_text ).'">';
1828
  break;
1829
  case 'icon' :
1830
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i>';
1831
  break;
1832
  default :
1833
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i><span class="wc-share-button-'.$key.'">'.esc_html( $icon_text ).'</span>';
1834
  break;
1835
  }
1836
  $html .= '</a>';
1841
  $html .='<a title="Share by Email" href="mailto:?subject='.rawurlencode( html_entity_decode( get_the_title(), ENT_QUOTES, $charset ) ).'&amp;body='.get_permalink().'">';
1842
  switch ( $format ) {
1843
  case 'image' :
1844
+ $html .= '<img src="'.esc_url( $icon_url ).'" alt="'.esc_attr( $icon_text ).'">';
1845
  break;
1846
  case 'icon' :
1847
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i>';
1848
  break;
1849
  default :
1850
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i><span class="wc-share-button-'.$key.'">'.esc_html( $icon_text ).'</span>';
1851
  break;
1852
  }
1853
  $html .= '</a>';
1858
  $html .='<a target="_blank" href="https://plus.google.com/share?url='.get_permalink().'">';
1859
  switch ( $format ) {
1860
  case 'image' :
1861
+ $html .= '<img src="'.esc_url( $icon_url ).'" alt="'.esc_attr( $icon_text ).'">';
1862
  break;
1863
  case 'icon' :
1864
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i>';
1865
  break;
1866
  default :
1867
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i><span class="wc-share-button-'.$key.'">'.esc_html( $icon_text ).'</span>';
1868
  break;
1869
  }
1870
  $html .= '</a>';
1880
  }
1881
  switch ( $format ) {
1882
  case 'image' :
1883
+ $html .= '<img src="'.esc_url( $icon_url ).'" alt="'.esc_attr( $icon_text ).'">';
1884
  break;
1885
  case 'icon' :
1886
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i>';
1887
  break;
1888
  default :
1889
+ $html .= '<i class="fa '.esc_attr( $icon_class ).'"></i><span class="wc-share-button-'.$key.'">'.esc_html( $icon_text ).'</span>';
1890
  break;
1891
  }
1892
  $html .= '</a>';
1901
  }
1902
  add_shortcode( 'wc_share', 'wc_shortcodes_share_buttons' );
1903
  }
1904
+
1905
  if ( ! function_exists('wc_shortcodes_get_share_buttons') ) {
1906
  function wc_shortcodes_get_share_buttons() {
1907
  $html = null;
includes/templates/slider1/content.php CHANGED
@@ -37,7 +37,7 @@
37
  }
38
  ?>
39
  <div class="wc-shortcodes-read-more">
40
- <a class="<?php echo $display['button_class']; ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $display['readmore']; ?></a>
41
  </div><!-- .entry-summary -->
42
  <?php endif; ?>
43
  </div>
37
  }
38
  ?>
39
  <div class="wc-shortcodes-read-more">
40
+ <a class="<?php echo esc_attr( $display['button_class'] ); ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $display['readmore']; ?></a>
41
  </div><!-- .entry-summary -->
42
  <?php endif; ?>
43
  </div>
includes/templates/slider2/content.php CHANGED
@@ -37,7 +37,7 @@
37
  }
38
  ?>
39
  <div class="wc-shortcodes-read-more">
40
- <a class="<?php echo $display['button_class']; ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $display['readmore']; ?></a>
41
  </div><!-- .entry-summary -->
42
  <?php endif; ?>
43
  </div>
37
  }
38
  ?>
39
  <div class="wc-shortcodes-read-more">
40
+ <a class="<?php echo esc_attr( $display['button_class'] ); ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $display['readmore']; ?></a>
41
  </div><!-- .entry-summary -->
42
  <?php endif; ?>
43
  </div>
readme.txt CHANGED
@@ -88,6 +88,10 @@ Use the shortcode manager in the TinyMCE text editor
88
 
89
  == Changelog ==
90
 
 
 
 
 
91
  = Version 2.05 =
92
 
93
  * minor style update
88
 
89
  == Changelog ==
90
 
91
+ = Version 2.06 =
92
+
93
+ * sanitized, escaped, and validated all POST calls
94
+
95
  = Version 2.05 =
96
 
97
  * minor style update
wc-shortcodes.php CHANGED
@@ -5,11 +5,11 @@ Plugin URI: http://webplantmedia.com/starter-themes/wordpresscanvas/features/sho
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
- Version: 2.05
9
  License: GPLv2 or later
10
  */
11
 
12
- define( 'WC_SHORTCODES_VERSION', '2.05' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -23,6 +23,7 @@ global $wc_shortcodes_social_icons;
23
  global $wc_shortcodes_share_buttons;
24
  global $wc_shortcodes_theme_support;
25
  global $wc_shortcodes_plugin_screen_hook_suffix;
 
26
 
27
  $wc_shortcodes_options = array();
28
  $wc_shortcodes_social_icons = array(
@@ -108,13 +109,14 @@ $wc_shortcodes_theme_support = array(
108
  );
109
 
110
  require_once( plugin_dir_path( __FILE__ ) . 'includes/vendors/wpc-settings-framework/init.php' );
111
- require_once( dirname(__FILE__) . '/includes/options.php' ); // define options array
112
- require_once( dirname(__FILE__) . '/includes/functions.php' ); // Adds basic filters and actions
 
113
  if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
114
- require_once( dirname(__FILE__) . '/includes/post-types.php' ); // Adds basic filters and actions
115
  }
116
- require_once( dirname(__FILE__) . '/includes/ajax.php' ); // Adds basic filters and actions
117
- require_once( dirname(__FILE__) . '/includes/scripts.php' ); // Adds plugin JS and CSS
118
- require_once( dirname(__FILE__) . '/includes/shortcode-functions.php'); // Main shortcode functions
119
- require_once( dirname(__FILE__) . '/includes/mce/shortcodes_tinymce.php'); // Add mce buttons to post editor
120
- require_once( dirname(__FILE__) . '/includes/widgets.php' ); // include any widgets
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 2.06
9
  License: GPLv2 or later
10
  */
11
 
12
+ define( 'WC_SHORTCODES_VERSION', '2.06' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
23
  global $wc_shortcodes_share_buttons;
24
  global $wc_shortcodes_theme_support;
25
  global $wc_shortcodes_plugin_screen_hook_suffix;
26
+ global $wc_shortcodes_sanitize;
27
 
28
  $wc_shortcodes_options = array();
29
  $wc_shortcodes_social_icons = array(
109
  );
110
 
111
  require_once( plugin_dir_path( __FILE__ ) . 'includes/vendors/wpc-settings-framework/init.php' );
112
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/classes/sanitize.php' );
113
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/options.php' ); // define options array
114
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/functions.php' ); // Adds basic filters and actions
115
  if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
116
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/post-types.php' ); // Adds basic filters and actions
117
  }
118
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/ajax.php' ); // Adds basic filters and actions
119
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/scripts.php' ); // Adds plugin JS and CSS
120
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/shortcode-functions.php'); // Main shortcode functions
121
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/mce/shortcodes_tinymce.php'); // Add mce buttons to post editor
122
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/widgets.php' ); // include any widgets