SiteOrigin Widgets Bundle - Version 1.5

Version Description

  • October 5 2015 =
  • Fixed: Conflict between WPML and repeaters.
  • Added Simple Masonry Layout widget.
  • Added Contact Form widget.
  • Added Image Grid widget.
  • Added Testimonial widget.
  • Changed layout of widgets activation page.
  • Added Trianglify to generate placeholder widget icons.
  • Added mechanism to use state emitters in repeaters.
  • Section expanded/collapsed states now stored across form loads.
  • Display once off admin notice when new widgets are available.
  • Fixed translation domain.
  • Editor Widget: Allow more HTML in Editor widget for trusted users.
  • Hero Image Widget: Added top padding setting.
  • Hero Image Widget: Can now set background click URL.
  • Hero Image Widget: Improved handling of buttons shortcode.
  • Slider Widget : Fixed open in new window setting.
  • Headline Widget: Added word-break CSS.
  • Headline Widget: Added option to set type of heading tags used.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 SiteOrigin Widgets Bundle
Version 1.5
Comparing to
See all releases

Code changes from version 1.4.4 to 1.5

Files changed (82) hide show
  1. admin/admin.css +70 -176
  2. admin/admin.js +73 -21
  3. admin/admin.min.js +1 -1
  4. admin/tpl/admin.php +34 -17
  5. admin/trianglify.js +3445 -0
  6. admin/trianglify.min.js +2 -0
  7. base/inc.php +2 -4
  8. base/inc/fields/base.class.php +5 -5
  9. base/inc/fields/checkbox.class.php +1 -1
  10. base/inc/fields/container-base.class.php +23 -5
  11. base/inc/fields/error.class.php +26 -0
  12. base/inc/fields/factory.class.php +11 -1
  13. base/inc/fields/media.class.php +3 -3
  14. base/inc/fields/number.class.php +1 -1
  15. base/inc/fields/repeater.class.php +6 -2
  16. base/inc/fields/section.class.php +11 -3
  17. base/inc/fields/widget.class.php +3 -3
  18. base/inc/meta-box-manager.php +2 -2
  19. base/inc/post-selector.php +29 -29
  20. base/inc/widget-manager.class.php +17 -8
  21. base/inc/widgets/base-slider.class.php +27 -20
  22. base/js/admin.js +215 -166
  23. base/js/admin.min.js +1 -1
  24. base/siteorigin-widget.class.php +14 -6
  25. icons/icons.php +5 -5
  26. js/slider/jquery.slider.js +10 -1
  27. js/slider/jquery.slider.min.js +1 -1
  28. readme.txt +21 -1
  29. so-widgets-bundle.php +112 -18
  30. widgets/so-button-widget/assets/banner.svg +30 -31
  31. widgets/so-button-widget/so-button-widget.php +50 -50
  32. widgets/so-contact-widget/assets/banner.svg +43 -0
  33. widgets/so-contact-widget/so-contact-widget.php +757 -0
  34. widgets/so-contact-widget/styles/default.less +126 -0
  35. widgets/so-contact-widget/tpl/default.php +44 -0
  36. widgets/so-cta-widget/assets/banner.svg +33 -31
  37. widgets/so-cta-widget/so-cta-widget.php +19 -19
  38. widgets/so-editor-widget/assets/banner.svg +8 -8
  39. widgets/so-editor-widget/so-editor-widget.php +15 -8
  40. widgets/so-features-widget/assets/banner.svg +56 -57
  41. widgets/so-features-widget/so-features-widget.php +26 -26
  42. widgets/so-google-map-widget/assets/banner.svg +44 -43
  43. widgets/so-google-map-widget/so-google-map-widget.php +99 -99
  44. widgets/so-headline-widget/assets/banner.svg +38 -38
  45. widgets/so-headline-widget/so-headline-widget.php +73 -39
  46. widgets/so-headline-widget/styles/sow-headline.less +6 -2
  47. widgets/so-headline-widget/tpl/headline.php +2 -2
  48. widgets/so-hero-widget/assets/banner.svg +40 -44
  49. widgets/so-hero-widget/so-hero-widget.php +52 -32
  50. widgets/so-hero-widget/styles/default.less +2 -1
  51. widgets/so-image-grid-widget/css/image-grid.css +11 -0
  52. widgets/so-image-grid-widget/js/image-grid.js +45 -0
  53. widgets/so-image-grid-widget/js/image-grid.min.js +1 -0
  54. widgets/so-image-grid-widget/so-image-grid-widget.php +136 -0
  55. widgets/so-image-grid-widget/styles/default.less +11 -0
  56. widgets/so-image-grid-widget/tpl/default.php +16 -0
  57. widgets/so-image-widget/assets/banner.svg +36 -36
  58. widgets/so-image-widget/so-image-widget.php +20 -20
  59. widgets/so-post-carousel-widget/assets/banner.svg +44 -44
  60. widgets/so-post-carousel-widget/so-post-carousel-widget.php +10 -10
  61. widgets/so-price-table-widget/assets/banner.svg +36 -42
  62. widgets/so-price-table-widget/so-price-table-widget.php +31 -32
  63. widgets/so-simple-masonry-widget/js/packery.pkgd.js +4089 -0
  64. widgets/so-simple-masonry-widget/js/packery.pkgd.min.js +3 -0
  65. widgets/so-simple-masonry-widget/js/simple-masonry.js +65 -0
  66. widgets/so-simple-masonry-widget/js/simple-masonry.min.js +1 -0
  67. widgets/so-simple-masonry-widget/so-simple-masonry-widget.php +219 -0
  68. widgets/so-simple-masonry-widget/styles/simple-masonry.less +9 -0
  69. widgets/so-simple-masonry-widget/tpl/simple-masonry.php +27 -0
  70. widgets/so-slider-widget/assets/banner.svg +40 -44
  71. widgets/so-slider-widget/so-slider-widget.php +20 -20
  72. widgets/so-social-media-buttons-widget/assets/banner.svg +39 -39
  73. widgets/so-social-media-buttons-widget/data/networks.php +43 -43
  74. widgets/so-social-media-buttons-widget/so-social-media-buttons-widget.php +44 -44
  75. widgets/so-testimonial-widget/assets/banner.svg +41 -0
  76. widgets/so-testimonial-widget/css/style.css +56 -0
  77. widgets/so-testimonial-widget/so-testimonial-widget.php +332 -0
  78. widgets/so-testimonial-widget/styles/default.less +125 -0
  79. widgets/so-testimonial-widget/svg/svgdefs.svg +20 -0
  80. widgets/so-testimonial-widget/tpl/default.php +39 -0
  81. widgets/so-video-widget/assets/banner.svg +36 -34
  82. widgets/so-video-widget/so-video-widget.php +20 -21
admin/admin.css CHANGED
@@ -145,226 +145,120 @@
145
-webkit-box-sizing: border-box;
146
box-sizing: border-box;
147
padding: 0 12px 24px 12px;
148
- width: 20%;
149
}
150
@media screen and (max-width: 1800px) {
151
#sow-widgets-page #widgets-list .so-widget-wrap {
152
- width: 25%;
153
}
154
}
155
@media screen and (max-width: 1280px) {
156
#sow-widgets-page #widgets-list .so-widget-wrap {
157
- width: 33.33%;
158
}
159
}
160
- @media screen and (max-width: 800px) {
161
#sow-widgets-page #widgets-list .so-widget-wrap {
162
- width: 50%;
163
}
164
}
165
#sow-widgets-page #widgets-list .so-widget {
166
float: left;
167
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
168
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
169
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
170
padding: 0;
171
width: 100%;
172
- background: #F2F2F2;
173
- border: 1px solid #D9D9D9;
174
position: relative;
175
overflow: hidden;
176
- /* The Switch - © 2013 Thibaut Courouble - MIT License */
177
}
178
- #sow-widgets-page #widgets-list .so-widget .so-widgets-active-banner {
179
- position: absolute;
180
- background: #555555;
181
- background: rgba(0, 0, 0, 0.75);
182
- padding: 12px;
183
- text-align: center;
184
- top: 0px;
185
- left: 0px;
186
- width: 100%;
187
- font-weight: bold;
188
- font-size: 13px;
189
- line-height: 1em;
190
- color: #FFFFFF;
191
}
192
- #sow-widgets-page #widgets-list .so-widget img {
193
- display: block;
194
- width: 100%;
195
- height: auto;
196
- background: #FFFFFF;
197
- border-bottom: 1px solid #D9D9D9;
198
}
199
#sow-widgets-page #widgets-list .so-widget .so-widget-text {
200
- padding: 20px;
201
}
202
- #sow-widgets-page #widgets-list .so-widget .so-widget-text h4 {
203
margin-top: 0;
204
- color: #777777;
205
- font-weight: bold;
206
- font-size: 1.2em;
207
}
208
- #sow-widgets-page #widgets-list .so-widget .so-widget-text p.so-widget-description {
209
- margin-bottom: 0;
210
line-height: 1.35em;
211
color: #777777;
212
- min-height: 2.7em;
213
- }
214
- #sow-widgets-page #widgets-list .so-widget img,
215
- #sow-widgets-page #widgets-list .so-widget,
216
- #sow-widgets-page #widgets-list .so-widget .so-widget-text,
217
- #sow-widgets-page #widgets-list .so-widget .so-widget-text h4,
218
- #sow-widgets-page #widgets-list .so-widget .so-widget-text p {
219
- -webkit-transition: all 0.5s ease;
220
- -moz-transition: all 0.5s ease;
221
- -o-transition: all 0.5s ease;
222
- transition: all 0.5s ease;
223
- min-height: 1em;
224
- }
225
- #sow-widgets-page #widgets-list .so-widget .switch {
226
- float: right;
227
- position: relative;
228
- display: inline-block;
229
- vertical-align: top;
230
- width: 56px;
231
- height: 20px;
232
- padding: 3px;
233
- background-color: #ffffff;
234
- border-radius: 18px;
235
- box-shadow: inset 0 -1px #ffffff, inset 0 1px 1px rgba(0, 0, 0, 0.05);
236
- cursor: pointer;
237
- margin-left: 16px;
238
- background-image: -webkit-linear-gradient(top, #eeeeee, #ffffff 25px);
239
- background-image: -moz-linear-gradient(top, #eeeeee, #ffffff 25px);
240
- background-image: -o-linear-gradient(top, #eeeeee, #ffffff 25px);
241
- background-image: linear-gradient(to bottom, #eeeeee, #ffffff 25px);
242
}
243
- #sow-widgets-page #widgets-list .so-widget .switch .dashicons-yes {
244
- position: absolute;
245
- top: 2px;
246
- left: -20px;
247
- color: #009200;
248
- display: none;
249
}
250
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input {
251
- position: absolute;
252
- top: 0;
253
- left: 0;
254
- opacity: 0;
255
}
256
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label {
257
- position: relative;
258
- display: block;
259
- height: inherit;
260
- font-size: 10px;
261
- text-transform: uppercase;
262
- background: #eceeef;
263
- border-radius: inherit;
264
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15);
265
- -webkit-transition: 0.15s ease-out;
266
- -moz-transition: 0.15s ease-out;
267
- -o-transition: 0.15s ease-out;
268
- transition: 0.15s ease-out;
269
- -webkit-transition-property: opacity background;
270
- -moz-transition-property: opacity background;
271
- -o-transition-property: opacity background;
272
- transition-property: opacity background;
273
- }
274
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:before,
275
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:after {
276
- position: absolute;
277
- top: 50%;
278
- margin-top: -0.5em;
279
- line-height: 1;
280
- -webkit-transition: inherit;
281
- -moz-transition: inherit;
282
- -o-transition: inherit;
283
- transition: inherit;
284
- }
285
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:before {
286
- content: attr(data-off);
287
- right: 11px;
288
- color: #aaa;
289
- text-shadow: 0 1px rgba(255, 255, 255, 0.5);
290
- }
291
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:after {
292
- content: attr(data-on);
293
- left: 11px;
294
- color: #ffffff;
295
- text-shadow: 0 1px rgba(0, 0, 0, 0.2);
296
- opacity: 0;
297
}
298
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-label {
299
- background: #47a8d8;
300
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 0 3px rgba(0, 0, 0, 0.2);
301
}
302
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-label:before {
303
- opacity: 0;
304
}
305
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-label:after {
306
- opacity: 1;
307
}
308
- #sow-widgets-page #widgets-list .so-widget .switch .switch-handle {
309
- position: absolute;
310
- top: 4px;
311
- left: 4px;
312
- width: 18px;
313
- height: 18px;
314
- background: #ffffff;
315
- border-radius: 10px;
316
- box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
317
- background-image: -webkit-linear-gradient(top, #ffffff 40%, #f0f0f0);
318
- background-image: -moz-linear-gradient(top, #ffffff 40%, #f0f0f0);
319
- background-image: -o-linear-gradient(top, #ffffff 40%, #f0f0f0);
320
- background-image: linear-gradient(to bottom, #ffffff 40%, #f0f0f0);
321
- -webkit-transition: left 0.15s ease-out;
322
- -moz-transition: left 0.15s ease-out;
323
- -o-transition: left 0.15s ease-out;
324
- transition: left 0.15s ease-out;
325
- }
326
- #sow-widgets-page #widgets-list .so-widget .switch .switch-handle:before {
327
- content: '';
328
- position: absolute;
329
- top: 50%;
330
- left: 50%;
331
- margin: -6px 0 0 -6px;
332
- width: 12px;
333
- height: 12px;
334
- background: #f9f9f9;
335
- border-radius: 6px;
336
- box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
337
- background-image: -webkit-linear-gradient(top, #eeeeee, #ffffff);
338
- background-image: -moz-linear-gradient(top, #eeeeee, #ffffff);
339
- background-image: -o-linear-gradient(top, #eeeeee, #ffffff);
340
- background-image: linear-gradient(to bottom, #eeeeee, #ffffff);
341
- }
342
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-handle {
343
- left: 40px;
344
- box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
345
- }
346
- #sow-widgets-page #widgets-list .so-widget .switch .switch-green > .switch-input:checked ~ .switch-label {
347
- background: #4fb845;
348
- }
349
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active {
350
- background: #F9F9F9;
351
- border: 1px solid #C9C9C9;
352
- }
353
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active img {
354
- border-bottom: 1px solid #D9D9D9;
355
- }
356
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active .so-widget-text h4 {
357
- color: #333333;
358
- }
359
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active .so-widget-text p {
360
- color: #333333;
361
}
362
#sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive img {
363
filter: url(filters.svg#grayscale);
364
filter: gray;
365
-webkit-filter: grayscale(1);
366
opacity: 0.7;
367
}
368
#sow-widgets-page .developers-link {
369
padding: 0 30px;
370
text-align: right;
145
-webkit-box-sizing: border-box;
146
box-sizing: border-box;
147
padding: 0 12px 24px 12px;
148
+ width: 25%;
149
}
150
@media screen and (max-width: 1800px) {
151
#sow-widgets-page #widgets-list .so-widget-wrap {
152
+ width: 33.333%;
153
}
154
}
155
@media screen and (max-width: 1280px) {
156
#sow-widgets-page #widgets-list .so-widget-wrap {
157
+ width: 50%;
158
}
159
}
160
+ @media screen and (max-width: 960px) {
161
#sow-widgets-page #widgets-list .so-widget-wrap {
162
+ width: 100%;
163
}
164
}
165
#sow-widgets-page #widgets-list .so-widget {
166
+ border: 1px solid #D9D9D9;
167
float: left;
168
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
169
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
170
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
171
padding: 0;
172
width: 100%;
173
+ background: #fefefe;
174
position: relative;
175
overflow: hidden;
176
}
177
+ #sow-widgets-page #widgets-list .so-widget .so-widget-banner {
178
+ width: 128px;
179
+ height: 128px;
180
+ float: left;
181
+ margin: 20px;
182
+ overflow: hidden;
183
}
184
+ #sow-widgets-page #widgets-list .so-widget .so-widget-banner img,
185
+ #sow-widgets-page #widgets-list .so-widget .so-widget-banner svg {
186
+ height: 128px;
187
+ width: auto;
188
}
189
#sow-widgets-page #widgets-list .so-widget .so-widget-text {
190
+ padding: 20px 20px 20px 0;
191
+ margin-left: 178px;
192
}
193
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-active-indicator {
194
+ float: right;
195
+ margin: 0 0 10px 10px;
196
+ background: #00a0d2;
197
+ padding: 4px 10px;
198
+ color: #fff;
199
+ border-radius: 3px;
200
+ -webkit-transition: all 0.35s ease;
201
+ -moz-transition: all 0.35s ease;
202
+ -o-transition: all 0.35s ease;
203
+ transition: all 0.35s ease;
204
+ }
205
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text h3 {
206
+ color: #0073aa;
207
+ font-size: 1.4em;
208
+ font-weight: 500;
209
margin-top: 0;
210
}
211
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-description {
212
+ margin: 0;
213
line-height: 1.35em;
214
color: #777777;
215
}
216
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-byline {
217
+ font-size: 0.9em;
218
+ margin-top: 10px;
219
+ color: #999;
220
+ font-style: italic;
221
}
222
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-byline a {
223
+ color: #666;
224
+ text-decoration: none;
225
}
226
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-byline a:hover {
227
+ color: #555;
228
+ text-decoration: underline;
229
}
230
+ #sow-widgets-page #widgets-list .so-widget .so-widget-toggle-active {
231
+ margin-top: 15px;
232
}
233
+ #sow-widgets-page #widgets-list .so-widget .so-widget-toggle-active button:focus {
234
+ outline: none;
235
}
236
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-active .so-widget-toggle-active .so-widget-activate {
237
+ display: none;
238
}
239
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive .so-widget-toggle-active .so-widget-deactivate {
240
+ display: none;
241
}
242
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive .so-widget-active-indicator {
243
+ opacity: 0;
244
+ }
245
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive h3 {
246
+ color: #666;
247
+ }
248
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive svg,
249
#sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive img {
250
filter: url(filters.svg#grayscale);
251
filter: gray;
252
-webkit-filter: grayscale(1);
253
opacity: 0.7;
254
}
255
+ #sow-widgets-page #widgets-list.so-animated img,
256
+ #sow-widgets-page #widgets-list.so-animated svg {
257
+ -webkit-transition: all 0.45s ease;
258
+ -moz-transition: all 0.45s ease;
259
+ -o-transition: all 0.45s ease;
260
+ transition: all 0.45s ease;
261
+ }
262
#sow-widgets-page .developers-link {
263
padding: 0 30px;
264
text-align: right;
admin/admin.js CHANGED
@@ -1,46 +1,95 @@
1
- /* globals jQuery */
2
3
jQuery(function($){
4
5
- $('.so-widget .switch .switch-input').change(function(e){
6
- var $ = $(this);
7
- var s = $.is(':checked');
8
- var $sw = $.closest('.switch');
9
10
if(s) {
11
- $.closest('.so-widget').addClass('so-widget-is-active').removeClass('so-widget-is-inactive');
12
}
13
else {
14
- $.closest('.so-widget').removeClass('so-widget-is-active').addClass('so-widget-is-inactive');
15
}
16
17
// Lets send an ajax request.
18
$.post(
19
- $.data('url'),
20
- { 'active' : s },
21
function(data){
22
- $sw.find('.dashicons-yes').clearQueue().fadeIn('fast').delay(750).fadeOut('fast');
23
}
24
);
25
});
26
27
$(window).resize(function() {
28
- var $descriptions = $('div.so-widget-text');
29
var largestHeight = 0;
30
$descriptions.each(function () {
31
- var headerHeight = $(this).find('h4').height();
32
- var bodyHeight = $(this).find('p.so-widget-description').height();
33
- var headerMarginBottom = parseFloat($(this).find('h4').css('margin-bottom'));
34
- var bodyMarginTop = parseFloat($(this).find('p.so-widget-description').css('margin-top'));
35
- var innerMargin = Math.max(headerMarginBottom, bodyMarginTop);
36
- var divHeight = headerHeight + bodyHeight + innerMargin;
37
- largestHeight = Math.max(largestHeight, divHeight);
38
});
39
$descriptions.each(function () {
40
- var minHeight = parseInt($(this).css('min-height'));
41
- var divHeight = Math.max(largestHeight, minHeight);
42
- $(this).height(divHeight);
43
});
44
}).resize();
45
46
// Handle the tabs
@@ -72,4 +121,7 @@ jQuery(function($){
72
73
$(window).resize();
74
});
75
});
1
+ /* globals jQuery, soWidgetsAdmin */
2
3
jQuery(function($){
4
5
+ $('.so-widget-toggle-active button').click( function(){
6
+ var $ = $(this),
7
+ s = $.data('status'),
8
+ $w = $.closest('.so-widget');
9
10
if(s) {
11
+ $w.addClass('so-widget-is-active').removeClass('so-widget-is-inactive');
12
}
13
else {
14
+ $w.removeClass('so-widget-is-active').addClass('so-widget-is-inactive');
15
}
16
17
// Lets send an ajax request.
18
$.post(
19
+ soWidgetsAdmin.toggleUrl,
20
+ {
21
+ 'widget' : $w.data('id'),
22
+ 'active' : s
23
+ },
24
function(data){
25
+ // $sw.find('.dashicons-yes').clearQueue().fadeIn('fast').delay(750).fadeOut('fast');
26
}
27
);
28
+
29
+ } );
30
+
31
+ // Fill in the missing header images
32
+ $('.so-widget-banner').each( function(){
33
+ var $ = $(this),
34
+ $img = $.find('img');
35
+
36
+ if( !$img.length ) {
37
+ // Create an SVG image as a placeholder icon
38
+ var pattern = Trianglify({
39
+ width: 128,
40
+ height: 128,
41
+ variance : 1,
42
+ cell_size: 32,
43
+ seed: $.data('seed')
44
+ });
45
+
46
+ $.append( pattern.svg() );
47
+ }
48
+ else {
49
+ if( $img.width() > 128 ) {
50
+ // Deal with wide banner images
51
+ $img.css('margin-left', -($img.width()-128)/2 );
52
+ }
53
+ }
54
+ } );
55
+
56
+ // Lets implement the search
57
+ var widgetSearch = function(){
58
+ var q = $(this).val().toLowerCase();
59
+
60
+ if( q === '' ) {
61
+ $('.so-widget-wrap').show();
62
+ }
63
+ else {
64
+ $('.so-widget').each( function(){
65
+ var $ = $(this);
66
+
67
+ if( $.find('h3').html().toLowerCase().indexOf(q) > -1 ) {
68
+ $.parent().show();
69
+ }
70
+ else {
71
+ $.parent().hide();
72
+ }
73
+ } );
74
+ }
75
+ };
76
+ $('#sow-widget-search input').on( {
77
+ keyup: widgetSearch,
78
+ search: widgetSearch
79
});
80
81
$(window).resize(function() {
82
+ var $descriptions = $('.so-widget-text').css('height', 'auto');
83
var largestHeight = 0;
84
+
85
$descriptions.each(function () {
86
+ largestHeight = Math.max(largestHeight, $(this).height() );
87
});
88
+
89
$descriptions.each(function () {
90
+ $(this).css('height', largestHeight);
91
});
92
+
93
}).resize();
94
95
// Handle the tabs
121
122
$(window).resize();
123
});
124
+
125
+ // Finally enable css3 animations on the widgets list
126
+ $('#widgets-list').addClass('so-animated');
127
});
admin/admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(i){i(".so-widget .switch .switch-input").change(function(s){var e=i(this),t=e.is(":checked"),a=e.closest(".switch");t?e.closest(".so-widget").addClass("so-widget-is-active").removeClass("so-widget-is-inactive"):e.closest(".so-widget").removeClass("so-widget-is-active").addClass("so-widget-is-inactive"),i.post(e.data("url"),{active:t},function(i){a.find(".dashicons-yes").clearQueue().fadeIn("fast").delay(750).fadeOut("fast")})}),i(window).resize(function(){var s=i("div.so-widget-text"),e=0;s.each(function(){var s=i(this).find("h4").height(),t=i(this).find("p.so-widget-description").height(),a=parseFloat(i(this).find("h4").css("margin-bottom")),o=parseFloat(i(this).find("p.so-widget-description").css("margin-top")),c=Math.max(a,o),d=s+t+c;e=Math.max(e,d)}),s.each(function(){var s=parseInt(i(this).css("min-height")),t=Math.max(e,s);i(this).height(t)})}).resize(),i("#sow-widgets-page .page-nav a").click(function(s){s.preventDefault();var e=i(this),t=e.attr("href"),a=e.closest("li");switch(i("#sow-widgets-page .page-nav li").not(a).removeClass("active"),a.addClass("active"),t){case"#all":i(".so-widget-wrap").show();break;case"#enabled":i(".so-widget-wrap").hide(),i(".so-widget-wrap .so-widget-is-active").each(function(){i(this).closest(".so-widget-wrap").show()}),i(".so-widget-wrap .so-widget-is-inactive").each(function(){i(this).closest(".so-widget-wrap").hide()});break;case"#disabled":i(".so-widget-wrap .so-widget-is-active").each(function(){i(this).closest(".so-widget-wrap").hide()}),i(".so-widget-wrap .so-widget-is-inactive").each(function(){i(this).closest(".so-widget-wrap").show()})}i(window).resize()})});
1
+ jQuery(function(e){e(".so-widget-toggle-active button").click(function(){var i=e(this),s=i.data("status"),t=i.closest(".so-widget");s?t.addClass("so-widget-is-active").removeClass("so-widget-is-inactive"):t.removeClass("so-widget-is-active").addClass("so-widget-is-inactive"),e.post(soWidgetsAdmin.toggleUrl,{widget:t.data("id"),active:s},function(e){})}),e(".so-widget-banner").each(function(){var i=e(this),s=i.find("img");if(s.length)s.width()>128&&s.css("margin-left",-(s.width()-128)/2);else{var t=Trianglify({width:128,height:128,variance:1,cell_size:32,seed:i.data("seed")});i.append(t.svg())}});var i=function(){var i=e(this).val().toLowerCase();""===i?e(".so-widget-wrap").show():e(".so-widget").each(function(){var s=e(this);s.find("h3").html().toLowerCase().indexOf(i)>-1?s.parent().show():s.parent().hide()})};e("#sow-widget-search input").on({keyup:i,search:i}),e(window).resize(function(){var i=e(".so-widget-text").css("height","auto"),s=0;i.each(function(){s=Math.max(s,e(this).height())}),i.each(function(){e(this).css("height",s)})}).resize(),e("#sow-widgets-page .page-nav a").click(function(i){i.preventDefault();var s=e(this),t=s.attr("href"),a=s.closest("li");switch(e("#sow-widgets-page .page-nav li").not(a).removeClass("active"),a.addClass("active"),t){case"#all":e(".so-widget-wrap").show();break;case"#enabled":e(".so-widget-wrap").hide(),e(".so-widget-wrap .so-widget-is-active").each(function(){e(this).closest(".so-widget-wrap").show()}),e(".so-widget-wrap .so-widget-is-inactive").each(function(){e(this).closest(".so-widget-wrap").hide()});break;case"#disabled":e(".so-widget-wrap .so-widget-is-active").each(function(){e(this).closest(".so-widget-wrap").hide()}),e(".so-widget-wrap .so-widget-is-inactive").each(function(){e(this).closest(".so-widget-wrap").show()})}e(window).resize()}),e("#widgets-list").addClass("so-animated")});
admin/tpl/admin.php CHANGED
@@ -8,11 +8,9 @@
8
</span>
9
<h1><?php _e('SiteOrigin Widgets Bundle', 'siteorigin-widgets') ?></h1>
10
11
- <!--
12
<div id="sow-widget-search">
13
- <input type="search" placeholder="<?php esc_attr_e('Search Widgets', 'siteorigin-widgets') ?>" />
14
</div>
15
- -->
16
</div>
17
18
<ul class="page-nav">
@@ -26,7 +24,7 @@
26
27
<?php foreach( $widgets as $id => $widget ): ?>
28
<div class="so-widget-wrap">
29
- <div class="so-widget so-widget-is-<?php echo $widget['Active'] ? 'active' : 'inactive' ?>">
30
31
<?php
32
$banner = '';
@@ -35,21 +33,40 @@
35
}
36
$banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
37
?>
38
-
39
- <img src="<?php echo sow_esc_url( !empty($banner) ? $banner : plugin_dir_url(__FILE__) . '../../banners/default.png' ) ?>" />
40
41
<div class="so-widget-text">
42
- <label class="switch">
43
- <span class="dashicons dashicons-yes"></span>
44
- <input class="switch-input" type="checkbox" <?php checked( $widget['Active'] ) ?> data-url="<?php echo wp_nonce_url( admin_url('admin-ajax.php?action=so_widgets_bundle_manage&widget='.$widget['ID']), 'manage_so_widget' ) ?>">
45
- <span class="switch-label" data-on="<?php _e('On', 'siteorigin-widgets') ?>" data-off="<?php _e('Off', 'siteorigin-widgets') ?>"></span>
46
- <span class="switch-handle"></span>
47
- </label>
48
-
49
- <h4><?php echo esc_html($widget['Name']); ?></h4>
50
- <p class="so-widget-description">
51
- <?php echo $widget['Description'] ?>
52
- </p>
53
</div>
54
55
</div>
8
</span>
9
<h1><?php _e('SiteOrigin Widgets Bundle', 'siteorigin-widgets') ?></h1>
10
11
<div id="sow-widget-search">
12
+ <input type="search" placeholder="<?php esc_attr_e('Filter Widgets', 'siteorigin-widgets') ?>" />
13
</div>
14
</div>
15
16
<ul class="page-nav">
24
25
<?php foreach( $widgets as $id => $widget ): ?>
26
<div class="so-widget-wrap">
27
+ <div class="so-widget so-widget-is-<?php echo $widget['Active'] ? 'active' : 'inactive' ?>" data-id="<?php echo esc_attr( $widget['ID'] ) ?>">
28
29
<?php
30
$banner = '';
33
}
34
$banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
35
?>
36
+ <div class="so-widget-banner" data-seed="<?php echo esc_attr( substr( md5($widget['ID']), 0, 6 ) ) ?>">
37
+ <?php if( !empty($banner) ) : ?>
38
+ <img src="<?php echo esc_url($banner) ?>" />
39
+ <?php endif; ?>
40
+ </div>
41
42
<div class="so-widget-text">
43
+
44
+ <div class="so-widget-active-indicator"><?php _e('Active', 'siteorigin-widgets') ?></div>
45
+
46
+ <h3><?php echo esc_html( $widget['Name'] ); ?></h3>
47
+
48
+ <div class="so-widget-description">
49
+ <?php echo esc_html( $widget['Description'] ) ?>
50
+ </div>
51
+
52
+ <?php if( !empty( $widget['Author'] ) ) : ?>
53
+ <div class="so-widget-byline">
54
+ By
55
+ <strong>
56
+ <?php
57
+ if( !empty($widget['AuthorURI']) ) echo '<a href="' . esc_url( $widget['AuthorURI'] ) . '" target="_blank">';
58
+ echo esc_html( $widget['Author'] );
59
+ if( !empty($widget['AuthorURI']) ) echo '</a>';
60
+ ?>
61
+ </strong>
62
+ </div>
63
+ <?php endif; ?>
64
+
65
+ <div class="so-widget-toggle-active">
66
+ <button class="button-secondary so-widget-activate" data-status="1"><?php esc_html_e( 'Activate', 'siteorigin-widgets' ) ?></button>
67
+ <button class="button-secondary so-widget-deactivate" data-status="0"><?php esc_html_e( 'Deactivate', 'siteorigin-widgets' ) ?></button>
68
+ </div>
69
+
70
</div>
71
72
</div>
admin/trianglify.js ADDED
@@ -0,0 +1,3445 @@
1
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Trianglify = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"./lib/trianglify.js":[function(require,module,exports){
2
+ /*
3
+ * Trianglify.js
4
+ * by @qrohlf
5
+ *
6
+ * Licensed under the GPLv3
7
+ */
8
+
9
+ var delaunay = require('delaunay-fast');
10
+ var seedrandom = require('seedrandom');
11
+ var chroma = require('chroma-js'); //PROBLEM: chroma.js is nearly 32k in size
12
+ var colorbrewer = require('./colorbrewer'); //We could use the chroma.js colorbrewer, but it's got some ugly stuff so we use our own subset.
13
+
14
+ var Pattern = require('./pattern');
15
+
16
+ var defaults = {
17
+ width: 600, // Width of pattern
18
+ height: 400, // Height of pattern
19
+ cell_size: 75, // Size of the cells used to generate a randomized grid
20
+ variance: 0.75, // how much to randomize the grid
21
+ seed: null, // Seed for the RNG
22
+ x_colors: 'random', // X color stops
23
+ y_colors: 'match_x', // Y color stops
24
+ palette: colorbrewer, // Palette to use for 'random' color option
25
+ color_space: 'lab', // Color space used for gradient construction & interpolation
26
+ color_function: null, // Color function f(x, y) that returns a color specification that is consumable by chroma-js
27
+ stroke_width: 1.51 // Width of stroke. Defaults to 1.51 to fix an issue with canvas antialiasing.
28
+ };
29
+
30
+ /*********************************************************
31
+ *
32
+ * Main function that is exported to the global namespace
33
+ *
34
+ **********************************************************/
35
+
36
+ function Trianglify(opts) {
37
+ // apply defaults
38
+ opts = _merge_opts(defaults, opts);
39
+
40
+ // setup seedable RNG
41
+ rand = seedrandom(opts.seed);
42
+
43
+ // randomize colors if requested
44
+ if (opts.x_colors === 'random') opts.x_colors = _random_from_palette();
45
+ if (opts.y_colors === 'random') opts.y_colors = _random_from_palette();
46
+ if (opts.y_colors === 'match_x') opts.y_colors = opts.x_colors;
47
+
48
+ // some sanity-checking
49
+ if (!(opts.width > 0 && opts.height > 0)) {
50
+ throw new Error("Width and height must be numbers greater than 0");
51
+ }
52
+
53
+ if (opts.cell_size < 2) {
54
+ throw new Error("Cell size must be greater than 2.");
55
+ }
56
+
57
+ // Setup the color gradient function
58
+ var gradient;
59
+
60
+ if (opts.color_function) {
61
+ gradient = function(x, y) {
62
+ return chroma(opts.color_function(x, y));
63
+ };
64
+ } else {
65
+ var x_color = chroma.scale(opts.x_colors).mode(opts.color_space);
66
+ var y_color = chroma.scale(opts.y_colors).mode(opts.color_space);
67
+ gradient = function(x, y) {
68
+ return chroma.interpolate(x_color(x), y_color(y), 0.5, opts.color_space);
69
+ };
70
+ }
71
+
72
+ // Figure out key dimensions
73
+
74
+ // it's a pain to prefix width and height with opts all the time, so let's
75
+ // give them proper variables to refer to
76
+ var width = opts.width;
77
+ var height = opts.height;
78
+
79
+ // How many cells we're going to have on each axis (pad by 2 cells on each edge)
80
+ var cells_x = Math.floor((width + 4 * opts.cell_size) / opts.cell_size);
81
+ var cells_y = Math.floor((height + 4 * opts.cell_size) / opts.cell_size);
82
+
83
+ // figure out the bleed widths to center the grid
84
+ var bleed_x = ((cells_x * opts.cell_size) - width)/2;
85
+ var bleed_y = ((cells_y * opts.cell_size) - height)/2;
86
+
87
+ // how much can out points wiggle (+/-) given the cell padding?
88
+ var variance = opts.cell_size * opts.variance / 2;
89
+
90
+ // Set up normalizers
91
+ var norm_x = function(x) {
92
+ return _map(x, [-bleed_x, width+bleed_x], [0, 1]);
93
+ };
94
+
95
+ var norm_y = function(y) {
96
+ return _map(y, [-bleed_y, height+bleed_y], [0, 1]);
97
+ };
98
+
99
+ // generate a point mesh
100
+ var points = _generate_points(width, height);
101
+
102
+ // delaunay.triangulate gives us indices into the original coordinate array
103
+ var geom_indices = delaunay.triangulate(points);
104
+
105
+ // iterate over the indices in groups of three to flatten them into polygons, with color lookup
106
+ var triangles = [];
107
+ var lookup_point = function(i) { return points[i];};
108
+ for (var i=0; i < geom_indices.length; i += 3) {
109
+ var vertices = [geom_indices[i], geom_indices[i+1], geom_indices[i+2]].map(lookup_point);
110
+ var centroid = _centroid(vertices);
111
+ var color = gradient(norm_x(centroid.x), norm_y(centroid.y)).hex();
112
+ triangles.push([color, vertices]);
113
+ }
114
+ return Pattern(triangles, opts);
115
+
116
+
117
+ /*********************************************************
118
+ *
119
+ * Private functions
120
+ *
121
+ **********************************************************/
122
+
123
+ function _map(num, in_range, out_range ) {
124
+ return ( num - in_range[0] ) * ( out_range[1] - out_range[0] ) / ( in_range[1] - in_range[0] ) + out_range[0];
125
+ }
126
+
127
+ // generate points on a randomized grid
128
+ function _generate_points(width, height) {
129
+
130
+ var points = [];
131
+ for (var i = - bleed_x; i < width + bleed_x; i += opts.cell_size) {
132
+ for (var j = - bleed_y; j < height + bleed_y; j += opts.cell_size) {
133
+ var x = i + opts.cell_size/2 + _map(rand(), [0, 1], [-variance, variance]);
134
+ var y = j + opts.cell_size/2 + _map(rand(), [0, 1], [-variance, variance]);
135
+ points.push([x, y].map(Math.floor));
136
+ }
137
+ }
138
+
139
+ return points;
140
+ }
141
+
142
+ //triangles only!
143
+ function _centroid(d) {
144
+ return {
145
+ x: (d[0][0] + d[1][0] + d[2][0])/3,
146
+ y: (d[0][1] + d[1][1] + d[2][1])/3
147
+ };
148
+ }
149
+
150
+ // select a random palette from colorbrewer
151
+ function _random_from_palette() {
152
+ if (opts.palette instanceof Array) {
153
+ return opts.palette[Math.floor(rand()*opts.palette.length)];
154
+ }
155
+
156
+ var keys = Object.keys(opts.palette);
157
+ return opts.palette[keys[Math.floor(rand()*keys.length)]];
158
+ }
159
+
160
+ // shallow extend (sort of) for option defaults
161
+ function _merge_opts(defaults, options) {
162
+ var out = {};
163
+
164
+ // shallow-copy defaults so we don't mutate the input objects (bad)
165
+ for (var key in defaults) {
166
+ out[key] = defaults[key];
167
+ }
168
+
169
+ for (key in options) {
170
+ if (defaults.hasOwnProperty(key)) {
171
+ out[key] = options[key]; // override defaults with options
172
+ } else {
173
+ throw new Error(key+" is not a configuration option for Trianglify. Check your spelling?");
174
+ }
175
+ }
176
+ return out;
177
+ }
178
+
179
+ } //end of Trianglify function closure
180
+
181
+ // exports
182
+ Trianglify.colorbrewer = colorbrewer;
183
+ Trianglify.defaults = defaults;
184
+ module.exports = Trianglify;
185
+ },{"./colorbrewer":"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js","./pattern":"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js","chroma-js":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js","delaunay-fast":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js","seedrandom":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js"}],"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js":[function(require,module,exports){
186
+ /*
187
+ * colorbrewer.js
188
+ *
189
+ * Colorbrewer colors, by Cindy Brewer
190
+ */
191
+
192
+ module.exports = {
193
+ YlGn: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],
194
+ YlGnBu: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],
195
+ GnBu: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],
196
+ BuGn: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],
197
+ PuBuGn: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],
198
+ PuBu: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],
199
+ BuPu: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],
200
+ RdPu: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],
201
+ PuRd: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],
202
+ OrRd: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],
203
+ YlOrRd: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],
204
+ YlOrBr: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],
205
+ Purples: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],
206
+ Blues: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],
207
+ Greens: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],
208
+ Oranges: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],
209
+ Reds: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],
210
+ Greys: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],
211
+ PuOr: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],
212
+ BrBG: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],
213
+ PRGn: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],
214
+ PiYG: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],
215
+ RdBu: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],
216