Shortcodes by Angie Makes - Version 1.60

Version Description

Download this release

Release Info

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

Code changes from version 1.59 to 1.60

README.md CHANGED
@@ -66,6 +66,10 @@ Use the shortcode manager in the TinyMCE text editor
66
 
67
  ## Changelog ##
68
 
 
 
 
 
69
  ### Version 1.59
70
 
71
  * minor bug fix
66
 
67
  ## Changelog ##
68
 
69
+ ### Version 1.60
70
+
71
+ * Removed namespace which is not supported in php 5.2
72
+
73
  ### Version 1.59
74
 
75
  * minor bug fix
includes/vendors/wpc-settings-framework/class-wpc-settings-framework-sanitize.php DELETED
@@ -1,626 +0,0 @@
1
- <?php
2
- namespace WC_Shortcodes;
3
-
4
- /**
5
- * This class will store sanitize functions
6
- *
7
- * @package WPC_Settings_Framework
8
- * @author Chris Baldelomar <chris@webplantmedia.com>
9
- * @license GPL-2.0+
10
- * @link http://webplantmedia.com
11
- * @copyright 2014 Chris Baldelomar
12
- */
13
- class WPC_Settings_Framework_Sanitize {
14
- /**
15
- * Instance of this class.
16
- *
17
- * @since 1.0.0
18
- *
19
- * @var object
20
- */
21
- protected static $instance = null;
22
-
23
- /**
24
- * Return an instance of this class.
25
- *
26
- * @since 1.0.0
27
- *
28
- * @return object A single instance of this class.
29
- */
30
- public static function get_instance() {
31
-
32
- // If the single instance hasn't been set, set it now.
33
- if ( null == self::$instance ) {
34
- self::$instance = new self;
35
- }
36
-
37
- return self::$instance;
38
- }
39
-
40
- /**
41
- * Given an option type, we will return a string
42
- * of the callback function used to sanitize
43
- * the option value
44
- *
45
- * @since 3.5.2
46
- * @access public
47
- *
48
- * @param string $type
49
- * @return string
50
- */
51
- public function callback( $type ) {
52
- switch ( $type ) {
53
- case 'color' :
54
- return 'hex_color';
55
- case 'image' :
56
- return 'esc_url_raw';
57
- case 'positive_pixel' :
58
- return 'positive_pixel';
59
- case 'pixel' :
60
- return 'pixel';
61
- case 'number' :
62
- return 'number';
63
- case 'decimal' :
64
- return 'decimal';
65
- case 'border' :
66
- return 'border';
67
- case 'background' :
68
- return 'background_css';
69
- case 'checkbox' :
70
- return 'checkbox';
71
- case 'gallery' :
72
- return 'gallery';
73
- case 'emails' :
74
- return 'emails';
75
- }
76
-
77
- return 'no_sanitize';
78
- }
79
-
80
- /**
81
- * Validate slideshow data saved to database.
82
- *
83
- * @since 3.6
84
- * @access public
85
- *
86
- * @param array $value
87
- * @return array
88
- */
89
- public function gallery( $value ) {
90
- if ( empty( $value ) )
91
- return null;
92
-
93
- $ids = explode( ',', $value );
94
-
95
- foreach ( $ids as $key => $id ) {
96
- if ( ! is_numeric( $id ) ) {
97
- unset( $ids[ $key ] );
98
- }
99
- }
100
-
101
- $value = implode( ',', $ids );
102
-
103
- return $value;
104
- }
105
-
106
- /**
107
- * Sanitize border values. Border consists
108
- * of pixel value, border style, and color.
109
- *
110
- * @since 3.6
111
- * @access public
112
- *
113
- * @param array $value
114
- * @return array
115
- */
116
- public function border( $value ) {
117
- $border = array(
118
- 'width' => '0px',
119
- 'style' => 'none',
120
- 'color' => '#ffffff',
121
- );
122
-
123
- if ( ! is_array( $value ) )
124
- return $border;
125
-
126
- foreach ( $value as $k => $v ) {
127
- switch ( $k ) {
128
- case 'width' :
129
- $v = $this->positive_pixel( $v );
130
- $border['width'] = $v;
131
- break;
132
- case 'style' :
133
- $v = $this->border_style( $v );
134
- $border['style'] = $v;
135
- break;
136
- case 'color' :
137
- $v = $this->hex_color( $v );
138
- $border['color'] = $v;
139
- break;
140
- }
141
- }
142
-
143
- return $border;
144
- }
145
-
146
- /**
147
- * Strips all non numerica characters and returns
148
- * intval() of string. Only allows for positive values.
149
- *
150
- * @since 3.6
151
- * @access public
152
- *
153
- * @param string $value
154
- * @return void
155
- */
156
- public function positive_pixel( $value ) {
157
- $value = preg_replace("/[^0-9]/", "",$value);
158
- $value = intval( $value );
159
-
160
- if ( empty( $value ) )
161
- $value = '0';
162
-
163
- return $value."px";
164
- }
165
-
166
- /**
167
- * Strips all non numerica characters and returns
168
- * intval() of string. Allows both negative and
169
- * positive values.
170
- *
171
- * @since 3.6
172
- * @access public
173
- *
174
- * @param string $value
175
- * @return void
176
- */
177
- public function pixel( $value ) {
178
- $value = preg_replace("/[^0-9\-]/", "",$value);
179
- $value = intval( $value );
180
-
181
- if ( empty( $value ) )
182
- $value = '0';
183
-
184
- return $value."px";
185
- }
186
-
187
- public function font( $value ) {
188
- $font = array(
189
- 'font_family' => '',
190
- 'font_size' => '',
191
- 'text_transform' => '',
192
- 'font_style' => '',
193
- 'font_weight' => '',
194
- 'color' => '',
195
- );
196
-
197
- if ( !is_array( $value ) )
198
- return $font;
199
-
200
- foreach ( $value as $k => $v ) {
201
- switch ( $k ) {
202
- case 'font_family' :
203
- $font['font_family'] = $v;
204
- break;
205
- case 'font_size' :
206
- $v = $this->pixel( $value['font_size'] );
207
- $font['font_size'] = $v;
208
- break;
209
- case 'text_transform' :
210
- $font['text_transform'] = $v;
211
- break;
212
- case 'font_style' :
213
- $v = $this->font_style( $v );
214
- $font['font_style'] = $v;
215
- break;
216
- case 'font_weight' :
217
- $v = $this->font_weight( $v );
218
- $font['font_weight'] = $v;
219
- break;
220
- case 'color' :
221
- $v = $this->hex_color( $v );
222
- $font['color'] = $v;
223
- break;
224
- }
225
- }
226
-
227
- return $font;
228
- }
229
-
230
- public function font_hover( $value ) {
231
- $font = array(
232
- 'text_decoration' => '',
233
- 'color' => '',
234
- );
235
-
236
- if ( !is_array( $value ) )
237
- return $font;
238
-
239
- foreach ( $value as $k => $v ) {
240
- switch ( $k ) {
241
- case 'text_decoration' :
242
- $v = $this->text_decoration( $v );
243
- $font['text_decoration'] = $v;
244
- break;
245
- case 'color' :
246
- $v = $this->hex_color( $v );
247
- $font['color'] = $v;
248
- break;
249
- }
250
- }
251
-
252
- return $font;
253
- }
254
-
255
- public function font_appearance( $value ) {
256
- $font = array(
257
- 'text_decoration' => '',
258
- 'font_style' => '',
259
- 'font_weight' => '',
260
- 'color' => '',
261
- );
262
-
263
- if ( !is_array( $value ) )
264
- return $font;
265
-
266
- foreach ( $value as $k => $v ) {
267
- switch ( $k ) {
268
- case 'text_decoration' :
269
- $v = $this->text_decoration( $v );
270
- $font['text_decoration'] = $v;
271
- break;
272
- case 'font_style' :
273
- $v = $this->font_style( $v );
274
- $font['font_style'] = $v;
275
- break;
276
- case 'font_weight' :
277
- $v = $this->font_weight( $v );
278
- $font['font_weight'] = $v;
279
- break;
280
- case 'color' :
281
- $v = $this->hex_color( $v );
282
- $font['color'] = $v;
283
- break;
284
- }
285
- }
286
-
287
- return $font;
288
- }
289
-
290
- public function text_decoration( $value ) {
291
- $whitelist = array(
292
- 'none',
293
- 'underline',
294
- 'overline',
295
- 'line-through',
296
- );
297
-
298
- if ( in_array( $value, $whitelist ) )
299
- return $value;
300
-
301
- return '';
302
- }
303
-
304
- public function text_transform( $value ) {
305
- $whitelist = array(
306
- 'none',
307
- 'capitalize',
308
- 'uppercase',
309
- 'lowercase',
310
- );
311
-
312
- if ( in_array( $value, $whitelist ) )
313
- return $value;
314
-
315
- return '';
316
- }
317
-
318
- public function font_style( $value ) {
319
- $whitelist = array(
320
- 'normal',
321
- 'italic',
322
- 'oblique',
323
- );
324
-
325
- if ( in_array( $value, $whitelist ) )
326
- return $value;
327
-
328
- return '';
329
- }
330
-
331
- public function font_weight( $value ) {
332
- $whitelist = array(
333
- 'normal',
334
- 'bold',
335
- 'bolder',
336
- 'lighter',
337
- '100',
338
- '200',
339
- '300',
340
- '400',
341
- '500',
342
- '600',
343
- '700',
344
- '800',
345
- '900',
346
- );
347
-
348
- if ( in_array( $value, $whitelist ) )
349
- return $value;
350
-
351
- return '';
352
- }
353
-
354
- public function background_css( $value ) {
355
- $background = array(
356
- 'color' => '',
357
- 'image' => '',
358
- 'repeat' => '',
359
- 'position' => '',
360
- 'attachment' => '',
361
- );
362
-
363
- if ( !is_array( $value ) )
364
- return $background;
365
-
366
- foreach ( $value as $k => $v ) {
367
- switch ( $k ) {
368
- case 'color' :
369
- $v = $this->hex_color( $v );
370
- $background['color'] = $v;
371
- break;
372
- case 'image' :
373
- $v = esc_url_raw( $v );
374
- $background['image'] = $v;
375
- break;
376
- case 'repeat' :
377
- $v = $this->background_repeat( $v );
378
- $background['repeat'] = $v;
379
- break;
380
- case 'position' :
381
- $v = $this->background_position( $v );
382
- $background['position'] = $v;
383
- break;
384
- case 'attachment' :
385
- $v = $this->background_attachment( $v );
386
- $background['attachment'] = $v;
387
- break;
388
- }
389
- }
390
-
391
- return $background;
392
- }
393
-
394
- public function background_repeat( $value ) {
395
- $whitelist = array( 'repeat', 'no-repeat', 'repeat-x', 'repeat-y' );
396
-
397
- if ( in_array( $value, $whitelist ) )
398
- return $value;
399
-
400
- return '';
401
- }
402
-
403
- public function border_style( $value ) {
404
- $whitelist = array(
405
- 'none',
406
- 'hidden',
407
- 'dotted',
408
- 'dashed',
409
- 'solid',
410
- 'double',
411
- 'groove',
412
- 'ridge',
413
- 'inset',
414
- 'outset',
415
- 'inherit',
416
- );
417
-
418
- if ( in_array( $value, $whitelist ) )
419
- return $value;
420
-
421
- return 'none';
422
- }
423
-
424
- public function background_position( $value ) {
425
- $whitelist = array(
426
- 'left top',
427
- 'left center',
428
- 'left bottom',
429
- 'right top',
430
- 'right center',
431
- 'right bottom',
432
- 'center top',
433
- 'center center',
434
- 'center bottom',
435
- );
436
-
437
- if ( in_array( $value, $whitelist ) )
438
- return $value;
439
-
440
- return '';
441
- }
442
-
443
- public function background_attachment( $value ) {
444
- $whitelist = array( 'fixed', 'scroll' );
445
-
446
- if ( in_array( $value, $whitelist ) )
447
- return $value;
448
-
449
- return '';
450
- }
451
-
452
- public function hex_color( $color ) {
453
- if ( '' === $color )
454
- return '';
455
-
456
- if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
457
- return $color;
458
-
459
- return null;
460
- }
461
-
462
- /**
463
- * replace nonalphannumeric charachers with underscore
464
- * should be safe enought to use as array key
465
- *
466
- * @since 3.5.2
467
- * @access public
468
- *
469
- * @param string $key
470
- * @return string
471
- */
472
- public function key( $key ) {
473
- $key = strtolower( preg_replace( '/[^a-zA-Z0-9]/', '_', $key ) );
474
-
475
- return $key;
476
- }
477
-
478
- /**
479
- * replace nonalphannumeric charachers with hyphen
480
- * should be safe enough to use as a CSS id
481
- *
482
- * @since 3.5.2
483
- * @access public
484
- *
485
- * @param string $key
486
- * @return string
487
- */
488
- public function id( $id ) {
489
- $id = strtolower( preg_replace( '/[^a-zA-Z0-9]/', '-', $id ) );
490
-
491
- return $id;
492
- }
493
-
494
- /**
495
- * return numeric values only
496
- *
497
- * @since 3.6
498
- * @access public
499
- *
500
- * @param string $number
501
- * @return int
502
- */
503
- public function number( $number ) {
504
- $number = (int) preg_replace( "/[^0-9\-]/", "", $number );
505
-
506
- return $number;
507
- }
508
-
509
- /**
510
- * return decimal number
511
- *
512
- * @since 3.6.1
513
- * @access public
514
- *
515
- * @param mixed $number
516
- * @return void
517
- */
518
- public function decimal( $number ) {
519
- $number = preg_replace( "/[^0-9\.\-]/", "", $number );
520
-
521
- return $number;
522
- }
523
-
524
- /**
525
- * replace space with plus sign. Should be safe enough
526
- * to use in Google Font stylesheet link
527
- *
528
- * @since 3.5.2
529
- * @access public
530
- *
531
- * @param string $code
532
- * @return string
533
- */
534
- public function google_code( $code ) {
535
- $code = preg_replace( '/\s/', '+', $code );
536
-
537
- return $code;
538
- }
539
-
540
- /**
541
- * Parse only friendly characters to use in family name
542
- * inside css file.
543
- *
544
- * @since 3.5.2
545
- * @access public
546
- *
547
- * @param string $name
548
- * @return string
549
- */
550
- public function font_family_name( $name ) {
551
- $name = preg_replace( '/[^a-zA-Z0-9\-_]/', '', $name );
552
-
553
- return $name;
554
- }
555
-
556
- /**
557
- * Checkbox should only return 1 or 0
558
- *
559
- * @since 3.5.2
560
- * @access public
561
- *
562
- * @param string $val
563
- * @return void
564
- */
565
- public function checkbox( $val ) {
566
- if ( $val )
567
- return 1;
568
- else
569
- return 0;
570
- }
571
-
572
- /**
573
- * Make sure sidebar is valid
574
- *
575
- * @since 3.6.1
576
- * @access public
577
- *
578
- * @param mixed $value
579
- * @return void
580
- */
581
- public function sidebar( $value ) {
582
- global $wp_registered_sidebars;
583
-
584
- if ( 'none' == $value )
585
- return $value;
586
-
587
- if ( array_key_exists( $value, $wp_registered_sidebars ) )
588
- return $value;
589
-
590
- return 'none';
591
- }
592
-
593
- /**
594
- * Sanitize multiple emails
595
- *
596
- * @since 3.7.1
597
- * @access public
598
- *
599
- * @param mixed $email
600
- * @return void
601
- */
602
- public function emails( $email ) {
603
- $valid = array();
604
-
605
- $email = explode( ',', $email );
606
-
607
- foreach ( $email as $e ) {
608
- $e = trim( $e );
609
- if ( is_email( $e ) )
610
- $valid[] = $e;
611
- }
612
-
613
- if ( ! empty( $valid ) )
614
- return implode( ',', $valid );
615
-
616
- return null;
617
- }
618
-
619
- public function esc_url_raw( $value ) {
620
- return esc_url_raw( $value );
621
- }
622
-
623
- public function no_sanitize( $value ) {
624
- return $value;
625
- }
626
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendors/wpc-settings-framework/class-wpc-settings-framework.php CHANGED
@@ -1,6 +1,4 @@
1
  <?php
2
- namespace WC_Shortcodes;
3
-
4
  /**
5
  * WPC Settings Framework.
6
  *
@@ -17,7 +15,7 @@ namespace WC_Shortcodes;
17
  * @package WPC_Settings_Framework
18
  * @author Chris Baldelomar <chris@webplantmedia.com>
19
  */
20
- class WPC_Settings_Framework {
21
 
22
  protected $version = '1.0.0';
23
 
@@ -66,9 +64,6 @@ class WPC_Settings_Framework {
66
  */
67
  private function __construct() {
68
 
69
- require_once( 'class-wpc-settings-framework-sanitize.php' );
70
- $this->sanitize = WPC_Settings_Framework_Sanitize::get_instance();
71
-
72
  $this->set_slug_prefix();
73
 
74
  add_action( 'admin_init', array( $this, 'set_plugin_info' ) );
@@ -107,8 +102,8 @@ class WPC_Settings_Framework {
107
  return;
108
  }
109
 
110
- $this->plugin_slug = $this->sanitize->id( $plugin_name );
111
- $this->plugin_prefix = $this->sanitize->key( $plugin_name ) . '_';
112
  }
113
 
114
  public function set_plugin_info() {
@@ -289,8 +284,8 @@ class WPC_Settings_Framework {
289
  }
290
 
291
  $callback = array(
292
- $this->sanitize,
293
- $this->sanitize->callback( $o['type'] ),
294
  );
295
 
296
  return $callback;
@@ -523,4 +518,595 @@ class WPC_Settings_Framework {
523
  break;
524
  }
525
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  }
1
  <?php
 
 
2
  /**
3
  * WPC Settings Framework.
4
  *
15
  * @package WPC_Settings_Framework
16
  * @author Chris Baldelomar <chris@webplantmedia.com>
17
  */
18
+ class WC_Shortcodes_Settings_Framework {
19
 
20
  protected $version = '1.0.0';
21
 
64
  */
65
  private function __construct() {
66
 
 
 
 
67
  $this->set_slug_prefix();
68
 
69
  add_action( 'admin_init', array( $this, 'set_plugin_info' ) );
102
  return;
103
  }
104
 
105
+ $this->plugin_slug = $this->sanitize_id( $plugin_name );
106
+ $this->plugin_prefix = $this->sanitize_key( $plugin_name ) . '_';
107
  }
108
 
109
  public function set_plugin_info() {
284
  }
285
 
286
  $callback = array(
287
+ $this,
288
+ $this->sanitize_callback( $o['type'] ),
289
  );
290
 
291
  return $callback;
518
  break;
519
  }
520
  }
521
+
522
+ /************
523
+ * Sanitize *
524
+ ************/
525
+
526
+ /**
527
+ * Given an option type, we will return a string
528
+ * of the callback function used to sanitize
529
+ * the option value
530
+ *
531
+ * @since 3.5.2
532
+ * @access public
533
+ *
534
+ * @param string $type
535
+ * @return string
536
+ */
537
+ public function sanitize_callback( $type ) {
538
+ switch ( $type ) {
539
+ case 'color' :
540
+ return 'sanitize_hex_color';
541
+ case 'image' :
542
+ return 'sanitize_esc_url_raw';
543
+ case 'positive_pixel' :
544
+ return 'sanitize_positive_pixel';
545
+ case 'pixel' :
546
+ return 'sanitize_pixel';
547
+ case 'number' :
548
+ return 'sanitize_number';
549
+ case 'decimal' :
550
+ return 'sanitize_decimal';
551
+ case 'border' :
552
+ return 'sanitize_border';
553
+ case 'background' :
554
+ return 'sanitize_background_css';
555
+ case 'checkbox' :
556
+ return 'sanitize_checkbox';
557
+ case 'gallery' :
558
+ return 'sanitize_gallery';
559
+ case 'emails' :
560
+ return 'sanitize_emails';
561
+ }
562
+
563
+ return 'sanitize_none';
564
+ }
565
+
566
+ /**
567
+ * Validate slideshow data saved to database.
568
+ *
569
+ * @since 3.6
570
+ * @access public
571
+ *
572
+ * @param array $value
573
+ * @return array
574
+ */
575
+ public function sanitize_gallery( $value ) {
576
+ if ( empty( $value ) )
577
+ return null;
578
+
579
+ $ids = explode( ',', $value );
580
+
581
+ foreach ( $ids as $key => $id ) {
582
+ if ( ! is_numeric( $id ) ) {
583
+ unset( $ids[ $key ] );
584
+ }
585
+ }
586
+
587
+ $value = implode( ',', $ids );
588
+
589
+ return $value;
590
+ }
591
+
592
+ /**
593
+ * Sanitize border values. Border consists
594
+ * of pixel value, border style, and color.
595
+ *
596
+ * @since 3.6
597
+ * @access public
598
+ *
599
+ * @param array $value
600
+ * @return array
601
+ */
602
+ public function sanitize_border( $value ) {
603
+ $border = array(
604
+ 'width' => '0px',
605
+ 'style' => 'none',
606
+ 'color' => '#ffffff',
607
+ );
608
+
609
+ if ( ! is_array( $value ) )
610
+ return $border;
611
+
612
+ foreach ( $value as $k => $v ) {
613
+ switch ( $k ) {
614
+ case 'width' :
615
+ $v = $this->sanitize_positive_pixel( $v );
616
+ $border['width'] = $v;
617
+ break;
618
+ case 'style' :
619
+ $v = $this->sanitize_border_style( $v );
620
+ $border['style'] = $v;
621
+ break;
622
+ case 'color' :
623
+ $v = $this->sanitize_hex_color( $v );
624
+ $border['color'] = $v;
625
+ break;
626
+ }
627
+ }
628
+
629
+ return $border;
630
+ }
631
+
632
+ /**
633
+ * Strips all non numerica characters and returns
634
+ * intval() of string. Only allows for positive values.
635
+ *
636
+ * @since 3.6
637
+ * @access public
638
+ *
639
+ * @param string $value
640
+ * @return void
641
+ */
642
+ public function sanitize_positive_pixel( $value ) {
643
+ $value = preg_replace("/[^0-9]/", "",$value);
644
+ $value = intval( $value );
645
+
646
+ if ( empty( $value ) )
647
+ $value = '0';
648
+
649
+ return $value."px";
650
+ }
651
+
652
+ /**
653
+ * Strips all non numerica characters and returns
654
+ * intval() of string. Allows both negative and
655
+ * positive values.
656
+ *
657
+ * @since 3.6
658
+ * @access public
659
+ *
660
+ * @param string $value
661
+ * @return void
662
+ */
663
+ public function sanitize_pixel( $value ) {
664
+ $value = preg_replace("/[^0-9\-]/", "",$value);
665
+ $value = intval( $value );
666
+
667
+ if ( empty( $value ) )
668
+ $value = '0';
669
+
670
+ return $value."px";
671
+ }
672
+
673
+ public function sanitize_font( $value ) {
674
+ $font = array(
675
+ 'font_family' => '',
676
+ 'font_size' => '',
677
+ 'text_transform' => '',
678
+ 'font_style' => '',
679
+ 'font_weight' => '',
680
+ 'color' => '',
681
+ );
682
+
683
+ if ( !is_array( $value ) )
684
+ return $font;
685
+
686
+ foreach ( $value as $k => $v ) {
687
+ switch ( $k ) {
688
+ case 'font_family' :
689
+ $font['font_family'] = $v;
690
+ break;
691
+ case 'font_size' :
692
+ $v = $this->sanitize_pixel( $value['font_size'] );
693
+ $font['font_size'] = $v;
694
+ break;
695
+ case 'text_transform' :
696
+ $font['text_transform'] = $v;
697
+ break;
698
+ case 'font_style' :
699
+ $v = $this->sanitize_font_style( $v );
700
+ $font['font_style'] = $v;
701
+ break;
702
+ case 'font_weight' :
703
+ $v = $this->sanitize_font_weight( $v );
704
+ $font['font_weight'] = $v;
705
+ break;
706
+ case 'color' :
707
+ $v = $this->sanitize_hex_color( $v );
708
+ $font['color'] = $v;
709
+ break;
710
+ }
711
+ }
712
+
713
+ return $font;
714
+ }
715
+
716
+ public function sanitize_font_hover( $value ) {
717
+ $font = array(
718
+ 'text_decoration' => '',
719
+ 'color' => '',
720
+ );
721
+
722
+ if ( !is_array( $value ) )
723
+ return $font;
724
+
725
+ foreach ( $value as $k => $v ) {
726
+ switch ( $k ) {
727
+ case 'text_decoration' :
728
+ $v = $this->sanitize_text_decoration( $v );
729
+ $font['text_decoration'] = $v;
730
+ break;
731
+ case 'color' :
732
+ $v = $this->sanitize_hex_color( $v );
733
+ $font['color'] = $v;
734
+ break;
735
+ }
736
+ }
737
+
738
+ return $font;
739
+ }
740
+
741
+ public function sanitize_font_appearance( $value ) {
742
+ $font = array(
743
+ 'text_decoration' => '',
744
+ 'font_style' => '',
745
+ 'font_weight' => '',
746
+ 'color' => '',
747
+ );
748
+
749
+ if ( !is_array( $value ) )
750
+ return $font;
751
+
752
+ foreach ( $value as $k => $v ) {
753
+ switch ( $k ) {
754
+ case 'text_decoration' :
755
+ $v = $this->sanitize_text_decoration( $v );
756
+ $font['text_decoration'] = $v;
757
+ break;
758
+ case 'font_style' :
759
+ $v = $this->sanitize_font_style( $v );
760
+ $font['font_style'] = $v;
761
+ break;
762
+ case 'font_weight' :
763
+ $v = $this->sanitize_font_weight( $v );
764
+ $font['font_weight'] = $v;
765
+ break;
766
+ case 'color' :
767
+ $v = $this->sanitize_hex_color( $v );
768
+ $font['color'] = $v;
769
+ break;
770
+ }
771
+ }
772
+
773
+ return $font;
774
+ }
775
+
776
+ public function sanitize_text_decoration( $value ) {
777
+ $whitelist = array(
778
+ 'none',
779
+ 'underline',
780
+ 'overline',
781
+ 'line-through',
782
+ );
783
+
784
+ if ( in_array( $value, $whitelist ) )
785
+ return $value;
786
+
787
+ return '';
788
+ }
789
+
790
+ public function sanitize_text_transform( $value ) {
791
+ $whitelist = array(
792
+ 'none',
793
+ 'capitalize',
794
+ 'uppercase',
795
+ 'lowercase',
796
+ );
797
+
798
+ if ( in_array( $value, $whitelist ) )
799
+ return $value;
800
+
801
+ return '';
802
+ }
803
+
804
+ public function sanitize_font_style( $value ) {
805
+ $whitelist = array(
806
+ 'normal',
807
+ 'italic',
808
+ 'oblique',
809
+ );
810
+
811
+ if ( in_array( $value, $whitelist ) )
812
+ return $value;
813
+
814
+ return '';
815
+ }
816
+
817
+ public function sanitize_font_weight( $value ) {
818
+ $whitelist = array(
819
+ 'normal',
820
+ 'bold',
821
+ 'bolder',
822
+ 'lighter',
823
+ '100',
824
+ '200',
825
+ '300',
826
+ '400',
827
+ '500',
828
+ '600',
829
+ '700',
830
+ '800',
831
+ '900',
832
+ );
833
+
834
+ if ( in_array( $value, $whitelist ) )
835
+ return $value;
836
+
837
+ return '';
838
+ }
839
+
840
+ public function sanitize_background_css( $value ) {
841
+ $background = array(
842
+ 'color' => '',
843
+ 'image' => '',
844
+ 'repeat' => '',
845
+ 'position' => '',
846
+ 'attachment' => '',
847
+ );
848
+
849
+ if ( !is_array( $value ) )
850
+ return $background;
851
+
852
+ foreach ( $value as $k => $v ) {
853
+ switch ( $k ) {
854
+ case 'color' :
855
+ $v = $this->sanitize_hex_color( $v );
856
+ $background['color'] = $v;
857
+ break;
858
+ case 'image' :
859
+ $v = esc_url_raw( $v );
860
+ $background['image'] = $v;
861
+ break;
862
+ case 'repeat' :
863
+ $v = $this->sanitize_background_repeat( $v );
864
+ $background['repeat'] = $v;
865
+ break;
866
+ case 'position' :
867
+ $v = $this->sanitize_background_position( $v );
868
+ $background['position'] = $v;
869
+ break;
870
+ case 'attachment' :
871
+ $v = $this->sanitize_background_attachment( $v );
872
+ $background['attachment'] = $v;
873
+ break;
874
+ }
875
+ }
876
+
877
+ return $background;
878
+ }
879
+
880
+ public function sanitize_background_repeat( $value ) {
881
+ $whitelist = array( 'repeat', 'no-repeat', 'repeat-x', 'repeat-y' );
882
+
883
+ if ( in_array( $value, $whitelist ) )
884
+ return $value;
885
+
886
+ return '';
887
+ }
888
+
889
+ public function sanitize_border_style( $value ) {
890
+ $whitelist = array(
891
+ 'none',
892
+ 'hidden',
893
+ 'dotted',
894
+ 'dashed',
895
+ 'solid',
896
+ 'double',
897
+ 'groove',
898
+ 'ridge',
899
+ 'inset',
900
+ 'outset',
901
+ 'inherit',
902
+ );
903
+
904
+ if ( in_array( $value, $whitelist ) )
905
+ return $value;
906
+
907
+ return 'none';
908
+ }
909
+
910
+ public function sanitize_background_position( $value ) {
911
+ $whitelist = array(
912
+ 'left top',
913
+ 'left center',
914
+ 'left bottom',
915
+ 'right top',
916
+ 'right center',
917
+ 'right bottom',
918
+ 'center top',
919
+ 'center center',
920
+ 'center bottom',
921
+ );
922
+
923
+ if ( in_array( $value, $whitelist ) )
924
+ return $value;
925
+
926
+ return '';
927
+ }
928
+
929
+ public function sanitize_background_attachment( $value ) {
930
+ $whitelist = array( 'fixed', 'scroll' );
931
+
932
+ if ( in_array( $value, $whitelist ) )
933
+ return $value;
934
+
935
+ return '';
936
+ }
937
+
938
+ public function sanitize_hex_color( $color ) {
939
+ if ( '' === $color )
940
+ return '';
941
+
942
+ if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
943
+ return $color;
944
+
945
+ return null;
946
+ }
947
+
948
+ /**
949
+ * replace nonalphannumeric charachers with underscore
950
+ * should be safe enought to use as array key
951
+ *
952
+ * @since 3.5.2
953
+ * @access public
954
+ *
955
+ * @param string $key
956
+ * @return string
957
+ */
958
+ public function sanitize_key( $key ) {
959
+ $key = strtolower( preg_replace( '/[^a-zA-Z0-9]/', '_', $key ) );
960
+
961
+ return $key;
962
+ }
963
+
964
+ /**
965
+ * replace nonalphannumeric charachers with hyphen
966
+ * should be safe enough to use as a CSS id
967
+ *
968
+ * @since 3.5.2
969
+ * @access public
970
+ *
971
+ * @param string $key
972
+ * @return string
973
+ */
974
+ public function sanitize_id( $id ) {
975
+ $id = strtolower( preg_replace( '/[^a-zA-Z0-9]/', '-', $id ) );
976
+
977
+ return $id;
978
+ }
979
+
980
+ /**
981
+ * return numeric values only
982
+ *
983
+ * @since 3.6
984
+ * @access public
985
+ *
986
+ * @param string $number
987
+ * @return int
988
+ */
989
+ public function sanitize_number( $number ) {
990
+ $number = (int) preg_replace( "/[^0-9\-]/", "", $number );
991
+
992
+ return $number;
993
+ }
994
+
995
+ /**
996
+ * return decimal number
997
+ *
998
+ * @since 3.6.1
999
+ * @access public
1000
+ *
1001
+ * @param mixed $number
1002
+ * @return void
1003
+ */
1004
+ public function sanitize_decimal( $number ) {
1005
+ $number = preg_replace( "/[^0-9\.\-]/", "", $number );
1006
+
1007
+ return $number;
1008
+ }
1009
+
1010
+ /**
1011
+ * replace space with plus sign. Should be safe enough
1012
+ * to use in Google Font stylesheet link
1013
+ *
1014
+ * @since 3.5.2
1015
+ * @access public
1016
+ *
1017
+ * @param string $code
1018
+ * @return string
1019
+ */
1020
+ public function sanitize_google_code( $code ) {
1021
+ $code = preg_replace( '/\s/', '+', $code );
1022
+
1023
+ return $code;
1024
+ }
1025
+
1026
+ /**
1027
+ * Parse only friendly characters to use in family name
1028
+ * inside css file.
1029
+ *
1030
+ * @since 3.5.2
1031
+ * @access public
1032
+ *
1033
+ * @param string $name
1034
+ * @return string
1035
+ */
1036
+ public function sanitize_font_family_name( $name ) {
1037
+ $name = preg_replace( '/[^a-zA-Z0-9\-_]/', '', $name );
1038
+
1039
+ return $name;
1040
+ }
1041
+
1042
+ /**
1043
+ * Checkbox should only return 1 or 0
1044
+ *
1045
+ * @since 3.5.2
1046
+ * @access public
1047
+ *
1048
+ * @param string $val
1049
+ * @return void
1050
+ */
1051
+ public function sanitize_checkbox( $val ) {
1052
+ if ( $val )
1053
+ return 1;
1054
+ else
1055
+ return 0;
1056
+ }
1057
+
1058
+ /**
1059
+ * Make sure sidebar is valid
1060
+ *
1061
+ * @since 3.6.1
1062
+ * @access public
1063
+ *
1064
+ * @param mixed $value
1065
+ * @return void
1066
+ */
1067
+ public function sanitize_sidebar( $value ) {
1068
+ global $wp_registered_sidebars;
1069
+
1070
+ if ( 'none' == $value )
1071
+ return $value;
1072
+
1073
+ if ( array_key_exists( $value, $wp_registered_sidebars ) )
1074
+ return $value;
1075
+
1076
+ return 'none';
1077
+ }
1078
+
1079
+ /**
1080
+ * Sanitize multiple emails
1081
+ *
1082
+ * @since 3.7.1
1083
+ * @access public
1084
+ *
1085
+ * @param mixed $email
1086
+ * @return void
1087
+ */
1088
+ public function sanitize_emails( $email ) {
1089
+ $valid = array();
1090
+
1091
+ $email = explode( ',', $email );
1092
+
1093
+ foreach ( $email as $e ) {
1094
+ $e = trim( $e );
1095
+ if ( is_email( $e ) )
1096
+ $valid[] = $e;
1097
+ }
1098
+
1099
+ if ( ! empty( $valid ) )
1100
+ return implode( ',', $valid );
1101
+
1102
+ return null;
1103
+ }
1104
+
1105
+ public function sanitize_esc_url_raw( $value ) {
1106
+ return esc_url_raw( $value );
1107
+ }
1108
+
1109
+ public function sanitize_none( $value ) {
1110
+ return $value;
1111
+ }
1112
  }
