Galleries by Angie Makes - Version 1.28

Version Description

Download this release

Release Info

Developer cbaldelomar
Plugin Icon wp plugin Galleries by Angie Makes
Version 1.28
Comparing to
See all releases

Code changes from version 1.27 to 1.28

Files changed (43) hide show
  1. README.md +8 -0
  2. includes/css/admin.css +0 -207
  3. includes/css/magnific-popup.css +2 -1
  4. includes/css/style.css +8 -0
  5. includes/functions.php +0 -38
  6. includes/js/jquery.magnific-popup.min.js +4 -3
  7. includes/options.php +260 -242
  8. includes/scripts.php +1 -4
  9. includes/settings.php +0 -315
  10. includes/vendors/wpc-settings-framework/class-wpc-settings-framework.php +1127 -0
  11. includes/vendors/wpc-settings-framework/css/index.php +1 -0
  12. includes/vendors/wpc-settings-framework/css/media-uploader.css +18 -0
  13. includes/vendors/wpc-settings-framework/css/options.css +151 -0
  14. includes/vendors/wpc-settings-framework/img/index.php +1 -0
  15. includes/vendors/wpc-settings-framework/init.php +13 -0
  16. includes/vendors/wpc-settings-framework/js/index.php +1 -0
  17. includes/vendors/wpc-settings-framework/js/media-uploader.js +201 -0
  18. includes/vendors/wpc-settings-framework/js/options.js +46 -0
  19. includes/vendors/wpc-settings-framework/views/group.php +11 -0
  20. includes/vendors/wpc-settings-framework/views/index.php +1 -0
  21. includes/vendors/wpc-settings-framework/views/page.php +30 -0
  22. includes/vendors/wpc-settings-framework/views/settings-error.php +10 -0
  23. includes/vendors/wpc-settings-framework/views/settings/background-options.php +56 -0
  24. includes/vendors/wpc-settings-framework/views/settings/border-fields.php +28 -0
  25. includes/vendors/wpc-settings-framework/views/settings/checkbox-field.php +13 -0
  26. includes/vendors/wpc-settings-framework/views/settings/color-field.php +10 -0
  27. includes/vendors/wpc-settings-framework/views/settings/custom-checkboxes.php +18 -0
  28. includes/vendors/wpc-settings-framework/views/settings/custom-dropdown.php +19 -0
  29. includes/vendors/wpc-settings-framework/views/settings/custom-radio.php +15 -0
  30. includes/vendors/wpc-settings-framework/views/settings/decimal-input-field.php +13 -0
  31. includes/vendors/wpc-settings-framework/views/settings/gallery-fields.php +22 -0
  32. includes/vendors/wpc-settings-framework/views/settings/image-field.php +23 -0
  33. includes/vendors/wpc-settings-framework/views/settings/input-field.php +10 -0
  34. includes/vendors/wpc-settings-framework/views/settings/number-input-field.php +13 -0
  35. includes/vendors/wpc-settings-framework/views/settings/order-show-hide.php +35 -0
  36. includes/vendors/wpc-settings-framework/views/settings/pixel-input-field.php +13 -0
  37. includes/vendors/wpc-settings-framework/views/settings/positive-number-input-field.php +13 -0
  38. includes/vendors/wpc-settings-framework/views/settings/positive-pixel-input-field.php +13 -0
  39. includes/vendors/wpc-settings-framework/views/settings/textarea-field.php +8 -0
  40. includes/vendors/wpc-settings-framework/views/settings/wp-editor.php +11 -0
  41. includes/vendors/wpc-settings-framework/views/tabs.php +85 -0
  42. readme.txt +8 -0
  43. wc-gallery.php +4 -4
README.md CHANGED
@@ -46,6 +46,14 @@ Insert a gallery through your dashboard. You will see extra dropdown settings wh
46
 
47
  ## Changelog ##
48
 
 
 
 
 
 
 
 
 
49
  ### Version 1.27
50
 
51
  * Removed 'Image Size' from gallery option since WordPress includes it by default now.
46
 
47
  ## Changelog ##
48
 
49
+ ### Version 1.28
50
+
51
+ * Removed loading of widgets file
52
+ * Updated options panel with settings framework
53
+ * Fixed style bug with magnific popup
54
+ * Updated Magnific Popup Library
55
+ * FIxed bug with gallery insertion option not being referenced correctly
56
+
57
  ### Version 1.27
58
 
59
  * Removed 'Image Size' from gallery option since WordPress includes it by default now.
includes/css/admin.css DELETED
@@ -1,207 +0,0 @@
1
- /**
2
- * CSS Hacks
3
- *
4
- * Needed common CSS trick
5
- */
6
-
7
- .wc-gallery-clearfix:after {
8
- visibility: hidden;
9
- display: block;
10
- font-size: 0;
11
- content: " ";
12
- clear: both;
13
- height: 0;
14
- }
15
-
16
- .wc-gallery-clearfix { display: inline-block; }
17
-
18
- * html .wc-gallery-clearfix {
19
- height: 1%;
20
- }
21
-
22
- .wc-gallery-clearfix { display: block; }
23
-
24
-
25
- /**
26
- * Google Fonts
27
- *
28
- * Styles for Fonts subpage in Wordpress dashboard
29
- */
30
-
31
- .wc-gallery-font-table {
32
- height: 300px;
33
- width: 450px;
34
- overflow-y: scroll;
35
- overflow-x: hidden;
36
- border: 1px solid #e5e5e5;
37
- }
38
-
39
- .wc-gallery-font-row {
40
- clear: both;
41
- }
42
-
43
- .wc-gallery-font-row:nth-child(even) {
44
- background-color: #e5e5e5;
45
- }
46
-
47
- .wc-gallery-font-title {
48
- width: 200px;
49
- float: left;
50
- padding-right: 10px;
51
- text-align: right;
52
- white-space: nowrap;
53
- }
54
-
55
- .wc-gallery-font-variants {
56
- width: 200px;
57
- float: left;
58
- }
59
-
60
- #wc-gallery-font-preview {
61
- font-size: 28px;
62
- line-height: 1.5;
63
- }
64
-
65
- .wc-gallery-font-preview-text {
66
- margin-right: 10px;
67
- }
68
-
69
- .wc-gallery-font-row-remove {
70
- vertical-align: middle;
71
- }
72
-
73
- .wc-gallery-font-preview-row {
74
- margin-bottom: 15px;
75
- }
76
-
77
-
78
- /**
79
- * Less Variables
80
- */
81
-
82
- .wc-gallery-variables-preview {
83
- margin-right: 190px;
84
- }
85
-
86
- .wc-gallery-variables-table {
87
- border: 1px solid #e5e5e5;
88
- width: 97%;
89
- }
90
-
91
- .wc-gallery-variables-table tr:nth-child(even) {
92
- background-color: #e5e5e5;
93
- }
94
-
95
- .wc-gallery-variables-table td {
96
- padding: 3px;
97
- }
98
-
99
-
100
- /**
101
- * Border Fields
102
- */
103
-
104
- .wc-gallery-font-hover-fields .wc-gallery-text-decoration,
105
- .wc-gallery-border-fields .wc-gallery-border-style,
106
- .wc-gallery-border-fields .wp-border-width,
107
- .wc-gallery-border-fields .wp-picker-container {
108
- margin-bottom: 7px;
109
- }
110
-
111
-
112
- /**
113
- * Font Fields
114
- */
115
-
116
- .wc-gallery-font-fields .wc-gallery-font-teaser,
117
- .wc-gallery-font-fields .wp-picker-container,
118
- .wc-gallery-font-fields select,
119
- .wc-gallery-font-fields input {
120
- margin-bottom: 7px;
121
- }
122
-
123
- .wc-gallery-font-teaser {
124
- display: block;
125
- line-height: 1.5;
126
- }
127
-
128
- .wc-gallery-font-appearance-fields select,
129
- .wc-gallery-font-appearance-fields .wp-picker-container {
130
- margin-bottom: 7px;
131
- }
132
-
133
-
134
- /**
135
- * Media Gallery
136
- *
137
- * Styles for media gallery
138
- */
139
-
140
- .wp-media-buttons-icon {
141
- background: url('../../../../../../../wp-admin/images/media-button.png') no-repeat top left;
142
- display: inline-block;
143
- width: 16px;
144
- height: 16px;
145
- vertical-align: text-top;
146
- margin: 0 2px;
147
- }
148
-
149
- .wc-gallery-preview-image img {
150
- max-width: 700px;
151
- max-height: 200px;
152
- background: #FAFAFA;
153
- border-color: #ccc #eee #eee #ccc;
154
- border-style: solid;
155
- border-width: 1px;
156
- padding: 5px;
157
- }
158
-
159
- .widget .wc-gallery-preview-image img {
160
- padding: 0;
161
- border-width: 0;
162
- max-width: 100%;
163
- }
164
-
165
- .wc-gallery-preview-image {
166
- margin-bottom: 5px;
167
- }
168
-
169
- .wc-gallery-upload-font-textarea {
170
- max-width: 900px;
171
- height: 210px;
172
- width: 97%;
173
- }
174
-
175
- .wc-gallery-social-media-field .button,
176
- .wc-gallery-social-media-field input,
177
- .wc-gallery-image-field .button,
178
- .wc-gallery-image-field input,
179
- .wc-gallery-background-options .button,
180
- .wc-gallery-background-options select,
181
- .wc-gallery-background-options input {
182
- margin-bottom: 7px;
183
- }
184
-
185
-
186
- /**
187
- * Theme Options Display
188
- *
189
- * Specific style for theme options pages
190
- */
191
-
192
- .wc-gallery-theme-options-display .form-table tr:nth-child(odd) {
193
- background-color: #f2f2f2;
194
- }
195
-
196
- .wc-gallery-textarea {
197
- max-width: 900px;
198
- height: 150px;
199
- width: 97%;
200
- }
201
-
202
- .wc-gallery-ajax-submit-button #submit {
203
- outline: 0;
204
- }
205
- .wc-gallery-ajax-submit-button #compile-status {
206
- margin-left: 5px;
207
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/css/magnific-popup.css CHANGED
@@ -157,7 +157,8 @@ button::-moz-focus-inner {
157
  right: 0;
158
  color: #cccccc;
159
  font-size: 12px;
160
- line-height: 18px; }
 
161
 
162
  .mfp-arrow {
163
  position: absolute;
157
  right: 0;
158
  color: #cccccc;
159
  font-size: 12px;
160
+ line-height: 18px;
161
+ white-space: nowrap; }
162
 
163
  .mfp-arrow {
164
  position: absolute;
includes/css/style.css CHANGED
@@ -302,3 +302,11 @@
302
  .mfp-bottom-bar p {
303
  margin-bottom: 0;
304
  }
 
 
 
 
 
 
 
 
302
  .mfp-bottom-bar p {
303
  margin-bottom: 0;
304
  }
305
+ .mfp-arrow:hover,
306
+ .mfp-arrow:active,
307
+ .mfp-arrow:focus {
308
+ top: 50%;
309
+ }
310
+ body .mfp-arrow:active {
311
+ margin-top: -55px;
312
+ }
includes/functions.php CHANGED
@@ -14,44 +14,6 @@ function wc_gallery_check_supports() {
14
  }
15
  add_action( 'init', 'wc_gallery_check_supports' );
16
 
17
- /*
18
- * Activation
19
- */
20
- function wc_gallery_options_activation_hook() {
21
- global $wc_gallery_options;
22
-
23
- $initialize = false;
24
-
25
- if ( ! WC_GALLERY_CURRENT_VERSION ) {
26
- $initialize = true;
27
- }
28
- else if ( version_compare( WC_GALLERY_VERSION, WC_GALLERY_CURRENT_VERSION ) > 0 ) {
29
- $initialize = true;
30
- }
31
-
32
- if ( $initialize ) {
33
- update_option( WC_GALLERY_PREFIX . 'current_version', WC_GALLERY_VERSION );
34
-
35
- foreach ( $wc_gallery_options as $o ) {
36
- foreach ( $o['sections'] as $oo ) {
37
- foreach ( $oo['options'] as $ooo ) {
38
- if ( isset( $ooo['group'] ) && is_array( $ooo['group'] ) ) {
39
- foreach ( $ooo['group'] as $key => $oooo ) {
40
- $option_name = WC_GALLERY_PREFIX . $oooo['id'];
41
- add_option( $option_name, $oooo['default'] );
42
- }
43
- }
44
- else {
45
- $option_name = WC_GALLERY_PREFIX . $ooo['id'];
46
- add_option( $option_name, $ooo['default'] );
47
- }
48
- }
49
- }
50
- }
51
- }
52
- }
53
- add_action( 'init', 'wc_gallery_options_activation_hook', 200 );
54
-
55
  /**
56
  * The Gallery shortcode.
57
  *
14
  }
15
  add_action( 'init', 'wc_gallery_check_supports' );
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * The Gallery shortcode.
19
  *
includes/js/jquery.magnific-popup.min.js CHANGED
@@ -1,3 +1,4 @@
1
- // Magnific Popup v0.9.9 by Dmitry Semenov
2
- // http://bit.ly/magnific-popup#build=inline+image+ajax+iframe+gallery+retina+imagezoom+fastclick
3
- (function(a){var b="Close",c="BeforeClose",d="AfterClose",e="BeforeAppend",f="MarkupParse",g="Open",h="Change",i="mfp",j="."+i,k="mfp-ready",l="mfp-removing",m="mfp-prevent-close",n,o=function(){},p=!!window.jQuery,q,r=a(window),s,t,u,v,w,x=function(a,b){n.ev.on(i+a+j,b)},y=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},z=function(b,c){n.ev.triggerHandler(i+b,c),n.st.callbacks&&(b=b.charAt(0).toLowerCase()+b.slice(1),n.st.callbacks[b]&&n.st.callbacks[b].apply(n,a.isArray(c)?c:[c]))},A=function(b){if(b!==w||!n.currTemplate.closeBtn)n.currTemplate.closeBtn=a(n.st.closeMarkup.replace("%title%",n.st.tClose)),w=b;return n.currTemplate.closeBtn},B=function(){a.magnificPopup.instance||(n=new o,n.init(),a.magnificPopup.instance=n)},C=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(a.transition!==undefined)return!0;while(b.length)if(b.pop()+"Transition"in a)return!0;return!1};o.prototype={constructor:o,init:function(){var b=navigator.appVersion;n.isIE7=b.indexOf("MSIE 7.")!==-1,n.isIE8=b.indexOf("MSIE 8.")!==-1,n.isLowIE=n.isIE7||n.isIE8,n.isAndroid=/android/gi.test(b),n.isIOS=/iphone|ipad|ipod/gi.test(b),n.supportsTransition=C(),n.probablyMobile=n.isAndroid||n.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),t=a(document),n.popupsCache={}},open:function(b){s||(s=a(document.body));var c;if(b.isObj===!1){n.items=b.items.toArray(),n.index=0;var d=b.items,e;for(c=0;c<d.length;c++){e=d[c],e.parsed&&(e=e.el[0]);if(e===b.el[0]){n.index=c;break}}}else n.items=a.isArray(b.items)?b.items:[b.items],n.index=b.index||0;if(n.isOpen){n.updateItemHTML();return}n.types=[],v="",b.mainEl&&b.mainEl.length?n.ev=b.mainEl.eq(0):n.ev=t,b.key?(n.popupsCache[b.key]||(n.popupsCache[b.key]={}),n.currTemplate=n.popupsCache[b.key]):n.currTemplate={},n.st=a.extend(!0,{},a.magnificPopup.defaults,b),n.fixedContentPos=n.st.fixedContentPos==="auto"?!n.probablyMobile:n.st.fixedContentPos,n.st.modal&&(n.st.closeOnContentClick=!1,n.st.closeOnBgClick=!1,n.st.showCloseBtn=!1,n.st.enableEscapeKey=!1),n.bgOverlay||(n.bgOverlay=y("bg").on("click"+j,function(){n.close()}),n.wrap=y("wrap").attr("tabindex",-1).on("click"+j,function(a){n._checkIfClose(a.target)&&n.close()}),n.container=y("container",n.wrap)),n.contentContainer=y("content"),n.st.preloader&&(n.preloader=y("preloader",n.container,n.st.tLoading));var h=a.magnificPopup.modules;for(c=0;c<h.length;c++){var i=h[c];i=i.charAt(0).toUpperCase()+i.slice(1),n["init"+i].call(n)}z("BeforeOpen"),n.st.showCloseBtn&&(n.st.closeBtnInside?(x(f,function(a,b,c,d){c.close_replaceWith=A(d.type)}),v+=" mfp-close-btn-in"):n.wrap.append(A())),n.st.alignTop&&(v+=" mfp-align-top"),n.fixedContentPos?n.wrap.css({overflow:n.st.overflowY,overflowX:"hidden",overflowY:n.st.overflowY}):n.wrap.css({top:r.scrollTop(),position:"absolute"}),(n.st.fixedBgPos===!1||n.st.fixedBgPos==="auto"&&!n.fixedContentPos)&&n.bgOverlay.css({height:t.height(),position:"absolute"}),n.st.enableEscapeKey&&t.on("keyup"+j,function(a){a.keyCode===27&&n.close()}),r.on("resize"+j,function(){n.updateSize()}),n.st.closeOnContentClick||(v+=" mfp-auto-cursor"),v&&n.wrap.addClass(v);var l=n.wH=r.height(),m={};if(n.fixedContentPos&&n._hasScrollBar(l)){var o=n._getScrollbarSize();o&&(m.marginRight=o)}n.fixedContentPos&&(n.isIE7?a("body, html").css("overflow","hidden"):m.overflow="hidden");var p=n.st.mainClass;return n.isIE7&&(p+=" mfp-ie7"),p&&n._addClassToMFP(p),n.updateItemHTML(),z("BuildControls"),a("html").css(m),n.bgOverlay.add(n.wrap).prependTo(n.st.prependTo||s),n._lastFocusedEl=document.activeElement,setTimeout(function(){n.content?(n._addClassToMFP(k),n._setFocus()):n.bgOverlay.addClass(k),t.on("focusin"+j,n._onFocusIn)},16),n.isOpen=!0,n.updateSize(l),z(g),b},close:function(){if(!n.isOpen)return;z(c),n.isOpen=!1,n.st.removalDelay&&!n.isLowIE&&n.supportsTransition?(n._addClassToMFP(l),setTimeout(function(){n._close()},n.st.removalDelay)):n._close()},_close:function(){z(b);var c=l+" "+k+" ";n.bgOverlay.detach(),n.wrap.detach(),n.container.empty(),n.st.mainClass&&(c+=n.st.mainClass+" "),n._removeClassFromMFP(c);if(n.fixedContentPos){var e={marginRight:""};n.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}t.off("keyup"+j+" focusin"+j),n.ev.off(j),n.wrap.attr("class","mfp-wrap").removeAttr("style"),n.bgOverlay.attr("class","mfp-bg"),n.container.attr("class","mfp-container"),n.st.showCloseBtn&&(!n.st.closeBtnInside||n.currTemplate[n.currItem.type]===!0)&&n.currTemplate.closeBtn&&n.currTemplate.closeBtn.detach(),n._lastFocusedEl&&a(n._lastFocusedEl).focus(),n.currItem=null,n.content=null,n.currTemplate=null,n.prevHeight=0,z(d)},updateSize:function(a){if(n.isIOS){var b=document.documentElement.clientWidth/window.innerWidth,c=window.innerHeight*b;n.wrap.css("height",c),n.wH=c}else n.wH=a||r.height();n.fixedContentPos||n.wrap.css("height",n.wH),z("Resize")},updateItemHTML:function(){var b=n.items[n.index];n.contentContainer.detach(),n.content&&n.content.detach(),b.parsed||(b=n.parseEl(n.index));var c=b.type;z("BeforeChange",[n.currItem?n.currItem.type:"",c]),n.currItem=b;if(!n.currTemplate[c]){var d=n.st[c]?n.st[c].markup:!1;z("FirstMarkupParse",d),d?n.currTemplate[c]=a(d):n.currTemplate[c]=!0}u&&u!==b.type&&n.container.removeClass("mfp-"+u+"-holder");var e=n["get"+c.charAt(0).toUpperCase()+c.slice(1)](b,n.currTemplate[c]);n.appendContent(e,c),b.preloaded=!0,z(h,b),u=b.type,n.container.prepend(n.contentContainer),z("AfterChange")},appendContent:function(a,b){n.content=a,a?n.st.showCloseBtn&&n.st.closeBtnInside&&n.currTemplate[b]===!0?n.content.find(".mfp-close").length||n.content.append(A()):n.content=a:n.content="",z(e),n.container.addClass("mfp-"+b+"-holder"),n.contentContainer.append(n.content)},parseEl:function(b){var c=n.items[b],d;c.tagName?c={el:a(c)}:(d=c.type,c={data:c,src:c.src});if(c.el){var e=n.types;for(var f=0;f<e.length;f++)if(c.el.hasClass("mfp-"+e[f])){d=e[f];break}c.src=c.el.attr("data-mfp-src"),c.src||(c.src=c.el.attr("href"))}return c.type=d||n.st.type||"inline",c.index=b,c.parsed=!0,n.items[b]=c,z("ElementParse",c),n.items[b]},addGroup:function(a,b){var c=function(c){c.mfpEl=this,n._openClick(c,a,b)};b||(b={});var d="click.magnificPopup";b.mainEl=a,b.items?(b.isObj=!0,a.off(d).on(d,c)):(b.isObj=!1,b.delegate?a.off(d).on(d,b.delegate,c):(b.items=a,a.off(d).on(d,c)))},_openClick:function(b,c,d){var e=d.midClick!==undefined?d.midClick:a.magnificPopup.defaults.midClick;if(!e&&(b.which===2||b.ctrlKey||b.metaKey))return;var f=d.disableOn!==undefined?d.disableOn:a.magnificPopup.defaults.disableOn;if(f)if(a.isFunction(f)){if(!f.call(n))return!0}else if(r.width()<f)return!0;b.type&&(b.preventDefault(),n.isOpen&&b.stopPropagation()),d.el=a(b.mfpEl),d.delegate&&(d.items=c.find(d.delegate)),n.open(d)},updateStatus:function(a,b){if(n.preloader){q!==a&&n.container.removeClass("mfp-s-"+q),!b&&a==="loading"&&(b=n.st.tLoading);var c={status:a,text:b};z("UpdateStatus",c),a=c.status,b=c.text,n.preloader.html(b),n.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),n.container.addClass("mfp-s-"+a),q=a}},_checkIfClose:function(b){if(a(b).hasClass(m))return;var c=n.st.closeOnContentClick,d=n.st.closeOnBgClick;if(c&&d)return!0;if(!n.content||a(b).hasClass("mfp-close")||n.preloader&&b===n.preloader[0])return!0;if(b!==n.content[0]&&!a.contains(n.content[0],b)){if(d&&a.contains(document,b))return!0}else if(c)return!0;return!1},_addClassToMFP:function(a){n.bgOverlay.addClass(a),n.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),n.wrap.removeClass(a)},_hasScrollBar:function(a){return(n.isIE7?t.height():document.body.scrollHeight)>(a||r.height())},_setFocus:function(){(n.st.focus?n.content.find(n.st.focus).eq(0):n.wrap).focus()},_onFocusIn:function(b){if(b.target!==n.wrap[0]&&!a.contains(n.wrap[0],b.target))return n._setFocus(),!1},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),z(f,[b,c,d]),a.each(c,function(a,c){if(c===undefined||c===!1)return!0;e=a.split("_");if(e.length>1){var d=b.find(j+"-"+e[0]);if(d.length>0){var f=e[1];f==="replaceWith"?d[0]!==c[0]&&d.replaceWith(c):f==="img"?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(j+"-"+a).html(c)})},_getScrollbarSize:function(){if(n.scrollbarSize===undefined){var a=document.createElement("div");a.id="mfp-sbm",a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),n.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return n.scrollbarSize}},a.magnificPopup={instance:null,proto:o.prototype,modules:[],open:function(b,c){return B(),b?b=a.extend(!0,{},b):b={},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(b){B();var c=a(this);if(typeof b=="string")if(b==="open"){var d,e=p?c.data("magnificPopup"):c[0].magnificPopup,f=parseInt(arguments[1],10)||0;e.items?d=e.items[f]:(d=c,e.delegate&&(d=d.find(e.delegate)),d=d.eq(f)),n._openClick({mfpEl:d},c,e)}else n.isOpen&&n[b].apply(n,Array.prototype.slice.call(arguments,1));else b=a.extend(!0,{},b),p?c.data("magnificPopup",b):c[0].magnificPopup=b,n.addGroup(c,b);return c};var D="inline",E,F,G,H=function(){G&&(F.after(G.addClass(E)).detach(),G=null)};a.magnificPopup.registerModule(D,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){n.types.push(D),x(b+"."+D,function(){H()})},getInline:function(b,c){H();if(b.src){var d=n.st.inline,e=a(b.src);if(e.length){var f=e[0].parentNode;f&&f.tagName&&(F||(E=d.hiddenClass,F=y(E),E="mfp-"+E),G=e.after(F).detach().removeClass(E)),n.updateStatus("ready")}else n.updateStatus("error",d.tNotFound),e=a("<div>");return b.inlineElement=e,e}return n.updateStatus("ready"),n._parseMarkup(c,{},b),c}}});var I="ajax",J,K=function(){J&&s.removeClass(J)},L=function(){K(),n.req&&n.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){n.types.push(I),J=n.st.ajax.cursor,x(b+"."+I,L),x("BeforeChange."+I,L)},getAjax:function(b){J&&s.addClass(J),n.updateStatus("loading");var c=a.extend({url:b.src,success:function(c,d,e){var f={data:c,xhr:e};z("ParseAjax",f),n.appendContent(a(f.data),I),b.finished=!0,K(),n._setFocus(),setTimeout(function(){n.wrap.addClass(k)},16),n.updateStatus("ready"),z("AjaxContentAdded")},error:function(){K(),b.finished=b.loadError=!0,n.updateStatus("error",n.st.ajax.tError.replace("%url%",b.src))}},n.st.ajax.settings);return n.req=a.ajax(c),""}}});var M,N=function(b){if(b.data&&b.data.title!==undefined)return b.data.title;var c=n.st.image.titleSrc;if(c){if(a.isFunction(c))return c.call(n,b);if(b.el)return b.el.attr(c)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var a=n.st.image,c=".image";n.types.push("image"),x(g+c,function(){n.currItem.type==="image"&&a.cursor&&s.addClass(a.cursor)}),x(b+c,function(){a.cursor&&s.removeClass(a.cursor),r.off("resize"+j)}),x("Resize"+c,n.resizeImage),n.isLowIE&&x("AfterChange",n.resizeImage)},resizeImage:function(){var a=n.currItem;if(!a||!a.img)return;if(n.st.image.verticalFit){var b=0;n.isLowIE&&(b=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",n.wH-b)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,M&&clearInterval(M),a.isCheckingImgSize=!1,z("ImageHasSize",a),a.imgHidden&&(n.content&&n.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var b=0,c=a.img[0],d=function(e){M&&clearInterval(M),M=setInterval(function(){if(c.naturalWidth>0){n._onImageHasSize(a);return}b>200&&clearInterval(M),b++,b===3?d(10):b===40?d(50):b===100&&d(500)},e)};d(1)},getImage:function(b,c){var d=0,e=function(){b&&(b.img[0].complete?(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("ready")),b.hasSize=!0,b.loaded=!0,z("ImageLoadComplete")):(d++,d<200?setTimeout(e,100):f()))},f=function(){b&&(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("error",g.tError.replace("%url%",b.src))),b.hasSize=!0,b.loaded=!0,b.loadError=!0)},g=n.st.image,h=c.find(".mfp-img");if(h.length){var i=document.createElement("img");i.className="mfp-img",b.img=a(i).on("load.mfploader",e).on("error.mfploader",f),i.src=b.src,h.is("img")&&(b.img=b.img.clone()),i=b.img[0],i.naturalWidth>0?b.hasSize=!0:i.width||(b.hasSize=!1)}return n._parseMarkup(c,{title:N(b),img_replaceWith:b.img},b),n.resizeImage(),b.hasSize?(M&&clearInterval(M),b.loadError?(c.addClass("mfp-loading"),n.updateStatus("error",g.tError.replace("%url%",b.src))):(c.removeClass("mfp-loading"),n.updateStatus("ready")),c):(n.updateStatus("loading"),b.loading=!0,b.hasSize||(b.imgHidden=!0,c.addClass("mfp-loading"),n.findImageSize(b)),c)}}});var O,P=function(){return O===undefined&&(O=document.createElement("p").style.MozTransform!==undefined),O};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a=n.st.zoom,d=".zoom",e;if(!a.enabled||!n.supportsTransition)return;var f=a.duration,g=function(b){var c=b.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+a.duration/1e3+"s "+a.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,c.css(e),c},h=function(){n.content.css("visibility","visible")},i,j;x("BuildControls"+d,function(){if(n._allowZoom()){clearTimeout(i),n.content.css("visibility","hidden"),e=n._getItemToZoom();if(!e){h();return}j=g(e),j.css(n._getOffset()),n.wrap.append(j),i=setTimeout(function(){j.css(n._getOffset(!0)),i=setTimeout(function(){h(),setTimeout(function(){j.remove(),e=j=null,z("ZoomAnimationEnded")},16)},f)},16)}}),x(c+d,function(){if(n._allowZoom()){clearTimeout(i),n.st.removalDelay=f;if(!e){e=n._getItemToZoom();if(!e)return;j=g(e)}j.css(n._getOffset(!0)),n.wrap.append(j),n.content.css("visibility","hidden"),setTimeout(function(){j.css(n._getOffset())},16)}}),x(b+d,function(){n._allowZoom()&&(h(),j&&j.remove(),e=null)})},_allowZoom:function(){return n.currItem.type==="image"},_getItemToZoom:function(){return n.currItem.hasSize?n.currItem.img:!1},_getOffset:function(b){var c;b?c=n.currItem.img:c=n.st.zoom.opener(n.currItem.el||n.currItem);var d=c.offset(),e=parseInt(c.css("padding-top"),10),f=parseInt(c.css("padding-bottom"),10);d.top-=a(window).scrollTop()-e;var g={width:c.width(),height:(p?c.innerHeight():c[0].offsetHeight)-f-e};return P()?g["-moz-transform"]=g.transform="translate("+d.left+"px,"+d.top+"px)":(g.left=d.left,g.top=d.top),g}}});var Q="iframe",R="//about:blank",S=function(a){if(n.currTemplate[Q]){var b=n.currTemplate[Q].find("iframe");b.length&&(a||(b[0].src=R),n.isIE8&&b.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(Q,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){n.types.push(Q),x("BeforeChange",function(a,b,c){b!==c&&(b===Q?S():c===Q&&S(!0))}),x(b+"."+Q,function(){S()})},getIframe:function(b,c){var d=b.src,e=n.st.iframe;a.each(e.patterns,function(){if(d.indexOf(this.index)>-1)return this.id&&(typeof this.id=="string"?d=d.substr(d.lastIndexOf(this.id)+this.id.length,d.length):d=this.id.call(this,d)),d=this.src.replace("%id%",d),!1});var f={};return e.srcAction&&(f[e.srcAction]=d),n._parseMarkup(c,f,b),n.updateStatus("ready"),c}}});var T=function(a){var b=n.items.length;return a>b-1?a-b:a<0?b+a:a},U=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=n.st.gallery,d=".mfp-gallery",e=Boolean(a.fn.mfpFastClick);n.direction=!0;if(!c||!c.enabled)return!1;v+=" mfp-gallery",x(g+d,function(){c.navigateByImgClick&&n.wrap.on("click"+d,".mfp-img",function(){if(n.items.length>1)return n.next(),!1}),t.on("keydown"+d,function(a){a.keyCode===37?n.prev():a.keyCode===39&&n.next()})}),x("UpdateStatus"+d,function(a,b){b.text&&(b.text=U(b.text,n.currItem.index,n.items.length))}),x(f+d,function(a,b,d,e){var f=n.items.length;d.counter=f>1?U(c.tCounter,e.index,f):""}),x("BuildControls"+d,function(){if(n.items.length>1&&c.arrows&&!n.arrowLeft){var b=c.arrowMarkup,d=n.arrowLeft=a(b.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(m),f=n.arrowRight=a(b.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(m),g=e?"mfpFastClick":"click";d[g](function(){n.prev()}),f[g](function(){n.next()}),n.isIE7&&(y("b",d[0],!1,!0),y("a",d[0],!1,!0),y("b",f[0],!1,!0),y("a",f[0],!1,!0)),n.container.append(d.add(f))}}),x(h+d,function(){n._preloadTimeout&&clearTimeout(n._preloadTimeout),n._preloadTimeout=setTimeout(function(){n.preloadNearbyImages(),n._preloadTimeout=null},16)}),x(b+d,function(){t.off(d),n.wrap.off("click"+d),n.arrowLeft&&e&&n.arrowLeft.add(n.arrowRight).destroyMfpFastClick(),n.arrowRight=n.arrowLeft=null})},next:function(){n.direction=!0,n.index=T(n.index+1),n.updateItemHTML()},prev:function(){n.direction=!1,n.index=T(n.index-1),n.updateItemHTML()},goTo:function(a){n.direction=a>=n.index,n.index=a,n.updateItemHTML()},preloadNearbyImages:function(){var a=n.st.gallery.preload,b=Math.min(a[0],n.items.length),c=Math.min(a[1],n.items.length),d;for(d=1;d<=(n.direction?c:b);d++)n._preloadItem(n.index+d);for(d=1;d<=(n.direction?b:c);d++)n._preloadItem(n.index-d)},_preloadItem:function(b){b=T(b);if(n.items[b].preloaded)return;var c=n.items[b];c.parsed||(c=n.parseEl(b)),z("LazyLoad",c),c.type==="image"&&(c.img=a('<img class="mfp-img" />').on("load.mfploader",function(){c.hasSize=!0}).on("error.mfploader",function(){c.hasSize=!0,c.loadError=!0,z("LazyLoadError",c)}).attr("src",c.src)),c.preloaded=!0}}});var V="retina";a.magnificPopup.registerModule(V,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=n.st.retina,b=a.ratio;b=isNaN(b)?b():b,b>1&&(x("ImageHasSize."+V,function(a,c){c.img.css({"max-width":c.img[0].naturalWidth/b,width:"100%"})}),x("ElementParse."+V,function(c,d){d.src=a.replaceSrc(d,b)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){r.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g=a(this),h;if(c){var i,j,k,l,m,n;g.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,r.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0];if(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)l=!0,d()}).on("touchend"+f,function(a){d();if(l||n>1)return;h=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){h=!1},b),e()})})}g.on("click"+f,function(){h||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&r.off("touchmove"+f+" touchend"+f)}}(),B()})(window.jQuery||window.Zepto)
 
1
+ /*! Magnific Popup - v1.0.0 - 2014-12-12
2
+ * http://dimsemenov.com/plugins/magnific-popup/
3
+ * Copyright (c) 2014 Dmitry Semenov; */
4
+ (function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(window.jQuery||window.Zepto)})(function(e){var t,n,i,o,r,a,s,l="Close",c="BeforeClose",d="AfterClose",u="BeforeAppend",p="MarkupParse",f="Open",m="Change",g="mfp",h="."+g,v="mfp-ready",C="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,I=e(window),x=function(e,n){t.ev.on(g+e+h,n)},k=function(t,n,i,o){var r=document.createElement("div");return r.className="mfp-"+t,i&&(r.innerHTML=i),o?n&&n.appendChild(r):(r=e(r),n&&r.appendTo(n)),r},T=function(n,i){t.ev.triggerHandler(g+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},E=function(n){return n===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=n),t.currTemplate.closeBtn},_=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},S=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var n=navigator.appVersion;t.isIE7=-1!==n.indexOf("MSIE 7."),t.isIE8=-1!==n.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=S(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),o=e(document),t.popupsCache={}},open:function(n){i||(i=e(document.body));var r;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var s,l=n.items;for(r=0;l.length>r;r++)if(s=l[r],s.parsed&&(s=s.el[0]),s===n.el[0]){t.index=r;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],a="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):o,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=k("bg").on("click"+h,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var c=e.magnificPopup.modules;for(r=0;c.length>r;r++){var d=c[r];d=d.charAt(0).toUpperCase()+d.slice(1),t["init"+d].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(p,function(e,t,n,i){n.close_replaceWith=E(i.type)}),a+=" mfp-close-btn-in"):t.wrap.append(E())),t.st.alignTop&&(a+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:I.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}),t.st.enableEscapeKey&&o.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),I.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(a+=" mfp-auto-cursor"),a&&t.wrap.addClass(a);var u=t.wH=I.height(),m={};if(t.fixedContentPos&&t._hasScrollBar(u)){var g=t._getScrollbarSize();g&&(m.marginRight=g)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):m.overflow="hidden");var C=t.st.mainClass;return t.isIE7&&(C+=" mfp-ie7"),C&&t._addClassToMFP(C),t.updateItemHTML(),T("BuildControls"),e("html").css(m),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||i),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),t._setFocus()):t.bgOverlay.addClass(v),o.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(u),T(f),n},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(C),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var n=C+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var i={marginRight:""};t.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}o.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,T(d)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||I.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(T("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var o=t.st[i]?t.st[i].markup:!1;T("FirstMarkupParse",o),t.currTemplate[i]=o?e(o):!0}r&&r!==n.type&&t.container.removeClass("mfp-"+r+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,T(m,n),r=n.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".mfp-close").length||t.content.append(E()):t.content=e:t.content="",T(u),t.container.addClass("mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i,o=t.items[n];if(o.tagName?o={el:e(o)}:(i=o.type,o={data:o,src:o.src}),o.el){for(var r=t.types,a=0;r.length>a;a++)if(o.el.hasClass("mfp-"+r[a])){i=r[a];break}o.src=o.el.attr("data-mfp-src"),o.src||(o.src=o.el.attr("href"))}return o.type=i||t.st.type||"inline",o.index=n,o.parsed=!0,t.items[n]=o,T("ElementParse",o),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var o="click.magnificPopup";n.mainEl=e,n.items?(n.isObj=!0,e.off(o).on(o,i)):(n.isObj=!1,n.delegate?e.off(o).on(o,n.delegate,i):(n.items=e,e.off(o).on(o,i)))},_openClick:function(n,i,o){var r=void 0!==o.midClick?o.midClick:e.magnificPopup.defaults.midClick;if(r||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==o.disableOn?o.disableOn:e.magnificPopup.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(a>I.width())return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),o.el=e(n.mfpEl),o.delegate&&(o.items=i.find(o.delegate)),t.open(o)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var o={status:e,text:i};T("UpdateStatus",o),e=o.status,i=o.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(y)){var i=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(i&&o)return!0;if(!t.content||e(n).hasClass("mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(o&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?o.height():document.body.scrollHeight)>(e||I.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){return n.target===t.wrap[0]||e.contains(t.wrap[0],n.target)?void 0:(t._setFocus(),!1)},_parseMarkup:function(t,n,i){var o;i.data&&(n=e.extend(i.data,n)),T(p,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(o=e.split("_"),o.length>1){var i=t.find(h+"-"+o[0]);if(i.length>0){var r=o[1];"replaceWith"===r?i[0]!==n[0]&&i.replaceWith(n):"img"===r?i.is("img")?i.attr("src",n):i.replaceWith('<img src="'+n+'" class="'+i.attr("class")+'" />'):i.attr(o[1],n)}}else t.find(h+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return _(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){_();var i=e(this);if("string"==typeof n)if("open"===n){var o,r=b?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;r.items?o=r.items[a]:(o=i,r.delegate&&(o=o.find(r.delegate)),o=o.eq(a)),t._openClick({mfpEl:o},i,r)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),b?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var P,O,z,M="inline",B=function(){z&&(O.after(z.addClass(P)).detach(),z=null)};e.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(M),x(l+"."+M,function(){B()})},getInline:function(n,i){if(B(),n.src){var o=t.st.inline,r=e(n.src);if(r.length){var a=r[0].parentNode;a&&a.tagName&&(O||(P=o.hiddenClass,O=k(P),P="mfp-"+P),z=r.after(O).detach().removeClass(P)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),r=e("<div>");return n.inlineElement=r,r}return t.updateStatus("ready"),t._parseMarkup(i,{},n),i}}});var F,H="ajax",L=function(){F&&i.removeClass(F)},A=function(){L(),t.req&&t.req.abort()};e.magnificPopup.registerModule(H,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){t.types.push(H),F=t.st.ajax.cursor,x(l+"."+H,A),x("BeforeChange."+H,A)},getAjax:function(n){F&&i.addClass(F),t.updateStatus("loading");var o=e.extend({url:n.src,success:function(i,o,r){var a={data:i,xhr:r};T("ParseAjax",a),t.appendContent(e(a.data),H),n.finished=!0,L(),t._setFocus(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){L(),n.finished=n.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",n.src))}},t.st.ajax.settings);return t.req=e.ajax(o),""}}});var j,N=function(n){if(n.data&&void 0!==n.data.title)return n.data.title;var i=t.st.image.titleSrc;if(i){if(e.isFunction(i))return i.call(t,n);if(n.el)return n.el.attr(i)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=t.st.image,n=".image";t.types.push("image"),x(f+n,function(){"image"===t.currItem.type&&e.cursor&&i.addClass(e.cursor)}),x(l+n,function(){e.cursor&&i.removeClass(e.cursor),I.off("resize"+h)}),x("Resize"+n,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var n=0;t.isLowIE&&(n=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-n)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,j&&clearInterval(j),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var n=0,i=e.img[0],o=function(r){j&&clearInterval(j),j=setInterval(function(){return i.naturalWidth>0?(t._onImageHasSize(e),void 0):(n>200&&clearInterval(j),n++,3===n?o(10):40===n?o(50):100===n&&o(500),void 0)},r)};o(1)},getImage:function(n,i){var o=0,r=function(){n&&(n.img[0].complete?(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("ready")),n.hasSize=!0,n.loaded=!0,T("ImageLoadComplete")):(o++,200>o?setTimeout(r,100):a()))},a=function(){n&&(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("error",s.tError.replace("%url%",n.src))),n.hasSize=!0,n.loaded=!0,n.loadError=!0)},s=t.st.image,l=i.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",n.el&&n.el.find("img").length&&(c.alt=n.el.find("img").attr("alt")),n.img=e(c).on("load.mfploader",r).on("error.mfploader",a),c.src=n.src,l.is("img")&&(n.img=n.img.clone()),c=n.img[0],c.naturalWidth>0?n.hasSize=!0:c.width||(n.hasSize=!1)}return t._parseMarkup(i,{title:N(n),img_replaceWith:n.img},n),t.resizeImage(),n.hasSize?(j&&clearInterval(j),n.loadError?(i.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",n.src))):(i.removeClass("mfp-loading"),t.updateStatus("ready")),i):(t.updateStatus("loading"),n.loading=!0,n.hasSize||(n.imgHidden=!0,i.addClass("mfp-loading"),t.findImageSize(n)),i)}}});var W,R=function(){return void 0===W&&(W=void 0!==document.createElement("p").style.MozTransform),W};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,n=t.st.zoom,i=".zoom";if(n.enabled&&t.supportsTransition){var o,r,a=n.duration,s=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),i="all "+n.duration/1e3+"s "+n.easing,o={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},r="transition";return o["-webkit-"+r]=o["-moz-"+r]=o["-o-"+r]=o[r]=i,t.css(o),t},d=function(){t.content.css("visibility","visible")};x("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return d(),void 0;r=s(e),r.css(t._getOffset()),t.wrap.append(r),o=setTimeout(function(){r.css(t._getOffset(!0)),o=setTimeout(function(){d(),setTimeout(function(){r.remove(),e=r=null,T("ZoomAnimationEnded")},16)},a)},16)}}),x(c+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.st.removalDelay=a,!e){if(e=t._getItemToZoom(),!e)return;r=s(e)}r.css(t._getOffset(!0)),t.wrap.append(r),t.content.css("visibility","hidden"),setTimeout(function(){r.css(t._getOffset())},16)}}),x(l+i,function(){t._allowZoom()&&(d(),r&&r.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(n){var i;i=n?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var o=i.offset(),r=parseInt(i.css("padding-top"),10),a=parseInt(i.css("padding-bottom"),10);o.top-=e(window).scrollTop()-r;var s={width:i.width(),height:(b?i.innerHeight():i[0].offsetHeight)-a-r};return R()?s["-moz-transform"]=s.transform="translate("+o.left+"px,"+o.top+"px)":(s.left=o.left,s.top=o.top),s}}});var Z="iframe",q="//about:blank",D=function(e){if(t.currTemplate[Z]){var n=t.currTemplate[Z].find("iframe");n.length&&(e||(n[0].src=q),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(Z,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(Z),x("BeforeChange",function(e,t,n){t!==n&&(t===Z?D():n===Z&&D(!0))}),x(l+"."+Z,function(){D()})},getIframe:function(n,i){var o=n.src,r=t.st.iframe;e.each(r.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var a={};return r.srcAction&&(a[r.srcAction]=o),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var K=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},Y=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,i=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",x(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+i,function(e,n){n.text&&(n.text=Y(n.text,t.currItem.index,t.items.length))}),x(p+i,function(e,i,o,r){var a=t.items.length;o.counter=a>1?Y(n.tCounter,r.index,a):""}),x("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,o=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=r?"mfpFastClick":"click";o[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(o.add(a))}}),x(m+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+i,function(){o.off(i),t.wrap.off("click"+i),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=K(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=K(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),o=Math.min(n[1],t.items.length);for(e=1;(t.direction?o:i)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?i:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=K(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('<img class="mfp-img" />').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()});
includes/options.php CHANGED
@@ -1,285 +1,301 @@
1
  <?php
2
- function wc_gallery_set_options() {
3
- global $wc_gallery_options;
4
  global $wc_gallery_theme_support;
5
 
6
- $wc_gallery_options['misc'] = array(
7
- 'title' => 'Misc',
8
- 'sections' => array(
9
- array(
10
- 'section' => 'wc-gallery-options-misc-section',
11
- 'title' => 'Miscellaneous Options',
12
- 'options' => array(
13
- array(
14
- 'id' => 'enable_gallery_css',
15
- 'title' => 'Gallery CSS',
16
- 'default' => true,
17
- 'description' => '',
18
- 'label' => 'Use gallery CSS provided by plugin',
19
- 'type' => 'checkbox',
20
- ),
21
- array(
22
- 'id' => 'enable_image_popup',
23
- 'title' => 'Image Popup',
24
- 'default' => true,
25
- 'description' => '',
26
- 'label' => 'Use <a target="_blank" href="http://dimsemenov.com/plugins/magnific-popup/">Magnific Popup</a> to showcase your images?',
27
- 'type' => 'checkbox',
28
- ),
29
- ),
30
- ),
31
- ),
32
- );
33
 
34
- $wc_gallery_options['wc-image-sizes'] = array(
35
- 'title' => 'Image Sizes',
36
- 'sections' => array(
 
 
 
 
 
37
  array(
38
- 'section' => 'wc-gallery-options-image-sizes-section',
39
- 'title' => 'Additional Image Sizes',
40
- 'options' => array(
41
  array(
42
- 'id' => 'icon_size',
43
- 'title' => 'Icon Size',
 
44
  'description' => '',
45
- 'group' => array(
46
  array(
47
- 'id' => 'icon_size_w',
48
- 'label' => 'Max Width',
49
- 'default' => $wc_gallery_theme_support['icon']['size_w'],
50
- 'type' => 'positive_number',
51
- ),
52
- array(
53
- 'id' => 'icon_size_h',
54
- 'label' => 'Max Height',
55
- 'default' => $wc_gallery_theme_support['icon']['size_h'],
56
- 'type' => 'positive_number',
57
- ),
58
- array(
59
- 'id' => 'icon_crop',
60
- 'label' => 'Crop to exact dimensions',
61
- 'default' => $wc_gallery_theme_support['icon']['crop'],
62
  'description' => '',
63
- 'type' => 'checkbox',
64
- ),
65
- ),
66
- ),
67
- array(
68
- 'id' => 'square_size',
69
- 'title' => 'Square Size',
70
- 'description' => '',
71
- 'group' => array(
72
- array(
73
- 'id' => 'square_size_w',
74
- 'label' => 'Max Width',
75
- 'default' => $wc_gallery_theme_support['square']['size_w'],
76
- 'type' => 'positive_number',
77
- 'less' => true,
78
- ),
79
- array(
80
- 'id' => 'square_size_h',
81
- 'label' => 'Max Height',
82
- 'default' => $wc_gallery_theme_support['square']['size_h'],
83
- 'type' => 'positive_number',
84
- 'less' => true,
85
  ),
86
  array(
87
- 'id' => 'square_crop',
88
- 'label' => 'Crop to exact dimensions',
89
- 'default' => $wc_gallery_theme_support['square']['crop'],
90
  'description' => '',
91
- 'type' => 'checkbox',
92
- ),
93
- ),
94
- ),
95
- array(
96
- 'id' => 'small_size',
97
- 'title' => 'Small Size',
98
- 'description' => '',
99
- 'group' => array(
100
- array(
101
- 'id' => 'small_size_w',
102
- 'label' => 'Max Width',
103
- 'default' => $wc_gallery_theme_support['small']['size_w'],
104
- 'type' => 'positive_number',
 
 
 
 
 
 
 
 
 
105
  ),
106
  array(
107
- 'id' => 'small_size_h',
108
- 'label' => 'Max Height',
109
- 'default' => $wc_gallery_theme_support['small']['size_h'],
110
- 'type' => 'positive_number',
111
- ),
112
- ),
113
- ),
114
- array(
115
- 'id' => 'standard_size',
116
- 'title' => 'Standard Size',
117
- 'description' => '',
118
- 'group' => array(
119
- array(
120
- 'id' => 'standard_size_w',
121
- 'label' => 'Max Width',
122
- 'default' => $wc_gallery_theme_support['standard']['size_w'],
123
- 'type' => 'positive_number',
124
- ),
125
- array(
126
- 'id' => 'standard_size_h',
127
- 'label' => 'Max Height',
128
- 'default' => $wc_gallery_theme_support['standard']['size_h'],
129
- 'type' => 'positive_number',
130
- ),
131
- ),
132
- ),
133
- array(
134
- 'id' => 'big_size',
135
- 'title' => 'Big Size',
136
- 'description' => '',
137
- 'group' => array(
138
- array(
139
- 'id' => 'big_size_w',
140
- 'label' => 'Max Width',
141
- 'default' => $wc_gallery_theme_support['big']['size_w'],
142
- 'type' => 'positive_number',
143
- ),
144
- array(
145
- 'id' => 'big_size_h',
146
- 'label' => 'Max Height',
147
- 'default' => $wc_gallery_theme_support['big']['size_h'],
148
- 'type' => 'positive_number',
149
  ),
150
- ),
151
- ),
152
- array(
153
- 'id' => 'fixedheightsmall_size',
154
- 'title' => 'Fixed Height Small Size',
155
- 'description' => '',
156
- 'group' => array(
157
  array(
158
- 'id' => 'fixedheightsmall_size_w',
159
- 'label' => 'Max Width',
160
- 'default' => $wc_gallery_theme_support['fixedheightsmall']['size_w'],
161
- 'type' => 'positive_number',
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  ),
163
  array(
164
- 'id' => 'fixedheightsmall_size_h',
165
- 'label' => 'Max Height',
166
- 'default' => $wc_gallery_theme_support['fixedheightsmall']['size_h'],
167
- 'type' => 'positive_number',
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  ),
169
- ),
170
- ),
171
- array(
172
- 'id' => 'fixedheightmedium_size',
173
- 'title' => 'Fixed Height Medium Size',
174
- 'description' => '',
175
- 'group' => array(
176
  array(
177
- 'id' => 'fixedheightmedium_size_w',
178
- 'label' => 'Max Width',
179
- 'default' => $wc_gallery_theme_support['fixedheightmedium']['size_w'],
180
- 'type' => 'positive_number',
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  ),
182
  array(
183
- 'id' => 'fixedheightmedium_size_h',
184
- 'label' => 'Max Height',
185
- 'default' => $wc_gallery_theme_support['fixedheightmedium']['size_h'],
186
- 'type' => 'positive_number',
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  ),
188
- ),
189
- ),
190
- array(
191
- 'id' => 'fixedheight_size',
192
- 'title' => 'Fixed Height Large Size',
193
- 'description' => '',
194
- 'group' => array(
195
  array(
196
- 'id' => 'fixedheight_size_w',
197
- 'label' => 'Max Width',
198
- 'default' => $wc_gallery_theme_support['fixedheight']['size_w'],
199
- 'type' => 'positive_number',
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  ),
201
  array(
202
- 'id' => 'fixedheight_size_h',
203
- 'label' => 'Max Height',
204
- 'default' => $wc_gallery_theme_support['fixedheight']['size_h'],
205
- 'type' => 'positive_number',
206
- ),
207
- ),
208
- ),
209
- array(
210
- 'id' => 'carouselsmall_size',
211
- 'title' => 'Carousel Small Size',
212
- 'description' => '',
213
- 'group' => array(
214
- array(
215
- 'id' => 'carouselsmall_size_w',
216
- 'label' => 'Max Width',
217
- 'default' => $wc_gallery_theme_support['carouselsmall']['size_w'],
218
- 'type' => 'positive_number',
 
 
 
 
 
 
 
219
  ),
220
  array(
221
- 'id' => 'carouselsmall_size_h',
222
- 'label' => 'Max Height',
223
- 'default' => $wc_gallery_theme_support['carouselsmall']['size_h'],
224
- 'type' => 'positive_number',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  ),
226
  array(
227
- 'id' => 'carouselsmall_crop',
228
- 'label' => 'Crop to exact dimensions',
229
- 'default' => $wc_gallery_theme_support['carouselsmall']['crop'],
230
  'description' => '',
231
- 'type' => 'checkbox',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  ),
233
  ),
234
  ),
 
 
 
 
 
 
235
  array(
236
- 'id' => 'carousel_size',
237
- 'title' => 'Carousel Large Size',
238
- 'description' => '',
239
- 'group' => array(
240
- array(
241
- 'id' => 'carousel_size_w',
242
- 'label' => 'Max Width',
243
- 'default' => $wc_gallery_theme_support['carousel']['size_w'],
244
- 'type' => 'positive_number',
245
- ),
246
  array(
247
- 'id' => 'carousel_size_h',
248
- 'label' => 'Max Height',
249
- 'default' => $wc_gallery_theme_support['carousel']['size_h'],
250
- 'type' => 'positive_number',
251
- ),
252
- array(
253
- 'id' => 'carousel_crop',
254
- 'label' => 'Crop to exact dimensions',
255
- 'default' => $wc_gallery_theme_support['carousel']['crop'],
256
  'description' => '',
 
257
  'type' => 'checkbox',
258
  ),
259
- ),
260
- ),
261
- array(
262
- 'id' => 'slider_size',
263
- 'title' => 'Slider Size',
264
- 'description' => '',
265
- 'group' => array(
266
  array(
267
- 'id' => 'slider_size_w',
268
- 'label' => 'Max Width',
269
- 'default' => $wc_gallery_theme_support['slider']['size_w'],
270
- 'type' => 'positive_number',
271
- ),
272
- array(
273
- 'id' => 'slider_size_h',
274
- 'label' => 'Max Height',
275
- 'default' => $wc_gallery_theme_support['slider']['size_h'],
276
- 'type' => 'positive_number',
277
- ),
278
- array(
279
- 'id' => 'slider_crop',
280
- 'label' => 'Crop to exact dimensions',
281
- 'default' => $wc_gallery_theme_support['slider']['crop'],
282
  'description' => '',
 
283
  'type' => 'checkbox',
284
  ),
285
  ),
@@ -288,5 +304,7 @@ function wc_gallery_set_options() {
288
  ),
289
  ),
290
  );
 
 
291
  }
292
- add_action( 'init', 'wc_gallery_set_options', 100 );
1
  <?php
2
+ function wc_gallery_options( $options ) {
 
3
  global $wc_gallery_theme_support;
4
 
5
+ // page
6
+ $menu_slug = 'wc-gallery';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ // Option
9
+ $options[ $menu_slug ] = array(
10
+ 'parent_slug' => 'themes.php',
11
+ 'page_title' => 'Gallery',
12
+ 'menu_title' => 'Gallery',
13
+ 'capability' => 'manage_options',
14
+ 'option_group' => 'wc-gallery-options-group',
15
+ 'tabs' => array(
16
  array(
17
+ 'id' => 'wc-gallery-image-sizes-tab',
18
+ 'title' => 'Image Sizes',
19
+ 'sections' => array(
20
  array(
21
+ 'id' => 'wc-gallery-image-sizes-section',
22
+ 'add_section' => true,
23
+ 'title' => 'Additional Image Sizes',
24
  'description' => '',
25
+ 'options' => array(
26
  array(
27
+ 'id' => 'icon_size',
28
+ 'title' => 'Icon Size',
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  'description' => '',
30
+ 'group' => array(
31
+ array(
32
+ 'option_name' => 'icon_size_w',
33
+ 'label' => 'Max Width',
34
+ 'default' => $wc_gallery_theme_support['icon']['size_w'],
35
+ 'type' => 'positive_number',
36
+ ),
37
+ array(
38
+ 'option_name' => 'icon_size_h',
39
+ 'label' => 'Max Height',
40
+ 'default' => $wc_gallery_theme_support['icon']['size_h'],
41
+ 'type' => 'positive_number',
42
+ ),
43
+ array(
44
+ 'option_name' => 'icon_crop',
45
+ 'label' => 'Crop to exact dimensions',
46
+ 'default' => $wc_gallery_theme_support['icon']['crop'],
47
+ 'description' => '',
48
+ 'type' => 'checkbox',
49
+ ),
50
+ ),
 
51
  ),
52
  array(
53
+ 'id' => 'square_size',
54
+ 'title' => 'Square Size',
 
55
  'description' => '',
56
+ 'group' => array(
57
+ array(
58
+ 'option_name' => 'square_size_w',
59
+ 'label' => 'Max Width',
60
+ 'default' => $wc_gallery_theme_support['square']['size_w'],
61
+ 'type' => 'positive_number',
62
+ 'less' => true,
63
+ ),
64
+ array(
65
+ 'option_name' => 'square_size_h',
66
+ 'label' => 'Max Height',
67
+ 'default' => $wc_gallery_theme_support['square']['size_h'],
68
+ 'type' => 'positive_number',
69
+ 'less' => true,
70
+ ),
71
+ array(
72
+ 'option_name' => 'square_crop',
73
+ 'label' => 'Crop to exact dimensions',
74
+ 'default' => $wc_gallery_theme_support['square']['crop'],
75
+ 'description' => '',
76
+ 'type' => 'checkbox',
77
+ ),
78
+ ),
79
  ),
80
  array(
81
+ 'id' => 'small_size',
82
+ 'title' => 'Small Size',
83
+ 'description' => '',
84
+ 'group' => array(
85
+ array(
86
+ 'option_name' => 'small_size_w',
87
+ 'label' => 'Max Width',
88
+ 'default' => $wc_gallery_theme_support['small']['size_w'],
89
+ 'type' => 'positive_number',
90
+ ),
91
+ array(
92
+ 'option_name' => 'small_size_h',
93
+ 'label' => 'Max Height',
94
+ 'default' => $wc_gallery_theme_support['small']['size_h'],
95
+ 'type' => 'positive_number',
96
+ ),
97
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  ),
 
 
 
 
 
 
 
99
  array(
100
+ 'id' => 'standard_size',
101
+ 'title' => 'Standard Size',
102
+ 'description' => '',
103
+ 'group' => array(
104
+ array(
105
+ 'option_name' => 'standard_size_w',
106
+ 'label' => 'Max Width',
107
+ 'default' => $wc_gallery_theme_support['standard']['size_w'],
108
+ 'type' => 'positive_number',
109
+ ),
110
+ array(
111
+ 'option_name' => 'standard_size_h',
112
+ 'label' => 'Max Height',
113
+ 'default' => $wc_gallery_theme_support['standard']['size_h'],
114
+ 'type' => 'positive_number',
115
+ ),
116
+ ),
117
  ),
118
  array(
119
+ 'id' => 'big_size',
120
+ 'title' => 'Big Size',
121
+ 'description' => '',
122
+ 'group' => array(
123
+ array(
124
+ 'option_name' => 'big_size_w',
125
+ 'label' => 'Max Width',
126
+ 'default' => $wc_gallery_theme_support['big']['size_w'],
127
+ 'type' => 'positive_number',
128
+ ),
129
+ array(
130
+ 'option_name' => 'big_size_h',
131
+ 'label' => 'Max Height',
132
+ 'default' => $wc_gallery_theme_support['big']['size_h'],
133
+ 'type' => 'positive_number',
134
+ ),
135
+ ),
136
  ),
 
 
 
 
 
 
 
137
  array(
138
+ 'id' => 'fixedheightsmall_size',
139
+ 'title' => 'Fixed Height Small Size',
140
+ 'description' => '',
141
+ 'group' => array(
142
+ array(
143
+ 'option_name' => 'fixedheightsmall_size_w',
144
+ 'label' => 'Max Width',
145
+ 'default' => $wc_gallery_theme_support['fixedheightsmall']['size_w'],
146
+ 'type' => 'positive_number',
147
+ ),
148
+ array(
149
+ 'option_name' => 'fixedheightsmall_size_h',
150
+ 'label' => 'Max Height',
151
+ 'default' => $wc_gallery_theme_support['fixedheightsmall']['size_h'],
152
+ 'type' => 'positive_number',
153
+ ),
154
+ ),
155
  ),
156
  array(
157
+ 'id' => 'fixedheightmedium_size',
158
+ 'title' => 'Fixed Height Medium Size',
159
+ 'description' => '',
160
+ 'group' => array(
161
+ array(
162
+ 'option_name' => 'fixedheightmedium_size_w',
163
+ 'label' => 'Max Width',
164
+ 'default' => $wc_gallery_theme_support['fixedheightmedium']['size_w'],
165
+ 'type' => 'positive_number',
166
+ ),
167
+ array(
168
+ 'option_name' => 'fixedheightmedium_size_h',
169
+ 'label' => 'Max Height',
170
+ 'default' => $wc_gallery_theme_support['fixedheightmedium']['size_h'],
171
+ 'type' => 'positive_number',
172
+ ),
173
+ ),
174
  ),
 
 
 
 
 
 
 
175
  array(
176
+ 'id' => 'fixedheight_size',
177
+ 'title' => 'Fixed Height Large Size',
178
+ 'description' => '',
179
+ 'group' => array(
180
+ array(
181
+ 'option_name' => 'fixedheight_size_w',
182
+ 'label' => 'Max Width',
183
+ 'default' => $wc_gallery_theme_support['fixedheight']['size_w'],
184
+ 'type' => 'positive_number',
185
+ ),
186
+ array(
187
+ 'option_name' => 'fixedheight_size_h',
188
+ 'label' => 'Max Height',
189
+ 'default' => $wc_gallery_theme_support['fixedheight']['size_h'],
190
+ 'type' => 'positive_number',
191
+ ),
192
+ ),
193
  ),
194
  array(
195
+ 'id' => 'carouselsmall_size',
196
+ 'title' => 'Carousel Small Size',
197
+ 'description' => '',
198
+ 'group' => array(
199
+ array(
200
+ 'option_name' => 'carouselsmall_size_w',
201
+ 'label' => 'Max Width',
202
+ 'default' => $wc_gallery_theme_support['carouselsmall']['size_w'],
203
+ 'type' => 'positive_number',
204
+ ),
205
+ array(
206
+ 'option_name' => 'carouselsmall_size_h',
207
+ 'label' => 'Max Height',
208
+ 'default' => $wc_gallery_theme_support['carouselsmall']['size_h'],
209
+ 'type' => 'positive_number',
210
+ ),
211
+ array(
212
+ 'option_name' => 'carouselsmall_crop',
213
+ 'label' => 'Crop to exact dimensions',
214
+ 'default' => $wc_gallery_theme_support['carouselsmall']['crop'],
215
+ 'description' => '',
216
+ 'type' => 'checkbox',
217
+ ),
218
+ ),
219
  ),
220
  array(
221
+ 'id' => 'carousel_size',
222
+ 'title' => 'Carousel Large Size',
223
+ 'description' => '',
224
+ 'group' => array(
225
+ array(
226
+ 'option_name' => 'carousel_size_w',
227
+ 'label' => 'Max Width',
228
+ 'default' => $wc_gallery_theme_support['carousel']['size_w'],
229
+ 'type' => 'positive_number',
230
+ ),
231
+ array(
232
+ 'option_name' => 'carousel_size_h',
233
+ 'label' => 'Max Height',
234
+ 'default' => $wc_gallery_theme_support['carousel']['size_h'],
235
+ 'type' => 'positive_number',
236
+ ),
237
+ array(
238
+ 'option_name' => 'carousel_crop',
239
+ 'label' => 'Crop to exact dimensions',
240
+ 'default' => $wc_gallery_theme_support['carousel']['crop'],
241
+ 'description' => '',
242
+ 'type' => 'checkbox',
243
+ ),
244
+ ),
245
  ),
246
  array(
247
+ 'id' => 'slider_size',
248
+ 'title' => 'Slider Size',
 
249
  'description' => '',
250
+ 'group' => array(
251
+ array(
252
+ 'option_name' => 'slider_size_w',
253
+ 'label' => 'Max Width',
254
+ 'default' => $wc_gallery_theme_support['slider']['size_w'],
255
+ 'type' => 'positive_number',
256
+ ),
257
+ array(
258
+ 'option_name' => 'slider_size_h',
259
+ 'label' => 'Max Height',
260
+ 'default' => $wc_gallery_theme_support['slider']['size_h'],
261
+ 'type' => 'positive_number',
262
+ ),
263
+ array(
264
+ 'option_name' => 'slider_crop',
265
+ 'label' => 'Crop to exact dimensions',
266
+ 'default' => $wc_gallery_theme_support['slider']['crop'],
267
+ 'description' => '',
268
+ 'type' => 'checkbox',
269
+ ),
270
+ ),
271
  ),
272
  ),
273
  ),
274
+ ),
275
+ ),
276
+ array(
277
+ 'id' => 'wc-gallery-misc-tab',
278
+ 'title' => 'Misc',
279
+ 'sections' => array(
280
  array(
281
+ 'id' => 'wc-gallery-misc-section',
282
+ 'add_section' => true, // Add a new section? Or does it already exists?
283
+ 'title' => 'Miscellaneous Options',
284
+ 'options' => array(
 
 
 
 
 
 
285
  array(
286
+ 'option_name' => 'enable_gallery_css',
287
+ 'title' => 'Gallery CSS',
288
+ 'default' => true,
 
 
 
 
 
 
289
  'description' => '',
290
+ 'label' => 'Use gallery CSS provided by plugin',
291
  'type' => 'checkbox',
292
  ),
 
 
 
 
 
 
 
293
  array(
294
+ 'option_name' => 'enable_image_popup',
295
+ 'title' => 'Image Popup',
296
+ 'default' => true,
 
 
 
 
 
 
 
 
 
 
 
 
297
  'description' => '',
298
+ 'label' => 'Use <a target="_blank" href="http://dimsemenov.com/plugins/magnific-popup/">Magnific Popup</a> to showcase your images?',
299
  'type' => 'checkbox',
300
  ),
301
  ),
304
  ),
305
  ),
306
  );
307
+
308
+ return $options;
309
  }
310
+ add_filter( 'wc_gallery_wpcsf_options', 'wc_gallery_options', 10, 1 );
includes/scripts.php CHANGED
@@ -13,7 +13,7 @@ if( !function_exists ('wc_gallery_scripts') ) :
13
  function wc_gallery_scripts() {
14
  $ver = WC_GALLERY_VERSION;
15
 
16
- if ( get_option( WC_GALLERY_PREFIX . 'enable_shortcode_css', true ) ) {
17
  wp_enqueue_style( 'wc-gallery-style', plugin_dir_url( __FILE__ ) . 'css/style.css', array( ), $ver );
18
  }
19
 
@@ -58,9 +58,6 @@ function wc_gallery_enqueue_admin_scripts() {
58
  if ( 'post' == $screen->base ) {
59
  wp_register_script( 'wc-gallery-admin-js', plugin_dir_url( __FILE__ ) . 'js/admin.js', array ( 'jquery' ), WC_GALLERY_VERSION, true );
60
  wp_enqueue_script( 'wc-gallery-admin-js' );
61
- wp_register_style( 'wc-gallery-admin', WC_GALLERY_PLUGIN_URL . 'includes/css/admin.css', array(), WC_GALLERY_VERSION, 'all' );
62
- wp_enqueue_style( 'wc-gallery-admin' );
63
-
64
  }
65
  }
66
  add_action('admin_enqueue_scripts', 'wc_gallery_enqueue_admin_scripts' );
13
  function wc_gallery_scripts() {
14
  $ver = WC_GALLERY_VERSION;
15
 
16
+ if ( get_option( WC_GALLERY_PREFIX . 'enable_gallery_css', true ) ) {
17
  wp_enqueue_style( 'wc-gallery-style', plugin_dir_url( __FILE__ ) . 'css/style.css', array( ), $ver );
18
  }
19
 
58
  if ( 'post' == $screen->base ) {
59
  wp_register_script( 'wc-gallery-admin-js', plugin_dir_url( __FILE__ ) . 'js/admin.js', array ( 'jquery' ), WC_GALLERY_VERSION, true );
60
  wp_enqueue_script( 'wc-gallery-admin-js' );
 
 
 
61
  }
62
  }
63
  add_action('admin_enqueue_scripts', 'wc_gallery_enqueue_admin_scripts' );
includes/settings.php DELETED
@@ -1,315 +0,0 @@
1
- <?php
2
- function wc_gallery_options_init() {
3
- global $wc_gallery_options;
4
-
5
- foreach ( $wc_gallery_options as $tab => $o ) {
6
- foreach ( $o['sections'] as $oo ) {
7
- add_settings_section( $oo['section'], $oo['title'], '', 'wc-gallery-options' . $tab );
8
- foreach( $oo['options'] as $ooo ) {
9
- if ( isset( $ooo['group'] ) && is_array( $ooo['group'] ) ) {
10
- foreach ( $ooo['group'] as $key => $oooo ) {
11
- $oooo['option_name'] = WC_GALLERY_PREFIX . $oooo['id'];
12
- $ooo['group'][ $key ]['option_name'] = WC_GALLERY_PREFIX . $oooo['id'];
13
-
14
- if ( isset( $oooo['option_name'] ) ) {
15
- $callback = wc_gallery_options_find_sanitize_callback( $oooo['type'] );
16
- register_setting( 'wc-gallery-options-'.$tab.'group', $oooo['option_name'], $callback );
17
- }
18
- }
19
- if ( isset( $ooo['id'] ) && isset( $ooo['title'] ) ) {
20
- add_settings_field('wc_gallery_'.$ooo['id'].'', '<label for="wc_gallery_'.$ooo['id'].'">'.__($ooo['title'] , 'wc_gallery' ).'</label>' , 'wc_gallery_options_display_group', 'wc-gallery-options'.$tab, $oo['section'], $ooo );
21
- }
22
- }
23
- else {
24
- $ooo['option_name'] = WC_GALLERY_PREFIX . $ooo['id'];
25
-
26
- if ( isset( $ooo['option_name'] ) ) {
27
- $callback = wc_gallery_options_find_sanitize_callback( $ooo['type'] );
28
- register_setting( 'wc-gallery-options-'.$tab.'group', $ooo['option_name'], $callback );
29
- add_settings_field('wc_gallery_'.$ooo['option_name'].'', '<label for="wc_gallery_'.$ooo['option_name'].'">'.__($ooo['title'] , 'wc_gallery' ).'</label>' , 'wc_gallery_options_display_setting', 'wc-gallery-options'.$tab, $oo['section'], $ooo );
30
- }
31
- }
32
- }
33
- }
34
- }
35
- }
36
- add_action( 'admin_init', 'wc_gallery_options_init' );
37
-
38
- function wc_gallery_options_admin_menu() {
39
- global $wc_gallery_options;
40
-
41
- foreach ( $wc_gallery_options as $tab => $o ) {
42
- $view_hook_name = add_submenu_page( 'options.php', $o['title'], $o['title'], 'manage_options', 'wc-gallery-options-' . $tab, 'wc_gallery_options_display_page' );
43
- }
44
-
45
- // add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );
46
- $view_hook_name = add_submenu_page( 'themes.php', 'Gallery', 'Gallery', 'manage_options', 'wc-gallery-options', 'wc_gallery_options_display_page' );
47
- }
48
- add_action( 'admin_menu', 'wc_gallery_options_admin_menu' );
49
-
50
- function wc_gallery_options_display_page() {
51
- global $wc_gallery_options, $tab;
52
- wp_reset_vars( array( 'tab' ) );
53
-
54
- // restore last tab visited
55
- if ( empty( $tab ) && isset( $_COOKIE[ WC_GALLERY_PREFIX . 'last_tab_visited'] ) ) {
56
- $last_tab = $_COOKIE[ WC_GALLERY_PREFIX . 'last_tab_visited'];
57
- if ( isset( $wc_gallery_options[ $last_tab ] ) ) {
58
- $tab = $last_tab;
59
- }
60
- }
61
-
62
- ?>
63
- <div class="wrap">
64
- <?php screen_icon(); ?>
65
- <?php
66
- $links = array();
67
- foreach( $wc_gallery_options as $id => $page ) :
68
- if ( empty( $tab ) || $id == $tab ) {
69
- $tab = $id;
70
- $links[] = "<a class='nav-tab nav-tab-active' href='themes.php?page=wc-gallery-options&tab=".$tab."'>".$page['title']."</a>";
71
- }
72
- else {
73
- $links[] = "<a class='nav-tab' href='themes.php?page=wc-gallery-options&tab=".$id."'>".$page['title']."</a>";
74
- }
75
- endforeach;
76
- ?>
77
- <h2 class="nav-tab-wrapper">
78
- <?php echo implode( '', $links ); ?>
79
- </h2>
80
-
81
- <?php if ( isset( $_GET['settings-updated'] ) ) : ?>
82
- <div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ) ?></strong></p></div>
83
- <?php endif; ?>
84
-
85
- <form id="compile-less-css" method="post" action="options.php">
86
- <?php
87
- // settings_fields( $option_group )
88
- // @option_group A settings group name. This should match the group name used in register_setting()
89
- settings_fields( 'wc-gallery-options-'.$tab.'group' );
90
-
91
- // do_settings_sections( $page )
92
- // The slug name of the page whose settings sections you want to output. This should match the page name used in add_settings_section()
93
- do_settings_sections( 'wc-gallery-options'.$tab );
94
- ?>
95
-
96
- <p class="submit">
97
- <?php submit_button( null, 'primary', 'submit', false ); ?>
98
- </p>
99
- </form>
100
- </div>
101
- <?php
102
- }
103
-
104
- /**
105
- * Call all the options displays in a given option
106
- * group
107
- *
108
- * @since 3.5.2
109
- * @access public
110
- *
111
- * @param array $args
112
- * @return void
113
- */
114
- function wc_gallery_options_display_group( $args ) {
115
- foreach ( $args['group'] as $g ) {
116
- wc_gallery_options_display_setting( $g );
117
- }
118
- ?>
119
-
120
- <?php if ( isset( $args['description'] ) ) : ?>
121
- <p class="description"><?php echo $args['description']; ?></p>
122
- <?php endif; ?>
123
-
124
- <?php
125
- }
126
-
127
- /*
128
- * Display Options
129
- */
130
- function wc_gallery_options_display_setting( $args ) {
131
- if ( !isset( $args['type'] ) )
132
- return;
133
-
134
- if ( !isset( $args['option_name'] ) )
135
- return;
136
-
137
- if ( !isset( $args['default'] ) )
138
- return;
139
-
140
- switch ( $args['type'] ) {
141
- case 'image' :
142
- wc_gallery_options_display_image_field( $args );
143
- break;
144
- case 'checkbox' :
145
- wc_gallery_options_display_checkbox_field( $args );
146
- break;
147
- case 'positive_number' :
148
- wc_gallery_options_display_positive_number_input_field( $args );
149
- break;
150
- default :
151
- wc_gallery_options_input_field( $args );
152
- break;
153
- }
154
- }
155
-
156
- function wc_gallery_options_input_field( $args ) {
157
- extract( $args );
158
-
159
- $val = get_option( $option_name, $default );
160
- ?>
161
-
162
- <?php if ( isset( $label ) ) : ?>
163
- <label for="<?php echo esc_attr($option_name); ?>"><?php echo $label; ?></label>&nbsp;
164
- <?php endif; ?>
165
-
166
- <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" type="text" value="<?php echo esc_attr($val); ?>" class="regular-text" />
167
- <?php if ( isset( $description ) && !empty( $description ) ) : ?>
168
- <p class="description"><?php echo $description; ?></p>
169
- <?php endif; ?>
170
- <?php
171
- }
172
- function wc_gallery_options_display_image_field( $args ) {
173
- extract( $args );
174
-
175
- $val = get_option( $option_name, $default );
176
-
177
- // preview image default style
178
- $style = '';
179
- if ( empty( $val['image'] ) )
180
- $style = ' style="display:none"';
181
- ?>
182
-
183
- <div class="wc-gallery-image-field">
184
- <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" class="regular-text ltr upload-input" type="text" value="<?php echo esc_attr($val); ?>" />
185
- <br />
186
- <a class="button wc-gallery-image-upload" data-target="#<?php echo $option_name; ?>" data-preview=".wc-gallery-preview-image" data-frame="select" data-state="wordpresscanvas_insert_single" data-fetch="url" data-title="Insert Image" data-button="Insert" data-class="media-frame wc-gallery-custom-uploader" title="Add Media"><span class="wp-media-buttons-icon"></span> Add Media</a>
187
- <a class="button wc-gallery-restore-image" data-restore="<?php echo $default; ?>" data-target="#<?php echo $option_name; ?>" data-preview=".wc-gallery-preview-image">Default</a>
188
- <a class="button wc-gallery-delete-image" data-target="#<?php echo $option_name; ?>" data-preview=".wc-gallery-preview-image">Delete</a>
189
- <p class="wc-gallery-preview-image"<?php echo $style; ?>><img src="<?php echo esc_attr($val); ?>" /></p>
190
- <?php if ( isset( $description ) && !empty( $description ) ) : ?>
191
- <p class="description"><?php echo $description; ?></p>
192
- <?php endif; ?>
193
- </div>
194
- <?php
195
- }
196
-
197
- function wc_gallery_options_display_checkbox_field( $args ) {
198
- extract( $args );
199
-
200
- $val = get_option( $option_name, $default );
201
- ?>
202
-
203
- <?php if ( isset( $label ) ) : ?>
204
- <label for="<?php echo esc_attr($option_name); ?>">
205
- <?php endif; ?>
206
-
207
- <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" type="checkbox" value="1" <?php checked( true, $val ); ?> />
208
-
209
- <?php if ( isset( $label ) ) : ?>
210
- &nbsp;<?php echo $label; ?></label>&nbsp;
211
- <?php endif; ?>
212
-
213
- <?php if ( isset( $description ) && !empty( $description ) ) : ?>
214
- <p class="description"><?php echo $description; ?></p>
215
- <?php endif; ?>
216
- <?php
217
- }
218
-
219
- /**
220
- * Display positive pixel input field.
221
- *
222
- * @since 3.5.2
223
- * @access public
224
- *
225
- * @param array $args
226
- * @return void
227
- */
228
- function wc_gallery_options_display_positive_number_input_field( $args ) {
229
- extract( $args );
230
-
231
- $val = get_option( $option_name, $default );
232
- $val = preg_replace("/[^0-9]/", "",$val);
233
- ?>
234
-
235
- <?php if ( isset( $label ) ) : ?>
236
- <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
237
- <?php endif; ?>
238
-
239
- <input type="number" min="0" class="small-text" name="<?php echo esc_attr($option_name); ?>" id="<?php echo $option_name; ?>" value="<?php echo esc_attr($val); ?>" />&nbsp;
240
-
241
- <?php if ( isset( $description ) && !empty( $description ) ) : ?>
242
- <p class="description"><?php echo $description; ?></p>
243
- <?php endif; ?>
244
-
245
- <?php
246
- }
247
-
248
- /*
249
- * Sanitize Options
250
- */
251
- function wc_gallery_options_find_sanitize_callback( $type ) {
252
- switch ( $type ) {
253
- case 'color' :
254
- return 'wc_gallery_options_sanitize_hex_color';
255
- case 'image' :
256
- return 'esc_url_raw';
257
- case 'checkbox' :
258
- return 'wc_gallery_options_sanitize_checkbox';
259
- case 'positive_number' :
260
- return 'wc_gallery_options_sanitize_positive_number';
261
- }
262
-
263
- return '';
264
- }
265
-
266
- /**
267
- * Strips all non numerica characters and returns
268
- * intval() of string. Only allows for positive values.
269
- *
270
- * @since 3.6
271
- * @access public
272
- *
273
- * @param string $value
274
- * @return void
275
- */
276
- function wc_gallery_options_sanitize_positive_number( $value ) {
277
- $value = preg_replace("/[^0-9]/", "",$value);
278
- $value = intval( $value );
279
-
280
- if ( empty( $value ) )
281
- $value = '0';
282
-
283
- return $value;
284
- }
285
-
286
- function wc_gallery_options_sanitize_checkbox( $val ) {
287
- if ( $val )
288
- return 1;
289
- else
290
- return 0;
291
- }
292
-
293
- function wc_gallery_options_sanitize_hex_color( $color ) {
294
- if ( '' === $color )
295
- return '';
296
-
297
- if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
298
- return $color;
299
-
300
- return null;
301
- }
302
-
303
- /*
304
- * Misc
305
- */
306
- function wc_gallery_remember_last_options_tab() {
307
- global $page;
308
-
309
- if ( isset( $_GET['page'] ) && $_GET['page'] == 'wc-gallery-options' ) {
310
- if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) {
311
- setcookie(WC_GALLERY_PREFIX . 'last_tab_visited', $_GET['tab'], time() + ( 2 * DAY_IN_SECONDS ) );
312
- }
313
- }
314
- }
315
- add_action( 'admin_init', 'wc_gallery_remember_last_options_tab' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendors/wpc-settings-framework/class-wpc-settings-framework.php ADDED
@@ -0,0 +1,1127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPC Settings Framework.
4
+ *
5
+ * @package WPC_Settings_Framework
6
+ * @author Chris Baldelomar <chris@webplantmedia.com>
7
+ * @license GPL-2.0+
8
+ * @link http://webplantmedia.com
9
+ * @copyright 2014 Chris Baldelomar
10
+ */
11
+
12
+ /**
13
+ * Settings framework class.
14
+ *
15
+ * @package WPC_Settings_Framework
16
+ * @author Chris Baldelomar <chris@webplantmedia.com>
17
+ */
18
+ class WC_Gallery_Settings_Framework {
19
+
20
+ protected $version = '1.0.0';
21
+
22
+ /**
23
+ * Instance of this class.
24
+ *
25
+ * @since 1.0.0
26
+ *
27
+ * @var object
28
+ */
29
+ protected static $instance = null;
30
+ protected $sanitize = null;
31
+ protected $display = null;
32
+
33
+ /**
34
+ * Slug of the plugin screen.
35
+ *
36
+ * @since 1.0.0
37
+ *
38
+ * @var string
39
+ */
40
+ protected $views = array();
41
+
42
+ /**
43
+ * The variable name is used as the text domain when internationalizing strings
44
+ * of text. Its value should match the Text Domain file header in the main
45
+ * plugin file.
46
+ *
47
+ * @since 1.0.0
48
+ *
49
+ * @var string
50
+ */
51
+ protected $plugin_slug = null;
52
+ protected $plugin_prefix = null;
53
+ protected $plugin_version = 0;
54
+ protected $options = array();
55
+ protected $wp_settings_tabs = array();
56
+ protected $tabs = array();
57
+
58
+
59
+ /**
60
+ * Initialize the plugin by loading admin scripts & styles and adding a
61
+ * settings page and menu.
62
+ *
63
+ * @since 1.0.0
64
+ */
65
+ private function __construct() {
66
+
67
+ $this->set_slug_prefix();
68
+
69
+ add_action( 'admin_init', array( $this, 'set_plugin_info' ) );
70
+
71
+ add_action( 'init', array( $this, 'set_options' ), 100 );
72
+ add_action( 'admin_init', array( $this, 'options_init' ) );
73
+ add_action( 'admin_init', array( $this, 'options_activation' ), 200 );
74
+ add_action( 'admin_menu', array( $this, 'options_admin_menu' ) );
75
+
76
+ // Load admin style sheet and JavaScript.
77
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
78
+ }
79
+
80
+ /**
81
+ * Return an instance of this class.
82
+ *
83
+ * @since 1.0.0
84
+ *
85
+ * @return object A single instance of this class.
86
+ */
87
+ public static function get_instance() {
88
+
89
+ // If the single instance hasn't been set, set it now.
90
+ if ( null == self::$instance ) {
91
+ self::$instance = new self;
92
+ }
93
+
94
+ return self::$instance;
95
+ }
96
+
97
+ public function set_slug_prefix() {
98
+ $plugin_basename = plugin_basename( __FILE__ );
99
+ $plugin_name = substr( $plugin_basename, 0, strpos( $plugin_basename, '/' ) );
100
+
101
+ if ( empty( $plugin_name ) ) {
102
+ return;
103
+ }
104
+
105
+ $this->plugin_slug = $this->sanitize_id( $plugin_name );
106
+ $this->plugin_prefix = $this->sanitize_key( $plugin_name ) . '_';
107
+ }
108
+
109
+ public function set_plugin_info() {
110
+ $this->plugin_current_version = get_option( $this->plugin_prefix . 'current_version' );
111
+
112
+ $active_plugins = get_option( 'active_plugins' );
113
+ $plugin = get_plugins( '/' . $this->plugin_slug );
114
+ if ( ! empty( $plugin ) ) {
115
+ $plugin = array_shift( $plugin );
116
+ $this->plugin_version = $plugin['Version'];
117
+ }
118
+ }
119
+
120
+ public function set_options() {
121
+ $this->options = apply_filters ( $this->plugin_prefix . 'wpcsf_options' , $this->options );
122
+ }
123
+
124
+ public function options_activation() {
125
+
126
+ $initialize = false;
127
+
128
+ if ( ! $this->plugin_current_version ) {
129
+ $initialize = true;
130
+ }
131
+ else if ( version_compare( $this->plugin_version, $this->plugin_current_version ) > 0 ) {
132
+ $initialize = true;
133
+ }
134
+
135
+ if ( $initialize ) {
136
+ update_option( $this->plugin_prefix . 'current_version', $this->plugin_version );
137
+
138
+ foreach ( $this->options as $menu_slug => $o ) {
139
+ if ( isset( $o['option_group'] ) ) {
140
+ if ( isset( $o['tabs'] ) &&
141
+ is_array( $o['tabs'] ) ) {
142
+ foreach( $o['tabs'] as $key => $oo ) {
143
+ if ( isset( $oo['sections'] ) &&
144
+ is_array( $oo['sections'] ) ) {
145
+ $this->loop_and_init_options( $oo['sections'] );
146
+ }
147
+ }
148
+ }
149
+ else if ( isset( $o['sections'] ) &&
150
+ is_array( $o['sections'] ) ) {
151
+ $this->loop_and_init_options( $o['sections'] );
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+
158
+ public function loop_and_init_options( $sections ) {
159
+ foreach( $sections as $o ) {
160
+ if ( isset( $o['id'] ) &&
161
+ isset( $o['title'] ) &&
162
+ isset( $o['options'] ) &&
163
+ is_array( $o['options'] ) ) {
164
+ foreach( $o['options'] as $oo ) {
165
+ if ( isset( $oo['group'] ) && is_array( $oo['group'] ) ) {
166
+ foreach ( $oo['group'] as $key => $ooo ) {
167
+ if ( isset( $ooo['option_name'] ) ) {
168
+ $ooo['option_name'] = $this->plugin_prefix . $ooo['option_name'];
169
+ $this->add_option( $ooo['option_name'], $ooo['default'] );
170
+ }
171
+ }
172
+ }
173
+ else {
174
+ if ( isset( $oo['option_name'] ) ) {
175
+ $oo['option_name'] = $this->plugin_prefix . $oo['option_name'];
176
+ $this->add_option( $oo['option_name'], $oo['default'] );
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+
184
+ public function add_option( $option_name, $default ) {
185
+ if ( $this->plugin_prefix . 'social_icons_display' == $option_name ) {
186
+ // $default = wc_shortcodes_default_social_icons();
187
+ // add_option( $option_name, $default );
188
+ }
189
+ else {
190
+ add_option( $option_name, $default );
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Register theme options from user defined options array
196
+ *
197
+ * @since 3.5.2
198
+ * @access public
199
+ *
200
+ * @return void
201
+ */
202
+ public function options_init() {
203
+ register_setting( $this->plugin_slug . '-wpcsf-current-version', $this->plugin_prefix . 'current_version' );
204
+
205
+ foreach ( $this->options as $menu_slug => $o ) {
206
+ if ( isset( $o['option_group'] ) ) {
207
+ if ( isset( $o['tabs'] ) &&
208
+ is_array( $o['tabs'] ) ) {
209
+ foreach( $o['tabs'] as $key => $oo ) {
210
+ if ( isset( $oo['sections'] ) &&
211
+ is_array( $oo['sections'] ) ) {
212
+ $this->loop_sections( $menu_slug, $o['option_group'], $oo['sections'], $oo['id'], $oo['title'] );
213
+ }
214
+ }
215
+ }
216
+ else if ( isset( $o['sections'] ) &&
217
+ is_array( $o['sections'] ) ) {
218
+ $this->loop_sections( $menu_slug, $o['option_group'], $o['sections'] );
219
+ }
220
+ }
221
+ }
222
+ }
223
+
224
+ public function loop_sections( $menu_slug, $option_group, &$sections, $tab_id = null, $tab_title = null ) {
225
+ foreach( $sections as $o ) {
226
+ if ( isset( $o['id'] ) &&
227
+ isset( $o['title'] ) &&
228
+ isset( $o['options'] ) &&
229
+ is_array( $o['options'] ) ) {
230
+ // add_settings_section( $id, $title, $callback, $page );
231
+ // @page should match @menu_slug from add_theme_page
232
+ if ( isset( $o['add_section'] ) && $o['add_section'] ) {
233
+ if ( ! empty( $tab_id ) && ! empty( $tab_title ) ) {
234
+ $this->add_settings_tabs( $tab_id, $tab_title, $o['id'], $o['title'], $menu_slug );
235
+ }
236
+ add_settings_section( $o['id'], $o['title'], '', $menu_slug );
237
+ }
238
+
239
+ foreach( $o['options'] as $oo ) {
240
+ if ( isset( $oo['group'] ) && is_array( $oo['group'] ) ) {
241
+ foreach ( $oo['group'] as $key => $ooo ) {
242
+ if ( isset( $ooo['option_name'] ) ) {
243
+ $ooo['option_name'] = $this->plugin_prefix . $ooo['option_name'];
244
+ $oo['group'][ $key ]['option_name'] = $ooo['option_name'];
245
+
246
+ $callback = $this->get_callback( $ooo );
247
+
248
+ // register_setting( $option_group, $option_name, $callback );
249
+ register_setting( $option_group, $ooo['option_name'], $callback );
250
+ }
251
+ }
252
+ if ( isset( $oo['id'] ) && isset( $oo['title'] ) ) {
253
+ // add_settings_field( $id, $title, $callback, $page, $section, $args );
254
+ // @page should match @menu_slug from add_theme_page
255
+ // @section the section you added with add_settings_section
256
+ add_settings_field($oo['id'], $oo['title'], array( $this, 'display_group' ), $menu_slug, $o['id'], $oo );
257
+ }
258
+ }
259
+ else {
260
+ if ( isset( $oo['option_name'] ) ) {
261
+ $oo['option_name'] = $this->plugin_prefix . $oo['option_name'];
262
+
263
+ $callback = $this->get_callback( $oo );
264
+
265
+ // register_setting( $option_group, $option_name, $callback );
266
+ register_setting( $option_group, $oo['option_name'], $callback );
267
+
268
+ // add_settings_field( $id, $title, $callback, $page, $section, $args );
269
+ // @page should match @menu_slug from add_theme_page
270
+ // @section the section you added with add_settings_section
271
+ add_settings_field( $oo['option_name'], '<label for="'.$oo['option_name'].'">'.$oo['title'].'</label>' , array( $this, 'display_setting' ), $menu_slug, $o['id'], $oo );
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ public function get_callback( &$o ) {
280
+ if ( isset( $o['callback'] ) && ! empty( $o['callback'] ) ) {
281
+ if ( function_exists( $o['callback'] ) ) {
282
+ return $o['callback'];
283
+ }
284
+ }
285
+
286
+ $callback = array(
287
+ $this,
288
+ $this->sanitize_callback( $o['type'] ),
289
+ );
290
+
291
+ return $callback;
292
+ }
293
+
294
+ /**
295
+ * Add submenu pages from user defined options array
296
+ *
297
+ * @since 3.5.2
298
+ * @access public
299
+ *
300
+ * @return void
301
+ */
302
+ public function options_admin_menu() {
303
+ if ( ! empty( $this->options ) ) {
304
+ foreach ( $this->options as $menu_slug => $v ) {
305
+ if ( isset( $v['parent_slug'] ) &&
306
+ isset( $v['page_title'] ) &&
307
+ isset( $v['menu_title'] ) &&
308
+ isset( $v['capability'] ) &&
309
+ isset( $v['option_group'] ) ) {
310
+ // add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );
311
+ $view_hook_name = add_submenu_page( $v['parent_slug'], $v['page_title'], $v['menu_title'], $v['capability'], $menu_slug, array( $this, 'display_page' ) );
312
+ $this->views[ $view_hook_name ] = $menu_slug;
313
+ }
314
+ else if ( isset( $v['parent_slug'] ) ) {
315
+ $this->views[ $v['parent_slug'] ] = $menu_slug;
316
+ }
317
+ }
318
+ }
319
+ }
320
+
321
+ public function add_settings_tabs( $id, $title, $section_id, $section_title, $menu_slug ) {
322
+ $this->wp_settings_tabs[ $menu_slug ][ $id ][ $section_id ] = array(
323
+ 'id' => $section_id,
324
+ 'title' => $section_title
325
+ );
326
+
327
+ $this->tabs[ $menu_slug ][ $id ] = array(
328
+ 'id' => $id,
329
+ 'title' => $title,
330
+ );
331
+ }
332
+
333
+ public function fetch_proper_hook_name( $hook ) {
334
+ switch( $hook ) {
335
+ case 'options-general.php' :
336
+ return 'settings_page_general';
337
+ case 'options-writing.php' :
338
+ return 'settings_page_writing';
339
+ case 'options-reading.php' :
340
+ return 'settings_page_reading';
341
+ case 'options-discussion.php' :
342
+ return 'settings_page_discussion';
343
+ case 'options-media.php' :
344
+ return 'settings_page_media';
345
+ case 'options-permalink.php' :
346
+ return 'settings_page_permalink';
347
+ }
348
+
349
+ return $hook;
350
+ }
351
+
352
+ /**
353
+ * Register and enqueue admin-specific JavaScript.
354
+ *
355
+ * @TODO:
356
+ *
357
+ * @since 1.0.0
358
+ *
359
+ * @return null Return early if no settings page is registered.
360
+ */
361
+ public function enqueue_admin_scripts( $hook ) {
362
+
363
+ $hook = $this->fetch_proper_hook_name( $hook );
364
+ // pr($hook);
365
+ // pr($this->views);
366
+
367
+ if ( ! isset( $this->views ) || empty( $this->views ) ) {
368
+ return;
369
+ }
370
+
371
+ if ( array_key_exists( $hook, $this->views ) ) {
372
+ // CSS
373
+ wp_enqueue_style( $this->plugin_slug .'-options-styles', plugins_url( 'css/options.css', __FILE__ ), array(), $this->version );
374
+ wp_enqueue_style( $this->plugin_slug .'-media-uploader-styles', plugins_url( 'css/media-uploader.css', __FILE__ ), array(), $this->version );
375
+ wp_enqueue_style( 'wp-color-picker' );
376
+
377
+ // JS
378
+ wp_enqueue_script( $this->plugin_slug . '-options-script', plugins_url( 'js/options.js', __FILE__ ), array( 'jquery' ), $this->version, true );
379
+ wp_enqueue_media();
380
+ wp_enqueue_script( $this->plugin_slug . '-media-uploader-script', plugins_url( 'js/media-uploader.js', __FILE__ ), array( 'jquery', 'wp-color-picker' ), $this->version, true );
381
+ }
382
+
383
+ }
384
+
385
+ /**
386
+ * Get current filter, check with available views
387
+ * created when adding sub_pages, and return
388
+ * menu slug
389
+ *
390
+ * @since 3.6.1
391
+ * @access public
392
+ *
393
+ * @return void
394
+ */
395
+ function get_current_view() {
396
+ $current_filter = current_filter();
397
+ if ( ! isset ( $this->views[ $current_filter ] ) )
398
+ return false;
399
+
400
+ $menu_slug = $this->views[ $current_filter ];
401
+
402
+ return $menu_slug;
403
+ }
404
+
405
+ /**
406
+ * Display default settings page.
407
+ *
408
+ * @since 3.5.2
409
+ * @access public
410
+ *
411
+ * @return void
412
+ */
413
+ function display_page() {
414
+ if ( ! $menu_slug = $this->get_current_view() )
415
+ return;
416
+
417
+ $o = $this->options[$menu_slug];
418
+ if ( ! empty( $this->wp_settings_tabs ) ) {
419
+ require( 'views/tabs.php' );
420
+ }
421
+ else {
422
+ require( 'views/page.php' );
423
+ }
424
+ }
425
+
426
+ /**
427
+ * Call all the options displays in a given option
428
+ * group
429
+ *
430
+ * @since 3.5.2
431
+ * @access public
432
+ *
433
+ * @param array $args
434
+ * @return void
435
+ */
436
+ function display_group( $args ) {
437
+ require( 'views/group.php' );
438
+ }
439
+
440
+ /**
441
+ * Controls which display function should be called
442
+ * given a option type passed.
443
+ *
444
+ * @since 3.5.2
445
+ * @access public
446
+ *
447
+ * @param array $args
448
+ * @return void
449
+ */
450
+ function display_setting( $args ) {
451
+ if ( ! isset( $args['type'] ) )
452
+ return;
453
+
454
+ if ( ! isset( $args['option_name'] ) )
455
+ return;
456
+
457
+ if ( ! isset( $args['default'] ) )
458
+ return;
459
+
460
+ if ( ! isset( $args['display'] ) || empty( $args['display'] ) )
461
+ $args['display'] = 'default';
462
+
463
+ extract( $args );
464
+ $val = get_option( $option_name, $default );
465
+
466
+ switch ( $args['type'] ) {
467
+ case 'image' :
468
+ require( 'views/settings/image-field.php' );
469
+ break;
470
+ case 'positive_pixel' :
471
+ require( 'views/settings/positive-pixel-input-field.php' );
472
+ break;
473
+ case 'positive_number' :
474
+ require( 'views/settings/positive-number-input-field.php' );
475
+ break;
476
+ case 'pixel' :
477
+ require( 'views/settings/pixel-input-field.php' );
478
+ break;
479
+ case 'number' :
480
+ require( 'views/settings/number-input-field.php' );
481
+ break;
482
+ case 'decimal' :
483
+ require( 'views/settings/decimal-input-field.php' );
484
+ break;
485
+ case 'radio' :
486
+ require( 'views/settings/custom-radio.php' );
487
+ break;
488
+ case 'checkboxes' :
489
+ require( 'views/settings/custom-checkboxes.php' );
490
+ break;
491
+ case 'dropdown' :
492
+ require( 'views/settings/custom-dropdown.php' );
493
+ break;
494
+ case 'background' :
495
+ require( 'views/settings/background-options.php' );
496
+ break;
497
+ case 'color' :
498
+ require( 'views/settings/color-field.php' );
499
+ break;
500
+ case 'checkbox' :
501
+ require( 'views/settings/checkbox-field.php' );
502
+ break;
503
+ case 'border' :
504
+ require( 'views/settings/border-fields.php' );
505
+ break;
506
+ case 'gallery' :
507
+ require( 'views/settings/gallery-fields.php' );
508
+ break;
509
+ case 'textarea' :
510
+ require( 'views/settings/textarea-field.php' );
511
+ break;
512
+ case 'wp_editor' :
513
+ require( 'views/settings/wp-editor.php' );
514
+ break;
515
+ case 'order_show_hide' :
516
+ require( 'views/settings/order-show-hide.php' );
517
+ break;
518
+ case 'emails' :
519
+ default :
520
+ require( 'views/settings/input-field.php' );
521
+ break;
522
+ }
523
+ }
524
+
525
+ /************
526
+ * Sanitize *
527
+ ************/
528
+
529
+ /**
530
+ * Given an option type, we will return a string
531
+ * of the callback function used to sanitize
532
+ * the option value
533
+ *
534
+ * @since 3.5.2
535
+ * @access public
536
+ *
537
+ * @param string $type
538
+ * @return string
539
+ */
540
+ public function sanitize_callback( $type ) {
541
+ switch ( $type ) {
542
+ case 'color' :
543
+ return 'sanitize_hex_color';
544
+ case 'image' :
545
+ return 'sanitize_esc_url_raw';
546
+ case 'positive_pixel' :
547
+ return 'sanitize_positive_pixel';
548
+ case 'positive_number' :
549
+ return 'sanitize_positive_number';
550
+ case 'pixel' :
551
+ return 'sanitize_pixel';
552
+ case 'number' :
553
+ return 'sanitize_number';
554
+ case 'decimal' :
555
+ return 'sanitize_decimal';
556
+ case 'border' :
557
+ return 'sanitize_border';
558
+ case 'background' :
559
+ return 'sanitize_background_css';
560
+ case 'checkbox' :
561
+ return 'sanitize_checkbox';
562
+ case 'gallery' :
563
+ return 'sanitize_gallery';
564
+ case 'emails' :
565
+ return 'sanitize_emails';
566
+ }
567
+
568
+ return 'sanitize_none';
569
+ }
570
+
571
+ /**
572
+ * Validate slideshow data saved to database.
573
+ *
574
+ * @since 3.6
575
+ * @access public
576
+ *
577
+ * @param array $value
578
+ * @return array
579
+ */
580
+ public function sanitize_gallery( $value ) {
581
+ if ( empty( $value ) )
582
+ return null;
583
+
584
+ $ids = explode( ',', $value );
585
+
586
+ foreach ( $ids as $key => $id ) {
587
+ if ( ! is_numeric( $id ) ) {
588
+ unset( $ids[ $key ] );
589
+ }
590
+ }
591
+
592
+ $value = implode( ',', $ids );
593
+
594
+ return $value;
595
+ }
596
+
597
+ /**
598
+ * Sanitize border values. Border consists
599
+ * of pixel value, border style, and color.
600
+ *
601
+ * @since 3.6
602
+ * @access public
603
+ *
604
+ * @param array $value
605
+ * @return array
606
+ */
607
+ public function sanitize_border( $value ) {
608
+ $border = array(
609
+ 'width' => '0px',
610
+ 'style' => 'none',
611
+ 'color' => '#ffffff',
612
+ );
613
+
614
+ if ( ! is_array( $value ) )
615
+ return $border;
616
+
617
+ foreach ( $value as $k => $v ) {
618
+ switch ( $k ) {
619
+ case 'width' :
620
+ $v = $this->sanitize_positive_pixel( $v );
621
+ $border['width'] = $v;
622
+ break;
623
+ case 'style' :
624
+ $v = $this->sanitize_border_style( $v );
625
+ $border['style'] = $v;
626
+ break;
627
+ case 'color' :
628
+ $v = $this->sanitize_hex_color( $v );
629
+ $border['color'] = $v;
630
+ break;
631
+ }
632
+ }
633
+
634
+ return $border;
635
+ }
636
+
637
+ /**
638
+ * Strips all non numerica characters and returns
639
+ * intval() of string. Only allows for positive values.
640
+ *
641
+ * @since 3.6
642
+ * @access public
643
+ *
644
+ * @param string $value
645
+ * @return void
646
+ */
647
+ public function sanitize_positive_pixel( $value ) {
648
+ $value = preg_replace("/[^0-9]/", "",$value);
649
+ $value = intval( $value );
650
+
651
+ if ( empty( $value ) )
652
+ $value = '0';
653
+
654
+ return $value."px";
655
+ }
656
+
657
+ public function sanitize_positive_number( $value ) {
658
+ $value = preg_replace("/[^0-9]/", "",$value);
659
+ $value = intval( $value );
660
+
661
+ if ( empty( $value ) )
662
+ $value = '0';
663
+
664
+ return $value;
665
+ }
666
+
667
+ /**
668
+ * Strips all non numerica characters and returns
669
+ * intval() of string. Allows both negative and
670
+ * positive values.
671
+ *
672
+ * @since 3.6
673
+ * @access public
674
+ *
675
+ * @param string $value
676
+ * @return void
677
+ */
678
+ public function sanitize_pixel( $value ) {
679
+ $value = preg_replace("/[^0-9\-]/", "",$value);
680
+ $value = intval( $value );
681
+
682
+ if ( empty( $value ) )
683
+ $value = '0';
684
+
685
+ return $value."px";
686
+ }
687
+
688
+ public function sanitize_font( $value ) {
689
+ $font = array(
690
+ 'font_family' => '',
691
+ 'font_size' => '',
692
+ 'text_transform' => '',
693
+ 'font_style' => '',
694
+ 'font_weight' => '',
695
+ 'color' => '',
696
+ );
697
+
698
+ if ( !is_array( $value ) )
699
+ return $font;
700
+
701
+ foreach ( $value as $k => $v ) {
702
+ switch ( $k ) {
703
+ case 'font_family' :
704
+ $font['font_family'] = $v;
705
+ break;
706
+ case 'font_size' :
707
+ $v = $this->sanitize_pixel( $value['font_size'] );
708
+ $font['font_size'] = $v;
709
+ break;
710
+ case 'text_transform' :
711
+ $font['text_transform'] = $v;
712
+ break;
713
+ case 'font_style' :
714
+ $v = $this->sanitize_font_style( $v );
715
+ $font['font_style'] = $v;
716
+ break;
717
+ case 'font_weight' :
718
+ $v = $this->sanitize_font_weight( $v );
719
+ $font['font_weight'] = $v;
720
+ break;
721
+ case 'color' :
722
+ $v = $this->sanitize_hex_color( $v );
723
+ $font['color'] = $v;
724
+ break;
725
+ }
726
+ }
727
+
728
+ return $font;
729
+ }
730
+
731
+ public function sanitize_font_hover( $value ) {
732
+ $font = array(
733
+ 'text_decoration' => '',
734
+ 'color' => '',
735
+ );
736
+
737
+ if ( !is_array( $value ) )
738
+ return $font;
739
+
740
+ foreach ( $value as $k => $v ) {
741
+ switch ( $k ) {
742
+ case 'text_decoration' :
743
+ $v = $this->sanitize_text_decoration( $v );
744
+ $font['text_decoration'] = $v;
745
+ break;
746
+ case 'color' :
747
+ $v = $this->sanitize_hex_color( $v );
748
+ $font['color'] = $v;
749
+ break;
750
+ }
751
+ }
752
+
753
+ return $font;
754
+ }
755
+
756
+ public function sanitize_font_appearance( $value ) {
757
+ $font = array(
758
+ 'text_decoration' => '',
759
+ 'font_style' => '',
760
+ 'font_weight' => '',
761
+ 'color' => '',
762
+ );
763
+
764
+ if ( !is_array( $value ) )
765
+ return $font;
766
+
767
+ foreach ( $value as $k => $v ) {
768
+ switch ( $k ) {
769
+ case 'text_decoration' :
770
+ $v = $this->sanitize_text_decoration( $v );
771
+ $font['text_decoration'] = $v;
772
+ break;
773
+ case 'font_style' :
774
+ $v = $this->sanitize_font_style( $v );
775
+ $font['font_style'] = $v;
776
+ break;
777
+ case 'font_weight' :
778
+ $v = $this->sanitize_font_weight( $v );
779
+ $font['font_weight'] = $v;
780
+ break;
781
+ case 'color' :
782
+ $v = $this->sanitize_hex_color( $v );
783
+ $font['color'] = $v;
784
+ break;
785
+ }
786
+ }
787
+
788
+ return $font;
789
+ }
790
+
791
+ public function sanitize_text_decoration( $value ) {
792
+ $whitelist = array(
793
+ 'none',
794
+ 'underline',
795
+ 'overline',
796
+ 'line-through',
797
+ );
798
+
799
+ if ( in_array( $value, $whitelist ) )
800
+ return $value;
801
+
802
+ return '';
803
+ }
804
+
805
+ public function sanitize_text_transform( $value ) {
806
+ $whitelist = array(
807
+ 'none',
808
+ 'capitalize',
809
+ 'uppercase',
810
+ 'lowercase',
811
+ );
812
+
813
+ if ( in_array( $value, $whitelist ) )
814
+ return $value;
815
+
816
+ return '';
817
+ }
818
+
819
+ public function sanitize_font_style( $value ) {
820
+ $whitelist = array(
821
+ 'normal',
822
+ 'italic',
823
+ 'oblique',
824
+ );
825
+
826
+ if ( in_array( $value, $whitelist ) )
827
+ return $value;
828
+
829
+ return '';
830
+ }
831
+
832
+ public function sanitize_font_weight( $value ) {
833
+ $whitelist = array(
834
+ 'normal',
835
+ 'bold',
836
+ 'bolder',
837
+ 'lighter',
838
+ '100',
839
+ '200',
840
+ '300',
841
+ '400',
842
+ '500',
843
+ '600',
844
+ '700',
845
+ '800',
846
+ '900',
847
+ );
848
+
849
+ if ( in_array( $value, $whitelist ) )
850
+ return $value;
851
+
852
+ return '';
853
+ }
854
+
855
+ public function sanitize_background_css( $value ) {
856
+ $background = array(
857
+ 'color' => '',
858
+ 'image' => '',
859
+ 'repeat' => '',
860
+ 'position' => '',
861
+ 'attachment' => '',
862
+ );
863
+
864
+ if ( !is_array( $value ) )
865
+ return $background;
866
+
867
+ foreach ( $value as $k => $v ) {
868
+ switch ( $k ) {
869
+ case 'color' :
870
+ $v = $this->sanitize_hex_color( $v );
871
+ $background['color'] = $v;
872
+ break;
873
+ case 'image' :
874
+ $v = esc_url_raw( $v );
875
+ $background['image'] = $v;
876
+ break;
877
+ case 'repeat' :
878
+ $v = $this->sanitize_background_repeat( $v );
879
+ $background['repeat'] = $v;
880
+ break;
881
+ case 'position' :
882
+ $v = $this->sanitize_background_position( $v );
883
+ $background['position'] = $v;
884
+ break;
885
+ case 'attachment' :
886
+ $v = $this->sanitize_background_attachment( $v );
887
+ $background['attachment'] = $v;
888
+ break;
889
+ }
890
+ }
891
+
892
+ return $background;
893
+ }
894
+
895
+ public function sanitize_background_repeat( $value ) {
896
+ $whitelist = array( 'repeat', 'no-repeat', 'repeat-x', 'repeat-y' );
897
+
898
+ if ( in_array( $value, $whitelist ) )
899
+ return $value;
900
+
901
+ return '';
902
+ }
903
+
904
+ public function sanitize_border_style( $value ) {
905
+ $whitelist = array(
906
+ 'none',
907
+ 'hidden',
908
+ 'dotted',
909
+ 'dashed',
910
+ 'solid',
911
+ 'double',
912
+ 'groove',
913
+ 'ridge',
914
+ 'inset',
915
+ 'outset',
916
+ 'inherit',
917
+ );
918
+
919
+ if ( in_array( $value, $whitelist ) )
920
+ return $value;
921
+
922
+ return 'none';
923
+ }
924
+
925
+ public function sanitize_background_position( $value ) {
926
+ $whitelist = array(
927
+ 'left top',
928
+ 'left center',
929
+ 'left bottom',
930
+ 'right top',
931
+ 'right center',
932
+ 'right bottom',
933
+ 'center top',
934
+ 'center center',
935
+ 'center bottom',
936
+ );
937
+
938
+ if ( in_array( $value, $whitelist ) )
939
+ return $value;
940
+
941
+ return '';
942
+ }
943
+
944
+ public function sanitize_background_attachment( $value ) {
945
+ $whitelist = array( 'fixed', 'scroll' );
946
+
947
+ if ( in_array( $value, $whitelist ) )
948
+ return $value;
949
+
950
+ return '';
951
+ }
952
+
953
+ public function sanitize_hex_color( $color ) {
954
+ if ( '' === $color )
955
+ return '';
956
+
957
+ if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
958
+ return $color;
959
+
960
+ return null;
961
+ }
962
+
963
+ /**
964
+ * replace nonalphannumeric charachers with underscore
965
+ * should be safe enought to use as array key
966
+ *
967
+ * @since 3.5.2
968
+ * @access public
969
+ *
970
+ * @param string $key
971
+ * @return string
972
+ */
973
+ public function sanitize_key( $key ) {
974
+ $key = strtolower( preg_replace( '/[^a-zA-Z0-9]/', '_', $key ) );
975
+
976
+ return $key;
977
+ }
978
+
979
+ /**
980
+ * replace nonalphannumeric charachers with hyphen
981
+ * should be safe enough to use as a CSS id
982
+ *
983
+ * @since 3.5.2
984
+ * @access public
985
+ *
986
+ * @param string $key
987
+ * @return string
988
+ */
989
+ public function sanitize_id( $id ) {
990
+ $id = strtolower( preg_replace( '/[^a-zA-Z0-9]/', '-', $id ) );
991
+
992
+ return $id;
993
+ }
994
+
995
+ /**
996
+ * return numeric values only
997
+ *
998
+ * @since 3.6
999
+ * @access public
1000
+ *
1001
+ * @param string $number
1002
+ * @return int
1003
+ */
1004
+ public function sanitize_number( $number ) {
1005
+ $number = (int) preg_replace( "/[^0-9\-]/", "", $number );
1006
+
1007
+ return $number;
1008
+ }
1009
+
1010
+ /**
1011
+ * return decimal number
1012
+ *
1013
+ * @since 3.6.1
1014
+ * @access public
1015
+ *
1016
+ * @param mixed $number
1017
+ * @return void
1018
+ */
1019
+ public function sanitize_decimal( $number ) {
1020
+ $number = preg_replace( "/[^0-9\.\-]/", "", $number );
1021
+
1022
+ return $number;
1023
+ }
1024
+
1025
+ /**
1026
+ * replace space with plus sign. Should be safe enough
1027
+ * to use in Google Font stylesheet link
1028
+ *
1029
+ * @since 3.5.2
1030
+ * @access public
1031
+ *
1032
+ * @param string $code
1033
+ * @return string
1034
+ */
1035
+ public function sanitize_google_code( $code ) {
1036
+ $code = preg_replace( '/\s/', '+', $code );
1037
+
1038
+ return $code;
1039
+ }
1040
+
1041
+ /**
1042
+ * Parse only friendly characters to use in family name
1043
+ * inside css file.
1044
+ *
1045
+ * @since 3.5.2
1046
+ * @access public
1047
+ *
1048
+ * @param string $name
1049
+ * @return string
1050
+ */
1051
+ public function sanitize_font_family_name( $name ) {
1052
+ $name = preg_replace( '/[^a-zA-Z0-9\-_]/', '', $name );
1053
+
1054
+ return $name;
1055
+ }
1056
+
1057
+ /**
1058
+ * Checkbox should only return 1 or 0
1059
+ *
1060
+ * @since 3.5.2
1061
+ * @access public
1062
+ *
1063
+ * @param string $val
1064
+ * @return void
1065
+ */
1066
+ public function sanitize_checkbox( $val ) {
1067
+ if ( $val )
1068
+ return 1;
1069
+ else
1070
+ return 0;
1071
+ }
1072
+
1073
+ /**
1074
+ * Make sure sidebar is valid
1075
+ *
1076
+ * @since 3.6.1
1077
+ * @access public
1078
+ *
1079
+ * @param mixed $value
1080
+ * @return void
1081
+ */
1082
+ public function sanitize_sidebar( $value ) {
1083
+ global $wp_registered_sidebars;
1084
+
1085
+ if ( 'none' == $value )
1086
+ return $value;
1087
+
1088
+ if ( array_key_exists( $value, $wp_registered_sidebars ) )
1089
+ return $value;
1090
+
1091
+ return 'none';
1092
+ }
1093
+
1094
+ /**
1095
+ * Sanitize multiple emails
1096
+ *
1097
+ * @since 3.7.1
1098
+ * @access public
1099
+ *
1100
+ * @param mixed $email
1101
+ * @return void
1102
+ */
1103
+ public function sanitize_emails( $email ) {
1104
+ $valid = array();
1105
+
1106
+ $email = explode( ',', $email );
1107
+
1108
+ foreach ( $email as $e ) {
1109
+ $e = trim( $e );
1110
+ if ( is_email( $e ) )
1111
+ $valid[] = $e;
1112
+ }
1113
+
1114
+ if ( ! empty( $valid ) )
1115
+ return implode( ',', $valid );
1116
+
1117
+ return null;
1118
+ }
1119
+
1120
+ public function sanitize_esc_url_raw( $value ) {
1121
+ return esc_url_raw( $value );
1122
+ }
1123
+
1124
+ public function sanitize_none( $value ) {
1125
+ return $value;
1126
+ }
1127
+ }
includes/vendors/wpc-settings-framework/css/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/vendors/wpc-settings-framework/css/media-uploader.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Media Upload Popup
3
+ *
4
+ * Could not figure out how to disable the link to field in the
5
+ * media manager, so I'm just hiding it for now
6
+ */
7
+
8
+ /* .wpcsf-custom-uploader .attachment-details, */
9
+ .wpcsf-custom-uploader .attachment-details label.setting,
10
+ .wpcsf-custom-uploader .attachment-display-settings label.setting:nth-child(2),
11
+ .wpcsf-custom-uploader .attachment-display-settings div.setting,
12
+ .wpcsf-custom-uploader .compat-attachment-fields {
13
+ display: none;
14
+ }
15
+
16
+ .wpcsf-custom-uploader-gallery-library .gallery-settings {
17
+ display: none;
18
+ }
includes/vendors/wpc-settings-framework/css/options.css ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * CSS Hacks
3
+ *
4
+ * Needed common CSS trick
5
+ */
6
+
7
+ .wpcsf-clearfix:after {
8
+ visibility: hidden;
9
+ display: block;
10
+ font-size: 0;
11
+ content: " ";
12
+ clear: both;
13
+ height: 0;
14
+ }
15
+
16
+ .wpcsf-clearfix { display: inline-block; }
17
+
18
+ * html .wpcsf-clearfix {
19
+ height: 1%;
20
+ }
21
+
22
+ .wpcsf-clearfix { display: block; }
23
+
24
+
25
+ /**
26
+ * Border Fields
27
+ */
28
+
29
+ .wpcsf-font-hover-fields .wpcsf-text-decoration,
30
+ .wpcsf-border-fields .wpcsf-border-style,
31
+ .wpcsf-border-fields .wp-border-width,
32
+ .wpcsf-border-fields .wp-picker-container {
33
+ margin-bottom: 7px;
34
+ }
35
+
36
+
37
+ /**
38
+ * Media Gallery
39
+ *
40
+ * Styles for media gallery
41
+ */
42
+
43
+ .wpcsf-image-upload {
44
+ padding-left: 5px !important;
45
+ }
46
+ .wpcsf-image-upload .wp-media-buttons-icon {
47
+ background: none repeat scroll 0% 0% transparent;
48
+ display: inline-block;
49
+ width: 18px;
50
+ height: 18px;
51
+ vertical-align: text-top;
52
+ margin: 0px 2px;
53
+ }
54
+ .wpcsf-image-upload .wp-media-buttons-icon:before {
55
+ content: '\f104';
56
+ font: normal 18px/1 'dashicons';
57
+ speak: none;
58
+ -webkit-font-smoothing: antialiased;
59
+ -moz-osx-font-smoothing: grayscale;
60
+ color: #888;
61
+ }
62
+
63
+ .wpcsf-preview-image img {
64
+ max-width: 700px;
65
+ max-height: 200px;
66
+ background: #FAFAFA;
67
+ border-color: #ccc #eee #eee #ccc;
68
+ border-style: solid;
69
+ border-width: 1px;
70
+ padding: 5px;
71
+ }
72
+
73
+ .wpcsf-preview-image {
74
+ margin-bottom: 5px;
75
+ }
76
+
77
+ .wpcsf-upload-font-textarea {
78
+ max-width: 900px;
79
+ height: 210px;
80
+ width: 97%;
81
+ }
82
+
83
+ .wpcsf-social-media-field .button,
84
+ .wpcsf-social-media-field input,
85
+ .wpcsf-image-field .button,
86
+ .wpcsf-image-field input,
87
+ .wpcsf-background-options .button,
88
+ .wpcsf-background-options select,
89
+ .wpcsf-background-options input {
90
+ margin-bottom: 7px;
91
+ }
92
+
93
+
94
+ /**
95
+ * Theme Options Display
96
+ *
97
+ * Specific style for theme options pages
98
+ */
99
+
100
+ .wpcsf-theme-options-display .form-table tr:nth-child(odd) {
101
+ background-color: #f2f2f2;
102
+ }
103
+
104
+ .wpcsf-wp-editor {
105
+ max-width: 900px;
106
+ width: 97%;
107
+ }
108
+
109
+ .wpcsf-textarea {
110
+ max-width: 900px;
111
+ height: 150px;
112
+ width: 97%;
113
+ }
114
+
115
+ /**
116
+ * Nav Tabs
117
+ */
118
+
119
+ .wpcsf-navigation .nav-tab {
120
+ border-bottom: 1px solid #ccc;
121
+ outline: none;
122
+ box-shadow: none;
123
+ }
124
+ .wpcsf-navigation .nav-tab.nav-tab-active {
125
+ border-bottom: 1px solid #f1f1f1;
126
+ }
127
+
128
+ /**
129
+ * Tabs
130
+ */
131
+
132
+ .wpcsf-tab {
133
+ display: none;
134
+ }
135
+ .wpcsf-tab.wpcsf-active-tab {
136
+ display: block;
137
+ }
138
+
139
+ /**
140
+ * Groups
141
+ */
142
+ .wpcsf-group .wpcsf-input-field label,
143
+ .wpcsf-group .wpcsf-image-field label {
144
+ display: inline-block;
145
+ }
146
+ .wpcsf-group .wpcsf-input-field {
147
+ margin-bottom: 5px;
148
+ }
149
+ .wpcsf-group .wpcsf-input-field .description {
150
+ display: inline-block;
151
+ }
includes/vendors/wpc-settings-framework/img/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/vendors/wpc-settings-framework/init.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*----------------------------------------------------------------------------*
3
+ * Dashboard and Administrative Functionality
4
+ *
5
+ * TODO: You must change the namespace here, and in the two class files.
6
+ *----------------------------------------------------------------------------*/
7
+
8
+ if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
9
+
10
+ require_once( 'class-wpc-settings-framework.php' );
11
+
12
+ add_action( 'plugins_loaded', array( 'WC_Gallery_Settings_Framework', 'get_instance' ) );
13
+ }
includes/vendors/wpc-settings-framework/js/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/vendors/wpc-settings-framework/js/media-uploader.js ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Chris Baldelomar
3
+ * @website http://webplantmedia.com/
4
+ */
5
+
6
+
7
+ (function($) {
8
+ "use strict";
9
+
10
+ var $body = $("body"), file_frame = [], media = wp.media;
11
+
12
+ //fetch preExisting selection of galleries. change the gallery state based on wheter we got a selection or not to "Edit gallery" or "AAdd gallery"
13
+ var fetchSelection = function(ids, options) {
14
+ if(typeof ids === 'undefined') {
15
+ return; //<--happens on multi_image insert for modal group
16
+ }
17
+
18
+ var id_array = ids.split(','),
19
+ args = {orderby: "post__in", order: "ASC", type: "image", perPage: -1, post__in:id_array},
20
+ attachments = wp.media.query( args ),
21
+ selection = new wp.media.model.Selection( attachments.models, {
22
+ props: attachments.props.toJSON(),
23
+ multiple: true
24
+ });
25
+
26
+
27
+ if(options.state === 'gallery-library' && id_array.length && !isNaN(parseInt(id_array[0],10))) {
28
+ options.state = 'gallery-edit';
29
+ }
30
+ return selection;
31
+ };
32
+
33
+ $body.on('click', '.wpcsf-image-upload', function( event ) {
34
+ event.preventDefault();
35
+
36
+ var clicked = $(this),
37
+ options = clicked.data(),
38
+ parent = clicked.parent(),
39
+ target = parent.find(options.target),
40
+ preview = parent.find(options.preview), // will not find <div> tag inside of <p>
41
+ prefill = fetchSelection(target.val(), options),
42
+ frame_key = _.random(0, 999999999999999999);
43
+ //set vars so we know that an editor is open
44
+
45
+ // If the media frame already exists, reopen it.
46
+ if ( file_frame[frame_key] ) {
47
+ file_frame[frame_key].open();
48
+ return;
49
+ }
50
+
51
+ // Create the media frame.
52
+ file_frame[frame_key] = wp.media({
53
+ frame: options.frame,
54
+ state: options.state,
55
+ library: { type: 'image' },
56
+ button: { text: options.button },
57
+ className: options['class'],
58
+ selection: prefill
59
+ });
60
+
61
+ if ( 'wpc_settings_framework_insert_single' === options.state ) {
62
+ // add the single insert state
63
+ file_frame[frame_key].states.add([
64
+ // Main states.
65
+ new media.controller.Library({
66
+ id: 'wpc_settings_framework_insert_single',
67
+ title: clicked.data( 'title' ),
68
+ priority: 20,
69
+ toolbar: 'select',
70
+ filterable: 'uploaded',
71
+ library: media.query( file_frame[frame_key].options.library ),
72
+ multiple: false,
73
+ editable: true,
74
+ displayUserSettings: false,
75
+ displaySettings: true,
76
+ allowLocalEdits: true
77
+ // AttachmentView: media.view.Attachment.Library
78
+ })
79
+ ]);
80
+ }
81
+ else if ( 'wpc_settings_framework_insert_multi' === options.state ) {
82
+ // add the single insert state
83
+ file_frame[frame_key].states.add([
84
+ new media.controller.Library({
85
+ id: 'wpc_settings_framework_insert_multi',
86
+ title: clicked.data( 'title' ),
87
+ priority: 20,
88
+ toolbar: 'select',
89
+ filterable: 'uploaded',
90
+ library: media.query( file_frame[frame_key].options.library ),
91
+ multiple: 'add',
92
+ editable: true,
93
+ displayUserSettings: false,
94
+ displaySettings: false,
95
+ allowLocalEdits: true
96
+ // AttachmentView: media.view.Attachment.Library
97
+ })
98
+ ]);
99
+ }
100
+
101
+ // When an image is selected, run a callback.
102
+ // Bind to various events since single insert and multiple trigger on different events and work with different data
103
+ file_frame[frame_key].on( 'select update insert', function(e) {
104
+ var selection, state = file_frame[frame_key].state();
105
+
106
+ // multiple items
107
+ if(typeof e !== 'undefined') {
108
+ selection = e;
109
+ }
110
+ // single item
111
+ else {
112
+ selection = state.get('selection');
113
+ }
114
+
115
+ var values , display, element, preview_html= "", preview_img;
116
+
117
+ values = selection.map( function( attachment ) {
118
+ element = attachment.toJSON();
119
+
120
+ if ( 'url' === options.fetch ) {
121
+ display = state.display( attachment ).toJSON();
122
+
123
+ if ( 'undefined' === typeof element.sizes ) {
124
+ preview_img = element.url;
125
+ preview_html += "<img src='"+preview_img+"' />";
126
+ }
127
+ else if ( ( 'string' === typeof options.imgsize ) && ( 'object' === typeof element.sizes[ options.imgsize ] ) ) {
128
+ preview_img = element.sizes[ options.imgsize ].url;
129
+ preview_html += "<img src='"+preview_img+"' />";
130
+ }
131
+ else {
132
+ preview_img = element.sizes[display.size].url;
133
+ preview_html += "<img src='"+preview_img+"' />";
134
+ }
135
+
136
+ return preview_img;
137
+ }
138
+ else if(options.fetch === 'id') {
139
+ preview_img = typeof element.sizes.thumbnail !== 'undefined' ? element.sizes.thumbnail.url : element.url ;
140
+ preview_html += "<img src='"+preview_img+"' />";
141
+
142
+ return element[options.fetch];
143
+ }
144
+ else {
145
+ return element.url;
146
+ }
147
+ });
148
+
149
+ if ( target.length ) {
150
+ target.val( values.join(',') ).trigger('change');
151
+
152
+ // triggers change in customizer
153
+ target.keyup();
154
+ }
155
+
156
+ if ( preview.length ) {
157
+ preview.html( preview_html ).show();
158
+ }
159
+ });
160
+
161
+ // Finally, open the modal
162
+ file_frame[frame_key].open();
163
+ })
164
+ .on('click', '.wpcsf-restore-image', function( e ) {
165
+ e.preventDefault();
166
+
167
+ var clicked = $(this),
168
+ options = clicked.data(),
169
+ parent = clicked.parent(),
170
+ target = parent.find(options.target),
171
+ preview = parent.find(options.preview);
172
+
173
+ $(target).val(options.restore);
174
+
175
+ if ( preview.length && options.restore.length ) {
176
+ $(preview).html('<img src="'+options.restore+'" />').show();
177
+ }
178
+ else {
179
+ $(preview).html("").hide();
180
+ }
181
+
182
+ $(target).keyup();
183
+ })
184
+ .on('click', '.wpcsf-delete-image', function( e ) {
185
+ e.preventDefault();
186
+
187
+ var clicked = $(this),
188
+ options = clicked.data(),
189
+ parent = clicked.parent(),
190
+ target = parent.find(options.target),
191
+ preview = parent.find(options.preview);
192
+
193
+ $(target).val('');
194
+
195
+ if ( preview.length ) {
196
+ $(preview).html("").hide();
197
+ }
198
+
199
+ $(target).keyup();
200
+ })
201
+ })(jQuery);
includes/vendors/wpc-settings-framework/js/options.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Chris Baldelomar
3
+ * @website http://wordpresscanvas.com/
4
+ */
5
+
6
+
7
+ (function ($) {
8
+ "use strict";
9
+
10
+ $(document).ready(function() {
11
+ $('.wpcsf-color-field').wpColorPicker();
12
+
13
+ $('.wpcsf-order-show-hide').sortable({ axis: "y" });
14
+
15
+ var $nav = $('.wpcsf-navigation');
16
+ if ( $nav.length > 0 ) {
17
+ var $navTab = $nav.find('.nav-tab');
18
+ var $pageTab = $('.wpcsf-tab');
19
+
20
+ var cookieName = $nav.data('cookieName');
21
+
22
+ $navTab.click( function( event ) {
23
+ event.preventDefault();
24
+
25
+ var $this = $(this);
26
+
27
+ var target = $this.data('target');
28
+ if ( 'string' == typeof target ) {
29
+ $navTab.removeClass('nav-tab-active');
30
+ $pageTab.removeClass('wpcsf-active-tab');
31
+
32
+ $navTab.filter('#nav-'+target).addClass('nav-tab-active');
33
+ $pageTab.filter('#'+target).addClass('wpcsf-active-tab');
34
+
35
+ if ( 'string' == typeof cookieName ) {
36
+ wpCookies.set( cookieName, target, 7 * 24 * 60 * 60 );
37
+ }
38
+ }
39
+
40
+ $('.wpcsf-tab-wrap .updated.settings-error').hide();
41
+
42
+ return false;
43
+ });
44
+ }
45
+ });
46
+ }(jQuery));
includes/vendors/wpc-settings-framework/views/group.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="wpcsf-<?php echo $args['id']; ?>-group" class="wpcsf-group">
2
+
3
+ <?php foreach ( $args['group'] as $g ) : ?>
4
+ <?php $this->display_setting( $g ); ?>
5
+ <?php endforeach; ?>
6
+
7
+ <?php if ( isset( $args['description'] ) ) : ?>
8
+ <p class="description"><?php echo $args['description']; ?></p>
9
+ <?php endif; ?>
10
+
11
+ </div>
includes/vendors/wpc-settings-framework/views/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/vendors/wpc-settings-framework/views/page.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap wpcsf-wrap">
2
+ <?php screen_icon(); ?>
3
+ <h2 id="theme-options-heading"><?php echo esc_html( $o['page_title'] ); ?></h2>
4
+
5
+ <?php if ( isset( $_GET['settings-updated'] ) ) : ?>
6
+ <div id="message" class="updated"><p><strong><?php _e( 'Settings saved.', 'wpc-settings-framework' ) ?></strong></p></div>
7
+ <?php endif; ?>
8
+
9
+ <form id="wpcsf-options" method="post" action="options.php">
10
+ <?php
11
+ // settings_fields( $option_group )
12
+ // @option_group A settings group name. This should match the group name used in register_setting()
13
+ settings_fields( $o['option_group'] );
14
+
15
+ // do_settings_fields( $page, $section )
16
+ // @page Slug title of the admin page whose settings fields you want to show, should match the group name used in add_settings_section()
17
+ // @section Slug title of the settings section whose fields you want to show. This should match the section ID used in add_settings_section()
18
+ //do_settings_fields( 'webpm-select-template', 'webpm-template-section' );
19
+
20
+ // do_settings_sections( $page )
21
+ // The slug name of the page whose settings sections you want to output. This should match the page name used in add_settings_section()
22
+ do_settings_sections( $menu_slug );
23
+ ?>
24
+
25
+ <p class="submit">
26
+ <?php submit_button( null, 'primary', 'submit', false ); ?>
27
+ <?php //submit_button( 'Restore Default Settings', 'delete', 'submit', false ); ?>
28
+ </p>
29
+ </form>
30
+ </div>
includes/vendors/wpc-settings-framework/views/settings-error.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ wp_reset_vars( array( 'action' ) );
3
+
4
+ if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {
5
+ // For backwards compat with plugins that don't use the Settings API and just set updated=1 in the redirect
6
+ add_settings_error( $menu_slug, 'settings_updated', __('Settings saved.'), 'updated' );
7
+ }
8
+
9
+ settings_errors();
10
+ ?>
includes/vendors/wpc-settings-framework/views/settings/background-options.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // preview image default style
3
+ $style = '';
4
+ if ( empty( $val['image'] ) )
5
+ $style = ' style="display:none"';
6
+ ?>
7
+
8
+ <div class="wpcsf-background-options">
9
+ <?php // Background Image ?>
10
+ <input name="<?php echo $option_name; ?>[image]" id="<?php echo $option_name; ?>" class="regular-text ltr upload-input" type="text" value="<?php echo esc_attr( $val['image'] ); ?>" />
11
+ <br />
12
+ <a class="button wpcsf-image-upload" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image" data-frame="select" data-state="wpc_settings_framework_insert_single" data-fetch="url" data-title="Insert Image" data-button="Insert" data-class="media-frame wpcsf-custom-uploader" title="Add Media"><span class="wp-media-buttons-icon"></span> Add Media</a>
13
+ <a class="button wpcsf-restore-image" data-restore="<?php echo esc_attr( $default['image'] ); ?>" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image">Default</a>
14
+ <a class="button wpcsf-delete-image" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image">Delete</a>
15
+ <br />
16
+ <p class="wpcsf-preview-image"<?php echo $style; ?>><img src="<?php echo esc_attr( $val['image'] ); ?>" /></p>
17
+
18
+ <?php // Background Repeat ?>
19
+ <select name="<?php echo $option_name; ?>[repeat]" >
20
+ <option value="repeat" <?php selected( $val['repeat'], 'repeat'); ?>>Repeat</option>
21
+ <option value="repeat-x" <?php echo selected( $val['repeat'], 'repeat-x', false ); ?>>Repeat Horizontal</option>
22
+ <option value="repeat-y" <?php echo selected( $val['repeat'], 'repeat-y', false ); ?>>Repeat Vertical</option>
23
+ <option value="no-repeat" <?php echo selected( $val['repeat'], 'no-repeat', false ); ?>>No Repeat</option>
24
+ <option value="" <?php selected( $val['repeat'], ''); ?>>Inherit</option>
25
+ </select>
26
+
27
+ <?php // Background position ?>
28
+ <select name="<?php echo $option_name; ?>[position]" >
29
+ <option value="left top" <?php selected( $val['position'], 'left top'); ?>>Left Top</option>
30
+ <option value="left center" <?php selected( $val['position'], 'left center'); ?>>Left Center</option>
31
+ <option value="left bottom" <?php selected( $val['position'], 'left bottom'); ?>>Left Bottom</option>
32
+ <option value="right top" <?php selected( $val['position'], 'right top'); ?>>Right Top</option>
33
+ <option value="right center" <?php selected( $val['position'], 'right center'); ?>>Right Center</option>
34
+ <option value="right bottom" <?php selected( $val['position'], 'right bottom'); ?>>Right Bottom</option>
35
+ <option value="center top" <?php selected( $val['position'], 'center top'); ?>>Center Top</option>
36
+ <option value="center center" <?php selected( $val['position'], 'center center'); ?>>Center Center</option>
37
+ <option value="center bottom" <?php selected( $val['position'], 'center bottom'); ?>>Center Bottom</option>
38
+ <option value="" <?php selected( $val['position'], ''); ?>>Inherit</option>
39
+ </select>
40
+
41
+ <?php // Background Attachment ?>
42
+ <select name="<?php echo $option_name; ?>[attachment]" >
43
+ <option value="scroll" <?php selected( $val['attachment'], 'scroll'); ?>>Scroll</option>
44
+ <option value="fixed" <?php selected( $val['attachment'], 'fixed'); ?>>Fixed</option>
45
+ <option value="" <?php selected( $val['attachment'], ''); ?>>Inherit</option>
46
+ </select>
47
+ <br />
48
+
49
+ <?php // Background Color ?>
50
+ <input name="<?php echo $option_name; ?>[color]" type="text" value="<?php echo $val['color']; ?>" class="wpcsf-color-field" data-default-color="<?php echo $default['color']; ?>" />
51
+
52
+ <?php // Description ?>
53
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
54
+ <p class="description"><?php echo $description; ?></p>
55
+ <?php endif; ?>
56
+ </div>
includes/vendors/wpc-settings-framework/views/settings/border-fields.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $val = wp_parse_args( $val, $default );
3
+ $val['width'] = preg_replace("/[^0-9]/", "",$val['width']);
4
+ ?>
5
+
6
+ <div class="wpcsf-border-fields">
7
+ <?php // Border Width ?>
8
+ <label for="<?php echo $option_name; ?>_width">Width</label>&nbsp;
9
+ <input type="number" min="0" class="wpcsf-border-width small-text" name="<?php echo $option_name; ?>[width]" id="<?php echo $option_name; ?>_width" value="<?php echo esc_attr($val['width']); ?>" />&nbsp;
10
+
11
+ <?php // Border Style ?>
12
+ <label for="<?php echo $option_name; ?>_style">Style</label>&nbsp;
13
+ <select name="<?php echo $option_name; ?>[style]" class="wpcsf-border-style" id="<?php echo $option_name; ?>_style" >
14
+ <option value="none" <?php selected( $val['style'], 'none'); ?>>None</option>
15
+ <option value="dotted" <?php selected( $val['style'], 'dotted'); ?>>Dotted</option>
16
+ <option value="dashed" <?php selected( $val['style'], 'dashed'); ?>>Dashed</option>
17
+ <option value="solid" <?php selected( $val['style'], 'solid'); ?>>Solid</option>
18
+ <option value="double" <?php selected( $val['style'], 'double'); ?>>Double</option>
19
+ </select>&nbsp;
20
+ <br />
21
+
22
+ <input name="<?php echo $option_name; ?>[color]" type="text" value="<?php echo esc_attr( $val['color'] ); ?>" class="wpcsf-color-field" data-default-color="<?php echo $default['color']; ?>" />
23
+
24
+ <?php // Description ?>
25
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
26
+ <p class="description"><?php echo $description; ?></p>
27
+ <?php endif; ?>
28
+ </div>
includes/vendors/wpc-settings-framework/views/settings/checkbox-field.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( isset( $label ) ) : ?>
2
+ <label for="<?php echo esc_attr($option_name); ?>">
3
+ <?php endif; ?>
4
+
5
+ <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" type="checkbox" value="1" <?php checked( true, $val ); ?> />
6
+
7
+ <?php if ( isset( $label ) ) : ?>
8
+ &nbsp;<?php echo $label; ?></label>&nbsp;
9
+ <?php endif; ?>
10
+
11
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
12
+ <p class="description"><?php echo $description; ?></p>
13
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/color-field.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( isset( $label ) ) : ?>
2
+ <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
3
+ <?php endif; ?>
4
+
5
+ <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" type="text" value="<?php echo esc_attr( $val ); ?>" class="wpcsf-color-field" data-default-color="<?php echo $default; ?>" /><br />
6
+
7
+ <?php // Description ?>
8
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
9
+ <p class="description"><?php echo $description; ?></p>
10
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/custom-checkboxes.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $val = is_array( $val ) ? $val : array();
3
+
4
+ if ( isset( $options_callback ) && ! empty( $options_callback ) )
5
+ $options = call_user_func( $options_callback );
6
+ ?>
7
+
8
+ <?php foreach ( $options as $key => $name ) : ?>
9
+ <label>
10
+ <?php $checked = in_array( $key, $val ) ? ' checked="checked"' : ''; ?>
11
+ <input name="<?php echo $option_name; ?>[]" type="checkbox" value="<?php echo $key; ?>" <?php echo $checked; ?> />
12
+ <?php echo $name; ?></label><br />
13
+ <?php endforeach; ?>
14
+
15
+ <?php // Description ?>
16
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
17
+ <p class="description"><?php echo $description; ?></p>
18
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/custom-dropdown.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( isset( $options_callback ) && ! empty( $options_callback ) )
3
+ $options = call_user_func( $options_callback );
4
+ ?>
5
+
6
+ <?php if ( isset( $label ) ) : ?>
7
+ <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
8
+ <?php endif; ?>
9
+
10
+ <select name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>">
11
+ <?php foreach ( $options as $key => $name ) : ?>
12
+ <option value="<?php echo $key; ?>" <?php selected( $val, $key); ?>><?php echo $name; ?></option>
13
+ <?php endforeach; ?>
14
+ </select>&nbsp;
15
+
16
+ <?php // Description ?>
17
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
18
+ <p class="description"><?php echo $description; ?></p>
19
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/custom-radio.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( isset( $options_callback ) && ! empty( $options_callback ) )
3
+ $options = call_user_func( $options_callback );
4
+ ?>
5
+
6
+ <?php foreach ( $options as $key => $name ) : ?>
7
+ <label>
8
+ <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" type="radio" value="<?php echo $key; ?>" <?php checked( $val, $key ); ?> />
9
+ <?php echo $name; ?></label><br />
10
+ <?php endforeach; ?>
11
+
12
+ <?php // Description ?>
13
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
14
+ <p class="description"><?php echo $description; ?></p>
15
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/decimal-input-field.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $val = preg_replace("/[^0-9\.\-]/", "",$val);
3
+ ?>
4
+
5
+ <?php if ( isset( $label ) ) : ?>
6
+ <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
7
+ <?php endif; ?>
8
+
9
+ <input type="number" class="small-text" step="any" name="<?php echo esc_attr($option_name); ?>" id="<?php echo $option_name; ?>" value="<?php echo esc_attr($val); ?>" />&nbsp;
10
+
11
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
12
+ <p class="description"><?php echo $description; ?></p>
13
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/gallery-fields.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // preview image default style
3
+ $style = '';
4
+ if ( empty( $val['image'] ) )
5
+ $style = ' style="display:none"';
6
+ ?>
7
+
8
+ <div class="wpcsf-image-field">
9
+ <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" class="regular-text ltr upload-input" type="hidden" value="<?php echo esc_attr($val); ?>" />
10
+ <a class="button wpcsf-image-upload" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image" data-frame="post" data-state="gallery-library" data-fetch="id" data-imgsize="thumbnail" data-title="Insert Gallery" data-button="Insert" data-class="media-frame wpcsf-custom-uploader-gallery-library" title="Add Media"><span class="wp-media-buttons-icon"></span> Add Media</a>
11
+ <a class="button wpcsf-delete-image" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image">Delete</a>
12
+ <p class="wpcsf-preview-image"<?php echo $style; ?>>
13
+ <?php $ids = explode( ',', $val ); ?>
14
+ <?php foreach ( $ids as $id ) : ?>
15
+ <?php $src = wp_get_attachment_image_src( $id, 'thumbnail', false ); ?>
16
+ <img src="<?php echo $src[0]; ?>" />
17
+ <?php endforeach; ?>
18
+ </p>
19
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
20
+ <p class="description"><?php echo $description; ?></p>
21
+ <?php endif; ?>
22
+ </div>
includes/vendors/wpc-settings-framework/views/settings/image-field.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // preview image default style
3
+ $style = '';
4
+ if ( empty( $val ) )
5
+ $style = ' style="display:none"';
6
+ ?>
7
+
8
+ <div class="wpcsf-image-field">
9
+ <?php if ( isset( $label ) ) : ?>
10
+ <label for="<?php echo esc_attr($option_name); ?>"><?php echo $label; ?></label>&nbsp;
11
+ <?php endif; ?>
12
+
13
+ <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" class="regular-text ltr upload-input" type="text" value="<?php echo esc_attr($val); ?>" />
14
+ <br />
15
+ <a class="button wpcsf-image-upload" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image" data-frame="select" data-state="wpc_settings_framework_insert_single" data-fetch="url" data-title="Insert Image" data-button="Insert" data-class="media-frame wpcsf-custom-uploader" title="Add Media"><span class="wp-media-buttons-icon"></span> Add Media</a>
16
+ <a class="button wpcsf-restore-image" data-restore="<?php echo $default; ?>" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image">Default</a>
17
+ <a class="button wpcsf-delete-image" data-target="#<?php echo $option_name; ?>" data-preview=".wpcsf-preview-image">Delete</a>
18
+ <p class="wpcsf-preview-image"<?php echo $style; ?>><img src="<?php echo esc_attr($val); ?>" /></p>
19
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
20
+ <p class="description"><?php echo $description; ?></p>
21
+ <?php endif; ?>
22
+ </div>
23
+ <?php
includes/vendors/wpc-settings-framework/views/settings/input-field.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpcsf-input-field">
2
+ <?php if ( isset( $label ) ) : ?>
3
+ <label for="<?php echo esc_attr($option_name); ?>"><?php echo $label; ?></label>&nbsp;
4
+ <?php endif; ?>
5
+
6
+ <input name="<?php echo $option_name; ?>" id="<?php echo $option_name; ?>" type="text" value="<?php echo esc_attr($val); ?>" class="regular-text" />
7
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
8
+ <p class="description"><?php echo $description; ?></p>
9
+ <?php endif; ?>
10
+ </div>
includes/vendors/wpc-settings-framework/views/settings/number-input-field.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $val = (int) preg_replace("/[^0-9\-]/", "",$val);
3
+ ?>
4
+
5
+ <?php if ( isset( $label ) ) : ?>
6
+ <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
7
+ <?php endif; ?>
8
+
9
+ <input type="number" class="small-text" step="1" name="<?php echo esc_attr($option_name); ?>" id="<?php echo $option_name; ?>" value="<?php echo esc_attr($val); ?>" />&nbsp;
10
+
11
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
12
+ <p class="description"><?php echo $description; ?></p>
13
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/order-show-hide.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $not_selected = $default;
3
+ ?>
4
+
5
+ <?php if ( isset( $label ) ) : ?>
6
+ <label for="<?php echo esc_attr($option_name); ?>"><?php echo $label; ?></label>&nbsp;
7
+ <?php endif; ?>
8
+
9
+ <ul class="wpcsf-clearfix wpcsf-order-show-hide">
10
+ <?php if ( is_array( $val ) && ! empty( $val ) ) : ?>
11
+ <?php foreach ( $val as $key => $name ) : ?>
12
+ <li>
13
+ <p style="width:300px;background-color:#f7f7f7;border:1px solid #dfdfdf;padding:5px 5px;line-height:1;margin:0;text-align:left;cursor:move;">
14
+ <input type="checkbox" name="<?php echo $option_name; ?>[<?php echo $key; ?>]" value="<?php echo $name; ?>" <?php checked( true, true ); ?> />
15
+ <?php echo $name; ?>
16
+ </p>
17
+ </li>
18
+ <?php unset( $not_selected[ $key ] ); ?>
19
+ <?php endforeach; ?>
20
+ <?php endif; ?>
21
+
22
+ <?php foreach ( $not_selected as $key => $name ) : ?>
23
+ <li>
24
+ <p style="width:300px;background-color:#f7f7f7;border:1px solid #dfdfdf;padding:5px 5px;line-height:1;margin:0;text-align:left;cursor:move;">
25
+ <input type="checkbox" name="<?php echo $option_name; ?>[<?php echo $key; ?>]" value="<?php echo $name; ?>" <?php checked( true, false ); ?> />
26
+ <?php echo $name; ?>
27
+ </p>
28
+ </li>
29
+ <?php unset( $not_selected[ $key ] ); ?>
30
+ <?php endforeach; ?>
31
+ </ul>
32
+
33
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
34
+ <p class="description"><?php echo $description; ?></p>
35
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/pixel-input-field.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $val = preg_replace("/[^0-9\-]/", "",$val);
3
+ ?>
4
+
5
+ <?php if ( isset( $label ) ) : ?>
6
+ <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
7
+ <?php endif; ?>
8
+
9
+ <input type="number" class="small-text" name="<?php echo esc_attr($option_name); ?>" id="<?php echo $option_name; ?>" value="<?php echo esc_attr($val); ?>" />&nbsp;
10
+
11
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
12
+ <p class="description"><?php echo $description; ?></p>
13
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/positive-number-input-field.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $val = preg_replace("/[^0-9]/", "",$val);
3
+ ?>
4
+
5
+ <?php if ( isset( $label ) ) : ?>
6
+ <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
7
+ <?php endif; ?>
8
+
9
+ <input type="number" min="0" class="small-text" name="<?php echo esc_attr($option_name); ?>" id="<?php echo $option_name; ?>" value="<?php echo esc_attr($val); ?>" />&nbsp;
10
+
11
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
12
+ <p class="description"><?php echo $description; ?></p>
13
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/positive-pixel-input-field.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $val = preg_replace("/[^0-9]/", "",$val);
3
+ ?>
4
+
5
+ <?php if ( isset( $label ) ) : ?>
6
+ <label for="<?php echo $option_name; ?>"><?php echo $label; ?></label>&nbsp;
7
+ <?php endif; ?>
8
+
9
+ <input type="number" min="0" class="small-text" name="<?php echo esc_attr($option_name); ?>" id="<?php echo $option_name; ?>" value="<?php echo esc_attr($val); ?>" />&nbsp;
10
+
11
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
12
+ <p class="description"><?php echo $description; ?></p>
13
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/textarea-field.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php if ( isset( $label ) ) : ?>
2
+ <label for="<?php echo esc_attr($option_name); ?>"><?php echo $label; ?></label>&nbsp;
3
+ <?php endif; ?>
4
+
5
+ <textarea name="<?php echo $option_name; ?>" class="wpcsf-textarea" id="<?php echo $option_name; ?>"><?php echo esc_textarea($val); ?></textarea>
6
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
7
+ <p class="description"><?php echo $description; ?></p>
8
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/settings/wp-editor.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( isset( $label ) ) : ?>
2
+ <label for="<?php echo esc_attr($option_name); ?>"><?php echo $label; ?></label>&nbsp;
3
+ <?php endif; ?>
4
+
5
+ <div class="wpcsf-wp-editor">
6
+ <?php wp_editor( $val, $option_name ); ?>
7
+ </div>
8
+
9
+ <?php if ( isset( $description ) && !empty( $description ) ) : ?>
10
+ <p class="description"><?php echo $description; ?></p>
11
+ <?php endif; ?>
includes/vendors/wpc-settings-framework/views/tabs.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $active_tab = null;
3
+ $cookie_name = $this->plugin_prefix . 'wpcsf_active_tab';
4
+
5
+ // restore last tab visited
6
+ if ( empty( $active_tab ) && isset( $_COOKIE[ $cookie_name ] ) && ! empty( $_COOKIE[ $cookie_name ] ) ) {
7
+ $last_tab = $_COOKIE[ $cookie_name ];
8
+ if ( isset( $this->tabs[ $menu_slug ][ $last_tab ] ) ) {
9
+ $active_tab = $last_tab;
10
+ }
11
+ }
12
+ ?>
13
+ <div class="wrap wpcsf-wrap wpcsf-tab-wrap">
14
+ <?php screen_icon(); ?>
15
+ <?php
16
+ $links = array();
17
+ foreach( $this->wp_settings_tabs[ $menu_slug ] as $tab_id => $tab ) :
18
+ $tab_title = 'No Title';
19
+ if ( isset( $this->tabs[ $menu_slug ][ $tab_id ]['title'] ) ) {
20
+ $tab_title = $this->tabs[ $menu_slug ][ $tab_id ]['title'];
21
+ }
22
+ if ( empty( $active_tab ) || $tab_id == $active_tab ) {
23
+ $active_tab = $tab_id;
24
+
25
+ $links[] = "<a id='nav-{$tab_id}' class='nav-tab nav-tab-active' data-target='{$tab_id}' href='#'>{$tab_title}</a>";
26
+ }
27
+ else {
28
+ $links[] = "<a id='nav-{$tab_id}' class='nav-tab' data-target='{$tab_id}' href='#'>{$tab_title}</a>";
29
+ }
30
+ endforeach;
31
+ ?>
32
+ <h2 class="wpcsf-navigation nav-tab-wrapper" data-cookie-name="<?php echo $cookie_name; ?>">
33
+ <?php echo implode( '', $links ); ?>
34
+ </h2>
35
+
36
+ <?php require( 'settings-error.php' ); ?>
37
+
38
+ <form id="wpcsf-options" method="post" action="options.php">
39
+ <?php
40
+ // settings_fields( $option_group )
41
+ // @option_group A settings group name. This should match the group name used in register_setting()
42
+ settings_fields( $o['option_group'] );
43
+
44
+ // do_settings_fields( $page, $section )
45
+ // @page Slug title of the admin page whose settings fields you want to show, should match the group name used in add_settings_section()
46
+ // @section Slug title of the settings section whose fields you want to show. This should match the section ID used in add_settings_section()
47
+ //do_settings_fields( 'webpm-select-template', 'webpm-template-section' );
48
+
49
+ // do_settings_sections( $page )
50
+ // The slug name of the page whose settings sections you want to output. This should match the page name used in add_settings_section()
51
+ global $wp_settings_sections, $wp_settings_fields;
52
+
53
+ if ( ! isset( $wp_settings_sections[$menu_slug] ) )
54
+ return;
55
+
56
+ foreach ( (array) $this->wp_settings_tabs[$menu_slug] as $tab_id => $tab ) {
57
+ $class = array();
58
+ $class[] = 'wpcsf-tab';
59
+ if ( $active_tab == $tab_id ) {
60
+ $class[] = 'wpcsf-active-tab';
61
+ }
62
+ echo "<div class='".implode( $class, ' ' )."' id='{$tab_id}'>\n";
63
+
64
+ foreach( $tab as $section ) {
65
+ if ( $section['title'] )
66
+ echo "<h3>{$section['title']}</h3>\n";
67
+
68
+ if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$menu_slug] ) || !isset( $wp_settings_fields[$menu_slug][$section['id']] ) )
69
+ continue;
70
+
71
+ echo '<table class="form-table">';
72
+ do_settings_fields( $menu_slug, $section['id'] );
73
+ echo '</table>';
74
+ }
75
+
76
+ echo '</div>';
77
+ }
78
+ ?>
79
+
80
+ <p class="submit">
81
+ <?php submit_button( null, 'primary', 'submit', false ); ?>
82
+ <?php //submit_button( 'Restore Default Settings', 'delete', 'submit', false ); ?>
83
+ </p>
84
+ </form>
85
+ </div>
readme.txt CHANGED
@@ -46,6 +46,14 @@ Insert a gallery through your dashboard. You will see extra dropdown settings wh
46
 
47
  == Changelog ==
48
 
 
 
 
 
 
 
 
 
49
  = Version 1.27 =
50
 
51
  * Removed 'Image Size' from gallery option since WordPress includes it by default now.
46
 
47
  == Changelog ==
48
 
49
+ = Version 1.28 =
50
+
51
+ * Removed loading of widgets file
52
+ * Updated options panel with settings framework
53
+ * Fixed style bug with magnific popup
54
+ * Updated Magnific Popup Library
55
+ * FIxed bug with gallery insertion option not being referenced correctly
56
+
57
  = Version 1.27 =
58
 
59
  * Removed 'Image Size' from gallery option since WordPress includes it by default now.
wc-gallery.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpresscanvas.com/features/gallery/
5
  Description: Extend WordPress galleries to display masonry gallery, carousel gallery, and slider gallery
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
- Version: 1.27
9
  License: GPLv2 or later
10
  */
11
 
@@ -13,7 +13,7 @@ function wc_gallery_using_woocommerce() {
13
  return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
14
  }
15
 
16
- define( 'WC_GALLERY_VERSION', '1.27' );
17
  define( 'WC_GALLERY_PREFIX', 'wc_gallery_' );
18
  define( '_WC_GALLERY_PREFIX', '_wc_gallery_' );
19
  define( 'WC_GALLERY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -81,8 +81,8 @@ $wc_gallery_theme_support = array(
81
  ),
82
  );
83
 
 
84
  require_once( dirname(__FILE__) . '/includes/functions.php' ); // Adds basic filters and actions
85
  require_once( dirname(__FILE__) . '/includes/options.php' ); // define options array
86
- require_once( dirname(__FILE__) . '/includes/settings.php' ); // Adds settings
87
  require_once( dirname(__FILE__) . '/includes/scripts.php' ); // Adds plugin JS and CSS
88
- require_once( dirname(__FILE__) . '/includes/widgets.php' ); // include any widgets
5
  Description: Extend WordPress galleries to display masonry gallery, carousel gallery, and slider gallery
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 1.28
9
  License: GPLv2 or later
10
  */
11
 
13
  return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
14
  }
15
 
16
+ define( 'WC_GALLERY_VERSION', '1.28' );
17
  define( 'WC_GALLERY_PREFIX', 'wc_gallery_' );
18
  define( '_WC_GALLERY_PREFIX', '_wc_gallery_' );
19
  define( 'WC_GALLERY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
81
  ),
82
  );
83
 
84
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/vendors/wpc-settings-framework/init.php' );
85
  require_once( dirname(__FILE__) . '/includes/functions.php' ); // Adds basic filters and actions
86
  require_once( dirname(__FILE__) . '/includes/options.php' ); // define options array
 
87
  require_once( dirname(__FILE__) . '/includes/scripts.php' ); // Adds plugin JS and CSS
88
+ // require_once( dirname(__FILE__) . '/includes/widgets.php' ); // include any widgets