Shortcodes by Angie Makes - Version 3.1

Version Description

Download this release

Release Info

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

Code changes from version 2.07 to 3.1

Files changed (115) hide show
  1. README.md +8 -1
  2. admin/assets/css/admin.css +0 -0
  3. admin/assets/css/ui-theme-override.css +107 -0
  4. {includes/admin → admin/assets}/css/wc-shortcodes.css +0 -0
  5. {includes/admin → admin/assets}/css/wcpostsliderwidget.css +7 -6
  6. admin/assets/js/admin.js +0 -0
  7. {includes/mce → admin/assets}/js/font-awesome-tinymce-4.js +0 -0
  8. {includes/mce → admin/assets}/js/font_awesome_tinymce.js +0 -0
  9. {includes/mce → admin/assets}/js/shortcodes-tinymce-4.js +0 -0
  10. {includes/mce → admin/assets}/js/shortcodes_tinymce.js +0 -0
  11. {includes/admin → admin/assets}/js/wc-shortcodes.js +0 -0
  12. {includes/admin → admin/assets}/js/wcpostsliderwidget.js +0 -0
  13. admin/class-admin.php +95 -0
  14. admin/class-ajax.php +178 -0
  15. admin/class-options.php +448 -0
  16. admin/class-tinymce-buttons.php +70 -0
  17. includes/ajax.php +0 -208
  18. includes/functions.php +0 -418
  19. includes/mce/js/images/shortcodes.png +0 -0
  20. includes/mce/shortcodes_tinymce.php +0 -54
  21. includes/options.php +0 -417
  22. includes/post-types.php +0 -227
  23. includes/scripts.php +0 -80
  24. includes/vendors/wpc-settings-framework/class-wpc-settings-framework.php +13 -13
  25. {includes → public/assets}/css/font-awesome.css +0 -0
  26. {includes → public/assets}/css/font-awesome.min.css +0 -0
  27. public/assets/css/public.css +0 -0
  28. {includes → public/assets}/css/style.css +0 -0
  29. {includes → public/assets}/fonts/FontAwesome.otf +0 -0
  30. {includes → public/assets}/fonts/fontawesome-webfont.eot +0 -0
  31. {includes → public/assets}/fonts/fontawesome-webfont.svg +0 -0
  32. {includes → public/assets}/fonts/fontawesome-webfont.ttf +0 -0
  33. {includes → public/assets}/fonts/fontawesome-webfont.woff +0 -0
  34. {includes → public/assets}/fonts/fontawesome-webfont.woff2 +0 -0
  35. public/assets/img/blogger.png +0 -0
  36. public/assets/img/bloglovin.png +0 -0
  37. public/assets/img/circle-border.png +0 -0
  38. public/assets/img/dash-border.png +0 -0
  39. public/assets/img/email.png +0 -0
  40. public/assets/img/etsy.png +0 -0
  41. public/assets/img/facebook.png +0 -0
  42. public/assets/img/flickr.png +0 -0
  43. public/assets/img/flower.png +0 -0
  44. public/assets/img/google.png +0 -0
  45. public/assets/img/instagram.png +0 -0
  46. public/assets/img/picasa.png +0 -0
  47. public/assets/img/pinterest.png +0 -0
  48. public/assets/img/print.png +0 -0
  49. public/assets/img/rss.png +0 -0
  50. public/assets/img/rustic-border.png +0 -0
  51. public/assets/img/shopping.png +0 -0
  52. public/assets/img/slide-arrow-left.png +0 -0
  53. public/assets/img/slide-arrow-right.png +0 -0
  54. public/assets/img/tumblr.png +0 -0
  55. public/assets/img/twitter.png +0 -0
  56. public/assets/img/vimeo.png +0 -0
  57. public/assets/img/youtube.png +0 -0
  58. {includes → public/assets}/js/accordion.js +0 -0
  59. {includes → public/assets}/js/countdown.js +0 -0
  60. {includes → public/assets}/js/fullwidth.js +0 -0
  61. {includes → public/assets}/js/googlemap.js +0 -0
  62. {includes → public/assets}/js/imagesloaded.pkgd.min.js +0 -0
  63. {includes → public/assets}/js/jquery.countdown.js +0 -0
  64. {includes → public/assets}/js/post-slider.js +0 -0
  65. {includes → public/assets}/js/posts-grid.js +0 -0
  66. {includes → public/assets}/js/posts.js +0 -0
  67. {includes → public/assets}/js/pre.js +0 -0
  68. {includes → public/assets}/js/prettify.js +0 -0
  69. public/assets/js/public.js +0 -0
  70. {includes → public/assets}/js/responsiveslides.min.js +0 -0
  71. {includes → public/assets}/js/rsvp.js +0 -0
  72. {includes → public/assets}/js/skillbar.js +0 -0
  73. {includes → public/assets}/js/tabs.js +0 -0
  74. {includes → public/assets}/js/toggle.js +0 -0
  75. public/class-ajax-front.php +99 -0
  76. public/class-hooks.php +141 -0
  77. public/class-post-types.php +235 -0
  78. public/class-public.php +164 -0
  79. includes/shortcode-functions.php → public/class-register.php +355 -398
  80. includes/classes/sanitize.php → public/class-sanitize.php +41 -10
  81. public/class-vars.php +129 -0
  82. public/class-widgets.php +38 -0
  83. public/functions.php +180 -0
  84. {includes → public}/templates/borderless/content-aside.php +0 -0
  85. {includes → public}/templates/borderless/content-audio.php +0 -0
  86. {includes → public}/templates/borderless/content-chat.php +0 -0
  87. {includes → public}/templates/borderless/content-excerpt.php +0 -0
  88. {includes → public}/templates/borderless/content-gallery.php +0 -0
  89. {includes → public}/templates/borderless/content-link.php +0 -0
  90. {includes → public}/templates/borderless/content-quote.php +0 -0
  91. {includes → public}/templates/borderless/content-video.php +0 -0
  92. {includes → public}/templates/borderless/content.php +0 -0
  93. {includes → public}/templates/borderless/entry-meta.php +0 -0
  94. {includes → public}/templates/borderless/index.php +0 -0
  95. {includes → public}/templates/box/content-aside.php +0 -0
  96. {includes → public}/templates/box/content-audio.php +0 -0
  97. {includes → public}/templates/box/content-chat.php +0 -0
  98. {includes → public}/templates/box/content-excerpt.php +0 -0
  99. {includes → public}/templates/box/content-gallery.php +0 -0
  100. {includes → public}/templates/box/content-link.php +0 -0
  101. {includes → public}/templates/box/content-quote.php +0 -0
  102. {includes → public}/templates/box/content-video.php +0 -0
  103. {includes → public}/templates/box/content.php +0 -0
  104. {includes → public}/templates/box/entry-meta.php +0 -0
  105. {includes → public}/templates/box/index.php +0 -0
  106. {includes → public}/templates/nav-filtering.php +0 -0
  107. {includes → public}/templates/nav-pagination.php +0 -0
  108. {includes → public}/templates/slider1/content.php +0 -0
  109. {includes → public}/templates/slider1/index.php +0 -0
  110. {includes → public}/templates/slider2/content.php +0 -0
  111. {includes → public}/templates/slider2/index.php +0 -0
  112. includes/widgets.php → public/widgets/widget-post-slider.php +1 -195
  113. public/widgets/widget-social-icons.php +180 -0
  114. readme.txt +8 -1
  115. wc-shortcodes.php +90 -110
README.md CHANGED
@@ -4,7 +4,7 @@
4
  **Donate link:** http://webplantmedia.com/donate/
5
  **Tags:** shortcode, shortcodes, accordion, accordions, tab, tabs, toggle, columns, column, section, sections, testimonials, border, borders, button, buttons, fullwidth, full width, notification, notifications, google maps, maps, googlemaps, social icons, progress bar, pricing, pricing box, highlights, image, flags, banners, countdown, rsvp, custom html, code, code snippets, snippets, isotope, masonry, posts, post_type, font awesome, icons, fontawesome, fa icons
6
  **Requires at least:** 3.7
7
- **Tested up to:** 4.6.1
8
  **Stable tag:** trunk
9
  **License:** GPLv2 or later
10
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
@@ -66,6 +66,13 @@ Use the shortcode manager in the TinyMCE text editor
66
 
67
  ## Changelog ##
68
 
 
 
 
 
 
 
 
69
  ### Version 2.07
70
 
71
  * sanitized, escaped, and validated all POST calls
4
  **Donate link:** http://webplantmedia.com/donate/
5
  **Tags:** shortcode, shortcodes, accordion, accordions, tab, tabs, toggle, columns, column, section, sections, testimonials, border, borders, button, buttons, fullwidth, full width, notification, notifications, google maps, maps, googlemaps, social icons, progress bar, pricing, pricing box, highlights, image, flags, banners, countdown, rsvp, custom html, code, code snippets, snippets, isotope, masonry, posts, post_type, font awesome, icons, fontawesome, fa icons
6
  **Requires at least:** 3.7
7
+ **Tested up to:** 4.7
8
  **Stable tag:** trunk
9
  **License:** GPLv2 or later
10
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
66
 
67
  ## Changelog ##
68
 
69
+ ### Version 3.1
70
+
71
+ * updated wpc settings framework to version 1.0.3
72
+ * Added option to enter Google Maps API
73
+ * Added style override when jquery ui style was enqueued.
74
+ * Restructured files
75
+
76
  ### Version 2.07
77
 
78
  * sanitized, escaped, and validated all POST calls
admin/assets/css/admin.css ADDED
File without changes
admin/assets/css/ui-theme-override.css ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpc-ui-theme-override.ui-widget {
2
+ font-family: inherit;
3
+ font-size: inherit;
4
+ }
5
+ .wpc-ui-theme-override.ui-helper-reset {
6
+ margin: 0;
7
+ padding: 0;
8
+ border: 0;
9
+ outline: 0;
10
+ line-height: inherit;
11
+ text-decoration: none;
12
+ font-size: inherit;
13
+ list-style: none;
14
+ }
15
+ .wpc-ui-theme-override.ui-accordion .ui-accordion-header {
16
+ display: block;
17
+ cursor: pointer;
18
+ position: relative;
19
+ margin: 0;
20
+ padding: 0;
21
+ font-size: inherit;
22
+ }
23
+ .wpc-ui-theme-override .ui-corner-all,
24
+ .wpc-ui-theme-override .ui-corner-top,
25
+ .wpc-ui-theme-override .ui-corner-right,
26
+ .wpc-ui-theme-override .ui-corner-tr {
27
+ border-radius: 0;
28
+ }
29
+ .wpc-ui-theme-override .ui-state-hover,
30
+ .wpc-ui-theme-override .ui-widget-content .ui-state-hover,
31
+ .wpc-ui-theme-override .ui-widget-header .ui-state-hover,
32
+ .wpc-ui-theme-override .ui-state-focus,
33
+ .wpc-ui-theme-override .ui-widget-content .ui-state-focus,
34
+ .wpc-ui-theme-override .ui-widget-header .ui-state-focus,
35
+ .wpc-ui-theme-override .ui-button:hover,
36
+ .wpc-ui-theme-override .ui-button:focus {
37
+ border: 0px solid #e5e5e5;
38
+ background: #ddd;
39
+ font-weight: inherit;
40
+ color: inherit;
41
+ }
42
+ .wpc-ui-theme-override .ui-menu .ui-state-focus,
43
+ .wpc-ui-theme-override .ui-menu .ui-state-active {
44
+ margin: 0;
45
+ }
46
+ .wpc-ui-theme-override .ui-state-active,
47
+ .wpc-ui-theme-override .ui-widget-content .ui-state-active,
48
+ .wpc-ui-theme-override .ui-widget-header .ui-state-active,
49
+ .wpc-ui-theme-override a.ui-button:active,
50
+ .wpc-ui-theme-override .ui-button:active,
51
+ .wpc-ui-theme-override .ui-button.ui-state-active:hover,
52
+ .wpc-ui-theme-override .ui-state-default,
53
+ .wpc-ui-theme-override .ui-widget-content .ui-state-default,
54
+ .wpc-ui-theme-override .ui-widget-header .ui-state-default,
55
+ .wpc-ui-theme-override .ui-button,
56
+ .wpc-ui-theme-override .ui-button.ui-state-disabled:hover,
57
+ .wpc-ui-theme-override .ui-button.ui-state-disabled:active {
58
+ border-style: solid;
59
+ border-width: 1px;
60
+ border-color: #e5e5e5;
61
+ background: #ffffff;
62
+ font-weight: inherit;
63
+ color: inherit;
64
+ }
65
+ .wpc-ui-theme-override .ui-icon,
66
+ .wpc-ui-theme-override .ui-widget-content .ui-icon {
67
+ display: none;
68
+ }
69
+ .wpc-ui-theme-override.ui-accordion .ui-accordion-content {
70
+ padding: 0;
71
+ border-top: 0;
72
+ overflow: visible;
73
+ }
74
+ .wpc-ui-theme-override .ui-widget-content {
75
+ border: 0px solid #e5e5e5;
76
+ background: #ffffff;
77
+ color: inherit;
78
+ }
79
+ /* accordion */
80
+ .wpc-ui-theme-override .ui-widget.ui-widget-content {
81
+ border: 1px solid #e5e5e5;
82
+ }
83
+ .wpc-ui-theme-override .ui-widget .ui-widget {
84
+ font-size: inherit;
85
+ }
86
+ .wpc-ui-theme-override .ui-menu {
87
+ list-style: none;
88
+ padding: 0;
89
+ margin: 0;
90
+ display: block;
91
+ outline: 0;
92
+ }
93
+ .wpc-ui-theme-override .ui-autocomplete {
94
+ position: absolute;
95
+ top: 0;
96
+ left: 0;
97
+ cursor: default;
98
+ }
99
+ .wpc-ui-theme-override .ui-front {
100
+ z-index: 999999;
101
+ }
102
+ .wpc-ui-theme-override .ui-autocomplete {
103
+ border: 1px solid #5b9dd9 !important;
104
+ -webkit-box-shadow: 0 1px 2px rgba(30,140,190,.8) !important;
105
+ box-shadow: 0 1px 2px rgba(30,140,190,.8) !important;
106
+ background-color: #fff !important;
107
+ }
{includes/admin → admin/assets}/css/wc-shortcodes.css RENAMED
File without changes
{includes/admin → admin/assets}/css/wcpostsliderwidget.css RENAMED
@@ -1,15 +1,15 @@
1
- .wc-shortcodes-post-slider-widget {
2
  margin-bottom: 1.5em;
3
  }
4
- .wc-shortcodes-post-slider-widget .ui-autocomplete {
5
  z-index: 999999;
6
  max-height: 300px;
7
  overflow: auto;
8
  }
9
- .wc-shortcodes-post-slider-widget .ui-autocomplete li {
10
  white-space: normal;
11
  }
12
- .wc-shortcodes-post-slider-widget .ui-accordion-header {
13
  border: 1px solid #ddd;
14
  position: relative;
15
  padding: 10px 15px;
@@ -23,8 +23,9 @@
23
  cursor: pointer;
24
  font-size: 1em;
25
  font-weight: 600;
 
26
  }
27
- .wc-shortcodes-post-slider-widget .ui-accordion-header:before {
28
  content: "\f345";
29
  border: none;
30
  background: 0 0;
@@ -44,6 +45,6 @@
44
  vertical-align: bottom;
45
  margin-right: 5px;
46
  }
47
- .wc-shortcodes-post-slider-widget .ui-accordion-header.ui-accordion-header-active:before {
48
  content: "\f347";
49
  }
1
+ html .wc-shortcodes-post-slider-widget.ui-accordion {
2
  margin-bottom: 1.5em;
3
  }
4
+ html .wc-shortcodes-post-slider-widget.ui-accordion .ui-autocomplete {
5
  z-index: 999999;
6
  max-height: 300px;
7
  overflow: auto;
8
  }
9
+ html .wc-shortcodes-post-slider-widget.ui-accordion .ui-autocomplete li {
10
  white-space: normal;
11
  }
12
+ html .wc-shortcodes-post-slider-widget.ui-accordion .ui-accordion-header {
13
  border: 1px solid #ddd;
14
  position: relative;
15
  padding: 10px 15px;
23
  cursor: pointer;
24
  font-size: 1em;
25
  font-weight: 600;
26
+ margin-top: 1em;
27
  }
28
+ html .wc-shortcodes-post-slider-widget.ui-accordion .ui-accordion-header:before {
29
  content: "\f345";
30
  border: none;
31
  background: 0 0;
45
  vertical-align: bottom;
46
  margin-right: 5px;
47
  }
48
+ html .wc-shortcodes-post-slider-widget.ui-accordion .ui-accordion-header.ui-accordion-header-active:before {
49
  content: "\f347";
50
  }