includes/vendors/wpc-settings-framework/init.php CHANGED
@@ -9,5 +9,5 @@ if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
9
 
10
  require_once( 'class-wpc-settings-framework.php' );
11
 
12
- add_action( 'plugins_loaded', array( 'WC_Shortcodes\\WPC_Settings_Framework', 'get_instance' ) );
13
  }
9
 
10
  require_once( 'class-wpc-settings-framework.php' );
11
 
12
+ add_action( 'plugins_loaded', array( 'WC_Shortcodes_Settings_Framework', 'get_instance' ) );
13
  }
readme.txt CHANGED
@@ -88,6 +88,10 @@ Use the shortcode manager in the TinyMCE text editor
88
 
89
  == Changelog ==
90
 
 
 
 
 
91
  = Version 1.59 =
92
 
93
  * minor bug fix
88
 
89
  == Changelog ==
90
 
91
+ = Version 1.60 =
92
+
93
+ * Removed namespace which is not supported in php 5.2
94
+
95
  = Version 1.59 =
96
 
97
  * minor bug fix
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: 1.59
9
  License: GPLv2 or later
10
  */
11
 
12
- define( 'WC_SHORTCODES_VERSION', '1.59' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 1.60
9
  License: GPLv2 or later
10
  */
11
 
12
+ define( 'WC_SHORTCODES_VERSION', '1.60' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );