Version Description
- 31 January 2017 =
- Introduced compatibility system.
- Added compatibility with Elementor and Beaver Builder.
- Ensure radio inputs in repeaters have their checked property set correctly.
- Various Call to Action widget improvements.
- Use
text-align: center;
for features icons. - Always use HTTPS for Google Webfonts.
- Post Selector: Exclude current post id
- Post Selector: Add filter returned query
- Post Carousel: Prevent empty title output.
- Google Maps: Add ability to set link for Static Map.
- Social Links: Add title field and title attributes for links.
- Features: Add title text field for features
- Button Widget: Add Font setting
- Contact: Add radio field Type
- Taxonomy: New Window Setting
- Added a way of specifying post types for link field.
- Introduced a global widget setup action.
Download this release
Release Info
Developer | gpriday |
Plugin | SiteOrigin Widgets Bundle |
Version | 1.8 |
Comparing to | |
See all releases |
Code changes from version 1.7.2 to 1.8
- base/base.php +2 -2
- base/inc/actions.php +8 -2
- base/inc/fields/css/icon-field.css +2 -3
- base/inc/fields/css/media-field.css +1 -1
- base/inc/fields/icon.class.php +1 -1
- base/inc/fields/js/tinymce-field.js +19 -9
- base/inc/fields/js/tinymce-field.min.js +1 -1
- base/inc/fields/link.class.php +16 -7
- base/inc/fields/media.class.php +5 -0
- base/inc/fields/radio.class.php +5 -4
- base/inc/lessc.inc.php +1 -1
- base/inc/post-selector.php +7 -2
- base/inc/widget-manager.class.php +1 -0
- base/js/admin.js +62 -8
- base/js/admin.min.js +1 -1
- base/siteorigin-widget.class.php +41 -14
- compat/beaver-builder/beaver-builder.php +97 -0
- compat/beaver-builder/sowb-beaver-builder.js +114 -0
- compat/beaver-builder/sowb-beaver-builder.min.js +1 -0
- compat/beaver-builder/styles.css +190 -0
- compat/builders.php +11 -0
- compat/compat.php +51 -0
- compat/elementor/elementor.php +102 -0
- compat/elementor/styles.css +225 -0
- js/slider/jquery.slider.js +243 -231
- js/slider/jquery.slider.min.js +1 -1
- readme.txt +23 -3
- so-widgets-bundle.php +6 -2
- widgets/button/button.php +22 -1
- widgets/button/styles/atom.less +6 -0
- widgets/button/styles/flat.less +6 -0
- widgets/button/styles/wire.less +6 -0
- widgets/contact/contact.php +4 -3
- widgets/contact/fields/checkboxes.class.php +13 -13
- widgets/contact/fields/radio.class.php +19 -0
- widgets/contact/styles/default.less +1 -1
- widgets/cta/css/style.css +4 -4
- widgets/cta/cta.php +10 -0
- widgets/cta/styles/default.less +15 -2
- widgets/cta/tpl/default.php +3 -3
- widgets/features/css/style.css +1 -3
- widgets/features/features.php +5 -0
- widgets/features/tpl/default.php +50 -47
- widgets/google-map/google-map.php +23 -4
- widgets/google-map/js/js-map.js +73 -47
- widgets/google-map/js/js-map.min.js +1 -1
- widgets/google-map/tpl/static-map.php +7 -0
- widgets/headline/headline.php +32 -0
- widgets/headline/styles/default.less +16 -0
- widgets/headline/tpl/default.php +20 -2
- widgets/image-grid/js/image-grid.js +38 -32
- widgets/image-grid/js/image-grid.min.js +1 -1
- widgets/image/image.php +12 -1
- widgets/layout-slider/layout-slider.php +13 -0
- widgets/post-carousel/tpl/base.php +2 -2
- widgets/simple-masonry/js/simple-masonry.js +71 -65
- widgets/simple-masonry/js/simple-masonry.min.js +1 -1
- widgets/simple-masonry/simple-masonry.php +1 -1
- widgets/simple-masonry/tpl/default.php +29 -17
- widgets/social-media-buttons/js/social-media-buttons-admin.js +13 -11
- widgets/social-media-buttons/js/social-media-buttons-admin.min.js +1 -1
- widgets/social-media-buttons/social-media-buttons.php +8 -0
- widgets/social-media-buttons/tpl/default.php +3 -1
- widgets/taxonomy/taxonomy.php +6 -0
- widgets/taxonomy/tpl/default.php +1 -2
- widgets/video/js/so-video-widget.js +11 -4
- widgets/video/js/so-video-widget.min.js +1 -1
- widgets/video/video.php +18 -16
base/base.php
CHANGED
@@ -105,7 +105,7 @@ function siteorigin_widget_get_font($font_value) {
|
|
105 |
$font['weight'] = $font_parts[1];
|
106 |
$font_url_param .= ':' . $font_parts[1];
|
107 |
}
|
108 |
-
$font['css_import'] = '@import url(
|
109 |
}
|
110 |
else {
|
111 |
$font['family'] = $font_value;
|
@@ -232,4 +232,4 @@ function siteorigin_widgets_get_measurements_list() {
|
|
232 |
|
233 |
// Allow themes and plugins to trim or enhance the list.
|
234 |
return apply_filters('siteorigin_widgets_get_measurements_list', $measurements);
|
235 |
-
}
|
105 |
$font['weight'] = $font_parts[1];
|
106 |
$font_url_param .= ':' . $font_parts[1];
|
107 |
}
|
108 |
+
$font['css_import'] = '@import url(https://fonts.googleapis.com/css?family=' . $font_url_param . ');';
|
109 |
}
|
110 |
else {
|
111 |
$font['family'] = $font_value;
|
232 |
|
233 |
// Allow themes and plugins to trim or enhance the list.
|
234 |
return apply_filters('siteorigin_widgets_get_measurements_list', $measurements);
|
235 |
+
}
|
base/inc/actions.php
CHANGED
@@ -65,9 +65,15 @@ function siteorigin_widget_search_posts_action(){
|
|
65 |
|
66 |
// Get all public post types, besides attachments
|
67 |
$post_types = (array) get_post_types( array(
|
68 |
-
'public'
|
|
|
69 |
) );
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
$post_types = apply_filters( 'siteorigin_widgets_search_posts_post_types', $post_types );
|
73 |
|
65 |
|
66 |
// Get all public post types, besides attachments
|
67 |
$post_types = (array) get_post_types( array(
|
68 |
+
'public' => true,
|
69 |
+
'publicly_queryable' => true
|
70 |
) );
|
71 |
+
|
72 |
+
if ( ! empty( $_REQUEST['postTypes'] ) ) {
|
73 |
+
$post_types = array_intersect( explode( ',', $_REQUEST['postTypes'] ), $post_types );
|
74 |
+
} else {
|
75 |
+
unset( $post_types['attachment'] );
|
76 |
+
}
|
77 |
|
78 |
$post_types = apply_filters( 'siteorigin_widgets_search_posts_post_types', $post_types );
|
79 |
|
base/inc/fields/css/icon-field.css
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
-webkit-border-radius: 3px;
|
13 |
-moz-border-radius: 3px;
|
14 |
border-radius: 3px;
|
15 |
-
|
16 |
border: 1px solid #bbbbbb;
|
17 |
height: 35px;
|
18 |
}
|
@@ -59,9 +59,8 @@
|
|
59 |
}
|
60 |
.siteorigin-widget-form .siteorigin-widget-field-type-icon .so-icon-remove {
|
61 |
cursor: pointer;
|
62 |
-
display: block;
|
63 |
text-decoration: none;
|
64 |
-
float: left;
|
65 |
color: #AAA;
|
66 |
font-size: 11px;
|
67 |
line-height: 1em;
|
12 |
-webkit-border-radius: 3px;
|
13 |
-moz-border-radius: 3px;
|
14 |
border-radius: 3px;
|
15 |
+
vertical-align: middle;
|
16 |
border: 1px solid #bbbbbb;
|
17 |
height: 35px;
|
18 |
}
|
59 |
}
|
60 |
.siteorigin-widget-form .siteorigin-widget-field-type-icon .so-icon-remove {
|
61 |
cursor: pointer;
|
62 |
+
display: inline-block;
|
63 |
text-decoration: none;
|
|
|
64 |
color: #AAA;
|
65 |
font-size: 11px;
|
66 |
line-height: 1em;
|
base/inc/fields/css/media-field.css
CHANGED
@@ -118,7 +118,7 @@
|
|
118 |
padding: 4px 8px;
|
119 |
margin-top: 2px !important;
|
120 |
margin-left: 25px !important;
|
121 |
-
width: 320px
|
122 |
}
|
123 |
#so-widgets-image-search-frame {
|
124 |
position: absolute;
|
118 |
padding: 4px 8px;
|
119 |
margin-top: 2px !important;
|
120 |
margin-left: 25px !important;
|
121 |
+
max-width: 320px;
|
122 |
}
|
123 |
#so-widgets-image-search-frame {
|
124 |
position: absolute;
|
base/inc/fields/icon.class.php
CHANGED
@@ -18,7 +18,7 @@ class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
|
|
18 |
<label><?php _e('Choose Icon', 'so-widgets-bundle') ?></label>
|
19 |
</div>
|
20 |
|
21 |
-
<a class="so-icon-remove" style="display: <?php echo !empty( $value ) ? 'block' : 'none' ?>;"><?php esc_html_e( 'Remove', 'so-widgets-bundle' ) ?></a>
|
22 |
|
23 |
<div class="clear"></div>
|
24 |
|
18 |
<label><?php _e('Choose Icon', 'so-widgets-bundle') ?></label>
|
19 |
</div>
|
20 |
|
21 |
+
<a class="so-icon-remove" style="display: <?php echo !empty( $value ) ? 'inline-block' : 'none' ?>;"><?php esc_html_e( 'Remove', 'so-widgets-bundle' ) ?></a>
|
22 |
|
23 |
<div class="clear"></div>
|
24 |
|
base/inc/fields/js/tinymce-field.js
CHANGED
@@ -21,9 +21,9 @@
|
|
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
|
25 |
var fieldName = /[a-zA-Z0-9\-]+(?:\[[a-zA-Z0-9]+\])?\[(.*)\]/.exec(name)[1];
|
26 |
-
var idPattern = new RegExp('widget-' + widgetIdBase + '
|
27 |
for (var initId in tinyMCEPreInit.mceInit) {
|
28 |
if (initId.match(idPattern)) {
|
29 |
mceSettings = $.extend({}, tinyMCEPreInit.mceInit[initId], mceSettings);
|
@@ -50,11 +50,6 @@
|
|
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;
|
@@ -81,10 +76,25 @@
|
|
81 |
quicktags(tinyMCEPreInit.qtInit[id]);
|
82 |
|
83 |
$(this).on( 'click', function(event) {
|
84 |
-
|
85 |
var $target = $(event.target);
|
86 |
if ( $target.hasClass( 'wp-switch-editor' ) ) {
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
$(this).find('+ .siteorigin-widget-tinymce-selected-editor').val(mode);
|
89 |
}
|
90 |
});
|
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);
|
50 |
}
|
51 |
}
|
52 |
);
|
|
|
|
|
|
|
|
|
|
|
53 |
};
|
54 |
mceSettings = $.extend({}, mceSettings, {selector: '#' + id, setup: setupEditor});
|
55 |
tinyMCEPreInit.mceInit[id] = mceSettings;
|
76 |
quicktags(tinyMCEPreInit.qtInit[id]);
|
77 |
|
78 |
$(this).on( 'click', function(event) {
|
79 |
+
|
80 |
var $target = $(event.target);
|
81 |
if ( $target.hasClass( 'wp-switch-editor' ) ) {
|
82 |
+
mode = $target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
|
83 |
+
if ( mode == 'tmce') {
|
84 |
+
// Quick bit of sanitization to prevent catastrophic backtracking in TinyMCE HTML parser regex
|
85 |
+
var editor = tinymce.get(id);
|
86 |
+
if (editor != null) {
|
87 |
+
var content = $textarea.val();
|
88 |
+
if (content.search('<') != -1) {
|
89 |
+
if (content.search('>') == -1) {
|
90 |
+
content = content.replace(/</g, '');
|
91 |
+
$textarea.val(content);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
editor.setContent(window.switchEditors.wpautop(content));
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
$(this).find('+ .siteorigin-widget-tinymce-selected-editor').val(mode);
|
99 |
}
|
100 |
});
|
base/inc/fields/js/tinymce-field.min.js
CHANGED
@@ -1 +1 @@
|
|
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"),
|
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"),a=r.attr("id");if("undefined"!=typeof tinymce){if(a.indexOf("__i__")>-1)return;var o=n.data("mceSettings"),s=n.data("widgetIdBase"),d=r.attr("name").replace(/\[\d*\]/g,""),c=/[a-zA-Z0-9\-]+(?:\[[a-zA-Z0-9]+\])?\[(.*)\]/.exec(d)[1],f=new RegExp("widget-"+s+"-?.*-"+c.replace(/\]\[/g,"-")+"[-d]*");for(var m in tinyMCEPreInit.mceInit)m.match(f)&&(o=e.extend({},tinyMCEPreInit.mceInit[m],o));var g,l=tinymce.get(a);null!=l&&(g=l.getContent(),l.remove());var u=function(e){e.on("change",function(){tinymce.get(a).save(),r.trigger("change"),r.val(window.switchEditors.pre_wpautop(e.getContent()))}),e.on("init",function(){g&&e.setContent(g)})};o=e.extend({},o,{selector:"#"+a,setup:u}),tinyMCEPreInit.mceInit[a]=o;var y=n.find("div#wp-"+a+"-wrap");if(y.hasClass("tmce-active"))if(e("#"+a).is(":visible"))tinymce.init(tinyMCEPreInit.mceInit[a]);else var p=setInterval(function(){e("#"+a).is(":visible")&&(tinymce.init(tinyMCEPreInit.mceInit[a]),clearInterval(p))},500)}var I=n.data("qtSettings");I=e.extend({},tinyMCEPreInit.qtInit["siteorigin-widget-input-tinymce-field"],I,{id:a}),tinyMCEPreInit.qtInit[a]=I,n.find(".quicktags-toolbar").remove(),quicktags(tinyMCEPreInit.qtInit[a]),e(this).on("click",function(t){var i=e(t.target);if(i.hasClass("wp-switch-editor")){if(mode=i.hasClass("switch-tmce")?"tmce":"html","tmce"==mode){var n=tinymce.get(a);if(null!=n){var o=r.val();o.search("<")!=-1&&o.search(">")==-1&&(o=o.replace(/</g,""),r.val(o)),n.setContent(window.switchEditors.wpautop(o))}}e(this).find("+ .siteorigin-widget-tinymce-selected-editor").val(mode)}})}),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/link.class.php
CHANGED
@@ -5,19 +5,28 @@
|
|
5 |
*/
|
6 |
class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Base {
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
protected function render_before_field( $value, $instance ) {
|
9 |
parent::render_before_field( $value, $instance );
|
10 |
?>
|
11 |
-
<a href="#" class="select-content-button button-
|
12 |
<div class="existing-content-selector">
|
13 |
|
14 |
<input type="text" class="content-text-search"
|
15 |
-
|
|
|
16 |
|
17 |
<ul class="posts"></ul>
|
18 |
|
19 |
<div class="buttons">
|
20 |
-
<a href="#" class="button-close button
|
21 |
</div>
|
22 |
</div>
|
23 |
<div class="url-input-wrapper">
|
@@ -33,14 +42,14 @@ class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Ba
|
|
33 |
|
34 |
protected function sanitize_field_input( $value, $instance ) {
|
35 |
$sanitized_value = trim( $value );
|
36 |
-
if( preg_match( '/^post\: *([0-9]+)/', $sanitized_value, $matches ) ) {
|
37 |
$sanitized_value = 'post: ' . $matches[1];
|
38 |
-
}
|
39 |
-
else {
|
40 |
$sanitized_value = sow_esc_url_raw( $sanitized_value );
|
41 |
}
|
|
|
42 |
return $sanitized_value;
|
43 |
}
|
44 |
|
45 |
|
46 |
-
}
|
5 |
*/
|
6 |
class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Base {
|
7 |
|
8 |
+
/**
|
9 |
+
* An array of post types to use in the query for posts when the 'Select Content' button is clicked.
|
10 |
+
*
|
11 |
+
* @access protected
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
protected $post_types;
|
15 |
+
|
16 |
protected function render_before_field( $value, $instance ) {
|
17 |
parent::render_before_field( $value, $instance );
|
18 |
?>
|
19 |
+
<a href="#" class="select-content-button button button-small"><?php esc_html_e('Select Content', 'so-widgets-bundle') ?></a>
|
20 |
<div class="existing-content-selector">
|
21 |
|
22 |
<input type="text" class="content-text-search"
|
23 |
+
data-post-types="<?php echo esc_attr( implode( ',', $this->post_types ) ) ?>"
|
24 |
+
placeholder="<?php esc_attr_e( 'Search Content', 'so-widgets-bundle' ) ?>"/>
|
25 |
|
26 |
<ul class="posts"></ul>
|
27 |
|
28 |
<div class="buttons">
|
29 |
+
<a href="#" class="button-close button"><?php esc_html_e('Close', 'so-widgets-bundle') ?></a>
|
30 |
</div>
|
31 |
</div>
|
32 |
<div class="url-input-wrapper">
|
42 |
|
43 |
protected function sanitize_field_input( $value, $instance ) {
|
44 |
$sanitized_value = trim( $value );
|
45 |
+
if ( preg_match( '/^post\: *([0-9]+)/', $sanitized_value, $matches ) ) {
|
46 |
$sanitized_value = 'post: ' . $matches[1];
|
47 |
+
} else {
|
|
|
48 |
$sanitized_value = sow_esc_url_raw( $sanitized_value );
|
49 |
}
|
50 |
+
|
51 |
return $sanitized_value;
|
52 |
}
|
53 |
|
54 |
|
55 |
+
}
|
base/inc/fields/media.class.php
CHANGED
@@ -83,6 +83,11 @@ class SiteOrigin_Widget_Field_Media extends SiteOrigin_Widget_Field_Base {
|
|
83 |
else{
|
84 |
$src = array( '', 0, 0 );
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
86 |
?>
|
87 |
<div class="media-field-wrapper">
|
88 |
<div class="current">
|
83 |
else{
|
84 |
$src = array( '', 0, 0 );
|
85 |
}
|
86 |
+
|
87 |
+
// If library is set to all, convert it to a wildcard as all isn't valid
|
88 |
+
if( $this->library == 'all' ){
|
89 |
+
$this->library = '*';
|
90 |
+
}
|
91 |
?>
|
92 |
<div class="media-field-wrapper">
|
93 |
<div class="current">
|
base/inc/fields/radio.class.php
CHANGED
@@ -14,15 +14,16 @@ class SiteOrigin_Widget_Field_Radio extends SiteOrigin_Widget_Field_Base {
|
|
14 |
|
15 |
protected function render_field( $value, $instance ) {
|
16 |
if ( ! isset( $this->options ) || empty( $this->options ) ) return;
|
17 |
-
|
18 |
foreach( $this->options as $k => $v ) {
|
19 |
?>
|
20 |
-
<label for="<?php echo esc_attr( $this->element_id . '-' . $
|
21 |
<input type="radio" name="<?php echo esc_attr( $this->element_name ) ?>"
|
22 |
-
id="<?php echo esc_attr( $this->element_id . '-' . $
|
23 |
value="<?php echo esc_attr( $k ) ?>" <?php checked( $k, $value ) ?>> <?php echo esc_html( $v ) ?>
|
24 |
</label>
|
25 |
<?php
|
|
|
26 |
}
|
27 |
}
|
28 |
|
@@ -33,4 +34,4 @@ class SiteOrigin_Widget_Field_Radio extends SiteOrigin_Widget_Field_Base {
|
|
33 |
return $sanitized_value;
|
34 |
}
|
35 |
|
36 |
-
}
|
14 |
|
15 |
protected function render_field( $value, $instance ) {
|
16 |
if ( ! isset( $this->options ) || empty( $this->options ) ) return;
|
17 |
+
$i = 0;
|
18 |
foreach( $this->options as $k => $v ) {
|
19 |
?>
|
20 |
+
<label for="<?php echo esc_attr( $this->element_id . '-' . $i ) ?>">
|
21 |
<input type="radio" name="<?php echo esc_attr( $this->element_name ) ?>"
|
22 |
+
id="<?php echo esc_attr( $this->element_id . '-' . $i ) ?>" class="siteorigin-widget-input"
|
23 |
value="<?php echo esc_attr( $k ) ?>" <?php checked( $k, $value ) ?>> <?php echo esc_html( $v ) ?>
|
24 |
</label>
|
25 |
<?php
|
26 |
+
$i += 1;
|
27 |
}
|
28 |
}
|
29 |
|
34 |
return $sanitized_value;
|
35 |
}
|
36 |
|
37 |
+
}
|
base/inc/lessc.inc.php
CHANGED
@@ -51,7 +51,7 @@ class lessc {
|
|
51 |
public $parentSelector = '&';
|
52 |
|
53 |
public $importDisabled = false;
|
54 |
-
public $importDir =
|
55 |
|
56 |
protected $numberPrecision = null;
|
57 |
|
51 |
public $parentSelector = '&';
|
52 |
|
53 |
public $importDisabled = false;
|
54 |
+
public $importDir = array();
|
55 |
|
56 |
protected $numberPrecision = null;
|
57 |
|
base/inc/post-selector.php
CHANGED
@@ -93,6 +93,11 @@ function siteorigin_widget_post_selector_process_query($query){
|
|
93 |
}
|
94 |
unset( $query['sticky'] );
|
95 |
}
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
if ( ! empty( $query['additional'] ) ) {
|
98 |
$query = wp_parse_args( $query['additional'], $query );
|
@@ -105,7 +110,7 @@ function siteorigin_widget_post_selector_process_query($query){
|
|
105 |
}
|
106 |
}
|
107 |
|
108 |
-
return $query;
|
109 |
}
|
110 |
|
111 |
function siteorigin_widget_post_selector_form_fields(){
|
@@ -128,7 +133,7 @@ function siteorigin_widget_post_selector_form_fields(){
|
|
128 |
$return['post__in'] = '';
|
129 |
$return['post__in'] .= '<label><span>' . __('Post in', 'so-widgets-bundle') . '</span>';
|
130 |
$return['post__in'] .= '<input type="text" name="post__in" class="" />';
|
131 |
-
$return['post__in'] .= ' <a href="#" class="sow-select-posts button button-
|
132 |
$return['post__in'] .= '</label>';
|
133 |
|
134 |
// The taxonomy field
|
93 |
}
|
94 |
unset( $query['sticky'] );
|
95 |
}
|
96 |
+
|
97 |
+
// Exclude the current post (if applicable) to avoid any issues associated with showing the same post again
|
98 |
+
if( get_the_id() != false ){
|
99 |
+
$query['post__not_in'][] = get_the_id();
|
100 |
+
}
|
101 |
|
102 |
if ( ! empty( $query['additional'] ) ) {
|
103 |
$query = wp_parse_args( $query['additional'], $query );
|
110 |
}
|
111 |
}
|
112 |
|
113 |
+
return apply_filters( 'siteorigin_widgets_posts_selector_query', $query );
|
114 |
}
|
115 |
|
116 |
function siteorigin_widget_post_selector_form_fields(){
|
133 |
$return['post__in'] = '';
|
134 |
$return['post__in'] .= '<label><span>' . __('Post in', 'so-widgets-bundle') . '</span>';
|
135 |
$return['post__in'] .= '<input type="text" name="post__in" class="" />';
|
136 |
+
$return['post__in'] .= ' <a href="#" class="sow-select-posts button button-small">' . __('Select posts', 'so-widgets-bundle') . '</a>';
|
137 |
$return['post__in'] .= '</label>';
|
138 |
|
139 |
// The taxonomy field
|
base/inc/widget-manager.class.php
CHANGED
@@ -117,6 +117,7 @@ class SiteOrigin_Widgets_Widget_Manager {
|
|
117 |
* @return mixed
|
118 |
*/
|
119 |
function get_class_from_path( $path ) {
|
|
|
120 |
foreach( $this->registered as $id => $r ) {
|
121 |
if( $r->path == $path ) return $r->class;
|
122 |
}
|
117 |
* @return mixed
|
118 |
*/
|
119 |
function get_class_from_path( $path ) {
|
120 |
+
$path = realpath( $path );
|
121 |
foreach( $this->registered as $id => $r ) {
|
122 |
if( $r->path == $path ) return $r->class;
|
123 |
}
|
base/js/admin.js
CHANGED
@@ -175,7 +175,13 @@
|
|
175 |
$el.find('.siteorigin-widget-field-repeater-item').sowSetupRepeaterItems();
|
176 |
|
177 |
// Set up any color fields
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
///////////////////////////////////////
|
181 |
// Handle the sections
|
@@ -203,6 +209,7 @@
|
|
203 |
value: parseInt( $input.val() ),
|
204 |
slide: function( event, ui ) {
|
205 |
$input.val( parseInt(ui.value) );
|
|
|
206 |
$$.find('.siteorigin-widget-slider-value').html( ui.value );
|
207 |
}
|
208 |
});
|
@@ -221,12 +228,14 @@
|
|
221 |
request.abort();
|
222 |
}
|
223 |
|
224 |
-
var
|
|
|
|
|
225 |
|
226 |
var $ul = $$.find('ul.posts').empty().addClass('loading');
|
227 |
$.get(
|
228 |
soWidgets.ajaxurl,
|
229 |
-
{ action: 'so_widgets_search_posts', query: query },
|
230 |
function(data){
|
231 |
for( var i = 0; i < data.length; i++ ) {
|
232 |
if( data[i].post_title === '' ) {
|
@@ -521,6 +530,16 @@
|
|
521 |
$in.attr('name', newName);
|
522 |
}
|
523 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
|
525 |
//Setup scrolling.
|
526 |
var scrollCount = $el.data('scroll-count') ? parseInt($el.data('scroll-count')) : 0;
|
@@ -704,11 +723,46 @@
|
|
704 |
}
|
705 |
}
|
706 |
if(id) {
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
712 |
$inputElement.attr('id', newId);
|
713 |
$copyItem.find('label[for=' + id + ']').attr('for', newId);
|
714 |
$copyItem.find('[id*=' + id + ']').each(function() {
|
175 |
$el.find('.siteorigin-widget-field-repeater-item').sowSetupRepeaterItems();
|
176 |
|
177 |
// Set up any color fields
|
178 |
+
$fields.find('> .siteorigin-widget-input-color').wpColorPicker( {
|
179 |
+
change: function(event, ui) {
|
180 |
+
setTimeout(function() {
|
181 |
+
$(event.target).trigger('change');
|
182 |
+
}, 100);
|
183 |
+
}
|
184 |
+
} );
|
185 |
|
186 |
///////////////////////////////////////
|
187 |
// Handle the sections
|
209 |
value: parseInt( $input.val() ),
|
210 |
slide: function( event, ui ) {
|
211 |
$input.val( parseInt(ui.value) );
|
212 |
+
$input.trigger( 'change' );
|
213 |
$$.find('.siteorigin-widget-slider-value').html( ui.value );
|
214 |
}
|
215 |
});
|
228 |
request.abort();
|
229 |
}
|
230 |
|
231 |
+
var $contentSearchInput = $$.find('.content-text-search');
|
232 |
+
var query = $contentSearchInput.val();
|
233 |
+
var postTypes = $contentSearchInput.data('postTypes');
|
234 |
|
235 |
var $ul = $$.find('ul.posts').empty().addClass('loading');
|
236 |
$.get(
|
237 |
soWidgets.ajaxurl,
|
238 |
+
{ action: 'so_widgets_search_posts', query: query, postTypes: postTypes },
|
239 |
function(data){
|
240 |
for( var i = 0; i < data.length; i++ ) {
|
241 |
if( data[i].post_title === '' ) {
|
530 |
$in.attr('name', newName);
|
531 |
}
|
532 |
});
|
533 |
+
|
534 |
+
if( ! $$.data('initialSetup') ) {
|
535 |
+
// Setup default checked values, now that we've updated input names.
|
536 |
+
// Without this radio inputs in repeaters will be rendered as if they all belong to the same group.
|
537 |
+
$$.find('.siteorigin-widget-input').each(function(i, input) {
|
538 |
+
var $in = $(input);
|
539 |
+
$in.prop('checked', $in.prop('defaultChecked'));
|
540 |
+
});
|
541 |
+
$$.data('initialSetup', true);
|
542 |
+
}
|
543 |
|
544 |
//Setup scrolling.
|
545 |
var scrollCount = $el.data('scroll-count') ? parseInt($el.data('scroll-count')) : 0;
|
723 |
}
|
724 |
}
|
725 |
if(id) {
|
726 |
+
var idRegExp;
|
727 |
+
var idBase;
|
728 |
+
var newId;
|
729 |
+
|
730 |
+
// Radio inputs are slightly different because there are multiple `input` elements for
|
731 |
+
// a single field, i.e. multiple `inputs` for selecting a single value.
|
732 |
+
if( $inputElement.is('[type="radio"]') ) {
|
733 |
+
// Radio inputs have their position appended to the id.
|
734 |
+
idBase = id.replace(/-\d+-\d+$/, '');
|
735 |
+
var radioIdBase = id.replace(/-\d+$/, '');
|
736 |
+
if (!newIds[idBase]) {
|
737 |
+
var radioNames = {};
|
738 |
+
newIds[idBase] = $form
|
739 |
+
// find all inputs containing idBase in their id attribute
|
740 |
+
.find('.siteorigin-widget-input[id^=' + idBase + ']')
|
741 |
+
// exclude inputs from templates
|
742 |
+
.not('[id*=_id_]')
|
743 |
+
// reduce to one element per radio input group.
|
744 |
+
.filter(function(index, element) {
|
745 |
+
var eltName = $(element).attr('name');
|
746 |
+
if(radioNames[eltName]) {
|
747 |
+
return false;
|
748 |
+
} else {
|
749 |
+
radioNames[eltName] = true;
|
750 |
+
return true;
|
751 |
+
}
|
752 |
+
}).length + 1;
|
753 |
+
}
|
754 |
+
var newRadioIdBase = idBase + '-' + newIds[idBase];
|
755 |
+
newId = newRadioIdBase + id.match(/-\d+$/)[0];
|
756 |
+
$copyItem.find('label[for=' + radioIdBase + ']').attr('for', newRadioIdBase);
|
757 |
+
} else {
|
758 |
+
idRegExp = new RegExp('-\\d+$');
|
759 |
+
idBase = id.replace(idRegExp, '');
|
760 |
+
if (!newIds[idBase]) {
|
761 |
+
newIds[idBase] = $form.find('.siteorigin-widget-input[id^=' + idBase + ']').not('[id*=_id_]').length + 1;
|
762 |
+
}
|
763 |
+
newId = idBase + '-' + newIds[idBase]++;
|
764 |
+
}
|
765 |
+
|
766 |
$inputElement.attr('id', newId);
|
767 |
$copyItem.find('label[for=' + id + ']').attr('for', newId);
|
768 |
$copyItem.find('[id*=' + id + ']').each(function() {
|
base/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,r,a=e(t),s=!0,o=a.find("input[name]");if(o.length&&o.attr("name").indexOf("__i__")!==-1)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),r=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(r).length)return!0;var a,o,d,l,f,g,p={},c=window.sowForms.getRepeaterId(i);if(c!==!1){var u={};for(var w in r)u[w.replace("{$repeater}",c)]=r[w];r=u}for(var w in r)if(f=!1,a=w.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/),null!==a){if(o={group:"default",name:"",multi:!1},void 0!==a[2]?(o.group=a[1],o.name=a[3]):o.name=a[0],o.multi=void 0!==a[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof p[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var m=0;m<g.length&&!(f=o.group===t&&g[m]===n);m++);}if(f){d=r[w],o.multi||(d=[d]);for(var m=0;m<d.length;m++)l="undefined"!=typeof d[m][1]&&Boolean(d[m][1])?i.find(d[m][1]):i,l[d[m][0]].apply(l,"undefined"!=typeof d[m][2]?d[m][2]:[]);p[o.group]=!0}}})}),a.sowSetupPreview(),n=a;var d=a.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),console.log(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})})}else n=a.closest(".siteorigin-widget-form-main");r=n.find("> .siteorigin-widgets-form-id").val();var l=a.find("> .siteorigin-widget-field");l.find("> .siteorigin-widget-section").sowSetupForm(),l.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),l.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),l.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),a.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),l.find("> .siteorigin-widget-input-color").wpColorPicker(),l.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(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})}),l.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)}})}),l.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(),r=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=" "),r.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));r.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var r=i.find(".existing-content-selector");r.toggle(),r.is(":visible")&&0===r.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 r=null;i.find(".content-text-search").keyup(function(){null!==r&&clearTimeout(r),r=setTimeout(function(){n()},500)})}),"undefined"!=typeof jQuery.fn.soPanelsSetupBuilderWidget&&l.filter(".siteorigin-widget-field-type-builder").each(function(){var i=e(this);i.find("> .siteorigin-page-builder-field").soPanelsSetupBuilderWidget()});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var r=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var r=window.sowForms.getRepeaterId(i);return r!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",r)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},a={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)a=r(t[s],a);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in a)"undefined"!=typeof o[d]&&a[d]===o[d]||(o[d]=a[d],n.trigger("sowstatechange",[d,a[d]]));n.data("states",o)}};l.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),a.trigger("sowsetupform",l).data("sow-form-setup",!0),l.trigger("sowsetupformfield"),a.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!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"));if(void 0===t)return!0;t=t[1];var r=t.split("][");r=r.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var a=n,s=0;s<r.length;s++)if(s===r.length-1)if("checkbox"===i.attr("type"))i.is(":checked")?a[r[s]]=""===i.val()||i.val():a[r[s]]=!1;else if("radio"===i.attr("type"))i.is(":checked")&&(a[r[s]]=""===i.val()||i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var o=null;"undefined"!=typeof tinyMCE&&(o=tinyMCE.get(i.attr("id"))),null===o||"function"!=typeof o.getContent||o.isHidden()?a[r[s]]=i.val():a[r[s]]=o.getContent()}else a[r[s]]=i.val();else"undefined"==typeof a[r[s]]&&(a[r[s]]={}),a=a[r[s]]});var r=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");r.find('input[name="data"]').val(JSON.stringify(n)),r.find('input[name="class"]').val(i.data("class")),r.find("iframe").on("load",function(){e(this).css("visibility","visible")}),r.find("form").submit(),r.find(".close").click(function(){r.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),r=n.find(".siteorigin-widget-field-repeater-items"),a=n.data("repeater-name");r.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 r=e(n).data("repeater-positions");"undefined"==typeof r&&(r={}),r[a]=i,e(n).data("repeater-positions",r)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),r=e(t);if("undefined"!=typeof n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}});var r=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(r>0&&t.length>r){var s=t.first().outerHeight();i.css("max-height",s*r).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),r.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){r.trigger("updateFieldPositions")}}),r.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()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),r=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.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 s=a.html().replace(/_id_/g,r),o="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(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":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(s));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 r=n.closest(".siteorigin-widget-field-repeater"),a=n.find("> .siteorigin-widget-field-repeater-item-top"),s=r.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}a.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(){e(window).resize(),e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),a.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()})}}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),r=e(this).closest(".siteorigin-widget-field-repeater-item"),a=r.clone(),s=r.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=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(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var g=i.closest(".wp-picker-container"),p=i.closest(".siteorigin-widget-field");g.remove(),p.append(i.remove())}else{var c=r.find('[name="'+l+'"]');c.length&&null!=c.val()&&i.val(c.val())}if(s){var u=s.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),a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var m=r.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"+o.toString()+"$3");i.attr("name",v),i.data("original-name",v)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var r=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=r.split("]["),s=a.length?n:null;a.length;)s=s[a.shift()];return s[t]},fetchWidgetVariable: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])}};window.sowForms=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(function(){e(document).trigger("sowadminloaded")})}(jQuery);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 r="",a="default";return void 0!==n[3]?(a=n[1],r=n[3]):r=n[1],{match:n[4].trim(),group:a,state:r}},_checker:function(e,i,t,n){var r={};"undefined"==typeof i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)a=sowEmitters._match(i[s],t),a!==!1&&("_true"===a.match||n(e,i,a.match))&&(r[a.group]=a.state);return r},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 t.split(",").map(function(e){return e.trim()}).indexOf(e)!==-1})}};
|
1 |
+
!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,r,a=e(t),s=!0,o=a.find("input[name]");if(o.length&&o.attr("name").indexOf("__i__")!==-1)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),r=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(r).length)return!0;var a,o,d,l,f,g,p={},c=window.sowForms.getRepeaterId(i);if(c!==!1){var u={};for(var w in r)u[w.replace("{$repeater}",c)]=r[w];r=u}for(var w in r)if(f=!1,a=w.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/),null!==a){if(o={group:"default",name:"",multi:!1},void 0!==a[2]?(o.group=a[1],o.name=a[3]):o.name=a[0],o.multi=void 0!==a[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof p[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var m=0;m<g.length&&!(f=o.group===t&&g[m]===n);m++);}if(f){d=r[w],o.multi||(d=[d]);for(var m=0;m<d.length;m++)l="undefined"!=typeof d[m][1]&&Boolean(d[m][1])?i.find(d[m][1]):i,l[d[m][0]].apply(l,"undefined"!=typeof d[m][2]?d[m][2]:[]);p[o.group]=!0}}})}),a.sowSetupPreview(),n=a;var d=a.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),console.log(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})})}else n=a.closest(".siteorigin-widget-form-main");r=n.find("> .siteorigin-widgets-form-id").val();var l=a.find("> .siteorigin-widget-field");l.find("> .siteorigin-widget-section").sowSetupForm(),l.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),l.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),l.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),a.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),l.find("> .siteorigin-widget-input-color").wpColorPicker({change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}}),l.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(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})}),l.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)),t.trigger("change"),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),l.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"),r=n.val(),a=n.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:r,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title=" "),s.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var r=i.find(".existing-content-selector");r.toggle(),r.is(":visible")&&0===r.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 r=null;i.find(".content-text-search").keyup(function(){null!==r&&clearTimeout(r),r=setTimeout(function(){n()},500)})}),"undefined"!=typeof jQuery.fn.soPanelsSetupBuilderWidget&&l.filter(".siteorigin-widget-field-type-builder").each(function(){var i=e(this);i.find("> .siteorigin-page-builder-field").soPanelsSetupBuilderWidget()});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var r=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var r=window.sowForms.getRepeaterId(i);return r!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",r)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},a={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)a=r(t[s],a);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in a)"undefined"!=typeof o[d]&&a[d]===o[d]||(o[d]=a[d],n.trigger("sowstatechange",[d,a[d]]));n.data("states",o)}};l.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),a.trigger("sowsetupform",l).data("sow-form-setup",!0),l.trigger("sowsetupformfield"),a.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!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"));if(void 0===t)return!0;t=t[1];var r=t.split("][");r=r.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var a=n,s=0;s<r.length;s++)if(s===r.length-1)if("checkbox"===i.attr("type"))i.is(":checked")?a[r[s]]=""===i.val()||i.val():a[r[s]]=!1;else if("radio"===i.attr("type"))i.is(":checked")&&(a[r[s]]=""===i.val()||i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var o=null;"undefined"!=typeof tinyMCE&&(o=tinyMCE.get(i.attr("id"))),null===o||"function"!=typeof o.getContent||o.isHidden()?a[r[s]]=i.val():a[r[s]]=o.getContent()}else a[r[s]]=i.val();else"undefined"==typeof a[r[s]]&&(a[r[s]]={}),a=a[r[s]]});var r=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");r.find('input[name="data"]').val(JSON.stringify(n)),r.find('input[name="class"]').val(i.data("class")),r.find("iframe").on("load",function(){e(this).css("visibility","visible")}),r.find("form").submit(),r.find(".close").click(function(){r.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),r=n.find(".siteorigin-widget-field-repeater-items"),a=n.data("repeater-name");r.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 r=e(n).data("repeater-positions");"undefined"==typeof r&&(r={}),r[a]=i,e(n).data("repeater-positions",r)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),r=e(t);if("undefined"!=typeof n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t);n.prop("checked",n.prop("defaultChecked"))}),i.data("initialSetup",!0));var r=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(r>0&&t.length>r){var s=t.first().outerHeight();i.css("max-height",s*r).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),r.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){r.trigger("updateFieldPositions")}}),r.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()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),r=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.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 s=a.html().replace(/_id_/g,r),o="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(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":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(s));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 r=n.closest(".siteorigin-widget-field-repeater"),a=n.find("> .siteorigin-widget-field-repeater-item-top"),s=r.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}a.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(){e(window).resize(),e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),a.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()})}}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),r=e(this).closest(".siteorigin-widget-field-repeater-item"),a=r.clone(),s=r.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=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(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var g=i.closest(".wp-picker-container"),p=i.closest(".siteorigin-widget-field");g.remove(),p.append(i.remove())}else{var c=r.find('[name="'+l+'"]');c.length&&null!=c.val()&&i.val(c.val())}if(s){var u,w,m;if(i.is('[type="radio"]')){w=s.replace(/-\d+-\d+$/,"");var h=s.replace(/-\d+$/,"");if(!d[w]){var v={};d[w]=t.find(".siteorigin-widget-input[id^="+w+"]").not("[id*=_id_]").filter(function(i,t){var n=e(t).attr("name");return!v[n]&&(v[n]=!0,!0)}).length+1}var y=w+"-"+d[w];m=y+s.match(/-\d+$/)[0],a.find("label[for="+h+"]").attr("for",y)}else u=new RegExp("-\\d+$"),w=s.replace(u,""),d[w]||(d[w]=t.find(".siteorigin-widget-input[id^="+w+"]").not("[id*=_id_]").length+1),m=w+"-"+d[w]++;i.attr("id",m),a.find("label[for="+s+"]").attr("for",m),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,m);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(m)&&tinymce.get(m).remove()}var b=r.parents(".siteorigin-widget-field-repeater").length,_=e("body");(_.hasClass("wp-customizer")||_.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(b+=1);var k=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(b-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",k),i.data("original-name",k)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var r=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=r.split("]["),s=a.length?n:null;a.length;)s=s[a.shift()];return s[t]},fetchWidgetVariable: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])}};window.sowForms=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(function(){e(document).trigger("sowadminloaded")})}(jQuery);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 r="",a="default";return void 0!==n[3]?(a=n[1],r=n[3]):r=n[1],{match:n[4].trim(),group:a,state:r}},_checker:function(e,i,t,n){var r={};"undefined"==typeof i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)a=sowEmitters._match(i[s],t),a!==!1&&("_true"===a.match||n(e,i,a.match))&&(r[a.group]=a.state);return r},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 t.split(",").map(function(e){return e.trim()}).indexOf(e)!==-1})}};
|
base/siteorigin-widget.class.php
CHANGED
@@ -228,7 +228,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
228 |
/**
|
229 |
* Generate the CSS for this widget and display it in the appropriate way
|
230 |
*
|
231 |
-
* @param $instance The instance array
|
232 |
*
|
233 |
* @return string The CSS name
|
234 |
*/
|
@@ -426,7 +426,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
426 |
<?php $this->scripts_loading_message() ?>
|
427 |
</div>
|
428 |
|
429 |
-
<?php if( $this->
|
430 |
<div class="siteorigin-widget-preview" style="display: none">
|
431 |
<a href="#" class="siteorigin-widget-preview-button button-secondary"><?php _e('Preview', 'so-widgets-bundle') ?></a>
|
432 |
</div>
|
@@ -454,7 +454,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
454 |
</script>
|
455 |
<?php
|
456 |
|
457 |
-
$this->enqueue_scripts( );
|
458 |
}
|
459 |
|
460 |
/**
|
@@ -465,6 +465,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
465 |
method_exists( $this, 'get_form_teaser' ) &&
|
466 |
( $teaser = $this->get_form_teaser() )
|
467 |
) {
|
|
|
|
|
|
|
|
|
468 |
$dismissed = get_user_meta( get_current_user_id(), 'teasers_dismissed', true );
|
469 |
if( empty( $dismissed[ $this->id_base ] ) ) {
|
470 |
$dismiss_url = add_query_arg( array(
|
@@ -505,7 +509,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
505 |
*
|
506 |
* @param bool|string $form_type Should we enqueue the field scripts too?
|
507 |
*/
|
508 |
-
function enqueue_scripts( $form_type = false ){
|
509 |
|
510 |
if( ! wp_script_is('siteorigin-widget-admin') ) {
|
511 |
wp_enqueue_style( 'wp-color-picker' );
|
@@ -785,7 +789,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
785 |
//handle less @import statements
|
786 |
$less = preg_replace_callback( '/^@import\s+".*?\/?([\w-\.]+)";/m', array( $this, 'get_less_import_contents' ), $less );
|
787 |
|
788 |
-
$vars = $this->get_less_variables($instance);
|
789 |
if( !empty( $vars ) ){
|
790 |
foreach($vars as $name => $value) {
|
791 |
// Ignore empty string, false and null values (but keep '0')
|
@@ -922,6 +926,8 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
922 |
if( empty( $instance ) ) return;
|
923 |
|
924 |
$fonts = $this->get_google_font_fields($instance);
|
|
|
|
|
925 |
$font_imports = array();
|
926 |
|
927 |
foreach ( $fonts as $font ) {
|
@@ -934,10 +940,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
934 |
}
|
935 |
|
936 |
// Remove empty and duplicate items from the array
|
937 |
-
$import_strings = array_filter($import_strings);
|
938 |
-
$import_strings = array_unique($import_strings);
|
939 |
|
940 |
-
return implode("\n", $import_strings);
|
941 |
}
|
942 |
|
943 |
/**
|
@@ -960,7 +966,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
960 |
*/
|
961 |
public function so_get_field_name( $field_name, $container = array() ) {
|
962 |
if( empty($container) ) {
|
963 |
-
|
964 |
}
|
965 |
else {
|
966 |
// We also need to add the container fields
|
@@ -975,8 +981,12 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
975 |
|
976 |
$name = $this->get_field_name( '{{{FIELD_NAME}}}' );
|
977 |
$name = str_replace('[{{{FIELD_NAME}}}]', $container_extras.'[' . esc_attr($field_name) . ']', $name);
|
978 |
-
return $name;
|
979 |
}
|
|
|
|
|
|
|
|
|
|
|
980 |
}
|
981 |
|
982 |
/**
|
@@ -1032,7 +1042,11 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
1032 |
* @return string
|
1033 |
*/
|
1034 |
function get_style_hash( $instance ) {
|
1035 |
-
|
|
|
|
|
|
|
|
|
1036 |
$version = property_exists( $this, 'version' ) ? $this->version : '';
|
1037 |
|
1038 |
return substr( md5( json_encode( $vars ) . $version ), 0, 12 );
|
@@ -1204,7 +1218,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
1204 |
* rather register scripts and styles using register_frontend_scripts() and register_frontend_styles(). This function
|
1205 |
* will then ensure that the scripts are not enqueued more than once.
|
1206 |
*/
|
1207 |
-
function enqueue_frontend_scripts( $instance ){
|
1208 |
$this->enqueue_registered_scripts();
|
1209 |
$this->enqueue_registered_styles();
|
1210 |
|
@@ -1224,16 +1238,29 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
1224 |
*
|
1225 |
* @return bool
|
1226 |
*/
|
1227 |
-
function is_preview( $instance = array() ){
|
1228 |
// Check if the instance is a preview
|
1229 |
if( !empty( $instance[ 'is_preview' ] ) ) return true;
|
1230 |
|
1231 |
// Check if the general request is a preview
|
1232 |
-
|
1233 |
is_preview() || // is this a standard preview
|
1234 |
$this->is_customize_preview() || // Is this a customizer preview
|
1235 |
!empty( $_GET['siteorigin_panels_live_editor'] ) || // Is this a Page Builder live editor request
|
1236 |
( !empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'so_panels_builder_content' ); // Is this a Page Builder content ajax request
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1237 |
}
|
1238 |
|
1239 |
/**
|
228 |
/**
|
229 |
* Generate the CSS for this widget and display it in the appropriate way
|
230 |
*
|
231 |
+
* @param $instance array The instance array
|
232 |
*
|
233 |
* @return string The CSS name
|
234 |
*/
|
426 |
<?php $this->scripts_loading_message() ?>
|
427 |
</div>
|
428 |
|
429 |
+
<?php if( $this->show_preview_button() ) : ?>
|
430 |
<div class="siteorigin-widget-preview" style="display: none">
|
431 |
<a href="#" class="siteorigin-widget-preview-button button-secondary"><?php _e('Preview', 'so-widgets-bundle') ?></a>
|
432 |
</div>
|
454 |
</script>
|
455 |
<?php
|
456 |
|
457 |
+
$this->enqueue_scripts( $form_type );
|
458 |
}
|
459 |
|
460 |
/**
|
465 |
method_exists( $this, 'get_form_teaser' ) &&
|
466 |
( $teaser = $this->get_form_teaser() )
|
467 |
) {
|
468 |
+
if ( ! is_admin() ) {
|
469 |
+
wp_enqueue_style( 'dashicons' );
|
470 |
+
}
|
471 |
+
|
472 |
$dismissed = get_user_meta( get_current_user_id(), 'teasers_dismissed', true );
|
473 |
if( empty( $dismissed[ $this->id_base ] ) ) {
|
474 |
$dismiss_url = add_query_arg( array(
|
509 |
*
|
510 |
* @param bool|string $form_type Should we enqueue the field scripts too?
|
511 |
*/
|
512 |
+
function enqueue_scripts( $form_type = false ) {
|
513 |
|
514 |
if( ! wp_script_is('siteorigin-widget-admin') ) {
|
515 |
wp_enqueue_style( 'wp-color-picker' );
|
789 |
//handle less @import statements
|
790 |
$less = preg_replace_callback( '/^@import\s+".*?\/?([\w-\.]+)";/m', array( $this, 'get_less_import_contents' ), $less );
|
791 |
|
792 |
+
$vars = apply_filters( 'siteorigin_widgets_less_variables_' . $this->id_base, $this->get_less_variables( $instance ), $instance, $this );
|
793 |
if( !empty( $vars ) ){
|
794 |
foreach($vars as $name => $value) {
|
795 |
// Ignore empty string, false and null values (but keep '0')
|
926 |
if( empty( $instance ) ) return;
|
927 |
|
928 |
$fonts = $this->get_google_font_fields($instance);
|
929 |
+
if( empty( $fonts ) || ! is_array( $fonts ) ) return '';
|
930 |
+
|
931 |
$font_imports = array();
|
932 |
|
933 |
foreach ( $fonts as $font ) {
|
940 |
}
|
941 |
|
942 |
// Remove empty and duplicate items from the array
|
943 |
+
$import_strings = array_filter( $import_strings );
|
944 |
+
$import_strings = array_unique( $import_strings );
|
945 |
|
946 |
+
return implode( "\n", $import_strings );
|
947 |
}
|
948 |
|
949 |
/**
|
966 |
*/
|
967 |
public function so_get_field_name( $field_name, $container = array() ) {
|
968 |
if( empty($container) ) {
|
969 |
+
$name = $this->get_field_name( $field_name );
|
970 |
}
|
971 |
else {
|
972 |
// We also need to add the container fields
|
981 |
|
982 |
$name = $this->get_field_name( '{{{FIELD_NAME}}}' );
|
983 |
$name = str_replace('[{{{FIELD_NAME}}}]', $container_extras.'[' . esc_attr($field_name) . ']', $name);
|
|
|
984 |
}
|
985 |
+
|
986 |
+
$name = apply_filters( 'siteorigin_widgets_get_field_name', $name );
|
987 |
+
$name = apply_filters( 'siteorigin_widgets_get_field_name_' . $this->id_base, $name );
|
988 |
+
|
989 |
+
return $name;
|
990 |
}
|
991 |
|
992 |
/**
|
1042 |
* @return string
|
1043 |
*/
|
1044 |
function get_style_hash( $instance ) {
|
1045 |
+
if( method_exists( $this, 'get_style_hash_variables' ) ) {
|
1046 |
+
$vars = apply_filters( 'siteorigin_widgets_hash_variables_' . $this->id_base, $this->get_style_hash_variables( $instance ), $instance, $this );
|
1047 |
+
} else {
|
1048 |
+
$vars = apply_filters( 'siteorigin_widgets_less_variables_' . $this->id_base, $this->get_less_variables( $instance ), $instance, $this );
|
1049 |
+
}
|
1050 |
$version = property_exists( $this, 'version' ) ? $this->version : '';
|
1051 |
|
1052 |
return substr( md5( json_encode( $vars ) . $version ), 0, 12 );
|
1218 |
* rather register scripts and styles using register_frontend_scripts() and register_frontend_styles(). This function
|
1219 |
* will then ensure that the scripts are not enqueued more than once.
|
1220 |
*/
|
1221 |
+
function enqueue_frontend_scripts( $instance ) {
|
1222 |
$this->enqueue_registered_scripts();
|
1223 |
$this->enqueue_registered_styles();
|
1224 |
|
1238 |
*
|
1239 |
* @return bool
|
1240 |
*/
|
1241 |
+
function is_preview( $instance = array() ) {
|
1242 |
// Check if the instance is a preview
|
1243 |
if( !empty( $instance[ 'is_preview' ] ) ) return true;
|
1244 |
|
1245 |
// Check if the general request is a preview
|
1246 |
+
$is_preview =
|
1247 |
is_preview() || // is this a standard preview
|
1248 |
$this->is_customize_preview() || // Is this a customizer preview
|
1249 |
!empty( $_GET['siteorigin_panels_live_editor'] ) || // Is this a Page Builder live editor request
|
1250 |
( !empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'so_panels_builder_content' ); // Is this a Page Builder content ajax request
|
1251 |
+
|
1252 |
+
return apply_filters( 'siteorigin_widgets_is_preview', $is_preview, $this );
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
/**
|
1256 |
+
* Whether or not so show the 'Preview' button
|
1257 |
+
*
|
1258 |
+
* @return bool
|
1259 |
+
*/
|
1260 |
+
function show_preview_button(){
|
1261 |
+
$show_preview = $this->widget_options['has_preview'] && ! $this->is_customize_preview();
|
1262 |
+
$show_preview = apply_filters( 'siteorigin_widgets_form_show_preview_button', $show_preview, $this );
|
1263 |
+
return $show_preview;
|
1264 |
}
|
1265 |
|
1266 |
/**
|
compat/beaver-builder/beaver-builder.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SiteOrigin_Widgets_Bundle_Beaver_Builder {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get the singleton instance
|
7 |
+
*
|
8 |
+
* @return SiteOrigin_Widgets_Bundle_Beaver_Builder
|
9 |
+
*/
|
10 |
+
public static function single() {
|
11 |
+
static $single;
|
12 |
+
return empty( $single ) ? $single = new self() : $single;
|
13 |
+
}
|
14 |
+
|
15 |
+
function __construct() {
|
16 |
+
add_action('wp', array( $this, 'init' ), 9 );
|
17 |
+
}
|
18 |
+
|
19 |
+
function init() {
|
20 |
+
if ( ! FLBuilderModel::is_builder_active() ) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
|
24 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_active_widgets_scripts' ) );
|
25 |
+
add_action( 'wp_print_footer_scripts', array( $this, 'print_footer_templates' ) );
|
26 |
+
|
27 |
+
add_filter( 'siteorigin_widgets_get_field_name', array( $this, 'bb_get_field_name' ) );
|
28 |
+
|
29 |
+
// Don't want to show the form preview button when using Beaver Builder
|
30 |
+
add_filter( 'siteorigin_widgets_form_show_preview_button', '__return_false' );
|
31 |
+
}
|
32 |
+
|
33 |
+
function enqueue_active_widgets_scripts() {
|
34 |
+
global $wp_widget_factory;
|
35 |
+
|
36 |
+
// Beaver Builder does it's editing in the front end so enqueue required form scripts for active widgets.
|
37 |
+
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
38 |
+
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
39 |
+
ob_start();
|
40 |
+
$widget_obj->form( array() );
|
41 |
+
ob_clean();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
if ( ! wp_script_is( 'wp-color-picker' ) ) {
|
46 |
+
// wp-color-picker hasn't been registered because we're in the front end, so enqueue with full args.
|
47 |
+
wp_enqueue_script( 'iris', '/wp-admin/js/iris.min.js', array(
|
48 |
+
'jquery-ui-draggable',
|
49 |
+
'jquery-ui-slider',
|
50 |
+
'jquery-touch-punch'
|
51 |
+
), '1.0.7', 1 );
|
52 |
+
|
53 |
+
wp_enqueue_script( 'wp-color-picker', '/wp-admin/js/color-picker' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'iris' ), false, 1 );
|
54 |
+
|
55 |
+
wp_enqueue_style( 'wp-color-picker' );
|
56 |
+
|
57 |
+
// Localization args for when wp-color-picker script hasn't been registered.
|
58 |
+
wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array(
|
59 |
+
'clear' => __( 'Clear', 'so-widgets-bundle' ),
|
60 |
+
'defaultString' => __( 'Default', 'so-widgets-bundle' ),
|
61 |
+
'pick' => __( 'Select Color', 'so-widgets-bundle' ),
|
62 |
+
'current' => __( 'Current Color', 'so-widgets-bundle' ),
|
63 |
+
) );
|
64 |
+
}
|
65 |
+
|
66 |
+
wp_enqueue_style( 'dashicons' );
|
67 |
+
wp_enqueue_media();
|
68 |
+
|
69 |
+
wp_enqueue_style( 'sowb-styles-for-beaver', plugin_dir_url( __FILE__ ) . 'styles.css' );
|
70 |
+
|
71 |
+
wp_enqueue_script(
|
72 |
+
'sowb-js-for-beaver',
|
73 |
+
plugin_dir_url( __FILE__ ) . 'sowb-beaver-builder' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
74 |
+
array( 'jquery', 'fl-builder' )
|
75 |
+
);
|
76 |
+
|
77 |
+
wp_enqueue_style( 'siteorigin-widget-admin', plugin_dir_url(SOW_BUNDLE_BASE_FILE).'base/css/admin.css', array( 'media-views' ), SOW_BUNDLE_VERSION );
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
function print_footer_templates() {
|
82 |
+
global $wp_widget_factory;
|
83 |
+
|
84 |
+
// Beaver Builder does it's editing in the front end so print required footer templates for active widgets.
|
85 |
+
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
86 |
+
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
87 |
+
$widget_obj->footer_admin_templates();
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
function bb_get_field_name( $name ) {
|
93 |
+
return preg_replace( '/\[[^\]]*\]/', '[]', $name, 1 );
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
SiteOrigin_Widgets_Bundle_Beaver_Builder::single();
|
compat/beaver-builder/sowb-beaver-builder.js
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var sowb = window.sowb || {};
|
2 |
+
|
3 |
+
( function($){
|
4 |
+
if( typeof FLBuilder !== 'undefined') {
|
5 |
+
sowb.orig_FLBuilder_getSettings = FLBuilder._getSettings;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Replace Beaver Builder's form data collection function with our modified version.
|
9 |
+
*/
|
10 |
+
FLBuilder._getSettings = function(form) {
|
11 |
+
FLBuilder._updateEditorFields();
|
12 |
+
form.find('.siteorigin-widget-input');
|
13 |
+
var data = form.serializeArray(),
|
14 |
+
i = 0,
|
15 |
+
k = 0,
|
16 |
+
value = '',
|
17 |
+
name = '',
|
18 |
+
key = '',
|
19 |
+
keys = [],
|
20 |
+
matches = [],
|
21 |
+
settings = {};
|
22 |
+
|
23 |
+
// Loop through the form data.
|
24 |
+
for ( i = 0; i < data.length; i++ ) {
|
25 |
+
|
26 |
+
value = data[ i ].value.replace( /\r/gm, '' );
|
27 |
+
|
28 |
+
// Don't save text editor textareas.
|
29 |
+
if ( data[ i ].name.indexOf( 'flrich' ) > -1 ) {
|
30 |
+
continue;
|
31 |
+
}
|
32 |
+
// Support foo[]... setting keys.
|
33 |
+
else if ( data[ i ].name.indexOf( '[' ) > -1 ) {
|
34 |
+
|
35 |
+
name = data[ i ].name.replace( /\[(.*)\]/, '' );
|
36 |
+
key = data[ i ].name.replace( name, '' );
|
37 |
+
keys = [];
|
38 |
+
matches = key.match( /\[[^\]]*\]/g );
|
39 |
+
|
40 |
+
// Remove [] from the keys.
|
41 |
+
for ( k = 0; k < matches.length; k++ ) {
|
42 |
+
|
43 |
+
if ( '[]' == matches[ k ] ) {
|
44 |
+
continue;
|
45 |
+
}
|
46 |
+
|
47 |
+
keys.push( matches[ k ].replace( /\[|\]/g, '' ) );
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
var f = function(object, val, head, tail) {
|
52 |
+
if( tail.length == 0) {
|
53 |
+
object[ head ] = val;
|
54 |
+
} else {
|
55 |
+
if( 'undefined' == typeof object [ head ] ) {
|
56 |
+
object [ head ] = {};
|
57 |
+
}
|
58 |
+
f(object[ head ], val, tail.shift(), tail);
|
59 |
+
}
|
60 |
+
};
|
61 |
+
|
62 |
+
if(keys.length > 0) {
|
63 |
+
|
64 |
+
var keysCopy = keys.slice();
|
65 |
+
if ( 'undefined' == typeof settings[ name ] ) {
|
66 |
+
settings[ name ] = {};
|
67 |
+
}
|
68 |
+
f(settings[ name ], value, keysCopy.shift(), keysCopy);
|
69 |
+
} else {
|
70 |
+
|
71 |
+
if ( 'undefined' == typeof settings[ name ] ) {
|
72 |
+
settings[ name ] = [];
|
73 |
+
}
|
74 |
+
|
75 |
+
settings[ name ].push( value );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
// Standard name/value pair.
|
79 |
+
else {
|
80 |
+
settings[ data[ i ].name ] = value;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
// Update auto suggest values.
|
85 |
+
for ( key in settings ) {
|
86 |
+
|
87 |
+
if ( 'undefined' != typeof settings[ 'as_values_' + key ] ) {
|
88 |
+
|
89 |
+
settings[ key ] = $.grep(
|
90 |
+
settings[ 'as_values_' + key ].split( ',' ),
|
91 |
+
function( n ) {
|
92 |
+
return n !== '';
|
93 |
+
}
|
94 |
+
).join( ',' );
|
95 |
+
|
96 |
+
try {
|
97 |
+
delete settings[ 'as_values_' + key ];
|
98 |
+
}
|
99 |
+
catch( e ) {}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
// Return the settings.
|
104 |
+
return settings;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
// To ensure necessary scripts are executed again when settings are changed
|
109 |
+
$( document ).on( 'fl-builder.preview-rendered fl-builder.layout-rendered', '.fl-builder-content', function() {
|
110 |
+
// Trigger Widgets Bundle widgets to setup
|
111 |
+
$( sowb ).trigger( 'setup_widgets' );
|
112 |
+
} );
|
113 |
+
|
114 |
+
})(jQuery);
|
compat/beaver-builder/sowb-beaver-builder.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var sowb=window.sowb||{};!function(e){"undefined"!=typeof FLBuilder&&(sowb.orig_FLBuilder_getSettings=FLBuilder._getSettings,FLBuilder._getSettings=function(i){FLBuilder._updateEditorFields(),i.find(".siteorigin-widget-input");var n=i.serializeArray(),t=0,r=0,d="",l="",u="",f=[],a=[],o={};for(t=0;t<n.length;t++)if(d=n[t].value.replace(/\r/gm,""),!(n[t].name.indexOf("flrich")>-1))if(n[t].name.indexOf("[")>-1){for(l=n[t].name.replace(/\[(.*)\]/,""),u=n[t].name.replace(l,""),f=[],a=u.match(/\[[^\]]*\]/g),r=0;r<a.length;r++)"[]"!=a[r]&&f.push(a[r].replace(/\[|\]/g,""));var s=function(e,i,n,t){0==t.length?e[n]=i:("undefined"==typeof e[n]&&(e[n]={}),s(e[n],i,t.shift(),t))};if(f.length>0){var g=f.slice();"undefined"==typeof o[l]&&(o[l]={}),s(o[l],d,g.shift(),g)}else"undefined"==typeof o[l]&&(o[l]=[]),o[l].push(d)}else o[n[t].name]=d;for(u in o)if("undefined"!=typeof o["as_values_"+u]){o[u]=e.grep(o["as_values_"+u].split(","),function(e){return""!==e}).join(",");try{delete o["as_values_"+u]}catch(p){}}return o}),e(document).on("fl-builder.preview-rendered fl-builder.layout-rendered",".fl-builder-content",function(){e(sowb).trigger("setup_widgets")})}(jQuery);
|
compat/beaver-builder/styles.css
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Styles required for icons, otherwise they are overridden by Beaver Builder's form styles */
|
2 |
+
/* Unfortunately a lot of `!important`s necessary to override beaver's `!important`s. :/ */
|
3 |
+
.fl-lightbox .siteorigin-widget-form,
|
4 |
+
.siteorigin-widgets-query-builder.media-modal {
|
5 |
+
/* Button styles copied from wp-core for default UI look. */
|
6 |
+
}
|
7 |
+
.fl-lightbox .siteorigin-widget-form.siteorigin-widget-form-main,
|
8 |
+
.siteorigin-widgets-query-builder.media-modal.siteorigin-widget-form-main {
|
9 |
+
min-width: inherit;
|
10 |
+
}
|
11 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-teaser .dashicons,
|
12 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-teaser .dashicons {
|
13 |
+
font-family: dashicons;
|
14 |
+
}
|
15 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input,
|
16 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input {
|
17 |
+
margin: 0 !important;
|
18 |
+
}
|
19 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input[type="checkbox"],
|
20 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input[type="checkbox"] {
|
21 |
+
vertical-align: middle;
|
22 |
+
}
|
23 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-color,
|
24 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input.siteorigin-widget-input-color {
|
25 |
+
margin: 5px !important;
|
26 |
+
}
|
27 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-measurement,
|
28 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input.siteorigin-widget-input-measurement {
|
29 |
+
margin: 1px !important;
|
30 |
+
height: inherit;
|
31 |
+
}
|
32 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field select.siteorigin-widget-input,
|
33 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field select.siteorigin-widget-input {
|
34 |
+
height: inherit;
|
35 |
+
padding: 3px;
|
36 |
+
}
|
37 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-field-type-slider input[type="number"],
|
38 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field .siteorigin-widget-field-type-slider input[type="number"] {
|
39 |
+
display: none !important;
|
40 |
+
}
|
41 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field .clear,
|
42 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field .clear {
|
43 |
+
clear: both;
|
44 |
+
}
|
45 |
+
.fl-lightbox .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-media .media-fallback-external,
|
46 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-media .media-fallback-external {
|
47 |
+
margin-top: 4px !important;
|
48 |
+
margin-left: 15px !important;
|
49 |
+
max-width: 220px;
|
50 |
+
}
|
51 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-elegantline,
|
52 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-elegantline,
|
53 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-fontawesome,
|
54 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-fontawesome,
|
55 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-genericons,
|
56 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-genericons,
|
57 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-icomoon,
|
58 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-icomoon,
|
59 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-ionicons,
|
60 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-ionicons,
|
61 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-typicons,
|
62 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-typicons {
|
63 |
+
display: inline-block;
|
64 |
+
speak: none;
|
65 |
+
font-style: normal;
|
66 |
+
font-weight: normal;
|
67 |
+
font-variant: normal;
|
68 |
+
text-transform: none;
|
69 |
+
line-height: 1;
|
70 |
+
-webkit-font-smoothing: antialiased;
|
71 |
+
-moz-osx-font-smoothing: grayscale;
|
72 |
+
}
|
73 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-elegantline,
|
74 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-elegantline {
|
75 |
+
font-family: 'sow-elegantline';
|
76 |
+
}
|
77 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-fontawesome,
|
78 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-fontawesome {
|
79 |
+
font-family: 'sow-fontawesome';
|
80 |
+
}
|
81 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-genericons,
|
82 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-genericons {
|
83 |
+
font-family: 'sow-genericons';
|
84 |
+
}
|
85 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-icomoon,
|
86 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-icomoon {
|
87 |
+
font-family: 'sow-icomoon';
|
88 |
+
}
|
89 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-ionicons,
|
90 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-ionicons {
|
91 |
+
font-family: 'sow-ionicons';
|
92 |
+
}
|
93 |
+
.fl-lightbox .siteorigin-widget-form .sow-icon-typicons,
|
94 |
+
.siteorigin-widgets-query-builder.media-modal .sow-icon-typicons {
|
95 |
+
font-family: 'sow-typicons';
|
96 |
+
}
|
97 |
+
.fl-lightbox .siteorigin-widget-form .button,
|
98 |
+
.siteorigin-widgets-query-builder.media-modal .button,
|
99 |
+
.fl-lightbox .siteorigin-widget-form .button-secondary,
|
100 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary {
|
101 |
+
display: inline-block;
|
102 |
+
text-decoration: none;
|
103 |
+
font-size: 13px;
|
104 |
+
line-height: 26px;
|
105 |
+
height: 28px;
|
106 |
+
margin: 0;
|
107 |
+
padding: 0 10px 1px;
|
108 |
+
cursor: pointer;
|
109 |
+
border: 1px solid #cccccc;
|
110 |
+
border-radius: 3px;
|
111 |
+
white-space: nowrap;
|
112 |
+
box-sizing: border-box;
|
113 |
+
font-family: inherit;
|
114 |
+
font-weight: normal;
|
115 |
+
text-transform: capitalize;
|
116 |
+
color: #555;
|
117 |
+
background: #f7f7f7;
|
118 |
+
}
|
119 |
+
.fl-lightbox .siteorigin-widget-form .button:hover,
|
120 |
+
.siteorigin-widgets-query-builder.media-modal .button:hover,
|
121 |
+
.fl-lightbox .siteorigin-widget-form .button-secondary:hover,
|
122 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:hover,
|
123 |
+
.fl-lightbox .siteorigin-widget-form .button:focus,
|
124 |
+
.siteorigin-widgets-query-builder.media-modal .button:focus,
|
125 |
+
.fl-lightbox .siteorigin-widget-form .button-secondary:focus,
|
126 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:focus {
|
127 |
+
background: #fafafa;
|
128 |
+
border-color: #999;
|
129 |
+
color: #23282d;
|
130 |
+
}
|
131 |
+
.fl-lightbox .siteorigin-widget-form .button:active,
|
132 |
+
.siteorigin-widgets-query-builder.media-modal .button:active,
|
133 |
+
.fl-lightbox .siteorigin-widget-form .button-secondary:active,
|
134 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:active,
|
135 |
+
.fl-lightbox .siteorigin-widget-form .button:focus,
|
136 |
+
.siteorigin-widgets-query-builder.media-modal .button:focus,
|
137 |
+
.fl-lightbox .siteorigin-widget-form .button-secondary:focus,
|
138 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:focus {
|
139 |
+
outline: none;
|
140 |
+
}
|
141 |
+
.fl-lightbox .siteorigin-widget-form .button.hidden,
|
142 |
+
.siteorigin-widgets-query-builder.media-modal .button.hidden,
|
143 |
+
.fl-lightbox .siteorigin-widget-form .button-secondary.hidden,
|
144 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary.hidden {
|
145 |
+
display: none;
|
146 |
+
}
|
147 |
+
.fl-lightbox .siteorigin-widget-form .button.button-small,
|
148 |
+
.siteorigin-widgets-query-builder.media-modal .button.button-small {
|
149 |
+
height: 23px;
|
150 |
+
line-height: 22px;
|
151 |
+
padding: 0 8px 1px;
|
152 |
+
font-size: 11px;
|
153 |
+
}
|
154 |
+
.fl-lightbox .siteorigin-widget-form select,
|
155 |
+
.siteorigin-widgets-query-builder.media-modal select,
|
156 |
+
.fl-lightbox .siteorigin-widget-form input[type=text],
|
157 |
+
.siteorigin-widgets-query-builder.media-modal input[type=text] {
|
158 |
+
margin: 1px;
|
159 |
+
border-radius: 0;
|
160 |
+
font-weight: inherit;
|
161 |
+
border: 1px solid #ddd;
|
162 |
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
|
163 |
+
background-color: #fff;
|
164 |
+
color: #32373c;
|
165 |
+
outline: 0;
|
166 |
+
transition: 50ms border-color ease-in-out;
|
167 |
+
}
|
168 |
+
.fl-lightbox .siteorigin-widget-form .ui-autocomplete,
|
169 |
+
.siteorigin-widgets-query-builder.media-modal .ui-autocomplete {
|
170 |
+
padding: 0;
|
171 |
+
margin: 0;
|
172 |
+
list-style: none;
|
173 |
+
position: absolute;
|
174 |
+
z-index: 10000;
|
175 |
+
border: 1px solid #5b9dd9;
|
176 |
+
box-shadow: 0 1px 2px rgba(30, 140, 190, 0.8);
|
177 |
+
background-color: #fff;
|
178 |
+
}
|
179 |
+
.fl-lightbox .siteorigin-widget-form .ui-autocomplete li,
|
180 |
+
.siteorigin-widgets-query-builder.media-modal .ui-autocomplete li {
|
181 |
+
margin-bottom: 0;
|
182 |
+
padding: 4px 10px;
|
183 |
+
white-space: nowrap;
|
184 |
+
text-align: left;
|
185 |
+
}
|
186 |
+
.fl-lightbox .siteorigin-widget-form .ui-autocomplete li.ui-state-focus,
|
187 |
+
.siteorigin-widgets-query-builder.media-modal .ui-autocomplete li.ui-state-focus {
|
188 |
+
background-color: #ddd;
|
189 |
+
cursor: pointer;
|
190 |
+
}
|
compat/builders.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
return array(
|
3 |
+
'beaver_builder' => array(
|
4 |
+
'name' => __( 'Beaver Builder', 'so-widgets-bundle' ),
|
5 |
+
'file_path' => plugin_dir_path( __FILE__ ) . 'beaver-builder/beaver-builder.php',
|
6 |
+
),
|
7 |
+
'elementor' => array(
|
8 |
+
'name' => __( 'Elementor', 'so-widgets-bundle' ),
|
9 |
+
'file_path' => plugin_dir_path( __FILE__ ) . 'elementor/elementor.php',
|
10 |
+
),
|
11 |
+
);
|
compat/compat.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SiteOrigin_Widgets_Bundle_Compatibility {
|
4 |
+
|
5 |
+
const BEAVER_BUILDER = 'Beaver Builder';
|
6 |
+
const ELEMENTOR = 'Elementor';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Get the singleton instance
|
10 |
+
*
|
11 |
+
* @return SiteOrigin_Widgets_Bundle_Compatibility
|
12 |
+
*/
|
13 |
+
public static function single() {
|
14 |
+
static $single;
|
15 |
+
return empty( $single ) ? $single = new self() : $single;
|
16 |
+
}
|
17 |
+
|
18 |
+
function __construct() {
|
19 |
+
$builder = $this->get_active_builder();
|
20 |
+
if ( ! empty( $builder ) ) {
|
21 |
+
require_once $builder['file_path'];
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
function get_active_builder() {
|
26 |
+
|
27 |
+
$builders = include_once 'builders.php';
|
28 |
+
|
29 |
+
foreach ( $builders as $builder ) {
|
30 |
+
if ( $this->is_active( $builder ) ) {
|
31 |
+
return $builder;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
return null;
|
36 |
+
}
|
37 |
+
|
38 |
+
function is_active( $builder ) {
|
39 |
+
switch ( $builder[ 'name' ] ) {
|
40 |
+
case self::BEAVER_BUILDER:
|
41 |
+
return class_exists( 'FLBuilderModel', false );
|
42 |
+
break;
|
43 |
+
case self::ELEMENTOR:
|
44 |
+
return class_exists( 'Elementor\\Plugin', false );
|
45 |
+
break;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
SiteOrigin_Widgets_Bundle_Compatibility::single();
|
compat/elementor/elementor.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SiteOrigin_Widgets_Bundle_Elementor {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get the singleton instance
|
7 |
+
*
|
8 |
+
* @return SiteOrigin_Widgets_Bundle_Elementor
|
9 |
+
*/
|
10 |
+
public static function single() {
|
11 |
+
static $single;
|
12 |
+
|
13 |
+
return empty( $single ) ? $single = new self() : $single;
|
14 |
+
}
|
15 |
+
|
16 |
+
private $plugin;
|
17 |
+
|
18 |
+
function __construct() {
|
19 |
+
add_action( 'template_redirect', [ $this, 'init' ] );
|
20 |
+
|
21 |
+
add_action( 'wp_ajax_elementor_render_widget', [ $this, 'ajax_render_widget_preview' ] );
|
22 |
+
add_action( 'wp_ajax_elementor_editor_get_wp_widget_form', [ $this, 'ajax_render_widget_form' ] );
|
23 |
+
}
|
24 |
+
|
25 |
+
function init() {
|
26 |
+
$this->plugin = Elementor\Plugin::instance();
|
27 |
+
if ( !empty( $this->plugin->preview ) && method_exists( $this->plugin->preview, 'is_preview_mode' ) && $this->plugin->preview->is_preview_mode() ) {
|
28 |
+
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_frontend_scripts' ] );
|
29 |
+
}
|
30 |
+
|
31 |
+
$elementor_editor = $this->plugin->editor;
|
32 |
+
if( ! is_admin() && method_exists( $elementor_editor, 'is_edit_mode' ) && $elementor_editor->is_edit_mode() ) {
|
33 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_active_widgets_scripts' ), 9999999 );
|
34 |
+
add_action( 'wp_print_footer_scripts', array( $this, 'print_footer_templates' ) );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
function enqueue_frontend_scripts() {
|
39 |
+
|
40 |
+
$post_id = get_the_ID();
|
41 |
+
|
42 |
+
if( defined( 'Elementor\\DB::STATUS_DRAFT' ) && ! empty( $this->plugin->db ) && method_exists( $this->plugin->db, 'get_builder' ) ) {
|
43 |
+
// This is necessary to ensure styles and scripts are enqueued. Not sure why this is enough, but I assume
|
44 |
+
// Elementor is calling widgets' `widget` method with instance data in the process of retrieving editor data.
|
45 |
+
$this->plugin->db->get_builder( $post_id, Elementor\DB::STATUS_DRAFT );
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
function enqueue_active_widgets_scripts() {
|
50 |
+
|
51 |
+
global $wp_widget_factory;
|
52 |
+
|
53 |
+
// Elementor does it's editing in it's own front end so enqueue required form scripts for active widgets.
|
54 |
+
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
55 |
+
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
56 |
+
/* @var $widget_obj SiteOrigin_Widget */
|
57 |
+
ob_start();
|
58 |
+
$widget_obj->form( array() );
|
59 |
+
ob_clean();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
wp_enqueue_style( 'sowb-styles-for-elementor', plugin_dir_url( __FILE__ ) . 'styles.css' );
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
function print_footer_templates() {
|
68 |
+
global $wp_widget_factory;
|
69 |
+
|
70 |
+
// Elementor does it's editing in the front end so print required footer templates for active widgets.
|
71 |
+
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
72 |
+
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
73 |
+
/* @var $widget_obj SiteOrigin_Widget */
|
74 |
+
$widget_obj->footer_admin_templates();
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
function ajax_render_widget_preview() {
|
80 |
+
|
81 |
+
add_filter( 'elementor/widget/render_content', array( $this, 'render_widget_preview' ) );
|
82 |
+
}
|
83 |
+
|
84 |
+
function render_widget_preview( $widget_output ) {
|
85 |
+
|
86 |
+
$wp_scripts = wp_scripts();
|
87 |
+
$wp_styles = wp_styles();
|
88 |
+
|
89 |
+
// Print any scripts and styles we may have enqueued for live preview.
|
90 |
+
wp_print_scripts( $wp_scripts->queue );
|
91 |
+
wp_print_styles( $wp_styles->queue );
|
92 |
+
|
93 |
+
return $widget_output;
|
94 |
+
}
|
95 |
+
|
96 |
+
function ajax_render_widget_form() {
|
97 |
+
// Don't want to show the form preview button when using Elementor
|
98 |
+
add_filter( 'siteorigin_widgets_form_show_preview_button', array( $this, '__return_false' ) );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
SiteOrigin_Widgets_Bundle_Elementor::single();
|
compat/elementor/styles.css
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form,
|
2 |
+
.siteorigin-widgets-query-builder,
|
3 |
+
.siteorigin-widgets-query-builder.media-modal {
|
4 |
+
min-width: inherit;
|
5 |
+
/* Button styles copied from wp-core for default UI look. */
|
6 |
+
}
|
7 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .wp-picker-container,
|
8 |
+
.siteorigin-widgets-query-builder .wp-picker-container,
|
9 |
+
.siteorigin-widgets-query-builder.media-modal .wp-picker-container {
|
10 |
+
float: none;
|
11 |
+
}
|
12 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .wp-picker-container.wp-picker-active,
|
13 |
+
.siteorigin-widgets-query-builder .wp-picker-container.wp-picker-active,
|
14 |
+
.siteorigin-widgets-query-builder.media-modal .wp-picker-container.wp-picker-active {
|
15 |
+
transform: none;
|
16 |
+
float: none;
|
17 |
+
position: relative;
|
18 |
+
padding: 0;
|
19 |
+
border: none;
|
20 |
+
background: none;
|
21 |
+
}
|
22 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .wp-picker-container.wp-picker-active .wp-color-result,
|
23 |
+
.siteorigin-widgets-query-builder .wp-picker-container.wp-picker-active .wp-color-result,
|
24 |
+
.siteorigin-widgets-query-builder.media-modal .wp-picker-container.wp-picker-active .wp-color-result {
|
25 |
+
float: none;
|
26 |
+
margin: 0;
|
27 |
+
}
|
28 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .wp-picker-container.wp-picker-active .wp-picker-input-wrap,
|
29 |
+
.siteorigin-widgets-query-builder .wp-picker-container.wp-picker-active .wp-picker-input-wrap,
|
30 |
+
.siteorigin-widgets-query-builder.media-modal .wp-picker-container.wp-picker-active .wp-picker-input-wrap {
|
31 |
+
padding: 0;
|
32 |
+
float: none;
|
33 |
+
}
|
34 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .wp-picker-container.wp-picker-active .iris-picker.iris-border,
|
35 |
+
.siteorigin-widgets-query-builder .wp-picker-container.wp-picker-active .iris-picker.iris-border,
|
36 |
+
.siteorigin-widgets-query-builder.media-modal .wp-picker-container.wp-picker-active .iris-picker.iris-border {
|
37 |
+
background: none;
|
38 |
+
}
|
39 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .wp-picker-container.wp-picker-active .iris-picker.iris-border .iris-picker-inner,
|
40 |
+
.siteorigin-widgets-query-builder .wp-picker-container.wp-picker-active .iris-picker.iris-border .iris-picker-inner,
|
41 |
+
.siteorigin-widgets-query-builder.media-modal .wp-picker-container.wp-picker-active .iris-picker.iris-border .iris-picker-inner {
|
42 |
+
left: 0;
|
43 |
+
right: 0;
|
44 |
+
}
|
45 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .wp-picker-container.wp-picker-active .wp-picker-clear,
|
46 |
+
.siteorigin-widgets-query-builder .wp-picker-container.wp-picker-active .wp-picker-clear,
|
47 |
+
.siteorigin-widgets-query-builder.media-modal .wp-picker-container.wp-picker-active .wp-picker-clear {
|
48 |
+
height: 28px;
|
49 |
+
}
|
50 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-link .existing-content-selector,
|
51 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field.siteorigin-widget-field-type-link .existing-content-selector,
|
52 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-link .existing-content-selector {
|
53 |
+
width: inherit;
|
54 |
+
}
|
55 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-input-color,
|
56 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field .siteorigin-widget-input-color,
|
57 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field .siteorigin-widget-input-color {
|
58 |
+
width: 120px;
|
59 |
+
margin: 0 3px;
|
60 |
+
}
|
61 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-measurement .siteorigin-widget-input-measurement,
|
62 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field.siteorigin-widget-field-type-measurement .siteorigin-widget-input-measurement,
|
63 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-measurement .siteorigin-widget-input-measurement,
|
64 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-measurement .sow-measurement-select-unit,
|
65 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field.siteorigin-widget-field-type-measurement .sow-measurement-select-unit,
|
66 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-measurement .sow-measurement-select-unit {
|
67 |
+
max-width: inherit;
|
68 |
+
height: 28px;
|
69 |
+
margin: 0;
|
70 |
+
}
|
71 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-measurement .siteorigin-widget-input-measurement,
|
72 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field.siteorigin-widget-field-type-measurement .siteorigin-widget-input-measurement,
|
73 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-measurement .siteorigin-widget-input-measurement {
|
74 |
+
width: 66%;
|
75 |
+
margin-right: 1px;
|
76 |
+
}
|
77 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-measurement .sow-measurement-select-unit,
|
78 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field.siteorigin-widget-field-type-measurement .sow-measurement-select-unit,
|
79 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-measurement .sow-measurement-select-unit {
|
80 |
+
width: 33%;
|
81 |
+
margin-left: 1px;
|
82 |
+
}
|
83 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-field-type-slider input[type="number"],
|
84 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field .siteorigin-widget-field-type-slider input[type="number"],
|
85 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field .siteorigin-widget-field-type-slider input[type="number"] {
|
86 |
+
display: none !important;
|
87 |
+
}
|
88 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field .clear,
|
89 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field .clear,
|
90 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field .clear {
|
91 |
+
clear: both;
|
92 |
+
}
|
93 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-media .media-fallback-external,
|
94 |
+
.siteorigin-widgets-query-builder .siteorigin-widget-field.siteorigin-widget-field-type-media .media-fallback-external,
|
95 |
+
.siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-media .media-fallback-external {
|
96 |
+
margin-top: 4px !important;
|
97 |
+
margin-left: 15px !important;
|
98 |
+
max-width: 220px;
|
99 |
+
}
|
100 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button,
|
101 |
+
.siteorigin-widgets-query-builder .button,
|
102 |
+
.siteorigin-widgets-query-builder.media-modal .button,
|
103 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button-secondary,
|
104 |
+
.siteorigin-widgets-query-builder .button-secondary,
|
105 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary {
|
106 |
+
display: inline-block;
|
107 |
+
text-decoration: none;
|
108 |
+
font-size: 13px;
|
109 |
+
line-height: 26px;
|
110 |
+
height: 28px;
|
111 |
+
margin: 0;
|
112 |
+
padding: 0 10px 1px;
|
113 |
+
cursor: pointer;
|
114 |
+
border: 1px solid #cccccc;
|
115 |
+
border-radius: 3px;
|
116 |
+
white-space: nowrap;
|
117 |
+
box-sizing: border-box;
|
118 |
+
font-family: inherit;
|
119 |
+
font-weight: normal;
|
120 |
+
text-transform: capitalize;
|
121 |
+
color: #555;
|
122 |
+
background: #f7f7f7;
|
123 |
+
}
|
124 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button:hover,
|
125 |
+
.siteorigin-widgets-query-builder .button:hover,
|
126 |
+
.siteorigin-widgets-query-builder.media-modal .button:hover,
|
127 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button-secondary:hover,
|
128 |
+
.siteorigin-widgets-query-builder .button-secondary:hover,
|
129 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:hover,
|
130 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button:focus,
|
131 |
+
.siteorigin-widgets-query-builder .button:focus,
|
132 |
+
.siteorigin-widgets-query-builder.media-modal .button:focus,
|
133 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button-secondary:focus,
|
134 |
+
.siteorigin-widgets-query-builder .button-secondary:focus,
|
135 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:focus {
|
136 |
+
background: #fafafa;
|
137 |
+
border-color: #999;
|
138 |
+
color: #23282d;
|
139 |
+
}
|
140 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button:active,
|
141 |
+
.siteorigin-widgets-query-builder .button:active,
|
142 |
+
.siteorigin-widgets-query-builder.media-modal .button:active,
|
143 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button-secondary:active,
|
144 |
+
.siteorigin-widgets-query-builder .button-secondary:active,
|
145 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:active,
|
146 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button:focus,
|
147 |
+
.siteorigin-widgets-query-builder .button:focus,
|
148 |
+
.siteorigin-widgets-query-builder.media-modal .button:focus,
|
149 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button-secondary:focus,
|
150 |
+
.siteorigin-widgets-query-builder .button-secondary:focus,
|
151 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary:focus {
|
152 |
+
outline: none;
|
153 |
+
}
|
154 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button.hidden,
|
155 |
+
.siteorigin-widgets-query-builder .button.hidden,
|
156 |
+
.siteorigin-widgets-query-builder.media-modal .button.hidden,
|
157 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button-secondary.hidden,
|
158 |
+
.siteorigin-widgets-query-builder .button-secondary.hidden,
|
159 |
+
.siteorigin-widgets-query-builder.media-modal .button-secondary.hidden {
|
160 |
+
display: none;
|
161 |
+
}
|
162 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .button.button-small,
|
163 |
+
.siteorigin-widgets-query-builder .button.button-small,
|
164 |
+
.siteorigin-widgets-query-builder.media-modal .button.button-small {
|
165 |
+
height: 25px;
|
166 |
+
line-height: 23px;
|
167 |
+
padding: 0 8px;
|
168 |
+
font-size: 11px;
|
169 |
+
}
|
170 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form select,
|
171 |
+
.siteorigin-widgets-query-builder select,
|
172 |
+
.siteorigin-widgets-query-builder.media-modal select,
|
173 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form input[type=text],
|
174 |
+
.siteorigin-widgets-query-builder input[type=text],
|
175 |
+
.siteorigin-widgets-query-builder.media-modal input[type=text] {
|
176 |
+
width: inherit;
|
177 |
+
margin: 1px;
|
178 |
+
border-radius: 0;
|
179 |
+
font-weight: inherit;
|
180 |
+
border: 1px solid #ddd;
|
181 |
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
|
182 |
+
background-color: #fff;
|
183 |
+
color: #32373c;
|
184 |
+
outline: 0;
|
185 |
+
transition: 50ms border-color ease-in-out;
|
186 |
+
}
|
187 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .ui-autocomplete,
|
188 |
+
.siteorigin-widgets-query-builder .ui-autocomplete,
|
189 |
+
.siteorigin-widgets-query-builder.media-modal .ui-autocomplete {
|
190 |
+
padding: 0;
|
191 |
+
margin: 0;
|
192 |
+
list-style: none;
|
193 |
+
position: absolute;
|
194 |
+
z-index: 10000;
|
195 |
+
border: 1px solid #5b9dd9;
|
196 |
+
box-shadow: 0 1px 2px rgba(30, 140, 190, 0.8);
|
197 |
+
background-color: #fff;
|
198 |
+
}
|
199 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .ui-autocomplete li,
|
200 |
+
.siteorigin-widgets-query-builder .ui-autocomplete li,
|
201 |
+
.siteorigin-widgets-query-builder.media-modal .ui-autocomplete li {
|
202 |
+
margin-bottom: 0;
|
203 |
+
padding: 4px 10px;
|
204 |
+
white-space: nowrap;
|
205 |
+
text-align: left;
|
206 |
+
}
|
207 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .ui-autocomplete li.ui-state-focus,
|
208 |
+
.siteorigin-widgets-query-builder .ui-autocomplete li.ui-state-focus,
|
209 |
+
.siteorigin-widgets-query-builder.media-modal .ui-autocomplete li.ui-state-focus {
|
210 |
+
background-color: #ddd;
|
211 |
+
cursor: pointer;
|
212 |
+
}
|
213 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .media-toolbar-primary,
|
214 |
+
.siteorigin-widgets-query-builder .media-toolbar-primary,
|
215 |
+
.siteorigin-widgets-query-builder.media-modal .media-toolbar-primary {
|
216 |
+
margin-top: 15px;
|
217 |
+
}
|
218 |
+
.elementor-panel #elementor-panel-page-editor .elementor-control-content .siteorigin-widget-form .query-builder-content .query-builder-form-field small,
|
219 |
+
.siteorigin-widgets-query-builder .query-builder-content .query-builder-form-field small,
|
220 |
+
.siteorigin-widgets-query-builder.media-modal .query-builder-content .query-builder-form-field small {
|
221 |
+
margin-top: 5px;
|
222 |
+
}
|
223 |
+
.elementor-panel {
|
224 |
+
width: 400px;
|
225 |
+
}
|
js/slider/jquery.slider.js
CHANGED
@@ -1,239 +1,251 @@
|
|
1 |
/**
|
2 |
* SiteOrigin Slider Javascript.
|
3 |
*
|
4 |
-
* Copyright 2014,
|
5 |
* Released under GPL 2.0 - see http://www.gnu.org/licenses/gpl-2.0.html
|
6 |
*/
|
7 |
|
8 |
-
var
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
} );
|
191 |
-
|
192 |
-
$base.keydown(
|
193 |
-
function(event) {
|
194 |
-
if(event.which === 37) {
|
195 |
-
//left
|
196 |
-
$$.cycle('prev');
|
197 |
-
}
|
198 |
-
else if (event.which === 39) {
|
199 |
-
//right
|
200 |
-
$$.cycle('next');
|
201 |
-
}
|
202 |
-
}
|
203 |
-
);
|
204 |
-
};
|
205 |
-
|
206 |
-
var images = $$.find('img');
|
207 |
-
var imagesLoaded = 0;
|
208 |
-
var sliderLoaded = false;
|
209 |
-
|
210 |
-
// Preload all the images, when they're loaded, then display the slider
|
211 |
-
images.each( function(){
|
212 |
-
var $i = $(this);
|
213 |
-
if( this.complete ) {
|
214 |
-
imagesLoaded++;
|
215 |
-
}
|
216 |
-
else {
|
217 |
-
$(this).one('load', function(){
|
218 |
-
imagesLoaded++;
|
219 |
-
|
220 |
-
if(imagesLoaded === images.length && !sliderLoaded) {
|
221 |
-
setupSlider();
|
222 |
-
sliderLoaded = true;
|
223 |
-
}
|
224 |
-
})
|
225 |
-
// Reset src attribute to force 'load' event for cached images in IE9 and IE10.
|
226 |
-
.attr('src', $(this).attr('src'));
|
227 |
-
}
|
228 |
-
|
229 |
-
if(imagesLoaded === images.length && !sliderLoaded) {
|
230 |
-
setupSlider();
|
231 |
-
sliderLoaded = true;
|
232 |
-
}
|
233 |
-
} );
|
234 |
-
|
235 |
-
if(images.length === 0) {
|
236 |
-
setupSlider();
|
237 |
-
}
|
238 |
-
});
|
239 |
} );
|
1 |
/**
|
2 |
* SiteOrigin Slider Javascript.
|
3 |
*
|
4 |
+
* Copyright 2014, SiteOrigin
|
5 |
* Released under GPL 2.0 - see http://www.gnu.org/licenses/gpl-2.0.html
|
6 |
*/
|
7 |
|
8 |
+
var sowb = window.sowb || {};
|
9 |
+
|
10 |
+
sowb.SiteOriginSlider = function($) {
|
11 |
+
return {
|
12 |
+
playSlideVideo: function(el) {
|
13 |
+
$(el).find('video').each(function(){
|
14 |
+
if(typeof this.play !== 'undefined') {
|
15 |
+
this.play();
|
16 |
+
}
|
17 |
+
});
|
18 |
+
},
|
19 |
+
|
20 |
+
pauseSlideVideo: function(el) {
|
21 |
+
$(el).find('video').each(function(){
|
22 |
+
if(typeof this.pause !== 'undefined') {
|
23 |
+
this.pause();
|
24 |
+
}
|
25 |
+
});
|
26 |
+
},
|
27 |
+
|
28 |
+
setupActiveSlide: function(slider, newActive, speed){
|
29 |
+
// Start by setting up the active sentinel
|
30 |
+
var
|
31 |
+
sentinel = $(slider).find('.cycle-sentinel'),
|
32 |
+
active = $(newActive),
|
33 |
+
video = active.find('video.sow-background-element');
|
34 |
+
|
35 |
+
if( speed == undefined ) {
|
36 |
+
sentinel.css( 'height', active.outerHeight() );
|
37 |
+
}
|
38 |
+
else {
|
39 |
+
sentinel.animate( {height: active.outerHeight()}, speed );
|
40 |
+
}
|
41 |
+
|
42 |
+
if( video.length ) {
|
43 |
+
|
44 |
+
// Resize the video so it fits in the current slide
|
45 |
+
var
|
46 |
+
slideRatio = active.outerWidth() / active.outerHeight(),
|
47 |
+
videoRatio = video.outerWidth() / video.outerHeight();
|
48 |
+
|
49 |
+
if( slideRatio > videoRatio ) {
|
50 |
+
video.css( {
|
51 |
+
'width' : '100%',
|
52 |
+
'height' : 'auto'
|
53 |
+
} );
|
54 |
+
}
|
55 |
+
else {
|
56 |
+
video.css( {
|
57 |
+
'width' : 'auto',
|
58 |
+
'height' : '100%'
|
59 |
+
} );
|
60 |
+
}
|
61 |
+
|
62 |
+
video.css( {
|
63 |
+
'margin-left' : -Math.ceil(video.width()/2),
|
64 |
+
'margin-top' : -Math.ceil(video.height()/2)
|
65 |
+
} );
|
66 |
+
}
|
67 |
+
},
|
68 |
+
};
|
69 |
+
};
|
70 |
+
|
71 |
|
72 |
+
jQuery( function($){
|
73 |
+
sowb.setupSliders = sowb.setupSlider = function() {
|
74 |
+
var siteoriginSlider = new sowb.SiteOriginSlider($);
|
75 |
+
|
76 |
+
$('.sow-slider-images').each(function(){
|
77 |
+
var $$ = $(this);
|
78 |
+
var $p = $$.siblings('.sow-slider-pagination');
|
79 |
+
var $base = $$.closest('.sow-slider-base');
|
80 |
+
var $n = $base.find('.sow-slide-nav');
|
81 |
+
var $slides = $$.find('.sow-slider-image');
|
82 |
+
var settings = $$.data('settings');
|
83 |
+
|
84 |
+
$slides.each(function( index, el) {
|
85 |
+
var $slide = $(el);
|
86 |
+
var urlData = $slide.data('url');
|
87 |
+
|
88 |
+
$slide.click(function(event) {
|
89 |
+
|
90 |
+
if( urlData !== undefined ) {
|
91 |
+
var $t = $(event.target);
|
92 |
+
// If this isn't a link, we'll use the URL of the frame
|
93 |
+
if( $t.prop("tagName") !== 'A' ) {
|
94 |
+
event.preventDefault();
|
95 |
+
window.open(urlData.url, urlData.new_window ? '_blank' : '_self');
|
96 |
+
}
|
97 |
+
}
|
98 |
+
} );
|
99 |
+
});
|
100 |
+
|
101 |
+
var setupSlider = function(){
|
102 |
+
// Show everything for this slider
|
103 |
+
$base.show();
|
104 |
+
|
105 |
+
// Setup each of the slider frames
|
106 |
+
$$.find('.sow-slider-image').each( function(){
|
107 |
+
var $i = $(this);
|
108 |
+
|
109 |
+
$(window)
|
110 |
+
.on('resize panelsStretchRows', function(){
|
111 |
+
$i.css( 'height', $i.find('.sow-slider-image-wrapper').outerHeight() );
|
112 |
+
})
|
113 |
+
.resize();
|
114 |
+
} );
|
115 |
+
|
116 |
+
// Set up the Cycle with videos
|
117 |
+
$$
|
118 |
+
.on({
|
119 |
+
'cycle-after' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag){
|
120 |
+
var $$ = $(this);
|
121 |
+
siteoriginSlider.playSlideVideo(incomingSlideEl);
|
122 |
+
siteoriginSlider.setupActiveSlide( $$, incomingSlideEl );
|
123 |
+
$( incomingSlideEl ).trigger('sowSlideCycleAfter');
|
124 |
+
},
|
125 |
+
|
126 |
+
'cycle-before' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
|
127 |
+
var $$ = $(this);
|
128 |
+
$p.find('> li').removeClass('sow-active').eq(optionHash.slideNum-1).addClass('sow-active');
|
129 |
+
siteoriginSlider.pauseSlideVideo(outgoingSlideEl);
|
130 |
+
siteoriginSlider.setupActiveSlide($$, incomingSlideEl, optionHash.speed);
|
131 |
+
$( incomingSlideEl ).trigger('sowSlideCycleBefore');
|
132 |
+
},
|
133 |
+
|
134 |
+
'cycle-initialized' : function(event, optionHash){
|
135 |
+
siteoriginSlider.playSlideVideo( $(this).find('.cycle-slide-active') );
|
136 |
+
siteoriginSlider.setupActiveSlide( $$, optionHash.slides[0] );
|
137 |
+
|
138 |
+
$p.find('>li').removeClass('sow-active').eq(0).addClass('sow-active');
|
139 |
+
$( this ).find('.cycle-slide-active').trigger( 'sowSlideInitial' );
|
140 |
+
|
141 |
+
if(optionHash.slideCount <= 1) {
|
142 |
+
// Special case when there is only one slide
|
143 |
+
$p.hide();
|
144 |
+
$n.hide();
|
145 |
+
}
|
146 |
+
|
147 |
+
$(window).resize();
|
148 |
+
}
|
149 |
+
})
|
150 |
+
.cycle( {
|
151 |
+
'slides' : '> .sow-slider-image',
|
152 |
+
'speed' : settings.speed,
|
153 |
+
'timeout' : settings.timeout,
|
154 |
+
'swipe' : settings.swipe,
|
155 |
+
'swipe-fx' : 'scrollHorz'
|
156 |
+
} ) ;
|
157 |
+
|
158 |
+
$$ .find('video.sow-background-element').on('loadeddata', function(){
|
159 |
+
siteoriginSlider.setupActiveSlide( $$, $$.find( '.cycle-slide-active' ) );
|
160 |
+
} );
|
161 |
+
|
162 |
+
// Set up showing and hiding navs
|
163 |
+
$p.add($n).hide();
|
164 |
+
if( !$base.hasClass('sow-slider-is-mobile') && $slides.length > 1 ) {
|
165 |
+
|
166 |
+
var toHide = false;
|
167 |
+
$base
|
168 |
+
.mouseenter(function(){
|
169 |
+
$p.add($n).clearQueue().fadeIn(150);
|
170 |
+
toHide = false;
|
171 |
+
})
|
172 |
+
.mouseleave(function(){
|
173 |
+
toHide = true;
|
174 |
+
setTimeout(function(){
|
175 |
+
if( toHide ) {
|
176 |
+
$p.add($n).clearQueue().fadeOut(150);
|
177 |
+
}
|
178 |
+
toHide = false;
|
179 |
+
}, 750);
|
180 |
+
});
|
181 |
+
}
|
182 |
+
|
183 |
+
// Resize the sentinel when ever the window is resized
|
184 |
+
$( window ).resize( function(){
|
185 |
+
siteoriginSlider.setupActiveSlide( $$, $$.find( '.cycle-slide-active' ) );
|
186 |
+
} );
|
187 |
+
|
188 |
+
// Setup clicks on the pagination
|
189 |
+
$p.find( '> li > a' ).click( function(e){
|
190 |
+
e.preventDefault();
|
191 |
+
$$.cycle( 'goto', $(this).data('goto') );
|
192 |
+
} );
|
193 |
+
|
194 |
+
// Clicking on the next and previous navigation buttons
|
195 |
+
$n.find( '> a' ).click( function(e){
|
196 |
+
e.preventDefault();
|
197 |
+
$$.cycle( $(this).data('action') );
|
198 |
+
} );
|
199 |
+
|
200 |
+
$base.keydown(
|
201 |
+
function(event) {
|
202 |
+
if(event.which === 37) {
|
203 |
+
//left
|
204 |
+
$$.cycle('prev');
|
205 |
+
}
|
206 |
+
else if (event.which === 39) {
|
207 |
+
//right
|
208 |
+
$$.cycle('next');
|
209 |
+
}
|
210 |
+
}
|
211 |
+
);
|
212 |
+
};
|
213 |
+
|
214 |
+
var images = $$.find('img');
|
215 |
+
var imagesLoaded = 0;
|
216 |
+
var sliderLoaded = false;
|
217 |
+
|
218 |
+
// Preload all the images, when they're loaded, then display the slider
|
219 |
+
images.each( function(){
|
220 |
+
var $i = $(this);
|
221 |
+
if( this.complete ) {
|
222 |
+
imagesLoaded++;
|
223 |
+
}
|
224 |
+
else {
|
225 |
+
$(this).one('load', function(){
|
226 |
+
imagesLoaded++;
|
227 |
+
|
228 |
+
if(imagesLoaded === images.length && !sliderLoaded) {
|
229 |
+
setupSlider();
|
230 |
+
sliderLoaded = true;
|
231 |
+
}
|
232 |
+
})
|
233 |
+
// Reset src attribute to force 'load' event for cached images in IE9 and IE10.
|
234 |
+
.attr('src', $(this).attr('src'));
|
235 |
+
}
|
236 |
+
|
237 |
+
if(imagesLoaded === images.length && !sliderLoaded) {
|
238 |
+
setupSlider();
|
239 |
+
sliderLoaded = true;
|
240 |
+
}
|
241 |
+
} );
|
242 |
+
|
243 |
+
if(images.length === 0) {
|
244 |
+
setupSlider();
|
245 |
+
}
|
246 |
+
});
|
247 |
+
};
|
248 |
+
sowb.setupSliders();
|
249 |
+
|
250 |
+
$( sowb ).on( 'setup_widgets', sowb.setupSliders );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
} );
|
js/slider/jquery.slider.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var
|
1 |
+
var sowb=window.sowb||{};sowb.SiteOriginSlider=function(e){return{playSlideVideo:function(i){e(i).find("video").each(function(){"undefined"!=typeof this.play&&this.play()})},pauseSlideVideo:function(i){e(i).find("video").each(function(){"undefined"!=typeof this.pause&&this.pause()})},setupActiveSlide:function(i,t,s){var n=e(i).find(".cycle-sentinel"),o=e(t),d=o.find("video.sow-background-element");if(void 0==s?n.css("height",o.outerHeight()):n.animate({height:o.outerHeight()},s),d.length){var c=o.outerWidth()/o.outerHeight(),l=d.outerWidth()/d.outerHeight();c>l?d.css({width:"100%",height:"auto"}):d.css({width:"auto",height:"100%"}),d.css({"margin-left":-Math.ceil(d.width()/2),"margin-top":-Math.ceil(d.height()/2)})}}}},jQuery(function(e){sowb.setupSliders=sowb.setupSlider=function(){var i=new sowb.SiteOriginSlider(e);e(".sow-slider-images").each(function(){var t=e(this),s=t.siblings(".sow-slider-pagination"),n=t.closest(".sow-slider-base"),o=n.find(".sow-slide-nav"),d=t.find(".sow-slider-image"),c=t.data("settings");d.each(function(i,t){var s=e(t),n=s.data("url");s.click(function(i){if(void 0!==n){var t=e(i.target);"A"!==t.prop("tagName")&&(i.preventDefault(),window.open(n.url,n.new_window?"_blank":"_self"))}})});var l=function(){if(n.show(),t.find(".sow-slider-image").each(function(){var i=e(this);e(window).on("resize panelsStretchRows",function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),t.on({"cycle-after":function(t,s,n,o,d){var c=e(this);i.playSlideVideo(o),i.setupActiveSlide(c,o),e(o).trigger("sowSlideCycleAfter")},"cycle-before":function(t,n,o,d,c){var l=e(this);s.find("> li").removeClass("sow-active").eq(n.slideNum-1).addClass("sow-active"),i.pauseSlideVideo(o),i.setupActiveSlide(l,d,n.speed),e(d).trigger("sowSlideCycleBefore")},"cycle-initialized":function(n,d){i.playSlideVideo(e(this).find(".cycle-slide-active")),i.setupActiveSlide(t,d.slides[0]),s.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),e(this).find(".cycle-slide-active").trigger("sowSlideInitial"),d.slideCount<=1&&(s.hide(),o.hide()),e(window).resize()}}).cycle({slides:"> .sow-slider-image",speed:c.speed,timeout:c.timeout,swipe:c.swipe,"swipe-fx":"scrollHorz"}),t.find("video.sow-background-element").on("loadeddata",function(){i.setupActiveSlide(t,t.find(".cycle-slide-active"))}),s.add(o).hide(),!n.hasClass("sow-slider-is-mobile")&&d.length>1){var l=!1;n.mouseenter(function(){s.add(o).clearQueue().fadeIn(150),l=!1}).mouseleave(function(){l=!0,setTimeout(function(){l&&s.add(o).clearQueue().fadeOut(150),l=!1},750)})}e(window).resize(function(){i.setupActiveSlide(t,t.find(".cycle-slide-active"))}),s.find("> li > a").click(function(i){i.preventDefault(),t.cycle("goto",e(this).data("goto"))}),o.find("> a").click(function(i){i.preventDefault(),t.cycle(e(this).data("action"))}),n.keydown(function(e){37===e.which?t.cycle("prev"):39===e.which&&t.cycle("next")})},a=t.find("img"),r=0,u=!1;a.each(function(){e(this);this.complete?r++:e(this).one("load",function(){r++,r!==a.length||u||(l(),u=!0)}).attr("src",e(this).attr("src")),r!==a.length||u||(l(),u=!0)}),0===a.length&&l()})},sowb.setupSliders(),e(sowb).on("setup_widgets",sowb.setupSliders)});
|
readme.txt
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
=== SiteOrigin Widgets Bundle ===
|
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.7
|
5 |
-
Stable tag: 1.
|
6 |
-
Build time:
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
|
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -51,6 +52,25 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
= 1.7.2 - 09 November 2016 =
|
55 |
* Made fixes to pass PHP 7 compatibility checks.
|
56 |
* Image Widget: Get alt and title text from chosen image.
|
1 |
=== SiteOrigin Widgets Bundle ===
|
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.7.2
|
5 |
+
Stable tag: 1.8
|
6 |
+
Build time: 2017-01-31T13:37:28+02:00
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
+
Donate link: https://siteorigin.com/downloads/contribution/
|
10 |
|
11 |
== Description ==
|
12 |
|
52 |
|
53 |
== Changelog ==
|
54 |
|
55 |
+
= 1.8 - 31 January 2017 =
|
56 |
+
* Introduced compatibility system.
|
57 |
+
* Added compatibility with Elementor and Beaver Builder.
|
58 |
+
* Ensure radio inputs in repeaters have their checked property set correctly.
|
59 |
+
* Various Call to Action widget improvements.
|
60 |
+
* Use `text-align: center;` for features icons.
|
61 |
+
* Always use HTTPS for Google Webfonts.
|
62 |
+
* Post Selector: Exclude current post id
|
63 |
+
* Post Selector: Add filter returned query
|
64 |
+
* Post Carousel: Prevent empty title output.
|
65 |
+
* Google Maps: Add ability to set link for Static Map.
|
66 |
+
* Social Links: Add title field and title attributes for links.
|
67 |
+
* Features: Add title text field for features
|
68 |
+
* Button Widget: Add Font setting
|
69 |
+
* Contact: Add radio field Type
|
70 |
+
* Taxonomy: New Window Setting
|
71 |
+
* Added a way of specifying post types for link field.
|
72 |
+
* Introduced a global widget setup action.
|
73 |
+
|
74 |
= 1.7.2 - 09 November 2016 =
|
75 |
* Made fixes to pass PHP 7 compatibility checks.
|
76 |
* Image Widget: Get alt and title text from chosen image.
|
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.
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /languages
|
8 |
Author: SiteOrigin
|
@@ -12,7 +12,7 @@ License: GPL3
|
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
-
define('SOW_BUNDLE_VERSION', '1.
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
@@ -24,6 +24,9 @@ if( !function_exists('siteorigin_widget_get_plugin_path') ) {
|
|
24 |
include plugin_dir_path(__FILE__).'base/base.php';
|
25 |
include plugin_dir_path(__FILE__).'icons/icons.php';
|
26 |
}
|
|
|
|
|
|
|
27 |
|
28 |
class SiteOrigin_Widgets_Bundle {
|
29 |
|
@@ -710,6 +713,7 @@ class SiteOrigin_Widgets_Bundle {
|
|
710 |
if ( ! empty( $wp_registered_widgets[$id] ) ) {
|
711 |
$widget = $wp_registered_widgets[$id]['callback'][0];
|
712 |
if ( !empty($widget) && is_object($widget) && is_subclass_of($widget, 'SiteOrigin_Widget') && is_active_widget( false, false, $widget->id_base ) ) {
|
|
|
713 |
$opt_wid = get_option( 'widget_' . $widget->id_base );
|
714 |
preg_match( '/-([0-9]+$)/', $id, $num_match );
|
715 |
$widget_instance = $opt_wid[ $num_match[1] ];
|
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.8
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /languages
|
8 |
Author: SiteOrigin
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
+
define('SOW_BUNDLE_VERSION', '1.8');
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
24 |
include plugin_dir_path(__FILE__).'base/base.php';
|
25 |
include plugin_dir_path(__FILE__).'icons/icons.php';
|
26 |
}
|
27 |
+
if( ! class_exists('SiteOrigin_Widgets_Bundle_Compatibility') ) {
|
28 |
+
include_once plugin_dir_path( __FILE__ ) . 'compat/compat.php';
|
29 |
+
}
|
30 |
|
31 |
class SiteOrigin_Widgets_Bundle {
|
32 |
|
713 |
if ( ! empty( $wp_registered_widgets[$id] ) ) {
|
714 |
$widget = $wp_registered_widgets[$id]['callback'][0];
|
715 |
if ( !empty($widget) && is_object($widget) && is_subclass_of($widget, 'SiteOrigin_Widget') && is_active_widget( false, false, $widget->id_base ) ) {
|
716 |
+
/* @var $widget SiteOrigin_Widget */
|
717 |
$opt_wid = get_option( 'widget_' . $widget->id_base );
|
718 |
preg_match( '/-([0-9]+$)/', $id, $num_match );
|
719 |
$widget_instance = $opt_wid[ $num_match[1] ];
|
widgets/button/button.php
CHANGED
@@ -130,6 +130,12 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
|
|
130 |
'label' => __('Use hover effects', 'so-widgets-bundle'),
|
131 |
),
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
'font_size' => array(
|
134 |
'type' => 'select',
|
135 |
'label' => __('Font size', 'so-widgets-bundle'),
|
@@ -233,7 +239,8 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
|
|
233 |
*/
|
234 |
function get_less_variables($instance){
|
235 |
if( empty( $instance ) || empty( $instance['design'] ) ) return array();
|
236 |
-
|
|
|
237 |
'button_width' => isset( $instance['design']['width'] ) ? $instance['design']['width'] : '',
|
238 |
'has_button_width' => empty( $instance['design']['width'] ) ? 'false' : 'true',
|
239 |
'button_color' => $instance['design']['button_color'],
|
@@ -244,8 +251,22 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
|
|
244 |
'padding' => $instance['design']['padding'] . 'em',
|
245 |
'has_text' => empty( $instance['text'] ) ? 'false' : 'true',
|
246 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
|
|
|
|
|
|
|
|
|
|
249 |
/**
|
250 |
* Make sure the instance is the most up to date version.
|
251 |
*
|
130 |
'label' => __('Use hover effects', 'so-widgets-bundle'),
|
131 |
),
|
132 |
|
133 |
+
'font' => array(
|
134 |
+
'type' => 'font',
|
135 |
+
'label' => __( 'Font', 'so-widgets-bundle' ),
|
136 |
+
'default' => 'default'
|
137 |
+
),
|
138 |
+
|
139 |
'font_size' => array(
|
140 |
'type' => 'select',
|
141 |
'label' => __('Font size', 'so-widgets-bundle'),
|
239 |
*/
|
240 |
function get_less_variables($instance){
|
241 |
if( empty( $instance ) || empty( $instance['design'] ) ) return array();
|
242 |
+
|
243 |
+
$less_vars = array(
|
244 |
'button_width' => isset( $instance['design']['width'] ) ? $instance['design']['width'] : '',
|
245 |
'has_button_width' => empty( $instance['design']['width'] ) ? 'false' : 'true',
|
246 |
'button_color' => $instance['design']['button_color'],
|
251 |
'padding' => $instance['design']['padding'] . 'em',
|
252 |
'has_text' => empty( $instance['text'] ) ? 'false' : 'true',
|
253 |
);
|
254 |
+
|
255 |
+
if ( ! empty( $instance['design']['font'] ) ) {
|
256 |
+
$font = siteorigin_widget_get_font( $instance['design']['font'] );
|
257 |
+
$less_vars['button_font'] = $font['family'];
|
258 |
+
if ( ! empty( $font['weight'] ) ) {
|
259 |
+
$less_vars['button_font_weight'] = $font['weight'];
|
260 |
+
}
|
261 |
+
}
|
262 |
+
return $less_vars;
|
263 |
}
|
264 |
|
265 |
+
function get_google_font_fields( $instance ) {
|
266 |
+
return array(
|
267 |
+
$instance['design']['font'],
|
268 |
+
);
|
269 |
+
}
|
270 |
/**
|
271 |
* Make sure the instance is the most up to date version.
|
272 |
*
|
widgets/button/styles/atom.less
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
@import "../../../base/less/mixins";
|
2 |
|
|
|
|
|
3 |
@button_width: '';
|
4 |
@has_button_width: false;
|
5 |
@button_color: #41a9d5;
|
6 |
@border_color: darken(@button_color, 15%);
|
7 |
@text_color: #FFFFFF;
|
8 |
|
|
|
|
|
|
|
9 |
@font_size: 1em;
|
10 |
@rounding: 0.25em;
|
11 |
@padding: 1em;
|
@@ -19,6 +24,7 @@
|
|
19 |
width: @button_width;
|
20 |
}
|
21 |
.btn_width();
|
|
|
22 |
|
23 |
font-size: @font_size;
|
24 |
padding: @padding @padding*2;
|
1 |
@import "../../../base/less/mixins";
|
2 |
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
@button_width: '';
|
6 |
@has_button_width: false;
|
7 |
@button_color: #41a9d5;
|
8 |
@border_color: darken(@button_color, 15%);
|
9 |
@text_color: #FFFFFF;
|
10 |
|
11 |
+
@button_font: default;
|
12 |
+
@button_font_weight: default;
|
13 |
+
|
14 |
@font_size: 1em;
|
15 |
@rounding: 0.25em;
|
16 |
@padding: 1em;
|
24 |
width: @button_width;
|
25 |
}
|
26 |
.btn_width();
|
27 |
+
.font(@button_font, @button_font_weight);
|
28 |
|
29 |
font-size: @font_size;
|
30 |
padding: @padding @padding*2;
|
widgets/button/styles/flat.less
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
@import "../../../base/less/mixins";
|
2 |
|
|
|
|
|
3 |
@button_width: '';
|
4 |
@has_button_width: false;
|
5 |
@button_color: #41a9d5;
|
6 |
@border_color: darken(@button_color, 5%);
|
7 |
@text_color: #FFFFFF;
|
8 |
|
|
|
|
|
|
|
9 |
@font_size: 1em;
|
10 |
@rounding: 0.25em;
|
11 |
@padding: 1em;
|
@@ -20,6 +25,7 @@
|
|
20 |
width: @button_width;
|
21 |
}
|
22 |
.btn_width();
|
|
|
23 |
|
24 |
font-size: @font_size;
|
25 |
padding: @padding @padding*2;
|
1 |
@import "../../../base/less/mixins";
|
2 |
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
@button_width: '';
|
6 |
@has_button_width: false;
|
7 |
@button_color: #41a9d5;
|
8 |
@border_color: darken(@button_color, 5%);
|
9 |
@text_color: #FFFFFF;
|
10 |
|
11 |
+
@button_font: default;
|
12 |
+
@button_font_weight: default;
|
13 |
+
|
14 |
@font_size: 1em;
|
15 |
@rounding: 0.25em;
|
16 |
@padding: 1em;
|
25 |
width: @button_width;
|
26 |
}
|
27 |
.btn_width();
|
28 |
+
.font(@button_font, @button_font_weight);
|
29 |
|
30 |
font-size: @font_size;
|
31 |
padding: @padding @padding*2;
|
widgets/button/styles/wire.less
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
@import "../../../base/less/mixins";
|
2 |
|
|
|
|
|
3 |
@button_width: '';
|
4 |
@has_button_width: false;
|
5 |
@button_color: #41a9d5;
|
6 |
@text_color: #FFFFFF;
|
7 |
|
|
|
|
|
|
|
8 |
@font_size: 1em;
|
9 |
@rounding: 0.25em;
|
10 |
@padding: 1em;
|
@@ -19,6 +24,7 @@
|
|
19 |
width: @button_width;
|
20 |
}
|
21 |
.btn_width();
|
|
|
22 |
|
23 |
font-size: @font_size;
|
24 |
padding: @padding @padding*2;
|
1 |
@import "../../../base/less/mixins";
|
2 |
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
@button_width: '';
|
6 |
@has_button_width: false;
|
7 |
@button_color: #41a9d5;
|
8 |
@text_color: #FFFFFF;
|
9 |
|
10 |
+
@button_font: default;
|
11 |
+
@button_font_weight: default;
|
12 |
+
|
13 |
@font_size: 1em;
|
14 |
@rounding: 0.25em;
|
15 |
@padding: 1em;
|
24 |
width: @button_width;
|
25 |
}
|
26 |
.btn_width();
|
27 |
+
.font(@button_font, @button_font_weight);
|
28 |
|
29 |
font-size: @font_size;
|
30 |
padding: @padding @padding*2;
|
widgets/contact/contact.php
CHANGED
@@ -108,6 +108,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
108 |
'textarea' => __( 'Text Area', 'so-widgets-bundle' ),
|
109 |
'select' => __( 'Dropdown Select', 'so-widgets-bundle' ),
|
110 |
'checkboxes' => __( 'Checkboxes', 'so-widgets-bundle' ),
|
|
|
111 |
),
|
112 |
'state_emitter' => array(
|
113 |
'callback' => 'select',
|
@@ -143,7 +144,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
143 |
)
|
144 |
),
|
145 |
|
146 |
-
// This are for select and checkboxes
|
147 |
'options' => array(
|
148 |
'type' => 'repeater',
|
149 |
'label' => __( 'Options', 'so-widgets-bundle' ),
|
@@ -158,7 +159,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
158 |
|
159 |
// These are only required for a few states
|
160 |
'state_handler' => array(
|
161 |
-
'field_type_{$repeater}[select,checkboxes]' => array('show'),
|
162 |
'_else[field_type_{$repeater}]' => array( 'hide' ),
|
163 |
),
|
164 |
),
|
@@ -712,7 +713,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
712 |
|
713 |
?><div class="sow-form-field sow-form-field-<?php echo sanitize_html_class( $field['type'] ) ?>"><?php
|
714 |
|
715 |
-
$is_text_input_field = ($field['type'] != 'select' && $field['type'] != 'checkboxes');
|
716 |
// label should be rendered before the field, then CSS will do the exact positioning.
|
717 |
$render_label_before_field = ( $label_position != 'below' && $label_position != 'inside' ) || ( $label_position == 'inside' && ! $is_text_input_field );
|
718 |
if( empty( $label_position ) || $render_label_before_field ) {
|
108 |
'textarea' => __( 'Text Area', 'so-widgets-bundle' ),
|
109 |
'select' => __( 'Dropdown Select', 'so-widgets-bundle' ),
|
110 |
'checkboxes' => __( 'Checkboxes', 'so-widgets-bundle' ),
|
111 |
+
'radio' => __( 'Radio', 'so-widgets-bundle' ),
|
112 |
),
|
113 |
'state_emitter' => array(
|
114 |
'callback' => 'select',
|
144 |
)
|
145 |
),
|
146 |
|
147 |
+
// This are for select, radio, and checkboxes
|
148 |
'options' => array(
|
149 |
'type' => 'repeater',
|
150 |
'label' => __( 'Options', 'so-widgets-bundle' ),
|
159 |
|
160 |
// These are only required for a few states
|
161 |
'state_handler' => array(
|
162 |
+
'field_type_{$repeater}[select,checkboxes,radio]' => array( 'show' ),
|
163 |
'_else[field_type_{$repeater}]' => array( 'hide' ),
|
164 |
),
|
165 |
),
|
713 |
|
714 |
?><div class="sow-form-field sow-form-field-<?php echo sanitize_html_class( $field['type'] ) ?>"><?php
|
715 |
|
716 |
+
$is_text_input_field = ( $field['type'] != 'select' && $field['type'] != 'radio' && $field['type'] != 'checkboxes');
|
717 |
// label should be rendered before the field, then CSS will do the exact positioning.
|
718 |
$render_label_before_field = ( $label_position != 'below' && $label_position != 'inside' ) || ( $label_position == 'inside' && ! $is_text_input_field );
|
719 |
if( empty( $label_position ) || $render_label_before_field ) {
|
widgets/contact/fields/checkboxes.class.php
CHANGED
@@ -3,21 +3,21 @@
|
|
3 |
class SiteOrigin_Widget_ContactForm_Field_Checkboxes extends SiteOrigin_Widget_ContactForm_Field_Base {
|
4 |
|
5 |
public function render_field( $options ) {
|
6 |
-
|
7 |
-
if ( ! empty( $options['field']['options'] ) ) {
|
8 |
if ( empty( $options['value'] ) || ! is_array( $options['value'] ) ) {
|
9 |
$options['value'] = array();
|
10 |
}
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
22 |
}
|
23 |
}
|
3 |
class SiteOrigin_Widget_ContactForm_Field_Checkboxes extends SiteOrigin_Widget_ContactForm_Field_Base {
|
4 |
|
5 |
public function render_field( $options ) {
|
6 |
+
if ( ! empty( $options['field']['options'] ) ):
|
|
|
7 |
if ( empty( $options['value'] ) || ! is_array( $options['value'] ) ) {
|
8 |
$options['value'] = array();
|
9 |
}
|
10 |
+
?>
|
11 |
+
<ul>
|
12 |
+
<?php foreach ( $options['field']['options'] as $i => $option ): ?>
|
13 |
+
<li>
|
14 |
+
<label>
|
15 |
+
<input type="checkbox" value="<?php echo esc_attr( $option['value'] ) ?>" name="<?php echo esc_attr( $options['field_name'] ) ?>[]" id="<?php echo esc_attr( $options['field_id'] ) . '-' . $i ?>"<?php echo checked( in_array( $option['value'], $options['value'] ), true, false ) ?>/>
|
16 |
+
<?php echo esc_html( $option['value'] ); ?>
|
17 |
+
</label>
|
18 |
+
</li>
|
19 |
+
<?php endforeach; ?>
|
20 |
+
</ul>
|
21 |
+
<?php endif;
|
22 |
}
|
23 |
}
|
widgets/contact/fields/radio.class.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SiteOrigin_Widget_ContactForm_Field_Radio extends SiteOrigin_Widget_ContactForm_Field_Base {
|
4 |
+
|
5 |
+
public function render_field( $options ) {
|
6 |
+
if ( ! empty( $options['field']['options'] ) ): ?>
|
7 |
+
<ul>
|
8 |
+
<?php foreach ( $options['field']['options'] as $i => $option ): ?>
|
9 |
+
<li>
|
10 |
+
<label>
|
11 |
+
<input type="radio" value="<?php echo esc_attr( $option['value'] ) ?>" name="<?php echo esc_attr( $options['field_name'] ) ?>" id="<?php echo esc_attr( $options['field_id'] ) . '-' . $i ?>"<?php echo checked( $option['value'], $options['value'], false ) ?>/>
|
12 |
+
<?php echo esc_html( $option['value'] ); ?>
|
13 |
+
</label>
|
14 |
+
</li>
|
15 |
+
<?php endforeach; ?>
|
16 |
+
</ul>
|
17 |
+
<?php endif;
|
18 |
+
}
|
19 |
+
}
|
widgets/contact/styles/default.less
CHANGED
@@ -64,7 +64,7 @@
|
|
64 |
border-radius: 0;
|
65 |
}
|
66 |
|
67 |
-
&.sow-form-field-checkboxes {
|
68 |
ul {
|
69 |
list-style: none;
|
70 |
margin: 0;
|
64 |
border-radius: 0;
|
65 |
}
|
66 |
|
67 |
+
&.sow-form-field-checkboxes, &.sow-form-field-radio {
|
68 |
ul {
|
69 |
list-style: none;
|
70 |
margin: 0;
|
widgets/cta/css/style.css
CHANGED
@@ -12,15 +12,15 @@
|
|
12 |
display: table;
|
13 |
clear: both;
|
14 |
}
|
15 |
-
.sow-cta-base .sow-cta-text
|
16 |
-
.sow-cta-base .sow-cta-text
|
17 |
.sow-cta-base .sow-cta-text p {
|
18 |
margin: 0.4em 0;
|
19 |
}
|
20 |
-
.sow-cta-base .sow-cta-text
|
21 |
margin-top: 0;
|
22 |
}
|
23 |
-
.sow-cta-base .sow-cta-text
|
24 |
.sow-cta-base .sow-cta-text p {
|
25 |
margin-bottom: 0;
|
26 |
font-weight: normal;
|
12 |
display: table;
|
13 |
clear: both;
|
14 |
}
|
15 |
+
.sow-cta-base .sow-cta-text .sow-cta-title,
|
16 |
+
.sow-cta-base .sow-cta-text .sow-cta-subtitle,
|
17 |
.sow-cta-base .sow-cta-text p {
|
18 |
margin: 0.4em 0;
|
19 |
}
|
20 |
+
.sow-cta-base .sow-cta-text .sow-cta-title {
|
21 |
margin-top: 0;
|
22 |
}
|
23 |
+
.sow-cta-base .sow-cta-text .sow-cta-subtitle,
|
24 |
.sow-cta-base .sow-cta-text p {
|
25 |
margin-bottom: 0;
|
26 |
font-weight: normal;
|
widgets/cta/cta.php
CHANGED
@@ -80,6 +80,14 @@ class SiteOrigin_Widget_Cta_Widget extends SiteOrigin_Widget {
|
|
80 |
'type' => 'color',
|
81 |
'label' => __('Border color', 'so-widgets-bundle'),
|
82 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
'button_align' => array(
|
84 |
'type' => 'select',
|
85 |
'label' => __( 'Button align', 'so-widgets-bundle' ),
|
@@ -107,6 +115,8 @@ class SiteOrigin_Widget_Cta_Widget extends SiteOrigin_Widget {
|
|
107 |
return array(
|
108 |
'border_color' => $instance['design']['border_color'],
|
109 |
'background_color' => $instance['design']['background_color'],
|
|
|
|
|
110 |
'button_align' => $instance['design']['button_align'],
|
111 |
);
|
112 |
}
|
80 |
'type' => 'color',
|
81 |
'label' => __('Border color', 'so-widgets-bundle'),
|
82 |
),
|
83 |
+
'title_color' => array(
|
84 |
+
'type' => 'color',
|
85 |
+
'label' => __('Title color', 'so-widgets-bundle'),
|
86 |
+
),
|
87 |
+
'subtitle_color' => array(
|
88 |
+
'type' => 'color',
|
89 |
+
'label' => __('Subtitle color', 'so-widgets-bundle'),
|
90 |
+
),
|
91 |
'button_align' => array(
|
92 |
'type' => 'select',
|
93 |
'label' => __( 'Button align', 'so-widgets-bundle' ),
|
115 |
return array(
|
116 |
'border_color' => $instance['design']['border_color'],
|
117 |
'background_color' => $instance['design']['background_color'],
|
118 |
+
'title_color' => $instance['design']['title_color'],
|
119 |
+
'subtitle_color' => $instance['design']['subtitle_color'],
|
120 |
'button_align' => $instance['design']['button_align'],
|
121 |
);
|
122 |
}
|
widgets/cta/styles/default.less
CHANGED
@@ -1,12 +1,25 @@
|
|
1 |
|
2 |
@border_color: #E3E3E3;
|
3 |
@background_color: #F8F8F8;
|
|
|
|
|
4 |
|
5 |
.sow-cta-base {
|
6 |
border-color: @border_color;
|
7 |
background-color: @background_color;
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
@button_align: right;
|
11 |
|
12 |
.sow-cta-base {
|
@@ -37,4 +50,4 @@
|
|
37 |
}
|
38 |
}
|
39 |
.so-widget-sow-button-align();
|
40 |
-
}
|
1 |
|
2 |
@border_color: #E3E3E3;
|
3 |
@background_color: #F8F8F8;
|
4 |
+
@title_color: default;
|
5 |
+
@subtitle_color: default;
|
6 |
|
7 |
.sow-cta-base {
|
8 |
border-color: @border_color;
|
9 |
background-color: @background_color;
|
10 |
+
|
11 |
+
.sow-cta-text {
|
12 |
+
.sow-cta- {
|
13 |
+
&title {
|
14 |
+
color: @title_color;
|
15 |
+
}
|
16 |
|
17 |
+
&subtitle {
|
18 |
+
color: @subtitle_color;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
@button_align: right;
|
24 |
|
25 |
.sow-cta-base {
|
50 |
}
|
51 |
}
|
52 |
.so-widget-sow-button-align();
|
53 |
+
}
|
widgets/cta/tpl/default.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
<div class="sow-cta-wrapper">
|
4 |
|
5 |
<div class="sow-cta-text">
|
6 |
-
<h4><?php echo wp_kses_post( $instance['title'] ) ?></h4>
|
7 |
-
<h5><?php echo wp_kses_post( $instance['sub_title'] ) ?></h5>
|
8 |
</div>
|
9 |
|
10 |
<?php $this->sub_widget('SiteOrigin_Widget_Button_Widget', $args, $instance['button']) ?>
|
11 |
|
12 |
</div>
|
13 |
|
14 |
-
</div>
|
3 |
<div class="sow-cta-wrapper">
|
4 |
|
5 |
<div class="sow-cta-text">
|
6 |
+
<h4 class="sow-cta-title"><?php echo wp_kses_post( $instance['title'] ) ?></h4>
|
7 |
+
<h5 class="sow-cta-subtitle"><?php echo wp_kses_post( $instance['sub_title'] ) ?></h5>
|
8 |
</div>
|
9 |
|
10 |
<?php $this->sub_widget('SiteOrigin_Widget_Button_Widget', $args, $instance['button']) ?>
|
11 |
|
12 |
</div>
|
13 |
|
14 |
+
</div>
|
widgets/features/css/style.css
CHANGED
@@ -36,14 +36,12 @@
|
|
36 |
text-decoration: none;
|
37 |
display: block;
|
38 |
color: #FFFFFF;
|
39 |
-
width:
|
40 |
height: 1em;
|
41 |
text-align: center;
|
42 |
position: absolute;
|
43 |
top: 50%;
|
44 |
-
left: 50%;
|
45 |
margin-top: -0.5em;
|
46 |
-
margin-left: -0.5em;
|
47 |
background-size: contain;
|
48 |
}
|
49 |
.sow-features-list .sow-features-feature h5 {
|
36 |
text-decoration: none;
|
37 |
display: block;
|
38 |
color: #FFFFFF;
|
39 |
+
width: 100%;
|
40 |
height: 1em;
|
41 |
text-align: center;
|
42 |
position: absolute;
|
43 |
top: 50%;
|
|
|
44 |
margin-top: -0.5em;
|
|
|
45 |
background-size: contain;
|
46 |
}
|
47 |
.sow-features-list .sow-features-feature h5 {
|
widgets/features/features.php
CHANGED
@@ -63,6 +63,11 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
|
|
63 |
'label' => __('Icon', 'so-widgets-bundle'),
|
64 |
),
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
'icon_color' => array(
|
67 |
'type' => 'color',
|
68 |
'label' => __('Icon color', 'so-widgets-bundle'),
|
63 |
'label' => __('Icon', 'so-widgets-bundle'),
|
64 |
),
|
65 |
|
66 |
+
'icon_title' => array(
|
67 |
+
'type' => 'text',
|
68 |
+
'label' => __( 'Icon title', 'so-widgets-bundle' ),
|
69 |
+
),
|
70 |
+
|
71 |
'icon_color' => array(
|
72 |
'type' => 'color',
|
73 |
'label' => __('Icon color', 'so-widgets-bundle'),
|
widgets/features/tpl/default.php
CHANGED
@@ -4,63 +4,66 @@ $last_row = floor( ( count($instance['features']) - 1 ) / $instance['per_row'] )
|
|
4 |
|
5 |
<div class="sow-features-list <?php if( $instance['responsive'] ) echo 'sow-features-responsive'; ?>">
|
6 |
|
7 |
-
<?php
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
|
|
|
29 |
}
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
if(!empty($feature['icon_color'])) $icon_styles[] = 'color: '.$feature['icon_color'];
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
61 |
</div>
|
62 |
-
</div>
|
63 |
|
64 |
-
|
|
|
65 |
|
66 |
</div>
|
4 |
|
5 |
<div class="sow-features-list <?php if( $instance['responsive'] ) echo 'sow-features-responsive'; ?>">
|
6 |
|
7 |
+
<?php if( isset( $instance['features'] ) ) : ?>
|
8 |
+
<?php foreach( $instance['features'] as $i => $feature ) : ?>
|
9 |
|
10 |
+
<?php if( $i % $instance['per_row'] == 0 && $i != 0 ) : ?>
|
11 |
+
<div class="sow-features-clear"></div>
|
12 |
+
<?php endif; ?>
|
13 |
|
14 |
+
<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 ) ?>%">
|
15 |
|
16 |
+
<?php if( !empty( $feature['more_url'] ) && $instance['icon_link'] ) echo '<a href="' . sow_esc_url( $feature['more_url'] ) . '" ' . ( $instance['new_window'] ? 'target="_blank"' : '' ) . '>'; ?>
|
17 |
+
<div
|
18 |
+
class="sow-icon-container <?php echo !empty($instance['container_shape']) ? 'sow-container-' . esc_attr($instance['container_shape']) : 'sow-container-none'?>"
|
19 |
+
style="font-size: <?php echo intval($instance['container_size']) . esc_attr( $instance['container_size_unit'] ); ?>; color: <?php echo esc_attr($feature['container_color']) ?>; width: <?php echo intval($instance['container_size']) . esc_attr( $instance['container_size_unit'] ); ?>; height: <?php echo intval($instance['container_size']) . esc_attr( $instance['container_size_unit'] ); ?>;"
|
20 |
+
<?php echo ( ! empty( $feature['icon_title'] ) ? 'title="' . esc_attr( $feature['icon_title'] ) . '"' : '' ); ?>>
|
21 |
+
<?php
|
22 |
+
$icon_styles = array();
|
23 |
+
if( !empty($feature['icon_image']) ) {
|
24 |
+
$size = empty( $feature['icon_image_size'] ) ? 'thumbnail' : $feature['icon_image_size'];
|
25 |
+
$attachment = wp_get_attachment_image_src( $feature['icon_image'], $size );
|
26 |
+
if(!empty($attachment)) {
|
27 |
+
$icon_styles[] = 'background-image: url(' . sow_esc_url($attachment[0]) . ')';
|
28 |
+
if(!empty($instance['icon_size'])) $icon_styles[] = 'font-size: '.intval($instance['icon_size']) . esc_attr( $instance['icon_size_unit'] );
|
29 |
|
30 |
+
?><div class="sow-icon-image" style="<?php echo implode('; ', $icon_styles) ?>"></div><?php
|
31 |
+
}
|
32 |
}
|
33 |
+
else {
|
34 |
+
if(!empty($instance['icon_size'])) $icon_styles[] = 'font-size: '.intval($instance['icon_size']).'px';
|
35 |
+
if(!empty($feature['icon_color'])) $icon_styles[] = 'color: '.$feature['icon_color'];
|
|
|
36 |
|
37 |
+
echo siteorigin_widget_get_icon($feature['icon'], $icon_styles);
|
38 |
+
}
|
39 |
+
?>
|
40 |
+
</div>
|
41 |
+
<?php if( !empty( $feature['more_url'] ) && $instance['icon_link'] ) echo '</a>'; ?>
|
42 |
|
43 |
+
<div class="textwidget">
|
44 |
+
<?php if(!empty($feature['title'])) : ?>
|
45 |
+
<h5>
|
46 |
+
<?php if( !empty( $feature['more_url'] ) && $instance['title_link'] ) echo '<a href="' . sow_esc_url( $feature['more_url'] ) . '" ' . ( $instance['new_window'] ? 'target="_blank"' : '' ) . '>'; ?>
|
47 |
+
<?php echo wp_kses_post( $feature['title'] ) ?>
|
48 |
+
<?php if( !empty( $feature['more_url'] ) && $instance['title_link'] ) echo '</a>'; ?>
|
49 |
+
</h5>
|
50 |
+
<?php endif; ?>
|
51 |
|
52 |
+
<?php if(!empty($feature['text'])) : ?>
|
53 |
+
<p><?php echo wp_kses_post( $feature['text'] ) ?></p>
|
54 |
+
<?php endif; ?>
|
55 |
|
56 |
+
<?php if(!empty($feature['more_text'])) : ?>
|
57 |
+
<p class="sow-more-text">
|
58 |
+
<?php if( !empty( $feature['more_url'] ) ) echo '<a href="' . sow_esc_url( $feature['more_url'] ) . '" ' . ( $instance['new_window'] ? 'target="_blank"' : '' ) . '>'; ?>
|
59 |
+
<?php echo wp_kses_post( $feature['more_text'] ) ?>
|
60 |
+
<?php if( !empty( $feature['more_url'] ) ) echo '</a>'; ?>
|
61 |
+
</p>
|
62 |
+
<?php endif; ?>
|
63 |
+
</div>
|
64 |
</div>
|
|
|
65 |
|
66 |
+
<?php endforeach; ?>
|
67 |
+
<?php endif; ?>
|
68 |
|
69 |
</div>
|
widgets/google-map/google-map.php
CHANGED
@@ -87,6 +87,26 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
87 |
'default' => 480,
|
88 |
'label' => __( 'Height', 'so-widgets-bundle' )
|
89 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
'zoom' => array(
|
91 |
'type' => 'slider',
|
92 |
'label' => __( 'Zoom level', 'so-widgets-bundle' ),
|
@@ -397,12 +417,11 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
397 |
$mrkr_src = wp_get_attachment_image_src( $instance['markers']['marker_icon'] );
|
398 |
|
399 |
$styles = $this->get_styles( $instance );
|
400 |
-
|
401 |
if ( $settings['map_type'] == 'static' ) {
|
402 |
-
$src_url = $this->get_static_image_src( $instance, $settings['width'], $settings['height'], ! empty( $styles ) ? $styles['styles'] : array() );
|
403 |
-
|
404 |
return array(
|
405 |
-
'src_url'
|
|
|
|
|
406 |
);
|
407 |
} else {
|
408 |
$markers = $instance['markers'];
|
87 |
'default' => 480,
|
88 |
'label' => __( 'Height', 'so-widgets-bundle' )
|
89 |
),
|
90 |
+
'destination_url' => array(
|
91 |
+
'type' => 'link',
|
92 |
+
'label' => __( 'Destination URL', 'so-widgets-bundle' ),
|
93 |
+
'hidden' => true,
|
94 |
+
'state_handler' => array(
|
95 |
+
'map_type[static]' => array('show'),
|
96 |
+
'_else[map_type]' => array('hide'),
|
97 |
+
),
|
98 |
+
),
|
99 |
+
|
100 |
+
'new_window' => array(
|
101 |
+
'type' => 'checkbox',
|
102 |
+
'default' => false,
|
103 |
+
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
104 |
+
'hidden' => true,
|
105 |
+
'state_handler' => array(
|
106 |
+
'map_type[static]' => array('show'),
|
107 |
+
'_else[map_type]' => array('hide'),
|
108 |
+
),
|
109 |
+
),
|
110 |
'zoom' => array(
|
111 |
'type' => 'slider',
|
112 |
'label' => __( 'Zoom level', 'so-widgets-bundle' ),
|
417 |
$mrkr_src = wp_get_attachment_image_src( $instance['markers']['marker_icon'] );
|
418 |
|
419 |
$styles = $this->get_styles( $instance );
|
|
|
420 |
if ( $settings['map_type'] == 'static' ) {
|
|
|
|
|
421 |
return array(
|
422 |
+
'src_url' => $this->get_static_image_src( $instance, $settings['width'], $settings['height'], ! empty( $styles ) ? $styles['styles'] : array() ),
|
423 |
+
'destination_url' => $instance['settings']['destination_url'],
|
424 |
+
'new_window' => $instance['settings']['new_window'],
|
425 |
);
|
426 |
} else {
|
427 |
$markers = $instance['markers'];
|
widgets/google-map/js/js-map.js
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
var sowb = window.sowb || {};
|
2 |
|
3 |
sowb.SiteOriginGoogleMap = function($) {
|
@@ -10,9 +12,9 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
10 |
'New York, NY, United States',
|
11 |
],
|
12 |
showMap: function(element, location, options) {
|
13 |
-
|
14 |
var zoom = Number(options.zoom);
|
15 |
-
|
16 |
if ( !zoom ) zoom = 14;
|
17 |
|
18 |
var userMapTypeId = 'user_map_style';
|
@@ -64,15 +66,15 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
64 |
map.setCenter(center);
|
65 |
});
|
66 |
}
|
67 |
-
|
68 |
this.linkAutocompleteField(options.autocomplete, options.autocompleteElement, map, options);
|
69 |
this.showMarkers(options.markerPositions, map, options);
|
70 |
this.showDirections(options.directions, map, options);
|
71 |
},
|
72 |
-
|
73 |
linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
|
74 |
if( autocomplete && autocompleteElement ) {
|
75 |
-
|
76 |
var updateMapLocation = function ( address ) {
|
77 |
if ( this.inputAddress != address ) {
|
78 |
this.inputAddress = address;
|
@@ -88,7 +90,7 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
88 |
);
|
89 |
}
|
90 |
}.bind( this );
|
91 |
-
|
92 |
var $autocompleteElement = $( autocompleteElement );
|
93 |
autocomplete.addListener( 'place_changed', function () {
|
94 |
var place = autocomplete.getPlace();
|
@@ -100,14 +102,14 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
100 |
}
|
101 |
}
|
102 |
}.bind( this ) );
|
103 |
-
|
104 |
google.maps.event.addDomListener( autocompleteElement, 'keypress', function ( event ) {
|
105 |
var key = event.keyCode || event.which;
|
106 |
if ( key == '13' ) {
|
107 |
event.preventDefault();
|
108 |
}
|
109 |
} );
|
110 |
-
|
111 |
$autocompleteElement.focusin( function () {
|
112 |
if ( !this.resultsObserver ) {
|
113 |
var autocompleteResultsContainer = document.querySelector( '.pac-container' );
|
@@ -120,13 +122,13 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
120 |
updateMapLocation( topQuery );
|
121 |
}
|
122 |
} );
|
123 |
-
|
124 |
var config = { attributes: true, childList: true, characterData: true };
|
125 |
-
|
126 |
this.resultsObserver.observe( autocompleteResultsContainer, config );
|
127 |
}
|
128 |
}.bind( this ) );
|
129 |
-
|
130 |
var revGeocode = function ( latLng ) {
|
131 |
this.getGeocoder().geocode( { location: latLng }, function ( results, status ) {
|
132 |
if ( status == google.maps.GeocoderStatus.OK ) {
|
@@ -141,17 +143,17 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
141 |
}
|
142 |
}.bind( this ) );
|
143 |
}.bind( this );
|
144 |
-
|
145 |
map.addListener( 'click', function ( event ) {
|
146 |
revGeocode( event.latLng );
|
147 |
} );
|
148 |
-
|
149 |
this.centerMarker.addListener( 'dragend', function ( event ) {
|
150 |
revGeocode( event.latLng );
|
151 |
} );
|
152 |
}
|
153 |
},
|
154 |
-
|
155 |
showMarkers: function(markerPositions, map, options) {
|
156 |
if ( markerPositions && markerPositions.length ) {
|
157 |
var geocoder = new google.maps.Geocoder();
|
@@ -250,7 +252,7 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
250 |
// Init any autocomplete fields first.
|
251 |
var $autoCompleteFields = $( '.sow-google-map-autocomplete' );
|
252 |
var autoCompleteInit = new $.Deferred();
|
253 |
-
if( $autoCompleteFields.length == 0) {
|
254 |
autoCompleteInit.resolve();
|
255 |
} else {
|
256 |
$autoCompleteFields.each(function (index, element) {
|
@@ -258,9 +260,9 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
258 |
element,
|
259 |
{types: ['address']}
|
260 |
);
|
261 |
-
|
262 |
var $mapField = $(element).siblings('.sow-google-map-canvas');
|
263 |
-
|
264 |
if ($mapField.length > 0) {
|
265 |
var options = $mapField.data('options');
|
266 |
options.autocomplete = autocomplete;
|
@@ -278,16 +280,16 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
278 |
}
|
279 |
}.bind(this));
|
280 |
}
|
281 |
-
|
282 |
autoCompleteInit.done(function(){
|
283 |
$('.sow-google-map-canvas').each(function (index, element) {
|
284 |
var $$ = $(element);
|
285 |
-
|
286 |
if( $$.data( 'initialized' ) ) {
|
287 |
// Already initialized so continue to next element.
|
288 |
return true;
|
289 |
}
|
290 |
-
|
291 |
var options = $$.data( 'options' );
|
292 |
var address = options.address;
|
293 |
// If no address was specified, but we have markers, use the first marker as the map center.
|
@@ -297,7 +299,7 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
297 |
address = markers[0].place;
|
298 |
}
|
299 |
}
|
300 |
-
|
301 |
this.getLocation( address ).done(
|
302 |
function ( location ) {
|
303 |
this.showMap( $$.get( 0 ), location, options );
|
@@ -306,7 +308,7 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
306 |
).fail( function () {
|
307 |
$$.append( '<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>' );
|
308 |
} );
|
309 |
-
|
310 |
}.bind(this));
|
311 |
}.bind(this));
|
312 |
},
|
@@ -334,12 +336,12 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
334 |
}
|
335 |
}
|
336 |
}
|
337 |
-
|
338 |
if ( location.hasOwnProperty( 'location' ) ) {
|
339 |
// We're using entered latlng coordinates directly
|
340 |
locationPromise.resolve( location.location );
|
341 |
} else if ( location.hasOwnProperty( 'address' ) ) {
|
342 |
-
|
343 |
// Either user entered an address, or fall back to defaults and use the geocoder.
|
344 |
if ( !location.address ) {
|
345 |
var rndIndx = parseInt( Math.random() * this.DEFAULT_LOCATIONS.length );
|
@@ -365,30 +367,54 @@ function soGoogleMapInitialize() {
|
|
365 |
}
|
366 |
|
367 |
jQuery(function ($) {
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
var
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
if(mapOptions) {
|
384 |
-
if( hasLibraries ) {
|
385 |
-
apiUrl += '&libraries=' + mapOptions.libraries.join(',');
|
386 |
}
|
387 |
-
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
}
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
});
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
|
3 |
var sowb = window.sowb || {};
|
4 |
|
5 |
sowb.SiteOriginGoogleMap = function($) {
|
12 |
'New York, NY, United States',
|
13 |
],
|
14 |
showMap: function(element, location, options) {
|
15 |
+
|
16 |
var zoom = Number(options.zoom);
|
17 |
+
|
18 |
if ( !zoom ) zoom = 14;
|
19 |
|
20 |
var userMapTypeId = 'user_map_style';
|
66 |
map.setCenter(center);
|
67 |
});
|
68 |
}
|
69 |
+
|
70 |
this.linkAutocompleteField(options.autocomplete, options.autocompleteElement, map, options);
|
71 |
this.showMarkers(options.markerPositions, map, options);
|
72 |
this.showDirections(options.directions, map, options);
|
73 |
},
|
74 |
+
|
75 |
linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
|
76 |
if( autocomplete && autocompleteElement ) {
|
77 |
+
|
78 |
var updateMapLocation = function ( address ) {
|
79 |
if ( this.inputAddress != address ) {
|
80 |
this.inputAddress = address;
|
90 |
);
|
91 |
}
|
92 |
}.bind( this );
|
93 |
+
|
94 |
var $autocompleteElement = $( autocompleteElement );
|
95 |
autocomplete.addListener( 'place_changed', function () {
|
96 |
var place = autocomplete.getPlace();
|
102 |
}
|
103 |
}
|
104 |
}.bind( this ) );
|
105 |
+
|
106 |
google.maps.event.addDomListener( autocompleteElement, 'keypress', function ( event ) {
|
107 |
var key = event.keyCode || event.which;
|
108 |
if ( key == '13' ) {
|
109 |
event.preventDefault();
|
110 |
}
|
111 |
} );
|
112 |
+
|
113 |
$autocompleteElement.focusin( function () {
|
114 |
if ( !this.resultsObserver ) {
|
115 |
var autocompleteResultsContainer = document.querySelector( '.pac-container' );
|
122 |
updateMapLocation( topQuery );
|
123 |
}
|
124 |
} );
|
125 |
+
|
126 |
var config = { attributes: true, childList: true, characterData: true };
|
127 |
+
|
128 |
this.resultsObserver.observe( autocompleteResultsContainer, config );
|
129 |
}
|
130 |
}.bind( this ) );
|
131 |
+
|
132 |
var revGeocode = function ( latLng ) {
|
133 |
this.getGeocoder().geocode( { location: latLng }, function ( results, status ) {
|
134 |
if ( status == google.maps.GeocoderStatus.OK ) {
|
143 |
}
|
144 |
}.bind( this ) );
|
145 |
}.bind( this );
|
146 |
+
|
147 |
map.addListener( 'click', function ( event ) {
|
148 |
revGeocode( event.latLng );
|
149 |
} );
|
150 |
+
|
151 |
this.centerMarker.addListener( 'dragend', function ( event ) {
|
152 |
revGeocode( event.latLng );
|
153 |
} );
|
154 |
}
|
155 |
},
|
156 |
+
|
157 |
showMarkers: function(markerPositions, map, options) {
|
158 |
if ( markerPositions && markerPositions.length ) {
|
159 |
var geocoder = new google.maps.Geocoder();
|
252 |
// Init any autocomplete fields first.
|
253 |
var $autoCompleteFields = $( '.sow-google-map-autocomplete' );
|
254 |
var autoCompleteInit = new $.Deferred();
|
255 |
+
if( $autoCompleteFields.length == 0 || typeof google.maps.places === 'undefined') {
|
256 |
autoCompleteInit.resolve();
|
257 |
} else {
|
258 |
$autoCompleteFields.each(function (index, element) {
|
260 |
element,
|
261 |
{types: ['address']}
|
262 |
);
|
263 |
+
|
264 |
var $mapField = $(element).siblings('.sow-google-map-canvas');
|
265 |
+
|
266 |
if ($mapField.length > 0) {
|
267 |
var options = $mapField.data('options');
|
268 |
options.autocomplete = autocomplete;
|
280 |
}
|
281 |
}.bind(this));
|
282 |
}
|
283 |
+
|
284 |
autoCompleteInit.done(function(){
|
285 |
$('.sow-google-map-canvas').each(function (index, element) {
|
286 |
var $$ = $(element);
|
287 |
+
|
288 |
if( $$.data( 'initialized' ) ) {
|
289 |
// Already initialized so continue to next element.
|
290 |
return true;
|
291 |
}
|
292 |
+
|
293 |
var options = $$.data( 'options' );
|
294 |
var address = options.address;
|
295 |
// If no address was specified, but we have markers, use the first marker as the map center.
|
299 |
address = markers[0].place;
|
300 |
}
|
301 |
}
|
302 |
+
|
303 |
this.getLocation( address ).done(
|
304 |
function ( location ) {
|
305 |
this.showMap( $$.get( 0 ), location, options );
|
308 |
).fail( function () {
|
309 |
$$.append( '<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>' );
|
310 |
} );
|
311 |
+
|
312 |
}.bind(this));
|
313 |
}.bind(this));
|
314 |
},
|
336 |
}
|
337 |
}
|
338 |
}
|
339 |
+
|
340 |
if ( location.hasOwnProperty( 'location' ) ) {
|
341 |
// We're using entered latlng coordinates directly
|
342 |
locationPromise.resolve( location.location );
|
343 |
} else if ( location.hasOwnProperty( 'address' ) ) {
|
344 |
+
|
345 |
// Either user entered an address, or fall back to defaults and use the geocoder.
|
346 |
if ( !location.address ) {
|
347 |
var rndIndx = parseInt( Math.random() * this.DEFAULT_LOCATIONS.length );
|
367 |
}
|
368 |
|
369 |
jQuery(function ($) {
|
370 |
+
|
371 |
+
sowb.setupGoogleMaps = function(){
|
372 |
+
var libraries = [];
|
373 |
+
var apiKey;
|
374 |
+
$('.sow-google-map-canvas').each(function(index, element) {
|
375 |
+
var $this = $(element);
|
376 |
+
var mapOptions = $this.data( 'options' );
|
377 |
+
var mapsApiLoaded = typeof window.google !== 'undefined' && typeof window.google.maps !== 'undefined';
|
378 |
+
var isLoaded = function (element) {
|
379 |
+
var lib = window.google.maps[element];
|
380 |
+
return window.google.maps.hasOwnProperty(element) && typeof lib !== 'undefined' && lib !== null;
|
381 |
+
};
|
382 |
+
var hasLibraries = typeof mapOptions.libraries !== 'undefined' && mapOptions.libraries !== null;
|
383 |
+
if(hasLibraries) {
|
384 |
+
mapsApiLoaded = mapsApiLoaded && mapOptions.libraries.every(isLoaded);
|
|
|
|
|
|
|
385 |
}
|
386 |
+
|
387 |
+
if (mapsApiLoaded) {
|
388 |
+
soGoogleMapInitialize();
|
389 |
+
} else {
|
390 |
+
if(mapOptions) {
|
391 |
+
if( hasLibraries ) {
|
392 |
+
libraries = libraries.concat(mapOptions.libraries);
|
393 |
+
}
|
394 |
+
if( !apiKey && mapOptions.apiKey ) {
|
395 |
+
apiKey = mapOptions.apiKey;
|
396 |
+
}
|
397 |
+
}
|
398 |
}
|
399 |
+
});
|
400 |
+
|
401 |
+
var apiUrl = 'https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize';
|
402 |
+
if(libraries && libraries.length) {
|
403 |
+
apiUrl += '&libraries=' + libraries.join(',');
|
404 |
+
}
|
405 |
+
if(apiKey) {
|
406 |
+
apiUrl += '&key=' + apiKey;
|
407 |
}
|
408 |
+
var script = $('<script type="text/javascript" src="' + apiUrl + '">');
|
409 |
+
var $body = $('body');
|
410 |
+
if( $body.find('script[src="' + apiUrl + '"]').length == 0 ) {
|
411 |
+
$('body').append(script);
|
412 |
+
} else {
|
413 |
+
|
414 |
+
}
|
415 |
+
};
|
416 |
+
sowb.setupGoogleMaps();
|
417 |
+
|
418 |
+
$( sowb ).on( 'setup_widgets', sowb.setupGoogleMaps );
|
419 |
+
|
420 |
});
|
widgets/google-map/js/js-map.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(window.jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var n="user_map_style",a={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,n]}},s=new google.maps.Map(e,a),r={name:t.mapName},l=t.mapStyles;if(l){var d=new google.maps.StyledMapType(l,r);s.mapTypes.set(n,d),s.setMapTypeId(n)}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:s,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var
|
1 |
+
function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(window.jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var n="user_map_style",a={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,n]}},s=new google.maps.Map(e,a),r={name:t.mapName},l=t.mapStyles;if(l){var d=new google.maps.StyledMapType(l,r);s.mapTypes.set(n,d),s.setMapTypeId(n)}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:s,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var p;google.maps.event.addDomListener(s,"idle",function(){p=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(p)})}this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,s,t),this.showMarkers(t.markerPositions,s,t),this.showDirections(t.directions,s,t)},linkAutocompleteField:function(o,t,i,n){if(o&&t){var a=function(e){this.inputAddress!=e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){var o=e.keyCode||e.which;"13"==o&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),n=t+(i?", "+i:"");n&&a(n)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t==google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){var i=new google.maps.Geocoder;this.infoWindows=[],e.forEach(function(e){var n=function(){i.geocode({address:e.place},function(i,a){if(a==google.maps.GeocoderStatus.OK){var s=new google.maps.Marker({position:i[0].geometry.location,map:o,draggable:t.markersDraggable,icon:t.markerIcon,title:""});if(e.hasOwnProperty("info")&&e.info){var r={content:e.info};e.hasOwnProperty("info_max_width")&&e.info_max_width&&(r.maxWidth=e.info_max_width);var l=t.markerInfoDisplay;r.disableAutoPan="always"==l;var d=new google.maps.InfoWindow(r);this.infoWindows.push(d);var p=l;"always"==l&&(p="click",d.open(o,s)),s.addListener(p,function(){d.open(o,s),"always"==l||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==d&&e.close()})}.bind(this)),"mouseover"==l&&s.addListener("mouseout",function(){setTimeout(function(){d.close()},100)})}}else a==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(n,1e3*Math.random(),e)}.bind(this))}.bind(this);setTimeout(n,1e3*Math.random(),e)}.bind(this))}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);var i=new google.maps.DirectionsService;i.route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(e,o){o==google.maps.DirectionsStatus.OK&&t.setDirections(e)})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0==o.length||"undefined"==typeof google.maps.places?t.resolve():o.each(function(o,i){var n=new google.maps.places.Autocomplete(i,{types:["address"]}),a=e(i).siblings(".sow-google-map-canvas");if(a.length>0){var s=a.data("options");s.autocomplete=n,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(a.get(0),e,s),a.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){a.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>"),t.reject()})}}.bind(this)),t.done(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var n=i.data("options"),a=n.address;if(!a){var s=n.markerPositions;s&&s.length&&(a=s[0].place)}this.getLocation(a).done(function(e){this.showMap(i.get(0),e,n),i.data("initialized")}.bind(this)).fail(function(){i.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")})}.bind(this))}.bind(this))},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,n={address:o};if(o&&o.indexOf(",")>-1){var a=o.split(",");a&&2==a.length&&(t=new google.maps.LatLng(a[0],a[1]),isNaN(t.lat())||isNaN(t.lng())||(n={location:{lat:t.lat(),lng:t.lng()}}))}if(n.hasOwnProperty("location"))i.resolve(n.location);else if(n.hasOwnProperty("address")){if(!n.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);n.address=this.DEFAULT_LOCATIONS[s]}this.getGeocoder().geocode(n,function(e,o){o==google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o==google.maps.GeocoderStatus.ZERO_RESULTS&&i.reject(o)})}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[];e(".sow-google-map-canvas").each(function(i,n){var a=e(n),s=a.data("options"),r="undefined"!=typeof window.google&&"undefined"!=typeof window.google.maps,l=function(e){var o=window.google.maps[e];return window.google.maps.hasOwnProperty(e)&&"undefined"!=typeof o&&null!==o},d="undefined"!=typeof s.libraries&&null!==s.libraries;d&&(r=r&&s.libraries.every(l)),r?soGoogleMapInitialize():s&&(d&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey))});var i="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize";t&&t.length&&(i+="&libraries="+t.join(",")),o&&(i+="&key="+o);var n=e('<script type="text/javascript" src="'+i+'">'),a=e("body");0==a.find('script[src="'+i+'"]').length&&e("body").append(n)},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)});
|
widgets/google-map/tpl/static-map.php
CHANGED
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
1 |
<img
|
2 |
border="0"
|
3 |
src="<?php echo sow_esc_url( $src_url ) ?>">
|
|
|
|
|
|
1 |
+
<?php if( !empty( $destination_url ) ): ?>
|
2 |
+
<a href="<?php echo sow_esc_url( $destination_url ) ?>" <?php echo $new_window ? 'target="_blank"' : '' ?>>
|
3 |
+
<?php endif; ?>
|
4 |
+
|
5 |
<img
|
6 |
border="0"
|
7 |
src="<?php echo sow_esc_url( $src_url ) ?>">
|
8 |
+
|
9 |
+
<?php
|
10 |
+
if( !empty( $destination_url ) ) echo '</a>';
|
widgets/headline/headline.php
CHANGED
@@ -38,6 +38,15 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
38 |
'type' => 'text',
|
39 |
'label' => __( 'Text', 'so-widgets-bundle' ),
|
40 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
'tag' => array(
|
42 |
'type' => 'select',
|
43 |
'label' => __( 'HTML Tag', 'so-widgets-bundle' ),
|
@@ -56,6 +65,10 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
56 |
'type' => 'color',
|
57 |
'label' => __('Color', 'so-widgets-bundle'),
|
58 |
),
|
|
|
|
|
|
|
|
|
59 |
'font' => array(
|
60 |
'type' => 'font',
|
61 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
@@ -96,6 +109,15 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
96 |
'type' => 'text',
|
97 |
'label' => __('Text', 'so-widgets-bundle')
|
98 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
'tag' => array(
|
100 |
'type' => 'select',
|
101 |
'label' => __( 'HTML Tag', 'so-widgets-bundle' ),
|
@@ -114,6 +136,10 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
114 |
'type' => 'color',
|
115 |
'label' => __('Color', 'so-widgets-bundle'),
|
116 |
),
|
|
|
|
|
|
|
|
|
117 |
'font' => array(
|
118 |
'type' => 'font',
|
119 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
@@ -226,6 +252,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
226 |
|
227 |
// All the headline attributes
|
228 |
$less_vars['headline_tag'] = isset( $instance['headline']['tag'] ) ? $instance['headline']['tag'] : false;
|
|
|
229 |
$less_vars['headline_align'] = isset( $instance['headline']['align'] ) ? $instance['headline']['align'] : false;
|
230 |
$less_vars['headline_color'] = isset( $instance['headline']['color'] ) ? $instance['headline']['color'] : false;
|
231 |
$less_vars['headline_font_size'] = isset( $instance['headline']['font_size'] ) ? $instance['headline']['font_size'] : false;
|
@@ -243,6 +270,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
243 |
|
244 |
// Set the sub headline attributes
|
245 |
$less_vars['sub_headline_align'] = isset( $instance['sub_headline']['align'] ) ? $instance['sub_headline']['align'] : false;
|
|
|
246 |
$less_vars['sub_headline_tag'] = isset( $instance['sub_headline']['tag'] ) ? $instance['sub_headline']['tag'] : false;
|
247 |
$less_vars['sub_headline_color'] = isset( $instance['sub_headline']['color'] ) ? $instance['sub_headline']['color'] : false;
|
248 |
$less_vars['sub_headline_font_size'] = isset( $instance['sub_headline']['font_size'] ) ? $instance['sub_headline']['font_size'] : false;
|
@@ -288,8 +316,12 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
288 |
|
289 |
return array(
|
290 |
'headline' => $instance['headline']['text'],
|
|
|
|
|
291 |
'headline_tag' => $instance['headline']['tag'],
|
292 |
'sub_headline' => $instance['sub_headline']['text'],
|
|
|
|
|
293 |
'sub_headline_tag' => $instance['sub_headline']['tag'],
|
294 |
'order' => $instance['order'],
|
295 |
'has_divider' => ! empty( $instance['divider'] ) && $instance['divider']['style'] != 'none'
|
38 |
'type' => 'text',
|
39 |
'label' => __( 'Text', 'so-widgets-bundle' ),
|
40 |
),
|
41 |
+
'destination_url' => array(
|
42 |
+
'type' => 'link',
|
43 |
+
'label' => __( 'Destination URL', 'so-widgets-bundle' ),
|
44 |
+
),
|
45 |
+
'new_window' => array(
|
46 |
+
'type' => 'checkbox',
|
47 |
+
'default' => false,
|
48 |
+
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
49 |
+
),
|
50 |
'tag' => array(
|
51 |
'type' => 'select',
|
52 |
'label' => __( 'HTML Tag', 'so-widgets-bundle' ),
|
65 |
'type' => 'color',
|
66 |
'label' => __('Color', 'so-widgets-bundle'),
|
67 |
),
|
68 |
+
'hover_color' => array(
|
69 |
+
'type' => 'color',
|
70 |
+
'label' => __('Hover Color', 'so-widgets-bundle'),
|
71 |
+
),
|
72 |
'font' => array(
|
73 |
'type' => 'font',
|
74 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
109 |
'type' => 'text',
|
110 |
'label' => __('Text', 'so-widgets-bundle')
|
111 |
),
|
112 |
+
'destination_url' => array(
|
113 |
+
'type' => 'link',
|
114 |
+
'label' => __( 'Destination URL', 'so-widgets-bundle' ),
|
115 |
+
),
|
116 |
+
'new_window' => array(
|
117 |
+
'type' => 'checkbox',
|
118 |
+
'default' => false,
|
119 |
+
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
120 |
+
),
|
121 |
'tag' => array(
|
122 |
'type' => 'select',
|
123 |
'label' => __( 'HTML Tag', 'so-widgets-bundle' ),
|
136 |
'type' => 'color',
|
137 |
'label' => __('Color', 'so-widgets-bundle'),
|
138 |
),
|
139 |
+
'hover_color' => array(
|
140 |
+
'type' => 'color',
|
141 |
+
'label' => __('Hover Color', 'so-widgets-bundle'),
|
142 |
+
),
|
143 |
'font' => array(
|
144 |
'type' => 'font',
|
145 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
252 |
|
253 |
// All the headline attributes
|
254 |
$less_vars['headline_tag'] = isset( $instance['headline']['tag'] ) ? $instance['headline']['tag'] : false;
|
255 |
+
$less_vars['headline_hover_color'] = isset( $instance['headline']['hover_color'] ) ? $instance['headline']['hover_color'] : false;
|
256 |
$less_vars['headline_align'] = isset( $instance['headline']['align'] ) ? $instance['headline']['align'] : false;
|
257 |
$less_vars['headline_color'] = isset( $instance['headline']['color'] ) ? $instance['headline']['color'] : false;
|
258 |
$less_vars['headline_font_size'] = isset( $instance['headline']['font_size'] ) ? $instance['headline']['font_size'] : false;
|
270 |
|
271 |
// Set the sub headline attributes
|
272 |
$less_vars['sub_headline_align'] = isset( $instance['sub_headline']['align'] ) ? $instance['sub_headline']['align'] : false;
|
273 |
+
$less_vars['sub_headline_hover_color'] = isset( $instance['sub_headline']['hover_color'] ) ? $instance['sub_headline']['hover_color'] : false;
|
274 |
$less_vars['sub_headline_tag'] = isset( $instance['sub_headline']['tag'] ) ? $instance['sub_headline']['tag'] : false;
|
275 |
$less_vars['sub_headline_color'] = isset( $instance['sub_headline']['color'] ) ? $instance['sub_headline']['color'] : false;
|
276 |
$less_vars['sub_headline_font_size'] = isset( $instance['sub_headline']['font_size'] ) ? $instance['sub_headline']['font_size'] : false;
|
316 |
|
317 |
return array(
|
318 |
'headline' => $instance['headline']['text'],
|
319 |
+
'headline_destination_url' => $instance['headline']['destination_url'],
|
320 |
+
'headline_new_window' => $instance['headline']['new_window'],
|
321 |
'headline_tag' => $instance['headline']['tag'],
|
322 |
'sub_headline' => $instance['sub_headline']['text'],
|
323 |
+
'sub_headline_destination_url' => $instance['sub_headline']['destination_url'],
|
324 |
+
'sub_headline_new_window' => $instance['headline']['new_window'],
|
325 |
'sub_headline_tag' => $instance['sub_headline']['tag'],
|
326 |
'order' => $instance['order'],
|
327 |
'has_divider' => ! empty( $instance['divider'] ) && $instance['divider']['style'] != 'none'
|
widgets/headline/styles/default.less
CHANGED
@@ -10,6 +10,7 @@
|
|
10 |
@headline_margin: default;
|
11 |
@headline_align: center;
|
12 |
@headline_color: default;
|
|
|
13 |
|
14 |
@sub_headline_tag: h3;
|
15 |
@sub_headline_font: default;
|
@@ -19,6 +20,7 @@
|
|
19 |
@sub_headline_margin: default;
|
20 |
@sub_headline_align: center;
|
21 |
@sub_headline_color: default;
|
|
|
22 |
|
23 |
@divider_style: solid;
|
24 |
@divider_width: 80%;
|
@@ -38,6 +40,13 @@
|
|
38 |
|
39 |
margin-top: @headline_margin;
|
40 |
margin-bottom: @headline_margin;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
@{sub_headline_tag}.sow-sub-headline {
|
@@ -49,6 +58,13 @@
|
|
49 |
|
50 |
margin-top: @sub_headline_margin;
|
51 |
margin-bottom: @sub_headline_margin;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
.decoration {
|
10 |
@headline_margin: default;
|
11 |
@headline_align: center;
|
12 |
@headline_color: default;
|
13 |
+
@headline_hover_color: default;
|
14 |
|
15 |
@sub_headline_tag: h3;
|
16 |
@sub_headline_font: default;
|
20 |
@sub_headline_margin: default;
|
21 |
@sub_headline_align: center;
|
22 |
@sub_headline_color: default;
|
23 |
+
@sub_headline_hover_color: default;
|
24 |
|
25 |
@divider_style: solid;
|
26 |
@divider_width: 80%;
|
40 |
|
41 |
margin-top: @headline_margin;
|
42 |
margin-bottom: @headline_margin;
|
43 |
+
|
44 |
+
& a {
|
45 |
+
color: @headline_color;
|
46 |
+
&:hover {
|
47 |
+
color: @headline_hover_color;
|
48 |
+
}
|
49 |
+
}
|
50 |
}
|
51 |
|
52 |
@{sub_headline_tag}.sow-sub-headline {
|
58 |
|
59 |
margin-top: @sub_headline_margin;
|
60 |
margin-bottom: @sub_headline_margin;
|
61 |
+
|
62 |
+
& a {
|
63 |
+
color: @sub_headline_color;
|
64 |
+
&:hover {
|
65 |
+
color: @sub_headline_hover_color;
|
66 |
+
}
|
67 |
+
}
|
68 |
}
|
69 |
|
70 |
.decoration {
|
widgets/headline/tpl/default.php
CHANGED
@@ -4,7 +4,16 @@
|
|
4 |
switch( $item ) {
|
5 |
case 'headline' :
|
6 |
if( !empty( $headline ) ) {
|
7 |
-
echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
break;
|
10 |
|
@@ -20,7 +29,16 @@
|
|
20 |
|
21 |
case 'sub_headline' :
|
22 |
if( !empty( $sub_headline ) ) {
|
23 |
-
echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
break;
|
26 |
}
|
4 |
switch( $item ) {
|
5 |
case 'headline' :
|
6 |
if( !empty( $headline ) ) {
|
7 |
+
echo "<$headline_tag class='sow-headline'>";
|
8 |
+
|
9 |
+
if( !empty( $headline_destination_url ) ): ?>
|
10 |
+
<a href="<?php echo sow_esc_url( $headline_destination_url ) ?>" <?php echo $headline_new_window ? 'target="_blank"' : '' ?>>
|
11 |
+
<?php
|
12 |
+
endif;
|
13 |
+
|
14 |
+
echo wp_kses_post( $headline );
|
15 |
+
if( !empty( $headline_destination_url ) ) echo '</a>';
|
16 |
+
echo "</$headline_tag>";
|
17 |
}
|
18 |
break;
|
19 |
|
29 |
|
30 |
case 'sub_headline' :
|
31 |
if( !empty( $sub_headline ) ) {
|
32 |
+
echo "<$sub_headline_tag class='sow-sub-headline'>";
|
33 |
+
|
34 |
+
if( !empty( $sub_headline_destination_url ) ): ?>
|
35 |
+
<a href="<?php echo sow_esc_url( $sub_headline_destination_url ) ?>" <?php echo $sub_headline_new_window ? 'target="_blank"' : '' ?>>
|
36 |
+
<?php
|
37 |
+
endif;
|
38 |
+
|
39 |
+
echo wp_kses_post( $sub_headline );
|
40 |
+
if( !empty( $sub_headline_destination_url ) ) echo '</a>';
|
41 |
+
echo "</$sub_headline_tag>";
|
42 |
}
|
43 |
break;
|
44 |
}
|
widgets/image-grid/js/image-grid.js
CHANGED
@@ -1,45 +1,51 @@
|
|
1 |
-
jQuery
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
alignImages();
|
40 |
|
41 |
-
|
|
|
|
|
42 |
|
43 |
-
|
44 |
|
45 |
-
} );
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
var sowb = window.sowb || {};
|
3 |
|
4 |
+
jQuery( function($){
|
5 |
+
sowb.setupImageGrids = function(){
|
6 |
+
$('.sow-image-grid-wrapper').each( function(){
|
7 |
+
var $$ = $(this);
|
8 |
|
9 |
+
var maxWidth = $$.data('max-width'),
|
10 |
+
maxHeight = $$.data('max-height');
|
11 |
|
12 |
+
if( maxWidth !== undefined || maxHeight !== undefined ) {
|
13 |
+
$$.find('img').each( function(){
|
14 |
+
var $img = $(this).css('display', 'block'),
|
15 |
+
ratio = $img.width() / $img.height();
|
16 |
|
17 |
+
var width = [];
|
18 |
|
19 |
+
// Lets set the widths of the image
|
20 |
+
if( maxWidth != undefined && $img.width() > maxWidth ) {
|
21 |
+
width.push( maxWidth );
|
22 |
+
}
|
23 |
|
24 |
+
if( maxHeight != undefined && $img.height() > maxHeight ) {
|
25 |
+
width.push( Math.round( maxHeight * ratio ) );
|
26 |
+
}
|
27 |
|
28 |
+
if( width.length ) {
|
29 |
+
width = Math.min.apply( Math, width );
|
30 |
+
$img.css('max-width', width);
|
31 |
+
}
|
32 |
|
33 |
+
} );
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
$$.find('img').css('display', 'block');
|
37 |
+
}
|
38 |
|
39 |
+
var alignImages = function(){
|
40 |
+
};
|
41 |
+
alignImages();
|
42 |
|
43 |
+
$(window).resize(alignImages);
|
|
|
44 |
|
45 |
+
} );
|
46 |
+
};
|
47 |
+
sowb.setupImageGrids();
|
48 |
|
49 |
+
$( sowb ).on( 'setup_widgets', sowb.setupImageGrids );
|
50 |
|
51 |
+
} );
|
widgets/image-grid/js/image-grid.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(i){i(".sow-image-grid-wrapper").each(function(){var
|
1 |
+
var sowb=window.sowb||{};jQuery(function(i){sowb.setupImageGrids=function(){i(".sow-image-grid-wrapper").each(function(){var s=i(this),t=s.data("max-width"),a=s.data("max-height");void 0!==t||void 0!==a?s.find("img").each(function(){var s=i(this).css("display","block"),d=s.width()/s.height(),o=[];void 0!=t&&s.width()>t&&o.push(t),void 0!=a&&s.height()>a&&o.push(Math.round(a*d)),o.length&&(o=Math.min.apply(Math,o),s.css("max-width",o))}):s.find("img").css("display","block");var d=function(){};d(),i(window).resize(d)})},sowb.setupImageGrids(),i(sowb).on("setup_widgets",sowb.setupImageGrids)});
|
widgets/image/image.php
CHANGED
@@ -102,8 +102,19 @@ class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
|
|
102 |
}
|
103 |
|
104 |
public function get_template_variables( $instance, $args ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
return array(
|
106 |
-
'title' =>
|
107 |
'title_position' => $instance['title_position'],
|
108 |
'image' => $instance['image'],
|
109 |
'size' => $instance['size'],
|
102 |
}
|
103 |
|
104 |
public function get_template_variables( $instance, $args ) {
|
105 |
+
// Workout the image title
|
106 |
+
if ( ! empty( $instance['title'] ) ) {
|
107 |
+
$title = $instance['title'];
|
108 |
+
} else {
|
109 |
+
// We do not want to use the default image titles as they're based on the file name without the extension
|
110 |
+
$file_name = pathinfo( get_post_meta( $instance['image'], '_wp_attached_file', true ), PATHINFO_FILENAME );
|
111 |
+
$title = get_the_title( $instance['image'] );
|
112 |
+
if ( $title == $file_name ) {
|
113 |
+
$title = '';
|
114 |
+
}
|
115 |
+
}
|
116 |
return array(
|
117 |
+
'title' => $title,
|
118 |
'title_position' => $instance['title_position'],
|
119 |
'image' => $instance['image'],
|
120 |
'size' => $instance['size'],
|
widgets/layout-slider/layout-slider.php
CHANGED
@@ -186,6 +186,19 @@ class SiteOrigin_Widget_LayoutSlider_Widget extends SiteOrigin_Widget_Base_Slide
|
|
186 |
);
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
/**
|
190 |
* Get everything necessary for the background image.
|
191 |
*
|
186 |
);
|
187 |
}
|
188 |
|
189 |
+
function form( $instance, $form_type = 'widget' ) {
|
190 |
+
if( defined('SITEORIGIN_PANELS_VERSION') ) {
|
191 |
+
parent::form( $instance, $form_type );
|
192 |
+
} else {
|
193 |
+
?>
|
194 |
+
<p>
|
195 |
+
<?php _e( 'This widget requires: ', 'so-widgets-bundle' ) ?>
|
196 |
+
<a href="https://siteorigin.com/page-builder/" target="_blank"><?php _e( 'SiteOrigin Page Builder', 'so-widgets-bundle' ) ?></a>
|
197 |
+
</p>
|
198 |
+
<?php
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
/**
|
203 |
* Get everything necessary for the background image.
|
204 |
*
|
widgets/post-carousel/tpl/base.php
CHANGED
@@ -5,7 +5,7 @@ $posts = new WP_Query( $query );
|
|
5 |
|
6 |
<?php if($posts->have_posts()) : ?>
|
7 |
<div class="sow-carousel-title">
|
8 |
-
<?php echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'] ?>
|
9 |
|
10 |
<a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
|
11 |
<a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
|
@@ -27,4 +27,4 @@ $posts = new WP_Query( $query );
|
|
27 |
</ul>
|
28 |
</div>
|
29 |
</div>
|
30 |
-
<?php endif; ?>
|
5 |
|
6 |
<?php if($posts->have_posts()) : ?>
|
7 |
<div class="sow-carousel-title">
|
8 |
+
<?php if( !empty( $instance['title'] ) ) echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'] ?>
|
9 |
|
10 |
<a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
|
11 |
<a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
|
27 |
</ul>
|
28 |
</div>
|
29 |
</div>
|
30 |
+
<?php endif; ?>
|
widgets/simple-masonry/js/simple-masonry.js
CHANGED
@@ -1,72 +1,78 @@
|
|
1 |
-
/* globals jQuery */
|
2 |
-
|
3 |
-
var $grid = $('.sow-masonry-grid');
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
var tabletQuery = window.matchMedia('(max-width: ' + layouts.tablet.breakPoint + 'px)');
|
10 |
-
var mobileQuery = window.matchMedia('(max-width: ' + layouts.mobile.breakPoint + 'px)');
|
11 |
-
var layout = layouts.desktop;
|
12 |
-
if(mobileQuery.matches) {
|
13 |
-
layout = layouts.mobile;
|
14 |
-
} else if (tabletQuery.matches) {
|
15 |
-
layout = layouts.tablet;
|
16 |
-
}
|
17 |
-
var numColumns = layout.numColumns;
|
18 |
-
$gridEl.css('width', 'auto');
|
19 |
-
var horizontalGutterSpace = layout.gutter * ( numColumns - 1 );
|
20 |
-
var columnWidth = Math.floor( ( $gridEl.width() - ( horizontalGutterSpace ) ) / numColumns );
|
21 |
-
$gridEl.width( ( columnWidth * numColumns ) + horizontalGutterSpace );
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
var
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
$img.
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
});
|
60 |
});
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
resizeMasonry();
|
65 |
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
resizeMasonry();
|
71 |
-
}, 100 );
|
72 |
-
});
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
var sowb = window.sowb || {};
|
|
|
3 |
|
4 |
+
jQuery( function($){
|
5 |
+
sowb.setupSimpleMasonries = function() {
|
6 |
+
var $ = jQuery;
|
7 |
+
var $grid = $('.sow-masonry-grid');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
var resizeMasonry = function(){
|
10 |
+
$grid.each(function(){
|
11 |
+
var $gridEl = $(this);
|
12 |
+
var layouts = $gridEl.data('layouts');
|
13 |
+
var tabletQuery = window.matchMedia('(max-width: ' + layouts.tablet.breakPoint + 'px)');
|
14 |
+
var mobileQuery = window.matchMedia('(max-width: ' + layouts.mobile.breakPoint + 'px)');
|
15 |
+
var layout = layouts.desktop;
|
16 |
+
if(mobileQuery.matches) {
|
17 |
+
layout = layouts.mobile;
|
18 |
+
} else if (tabletQuery.matches) {
|
19 |
+
layout = layouts.tablet;
|
20 |
+
}
|
21 |
+
var numColumns = layout.numColumns;
|
22 |
+
$gridEl.css('width', 'auto');
|
23 |
+
var horizontalGutterSpace = layout.gutter * ( numColumns - 1 );
|
24 |
+
var columnWidth = Math.floor( ( $gridEl.width() - ( horizontalGutterSpace ) ) / numColumns );
|
25 |
+
$gridEl.width( ( columnWidth * numColumns ) + horizontalGutterSpace );
|
26 |
|
27 |
+
$gridEl.imagesLoaded( function() {
|
28 |
+
$gridEl.find('> .sow-masonry-grid-item').each(function(){
|
29 |
+
var $$ = $(this);
|
30 |
+
var colSpan = $$.data('colSpan');
|
31 |
+
colSpan = Math.max(Math.min(colSpan, layout.numColumns), 1);
|
32 |
+
$$.width( ( columnWidth * colSpan ) + (layout.gutter * (colSpan-1)));
|
33 |
+
var rowSpan = $$.data('rowSpan');
|
34 |
+
rowSpan = Math.max(Math.min(rowSpan, layout.numColumns), 1);
|
35 |
+
//Use rowHeight if non-zero else fall back to matching columnWidth.
|
36 |
+
var rowHeight = layout.rowHeight || columnWidth;
|
37 |
+
$$.css('height', (rowHeight * rowSpan) + (layout.gutter * (rowSpan-1)));
|
38 |
+
|
39 |
+
var $img = $$.find('> img,> a > img');
|
40 |
+
var imgAR = $img.attr('height') > 0 ? $img.attr('width')/$img.attr('height') : 1;
|
41 |
+
var itemAR = $$.height() > 0 ? $$.width()/$$.height() : 1;
|
42 |
+
imgAR = parseFloat(imgAR.toFixed(3));
|
43 |
+
itemAR = parseFloat(itemAR.toFixed(3));
|
44 |
+
if(imgAR > itemAR) {
|
45 |
+
$img.css('width', 'auto');
|
46 |
+
$img.css('height', '100%');
|
47 |
+
$img.css('margin-top', '');
|
48 |
+
var marginLeft = ($img.width() - $$.width()) * -0.5;
|
49 |
+
$img.css('margin-left', marginLeft+'px');
|
50 |
+
}
|
51 |
+
else {
|
52 |
+
$img.css('height', 'auto');
|
53 |
+
$img.css('width', '100%');
|
54 |
+
$img.css('margin-left', '');
|
55 |
+
var marginTop = ($img.height() - $$.height()) * -0.5;
|
56 |
+
$img.css('margin-top', marginTop+'px');
|
57 |
+
}
|
58 |
+
});
|
59 |
+
$gridEl.packery({
|
60 |
+
itemSelector: '.sow-masonry-grid-item',
|
61 |
+
columnWidth: columnWidth,
|
62 |
+
gutter: layout.gutter
|
63 |
+
});
|
64 |
});
|
65 |
});
|
66 |
+
};
|
67 |
+
|
68 |
+
$(window).on('resize panelsStretchRows', resizeMasonry);
|
|
|
69 |
|
70 |
+
// Ensure that the masonry has resized correct on load.
|
71 |
+
setTimeout( function () {
|
72 |
+
resizeMasonry();
|
73 |
+
}, 100 );
|
74 |
+
};
|
75 |
+
sowb.setupSimpleMasonries();
|
76 |
|
77 |
+
$( sowb ).on( 'setup_widgets', sowb.setupSimpleMasonries );
|
78 |
+
} );
|
|
|
|
|
|
widgets/simple-masonry/js/simple-masonry.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(t){var
|
1 |
+
var sowb=window.sowb||{};jQuery(function(t){sowb.setupSimpleMasonries=function(){var t=jQuery,i=t(".sow-masonry-grid"),a=function(){i.each(function(){var i=t(this),a=i.data("layouts"),e=window.matchMedia("(max-width: "+a.tablet.breakPoint+"px)"),s=window.matchMedia("(max-width: "+a.mobile.breakPoint+"px)"),o=a.desktop;s.matches?o=a.mobile:e.matches&&(o=a.tablet);var h=o.numColumns;i.css("width","auto");var n=o.gutter*(h-1),r=Math.floor((i.width()-n)/h);i.width(r*h+n),i.imagesLoaded(function(){i.find("> .sow-masonry-grid-item").each(function(){var i=t(this),a=i.data("colSpan");a=Math.max(Math.min(a,o.numColumns),1),i.width(r*a+o.gutter*(a-1));var e=i.data("rowSpan");e=Math.max(Math.min(e,o.numColumns),1);var s=o.rowHeight||r;i.css("height",s*e+o.gutter*(e-1));var h=i.find("> img,> a > img"),n=h.attr("height")>0?h.attr("width")/h.attr("height"):1,m=i.height()>0?i.width()/i.height():1;if(n=parseFloat(n.toFixed(3)),m=parseFloat(m.toFixed(3)),n>m){h.css("width","auto"),h.css("height","100%"),h.css("margin-top","");var d=(h.width()-i.width())*-.5;h.css("margin-left",d+"px")}else{h.css("height","auto"),h.css("width","100%"),h.css("margin-left","");var w=(h.height()-i.height())*-.5;h.css("margin-top",w+"px")}}),i.packery({itemSelector:".sow-masonry-grid-item",columnWidth:r,gutter:o.gutter})})})};t(window).on("resize panelsStretchRows",a),setTimeout(function(){a()},100)},sowb.setupSimpleMasonries(),t(sowb).on("setup_widgets",sowb.setupSimpleMasonries)});
|
widgets/simple-masonry/simple-masonry.php
CHANGED
@@ -188,7 +188,7 @@ class SiteOrigin_Widget_Simple_Masonry_Widget extends SiteOrigin_Widget {
|
|
188 |
|
189 |
public function get_template_variables( $instance, $args ) {
|
190 |
return array(
|
191 |
-
'items' => $instance['items'],
|
192 |
'layouts' => array(
|
193 |
'desktop' => siteorigin_widgets_underscores_to_camel_case(
|
194 |
array(
|
188 |
|
189 |
public function get_template_variables( $instance, $args ) {
|
190 |
return array(
|
191 |
+
'items' => isset( $instance['items'] ) ? $instance['items'] : array(),
|
192 |
'layouts' => array(
|
193 |
'desktop' => siteorigin_widgets_underscores_to_camel_case(
|
194 |
array(
|
widgets/simple-masonry/tpl/default.php
CHANGED
@@ -1,26 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div class="sow-masonry-grid"
|
2 |
data-layouts="<?php echo esc_attr( json_encode( $layouts ) ) ?>">
|
3 |
<?php
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
|
21 |
<?php endif; ?>
|
22 |
-
|
23 |
-
|
|
|
24 |
}
|
25 |
?>
|
26 |
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var $args
|
4 |
+
* @var $items
|
5 |
+
* @var $layouts
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
|
9 |
+
<?php if( !empty( $instance['widget_title'] ) ) echo $args['before_title'] . esc_html( $instance['widget_title'] ) . $args['after_title'] ?>
|
10 |
+
|
11 |
<div class="sow-masonry-grid"
|
12 |
data-layouts="<?php echo esc_attr( json_encode( $layouts ) ) ?>">
|
13 |
<?php
|
14 |
+
if( ! empty( $items ) ) {
|
15 |
+
foreach ( $items as $item ) {
|
16 |
+
$src = wp_get_attachment_image_src( $item['image'], 'full' );
|
17 |
+
$src = empty( $src ) ? '' : $src[0];
|
18 |
+
$title = empty( $item['title'] ) ? '' : $item['title'];
|
19 |
+
$url = empty( $item['url'] ) ? '' : $item['url'];
|
20 |
+
$new_window = ! empty( $item['new_window'] );
|
21 |
+
?>
|
22 |
+
<div class="sow-masonry-grid-item" data-col-span="<?php echo esc_attr( $item['column_span'] ) ?>"
|
23 |
+
data-row-span="<?php echo esc_attr( $item['row_span'] ) ?>">
|
24 |
+
<?php if ( ! empty( $url ) ) : ?>
|
25 |
+
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if ( $new_window ) { ?>target="_blank" <?php } ?>>
|
26 |
+
<?php endif; ?>
|
27 |
|
28 |
+
<?php echo wp_get_attachment_image( $item['image'], 'full', false, array( 'title' => esc_attr( $title ) ) ); ?>
|
29 |
|
30 |
+
<?php if ( ! empty( $url ) ) : ?>
|
31 |
+
</a>
|
32 |
<?php endif; ?>
|
33 |
+
</div>
|
34 |
+
<?php
|
35 |
+
}
|
36 |
}
|
37 |
?>
|
38 |
|
widgets/social-media-buttons/js/social-media-buttons-admin.js
CHANGED
@@ -8,16 +8,18 @@
|
|
8 |
window.sowForms.fetchWidgetVariable('networks', 'SiteOrigin_Widget_SocialMediaButtons_Widget',
|
9 |
function(networks) {
|
10 |
var selectedNetwork = networks[$selectNetworkInput.find(':selected').val()];
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
);
|
23 |
};
|
@@ -34,4 +36,4 @@
|
|
34 |
|
35 |
} );
|
36 |
|
37 |
-
})(jQuery);
|
8 |
window.sowForms.fetchWidgetVariable('networks', 'SiteOrigin_Widget_SocialMediaButtons_Widget',
|
9 |
function(networks) {
|
10 |
var selectedNetwork = networks[$selectNetworkInput.find(':selected').val()];
|
11 |
+
if( selectedNetwork ) {
|
12 |
+
var $closestForm = $selectNetworkInput.closest('.siteorigin-widget-field-repeater-item-form');
|
13 |
+
|
14 |
+
var $urlInput = $closestForm.find('[id*="networks-url"]');
|
15 |
+
$urlInput.val(selectedNetwork.base_url);
|
16 |
+
|
17 |
+
var $iconColorPicker = $closestForm.find('[id*="networks-icon_color"]');
|
18 |
+
$iconColorPicker.wpColorPicker('color', selectedNetwork.icon_color);
|
19 |
+
|
20 |
+
var $buttonColorPicker = $closestForm.find('[id*="networks-button_color"]');
|
21 |
+
$buttonColorPicker.wpColorPicker('color', selectedNetwork.button_color);
|
22 |
+
}
|
23 |
}
|
24 |
);
|
25 |
};
|
36 |
|
37 |
} );
|
38 |
|
39 |
+
})(jQuery);
|
widgets/social-media-buttons/js/social-media-buttons-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(i){i(document).on("sowsetupform",'.siteorigin-widget-form[data-class="SiteOrigin_Widget_SocialMediaButtons_Widget"]',function(){var o=i(this),t=function(i){window.sowForms.fetchWidgetVariable("networks","SiteOrigin_Widget_SocialMediaButtons_Widget",function(o){var t=o[i.find(":selected").val()]
|
1 |
+
!function(i){i(document).on("sowsetupform",'.siteorigin-widget-form[data-class="SiteOrigin_Widget_SocialMediaButtons_Widget"]',function(){var o=i(this),t=function(i){window.sowForms.fetchWidgetVariable("networks","SiteOrigin_Widget_SocialMediaButtons_Widget",function(o){var t=o[i.find(":selected").val()];if(t){var e=i.closest(".siteorigin-widget-field-repeater-item-form"),n=e.find('[id*="networks-url"]');n.val(t.base_url);var r=e.find('[id*="networks-icon_color"]');r.wpColorPicker("color",t.icon_color);var d=e.find('[id*="networks-button_color"]');d.wpColorPicker("color",t.button_color)}})};"undefined"==typeof o.data("initialised")&&(o.on("change",'[id*="networks-name"]',function(o){t(i(o.target))}),o.data("initialised",!0))})}(jQuery);
|
widgets/social-media-buttons/social-media-buttons.php
CHANGED
@@ -37,6 +37,10 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
|
|
37 |
}
|
38 |
|
39 |
return array(
|
|
|
|
|
|
|
|
|
40 |
'networks' => array(
|
41 |
'type' => 'repeater',
|
42 |
'label' => __( 'Networks', 'so-widgets-bundle' ),
|
@@ -57,6 +61,10 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
|
|
57 |
'type' => 'text',
|
58 |
'label' => __( 'URL', 'so-widgets-bundle' )
|
59 |
),
|
|
|
|
|
|
|
|
|
60 |
'icon_color' => array(
|
61 |
'type' => 'color',
|
62 |
'label' => __( 'Icon color', 'so-widgets-bundle' )
|
37 |
}
|
38 |
|
39 |
return array(
|
40 |
+
'title' => array(
|
41 |
+
'type' => 'text',
|
42 |
+
'label' => __( 'Title', 'so-widgets-bundle' ),
|
43 |
+
),
|
44 |
'networks' => array(
|
45 |
'type' => 'repeater',
|
46 |
'label' => __( 'Networks', 'so-widgets-bundle' ),
|
61 |
'type' => 'text',
|
62 |
'label' => __( 'URL', 'so-widgets-bundle' )
|
63 |
),
|
64 |
+
'icon_title' => array(
|
65 |
+
'type' => 'text',
|
66 |
+
'label' => __( 'Icon title', 'so-widgets-bundle' ),
|
67 |
+
),
|
68 |
'icon_color' => array(
|
69 |
'type' => 'color',
|
70 |
'label' => __( 'Icon color', 'so-widgets-bundle' )
|
widgets/social-media-buttons/tpl/default.php
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
<div class="social-media-button-container">
|
2 |
<?php foreach( $networks as $network ) :
|
3 |
$classes = array();
|
@@ -6,7 +8,7 @@
|
|
6 |
$classes[] = "sow-social-media-button";
|
7 |
$button_attributes = array(
|
8 |
'class' => esc_attr( implode(' ', $classes) ),
|
9 |
-
'title' => sprintf( __( '%s on %s', 'so-widgets-bundle' ), get_bloginfo( 'name' ), ucwords( str_replace( '-', ' ', $network['name'] ) ) ),
|
10 |
);
|
11 |
if( !empty( $instance['design']['new_window'] ) ) $button_attributes['target'] = '_blank';
|
12 |
if ( ! empty( $network['url'] ) ) $button_attributes['href'] = sow_esc_url( trim( $network['url'] ) );
|
1 |
+
<?php if ( !empty( $instance['title'] ) ) echo $args['before_title'] . esc_html( $instance['title'] ) . $args['after_title']; ?>
|
2 |
+
|
3 |
<div class="social-media-button-container">
|
4 |
<?php foreach( $networks as $network ) :
|
5 |
$classes = array();
|
8 |
$classes[] = "sow-social-media-button";
|
9 |
$button_attributes = array(
|
10 |
'class' => esc_attr( implode(' ', $classes) ),
|
11 |
+
'title' => empty( $network['icon_title'] ) ? sprintf( __( '%s on %s', 'so-widgets-bundle' ), get_bloginfo( 'name' ), ucwords( str_replace( '-', ' ', $network['name'] ) ) ) : $network['icon_title'],
|
12 |
);
|
13 |
if( !empty( $instance['design']['new_window'] ) ) $button_attributes['target'] = '_blank';
|
14 |
if ( ! empty( $network['url'] ) ) $button_attributes['href'] = sow_esc_url( trim( $network['url'] ) );
|
widgets/taxonomy/taxonomy.php
CHANGED
@@ -57,6 +57,11 @@ class SiteOrigin_Widget_Taxonomy_Widget extends SiteOrigin_Widget {
|
|
57 |
'type' => 'color',
|
58 |
'label' => __( 'Hover color', 'so-widgets-bundle' ),
|
59 |
),
|
|
|
|
|
|
|
|
|
|
|
60 |
);
|
61 |
}
|
62 |
|
@@ -87,6 +92,7 @@ class SiteOrigin_Widget_Taxonomy_Widget extends SiteOrigin_Widget {
|
|
87 |
'taxonomy_name' => $instance['taxonomy'],
|
88 |
'label' => $instance['label'],
|
89 |
'display_format' => $instance['display_format'],
|
|
|
90 |
);
|
91 |
}
|
92 |
}
|
57 |
'type' => 'color',
|
58 |
'label' => __( 'Hover color', 'so-widgets-bundle' ),
|
59 |
),
|
60 |
+
'new_window' => array(
|
61 |
+
'type' => 'checkbox',
|
62 |
+
'default' => false,
|
63 |
+
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
64 |
+
),
|
65 |
);
|
66 |
}
|
67 |
|
92 |
'taxonomy_name' => $instance['taxonomy'],
|
93 |
'label' => $instance['label'],
|
94 |
'display_format' => $instance['display_format'],
|
95 |
+
'new_window' => $instance['new_window'],
|
96 |
);
|
97 |
}
|
98 |
}
|
widgets/taxonomy/tpl/default.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
?>
|
10 |
|
11 |
-
|
12 |
<?php if( !empty( $title ) ) echo $args['before_title'] . esc_html( $title ) . $args['after_title']; ?>
|
13 |
|
14 |
<div class="sow-taxonomy">
|
@@ -18,7 +17,7 @@
|
|
18 |
<?php endif; ?>
|
19 |
|
20 |
<?php foreach ( get_the_terms( $post->ID, $taxonomy_name ) as $term ) : ?>
|
21 |
-
<a class="so-taxonomy-<?php echo esc_attr( $display_format )?>" href="<?php echo get_term_link( $term, $taxonomy_name ) ?>" rel="tag"
|
22 |
<?php endforeach; ?>
|
23 |
|
24 |
</div>
|
8 |
*/
|
9 |
?>
|
10 |
|
|
|
11 |
<?php if( !empty( $title ) ) echo $args['before_title'] . esc_html( $title ) . $args['after_title']; ?>
|
12 |
|
13 |
<div class="sow-taxonomy">
|
17 |
<?php endif; ?>
|
18 |
|
19 |
<?php foreach ( get_the_terms( $post->ID, $taxonomy_name ) as $term ) : ?>
|
20 |
+
<a class="so-taxonomy-<?php echo esc_attr( $display_format )?>" href="<?php echo get_term_link( $term, $taxonomy_name ) ?>" rel="tag" <?php if ( ! empty( $new_window ) ) echo 'target="_blank"'; ?>><?php echo esc_html( $term->name ) ?></a>
|
21 |
<?php endforeach; ?>
|
22 |
|
23 |
</div>
|
widgets/video/js/so-video-widget.js
CHANGED
@@ -1,5 +1,12 @@
|
|
|
|
|
|
1 |
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
var sowb = window.sowb || {};
|
3 |
|
4 |
+
jQuery( function ( $ ) {
|
5 |
+
sowb.setupVideoPlayers = function() {
|
6 |
+
var $ = jQuery;
|
7 |
+
$('video.sow-video-widget').mediaelementplayer();
|
8 |
+
};
|
9 |
+
sowb.setupVideoPlayers();
|
10 |
+
|
11 |
+
$( sowb ).on( 'setup_widgets', sowb.setupVideoPlayers );
|
12 |
+
} );
|
widgets/video/js/so-video-widget.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(e){e("video.sow-video-widget").mediaelementplayer()});
|
1 |
+
var sowb=window.sowb||{};jQuery(function(e){sowb.setupVideoPlayers=function(){var e=jQuery;e("video.sow-video-widget").mediaelementplayer()},sowb.setupVideoPlayers(),e(sowb).on("setup_widgets",sowb.setupVideoPlayers)});
|
widgets/video/video.php
CHANGED
@@ -115,7 +115,7 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
|
|
115 |
}
|
116 |
|
117 |
function enqueue_frontend_scripts( $instance ) {
|
118 |
-
$video_host = $instance['host_type'];
|
119 |
if ( $video_host == 'external' ) {
|
120 |
$video_host = ! empty( $instance['video']['external_video'] ) ? $this->get_host_from_url( $instance['video']['external_video'] ) : '';
|
121 |
}
|
@@ -160,21 +160,23 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
|
|
160 |
$video_host = $instance['host_type'];
|
161 |
if ( $video_host == 'self' ) {
|
162 |
|
163 |
-
|
164 |
-
$
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
178 |
}
|
179 |
}
|
180 |
$poster = ! empty( $instance['video']['self_poster'] ) ? wp_get_attachment_url( $instance['video']['self_poster'] ) : '';
|
115 |
}
|
116 |
|
117 |
function enqueue_frontend_scripts( $instance ) {
|
118 |
+
$video_host = empty( $instance['host_type'] ) ? '' : $instance['host_type'];
|
119 |
if ( $video_host == 'external' ) {
|
120 |
$video_host = ! empty( $instance['video']['external_video'] ) ? $this->get_host_from_url( $instance['video']['external_video'] ) : '';
|
121 |
}
|
160 |
$video_host = $instance['host_type'];
|
161 |
if ( $video_host == 'self' ) {
|
162 |
|
163 |
+
if ( isset( $instance['video']['self_sources'] ) ) {
|
164 |
+
foreach ( $instance['video']['self_sources'] as $source ) {
|
165 |
+
$src = '';
|
166 |
+
$video_type = '';
|
167 |
+
if ( ! empty( $source['self_video'] ) ) {
|
168 |
+
// Handle an attachment video
|
169 |
+
$src = wp_get_attachment_url( $source['self_video'] );
|
170 |
+
$video_type = get_post_mime_type( $source['self_video'] );
|
171 |
+
} else if ( ! empty( $source['self_video_fallback'] ) ) {
|
172 |
+
// Handle an external URL video
|
173 |
+
$src = $source['self_video_fallback'];
|
174 |
+
$vid_info = wp_check_filetype( basename( $source['self_video_fallback'] ) );
|
175 |
+
$video_type = $vid_info['type'];
|
176 |
+
}
|
177 |
+
if ( ! empty( $src ) ) {
|
178 |
+
$self_sources[] = array( 'src' => $src, 'video_type' => $video_type );
|
179 |
+
}
|
180 |
}
|
181 |
}
|
182 |
$poster = ! empty( $instance['video']['self_poster'] ) ? wp_get_attachment_url( $instance['video']['self_poster'] ) : '';
|