Version Description
- September 5 2015 =
- Added support for WooCommerce shortcodes to TinyMCE field.
- New streamlined icon selector field.
- Added info window functionality to maps widget.
- Added a button to duplicate repeater items.
- Added more design settings to hero image widget.
- Removed full screen mode from TinyMCE field.
- Option to keep map centered when container is resized.
- Fixed: CSS bug for Google font imports on generated CSS.
- Fixed: Post selector for URL fields properly handles empty titles.
Download this release
Release Info
Developer | gpriday |
Plugin | SiteOrigin Widgets Bundle |
Version | 1.4.3 |
Comparing to | |
See all releases |
Code changes from version 1.4.2 to 1.4.3
- base/css/admin.css +78 -13
- base/inc.php +3 -68
- base/inc/attachments.php +56 -0
- base/inc/fields/base.class.php +0 -1
- base/inc/fields/color.class.php +4 -1
- base/inc/fields/container-base.class.php +4 -4
- base/inc/fields/icon.class.php +6 -0
- base/inc/fields/js/so-tinymce-field.js +60 -52
- base/inc/fields/js/so-tinymce-field.min.js +1 -1
- base/inc/fields/repeater.class.php +18 -0
- base/inc/fields/tinymce.class.php +43 -0
- base/inc/widget-manager.class.php +125 -0
- base/js/admin.js +120 -20
- base/js/admin.min.js +1 -1
- base/less/mixins.less +5 -0
- base/siteorigin-widget.class.php +30 -16
- readme.txt +12 -1
- so-widgets-bundle.php +3 -4
- widgets/so-button-widget/so-button-widget.php +1 -1
- widgets/so-cta-widget/so-cta-widget.php +1 -1
- widgets/so-editor-widget/so-editor-widget.php +10 -19
- widgets/so-features-widget/css/style.css +2 -2
- widgets/so-features-widget/inc/containers.php +1 -0
- widgets/so-features-widget/so-features-widget.php +2 -1
- widgets/so-features-widget/tpl/base.php +3 -1
- widgets/so-google-map-widget/js/js-map.js +32 -7
- widgets/so-google-map-widget/js/js-map.min.js +1 -1
- widgets/so-google-map-widget/so-google-map-widget.php +48 -6
- widgets/so-headline-widget/so-headline-widget.php +1 -2
- widgets/so-headline-widget/styles/sow-headline.less +2 -5
- widgets/so-hero-widget/so-hero-widget.php +61 -19
- widgets/so-hero-widget/styles/default.less +14 -3
- widgets/so-image-widget/so-image-widget.php +1 -1
- widgets/so-image-widget/tpl/base.php +10 -8
- widgets/so-post-carousel-widget/so-post-carousel-widget.php +1 -1
- widgets/so-price-table-widget/so-price-table-widget.php +1 -1
- widgets/so-slider-widget/so-slider-widget.php +21 -7
- widgets/so-social-media-buttons-widget/so-social-media-buttons-widget.php +1 -2
base/css/admin.css
CHANGED
@@ -5,6 +5,9 @@
|
|
5 |
display: block !important;
|
6 |
margin: 15px 0;
|
7 |
}
|
|
|
|
|
|
|
8 |
.siteorigin-widget-form a {
|
9 |
box-shadow: none;
|
10 |
}
|
@@ -21,12 +24,6 @@
|
|
21 |
.siteorigin-widget-form .siteorigin-widget-field label.siteorigin-widget-field-label {
|
22 |
font-weight: bold;
|
23 |
}
|
24 |
-
.siteorigin-widget-form .siteorigin-widget-field:last-child {
|
25 |
-
margin-bottom: 0;
|
26 |
-
}
|
27 |
-
.siteorigin-widget-form .siteorigin-widget-field:first-child {
|
28 |
-
margin-top: 0;
|
29 |
-
}
|
30 |
.siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-field-description {
|
31 |
font-size: 0.9em;
|
32 |
margin-top: 0.2em;
|
@@ -126,6 +123,7 @@
|
|
126 |
padding: 0 !important;
|
127 |
}
|
128 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand,
|
|
|
129 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove {
|
130 |
width: 14px;
|
131 |
height: 14px;
|
@@ -138,6 +136,7 @@
|
|
138 |
text-align: center;
|
139 |
}
|
140 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before,
|
|
|
141 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before {
|
142 |
font-family: dashicons;
|
143 |
vertical-align: middle;
|
@@ -149,15 +148,21 @@
|
|
149 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before {
|
150 |
content: "\f140";
|
151 |
}
|
152 |
-
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:hover {
|
153 |
-
background: #989fa5;
|
154 |
-
}
|
155 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:hover:before {
|
156 |
-
color: #
|
157 |
}
|
158 |
-
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-
|
159 |
right: 28px;
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before {
|
162 |
content: '\f158';
|
163 |
}
|
@@ -197,7 +202,7 @@
|
|
197 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form {
|
198 |
border-top: 1px solid #EEEEEE;
|
199 |
display: none;
|
200 |
-
padding: 10px;
|
201 |
}
|
202 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add {
|
203 |
padding: 7px 10px;
|
@@ -383,7 +388,7 @@
|
|
383 |
}
|
384 |
.siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section,
|
385 |
.siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section {
|
386 |
-
padding: 10px;
|
387 |
background: #FCFCFC;
|
388 |
border: 1px solid #EEEEEE;
|
389 |
border-top: 0;
|
@@ -474,13 +479,73 @@
|
|
474 |
width: 120px;
|
475 |
text-align: center;
|
476 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
.siteorigin-widget-form .siteorigin-widget-icon-selector {
|
|
|
478 |
padding: 10px;
|
479 |
border: 1px solid #D8D8D8;
|
480 |
background: #FFFFFF;
|
481 |
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.0275);
|
482 |
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.0275);
|
483 |
box-shadow: 0 1px 2px rgba(0,0,0,0.0275);
|
|
|
484 |
}
|
485 |
.siteorigin-widget-form .siteorigin-widget-icon-selector select.siteorigin-widget-icon-family {
|
486 |
font-size: 11px;
|
5 |
display: block !important;
|
6 |
margin: 15px 0;
|
7 |
}
|
8 |
+
.siteorigin-widget-form > div:first-child {
|
9 |
+
margin-top: 0;
|
10 |
+
}
|
11 |
.siteorigin-widget-form a {
|
12 |
box-shadow: none;
|
13 |
}
|
24 |
.siteorigin-widget-form .siteorigin-widget-field label.siteorigin-widget-field-label {
|
25 |
font-weight: bold;
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
.siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-field-description {
|
28 |
font-size: 0.9em;
|
29 |
margin-top: 0.2em;
|
123 |
padding: 0 !important;
|
124 |
}
|
125 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand,
|
126 |
+
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy,
|
127 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove {
|
128 |
width: 14px;
|
129 |
height: 14px;
|
136 |
text-align: center;
|
137 |
}
|
138 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before,
|
139 |
+
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:before,
|
140 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before {
|
141 |
font-family: dashicons;
|
142 |
vertical-align: middle;
|
148 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before {
|
149 |
content: "\f140";
|
150 |
}
|
|
|
|
|
|
|
151 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:hover:before {
|
152 |
+
color: #50575D;
|
153 |
}
|
154 |
+
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy {
|
155 |
right: 28px;
|
156 |
}
|
157 |
+
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:before {
|
158 |
+
content: "\f105";
|
159 |
+
}
|
160 |
+
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:hover:before {
|
161 |
+
color: #50575D;
|
162 |
+
}
|
163 |
+
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove {
|
164 |
+
right: 48px;
|
165 |
+
}
|
166 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before {
|
167 |
content: '\f158';
|
168 |
}
|
202 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form {
|
203 |
border-top: 1px solid #EEEEEE;
|
204 |
display: none;
|
205 |
+
padding: 1px 10px;
|
206 |
}
|
207 |
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add {
|
208 |
padding: 7px 10px;
|
388 |
}
|
389 |
.siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section,
|
390 |
.siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section {
|
391 |
+
padding: 1px 10px;
|
392 |
background: #FCFCFC;
|
393 |
border: 1px solid #EEEEEE;
|
394 |
border-top: 0;
|
479 |
width: 120px;
|
480 |
text-align: center;
|
481 |
}
|
482 |
+
.siteorigin-widget-form .siteorigin-widget-icon-selector-current {
|
483 |
+
display: inline-block;
|
484 |
+
background: #f9f9f9;
|
485 |
+
background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #f2f2f2), color-stop(1, #f9f9f9));
|
486 |
+
background: -ms-linear-gradient(bottom, #f2f2f2, #f9f9f9);
|
487 |
+
background: -moz-linear-gradient(center bottom, #f2f2f2 0%, #f9f9f9 100%);
|
488 |
+
background: -o-linear-gradient(#f9f9f9, #f2f2f2);
|
489 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#f2f2f2', GradientType=0);
|
490 |
+
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
491 |
+
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
492 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
493 |
+
-webkit-border-radius: 3px;
|
494 |
+
-moz-border-radius: 3px;
|
495 |
+
border-radius: 3px;
|
496 |
+
border: 1px solid #bbbbbb;
|
497 |
+
height: 35px;
|
498 |
+
}
|
499 |
+
.siteorigin-widget-form .siteorigin-widget-icon-selector-current:hover {
|
500 |
+
background: #ffffff;
|
501 |
+
background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #f7f7f7), color-stop(1, #ffffff));
|
502 |
+
background: -ms-linear-gradient(bottom, #f7f7f7, #ffffff);
|
503 |
+
background: -moz-linear-gradient(center bottom, #f7f7f7 0%, #ffffff 100%);
|
504 |
+
background: -o-linear-gradient(#ffffff, #f7f7f7);
|
505 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f7f7f7', GradientType=0);
|
506 |
+
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.15);
|
507 |
+
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.15);
|
508 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.15);
|
509 |
+
}
|
510 |
+
.siteorigin-widget-form .siteorigin-widget-icon-selector-current .siteorigin-widget-icon {
|
511 |
+
-ms-box-sizing: border-box;
|
512 |
+
-moz-box-sizing: border-box;
|
513 |
+
-webkit-box-sizing: border-box;
|
514 |
+
box-sizing: border-box;
|
515 |
+
float: left;
|
516 |
+
margin: 4px;
|
517 |
+
padding: 3px;
|
518 |
+
border: 1px solid #999;
|
519 |
+
background: #f3f3f3;
|
520 |
+
height: 27px;
|
521 |
+
width: 32px;
|
522 |
+
text-align: center;
|
523 |
+
}
|
524 |
+
.siteorigin-widget-form .siteorigin-widget-icon-selector-current .siteorigin-widget-icon span {
|
525 |
+
color: #333;
|
526 |
+
font-size: 20px;
|
527 |
+
}
|
528 |
+
.siteorigin-widget-form .siteorigin-widget-icon-selector-current label {
|
529 |
+
display: block;
|
530 |
+
float: left;
|
531 |
+
color: #666;
|
532 |
+
text-decoration: none;
|
533 |
+
text-shadow: 0 1px 0 #FFF;
|
534 |
+
font-weight: 600;
|
535 |
+
font-size: 11px;
|
536 |
+
padding: 9px 10px 7px 7px;
|
537 |
+
outline: none;
|
538 |
+
cursor: pointer;
|
539 |
+
}
|
540 |
.siteorigin-widget-form .siteorigin-widget-icon-selector {
|
541 |
+
display: none;
|
542 |
padding: 10px;
|
543 |
border: 1px solid #D8D8D8;
|
544 |
background: #FFFFFF;
|
545 |
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.0275);
|
546 |
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.0275);
|
547 |
box-shadow: 0 1px 2px rgba(0,0,0,0.0275);
|
548 |
+
margin-top: 10px;
|
549 |
}
|
550 |
.siteorigin-widget-form .siteorigin-widget-icon-selector select.siteorigin-widget-icon-family {
|
551 |
font-size: 11px;
|
base/inc.php
CHANGED
@@ -2,74 +2,13 @@
|
|
2 |
|
3 |
include plugin_dir_path(__FILE__).'inc/fields/siteorigin-widget-field-class-loader.class.php';
|
4 |
include plugin_dir_path(__FILE__).'siteorigin-widget.class.php';
|
|
|
|
|
5 |
include plugin_dir_path(__FILE__).'inc/meta-box-manager.php';
|
6 |
include plugin_dir_path(__FILE__).'inc/post-selector.php';
|
7 |
include plugin_dir_path(__FILE__).'inc/fonts.php';
|
8 |
include plugin_dir_path(__FILE__).'inc/string-utils.php';
|
9 |
-
|
10 |
-
global $siteorigin_widgets_registered, $siteorigin_widgets_classes;
|
11 |
-
$siteorigin_widgets_registered = array();
|
12 |
-
$siteorigin_widgets_classes = array();
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Register a plugin
|
16 |
-
*
|
17 |
-
* @param $name
|
18 |
-
* @param $path
|
19 |
-
* @param $class
|
20 |
-
*/
|
21 |
-
function siteorigin_widget_register($name, $path, $class = false){
|
22 |
-
global $siteorigin_widgets_registered, $siteorigin_widgets_classes;
|
23 |
-
$siteorigin_widgets_registered[$name] = realpath( $path );
|
24 |
-
if ( empty( $class ) ) {
|
25 |
-
$class = 'SiteOrigin_Widget_' . str_replace( ' ', '', ucwords( str_replace('-', ' ', $name) ) ) . '_Widget';
|
26 |
-
}
|
27 |
-
$siteorigin_widgets_classes[] = $class;
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Initialize all widgets
|
32 |
-
*/
|
33 |
-
function siteorigin_widgets_widgets_init(){
|
34 |
-
global $siteorigin_widgets_classes;
|
35 |
-
foreach( $siteorigin_widgets_classes as $class ){
|
36 |
-
register_widget($class);
|
37 |
-
}
|
38 |
-
$siteorigin_widgets_classes = array();
|
39 |
-
}
|
40 |
-
add_action('widgets_init', 'siteorigin_widgets_widgets_init');
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Get the base file of a widget plugin
|
44 |
-
*
|
45 |
-
* @param $name
|
46 |
-
* @return bool
|
47 |
-
*/
|
48 |
-
function siteorigin_widget_get_plugin_path($name){
|
49 |
-
global $siteorigin_widgets_registered;
|
50 |
-
return isset($siteorigin_widgets_registered[$name]) ? $siteorigin_widgets_registered[$name] : false;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Get the base path folder of a widget plugin.
|
55 |
-
*
|
56 |
-
* @param $name
|
57 |
-
* @return string
|
58 |
-
*/
|
59 |
-
function siteorigin_widget_get_plugin_dir_path($name){
|
60 |
-
if( strpos($name, 'sow-') === 0 ) $name = substr($name, 4); // Handle raw widget IDs, assuming they're prefixed with sow-
|
61 |
-
return plugin_dir_path( siteorigin_widget_get_plugin_path($name) );
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Get the base path URL of a widget plugin.
|
66 |
-
*
|
67 |
-
* @param $name
|
68 |
-
* @return string
|
69 |
-
*/
|
70 |
-
function siteorigin_widget_get_plugin_dir_url($name){
|
71 |
-
return plugin_dir_url( siteorigin_widget_get_plugin_path($name) );
|
72 |
-
}
|
73 |
|
74 |
/**
|
75 |
* @param $css
|
@@ -139,8 +78,6 @@ function siteorigin_widget_get_icon($icon_value, $icon_styles = false) {
|
|
139 |
|
140 |
}
|
141 |
|
142 |
-
|
143 |
-
|
144 |
/**
|
145 |
* @param $font_value
|
146 |
*
|
@@ -317,7 +254,6 @@ function sow_esc_url( $url ) {
|
|
317 |
function sow_esc_url_raw( $url ) {
|
318 |
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
319 |
// Convert the special post URL into a permalink
|
320 |
-
// return 'post: ' . $matches[1];
|
321 |
$url = get_the_permalink( intval($matches[1]) );
|
322 |
}
|
323 |
|
@@ -374,5 +310,4 @@ function siteorigin_widgets_font_families( ){
|
|
374 |
function siteorigin_widgets_tinymce_admin_print_styles() {
|
375 |
wp_enqueue_style( 'editor-buttons' );
|
376 |
}
|
377 |
-
|
378 |
add_action( 'admin_print_styles', 'siteorigin_widgets_tinymce_admin_print_styles' );
|
2 |
|
3 |
include plugin_dir_path(__FILE__).'inc/fields/siteorigin-widget-field-class-loader.class.php';
|
4 |
include plugin_dir_path(__FILE__).'siteorigin-widget.class.php';
|
5 |
+
|
6 |
+
include plugin_dir_path(__FILE__).'inc/widget-manager.class.php';
|
7 |
include plugin_dir_path(__FILE__).'inc/meta-box-manager.php';
|
8 |
include plugin_dir_path(__FILE__).'inc/post-selector.php';
|
9 |
include plugin_dir_path(__FILE__).'inc/fonts.php';
|
10 |
include plugin_dir_path(__FILE__).'inc/string-utils.php';
|
11 |
+
include plugin_dir_path(__FILE__).'inc/attachments.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
/**
|
14 |
* @param $css
|
78 |
|
79 |
}
|
80 |
|
|
|
|
|
81 |
/**
|
82 |
* @param $font_value
|
83 |
*
|
254 |
function sow_esc_url_raw( $url ) {
|
255 |
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
256 |
// Convert the special post URL into a permalink
|
|
|
257 |
$url = get_the_permalink( intval($matches[1]) );
|
258 |
}
|
259 |
|
310 |
function siteorigin_widgets_tinymce_admin_print_styles() {
|
311 |
wp_enqueue_style( 'editor-buttons' );
|
312 |
}
|
|
|
313 |
add_action( 'admin_print_styles', 'siteorigin_widgets_tinymce_admin_print_styles' );
|
base/inc/attachments.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Get the attachment src, but also have the option of getting the fallback URL.
|
5 |
+
*
|
6 |
+
* @param $attachment
|
7 |
+
* @param $size
|
8 |
+
* @param bool|false $fallback
|
9 |
+
*
|
10 |
+
* @return array|bool|false
|
11 |
+
*/
|
12 |
+
function siteorigin_widgets_get_attachment_image_src( $attachment, $size, $fallback = false ){
|
13 |
+
if( empty( $attachment ) && !empty($fallback) ) {
|
14 |
+
$url = parse_url( $fallback );
|
15 |
+
|
16 |
+
if( !empty($url['fragment']) && preg_match('/^([0-9]+)x([0-9]+)$/', $url['fragment'], $matches) ) {
|
17 |
+
$width = intval($matches[1]);
|
18 |
+
$height = intval($matches[2]);
|
19 |
+
}
|
20 |
+
else {
|
21 |
+
$width = 0;
|
22 |
+
$height = 0;
|
23 |
+
}
|
24 |
+
|
25 |
+
// TODO, try get better values than 0 for width and height
|
26 |
+
return array( $fallback, $width, $height, false );
|
27 |
+
}
|
28 |
+
if( !empty( $attachment ) ) {
|
29 |
+
return wp_get_attachment_image_src( $attachment, $size );
|
30 |
+
}
|
31 |
+
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
|
35 |
+
function siteorigin_widgets_get_attachment_image( $attachment, $size, $fallback ){
|
36 |
+
if( !empty( $attachment ) ) {
|
37 |
+
return wp_get_attachment_image( $attachment, $size );
|
38 |
+
}
|
39 |
+
else {
|
40 |
+
$src = siteorigin_widgets_get_attachment_image_src( $attachment, $size, $fallback );
|
41 |
+
if( empty($src[0]) ) return '';
|
42 |
+
|
43 |
+
$atts = array(
|
44 |
+
'src' => $src[0],
|
45 |
+
);
|
46 |
+
|
47 |
+
if( !empty($src[1]) ) $atts['width'] = $src[1];
|
48 |
+
if( !empty($src[2]) ) $atts['height'] = $src[2];
|
49 |
+
|
50 |
+
$return = '<img ';
|
51 |
+
foreach( $atts as $id => $val ) {
|
52 |
+
$return .= $id . '="' . esc_attr($val) . '" ';
|
53 |
+
}
|
54 |
+
return $return;
|
55 |
+
}
|
56 |
+
}
|
base/inc/fields/base.class.php
CHANGED
@@ -315,7 +315,6 @@ abstract class SiteOrigin_Widget_Field_Base {
|
|
315 |
* The default sanitization function.
|
316 |
*
|
317 |
* @param $value mixed The value to be sanitized.
|
318 |
-
* @param $instance array The widget instance.
|
319 |
* @return mixed|string|void
|
320 |
*/
|
321 |
public function sanitize( $value ) {
|
315 |
* The default sanitization function.
|
316 |
*
|
317 |
* @param $value mixed The value to be sanitized.
|
|
|
318 |
* @return mixed|string|void
|
319 |
*/
|
320 |
public function sanitize( $value ) {
|
base/inc/fields/color.class.php
CHANGED
@@ -13,7 +13,10 @@ class SiteOrigin_Widget_Field_Color extends SiteOrigin_Widget_Field_Text_Input_B
|
|
13 |
|
14 |
protected function sanitize_field_input( $value ) {
|
15 |
$sanitized_value = $value;
|
16 |
-
if
|
|
|
|
|
|
|
17 |
// 3 or 6 hex digits, or the empty string.
|
18 |
$sanitized_value = false;
|
19 |
}
|
13 |
|
14 |
protected function sanitize_field_input( $value ) {
|
15 |
$sanitized_value = $value;
|
16 |
+
if( ! preg_match('|^#|', $sanitized_value) ) {
|
17 |
+
$sanitized_value = '#' . $sanitized_value;
|
18 |
+
}
|
19 |
+
if ( ! preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $sanitized_value ) ){
|
20 |
// 3 or 6 hex digits, or the empty string.
|
21 |
$sanitized_value = false;
|
22 |
}
|
base/inc/fields/container-base.class.php
CHANGED
@@ -87,7 +87,7 @@ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_
|
|
87 |
$is_template
|
88 |
);
|
89 |
$sub_value = ( ! empty( $values ) && isset( $values[$sub_field_name] ) ) ? $values[$sub_field_name] : null;
|
90 |
-
$field->render( $sub_value );
|
91 |
$field_js_vars = $field->get_javascript_variables();
|
92 |
if( ! empty( $field_js_vars ) ) {
|
93 |
$this->javascript_variables[$sub_field_name] = $field_js_vars;
|
@@ -101,9 +101,9 @@ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_
|
|
101 |
/* @var $field_factory SiteOrigin_Widget_Field_Factory */
|
102 |
$field_factory = SiteOrigin_Widget_Field_Factory::getInstance();
|
103 |
foreach( $this->fields as $sub_field_name => $sub_field_options ) {
|
104 |
-
|
105 |
/* @var $sub_field SiteOrigin_Widget_Field_Base */
|
106 |
-
if( ! empty( $this->sub_fields ) && ! empty( $this->
|
107 |
$sub_field = $this->sub_fields[$sub_field_name];
|
108 |
}
|
109 |
else {
|
@@ -114,7 +114,7 @@ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_
|
|
114 |
$this->parent_container
|
115 |
);
|
116 |
}
|
117 |
-
$value[$sub_field_name] = $sub_field->sanitize( $value[$sub_field_name] );
|
118 |
$value = $sub_field->sanitize_instance( $value );
|
119 |
}
|
120 |
|
87 |
$is_template
|
88 |
);
|
89 |
$sub_value = ( ! empty( $values ) && isset( $values[$sub_field_name] ) ) ? $values[$sub_field_name] : null;
|
90 |
+
$field->render( $sub_value, $values );
|
91 |
$field_js_vars = $field->get_javascript_variables();
|
92 |
if( ! empty( $field_js_vars ) ) {
|
93 |
$this->javascript_variables[$sub_field_name] = $field_js_vars;
|
101 |
/* @var $field_factory SiteOrigin_Widget_Field_Factory */
|
102 |
$field_factory = SiteOrigin_Widget_Field_Factory::getInstance();
|
103 |
foreach( $this->fields as $sub_field_name => $sub_field_options ) {
|
104 |
+
|
105 |
/* @var $sub_field SiteOrigin_Widget_Field_Base */
|
106 |
+
if( ! empty( $this->sub_fields ) && ! empty( $this->sub_fields[$sub_field_name] ) ) {
|
107 |
$sub_field = $this->sub_fields[$sub_field_name];
|
108 |
}
|
109 |
else {
|
114 |
$this->parent_container
|
115 |
);
|
116 |
}
|
117 |
+
$value[$sub_field_name] = $sub_field->sanitize( isset($value[$sub_field_name]) ? $value[$sub_field_name] : null );
|
118 |
$value = $sub_field->sanitize_instance( $value );
|
119 |
}
|
120 |
|
base/inc/fields/icon.class.php
CHANGED
@@ -12,6 +12,12 @@ class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
|
|
12 |
list( $value_family, $null ) = !empty($value) ? explode('-', $value, 2) : array('fontawesome', '');
|
13 |
|
14 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
<div class="siteorigin-widget-icon-selector siteorigin-widget-field-subcontainer">
|
16 |
<select class="siteorigin-widget-icon-family" >
|
17 |
<?php foreach( $widget_icon_families as $family_id => $family_info ) : ?>
|
12 |
list( $value_family, $null ) = !empty($value) ? explode('-', $value, 2) : array('fontawesome', '');
|
13 |
|
14 |
?>
|
15 |
+
|
16 |
+
<div class="siteorigin-widget-icon-selector-current">
|
17 |
+
<div class="siteorigin-widget-icon"><span></span></div>
|
18 |
+
<label><?php _e('Choose Icon', 'siteorigin-widgets') ?></label>
|
19 |
+
</div>
|
20 |
+
|
21 |
<div class="siteorigin-widget-icon-selector siteorigin-widget-field-subcontainer">
|
22 |
<select class="siteorigin-widget-icon-family" >
|
23 |
<?php foreach( $widget_icon_families as $family_id => $family_info ) : ?>
|
base/inc/fields/js/so-tinymce-field.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/* global
|
2 |
|
3 |
(function( $ ) {
|
4 |
var setup = function(widgetForm) {
|
@@ -17,62 +17,70 @@
|
|
17 |
var $container = $(element);
|
18 |
var $textarea = $container.find('textarea');
|
19 |
var id = $textarea.attr('id');
|
20 |
-
if
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
}
|
31 |
-
var content;
|
32 |
-
var curEd = tinymce.get(id);
|
33 |
-
if (curEd != null) {
|
34 |
-
content = curEd.getContent();
|
35 |
-
curEd.remove();
|
36 |
-
}
|
37 |
-
var setupEditor = function (editor) {
|
38 |
-
editor.on('change',
|
39 |
-
function () {
|
40 |
-
tinymce.get(id).save();
|
41 |
-
$textarea.trigger('change');
|
42 |
}
|
43 |
-
);
|
44 |
-
editor.on('init',
|
45 |
-
function () {
|
46 |
-
if (content) {
|
47 |
-
editor.setContent(content);
|
48 |
-
}
|
49 |
-
}
|
50 |
-
);
|
51 |
-
};
|
52 |
-
mceSettings = $.extend({}, mceSettings, {selector: '#' + id, setup: setupEditor});
|
53 |
-
tinyMCEPreInit.mceInit[id] = mceSettings;
|
54 |
-
var wrapDiv = $container.find('div#wp-' + id + '-wrap');
|
55 |
-
if (wrapDiv.hasClass('tmce-active')) {
|
56 |
-
// Add a small timeout to make sure everything is ready - mainly for customizer and widgets interface
|
57 |
-
if ($('#' + id).is(':visible')) {
|
58 |
-
tinymce.init(tinyMCEPreInit.mceInit[id]);
|
59 |
}
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
}
|
69 |
-
if (!QTags.instances[id]) {
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
});
|
77 |
QTags._buttonsInit();
|
78 |
}
|
1 |
+
/* global tinyMCEPreInit, quicktags, QTags, tinymce */
|
2 |
|
3 |
(function( $ ) {
|
4 |
var setup = function(widgetForm) {
|
17 |
var $container = $(element);
|
18 |
var $textarea = $container.find('textarea');
|
19 |
var id = $textarea.attr('id');
|
20 |
+
if( typeof tinymce != 'undefined') {
|
21 |
+
if (id.indexOf('__i__') > -1) return;
|
22 |
+
var mceSettings = $container.data('mceSettings');
|
23 |
+
var widgetIdBase = $container.data('widgetIdBase');
|
24 |
+
var name = $textarea.attr('name').replace(/\[\d\]/g, '');
|
25 |
+
var fieldName = /[a-zA-Z0-9\-]+(?:\[[a-zA-Z0-9]+\])?\[(.*)\]/.exec(name)[1];
|
26 |
+
var idPattern = new RegExp('widget-' + widgetIdBase + '-.*-' + fieldName.replace(/\]\[/g, '-') + '[-\d]*');
|
27 |
+
for (var initId in tinyMCEPreInit.mceInit) {
|
28 |
+
if (initId.match(idPattern)) {
|
29 |
+
mceSettings = $.extend({}, tinyMCEPreInit.mceInit[initId], mceSettings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
+
var content;
|
33 |
+
var curEd = tinymce.get(id);
|
34 |
+
if (curEd != null) {
|
35 |
+
content = curEd.getContent();
|
36 |
+
curEd.remove();
|
37 |
+
}
|
38 |
+
var setupEditor = function (editor) {
|
39 |
+
editor.on('change',
|
40 |
+
function () {
|
41 |
+
tinymce.get(id).save();
|
42 |
+
$textarea.trigger('change');
|
43 |
+
$textarea.val(window.switchEditors.pre_wpautop(editor.getContent()));
|
44 |
}
|
45 |
+
);
|
46 |
+
editor.on('init',
|
47 |
+
function () {
|
48 |
+
if (content) {
|
49 |
+
editor.setContent(content);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
);
|
53 |
+
$textarea.on('keyup',
|
54 |
+
function () {
|
55 |
+
editor.setContent(window.switchEditors.wpautop($textarea.val()));
|
56 |
+
}
|
57 |
+
);
|
58 |
+
};
|
59 |
+
mceSettings = $.extend({}, mceSettings, {selector: '#' + id, setup: setupEditor});
|
60 |
+
tinyMCEPreInit.mceInit[id] = mceSettings;
|
61 |
+
var wrapDiv = $container.find('div#wp-' + id + '-wrap');
|
62 |
+
if (wrapDiv.hasClass('tmce-active')) {
|
63 |
+
// Add a small timeout to make sure everything is ready - mainly for customizer and widgets interface
|
64 |
+
if ($('#' + id).is(':visible')) {
|
65 |
+
tinymce.init(tinyMCEPreInit.mceInit[id]);
|
66 |
+
}
|
67 |
+
else {
|
68 |
+
var intervalId = setInterval(function () {
|
69 |
+
if ($('#' + id).is(':visible')) {
|
70 |
+
tinymce.init(tinyMCEPreInit.mceInit[id]);
|
71 |
+
clearInterval(intervalId);
|
72 |
+
}
|
73 |
+
}, 500);
|
74 |
+
}
|
75 |
}
|
76 |
}
|
77 |
+
//if (!QTags.instances[id]) {
|
78 |
+
var qtSettings = $container.data('qtSettings');
|
79 |
+
qtSettings = $.extend({}, tinyMCEPreInit.qtInit['siteorigin-widget-input-tinymce-field'], qtSettings, {id: id});
|
80 |
+
tinyMCEPreInit.qtInit[id] = qtSettings;
|
81 |
+
$container.find('.quicktags-toolbar').remove();
|
82 |
+
quicktags(tinyMCEPreInit.qtInit[id]);
|
83 |
+
//}
|
84 |
});
|
85 |
QTags._buttonsInit();
|
86 |
}
|
base/inc/fields/js/so-tinymce-field.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var
|
1 |
+
!function(e){var t=function(i){"undefined"!=typeof tinyMCEPreInit?(tinyMCEPreInit.mceInit.hasOwnProperty("undefined")&&delete tinyMCEPreInit.mceInit.undefined,tinyMCEPreInit.qtInit.hasOwnProperty("undefined")&&delete tinyMCEPreInit.qtInit.undefined,QTags.instances.hasOwnProperty("undefined")&&delete QTags.instances.undefined,e(i).find("> .siteorigin-widget-field-type-tinymce > .siteorigin-widget-tinymce-container").each(function(t,i){var n=e(i),r=n.find("textarea"),o=r.attr("id");if("undefined"!=typeof tinymce){if(o.indexOf("__i__")>-1)return;var d=n.data("mceSettings"),a=n.data("widgetIdBase"),s=r.attr("name").replace(/\[\d\]/g,""),c=/[a-zA-Z0-9\-]+(?:\[[a-zA-Z0-9]+\])?\[(.*)\]/.exec(s)[1],f=new RegExp("widget-"+a+"-.*-"+c.replace(/\]\[/g,"-")+"[-d]*");for(var g in tinyMCEPreInit.mceInit)g.match(f)&&(d=e.extend({},tinyMCEPreInit.mceInit[g],d));var m,u=tinymce.get(o);null!=u&&(m=u.getContent(),u.remove());var l=function(e){e.on("change",function(){tinymce.get(o).save(),r.trigger("change"),r.val(window.switchEditors.pre_wpautop(e.getContent()))}),e.on("init",function(){m&&e.setContent(m)}),r.on("keyup",function(){e.setContent(window.switchEditors.wpautop(r.val()))})};d=e.extend({},d,{selector:"#"+o,setup:l}),tinyMCEPreInit.mceInit[o]=d;var y=n.find("div#wp-"+o+"-wrap");if(y.hasClass("tmce-active"))if(e("#"+o).is(":visible"))tinymce.init(tinyMCEPreInit.mceInit[o]);else var I=setInterval(function(){e("#"+o).is(":visible")&&(tinymce.init(tinyMCEPreInit.mceInit[o]),clearInterval(I))},500)}var p=n.data("qtSettings");p=e.extend({},tinyMCEPreInit.qtInit["siteorigin-widget-input-tinymce-field"],p,{id:o}),tinyMCEPreInit.qtInit[o]=p,n.find(".quicktags-toolbar").remove(),quicktags(tinyMCEPreInit.qtInit[o])}),QTags._buttonsInit()):setTimeout(function(){t(i)},500)};e(document).on("sowsetupform",function(i){var n=e(i.target);n.is(".siteorigin-widget-field-repeater-item-form")?n.is(":visible")?t(n):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(t(n),n.off("slideToggleOpenComplete"))}):t(n)}),e(document).on("sortstop",function(i,n){n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){t(e(this))}):t(n.item.find(".siteorigin-widget-form"))})}(jQuery);
|
base/inc/fields/repeater.class.php
CHANGED
@@ -69,6 +69,7 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
|
|
69 |
<div class="siteorigin-widget-field-repeater-item-top">
|
70 |
<div class="siteorigin-widget-field-expand"></div>
|
71 |
<?php if( empty( $this->readonly ) ) : ?>
|
|
|
72 |
<div class="siteorigin-widget-field-remove"></div>
|
73 |
<?php endif; ?>
|
74 |
<h4><?php echo esc_html( $this->item_name ) ?></h4>
|
@@ -103,4 +104,21 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
|
|
103 |
protected function render_field_label() {
|
104 |
// Empty override. This field renders it's own label in the render_field() function.
|
105 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
69 |
<div class="siteorigin-widget-field-repeater-item-top">
|
70 |
<div class="siteorigin-widget-field-expand"></div>
|
71 |
<?php if( empty( $this->readonly ) ) : ?>
|
72 |
+
<div class="siteorigin-widget-field-copy"></div>
|
73 |
<div class="siteorigin-widget-field-remove"></div>
|
74 |
<?php endif; ?>
|
75 |
<h4><?php echo esc_html( $this->item_name ) ?></h4>
|
104 |
protected function render_field_label() {
|
105 |
// Empty override. This field renders it's own label in the render_field() function.
|
106 |
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Go over the items in the repeater and sanitize each one using the container sanitization function.
|
110 |
+
*
|
111 |
+
* @param mixed $value
|
112 |
+
*
|
113 |
+
* @return array|mixed
|
114 |
+
*/
|
115 |
+
function sanitize_field_input( $value ){
|
116 |
+
if( empty($value) ) return array();
|
117 |
+
|
118 |
+
foreach( $value as &$el ) {
|
119 |
+
$el = parent::sanitize_field_input( $el );
|
120 |
+
}
|
121 |
+
|
122 |
+
return $value;
|
123 |
+
}
|
124 |
}
|
base/inc/fields/tinymce.class.php
CHANGED
@@ -33,6 +33,9 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
|
|
33 |
protected function initialize() {
|
34 |
parent::initialize();
|
35 |
|
|
|
|
|
|
|
36 |
if ( !empty( $this->button_filters ) ) {
|
37 |
foreach ( $this->button_filters as $filter_name => $filter ) {
|
38 |
if ( preg_match( '/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name ) && !empty( $filter ) && is_callable( $filter ) ) {
|
@@ -40,6 +43,33 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
|
|
40 |
}
|
41 |
}
|
42 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
/**
|
@@ -64,6 +94,19 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
|
|
64 |
}
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
protected function render_field( $value, $instance ) {
|
68 |
|
69 |
$settings = array(
|
33 |
protected function initialize() {
|
34 |
parent::initialize();
|
35 |
|
36 |
+
add_filter( 'mce_buttons', array( $this, 'mce_buttons_filter' ), 10, 2 );
|
37 |
+
add_filter( 'quicktags_settings', array( $this, 'quicktags_settings' ), 10, 2 );
|
38 |
+
|
39 |
if ( !empty( $this->button_filters ) ) {
|
40 |
foreach ( $this->button_filters as $filter_name => $filter ) {
|
41 |
if ( preg_match( '/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name ) && !empty( $filter ) && is_callable( $filter ) ) {
|
43 |
}
|
44 |
}
|
45 |
}
|
46 |
+
|
47 |
+
if( class_exists( 'WC_Shortcodes_Admin' ) ) {
|
48 |
+
$screen = get_current_screen();
|
49 |
+
if( !is_null( $screen ) && $screen->id != 'widgets' ) {
|
50 |
+
add_filter( 'mce_external_plugins', array( $this, 'add_wc_shortcode_plugin' ), 15 );
|
51 |
+
add_filter( 'mce_buttons', array( $this, 'register_wc_shortcode_button' ), 15 );
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
function add_wc_shortcode_plugin( $plugins ) {
|
57 |
+
if( isset( $plugins['woocommerce_shortcodes'] ) ) {
|
58 |
+
return $plugins;
|
59 |
+
}
|
60 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
61 |
+
if( file_exists( plugin_dir_path('woocommerce-shortcodes.php') ) ) {
|
62 |
+
$plugins['woocommerce_shortcodes'] = plugins_url( 'woocommerce-shortcodes/assets/js/editor' . $suffix . '.js' );
|
63 |
+
}
|
64 |
+
return $plugins;
|
65 |
+
}
|
66 |
+
|
67 |
+
function register_wc_shortcode_button( $buttons ) {
|
68 |
+
if( in_array( 'woocommerce_shortcodes', $buttons ) ) {
|
69 |
+
return $buttons;
|
70 |
+
}
|
71 |
+
array_push( $buttons, '|', 'woocommerce_shortcodes' );
|
72 |
+
return $buttons;
|
73 |
}
|
74 |
|
75 |
/**
|
94 |
}
|
95 |
}
|
96 |
|
97 |
+
public function mce_buttons_filter( $buttons, $editor_id ) {
|
98 |
+
if (($key = array_search('fullscreen', $buttons)) !== false) {
|
99 |
+
unset($buttons[$key]);
|
100 |
+
}
|
101 |
+
return $buttons;
|
102 |
+
}
|
103 |
+
|
104 |
+
public function quicktags_settings( $settings, $editor_id ) {
|
105 |
+
$settings['buttons'] = preg_replace( '/,fullscreen/', '', $settings['buttons'] );
|
106 |
+
$settings['buttons'] = preg_replace( '/,dfw/', '', $settings['buttons'] );
|
107 |
+
return $settings;
|
108 |
+
}
|
109 |
+
|
110 |
protected function render_field( $value, $instance ) {
|
111 |
|
112 |
$settings = array(
|
base/inc/widget-manager.class.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SiteOrigin_Widgets_Widget_Manager {
|
4 |
+
/**
|
5 |
+
* Regsitered widgets
|
6 |
+
*
|
7 |
+
* @var
|
8 |
+
*/
|
9 |
+
private $regisrered;
|
10 |
+
|
11 |
+
function __construct(){
|
12 |
+
$this->regisrered = array();
|
13 |
+
add_action( 'widgets_init', array( $this, 'widgets_init' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
static function single() {
|
17 |
+
static $single;
|
18 |
+
|
19 |
+
if( empty($single) ) {
|
20 |
+
$single = new SiteOrigin_Widgets_Widget_Manager ();
|
21 |
+
}
|
22 |
+
|
23 |
+
return $single;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @param $id
|
28 |
+
* @param $path
|
29 |
+
* @param bool|false $class
|
30 |
+
*/
|
31 |
+
public function register( $id, $path, $class = false ){
|
32 |
+
$path = realpath( $path );
|
33 |
+
if ( empty( $class ) ) {
|
34 |
+
$class = 'SiteOrigin_Widget_' . str_replace( ' ', '', ucwords( str_replace('-', ' ', $id) ) ) . '_Widget';
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->regisrered[$id] = new stdClass();
|
38 |
+
$this->regisrered[$id]->path = $path;
|
39 |
+
$this->regisrered[$id]->class = $class;
|
40 |
+
$this->regisrered[$id]->registered = false;
|
41 |
+
|
42 |
+
return $this->regisrered[$id];
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Initialize all the widgets.
|
47 |
+
*/
|
48 |
+
public function widgets_init(){
|
49 |
+
foreach( $this->regisrered as $id => & $info ) {
|
50 |
+
if( $info->registered ) continue;
|
51 |
+
register_widget( $info->class );
|
52 |
+
$info->registered = true;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
public function get_plugin_path( $id ) {
|
57 |
+
// Handle raw widget IDs, assuming they're prefixed with sow-
|
58 |
+
if( strpos($id, 'sow-') === 0 ) $id = substr($id, 4);
|
59 |
+
|
60 |
+
return !empty($this->regisrered[$id]) ? $this->regisrered[$id]->path : false;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @param $id
|
65 |
+
*
|
66 |
+
* @return string
|
67 |
+
*
|
68 |
+
* @todo examine this when using a widget in a theme folder.
|
69 |
+
*/
|
70 |
+
function get_plugin_dir_path( $id ){
|
71 |
+
// Handle raw widget IDs, assuming they're prefixed with sow-
|
72 |
+
if( strpos($id, 'sow-') === 0 ) $id = substr($id, 4);
|
73 |
+
|
74 |
+
return plugin_dir_path( $this->get_plugin_path( $id ) );
|
75 |
+
}
|
76 |
+
|
77 |
+
function get_plugin_dir_url( $id ){
|
78 |
+
// Handle raw widget IDs, assuming they're prefixed with sow-
|
79 |
+
if( strpos($id, 'sow-') === 0 ) $id = substr($id, 4);
|
80 |
+
|
81 |
+
return plugin_dir_url( $this->get_plugin_path( $id ) );
|
82 |
+
}
|
83 |
+
}
|
84 |
+
SiteOrigin_Widgets_Widget_Manager::single();
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Register a widget
|
88 |
+
*
|
89 |
+
* @param string $id The ID of the widget
|
90 |
+
* @param string $path The path of the widget
|
91 |
+
* @param bool|string $class The name of the class
|
92 |
+
*/
|
93 |
+
function siteorigin_widget_register( $id, $path, $class = false ){
|
94 |
+
SiteOrigin_Widgets_Widget_Manager::single()->register( $id, $path, $class );
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Get the base file of a widget plugin
|
99 |
+
*
|
100 |
+
* @param $name
|
101 |
+
* @return bool
|
102 |
+
*/
|
103 |
+
function siteorigin_widget_get_plugin_path($id){
|
104 |
+
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_path( $id );
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Get the base path folder of a widget plugin.
|
109 |
+
*
|
110 |
+
* @param $id
|
111 |
+
* @return string
|
112 |
+
*/
|
113 |
+
function siteorigin_widget_get_plugin_dir_path($id){
|
114 |
+
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_path($id);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get the base path URL of a widget plugin.
|
119 |
+
*
|
120 |
+
* @param $id
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
function siteorigin_widget_get_plugin_dir_url($id){
|
124 |
+
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_url($id);
|
125 |
+
}
|
base/js/admin.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
|
2 |
-
/* globals wp, jQuery, soWidgets, confirm */
|
3 |
|
4 |
var sowEmitters = {
|
5 |
|
@@ -377,9 +377,16 @@ var sowEmitters = {
|
|
377 |
// Handle the icon selection
|
378 |
|
379 |
var iconWidgetCache = {};
|
380 |
-
$fields.
|
381 |
-
var
|
382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
|
384 |
var rerenderIcons = function(){
|
385 |
var family = $is.find('select.siteorigin-widget-icon-family').val();
|
@@ -409,22 +416,41 @@ var sowEmitters = {
|
|
409 |
.click(function(){
|
410 |
var $$ = $(this);
|
411 |
if( $$.hasClass('siteorigin-widget-active') ) {
|
|
|
412 |
$$.removeClass('siteorigin-widget-active');
|
413 |
$v.val( '' );
|
|
|
|
|
|
|
414 |
}
|
415 |
else {
|
|
|
416 |
container.find('.siteorigin-widget-icon-icons-icon').removeClass('siteorigin-widget-active');
|
417 |
$$.addClass('siteorigin-widget-active');
|
418 |
-
$v.val(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
}
|
420 |
$v.trigger('change');
|
|
|
|
|
|
|
421 |
});
|
422 |
|
|
|
|
|
423 |
if( $v.val() === family + '-' + i ) {
|
|
|
|
|
|
|
|
|
424 |
icon.addClass('siteorigin-widget-active');
|
425 |
}
|
426 |
-
|
427 |
-
container.append(icon);
|
428 |
}
|
429 |
|
430 |
// Move a selcted item to the first position
|
@@ -460,7 +486,6 @@ var sowEmitters = {
|
|
460 |
$is.find('.siteorigin-widget-icon-icons').empty();
|
461 |
changeIconFamily();
|
462 |
});
|
463 |
-
|
464 |
});
|
465 |
|
466 |
///////////////////////////////////////
|
@@ -503,6 +528,10 @@ var sowEmitters = {
|
|
503 |
{ action: 'so_widgets_search_posts', query: query },
|
504 |
function(data){
|
505 |
for( var i = 0; i < data.length; i++ ) {
|
|
|
|
|
|
|
|
|
506 |
// Add all the post items
|
507 |
$ul.append(
|
508 |
$('<li>')
|
@@ -811,11 +840,12 @@ var sowEmitters = {
|
|
811 |
$('<div class="siteorigin-widget-field-repeater-item-top" />')
|
812 |
.append(
|
813 |
$('<div class="siteorigin-widget-field-expand" />')
|
814 |
-
|
|
|
|
|
815 |
)
|
816 |
.append(
|
817 |
readonly ? '' : $('<div class="siteorigin-widget-field-remove" />')
|
818 |
-
|
819 |
)
|
820 |
.append( $('<h4 />').html( $el.data('item-name') ) )
|
821 |
)
|
@@ -867,7 +897,7 @@ var sowEmitters = {
|
|
867 |
}
|
868 |
|
869 |
itemTop.click(function (e) {
|
870 |
-
if (e.target.className === "siteorigin-widget-field-remove") {
|
871 |
return;
|
872 |
}
|
873 |
e.preventDefault();
|
@@ -884,18 +914,88 @@ var sowEmitters = {
|
|
884 |
});
|
885 |
});
|
886 |
|
887 |
-
itemTop.find('.siteorigin-widget-field-remove')
|
888 |
-
.
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
$(this).
|
893 |
-
|
894 |
-
|
895 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
896 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
897 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
898 |
});
|
|
|
899 |
|
900 |
$el.find('> .siteorigin-widget-field-repeater-item-form').sowSetupForm();
|
901 |
|
1 |
|
2 |
+
/* globals wp, jQuery, soWidgets, confirm, tinymce */
|
3 |
|
4 |
var sowEmitters = {
|
5 |
|
377 |
// Handle the icon selection
|
378 |
|
379 |
var iconWidgetCache = {};
|
380 |
+
$fields.filter('.siteorigin-widget-field-type-icon').each(function(){
|
381 |
+
var $$ = $(this),
|
382 |
+
$is = $$.find('.siteorigin-widget-icon-selector'),
|
383 |
+
$v = $is.find('.siteorigin-widget-icon-icon'),
|
384 |
+
$b = $$.find('.siteorigin-widget-icon-selector-current');
|
385 |
+
|
386 |
+
// Clicking on the button should display the icon selector
|
387 |
+
$b.click(function(){
|
388 |
+
$is.slideToggle();
|
389 |
+
});
|
390 |
|
391 |
var rerenderIcons = function(){
|
392 |
var family = $is.find('select.siteorigin-widget-icon-family').val();
|
416 |
.click(function(){
|
417 |
var $$ = $(this);
|
418 |
if( $$.hasClass('siteorigin-widget-active') ) {
|
419 |
+
// This is being unselected
|
420 |
$$.removeClass('siteorigin-widget-active');
|
421 |
$v.val( '' );
|
422 |
+
|
423 |
+
// Hide the button icon
|
424 |
+
$b.find('span').hide();
|
425 |
}
|
426 |
else {
|
427 |
+
// This is being selected
|
428 |
container.find('.siteorigin-widget-icon-icons-icon').removeClass('siteorigin-widget-active');
|
429 |
$$.addClass('siteorigin-widget-active');
|
430 |
+
$v.val( $$.data('value') );
|
431 |
+
|
432 |
+
// Also add this to the button
|
433 |
+
$b.find('span')
|
434 |
+
.show()
|
435 |
+
.attr( 'data-sow-icon', $$.attr('data-sow-icon') )
|
436 |
+
.attr( 'class', '' )
|
437 |
+
.addClass( 'sow-icon-' + family );
|
438 |
}
|
439 |
$v.trigger('change');
|
440 |
+
|
441 |
+
// Hide the icon selector
|
442 |
+
$is.slideUp();
|
443 |
});
|
444 |
|
445 |
+
container.append(icon);
|
446 |
+
|
447 |
if( $v.val() === family + '-' + i ) {
|
448 |
+
if( !icon.hasClass('siteorigin-widget-active') ) {
|
449 |
+
// This is becoming active, so simulate a click
|
450 |
+
icon.click();
|
451 |
+
}
|
452 |
icon.addClass('siteorigin-widget-active');
|
453 |
}
|
|
|
|
|
454 |
}
|
455 |
|
456 |
// Move a selcted item to the first position
|
486 |
$is.find('.siteorigin-widget-icon-icons').empty();
|
487 |
changeIconFamily();
|
488 |
});
|
|
|
489 |
});
|
490 |
|
491 |
///////////////////////////////////////
|
528 |
{ action: 'so_widgets_search_posts', query: query },
|
529 |
function(data){
|
530 |
for( var i = 0; i < data.length; i++ ) {
|
531 |
+
if( data[i].post_title === '' ) {
|
532 |
+
data[i].post_title = ' ';
|
533 |
+
}
|
534 |
+
|
535 |
// Add all the post items
|
536 |
$ul.append(
|
537 |
$('<li>')
|
840 |
$('<div class="siteorigin-widget-field-repeater-item-top" />')
|
841 |
.append(
|
842 |
$('<div class="siteorigin-widget-field-expand" />')
|
843 |
+
)
|
844 |
+
.append(
|
845 |
+
readonly ? '' : $('<div class="siteorigin-widget-field-copy" />')
|
846 |
)
|
847 |
.append(
|
848 |
readonly ? '' : $('<div class="siteorigin-widget-field-remove" />')
|
|
|
849 |
)
|
850 |
.append( $('<h4 />').html( $el.data('item-name') ) )
|
851 |
)
|
897 |
}
|
898 |
|
899 |
itemTop.click(function (e) {
|
900 |
+
if (e.target.className === "siteorigin-widget-field-remove" || e.target.className === "siteorigin-widget-field-copy") {
|
901 |
return;
|
902 |
}
|
903 |
e.preventDefault();
|
914 |
});
|
915 |
});
|
916 |
|
917 |
+
itemTop.find('.siteorigin-widget-field-remove').click(function (e) {
|
918 |
+
e.preventDefault();
|
919 |
+
if ( confirm( soWidgets.sure ) ) {
|
920 |
+
var $s = $(this).closest('.siteorigin-widget-field-repeater-items');
|
921 |
+
$(this).closest('.siteorigin-widget-field-repeater-item').slideUp('fast', function () {
|
922 |
+
$(this).remove();
|
923 |
+
$s.sortable("refresh").trigger('updateFieldPositions');
|
924 |
+
$(window).resize();
|
925 |
+
});
|
926 |
+
}
|
927 |
+
});
|
928 |
+
itemTop.find('.siteorigin-widget-field-copy').click(function(e){
|
929 |
+
e.preventDefault();
|
930 |
+
var $form = $(this).closest('.siteorigin-widget-form-main');
|
931 |
+
var $item = $(this).closest('.siteorigin-widget-field-repeater-item');
|
932 |
+
var $copyItem = $item.clone();
|
933 |
+
var $items = $item.closest('.siteorigin-widget-field-repeater-items');
|
934 |
+
//var $nextIndex = $item.index()+1;
|
935 |
+
var $nextIndex = $items.children().length;
|
936 |
+
var newIds = {};
|
937 |
+
|
938 |
+
$copyItem.find( '*[name]' ).each( function () {
|
939 |
+
var $inputElement = $(this);
|
940 |
+
var id = $inputElement.attr('id');
|
941 |
+
var nm = $inputElement.attr('name');
|
942 |
+
// TinyMCE field :/
|
943 |
+
if($inputElement.is('textarea') && $inputElement.parent().is('.wp-editor-container') && typeof tinymce != 'undefined') {
|
944 |
+
$inputElement.parent().empty().append($inputElement);
|
945 |
+
$inputElement.css('display', '');
|
946 |
+
var curEd = tinymce.get(id);
|
947 |
+
if(curEd) {
|
948 |
+
$inputElement.val(curEd.getContent());
|
949 |
+
}
|
950 |
+
}
|
951 |
+
// Color field :/
|
952 |
+
else if( $inputElement.is('.wp-color-picker')) {
|
953 |
+
var $wpPickerContainer = $inputElement.closest('.wp-picker-container');
|
954 |
+
var $soWidgetField = $inputElement.closest('.siteorigin-widget-field');
|
955 |
+
$wpPickerContainer.remove();
|
956 |
+
$soWidgetField.append($inputElement.remove());
|
957 |
+
}
|
958 |
+
else {
|
959 |
+
var $originalInput = $item.find('[name="' + nm + '"]');
|
960 |
+
if( $originalInput.length && $originalInput.val() != null ){
|
961 |
+
$inputElement.val($originalInput.val());
|
962 |
+
}
|
963 |
+
}
|
964 |
+
if(id) {
|
965 |
+
var idBase = id.replace(/-\d+$/, '');
|
966 |
+
if (!newIds[idBase]) {
|
967 |
+
newIds[idBase] = $form.find('.siteorigin-widget-input[id^=' + idBase + ']').not('[id*=_id_]').length + 1;
|
968 |
+
}
|
969 |
+
var newId = idBase + '-' + newIds[idBase]++;
|
970 |
+
$inputElement.attr('id', newId);
|
971 |
+
$copyItem.find('label[for=' + id + ']').attr('for', newId);
|
972 |
+
$copyItem.find('[id*=' + id + ']').each(function() {
|
973 |
+
var oldIdAttr = $(this).attr('id');
|
974 |
+
var newIdAttr = oldIdAttr.replace(id, newId);
|
975 |
+
$(this).attr('id', newIdAttr);
|
976 |
});
|
977 |
+
if(typeof tinymce != 'undefined' && tinymce.get(newId)) {
|
978 |
+
tinymce.get(newId).remove();
|
979 |
+
}
|
980 |
+
}
|
981 |
+
var nestLevel = $item.parents('.siteorigin-widget-field-repeater').length;
|
982 |
+
var $body = $('body');
|
983 |
+
if( ($body.hasClass('wp-customizer') || $body.hasClass('widgets-php')) && $el.closest('.panel-dialog').length == 0) {
|
984 |
+
nestLevel += 1;
|
985 |
}
|
986 |
+
var newName = nm.replace(new RegExp('((?:.*?\\[\\d+\\]){'+(nestLevel-1).toString()+'})?(.*?\\[)\\d+(\\])'), '$1$2'+$nextIndex.toString()+'$3');
|
987 |
+
$inputElement.attr('name', newName);
|
988 |
+
$inputElement.data('original-name', newName);
|
989 |
+
} );
|
990 |
+
|
991 |
+
//$item.after($copyItem);
|
992 |
+
//$items.sortable( "refresh").trigger('updateFieldPositions');
|
993 |
+
$items.append($copyItem).sortable( "refresh").trigger('updateFieldPositions');
|
994 |
+
$copyItem.sowSetupRepeaterItems();
|
995 |
+
$copyItem.hide().slideDown('fast', function(){
|
996 |
+
$(window).resize();
|
997 |
});
|
998 |
+
});
|
999 |
|
1000 |
$el.find('> .siteorigin-widget-field-repeater-item-form').sowSetupForm();
|
1001 |
|
base/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,o=0;o<i.length;o++)r=sowEmitters._match(i[o],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a=e(t),r=!0,o=a.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(a.is(".siteorigin-widget-form-main")){if(a.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!a.is(":visible")&&0===a.closest(".panel-dialog").length)return!0;a.on("sowstatechange",function(i,t,n){a.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),r?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var o,s,d,l,f,g={};for(var c in a)if(f=!1,o=c.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_-]+)\])?(\[\])?$/),null!==o&&(s={group:"default",name:"",multi:!1},void 0!==o[2]?(s.group=o[1],s.name=o[3]):s.name=o[0],s.multi=void 0!==o[4],"_else"===s.group?(s.group=s.name,s.name="",f=s.group===t&&"undefined"==typeof g[s.group]):f=s.group===t&&s.name===n,f)){d=a[c],s.multi||(d=[d]);for(var u=0;u<d.length;u++)l="undefined"!=typeof d[u][1]&&Boolean(d[u][1])?i.find(d[u][1]):i,l[d[u][0]].apply(l,"undefined"!=typeof d[u][2]?d[u][2]:[]);g[s.group]=!0}})}),a.sowSetupPreview(),n=a}else n=a.closest(".siteorigin-widget-form-main");var s=a.find("> .siteorigin-widget-field");s.find("> .siteorigin-widget-section").sowSetupForm(),s.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),s.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),s.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),a.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),s.find("> .siteorigin-widget-input-color").wpColorPicker().closest(".siteorigin-widget-field").find("a").click(function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center")}),s.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),s.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center"),e(window).resize()})});var d={};s.find("> .siteorigin-widget-icon-selector").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-icon"),n=function(){var n=i.find("select.siteorigin-widget-icon-family").val(),a=i.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof d[n]){a.empty(),0===e("#siteorigin-widget-font-"+n).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+n).attr("href",d[n].style_uri).appendTo("head");for(var r in d[n].icons){var o=e('<div data-sow-icon="'+d[n].icons[r]+'"/>').attr("data-value",n+"-"+r).addClass("sow-icon-"+n).addClass("siteorigin-widget-icon-icons-icon").click(function(){var i=e(this);i.hasClass("siteorigin-widget-active")?(i.removeClass("siteorigin-widget-active"),t.val("")):(a.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),i.addClass("siteorigin-widget-active"),t.val(e(this).data("value"))),t.trigger("change")});t.val()===n+"-"+r&&o.addClass("siteorigin-widget-active"),a.append(o)}a.prepend(a.find(".siteorigin-widget-active"))}},a=function(){var t=i.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof t&&""!==t&&("undefined"==typeof d[t]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:i.find("select.siteorigin-widget-icon-family").val()},function(e){d[t]=e,n()}):n())};a(),i.find("select.siteorigin-widget-icon-family").change(function(){i.find(".siteorigin-widget-icon-icons").empty(),a()})}),s.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),s.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var l=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){return"undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1)?n:e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var o=0;o<t.length;o++)r=a(t[o],r);var s=n.data("states");"undefined"==typeof s&&(s={"default":""});for(var d in r)("undefined"==typeof s[d]||r[d]!==s[d])&&(s[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",s)}};s.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",l),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&l.call(i[0]):l.call(i[0])})}),a.trigger("sowsetupform",s).data("sow-form-setup",!0),a.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),r=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,o=0;o<a.length;o++)o===a.length-1?"checkbox"===i.attr("type")?r[a[o]]=i.is(":checked")?""!==i.val()?i.val():!0:!1:"radio"===i.attr("type")?i.is(":checked")&&(r[a[o]]=""!==i.val()?i.val():!0):r[a[o]]=i.val():("undefined"==typeof r[a[o]]&&(r[a[o]]={}),r=r[a[o]])});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var o in n)r=r.replace("#"+o+"#",n[o]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var o=t.first().outerHeight();i.css("max-height",o*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()}),"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center")}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeater-items").slideToggle("fast")})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var o=r.html().replace(/_id_/g,a),s="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(s?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(o));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),o=a.data("item-label");if(o&&o.selector){var s=function(){var e=o.hasOwnProperty("valueMethod")&&o.valueMethod?o.valueMethod:"val",i=n.find(o.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};s();var d=o.hasOwnProperty("updateEvent")&&o.updateEvent?o.updateEvent:"change";n.bind(d,s)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center"),e(this).trigger(e(this).is(":visible")?"slideToggleOpenComplete":"slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})},window.sowGetWidgetFieldVariable=function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),o=r.length?n:null;r.length;)o=o[r.shift()];return o[t]},window.sowFetchWidgetVariable=function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);
|
1 |
+
var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,o=0;o<i.length;o++)r=sowEmitters._match(i[o],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a=e(t),r=!0,o=a.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(a.is(".siteorigin-widget-form-main")){if(a.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!a.is(":visible")&&0===a.closest(".panel-dialog").length)return!0;a.on("sowstatechange",function(i,t,n){a.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),r?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var o,s,d,l,f,c={};for(var g in a)if(f=!1,o=g.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_-]+)\])?(\[\])?$/),null!==o&&(s={group:"default",name:"",multi:!1},void 0!==o[2]?(s.group=o[1],s.name=o[3]):s.name=o[0],s.multi=void 0!==o[4],"_else"===s.group?(s.group=s.name,s.name="",f=s.group===t&&"undefined"==typeof c[s.group]):f=s.group===t&&s.name===n,f)){d=a[g],s.multi||(d=[d]);for(var p=0;p<d.length;p++)l="undefined"!=typeof d[p][1]&&Boolean(d[p][1])?i.find(d[p][1]):i,l[d[p][0]].apply(l,"undefined"!=typeof d[p][2]?d[p][2]:[]);c[s.group]=!0}})}),a.sowSetupPreview(),n=a}else n=a.closest(".siteorigin-widget-form-main");var s=a.find("> .siteorigin-widget-field");s.find("> .siteorigin-widget-section").sowSetupForm(),s.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),s.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),s.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),a.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),s.find("> .siteorigin-widget-input-color").wpColorPicker().closest(".siteorigin-widget-field").find("a").click(function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center")}),s.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),s.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center"),e(window).resize()})});var d={};s.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof d[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",d[i].style_uri).appendTo("head");for(var o in d[i].icons){var s=e('<div data-sow-icon="'+d[i].icons[o]+'"/>').attr("data-value",i+"-"+o).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var o=e(this);o.hasClass("siteorigin-widget-active")?(o.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),o.addClass("siteorigin-widget-active"),n.val(o.data("value")),a.find("span").show().attr("data-sow-icon",o.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(s),n.val()===i+"-"+o&&(s.hasClass("siteorigin-widget-active")||s.click(),s.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},o=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof d[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){d[i]=e,r()}):r())};o(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),o()})}),s.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),s.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title=" "),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var l=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){return"undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1)?n:e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var o=0;o<t.length;o++)r=a(t[o],r);var s=n.data("states");"undefined"==typeof s&&(s={"default":""});for(var d in r)("undefined"==typeof s[d]||r[d]!==s[d])&&(s[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",s)}};s.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",l),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&l.call(i[0]):l.call(i[0])})}),a.trigger("sowsetupform",s).data("sow-form-setup",!0),a.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),r=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,o=0;o<a.length;o++)o===a.length-1?"checkbox"===i.attr("type")?r[a[o]]=i.is(":checked")?""!==i.val()?i.val():!0:!1:"radio"===i.attr("type")?i.is(":checked")&&(r[a[o]]=""!==i.val()?i.val():!0):r[a[o]]=i.val():("undefined"==typeof r[a[o]]&&(r[a[o]]={}),r=r[a[o]])});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var o in n)r=r.replace("#"+o+"#",n[o]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var o=t.first().outerHeight();i.css("max-height",o*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()}),"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center")}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeater-items").slideToggle("fast")})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var o=r.html().replace(/_id_/g,a),s="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(s?"":e('<div class="siteorigin-widget-field-copy" />')).append(s?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(o));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),o=a.data("item-label");if(o&&o.selector){var s=function(){var e=o.hasOwnProperty("valueMethod")&&o.valueMethod?o.valueMethod:"val",i=n.find(o.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};s();var d=o.hasOwnProperty("updateEvent")&&o.updateEvent?o.updateEvent:"change";n.bind(d,s)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center"),e(this).trigger(e(this).is(":visible")?"slideToggleOpenComplete":"slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),o=a.closest(".siteorigin-widget-field-repeater-items"),s=o.children().length,d={};r.find("*[name]").each(function(){var i=e(this),o=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var f=tinymce.get(o);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var c=i.closest(".wp-picker-container"),g=i.closest(".siteorigin-widget-field");c.remove(),g.append(i.remove())}else{var p=a.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(o){var u=o.replace(/-\d+$/,"");d[u]||(d[u]=t.find(".siteorigin-widget-input[id^="+u+"]").not("[id*=_id_]").length+1);var w=u+"-"+d[u]++;i.attr("id",w),r.find("label[for="+o+"]").attr("for",w),r.find("[id*="+o+"]").each(function(){var i=e(this).attr("id"),t=i.replace(o,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var m=a.parents(".siteorigin-widget-field-repeater").length,h=e("body");(h.hasClass("wp-customizer")||h.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(m+=1);var v=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(m-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+s.toString()+"$3");i.attr("name",v),i.data("original-name",v)}),o.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})},window.sowGetWidgetFieldVariable=function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),o=r.length?n:null;r.length;)o=o[r.shift()];return o[t]},window.sowFetchWidgetVariable=function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);
|
base/less/mixins.less
CHANGED
@@ -185,5 +185,10 @@
|
|
185 |
.bordered(@border_top, @border_color, @border_bottom, @border_color);
|
186 |
}
|
187 |
|
|
|
|
|
|
|
|
|
|
|
188 |
//this is to remove annoying IDE warnings for not being able to resolve .widget-function() calls
|
189 |
.widget-function(...){}
|
185 |
.bordered(@border_top, @border_color, @border_bottom, @border_color);
|
186 |
}
|
187 |
|
188 |
+
.font(@font, @weight) when not (@font = default) {
|
189 |
+
font-family: @font;
|
190 |
+
font-weight: @weight;
|
191 |
+
}
|
192 |
+
|
193 |
//this is to remove annoying IDE warnings for not being able to resolve .widget-function() calls
|
194 |
.widget-function(...){}
|
base/siteorigin-widget.class.php
CHANGED
@@ -112,7 +112,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
112 |
) );
|
113 |
|
114 |
// Add any missing default values to the instance
|
115 |
-
$instance = $this->add_defaults($this->form_options, $instance);
|
116 |
|
117 |
$css_name = $this->generate_and_enqueue_instance_styles( $instance );
|
118 |
$this->enqueue_frontend_scripts( $instance );
|
@@ -162,6 +162,11 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
162 |
* @return string The CSS name
|
163 |
*/
|
164 |
function generate_and_enqueue_instance_styles( $instance ) {
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
$this->current_instance = $instance;
|
167 |
$style = $this->get_style_name( $instance );
|
@@ -240,7 +245,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
240 |
$args['before_widget'] = '';
|
241 |
$args['after_widget'] = '';
|
242 |
|
243 |
-
$widget->widget($args, $instance);
|
244 |
}
|
245 |
|
246 |
/**
|
@@ -254,15 +259,23 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
254 |
|
255 |
foreach($form as $id => $field) {
|
256 |
|
257 |
-
if($field['type'] == 'repeater'
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
261 |
}
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
263 |
}
|
264 |
else {
|
265 |
-
if( !isset($instance[$id]) && isset($field['default']) )
|
|
|
|
|
266 |
}
|
267 |
}
|
268 |
|
@@ -278,6 +291,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
278 |
public function form( $instance ) {
|
279 |
$this->enqueue_scripts();
|
280 |
$instance = $this->modify_instance($instance);
|
|
|
281 |
|
282 |
// Filter the instance specifically for the form
|
283 |
$instance = apply_filters('siteorigin_widgets_form_instance_' . $this->id_base, $instance, $this);
|
@@ -434,17 +448,15 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
434 |
/* @var $field_factory SiteOrigin_Widget_Field_Factory */
|
435 |
$field_factory = SiteOrigin_Widget_Field_Factory::getInstance();
|
436 |
foreach ( $form_options as $field_name => $field_options ) {
|
437 |
-
if ( empty( $new_instance[$field_name] ) ) {
|
438 |
-
$new_instance[$field_name] = false;
|
439 |
-
continue;
|
440 |
-
}
|
441 |
/* @var $field SiteOrigin_Widget_Field_Base */
|
442 |
if ( !empty( $this->fields ) && !empty( $this->fields[$field_name] ) ) {
|
443 |
$field = $this->fields[$field_name];
|
444 |
-
}
|
|
|
445 |
$field = $field_factory->create_field( $field_name, $field_options, $this );
|
|
|
446 |
}
|
447 |
-
$new_instance[$field_name] = $field->sanitize( $new_instance[$field_name] );
|
448 |
$new_instance = $field->sanitize_instance( $new_instance );
|
449 |
}
|
450 |
|
@@ -579,7 +591,8 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
579 |
$vars = $this->get_less_variables($instance);
|
580 |
if( !empty( $vars ) ){
|
581 |
foreach($vars as $name => $value) {
|
582 |
-
|
|
|
583 |
|
584 |
$less = preg_replace('/\@'.preg_quote($name).' *\:.*?;/', '@'.$name.': '.$value.';', $less);
|
585 |
}
|
@@ -596,9 +609,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
596 |
$css_imports = '';
|
597 |
if ( preg_match_all( '/^@import.+/m', $less, $imports ) ) {
|
598 |
$css_imports = implode( "\n", $imports[0] );
|
|
|
599 |
}
|
600 |
|
601 |
-
$less = $css_imports . "\n\n" . '.so-widget-'.$css_name.
|
602 |
|
603 |
$c = new lessc();
|
604 |
$lc_functions = new SiteOrigin_Widgets_Less_Functions($this, $instance);
|
112 |
) );
|
113 |
|
114 |
// Add any missing default values to the instance
|
115 |
+
$instance = $this->add_defaults( $this->form_options, $instance );
|
116 |
|
117 |
$css_name = $this->generate_and_enqueue_instance_styles( $instance );
|
118 |
$this->enqueue_frontend_scripts( $instance );
|
162 |
* @return string The CSS name
|
163 |
*/
|
164 |
function generate_and_enqueue_instance_styles( $instance ) {
|
165 |
+
// We'll assume empty instances don't have styles
|
166 |
+
if( empty($instance) ) return;
|
167 |
+
|
168 |
+
// Make sure all the default values are in place
|
169 |
+
$instance = $this->add_defaults( $this->form_options, $instance );
|
170 |
|
171 |
$this->current_instance = $instance;
|
172 |
$style = $this->get_style_name( $instance );
|
245 |
$args['before_widget'] = '';
|
246 |
$args['after_widget'] = '';
|
247 |
|
248 |
+
$widget->widget( $args, $instance );
|
249 |
}
|
250 |
|
251 |
/**
|
259 |
|
260 |
foreach($form as $id => $field) {
|
261 |
|
262 |
+
if( $field['type'] == 'repeater' ) {
|
263 |
+
if( !empty($instance[$id]) ) {
|
264 |
+
foreach( array_keys($instance[$id]) as $i ){
|
265 |
+
$instance[$id][$i] = $this->add_defaults( $field['fields'], $instance[$id][$i], $level + 1 );
|
266 |
+
}
|
267 |
}
|
268 |
+
}
|
269 |
+
else if( $field['type'] == 'section' ) {
|
270 |
+
if( empty($instance[$id]) ) {
|
271 |
+
$instance[$id] = array();
|
272 |
+
}
|
273 |
+
$instance[$id] = $this->add_defaults( $field['fields'], $instance[$id], $level + 1 );
|
274 |
}
|
275 |
else {
|
276 |
+
if( !isset($instance[$id]) && isset($field['default']) ) {
|
277 |
+
$instance[$id] = $field['default'];
|
278 |
+
}
|
279 |
}
|
280 |
}
|
281 |
|
291 |
public function form( $instance ) {
|
292 |
$this->enqueue_scripts();
|
293 |
$instance = $this->modify_instance($instance);
|
294 |
+
$instance = $this->add_defaults( $this->form_options(), $instance );
|
295 |
|
296 |
// Filter the instance specifically for the form
|
297 |
$instance = apply_filters('siteorigin_widgets_form_instance_' . $this->id_base, $instance, $this);
|
448 |
/* @var $field_factory SiteOrigin_Widget_Field_Factory */
|
449 |
$field_factory = SiteOrigin_Widget_Field_Factory::getInstance();
|
450 |
foreach ( $form_options as $field_name => $field_options ) {
|
|
|
|
|
|
|
|
|
451 |
/* @var $field SiteOrigin_Widget_Field_Base */
|
452 |
if ( !empty( $this->fields ) && !empty( $this->fields[$field_name] ) ) {
|
453 |
$field = $this->fields[$field_name];
|
454 |
+
}
|
455 |
+
else {
|
456 |
$field = $field_factory->create_field( $field_name, $field_options, $this );
|
457 |
+
$this->fields[$field_name] = $field;
|
458 |
}
|
459 |
+
$new_instance[$field_name] = $field->sanitize( isset( $new_instance[$field_name] ) ? $new_instance[$field_name] : null );
|
460 |
$new_instance = $field->sanitize_instance( $new_instance );
|
461 |
}
|
462 |
|
591 |
$vars = $this->get_less_variables($instance);
|
592 |
if( !empty( $vars ) ){
|
593 |
foreach($vars as $name => $value) {
|
594 |
+
// Ignore empty string
|
595 |
+
if( $value === '' || $value === false ) continue;
|
596 |
|
597 |
$less = preg_replace('/\@'.preg_quote($name).' *\:.*?;/', '@'.$name.': '.$value.';', $less);
|
598 |
}
|
609 |
$css_imports = '';
|
610 |
if ( preg_match_all( '/^@import.+/m', $less, $imports ) ) {
|
611 |
$css_imports = implode( "\n", $imports[0] );
|
612 |
+
$less = preg_replace( '/^@import.+/m', '', $less );
|
613 |
}
|
614 |
|
615 |
+
$less = $css_imports . "\n\n" . '.so-widget-'.$css_name." { \n".$less."\n } ";
|
616 |
|
617 |
$c = new lessc();
|
618 |
$lc_functions = new SiteOrigin_Widgets_Less_Functions($this, $instance);
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
|
3 |
Requires at least: 3.9
|
4 |
Tested up to: 4.3
|
5 |
-
Stable tag: 1.4.
|
6 |
License: GPLv3 or later
|
7 |
Contributors: gpriday, braam-genis
|
8 |
|
@@ -50,6 +50,17 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
|
|
50 |
|
51 |
== Changelog ==
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
= 1.4.2 - August 18 2015 =
|
54 |
* Urgent fix in preparation for WordPress 4.3 release
|
55 |
|
2 |
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
|
3 |
Requires at least: 3.9
|
4 |
Tested up to: 4.3
|
5 |
+
Stable tag: 1.4.2
|
6 |
License: GPLv3 or later
|
7 |
Contributors: gpriday, braam-genis
|
8 |
|
50 |
|
51 |
== Changelog ==
|
52 |
|
53 |
+
= 1.4.3 - September 5 2015 =
|
54 |
+
* Added support for WooCommerce shortcodes to TinyMCE field.
|
55 |
+
* New streamlined icon selector field.
|
56 |
+
* Added info window functionality to maps widget.
|
57 |
+
* Added a button to duplicate repeater items.
|
58 |
+
* Added more design settings to hero image widget.
|
59 |
+
* Removed full screen mode from TinyMCE field.
|
60 |
+
* Option to keep map centered when container is resized.
|
61 |
+
* Fixed: CSS bug for Google font imports on generated CSS.
|
62 |
+
* Fixed: Post selector for URL fields properly handles empty titles.
|
63 |
+
|
64 |
= 1.4.2 - August 18 2015 =
|
65 |
* Urgent fix in preparation for WordPress 4.3 release
|
66 |
|
so-widgets-bundle.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
-
Version: 1.4.
|
6 |
Author: SiteOrigin
|
7 |
Author URI: https://siteorigin.com
|
8 |
Plugin URI: https://siteorigin.com/widgets-bundle/
|
@@ -10,7 +10,7 @@ License: GPL3
|
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
11 |
*/
|
12 |
|
13 |
-
define('SOW_BUNDLE_VERSION', '1.4.
|
14 |
define('SOW_BUNDLE_JS_SUFFIX', '.min');
|
15 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
16 |
|
@@ -19,7 +19,6 @@ if( !function_exists('siteorigin_widget_get_plugin_path') ) {
|
|
19 |
include plugin_dir_path(__FILE__).'icons/icons.php';
|
20 |
}
|
21 |
|
22 |
-
|
23 |
class SiteOrigin_Widgets_Bundle {
|
24 |
|
25 |
private $widget_folders;
|
@@ -326,7 +325,7 @@ class SiteOrigin_Widgets_Bundle {
|
|
326 |
include_once $folder . $widget_id . '/' . $widget_id . '.php';
|
327 |
|
328 |
if( has_action('widgets_init') ) {
|
329 |
-
|
330 |
}
|
331 |
}
|
332 |
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
+
Version: 1.4.3
|
6 |
Author: SiteOrigin
|
7 |
Author URI: https://siteorigin.com
|
8 |
Plugin URI: https://siteorigin.com/widgets-bundle/
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
11 |
*/
|
12 |
|
13 |
+
define('SOW_BUNDLE_VERSION', '1.4.3');
|
14 |
define('SOW_BUNDLE_JS_SUFFIX', '.min');
|
15 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
16 |
|
19 |
include plugin_dir_path(__FILE__).'icons/icons.php';
|
20 |
}
|
21 |
|
|
|
22 |
class SiteOrigin_Widgets_Bundle {
|
23 |
|
24 |
private $widget_folders;
|
325 |
include_once $folder . $widget_id . '/' . $widget_id . '.php';
|
326 |
|
327 |
if( has_action('widgets_init') ) {
|
328 |
+
SiteOrigin_Widgets_Widget_Manager::single()->widgets_init();
|
329 |
}
|
330 |
}
|
331 |
|
widgets/so-button-widget/so-button-widget.php
CHANGED
@@ -14,7 +14,7 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
|
|
14 |
__('SiteOrigin Button', 'siteorigin-widgets'),
|
15 |
array(
|
16 |
'description' => __('A customizable button widget.', 'siteorigin-widgets'),
|
17 |
-
'help' => '
|
18 |
),
|
19 |
array(
|
20 |
|
14 |
__('SiteOrigin Button', 'siteorigin-widgets'),
|
15 |
array(
|
16 |
'description' => __('A customizable button widget.', 'siteorigin-widgets'),
|
17 |
+
'help' => 'https://siteorigin.com/widgets-bundle/button-widget-documentation/'
|
18 |
),
|
19 |
array(
|
20 |
|
widgets/so-cta-widget/so-cta-widget.php
CHANGED
@@ -15,7 +15,7 @@ class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
|
|
15 |
__('SiteOrigin Call-to-action', 'siteorigin-widgets'),
|
16 |
array(
|
17 |
'description' => __('A simple call-to-action widget with massive power.', 'siteorigin-widgets'),
|
18 |
-
'help' => '
|
19 |
),
|
20 |
array(
|
21 |
|
15 |
__('SiteOrigin Call-to-action', 'siteorigin-widgets'),
|
16 |
array(
|
17 |
'description' => __('A simple call-to-action widget with massive power.', 'siteorigin-widgets'),
|
18 |
+
'help' => 'https://siteorigin.com/widgets-bundle/call-action-widget/'
|
19 |
),
|
20 |
array(
|
21 |
|
widgets/so-editor-widget/so-editor-widget.php
CHANGED
@@ -16,6 +16,7 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
|
|
16 |
__('SiteOrigin Editor', 'siteorigin-widgets'),
|
17 |
array(
|
18 |
'description' => __('A rich-text, text editor.', 'siteorigin-widgets'),
|
|
|
19 |
),
|
20 |
array(),
|
21 |
array(
|
@@ -25,30 +26,18 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
|
|
25 |
),
|
26 |
'text' => array(
|
27 |
'type' => 'tinymce',
|
28 |
-
'rows' => 20
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
),
|
34 |
),
|
35 |
plugin_dir_path(__FILE__)
|
36 |
);
|
37 |
}
|
38 |
|
39 |
-
public function mce_buttons_filter( $buttons, $editor_id ) {
|
40 |
-
if (($key = array_search('fullscreen', $buttons)) !== false) {
|
41 |
-
unset($buttons[$key]);
|
42 |
-
}
|
43 |
-
return $buttons;
|
44 |
-
}
|
45 |
-
|
46 |
-
public function quicktags_settings( $settings, $editor_id ) {
|
47 |
-
$settings['buttons'] = preg_replace( '/,fullscreen/', '', $settings['buttons'] );
|
48 |
-
$settings['buttons'] = preg_replace( '/,dfw/', '', $settings['buttons'] );
|
49 |
-
return $settings;
|
50 |
-
}
|
51 |
-
|
52 |
function unwpautop($string) {
|
53 |
$string = str_replace("\n", "", $string);
|
54 |
$string = str_replace("<p>", "", $string);
|
@@ -72,7 +61,9 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
|
|
72 |
if( !empty($GLOBALS['wp_embed']) ) {
|
73 |
$instance['text'] = $GLOBALS['wp_embed']->autoembed( $instance['text'] );
|
74 |
}
|
75 |
-
|
|
|
|
|
76 |
$instance['text'] = do_shortcode( $instance['text'] );
|
77 |
|
78 |
return array(
|
16 |
__('SiteOrigin Editor', 'siteorigin-widgets'),
|
17 |
array(
|
18 |
'description' => __('A rich-text, text editor.', 'siteorigin-widgets'),
|
19 |
+
'help' => 'https://siteorigin.com/widgets-bundle/editor-widget/'
|
20 |
),
|
21 |
array(),
|
22 |
array(
|
26 |
),
|
27 |
'text' => array(
|
28 |
'type' => 'tinymce',
|
29 |
+
'rows' => 20
|
30 |
+
),
|
31 |
+
'autop' => array(
|
32 |
+
'type' => 'checkbox',
|
33 |
+
'default' => true,
|
34 |
+
'label' => __('Automatically add paragraphs', 'siteorigin-widgets'),
|
35 |
),
|
36 |
),
|
37 |
plugin_dir_path(__FILE__)
|
38 |
);
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
function unwpautop($string) {
|
42 |
$string = str_replace("\n", "", $string);
|
43 |
$string = str_replace("<p>", "", $string);
|
61 |
if( !empty($GLOBALS['wp_embed']) ) {
|
62 |
$instance['text'] = $GLOBALS['wp_embed']->autoembed( $instance['text'] );
|
63 |
}
|
64 |
+
if( $instance['autop'] ) {
|
65 |
+
$instance['text'] = wpautop( $instance['text'] );
|
66 |
+
}
|
67 |
$instance['text'] = do_shortcode( $instance['text'] );
|
68 |
|
69 |
return array(
|
widgets/so-features-widget/css/style.css
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
@font-face {
|
2 |
font-family: 'feature-background';
|
3 |
-
src: url('fonts/feature-background.eot
|
4 |
-
src: url('fonts/feature-background.eot
|
5 |
font-weight: normal;
|
6 |
font-style: normal;
|
7 |
}
|
1 |
@font-face {
|
2 |
font-family: 'feature-background';
|
3 |
+
src: url('fonts/feature-background.eot');
|
4 |
+
src: url('fonts/feature-background.eot') format('embedded-opentype'), url('fonts/feature-background.woff') format('woff'), url('fonts/feature-background.ttf') format('truetype'), url('fonts/feature-background.svg') format('svg');
|
5 |
font-weight: normal;
|
6 |
font-style: normal;
|
7 |
}
|
widgets/so-features-widget/inc/containers.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
return array(
|
|
|
4 |
"round" => "round",
|
5 |
"sticker" => "sticker",
|
6 |
"rounded-sticker" => "rounded-sticker",
|
1 |
<?php
|
2 |
|
3 |
return array(
|
4 |
+
"" => "none",
|
5 |
"round" => "round",
|
6 |
"sticker" => "sticker",
|
7 |
"rounded-sticker" => "rounded-sticker",
|
widgets/so-features-widget/so-features-widget.php
CHANGED
@@ -13,7 +13,7 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
|
|
13 |
__( 'SiteOrigin Features', 'siteorigin-widgets' ),
|
14 |
array(
|
15 |
'description' => __( 'Displays a list of features.', 'siteorigin-widgets' ),
|
16 |
-
'help' => '
|
17 |
),
|
18 |
array(),
|
19 |
array(
|
@@ -83,6 +83,7 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
|
|
83 |
'container_shape' => array(
|
84 |
'type' => 'select',
|
85 |
'label' => __('Container shape', 'siteorigin-widgets'),
|
|
|
86 |
'options' => array(
|
87 |
),
|
88 |
),
|
13 |
__( 'SiteOrigin Features', 'siteorigin-widgets' ),
|
14 |
array(
|
15 |
'description' => __( 'Displays a list of features.', 'siteorigin-widgets' ),
|
16 |
+
'help' => 'https://siteorigin.com/widgets-bundle/features-widget-documentation/'
|
17 |
),
|
18 |
array(),
|
19 |
array(
|
83 |
'container_shape' => array(
|
84 |
'type' => 'select',
|
85 |
'label' => __('Container shape', 'siteorigin-widgets'),
|
86 |
+
'default' => 'round',
|
87 |
'options' => array(
|
88 |
),
|
89 |
),
|
widgets/so-features-widget/tpl/base.php
CHANGED
@@ -13,7 +13,9 @@ $last_row = floor( ( count($instance['features']) - 1 ) / $instance['per_row'] )
|
|
13 |
<div class="sow-features-feature <?php if( floor( $i / $instance['per_row'] ) == $last_row ) echo 'sow-features-feature-last-row' ?>" style="width: <?php echo round( 100 / $instance['per_row'], 3 ) ?>%">
|
14 |
|
15 |
<?php if( !empty( $feature['more_url'] ) && $instance['icon_link'] ) echo '<a href="' . sow_esc_url( $feature['more_url'] ) . '" ' . ( $instance['new_window'] ? 'target="_blank"' : '' ) . '>'; ?>
|
16 |
-
<div
|
|
|
|
|
17 |
<?php
|
18 |
if( !empty($feature['icon_image']) ) {
|
19 |
$attachment = wp_get_attachment_image_src($feature['icon_image']);
|
13 |
<div class="sow-features-feature <?php if( floor( $i / $instance['per_row'] ) == $last_row ) echo 'sow-features-feature-last-row' ?>" style="width: <?php echo round( 100 / $instance['per_row'], 3 ) ?>%">
|
14 |
|
15 |
<?php if( !empty( $feature['more_url'] ) && $instance['icon_link'] ) echo '<a href="' . sow_esc_url( $feature['more_url'] ) . '" ' . ( $instance['new_window'] ? 'target="_blank"' : '' ) . '>'; ?>
|
16 |
+
<div
|
17 |
+
class="sow-icon-container <?php echo !empty($instance['container_shape']) ? 'sow-container-' . esc_attr($instance['container_shape']) : 'sow-container-none'?>"
|
18 |
+
style="font-size: <?php echo intval($instance['container_size']) ?>px; color: <?php echo esc_attr($feature['container_color']) ?>; width: <?php echo intval($instance['container_size']) ?>px; height: <?php echo intval($instance['container_size']) ?>px;">
|
19 |
<?php
|
20 |
if( !empty($feature['icon_image']) ) {
|
21 |
$attachment = wp_get_attachment_image_src($feature['icon_image']);
|
widgets/so-google-map-widget/js/js-map.js
CHANGED
@@ -25,6 +25,7 @@ function loadMap($) {
|
|
25 |
zoom: zoom,
|
26 |
scrollwheel: Boolean( $$.data('scroll-zoom') ),
|
27 |
draggable: Boolean( $$.data('draggable') ),
|
|
|
28 |
center: results[0].geometry.location,
|
29 |
mapTypeControlOptions: {
|
30 |
mapTypeIds: [google.maps.MapTypeId.ROADMAP, userMapTypeId]
|
@@ -63,13 +64,33 @@ function loadMap($) {
|
|
63 |
var geocodeMarker = function () {
|
64 |
geocoder.geocode({'address': mrkr.place}, function (res, status) {
|
65 |
if (status == google.maps.GeocoderStatus.OK) {
|
66 |
-
|
|
|
67 |
position: res[0].geometry.location,
|
68 |
map: map,
|
69 |
draggable: Boolean($$.data('markers-draggable')),
|
70 |
icon: $$.data('marker-icon'),
|
71 |
title: ''
|
72 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
} else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
|
74 |
//try again please
|
75 |
setTimeout(geocodeMarker, Math.random() * 1000, mrkr);
|
@@ -82,7 +103,6 @@ function loadMap($) {
|
|
82 |
);
|
83 |
}
|
84 |
|
85 |
-
|
86 |
var directions = $$.data('directions');
|
87 |
if ( directions ) {
|
88 |
|
@@ -106,11 +126,6 @@ function loadMap($) {
|
|
106 |
avoidTolls: Boolean( directions.avoidTolls ),
|
107 |
waypoints: directions.waypoints,
|
108 |
optimizeWaypoints: Boolean( directions.optimizeWaypoints )
|
109 |
-
//unitSystem: directions.unitSystem == 'metric' ? 0 : 1,
|
110 |
-
//transitOptions: TransitOptions,
|
111 |
-
//durationInTraffic: Boolean,
|
112 |
-
//provideRouteAlternatives: Boolean,
|
113 |
-
//region: String
|
114 |
},
|
115 |
function(result, status) {
|
116 |
if (status == google.maps.DirectionsStatus.OK) {
|
@@ -118,6 +133,16 @@ function loadMap($) {
|
|
118 |
}
|
119 |
});
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
else if (status == google.maps.GeocoderStatus.ZERO_RESULTS) {
|
123 |
$$.append('<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>');
|
25 |
zoom: zoom,
|
26 |
scrollwheel: Boolean( $$.data('scroll-zoom') ),
|
27 |
draggable: Boolean( $$.data('draggable') ),
|
28 |
+
disableDefaultUI: Boolean( $$.data('disable-ui') ),
|
29 |
center: results[0].geometry.location,
|
30 |
mapTypeControlOptions: {
|
31 |
mapTypeIds: [google.maps.MapTypeId.ROADMAP, userMapTypeId]
|
64 |
var geocodeMarker = function () {
|
65 |
geocoder.geocode({'address': mrkr.place}, function (res, status) {
|
66 |
if (status == google.maps.GeocoderStatus.OK) {
|
67 |
+
|
68 |
+
var marker = new google.maps.Marker({
|
69 |
position: res[0].geometry.location,
|
70 |
map: map,
|
71 |
draggable: Boolean($$.data('markers-draggable')),
|
72 |
icon: $$.data('marker-icon'),
|
73 |
title: ''
|
74 |
});
|
75 |
+
|
76 |
+
if(mrkr.hasOwnProperty('info') && mrkr.info) {
|
77 |
+
var infoWindowOptions = { content: mrkr.info };
|
78 |
+
|
79 |
+
if(mrkr.hasOwnProperty('info_max_width') && mrkr.info_max_width) {
|
80 |
+
infoWindowOptions.maxWidth = mrkr.info_max_width;
|
81 |
+
}
|
82 |
+
|
83 |
+
var infoDisplay = $$.data('marker-info-display');
|
84 |
+
infoWindowOptions.disableAutoPan = infoDisplay == 'always';
|
85 |
+
var infoWindow = new google.maps.InfoWindow(infoWindowOptions);
|
86 |
+
if( infoDisplay == 'always') {
|
87 |
+
infoWindow.open(map, marker);
|
88 |
+
} else {
|
89 |
+
marker.addListener(infoDisplay, function() {
|
90 |
+
infoWindow.open(map, marker);
|
91 |
+
});
|
92 |
+
}
|
93 |
+
}
|
94 |
} else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
|
95 |
//try again please
|
96 |
setTimeout(geocodeMarker, Math.random() * 1000, mrkr);
|
103 |
);
|
104 |
}
|
105 |
|
|
|
106 |
var directions = $$.data('directions');
|
107 |
if ( directions ) {
|
108 |
|
126 |
avoidTolls: Boolean( directions.avoidTolls ),
|
127 |
waypoints: directions.waypoints,
|
128 |
optimizeWaypoints: Boolean( directions.optimizeWaypoints )
|
|
|
|
|
|
|
|
|
|
|
129 |
},
|
130 |
function(result, status) {
|
131 |
if (status == google.maps.DirectionsStatus.OK) {
|
133 |
}
|
134 |
});
|
135 |
}
|
136 |
+
|
137 |
+
if(Boolean( $$.data('keep-centered') )) {
|
138 |
+
var center;
|
139 |
+
google.maps.event.addDomListener(map, 'idle', function () {
|
140 |
+
center = map.getCenter();
|
141 |
+
});
|
142 |
+
google.maps.event.addDomListener(window, 'resize', function () {
|
143 |
+
map.setCenter(center);
|
144 |
+
});
|
145 |
+
}
|
146 |
}
|
147 |
else if (status == google.maps.GeocoderStatus.ZERO_RESULTS) {
|
148 |
$$.append('<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>');
|
widgets/so-google-map-widget/js/js-map.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function loadMap(a){a(".sow-google-map-canvas").each(function(){var
|
1 |
+
function loadMap(a){a(".sow-google-map-canvas").each(function(){var e=a(this),o=e.data("address");if(!o){var t=e.data("marker-positions");t&&t.length&&(o=t[0].place)}var n=new google.maps.Geocoder;n.geocode({address:o},function(a,o){if(o==google.maps.GeocoderStatus.OK){var t=Number(e.data("zoom"));t||(t=14);var i="user_map_style",r={zoom:t,scrollwheel:Boolean(e.data("scroll-zoom")),draggable:Boolean(e.data("draggable")),disableDefaultUI:Boolean(e.data("disable-ui")),center:a[0].geometry.location,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,i]}},s=new google.maps.Map(e.get(0),r),p={name:e.data("map-name")},d=e.data("map-styles");if(d){var l=new google.maps.StyledMapType(d,p);s.mapTypes.set(i,l),s.setMapTypeId(i)}Boolean(e.data("marker-at-center"))&&new google.maps.Marker({position:a[0].geometry.location,map:s,draggable:Boolean(e.data("markers-draggable")),icon:e.data("marker-icon"),title:""});var g=e.data("marker-positions");g&&g.length&&g.forEach(function(a){var o=function(){n.geocode({address:a.place},function(t,n){if(n==google.maps.GeocoderStatus.OK){var i=new google.maps.Marker({position:t[0].geometry.location,map:s,draggable:Boolean(e.data("markers-draggable")),icon:e.data("marker-icon"),title:""});if(a.hasOwnProperty("info")&&a.info){var r={content:a.info};a.hasOwnProperty("info_max_width")&&a.info_max_width&&(r.maxWidth=a.info_max_width);var p=e.data("marker-info-display");r.disableAutoPan="always"==p;var d=new google.maps.InfoWindow(r);"always"==p?d.open(s,i):i.addListener(p,function(){d.open(s,i)})}}else n==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(o,1e3*Math.random(),a)})};setTimeout(o,1e3*Math.random(),a)});var m=e.data("directions");if(m){m.waypoints&&m.waypoints.length&&m.waypoints.map(function(a){a.stopover=Boolean(a.stopover)});var c=new google.maps.DirectionsRenderer;c.setMap(s);var v=new google.maps.DirectionsService;v.route({origin:m.origin,destination:m.destination,travelMode:m.travelMode.toUpperCase(),avoidHighways:Boolean(m.avoidHighways),avoidTolls:Boolean(m.avoidTolls),waypoints:m.waypoints,optimizeWaypoints:Boolean(m.optimizeWaypoints)},function(a,e){e==google.maps.DirectionsStatus.OK&&c.setDirections(a)})}if(Boolean(e.data("keep-centered"))){var w;google.maps.event.addDomListener(s,"idle",function(){w=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(w)})}}else o==google.maps.GeocoderStatus.ZERO_RESULTS&&e.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")})})}function loadApi(a){var e=a(".sow-google-map-canvas").data("api-key"),o="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=initialize";e&&(o+="&key="+e);var t=a('<script type="text/javascript" src="'+o+'">');a("body").append(t)}function initialize(){loadMap(window.jQuery)}jQuery(function(a){window.google&&window.google.maps?loadMap(a):loadApi(a)});
|
widgets/so-google-map-widget/so-google-map-widget.php
CHANGED
@@ -16,7 +16,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
16 |
__( 'SiteOrigin Google Maps', 'siteorigin-widgets' ),
|
17 |
array(
|
18 |
'description' => __( 'A Google Maps widget.', 'siteorigin-widgets' ),
|
19 |
-
'help' => '
|
20 |
),
|
21 |
array(),
|
22 |
array(
|
@@ -89,6 +89,26 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
89 |
),
|
90 |
'label' => __( 'Draggable', 'siteorigin-widgets' ),
|
91 |
'description' => __( 'Allow dragging the map to move it around.', 'siteorigin-widgets' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
)
|
93 |
)
|
94 |
),
|
@@ -133,9 +153,28 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
133 |
'type' => 'textarea',
|
134 |
'rows' => 2,
|
135 |
'label' => __( 'Place', 'siteorigin-widgets' )
|
136 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
)
|
138 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
)
|
140 |
),
|
141 |
'styles' => array(
|
@@ -329,7 +368,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
329 |
'sow-google-map',
|
330 |
siteorigin_widget_get_plugin_dir_url( 'google-map' ) . 'js/js-map' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
331 |
array( 'jquery' ),
|
332 |
-
SOW_BUNDLE_VERSION
|
333 |
)
|
334 |
)
|
335 |
);
|
@@ -386,9 +425,12 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
386 |
'zoom' => $settings['zoom'],
|
387 |
'scroll-zoom' => $settings['scroll_zoom'],
|
388 |
'draggable' => $settings['draggable'],
|
|
|
|
|
389 |
'marker-icon' => ! empty( $mrkr_src ) ? $mrkr_src[0] : '',
|
390 |
'markers-draggable' => isset( $markers['markers_draggable'] ) ? $markers['markers_draggable'] : '',
|
391 |
-
'marker-at-center' => $markers['marker_at_center'],
|
|
|
392 |
'marker-positions' => isset( $markers['marker_positions'] ) ? json_encode( $markers['marker_positions'] ) : '',
|
393 |
'map-name' => ! empty( $styles ) ? $styles['map_name'] : '',
|
394 |
'map-styles' => ! empty( $styles ) ? json_encode( $styles['styles'] ) : '',
|
@@ -503,7 +545,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
503 |
}
|
504 |
}
|
505 |
|
506 |
-
if ( $markers['marker_at_center'] ) {
|
507 |
if ( ! empty( $markers_st ) ) {
|
508 |
$markers_st .= "|";
|
509 |
}
|
16 |
__( 'SiteOrigin Google Maps', 'siteorigin-widgets' ),
|
17 |
array(
|
18 |
'description' => __( 'A Google Maps widget.', 'siteorigin-widgets' ),
|
19 |
+
'help' => 'https://siteorigin.com/widgets-bundle/google-maps-widget/'
|
20 |
),
|
21 |
array(),
|
22 |
array(
|
89 |
),
|
90 |
'label' => __( 'Draggable', 'siteorigin-widgets' ),
|
91 |
'description' => __( 'Allow dragging the map to move it around.', 'siteorigin-widgets' )
|
92 |
+
),
|
93 |
+
'disable_default_ui' => array(
|
94 |
+
'type' => 'checkbox',
|
95 |
+
'default' => false,
|
96 |
+
'state_handler' => array(
|
97 |
+
'map_type[interactive]' => array('show'),
|
98 |
+
'_else[map_type]' => array('hide'),
|
99 |
+
),
|
100 |
+
'label' => __( 'Disable default UI', 'siteorigin-widgets' ),
|
101 |
+
'description' => __( 'Hides the default Google Maps controls.', 'siteorigin-widgets' )
|
102 |
+
),
|
103 |
+
'keep_centered' => array(
|
104 |
+
'type' => 'checkbox',
|
105 |
+
'default' => false,
|
106 |
+
'state_handler' => array(
|
107 |
+
'map_type[interactive]' => array('show'),
|
108 |
+
'_else[map_type]' => array('hide'),
|
109 |
+
),
|
110 |
+
'label' => __( 'Keep map centered', 'siteorigin-widgets' ),
|
111 |
+
'description' => __( 'Keeps the map centered when it\'s container is resized.', 'siteorigin-widgets' )
|
112 |
)
|
113 |
)
|
114 |
),
|
153 |
'type' => 'textarea',
|
154 |
'rows' => 2,
|
155 |
'label' => __( 'Place', 'siteorigin-widgets' )
|
156 |
+
),
|
157 |
+
'info' => array(
|
158 |
+
'type' => 'tinymce',
|
159 |
+
'rows' => 10,
|
160 |
+
'label' => __( 'Info Window Content', 'siteorigin-widgets' )
|
161 |
+
),
|
162 |
+
'info_max_width' => array(
|
163 |
+
'type' => 'text',
|
164 |
+
'label' => __( 'Info Window max width', 'siteorigin-widgets' )
|
165 |
+
),
|
166 |
)
|
167 |
+
),
|
168 |
+
'info_display' => array(
|
169 |
+
'type' => 'radio',
|
170 |
+
'label' => __( 'When should Info Windows be displayed?' ),
|
171 |
+
'default' => 'click',
|
172 |
+
'options' => array(
|
173 |
+
'click' => __( 'Click', 'siteorigin-widgets' ),
|
174 |
+
'mouseover' => __( 'Mouse over', 'siteorigin-widgets' ),
|
175 |
+
'always' => __( 'Always', 'siteorigin-widgets' ),
|
176 |
+
)
|
177 |
+
),
|
178 |
)
|
179 |
),
|
180 |
'styles' => array(
|
368 |
'sow-google-map',
|
369 |
siteorigin_widget_get_plugin_dir_url( 'google-map' ) . 'js/js-map' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
370 |
array( 'jquery' ),
|
371 |
+
SOW_BUNDLE_VERSION . mt_rand()
|
372 |
)
|
373 |
)
|
374 |
);
|
425 |
'zoom' => $settings['zoom'],
|
426 |
'scroll-zoom' => $settings['scroll_zoom'],
|
427 |
'draggable' => $settings['draggable'],
|
428 |
+
'disable-ui' => $settings['disable_default_ui'],
|
429 |
+
'keep-centered' => $settings['keep_centered'],
|
430 |
'marker-icon' => ! empty( $mrkr_src ) ? $mrkr_src[0] : '',
|
431 |
'markers-draggable' => isset( $markers['markers_draggable'] ) ? $markers['markers_draggable'] : '',
|
432 |
+
'marker-at-center' => !empty( $markers['marker_at_center'] ),
|
433 |
+
'marker-info-display' => $markers['info_display'],
|
434 |
'marker-positions' => isset( $markers['marker_positions'] ) ? json_encode( $markers['marker_positions'] ) : '',
|
435 |
'map-name' => ! empty( $styles ) ? $styles['map_name'] : '',
|
436 |
'map-styles' => ! empty( $styles ) ? json_encode( $styles['styles'] ) : '',
|
545 |
}
|
546 |
}
|
547 |
|
548 |
+
if ( !empty( $markers['marker_at_center'] ) ) {
|
549 |
if ( ! empty( $markers_st ) ) {
|
550 |
$markers_st .= "|";
|
551 |
}
|
widgets/so-headline-widget/so-headline-widget.php
CHANGED
@@ -15,8 +15,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
15 |
'sow-headline',
|
16 |
__( 'SiteOrigin Headline', 'siteorigin-widgets' ),
|
17 |
array(
|
18 |
-
'description' => __( 'A headline widget.', 'siteorigin-widgets' )
|
19 |
-
'help' => 'http://siteorigin.com/widgets-bundle/headline-widget-documentation/'
|
20 |
),
|
21 |
array(),
|
22 |
array(
|
15 |
'sow-headline',
|
16 |
__( 'SiteOrigin Headline', 'siteorigin-widgets' ),
|
17 |
array(
|
18 |
+
'description' => __( 'A headline widget.', 'siteorigin-widgets' )
|
|
|
19 |
),
|
20 |
array(),
|
21 |
array(
|
widgets/so-headline-widget/styles/sow-headline.less
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
.widget-function('import_google_font');
|
2 |
|
3 |
@headline_font: "Lucida Grande", sans-serif;
|
@@ -14,11 +16,6 @@
|
|
14 |
@divider_style: solid;
|
15 |
@divider_color: #EEEEEE;
|
16 |
|
17 |
-
.font(@font, @weight) when not (@font = default) {
|
18 |
-
font-family: @font;
|
19 |
-
font-weight: @weight;
|
20 |
-
}
|
21 |
-
|
22 |
#sow-headline-container.sow-headline {
|
23 |
|
24 |
h1 {
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
.widget-function('import_google_font');
|
4 |
|
5 |
@headline_font: "Lucida Grande", sans-serif;
|
16 |
@divider_style: solid;
|
17 |
@divider_color: #EEEEEE;
|
18 |
|
|
|
|
|
|
|
|
|
|
|
19 |
#sow-headline-container.sow-headline {
|
20 |
|
21 |
h1 {
|
widgets/so-hero-widget/so-hero-widget.php
CHANGED
@@ -69,6 +69,7 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
69 |
'type' => 'media',
|
70 |
'label' => __( 'Background image', 'siteorigin-widgets' ),
|
71 |
'library' => 'image',
|
|
|
72 |
),
|
73 |
|
74 |
'opacity' => array(
|
@@ -113,34 +114,46 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
113 |
'fields' => array(
|
114 |
|
115 |
'padding' => array(
|
116 |
-
'type' => '
|
117 |
-
'label' => __('
|
118 |
-
'max' => 150,
|
119 |
-
'min' => 0,
|
120 |
'default' => 50,
|
121 |
),
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
'width' => array(
|
124 |
-
'type' => '
|
125 |
-
'label' => __('Maximum
|
126 |
-
'max' => 1920,
|
127 |
-
'min' => 280,
|
128 |
'default' => 1280,
|
129 |
),
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
'heading_size' => array(
|
132 |
-
'type' => '
|
133 |
-
'label' => __('Heading
|
134 |
-
'max' => 72,
|
135 |
-
'min' => 6,
|
136 |
'default' => 38,
|
137 |
),
|
138 |
|
139 |
-
'
|
140 |
'type' => 'slider',
|
141 |
-
'label' => __('
|
142 |
-
'max' =>
|
143 |
-
'min' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
'default' => 16,
|
145 |
),
|
146 |
|
@@ -162,7 +175,7 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
-
* Get everything
|
166 |
*
|
167 |
* @param $i
|
168 |
* @param $frame
|
@@ -170,8 +183,11 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
170 |
* @return array
|
171 |
*/
|
172 |
function get_frame_background( $i, $frame ){
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
175 |
|
176 |
return array(
|
177 |
'color' => !empty( $frame['background']['color'] ) ? $frame['background']['color'] : false,
|
@@ -235,13 +251,39 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
235 |
|
236 |
// Hero specific design
|
237 |
$less['slide_padding'] = intval( $instance['design']['padding'] ) . 'px';
|
|
|
|
|
238 |
$less['slide_width'] = intval( $instance['design']['width'] ) . 'px';
|
239 |
$less['heading_size'] = intval( $instance['design']['heading_size'] ) . 'px';
|
240 |
$less['text_size'] = intval( $instance['design']['text_size'] ) . 'px';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
return $less;
|
243 |
}
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
|
247 |
siteorigin_widget_register('hero', __FILE__);
|
69 |
'type' => 'media',
|
70 |
'label' => __( 'Background image', 'siteorigin-widgets' ),
|
71 |
'library' => 'image',
|
72 |
+
'fallback' => true,
|
73 |
),
|
74 |
|
75 |
'opacity' => array(
|
114 |
'fields' => array(
|
115 |
|
116 |
'padding' => array(
|
117 |
+
'type' => 'number',
|
118 |
+
'label' => __('Top and bottom padding', 'siteorigin-widgets'),
|
|
|
|
|
119 |
'default' => 50,
|
120 |
),
|
121 |
|
122 |
+
'padding_sides' => array(
|
123 |
+
'type' => 'number',
|
124 |
+
'label' => __('Side padding', 'siteorigin-widgets'),
|
125 |
+
'default' => 20,
|
126 |
+
),
|
127 |
+
|
128 |
'width' => array(
|
129 |
+
'type' => 'number',
|
130 |
+
'label' => __('Maximum container width', 'siteorigin-widgets'),
|
|
|
|
|
131 |
'default' => 1280,
|
132 |
),
|
133 |
|
134 |
+
'heading_font' => array(
|
135 |
+
'type' => 'font',
|
136 |
+
'label' => __('Heading font', 'siteorigin-widgets'),
|
137 |
+
'default' => '',
|
138 |
+
),
|
139 |
+
|
140 |
'heading_size' => array(
|
141 |
+
'type' => 'number',
|
142 |
+
'label' => __('Heading size', 'siteorigin-widgets'),
|
|
|
|
|
143 |
'default' => 38,
|
144 |
),
|
145 |
|
146 |
+
'heading_shadow' => array(
|
147 |
'type' => 'slider',
|
148 |
+
'label' => __('Heading shadow intensity', 'siteorigin-widgets'),
|
149 |
+
'max' => 100,
|
150 |
+
'min' => 0,
|
151 |
+
'default' => 50,
|
152 |
+
),
|
153 |
+
|
154 |
+
'text_size' => array(
|
155 |
+
'type' => 'number',
|
156 |
+
'label' => __('Text size', 'siteorigin-widgets'),
|
157 |
'default' => 16,
|
158 |
),
|
159 |
|
175 |
}
|
176 |
|
177 |
/**
|
178 |
+
* Get everything necessary for the background image.
|
179 |
*
|
180 |
* @param $i
|
181 |
* @param $frame
|
183 |
* @return array
|
184 |
*/
|
185 |
function get_frame_background( $i, $frame ){
|
186 |
+
$background_image = siteorigin_widgets_get_attachment_image_src(
|
187 |
+
$frame['background']['image'],
|
188 |
+
'full',
|
189 |
+
!empty( $frame['background']['image_fallback'] ) ? $frame['background']['image_fallback'] : ''
|
190 |
+
);
|
191 |
|
192 |
return array(
|
193 |
'color' => !empty( $frame['background']['color'] ) ? $frame['background']['color'] : false,
|
251 |
|
252 |
// Hero specific design
|
253 |
$less['slide_padding'] = intval( $instance['design']['padding'] ) . 'px';
|
254 |
+
|
255 |
+
$less['slide_padding_sides'] = intval( $instance['design']['padding_sides'] ) . 'px';
|
256 |
$less['slide_width'] = intval( $instance['design']['width'] ) . 'px';
|
257 |
$less['heading_size'] = intval( $instance['design']['heading_size'] ) . 'px';
|
258 |
$less['text_size'] = intval( $instance['design']['text_size'] ) . 'px';
|
259 |
+
$less['heading_shadow'] = intval( $instance['design']['heading_shadow'] );
|
260 |
+
|
261 |
+
$font = siteorigin_widget_get_font( $instance['design']['heading_font'] );
|
262 |
+
$less['heading_font'] = $font['family'];
|
263 |
+
if ( ! empty( $font['weight'] ) ) {
|
264 |
+
$less['heading_font_weight'] = $font['weight'];
|
265 |
+
}
|
266 |
|
267 |
return $less;
|
268 |
}
|
269 |
|
270 |
+
/**
|
271 |
+
* Less function for importing Google web fonts.
|
272 |
+
*
|
273 |
+
* @param $instance
|
274 |
+
* @param $args
|
275 |
+
*
|
276 |
+
* @return string
|
277 |
+
*/
|
278 |
+
function less_import_google_font($instance, $args) {
|
279 |
+
if( empty( $instance ) ) return;
|
280 |
+
|
281 |
+
$font_import = siteorigin_widget_get_font( $instance['design']['heading_font'] );
|
282 |
+
if( !empty( $font_import['css_import'] ) ) {
|
283 |
+
return $font_import['css_import'];
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
}
|
288 |
|
289 |
siteorigin_widget_register('hero', __FILE__);
|
widgets/so-hero-widget/styles/default.less
CHANGED
@@ -1,23 +1,34 @@
|
|
|
|
|
|
|
|
|
|
1 |
@nav_color_hex: #FFFFFF;
|
2 |
@nav_size: 25;
|
3 |
|
4 |
@slide_padding: 50px;
|
|
|
5 |
@slide_width: 1280px;
|
6 |
@heading_size: 38px;
|
7 |
@text_size: 16px;
|
|
|
|
|
|
|
|
|
8 |
|
9 |
.sow-slider-base {
|
10 |
|
11 |
.sow-slider-image-wrapper {
|
12 |
-
padding
|
13 |
-
|
14 |
max-width: @slide_width;
|
15 |
|
16 |
h1,h2,h3,h4,h5,h6{
|
17 |
line-height: 1.375em;
|
18 |
color: #FFFFFF;
|
19 |
-
text-shadow: 0 2px 2px rgba(0,0,0,
|
20 |
margin: 0.1em 0;
|
|
|
|
|
21 |
}
|
22 |
|
23 |
h1 {
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
@nav_color_hex: #FFFFFF;
|
6 |
@nav_size: 25;
|
7 |
|
8 |
@slide_padding: 50px;
|
9 |
+
@slide_padding_sides: 10px;
|
10 |
@slide_width: 1280px;
|
11 |
@heading_size: 38px;
|
12 |
@text_size: 16px;
|
13 |
+
@heading_shadow: 50;
|
14 |
+
|
15 |
+
@heading_font: "Arial", sans-serif;
|
16 |
+
@heading_font_weight: 400;
|
17 |
|
18 |
.sow-slider-base {
|
19 |
|
20 |
.sow-slider-image-wrapper {
|
21 |
+
padding: @slide_padding @slide_padding_sides;
|
22 |
+
|
23 |
max-width: @slide_width;
|
24 |
|
25 |
h1,h2,h3,h4,h5,h6{
|
26 |
line-height: 1.375em;
|
27 |
color: #FFFFFF;
|
28 |
+
text-shadow: 0 2px 2px rgba( 0, 0, 0, @heading_shadow/100 );
|
29 |
margin: 0.1em 0;
|
30 |
+
|
31 |
+
.font(@heading_font, @heading_font_weight);
|
32 |
}
|
33 |
|
34 |
h1 {
|
widgets/so-image-widget/so-image-widget.php
CHANGED
@@ -13,7 +13,7 @@ class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
|
|
13 |
__('SiteOrigin Image', 'siteorigin-widgets'),
|
14 |
array(
|
15 |
'description' => __('A simple image widget with massive power.', 'siteorigin-widgets'),
|
16 |
-
'help' => '
|
17 |
),
|
18 |
array(
|
19 |
|
13 |
__('SiteOrigin Image', 'siteorigin-widgets'),
|
14 |
array(
|
15 |
'description' => __('A simple image widget with massive power.', 'siteorigin-widgets'),
|
16 |
+
'help' => 'https://siteorigin.com/widgets-bundle/image-widget-documentation/'
|
17 |
),
|
18 |
array(
|
19 |
|
widgets/so-image-widget/tpl/base.php
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
if( !empty($src) ) {
|
4 |
$attr = array(
|
5 |
'src' => $src[0],
|
6 |
-
'width' => $src[1],
|
7 |
-
'height' => $src[2],
|
8 |
-
);
|
9 |
-
}
|
10 |
-
else if( !empty( $instance['image_fallback'] ) ) {
|
11 |
-
$attr = array(
|
12 |
-
'src' => esc_url($instance['image_fallback']),
|
13 |
);
|
|
|
|
|
|
|
14 |
}
|
15 |
|
16 |
$styles = array();
|
1 |
<?php
|
2 |
+
|
3 |
+
$src = siteorigin_widgets_get_attachment_image_src(
|
4 |
+
$instance['image'],
|
5 |
+
$instance['size'],
|
6 |
+
!empty($instance['image_fallback']) ? $instance['image_fallback'] : false
|
7 |
+
);
|
8 |
+
|
9 |
if( !empty($src) ) {
|
10 |
$attr = array(
|
11 |
'src' => $src[0],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
);
|
13 |
+
|
14 |
+
if(!empty($src[1])) $attr['width'] = $src[1];
|
15 |
+
if(!empty($src[2])) $attr['height'] = $src[2];
|
16 |
}
|
17 |
|
18 |
$styles = array();
|
widgets/so-post-carousel-widget/so-post-carousel-widget.php
CHANGED
@@ -57,7 +57,7 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
|
|
57 |
__('SiteOrigin Post Carousel', 'siteorigin-widgets'),
|
58 |
array(
|
59 |
'description' => __('Display your posts as a carousel.', 'siteorigin-widgets'),
|
60 |
-
'help' => '
|
61 |
),
|
62 |
array(
|
63 |
|
57 |
__('SiteOrigin Post Carousel', 'siteorigin-widgets'),
|
58 |
array(
|
59 |
'description' => __('Display your posts as a carousel.', 'siteorigin-widgets'),
|
60 |
+
'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'
|
61 |
),
|
62 |
array(
|
63 |
|
widgets/so-price-table-widget/so-price-table-widget.php
CHANGED
@@ -14,7 +14,7 @@ class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
|
|
14 |
__('SiteOrigin Price Table', 'siteorigin-widgets'),
|
15 |
array(
|
16 |
'description' => __('A simple Price Table.', 'siteorigin-widgets'),
|
17 |
-
'help' => '
|
18 |
),
|
19 |
array(
|
20 |
|
14 |
__('SiteOrigin Price Table', 'siteorigin-widgets'),
|
15 |
array(
|
16 |
'description' => __('A simple Price Table.', 'siteorigin-widgets'),
|
17 |
+
'help' => 'https://siteorigin.com/widgets-bundle/price-table-widget/'
|
18 |
),
|
19 |
array(
|
20 |
|
widgets/so-slider-widget/so-slider-widget.php
CHANGED
@@ -15,7 +15,7 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
15 |
__('SiteOrigin Slider', 'siteorigin-widgets'),
|
16 |
array(
|
17 |
'description' => __('A responsive slider widget that supports images and video.', 'siteorigin-widgets'),
|
18 |
-
'help' => '
|
19 |
'panels_title' => false,
|
20 |
),
|
21 |
array(
|
@@ -48,6 +48,7 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
48 |
'type' => 'media',
|
49 |
'library' => 'image',
|
50 |
'label' => __('Background image', 'siteorigin-widgets'),
|
|
|
51 |
),
|
52 |
|
53 |
'background_color' => array(
|
@@ -69,6 +70,7 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
69 |
'type' => 'media',
|
70 |
'library' => 'image',
|
71 |
'label' => __('Foreground image', 'siteorigin-widgets'),
|
|
|
72 |
),
|
73 |
|
74 |
'url' => array(
|
@@ -94,8 +96,11 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
94 |
}
|
95 |
|
96 |
function get_frame_background( $i, $frame ){
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
99 |
|
100 |
return array(
|
101 |
'color' => !empty( $frame['background_color'] ) ? $frame['background_color'] : '#a0a0a0',
|
@@ -118,14 +123,19 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
118 |
}
|
119 |
}
|
120 |
|
121 |
-
|
122 |
-
$
|
|
|
|
|
|
|
|
|
|
|
123 |
?>
|
124 |
<div class="sow-slider-image-container">
|
125 |
<div class="sow-slider-image-wrapper" style="<?php if(!empty($foreground_image[1])) echo 'max-width: ' . intval($foreground_image[1]) . 'px' ?>">
|
126 |
<?php
|
127 |
if(!empty($frame['url'])) echo '<a href="' . sow_esc_url($frame['url']) . '">';
|
128 |
-
echo
|
129 |
if(!empty($frame['url'])) echo '</a>';
|
130 |
?>
|
131 |
</div>
|
@@ -137,7 +147,11 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
137 |
if(!empty($frame['url'])) echo '<a href="' . sow_esc_url($frame['url']) . '" ' . ( !empty($frame['new_window']) ? 'target="_blank"' : '' ) . '>';
|
138 |
|
139 |
// Lets use the background image
|
140 |
-
echo
|
|
|
|
|
|
|
|
|
141 |
|
142 |
if( !empty($frame['url']) ) echo '</a>';
|
143 |
}
|
15 |
__('SiteOrigin Slider', 'siteorigin-widgets'),
|
16 |
array(
|
17 |
'description' => __('A responsive slider widget that supports images and video.', 'siteorigin-widgets'),
|
18 |
+
'help' => 'https://siteorigin.com/widgets-bundle/slider-widget-documentation/',
|
19 |
'panels_title' => false,
|
20 |
),
|
21 |
array(
|
48 |
'type' => 'media',
|
49 |
'library' => 'image',
|
50 |
'label' => __('Background image', 'siteorigin-widgets'),
|
51 |
+
'fallback' => true,
|
52 |
),
|
53 |
|
54 |
'background_color' => array(
|
70 |
'type' => 'media',
|
71 |
'library' => 'image',
|
72 |
'label' => __('Foreground image', 'siteorigin-widgets'),
|
73 |
+
'fallback' => true,
|
74 |
),
|
75 |
|
76 |
'url' => array(
|
96 |
}
|
97 |
|
98 |
function get_frame_background( $i, $frame ){
|
99 |
+
$background_image = siteorigin_widgets_get_attachment_image_src(
|
100 |
+
$frame['background_image'],
|
101 |
+
'full',
|
102 |
+
!empty( $frame['background_image_fallback'] ) ? $frame['background_image_fallback'] : ''
|
103 |
+
);
|
104 |
|
105 |
return array(
|
106 |
'color' => !empty( $frame['background_color'] ) ? $frame['background_color'] : '#a0a0a0',
|
123 |
}
|
124 |
}
|
125 |
|
126 |
+
$foreground_image = siteorigin_widgets_get_attachment_image(
|
127 |
+
$frame['foreground_image'],
|
128 |
+
'full',
|
129 |
+
!empty( $frame['foreground_image_fallback'] ) ? $frame['foreground_image_fallback'] : ''
|
130 |
+
);
|
131 |
+
|
132 |
+
if( !empty($foreground_image) ) {
|
133 |
?>
|
134 |
<div class="sow-slider-image-container">
|
135 |
<div class="sow-slider-image-wrapper" style="<?php if(!empty($foreground_image[1])) echo 'max-width: ' . intval($foreground_image[1]) . 'px' ?>">
|
136 |
<?php
|
137 |
if(!empty($frame['url'])) echo '<a href="' . sow_esc_url($frame['url']) . '">';
|
138 |
+
echo $foreground_image;
|
139 |
if(!empty($frame['url'])) echo '</a>';
|
140 |
?>
|
141 |
</div>
|
147 |
if(!empty($frame['url'])) echo '<a href="' . sow_esc_url($frame['url']) . '" ' . ( !empty($frame['new_window']) ? 'target="_blank"' : '' ) . '>';
|
148 |
|
149 |
// Lets use the background image
|
150 |
+
echo siteorigin_widgets_get_attachment_image(
|
151 |
+
$frame['background_image'],
|
152 |
+
'full',
|
153 |
+
!empty( $frame['background_image_fallback'] ) ? $frame['background_image_fallback'] : ''
|
154 |
+
);
|
155 |
|
156 |
if( !empty($frame['url']) ) echo '</a>';
|
157 |
}
|
widgets/so-social-media-buttons-widget/so-social-media-buttons-widget.php
CHANGED
@@ -25,8 +25,7 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
|
|
25 |
'sow-social-media-buttons',
|
26 |
__( 'SiteOrigin Social Media Buttons', 'siteorigin-widgets' ),
|
27 |
array(
|
28 |
-
'description' => __( 'A social media buttons widget.', 'siteorigin-widgets' )
|
29 |
-
'help' => 'http://siteorigin.com/widgets-bundle/social-media-buttons-widget-documentation/'
|
30 |
),
|
31 |
array(),
|
32 |
array(
|
25 |
'sow-social-media-buttons',
|
26 |
__( 'SiteOrigin Social Media Buttons', 'siteorigin-widgets' ),
|
27 |
array(
|
28 |
+
'description' => __( 'A social media buttons widget.', 'siteorigin-widgets' )
|
|
|
29 |
),
|
30 |
array(),
|
31 |
array(
|