Version Description
- 21 July 2016 =
- More settings and customizability for Headline widget.
- Added FitText to Headline and Hero Image widgets.
- Fixed Pixabay image importing.
Download this release
Release Info
Developer | gpriday |
Plugin | SiteOrigin Widgets Bundle |
Version | 1.6.4 |
Comparing to | |
See all releases |
Code changes from version 1.6.3 to 1.6.4
- base/base.php +1 -15
- base/inc/actions.php +10 -4
- base/inc/fields/css/media-field.css +14 -8
- base/inc/fields/css/order-field.css +12 -0
- base/inc/fields/js/order-field.js +22 -0
- base/inc/fields/js/order-field.min.js +1 -0
- base/inc/fields/media.class.php +6 -5
- base/inc/fields/order.class.php +55 -0
- base/siteorigin-widget.class.php +15 -5
- js/sow.jquery.fittext.js +51 -0
- js/sow.jquery.fittext.min.js +1 -0
- readme.txt +7 -2
- so-widgets-bundle.php +7 -2
- widgets/headline/headline.php +181 -88
- widgets/headline/styles/default.less +44 -12
- widgets/headline/tpl/default.php +26 -14
- widgets/hero/hero.php +17 -0
base/base.php
CHANGED
@@ -227,21 +227,7 @@ add_action( 'admin_print_styles', 'siteorigin_widgets_tinymce_admin_print_styles
|
|
227 |
*/
|
228 |
function siteorigin_widgets_get_measurements_list() {
|
229 |
$measurements = array(
|
230 |
-
'px',
|
231 |
-
'%',
|
232 |
-
'in',
|
233 |
-
'cm',
|
234 |
-
'mm',
|
235 |
-
'em',
|
236 |
-
'rem',
|
237 |
-
'pt',
|
238 |
-
'pc',
|
239 |
-
'ex',
|
240 |
-
'ch',
|
241 |
-
'vw',
|
242 |
-
'vh',
|
243 |
-
'vmin',
|
244 |
-
'vmax',
|
245 |
);
|
246 |
|
247 |
// Allow themes and plugins to trim or enhance the list.
|
227 |
*/
|
228 |
function siteorigin_widgets_get_measurements_list() {
|
229 |
$measurements = array(
|
230 |
+
'px', '%', 'in', 'cm', 'mm', 'em', 'rem', 'pt', 'pc', 'ex', 'ch', 'vw', 'vh', 'vmin', 'vmax',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
);
|
232 |
|
233 |
// Allow themes and plugins to trim or enhance the list.
|
base/inc/actions.php
CHANGED
@@ -116,9 +116,11 @@ function siteorigin_widget_remote_image_search(){
|
|
116 |
|
117 |
if( ! is_wp_error( $result ) ) {
|
118 |
$result = json_decode( $result['body'], true );
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
122 |
}
|
123 |
}
|
124 |
}
|
@@ -142,7 +144,11 @@ function siteorigin_widget_image_import(){
|
|
142 |
'message' => __( 'Nonce error', 'so-widgets-bundle' ),
|
143 |
);
|
144 |
}
|
145 |
-
else if(
|
|
|
|
|
|
|
|
|
146 |
$result = array(
|
147 |
'error' => true,
|
148 |
'message' => __( 'Signature error', 'so-widgets-bundle' ),
|
116 |
|
117 |
if( ! is_wp_error( $result ) ) {
|
118 |
$result = json_decode( $result['body'], true );
|
119 |
+
if( !empty( $result['items'] ) ) {
|
120 |
+
foreach( $result['items'] as & $r ) {
|
121 |
+
if( !empty( $r['full_url'] ) ) {
|
122 |
+
$r['import_signature'] = md5( $r['full_url'] . '::' . NONCE_SALT );
|
123 |
+
}
|
124 |
}
|
125 |
}
|
126 |
}
|
144 |
'message' => __( 'Nonce error', 'so-widgets-bundle' ),
|
145 |
);
|
146 |
}
|
147 |
+
else if(
|
148 |
+
empty( $_GET['import_signature'] ) ||
|
149 |
+
empty( $_GET['full_url'] ) ||
|
150 |
+
md5( $_GET['full_url'] . '::' . NONCE_SALT ) !== $_GET['import_signature']
|
151 |
+
) {
|
152 |
$result = array(
|
153 |
'error' => true,
|
154 |
'message' => __( 'Signature error', 'so-widgets-bundle' ),
|
base/inc/fields/css/media-field.css
CHANGED
@@ -129,14 +129,15 @@
|
|
129 |
background-color: #fff;
|
130 |
padding: 25px;
|
131 |
overflow-y: scroll;
|
|
|
132 |
}
|
133 |
#so-widgets-image-search-frame #so-widgets-image-search-form {
|
134 |
-
display:
|
135 |
-
max-width: 420px;
|
136 |
width: 100%;
|
137 |
position: relative;
|
138 |
-
padding-right:
|
139 |
margin-bottom: 2px;
|
|
|
140 |
}
|
141 |
#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-input {
|
142 |
padding: 9px 12px;
|
@@ -152,21 +153,26 @@
|
|
152 |
font-size: 1.2em;
|
153 |
height: 100%;
|
154 |
top: 0;
|
155 |
-
right:
|
156 |
border-width: 1px;
|
157 |
box-shadow: none;
|
158 |
}
|
159 |
#so-widgets-image-search-frame #so-widgets-image-search-suggestions {
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
display: none;
|
161 |
-
float: right;
|
162 |
font-size: 1.1em;
|
163 |
-
|
164 |
}
|
165 |
#so-widgets-image-search-frame #so-widgets-image-search-suggestions strong {
|
166 |
-
|
167 |
}
|
168 |
#so-widgets-image-search-frame #so-widgets-image-search-suggestions ul {
|
169 |
-
display:
|
170 |
list-style: none;
|
171 |
margin: 0;
|
172 |
padding: 0;
|
129 |
background-color: #fff;
|
130 |
padding: 25px;
|
131 |
overflow-y: scroll;
|
132 |
+
overflow-x: hidden;
|
133 |
}
|
134 |
#so-widgets-image-search-frame #so-widgets-image-search-form {
|
135 |
+
display: block;
|
|
|
136 |
width: 100%;
|
137 |
position: relative;
|
138 |
+
padding-right: 368px;
|
139 |
margin-bottom: 2px;
|
140 |
+
box-sizing: border-box;
|
141 |
}
|
142 |
#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-input {
|
143 |
padding: 9px 12px;
|
153 |
font-size: 1.2em;
|
154 |
height: 100%;
|
155 |
top: 0;
|
156 |
+
right: 320px;
|
157 |
border-width: 1px;
|
158 |
box-shadow: none;
|
159 |
}
|
160 |
#so-widgets-image-search-frame #so-widgets-image-search-suggestions {
|
161 |
+
position: absolute;
|
162 |
+
right: 0;
|
163 |
+
top: 0;
|
164 |
+
width: 300px;
|
165 |
+
height: 40px;
|
166 |
+
text-align: right;
|
167 |
display: none;
|
|
|
168 |
font-size: 1.1em;
|
169 |
+
overflow: hidden;
|
170 |
}
|
171 |
#so-widgets-image-search-frame #so-widgets-image-search-suggestions strong {
|
172 |
+
display: block;
|
173 |
}
|
174 |
#so-widgets-image-search-frame #so-widgets-image-search-suggestions ul {
|
175 |
+
display: block;
|
176 |
list-style: none;
|
177 |
margin: 0;
|
178 |
padding: 0;
|
base/inc/fields/css/order-field.css
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.siteorigin-widget-field-type-order .siteorigin-widget-order-items .siteorigin-widget-order-item {
|
2 |
+
display: block;
|
3 |
+
max-width: 200px;
|
4 |
+
background-color: #f4f4f4;
|
5 |
+
margin-bottom: 2px;
|
6 |
+
padding: 4px 6px;
|
7 |
+
cursor: move;
|
8 |
+
border: 1px solid #e0e0e0;
|
9 |
+
}
|
10 |
+
.siteorigin-widget-field-type-order .siteorigin-widget-order-items .siteorigin-widget-order-item:last-child {
|
11 |
+
margin-bottom: 0;
|
12 |
+
}
|
base/inc/fields/js/order-field.js
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function($){
|
2 |
+
|
3 |
+
$(document).on( 'sowsetupform', function(e) {
|
4 |
+
var $form = $(e.target);
|
5 |
+
|
6 |
+
|
7 |
+
$form.find( '.siteorigin-widget-field-type-order' ).each( function(){
|
8 |
+
var $$ = $( this );
|
9 |
+
|
10 |
+
$$.find( '.siteorigin-widget-order-items' ).sortable( {
|
11 |
+
stop: function(){
|
12 |
+
var val = [];
|
13 |
+
$$.find( '.siteorigin-widget-order-item' ).each( function( i, el ){
|
14 |
+
val.push( $(el).data('value') );
|
15 |
+
} );
|
16 |
+
$$.find('.siteorigin-widget-input').val( val.join(',') );
|
17 |
+
}
|
18 |
+
} );
|
19 |
+
} );
|
20 |
+
});
|
21 |
+
|
22 |
+
}( jQuery ) );
|
base/inc/fields/js/order-field.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(i){i(document).on("sowsetupform",function(t){var e=i(t.target);e.find(".siteorigin-widget-field-type-order").each(function(){var t=i(this);t.find(".siteorigin-widget-order-items").sortable({stop:function(){var e=[];t.find(".siteorigin-widget-order-item").each(function(t,n){e.push(i(n).data("value"))}),t.find(".siteorigin-widget-input").val(e.join(","))}})})})}(jQuery);
|
base/inc/fields/media.class.php
CHANGED
@@ -177,11 +177,12 @@ class SiteOrigin_Widget_Field_Media extends SiteOrigin_Widget_Field_Base {
|
|
177 |
<button type="submit" class="button-primary so-widgets-search-button">
|
178 |
<span class="dashicons dashicons-search"></span>
|
179 |
</button>
|
|
|
|
|
|
|
|
|
|
|
180 |
</form>
|
181 |
-
<div id="so-widgets-image-search-suggestions">
|
182 |
-
<strong><?php esc_html_e( 'Related Searches: ', 'so-widgets-bundle' ) ?></strong>
|
183 |
-
<ul class="so-keywords-list"></ul>
|
184 |
-
</div>
|
185 |
<div id="so-widgets-image-search-powered">
|
186 |
<?php
|
187 |
printf(
|
@@ -224,4 +225,4 @@ class SiteOrigin_Widget_Field_Media extends SiteOrigin_Widget_Field_Base {
|
|
224 |
</script>
|
225 |
<?php
|
226 |
}
|
227 |
-
}
|
177 |
<button type="submit" class="button-primary so-widgets-search-button">
|
178 |
<span class="dashicons dashicons-search"></span>
|
179 |
</button>
|
180 |
+
|
181 |
+
<div id="so-widgets-image-search-suggestions">
|
182 |
+
<strong><?php esc_html_e( 'Related Searches: ', 'so-widgets-bundle' ) ?></strong>
|
183 |
+
<ul class="so-keywords-list"></ul>
|
184 |
+
</div>
|
185 |
</form>
|
|
|
|
|
|
|
|
|
186 |
<div id="so-widgets-image-search-powered">
|
187 |
<?php
|
188 |
printf(
|
225 |
</script>
|
226 |
<?php
|
227 |
}
|
228 |
+
}
|
base/inc/fields/order.class.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class SiteOrigin_Widget_Field_Order
|
5 |
+
*/
|
6 |
+
class SiteOrigin_Widget_Field_Order extends SiteOrigin_Widget_Field_Base {
|
7 |
+
|
8 |
+
protected $options;
|
9 |
+
|
10 |
+
protected function render_field( $value, $instance ) {
|
11 |
+
|
12 |
+
if( ! empty( $this->options ) && ! empty( $value ) ) {
|
13 |
+
?><div class="siteorigin-widget-order-items"><?php
|
14 |
+
foreach( $value as $key ) {
|
15 |
+
?>
|
16 |
+
<div class="siteorigin-widget-order-item" data-value="<?php echo esc_attr( $key ) ?>">
|
17 |
+
<?php echo esc_html( $this->options[ $key ] ) ?>
|
18 |
+
</div>
|
19 |
+
<?php
|
20 |
+
}
|
21 |
+
?></div><?php
|
22 |
+
}
|
23 |
+
|
24 |
+
?>
|
25 |
+
<input
|
26 |
+
type="hidden"
|
27 |
+
name="<?php echo esc_attr( $this->element_name ) ?>"
|
28 |
+
id="<?php echo esc_attr( $this->element_id ) ?>"
|
29 |
+
class="siteorigin-widget-input"
|
30 |
+
value="<?php echo esc_attr( implode( ',', $value ) ) ?>">
|
31 |
+
<?php
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function sanitize_field_input( $value, $instance ) {
|
36 |
+
if( ! is_array( $value ) ) {
|
37 |
+
$value = explode(',', $value);
|
38 |
+
$value = array_map( 'trim', $value );
|
39 |
+
}
|
40 |
+
|
41 |
+
foreach( $value as $i => $k ) {
|
42 |
+
if( empty( $this->options[$k] ) ) {
|
43 |
+
unset( $value[ $i ] );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
return $value;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function enqueue_scripts() {
|
51 |
+
wp_enqueue_script( 'so-order-field', plugin_dir_url(__FILE__) . 'js/order-field' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery', 'jquery-ui-sortable' ), SOW_BUNDLE_VERSION );
|
52 |
+
wp_enqueue_style( 'so-order-field', plugin_dir_url(__FILE__) . 'css/order-field.css', array( ), SOW_BUNDLE_VERSION );
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
base/siteorigin-widget.class.php
CHANGED
@@ -62,7 +62,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
62 |
) );
|
63 |
|
64 |
$control_options = wp_parse_args($widget_options, array(
|
65 |
-
'width' =>
|
66 |
) );
|
67 |
|
68 |
if( empty( $this->widget_class ) ) {
|
@@ -126,7 +126,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
126 |
$this->form_options = $this->initialize_form();
|
127 |
}
|
128 |
|
129 |
-
$instance = $this->modify_instance($instance);
|
130 |
|
131 |
// Filter the instance
|
132 |
$instance = apply_filters( 'siteorigin_widgets_instance', $instance, $this );
|
@@ -185,8 +185,16 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
185 |
$template_html = $this->get_html_content( $instance, $args, $template_vars, $css_name );
|
186 |
}
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
echo $args['before_widget'];
|
189 |
-
echo '<div class="
|
190 |
echo $template_html;
|
191 |
echo '</div>';
|
192 |
echo $args['after_widget'];
|
@@ -667,8 +675,8 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
667 |
$vars = $this->get_less_variables($instance);
|
668 |
if( !empty( $vars ) ){
|
669 |
foreach($vars as $name => $value) {
|
670 |
-
// Ignore empty string
|
671 |
-
if( $value === '' || $value === false ) continue;
|
672 |
|
673 |
$less = preg_replace('/\@'.preg_quote($name).' *\:.*?;/', '@'.$name.': '.$value.';', $less);
|
674 |
}
|
@@ -887,6 +895,8 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
887 |
*
|
888 |
* @param $markdown
|
889 |
* @return string The HTML
|
|
|
|
|
890 |
*/
|
891 |
function parse_markdown( $markdown ){
|
892 |
if( !class_exists('Markdown_Parser') ) include plugin_dir_path(__FILE__).'inc/markdown.php';
|
62 |
) );
|
63 |
|
64 |
$control_options = wp_parse_args($widget_options, array(
|
65 |
+
'width' => 800,
|
66 |
) );
|
67 |
|
68 |
if( empty( $this->widget_class ) ) {
|
126 |
$this->form_options = $this->initialize_form();
|
127 |
}
|
128 |
|
129 |
+
$instance = $this->modify_instance( $instance );
|
130 |
|
131 |
// Filter the instance
|
132 |
$instance = apply_filters( 'siteorigin_widgets_instance', $instance, $this );
|
185 |
$template_html = $this->get_html_content( $instance, $args, $template_vars, $css_name );
|
186 |
}
|
187 |
|
188 |
+
$wrapper_classes = apply_filters(
|
189 |
+
'siteorigin_widgets_wrapper_classes_' . $this->id_base,
|
190 |
+
array( 'so-widget-' . $this->id_base, 'so-widget-'.$css_name ),
|
191 |
+
$instance,
|
192 |
+
$this
|
193 |
+
);
|
194 |
+
$wrapper_classes = array_map( 'sanitize_html_class', $wrapper_classes );
|
195 |
+
|
196 |
echo $args['before_widget'];
|
197 |
+
echo '<div class="' . esc_attr( implode( ' ', $wrapper_classes ) ) . '">';
|
198 |
echo $template_html;
|
199 |
echo '</div>';
|
200 |
echo $args['after_widget'];
|
675 |
$vars = $this->get_less_variables($instance);
|
676 |
if( !empty( $vars ) ){
|
677 |
foreach($vars as $name => $value) {
|
678 |
+
// Ignore empty string, false and null values (but keep '0')
|
679 |
+
if( $value === '' || $value === false || $value === null ) continue;
|
680 |
|
681 |
$less = preg_replace('/\@'.preg_quote($name).' *\:.*?;/', '@'.$name.': '.$value.';', $less);
|
682 |
}
|
895 |
*
|
896 |
* @param $markdown
|
897 |
* @return string The HTML
|
898 |
+
*
|
899 |
+
* @deprecated Will be removed in version 2.0
|
900 |
*/
|
901 |
function parse_markdown( $markdown ){
|
902 |
if( !class_exists('Markdown_Parser') ) include plugin_dir_path(__FILE__).'inc/markdown.php';
|
js/sow.jquery.fittext.js
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*global jQuery */
|
2 |
+
/*!
|
3 |
+
* FitText.js 1.2
|
4 |
+
*
|
5 |
+
* Copyright 2011, Dave Rupert http://daverupert.com
|
6 |
+
* Released under the WTFPL license
|
7 |
+
* http://sam.zoy.org/wtfpl/
|
8 |
+
*
|
9 |
+
* Date: Thu May 05 14:23:00 2011 -0600
|
10 |
+
*/
|
11 |
+
|
12 |
+
(function ($) {
|
13 |
+
|
14 |
+
$.fn.fitText = function (kompressor, options) {
|
15 |
+
|
16 |
+
// Setup options
|
17 |
+
var compressor = kompressor || 1,
|
18 |
+
settings = $.extend({
|
19 |
+
'minFontSize': Number.NEGATIVE_INFINITY,
|
20 |
+
'maxFontSize': Number.POSITIVE_INFINITY
|
21 |
+
}, options);
|
22 |
+
|
23 |
+
return this.each(function () {
|
24 |
+
|
25 |
+
// Store the object
|
26 |
+
var $this = $(this);
|
27 |
+
|
28 |
+
// Resizer() resizes items based on the object width divided by the compressor * 10
|
29 |
+
var resizer = function () {
|
30 |
+
$this.css('font-size', Math.max(Math.min($this.width() / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
|
31 |
+
};
|
32 |
+
|
33 |
+
// Call once to set.
|
34 |
+
resizer();
|
35 |
+
|
36 |
+
// Call on resize. Opera debounces their resize by default.
|
37 |
+
$(window).on('resize.fittext orientationchange.fittext', resizer);
|
38 |
+
|
39 |
+
});
|
40 |
+
};
|
41 |
+
})(jQuery);
|
42 |
+
|
43 |
+
jQuery( function( $ ){
|
44 |
+
// Apply FitText to all Widgets Bundle FitText wrappers
|
45 |
+
$('.so-widget-fittext-wrapper').find( 'h1,h2,h3,h4,h5,h6' ).each( function(){
|
46 |
+
var $$ = $(this);
|
47 |
+
$$.fitText( 0.85, {
|
48 |
+
maxFontSize: $$.css('font-size')
|
49 |
+
} );
|
50 |
+
} );
|
51 |
+
} );
|
js/sow.jquery.fittext.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t){t.fn.fitText=function(i,n){var e=i||1,o=t.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},n);return this.each(function(){var i=t(this),n=function(){i.css("font-size",Math.max(Math.min(i.width()/(10*e),parseFloat(o.maxFontSize)),parseFloat(o.minFontSize)))};n(),t(window).on("resize.fittext orientationchange.fittext",n)})}}(jQuery),jQuery(function(t){t(".so-widget-fittext-wrapper").find("h1,h2,h3,h4,h5,h6").each(function(){var i=t(this);i.fitText(.85,{maxFontSize:i.css("font-size")})})});
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
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.5.3
|
5 |
-
Stable tag: 1.6.
|
6 |
-
Build time: 2016-07-
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
|
@@ -51,6 +51,11 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
= 1.6.3 - 19 July 2016 =
|
55 |
* Added image search functionality to media field.
|
56 |
* Moved actions into their own file.
|
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.5.3
|
5 |
+
Stable tag: 1.6.4
|
6 |
+
Build time: 2016-07-21T09:52:32+02:00
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
|
51 |
|
52 |
== Changelog ==
|
53 |
|
54 |
+
= 1.6.4 - 21 July 2016 =
|
55 |
+
* More settings and customizability for Headline widget.
|
56 |
+
* Added FitText to Headline and Hero Image widgets.
|
57 |
+
* Fixed Pixabay image importing.
|
58 |
+
|
59 |
= 1.6.3 - 19 July 2016 =
|
60 |
* Added image search functionality to media field.
|
61 |
* Moved actions into their own file.
|
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.
|
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.6.
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
@@ -70,6 +70,7 @@ class SiteOrigin_Widgets_Bundle {
|
|
70 |
add_filter( 'siteorigin_panels_prebuilt_layout', array($this, 'load_missing_widgets') );
|
71 |
add_filter( 'siteorigin_panels_widget_object', array($this, 'load_missing_widget'), 10, 2 );
|
72 |
|
|
|
73 |
add_filter( 'wp_enqueue_scripts', array($this, 'enqueue_active_widgets_scripts') );
|
74 |
}
|
75 |
|
@@ -606,6 +607,10 @@ class SiteOrigin_Widgets_Bundle {
|
|
606 |
return $links;
|
607 |
}
|
608 |
|
|
|
|
|
|
|
|
|
609 |
/**
|
610 |
* Ensure active widgets' scripts are enqueued at the right time.
|
611 |
*/
|
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.4
|
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.6.4');
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
70 |
add_filter( 'siteorigin_panels_prebuilt_layout', array($this, 'load_missing_widgets') );
|
71 |
add_filter( 'siteorigin_panels_widget_object', array($this, 'load_missing_widget'), 10, 2 );
|
72 |
|
73 |
+
add_filter( 'wp_enqueue_scripts', array($this, 'register_general_scripts') );
|
74 |
add_filter( 'wp_enqueue_scripts', array($this, 'enqueue_active_widgets_scripts') );
|
75 |
}
|
76 |
|
607 |
return $links;
|
608 |
}
|
609 |
|
610 |
+
function register_general_scripts(){
|
611 |
+
wp_register_script( 'sow-fittext', plugin_dir_url( __FILE__ ) . 'js/sow.jquery.fittext' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery' ), '1.2', true );
|
612 |
+
}
|
613 |
+
|
614 |
/**
|
615 |
* Ensure active widgets' scripts are enqueued at the right time.
|
616 |
*/
|
widgets/headline/headline.php
CHANGED
@@ -23,6 +23,10 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
23 |
);
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
26 |
function initialize_form(){
|
27 |
return array(
|
28 |
'headline' => array(
|
@@ -36,7 +40,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
36 |
),
|
37 |
'tag' => array(
|
38 |
'type' => 'select',
|
39 |
-
'label' => __( '
|
40 |
'default' => 'h1',
|
41 |
'options' => array(
|
42 |
'h1' => __( 'H1', 'so-widgets-bundle' ),
|
@@ -45,20 +49,25 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
45 |
'h4' => __( 'H4', 'so-widgets-bundle' ),
|
46 |
'h5' => __( 'H5', 'so-widgets-bundle' ),
|
47 |
'h6' => __( 'H6', 'so-widgets-bundle' ),
|
|
|
48 |
)
|
49 |
),
|
|
|
|
|
|
|
|
|
50 |
'font' => array(
|
51 |
'type' => 'font',
|
52 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
53 |
'default' => 'default'
|
54 |
),
|
55 |
-
'
|
56 |
-
'type' => '
|
57 |
-
'label' => __('
|
58 |
),
|
59 |
'align' => array(
|
60 |
'type' => 'select',
|
61 |
-
'label' => __( '
|
62 |
'default' => 'center',
|
63 |
'options' => array(
|
64 |
'center' => __( 'Center', 'so-widgets-bundle' ),
|
@@ -66,7 +75,16 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
66 |
'right' => __( 'Right', 'so-widgets-bundle' ),
|
67 |
'justify' => __( 'Justify', 'so-widgets-bundle' )
|
68 |
)
|
69 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
)
|
71 |
),
|
72 |
'sub_headline' => array(
|
@@ -80,7 +98,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
80 |
),
|
81 |
'tag' => array(
|
82 |
'type' => 'select',
|
83 |
-
'label' => __( '
|
84 |
'default' => 'h3',
|
85 |
'options' => array(
|
86 |
'h1' => __( 'H1', 'so-widgets-bundle' ),
|
@@ -89,20 +107,25 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
89 |
'h4' => __( 'H4', 'so-widgets-bundle' ),
|
90 |
'h5' => __( 'H5', 'so-widgets-bundle' ),
|
91 |
'h6' => __( 'H6', 'so-widgets-bundle' ),
|
|
|
92 |
)
|
93 |
),
|
|
|
|
|
|
|
|
|
94 |
'font' => array(
|
95 |
'type' => 'font',
|
96 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
97 |
'default' => 'default'
|
98 |
),
|
99 |
-
'
|
100 |
-
'type' => '
|
101 |
-
'label' => __('
|
102 |
),
|
103 |
'align' => array(
|
104 |
'type' => 'select',
|
105 |
-
'label' => __( '
|
106 |
'default' => 'center',
|
107 |
'options' => array(
|
108 |
'center' => __( 'Center', 'so-widgets-bundle' ),
|
@@ -110,7 +133,16 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
110 |
'right' => __( 'Right', 'so-widgets-bundle' ),
|
111 |
'justify' => __( 'Justify', 'so-widgets-bundle' )
|
112 |
)
|
113 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
)
|
115 |
),
|
116 |
'divider' => array(
|
@@ -134,32 +166,57 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
134 |
'outset' => __('Outset', 'so-widgets-bundle'),
|
135 |
)
|
136 |
),
|
137 |
-
'weight' => array(
|
138 |
-
'type' => 'select',
|
139 |
-
'label' => __( 'Weight', 'so-widgets-bundle' ),
|
140 |
-
'default' => 'thin',
|
141 |
-
'options' => array(
|
142 |
-
'thin' => __( 'Thin', 'so-widgets-bundle' ),
|
143 |
-
'medium' => __( 'Medium', 'so-widgets-bundle' ),
|
144 |
-
'thick' => __( 'Thick', 'so-widgets-bundle' ),
|
145 |
-
)
|
146 |
-
),
|
147 |
'color' => array(
|
148 |
'type' => 'color',
|
149 |
'label' => __('Color', 'so-widgets-bundle'),
|
150 |
'default' => '#EEEEEE'
|
151 |
),
|
152 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
'type' => 'measurement',
|
154 |
-
'label' => __('
|
155 |
-
'default' => '
|
156 |
),
|
157 |
-
'
|
158 |
'type' => 'measurement',
|
159 |
-
'label' => __('Top
|
160 |
-
'default' => '
|
161 |
-
)
|
162 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
)
|
164 |
);
|
165 |
}
|
@@ -167,77 +224,51 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
167 |
function get_less_variables( $instance ) {
|
168 |
$less_vars = array();
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
}
|
178 |
-
if ( ! empty( $headline_styles['color'] ) ) {
|
179 |
-
$less_vars['headline_color'] = $headline_styles['color'];
|
180 |
-
}
|
181 |
-
if ( ! empty( $headline_styles['font'] ) ) {
|
182 |
-
$font = siteorigin_widget_get_font( $headline_styles['font'] );
|
183 |
-
$less_vars['headline_font'] = $font['family'];
|
184 |
-
if ( ! empty( $font['weight'] ) ) {
|
185 |
-
$less_vars['headline_font_weight'] = $font['weight'];
|
186 |
-
}
|
187 |
-
}
|
188 |
-
}
|
189 |
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
$less_vars['sub_headline_tag'] = $sub_headline_styles['tag'];
|
197 |
-
}
|
198 |
-
if ( ! empty( $sub_headline_styles['color'] ) ) {
|
199 |
-
$less_vars['sub_headline_color'] = $sub_headline_styles['color'];
|
200 |
-
}
|
201 |
-
if ( ! empty( $sub_headline_styles['font'] ) ) {
|
202 |
-
$font = siteorigin_widget_get_font( $sub_headline_styles['font'] );
|
203 |
-
$less_vars['sub_headline_font'] = $font['family'];
|
204 |
-
if ( ! empty( $font['weight'] ) ) {
|
205 |
-
$less_vars['sub_headline_font_weight'] = $font['weight'];
|
206 |
-
}
|
207 |
}
|
208 |
}
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
if ( ! empty( $divider_styles['weight'] ) ) {
|
218 |
-
$less_vars['divider_weight'] = $divider_styles['weight'];
|
219 |
-
}
|
220 |
-
|
221 |
-
if ( ! empty( $divider_styles['color'] ) ) {
|
222 |
-
$less_vars['divider_color'] = $divider_styles['color'];
|
223 |
-
}
|
224 |
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
|
|
227 |
}
|
228 |
-
|
229 |
-
if ( !empty( $divider_styles['side_margin'] ) ) {
|
230 |
-
$less_vars['divider_side_margin'] = $divider_styles['side_margin'];
|
231 |
-
}
|
232 |
-
|
233 |
-
|
234 |
}
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
return $less_vars;
|
237 |
}
|
238 |
|
239 |
function get_google_font_fields( $instance ) {
|
240 |
-
|
241 |
return array(
|
242 |
$instance['headline']['font'],
|
243 |
$instance['sub_headline']['font'],
|
@@ -260,9 +291,71 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
260 |
'headline_tag' => $instance['headline']['tag'],
|
261 |
'sub_headline' => $instance['sub_headline']['text'],
|
262 |
'sub_headline_tag' => $instance['sub_headline']['tag'],
|
|
|
263 |
'has_divider' => ! empty( $instance['divider'] ) && $instance['divider']['style'] != 'none'
|
264 |
);
|
265 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
siteorigin_widget_register('sow-headline', __FILE__, 'SiteOrigin_Widget_Headline_Widget');
|
23 |
);
|
24 |
}
|
25 |
|
26 |
+
function initialize(){
|
27 |
+
add_filter( 'siteorigin_widgets_wrapper_classes_' . $this->id_base, array( $this, 'wrapper_class_filter' ), 10, 2 );
|
28 |
+
}
|
29 |
+
|
30 |
function initialize_form(){
|
31 |
return array(
|
32 |
'headline' => array(
|
40 |
),
|
41 |
'tag' => array(
|
42 |
'type' => 'select',
|
43 |
+
'label' => __( 'HTML Tag', 'so-widgets-bundle' ),
|
44 |
'default' => 'h1',
|
45 |
'options' => array(
|
46 |
'h1' => __( 'H1', 'so-widgets-bundle' ),
|
49 |
'h4' => __( 'H4', 'so-widgets-bundle' ),
|
50 |
'h5' => __( 'H5', 'so-widgets-bundle' ),
|
51 |
'h6' => __( 'H6', 'so-widgets-bundle' ),
|
52 |
+
'p' => __( 'Paragraph', 'so-widgets-bundle' ),
|
53 |
)
|
54 |
),
|
55 |
+
'color' => array(
|
56 |
+
'type' => 'color',
|
57 |
+
'label' => __('Color', 'so-widgets-bundle'),
|
58 |
+
),
|
59 |
'font' => array(
|
60 |
'type' => 'font',
|
61 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
62 |
'default' => 'default'
|
63 |
),
|
64 |
+
'font_size' => array(
|
65 |
+
'type' => 'measurement',
|
66 |
+
'label' => __('Font Size', 'so-widgets-bundle')
|
67 |
),
|
68 |
'align' => array(
|
69 |
'type' => 'select',
|
70 |
+
'label' => __( 'Alignment', 'so-widgets-bundle' ),
|
71 |
'default' => 'center',
|
72 |
'options' => array(
|
73 |
'center' => __( 'Center', 'so-widgets-bundle' ),
|
75 |
'right' => __( 'Right', 'so-widgets-bundle' ),
|
76 |
'justify' => __( 'Justify', 'so-widgets-bundle' )
|
77 |
)
|
78 |
+
),
|
79 |
+
'line_height' => array(
|
80 |
+
'type' => 'measurement',
|
81 |
+
'label' => __('Line Height', 'so-widgets-bundle')
|
82 |
+
),
|
83 |
+
'margin' => array(
|
84 |
+
'type' => 'measurement',
|
85 |
+
'label' => __('Top and Bottom Margin', 'so-widgets-bundle'),
|
86 |
+
'default' => '',
|
87 |
+
),
|
88 |
)
|
89 |
),
|
90 |
'sub_headline' => array(
|
98 |
),
|
99 |
'tag' => array(
|
100 |
'type' => 'select',
|
101 |
+
'label' => __( 'HTML Tag', 'so-widgets-bundle' ),
|
102 |
'default' => 'h3',
|
103 |
'options' => array(
|
104 |
'h1' => __( 'H1', 'so-widgets-bundle' ),
|
107 |
'h4' => __( 'H4', 'so-widgets-bundle' ),
|
108 |
'h5' => __( 'H5', 'so-widgets-bundle' ),
|
109 |
'h6' => __( 'H6', 'so-widgets-bundle' ),
|
110 |
+
'p' => __( 'Paragraph', 'so-widgets-bundle' ),
|
111 |
)
|
112 |
),
|
113 |
+
'color' => array(
|
114 |
+
'type' => 'color',
|
115 |
+
'label' => __('Color', 'so-widgets-bundle'),
|
116 |
+
),
|
117 |
'font' => array(
|
118 |
'type' => 'font',
|
119 |
'label' => __( 'Font', 'so-widgets-bundle' ),
|
120 |
'default' => 'default'
|
121 |
),
|
122 |
+
'font_size' => array(
|
123 |
+
'type' => 'measurement',
|
124 |
+
'label' => __('Font Size', 'so-widgets-bundle')
|
125 |
),
|
126 |
'align' => array(
|
127 |
'type' => 'select',
|
128 |
+
'label' => __( 'Alignment', 'so-widgets-bundle' ),
|
129 |
'default' => 'center',
|
130 |
'options' => array(
|
131 |
'center' => __( 'Center', 'so-widgets-bundle' ),
|
133 |
'right' => __( 'Right', 'so-widgets-bundle' ),
|
134 |
'justify' => __( 'Justify', 'so-widgets-bundle' )
|
135 |
)
|
136 |
+
),
|
137 |
+
'line_height' => array(
|
138 |
+
'type' => 'measurement',
|
139 |
+
'label' => __('Line Height', 'so-widgets-bundle')
|
140 |
+
),
|
141 |
+
'margin' => array(
|
142 |
+
'type' => 'measurement',
|
143 |
+
'label' => __('Top and Bottom Margin', 'so-widgets-bundle'),
|
144 |
+
'default' => '',
|
145 |
+
),
|
146 |
)
|
147 |
),
|
148 |
'divider' => array(
|
166 |
'outset' => __('Outset', 'so-widgets-bundle'),
|
167 |
)
|
168 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
'color' => array(
|
170 |
'type' => 'color',
|
171 |
'label' => __('Color', 'so-widgets-bundle'),
|
172 |
'default' => '#EEEEEE'
|
173 |
),
|
174 |
+
'thickness' => array(
|
175 |
+
'type' => 'slider',
|
176 |
+
'label' => __( 'Thickness', 'so-widgets-bundle' ),
|
177 |
+
'min' => 0,
|
178 |
+
'max' => 20,
|
179 |
+
'default' => 1
|
180 |
+
),
|
181 |
+
'align' => array(
|
182 |
+
'type' => 'select',
|
183 |
+
'label' => __('Alignment', 'so-widgets-bundle'),
|
184 |
+
'default' => 'center',
|
185 |
+
'options' => array(
|
186 |
+
'center' => __( 'Center', 'so-widgets-bundle' ),
|
187 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
188 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
189 |
+
),
|
190 |
+
),
|
191 |
+
'width' => array(
|
192 |
'type' => 'measurement',
|
193 |
+
'label' => __('Divider Width', 'so-widgets-bundle'),
|
194 |
+
'default' => '80%',
|
195 |
),
|
196 |
+
'margin' => array(
|
197 |
'type' => 'measurement',
|
198 |
+
'label' => __('Top and Bottom Margin', 'so-widgets-bundle'),
|
199 |
+
'default' => '',
|
200 |
+
),
|
201 |
)
|
202 |
+
),
|
203 |
+
|
204 |
+
'order' => array(
|
205 |
+
'type' => 'order',
|
206 |
+
'label' => __( 'Element Order', 'so-widgets-bundle' ),
|
207 |
+
'options' => array(
|
208 |
+
'headline' => __( 'Headline', 'so-widgets-bundle' ),
|
209 |
+
'divider' => __( 'Divider', 'so-widgets-bundle' ),
|
210 |
+
'sub_headline' => __( 'Sub Headline', 'so-widgets-bundle' ),
|
211 |
+
),
|
212 |
+
'default' => array( 'headline', 'divider', 'sub_headline' ),
|
213 |
+
),
|
214 |
+
|
215 |
+
'fittext' => array(
|
216 |
+
'type' => 'checkbox',
|
217 |
+
'label' => __( 'Use FitText', 'so-widgets-bundle' ),
|
218 |
+
'description' => __( 'Dynamically adjust your heading font size based on screen size.', 'so-widgets-bundle' ),
|
219 |
+
'default' => false,
|
220 |
)
|
221 |
);
|
222 |
}
|
224 |
function get_less_variables( $instance ) {
|
225 |
$less_vars = array();
|
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;
|
232 |
+
$less_vars['headline_line_height'] = isset( $instance['headline']['line_height'] ) ? $instance['headline']['line_height'] : false;
|
233 |
+
$less_vars['headline_margin'] = isset( $instance['headline']['margin'] ) ? $instance['headline']['margin'] : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
+
// Headline font family and weight
|
236 |
+
if ( ! empty( $instance['headline']['font'] ) ) {
|
237 |
+
$font = siteorigin_widget_get_font( $instance['headline']['font'] );
|
238 |
+
$less_vars['headline_font'] = $font['family'];
|
239 |
+
if ( ! empty( $font['weight'] ) ) {
|
240 |
+
$less_vars['headline_font_weight'] = $font['weight'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
}
|
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;
|
249 |
+
$less_vars['sub_headline_line_height'] = isset( $instance['sub_headline']['line_height'] ) ? $instance['sub_headline']['line_height'] : false;
|
250 |
+
$less_vars['sub_headline_margin'] = isset( $instance['sub_headline']['margin'] ) ? $instance['sub_headline']['margin'] : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
+
// Sub headline font family and weight
|
253 |
+
if ( ! empty( $instance['sub_headline']['font'] ) ) {
|
254 |
+
$font = siteorigin_widget_get_font( $instance['sub_headline']['font'] );
|
255 |
+
$less_vars['sub_headline_font'] = $font['family'];
|
256 |
+
if ( ! empty( $font['weight'] ) ) {
|
257 |
+
$less_vars['sub_headline_font_weight'] = $font['weight'];
|
258 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
|
261 |
+
$less_vars['divider_style'] = isset( $instance['divider']['style'] ) ? $instance['divider']['style'] : false;
|
262 |
+
$less_vars['divider_width'] = isset( $instance['divider']['width'] ) ? $instance['divider']['width'] : false;
|
263 |
+
$less_vars['divider_thickness'] = isset( $instance['divider']['thickness'] ) ? intval( $instance['divider']['thickness'] ) . 'px' : false;
|
264 |
+
$less_vars['divider_align'] = isset( $instance['divider']['align'] ) ? $instance['divider']['align'] : false;
|
265 |
+
$less_vars['divider_color'] = isset( $instance['divider']['color'] ) ? $instance['divider']['color'] : false;
|
266 |
+
$less_vars['divider_margin'] = isset( $instance['divider']['margin'] ) ? $instance['divider']['margin'] : false;
|
267 |
+
|
268 |
return $less_vars;
|
269 |
}
|
270 |
|
271 |
function get_google_font_fields( $instance ) {
|
|
|
272 |
return array(
|
273 |
$instance['headline']['font'],
|
274 |
$instance['sub_headline']['font'],
|
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'
|
296 |
);
|
297 |
}
|
298 |
+
|
299 |
+
function wrapper_class_filter( $classes, $instance ){
|
300 |
+
if( $instance[ 'fittext' ] ) {
|
301 |
+
$classes[] = 'so-widget-fittext-wrapper';
|
302 |
+
wp_enqueue_script( 'sow-fittext' );
|
303 |
+
}
|
304 |
+
return $classes;
|
305 |
+
}
|
306 |
+
|
307 |
+
function modify_instance( $instance ) {
|
308 |
+
// Change the old divider weight into a divider thickness
|
309 |
+
if( isset( $instance['divider']['weight'] ) && ! isset( $instance['divider']['thickness'] ) ) {
|
310 |
+
switch( $instance['divider']['weight'] ) {
|
311 |
+
case 'medium':
|
312 |
+
$instance['divider']['thickness'] = 3;
|
313 |
+
break;
|
314 |
+
case 'thick':
|
315 |
+
$instance['divider']['thickness'] = 5;
|
316 |
+
break;
|
317 |
+
case 'thin' :
|
318 |
+
default :
|
319 |
+
$instance['divider']['thickness'] = 1;
|
320 |
+
break;
|
321 |
+
}
|
322 |
+
unset( $instance['divider']['weight'] );
|
323 |
+
}
|
324 |
+
|
325 |
+
// Change the old divider side margin into overall width
|
326 |
+
if( isset( $instance['divider']['side_margin'] ) && ! isset( $instance['divider']['width'] ) ) {
|
327 |
+
global $content_width;
|
328 |
+
$value = floatval( $instance['divider']['side_margin'] );
|
329 |
+
|
330 |
+
switch( $instance['divider']['side_margin_unit'] ) {
|
331 |
+
case 'px' :
|
332 |
+
$instance['divider']['width'] = ( ( !empty( $content_width ) ? $content_width : 960 ) - ( 2 * $value ) ) . 'px';
|
333 |
+
$instance['divider']['width_unit'] = 'px';
|
334 |
+
break;
|
335 |
+
|
336 |
+
case '%' :
|
337 |
+
$instance['divider']['width'] = ( 100 - (2 * $value) ) . '%';
|
338 |
+
$instance['divider']['width_unit'] = '%';
|
339 |
+
break;
|
340 |
+
|
341 |
+
default :
|
342 |
+
$instance['divider']['width'] = '80%';
|
343 |
+
$instance['divider']['width_unit'] = '%';
|
344 |
+
break;
|
345 |
+
}
|
346 |
+
|
347 |
+
unset( $instance['divider']['side_margin'] );
|
348 |
+
unset( $instance['divider']['side_margin_unit'] );
|
349 |
+
}
|
350 |
+
|
351 |
+
// Copy top margin over to bottom margin
|
352 |
+
if( isset( $instance['divider']['top_margin'] ) && ! isset( $instance['divider']['bottom_margin'] ) ) {
|
353 |
+
$instance['divider']['bottom_margin'] = $instance['divider']['top_margin'];
|
354 |
+
$instance['divider']['bottom_margin_unit'] = $instance['divider']['top_margin_unit'];
|
355 |
+
}
|
356 |
+
|
357 |
+
return $instance;
|
358 |
+
}
|
359 |
}
|
360 |
|
361 |
siteorigin_widget_register('sow-headline', __FILE__, 'SiteOrigin_Widget_Headline_Widget');
|
widgets/headline/styles/default.less
CHANGED
@@ -5,41 +5,73 @@
|
|
5 |
@headline_tag: h1;
|
6 |
@headline_font: default;
|
7 |
@headline_font_weight: 400;
|
|
|
|
|
|
|
8 |
@headline_align: center;
|
9 |
@headline_color: default;
|
10 |
|
11 |
@sub_headline_tag: h3;
|
12 |
@sub_headline_font: default;
|
13 |
@sub_headline_font_weight: 400;
|
|
|
|
|
|
|
14 |
@sub_headline_align: center;
|
15 |
@sub_headline_color: default;
|
16 |
|
17 |
-
@divider_weight: thin;
|
18 |
@divider_style: solid;
|
|
|
|
|
19 |
@divider_color: #EEEEEE;
|
20 |
-
@
|
21 |
-
@
|
22 |
|
23 |
-
|
24 |
|
25 |
-
@{headline_tag} {
|
26 |
.font(@headline_font, @headline_font_weight);
|
27 |
text-align: @headline_align;
|
28 |
color: @headline_color;
|
29 |
-
line-height:
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
-
@{sub_headline_tag} {
|
33 |
.font(@sub_headline_font, @sub_headline_font_weight);
|
34 |
text-align: @sub_headline_align;
|
35 |
color: @sub_headline_color;
|
36 |
-
line-height:
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
.decoration {
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
margin: @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
}
|
5 |
@headline_tag: h1;
|
6 |
@headline_font: default;
|
7 |
@headline_font_weight: 400;
|
8 |
+
@headline_font_size: default;
|
9 |
+
@headline_line_height: 1.4em;
|
10 |
+
@headline_margin: default;
|
11 |
@headline_align: center;
|
12 |
@headline_color: default;
|
13 |
|
14 |
@sub_headline_tag: h3;
|
15 |
@sub_headline_font: default;
|
16 |
@sub_headline_font_weight: 400;
|
17 |
+
@sub_headline_font_size: default;
|
18 |
+
@sub_headline_line_height: 1.4em;
|
19 |
+
@sub_headline_margin: default;
|
20 |
@sub_headline_align: center;
|
21 |
@sub_headline_color: default;
|
22 |
|
|
|
23 |
@divider_style: solid;
|
24 |
+
@divider_width: 80%;
|
25 |
+
@divider_thickness: 1px;
|
26 |
@divider_color: #EEEEEE;
|
27 |
+
@divider_margin: 20px;
|
28 |
+
@divider_align: center;
|
29 |
|
30 |
+
.sow-headline-container {
|
31 |
|
32 |
+
@{headline_tag}.sow-headline {
|
33 |
.font(@headline_font, @headline_font_weight);
|
34 |
text-align: @headline_align;
|
35 |
color: @headline_color;
|
36 |
+
line-height: @headline_line_height;
|
37 |
+
font-size: @headline_font_size;
|
38 |
+
|
39 |
+
margin-top: @headline_margin;
|
40 |
+
margin-bottom: @headline_margin;
|
41 |
}
|
42 |
|
43 |
+
@{sub_headline_tag}.sow-sub-headline {
|
44 |
.font(@sub_headline_font, @sub_headline_font_weight);
|
45 |
text-align: @sub_headline_align;
|
46 |
color: @sub_headline_color;
|
47 |
+
line-height: @sub_headline_line_height;
|
48 |
+
font-size: @sub_headline_font_size;
|
49 |
+
|
50 |
+
margin-top: @sub_headline_margin;
|
51 |
+
margin-bottom: @sub_headline_margin;
|
52 |
}
|
53 |
|
54 |
.decoration {
|
55 |
+
line-height: 0em;
|
56 |
+
text-align: @divider_align;
|
57 |
+
|
58 |
+
margin-top: @divider_margin;
|
59 |
+
margin-bottom: @divider_margin;
|
60 |
+
|
61 |
+
.decoration-inside {
|
62 |
+
height: 1px;
|
63 |
+
display: inline-block;
|
64 |
+
border-top: @divider_thickness @divider_style @divider_color;
|
65 |
+
width: 100%;
|
66 |
+
max-width: @divider_width;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
*:first-child {
|
71 |
+
margin-top: 0 !important;
|
72 |
+
}
|
73 |
+
|
74 |
+
*:last-child {
|
75 |
+
margin-bottom: 0 !important;
|
76 |
}
|
77 |
}
|
widgets/headline/tpl/default.php
CHANGED
@@ -1,17 +1,29 @@
|
|
1 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
<?php if ( !empty( $sub_headline ) ) : ?>
|
14 |
-
<<?php echo $sub_headline_tag ?>><?php echo $sub_headline ?></<?php echo $sub_headline_tag ?>>
|
15 |
-
<?php endif; ?>
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
</div>
|
1 |
+
<div class="sow-headline-container <?php if( $instance['fittext'] ) ?>">
|
2 |
+
<?php
|
3 |
+
foreach( $order as $item ) {
|
4 |
+
switch( $item ) {
|
5 |
+
case 'headline' :
|
6 |
+
if( !empty( $headline ) ) {
|
7 |
+
echo '<' . $headline_tag . ' class="sow-headline">' . wp_kses_post( $headline ) . '</' . $headline_tag . '>';
|
8 |
+
}
|
9 |
+
break;
|
10 |
|
11 |
+
case 'divider' :
|
12 |
+
if( $has_divider ) {
|
13 |
+
?>
|
14 |
+
<div class="decoration">
|
15 |
+
<div class="decoration-inside"></div>
|
16 |
+
</div>
|
17 |
+
<?php
|
18 |
+
}
|
19 |
+
break;
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
case 'sub_headline' :
|
22 |
+
if( !empty( $sub_headline ) ) {
|
23 |
+
echo '<' . $sub_headline_tag . ' class="sow-sub-headline">' . wp_kses_post( $sub_headline ) . '</' . $sub_headline_tag . '>';
|
24 |
+
}
|
25 |
+
break;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
?>
|
29 |
</div>
|
widgets/hero/hero.php
CHANGED
@@ -33,6 +33,8 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
33 |
SiteOrigin_Widgets_Bundle::single()->include_widget( 'button' );
|
34 |
}
|
35 |
|
|
|
|
|
36 |
// Let the slider base class do its initialization
|
37 |
parent::initialize();
|
38 |
}
|
@@ -197,6 +199,13 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
197 |
'default' => '38px',
|
198 |
),
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
'heading_shadow' => array(
|
201 |
'type' => 'slider',
|
202 |
'label' => __('Heading shadow intensity', 'so-widgets-bundle'),
|
@@ -358,6 +367,14 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
358 |
}
|
359 |
}
|
360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
}
|
362 |
|
363 |
siteorigin_widget_register('sow-hero', __FILE__, 'SiteOrigin_Widget_Hero_Widget');
|
33 |
SiteOrigin_Widgets_Bundle::single()->include_widget( 'button' );
|
34 |
}
|
35 |
|
36 |
+
add_filter( 'siteorigin_widgets_wrapper_classes_' . $this->id_base, array( $this, 'wrapper_class_filter' ), 10, 2 );
|
37 |
+
|
38 |
// Let the slider base class do its initialization
|
39 |
parent::initialize();
|
40 |
}
|
199 |
'default' => '38px',
|
200 |
),
|
201 |
|
202 |
+
'fittext' => array(
|
203 |
+
'type' => 'checkbox',
|
204 |
+
'label' => __( 'Use FitText', 'so-widgets-bundle' ),
|
205 |
+
'description' => __( 'Dynamically adjust your heading font size based on screen size.', 'so-widgets-bundle' ),
|
206 |
+
'default' => true,
|
207 |
+
),
|
208 |
+
|
209 |
'heading_shadow' => array(
|
210 |
'type' => 'slider',
|
211 |
'label' => __('Heading shadow intensity', 'so-widgets-bundle'),
|
367 |
}
|
368 |
}
|
369 |
|
370 |
+
function wrapper_class_filter( $classes, $instance ){
|
371 |
+
if( $instance['design']['fittext'] ) {
|
372 |
+
$classes[] = 'so-widget-fittext-wrapper';
|
373 |
+
wp_enqueue_script( 'sow-fittext' );
|
374 |
+
}
|
375 |
+
return $classes;
|
376 |
+
}
|
377 |
+
|
378 |
}
|
379 |
|
380 |
siteorigin_widget_register('sow-hero', __FILE__, 'SiteOrigin_Widget_Hero_Widget');
|