admin/assets/js/admin.js ADDED
File without changes
{includes/mce → admin/assets}/js/font-awesome-tinymce-4.js RENAMED
File without changes
{includes/mce → admin/assets}/js/font_awesome_tinymce.js RENAMED
File without changes
{includes/mce → admin/assets}/js/shortcodes-tinymce-4.js RENAMED
File without changes
{includes/mce → admin/assets}/js/shortcodes_tinymce.js RENAMED
File without changes
{includes/admin → admin/assets}/js/wc-shortcodes.js RENAMED
File without changes
{includes/admin → admin/assets}/js/wcpostsliderwidget.js RENAMED
File without changes
admin/class-admin.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_Admin extends WPC_Shortcodes_Vars {
3
+
4
+ /**
5
+ * Instance of this class.
6
+ *
7
+ * @since 1.0.0
8
+ *
9
+ * @var object
10
+ */
11
+ protected static $instance = null;
12
+
13
+ /**
14
+ * Slug of the plugin screen.
15
+ *
16
+ * @since 1.0.0
17
+ *
18
+ * @var string
19
+ */
20
+ protected $plugin_screen_hook_suffix = null;
21
+
22
+ public static function get_instance() {
23
+
24
+ // If the single instance hasn't been set, set it now.
25
+ if ( null == self::$instance ) {
26
+ self::$instance = new self;
27
+ }
28
+
29
+ return self::$instance;
30
+ }
31
+
32
+ /**
33
+ * Initialize the plugin by loading admin scripts & styles and adding a
34
+ * settings page and menu.
35
+ *
36
+ * @since 1.0.0
37
+ */
38
+ private function __construct() {
39
+
40
+ // Load admin style sheet and JavaScript.
41
+ // add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue_admin_styles' ) );
42
+ add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue_admin_scripts' ), 10, 1 );
43
+
44
+ // Add an action link pointing to the options page.
45
+ $plugin_basename = plugin_basename( plugin_dir_path( realpath( dirname( __FILE__ ) ) ) . parent::$plugin_slug . '.php' );
46
+ add_filter( 'plugin_action_links_' . $plugin_basename, array( &$this, 'add_action_links' ) );
47
+ }
48
+
49
+ /**
50
+ * Register and enqueue admin-specific style sheet.
51
+ *
52
+ * @since 1.0.0
53
+ *
54
+ * @return null Return early if no settings page is registered.
55
+ */
56
+ public function enqueue_admin_styles() {
57
+ }
58
+
59
+ /**
60
+ * Register and enqueue admin-specific JavaScript.
61
+ *
62
+ * @TODO:
63
+ *
64
+ * @since 1.0.0
65
+ *
66
+ * @return null Return early if no settings page is registered.
67
+ */
68
+ public function enqueue_admin_scripts( $hook ) {
69
+
70
+ $ver = WC_SHORTCODES_VERSION;
71
+
72
+ if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'widgets.php' ) {
73
+ wp_enqueue_style( 'wc-shortcodes-admin-style', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/css/wc-shortcodes.css', array( ), $ver );
74
+ wp_enqueue_style( 'wc-shortcodes-ui-theme-override-style', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/css/ui-theme-override.css', array( ), $ver );
75
+ wp_enqueue_style( 'wc-shortcodes-post-slider-widget-style', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/css/wcpostsliderwidget.css', array( ), $ver );
76
+ wp_enqueue_script( 'wc-shortcodes-post-slider-widget', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/js/wcpostsliderwidget.js', array ( 'jquery', 'jquery-ui-autocomplete', 'jquery-ui-accordion' ), $ver, true );
77
+ wp_enqueue_script( 'wc-shortcodes', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/js/wc-shortcodes.js', array ( 'jquery' ), $ver, true );
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Add settings action link to the plugins page.
83
+ *
84
+ * @since 1.0.0
85
+ */
86
+ public function add_action_links( $links ) {
87
+
88
+ return array_merge(
89
+ array(
90
+ 'settings' => '<a href="' . admin_url( 'themes.php?page=' . parent::$plugin_slug ) . '">' . __( 'Settings', 'wc-shortcodes' ) . '</a>'
91
+ ),
92
+ $links
93
+ );
94
+ }
95
+ }
admin/class-ajax.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_Ajax {
3
+ protected static $instance = null;
4
+
5
+ public static function get_instance() {
6
+
7
+ // If the single instance hasn't been set, set it now.
8
+ if ( null == self::$instance ) {
9
+ self::$instance = new self;
10
+ }
11
+
12
+ return self::$instance;
13
+ }
14
+
15
+ private function __construct() {
16
+ add_action( 'wp_ajax_wc_post_lookup', array( &$this, 'post_lookup_callback' ) );
17
+ add_action( 'wp_ajax_wc_terms_lookup', array( &$this, 'terms_lookup_callback' ) );
18
+ add_action( 'wp_ajax_wc_mce_popup', array( &$this, 'mce_popup' ) );
19
+ }
20
+
21
+ public function post_lookup_callback() {
22
+ global $wpdb; //get access to the WordPress database object variable
23
+
24
+ //get names of all businesses
25
+ $request = '%' . $wpdb->esc_like( stripslashes( sanitize_text_field( $_POST['request'] ) ) ) . '%'; //escape for use in LIKE statement
26
+ $post_type = stripslashes( sanitize_text_field( $_POST['post_type'] ) );
27
+
28
+ $sql = "
29
+ select
30
+ ID,
31
+ post_title
32
+ from
33
+ $wpdb->posts
34
+ where
35
+ post_title like %s
36
+ and post_type='%s'
37
+ and post_status='publish'
38
+ order by
39
+ post_title ASC
40
+ limit
41
+ 0,30
42
+ ";
43
+
44
+ $sql = $wpdb->prepare($sql, $request, $post_type);
45
+
46
+ $results = $wpdb->get_results($sql);
47
+
48
+ //copy the business titles to a simple array
49
+ $titles = array();
50
+ $i = 0;
51
+ foreach( $results as $r ) {
52
+ $titles[ $i ][ 'label' ] = $r->post_title . " (" . $r->ID . ")";
53
+ $titles[ $i ][ 'value' ] = $r->ID;
54
+ $i++;
55
+ }
56
+
57
+ if ( empty( $titles ) ) {
58
+ $titles[0]['label'] = "No results found in post type \"$post_type\".";
59
+ $titles[0]['value'] = "0";
60
+ }
61
+
62
+ echo json_encode($titles); //encode into JSON format and output
63
+
64
+ die(); //stop "0" from being output
65
+ }
66
+
67
+ public function terms_lookup_callback() {
68
+ global $wpdb; //get access to the WordPress database object variable
69
+
70
+ //get names of all businesses
71
+ $request = '%' . $wpdb->esc_like( stripslashes( sanitize_text_field( $_POST['request'] ) ) ) . '%'; //escape for use in LIKE statement
72
+ $post_type = stripslashes( sanitize_text_field( $_POST['post_type'] ) );
73
+ $taxonomy = stripslashes( sanitize_text_field( $_POST['taxonomy'] ) );
74
+
75
+ if ( empty( $taxonomy ) ) {
76
+ $titles = array();
77
+ $titles[0]['label'] = "Please select a taxonomy.";
78
+ $titles[0]['value'] = "0";
79
+
80
+ echo json_encode($titles); //encode into JSON format and output
81
+
82
+ die(); //stop "0" from being output
83
+ }
84
+
85
+ $sql = "
86
+ SELECT
87
+ t.slug,
88
+ t.slug
89
+ FROM $wpdb->terms AS t
90
+ INNER JOIN $wpdb->term_taxonomy AS tt ON (tt.term_id = t.term_id)
91
+ INNER JOIN $wpdb->term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
92
+ WHERE t.slug like %s
93
+ AND tt.taxonomy IN ('%s')
94
+ GROUP BY
95
+ t.slug
96
+ ORDER BY
97
+ t.name ASC
98
+ limit
99
+ 0,30
100
+ ";
101
+
102
+ $sql = $wpdb->prepare($sql, $request, $taxonomy);
103
+
104
+ $results = $wpdb->get_results($sql);
105
+
106
+ //copy the business titles to a simple array
107
+ $titles = array();
108
+ $i = 0;
109
+ foreach( $results as $r ) {
110
+ $titles[ $i ]['label'] = $r->slug;
111
+ $titles[ $i ]['value'] = $r->slug;
112
+ $i++;
113
+ }
114
+
115
+ if ( empty( $titles ) ) {
116
+ $titles[0]['label'] = "No results found in selected taxonomy \"$taxonomy\".";
117
+ $titles[0]['value'] = "0";
118
+ }
119
+
120
+ echo json_encode($titles); //encode into JSON format and output
121
+
122
+ die(); //stop "0" from being output
123
+ }
124
+
125
+ public function mce_popup() {
126
+
127
+ // no need to sanitize here.
128
+ $tag = $_POST['tag'];
129
+ $shortcode = stripslashes( $_POST['shortcode'] );
130
+
131
+ $attr = $this->parse_shortcode( $tag, $shortcode );
132
+
133
+ switch ( $tag ) {
134
+ case 'wc_post_slider' :
135
+ $widget = new WC_Shortcodes_Post_Slider_Widget();
136
+ $widget->form( $attr );
137
+ break;
138
+ }
139
+
140
+ die();
141
+ }
142
+
143
+ private function parse_shortcode( $check_tag, $content ) {
144
+ global $shortcode_tags;
145
+
146
+ if ( false === strpos( $content, '[' ) ) {
147
+ return false;
148
+ }
149
+
150
+ if (empty($shortcode_tags) || !is_array($shortcode_tags))
151
+ return false;
152
+
153
+ // Find all registered tag names in $content.
154
+ preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
155
+ $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
156
+
157
+ if ( empty( $tagnames ) ) {
158
+ return false;
159
+ }
160
+
161
+ $pattern = get_shortcode_regex( $tagnames );
162
+ preg_match( "/$pattern/", $content, $m );
163
+
164
+ // allow [[foo]] syntax for escaping a tag
165
+ if ( $m[1] == '[' && $m[6] == ']' ) {
166
+ return substr($m[0], 1, -1);
167
+ }
168
+
169
+ $tag = $m[2];
170
+
171
+ if ( $tag != $check_tag )
172
+ return false;
173
+
174
+ $attr = shortcode_parse_atts( $m[3] );
175
+
176
+ return $attr;
177
+ }
178
+ }
admin/class-options.php ADDED
@@ -0,0 +1,448 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_Options extends WPC_Shortcodes_Vars {
3
+ /**
4
+ * Instance of this class.
5
+ *
6
+ * @since 1.0.0
7
+ *
8
+ * @var object
9
+ */
10
+ protected static $instance = null;
11
+
12
+ public static function get_instance() {
13
+
14
+ // If the single instance hasn't been set, set it now.
15
+ if ( null == self::$instance ) {
16
+ self::$instance = new self;
17
+ }
18
+
19
+ return self::$instance;
20
+ }
21
+
22
+ private function __construct() {
23
+ add_filter( 'wc_shortcodes_wpcsf_options', array( &$this, 'set_options' ), 10, 1 );
24
+ add_filter( 'wc_shortcodes_wpcsf_theme_support', array( &$this, 'wpcsf_theme_support' ), 10, 1 );
25
+ }
26
+
27
+ public function set_options( $options ) {
28
+ // RSVP
29
+ $number_options = "1\n2\n3\n4\n5";
30
+ $event_options = "All Events\nMain Ceremony\nWedding Party";
31
+ $admin_email = get_option( 'admin_email' );
32
+
33
+ // page
34
+ $menu_slug = 'wc-shortcodes';
35
+
36
+ // Option
37
+ $options[ $menu_slug ] = array(
38
+ 'parent_slug' => 'themes.php',
39
+ 'page_title' => 'Shortcodes',
40
+ 'menu_title' => 'Shortcodes',
41
+ 'capability' => 'manage_options',
42
+ 'option_group' => 'wc-shortcodes-options-group',
43
+ 'tabs' => array(
44
+ array(
45
+ 'id' => 'wc-shortcodes-options-social-media-options-tab',
46
+ 'title' => 'Social Media',
47
+ 'sections' => array(
48
+ array(
49
+ 'id' => 'wc-shortcodes-options-social-media-display-section',
50
+ 'add_section' => true, // Add a new section? Or does it already exists?
51
+ 'title' => 'Display',
52
+ 'options' => array(
53
+ array(
54
+ 'option_name' => 'social_icons_display',
55
+ 'title' => 'Order / Show / Hide',
56
+ 'default' => parent::$social_icons,
57
+ 'description' => '',
58
+ 'type' => 'order_show_hide',
59
+ 'callback' => array( &$this, 'sanitize_social_icons' ),
60
+ ),
61
+ array(
62
+ 'option_name' => 'social_icons_format',
63
+ 'title' => 'Format',
64
+ 'default' => parent::$theme_support['social_icons_format'],
65
+ 'description' => '',
66
+ 'type' => 'dropdown',
67
+ 'options' => array(
68
+ 'icon' => 'Icon',
69
+ 'image' => 'Image',
70
+ ),
71
+ 'theme_reset' => true,
72
+ ),
73
+ ),
74
+ ),
75
+ array(
76
+ 'id' => 'wc-shortcodes-options-social-media-configure-section',
77
+ 'add_section' => true,
78
+ 'title' => 'Customize',
79
+ 'options' => $this->get_social_icons_options(),
80
+ ),
81
+ ),
82
+ ),
83
+ array(
84
+ 'id' => 'wc-shortcodes-options-share-buttons-options-tab',
85
+ 'title' => 'Share Buttons',
86
+ 'sections' => array(
87
+ array(
88
+ 'id' => 'wc-shortcodes-options-share-buttons-display-section',
89
+ 'add_section' => true, // Add a new section? Or does it already exists?
90
+ 'title' => 'Display',
91
+ 'options' => array(
92
+ array(
93
+ 'option_name' => 'share_buttons_display',
94
+ 'title' => 'Order / Show / Hide',
95
+ 'default' => parent::$share_buttons,
96
+ 'description' => '',
97
+ 'type' => 'order_show_hide',
98
+ 'callback' => array( &$this, 'sanitize_share_buttons' ),
99
+ ),
100
+ array(
101
+ 'option_name' => 'share_buttons_format',
102
+ 'title' => 'Format',
103
+ 'default' => parent::$theme_support['share_buttons_format'],
104
+ 'description' => '',
105
+ 'type' => 'dropdown',
106
+ 'options' => array(
107
+ 'icon' => 'Icon',
108
+ 'image' => 'Image',
109
+ 'icon-text' => 'Icon + Text',
110
+ 'text' => 'Text',
111
+ ),
112
+ 'theme_reset' => true,
113
+ ),
114
+ array(
115
+ 'option_name' => 'share_buttons_on_post_page',
116
+ 'title' => 'Post Page',
117
+ 'default' => parent::$theme_support['share_buttons_on_post_page'],
118
+ 'description' => '',
119
+ 'label' => 'Add share buttons to the bottom of your post pages',
120
+ 'type' => 'checkbox',
121
+ 'theme_reset' => true,
122
+ 'hide' => parent::$theme_support['share_buttons_filter_disable'],
123
+ ),
124
+ array(
125
+ 'option_name' => 'share_buttons_on_blog_page',
126
+ 'title' => 'Blog Page',
127
+ 'default' => parent::$theme_support['share_buttons_on_blog_page'],
128
+ 'description' => '',
129
+ 'label' => 'Add share buttons to the bottom of your posts in your blog',
130
+ 'type' => 'checkbox',
131
+ 'theme_reset' => true,
132
+ 'hide' => parent::$theme_support['share_buttons_filter_disable'],
133
+ ),
134
+ array(
135
+ 'option_name' => 'share_buttons_on_archive_page',
136
+ 'title' => 'Archive Page',
137
+ 'default' => parent::$theme_support['share_buttons_on_archive_page'],
138
+ 'description' => '',
139
+ 'label' => 'Add share buttons to the bottom of your posts in your category, tag, date, and author archive pages.',
140
+ 'type' => 'checkbox',
141
+ 'theme_reset' => true,
142
+ 'hide' => parent::$theme_support['share_buttons_filter_disable'],
143
+ ),
144
+ array(
145
+ 'option_name' => 'share_buttons_on_product_page',
146
+ 'title' => 'Product Page',
147
+ 'default' => parent::$theme_support['share_buttons_on_product_page'],
148
+ 'description' => '',
149
+ 'label' => 'Add share buttons to the bottom of your WooCommerce product page.',
150
+ 'type' => 'checkbox',
151
+ 'theme_reset' => true,
152
+ 'hide' => parent::$theme_support['share_buttons_filter_disable'],
153
+ ),
154
+ ),
155
+ ),
156
+ array(
157
+ 'id' => 'wc-shortcodes-options-share-buttons-configure-section',
158
+ 'add_section' => true,
159
+ 'title' => 'Customize',
160
+ 'options' => $this->get_share_buttons_options(),
161
+ ),
162
+ ),
163
+ ),
164
+ array(
165
+ 'id' => 'wc-shortcodes-options-rsvp-options-tab',
166
+ 'title' => 'RSVP',
167
+ 'sections' => array(
168
+ array(
169
+ 'id' => 'wc-shortcodes-options-rsvp-section',
170
+ 'add_section' => true,
171
+ 'title' => 'RSVP',
172
+ 'options' => array(
173
+ array(
174
+ 'option_name' => 'rsvp_email',
175
+ 'title' => 'Email To',
176
+ 'default' => $admin_email,
177
+ 'description' => 'Send RSVP notification to the email address above. Separate multiple emails with a comma.',
178
+ 'type' => 'emails',
179
+ ),
180
+ array(
181
+ 'option_name' => 'rsvp_email_title',
182
+ 'title' => 'Email Title',
183
+ 'default' => 'New RSVP - ' .get_bloginfo('title'),
184
+ 'description' => 'The subject tile of your email you will receive',
185
+ 'type' => 'input',
186
+ ),
187
+ array(
188
+ 'option_name' => 'rsvp_success_message',
189
+ 'title' => 'Success Message',
190
+ 'default' => 'Thanks for attending! We will see you at our wedding.',
191
+ 'description' => 'The message to display after a user successfully RSVP\'d',
192
+ 'type' => 'input',
193
+ ),
194
+ ),
195
+ ),
196
+ array(
197
+ 'id' => 'wc-shortcodes-options-rsvp-name-section',
198
+ 'title' => 'Name',
199
+ 'add_section' => true,
200
+ 'options' => array(
201
+ array(
202
+ 'option_name' => 'rsvp_name_title',
203
+ 'title' => 'Title',
204
+ 'default' => 'Your Name',
205
+ 'description' => '',
206
+ 'type' => 'input',
207
+ ),
208
+ ),
209
+ ),
210
+ array(
211
+ 'id' => 'wc-shortcodes-options-rsvp-number-section',
212
+ 'title' => 'Number',
213
+ 'add_section' => true,
214
+ 'options' => array(
215
+ array(
216
+ 'option_name' => 'rsvp_number_title',
217
+ 'title' => 'Title',
218
+ 'default' => 'Number of Guests',
219
+ 'description' => '',
220
+ 'type' => 'input',
221
+ ),
222
+ array(
223
+ 'option_name' => 'rsvp_number_options',
224
+ 'title' => 'Options',
225
+ 'default' => $number_options,
226
+ 'description' => '',
227
+ 'type' => 'textarea',
228
+ ),
229
+ ),
230
+ ),
231
+ array(
232
+ 'id' => 'wc-shortcodes-options-rsvp-event-section',
233
+ 'title' => 'Event',
234
+ 'add_section' => true,
235
+ 'options' => array(
236
+ array(
237
+ 'option_name' => 'rsvp_event_title',
238
+ 'title' => 'Title',
239
+ 'default' => 'You Will Attend...',
240
+ 'description' => '',
241
+ 'type' => 'input',
242
+ ),
243
+ array(
244
+ 'option_name' => 'rsvp_event_options',
245
+ 'title' => 'Options',
246
+ 'default' => $event_options,
247
+ 'description' => '',
248
+ 'type' => 'textarea',
249
+ ),
250
+ ),
251
+ ),
252
+ array(
253
+ 'id' => 'wc-shortcodes-options-rsvp-button-section',
254
+ 'title' => 'Button',
255
+ 'add_section' => true,
256
+ 'options' => array(
257
+ array(
258
+ 'option_name' => 'rsvp_button_title',
259
+ 'title' => 'Title',
260
+ 'default' => 'I Am Attending',
261
+ 'description' => '',
262
+ 'type' => 'input',
263
+ ),
264
+ ),
265
+ ),
266
+ ),
267
+ ),
268
+ array(
269
+ 'id' => 'wc-shortcodes-options-google-maps-options-tab',
270
+ 'title' => 'Maps',
271
+ 'sections' => array(
272
+ array(
273
+ 'id' => 'wc-shortcodes-options-google-maps-section',
274
+ 'title' => 'Google Maps',
275
+ 'add_section' => true,
276
+ 'options' => array(
277
+ array(
278
+ 'option_name' => 'google_maps_api_key',
279
+ 'title' => 'Google Maps API Key',
280
+ 'default' => '',
281
+ 'description' => 'Google requires an <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">API key</a> to embed Google Maps.',
282
+ 'type' => 'input',
283
+ ),
284
+ ),
285
+ ),
286
+ ),
287
+ ),
288
+ array(
289
+ 'id' => 'wc-misc-options-tab',
290
+ 'title' => 'Misc',
291
+ 'sections' => array(
292
+ array(
293
+ 'id' => 'wc-misc-options-section',
294
+ 'add_section' => true, // Add a new section? Or does it already exists?
295
+ 'title' => 'Miscellaneous Options',
296
+ 'options' => array(
297
+ array(
298
+ 'option_name' => 'enable_shortcode_css',
299
+ 'title' => 'Shortcode CSS',
300
+ 'default' => '1',
301
+ 'description' => '',
302
+ 'label' => 'Use shortcode CSS provided by plugin.',
303
+ 'type' => 'checkbox',
304
+ 'theme_reset' => true,
305
+ ),
306
+ array(
307
+ 'option_name' => 'enable_font_awesome',
308
+ 'title' => 'FontAwesome',
309
+ 'default' => '1',
310
+ 'description' => '',
311
+ 'label' => 'Use FontAwesome icons provided by plugin.',
312
+ 'type' => 'checkbox',
313
+ 'theme_reset' => true,
314
+ ),
315
+ array(
316
+ 'option_name' => 'enable_slide_post_type',
317
+ 'title' => 'Slide Post Type',
318
+ 'default' => '1',
319
+ 'description' => '',
320
+ 'label' => 'Create custom slides to use with our <code>[wc_post_slider]</code> shortcode.',
321
+ 'type' => 'checkbox',
322
+ 'theme_reset' => true,
323
+ ),
324
+ ),
325
+ ),
326
+ ),
327
+ ),
328
+ ),
329
+ );
330
+
331
+ return $options;
332
+ }
333
+
334
+ public function wpcsf_theme_support() {
335
+ return parent::$theme_support;
336
+ }
337
+
338
+ private function get_share_buttons_options() {
339
+ $options = array();
340
+ foreach ( parent::$share_buttons as $key => $value ) {
341
+ $options[] = array(
342
+ 'id' => $key . '-share',
343
+ 'title' => $value,
344
+ 'description' => '',
345
+ 'group' => array(
346
+ array(
347
+ 'option_name' => $key . '_share_text',
348
+ 'label' => 'Share Text',
349
+ 'default' => parent::$theme_support[ $key . '_share_text'],
350
+ 'description' => '',
351
+ 'type' => 'input',
352
+ 'theme_reset' => true,
353
+ ),
354
+ array(
355
+ 'option_name' => $key . '_share_font_icon',
356
+ 'label' => 'Font Icon',
357
+ 'default' => parent::$theme_support[ $key . '_share_font_icon'],
358
+ 'description' => '<a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">See All Icons</a>',
359
+ 'type' => 'input',
360
+ 'theme_reset' => true,
361
+ ),
362
+ array(
363
+ 'option_name' => $key . '_share_icon',
364
+ 'label' => 'Image Icon',
365
+ 'default' => parent::$theme_support[ $key . '_share_button'],
366
+ 'description' => '',
367
+ 'type' => 'image',
368
+ 'theme_reset' => true,
369
+ ),
370
+ ),
371
+ );
372
+ }
373
+
374
+ return $options;
375
+ }
376
+
377
+ private function get_social_icons_options() {
378
+ $options = array();
379
+ foreach ( parent::$social_icons as $key => $value ) {
380
+ $options[] = array(
381
+ 'id' => $key,
382
+ 'title' => $value,
383
+ 'description' => '',
384
+ 'group' => array(
385
+ array(
386
+ 'option_name' => $key . '_link',
387
+ 'label' => 'Link',
388
+ 'default' => '',
389
+ 'description' => '',
390
+ 'type' => 'input',
391
+ ),
392
+ array(
393
+ 'option_name' => $key . '_font_icon',
394
+ 'label' => 'Font Icon',
395
+ 'default' => parent::$theme_support[ $key . '_font_icon'],
396
+ 'description' => '<a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">See All Icons</a>',
397
+ 'type' => 'input',
398
+ 'theme_reset' => true,
399
+ ),
400
+ array(
401
+ 'option_name' => $key . '_icon',
402
+ 'label' => 'Image Icon',
403
+ 'default' => parent::$theme_support[ $key . '_social_icon'],
404
+ 'description' => '',
405
+ 'type' => 'image',
406
+ 'theme_reset' => true,
407
+ ),
408
+ ),
409
+ );
410
+ }
411
+
412
+ return $options;
413
+ }
414
+
415
+ public function sanitize_share_buttons( $value ) {
416
+
417
+ $whitelist = parent::$share_buttons;
418
+
419
+ $valid = array();
420
+
421
+ if ( ! is_array( $value ) || empty( $value ) )
422
+ return null;
423
+
424
+ foreach ( $value as $k => $v ) {
425
+ if ( array_key_exists( $k, $whitelist ) )
426
+ $valid[ $k ] = $v;
427
+ }
428
+
429
+ return $valid;
430
+ }
431
+
432
+ public function sanitize_social_icons( $value ) {
433
+
434
+ $whitelist = parent::$social_icons;
435
+
436
+ $valid = array();
437
+
438
+ if ( ! is_array( $value ) || empty( $value ) )
439
+ return null;
440
+
441
+ foreach ( $value as $k => $v ) {
442
+ if ( array_key_exists( $k, $whitelist ) )
443
+ $valid[ $k ] = $v;
444
+ }
445
+
446
+ return $valid;
447
+ }
448
+ }
admin/class-tinymce-buttons.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_TinyMCE_Buttons {
3
+ protected static $instance = null;
4
+
5
+ public static function get_instance() {
6
+
7
+ // If the single instance hasn't been set, set it now.
8
+ if ( null == self::$instance ) {
9
+ self::$instance = new self;
10
+ }
11
+
12
+ return self::$instance;
13
+ }
14
+
15
+ private function __construct() {
16
+ add_action( 'admin_head', array( &$this,'init' ) );
17
+ // add_action( 'admin_head', array( &$this, 'localize_script' ) );
18
+ }
19
+
20
+ public function init() {
21
+ if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
22
+ return;
23
+
24
+ if ( get_user_option('rich_editing') == 'true' ) {
25
+ // add_action('admin_enqueue_scripts', array( &$this, 'register_plugin_styles' ));
26
+
27
+ add_filter( 'mce_external_plugins', array( &$this, 'add_plugin' ) );
28
+ add_filter( 'mce_buttons', array( &$this,'register_button' ) );
29
+ }
30
+ }
31
+
32
+ public function localize_script() {
33
+ global $wc_shortcodes_theme_support;
34
+
35
+ ?>
36
+ <script type="text/javascript">
37
+ var wpc_shortcodes = <?php echo json_encode( $wc_shortcodes_theme_support ); ?>;
38
+ </script>
39
+ <?php
40
+ }
41
+
42
+ public function add_plugin($plugin_array) {
43
+ global $wp_version;
44
+ $ver = WC_SHORTCODES_VERSION;
45
+
46
+ // version 3.9 updated to tinymce 4.0
47
+ if ( version_compare( $wp_version, '3.9', '>=' ) ) {
48
+ $plugin_array['wpc_shortcodes'] = WC_SHORTCODES_PLUGIN_URL .'admin/assets/js/shortcodes-tinymce-4.js?ver=' . $ver;
49
+ $plugin_array['wpc_font_awesome'] = WC_SHORTCODES_PLUGIN_URL .'admin/assets/js/font-awesome-tinymce-4.js?ver=' . $ver;
50
+ }
51
+ else {
52
+ $plugin_array['wpc_shortcodes'] = WC_SHORTCODES_PLUGIN_URL .'admin/assets/js/shortcodes_tinymce.js?ver=' . $ver;
53
+ $plugin_array['wpc_font_awesome'] = WC_SHORTCODES_PLUGIN_URL .'admin/assets/js/font_awesome_tinymce.js?ver=' . $ver;
54
+ }
55
+ return $plugin_array;
56
+ }
57
+
58
+ public function register_button($buttons) {
59
+ array_push($buttons, "wpc_shortcodes_button");
60
+ array_push($buttons, 'wpcfontAwesomeGlyphSelect');
61
+
62
+ return $buttons;
63
+ }
64
+
65
+ public function register_plugin_styles() {
66
+ global $wp_styles;
67
+
68
+ wp_enqueue_style('wc-font-awesome-styles', WC_SHORTCODES_PLUGIN_URL . 'includes/css/font-awesome.css', array(), WC_SHORTCODES_VERSION, 'all');
69
+ }
70
+ }
includes/ajax.php DELETED
@@ -1,208 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * webpm_send_email
5
- *
6
- * Ajax function to send email without
7
- * reloading the page.
8
- *
9
- * @access public
10
- * @return void
11
- */
12
- function wc_shortcodes_send_rsvp_email() {
13
- // get the submitted parameters
14
- $error = array();
15
- $emailSent = false;
16
- $message = array();
17
-
18
- $email_to = get_option( WC_SHORTCODES_PREFIX . 'rsvp_email');
19
- $email_title = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_email_title') );
20
- $email_success_message = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_success_message') );
21
- $email_success_message = empty( $email_success_message ) ? 'Message Sent' : $email_success_message;
22
-
23
- $admin_email = get_option('admin_email');
24
- if ( empty( $email_to ) ) {
25
- $email_to = $admin_email;
26
- }
27
-
28
- $email_to = sanitize_email( $email_to );
29
- $email_title = sanitize_text_field( $email_to );
30
- $email_success_message = sanitize_text_field( $email_to );
31
-
32
- $rsvp_name = trim( sanitize_text_field( $_POST['rsvp_name'] ) );
33
- if ( $rsvp_name === '') {
34
- $error[] = 'Please enter your name.';
35
- $hasError = true;
36
- } else {
37
- $message[] = 'Name: ' . esc_html( $rsvp_name );
38
- }
39
-
40
- $rsvp_number = trim( sanitize_text_field( $_POST['rsvp_number'] ) );
41
- if ( $rsvp_number === '') {
42
- $error[] = 'Please select a number.';
43
- $hasError = true;
44
- } else {
45
- $message[] = 'Number: ' . esc_html( $rsvp_number );
46
- }
47
-
48
- $rsvp_event = trim( sanitize_text_field( $_POST['rsvp_event'] ) );
49
- if ( $rsvp_event === '') {
50
- $error[] = 'Please select event.';
51
- $hasError = true;
52
- } else {
53
- $message[] = 'Event: ' . esc_html( $rsvp_event );
54
- }
55
-
56
- $status = trim(implode("<br />", $error));
57
-
58
- if ( empty( $error ) ) {
59
- $subject = $email_title;
60
- $name = $rsvp_name;
61
- $body = implode( "\n\n", $message );
62
- $body .= "\n\n\n\nThis message was sent through the contact form via ".get_bloginfo('url');
63
- $headers = "From: " . $admin_email . "\r\n";
64
-
65
- wp_mail($email_to, $subject, $body, $headers);
66
- $emailSent = true;
67
- $status = $email_success_message;
68
- }
69
-
70
- // generate the response
71
- $response = json_encode( array( 'success' => (int) $emailSent, 'message' => $status ) );
72
-
73
- // response output
74
- header( "Content-Type: application/json" );
75
- echo $response;
76
-
77
- // IMPORTANT: don't forget to "exit"
78
- exit;
79
- }
80
- // send email when logged out
81
- add_action( 'wp_ajax_nopriv_wc-send-rsvp-email', 'wc_shortcodes_send_rsvp_email' );
82
- // send email when logged in
83
- add_action( 'wp_ajax_wc-send-rsvp-email', 'wc_shortcodes_send_rsvp_email' );
84
-
85
- function wc_shortcodes_post_lookup_callback() {
86
- global $wpdb; //get access to the WordPress database object variable
87
-
88
- //get names of all businesses
89
- $request = '%' . $wpdb->esc_like( stripslashes( sanitize_text_field( $_POST['request'] ) ) ) . '%'; //escape for use in LIKE statement
90
- $post_type = stripslashes( sanitize_text_field( $_POST['post_type'] ) );
91
-
92
- $sql = "
93
- select
94
- ID,
95
- post_title
96
- from
97
- $wpdb->posts
98
- where
99
- post_title like %s
100
- and post_type='%s'
101
- and post_status='publish'
102
- order by
103
- post_title ASC
104
- limit
105
- 0,30
106
- ";
107
-
108
- $sql = $wpdb->prepare($sql, $request, $post_type);
109
-
110
- $results = $wpdb->get_results($sql);
111
-
112
- //copy the business titles to a simple array
113
- $titles = array();
114
- $i = 0;
115
- foreach( $results as $r ) {
116
- $titles[ $i ][ 'label' ] = $r->post_title . " (" . $r->ID . ")";
117
- $titles[ $i ][ 'value' ] = $r->ID;
118
- $i++;
119
- }
120
-
121
- if ( empty( $titles ) ) {
122
- $titles[0]['label'] = "No results found in post type \"$post_type\".";
123
- $titles[0]['value'] = "0";
124
- }
125
-
126
- echo json_encode($titles); //encode into JSON format and output
127
-
128
- die(); //stop "0" from being output
129
- }
130
- add_action( 'wp_ajax_wc_post_lookup', 'wc_shortcodes_post_lookup_callback' );
131
-
132
- function wc_shortcodes_terms_lookup_callback() {
133
- global $wpdb; //get access to the WordPress database object variable
134
-
135
- //get names of all businesses
136
- $request = '%' . $wpdb->esc_like( stripslashes( sanitize_text_field( $_POST['request'] ) ) ) . '%'; //escape for use in LIKE statement
137
- $post_type = stripslashes( sanitize_text_field( $_POST['post_type'] ) );
138
- $taxonomy = stripslashes( sanitize_text_field( $_POST['taxonomy'] ) );
139
-
140
- if ( empty( $taxonomy ) ) {
141
- $titles = array();
142
- $titles[0]['label'] = "Please select a taxonomy.";
143
- $titles[0]['value'] = "0";
144
-
145
- echo json_encode($titles); //encode into JSON format and output
146
-
147
- die(); //stop "0" from being output
148
- }
149
-
150
- $sql = "
151
- SELECT
152
- t.slug,
153
- t.slug
154
- FROM $wpdb->terms AS t
155
- INNER JOIN $wpdb->term_taxonomy AS tt ON (tt.term_id = t.term_id)
156
- INNER JOIN $wpdb->term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
157
- WHERE t.slug like %s
158
- AND tt.taxonomy IN ('%s')
159
- GROUP BY
160
- t.slug
161
- ORDER BY
162
- t.name ASC
163
- limit
164
- 0,30
165
- ";
166
-
167
- $sql = $wpdb->prepare($sql, $request, $taxonomy);
168
-
169
- $results = $wpdb->get_results($sql);
170
-
171
- //copy the business titles to a simple array
172
- $titles = array();
173
- $i = 0;
174
- foreach( $results as $r ) {
175
- $titles[ $i ]['label'] = $r->slug;
176
- $titles[ $i ]['value'] = $r->slug;
177
- $i++;
178
- }
179
-
180
- if ( empty( $titles ) ) {
181
- $titles[0]['label'] = "No results found in selected taxonomy \"$taxonomy\".";
182
- $titles[0]['value'] = "0";
183
- }
184
-
185
- echo json_encode($titles); //encode into JSON format and output
186
-
187
- die(); //stop "0" from being output
188
- }
189
- add_action( 'wp_ajax_wc_terms_lookup', 'wc_shortcodes_terms_lookup_callback' );
190
-
191
- function wc_shortcodes_mce_popup() {
192
-
193
- // no need to sanitize here.
194
- $tag = $_POST['tag'];
195
- $shortcode = stripslashes( $_POST['shortcode'] );
196
-
197
- $attr = wc_shortcodes_parse_shortcode( $tag, $shortcode );
198
-
199
- switch ( $tag ) {
200
- case 'wc_post_slider' :
201
- $widget = new WC_Shortcodes_Post_Slider_Widget();
202
- $widget->form( $attr );
203
- break;
204
- }
205
-
206
- die();
207
- }
208
- add_action( 'wp_ajax_wc_mce_popup', 'wc_shortcodes_mce_popup' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions.php DELETED
@@ -1,418 +0,0 @@
1
- <?php
2
- function wc_shortcodes_check_supports() {
3
- global $wc_shortcodes_theme_support;
4
-
5
- if ( current_theme_supports( 'wpc-shortcodes' ) ) {
6
- $supports = get_theme_support( 'wpc-shortcodes' );
7
-
8
- if ( isset( $supports[0] ) && is_array( $supports[0] ) ) {
9
- foreach ( $supports[0] as $key => $value ) {
10
- $wc_shortcodes_theme_support[ $key ] = $value;
11
- }
12
- }
13
- }
14
- }
15
- add_action( 'init', 'wc_shortcodes_check_supports' );
16
-
17
- function wc_shortcodes_add_action_links( $links ) {
18
- return array_merge(
19
- array(
20
- 'settings' => '<a href="' . admin_url( 'themes.php?page=wc-shortcodes' ) . '">' . __( 'Settings', 'wc-shortcodes' ) . '</a>'
21
- ),
22
- $links
23
- );
24
- }
25
- add_filter( 'plugin_action_links_' . WC_SHORTCODES_PLUGIN_BASENAME, 'wc_shortcodes_add_action_links' );
26
-
27
- /**
28
- * filter social url. For example, we want to add
29
- * mailto: to an email address.
30
- *
31
- * @access public
32
- * @return void
33
- */
34
- function wc_shortcodes_smart_social_link( $social_link, $name ) {
35
- switch ( $name ) {
36
- case 'email' :
37
- // some users may have already inserted mailto:, so let's remove it.
38
- if ( is_email( $social_link ) ) {
39
- $social_link = str_replace( 'mailto:', '', $social_link );
40
- $social_link = 'mailto:'.$social_link;
41
- }
42
- break;
43
- default :
44
- $social_link = esc_url( $social_link );
45
- break;
46
- }
47
-
48
- return $social_link;
49
- }
50
- add_filter( 'wc_shortcodes_social_link' , 'wc_shortcodes_smart_social_link', 10, 2 );
51
-
52
- function wc_shortcodes_default_social_icons() {
53
- global $wc_shortcodes_social_icons;
54
-
55
- $default = $wc_shortcodes_social_icons;
56
-
57
- foreach ( $wc_shortcodes_social_icons as $key => $value ) {
58
- $link_option_name = WC_SHORTCODES_PREFIX . $key . '_link';
59
- $icon_option_name = WC_SHORTCODES_PREFIX . $key . '_icon';
60
-
61
- if ( $icon_url = get_option( $icon_option_name ) ) {
62
- $social_link = get_option( $link_option_name );
63
-
64
- if ( empty( $social_link ) )
65
- unset( $default[ $key ] );
66
- }
67
- }
68
-
69
- if ( empty( $default ) ) {
70
- $default = $wc_shortcodes_social_icons;
71
- }
72
-
73
- return $default;
74
- }
75
-
76
- if ( ! function_exists( 'wc_shortcodes_display_term_classes' ) ) {
77
- function wc_shortcodes_display_term_classes( $taxonomy ) {
78
- global $post;
79
-
80
- $classes = array();
81
-
82
- if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
83
- foreach ( (array) wp_get_post_terms( $post->ID, $taxonomy ) as $term ) {
84
- if ( empty( $term->slug ) )
85
- continue;
86
- $classes[] = 'wc-shortcodes-filter-' . sanitize_html_class($term->slug, $term->term_id);
87
- }
88
- }
89
-
90
- return $classes;
91
- }
92
- }
93
-
94
- if ( ! function_exists( 'wc_shortcodes_comma_delim_to_array' ) ) {
95
- function wc_shortcodes_comma_delim_to_array( $string ) {
96
- $a = explode( ',', $string );
97
-
98
- foreach ( $a as $key => $value ) {
99
- $value = trim( $value );
100
-
101
- if ( empty( $value ) )
102
- unset( $a[ $key ] );
103
- else
104
- $a[ $key ] = $value;
105
- }
106
-
107
- if ( empty( $a ) )
108
- return '';
109
- else
110
- return $a;
111
- }
112
- }
113
-
114
- function wc_shortcodes_body_class( $classes ) {
115
- if ( WC_SHORTCODES_FONT_AWESOME_ENABLED )
116
- $classes[] = 'wc-shortcodes-font-awesome-enabled';
117
-
118
- return $classes;
119
- }
120
- add_filter( 'body_class', 'wc_shortcodes_body_class' );
121
-
122
- function wc_shortcodes_add_filters_for_custom_content() {
123
- add_filter( 'wc_shortcodes_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
124
- add_filter( 'wc_shortcodes_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
125
- add_filter( 'wc_shortcodes_the_content', 'wptexturize' );
126
- add_filter( 'wc_shortcodes_the_content', 'convert_smilies' );
127
- add_filter( 'wc_shortcodes_the_content', 'convert_chars' );
128
- add_filter( 'wc_shortcodes_the_content', 'wpautop' );
129
- add_filter( 'wc_shortcodes_the_content', 'shortcode_unautop' );
130
- add_filter( 'wc_shortcodes_the_content', 'prepend_attachment' );
131
- add_filter( 'wc_shortcodes_the_content', 'do_shortcode', 11 ); // AFTER wpautop()
132
-
133
- add_filter( 'wc_shortcodes_get_the_excerpt', 'wc_shortcodes_wp_trim_excerpt' );
134
-
135
- add_filter( 'wc_shortcodes_the_excerpt', 'wptexturize' );
136
- add_filter( 'wc_shortcodes_the_excerpt', 'convert_smilies' );
137
- add_filter( 'wc_shortcodes_the_excerpt', 'convert_chars' );
138
- add_filter( 'wc_shortcodes_the_excerpt', 'wpautop' );
139
- add_filter( 'wc_shortcodes_the_excerpt', 'shortcode_unautop');
140
- }
141
- add_action( 'init', 'wc_shortcodes_add_filters_for_custom_content' );
142
-
143
- function wc_shortcodes_the_media_content( $more_link_text = null, $strip_teaser = false ) {
144
- $content = get_the_content( $more_link_text, $strip_teaser );
145
-
146
- $pieces = explode( "\n", $content );
147
-
148
- $content = '';
149
-
150
- foreach ( $pieces as $line ) {
151
- if ( empty( $line ) ) {
152
- continue;
153
- }
154
-
155
- if ( preg_match( '|^\s*(https?://[^\s"]+)\s*$|im', $line ) ) {
156
- $content = $line;
157
- break;
158
- }
159
- else if ( has_shortcode( $line, 'audio' ) ) {
160
- $content = $line;
161
- break;
162
- }
163
- else if ( has_shortcode( $line, 'video' ) ) {
164
- $content = $line;
165
- break;
166
- }
167
- }
168
-
169
- /**
170
- * Filter the post content.
171
- *
172
- * @since 0.71
173
- *
174
- * @param string $content Content of the current post.
175
- */
176
- $content = apply_filters( 'wc_shortcodes_the_content', $content );
177
- $content = str_replace( ']]>', ']]&gt;', $content );
178
- echo $content;
179
- }
180
-
181
- function wc_shortcodes_the_content( $more_link_text = null, $strip_teaser = false ) {
182
- $content = get_the_content( $more_link_text, $strip_teaser );
183
-
184
- /**
185
- * Filter the post content.
186
- *
187
- * @since 0.71
188
- *
189
- * @param string $content Content of the current post.
190
- */
191
- $content = apply_filters( 'wc_shortcodes_the_content', $content );
192
- $content = str_replace( ']]>', ']]&gt;', $content );
193
- echo $content;
194
- }
195
-
196
- function wc_shortcodes_the_excerpt() {
197
- $excerpt = wc_shortcodes_get_the_excerpt();
198
-
199
- /**
200
- * Filter the post content.
201
- *
202
- * @since 0.71
203
- *
204
- * @param string $content Content of the current post.
205
- */
206
- $excerpt = apply_filters( 'wc_shortcodes_the_excerpt', $excerpt );
207
- echo $excerpt;
208
- }
209
-
210
- function wc_shortcodes_get_the_excerpt( $deprecated = '' ) {
211
- if ( !empty( $deprecated ) )
212
- _deprecated_argument( __FUNCTION__, '2.3' );
213
-
214
- $post = get_post();
215
-
216
- if ( post_password_required() ) {
217
- return __( 'There is no excerpt because this is a protected post.' );
218
- }
219
-
220
- /**
221
- * Filter the retrieved post excerpt.
222
- *
223
- * @since 1.2.0
224
- *
225
- * @param string $post_excerpt The post excerpt.
226
- */
227
- return apply_filters( 'wc_shortcodes_get_the_excerpt', $post->post_excerpt );
228
- }
229
-
230
- /**
231
- * Generates an excerpt from the content, if needed.
232
- *
233
- * The excerpt word amount will be 55 words and if the amount is greater than
234
- * that, then the string ' [&hellip;]' will be appended to the excerpt. If the string
235
- * is less than 55 words, then the content will be returned as is.
236
- *
237
- * The 55 word limit can be modified by plugins/themes using the excerpt_length filter
238
- * The ' [&hellip;]' string can be modified by plugins/themes using the excerpt_more filter
239
- *
240
- * @since 1.5.0
241
- *
242
- * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
243
- * @return string The excerpt.
244
- */
245
- function wc_shortcodes_wp_trim_excerpt($text = '') {
246
- global $wc_shortcodes_posts_query;
247
-
248
- $excerpt_length = 55;
249
- if ( isset( $wc_shortcodes_posts_query->excerpt_length ) && ! empty( $wc_shortcodes_posts_query->excerpt_length ) ) {
250
- $excerpt_length = (int) $wc_shortcodes_posts_query->excerpt_length;
251
- }
252
-
253
- $raw_excerpt = $text;
254
- if ( '' == $text ) {
255
- $text = get_the_content('');
256
-
257
- $text = strip_shortcodes( $text );
258
-
259
- /** This filter is documented in wp-includes/post-template.php */
260
- $text = apply_filters( 'wc_shortcodes_the_content', $text );
261
- $text = str_replace(']]>', ']]&gt;', $text);
262
-
263
- /**
264
- * Filter the number of words in an excerpt.
265
- *
266
- * @since 2.7.0
267
- *
268
- * @param int $number The number of words. Default 55.
269
- */
270
- $excerpt_length = apply_filters( 'wc_shortcodes_excerpt_length', $excerpt_length );
271
- /**
272
- * Filter the string in the "more" link displayed after a trimmed excerpt.
273
- *
274
- * @since 2.9.0
275
- *
276
- * @param string $more_string The string shown within the more link.
277
- */
278
- $excerpt_more = apply_filters( 'wc_shortcodes_excerpt_more', '&hellip;' );
279
- $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
280
- }
281
- /**
282
- * Filter the trimmed excerpt string.
283
- *
284
- * @since 2.8.0
285
- *
286
- * @param string $text The trimmed text.
287
- * @param string $raw_excerpt The text prior to trimming.
288
- */
289
- return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
290
- }
291
-
292
- function wc_shortcodes_echo_share_buttons() {
293
- $share = do_shortcode( '[wc_share_buttons]' );
294
-
295
- if ( ! empty( $share ) ) {
296
- echo $share;
297
- }
298
- }
299
- function wc_shortcodes_display_share_buttons( $content ) {
300
- global $wp_current_filter;
301
-
302
- $display = false;
303
-
304
- if ( is_single() && 'post' == get_post_type() ) {
305
- $display = true;
306
- }
307
- else if ( ( is_home() || is_archive() ) && 'post' == get_post_type() ) {
308
- $display = true;
309
- }
310
- // Don't output flair on excerpts
311
- if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
312
- $display = false;
313
- }
314
-
315
- if ( ! $display ) {
316
- return $content;
317
- }
318
-
319
- $share = do_shortcode( '[wc_share_buttons]' );
320
- $share = apply_filters( 'wc_shortcodes_display_share_buttons', $share );
321
-
322
- if ( empty( $share ) ) {
323
- return $content;
324
- }
325
-
326
- $content .= $share;
327
-
328
- return $content;
329
- }
330
- function wc_shortcodes_share_buttons_filters() {
331
- global $wc_shortcodes_theme_support;
332
-
333
- if ( $wc_shortcodes_theme_support[ 'share_buttons_filter_disable' ] ) {
334
- return;
335
- }
336
-
337
- $share_buttons_on_post_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_post_page' );
338
- $share_buttons_on_blog_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_blog_page' );
339
- $share_buttons_on_archive_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_archive_page' );
340
- $share_buttons_on_product_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_product_page' );
341
-
342
- if ( $share_buttons_on_post_page ) {
343
- if ( is_single() && 'post' == get_post_type() ) {
344
- add_filter( 'the_content', 'wc_shortcodes_display_share_buttons', 38, 1 );
345
- }
346
- }
347
-
348
- if ( $share_buttons_on_blog_page ) {
349
- if ( is_home() ) {
350
- add_filter( 'the_content', 'wc_shortcodes_display_share_buttons', 38, 1 );
351
- // add_filter( 'the_excerpt', 'wc_shortcodes_display_share_buttons', 38, 1 );
352
- }
353
- }
354
-
355
- if ( $share_buttons_on_archive_page ) {
356
- if ( is_category() || is_tag() || is_author() || is_date() ) {
357
- add_filter( 'the_content', 'wc_shortcodes_display_share_buttons', 38, 1 );
358
- // add_filter( 'the_excerpt', 'wc_shortcodes_display_share_buttons', 38, 1 );
359
- }
360
- }
361
-
362
- if ( $share_buttons_on_product_page ) {
363
- add_action( 'woocommerce_single_product_summary', 'wc_shortcodes_echo_share_buttons', 99 );
364
- }
365
-
366
- }
367
- add_action( 'wp', 'wc_shortcodes_share_buttons_filters', 11 );
368
-
369
- function wc_shortcodes_get_posted_category() {
370
- $html = null;
371
- $cats = get_the_category_list( ', ' );
372
-
373
- if ( ! empty( $cats ) ) {
374
- $html .= '<div class="wc-shortcodes-entry-category">';
375
- if ( ! empty( $cats ) ) {
376
- $html .= '<span class="wc-shortcodes-cat-posted-text">' . __( 'Posted in', 'wpcanvas2' ) . ' </span><span class="wc-shortcodes-post-in-cat-links">' . $cats . '</span>';
377
- }
378
- $html .= '</div>';
379
- }
380
-
381
- return $html;
382
- }
383
-
384
- function wc_shortcodes_parse_shortcode( $check_tag, $content ) {
385
- global $shortcode_tags;
386
-
387
- if ( false === strpos( $content, '[' ) ) {
388
- return false;
389
- }
390
-
391
- if (empty($shortcode_tags) || !is_array($shortcode_tags))
392
- return false;
393
-
394
- // Find all registered tag names in $content.
395
- preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
396
- $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
397
-
398
- if ( empty( $tagnames ) ) {
399
- return false;
400
- }
401
-
402
- $pattern = get_shortcode_regex( $tagnames );
403
- preg_match( "/$pattern/", $content, $m );
404
-
405
- // allow [[foo]] syntax for escaping a tag
406
- if ( $m[1] == '[' && $m[6] == ']' ) {
407
- return substr($m[0], 1, -1);
408
- }
409
-
410
- $tag = $m[2];
411
-
412
- if ( $tag != $check_tag )
413
- return false;
414
-
415
- $attr = shortcode_parse_atts( $m[3] );
416
-
417
- return $attr;
418
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/mce/js/images/shortcodes.png DELETED
Binary file
includes/mce/shortcodes_tinymce.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- class WC_Shortcodes_TinyMCE_Buttons {
3
- function __construct() {
4
- add_action( 'admin_head', array(&$this,'init') );
5
- // add_action( 'admin_head', array( &$this, 'localize_script' ) );
6
- }
7
- function init() {
8
- if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
9
- return;
10
-
11
- if ( get_user_option('rich_editing') == 'true' ) {
12
- // add_action('admin_enqueue_scripts', array(&$this, 'register_plugin_styles'));
13
-
14
- add_filter( 'mce_external_plugins', array(&$this, 'add_plugin') );
15
- add_filter( 'mce_buttons', array(&$this,'register_button') );
16
- }
17
- }
18
- function localize_script() {
19
- global $wc_shortcodes_theme_support;
20
-
21
- ?>
22
- <script type="text/javascript">
23
- var wpc_shortcodes = <?php echo json_encode( $wc_shortcodes_theme_support ); ?>;
24
- </script>
25
- <?php
26
- }
27
- function add_plugin($plugin_array) {
28
- global $wp_version;
29
- $ver = WC_SHORTCODES_VERSION;
30
-
31
- // version 3.9 updated to tinymce 4.0
32
- if ( version_compare( $wp_version, '3.9', '>=' ) ) {
33
- $plugin_array['wpc_shortcodes'] = plugin_dir_url( __FILE__ ) .'js/shortcodes-tinymce-4.js?ver=' . $ver;
34
- $plugin_array['wpc_font_awesome'] = plugin_dir_url( __FILE__ ) .'js/font-awesome-tinymce-4.js?ver=' . $ver;
35
- }
36
- else {
37
- $plugin_array['wpc_shortcodes'] = plugin_dir_url( __FILE__ ) .'js/shortcodes_tinymce.js?ver=' . $ver;
38
- $plugin_array['wpc_font_awesome'] = plugin_dir_url( __FILE__ ) .'js/font_awesome_tinymce.js?ver=' . $ver;
39
- }
40
- return $plugin_array;
41
- }
42
- function register_button($buttons) {
43
- array_push($buttons, "wpc_shortcodes_button");
44
- array_push($buttons, 'wpcfontAwesomeGlyphSelect');
45
-
46
- return $buttons;
47
- }
48
- function register_plugin_styles() {
49
- global $wp_styles;
50
-
51
- wp_enqueue_style('wc-font-awesome-styles', WC_SHORTCODES_PLUGIN_URL . 'includes/css/font-awesome.css', array(), WC_SHORTCODES_VERSION, 'all');
52
- }
53
- }
54
- $wcshortcode = new WC_Shortcodes_TinyMCE_Buttons;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/options.php DELETED
@@ -1,417 +0,0 @@
1
- <?php
2
- function wc_shortcodes_options( $options ) {
3
- global $wc_shortcodes_share_buttons;
4
- global $wc_shortcodes_social_icons;
5
- global $wc_shortcodes_theme_support;
6
-
7
- // RSVP
8
- $number_options = "1\n2\n3\n4\n5";
9
- $event_options = "All Events\nMain Ceremony\nWedding Party";
10
- $admin_email = get_option( 'admin_email' );
11
-
12
- // page
13
- $menu_slug = 'wc-shortcodes';
14
-
15
- // Option
16
- $options[ $menu_slug ] = array(
17
- 'parent_slug' => 'themes.php',
18
- 'page_title' => 'Shortcodes',
19
- 'menu_title' => 'Shortcodes',
20
- 'capability' => 'manage_options',
21
- 'option_group' => 'wc-shortcodes-options-group',
22
- 'tabs' => array(
23
- array(
24
- 'id' => 'wc-shortcodes-options-social-media-options-tab',
25
- 'title' => 'Social Media',
26
- 'sections' => array(
27
- array(
28
- 'id' => 'wc-shortcodes-options-social-media-display-section',
29
- 'add_section' => true, // Add a new section? Or does it already exists?
30
- 'title' => 'Display',
31
- 'options' => array(
32
- array(
33
- 'option_name' => 'social_icons_display',
34
- 'title' => 'Order / Show / Hide',
35
- 'default' => $wc_shortcodes_social_icons,
36
- 'description' => '',
37
- 'type' => 'order_show_hide',
38
- 'callback' => 'wc_shortcodes_sanitize_social_icons',
39
- ),
40
- array(
41
- 'option_name' => 'social_icons_format',
42
- 'title' => 'Format',
43
- 'default' => $wc_shortcodes_theme_support['social_icons_format'],
44
- 'description' => '',
45
- 'type' => 'dropdown',
46
- 'options' => array(
47
- 'icon' => 'Icon',
48
- 'image' => 'Image',
49
- ),
50
- 'theme_reset' => true,
51
- ),
52
- ),
53
- ),
54
- array(
55
- 'id' => 'wc-shortcodes-options-social-media-configure-section',
56
- 'add_section' => true,
57
- 'title' => 'Customize',
58
- 'options' => wc_shortcodes_get_social_icons_options(),
59
- ),
60
- ),
61
- ),
62
- array(
63
- 'id' => 'wc-shortcodes-options-share-buttons-options-tab',
64
- 'title' => 'Share Buttons',
65
- 'sections' => array(
66
- array(
67
- 'id' => 'wc-shortcodes-options-share-buttons-display-section',
68
- 'add_section' => true, // Add a new section? Or does it already exists?
69
- 'title' => 'Display',
70
- 'options' => array(
71
- array(
72
- 'option_name' => 'share_buttons_display',
73
- 'title' => 'Order / Show / Hide',
74
- 'default' => $wc_shortcodes_share_buttons,
75
- 'description' => '',
76
- 'type' => 'order_show_hide',
77
- 'callback' => 'wc_shortcodes_sanitize_share_buttons',
78
- ),
79
- array(
80
- 'option_name' => 'share_buttons_format',
81
- 'title' => 'Format',
82
- 'default' => $wc_shortcodes_theme_support['share_buttons_format'],
83
- 'description' => '',
84
- 'type' => 'dropdown',
85
- 'options' => array(
86
- 'icon' => 'Icon',
87
- 'image' => 'Image',
88
- 'icon-text' => 'Icon + Text',
89
- 'text' => 'Text',
90
- ),
91
- 'theme_reset' => true,
92
- ),
93
- array(
94
- 'option_name' => 'share_buttons_on_post_page',
95
- 'title' => 'Post Page',
96
- 'default' => $wc_shortcodes_theme_support['share_buttons_on_post_page'],
97
- 'description' => '',
98
- 'label' => 'Add share buttons to the bottom of your post pages',
99
- 'type' => 'checkbox',
100
- 'theme_reset' => true,
101
- 'hide' => $wc_shortcodes_theme_support['share_buttons_filter_disable'],
102
- ),
103
- array(
104
- 'option_name' => 'share_buttons_on_blog_page',
105
- 'title' => 'Blog Page',
106
- 'default' => $wc_shortcodes_theme_support['share_buttons_on_blog_page'],
107
- 'description' => '',
108
- 'label' => 'Add share buttons to the bottom of your posts in your blog',
109
- 'type' => 'checkbox',
110
- 'theme_reset' => true,
111
- 'hide' => $wc_shortcodes_theme_support['share_buttons_filter_disable'],
112
- ),
113
- array(
114
- 'option_name' => 'share_buttons_on_archive_page',
115
- 'title' => 'Archive Page',
116
- 'default' => $wc_shortcodes_theme_support['share_buttons_on_archive_page'],
117
- 'description' => '',
118
- 'label' => 'Add share buttons to the bottom of your posts in your category, tag, date, and author archive pages.',
119
- 'type' => 'checkbox',
120
- 'theme_reset' => true,
121
- 'hide' => $wc_shortcodes_theme_support['share_buttons_filter_disable'],
122
- ),
123
- array(
124
- 'option_name' => 'share_buttons_on_product_page',
125
- 'title' => 'Product Page',
126
- 'default' => $wc_shortcodes_theme_support['share_buttons_on_product_page'],
127
- 'description' => '',
128
- 'label' => 'Add share buttons to the bottom of your WooCommerce product page.',
129
- 'type' => 'checkbox',
130
- 'theme_reset' => true,
131
- 'hide' => $wc_shortcodes_theme_support['share_buttons_filter_disable'],
132
- ),
133
- ),
134
- ),
135
- array(
136
- 'id' => 'wc-shortcodes-options-share-buttons-configure-section',
137
- 'add_section' => true,
138
- 'title' => 'Customize',
139
- 'options' => wc_shortcodes_get_share_buttons_options(),
140
- ),
141
- ),
142
- ),
143
- array(
144
- 'id' => 'wc-shortcodes-options-rsvp-options-tab',
145
- 'title' => 'RSVP',
146
- 'sections' => array(
147
- array(
148
- 'id' => 'wc-shortcodes-options-rsvp-section',
149
- 'add_section' => true,
150
- 'title' => 'RSVP',
151
- 'options' => array(
152
- array(
153
- 'option_name' => 'rsvp_email',
154
- 'title' => 'Email To',
155
- 'default' => $admin_email,
156
- 'description' => 'Send RSVP notification to the email address above. Separate multiple emails with a comma.',
157
- 'type' => 'emails',
158
- ),
159
- array(
160
- 'option_name' => 'rsvp_email_title',
161
- 'title' => 'Email Title',
162
- 'default' => 'New RSVP - ' .get_bloginfo('title'),
163
- 'description' => 'The subject tile of your email you will receive',
164
- 'type' => 'input',
165
- ),
166
- array(
167
- 'option_name' => 'rsvp_success_message',
168
- 'title' => 'Success Message',
169
- 'default' => 'Thanks for attending! We will see you at our wedding.',
170
- 'description' => 'The message to display after a user successfully RSVP\'d',
171
- 'type' => 'input',
172
- ),
173
- ),
174
- ),
175
- array(
176
- 'id' => 'wc-shortcodes-options-rsvp-name-section',
177
- 'title' => 'Name',
178
- 'add_section' => true,
179
- 'options' => array(
180
- array(
181
- 'option_name' => 'rsvp_name_title',
182
- 'title' => 'Title',
183
- 'default' => 'Your Name',
184
- 'description' => '',
185
- 'type' => 'input',
186
- ),
187
- ),
188
- ),
189
- array(
190
- 'id' => 'wc-shortcodes-options-rsvp-number-section',
191
- 'title' => 'Number',
192
- 'add_section' => true,
193
- 'options' => array(
194
- array(
195
- 'option_name' => 'rsvp_number_title',
196
- 'title' => 'Title',
197
- 'default' => 'Number of Guests',
198
- 'description' => '',
199
- 'type' => 'input',
200
- ),
201
- array(
202
- 'option_name' => 'rsvp_number_options',
203
- 'title' => 'Options',
204
- 'default' => $number_options,
205
- 'description' => '',
206
- 'type' => 'textarea',
207
- ),
208
- ),
209
- ),
210
- array(
211
- 'id' => 'wc-shortcodes-options-rsvp-event-section',
212
- 'title' => 'Event',
213
- 'add_section' => true,
214
- 'options' => array(
215
- array(
216
- 'option_name' => 'rsvp_event_title',
217
- 'title' => 'Title',
218
- 'default' => 'You Will Attend...',
219
- 'description' => '',
220
- 'type' => 'input',
221
- ),
222
- array(
223
- 'option_name' => 'rsvp_event_options',
224
- 'title' => 'Options',
225
- 'default' => $event_options,
226
- 'description' => '',
227
- 'type' => 'textarea',
228
- ),
229
- ),
230
- ),
231
- array(
232
- 'id' => 'wc-shortcodes-options-rsvp-button-section',
233
- 'title' => 'Button',
234
- 'add_section' => true,
235
- 'options' => array(
236
- array(
237
- 'option_name' => 'rsvp_button_title',
238
- 'title' => 'Title',
239
- 'default' => 'I Am Attending',
240
- 'description' => '',
241
- 'type' => 'input',
242
- ),
243
- ),
244
- ),
245
- ),
246
- ),
247
- array(
248
- 'id' => 'wc-misc-options-tab',
249
- 'title' => 'Misc',
250
- 'sections' => array(
251
- array(
252
- 'id' => 'wc-misc-options-section',
253
- 'add_section' => true, // Add a new section? Or does it already exists?
254
- 'title' => 'Miscellaneous Options',
255
- 'options' => array(
256
- array(
257
- 'option_name' => 'enable_shortcode_css',
258
- 'title' => 'Shortcode CSS',
259
- 'default' => '1',
260
- 'description' => '',
261
- 'label' => 'Use shortcode CSS provided by plugin.',
262
- 'type' => 'checkbox',
263
- 'theme_reset' => true,
264
- ),
265
- array(
266
- 'option_name' => 'enable_font_awesome',
267
- 'title' => 'FontAwesome',
268
- 'default' => '1',
269
- 'description' => '',
270
- 'label' => 'Use FontAwesome icons provided by plugin.',
271
- 'type' => 'checkbox',
272
- 'theme_reset' => true,
273
- ),
274
- array(
275
- 'option_name' => 'enable_slide_post_type',
276
- 'title' => 'Slide Post Type',
277
- 'default' => '1',
278
- 'description' => '',
279
- 'label' => 'Create custom slides to use with our <code>[wc_post_slider]</code> shortcode.',
280
- 'type' => 'checkbox',
281
- 'theme_reset' => true,
282
- ),
283
- ),
284
- ),
285
- ),
286
- ),
287
- ),
288
- );
289
-
290
- return $options;
291
- }
292
- add_filter( 'wc_shortcodes_wpcsf_options', 'wc_shortcodes_options', 10, 1 );
293
-
294
- function wc_shortcodes_theme_support() {
295
- global $wc_shortcodes_theme_support;
296
-
297
- return $wc_shortcodes_theme_support;
298
- }
299
- add_filter( 'wc_shortcodes_wpcsf_theme_support', 'wc_shortcodes_theme_support', 10, 1 );
300
-
301
- function wc_shortcodes_get_share_buttons_options() {
302
- global $wc_shortcodes_theme_support;
303
- global $wc_shortcodes_share_buttons;
304
-
305
- $options = array();
306
- foreach ( $wc_shortcodes_share_buttons as $key => $value ) {
307
- $options[] = array(
308
- 'id' => $key . '-share',
309
- 'title' => $value,
310
- 'description' => '',
311
- 'group' => array(
312
- array(
313
- 'option_name' => $key . '_share_text',
314
- 'label' => 'Share Text',
315
- 'default' => $wc_shortcodes_theme_support[ $key . '_share_text'],
316
- 'description' => '',
317
- 'type' => 'input',
318
- 'theme_reset' => true,
319
- ),
320
- array(
321
- 'option_name' => $key . '_share_font_icon',
322
- 'label' => 'Font Icon',
323
- 'default' => $wc_shortcodes_theme_support[ $key . '_share_font_icon'],
324
- 'description' => '<a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">See All Icons</a>',
325
- 'type' => 'input',
326
- 'theme_reset' => true,
327
- ),
328
- array(
329
- 'option_name' => $key . '_share_icon',
330
- 'label' => 'Image Icon',
331
- 'default' => $wc_shortcodes_theme_support[ $key . '_share_button'],
332
- 'description' => '',
333
- 'type' => 'image',
334
- 'theme_reset' => true,
335
- ),
336
- ),
337
- );
338
- }
339
-
340
- return $options;
341
- }
342
- function wc_shortcodes_get_social_icons_options() {
343
- global $wc_shortcodes_theme_support;
344
- global $wc_shortcodes_social_icons;
345
-
346
- $options = array();
347
- foreach ( $wc_shortcodes_social_icons as $key => $value ) {
348
- $options[] = array(
349
- 'id' => $key,
350
- 'title' => $value,
351
- 'description' => '',
352
- 'group' => array(
353
- array(
354
- 'option_name' => $key . '_link',
355
- 'label' => 'Link',
356
- 'default' => '',
357
- 'description' => '',
358
- 'type' => 'input',
359
- ),
360
- array(
361
- 'option_name' => $key . '_font_icon',
362
- 'label' => 'Font Icon',
363
- 'default' => $wc_shortcodes_theme_support[ $key . '_font_icon'],
364
- 'description' => '<a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">See All Icons</a>',
365
- 'type' => 'input',
366
- 'theme_reset' => true,
367
- ),
368
- array(
369
- 'option_name' => $key . '_icon',
370
- 'label' => 'Image Icon',
371
- 'default' => $wc_shortcodes_theme_support[ $key . '_social_icon'],
372
- 'description' => '',
373
- 'type' => 'image',
374
- 'theme_reset' => true,
375
- ),
376
- ),
377
- );
378
- }
379
-
380
- return $options;
381
- }
382
-
383
- function wc_shortcodes_sanitize_share_buttons( $value ) {
384
- global $wc_shortcodes_share_buttons;
385
-
386
- $whitelist = $wc_shortcodes_share_buttons;
387
-
388
- $valid = array();
389
-
390
- if ( ! is_array( $value ) || empty( $value ) )
391
- return null;
392
-
393
- foreach ( $value as $k => $v ) {
394
- if ( array_key_exists( $k, $whitelist ) )
395
- $valid[ $k ] = $v;
396
- }
397
-
398
- return $valid;
399
- }
400
-
401
- function wc_shortcodes_sanitize_social_icons( $value ) {
402
- global $wc_shortcodes_social_icons;
403
-
404
- $whitelist = $wc_shortcodes_social_icons;
405
-
406
- $valid = array();
407
-
408
- if ( ! is_array( $value ) || empty( $value ) )
409
- return null;
410
-
411
- foreach ( $value as $k => $v ) {
412
- if ( array_key_exists( $k, $whitelist ) )
413
- $valid[ $k ] = $v;
414
- }
415
-
416
- return $valid;
417
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/post-types.php DELETED
@@ -1,227 +0,0 @@
1
- <?php
2
- /**
3
- * File for registering custom post types.
4
- *
5
- * @package WC Custom Post Types
6
- * @since 1.1
7
- * @author Chris Baldelomar <chris@webplantmedia.com>
8
- * @copyright Copyright (c) 2013, Chris Baldelomar
9
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
- */
11
-
12
- /**
13
- * Registers post types needed by the plugin.
14
- *
15
- * @since 0.1.0
16
- * @access public
17
- * @return void
18
- */
19
- function wc_shortcodes_register_post_types() {
20
-
21
- /* Set up the arguments for the slider item post type. */
22
- $args = array(
23
- 'description' => '',
24
- 'public' => false,
25
- 'publicly_queryable' => false,
26
- 'show_in_nav_menus' => false,
27
- 'show_in_admin_bar' => true,
28
- 'exclude_from_search' => true,
29
- 'show_ui' => true,
30
- 'show_in_menu' => true,
31
- 'menu_position' => 11,
32
- 'menu_icon' => 'dashicons-images-alt2',
33
- 'can_export' => true,
34
- 'delete_with_user' => false,
35
- 'hierarchical' => false,
36
- 'has_archive' => false,
37
- 'query_var' => false,
38
- 'register_meta_box_cb' => 'wc_shortcodes_slide_metabox',
39
-
40
- /* The rewrite handles the URL structure. */
41
- 'rewrite' => false,
42
-
43
- /* What features the post type supports. */
44
- 'supports' => array(
45
- 'title',
46
- 'editor',
47
- 'thumbnail',
48
- 'page-attributes',
49
- ),
50
-
51
- /* Labels used when displaying the posts. */
52
- 'labels' => array(
53
- 'name' => __( 'Slider Items', 'wc-shortcodes' ),
54
- 'singular_name' => __( 'Slider Item', 'wc-shortcodes' ),
55
- 'menu_name' => __( 'Slider', 'wc-shortcodes' ),
56
- 'name_admin_bar' => __( 'Slider Item', 'wc-shortcodes' ),
57
- 'add_new' => __( 'Add New', 'wc-shortcodes' ),
58
- 'add_new_item' => __( 'Add New Slider Item', 'wc-shortcodes' ),
59
- 'edit_item' => __( 'Edit Slider Item', 'wc-shortcodes' ),
60
- 'new_item' => __( 'New Slider Item', 'wc-shortcodes' ),
61
- 'view_item' => __( 'View Slider Item', 'wc-shortcodes' ),
62
- 'search_items' => __( 'Search Slider', 'wc-shortcodes' ),
63
- 'not_found' => __( 'No slider items found', 'wc-shortcodes' ),
64
- 'not_found_in_trash' => __( 'No slider items found in trash', 'wc-shortcodes' ),
65
- 'all_items' => __( 'Slider Items', 'wc-shortcodes' ),
66
-
67
- // Custom labels b/c WordPress doesn't have anything to handle this.
68
- 'archive_title' => __( 'Slider', 'wc-shortcodes' ),
69
- )
70
- );
71
-
72
- /* Register the slider item post type. */
73
- register_post_type( 'wcs_slide', $args );
74
- }
75
- /* Register custom post types on the 'init' hook. */
76
- add_action( 'init', 'wc_shortcodes_register_post_types' );
77
-
78
- /**
79
- * Register taxonomies for the plugin.
80
- *
81
- * @since 0.1.0
82
- * @access public
83
- * @return void.
84
- */
85
- function wc_shortcodes_register_taxonomies() {
86
-
87
- /* Set up the arguments for the slider taxonomy. */
88
- $args = array(
89
- 'public' => false,
90
- 'show_ui' => true,
91
- 'show_in_nav_menus' => false,
92
- 'show_tagcloud' => false,
93
- 'show_admin_column' => true,
94
- 'hierarchical' => true,
95
- 'query_var' => false,
96
-
97
- /* The rewrite handles the URL structure. */
98
- 'rewrite' => false,
99
-
100
- /* Labels used when displaying taxonomy and terms. */
101
- 'labels' => array(
102
- 'name' => __( 'Slider Categories', 'wc-shortcodes' ),
103
- 'singular_name' => __( 'Slider Category', 'wc-shortcodes' ),
104
- 'menu_name' => __( 'Categories', 'wc-shortcodes' ),
105
- 'name_admin_bar' => __( 'Slider Category', 'wc-shortcodes' ),
106
- 'search_items' => __( 'Search Slider Categories', 'wc-shortcodes' ),
107
- 'popular_items' => __( 'Popular Slider Categories', 'wc-shortcodes' ),
108
- 'all_items' => __( 'All Slider Categories', 'wc-shortcodes' ),
109
- 'edit_item' => __( 'Edit Slider Category', 'wc-shortcodes' ),
110
- 'view_item' => __( 'View Slider Category', 'wc-shortcodes' ),
111
- 'update_item' => __( 'Update Slider Category', 'wc-shortcodes' ),
112
- 'add_new_item' => __( 'Add New Slider Category', 'wc-shortcodes' ),
113
- 'new_item_name' => __( 'New Slider Category Name', 'wc-shortcodes' ),
114
- 'separate_items_with_commas' => __( 'Separate slider categories with commas', 'wc-shortcodes' ),
115
- 'add_or_remove_items' => __( 'Add or remove slider categories', 'wc-shortcodes' ),
116
- 'choose_from_most_used' => __( 'Choose from the most used slider categories', 'wc-shortcodes' ),
117
- )
118
- );
119
-
120
- /* Register the 'slider' taxonomy. */
121
- register_taxonomy( 'wcs_slide_cat', array( 'wcs_slide' ), $args );
122
-
123
- /* Set up the arguments for the slider taxonomy. */
124
- $args = array(
125
- 'public' => false,
126
- 'show_ui' => true,
127
- 'show_in_nav_menus' => false,
128
- 'show_tagcloud' => false,
129
- 'show_admin_column' => true,
130
- 'hierarchical' => false,
131
- 'query_var' => 'slider_tag',
132
-
133
- /* The rewrite handles the URL structure. */
134
- 'rewrite' => false,
135
-
136
- /* Labels used when displaying taxonomy and terms. */
137
- 'labels' => array(
138
- 'name' => __( 'Slider Tags', 'wc-shortcodes' ),
139
- 'singular_name' => __( 'Slider Tag', 'wc-shortcodes' ),
140
- 'menu_name' => __( 'Tags', 'wc-shortcodes' ),
141
- 'name_admin_bar' => __( 'Slider Tag', 'wc-shortcodes' ),
142
- 'search_items' => __( 'Search Slider Tags', 'wc-shortcodes' ),
143
- 'popular_items' => __( 'Popular Slider Tags', 'wc-shortcodes' ),
144
- 'all_items' => __( 'All Slider Tags', 'wc-shortcodes' ),
145
- 'edit_item' => __( 'Edit Slider Tag', 'wc-shortcodes' ),
146
- 'view_item' => __( 'View Slider Tag', 'wc-shortcodes' ),
147
- 'update_item' => __( 'Update Slider Tag', 'wc-shortcodes' ),
148
- 'add_new_item' => __( 'Add New Slider Tag', 'wc-shortcodes' ),
149
- 'new_item_name' => __( 'New Slider Tag Name', 'wc-shortcodes' ),
150
- 'separate_items_with_commas' => __( 'Separate slider tags with commas', 'wc-shortcodes' ),
151
- 'add_or_remove_items' => __( 'Add or remove slider tags', 'wc-shortcodes' ),
152
- 'choose_from_most_used' => __( 'Choose from the most used slider tags', 'wc-shortcodes' ),
153
- )
154
- );
155
-
156
- /* Register the 'slider' taxonomy. */
157
- register_taxonomy( 'wcs_slide_tag', array( 'wcs_slide' ), $args );
158
- }
159
- /* Register taxonomies on the 'init' hook. */
160
- add_action( 'init', 'wc_shortcodes_register_taxonomies' );
161
-
162
- function wc_shortcodes_save_meta($post_id, $post) {
163
-
164
- if ( ! isset( $_POST['slidedetails_noncename'] ) ) {
165
- return;
166
- }
167
-
168
- // verify this came from the our screen and with proper authorization,
169
- // because save_post can be triggered at other times
170
- if ( ! wp_verify_nonce( $_POST['slidedetails_noncename'], plugin_basename(__FILE__) )) {
171
- return $post->ID;
172
- }
173
-
174
- // Is the user allowed to edit the post or page?
175
- if ( !current_user_can( 'edit_post', $post->ID ))
176
- return $post->ID;
177
-
178
- // OK, we're authenticated: we need to find and save the data
179
- // We'll put it into an array to make it easier to loop though.
180
-
181
- $meta['_wc_shortcodes_slide_url'] = esc_url_raw( $_POST['_wc_shortcodes_slide_url'] );
182
-
183
- // Add values of $events_meta as custom fields
184
-
185
- foreach ( $meta as $key => $value ) { // Cycle through the $events_meta array!
186
- if( $post->post_type == 'revision' ) {
187
- // Don't store custom data twice
188
- return;
189
- }
190
-
191
- // $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
192
-
193
- if ( get_post_meta( $post->ID, $key, false ) ) {
194
- // If the custom field already has a value
195
- update_post_meta( $post->ID, $key, $value );
196
- } else {
197
- // If the custom field doesn't have a value
198
- add_post_meta( $post->ID, $key, $value );
199
- }
200
- if( ! $value ) {
201
- delete_post_meta( $post->ID, $key ); // Delete if blank
202
- }
203
- }
204
-
205
- }
206
-
207
- add_action('save_post', 'wc_shortcodes_save_meta', 1, 2); // save the custom fields
208
-
209
- function wc_shortcodes_slide_details() {
210
- global $post;
211
-
212
- // Noncename needed to verify where the data originated
213
- echo '<input type="hidden" name="slidedetails_noncename" id="slidedetails_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
214
-
215
- // Get the location data if its already been entered
216
- $url = get_post_meta($post->ID, '_wc_shortcodes_slide_url', true);
217
-
218
- echo '<p><strong>Enter URL:</strong></p>';
219
- echo '<input type="text" name="_wc_shortcodes_slide_url" value="' . $url . '" class="widefat" />';
220
- }
221
-
222
- function wc_shortcodes_slide_metabox() {
223
- add_meta_box('wc-shortcodes-slide-metabox', 'Slide Details', 'wc_shortcodes_slide_details', 'wcs_slide', 'normal', 'high');
224
- }
225
- add_action( 'add_meta_boxes', 'wc_shortcodes_slide_metabox' );
226
-
227
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/scripts.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
- if( ! function_exists('wc_shortcodes_scripts') ) :
3
- function wc_shortcodes_scripts() {
4
- $ver = WC_SHORTCODES_VERSION;
5
-
6
- if ( get_option( WC_SHORTCODES_PREFIX . 'enable_shortcode_css', true ) ) {
7
- wp_enqueue_style( 'wc-shortcodes-style', plugin_dir_url( __FILE__ ) . 'css/style.css', array( ), $ver );
8
- }
9
-
10
- wp_enqueue_script('jquery');
11
- wp_register_script( 'wc-shortcodes-tabs', plugin_dir_url( __FILE__ ) . 'js/tabs.js', array ( 'jquery' ), $ver, true );
12
- wp_register_script( 'wc-shortcodes-toggle', plugin_dir_url( __FILE__ ) . 'js/toggle.js', 'jquery', $ver, true );
13
- wp_register_script( 'wc-shortcodes-accordion', plugin_dir_url( __FILE__ ) . 'js/accordion.js', array ( 'jquery' ), $ver, true );
14
- wp_register_script( 'wc-shortcodes-prettify', plugin_dir_url( __FILE__ ) . 'js/prettify.js', array ( ), $ver, true );
15
- wp_register_script( 'wc-shortcodes-pre', plugin_dir_url( __FILE__ ) . 'js/pre.js', array ( 'jquery' ), $ver, true );
16
- wp_register_script( 'wc-shortcodes-googlemap', plugin_dir_url( __FILE__ ) . 'js/googlemap.js', array('jquery'), $ver, true);
17
- wp_register_script( 'wc-shortcodes-googlemap-api', 'https://maps.googleapis.com/maps/api/js?sensor=false', array('jquery'), $ver, true);
18
- wp_register_script( 'wc-shortcodes-skillbar', plugin_dir_url( __FILE__ ) . 'js/skillbar.js', array ( 'jquery' ), $ver, true );
19
- wp_register_script( 'wc-shortcodes-fullwidth', plugin_dir_url( __FILE__ ) . 'js/fullwidth.js', array ( 'jquery' ), $ver, true );
20
-
21
- // Masonry
22
- wp_enqueue_script( 'jquery-masonry' );
23
-
24
- // images loaded
25
- wp_register_script( 'wordpresscanvas-imagesloaded', plugin_dir_url( __FILE__ ) . 'js/imagesloaded.pkgd.min.js', array (), '4.1.0', true );
26
-
27
- // slider
28
- wp_register_script( 'wordpresscanvas-rslides', plugin_dir_url( __FILE__ ) . 'js/responsiveslides.min.js', array ( 'jquery' ), '1.54', true );
29
- wp_register_style( 'wc-shortcodes-bxslider', plugin_dir_url( __FILE__ ) . 'vendors/bxslider/jquery.bxslider.min.css', array( ), '4.2.5' );
30
- wp_register_script( 'wc-shortcodes-bxslider', plugin_dir_url( __FILE__ ) . 'vendors/bxslider/jquery.bxslider.min.js', array ( 'jquery' ), '4.2.5', true );
31
- wp_register_script( 'wc-shortcodes-post-slider', plugin_dir_url( __FILE__ ) . 'js/post-slider.js', array ( 'jquery' ), $ver, true );
32
-
33
- // posts
34
- wp_register_script( 'wc-shortcodes-posts', plugin_dir_url( __FILE__ ) . 'js/posts.js', array ( 'jquery', 'wordpresscanvas-rslides', 'jquery-masonry', 'wordpresscanvas-imagesloaded' ), $ver, true );
35
- wp_register_script( 'wc-shortcodes-posts-grid', plugin_dir_url( __FILE__ ) . 'js/posts-grid.js', array ( 'jquery', 'wordpresscanvas-rslides' ), $ver, true );
36
-
37
- // countdown
38
- wp_register_script( 'wc-shortcodes-jquery-countdown-js', plugin_dir_url( __FILE__ ) . 'js/jquery.countdown.js', array ( 'jquery' ), $ver, true );
39
- wp_register_script( 'wc-shortcodes-countdown', plugin_dir_url( __FILE__ ) . 'js/countdown.js', array ( 'wc-shortcodes-jquery-countdown-js' ), $ver, true );
40
-
41
- // rsvp
42
- wp_register_script( 'wc-shortcodes-rsvp', plugin_dir_url( __FILE__ ) . 'js/rsvp.js', array ( 'jquery' ), $ver, true );
43
-
44
- $local = array(
45
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
46
- );
47
-
48
- wp_localize_script( 'wc-shortcodes-rsvp', 'WCShortcodes', $local );
49
- wp_enqueue_script( 'wc-shortcodes-rsvp' );
50
- }
51
- add_action('wp_enqueue_scripts', 'wc_shortcodes_scripts');
52
- endif;
53
-
54
- if( ! function_exists('wc_shortcodes_scripts_override') ) :
55
- function wc_shortcodes_scripts_override() {
56
-
57
- if ( WC_SHORTCODES_FONT_AWESOME_ENABLED ) {
58
- wp_deregister_style( 'wordpresscanvas-font-awesome' );
59
- wp_register_style( 'wordpresscanvas-font-awesome', plugin_dir_url( __FILE__ ) . 'css/font-awesome.min.css', array( ), '4.6.3' );
60
- wp_enqueue_style( 'wordpresscanvas-font-awesome' );
61
- }
62
-
63
- /* if ( ! wp_script_is( 'pinit', 'registered' ) ) {
64
- wp_register_script( 'pinit', '//assets.pinterest.com/js/pinit.js', array(), false, true);
65
- } */
66
- }
67
- add_action('wp_enqueue_scripts', 'wc_shortcodes_scripts_override', 9999 );
68
- endif;
69
-
70
- function wc_shortcodes_admin_enqueue_scripts( $hook ) {
71
- $ver = WC_SHORTCODES_VERSION;
72
-
73
- if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'widgets.php' ) {
74
- wp_enqueue_style( 'wc-shortcodes-admin-style', plugin_dir_url( __FILE__ ) . 'admin/css/wc-shortcodes.css', array( ), $ver );
75
- wp_enqueue_style( 'wc-shortcodes-post-slider-widget-style', plugin_dir_url( __FILE__ ) . 'admin/css/wcpostsliderwidget.css', array( ), $ver );
76
- wp_enqueue_script( 'wc-shortcodes-post-slider-widget', plugin_dir_url( __FILE__ ) . 'admin/js/wcpostsliderwidget.js', array ( 'jquery', 'jquery-ui-autocomplete', 'jquery-ui-accordion' ), $ver, true );
77
- wp_enqueue_script( 'wc-shortcodes', plugin_dir_url( __FILE__ ) . 'admin/js/wc-shortcodes.js', array ( 'jquery' ), $ver, true );
78
- }
79
- }
80
- add_action( 'admin_enqueue_scripts', 'wc_shortcodes_admin_enqueue_scripts' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendors/wpc-settings-framework/class-wpc-settings-framework.php CHANGED
@@ -17,7 +17,7 @@
17
  */
18
  class WC_Shortcodes_Settings_Framework {
19
 
20
- protected $version = '1.0.2';
21
 
22
  /**
23
  * Instance of this class.
@@ -67,17 +67,17 @@ class WC_Shortcodes_Settings_Framework {
67
 
68
  $this->set_slug_prefix();
69
 
70
- add_action( 'admin_init', array( $this, 'set_plugin_info' ) );
71
 
72
- add_action( 'init', array( $this, 'set_options' ), 100 );
73
- add_action( 'admin_init', array( $this, 'register_settings' ) );
74
- add_action( 'admin_init', array( $this, 'options_activation' ), 200 );
75
- // add_action( 'admin_init', array( $this, 'update_options' ), 200 ); // debug
76
- add_action( 'after_switch_theme', array( $this, 'update_options' ), 200 );
77
- add_action( 'admin_menu', array( $this, 'options_admin_menu' ) );
78
 
79
  // Load admin style sheet and JavaScript.
80
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
81
  }
82
 
83
  /**
@@ -316,7 +316,7 @@ class WC_Shortcodes_Settings_Framework {
316
  // add_settings_field( $id, $title, $callback, $page, $section, $args );
317
  // @page should match @menu_slug from add_theme_page
318
  // @section the section you added with add_settings_section
319
- add_settings_field($oo['id'], $oo['title'], array( $this, 'display_group' ), $menu_slug, $o['id'], $oo );
320
  }
321
  }
322
  else {
@@ -334,7 +334,7 @@ class WC_Shortcodes_Settings_Framework {
334
  // add_settings_field( $id, $title, $callback, $page, $section, $args );
335
  // @page should match @menu_slug from add_theme_page
336
  // @section the section you added with add_settings_section
337
- add_settings_field( $oo['option_name'], '<label for="'.$oo['option_name'].'">'.$oo['title'].'</label>' , array( $this, 'display_setting' ), $menu_slug, $o['id'], $oo );
338
  }
339
  }
340
  }
@@ -344,7 +344,7 @@ class WC_Shortcodes_Settings_Framework {
344
 
345
  public function get_callback( &$o ) {
346
  if ( isset( $o['callback'] ) && ! empty( $o['callback'] ) ) {
347
- if ( function_exists( $o['callback'] ) ) {
348
  return $o['callback'];
349
  }
350
  }
@@ -374,7 +374,7 @@ class WC_Shortcodes_Settings_Framework {
374
  isset( $v['capability'] ) &&
375
  isset( $v['option_group'] ) ) {
376
  // add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );
377
- $view_hook_name = add_submenu_page( $v['parent_slug'], $v['page_title'], $v['menu_title'], $v['capability'], $menu_slug, array( $this, 'display_page' ) );
378
  $this->views[ $view_hook_name ] = $menu_slug;
379
  }
380
  else if ( isset( $v['parent_slug'] ) ) {
17
  */
18
  class WC_Shortcodes_Settings_Framework {
19
 
20
+ protected $version = '1.0.4';
21
 
22
  /**
23
  * Instance of this class.
67
 
68
  $this->set_slug_prefix();
69
 
70
+ add_action( 'admin_init', array( &$this, 'set_plugin_info' ) );
71
 
72
+ add_action( 'init', array( &$this, 'set_options' ), 100 );
73
+ add_action( 'admin_init', array( &$this, 'register_settings' ) );
74
+ add_action( 'admin_init', array( &$this, 'options_activation' ), 200 );
75
+ // add_action( 'admin_init', array( &$this, 'update_options' ), 200 ); // debug
76
+ add_action( 'after_switch_theme', array( &$this, 'update_options' ), 200 );
77
+ add_action( 'admin_menu', array( &$this, 'options_admin_menu' ) );
78
 
79
  // Load admin style sheet and JavaScript.
80
+ add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue_admin_scripts' ) );
81
  }
82
 
83
  /**
316
  // add_settings_field( $id, $title, $callback, $page, $section, $args );
317
  // @page should match @menu_slug from add_theme_page
318
  // @section the section you added with add_settings_section
319
+ add_settings_field($oo['id'], $oo['title'], array( &$this, 'display_group' ), $menu_slug, $o['id'], $oo );
320
  }
321
  }
322
  else {
334
  // add_settings_field( $id, $title, $callback, $page, $section, $args );
335
  // @page should match @menu_slug from add_theme_page
336
  // @section the section you added with add_settings_section
337
+ add_settings_field( $oo['option_name'], '<label for="'.$oo['option_name'].'">'.$oo['title'].'</label>' , array( &$this, 'display_setting' ), $menu_slug, $o['id'], $oo );
338
  }
339
  }
340
  }
344
 
345
  public function get_callback( &$o ) {
346
  if ( isset( $o['callback'] ) && ! empty( $o['callback'] ) ) {
347
+ if ( is_callable( $o['callback'] ) ) {
348
  return $o['callback'];
349
  }
350
  }
374
  isset( $v['capability'] ) &&
375
  isset( $v['option_group'] ) ) {
376
  // add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );
377
+ $view_hook_name = add_submenu_page( $v['parent_slug'], $v['page_title'], $v['menu_title'], $v['capability'], $menu_slug, array( &$this, 'display_page' ) );
378
  $this->views[ $view_hook_name ] = $menu_slug;
379
  }
380
  else if ( isset( $v['parent_slug'] ) ) {
{includes → public/assets}/css/font-awesome.css RENAMED
File without changes
{includes → public/assets}/css/font-awesome.min.css RENAMED
File without changes
public/assets/css/public.css ADDED
File without changes
{includes → public/assets}/css/style.css RENAMED
File without changes
{includes → public/assets}/fonts/FontAwesome.otf RENAMED
File without changes
{includes → public/assets}/fonts/fontawesome-webfont.eot RENAMED
File without changes
{includes → public/assets}/fonts/fontawesome-webfont.svg RENAMED
File without changes
{includes → public/assets}/fonts/fontawesome-webfont.ttf RENAMED
File without changes
{includes → public/assets}/fonts/fontawesome-webfont.woff RENAMED
File without changes
{includes → public/assets}/fonts/fontawesome-webfont.woff2 RENAMED
File without changes
public/assets/img/blogger.png ADDED
Binary file
public/assets/img/bloglovin.png ADDED
Binary file
public/assets/img/circle-border.png ADDED
Binary file
public/assets/img/dash-border.png ADDED
Binary file
public/assets/img/email.png ADDED
Binary file
public/assets/img/etsy.png ADDED
Binary file
public/assets/img/facebook.png ADDED
Binary file
public/assets/img/flickr.png ADDED
Binary file
public/assets/img/flower.png ADDED
Binary file
public/assets/img/google.png ADDED
Binary file
public/assets/img/instagram.png ADDED
Binary file
public/assets/img/picasa.png ADDED
Binary file
public/assets/img/pinterest.png ADDED
Binary file
public/assets/img/print.png ADDED
Binary file
public/assets/img/rss.png ADDED
Binary file
public/assets/img/rustic-border.png ADDED
Binary file
public/assets/img/shopping.png ADDED
Binary file
public/assets/img/slide-arrow-left.png ADDED
Binary file
public/assets/img/slide-arrow-right.png ADDED
Binary file
public/assets/img/tumblr.png ADDED
Binary file
public/assets/img/twitter.png ADDED
Binary file
public/assets/img/vimeo.png ADDED
Binary file
public/assets/img/youtube.png ADDED
Binary file
{includes → public/assets}/js/accordion.js RENAMED
File without changes
{includes → public/assets}/js/countdown.js RENAMED
File without changes
{includes → public/assets}/js/fullwidth.js RENAMED
File without changes
{includes → public/assets}/js/googlemap.js RENAMED
File without changes
{includes → public/assets}/js/imagesloaded.pkgd.min.js RENAMED
File without changes
{includes → public/assets}/js/jquery.countdown.js RENAMED
File without changes
{includes → public/assets}/js/post-slider.js RENAMED
File without changes
{includes → public/assets}/js/posts-grid.js RENAMED
File without changes
{includes → public/assets}/js/posts.js RENAMED
File without changes
{includes → public/assets}/js/pre.js RENAMED
File without changes
{includes → public/assets}/js/prettify.js RENAMED
File without changes
public/assets/js/public.js ADDED
File without changes
{includes → public/assets}/js/responsiveslides.min.js RENAMED
File without changes
{includes → public/assets}/js/rsvp.js RENAMED
File without changes
{includes → public/assets}/js/skillbar.js RENAMED
File without changes
{includes → public/assets}/js/tabs.js RENAMED
File without changes
{includes → public/assets}/js/toggle.js RENAMED
File without changes
public/class-ajax-front.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_Ajax_Front {
3
+ protected static $instance = null;
4
+
5
+ public static function get_instance() {
6
+
7
+ // If the single instance hasn't been set, set it now.
8
+ if ( null == self::$instance ) {
9
+ self::$instance = new self;
10
+ }
11
+
12
+ return self::$instance;
13
+ }
14
+
15
+ private function __construct() {
16
+ // send email when logged out
17
+ add_action( 'wp_ajax_nopriv_wc-send-rsvp-email', array( &$this, 'send_rsvp_email' ) );
18
+ // send email when logged in
19
+ add_action( 'wp_ajax_wc-send-rsvp-email', array( &$this, 'send_rsvp_email' ) );
20
+ }
21
+
22
+ /**
23
+ * webpm_send_email
24
+ *
25
+ * Ajax function to send email without
26
+ * reloading the page.
27
+ *
28
+ * @access public
29
+ * @return void
30
+ */
31
+ public function send_rsvp_email() {
32
+ // get the submitted parameters
33
+ $error = array();
34
+ $emailSent = false;
35
+ $message = array();
36
+
37
+ $email_to = get_option( WC_SHORTCODES_PREFIX . 'rsvp_email');
38
+ $email_title = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_email_title') );
39
+ $email_success_message = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_success_message') );
40
+ $email_success_message = empty( $email_success_message ) ? 'Message Sent' : $email_success_message;
41
+
42
+ $admin_email = get_option('admin_email');
43
+ if ( empty( $email_to ) ) {
44
+ $email_to = $admin_email;
45
+ }
46
+
47
+ $email_to = sanitize_email( $email_to );
48
+ $email_title = sanitize_text_field( $email_to );
49
+ $email_success_message = sanitize_text_field( $email_to );
50
+
51
+ $rsvp_name = trim( sanitize_text_field( $_POST['rsvp_name'] ) );
52
+ if ( $rsvp_name === '') {
53
+ $error[] = 'Please enter your name.';
54
+ $hasError = true;
55
+ } else {
56
+ $message[] = 'Name: ' . esc_html( $rsvp_name );
57
+ }
58
+
59
+ $rsvp_number = trim( sanitize_text_field( $_POST['rsvp_number'] ) );
60
+ if ( $rsvp_number === '') {
61
+ $error[] = 'Please select a number.';
62
+ $hasError = true;
63
+ } else {
64
+ $message[] = 'Number: ' . esc_html( $rsvp_number );
65
+ }
66
+
67
+ $rsvp_event = trim( sanitize_text_field( $_POST['rsvp_event'] ) );
68
+ if ( $rsvp_event === '') {
69
+ $error[] = 'Please select event.';
70
+ $hasError = true;
71
+ } else {
72
+ $message[] = 'Event: ' . esc_html( $rsvp_event );
73
+ }
74
+
75
+ $status = trim(implode("<br />", $error));
76
+
77
+ if ( empty( $error ) ) {
78
+ $subject = $email_title;
79
+ $name = $rsvp_name;
80
+ $body = implode( "\n\n", $message );
81
+ $body .= "\n\n\n\nThis message was sent through the contact form via ".get_bloginfo('url');
82
+ $headers = "From: " . $admin_email . "\r\n";
83
+
84
+ wp_mail($email_to, $subject, $body, $headers);
85
+ $emailSent = true;
86
+ $status = $email_success_message;
87
+ }
88
+
89
+ // generate the response
90
+ $response = json_encode( array( 'success' => (int) $emailSent, 'message' => $status ) );
91
+
92
+ // response output
93
+ header( "Content-Type: application/json" );
94
+ echo $response;
95
+
96
+ // IMPORTANT: don't forget to "exit"
97
+ exit;
98
+ }
99
+ }
public/class-hooks.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_Hooks extends WPC_Shortcodes_Vars {
3
+ protected static $instance = null;
4
+ protected $sanitize = null;
5
+
6
+ public static function get_instance() {
7
+
8
+ // If the single instance hasn't been set, set it now.
9
+ if ( null == self::$instance ) {
10
+ self::$instance = new self;
11
+ }
12
+
13
+ return self::$instance;
14
+ }
15
+
16
+ private function __construct() {
17
+ add_filter( 'body_class', array( &$this, 'body_class' ) );
18
+ add_filter( 'wc_shortcodes_social_link' , array( &$this, 'smart_social_link' ), 10, 2 );
19
+ add_action( 'init', array( &$this, 'add_filters_for_custom_content' ) );
20
+ add_action( 'wp', array( &$this, 'share_buttons_filters' ), 11 );
21
+ }
22
+
23
+ function body_class( $classes ) {
24
+ if ( WC_SHORTCODES_FONT_AWESOME_ENABLED )
25
+ $classes[] = 'wc-shortcodes-font-awesome-enabled';
26
+
27
+ return $classes;
28
+ }
29
+
30
+ public function smart_social_link( $social_link, $name ) {
31
+ switch ( $name ) {
32
+ case 'email' :
33
+ // some users may have already inserted mailto:, so let's remove it.
34
+ if ( is_email( $social_link ) ) {
35
+ $social_link = str_replace( 'mailto:', '', $social_link );
36
+ $social_link = 'mailto:'.$social_link;
37
+ }
38
+ break;
39
+ default :
40
+ $social_link = esc_url( $social_link );
41
+ break;
42
+ }
43
+
44
+ return $social_link;
45
+ }
46
+
47
+ public function add_filters_for_custom_content() {
48
+ add_filter( 'wc_shortcodes_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
49
+ add_filter( 'wc_shortcodes_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
50
+ add_filter( 'wc_shortcodes_the_content', 'wptexturize' );
51
+ add_filter( 'wc_shortcodes_the_content', 'convert_smilies' );
52
+ add_filter( 'wc_shortcodes_the_content', 'convert_chars' );
53
+ add_filter( 'wc_shortcodes_the_content', 'wpautop' );
54
+ add_filter( 'wc_shortcodes_the_content', 'shortcode_unautop' );
55
+ add_filter( 'wc_shortcodes_the_content', 'prepend_attachment' );
56
+ add_filter( 'wc_shortcodes_the_content', 'do_shortcode', 11 ); // AFTER wpautop()
57
+
58
+ add_filter( 'wc_shortcodes_get_the_excerpt', 'wc_shortcodes_wp_trim_excerpt' );
59
+
60
+ add_filter( 'wc_shortcodes_the_excerpt', 'wptexturize' );
61
+ add_filter( 'wc_shortcodes_the_excerpt', 'convert_smilies' );
62
+ add_filter( 'wc_shortcodes_the_excerpt', 'convert_chars' );
63
+ add_filter( 'wc_shortcodes_the_excerpt', 'wpautop' );
64
+ add_filter( 'wc_shortcodes_the_excerpt', 'shortcode_unautop');
65
+ }
66
+
67
+ public function echo_share_buttons() {
68
+ $share = do_shortcode( '[wc_share_buttons]' );
69
+
70
+ if ( ! empty( $share ) ) {
71
+ echo $share;
72
+ }
73
+ }
74
+
75
+ public function display_share_buttons( $content ) {
76
+ global $wp_current_filter;
77
+
78
+ $display = false;
79
+
80
+ if ( is_single() && 'post' == get_post_type() ) {
81
+ $display = true;
82
+ }
83
+ else if ( ( is_home() || is_archive() ) && 'post' == get_post_type() ) {
84
+ $display = true;
85
+ }
86
+ // Don't output flair on excerpts
87
+ if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
88
+ $display = false;
89
+ }
90
+
91
+ if ( ! $display ) {
92
+ return $content;
93
+ }
94
+
95
+ $share = do_shortcode( '[wc_share_buttons]' );
96
+ $share = apply_filters( 'wc_shortcodes_display_share_buttons', $share );
97
+
98
+ if ( empty( $share ) ) {
99
+ return $content;
100
+ }
101
+
102
+ $content .= $share;
103
+
104
+ return $content;
105
+ }
106
+
107
+ function share_buttons_filters() {
108
+ if ( parent::$theme_support[ 'share_buttons_filter_disable' ] ) {
109
+ return;
110
+ }
111
+
112
+ $share_buttons_on_post_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_post_page' );
113
+ $share_buttons_on_blog_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_blog_page' );
114
+ $share_buttons_on_archive_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_archive_page' );
115
+ $share_buttons_on_product_page = get_option( WC_SHORTCODES_PREFIX . 'share_buttons_on_product_page' );
116
+
117
+ if ( $share_buttons_on_post_page ) {
118
+ if ( is_single() && 'post' == get_post_type() ) {
119
+ add_filter( 'the_content', array( &$this, 'display_share_buttons' ), 38, 1 );
120
+ }
121
+ }
122
+
123
+ if ( $share_buttons_on_blog_page ) {
124
+ if ( is_home() ) {
125
+ add_filter( 'the_content', array( &$this, 'display_share_buttons' ), 38, 1 );
126
+ // add_filter( 'the_excerpt', 'wc_shortcodes_display_share_buttons', 38, 1 );
127
+ }
128
+ }
129
+
130
+ if ( $share_buttons_on_archive_page ) {
131
+ if ( is_category() || is_tag() || is_author() || is_date() ) {
132
+ add_filter( 'the_content', array( &$this, 'display_share_buttons' ), 38, 1 );
133
+ // add_filter( 'the_excerpt', 'wc_shortcodes_display_share_buttons', 38, 1 );
134
+ }
135
+ }
136
+
137
+ if ( $share_buttons_on_product_page ) {
138
+ add_action( 'woocommerce_single_product_summary', array( &$this, 'echo_share_buttons' ), 99 );
139
+ }
140
+ }
141
+ }
public/class-post-types.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_Post_Types {
3
+
4
+ protected static $instance = null;
5
+
6
+ public static function get_instance() {
7
+
8
+ // If the single instance hasn't been set, set it now.
9
+ if ( null == self::$instance ) {
10
+ self::$instance = new self;
11
+ }
12
+
13
+ return self::$instance;
14
+ }
15
+
16
+ private function __construct() {
17
+ /* Register custom post types on the 'init' hook. */
18
+ add_action( 'init', array( &$this, 'register_post_types' ) );
19
+
20
+ /* Register taxonomies on the 'init' hook. */
21
+ add_action( 'init', array( &$this, 'register_taxonomies' ) );
22
+
23
+ add_action( 'save_post', array( &$this, 'save_meta' ), 1, 2 ); // save the custom fields
24
+
25
+ add_action( 'add_meta_boxes', array( &$this, 'slide_metabox' ) );
26
+ }
27
+
28
+ /**
29
+ * Registers post types needed by the plugin.
30
+ *
31
+ * @since 0.1.0
32
+ * @access public
33
+ * @return void
34
+ */
35
+ public function register_post_types() {
36
+
37
+ /* Set up the arguments for the slider item post type. */
38
+ $args = array(
39
+ 'description' => '',
40
+ 'public' => false,
41
+ 'publicly_queryable' => false,
42
+ 'show_in_nav_menus' => false,
43
+ 'show_in_admin_bar' => true,
44
+ 'exclude_from_search' => true,
45
+ 'show_ui' => true,
46
+ 'show_in_menu' => true,
47
+ 'menu_position' => 11,
48
+ 'menu_icon' => 'dashicons-images-alt2',
49
+ 'can_export' => true,
50
+ 'delete_with_user' => false,
51
+ 'hierarchical' => false,
52
+ 'has_archive' => false,
53
+ 'query_var' => false,
54
+ 'register_meta_box_cb' => array( &$this, 'slide_metabox' ),
55
+
56
+ /* The rewrite handles the URL structure. */
57
+ 'rewrite' => false,
58
+
59
+ /* What features the post type supports. */
60
+ 'supports' => array(
61
+ 'title',
62
+ 'editor',
63
+ 'thumbnail',
64
+ 'page-attributes',
65
+ ),
66
+
67
+ /* Labels used when displaying the posts. */
68
+ 'labels' => array(
69
+ 'name' => __( 'Slider Items', 'wc-shortcodes' ),
70
+ 'singular_name' => __( 'Slider Item', 'wc-shortcodes' ),
71
+ 'menu_name' => __( 'Slider', 'wc-shortcodes' ),
72
+ 'name_admin_bar' => __( 'Slider Item', 'wc-shortcodes' ),
73
+ 'add_new' => __( 'Add New', 'wc-shortcodes' ),
74
+ 'add_new_item' => __( 'Add New Slider Item', 'wc-shortcodes' ),
75
+ 'edit_item' => __( 'Edit Slider Item', 'wc-shortcodes' ),
76
+ 'new_item' => __( 'New Slider Item', 'wc-shortcodes' ),
77
+ 'view_item' => __( 'View Slider Item', 'wc-shortcodes' ),
78
+ 'search_items' => __( 'Search Slider', 'wc-shortcodes' ),
79
+ 'not_found' => __( 'No slider items found', 'wc-shortcodes' ),
80
+ 'not_found_in_trash' => __( 'No slider items found in trash', 'wc-shortcodes' ),
81
+ 'all_items' => __( 'Slider Items', 'wc-shortcodes' ),
82
+
83
+ // Custom labels b/c WordPress doesn't have anything to handle this.
84
+ 'archive_title' => __( 'Slider', 'wc-shortcodes' ),
85
+ )
86
+ );
87
+
88
+ /* Register the slider item post type. */
89
+ register_post_type( 'wcs_slide', $args );
90
+ }
91
+
92
+ /**
93
+ * Register taxonomies for the plugin.
94
+ *
95
+ * @since 0.1.0
96
+ * @access public
97
+ * @return void.
98
+ */
99
+ public function register_taxonomies() {
100
+
101
+ /* Set up the arguments for the slider taxonomy. */
102
+ $args = array(
103
+ 'public' => false,
104
+ 'show_ui' => true,
105
+ 'show_in_nav_menus' => false,
106
+ 'show_tagcloud' => false,
107
+ 'show_admin_column' => true,
108
+ 'hierarchical' => true,
109
+ 'query_var' => false,
110
+
111
+ /* The rewrite handles the URL structure. */
112
+ 'rewrite' => false,
113
+
114
+ /* Labels used when displaying taxonomy and terms. */
115
+ 'labels' => array(
116
+ 'name' => __( 'Slider Categories', 'wc-shortcodes' ),
117
+ 'singular_name' => __( 'Slider Category', 'wc-shortcodes' ),
118
+ 'menu_name' => __( 'Categories', 'wc-shortcodes' ),
119
+ 'name_admin_bar' => __( 'Slider Category', 'wc-shortcodes' ),
120
+ 'search_items' => __( 'Search Slider Categories', 'wc-shortcodes' ),
121
+ 'popular_items' => __( 'Popular Slider Categories', 'wc-shortcodes' ),
122
+ 'all_items' => __( 'All Slider Categories', 'wc-shortcodes' ),
123
+ 'edit_item' => __( 'Edit Slider Category', 'wc-shortcodes' ),
124
+ 'view_item' => __( 'View Slider Category', 'wc-shortcodes' ),
125
+ 'update_item' => __( 'Update Slider Category', 'wc-shortcodes' ),
126
+ 'add_new_item' => __( 'Add New Slider Category', 'wc-shortcodes' ),
127
+ 'new_item_name' => __( 'New Slider Category Name', 'wc-shortcodes' ),
128
+ 'separate_items_with_commas' => __( 'Separate slider categories with commas', 'wc-shortcodes' ),
129
+ 'add_or_remove_items' => __( 'Add or remove slider categories', 'wc-shortcodes' ),
130
+ 'choose_from_most_used' => __( 'Choose from the most used slider categories', 'wc-shortcodes' ),
131
+ )
132
+ );
133
+
134
+ /* Register the 'slider' taxonomy. */
135
+ register_taxonomy( 'wcs_slide_cat', array( 'wcs_slide' ), $args );
136
+
137
+ /* Set up the arguments for the slider taxonomy. */
138
+ $args = array(
139
+ 'public' => false,
140
+ 'show_ui' => true,
141
+ 'show_in_nav_menus' => false,
142
+ 'show_tagcloud' => false,
143
+ 'show_admin_column' => true,
144
+ 'hierarchical' => false,
145
+ 'query_var' => 'slider_tag',
146
+
147
+ /* The rewrite handles the URL structure. */
148
+ 'rewrite' => false,
149
+
150
+ /* Labels used when displaying taxonomy and terms. */
151
+ 'labels' => array(
152
+ 'name' => __( 'Slider Tags', 'wc-shortcodes' ),
153
+ 'singular_name' => __( 'Slider Tag', 'wc-shortcodes' ),
154
+ 'menu_name' => __( 'Tags', 'wc-shortcodes' ),
155
+ 'name_admin_bar' => __( 'Slider Tag', 'wc-shortcodes' ),
156
+ 'search_items' => __( 'Search Slider Tags', 'wc-shortcodes' ),
157
+ 'popular_items' => __( 'Popular Slider Tags', 'wc-shortcodes' ),
158
+ 'all_items' => __( 'All Slider Tags', 'wc-shortcodes' ),
159
+ 'edit_item' => __( 'Edit Slider Tag', 'wc-shortcodes' ),
160
+ 'view_item' => __( 'View Slider Tag', 'wc-shortcodes' ),
161
+ 'update_item' => __( 'Update Slider Tag', 'wc-shortcodes' ),
162
+ 'add_new_item' => __( 'Add New Slider Tag', 'wc-shortcodes' ),
163
+ 'new_item_name' => __( 'New Slider Tag Name', 'wc-shortcodes' ),
164
+ 'separate_items_with_commas' => __( 'Separate slider tags with commas', 'wc-shortcodes' ),
165
+ 'add_or_remove_items' => __( 'Add or remove slider tags', 'wc-shortcodes' ),
166
+ 'choose_from_most_used' => __( 'Choose from the most used slider tags', 'wc-shortcodes' ),
167
+ )
168
+ );
169
+
170
+ /* Register the 'slider' taxonomy. */
171
+ register_taxonomy( 'wcs_slide_tag', array( 'wcs_slide' ), $args );
172
+ }
173
+
174
+ public function save_meta($post_id, $post) {
175
+
176
+ if ( ! isset( $_POST['slidedetails_noncename'] ) ) {
177
+ return;
178
+ }
179
+
180
+ // verify this came from the our screen and with proper authorization,
181
+ // because save_post can be triggered at other times
182
+ if ( ! wp_verify_nonce( $_POST['slidedetails_noncename'], plugin_basename(__FILE__) )) {
183
+ return $post->ID;
184
+ }
185
+
186
+ // Is the user allowed to edit the post or page?
187
+ if ( !current_user_can( 'edit_post', $post->ID ))
188
+ return $post->ID;
189
+
190
+ // OK, we're authenticated: we need to find and save the data
191
+ // We'll put it into an array to make it easier to loop though.
192
+
193
+ $meta['_wc_shortcodes_slide_url'] = esc_url_raw( $_POST['_wc_shortcodes_slide_url'] );
194
+
195
+ // Add values of $events_meta as custom fields
196
+
197
+ foreach ( $meta as $key => $value ) { // Cycle through the $events_meta array!
198
+ if( $post->post_type == 'revision' ) {
199
+ // Don't store custom data twice
200
+ return;
201
+ }
202
+
203
+ // $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
204
+
205
+ if ( get_post_meta( $post->ID, $key, false ) ) {
206
+ // If the custom field already has a value
207
+ update_post_meta( $post->ID, $key, $value );
208
+ } else {
209
+ // If the custom field doesn't have a value
210
+ add_post_meta( $post->ID, $key, $value );
211
+ }
212
+ if( ! $value ) {
213
+ delete_post_meta( $post->ID, $key ); // Delete if blank
214
+ }
215
+ }
216
+
217
+ }
218
+
219
+ public function slide_details() {
220
+ global $post;
221
+
222
+ // Noncename needed to verify where the data originated
223
+ echo '<input type="hidden" name="slidedetails_noncename" id="slidedetails_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
224
+
225
+ // Get the location data if its already been entered
226
+ $url = get_post_meta($post->ID, '_wc_shortcodes_slide_url', true);
227
+
228
+ echo '<p><strong>Enter URL:</strong></p>';
229
+ echo '<input type="text" name="_wc_shortcodes_slide_url" value="' . $url . '" class="widefat" />';
230
+ }
231
+
232
+ public function slide_metabox() {
233
+ add_meta_box('wc-shortcodes-slide-metabox', 'Slide Details', array( &$this, 'slide_details' ), 'wcs_slide', 'normal', 'high');
234
+ }
235
+ }
public/class-public.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPC_Shortcodes_Public extends WPC_Shortcodes_Vars {
4
+
5
+ /**
6
+ * Instance of this class.
7
+ *
8
+ * @since 1.0.0
9
+ *
10
+ * @var object
11
+ */
12
+ protected static $instance = null;
13
+
14
+ public static function get_instance() {
15
+
16
+ // If the single instance hasn't been set, set it now.
17
+ if ( null == self::$instance ) {
18
+ self::$instance = new self;
19
+ }
20
+
21
+ return self::$instance;
22
+ }
23
+
24
+ /**
25
+ * Initialize the plugin by setting localization and loading public scripts
26
+ * and styles.
27
+ *
28
+ * @since 1.0.0
29
+ */
30
+ private function __construct() {
31
+
32
+ // Load theme support variables.
33
+ add_action( 'init', array( &$this, 'check_supports' ) );
34
+
35
+ // Load plugin text domain.
36
+ add_action( 'init', array( &$this, 'load_plugin_textdomain' ) );
37
+
38
+ // Load public-facing style sheet and JavaScript.
39
+ // add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_styles' ) );
40
+ add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
41
+ add_action( 'wp_enqueue_scripts', array( &$this, 'scripts_override' ), 9999 );
42
+ }
43
+
44
+ public function check_supports() {
45
+ if ( current_theme_supports( 'wpc-shortcodes' ) ) {
46
+ $supports = get_theme_support( 'wpc-shortcodes' );
47
+
48
+ if ( isset( $supports[0] ) && is_array( $supports[0] ) ) {
49
+ foreach ( $supports[0] as $key => $value ) {
50
+ parent::$theme_support[ $key ] = $value;
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Load the plugin text domain for translation.
58
+ *
59
+ * @since 1.0.0
60
+ */
61
+ public function load_plugin_textdomain() {
62
+
63
+ $domain = parent::$plugin_slug;
64
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
65
+
66
+ load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
67
+ load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
68
+
69
+ }
70
+
71
+ /**
72
+ * Register and enqueue public-facing style sheet.
73
+ *
74
+ * @since 1.0.0
75
+ */
76
+ public function enqueue_styles() {
77
+ }
78
+
79
+ /**
80
+ * Register and enqueues public-facing JavaScript files.
81
+ *
82
+ * @since 1.0.0
83
+ */
84
+ public function enqueue_scripts() {
85
+ $ver = WC_SHORTCODES_VERSION;
86
+
87
+ if ( get_option( WC_SHORTCODES_PREFIX . 'enable_shortcode_css', true ) ) {
88
+ wp_enqueue_style( 'wc-shortcodes-style', WC_SHORTCODES_PLUGIN_URL . 'public/assets/css/style.css', array( ), $ver );
89
+ }
90
+
91
+ wp_enqueue_script('jquery');
92
+ wp_register_script( 'wc-shortcodes-tabs', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/tabs.js', array ( 'jquery' ), $ver, true );
93
+ wp_register_script( 'wc-shortcodes-toggle', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/toggle.js', 'jquery', $ver, true );
94
+ wp_register_script( 'wc-shortcodes-accordion', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/accordion.js', array ( 'jquery' ), $ver, true );
95
+ wp_register_script( 'wc-shortcodes-prettify', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/prettify.js', array ( ), $ver, true );
96
+ wp_register_script( 'wc-shortcodes-pre', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/pre.js', array ( 'jquery' ), $ver, true );
97
+ wp_register_script( 'wc-shortcodes-googlemap', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/googlemap.js', array('jquery'), $ver, true);
98
+
99
+ if ( $api_key = get_option( WC_SHORTCODES_PREFIX . 'google_maps_api_key', true ) ) {
100
+ wp_register_script( 'wc-shortcodes-googlemap-api', 'https://maps.googleapis.com/maps/api/js?key=' . urlencode( $api_key ), array('jquery'), $ver, true);
101
+ }
102
+ wp_register_script( 'wc-shortcodes-skillbar', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/skillbar.js', array ( 'jquery' ), $ver, true );
103
+ wp_register_script( 'wc-shortcodes-fullwidth', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/fullwidth.js', array ( 'jquery' ), $ver, true );
104
+
105
+ // Masonry
106
+ wp_enqueue_script( 'jquery-masonry' );
107
+
108
+ // images loaded
109
+ wp_register_script( 'wordpresscanvas-imagesloaded', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/imagesloaded.pkgd.min.js', array (), '4.1.0', true );
110
+
111
+ // slider
112
+ wp_register_script( 'wordpresscanvas-rslides', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/responsiveslides.min.js', array ( 'jquery' ), '1.54', true );
113
+ wp_register_style( 'wc-shortcodes-bxslider', WC_SHORTCODES_PLUGIN_URL . 'includes/vendors/bxslider/jquery.bxslider.min.css', array( ), '4.2.5' );
114
+ wp_register_script( 'wc-shortcodes-bxslider', WC_SHORTCODES_PLUGIN_URL . 'includes/vendors/bxslider/jquery.bxslider.min.js', array ( 'jquery' ), '4.2.5', true );
115
+ wp_register_script( 'wc-shortcodes-post-slider', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/post-slider.js', array ( 'jquery' ), $ver, true );
116
+
117
+ // posts
118
+ wp_register_script( 'wc-shortcodes-posts', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/posts.js', array ( 'jquery', 'wordpresscanvas-rslides', 'jquery-masonry', 'wordpresscanvas-imagesloaded' ), $ver, true );
119
+ wp_register_script( 'wc-shortcodes-posts-grid', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/posts-grid.js', array ( 'jquery', 'wordpresscanvas-rslides' ), $ver, true );
120
+
121
+ // countdown
122
+ wp_register_script( 'wc-shortcodes-jquery-countdown-js', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/jquery.countdown.js', array ( 'jquery' ), $ver, true );
123
+ wp_register_script( 'wc-shortcodes-countdown', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/countdown.js', array ( 'wc-shortcodes-jquery-countdown-js' ), $ver, true );
124
+
125
+ // rsvp
126
+ wp_register_script( 'wc-shortcodes-rsvp', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/rsvp.js', array ( 'jquery' ), $ver, true );
127
+
128
+ $local = array(
129
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
130
+ );
131
+
132
+ wp_localize_script( 'wc-shortcodes-rsvp', 'WCShortcodes', $local );
133
+ wp_enqueue_script( 'wc-shortcodes-rsvp' );
134
+ }
135
+
136
+ public function scripts_override() {
137
+
138
+ if ( WC_SHORTCODES_FONT_AWESOME_ENABLED ) {
139
+ wp_deregister_style( 'wordpresscanvas-font-awesome' );
140
+ wp_register_style( 'wordpresscanvas-font-awesome', WC_SHORTCODES_PLUGIN_URL . 'public/assets/css/font-awesome.min.css', array( ), '4.6.3' );
141
+ wp_enqueue_style( 'wordpresscanvas-font-awesome' );
142
+ }
143
+
144
+ /* if ( ! wp_script_is( 'pinit', 'registered' ) ) {
145
+ wp_register_script( 'pinit', '//assets.pinterest.com/js/pinit.js', array(), false, true);
146
+ } */
147
+ }
148
+
149
+ /**
150
+ * Fired for each blog when the plugin is activated.
151
+ *
152
+ * @since 1.0.0
153
+ */
154
+ public static function single_activate() {
155
+ }
156
+
157
+ /**
158
+ * Fired for each blog when the plugin is deactivated.
159
+ *
160
+ * @since 1.0.0
161
+ */
162
+ public static function single_deactivate() {
163
+ }
164
+ }
includes/shortcode-functions.php → public/class-register.php RENAMED
@@ -1,220 +1,245 @@
1
  <?php
2
- /**
3
- * Allow shortcodes to be executed before they go
4
- * go through all of Wordpress' filters.
5
- *
6
- * @since 3.6.1
7
- * @access public
8
- *
9
- * @param mixed $content
10
- * @return void
11
- */
12
- function wc_shortcodes_pre_process($content) {
13
- global $shortcode_tags;
14
-
15
- // Backup current registered shortcodes and clear them all out
16
- $orig_shortcode_tags = $shortcode_tags;
17
- $shortcode_tags = array();
18
-
19
- do_action( 'wc_shortcodes_add_preprocess' );
20
-
21
- // Do the shortcode (only the one above is registered)
22
- $content = do_shortcode($content);
23
-
24
- // Put the original shortcodes back
25
- $shortcode_tags = $orig_shortcode_tags;
26
-
27
- return $content;
28
- }
29
- add_filter('the_content', 'wc_shortcodes_pre_process', 7);
30
- add_filter('wc_shortcodes_the_content', 'wc_shortcodes_pre_process', 7);
31
-
32
- /**
33
- * Add all preprocessed shortcodes here
34
- *
35
- * @since 3.6.1
36
- * @access public
37
- *
38
- * @return void
39
- */
40
- function wc_shortcodes_add_preprocess() {
41
- add_shortcode( 'wc_fullwidth' , 'wc_shortcodes_fullwidth' );
42
- add_shortcode( 'wc_column', 'wc_shortcodes_column' );
43
- add_shortcode( 'wc_row', 'wc_shortcodes_row' );
44
- add_shortcode( 'wc_center', 'wc_shortcodes_center' );
45
- add_shortcode( 'wc_toggle', 'wc_shortcodes_toggle' );
46
- add_shortcode( 'wc_accordion', 'wc_shortcodes_accordion_main' );
47
- add_shortcode( 'wc_accordion_section', 'wc_shortcodes_accordion_section' );
48
- add_shortcode( 'wc_tabgroup', 'wc_shortcodes_tabgroup' );
49
- add_shortcode( 'wc_tab', 'wc_shortcodes_tab' );
50
- add_shortcode( 'wc_testimonial', 'wc_shortcodes_testimonial' );
51
- add_shortcode( 'wc_box', 'wc_shortcodes_box' );
52
- add_shortcode( 'wc_pricing', 'wc_shortcodes_pricing' );
53
- add_shortcode( 'wc_code' , 'wc_shortcodes_displaycode' );
54
- }
55
- add_action( 'wc_shortcodes_add_preprocess', 'wc_shortcodes_add_preprocess' );
56
 
 
57
 
58
- /*
59
- * Allow shortcodes in widgets
60
- * @since v1.0
61
- */
62
- add_filter('widget_text', 'do_shortcode');
 
 
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
- /**
66
- * @since 3.6
67
- * @access public
68
- *
69
- * @param array $atts
70
- * @param string $content
71
- * @return void
72
- */
73
- function wc_shortcodes_fullwidth( $atts, $content = null ) {
74
- global $wc_shortcodes_theme_support;
75
 
76
- extract(shortcode_atts(array(
77
- 'selector' => $wc_shortcodes_theme_support[ 'fullwidth_container' ],
78
- ), $atts));
79
 
80
- if ( empty( $selector ) ) {
81
- $selector = $wc_shortcodes_theme_support[ 'fullwidth_container' ];
 
 
 
 
 
82
  }
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
- *
93
- * @param mixed $atts
94
- * @param mixed $content
95
- * @access public
96
- * @return void
97
- */
98
- function wc_shortcodes_displayhtml( $atts, $content = null ) {
99
- global $post;
100
- $html = '';
101
 
102
- if ( $content != null )
103
- return $content;
104
 
105
- extract(shortcode_atts(array(
106
- 'name' => ''
107
- ), $atts));
108
 
109
- // sanitize
110
- $name = WCShortcodes_Sanitize::text_field( $name );
111
- $name = preg_replace( '/^_/', '', $name );
112
 
113
- if ( empty( $name ) )
114
- return null;
 
 
 
 
 
 
 
 
 
115
 
116
- if ( $snippet = get_post_meta($post->ID, $name, true ) ) {
117
- $html = '<div class="wc-shortcodes-html-wrapper wc-shortcodes-item wc-shortcodes-content">' . $snippet . '</div>';
118
- }
119
 
120
- return $html;
121
- }
122
- add_shortcode( 'wc_html', 'wc_shortcodes_displayhtml' );
123
 
 
 
 
124
 
125
- /**
126
- * @param mixed $atts
127
- * @param mixed $content
128
- * @access public
129
- * @return void
130
- */
131
- function wc_shortcodes_displaycode( $atts, $content = null ) {
132
- return '<code>'.$content.'</code>';
133
- }
134
 
135
- /**
136
- * @param mixed $atts
137
- * @param mixed $content
138
- * @access public
139
- * @return void
140
- */
141
- function wc_shortcodes_displaypre( $atts, $content = null ) {
142
- global $post;
143
- $html = '';
144
- static $instance = 0;
145
- $instance++;
146
-
147
- if ( $content != null )
148
- return $content;
149
 
150
- extract(shortcode_atts(array(
151
- 'name' => '',
152
- 'scrollable' => 1,
153
- 'color' => 1,
154
- 'lang' => '',
155
- 'linenums' => 0,
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';
169
- if ( (int) $linenums )
170
- $class[] = 'linenums';
171
- if ( ! empty( $lang ) )
172
- $class[] = 'lang-' . $lang;
173
  }
174
- if ( (int) $scrollable )
175
- $class[] = 'pre-scrollable';
176
- if ( (int) $wrap )
177
- $class[] = 'pre-wrap';
178
 
179
- $class = implode( ' ', $class );
180
 
181
- $name = preg_replace( '/^_/', '', $name );
 
 
 
 
 
 
 
 
182
 
183
- if ( empty( $name ) )
184
- return null;
 
 
 
 
 
 
 
 
 
185
 
186
- if ( $code = get_post_meta($post->ID, $name, true ) ) {
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
- }
194
 
195
- return $html;
196
- }
197
- add_shortcode( 'wc_pre' , 'wc_shortcodes_displaypre' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
 
 
199
 
200
- /*
201
- * Clear Floats
202
- * @since v1.0
203
- */
204
- if( !function_exists('wc_shortcodes_clear_floats') ) {
205
- function wc_shortcodes_clear_floats() {
 
 
 
 
 
 
 
 
 
 
 
 
206
  return '<div class="wc-shortcodes-clear-floats"></div>';
207
  }
208
- add_shortcode( 'wc_clear_floats', 'wc_shortcodes_clear_floats' );
209
- }
210
 
211
 
212
- /*
213
- * Skillbars
214
- * @since v1.3
215
- */
216
- if( !function_exists('wc_shortcodes_skillbar') ) {
217
- function wc_shortcodes_skillbar( $atts ) {
218
  extract( shortcode_atts( array(
219
  'title' => '',
220
  'percentage' => '100',
@@ -224,9 +249,9 @@ if( !function_exists('wc_shortcodes_skillbar') ) {
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');
@@ -242,36 +267,30 @@ if( !function_exists('wc_shortcodes_skillbar') ) {
242
 
243
  return $output;
244
  }
245
- add_shortcode( 'wc_skillbar', 'wc_shortcodes_skillbar' );
246
- }
247
 
248
 
249
- /*
250
- * Spacing
251
- * @since v1.0
252
- */
253
- if( !function_exists('wc_shortcodes_spacing') ) {
254
- function wc_shortcodes_spacing( $atts ) {
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
- }
267
 
268
 
269
- /**
270
- * Social Icons
271
- * @since 1.0
272
- */
273
- if( !function_exists('wc_shortcodes_social_icons') ) {
274
- function wc_shortcodes_social_icons( $atts ){
275
  extract(shortcode_atts(array(
276
  'class' => '',
277
  'size' => 'large', // deprecated. using maxheight now
@@ -353,15 +372,12 @@ if( !function_exists('wc_shortcodes_social_icons') ) {
353
 
354
  return $html;
355
  }
356
- add_shortcode( 'wc_social_icons', 'wc_shortcodes_social_icons' );
357
- }
358
 
359
- /**
360
- * Highlights
361
- * @since 1.0
362
- */
363
- if ( !function_exists( 'wc_shortcodes_highlight' ) ) {
364
- function wc_shortcodes_highlight( $atts, $content = null ) {
365
  extract( shortcode_atts( array(
366
  'color' => 'yellow',
367
  'class' => '',
@@ -370,16 +386,13 @@ if ( !function_exists( 'wc_shortcodes_highlight' ) ) {
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' );
374
- }
375
 
376
 
377
- /*
378
- * Buttons
379
- * @since v1.0
380
- */
381
- if( !function_exists('wc_shortcodes_button') ) {
382
- function wc_shortcodes_button( $atts, $content = null ) {
383
  extract( shortcode_atts( array(
384
  'type' => 'primary', // or inverse
385
  'url' => 'http://www.wordpresscanvas.com',
@@ -394,7 +407,7 @@ if( !function_exists('wc_shortcodes_button') ) {
394
  ), $atts ) );
395
 
396
  // sanitize
397
- $border_radius = WCShortcodes_Sanitize::css_unit( $border_radius );
398
 
399
  $custom_class = sanitize_title( $class );
400
 
@@ -429,18 +442,15 @@ if( !function_exists('wc_shortcodes_button') ) {
429
 
430
  return $button;
431
  }
432
- add_shortcode( 'wc_button', 'wc_shortcodes_button' );
433
- }
434
 
435
 
436
 
437
- /*
438
- * Boxes
439
- * @since v1.0
440
- *
441
- */
442
- if( !function_exists('wc_shortcodes_box') ) {
443
- function wc_shortcodes_box( $atts, $content = null ) {
444
  extract( shortcode_atts( array(
445
  'color' => 'primary',
446
  'text_align' => 'left',
@@ -449,8 +459,8 @@ if( !function_exists('wc_shortcodes_box') ) {
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
 
@@ -468,17 +478,15 @@ if( !function_exists('wc_shortcodes_box') ) {
468
 
469
  return $alert_content;
470
  }
471
- }
472
 
473
 
474
 
475
- /*
476
- * Testimonial
477
- * @since v1.0
478
- *
479
- */
480
- if( !function_exists('wc_shortcodes_testimonial') ) {
481
- function wc_shortcodes_testimonial( $atts, $content = null ) {
482
  extract( shortcode_atts( array(
483
  'by' => '',
484
  'url' => '',
@@ -498,41 +506,37 @@ if( !function_exists('wc_shortcodes_testimonial') ) {
498
 
499
  return $testimonial_content;
500
  }
501
- }
502
 
503
 
504
 
505
- /*
506
- * Center
507
- * @since v1.0
508
- *
509
- */
510
- if( !function_exists('wc_shortcodes_center') ) {
511
- function wc_shortcodes_center( $atts, $content = null ){
512
  extract( shortcode_atts( array(
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
 
527
 
528
 
529
- /*
530
- * Columns
531
- * @since v1.0
532
- *
533
- */
534
- if( !function_exists('wc_shortcodes_column') ) {
535
- function wc_shortcodes_column( $atts, $content = null ){
536
  extract( shortcode_atts( array(
537
  'size' => 'one-third',
538
  'position' =>'',
@@ -554,30 +558,26 @@ if( !function_exists('wc_shortcodes_column') ) {
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
 
559
 
560
 
561
 
562
- /*
563
- * Rows
564
- * @since v1.0
565
- *
566
- */
567
- if( !function_exists('wc_shortcodes_row') ) {
568
- function wc_shortcodes_row( $atts, $content = null ){
569
  return '<div class="wc-shortcodes-row wc-shortcodes-item wc-shortcodes-clearfix">' . do_shortcode($content) . '</div>';
570
  }
571
- }
572
 
573
 
574
 
575
- /*
576
- * Toggle
577
- * @since v1.0
578
- */
579
- if( !function_exists('wc_shortcodes_toggle') ) {
580
- function wc_shortcodes_toggle( $atts, $content = null ) {
581
  extract( shortcode_atts( array(
582
  'title' => 'Toggle Title',
583
  'class' => '',
@@ -586,7 +586,7 @@ if( !function_exists('wc_shortcodes_toggle') ) {
586
  'layout' => 'box',
587
  ), $atts ) );
588
 
589
- $padding = WCShortcodes_Sanitize::css_unit( $padding );
590
 
591
  $classes = array();
592
 
@@ -616,18 +616,16 @@ if( !function_exists('wc_shortcodes_toggle') ) {
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
 
621
 
622
- /*
623
- * Accordion
624
- * @since v1.0
625
- *
626
- */
627
 
628
- // Main
629
- if( !function_exists('wc_shortcodes_accordion_main') ) {
630
- function wc_shortcodes_accordion_main( $atts, $content = null ) {
631
 
632
  extract( shortcode_atts( array(
633
  'class' => '',
@@ -636,8 +634,8 @@ if( !function_exists('wc_shortcodes_accordion_main') ) {
636
  'layout' => 'box',
637
  ), $atts ) );
638
 
639
- $collapse = WCShortcodes_Sanitize::bool( $collapse );
640
- $leaveopen = WCShortcodes_Sanitize::bool( $leaveopen );
641
 
642
  $classes = array();
643
 
@@ -672,12 +670,10 @@ if( !function_exists('wc_shortcodes_accordion_main') ) {
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
 
677
 
678
- // Section
679
- if( !function_exists('wc_shortcodes_accordion_section') ) {
680
- function wc_shortcodes_accordion_section( $atts, $content = null ) {
681
  extract( shortcode_atts( array(
682
  'title' => 'Title',
683
  'class' => '',
@@ -685,17 +681,15 @@ if( !function_exists('wc_shortcodes_accordion_section') ) {
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
- }
690
 
691
 
692
- /*
693
- * Tabs
694
- * @since v1.0
695
- *
696
- */
697
- if (!function_exists('wc_shortcodes_tabgroup')) {
698
- function wc_shortcodes_tabgroup( $atts, $content = null ) {
699
  static $instance = 0;
700
  $instance++;
701
 
@@ -727,23 +721,22 @@ if (!function_exists('wc_shortcodes_tabgroup')) {
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 ){
734
  $output .= '<li><a href="#" data-index="'.$i++.'" data-id="#wc-shortcodes-tab-'. sanitize_title( $tab[0] ) .'">' . $tab[0] . '</a></li>';
735
  }
736
- $output .= '</ul>';
737
- $output .= do_shortcode( $content );
738
- $output .= '</div>';
739
  } else {
740
  $output .= do_shortcode( $content );
741
  }
742
  return $output;
743
  }
744
- }
745
- if (!function_exists('wc_shortcodes_tab')) {
746
- function wc_shortcodes_tab( $atts, $content = null ) {
747
  $defaults = array(
748
  'title' => 'Tab',
749
  );
@@ -758,19 +751,17 @@ if (!function_exists('wc_shortcodes_tab')) {
758
 
759
  return '<div id="wc-shortcodes-tab-'. sanitize_title( $title ) .'" class="'. esc_attr( $class ) .'">'. do_shortcode( $content ) .'</div>';
760
  }
761
- }
762
 
763
 
764
 
765
 
766
- /*
767
- * Pricing Table
768
- * @since v1.0
769
- *
770
- */
771
- /*section*/
772
- if( !function_exists('wc_shortcodes_pricing') ) {
773
- function wc_shortcodes_pricing( $atts, $content = null ) {
774
 
775
  extract( shortcode_atts( array(
776
  'type' => 'primary', // primary, secondary, inverse
@@ -800,16 +791,14 @@ if( !function_exists('wc_shortcodes_pricing') ) {
800
  $pricing_content .= '</div>';
801
  return $pricing_content;
802
  }
803
-
804
- }
805
 
806
 
807
- /*
808
- * Heading
809
- * @since v1.1
810
- */
811
- if( !function_exists('wc_shortcodes_heading') ) {
812
- function wc_shortcodes_heading( $atts ) {
813
  extract( shortcode_atts( array(
814
  'title' => __('Sample Heading', 'wc'),
815
  'type' => 'h2',
@@ -824,7 +813,7 @@ if( !function_exists('wc_shortcodes_heading') ) {
824
  'icon_spacing' => '',
825
  ), $atts ) );
826
 
827
- $type = WCShortcodes_Sanitize::heading_type( $type );
828
 
829
  $style_attr = '';
830
 
@@ -850,7 +839,7 @@ if( !function_exists('wc_shortcodes_heading') ) {
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>';
@@ -867,16 +856,13 @@ if( !function_exists('wc_shortcodes_heading') ) {
867
 
868
  return $output;
869
  }
870
- add_shortcode( 'wc_heading', 'wc_shortcodes_heading' );
871
- }
872
 
873
 
874
- /*
875
- * Google Maps
876
- * @since v1.1
877
- */
878
- if (! function_exists( 'wc_shortcodes_googlemaps' ) ) :
879
- function wc_shortcodes_googlemaps($atts, $content = null) {
880
  static $instance = 0;
881
  $instance++;
882
 
@@ -889,8 +875,8 @@ if (! function_exists( 'wc_shortcodes_googlemaps' ) ) :
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
 
@@ -911,18 +897,14 @@ if (! function_exists( 'wc_shortcodes_googlemaps' ) ) :
911
  $output .= '</div>';
912
 
913
  return $output;
914
-
915
  }
916
- add_shortcode( 'wc_googlemap', 'wc_shortcodes_googlemaps' );
917
- endif;
918
 
919
 
920
- /*
921
- * Divider
922
- * @since v1.1
923
- */
924
- if( !function_exists('wc_shortcodes_divider') ) {
925
- function wc_shortcodes_divider( $atts ) {
926
  extract( shortcode_atts( array(
927
  'style' => 'solid',
928
  'line' => 'single',
@@ -931,8 +913,8 @@ if( !function_exists('wc_shortcodes_divider') ) {
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
 
@@ -953,16 +935,13 @@ if( !function_exists('wc_shortcodes_divider') ) {
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
- }
958
 
959
 
960
- /*
961
- * Countdown
962
- * @since v1.10
963
- */
964
- if( !function_exists('wc_shortcodes_countdown') ) {
965
- function wc_shortcodes_countdown( $atts ) {
966
  extract( shortcode_atts( array(
967
  'date' => '',
968
  'format' => 'wdHMs',
@@ -986,13 +965,10 @@ if( !function_exists('wc_shortcodes_countdown') ) {
986
 
987
  return $html;
988
  }
989
- add_shortcode( 'wc_countdown', 'wc_shortcodes_countdown' );
990
- }
991
 
992
 
993
 
994
- if( !function_exists('wc_shortcodes_rsvp') ) {
995
- function wc_shortcodes_rsvp( $atts ) {
996
  extract( shortcode_atts( array(
997
  'columns' => '3',
998
  'align' => 'left',
@@ -1001,7 +977,7 @@ if( !function_exists('wc_shortcodes_rsvp') ) {
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 = '';
@@ -1068,20 +1044,17 @@ if( !function_exists('wc_shortcodes_rsvp') ) {
1068
 
1069
  return '<div class="wc-shortcodes-rsvp wc-shortcodes-content wc-shortcodes-item wc-shortcodes-rsvp-columns-'.$columns.' wc-shortcodes-rsvp-align-'.esc_attr($align).' rsvp-button-align-'.esc_attr($button_align).'">' . do_shortcode( $html ) . '</div>';
1070
  }
1071
- add_shortcode( 'wc_rsvp', 'wc_shortcodes_rsvp' );
1072
- }
1073
 
1074
- if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1075
- /**
1076
- * Display posts in various formats
1077
- *
1078
- * @since 3.8
1079
- * @access public
1080
- *
1081
- * @param mixed $atts
1082
- * @return void
1083
- */
1084
- function wc_shortcodes_posts( $atts ) {
1085
  global $data;
1086
  global $post;
1087
  global $wc_shortcodes_posts_query;
@@ -1173,12 +1146,12 @@ if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1173
  }
1174
 
1175
  // clean input values
1176
- $atts['terms'] = wc_shortcodes_comma_delim_to_array( $atts['terms'] );
1177
  $wpc_term = null;
1178
  if ( isset( $_GET['wpc_term'] ) && ! empty( $_GET['wpc_term'] ) ) {
1179
  $wpc_term = $_GET['wpc_term'];
1180
  }
1181
- $atts['post__in'] = wc_shortcodes_comma_delim_to_array( $atts['post__in'] );
1182
  $display['columns'] == (int) $display['columns'];
1183
  $display['excerpt_length'] = (int) $display['excerpt_length'];
1184
  $atts['order'] = strtoupper( $atts['order'] );
@@ -1313,11 +1286,8 @@ if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1313
  wp_reset_query();
1314
  return $html;
1315
  }
1316
- }
1317
- add_shortcode( 'wc_posts', 'wc_shortcodes_posts' );
1318
 
1319
- if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1320
- function wc_shortcodes_post_slider( $atts ) {
1321
  global $data;
1322
  global $post;
1323
  global $wc_shortcodes_posts_query;
@@ -1569,11 +1539,8 @@ if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1569
 
1570
  return $html;
1571
  }
1572
- }
1573
- add_shortcode( 'wc_post_slider', 'wc_shortcodes_post_slider' );
1574
 
1575
- if( !function_exists('wc_shortcodes_image') ) {
1576
- function wc_shortcodes_image( $atts ) {
1577
  extract( shortcode_atts( array(
1578
  // attachment detail settings
1579
  'title' => '',
@@ -1603,14 +1570,14 @@ if( !function_exists('wc_shortcodes_image') ) {
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();
@@ -1694,11 +1661,8 @@ if( !function_exists('wc_shortcodes_image') ) {
1694
 
1695
  return $html;
1696
  }
1697
- add_shortcode( 'wc_image', 'wc_shortcodes_image' );
1698
- }
1699
 
1700
- if( !function_exists('wc_shortcodes_fa') ) {
1701
- function wc_shortcodes_fa( $atts ) {
1702
  extract( shortcode_atts( array(
1703
  // icon options
1704
  'icon' => '',
@@ -1709,8 +1673,8 @@ if( !function_exists('wc_shortcodes_fa') ) {
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 '';
@@ -1737,11 +1701,8 @@ if( !function_exists('wc_shortcodes_fa') ) {
1737
 
1738
  return $html;
1739
  }
1740
- add_shortcode( 'wc_fa', 'wc_shortcodes_fa' );
1741
- }
1742
 
1743
- if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1744
- function wc_shortcodes_share_buttons( $atts ) {
1745
  extract( shortcode_atts( array(
1746
  // misc options
1747
  'class' => '',
@@ -1899,15 +1860,12 @@ if ( ! function_exists('wc_shortcodes_share_buttons') ) {
1899
 
1900
  return $html;
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;
1908
  $share_buttons = null;
1909
 
1910
- $share_buttons = wc_shortcodes_share_buttons( null );
1911
 
1912
  if ( empty( $share_buttons ) ) {
1913
  return '';
@@ -1923,5 +1881,4 @@ if ( ! function_exists('wc_shortcodes_get_share_buttons') ) {
1923
 
1924
  return $html;
1925
  }
1926
- add_shortcode( 'wc_share_buttons', 'wc_shortcodes_get_share_buttons' );
1927
  }
1
  <?php
2
+ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
3
+ protected static $instance = null;
4
+ protected $sanitize = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
+ public static function get_instance() {
7
 
8
+ // If the single instance hasn't been set, set it now.
9
+ if ( null == self::$instance ) {
10
+ self::$instance = new self;
11
+ }
12
+
13
+ return self::$instance;
14
+ }
15
 
16
+ private function __construct() {
17
+ $this->sanitize = WPC_Shortcodes_Sanitize::get_instance();
18
+
19
+ add_filter( 'the_content', array( &$this, 'pre_process' ), 7 );
20
+ add_filter( 'wc_shortcodes_the_content', array( &$this, 'pre_process' ), 7 );
21
+ add_action( 'wc_shortcodes_add_preprocess', array( &$this, 'add_preprocess' ) );
22
+ add_shortcode( 'wc_html', array( &$this, 'displayhtml' ) );
23
+ add_shortcode( 'wc_pre' , array( &$this, 'displaypre' ) );
24
+ add_shortcode( 'wc_clear_floats', array( &$this, 'clear_floats' ) );
25
+ add_shortcode( 'wc_skillbar', array( &$this, 'skillbar' ) );
26
+ add_shortcode( 'wc_spacing', array( &$this, 'spacing' ) );
27
+ add_shortcode( 'wc_social_icons', array( &$this, 'social_icons' ) );
28
+ add_shortcode( 'wc_highlight', array( &$this, 'highlight' ) );
29
+ add_shortcode( 'wc_button', array( &$this, 'button' ) );
30
+ add_shortcode( 'wc_heading', array( &$this, 'heading' ) );
31
+ add_shortcode( 'wc_googlemap', array( &$this, 'googlemaps' ) );
32
+ add_shortcode( 'wc_divider', array( &$this, 'divider' ) );
33
+ add_shortcode( 'wc_countdown', array( &$this, 'countdown' ) );
34
+ add_shortcode( 'wc_rsvp', array( &$this, 'rsvp' ) );
35
+ add_shortcode( 'wc_posts', array( &$this, 'posts' ) );
36
+ add_shortcode( 'wc_post_slider', array( &$this, 'post_slider' ) );
37
+ add_shortcode( 'wc_image', array( &$this, 'image' ) );
38
+ add_shortcode( 'wc_fa', array( &$this, 'fa' ) );
39
+ add_shortcode( 'wc_share', array( &$this, 'share_buttons' ) );
40
+ add_shortcode( 'wc_share_buttons', array( &$this, 'get_share_buttons' ) );
41
+ // Allow shortcodes in widgets.
42
+ add_filter( 'widget_text', 'do_shortcode' );
43
+ }
44
+
45
+ /**
46
+ * Allow shortcodes to be executed before they go
47
+ * go through all of Wordpress' filters.
48
+ *
49
+ * @since 3.6.1
50
+ * @access public
51
+ *
52
+ * @param mixed $content
53
+ * @return void
54
+ */
55
+ public function pre_process($content) {
56
+ global $shortcode_tags;
57
 
58
+ // Backup current registered shortcodes and clear them all out
59
+ $orig_shortcode_tags = $shortcode_tags;
60
+ $shortcode_tags = array();
 
 
 
 
 
 
 
61
 
62
+ do_action( 'wc_shortcodes_add_preprocess' );
 
 
63
 
64
+ // Do the shortcode (only the one above is registered)
65
+ $content = do_shortcode($content);
66
+
67
+ // Put the original shortcodes back
68
+ $shortcode_tags = $orig_shortcode_tags;
69
+
70
+ return $content;
71
  }
72
 
73
+ /**
74
+ * Add all preprocessed shortcodes here
75
+ *
76
+ * @since 3.6.1
77
+ * @access public
78
+ *
79
+ * @return void
80
+ */
81
+ public function add_preprocess() {
82
+ add_shortcode( 'wc_fullwidth' , array( &$this, 'fullwidth' ) );
83
+ add_shortcode( 'wc_column', array( &$this, 'column' ) );
84
+ add_shortcode( 'wc_row', array( &$this, 'row' ) );
85
+ add_shortcode( 'wc_center', array( &$this, 'center' ) );
86
+ add_shortcode( 'wc_toggle', array( &$this, 'toggle' ) );
87
+ add_shortcode( 'wc_accordion', array( &$this, 'accordion_main' ) );
88
+ add_shortcode( 'wc_accordion_section', array( &$this, 'accordion_section' ) );
89
+ add_shortcode( 'wc_tabgroup', array( &$this, 'tabgroup' ) );
90
+ add_shortcode( 'wc_tab', array( &$this, 'tab' ) );
91
+ add_shortcode( 'wc_testimonial', array( &$this, 'testimonial' ) );
92
+ add_shortcode( 'wc_box', array( &$this, 'box' ) );
93
+ add_shortcode( 'wc_pricing', array( &$this, 'pricing' ) );
94
+ add_shortcode( 'wc_code' , array( &$this, 'displaycode' ) );
95
+ }
96
 
97
+ /**
98
+ * @since 3.6
99
+ * @access public
100
+ *
101
+ * @param array $atts
102
+ * @param string $content
103
+ * @return void
104
+ */
105
+ public function fullwidth( $atts, $content = null ) {
106
 
107
+ extract(shortcode_atts(array(
108
+ 'selector' => parent::$theme_support[ 'fullwidth_container' ],
109
+ ), $atts));
110
 
111
+ if ( empty( $selector ) ) {
112
+ $selector = parent::$theme_support[ 'fullwidth_container' ];
113
+ }
 
 
 
 
 
 
 
 
114
 
115
+ wp_enqueue_script('wc-shortcodes-fullwidth');
 
116
 
117
+ return '<div class="wc-shortcodes-full-width wc-shortcodes-content" data-selector="' . esc_attr( $selector ) . '">' . do_shortcode( $content ) . '</div>';
118
+ }
 
119
 
 
 
 
120
 
121
+ /**
122
+ * Easily Display HTML in post
123
+ *
124
+ * @param mixed $atts
125
+ * @param mixed $content
126
+ * @access public
127
+ * @return void
128
+ */
129
+ public function displayhtml( $atts, $content = null ) {
130
+ global $post;
131
+ $html = '';
132
 
133
+ if ( $content != null )
134
+ return $content;
 
135
 
136
+ extract(shortcode_atts(array(
137
+ 'name' => ''
138
+ ), $atts));
139
 
140
+ // sanitize
141
+ $name = $this->sanitize->text_field( $name );
142
+ $name = preg_replace( '/^_/', '', $name );
143
 
144
+ if ( empty( $name ) )
145
+ return null;
 
 
 
 
 
 
 
146
 
147
+ if ( $snippet = get_post_meta($post->ID, $name, true ) ) {
148
+ $html = '<div class="wc-shortcodes-html-wrapper wc-shortcodes-item wc-shortcodes-content">' . $snippet . '</div>';
149
+ }
 
 
 
 
 
 
 
 
 
 
 
150
 
151
+ return $html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
 
 
 
 
153
 
 
154
 
155
+ /**
156
+ * @param mixed $atts
157
+ * @param mixed $content
158
+ * @access public
159
+ * @return void
160
+ */
161
+ public function displaycode( $atts, $content = null ) {
162
+ return '<code>'.$content.'</code>';
163
+ }
164
 
165
+ /**
166
+ * @param mixed $atts
167
+ * @param mixed $content
168
+ * @access public
169
+ * @return void
170
+ */
171
+ public function displaypre( $atts, $content = null ) {
172
+ global $post;
173
+ $html = '';
174
+ static $instance = 0;
175
+ $instance++;
176
 
177
+ if ( $content != null )
178
+ return $content;
 
 
 
 
 
 
179
 
180
+ extract(shortcode_atts(array(
181
+ 'name' => '',
182
+ 'scrollable' => 1,
183
+ 'color' => 1,
184
+ 'lang' => '',
185
+ 'linenums' => 0,
186
+ 'wrap' => 0,
187
+ ), $atts));
188
+
189
+ // sanitize
190
+ $scrollable = $this->sanitize->bool( $scrollable );
191
+ $color = $this->sanitize->bool( $color );
192
+ $linenums = $this->sanitize->bool( $linenums );
193
+ $wrap = $this->sanitize->bool( $wrap );
194
+ $name = $this->sanitize->text_field( $name );
195
+
196
+ $class = array();
197
+ if ( (int) $color ) {
198
+ $class[] = 'prettyprint';
199
+ if ( (int) $linenums )
200
+ $class[] = 'linenums';
201
+ if ( ! empty( $lang ) )
202
+ $class[] = 'lang-' . $lang;
203
+ }
204
+ if ( (int) $scrollable )
205
+ $class[] = 'pre-scrollable';
206
+ if ( (int) $wrap )
207
+ $class[] = 'pre-wrap';
208
+
209
+ $class = implode( ' ', $class );
210
+
211
+ $name = preg_replace( '/^_/', '', $name );
212
 
213
+ if ( empty( $name ) )
214
+ return null;
215
 
216
+ if ( $code = get_post_meta($post->ID, $name, true ) ) {
217
+ wp_enqueue_script('wc-shortcodes-prettify');
218
+ wp_enqueue_script('wc-shortcodes-pre');
219
+ //$code = preg_replace( '/[ ]{4,}|[\t]/', ' ', $code );
220
+ $html .= '<pre id="prettycode-'.$instance.'" class="'.esc_attr( $class ).'">';
221
+ $html .= htmlspecialchars( $code );
222
+ $html .= '</pre>';
223
+ }
224
+
225
+ return $html;
226
+ }
227
+
228
+
229
+ /*
230
+ * Clear Floats
231
+ * @since v1.0
232
+ */
233
+ public function clear_floats() {
234
  return '<div class="wc-shortcodes-clear-floats"></div>';
235
  }
 
 
236
 
237
 
238
+ /*
239
+ * Skillbars
240
+ * @since v1.3
241
+ */
242
+ public function skillbar( $atts ) {
 
243
  extract( shortcode_atts( array(
244
  'title' => '',
245
  'percentage' => '100',
249
  ), $atts ) );
250
 
251
  // sanitize
252
+ $percentage = $this->sanitize->int_float( $percentage );
253
+ $color = $this->sanitize->hex_color( $color );
254
+ $show_percent = $this->sanitize->bool( $show_percent );
255
 
256
  // Enque scripts
257
  wp_enqueue_script('wc-shortcodes-skillbar');
267
 
268
  return $output;
269
  }
 
 
270
 
271
 
272
+ /*
273
+ * Spacing
274
+ * @since v1.0
275
+ */
276
+ public function spacing( $atts ) {
 
277
  extract( shortcode_atts( array(
278
  'size' => '20px',
279
  'class' => '',
280
  ), $atts ) );
281
 
282
  // sanitize
283
+ $size = $this->sanitize->css_unit( $size );
284
 
285
  return '<hr class="wc-shortcodes-spacing '. esc_attr( $class ) .'" style="height: '. esc_attr( $size ) .'" />';
286
  }
 
 
287
 
288
 
289
+ /**
290
+ * Social Icons
291
+ * @since 1.0
292
+ */
293
+ public function social_icons( $atts ){
 
294
  extract(shortcode_atts(array(
295
  'class' => '',
296
  'size' => 'large', // deprecated. using maxheight now
372
 
373
  return $html;
374
  }
 
 
375
 
376
+ /**
377
+ * Highlights
378
+ * @since 1.0
379
+ */
380
+ public function highlight( $atts, $content = null ) {
 
381
  extract( shortcode_atts( array(
382
  'color' => 'yellow',
383
  'class' => '',
386
  return '<span class="wc-shortcodes-highlight wc-shortcodes-highlight-'. esc_attr( $color ) .' '. esc_attr( $class ) .'">' . do_shortcode( $content ) . '</span>';
387
 
388
  }
 
 
389
 
390
 
391
+ /*
392
+ * Buttons
393
+ * @since v1.0
394
+ */
395
+ public function button( $atts, $content = null ) {
 
396
  extract( shortcode_atts( array(
397
  'type' => 'primary', // or inverse
398
  'url' => 'http://www.wordpresscanvas.com',
407
  ), $atts ) );
408
 
409
  // sanitize
410
+ $border_radius = $this->sanitize->css_unit( $border_radius );
411
 
412
  $custom_class = sanitize_title( $class );
413
 
442
 
443
  return $button;
444
  }
 
 
445
 
446
 
447
 
448
+ /*
449
+ * Boxes
450
+ * @since v1.0
451
+ *
452
+ */
453
+ public function box( $atts, $content = null ) {
 
454
  extract( shortcode_atts( array(
455
  'color' => 'primary',
456
  'text_align' => 'left',
459
  'class' => '',
460
  ), $atts ) );
461
 
462
+ $margin_top = $this->sanitize->css_unit( $margin_top );
463
+ $margin_bottom = $this->sanitize->css_unit( $margin_bottom );
464
 
465
  $style_attr = '';
466
 
478
 
479
  return $alert_content;
480
  }
 
481
 
482
 
483
 
484
+ /*
485
+ * Testimonial
486
+ * @since v1.0
487
+ *
488
+ */
489
+ public function testimonial( $atts, $content = null ) {
 
490
  extract( shortcode_atts( array(
491
  'by' => '',
492
  'url' => '',
506
 
507
  return $testimonial_content;
508
  }
 
509
 
510
 
511
 
512
+ /*
513
+ * Center
514
+ * @since v1.0
515
+ *
516
+ */
517
+ public function center( $atts, $content = null ){
 
518
  extract( shortcode_atts( array(
519
  'max_width' => '500px',
520
  'text_align' => 'center',
521
  'class' => '',
522
  ), $atts ) );
523
 
524
+ $max_width = $this->sanitize->css_unit( $max_width );
525
 
526
  // $append_clearfix = '<div class="wc-shortcodes-clear-floats"></div>';
527
  $style = empty( $max_width ) ? '' : ' style="max-width:'.esc_attr( $max_width ).';"';
528
 
529
  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>';
530
  }
 
531
 
532
 
533
 
534
+ /*
535
+ * Columns
536
+ * @since v1.0
537
+ *
538
+ */
539
+ public function column( $atts, $content = null ){
 
540
  extract( shortcode_atts( array(
541
  'size' => 'one-third',
542
  'position' =>'',
558
 
559
  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>';
560
  }
 
561
 
562
 
563
 
564
 
565
+ /*
566
+ * Rows
567
+ * @since v1.0
568
+ *
569
+ */
570
+ public function row( $atts, $content = null ){
 
571
  return '<div class="wc-shortcodes-row wc-shortcodes-item wc-shortcodes-clearfix">' . do_shortcode($content) . '</div>';
572
  }
 
573
 
574
 
575
 
576
+ /*
577
+ * Toggle
578
+ * @since v1.0
579
+ */
580
+ public function toggle( $atts, $content = null ) {
 
581
  extract( shortcode_atts( array(
582
  'title' => 'Toggle Title',
583
  'class' => '',
586
  'layout' => 'box',
587
  ), $atts ) );
588
 
589
+ $padding = $this->sanitize->css_unit( $padding );
590
 
591
  $classes = array();
592
 
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
 
621
+ /*
622
+ * Accordion
623
+ * @since v1.0
624
+ *
625
+ */
626
 
627
+ // Main
628
+ public function accordion_main( $atts, $content = null ) {
 
629
 
630
  extract( shortcode_atts( array(
631
  'class' => '',
634
  'layout' => 'box',
635
  ), $atts ) );
636
 
637
+ $collapse = $this->sanitize->bool( $collapse );
638
+ $leaveopen = $this->sanitize->bool( $leaveopen );
639
 
640
  $classes = array();
641
 
670
  // Display the accordion
671
  return '<div class="'. esc_attr( $class ) .'" data-behavior="'.esc_attr( $behavior ).'" data-start-state="'.esc_attr( $state ).'">' . do_shortcode($content) . '</div>';
672
  }
 
673
 
674
 
675
+ // Section
676
+ public function accordion_section( $atts, $content = null ) {
 
677
  extract( shortcode_atts( array(
678
  'title' => 'Title',
679
  'class' => '',
681
 
682
  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>';
683
  }
684
+
 
685
 
686
 
687
+ /*
688
+ * Tabs
689
+ * @since v1.0
690
+ *
691
+ */
692
+ public function tabgroup( $atts, $content = null ) {
 
693
  static $instance = 0;
694
  $instance++;
695
 
721
  if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
722
  $output = '';
723
  if( count($tab_titles) ){
724
+ $output .= '<div id="wc-shortcodes-tab-'. esc_attr( $instance ) .'" class="'.esc_attr( $class ).'">';
725
  $output .= '<ul class="wcs-tabs-nav wc-shortcodes-clearfix">';
726
  $i = 0;
727
  foreach( $tab_titles as $tab ){
728
  $output .= '<li><a href="#" data-index="'.$i++.'" data-id="#wc-shortcodes-tab-'. sanitize_title( $tab[0] ) .'">' . $tab[0] . '</a></li>';
729
  }
730
+ $output .= '</ul>';
731
+ $output .= do_shortcode( $content );
732
+ $output .= '</div>';
733
  } else {
734
  $output .= do_shortcode( $content );
735
  }
736
  return $output;
737
  }
738
+
739
+ public function tab( $atts, $content = null ) {
 
740
  $defaults = array(
741
  'title' => 'Tab',
742
  );
751
 
752
  return '<div id="wc-shortcodes-tab-'. sanitize_title( $title ) .'" class="'. esc_attr( $class ) .'">'. do_shortcode( $content ) .'</div>';
753
  }
 
754
 
755
 
756
 
757
 
758
+ /*
759
+ * Pricing Table
760
+ * @since v1.0
761
+ *
762
+ */
763
+ /*section*/
764
+ public function pricing( $atts, $content = null ) {
 
765
 
766
  extract( shortcode_atts( array(
767
  'type' => 'primary', // primary, secondary, inverse
791
  $pricing_content .= '</div>';
792
  return $pricing_content;
793
  }
794
+
 
795
 
796
 
797
+ /*
798
+ * Heading
799
+ * @since v1.1
800
+ */
801
+ public function heading( $atts ) {
 
802
  extract( shortcode_atts( array(
803
  'title' => __('Sample Heading', 'wc'),
804
  'type' => 'h2',
813
  'icon_spacing' => '',
814
  ), $atts ) );
815
 
816
+ $type = $this->sanitize->heading_type( $type );
817
 
818
  $style_attr = '';
819
 
839
  if ( 'h1' == $type )
840
  $class = trim( 'entry-title ' . $class );
841
 
842
+ $output = '<'.$type.' class="wc-shortcodes-heading '. esc_attr( $text_align ) .' '. esc_attr( $class ) .'" style="'.esc_attr( $style_attr ).'"><span>';
843
 
844
  if ( $icon_left )
845
  $output .= '<i class="wc-shortcodes-button-icon-left fa fa-'. esc_attr( $icon_left ) .'" style="margin-right:'.esc_attr( $icon_spacing ).'"></i>';
856
 
857
  return $output;
858
  }
 
 
859
 
860
 
861
+ /*
862
+ * Google Maps
863
+ * @since v1.1
864
+ */
865
+ public function googlemaps($atts, $content = null) {
 
866
  static $instance = 0;
867
  $instance++;
868
 
875
  'class' => '', // add a custom class to your google map
876
  ), $atts));
877
 
878
+ $height = $this->sanitize->pixel( $height );
879
+ $zoom = $this->sanitize->number( $zoom );
880
 
881
  $title_on_load = 'yes' == $title_on_load ? 1 : 0;
882
 
897
  $output .= '</div>';
898
 
899
  return $output;
 
900
  }
 
 
901
 
902
 
903
+ /*
904
+ * Divider
905
+ * @since v1.1
906
+ */
907
+ public function divider( $atts ) {
 
908
  extract( shortcode_atts( array(
909
  'style' => 'solid',
910
  'line' => 'single',
913
  'class' => '',
914
  ), $atts ) );
915
 
916
+ $margin_top = $this->sanitize->css_unit( $margin_top );
917
+ $margin_bottom = $this->sanitize->css_unit( $margin_bottom );
918
 
919
  $style_attr = array();
920
 
935
 
936
  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.' />';
937
  }
 
 
938
 
939
 
940
+ /*
941
+ * Countdown
942
+ * @since v1.10
943
+ */
944
+ public function countdown( $atts ) {
 
945
  extract( shortcode_atts( array(
946
  'date' => '',
947
  'format' => 'wdHMs',
965
 
966
  return $html;
967
  }
 
 
968
 
969
 
970
 
971
+ public function rsvp( $atts ) {
 
972
  extract( shortcode_atts( array(
973
  'columns' => '3',
974
  'align' => 'left',
977
 
978
  wp_enqueue_script('wc-shortcodes-rsvp');
979
 
980
+ $columns = $this->sanitize->positive_number( $columns );
981
  $columns = 3 == $columns ? $columns : 1;
982
 
983
  $html = '';
1044
 
1045
  return '<div class="wc-shortcodes-rsvp wc-shortcodes-content wc-shortcodes-item wc-shortcodes-rsvp-columns-'.$columns.' wc-shortcodes-rsvp-align-'.esc_attr($align).' rsvp-button-align-'.esc_attr($button_align).'">' . do_shortcode( $html ) . '</div>';
1046
  }
 
 
1047
 
1048
+ /**
1049
+ * Display posts in various formats
1050
+ *
1051
+ * @since 3.8
1052
+ * @access public
1053
+ *
1054
+ * @param mixed $atts
1055
+ * @return void
1056
+ */
1057
+ public function posts( $atts ) {
 
1058
  global $data;
1059
  global $post;
1060
  global $wc_shortcodes_posts_query;
1146
  }
1147
 
1148
  // clean input values
1149
+ $atts['terms'] = $this->sanitize->comma_delim_to_array( $atts['terms'] );
1150
  $wpc_term = null;
1151
  if ( isset( $_GET['wpc_term'] ) && ! empty( $_GET['wpc_term'] ) ) {
1152
  $wpc_term = $_GET['wpc_term'];
1153
  }
1154
+ $atts['post__in'] = $this->sanitize->comma_delim_to_array( $atts['post__in'] );
1155
  $display['columns'] == (int) $display['columns'];
1156
  $display['excerpt_length'] = (int) $display['excerpt_length'];
1157
  $atts['order'] = strtoupper( $atts['order'] );
1286
  wp_reset_query();
1287
  return $html;
1288
  }
 
 
1289
 
1290
+ public function post_slider( $atts ) {
 
1291
  global $data;
1292
  global $post;
1293
  global $wc_shortcodes_posts_query;
1539
 
1540
  return $html;
1541
  }
 
 
1542
 
1543
+ public function image( $atts ) {
 
1544
  extract( shortcode_atts( array(
1545
  // attachment detail settings
1546
  'title' => '',
1570
  'class' => '',
1571
  ), $atts ) );
1572
 
1573
+ $font_size = $this->sanitize->css_unit( $font_size );
1574
+ $flag_width = $this->sanitize->css_unit( $flag_width );
1575
 
1576
  // function options
1577
  $div_wrapper = false;
1578
 
1579
  // sanitize
1580
+ $attachment_id = $this->sanitize->number( $attachment_id );
1581
 
1582
  // classes
1583
  $classes = array();
1661
 
1662
  return $html;
1663
  }
 
 
1664
 
1665
+ public function fa( $atts ) {
 
1666
  extract( shortcode_atts( array(
1667
  // icon options
1668
  'icon' => '',
1673
  'class' => '',
1674
  ), $atts ) );
1675
 
1676
+ $margin_right = $this->sanitize->css_unit( $margin_right );
1677
+ $margin_left = $this->sanitize->css_unit( $margin_left );
1678
 
1679
  if ( empty( $icon ) )
1680
  return '';
1701
 
1702
  return $html;
1703
  }
 
 
1704
 
1705
+ public function share_buttons( $atts ) {
 
1706
  extract( shortcode_atts( array(
1707
  // misc options
1708
  'class' => '',
1860
 
1861
  return $html;
1862
  }
 
 
1863
 
1864
+ public function get_share_buttons() {
 
1865
  $html = null;
1866
  $share_buttons = null;
1867
 
1868
+ $share_buttons = $this->share_buttons( null );
1869
 
1870
  if ( empty( $share_buttons ) ) {
1871
  return '';
1881
 
1882
  return $html;
1883
  }
 
1884
  }
includes/classes/sanitize.php → public/class-sanitize.php RENAMED
@@ -2,8 +2,23 @@
2
  /**
3
  * Sanitize Class
4
  */
5
- class WCShortcodes_Sanitize {
6
- static public function bool( $value ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  if ( 'true' == $value ) {
8
  return true;
9
  }
@@ -14,17 +29,17 @@ class WCShortcodes_Sanitize {
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
 
@@ -37,7 +52,7 @@ class WCShortcodes_Sanitize {
37
  return $value;
38
  }
39
 
40
- static public function number( $value ) {
41
  $value = preg_replace("/[^0-9\-]/", "",$value);
42
  $value = intval( $value );
43
 
@@ -47,7 +62,7 @@ class WCShortcodes_Sanitize {
47
  return $value;
48
  }
49
 
50
- static public function pixel( $value ) {
51
  if ( '' == $value )
52
  return $value;
53
 
@@ -60,7 +75,7 @@ class WCShortcodes_Sanitize {
60
  return $value."px";
61
  }
62
 
63
- static public function css_unit( $value, $css_unit = 'px' ) {
64
  if ( '' == $value )
65
  return $value;
66
 
@@ -76,7 +91,7 @@ class WCShortcodes_Sanitize {
76
  return $value . $css_unit;
77
  }
78
 
79
- static public function hex_color( $color ) {
80
  if ( '' === $color )
81
  return '';
82
 
@@ -87,7 +102,7 @@ class WCShortcodes_Sanitize {
87
  return '';
88
  }
89
 
90
- static public function heading_type( $value, $default = 'h2' ) {
91
  $whitelist = array(
92
  'h1',
93
  'h2',
@@ -105,5 +120,21 @@ class WCShortcodes_Sanitize {
105
 
106
  return $default;
107
  }
 
 
 
 
 
 
 
 
 
 
 
108
 
 
 
 
 
 
109
  }
2
  /**
3
  * Sanitize Class
4
  */
5
+ class WPC_Shortcodes_Sanitize {
6
+ protected static $instance = null;
7
+
8
+ public static function get_instance() {
9
+
10
+ // If the single instance hasn't been set, set it now.
11
+ if ( null == self::$instance ) {
12
+ self::$instance = new self;
13
+ }
14
+
15
+ return self::$instance;
16
+ }
17
+
18
+ private function __construct() {
19
+ }
20
+
21
+ public function bool( $value ) {
22
  if ( 'true' == $value ) {
23
  return true;
24
  }
29
  return (bool) $value;
30
  }
31
 
32
+ public function text_field( $value ) {
33
  return trim( sanitize_text_field( $value ) );
34
  }
35
 
36
+ public function int_float( $value ) {
37
  $value = filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
38
 
39
  return $value;
40
  }
41
 
42
+ public function positive_number( $value ) {
43
  $value = preg_replace("/[^0-9\-]/", "",$value);
44
  $value = intval( $value );
45
 
52
  return $value;
53
  }
54
 
55
+ public function number( $value ) {
56
  $value = preg_replace("/[^0-9\-]/", "",$value);
57
  $value = intval( $value );
58
 
62
  return $value;
63
  }
64
 
65
+ public function pixel( $value ) {
66
  if ( '' == $value )
67
  return $value;
68
 
75
  return $value."px";
76
  }
77
 
78
+ public function css_unit( $value, $css_unit = 'px' ) {
79
  if ( '' == $value )
80
  return $value;
81
 
91
  return $value . $css_unit;
92
  }
93
 
94
+ public function hex_color( $color ) {
95
  if ( '' === $color )
96
  return '';
97
 
102
  return '';
103
  }
104
 
105
+ public function heading_type( $value, $default = 'h2' ) {
106
  $whitelist = array(
107
  'h1',
108
  'h2',
120
 
121
  return $default;
122
  }
123
+ public function comma_delim_to_array( $string ) {
124
+ $a = explode( ',', $string );
125
+
126
+ foreach ( $a as $key => $value ) {
127
+ $value = trim( $value );
128
+
129
+ if ( empty( $value ) )
130
+ unset( $a[ $key ] );
131
+ else
132
+ $a[ $key ] = $value;
133
+ }
134
 
135
+ if ( empty( $a ) )
136
+ return '';
137
+ else
138
+ return $a;
139
+ }
140
  }
public/class-vars.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WPC_Shortcodes_Vars {
3
+
4
+ /**
5
+ * Plugin version, used for cache-busting of style and script file references.
6
+ *
7
+ * @since 1.0.0
8
+ *
9
+ * @var string
10
+ */
11
+ const VERSION = '3.1';
12
+ const DB_VERSION = '1.0';
13
+
14
+ /**
15
+ * @TODO - Rename "plugin-name" to the name your your plugin
16
+ *
17
+ * Unique identifier for your plugin.
18
+ *
19
+ *
20
+ * The variable name is used as the text domain when internationalizing strings
21
+ * of text. Its value should match the Text Domain file header in the main
22
+ * plugin file.
23
+ *
24
+ * @since 1.0.0
25
+ *
26
+ * @var string
27
+ */
28
+ protected static $plugin_slug = 'wc-shortcodes';
29
+ protected static $plugin_prefix = 'wc_shortcodes';
30
+
31
+ protected static $options;
32
+ protected static $social_icons;
33
+ protected static $share_buttons;
34
+ protected static $theme_support;
35
+
36
+ public static function init_vars() {
37
+ define( 'WC_SHORTCODES_IS_ACTIVATED', true );
38
+ define( 'WC_SHORTCODES_VERSION', self::VERSION );
39
+ define( 'WC_SHORTCODES_PREFIX', self::$plugin_prefix . '_' );
40
+ define( '_WC_SHORTCODES_PREFIX', '_' . self::$plugin_prefix . '_' );
41
+ define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( dirname( __FILE__ ) ) );
42
+ define( 'WC_SHORTCODES_CURRENT_VERSION', get_option( WC_SHORTCODES_PREFIX . 'current_version' ) );
43
+ define( 'WC_SHORTCODES_FONT_AWESOME_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_font_awesome', true ) );
44
+ define( 'WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_slide_post_type', true ) );
45
+
46
+ self::$options = array();
47
+ self::$social_icons = array(
48
+ 'facebook' => 'Facebook',
49
+ 'google' => 'Google',
50
+ 'twitter' => 'Twitter',
51
+ 'pinterest' => 'Pinterest',
52
+ 'instagram' => 'Instagram',
53
+ 'bloglovin' => 'BlogLovin',
54
+ 'flickr' => 'Flickr',
55
+ 'rss' => 'RSS',
56
+ 'email' => 'Email',
57
+ 'custom1' => 'Custom 1',
58
+ 'custom2' => 'Custom 2',
59
+ 'custom3' => 'Custom 3',
60
+ 'custom4' => 'Custom 4',
61
+ 'custom5' => 'Custom 5',
62
+ );
63
+ self::$share_buttons = array(
64
+ 'pinterest' => 'Pinterest',
65
+ 'facebook' => 'Facebook',
66
+ 'twitter' => 'Twitter',
67
+ 'google' => 'Google',
68
+ 'email' => 'Email',
69
+ 'print' => 'Print',
70
+ );
71
+ self::$theme_support = array(
72
+ 'theme_reset' => false,
73
+ 'fullwidth_container' => '#main',
74
+ 'social_icons_format' => 'image',
75
+ 'share_buttons_filter_disable' => false,
76
+ 'share_buttons_on_post_page' => false,
77
+ 'share_buttons_on_blog_page' => false,
78
+ 'share_buttons_on_archive_page' => false,
79
+ 'share_buttons_on_product_page' => false,
80
+ 'facebook_font_icon' => 'fa-facebook',
81
+ 'facebook_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/facebook.png',
82
+ 'twitter_font_icon' => 'fa-twitter',
83
+ 'twitter_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/twitter.png',
84
+ 'pinterest_font_icon' => 'fa-pinterest',
85
+ 'pinterest_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/pinterest.png',
86
+ 'google_font_icon' => 'fa-google-plus',
87
+ 'google_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/google.png',
88
+ 'bloglovin_font_icon' => 'fa-plus-square',
89
+ 'bloglovin_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/bloglovin.png',
90
+ 'email_font_icon' => 'fa-envelope',
91
+ 'email_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/email.png',
92
+ 'flickr_font_icon' => 'fa-flickr',
93
+ 'flickr_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/flickr.png',
94
+ 'instagram_font_icon' => 'fa-instagram',
95
+ 'instagram_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/instagram.png',
96
+ 'rss_font_icon' => 'fa-rss',
97
+ 'rss_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/rss.png',
98
+ 'custom1_font_icon' => 'fa-camera',
99
+ 'custom1_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/picasa.png',
100
+ 'custom2_font_icon' => 'fa-shopping-cart',
101
+ 'custom2_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/shopping.png',
102
+ 'custom3_font_icon' => 'fa-youtube',
103
+ 'custom3_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/youtube.png',
104
+ 'custom4_font_icon' => 'fa-dollar',
105
+ 'custom4_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/etsy.png',
106
+ 'custom5_font_icon' => 'fa-tumblr',
107
+ 'custom5_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/tumblr.png',
108
+ 'share_buttons_format' => 'image',
109
+ 'pinterest_share_text' => 'Pin it',
110
+ 'pinterest_share_font_icon' => 'fa-pinterest',
111
+ 'pinterest_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/pinterest.png',
112
+ 'facebook_share_text' => 'Share',
113
+ 'facebook_share_font_icon' => 'fa-facebook',
114
+ 'facebook_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/facebook.png',
115
+ 'twitter_share_text' => 'Tweet',
116
+ 'twitter_share_font_icon' => 'fa-twitter',
117
+ 'twitter_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/twitter.png',
118
+ 'google_share_text' => 'Share',
119
+ 'google_share_font_icon' => 'fa-google-plus',
120
+ 'google_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/google.png',
121
+ 'email_share_text' => 'Email',
122
+ 'email_share_font_icon' => 'fa-envelope',
123
+ 'email_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/email.png',
124
+ 'print_share_text' => 'Print',
125
+ 'print_share_font_icon' => 'fa-print',
126
+ 'print_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/print.png',
127
+ );
128
+ }
129
+ }
public/class-widgets.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPC_Shortcodes_Widgets extends WPC_Shortcodes_Vars {
4
+
5
+ /**
6
+ * Instance of this class.
7
+ *
8
+ * @since 1.0.0
9
+ *
10
+ * @var object
11
+ */
12
+ protected static $instance = null;
13
+
14
+ public static function get_instance() {
15
+
16
+ // If the single instance hasn't been set, set it now.
17
+ if ( null == self::$instance ) {
18
+ self::$instance = new self;
19
+ }
20
+
21
+ return self::$instance;
22
+ }
23
+
24
+ /**
25
+ * Initialize the plugin by setting localization and loading public scripts
26
+ * and styles.
27
+ *
28
+ * @since 1.0.0
29
+ */
30
+ private function __construct() {
31
+ add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
32
+ }
33
+
34
+ public function register_widgets() {
35
+ register_widget( 'WC_Shortcodes_Social_Icons_Widget' );
36
+ register_widget( 'WC_Shortcodes_Post_Slider_Widget' );
37
+ }
38
+ }
public/functions.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wc_shortcodes_display_term_classes( $taxonomy ) {
3
+ global $post;
4
+
5
+ $classes = array();
6
+
7
+ if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
8
+ foreach ( (array) wp_get_post_terms( $post->ID, $taxonomy ) as $term ) {
9
+ if ( empty( $term->slug ) )
10
+ continue;
11
+ $classes[] = 'wc-shortcodes-filter-' . sanitize_html_class($term->slug, $term->term_id);
12
+ }
13
+ }
14
+
15
+ return $classes;
16
+ }
17
+
18
+ function wc_shortcodes_the_media_content( $more_link_text = null, $strip_teaser = false ) {
19
+ $content = get_the_content( $more_link_text, $strip_teaser );
20
+
21
+ $pieces = explode( "\n", $content );
22
+
23
+ $content = '';
24
+
25
+ foreach ( $pieces as $line ) {
26
+ if ( empty( $line ) ) {
27
+ continue;
28
+ }
29
+
30
+ if ( preg_match( '|^\s*(https?://[^\s"]+)\s*$|im', $line ) ) {
31
+ $content = $line;
32
+ break;
33
+ }
34
+ else if ( has_shortcode( $line, 'audio' ) ) {
35
+ $content = $line;
36
+ break;
37
+ }
38
+ else if ( has_shortcode( $line, 'video' ) ) {
39
+ $content = $line;
40
+ break;
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Filter the post content.
46
+ *
47
+ * @since 0.71
48
+ *
49
+ * @param string $content Content of the current post.
50
+ */
51
+ $content = apply_filters( 'wc_shortcodes_the_content', $content );
52
+ $content = str_replace( ']]>', ']]&gt;', $content );
53
+ echo $content;
54
+ }
55
+
56
+ function wc_shortcodes_the_content( $more_link_text = null, $strip_teaser = false ) {
57
+ $content = get_the_content( $more_link_text, $strip_teaser );
58
+
59
+ /**
60
+ * Filter the post content.
61
+ *
62
+ * @since 0.71
63
+ *
64
+ * @param string $content Content of the current post.
65
+ */
66
+ $content = apply_filters( 'wc_shortcodes_the_content', $content );
67
+ $content = str_replace( ']]>', ']]&gt;', $content );
68
+ echo $content;
69
+ }
70
+
71
+ function wc_shortcodes_the_excerpt() {
72
+ $excerpt = wc_shortcodes_get_the_excerpt();
73
+
74
+ /**
75
+ * Filter the post content.
76
+ *
77
+ * @since 0.71
78
+ *
79
+ * @param string $content Content of the current post.
80
+ */
81
+ $excerpt = apply_filters( 'wc_shortcodes_the_excerpt', $excerpt );
82
+ echo $excerpt;
83
+ }
84
+
85
+ function wc_shortcodes_get_the_excerpt( $deprecated = '' ) {
86
+ if ( !empty( $deprecated ) )
87
+ _deprecated_argument( __FUNCTION__, '2.3' );
88
+
89
+ $post = get_post();
90
+
91
+ if ( post_password_required() ) {
92
+ return __( 'There is no excerpt because this is a protected post.' );
93
+ }
94
+
95
+ /**
96
+ * Filter the retrieved post excerpt.
97
+ *
98
+ * @since 1.2.0
99
+ *
100
+ * @param string $post_excerpt The post excerpt.
101
+ */
102
+ return apply_filters( 'wc_shortcodes_get_the_excerpt', $post->post_excerpt );
103
+ }
104
+
105
+ /**
106
+ * Generates an excerpt from the content, if needed.
107
+ *
108
+ * The excerpt word amount will be 55 words and if the amount is greater than
109
+ * that, then the string ' [&hellip;]' will be appended to the excerpt. If the string
110
+ * is less than 55 words, then the content will be returned as is.
111
+ *
112
+ * The 55 word limit can be modified by plugins/themes using the excerpt_length filter
113
+ * The ' [&hellip;]' string can be modified by plugins/themes using the excerpt_more filter
114
+ *
115
+ * @since 1.5.0
116
+ *
117
+ * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
118
+ * @return string The excerpt.
119
+ */
120
+ function wc_shortcodes_wp_trim_excerpt($text = '') {
121
+ global $wc_shortcodes_posts_query;
122
+
123
+ $excerpt_length = 55;
124
+ if ( isset( $wc_shortcodes_posts_query->excerpt_length ) && ! empty( $wc_shortcodes_posts_query->excerpt_length ) ) {
125
+ $excerpt_length = (int) $wc_shortcodes_posts_query->excerpt_length;
126
+ }
127
+
128
+ $raw_excerpt = $text;
129
+ if ( '' == $text ) {
130
+ $text = get_the_content('');
131
+
132
+ $text = strip_shortcodes( $text );
133
+
134
+ /** This filter is documented in wp-includes/post-template.php */
135
+ $text = apply_filters( 'wc_shortcodes_the_content', $text );
136
+ $text = str_replace(']]>', ']]&gt;', $text);
137
+
138
+ /**
139
+ * Filter the number of words in an excerpt.
140
+ *
141
+ * @since 2.7.0
142
+ *
143
+ * @param int $number The number of words. Default 55.
144
+ */
145
+ $excerpt_length = apply_filters( 'wc_shortcodes_excerpt_length', $excerpt_length );
146
+ /**
147
+ * Filter the string in the "more" link displayed after a trimmed excerpt.
148
+ *
149
+ * @since 2.9.0
150
+ *
151
+ * @param string $more_string The string shown within the more link.
152
+ */
153
+ $excerpt_more = apply_filters( 'wc_shortcodes_excerpt_more', '&hellip;' );
154
+ $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
155
+ }
156
+ /**
157
+ * Filter the trimmed excerpt string.
158
+ *
159
+ * @since 2.8.0
160
+ *
161
+ * @param string $text The trimmed text.
162
+ * @param string $raw_excerpt The text prior to trimming.
163
+ */
164
+ return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
165
+ }
166
+
167
+ function wc_shortcodes_get_posted_category() {
168
+ $html = null;
169
+ $cats = get_the_category_list( ', ' );
170
+
171
+ if ( ! empty( $cats ) ) {
172
+ $html .= '<div class="wc-shortcodes-entry-category">';
173
+ if ( ! empty( $cats ) ) {
174
+ $html .= '<span class="wc-shortcodes-cat-posted-text">' . __( 'Posted in', 'wpcanvas2' ) . ' </span><span class="wc-shortcodes-post-in-cat-links">' . $cats . '</span>';
175
+ }
176
+ $html .= '</div>';
177
+ }
178
+
179
+ return $html;
180
+ }
{includes → public}/templates/borderless/content-aside.php RENAMED
File without changes
{includes → public}/templates/borderless/content-audio.php RENAMED
File without changes
{includes → public}/templates/borderless/content-chat.php RENAMED
File without changes
{includes → public}/templates/borderless/content-excerpt.php RENAMED
File without changes
{includes → public}/templates/borderless/content-gallery.php RENAMED
File without changes
{includes → public}/templates/borderless/content-link.php RENAMED
File without changes
{includes → public}/templates/borderless/content-quote.php RENAMED
File without changes
{includes → public}/templates/borderless/content-video.php RENAMED
File without changes
{includes → public}/templates/borderless/content.php RENAMED
File without changes
{includes → public}/templates/borderless/entry-meta.php RENAMED
File without changes
{includes → public}/templates/borderless/index.php RENAMED
File without changes
{includes → public}/templates/box/content-aside.php RENAMED
File without changes
{includes → public}/templates/box/content-audio.php RENAMED
File without changes
{includes → public}/templates/box/content-chat.php RENAMED
File without changes
{includes → public}/templates/box/content-excerpt.php RENAMED
File without changes
{includes → public}/templates/box/content-gallery.php RENAMED
File without changes
{includes → public}/templates/box/content-link.php RENAMED
File without changes
{includes → public}/templates/box/content-quote.php RENAMED
File without changes
{includes → public}/templates/box/content-video.php RENAMED
File without changes
{includes → public}/templates/box/content.php RENAMED
File without changes
{includes → public}/templates/box/entry-meta.php RENAMED
File without changes
{includes → public}/templates/box/index.php RENAMED
File without changes
{includes → public}/templates/nav-filtering.php RENAMED
File without changes
{includes → public}/templates/nav-pagination.php RENAMED
File without changes
{includes → public}/templates/slider1/content.php RENAMED
File without changes
{includes → public}/templates/slider1/index.php RENAMED
File without changes
{includes → public}/templates/slider2/content.php RENAMED
File without changes
{includes → public}/templates/slider2/index.php RENAMED
File without changes
includes/widgets.php → public/widgets/widget-post-slider.php RENAMED
@@ -1,198 +1,4 @@
1
  <?php
2
- /******************************************************************
3
- Author: Chris Baldelomar
4
- URL: http://webplantmedia.com
5
-
6
- All widget code should go here.
7
- ******************************************************************/
8
-
9
- function wc_shortcodes_register_widgets() {
10
- // Register social icons widget version 2
11
- register_widget('WC_Shortcodes_Social_Icons_Widget');
12
- register_widget('WC_Shortcodes_Post_Slider_Widget');
13
- }
14
- add_action('widgets_init', 'wc_shortcodes_register_widgets');
15
-
16
- /**
17
- * WC_Shortcodes_Social_Icons_Widget
18
- *
19
- * This displays a sidebar widget of social media icons.
20
- *
21
- * @uses WP
22
- * @uses _Widget
23
- */
24
- class WC_Shortcodes_Social_Icons_Widget extends WP_Widget {
25
- function __construct() {
26
- $widget_ops = array( 'description' => __('Add your social icons to your sidebar.') );
27
- parent::__construct( 'wc_shortcodes_social_icons', __('WP Canvas - Social Media Icons'), $widget_ops );
28
- }
29
-
30
- function widget($args, $instance) {
31
-
32
- $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
33
-
34
- echo $args['before_widget'];
35
-
36
- if ( !empty($instance['title']) )
37
- echo $args['before_title'] . $instance['title'] . $args['after_title'];
38
-
39
- if ( empty( $instance['format'] ) ) {
40
- $instance['format'] = 'default';
41
- }
42
- $format = $instance['format'];
43
-
44
- // set class with the number of columns the user selected
45
- $columns = $instance['columns'];
46
- if ( empty($columns) ) {
47
- $columns = 'float-left';
48
- }
49
- $maxheight = 'none';
50
- if ( isset( $instance['maxheight'] ) ) {
51
- $maxheight = $instance['maxheight'];
52
- }
53
-
54
- $order = get_option( WC_SHORTCODES_PREFIX . 'social_icons_display' );
55
-
56
- switch ( $format ) {
57
- case 'default' :
58
- $format = get_option( WC_SHORTCODES_PREFIX . 'social_icons_format', 'icon' );
59
- break;
60
- case 'icon' :
61
- $format = 'icon';
62
- break;
63
- default :
64
- $format = 'image';
65
- }
66
-
67
- $show_image = 'image' == $format ? true : false;
68
-
69
- if ( ! is_array( $order ) || empty( $order ) ) {
70
- return;
71
- }
72
-
73
- $first = true;
74
-
75
- $column_display = false;
76
- if ( is_numeric( $columns ) & (int) $columns > 0 ) {
77
- $column_display = true;
78
- }
79
-
80
- $classes = array();
81
- $classes[] = 'wc-shortcodes-social-icons';
82
- $classes[] = 'wc-shortcodes-clearfix';
83
- $classes[] = 'wc-shortcodes-columns-'.$columns;
84
- $classes[] = 'wc-shortcodes-maxheight-'.$maxheight;
85
- $classes[] = 'wc-shortcodes-social-icons-format-'.$format;
86
-
87
- $html = '<ul class="'.implode( ' ', $classes ).'">';
88
- $i = 0;
89
- foreach ($order as $key => $name) {
90
- $li_class = array();
91
- $li_class[] = 'wc-shortcodes-social-icon';
92
- $li_class[] = 'wc-shortcode-social-icon-' . $key;
93
-
94
- if ( $column_display && $i % $columns == 0 ) {
95
- $li_class[] = 'clear-left';
96
- }
97
-
98
- $link_option_name = WC_SHORTCODES_PREFIX . $key . '_link';
99
- $image_icon_option_name = WC_SHORTCODES_PREFIX . $key . '_icon';
100
- $font_icon_option_name = WC_SHORTCODES_PREFIX . $key . '_font_icon';
101
-
102
- $social_link = get_option( $link_option_name );
103
- $social_link = apply_filters( 'wc_shortcodes_social_link', $social_link, $key );
104
-
105
- $first_class = $first ? ' first-icon' : '';
106
- $first = false;
107
-
108
- if ( $show_image ) {
109
- $icon_url = get_option( $image_icon_option_name );
110
-
111
- $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . $key . $first_class . '">';
112
- $html .='<a target="_blank" href="'.$social_link.'">';
113
- $html .= '<img src="'.$icon_url.'" alt="'.$name.'">';
114
- $html .= '</a>';
115
- $html .= '</li>';
116
- }
117
- else {
118
- $icon_class = get_option( $font_icon_option_name );
119
-
120
- $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . $key . $first_class . '">';
121
- $html .='<a target="_blank" href="'.$social_link.'">';
122
- $html .= '<i class="fa '.$icon_class.'"></i>';
123
- $html .= '</a>';
124
- $html .= '</li>';
125
- }
126
- }
127
- $html .= '</ul>';
128
-
129
- echo $html;
130
-
131
- echo $args['after_widget'];
132
- }
133
-
134
- function update( $new_instance, $old_instance ) {
135
- $instance['title'] = strip_tags( stripslashes($new_instance['title']) );
136
- $instance['format'] = $new_instance['format'];
137
- $instance['columns'] = $new_instance['columns'];
138
- $instance['maxheight'] = $new_instance['maxheight'];
139
- return $instance;
140
- }
141
-
142
- function form( $instance ) {
143
- $title = isset( $instance['title'] ) ? $instance['title'] : 'Follow Me!';
144
- $format = isset( $instance['format'] ) ? $instance['format'] : 'default';
145
- $columns = isset( $instance['columns'] ) ? $instance['columns'] : 'float-left';
146
- $maxheight = isset( $instance['maxheight'] ) ? $instance['maxheight'] : 'none';
147
- ?>
148
- <p>
149
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
150
- <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
151
- </p>
152
- <p>
153
- <label for="<?php echo $this->get_field_id('format'); ?>"><?php _e('Format:'); ?></label>
154
- <select id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>">
155
- <option value="default"<?php selected( $format, 'default' ); ?>>Default</option>';
156
- <option value="icon"<?php selected( $format, 'icon' ); ?>>Icon</option>';
157
- <option value="image"<?php selected( $format, 'image' ); ?>>Image</option>';
158
- </select>
159
- </p>
160
- <p>
161
- <label for="<?php echo $this->get_field_id('columns'); ?>"><?php _e('Display:'); ?></label>
162
- <select id="<?php echo $this->get_field_id('columns'); ?>" name="<?php echo $this->get_field_name('columns'); ?>">
163
- <option value="float-center"<?php selected( $columns, 'float-center' ); ?>>Float Center</option>';
164
- <option value="float-left"<?php selected( $columns, 'float-left' ); ?>>Float Left</option>';
165
- <option value="float-right"<?php selected( $columns, 'float-right' ); ?>>Float Right</option>';
166
- <option value="1"<?php selected( $columns, '1' ); ?>>1 Column</option>';
167
- <option value="2"<?php selected( $columns, '2' ); ?>>2 Columns</option>';
168
- <option value="3"<?php selected( $columns, '3' ); ?>>3 Columns</option>';
169
- <option value="4"<?php selected( $columns, '4' ); ?>>4 Columns</option>';
170
- <option value="5"<?php selected( $columns, '5' ); ?>>5 Columns</option>';
171
- <option value="6"<?php selected( $columns, '6' ); ?>>6 Columns</option>';
172
- <option value="7"<?php selected( $columns, '7' ); ?>>7 Columns</option>';
173
- <option value="8"<?php selected( $columns, '8' ); ?>>8 Columns</option>';
174
- </select>
175
- </p>
176
- <p>
177
- <label for="<?php echo $this->get_field_id('maxheight'); ?>"><?php _e('Max Height:'); ?></label>
178
- <select id="<?php echo $this->get_field_id('maxheight'); ?>" name="<?php echo $this->get_field_name('maxheight'); ?>">
179
- <option value="none"<?php selected( $maxheight, 'none' ); ?>>None</option>';
180
- <?php for( $i = 10; $i <= 70; $i = $i + 2 ) : ?>
181
- <option value="<?php echo $i; ?>"<?php selected( $maxheight, $i ); ?>><?php echo $i; ?>px</option>';
182
- <?php endfor; ?>
183
- </select>
184
- </p>
185
- <script type="text/javascript">
186
- /* <![CDATA[ */
187
- jQuery(document).ready(function($){
188
- $('.wc-shortcodes-social-icons').sortable({ axis: "y" });
189
- });
190
- /* ]]> */
191
- </script>
192
- <?php
193
- }
194
- }
195
-
196
  /**
197
  * WC_Shortcodes_Post_Slider_Widget
198
  *
@@ -296,7 +102,7 @@ class WC_Shortcodes_Post_Slider_Widget extends WP_Widget {
296
  unset( $post_types['attachment'] );
297
  ?>
298
 
299
- <div id="wc-shortcodes-post-slider-widget-<?php echo $this->number; ?>" class="wc-shortcodes-post-slider-widget">
300
  <h3>Select Posts</h3>
301
  <div>
302
  <p>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * WC_Shortcodes_Post_Slider_Widget
4
  *
102
  unset( $post_types['attachment'] );
103
  ?>
104
 
105
+ <div id="wc-shortcodes-post-slider-widget-<?php echo $this->number; ?>" class="wc-shortcodes-post-slider-widget wpc-ui-theme-override">
106
  <h3>Select Posts</h3>
107
  <div>
108
  <p>
public/widgets/widget-social-icons.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WC_Shortcodes_Social_Icons_Widget
4
+ *
5
+ * This displays a sidebar widget of social media icons.
6
+ *
7
+ * @uses WP
8
+ * @uses _Widget
9
+ */
10
+ class WC_Shortcodes_Social_Icons_Widget extends WP_Widget {
11
+ function __construct() {
12
+ $widget_ops = array( 'description' => __('Add your social icons to your sidebar.') );
13
+ parent::__construct( 'wc_shortcodes_social_icons', __('WP Canvas - Social Media Icons'), $widget_ops );
14
+ }
15
+
16
+ function widget($args, $instance) {
17
+
18
+ $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
19
+
20
+ echo $args['before_widget'];
21
+
22
+ if ( !empty($instance['title']) )
23
+ echo $args['before_title'] . $instance['title'] . $args['after_title'];
24
+
25
+ if ( empty( $instance['format'] ) ) {
26
+ $instance['format'] = 'default';
27
+ }
28
+ $format = $instance['format'];
29
+
30
+ // set class with the number of columns the user selected
31
+ $columns = $instance['columns'];
32
+ if ( empty($columns) ) {
33
+ $columns = 'float-left';
34
+ }
35
+ $maxheight = 'none';
36
+ if ( isset( $instance['maxheight'] ) ) {
37
+ $maxheight = $instance['maxheight'];
38
+ }
39
+
40
+ $order = get_option( WC_SHORTCODES_PREFIX . 'social_icons_display' );
41
+
42
+ switch ( $format ) {
43
+ case 'default' :
44
+ $format = get_option( WC_SHORTCODES_PREFIX . 'social_icons_format', 'icon' );
45
+ break;
46
+ case 'icon' :
47
+ $format = 'icon';
48
+ break;
49
+ default :
50
+ $format = 'image';
51
+ }
52
+
53
+ $show_image = 'image' == $format ? true : false;
54
+
55
+ if ( ! is_array( $order ) || empty( $order ) ) {
56
+ return;
57
+ }
58
+
59
+ $first = true;
60
+
61
+ $column_display = false;
62
+ if ( is_numeric( $columns ) & (int) $columns > 0 ) {
63
+ $column_display = true;
64
+ }
65
+
66
+ $classes = array();
67
+ $classes[] = 'wc-shortcodes-social-icons';
68
+ $classes[] = 'wc-shortcodes-clearfix';
69
+ $classes[] = 'wc-shortcodes-columns-'.$columns;
70
+ $classes[] = 'wc-shortcodes-maxheight-'.$maxheight;
71
+ $classes[] = 'wc-shortcodes-social-icons-format-'.$format;
72
+
73
+ $html = '<ul class="'.implode( ' ', $classes ).'">';
74
+ $i = 0;
75
+ foreach ($order as $key => $name) {
76
+ $li_class = array();
77
+ $li_class[] = 'wc-shortcodes-social-icon';
78
+ $li_class[] = 'wc-shortcode-social-icon-' . $key;
79
+
80
+ if ( $column_display && $i % $columns == 0 ) {
81
+ $li_class[] = 'clear-left';
82
+ }
83
+
84
+ $link_option_name = WC_SHORTCODES_PREFIX . $key . '_link';
85
+ $image_icon_option_name = WC_SHORTCODES_PREFIX . $key . '_icon';
86
+ $font_icon_option_name = WC_SHORTCODES_PREFIX . $key . '_font_icon';
87
+
88
+ $social_link = get_option( $link_option_name );
89
+ $social_link = apply_filters( 'wc_shortcodes_social_link', $social_link, $key );
90
+
91
+ $first_class = $first ? ' first-icon' : '';
92
+ $first = false;
93
+
94
+ if ( $show_image ) {
95
+ $icon_url = get_option( $image_icon_option_name );
96
+
97
+ $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . $key . $first_class . '">';
98
+ $html .='<a target="_blank" href="'.$social_link.'">';
99
+ $html .= '<img src="'.$icon_url.'" alt="'.$name.'">';
100
+ $html .= '</a>';
101
+ $html .= '</li>';
102
+ }
103
+ else {
104
+ $icon_class = get_option( $font_icon_option_name );
105
+
106
+ $html .= '<li class="wc-shortcodes-social-icon wc-shortcode-social-icon-' . $key . $first_class . '">';
107
+ $html .='<a target="_blank" href="'.$social_link.'">';
108
+ $html .= '<i class="fa '.$icon_class.'"></i>';
109
+ $html .= '</a>';
110
+ $html .= '</li>';
111
+ }
112
+ }
113
+ $html .= '</ul>';
114
+
115
+ echo $html;
116
+
117
+ echo $args['after_widget'];
118
+ }
119
+
120
+ function update( $new_instance, $old_instance ) {
121
+ $instance['title'] = strip_tags( stripslashes($new_instance['title']) );
122
+ $instance['format'] = $new_instance['format'];
123
+ $instance['columns'] = $new_instance['columns'];
124
+ $instance['maxheight'] = $new_instance['maxheight'];
125
+ return $instance;
126
+ }
127
+
128
+ function form( $instance ) {
129
+ $title = isset( $instance['title'] ) ? $instance['title'] : 'Follow Me!';
130
+ $format = isset( $instance['format'] ) ? $instance['format'] : 'default';
131
+ $columns = isset( $instance['columns'] ) ? $instance['columns'] : 'float-left';
132
+ $maxheight = isset( $instance['maxheight'] ) ? $instance['maxheight'] : 'none';
133
+ ?>
134
+ <p>
135
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
136
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
137
+ </p>
138
+ <p>
139
+ <label for="<?php echo $this->get_field_id('format'); ?>"><?php _e('Format:'); ?></label>
140
+ <select id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>">
141
+ <option value="default"<?php selected( $format, 'default' ); ?>>Default</option>';
142
+ <option value="icon"<?php selected( $format, 'icon' ); ?>>Icon</option>';
143
+ <option value="image"<?php selected( $format, 'image' ); ?>>Image</option>';
144
+ </select>
145
+ </p>
146
+ <p>
147
+ <label for="<?php echo $this->get_field_id('columns'); ?>"><?php _e('Display:'); ?></label>
148
+ <select id="<?php echo $this->get_field_id('columns'); ?>" name="<?php echo $this->get_field_name('columns'); ?>">
149
+ <option value="float-center"<?php selected( $columns, 'float-center' ); ?>>Float Center</option>';
150
+ <option value="float-left"<?php selected( $columns, 'float-left' ); ?>>Float Left</option>';
151
+ <option value="float-right"<?php selected( $columns, 'float-right' ); ?>>Float Right</option>';
152
+ <option value="1"<?php selected( $columns, '1' ); ?>>1 Column</option>';
153
+ <option value="2"<?php selected( $columns, '2' ); ?>>2 Columns</option>';
154
+ <option value="3"<?php selected( $columns, '3' ); ?>>3 Columns</option>';
155
+ <option value="4"<?php selected( $columns, '4' ); ?>>4 Columns</option>';
156
+ <option value="5"<?php selected( $columns, '5' ); ?>>5 Columns</option>';
157
+ <option value="6"<?php selected( $columns, '6' ); ?>>6 Columns</option>';
158
+ <option value="7"<?php selected( $columns, '7' ); ?>>7 Columns</option>';
159
+ <option value="8"<?php selected( $columns, '8' ); ?>>8 Columns</option>';
160
+ </select>
161
+ </p>
162
+ <p>
163
+ <label for="<?php echo $this->get_field_id('maxheight'); ?>"><?php _e('Max Height:'); ?></label>
164
+ <select id="<?php echo $this->get_field_id('maxheight'); ?>" name="<?php echo $this->get_field_name('maxheight'); ?>">
165
+ <option value="none"<?php selected( $maxheight, 'none' ); ?>>None</option>';
166
+ <?php for( $i = 10; $i <= 70; $i = $i + 2 ) : ?>
167
+ <option value="<?php echo $i; ?>"<?php selected( $maxheight, $i ); ?>><?php echo $i; ?>px</option>';
168
+ <?php endfor; ?>
169
+ </select>
170
+ </p>
171
+ <script type="text/javascript">
172
+ /* <![CDATA[ */
173
+ jQuery(document).ready(function($){
174
+ $('.wc-shortcodes-social-icons').sortable({ axis: "y" });
175
+ });
176
+ /* ]]> */
177
+ </script>
178
+ <?php
179
+ }
180
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: cbaldelomar
4
  Donate link: http://webplantmedia.com/donate/
5
  Tags: shortcode, shortcodes, accordion, accordions, tab, tabs, toggle, columns, column, section, sections, testimonials, border, borders, button, buttons, fullwidth, full width, notification, notifications, google maps, maps, googlemaps, social icons, progress bar, pricing, pricing box, highlights, image, flags, banners, countdown, rsvp, custom html, code, code snippets, snippets, isotope, masonry, posts, post_type, font awesome, icons, fontawesome, fa icons
6
  Requires at least: 3.7
7
- Tested up to: 4.6.1
8
  Stable tag: trunk
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -88,6 +88,13 @@ Use the shortcode manager in the TinyMCE text editor
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
 
91
  = Version 2.07 =
92
 
93
  * sanitized, escaped, and validated all POST calls
4
  Donate link: http://webplantmedia.com/donate/
5
  Tags: shortcode, shortcodes, accordion, accordions, tab, tabs, toggle, columns, column, section, sections, testimonials, border, borders, button, buttons, fullwidth, full width, notification, notifications, google maps, maps, googlemaps, social icons, progress bar, pricing, pricing box, highlights, image, flags, banners, countdown, rsvp, custom html, code, code snippets, snippets, isotope, masonry, posts, post_type, font awesome, icons, fontawesome, fa icons
6
  Requires at least: 3.7
7
+ Tested up to: 4.7
8
  Stable tag: trunk
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
88
 
89
  == Changelog ==
90
 
91
+ = Version 3.1 =
92
+
93
+ * updated wpc settings framework to version 1.0.3
94
+ * Added option to enter Google Maps API
95
+ * Added style override when jquery ui style was enqueued.
96
+ * Restructured files
97
+
98
  = Version 2.07 =
99
 
100
  * sanitized, escaped, and validated all POST calls
wc-shortcodes.php CHANGED
@@ -5,118 +5,98 @@ 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.07
9
  License: GPLv2 or later
10
  */
11
 
12
- define( 'WC_SHORTCODES_VERSION', '2.07' );
13
- define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
- define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
- define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
16
- define( 'WC_SHORTCODES_CURRENT_VERSION', get_option( WC_SHORTCODES_PREFIX . 'current_version' ) );
17
- define( 'WC_SHORTCODES_FONT_AWESOME_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_font_awesome', true ) );
18
- define( 'WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_slide_post_type', true ) );
19
- define( 'WC_SHORTCODES_PLUGIN_BASENAME', plugin_basename( plugin_dir_path( realpath( __FILE__ ) ) . 'wc-shortcodes.php' ) );
20
-
21
- global $wc_shortcodes_options;
22
- 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
- global $wc_shortcodes_sanitize;
27
-
28
- $wc_shortcodes_options = array();
29
- $wc_shortcodes_social_icons = array(
30
- 'facebook' => 'Facebook',
31
- 'google' => 'Google',
32
- 'twitter' => 'Twitter',
33
- 'pinterest' => 'Pinterest',
34
- 'instagram' => 'Instagram',
35
- 'bloglovin' => 'BlogLovin',
36
- 'flickr' => 'Flickr',
37
- 'rss' => 'RSS',
38
- 'email' => 'Email',
39
- 'custom1' => 'Custom 1',
40
- 'custom2' => 'Custom 2',
41
- 'custom3' => 'Custom 3',
42
- 'custom4' => 'Custom 4',
43
- 'custom5' => 'Custom 5',
44
- );
45
- $wc_shortcodes_share_buttons = array(
46
- 'pinterest' => 'Pinterest',
47
- 'facebook' => 'Facebook',
48
- 'twitter' => 'Twitter',
49
- 'google' => 'Google',
50
- 'email' => 'Email',
51
- 'print' => 'Print',
52
- );
53
- $wc_shortcodes_theme_support = array(
54
- 'theme_reset' => false,
55
- 'fullwidth_container' => '#main',
56
- 'social_icons_format' => 'image',
57
- 'share_buttons_filter_disable' => false,
58
- 'share_buttons_on_post_page' => false,
59
- 'share_buttons_on_blog_page' => false,
60
- 'share_buttons_on_archive_page' => false,
61
- 'share_buttons_on_product_page' => false,
62
- 'facebook_font_icon' => 'fa-facebook',
63
- 'facebook_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/facebook.png',
64
- 'twitter_font_icon' => 'fa-twitter',
65
- 'twitter_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/twitter.png',
66
- 'pinterest_font_icon' => 'fa-pinterest',
67
- 'pinterest_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/pinterest.png',
68
- 'google_font_icon' => 'fa-google-plus',
69
- 'google_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/google.png',
70
- 'bloglovin_font_icon' => 'fa-plus-square',
71
- 'bloglovin_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/bloglovin.png',
72
- 'email_font_icon' => 'fa-envelope',
73
- 'email_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/email.png',
74
- 'flickr_font_icon' => 'fa-flickr',
75
- 'flickr_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/flickr.png',
76
- 'instagram_font_icon' => 'fa-instagram',
77
- 'instagram_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/instagram.png',
78
- 'rss_font_icon' => 'fa-rss',
79
- 'rss_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/rss.png',
80
- 'custom1_font_icon' => 'fa-camera',
81
- 'custom1_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/picasa.png',
82
- 'custom2_font_icon' => 'fa-shopping-cart',
83
- 'custom2_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/shopping.png',
84
- 'custom3_font_icon' => 'fa-youtube',
85
- 'custom3_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/youtube.png',
86
- 'custom4_font_icon' => 'fa-dollar',
87
- 'custom4_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/etsy.png',
88
- 'custom5_font_icon' => 'fa-tumblr',
89
- 'custom5_social_icon' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/tumblr.png',
90
- 'share_buttons_format' => 'image',
91
- 'pinterest_share_text' => 'Pin it',
92
- 'pinterest_share_font_icon' => 'fa-pinterest',
93
- 'pinterest_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/pinterest.png',
94
- 'facebook_share_text' => 'Share',
95
- 'facebook_share_font_icon' => 'fa-facebook',
96
- 'facebook_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/facebook.png',
97
- 'twitter_share_text' => 'Tweet',
98
- 'twitter_share_font_icon' => 'fa-twitter',
99
- 'twitter_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/twitter.png',
100
- 'google_share_text' => 'Share',
101
- 'google_share_font_icon' => 'fa-google-plus',
102
- 'google_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/google.png',
103
- 'email_share_text' => 'Email',
104
- 'email_share_font_icon' => 'fa-envelope',
105
- 'email_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/email.png',
106
- 'print_share_text' => 'Print',
107
- 'print_share_font_icon' => 'fa-print',
108
- 'print_share_button' => WC_SHORTCODES_PLUGIN_URL . 'includes/img/print.png',
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
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 3.1
9
  License: GPLv2 or later
10
  */
11
 
12
+ // If this file is called directly, abort.
13
+ if ( ! defined( 'WPINC' ) ) {
14
+ die;
15
+ }
16
+
17
+ /*----------------------------------------------------------------------------*
18
+ * Public-Facing Functionality
19
+ *----------------------------------------------------------------------------*/
20
+
21
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-vars.php' );
22
+ WPC_Shortcodes_Vars::init_vars();
23
+
24
+ require_once( plugin_dir_path( __FILE__ ) . 'public/functions.php' ); // Adds basic filters and actions
25
+
26
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-public.php' );
27
+
28
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-sanitize.php' );
29
+
30
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-register.php' );
31
+
32
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-hooks.php' );
33
+
34
+ if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
35
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-post-types.php' ); //Adds basic filters and actions
36
+ }
37
+
38
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-ajax-front.php' );
39
+
40
+ foreach ( glob( plugin_dir_path( __FILE__ ) . 'public/widgets/widget-*.php' ) as $filename ) {
41
+ require_once( $filename );
42
+ }
43
+
44
+ require_once( plugin_dir_path( __FILE__ ) . 'public/class-widgets.php' );
45
+
46
+
47
+ // Initialize classes.
48
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Public', 'get_instance' ) );
49
+
50
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Sanitize', 'get_instance' ) );
51
+
52
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Register', 'get_instance' ) );
53
+
54
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Hooks', 'get_instance' ) );
55
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
57
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Post_Types', 'get_instance' ) );
58
+ }
59
+
60
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Ajax_Front', 'get_instance' ) );
61
+
62
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Widgets', 'get_instance' ) );
63
+
64
+
65
+ /*
66
+ * Register hooks that are fired when the plugin is activated or deactivated.
67
+ * When the plugin is deleted, the uninstall.php file is loaded.
68
+ */
69
+ // register_activation_hook( __FILE__, array( 'WPC_Shortcode_Public', 'single_activate' ) );
70
+
71
+ // register_deactivation_hook( __FILE__, array( 'WPC_Shortcode_Public', 'single_deactivate' ) );
72
+
73
+ /*----------------------------------------------------------------------------*
74
+ * Dashboard and Administrative Functionality
75
+ *----------------------------------------------------------------------------*/
76
+
77
+ if ( is_admin() ) {
78
+ if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
79
+
80
+ require_once( plugin_dir_path( __FILE__ ) . 'admin/class-admin.php' );
81
+
82
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/vendors/wpc-settings-framework/init.php' );
83
+
84
+ require_once( plugin_dir_path( __FILE__ ) . 'admin/class-options.php' );
85
+
86
+ require_once( plugin_dir_path( __FILE__ ) . 'admin/class-tinymce-buttons.php' );
87
+
88
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Admin', 'get_instance' ) );
89
+
90
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Options', 'get_instance' ) );
91
+
92
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_TinyMCE_Buttons', 'get_instance' ) );
93
+
94
+ }
95
+ else {
96
+
97
+ require_once( plugin_dir_path( __FILE__ ) . 'admin/class-ajax.php' );
98
+
99
+ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Ajax', 'get_instance' ) );
100
+
101
+ }
102
  }