Version Description
- 7 February 2018 =
- Slider: Add playsinline for Video backgrounds for iOS.
- Repeater field: Trigger change events for repeater when adding, removing or duplicating items.
- TinyMCE field: Removed special handling for TinyMCE fields when retrieving data. Just use field value directly.
- Fixed build overwriting some CSS files.
Download this release
Release Info
Developer | gpriday |
Plugin | SiteOrigin Widgets Bundle |
Version | 1.11.4 |
Comparing to | |
See all releases |
Code changes from version 1.11.3 to 1.11.4
- admin/tpl/admin.php +130 -130
- base/base.php +254 -254
- base/inc/fields/checkbox.class.php +26 -26
- base/inc/fields/js/tinymce-field.js +112 -112
- base/inc/fields/slider.class.php +49 -49
- base/inc/fields/tinymce.class.php +525 -525
- base/inc/post-selector.php +134 -134
- base/inc/widget-manager.class.php +167 -167
- base/inc/widgets/base-slider.class.php +341 -341
- base/js/admin.js +1292 -1303
- base/js/admin.min.js +1 -1
- compat/beaver-builder/beaver-builder.php +97 -97
- compat/compat.php +55 -55
- js/sow.google.map.js +473 -473
- lang/so-widgets-bundle.pot +436 -432
- readme.txt +8 -2
- so-widgets-bundle.php +795 -795
- widgets/accordion/js/accordion.js +111 -111
- widgets/accordion/styles/default.less +105 -105
- widgets/accordion/tpl/default.php +41 -41
- widgets/button/button.php +382 -382
- widgets/button/css/style.css +1 -45
- widgets/button/styles/atom.less +59 -59
- widgets/button/styles/flat.less +59 -59
- widgets/button/styles/wire.less +56 -56
- widgets/contact/contact.php +1283 -1283
- widgets/contact/js/contact.js +63 -63
- widgets/contact/styles/default.less +231 -231
- widgets/contact/tpl/default.php +58 -58
- widgets/cta/css/style.css +1 -42
- widgets/cta/cta.php +139 -131
- widgets/cta/styles/default.less +66 -66
- widgets/features/css/style.css +1 -58
- widgets/features/features.php +315 -315
- widgets/features/styles/default.less +187 -187
- widgets/google-map/css/style.css +1 -11
- widgets/google-map/google-map.php +694 -694
- widgets/hero/hero.php +447 -447
- widgets/hero/styles/default.less +119 -119
- widgets/image-grid/css/image-grid.css +1 -11
- widgets/post-carousel/css/style.css +1 -160
- widgets/social-media-buttons/social-media-buttons.php +306 -306
- widgets/social-media-buttons/styles/widget-mixins.less +46 -46
- widgets/tabs/js/tabs.js +82 -82
- widgets/tabs/styles/default.less +120 -120
- widgets/testimonial/css/style.css +1 -56
- widgets/testimonial/styles/default.less +188 -188
- widgets/testimonial/testimonial.php +369 -361
- widgets/testimonial/tpl/default.php +72 -72
- widgets/video/css/html-player-responsive.css +1 -5
- widgets/video/css/skin.css +1 -154
admin/tpl/admin.php
CHANGED
@@ -1,130 +1,130 @@
|
|
1 |
-
<div class="wrap" id="sow-widgets-page">
|
2 |
-
<div class="page-banner">
|
3 |
-
|
4 |
-
<span class="icon">
|
5 |
-
<img src="<?php echo siteorigin_widgets_url( 'admin/images/icon-back.png' )?>" class="icon-back" width="50" height="43">
|
6 |
-
<img src="<?php echo siteorigin_widgets_url( 'admin/images/icon-gear.png' ) ?>" class="icon-gear" width="26" height="26">
|
7 |
-
<img src="<?php echo siteorigin_widgets_url( 'admin/images/icon-front.png' ) ?>" class="icon-front" width="50" height="43">
|
8 |
-
</span>
|
9 |
-
<h1><?php _e('SiteOrigin Widgets Bundle', 'so-widgets-bundle') ?></h1>
|
10 |
-
|
11 |
-
<div id="sow-widget-search">
|
12 |
-
<input type="search" placeholder="<?php esc_attr_e('Filter Widgets', 'so-widgets-bundle') ?>" />
|
13 |
-
</div>
|
14 |
-
</div>
|
15 |
-
|
16 |
-
<ul class="page-nav">
|
17 |
-
<li class="active"><a href="#all"><?php _e('All', 'so-widgets-bundle') ?></a></li>
|
18 |
-
<li><a href="#enabled"><?php _e('Enabled', 'so-widgets-bundle') ?></a></li>
|
19 |
-
<li><a href="#disabled"><?php _e('Disabled', 'so-widgets-bundle') ?></a></li>
|
20 |
-
</ul>
|
21 |
-
|
22 |
-
|
23 |
-
<div id="widgets-list">
|
24 |
-
|
25 |
-
<?php
|
26 |
-
foreach( $widgets as $file => $widget ):
|
27 |
-
$file = wp_normalize_path( $file );
|
28 |
-
?>
|
29 |
-
<div class="so-widget-wrap">
|
30 |
-
<div class="so-widget so-widget-is-<?php echo $widget['Active'] ? 'active' : 'inactive' ?>" data-id="<?php echo esc_attr( $widget['ID'] ) ?>">
|
31 |
-
|
32 |
-
<?php
|
33 |
-
$banner = '';
|
34 |
-
$widget_dir = dirname( $file );
|
35 |
-
if( file_exists( $widget_dir . '/assets/banner.svg' ) ) {
|
36 |
-
$banner = str_replace( wp_normalize_path( WP_CONTENT_DIR ), content_url(), $widget_dir ) . '/assets/banner.svg';
|
37 |
-
}
|
38 |
-
$banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
|
39 |
-
?>
|
40 |
-
<div class="so-widget-banner" data-seed="<?php echo esc_attr( substr( md5($widget['ID']), 0, 6 ) ) ?>">
|
41 |
-
<?php if( !empty( $banner ) ) : ?>
|
42 |
-
<img src="<?php echo esc_url($banner) ?>" />
|
43 |
-
<?php endif; ?>
|
44 |
-
</div>
|
45 |
-
|
46 |
-
<div class="so-widget-text">
|
47 |
-
|
48 |
-
<div class="so-widget-active-indicator"><?php _e('Active', 'so-widgets-bundle') ?></div>
|
49 |
-
|
50 |
-
<h3><?php echo esc_html( $widget['Name'] ); ?></h3>
|
51 |
-
|
52 |
-
<div class="so-widget-description">
|
53 |
-
<?php echo esc_html( $widget['Description'] ) ?>
|
54 |
-
</div>
|
55 |
-
|
56 |
-
<?php if( !empty( $widget['Author'] ) ) : ?>
|
57 |
-
<div class="so-widget-byline">
|
58 |
-
By
|
59 |
-
<strong>
|
60 |
-
<?php
|
61 |
-
if( !empty($widget['AuthorURI']) ) echo '<a href="' . esc_url( $widget['AuthorURI'] ) . '" target="_blank" rel="noopener noreferrer">';
|
62 |
-
echo esc_html( $widget['Author'] );
|
63 |
-
if( !empty($widget['AuthorURI']) ) echo '</a>';
|
64 |
-
?>
|
65 |
-
</strong>
|
66 |
-
</div>
|
67 |
-
<?php endif; ?>
|
68 |
-
|
69 |
-
<div class="so-widget-toggle-active">
|
70 |
-
<button class="button-secondary so-widget-activate" data-status="1"><?php esc_html_e( 'Activate', 'so-widgets-bundle' ) ?></button>
|
71 |
-
<button class="button-secondary so-widget-deactivate" data-status="0"><?php esc_html_e( 'Deactivate', 'so-widgets-bundle' ) ?></button>
|
72 |
-
</div>
|
73 |
-
|
74 |
-
<?php
|
75 |
-
/** @var SiteOrigin_Widget $widget_object */
|
76 |
-
$widget_object = !empty( $widget_objects[ $file ] ) ? $widget_objects[ $file ] : false;
|
77 |
-
if( !empty( $widget_object ) && $widget_object->has_form( 'settings' ) ) {
|
78 |
-
$rel_path = str_replace( wp_normalize_path( WP_CONTENT_DIR ), '', $file );
|
79 |
-
|
80 |
-
$form_url = add_query_arg( array(
|
81 |
-
'id' => $rel_path,
|
82 |
-
'action' => 'so_widgets_setting_form',
|
83 |
-
),
|
84 |
-
admin_url( 'admin-ajax.php' )
|
85 |
-
);
|
86 |
-
$form_url = wp_nonce_url( $form_url, 'display-widget-form' );
|
87 |
-
|
88 |
-
?>
|
89 |
-
<button class="button-secondary so-widget-settings" data-form-url="<?php echo esc_url( $form_url ) ?>">
|
90 |
-
<?php esc_html_e( 'Settings', 'so-widgets-bundle' ) ?>
|
91 |
-
</button>
|
92 |
-
<?php
|
93 |
-
}
|
94 |
-
?>
|
95 |
-
</div>
|
96 |
-
|
97 |
-
</div>
|
98 |
-
</div>
|
99 |
-
<?php endforeach; ?>
|
100 |
-
|
101 |
-
</div>
|
102 |
-
|
103 |
-
<div class="developers-link">
|
104 |
-
<?php _e('Developers - create your own widgets for the Widgets Bundle.', 'so-widgets-bundle') ?>
|
105 |
-
<a href="https://siteorigin.com/docs/widgets-bundle/" target="_blank" rel="noopener noreferrer"><?php _e('Read More', 'so-widgets-bundle') ?></a>.
|
106 |
-
</div>
|
107 |
-
|
108 |
-
<div id="sow-settings-dialog">
|
109 |
-
<div class="so-overlay"></div>
|
110 |
-
|
111 |
-
<div class="so-title-bar">
|
112 |
-
<h3 class="so-title"><?php _e( 'Widget Settings', 'so-widgets-bundle' ) ?></h3>
|
113 |
-
<a class="so-close">
|
114 |
-
<span class="so-dialog-icon"></span>
|
115 |
-
</a>
|
116 |
-
</div>
|
117 |
-
|
118 |
-
<div class="so-content so-loading">
|
119 |
-
</div>
|
120 |
-
|
121 |
-
<div class="so-toolbar">
|
122 |
-
<div class="so-buttons">
|
123 |
-
<button class="button-primary so-save"><?php _e( 'Save', 'so-widgets-bundle' ) ?></button>
|
124 |
-
</div>
|
125 |
-
</div>
|
126 |
-
</div>
|
127 |
-
|
128 |
-
<iframe id="so-widget-settings-save" name="so-widget-settings-save"></iframe>
|
129 |
-
|
130 |
-
</div>
|
1 |
+
<div class="wrap" id="sow-widgets-page">
|
2 |
+
<div class="page-banner">
|
3 |
+
|
4 |
+
<span class="icon">
|
5 |
+
<img src="<?php echo siteorigin_widgets_url( 'admin/images/icon-back.png' )?>" class="icon-back" width="50" height="43">
|
6 |
+
<img src="<?php echo siteorigin_widgets_url( 'admin/images/icon-gear.png' ) ?>" class="icon-gear" width="26" height="26">
|
7 |
+
<img src="<?php echo siteorigin_widgets_url( 'admin/images/icon-front.png' ) ?>" class="icon-front" width="50" height="43">
|
8 |
+
</span>
|
9 |
+
<h1><?php _e('SiteOrigin Widgets Bundle', 'so-widgets-bundle') ?></h1>
|
10 |
+
|
11 |
+
<div id="sow-widget-search">
|
12 |
+
<input type="search" placeholder="<?php esc_attr_e('Filter Widgets', 'so-widgets-bundle') ?>" />
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
<ul class="page-nav">
|
17 |
+
<li class="active"><a href="#all"><?php _e('All', 'so-widgets-bundle') ?></a></li>
|
18 |
+
<li><a href="#enabled"><?php _e('Enabled', 'so-widgets-bundle') ?></a></li>
|
19 |
+
<li><a href="#disabled"><?php _e('Disabled', 'so-widgets-bundle') ?></a></li>
|
20 |
+
</ul>
|
21 |
+
|
22 |
+
|
23 |
+
<div id="widgets-list">
|
24 |
+
|
25 |
+
<?php
|
26 |
+
foreach( $widgets as $file => $widget ):
|
27 |
+
$file = wp_normalize_path( $file );
|
28 |
+
?>
|
29 |
+
<div class="so-widget-wrap">
|
30 |
+
<div class="so-widget so-widget-is-<?php echo $widget['Active'] ? 'active' : 'inactive' ?>" data-id="<?php echo esc_attr( $widget['ID'] ) ?>">
|
31 |
+
|
32 |
+
<?php
|
33 |
+
$banner = '';
|
34 |
+
$widget_dir = dirname( $file );
|
35 |
+
if( file_exists( $widget_dir . '/assets/banner.svg' ) ) {
|
36 |
+
$banner = str_replace( wp_normalize_path( WP_CONTENT_DIR ), content_url(), $widget_dir ) . '/assets/banner.svg';
|
37 |
+
}
|
38 |
+
$banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
|
39 |
+
?>
|
40 |
+
<div class="so-widget-banner" data-seed="<?php echo esc_attr( substr( md5($widget['ID']), 0, 6 ) ) ?>">
|
41 |
+
<?php if( !empty( $banner ) ) : ?>
|
42 |
+
<img src="<?php echo esc_url($banner) ?>" />
|
43 |
+
<?php endif; ?>
|
44 |
+
</div>
|
45 |
+
|
46 |
+
<div class="so-widget-text">
|
47 |
+
|
48 |
+
<div class="so-widget-active-indicator"><?php _e('Active', 'so-widgets-bundle') ?></div>
|
49 |
+
|
50 |
+
<h3><?php echo esc_html( $widget['Name'] ); ?></h3>
|
51 |
+
|
52 |
+
<div class="so-widget-description">
|
53 |
+
<?php echo esc_html( $widget['Description'] ) ?>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<?php if( !empty( $widget['Author'] ) ) : ?>
|
57 |
+
<div class="so-widget-byline">
|
58 |
+
By
|
59 |
+
<strong>
|
60 |
+
<?php
|
61 |
+
if( !empty($widget['AuthorURI']) ) echo '<a href="' . esc_url( $widget['AuthorURI'] ) . '" target="_blank" rel="noopener noreferrer">';
|
62 |
+
echo esc_html( $widget['Author'] );
|
63 |
+
if( !empty($widget['AuthorURI']) ) echo '</a>';
|
64 |
+
?>
|
65 |
+
</strong>
|
66 |
+
</div>
|
67 |
+
<?php endif; ?>
|
68 |
+
|
69 |
+
<div class="so-widget-toggle-active">
|
70 |
+
<button class="button-secondary so-widget-activate" data-status="1"><?php esc_html_e( 'Activate', 'so-widgets-bundle' ) ?></button>
|
71 |
+
<button class="button-secondary so-widget-deactivate" data-status="0"><?php esc_html_e( 'Deactivate', 'so-widgets-bundle' ) ?></button>
|
72 |
+
</div>
|
73 |
+
|
74 |
+
<?php
|
75 |
+
/** @var SiteOrigin_Widget $widget_object */
|
76 |
+
$widget_object = !empty( $widget_objects[ $file ] ) ? $widget_objects[ $file ] : false;
|
77 |
+
if( !empty( $widget_object ) && $widget_object->has_form( 'settings' ) ) {
|
78 |
+
$rel_path = str_replace( wp_normalize_path( WP_CONTENT_DIR ), '', $file );
|
79 |
+
|
80 |
+
$form_url = add_query_arg( array(
|
81 |
+
'id' => $rel_path,
|
82 |
+
'action' => 'so_widgets_setting_form',
|
83 |
+
),
|
84 |
+
admin_url( 'admin-ajax.php' )
|
85 |
+
);
|
86 |
+
$form_url = wp_nonce_url( $form_url, 'display-widget-form' );
|
87 |
+
|
88 |
+
?>
|
89 |
+
<button class="button-secondary so-widget-settings" data-form-url="<?php echo esc_url( $form_url ) ?>">
|
90 |
+
<?php esc_html_e( 'Settings', 'so-widgets-bundle' ) ?>
|
91 |
+
</button>
|
92 |
+
<?php
|
93 |
+
}
|
94 |
+
?>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
<?php endforeach; ?>
|
100 |
+
|
101 |
+
</div>
|
102 |
+
|
103 |
+
<div class="developers-link">
|
104 |
+
<?php _e('Developers - create your own widgets for the Widgets Bundle.', 'so-widgets-bundle') ?>
|
105 |
+
<a href="https://siteorigin.com/docs/widgets-bundle/" target="_blank" rel="noopener noreferrer"><?php _e('Read More', 'so-widgets-bundle') ?></a>.
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<div id="sow-settings-dialog">
|
109 |
+
<div class="so-overlay"></div>
|
110 |
+
|
111 |
+
<div class="so-title-bar">
|
112 |
+
<h3 class="so-title"><?php _e( 'Widget Settings', 'so-widgets-bundle' ) ?></h3>
|
113 |
+
<a class="so-close">
|
114 |
+
<span class="so-dialog-icon"></span>
|
115 |
+
</a>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<div class="so-content so-loading">
|
119 |
+
</div>
|
120 |
+
|
121 |
+
<div class="so-toolbar">
|
122 |
+
<div class="so-buttons">
|
123 |
+
<button class="button-primary so-save"><?php _e( 'Save', 'so-widgets-bundle' ) ?></button>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
|
128 |
+
<iframe id="so-widget-settings-save" name="so-widget-settings-save"></iframe>
|
129 |
+
|
130 |
+
</div>
|
base/base.php
CHANGED
@@ -1,254 +1,254 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
include plugin_dir_path(__FILE__).'inc/fields/siteorigin-widget-field-class-loader.class.php';
|
4 |
-
include plugin_dir_path(__FILE__).'siteorigin-widget.class.php';
|
5 |
-
|
6 |
-
include plugin_dir_path(__FILE__).'inc/widget-manager.class.php';
|
7 |
-
include plugin_dir_path(__FILE__).'inc/meta-box-manager.php';
|
8 |
-
include plugin_dir_path(__FILE__).'inc/post-selector.php';
|
9 |
-
include plugin_dir_path(__FILE__).'inc/string-utils.php';
|
10 |
-
include plugin_dir_path(__FILE__).'inc/array-utils.php';
|
11 |
-
include plugin_dir_path(__FILE__).'inc/attachments.php';
|
12 |
-
include plugin_dir_path(__FILE__).'inc/actions.php';
|
13 |
-
include plugin_dir_path(__FILE__).'inc/shortcode.php';
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @param $css
|
17 |
-
*/
|
18 |
-
function siteorigin_widget_add_inline_css($css){
|
19 |
-
global $siteorigin_widgets_inline_styles;
|
20 |
-
if ( empty( $siteorigin_widgets_inline_styles ) ) {
|
21 |
-
$siteorigin_widgets_inline_styles = array();
|
22 |
-
}
|
23 |
-
|
24 |
-
$siteorigin_widgets_inline_styles[] = $css;
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Print any inline styles that have been added with siteorigin_widget_add_inline_css
|
29 |
-
*/
|
30 |
-
function siteorigin_widget_print_styles(){
|
31 |
-
global $siteorigin_widgets_inline_styles;
|
32 |
-
if ( ! empty( $siteorigin_widgets_inline_styles ) ) {
|
33 |
-
foreach ($siteorigin_widgets_inline_styles as $widget_css) {
|
34 |
-
?>
|
35 |
-
<style type="text/css"><?php echo($widget_css) ?></style><?php
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
$siteorigin_widgets_inline_styles = array();
|
40 |
-
}
|
41 |
-
add_action('wp_head', 'siteorigin_widget_print_styles');
|
42 |
-
add_action('wp_footer', 'siteorigin_widget_print_styles');
|
43 |
-
|
44 |
-
/**
|
45 |
-
* The ajax handler for getting a list of available icons.
|
46 |
-
*/
|
47 |
-
function siteorigin_widget_get_icon_list(){
|
48 |
-
if(empty($_GET['family'])) exit();
|
49 |
-
if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
|
50 |
-
|
51 |
-
$widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array() );
|
52 |
-
|
53 |
-
header('content-type: application/json');
|
54 |
-
echo json_encode( !empty($widget_icon_families[$_GET['family']]) ? $widget_icon_families[$_GET['family']] : array() );
|
55 |
-
exit();
|
56 |
-
}
|
57 |
-
add_action('wp_ajax_siteorigin_widgets_get_icons', 'siteorigin_widget_get_icon_list');
|
58 |
-
|
59 |
-
/**
|
60 |
-
* @param $icon_value
|
61 |
-
* @param bool $icon_styles
|
62 |
-
*
|
63 |
-
* @return bool|string
|
64 |
-
*/
|
65 |
-
function siteorigin_widget_get_icon($icon_value, $icon_styles = false) {
|
66 |
-
if( empty( $icon_value ) ) return false;
|
67 |
-
list( $family, $icon ) = explode('-', $icon_value, 2);
|
68 |
-
if( empty( $family ) || empty( $icon ) ) return false;
|
69 |
-
|
70 |
-
static $widget_icon_families;
|
71 |
-
static $widget_icons_enqueued = array();
|
72 |
-
|
73 |
-
if( empty($widget_icon_families) ) $widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array() );
|
74 |
-
if( empty($widget_icon_families[$family]) || empty($widget_icon_families[$family]['icons'][$icon]) ) return false;
|
75 |
-
|
76 |
-
if(empty($widget_icons_enqueued[$family]) && !empty($widget_icon_families[$family]['style_uri'])) {
|
77 |
-
if( !wp_style_is( 'siteorigin-widget-icon-font-'.$family ) ) {
|
78 |
-
wp_enqueue_style('siteorigin-widget-icon-font-'.$family, $widget_icon_families[$family]['style_uri'] );
|
79 |
-
}
|
80 |
-
return '<span class="sow-icon-' . esc_attr($family) . '" data-sow-icon="' . $widget_icon_families[$family]['icons'][$icon] . '" ' . ( !empty($icon_styles) ? 'style="'.implode('; ', $icon_styles).'"' : '' ) . '></span>';
|
81 |
-
}
|
82 |
-
else {
|
83 |
-
return false;
|
84 |
-
}
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* @param $font_value
|
90 |
-
*
|
91 |
-
* @return array
|
92 |
-
*/
|
93 |
-
function siteorigin_widget_get_font($font_value) {
|
94 |
-
|
95 |
-
$web_safe = array(
|
96 |
-
'Helvetica Neue' => 'Arial, Helvetica, Geneva, sans-serif',
|
97 |
-
'Lucida Grande' => 'Lucida, Verdana, sans-serif',
|
98 |
-
'Georgia' => '"Times New Roman", Times, serif',
|
99 |
-
'Courier New' => 'Courier, mono',
|
100 |
-
'default' => 'default',
|
101 |
-
);
|
102 |
-
|
103 |
-
$font = array();
|
104 |
-
if ( isset( $web_safe[ $font_value ] ) ) {
|
105 |
-
$font['family'] = $web_safe[ $font_value ];
|
106 |
-
}
|
107 |
-
else if( siteorigin_widgets_is_google_webfont( $font_value ) ) {
|
108 |
-
$font_parts = explode( ':', $font_value );
|
109 |
-
$font['family'] = $font_parts[0];
|
110 |
-
$font_url_param = urlencode( $font_parts[0] );
|
111 |
-
if ( count( $font_parts ) > 1 ) {
|
112 |
-
$font['weight'] = $font_parts[1];
|
113 |
-
$font_url_param .= ':' . $font_parts[1];
|
114 |
-
}
|
115 |
-
$font['css_import'] = '@import url(https://fonts.googleapis.com/css?family=' . $font_url_param . ');';
|
116 |
-
}
|
117 |
-
else {
|
118 |
-
$font['family'] = $font_value;
|
119 |
-
$font = apply_filters( 'siteorigin_widget_get_custom_font_family', $font );
|
120 |
-
}
|
121 |
-
|
122 |
-
return $font;
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Compatibility with Page Builder, add the groups and icons.
|
127 |
-
*
|
128 |
-
* @param $widgets
|
129 |
-
*
|
130 |
-
* @return mixed
|
131 |
-
*/
|
132 |
-
function siteorigin_widget_add_bundle_groups($widgets){
|
133 |
-
foreach( $widgets as $class => &$widget ) {
|
134 |
-
if( preg_match('/SiteOrigin_Widgets?_(.*)_Widget/i', $class, $matches) ) {
|
135 |
-
$widget['icon'] = 'so-widget-icon so-widget-icon-'.strtolower($matches[1]);
|
136 |
-
$widget['groups'] = array('so-widgets-bundle');
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
return $widgets;
|
141 |
-
}
|
142 |
-
add_filter('siteorigin_panels_widgets', 'siteorigin_widget_add_bundle_groups', 11);
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Escape a URL
|
146 |
-
*
|
147 |
-
* @param $url
|
148 |
-
*
|
149 |
-
* @return string
|
150 |
-
*/
|
151 |
-
function sow_esc_url( $url ) {
|
152 |
-
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
153 |
-
// Convert the special post URL into a permalink
|
154 |
-
$url = get_the_permalink( intval($matches[1]) );
|
155 |
-
if( empty($url) ) return '';
|
156 |
-
}
|
157 |
-
|
158 |
-
$protocols = wp_allowed_protocols();
|
159 |
-
$protocols[] = 'skype';
|
160 |
-
return esc_url( $url, $protocols );
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* A special URL escaping function that handles additional protocols
|
165 |
-
*
|
166 |
-
* @param $url
|
167 |
-
*
|
168 |
-
* @return string
|
169 |
-
*/
|
170 |
-
function sow_esc_url_raw( $url ) {
|
171 |
-
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
172 |
-
// Convert the special post URL into a permalink
|
173 |
-
$url = get_the_permalink( intval($matches[1]) );
|
174 |
-
}
|
175 |
-
|
176 |
-
$protocols = wp_allowed_protocols();
|
177 |
-
$protocols[] = 'skype';
|
178 |
-
return esc_url_raw( $url, $protocols );
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Get all the Google Web Fonts.
|
183 |
-
*
|
184 |
-
* @return mixed|void
|
185 |
-
*/
|
186 |
-
function siteorigin_widgets_fonts_google_webfonts( ) {
|
187 |
-
$fonts = include plugin_dir_path( __FILE__ ) . 'inc/fonts.php';
|
188 |
-
$fonts = apply_filters( 'siteorigin_widgets_google_webfonts', $fonts );
|
189 |
-
return !empty( $fonts ) ? $fonts : array();
|
190 |
-
}
|
191 |
-
|
192 |
-
function siteorigin_widgets_is_google_webfont( $font_value ) {
|
193 |
-
$google_webfonts = siteorigin_widgets_fonts_google_webfonts();
|
194 |
-
|
195 |
-
$font_family = explode( ':', $font_value );
|
196 |
-
$font_family = $font_family[0];
|
197 |
-
|
198 |
-
return isset( $google_webfonts[$font_family] );
|
199 |
-
}
|
200 |
-
|
201 |
-
function siteorigin_widgets_font_families( ){
|
202 |
-
// Add the default fonts
|
203 |
-
$font_families = array(
|
204 |
-
'Helvetica Neue' => 'Helvetica Neue',
|
205 |
-
'Lucida Grande' => 'Lucida Grande',
|
206 |
-
'Georgia' => 'Georgia',
|
207 |
-
'Courier New' => 'Courier New',
|
208 |
-
);
|
209 |
-
|
210 |
-
// Add in all the Google font families
|
211 |
-
foreach ( siteorigin_widgets_fonts_google_webfonts() as $font => $variants ) {
|
212 |
-
foreach ( $variants as $variant ) {
|
213 |
-
if ( $variant == 'regular' || $variant == 400 ) {
|
214 |
-
$font_families[ $font ] = $font;
|
215 |
-
}
|
216 |
-
else {
|
217 |
-
$font_families[ $font . ':' . $variant ] = $font . ' (' . $variant . ')';
|
218 |
-
}
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
return apply_filters('siteorigin_widgets_font_families', $font_families);
|
223 |
-
}
|
224 |
-
|
225 |
-
function siteorigin_widgets_tinymce_admin_print_styles() {
|
226 |
-
wp_enqueue_style( 'editor-buttons' );
|
227 |
-
}
|
228 |
-
add_action( 'admin_print_styles', 'siteorigin_widgets_tinymce_admin_print_styles' );
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Get list of supported measurements
|
232 |
-
*
|
233 |
-
* @return array
|
234 |
-
*/
|
235 |
-
function siteorigin_widgets_get_measurements_list() {
|
236 |
-
$measurements = array(
|
237 |
-
'px', '%', 'in', 'cm', 'mm', 'em', 'rem', 'pt', 'pc', 'ex', 'ch', 'vw', 'vh', 'vmin', 'vmax',
|
238 |
-
);
|
239 |
-
|
240 |
-
// Allow themes and plugins to trim or enhance the list.
|
241 |
-
return apply_filters('siteorigin_widgets_get_measurements_list', $measurements);
|
242 |
-
}
|
243 |
-
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Returns the base URL of our widget with `$path` appended.
|
247 |
-
*
|
248 |
-
* @param string $path Extra path to append to the end of the URL.
|
249 |
-
*
|
250 |
-
* @return string Base URL of the widget, with $path appended.
|
251 |
-
*/
|
252 |
-
function siteorigin_widgets_url( $path = '' ) {
|
253 |
-
return plugins_url( 'so-widgets-bundle/' . $path );
|
254 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
include plugin_dir_path(__FILE__).'inc/fields/siteorigin-widget-field-class-loader.class.php';
|
4 |
+
include plugin_dir_path(__FILE__).'siteorigin-widget.class.php';
|
5 |
+
|
6 |
+
include plugin_dir_path(__FILE__).'inc/widget-manager.class.php';
|
7 |
+
include plugin_dir_path(__FILE__).'inc/meta-box-manager.php';
|
8 |
+
include plugin_dir_path(__FILE__).'inc/post-selector.php';
|
9 |
+
include plugin_dir_path(__FILE__).'inc/string-utils.php';
|
10 |
+
include plugin_dir_path(__FILE__).'inc/array-utils.php';
|
11 |
+
include plugin_dir_path(__FILE__).'inc/attachments.php';
|
12 |
+
include plugin_dir_path(__FILE__).'inc/actions.php';
|
13 |
+
include plugin_dir_path(__FILE__).'inc/shortcode.php';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param $css
|
17 |
+
*/
|
18 |
+
function siteorigin_widget_add_inline_css($css){
|
19 |
+
global $siteorigin_widgets_inline_styles;
|
20 |
+
if ( empty( $siteorigin_widgets_inline_styles ) ) {
|
21 |
+
$siteorigin_widgets_inline_styles = array();
|
22 |
+
}
|
23 |
+
|
24 |
+
$siteorigin_widgets_inline_styles[] = $css;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Print any inline styles that have been added with siteorigin_widget_add_inline_css
|
29 |
+
*/
|
30 |
+
function siteorigin_widget_print_styles(){
|
31 |
+
global $siteorigin_widgets_inline_styles;
|
32 |
+
if ( ! empty( $siteorigin_widgets_inline_styles ) ) {
|
33 |
+
foreach ($siteorigin_widgets_inline_styles as $widget_css) {
|
34 |
+
?>
|
35 |
+
<style type="text/css"><?php echo($widget_css) ?></style><?php
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
$siteorigin_widgets_inline_styles = array();
|
40 |
+
}
|
41 |
+
add_action('wp_head', 'siteorigin_widget_print_styles');
|
42 |
+
add_action('wp_footer', 'siteorigin_widget_print_styles');
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The ajax handler for getting a list of available icons.
|
46 |
+
*/
|
47 |
+
function siteorigin_widget_get_icon_list(){
|
48 |
+
if(empty($_GET['family'])) exit();
|
49 |
+
if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
|
50 |
+
|
51 |
+
$widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array() );
|
52 |
+
|
53 |
+
header('content-type: application/json');
|
54 |
+
echo json_encode( !empty($widget_icon_families[$_GET['family']]) ? $widget_icon_families[$_GET['family']] : array() );
|
55 |
+
exit();
|
56 |
+
}
|
57 |
+
add_action('wp_ajax_siteorigin_widgets_get_icons', 'siteorigin_widget_get_icon_list');
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param $icon_value
|
61 |
+
* @param bool $icon_styles
|
62 |
+
*
|
63 |
+
* @return bool|string
|
64 |
+
*/
|
65 |
+
function siteorigin_widget_get_icon($icon_value, $icon_styles = false) {
|
66 |
+
if( empty( $icon_value ) ) return false;
|
67 |
+
list( $family, $icon ) = explode('-', $icon_value, 2);
|
68 |
+
if( empty( $family ) || empty( $icon ) ) return false;
|
69 |
+
|
70 |
+
static $widget_icon_families;
|
71 |
+
static $widget_icons_enqueued = array();
|
72 |
+
|
73 |
+
if( empty($widget_icon_families) ) $widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array() );
|
74 |
+
if( empty($widget_icon_families[$family]) || empty($widget_icon_families[$family]['icons'][$icon]) ) return false;
|
75 |
+
|
76 |
+
if(empty($widget_icons_enqueued[$family]) && !empty($widget_icon_families[$family]['style_uri'])) {
|
77 |
+
if( !wp_style_is( 'siteorigin-widget-icon-font-'.$family ) ) {
|
78 |
+
wp_enqueue_style('siteorigin-widget-icon-font-'.$family, $widget_icon_families[$family]['style_uri'] );
|
79 |
+
}
|
80 |
+
return '<span class="sow-icon-' . esc_attr($family) . '" data-sow-icon="' . $widget_icon_families[$family]['icons'][$icon] . '" ' . ( !empty($icon_styles) ? 'style="'.implode('; ', $icon_styles).'"' : '' ) . '></span>';
|
81 |
+
}
|
82 |
+
else {
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param $font_value
|
90 |
+
*
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
function siteorigin_widget_get_font($font_value) {
|
94 |
+
|
95 |
+
$web_safe = array(
|
96 |
+
'Helvetica Neue' => 'Arial, Helvetica, Geneva, sans-serif',
|
97 |
+
'Lucida Grande' => 'Lucida, Verdana, sans-serif',
|
98 |
+
'Georgia' => '"Times New Roman", Times, serif',
|
99 |
+
'Courier New' => 'Courier, mono',
|
100 |
+
'default' => 'default',
|
101 |
+
);
|
102 |
+
|
103 |
+
$font = array();
|
104 |
+
if ( isset( $web_safe[ $font_value ] ) ) {
|
105 |
+
$font['family'] = $web_safe[ $font_value ];
|
106 |
+
}
|
107 |
+
else if( siteorigin_widgets_is_google_webfont( $font_value ) ) {
|
108 |
+
$font_parts = explode( ':', $font_value );
|
109 |
+
$font['family'] = $font_parts[0];
|
110 |
+
$font_url_param = urlencode( $font_parts[0] );
|
111 |
+
if ( count( $font_parts ) > 1 ) {
|
112 |
+
$font['weight'] = $font_parts[1];
|
113 |
+
$font_url_param .= ':' . $font_parts[1];
|
114 |
+
}
|
115 |
+
$font['css_import'] = '@import url(https://fonts.googleapis.com/css?family=' . $font_url_param . ');';
|
116 |
+
}
|
117 |
+
else {
|
118 |
+
$font['family'] = $font_value;
|
119 |
+
$font = apply_filters( 'siteorigin_widget_get_custom_font_family', $font );
|
120 |
+
}
|
121 |
+
|
122 |
+
return $font;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Compatibility with Page Builder, add the groups and icons.
|
127 |
+
*
|
128 |
+
* @param $widgets
|
129 |
+
*
|
130 |
+
* @return mixed
|
131 |
+
*/
|
132 |
+
function siteorigin_widget_add_bundle_groups($widgets){
|
133 |
+
foreach( $widgets as $class => &$widget ) {
|
134 |
+
if( preg_match('/SiteOrigin_Widgets?_(.*)_Widget/i', $class, $matches) ) {
|
135 |
+
$widget['icon'] = 'so-widget-icon so-widget-icon-'.strtolower($matches[1]);
|
136 |
+
$widget['groups'] = array('so-widgets-bundle');
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
return $widgets;
|
141 |
+
}
|
142 |
+
add_filter('siteorigin_panels_widgets', 'siteorigin_widget_add_bundle_groups', 11);
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Escape a URL
|
146 |
+
*
|
147 |
+
* @param $url
|
148 |
+
*
|
149 |
+
* @return string
|
150 |
+
*/
|
151 |
+
function sow_esc_url( $url ) {
|
152 |
+
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
153 |
+
// Convert the special post URL into a permalink
|
154 |
+
$url = get_the_permalink( intval($matches[1]) );
|
155 |
+
if( empty($url) ) return '';
|
156 |
+
}
|
157 |
+
|
158 |
+
$protocols = wp_allowed_protocols();
|
159 |
+
$protocols[] = 'skype';
|
160 |
+
return esc_url( $url, $protocols );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* A special URL escaping function that handles additional protocols
|
165 |
+
*
|
166 |
+
* @param $url
|
167 |
+
*
|
168 |
+
* @return string
|
169 |
+
*/
|
170 |
+
function sow_esc_url_raw( $url ) {
|
171 |
+
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
172 |
+
// Convert the special post URL into a permalink
|
173 |
+
$url = get_the_permalink( intval($matches[1]) );
|
174 |
+
}
|
175 |
+
|
176 |
+
$protocols = wp_allowed_protocols();
|
177 |
+
$protocols[] = 'skype';
|
178 |
+
return esc_url_raw( $url, $protocols );
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Get all the Google Web Fonts.
|
183 |
+
*
|
184 |
+
* @return mixed|void
|
185 |
+
*/
|
186 |
+
function siteorigin_widgets_fonts_google_webfonts( ) {
|
187 |
+
$fonts = include plugin_dir_path( __FILE__ ) . 'inc/fonts.php';
|
188 |
+
$fonts = apply_filters( 'siteorigin_widgets_google_webfonts', $fonts );
|
189 |
+
return !empty( $fonts ) ? $fonts : array();
|
190 |
+
}
|
191 |
+
|
192 |
+
function siteorigin_widgets_is_google_webfont( $font_value ) {
|
193 |
+
$google_webfonts = siteorigin_widgets_fonts_google_webfonts();
|
194 |
+
|
195 |
+
$font_family = explode( ':', $font_value );
|
196 |
+
$font_family = $font_family[0];
|
197 |
+
|
198 |
+
return isset( $google_webfonts[$font_family] );
|
199 |
+
}
|
200 |
+
|
201 |
+
function siteorigin_widgets_font_families( ){
|
202 |
+
// Add the default fonts
|
203 |
+
$font_families = array(
|
204 |
+
'Helvetica Neue' => 'Helvetica Neue',
|
205 |
+
'Lucida Grande' => 'Lucida Grande',
|
206 |
+
'Georgia' => 'Georgia',
|
207 |
+
'Courier New' => 'Courier New',
|
208 |
+
);
|
209 |
+
|
210 |
+
// Add in all the Google font families
|
211 |
+
foreach ( siteorigin_widgets_fonts_google_webfonts() as $font => $variants ) {
|
212 |
+
foreach ( $variants as $variant ) {
|
213 |
+
if ( $variant == 'regular' || $variant == 400 ) {
|
214 |
+
$font_families[ $font ] = $font;
|
215 |
+
}
|
216 |
+
else {
|
217 |
+
$font_families[ $font . ':' . $variant ] = $font . ' (' . $variant . ')';
|
218 |
+
}
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
return apply_filters('siteorigin_widgets_font_families', $font_families);
|
223 |
+
}
|
224 |
+
|
225 |
+
function siteorigin_widgets_tinymce_admin_print_styles() {
|
226 |
+
wp_enqueue_style( 'editor-buttons' );
|
227 |
+
}
|
228 |
+
add_action( 'admin_print_styles', 'siteorigin_widgets_tinymce_admin_print_styles' );
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Get list of supported measurements
|
232 |
+
*
|
233 |
+
* @return array
|
234 |
+
*/
|
235 |
+
function siteorigin_widgets_get_measurements_list() {
|
236 |
+
$measurements = array(
|
237 |
+
'px', '%', 'in', 'cm', 'mm', 'em', 'rem', 'pt', 'pc', 'ex', 'ch', 'vw', 'vh', 'vmin', 'vmax',
|
238 |
+
);
|
239 |
+
|
240 |
+
// Allow themes and plugins to trim or enhance the list.
|
241 |
+
return apply_filters('siteorigin_widgets_get_measurements_list', $measurements);
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Returns the base URL of our widget with `$path` appended.
|
247 |
+
*
|
248 |
+
* @param string $path Extra path to append to the end of the URL.
|
249 |
+
*
|
250 |
+
* @return string Base URL of the widget, with $path appended.
|
251 |
+
*/
|
252 |
+
function siteorigin_widgets_url( $path = '' ) {
|
253 |
+
return plugins_url( 'so-widgets-bundle/' . $path );
|
254 |
+
}
|
base/inc/fields/checkbox.class.php
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class SiteOrigin_Widget_Field_Checkbox
|
5 |
-
*/
|
6 |
-
class SiteOrigin_Widget_Field_Checkbox extends SiteOrigin_Widget_Field_Base {
|
7 |
-
|
8 |
-
protected function render_field( $value, $instance ) {
|
9 |
-
?>
|
10 |
-
<label for="<?php echo esc_attr( $this->element_id ) ?>" class="so-checkbox-label">
|
11 |
-
<input type="checkbox" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
12 |
-
class="siteorigin-widget-input" <?php checked( !empty( $value ) ) ?> />
|
13 |
-
<?php echo esc_html( $this->label ) ?>
|
14 |
-
</label>
|
15 |
-
<?php
|
16 |
-
}
|
17 |
-
|
18 |
-
protected function render_field_label( $value, $instance ) {
|
19 |
-
// Empty override. This field renders it's own label in the render_field() function.
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function sanitize_field_input( $value, $instance ) {
|
23 |
-
return ! empty( $value ) && ! ( is_string( $value ) && $value === 'false' );
|
24 |
-
}
|
25 |
-
|
26 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class SiteOrigin_Widget_Field_Checkbox
|
5 |
+
*/
|
6 |
+
class SiteOrigin_Widget_Field_Checkbox extends SiteOrigin_Widget_Field_Base {
|
7 |
+
|
8 |
+
protected function render_field( $value, $instance ) {
|
9 |
+
?>
|
10 |
+
<label for="<?php echo esc_attr( $this->element_id ) ?>" class="so-checkbox-label">
|
11 |
+
<input type="checkbox" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
12 |
+
class="siteorigin-widget-input" <?php checked( !empty( $value ) ) ?> />
|
13 |
+
<?php echo esc_html( $this->label ) ?>
|
14 |
+
</label>
|
15 |
+
<?php
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function render_field_label( $value, $instance ) {
|
19 |
+
// Empty override. This field renders it's own label in the render_field() function.
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function sanitize_field_input( $value, $instance ) {
|
23 |
+
return ! empty( $value ) && ! ( is_string( $value ) && $value === 'false' );
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
base/inc/fields/js/tinymce-field.js
CHANGED
@@ -1,112 +1,112 @@
|
|
1 |
-
/* global tinymce, switchEditors */
|
2 |
-
|
3 |
-
(function ( $ ) {
|
4 |
-
var setup = function( $field ) {
|
5 |
-
|
6 |
-
if ( $field.data( 'initialized' ) ) {
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
var $container = $field.find( '.siteorigin-widget-tinymce-container' );
|
11 |
-
var settings = $container.data( 'editorSettings' );
|
12 |
-
var $textarea = $container.find( 'textarea' );
|
13 |
-
var id = $textarea.attr( 'id' );
|
14 |
-
var setupEditor = function ( editor ) {
|
15 |
-
editor.on( 'change',
|
16 |
-
function () {
|
17 |
-
window.tinymce.get( id ).save();
|
18 |
-
$textarea.trigger( 'change' );
|
19 |
-
}
|
20 |
-
);
|
21 |
-
};
|
22 |
-
|
23 |
-
settings.tinymce = $.extend( {}, settings.tinymce, { selector: '#' + id, setup: setupEditor } );
|
24 |
-
$( document ).one( 'wp-before-tinymce-init', function ( event, init ) {
|
25 |
-
if ( init.selector === settings.tinymce.selector ) {
|
26 |
-
var mediaButtons = $container.data( 'mediaButtons' );
|
27 |
-
$field.find( '.wp-editor-tabs' ).before( mediaButtons.html );
|
28 |
-
}
|
29 |
-
} );
|
30 |
-
$( document ).one( 'tinymce-editor-setup', function () {
|
31 |
-
if ( ! $field.find( '.wp-editor-wrap' ).hasClass( settings.selectedEditor + '-active' ) ) {
|
32 |
-
setTimeout( function () {
|
33 |
-
window.switchEditors.go( id );
|
34 |
-
}, 10 );
|
35 |
-
}
|
36 |
-
} );
|
37 |
-
|
38 |
-
wp.editor.remove( id );
|
39 |
-
|
40 |
-
// Wait for textarea to be visible before initialization.
|
41 |
-
if ( $textarea.is( ':visible' ) ) {
|
42 |
-
wp.editor.initialize( id, settings );
|
43 |
-
}
|
44 |
-
else {
|
45 |
-
var intervalId = setInterval( function () {
|
46 |
-
if ( $textarea.is( ':visible' ) ) {
|
47 |
-
wp.editor.initialize( id, settings );
|
48 |
-
clearInterval( intervalId );
|
49 |
-
}
|
50 |
-
}, 500);
|
51 |
-
}
|
52 |
-
|
53 |
-
$field.on( 'click', function ( event ) {
|
54 |
-
var $target = $( event.target );
|
55 |
-
var mode = $target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
|
56 |
-
if ( mode === 'tmce' ) {
|
57 |
-
var editor = window.tinymce.get( id );
|
58 |
-
// Quick bit of sanitization to prevent catastrophic backtracking in TinyMCE HTML parser regex
|
59 |
-
if ( $target.hasClass( 'wp-switch-editor' ) && editor !== null ) {
|
60 |
-
var content = $textarea.val();
|
61 |
-
if ( content.search( '<' ) !== -1 && content.search( '>' ) === -1) {
|
62 |
-
content = content.replace( /</g, '' );
|
63 |
-
$textarea.val( content );
|
64 |
-
}
|
65 |
-
editor.setContent(window.switchEditors.wpautop(content));
|
66 |
-
}
|
67 |
-
}
|
68 |
-
$field.find( '.siteorigin-widget-tinymce-selected-editor' ).val( mode );
|
69 |
-
} );
|
70 |
-
|
71 |
-
$field.data( 'initialized', true );
|
72 |
-
};
|
73 |
-
|
74 |
-
$( document ).on( 'sowsetupformfield', '.siteorigin-widget-field-type-tinymce', function () {
|
75 |
-
var $field = $( this );
|
76 |
-
var $parentRepeaterItem = $field.closest( '.siteorigin-widget-field-repeater-item-form' );
|
77 |
-
|
78 |
-
if ( $parentRepeaterItem.length > 0 ) {
|
79 |
-
if ( $parentRepeaterItem.is( ':visible' ) ) {
|
80 |
-
setup( $field );
|
81 |
-
}
|
82 |
-
else {
|
83 |
-
$parentRepeaterItem.on('slideToggleOpenComplete', function onSlideToggleComplete() {
|
84 |
-
if ( $parentRepeaterItem.is( ':visible' ) ) {
|
85 |
-
setup( $field );
|
86 |
-
$parentRepeaterItem.off( 'slideToggleOpenComplete' );
|
87 |
-
}
|
88 |
-
});
|
89 |
-
}
|
90 |
-
}
|
91 |
-
else {
|
92 |
-
setup( $field );
|
93 |
-
}
|
94 |
-
});
|
95 |
-
|
96 |
-
$( document ).on( 'sortstop', function ( event, ui ) {
|
97 |
-
var $form;
|
98 |
-
if ( ui.item.is( '.siteorigin-widget-field-repeater-item' ) ) {
|
99 |
-
$form = ui.item.find( '> .siteorigin-widget-field-repeater-item-form' );
|
100 |
-
}
|
101 |
-
else {
|
102 |
-
$form = ui.item.find('.siteorigin-widget-form');
|
103 |
-
}
|
104 |
-
|
105 |
-
$form.find( '.siteorigin-widget-field-type-tinymce' ).each( function () {
|
106 |
-
$( this ).data( 'initialized', null );
|
107 |
-
setup( $( this ) );
|
108 |
-
} );
|
109 |
-
|
110 |
-
});
|
111 |
-
|
112 |
-
})( jQuery );
|
1 |
+
/* global tinymce, switchEditors */
|
2 |
+
|
3 |
+
(function ( $ ) {
|
4 |
+
var setup = function( $field ) {
|
5 |
+
|
6 |
+
if ( $field.data( 'initialized' ) ) {
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
+
var $container = $field.find( '.siteorigin-widget-tinymce-container' );
|
11 |
+
var settings = $container.data( 'editorSettings' );
|
12 |
+
var $textarea = $container.find( 'textarea' );
|
13 |
+
var id = $textarea.attr( 'id' );
|
14 |
+
var setupEditor = function ( editor ) {
|
15 |
+
editor.on( 'change',
|
16 |
+
function () {
|
17 |
+
window.tinymce.get( id ).save();
|
18 |
+
$textarea.trigger( 'change' );
|
19 |
+
}
|
20 |
+
);
|
21 |
+
};
|
22 |
+
|
23 |
+
settings.tinymce = $.extend( {}, settings.tinymce, { selector: '#' + id, setup: setupEditor } );
|
24 |
+
$( document ).one( 'wp-before-tinymce-init', function ( event, init ) {
|
25 |
+
if ( init.selector === settings.tinymce.selector ) {
|
26 |
+
var mediaButtons = $container.data( 'mediaButtons' );
|
27 |
+
$field.find( '.wp-editor-tabs' ).before( mediaButtons.html );
|
28 |
+
}
|
29 |
+
} );
|
30 |
+
$( document ).one( 'tinymce-editor-setup', function () {
|
31 |
+
if ( ! $field.find( '.wp-editor-wrap' ).hasClass( settings.selectedEditor + '-active' ) ) {
|
32 |
+
setTimeout( function () {
|
33 |
+
window.switchEditors.go( id );
|
34 |
+
}, 10 );
|
35 |
+
}
|
36 |
+
} );
|
37 |
+
|
38 |
+
wp.editor.remove( id );
|
39 |
+
|
40 |
+
// Wait for textarea to be visible before initialization.
|
41 |
+
if ( $textarea.is( ':visible' ) ) {
|
42 |
+
wp.editor.initialize( id, settings );
|
43 |
+
}
|
44 |
+
else {
|
45 |
+
var intervalId = setInterval( function () {
|
46 |
+
if ( $textarea.is( ':visible' ) ) {
|
47 |
+
wp.editor.initialize( id, settings );
|
48 |
+
clearInterval( intervalId );
|
49 |
+
}
|
50 |
+
}, 500);
|
51 |
+
}
|
52 |
+
|
53 |
+
$field.on( 'click', function ( event ) {
|
54 |
+
var $target = $( event.target );
|
55 |
+
var mode = $target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
|
56 |
+
if ( mode === 'tmce' ) {
|
57 |
+
var editor = window.tinymce.get( id );
|
58 |
+
// Quick bit of sanitization to prevent catastrophic backtracking in TinyMCE HTML parser regex
|
59 |
+
if ( $target.hasClass( 'wp-switch-editor' ) && editor !== null ) {
|
60 |
+
var content = $textarea.val();
|
61 |
+
if ( content.search( '<' ) !== -1 && content.search( '>' ) === -1) {
|
62 |
+
content = content.replace( /</g, '' );
|
63 |
+
$textarea.val( content );
|
64 |
+
}
|
65 |
+
editor.setContent(window.switchEditors.wpautop(content));
|
66 |
+
}
|
67 |
+
}
|
68 |
+
$field.find( '.siteorigin-widget-tinymce-selected-editor' ).val( mode );
|
69 |
+
} );
|
70 |
+
|
71 |
+
$field.data( 'initialized', true );
|
72 |
+
};
|
73 |
+
|
74 |
+
$( document ).on( 'sowsetupformfield', '.siteorigin-widget-field-type-tinymce', function () {
|
75 |
+
var $field = $( this );
|
76 |
+
var $parentRepeaterItem = $field.closest( '.siteorigin-widget-field-repeater-item-form' );
|
77 |
+
|
78 |
+
if ( $parentRepeaterItem.length > 0 ) {
|
79 |
+
if ( $parentRepeaterItem.is( ':visible' ) ) {
|
80 |
+
setup( $field );
|
81 |
+
}
|
82 |
+
else {
|
83 |
+
$parentRepeaterItem.on('slideToggleOpenComplete', function onSlideToggleComplete() {
|
84 |
+
if ( $parentRepeaterItem.is( ':visible' ) ) {
|
85 |
+
setup( $field );
|
86 |
+
$parentRepeaterItem.off( 'slideToggleOpenComplete' );
|
87 |
+
}
|
88 |
+
});
|
89 |
+
}
|
90 |
+
}
|
91 |
+
else {
|
92 |
+
setup( $field );
|
93 |
+
}
|
94 |
+
});
|
95 |
+
|
96 |
+
$( document ).on( 'sortstop', function ( event, ui ) {
|
97 |
+
var $form;
|
98 |
+
if ( ui.item.is( '.siteorigin-widget-field-repeater-item' ) ) {
|
99 |
+
$form = ui.item.find( '> .siteorigin-widget-field-repeater-item-form' );
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$form = ui.item.find('.siteorigin-widget-form');
|
103 |
+
}
|
104 |
+
|
105 |
+
$form.find( '.siteorigin-widget-field-type-tinymce' ).each( function () {
|
106 |
+
$( this ).data( 'initialized', null );
|
107 |
+
setup( $( this ) );
|
108 |
+
} );
|
109 |
+
|
110 |
+
});
|
111 |
+
|
112 |
+
})( jQuery );
|
base/inc/fields/slider.class.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class SiteOrigin_Widget_Field_Slider
|
5 |
-
*/
|
6 |
-
class SiteOrigin_Widget_Field_Slider extends SiteOrigin_Widget_Field_Base {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* The minimum value of the allowed range.
|
10 |
-
*
|
11 |
-
* @access protected
|
12 |
-
* @var float
|
13 |
-
*/
|
14 |
-
protected $min;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* The maximum value of the allowed range.
|
18 |
-
*
|
19 |
-
* @access protected
|
20 |
-
* @var float
|
21 |
-
*/
|
22 |
-
protected $max;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* The step size when moving in the range.
|
26 |
-
*
|
27 |
-
* @access protected
|
28 |
-
* @var float
|
29 |
-
*/
|
30 |
-
protected $step;
|
31 |
-
|
32 |
-
protected function render_field( $value, $instance ) {
|
33 |
-
?>
|
34 |
-
<div class="siteorigin-widget-slider-value"><?php echo ! empty( $value ) ? esc_html( $value ) : 0 ?></div>
|
35 |
-
<div class="siteorigin-widget-slider-wrapper">
|
36 |
-
<div class="siteorigin-widget-value-slider"></div>
|
37 |
-
</div>
|
38 |
-
<input type="number" class="siteorigin-widget-input" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
39 |
-
value="<?php echo !empty( $value ) ? esc_attr( $value ) : 0 ?>"
|
40 |
-
min="<?php echo isset( $this->min ) ? floatval( $this->min ) : 0 ?>"
|
41 |
-
max="<?php echo isset( $this->max ) ? floatval( $this->max ) : 100 ?>"
|
42 |
-
step="<?php echo isset( $this->step ) ? floatval( $this->step ) : 1 ?>"/>
|
43 |
-
<?php
|
44 |
-
}
|
45 |
-
|
46 |
-
protected function sanitize_field_input( $value, $instance ) {
|
47 |
-
return (float) $value;
|
48 |
-
}
|
49 |
-
|
50 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class SiteOrigin_Widget_Field_Slider
|
5 |
+
*/
|
6 |
+
class SiteOrigin_Widget_Field_Slider extends SiteOrigin_Widget_Field_Base {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* The minimum value of the allowed range.
|
10 |
+
*
|
11 |
+
* @access protected
|
12 |
+
* @var float
|
13 |
+
*/
|
14 |
+
protected $min;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The maximum value of the allowed range.
|
18 |
+
*
|
19 |
+
* @access protected
|
20 |
+
* @var float
|
21 |
+
*/
|
22 |
+
protected $max;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The step size when moving in the range.
|
26 |
+
*
|
27 |
+
* @access protected
|
28 |
+
* @var float
|
29 |
+
*/
|
30 |
+
protected $step;
|
31 |
+
|
32 |
+
protected function render_field( $value, $instance ) {
|
33 |
+
?>
|
34 |
+
<div class="siteorigin-widget-slider-value"><?php echo ! empty( $value ) ? esc_html( $value ) : 0 ?></div>
|
35 |
+
<div class="siteorigin-widget-slider-wrapper">
|
36 |
+
<div class="siteorigin-widget-value-slider"></div>
|
37 |
+
</div>
|
38 |
+
<input type="number" class="siteorigin-widget-input" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
39 |
+
value="<?php echo !empty( $value ) ? esc_attr( $value ) : 0 ?>"
|
40 |
+
min="<?php echo isset( $this->min ) ? floatval( $this->min ) : 0 ?>"
|
41 |
+
max="<?php echo isset( $this->max ) ? floatval( $this->max ) : 100 ?>"
|
42 |
+
step="<?php echo isset( $this->step ) ? floatval( $this->step ) : 1 ?>"/>
|
43 |
+
<?php
|
44 |
+
}
|
45 |
+
|
46 |
+
protected function sanitize_field_input( $value, $instance ) {
|
47 |
+
return (float) $value;
|
48 |
+
}
|
49 |
+
|
50 |
}
|
base/inc/fields/tinymce.class.php
CHANGED
@@ -1,525 +1,525 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input_Base {
|
4 |
-
/**
|
5 |
-
* The number of visible rows in the textarea.
|
6 |
-
*
|
7 |
-
* @access protected
|
8 |
-
* @var int
|
9 |
-
*/
|
10 |
-
protected $rows = 10;
|
11 |
-
/**
|
12 |
-
* The editor initial height. Overrides rows if it is set.
|
13 |
-
*
|
14 |
-
* @access protected
|
15 |
-
* @var int
|
16 |
-
*/
|
17 |
-
protected $editor_height;
|
18 |
-
/**
|
19 |
-
* The editor to be displayed initially.
|
20 |
-
*
|
21 |
-
* @access protected
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
protected $default_editor = 'tinymce';
|
25 |
-
/**
|
26 |
-
* The last editor selected by the user.
|
27 |
-
*
|
28 |
-
* @access protected
|
29 |
-
* @var string
|
30 |
-
*/
|
31 |
-
protected $selected_editor;
|
32 |
-
/**
|
33 |
-
* An array of the buttons which will be rendered for the first toolbar of the TinyMCE editor.
|
34 |
-
*
|
35 |
-
* @access protected
|
36 |
-
* @var array
|
37 |
-
*/
|
38 |
-
protected $mce_buttons;
|
39 |
-
/**
|
40 |
-
* An array of the buttons which will be rendered for the second toolbar of the TinyMCE editor.
|
41 |
-
*
|
42 |
-
* @access protected
|
43 |
-
* @var array
|
44 |
-
*/
|
45 |
-
protected $mce_buttons_2;
|
46 |
-
/**
|
47 |
-
* An array of the buttons which will be rendered for the third toolbar of the TinyMCE editor.
|
48 |
-
*
|
49 |
-
* @access protected
|
50 |
-
* @var array
|
51 |
-
*/
|
52 |
-
protected $mce_buttons_3;
|
53 |
-
/**
|
54 |
-
* An array of the buttons which will be rendered for the fourth toolbar of the TinyMCE editor.
|
55 |
-
*
|
56 |
-
* @access protected
|
57 |
-
* @var array
|
58 |
-
*/
|
59 |
-
protected $mce_buttons_4;
|
60 |
-
/**
|
61 |
-
* An array of the buttons which will be rendered for the QuickTags editor.
|
62 |
-
*
|
63 |
-
* @access protected
|
64 |
-
* @var array
|
65 |
-
*/
|
66 |
-
protected $quicktags_buttons;
|
67 |
-
/**
|
68 |
-
* An array of filter callbacks to apply to the set of buttons which will be rendered for the editor.
|
69 |
-
*
|
70 |
-
* @access protected
|
71 |
-
* @var array
|
72 |
-
*/
|
73 |
-
protected $button_filters;
|
74 |
-
/**
|
75 |
-
* An array of the included plugins to enable for the TinyMCE editor.
|
76 |
-
*
|
77 |
-
* @access protected
|
78 |
-
* @var array
|
79 |
-
*/
|
80 |
-
protected $mce_plugins;
|
81 |
-
/**
|
82 |
-
* An array of external plugins for the TinyMCE editor.
|
83 |
-
*
|
84 |
-
* @access protected
|
85 |
-
* @var array
|
86 |
-
*/
|
87 |
-
protected $mce_external_plugins;
|
88 |
-
/**
|
89 |
-
* Updated Editor JS API was introduced in WP 4.8 so need to check for compatibility with older versions.
|
90 |
-
*
|
91 |
-
* @access private
|
92 |
-
* @var bool
|
93 |
-
*/
|
94 |
-
private $wp_version_lt_4_8;
|
95 |
-
|
96 |
-
protected function get_default_options() {
|
97 |
-
return array(
|
98 |
-
'mce_buttons' => array(
|
99 |
-
'formatselect',
|
100 |
-
'bold',
|
101 |
-
'italic',
|
102 |
-
'bullist',
|
103 |
-
'numlist',
|
104 |
-
'blockquote',
|
105 |
-
'alignleft',
|
106 |
-
'aligncenter',
|
107 |
-
'alignright',
|
108 |
-
'link',
|
109 |
-
'unlink',
|
110 |
-
'wp_more',
|
111 |
-
'wp_adv',
|
112 |
-
),
|
113 |
-
'mce_buttons_2' => array(
|
114 |
-
'strikethrough',
|
115 |
-
'hr',
|
116 |
-
'forecolor',
|
117 |
-
'pastetext',
|
118 |
-
'removeformat',
|
119 |
-
'charmap',
|
120 |
-
'outdent',
|
121 |
-
'indent',
|
122 |
-
'undo',
|
123 |
-
'redo',
|
124 |
-
'wp_help',
|
125 |
-
),
|
126 |
-
'quicktags_buttons' => array(
|
127 |
-
'strong',
|
128 |
-
'em',
|
129 |
-
'link',
|
130 |
-
'block',
|
131 |
-
'del',
|
132 |
-
'ins',
|
133 |
-
'img',
|
134 |
-
'ul',
|
135 |
-
'ol',
|
136 |
-
'li',
|
137 |
-
'code',
|
138 |
-
'more',
|
139 |
-
'close',
|
140 |
-
),
|
141 |
-
'mce_plugins' => array(
|
142 |
-
'charmap',
|
143 |
-
'colorpicker',
|
144 |
-
'hr',
|
145 |
-
'lists',
|
146 |
-
'media',
|
147 |
-
'paste',
|
148 |
-
'tabfocus',
|
149 |
-
'textcolor',
|
150 |
-
'fullscreen',
|
151 |
-
'wordpress',
|
152 |
-
'wpautoresize',
|
153 |
-
'wpeditimage',
|
154 |
-
'wpemoji',
|
155 |
-
'wpgallery',
|
156 |
-
'wplink',
|
157 |
-
'wpdialogs',
|
158 |
-
'wptextpattern',
|
159 |
-
'wpview',
|
160 |
-
),
|
161 |
-
'mce_external_plugins' => array(),
|
162 |
-
);
|
163 |
-
}
|
164 |
-
|
165 |
-
protected function initialize() {
|
166 |
-
if ( ! is_admin() ) {
|
167 |
-
return;
|
168 |
-
}
|
169 |
-
|
170 |
-
global $wp_version;
|
171 |
-
$this->wp_version_lt_4_8 = version_compare( $wp_version, '4.8', '<' );
|
172 |
-
|
173 |
-
if ( ! empty( $this->wp_version_lt_4_8 ) ) {
|
174 |
-
add_filter( 'mce_buttons', array( $this, 'mce_buttons_filter' ), 10, 2 );
|
175 |
-
add_filter( 'quicktags_settings', array( $this, 'quicktags_settings' ), 10, 2 );
|
176 |
-
}
|
177 |
-
|
178 |
-
if ( ! empty( $this->button_filters ) ) {
|
179 |
-
foreach ( $this->button_filters as $filter_name => $filter ) {
|
180 |
-
$is_valid_filter = preg_match(
|
181 |
-
'/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name
|
182 |
-
) && ! empty( $filter ) && is_callable( $filter );
|
183 |
-
if ( $is_valid_filter ) {
|
184 |
-
add_filter( $filter_name, array( $this, $filter_name ), 10, 2 );
|
185 |
-
}
|
186 |
-
}
|
187 |
-
}
|
188 |
-
|
189 |
-
if( class_exists( 'WC_Shortcodes_TinyMCE_Buttons' ) ) {
|
190 |
-
if ( ! empty( $this->wp_version_lt_4_8 ) ) {
|
191 |
-
$screen = get_current_screen();
|
192 |
-
if( ! is_null( $screen ) && $screen->id != 'widgets' ) {
|
193 |
-
add_filter( 'mce_external_plugins', array( $this, 'add_wpc_shortcodes_plugin' ), 15 );
|
194 |
-
add_filter( 'mce_buttons', array( $this, 'register_wpc_shortcodes_button' ), 15 );
|
195 |
-
}
|
196 |
-
} else {
|
197 |
-
$this->mce_external_plugins = $this->add_wpc_shortcodes_plugin( $this->mce_external_plugins );
|
198 |
-
$this->mce_buttons = $this->register_wpc_shortcodes_button( $this->mce_buttons );
|
199 |
-
}
|
200 |
-
}
|
201 |
-
|
202 |
-
if( class_exists( 'WC_Shortcodes_Admin' ) ) {
|
203 |
-
if ( ! empty( $this->wp_version_lt_4_8 ) ) {
|
204 |
-
|
205 |
-
$screen = get_current_screen();
|
206 |
-
if( ! is_null( $screen ) && $screen->id != 'widgets' ) {
|
207 |
-
add_filter( 'mce_external_plugins', array( $this, 'add_wc_shortcodes_plugin' ), 15 );
|
208 |
-
add_filter( 'mce_buttons', array( $this, 'register_wc_shortcodes_button' ), 15 );
|
209 |
-
}
|
210 |
-
} else {
|
211 |
-
$this->mce_external_plugins = $this->add_wc_shortcodes_plugin( $this->mce_external_plugins );
|
212 |
-
$this->mce_buttons = $this->register_wc_shortcodes_button( $this->mce_buttons );
|
213 |
-
}
|
214 |
-
}
|
215 |
-
}
|
216 |
-
|
217 |
-
function add_wc_shortcodes_plugin( $plugins ) {
|
218 |
-
if( isset( $plugins['woocommerce_shortcodes'] ) ) {
|
219 |
-
return $plugins;
|
220 |
-
}
|
221 |
-
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
222 |
-
$editor_path = 'woocommerce-shortcodes/assets/js/editor' . $suffix . '.js';
|
223 |
-
if( file_exists( WP_PLUGIN_DIR . '/' . $editor_path ) ) {
|
224 |
-
$plugins['woocommerce_shortcodes'] = plugins_url( $editor_path );
|
225 |
-
}
|
226 |
-
return $plugins;
|
227 |
-
}
|
228 |
-
|
229 |
-
function register_wc_shortcodes_button( $buttons ) {
|
230 |
-
if( ! in_array( 'woocommerce_shortcodes', $buttons ) ) {
|
231 |
-
array_push( $buttons, '|', 'woocommerce_shortcodes' );
|
232 |
-
}
|
233 |
-
return $buttons;
|
234 |
-
}
|
235 |
-
|
236 |
-
function add_wpc_shortcodes_plugin( $plugins ) {
|
237 |
-
if( ! isset( $plugins['wpc_shortcodes'] ) ) {
|
238 |
-
$shortcodes_path = 'wc-shortcodes/includes/mce/js/shortcodes-tinymce-4.js';
|
239 |
-
if ( file_exists( WP_PLUGIN_DIR . '/' . $shortcodes_path ) ) {
|
240 |
-
$plugins['wpc_shortcodes'] = plugins_url( $shortcodes_path . '?ver=' . WC_SHORTCODES_VERSION );
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
-
if( ! isset( $plugins['wpc_font_awesome'] ) ) {
|
245 |
-
$fontawesome_path = 'wc-shortcodes/includes/mce/js/font-awesome-tinymce-4.js';
|
246 |
-
if ( file_exists( WP_PLUGIN_DIR . '/' . $fontawesome_path ) ) {
|
247 |
-
$plugins['wpc_font_awesome'] = plugins_url( $fontawesome_path . '?ver=' . WC_SHORTCODES_VERSION );
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
return $plugins;
|
252 |
-
}
|
253 |
-
|
254 |
-
function register_wpc_shortcodes_button( $buttons ) {
|
255 |
-
if( ! in_array( 'wpc_shortcodes_button', $buttons ) ) {
|
256 |
-
array_push( $buttons, 'wpc_shortcodes_button' );
|
257 |
-
}
|
258 |
-
if( ! in_array( 'wpcfontAwesomeGlyphSelect', $buttons ) ) {
|
259 |
-
array_push( $buttons, 'wpcfontAwesomeGlyphSelect' );
|
260 |
-
}
|
261 |
-
|
262 |
-
return $buttons;
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* @param $name
|
267 |
-
* @param $arguments
|
268 |
-
* @return array|mixed
|
269 |
-
*/
|
270 |
-
function __call( $name, $arguments ) {
|
271 |
-
if ( preg_match( '/mce_buttons(?:_[1-4])?|quicktags_settings/', $name ) && !empty( $this->button_filters[$name] ) ) {
|
272 |
-
$filter = $this->button_filters[$name];
|
273 |
-
if ( !empty( $filter[0] ) && is_a( $filter[0], 'SiteOrigin_Widget' ) ) {
|
274 |
-
$widget = $filter[0];
|
275 |
-
$settings = !empty($arguments[0]) ? $arguments[0] : array();
|
276 |
-
$editor_id = !empty($arguments[1]) ? $arguments[1] : '';
|
277 |
-
if ( preg_match( '/widget-' . $widget->id_base . '-.*-' . $this->base_name . '/', $editor_id ) ) {
|
278 |
-
return call_user_func( $filter, $settings, $editor_id );
|
279 |
-
}
|
280 |
-
else {
|
281 |
-
return $settings;
|
282 |
-
}
|
283 |
-
}
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
public function mce_buttons_filter( $buttons, $editor_id ) {
|
288 |
-
if (($key = array_search('fullscreen', $buttons)) !== false) {
|
289 |
-
unset($buttons[$key]);
|
290 |
-
}
|
291 |
-
return $buttons;
|
292 |
-
}
|
293 |
-
|
294 |
-
public function quicktags_settings( $settings, $editor_id ) {
|
295 |
-
$settings['buttons'] = preg_replace( '/,fullscreen/', '', $settings['buttons'] );
|
296 |
-
$settings['buttons'] = preg_replace( '/,dfw/', '', $settings['buttons'] );
|
297 |
-
return $settings;
|
298 |
-
}
|
299 |
-
|
300 |
-
protected function get_input_classes() {
|
301 |
-
$classes = parent::get_input_classes();
|
302 |
-
$classes[] = 'wp-editor-area';
|
303 |
-
return $classes;
|
304 |
-
}
|
305 |
-
|
306 |
-
protected function render_before_field( $value, $instance ) {
|
307 |
-
$selected_editor_name = $this->get_selected_editor_field_name( $this->base_name );
|
308 |
-
if( ! empty( $instance[ $selected_editor_name ] ) ) {
|
309 |
-
$this->selected_editor = $instance[ $selected_editor_name ];
|
310 |
-
}
|
311 |
-
else {
|
312 |
-
$this->selected_editor = $this->default_editor;
|
313 |
-
}
|
314 |
-
parent::render_before_field( $value, $instance );
|
315 |
-
}
|
316 |
-
|
317 |
-
protected function render_field( $value, $instance ) {
|
318 |
-
|
319 |
-
if ( $this->wp_version_lt_4_8 ) {
|
320 |
-
$this->render_field_pre48( $value, $instance );
|
321 |
-
return;
|
322 |
-
}
|
323 |
-
|
324 |
-
$selected_editor = in_array( $this->selected_editor, array( 'tinymce', 'tmce' ) ) ? 'tmce' : 'html';
|
325 |
-
|
326 |
-
$tmce_settings = array(
|
327 |
-
'toolbar1' => apply_filters( 'mce_buttons', $this->mce_buttons, $this->element_id ),
|
328 |
-
'toolbar2' => apply_filters( 'mce_buttons_2', $this->mce_buttons_2, $this->element_id ),
|
329 |
-
'toolbar3' => apply_filters( 'mce_buttons_3',$this->mce_buttons_3, $this->element_id ),
|
330 |
-
'toolbar4' => apply_filters( 'mce_buttons_4',$this->mce_buttons_4, $this->element_id ),
|
331 |
-
'plugins' => array_unique( apply_filters( 'tiny_mce_plugins', $this->mce_plugins ) ),
|
332 |
-
);
|
333 |
-
|
334 |
-
foreach ( $tmce_settings as $name => $setting ) {
|
335 |
-
$tmce_settings[ $name ] = is_array( $setting ) ? implode( ',', $setting ) : '';
|
336 |
-
}
|
337 |
-
|
338 |
-
$tmce_settings['external_plugins'] = array_unique( apply_filters( 'mce_external_plugins', $this->mce_external_plugins ) );
|
339 |
-
|
340 |
-
$suffix = SCRIPT_DEBUG ? '' : '.min';
|
341 |
-
$version = 'ver=' . get_bloginfo( 'version' );
|
342 |
-
// Default stylesheets
|
343 |
-
$mce_css = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
|
344 |
-
includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
|
345 |
-
|
346 |
-
$editor_styles = get_editor_stylesheets();
|
347 |
-
|
348 |
-
if ( ! empty( $editor_styles ) ) {
|
349 |
-
// Force urlencoding of commas.
|
350 |
-
foreach ( $editor_styles as $key => $url ) {
|
351 |
-
if ( strpos( $url, ',' ) !== false ) {
|
352 |
-
$editor_styles[ $key ] = str_replace( ',', '%2C', $url );
|
353 |
-
}
|
354 |
-
}
|
355 |
-
|
356 |
-
$mce_css .= ',' . implode( ',', $editor_styles );
|
357 |
-
}
|
358 |
-
$mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
|
359 |
-
$tmce_settings['content_css'] = $mce_css;
|
360 |
-
|
361 |
-
$qt_settings = apply_filters(
|
362 |
-
'quicktags_settings',
|
363 |
-
array( 'buttons' => $this->quicktags_buttons ),
|
364 |
-
$this->element_id
|
365 |
-
);
|
366 |
-
|
367 |
-
$qt_settings['buttons'] = ! empty( $qt_settings['buttons'] ) ? $qt_settings['buttons'] : array();
|
368 |
-
$qt_settings['buttons'] = is_array( $qt_settings['buttons'] ) ? implode( ',', $qt_settings['buttons'] ) : '';
|
369 |
-
|
370 |
-
$settings = array(
|
371 |
-
'selectedEditor' => $selected_editor,
|
372 |
-
'tinymce' => array(
|
373 |
-
'wp_skip_init' => strpos( $this->element_id, '__i__' ) != false ||
|
374 |
-
strpos( $this->element_id, '_id_' ) != false,
|
375 |
-
'wpautop' => true,
|
376 |
-
),
|
377 |
-
'quicktags' => array(
|
378 |
-
'buttons' => $qt_settings['buttons'],
|
379 |
-
),
|
380 |
-
);
|
381 |
-
|
382 |
-
$tmce_settings = apply_filters( 'tiny_mce_before_init', $tmce_settings, $this->element_id );
|
383 |
-
|
384 |
-
foreach ( $tmce_settings as $name => $setting ) {
|
385 |
-
unset( $jdec );
|
386 |
-
if ( ! empty( $tmce_settings[ $name ] ) ) {
|
387 |
-
// Attempt to decode setting as JSON. For back compat with filters used by WP editor.
|
388 |
-
if ( is_string( $setting ) ) {
|
389 |
-
$jdec = json_decode( $setting, true );
|
390 |
-
}
|
391 |
-
$settings['tinymce'][ $name ] = empty( $jdec ) ? $setting : $jdec;
|
392 |
-
}
|
393 |
-
}
|
394 |
-
|
395 |
-
$value = apply_filters( 'the_editor_content', $value, $this->selected_editor );
|
396 |
-
|
397 |
-
if ( false !== stripos( $value, 'textarea' ) ) {
|
398 |
-
$value = preg_replace( '%</textarea%i', '</textarea', $value );
|
399 |
-
}
|
400 |
-
|
401 |
-
|
402 |
-
$media_buttons = $this->render_media_buttons( $this->element_id );
|
403 |
-
|
404 |
-
?><div class="siteorigin-widget-tinymce-container"
|
405 |
-
data-editor-settings="<?php echo esc_attr( json_encode( $settings ) ) ?>"
|
406 |
-
data-media-buttons="<?php echo esc_attr( json_encode( array( 'html' => $media_buttons ) ) ) ?>">
|
407 |
-
<textarea id="<?php echo esc_attr( $this->element_id ) ?>"
|
408 |
-
name="<?php echo esc_attr( $this->element_name ) ?>"
|
409 |
-
<?php if ( isset( $this->editor_height ) ) : ?>
|
410 |
-
style="height: <?php echo intval( $this->editor_height ) ?>px"
|
411 |
-
<?php else : ?>
|
412 |
-
rows="<?php echo esc_attr( $this->rows ) ?>"
|
413 |
-
<?php endif; ?>
|
414 |
-
<?php $this->render_data_attributes( $this->get_input_data_attributes() ) ?>
|
415 |
-
<?php $this->render_CSS_classes( $this->get_input_classes() ) ?>
|
416 |
-
<?php if ( ! empty( $this->placeholder ) ) echo 'placeholder="' . esc_attr( $this->placeholder ) . '"' ?>
|
417 |
-
<?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>><?php echo htmlentities( $value, ENT_QUOTES, 'UTF-8' ) ?></textarea>
|
418 |
-
</div>
|
419 |
-
<input type="hidden"
|
420 |
-
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_selected_editor', $this->parent_container) ) ?>"
|
421 |
-
class="siteorigin-widget-input siteorigin-widget-tinymce-selected-editor"
|
422 |
-
value="<?php echo esc_attr( $this->selected_editor ) ?>"/>
|
423 |
-
<?php
|
424 |
-
|
425 |
-
}
|
426 |
-
|
427 |
-
private function render_field_pre48( $value, $instance ) {
|
428 |
-
|
429 |
-
$settings = array(
|
430 |
-
'textarea_name' => esc_attr( $this->element_name ),
|
431 |
-
'default_editor' => $this->selected_editor,
|
432 |
-
'textarea_rows' => $this->rows,
|
433 |
-
'editor_class' => 'siteorigin-widget-input',
|
434 |
-
'tinymce' => array(
|
435 |
-
'wp_skip_init' => strpos( $this->element_id, '__i__' ) != false || strpos( $this->element_id, '_id_' ) != false
|
436 |
-
)
|
437 |
-
);
|
438 |
-
if( isset( $this->editor_height ) ) $settings['editor_height'] = $this->editor_height;
|
439 |
-
preg_match( '/widget-(.+?)\[/', $this->element_name, $id_base_matches );
|
440 |
-
$widget_id_base = empty($id_base_matches) || count($id_base_matches) < 2 ? '' : $id_base_matches[1];
|
441 |
-
?>
|
442 |
-
<div class="siteorigin-widget-tinymce-container"
|
443 |
-
data-mce-settings="<?php echo esc_attr( json_encode( $settings['tinymce'] ) ) ?>"
|
444 |
-
data-qt-settings="<?php echo esc_attr( json_encode( array() ) ) ?>"
|
445 |
-
data-widget-id-base="<?php echo esc_attr( $widget_id_base ) ?>"
|
446 |
-
>
|
447 |
-
<?php
|
448 |
-
wp_editor( $value, esc_attr( $this->element_id ), $settings )
|
449 |
-
?>
|
450 |
-
</div>
|
451 |
-
<input type="hidden"
|
452 |
-
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_selected_editor', $this->parent_container) ) ?>"
|
453 |
-
class="siteorigin-widget-input siteorigin-widget-tinymce-selected-editor"
|
454 |
-
value="<?php echo esc_attr( $this->selected_editor ) ?>"/>
|
455 |
-
<?php
|
456 |
-
|
457 |
-
if( $this->selected_editor == 'html' ) {
|
458 |
-
remove_filter( 'the_editor_content', 'wp_htmledit_pre' );
|
459 |
-
}
|
460 |
-
if( $this->selected_editor == 'tinymce' ) {
|
461 |
-
remove_filter( 'the_editor_content', 'wp_richedit_pre' );
|
462 |
-
}
|
463 |
-
}
|
464 |
-
|
465 |
-
public function enqueue_scripts() {
|
466 |
-
|
467 |
-
if ( $this->wp_version_lt_4_8 ) {
|
468 |
-
$src = plugin_dir_url( __FILE__ ) . 'js/tinymce-field-pre48' . SOW_BUNDLE_JS_SUFFIX . '.js';
|
469 |
-
$deps = array( 'jquery', 'editor', 'quicktags' );
|
470 |
-
} else {
|
471 |
-
wp_enqueue_editor();
|
472 |
-
$src = plugin_dir_url( __FILE__ ) . 'js/tinymce-field' . SOW_BUNDLE_JS_SUFFIX . '.js';
|
473 |
-
$deps = array( 'jquery' );
|
474 |
-
}
|
475 |
-
|
476 |
-
wp_enqueue_script( 'so-tinymce-field', $src, $deps, SOW_BUNDLE_VERSION );
|
477 |
-
wp_enqueue_style(
|
478 |
-
'so-tinymce-field', plugin_dir_url( __FILE__ ) . 'css/tinymce-field.css', array(), SOW_BUNDLE_VERSION
|
479 |
-
);
|
480 |
-
}
|
481 |
-
|
482 |
-
protected function sanitize_field_input( $value, $instance ) {
|
483 |
-
if( current_user_can( 'unfiltered_html' ) ) {
|
484 |
-
$sanitized_value = $value;
|
485 |
-
} else {
|
486 |
-
$sanitized_value = wp_kses_post( $value );
|
487 |
-
}
|
488 |
-
$sanitized_value = balanceTags( $sanitized_value , true );
|
489 |
-
return $sanitized_value;
|
490 |
-
}
|
491 |
-
|
492 |
-
public function sanitize_instance( $instance ) {
|
493 |
-
$selected_editor_name = $this->get_selected_editor_field_name( $this->base_name );
|
494 |
-
if( ! empty( $instance[ $selected_editor_name ] ) ) {
|
495 |
-
$selected_editor = $instance[ $selected_editor_name ];
|
496 |
-
$instance[ $selected_editor_name ] = in_array( $selected_editor, array( 'tinymce', 'tmce', 'quicktags', 'html' ) ) ? $selected_editor : $this->default_editor;
|
497 |
-
}
|
498 |
-
return $instance;
|
499 |
-
}
|
500 |
-
|
501 |
-
public function get_selected_editor_field_name( $base_name ) {
|
502 |
-
$v_name = $base_name;
|
503 |
-
if( strpos($v_name, '][') !== false ) {
|
504 |
-
// Remove this splitter
|
505 |
-
$v_name = substr( $v_name, strrpos($v_name, '][') + 2 );
|
506 |
-
}
|
507 |
-
return $v_name . '_selected_editor';
|
508 |
-
}
|
509 |
-
|
510 |
-
private function render_media_buttons( $editor_id ) {
|
511 |
-
|
512 |
-
ob_start();
|
513 |
-
if ( ! function_exists( 'media_buttons' ) ) {
|
514 |
-
include( ABSPATH . 'wp-admin/includes/media.php' );
|
515 |
-
}
|
516 |
-
|
517 |
-
echo '<div id="wp-' . esc_attr( $editor_id ) . '-media-buttons" class="wp-media-buttons">';
|
518 |
-
|
519 |
-
do_action( 'media_buttons', $editor_id );
|
520 |
-
|
521 |
-
echo "</div>\n";
|
522 |
-
|
523 |
-
return ob_get_clean();
|
524 |
-
}
|
525 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input_Base {
|
4 |
+
/**
|
5 |
+
* The number of visible rows in the textarea.
|
6 |
+
*
|
7 |
+
* @access protected
|
8 |
+
* @var int
|
9 |
+
*/
|
10 |
+
protected $rows = 10;
|
11 |
+
/**
|
12 |
+
* The editor initial height. Overrides rows if it is set.
|
13 |
+
*
|
14 |
+
* @access protected
|
15 |
+
* @var int
|
16 |
+
*/
|
17 |
+
protected $editor_height;
|
18 |
+
/**
|
19 |
+
* The editor to be displayed initially.
|
20 |
+
*
|
21 |
+
* @access protected
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
protected $default_editor = 'tinymce';
|
25 |
+
/**
|
26 |
+
* The last editor selected by the user.
|
27 |
+
*
|
28 |
+
* @access protected
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $selected_editor;
|
32 |
+
/**
|
33 |
+
* An array of the buttons which will be rendered for the first toolbar of the TinyMCE editor.
|
34 |
+
*
|
35 |
+
* @access protected
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
protected $mce_buttons;
|
39 |
+
/**
|
40 |
+
* An array of the buttons which will be rendered for the second toolbar of the TinyMCE editor.
|
41 |
+
*
|
42 |
+
* @access protected
|
43 |
+
* @var array
|
44 |
+
*/
|
45 |
+
protected $mce_buttons_2;
|
46 |
+
/**
|
47 |
+
* An array of the buttons which will be rendered for the third toolbar of the TinyMCE editor.
|
48 |
+
*
|
49 |
+
* @access protected
|
50 |
+
* @var array
|
51 |
+
*/
|
52 |
+
protected $mce_buttons_3;
|
53 |
+
/**
|
54 |
+
* An array of the buttons which will be rendered for the fourth toolbar of the TinyMCE editor.
|
55 |
+
*
|
56 |
+
* @access protected
|
57 |
+
* @var array
|
58 |
+
*/
|
59 |
+
protected $mce_buttons_4;
|
60 |
+
/**
|
61 |
+
* An array of the buttons which will be rendered for the QuickTags editor.
|
62 |
+
*
|
63 |
+
* @access protected
|
64 |
+
* @var array
|
65 |
+
*/
|
66 |
+
protected $quicktags_buttons;
|
67 |
+
/**
|
68 |
+
* An array of filter callbacks to apply to the set of buttons which will be rendered for the editor.
|
69 |
+
*
|
70 |
+
* @access protected
|
71 |
+
* @var array
|
72 |
+
*/
|
73 |
+
protected $button_filters;
|
74 |
+
/**
|
75 |
+
* An array of the included plugins to enable for the TinyMCE editor.
|
76 |
+
*
|
77 |
+
* @access protected
|
78 |
+
* @var array
|
79 |
+
*/
|
80 |
+
protected $mce_plugins;
|
81 |
+
/**
|
82 |
+
* An array of external plugins for the TinyMCE editor.
|
83 |
+
*
|
84 |
+
* @access protected
|
85 |
+
* @var array
|
86 |
+
*/
|
87 |
+
protected $mce_external_plugins;
|
88 |
+
/**
|
89 |
+
* Updated Editor JS API was introduced in WP 4.8 so need to check for compatibility with older versions.
|
90 |
+
*
|
91 |
+
* @access private
|
92 |
+
* @var bool
|
93 |
+
*/
|
94 |
+
private $wp_version_lt_4_8;
|
95 |
+
|
96 |
+
protected function get_default_options() {
|
97 |
+
return array(
|
98 |
+
'mce_buttons' => array(
|
99 |
+
'formatselect',
|
100 |
+
'bold',
|
101 |
+
'italic',
|
102 |
+
'bullist',
|
103 |
+
'numlist',
|
104 |
+
'blockquote',
|
105 |
+
'alignleft',
|
106 |
+
'aligncenter',
|
107 |
+
'alignright',
|
108 |
+
'link',
|
109 |
+
'unlink',
|
110 |
+
'wp_more',
|
111 |
+
'wp_adv',
|
112 |
+
),
|
113 |
+
'mce_buttons_2' => array(
|
114 |
+
'strikethrough',
|
115 |
+
'hr',
|
116 |
+
'forecolor',
|
117 |
+
'pastetext',
|
118 |
+
'removeformat',
|
119 |
+
'charmap',
|
120 |
+
'outdent',
|
121 |
+
'indent',
|
122 |
+
'undo',
|
123 |
+
'redo',
|
124 |
+
'wp_help',
|
125 |
+
),
|
126 |
+
'quicktags_buttons' => array(
|
127 |
+
'strong',
|
128 |
+
'em',
|
129 |
+
'link',
|
130 |
+
'block',
|
131 |
+
'del',
|
132 |
+
'ins',
|
133 |
+
'img',
|
134 |
+
'ul',
|
135 |
+
'ol',
|
136 |
+
'li',
|
137 |
+
'code',
|
138 |
+
'more',
|
139 |
+
'close',
|
140 |
+
),
|
141 |
+
'mce_plugins' => array(
|
142 |
+
'charmap',
|
143 |
+
'colorpicker',
|
144 |
+
'hr',
|
145 |
+
'lists',
|
146 |
+
'media',
|
147 |
+
'paste',
|
148 |
+
'tabfocus',
|
149 |
+
'textcolor',
|
150 |
+
'fullscreen',
|
151 |
+
'wordpress',
|
152 |
+
'wpautoresize',
|
153 |
+
'wpeditimage',
|
154 |
+
'wpemoji',
|
155 |
+
'wpgallery',
|
156 |
+
'wplink',
|
157 |
+
'wpdialogs',
|
158 |
+
'wptextpattern',
|
159 |
+
'wpview',
|
160 |
+
),
|
161 |
+
'mce_external_plugins' => array(),
|
162 |
+
);
|
163 |
+
}
|
164 |
+
|
165 |
+
protected function initialize() {
|
166 |
+
if ( ! is_admin() ) {
|
167 |
+
return;
|
168 |
+
}
|
169 |
+
|
170 |
+
global $wp_version;
|
171 |
+
$this->wp_version_lt_4_8 = version_compare( $wp_version, '4.8', '<' );
|
172 |
+
|
173 |
+
if ( ! empty( $this->wp_version_lt_4_8 ) ) {
|
174 |
+
add_filter( 'mce_buttons', array( $this, 'mce_buttons_filter' ), 10, 2 );
|
175 |
+
add_filter( 'quicktags_settings', array( $this, 'quicktags_settings' ), 10, 2 );
|
176 |
+
}
|
177 |
+
|
178 |
+
if ( ! empty( $this->button_filters ) ) {
|
179 |
+
foreach ( $this->button_filters as $filter_name => $filter ) {
|
180 |
+
$is_valid_filter = preg_match(
|
181 |
+
'/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name
|
182 |
+
) && ! empty( $filter ) && is_callable( $filter );
|
183 |
+
if ( $is_valid_filter ) {
|
184 |
+
add_filter( $filter_name, array( $this, $filter_name ), 10, 2 );
|
185 |
+
}
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
if( class_exists( 'WC_Shortcodes_TinyMCE_Buttons' ) ) {
|
190 |
+
if ( ! empty( $this->wp_version_lt_4_8 ) ) {
|
191 |
+
$screen = get_current_screen();
|
192 |
+
if( ! is_null( $screen ) && $screen->id != 'widgets' ) {
|
193 |
+
add_filter( 'mce_external_plugins', array( $this, 'add_wpc_shortcodes_plugin' ), 15 );
|
194 |
+
add_filter( 'mce_buttons', array( $this, 'register_wpc_shortcodes_button' ), 15 );
|
195 |
+
}
|
196 |
+
} else {
|
197 |
+
$this->mce_external_plugins = $this->add_wpc_shortcodes_plugin( $this->mce_external_plugins );
|
198 |
+
$this->mce_buttons = $this->register_wpc_shortcodes_button( $this->mce_buttons );
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
if( class_exists( 'WC_Shortcodes_Admin' ) ) {
|
203 |
+
if ( ! empty( $this->wp_version_lt_4_8 ) ) {
|
204 |
+
|
205 |
+
$screen = get_current_screen();
|
206 |
+
if( ! is_null( $screen ) && $screen->id != 'widgets' ) {
|
207 |
+
add_filter( 'mce_external_plugins', array( $this, 'add_wc_shortcodes_plugin' ), 15 );
|
208 |
+
add_filter( 'mce_buttons', array( $this, 'register_wc_shortcodes_button' ), 15 );
|
209 |
+
}
|
210 |
+
} else {
|
211 |
+
$this->mce_external_plugins = $this->add_wc_shortcodes_plugin( $this->mce_external_plugins );
|
212 |
+
$this->mce_buttons = $this->register_wc_shortcodes_button( $this->mce_buttons );
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
function add_wc_shortcodes_plugin( $plugins ) {
|
218 |
+
if( isset( $plugins['woocommerce_shortcodes'] ) ) {
|
219 |
+
return $plugins;
|
220 |
+
}
|
221 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
222 |
+
$editor_path = 'woocommerce-shortcodes/assets/js/editor' . $suffix . '.js';
|
223 |
+
if( file_exists( WP_PLUGIN_DIR . '/' . $editor_path ) ) {
|
224 |
+
$plugins['woocommerce_shortcodes'] = plugins_url( $editor_path );
|
225 |
+
}
|
226 |
+
return $plugins;
|
227 |
+
}
|
228 |
+
|
229 |
+
function register_wc_shortcodes_button( $buttons ) {
|
230 |
+
if( ! in_array( 'woocommerce_shortcodes', $buttons ) ) {
|
231 |
+
array_push( $buttons, '|', 'woocommerce_shortcodes' );
|
232 |
+
}
|
233 |
+
return $buttons;
|
234 |
+
}
|
235 |
+
|
236 |
+
function add_wpc_shortcodes_plugin( $plugins ) {
|
237 |
+
if( ! isset( $plugins['wpc_shortcodes'] ) ) {
|
238 |
+
$shortcodes_path = 'wc-shortcodes/includes/mce/js/shortcodes-tinymce-4.js';
|
239 |
+
if ( file_exists( WP_PLUGIN_DIR . '/' . $shortcodes_path ) ) {
|
240 |
+
$plugins['wpc_shortcodes'] = plugins_url( $shortcodes_path . '?ver=' . WC_SHORTCODES_VERSION );
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
if( ! isset( $plugins['wpc_font_awesome'] ) ) {
|
245 |
+
$fontawesome_path = 'wc-shortcodes/includes/mce/js/font-awesome-tinymce-4.js';
|
246 |
+
if ( file_exists( WP_PLUGIN_DIR . '/' . $fontawesome_path ) ) {
|
247 |
+
$plugins['wpc_font_awesome'] = plugins_url( $fontawesome_path . '?ver=' . WC_SHORTCODES_VERSION );
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
return $plugins;
|
252 |
+
}
|
253 |
+
|
254 |
+
function register_wpc_shortcodes_button( $buttons ) {
|
255 |
+
if( ! in_array( 'wpc_shortcodes_button', $buttons ) ) {
|
256 |
+
array_push( $buttons, 'wpc_shortcodes_button' );
|
257 |
+
}
|
258 |
+
if( ! in_array( 'wpcfontAwesomeGlyphSelect', $buttons ) ) {
|
259 |
+
array_push( $buttons, 'wpcfontAwesomeGlyphSelect' );
|
260 |
+
}
|
261 |
+
|
262 |
+
return $buttons;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* @param $name
|
267 |
+
* @param $arguments
|
268 |
+
* @return array|mixed
|
269 |
+
*/
|
270 |
+
function __call( $name, $arguments ) {
|
271 |
+
if ( preg_match( '/mce_buttons(?:_[1-4])?|quicktags_settings/', $name ) && !empty( $this->button_filters[$name] ) ) {
|
272 |
+
$filter = $this->button_filters[$name];
|
273 |
+
if ( !empty( $filter[0] ) && is_a( $filter[0], 'SiteOrigin_Widget' ) ) {
|
274 |
+
$widget = $filter[0];
|
275 |
+
$settings = !empty($arguments[0]) ? $arguments[0] : array();
|
276 |
+
$editor_id = !empty($arguments[1]) ? $arguments[1] : '';
|
277 |
+
if ( preg_match( '/widget-' . $widget->id_base . '-.*-' . $this->base_name . '/', $editor_id ) ) {
|
278 |
+
return call_user_func( $filter, $settings, $editor_id );
|
279 |
+
}
|
280 |
+
else {
|
281 |
+
return $settings;
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
public function mce_buttons_filter( $buttons, $editor_id ) {
|
288 |
+
if (($key = array_search('fullscreen', $buttons)) !== false) {
|
289 |
+
unset($buttons[$key]);
|
290 |
+
}
|
291 |
+
return $buttons;
|
292 |
+
}
|
293 |
+
|
294 |
+
public function quicktags_settings( $settings, $editor_id ) {
|
295 |
+
$settings['buttons'] = preg_replace( '/,fullscreen/', '', $settings['buttons'] );
|
296 |
+
$settings['buttons'] = preg_replace( '/,dfw/', '', $settings['buttons'] );
|
297 |
+
return $settings;
|
298 |
+
}
|
299 |
+
|
300 |
+
protected function get_input_classes() {
|
301 |
+
$classes = parent::get_input_classes();
|
302 |
+
$classes[] = 'wp-editor-area';
|
303 |
+
return $classes;
|
304 |
+
}
|
305 |
+
|
306 |
+
protected function render_before_field( $value, $instance ) {
|
307 |
+
$selected_editor_name = $this->get_selected_editor_field_name( $this->base_name );
|
308 |
+
if( ! empty( $instance[ $selected_editor_name ] ) ) {
|
309 |
+
$this->selected_editor = $instance[ $selected_editor_name ];
|
310 |
+
}
|
311 |
+
else {
|
312 |
+
$this->selected_editor = $this->default_editor;
|
313 |
+
}
|
314 |
+
parent::render_before_field( $value, $instance );
|
315 |
+
}
|
316 |
+
|
317 |
+
protected function render_field( $value, $instance ) {
|
318 |
+
|
319 |
+
if ( $this->wp_version_lt_4_8 ) {
|
320 |
+
$this->render_field_pre48( $value, $instance );
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
|
324 |
+
$selected_editor = in_array( $this->selected_editor, array( 'tinymce', 'tmce' ) ) ? 'tmce' : 'html';
|
325 |
+
|
326 |
+
$tmce_settings = array(
|
327 |
+
'toolbar1' => apply_filters( 'mce_buttons', $this->mce_buttons, $this->element_id ),
|
328 |
+
'toolbar2' => apply_filters( 'mce_buttons_2', $this->mce_buttons_2, $this->element_id ),
|
329 |
+
'toolbar3' => apply_filters( 'mce_buttons_3',$this->mce_buttons_3, $this->element_id ),
|
330 |
+
'toolbar4' => apply_filters( 'mce_buttons_4',$this->mce_buttons_4, $this->element_id ),
|
331 |
+
'plugins' => array_unique( apply_filters( 'tiny_mce_plugins', $this->mce_plugins ) ),
|
332 |
+
);
|
333 |
+
|
334 |
+
foreach ( $tmce_settings as $name => $setting ) {
|
335 |
+
$tmce_settings[ $name ] = is_array( $setting ) ? implode( ',', $setting ) : '';
|
336 |
+
}
|
337 |
+
|
338 |
+
$tmce_settings['external_plugins'] = array_unique( apply_filters( 'mce_external_plugins', $this->mce_external_plugins ) );
|
339 |
+
|
340 |
+
$suffix = SCRIPT_DEBUG ? '' : '.min';
|
341 |
+
$version = 'ver=' . get_bloginfo( 'version' );
|
342 |
+
// Default stylesheets
|
343 |
+
$mce_css = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
|
344 |
+
includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
|
345 |
+
|
346 |
+
$editor_styles = get_editor_stylesheets();
|
347 |
+
|
348 |
+
if ( ! empty( $editor_styles ) ) {
|
349 |
+
// Force urlencoding of commas.
|
350 |
+
foreach ( $editor_styles as $key => $url ) {
|
351 |
+
if ( strpos( $url, ',' ) !== false ) {
|
352 |
+
$editor_styles[ $key ] = str_replace( ',', '%2C', $url );
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
$mce_css .= ',' . implode( ',', $editor_styles );
|
357 |
+
}
|
358 |
+
$mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
|
359 |
+
$tmce_settings['content_css'] = $mce_css;
|
360 |
+
|
361 |
+
$qt_settings = apply_filters(
|
362 |
+
'quicktags_settings',
|
363 |
+
array( 'buttons' => $this->quicktags_buttons ),
|
364 |
+
$this->element_id
|
365 |
+
);
|
366 |
+
|
367 |
+
$qt_settings['buttons'] = ! empty( $qt_settings['buttons'] ) ? $qt_settings['buttons'] : array();
|
368 |
+
$qt_settings['buttons'] = is_array( $qt_settings['buttons'] ) ? implode( ',', $qt_settings['buttons'] ) : '';
|
369 |
+
|
370 |
+
$settings = array(
|
371 |
+
'selectedEditor' => $selected_editor,
|
372 |
+
'tinymce' => array(
|
373 |
+
'wp_skip_init' => strpos( $this->element_id, '__i__' ) != false ||
|
374 |
+
strpos( $this->element_id, '_id_' ) != false,
|
375 |
+
'wpautop' => true,
|
376 |
+
),
|
377 |
+
'quicktags' => array(
|
378 |
+
'buttons' => $qt_settings['buttons'],
|
379 |
+
),
|
380 |
+
);
|
381 |
+
|
382 |
+
$tmce_settings = apply_filters( 'tiny_mce_before_init', $tmce_settings, $this->element_id );
|
383 |
+
|
384 |
+
foreach ( $tmce_settings as $name => $setting ) {
|
385 |
+
unset( $jdec );
|
386 |
+
if ( ! empty( $tmce_settings[ $name ] ) ) {
|
387 |
+
// Attempt to decode setting as JSON. For back compat with filters used by WP editor.
|
388 |
+
if ( is_string( $setting ) ) {
|
389 |
+
$jdec = json_decode( $setting, true );
|
390 |
+
}
|
391 |
+
$settings['tinymce'][ $name ] = empty( $jdec ) ? $setting : $jdec;
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
$value = apply_filters( 'the_editor_content', $value, $this->selected_editor );
|
396 |
+
|
397 |
+
if ( false !== stripos( $value, 'textarea' ) ) {
|
398 |
+
$value = preg_replace( '%</textarea%i', '</textarea', $value );
|
399 |
+
}
|
400 |
+
|
401 |
+
|
402 |
+
$media_buttons = $this->render_media_buttons( $this->element_id );
|
403 |
+
|
404 |
+
?><div class="siteorigin-widget-tinymce-container"
|
405 |
+
data-editor-settings="<?php echo esc_attr( json_encode( $settings ) ) ?>"
|
406 |
+
data-media-buttons="<?php echo esc_attr( json_encode( array( 'html' => $media_buttons ) ) ) ?>">
|
407 |
+
<textarea id="<?php echo esc_attr( $this->element_id ) ?>"
|
408 |
+
name="<?php echo esc_attr( $this->element_name ) ?>"
|
409 |
+
<?php if ( isset( $this->editor_height ) ) : ?>
|
410 |
+
style="height: <?php echo intval( $this->editor_height ) ?>px"
|
411 |
+
<?php else : ?>
|
412 |
+
rows="<?php echo esc_attr( $this->rows ) ?>"
|
413 |
+
<?php endif; ?>
|
414 |
+
<?php $this->render_data_attributes( $this->get_input_data_attributes() ) ?>
|
415 |
+
<?php $this->render_CSS_classes( $this->get_input_classes() ) ?>
|
416 |
+
<?php if ( ! empty( $this->placeholder ) ) echo 'placeholder="' . esc_attr( $this->placeholder ) . '"' ?>
|
417 |
+
<?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>><?php echo htmlentities( $value, ENT_QUOTES, 'UTF-8' ) ?></textarea>
|
418 |
+
</div>
|
419 |
+
<input type="hidden"
|
420 |
+
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_selected_editor', $this->parent_container) ) ?>"
|
421 |
+
class="siteorigin-widget-input siteorigin-widget-tinymce-selected-editor"
|
422 |
+
value="<?php echo esc_attr( $this->selected_editor ) ?>"/>
|
423 |
+
<?php
|
424 |
+
|
425 |
+
}
|
426 |
+
|
427 |
+
private function render_field_pre48( $value, $instance ) {
|
428 |
+
|
429 |
+
$settings = array(
|
430 |
+
'textarea_name' => esc_attr( $this->element_name ),
|
431 |
+
'default_editor' => $this->selected_editor,
|
432 |
+
'textarea_rows' => $this->rows,
|
433 |
+
'editor_class' => 'siteorigin-widget-input',
|
434 |
+
'tinymce' => array(
|
435 |
+
'wp_skip_init' => strpos( $this->element_id, '__i__' ) != false || strpos( $this->element_id, '_id_' ) != false
|
436 |
+
)
|
437 |
+
);
|
438 |
+
if( isset( $this->editor_height ) ) $settings['editor_height'] = $this->editor_height;
|
439 |
+
preg_match( '/widget-(.+?)\[/', $this->element_name, $id_base_matches );
|
440 |
+
$widget_id_base = empty($id_base_matches) || count($id_base_matches) < 2 ? '' : $id_base_matches[1];
|
441 |
+
?>
|
442 |
+
<div class="siteorigin-widget-tinymce-container"
|
443 |
+
data-mce-settings="<?php echo esc_attr( json_encode( $settings['tinymce'] ) ) ?>"
|
444 |
+
data-qt-settings="<?php echo esc_attr( json_encode( array() ) ) ?>"
|
445 |
+
data-widget-id-base="<?php echo esc_attr( $widget_id_base ) ?>"
|
446 |
+
>
|
447 |
+
<?php
|
448 |
+
wp_editor( $value, esc_attr( $this->element_id ), $settings )
|
449 |
+
?>
|
450 |
+
</div>
|
451 |
+
<input type="hidden"
|
452 |
+
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_selected_editor', $this->parent_container) ) ?>"
|
453 |
+
class="siteorigin-widget-input siteorigin-widget-tinymce-selected-editor"
|
454 |
+
value="<?php echo esc_attr( $this->selected_editor ) ?>"/>
|
455 |
+
<?php
|
456 |
+
|
457 |
+
if( $this->selected_editor == 'html' ) {
|
458 |
+
remove_filter( 'the_editor_content', 'wp_htmledit_pre' );
|
459 |
+
}
|
460 |
+
if( $this->selected_editor == 'tinymce' ) {
|
461 |
+
remove_filter( 'the_editor_content', 'wp_richedit_pre' );
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
public function enqueue_scripts() {
|
466 |
+
|
467 |
+
if ( $this->wp_version_lt_4_8 ) {
|
468 |
+
$src = plugin_dir_url( __FILE__ ) . 'js/tinymce-field-pre48' . SOW_BUNDLE_JS_SUFFIX . '.js';
|
469 |
+
$deps = array( 'jquery', 'editor', 'quicktags' );
|
470 |
+
} else {
|
471 |
+
wp_enqueue_editor();
|
472 |
+
$src = plugin_dir_url( __FILE__ ) . 'js/tinymce-field' . SOW_BUNDLE_JS_SUFFIX . '.js';
|
473 |
+
$deps = array( 'jquery' );
|
474 |
+
}
|
475 |
+
|
476 |
+
wp_enqueue_script( 'so-tinymce-field', $src, $deps, SOW_BUNDLE_VERSION );
|
477 |
+
wp_enqueue_style(
|
478 |
+
'so-tinymce-field', plugin_dir_url( __FILE__ ) . 'css/tinymce-field.css', array(), SOW_BUNDLE_VERSION
|
479 |
+
);
|
480 |
+
}
|
481 |
+
|
482 |
+
protected function sanitize_field_input( $value, $instance ) {
|
483 |
+
if( current_user_can( 'unfiltered_html' ) ) {
|
484 |
+
$sanitized_value = $value;
|
485 |
+
} else {
|
486 |
+
$sanitized_value = wp_kses_post( $value );
|
487 |
+
}
|
488 |
+
$sanitized_value = balanceTags( $sanitized_value , true );
|
489 |
+
return $sanitized_value;
|
490 |
+
}
|
491 |
+
|
492 |
+
public function sanitize_instance( $instance ) {
|
493 |
+
$selected_editor_name = $this->get_selected_editor_field_name( $this->base_name );
|
494 |
+
if( ! empty( $instance[ $selected_editor_name ] ) ) {
|
495 |
+
$selected_editor = $instance[ $selected_editor_name ];
|
496 |
+
$instance[ $selected_editor_name ] = in_array( $selected_editor, array( 'tinymce', 'tmce', 'quicktags', 'html' ) ) ? $selected_editor : $this->default_editor;
|
497 |
+
}
|
498 |
+
return $instance;
|
499 |
+
}
|
500 |
+
|
501 |
+
public function get_selected_editor_field_name( $base_name ) {
|
502 |
+
$v_name = $base_name;
|
503 |
+
if( strpos($v_name, '][') !== false ) {
|
504 |
+
// Remove this splitter
|
505 |
+
$v_name = substr( $v_name, strrpos($v_name, '][') + 2 );
|
506 |
+
}
|
507 |
+
return $v_name . '_selected_editor';
|
508 |
+
}
|
509 |
+
|
510 |
+
private function render_media_buttons( $editor_id ) {
|
511 |
+
|
512 |
+
ob_start();
|
513 |
+
if ( ! function_exists( 'media_buttons' ) ) {
|
514 |
+
include( ABSPATH . 'wp-admin/includes/media.php' );
|
515 |
+
}
|
516 |
+
|
517 |
+
echo '<div id="wp-' . esc_attr( $editor_id ) . '-media-buttons" class="wp-media-buttons">';
|
518 |
+
|
519 |
+
do_action( 'media_buttons', $editor_id );
|
520 |
+
|
521 |
+
echo "</div>\n";
|
522 |
+
|
523 |
+
return ob_get_clean();
|
524 |
+
}
|
525 |
+
}
|
base/inc/post-selector.php
CHANGED
@@ -1,134 +1,134 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Filter a query created from the post selector field into an array that will work properly with get_posts
|
5 |
-
*
|
6 |
-
* @param $query
|
7 |
-
*
|
8 |
-
* @return mixed
|
9 |
-
*/
|
10 |
-
function siteorigin_widget_post_selector_process_query( $query ){
|
11 |
-
$query = wp_parse_args($query,
|
12 |
-
array(
|
13 |
-
'post_status' => 'publish',
|
14 |
-
'posts_per_page' => 10,
|
15 |
-
)
|
16 |
-
);
|
17 |
-
|
18 |
-
if( !empty( $query['post_type'] ) ) {
|
19 |
-
if($query['post_type'] == '_all') $query['post_type'] = siteorigin_widget_post_selector_all_post_types();
|
20 |
-
$query['post_type'] = strpos( $query['post_type'], ',' ) !== false ? explode( ',', $query['post_type'] ) : $query['post_type'];
|
21 |
-
}
|
22 |
-
if( !empty( $query['post_type'] ) && $query['post_type'] == 'attachment' && $query['post_status'] == 'publish' ) {
|
23 |
-
$query['post_status'] = 'inherit';
|
24 |
-
}
|
25 |
-
|
26 |
-
|
27 |
-
if(!empty($query['post__in'])) {
|
28 |
-
$query['post__in'] = explode(',', $query['post__in']);
|
29 |
-
$query['post__in'] = array_map('intval', $query['post__in']);
|
30 |
-
}
|
31 |
-
|
32 |
-
if(!empty($query['tax_query'])) {
|
33 |
-
$tax_queries = explode(',', $query['tax_query']);
|
34 |
-
|
35 |
-
$query['tax_query'] = array();
|
36 |
-
$query['tax_query']['relation'] = 'OR';
|
37 |
-
foreach($tax_queries as $tq) {
|
38 |
-
list($tax, $term) = explode(':', $tq);
|
39 |
-
|
40 |
-
if( empty($tax) || empty($term) ) continue;
|
41 |
-
$query['tax_query'][] = array(
|
42 |
-
'taxonomy' => $tax,
|
43 |
-
'field' => 'slug',
|
44 |
-
'terms' => $term
|
45 |
-
);
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
if ( isset( $query['date_type'] ) && $query['date_type'] == 'relative' ) {
|
50 |
-
|
51 |
-
$date_query_rel = json_decode(
|
52 |
-
stripslashes( $query['date_query_relative'] ),
|
53 |
-
true
|
54 |
-
);
|
55 |
-
$value_after = new DateTime(
|
56 |
-
$date_query_rel['from']['value'] . ' ' . $date_query_rel['from']['unit'] . ' ago'
|
57 |
-
);
|
58 |
-
$value['after'] = $value_after->format( 'Y-m-d' );
|
59 |
-
$value_before = new DateTime(
|
60 |
-
$date_query_rel['to']['value'] . ' ' . $date_query_rel['to']['unit'] . ' ago'
|
61 |
-
);
|
62 |
-
$value['before'] = $value_before->format( 'Y-m-d' );
|
63 |
-
$query['date_query'] = $value;
|
64 |
-
unset( $query['date_type'] );
|
65 |
-
unset( $query['date_query_relative'] );
|
66 |
-
} else if ( ! empty( $query['date_query'] ) ) {
|
67 |
-
$query['date_query'] = json_decode( stripslashes( $query['date_query'] ), true );
|
68 |
-
}
|
69 |
-
|
70 |
-
if ( ! empty( $query['date_query'] ) ) {
|
71 |
-
$query['date_query']['inclusive'] = true;
|
72 |
-
}
|
73 |
-
|
74 |
-
if ( ! empty( $query['sticky'] ) ) {
|
75 |
-
switch($query['sticky']){
|
76 |
-
case 'ignore' :
|
77 |
-
$query['ignore_sticky_posts'] = 1;
|
78 |
-
break;
|
79 |
-
case 'only' :
|
80 |
-
$post_in = empty( $query['post__in'] ) ? array() : $query['post__in'];
|
81 |
-
$query['post__in'] = array_merge( $post_in, get_option( 'sticky_posts' ) );
|
82 |
-
break;
|
83 |
-
case 'exclude' :
|
84 |
-
$query['post__not_in'] = get_option( 'sticky_posts' );
|
85 |
-
break;
|
86 |
-
}
|
87 |
-
unset( $query['sticky'] );
|
88 |
-
}
|
89 |
-
|
90 |
-
// Exclude the current post (if applicable) to avoid any issues associated with showing the same post again
|
91 |
-
if( is_singular() && get_the_id() != false ){
|
92 |
-
$query['post__not_in'][] = get_the_id();
|
93 |
-
}
|
94 |
-
|
95 |
-
if ( ! empty( $query['additional'] ) ) {
|
96 |
-
$query = wp_parse_args( $query['additional'], $query );
|
97 |
-
unset( $query['additional'] );
|
98 |
-
|
99 |
-
// If post_not_in is set, we need to convert it to an array to avoid issues with the query.
|
100 |
-
if( !empty( $query['post__not_in'] ) && !is_array( $query['post__not_in'] ) ){
|
101 |
-
$query['post__not_in'] = explode( ',', $query['post__not_in'] );
|
102 |
-
$query['post__not_in'] = array_map( 'intval', $query['post__not_in'] );
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
return apply_filters( 'siteorigin_widgets_posts_selector_query', $query );
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Just return a comma separated list of all available post types.
|
112 |
-
*
|
113 |
-
* @return string
|
114 |
-
*/
|
115 |
-
function siteorigin_widget_post_selector_all_post_types(){
|
116 |
-
$post_types = array();
|
117 |
-
foreach( get_post_types( array( 'public' => true ), 'objects' ) as $id => $type ) {
|
118 |
-
$post_types[] = $id;
|
119 |
-
}
|
120 |
-
|
121 |
-
return implode(',', $post_types);
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Tells us how many posts this query has
|
126 |
-
*
|
127 |
-
* @param $query
|
128 |
-
* @return int
|
129 |
-
*/
|
130 |
-
function siteorigin_widget_post_selector_count_posts( $query ) {
|
131 |
-
$query = siteorigin_widget_post_selector_process_query( $query );
|
132 |
-
$posts = new WP_Query($query);
|
133 |
-
return $posts->found_posts;
|
134 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Filter a query created from the post selector field into an array that will work properly with get_posts
|
5 |
+
*
|
6 |
+
* @param $query
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
function siteorigin_widget_post_selector_process_query( $query ){
|
11 |
+
$query = wp_parse_args($query,
|
12 |
+
array(
|
13 |
+
'post_status' => 'publish',
|
14 |
+
'posts_per_page' => 10,
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
+
if( !empty( $query['post_type'] ) ) {
|
19 |
+
if($query['post_type'] == '_all') $query['post_type'] = siteorigin_widget_post_selector_all_post_types();
|
20 |
+
$query['post_type'] = strpos( $query['post_type'], ',' ) !== false ? explode( ',', $query['post_type'] ) : $query['post_type'];
|
21 |
+
}
|
22 |
+
if( !empty( $query['post_type'] ) && $query['post_type'] == 'attachment' && $query['post_status'] == 'publish' ) {
|
23 |
+
$query['post_status'] = 'inherit';
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
if(!empty($query['post__in'])) {
|
28 |
+
$query['post__in'] = explode(',', $query['post__in']);
|
29 |
+
$query['post__in'] = array_map('intval', $query['post__in']);
|
30 |
+
}
|
31 |
+
|
32 |
+
if(!empty($query['tax_query'])) {
|
33 |
+
$tax_queries = explode(',', $query['tax_query']);
|
34 |
+
|
35 |
+
$query['tax_query'] = array();
|
36 |
+
$query['tax_query']['relation'] = 'OR';
|
37 |
+
foreach($tax_queries as $tq) {
|
38 |
+
list($tax, $term) = explode(':', $tq);
|
39 |
+
|
40 |
+
if( empty($tax) || empty($term) ) continue;
|
41 |
+
$query['tax_query'][] = array(
|
42 |
+
'taxonomy' => $tax,
|
43 |
+
'field' => 'slug',
|
44 |
+
'terms' => $term
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( isset( $query['date_type'] ) && $query['date_type'] == 'relative' ) {
|
50 |
+
|
51 |
+
$date_query_rel = json_decode(
|
52 |
+
stripslashes( $query['date_query_relative'] ),
|
53 |
+
true
|
54 |
+
);
|
55 |
+
$value_after = new DateTime(
|
56 |
+
$date_query_rel['from']['value'] . ' ' . $date_query_rel['from']['unit'] . ' ago'
|
57 |
+
);
|
58 |
+
$value['after'] = $value_after->format( 'Y-m-d' );
|
59 |
+
$value_before = new DateTime(
|
60 |
+
$date_query_rel['to']['value'] . ' ' . $date_query_rel['to']['unit'] . ' ago'
|
61 |
+
);
|
62 |
+
$value['before'] = $value_before->format( 'Y-m-d' );
|
63 |
+
$query['date_query'] = $value;
|
64 |
+
unset( $query['date_type'] );
|
65 |
+
unset( $query['date_query_relative'] );
|
66 |
+
} else if ( ! empty( $query['date_query'] ) ) {
|
67 |
+
$query['date_query'] = json_decode( stripslashes( $query['date_query'] ), true );
|
68 |
+
}
|
69 |
+
|
70 |
+
if ( ! empty( $query['date_query'] ) ) {
|
71 |
+
$query['date_query']['inclusive'] = true;
|
72 |
+
}
|
73 |
+
|
74 |
+
if ( ! empty( $query['sticky'] ) ) {
|
75 |
+
switch($query['sticky']){
|
76 |
+
case 'ignore' :
|
77 |
+
$query['ignore_sticky_posts'] = 1;
|
78 |
+
break;
|
79 |
+
case 'only' :
|
80 |
+
$post_in = empty( $query['post__in'] ) ? array() : $query['post__in'];
|
81 |
+
$query['post__in'] = array_merge( $post_in, get_option( 'sticky_posts' ) );
|
82 |
+
break;
|
83 |
+
case 'exclude' :
|
84 |
+
$query['post__not_in'] = get_option( 'sticky_posts' );
|
85 |
+
break;
|
86 |
+
}
|
87 |
+
unset( $query['sticky'] );
|
88 |
+
}
|
89 |
+
|
90 |
+
// Exclude the current post (if applicable) to avoid any issues associated with showing the same post again
|
91 |
+
if( is_singular() && get_the_id() != false ){
|
92 |
+
$query['post__not_in'][] = get_the_id();
|
93 |
+
}
|
94 |
+
|
95 |
+
if ( ! empty( $query['additional'] ) ) {
|
96 |
+
$query = wp_parse_args( $query['additional'], $query );
|
97 |
+
unset( $query['additional'] );
|
98 |
+
|
99 |
+
// If post_not_in is set, we need to convert it to an array to avoid issues with the query.
|
100 |
+
if( !empty( $query['post__not_in'] ) && !is_array( $query['post__not_in'] ) ){
|
101 |
+
$query['post__not_in'] = explode( ',', $query['post__not_in'] );
|
102 |
+
$query['post__not_in'] = array_map( 'intval', $query['post__not_in'] );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return apply_filters( 'siteorigin_widgets_posts_selector_query', $query );
|
107 |
+
}
|
108 |
+
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Just return a comma separated list of all available post types.
|
112 |
+
*
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
function siteorigin_widget_post_selector_all_post_types(){
|
116 |
+
$post_types = array();
|
117 |
+
foreach( get_post_types( array( 'public' => true ), 'objects' ) as $id => $type ) {
|
118 |
+
$post_types[] = $id;
|
119 |
+
}
|
120 |
+
|
121 |
+
return implode(',', $post_types);
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Tells us how many posts this query has
|
126 |
+
*
|
127 |
+
* @param $query
|
128 |
+
* @return int
|
129 |
+
*/
|
130 |
+
function siteorigin_widget_post_selector_count_posts( $query ) {
|
131 |
+
$query = siteorigin_widget_post_selector_process_query( $query );
|
132 |
+
$posts = new WP_Query($query);
|
133 |
+
return $posts->found_posts;
|
134 |
+
}
|
base/inc/widget-manager.class.php
CHANGED
@@ -1,167 +1,167 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Handles registering Widgets Bundle widgets.
|
5 |
-
*
|
6 |
-
* Class SiteOrigin_Widgets_Widget_Manager
|
7 |
-
*/
|
8 |
-
class SiteOrigin_Widgets_Widget_Manager {
|
9 |
-
/**
|
10 |
-
* Regsitered widgets
|
11 |
-
*
|
12 |
-
* @var
|
13 |
-
*/
|
14 |
-
private $registered;
|
15 |
-
|
16 |
-
function __construct(){
|
17 |
-
$this->registered = array();
|
18 |
-
add_action( 'widgets_init', array( $this, 'widgets_init' ) );
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Get the single instance.
|
23 |
-
*
|
24 |
-
* @return SiteOrigin_Widgets_Widget_Manager
|
25 |
-
*/
|
26 |
-
static function single() {
|
27 |
-
static $single;
|
28 |
-
|
29 |
-
if( empty($single) ) {
|
30 |
-
$single = new self();
|
31 |
-
}
|
32 |
-
|
33 |
-
return $single;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @param $id
|
38 |
-
* @param $path
|
39 |
-
* @param bool|false $class
|
40 |
-
* @return mixed
|
41 |
-
*/
|
42 |
-
public function register( $id, $path, $class = false ){
|
43 |
-
$path = wp_normalize_path( $path );
|
44 |
-
if ( empty( $class ) ) {
|
45 |
-
$class = 'SiteOrigin_Widget_' . str_replace( ' ', '', ucwords( str_replace('-', ' ', $id) ) ) . '_Widget';
|
46 |
-
}
|
47 |
-
|
48 |
-
$this->registered[ $id ] = new stdClass();
|
49 |
-
$this->registered[ $id ]->path = $path;
|
50 |
-
$this->registered[ $id ]->class = $class;
|
51 |
-
$this->registered[ $id ]->registered = false;
|
52 |
-
|
53 |
-
return $this->registered[ $id ];
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Initialize all the widgets.
|
58 |
-
*/
|
59 |
-
public function widgets_init(){
|
60 |
-
foreach( $this->registered as $id => & $info ) {
|
61 |
-
if( $info->registered ) continue;
|
62 |
-
register_widget( $info->class );
|
63 |
-
$info->registered = true;
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Get the path of the widget
|
69 |
-
*
|
70 |
-
* @param $id
|
71 |
-
*
|
72 |
-
* @return bool
|
73 |
-
*/
|
74 |
-
public function get_plugin_path( $id ) {
|
75 |
-
if( empty( $this->registered[ $id ] ) ) {
|
76 |
-
// This call might be using the incorrect ID convention.
|
77 |
-
if( substr($id, 0, 4) == 'sow-' ) $id = substr($id, 4);
|
78 |
-
else $id = 'sow-' . $id;
|
79 |
-
}
|
80 |
-
|
81 |
-
return !empty($this->registered[$id]) ? $this->registered[$id]->path : false;
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* @param $id
|
86 |
-
*
|
87 |
-
* @return string
|
88 |
-
*
|
89 |
-
* @todo examine this when using a widget in a theme folder.
|
90 |
-
*/
|
91 |
-
function get_plugin_dir_path( $id ){
|
92 |
-
return plugin_dir_path( $this->get_plugin_path( $id ) );
|
93 |
-
}
|
94 |
-
|
95 |
-
function get_plugin_dir_url( $id ){
|
96 |
-
return plugin_dir_url( $this->get_plugin_path( $id ) );
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Get a widget ID from a file path
|
101 |
-
*
|
102 |
-
* @param string $path The file path.
|
103 |
-
*
|
104 |
-
* @return string The ID.
|
105 |
-
*/
|
106 |
-
function get_id_from_path( $path ){
|
107 |
-
foreach( $this->registered as $id => $r ) {
|
108 |
-
if( $r->path == $path ) return $id;
|
109 |
-
}
|
110 |
-
return false;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Get the class name of a widget from the
|
115 |
-
*
|
116 |
-
* @param $path
|
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 |
-
}
|
123 |
-
return false;
|
124 |
-
}
|
125 |
-
}
|
126 |
-
SiteOrigin_Widgets_Widget_Manager::single();
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Register a widget
|
130 |
-
*
|
131 |
-
* @param string $id The ID of the widget
|
132 |
-
* @param string $path The path of the widget
|
133 |
-
* @param bool|string $class The name of the class
|
134 |
-
*/
|
135 |
-
function siteorigin_widget_register( $id, $path, $class = false ){
|
136 |
-
SiteOrigin_Widgets_Widget_Manager::single()->register( $id, $path, $class );
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Get the base file of a widget plugin
|
141 |
-
*
|
142 |
-
* @param $name
|
143 |
-
* @return bool
|
144 |
-
*/
|
145 |
-
function siteorigin_widget_get_plugin_path($id){
|
146 |
-
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_path( $id );
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Get the base path folder of a widget plugin.
|
151 |
-
*
|
152 |
-
* @param $id
|
153 |
-
* @return string
|
154 |
-
*/
|
155 |
-
function siteorigin_widget_get_plugin_dir_path($id){
|
156 |
-
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_path( $id );
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Get the base path URL of a widget plugin.
|
161 |
-
*
|
162 |
-
* @param $id
|
163 |
-
* @return string
|
164 |
-
*/
|
165 |
-
function siteorigin_widget_get_plugin_dir_url($id){
|
166 |
-
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_url( $id );
|
167 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles registering Widgets Bundle widgets.
|
5 |
+
*
|
6 |
+
* Class SiteOrigin_Widgets_Widget_Manager
|
7 |
+
*/
|
8 |
+
class SiteOrigin_Widgets_Widget_Manager {
|
9 |
+
/**
|
10 |
+
* Regsitered widgets
|
11 |
+
*
|
12 |
+
* @var
|
13 |
+
*/
|
14 |
+
private $registered;
|
15 |
+
|
16 |
+
function __construct(){
|
17 |
+
$this->registered = array();
|
18 |
+
add_action( 'widgets_init', array( $this, 'widgets_init' ) );
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get the single instance.
|
23 |
+
*
|
24 |
+
* @return SiteOrigin_Widgets_Widget_Manager
|
25 |
+
*/
|
26 |
+
static function single() {
|
27 |
+
static $single;
|
28 |
+
|
29 |
+
if( empty($single) ) {
|
30 |
+
$single = new self();
|
31 |
+
}
|
32 |
+
|
33 |
+
return $single;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @param $id
|
38 |
+
* @param $path
|
39 |
+
* @param bool|false $class
|
40 |
+
* @return mixed
|
41 |
+
*/
|
42 |
+
public function register( $id, $path, $class = false ){
|
43 |
+
$path = wp_normalize_path( $path );
|
44 |
+
if ( empty( $class ) ) {
|
45 |
+
$class = 'SiteOrigin_Widget_' . str_replace( ' ', '', ucwords( str_replace('-', ' ', $id) ) ) . '_Widget';
|
46 |
+
}
|
47 |
+
|
48 |
+
$this->registered[ $id ] = new stdClass();
|
49 |
+
$this->registered[ $id ]->path = $path;
|
50 |
+
$this->registered[ $id ]->class = $class;
|
51 |
+
$this->registered[ $id ]->registered = false;
|
52 |
+
|
53 |
+
return $this->registered[ $id ];
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Initialize all the widgets.
|
58 |
+
*/
|
59 |
+
public function widgets_init(){
|
60 |
+
foreach( $this->registered as $id => & $info ) {
|
61 |
+
if( $info->registered ) continue;
|
62 |
+
register_widget( $info->class );
|
63 |
+
$info->registered = true;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Get the path of the widget
|
69 |
+
*
|
70 |
+
* @param $id
|
71 |
+
*
|
72 |
+
* @return bool
|
73 |
+
*/
|
74 |
+
public function get_plugin_path( $id ) {
|
75 |
+
if( empty( $this->registered[ $id ] ) ) {
|
76 |
+
// This call might be using the incorrect ID convention.
|
77 |
+
if( substr($id, 0, 4) == 'sow-' ) $id = substr($id, 4);
|
78 |
+
else $id = 'sow-' . $id;
|
79 |
+
}
|
80 |
+
|
81 |
+
return !empty($this->registered[$id]) ? $this->registered[$id]->path : false;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @param $id
|
86 |
+
*
|
87 |
+
* @return string
|
88 |
+
*
|
89 |
+
* @todo examine this when using a widget in a theme folder.
|
90 |
+
*/
|
91 |
+
function get_plugin_dir_path( $id ){
|
92 |
+
return plugin_dir_path( $this->get_plugin_path( $id ) );
|
93 |
+
}
|
94 |
+
|
95 |
+
function get_plugin_dir_url( $id ){
|
96 |
+
return plugin_dir_url( $this->get_plugin_path( $id ) );
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get a widget ID from a file path
|
101 |
+
*
|
102 |
+
* @param string $path The file path.
|
103 |
+
*
|
104 |
+
* @return string The ID.
|
105 |
+
*/
|
106 |
+
function get_id_from_path( $path ){
|
107 |
+
foreach( $this->registered as $id => $r ) {
|
108 |
+
if( $r->path == $path ) return $id;
|
109 |
+
}
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Get the class name of a widget from the
|
115 |
+
*
|
116 |
+
* @param $path
|
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 |
+
}
|
123 |
+
return false;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
SiteOrigin_Widgets_Widget_Manager::single();
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Register a widget
|
130 |
+
*
|
131 |
+
* @param string $id The ID of the widget
|
132 |
+
* @param string $path The path of the widget
|
133 |
+
* @param bool|string $class The name of the class
|
134 |
+
*/
|
135 |
+
function siteorigin_widget_register( $id, $path, $class = false ){
|
136 |
+
SiteOrigin_Widgets_Widget_Manager::single()->register( $id, $path, $class );
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Get the base file of a widget plugin
|
141 |
+
*
|
142 |
+
* @param $name
|
143 |
+
* @return bool
|
144 |
+
*/
|
145 |
+
function siteorigin_widget_get_plugin_path($id){
|
146 |
+
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_path( $id );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get the base path folder of a widget plugin.
|
151 |
+
*
|
152 |
+
* @param $id
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
function siteorigin_widget_get_plugin_dir_path($id){
|
156 |
+
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_path( $id );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get the base path URL of a widget plugin.
|
161 |
+
*
|
162 |
+
* @param $id
|
163 |
+
* @return string
|
164 |
+
*/
|
165 |
+
function siteorigin_widget_get_plugin_dir_url($id){
|
166 |
+
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_url( $id );
|
167 |
+
}
|
base/inc/widgets/base-slider.class.php
CHANGED
@@ -1,341 +1,341 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Register all the frontend scripts and styles for the base slider.
|
7 |
-
*/
|
8 |
-
function initialize() {
|
9 |
-
|
10 |
-
$frontend_scripts = array();
|
11 |
-
$frontend_scripts[] = array(
|
12 |
-
'sow-slider-slider-cycle2',
|
13 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/jquery.cycle' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
14 |
-
array( 'jquery' ),
|
15 |
-
SOW_BUNDLE_VERSION
|
16 |
-
);
|
17 |
-
if( function_exists('wp_is_mobile') && wp_is_mobile() ) {
|
18 |
-
$frontend_scripts[] = array(
|
19 |
-
'sow-slider-slider-cycle2-swipe',
|
20 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/jquery.cycle.swipe' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
21 |
-
array( 'jquery' ),
|
22 |
-
SOW_BUNDLE_VERSION
|
23 |
-
);
|
24 |
-
}
|
25 |
-
$frontend_scripts[] = array(
|
26 |
-
'sow-slider-slider',
|
27 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/slider/jquery.slider' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
28 |
-
array( 'jquery' ),
|
29 |
-
SOW_BUNDLE_VERSION
|
30 |
-
);
|
31 |
-
|
32 |
-
$this->register_frontend_scripts( $frontend_scripts );
|
33 |
-
$this->register_frontend_styles(
|
34 |
-
array(
|
35 |
-
array(
|
36 |
-
'sow-slider-slider',
|
37 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'css/slider/slider.css',
|
38 |
-
array(),
|
39 |
-
SOW_BUNDLE_VERSION
|
40 |
-
)
|
41 |
-
)
|
42 |
-
);
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* The control array required for the slider
|
47 |
-
*
|
48 |
-
* @return array
|
49 |
-
*/
|
50 |
-
function control_form_fields(){
|
51 |
-
return array(
|
52 |
-
'speed' => array(
|
53 |
-
'type' => 'number',
|
54 |
-
'label' => __('Animation speed', 'so-widgets-bundle'),
|
55 |
-
'description' => __('Animation speed in milliseconds.', 'so-widgets-bundle'),
|
56 |
-
'default' => 800,
|
57 |
-
),
|
58 |
-
|
59 |
-
'timeout' => array(
|
60 |
-
'type' => 'number',
|
61 |
-
'label' => __('Timeout', 'so-widgets-bundle'),
|
62 |
-
'description' => __('How long each frame is displayed for in milliseconds.', 'so-widgets-bundle'),
|
63 |
-
'default' => 8000,
|
64 |
-
),
|
65 |
-
|
66 |
-
'nav_color_hex' => array(
|
67 |
-
'type' => 'color',
|
68 |
-
'label' => __('Navigation color', 'so-widgets-bundle'),
|
69 |
-
'default' => '#FFFFFF',
|
70 |
-
),
|
71 |
-
|
72 |
-
'nav_style' => array(
|
73 |
-
'type' => 'select',
|
74 |
-
'label' => __('Navigation style', 'so-widgets-bundle'),
|
75 |
-
'default' => 'thin',
|
76 |
-
'options' => array(
|
77 |
-
'ultra-thin' => __('Ultra thin', 'so-widgets-bundle'),
|
78 |
-
'thin' => __('Thin', 'so-widgets-bundle'),
|
79 |
-
'medium' => __('Medium', 'so-widgets-bundle'),
|
80 |
-
'thick' => __('Thick', 'so-widgets-bundle'),
|
81 |
-
'ultra-thin-rounded' => __('Rounded ultra thin', 'so-widgets-bundle'),
|
82 |
-
'thin-rounded' => __('Rounded thin', 'so-widgets-bundle'),
|
83 |
-
'medium-rounded' => __('Rounded medium', 'so-widgets-bundle'),
|
84 |
-
'thick-rounded' => __('Rounded thick', 'so-widgets-bundle'),
|
85 |
-
)
|
86 |
-
),
|
87 |
-
|
88 |
-
'nav_size' => array(
|
89 |
-
'type' => 'number',
|
90 |
-
'label' => __('Navigation size', 'so-widgets-bundle'),
|
91 |
-
'default' => '25',
|
92 |
-
),
|
93 |
-
|
94 |
-
'swipe' => array(
|
95 |
-
'type' => 'checkbox',
|
96 |
-
'label' => __( 'Swipe Control', 'so-widgets-bundle' ),
|
97 |
-
'description' => __( 'Allow users to swipe through frames on mobile devices.', 'so-widgets-bundle' ),
|
98 |
-
'default' => true,
|
99 |
-
)
|
100 |
-
);
|
101 |
-
}
|
102 |
-
|
103 |
-
function video_form_fields(){
|
104 |
-
return array(
|
105 |
-
'file' => array(
|
106 |
-
'type' => 'media',
|
107 |
-
'library' => 'video',
|
108 |
-
'label' => __('Video file', 'so-widgets-bundle'),
|
109 |
-
),
|
110 |
-
|
111 |
-
'url' => array(
|
112 |
-
'type' => 'text',
|
113 |
-
'sanitize' => 'url',
|
114 |
-
'label' => __('Video URL', 'so-widgets-bundle'),
|
115 |
-
'optional' => 'true',
|
116 |
-
'description' => __('An external URL of the video. Overrides video file.', 'so-widgets-bundle')
|
117 |
-
),
|
118 |
-
|
119 |
-
'format' => array(
|
120 |
-
'type' => 'select',
|
121 |
-
'label' => __('Video format', 'so-widgets-bundle'),
|
122 |
-
'options' => array(
|
123 |
-
'video/mp4' => 'MP4',
|
124 |
-
'video/webm' => 'WebM',
|
125 |
-
'video/ogg' => 'Ogg',
|
126 |
-
),
|
127 |
-
),
|
128 |
-
|
129 |
-
'height' => array(
|
130 |
-
'type' => 'number',
|
131 |
-
'label' => __( 'Maximum height', 'so-widgets-bundle' )
|
132 |
-
),
|
133 |
-
|
134 |
-
);
|
135 |
-
}
|
136 |
-
|
137 |
-
function slider_settings( $controls ){
|
138 |
-
return array(
|
139 |
-
'pagination' => true,
|
140 |
-
'speed' => empty( $controls['speed'] ) ? 1 : $controls['speed'],
|
141 |
-
'timeout' => $controls['timeout'],
|
142 |
-
'swipe' => $controls['swipe'],
|
143 |
-
);
|
144 |
-
}
|
145 |
-
|
146 |
-
function render_template( $controls, $frames ){
|
147 |
-
$this->render_template_part('before_slider', $controls, $frames);
|
148 |
-
$this->render_template_part('before_slides', $controls, $frames);
|
149 |
-
|
150 |
-
foreach( $frames as $i => $frame ) {
|
151 |
-
$this->render_frame( $i, $frame );
|
152 |
-
}
|
153 |
-
|
154 |
-
$this->render_template_part('after_slides', $controls, $frames);
|
155 |
-
$this->render_template_part('navigation', $controls, $frames);
|
156 |
-
$this->render_template_part('after_slider', $controls, $frames);
|
157 |
-
}
|
158 |
-
|
159 |
-
function render_template_part( $part, $controls, $frames ) {
|
160 |
-
switch( $part ) {
|
161 |
-
case 'before_slider':
|
162 |
-
?><div class="sow-slider-base <?php if( wp_is_mobile() ) echo 'sow-slider-is-mobile' ?>" style="display: none"><?php
|
163 |
-
break;
|
164 |
-
case 'before_slides':
|
165 |
-
$settings = $this->slider_settings( $controls );
|
166 |
-
?><ul class="sow-slider-images" data-settings="<?php echo esc_attr( json_encode($settings) ) ?>"><?php
|
167 |
-
break;
|
168 |
-
case 'after_slides':
|
169 |
-
?></ul><?php
|
170 |
-
break;
|
171 |
-
case 'navigation':
|
172 |
-
?>
|
173 |
-
<ol class="sow-slider-pagination">
|
174 |
-
<?php foreach($frames as $i => $frame) : ?>
|
175 |
-
<li><a href="#" data-goto="<?php echo $i ?>"><?php echo $i+1 ?></a></li>
|
176 |
-
<?php endforeach; ?>
|
177 |
-
</ol>
|
178 |
-
|
179 |
-
<div class="sow-slide-nav sow-slide-nav-next">
|
180 |
-
<a href="#" data-goto="next" data-action="next">
|
181 |
-
<em class="sow-sld-icon-<?php echo sanitize_html_class( $controls['nav_style'] ) ?>-right"></em>
|
182 |
-
</a>
|
183 |
-
</div>
|
184 |
-
|
185 |
-
<div class="sow-slide-nav sow-slide-nav-prev">
|
186 |
-
<a href="#" data-goto="previous" data-action="prev">
|
187 |
-
<em class="sow-sld-icon-<?php echo sanitize_html_class( $controls['nav_style'] ) ?>-left"></em>
|
188 |
-
</a>
|
189 |
-
</div>
|
190 |
-
<?php
|
191 |
-
break;
|
192 |
-
case 'after_slider':
|
193 |
-
?></div><?php
|
194 |
-
break;
|
195 |
-
}
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Get the frame background information from the frame. This can be overwritten by child classes.
|
200 |
-
*
|
201 |
-
* @param $frame
|
202 |
-
*
|
203 |
-
* @return array
|
204 |
-
*/
|
205 |
-
function get_frame_background( $i, $frame ) {
|
206 |
-
return array( );
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* This is mainly for rendering the frame wrapper
|
211 |
-
*
|
212 |
-
* @param $i
|
213 |
-
* @param $frame
|
214 |
-
*/
|
215 |
-
function render_frame( $i, $frame ){
|
216 |
-
$background = wp_parse_args( $this->get_frame_background( $i, $frame ), array(
|
217 |
-
'color' => false,
|
218 |
-
'image' => false,
|
219 |
-
'image-width' => 0,
|
220 |
-
'image-height' => 0,
|
221 |
-
'opacity' => 1,
|
222 |
-
'url' => false,
|
223 |
-
'new_window' => false,
|
224 |
-
'image-sizing' => 'cover', // options for image sizing are cover and contain
|
225 |
-
'videos' => false,
|
226 |
-
'videos-sizing' => 'background', // options for video sizing are background or full
|
227 |
-
) );
|
228 |
-
|
229 |
-
$wrapper_attributes = array(
|
230 |
-
'class' => array( 'sow-slider-image' ),
|
231 |
-
'style' => array(),
|
232 |
-
);
|
233 |
-
|
234 |
-
if( !empty($background['color']) ) {
|
235 |
-
$wrapper_attributes['style'][] = 'background-color: ' . esc_attr($background['color']);
|
236 |
-
}
|
237 |
-
|
238 |
-
if( $background['opacity'] >= 1 ) {
|
239 |
-
if( !empty($background['image']) ) {
|
240 |
-
$wrapper_attributes['style'][] = 'background-image: url(' . esc_url($background['image']) . ')';
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
-
if( ! empty( $background['url'] ) ) {
|
245 |
-
$wrapper_attributes['style'][] = 'cursor: pointer;';
|
246 |
-
}
|
247 |
-
|
248 |
-
if( !empty($background['image']) && !empty($background['image-sizing']) ) {
|
249 |
-
$wrapper_attributes['class'][] = ' ' . 'sow-slider-image-' . $background['image-sizing'];
|
250 |
-
}
|
251 |
-
if( !empty( $background['url'] ) ) {
|
252 |
-
$wrapper_attributes['data-url'] = json_encode( array(
|
253 |
-
'url' => sow_esc_url($background['url']),
|
254 |
-
'new_window' => !empty( $background['new_window'] )
|
255 |
-
) );
|
256 |
-
}
|
257 |
-
$wrapper_attributes = apply_filters( 'siteorigin_widgets_slider_wrapper_attributes', $wrapper_attributes, $frame, $background );
|
258 |
-
|
259 |
-
$wrapper_attributes['class'] = implode( ' ', $wrapper_attributes['class'] );
|
260 |
-
$wrapper_attributes['style'] = implode( ';', $wrapper_attributes['style'] );
|
261 |
-
|
262 |
-
?>
|
263 |
-
<li <?php foreach( $wrapper_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?>>
|
264 |
-
<?php
|
265 |
-
$this->render_frame_contents( $i, $frame );
|
266 |
-
if( !empty( $background['videos'] ) ) {
|
267 |
-
$this->video_code( $background['videos'], array('sow-' . $background['video-sizing'] . '-element') );
|
268 |
-
}
|
269 |
-
|
270 |
-
if( $background['opacity'] < 1 && !empty($background['image']) ) {
|
271 |
-
$overlay_attributes = array(
|
272 |
-
'class' => array( 'sow-slider-image-overlay', 'sow-slider-image-' . $background['image-sizing'] ),
|
273 |
-
'style' => array(
|
274 |
-
'background-image: url(' . $background['image'] . ')',
|
275 |
-
'opacity: ' . floatval( $background['opacity'] ),
|
276 |
-
)
|
277 |
-
);
|
278 |
-
$overlay_attributes = apply_filters( 'siteorigin_widgets_slider_overlay_attributes', $overlay_attributes, $frame, $background );
|
279 |
-
|
280 |
-
$overlay_attributes['class'] = implode( ' ', $overlay_attributes['class'] );
|
281 |
-
$overlay_attributes['style'] = implode( ';', $overlay_attributes['style'] );
|
282 |
-
|
283 |
-
?><div <?php foreach( $overlay_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?> ></div><?php
|
284 |
-
}
|
285 |
-
|
286 |
-
?>
|
287 |
-
</li>
|
288 |
-
<?php
|
289 |
-
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Render the actual content of the frame.
|
294 |
-
*
|
295 |
-
* @param $i
|
296 |
-
* @param $frame
|
297 |
-
*/
|
298 |
-
abstract function render_frame_contents( $i, $frame );
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Render the background videos
|
302 |
-
*
|
303 |
-
* @param $videos
|
304 |
-
* @param array $classes
|
305 |
-
*/
|
306 |
-
function video_code( $videos, $classes = array() ){
|
307 |
-
if( empty( $videos ) ) return;
|
308 |
-
$video_element = '<video class="' . esc_attr( implode( ',', $classes ) ) . '" autoplay loop muted>';
|
309 |
-
|
310 |
-
foreach( $videos as $video ) {
|
311 |
-
if( empty( $video['file'] ) && empty ( $video['url'] ) ) continue;
|
312 |
-
// If video is an external file, try and display it using oEmbed
|
313 |
-
if( !empty( $video['url'] ) ) {
|
314 |
-
$args = array();
|
315 |
-
if ( ! empty( $video['height'] ) ) {
|
316 |
-
$args['height'] = $video['height'];
|
317 |
-
}
|
318 |
-
$embedded_video = wp_oembed_get( $video['url'], $args );
|
319 |
-
|
320 |
-
// Check if we can oEmbed the video or not
|
321 |
-
if( !$embedded_video ) {
|
322 |
-
$video_file = sow_esc_url( $video['url'] );
|
323 |
-
}else{
|
324 |
-
echo $embedded_video;
|
325 |
-
continue;
|
326 |
-
}
|
327 |
-
}
|
328 |
-
|
329 |
-
// If $video_file isn't set video is a local file
|
330 |
-
if( !isset( $video_file ) ) {
|
331 |
-
$video_file = wp_get_attachment_url( $video['file'] );
|
332 |
-
}
|
333 |
-
$video_element .= '<source src="' . sow_esc_url( $video_file ) . '" type="' . esc_attr( $video['format'] ) . '">';
|
334 |
-
}
|
335 |
-
if ( strpos( $video_element, 'source' ) !== false ) {
|
336 |
-
$video_element .= '</video>';
|
337 |
-
echo $video_element;
|
338 |
-
}
|
339 |
-
}
|
340 |
-
|
341 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Register all the frontend scripts and styles for the base slider.
|
7 |
+
*/
|
8 |
+
function initialize() {
|
9 |
+
|
10 |
+
$frontend_scripts = array();
|
11 |
+
$frontend_scripts[] = array(
|
12 |
+
'sow-slider-slider-cycle2',
|
13 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/jquery.cycle' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
14 |
+
array( 'jquery' ),
|
15 |
+
SOW_BUNDLE_VERSION
|
16 |
+
);
|
17 |
+
if( function_exists('wp_is_mobile') && wp_is_mobile() ) {
|
18 |
+
$frontend_scripts[] = array(
|
19 |
+
'sow-slider-slider-cycle2-swipe',
|
20 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/jquery.cycle.swipe' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
21 |
+
array( 'jquery' ),
|
22 |
+
SOW_BUNDLE_VERSION
|
23 |
+
);
|
24 |
+
}
|
25 |
+
$frontend_scripts[] = array(
|
26 |
+
'sow-slider-slider',
|
27 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/slider/jquery.slider' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
28 |
+
array( 'jquery' ),
|
29 |
+
SOW_BUNDLE_VERSION
|
30 |
+
);
|
31 |
+
|
32 |
+
$this->register_frontend_scripts( $frontend_scripts );
|
33 |
+
$this->register_frontend_styles(
|
34 |
+
array(
|
35 |
+
array(
|
36 |
+
'sow-slider-slider',
|
37 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'css/slider/slider.css',
|
38 |
+
array(),
|
39 |
+
SOW_BUNDLE_VERSION
|
40 |
+
)
|
41 |
+
)
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* The control array required for the slider
|
47 |
+
*
|
48 |
+
* @return array
|
49 |
+
*/
|
50 |
+
function control_form_fields(){
|
51 |
+
return array(
|
52 |
+
'speed' => array(
|
53 |
+
'type' => 'number',
|
54 |
+
'label' => __('Animation speed', 'so-widgets-bundle'),
|
55 |
+
'description' => __('Animation speed in milliseconds.', 'so-widgets-bundle'),
|
56 |
+
'default' => 800,
|
57 |
+
),
|
58 |
+
|
59 |
+
'timeout' => array(
|
60 |
+
'type' => 'number',
|
61 |
+
'label' => __('Timeout', 'so-widgets-bundle'),
|
62 |
+
'description' => __('How long each frame is displayed for in milliseconds.', 'so-widgets-bundle'),
|
63 |
+
'default' => 8000,
|
64 |
+
),
|
65 |
+
|
66 |
+
'nav_color_hex' => array(
|
67 |
+
'type' => 'color',
|
68 |
+
'label' => __('Navigation color', 'so-widgets-bundle'),
|
69 |
+
'default' => '#FFFFFF',
|
70 |
+
),
|
71 |
+
|
72 |
+
'nav_style' => array(
|
73 |
+
'type' => 'select',
|
74 |
+
'label' => __('Navigation style', 'so-widgets-bundle'),
|
75 |
+
'default' => 'thin',
|
76 |
+
'options' => array(
|
77 |
+
'ultra-thin' => __('Ultra thin', 'so-widgets-bundle'),
|
78 |
+
'thin' => __('Thin', 'so-widgets-bundle'),
|
79 |
+
'medium' => __('Medium', 'so-widgets-bundle'),
|
80 |
+
'thick' => __('Thick', 'so-widgets-bundle'),
|
81 |
+
'ultra-thin-rounded' => __('Rounded ultra thin', 'so-widgets-bundle'),
|
82 |
+
'thin-rounded' => __('Rounded thin', 'so-widgets-bundle'),
|
83 |
+
'medium-rounded' => __('Rounded medium', 'so-widgets-bundle'),
|
84 |
+
'thick-rounded' => __('Rounded thick', 'so-widgets-bundle'),
|
85 |
+
)
|
86 |
+
),
|
87 |
+
|
88 |
+
'nav_size' => array(
|
89 |
+
'type' => 'number',
|
90 |
+
'label' => __('Navigation size', 'so-widgets-bundle'),
|
91 |
+
'default' => '25',
|
92 |
+
),
|
93 |
+
|
94 |
+
'swipe' => array(
|
95 |
+
'type' => 'checkbox',
|
96 |
+
'label' => __( 'Swipe Control', 'so-widgets-bundle' ),
|
97 |
+
'description' => __( 'Allow users to swipe through frames on mobile devices.', 'so-widgets-bundle' ),
|
98 |
+
'default' => true,
|
99 |
+
)
|
100 |
+
);
|
101 |
+
}
|
102 |
+
|
103 |
+
function video_form_fields(){
|
104 |
+
return array(
|
105 |
+
'file' => array(
|
106 |
+
'type' => 'media',
|
107 |
+
'library' => 'video',
|
108 |
+
'label' => __('Video file', 'so-widgets-bundle'),
|
109 |
+
),
|
110 |
+
|
111 |
+
'url' => array(
|
112 |
+
'type' => 'text',
|
113 |
+
'sanitize' => 'url',
|
114 |
+
'label' => __('Video URL', 'so-widgets-bundle'),
|
115 |
+
'optional' => 'true',
|
116 |
+
'description' => __('An external URL of the video. Overrides video file.', 'so-widgets-bundle')
|
117 |
+
),
|
118 |
+
|
119 |
+
'format' => array(
|
120 |
+
'type' => 'select',
|
121 |
+
'label' => __('Video format', 'so-widgets-bundle'),
|
122 |
+
'options' => array(
|
123 |
+
'video/mp4' => 'MP4',
|
124 |
+
'video/webm' => 'WebM',
|
125 |
+
'video/ogg' => 'Ogg',
|
126 |
+
),
|
127 |
+
),
|
128 |
+
|
129 |
+
'height' => array(
|
130 |
+
'type' => 'number',
|
131 |
+
'label' => __( 'Maximum height', 'so-widgets-bundle' )
|
132 |
+
),
|
133 |
+
|
134 |
+
);
|
135 |
+
}
|
136 |
+
|
137 |
+
function slider_settings( $controls ){
|
138 |
+
return array(
|
139 |
+
'pagination' => true,
|
140 |
+
'speed' => empty( $controls['speed'] ) ? 1 : $controls['speed'],
|
141 |
+
'timeout' => $controls['timeout'],
|
142 |
+
'swipe' => $controls['swipe'],
|
143 |
+
);
|
144 |
+
}
|
145 |
+
|
146 |
+
function render_template( $controls, $frames ){
|
147 |
+
$this->render_template_part('before_slider', $controls, $frames);
|
148 |
+
$this->render_template_part('before_slides', $controls, $frames);
|
149 |
+
|
150 |
+
foreach( $frames as $i => $frame ) {
|
151 |
+
$this->render_frame( $i, $frame );
|
152 |
+
}
|
153 |
+
|
154 |
+
$this->render_template_part('after_slides', $controls, $frames);
|
155 |
+
$this->render_template_part('navigation', $controls, $frames);
|
156 |
+
$this->render_template_part('after_slider', $controls, $frames);
|
157 |
+
}
|
158 |
+
|
159 |
+
function render_template_part( $part, $controls, $frames ) {
|
160 |
+
switch( $part ) {
|
161 |
+
case 'before_slider':
|
162 |
+
?><div class="sow-slider-base <?php if( wp_is_mobile() ) echo 'sow-slider-is-mobile' ?>" style="display: none"><?php
|
163 |
+
break;
|
164 |
+
case 'before_slides':
|
165 |
+
$settings = $this->slider_settings( $controls );
|
166 |
+
?><ul class="sow-slider-images" data-settings="<?php echo esc_attr( json_encode($settings) ) ?>"><?php
|
167 |
+
break;
|
168 |
+
case 'after_slides':
|
169 |
+
?></ul><?php
|
170 |
+
break;
|
171 |
+
case 'navigation':
|
172 |
+
?>
|
173 |
+
<ol class="sow-slider-pagination">
|
174 |
+
<?php foreach($frames as $i => $frame) : ?>
|
175 |
+
<li><a href="#" data-goto="<?php echo $i ?>"><?php echo $i+1 ?></a></li>
|
176 |
+
<?php endforeach; ?>
|
177 |
+
</ol>
|
178 |
+
|
179 |
+
<div class="sow-slide-nav sow-slide-nav-next">
|
180 |
+
<a href="#" data-goto="next" data-action="next">
|
181 |
+
<em class="sow-sld-icon-<?php echo sanitize_html_class( $controls['nav_style'] ) ?>-right"></em>
|
182 |
+
</a>
|
183 |
+
</div>
|
184 |
+
|
185 |
+
<div class="sow-slide-nav sow-slide-nav-prev">
|
186 |
+
<a href="#" data-goto="previous" data-action="prev">
|
187 |
+
<em class="sow-sld-icon-<?php echo sanitize_html_class( $controls['nav_style'] ) ?>-left"></em>
|
188 |
+
</a>
|
189 |
+
</div>
|
190 |
+
<?php
|
191 |
+
break;
|
192 |
+
case 'after_slider':
|
193 |
+
?></div><?php
|
194 |
+
break;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Get the frame background information from the frame. This can be overwritten by child classes.
|
200 |
+
*
|
201 |
+
* @param $frame
|
202 |
+
*
|
203 |
+
* @return array
|
204 |
+
*/
|
205 |
+
function get_frame_background( $i, $frame ) {
|
206 |
+
return array( );
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* This is mainly for rendering the frame wrapper
|
211 |
+
*
|
212 |
+
* @param $i
|
213 |
+
* @param $frame
|
214 |
+
*/
|
215 |
+
function render_frame( $i, $frame ){
|
216 |
+
$background = wp_parse_args( $this->get_frame_background( $i, $frame ), array(
|
217 |
+
'color' => false,
|
218 |
+
'image' => false,
|
219 |
+
'image-width' => 0,
|
220 |
+
'image-height' => 0,
|
221 |
+
'opacity' => 1,
|
222 |
+
'url' => false,
|
223 |
+
'new_window' => false,
|
224 |
+
'image-sizing' => 'cover', // options for image sizing are cover and contain
|
225 |
+
'videos' => false,
|
226 |
+
'videos-sizing' => 'background', // options for video sizing are background or full
|
227 |
+
) );
|
228 |
+
|
229 |
+
$wrapper_attributes = array(
|
230 |
+
'class' => array( 'sow-slider-image' ),
|
231 |
+
'style' => array(),
|
232 |
+
);
|
233 |
+
|
234 |
+
if( !empty($background['color']) ) {
|
235 |
+
$wrapper_attributes['style'][] = 'background-color: ' . esc_attr($background['color']);
|
236 |
+
}
|
237 |
+
|
238 |
+
if( $background['opacity'] >= 1 ) {
|
239 |
+
if( !empty($background['image']) ) {
|
240 |
+
$wrapper_attributes['style'][] = 'background-image: url(' . esc_url($background['image']) . ')';
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
if( ! empty( $background['url'] ) ) {
|
245 |
+
$wrapper_attributes['style'][] = 'cursor: pointer;';
|
246 |
+
}
|
247 |
+
|
248 |
+
if( !empty($background['image']) && !empty($background['image-sizing']) ) {
|
249 |
+
$wrapper_attributes['class'][] = ' ' . 'sow-slider-image-' . $background['image-sizing'];
|
250 |
+
}
|
251 |
+
if( !empty( $background['url'] ) ) {
|
252 |
+
$wrapper_attributes['data-url'] = json_encode( array(
|
253 |
+
'url' => sow_esc_url($background['url']),
|
254 |
+
'new_window' => !empty( $background['new_window'] )
|
255 |
+
) );
|
256 |
+
}
|
257 |
+
$wrapper_attributes = apply_filters( 'siteorigin_widgets_slider_wrapper_attributes', $wrapper_attributes, $frame, $background );
|
258 |
+
|
259 |
+
$wrapper_attributes['class'] = implode( ' ', $wrapper_attributes['class'] );
|
260 |
+
$wrapper_attributes['style'] = implode( ';', $wrapper_attributes['style'] );
|
261 |
+
|
262 |
+
?>
|
263 |
+
<li <?php foreach( $wrapper_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?>>
|
264 |
+
<?php
|
265 |
+
$this->render_frame_contents( $i, $frame );
|
266 |
+
if( !empty( $background['videos'] ) ) {
|
267 |
+
$this->video_code( $background['videos'], array('sow-' . $background['video-sizing'] . '-element') );
|
268 |
+
}
|
269 |
+
|
270 |
+
if( $background['opacity'] < 1 && !empty($background['image']) ) {
|
271 |
+
$overlay_attributes = array(
|
272 |
+
'class' => array( 'sow-slider-image-overlay', 'sow-slider-image-' . $background['image-sizing'] ),
|
273 |
+
'style' => array(
|
274 |
+
'background-image: url(' . $background['image'] . ')',
|
275 |
+
'opacity: ' . floatval( $background['opacity'] ),
|
276 |
+
)
|
277 |
+
);
|
278 |
+
$overlay_attributes = apply_filters( 'siteorigin_widgets_slider_overlay_attributes', $overlay_attributes, $frame, $background );
|
279 |
+
|
280 |
+
$overlay_attributes['class'] = implode( ' ', $overlay_attributes['class'] );
|
281 |
+
$overlay_attributes['style'] = implode( ';', $overlay_attributes['style'] );
|
282 |
+
|
283 |
+
?><div <?php foreach( $overlay_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?> ></div><?php
|
284 |
+
}
|
285 |
+
|
286 |
+
?>
|
287 |
+
</li>
|
288 |
+
<?php
|
289 |
+
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Render the actual content of the frame.
|
294 |
+
*
|
295 |
+
* @param $i
|
296 |
+
* @param $frame
|
297 |
+
*/
|
298 |
+
abstract function render_frame_contents( $i, $frame );
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Render the background videos
|
302 |
+
*
|
303 |
+
* @param $videos
|
304 |
+
* @param array $classes
|
305 |
+
*/
|
306 |
+
function video_code( $videos, $classes = array() ){
|
307 |
+
if( empty( $videos ) ) return;
|
308 |
+
$video_element = '<video class="' . esc_attr( implode( ',', $classes ) ) . '" autoplay loop muted playsinline>';
|
309 |
+
|
310 |
+
foreach( $videos as $video ) {
|
311 |
+
if( empty( $video['file'] ) && empty ( $video['url'] ) ) continue;
|
312 |
+
// If video is an external file, try and display it using oEmbed
|
313 |
+
if( !empty( $video['url'] ) ) {
|
314 |
+
$args = array();
|
315 |
+
if ( ! empty( $video['height'] ) ) {
|
316 |
+
$args['height'] = $video['height'];
|
317 |
+
}
|
318 |
+
$embedded_video = wp_oembed_get( $video['url'], $args );
|
319 |
+
|
320 |
+
// Check if we can oEmbed the video or not
|
321 |
+
if( !$embedded_video ) {
|
322 |
+
$video_file = sow_esc_url( $video['url'] );
|
323 |
+
}else{
|
324 |
+
echo $embedded_video;
|
325 |
+
continue;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
// If $video_file isn't set video is a local file
|
330 |
+
if( !isset( $video_file ) ) {
|
331 |
+
$video_file = wp_get_attachment_url( $video['file'] );
|
332 |
+
}
|
333 |
+
$video_element .= '<source src="' . sow_esc_url( $video_file ) . '" type="' . esc_attr( $video['format'] ) . '">';
|
334 |
+
}
|
335 |
+
if ( strpos( $video_element, 'source' ) !== false ) {
|
336 |
+
$video_element .= '</video>';
|
337 |
+
echo $video_element;
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
}
|
base/js/admin.js
CHANGED
@@ -1,1303 +1,1292 @@
|
|
1 |
-
/* globals wp, jQuery, _, soWidgets, confirm, tinymce, sowbForms */
|
2 |
-
|
3 |
-
var sowbForms = window.sowbForms || {};
|
4 |
-
|
5 |
-
(function ($) {
|
6 |
-
|
7 |
-
$.fn.sowSetupForm = function () {
|
8 |
-
|
9 |
-
return $(this).each(function (i, el) {
|
10 |
-
var $el = $(el),
|
11 |
-
$mainForm,
|
12 |
-
formId,
|
13 |
-
formInitializing = true;
|
14 |
-
|
15 |
-
var $body = $( 'body' );
|
16 |
-
// Skip this if the widget has any fields with an __i__
|
17 |
-
var $inputs = $el.find('input[name]');
|
18 |
-
if ($inputs.length && $inputs.attr('name').indexOf('__i__') !== -1) {
|
19 |
-
return this;
|
20 |
-
}
|
21 |
-
|
22 |
-
// Skip this if we've already set up the form
|
23 |
-
if ( $el.is('.siteorigin-widget-form-main') ) {
|
24 |
-
if ($el.data('sow-form-setup') === true) {
|
25 |
-
return true;
|
26 |
-
}
|
27 |
-
// If we're in the main widgets interface and the form isn't visible and it isn't contained in a
|
28 |
-
// panels dialog (when using the Layout Builder widget), don't worry about setting it up.
|
29 |
-
if ($body.hasClass('widgets-php') && !$el.is(':visible') && $el.closest('.panel-dialog').length === 0) {
|
30 |
-
return true;
|
31 |
-
}
|
32 |
-
|
33 |
-
// Listen for a state change event if this is the main form wrapper
|
34 |
-
$el.on('sowstatechange', function (e, incomingGroup, incomingState) {
|
35 |
-
|
36 |
-
// Find all wrappers that have state handlers on them
|
37 |
-
$el.find('[data-state-handler]').each(function () {
|
38 |
-
var $$ = $(this);
|
39 |
-
// Create a copy of the current state handlers. Add in initial handlers if the form is initializing.
|
40 |
-
var handler = $.extend({}, $$.data('state-handler'), formInitializing ? $$.data('state-handler-initial') : {});
|
41 |
-
if (Object.keys(handler).length === 0) {
|
42 |
-
return true;
|
43 |
-
}
|
44 |
-
|
45 |
-
// We need to figure out what the incoming state is
|
46 |
-
var handlerStateParts, handlerState, thisHandler, $$f, runHandler, handlerStateNames;
|
47 |
-
|
48 |
-
// Indicates if the handler has run
|
49 |
-
var handlerRun = {};
|
50 |
-
|
51 |
-
var repeaterIndex = sowbForms.getContainerFieldId( $$, 'repeater', '.siteorigin-widget-field-repeater-item' );
|
52 |
-
if (repeaterIndex !== false) {
|
53 |
-
var repeaterHandler = {};
|
54 |
-
for ( var rptrState in handler) {
|
55 |
-
repeaterHandler[rptrState.replace('{$repeater}', repeaterIndex)] = handler[rptrState];
|
56 |
-
}
|
57 |
-
handler = repeaterHandler;
|
58 |
-
}
|
59 |
-
|
60 |
-
var widgetFieldId = sowbForms.getContainerFieldId( $$, 'widget', '.siteorigin-widget-widget' );
|
61 |
-
if ( widgetFieldId !== false ) {
|
62 |
-
var widgetFieldHandler = {};
|
63 |
-
for ( var wdgFldState in handler) {
|
64 |
-
var stMatches = wdgFldState.match( /_else\[(.*)\]|(.*)\[(.*)\]/ );
|
65 |
-
var st = '';
|
66 |
-
if ( stMatches && stMatches.length && stMatches[1] === undefined ) {
|
67 |
-
st = stMatches[ 2 ] + '_' + widgetFieldId + '[' + stMatches[ 3 ] + ']';
|
68 |
-
} else {
|
69 |
-
st = '_else[' + stMatches[ 1 ] + '_' + widgetFieldId + ']';
|
70 |
-
}
|
71 |
-
|
72 |
-
widgetFieldHandler[st] = handler[wdgFldState];
|
73 |
-
}
|
74 |
-
handler = widgetFieldHandler;
|
75 |
-
}
|
76 |
-
|
77 |
-
// Go through all the handlers
|
78 |
-
for (var state in handler) {
|
79 |
-
runHandler = false;
|
80 |
-
|
81 |
-
// Parse the handler state parts
|
82 |
-
handlerStateParts = state.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/);
|
83 |
-
if (handlerStateParts === null) {
|
84 |
-
// Skip this if there's a problem with the state parts
|
85 |
-
continue;
|
86 |
-
}
|
87 |
-
|
88 |
-
handlerState = {
|
89 |
-
'group': 'default',
|
90 |
-
'name': '',
|
91 |
-
'multi': false
|
92 |
-
};
|
93 |
-
|
94 |
-
// Assign the handlerState attributes based on the parsed state
|
95 |
-
if (handlerStateParts[2] !== undefined) {
|
96 |
-
handlerState.group = handlerStateParts[1];
|
97 |
-
handlerState.name = handlerStateParts[3];
|
98 |
-
}
|
99 |
-
else {
|
100 |
-
handlerState.name = handlerStateParts[0];
|
101 |
-
}
|
102 |
-
handlerState.multi = (handlerStateParts[4] !== undefined);
|
103 |
-
|
104 |
-
if (handlerState.group === '_else') {
|
105 |
-
// This is the special case of an group else handler
|
106 |
-
// Always run if no handlers from the current group have been run yet
|
107 |
-
handlerState.group = handlerState.name;
|
108 |
-
handlerState.name = '';
|
109 |
-
|
110 |
-
// We will run this handler because none have run for it yet
|
111 |
-
runHandler = ( handlerState.group === incomingGroup && typeof handlerRun[handlerState.group] === 'undefined' );
|
112 |
-
}
|
113 |
-
else {
|
114 |
-
// Evaluate if we're in the current state
|
115 |
-
handlerStateNames = handlerState.name.split(',').map(function (a) {
|
116 |
-
return a.trim()
|
117 |
-
});
|
118 |
-
for (var i = 0; i < handlerStateNames.length; i++) {
|
119 |
-
runHandler = (handlerState.group === incomingGroup && handlerStateNames[i] === incomingState);
|
120 |
-
if (runHandler) break;
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
// Run the handler if previous checks have determined we should
|
125 |
-
if (runHandler) {
|
126 |
-
thisHandler = handler[state];
|
127 |
-
|
128 |
-
// Now we can handle the the handler
|
129 |
-
if (!handlerState.multi) {
|
130 |
-
thisHandler = [thisHandler];
|
131 |
-
}
|
132 |
-
|
133 |
-
for (var i = 0; i < thisHandler.length; i++) {
|
134 |
-
// Choose the item we'll be acting on here
|
135 |
-
if (typeof thisHandler[i][1] !== 'undefined' && Boolean(thisHandler[i][1])) {
|
136 |
-
// thisHandler[i][1] is the sub selector
|
137 |
-
$$f = $$.find(thisHandler[i][1]);
|
138 |
-
}
|
139 |
-
else {
|
140 |
-
$$f = $$;
|
141 |
-
}
|
142 |
-
|
143 |
-
// Call the function on the wrapper we've selected
|
144 |
-
$$f[thisHandler[i][0]].apply($$f, typeof thisHandler[i][2] !== 'undefined' ? thisHandler[i][2] : []);
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
-
// Store that we've run a handler
|
149 |
-
handlerRun[handlerState.group] = true;
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
});
|
154 |
-
});
|
155 |
-
|
156 |
-
// Lets set up the preview
|
157 |
-
$el.sowSetupPreview();
|
158 |
-
$mainForm = $el;
|
159 |
-
|
160 |
-
var $teaser = $el.find('.siteorigin-widget-teaser');
|
161 |
-
$teaser.find('.dashicons-dismiss').click(function () {
|
162 |
-
var $$ = $(this);
|
163 |
-
$.get($$.data('dismiss-url'));
|
164 |
-
|
165 |
-
$teaser.slideUp('normal', function () {
|
166 |
-
$teaser.remove();
|
167 |
-
});
|
168 |
-
});
|
169 |
-
|
170 |
-
var _sow_form_id = $el.find( '> .siteorigin-widgets-form-id' ).val();
|
171 |
-
var $timestampField = $el.find( '> .siteorigin-widgets-form-timestamp' );
|
172 |
-
var _sow_form_timestamp = parseInt( $timestampField.val() || 0 );
|
173 |
-
var data = JSON.parse( sessionStorage.getItem( _sow_form_id ) );
|
174 |
-
if ( data ) {
|
175 |
-
if ( data['_sow_form_timestamp'] > _sow_form_timestamp ) {
|
176 |
-
var $newerNotification = $( '<div class="siteorigin-widget-form-notification">' +
|
177 |
-
'<span>' + soWidgets.backup.newerVersion + '</span>' +
|
178 |
-
'<a class="button button-small so-backup-restore">' + soWidgets.backup.restore + '</a>' +
|
179 |
-
'<a class="button button-small so-backup-dismiss">' + soWidgets.backup.dismiss + '</a>' +
|
180 |
-
'<div><small>' + soWidgets.backup.replaceWarning + '</small></div>' +
|
181 |
-
'</div>' );
|
182 |
-
$el.prepend( $newerNotification );
|
183 |
-
|
184 |
-
$newerNotification.find( '.so-backup-restore' ).click( function () {
|
185 |
-
sowbForms.setWidgetFormValues( $mainForm, data );
|
186 |
-
$newerNotification.slideUp( 'fast', function () {
|
187 |
-
$newerNotification.remove();
|
188 |
-
} );
|
189 |
-
} );
|
190 |
-
$newerNotification.find( '.so-backup-dismiss' ).click( function () {
|
191 |
-
$newerNotification.slideUp( 'fast', function () {
|
192 |
-
sessionStorage.removeItem( _sow_form_id );
|
193 |
-
$newerNotification.remove();
|
194 |
-
} );
|
195 |
-
} );
|
196 |
-
} else {
|
197 |
-
sessionStorage.removeItem( _sow_form_id );
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
$el.change( function () {
|
202 |
-
$timestampField.val( new Date().getTime() );
|
203 |
-
var data = sowbForms.getWidgetFormValues( $el );
|
204 |
-
sessionStorage.setItem( _sow_form_id, JSON.stringify( data ) );
|
205 |
-
} );
|
206 |
-
}
|
207 |
-
else {
|
208 |
-
$mainForm = $el.closest('.siteorigin-widget-form-main');
|
209 |
-
}
|
210 |
-
formId = $mainForm.find('> .siteorigin-widgets-form-id').val();
|
211 |
-
|
212 |
-
// Find any field or sub widget fields.
|
213 |
-
var $fields = $el.find('> .siteorigin-widget-field');
|
214 |
-
|
215 |
-
// Process any sub sections
|
216 |
-
$fields.find('> .siteorigin-widget-section').sowSetupForm();
|
217 |
-
|
218 |
-
var $subwidgetFields = $fields.find('> .siteorigin-widget-widget');
|
219 |
-
$subwidgetFields.find('> .siteorigin-widget-section').sowSetupForm();
|
220 |
-
|
221 |
-
// Process any sub widgets whose fields aren't contained in a section
|
222 |
-
$subwidgetFields.filter(':not(:has(> .siteorigin-widget-section))').sowSetupForm();
|
223 |
-
|
224 |
-
// Store the field names
|
225 |
-
$fields.find('.siteorigin-widget-input').each(function (i, input) {
|
226 |
-
if ($(input).data('original-name') === null) {
|
227 |
-
$(input).data('original-name', $(input).attr('name'));
|
228 |
-
}
|
229 |
-
});
|
230 |
-
|
231 |
-
// Setup all the repeaters
|
232 |
-
$fields.find('> .siteorigin-widget-field-repeater').sowSetupRepeater();
|
233 |
-
|
234 |
-
// For any repeater items currently in existence
|
235 |
-
$el.find('.siteorigin-widget-field-repeater-item').sowSetupRepeaterItems();
|
236 |
-
|
237 |
-
// Set up any color fields
|
238 |
-
$fields.find('> .siteorigin-widget-input-color').each(function () {
|
239 |
-
var colorField = $(this);
|
240 |
-
var colorFieldOptions = {
|
241 |
-
change: function (event, ui) {
|
242 |
-
setTimeout(function () {
|
243 |
-
$(event.target).trigger('change');
|
244 |
-
}, 100);
|
245 |
-
}
|
246 |
-
};
|
247 |
-
if (colorField.data('defaultColor')) {
|
248 |
-
colorFieldOptions.defaultColor = colorField.data('defaultColor');
|
249 |
-
}
|
250 |
-
colorField.wpColorPicker(colorFieldOptions);
|
251 |
-
});
|
252 |
-
|
253 |
-
///////////////////////////////////////
|
254 |
-
// Handle the sections
|
255 |
-
var expandContainer = function () {
|
256 |
-
$(this).toggleClass('siteorigin-widget-section-visible');
|
257 |
-
$(this).parent().find('> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section')
|
258 |
-
.slideToggle('fast', function () {
|
259 |
-
$(window).resize();
|
260 |
-
$(this).find('> .siteorigin-widget-field-container-state').val($(this).is(':visible') ? 'open' : 'closed');
|
261 |
-
|
262 |
-
if ( $( this ).is( ':visible' ) ) {
|
263 |
-
var $fields = $( this ).find( '> .siteorigin-widget-field' );
|
264 |
-
$fields.trigger( 'sowsetupformfield' );
|
265 |
-
}
|
266 |
-
} );
|
267 |
-
};
|
268 |
-
$fields.filter('.siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section').find('> label').click(expandContainer);
|
269 |
-
$fields.filter('.siteorigin-widget-field-type-posts').find('.posts-container-label-wrapper').click(expandContainer);
|
270 |
-
|
271 |
-
///////////////////////////////////////
|
272 |
-
// Handle the slider fields
|
273 |
-
|
274 |
-
$fields.filter('.siteorigin-widget-field-type-slider').each(function () {
|
275 |
-
var $$ = $(this);
|
276 |
-
var $input = $$.find('input[type="number"]');
|
277 |
-
var $c = $$.find('.siteorigin-widget-value-slider');
|
278 |
-
|
279 |
-
$c.slider({
|
280 |
-
max: parseFloat($input.attr('max')),
|
281 |
-
min: parseFloat($input.attr('min')),
|
282 |
-
step: parseFloat($input.attr('step')),
|
283 |
-
value: parseFloat($input.val()),
|
284 |
-
slide: function (event, ui) {
|
285 |
-
$input.val( parseFloat( ui.value ) );
|
286 |
-
$input.trigger( 'change' );
|
287 |
-
},
|
288 |
-
change: function( event, ui ) {
|
289 |
-
$$.find('.siteorigin-widget-slider-value').html(ui.value);
|
290 |
-
},
|
291 |
-
});
|
292 |
-
$input.change(function(event, data) {
|
293 |
-
if ( ! ( data && data.silent ) ) {
|
294 |
-
$c.slider( 'value', parseFloat( $input.val() ) );
|
295 |
-
}
|
296 |
-
});
|
297 |
-
});
|
298 |
-
|
299 |
-
///////////////////////////////////////
|
300 |
-
// Setup the URL fields
|
301 |
-
|
302 |
-
$fields.filter('.siteorigin-widget-field-type-link').each(function () {
|
303 |
-
var $$ = $(this);
|
304 |
-
|
305 |
-
// Function that refreshes the list of
|
306 |
-
var request = null;
|
307 |
-
var refreshList = function () {
|
308 |
-
if (request !== null) {
|
309 |
-
request.abort();
|
310 |
-
}
|
311 |
-
|
312 |
-
var $contentSearchInput = $$.find('.content-text-search');
|
313 |
-
var query = $contentSearchInput.val();
|
314 |
-
var postTypes = $contentSearchInput.data('postTypes');
|
315 |
-
|
316 |
-
var $ul = $$.find('ul.posts').empty().addClass('loading');
|
317 |
-
$.get(
|
318 |
-
soWidgets.ajaxurl,
|
319 |
-
{action: 'so_widgets_search_posts', query: query, postTypes: postTypes},
|
320 |
-
function (data) {
|
321 |
-
for (var i = 0; i < data.length; i++) {
|
322 |
-
if (data[i].label === '') {
|
323 |
-
data[i].label = ' ';
|
324 |
-
}
|
325 |
-
|
326 |
-
// Add all the post items
|
327 |
-
$ul.append(
|
328 |
-
$('<li>')
|
329 |
-
.addClass('post')
|
330 |
-
.html(data[i].label + '<span>(' + data[i].type + ')</span>')
|
331 |
-
.data(data[i])
|
332 |
-
);
|
333 |
-
}
|
334 |
-
$ul.removeClass('loading');
|
335 |
-
}
|
336 |
-
);
|
337 |
-
};
|
338 |
-
|
339 |
-
// Toggle display of the existing content
|
340 |
-
$$.find('.select-content-button, .button-close').click(function (e) {
|
341 |
-
e.preventDefault();
|
342 |
-
|
343 |
-
$(this).blur();
|
344 |
-
var $s = $$.find('.existing-content-selector');
|
345 |
-
$s.toggle();
|
346 |
-
|
347 |
-
if ($s.is(':visible') && $s.find('ul.posts li').length === 0) {
|
348 |
-
refreshList();
|
349 |
-
}
|
350 |
-
|
351 |
-
});
|
352 |
-
|
353 |
-
// Clicking on one of the url items
|
354 |
-
$$.on('click', '.posts li', function (e) {
|
355 |
-
e.preventDefault();
|
356 |
-
var $li = $(this);
|
357 |
-
$$.find('input.siteorigin-widget-input').val('post: ' + $li.data('value'));
|
358 |
-
$$.find('.existing-content-selector').toggle();
|
359 |
-
});
|
360 |
-
|
361 |
-
var interval = null;
|
362 |
-
$$.find('.content-text-search').keyup(function () {
|
363 |
-
if (interval !== null) {
|
364 |
-
clearTimeout(interval);
|
365 |
-
}
|
366 |
-
|
367 |
-
interval = setTimeout(function () {
|
368 |
-
refreshList();
|
369 |
-
}, 500);
|
370 |
-
});
|
371 |
-
});
|
372 |
-
|
373 |
-
///////////////////////////////////////
|
374 |
-
// Setup the Builder fields
|
375 |
-
if (typeof jQuery.fn.soPanelsSetupBuilderWidget !== 'undefined') {
|
376 |
-
$fields.filter('.siteorigin-widget-field-type-builder').each(function () {
|
377 |
-
$( this ).find( '> .siteorigin-page-builder-field' ).each( function () {
|
378 |
-
var $$ = $( this );
|
379 |
-
$$.soPanelsSetupBuilderWidget( { builderType: $$.data( 'type' ) } );
|
380 |
-
} );
|
381 |
-
});
|
382 |
-
}
|
383 |
-
|
384 |
-
///////////////////////////////////////
|
385 |
-
// Now lets handle the state emitters
|
386 |
-
|
387 |
-
var stateEmitterChangeHandler = function () {
|
388 |
-
var $$ = $(this);
|
389 |
-
|
390 |
-
// These emitters can either be an array or a
|
391 |
-
var emitters = $$.closest('[data-state-emitter]').data('state-emitter');
|
392 |
-
|
393 |
-
if (typeof emitters !== 'undefined') {
|
394 |
-
var handleStateEmitter = function (emitter, currentStates) {
|
395 |
-
if (typeof sowEmitters[emitter.callback] === 'undefined' || emitter.callback.substr(0, 1) === '_') {
|
396 |
-
// Skip if the function doesn't exist, or it starts with an underscore (internal functions).
|
397 |
-
return currentStates;
|
398 |
-
}
|
399 |
-
|
400 |
-
// Check if this is inside a repeater
|
401 |
-
var repeaterIndex = sowbForms.getContainerFieldId( $$, 'repeater', '.siteorigin-widget-field-repeater-item' );
|
402 |
-
if (repeaterIndex !== false) {
|
403 |
-
emitter.args = emitter.args.map(function (a) {
|
404 |
-
return a.replace('{$repeater}', repeaterIndex);
|
405 |
-
});
|
406 |
-
}
|
407 |
-
|
408 |
-
var widgetFieldId = sowbForms.getContainerFieldId( $$, 'widget', '.siteorigin-widget-widget' );
|
409 |
-
if ( widgetFieldId !== false && ! emitter.hasOwnProperty( 'widgetFieldId' ) ) {
|
410 |
-
emitter.widgetFieldId = widgetFieldId;
|
411 |
-
emitter.args = emitter.args.map(function (arg) {
|
412 |
-
return arg + '_' + widgetFieldId;
|
413 |
-
});
|
414 |
-
}
|
415 |
-
|
416 |
-
var val = $$.is('[type="checkbox"]') ? $$.is(':checked') : $$.val();
|
417 |
-
// Return an array that has the new states added to the array
|
418 |
-
return $.extend(currentStates, sowEmitters[emitter.callback](val, emitter.args));
|
419 |
-
};
|
420 |
-
|
421 |
-
// Run the states through the state emitters
|
422 |
-
var states = {'default': ''};
|
423 |
-
|
424 |
-
// Go through the array of emitters
|
425 |
-
if (typeof emitters.length === 'undefined') {
|
426 |
-
emitters = [emitters];
|
427 |
-
}
|
428 |
-
|
429 |
-
for (var i = 0; i < emitters.length; i++) {
|
430 |
-
states = handleStateEmitter(emitters[i], states);
|
431 |
-
}
|
432 |
-
|
433 |
-
// Check which states have changed and trigger appropriate sowstatechange
|
434 |
-
var formStates = $mainForm.data('states');
|
435 |
-
if (typeof formStates === 'undefined') {
|
436 |
-
formStates = {'default': ''};
|
437 |
-
}
|
438 |
-
for (var k in states) {
|
439 |
-
if (typeof formStates[k] === 'undefined' || states[k] !== formStates[k]) {
|
440 |
-
// If the state is different from the original formStates, then trigger a state change
|
441 |
-
formStates[k] = states[k];
|
442 |
-
$mainForm.trigger('sowstatechange', [k, states[k]]);
|
443 |
-
}
|
444 |
-
}
|
445 |
-
|
446 |
-
// Store the form states back in the form
|
447 |
-
$mainForm.data('states', formStates);
|
448 |
-
}
|
449 |
-
};
|
450 |
-
|
451 |
-
$fields.filter('[data-state-emitter]').each(function () {
|
452 |
-
|
453 |
-
// Listen for any change events on an emitter field
|
454 |
-
$(this).find('.siteorigin-widget-input').on('keyup change', stateEmitterChangeHandler);
|
455 |
-
|
456 |
-
// Trigger initial state emitter changes
|
457 |
-
$(this).find('.siteorigin-widget-input').each(function () {
|
458 |
-
var $$ = $(this);
|
459 |
-
if ($$.is(':radio')) {
|
460 |
-
// Only checked radio inputs must have change events
|
461 |
-
if ($$.is(':checked')) {
|
462 |
-
stateEmitterChangeHandler.call($$[0]);
|
463 |
-
}
|
464 |
-
}
|
465 |
-
else {
|
466 |
-
stateEmitterChangeHandler.call($$[0]);
|
467 |
-
}
|
468 |
-
});
|
469 |
-
|
470 |
-
});
|
471 |
-
|
472 |
-
// Give plugins a chance to influence the form
|
473 |
-
$el.trigger('sowsetupform', $fields).data('sow-form-setup', true);
|
474 |
-
|
475 |
-
$fields.trigger('sowsetupformfield');
|
476 |
-
|
477 |
-
$el.find('.siteorigin-widget-field-repeater-item').trigger('updateFieldPositions');
|
478 |
-
|
479 |
-
if ( $body.hasClass( 'wp-customizer' ) || $body.hasClass( 'widgets-php' ) ) {
|
480 |
-
// Reinitialize widget fields when they're dragged and dropped.
|
481 |
-
$el.closest( '.ui-sortable' ).on( 'sortstop', function (event, ui) {
|
482 |
-
var $fields = ui.item.find( '.siteorigin-widget-form' ).find( '> .siteorigin-widget-field' );
|
483 |
-
$fields.trigger( 'sowsetupformfield' );
|
484 |
-
} );
|
485 |
-
}
|
486 |
-
|
487 |
-
/////////////////////////////
|
488 |
-
// The end of the form setup.
|
489 |
-
/////////////////////////////
|
490 |
-
|
491 |
-
formInitializing = false;
|
492 |
-
});
|
493 |
-
};
|
494 |
-
|
495 |
-
$.fn.sowSetupPreview = function () {
|
496 |
-
var $el = $(this);
|
497 |
-
var previewButton = $el.siblings('.siteorigin-widget-preview');
|
498 |
-
|
499 |
-
previewButton.find('> a').click(function (e) {
|
500 |
-
e.preventDefault();
|
501 |
-
|
502 |
-
var data = sowbForms.getWidgetFormValues($el);
|
503 |
-
|
504 |
-
// Create a new modal window
|
505 |
-
var modal = $($('#so-widgets-bundle-tpl-preview-dialog').html().trim()).appendTo('body');
|
506 |
-
modal.find('input[name="data"]').val(JSON.stringify(data));
|
507 |
-
modal.find('input[name="class"]').val($el.data('class'));
|
508 |
-
modal.find('iframe').on('load', function () {
|
509 |
-
$(this).css('visibility', 'visible');
|
510 |
-
});
|
511 |
-
modal.find('form').submit();
|
512 |
-
|
513 |
-
modal.find('.close').click(function () {
|
514 |
-
modal.remove();
|
515 |
-
});
|
516 |
-
});
|
517 |
-
};
|
518 |
-
|
519 |
-
$.fn.sowSetupRepeater = function () {
|
520 |
-
|
521 |
-
return $(this).each(function (i, el) {
|
522 |
-
var $el = $(el);
|
523 |
-
var $items = $el.find('.siteorigin-widget-field-repeater-items');
|
524 |
-
var name = $el.data('repeater-name');
|
525 |
-
|
526 |
-
$items.bind('updateFieldPositions', function () {
|
527 |
-
var $$ = $(this);
|
528 |
-
var $rptrItems = $$.find('> .siteorigin-widget-field-repeater-item');
|
529 |
-
|
530 |
-
// Set the position for the repeater items
|
531 |
-
$rptrItems.each(function (i, el) {
|
532 |
-
$(el).find('.siteorigin-widget-input').each(function (j, input) {
|
533 |
-
var pos = $(input).data('repeater-positions');
|
534 |
-
if (typeof pos === 'undefined') {
|
535 |
-
pos = {};
|
536 |
-
}
|
537 |
-
|
538 |
-
pos[name] = i;
|
539 |
-
$(input).data('repeater-positions', pos);
|
540 |
-
});
|
541 |
-
});
|
542 |
-
|
543 |
-
// Update the field names for all the input items
|
544 |
-
$$.find('.siteorigin-widget-input').each(function (i, input) {
|
545 |
-
var $in = $(input);
|
546 |
-
var pos = $in.data('repeater-positions');
|
547 |
-
|
548 |
-
if (typeof pos !== 'undefined') {
|
549 |
-
var newName = $in.attr('data-original-name');
|
550 |
-
|
551 |
-
if (!newName) {
|
552 |
-
$in.attr('data-original-name', $in.attr('name'));
|
553 |
-
newName = $in.attr('name');
|
554 |
-
}
|
555 |
-
if (!newName) {
|
556 |
-
return;
|
557 |
-
}
|
558 |
-
|
559 |
-
if (pos) {
|
560 |
-
for (var k in pos) {
|
561 |
-
newName = newName.replace('#' + k + '#', pos[k]);
|
562 |
-
}
|
563 |
-
}
|
564 |
-
$in.attr('name', newName);
|
565 |
-
}
|
566 |
-
});
|
567 |
-
|
568 |
-
if (!$$.data('initialSetup')) {
|
569 |
-
// Setup default checked values, now that we've updated input names.
|
570 |
-
// Without this radio inputs in repeaters will be rendered as if they all belong to the same group.
|
571 |
-
$$.find('.siteorigin-widget-input').each(function (i, input) {
|
572 |
-
var $in = $(input);
|
573 |
-
$in.prop('checked', $in.prop('defaultChecked'));
|
574 |
-
});
|
575 |
-
$$.data('initialSetup', true);
|
576 |
-
}
|
577 |
-
|
578 |
-
//Setup scrolling.
|
579 |
-
var scrollCount = $el.data('scroll-count') ? parseInt($el.data('scroll-count')) : 0;
|
580 |
-
if (scrollCount > 0 && $rptrItems.length > scrollCount) {
|
581 |
-
var itemHeight = $rptrItems.first().outerHeight();
|
582 |
-
$$.css('max-height', itemHeight * scrollCount).css('overflow', 'auto');
|
583 |
-
}
|
584 |
-
else {
|
585 |
-
//TODO: Check whether there was a value before overriding and set it back to that.
|
586 |
-
$$.css('max-height', '').css('overflow', '');
|
587 |
-
}
|
588 |
-
});
|
589 |
-
|
590 |
-
$items.sortable({
|
591 |
-
handle: '.siteorigin-widget-field-repeater-item-top',
|
592 |
-
items: '> .siteorigin-widget-field-repeater-item',
|
593 |
-
update: function () {
|
594 |
-
// Clear `name` attributes for radio inputs. They'll be reassigned on update.
|
595 |
-
// This prevents some radio inputs values being cleared during the update process.
|
596 |
-
$items.find( 'input[type="radio"].siteorigin-widget-input' ).attr( 'name', '' );
|
597 |
-
$items.trigger('updateFieldPositions');
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
$fields.
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
$fields.
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
$
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
var
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
item
|
672 |
-
item.
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
$itemsContainer
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
e.
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
$
|
723 |
-
|
724 |
-
|
725 |
-
$
|
726 |
-
}
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
}
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
var $
|
753 |
-
var
|
754 |
-
|
755 |
-
$
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
.
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
var
|
839 |
-
$
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
$copyItem
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
*
|
867 |
-
*
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
var
|
876 |
-
if (
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
*
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
var
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
name
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
if (
|
986 |
-
fieldValue =
|
987 |
-
}
|
988 |
-
else {
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
}
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
var
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
if ( !
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
return
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
*
|
1278 |
-
*
|
1279 |
-
* @
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
})
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
*/
|
1294 |
-
'in': function (val, args) {
|
1295 |
-
return sowEmitters._checker(val, args, '[^;{}]*', function (val, args, match) {
|
1296 |
-
return match.split(',').map(function (s) {
|
1297 |
-
return s.trim();
|
1298 |
-
}).indexOf(val) !== -1;
|
1299 |
-
});
|
1300 |
-
}
|
1301 |
-
};
|
1302 |
-
|
1303 |
-
window.sowbForms = sowbForms;
|
1 |
+
/* globals wp, jQuery, _, soWidgets, confirm, tinymce, sowbForms */
|
2 |
+
|
3 |
+
var sowbForms = window.sowbForms || {};
|
4 |
+
|
5 |
+
(function ($) {
|
6 |
+
|
7 |
+
$.fn.sowSetupForm = function () {
|
8 |
+
|
9 |
+
return $(this).each(function (i, el) {
|
10 |
+
var $el = $(el),
|
11 |
+
$mainForm,
|
12 |
+
formId,
|
13 |
+
formInitializing = true;
|
14 |
+
|
15 |
+
var $body = $( 'body' );
|
16 |
+
// Skip this if the widget has any fields with an __i__
|
17 |
+
var $inputs = $el.find('input[name]');
|
18 |
+
if ($inputs.length && $inputs.attr('name').indexOf('__i__') !== -1) {
|
19 |
+
return this;
|
20 |
+
}
|
21 |
+
|
22 |
+
// Skip this if we've already set up the form
|
23 |
+
if ( $el.is('.siteorigin-widget-form-main') ) {
|
24 |
+
if ($el.data('sow-form-setup') === true) {
|
25 |
+
return true;
|
26 |
+
}
|
27 |
+
// If we're in the main widgets interface and the form isn't visible and it isn't contained in a
|
28 |
+
// panels dialog (when using the Layout Builder widget), don't worry about setting it up.
|
29 |
+
if ($body.hasClass('widgets-php') && !$el.is(':visible') && $el.closest('.panel-dialog').length === 0) {
|
30 |
+
return true;
|
31 |
+
}
|
32 |
+
|
33 |
+
// Listen for a state change event if this is the main form wrapper
|
34 |
+
$el.on('sowstatechange', function (e, incomingGroup, incomingState) {
|
35 |
+
|
36 |
+
// Find all wrappers that have state handlers on them
|
37 |
+
$el.find('[data-state-handler]').each(function () {
|
38 |
+
var $$ = $(this);
|
39 |
+
// Create a copy of the current state handlers. Add in initial handlers if the form is initializing.
|
40 |
+
var handler = $.extend({}, $$.data('state-handler'), formInitializing ? $$.data('state-handler-initial') : {});
|
41 |
+
if (Object.keys(handler).length === 0) {
|
42 |
+
return true;
|
43 |
+
}
|
44 |
+
|
45 |
+
// We need to figure out what the incoming state is
|
46 |
+
var handlerStateParts, handlerState, thisHandler, $$f, runHandler, handlerStateNames;
|
47 |
+
|
48 |
+
// Indicates if the handler has run
|
49 |
+
var handlerRun = {};
|
50 |
+
|
51 |
+
var repeaterIndex = sowbForms.getContainerFieldId( $$, 'repeater', '.siteorigin-widget-field-repeater-item' );
|
52 |
+
if (repeaterIndex !== false) {
|
53 |
+
var repeaterHandler = {};
|
54 |
+
for ( var rptrState in handler) {
|
55 |
+
repeaterHandler[rptrState.replace('{$repeater}', repeaterIndex)] = handler[rptrState];
|
56 |
+
}
|
57 |
+
handler = repeaterHandler;
|
58 |
+
}
|
59 |
+
|
60 |
+
var widgetFieldId = sowbForms.getContainerFieldId( $$, 'widget', '.siteorigin-widget-widget' );
|
61 |
+
if ( widgetFieldId !== false ) {
|
62 |
+
var widgetFieldHandler = {};
|
63 |
+
for ( var wdgFldState in handler) {
|
64 |
+
var stMatches = wdgFldState.match( /_else\[(.*)\]|(.*)\[(.*)\]/ );
|
65 |
+
var st = '';
|
66 |
+
if ( stMatches && stMatches.length && stMatches[1] === undefined ) {
|
67 |
+
st = stMatches[ 2 ] + '_' + widgetFieldId + '[' + stMatches[ 3 ] + ']';
|
68 |
+
} else {
|
69 |
+
st = '_else[' + stMatches[ 1 ] + '_' + widgetFieldId + ']';
|
70 |
+
}
|
71 |
+
|
72 |
+
widgetFieldHandler[st] = handler[wdgFldState];
|
73 |
+
}
|
74 |
+
handler = widgetFieldHandler;
|
75 |
+
}
|
76 |
+
|
77 |
+
// Go through all the handlers
|
78 |
+
for (var state in handler) {
|
79 |
+
runHandler = false;
|
80 |
+
|
81 |
+
// Parse the handler state parts
|
82 |
+
handlerStateParts = state.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/);
|
83 |
+
if (handlerStateParts === null) {
|
84 |
+
// Skip this if there's a problem with the state parts
|
85 |
+
continue;
|
86 |
+
}
|
87 |
+
|
88 |
+
handlerState = {
|
89 |
+
'group': 'default',
|
90 |
+
'name': '',
|
91 |
+
'multi': false
|
92 |
+
};
|
93 |
+
|
94 |
+
// Assign the handlerState attributes based on the parsed state
|
95 |
+
if (handlerStateParts[2] !== undefined) {
|
96 |
+
handlerState.group = handlerStateParts[1];
|
97 |
+
handlerState.name = handlerStateParts[3];
|
98 |
+
}
|
99 |
+
else {
|
100 |
+
handlerState.name = handlerStateParts[0];
|
101 |
+
}
|
102 |
+
handlerState.multi = (handlerStateParts[4] !== undefined);
|
103 |
+
|
104 |
+
if (handlerState.group === '_else') {
|
105 |
+
// This is the special case of an group else handler
|
106 |
+
// Always run if no handlers from the current group have been run yet
|
107 |
+
handlerState.group = handlerState.name;
|
108 |
+
handlerState.name = '';
|
109 |
+
|
110 |
+
// We will run this handler because none have run for it yet
|
111 |
+
runHandler = ( handlerState.group === incomingGroup && typeof handlerRun[handlerState.group] === 'undefined' );
|
112 |
+
}
|
113 |
+
else {
|
114 |
+
// Evaluate if we're in the current state
|
115 |
+
handlerStateNames = handlerState.name.split(',').map(function (a) {
|
116 |
+
return a.trim()
|
117 |
+
});
|
118 |
+
for (var i = 0; i < handlerStateNames.length; i++) {
|
119 |
+
runHandler = (handlerState.group === incomingGroup && handlerStateNames[i] === incomingState);
|
120 |
+
if (runHandler) break;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
// Run the handler if previous checks have determined we should
|
125 |
+
if (runHandler) {
|
126 |
+
thisHandler = handler[state];
|
127 |
+
|
128 |
+
// Now we can handle the the handler
|
129 |
+
if (!handlerState.multi) {
|
130 |
+
thisHandler = [thisHandler];
|
131 |
+
}
|
132 |
+
|
133 |
+
for (var i = 0; i < thisHandler.length; i++) {
|
134 |
+
// Choose the item we'll be acting on here
|
135 |
+
if (typeof thisHandler[i][1] !== 'undefined' && Boolean(thisHandler[i][1])) {
|
136 |
+
// thisHandler[i][1] is the sub selector
|
137 |
+
$$f = $$.find(thisHandler[i][1]);
|
138 |
+
}
|
139 |
+
else {
|
140 |
+
$$f = $$;
|
141 |
+
}
|
142 |
+
|
143 |
+
// Call the function on the wrapper we've selected
|
144 |
+
$$f[thisHandler[i][0]].apply($$f, typeof thisHandler[i][2] !== 'undefined' ? thisHandler[i][2] : []);
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
// Store that we've run a handler
|
149 |
+
handlerRun[handlerState.group] = true;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
});
|
154 |
+
});
|
155 |
+
|
156 |
+
// Lets set up the preview
|
157 |
+
$el.sowSetupPreview();
|
158 |
+
$mainForm = $el;
|
159 |
+
|
160 |
+
var $teaser = $el.find('.siteorigin-widget-teaser');
|
161 |
+
$teaser.find('.dashicons-dismiss').click(function () {
|
162 |
+
var $$ = $(this);
|
163 |
+
$.get($$.data('dismiss-url'));
|
164 |
+
|
165 |
+
$teaser.slideUp('normal', function () {
|
166 |
+
$teaser.remove();
|
167 |
+
});
|
168 |
+
});
|
169 |
+
|
170 |
+
var _sow_form_id = $el.find( '> .siteorigin-widgets-form-id' ).val();
|
171 |
+
var $timestampField = $el.find( '> .siteorigin-widgets-form-timestamp' );
|
172 |
+
var _sow_form_timestamp = parseInt( $timestampField.val() || 0 );
|
173 |
+
var data = JSON.parse( sessionStorage.getItem( _sow_form_id ) );
|
174 |
+
if ( data ) {
|
175 |
+
if ( data['_sow_form_timestamp'] > _sow_form_timestamp ) {
|
176 |
+
var $newerNotification = $( '<div class="siteorigin-widget-form-notification">' +
|
177 |
+
'<span>' + soWidgets.backup.newerVersion + '</span>' +
|
178 |
+
'<a class="button button-small so-backup-restore">' + soWidgets.backup.restore + '</a>' +
|
179 |
+
'<a class="button button-small so-backup-dismiss">' + soWidgets.backup.dismiss + '</a>' +
|
180 |
+
'<div><small>' + soWidgets.backup.replaceWarning + '</small></div>' +
|
181 |
+
'</div>' );
|
182 |
+
$el.prepend( $newerNotification );
|
183 |
+
|
184 |
+
$newerNotification.find( '.so-backup-restore' ).click( function () {
|
185 |
+
sowbForms.setWidgetFormValues( $mainForm, data );
|
186 |
+
$newerNotification.slideUp( 'fast', function () {
|
187 |
+
$newerNotification.remove();
|
188 |
+
} );
|
189 |
+
} );
|
190 |
+
$newerNotification.find( '.so-backup-dismiss' ).click( function () {
|
191 |
+
$newerNotification.slideUp( 'fast', function () {
|
192 |
+
sessionStorage.removeItem( _sow_form_id );
|
193 |
+
$newerNotification.remove();
|
194 |
+
} );
|
195 |
+
} );
|
196 |
+
} else {
|
197 |
+
sessionStorage.removeItem( _sow_form_id );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
$el.change( function () {
|
202 |
+
$timestampField.val( new Date().getTime() );
|
203 |
+
var data = sowbForms.getWidgetFormValues( $el );
|
204 |
+
sessionStorage.setItem( _sow_form_id, JSON.stringify( data ) );
|
205 |
+
} );
|
206 |
+
}
|
207 |
+
else {
|
208 |
+
$mainForm = $el.closest('.siteorigin-widget-form-main');
|
209 |
+
}
|
210 |
+
formId = $mainForm.find('> .siteorigin-widgets-form-id').val();
|
211 |
+
|
212 |
+
// Find any field or sub widget fields.
|
213 |
+
var $fields = $el.find('> .siteorigin-widget-field');
|
214 |
+
|
215 |
+
// Process any sub sections
|
216 |
+
$fields.find('> .siteorigin-widget-section').sowSetupForm();
|
217 |
+
|
218 |
+
var $subwidgetFields = $fields.find('> .siteorigin-widget-widget');
|
219 |
+
$subwidgetFields.find('> .siteorigin-widget-section').sowSetupForm();
|
220 |
+
|
221 |
+
// Process any sub widgets whose fields aren't contained in a section
|
222 |
+
$subwidgetFields.filter(':not(:has(> .siteorigin-widget-section))').sowSetupForm();
|
223 |
+
|
224 |
+
// Store the field names
|
225 |
+
$fields.find('.siteorigin-widget-input').each(function (i, input) {
|
226 |
+
if ($(input).data('original-name') === null) {
|
227 |
+
$(input).data('original-name', $(input).attr('name'));
|
228 |
+
}
|
229 |
+
});
|
230 |
+
|
231 |
+
// Setup all the repeaters
|
232 |
+
$fields.find('> .siteorigin-widget-field-repeater').sowSetupRepeater();
|
233 |
+
|
234 |
+
// For any repeater items currently in existence
|
235 |
+
$el.find('.siteorigin-widget-field-repeater-item').sowSetupRepeaterItems();
|
236 |
+
|
237 |
+
// Set up any color fields
|
238 |
+
$fields.find('> .siteorigin-widget-input-color').each(function () {
|
239 |
+
var colorField = $(this);
|
240 |
+
var colorFieldOptions = {
|
241 |
+
change: function (event, ui) {
|
242 |
+
setTimeout(function () {
|
243 |
+
$(event.target).trigger('change');
|
244 |
+
}, 100);
|
245 |
+
}
|
246 |
+
};
|
247 |
+
if (colorField.data('defaultColor')) {
|
248 |
+
colorFieldOptions.defaultColor = colorField.data('defaultColor');
|
249 |
+
}
|
250 |
+
colorField.wpColorPicker(colorFieldOptions);
|
251 |
+
});
|
252 |
+
|
253 |
+
///////////////////////////////////////
|
254 |
+
// Handle the sections
|
255 |
+
var expandContainer = function () {
|
256 |
+
$(this).toggleClass('siteorigin-widget-section-visible');
|
257 |
+
$(this).parent().find('> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section')
|
258 |
+
.slideToggle('fast', function () {
|
259 |
+
$(window).resize();
|
260 |
+
$(this).find('> .siteorigin-widget-field-container-state').val($(this).is(':visible') ? 'open' : 'closed');
|
261 |
+
|
262 |
+
if ( $( this ).is( ':visible' ) ) {
|
263 |
+
var $fields = $( this ).find( '> .siteorigin-widget-field' );
|
264 |
+
$fields.trigger( 'sowsetupformfield' );
|
265 |
+
}
|
266 |
+
} );
|
267 |
+
};
|
268 |
+
$fields.filter('.siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section').find('> label').click(expandContainer);
|
269 |
+
$fields.filter('.siteorigin-widget-field-type-posts').find('.posts-container-label-wrapper').click(expandContainer);
|
270 |
+
|
271 |
+
///////////////////////////////////////
|
272 |
+
// Handle the slider fields
|
273 |
+
|
274 |
+
$fields.filter('.siteorigin-widget-field-type-slider').each(function () {
|
275 |
+
var $$ = $(this);
|
276 |
+
var $input = $$.find('input[type="number"]');
|
277 |
+
var $c = $$.find('.siteorigin-widget-value-slider');
|
278 |
+
|
279 |
+
$c.slider({
|
280 |
+
max: parseFloat($input.attr('max')),
|
281 |
+
min: parseFloat($input.attr('min')),
|
282 |
+
step: parseFloat($input.attr('step')),
|
283 |
+
value: parseFloat($input.val()),
|
284 |
+
slide: function (event, ui) {
|
285 |
+
$input.val( parseFloat( ui.value ) );
|
286 |
+
$input.trigger( 'change' );
|
287 |
+
},
|
288 |
+
change: function( event, ui ) {
|
289 |
+
$$.find('.siteorigin-widget-slider-value').html(ui.value);
|
290 |
+
},
|
291 |
+
});
|
292 |
+
$input.change(function(event, data) {
|
293 |
+
if ( ! ( data && data.silent ) ) {
|
294 |
+
$c.slider( 'value', parseFloat( $input.val() ) );
|
295 |
+
}
|
296 |
+
});
|
297 |
+
});
|
298 |
+
|
299 |
+
///////////////////////////////////////
|
300 |
+
// Setup the URL fields
|
301 |
+
|
302 |
+
$fields.filter('.siteorigin-widget-field-type-link').each(function () {
|
303 |
+
var $$ = $(this);
|
304 |
+
|
305 |
+
// Function that refreshes the list of
|
306 |
+
var request = null;
|
307 |
+
var refreshList = function () {
|
308 |
+
if (request !== null) {
|
309 |
+
request.abort();
|
310 |
+
}
|
311 |
+
|
312 |
+
var $contentSearchInput = $$.find('.content-text-search');
|
313 |
+
var query = $contentSearchInput.val();
|
314 |
+
var postTypes = $contentSearchInput.data('postTypes');
|
315 |
+
|
316 |
+
var $ul = $$.find('ul.posts').empty().addClass('loading');
|
317 |
+
$.get(
|
318 |
+
soWidgets.ajaxurl,
|
319 |
+
{action: 'so_widgets_search_posts', query: query, postTypes: postTypes},
|
320 |
+
function (data) {
|
321 |
+
for (var i = 0; i < data.length; i++) {
|
322 |
+
if (data[i].label === '') {
|
323 |
+
data[i].label = ' ';
|
324 |
+
}
|
325 |
+
|
326 |
+
// Add all the post items
|
327 |
+
$ul.append(
|
328 |
+
$('<li>')
|
329 |
+
.addClass('post')
|
330 |
+
.html(data[i].label + '<span>(' + data[i].type + ')</span>')
|
331 |
+
.data(data[i])
|
332 |
+
);
|
333 |
+
}
|
334 |
+
$ul.removeClass('loading');
|
335 |
+
}
|
336 |
+
);
|
337 |
+
};
|
338 |
+
|
339 |
+
// Toggle display of the existing content
|
340 |
+
$$.find('.select-content-button, .button-close').click(function (e) {
|
341 |
+
e.preventDefault();
|
342 |
+
|
343 |
+
$(this).blur();
|
344 |
+
var $s = $$.find('.existing-content-selector');
|
345 |
+
$s.toggle();
|
346 |
+
|
347 |
+
if ($s.is(':visible') && $s.find('ul.posts li').length === 0) {
|
348 |
+
refreshList();
|
349 |
+
}
|
350 |
+
|
351 |
+
});
|
352 |
+
|
353 |
+
// Clicking on one of the url items
|
354 |
+
$$.on('click', '.posts li', function (e) {
|
355 |
+
e.preventDefault();
|
356 |
+
var $li = $(this);
|
357 |
+
$$.find('input.siteorigin-widget-input').val('post: ' + $li.data('value'));
|
358 |
+
$$.find('.existing-content-selector').toggle();
|
359 |
+
});
|
360 |
+
|
361 |
+
var interval = null;
|
362 |
+
$$.find('.content-text-search').keyup(function () {
|
363 |
+
if (interval !== null) {
|
364 |
+
clearTimeout(interval);
|
365 |
+
}
|
366 |
+
|
367 |
+
interval = setTimeout(function () {
|
368 |
+
refreshList();
|
369 |
+
}, 500);
|
370 |
+
});
|
371 |
+
});
|
372 |
+
|
373 |
+
///////////////////////////////////////
|
374 |
+
// Setup the Builder fields
|
375 |
+
if (typeof jQuery.fn.soPanelsSetupBuilderWidget !== 'undefined') {
|
376 |
+
$fields.filter('.siteorigin-widget-field-type-builder').each(function () {
|
377 |
+
$( this ).find( '> .siteorigin-page-builder-field' ).each( function () {
|
378 |
+
var $$ = $( this );
|
379 |
+
$$.soPanelsSetupBuilderWidget( { builderType: $$.data( 'type' ) } );
|
380 |
+
} );
|
381 |
+
});
|
382 |
+
}
|
383 |
+
|
384 |
+
///////////////////////////////////////
|
385 |
+
// Now lets handle the state emitters
|
386 |
+
|
387 |
+
var stateEmitterChangeHandler = function () {
|
388 |
+
var $$ = $(this);
|
389 |
+
|
390 |
+
// These emitters can either be an array or a
|
391 |
+
var emitters = $$.closest('[data-state-emitter]').data('state-emitter');
|
392 |
+
|
393 |
+
if (typeof emitters !== 'undefined') {
|
394 |
+
var handleStateEmitter = function (emitter, currentStates) {
|
395 |
+
if (typeof sowEmitters[emitter.callback] === 'undefined' || emitter.callback.substr(0, 1) === '_') {
|
396 |
+
// Skip if the function doesn't exist, or it starts with an underscore (internal functions).
|
397 |
+
return currentStates;
|
398 |
+
}
|
399 |
+
|
400 |
+
// Check if this is inside a repeater
|
401 |
+
var repeaterIndex = sowbForms.getContainerFieldId( $$, 'repeater', '.siteorigin-widget-field-repeater-item' );
|
402 |
+
if (repeaterIndex !== false) {
|
403 |
+
emitter.args = emitter.args.map(function (a) {
|
404 |
+
return a.replace('{$repeater}', repeaterIndex);
|
405 |
+
});
|
406 |
+
}
|
407 |
+
|
408 |
+
var widgetFieldId = sowbForms.getContainerFieldId( $$, 'widget', '.siteorigin-widget-widget' );
|
409 |
+
if ( widgetFieldId !== false && ! emitter.hasOwnProperty( 'widgetFieldId' ) ) {
|
410 |
+
emitter.widgetFieldId = widgetFieldId;
|
411 |
+
emitter.args = emitter.args.map(function (arg) {
|
412 |
+
return arg + '_' + widgetFieldId;
|
413 |
+
});
|
414 |
+
}
|
415 |
+
|
416 |
+
var val = $$.is('[type="checkbox"]') ? $$.is(':checked') : $$.val();
|
417 |
+
// Return an array that has the new states added to the array
|
418 |
+
return $.extend(currentStates, sowEmitters[emitter.callback](val, emitter.args));
|
419 |
+
};
|
420 |
+
|
421 |
+
// Run the states through the state emitters
|
422 |
+
var states = {'default': ''};
|
423 |
+
|
424 |
+
// Go through the array of emitters
|
425 |
+
if (typeof emitters.length === 'undefined') {
|
426 |
+
emitters = [emitters];
|
427 |
+
}
|
428 |
+
|
429 |
+
for (var i = 0; i < emitters.length; i++) {
|
430 |
+
states = handleStateEmitter(emitters[i], states);
|
431 |
+
}
|
432 |
+
|
433 |
+
// Check which states have changed and trigger appropriate sowstatechange
|
434 |
+
var formStates = $mainForm.data('states');
|
435 |
+
if (typeof formStates === 'undefined') {
|
436 |
+
formStates = {'default': ''};
|
437 |
+
}
|
438 |
+
for (var k in states) {
|
439 |
+
if (typeof formStates[k] === 'undefined' || states[k] !== formStates[k]) {
|
440 |
+
// If the state is different from the original formStates, then trigger a state change
|
441 |
+
formStates[k] = states[k];
|
442 |
+
$mainForm.trigger('sowstatechange', [k, states[k]]);
|
443 |
+
}
|
444 |
+
}
|
445 |
+
|
446 |
+
// Store the form states back in the form
|
447 |
+
$mainForm.data('states', formStates);
|
448 |
+
}
|
449 |
+
};
|
450 |
+
|
451 |
+
$fields.filter('[data-state-emitter]').each(function () {
|
452 |
+
|
453 |
+
// Listen for any change events on an emitter field
|
454 |
+
$(this).find('.siteorigin-widget-input').on('keyup change', stateEmitterChangeHandler);
|
455 |
+
|
456 |
+
// Trigger initial state emitter changes
|
457 |
+
$(this).find('.siteorigin-widget-input').each(function () {
|
458 |
+
var $$ = $(this);
|
459 |
+
if ($$.is(':radio')) {
|
460 |
+
// Only checked radio inputs must have change events
|
461 |
+
if ($$.is(':checked')) {
|
462 |
+
stateEmitterChangeHandler.call($$[0]);
|
463 |
+
}
|
464 |
+
}
|
465 |
+
else {
|
466 |
+
stateEmitterChangeHandler.call($$[0]);
|
467 |
+
}
|
468 |
+
});
|
469 |
+
|
470 |
+
});
|
471 |
+
|
472 |
+
// Give plugins a chance to influence the form
|
473 |
+
$el.trigger('sowsetupform', $fields).data('sow-form-setup', true);
|
474 |
+
|
475 |
+
$fields.trigger('sowsetupformfield');
|
476 |
+
|
477 |
+
$el.find('.siteorigin-widget-field-repeater-item').trigger('updateFieldPositions');
|
478 |
+
|
479 |
+
if ( $body.hasClass( 'wp-customizer' ) || $body.hasClass( 'widgets-php' ) ) {
|
480 |
+
// Reinitialize widget fields when they're dragged and dropped.
|
481 |
+
$el.closest( '.ui-sortable' ).on( 'sortstop', function (event, ui) {
|
482 |
+
var $fields = ui.item.find( '.siteorigin-widget-form' ).find( '> .siteorigin-widget-field' );
|
483 |
+
$fields.trigger( 'sowsetupformfield' );
|
484 |
+
} );
|
485 |
+
}
|
486 |
+
|
487 |
+
/////////////////////////////
|
488 |
+
// The end of the form setup.
|
489 |
+
/////////////////////////////
|
490 |
+
|
491 |
+
formInitializing = false;
|
492 |
+
});
|
493 |
+
};
|
494 |
+
|
495 |
+
$.fn.sowSetupPreview = function () {
|
496 |
+
var $el = $(this);
|
497 |
+
var previewButton = $el.siblings('.siteorigin-widget-preview');
|
498 |
+
|
499 |
+
previewButton.find('> a').click(function (e) {
|
500 |
+
e.preventDefault();
|
501 |
+
|
502 |
+
var data = sowbForms.getWidgetFormValues($el);
|
503 |
+
|
504 |
+
// Create a new modal window
|
505 |
+
var modal = $($('#so-widgets-bundle-tpl-preview-dialog').html().trim()).appendTo('body');
|
506 |
+
modal.find('input[name="data"]').val(JSON.stringify(data));
|
507 |
+
modal.find('input[name="class"]').val($el.data('class'));
|
508 |
+
modal.find('iframe').on('load', function () {
|
509 |
+
$(this).css('visibility', 'visible');
|
510 |
+
});
|
511 |
+
modal.find('form').submit();
|
512 |
+
|
513 |
+
modal.find('.close').click(function () {
|
514 |
+
modal.remove();
|
515 |
+
});
|
516 |
+
});
|
517 |
+
};
|
518 |
+
|
519 |
+
$.fn.sowSetupRepeater = function () {
|
520 |
+
|
521 |
+
return $(this).each(function (i, el) {
|
522 |
+
var $el = $(el);
|
523 |
+
var $items = $el.find('.siteorigin-widget-field-repeater-items');
|
524 |
+
var name = $el.data('repeater-name');
|
525 |
+
|
526 |
+
$items.bind('updateFieldPositions', function () {
|
527 |
+
var $$ = $(this);
|
528 |
+
var $rptrItems = $$.find('> .siteorigin-widget-field-repeater-item');
|
529 |
+
|
530 |
+
// Set the position for the repeater items
|
531 |
+
$rptrItems.each(function (i, el) {
|
532 |
+
$(el).find('.siteorigin-widget-input').each(function (j, input) {
|
533 |
+
var pos = $(input).data('repeater-positions');
|
534 |
+
if (typeof pos === 'undefined') {
|
535 |
+
pos = {};
|
536 |
+
}
|
537 |
+
|
538 |
+
pos[name] = i;
|
539 |
+
$(input).data('repeater-positions', pos);
|
540 |
+
});
|
541 |
+
});
|
542 |
+
|
543 |
+
// Update the field names for all the input items
|
544 |
+
$$.find('.siteorigin-widget-input').each(function (i, input) {
|
545 |
+
var $in = $(input);
|
546 |
+
var pos = $in.data('repeater-positions');
|
547 |
+
|
548 |
+
if (typeof pos !== 'undefined') {
|
549 |
+
var newName = $in.attr('data-original-name');
|
550 |
+
|
551 |
+
if (!newName) {
|
552 |
+
$in.attr('data-original-name', $in.attr('name'));
|
553 |
+
newName = $in.attr('name');
|
554 |
+
}
|
555 |
+
if (!newName) {
|
556 |
+
return;
|
557 |
+
}
|
558 |
+
|
559 |
+
if (pos) {
|
560 |
+
for (var k in pos) {
|
561 |
+
newName = newName.replace('#' + k + '#', pos[k]);
|
562 |
+
}
|
563 |
+
}
|
564 |
+
$in.attr('name', newName);
|
565 |
+
}
|
566 |
+
});
|
567 |
+
|
568 |
+
if (!$$.data('initialSetup')) {
|
569 |
+
// Setup default checked values, now that we've updated input names.
|
570 |
+
// Without this radio inputs in repeaters will be rendered as if they all belong to the same group.
|
571 |
+
$$.find('.siteorigin-widget-input').each(function (i, input) {
|
572 |
+
var $in = $(input);
|
573 |
+
$in.prop('checked', $in.prop('defaultChecked'));
|
574 |
+
});
|
575 |
+
$$.data('initialSetup', true);
|
576 |
+
}
|
577 |
+
|
578 |
+
//Setup scrolling.
|
579 |
+
var scrollCount = $el.data('scroll-count') ? parseInt($el.data('scroll-count')) : 0;
|
580 |
+
if (scrollCount > 0 && $rptrItems.length > scrollCount) {
|
581 |
+
var itemHeight = $rptrItems.first().outerHeight();
|
582 |
+
$$.css('max-height', itemHeight * scrollCount).css('overflow', 'auto');
|
583 |
+
}
|
584 |
+
else {
|
585 |
+
//TODO: Check whether there was a value before overriding and set it back to that.
|
586 |
+
$$.css('max-height', '').css('overflow', '');
|
587 |
+
}
|
588 |
+
});
|
589 |
+
|
590 |
+
$items.sortable({
|
591 |
+
handle: '.siteorigin-widget-field-repeater-item-top',
|
592 |
+
items: '> .siteorigin-widget-field-repeater-item',
|
593 |
+
update: function () {
|
594 |
+
// Clear `name` attributes for radio inputs. They'll be reassigned on update.
|
595 |
+
// This prevents some radio inputs values being cleared during the update process.
|
596 |
+
$items.find( 'input[type="radio"].siteorigin-widget-input' ).attr( 'name', '' );
|
597 |
+
$items.trigger('updateFieldPositions');
|
598 |
+
$el.trigger( 'change' );
|
599 |
+
},
|
600 |
+
sortstop: function (event, ui) {
|
601 |
+
if ( ui.item.is( '.siteorigin-widget-field-repeater-item' ) ) {
|
602 |
+
ui.item.find( '> .siteorigin-widget-field-repeater-item-form' ).each( function () {
|
603 |
+
var $fields = $( this ).find( '> .siteorigin-widget-field' );
|
604 |
+
$fields.trigger( 'sowsetupformfield' );
|
605 |
+
} );
|
606 |
+
}
|
607 |
+
else {
|
608 |
+
var $fields = ui.item.find( '.siteorigin-widget-form' ).find( '> .siteorigin-widget-field' );
|
609 |
+
$fields.trigger( 'sowsetupformfield' );
|
610 |
+
}
|
611 |
+
$el.trigger( 'change' );
|
612 |
+
}
|
613 |
+
});
|
614 |
+
$items.trigger('updateFieldPositions');
|
615 |
+
|
616 |
+
$el.find('> .siteorigin-widget-field-repeater-add').disableSelection().click(function (e) {
|
617 |
+
e.preventDefault();
|
618 |
+
$el.closest('.siteorigin-widget-field-repeater')
|
619 |
+
.sowAddRepeaterItem()
|
620 |
+
.find('> .siteorigin-widget-field-repeater-items').slideDown('fast', function () {
|
621 |
+
$(window).resize();
|
622 |
+
});
|
623 |
+
});
|
624 |
+
|
625 |
+
$el.find('> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand').click(function (e) {
|
626 |
+
e.preventDefault();
|
627 |
+
$el.closest('.siteorigin-widget-field-repeater').find('> .siteorigin-widget-field-repeateritems-').slideToggle('fast', function () {
|
628 |
+
$(window).resize();
|
629 |
+
});
|
630 |
+
});
|
631 |
+
});
|
632 |
+
};
|
633 |
+
|
634 |
+
$.fn.sowAddRepeaterItem = function () {
|
635 |
+
return $(this).each(function (i, el) {
|
636 |
+
|
637 |
+
var $el = $(el);
|
638 |
+
var $nextIndex = $el.find('> .siteorigin-widget-field-repeater-items').children().length + 1;
|
639 |
+
|
640 |
+
// Create an object with the repeater html so we can make some changes to it.
|
641 |
+
var repeaterObject = $('<div>' + $el.find('> .siteorigin-widget-field-repeater-item-html').html() + '</div>');
|
642 |
+
repeaterObject.find('.siteorigin-widget-input[data-name]').each(function () {
|
643 |
+
var $$ = $(this);
|
644 |
+
// Skip out items that are themselves inside repeater HTML wrappers
|
645 |
+
if ($$.closest('.siteorigin-widget-field-repeater-item-html').length === 0) {
|
646 |
+
$$.attr('name', $(this).data('name'));
|
647 |
+
}
|
648 |
+
});
|
649 |
+
var repeaterHtml = repeaterObject.html().replace(/_id_/g, $nextIndex);
|
650 |
+
|
651 |
+
var readonly = typeof $el.attr('readonly') !== 'undefined';
|
652 |
+
var item = $('<div class="siteorigin-widget-field-repeater-item ui-draggable" />')
|
653 |
+
.append(
|
654 |
+
$('<div class="siteorigin-widget-field-repeater-item-top" />')
|
655 |
+
.append(
|
656 |
+
$('<div class="siteorigin-widget-field-expand" />')
|
657 |
+
)
|
658 |
+
.append(
|
659 |
+
readonly ? '' : $('<div class="siteorigin-widget-field-copy" />')
|
660 |
+
)
|
661 |
+
.append(
|
662 |
+
readonly ? '' : $('<div class="siteorigin-widget-field-remove" />')
|
663 |
+
)
|
664 |
+
.append($('<h4 />').html($el.data('item-name')))
|
665 |
+
)
|
666 |
+
.append(
|
667 |
+
$('<div class="siteorigin-widget-field-repeater-item-form" />')
|
668 |
+
.html(repeaterHtml)
|
669 |
+
);
|
670 |
+
|
671 |
+
// Add the item and refresh
|
672 |
+
$el.find('> .siteorigin-widget-field-repeater-items').append(item).sortable("refresh").trigger('updateFieldPositions');
|
673 |
+
item.sowSetupRepeaterItems();
|
674 |
+
item.hide().slideDown('fast', function () {
|
675 |
+
$(window).resize();
|
676 |
+
});
|
677 |
+
$el.trigger( 'change' );
|
678 |
+
});
|
679 |
+
};
|
680 |
+
|
681 |
+
$.fn.sowRemoveRepeaterItem = function () {
|
682 |
+
return $(this).each(function (i, el) {
|
683 |
+
var $itemsContainer = $(this).closest('.siteorigin-widget-field-repeater-items');
|
684 |
+
$(this).remove();
|
685 |
+
$itemsContainer.sortable("refresh").trigger('updateFieldPositions');
|
686 |
+
$( el ).trigger( 'change' );
|
687 |
+
});
|
688 |
+
};
|
689 |
+
|
690 |
+
$.fn.sowSetupRepeaterItems = function () {
|
691 |
+
return $(this).each(function (i, el) {
|
692 |
+
var $el = $(el);
|
693 |
+
|
694 |
+
if (typeof $el.data('sowrepeater-actions-setup') === 'undefined') {
|
695 |
+
var $parentRepeater = $el.closest('.siteorigin-widget-field-repeater');
|
696 |
+
var itemTop = $el.find('> .siteorigin-widget-field-repeater-item-top');
|
697 |
+
var itemLabel = $parentRepeater.data('item-label');
|
698 |
+
if (itemLabel && itemLabel.selector) {
|
699 |
+
var updateLabel = function () {
|
700 |
+
var functionName = ( itemLabel.hasOwnProperty('valueMethod') && itemLabel.valueMethod ) ? itemLabel.valueMethod : 'val';
|
701 |
+
var txt = $el.find(itemLabel.selector)[functionName]();
|
702 |
+
if (txt) {
|
703 |
+
if (txt.length > 80) {
|
704 |
+
txt = txt.substr(0, 79) + '...';
|
705 |
+
}
|
706 |
+
itemTop.find('h4').text(txt);
|
707 |
+
}
|
708 |
+
};
|
709 |
+
updateLabel();
|
710 |
+
var eventName = ( itemLabel.hasOwnProperty('updateEvent') && itemLabel.updateEvent ) ? itemLabel.updateEvent : 'change';
|
711 |
+
$el.bind(eventName, updateLabel);
|
712 |
+
}
|
713 |
+
|
714 |
+
itemTop.click(function (e) {
|
715 |
+
if (e.target.className === "siteorigin-widget-field-remove" || e.target.className === "siteorigin-widget-field-copy") {
|
716 |
+
return;
|
717 |
+
}
|
718 |
+
e.preventDefault();
|
719 |
+
$(this).closest('.siteorigin-widget-field-repeater-item').find('.siteorigin-widget-field-repeater-item-form').eq(0).slideToggle('fast', function () {
|
720 |
+
$(window).resize();
|
721 |
+
if ($(this).is(':visible')) {
|
722 |
+
$(this).trigger('slideToggleOpenComplete');
|
723 |
+
|
724 |
+
var $fields = $( this ).find( '> .siteorigin-widget-field' );
|
725 |
+
$fields.trigger( 'sowsetupformfield' );
|
726 |
+
}
|
727 |
+
else {
|
728 |
+
$(this).trigger('slideToggleCloseComplete');
|
729 |
+
}
|
730 |
+
});
|
731 |
+
});
|
732 |
+
|
733 |
+
itemTop.find('.siteorigin-widget-field-remove').click(function (e, params) {
|
734 |
+
e.preventDefault();
|
735 |
+
var $s = $( this ).closest( '.siteorigin-widget-field-repeater-items' );
|
736 |
+
var $item = $( this ).closest( '.siteorigin-widget-field-repeater-item' );
|
737 |
+
var removeItem = function () {
|
738 |
+
$item.remove();
|
739 |
+
$s.sortable( "refresh" ).trigger( 'updateFieldPositions' );
|
740 |
+
$( window ).resize();
|
741 |
+
};
|
742 |
+
if ( params && params.silent ) {
|
743 |
+
removeItem();
|
744 |
+
} else if ( confirm( soWidgets.sure ) ) {
|
745 |
+
$item.slideUp('fast', removeItem );
|
746 |
+
}
|
747 |
+
$el.trigger( 'change' );
|
748 |
+
});
|
749 |
+
itemTop.find('.siteorigin-widget-field-copy').click(function (e) {
|
750 |
+
e.preventDefault();
|
751 |
+
var $form = $(this).closest('.siteorigin-widget-form-main');
|
752 |
+
var $item = $(this).closest('.siteorigin-widget-field-repeater-item');
|
753 |
+
var $copyItem = $item.clone();
|
754 |
+
var $items = $item.closest('.siteorigin-widget-field-repeater-items');
|
755 |
+
//var $nextIndex = $item.index()+1;
|
756 |
+
var $nextIndex = $items.children().length;
|
757 |
+
var newIds = {};
|
758 |
+
|
759 |
+
$copyItem.find('*[name]').each(function () {
|
760 |
+
var $inputElement = $(this);
|
761 |
+
var id = $inputElement.attr('id');
|
762 |
+
var nm = $inputElement.attr('name');
|
763 |
+
// TinyMCE field :/
|
764 |
+
if ($inputElement.is('textarea') && $inputElement.parent().is('.wp-editor-container') && typeof tinymce != 'undefined') {
|
765 |
+
$inputElement.parent().empty().append($inputElement);
|
766 |
+
$inputElement.css('display', '');
|
767 |
+
var curEd = tinymce.get(id);
|
768 |
+
if (curEd) {
|
769 |
+
$inputElement.val(curEd.getContent());
|
770 |
+
}
|
771 |
+
}
|
772 |
+
// Color field :/
|
773 |
+
else if ($inputElement.is('.wp-color-picker')) {
|
774 |
+
var $wpPickerContainer = $inputElement.closest('.wp-picker-container');
|
775 |
+
var $soWidgetField = $inputElement.closest('.siteorigin-widget-field');
|
776 |
+
$wpPickerContainer.remove();
|
777 |
+
$soWidgetField.append($inputElement.remove());
|
778 |
+
}
|
779 |
+
else {
|
780 |
+
var $originalInput = id ? $item.find( '#' + id ) : $item.find('[name="' + nm + '"]');
|
781 |
+
if ($originalInput.length && $originalInput.val() != null) {
|
782 |
+
$inputElement.val($originalInput.val());
|
783 |
+
}
|
784 |
+
}
|
785 |
+
if (id) {
|
786 |
+
var idRegExp;
|
787 |
+
var idBase;
|
788 |
+
var newId;
|
789 |
+
|
790 |
+
// Radio inputs are slightly different because there are multiple `input` elements for
|
791 |
+
// a single field, i.e. multiple `inputs` for selecting a single value.
|
792 |
+
if ($inputElement.is('[type="radio"]')) {
|
793 |
+
// Radio inputs have their position appended to the id.
|
794 |
+
idBase = id.replace(/-\d+-\d+$/, '');
|
795 |
+
var radioIdBase = id.replace(/-\d+$/, '');
|
796 |
+
if (!newIds[idBase]) {
|
797 |
+
var radioNames = {};
|
798 |
+
newIds[idBase] = $form
|
799 |
+
// find all inputs containing idBase in their id attribute
|
800 |
+
.find('.siteorigin-widget-input[id^=' + idBase + ']')
|
801 |
+
// exclude inputs from templates
|
802 |
+
.not('[id*=_id_]')
|
803 |
+
// reduce to one element per radio input group.
|
804 |
+
.filter(function (index, element) {
|
805 |
+
var eltName = $(element).attr('name');
|
806 |
+
if (radioNames[eltName]) {
|
807 |
+
return false;
|
808 |
+
} else {
|
809 |
+
radioNames[eltName] = true;
|
810 |
+
return true;
|
811 |
+
}
|
812 |
+
}).length + 1;
|
813 |
+
}
|
814 |
+
var newRadioIdBase = idBase + '-' + newIds[idBase];
|
815 |
+
newId = newRadioIdBase + id.match(/-\d+$/)[0];
|
816 |
+
$copyItem.find('label[for=' + radioIdBase + ']').attr('for', newRadioIdBase);
|
817 |
+
} else {
|
818 |
+
idRegExp = new RegExp('-\\d+$');
|
819 |
+
idBase = id.replace(idRegExp, '');
|
820 |
+
if (!newIds[idBase]) {
|
821 |
+
newIds[idBase] = $form.find('.siteorigin-widget-input[id^=' + idBase + ']').not('[id*=_id_]').length + 1;
|
822 |
+
}
|
823 |
+
newId = idBase + '-' + newIds[idBase]++;
|
824 |
+
}
|
825 |
+
|
826 |
+
$inputElement.attr('id', newId);
|
827 |
+
$copyItem.find('label[for=' + id + ']').attr('for', newId);
|
828 |
+
$copyItem.find('[id*=' + id + ']').each(function () {
|
829 |
+
var oldIdAttr = $(this).attr('id');
|
830 |
+
var newIdAttr = oldIdAttr.replace(id, newId);
|
831 |
+
$(this).attr('id', newIdAttr);
|
832 |
+
});
|
833 |
+
if (typeof tinymce !== 'undefined' && tinymce.get(newId)) {
|
834 |
+
tinymce.get(newId).remove();
|
835 |
+
}
|
836 |
+
}
|
837 |
+
var nestLevel = $item.parents('.siteorigin-widget-field-repeater').length;
|
838 |
+
var $body = $('body');
|
839 |
+
if (($body.hasClass('wp-customizer') || $body.hasClass('widgets-php')) && $el.closest('.panel-dialog').length === 0) {
|
840 |
+
nestLevel += 1;
|
841 |
+
}
|
842 |
+
var newName = nm.replace(new RegExp('((?:.*?\\[\\d+\\]){' + (nestLevel - 1).toString() + '})?(.*?\\[)\\d+(\\])'), '$1$2' + $nextIndex.toString() + '$3');
|
843 |
+
$inputElement.attr('name', newName);
|
844 |
+
$inputElement.data('original-name', newName);
|
845 |
+
});
|
846 |
+
|
847 |
+
//$item.after($copyItem);
|
848 |
+
//$items.sortable( "refresh").trigger('updateFieldPositions');
|
849 |
+
$items.append($copyItem).sortable("refresh").trigger('updateFieldPositions');
|
850 |
+
$copyItem.sowSetupRepeaterItems();
|
851 |
+
$copyItem.hide().slideDown('fast', function () {
|
852 |
+
$(window).resize();
|
853 |
+
});
|
854 |
+
$el.trigger( 'change' );
|
855 |
+
});
|
856 |
+
|
857 |
+
$el.find('> .siteorigin-widget-field-repeater-item-form').sowSetupForm();
|
858 |
+
|
859 |
+
$el.data('sowrepeater-actions-setup', true);
|
860 |
+
}
|
861 |
+
});
|
862 |
+
};
|
863 |
+
|
864 |
+
// Widgets Bundle utility functions
|
865 |
+
/**
|
866 |
+
* Get the unique index of a repeated item. Could be in a repeater or if multiple widget fields with the same
|
867 |
+
* widget class.
|
868 |
+
*
|
869 |
+
* @param $el
|
870 |
+
* @param containerType
|
871 |
+
* @param containerClass
|
872 |
+
* @return {*}
|
873 |
+
*/
|
874 |
+
sowbForms.getContainerFieldId = function ( $el, containerType, containerClass ) {
|
875 |
+
var fieldIdPropName = containerType + 'FieldId';
|
876 |
+
if ( ! this.hasOwnProperty( fieldIdPropName ) ) {
|
877 |
+
this[ fieldIdPropName ] = 1;
|
878 |
+
}
|
879 |
+
|
880 |
+
var $field = $el.closest( containerClass );
|
881 |
+
if ( $field.length ) {
|
882 |
+
var fieldId = $field.data( 'field-id' );
|
883 |
+
if ( fieldId === undefined ) {
|
884 |
+
fieldId = this[ fieldIdPropName ]++;
|
885 |
+
}
|
886 |
+
$field.data( 'field-id', fieldId );
|
887 |
+
|
888 |
+
return fieldId;
|
889 |
+
}
|
890 |
+
else {
|
891 |
+
return false;
|
892 |
+
}
|
893 |
+
};
|
894 |
+
|
895 |
+
/**
|
896 |
+
* Retrieve a variable for a field with the given identifier, elementName.
|
897 |
+
*
|
898 |
+
* @return {*}
|
899 |
+
* @param widgetClass The class name of the widget for which to retrieve a variable.
|
900 |
+
* @param elementName The name of the field for which to retrieve a variable.
|
901 |
+
* @param key The name of the variable to retrieve.
|
902 |
+
*/
|
903 |
+
sowbForms.getWidgetFieldVariable = function (widgetClass, elementName, key) {
|
904 |
+
var widgetVars = window.sow_field_javascript_variables[widgetClass];
|
905 |
+
// Get rid of any index placeholders
|
906 |
+
elementName = elementName.replace(/\[#.*?#\]/g, '');
|
907 |
+
var variablePath = /[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(elementName)[1];
|
908 |
+
var variablePathParts = variablePath.split('][');
|
909 |
+
var elementVars = variablePathParts.length ? widgetVars : null;
|
910 |
+
while (variablePathParts.length) {
|
911 |
+
elementVars = elementVars[variablePathParts.shift()];
|
912 |
+
}
|
913 |
+
return elementVars[key];
|
914 |
+
};
|
915 |
+
|
916 |
+
sowbForms.fetchWidgetVariable = function (key, widget, callback) {
|
917 |
+
window.sowVars = window.sowVars || {};
|
918 |
+
|
919 |
+
if (typeof window.sowVars[widget] === 'undefined') {
|
920 |
+
$.post(
|
921 |
+
soWidgets.ajaxurl,
|
922 |
+
{'action': 'sow_get_javascript_variables', 'widget': widget, 'key': key},
|
923 |
+
function (result) {
|
924 |
+
window.sowVars[widget] = result;
|
925 |
+
callback(window.sowVars[widget][key]);
|
926 |
+
}
|
927 |
+
);
|
928 |
+
}
|
929 |
+
else {
|
930 |
+
callback(window.sowVars[widget][key]);
|
931 |
+
}
|
932 |
+
};
|
933 |
+
|
934 |
+
sowbForms.getWidgetFormValues = function ( formContainer ) {
|
935 |
+
|
936 |
+
if ( _.isUndefined( formContainer ) ) {
|
937 |
+
return null;
|
938 |
+
}
|
939 |
+
|
940 |
+
var data = {};
|
941 |
+
|
942 |
+
formContainer.find('*[name]').each(function () {
|
943 |
+
var $$ = $(this);
|
944 |
+
|
945 |
+
try {
|
946 |
+
var name = /[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec( $$.attr( 'name' ) );
|
947 |
+
|
948 |
+
if ( _.isEmpty( name ) ) {
|
949 |
+
return true;
|
950 |
+
}
|
951 |
+
|
952 |
+
// Create an array with the parts of the name
|
953 |
+
name = name[1];
|
954 |
+
var parts = name.split( '][' );
|
955 |
+
|
956 |
+
// Make sure we either have numbers or strings
|
957 |
+
parts = parts.map( function ( e ) {
|
958 |
+
if ( ! isNaN( parseFloat( e ) ) && isFinite( e ) ) {
|
959 |
+
return parseInt( e );
|
960 |
+
}
|
961 |
+
else {
|
962 |
+
return e;
|
963 |
+
}
|
964 |
+
} );
|
965 |
+
|
966 |
+
var sub = data;
|
967 |
+
var fieldValue = null;
|
968 |
+
|
969 |
+
var fieldType = _.isString( $$.attr( 'type' ) ) ? $$.attr( 'type' ).toLowerCase() : null;
|
970 |
+
|
971 |
+
if ( fieldType === 'checkbox' ) {
|
972 |
+
if ( $$.is( ':checked' ) ) {
|
973 |
+
fieldValue = $$.val() !== '' ? $$.val() : true;
|
974 |
+
} else {
|
975 |
+
fieldValue = false;
|
976 |
+
}
|
977 |
+
} else if ( fieldType === 'radio' ) {
|
978 |
+
if ( $$.is( ':checked' ) ) {
|
979 |
+
fieldValue = $$.val();
|
980 |
+
} else {
|
981 |
+
return;
|
982 |
+
}
|
983 |
+
} else if ( $$.prop( 'tagName' ) === 'SELECT' ) {
|
984 |
+
var selected = $$.find( 'option:selected' );
|
985 |
+
if ( selected.length === 1 ) {
|
986 |
+
fieldValue = $$.find( 'option:selected' ).val();
|
987 |
+
}
|
988 |
+
else if ( selected.length > 1 ) {
|
989 |
+
// This is a mutli-select field
|
990 |
+
fieldValue = _.map( $$.find( 'option:selected' ), function ( n, i ) {
|
991 |
+
return $( n ).val();
|
992 |
+
} );
|
993 |
+
}
|
994 |
+
} else {
|
995 |
+
fieldValue = $$.val();
|
996 |
+
}
|
997 |
+
for ( var i = 0; i < parts.length; i++ ) {
|
998 |
+
if ( i === parts.length - 1 ) {
|
999 |
+
if ( parts[i] === '' ) {
|
1000 |
+
// This needs to be an array
|
1001 |
+
sub.push( fieldValue );
|
1002 |
+
} else {
|
1003 |
+
sub[ parts[ i ] ] = fieldValue;
|
1004 |
+
}
|
1005 |
+
}
|
1006 |
+
else {
|
1007 |
+
if ( _.isUndefined( sub[ parts[ i ] ] ) ) {
|
1008 |
+
// We assume that a numeric key means it's an array. (or empty string??)
|
1009 |
+
if ( _.isNumber( parts[ i + 1 ] ) || parts[ i + 1 ] === '' ) {
|
1010 |
+
sub[ parts[ i ] ] = [];
|
1011 |
+
} else {
|
1012 |
+
sub[ parts[ i ] ] = {};
|
1013 |
+
}
|
1014 |
+
}
|
1015 |
+
// Go deeper into the data and continue
|
1016 |
+
sub = sub[ parts[ i ] ];
|
1017 |
+
}
|
1018 |
+
}
|
1019 |
+
} catch ( error ) {
|
1020 |
+
console.error( 'Field [' + $$.attr( 'name' ) + '] could not be processed and was skipped - ' + error.message );
|
1021 |
+
}
|
1022 |
+
});
|
1023 |
+
return data;
|
1024 |
+
};
|
1025 |
+
|
1026 |
+
|
1027 |
+
/**
|
1028 |
+
* Sets all the widget form fields in the given container with the given data values.
|
1029 |
+
*
|
1030 |
+
* @param formContainer The jQuery element containing the widget form fields.
|
1031 |
+
* @param data The data from which to set the widget form field values.
|
1032 |
+
* @param skipMissingValues If `true`, this will skip form fields for which the data values are missing.
|
1033 |
+
* If `false`, the form fields will be cleared. Default is `false`.
|
1034 |
+
*/
|
1035 |
+
sowbForms.setWidgetFormValues = function (formContainer, data, skipMissingValues) {
|
1036 |
+
skipMissingValues = skipMissingValues || false;
|
1037 |
+
// First check if this form has any repeaters.
|
1038 |
+
var depth = 0;
|
1039 |
+
var updateRepeaterChildren = function ( formParent, formData ) {
|
1040 |
+
if ( ++depth === 10 ) {
|
1041 |
+
return;
|
1042 |
+
}
|
1043 |
+
// Only direct child fields which are repeaters.
|
1044 |
+
formParent.find( '> .siteorigin-widget-field-type-repeater' ).each( function () {
|
1045 |
+
var $repeater = $( this ).find( '> .siteorigin-widget-field-repeater' );
|
1046 |
+
var repeaterName = $repeater.data( 'repeaterName' );
|
1047 |
+
var repeaterData = formData.hasOwnProperty( repeaterName ) ? formData[ repeaterName ] : null;
|
1048 |
+
if ( ! repeaterData || ! Array.isArray( repeaterData ) ) {
|
1049 |
+
return;
|
1050 |
+
}
|
1051 |
+
// Check that the number of child items matches the number of data items.
|
1052 |
+
var repeaterChildren = $repeater.find( '> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item' );
|
1053 |
+
var numItems = repeaterData.length;
|
1054 |
+
var numChildren = repeaterChildren.length;
|
1055 |
+
if ( numItems > numChildren ) {
|
1056 |
+
// If data items > child items, create extra child items.
|
1057 |
+
for ( var i = 0; i < numItems - numChildren; i++) {
|
1058 |
+
$repeater.find( '> .siteorigin-widget-field-repeater-add' ).click();
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
} else if ( ! skipMissingValues && numItems < numChildren ) {
|
1062 |
+
// If child items > data items, remove extra child items.
|
1063 |
+
for ( var j = numItems; j < numChildren; j++) {
|
1064 |
+
var $child = $( repeaterChildren.eq( j ) );
|
1065 |
+
$child.find( '> .siteorigin-widget-field-repeater-item-top' )
|
1066 |
+
.find( '.siteorigin-widget-field-remove' )
|
1067 |
+
.trigger( 'click', { silent: true } );
|
1068 |
+
}
|
1069 |
+
}
|
1070 |
+
repeaterChildren = $repeater.find( '> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item' );
|
1071 |
+
for ( var k = 0; k < repeaterChildren.length; k++ ) {
|
1072 |
+
repeaterChildren.eq( k ).find( '> .siteorigin-widget-field-repeater-item-form' );
|
1073 |
+
updateRepeaterChildren(
|
1074 |
+
repeaterChildren.eq( k ).find( '> .siteorigin-widget-field-repeater-item-form' ),
|
1075 |
+
repeaterData[ k ]
|
1076 |
+
);
|
1077 |
+
}
|
1078 |
+
} );
|
1079 |
+
};
|
1080 |
+
|
1081 |
+
updateRepeaterChildren(formContainer, data);
|
1082 |
+
|
1083 |
+
formContainer.find('*[name]').each(function () {
|
1084 |
+
var $$ = $(this);
|
1085 |
+
var name = /[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec($$.attr('name'));
|
1086 |
+
|
1087 |
+
if ( name === undefined || name === null ) {
|
1088 |
+
return true;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
name = name[1];
|
1092 |
+
var parts = name.split('][');
|
1093 |
+
|
1094 |
+
// Make sure we either have numbers or strings
|
1095 |
+
parts = parts.map( function ( e ) {
|
1096 |
+
if ( !isNaN( parseFloat( e ) ) && isFinite( e ) ) {
|
1097 |
+
return parseInt( e );
|
1098 |
+
} else {
|
1099 |
+
return e;
|
1100 |
+
}
|
1101 |
+
} );
|
1102 |
+
|
1103 |
+
var sub = data;
|
1104 |
+
var value;
|
1105 |
+
for (var i = 0; i < parts.length; i++) {
|
1106 |
+
// If the field is missing from the data, just leave `value` as `undefined`.
|
1107 |
+
if ( ! sub.hasOwnProperty( parts[ i ] ) ) {
|
1108 |
+
if ( skipMissingValues ) {
|
1109 |
+
return true;
|
1110 |
+
} else {
|
1111 |
+
break;
|
1112 |
+
}
|
1113 |
+
}
|
1114 |
+
if (i === parts.length - 1) {
|
1115 |
+
value = sub[ parts[ i ] ];
|
1116 |
+
} else {
|
1117 |
+
sub = sub[ parts[ i ] ];
|
1118 |
+
}
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
// This is the end, so we need to set the value on the field here.
|
1122 |
+
if ( $$.attr( 'type' ) === 'checkbox' ) {
|
1123 |
+
$$.prop( 'checked', value );
|
1124 |
+
} else if ( $$.attr( 'type' ) === 'radio' ) {
|
1125 |
+
$$.prop( 'checked', value === $$.val() );
|
1126 |
+
} else if ( $$.prop( 'tagName' ) === 'TEXTAREA' && $$.hasClass( 'wp-editor-area' ) ) {
|
1127 |
+
// This is a TinyMCE editor, so we'll use the tinyMCE object to get the content
|
1128 |
+
var editor = null;
|
1129 |
+
if ( typeof tinyMCE !== 'undefined' ) {
|
1130 |
+
editor = tinyMCE.get( $$.attr( 'id' ) );
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
if ( editor !== null && typeof( editor.getContent ) === "function" && ! editor.isHidden() ) {
|
1134 |
+
editor.setContent( value );
|
1135 |
+
}
|
1136 |
+
else {
|
1137 |
+
$$.val( value );
|
1138 |
+
}
|
1139 |
+
}
|
1140 |
+
else {
|
1141 |
+
$$.val( value );
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
$$.trigger( 'change' );
|
1145 |
+
|
1146 |
+
});
|
1147 |
+
};
|
1148 |
+
|
1149 |
+
// When we click on a widget top
|
1150 |
+
$('.widgets-holder-wrap').on('click', '.widget:has(.siteorigin-widget-form-main) .widget-top', function () {
|
1151 |
+
var $$ = $(this).closest('.widget').find('.siteorigin-widget-form-main');
|
1152 |
+
setTimeout(function () {
|
1153 |
+
$$.sowSetupForm();
|
1154 |
+
}, 200);
|
1155 |
+
});
|
1156 |
+
|
1157 |
+
if ( $('body').hasClass('wp-customizer') ) {
|
1158 |
+
// Setup new widgets when they're added in the customizer interface
|
1159 |
+
$(document).on('widget-added', function (e, widget) {
|
1160 |
+
widget.find('.siteorigin-widget-form').sowSetupForm();
|
1161 |
+
});
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
$( document ).on( 'open_dialog', function ( e, dialog ) {
|
1165 |
+
// When we open a Page Builder edit widget dialog
|
1166 |
+
if ( dialog.$el.find( '.so-panels-dialog' ).is( '.so-panels-dialog-edit-widget' ) ) {
|
1167 |
+
var $fields = $( e.target ).find( '.siteorigin-widget-form-main' ).find( '> .siteorigin-widget-field' );
|
1168 |
+
$fields.trigger( 'sowsetupformfield' );
|
1169 |
+
}
|
1170 |
+
});
|
1171 |
+
|
1172 |
+
$(function () {
|
1173 |
+
$(document).trigger('sowadminloaded');
|
1174 |
+
});
|
1175 |
+
|
1176 |
+
})(jQuery);
|
1177 |
+
|
1178 |
+
var sowEmitters = {
|
1179 |
+
|
1180 |
+
/**
|
1181 |
+
* Find the group/state and an extra match part.
|
1182 |
+
*
|
1183 |
+
* @param arg
|
1184 |
+
* @param matchPart
|
1185 |
+
* @return {*}
|
1186 |
+
*/
|
1187 |
+
'_match': function (arg, matchPart) {
|
1188 |
+
if (typeof matchPart === 'undefined') {
|
1189 |
+
matchPart = '.*';
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
// Create the regular expression to match the group/state and extra match
|
1193 |
+
var exp = new RegExp('^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *(' + matchPart + ') *$');
|
1194 |
+
var m = exp.exec(arg);
|
1195 |
+
|
1196 |
+
if (m === null) {
|
1197 |
+
return false;
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
var state = '';
|
1201 |
+
var group = 'default';
|
1202 |
+
|
1203 |
+
if (m[3] !== undefined) {
|
1204 |
+
group = m[1];
|
1205 |
+
state = m[3];
|
1206 |
+
}
|
1207 |
+
else {
|
1208 |
+
state = m[1];
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
return {
|
1212 |
+
'match': m[4].trim(),
|
1213 |
+
'group': group,
|
1214 |
+
'state': state
|
1215 |
+
};
|
1216 |
+
},
|
1217 |
+
|
1218 |
+
'_checker': function (val, args, matchPart, callback) {
|
1219 |
+
var returnStates = {};
|
1220 |
+
if (typeof args.length === 'undefined') {
|
1221 |
+
args = [args];
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
var m;
|
1225 |
+
for (var i = 0; i < args.length; i++) {
|
1226 |
+
m = sowEmitters._match(args[i], matchPart);
|
1227 |
+
if (m === false) {
|
1228 |
+
continue;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
if (m.match === '_true' || callback(val, args, m.match)) {
|
1232 |
+
returnStates[m.group] = m.state;
|
1233 |
+
}
|
1234 |
+
}
|
1235 |
+
|
1236 |
+
return returnStates;
|
1237 |
+
},
|
1238 |
+
|
1239 |
+
/**
|
1240 |
+
* A very simple state emitter that simply sets the given group the value
|
1241 |
+
*
|
1242 |
+
*
|
1243 |
+
* @param val
|
1244 |
+
* @param args
|
1245 |
+
* @returns {{}}
|
1246 |
+
*/
|
1247 |
+
'select': function (val, args) {
|
1248 |
+
if (typeof args.length === 'undefined') {
|
1249 |
+
args = [args];
|
1250 |
+
}
|
1251 |
+
|
1252 |
+
var returnGroups = {};
|
1253 |
+
for (var i = 0; i < args.length; i++) {
|
1254 |
+
if (args[i] === '') {
|
1255 |
+
args[i] = 'default';
|
1256 |
+
}
|
1257 |
+
returnGroups[args[i]] = val;
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
return returnGroups;
|
1261 |
+
},
|
1262 |
+
|
1263 |
+
/**
|
1264 |
+
* The conditional state emitter uses eval to check a given conditional argument.
|
1265 |
+
*
|
1266 |
+
* @param val
|
1267 |
+
* @param args
|
1268 |
+
* @return {{}}
|
1269 |
+
*/
|
1270 |
+
'conditional': function (val, args) {
|
1271 |
+
return sowEmitters._checker(val, args, '[^;{}]*', function (val, args, match) {
|
1272 |
+
return eval(match);
|
1273 |
+
});
|
1274 |
+
},
|
1275 |
+
|
1276 |
+
/**
|
1277 |
+
* The in state emitter checks if the value is in an array of functions
|
1278 |
+
*
|
1279 |
+
* @param val
|
1280 |
+
* @param args
|
1281 |
+
* @return {{}}
|
1282 |
+
*/
|
1283 |
+
'in': function (val, args) {
|
1284 |
+
return sowEmitters._checker(val, args, '[^;{}]*', function (val, args, match) {
|
1285 |
+
return match.split(',').map(function (s) {
|
1286 |
+
return s.trim();
|
1287 |
+
}).indexOf(val) !== -1;
|
1288 |
+
});
|
1289 |
+
}
|
1290 |
+
};
|
1291 |
+
|
1292 |
+
window.sowbForms = sowbForms;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
base/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,f,g,p={},c=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==c){var u={};for(var m in n)u[m.replace("{$repeater}",c)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(f=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&void 0===p[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<g.length&&!(f=o.group===t&&g[k]===r);k++);}if(f){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);p[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})});var l=n.find("> .siteorigin-widgets-form-id").val(),f=n.find("> .siteorigin-widgets-form-timestamp"),g=parseInt(f.val()||0),p=JSON.parse(sessionStorage.getItem(l));if(p)if(p._sow_form_timestamp>g){var c=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(c),c.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,p),c.slideUp("fast",function(){c.remove()})}),c.find(".so-backup-dismiss").click(function(){c.slideUp("fast",function(){sessionStorage.removeItem(l),c.remove()})})}else sessionStorage.removeItem(l);n.change(function(){f.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label=" "),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",v),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.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,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==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 r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.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 r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[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,n),o=void 0!==r.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(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.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 r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.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";r.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(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var r=e(this).closest(".siteorigin-widget-field-repeater-items"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=function(){n.remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?a():confirm(soWidgets.sure)&&n.slideUp("fast",a)}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.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=s?n.find("#"+s):n.find('[name="'+l+'"]');c.length&&null!=c.val()&&i.val(c.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+$/,"");var v=s.replace(/-\d+$/,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+$/)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+$"),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;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 y=n.parents(".siteorigin-widget-field-repeater").length,F=e("body");(F.hasClass("wp-customizer")||F.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(y+=1);var k=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(y-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()})}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var f=0;f<n.length;f++)f===n.length-1?""===n[f]?a.push(s):a[n[f]]=s:(_.isUndefined(a[n[f]])&&(_.isNumber(n[f+1])||""===n[f+1]?a[n[f]]=[]:a[n[f]]={}),a=a[n[f]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r){r=r||!1;var n=0,a=function(i,t){10!=++n&&i.find("> .siteorigin-widget-field-type-repeater").each(function(){var i=e(this).find("> .siteorigin-widget-field-repeater"),n=i.data("repeaterName"),s=t.hasOwnProperty(n)?t[n]:null;if(s&&Array.isArray(s)){var o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),d=s.length,l=o.length;if(d>l)for(var f=0;f<d-l;f++)i.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&d<l)for(var g=d;g<l;g++){var p=e(o.eq(g));p.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var c=0;c<o.length;c++)o.eq(c).find("> .siteorigin-widget-field-repeater-item-form"),a(o.eq(c).find("> .siteorigin-widget-field-repeater-item-form"),s[c])}})};a(i,t),i.find("*[name]").each(function(){var i=e(this),n=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===n||null===n)return!0;n=n[1];var a=n.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var s,o=t,d=0;d<a.length;d++){if(!o.hasOwnProperty(a[d])){if(r)return!0;break}d===a.length-1?s=o[a[d]]:o=o[a[d]]}if("checkbox"===i.attr("type"))i.prop("checked",s);else if("radio"===i.attr("type"))i.prop("checked",s===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var l=null;"undefined"!=typeof tinyMCE&&(l=tinyMCE.get(i.attr("id"))),null===l||"function"!=typeof l.getContent||l.isHidden()?i.val(s):l.setContent(s)}else i.val(s);i.trigger("change")})},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("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
|
1 |
+
var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,g,f,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(g=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",g=o.group===t&&void 0===c[o.group];else{f=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<f.length&&!(g=o.group===t&&f[k]===r);k++);}if(g){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})});var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>f){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label=" "),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",v),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.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,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==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 r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.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 r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[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,n),o=void 0!==r.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(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.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";r.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(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var n=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),n.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s),r.trigger("change")}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.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 g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");f.remove(),c.append(i.remove())}else{var p=s?n.find("#"+s):n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+$/,"");var v=s.replace(/-\d+$/,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+$/)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+$"),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;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 y=n.parents(".siteorigin-widget-field-repeater").length,F=e("body");(F.hasClass("wp-customizer")||F.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(y+=1);var k=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(y-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()}),r.trigger("change")}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("SELECT"===i.prop("tagName")){var d=i.find("option:selected");1===d.length?s=i.find("option:selected").val():d.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var l=0;l<n.length;l++)l===n.length-1?""===n[l]?a.push(s):a[n[l]]=s:(_.isUndefined(a[n[l]])&&(_.isNumber(n[l+1])||""===n[l+1]?a[n[l]]=[]:a[n[l]]={}),a=a[n[l]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r){r=r||!1;var n=0,a=function(i,t){10!=++n&&i.find("> .siteorigin-widget-field-type-repeater").each(function(){var i=e(this).find("> .siteorigin-widget-field-repeater"),n=i.data("repeaterName"),s=t.hasOwnProperty(n)?t[n]:null;if(s&&Array.isArray(s)){var o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),d=s.length,l=o.length;if(d>l)for(var g=0;g<d-l;g++)i.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&d<l)for(var f=d;f<l;f++){var c=e(o.eq(f));c.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var p=0;p<o.length;p++)o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),a(o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),s[p])}})};a(i,t),i.find("*[name]").each(function(){var i=e(this),n=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===n||null===n)return!0;n=n[1];var a=n.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var s,o=t,d=0;d<a.length;d++){if(!o.hasOwnProperty(a[d])){if(r)return!0;break}d===a.length-1?s=o[a[d]]:o=o[a[d]]}if("checkbox"===i.attr("type"))i.prop("checked",s);else if("radio"===i.attr("type"))i.prop("checked",s===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var l=null;"undefined"!=typeof tinyMCE&&(l=tinyMCE.get(i.attr("id"))),null===l||"function"!=typeof l.getContent||l.isHidden()?i.val(s):l.setContent(s)}else i.val(s);i.trigger("change")})},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("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
|
compat/beaver-builder/beaver-builder.php
CHANGED
@@ -1,97 +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 |
-
// Don't want to show the form preview button when using Beaver Builder
|
28 |
-
add_filter( 'siteorigin_widgets_form_show_preview_button', '__return_false' );
|
29 |
-
}
|
30 |
-
|
31 |
-
function enqueue_active_widgets_scripts() {
|
32 |
-
global $wp_widget_factory;
|
33 |
-
|
34 |
-
// Beaver Builder does it's editing in the front end so enqueue required form scripts for active widgets.
|
35 |
-
$any_widgets_active = false;
|
36 |
-
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
37 |
-
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
38 |
-
$any_widgets_active = true;
|
39 |
-
ob_start();
|
40 |
-
$widget_obj->form( array() );
|
41 |
-
ob_clean();
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
// No widgets active. :/ Let's get outta here.
|
46 |
-
if ( ! $any_widgets_active ) {
|
47 |
-
return;
|
48 |
-
}
|
49 |
-
|
50 |
-
if ( ! wp_script_is( 'wp-color-picker' ) ) {
|
51 |
-
// wp-color-picker hasn't been registered because we're in the front end, so enqueue with full args.
|
52 |
-
wp_enqueue_script( 'iris', '/wp-admin/js/iris.min.js', array(
|
53 |
-
'jquery-ui-draggable',
|
54 |
-
'jquery-ui-slider',
|
55 |
-
'jquery-touch-punch'
|
56 |
-
), '1.0.7', 1 );
|
57 |
-
|
58 |
-
wp_enqueue_script( 'wp-color-picker', '/wp-admin/js/color-picker' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'iris' ), false, 1 );
|
59 |
-
|
60 |
-
wp_enqueue_style( 'wp-color-picker' );
|
61 |
-
|
62 |
-
// Localization args for when wp-color-picker script hasn't been registered.
|
63 |
-
wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array(
|
64 |
-
'clear' => __( 'Clear', 'so-widgets-bundle' ),
|
65 |
-
'defaultString' => __( 'Default', 'so-widgets-bundle' ),
|
66 |
-
'pick' => __( 'Select Color', 'so-widgets-bundle' ),
|
67 |
-
'current' => __( 'Current Color', 'so-widgets-bundle' ),
|
68 |
-
) );
|
69 |
-
}
|
70 |
-
|
71 |
-
wp_enqueue_style( 'sowb-styles-for-beaver', plugin_dir_url( __FILE__ ) . 'styles.css' );
|
72 |
-
|
73 |
-
$deps = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? array( 'jquery', 'fl-builder' ) : array( 'fl-builder-min' );
|
74 |
-
wp_enqueue_script(
|
75 |
-
'sowb-js-for-beaver',
|
76 |
-
plugin_dir_url( __FILE__ ) . 'sowb-beaver-builder' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
77 |
-
$deps
|
78 |
-
);
|
79 |
-
|
80 |
-
wp_enqueue_style( 'siteorigin-widget-admin', plugin_dir_url(SOW_BUNDLE_BASE_FILE).'base/css/admin.css', array( 'media-views' ), SOW_BUNDLE_VERSION );
|
81 |
-
|
82 |
-
}
|
83 |
-
|
84 |
-
function print_footer_templates() {
|
85 |
-
global $wp_widget_factory;
|
86 |
-
|
87 |
-
// Beaver Builder does it's editing in the front end so print required footer templates for active widgets.
|
88 |
-
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
89 |
-
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
90 |
-
$widget_obj->footer_admin_templates();
|
91 |
-
}
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
}
|
96 |
-
|
97 |
-
SiteOrigin_Widgets_Bundle_Beaver_Builder::single();
|
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 |
+
// Don't want to show the form preview button when using Beaver Builder
|
28 |
+
add_filter( 'siteorigin_widgets_form_show_preview_button', '__return_false' );
|
29 |
+
}
|
30 |
+
|
31 |
+
function enqueue_active_widgets_scripts() {
|
32 |
+
global $wp_widget_factory;
|
33 |
+
|
34 |
+
// Beaver Builder does it's editing in the front end so enqueue required form scripts for active widgets.
|
35 |
+
$any_widgets_active = false;
|
36 |
+
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
37 |
+
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
38 |
+
$any_widgets_active = true;
|
39 |
+
ob_start();
|
40 |
+
$widget_obj->form( array() );
|
41 |
+
ob_clean();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
// No widgets active. :/ Let's get outta here.
|
46 |
+
if ( ! $any_widgets_active ) {
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
if ( ! wp_script_is( 'wp-color-picker' ) ) {
|
51 |
+
// wp-color-picker hasn't been registered because we're in the front end, so enqueue with full args.
|
52 |
+
wp_enqueue_script( 'iris', '/wp-admin/js/iris.min.js', array(
|
53 |
+
'jquery-ui-draggable',
|
54 |
+
'jquery-ui-slider',
|
55 |
+
'jquery-touch-punch'
|
56 |
+
), '1.0.7', 1 );
|
57 |
+
|
58 |
+
wp_enqueue_script( 'wp-color-picker', '/wp-admin/js/color-picker' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'iris' ), false, 1 );
|
59 |
+
|
60 |
+
wp_enqueue_style( 'wp-color-picker' );
|
61 |
+
|
62 |
+
// Localization args for when wp-color-picker script hasn't been registered.
|
63 |
+
wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array(
|
64 |
+
'clear' => __( 'Clear', 'so-widgets-bundle' ),
|
65 |
+
'defaultString' => __( 'Default', 'so-widgets-bundle' ),
|
66 |
+
'pick' => __( 'Select Color', 'so-widgets-bundle' ),
|
67 |
+
'current' => __( 'Current Color', 'so-widgets-bundle' ),
|
68 |
+
) );
|
69 |
+
}
|
70 |
+
|
71 |
+
wp_enqueue_style( 'sowb-styles-for-beaver', plugin_dir_url( __FILE__ ) . 'styles.css' );
|
72 |
+
|
73 |
+
$deps = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? array( 'jquery', 'fl-builder' ) : array( 'fl-builder-min' );
|
74 |
+
wp_enqueue_script(
|
75 |
+
'sowb-js-for-beaver',
|
76 |
+
plugin_dir_url( __FILE__ ) . 'sowb-beaver-builder' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
77 |
+
$deps
|
78 |
+
);
|
79 |
+
|
80 |
+
wp_enqueue_style( 'siteorigin-widget-admin', plugin_dir_url(SOW_BUNDLE_BASE_FILE).'base/css/admin.css', array( 'media-views' ), SOW_BUNDLE_VERSION );
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
function print_footer_templates() {
|
85 |
+
global $wp_widget_factory;
|
86 |
+
|
87 |
+
// Beaver Builder does it's editing in the front end so print required footer templates for active widgets.
|
88 |
+
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
|
89 |
+
if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
|
90 |
+
$widget_obj->footer_admin_templates();
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
SiteOrigin_Widgets_Bundle_Beaver_Builder::single();
|
compat/compat.php
CHANGED
@@ -1,55 +1,55 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class SiteOrigin_Widgets_Bundle_Compatibility {
|
4 |
-
|
5 |
-
const BEAVER_BUILDER = 'Beaver Builder';
|
6 |
-
const ELEMENTOR = 'Elementor';
|
7 |
-
const VISUAL_COMPOSER = 'Visual Composer';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Get the singleton instance
|
11 |
-
*
|
12 |
-
* @return SiteOrigin_Widgets_Bundle_Compatibility
|
13 |
-
*/
|
14 |
-
public static function single() {
|
15 |
-
static $single;
|
16 |
-
return empty( $single ) ? $single = new self() : $single;
|
17 |
-
}
|
18 |
-
|
19 |
-
function __construct() {
|
20 |
-
$builder = $this->get_active_builder();
|
21 |
-
if ( ! empty( $builder ) ) {
|
22 |
-
require_once $builder['file_path'];
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
function get_active_builder() {
|
27 |
-
|
28 |
-
$builders = include_once 'builders.php';
|
29 |
-
|
30 |
-
foreach ( $builders as $builder ) {
|
31 |
-
if ( $this->is_active( $builder ) ) {
|
32 |
-
return $builder;
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
return null;
|
37 |
-
}
|
38 |
-
|
39 |
-
function is_active( $builder ) {
|
40 |
-
switch ( $builder[ 'name' ] ) {
|
41 |
-
case self::BEAVER_BUILDER:
|
42 |
-
return class_exists( 'FLBuilderModel', false );
|
43 |
-
break;
|
44 |
-
case self::ELEMENTOR:
|
45 |
-
return class_exists( 'Elementor\\Plugin', false );
|
46 |
-
break;
|
47 |
-
case self::VISUAL_COMPOSER:
|
48 |
-
return class_exists( 'Vc_Manager' );
|
49 |
-
break;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
SiteOrigin_Widgets_Bundle_Compatibility::single();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SiteOrigin_Widgets_Bundle_Compatibility {
|
4 |
+
|
5 |
+
const BEAVER_BUILDER = 'Beaver Builder';
|
6 |
+
const ELEMENTOR = 'Elementor';
|
7 |
+
const VISUAL_COMPOSER = 'Visual Composer';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Get the singleton instance
|
11 |
+
*
|
12 |
+
* @return SiteOrigin_Widgets_Bundle_Compatibility
|
13 |
+
*/
|
14 |
+
public static function single() {
|
15 |
+
static $single;
|
16 |
+
return empty( $single ) ? $single = new self() : $single;
|
17 |
+
}
|
18 |
+
|
19 |
+
function __construct() {
|
20 |
+
$builder = $this->get_active_builder();
|
21 |
+
if ( ! empty( $builder ) ) {
|
22 |
+
require_once $builder['file_path'];
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
function get_active_builder() {
|
27 |
+
|
28 |
+
$builders = include_once 'builders.php';
|
29 |
+
|
30 |
+
foreach ( $builders as $builder ) {
|
31 |
+
if ( $this->is_active( $builder ) ) {
|
32 |
+
return $builder;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
return null;
|
37 |
+
}
|
38 |
+
|
39 |
+
function is_active( $builder ) {
|
40 |
+
switch ( $builder[ 'name' ] ) {
|
41 |
+
case self::BEAVER_BUILDER:
|
42 |
+
return class_exists( 'FLBuilderModel', false );
|
43 |
+
break;
|
44 |
+
case self::ELEMENTOR:
|
45 |
+
return class_exists( 'Elementor\\Plugin', false );
|
46 |
+
break;
|
47 |
+
case self::VISUAL_COMPOSER:
|
48 |
+
return class_exists( 'Vc_Manager' );
|
49 |
+
break;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
SiteOrigin_Widgets_Bundle_Compatibility::single();
|
js/sow.google.map.js
CHANGED
@@ -1,473 +1,473 @@
|
|
1 |
-
/* globals jQuery, google, sowb */
|
2 |
-
|
3 |
-
var sowb = window.sowb || {};
|
4 |
-
|
5 |
-
sowb.SiteOriginGoogleMap = function($) {
|
6 |
-
return {
|
7 |
-
// So that we can always display something, even if no location or address was entered.
|
8 |
-
DEFAULT_LOCATIONS: [
|
9 |
-
'Addo Elephant National Park, R335, Addo',
|
10 |
-
'Cape Town, Western Cape, South Africa',
|
11 |
-
'San Francisco Bay Area, CA, United States',
|
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';
|
21 |
-
|
22 |
-
var mapOptions = {
|
23 |
-
zoom: zoom,
|
24 |
-
scrollwheel: options.scrollZoom,
|
25 |
-
draggable: options.draggable,
|
26 |
-
disableDefaultUI: options.disableUi,
|
27 |
-
zoomControl: options.zoomControl,
|
28 |
-
panControl: options.panControl,
|
29 |
-
center: location,
|
30 |
-
mapTypeControlOptions: {
|
31 |
-
mapTypeIds: [google.maps.MapTypeId.ROADMAP, userMapTypeId]
|
32 |
-
}
|
33 |
-
};
|
34 |
-
|
35 |
-
var map = new google.maps.Map(element, mapOptions);
|
36 |
-
|
37 |
-
var userMapOptions = {
|
38 |
-
name: options.mapName
|
39 |
-
};
|
40 |
-
|
41 |
-
var userMapStyles = options.mapStyles;
|
42 |
-
|
43 |
-
if ( userMapStyles ) {
|
44 |
-
var userMapType = new google.maps.StyledMapType(userMapStyles, userMapOptions);
|
45 |
-
|
46 |
-
map.mapTypes.set(userMapTypeId, userMapType);
|
47 |
-
map.setMapTypeId(userMapTypeId);
|
48 |
-
}
|
49 |
-
|
50 |
-
if (options.markerAtCenter) {
|
51 |
-
this.centerMarker = new google.maps.Marker({
|
52 |
-
position: location,
|
53 |
-
map: map,
|
54 |
-
draggable: options.markersDraggable,
|
55 |
-
icon: options.markerIcon,
|
56 |
-
title: ''
|
57 |
-
});
|
58 |
-
}
|
59 |
-
|
60 |
-
if(options.keepCentered) {
|
61 |
-
var center;
|
62 |
-
google.maps.event.addDomListener(map, 'idle', function () {
|
63 |
-
center = map.getCenter();
|
64 |
-
});
|
65 |
-
google.maps.event.addDomListener(window, 'resize', function () {
|
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 |
-
// If the Google Maps element is hidden it won't display properly. This is an attempt to make it display by
|
75 |
-
// calling resize when a custom 'show' event is fired. The 'show' event is something we fire in a few widgets
|
76 |
-
// like Accordion and Tabs and in future any widgets which might show and hide content using `display:none;`.
|
77 |
-
if ( $( element ).is( ':hidden' ) ) {
|
78 |
-
var $visParent = $( element ).closest( ':visible' );
|
79 |
-
$visParent.find( '> :hidden' ).on( 'show', function () {
|
80 |
-
google.maps.event.trigger(map, 'resize');
|
81 |
-
map.setCenter(location);
|
82 |
-
} );
|
83 |
-
}
|
84 |
-
|
85 |
-
},
|
86 |
-
|
87 |
-
linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
|
88 |
-
if( autocomplete && autocompleteElement ) {
|
89 |
-
|
90 |
-
var updateMapLocation = function ( address ) {
|
91 |
-
if ( this.inputAddress !== address ) {
|
92 |
-
this.inputAddress = address;
|
93 |
-
this.getLocation( this.inputAddress ).done(
|
94 |
-
function ( location ) {
|
95 |
-
map.setZoom( 15 );
|
96 |
-
map.setCenter( location );
|
97 |
-
if( this.centerMarker ) {
|
98 |
-
this.centerMarker.setPosition( location );
|
99 |
-
this.centerMarker.setTitle( this.inputAddress );
|
100 |
-
}
|
101 |
-
}.bind( this )
|
102 |
-
);
|
103 |
-
}
|
104 |
-
}.bind( this );
|
105 |
-
|
106 |
-
var $autocompleteElement = $( autocompleteElement );
|
107 |
-
autocomplete.addListener( 'place_changed', function () {
|
108 |
-
var place = autocomplete.getPlace();
|
109 |
-
map.setZoom( 15 );
|
110 |
-
if ( place.geometry ) {
|
111 |
-
map.setCenter( place.geometry.location );
|
112 |
-
if( this.centerMarker ) {
|
113 |
-
this.centerMarker.setPosition(place.geometry.location);
|
114 |
-
}
|
115 |
-
}
|
116 |
-
}.bind( this ) );
|
117 |
-
|
118 |
-
google.maps.event.addDomListener( autocompleteElement, 'keypress', function ( event ) {
|
119 |
-
var key = event.keyCode || event.which;
|
120 |
-
if ( key === '13' ) {
|
121 |
-
event.preventDefault();
|
122 |
-
}
|
123 |
-
} );
|
124 |
-
|
125 |
-
$autocompleteElement.focusin( function () {
|
126 |
-
if ( !this.resultsObserver ) {
|
127 |
-
var autocompleteResultsContainer = document.querySelector( '.pac-container' );
|
128 |
-
this.resultsObserver = new MutationObserver( function () {
|
129 |
-
var $topResult = $( $( '.pac-item' ).get( 0 ) );
|
130 |
-
var queryPartA = $topResult.find( '.pac-item-query' ).text();
|
131 |
-
var queryPartB = $topResult.find( 'span' ).not( '[class]' ).text();
|
132 |
-
var topQuery = queryPartA + ( queryPartB ? (', ' + queryPartB) : '' );
|
133 |
-
if ( topQuery ) {
|
134 |
-
updateMapLocation( topQuery );
|
135 |
-
}
|
136 |
-
} );
|
137 |
-
|
138 |
-
var config = { attributes: true, childList: true, characterData: true };
|
139 |
-
|
140 |
-
this.resultsObserver.observe( autocompleteResultsContainer, config );
|
141 |
-
}
|
142 |
-
}.bind( this ) );
|
143 |
-
|
144 |
-
var revGeocode = function ( latLng ) {
|
145 |
-
this.getGeocoder().geocode( { location: latLng }, function ( results, status ) {
|
146 |
-
if ( status === google.maps.GeocoderStatus.OK ) {
|
147 |
-
if ( results.length > 0 ) {
|
148 |
-
var addr = results[ 0 ].formatted_address;
|
149 |
-
$autocompleteElement.val( addr );
|
150 |
-
if( this.centerMarker ) {
|
151 |
-
this.centerMarker.setPosition(latLng);
|
152 |
-
this.centerMarker.setTitle(addr);
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
156 |
-
}.bind( this ) );
|
157 |
-
}.bind( this );
|
158 |
-
|
159 |
-
map.addListener( 'click', function ( event ) {
|
160 |
-
revGeocode( event.latLng );
|
161 |
-
} );
|
162 |
-
|
163 |
-
this.centerMarker.addListener( 'dragend', function ( event ) {
|
164 |
-
revGeocode( event.latLng );
|
165 |
-
} );
|
166 |
-
}
|
167 |
-
},
|
168 |
-
|
169 |
-
showMarkers: function(markerPositions, map, options) {
|
170 |
-
if ( markerPositions && markerPositions.length ) {
|
171 |
-
this.infoWindows = [];
|
172 |
-
var markerBatches = [];
|
173 |
-
var BATCH_SIZE = 10;
|
174 |
-
// Group markers into batches of 10 in attempt to avoid query limits
|
175 |
-
for ( var i = 0; i < markerPositions.length; i++ ) {
|
176 |
-
var batchIndex = parseInt( i / BATCH_SIZE ); // truncate decimals
|
177 |
-
if ( markerBatches.length === batchIndex ) {
|
178 |
-
markerBatches[ batchIndex ] = [];
|
179 |
-
}
|
180 |
-
markerBatches[ batchIndex ][ i % BATCH_SIZE ] = markerPositions[ i ];
|
181 |
-
}
|
182 |
-
|
183 |
-
var geocodeMarkerBatch = function ( markerBatchHead, markerBatchTail ) {
|
184 |
-
var doneCount = 0;
|
185 |
-
markerBatchHead.forEach( function ( mrkr ) {
|
186 |
-
this.getLocation( mrkr.place ).done( function ( location ) {
|
187 |
-
var mrkerIcon = options.markerIcon;
|
188 |
-
if(mrkr.custom_marker_icon) {
|
189 |
-
mrkerIcon = mrkr.custom_marker_icon;
|
190 |
-
}
|
191 |
-
|
192 |
-
var marker = new google.maps.Marker( {
|
193 |
-
position: location,
|
194 |
-
map: map,
|
195 |
-
draggable: options.markersDraggable,
|
196 |
-
icon: mrkerIcon,
|
197 |
-
title: ''
|
198 |
-
} );
|
199 |
-
|
200 |
-
if ( mrkr.hasOwnProperty( 'info' ) && mrkr.info ) {
|
201 |
-
var infoWindowOptions = { content: mrkr.info };
|
202 |
-
|
203 |
-
if ( mrkr.hasOwnProperty( 'info_max_width' ) && mrkr.info_max_width ) {
|
204 |
-
infoWindowOptions.maxWidth = mrkr.info_max_width;
|
205 |
-
}
|
206 |
-
|
207 |
-
var infoDisplay = options.markerInfoDisplay;
|
208 |
-
infoWindowOptions.disableAutoPan = infoDisplay === 'always';
|
209 |
-
var infoWindow = new google.maps.InfoWindow( infoWindowOptions );
|
210 |
-
this.infoWindows.push( infoWindow );
|
211 |
-
var openEvent = infoDisplay;
|
212 |
-
if ( infoDisplay === 'always' ) {
|
213 |
-
openEvent = 'click';
|
214 |
-
infoWindow.open( map, marker );
|
215 |
-
}
|
216 |
-
marker.addListener( openEvent, function () {
|
217 |
-
infoWindow.open( map, marker );
|
218 |
-
if ( infoDisplay !== 'always' && !options.markerInfoMultiple ) {
|
219 |
-
this.infoWindows.forEach( function ( iw ) {
|
220 |
-
if ( iw !== infoWindow ) {
|
221 |
-
iw.close();
|
222 |
-
}
|
223 |
-
} );
|
224 |
-
}
|
225 |
-
}.bind( this ) );
|
226 |
-
if ( infoDisplay === 'mouseover' ) {
|
227 |
-
marker.addListener( 'mouseout', function () {
|
228 |
-
setTimeout( function () {
|
229 |
-
infoWindow.close();
|
230 |
-
}, 100 );
|
231 |
-
} );
|
232 |
-
}
|
233 |
-
}
|
234 |
-
if ( ++doneCount === markerBatchHead.length && markerBatchTail.length ) {
|
235 |
-
geocodeMarkerBatch( markerBatchTail.shift(), markerBatchTail );
|
236 |
-
}
|
237 |
-
}.bind( this ) );
|
238 |
-
}.bind( this ) );
|
239 |
-
}.bind( this );
|
240 |
-
geocodeMarkerBatch( markerBatches.shift(), markerBatches );
|
241 |
-
|
242 |
-
}
|
243 |
-
},
|
244 |
-
showDirections: function(directions, map) {
|
245 |
-
if ( directions ) {
|
246 |
-
if ( directions.waypoints && directions.waypoints.length ) {
|
247 |
-
directions.waypoints.map(
|
248 |
-
function (wypt) {
|
249 |
-
wypt.stopover = Boolean(wypt.stopover);
|
250 |
-
}
|
251 |
-
);
|
252 |
-
}
|
253 |
-
|
254 |
-
var directionsRenderer = new google.maps.DirectionsRenderer();
|
255 |
-
directionsRenderer.setMap(map);
|
256 |
-
|
257 |
-
var directionsService = new google.maps.DirectionsService();
|
258 |
-
directionsService.route({
|
259 |
-
origin: directions.origin,
|
260 |
-
destination: directions.destination,
|
261 |
-
travelMode: directions.travelMode.toUpperCase(),
|
262 |
-
avoidHighways: directions.avoidHighways,
|
263 |
-
avoidTolls: directions.avoidTolls,
|
264 |
-
waypoints: directions.waypoints,
|
265 |
-
optimizeWaypoints: directions.optimizeWaypoints,
|
266 |
-
},
|
267 |
-
function(result, status) {
|
268 |
-
if (status === google.maps.DirectionsStatus.OK) {
|
269 |
-
directionsRenderer.setOptions( { preserveViewport: directions.preserveViewport } );
|
270 |
-
directionsRenderer.setDirections(result);
|
271 |
-
}
|
272 |
-
});
|
273 |
-
}
|
274 |
-
},
|
275 |
-
initMaps: function() {
|
276 |
-
// Init any autocomplete fields first.
|
277 |
-
var $autoCompleteFields = $( '.sow-google-map-autocomplete' );
|
278 |
-
var autoCompleteInit = new $.Deferred();
|
279 |
-
if( $autoCompleteFields.length === 0 ) {
|
280 |
-
autoCompleteInit.resolve();
|
281 |
-
} else {
|
282 |
-
$autoCompleteFields.each(function (index, element) {
|
283 |
-
|
284 |
-
if ( typeof google.maps.places === 'undefined' ) {
|
285 |
-
autoCompleteInit.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');
|
286 |
-
return;
|
287 |
-
}
|
288 |
-
|
289 |
-
var autocomplete = new google.maps.places.Autocomplete(
|
290 |
-
element,
|
291 |
-
{types: ['address']}
|
292 |
-
);
|
293 |
-
|
294 |
-
var $mapField = $(element).siblings('.sow-google-map-canvas');
|
295 |
-
|
296 |
-
if ($mapField.length > 0) {
|
297 |
-
var options = $mapField.data('options');
|
298 |
-
options.autocomplete = autocomplete;
|
299 |
-
options.autocompleteElement = element;
|
300 |
-
this.getLocation(options.address).done(
|
301 |
-
function (location) {
|
302 |
-
this.showMap($mapField.get(0), location, options);
|
303 |
-
$mapField.data('initialized', true);
|
304 |
-
autoCompleteInit.resolve();
|
305 |
-
}.bind(this)
|
306 |
-
).fail(function () {
|
307 |
-
$mapField.append('<div><p><strong>' + soWidgetsGoogleMap.geocode.noResults + '</strong></p></div>');
|
308 |
-
autoCompleteInit.reject();
|
309 |
-
});
|
310 |
-
}
|
311 |
-
}.bind(this));
|
312 |
-
}
|
313 |
-
|
314 |
-
autoCompleteInit.always(function(){
|
315 |
-
$('.sow-google-map-canvas').each(function (index, element) {
|
316 |
-
var $$ = $(element);
|
317 |
-
|
318 |
-
if( $$.data( 'initialized' ) ) {
|
319 |
-
// Already initialized so continue to next element.
|
320 |
-
return true;
|
321 |
-
}
|
322 |
-
|
323 |
-
var options = $$.data( 'options' );
|
324 |
-
var address = options.address;
|
325 |
-
// If no address was specified, but we have markers, use the first marker as the map center.
|
326 |
-
if(!address) {
|
327 |
-
var markers = options.markerPositions;
|
328 |
-
if(markers && markers.length) {
|
329 |
-
address = markers[0].place;
|
330 |
-
}
|
331 |
-
}
|
332 |
-
|
333 |
-
this.getLocation( address ).done(
|
334 |
-
function ( location ) {
|
335 |
-
this.showMap( $$.get( 0 ), location, options );
|
336 |
-
$$.data( 'initialized' );
|
337 |
-
}.bind( this )
|
338 |
-
).fail( function () {
|
339 |
-
$$.append( '<div><p><strong>' + soWidgetsGoogleMap.geocode.noResults + '</strong></p></div>' );
|
340 |
-
} );
|
341 |
-
|
342 |
-
}.bind(this));
|
343 |
-
}.bind(this))
|
344 |
-
.fail(function(error){
|
345 |
-
console.log(error);
|
346 |
-
});
|
347 |
-
},
|
348 |
-
getGeocoder: function () {
|
349 |
-
if ( !this._geocoder ) {
|
350 |
-
this._geocoder = new google.maps.Geocoder();
|
351 |
-
}
|
352 |
-
return this._geocoder;
|
353 |
-
},
|
354 |
-
getLocation: function ( inputLocation ) {
|
355 |
-
var locationPromise = new $.Deferred();
|
356 |
-
var location = { address: inputLocation };
|
357 |
-
//check if address is actually a valid latlng
|
358 |
-
var latLng;
|
359 |
-
if ( inputLocation && inputLocation.indexOf( ',' ) > -1 ) {
|
360 |
-
var vals = inputLocation.split( ',' );
|
361 |
-
// A latlng value should be of the format 'lat,lng'
|
362 |
-
if ( vals && vals.length === 2 ) {
|
363 |
-
latLng = new google.maps.LatLng( vals[ 0 ], vals[ 1 ] );
|
364 |
-
// Let the API decide if we have a valid latlng
|
365 |
-
// This should fail if the input is an address containing a comma
|
366 |
-
// e.g. 123 Sesame Street, Middleburg, FL, United States
|
367 |
-
if ( !(isNaN( latLng.lat() ) || isNaN( latLng.lng() )) ) {
|
368 |
-
location = { location: { lat: latLng.lat(), lng: latLng.lng() } };
|
369 |
-
}
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
if ( location.hasOwnProperty( 'location' ) ) {
|
374 |
-
// We're using entered latlng coordinates directly
|
375 |
-
locationPromise.resolve( location.location );
|
376 |
-
} else if ( location.hasOwnProperty( 'address' ) ) {
|
377 |
-
|
378 |
-
// Either user entered an address, or fall back to defaults and use the geocoder.
|
379 |
-
if ( !location.address ) {
|
380 |
-
var rndIndx = parseInt( Math.random() * this.DEFAULT_LOCATIONS.length );
|
381 |
-
location.address = this.DEFAULT_LOCATIONS[ rndIndx ];
|
382 |
-
}
|
383 |
-
var onGeocodeResults = function ( results, status ) {
|
384 |
-
if ( status === google.maps.GeocoderStatus.OK ) {
|
385 |
-
locationPromise.resolve( results[ 0 ].geometry.location );
|
386 |
-
} else if ( status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT ) {
|
387 |
-
//try again please
|
388 |
-
setTimeout( function () {
|
389 |
-
this.getGeocoder().geocode.call( this, location, onGeocodeResults );
|
390 |
-
}.bind( this ), 100 );
|
391 |
-
} else if ( status === google.maps.GeocoderStatus.ZERO_RESULTS ) {
|
392 |
-
locationPromise.reject( status );
|
393 |
-
}
|
394 |
-
}.bind( this );
|
395 |
-
|
396 |
-
this.getGeocoder().geocode( location, onGeocodeResults );
|
397 |
-
}
|
398 |
-
return locationPromise;
|
399 |
-
},
|
400 |
-
};
|
401 |
-
};
|
402 |
-
|
403 |
-
// Called by Google Maps API when it has loaded.
|
404 |
-
function soGoogleMapInitialize() {
|
405 |
-
new sowb.SiteOriginGoogleMap(jQuery).initMaps();
|
406 |
-
}
|
407 |
-
|
408 |
-
jQuery(function ($) {
|
409 |
-
|
410 |
-
sowb.setupGoogleMaps = function() {
|
411 |
-
var libraries = [];
|
412 |
-
var apiKey;
|
413 |
-
$('.sow-google-map-canvas').each(function(index, element) {
|
414 |
-
var $this = $(element);
|
415 |
-
var mapOptions = $this.data( 'options' );
|
416 |
-
if ( mapOptions) {
|
417 |
-
if( typeof mapOptions.libraries !== 'undefined' && mapOptions.libraries !== null ) {
|
418 |
-
libraries = libraries.concat(mapOptions.libraries);
|
419 |
-
}
|
420 |
-
if( !apiKey && mapOptions.apiKey ) {
|
421 |
-
apiKey = mapOptions.apiKey;
|
422 |
-
}
|
423 |
-
}
|
424 |
-
});
|
425 |
-
|
426 |
-
var mapsApiLoaded = typeof window.google !== 'undefined' && typeof window.google.maps !== 'undefined';
|
427 |
-
if ( mapsApiLoaded ) {
|
428 |
-
soGoogleMapInitialize();
|
429 |
-
} else {
|
430 |
-
var apiUrl = 'https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize';
|
431 |
-
|
432 |
-
if ( libraries && libraries.length ) {
|
433 |
-
apiUrl += '&libraries=' + libraries.join(',');
|
434 |
-
}
|
435 |
-
|
436 |
-
if ( apiKey ) {
|
437 |
-
apiUrl += '&key=' + apiKey;
|
438 |
-
}
|
439 |
-
|
440 |
-
// This allows us to "catch" Google Maps JavaScript API errors and do a bit of custom handling. In this case,
|
441 |
-
// we display a user-specified fallback image if there is one.
|
442 |
-
if ( window.console && window.console.error ) {
|
443 |
-
var errLog = window.console.error;
|
444 |
-
|
445 |
-
sowb.onLoadMapsApiError = function ( error ) {
|
446 |
-
var matchError = error.match( /^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/ );
|
447 |
-
if ( matchError && matchError.length && matchError[0] ) {
|
448 |
-
$( '.sow-google-map-canvas' ).each( function ( index, element ) {
|
449 |
-
var $this = $( element );
|
450 |
-
if ( $this.data( 'fallbackImage' ) ) {
|
451 |
-
var imgData = $this.data( 'fallbackImage' );
|
452 |
-
if ( imgData.hasOwnProperty( 'img' ) ) {
|
453 |
-
$this.append( imgData.img );
|
454 |
-
}
|
455 |
-
}
|
456 |
-
} );
|
457 |
-
}
|
458 |
-
errLog.apply( window.console, arguments );
|
459 |
-
};
|
460 |
-
|
461 |
-
window.console.error = sowb.onLoadMapsApiError;
|
462 |
-
}
|
463 |
-
|
464 |
-
$( 'body' ).append( '<script async type="text/javascript" src="' + apiUrl + '">' );
|
465 |
-
}
|
466 |
-
};
|
467 |
-
sowb.setupGoogleMaps();
|
468 |
-
|
469 |
-
$( sowb ).on( 'setup_widgets', sowb.setupGoogleMaps );
|
470 |
-
|
471 |
-
});
|
472 |
-
|
473 |
-
window.sowb = sowb;
|
1 |
+
/* globals jQuery, google, sowb */
|
2 |
+
|
3 |
+
var sowb = window.sowb || {};
|
4 |
+
|
5 |
+
sowb.SiteOriginGoogleMap = function($) {
|
6 |
+
return {
|
7 |
+
// So that we can always display something, even if no location or address was entered.
|
8 |
+
DEFAULT_LOCATIONS: [
|
9 |
+
'Addo Elephant National Park, R335, Addo',
|
10 |
+
'Cape Town, Western Cape, South Africa',
|
11 |
+
'San Francisco Bay Area, CA, United States',
|
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';
|
21 |
+
|
22 |
+
var mapOptions = {
|
23 |
+
zoom: zoom,
|
24 |
+
scrollwheel: options.scrollZoom,
|
25 |
+
draggable: options.draggable,
|
26 |
+
disableDefaultUI: options.disableUi,
|
27 |
+
zoomControl: options.zoomControl,
|
28 |
+
panControl: options.panControl,
|
29 |
+
center: location,
|
30 |
+
mapTypeControlOptions: {
|
31 |
+
mapTypeIds: [google.maps.MapTypeId.ROADMAP, userMapTypeId]
|
32 |
+
}
|
33 |
+
};
|
34 |
+
|
35 |
+
var map = new google.maps.Map(element, mapOptions);
|
36 |
+
|
37 |
+
var userMapOptions = {
|
38 |
+
name: options.mapName
|
39 |
+
};
|
40 |
+
|
41 |
+
var userMapStyles = options.mapStyles;
|
42 |
+
|
43 |
+
if ( userMapStyles ) {
|
44 |
+
var userMapType = new google.maps.StyledMapType(userMapStyles, userMapOptions);
|
45 |
+
|
46 |
+
map.mapTypes.set(userMapTypeId, userMapType);
|
47 |
+
map.setMapTypeId(userMapTypeId);
|
48 |
+
}
|
49 |
+
|
50 |
+
if (options.markerAtCenter) {
|
51 |
+
this.centerMarker = new google.maps.Marker({
|
52 |
+
position: location,
|
53 |
+
map: map,
|
54 |
+
draggable: options.markersDraggable,
|
55 |
+
icon: options.markerIcon,
|
56 |
+
title: ''
|
57 |
+
});
|
58 |
+
}
|
59 |
+
|
60 |
+
if(options.keepCentered) {
|
61 |
+
var center;
|
62 |
+
google.maps.event.addDomListener(map, 'idle', function () {
|
63 |
+
center = map.getCenter();
|
64 |
+
});
|
65 |
+
google.maps.event.addDomListener(window, 'resize', function () {
|
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 |
+
// If the Google Maps element is hidden it won't display properly. This is an attempt to make it display by
|
75 |
+
// calling resize when a custom 'show' event is fired. The 'show' event is something we fire in a few widgets
|
76 |
+
// like Accordion and Tabs and in future any widgets which might show and hide content using `display:none;`.
|
77 |
+
if ( $( element ).is( ':hidden' ) ) {
|
78 |
+
var $visParent = $( element ).closest( ':visible' );
|
79 |
+
$visParent.find( '> :hidden' ).on( 'show', function () {
|
80 |
+
google.maps.event.trigger(map, 'resize');
|
81 |
+
map.setCenter(location);
|
82 |
+
} );
|
83 |
+
}
|
84 |
+
|
85 |
+
},
|
86 |
+
|
87 |
+
linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
|
88 |
+
if( autocomplete && autocompleteElement ) {
|
89 |
+
|
90 |
+
var updateMapLocation = function ( address ) {
|
91 |
+
if ( this.inputAddress !== address ) {
|
92 |
+
this.inputAddress = address;
|
93 |
+
this.getLocation( this.inputAddress ).done(
|
94 |
+
function ( location ) {
|
95 |
+
map.setZoom( 15 );
|
96 |
+
map.setCenter( location );
|
97 |
+
if( this.centerMarker ) {
|
98 |
+
this.centerMarker.setPosition( location );
|
99 |
+
this.centerMarker.setTitle( this.inputAddress );
|
100 |
+
}
|
101 |
+
}.bind( this )
|
102 |
+
);
|
103 |
+
}
|
104 |
+
}.bind( this );
|
105 |
+
|
106 |
+
var $autocompleteElement = $( autocompleteElement );
|
107 |
+
autocomplete.addListener( 'place_changed', function () {
|
108 |
+
var place = autocomplete.getPlace();
|
109 |
+
map.setZoom( 15 );
|
110 |
+
if ( place.geometry ) {
|
111 |
+
map.setCenter( place.geometry.location );
|
112 |
+
if( this.centerMarker ) {
|
113 |
+
this.centerMarker.setPosition(place.geometry.location);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}.bind( this ) );
|
117 |
+
|
118 |
+
google.maps.event.addDomListener( autocompleteElement, 'keypress', function ( event ) {
|
119 |
+
var key = event.keyCode || event.which;
|
120 |
+
if ( key === '13' ) {
|
121 |
+
event.preventDefault();
|
122 |
+
}
|
123 |
+
} );
|
124 |
+
|
125 |
+
$autocompleteElement.focusin( function () {
|
126 |
+
if ( !this.resultsObserver ) {
|
127 |
+
var autocompleteResultsContainer = document.querySelector( '.pac-container' );
|
128 |
+
this.resultsObserver = new MutationObserver( function () {
|
129 |
+
var $topResult = $( $( '.pac-item' ).get( 0 ) );
|
130 |
+
var queryPartA = $topResult.find( '.pac-item-query' ).text();
|
131 |
+
var queryPartB = $topResult.find( 'span' ).not( '[class]' ).text();
|
132 |
+
var topQuery = queryPartA + ( queryPartB ? (', ' + queryPartB) : '' );
|
133 |
+
if ( topQuery ) {
|
134 |
+
updateMapLocation( topQuery );
|
135 |
+
}
|
136 |
+
} );
|
137 |
+
|
138 |
+
var config = { attributes: true, childList: true, characterData: true };
|
139 |
+
|
140 |
+
this.resultsObserver.observe( autocompleteResultsContainer, config );
|
141 |
+
}
|
142 |
+
}.bind( this ) );
|
143 |
+
|
144 |
+
var revGeocode = function ( latLng ) {
|
145 |
+
this.getGeocoder().geocode( { location: latLng }, function ( results, status ) {
|
146 |
+
if ( status === google.maps.GeocoderStatus.OK ) {
|
147 |
+
if ( results.length > 0 ) {
|
148 |
+
var addr = results[ 0 ].formatted_address;
|
149 |
+
$autocompleteElement.val( addr );
|
150 |
+
if( this.centerMarker ) {
|
151 |
+
this.centerMarker.setPosition(latLng);
|
152 |
+
this.centerMarker.setTitle(addr);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}.bind( this ) );
|
157 |
+
}.bind( this );
|
158 |
+
|
159 |
+
map.addListener( 'click', function ( event ) {
|
160 |
+
revGeocode( event.latLng );
|
161 |
+
} );
|
162 |
+
|
163 |
+
this.centerMarker.addListener( 'dragend', function ( event ) {
|
164 |
+
revGeocode( event.latLng );
|
165 |
+
} );
|
166 |
+
}
|
167 |
+
},
|
168 |
+
|
169 |
+
showMarkers: function(markerPositions, map, options) {
|
170 |
+
if ( markerPositions && markerPositions.length ) {
|
171 |
+
this.infoWindows = [];
|
172 |
+
var markerBatches = [];
|
173 |
+
var BATCH_SIZE = 10;
|
174 |
+
// Group markers into batches of 10 in attempt to avoid query limits
|
175 |
+
for ( var i = 0; i < markerPositions.length; i++ ) {
|
176 |
+
var batchIndex = parseInt( i / BATCH_SIZE ); // truncate decimals
|
177 |
+
if ( markerBatches.length === batchIndex ) {
|
178 |
+
markerBatches[ batchIndex ] = [];
|
179 |
+
}
|
180 |
+
markerBatches[ batchIndex ][ i % BATCH_SIZE ] = markerPositions[ i ];
|
181 |
+
}
|
182 |
+
|
183 |
+
var geocodeMarkerBatch = function ( markerBatchHead, markerBatchTail ) {
|
184 |
+
var doneCount = 0;
|
185 |
+
markerBatchHead.forEach( function ( mrkr ) {
|
186 |
+
this.getLocation( mrkr.place ).done( function ( location ) {
|
187 |
+
var mrkerIcon = options.markerIcon;
|
188 |
+
if(mrkr.custom_marker_icon) {
|
189 |
+
mrkerIcon = mrkr.custom_marker_icon;
|
190 |
+
}
|
191 |
+
|
192 |
+
var marker = new google.maps.Marker( {
|
193 |
+
position: location,
|
194 |
+
map: map,
|
195 |
+
draggable: options.markersDraggable,
|
196 |
+
icon: mrkerIcon,
|
197 |
+
title: ''
|
198 |
+
} );
|
199 |
+
|
200 |
+
if ( mrkr.hasOwnProperty( 'info' ) && mrkr.info ) {
|
201 |
+
var infoWindowOptions = { content: mrkr.info };
|
202 |
+
|
203 |
+
if ( mrkr.hasOwnProperty( 'info_max_width' ) && mrkr.info_max_width ) {
|
204 |
+
infoWindowOptions.maxWidth = mrkr.info_max_width;
|
205 |
+
}
|
206 |
+
|
207 |
+
var infoDisplay = options.markerInfoDisplay;
|
208 |
+
infoWindowOptions.disableAutoPan = infoDisplay === 'always';
|
209 |
+
var infoWindow = new google.maps.InfoWindow( infoWindowOptions );
|
210 |
+
this.infoWindows.push( infoWindow );
|
211 |
+
var openEvent = infoDisplay;
|
212 |
+
if ( infoDisplay === 'always' ) {
|
213 |
+
openEvent = 'click';
|
214 |
+
infoWindow.open( map, marker );
|
215 |
+
}
|
216 |
+
marker.addListener( openEvent, function () {
|
217 |
+
infoWindow.open( map, marker );
|
218 |
+
if ( infoDisplay !== 'always' && !options.markerInfoMultiple ) {
|
219 |
+
this.infoWindows.forEach( function ( iw ) {
|
220 |
+
if ( iw !== infoWindow ) {
|
221 |
+
iw.close();
|
222 |
+
}
|
223 |
+
} );
|
224 |
+
}
|
225 |
+
}.bind( this ) );
|
226 |
+
if ( infoDisplay === 'mouseover' ) {
|
227 |
+
marker.addListener( 'mouseout', function () {
|
228 |
+
setTimeout( function () {
|
229 |
+
infoWindow.close();
|
230 |
+
}, 100 );
|
231 |
+
} );
|
232 |
+
}
|
233 |
+
}
|
234 |
+
if ( ++doneCount === markerBatchHead.length && markerBatchTail.length ) {
|
235 |
+
geocodeMarkerBatch( markerBatchTail.shift(), markerBatchTail );
|
236 |
+
}
|
237 |
+
}.bind( this ) );
|
238 |
+
}.bind( this ) );
|
239 |
+
}.bind( this );
|
240 |
+
geocodeMarkerBatch( markerBatches.shift(), markerBatches );
|
241 |
+
|
242 |
+
}
|
243 |
+
},
|
244 |
+
showDirections: function(directions, map) {
|
245 |
+
if ( directions ) {
|
246 |
+
if ( directions.waypoints && directions.waypoints.length ) {
|
247 |
+
directions.waypoints.map(
|
248 |
+
function (wypt) {
|
249 |
+
wypt.stopover = Boolean(wypt.stopover);
|
250 |
+
}
|
251 |
+
);
|
252 |
+
}
|
253 |
+
|
254 |
+
var directionsRenderer = new google.maps.DirectionsRenderer();
|
255 |
+
directionsRenderer.setMap(map);
|
256 |
+
|
257 |
+
var directionsService = new google.maps.DirectionsService();
|
258 |
+
directionsService.route({
|
259 |
+
origin: directions.origin,
|
260 |
+
destination: directions.destination,
|
261 |
+
travelMode: directions.travelMode.toUpperCase(),
|
262 |
+
avoidHighways: directions.avoidHighways,
|
263 |
+
avoidTolls: directions.avoidTolls,
|
264 |
+
waypoints: directions.waypoints,
|
265 |
+
optimizeWaypoints: directions.optimizeWaypoints,
|
266 |
+
},
|
267 |
+
function(result, status) {
|
268 |
+
if (status === google.maps.DirectionsStatus.OK) {
|
269 |
+
directionsRenderer.setOptions( { preserveViewport: directions.preserveViewport } );
|
270 |
+
directionsRenderer.setDirections(result);
|
271 |
+
}
|
272 |
+
});
|
273 |
+
}
|
274 |
+
},
|
275 |
+
initMaps: function() {
|
276 |
+
// Init any autocomplete fields first.
|
277 |
+
var $autoCompleteFields = $( '.sow-google-map-autocomplete' );
|
278 |
+
var autoCompleteInit = new $.Deferred();
|
279 |
+
if( $autoCompleteFields.length === 0 ) {
|
280 |
+
autoCompleteInit.resolve();
|
281 |
+
} else {
|
282 |
+
$autoCompleteFields.each(function (index, element) {
|
283 |
+
|
284 |
+
if ( typeof google.maps.places === 'undefined' ) {
|
285 |
+
autoCompleteInit.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');
|
286 |
+
return;
|
287 |
+
}
|
288 |
+
|
289 |
+
var autocomplete = new google.maps.places.Autocomplete(
|
290 |
+
element,
|
291 |
+
{types: ['address']}
|
292 |
+
);
|
293 |
+
|
294 |
+
var $mapField = $(element).siblings('.sow-google-map-canvas');
|
295 |
+
|
296 |
+
if ($mapField.length > 0) {
|
297 |
+
var options = $mapField.data('options');
|
298 |
+
options.autocomplete = autocomplete;
|
299 |
+
options.autocompleteElement = element;
|
300 |
+
this.getLocation(options.address).done(
|
301 |
+
function (location) {
|
302 |
+
this.showMap($mapField.get(0), location, options);
|
303 |
+
$mapField.data('initialized', true);
|
304 |
+
autoCompleteInit.resolve();
|
305 |
+
}.bind(this)
|
306 |
+
).fail(function () {
|
307 |
+
$mapField.append('<div><p><strong>' + soWidgetsGoogleMap.geocode.noResults + '</strong></p></div>');
|
308 |
+
autoCompleteInit.reject();
|
309 |
+
});
|
310 |
+
}
|
311 |
+
}.bind(this));
|
312 |
+
}
|
313 |
+
|
314 |
+
autoCompleteInit.always(function(){
|
315 |
+
$('.sow-google-map-canvas').each(function (index, element) {
|
316 |
+
var $$ = $(element);
|
317 |
+
|
318 |
+
if( $$.data( 'initialized' ) ) {
|
319 |
+
// Already initialized so continue to next element.
|
320 |
+
return true;
|
321 |
+
}
|
322 |
+
|
323 |
+
var options = $$.data( 'options' );
|
324 |
+
var address = options.address;
|
325 |
+
// If no address was specified, but we have markers, use the first marker as the map center.
|
326 |
+
if(!address) {
|
327 |
+
var markers = options.markerPositions;
|
328 |
+
if(markers && markers.length) {
|
329 |
+
address = markers[0].place;
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
this.getLocation( address ).done(
|
334 |
+
function ( location ) {
|
335 |
+
this.showMap( $$.get( 0 ), location, options );
|
336 |
+
$$.data( 'initialized' );
|
337 |
+
}.bind( this )
|
338 |
+
).fail( function () {
|
339 |
+
$$.append( '<div><p><strong>' + soWidgetsGoogleMap.geocode.noResults + '</strong></p></div>' );
|
340 |
+
} );
|
341 |
+
|
342 |
+
}.bind(this));
|
343 |
+
}.bind(this))
|
344 |
+
.fail(function(error){
|
345 |
+
console.log(error);
|
346 |
+
});
|
347 |
+
},
|
348 |
+
getGeocoder: function () {
|
349 |
+
if ( !this._geocoder ) {
|
350 |
+
this._geocoder = new google.maps.Geocoder();
|
351 |
+
}
|
352 |
+
return this._geocoder;
|
353 |
+
},
|
354 |
+
getLocation: function ( inputLocation ) {
|
355 |
+
var locationPromise = new $.Deferred();
|
356 |
+
var location = { address: inputLocation };
|
357 |
+
//check if address is actually a valid latlng
|
358 |
+
var latLng;
|
359 |
+
if ( inputLocation && inputLocation.indexOf( ',' ) > -1 ) {
|
360 |
+
var vals = inputLocation.split( ',' );
|
361 |
+
// A latlng value should be of the format 'lat,lng'
|
362 |
+
if ( vals && vals.length === 2 ) {
|
363 |
+
latLng = new google.maps.LatLng( vals[ 0 ], vals[ 1 ] );
|
364 |
+
// Let the API decide if we have a valid latlng
|
365 |
+
// This should fail if the input is an address containing a comma
|
366 |
+
// e.g. 123 Sesame Street, Middleburg, FL, United States
|
367 |
+
if ( !(isNaN( latLng.lat() ) || isNaN( latLng.lng() )) ) {
|
368 |
+
location = { location: { lat: latLng.lat(), lng: latLng.lng() } };
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
if ( location.hasOwnProperty( 'location' ) ) {
|
374 |
+
// We're using entered latlng coordinates directly
|
375 |
+
locationPromise.resolve( location.location );
|
376 |
+
} else if ( location.hasOwnProperty( 'address' ) ) {
|
377 |
+
|
378 |
+
// Either user entered an address, or fall back to defaults and use the geocoder.
|
379 |
+
if ( !location.address ) {
|
380 |
+
var rndIndx = parseInt( Math.random() * this.DEFAULT_LOCATIONS.length );
|
381 |
+
location.address = this.DEFAULT_LOCATIONS[ rndIndx ];
|
382 |
+
}
|
383 |
+
var onGeocodeResults = function ( results, status ) {
|
384 |
+
if ( status === google.maps.GeocoderStatus.OK ) {
|
385 |
+
locationPromise.resolve( results[ 0 ].geometry.location );
|
386 |
+
} else if ( status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT ) {
|
387 |
+
//try again please
|
388 |
+
setTimeout( function () {
|
389 |
+
this.getGeocoder().geocode.call( this, location, onGeocodeResults );
|
390 |
+
}.bind( this ), 100 );
|
391 |
+
} else if ( status === google.maps.GeocoderStatus.ZERO_RESULTS ) {
|
392 |
+
locationPromise.reject( status );
|
393 |
+
}
|
394 |
+
}.bind( this );
|
395 |
+
|
396 |
+
this.getGeocoder().geocode( location, onGeocodeResults );
|
397 |
+
}
|
398 |
+
return locationPromise;
|
399 |
+
},
|
400 |
+
};
|
401 |
+
};
|
402 |
+
|
403 |
+
// Called by Google Maps API when it has loaded.
|
404 |
+
function soGoogleMapInitialize() {
|
405 |
+
new sowb.SiteOriginGoogleMap(jQuery).initMaps();
|
406 |
+
}
|
407 |
+
|
408 |
+
jQuery(function ($) {
|
409 |
+
|
410 |
+
sowb.setupGoogleMaps = function() {
|
411 |
+
var libraries = [];
|
412 |
+
var apiKey;
|
413 |
+
$('.sow-google-map-canvas').each(function(index, element) {
|
414 |
+
var $this = $(element);
|
415 |
+
var mapOptions = $this.data( 'options' );
|
416 |
+
if ( mapOptions) {
|
417 |
+
if( typeof mapOptions.libraries !== 'undefined' && mapOptions.libraries !== null ) {
|
418 |
+
libraries = libraries.concat(mapOptions.libraries);
|
419 |
+
}
|
420 |
+
if( !apiKey && mapOptions.apiKey ) {
|
421 |
+
apiKey = mapOptions.apiKey;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
});
|
425 |
+
|
426 |
+
var mapsApiLoaded = typeof window.google !== 'undefined' && typeof window.google.maps !== 'undefined';
|
427 |
+
if ( mapsApiLoaded ) {
|
428 |
+
soGoogleMapInitialize();
|
429 |
+
} else {
|
430 |
+
var apiUrl = 'https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize';
|
431 |
+
|
432 |
+
if ( libraries && libraries.length ) {
|
433 |
+
apiUrl += '&libraries=' + libraries.join(',');
|
434 |
+
}
|
435 |
+
|
436 |
+
if ( apiKey ) {
|
437 |
+
apiUrl += '&key=' + apiKey;
|
438 |
+
}
|
439 |
+
|
440 |
+
// This allows us to "catch" Google Maps JavaScript API errors and do a bit of custom handling. In this case,
|
441 |
+
// we display a user-specified fallback image if there is one.
|
442 |
+
if ( window.console && window.console.error ) {
|
443 |
+
var errLog = window.console.error;
|
444 |
+
|
445 |
+
sowb.onLoadMapsApiError = function ( error ) {
|
446 |
+
var matchError = error.match( /^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/ );
|
447 |
+
if ( matchError && matchError.length && matchError[0] ) {
|
448 |
+
$( '.sow-google-map-canvas' ).each( function ( index, element ) {
|
449 |
+
var $this = $( element );
|
450 |
+
if ( $this.data( 'fallbackImage' ) ) {
|
451 |
+
var imgData = $this.data( 'fallbackImage' );
|
452 |
+
if ( imgData.hasOwnProperty( 'img' ) ) {
|
453 |
+
$this.append( imgData.img );
|
454 |
+
}
|
455 |
+
}
|
456 |
+
} );
|
457 |
+
}
|
458 |
+
errLog.apply( window.console, arguments );
|
459 |
+
};
|
460 |
+
|
461 |
+
window.console.error = sowb.onLoadMapsApiError;
|
462 |
+
}
|
463 |
+
|
464 |
+
$( 'body' ).append( '<script async type="text/javascript" src="' + apiUrl + '">' );
|
465 |
+
}
|
466 |
+
};
|
467 |
+
sowb.setupGoogleMaps();
|
468 |
+
|
469 |
+
$( sowb ).on( 'setup_widgets', sowb.setupGoogleMaps );
|
470 |
+
|
471 |
+
});
|
472 |
+
|
473 |
+
window.sowb = sowb;
|
lang/so-widgets-bundle.pot
CHANGED
@@ -17,63 +17,63 @@ msgstr ""
|
|
17 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
|
20 |
-
#: tmp/admin/tpl/admin.php:
|
21 |
msgid "SiteOrigin Widgets Bundle"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: tmp/admin/tpl/admin.php:
|
25 |
msgid "Filter Widgets"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: tmp/admin/tpl/admin.php:
|
29 |
msgid "All"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: tmp/admin/tpl/admin.php:
|
33 |
msgid "Enabled"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: tmp/admin/tpl/admin.php:
|
37 |
msgid "Disabled"
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: tmp/admin/tpl/admin.php:
|
41 |
msgid "Active"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: tmp/admin/tpl/admin.php:
|
45 |
msgid "Activate"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: tmp/admin/tpl/admin.php:
|
49 |
msgid "Deactivate"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: tmp/admin/tpl/admin.php:
|
53 |
msgid "Settings"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: tmp/admin/tpl/admin.php:
|
57 |
msgid "Developers - create your own widgets for the Widgets Bundle."
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: tmp/admin/tpl/admin.php:
|
61 |
msgid "Read More"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: tmp/admin/tpl/admin.php:
|
65 |
msgid "Widget Settings"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: tmp/admin/tpl/admin.php:
|
69 |
msgid "Save"
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: tmp/base/inc/actions.php:10, tmp/base/inc/actions.php:73, tmp/base/inc/actions.php:117, tmp/base/inc/actions.php:153, tmp/base/inc/actions.php:166, tmp/base/inc/actions.php:170, tmp/base/inc/actions.php:261, tmp/base/inc/actions.php:264, tmp/so-widgets-bundle.php:
|
73 |
msgid "Invalid request."
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: tmp/base/inc/actions.php:12, tmp/base/inc/actions.php:20, tmp/so-widgets-bundle.php:
|
77 |
msgid "Invalid post."
|
78 |
msgstr ""
|
79 |
|
@@ -117,7 +117,7 @@ msgstr ""
|
|
117 |
msgid "SiteOrigin Page Builder"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: tmp/base/inc/fields/date-range.class.php:31, tmp/base/inc/fields/date-range.class.php:45, tmp/widgets/contact/contact.php:
|
121 |
msgid "From"
|
122 |
msgstr ""
|
123 |
|
@@ -297,7 +297,7 @@ msgstr ""
|
|
297 |
msgid "Author"
|
298 |
msgstr ""
|
299 |
|
300 |
-
#: tmp/base/inc/fields/posts.class.php:82, tmp/widgets/accordion/accordion.php:46, tmp/widgets/accordion/accordion.php:59, tmp/widgets/contact/contact.php:
|
301 |
msgid "Title"
|
302 |
msgstr ""
|
303 |
|
@@ -357,7 +357,7 @@ msgstr ""
|
|
357 |
msgid "Sticky posts"
|
358 |
msgstr ""
|
359 |
|
360 |
-
#: tmp/base/inc/fields/posts.class.php:115, tmp/compat/beaver-builder/beaver-builder.php:
|
361 |
msgid "Default"
|
362 |
msgstr ""
|
363 |
|
@@ -413,91 +413,91 @@ msgstr ""
|
|
413 |
msgid "Widgets Bundle Post Meta Data"
|
414 |
msgstr ""
|
415 |
|
416 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
417 |
msgid "Animation speed"
|
418 |
msgstr ""
|
419 |
|
420 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
421 |
msgid "Animation speed in milliseconds."
|
422 |
msgstr ""
|
423 |
|
424 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
425 |
msgid "Timeout"
|
426 |
msgstr ""
|
427 |
|
428 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
429 |
msgid "How long each frame is displayed for in milliseconds."
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
433 |
msgid "Navigation color"
|
434 |
msgstr ""
|
435 |
|
436 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
437 |
msgid "Navigation style"
|
438 |
msgstr ""
|
439 |
|
440 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
441 |
msgid "Ultra thin"
|
442 |
msgstr ""
|
443 |
|
444 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
445 |
msgid "Thin"
|
446 |
msgstr ""
|
447 |
|
448 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
449 |
msgid "Medium"
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
453 |
msgid "Thick"
|
454 |
msgstr ""
|
455 |
|
456 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
457 |
msgid "Rounded ultra thin"
|
458 |
msgstr ""
|
459 |
|
460 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
461 |
msgid "Rounded thin"
|
462 |
msgstr ""
|
463 |
|
464 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
465 |
msgid "Rounded medium"
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
469 |
msgid "Rounded thick"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
473 |
msgid "Navigation size"
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
477 |
msgid "Swipe Control"
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
481 |
msgid "Allow users to swipe through frames on mobile devices."
|
482 |
msgstr ""
|
483 |
|
484 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
485 |
msgid "Video file"
|
486 |
msgstr ""
|
487 |
|
488 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
489 |
msgid "Video URL"
|
490 |
msgstr ""
|
491 |
|
492 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
493 |
msgid "An external URL of the video. Overrides video file."
|
494 |
msgstr ""
|
495 |
|
496 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
497 |
msgid "Video format"
|
498 |
msgstr ""
|
499 |
|
500 |
-
#: tmp/base/inc/widgets/base-slider.class.php:
|
501 |
msgid "Maximum height"
|
502 |
msgstr ""
|
503 |
|
@@ -537,15 +537,15 @@ msgstr ""
|
|
537 |
msgid "Clicking %s will replace the current widget contents. You can revert by refreshing the page before updating."
|
538 |
msgstr ""
|
539 |
|
540 |
-
#: tmp/compat/beaver-builder/beaver-builder.php:
|
541 |
msgid "Clear"
|
542 |
msgstr ""
|
543 |
|
544 |
-
#: tmp/compat/beaver-builder/beaver-builder.php:
|
545 |
msgid "Select Color"
|
546 |
msgstr ""
|
547 |
|
548 |
-
#: tmp/compat/beaver-builder/beaver-builder.php:
|
549 |
msgid "Current Color"
|
550 |
msgstr ""
|
551 |
|
@@ -565,7 +565,7 @@ msgstr ""
|
|
565 |
msgid "SiteOrigin Widget"
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: tmp/compat/visual-composer/visual-composer.php:40, tmp/so-widgets-bundle.php:
|
569 |
msgid "SiteOrigin Widgets"
|
570 |
msgstr ""
|
571 |
|
@@ -601,31 +601,31 @@ msgstr ""
|
|
601 |
msgid "Ionicons"
|
602 |
msgstr ""
|
603 |
|
604 |
-
#: tmp/so-widgets-bundle.php:
|
605 |
msgid "A new widget!"
|
606 |
msgstr ""
|
607 |
|
608 |
-
#: tmp/so-widgets-bundle.php:
|
609 |
msgid "Insufficient permissions."
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: tmp/so-widgets-bundle.php:
|
613 |
msgid "%s was %s"
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: tmp/so-widgets-bundle.php:
|
617 |
msgid "Activated"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: tmp/so-widgets-bundle.php:
|
621 |
msgid "Deactivated"
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: tmp/so-widgets-bundle.php:
|
625 |
msgid "Manage Widgets"
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: tmp/so-widgets-bundle.php:
|
629 |
msgid "Support"
|
630 |
msgstr ""
|
631 |
|
@@ -641,7 +641,7 @@ msgstr ""
|
|
641 |
msgid "Panels"
|
642 |
msgstr ""
|
643 |
|
644 |
-
#: tmp/widgets/accordion/accordion.php:63, tmp/widgets/hero/hero.php:
|
645 |
msgid "Content"
|
646 |
msgstr ""
|
647 |
|
@@ -661,7 +661,7 @@ msgstr ""
|
|
661 |
msgid "Closed"
|
662 |
msgstr ""
|
663 |
|
664 |
-
#: tmp/widgets/accordion/accordion.php:79, tmp/widgets/contact/contact.php:
|
665 |
msgid "Design"
|
666 |
msgstr ""
|
667 |
|
@@ -669,7 +669,7 @@ msgstr ""
|
|
669 |
msgid "Headings"
|
670 |
msgstr ""
|
671 |
|
672 |
-
#: tmp/widgets/accordion/accordion.php:89, tmp/widgets/accordion/accordion.php:127, tmp/widgets/contact/contact.php:
|
673 |
msgid "Background color"
|
674 |
msgstr ""
|
675 |
|
@@ -677,7 +677,7 @@ msgstr ""
|
|
677 |
msgid "Background hover color"
|
678 |
msgstr ""
|
679 |
|
680 |
-
#: tmp/widgets/accordion/accordion.php:99, tmp/widgets/cta/cta.php:
|
681 |
msgid "Title color"
|
682 |
msgstr ""
|
683 |
|
@@ -685,7 +685,7 @@ msgstr ""
|
|
685 |
msgid "Title hover color"
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: tmp/widgets/accordion/accordion.php:108, tmp/widgets/accordion/accordion.php:136, tmp/widgets/contact/contact.php:
|
689 |
msgid "Border color"
|
690 |
msgstr ""
|
691 |
|
@@ -693,7 +693,7 @@ msgstr ""
|
|
693 |
msgid "Border hover color"
|
694 |
msgstr ""
|
695 |
|
696 |
-
#: tmp/widgets/accordion/accordion.php:116, tmp/widgets/accordion/accordion.php:140, tmp/widgets/contact/contact.php:
|
697 |
msgid "Border width"
|
698 |
msgstr ""
|
699 |
|
@@ -709,726 +709,730 @@ msgstr ""
|
|
709 |
msgid "Get more customization options and the ability to use widgets and layouts as your accordion content with %sSiteOrigin Premium%s"
|
710 |
msgstr ""
|
711 |
|
712 |
-
#: tmp/widgets/button/button.php:
|
713 |
msgid "SiteOrigin Button"
|
714 |
msgstr ""
|
715 |
|
716 |
-
#: tmp/widgets/button/button.php:
|
717 |
msgid "A customizable button widget."
|
718 |
msgstr ""
|
719 |
|
720 |
-
#: tmp/widgets/button/button.php:
|
721 |
msgid "Button text"
|
722 |
msgstr ""
|
723 |
|
724 |
-
#: tmp/widgets/button/button.php:
|
725 |
msgid "Destination URL"
|
726 |
msgstr ""
|
727 |
|
728 |
-
#: tmp/widgets/button/button.php:
|
729 |
msgid "Open in a new window"
|
730 |
msgstr ""
|
731 |
|
732 |
-
#: tmp/widgets/button/button.php:
|
733 |
msgid "Icon"
|
734 |
msgstr ""
|
735 |
|
736 |
-
#: tmp/widgets/button/button.php:
|
737 |
msgid "Icon color"
|
738 |
msgstr ""
|
739 |
|
740 |
-
#: tmp/widgets/button/button.php:
|
741 |
msgid "Image icon"
|
742 |
msgstr ""
|
743 |
|
744 |
-
#: tmp/widgets/button/button.php:
|
745 |
msgid "Replaces the icon with your own image icon."
|
746 |
msgstr ""
|
747 |
|
748 |
-
#: tmp/widgets/button/button.php:
|
749 |
msgid "Icon Placement"
|
750 |
msgstr ""
|
751 |
|
752 |
-
#: tmp/widgets/button/button.php:
|
753 |
msgid "Top"
|
754 |
msgstr ""
|
755 |
|
756 |
-
#: tmp/widgets/button/button.php:
|
757 |
msgid "Right"
|
758 |
msgstr ""
|
759 |
|
760 |
-
#: tmp/widgets/button/button.php:
|
761 |
msgid "Bottom"
|
762 |
msgstr ""
|
763 |
|
764 |
-
#: tmp/widgets/button/button.php:
|
765 |
msgid "Left"
|
766 |
msgstr ""
|
767 |
|
768 |
-
#: tmp/widgets/button/button.php:
|
769 |
msgid "Design and layout"
|
770 |
msgstr ""
|
771 |
|
772 |
-
#: tmp/widgets/button/button.php:
|
773 |
msgid "Width"
|
774 |
msgstr ""
|
775 |
|
776 |
-
#: tmp/widgets/button/button.php:
|
777 |
msgid "Leave blank to let the button resize according to content."
|
778 |
msgstr ""
|
779 |
|
780 |
-
#: tmp/widgets/button/button.php:
|
781 |
msgid "Align"
|
782 |
msgstr ""
|
783 |
|
784 |
-
#: tmp/widgets/button/button.php:
|
785 |
msgid "Center"
|
786 |
msgstr ""
|
787 |
|
788 |
-
#: tmp/widgets/button/button.php:
|
789 |
msgid "Justify"
|
790 |
msgstr ""
|
791 |
|
792 |
-
#: tmp/widgets/button/button.php:
|
793 |
msgid "Button theme"
|
794 |
msgstr ""
|
795 |
|
796 |
-
#: tmp/widgets/button/button.php:
|
797 |
msgid "Atom"
|
798 |
msgstr ""
|
799 |
|
800 |
-
#: tmp/widgets/button/button.php:
|
801 |
msgid "Flat"
|
802 |
msgstr ""
|
803 |
|
804 |
-
#: tmp/widgets/button/button.php:
|
805 |
msgid "Wire"
|
806 |
msgstr ""
|
807 |
|
808 |
-
#: tmp/widgets/button/button.php:
|
809 |
msgid "Button color"
|
810 |
msgstr ""
|
811 |
|
812 |
-
#: tmp/widgets/button/button.php:
|
813 |
msgid "Text color"
|
814 |
msgstr ""
|
815 |
|
816 |
-
#: tmp/widgets/button/button.php:
|
817 |
msgid "Use hover effects"
|
818 |
msgstr ""
|
819 |
|
820 |
-
#: tmp/widgets/button/button.php:
|
821 |
msgid "Font"
|
822 |
msgstr ""
|
823 |
|
824 |
-
#: tmp/widgets/button/button.php:
|
825 |
msgid "Font size"
|
826 |
msgstr ""
|
827 |
|
828 |
-
#: tmp/widgets/button/button.php:
|
829 |
msgid "Normal"
|
830 |
msgstr ""
|
831 |
|
832 |
-
#: tmp/widgets/button/button.php:
|
833 |
msgid "Large"
|
834 |
msgstr ""
|
835 |
|
836 |
-
#: tmp/widgets/button/button.php:
|
837 |
msgid "Extra large"
|
838 |
msgstr ""
|
839 |
|
840 |
-
#: tmp/widgets/button/button.php:
|
841 |
msgid "Rounding"
|
842 |
msgstr ""
|
843 |
|
844 |
-
#: tmp/widgets/button/button.php:
|
845 |
msgid "None"
|
846 |
msgstr ""
|
847 |
|
848 |
-
#: tmp/widgets/button/button.php:
|
849 |
msgid "Slightly rounded"
|
850 |
msgstr ""
|
851 |
|
852 |
-
#: tmp/widgets/button/button.php:
|
853 |
msgid "Very rounded"
|
854 |
msgstr ""
|
855 |
|
856 |
-
#: tmp/widgets/button/button.php:
|
857 |
msgid "Completely rounded"
|
858 |
msgstr ""
|
859 |
|
860 |
-
#: tmp/widgets/button/button.php:
|
861 |
msgid "Padding"
|
862 |
msgstr ""
|
863 |
|
864 |
-
#: tmp/widgets/button/button.php:
|
865 |
msgid "Low"
|
866 |
msgstr ""
|
867 |
|
868 |
-
#: tmp/widgets/button/button.php:
|
869 |
msgid "High"
|
870 |
msgstr ""
|
871 |
|
872 |
-
#: tmp/widgets/button/button.php:
|
873 |
msgid "Very high"
|
874 |
msgstr ""
|
875 |
|
876 |
-
#: tmp/widgets/button/button.php:
|
877 |
msgid "Other attributes and SEO"
|
878 |
msgstr ""
|
879 |
|
880 |
-
#: tmp/widgets/button/button.php:
|
881 |
msgid "Button ID"
|
882 |
msgstr ""
|
883 |
|
884 |
-
#: tmp/widgets/button/button.php:
|
885 |
msgid "An ID attribute allows you to target this button in Javascript."
|
886 |
msgstr ""
|
887 |
|
888 |
-
#: tmp/widgets/button/button.php:
|
889 |
msgid "Button Classes"
|
890 |
msgstr ""
|
891 |
|
892 |
-
#: tmp/widgets/button/button.php:
|
893 |
msgid "Additional CSS classes added to the button link."
|
894 |
msgstr ""
|
895 |
|
896 |
-
#: tmp/widgets/button/button.php:
|
897 |
msgid "Title attribute"
|
898 |
msgstr ""
|
899 |
|
900 |
-
#: tmp/widgets/button/button.php:
|
901 |
msgid "Adds a title attribute to the button link."
|
902 |
msgstr ""
|
903 |
|
904 |
-
#: tmp/widgets/button/button.php:
|
905 |
msgid "Onclick"
|
906 |
msgstr ""
|
907 |
|
908 |
-
#: tmp/widgets/button/button.php:
|
909 |
msgid "Run this Javascript when the button is clicked. Ideal for tracking."
|
910 |
msgstr ""
|
911 |
|
912 |
-
#: tmp/widgets/button/button.php:
|
913 |
msgid "Rel attribute"
|
914 |
msgstr ""
|
915 |
|
916 |
-
#: tmp/widgets/button/button.php:
|
917 |
msgid "Adds a rel attribute to the button link."
|
918 |
msgstr ""
|
919 |
|
920 |
-
#: tmp/widgets/contact/contact.php:
|
921 |
msgid "SiteOrigin Contact Form"
|
922 |
msgstr ""
|
923 |
|
924 |
-
#: tmp/widgets/contact/contact.php:
|
925 |
msgid "Create a simple contact form for your users to get hold of you."
|
926 |
msgstr ""
|
927 |
|
928 |
-
#: tmp/widgets/contact/contact.php:
|
929 |
msgid "Contact Us"
|
930 |
msgstr ""
|
931 |
|
932 |
-
#: tmp/widgets/contact/contact.php:
|
933 |
msgid "Display title"
|
934 |
msgstr ""
|
935 |
|
936 |
-
#: tmp/widgets/contact/contact.php:
|
937 |
msgid "To email address"
|
938 |
msgstr ""
|
939 |
|
940 |
-
#: tmp/widgets/contact/contact.php:
|
941 |
msgid "Where contact emails will be delivered to. You can send to multiple emails by separating the emails with a comma (,)"
|
942 |
msgstr ""
|
943 |
|
944 |
-
#: tmp/widgets/contact/contact.php:
|
945 |
msgid "From email address"
|
946 |
msgstr ""
|
947 |
|
948 |
-
#: tmp/widgets/contact/contact.php:
|
949 |
msgid "It will appear as if emails are sent from this address. Ideally this should be in the same domain as this server to avoid spam filters."
|
950 |
msgstr ""
|
951 |
|
952 |
-
#: tmp/widgets/contact/contact.php:
|
953 |
msgid "Default subject"
|
954 |
msgstr ""
|
955 |
|
956 |
-
#: tmp/widgets/contact/contact.php:
|
957 |
msgid "Subject to use when there isn't one available."
|
958 |
msgstr ""
|
959 |
|
960 |
-
#: tmp/widgets/contact/contact.php:
|
961 |
msgid "Subject prefix"
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: tmp/widgets/contact/contact.php:
|
965 |
msgid "Prefix added to all incoming email subjects."
|
966 |
msgstr ""
|
967 |
|
968 |
-
#: tmp/widgets/contact/contact.php:
|
969 |
msgid "Success message"
|
970 |
msgstr ""
|
971 |
|
972 |
-
#: tmp/widgets/contact/contact.php:
|
973 |
msgid "Message to display after message successfully sent."
|
974 |
msgstr ""
|
975 |
|
976 |
-
#: tmp/widgets/contact/contact.php:
|
977 |
msgid "Thanks for contacting us. We'll get back to you shortly."
|
978 |
msgstr ""
|
979 |
|
980 |
-
#: tmp/widgets/contact/contact.php:
|
981 |
msgid "Submit button text"
|
982 |
msgstr ""
|
983 |
|
984 |
-
#: tmp/widgets/contact/contact.php:
|
985 |
msgid "An ID attribute allows you to target this button in JavaScript."
|
986 |
msgstr ""
|
987 |
|
988 |
-
#: tmp/widgets/contact/contact.php:
|
989 |
msgid "Run this JavaScript when the button is clicked. Ideal for tracking."
|
990 |
msgstr ""
|
991 |
|
992 |
-
#: tmp/widgets/contact/contact.php:
|
993 |
msgid "Indicate required fields with asterisk (*)"
|
994 |
msgstr ""
|
995 |
|
996 |
-
#: tmp/widgets/contact/contact.php:
|
997 |
msgid "Required field indicator message"
|
998 |
msgstr ""
|
999 |
|
1000 |
-
#: tmp/widgets/contact/contact.php:
|
1001 |
msgid "Fields marked with * are required"
|
1002 |
msgstr ""
|
1003 |
|
1004 |
-
#: tmp/widgets/contact/contact.php:
|
1005 |
msgid "Fields"
|
1006 |
msgstr ""
|
1007 |
|
1008 |
-
#: tmp/widgets/contact/contact.php:
|
1009 |
msgid "Field"
|
1010 |
msgstr ""
|
1011 |
|
1012 |
-
#: tmp/widgets/contact/contact.php:
|
1013 |
msgid "Field Type"
|
1014 |
msgstr ""
|
1015 |
|
1016 |
-
#: tmp/widgets/contact/contact.php:
|
1017 |
msgid "Select Field Type"
|
1018 |
msgstr ""
|
1019 |
|
1020 |
-
#: tmp/widgets/contact/contact.php:
|
1021 |
msgid "Name"
|
1022 |
msgstr ""
|
1023 |
|
1024 |
-
#: tmp/widgets/contact/contact.php:
|
1025 |
msgid "Email"
|
1026 |
msgstr ""
|
1027 |
|
1028 |
-
#: tmp/widgets/contact/contact.php:
|
1029 |
msgid "Subject"
|
1030 |
msgstr ""
|
1031 |
|
1032 |
-
#: tmp/widgets/contact/contact.php:
|
1033 |
msgid "Text"
|
1034 |
msgstr ""
|
1035 |
|
1036 |
-
#: tmp/widgets/contact/contact.php:
|
1037 |
msgid "Text Area"
|
1038 |
msgstr ""
|
1039 |
|
1040 |
-
#: tmp/widgets/contact/contact.php:
|
1041 |
msgid "Dropdown Select"
|
1042 |
msgstr ""
|
1043 |
|
1044 |
-
#: tmp/widgets/contact/contact.php:
|
1045 |
msgid "Checkboxes"
|
1046 |
msgstr ""
|
1047 |
|
1048 |
-
#: tmp/widgets/contact/contact.php:
|
1049 |
msgid "Radio"
|
1050 |
msgstr ""
|
1051 |
|
1052 |
-
#: tmp/widgets/contact/contact.php:
|
1053 |
msgid "Label"
|
1054 |
msgstr ""
|
1055 |
|
1056 |
-
#: tmp/widgets/contact/contact.php:
|
1057 |
msgid "Description"
|
1058 |
msgstr ""
|
1059 |
|
1060 |
-
#: tmp/widgets/contact/contact.php:
|
1061 |
msgid "This text will appear small beneath the input field."
|
1062 |
msgstr ""
|
1063 |
|
1064 |
-
#: tmp/widgets/contact/contact.php:
|
1065 |
msgid "Required Field"
|
1066 |
msgstr ""
|
1067 |
|
1068 |
-
#: tmp/widgets/contact/contact.php:
|
1069 |
msgid "Required field"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
-
#: tmp/widgets/contact/contact.php:
|
1073 |
msgid "Is this field required?"
|
1074 |
msgstr ""
|
1075 |
|
1076 |
-
#: tmp/widgets/contact/contact.php:
|
1077 |
msgid "Missing message"
|
1078 |
msgstr ""
|
1079 |
|
1080 |
-
#: tmp/widgets/contact/contact.php:
|
1081 |
msgid "Error message to display if this field is missing."
|
1082 |
msgstr ""
|
1083 |
|
1084 |
-
#: tmp/widgets/contact/contact.php:
|
1085 |
msgid "Options"
|
1086 |
msgstr ""
|
1087 |
|
1088 |
-
#: tmp/widgets/contact/contact.php:
|
1089 |
msgid "Option"
|
1090 |
msgstr ""
|
1091 |
|
1092 |
-
#: tmp/widgets/contact/contact.php:
|
1093 |
msgid "Value"
|
1094 |
msgstr ""
|
1095 |
|
1096 |
-
#: tmp/widgets/contact/contact.php:
|
1097 |
msgid "Spam Protection"
|
1098 |
msgstr ""
|
1099 |
|
1100 |
-
#: tmp/widgets/contact/contact.php:
|
1101 |
msgid "reCAPTCHA"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
-
#: tmp/widgets/contact/contact.php:
|
1105 |
msgid "Use reCAPTCHA"
|
1106 |
msgstr ""
|
1107 |
|
1108 |
-
#: tmp/widgets/contact/contact.php:
|
1109 |
msgid "reCAPTCHA Site Key"
|
1110 |
msgstr ""
|
1111 |
|
1112 |
-
#: tmp/widgets/contact/contact.php:
|
1113 |
msgid "reCAPTCHA Secret Key"
|
1114 |
msgstr ""
|
1115 |
|
1116 |
-
#: tmp/widgets/contact/contact.php:
|
1117 |
msgid "Theme"
|
1118 |
msgstr ""
|
1119 |
|
1120 |
-
#: tmp/widgets/contact/contact.php:
|
1121 |
msgid "Light"
|
1122 |
msgstr ""
|
1123 |
|
1124 |
-
#: tmp/widgets/contact/contact.php:
|
1125 |
msgid "Dark"
|
1126 |
msgstr ""
|
1127 |
|
1128 |
-
#: tmp/widgets/contact/contact.php:
|
1129 |
msgid "Challenge type"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
-
#: tmp/widgets/contact/contact.php:
|
1133 |
msgid "Image"
|
1134 |
msgstr ""
|
1135 |
|
1136 |
-
#: tmp/widgets/contact/contact.php:
|
1137 |
msgid "Audio"
|
1138 |
msgstr ""
|
1139 |
|
1140 |
-
#: tmp/widgets/contact/contact.php:
|
1141 |
msgid "Size"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
-
#: tmp/widgets/contact/contact.php:
|
1145 |
msgid "Compact"
|
1146 |
msgstr ""
|
1147 |
|
1148 |
-
#: tmp/widgets/contact/contact.php:
|
1149 |
msgid "Akismet"
|
1150 |
msgstr ""
|
1151 |
|
1152 |
-
#: tmp/widgets/contact/contact.php:
|
1153 |
msgid "Use Akismet filtering"
|
1154 |
msgstr ""
|
1155 |
|
1156 |
-
#: tmp/widgets/contact/contact.php:
|
1157 |
msgid "Spam action"
|
1158 |
msgstr ""
|
1159 |
|
1160 |
-
#: tmp/widgets/contact/contact.php:
|
1161 |
msgid "Show error message"
|
1162 |
msgstr ""
|
1163 |
|
1164 |
-
#: tmp/widgets/contact/contact.php:
|
1165 |
msgid "Tag as spam in subject"
|
1166 |
msgstr ""
|
1167 |
|
1168 |
-
#: tmp/widgets/contact/contact.php:
|
1169 |
msgid "How to handle submissions that are identified as spam."
|
1170 |
msgstr ""
|
1171 |
|
1172 |
-
#: tmp/widgets/contact/contact.php:
|
1173 |
msgid "Container"
|
1174 |
msgstr ""
|
1175 |
|
1176 |
-
#: tmp/widgets/contact/contact.php:
|
1177 |
msgid "Border style"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
-
#: tmp/widgets/contact/contact.php:
|
1181 |
msgid "Hidden"
|
1182 |
msgstr ""
|
1183 |
|
1184 |
-
#: tmp/widgets/contact/contact.php:
|
1185 |
msgid "Dotted"
|
1186 |
msgstr ""
|
1187 |
|
1188 |
-
#: tmp/widgets/contact/contact.php:
|
1189 |
msgid "Dashed"
|
1190 |
msgstr ""
|
1191 |
|
1192 |
-
#: tmp/widgets/contact/contact.php:
|
1193 |
msgid "Solid"
|
1194 |
msgstr ""
|
1195 |
|
1196 |
-
#: tmp/widgets/contact/contact.php:
|
1197 |
msgid "Double"
|
1198 |
msgstr ""
|
1199 |
|
1200 |
-
#: tmp/widgets/contact/contact.php:
|
1201 |
msgid "Groove"
|
1202 |
msgstr ""
|
1203 |
|
1204 |
-
#: tmp/widgets/contact/contact.php:
|
1205 |
msgid "Ridge"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
-
#: tmp/widgets/contact/contact.php:
|
1209 |
msgid "Inset"
|
1210 |
msgstr ""
|
1211 |
|
1212 |
-
#: tmp/widgets/contact/contact.php:
|
1213 |
msgid "Outset"
|
1214 |
msgstr ""
|
1215 |
|
1216 |
-
#: tmp/widgets/contact/contact.php:
|
1217 |
msgid "Field labels"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
-
#: tmp/widgets/contact/contact.php:
|
1221 |
msgid "Color"
|
1222 |
msgstr ""
|
1223 |
|
1224 |
-
#: tmp/widgets/contact/contact.php:
|
1225 |
msgid "Position"
|
1226 |
msgstr ""
|
1227 |
|
1228 |
-
#: tmp/widgets/contact/contact.php:
|
1229 |
msgid "Above"
|
1230 |
msgstr ""
|
1231 |
|
1232 |
-
#: tmp/widgets/contact/contact.php:
|
1233 |
msgid "Below"
|
1234 |
msgstr ""
|
1235 |
|
1236 |
-
#: tmp/widgets/contact/contact.php:
|
1237 |
msgid "Inside"
|
1238 |
msgstr ""
|
1239 |
|
1240 |
-
#: tmp/widgets/contact/contact.php:
|
1241 |
msgid "Font Size"
|
1242 |
msgstr ""
|
1243 |
|
1244 |
-
#: tmp/widgets/contact/contact.php:
|
1245 |
msgid "Text Color"
|
1246 |
msgstr ""
|
1247 |
|
1248 |
-
#: tmp/widgets/contact/contact.php:
|
1249 |
msgid "Margin"
|
1250 |
msgstr ""
|
1251 |
|
1252 |
-
#: tmp/widgets/contact/contact.php:
|
1253 |
msgid "Height"
|
1254 |
msgstr ""
|
1255 |
|
1256 |
-
#: tmp/widgets/contact/contact.php:
|
1257 |
msgid "Background"
|
1258 |
msgstr ""
|
1259 |
|
1260 |
-
#: tmp/widgets/contact/contact.php:
|
1261 |
msgid " Border style"
|
1262 |
msgstr ""
|
1263 |
|
1264 |
-
#: tmp/widgets/contact/contact.php:
|
1265 |
msgid "Border rounding"
|
1266 |
msgstr ""
|
1267 |
|
1268 |
-
#: tmp/widgets/contact/contact.php:
|
1269 |
msgid "Field descriptions"
|
1270 |
msgstr ""
|
1271 |
|
1272 |
-
#: tmp/widgets/contact/contact.php:
|
1273 |
msgid "Style"
|
1274 |
msgstr ""
|
1275 |
|
1276 |
-
#: tmp/widgets/contact/contact.php:
|
1277 |
msgid "Italic"
|
1278 |
msgstr ""
|
1279 |
|
1280 |
-
#: tmp/widgets/contact/contact.php:
|
1281 |
msgid "Error messages"
|
1282 |
msgstr ""
|
1283 |
|
1284 |
-
#: tmp/widgets/contact/contact.php:
|
1285 |
msgid "Error background color"
|
1286 |
msgstr ""
|
1287 |
|
1288 |
-
#: tmp/widgets/contact/contact.php:
|
1289 |
msgid "Error border color"
|
1290 |
msgstr ""
|
1291 |
|
1292 |
-
#: tmp/widgets/contact/contact.php:
|
1293 |
msgid "Error text color"
|
1294 |
msgstr ""
|
1295 |
|
1296 |
-
#: tmp/widgets/contact/contact.php:
|
1297 |
msgid "Error padding"
|
1298 |
msgstr ""
|
1299 |
|
1300 |
-
#: tmp/widgets/contact/contact.php:
|
1301 |
msgid "Error margin"
|
1302 |
msgstr ""
|
1303 |
|
1304 |
-
#: tmp/widgets/contact/contact.php:
|
1305 |
msgid "Submit button"
|
1306 |
msgstr ""
|
1307 |
|
1308 |
-
#: tmp/widgets/contact/contact.php:
|
1309 |
msgid "Style submit button"
|
1310 |
msgstr ""
|
1311 |
|
1312 |
-
#: tmp/widgets/contact/contact.php:
|
1313 |
msgid "Style the button or leave it with default theme styling."
|
1314 |
msgstr ""
|
1315 |
|
1316 |
-
#: tmp/widgets/contact/contact.php:
|
1317 |
msgid "Gradient intensity"
|
1318 |
msgstr ""
|
1319 |
|
1320 |
-
#: tmp/widgets/contact/contact.php:
|
1321 |
msgid "Font weight"
|
1322 |
msgstr ""
|
1323 |
|
1324 |
-
#: tmp/widgets/contact/contact.php:
|
1325 |
msgid "Semi-bold"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
-
#: tmp/widgets/contact/contact.php:
|
1329 |
msgid "Bold"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
-
#: tmp/widgets/contact/contact.php:
|
1333 |
msgid "Inset highlight"
|
1334 |
msgstr ""
|
1335 |
|
1336 |
-
#: tmp/widgets/contact/contact.php:
|
1337 |
msgid "The white highlight at the bottom of the button"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
-
#: tmp/widgets/contact/contact.php:
|
1341 |
msgid "Input focus"
|
1342 |
msgstr ""
|
1343 |
|
1344 |
-
#: tmp/widgets/contact/contact.php:
|
1345 |
msgid "Get more form fields for the Contact Form Widget in %s"
|
1346 |
msgstr ""
|
1347 |
|
1348 |
-
#: tmp/widgets/contact/contact.php:
|
1349 |
msgid "SiteOrigin Premium"
|
1350 |
msgstr ""
|
1351 |
|
1352 |
-
#: tmp/widgets/contact/contact.php:
|
1353 |
msgid "Your Name"
|
1354 |
msgstr ""
|
1355 |
|
1356 |
-
#: tmp/widgets/contact/contact.php:
|
1357 |
msgid "Please enter your name"
|
1358 |
msgstr ""
|
1359 |
|
1360 |
-
#: tmp/widgets/contact/contact.php:
|
1361 |
msgid "Your Email"
|
1362 |
msgstr ""
|
1363 |
|
1364 |
-
#: tmp/widgets/contact/contact.php:
|
1365 |
msgid "Please enter a valid email address"
|
1366 |
msgstr ""
|
1367 |
|
1368 |
-
#: tmp/widgets/contact/contact.php:
|
1369 |
msgid "Please enter a subject"
|
1370 |
msgstr ""
|
1371 |
|
1372 |
-
#: tmp/widgets/contact/contact.php:
|
1373 |
msgid "Message"
|
1374 |
msgstr ""
|
1375 |
|
1376 |
-
#: tmp/widgets/contact/contact.php:
|
1377 |
msgid "Please write something"
|
1378 |
msgstr ""
|
1379 |
|
1380 |
-
#: tmp/widgets/contact/contact.php:
|
1381 |
msgid "Invalid email address."
|
1382 |
msgstr ""
|
1383 |
|
1384 |
-
#: tmp/widgets/contact/contact.php:
|
1385 |
msgid "Error sending email, please try again later."
|
1386 |
msgstr ""
|
1387 |
|
1388 |
-
#: tmp/widgets/contact/contact.php:
|
1389 |
msgid "A valid email is required"
|
1390 |
msgstr ""
|
1391 |
|
1392 |
-
#: tmp/widgets/contact/contact.php:
|
1393 |
msgid "The email address is invalid"
|
1394 |
msgstr ""
|
1395 |
|
1396 |
-
#: tmp/widgets/contact/contact.php:
|
1397 |
msgid "Missing subject"
|
1398 |
msgstr ""
|
1399 |
|
1400 |
-
#: tmp/widgets/contact/contact.php:
|
1401 |
msgid "Error validating your Captcha response."
|
1402 |
msgstr ""
|
1403 |
|
1404 |
-
#: tmp/widgets/contact/contact.php:
|
1405 |
msgid "Unfortunately our system identified your message as spam."
|
1406 |
msgstr ""
|
1407 |
|
1408 |
-
#: tmp/widgets/cta/cta.php:
|
1409 |
msgid "SiteOrigin Call-to-action"
|
1410 |
msgstr ""
|
1411 |
|
1412 |
-
#: tmp/widgets/cta/cta.php:
|
1413 |
msgid "A simple call-to-action widget with massive power."
|
1414 |
msgstr ""
|
1415 |
|
1416 |
-
#: tmp/widgets/cta/cta.php:
|
1417 |
msgid "Subtitle"
|
1418 |
msgstr ""
|
1419 |
|
1420 |
-
#: tmp/widgets/cta/cta.php:
|
1421 |
msgid "Subtitle color"
|
1422 |
msgstr ""
|
1423 |
|
1424 |
-
#: tmp/widgets/cta/cta.php:
|
1425 |
msgid "Button align"
|
1426 |
msgstr ""
|
1427 |
|
1428 |
-
#: tmp/widgets/cta/cta.php:
|
1429 |
msgid "Button"
|
1430 |
msgstr ""
|
1431 |
|
|
|
|
|
|
|
|
|
1432 |
#: tmp/widgets/editor/editor.php:16
|
1433 |
msgid "SiteOrigin Editor"
|
1434 |
msgstr ""
|
@@ -1445,491 +1449,491 @@ msgstr ""
|
|
1445 |
msgid "Enable the \"Automatically add paragraphs\" setting by default."
|
1446 |
msgstr ""
|
1447 |
|
1448 |
-
#: tmp/widgets/features/features.php:
|
1449 |
msgid "SiteOrigin Features"
|
1450 |
msgstr ""
|
1451 |
|
1452 |
-
#: tmp/widgets/features/features.php:
|
1453 |
msgid "Displays a list of features."
|
1454 |
msgstr ""
|
1455 |
|
1456 |
-
#: tmp/widgets/features/features.php:
|
1457 |
msgid "Features"
|
1458 |
msgstr ""
|
1459 |
|
1460 |
-
#: tmp/widgets/features/features.php:
|
1461 |
msgid "Feature"
|
1462 |
msgstr ""
|
1463 |
|
1464 |
-
#: tmp/widgets/features/features.php:
|
1465 |
msgid "Container color"
|
1466 |
msgstr ""
|
1467 |
|
1468 |
-
#: tmp/widgets/features/features.php:
|
1469 |
msgid "Container Position"
|
1470 |
msgstr ""
|
1471 |
|
1472 |
-
#: tmp/widgets/features/features.php:
|
1473 |
msgid "Icon title"
|
1474 |
msgstr ""
|
1475 |
|
1476 |
-
#: tmp/widgets/features/features.php:
|
1477 |
msgid "Icon image"
|
1478 |
msgstr ""
|
1479 |
|
1480 |
-
#: tmp/widgets/features/features.php:
|
1481 |
msgid "Use your own icon image."
|
1482 |
msgstr ""
|
1483 |
|
1484 |
-
#: tmp/widgets/features/features.php:
|
1485 |
msgid "Icon image size"
|
1486 |
msgstr ""
|
1487 |
|
1488 |
-
#: tmp/widgets/features/features.php:
|
1489 |
msgid "Title text"
|
1490 |
msgstr ""
|
1491 |
|
1492 |
-
#: tmp/widgets/features/features.php:
|
1493 |
msgid "More link text"
|
1494 |
msgstr ""
|
1495 |
|
1496 |
-
#: tmp/widgets/features/features.php:
|
1497 |
msgid "More link URL"
|
1498 |
msgstr ""
|
1499 |
|
1500 |
-
#: tmp/widgets/features/features.php:
|
1501 |
msgid "Font Design"
|
1502 |
msgstr ""
|
1503 |
|
1504 |
-
#: tmp/widgets/features/features.php:
|
1505 |
msgid "More Link"
|
1506 |
msgstr ""
|
1507 |
|
1508 |
-
#: tmp/widgets/features/features.php:
|
1509 |
msgid "Container shape"
|
1510 |
msgstr ""
|
1511 |
|
1512 |
-
#: tmp/widgets/features/features.php:
|
1513 |
msgid "Container size"
|
1514 |
msgstr ""
|
1515 |
|
1516 |
-
#: tmp/widgets/features/features.php:
|
1517 |
msgid "Icon size"
|
1518 |
msgstr ""
|
1519 |
|
1520 |
-
#: tmp/widgets/features/features.php:
|
1521 |
msgid "Use icon size for custom icon"
|
1522 |
msgstr ""
|
1523 |
|
1524 |
-
#: tmp/widgets/features/features.php:
|
1525 |
msgid "Features per row"
|
1526 |
msgstr ""
|
1527 |
|
1528 |
-
#: tmp/widgets/features/features.php:
|
1529 |
msgid "Responsive layout"
|
1530 |
msgstr ""
|
1531 |
|
1532 |
-
#: tmp/widgets/features/features.php:
|
1533 |
msgid "Link feature title to more URL"
|
1534 |
msgstr ""
|
1535 |
|
1536 |
-
#: tmp/widgets/features/features.php:
|
1537 |
msgid "Link icon to more URL"
|
1538 |
msgstr ""
|
1539 |
|
1540 |
-
#: tmp/widgets/features/features.php:
|
1541 |
msgid "Open more URL in a new window"
|
1542 |
msgstr ""
|
1543 |
|
1544 |
-
#: tmp/widgets/features/features.php:
|
1545 |
msgid "Responsive Breakpoint"
|
1546 |
msgstr ""
|
1547 |
|
1548 |
-
#: tmp/widgets/features/features.php:
|
1549 |
msgid "This setting controls when the features widget will collapse for mobile devices. The default value is 520px"
|
1550 |
msgstr ""
|
1551 |
|
1552 |
-
#: tmp/widgets/google-map/google-map.php:
|
1553 |
msgid "SiteOrigin Google Maps"
|
1554 |
msgstr ""
|
1555 |
|
1556 |
-
#: tmp/widgets/google-map/google-map.php:
|
1557 |
msgid "A Google Maps widget."
|
1558 |
msgstr ""
|
1559 |
|
1560 |
-
#: tmp/widgets/google-map/google-map.php:
|
1561 |
msgid "Map center"
|
1562 |
msgstr ""
|
1563 |
|
1564 |
-
#: tmp/widgets/google-map/google-map.php:
|
1565 |
msgid "The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the <strong>Geocoding API</strong> in the %sGoogle APIs Dashboard%s."
|
1566 |
msgstr ""
|
1567 |
|
1568 |
-
#: tmp/widgets/google-map/google-map.php:
|
1569 |
msgid "API key"
|
1570 |
msgstr ""
|
1571 |
|
1572 |
-
#: tmp/widgets/google-map/google-map.php:
|
1573 |
msgid "Enter your %sAPI key%s. Your map may not function correctly without one."
|
1574 |
msgstr ""
|
1575 |
|
1576 |
-
#: tmp/widgets/google-map/google-map.php:
|
1577 |
msgid "Set map display options."
|
1578 |
msgstr ""
|
1579 |
|
1580 |
-
#: tmp/widgets/google-map/google-map.php:
|
1581 |
msgid "Map type"
|
1582 |
msgstr ""
|
1583 |
|
1584 |
-
#: tmp/widgets/google-map/google-map.php:
|
1585 |
msgid "Interactive"
|
1586 |
msgstr ""
|
1587 |
|
1588 |
-
#: tmp/widgets/google-map/google-map.php:
|
1589 |
msgid "Static image"
|
1590 |
msgstr ""
|
1591 |
|
1592 |
-
#: tmp/widgets/google-map/google-map.php:
|
1593 |
msgid "Zoom level"
|
1594 |
msgstr ""
|
1595 |
|
1596 |
-
#: tmp/widgets/google-map/google-map.php:
|
1597 |
msgid "A value from 0 (the world) to 21 (street level)."
|
1598 |
msgstr ""
|
1599 |
|
1600 |
-
#: tmp/widgets/google-map/google-map.php:
|
1601 |
msgid "Scroll to zoom"
|
1602 |
msgstr ""
|
1603 |
|
1604 |
-
#: tmp/widgets/google-map/google-map.php:
|
1605 |
msgid "Allow scrolling over the map to zoom in or out."
|
1606 |
msgstr ""
|
1607 |
|
1608 |
-
#: tmp/widgets/google-map/google-map.php:
|
1609 |
msgid "Draggable"
|
1610 |
msgstr ""
|
1611 |
|
1612 |
-
#: tmp/widgets/google-map/google-map.php:
|
1613 |
msgid "Allow dragging the map to move it around."
|
1614 |
msgstr ""
|
1615 |
|
1616 |
-
#: tmp/widgets/google-map/google-map.php:
|
1617 |
msgid "Disable default UI"
|
1618 |
msgstr ""
|
1619 |
|
1620 |
-
#: tmp/widgets/google-map/google-map.php:
|
1621 |
msgid "Hides the default Google Maps controls."
|
1622 |
msgstr ""
|
1623 |
|
1624 |
-
#: tmp/widgets/google-map/google-map.php:
|
1625 |
msgid "Keep map centered"
|
1626 |
msgstr ""
|
1627 |
|
1628 |
-
#: tmp/widgets/google-map/google-map.php:
|
1629 |
msgid "Keeps the map centered when it's container is resized."
|
1630 |
msgstr ""
|
1631 |
|
1632 |
-
#: tmp/widgets/google-map/google-map.php:
|
1633 |
msgid "Fallback Image"
|
1634 |
msgstr ""
|
1635 |
|
1636 |
-
#: tmp/widgets/google-map/google-map.php:
|
1637 |
msgid "This image will be displayed if there are any problems with displaying the specified map."
|
1638 |
msgstr ""
|
1639 |
|
1640 |
-
#: tmp/widgets/google-map/google-map.php:
|
1641 |
msgid "Fallback Image Size"
|
1642 |
msgstr ""
|
1643 |
|
1644 |
-
#: tmp/widgets/google-map/google-map.php:
|
1645 |
msgid "Markers"
|
1646 |
msgstr ""
|
1647 |
|
1648 |
-
#: tmp/widgets/google-map/google-map.php:
|
1649 |
msgid "Use markers to identify points of interest on the map."
|
1650 |
msgstr ""
|
1651 |
|
1652 |
-
#: tmp/widgets/google-map/google-map.php:
|
1653 |
msgid "Show marker at map center"
|
1654 |
msgstr ""
|
1655 |
|
1656 |
-
#: tmp/widgets/google-map/google-map.php:
|
1657 |
msgid "Marker icon"
|
1658 |
msgstr ""
|
1659 |
|
1660 |
-
#: tmp/widgets/google-map/google-map.php:
|
1661 |
msgid "Replaces the default map marker with your own image."
|
1662 |
msgstr ""
|
1663 |
|
1664 |
-
#: tmp/widgets/google-map/google-map.php:
|
1665 |
msgid "Draggable markers"
|
1666 |
msgstr ""
|
1667 |
|
1668 |
-
#: tmp/widgets/google-map/google-map.php:
|
1669 |
msgid "Marker positions"
|
1670 |
msgstr ""
|
1671 |
|
1672 |
-
#: tmp/widgets/google-map/google-map.php:
|
1673 |
msgid "Please be aware that adding more than 10 markers may cause a slight delay before they appear, due to Google Geocoding API rate limits."
|
1674 |
msgstr ""
|
1675 |
|
1676 |
-
#: tmp/widgets/google-map/google-map.php:
|
1677 |
msgid "Marker"
|
1678 |
msgstr ""
|
1679 |
|
1680 |
-
#: tmp/widgets/google-map/google-map.php:
|
1681 |
msgid "Place"
|
1682 |
msgstr ""
|
1683 |
|
1684 |
-
#: tmp/widgets/google-map/google-map.php:
|
1685 |
msgid "Info Window Content"
|
1686 |
msgstr ""
|
1687 |
|
1688 |
-
#: tmp/widgets/google-map/google-map.php:
|
1689 |
msgid "Info Window max width"
|
1690 |
msgstr ""
|
1691 |
|
1692 |
-
#: tmp/widgets/google-map/google-map.php:
|
1693 |
msgid "Custom Marker icon"
|
1694 |
msgstr ""
|
1695 |
|
1696 |
-
#: tmp/widgets/google-map/google-map.php:
|
1697 |
msgid "Replace the default map marker with your own image for each marker."
|
1698 |
msgstr ""
|
1699 |
|
1700 |
-
#: tmp/widgets/google-map/google-map.php:
|
1701 |
msgid "When should Info Windows be displayed?"
|
1702 |
msgstr ""
|
1703 |
|
1704 |
-
#: tmp/widgets/google-map/google-map.php:
|
1705 |
msgid "Click"
|
1706 |
msgstr ""
|
1707 |
|
1708 |
-
#: tmp/widgets/google-map/google-map.php:
|
1709 |
msgid "Mouse over"
|
1710 |
msgstr ""
|
1711 |
|
1712 |
-
#: tmp/widgets/google-map/google-map.php:
|
1713 |
msgid "Always"
|
1714 |
msgstr ""
|
1715 |
|
1716 |
-
#: tmp/widgets/google-map/google-map.php:
|
1717 |
msgid "Allow multiple simultaneous Info Windows?"
|
1718 |
msgstr ""
|
1719 |
|
1720 |
-
#: tmp/widgets/google-map/google-map.php:
|
1721 |
msgid "Styles"
|
1722 |
msgstr ""
|
1723 |
|
1724 |
-
#: tmp/widgets/google-map/google-map.php:
|
1725 |
msgid "Apply custom colors to map features, or hide them completely."
|
1726 |
msgstr ""
|
1727 |
|
1728 |
-
#: tmp/widgets/google-map/google-map.php:
|
1729 |
msgid "Map styles"
|
1730 |
msgstr ""
|
1731 |
|
1732 |
-
#: tmp/widgets/google-map/google-map.php:
|
1733 |
msgid "Custom"
|
1734 |
msgstr ""
|
1735 |
|
1736 |
-
#: tmp/widgets/google-map/google-map.php:
|
1737 |
msgid "Predefined Styles"
|
1738 |
msgstr ""
|
1739 |
|
1740 |
-
#: tmp/widgets/google-map/google-map.php:
|
1741 |
msgid "Styled map name"
|
1742 |
msgstr ""
|
1743 |
|
1744 |
-
#: tmp/widgets/google-map/google-map.php:
|
1745 |
msgid "Raw JSON styles"
|
1746 |
msgstr ""
|
1747 |
|
1748 |
-
#: tmp/widgets/google-map/google-map.php:
|
1749 |
msgid "Copy and paste predefined styles here from <a href=\"http://snazzymaps.com/\" target=\"_blank\" rel=\"noopener noreferrer\">Snazzy Maps</a>."
|
1750 |
msgstr ""
|
1751 |
|
1752 |
-
#: tmp/widgets/google-map/google-map.php:
|
1753 |
msgid "Custom map styles"
|
1754 |
msgstr ""
|
1755 |
|
1756 |
-
#: tmp/widgets/google-map/google-map.php:
|
1757 |
msgid "Select map feature to style"
|
1758 |
msgstr ""
|
1759 |
|
1760 |
-
#: tmp/widgets/google-map/google-map.php:
|
1761 |
msgid "Water"
|
1762 |
msgstr ""
|
1763 |
|
1764 |
-
#: tmp/widgets/google-map/google-map.php:
|
1765 |
msgid "Highways"
|
1766 |
msgstr ""
|
1767 |
|
1768 |
-
#: tmp/widgets/google-map/google-map.php:
|
1769 |
msgid "Arterial roads"
|
1770 |
msgstr ""
|
1771 |
|
1772 |
-
#: tmp/widgets/google-map/google-map.php:
|
1773 |
msgid "Local roads"
|
1774 |
msgstr ""
|
1775 |
|
1776 |
-
#: tmp/widgets/google-map/google-map.php:
|
1777 |
msgid "Transit lines"
|
1778 |
msgstr ""
|
1779 |
|
1780 |
-
#: tmp/widgets/google-map/google-map.php:
|
1781 |
msgid "Transit stations"
|
1782 |
msgstr ""
|
1783 |
|
1784 |
-
#: tmp/widgets/google-map/google-map.php:
|
1785 |
msgid "Man-made landscape"
|
1786 |
msgstr ""
|
1787 |
|
1788 |
-
#: tmp/widgets/google-map/google-map.php:
|
1789 |
msgid "Natural landscape landcover"
|
1790 |
msgstr ""
|
1791 |
|
1792 |
-
#: tmp/widgets/google-map/google-map.php:
|
1793 |
msgid "Natural landscape terrain"
|
1794 |
msgstr ""
|
1795 |
|
1796 |
-
#: tmp/widgets/google-map/google-map.php:
|
1797 |
msgid "Point of interest - Attractions"
|
1798 |
msgstr ""
|
1799 |
|
1800 |
-
#: tmp/widgets/google-map/google-map.php:
|
1801 |
msgid "Point of interest - Business"
|
1802 |
msgstr ""
|
1803 |
|
1804 |
-
#: tmp/widgets/google-map/google-map.php:
|
1805 |
msgid "Point of interest - Government"
|
1806 |
msgstr ""
|
1807 |
|
1808 |
-
#: tmp/widgets/google-map/google-map.php:
|
1809 |
msgid "Point of interest - Medical"
|
1810 |
msgstr ""
|
1811 |
|
1812 |
-
#: tmp/widgets/google-map/google-map.php:
|
1813 |
msgid "Point of interest - Parks"
|
1814 |
msgstr ""
|
1815 |
|
1816 |
-
#: tmp/widgets/google-map/google-map.php:
|
1817 |
msgid "Point of interest - Places of worship"
|
1818 |
msgstr ""
|
1819 |
|
1820 |
-
#: tmp/widgets/google-map/google-map.php:
|
1821 |
msgid "Point of interest - Schools"
|
1822 |
msgstr ""
|
1823 |
|
1824 |
-
#: tmp/widgets/google-map/google-map.php:
|
1825 |
msgid "Point of interest - Sports complexes"
|
1826 |
msgstr ""
|
1827 |
|
1828 |
-
#: tmp/widgets/google-map/google-map.php:
|
1829 |
msgid "Select element type to style"
|
1830 |
msgstr ""
|
1831 |
|
1832 |
-
#: tmp/widgets/google-map/google-map.php:
|
1833 |
msgid "Geometry"
|
1834 |
msgstr ""
|
1835 |
|
1836 |
-
#: tmp/widgets/google-map/google-map.php:
|
1837 |
msgid "Labels"
|
1838 |
msgstr ""
|
1839 |
|
1840 |
-
#: tmp/widgets/google-map/google-map.php:
|
1841 |
msgid "Visible"
|
1842 |
msgstr ""
|
1843 |
|
1844 |
-
#: tmp/widgets/google-map/google-map.php:
|
1845 |
msgid "Directions"
|
1846 |
msgstr ""
|
1847 |
|
1848 |
-
#: tmp/widgets/google-map/google-map.php:
|
1849 |
msgid "Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the <strong>Directions API</strong> in the %sGoogle APIs Dashboard%s."
|
1850 |
msgstr ""
|
1851 |
|
1852 |
-
#: tmp/widgets/google-map/google-map.php:
|
1853 |
msgid "Starting point"
|
1854 |
msgstr ""
|
1855 |
|
1856 |
-
#: tmp/widgets/google-map/google-map.php:
|
1857 |
msgid "Destination"
|
1858 |
msgstr ""
|
1859 |
|
1860 |
-
#: tmp/widgets/google-map/google-map.php:
|
1861 |
msgid "Travel mode"
|
1862 |
msgstr ""
|
1863 |
|
1864 |
-
#: tmp/widgets/google-map/google-map.php:
|
1865 |
msgid "Driving"
|
1866 |
msgstr ""
|
1867 |
|
1868 |
-
#: tmp/widgets/google-map/google-map.php:
|
1869 |
msgid "Walking"
|
1870 |
msgstr ""
|
1871 |
|
1872 |
-
#: tmp/widgets/google-map/google-map.php:
|
1873 |
msgid "Bicycling"
|
1874 |
msgstr ""
|
1875 |
|
1876 |
-
#: tmp/widgets/google-map/google-map.php:
|
1877 |
msgid "Transit"
|
1878 |
msgstr ""
|
1879 |
|
1880 |
-
#: tmp/widgets/google-map/google-map.php:
|
1881 |
msgid "Avoid highways"
|
1882 |
msgstr ""
|
1883 |
|
1884 |
-
#: tmp/widgets/google-map/google-map.php:
|
1885 |
msgid "Avoid tolls"
|
1886 |
msgstr ""
|
1887 |
|
1888 |
-
#: tmp/widgets/google-map/google-map.php:
|
1889 |
msgid "Preserve viewport"
|
1890 |
msgstr ""
|
1891 |
|
1892 |
-
#: tmp/widgets/google-map/google-map.php:
|
1893 |
msgid "This will prevent the map from centering and zooming around the directions. Use this when you have other markers or features on your map."
|
1894 |
msgstr ""
|
1895 |
|
1896 |
-
#: tmp/widgets/google-map/google-map.php:
|
1897 |
msgid "Waypoints"
|
1898 |
msgstr ""
|
1899 |
|
1900 |
-
#: tmp/widgets/google-map/google-map.php:
|
1901 |
msgid "Waypoint"
|
1902 |
msgstr ""
|
1903 |
|
1904 |
-
#: tmp/widgets/google-map/google-map.php:
|
1905 |
msgid "Location"
|
1906 |
msgstr ""
|
1907 |
|
1908 |
-
#: tmp/widgets/google-map/google-map.php:
|
1909 |
msgid "Stopover"
|
1910 |
msgstr ""
|
1911 |
|
1912 |
-
#: tmp/widgets/google-map/google-map.php:
|
1913 |
msgid "Whether or not this is a stop on the route or just a route preference."
|
1914 |
msgstr ""
|
1915 |
|
1916 |
-
#: tmp/widgets/google-map/google-map.php:
|
1917 |
msgid "Optimize waypoints"
|
1918 |
msgstr ""
|
1919 |
|
1920 |
-
#: tmp/widgets/google-map/google-map.php:
|
1921 |
msgid "Allow the Google Maps service to reorder waypoints for the shortest travelling distance."
|
1922 |
msgstr ""
|
1923 |
|
1924 |
-
#: tmp/widgets/google-map/google-map.php:
|
1925 |
msgid "Enter your %sAPI key%s. Your map won't function correctly without one."
|
1926 |
msgstr ""
|
1927 |
|
1928 |
-
#: tmp/widgets/google-map/google-map.php:
|
1929 |
msgid "There were no results for the place you entered. Please try another."
|
1930 |
msgstr ""
|
1931 |
|
1932 |
-
#: tmp/widgets/google-map/google-map.php:
|
1933 |
msgid "Custom Map"
|
1934 |
msgstr ""
|
1935 |
|
@@ -2017,139 +2021,139 @@ msgstr ""
|
|
2017 |
msgid "Sub Headline"
|
2018 |
msgstr ""
|
2019 |
|
2020 |
-
#: tmp/widgets/headline/headline.php:244, tmp/widgets/hero/hero.php:
|
2021 |
msgid "Use FitText"
|
2022 |
msgstr ""
|
2023 |
|
2024 |
-
#: tmp/widgets/headline/headline.php:245, tmp/widgets/hero/hero.php:
|
2025 |
msgid "Dynamically adjust your heading font size based on screen size."
|
2026 |
msgstr ""
|
2027 |
|
2028 |
-
#: tmp/widgets/headline/headline.php:258, tmp/widgets/hero/hero.php:
|
2029 |
msgid "FitText Compressor Strength"
|
2030 |
msgstr ""
|
2031 |
|
2032 |
-
#: tmp/widgets/headline/headline.php:259, tmp/widgets/hero/hero.php:
|
2033 |
msgid "How aggressively FitText should resize your heading."
|
2034 |
msgstr ""
|
2035 |
|
2036 |
-
#: tmp/widgets/hero/hero.php:
|
2037 |
msgid "SiteOrigin Hero"
|
2038 |
msgstr ""
|
2039 |
|
2040 |
-
#: tmp/widgets/hero/hero.php:
|
2041 |
msgid "A big hero image with a few settings to make it your own."
|
2042 |
msgstr ""
|
2043 |
|
2044 |
-
#: tmp/widgets/hero/hero.php:
|
2045 |
msgid "Hero frames"
|
2046 |
msgstr ""
|
2047 |
|
2048 |
-
#: tmp/widgets/hero/hero.php:
|
2049 |
msgid "Frame"
|
2050 |
msgstr ""
|
2051 |
|
2052 |
-
#: tmp/widgets/hero/hero.php:
|
2053 |
msgid "Buttons"
|
2054 |
msgstr ""
|
2055 |
|
2056 |
-
#: tmp/widgets/hero/hero.php:
|
2057 |
msgid "Add [buttons] shortcode to the content to insert these buttons."
|
2058 |
msgstr ""
|
2059 |
|
2060 |
-
#: tmp/widgets/hero/hero.php:
|
2061 |
msgid "Background image"
|
2062 |
msgstr ""
|
2063 |
|
2064 |
-
#: tmp/widgets/hero/hero.php:
|
2065 |
msgid "Image size"
|
2066 |
msgstr ""
|
2067 |
|
2068 |
-
#: tmp/widgets/hero/hero.php:
|
2069 |
msgid "Background image type"
|
2070 |
msgstr ""
|
2071 |
|
2072 |
-
#: tmp/widgets/hero/hero.php:
|
2073 |
msgid "Cover"
|
2074 |
msgstr ""
|
2075 |
|
2076 |
-
#: tmp/widgets/hero/hero.php:
|
2077 |
msgid "Background image opacity"
|
2078 |
msgstr ""
|
2079 |
|
2080 |
-
#: tmp/widgets/hero/hero.php:
|
2081 |
msgid "Open URL in a new window"
|
2082 |
msgstr ""
|
2083 |
|
2084 |
-
#: tmp/widgets/hero/hero.php:
|
2085 |
msgid "Video"
|
2086 |
msgstr ""
|
2087 |
|
2088 |
-
#: tmp/widgets/hero/hero.php:
|
2089 |
msgid "Background videos"
|
2090 |
msgstr ""
|
2091 |
|
2092 |
-
#: tmp/widgets/hero/hero.php:
|
2093 |
msgid "Slider Controls"
|
2094 |
msgstr ""
|
2095 |
|
2096 |
-
#: tmp/widgets/hero/hero.php:
|
2097 |
msgid "Design and Layout"
|
2098 |
msgstr ""
|
2099 |
|
2100 |
-
#: tmp/widgets/hero/hero.php:
|
2101 |
msgid "Top and bottom padding"
|
2102 |
msgstr ""
|
2103 |
|
2104 |
-
#: tmp/widgets/hero/hero.php:
|
2105 |
msgid "Extra top padding"
|
2106 |
msgstr ""
|
2107 |
|
2108 |
-
#: tmp/widgets/hero/hero.php:
|
2109 |
msgid "Additional padding added to the top of the slider"
|
2110 |
msgstr ""
|
2111 |
|
2112 |
-
#: tmp/widgets/hero/hero.php:
|
2113 |
msgid "Side padding"
|
2114 |
msgstr ""
|
2115 |
|
2116 |
-
#: tmp/widgets/hero/hero.php:
|
2117 |
msgid "Maximum container width"
|
2118 |
msgstr ""
|
2119 |
|
2120 |
-
#: tmp/widgets/hero/hero.php:
|
2121 |
msgid "Heading font"
|
2122 |
msgstr ""
|
2123 |
|
2124 |
-
#: tmp/widgets/hero/hero.php:
|
2125 |
msgid "Heading color"
|
2126 |
msgstr ""
|
2127 |
|
2128 |
-
#: tmp/widgets/hero/hero.php:
|
2129 |
msgid "Heading size"
|
2130 |
msgstr ""
|
2131 |
|
2132 |
-
#: tmp/widgets/hero/hero.php:
|
2133 |
msgid "Heading shadow intensity"
|
2134 |
msgstr ""
|
2135 |
|
2136 |
-
#: tmp/widgets/hero/hero.php:
|
2137 |
msgid "Text size"
|
2138 |
msgstr ""
|
2139 |
|
2140 |
-
#: tmp/widgets/hero/hero.php:
|
2141 |
msgid "Text font"
|
2142 |
msgstr ""
|
2143 |
|
2144 |
-
#: tmp/widgets/hero/hero.php:
|
2145 |
msgid "Text shadow intensity"
|
2146 |
msgstr ""
|
2147 |
|
2148 |
-
#: tmp/widgets/hero/hero.php:
|
2149 |
msgid "Link color"
|
2150 |
msgstr ""
|
2151 |
|
2152 |
-
#: tmp/widgets/hero/hero.php:
|
2153 |
msgid "Link Hover Color"
|
2154 |
msgstr ""
|
2155 |
|
@@ -2177,7 +2181,7 @@ msgstr ""
|
|
2177 |
msgid "Image title"
|
2178 |
msgstr ""
|
2179 |
|
2180 |
-
#: tmp/widgets/image-grid/image-grid.php:71, tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2181 |
msgid "URL"
|
2182 |
msgstr ""
|
2183 |
|
@@ -2637,35 +2641,35 @@ msgstr ""
|
|
2637 |
msgid "YouTube"
|
2638 |
msgstr ""
|
2639 |
|
2640 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2641 |
msgid "SiteOrigin Social Media Buttons"
|
2642 |
msgstr ""
|
2643 |
|
2644 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2645 |
msgid "A social media buttons widget."
|
2646 |
msgstr ""
|
2647 |
|
2648 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2649 |
msgid "Mobile Collapse Width"
|
2650 |
msgstr ""
|
2651 |
|
2652 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2653 |
msgid "This setting allows you to set the resoloution for when the Mobile Align setting will be used."
|
2654 |
msgstr ""
|
2655 |
|
2656 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2657 |
msgid "Networks"
|
2658 |
msgstr ""
|
2659 |
|
2660 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2661 |
msgid "Network"
|
2662 |
msgstr ""
|
2663 |
|
2664 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2665 |
msgid "Select network"
|
2666 |
msgstr ""
|
2667 |
|
2668 |
-
#: tmp/widgets/social-media-buttons/social-media-buttons.php:
|
2669 |
msgid "Mobile Align"
|
2670 |
msgstr ""
|
2671 |
|
@@ -2725,123 +2729,123 @@ msgstr ""
|
|
2725 |
msgid "Hover color"
|
2726 |
msgstr ""
|
2727 |
|
2728 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2729 |
msgid "SiteOrigin Testimonials"
|
2730 |
msgstr ""
|
2731 |
|
2732 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2733 |
msgid "Share your product/service testimonials in a variety of different ways."
|
2734 |
msgstr ""
|
2735 |
|
2736 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2737 |
msgid "Testimonials"
|
2738 |
msgstr ""
|
2739 |
|
2740 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2741 |
msgid "Testimonial"
|
2742 |
msgstr ""
|
2743 |
|
2744 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2745 |
msgid "The author of the testimonial"
|
2746 |
msgstr ""
|
2747 |
|
2748 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2749 |
msgid "Link name"
|
2750 |
msgstr ""
|
2751 |
|
2752 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2753 |
msgid "Their location or company name"
|
2754 |
msgstr ""
|
2755 |
|
2756 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2757 |
msgid "Link image"
|
2758 |
msgstr ""
|
2759 |
|
2760 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2761 |
msgid "What your customer had to say"
|
2762 |
msgstr ""
|
2763 |
|
2764 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2765 |
msgid "Open In New Window"
|
2766 |
msgstr ""
|
2767 |
|
2768 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2769 |
msgid "Testimonials per row"
|
2770 |
msgstr ""
|
2771 |
|
2772 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2773 |
msgid "Responsive"
|
2774 |
msgstr ""
|
2775 |
|
2776 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2777 |
msgid "Tablet"
|
2778 |
msgstr ""
|
2779 |
|
2780 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2781 |
msgid "Resolution"
|
2782 |
msgstr ""
|
2783 |
|
2784 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2785 |
msgid "The resolution to treat as a mobile resolution."
|
2786 |
msgstr ""
|
2787 |
|
2788 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2789 |
msgid "Mobile Phone"
|
2790 |
msgstr ""
|
2791 |
|
2792 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2793 |
msgid "The resolution to treat as a tablet resolution."
|
2794 |
msgstr ""
|
2795 |
|
2796 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2797 |
msgid "Testimonial image shape"
|
2798 |
msgstr ""
|
2799 |
|
2800 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2801 |
msgid "Square"
|
2802 |
msgstr ""
|
2803 |
|
2804 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2805 |
msgid "Round"
|
2806 |
msgstr ""
|
2807 |
|
2808 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2809 |
msgid "Colors"
|
2810 |
msgstr ""
|
2811 |
|
2812 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2813 |
msgid "Widget Background"
|
2814 |
msgstr ""
|
2815 |
|
2816 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2817 |
msgid "Text Background"
|
2818 |
msgstr ""
|
2819 |
|
2820 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2821 |
msgid "Testimonial Radius"
|
2822 |
msgstr ""
|
2823 |
|
2824 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2825 |
msgid "User position"
|
2826 |
msgstr ""
|
2827 |
|
2828 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2829 |
msgid "Middle"
|
2830 |
msgstr ""
|
2831 |
|
2832 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2833 |
msgid "Testimonial layout"
|
2834 |
msgstr ""
|
2835 |
|
2836 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2837 |
msgid "Side by side"
|
2838 |
msgstr ""
|
2839 |
|
2840 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2841 |
msgid "Text above user"
|
2842 |
msgstr ""
|
2843 |
|
2844 |
-
#: tmp/widgets/testimonial/testimonial.php:
|
2845 |
msgid "Text below user"
|
2846 |
msgstr ""
|
2847 |
|
17 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
|
20 |
+
#: tmp/admin/tpl/admin.php:17, tmp/so-widgets-bundle.php:397
|
21 |
msgid "SiteOrigin Widgets Bundle"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: tmp/admin/tpl/admin.php:23
|
25 |
msgid "Filter Widgets"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: tmp/admin/tpl/admin.php:33, tmp/base/inc/fields/posts.class.php:12, tmp/widgets/google-map/google-map.php:673
|
29 |
msgid "All"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: tmp/admin/tpl/admin.php:35
|
33 |
msgid "Enabled"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: tmp/admin/tpl/admin.php:37
|
37 |
msgid "Disabled"
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: tmp/admin/tpl/admin.php:95
|
41 |
msgid "Active"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: tmp/admin/tpl/admin.php:139
|
45 |
msgid "Activate"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: tmp/admin/tpl/admin.php:141
|
49 |
msgid "Deactivate"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: tmp/admin/tpl/admin.php:179, tmp/widgets/contact/contact.php:115, tmp/widgets/google-map/google-map.php:125, tmp/widgets/testimonial/testimonial.php:197
|
53 |
msgid "Settings"
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: tmp/admin/tpl/admin.php:207
|
57 |
msgid "Developers - create your own widgets for the Widgets Bundle."
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: tmp/admin/tpl/admin.php:209
|
61 |
msgid "Read More"
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: tmp/admin/tpl/admin.php:223
|
65 |
msgid "Widget Settings"
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: tmp/admin/tpl/admin.php:245
|
69 |
msgid "Save"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: tmp/base/inc/actions.php:10, tmp/base/inc/actions.php:73, tmp/base/inc/actions.php:117, tmp/base/inc/actions.php:153, tmp/base/inc/actions.php:166, tmp/base/inc/actions.php:170, tmp/base/inc/actions.php:261, tmp/base/inc/actions.php:264, tmp/so-widgets-bundle.php:705, tmp/so-widgets-bundle.php:753, tmp/so-widgets-bundle.php:779, tmp/so-widgets-bundle.php:839, tmp/so-widgets-bundle.php:861, tmp/so-widgets-bundle.php:993, tmp/so-widgets-bundle.php:1015
|
73 |
msgid "Invalid request."
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: tmp/base/inc/actions.php:12, tmp/base/inc/actions.php:20, tmp/so-widgets-bundle.php:719, tmp/so-widgets-bundle.php:1005
|
77 |
msgid "Invalid post."
|
78 |
msgstr ""
|
79 |
|
117 |
msgid "SiteOrigin Page Builder"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: tmp/base/inc/fields/date-range.class.php:31, tmp/base/inc/fields/date-range.class.php:45, tmp/widgets/contact/contact.php:2375
|
121 |
msgid "From"
|
122 |
msgstr ""
|
123 |
|
297 |
msgid "Author"
|
298 |
msgstr ""
|
299 |
|
300 |
+
#: tmp/base/inc/fields/posts.class.php:82, tmp/widgets/accordion/accordion.php:46, tmp/widgets/accordion/accordion.php:59, tmp/widgets/contact/contact.php:93, tmp/widgets/cta/cta.php:125, tmp/widgets/editor/editor.php:32, tmp/widgets/features/features.php:263, tmp/widgets/post-carousel/post-carousel.php:97, tmp/widgets/price-table/price-table.php:41, tmp/widgets/price-table/price-table.php:60, tmp/widgets/simple-masonry/simple-masonry.php:43, tmp/widgets/simple-masonry/simple-masonry.php:74, tmp/widgets/social-media-buttons/social-media-buttons.php:105, tmp/widgets/tabs/tabs.php:46, tmp/widgets/tabs/tabs.php:59, tmp/widgets/taxonomy/taxonomy.php:33, tmp/widgets/testimonial/testimonial.php:79, tmp/widgets/video/video.php:32
|
301 |
msgid "Title"
|
302 |
msgstr ""
|
303 |
|
357 |
msgid "Sticky posts"
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: tmp/base/inc/fields/posts.class.php:115, tmp/compat/beaver-builder/beaver-builder.php:129, tmp/widgets/google-map/google-map.php:537, tmp/widgets/image/image.php:46
|
361 |
msgid "Default"
|
362 |
msgstr ""
|
363 |
|
413 |
msgid "Widgets Bundle Post Meta Data"
|
414 |
msgstr ""
|
415 |
|
416 |
+
#: tmp/base/inc/widgets/base-slider.class.php:107
|
417 |
msgid "Animation speed"
|
418 |
msgstr ""
|
419 |
|
420 |
+
#: tmp/base/inc/widgets/base-slider.class.php:109
|
421 |
msgid "Animation speed in milliseconds."
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: tmp/base/inc/widgets/base-slider.class.php:121
|
425 |
msgid "Timeout"
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: tmp/base/inc/widgets/base-slider.class.php:123
|
429 |
msgid "How long each frame is displayed for in milliseconds."
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: tmp/base/inc/widgets/base-slider.class.php:135
|
433 |
msgid "Navigation color"
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: tmp/base/inc/widgets/base-slider.class.php:147
|
437 |
msgid "Navigation style"
|
438 |
msgstr ""
|
439 |
|
440 |
+
#: tmp/base/inc/widgets/base-slider.class.php:153
|
441 |
msgid "Ultra thin"
|
442 |
msgstr ""
|
443 |
|
444 |
+
#: tmp/base/inc/widgets/base-slider.class.php:155
|
445 |
msgid "Thin"
|
446 |
msgstr ""
|
447 |
|
448 |
+
#: tmp/base/inc/widgets/base-slider.class.php:157, tmp/widgets/button/button.php:311, tmp/widgets/button/button.php:359, tmp/widgets/social-media-buttons/social-media-buttons.php:237, tmp/widgets/social-media-buttons/social-media-buttons.php:281, tmp/widgets/social-media-buttons/social-media-buttons.php:347
|
449 |
msgid "Medium"
|
450 |
msgstr ""
|
451 |
|
452 |
+
#: tmp/base/inc/widgets/base-slider.class.php:159
|
453 |
msgid "Thick"
|
454 |
msgstr ""
|
455 |
|
456 |
+
#: tmp/base/inc/widgets/base-slider.class.php:161
|
457 |
msgid "Rounded ultra thin"
|
458 |
msgstr ""
|
459 |
|
460 |
+
#: tmp/base/inc/widgets/base-slider.class.php:163
|
461 |
msgid "Rounded thin"
|
462 |
msgstr ""
|
463 |
|
464 |
+
#: tmp/base/inc/widgets/base-slider.class.php:165
|
465 |
msgid "Rounded medium"
|
466 |
msgstr ""
|
467 |
|
468 |
+
#: tmp/base/inc/widgets/base-slider.class.php:167
|
469 |
msgid "Rounded thick"
|
470 |
msgstr ""
|
471 |
|
472 |
+
#: tmp/base/inc/widgets/base-slider.class.php:179
|
473 |
msgid "Navigation size"
|
474 |
msgstr ""
|
475 |
|
476 |
+
#: tmp/base/inc/widgets/base-slider.class.php:191
|
477 |
msgid "Swipe Control"
|
478 |
msgstr ""
|
479 |
|
480 |
+
#: tmp/base/inc/widgets/base-slider.class.php:193
|
481 |
msgid "Allow users to swipe through frames on mobile devices."
|
482 |
msgstr ""
|
483 |
|
484 |
+
#: tmp/base/inc/widgets/base-slider.class.php:215
|
485 |
msgid "Video file"
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: tmp/base/inc/widgets/base-slider.class.php:227, tmp/widgets/video/video.php:84
|
489 |
msgid "Video URL"
|
490 |
msgstr ""
|
491 |
|
492 |
+
#: tmp/base/inc/widgets/base-slider.class.php:231
|
493 |
msgid "An external URL of the video. Overrides video file."
|
494 |
msgstr ""
|
495 |
|
496 |
+
#: tmp/base/inc/widgets/base-slider.class.php:241
|
497 |
msgid "Video format"
|
498 |
msgstr ""
|
499 |
|
500 |
+
#: tmp/base/inc/widgets/base-slider.class.php:261
|
501 |
msgid "Maximum height"
|
502 |
msgstr ""
|
503 |
|
537 |
msgid "Clicking %s will replace the current widget contents. You can revert by refreshing the page before updating."
|
538 |
msgstr ""
|
539 |
|
540 |
+
#: tmp/compat/beaver-builder/beaver-builder.php:127
|
541 |
msgid "Clear"
|
542 |
msgstr ""
|
543 |
|
544 |
+
#: tmp/compat/beaver-builder/beaver-builder.php:131
|
545 |
msgid "Select Color"
|
546 |
msgstr ""
|
547 |
|
548 |
+
#: tmp/compat/beaver-builder/beaver-builder.php:133
|
549 |
msgid "Current Color"
|
550 |
msgstr ""
|
551 |
|
565 |
msgid "SiteOrigin Widget"
|
566 |
msgstr ""
|
567 |
|
568 |
+
#: tmp/compat/visual-composer/visual-composer.php:40, tmp/so-widgets-bundle.php:893, tmp/so-widgets-bundle.php:895
|
569 |
msgid "SiteOrigin Widgets"
|
570 |
msgstr ""
|
571 |
|
601 |
msgid "Ionicons"
|
602 |
msgstr ""
|
603 |
|
604 |
+
#: tmp/so-widgets-bundle.php:429
|
605 |
msgid "A new widget!"
|
606 |
msgstr ""
|
607 |
|
608 |
+
#: tmp/so-widgets-bundle.php:713, tmp/so-widgets-bundle.php:759, tmp/so-widgets-bundle.php:845
|
609 |
msgid "Insufficient permissions."
|
610 |
msgstr ""
|
611 |
|
612 |
+
#: tmp/so-widgets-bundle.php:945
|
613 |
msgid "%s was %s"
|
614 |
msgstr ""
|
615 |
|
616 |
+
#: tmp/so-widgets-bundle.php:949
|
617 |
msgid "Activated"
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: tmp/so-widgets-bundle.php:949
|
621 |
msgid "Deactivated"
|
622 |
msgstr ""
|
623 |
|
624 |
+
#: tmp/so-widgets-bundle.php:1457
|
625 |
msgid "Manage Widgets"
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: tmp/so-widgets-bundle.php:1459
|
629 |
msgid "Support"
|
630 |
msgstr ""
|
631 |
|
641 |
msgid "Panels"
|
642 |
msgstr ""
|
643 |
|
644 |
+
#: tmp/widgets/accordion/accordion.php:63, tmp/widgets/hero/hero.php:117, tmp/widgets/layout-slider/layout-slider.php:47, tmp/widgets/tabs/tabs.php:63
|
645 |
msgid "Content"
|
646 |
msgstr ""
|
647 |
|
661 |
msgid "Closed"
|
662 |
msgstr ""
|
663 |
|
664 |
+
#: tmp/widgets/accordion/accordion.php:79, tmp/widgets/contact/contact.php:571, tmp/widgets/cta/cta.php:145, tmp/widgets/tabs/tabs.php:75, tmp/widgets/testimonial/testimonial.php:363
|
665 |
msgid "Design"
|
666 |
msgstr ""
|
667 |
|
669 |
msgid "Headings"
|
670 |
msgstr ""
|
671 |
|
672 |
+
#: tmp/widgets/accordion/accordion.php:89, tmp/widgets/accordion/accordion.php:127, tmp/widgets/contact/contact.php:591, tmp/widgets/contact/contact.php:1049, tmp/widgets/cta/cta.php:153, tmp/widgets/hero/hero.php:235, tmp/widgets/layout-slider/layout-slider.php:81, tmp/widgets/social-media-buttons/social-media-buttons.php:169, tmp/widgets/tabs/tabs.php:85, tmp/widgets/tabs/tabs.php:105, tmp/widgets/tabs/tabs.php:149
|
673 |
msgid "Background color"
|
674 |
msgstr ""
|
675 |
|
677 |
msgid "Background hover color"
|
678 |
msgstr ""
|
679 |
|
680 |
+
#: tmp/widgets/accordion/accordion.php:99, tmp/widgets/cta/cta.php:169, tmp/widgets/tabs/tabs.php:114
|
681 |
msgid "Title color"
|
682 |
msgstr ""
|
683 |
|
685 |
msgid "Title hover color"
|
686 |
msgstr ""
|
687 |
|
688 |
+
#: tmp/widgets/accordion/accordion.php:108, tmp/widgets/accordion/accordion.php:136, tmp/widgets/contact/contact.php:611, tmp/widgets/contact/contact.php:837, tmp/widgets/contact/contact.php:1069, tmp/widgets/cta/cta.php:161, tmp/widgets/tabs/tabs.php:90, tmp/widgets/tabs/tabs.php:124, tmp/widgets/tabs/tabs.php:158
|
689 |
msgid "Border color"
|
690 |
msgstr ""
|
691 |
|
693 |
msgid "Border hover color"
|
694 |
msgstr ""
|
695 |
|
696 |
+
#: tmp/widgets/accordion/accordion.php:116, tmp/widgets/accordion/accordion.php:140, tmp/widgets/contact/contact.php:621, tmp/widgets/contact/contact.php:847, tmp/widgets/contact/contact.php:1101, tmp/widgets/tabs/tabs.php:94, tmp/widgets/tabs/tabs.php:134, tmp/widgets/tabs/tabs.php:162
|
697 |
msgid "Border width"
|
698 |
msgstr ""
|
699 |
|
709 |
msgid "Get more customization options and the ability to use widgets and layouts as your accordion content with %sSiteOrigin Premium%s"
|
710 |
msgstr ""
|
711 |
|
712 |
+
#: tmp/widgets/button/button.php:27
|
713 |
msgid "SiteOrigin Button"
|
714 |
msgstr ""
|
715 |
|
716 |
+
#: tmp/widgets/button/button.php:31
|
717 |
msgid "A customizable button widget."
|
718 |
msgstr ""
|
719 |
|
720 |
+
#: tmp/widgets/button/button.php:89, tmp/widgets/price-table/price-table.php:92
|
721 |
msgid "Button text"
|
722 |
msgstr ""
|
723 |
|
724 |
+
#: tmp/widgets/button/button.php:99, tmp/widgets/google-map/google-map.php:193, tmp/widgets/headline/headline.php:44, tmp/widgets/headline/headline.php:115, tmp/widgets/hero/hero.php:247, tmp/widgets/icon/icon.php:56, tmp/widgets/image/image.php:76, tmp/widgets/layout-slider/layout-slider.php:87, tmp/widgets/simple-masonry/simple-masonry.php:78, tmp/widgets/slider/slider.php:84
|
725 |
msgid "Destination URL"
|
726 |
msgstr ""
|
727 |
|
728 |
+
#: tmp/widgets/button/button.php:111, tmp/widgets/google-map/google-map.php:215, tmp/widgets/headline/headline.php:49, tmp/widgets/headline/headline.php:120, tmp/widgets/icon/icon.php:62, tmp/widgets/simple-masonry/simple-masonry.php:83, tmp/widgets/social-media-buttons/social-media-buttons.php:191, tmp/widgets/taxonomy/taxonomy.php:64
|
729 |
msgid "Open in a new window"
|
730 |
msgstr ""
|
731 |
|
732 |
+
#: tmp/widgets/button/button.php:121, tmp/widgets/button/button.php:129, tmp/widgets/features/features.php:149, tmp/widgets/icon/icon.php:30, tmp/widgets/price-table/price-table.php:118
|
733 |
msgid "Icon"
|
734 |
msgstr ""
|
735 |
|
736 |
+
#: tmp/widgets/button/button.php:139, tmp/widgets/features/features.php:169, tmp/widgets/price-table/price-table.php:122, tmp/widgets/social-media-buttons/social-media-buttons.php:161
|
737 |
msgid "Icon color"
|
738 |
msgstr ""
|
739 |
|
740 |
+
#: tmp/widgets/button/button.php:149
|
741 |
msgid "Image icon"
|
742 |
msgstr ""
|
743 |
|
744 |
+
#: tmp/widgets/button/button.php:151
|
745 |
msgid "Replaces the icon with your own image icon."
|
746 |
msgstr ""
|
747 |
|
748 |
+
#: tmp/widgets/button/button.php:161
|
749 |
msgid "Icon Placement"
|
750 |
msgstr ""
|
751 |
|
752 |
+
#: tmp/widgets/button/button.php:167, tmp/widgets/features/features.php:125
|
753 |
msgid "Top"
|
754 |
msgstr ""
|
755 |
|
756 |
+
#: tmp/widgets/button/button.php:169, tmp/widgets/button/button.php:221, tmp/widgets/contact/contact.php:721, tmp/widgets/contact/contact.php:751, tmp/widgets/contact/contact.php:1191, tmp/widgets/cta/cta.php:193, tmp/widgets/features/features.php:127, tmp/widgets/headline/headline.php:89, tmp/widgets/headline/headline.php:160, tmp/widgets/headline/headline.php:215, tmp/widgets/icon/icon.php:49, tmp/widgets/image/image.php:48, tmp/widgets/social-media-buttons/social-media-buttons.php:303, tmp/widgets/social-media-buttons/social-media-buttons.php:325, tmp/widgets/testimonial/testimonial.php:507
|
757 |
msgid "Right"
|
758 |
msgstr ""
|
759 |
|
760 |
+
#: tmp/widgets/button/button.php:171, tmp/widgets/features/features.php:129
|
761 |
msgid "Bottom"
|
762 |
msgstr ""
|
763 |
|
764 |
+
#: tmp/widgets/button/button.php:173, tmp/widgets/button/button.php:219, tmp/widgets/contact/contact.php:719, tmp/widgets/contact/contact.php:749, tmp/widgets/contact/contact.php:1189, tmp/widgets/cta/cta.php:191, tmp/widgets/features/features.php:131, tmp/widgets/headline/headline.php:88, tmp/widgets/headline/headline.php:159, tmp/widgets/headline/headline.php:214, tmp/widgets/icon/icon.php:48, tmp/widgets/image/image.php:47, tmp/widgets/social-media-buttons/social-media-buttons.php:301, tmp/widgets/social-media-buttons/social-media-buttons.php:323, tmp/widgets/testimonial/testimonial.php:505
|
765 |
msgid "Left"
|
766 |
msgstr ""
|
767 |
|
768 |
+
#: tmp/widgets/button/button.php:189, tmp/widgets/social-media-buttons/social-media-buttons.php:181
|
769 |
msgid "Design and layout"
|
770 |
msgstr ""
|
771 |
|
772 |
+
#: tmp/widgets/button/button.php:201, tmp/widgets/contact/contact.php:733, tmp/widgets/contact/contact.php:1175, tmp/widgets/contact/contact.php:1277, tmp/widgets/google-map/google-map.php:175
|
773 |
msgid "Width"
|
774 |
msgstr ""
|
775 |
|
776 |
+
#: tmp/widgets/button/button.php:203
|
777 |
msgid "Leave blank to let the button resize according to content."
|
778 |
msgstr ""
|
779 |
|
780 |
+
#: tmp/widgets/button/button.php:213, tmp/widgets/contact/contact.php:743, tmp/widgets/contact/contact.php:1183, tmp/widgets/social-media-buttons/social-media-buttons.php:295
|
781 |
msgid "Align"
|
782 |
msgstr ""
|
783 |
|
784 |
+
#: tmp/widgets/button/button.php:223, tmp/widgets/contact/contact.php:753, tmp/widgets/contact/contact.php:1193, tmp/widgets/headline/headline.php:87, tmp/widgets/headline/headline.php:158, tmp/widgets/headline/headline.php:213, tmp/widgets/icon/icon.php:47, tmp/widgets/image/image.php:49, tmp/widgets/social-media-buttons/social-media-buttons.php:305, tmp/widgets/social-media-buttons/social-media-buttons.php:327
|
785 |
msgid "Center"
|
786 |
msgstr ""
|
787 |
|
788 |
+
#: tmp/widgets/button/button.php:225, tmp/widgets/contact/contact.php:755, tmp/widgets/headline/headline.php:90, tmp/widgets/headline/headline.php:161, tmp/widgets/social-media-buttons/social-media-buttons.php:307, tmp/widgets/social-media-buttons/social-media-buttons.php:329
|
789 |
msgid "Justify"
|
790 |
msgstr ""
|
791 |
|
792 |
+
#: tmp/widgets/button/button.php:237, tmp/widgets/social-media-buttons/social-media-buttons.php:201
|
793 |
msgid "Button theme"
|
794 |
msgstr ""
|
795 |
|
796 |
+
#: tmp/widgets/button/button.php:243, tmp/widgets/price-table/price-table.php:133, tmp/widgets/social-media-buttons/social-media-buttons.php:207
|
797 |
msgid "Atom"
|
798 |
msgstr ""
|
799 |
|
800 |
+
#: tmp/widgets/button/button.php:245, tmp/widgets/social-media-buttons/social-media-buttons.php:209
|
801 |
msgid "Flat"
|
802 |
msgstr ""
|
803 |
|
804 |
+
#: tmp/widgets/button/button.php:247, tmp/widgets/social-media-buttons/social-media-buttons.php:211
|
805 |
msgid "Wire"
|
806 |
msgstr ""
|
807 |
|
808 |
+
#: tmp/widgets/button/button.php:261, tmp/widgets/price-table/price-table.php:149
|
809 |
msgid "Button color"
|
810 |
msgstr ""
|
811 |
|
812 |
+
#: tmp/widgets/button/button.php:271, tmp/widgets/contact/contact.php:1125, tmp/widgets/hero/hero.php:485, tmp/widgets/layout-slider/layout-slider.php:181
|
813 |
msgid "Text color"
|
814 |
msgstr ""
|
815 |
|
816 |
+
#: tmp/widgets/button/button.php:283, tmp/widgets/social-media-buttons/social-media-buttons.php:221
|
817 |
msgid "Use hover effects"
|
818 |
msgstr ""
|
819 |
|
820 |
+
#: tmp/widgets/button/button.php:293, tmp/widgets/contact/contact.php:679, tmp/widgets/contact/contact.php:779, tmp/widgets/features/features.php:273, tmp/widgets/features/features.php:315, tmp/widgets/features/features.php:357, tmp/widgets/headline/headline.php:75, tmp/widgets/headline/headline.php:146
|
821 |
msgid "Font"
|
822 |
msgstr ""
|
823 |
|
824 |
+
#: tmp/widgets/button/button.php:305, tmp/widgets/contact/contact.php:689, tmp/widgets/contact/contact.php:1135
|
825 |
msgid "Font size"
|
826 |
msgstr ""
|
827 |
|
828 |
+
#: tmp/widgets/button/button.php:309, tmp/widgets/contact/contact.php:505, tmp/widgets/contact/contact.php:947, tmp/widgets/contact/contact.php:1151, tmp/widgets/social-media-buttons/social-media-buttons.php:235
|
829 |
msgid "Normal"
|
830 |
msgstr ""
|
831 |
|
832 |
+
#: tmp/widgets/button/button.php:313, tmp/widgets/social-media-buttons/social-media-buttons.php:239
|
833 |
msgid "Large"
|
834 |
msgstr ""
|
835 |
|
836 |
+
#: tmp/widgets/button/button.php:315, tmp/widgets/social-media-buttons/social-media-buttons.php:241
|
837 |
msgid "Extra large"
|
838 |
msgstr ""
|
839 |
|
840 |
+
#: tmp/widgets/button/button.php:327, tmp/widgets/social-media-buttons/social-media-buttons.php:251
|
841 |
msgid "Rounding"
|
842 |
msgstr ""
|
843 |
|
844 |
+
#: tmp/widgets/button/button.php:333, tmp/widgets/contact/contact.php:637, tmp/widgets/contact/contact.php:863, tmp/widgets/contact/contact.php:1085, tmp/widgets/contact/contact.php:1255, tmp/widgets/headline/headline.php:185, tmp/widgets/social-media-buttons/social-media-buttons.php:257
|
845 |
msgid "None"
|
846 |
msgstr ""
|
847 |
|
848 |
+
#: tmp/widgets/button/button.php:335, tmp/widgets/social-media-buttons/social-media-buttons.php:259
|
849 |
msgid "Slightly rounded"
|
850 |
msgstr ""
|
851 |
|
852 |
+
#: tmp/widgets/button/button.php:337, tmp/widgets/social-media-buttons/social-media-buttons.php:261
|
853 |
msgid "Very rounded"
|
854 |
msgstr ""
|
855 |
|
856 |
+
#: tmp/widgets/button/button.php:339, tmp/widgets/social-media-buttons/social-media-buttons.php:263
|
857 |
msgid "Completely rounded"
|
858 |
msgstr ""
|
859 |
|
860 |
+
#: tmp/widgets/button/button.php:351, tmp/widgets/contact/contact.php:601, tmp/widgets/contact/contact.php:813, tmp/widgets/contact/contact.php:1165, tmp/widgets/social-media-buttons/social-media-buttons.php:273, tmp/widgets/testimonial/testimonial.php:465
|
861 |
msgid "Padding"
|
862 |
msgstr ""
|
863 |
|
864 |
+
#: tmp/widgets/button/button.php:357, tmp/widgets/social-media-buttons/social-media-buttons.php:279, tmp/widgets/social-media-buttons/social-media-buttons.php:345
|
865 |
msgid "Low"
|
866 |
msgstr ""
|
867 |
|
868 |
+
#: tmp/widgets/button/button.php:361, tmp/widgets/social-media-buttons/social-media-buttons.php:283, tmp/widgets/social-media-buttons/social-media-buttons.php:349
|
869 |
msgid "High"
|
870 |
msgstr ""
|
871 |
|
872 |
+
#: tmp/widgets/button/button.php:363, tmp/widgets/social-media-buttons/social-media-buttons.php:285, tmp/widgets/social-media-buttons/social-media-buttons.php:351
|
873 |
msgid "Very high"
|
874 |
msgstr ""
|
875 |
|
876 |
+
#: tmp/widgets/button/button.php:381
|
877 |
msgid "Other attributes and SEO"
|
878 |
msgstr ""
|
879 |
|
880 |
+
#: tmp/widgets/button/button.php:391, tmp/widgets/contact/contact.php:191
|
881 |
msgid "Button ID"
|
882 |
msgstr ""
|
883 |
|
884 |
+
#: tmp/widgets/button/button.php:393
|
885 |
msgid "An ID attribute allows you to target this button in Javascript."
|
886 |
msgstr ""
|
887 |
|
888 |
+
#: tmp/widgets/button/button.php:403
|
889 |
msgid "Button Classes"
|
890 |
msgstr ""
|
891 |
|
892 |
+
#: tmp/widgets/button/button.php:405
|
893 |
msgid "Additional CSS classes added to the button link."
|
894 |
msgstr ""
|
895 |
|
896 |
+
#: tmp/widgets/button/button.php:415
|
897 |
msgid "Title attribute"
|
898 |
msgstr ""
|
899 |
|
900 |
+
#: tmp/widgets/button/button.php:417
|
901 |
msgid "Adds a title attribute to the button link."
|
902 |
msgstr ""
|
903 |
|
904 |
+
#: tmp/widgets/button/button.php:427, tmp/widgets/contact/contact.php:201
|
905 |
msgid "Onclick"
|
906 |
msgstr ""
|
907 |
|
908 |
+
#: tmp/widgets/button/button.php:429
|
909 |
msgid "Run this Javascript when the button is clicked. Ideal for tracking."
|
910 |
msgstr ""
|
911 |
|
912 |
+
#: tmp/widgets/button/button.php:439
|
913 |
msgid "Rel attribute"
|
914 |
msgstr ""
|
915 |
|
916 |
+
#: tmp/widgets/button/button.php:441
|
917 |
msgid "Adds a rel attribute to the button link."
|
918 |
msgstr ""
|
919 |
|
920 |
+
#: tmp/widgets/contact/contact.php:31
|
921 |
msgid "SiteOrigin Contact Form"
|
922 |
msgstr ""
|
923 |
|
924 |
+
#: tmp/widgets/contact/contact.php:35
|
925 |
msgid "Create a simple contact form for your users to get hold of you."
|
926 |
msgstr ""
|
927 |
|
928 |
+
#: tmp/widgets/contact/contact.php:95, tmp/widgets/contact/contact.php:183
|
929 |
msgid "Contact Us"
|
930 |
msgstr ""
|
931 |
|
932 |
+
#: tmp/widgets/contact/contact.php:105
|
933 |
msgid "Display title"
|
934 |
msgstr ""
|
935 |
|
936 |
+
#: tmp/widgets/contact/contact.php:125
|
937 |
msgid "To email address"
|
938 |
msgstr ""
|
939 |
|
940 |
+
#: tmp/widgets/contact/contact.php:127
|
941 |
msgid "Where contact emails will be delivered to. You can send to multiple emails by separating the emails with a comma (,)"
|
942 |
msgstr ""
|
943 |
|
944 |
+
#: tmp/widgets/contact/contact.php:137
|
945 |
msgid "From email address"
|
946 |
msgstr ""
|
947 |
|
948 |
+
#: tmp/widgets/contact/contact.php:139
|
949 |
msgid "It will appear as if emails are sent from this address. Ideally this should be in the same domain as this server to avoid spam filters."
|
950 |
msgstr ""
|
951 |
|
952 |
+
#: tmp/widgets/contact/contact.php:149
|
953 |
msgid "Default subject"
|
954 |
msgstr ""
|
955 |
|
956 |
+
#: tmp/widgets/contact/contact.php:151
|
957 |
msgid "Subject to use when there isn't one available."
|
958 |
msgstr ""
|
959 |
|
960 |
+
#: tmp/widgets/contact/contact.php:159
|
961 |
msgid "Subject prefix"
|
962 |
msgstr ""
|
963 |
|
964 |
+
#: tmp/widgets/contact/contact.php:161
|
965 |
msgid "Prefix added to all incoming email subjects."
|
966 |
msgstr ""
|
967 |
|
968 |
+
#: tmp/widgets/contact/contact.php:169
|
969 |
msgid "Success message"
|
970 |
msgstr ""
|
971 |
|
972 |
+
#: tmp/widgets/contact/contact.php:171
|
973 |
msgid "Message to display after message successfully sent."
|
974 |
msgstr ""
|
975 |
|
976 |
+
#: tmp/widgets/contact/contact.php:173
|
977 |
msgid "Thanks for contacting us. We'll get back to you shortly."
|
978 |
msgstr ""
|
979 |
|
980 |
+
#: tmp/widgets/contact/contact.php:181
|
981 |
msgid "Submit button text"
|
982 |
msgstr ""
|
983 |
|
984 |
+
#: tmp/widgets/contact/contact.php:193
|
985 |
msgid "An ID attribute allows you to target this button in JavaScript."
|
986 |
msgstr ""
|
987 |
|
988 |
+
#: tmp/widgets/contact/contact.php:203
|
989 |
msgid "Run this JavaScript when the button is clicked. Ideal for tracking."
|
990 |
msgstr ""
|
991 |
|
992 |
+
#: tmp/widgets/contact/contact.php:211
|
993 |
msgid "Indicate required fields with asterisk (*)"
|
994 |
msgstr ""
|
995 |
|
996 |
+
#: tmp/widgets/contact/contact.php:233
|
997 |
msgid "Required field indicator message"
|
998 |
msgstr ""
|
999 |
|
1000 |
+
#: tmp/widgets/contact/contact.php:235
|
1001 |
msgid "Fields marked with * are required"
|
1002 |
msgstr ""
|
1003 |
|
1004 |
+
#: tmp/widgets/contact/contact.php:259, tmp/widgets/contact/contact.php:771
|
1005 |
msgid "Fields"
|
1006 |
msgstr ""
|
1007 |
|
1008 |
+
#: tmp/widgets/contact/contact.php:261
|
1009 |
msgid "Field"
|
1010 |
msgstr ""
|
1011 |
|
1012 |
+
#: tmp/widgets/contact/contact.php:277
|
1013 |
msgid "Field Type"
|
1014 |
msgstr ""
|
1015 |
|
1016 |
+
#: tmp/widgets/contact/contact.php:279
|
1017 |
msgid "Select Field Type"
|
1018 |
msgstr ""
|
1019 |
|
1020 |
+
#: tmp/widgets/contact/contact.php:283, tmp/widgets/testimonial/testimonial.php:107
|
1021 |
msgid "Name"
|
1022 |
msgstr ""
|
1023 |
|
1024 |
+
#: tmp/widgets/contact/contact.php:285, tmp/widgets/social-media-buttons/data/networks.php:29
|
1025 |
msgid "Email"
|
1026 |
msgstr ""
|
1027 |
|
1028 |
+
#: tmp/widgets/contact/contact.php:287, tmp/widgets/contact/contact.php:1405
|
1029 |
msgid "Subject"
|
1030 |
msgstr ""
|
1031 |
|
1032 |
+
#: tmp/widgets/contact/contact.php:289, tmp/widgets/features/features.php:219, tmp/widgets/features/features.php:305, tmp/widgets/headline/headline.php:40, tmp/widgets/headline/headline.php:111, tmp/widgets/price-table/price-table.php:110, tmp/widgets/taxonomy/taxonomy.php:50, tmp/widgets/testimonial/testimonial.php:161
|
1033 |
msgid "Text"
|
1034 |
msgstr ""
|
1035 |
|
1036 |
+
#: tmp/widgets/contact/contact.php:291
|
1037 |
msgid "Text Area"
|
1038 |
msgstr ""
|
1039 |
|
1040 |
+
#: tmp/widgets/contact/contact.php:293
|
1041 |
msgid "Dropdown Select"
|
1042 |
msgstr ""
|
1043 |
|
1044 |
+
#: tmp/widgets/contact/contact.php:295
|
1045 |
msgid "Checkboxes"
|
1046 |
msgstr ""
|
1047 |
|
1048 |
+
#: tmp/widgets/contact/contact.php:297
|
1049 |
msgid "Radio"
|
1050 |
msgstr ""
|
1051 |
|
1052 |
+
#: tmp/widgets/contact/contact.php:317, tmp/widgets/taxonomy/taxonomy.php:42
|
1053 |
msgid "Label"
|
1054 |
msgstr ""
|
1055 |
|
1056 |
+
#: tmp/widgets/contact/contact.php:327
|
1057 |
msgid "Description"
|
1058 |
msgstr ""
|
1059 |
|
1060 |
+
#: tmp/widgets/contact/contact.php:329
|
1061 |
msgid "This text will appear small beneath the input field."
|
1062 |
msgstr ""
|
1063 |
|
1064 |
+
#: tmp/widgets/contact/contact.php:339
|
1065 |
msgid "Required Field"
|
1066 |
msgstr ""
|
1067 |
|
1068 |
+
#: tmp/widgets/contact/contact.php:347, tmp/widgets/contact/contact.php:1995
|
1069 |
msgid "Required field"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
+
#: tmp/widgets/contact/contact.php:349
|
1073 |
msgid "Is this field required?"
|
1074 |
msgstr ""
|
1075 |
|
1076 |
+
#: tmp/widgets/contact/contact.php:357
|
1077 |
msgid "Missing message"
|
1078 |
msgstr ""
|
1079 |
|
1080 |
+
#: tmp/widgets/contact/contact.php:359
|
1081 |
msgid "Error message to display if this field is missing."
|
1082 |
msgstr ""
|
1083 |
|
1084 |
+
#: tmp/widgets/contact/contact.php:375
|
1085 |
msgid "Options"
|
1086 |
msgstr ""
|
1087 |
|
1088 |
+
#: tmp/widgets/contact/contact.php:377
|
1089 |
msgid "Option"
|
1090 |
msgstr ""
|
1091 |
|
1092 |
+
#: tmp/widgets/contact/contact.php:387
|
1093 |
msgid "Value"
|
1094 |
msgstr ""
|
1095 |
|
1096 |
+
#: tmp/widgets/contact/contact.php:417
|
1097 |
msgid "Spam Protection"
|
1098 |
msgstr ""
|
1099 |
|
1100 |
+
#: tmp/widgets/contact/contact.php:429
|
1101 |
msgid "reCAPTCHA"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
+
#: tmp/widgets/contact/contact.php:437
|
1105 |
msgid "Use reCAPTCHA"
|
1106 |
msgstr ""
|
1107 |
|
1108 |
+
#: tmp/widgets/contact/contact.php:447
|
1109 |
msgid "reCAPTCHA Site Key"
|
1110 |
msgstr ""
|
1111 |
|
1112 |
+
#: tmp/widgets/contact/contact.php:455
|
1113 |
msgid "reCAPTCHA Secret Key"
|
1114 |
msgstr ""
|
1115 |
|
1116 |
+
#: tmp/widgets/contact/contact.php:463
|
1117 |
msgid "Theme"
|
1118 |
msgstr ""
|
1119 |
|
1120 |
+
#: tmp/widgets/contact/contact.php:469
|
1121 |
msgid "Light"
|
1122 |
msgstr ""
|
1123 |
|
1124 |
+
#: tmp/widgets/contact/contact.php:471
|
1125 |
msgid "Dark"
|
1126 |
msgstr ""
|
1127 |
|
1128 |
+
#: tmp/widgets/contact/contact.php:481
|
1129 |
msgid "Challenge type"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
+
#: tmp/widgets/contact/contact.php:487, tmp/widgets/image-grid/image-grid.php:54, tmp/widgets/image-grid/image-grid.php:63, tmp/widgets/price-table/price-table.php:69, tmp/widgets/simple-masonry/simple-masonry.php:54, tmp/widgets/testimonial/testimonial.php:141, tmp/widgets/testimonial/testimonial.php:373
|
1133 |
msgid "Image"
|
1134 |
msgstr ""
|
1135 |
|
1136 |
+
#: tmp/widgets/contact/contact.php:489
|
1137 |
msgid "Audio"
|
1138 |
msgstr ""
|
1139 |
|
1140 |
+
#: tmp/widgets/contact/contact.php:499, tmp/widgets/contact/contact.php:919, tmp/widgets/features/features.php:283, tmp/widgets/features/features.php:325, tmp/widgets/features/features.php:367, tmp/widgets/icon/icon.php:40
|
1141 |
msgid "Size"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
+
#: tmp/widgets/contact/contact.php:507
|
1145 |
msgid "Compact"
|
1146 |
msgstr ""
|
1147 |
|
1148 |
+
#: tmp/widgets/contact/contact.php:523
|
1149 |
msgid "Akismet"
|
1150 |
msgstr ""
|
1151 |
|
1152 |
+
#: tmp/widgets/contact/contact.php:531
|
1153 |
msgid "Use Akismet filtering"
|
1154 |
msgstr ""
|
1155 |
|
1156 |
+
#: tmp/widgets/contact/contact.php:541
|
1157 |
msgid "Spam action"
|
1158 |
msgstr ""
|
1159 |
|
1160 |
+
#: tmp/widgets/contact/contact.php:545
|
1161 |
msgid "Show error message"
|
1162 |
msgstr ""
|
1163 |
|
1164 |
+
#: tmp/widgets/contact/contact.php:547
|
1165 |
msgid "Tag as spam in subject"
|
1166 |
msgstr ""
|
1167 |
|
1168 |
+
#: tmp/widgets/contact/contact.php:551
|
1169 |
msgid "How to handle submissions that are identified as spam."
|
1170 |
msgstr ""
|
1171 |
|
1172 |
+
#: tmp/widgets/contact/contact.php:583
|
1173 |
msgid "Container"
|
1174 |
msgstr ""
|
1175 |
|
1176 |
+
#: tmp/widgets/contact/contact.php:631, tmp/widgets/contact/contact.php:1079
|
1177 |
msgid "Border style"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
+
#: tmp/widgets/contact/contact.php:639, tmp/widgets/contact/contact.php:865, tmp/widgets/contact/contact.php:1257, tmp/widgets/image/image.php:63
|
1181 |
msgid "Hidden"
|
1182 |
msgstr ""
|
1183 |
|
1184 |
+
#: tmp/widgets/contact/contact.php:641, tmp/widgets/contact/contact.php:867, tmp/widgets/contact/contact.php:1089, tmp/widgets/contact/contact.php:1239, tmp/widgets/headline/headline.php:187
|
1185 |
msgid "Dotted"
|
1186 |
msgstr ""
|
1187 |
|
1188 |
+
#: tmp/widgets/contact/contact.php:643, tmp/widgets/contact/contact.php:869, tmp/widgets/contact/contact.php:1091, tmp/widgets/contact/contact.php:1241, tmp/widgets/headline/headline.php:188
|
1189 |
msgid "Dashed"
|
1190 |
msgstr ""
|
1191 |
|
1192 |
+
#: tmp/widgets/contact/contact.php:645, tmp/widgets/contact/contact.php:871, tmp/widgets/contact/contact.php:1087, tmp/widgets/contact/contact.php:1243, tmp/widgets/headline/headline.php:186
|
1193 |
msgid "Solid"
|
1194 |
msgstr ""
|
1195 |
|
1196 |
+
#: tmp/widgets/contact/contact.php:647, tmp/widgets/contact/contact.php:873, tmp/widgets/contact/contact.php:1245, tmp/widgets/headline/headline.php:189
|
1197 |
msgid "Double"
|
1198 |
msgstr ""
|
1199 |
|
1200 |
+
#: tmp/widgets/contact/contact.php:649, tmp/widgets/contact/contact.php:875, tmp/widgets/contact/contact.php:1247, tmp/widgets/headline/headline.php:190
|
1201 |
msgid "Groove"
|
1202 |
msgstr ""
|
1203 |
|
1204 |
+
#: tmp/widgets/contact/contact.php:651, tmp/widgets/contact/contact.php:877, tmp/widgets/contact/contact.php:1249, tmp/widgets/headline/headline.php:191
|
1205 |
msgid "Ridge"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
+
#: tmp/widgets/contact/contact.php:653, tmp/widgets/contact/contact.php:879, tmp/widgets/contact/contact.php:1251, tmp/widgets/headline/headline.php:192
|
1209 |
msgid "Inset"
|
1210 |
msgstr ""
|
1211 |
|
1212 |
+
#: tmp/widgets/contact/contact.php:655, tmp/widgets/contact/contact.php:881, tmp/widgets/contact/contact.php:1253, tmp/widgets/headline/headline.php:193
|
1213 |
msgid "Outset"
|
1214 |
msgstr ""
|
1215 |
|
1216 |
+
#: tmp/widgets/contact/contact.php:671
|
1217 |
msgid "Field labels"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
+
#: tmp/widgets/contact/contact.php:699, tmp/widgets/contact/contact.php:929, tmp/widgets/contact/contact.php:1267, tmp/widgets/features/features.php:291, tmp/widgets/features/features.php:333, tmp/widgets/features/features.php:375, tmp/widgets/google-map/google-map.php:693, tmp/widgets/headline/headline.php:67, tmp/widgets/headline/headline.php:138, tmp/widgets/headline/headline.php:198, tmp/widgets/icon/icon.php:35, tmp/widgets/taxonomy/taxonomy.php:55
|
1221 |
msgid "Color"
|
1222 |
msgstr ""
|
1223 |
|
1224 |
+
#: tmp/widgets/contact/contact.php:709
|
1225 |
msgid "Position"
|
1226 |
msgstr ""
|
1227 |
|
1228 |
+
#: tmp/widgets/contact/contact.php:715, tmp/widgets/image/image.php:64
|
1229 |
msgid "Above"
|
1230 |
msgstr ""
|
1231 |
|
1232 |
+
#: tmp/widgets/contact/contact.php:717, tmp/widgets/image/image.php:65
|
1233 |
msgid "Below"
|
1234 |
msgstr ""
|
1235 |
|
1236 |
+
#: tmp/widgets/contact/contact.php:723
|
1237 |
msgid "Inside"
|
1238 |
msgstr ""
|
1239 |
|
1240 |
+
#: tmp/widgets/contact/contact.php:789, tmp/widgets/headline/headline.php:80, tmp/widgets/headline/headline.php:151
|
1241 |
msgid "Font Size"
|
1242 |
msgstr ""
|
1243 |
|
1244 |
+
#: tmp/widgets/contact/contact.php:797, tmp/widgets/testimonial/testimonial.php:449
|
1245 |
msgid "Text Color"
|
1246 |
msgstr ""
|
1247 |
|
1248 |
+
#: tmp/widgets/contact/contact.php:805, tmp/widgets/social-media-buttons/social-media-buttons.php:339
|
1249 |
msgid "Margin"
|
1250 |
msgstr ""
|
1251 |
|
1252 |
+
#: tmp/widgets/contact/contact.php:821, tmp/widgets/google-map/google-map.php:185, tmp/widgets/hero/hero.php:321, tmp/widgets/layout-slider/layout-slider.php:124
|
1253 |
msgid "Height"
|
1254 |
msgstr ""
|
1255 |
|
1256 |
+
#: tmp/widgets/contact/contact.php:829, tmp/widgets/hero/hero.php:169, tmp/widgets/layout-slider/layout-slider.php:52
|
1257 |
msgid "Background"
|
1258 |
msgstr ""
|
1259 |
|
1260 |
+
#: tmp/widgets/contact/contact.php:857
|
1261 |
msgid " Border style"
|
1262 |
msgstr ""
|
1263 |
|
1264 |
+
#: tmp/widgets/contact/contact.php:891, tmp/widgets/contact/contact.php:1111
|
1265 |
msgid "Border rounding"
|
1266 |
msgstr ""
|
1267 |
|
1268 |
+
#: tmp/widgets/contact/contact.php:911
|
1269 |
msgid "Field descriptions"
|
1270 |
msgstr ""
|
1271 |
|
1272 |
+
#: tmp/widgets/contact/contact.php:939, tmp/widgets/contact/contact.php:1233, tmp/widgets/google-map/google-map.php:599, tmp/widgets/headline/headline.php:182
|
1273 |
msgid "Style"
|
1274 |
msgstr ""
|
1275 |
|
1276 |
+
#: tmp/widgets/contact/contact.php:945
|
1277 |
msgid "Italic"
|
1278 |
msgstr ""
|
1279 |
|
1280 |
+
#: tmp/widgets/contact/contact.php:963
|
1281 |
msgid "Error messages"
|
1282 |
msgstr ""
|
1283 |
|
1284 |
+
#: tmp/widgets/contact/contact.php:971
|
1285 |
msgid "Error background color"
|
1286 |
msgstr ""
|
1287 |
|
1288 |
+
#: tmp/widgets/contact/contact.php:981
|
1289 |
msgid "Error border color"
|
1290 |
msgstr ""
|
1291 |
|
1292 |
+
#: tmp/widgets/contact/contact.php:991
|
1293 |
msgid "Error text color"
|
1294 |
msgstr ""
|
1295 |
|
1296 |
+
#: tmp/widgets/contact/contact.php:1001
|
1297 |
msgid "Error padding"
|
1298 |
msgstr ""
|
1299 |
|
1300 |
+
#: tmp/widgets/contact/contact.php:1011
|
1301 |
msgid "Error margin"
|
1302 |
msgstr ""
|
1303 |
|
1304 |
+
#: tmp/widgets/contact/contact.php:1027
|
1305 |
msgid "Submit button"
|
1306 |
msgstr ""
|
1307 |
|
1308 |
+
#: tmp/widgets/contact/contact.php:1035
|
1309 |
msgid "Style submit button"
|
1310 |
msgstr ""
|
1311 |
|
1312 |
+
#: tmp/widgets/contact/contact.php:1037
|
1313 |
msgid "Style the button or leave it with default theme styling."
|
1314 |
msgstr ""
|
1315 |
|
1316 |
+
#: tmp/widgets/contact/contact.php:1059
|
1317 |
msgid "Gradient intensity"
|
1318 |
msgstr ""
|
1319 |
|
1320 |
+
#: tmp/widgets/contact/contact.php:1145
|
1321 |
msgid "Font weight"
|
1322 |
msgstr ""
|
1323 |
|
1324 |
+
#: tmp/widgets/contact/contact.php:1153
|
1325 |
msgid "Semi-bold"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
+
#: tmp/widgets/contact/contact.php:1155
|
1329 |
msgid "Bold"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
+
#: tmp/widgets/contact/contact.php:1203
|
1333 |
msgid "Inset highlight"
|
1334 |
msgstr ""
|
1335 |
|
1336 |
+
#: tmp/widgets/contact/contact.php:1205
|
1337 |
msgid "The white highlight at the bottom of the button"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
+
#: tmp/widgets/contact/contact.php:1225
|
1341 |
msgid "Input focus"
|
1342 |
msgstr ""
|
1343 |
|
1344 |
+
#: tmp/widgets/contact/contact.php:1319
|
1345 |
msgid "Get more form fields for the Contact Form Widget in %s"
|
1346 |
msgstr ""
|
1347 |
|
1348 |
+
#: tmp/widgets/contact/contact.php:1321
|
1349 |
msgid "SiteOrigin Premium"
|
1350 |
msgstr ""
|
1351 |
|
1352 |
+
#: tmp/widgets/contact/contact.php:1373
|
1353 |
msgid "Your Name"
|
1354 |
msgstr ""
|
1355 |
|
1356 |
+
#: tmp/widgets/contact/contact.php:1379
|
1357 |
msgid "Please enter your name"
|
1358 |
msgstr ""
|
1359 |
|
1360 |
+
#: tmp/widgets/contact/contact.php:1389
|
1361 |
msgid "Your Email"
|
1362 |
msgstr ""
|
1363 |
|
1364 |
+
#: tmp/widgets/contact/contact.php:1395
|
1365 |
msgid "Please enter a valid email address"
|
1366 |
msgstr ""
|
1367 |
|
1368 |
+
#: tmp/widgets/contact/contact.php:1411
|
1369 |
msgid "Please enter a subject"
|
1370 |
msgstr ""
|
1371 |
|
1372 |
+
#: tmp/widgets/contact/contact.php:1421
|
1373 |
msgid "Message"
|
1374 |
msgstr ""
|
1375 |
|
1376 |
+
#: tmp/widgets/contact/contact.php:1427
|
1377 |
msgid "Please write something"
|
1378 |
msgstr ""
|
1379 |
|
1380 |
+
#: tmp/widgets/contact/contact.php:2019
|
1381 |
msgid "Invalid email address."
|
1382 |
msgstr ""
|
1383 |
|
1384 |
+
#: tmp/widgets/contact/contact.php:2167
|
1385 |
msgid "Error sending email, please try again later."
|
1386 |
msgstr ""
|
1387 |
|
1388 |
+
#: tmp/widgets/contact/contact.php:2215
|
1389 |
msgid "A valid email is required"
|
1390 |
msgstr ""
|
1391 |
|
1392 |
+
#: tmp/widgets/contact/contact.php:2219
|
1393 |
msgid "The email address is invalid"
|
1394 |
msgstr ""
|
1395 |
|
1396 |
+
#: tmp/widgets/contact/contact.php:2227
|
1397 |
msgid "Missing subject"
|
1398 |
msgstr ""
|
1399 |
|
1400 |
+
#: tmp/widgets/contact/contact.php:2295
|
1401 |
msgid "Error validating your Captcha response."
|
1402 |
msgstr ""
|
1403 |
|
1404 |
+
#: tmp/widgets/contact/contact.php:2359
|
1405 |
msgid "Unfortunately our system identified your message as spam."
|
1406 |
msgstr ""
|
1407 |
|
1408 |
+
#: tmp/widgets/cta/cta.php:29
|
1409 |
msgid "SiteOrigin Call-to-action"
|
1410 |
msgstr ""
|
1411 |
|
1412 |
+
#: tmp/widgets/cta/cta.php:33
|
1413 |
msgid "A simple call-to-action widget with massive power."
|
1414 |
msgstr ""
|
1415 |
|
1416 |
+
#: tmp/widgets/cta/cta.php:135, tmp/widgets/price-table/price-table.php:64
|
1417 |
msgid "Subtitle"
|
1418 |
msgstr ""
|
1419 |
|
1420 |
+
#: tmp/widgets/cta/cta.php:177
|
1421 |
msgid "Subtitle color"
|
1422 |
msgstr ""
|
1423 |
|
1424 |
+
#: tmp/widgets/cta/cta.php:185
|
1425 |
msgid "Button align"
|
1426 |
msgstr ""
|
1427 |
|
1428 |
+
#: tmp/widgets/cta/cta.php:211, tmp/widgets/hero/hero.php:129, tmp/widgets/hero/hero.php:153
|
1429 |
msgid "Button"
|
1430 |
msgstr ""
|
1431 |
|
1432 |
+
#: tmp/widgets/cta/cta.php:263, tmp/widgets/testimonial/testimonial.php:723
|
1433 |
+
msgid "Get more font customization options with %sSiteOrigin Premium%s"
|
1434 |
+
msgstr ""
|
1435 |
+
|
1436 |
#: tmp/widgets/editor/editor.php:16
|
1437 |
msgid "SiteOrigin Editor"
|
1438 |
msgstr ""
|
1449 |
msgid "Enable the \"Automatically add paragraphs\" setting by default."
|
1450 |
msgstr ""
|
1451 |
|
1452 |
+
#: tmp/widgets/features/features.php:25
|
1453 |
msgid "SiteOrigin Features"
|
1454 |
msgstr ""
|
1455 |
|
1456 |
+
#: tmp/widgets/features/features.php:29
|
1457 |
msgid "Displays a list of features."
|
1458 |
msgstr ""
|
1459 |
|
1460 |
+
#: tmp/widgets/features/features.php:83, tmp/widgets/price-table/price-table.php:100
|
1461 |
msgid "Features"
|
1462 |
msgstr ""
|
1463 |
|
1464 |
+
#: tmp/widgets/features/features.php:85, tmp/widgets/price-table/price-table.php:101
|
1465 |
msgid "Feature"
|
1466 |
msgstr ""
|
1467 |
|
1468 |
+
#: tmp/widgets/features/features.php:109
|
1469 |
msgid "Container color"
|
1470 |
msgstr ""
|
1471 |
|
1472 |
+
#: tmp/widgets/features/features.php:121
|
1473 |
msgid "Container Position"
|
1474 |
msgstr ""
|
1475 |
|
1476 |
+
#: tmp/widgets/features/features.php:159, tmp/widgets/social-media-buttons/social-media-buttons.php:153
|
1477 |
msgid "Icon title"
|
1478 |
msgstr ""
|
1479 |
|
1480 |
+
#: tmp/widgets/features/features.php:183
|
1481 |
msgid "Icon image"
|
1482 |
msgstr ""
|
1483 |
|
1484 |
+
#: tmp/widgets/features/features.php:185
|
1485 |
msgid "Use your own icon image."
|
1486 |
msgstr ""
|
1487 |
|
1488 |
+
#: tmp/widgets/features/features.php:195
|
1489 |
msgid "Icon image size"
|
1490 |
msgstr ""
|
1491 |
|
1492 |
+
#: tmp/widgets/features/features.php:209, tmp/widgets/image/image.php:55
|
1493 |
msgid "Title text"
|
1494 |
msgstr ""
|
1495 |
|
1496 |
+
#: tmp/widgets/features/features.php:229
|
1497 |
msgid "More link text"
|
1498 |
msgstr ""
|
1499 |
|
1500 |
+
#: tmp/widgets/features/features.php:239
|
1501 |
msgid "More link URL"
|
1502 |
msgstr ""
|
1503 |
|
1504 |
+
#: tmp/widgets/features/features.php:253
|
1505 |
msgid "Font Design"
|
1506 |
msgstr ""
|
1507 |
|
1508 |
+
#: tmp/widgets/features/features.php:347
|
1509 |
msgid "More Link"
|
1510 |
msgstr ""
|
1511 |
|
1512 |
+
#: tmp/widgets/features/features.php:393
|
1513 |
msgid "Container shape"
|
1514 |
msgstr ""
|
1515 |
|
1516 |
+
#: tmp/widgets/features/features.php:407
|
1517 |
msgid "Container size"
|
1518 |
msgstr ""
|
1519 |
|
1520 |
+
#: tmp/widgets/features/features.php:419, tmp/widgets/social-media-buttons/social-media-buttons.php:231
|
1521 |
msgid "Icon size"
|
1522 |
msgstr ""
|
1523 |
|
1524 |
+
#: tmp/widgets/features/features.php:431
|
1525 |
msgid "Use icon size for custom icon"
|
1526 |
msgstr ""
|
1527 |
|
1528 |
+
#: tmp/widgets/features/features.php:443
|
1529 |
msgid "Features per row"
|
1530 |
msgstr ""
|
1531 |
|
1532 |
+
#: tmp/widgets/features/features.php:455
|
1533 |
msgid "Responsive layout"
|
1534 |
msgstr ""
|
1535 |
|
1536 |
+
#: tmp/widgets/features/features.php:467
|
1537 |
msgid "Link feature title to more URL"
|
1538 |
msgstr ""
|
1539 |
|
1540 |
+
#: tmp/widgets/features/features.php:479
|
1541 |
msgid "Link icon to more URL"
|
1542 |
msgstr ""
|
1543 |
|
1544 |
+
#: tmp/widgets/features/features.php:491
|
1545 |
msgid "Open more URL in a new window"
|
1546 |
msgstr ""
|
1547 |
|
1548 |
+
#: tmp/widgets/features/features.php:591
|
1549 |
msgid "Responsive Breakpoint"
|
1550 |
msgstr ""
|
1551 |
|
1552 |
+
#: tmp/widgets/features/features.php:595
|
1553 |
msgid "This setting controls when the features widget will collapse for mobile devices. The default value is 520px"
|
1554 |
msgstr ""
|
1555 |
|
1556 |
+
#: tmp/widgets/google-map/google-map.php:31
|
1557 |
msgid "SiteOrigin Google Maps"
|
1558 |
msgstr ""
|
1559 |
|
1560 |
+
#: tmp/widgets/google-map/google-map.php:35
|
1561 |
msgid "A Google Maps widget."
|
1562 |
msgstr ""
|
1563 |
|
1564 |
+
#: tmp/widgets/google-map/google-map.php:73
|
1565 |
msgid "Map center"
|
1566 |
msgstr ""
|
1567 |
|
1568 |
+
#: tmp/widgets/google-map/google-map.php:77
|
1569 |
msgid "The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the <strong>Geocoding API</strong> in the %sGoogle APIs Dashboard%s."
|
1570 |
msgstr ""
|
1571 |
|
1572 |
+
#: tmp/widgets/google-map/google-map.php:91, tmp/widgets/google-map/google-map.php:101, tmp/widgets/google-map/google-map.php:873
|
1573 |
msgid "API key"
|
1574 |
msgstr ""
|
1575 |
|
1576 |
+
#: tmp/widgets/google-map/google-map.php:107
|
1577 |
msgid "Enter your %sAPI key%s. Your map may not function correctly without one."
|
1578 |
msgstr ""
|
1579 |
|
1580 |
+
#: tmp/widgets/google-map/google-map.php:129
|
1581 |
msgid "Set map display options."
|
1582 |
msgstr ""
|
1583 |
|
1584 |
+
#: tmp/widgets/google-map/google-map.php:139
|
1585 |
msgid "Map type"
|
1586 |
msgstr ""
|
1587 |
|
1588 |
+
#: tmp/widgets/google-map/google-map.php:151
|
1589 |
msgid "Interactive"
|
1590 |
msgstr ""
|
1591 |
|
1592 |
+
#: tmp/widgets/google-map/google-map.php:153
|
1593 |
msgid "Static image"
|
1594 |
msgstr ""
|
1595 |
|
1596 |
+
#: tmp/widgets/google-map/google-map.php:233
|
1597 |
msgid "Zoom level"
|
1598 |
msgstr ""
|
1599 |
|
1600 |
+
#: tmp/widgets/google-map/google-map.php:235
|
1601 |
msgid "A value from 0 (the world) to 21 (street level)."
|
1602 |
msgstr ""
|
1603 |
|
1604 |
+
#: tmp/widgets/google-map/google-map.php:263
|
1605 |
msgid "Scroll to zoom"
|
1606 |
msgstr ""
|
1607 |
|
1608 |
+
#: tmp/widgets/google-map/google-map.php:265
|
1609 |
msgid "Allow scrolling over the map to zoom in or out."
|
1610 |
msgstr ""
|
1611 |
|
1612 |
+
#: tmp/widgets/google-map/google-map.php:283
|
1613 |
msgid "Draggable"
|
1614 |
msgstr ""
|
1615 |
|
1616 |
+
#: tmp/widgets/google-map/google-map.php:285
|
1617 |
msgid "Allow dragging the map to move it around."
|
1618 |
msgstr ""
|
1619 |
|
1620 |
+
#: tmp/widgets/google-map/google-map.php:303
|
1621 |
msgid "Disable default UI"
|
1622 |
msgstr ""
|
1623 |
|
1624 |
+
#: tmp/widgets/google-map/google-map.php:305
|
1625 |
msgid "Hides the default Google Maps controls."
|
1626 |
msgstr ""
|
1627 |
|
1628 |
+
#: tmp/widgets/google-map/google-map.php:323
|
1629 |
msgid "Keep map centered"
|
1630 |
msgstr ""
|
1631 |
|
1632 |
+
#: tmp/widgets/google-map/google-map.php:325
|
1633 |
msgid "Keeps the map centered when it's container is resized."
|
1634 |
msgstr ""
|
1635 |
|
1636 |
+
#: tmp/widgets/google-map/google-map.php:333
|
1637 |
msgid "Fallback Image"
|
1638 |
msgstr ""
|
1639 |
|
1640 |
+
#: tmp/widgets/google-map/google-map.php:335
|
1641 |
msgid "This image will be displayed if there are any problems with displaying the specified map."
|
1642 |
msgstr ""
|
1643 |
|
1644 |
+
#: tmp/widgets/google-map/google-map.php:345
|
1645 |
msgid "Fallback Image Size"
|
1646 |
msgstr ""
|
1647 |
|
1648 |
+
#: tmp/widgets/google-map/google-map.php:357
|
1649 |
msgid "Markers"
|
1650 |
msgstr ""
|
1651 |
|
1652 |
+
#: tmp/widgets/google-map/google-map.php:361
|
1653 |
msgid "Use markers to identify points of interest on the map."
|
1654 |
msgstr ""
|
1655 |
|
1656 |
+
#: tmp/widgets/google-map/google-map.php:371
|
1657 |
msgid "Show marker at map center"
|
1658 |
msgstr ""
|
1659 |
|
1660 |
+
#: tmp/widgets/google-map/google-map.php:381
|
1661 |
msgid "Marker icon"
|
1662 |
msgstr ""
|
1663 |
|
1664 |
+
#: tmp/widgets/google-map/google-map.php:383
|
1665 |
msgid "Replaces the default map marker with your own image."
|
1666 |
msgstr ""
|
1667 |
|
1668 |
+
#: tmp/widgets/google-map/google-map.php:401
|
1669 |
msgid "Draggable markers"
|
1670 |
msgstr ""
|
1671 |
|
1672 |
+
#: tmp/widgets/google-map/google-map.php:409
|
1673 |
msgid "Marker positions"
|
1674 |
msgstr ""
|
1675 |
|
1676 |
+
#: tmp/widgets/google-map/google-map.php:411
|
1677 |
msgid "Please be aware that adding more than 10 markers may cause a slight delay before they appear, due to Google Geocoding API rate limits."
|
1678 |
msgstr ""
|
1679 |
|
1680 |
+
#: tmp/widgets/google-map/google-map.php:413
|
1681 |
msgid "Marker"
|
1682 |
msgstr ""
|
1683 |
|
1684 |
+
#: tmp/widgets/google-map/google-map.php:433
|
1685 |
msgid "Place"
|
1686 |
msgstr ""
|
1687 |
|
1688 |
+
#: tmp/widgets/google-map/google-map.php:443
|
1689 |
msgid "Info Window Content"
|
1690 |
msgstr ""
|
1691 |
|
1692 |
+
#: tmp/widgets/google-map/google-map.php:451
|
1693 |
msgid "Info Window max width"
|
1694 |
msgstr ""
|
1695 |
|
1696 |
+
#: tmp/widgets/google-map/google-map.php:461
|
1697 |
msgid "Custom Marker icon"
|
1698 |
msgstr ""
|
1699 |
|
1700 |
+
#: tmp/widgets/google-map/google-map.php:463
|
1701 |
msgid "Replace the default map marker with your own image for each marker."
|
1702 |
msgstr ""
|
1703 |
|
1704 |
+
#: tmp/widgets/google-map/google-map.php:475
|
1705 |
msgid "When should Info Windows be displayed?"
|
1706 |
msgstr ""
|
1707 |
|
1708 |
+
#: tmp/widgets/google-map/google-map.php:481
|
1709 |
msgid "Click"
|
1710 |
msgstr ""
|
1711 |
|
1712 |
+
#: tmp/widgets/google-map/google-map.php:483
|
1713 |
msgid "Mouse over"
|
1714 |
msgstr ""
|
1715 |
|
1716 |
+
#: tmp/widgets/google-map/google-map.php:485
|
1717 |
msgid "Always"
|
1718 |
msgstr ""
|
1719 |
|
1720 |
+
#: tmp/widgets/google-map/google-map.php:495
|
1721 |
msgid "Allow multiple simultaneous Info Windows?"
|
1722 |
msgstr ""
|
1723 |
|
1724 |
+
#: tmp/widgets/google-map/google-map.php:511
|
1725 |
msgid "Styles"
|
1726 |
msgstr ""
|
1727 |
|
1728 |
+
#: tmp/widgets/google-map/google-map.php:515
|
1729 |
msgid "Apply custom colors to map features, or hide them completely."
|
1730 |
msgstr ""
|
1731 |
|
1732 |
+
#: tmp/widgets/google-map/google-map.php:525
|
1733 |
msgid "Map styles"
|
1734 |
msgstr ""
|
1735 |
|
1736 |
+
#: tmp/widgets/google-map/google-map.php:539
|
1737 |
msgid "Custom"
|
1738 |
msgstr ""
|
1739 |
|
1740 |
+
#: tmp/widgets/google-map/google-map.php:541
|
1741 |
msgid "Predefined Styles"
|
1742 |
msgstr ""
|
1743 |
|
1744 |
+
#: tmp/widgets/google-map/google-map.php:559
|
1745 |
msgid "Styled map name"
|
1746 |
msgstr ""
|
1747 |
|
1748 |
+
#: tmp/widgets/google-map/google-map.php:579
|
1749 |
msgid "Raw JSON styles"
|
1750 |
msgstr ""
|
1751 |
|
1752 |
+
#: tmp/widgets/google-map/google-map.php:581
|
1753 |
msgid "Copy and paste predefined styles here from <a href=\"http://snazzymaps.com/\" target=\"_blank\" rel=\"noopener noreferrer\">Snazzy Maps</a>."
|
1754 |
msgstr ""
|
1755 |
|
1756 |
+
#: tmp/widgets/google-map/google-map.php:597
|
1757 |
msgid "Custom map styles"
|
1758 |
msgstr ""
|
1759 |
|
1760 |
+
#: tmp/widgets/google-map/google-map.php:619
|
1761 |
msgid "Select map feature to style"
|
1762 |
msgstr ""
|
1763 |
|
1764 |
+
#: tmp/widgets/google-map/google-map.php:623
|
1765 |
msgid "Water"
|
1766 |
msgstr ""
|
1767 |
|
1768 |
+
#: tmp/widgets/google-map/google-map.php:625
|
1769 |
msgid "Highways"
|
1770 |
msgstr ""
|
1771 |
|
1772 |
+
#: tmp/widgets/google-map/google-map.php:627
|
1773 |
msgid "Arterial roads"
|
1774 |
msgstr ""
|
1775 |
|
1776 |
+
#: tmp/widgets/google-map/google-map.php:629
|
1777 |
msgid "Local roads"
|
1778 |
msgstr ""
|
1779 |
|
1780 |
+
#: tmp/widgets/google-map/google-map.php:631
|
1781 |
msgid "Transit lines"
|
1782 |
msgstr ""
|
1783 |
|
1784 |
+
#: tmp/widgets/google-map/google-map.php:633
|
1785 |
msgid "Transit stations"
|
1786 |
msgstr ""
|
1787 |
|
1788 |
+
#: tmp/widgets/google-map/google-map.php:635
|
1789 |
msgid "Man-made landscape"
|
1790 |
msgstr ""
|
1791 |
|
1792 |
+
#: tmp/widgets/google-map/google-map.php:637
|
1793 |
msgid "Natural landscape landcover"
|
1794 |
msgstr ""
|
1795 |
|
1796 |
+
#: tmp/widgets/google-map/google-map.php:639
|
1797 |
msgid "Natural landscape terrain"
|
1798 |
msgstr ""
|
1799 |
|
1800 |
+
#: tmp/widgets/google-map/google-map.php:641
|
1801 |
msgid "Point of interest - Attractions"
|
1802 |
msgstr ""
|
1803 |
|
1804 |
+
#: tmp/widgets/google-map/google-map.php:643
|
1805 |
msgid "Point of interest - Business"
|
1806 |
msgstr ""
|
1807 |
|
1808 |
+
#: tmp/widgets/google-map/google-map.php:645
|
1809 |
msgid "Point of interest - Government"
|
1810 |
msgstr ""
|
1811 |
|
1812 |
+
#: tmp/widgets/google-map/google-map.php:647
|
1813 |
msgid "Point of interest - Medical"
|
1814 |
msgstr ""
|
1815 |
|
1816 |
+
#: tmp/widgets/google-map/google-map.php:649
|
1817 |
msgid "Point of interest - Parks"
|
1818 |
msgstr ""
|
1819 |
|
1820 |
+
#: tmp/widgets/google-map/google-map.php:651
|
1821 |
msgid "Point of interest - Places of worship"
|
1822 |
msgstr ""
|
1823 |
|
1824 |
+
#: tmp/widgets/google-map/google-map.php:653
|
1825 |
msgid "Point of interest - Schools"
|
1826 |
msgstr ""
|
1827 |
|
1828 |
+
#: tmp/widgets/google-map/google-map.php:655
|
1829 |
msgid "Point of interest - Sports complexes"
|
1830 |
msgstr ""
|
1831 |
|
1832 |
+
#: tmp/widgets/google-map/google-map.php:665
|
1833 |
msgid "Select element type to style"
|
1834 |
msgstr ""
|
1835 |
|
1836 |
+
#: tmp/widgets/google-map/google-map.php:669
|
1837 |
msgid "Geometry"
|
1838 |
msgstr ""
|
1839 |
|
1840 |
+
#: tmp/widgets/google-map/google-map.php:671
|
1841 |
msgid "Labels"
|
1842 |
msgstr ""
|
1843 |
|
1844 |
+
#: tmp/widgets/google-map/google-map.php:685
|
1845 |
msgid "Visible"
|
1846 |
msgstr ""
|
1847 |
|
1848 |
+
#: tmp/widgets/google-map/google-map.php:709
|
1849 |
msgid "Directions"
|
1850 |
msgstr ""
|
1851 |
|
1852 |
+
#: tmp/widgets/google-map/google-map.php:723
|
1853 |
msgid "Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the <strong>Directions API</strong> in the %sGoogle APIs Dashboard%s."
|
1854 |
msgstr ""
|
1855 |
|
1856 |
+
#: tmp/widgets/google-map/google-map.php:737
|
1857 |
msgid "Starting point"
|
1858 |
msgstr ""
|
1859 |
|
1860 |
+
#: tmp/widgets/google-map/google-map.php:745
|
1861 |
msgid "Destination"
|
1862 |
msgstr ""
|
1863 |
|
1864 |
+
#: tmp/widgets/google-map/google-map.php:753
|
1865 |
msgid "Travel mode"
|
1866 |
msgstr ""
|
1867 |
|
1868 |
+
#: tmp/widgets/google-map/google-map.php:759
|
1869 |
msgid "Driving"
|
1870 |
msgstr ""
|
1871 |
|
1872 |
+
#: tmp/widgets/google-map/google-map.php:761
|
1873 |
msgid "Walking"
|
1874 |
msgstr ""
|
1875 |
|
1876 |
+
#: tmp/widgets/google-map/google-map.php:763
|
1877 |
msgid "Bicycling"
|
1878 |
msgstr ""
|
1879 |
|
1880 |
+
#: tmp/widgets/google-map/google-map.php:765
|
1881 |
msgid "Transit"
|
1882 |
msgstr ""
|
1883 |
|
1884 |
+
#: tmp/widgets/google-map/google-map.php:775
|
1885 |
msgid "Avoid highways"
|
1886 |
msgstr ""
|
1887 |
|
1888 |
+
#: tmp/widgets/google-map/google-map.php:783
|
1889 |
msgid "Avoid tolls"
|
1890 |
msgstr ""
|
1891 |
|
1892 |
+
#: tmp/widgets/google-map/google-map.php:791
|
1893 |
msgid "Preserve viewport"
|
1894 |
msgstr ""
|
1895 |
|
1896 |
+
#: tmp/widgets/google-map/google-map.php:793
|
1897 |
msgid "This will prevent the map from centering and zooming around the directions. Use this when you have other markers or features on your map."
|
1898 |
msgstr ""
|
1899 |
|
1900 |
+
#: tmp/widgets/google-map/google-map.php:801
|
1901 |
msgid "Waypoints"
|
1902 |
msgstr ""
|
1903 |
|
1904 |
+
#: tmp/widgets/google-map/google-map.php:803
|
1905 |
msgid "Waypoint"
|
1906 |
msgstr ""
|
1907 |
|
1908 |
+
#: tmp/widgets/google-map/google-map.php:823, tmp/widgets/testimonial/testimonial.php:129
|
1909 |
msgid "Location"
|
1910 |
msgstr ""
|
1911 |
|
1912 |
+
#: tmp/widgets/google-map/google-map.php:833
|
1913 |
msgid "Stopover"
|
1914 |
msgstr ""
|
1915 |
|
1916 |
+
#: tmp/widgets/google-map/google-map.php:835
|
1917 |
msgid "Whether or not this is a stop on the route or just a route preference."
|
1918 |
msgstr ""
|
1919 |
|
1920 |
+
#: tmp/widgets/google-map/google-map.php:847
|
1921 |
msgid "Optimize waypoints"
|
1922 |
msgstr ""
|
1923 |
|
1924 |
+
#: tmp/widgets/google-map/google-map.php:851
|
1925 |
msgid "Allow the Google Maps service to reorder waypoints for the shortest travelling distance."
|
1926 |
msgstr ""
|
1927 |
|
1928 |
+
#: tmp/widgets/google-map/google-map.php:879
|
1929 |
msgid "Enter your %sAPI key%s. Your map won't function correctly without one."
|
1930 |
msgstr ""
|
1931 |
|
1932 |
+
#: tmp/widgets/google-map/google-map.php:1103
|
1933 |
msgid "There were no results for the place you entered. Please try another."
|
1934 |
msgstr ""
|
1935 |
|
1936 |
+
#: tmp/widgets/google-map/google-map.php:1209
|
1937 |
msgid "Custom Map"
|
1938 |
msgstr ""
|
1939 |
|
2021 |
msgid "Sub Headline"
|
2022 |
msgstr ""
|
2023 |
|
2024 |
+
#: tmp/widgets/headline/headline.php:244, tmp/widgets/hero/hero.php:419
|
2025 |
msgid "Use FitText"
|
2026 |
msgstr ""
|
2027 |
|
2028 |
+
#: tmp/widgets/headline/headline.php:245, tmp/widgets/hero/hero.php:421
|
2029 |
msgid "Dynamically adjust your heading font size based on screen size."
|
2030 |
msgstr ""
|
2031 |
|
2032 |
+
#: tmp/widgets/headline/headline.php:258, tmp/widgets/hero/hero.php:447
|
2033 |
msgid "FitText Compressor Strength"
|
2034 |
msgstr ""
|
2035 |
|
2036 |
+
#: tmp/widgets/headline/headline.php:259, tmp/widgets/hero/hero.php:449
|
2037 |
msgid "How aggressively FitText should resize your heading."
|
2038 |
msgstr ""
|
2039 |
|
2040 |
+
#: tmp/widgets/hero/hero.php:35
|
2041 |
msgid "SiteOrigin Hero"
|
2042 |
msgstr ""
|
2043 |
|
2044 |
+
#: tmp/widgets/hero/hero.php:39
|
2045 |
msgid "A big hero image with a few settings to make it your own."
|
2046 |
msgstr ""
|
2047 |
|
2048 |
+
#: tmp/widgets/hero/hero.php:93
|
2049 |
msgid "Hero frames"
|
2050 |
msgstr ""
|
2051 |
|
2052 |
+
#: tmp/widgets/hero/hero.php:95, tmp/widgets/layout-slider/layout-slider.php:35, tmp/widgets/slider/slider.php:34
|
2053 |
msgid "Frame"
|
2054 |
msgstr ""
|
2055 |
|
2056 |
+
#: tmp/widgets/hero/hero.php:127, tmp/widgets/taxonomy/taxonomy.php:49
|
2057 |
msgid "Buttons"
|
2058 |
msgstr ""
|
2059 |
|
2060 |
+
#: tmp/widgets/hero/hero.php:131
|
2061 |
msgid "Add [buttons] shortcode to the content to insert these buttons."
|
2062 |
msgstr ""
|
2063 |
|
2064 |
+
#: tmp/widgets/hero/hero.php:177, tmp/widgets/layout-slider/layout-slider.php:56, tmp/widgets/slider/slider.php:56
|
2065 |
msgid "Background image"
|
2066 |
msgstr ""
|
2067 |
|
2068 |
+
#: tmp/widgets/hero/hero.php:191, tmp/widgets/image-grid/image-grid.php:86, tmp/widgets/image/image.php:38, tmp/widgets/testimonial/testimonial.php:259, tmp/widgets/testimonial/testimonial.php:317, tmp/widgets/testimonial/testimonial.php:401
|
2069 |
msgid "Image size"
|
2070 |
msgstr ""
|
2071 |
|
2072 |
+
#: tmp/widgets/hero/hero.php:201, tmp/widgets/layout-slider/layout-slider.php:63, tmp/widgets/slider/slider.php:67
|
2073 |
msgid "Background image type"
|
2074 |
msgstr ""
|
2075 |
|
2076 |
+
#: tmp/widgets/hero/hero.php:205, tmp/widgets/slider/slider.php:69
|
2077 |
msgid "Cover"
|
2078 |
msgstr ""
|
2079 |
|
2080 |
+
#: tmp/widgets/hero/hero.php:217, tmp/widgets/layout-slider/layout-slider.php:72
|
2081 |
msgid "Background image opacity"
|
2082 |
msgstr ""
|
2083 |
|
2084 |
+
#: tmp/widgets/hero/hero.php:257, tmp/widgets/layout-slider/layout-slider.php:92
|
2085 |
msgid "Open URL in a new window"
|
2086 |
msgstr ""
|
2087 |
|
2088 |
+
#: tmp/widgets/hero/hero.php:267, tmp/widgets/layout-slider/layout-slider.php:97, tmp/widgets/slider/slider.php:43
|
2089 |
msgid "Video"
|
2090 |
msgstr ""
|
2091 |
|
2092 |
+
#: tmp/widgets/hero/hero.php:269, tmp/widgets/layout-slider/layout-slider.php:98, tmp/widgets/slider/slider.php:44
|
2093 |
msgid "Background videos"
|
2094 |
msgstr ""
|
2095 |
|
2096 |
+
#: tmp/widgets/hero/hero.php:299, tmp/widgets/layout-slider/layout-slider.php:113
|
2097 |
msgid "Slider Controls"
|
2098 |
msgstr ""
|
2099 |
|
2100 |
+
#: tmp/widgets/hero/hero.php:311, tmp/widgets/layout-slider/layout-slider.php:119
|
2101 |
msgid "Design and Layout"
|
2102 |
msgstr ""
|
2103 |
|
2104 |
+
#: tmp/widgets/hero/hero.php:333, tmp/widgets/layout-slider/layout-slider.php:130
|
2105 |
msgid "Top and bottom padding"
|
2106 |
msgstr ""
|
2107 |
|
2108 |
+
#: tmp/widgets/hero/hero.php:345, tmp/widgets/layout-slider/layout-slider.php:136
|
2109 |
msgid "Extra top padding"
|
2110 |
msgstr ""
|
2111 |
|
2112 |
+
#: tmp/widgets/hero/hero.php:347, tmp/widgets/layout-slider/layout-slider.php:137
|
2113 |
msgid "Additional padding added to the top of the slider"
|
2114 |
msgstr ""
|
2115 |
|
2116 |
+
#: tmp/widgets/hero/hero.php:359, tmp/widgets/layout-slider/layout-slider.php:143
|
2117 |
msgid "Side padding"
|
2118 |
msgstr ""
|
2119 |
|
2120 |
+
#: tmp/widgets/hero/hero.php:371, tmp/widgets/layout-slider/layout-slider.php:149
|
2121 |
msgid "Maximum container width"
|
2122 |
msgstr ""
|
2123 |
|
2124 |
+
#: tmp/widgets/hero/hero.php:383
|
2125 |
msgid "Heading font"
|
2126 |
msgstr ""
|
2127 |
|
2128 |
+
#: tmp/widgets/hero/hero.php:395, tmp/widgets/layout-slider/layout-slider.php:155
|
2129 |
msgid "Heading color"
|
2130 |
msgstr ""
|
2131 |
|
2132 |
+
#: tmp/widgets/hero/hero.php:407, tmp/widgets/layout-slider/layout-slider.php:161
|
2133 |
msgid "Heading size"
|
2134 |
msgstr ""
|
2135 |
|
2136 |
+
#: tmp/widgets/hero/hero.php:469, tmp/widgets/layout-slider/layout-slider.php:167
|
2137 |
msgid "Heading shadow intensity"
|
2138 |
msgstr ""
|
2139 |
|
2140 |
+
#: tmp/widgets/hero/hero.php:495, tmp/widgets/layout-slider/layout-slider.php:175
|
2141 |
msgid "Text size"
|
2142 |
msgstr ""
|
2143 |
|
2144 |
+
#: tmp/widgets/hero/hero.php:505
|
2145 |
msgid "Text font"
|
2146 |
msgstr ""
|
2147 |
|
2148 |
+
#: tmp/widgets/hero/hero.php:515
|
2149 |
msgid "Text shadow intensity"
|
2150 |
msgstr ""
|
2151 |
|
2152 |
+
#: tmp/widgets/hero/hero.php:533
|
2153 |
msgid "Link color"
|
2154 |
msgstr ""
|
2155 |
|
2156 |
+
#: tmp/widgets/hero/hero.php:543
|
2157 |
msgid "Link Hover Color"
|
2158 |
msgstr ""
|
2159 |
|
2181 |
msgid "Image title"
|
2182 |
msgstr ""
|
2183 |
|
2184 |
+
#: tmp/widgets/image-grid/image-grid.php:71, tmp/widgets/social-media-buttons/social-media-buttons.php:145, tmp/widgets/testimonial/testimonial.php:173
|
2185 |
msgid "URL"
|
2186 |
msgstr ""
|
2187 |
|
2641 |
msgid "YouTube"
|
2642 |
msgstr ""
|
2643 |
|
2644 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:35
|
2645 |
msgid "SiteOrigin Social Media Buttons"
|
2646 |
msgstr ""
|
2647 |
|
2648 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:39
|
2649 |
msgid "A social media buttons widget."
|
2650 |
msgstr ""
|
2651 |
|
2652 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:63
|
2653 |
msgid "Mobile Collapse Width"
|
2654 |
msgstr ""
|
2655 |
|
2656 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:67
|
2657 |
msgid "This setting allows you to set the resoloution for when the Mobile Align setting will be used."
|
2658 |
msgstr ""
|
2659 |
|
2660 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:113
|
2661 |
msgid "Networks"
|
2662 |
msgstr ""
|
2663 |
|
2664 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:115
|
2665 |
msgid "Network"
|
2666 |
msgstr ""
|
2667 |
|
2668 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:135
|
2669 |
msgid "Select network"
|
2670 |
msgstr ""
|
2671 |
|
2672 |
+
#: tmp/widgets/social-media-buttons/social-media-buttons.php:317
|
2673 |
msgid "Mobile Align"
|
2674 |
msgstr ""
|
2675 |
|
2729 |
msgid "Hover color"
|
2730 |
msgstr ""
|
2731 |
|
2732 |
+
#: tmp/widgets/testimonial/testimonial.php:27
|
2733 |
msgid "SiteOrigin Testimonials"
|
2734 |
msgstr ""
|
2735 |
|
2736 |
+
#: tmp/widgets/testimonial/testimonial.php:31
|
2737 |
msgid "Share your product/service testimonials in a variety of different ways."
|
2738 |
msgstr ""
|
2739 |
|
2740 |
+
#: tmp/widgets/testimonial/testimonial.php:87
|
2741 |
msgid "Testimonials"
|
2742 |
msgstr ""
|
2743 |
|
2744 |
+
#: tmp/widgets/testimonial/testimonial.php:89
|
2745 |
msgid "Testimonial"
|
2746 |
msgstr ""
|
2747 |
|
2748 |
+
#: tmp/widgets/testimonial/testimonial.php:109
|
2749 |
msgid "The author of the testimonial"
|
2750 |
msgstr ""
|
2751 |
|
2752 |
+
#: tmp/widgets/testimonial/testimonial.php:119
|
2753 |
msgid "Link name"
|
2754 |
msgstr ""
|
2755 |
|
2756 |
+
#: tmp/widgets/testimonial/testimonial.php:131
|
2757 |
msgid "Their location or company name"
|
2758 |
msgstr ""
|
2759 |
|
2760 |
+
#: tmp/widgets/testimonial/testimonial.php:151
|
2761 |
msgid "Link image"
|
2762 |
msgstr ""
|
2763 |
|
2764 |
+
#: tmp/widgets/testimonial/testimonial.php:163
|
2765 |
msgid "What your customer had to say"
|
2766 |
msgstr ""
|
2767 |
|
2768 |
+
#: tmp/widgets/testimonial/testimonial.php:183
|
2769 |
msgid "Open In New Window"
|
2770 |
msgstr ""
|
2771 |
|
2772 |
+
#: tmp/widgets/testimonial/testimonial.php:207, tmp/widgets/testimonial/testimonial.php:243, tmp/widgets/testimonial/testimonial.php:301
|
2773 |
msgid "Testimonials per row"
|
2774 |
msgstr ""
|
2775 |
|
2776 |
+
#: tmp/widgets/testimonial/testimonial.php:225
|
2777 |
msgid "Responsive"
|
2778 |
msgstr ""
|
2779 |
|
2780 |
+
#: tmp/widgets/testimonial/testimonial.php:235
|
2781 |
msgid "Tablet"
|
2782 |
msgstr ""
|
2783 |
|
2784 |
+
#: tmp/widgets/testimonial/testimonial.php:275, tmp/widgets/testimonial/testimonial.php:333
|
2785 |
msgid "Resolution"
|
2786 |
msgstr ""
|
2787 |
|
2788 |
+
#: tmp/widgets/testimonial/testimonial.php:277
|
2789 |
msgid "The resolution to treat as a mobile resolution."
|
2790 |
msgstr ""
|
2791 |
|
2792 |
+
#: tmp/widgets/testimonial/testimonial.php:293
|
2793 |
msgid "Mobile Phone"
|
2794 |
msgstr ""
|
2795 |
|
2796 |
+
#: tmp/widgets/testimonial/testimonial.php:335
|
2797 |
msgid "The resolution to treat as a tablet resolution."
|
2798 |
msgstr ""
|
2799 |
|
2800 |
+
#: tmp/widgets/testimonial/testimonial.php:381
|
2801 |
msgid "Testimonial image shape"
|
2802 |
msgstr ""
|
2803 |
|
2804 |
+
#: tmp/widgets/testimonial/testimonial.php:385
|
2805 |
msgid "Square"
|
2806 |
msgstr ""
|
2807 |
|
2808 |
+
#: tmp/widgets/testimonial/testimonial.php:387
|
2809 |
msgid "Round"
|
2810 |
msgstr ""
|
2811 |
|
2812 |
+
#: tmp/widgets/testimonial/testimonial.php:423
|
2813 |
msgid "Colors"
|
2814 |
msgstr ""
|
2815 |
|
2816 |
+
#: tmp/widgets/testimonial/testimonial.php:431
|
2817 |
msgid "Widget Background"
|
2818 |
msgstr ""
|
2819 |
|
2820 |
+
#: tmp/widgets/testimonial/testimonial.php:439
|
2821 |
msgid "Text Background"
|
2822 |
msgstr ""
|
2823 |
|
2824 |
+
#: tmp/widgets/testimonial/testimonial.php:483
|
2825 |
msgid "Testimonial Radius"
|
2826 |
msgstr ""
|
2827 |
|
2828 |
+
#: tmp/widgets/testimonial/testimonial.php:501
|
2829 |
msgid "User position"
|
2830 |
msgstr ""
|
2831 |
|
2832 |
+
#: tmp/widgets/testimonial/testimonial.php:509
|
2833 |
msgid "Middle"
|
2834 |
msgstr ""
|
2835 |
|
2836 |
+
#: tmp/widgets/testimonial/testimonial.php:523
|
2837 |
msgid "Testimonial layout"
|
2838 |
msgstr ""
|
2839 |
|
2840 |
+
#: tmp/widgets/testimonial/testimonial.php:527
|
2841 |
msgid "Side by side"
|
2842 |
msgstr ""
|
2843 |
|
2844 |
+
#: tmp/widgets/testimonial/testimonial.php:529
|
2845 |
msgid "Text above user"
|
2846 |
msgstr ""
|
2847 |
|
2848 |
+
#: tmp/widgets/testimonial/testimonial.php:531
|
2849 |
msgid "Text below user"
|
2850 |
msgstr ""
|
2851 |
|
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: 4.2
|
4 |
Tested up to: 4.9.1
|
5 |
-
Stable tag: 1.11.
|
6 |
-
Build time: 2018-
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
Donate link: https://siteorigin.com/downloads/contribution/
|
@@ -65,6 +65,12 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
= 1.11.3 - 10 January 2018 =
|
69 |
* Hero: Add margin-top to so-widget-sow-button for spacing.
|
70 |
* Accordion: Added overflow to prevent Image overlap.
|
2 |
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
|
3 |
Requires at least: 4.2
|
4 |
Tested up to: 4.9.1
|
5 |
+
Stable tag: 1.11.4
|
6 |
+
Build time: 2018-02-07T08:38:59+02:00
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
Donate link: https://siteorigin.com/downloads/contribution/
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.11.4 - 7 February 2018 =
|
69 |
+
* Slider: Add playsinline for Video backgrounds for iOS.
|
70 |
+
* Repeater field: Trigger change events for repeater when adding, removing or duplicating items.
|
71 |
+
* TinyMCE field: Removed special handling for TinyMCE fields when retrieving data. Just use field value directly.
|
72 |
+
* Fixed build overwriting some CSS files.
|
73 |
+
|
74 |
= 1.11.3 - 10 January 2018 =
|
75 |
* Hero: Add margin-top to so-widget-sow-button for spacing.
|
76 |
* Accordion: Added overflow to prevent Image overlap.
|
so-widgets-bundle.php
CHANGED
@@ -1,795 +1,795 @@
|
|
1 |
-
<?php
|
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.11.
|
6 |
-
Text Domain: so-widgets-bundle
|
7 |
-
Domain Path: /lang
|
8 |
-
Author: SiteOrigin
|
9 |
-
Author URI: https://siteorigin.com
|
10 |
-
Plugin URI: https://siteorigin.com/widgets-bundle/
|
11 |
-
License: GPL3
|
12 |
-
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
-
*/
|
14 |
-
|
15 |
-
define('SOW_BUNDLE_VERSION', '1.11.
|
16 |
-
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
-
|
18 |
-
// Allow JS suffix to be pre-set
|
19 |
-
if( !defined( 'SOW_BUNDLE_JS_SUFFIX' ) ) {
|
20 |
-
define('SOW_BUNDLE_JS_SUFFIX', '.min');
|
21 |
-
}
|
22 |
-
|
23 |
-
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 |
-
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 |
-
|
33 |
-
private $widget_folders;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @var array The array of default widgets.
|
37 |
-
*/
|
38 |
-
static $default_active_widgets = array(
|
39 |
-
'button' => true,
|
40 |
-
'google-map' => true,
|
41 |
-
'image' => true,
|
42 |
-
'slider' => true,
|
43 |
-
'post-carousel' => true,
|
44 |
-
'editor' => true,
|
45 |
-
);
|
46 |
-
|
47 |
-
function __construct(){
|
48 |
-
add_action('admin_init', array($this, 'admin_activate_widget') );
|
49 |
-
add_action('admin_menu', array($this, 'admin_menu_init') );
|
50 |
-
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts') );
|
51 |
-
|
52 |
-
// All the ajax actions
|
53 |
-
add_action('wp_ajax_so_widgets_bundle_manage', array($this, 'admin_ajax_manage_handler') );
|
54 |
-
add_action('wp_ajax_sow_get_javascript_variables', array($this, 'admin_ajax_get_javascript_variables') );
|
55 |
-
|
56 |
-
add_action('wp_ajax_so_widgets_setting_form', array($this, 'admin_ajax_settings_form') );
|
57 |
-
add_action('wp_ajax_so_widgets_setting_save', array($this, 'admin_ajax_settings_save') );
|
58 |
-
|
59 |
-
// Initialize the widgets, but do it fairly late
|
60 |
-
add_action( 'plugins_loaded', array($this, 'set_plugin_textdomain'), 1 );
|
61 |
-
add_action( 'after_setup_theme', array($this, 'get_widget_folders'), 11 );
|
62 |
-
add_action( 'after_setup_theme', array($this, 'load_widget_plugins'), 11 );
|
63 |
-
|
64 |
-
// Add the plugin_action_links links.
|
65 |
-
add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links') );
|
66 |
-
|
67 |
-
add_action( 'admin_init', array($this, 'plugin_version_check') );
|
68 |
-
add_action( 'siteorigin_widgets_version_update', array( $this, 'handle_update' ), 10, 2 );
|
69 |
-
add_action( 'admin_notices', array( $this, 'display_admin_notices') );
|
70 |
-
|
71 |
-
// Actions for clearing widget cache
|
72 |
-
add_action( 'switch_theme', array($this, 'clear_widget_cache') );
|
73 |
-
add_action( 'activated_plugin', array($this, 'clear_widget_cache') );
|
74 |
-
add_action( 'upgrader_process_complete', array($this, 'clear_widget_cache') );
|
75 |
-
|
76 |
-
// These filters are used to activate any widgets that are missing.
|
77 |
-
add_filter( 'siteorigin_panels_data', array($this, 'load_missing_widgets') );
|
78 |
-
add_filter( 'siteorigin_panels_prebuilt_layout', array($this, 'load_missing_widgets') );
|
79 |
-
add_filter( 'siteorigin_panels_widget_object', array($this, 'load_missing_widget'), 10, 2 );
|
80 |
-
|
81 |
-
add_filter( 'wp_enqueue_scripts', array($this, 'register_general_scripts') );
|
82 |
-
add_filter( 'wp_enqueue_scripts', array($this, 'enqueue_active_widgets_scripts') );
|
83 |
-
|
84 |
-
// This is a temporary filter to disable the new Jetpack Grunion contact form editor.
|
85 |
-
add_filter( 'tmp_grunion_allow_editor_view', '__return_false' );
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Get the single of this plugin
|
90 |
-
*
|
91 |
-
* @return SiteOrigin_Widgets_Bundle
|
92 |
-
*/
|
93 |
-
static function single() {
|
94 |
-
static $single;
|
95 |
-
|
96 |
-
if( empty($single) ) {
|
97 |
-
$single = new SiteOrigin_Widgets_Bundle();
|
98 |
-
}
|
99 |
-
|
100 |
-
return $single;
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Set the text domain for the plugin
|
105 |
-
*
|
106 |
-
* @action plugins_loaded
|
107 |
-
*/
|
108 |
-
function set_plugin_textdomain(){
|
109 |
-
load_plugin_textdomain('so-widgets-bundle', false, dirname( plugin_basename( __FILE__ ) ). '/lang/');
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* This clears the file cache.
|
114 |
-
*
|
115 |
-
* @action admin_init
|
116 |
-
*/
|
117 |
-
function plugin_version_check(){
|
118 |
-
|
119 |
-
$active_version = get_option( 'siteorigin_widget_bundle_version' );
|
120 |
-
|
121 |
-
$is_new = empty($active_version) || version_compare( $active_version, SOW_BUNDLE_VERSION, '<' );
|
122 |
-
$is_new = apply_filters( 'siteorigin_widgets_is_new_version', $is_new );
|
123 |
-
|
124 |
-
if( $is_new ) {
|
125 |
-
|
126 |
-
update_option( 'siteorigin_widget_bundle_version', SOW_BUNDLE_VERSION );
|
127 |
-
// If this is a new version, then trigger an action to let widgets handle the updates.
|
128 |
-
do_action( 'siteorigin_widgets_version_update', SOW_BUNDLE_VERSION, $active_version );
|
129 |
-
$this->clear_widget_cache();
|
130 |
-
}
|
131 |
-
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* This should call any necessary functions when the plugin has been updated.
|
136 |
-
*
|
137 |
-
* @action siteorigin_widgets_version_update
|
138 |
-
*/
|
139 |
-
function handle_update($old_version, $new_version) {
|
140 |
-
//Always check for new widgets.
|
141 |
-
$this->check_for_new_widgets();
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Deletes any CSS generated by/for the widgets.
|
146 |
-
* Called on 'upgrader_process_complete', 'switch_theme', and 'activated_plugin' actions.
|
147 |
-
* Can also be called directly on the `SiteOrigin_Widgets_Bundle` singleton class.
|
148 |
-
*
|
149 |
-
* @action upgrader_process_complete Occurs after any theme, plugin or the WordPress core is updated to a new version.
|
150 |
-
* @action switch_theme Occurs after switching to a different theme.
|
151 |
-
* @action activated_plugin Occurs after a plugin has been activated.
|
152 |
-
*
|
153 |
-
*/
|
154 |
-
function clear_widget_cache() {
|
155 |
-
// Remove all cached CSS for SiteOrigin Widgets
|
156 |
-
if( function_exists('WP_Filesystem') && WP_Filesystem() ) {
|
157 |
-
global $wp_filesystem;
|
158 |
-
$upload_dir = wp_upload_dir();
|
159 |
-
|
160 |
-
// Remove any old widget cache files, if they exist.
|
161 |
-
$list = $wp_filesystem->dirlist( $upload_dir['basedir'] . '/siteorigin-widgets/' );
|
162 |
-
if( !empty($list) ) {
|
163 |
-
foreach($list as $file) {
|
164 |
-
// Delete the file
|
165 |
-
$wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $file['name'] );
|
166 |
-
}
|
167 |
-
}
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Setup and return the widget folders
|
173 |
-
*/
|
174 |
-
function check_for_new_widgets() {
|
175 |
-
// get list of available widgets
|
176 |
-
$widgets = array_keys( $this->get_widgets_list() );
|
177 |
-
// get option for previously installed widgets
|
178 |
-
$old_widgets = get_option( 'siteorigin_widgets_old_widgets' );
|
179 |
-
// if this has never been set before, it's probably a new installation so we don't want to notify for all the widgets
|
180 |
-
if ( empty( $old_widgets ) ) {
|
181 |
-
update_option( 'siteorigin_widgets_old_widgets', implode( ',', $widgets ) );
|
182 |
-
return;
|
183 |
-
}
|
184 |
-
$old_widgets = explode( ',', $old_widgets );
|
185 |
-
$new_widgets = array_diff( $widgets, $old_widgets );
|
186 |
-
if ( ! empty( $new_widgets ) ) {
|
187 |
-
update_option( 'siteorigin_widgets_new_widgets', $new_widgets );
|
188 |
-
update_option( 'siteorigin_widgets_old_widgets', implode( ',', $widgets ) );
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
function display_admin_notices() {
|
193 |
-
$new_widgets = get_option( 'siteorigin_widgets_new_widgets' );
|
194 |
-
if ( empty( $new_widgets ) ) {
|
195 |
-
return;
|
196 |
-
}
|
197 |
-
?>
|
198 |
-
<div class="updated">
|
199 |
-
<p><?php echo __( 'New widgets available in the ') . '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">' . __('SiteOrigin Widgets Bundle', 'so-widgets-bundle' ) . '</a>!'; ?></p>
|
200 |
-
<?php
|
201 |
-
|
202 |
-
$default_headers = array(
|
203 |
-
'Name' => 'Widget Name',
|
204 |
-
'Description' => 'Description',
|
205 |
-
'Author' => 'Author',
|
206 |
-
'AuthorURI' => 'Author URI',
|
207 |
-
'WidgetURI' => 'Widget URI',
|
208 |
-
'VideoURI' => 'Video URI',
|
209 |
-
);
|
210 |
-
|
211 |
-
foreach ( $new_widgets as $widget_file_path ) {
|
212 |
-
preg_match( '/.*[\/\\\\](.*).php/', $widget_file_path, $match );
|
213 |
-
$widget = get_file_data( $widget_file_path, $default_headers, 'siteorigin-widget' );
|
214 |
-
$name = empty( $widget['Name'] ) ? $match[1] : $widget['Name'];
|
215 |
-
$description = empty( $widget['Description'] ) ? __( 'A new widget!', 'so-widgets-bundle' ) : $widget['Description'];
|
216 |
-
?>
|
217 |
-
<p><b><?php echo esc_html( $name . ' - ' . $description) ?></b></p>
|
218 |
-
<?php
|
219 |
-
}
|
220 |
-
?>
|
221 |
-
</div>
|
222 |
-
<?php
|
223 |
-
update_option( 'siteorigin_widgets_new_widgets', array() );
|
224 |
-
}
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Setup and return the widget folders
|
228 |
-
*/
|
229 |
-
function get_widget_folders(){
|
230 |
-
if( empty($this->widget_folders) ) {
|
231 |
-
// We can use this filter to add more folders to use for widgets
|
232 |
-
$this->widget_folders = apply_filters('siteorigin_widgets_widget_folders', array(
|
233 |
-
plugin_dir_path(__FILE__) . 'widgets/'
|
234 |
-
) );
|
235 |
-
}
|
236 |
-
|
237 |
-
return $this->widget_folders;
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Load all the widgets if their plugins are not already active.
|
242 |
-
*
|
243 |
-
* @action plugins_loaded
|
244 |
-
*/
|
245 |
-
function load_widget_plugins(){
|
246 |
-
|
247 |
-
// Load all the widget we currently have active and filter them
|
248 |
-
$active_widgets = $this->get_active_widgets();
|
249 |
-
$widget_folders = $this->get_widget_folders();
|
250 |
-
|
251 |
-
foreach( $active_widgets as $widget_id => $active ) {
|
252 |
-
if( empty($active) ) continue;
|
253 |
-
|
254 |
-
foreach( $widget_folders as $folder ) {
|
255 |
-
if ( !file_exists($folder . $widget_id.'/'.$widget_id.'.php') ) continue;
|
256 |
-
|
257 |
-
// Include this widget file
|
258 |
-
include_once $folder . $widget_id.'/'.$widget_id.'.php';
|
259 |
-
}
|
260 |
-
|
261 |
-
}
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Get a list of currently active widgets.
|
266 |
-
*
|
267 |
-
* @param bool $filter
|
268 |
-
*
|
269 |
-
* @return mixed|void
|
270 |
-
*/
|
271 |
-
function get_active_widgets( $filter = true ){
|
272 |
-
// Basic caching of the current active widgets
|
273 |
-
$active_widgets = wp_cache_get( 'active_widgets', 'siteorigin_widgets' );
|
274 |
-
|
275 |
-
if( empty($active_widgets) ) {
|
276 |
-
$active_widgets = get_option( 'siteorigin_widgets_active', array() );
|
277 |
-
$active_widgets = wp_parse_args( $active_widgets, apply_filters( 'siteorigin_widgets_default_active', self::$default_active_widgets ) );
|
278 |
-
|
279 |
-
// Migrate any old names
|
280 |
-
foreach ( $active_widgets as $widget_name => $is_active ) {
|
281 |
-
if ( substr( $widget_name, 0, 3 ) !== 'so-' ) {
|
282 |
-
continue;
|
283 |
-
}
|
284 |
-
if ( preg_match( '/so-([a-z\-]+)-widget/', $widget_name, $matches ) && ! isset( $active_widgets[ $matches[1] ] ) ) {
|
285 |
-
unset( $active_widgets[ $widget_name ] );
|
286 |
-
$active_widgets[ $matches[1] ] = $is_active;
|
287 |
-
}
|
288 |
-
}
|
289 |
-
|
290 |
-
if ( $filter ) {
|
291 |
-
$active_widgets = apply_filters( 'siteorigin_widgets_active_widgets', $active_widgets );
|
292 |
-
}
|
293 |
-
|
294 |
-
wp_cache_add( 'active_widgets', $active_widgets, 'siteorigin_widgets' );
|
295 |
-
}
|
296 |
-
|
297 |
-
return $active_widgets;
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Enqueue the admin page stuff.
|
302 |
-
*/
|
303 |
-
function admin_enqueue_scripts($prefix) {
|
304 |
-
if( $prefix != 'plugins_page_so-widgets-plugins' ) return;
|
305 |
-
wp_enqueue_style( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin.css', array(), SOW_BUNDLE_VERSION );
|
306 |
-
wp_enqueue_script( 'siteorigin-widgets-trianglify', plugin_dir_url( __FILE__ ) . 'admin/trianglify' . SOW_BUNDLE_JS_SUFFIX . '.js', array(), SOW_BUNDLE_VERSION );
|
307 |
-
wp_enqueue_script( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin' . SOW_BUNDLE_JS_SUFFIX . '.js', array(), SOW_BUNDLE_VERSION );
|
308 |
-
|
309 |
-
wp_localize_script( 'siteorigin-widgets-manage-admin', 'soWidgetsAdmin', array(
|
310 |
-
'toggleUrl' => wp_nonce_url( admin_url('admin-ajax.php?action=so_widgets_bundle_manage'), 'manage_so_widget' )
|
311 |
-
) );
|
312 |
-
}
|
313 |
-
|
314 |
-
/**
|
315 |
-
* The fallback (from ajax) URL handler for activating or deactivating a widget
|
316 |
-
*/
|
317 |
-
function admin_activate_widget() {
|
318 |
-
if(
|
319 |
-
current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) )
|
320 |
-
&& !empty($_GET['page'])
|
321 |
-
&& $_GET['page'] == 'so-widgets-plugins'
|
322 |
-
&& !empty( $_GET['widget_action'] ) && !empty( $_GET['widget'] )
|
323 |
-
&& isset($_GET['_wpnonce'])
|
324 |
-
&& wp_verify_nonce($_GET['_wpnonce'], 'siteorigin_widget_action')
|
325 |
-
) {
|
326 |
-
|
327 |
-
switch($_GET['widget_action']) {
|
328 |
-
case 'activate':
|
329 |
-
$this->activate_widget( $_GET['widget'] );
|
330 |
-
break;
|
331 |
-
|
332 |
-
case 'deactivate':
|
333 |
-
$this->deactivate_widget( $_GET['widget'] );
|
334 |
-
break;
|
335 |
-
}
|
336 |
-
|
337 |
-
// Redirect and clear all the args
|
338 |
-
wp_redirect( add_query_arg( array(
|
339 |
-
'_wpnonce' => false,
|
340 |
-
'widget_action_done' => 'true',
|
341 |
-
) ) );
|
342 |
-
|
343 |
-
}
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Handler for activating and deactivating widgets.
|
348 |
-
*
|
349 |
-
* @action wp_ajax_so_widgets_bundle_manage
|
350 |
-
*/
|
351 |
-
function admin_ajax_manage_handler(){
|
352 |
-
if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'manage_so_widget' ) ) {
|
353 |
-
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
354 |
-
}
|
355 |
-
|
356 |
-
if ( ! current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) ) ) {
|
357 |
-
wp_die( __( 'Insufficient permissions.', 'so-widgets-bundle' ), 403 );
|
358 |
-
}
|
359 |
-
if ( empty( $_POST['widget'] ) ) {
|
360 |
-
wp_die( __( 'Invalid post.', 'so-widgets-bundle' ), 400 );
|
361 |
-
}
|
362 |
-
|
363 |
-
if( !empty($_POST['active']) ) $this->activate_widget($_POST['widget']);
|
364 |
-
else $this->deactivate_widget( $_POST['widget'] );
|
365 |
-
|
366 |
-
// Send a kind of dummy response.
|
367 |
-
wp_send_json( array( 'done' => true ) );
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Handler for displaying the Widget settings form.
|
372 |
-
*
|
373 |
-
* @action wp_ajax_so_widgets_setting_form
|
374 |
-
*/
|
375 |
-
function admin_ajax_settings_form(){
|
376 |
-
if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'display-widget-form' ) ) {
|
377 |
-
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
378 |
-
}
|
379 |
-
if ( ! current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) ) ) {
|
380 |
-
wp_die( __( 'Insufficient permissions.', 'so-widgets-bundle' ), 403 );
|
381 |
-
}
|
382 |
-
|
383 |
-
$widget_objects = $this->get_widget_objects();
|
384 |
-
|
385 |
-
$widget_path = empty( $_GET['id'] ) ? false : wp_normalize_path( WP_CONTENT_DIR ) . $_GET['id'];
|
386 |
-
|
387 |
-
$widget_object = empty( $widget_objects[ $widget_path ] ) ? false : $widget_objects[ $widget_path ];
|
388 |
-
|
389 |
-
if ( empty( $widget_object ) || ! $widget_object->has_form( 'settings' ) ) {
|
390 |
-
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
391 |
-
}
|
392 |
-
|
393 |
-
unset( $widget_object->widget_options['has_preview'] );
|
394 |
-
|
395 |
-
$action_url = admin_url( 'admin-ajax.php' );
|
396 |
-
$action_url = add_query_arg( array(
|
397 |
-
'id' => $_GET['id'],
|
398 |
-
'action' => 'so_widgets_setting_save',
|
399 |
-
), $action_url );
|
400 |
-
$action_url = wp_nonce_url( $action_url, 'save-widget-settings' );
|
401 |
-
|
402 |
-
$value = $widget_object->get_global_settings();
|
403 |
-
|
404 |
-
?>
|
405 |
-
<form method="post" action="<?php echo esc_url( $action_url ) ?>" target="so-widget-settings-save">
|
406 |
-
<?php $widget_object->form( $value, 'settings' ) ?>
|
407 |
-
</form>
|
408 |
-
<?php
|
409 |
-
|
410 |
-
wp_die();
|
411 |
-
}
|
412 |
-
|
413 |
-
/**
|
414 |
-
* Handler for saving the widget settings.
|
415 |
-
*
|
416 |
-
* @action wp_ajax_so_widgets_setting_save
|
417 |
-
*/
|
418 |
-
function admin_ajax_settings_save(){
|
419 |
-
if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'save-widget-settings' ) ) {
|
420 |
-
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
421 |
-
}
|
422 |
-
if ( ! current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) ) ) {
|
423 |
-
wp_die( __( 'Insufficient permissions.', 'so-widgets-bundle' ), 403 );
|
424 |
-
}
|
425 |
-
|
426 |
-
$widget_objects = $this->get_widget_objects();
|
427 |
-
$widget_path = empty( $_GET['id'] ) ? false : wp_normalize_path( WP_CONTENT_DIR ) . $_GET['id'];
|
428 |
-
$widget_object = empty( $widget_objects[ $widget_path ] ) ? false : $widget_objects[ $widget_path ];
|
429 |
-
|
430 |
-
if ( empty( $widget_object ) || ! $widget_object->has_form( 'settings' ) ) {
|
431 |
-
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
432 |
-
}
|
433 |
-
|
434 |
-
$form_values = array_shift( array_shift( array_values( $_POST ) ) );
|
435 |
-
$widget_object->save_global_settings( $form_values );
|
436 |
-
|
437 |
-
wp_send_json_success();
|
438 |
-
}
|
439 |
-
|
440 |
-
/**
|
441 |
-
* Add the admin menu page.
|
442 |
-
*
|
443 |
-
* @action admin_menu
|
444 |
-
*/
|
445 |
-
function admin_menu_init(){
|
446 |
-
add_plugins_page(
|
447 |
-
__('SiteOrigin Widgets', 'so-widgets-bundle'),
|
448 |
-
__('SiteOrigin Widgets', 'so-widgets-bundle'),
|
449 |
-
apply_filters('siteorigin_widgets_admin_menu_capability', 'manage_options'),
|
450 |
-
'so-widgets-plugins',
|
451 |
-
array($this, 'admin_page')
|
452 |
-
);
|
453 |
-
}
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Display the admin page.
|
457 |
-
*/
|
458 |
-
function admin_page(){
|
459 |
-
$widgets = $this->get_widgets_list();
|
460 |
-
$widget_objects = $this->get_widget_objects();
|
461 |
-
|
462 |
-
if(
|
463 |
-
isset($_GET['widget_action_done'])
|
464 |
-
&& !empty($_GET['widget_action'])
|
465 |
-
&& !empty($_GET['widget'])
|
466 |
-
&& !empty( $widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ] )
|
467 |
-
) {
|
468 |
-
?>
|
469 |
-
<div class="updated">
|
470 |
-
<p>
|
471 |
-
<?php
|
472 |
-
printf(
|
473 |
-
__('%s was %s', 'so-widgets-bundle'),
|
474 |
-
$widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ]['Name'],
|
475 |
-
$_GET['widget_action'] == 'activate' ? __('Activated', 'so-widgets-bundle') : __('Deactivated', 'so-widgets-bundle')
|
476 |
-
)
|
477 |
-
?>
|
478 |
-
</p>
|
479 |
-
</div>
|
480 |
-
<?php
|
481 |
-
}
|
482 |
-
|
483 |
-
// Enqueue all the admin page scripts
|
484 |
-
foreach( $widget_objects as $widget ) {
|
485 |
-
$widget->enqueue_scripts( 'settings' );
|
486 |
-
}
|
487 |
-
|
488 |
-
include plugin_dir_path(__FILE__).'admin/tpl/admin.php';
|
489 |
-
}
|
490 |
-
|
491 |
-
/**
|
492 |
-
* Get javascript variables for admin.
|
493 |
-
*/
|
494 |
-
function admin_ajax_get_javascript_variables() {
|
495 |
-
if ( empty( $_REQUEST['_widgets_nonce'] ) ||
|
496 |
-
! wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) {
|
497 |
-
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
498 |
-
}
|
499 |
-
|
500 |
-
$widget_class = $_POST['widget'];
|
501 |
-
global $wp_widget_factory;
|
502 |
-
if ( empty( $wp_widget_factory->widgets[ $widget_class ] ) ) {
|
503 |
-
wp_die( __( 'Invalid post.', 'so-widgets-bundle' ), 400 );
|
504 |
-
}
|
505 |
-
|
506 |
-
$widget = $wp_widget_factory->widgets[ $widget_class ];
|
507 |
-
if ( ! method_exists( $widget, 'get_javascript_variables' ) ) {
|
508 |
-
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
509 |
-
}
|
510 |
-
|
511 |
-
$result = $widget->get_javascript_variables();
|
512 |
-
|
513 |
-
wp_send_json( $result );
|
514 |
-
}
|
515 |
-
|
516 |
-
/**
|
517 |
-
* Activate a widget
|
518 |
-
*
|
519 |
-
* @param string $widget_id The ID of the widget that we're activating.
|
520 |
-
* @param bool $include Should we include the widget, to make it available in the current request.
|
521 |
-
*
|
522 |
-
* @return bool
|
523 |
-
*/
|
524 |
-
function activate_widget( $widget_id, $include = true ){
|
525 |
-
$exists = false;
|
526 |
-
foreach( $this->widget_folders as $folder ) {
|
527 |
-
if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
|
528 |
-
$exists = true;
|
529 |
-
}
|
530 |
-
|
531 |
-
if( !$exists ) return false;
|
532 |
-
|
533 |
-
// There are times when we activate several widgets at once, so clear the cache.
|
534 |
-
wp_cache_delete( 'siteorigin_widgets_active', 'options' );
|
535 |
-
$active_widgets = $this->get_active_widgets();
|
536 |
-
$active_widgets[$widget_id] = true;
|
537 |
-
update_option( 'siteorigin_widgets_active', $active_widgets );
|
538 |
-
wp_cache_delete( 'active_widgets', 'siteorigin_widgets' );
|
539 |
-
|
540 |
-
// If we don't want to include the widget files, then our job here is done.
|
541 |
-
if( !$include ) return;
|
542 |
-
|
543 |
-
// Now, lets actually include the files
|
544 |
-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
545 |
-
|
546 |
-
foreach( $this->widget_folders as $folder ) {
|
547 |
-
if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
|
548 |
-
include_once $folder . $widget_id . '/' . $widget_id . '.php';
|
549 |
-
|
550 |
-
if( has_action('widgets_init') ) {
|
551 |
-
SiteOrigin_Widgets_Widget_Manager::single()->widgets_init();
|
552 |
-
}
|
553 |
-
}
|
554 |
-
|
555 |
-
return true;
|
556 |
-
}
|
557 |
-
|
558 |
-
/**
|
559 |
-
* Include a widget that might not have been registered.
|
560 |
-
*
|
561 |
-
* @param $widget_id
|
562 |
-
*
|
563 |
-
* @return bool
|
564 |
-
*/
|
565 |
-
function include_widget( $widget_id ) {
|
566 |
-
$folders = $this->get_widget_folders();
|
567 |
-
|
568 |
-
foreach( $folders as $folder ) {
|
569 |
-
if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
|
570 |
-
include_once $folder . $widget_id . '/' . $widget_id . '.php';
|
571 |
-
return true;
|
572 |
-
}
|
573 |
-
|
574 |
-
return false;
|
575 |
-
}
|
576 |
-
|
577 |
-
/**
|
578 |
-
* Deactivate a widget
|
579 |
-
*
|
580 |
-
* @param $id
|
581 |
-
*/
|
582 |
-
function deactivate_widget($id){
|
583 |
-
$active_widgets = $this->get_active_widgets();
|
584 |
-
$active_widgets[$id] = false;
|
585 |
-
update_option( 'siteorigin_widgets_active', $active_widgets );
|
586 |
-
wp_cache_delete( 'active_widgets', 'siteorigin_widgets' );
|
587 |
-
}
|
588 |
-
|
589 |
-
/**
|
590 |
-
* Gets a list of all available widgets
|
591 |
-
*/
|
592 |
-
function get_widgets_list(){
|
593 |
-
$active = $this->get_active_widgets();
|
594 |
-
$folders = $this->get_widget_folders();
|
595 |
-
|
596 |
-
$default_headers = array(
|
597 |
-
'Name' => 'Widget Name',
|
598 |
-
'Description' => 'Description',
|
599 |
-
'Author' => 'Author',
|
600 |
-
'AuthorURI' => 'Author URI',
|
601 |
-
'WidgetURI' => 'Widget URI',
|
602 |
-
'VideoURI' => 'Video URI',
|
603 |
-
);
|
604 |
-
|
605 |
-
$widgets = array();
|
606 |
-
foreach( $folders as $folder ) {
|
607 |
-
|
608 |
-
$files = glob( $folder . '*/*.php' );
|
609 |
-
foreach($files as $file) {
|
610 |
-
$widget = get_file_data( $file, $default_headers, 'siteorigin-widget' );
|
611 |
-
//skip the file if it's missing a name
|
612 |
-
if ( empty( $widget['Name'] ) ) {
|
613 |
-
continue;
|
614 |
-
}
|
615 |
-
$f = pathinfo($file);
|
616 |
-
$id = $f['filename'];
|
617 |
-
|
618 |
-
$widget['ID'] = $id;
|
619 |
-
$widget['Active'] = !empty( $active[ $id ] );
|
620 |
-
$widget['File'] = $file;
|
621 |
-
|
622 |
-
$widgets[ $file ] = $widget;
|
623 |
-
}
|
624 |
-
|
625 |
-
}
|
626 |
-
|
627 |
-
// Sort the widgets alphabetically
|
628 |
-
uasort( $widgets, array($this, 'widget_uasort') );
|
629 |
-
return $widgets;
|
630 |
-
}
|
631 |
-
|
632 |
-
/**
|
633 |
-
* Get instances of all the widgets. Even ones that are not active.
|
634 |
-
*/
|
635 |
-
private function get_widget_objects(){
|
636 |
-
$folders = $this->get_widget_folders();
|
637 |
-
|
638 |
-
$widgets = array();
|
639 |
-
$manager = SiteOrigin_Widgets_Widget_Manager::single();
|
640 |
-
|
641 |
-
foreach( $folders as $folder ) {
|
642 |
-
|
643 |
-
$files = glob( wp_normalize_path( $folder ) . '*/*.php' );
|
644 |
-
foreach ($files as $file) {
|
645 |
-
$file = wp_normalize_path( $file );
|
646 |
-
include_once $file;
|
647 |
-
|
648 |
-
$widget_class = $manager->get_class_from_path( $file );
|
649 |
-
|
650 |
-
if( $widget_class && class_exists( $widget_class ) ) {
|
651 |
-
$widgets[ $file ] = new $widget_class();
|
652 |
-
}
|
653 |
-
}
|
654 |
-
}
|
655 |
-
|
656 |
-
return $widgets;
|
657 |
-
}
|
658 |
-
|
659 |
-
/**
|
660 |
-
* Sorting function to sort widgets by name
|
661 |
-
*
|
662 |
-
* @param $widget_a
|
663 |
-
* @param $widget_b
|
664 |
-
*
|
665 |
-
* @return int
|
666 |
-
*/
|
667 |
-
function widget_uasort($widget_a, $widget_b) {
|
668 |
-
return $widget_a['Name'] > $widget_b['Name'] ? 1 : -1;
|
669 |
-
}
|
670 |
-
|
671 |
-
/**
|
672 |
-
* Look in Page Builder data for any missing widgets.
|
673 |
-
*
|
674 |
-
* @param $data
|
675 |
-
*
|
676 |
-
* @return mixed
|
677 |
-
*
|
678 |
-
* @action siteorigin_panels_data
|
679 |
-
*/
|
680 |
-
function load_missing_widgets( $data ){
|
681 |
-
if(empty($data['widgets'])) return $data;
|
682 |
-
|
683 |
-
global $wp_widget_factory;
|
684 |
-
|
685 |
-
foreach($data['widgets'] as $widget) {
|
686 |
-
if( empty( $widget['panels_info']['class'] ) ) continue;
|
687 |
-
if( !empty( $wp_widget_factory->widgets[ $widget['panels_info']['class'] ] ) ) continue;
|
688 |
-
|
689 |
-
$this->load_missing_widget( false, $widget['panels_info']['class'] );
|
690 |
-
}
|
691 |
-
|
692 |
-
return $data;
|
693 |
-
}
|
694 |
-
|
695 |
-
/**
|
696 |
-
* Attempt to load a single missing widget.
|
697 |
-
*
|
698 |
-
* @param $the_widget
|
699 |
-
* @param $class
|
700 |
-
*
|
701 |
-
* @return
|
702 |
-
*/
|
703 |
-
function load_missing_widget( $the_widget, $class ){
|
704 |
-
// We only want to worry about missing widgets
|
705 |
-
if( ! empty( $the_widget ) ) return $the_widget;
|
706 |
-
|
707 |
-
if( preg_match('/SiteOrigin_Widgets?_([A-Za-z]+)_Widget/', $class, $matches) ) {
|
708 |
-
$name = $matches[1];
|
709 |
-
$id = strtolower( implode( '-', array_filter( preg_split( '/(?=[A-Z])/', $name ) ) ) );
|
710 |
-
|
711 |
-
if( $id == 'contact-form' ) {
|
712 |
-
// Handle the special case of the contact form widget, which is incorrectly named
|
713 |
-
$id = 'contact';
|
714 |
-
}
|
715 |
-
|
716 |
-
$this->activate_widget($id, true);
|
717 |
-
global $wp_widget_factory;
|
718 |
-
if( !empty($wp_widget_factory->widgets[$class]) ) return $wp_widget_factory->widgets[$class];
|
719 |
-
}
|
720 |
-
|
721 |
-
return $the_widget;
|
722 |
-
}
|
723 |
-
|
724 |
-
/**
|
725 |
-
* Add action links.
|
726 |
-
*/
|
727 |
-
function plugin_action_links($links){
|
728 |
-
unset( $links['edit'] );
|
729 |
-
$links['manage'] = '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">'.__('Manage Widgets', 'so-widgets-bundle').'</a>';
|
730 |
-
$links['support'] = '<a href="https://siteorigin.com/thread/" target="_blank" rel="noopener noreferrer">'.__('Support', 'so-widgets-bundle').'</a>';
|
731 |
-
return $links;
|
732 |
-
}
|
733 |
-
|
734 |
-
function register_general_scripts() {
|
735 |
-
wp_register_script( 'sow-fittext',
|
736 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/sow.jquery.fittext' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
737 |
-
array( 'jquery' ),
|
738 |
-
'1.2',
|
739 |
-
true
|
740 |
-
);
|
741 |
-
wp_register_script(
|
742 |
-
'dessandro-imagesLoaded',
|
743 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/lib/imagesloaded.pkgd' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
744 |
-
array( 'jquery' ),
|
745 |
-
'3.2.0',
|
746 |
-
true
|
747 |
-
);
|
748 |
-
wp_register_script(
|
749 |
-
'dessandro-packery',
|
750 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/lib/packery.pkgd' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
751 |
-
array( 'jquery' ),
|
752 |
-
'1.4.3',
|
753 |
-
true
|
754 |
-
);
|
755 |
-
wp_register_script(
|
756 |
-
'sow-google-map',
|
757 |
-
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/sow.google.map' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
758 |
-
array( 'jquery' ),
|
759 |
-
SOW_BUNDLE_VERSION
|
760 |
-
);
|
761 |
-
}
|
762 |
-
|
763 |
-
/**
|
764 |
-
* Ensure active widgets' scripts are enqueued at the right time.
|
765 |
-
*/
|
766 |
-
function enqueue_active_widgets_scripts() {
|
767 |
-
global $wp_registered_widgets;
|
768 |
-
$sidebars_widgets = wp_get_sidebars_widgets();
|
769 |
-
if( empty($sidebars_widgets) ) return;
|
770 |
-
foreach( $sidebars_widgets as $sidebar => $widgets ) {
|
771 |
-
if ( ! empty( $widgets ) && $sidebar !== "wp_inactive_widgets") {
|
772 |
-
foreach ( $widgets as $i => $id ) {
|
773 |
-
if ( ! empty( $wp_registered_widgets[$id] ) ) {
|
774 |
-
$widget = $wp_registered_widgets[$id]['callback'][0];
|
775 |
-
if ( !empty($widget) && is_object($widget) && is_subclass_of($widget, 'SiteOrigin_Widget') && is_active_widget( false, false, $widget->id_base ) ) {
|
776 |
-
/* @var $widget SiteOrigin_Widget */
|
777 |
-
$opt_wid = get_option( 'widget_' . $widget->id_base );
|
778 |
-
preg_match( '/-([0-9]+$)/', $id, $num_match );
|
779 |
-
$widget_instance = $opt_wid[ $num_match[1] ];
|
780 |
-
$widget->enqueue_frontend_scripts( $widget_instance);
|
781 |
-
$widget->generate_and_enqueue_instance_styles( $widget_instance );
|
782 |
-
}
|
783 |
-
}
|
784 |
-
}
|
785 |
-
}
|
786 |
-
}
|
787 |
-
}
|
788 |
-
}
|
789 |
-
|
790 |
-
// create the initial single
|
791 |
-
SiteOrigin_Widgets_Bundle::single();
|
792 |
-
|
793 |
-
// Initialize the Meta Box Manager
|
794 |
-
global $sow_meta_box_manager;
|
795 |
-
$sow_meta_box_manager = SiteOrigin_Widget_Meta_Box_Manager::single();
|
1 |
+
<?php
|
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.11.4
|
6 |
+
Text Domain: so-widgets-bundle
|
7 |
+
Domain Path: /lang
|
8 |
+
Author: SiteOrigin
|
9 |
+
Author URI: https://siteorigin.com
|
10 |
+
Plugin URI: https://siteorigin.com/widgets-bundle/
|
11 |
+
License: GPL3
|
12 |
+
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
+
*/
|
14 |
+
|
15 |
+
define('SOW_BUNDLE_VERSION', '1.11.4');
|
16 |
+
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
+
|
18 |
+
// Allow JS suffix to be pre-set
|
19 |
+
if( !defined( 'SOW_BUNDLE_JS_SUFFIX' ) ) {
|
20 |
+
define('SOW_BUNDLE_JS_SUFFIX', '.min');
|
21 |
+
}
|
22 |
+
|
23 |
+
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 |
+
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 |
+
|
33 |
+
private $widget_folders;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var array The array of default widgets.
|
37 |
+
*/
|
38 |
+
static $default_active_widgets = array(
|
39 |
+
'button' => true,
|
40 |
+
'google-map' => true,
|
41 |
+
'image' => true,
|
42 |
+
'slider' => true,
|
43 |
+
'post-carousel' => true,
|
44 |
+
'editor' => true,
|
45 |
+
);
|
46 |
+
|
47 |
+
function __construct(){
|
48 |
+
add_action('admin_init', array($this, 'admin_activate_widget') );
|
49 |
+
add_action('admin_menu', array($this, 'admin_menu_init') );
|
50 |
+
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts') );
|
51 |
+
|
52 |
+
// All the ajax actions
|
53 |
+
add_action('wp_ajax_so_widgets_bundle_manage', array($this, 'admin_ajax_manage_handler') );
|
54 |
+
add_action('wp_ajax_sow_get_javascript_variables', array($this, 'admin_ajax_get_javascript_variables') );
|
55 |
+
|
56 |
+
add_action('wp_ajax_so_widgets_setting_form', array($this, 'admin_ajax_settings_form') );
|
57 |
+
add_action('wp_ajax_so_widgets_setting_save', array($this, 'admin_ajax_settings_save') );
|
58 |
+
|
59 |
+
// Initialize the widgets, but do it fairly late
|
60 |
+
add_action( 'plugins_loaded', array($this, 'set_plugin_textdomain'), 1 );
|
61 |
+
add_action( 'after_setup_theme', array($this, 'get_widget_folders'), 11 );
|
62 |
+
add_action( 'after_setup_theme', array($this, 'load_widget_plugins'), 11 );
|
63 |
+
|
64 |
+
// Add the plugin_action_links links.
|
65 |
+
add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links') );
|
66 |
+
|
67 |
+
add_action( 'admin_init', array($this, 'plugin_version_check') );
|
68 |
+
add_action( 'siteorigin_widgets_version_update', array( $this, 'handle_update' ), 10, 2 );
|
69 |
+
add_action( 'admin_notices', array( $this, 'display_admin_notices') );
|
70 |
+
|
71 |
+
// Actions for clearing widget cache
|
72 |
+
add_action( 'switch_theme', array($this, 'clear_widget_cache') );
|
73 |
+
add_action( 'activated_plugin', array($this, 'clear_widget_cache') );
|
74 |
+
add_action( 'upgrader_process_complete', array($this, 'clear_widget_cache') );
|
75 |
+
|
76 |
+
// These filters are used to activate any widgets that are missing.
|
77 |
+
add_filter( 'siteorigin_panels_data', array($this, 'load_missing_widgets') );
|
78 |
+
add_filter( 'siteorigin_panels_prebuilt_layout', array($this, 'load_missing_widgets') );
|
79 |
+
add_filter( 'siteorigin_panels_widget_object', array($this, 'load_missing_widget'), 10, 2 );
|
80 |
+
|
81 |
+
add_filter( 'wp_enqueue_scripts', array($this, 'register_general_scripts') );
|
82 |
+
add_filter( 'wp_enqueue_scripts', array($this, 'enqueue_active_widgets_scripts') );
|
83 |
+
|
84 |
+
// This is a temporary filter to disable the new Jetpack Grunion contact form editor.
|
85 |
+
add_filter( 'tmp_grunion_allow_editor_view', '__return_false' );
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Get the single of this plugin
|
90 |
+
*
|
91 |
+
* @return SiteOrigin_Widgets_Bundle
|
92 |
+
*/
|
93 |
+
static function single() {
|
94 |
+
static $single;
|
95 |
+
|
96 |
+
if( empty($single) ) {
|
97 |
+
$single = new SiteOrigin_Widgets_Bundle();
|
98 |
+
}
|
99 |
+
|
100 |
+
return $single;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Set the text domain for the plugin
|
105 |
+
*
|
106 |
+
* @action plugins_loaded
|
107 |
+
*/
|
108 |
+
function set_plugin_textdomain(){
|
109 |
+
load_plugin_textdomain('so-widgets-bundle', false, dirname( plugin_basename( __FILE__ ) ). '/lang/');
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* This clears the file cache.
|
114 |
+
*
|
115 |
+
* @action admin_init
|
116 |
+
*/
|
117 |
+
function plugin_version_check(){
|
118 |
+
|
119 |
+
$active_version = get_option( 'siteorigin_widget_bundle_version' );
|
120 |
+
|
121 |
+
$is_new = empty($active_version) || version_compare( $active_version, SOW_BUNDLE_VERSION, '<' );
|
122 |
+
$is_new = apply_filters( 'siteorigin_widgets_is_new_version', $is_new );
|
123 |
+
|
124 |
+
if( $is_new ) {
|
125 |
+
|
126 |
+
update_option( 'siteorigin_widget_bundle_version', SOW_BUNDLE_VERSION );
|
127 |
+
// If this is a new version, then trigger an action to let widgets handle the updates.
|
128 |
+
do_action( 'siteorigin_widgets_version_update', SOW_BUNDLE_VERSION, $active_version );
|
129 |
+
$this->clear_widget_cache();
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* This should call any necessary functions when the plugin has been updated.
|
136 |
+
*
|
137 |
+
* @action siteorigin_widgets_version_update
|
138 |
+
*/
|
139 |
+
function handle_update($old_version, $new_version) {
|
140 |
+
//Always check for new widgets.
|
141 |
+
$this->check_for_new_widgets();
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Deletes any CSS generated by/for the widgets.
|
146 |
+
* Called on 'upgrader_process_complete', 'switch_theme', and 'activated_plugin' actions.
|
147 |
+
* Can also be called directly on the `SiteOrigin_Widgets_Bundle` singleton class.
|
148 |
+
*
|
149 |
+
* @action upgrader_process_complete Occurs after any theme, plugin or the WordPress core is updated to a new version.
|
150 |
+
* @action switch_theme Occurs after switching to a different theme.
|
151 |
+
* @action activated_plugin Occurs after a plugin has been activated.
|
152 |
+
*
|
153 |
+
*/
|
154 |
+
function clear_widget_cache() {
|
155 |
+
// Remove all cached CSS for SiteOrigin Widgets
|
156 |
+
if( function_exists('WP_Filesystem') && WP_Filesystem() ) {
|
157 |
+
global $wp_filesystem;
|
158 |
+
$upload_dir = wp_upload_dir();
|
159 |
+
|
160 |
+
// Remove any old widget cache files, if they exist.
|
161 |
+
$list = $wp_filesystem->dirlist( $upload_dir['basedir'] . '/siteorigin-widgets/' );
|
162 |
+
if( !empty($list) ) {
|
163 |
+
foreach($list as $file) {
|
164 |
+
// Delete the file
|
165 |
+
$wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $file['name'] );
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Setup and return the widget folders
|
173 |
+
*/
|
174 |
+
function check_for_new_widgets() {
|
175 |
+
// get list of available widgets
|
176 |
+
$widgets = array_keys( $this->get_widgets_list() );
|
177 |
+
// get option for previously installed widgets
|
178 |
+
$old_widgets = get_option( 'siteorigin_widgets_old_widgets' );
|
179 |
+
// if this has never been set before, it's probably a new installation so we don't want to notify for all the widgets
|
180 |
+
if ( empty( $old_widgets ) ) {
|
181 |
+
update_option( 'siteorigin_widgets_old_widgets', implode( ',', $widgets ) );
|
182 |
+
return;
|
183 |
+
}
|
184 |
+
$old_widgets = explode( ',', $old_widgets );
|
185 |
+
$new_widgets = array_diff( $widgets, $old_widgets );
|
186 |
+
if ( ! empty( $new_widgets ) ) {
|
187 |
+
update_option( 'siteorigin_widgets_new_widgets', $new_widgets );
|
188 |
+
update_option( 'siteorigin_widgets_old_widgets', implode( ',', $widgets ) );
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
function display_admin_notices() {
|
193 |
+
$new_widgets = get_option( 'siteorigin_widgets_new_widgets' );
|
194 |
+
if ( empty( $new_widgets ) ) {
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
?>
|
198 |
+
<div class="updated">
|
199 |
+
<p><?php echo __( 'New widgets available in the ') . '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">' . __('SiteOrigin Widgets Bundle', 'so-widgets-bundle' ) . '</a>!'; ?></p>
|
200 |
+
<?php
|
201 |
+
|
202 |
+
$default_headers = array(
|
203 |
+
'Name' => 'Widget Name',
|
204 |
+
'Description' => 'Description',
|
205 |
+
'Author' => 'Author',
|
206 |
+
'AuthorURI' => 'Author URI',
|
207 |
+
'WidgetURI' => 'Widget URI',
|
208 |
+
'VideoURI' => 'Video URI',
|
209 |
+
);
|
210 |
+
|
211 |
+
foreach ( $new_widgets as $widget_file_path ) {
|
212 |
+
preg_match( '/.*[\/\\\\](.*).php/', $widget_file_path, $match );
|
213 |
+
$widget = get_file_data( $widget_file_path, $default_headers, 'siteorigin-widget' );
|
214 |
+
$name = empty( $widget['Name'] ) ? $match[1] : $widget['Name'];
|
215 |
+
$description = empty( $widget['Description'] ) ? __( 'A new widget!', 'so-widgets-bundle' ) : $widget['Description'];
|
216 |
+
?>
|
217 |
+
<p><b><?php echo esc_html( $name . ' - ' . $description) ?></b></p>
|
218 |
+
<?php
|
219 |
+
}
|
220 |
+
?>
|
221 |
+
</div>
|
222 |
+
<?php
|
223 |
+
update_option( 'siteorigin_widgets_new_widgets', array() );
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Setup and return the widget folders
|
228 |
+
*/
|
229 |
+
function get_widget_folders(){
|
230 |
+
if( empty($this->widget_folders) ) {
|
231 |
+
// We can use this filter to add more folders to use for widgets
|
232 |
+
$this->widget_folders = apply_filters('siteorigin_widgets_widget_folders', array(
|
233 |
+
plugin_dir_path(__FILE__) . 'widgets/'
|
234 |
+
) );
|
235 |
+
}
|
236 |
+
|
237 |
+
return $this->widget_folders;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Load all the widgets if their plugins are not already active.
|
242 |
+
*
|
243 |
+
* @action plugins_loaded
|
244 |
+
*/
|
245 |
+
function load_widget_plugins(){
|
246 |
+
|
247 |
+
// Load all the widget we currently have active and filter them
|
248 |
+
$active_widgets = $this->get_active_widgets();
|
249 |
+
$widget_folders = $this->get_widget_folders();
|
250 |
+
|
251 |
+
foreach( $active_widgets as $widget_id => $active ) {
|
252 |
+
if( empty($active) ) continue;
|
253 |
+
|
254 |
+
foreach( $widget_folders as $folder ) {
|
255 |
+
if ( !file_exists($folder . $widget_id.'/'.$widget_id.'.php') ) continue;
|
256 |
+
|
257 |
+
// Include this widget file
|
258 |
+
include_once $folder . $widget_id.'/'.$widget_id.'.php';
|
259 |
+
}
|
260 |
+
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Get a list of currently active widgets.
|
266 |
+
*
|
267 |
+
* @param bool $filter
|
268 |
+
*
|
269 |
+
* @return mixed|void
|
270 |
+
*/
|
271 |
+
function get_active_widgets( $filter = true ){
|
272 |
+
// Basic caching of the current active widgets
|
273 |
+
$active_widgets = wp_cache_get( 'active_widgets', 'siteorigin_widgets' );
|
274 |
+
|
275 |
+
if( empty($active_widgets) ) {
|
276 |
+
$active_widgets = get_option( 'siteorigin_widgets_active', array() );
|
277 |
+
$active_widgets = wp_parse_args( $active_widgets, apply_filters( 'siteorigin_widgets_default_active', self::$default_active_widgets ) );
|
278 |
+
|
279 |
+
// Migrate any old names
|
280 |
+
foreach ( $active_widgets as $widget_name => $is_active ) {
|
281 |
+
if ( substr( $widget_name, 0, 3 ) !== 'so-' ) {
|
282 |
+
continue;
|
283 |
+
}
|
284 |
+
if ( preg_match( '/so-([a-z\-]+)-widget/', $widget_name, $matches ) && ! isset( $active_widgets[ $matches[1] ] ) ) {
|
285 |
+
unset( $active_widgets[ $widget_name ] );
|
286 |
+
$active_widgets[ $matches[1] ] = $is_active;
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
if ( $filter ) {
|
291 |
+
$active_widgets = apply_filters( 'siteorigin_widgets_active_widgets', $active_widgets );
|
292 |
+
}
|
293 |
+
|
294 |
+
wp_cache_add( 'active_widgets', $active_widgets, 'siteorigin_widgets' );
|
295 |
+
}
|
296 |
+
|
297 |
+
return $active_widgets;
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Enqueue the admin page stuff.
|
302 |
+
*/
|
303 |
+
function admin_enqueue_scripts($prefix) {
|
304 |
+
if( $prefix != 'plugins_page_so-widgets-plugins' ) return;
|
305 |
+
wp_enqueue_style( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin.css', array(), SOW_BUNDLE_VERSION );
|
306 |
+
wp_enqueue_script( 'siteorigin-widgets-trianglify', plugin_dir_url( __FILE__ ) . 'admin/trianglify' . SOW_BUNDLE_JS_SUFFIX . '.js', array(), SOW_BUNDLE_VERSION );
|
307 |
+
wp_enqueue_script( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin' . SOW_BUNDLE_JS_SUFFIX . '.js', array(), SOW_BUNDLE_VERSION );
|
308 |
+
|
309 |
+
wp_localize_script( 'siteorigin-widgets-manage-admin', 'soWidgetsAdmin', array(
|
310 |
+
'toggleUrl' => wp_nonce_url( admin_url('admin-ajax.php?action=so_widgets_bundle_manage'), 'manage_so_widget' )
|
311 |
+
) );
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* The fallback (from ajax) URL handler for activating or deactivating a widget
|
316 |
+
*/
|
317 |
+
function admin_activate_widget() {
|
318 |
+
if(
|
319 |
+
current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) )
|
320 |
+
&& !empty($_GET['page'])
|
321 |
+
&& $_GET['page'] == 'so-widgets-plugins'
|
322 |
+
&& !empty( $_GET['widget_action'] ) && !empty( $_GET['widget'] )
|
323 |
+
&& isset($_GET['_wpnonce'])
|
324 |
+
&& wp_verify_nonce($_GET['_wpnonce'], 'siteorigin_widget_action')
|
325 |
+
) {
|
326 |
+
|
327 |
+
switch($_GET['widget_action']) {
|
328 |
+
case 'activate':
|
329 |
+
$this->activate_widget( $_GET['widget'] );
|
330 |
+
break;
|
331 |
+
|
332 |
+
case 'deactivate':
|
333 |
+
$this->deactivate_widget( $_GET['widget'] );
|
334 |
+
break;
|
335 |
+
}
|
336 |
+
|
337 |
+
// Redirect and clear all the args
|
338 |
+
wp_redirect( add_query_arg( array(
|
339 |
+
'_wpnonce' => false,
|
340 |
+
'widget_action_done' => 'true',
|
341 |
+
) ) );
|
342 |
+
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Handler for activating and deactivating widgets.
|
348 |
+
*
|
349 |
+
* @action wp_ajax_so_widgets_bundle_manage
|
350 |
+
*/
|
351 |
+
function admin_ajax_manage_handler(){
|
352 |
+
if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'manage_so_widget' ) ) {
|
353 |
+
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
354 |
+
}
|
355 |
+
|
356 |
+
if ( ! current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) ) ) {
|
357 |
+
wp_die( __( 'Insufficient permissions.', 'so-widgets-bundle' ), 403 );
|
358 |
+
}
|
359 |
+
if ( empty( $_POST['widget'] ) ) {
|
360 |
+
wp_die( __( 'Invalid post.', 'so-widgets-bundle' ), 400 );
|
361 |
+
}
|
362 |
+
|
363 |
+
if( !empty($_POST['active']) ) $this->activate_widget($_POST['widget']);
|
364 |
+
else $this->deactivate_widget( $_POST['widget'] );
|
365 |
+
|
366 |
+
// Send a kind of dummy response.
|
367 |
+
wp_send_json( array( 'done' => true ) );
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Handler for displaying the Widget settings form.
|
372 |
+
*
|
373 |
+
* @action wp_ajax_so_widgets_setting_form
|
374 |
+
*/
|
375 |
+
function admin_ajax_settings_form(){
|
376 |
+
if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'display-widget-form' ) ) {
|
377 |
+
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
378 |
+
}
|
379 |
+
if ( ! current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) ) ) {
|
380 |
+
wp_die( __( 'Insufficient permissions.', 'so-widgets-bundle' ), 403 );
|
381 |
+
}
|
382 |
+
|
383 |
+
$widget_objects = $this->get_widget_objects();
|
384 |
+
|
385 |
+
$widget_path = empty( $_GET['id'] ) ? false : wp_normalize_path( WP_CONTENT_DIR ) . $_GET['id'];
|
386 |
+
|
387 |
+
$widget_object = empty( $widget_objects[ $widget_path ] ) ? false : $widget_objects[ $widget_path ];
|
388 |
+
|
389 |
+
if ( empty( $widget_object ) || ! $widget_object->has_form( 'settings' ) ) {
|
390 |
+
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
391 |
+
}
|
392 |
+
|
393 |
+
unset( $widget_object->widget_options['has_preview'] );
|
394 |
+
|
395 |
+
$action_url = admin_url( 'admin-ajax.php' );
|
396 |
+
$action_url = add_query_arg( array(
|
397 |
+
'id' => $_GET['id'],
|
398 |
+
'action' => 'so_widgets_setting_save',
|
399 |
+
), $action_url );
|
400 |
+
$action_url = wp_nonce_url( $action_url, 'save-widget-settings' );
|
401 |
+
|
402 |
+
$value = $widget_object->get_global_settings();
|
403 |
+
|
404 |
+
?>
|
405 |
+
<form method="post" action="<?php echo esc_url( $action_url ) ?>" target="so-widget-settings-save">
|
406 |
+
<?php $widget_object->form( $value, 'settings' ) ?>
|
407 |
+
</form>
|
408 |
+
<?php
|
409 |
+
|
410 |
+
wp_die();
|
411 |
+
}
|
412 |
+
|
413 |
+
/**
|
414 |
+
* Handler for saving the widget settings.
|
415 |
+
*
|
416 |
+
* @action wp_ajax_so_widgets_setting_save
|
417 |
+
*/
|
418 |
+
function admin_ajax_settings_save(){
|
419 |
+
if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'save-widget-settings' ) ) {
|
420 |
+
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
421 |
+
}
|
422 |
+
if ( ! current_user_can( apply_filters( 'siteorigin_widgets_admin_menu_capability', 'manage_options' ) ) ) {
|
423 |
+
wp_die( __( 'Insufficient permissions.', 'so-widgets-bundle' ), 403 );
|
424 |
+
}
|
425 |
+
|
426 |
+
$widget_objects = $this->get_widget_objects();
|
427 |
+
$widget_path = empty( $_GET['id'] ) ? false : wp_normalize_path( WP_CONTENT_DIR ) . $_GET['id'];
|
428 |
+
$widget_object = empty( $widget_objects[ $widget_path ] ) ? false : $widget_objects[ $widget_path ];
|
429 |
+
|
430 |
+
if ( empty( $widget_object ) || ! $widget_object->has_form( 'settings' ) ) {
|
431 |
+
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
432 |
+
}
|
433 |
+
|
434 |
+
$form_values = array_shift( array_shift( array_values( $_POST ) ) );
|
435 |
+
$widget_object->save_global_settings( $form_values );
|
436 |
+
|
437 |
+
wp_send_json_success();
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Add the admin menu page.
|
442 |
+
*
|
443 |
+
* @action admin_menu
|
444 |
+
*/
|
445 |
+
function admin_menu_init(){
|
446 |
+
add_plugins_page(
|
447 |
+
__('SiteOrigin Widgets', 'so-widgets-bundle'),
|
448 |
+
__('SiteOrigin Widgets', 'so-widgets-bundle'),
|
449 |
+
apply_filters('siteorigin_widgets_admin_menu_capability', 'manage_options'),
|
450 |
+
'so-widgets-plugins',
|
451 |
+
array($this, 'admin_page')
|
452 |
+
);
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Display the admin page.
|
457 |
+
*/
|
458 |
+
function admin_page(){
|
459 |
+
$widgets = $this->get_widgets_list();
|
460 |
+
$widget_objects = $this->get_widget_objects();
|
461 |
+
|
462 |
+
if(
|
463 |
+
isset($_GET['widget_action_done'])
|
464 |
+
&& !empty($_GET['widget_action'])
|
465 |
+
&& !empty($_GET['widget'])
|
466 |
+
&& !empty( $widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ] )
|
467 |
+
) {
|
468 |
+
?>
|
469 |
+
<div class="updated">
|
470 |
+
<p>
|
471 |
+
<?php
|
472 |
+
printf(
|
473 |
+
__('%s was %s', 'so-widgets-bundle'),
|
474 |
+
$widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ]['Name'],
|
475 |
+
$_GET['widget_action'] == 'activate' ? __('Activated', 'so-widgets-bundle') : __('Deactivated', 'so-widgets-bundle')
|
476 |
+
)
|
477 |
+
?>
|
478 |
+
</p>
|
479 |
+
</div>
|
480 |
+
<?php
|
481 |
+
}
|
482 |
+
|
483 |
+
// Enqueue all the admin page scripts
|
484 |
+
foreach( $widget_objects as $widget ) {
|
485 |
+
$widget->enqueue_scripts( 'settings' );
|
486 |
+
}
|
487 |
+
|
488 |
+
include plugin_dir_path(__FILE__).'admin/tpl/admin.php';
|
489 |
+
}
|
490 |
+
|
491 |
+
/**
|
492 |
+
* Get javascript variables for admin.
|
493 |
+
*/
|
494 |
+
function admin_ajax_get_javascript_variables() {
|
495 |
+
if ( empty( $_REQUEST['_widgets_nonce'] ) ||
|
496 |
+
! wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) {
|
497 |
+
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 403 );
|
498 |
+
}
|
499 |
+
|
500 |
+
$widget_class = $_POST['widget'];
|
501 |
+
global $wp_widget_factory;
|
502 |
+
if ( empty( $wp_widget_factory->widgets[ $widget_class ] ) ) {
|
503 |
+
wp_die( __( 'Invalid post.', 'so-widgets-bundle' ), 400 );
|
504 |
+
}
|
505 |
+
|
506 |
+
$widget = $wp_widget_factory->widgets[ $widget_class ];
|
507 |
+
if ( ! method_exists( $widget, 'get_javascript_variables' ) ) {
|
508 |
+
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
509 |
+
}
|
510 |
+
|
511 |
+
$result = $widget->get_javascript_variables();
|
512 |
+
|
513 |
+
wp_send_json( $result );
|
514 |
+
}
|
515 |
+
|
516 |
+
/**
|
517 |
+
* Activate a widget
|
518 |
+
*
|
519 |
+
* @param string $widget_id The ID of the widget that we're activating.
|
520 |
+
* @param bool $include Should we include the widget, to make it available in the current request.
|
521 |
+
*
|
522 |
+
* @return bool
|
523 |
+
*/
|
524 |
+
function activate_widget( $widget_id, $include = true ){
|
525 |
+
$exists = false;
|
526 |
+
foreach( $this->widget_folders as $folder ) {
|
527 |
+
if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
|
528 |
+
$exists = true;
|
529 |
+
}
|
530 |
+
|
531 |
+
if( !$exists ) return false;
|
532 |
+
|
533 |
+
// There are times when we activate several widgets at once, so clear the cache.
|
534 |
+
wp_cache_delete( 'siteorigin_widgets_active', 'options' );
|
535 |
+
$active_widgets = $this->get_active_widgets();
|
536 |
+
$active_widgets[$widget_id] = true;
|
537 |
+
update_option( 'siteorigin_widgets_active', $active_widgets );
|
538 |
+
wp_cache_delete( 'active_widgets', 'siteorigin_widgets' );
|
539 |
+
|
540 |
+
// If we don't want to include the widget files, then our job here is done.
|
541 |
+
if( !$include ) return;
|
542 |
+
|
543 |
+
// Now, lets actually include the files
|
544 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
545 |
+
|
546 |
+
foreach( $this->widget_folders as $folder ) {
|
547 |
+
if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
|
548 |
+
include_once $folder . $widget_id . '/' . $widget_id . '.php';
|
549 |
+
|
550 |
+
if( has_action('widgets_init') ) {
|
551 |
+
SiteOrigin_Widgets_Widget_Manager::single()->widgets_init();
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
return true;
|
556 |
+
}
|
557 |
+
|
558 |
+
/**
|
559 |
+
* Include a widget that might not have been registered.
|
560 |
+
*
|
561 |
+
* @param $widget_id
|
562 |
+
*
|
563 |
+
* @return bool
|
564 |
+
*/
|
565 |
+
function include_widget( $widget_id ) {
|
566 |
+
$folders = $this->get_widget_folders();
|
567 |
+
|
568 |
+
foreach( $folders as $folder ) {
|
569 |
+
if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
|
570 |
+
include_once $folder . $widget_id . '/' . $widget_id . '.php';
|
571 |
+
return true;
|
572 |
+
}
|
573 |
+
|
574 |
+
return false;
|
575 |
+
}
|
576 |
+
|
577 |
+
/**
|
578 |
+
* Deactivate a widget
|
579 |
+
*
|
580 |
+
* @param $id
|
581 |
+
*/
|
582 |
+
function deactivate_widget($id){
|
583 |
+
$active_widgets = $this->get_active_widgets();
|
584 |
+
$active_widgets[$id] = false;
|
585 |
+
update_option( 'siteorigin_widgets_active', $active_widgets );
|
586 |
+
wp_cache_delete( 'active_widgets', 'siteorigin_widgets' );
|
587 |
+
}
|
588 |
+
|
589 |
+
/**
|
590 |
+
* Gets a list of all available widgets
|
591 |
+
*/
|
592 |
+
function get_widgets_list(){
|
593 |
+
$active = $this->get_active_widgets();
|
594 |
+
$folders = $this->get_widget_folders();
|
595 |
+
|
596 |
+
$default_headers = array(
|
597 |
+
'Name' => 'Widget Name',
|
598 |
+
'Description' => 'Description',
|
599 |
+
'Author' => 'Author',
|
600 |
+
'AuthorURI' => 'Author URI',
|
601 |
+
'WidgetURI' => 'Widget URI',
|
602 |
+
'VideoURI' => 'Video URI',
|
603 |
+
);
|
604 |
+
|
605 |
+
$widgets = array();
|
606 |
+
foreach( $folders as $folder ) {
|
607 |
+
|
608 |
+
$files = glob( $folder . '*/*.php' );
|
609 |
+
foreach($files as $file) {
|
610 |
+
$widget = get_file_data( $file, $default_headers, 'siteorigin-widget' );
|
611 |
+
//skip the file if it's missing a name
|
612 |
+
if ( empty( $widget['Name'] ) ) {
|
613 |
+
continue;
|
614 |
+
}
|
615 |
+
$f = pathinfo($file);
|
616 |
+
$id = $f['filename'];
|
617 |
+
|
618 |
+
$widget['ID'] = $id;
|
619 |
+
$widget['Active'] = !empty( $active[ $id ] );
|
620 |
+
$widget['File'] = $file;
|
621 |
+
|
622 |
+
$widgets[ $file ] = $widget;
|
623 |
+
}
|
624 |
+
|
625 |
+
}
|
626 |
+
|
627 |
+
// Sort the widgets alphabetically
|
628 |
+
uasort( $widgets, array($this, 'widget_uasort') );
|
629 |
+
return $widgets;
|
630 |
+
}
|
631 |
+
|
632 |
+
/**
|
633 |
+
* Get instances of all the widgets. Even ones that are not active.
|
634 |
+
*/
|
635 |
+
private function get_widget_objects(){
|
636 |
+
$folders = $this->get_widget_folders();
|
637 |
+
|
638 |
+
$widgets = array();
|
639 |
+
$manager = SiteOrigin_Widgets_Widget_Manager::single();
|
640 |
+
|
641 |
+
foreach( $folders as $folder ) {
|
642 |
+
|
643 |
+
$files = glob( wp_normalize_path( $folder ) . '*/*.php' );
|
644 |
+
foreach ($files as $file) {
|
645 |
+
$file = wp_normalize_path( $file );
|
646 |
+
include_once $file;
|
647 |
+
|
648 |
+
$widget_class = $manager->get_class_from_path( $file );
|
649 |
+
|
650 |
+
if( $widget_class && class_exists( $widget_class ) ) {
|
651 |
+
$widgets[ $file ] = new $widget_class();
|
652 |
+
}
|
653 |
+
}
|
654 |
+
}
|
655 |
+
|
656 |
+
return $widgets;
|
657 |
+
}
|
658 |
+
|
659 |
+
/**
|
660 |
+
* Sorting function to sort widgets by name
|
661 |
+
*
|
662 |
+
* @param $widget_a
|
663 |
+
* @param $widget_b
|
664 |
+
*
|
665 |
+
* @return int
|
666 |
+
*/
|
667 |
+
function widget_uasort($widget_a, $widget_b) {
|
668 |
+
return $widget_a['Name'] > $widget_b['Name'] ? 1 : -1;
|
669 |
+
}
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Look in Page Builder data for any missing widgets.
|
673 |
+
*
|
674 |
+
* @param $data
|
675 |
+
*
|
676 |
+
* @return mixed
|
677 |
+
*
|
678 |
+
* @action siteorigin_panels_data
|
679 |
+
*/
|
680 |
+
function load_missing_widgets( $data ){
|
681 |
+
if(empty($data['widgets'])) return $data;
|
682 |
+
|
683 |
+
global $wp_widget_factory;
|
684 |
+
|
685 |
+
foreach($data['widgets'] as $widget) {
|
686 |
+
if( empty( $widget['panels_info']['class'] ) ) continue;
|
687 |
+
if( !empty( $wp_widget_factory->widgets[ $widget['panels_info']['class'] ] ) ) continue;
|
688 |
+
|
689 |
+
$this->load_missing_widget( false, $widget['panels_info']['class'] );
|
690 |
+
}
|
691 |
+
|
692 |
+
return $data;
|
693 |
+
}
|
694 |
+
|
695 |
+
/**
|
696 |
+
* Attempt to load a single missing widget.
|
697 |
+
*
|
698 |
+
* @param $the_widget
|
699 |
+
* @param $class
|
700 |
+
*
|
701 |
+
* @return
|
702 |
+
*/
|
703 |
+
function load_missing_widget( $the_widget, $class ){
|
704 |
+
// We only want to worry about missing widgets
|
705 |
+
if( ! empty( $the_widget ) ) return $the_widget;
|
706 |
+
|
707 |
+
if( preg_match('/SiteOrigin_Widgets?_([A-Za-z]+)_Widget/', $class, $matches) ) {
|
708 |
+
$name = $matches[1];
|
709 |
+
$id = strtolower( implode( '-', array_filter( preg_split( '/(?=[A-Z])/', $name ) ) ) );
|
710 |
+
|
711 |
+
if( $id == 'contact-form' ) {
|
712 |
+
// Handle the special case of the contact form widget, which is incorrectly named
|
713 |
+
$id = 'contact';
|
714 |
+
}
|
715 |
+
|
716 |
+
$this->activate_widget($id, true);
|
717 |
+
global $wp_widget_factory;
|
718 |
+
if( !empty($wp_widget_factory->widgets[$class]) ) return $wp_widget_factory->widgets[$class];
|
719 |
+
}
|
720 |
+
|
721 |
+
return $the_widget;
|
722 |
+
}
|
723 |
+
|
724 |
+
/**
|
725 |
+
* Add action links.
|
726 |
+
*/
|
727 |
+
function plugin_action_links($links){
|
728 |
+
unset( $links['edit'] );
|
729 |
+
$links['manage'] = '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">'.__('Manage Widgets', 'so-widgets-bundle').'</a>';
|
730 |
+
$links['support'] = '<a href="https://siteorigin.com/thread/" target="_blank" rel="noopener noreferrer">'.__('Support', 'so-widgets-bundle').'</a>';
|
731 |
+
return $links;
|
732 |
+
}
|
733 |
+
|
734 |
+
function register_general_scripts() {
|
735 |
+
wp_register_script( 'sow-fittext',
|
736 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/sow.jquery.fittext' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
737 |
+
array( 'jquery' ),
|
738 |
+
'1.2',
|
739 |
+
true
|
740 |
+
);
|
741 |
+
wp_register_script(
|
742 |
+
'dessandro-imagesLoaded',
|
743 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/lib/imagesloaded.pkgd' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
744 |
+
array( 'jquery' ),
|
745 |
+
'3.2.0',
|
746 |
+
true
|
747 |
+
);
|
748 |
+
wp_register_script(
|
749 |
+
'dessandro-packery',
|
750 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/lib/packery.pkgd' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
751 |
+
array( 'jquery' ),
|
752 |
+
'1.4.3',
|
753 |
+
true
|
754 |
+
);
|
755 |
+
wp_register_script(
|
756 |
+
'sow-google-map',
|
757 |
+
plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/sow.google.map' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
758 |
+
array( 'jquery' ),
|
759 |
+
SOW_BUNDLE_VERSION
|
760 |
+
);
|
761 |
+
}
|
762 |
+
|
763 |
+
/**
|
764 |
+
* Ensure active widgets' scripts are enqueued at the right time.
|
765 |
+
*/
|
766 |
+
function enqueue_active_widgets_scripts() {
|
767 |
+
global $wp_registered_widgets;
|
768 |
+
$sidebars_widgets = wp_get_sidebars_widgets();
|
769 |
+
if( empty($sidebars_widgets) ) return;
|
770 |
+
foreach( $sidebars_widgets as $sidebar => $widgets ) {
|
771 |
+
if ( ! empty( $widgets ) && $sidebar !== "wp_inactive_widgets") {
|
772 |
+
foreach ( $widgets as $i => $id ) {
|
773 |
+
if ( ! empty( $wp_registered_widgets[$id] ) ) {
|
774 |
+
$widget = $wp_registered_widgets[$id]['callback'][0];
|
775 |
+
if ( !empty($widget) && is_object($widget) && is_subclass_of($widget, 'SiteOrigin_Widget') && is_active_widget( false, false, $widget->id_base ) ) {
|
776 |
+
/* @var $widget SiteOrigin_Widget */
|
777 |
+
$opt_wid = get_option( 'widget_' . $widget->id_base );
|
778 |
+
preg_match( '/-([0-9]+$)/', $id, $num_match );
|
779 |
+
$widget_instance = $opt_wid[ $num_match[1] ];
|
780 |
+
$widget->enqueue_frontend_scripts( $widget_instance);
|
781 |
+
$widget->generate_and_enqueue_instance_styles( $widget_instance );
|
782 |
+
}
|
783 |
+
}
|
784 |
+
}
|
785 |
+
}
|
786 |
+
}
|
787 |
+
}
|
788 |
+
}
|
789 |
+
|
790 |
+
// create the initial single
|
791 |
+
SiteOrigin_Widgets_Bundle::single();
|
792 |
+
|
793 |
+
// Initialize the Meta Box Manager
|
794 |
+
global $sow_meta_box_manager;
|
795 |
+
$sow_meta_box_manager = SiteOrigin_Widget_Meta_Box_Manager::single();
|
widgets/accordion/js/accordion.js
CHANGED
@@ -1,111 +1,111 @@
|
|
1 |
-
/* globals jQuery, sowb */
|
2 |
-
|
3 |
-
var sowb = window.sowb || {};
|
4 |
-
|
5 |
-
jQuery( function ( $ ) {
|
6 |
-
|
7 |
-
sowb.setupAccordion = function() {
|
8 |
-
$( '.sow-accordion' ).each( function ( index, element ) {
|
9 |
-
var $widget = $( this ).closest( '.so-widget-sow-accordion' );
|
10 |
-
var useAnchorTags = $widget.data( 'useAnchorTags' );
|
11 |
-
|
12 |
-
var $accordionPanels = $( element ).find( '> .sow-accordion-panel' );
|
13 |
-
|
14 |
-
$accordionPanels.not( '.sow-accordion-panel-open' ).find( '.sow-accordion-panel-content' ).hide();
|
15 |
-
|
16 |
-
var openPanels = $accordionPanels.filter( '.sow-accordion-panel-open' ).toArray();
|
17 |
-
var updateHash = function () {
|
18 |
-
// noop
|
19 |
-
};
|
20 |
-
|
21 |
-
var openPanel = function ( panel, preventHashChange ) {
|
22 |
-
var $panel = $( panel );
|
23 |
-
if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
|
24 |
-
$panel.find( '> .sow-accordion-panel-content' ).slideDown(
|
25 |
-
function() {
|
26 |
-
$( this ).trigger( 'show' );
|
27 |
-
}
|
28 |
-
);
|
29 |
-
$panel.addClass( 'sow-accordion-panel-open' );
|
30 |
-
openPanels.push( panel );
|
31 |
-
if ( ! preventHashChange ) {
|
32 |
-
updateHash();
|
33 |
-
}
|
34 |
-
}
|
35 |
-
};
|
36 |
-
|
37 |
-
var closePanel = function ( panel, preventHashChange ) {
|
38 |
-
var $panel = $( panel );
|
39 |
-
if ( $panel.is( '.sow-accordion-panel-open' ) ) {
|
40 |
-
$panel.find( '> .sow-accordion-panel-content' ).slideUp(
|
41 |
-
function() {
|
42 |
-
$( this ).trigger( 'hide' );
|
43 |
-
}
|
44 |
-
);
|
45 |
-
$panel.removeClass( 'sow-accordion-panel-open' );
|
46 |
-
openPanels.splice( openPanels.indexOf( panel ), 1 );
|
47 |
-
if ( ! preventHashChange ) {
|
48 |
-
updateHash();
|
49 |
-
}
|
50 |
-
}
|
51 |
-
};
|
52 |
-
|
53 |
-
$accordionPanels.find( '> .sow-accordion-panel-header' ).click( function () {
|
54 |
-
var $this = $( this );
|
55 |
-
var maxOpenPanels = $widget.data( 'maxOpenPanels' );
|
56 |
-
var $panel = $this.closest( '.sow-accordion-panel' );
|
57 |
-
if ( $panel.is( '.sow-accordion-panel-open' ) ) {
|
58 |
-
closePanel( $panel.get( 0 ) );
|
59 |
-
} else {
|
60 |
-
openPanel( $panel.get( 0 ) );
|
61 |
-
}
|
62 |
-
if ( ! isNaN( maxOpenPanels ) && maxOpenPanels > 0 && openPanels.length > maxOpenPanels ) {
|
63 |
-
closePanel( openPanels[ 0 ] );
|
64 |
-
}
|
65 |
-
} );
|
66 |
-
|
67 |
-
if ( useAnchorTags ) {
|
68 |
-
updateHash = function () {
|
69 |
-
var anchors = [];
|
70 |
-
for ( var i = 0; i < openPanels.length; i++ ) {
|
71 |
-
var anchor = $( openPanels[ i ] ).data( 'anchor' );
|
72 |
-
if ( anchor ) {
|
73 |
-
anchors[ i ] = anchor;
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
if ( anchors && anchors.length ) {
|
78 |
-
window.location.hash = anchors.join( ',' );
|
79 |
-
} else {
|
80 |
-
window.history.pushState( '', document.title, window.location.pathname + window.location.search );
|
81 |
-
}
|
82 |
-
};
|
83 |
-
|
84 |
-
var updatePanelStates = function () {
|
85 |
-
var panels = $accordionPanels.toArray();
|
86 |
-
for ( var i = 0; i < panels.length; i++ ) {
|
87 |
-
panel = panels[ i ];
|
88 |
-
var anchor = $( panel ).data( 'anchor' );
|
89 |
-
if ( anchor && window.location.hash.indexOf( anchor ) > -1 ) {
|
90 |
-
openPanel( panel, true );
|
91 |
-
} else {
|
92 |
-
closePanel( panel, true );
|
93 |
-
}
|
94 |
-
}
|
95 |
-
};
|
96 |
-
$( window ).on( 'hashchange', updatePanelStates );
|
97 |
-
if ( window.location.hash ) {
|
98 |
-
updatePanelStates();
|
99 |
-
} else {
|
100 |
-
updateHash();
|
101 |
-
}
|
102 |
-
}
|
103 |
-
} );
|
104 |
-
};
|
105 |
-
|
106 |
-
sowb.setupAccordion();
|
107 |
-
|
108 |
-
$( sowb ).on( 'setup_widgets', sowb.setupAccordion );
|
109 |
-
} );
|
110 |
-
|
111 |
-
window.sowb = sowb;
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
|
3 |
+
var sowb = window.sowb || {};
|
4 |
+
|
5 |
+
jQuery( function ( $ ) {
|
6 |
+
|
7 |
+
sowb.setupAccordion = function() {
|
8 |
+
$( '.sow-accordion' ).each( function ( index, element ) {
|
9 |
+
var $widget = $( this ).closest( '.so-widget-sow-accordion' );
|
10 |
+
var useAnchorTags = $widget.data( 'useAnchorTags' );
|
11 |
+
|
12 |
+
var $accordionPanels = $( element ).find( '> .sow-accordion-panel' );
|
13 |
+
|
14 |
+
$accordionPanels.not( '.sow-accordion-panel-open' ).find( '.sow-accordion-panel-content' ).hide();
|
15 |
+
|
16 |
+
var openPanels = $accordionPanels.filter( '.sow-accordion-panel-open' ).toArray();
|
17 |
+
var updateHash = function () {
|
18 |
+
// noop
|
19 |
+
};
|
20 |
+
|
21 |
+
var openPanel = function ( panel, preventHashChange ) {
|
22 |
+
var $panel = $( panel );
|
23 |
+
if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
|
24 |
+
$panel.find( '> .sow-accordion-panel-content' ).slideDown(
|
25 |
+
function() {
|
26 |
+
$( this ).trigger( 'show' );
|
27 |
+
}
|
28 |
+
);
|
29 |
+
$panel.addClass( 'sow-accordion-panel-open' );
|
30 |
+
openPanels.push( panel );
|
31 |
+
if ( ! preventHashChange ) {
|
32 |
+
updateHash();
|
33 |
+
}
|
34 |
+
}
|
35 |
+
};
|
36 |
+
|
37 |
+
var closePanel = function ( panel, preventHashChange ) {
|
38 |
+
var $panel = $( panel );
|
39 |
+
if ( $panel.is( '.sow-accordion-panel-open' ) ) {
|
40 |
+
$panel.find( '> .sow-accordion-panel-content' ).slideUp(
|
41 |
+
function() {
|
42 |
+
$( this ).trigger( 'hide' );
|
43 |
+
}
|
44 |
+
);
|
45 |
+
$panel.removeClass( 'sow-accordion-panel-open' );
|
46 |
+
openPanels.splice( openPanels.indexOf( panel ), 1 );
|
47 |
+
if ( ! preventHashChange ) {
|
48 |
+
updateHash();
|
49 |
+
}
|
50 |
+
}
|
51 |
+
};
|
52 |
+
|
53 |
+
$accordionPanels.find( '> .sow-accordion-panel-header' ).click( function () {
|
54 |
+
var $this = $( this );
|
55 |
+
var maxOpenPanels = $widget.data( 'maxOpenPanels' );
|
56 |
+
var $panel = $this.closest( '.sow-accordion-panel' );
|
57 |
+
if ( $panel.is( '.sow-accordion-panel-open' ) ) {
|
58 |
+
closePanel( $panel.get( 0 ) );
|
59 |
+
} else {
|
60 |
+
openPanel( $panel.get( 0 ) );
|
61 |
+
}
|
62 |
+
if ( ! isNaN( maxOpenPanels ) && maxOpenPanels > 0 && openPanels.length > maxOpenPanels ) {
|
63 |
+
closePanel( openPanels[ 0 ] );
|
64 |
+
}
|
65 |
+
} );
|
66 |
+
|
67 |
+
if ( useAnchorTags ) {
|
68 |
+
updateHash = function () {
|
69 |
+
var anchors = [];
|
70 |
+
for ( var i = 0; i < openPanels.length; i++ ) {
|
71 |
+
var anchor = $( openPanels[ i ] ).data( 'anchor' );
|
72 |
+
if ( anchor ) {
|
73 |
+
anchors[ i ] = anchor;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( anchors && anchors.length ) {
|
78 |
+
window.location.hash = anchors.join( ',' );
|
79 |
+
} else {
|
80 |
+
window.history.pushState( '', document.title, window.location.pathname + window.location.search );
|
81 |
+
}
|
82 |
+
};
|
83 |
+
|
84 |
+
var updatePanelStates = function () {
|
85 |
+
var panels = $accordionPanels.toArray();
|
86 |
+
for ( var i = 0; i < panels.length; i++ ) {
|
87 |
+
panel = panels[ i ];
|
88 |
+
var anchor = $( panel ).data( 'anchor' );
|
89 |
+
if ( anchor && window.location.hash.indexOf( anchor ) > -1 ) {
|
90 |
+
openPanel( panel, true );
|
91 |
+
} else {
|
92 |
+
closePanel( panel, true );
|
93 |
+
}
|
94 |
+
}
|
95 |
+
};
|
96 |
+
$( window ).on( 'hashchange', updatePanelStates );
|
97 |
+
if ( window.location.hash ) {
|
98 |
+
updatePanelStates();
|
99 |
+
} else {
|
100 |
+
updateHash();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
} );
|
104 |
+
};
|
105 |
+
|
106 |
+
sowb.setupAccordion();
|
107 |
+
|
108 |
+
$( sowb ).on( 'setup_widgets', sowb.setupAccordion );
|
109 |
+
} );
|
110 |
+
|
111 |
+
window.sowb = sowb;
|
widgets/accordion/styles/default.less
CHANGED
@@ -1,105 +1,105 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@heading_background_color: default;
|
6 |
-
@heading_background_hover_color: default;
|
7 |
-
@title_color: default;
|
8 |
-
@title_hover_color: default;
|
9 |
-
@heading_title_align: left;
|
10 |
-
@heading_title_font_family: default;
|
11 |
-
@heading_title_font_weight: default;
|
12 |
-
@heading_title_font_size: default;
|
13 |
-
@heading_title_text_transform: default;
|
14 |
-
@heading_border_color: default;
|
15 |
-
@heading_border_hover_color: default;
|
16 |
-
@has_heading_border_width: default;
|
17 |
-
@heading_border_width: default;
|
18 |
-
@heading_border_radius: default;
|
19 |
-
@heading_padding: 15px 30px 15px 30px;
|
20 |
-
@show_open_close_icon: true;
|
21 |
-
@open_close_location: right;
|
22 |
-
|
23 |
-
@panels_background_color: default;
|
24 |
-
@panels_font_family: default;
|
25 |
-
@panels_font_size: default;
|
26 |
-
@panels_font_color: default;
|
27 |
-
@panels_border_color: default;
|
28 |
-
@has_panels_border_width: default;
|
29 |
-
@panels_border_width: default;
|
30 |
-
@panels_border_radius: default;
|
31 |
-
@panels_padding: 15px 30px 15px 30px;
|
32 |
-
@panels_margin_bottom: 10px;
|
33 |
-
|
34 |
-
.sow-accordion {
|
35 |
-
.sow-accordion-panel {
|
36 |
-
.sow-accordion-panel-header {
|
37 |
-
position: relative;
|
38 |
-
cursor: pointer;
|
39 |
-
padding: @heading_padding;
|
40 |
-
background-color: @heading_background_color;
|
41 |
-
color: @title_color;
|
42 |
-
text-align: @heading_title_align;
|
43 |
-
font-family: @heading_title_font_family;
|
44 |
-
font-weight: @heading_title_font_weight;
|
45 |
-
font-size: @heading_title_font_size;
|
46 |
-
text-transform: @heading_title_text_transform;
|
47 |
-
|
48 |
-
& when( @has_heading_border_width = true ) {
|
49 |
-
border-style: solid;
|
50 |
-
border-color: @heading_border_color;
|
51 |
-
border-width: @heading_border_width;
|
52 |
-
border-radius: @heading_border_radius;
|
53 |
-
}
|
54 |
-
|
55 |
-
&:hover {
|
56 |
-
background-color: @heading_background_hover_color;
|
57 |
-
color: @title_hover_color;
|
58 |
-
border-color: @heading_border_hover_color;
|
59 |
-
}
|
60 |
-
|
61 |
-
.sow-accordion-title {
|
62 |
-
display: inline-block;
|
63 |
-
width: ~"calc(100% - 20px)";
|
64 |
-
& when ( @show_open_close_icon = true ) and ( @heading_title_align = @open_close_location ) {
|
65 |
-
margin-@{open_close_location}: 5px;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
.sow-accordion-open-close-button {
|
70 |
-
float: @open_close_location;
|
71 |
-
|
72 |
-
& when ( @show_open_close_icon = false ) {
|
73 |
-
display: none;
|
74 |
-
}
|
75 |
-
}
|
76 |
-
}
|
77 |
-
&:not(.sow-accordion-panel-open) > .sow-accordion-panel-header {
|
78 |
-
.sow-accordion-close-button {
|
79 |
-
display: none;
|
80 |
-
}
|
81 |
-
}
|
82 |
-
&.sow-accordion-panel-open > .sow-accordion-panel-header {
|
83 |
-
.sow-accordion-open-button {
|
84 |
-
display: none;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
.sow-accordion-panel-content {
|
88 |
-
.sow-accordion-panel-border {
|
89 |
-
background-color: @panels_background_color;
|
90 |
-
& when ( @has_panels_border_width = true ) {
|
91 |
-
border-style: solid;
|
92 |
-
border-color: @panels_border_color;
|
93 |
-
border-width: @panels_border_width;
|
94 |
-
border-radius: @panels_border_radius;
|
95 |
-
}
|
96 |
-
padding: @panels_padding;
|
97 |
-
color: @panels_font_color;
|
98 |
-
font-family: @panels_font_family;
|
99 |
-
font-size: @panels_font_size;
|
100 |
-
overflow: auto;
|
101 |
-
}
|
102 |
-
}
|
103 |
-
margin-bottom: @panels_margin_bottom;
|
104 |
-
}
|
105 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@heading_background_color: default;
|
6 |
+
@heading_background_hover_color: default;
|
7 |
+
@title_color: default;
|
8 |
+
@title_hover_color: default;
|
9 |
+
@heading_title_align: left;
|
10 |
+
@heading_title_font_family: default;
|
11 |
+
@heading_title_font_weight: default;
|
12 |
+
@heading_title_font_size: default;
|
13 |
+
@heading_title_text_transform: default;
|
14 |
+
@heading_border_color: default;
|
15 |
+
@heading_border_hover_color: default;
|
16 |
+
@has_heading_border_width: default;
|
17 |
+
@heading_border_width: default;
|
18 |
+
@heading_border_radius: default;
|
19 |
+
@heading_padding: 15px 30px 15px 30px;
|
20 |
+
@show_open_close_icon: true;
|
21 |
+
@open_close_location: right;
|
22 |
+
|
23 |
+
@panels_background_color: default;
|
24 |
+
@panels_font_family: default;
|
25 |
+
@panels_font_size: default;
|
26 |
+
@panels_font_color: default;
|
27 |
+
@panels_border_color: default;
|
28 |
+
@has_panels_border_width: default;
|
29 |
+
@panels_border_width: default;
|
30 |
+
@panels_border_radius: default;
|
31 |
+
@panels_padding: 15px 30px 15px 30px;
|
32 |
+
@panels_margin_bottom: 10px;
|
33 |
+
|
34 |
+
.sow-accordion {
|
35 |
+
.sow-accordion-panel {
|
36 |
+
.sow-accordion-panel-header {
|
37 |
+
position: relative;
|
38 |
+
cursor: pointer;
|
39 |
+
padding: @heading_padding;
|
40 |
+
background-color: @heading_background_color;
|
41 |
+
color: @title_color;
|
42 |
+
text-align: @heading_title_align;
|
43 |
+
font-family: @heading_title_font_family;
|
44 |
+
font-weight: @heading_title_font_weight;
|
45 |
+
font-size: @heading_title_font_size;
|
46 |
+
text-transform: @heading_title_text_transform;
|
47 |
+
|
48 |
+
& when( @has_heading_border_width = true ) {
|
49 |
+
border-style: solid;
|
50 |
+
border-color: @heading_border_color;
|
51 |
+
border-width: @heading_border_width;
|
52 |
+
border-radius: @heading_border_radius;
|
53 |
+
}
|
54 |
+
|
55 |
+
&:hover {
|
56 |
+
background-color: @heading_background_hover_color;
|
57 |
+
color: @title_hover_color;
|
58 |
+
border-color: @heading_border_hover_color;
|
59 |
+
}
|
60 |
+
|
61 |
+
.sow-accordion-title {
|
62 |
+
display: inline-block;
|
63 |
+
width: ~"calc(100% - 20px)";
|
64 |
+
& when ( @show_open_close_icon = true ) and ( @heading_title_align = @open_close_location ) {
|
65 |
+
margin-@{open_close_location}: 5px;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
.sow-accordion-open-close-button {
|
70 |
+
float: @open_close_location;
|
71 |
+
|
72 |
+
& when ( @show_open_close_icon = false ) {
|
73 |
+
display: none;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
&:not(.sow-accordion-panel-open) > .sow-accordion-panel-header {
|
78 |
+
.sow-accordion-close-button {
|
79 |
+
display: none;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
&.sow-accordion-panel-open > .sow-accordion-panel-header {
|
83 |
+
.sow-accordion-open-button {
|
84 |
+
display: none;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
.sow-accordion-panel-content {
|
88 |
+
.sow-accordion-panel-border {
|
89 |
+
background-color: @panels_background_color;
|
90 |
+
& when ( @has_panels_border_width = true ) {
|
91 |
+
border-style: solid;
|
92 |
+
border-color: @panels_border_color;
|
93 |
+
border-width: @panels_border_width;
|
94 |
+
border-radius: @panels_border_radius;
|
95 |
+
}
|
96 |
+
padding: @panels_padding;
|
97 |
+
color: @panels_font_color;
|
98 |
+
font-family: @panels_font_family;
|
99 |
+
font-size: @panels_font_size;
|
100 |
+
overflow: auto;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
margin-bottom: @panels_margin_bottom;
|
104 |
+
}
|
105 |
+
}
|
widgets/accordion/tpl/default.php
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @var array $instance
|
4 |
-
* @var array $panels
|
5 |
-
* @var string $icon_open
|
6 |
-
* @var string $icon_close
|
7 |
-
*/
|
8 |
-
|
9 |
-
if( !empty( $instance['title'] ) ) {
|
10 |
-
echo $args['before_title'] . $instance['title'] . $args['after_title'];
|
11 |
-
}
|
12 |
-
?>
|
13 |
-
<div>
|
14 |
-
<div class="sow-accordion">
|
15 |
-
<?php foreach ( $panels as $panel ) : ?>
|
16 |
-
<div class="sow-accordion-panel<?php if ( $panel['initial_state'] == 'open' ) echo ' sow-accordion-panel-open'; ?>"
|
17 |
-
data-anchor="<?php echo sanitize_title_with_dashes( $panel['anchor'] ); ?>">
|
18 |
-
<div class="sow-accordion-panel-header">
|
19 |
-
<div class="sow-accordion-title">
|
20 |
-
<?php echo $panel['before_title']; ?>
|
21 |
-
<?php echo wp_kses_post( $panel['title'] ); ?>
|
22 |
-
<?php echo $panel['after_title']; ?>
|
23 |
-
</div>
|
24 |
-
<div class="sow-accordion-open-close-button">
|
25 |
-
<div class="sow-accordion-open-button">
|
26 |
-
<?php echo siteorigin_widget_get_icon( $icon_open ); ?>
|
27 |
-
</div>
|
28 |
-
<div class="sow-accordion-close-button">
|
29 |
-
<?php echo siteorigin_widget_get_icon( $icon_close ); ?>
|
30 |
-
</div>
|
31 |
-
</div>
|
32 |
-
</div>
|
33 |
-
<div class="sow-accordion-panel-content">
|
34 |
-
<div class="sow-accordion-panel-border">
|
35 |
-
<?php $this->render_panel_content( $panel, $instance ); ?>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
</div>
|
39 |
-
<?php endforeach; ?>
|
40 |
-
</div>
|
41 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var array $instance
|
4 |
+
* @var array $panels
|
5 |
+
* @var string $icon_open
|
6 |
+
* @var string $icon_close
|
7 |
+
*/
|
8 |
+
|
9 |
+
if( !empty( $instance['title'] ) ) {
|
10 |
+
echo $args['before_title'] . $instance['title'] . $args['after_title'];
|
11 |
+
}
|
12 |
+
?>
|
13 |
+
<div>
|
14 |
+
<div class="sow-accordion">
|
15 |
+
<?php foreach ( $panels as $panel ) : ?>
|
16 |
+
<div class="sow-accordion-panel<?php if ( $panel['initial_state'] == 'open' ) echo ' sow-accordion-panel-open'; ?>"
|
17 |
+
data-anchor="<?php echo sanitize_title_with_dashes( $panel['anchor'] ); ?>">
|
18 |
+
<div class="sow-accordion-panel-header">
|
19 |
+
<div class="sow-accordion-title">
|
20 |
+
<?php echo $panel['before_title']; ?>
|
21 |
+
<?php echo wp_kses_post( $panel['title'] ); ?>
|
22 |
+
<?php echo $panel['after_title']; ?>
|
23 |
+
</div>
|
24 |
+
<div class="sow-accordion-open-close-button">
|
25 |
+
<div class="sow-accordion-open-button">
|
26 |
+
<?php echo siteorigin_widget_get_icon( $icon_open ); ?>
|
27 |
+
</div>
|
28 |
+
<div class="sow-accordion-close-button">
|
29 |
+
<?php echo siteorigin_widget_get_icon( $icon_close ); ?>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
<div class="sow-accordion-panel-content">
|
34 |
+
<div class="sow-accordion-panel-border">
|
35 |
+
<?php $this->render_panel_content( $panel, $instance ); ?>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
<?php endforeach; ?>
|
40 |
+
</div>
|
41 |
+
</div>
|
widgets/button/button.php
CHANGED
@@ -1,382 +1,382 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Widget Name: Button
|
4 |
-
Description: A powerful yet simple button widget for your sidebars or Page Builder pages.
|
5 |
-
Author: SiteOrigin
|
6 |
-
Author URI: https://siteorigin.com
|
7 |
-
*/
|
8 |
-
|
9 |
-
class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
|
10 |
-
function __construct() {
|
11 |
-
|
12 |
-
parent::__construct(
|
13 |
-
'sow-button',
|
14 |
-
__('SiteOrigin Button', 'so-widgets-bundle'),
|
15 |
-
array(
|
16 |
-
'description' => __('A customizable button widget.', 'so-widgets-bundle'),
|
17 |
-
'help' => 'https://siteorigin.com/widgets-bundle/button-widget-documentation/'
|
18 |
-
),
|
19 |
-
array(
|
20 |
-
|
21 |
-
),
|
22 |
-
false,
|
23 |
-
plugin_dir_path(__FILE__)
|
24 |
-
);
|
25 |
-
|
26 |
-
}
|
27 |
-
|
28 |
-
function initialize() {
|
29 |
-
$this->register_frontend_styles(
|
30 |
-
array(
|
31 |
-
array(
|
32 |
-
'sow-button-base',
|
33 |
-
plugin_dir_url(__FILE__) . 'css/style.css',
|
34 |
-
array(),
|
35 |
-
SOW_BUNDLE_VERSION
|
36 |
-
),
|
37 |
-
)
|
38 |
-
);
|
39 |
-
}
|
40 |
-
|
41 |
-
function get_widget_form() {
|
42 |
-
return array(
|
43 |
-
'text' => array(
|
44 |
-
'type' => 'text',
|
45 |
-
'label' => __('Button text', 'so-widgets-bundle'),
|
46 |
-
),
|
47 |
-
|
48 |
-
'url' => array(
|
49 |
-
'type' => 'link',
|
50 |
-
'label' => __('Destination URL', 'so-widgets-bundle'),
|
51 |
-
),
|
52 |
-
|
53 |
-
'new_window' => array(
|
54 |
-
'type' => 'checkbox',
|
55 |
-
'default' => false,
|
56 |
-
'label' => __('Open in a new window', 'so-widgets-bundle'),
|
57 |
-
),
|
58 |
-
|
59 |
-
'button_icon' => array(
|
60 |
-
'type' => 'section',
|
61 |
-
'label' => __('Icon', 'so-widgets-bundle'),
|
62 |
-
'fields' => array(
|
63 |
-
'icon_selected' => array(
|
64 |
-
'type' => 'icon',
|
65 |
-
'label' => __('Icon', 'so-widgets-bundle'),
|
66 |
-
),
|
67 |
-
|
68 |
-
'icon_color' => array(
|
69 |
-
'type' => 'color',
|
70 |
-
'label' => __('Icon color', 'so-widgets-bundle'),
|
71 |
-
),
|
72 |
-
|
73 |
-
'icon' => array(
|
74 |
-
'type' => 'media',
|
75 |
-
'label' => __('Image icon', 'so-widgets-bundle'),
|
76 |
-
'description' => __('Replaces the icon with your own image icon.', 'so-widgets-bundle'),
|
77 |
-
),
|
78 |
-
|
79 |
-
'icon_placement' => array(
|
80 |
-
'type' => 'select',
|
81 |
-
'label' => __( 'Icon Placement', 'so-widgets-bundle' ),
|
82 |
-
'default' => 'left',
|
83 |
-
'options' => array(
|
84 |
-
'top' => __( 'Top', 'so-widgets-bundle' ),
|
85 |
-
'right' => __( 'Right', 'so-widgets-bundle' ),
|
86 |
-
'bottom' => __( 'Bottom', 'so-widgets-bundle' ),
|
87 |
-
'left' => __( 'Left', 'so-widgets-bundle' ),
|
88 |
-
),
|
89 |
-
),
|
90 |
-
),
|
91 |
-
),
|
92 |
-
|
93 |
-
'design' => array(
|
94 |
-
'type' => 'section',
|
95 |
-
'label' => __('Design and layout', 'so-widgets-bundle'),
|
96 |
-
'hide' => true,
|
97 |
-
'fields' => array(
|
98 |
-
|
99 |
-
'width' => array(
|
100 |
-
'type' => 'measurement',
|
101 |
-
'label' => __( 'Width', 'so-widgets-bundle' ),
|
102 |
-
'description' => __( 'Leave blank to let the button resize according to content.', 'so-widgets-bundle' )
|
103 |
-
),
|
104 |
-
|
105 |
-
'align' => array(
|
106 |
-
'type' => 'select',
|
107 |
-
'label' => __('Align', 'so-widgets-bundle'),
|
108 |
-
'default' => 'center',
|
109 |
-
'options' => array(
|
110 |
-
'left' => __('Left', 'so-widgets-bundle'),
|
111 |
-
'right' => __('Right', 'so-widgets-bundle'),
|
112 |
-
'center' => __('Center', 'so-widgets-bundle'),
|
113 |
-
'justify' => __('Justify', 'so-widgets-bundle'),
|
114 |
-
),
|
115 |
-
),
|
116 |
-
|
117 |
-
'theme' => array(
|
118 |
-
'type' => 'select',
|
119 |
-
'label' => __('Button theme', 'so-widgets-bundle'),
|
120 |
-
'default' => 'atom',
|
121 |
-
'options' => array(
|
122 |
-
'atom' => __('Atom', 'so-widgets-bundle'),
|
123 |
-
'flat' => __('Flat', 'so-widgets-bundle'),
|
124 |
-
'wire' => __('Wire', 'so-widgets-bundle'),
|
125 |
-
),
|
126 |
-
),
|
127 |
-
|
128 |
-
|
129 |
-
'button_color' => array(
|
130 |
-
'type' => 'color',
|
131 |
-
'label' => __('Button color', 'so-widgets-bundle'),
|
132 |
-
),
|
133 |
-
|
134 |
-
'text_color' => array(
|
135 |
-
'type' => 'color',
|
136 |
-
'label' => __('Text color', 'so-widgets-bundle'),
|
137 |
-
),
|
138 |
-
|
139 |
-
'hover' => array(
|
140 |
-
'type' => 'checkbox',
|
141 |
-
'default' => true,
|
142 |
-
'label' => __('Use hover effects', 'so-widgets-bundle'),
|
143 |
-
),
|
144 |
-
|
145 |
-
'font' => array(
|
146 |
-
'type' => 'font',
|
147 |
-
'label' => __( 'Font', 'so-widgets-bundle' ),
|
148 |
-
'default' => 'default'
|
149 |
-
),
|
150 |
-
|
151 |
-
'font_size' => array(
|
152 |
-
'type' => 'select',
|
153 |
-
'label' => __('Font size', 'so-widgets-bundle'),
|
154 |
-
'options' => array(
|
155 |
-
'1' => __('Normal', 'so-widgets-bundle'),
|
156 |
-
'1.15' => __('Medium', 'so-widgets-bundle'),
|
157 |
-
'1.3' => __('Large', 'so-widgets-bundle'),
|
158 |
-
'1.45' => __('Extra large', 'so-widgets-bundle'),
|
159 |
-
),
|
160 |
-
),
|
161 |
-
|
162 |
-
'rounding' => array(
|
163 |
-
'type' => 'select',
|
164 |
-
'label' => __('Rounding', 'so-widgets-bundle'),
|
165 |
-
'default' => '0.25',
|
166 |
-
'options' => array(
|
167 |
-
'0' => __('None', 'so-widgets-bundle'),
|
168 |
-
'0.25' => __('Slightly rounded', 'so-widgets-bundle'),
|
169 |
-
'0.5' => __('Very rounded', 'so-widgets-bundle'),
|
170 |
-
'1.5' => __('Completely rounded', 'so-widgets-bundle'),
|
171 |
-
),
|
172 |
-
),
|
173 |
-
|
174 |
-
'padding' => array(
|
175 |
-
'type' => 'select',
|
176 |
-
'label' => __('Padding', 'so-widgets-bundle'),
|
177 |
-
'default' => '1',
|
178 |
-
'options' => array(
|
179 |
-
'0.5' => __('Low', 'so-widgets-bundle'),
|
180 |
-
'1' => __('Medium', 'so-widgets-bundle'),
|
181 |
-
'1.4' => __('High', 'so-widgets-bundle'),
|
182 |
-
'1.8' => __('Very high', 'so-widgets-bundle'),
|
183 |
-
),
|
184 |
-
),
|
185 |
-
|
186 |
-
),
|
187 |
-
),
|
188 |
-
|
189 |
-
'attributes' => array(
|
190 |
-
'type' => 'section',
|
191 |
-
'label' => __('Other attributes and SEO', 'so-widgets-bundle'),
|
192 |
-
'hide' => true,
|
193 |
-
'fields' => array(
|
194 |
-
'id' => array(
|
195 |
-
'type' => 'text',
|
196 |
-
'label' => __('Button ID', 'so-widgets-bundle'),
|
197 |
-
'description' => __('An ID attribute allows you to target this button in Javascript.', 'so-widgets-bundle'),
|
198 |
-
),
|
199 |
-
|
200 |
-
'classes' => array(
|
201 |
-
'type' => 'text',
|
202 |
-
'label' => __('Button Classes', 'so-widgets-bundle'),
|
203 |
-
'description' => __('Additional CSS classes added to the button link.', 'so-widgets-bundle'),
|
204 |
-
),
|
205 |
-
|
206 |
-
'title' => array(
|
207 |
-
'type' => 'text',
|
208 |
-
'label' => __('Title attribute', 'so-widgets-bundle'),
|
209 |
-
'description' => __('Adds a title attribute to the button link.', 'so-widgets-bundle'),
|
210 |
-
),
|
211 |
-
|
212 |
-
'onclick' => array(
|
213 |
-
'type' => 'text',
|
214 |
-
'label' => __('Onclick', 'so-widgets-bundle'),
|
215 |
-
'description' => __('Run this Javascript when the button is clicked. Ideal for tracking.', 'so-widgets-bundle'),
|
216 |
-
),
|
217 |
-
|
218 |
-
'rel' => array(
|
219 |
-
'type' => 'text',
|
220 |
-
'label' => __('Rel attribute', 'so-widgets-bundle'),
|
221 |
-
'description' => __('Adds a rel attribute to the button link.', 'so-widgets-bundle'),
|
222 |
-
),
|
223 |
-
)
|
224 |
-
),
|
225 |
-
);
|
226 |
-
}
|
227 |
-
|
228 |
-
function get_style_name($instance) {
|
229 |
-
if(empty($instance['design']['theme'])) return 'atom';
|
230 |
-
return $instance['design']['theme'];
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Get the variables for the button widget.
|
235 |
-
*
|
236 |
-
* @param $instance
|
237 |
-
* @param $args
|
238 |
-
*
|
239 |
-
* @return array
|
240 |
-
*/
|
241 |
-
function get_template_variables( $instance, $args ) {
|
242 |
-
$button_attributes = array();
|
243 |
-
|
244 |
-
$attributes = $instance['attributes'];
|
245 |
-
|
246 |
-
$classes = ! empty( $attributes['classes'] ) ? $attributes['classes'] : '';
|
247 |
-
if ( ! empty( $classes ) ) {
|
248 |
-
$classes .= ' ';
|
249 |
-
}
|
250 |
-
$classes .= 'ow-icon-placement-'. $instance['button_icon']['icon_placement'];
|
251 |
-
if ( ! empty( $instance['design']['hover'] ) ) {
|
252 |
-
$classes .= ' ow-button-hover';
|
253 |
-
}
|
254 |
-
|
255 |
-
$button_attributes['class'] = implode( ' ',
|
256 |
-
array_map( 'sanitize_html_class',
|
257 |
-
explode( ' ', $classes )
|
258 |
-
)
|
259 |
-
);
|
260 |
-
|
261 |
-
if ( ! empty( $instance['new_window'] ) ) {
|
262 |
-
$button_attributes['target'] = '_blank';
|
263 |
-
$button_attributes['rel'] = 'noopener noreferrer';
|
264 |
-
}
|
265 |
-
|
266 |
-
if ( ! empty( $attributes['id'] ) ) {
|
267 |
-
$button_attributes['id'] = $attributes['id'];
|
268 |
-
}
|
269 |
-
if ( ! empty( $attributes['title'] ) ) {
|
270 |
-
$button_attributes['title'] = $attributes['title'];
|
271 |
-
}
|
272 |
-
if ( ! empty( $attributes['rel'] ) ) {
|
273 |
-
if ( isset ( $button_attributes['rel'] ) ) {
|
274 |
-
$button_attributes['rel'] .= " $attributes[rel]";
|
275 |
-
} else {
|
276 |
-
$button_attributes['rel'] = $attributes['rel'];
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
$icon_image_url = '';
|
281 |
-
if( ! empty( $instance['button_icon']['icon'] ) ) {
|
282 |
-
$attachment = wp_get_attachment_image_src( $instance['button_icon']['icon'] );
|
283 |
-
|
284 |
-
if ( ! empty( $attachment ) ) {
|
285 |
-
$icon_image_url = $attachment[0];
|
286 |
-
}
|
287 |
-
}
|
288 |
-
|
289 |
-
return array(
|
290 |
-
'button_attributes' => $button_attributes,
|
291 |
-
'href' => !empty( $instance['url'] ) ? $instance['url'] : '#',
|
292 |
-
'onclick' => ! empty( $attributes['onclick'] ) ? $attributes['onclick'] : '',
|
293 |
-
'align' => $instance['design']['align'],
|
294 |
-
'icon_image_url' => $icon_image_url,
|
295 |
-
'icon' => $instance['button_icon']['icon_selected'],
|
296 |
-
'icon_color' => $instance['button_icon']['icon_color'],
|
297 |
-
'text' => $instance['text'],
|
298 |
-
);
|
299 |
-
}
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Get the variables that we'll be injecting into the less stylesheet.
|
303 |
-
*
|
304 |
-
* @param $instance
|
305 |
-
*
|
306 |
-
* @return array
|
307 |
-
*/
|
308 |
-
function get_less_variables($instance){
|
309 |
-
if( empty( $instance ) || empty( $instance['design'] ) ) return array();
|
310 |
-
|
311 |
-
$less_vars = array(
|
312 |
-
'button_width' => isset( $instance['design']['width'] ) ? $instance['design']['width'] : '',
|
313 |
-
'button_color' => isset($instance['design']['button_color']) ? $instance['design']['button_color'] : '',
|
314 |
-
'text_color' => isset($instance['design']['text_color']) ? $instance['design']['text_color'] : '',
|
315 |
-
|
316 |
-
'font_size' => isset($instance['design']['font_size']) ? $instance['design']['font_size'] . 'em' : '',
|
317 |
-
'rounding' => isset($instance['design']['rounding']) ? $instance['design']['rounding'] . 'em' : '',
|
318 |
-
'padding' => isset($instance['design']['padding']) ? $instance['design']['padding'] . 'em' : '',
|
319 |
-
'has_text' => empty( $instance['text'] ) ? 'false' : 'true',
|
320 |
-
);
|
321 |
-
|
322 |
-
if ( ! empty( $instance['design']['font'] ) ) {
|
323 |
-
$font = siteorigin_widget_get_font( $instance['design']['font'] );
|
324 |
-
$less_vars['button_font'] = $font['family'];
|
325 |
-
if ( ! empty( $font['weight'] ) ) {
|
326 |
-
$less_vars['button_font_weight'] = $font['weight'];
|
327 |
-
}
|
328 |
-
}
|
329 |
-
return $less_vars;
|
330 |
-
}
|
331 |
-
|
332 |
-
function get_google_font_fields( $instance ) {
|
333 |
-
return array(
|
334 |
-
$instance['design']['font'],
|
335 |
-
);
|
336 |
-
}
|
337 |
-
/**
|
338 |
-
* Make sure the instance is the most up to date version.
|
339 |
-
*
|
340 |
-
* @param $instance
|
341 |
-
*
|
342 |
-
* @return mixed
|
343 |
-
*/
|
344 |
-
function modify_instance( $instance ) {
|
345 |
-
$migrate_props = array(
|
346 |
-
'button_icon' => array(
|
347 |
-
'icon_selected',
|
348 |
-
'icon_color',
|
349 |
-
'icon',
|
350 |
-
),
|
351 |
-
'design' => array(
|
352 |
-
'align',
|
353 |
-
'theme',
|
354 |
-
'button_color',
|
355 |
-
'text_color',
|
356 |
-
'hover',
|
357 |
-
'font_size',
|
358 |
-
'rounding',
|
359 |
-
'padding',
|
360 |
-
),
|
361 |
-
'attributes' => array(
|
362 |
-
'id'
|
363 |
-
),
|
364 |
-
);
|
365 |
-
|
366 |
-
foreach ( $migrate_props as $prop => $sub_props ) {
|
367 |
-
if ( empty( $instance[ $prop ] ) ) {
|
368 |
-
$instance[ $prop ] = array();
|
369 |
-
foreach ( $sub_props as $sub_prop ) {
|
370 |
-
if ( isset( $instance[ $sub_prop ] ) ) {
|
371 |
-
$instance[ $prop ][ $sub_prop ] = $instance[ $sub_prop ];
|
372 |
-
unset( $instance[ $sub_prop ] );
|
373 |
-
}
|
374 |
-
}
|
375 |
-
}
|
376 |
-
}
|
377 |
-
|
378 |
-
return $instance;
|
379 |
-
}
|
380 |
-
}
|
381 |
-
|
382 |
-
siteorigin_widget_register('sow-button', __FILE__, 'SiteOrigin_Widget_Button_Widget');
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Widget Name: Button
|
4 |
+
Description: A powerful yet simple button widget for your sidebars or Page Builder pages.
|
5 |
+
Author: SiteOrigin
|
6 |
+
Author URI: https://siteorigin.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
|
10 |
+
function __construct() {
|
11 |
+
|
12 |
+
parent::__construct(
|
13 |
+
'sow-button',
|
14 |
+
__('SiteOrigin Button', 'so-widgets-bundle'),
|
15 |
+
array(
|
16 |
+
'description' => __('A customizable button widget.', 'so-widgets-bundle'),
|
17 |
+
'help' => 'https://siteorigin.com/widgets-bundle/button-widget-documentation/'
|
18 |
+
),
|
19 |
+
array(
|
20 |
+
|
21 |
+
),
|
22 |
+
false,
|
23 |
+
plugin_dir_path(__FILE__)
|
24 |
+
);
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
function initialize() {
|
29 |
+
$this->register_frontend_styles(
|
30 |
+
array(
|
31 |
+
array(
|
32 |
+
'sow-button-base',
|
33 |
+
plugin_dir_url(__FILE__) . 'css/style.css',
|
34 |
+
array(),
|
35 |
+
SOW_BUNDLE_VERSION
|
36 |
+
),
|
37 |
+
)
|
38 |
+
);
|
39 |
+
}
|
40 |
+
|
41 |
+
function get_widget_form() {
|
42 |
+
return array(
|
43 |
+
'text' => array(
|
44 |
+
'type' => 'text',
|
45 |
+
'label' => __('Button text', 'so-widgets-bundle'),
|
46 |
+
),
|
47 |
+
|
48 |
+
'url' => array(
|
49 |
+
'type' => 'link',
|
50 |
+
'label' => __('Destination URL', 'so-widgets-bundle'),
|
51 |
+
),
|
52 |
+
|
53 |
+
'new_window' => array(
|
54 |
+
'type' => 'checkbox',
|
55 |
+
'default' => false,
|
56 |
+
'label' => __('Open in a new window', 'so-widgets-bundle'),
|
57 |
+
),
|
58 |
+
|
59 |
+
'button_icon' => array(
|
60 |
+
'type' => 'section',
|
61 |
+
'label' => __('Icon', 'so-widgets-bundle'),
|
62 |
+
'fields' => array(
|
63 |
+
'icon_selected' => array(
|
64 |
+
'type' => 'icon',
|
65 |
+
'label' => __('Icon', 'so-widgets-bundle'),
|
66 |
+
),
|
67 |
+
|
68 |
+
'icon_color' => array(
|
69 |
+
'type' => 'color',
|
70 |
+
'label' => __('Icon color', 'so-widgets-bundle'),
|
71 |
+
),
|
72 |
+
|
73 |
+
'icon' => array(
|
74 |
+
'type' => 'media',
|
75 |
+
'label' => __('Image icon', 'so-widgets-bundle'),
|
76 |
+
'description' => __('Replaces the icon with your own image icon.', 'so-widgets-bundle'),
|
77 |
+
),
|
78 |
+
|
79 |
+
'icon_placement' => array(
|
80 |
+
'type' => 'select',
|
81 |
+
'label' => __( 'Icon Placement', 'so-widgets-bundle' ),
|
82 |
+
'default' => 'left',
|
83 |
+
'options' => array(
|
84 |
+
'top' => __( 'Top', 'so-widgets-bundle' ),
|
85 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
86 |
+
'bottom' => __( 'Bottom', 'so-widgets-bundle' ),
|
87 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
88 |
+
),
|
89 |
+
),
|
90 |
+
),
|
91 |
+
),
|
92 |
+
|
93 |
+
'design' => array(
|
94 |
+
'type' => 'section',
|
95 |
+
'label' => __('Design and layout', 'so-widgets-bundle'),
|
96 |
+
'hide' => true,
|
97 |
+
'fields' => array(
|
98 |
+
|
99 |
+
'width' => array(
|
100 |
+
'type' => 'measurement',
|
101 |
+
'label' => __( 'Width', 'so-widgets-bundle' ),
|
102 |
+
'description' => __( 'Leave blank to let the button resize according to content.', 'so-widgets-bundle' )
|
103 |
+
),
|
104 |
+
|
105 |
+
'align' => array(
|
106 |
+
'type' => 'select',
|
107 |
+
'label' => __('Align', 'so-widgets-bundle'),
|
108 |
+
'default' => 'center',
|
109 |
+
'options' => array(
|
110 |
+
'left' => __('Left', 'so-widgets-bundle'),
|
111 |
+
'right' => __('Right', 'so-widgets-bundle'),
|
112 |
+
'center' => __('Center', 'so-widgets-bundle'),
|
113 |
+
'justify' => __('Justify', 'so-widgets-bundle'),
|
114 |
+
),
|
115 |
+
),
|
116 |
+
|
117 |
+
'theme' => array(
|
118 |
+
'type' => 'select',
|
119 |
+
'label' => __('Button theme', 'so-widgets-bundle'),
|
120 |
+
'default' => 'atom',
|
121 |
+
'options' => array(
|
122 |
+
'atom' => __('Atom', 'so-widgets-bundle'),
|
123 |
+
'flat' => __('Flat', 'so-widgets-bundle'),
|
124 |
+
'wire' => __('Wire', 'so-widgets-bundle'),
|
125 |
+
),
|
126 |
+
),
|
127 |
+
|
128 |
+
|
129 |
+
'button_color' => array(
|
130 |
+
'type' => 'color',
|
131 |
+
'label' => __('Button color', 'so-widgets-bundle'),
|
132 |
+
),
|
133 |
+
|
134 |
+
'text_color' => array(
|
135 |
+
'type' => 'color',
|
136 |
+
'label' => __('Text color', 'so-widgets-bundle'),
|
137 |
+
),
|
138 |
+
|
139 |
+
'hover' => array(
|
140 |
+
'type' => 'checkbox',
|
141 |
+
'default' => true,
|
142 |
+
'label' => __('Use hover effects', 'so-widgets-bundle'),
|
143 |
+
),
|
144 |
+
|
145 |
+
'font' => array(
|
146 |
+
'type' => 'font',
|
147 |
+
'label' => __( 'Font', 'so-widgets-bundle' ),
|
148 |
+
'default' => 'default'
|
149 |
+
),
|
150 |
+
|
151 |
+
'font_size' => array(
|
152 |
+
'type' => 'select',
|
153 |
+
'label' => __('Font size', 'so-widgets-bundle'),
|
154 |
+
'options' => array(
|
155 |
+
'1' => __('Normal', 'so-widgets-bundle'),
|
156 |
+
'1.15' => __('Medium', 'so-widgets-bundle'),
|
157 |
+
'1.3' => __('Large', 'so-widgets-bundle'),
|
158 |
+
'1.45' => __('Extra large', 'so-widgets-bundle'),
|
159 |
+
),
|
160 |
+
),
|
161 |
+
|
162 |
+
'rounding' => array(
|
163 |
+
'type' => 'select',
|
164 |
+
'label' => __('Rounding', 'so-widgets-bundle'),
|
165 |
+
'default' => '0.25',
|
166 |
+
'options' => array(
|
167 |
+
'0' => __('None', 'so-widgets-bundle'),
|
168 |
+
'0.25' => __('Slightly rounded', 'so-widgets-bundle'),
|
169 |
+
'0.5' => __('Very rounded', 'so-widgets-bundle'),
|
170 |
+
'1.5' => __('Completely rounded', 'so-widgets-bundle'),
|
171 |
+
),
|
172 |
+
),
|
173 |
+
|
174 |
+
'padding' => array(
|
175 |
+
'type' => 'select',
|
176 |
+
'label' => __('Padding', 'so-widgets-bundle'),
|
177 |
+
'default' => '1',
|
178 |
+
'options' => array(
|
179 |
+
'0.5' => __('Low', 'so-widgets-bundle'),
|
180 |
+
'1' => __('Medium', 'so-widgets-bundle'),
|
181 |
+
'1.4' => __('High', 'so-widgets-bundle'),
|
182 |
+
'1.8' => __('Very high', 'so-widgets-bundle'),
|
183 |
+
),
|
184 |
+
),
|
185 |
+
|
186 |
+
),
|
187 |
+
),
|
188 |
+
|
189 |
+
'attributes' => array(
|
190 |
+
'type' => 'section',
|
191 |
+
'label' => __('Other attributes and SEO', 'so-widgets-bundle'),
|
192 |
+
'hide' => true,
|
193 |
+
'fields' => array(
|
194 |
+
'id' => array(
|
195 |
+
'type' => 'text',
|
196 |
+
'label' => __('Button ID', 'so-widgets-bundle'),
|
197 |
+
'description' => __('An ID attribute allows you to target this button in Javascript.', 'so-widgets-bundle'),
|
198 |
+
),
|
199 |
+
|
200 |
+
'classes' => array(
|
201 |
+
'type' => 'text',
|
202 |
+
'label' => __('Button Classes', 'so-widgets-bundle'),
|
203 |
+
'description' => __('Additional CSS classes added to the button link.', 'so-widgets-bundle'),
|
204 |
+
),
|
205 |
+
|
206 |
+
'title' => array(
|
207 |
+
'type' => 'text',
|
208 |
+
'label' => __('Title attribute', 'so-widgets-bundle'),
|
209 |
+
'description' => __('Adds a title attribute to the button link.', 'so-widgets-bundle'),
|
210 |
+
),
|
211 |
+
|
212 |
+
'onclick' => array(
|
213 |
+
'type' => 'text',
|
214 |
+
'label' => __('Onclick', 'so-widgets-bundle'),
|
215 |
+
'description' => __('Run this Javascript when the button is clicked. Ideal for tracking.', 'so-widgets-bundle'),
|
216 |
+
),
|
217 |
+
|
218 |
+
'rel' => array(
|
219 |
+
'type' => 'text',
|
220 |
+
'label' => __('Rel attribute', 'so-widgets-bundle'),
|
221 |
+
'description' => __('Adds a rel attribute to the button link.', 'so-widgets-bundle'),
|
222 |
+
),
|
223 |
+
)
|
224 |
+
),
|
225 |
+
);
|
226 |
+
}
|
227 |
+
|
228 |
+
function get_style_name($instance) {
|
229 |
+
if(empty($instance['design']['theme'])) return 'atom';
|
230 |
+
return $instance['design']['theme'];
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Get the variables for the button widget.
|
235 |
+
*
|
236 |
+
* @param $instance
|
237 |
+
* @param $args
|
238 |
+
*
|
239 |
+
* @return array
|
240 |
+
*/
|
241 |
+
function get_template_variables( $instance, $args ) {
|
242 |
+
$button_attributes = array();
|
243 |
+
|
244 |
+
$attributes = $instance['attributes'];
|
245 |
+
|
246 |
+
$classes = ! empty( $attributes['classes'] ) ? $attributes['classes'] : '';
|
247 |
+
if ( ! empty( $classes ) ) {
|
248 |
+
$classes .= ' ';
|
249 |
+
}
|
250 |
+
$classes .= 'ow-icon-placement-'. $instance['button_icon']['icon_placement'];
|
251 |
+
if ( ! empty( $instance['design']['hover'] ) ) {
|
252 |
+
$classes .= ' ow-button-hover';
|
253 |
+
}
|
254 |
+
|
255 |
+
$button_attributes['class'] = implode( ' ',
|
256 |
+
array_map( 'sanitize_html_class',
|
257 |
+
explode( ' ', $classes )
|
258 |
+
)
|
259 |
+
);
|
260 |
+
|
261 |
+
if ( ! empty( $instance['new_window'] ) ) {
|
262 |
+
$button_attributes['target'] = '_blank';
|
263 |
+
$button_attributes['rel'] = 'noopener noreferrer';
|
264 |
+
}
|
265 |
+
|
266 |
+
if ( ! empty( $attributes['id'] ) ) {
|
267 |
+
$button_attributes['id'] = $attributes['id'];
|
268 |
+
}
|
269 |
+
if ( ! empty( $attributes['title'] ) ) {
|
270 |
+
$button_attributes['title'] = $attributes['title'];
|
271 |
+
}
|
272 |
+
if ( ! empty( $attributes['rel'] ) ) {
|
273 |
+
if ( isset ( $button_attributes['rel'] ) ) {
|
274 |
+
$button_attributes['rel'] .= " $attributes[rel]";
|
275 |
+
} else {
|
276 |
+
$button_attributes['rel'] = $attributes['rel'];
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
$icon_image_url = '';
|
281 |
+
if( ! empty( $instance['button_icon']['icon'] ) ) {
|
282 |
+
$attachment = wp_get_attachment_image_src( $instance['button_icon']['icon'] );
|
283 |
+
|
284 |
+
if ( ! empty( $attachment ) ) {
|
285 |
+
$icon_image_url = $attachment[0];
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
return array(
|
290 |
+
'button_attributes' => $button_attributes,
|
291 |
+
'href' => !empty( $instance['url'] ) ? $instance['url'] : '#',
|
292 |
+
'onclick' => ! empty( $attributes['onclick'] ) ? $attributes['onclick'] : '',
|
293 |
+
'align' => $instance['design']['align'],
|
294 |
+
'icon_image_url' => $icon_image_url,
|
295 |
+
'icon' => $instance['button_icon']['icon_selected'],
|
296 |
+
'icon_color' => $instance['button_icon']['icon_color'],
|
297 |
+
'text' => $instance['text'],
|
298 |
+
);
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Get the variables that we'll be injecting into the less stylesheet.
|
303 |
+
*
|
304 |
+
* @param $instance
|
305 |
+
*
|
306 |
+
* @return array
|
307 |
+
*/
|
308 |
+
function get_less_variables($instance){
|
309 |
+
if( empty( $instance ) || empty( $instance['design'] ) ) return array();
|
310 |
+
|
311 |
+
$less_vars = array(
|
312 |
+
'button_width' => isset( $instance['design']['width'] ) ? $instance['design']['width'] : '',
|
313 |
+
'button_color' => isset($instance['design']['button_color']) ? $instance['design']['button_color'] : '',
|
314 |
+
'text_color' => isset($instance['design']['text_color']) ? $instance['design']['text_color'] : '',
|
315 |
+
|
316 |
+
'font_size' => isset($instance['design']['font_size']) ? $instance['design']['font_size'] . 'em' : '',
|
317 |
+
'rounding' => isset($instance['design']['rounding']) ? $instance['design']['rounding'] . 'em' : '',
|
318 |
+
'padding' => isset($instance['design']['padding']) ? $instance['design']['padding'] . 'em' : '',
|
319 |
+
'has_text' => empty( $instance['text'] ) ? 'false' : 'true',
|
320 |
+
);
|
321 |
+
|
322 |
+
if ( ! empty( $instance['design']['font'] ) ) {
|
323 |
+
$font = siteorigin_widget_get_font( $instance['design']['font'] );
|
324 |
+
$less_vars['button_font'] = $font['family'];
|
325 |
+
if ( ! empty( $font['weight'] ) ) {
|
326 |
+
$less_vars['button_font_weight'] = $font['weight'];
|
327 |
+
}
|
328 |
+
}
|
329 |
+
return $less_vars;
|
330 |
+
}
|
331 |
+
|
332 |
+
function get_google_font_fields( $instance ) {
|
333 |
+
return array(
|
334 |
+
$instance['design']['font'],
|
335 |
+
);
|
336 |
+
}
|
337 |
+
/**
|
338 |
+
* Make sure the instance is the most up to date version.
|
339 |
+
*
|
340 |
+
* @param $instance
|
341 |
+
*
|
342 |
+
* @return mixed
|
343 |
+
*/
|
344 |
+
function modify_instance( $instance ) {
|
345 |
+
$migrate_props = array(
|
346 |
+
'button_icon' => array(
|
347 |
+
'icon_selected',
|
348 |
+
'icon_color',
|
349 |
+
'icon',
|
350 |
+
),
|
351 |
+
'design' => array(
|
352 |
+
'align',
|
353 |
+
'theme',
|
354 |
+
'button_color',
|
355 |
+
'text_color',
|
356 |
+
'hover',
|
357 |
+
'font_size',
|
358 |
+
'rounding',
|
359 |
+
'padding',
|
360 |
+
),
|
361 |
+
'attributes' => array(
|
362 |
+
'id'
|
363 |
+
),
|
364 |
+
);
|
365 |
+
|
366 |
+
foreach ( $migrate_props as $prop => $sub_props ) {
|
367 |
+
if ( empty( $instance[ $prop ] ) ) {
|
368 |
+
$instance[ $prop ] = array();
|
369 |
+
foreach ( $sub_props as $sub_prop ) {
|
370 |
+
if ( isset( $instance[ $sub_prop ] ) ) {
|
371 |
+
$instance[ $prop ][ $sub_prop ] = $instance[ $sub_prop ];
|
372 |
+
unset( $instance[ $sub_prop ] );
|
373 |
+
}
|
374 |
+
}
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
return $instance;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
siteorigin_widget_register('sow-button', __FILE__, 'SiteOrigin_Widget_Button_Widget');
|
widgets/button/css/style.css
CHANGED
@@ -1,45 +1 @@
|
|
1 |
-
.ow-button-base {
|
2 |
-
zoom: 1;
|
3 |
-
/* All the special styles */
|
4 |
-
}
|
5 |
-
.ow-button-base:before {
|
6 |
-
content: '';
|
7 |
-
display: block;
|
8 |
-
}
|
9 |
-
.ow-button-base:after {
|
10 |
-
content: '';
|
11 |
-
display: table;
|
12 |
-
clear: both;
|
13 |
-
}
|
14 |
-
.ow-button-base a {
|
15 |
-
text-align: center;
|
16 |
-
display: inline-block;
|
17 |
-
cursor: pointer;
|
18 |
-
text-decoration: none;
|
19 |
-
line-height: 1em;
|
20 |
-
}
|
21 |
-
.ow-button-base a .sow-icon-image,
|
22 |
-
.ow-button-base a [class^="sow-icon-"] {
|
23 |
-
font-size: 1.3em;
|
24 |
-
height: 1em;
|
25 |
-
width: auto;
|
26 |
-
margin: -0.1em 0.75em -0.2em -0.75em;
|
27 |
-
display: block;
|
28 |
-
float: left;
|
29 |
-
}
|
30 |
-
.ow-button-base a .sow-icon-image {
|
31 |
-
width: 1em;
|
32 |
-
background-size: cover;
|
33 |
-
}
|
34 |
-
.ow-button-base.ow-button-align-left {
|
35 |
-
text-align: left;
|
36 |
-
}
|
37 |
-
.ow-button-base.ow-button-align-right {
|
38 |
-
text-align: right;
|
39 |
-
}
|
40 |
-
.ow-button-base.ow-button-align-center {
|
41 |
-
text-align: center;
|
42 |
-
}
|
43 |
-
.ow-button-base.ow-button-align-justify a {
|
44 |
-
display: block;
|
45 |
-
}
|
1 |
+
.ow-button-base{zoom:1}.ow-button-base:before{content:'';display:block}.ow-button-base:after{content:'';display:table;clear:both}.ow-button-base a{text-align:center;display:inline-block;cursor:pointer;text-decoration:none;line-height:1em}.ow-button-base a .sow-icon-image,.ow-button-base a [class^="sow-icon-"]{font-size:1.3em;height:1em;width:auto;margin:-0.1em .75em -0.2em -0.75em;display:block;float:left}.ow-button-base a .sow-icon-image{width:1em;background-size:cover}.ow-button-base a.ow-icon-placement-top .sow-icon-image,.ow-button-base a.ow-icon-placement-top [class^="sow-icon-"]{margin:0 auto .5em;float:none}.ow-button-base a.ow-icon-placement-right .sow-icon-image,.ow-button-base a.ow-icon-placement-right [class^="sow-icon-"]{margin:-0.1em -0.75em -0.2em .75em;float:right}.ow-button-base a.ow-icon-placement-bottom .sow-icon-image,.ow-button-base a.ow-icon-placement-bottom [class^="sow-icon-"]{float:none;margin:.5em auto 0}.ow-button-base a.ow-icon-placement-bottom>span{display:flex;flex-direction:column-reverse}.ow-button-base a.ow-icon-placement-left .sow-icon-image,.ow-button-base a.ow-icon-placement-left [class^="sow-icon-"]{margin:-0.1em .75em -0.2em -0.75em;float:left}.ow-button-base.ow-button-align-left{text-align:left}.ow-button-base.ow-button-align-right{text-align:right}.ow-button-base.ow-button-align-center{text-align:center}.ow-button-base.ow-button-align-justify a{display:block}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/button/styles/atom.less
CHANGED
@@ -1,59 +1,59 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@button_width: '';
|
6 |
-
@button_color: #41a9d5;
|
7 |
-
@border_color: darken(@button_color, 15%);
|
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;
|
16 |
-
@has_text: true;
|
17 |
-
|
18 |
-
.ow-button-base {
|
19 |
-
|
20 |
-
a {
|
21 |
-
.box-sizing(border-box);
|
22 |
-
& when( isnumber( @button_width ) ) {
|
23 |
-
width: @button_width;
|
24 |
-
}
|
25 |
-
.font(@button_font, @button_font_weight);
|
26 |
-
|
27 |
-
font-size: @font_size;
|
28 |
-
padding: @padding @padding*2;
|
29 |
-
.gradient(@button_color, darken(@button_color, 10%), @button_color);
|
30 |
-
border: 1px solid;
|
31 |
-
border-color: lighten(@border_color, 2%) @border_color darken(@border_color, 3%) @border_color;
|
32 |
-
|
33 |
-
color: @text_color !important;
|
34 |
-
|
35 |
-
.rounded(@rounding);
|
36 |
-
|
37 |
-
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.065)");
|
38 |
-
text-shadow: 0 1px 0 rgba(0,0,0,0.05);
|
39 |
-
|
40 |
-
& when not ( @has_text = true ) {
|
41 |
-
.sow-icon-image,
|
42 |
-
[class^="sow-icon-"] {
|
43 |
-
margin: 0;
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
&:visited,
|
48 |
-
&:active,
|
49 |
-
&:hover{
|
50 |
-
color: @text_color !important;
|
51 |
-
}
|
52 |
-
|
53 |
-
&.ow-button-hover:hover {
|
54 |
-
.gradient(lighten(@button_color, 2%), lighten(darken(@button_color, 10%), 2%), lighten(@button_color, 2%));
|
55 |
-
border-color: lighten(lighten(@border_color, 2%), 2%) lighten(@border_color, 2%) darken(lighten(@border_color, 2%), 3%) lighten(@border_color, 2%);
|
56 |
-
color: lighten(@text_color, 2%);
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@button_width: '';
|
6 |
+
@button_color: #41a9d5;
|
7 |
+
@border_color: darken(@button_color, 15%);
|
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;
|
16 |
+
@has_text: true;
|
17 |
+
|
18 |
+
.ow-button-base {
|
19 |
+
|
20 |
+
a {
|
21 |
+
.box-sizing(border-box);
|
22 |
+
& when( isnumber( @button_width ) ) {
|
23 |
+
width: @button_width;
|
24 |
+
}
|
25 |
+
.font(@button_font, @button_font_weight);
|
26 |
+
|
27 |
+
font-size: @font_size;
|
28 |
+
padding: @padding @padding*2;
|
29 |
+
.gradient(@button_color, darken(@button_color, 10%), @button_color);
|
30 |
+
border: 1px solid;
|
31 |
+
border-color: lighten(@border_color, 2%) @border_color darken(@border_color, 3%) @border_color;
|
32 |
+
|
33 |
+
color: @text_color !important;
|
34 |
+
|
35 |
+
.rounded(@rounding);
|
36 |
+
|
37 |
+
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.065)");
|
38 |
+
text-shadow: 0 1px 0 rgba(0,0,0,0.05);
|
39 |
+
|
40 |
+
& when not ( @has_text = true ) {
|
41 |
+
.sow-icon-image,
|
42 |
+
[class^="sow-icon-"] {
|
43 |
+
margin: 0;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
&:visited,
|
48 |
+
&:active,
|
49 |
+
&:hover{
|
50 |
+
color: @text_color !important;
|
51 |
+
}
|
52 |
+
|
53 |
+
&.ow-button-hover:hover {
|
54 |
+
.gradient(lighten(@button_color, 2%), lighten(darken(@button_color, 10%), 2%), lighten(@button_color, 2%));
|
55 |
+
border-color: lighten(lighten(@border_color, 2%), 2%) lighten(@border_color, 2%) darken(lighten(@border_color, 2%), 3%) lighten(@border_color, 2%);
|
56 |
+
color: lighten(@text_color, 2%);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
widgets/button/styles/flat.less
CHANGED
@@ -1,59 +1,59 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@button_width: '';
|
6 |
-
@button_color: #41a9d5;
|
7 |
-
@border_color: darken(@button_color, 5%);
|
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;
|
16 |
-
@has_text: true;
|
17 |
-
|
18 |
-
.ow-button-base {
|
19 |
-
.clearfix();
|
20 |
-
|
21 |
-
a {
|
22 |
-
.box-sizing(border-box);
|
23 |
-
& when( isnumber( @button_width ) ) {
|
24 |
-
width: @button_width;
|
25 |
-
}
|
26 |
-
.font(@button_font, @button_font_weight);
|
27 |
-
|
28 |
-
font-size: @font_size;
|
29 |
-
padding: @padding @padding*2;
|
30 |
-
background: @button_color;
|
31 |
-
|
32 |
-
color: @text_color !important;
|
33 |
-
border: 1px solid @button_color;
|
34 |
-
border-width: 1px 0;
|
35 |
-
|
36 |
-
.rounded(@rounding);
|
37 |
-
|
38 |
-
text-shadow: 0 1px 0 rgba(0,0,0,0.05);
|
39 |
-
|
40 |
-
& when not ( @has_text = true ) {
|
41 |
-
.sow-icon-image,
|
42 |
-
[class^="sow-icon-"] {
|
43 |
-
margin: 0;
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
&:visited,
|
48 |
-
&:active,
|
49 |
-
&:hover{
|
50 |
-
color: @text_color !important;
|
51 |
-
}
|
52 |
-
|
53 |
-
&.ow-button-hover:hover {
|
54 |
-
background: lighten(@button_color, 4%);
|
55 |
-
border-bottom-color: lighten(@border_color, 4%);
|
56 |
-
color: lighten(@text_color, 4%);
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@button_width: '';
|
6 |
+
@button_color: #41a9d5;
|
7 |
+
@border_color: darken(@button_color, 5%);
|
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;
|
16 |
+
@has_text: true;
|
17 |
+
|
18 |
+
.ow-button-base {
|
19 |
+
.clearfix();
|
20 |
+
|
21 |
+
a {
|
22 |
+
.box-sizing(border-box);
|
23 |
+
& when( isnumber( @button_width ) ) {
|
24 |
+
width: @button_width;
|
25 |
+
}
|
26 |
+
.font(@button_font, @button_font_weight);
|
27 |
+
|
28 |
+
font-size: @font_size;
|
29 |
+
padding: @padding @padding*2;
|
30 |
+
background: @button_color;
|
31 |
+
|
32 |
+
color: @text_color !important;
|
33 |
+
border: 1px solid @button_color;
|
34 |
+
border-width: 1px 0;
|
35 |
+
|
36 |
+
.rounded(@rounding);
|
37 |
+
|
38 |
+
text-shadow: 0 1px 0 rgba(0,0,0,0.05);
|
39 |
+
|
40 |
+
& when not ( @has_text = true ) {
|
41 |
+
.sow-icon-image,
|
42 |
+
[class^="sow-icon-"] {
|
43 |
+
margin: 0;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
&:visited,
|
48 |
+
&:active,
|
49 |
+
&:hover{
|
50 |
+
color: @text_color !important;
|
51 |
+
}
|
52 |
+
|
53 |
+
&.ow-button-hover:hover {
|
54 |
+
background: lighten(@button_color, 4%);
|
55 |
+
border-bottom-color: lighten(@border_color, 4%);
|
56 |
+
color: lighten(@text_color, 4%);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
widgets/button/styles/wire.less
CHANGED
@@ -1,56 +1,56 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@button_width: '';
|
6 |
-
@button_color: #41a9d5;
|
7 |
-
@text_color: #FFFFFF;
|
8 |
-
|
9 |
-
@button_font: default;
|
10 |
-
@button_font_weight: default;
|
11 |
-
|
12 |
-
@font_size: 1em;
|
13 |
-
@rounding: 0.25em;
|
14 |
-
@padding: 1em;
|
15 |
-
@has_text: true;
|
16 |
-
|
17 |
-
.ow-button-base {
|
18 |
-
.clearfix();
|
19 |
-
|
20 |
-
a {
|
21 |
-
.box-sizing(border-box);
|
22 |
-
& when( isnumber( @button_width ) ) {
|
23 |
-
width: @button_width;
|
24 |
-
}
|
25 |
-
.font(@button_font, @button_font_weight);
|
26 |
-
|
27 |
-
font-size: @font_size;
|
28 |
-
padding: @padding @padding*2;
|
29 |
-
background: transparent;
|
30 |
-
border: 2px solid @button_color;
|
31 |
-
|
32 |
-
color: @button_color !important;
|
33 |
-
|
34 |
-
.rounded(@rounding);
|
35 |
-
|
36 |
-
text-shadow: 0 1px 0 rgba(0,0,0,0.05);
|
37 |
-
|
38 |
-
& when not ( @has_text = true ) {
|
39 |
-
.sow-icon-image,
|
40 |
-
[class^="sow-icon-"] {
|
41 |
-
margin: 0;
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
&:visited,
|
46 |
-
&:active,
|
47 |
-
&:hover{
|
48 |
-
color: @button_color !important;
|
49 |
-
}
|
50 |
-
|
51 |
-
&.ow-button-hover:hover {
|
52 |
-
background: @button_color;
|
53 |
-
color: @text_color !important;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@button_width: '';
|
6 |
+
@button_color: #41a9d5;
|
7 |
+
@text_color: #FFFFFF;
|
8 |
+
|
9 |
+
@button_font: default;
|
10 |
+
@button_font_weight: default;
|
11 |
+
|
12 |
+
@font_size: 1em;
|
13 |
+
@rounding: 0.25em;
|
14 |
+
@padding: 1em;
|
15 |
+
@has_text: true;
|
16 |
+
|
17 |
+
.ow-button-base {
|
18 |
+
.clearfix();
|
19 |
+
|
20 |
+
a {
|
21 |
+
.box-sizing(border-box);
|
22 |
+
& when( isnumber( @button_width ) ) {
|
23 |
+
width: @button_width;
|
24 |
+
}
|
25 |
+
.font(@button_font, @button_font_weight);
|
26 |
+
|
27 |
+
font-size: @font_size;
|
28 |
+
padding: @padding @padding*2;
|
29 |
+
background: transparent;
|
30 |
+
border: 2px solid @button_color;
|
31 |
+
|
32 |
+
color: @button_color !important;
|
33 |
+
|
34 |
+
.rounded(@rounding);
|
35 |
+
|
36 |
+
text-shadow: 0 1px 0 rgba(0,0,0,0.05);
|
37 |
+
|
38 |
+
& when not ( @has_text = true ) {
|
39 |
+
.sow-icon-image,
|
40 |
+
[class^="sow-icon-"] {
|
41 |
+
margin: 0;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
&:visited,
|
46 |
+
&:active,
|
47 |
+
&:hover{
|
48 |
+
color: @button_color !important;
|
49 |
+
}
|
50 |
+
|
51 |
+
&.ow-button-hover:hover {
|
52 |
+
background: @button_color;
|
53 |
+
color: @text_color !important;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
widgets/contact/contact.php
CHANGED
@@ -1,1283 +1,1283 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Widget Name: Contact Form
|
5 |
-
Description: A light weight contact form builder.
|
6 |
-
Author: SiteOrigin
|
7 |
-
Author URI: https://siteorigin.com
|
8 |
-
*/
|
9 |
-
|
10 |
-
class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
11 |
-
|
12 |
-
function __construct() {
|
13 |
-
|
14 |
-
parent::__construct(
|
15 |
-
'sow-contact-form',
|
16 |
-
__( 'SiteOrigin Contact Form', 'so-widgets-bundle' ),
|
17 |
-
array(
|
18 |
-
'description' => __( 'Create a simple contact form for your users to get hold of you.', 'so-widgets-bundle' ),
|
19 |
-
),
|
20 |
-
array(),
|
21 |
-
false,
|
22 |
-
plugin_dir_path( __FILE__ )
|
23 |
-
);
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Initialize the contact form widget
|
28 |
-
*/
|
29 |
-
function initialize() {
|
30 |
-
$this->register_frontend_scripts(
|
31 |
-
array(
|
32 |
-
array(
|
33 |
-
'sow-contact',
|
34 |
-
plugin_dir_url( __FILE__ ) . 'js/contact' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
35 |
-
array( 'jquery' ),
|
36 |
-
SOW_BUNDLE_VERSION
|
37 |
-
)
|
38 |
-
)
|
39 |
-
);
|
40 |
-
add_filter( 'siteorigin_widgets_sanitize_field_multiple_emails', array( $this, 'sanitize_multiple_emails' ) );
|
41 |
-
}
|
42 |
-
|
43 |
-
function get_widget_form() {
|
44 |
-
return array(
|
45 |
-
'title' => array(
|
46 |
-
'type' => 'text',
|
47 |
-
'label' => __( 'Title', 'so-widgets-bundle' ),
|
48 |
-
'default' => __( 'Contact Us', 'so-widgets-bundle' ),
|
49 |
-
),
|
50 |
-
|
51 |
-
'display_title' => array(
|
52 |
-
'type' => 'checkbox',
|
53 |
-
'label' => __( 'Display title', 'so-widgets-bundle' ),
|
54 |
-
),
|
55 |
-
|
56 |
-
'settings' => array(
|
57 |
-
'type' => 'section',
|
58 |
-
'label' => __( 'Settings', 'so-widgets-bundle' ),
|
59 |
-
'hide' => true,
|
60 |
-
'fields' => array(
|
61 |
-
'to' => array(
|
62 |
-
'type' => 'text',
|
63 |
-
'label' => __( 'To email address', 'so-widgets-bundle' ),
|
64 |
-
'description' => __( 'Where contact emails will be delivered to. You can send to multiple emails by separating the emails with a comma (,)', 'so-widgets-bundle' ),
|
65 |
-
'sanitize' => 'multiple_emails',
|
66 |
-
),
|
67 |
-
'from' => array(
|
68 |
-
'type' => 'text',
|
69 |
-
'label' => __( 'From email address', 'so-widgets-bundle' ),
|
70 |
-
'description' => __( 'It will appear as if emails are sent from this address. Ideally this should be in the same domain as this server to avoid spam filters.', 'so-widgets-bundle' ),
|
71 |
-
'sanitize' => 'email',
|
72 |
-
),
|
73 |
-
'default_subject' => array(
|
74 |
-
'type' => 'text',
|
75 |
-
'label' => __( 'Default subject', 'so-widgets-bundle' ),
|
76 |
-
'description' => __( "Subject to use when there isn't one available.", 'so-widgets-bundle' ),
|
77 |
-
),
|
78 |
-
'subject_prefix' => array(
|
79 |
-
'type' => 'text',
|
80 |
-
'label' => __( 'Subject prefix', 'so-widgets-bundle' ),
|
81 |
-
'description' => __( 'Prefix added to all incoming email subjects.', 'so-widgets-bundle' ),
|
82 |
-
),
|
83 |
-
'success_message' => array(
|
84 |
-
'type' => 'tinymce',
|
85 |
-
'label' => __( 'Success message', 'so-widgets-bundle' ),
|
86 |
-
'description' => __( 'Message to display after message successfully sent.', 'so-widgets-bundle' ),
|
87 |
-
'default' => __( "Thanks for contacting us. We'll get back to you shortly.", 'so-widgets-bundle' )
|
88 |
-
),
|
89 |
-
'submit_text' => array(
|
90 |
-
'type' => 'text',
|
91 |
-
'label' => __( 'Submit button text', 'so-widgets-bundle' ),
|
92 |
-
'default' => __( "Contact Us", 'so-widgets-bundle' )
|
93 |
-
),
|
94 |
-
'submit_id' => array(
|
95 |
-
'type' => 'text',
|
96 |
-
'label' => __( 'Button ID', 'so-widgets-bundle' ),
|
97 |
-
'description' => __( 'An ID attribute allows you to target this button in JavaScript.', 'so-widgets-bundle' ),
|
98 |
-
),
|
99 |
-
'onclick' => array(
|
100 |
-
'type' => 'text',
|
101 |
-
'label' => __( 'Onclick', 'so-widgets-bundle' ),
|
102 |
-
'description' => __( 'Run this JavaScript when the button is clicked. Ideal for tracking.', 'so-widgets-bundle' ),
|
103 |
-
),
|
104 |
-
'required_field_indicator' => array(
|
105 |
-
'type' => 'checkbox',
|
106 |
-
'label' => __( 'Indicate required fields with asterisk (*)', 'so-widgets-bundle' ),
|
107 |
-
'state_emitter' => array(
|
108 |
-
'callback' => 'conditional',
|
109 |
-
'args' => array(
|
110 |
-
'required_fields[show]: val',
|
111 |
-
'required_fields[hide]: ! val'
|
112 |
-
),
|
113 |
-
)
|
114 |
-
),
|
115 |
-
'required_field_indicator_message' => array(
|
116 |
-
'type' => 'text',
|
117 |
-
'label' => __( 'Required field indicator message', 'so-widgets-bundle' ),
|
118 |
-
'default' => __( 'Fields marked with * are required', 'so-widgets-bundle' ),
|
119 |
-
'state_handler' => array(
|
120 |
-
'required_fields[show]' => array( 'show' ),
|
121 |
-
'required_fields[hide]' => array( 'hide' ),
|
122 |
-
)
|
123 |
-
),
|
124 |
-
),
|
125 |
-
),
|
126 |
-
|
127 |
-
'fields' => array(
|
128 |
-
|
129 |
-
'type' => 'repeater',
|
130 |
-
'label' => __( 'Fields', 'so-widgets-bundle' ),
|
131 |
-
'item_name' => __( 'Field', 'so-widgets-bundle' ),
|
132 |
-
'item_label' => array(
|
133 |
-
'selector' => "[id*='label']",
|
134 |
-
),
|
135 |
-
'fields' => array(
|
136 |
-
|
137 |
-
'type' => array(
|
138 |
-
'type' => 'select',
|
139 |
-
'label' => __( 'Field Type', 'so-widgets-bundle' ),
|
140 |
-
'prompt' => __( 'Select Field Type', 'so-widgets-bundle' ),
|
141 |
-
'options' => array(
|
142 |
-
'name' => __( 'Name', 'so-widgets-bundle' ),
|
143 |
-
'email' => __( 'Email', 'so-widgets-bundle' ),
|
144 |
-
'subject' => __( 'Subject', 'so-widgets-bundle' ),
|
145 |
-
'text' => __( 'Text', 'so-widgets-bundle' ),
|
146 |
-
'textarea' => __( 'Text Area', 'so-widgets-bundle' ),
|
147 |
-
'select' => __( 'Dropdown Select', 'so-widgets-bundle' ),
|
148 |
-
'checkboxes' => __( 'Checkboxes', 'so-widgets-bundle' ),
|
149 |
-
'radio' => __( 'Radio', 'so-widgets-bundle' ),
|
150 |
-
),
|
151 |
-
'state_emitter' => array(
|
152 |
-
'callback' => 'select',
|
153 |
-
'args' => array( 'field_type_{$repeater}' ),
|
154 |
-
)
|
155 |
-
),
|
156 |
-
|
157 |
-
'label' => array(
|
158 |
-
'type' => 'text',
|
159 |
-
'label' => __( 'Label', 'so-widgets-bundle' ),
|
160 |
-
),
|
161 |
-
|
162 |
-
'description' => array(
|
163 |
-
'type' => 'text',
|
164 |
-
'label' => __( 'Description', 'so-widgets-bundle' ),
|
165 |
-
'description' => __( 'This text will appear small beneath the input field.', 'so-widgets-bundle' ),
|
166 |
-
),
|
167 |
-
|
168 |
-
'required' => array(
|
169 |
-
'type' => 'section',
|
170 |
-
'label' => __( 'Required Field', 'so-widgets-bundle' ),
|
171 |
-
'fields' => array(
|
172 |
-
'required' => array(
|
173 |
-
'type' => 'checkbox',
|
174 |
-
'label' => __( 'Required field', 'so-widgets-bundle' ),
|
175 |
-
'description' => __( 'Is this field required?', 'so-widgets-bundle' ),
|
176 |
-
),
|
177 |
-
'missing_message' => array(
|
178 |
-
'type' => 'text',
|
179 |
-
'label' => __( 'Missing message', 'so-widgets-bundle' ),
|
180 |
-
'description' => __( 'Error message to display if this field is missing.', 'so-widgets-bundle' ),
|
181 |
-
)
|
182 |
-
)
|
183 |
-
),
|
184 |
-
|
185 |
-
// This are for select, radio, and checkboxes
|
186 |
-
'options' => array(
|
187 |
-
'type' => 'repeater',
|
188 |
-
'label' => __( 'Options', 'so-widgets-bundle' ),
|
189 |
-
'item_name' => __( 'Option', 'so-widgets-bundle' ),
|
190 |
-
'item_label' => array( 'selector' => "[id*='value']" ),
|
191 |
-
'fields' => array(
|
192 |
-
'value' => array(
|
193 |
-
'type' => 'text',
|
194 |
-
'label' => __( 'Value', 'so-widgets-bundle' ),
|
195 |
-
),
|
196 |
-
),
|
197 |
-
|
198 |
-
// These are only required for a few states
|
199 |
-
'state_handler' => array(
|
200 |
-
'field_type_{$repeater}[select,checkboxes,radio]' => array( 'show' ),
|
201 |
-
'_else[field_type_{$repeater}]' => array( 'hide' ),
|
202 |
-
),
|
203 |
-
),
|
204 |
-
),
|
205 |
-
),
|
206 |
-
|
207 |
-
'spam' => array(
|
208 |
-
'type' => 'section',
|
209 |
-
'label' => __( 'Spam Protection', 'so-widgets-bundle' ),
|
210 |
-
'hide' => true,
|
211 |
-
'fields' => array(
|
212 |
-
|
213 |
-
'recaptcha' => array(
|
214 |
-
'type' => 'section',
|
215 |
-
'label' => __( 'reCAPTCHA', 'so-widgets-bundle' ),
|
216 |
-
'fields' => array(
|
217 |
-
'use_captcha' => array(
|
218 |
-
'type' => 'checkbox',
|
219 |
-
'label' => __( 'Use reCAPTCHA', 'so-widgets-bundle' ),
|
220 |
-
'default' => false,
|
221 |
-
),
|
222 |
-
'site_key' => array(
|
223 |
-
'type' => 'text',
|
224 |
-
'label' => __( 'reCAPTCHA Site Key', 'so-widgets-bundle' ),
|
225 |
-
),
|
226 |
-
'secret_key' => array(
|
227 |
-
'type' => 'text',
|
228 |
-
'label' => __( 'reCAPTCHA Secret Key', 'so-widgets-bundle' ),
|
229 |
-
),
|
230 |
-
'theme' => array(
|
231 |
-
'type' => 'select',
|
232 |
-
'label' => __( 'Theme', 'so-widgets-bundle' ),
|
233 |
-
'default' => 'light',
|
234 |
-
'options' => array(
|
235 |
-
'light' => __( 'Light', 'so-widgets-bundle' ),
|
236 |
-
'dark' => __( 'Dark', 'so-widgets-bundle' ),
|
237 |
-
),
|
238 |
-
),
|
239 |
-
'type' => array(
|
240 |
-
'type' => 'select',
|
241 |
-
'label' => __( 'Challenge type', 'so-widgets-bundle' ),
|
242 |
-
'default' => 'image',
|
243 |
-
'options' => array(
|
244 |
-
'image' => __( 'Image', 'so-widgets-bundle' ),
|
245 |
-
'audio' => __( 'Audio', 'so-widgets-bundle' ),
|
246 |
-
),
|
247 |
-
),
|
248 |
-
'size' => array(
|
249 |
-
'type' => 'select',
|
250 |
-
'label' => __( 'Size', 'so-widgets-bundle' ),
|
251 |
-
'default' => 'normal',
|
252 |
-
'options' => array(
|
253 |
-
'normal' => __( 'Normal', 'so-widgets-bundle' ),
|
254 |
-
'compact' => __( 'Compact', 'so-widgets-bundle' ),
|
255 |
-
),
|
256 |
-
),
|
257 |
-
)
|
258 |
-
),
|
259 |
-
|
260 |
-
'akismet' => array(
|
261 |
-
'type' => 'section',
|
262 |
-
'label' => __( 'Akismet', 'so-widgets-bundle' ),
|
263 |
-
'fields' => array(
|
264 |
-
'use_akismet' => array(
|
265 |
-
'type' => 'checkbox',
|
266 |
-
'label' => __( 'Use Akismet filtering', 'so-widgets-bundle' ),
|
267 |
-
'default' => true,
|
268 |
-
),
|
269 |
-
'spam_action' => array(
|
270 |
-
'type' => 'select',
|
271 |
-
'label' => __( 'Spam action', 'so-widgets-bundle' ),
|
272 |
-
'options' => array(
|
273 |
-
'error' => __( 'Show error message', 'so-widgets-bundle' ),
|
274 |
-
'tag' => __( 'Tag as spam in subject', 'so-widgets-bundle' ),
|
275 |
-
),
|
276 |
-
'description' => __( 'How to handle submissions that are identified as spam.', 'so-widgets-bundle' ),
|
277 |
-
'default' => 'error',
|
278 |
-
),
|
279 |
-
)
|
280 |
-
),
|
281 |
-
),
|
282 |
-
),
|
283 |
-
|
284 |
-
'design' => array(
|
285 |
-
'type' => 'section',
|
286 |
-
'label' => __( 'Design', 'so-widgets-bundle' ),
|
287 |
-
'hide' => true,
|
288 |
-
'fields' => array(
|
289 |
-
|
290 |
-
'container' => array(
|
291 |
-
'type' => 'section',
|
292 |
-
'label' => __( 'Container', 'so-widgets-bundle' ),
|
293 |
-
'fields' => array(
|
294 |
-
'background' => array(
|
295 |
-
'type' => 'color',
|
296 |
-
'label' => __( 'Background color', 'so-widgets-bundle' ),
|
297 |
-
'default' => '#f2f2f2',
|
298 |
-
),
|
299 |
-
'padding' => array(
|
300 |
-
'type' => 'measurement',
|
301 |
-
'label' => __( 'Padding', 'so-widgets-bundle' ),
|
302 |
-
'default' => '10px',
|
303 |
-
),
|
304 |
-
'border_color' => array(
|
305 |
-
'type' => 'color',
|
306 |
-
'label' => __( 'Border color', 'so-widgets-bundle' ),
|
307 |
-
'default' => '#c0c0c0',
|
308 |
-
),
|
309 |
-
'border_width' => array(
|
310 |
-
'type' => 'measurement',
|
311 |
-
'label' => __( 'Border width', 'so-widgets-bundle' ),
|
312 |
-
'default' => '1px',
|
313 |
-
),
|
314 |
-
'border_style' => array(
|
315 |
-
'type' => 'select',
|
316 |
-
'label' => __( 'Border style', 'so-widgets-bundle' ),
|
317 |
-
'default' => 'solid',
|
318 |
-
'options' => array(
|
319 |
-
'none' => __( 'None', 'so-widgets-bundle' ),
|
320 |
-
'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
|
321 |
-
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
322 |
-
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
323 |
-
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
324 |
-
'double' => __( 'Double', 'so-widgets-bundle' ),
|
325 |
-
'groove' => __( 'Groove', 'so-widgets-bundle' ),
|
326 |
-
'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
|
327 |
-
'inset' => __( 'Inset', 'so-widgets-bundle' ),
|
328 |
-
'outset' => __( 'Outset', 'so-widgets-bundle' ),
|
329 |
-
)
|
330 |
-
),
|
331 |
-
)
|
332 |
-
),
|
333 |
-
|
334 |
-
'labels' => array(
|
335 |
-
'type' => 'section',
|
336 |
-
'label' => __( 'Field labels', 'so-widgets-bundle' ),
|
337 |
-
'fields' => array(
|
338 |
-
'font' => array(
|
339 |
-
'type' => 'font',
|
340 |
-
'label' => __( 'Font', 'so-widgets-bundle' ),
|
341 |
-
'default' => 'default',
|
342 |
-
),
|
343 |
-
'size' => array(
|
344 |
-
'type' => 'measurement',
|
345 |
-
'label' => __( 'Font size', 'so-widgets-bundle' ),
|
346 |
-
'default' => 'default',
|
347 |
-
),
|
348 |
-
'color' => array(
|
349 |
-
'type' => 'color',
|
350 |
-
'label' => __( 'Color', 'so-widgets-bundle' ),
|
351 |
-
'default' => 'default',
|
352 |
-
),
|
353 |
-
'position' => array(
|
354 |
-
'type' => 'select',
|
355 |
-
'label' => __( 'Position', 'so-widgets-bundle' ),
|
356 |
-
'default' => 'above',
|
357 |
-
'options' => array(
|
358 |
-
'above' => __( 'Above', 'so-widgets-bundle' ),
|
359 |
-
'below' => __( 'Below', 'so-widgets-bundle' ),
|
360 |
-
'left' => __( 'Left', 'so-widgets-bundle' ),
|
361 |
-
'right' => __( 'Right', 'so-widgets-bundle' ),
|
362 |
-
'inside' => __( 'Inside', 'so-widgets-bundle' ),
|
363 |
-
),
|
364 |
-
),
|
365 |
-
'width' => array(
|
366 |
-
'type' => 'measurement',
|
367 |
-
'label' => __( 'Width', 'so-widgets-bundle' ),
|
368 |
-
'default' => '',
|
369 |
-
),
|
370 |
-
'align' => array(
|
371 |
-
'type' => 'select',
|
372 |
-
'label' => __( 'Align', 'so-widgets-bundle' ),
|
373 |
-
'default' => 'left',
|
374 |
-
'options' => array(
|
375 |
-
'left' => __( 'Left', 'so-widgets-bundle' ),
|
376 |
-
'right' => __( 'Right', 'so-widgets-bundle' ),
|
377 |
-
'center' => __( 'Center', 'so-widgets-bundle' ),
|
378 |
-
'justify' => __( 'Justify', 'so-widgets-bundle' ),
|
379 |
-
)
|
380 |
-
),
|
381 |
-
),
|
382 |
-
),
|
383 |
-
|
384 |
-
'fields' => array(
|
385 |
-
'type' => 'section',
|
386 |
-
'label' => __( 'Fields', 'so-widgets-bundle' ),
|
387 |
-
'fields' => array(
|
388 |
-
'font' => array(
|
389 |
-
'type' => 'font',
|
390 |
-
'label' => __( 'Font', 'so-widgets-bundle' ),
|
391 |
-
'default' => 'default',
|
392 |
-
),
|
393 |
-
'font_size' => array(
|
394 |
-
'type' => 'measurement',
|
395 |
-
'label' => __( 'Font Size', 'so-widgets-bundle' )
|
396 |
-
),
|
397 |
-
'color' => array(
|
398 |
-
'type' => 'color',
|
399 |
-
'label' => __( 'Text Color', 'so-widgets-bundle' ),
|
400 |
-
),
|
401 |
-
'margin' => array(
|
402 |
-
'type' => 'measurement',
|
403 |
-
'label' => __( 'Margin', 'so-widgets-bundle' )
|
404 |
-
),
|
405 |
-
'padding' => array(
|
406 |
-
'type' => 'measurement',
|
407 |
-
'label' => __( 'Padding', 'so-widgets-bundle' )
|
408 |
-
),
|
409 |
-
'height' => array(
|
410 |
-
'type' => 'measurement',
|
411 |
-
'label' => __( 'Height', 'so-widgets-bundle' )
|
412 |
-
),
|
413 |
-
'background' => array(
|
414 |
-
'type' => 'color',
|
415 |
-
'label' => __( 'Background', 'so-widgets-bundle' ),
|
416 |
-
),
|
417 |
-
'border_color' => array(
|
418 |
-
'type' => 'color',
|
419 |
-
'label' => __( 'Border color', 'so-widgets-bundle' ),
|
420 |
-
'default' => '#c0c0c0',
|
421 |
-
),
|
422 |
-
'border_width' => array(
|
423 |
-
'type' => 'measurement',
|
424 |
-
'label' => __( 'Border width', 'so-widgets-bundle' ),
|
425 |
-
'default' => '1px',
|
426 |
-
),
|
427 |
-
'border_style' => array(
|
428 |
-
'type' => 'select',
|
429 |
-
'label' => __( ' Border style', 'so-widgets-bundle' ),
|
430 |
-
'default' => 'solid',
|
431 |
-
'options' => array(
|
432 |
-
'none' => __( 'None', 'so-widgets-bundle' ),
|
433 |
-
'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
|
434 |
-
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
435 |
-
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
436 |
-
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
437 |
-
'double' => __( 'Double', 'so-widgets-bundle' ),
|
438 |
-
'groove' => __( 'Groove', 'so-widgets-bundle' ),
|
439 |
-
'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
|
440 |
-
'inset' => __( 'Inset', 'so-widgets-bundle' ),
|
441 |
-
'outset' => __( 'Outset', 'so-widgets-bundle' ),
|
442 |
-
)
|
443 |
-
),
|
444 |
-
'border_radius' => array(
|
445 |
-
'type' => 'slider',
|
446 |
-
'label' => __( 'Border rounding', 'so-widgets-bundle' ),
|
447 |
-
'default' => 0,
|
448 |
-
'max' => 50,
|
449 |
-
'min' => 0
|
450 |
-
),
|
451 |
-
)
|
452 |
-
),
|
453 |
-
|
454 |
-
'descriptions' => array(
|
455 |
-
'type' => 'section',
|
456 |
-
'label' => __( 'Field descriptions', 'so-widgets-bundle' ),
|
457 |
-
'fields' => array(
|
458 |
-
'size' => array(
|
459 |
-
'type' => 'measurement',
|
460 |
-
'label' => __( 'Size', 'so-widgets-bundle' ),
|
461 |
-
'default' => '0.9em',
|
462 |
-
),
|
463 |
-
'color' => array(
|
464 |
-
'type' => 'color',
|
465 |
-
'label' => __( 'Color', 'so-widgets-bundle' ),
|
466 |
-
'default' => '#999999',
|
467 |
-
),
|
468 |
-
'style' => array(
|
469 |
-
'type' => 'select',
|
470 |
-
'label' => __( 'Style', 'so-widgets-bundle' ),
|
471 |
-
'default' => 'italic',
|
472 |
-
'options' => array(
|
473 |
-
'italic' => __( 'Italic', 'so-widgets-bundle' ),
|
474 |
-
'normal' => __( 'Normal', 'so-widgets-bundle' ),
|
475 |
-
)
|
476 |
-
),
|
477 |
-
)
|
478 |
-
),
|
479 |
-
|
480 |
-
'errors' => array(
|
481 |
-
'type' => 'section',
|
482 |
-
'label' => __( 'Error messages', 'so-widgets-bundle' ),
|
483 |
-
'fields' => array(
|
484 |
-
'background' => array(
|
485 |
-
'type' => 'color',
|
486 |
-
'label' => __( 'Error background color', 'so-widgets-bundle' ),
|
487 |
-
'default' => '#fce4e5',
|
488 |
-
),
|
489 |
-
'border_color' => array(
|
490 |
-
'type' => 'color',
|
491 |
-
'label' => __( 'Error border color', 'so-widgets-bundle' ),
|
492 |
-
'default' => '#ec666a',
|
493 |
-
),
|
494 |
-
'text_color' => array(
|
495 |
-
'type' => 'color',
|
496 |
-
'label' => __( 'Error text color', 'so-widgets-bundle' ),
|
497 |
-
'default' => '#ec666a',
|
498 |
-
),
|
499 |
-
'padding' => array(
|
500 |
-
'type' => 'measurement',
|
501 |
-
'label' => __( 'Error padding', 'so-widgets-bundle' ),
|
502 |
-
'default' => '5px',
|
503 |
-
),
|
504 |
-
'margin' => array(
|
505 |
-
'type' => 'measurement',
|
506 |
-
'label' => __( 'Error margin', 'so-widgets-bundle' ),
|
507 |
-
'default' => '10px',
|
508 |
-
),
|
509 |
-
)
|
510 |
-
),
|
511 |
-
|
512 |
-
'submit' => array(
|
513 |
-
'type' => 'section',
|
514 |
-
'label' => __( 'Submit button', 'so-widgets-bundle' ),
|
515 |
-
'fields' => array(
|
516 |
-
'styled' => array(
|
517 |
-
'type' => 'checkbox',
|
518 |
-
'label' => __( 'Style submit button', 'so-widgets-bundle' ),
|
519 |
-
'description' => __( 'Style the button or leave it with default theme styling.', 'so-widgets-bundle' ),
|
520 |
-
'default' => true,
|
521 |
-
),
|
522 |
-
|
523 |
-
'background_color' => array(
|
524 |
-
'type' => 'color',
|
525 |
-
'label' => __( 'Background color', 'so-widgets-bundle' ),
|
526 |
-
'default' => '#eeeeee',
|
527 |
-
),
|
528 |
-
'background_gradient' => array(
|
529 |
-
'type' => 'slider',
|
530 |
-
'label' => __( 'Gradient intensity', 'so-widgets-bundle' ),
|
531 |
-
'default' => 10,
|
532 |
-
),
|
533 |
-
'border_color' => array(
|
534 |
-
'type' => 'color',
|
535 |
-
'label' => __( 'Border color', 'so-widgets-bundle' ),
|
536 |
-
'default' => '#989a9c',
|
537 |
-
),
|
538 |
-
'border_style' => array(
|
539 |
-
'type' => 'select',
|
540 |
-
'label' => __( 'Border style', 'so-widgets-bundle' ),
|
541 |
-
'default' => 'solid',
|
542 |
-
'options' => array(
|
543 |
-
'none' => __( 'None', 'so-widgets-bundle' ),
|
544 |
-
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
545 |
-
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
546 |
-
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
547 |
-
)
|
548 |
-
),
|
549 |
-
'border_width' => array(
|
550 |
-
'type' => 'measurement',
|
551 |
-
'label' => __( 'Border width', 'so-widgets-bundle' ),
|
552 |
-
'default' => '1px',
|
553 |
-
),
|
554 |
-
'border_radius' => array(
|
555 |
-
'type' => 'slider',
|
556 |
-
'label' => __( 'Border rounding', 'so-widgets-bundle' ),
|
557 |
-
'default' => 3,
|
558 |
-
'max' => 50,
|
559 |
-
'min' => 0
|
560 |
-
),
|
561 |
-
'text_color' => array(
|
562 |
-
'type' => 'color',
|
563 |
-
'label' => __( 'Text color', 'so-widgets-bundle' ),
|
564 |
-
'default' => '#5a5a5a',
|
565 |
-
),
|
566 |
-
'font_size' => array(
|
567 |
-
'type' => 'measurement',
|
568 |
-
'label' => __( 'Font size', 'so-widgets-bundle' ),
|
569 |
-
'default' => 'default',
|
570 |
-
),
|
571 |
-
'weight' => array(
|
572 |
-
'type' => 'select',
|
573 |
-
'label' => __( 'Font weight', 'so-widgets-bundle' ),
|
574 |
-
'default' => '500',
|
575 |
-
'options' => array(
|
576 |
-
'normal' => __( 'Normal', 'so-widgets-bundle' ),
|
577 |
-
'500' => __( 'Semi-bold', 'so-widgets-bundle' ),
|
578 |
-
'bold' => __( 'Bold', 'so-widgets-bundle' ),
|
579 |
-
)
|
580 |
-
),
|
581 |
-
'padding' => array(
|
582 |
-
'type' => 'measurement',
|
583 |
-
'label' => __( 'Padding', 'so-widgets-bundle' ),
|
584 |
-
'default' => '10px',
|
585 |
-
),
|
586 |
-
'width' => array(
|
587 |
-
'type' => 'measurement',
|
588 |
-
'label' => __( 'Width', 'so-widgets-bundle' ),
|
589 |
-
),
|
590 |
-
'align' => array(
|
591 |
-
'type' => 'select',
|
592 |
-
'label' => __( 'Align', 'so-widgets-bundle' ),
|
593 |
-
'default' => 'left',
|
594 |
-
'options' => array(
|
595 |
-
'left' => __( 'Left', 'so-widgets-bundle' ),
|
596 |
-
'right' => __( 'Right', 'so-widgets-bundle' ),
|
597 |
-
'center' => __( 'Center', 'so-widgets-bundle' ),
|
598 |
-
)
|
599 |
-
),
|
600 |
-
'inset_highlight' => array(
|
601 |
-
'type' => 'slider',
|
602 |
-
'label' => __( 'Inset highlight', 'so-widgets-bundle' ),
|
603 |
-
'description' => __( 'The white highlight at the bottom of the button', 'so-widgets-bundle' ),
|
604 |
-
'default' => 50,
|
605 |
-
'max' => 100,
|
606 |
-
'min' => 0
|
607 |
-
),
|
608 |
-
)
|
609 |
-
),
|
610 |
-
|
611 |
-
'focus' => array(
|
612 |
-
'type' => 'section',
|
613 |
-
'label' => __( 'Input focus', 'so-widgets-bundle' ),
|
614 |
-
'fields' => array(
|
615 |
-
'style' => array(
|
616 |
-
'type' => 'select',
|
617 |
-
'label' => __( 'Style', 'so-widgets-bundle' ),
|
618 |
-
'default' => 'solid',
|
619 |
-
'options' => array(
|
620 |
-
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
621 |
-
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
622 |
-
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
623 |
-
'double' => __( 'Double', 'so-widgets-bundle' ),
|
624 |
-
'groove' => __( 'Groove', 'so-widgets-bundle' ),
|
625 |
-
'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
|
626 |
-
'inset' => __( 'Inset', 'so-widgets-bundle' ),
|
627 |
-
'outset' => __( 'Outset', 'so-widgets-bundle' ),
|
628 |
-
'none' => __( 'None', 'so-widgets-bundle' ),
|
629 |
-
'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
|
630 |
-
)
|
631 |
-
),
|
632 |
-
'color' => array(
|
633 |
-
'type' => 'color',
|
634 |
-
'label' => __( 'Color', 'so-widgets-bundle' ),
|
635 |
-
'default' => 'default',
|
636 |
-
),
|
637 |
-
'width' => array(
|
638 |
-
'type' => 'measurement',
|
639 |
-
'label' => __( 'Width', 'so-widgets-bundle' ),
|
640 |
-
'default' => '1px',
|
641 |
-
),
|
642 |
-
),
|
643 |
-
),
|
644 |
-
),
|
645 |
-
),
|
646 |
-
);
|
647 |
-
}
|
648 |
-
|
649 |
-
function get_form_teaser() {
|
650 |
-
if ( ! $this->display_siteorigin_premium_teaser() ) {
|
651 |
-
return false;
|
652 |
-
}
|
653 |
-
|
654 |
-
$url = add_query_arg( array(
|
655 |
-
'featured_addon' => 'plugin/contact-form-fields',
|
656 |
-
'featured_plugin' => 'widgets-bundle'
|
657 |
-
), 'https://siteorigin.com/downloads/premium/' );
|
658 |
-
|
659 |
-
return sprintf(
|
660 |
-
__( 'Get more form fields for the Contact Form Widget in %s', 'so-widgets-bundle' ),
|
661 |
-
'<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer">' . __( 'SiteOrigin Premium', 'so-widgets-bundle' ) . '</a>'
|
662 |
-
);
|
663 |
-
}
|
664 |
-
|
665 |
-
function sanitize_multiple_emails( $value ) {
|
666 |
-
$values = explode( ',', $value );
|
667 |
-
foreach ( $values as $i => $email ) {
|
668 |
-
$values[ $i ] = sanitize_email( $email );
|
669 |
-
}
|
670 |
-
|
671 |
-
return implode( ',', $values );
|
672 |
-
}
|
673 |
-
|
674 |
-
function modify_instance( $instance ) {
|
675 |
-
// Use this to set up an initial version of the
|
676 |
-
if ( empty( $instance['settings']['to'] ) ) {
|
677 |
-
$current_user = wp_get_current_user();
|
678 |
-
$instance['settings']['to'] = $current_user->user_email;
|
679 |
-
}
|
680 |
-
if ( empty( $instance['settings']['from'] ) ) {
|
681 |
-
$instance['settings']['from'] = get_option( 'admin_email' );
|
682 |
-
}
|
683 |
-
if ( empty( $instance['fields'] ) ) {
|
684 |
-
$instance['fields'] = array(
|
685 |
-
array(
|
686 |
-
'type' => 'name',
|
687 |
-
'label' => __( 'Your Name', 'so-widgets-bundle' ),
|
688 |
-
'required' => array(
|
689 |
-
'required' => true,
|
690 |
-
'missing_message' => __( 'Please enter your name', 'so-widgets-bundle' ),
|
691 |
-
),
|
692 |
-
),
|
693 |
-
array(
|
694 |
-
'type' => 'email',
|
695 |
-
'label' => __( 'Your Email', 'so-widgets-bundle' ),
|
696 |
-
'required' => array(
|
697 |
-
'required' => true,
|
698 |
-
'missing_message' => __( 'Please enter a valid email address', 'so-widgets-bundle' ),
|
699 |
-
),
|
700 |
-
),
|
701 |
-
array(
|
702 |
-
'type' => 'subject',
|
703 |
-
'label' => __( 'Subject', 'so-widgets-bundle' ),
|
704 |
-
'required' => array(
|
705 |
-
'required' => true,
|
706 |
-
'missing_message' => __( 'Please enter a subject', 'so-widgets-bundle' ),
|
707 |
-
),
|
708 |
-
),
|
709 |
-
array(
|
710 |
-
'type' => 'textarea',
|
711 |
-
'label' => __( 'Message', 'so-widgets-bundle' ),
|
712 |
-
'required' => array(
|
713 |
-
'required' => true,
|
714 |
-
'missing_message' => __( 'Please write something', 'so-widgets-bundle' ),
|
715 |
-
),
|
716 |
-
),
|
717 |
-
);
|
718 |
-
}
|
719 |
-
|
720 |
-
return $instance;
|
721 |
-
}
|
722 |
-
|
723 |
-
function get_template_variables( $instance, $args ) {
|
724 |
-
unset( $instance['title'] );
|
725 |
-
unset( $instance['display_title'] );
|
726 |
-
unset( $instance['design'] );
|
727 |
-
unset( $instance['panels_info'] );
|
728 |
-
|
729 |
-
// Include '_sow_form_id' in generation of 'instance_hash' to allow multiple instances of the same form on a page.
|
730 |
-
$instance_hash = md5( serialize( $instance ) );
|
731 |
-
unset( $instance['_sow_form_id'] );
|
732 |
-
|
733 |
-
$submit_attributes = array();
|
734 |
-
if ( ! empty( $instance['settings']['submit_id'] ) ) {
|
735 |
-
$submit_attributes['id'] = $instance['settings']['submit_id'];
|
736 |
-
}
|
737 |
-
|
738 |
-
return array(
|
739 |
-
'instance_hash' => $instance_hash,
|
740 |
-
'submit_attributes' => $submit_attributes,
|
741 |
-
'onclick' => ! empty( $instance['settings']['onclick'] ) ? $instance['settings']['onclick'] : '',
|
742 |
-
);
|
743 |
-
}
|
744 |
-
|
745 |
-
function get_less_variables( $instance ) {
|
746 |
-
if ( empty( $instance['design']['labels']['font'] ) ) {
|
747 |
-
$instance['design']['labels'] = array( 'font' => '' );
|
748 |
-
}
|
749 |
-
$label_font = siteorigin_widget_get_font( $instance['design']['labels']['font'] );
|
750 |
-
$field_font = siteorigin_widget_get_font( $instance['design']['fields']['font'] );
|
751 |
-
|
752 |
-
$label_position = $instance['design']['labels']['position'];
|
753 |
-
if ( $label_position != 'left' && $label_position != 'right' ) {
|
754 |
-
$label_position = 'default';
|
755 |
-
}
|
756 |
-
|
757 |
-
$vars = array(
|
758 |
-
// All the container variables.
|
759 |
-
'container_background' => $instance['design']['container']['background'],
|
760 |
-
'container_padding' => $instance['design']['container']['padding'],
|
761 |
-
'container_border_color' => $instance['design']['container']['border_color'],
|
762 |
-
'container_border_width' => $instance['design']['container']['border_width'],
|
763 |
-
'container_border_style' => $instance['design']['container']['border_style'],
|
764 |
-
|
765 |
-
// Field labels
|
766 |
-
'label_font_family' => $label_font['family'],
|
767 |
-
'label_font_weight' => ! empty( $label_font['weight'] ) ? $label_font['weight'] : '',
|
768 |
-
'label_font_size' => $instance['design']['labels']['size'],
|
769 |
-
'label_font_color' => $instance['design']['labels']['color'],
|
770 |
-
'label_position' => $label_position,
|
771 |
-
'label_width' => $instance['design']['labels']['width'],
|
772 |
-
'label_align' => $instance['design']['labels']['align'],
|
773 |
-
|
774 |
-
// Fields
|
775 |
-
'field_font_family' => $field_font['family'],
|
776 |
-
'field_font_weight' => ! empty( $field_font['weight'] ) ? $field_font['weight'] : '',
|
777 |
-
'field_font_size' => $instance['design']['fields']['font_size'],
|
778 |
-
'field_font_color' => $instance['design']['fields']['color'],
|
779 |
-
'field_margin' => $instance['design']['fields']['margin'],
|
780 |
-
'field_padding' => $instance['design']['fields']['padding'],
|
781 |
-
'field_height' => $instance['design']['fields']['height'],
|
782 |
-
'field_background' => $instance['design']['fields']['background'],
|
783 |
-
'field_border_color' => $instance['design']['fields']['border_color'],
|
784 |
-
'field_border_width' => $instance['design']['fields']['border_width'],
|
785 |
-
'field_border_style' => $instance['design']['fields']['border_style'],
|
786 |
-
'field_border_radius' => $instance['design']['fields']['border_radius'] . 'px',
|
787 |
-
|
788 |
-
// Field descriptions
|
789 |
-
'description_font_size' => $instance['design']['descriptions']['size'],
|
790 |
-
'description_font_color' => $instance['design']['descriptions']['color'],
|
791 |
-
'description_font_style' => $instance['design']['descriptions']['style'],
|
792 |
-
|
793 |
-
// The error message styles
|
794 |
-
'error_background' => $instance['design']['errors']['background'],
|
795 |
-
'error_border' => $instance['design']['errors']['border_color'],
|
796 |
-
'error_text' => $instance['design']['errors']['text_color'],
|
797 |
-
'error_padding' => $instance['design']['errors']['padding'],
|
798 |
-
'error_margin' => $instance['design']['errors']['margin'],
|
799 |
-
|
800 |
-
// The submit button
|
801 |
-
'submit_background_color' => $instance['design']['submit']['background_color'],
|
802 |
-
'submit_background_gradient' => $instance['design']['submit']['background_gradient'] . '%',
|
803 |
-
'submit_border_color' => $instance['design']['submit']['border_color'],
|
804 |
-
'submit_border_style' => $instance['design']['submit']['border_style'],
|
805 |
-
'submit_border_width' => $instance['design']['submit']['border_width'],
|
806 |
-
'submit_border_radius' => $instance['design']['submit']['border_radius'] . 'px',
|
807 |
-
'submit_text_color' => $instance['design']['submit']['text_color'],
|
808 |
-
'submit_font_size' => $instance['design']['submit']['font_size'],
|
809 |
-
'submit_weight' => $instance['design']['submit']['weight'],
|
810 |
-
'submit_padding' => $instance['design']['submit']['padding'],
|
811 |
-
'submit_width' => ! empty( $instance['design']['submit']['width'] ) ? $instance['design']['submit']['width'] : '',
|
812 |
-
'submit_align' => ! empty( $instance['design']['submit']['align'] ) ? $instance['design']['submit']['align'] : '',
|
813 |
-
'submit_inset_highlight' => $instance['design']['submit']['inset_highlight'] . '%',
|
814 |
-
|
815 |
-
// Input focus styles
|
816 |
-
'outline_style' => $instance['design']['focus']['style'],
|
817 |
-
'outline_color' => $instance['design']['focus']['color'],
|
818 |
-
'outline_width' => $instance['design']['focus']['width'],
|
819 |
-
);
|
820 |
-
|
821 |
-
return $vars;
|
822 |
-
}
|
823 |
-
|
824 |
-
function get_google_font_fields( $instance ) {
|
825 |
-
return array(
|
826 |
-
$instance['design']['labels']['font'],
|
827 |
-
$instance['design']['fields']['font'],
|
828 |
-
);
|
829 |
-
}
|
830 |
-
|
831 |
-
static function name_from_label( $label, & $ids ) {
|
832 |
-
$it = 0;
|
833 |
-
|
834 |
-
$label = str_replace( ' ', '-', strtolower( $label ) );
|
835 |
-
$label = sanitize_html_class( $label );
|
836 |
-
do {
|
837 |
-
$id = $label . ( $it > 0 ? '-' . $it : '' );
|
838 |
-
$it ++;
|
839 |
-
} while ( ! empty( $ids[ $id ] ) );
|
840 |
-
$ids[ $id ] = true;
|
841 |
-
|
842 |
-
return $id;
|
843 |
-
}
|
844 |
-
|
845 |
-
/**
|
846 |
-
* Render the form fields
|
847 |
-
*
|
848 |
-
* @param $fields
|
849 |
-
* @param array $errors
|
850 |
-
* @param $instance
|
851 |
-
*/
|
852 |
-
function render_form_fields( $fields, $errors = array(), $instance ) {
|
853 |
-
|
854 |
-
$field_ids = array();
|
855 |
-
$label_position = $instance['design']['labels']['position'];
|
856 |
-
|
857 |
-
$indicate_required_fields = $instance['settings']['required_field_indicator'];
|
858 |
-
|
859 |
-
if ( ! empty( $indicate_required_fields ) ) {
|
860 |
-
?>
|
861 |
-
<p><em><?php echo esc_html( $instance['settings']['required_field_indicator_message'] ) ?></em></p>
|
862 |
-
<?php
|
863 |
-
}
|
864 |
-
|
865 |
-
foreach ( $fields as $i => $field ) {
|
866 |
-
if ( empty( $field['type'] ) ) {
|
867 |
-
continue;
|
868 |
-
}
|
869 |
-
// Using `$instance['_sow_form_id']` to uniquely identify contact form fields across widgets.
|
870 |
-
// I.e. if there are many contact form widgets on a page this will prevent field name conflicts.
|
871 |
-
$field_name = $this->name_from_label( ! empty( $field['label'] ) ? $field['label'] : $i, $field_ids ) . '-' . $instance['_sow_form_id'];
|
872 |
-
$field_id = 'sow-contact-form-field-' . $field_name;
|
873 |
-
|
874 |
-
$value = '';
|
875 |
-
if ( ! empty( $_POST[ $field_name ] ) && wp_verify_nonce( $_POST['_wpnonce'], '_contact_form_submit' ) ) {
|
876 |
-
$value = stripslashes_deep( $_POST[ $field_name ] );
|
877 |
-
}
|
878 |
-
|
879 |
-
?>
|
880 |
-
<div class="sow-form-field sow-form-field-<?php echo sanitize_html_class( $field['type'] ) ?>"><?php
|
881 |
-
|
882 |
-
$label = $field['label'];
|
883 |
-
if ( $indicate_required_fields && ! empty( $field['required']['required'] ) ) {
|
884 |
-
$label .= '*';
|
885 |
-
}
|
886 |
-
$is_text_input_field = ( $field['type'] != 'select' && $field['type'] != 'radio' && $field['type'] != 'checkboxes' );
|
887 |
-
// label should be rendered before the field, then CSS will do the exact positioning.
|
888 |
-
$render_label_before_field = ( $label_position != 'below' && $label_position != 'inside' ) || ( $label_position == 'inside' && ! $is_text_input_field );
|
889 |
-
if ( empty( $label_position ) || $render_label_before_field ) {
|
890 |
-
$this->render_form_label( $field_id, $label, $label_position );
|
891 |
-
}
|
892 |
-
|
893 |
-
$show_placeholder = $label_position == 'inside';
|
894 |
-
|
895 |
-
if ( ! empty( $errors[ $field_name ] ) ) {
|
896 |
-
?>
|
897 |
-
<div class="sow-error">
|
898 |
-
<?php echo wp_kses_post( $errors[ $field_name ] ) ?>
|
899 |
-
</div>
|
900 |
-
<?php
|
901 |
-
}
|
902 |
-
?><span class="sow-field-container"><?php
|
903 |
-
$class_name = empty( $field['type'] ) ? '' : 'SiteOrigin_Widget_ContactForm_Field_' . ucwords( $field['type'] );
|
904 |
-
// This does autoloading if required.
|
905 |
-
if ( class_exists( $class_name ) ) {
|
906 |
-
/**
|
907 |
-
* @var $contact_field SiteOrigin_Widget_ContactForm_Field_Base
|
908 |
-
*/
|
909 |
-
$field_input_options = array(
|
910 |
-
'field' => $field,
|
911 |
-
'field_id' => $field_id,
|
912 |
-
'field_name' => $field_name,
|
913 |
-
'value' => $value,
|
914 |
-
'show_placeholder' => $show_placeholder,
|
915 |
-
'label' => $label,
|
916 |
-
);
|
917 |
-
$contact_field = new $class_name( $field_input_options );
|
918 |
-
$contact_field->render();
|
919 |
-
} else {
|
920 |
-
echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $value ) . '" class="sow-text-field" ' . ( $show_placeholder ? 'placeholder="' . esc_attr( $label ) . '"' : '' ) . '/>';
|
921 |
-
}
|
922 |
-
?></span><?php
|
923 |
-
|
924 |
-
if ( ! empty( $label_position ) && $label_position == 'below' ) {
|
925 |
-
$this->render_form_label( $field_id, $label, $instance );
|
926 |
-
}
|
927 |
-
|
928 |
-
if ( ! empty( $field['description'] ) ) {
|
929 |
-
?>
|
930 |
-
<div class="sow-form-field-description">
|
931 |
-
<?php echo wp_kses_post( $field['description'] ) ?>
|
932 |
-
</div>
|
933 |
-
<?php
|
934 |
-
}
|
935 |
-
|
936 |
-
?></div><?php
|
937 |
-
}
|
938 |
-
}
|
939 |
-
|
940 |
-
function render_form_label( $field_id, $label, $position ) {
|
941 |
-
if ( ! empty( $label ) ) {
|
942 |
-
$label_class = '';
|
943 |
-
if ( ! empty( $position ) ) {
|
944 |
-
$label_class = ' class="sow-form-field-label-' . $position . '"';
|
945 |
-
}
|
946 |
-
?><label<?php if ( ! empty( $label_class ) ) {
|
947 |
-
echo $label_class;
|
948 |
-
} ?> for="<?php echo esc_attr( $field_id ) ?>"><strong><?php echo esc_html( $label ) ?></strong></label>
|
949 |
-
<?php
|
950 |
-
}
|
951 |
-
}
|
952 |
-
|
953 |
-
/**
|
954 |
-
* Ajax action handler to send the form
|
955 |
-
*/
|
956 |
-
function contact_form_action( $instance, $storage_hash ) {
|
957 |
-
if ( ! wp_verify_nonce( $_POST['_wpnonce'], '_contact_form_submit' ) ) {
|
958 |
-
// Using `return false;` instead of `wp_die` because this function may sometimes be called as a side effect
|
959 |
-
// of trying to enqueue scripts required for the front end. In those cases `$_POST['_wpnonce']` doesn't exist
|
960 |
-
// and calling `wp_die` will halt script execution and break things. Ideally it should be possible to enqueue
|
961 |
-
// front end scripts without calling widgets' render functions, but that will mean a fairly large refactor.
|
962 |
-
return false;
|
963 |
-
}
|
964 |
-
if ( empty( $_POST['instance_hash'] ) || $_POST['instance_hash'] != $storage_hash ) {
|
965 |
-
return false;
|
966 |
-
}
|
967 |
-
if ( empty( $instance['fields'] ) ) {
|
968 |
-
array(
|
969 |
-
'status' => null,
|
970 |
-
);
|
971 |
-
}
|
972 |
-
|
973 |
-
// Make sure that this action only runs once per instance
|
974 |
-
static $send_cache = array();
|
975 |
-
$send_cache_hash = md5( serialize( $instance ) . '::' . $storage_hash );
|
976 |
-
if ( isset( $send_cache[ $send_cache_hash ] ) ) {
|
977 |
-
return $send_cache[ $send_cache_hash ];
|
978 |
-
}
|
979 |
-
|
980 |
-
$errors = array();
|
981 |
-
$email_fields = array();
|
982 |
-
$post_vars = stripslashes_deep( $_POST );
|
983 |
-
|
984 |
-
$field_ids = array();
|
985 |
-
foreach ( $instance['fields'] as $i => $field ) {
|
986 |
-
if ( empty( $field['type'] ) ) {
|
987 |
-
continue;
|
988 |
-
}
|
989 |
-
$field_name = $this->name_from_label( ! empty( $field['label'] ) ? $field['label'] : $i, $field_ids ) . '-' . $instance['_sow_form_id'];
|
990 |
-
$value = ! empty( $post_vars[ $field_name ] ) ? $post_vars[ $field_name ] : '';
|
991 |
-
|
992 |
-
if ( empty( $value ) ) {
|
993 |
-
if ( $field['required']['required'] ) {
|
994 |
-
// Add in the default subject
|
995 |
-
if ( $field['type'] == 'subject' && ! empty( $instance['settings']['default_subject'] ) ) {
|
996 |
-
$value = $instance['settings']['default_subject'];
|
997 |
-
} else {
|
998 |
-
$errors[ $field_name ] = ! empty( $field['required']['missing_message'] ) ? $field['required']['missing_message'] : __( 'Required field', 'so-widgets-bundle' );
|
999 |
-
continue;
|
1000 |
-
}
|
1001 |
-
} else {
|
1002 |
-
continue; // Don't process an empty field that's not required
|
1003 |
-
}
|
1004 |
-
}
|
1005 |
-
|
1006 |
-
// Type Validation
|
1007 |
-
switch ( $field['type'] ) {
|
1008 |
-
case 'email':
|
1009 |
-
if ( $value != sanitize_email( $value ) ) {
|
1010 |
-
$errors[ $field_name ] = __( 'Invalid email address.', 'so-widgets-bundle' );
|
1011 |
-
}
|
1012 |
-
$email_fields[ $field['type'] ] = $value;
|
1013 |
-
|
1014 |
-
break;
|
1015 |
-
|
1016 |
-
case 'name':
|
1017 |
-
case 'subject':
|
1018 |
-
$email_fields[ $field['type'] ] = $value;
|
1019 |
-
|
1020 |
-
break;
|
1021 |
-
|
1022 |
-
case 'checkboxes':
|
1023 |
-
$email_fields['message'][] = array(
|
1024 |
-
'label' => $field['label'],
|
1025 |
-
'value' => implode( ', ', $value ),
|
1026 |
-
);
|
1027 |
-
break;
|
1028 |
-
|
1029 |
-
default:
|
1030 |
-
$email_fields['message'][] = array(
|
1031 |
-
'label' => $field['label'],
|
1032 |
-
'value' => $value,
|
1033 |
-
);
|
1034 |
-
break;
|
1035 |
-
}
|
1036 |
-
}
|
1037 |
-
|
1038 |
-
// Add in the default subject if no subject field is defined in the form at all
|
1039 |
-
if ( ! isset( $email_fields['subject'] ) && ! empty( $instance['settings']['default_subject'] ) ) {
|
1040 |
-
$email_fields['subject'] = $instance['settings']['default_subject'];
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
// Add in the default subject prefix
|
1044 |
-
if ( ! empty( $email_fields['subject'] ) && ! empty( $instance['settings']['subject_prefix'] ) ) {
|
1045 |
-
$email_fields['subject'] = $instance['settings']['subject_prefix'] . ' ' . $email_fields['subject'];
|
1046 |
-
}
|
1047 |
-
|
1048 |
-
// Now we do some email message validation
|
1049 |
-
if ( empty( $errors ) ) {
|
1050 |
-
$email_errors = $this->validate_mail( $email_fields );
|
1051 |
-
// Missing subject input and no default subject set. Revert to using a generic default 'SiteName Contact Form'
|
1052 |
-
if ( ! isset( $email_fields['subject'] ) && ! empty( $email_errors['subject'] ) ) {
|
1053 |
-
unset( $email_errors['subject'] );
|
1054 |
-
$email_fields['subject'] = get_bloginfo() . ' ' . __( 'Contact Form', 'siteorigin-widgets' );
|
1055 |
-
}
|
1056 |
-
if ( ! empty( $email_errors ) ) {
|
1057 |
-
$errors['_general'] = $email_errors;
|
1058 |
-
}
|
1059 |
-
}
|
1060 |
-
|
1061 |
-
// And if we get this far, do some spam filtering and Captcha checking
|
1062 |
-
if ( empty( $errors ) ) {
|
1063 |
-
$spam_errors = $this->spam_check( $post_vars, $email_fields, $instance );
|
1064 |
-
if ( ! empty( $spam_errors ) ) {
|
1065 |
-
// Now we can decide how we want to handle this spam status
|
1066 |
-
if ( ! empty( $spam_errors['akismet'] ) && $instance['spam']['akismet']['spam_action'] == 'tag' ) {
|
1067 |
-
unset( $spam_errors['akismet'] );
|
1068 |
-
$email_fields['subject'] = '[spam] ' . $email_fields['subject'];
|
1069 |
-
}
|
1070 |
-
}
|
1071 |
-
|
1072 |
-
if ( ! empty( $spam_errors ) ) {
|
1073 |
-
$errors['_general'] = $spam_errors;
|
1074 |
-
}
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
if ( empty( $errors ) ) {
|
1078 |
-
// We can send the email
|
1079 |
-
$success = $this->send_mail( $email_fields, $instance );
|
1080 |
-
|
1081 |
-
if ( is_wp_error( $success ) ) {
|
1082 |
-
$errors['_general']['send'] = $success->get_error_message();
|
1083 |
-
} else if ( ! $success ) {
|
1084 |
-
$errors['_general']['send'] = __( 'Error sending email, please try again later.', 'so-widgets-bundle' );
|
1085 |
-
} else {
|
1086 |
-
// This action will allow other plugins to run code when contact form has successfully been sent
|
1087 |
-
do_action( 'siteorigin_widgets_contact_sent', $instance, $email_fields );
|
1088 |
-
}
|
1089 |
-
} else {
|
1090 |
-
// This action will allow other plugins to run code when the contact form submission has resulted in error
|
1091 |
-
do_action( 'siteorigin_widgets_contact_error', $instance, $email_fields, $errors );
|
1092 |
-
}
|
1093 |
-
|
1094 |
-
$send_cache[ $send_cache_hash ] = array(
|
1095 |
-
'status' => empty( $errors ) ? 'success' : 'fail',
|
1096 |
-
'errors' => $errors
|
1097 |
-
);
|
1098 |
-
|
1099 |
-
return $send_cache[ $send_cache_hash ];
|
1100 |
-
}
|
1101 |
-
|
1102 |
-
/**
|
1103 |
-
* Validate fields of an email message
|
1104 |
-
*/
|
1105 |
-
function validate_mail( $email_fields ) {
|
1106 |
-
$errors = array();
|
1107 |
-
if ( empty( $email_fields['email'] ) ) {
|
1108 |
-
$errors['email'] = __( 'A valid email is required', 'so-widgets-bundle' );
|
1109 |
-
} elseif ( function_exists( 'filter_var' ) && ! filter_var( $email_fields['email'], FILTER_VALIDATE_EMAIL ) ) {
|
1110 |
-
$errors['email'] = __( 'The email address is invalid', 'so-widgets-bundle' );
|
1111 |
-
}
|
1112 |
-
|
1113 |
-
if ( empty( $email_fields['subject'] ) ) {
|
1114 |
-
$errors['subject'] = __( 'Missing subject', 'so-widgets-bundle' );
|
1115 |
-
}
|
1116 |
-
|
1117 |
-
return $errors;
|
1118 |
-
}
|
1119 |
-
|
1120 |
-
/**
|
1121 |
-
* Check the email for spam
|
1122 |
-
*
|
1123 |
-
* @param $email_fields
|
1124 |
-
* @param $instance
|
1125 |
-
*
|
1126 |
-
* @return array
|
1127 |
-
*/
|
1128 |
-
function spam_check( $post_vars, $email_fields, $instance ) {
|
1129 |
-
$errors = array();
|
1130 |
-
|
1131 |
-
$recaptcha_config = $instance['spam']['recaptcha'];
|
1132 |
-
$use_recaptcha = $recaptcha_config['use_captcha'] && ! empty( $recaptcha_config['site_key'] ) && ! empty( $recaptcha_config['secret_key'] );
|
1133 |
-
if ( $use_recaptcha ) {
|
1134 |
-
$result = wp_remote_post(
|
1135 |
-
'https://www.google.com/recaptcha/api/siteverify',
|
1136 |
-
array(
|
1137 |
-
'body' => array(
|
1138 |
-
'secret' => $instance['spam']['recaptcha']['secret_key'],
|
1139 |
-
'response' => $post_vars['g-recaptcha-response'],
|
1140 |
-
'remoteip' => isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null,
|
1141 |
-
)
|
1142 |
-
)
|
1143 |
-
);
|
1144 |
-
|
1145 |
-
if ( ! is_wp_error( $result ) && ! empty( $result['body'] ) ) {
|
1146 |
-
$result = json_decode( $result['body'], true );
|
1147 |
-
if ( isset( $result['success'] ) && ! $result['success'] ) {
|
1148 |
-
$errors['recaptcha'] = __( 'Error validating your Captcha response.', 'so-widgets-bundle' );
|
1149 |
-
}
|
1150 |
-
}
|
1151 |
-
}
|
1152 |
-
|
1153 |
-
if ( $instance['spam']['akismet']['use_akismet'] && class_exists( 'Akismet' ) ) {
|
1154 |
-
$comment = array();
|
1155 |
-
|
1156 |
-
$message_text = array();
|
1157 |
-
foreach ( $email_fields['message'] as $m ) {
|
1158 |
-
$message_text[] = $m['value'];
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
$comment['comment_text'] = $email_fields['subject'] . "\n\n" . implode( "\n\n", $message_text );
|
1162 |
-
$comment['comment_author'] = ! empty( $email_fields['name'] ) ? $email_fields['name'] : '';
|
1163 |
-
$comment['comment_author_email'] = $email_fields['email'];
|
1164 |
-
$comment['comment_post_ID'] = get_the_ID();
|
1165 |
-
|
1166 |
-
$comment['comment_type'] = 'contact-form';
|
1167 |
-
|
1168 |
-
$comment['user_ip'] = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null;
|
1169 |
-
$comment['user_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
1170 |
-
$comment['referrer'] = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : null;
|
1171 |
-
$comment['blog'] = get_option( 'home' );
|
1172 |
-
$comment['blog_lang'] = get_locale();
|
1173 |
-
$comment['blog_charset'] = get_option( 'blog_charset' );
|
1174 |
-
|
1175 |
-
// Pretend to check with Akismet
|
1176 |
-
$response = Akismet::http_post( Akismet::build_query( $comment ), 'comment-check' );
|
1177 |
-
$is_spam = ! empty( $response[1] ) && $response[1] == 'true';
|
1178 |
-
|
1179 |
-
if ( $is_spam ) {
|
1180 |
-
$errors['akismet'] = __( 'Unfortunately our system identified your message as spam.', 'so-widgets-bundle' );
|
1181 |
-
}
|
1182 |
-
}
|
1183 |
-
|
1184 |
-
return $errors;
|
1185 |
-
}
|
1186 |
-
|
1187 |
-
function send_mail( $email_fields, $instance ) {
|
1188 |
-
$body = '<strong>' . __( 'From', 'so-widgets-bundle' ) . ':</strong> <a href="mailto:' . sanitize_email( $email_fields['email'] ) . '">' . esc_html( $email_fields['name'] ) . '</a> <' . sanitize_email( $email_fields['email'] ) . "> \n\n";
|
1189 |
-
foreach ( $email_fields['message'] as $m ) {
|
1190 |
-
$body .= '<strong>' . $m['label'] . ':</strong>';
|
1191 |
-
$body .= "\n";
|
1192 |
-
$body .= htmlspecialchars( $m['value'] );
|
1193 |
-
$body .= "\n\n";
|
1194 |
-
}
|
1195 |
-
$body = wpautop( trim( $body ) );
|
1196 |
-
|
1197 |
-
if ( $instance['settings']['to'] == 'ibrossiter@gmail.com' || $instance['settings']['to'] == 'test@example.com' || empty( $instance['settings']['to'] ) ) {
|
1198 |
-
// Replace default and empty email address.
|
1199 |
-
// Also replaces the email address that comes from the prebuilt layout directory
|
1200 |
-
$instance['settings']['to'] = get_option( 'admin_email' );
|
1201 |
-
}
|
1202 |
-
|
1203 |
-
if ( $instance['settings']['from'] == 'test@example.com' || empty( $instance['settings']['from'] ) ) {
|
1204 |
-
$instance['settings']['from'] = get_option( 'admin_email' );
|
1205 |
-
}
|
1206 |
-
|
1207 |
-
$headers = array(
|
1208 |
-
'Content-Type: text/html; charset=UTF-8',
|
1209 |
-
'From: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . $instance['settings']['from'] . '>',
|
1210 |
-
'Reply-To: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . sanitize_email( $email_fields['email'] ) . '>',
|
1211 |
-
);
|
1212 |
-
|
1213 |
-
// Check if this is a duplicated send
|
1214 |
-
$hash = md5( json_encode( array(
|
1215 |
-
'to' => $instance['settings']['to'],
|
1216 |
-
'subject' => $email_fields['subject'],
|
1217 |
-
'body' => $body,
|
1218 |
-
'headers' => $headers
|
1219 |
-
) ) );
|
1220 |
-
$hash_check = get_option( 'so_contact_hashes', array() );
|
1221 |
-
// Remove expired hashes
|
1222 |
-
foreach ( $hash_check as $h => $t ) {
|
1223 |
-
if ( $t < time() - 5 * 60 ) {
|
1224 |
-
unset( $hash_check[ $h ] );
|
1225 |
-
}
|
1226 |
-
}
|
1227 |
-
|
1228 |
-
if ( isset( $hash_check[ $hash ] ) ) {
|
1229 |
-
// Store the version with the expired hashes removed
|
1230 |
-
update_option( 'so_contact_hashes', $hash_check, true );
|
1231 |
-
|
1232 |
-
// This message has already been sent successfully
|
1233 |
-
return true;
|
1234 |
-
}
|
1235 |
-
|
1236 |
-
$mail_success = wp_mail( $instance['settings']['to'], $email_fields['subject'], $body, $headers );
|
1237 |
-
if ( $mail_success ) {
|
1238 |
-
$hash_check[ $hash ] = time();
|
1239 |
-
update_option( 'so_contact_hashes', $hash_check, true );
|
1240 |
-
}
|
1241 |
-
|
1242 |
-
return $mail_success;
|
1243 |
-
}
|
1244 |
-
|
1245 |
-
/**
|
1246 |
-
* Sanitize a value for an email header.
|
1247 |
-
*
|
1248 |
-
* From Pear Mail https://pear.php.net/package/Mail (BSD Style license - https://pear.php.net/copyright.php).
|
1249 |
-
*
|
1250 |
-
* @param $value
|
1251 |
-
*
|
1252 |
-
* @return mixed
|
1253 |
-
*/
|
1254 |
-
static function sanitize_header( $value ) {
|
1255 |
-
return preg_replace( '=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i', null, $value );
|
1256 |
-
}
|
1257 |
-
|
1258 |
-
}
|
1259 |
-
|
1260 |
-
siteorigin_widget_register( 'sow-contact-form', __FILE__, 'SiteOrigin_Widgets_ContactForm_Widget' );
|
1261 |
-
|
1262 |
-
// Tell the autoloader where to look for contactform field classes.
|
1263 |
-
function contactform_fields_class_paths( $class_paths ) {
|
1264 |
-
$loader = SiteOrigin_Widget_Field_Class_Loader::single();
|
1265 |
-
|
1266 |
-
$loader->add_class_prefixes(
|
1267 |
-
apply_filters( 'siteorigin_widgets_contact_form_field_class_prefixes', array(
|
1268 |
-
'SiteOrigin_Widget_ContactForm_Field_'
|
1269 |
-
) ),
|
1270 |
-
'contact-form'
|
1271 |
-
);
|
1272 |
-
|
1273 |
-
$loader->add_class_paths(
|
1274 |
-
apply_filters( 'siteorigin_widgets_contact_form_field_class_paths', array(
|
1275 |
-
plugin_dir_path( __FILE__ ) . 'fields/'
|
1276 |
-
) ),
|
1277 |
-
'contact-form'
|
1278 |
-
);
|
1279 |
-
|
1280 |
-
return $class_paths;
|
1281 |
-
}
|
1282 |
-
|
1283 |
-
add_filter( 'init', 'contactform_fields_class_paths' );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Widget Name: Contact Form
|
5 |
+
Description: A light weight contact form builder.
|
6 |
+
Author: SiteOrigin
|
7 |
+
Author URI: https://siteorigin.com
|
8 |
+
*/
|
9 |
+
|
10 |
+
class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
11 |
+
|
12 |
+
function __construct() {
|
13 |
+
|
14 |
+
parent::__construct(
|
15 |
+
'sow-contact-form',
|
16 |
+
__( 'SiteOrigin Contact Form', 'so-widgets-bundle' ),
|
17 |
+
array(
|
18 |
+
'description' => __( 'Create a simple contact form for your users to get hold of you.', 'so-widgets-bundle' ),
|
19 |
+
),
|
20 |
+
array(),
|
21 |
+
false,
|
22 |
+
plugin_dir_path( __FILE__ )
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Initialize the contact form widget
|
28 |
+
*/
|
29 |
+
function initialize() {
|
30 |
+
$this->register_frontend_scripts(
|
31 |
+
array(
|
32 |
+
array(
|
33 |
+
'sow-contact',
|
34 |
+
plugin_dir_url( __FILE__ ) . 'js/contact' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
35 |
+
array( 'jquery' ),
|
36 |
+
SOW_BUNDLE_VERSION
|
37 |
+
)
|
38 |
+
)
|
39 |
+
);
|
40 |
+
add_filter( 'siteorigin_widgets_sanitize_field_multiple_emails', array( $this, 'sanitize_multiple_emails' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
function get_widget_form() {
|
44 |
+
return array(
|
45 |
+
'title' => array(
|
46 |
+
'type' => 'text',
|
47 |
+
'label' => __( 'Title', 'so-widgets-bundle' ),
|
48 |
+
'default' => __( 'Contact Us', 'so-widgets-bundle' ),
|
49 |
+
),
|
50 |
+
|
51 |
+
'display_title' => array(
|
52 |
+
'type' => 'checkbox',
|
53 |
+
'label' => __( 'Display title', 'so-widgets-bundle' ),
|
54 |
+
),
|
55 |
+
|
56 |
+
'settings' => array(
|
57 |
+
'type' => 'section',
|
58 |
+
'label' => __( 'Settings', 'so-widgets-bundle' ),
|
59 |
+
'hide' => true,
|
60 |
+
'fields' => array(
|
61 |
+
'to' => array(
|
62 |
+
'type' => 'text',
|
63 |
+
'label' => __( 'To email address', 'so-widgets-bundle' ),
|
64 |
+
'description' => __( 'Where contact emails will be delivered to. You can send to multiple emails by separating the emails with a comma (,)', 'so-widgets-bundle' ),
|
65 |
+
'sanitize' => 'multiple_emails',
|
66 |
+
),
|
67 |
+
'from' => array(
|
68 |
+
'type' => 'text',
|
69 |
+
'label' => __( 'From email address', 'so-widgets-bundle' ),
|
70 |
+
'description' => __( 'It will appear as if emails are sent from this address. Ideally this should be in the same domain as this server to avoid spam filters.', 'so-widgets-bundle' ),
|
71 |
+
'sanitize' => 'email',
|
72 |
+
),
|
73 |
+
'default_subject' => array(
|
74 |
+
'type' => 'text',
|
75 |
+
'label' => __( 'Default subject', 'so-widgets-bundle' ),
|
76 |
+
'description' => __( "Subject to use when there isn't one available.", 'so-widgets-bundle' ),
|
77 |
+
),
|
78 |
+
'subject_prefix' => array(
|
79 |
+
'type' => 'text',
|
80 |
+
'label' => __( 'Subject prefix', 'so-widgets-bundle' ),
|
81 |
+
'description' => __( 'Prefix added to all incoming email subjects.', 'so-widgets-bundle' ),
|
82 |
+
),
|
83 |
+
'success_message' => array(
|
84 |
+
'type' => 'tinymce',
|
85 |
+
'label' => __( 'Success message', 'so-widgets-bundle' ),
|
86 |
+
'description' => __( 'Message to display after message successfully sent.', 'so-widgets-bundle' ),
|
87 |
+
'default' => __( "Thanks for contacting us. We'll get back to you shortly.", 'so-widgets-bundle' )
|
88 |
+
),
|
89 |
+
'submit_text' => array(
|
90 |
+
'type' => 'text',
|
91 |
+
'label' => __( 'Submit button text', 'so-widgets-bundle' ),
|
92 |
+
'default' => __( "Contact Us", 'so-widgets-bundle' )
|
93 |
+
),
|
94 |
+
'submit_id' => array(
|
95 |
+
'type' => 'text',
|
96 |
+
'label' => __( 'Button ID', 'so-widgets-bundle' ),
|
97 |
+
'description' => __( 'An ID attribute allows you to target this button in JavaScript.', 'so-widgets-bundle' ),
|
98 |
+
),
|
99 |
+
'onclick' => array(
|
100 |
+
'type' => 'text',
|
101 |
+
'label' => __( 'Onclick', 'so-widgets-bundle' ),
|
102 |
+
'description' => __( 'Run this JavaScript when the button is clicked. Ideal for tracking.', 'so-widgets-bundle' ),
|
103 |
+
),
|
104 |
+
'required_field_indicator' => array(
|
105 |
+
'type' => 'checkbox',
|
106 |
+
'label' => __( 'Indicate required fields with asterisk (*)', 'so-widgets-bundle' ),
|
107 |
+
'state_emitter' => array(
|
108 |
+
'callback' => 'conditional',
|
109 |
+
'args' => array(
|
110 |
+
'required_fields[show]: val',
|
111 |
+
'required_fields[hide]: ! val'
|
112 |
+
),
|
113 |
+
)
|
114 |
+
),
|
115 |
+
'required_field_indicator_message' => array(
|
116 |
+
'type' => 'text',
|
117 |
+
'label' => __( 'Required field indicator message', 'so-widgets-bundle' ),
|
118 |
+
'default' => __( 'Fields marked with * are required', 'so-widgets-bundle' ),
|
119 |
+
'state_handler' => array(
|
120 |
+
'required_fields[show]' => array( 'show' ),
|
121 |
+
'required_fields[hide]' => array( 'hide' ),
|
122 |
+
)
|
123 |
+
),
|
124 |
+
),
|
125 |
+
),
|
126 |
+
|
127 |
+
'fields' => array(
|
128 |
+
|
129 |
+
'type' => 'repeater',
|
130 |
+
'label' => __( 'Fields', 'so-widgets-bundle' ),
|
131 |
+
'item_name' => __( 'Field', 'so-widgets-bundle' ),
|
132 |
+
'item_label' => array(
|
133 |
+
'selector' => "[id*='label']",
|
134 |
+
),
|
135 |
+
'fields' => array(
|
136 |
+
|
137 |
+
'type' => array(
|
138 |
+
'type' => 'select',
|
139 |
+
'label' => __( 'Field Type', 'so-widgets-bundle' ),
|
140 |
+
'prompt' => __( 'Select Field Type', 'so-widgets-bundle' ),
|
141 |
+
'options' => array(
|
142 |
+
'name' => __( 'Name', 'so-widgets-bundle' ),
|
143 |
+
'email' => __( 'Email', 'so-widgets-bundle' ),
|
144 |
+
'subject' => __( 'Subject', 'so-widgets-bundle' ),
|
145 |
+
'text' => __( 'Text', 'so-widgets-bundle' ),
|
146 |
+
'textarea' => __( 'Text Area', 'so-widgets-bundle' ),
|
147 |
+
'select' => __( 'Dropdown Select', 'so-widgets-bundle' ),
|
148 |
+
'checkboxes' => __( 'Checkboxes', 'so-widgets-bundle' ),
|
149 |
+
'radio' => __( 'Radio', 'so-widgets-bundle' ),
|
150 |
+
),
|
151 |
+
'state_emitter' => array(
|
152 |
+
'callback' => 'select',
|
153 |
+
'args' => array( 'field_type_{$repeater}' ),
|
154 |
+
)
|
155 |
+
),
|
156 |
+
|
157 |
+
'label' => array(
|
158 |
+
'type' => 'text',
|
159 |
+
'label' => __( 'Label', 'so-widgets-bundle' ),
|
160 |
+
),
|
161 |
+
|
162 |
+
'description' => array(
|
163 |
+
'type' => 'text',
|
164 |
+
'label' => __( 'Description', 'so-widgets-bundle' ),
|
165 |
+
'description' => __( 'This text will appear small beneath the input field.', 'so-widgets-bundle' ),
|
166 |
+
),
|
167 |
+
|
168 |
+
'required' => array(
|
169 |
+
'type' => 'section',
|
170 |
+
'label' => __( 'Required Field', 'so-widgets-bundle' ),
|
171 |
+
'fields' => array(
|
172 |
+
'required' => array(
|
173 |
+
'type' => 'checkbox',
|
174 |
+
'label' => __( 'Required field', 'so-widgets-bundle' ),
|
175 |
+
'description' => __( 'Is this field required?', 'so-widgets-bundle' ),
|
176 |
+
),
|
177 |
+
'missing_message' => array(
|
178 |
+
'type' => 'text',
|
179 |
+
'label' => __( 'Missing message', 'so-widgets-bundle' ),
|
180 |
+
'description' => __( 'Error message to display if this field is missing.', 'so-widgets-bundle' ),
|
181 |
+
)
|
182 |
+
)
|
183 |
+
),
|
184 |
+
|
185 |
+
// This are for select, radio, and checkboxes
|
186 |
+
'options' => array(
|
187 |
+
'type' => 'repeater',
|
188 |
+
'label' => __( 'Options', 'so-widgets-bundle' ),
|
189 |
+
'item_name' => __( 'Option', 'so-widgets-bundle' ),
|
190 |
+
'item_label' => array( 'selector' => "[id*='value']" ),
|
191 |
+
'fields' => array(
|
192 |
+
'value' => array(
|
193 |
+
'type' => 'text',
|
194 |
+
'label' => __( 'Value', 'so-widgets-bundle' ),
|
195 |
+
),
|
196 |
+
),
|
197 |
+
|
198 |
+
// These are only required for a few states
|
199 |
+
'state_handler' => array(
|
200 |
+
'field_type_{$repeater}[select,checkboxes,radio]' => array( 'show' ),
|
201 |
+
'_else[field_type_{$repeater}]' => array( 'hide' ),
|
202 |
+
),
|
203 |
+
),
|
204 |
+
),
|
205 |
+
),
|
206 |
+
|
207 |
+
'spam' => array(
|
208 |
+
'type' => 'section',
|
209 |
+
'label' => __( 'Spam Protection', 'so-widgets-bundle' ),
|
210 |
+
'hide' => true,
|
211 |
+
'fields' => array(
|
212 |
+
|
213 |
+
'recaptcha' => array(
|
214 |
+
'type' => 'section',
|
215 |
+
'label' => __( 'reCAPTCHA', 'so-widgets-bundle' ),
|
216 |
+
'fields' => array(
|
217 |
+
'use_captcha' => array(
|
218 |
+
'type' => 'checkbox',
|
219 |
+
'label' => __( 'Use reCAPTCHA', 'so-widgets-bundle' ),
|
220 |
+
'default' => false,
|
221 |
+
),
|
222 |
+
'site_key' => array(
|
223 |
+
'type' => 'text',
|
224 |
+
'label' => __( 'reCAPTCHA Site Key', 'so-widgets-bundle' ),
|
225 |
+
),
|
226 |
+
'secret_key' => array(
|
227 |
+
'type' => 'text',
|
228 |
+
'label' => __( 'reCAPTCHA Secret Key', 'so-widgets-bundle' ),
|
229 |
+
),
|
230 |
+
'theme' => array(
|
231 |
+
'type' => 'select',
|
232 |
+
'label' => __( 'Theme', 'so-widgets-bundle' ),
|
233 |
+
'default' => 'light',
|
234 |
+
'options' => array(
|
235 |
+
'light' => __( 'Light', 'so-widgets-bundle' ),
|
236 |
+
'dark' => __( 'Dark', 'so-widgets-bundle' ),
|
237 |
+
),
|
238 |
+
),
|
239 |
+
'type' => array(
|
240 |
+
'type' => 'select',
|
241 |
+
'label' => __( 'Challenge type', 'so-widgets-bundle' ),
|
242 |
+
'default' => 'image',
|
243 |
+
'options' => array(
|
244 |
+
'image' => __( 'Image', 'so-widgets-bundle' ),
|
245 |
+
'audio' => __( 'Audio', 'so-widgets-bundle' ),
|
246 |
+
),
|
247 |
+
),
|
248 |
+
'size' => array(
|
249 |
+
'type' => 'select',
|
250 |
+
'label' => __( 'Size', 'so-widgets-bundle' ),
|
251 |
+
'default' => 'normal',
|
252 |
+
'options' => array(
|
253 |
+
'normal' => __( 'Normal', 'so-widgets-bundle' ),
|
254 |
+
'compact' => __( 'Compact', 'so-widgets-bundle' ),
|
255 |
+
),
|
256 |
+
),
|
257 |
+
)
|
258 |
+
),
|
259 |
+
|
260 |
+
'akismet' => array(
|
261 |
+
'type' => 'section',
|
262 |
+
'label' => __( 'Akismet', 'so-widgets-bundle' ),
|
263 |
+
'fields' => array(
|
264 |
+
'use_akismet' => array(
|
265 |
+
'type' => 'checkbox',
|
266 |
+
'label' => __( 'Use Akismet filtering', 'so-widgets-bundle' ),
|
267 |
+
'default' => true,
|
268 |
+
),
|
269 |
+
'spam_action' => array(
|
270 |
+
'type' => 'select',
|
271 |
+
'label' => __( 'Spam action', 'so-widgets-bundle' ),
|
272 |
+
'options' => array(
|
273 |
+
'error' => __( 'Show error message', 'so-widgets-bundle' ),
|
274 |
+
'tag' => __( 'Tag as spam in subject', 'so-widgets-bundle' ),
|
275 |
+
),
|
276 |
+
'description' => __( 'How to handle submissions that are identified as spam.', 'so-widgets-bundle' ),
|
277 |
+
'default' => 'error',
|
278 |
+
),
|
279 |
+
)
|
280 |
+
),
|
281 |
+
),
|
282 |
+
),
|
283 |
+
|
284 |
+
'design' => array(
|
285 |
+
'type' => 'section',
|
286 |
+
'label' => __( 'Design', 'so-widgets-bundle' ),
|
287 |
+
'hide' => true,
|
288 |
+
'fields' => array(
|
289 |
+
|
290 |
+
'container' => array(
|
291 |
+
'type' => 'section',
|
292 |
+
'label' => __( 'Container', 'so-widgets-bundle' ),
|
293 |
+
'fields' => array(
|
294 |
+
'background' => array(
|
295 |
+
'type' => 'color',
|
296 |
+
'label' => __( 'Background color', 'so-widgets-bundle' ),
|
297 |
+
'default' => '#f2f2f2',
|
298 |
+
),
|
299 |
+
'padding' => array(
|
300 |
+
'type' => 'measurement',
|
301 |
+
'label' => __( 'Padding', 'so-widgets-bundle' ),
|
302 |
+
'default' => '10px',
|
303 |
+
),
|
304 |
+
'border_color' => array(
|
305 |
+
'type' => 'color',
|
306 |
+
'label' => __( 'Border color', 'so-widgets-bundle' ),
|
307 |
+
'default' => '#c0c0c0',
|
308 |
+
),
|
309 |
+
'border_width' => array(
|
310 |
+
'type' => 'measurement',
|
311 |
+
'label' => __( 'Border width', 'so-widgets-bundle' ),
|
312 |
+
'default' => '1px',
|
313 |
+
),
|
314 |
+
'border_style' => array(
|
315 |
+
'type' => 'select',
|
316 |
+
'label' => __( 'Border style', 'so-widgets-bundle' ),
|
317 |
+
'default' => 'solid',
|
318 |
+
'options' => array(
|
319 |
+
'none' => __( 'None', 'so-widgets-bundle' ),
|
320 |
+
'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
|
321 |
+
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
322 |
+
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
323 |
+
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
324 |
+
'double' => __( 'Double', 'so-widgets-bundle' ),
|
325 |
+
'groove' => __( 'Groove', 'so-widgets-bundle' ),
|
326 |
+
'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
|
327 |
+
'inset' => __( 'Inset', 'so-widgets-bundle' ),
|
328 |
+
'outset' => __( 'Outset', 'so-widgets-bundle' ),
|
329 |
+
)
|
330 |
+
),
|
331 |
+
)
|
332 |
+
),
|
333 |
+
|
334 |
+
'labels' => array(
|
335 |
+
'type' => 'section',
|
336 |
+
'label' => __( 'Field labels', 'so-widgets-bundle' ),
|
337 |
+
'fields' => array(
|
338 |
+
'font' => array(
|
339 |
+
'type' => 'font',
|
340 |
+
'label' => __( 'Font', 'so-widgets-bundle' ),
|
341 |
+
'default' => 'default',
|
342 |
+
),
|
343 |
+
'size' => array(
|
344 |
+
'type' => 'measurement',
|
345 |
+
'label' => __( 'Font size', 'so-widgets-bundle' ),
|
346 |
+
'default' => 'default',
|
347 |
+
),
|
348 |
+
'color' => array(
|
349 |
+
'type' => 'color',
|
350 |
+
'label' => __( 'Color', 'so-widgets-bundle' ),
|
351 |
+
'default' => 'default',
|
352 |
+
),
|
353 |
+
'position' => array(
|
354 |
+
'type' => 'select',
|
355 |
+
'label' => __( 'Position', 'so-widgets-bundle' ),
|
356 |
+
'default' => 'above',
|
357 |
+
'options' => array(
|
358 |
+
'above' => __( 'Above', 'so-widgets-bundle' ),
|
359 |
+
'below' => __( 'Below', 'so-widgets-bundle' ),
|
360 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
361 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
362 |
+
'inside' => __( 'Inside', 'so-widgets-bundle' ),
|
363 |
+
),
|
364 |
+
),
|
365 |
+
'width' => array(
|
366 |
+
'type' => 'measurement',
|
367 |
+
'label' => __( 'Width', 'so-widgets-bundle' ),
|
368 |
+
'default' => '',
|
369 |
+
),
|
370 |
+
'align' => array(
|
371 |
+
'type' => 'select',
|
372 |
+
'label' => __( 'Align', 'so-widgets-bundle' ),
|
373 |
+
'default' => 'left',
|
374 |
+
'options' => array(
|
375 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
376 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
377 |
+
'center' => __( 'Center', 'so-widgets-bundle' ),
|
378 |
+
'justify' => __( 'Justify', 'so-widgets-bundle' ),
|
379 |
+
)
|
380 |
+
),
|
381 |
+
),
|
382 |
+
),
|
383 |
+
|
384 |
+
'fields' => array(
|
385 |
+
'type' => 'section',
|
386 |
+
'label' => __( 'Fields', 'so-widgets-bundle' ),
|
387 |
+
'fields' => array(
|
388 |
+
'font' => array(
|
389 |
+
'type' => 'font',
|
390 |
+
'label' => __( 'Font', 'so-widgets-bundle' ),
|
391 |
+
'default' => 'default',
|
392 |
+
),
|
393 |
+
'font_size' => array(
|
394 |
+
'type' => 'measurement',
|
395 |
+
'label' => __( 'Font Size', 'so-widgets-bundle' )
|
396 |
+
),
|
397 |
+
'color' => array(
|
398 |
+
'type' => 'color',
|
399 |
+
'label' => __( 'Text Color', 'so-widgets-bundle' ),
|
400 |
+
),
|
401 |
+
'margin' => array(
|
402 |
+
'type' => 'measurement',
|
403 |
+
'label' => __( 'Margin', 'so-widgets-bundle' )
|
404 |
+
),
|
405 |
+
'padding' => array(
|
406 |
+
'type' => 'measurement',
|
407 |
+
'label' => __( 'Padding', 'so-widgets-bundle' )
|
408 |
+
),
|
409 |
+
'height' => array(
|
410 |
+
'type' => 'measurement',
|
411 |
+
'label' => __( 'Height', 'so-widgets-bundle' )
|
412 |
+
),
|
413 |
+
'background' => array(
|
414 |
+
'type' => 'color',
|
415 |
+
'label' => __( 'Background', 'so-widgets-bundle' ),
|
416 |
+
),
|
417 |
+
'border_color' => array(
|
418 |
+
'type' => 'color',
|
419 |
+
'label' => __( 'Border color', 'so-widgets-bundle' ),
|
420 |
+
'default' => '#c0c0c0',
|
421 |
+
),
|
422 |
+
'border_width' => array(
|
423 |
+
'type' => 'measurement',
|
424 |
+
'label' => __( 'Border width', 'so-widgets-bundle' ),
|
425 |
+
'default' => '1px',
|
426 |
+
),
|
427 |
+
'border_style' => array(
|
428 |
+
'type' => 'select',
|
429 |
+
'label' => __( ' Border style', 'so-widgets-bundle' ),
|
430 |
+
'default' => 'solid',
|
431 |
+
'options' => array(
|
432 |
+
'none' => __( 'None', 'so-widgets-bundle' ),
|
433 |
+
'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
|
434 |
+
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
435 |
+
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
436 |
+
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
437 |
+
'double' => __( 'Double', 'so-widgets-bundle' ),
|
438 |
+
'groove' => __( 'Groove', 'so-widgets-bundle' ),
|
439 |
+
'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
|
440 |
+
'inset' => __( 'Inset', 'so-widgets-bundle' ),
|
441 |
+
'outset' => __( 'Outset', 'so-widgets-bundle' ),
|
442 |
+
)
|
443 |
+
),
|
444 |
+
'border_radius' => array(
|
445 |
+
'type' => 'slider',
|
446 |
+
'label' => __( 'Border rounding', 'so-widgets-bundle' ),
|
447 |
+
'default' => 0,
|
448 |
+
'max' => 50,
|
449 |
+
'min' => 0
|
450 |
+
),
|
451 |
+
)
|
452 |
+
),
|
453 |
+
|
454 |
+
'descriptions' => array(
|
455 |
+
'type' => 'section',
|
456 |
+
'label' => __( 'Field descriptions', 'so-widgets-bundle' ),
|
457 |
+
'fields' => array(
|
458 |
+
'size' => array(
|
459 |
+
'type' => 'measurement',
|
460 |
+
'label' => __( 'Size', 'so-widgets-bundle' ),
|
461 |
+
'default' => '0.9em',
|
462 |
+
),
|
463 |
+
'color' => array(
|
464 |
+
'type' => 'color',
|
465 |
+
'label' => __( 'Color', 'so-widgets-bundle' ),
|
466 |
+
'default' => '#999999',
|
467 |
+
),
|
468 |
+
'style' => array(
|
469 |
+
'type' => 'select',
|
470 |
+
'label' => __( 'Style', 'so-widgets-bundle' ),
|
471 |
+
'default' => 'italic',
|
472 |
+
'options' => array(
|
473 |
+
'italic' => __( 'Italic', 'so-widgets-bundle' ),
|
474 |
+
'normal' => __( 'Normal', 'so-widgets-bundle' ),
|
475 |
+
)
|
476 |
+
),
|
477 |
+
)
|
478 |
+
),
|
479 |
+
|
480 |
+
'errors' => array(
|
481 |
+
'type' => 'section',
|
482 |
+
'label' => __( 'Error messages', 'so-widgets-bundle' ),
|
483 |
+
'fields' => array(
|
484 |
+
'background' => array(
|
485 |
+
'type' => 'color',
|
486 |
+
'label' => __( 'Error background color', 'so-widgets-bundle' ),
|
487 |
+
'default' => '#fce4e5',
|
488 |
+
),
|
489 |
+
'border_color' => array(
|
490 |
+
'type' => 'color',
|
491 |
+
'label' => __( 'Error border color', 'so-widgets-bundle' ),
|
492 |
+
'default' => '#ec666a',
|
493 |
+
),
|
494 |
+
'text_color' => array(
|
495 |
+
'type' => 'color',
|
496 |
+
'label' => __( 'Error text color', 'so-widgets-bundle' ),
|
497 |
+
'default' => '#ec666a',
|
498 |
+
),
|
499 |
+
'padding' => array(
|
500 |
+
'type' => 'measurement',
|
501 |
+
'label' => __( 'Error padding', 'so-widgets-bundle' ),
|
502 |
+
'default' => '5px',
|
503 |
+
),
|
504 |
+
'margin' => array(
|
505 |
+
'type' => 'measurement',
|
506 |
+
'label' => __( 'Error margin', 'so-widgets-bundle' ),
|
507 |
+
'default' => '10px',
|
508 |
+
),
|
509 |
+
)
|
510 |
+
),
|
511 |
+
|
512 |
+
'submit' => array(
|
513 |
+
'type' => 'section',
|
514 |
+
'label' => __( 'Submit button', 'so-widgets-bundle' ),
|
515 |
+
'fields' => array(
|
516 |
+
'styled' => array(
|
517 |
+
'type' => 'checkbox',
|
518 |
+
'label' => __( 'Style submit button', 'so-widgets-bundle' ),
|
519 |
+
'description' => __( 'Style the button or leave it with default theme styling.', 'so-widgets-bundle' ),
|
520 |
+
'default' => true,
|
521 |
+
),
|
522 |
+
|
523 |
+
'background_color' => array(
|
524 |
+
'type' => 'color',
|
525 |
+
'label' => __( 'Background color', 'so-widgets-bundle' ),
|
526 |
+
'default' => '#eeeeee',
|
527 |
+
),
|
528 |
+
'background_gradient' => array(
|
529 |
+
'type' => 'slider',
|
530 |
+
'label' => __( 'Gradient intensity', 'so-widgets-bundle' ),
|
531 |
+
'default' => 10,
|
532 |
+
),
|
533 |
+
'border_color' => array(
|
534 |
+
'type' => 'color',
|
535 |
+
'label' => __( 'Border color', 'so-widgets-bundle' ),
|
536 |
+
'default' => '#989a9c',
|
537 |
+
),
|
538 |
+
'border_style' => array(
|
539 |
+
'type' => 'select',
|
540 |
+
'label' => __( 'Border style', 'so-widgets-bundle' ),
|
541 |
+
'default' => 'solid',
|
542 |
+
'options' => array(
|
543 |
+
'none' => __( 'None', 'so-widgets-bundle' ),
|
544 |
+
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
545 |
+
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
546 |
+
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
547 |
+
)
|
548 |
+
),
|
549 |
+
'border_width' => array(
|
550 |
+
'type' => 'measurement',
|
551 |
+
'label' => __( 'Border width', 'so-widgets-bundle' ),
|
552 |
+
'default' => '1px',
|
553 |
+
),
|
554 |
+
'border_radius' => array(
|
555 |
+
'type' => 'slider',
|
556 |
+
'label' => __( 'Border rounding', 'so-widgets-bundle' ),
|
557 |
+
'default' => 3,
|
558 |
+
'max' => 50,
|
559 |
+
'min' => 0
|
560 |
+
),
|
561 |
+
'text_color' => array(
|
562 |
+
'type' => 'color',
|
563 |
+
'label' => __( 'Text color', 'so-widgets-bundle' ),
|
564 |
+
'default' => '#5a5a5a',
|
565 |
+
),
|
566 |
+
'font_size' => array(
|
567 |
+
'type' => 'measurement',
|
568 |
+
'label' => __( 'Font size', 'so-widgets-bundle' ),
|
569 |
+
'default' => 'default',
|
570 |
+
),
|
571 |
+
'weight' => array(
|
572 |
+
'type' => 'select',
|
573 |
+
'label' => __( 'Font weight', 'so-widgets-bundle' ),
|
574 |
+
'default' => '500',
|
575 |
+
'options' => array(
|
576 |
+
'normal' => __( 'Normal', 'so-widgets-bundle' ),
|
577 |
+
'500' => __( 'Semi-bold', 'so-widgets-bundle' ),
|
578 |
+
'bold' => __( 'Bold', 'so-widgets-bundle' ),
|
579 |
+
)
|
580 |
+
),
|
581 |
+
'padding' => array(
|
582 |
+
'type' => 'measurement',
|
583 |
+
'label' => __( 'Padding', 'so-widgets-bundle' ),
|
584 |
+
'default' => '10px',
|
585 |
+
),
|
586 |
+
'width' => array(
|
587 |
+
'type' => 'measurement',
|
588 |
+
'label' => __( 'Width', 'so-widgets-bundle' ),
|
589 |
+
),
|
590 |
+
'align' => array(
|
591 |
+
'type' => 'select',
|
592 |
+
'label' => __( 'Align', 'so-widgets-bundle' ),
|
593 |
+
'default' => 'left',
|
594 |
+
'options' => array(
|
595 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
596 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
597 |
+
'center' => __( 'Center', 'so-widgets-bundle' ),
|
598 |
+
)
|
599 |
+
),
|
600 |
+
'inset_highlight' => array(
|
601 |
+
'type' => 'slider',
|
602 |
+
'label' => __( 'Inset highlight', 'so-widgets-bundle' ),
|
603 |
+
'description' => __( 'The white highlight at the bottom of the button', 'so-widgets-bundle' ),
|
604 |
+
'default' => 50,
|
605 |
+
'max' => 100,
|
606 |
+
'min' => 0
|
607 |
+
),
|
608 |
+
)
|
609 |
+
),
|
610 |
+
|
611 |
+
'focus' => array(
|
612 |
+
'type' => 'section',
|
613 |
+
'label' => __( 'Input focus', 'so-widgets-bundle' ),
|
614 |
+
'fields' => array(
|
615 |
+
'style' => array(
|
616 |
+
'type' => 'select',
|
617 |
+
'label' => __( 'Style', 'so-widgets-bundle' ),
|
618 |
+
'default' => 'solid',
|
619 |
+
'options' => array(
|
620 |
+
'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
|
621 |
+
'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
|
622 |
+
'solid' => __( 'Solid', 'so-widgets-bundle' ),
|
623 |
+
'double' => __( 'Double', 'so-widgets-bundle' ),
|
624 |
+
'groove' => __( 'Groove', 'so-widgets-bundle' ),
|
625 |
+
'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
|
626 |
+
'inset' => __( 'Inset', 'so-widgets-bundle' ),
|
627 |
+
'outset' => __( 'Outset', 'so-widgets-bundle' ),
|
628 |
+
'none' => __( 'None', 'so-widgets-bundle' ),
|
629 |
+
'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
|
630 |
+
)
|
631 |
+
),
|
632 |
+
'color' => array(
|
633 |
+
'type' => 'color',
|
634 |
+
'label' => __( 'Color', 'so-widgets-bundle' ),
|
635 |
+
'default' => 'default',
|
636 |
+
),
|
637 |
+
'width' => array(
|
638 |
+
'type' => 'measurement',
|
639 |
+
'label' => __( 'Width', 'so-widgets-bundle' ),
|
640 |
+
'default' => '1px',
|
641 |
+
),
|
642 |
+
),
|
643 |
+
),
|
644 |
+
),
|
645 |
+
),
|
646 |
+
);
|
647 |
+
}
|
648 |
+
|
649 |
+
function get_form_teaser() {
|
650 |
+
if ( ! $this->display_siteorigin_premium_teaser() ) {
|
651 |
+
return false;
|
652 |
+
}
|
653 |
+
|
654 |
+
$url = add_query_arg( array(
|
655 |
+
'featured_addon' => 'plugin/contact-form-fields',
|
656 |
+
'featured_plugin' => 'widgets-bundle'
|
657 |
+
), 'https://siteorigin.com/downloads/premium/' );
|
658 |
+
|
659 |
+
return sprintf(
|
660 |
+
__( 'Get more form fields for the Contact Form Widget in %s', 'so-widgets-bundle' ),
|
661 |
+
'<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer">' . __( 'SiteOrigin Premium', 'so-widgets-bundle' ) . '</a>'
|
662 |
+
);
|
663 |
+
}
|
664 |
+
|
665 |
+
function sanitize_multiple_emails( $value ) {
|
666 |
+
$values = explode( ',', $value );
|
667 |
+
foreach ( $values as $i => $email ) {
|
668 |
+
$values[ $i ] = sanitize_email( $email );
|
669 |
+
}
|
670 |
+
|
671 |
+
return implode( ',', $values );
|
672 |
+
}
|
673 |
+
|
674 |
+
function modify_instance( $instance ) {
|
675 |
+
// Use this to set up an initial version of the
|
676 |
+
if ( empty( $instance['settings']['to'] ) ) {
|
677 |
+
$current_user = wp_get_current_user();
|
678 |
+
$instance['settings']['to'] = $current_user->user_email;
|
679 |
+
}
|
680 |
+
if ( empty( $instance['settings']['from'] ) ) {
|
681 |
+
$instance['settings']['from'] = get_option( 'admin_email' );
|
682 |
+
}
|
683 |
+
if ( empty( $instance['fields'] ) ) {
|
684 |
+
$instance['fields'] = array(
|
685 |
+
array(
|
686 |
+
'type' => 'name',
|
687 |
+
'label' => __( 'Your Name', 'so-widgets-bundle' ),
|
688 |
+
'required' => array(
|
689 |
+
'required' => true,
|
690 |
+
'missing_message' => __( 'Please enter your name', 'so-widgets-bundle' ),
|
691 |
+
),
|
692 |
+
),
|
693 |
+
array(
|
694 |
+
'type' => 'email',
|
695 |
+
'label' => __( 'Your Email', 'so-widgets-bundle' ),
|
696 |
+
'required' => array(
|
697 |
+
'required' => true,
|
698 |
+
'missing_message' => __( 'Please enter a valid email address', 'so-widgets-bundle' ),
|
699 |
+
),
|
700 |
+
),
|
701 |
+
array(
|
702 |
+
'type' => 'subject',
|
703 |
+
'label' => __( 'Subject', 'so-widgets-bundle' ),
|
704 |
+
'required' => array(
|
705 |
+
'required' => true,
|
706 |
+
'missing_message' => __( 'Please enter a subject', 'so-widgets-bundle' ),
|
707 |
+
),
|
708 |
+
),
|
709 |
+
array(
|
710 |
+
'type' => 'textarea',
|
711 |
+
'label' => __( 'Message', 'so-widgets-bundle' ),
|
712 |
+
'required' => array(
|
713 |
+
'required' => true,
|
714 |
+
'missing_message' => __( 'Please write something', 'so-widgets-bundle' ),
|
715 |
+
),
|
716 |
+
),
|
717 |
+
);
|
718 |
+
}
|
719 |
+
|
720 |
+
return $instance;
|
721 |
+
}
|
722 |
+
|
723 |
+
function get_template_variables( $instance, $args ) {
|
724 |
+
unset( $instance['title'] );
|
725 |
+
unset( $instance['display_title'] );
|
726 |
+
unset( $instance['design'] );
|
727 |
+
unset( $instance['panels_info'] );
|
728 |
+
|
729 |
+
// Include '_sow_form_id' in generation of 'instance_hash' to allow multiple instances of the same form on a page.
|
730 |
+
$instance_hash = md5( serialize( $instance ) );
|
731 |
+
unset( $instance['_sow_form_id'] );
|
732 |
+
|
733 |
+
$submit_attributes = array();
|
734 |
+
if ( ! empty( $instance['settings']['submit_id'] ) ) {
|
735 |
+
$submit_attributes['id'] = $instance['settings']['submit_id'];
|
736 |
+
}
|
737 |
+
|
738 |
+
return array(
|
739 |
+
'instance_hash' => $instance_hash,
|
740 |
+
'submit_attributes' => $submit_attributes,
|
741 |
+
'onclick' => ! empty( $instance['settings']['onclick'] ) ? $instance['settings']['onclick'] : '',
|
742 |
+
);
|
743 |
+
}
|
744 |
+
|
745 |
+
function get_less_variables( $instance ) {
|
746 |
+
if ( empty( $instance['design']['labels']['font'] ) ) {
|
747 |
+
$instance['design']['labels'] = array( 'font' => '' );
|
748 |
+
}
|
749 |
+
$label_font = siteorigin_widget_get_font( $instance['design']['labels']['font'] );
|
750 |
+
$field_font = siteorigin_widget_get_font( $instance['design']['fields']['font'] );
|
751 |
+
|
752 |
+
$label_position = $instance['design']['labels']['position'];
|
753 |
+
if ( $label_position != 'left' && $label_position != 'right' ) {
|
754 |
+
$label_position = 'default';
|
755 |
+
}
|
756 |
+
|
757 |
+
$vars = array(
|
758 |
+
// All the container variables.
|
759 |
+
'container_background' => $instance['design']['container']['background'],
|
760 |
+
'container_padding' => $instance['design']['container']['padding'],
|
761 |
+
'container_border_color' => $instance['design']['container']['border_color'],
|
762 |
+
'container_border_width' => $instance['design']['container']['border_width'],
|
763 |
+
'container_border_style' => $instance['design']['container']['border_style'],
|
764 |
+
|
765 |
+
// Field labels
|
766 |
+
'label_font_family' => $label_font['family'],
|
767 |
+
'label_font_weight' => ! empty( $label_font['weight'] ) ? $label_font['weight'] : '',
|
768 |
+
'label_font_size' => $instance['design']['labels']['size'],
|
769 |
+
'label_font_color' => $instance['design']['labels']['color'],
|
770 |
+
'label_position' => $label_position,
|
771 |
+
'label_width' => $instance['design']['labels']['width'],
|
772 |
+
'label_align' => $instance['design']['labels']['align'],
|
773 |
+
|
774 |
+
// Fields
|
775 |
+
'field_font_family' => $field_font['family'],
|
776 |
+
'field_font_weight' => ! empty( $field_font['weight'] ) ? $field_font['weight'] : '',
|
777 |
+
'field_font_size' => $instance['design']['fields']['font_size'],
|
778 |
+
'field_font_color' => $instance['design']['fields']['color'],
|
779 |
+
'field_margin' => $instance['design']['fields']['margin'],
|
780 |
+
'field_padding' => $instance['design']['fields']['padding'],
|
781 |
+
'field_height' => $instance['design']['fields']['height'],
|
782 |
+
'field_background' => $instance['design']['fields']['background'],
|
783 |
+
'field_border_color' => $instance['design']['fields']['border_color'],
|
784 |
+
'field_border_width' => $instance['design']['fields']['border_width'],
|
785 |
+
'field_border_style' => $instance['design']['fields']['border_style'],
|
786 |
+
'field_border_radius' => $instance['design']['fields']['border_radius'] . 'px',
|
787 |
+
|
788 |
+
// Field descriptions
|
789 |
+
'description_font_size' => $instance['design']['descriptions']['size'],
|
790 |
+
'description_font_color' => $instance['design']['descriptions']['color'],
|
791 |
+
'description_font_style' => $instance['design']['descriptions']['style'],
|
792 |
+
|
793 |
+
// The error message styles
|
794 |
+
'error_background' => $instance['design']['errors']['background'],
|
795 |
+
'error_border' => $instance['design']['errors']['border_color'],
|
796 |
+
'error_text' => $instance['design']['errors']['text_color'],
|
797 |
+
'error_padding' => $instance['design']['errors']['padding'],
|
798 |
+
'error_margin' => $instance['design']['errors']['margin'],
|
799 |
+
|
800 |
+
// The submit button
|
801 |
+
'submit_background_color' => $instance['design']['submit']['background_color'],
|
802 |
+
'submit_background_gradient' => $instance['design']['submit']['background_gradient'] . '%',
|
803 |
+
'submit_border_color' => $instance['design']['submit']['border_color'],
|
804 |
+
'submit_border_style' => $instance['design']['submit']['border_style'],
|
805 |
+
'submit_border_width' => $instance['design']['submit']['border_width'],
|
806 |
+
'submit_border_radius' => $instance['design']['submit']['border_radius'] . 'px',
|
807 |
+
'submit_text_color' => $instance['design']['submit']['text_color'],
|
808 |
+
'submit_font_size' => $instance['design']['submit']['font_size'],
|
809 |
+
'submit_weight' => $instance['design']['submit']['weight'],
|
810 |
+
'submit_padding' => $instance['design']['submit']['padding'],
|
811 |
+
'submit_width' => ! empty( $instance['design']['submit']['width'] ) ? $instance['design']['submit']['width'] : '',
|
812 |
+
'submit_align' => ! empty( $instance['design']['submit']['align'] ) ? $instance['design']['submit']['align'] : '',
|
813 |
+
'submit_inset_highlight' => $instance['design']['submit']['inset_highlight'] . '%',
|
814 |
+
|
815 |
+
// Input focus styles
|
816 |
+
'outline_style' => $instance['design']['focus']['style'],
|
817 |
+
'outline_color' => $instance['design']['focus']['color'],
|
818 |
+
'outline_width' => $instance['design']['focus']['width'],
|
819 |
+
);
|
820 |
+
|
821 |
+
return $vars;
|
822 |
+
}
|
823 |
+
|
824 |
+
function get_google_font_fields( $instance ) {
|
825 |
+
return array(
|
826 |
+
$instance['design']['labels']['font'],
|
827 |
+
$instance['design']['fields']['font'],
|
828 |
+
);
|
829 |
+
}
|
830 |
+
|
831 |
+
static function name_from_label( $label, & $ids ) {
|
832 |
+
$it = 0;
|
833 |
+
|
834 |
+
$label = str_replace( ' ', '-', strtolower( $label ) );
|
835 |
+
$label = sanitize_html_class( $label );
|
836 |
+
do {
|
837 |
+
$id = $label . ( $it > 0 ? '-' . $it : '' );
|
838 |
+
$it ++;
|
839 |
+
} while ( ! empty( $ids[ $id ] ) );
|
840 |
+
$ids[ $id ] = true;
|
841 |
+
|
842 |
+
return $id;
|
843 |
+
}
|
844 |
+
|
845 |
+
/**
|
846 |
+
* Render the form fields
|
847 |
+
*
|
848 |
+
* @param $fields
|
849 |
+
* @param array $errors
|
850 |
+
* @param $instance
|
851 |
+
*/
|
852 |
+
function render_form_fields( $fields, $errors = array(), $instance ) {
|
853 |
+
|
854 |
+
$field_ids = array();
|
855 |
+
$label_position = $instance['design']['labels']['position'];
|
856 |
+
|
857 |
+
$indicate_required_fields = $instance['settings']['required_field_indicator'];
|
858 |
+
|
859 |
+
if ( ! empty( $indicate_required_fields ) ) {
|
860 |
+
?>
|
861 |
+
<p><em><?php echo esc_html( $instance['settings']['required_field_indicator_message'] ) ?></em></p>
|
862 |
+
<?php
|
863 |
+
}
|
864 |
+
|
865 |
+
foreach ( $fields as $i => $field ) {
|
866 |
+
if ( empty( $field['type'] ) ) {
|
867 |
+
continue;
|
868 |
+
}
|
869 |
+
// Using `$instance['_sow_form_id']` to uniquely identify contact form fields across widgets.
|
870 |
+
// I.e. if there are many contact form widgets on a page this will prevent field name conflicts.
|
871 |
+
$field_name = $this->name_from_label( ! empty( $field['label'] ) ? $field['label'] : $i, $field_ids ) . '-' . $instance['_sow_form_id'];
|
872 |
+
$field_id = 'sow-contact-form-field-' . $field_name;
|
873 |
+
|
874 |
+
$value = '';
|
875 |
+
if ( ! empty( $_POST[ $field_name ] ) && wp_verify_nonce( $_POST['_wpnonce'], '_contact_form_submit' ) ) {
|
876 |
+
$value = stripslashes_deep( $_POST[ $field_name ] );
|
877 |
+
}
|
878 |
+
|
879 |
+
?>
|
880 |
+
<div class="sow-form-field sow-form-field-<?php echo sanitize_html_class( $field['type'] ) ?>"><?php
|
881 |
+
|
882 |
+
$label = $field['label'];
|
883 |
+
if ( $indicate_required_fields && ! empty( $field['required']['required'] ) ) {
|
884 |
+
$label .= '*';
|
885 |
+
}
|
886 |
+
$is_text_input_field = ( $field['type'] != 'select' && $field['type'] != 'radio' && $field['type'] != 'checkboxes' );
|
887 |
+
// label should be rendered before the field, then CSS will do the exact positioning.
|
888 |
+
$render_label_before_field = ( $label_position != 'below' && $label_position != 'inside' ) || ( $label_position == 'inside' && ! $is_text_input_field );
|
889 |
+
if ( empty( $label_position ) || $render_label_before_field ) {
|
890 |
+
$this->render_form_label( $field_id, $label, $label_position );
|
891 |
+
}
|
892 |
+
|
893 |
+
$show_placeholder = $label_position == 'inside';
|
894 |
+
|
895 |
+
if ( ! empty( $errors[ $field_name ] ) ) {
|
896 |
+
?>
|
897 |
+
<div class="sow-error">
|
898 |
+
<?php echo wp_kses_post( $errors[ $field_name ] ) ?>
|
899 |
+
</div>
|
900 |
+
<?php
|
901 |
+
}
|
902 |
+
?><span class="sow-field-container"><?php
|
903 |
+
$class_name = empty( $field['type'] ) ? '' : 'SiteOrigin_Widget_ContactForm_Field_' . ucwords( $field['type'] );
|
904 |
+
// This does autoloading if required.
|
905 |
+
if ( class_exists( $class_name ) ) {
|
906 |
+
/**
|
907 |
+
* @var $contact_field SiteOrigin_Widget_ContactForm_Field_Base
|
908 |
+
*/
|
909 |
+
$field_input_options = array(
|
910 |
+
'field' => $field,
|
911 |
+
'field_id' => $field_id,
|
912 |
+
'field_name' => $field_name,
|
913 |
+
'value' => $value,
|
914 |
+
'show_placeholder' => $show_placeholder,
|
915 |
+
'label' => $label,
|
916 |
+
);
|
917 |
+
$contact_field = new $class_name( $field_input_options );
|
918 |
+
$contact_field->render();
|
919 |
+
} else {
|
920 |
+
echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $value ) . '" class="sow-text-field" ' . ( $show_placeholder ? 'placeholder="' . esc_attr( $label ) . '"' : '' ) . '/>';
|
921 |
+
}
|
922 |
+
?></span><?php
|
923 |
+
|
924 |
+
if ( ! empty( $label_position ) && $label_position == 'below' ) {
|
925 |
+
$this->render_form_label( $field_id, $label, $instance );
|
926 |
+
}
|
927 |
+
|
928 |
+
if ( ! empty( $field['description'] ) ) {
|
929 |
+
?>
|
930 |
+
<div class="sow-form-field-description">
|
931 |
+
<?php echo wp_kses_post( $field['description'] ) ?>
|
932 |
+
</div>
|
933 |
+
<?php
|
934 |
+
}
|
935 |
+
|
936 |
+
?></div><?php
|
937 |
+
}
|
938 |
+
}
|
939 |
+
|
940 |
+
function render_form_label( $field_id, $label, $position ) {
|
941 |
+
if ( ! empty( $label ) ) {
|
942 |
+
$label_class = '';
|
943 |
+
if ( ! empty( $position ) ) {
|
944 |
+
$label_class = ' class="sow-form-field-label-' . $position . '"';
|
945 |
+
}
|
946 |
+
?><label<?php if ( ! empty( $label_class ) ) {
|
947 |
+
echo $label_class;
|
948 |
+
} ?> for="<?php echo esc_attr( $field_id ) ?>"><strong><?php echo esc_html( $label ) ?></strong></label>
|
949 |
+
<?php
|
950 |
+
}
|
951 |
+
}
|
952 |
+
|
953 |
+
/**
|
954 |
+
* Ajax action handler to send the form
|
955 |
+
*/
|
956 |
+
function contact_form_action( $instance, $storage_hash ) {
|
957 |
+
if ( ! wp_verify_nonce( $_POST['_wpnonce'], '_contact_form_submit' ) ) {
|
958 |
+
// Using `return false;` instead of `wp_die` because this function may sometimes be called as a side effect
|
959 |
+
// of trying to enqueue scripts required for the front end. In those cases `$_POST['_wpnonce']` doesn't exist
|
960 |
+
// and calling `wp_die` will halt script execution and break things. Ideally it should be possible to enqueue
|
961 |
+
// front end scripts without calling widgets' render functions, but that will mean a fairly large refactor.
|
962 |
+
return false;
|
963 |
+
}
|
964 |
+
if ( empty( $_POST['instance_hash'] ) || $_POST['instance_hash'] != $storage_hash ) {
|
965 |
+
return false;
|
966 |
+
}
|
967 |
+
if ( empty( $instance['fields'] ) ) {
|
968 |
+
array(
|
969 |
+
'status' => null,
|
970 |
+
);
|
971 |
+
}
|
972 |
+
|
973 |
+
// Make sure that this action only runs once per instance
|
974 |
+
static $send_cache = array();
|
975 |
+
$send_cache_hash = md5( serialize( $instance ) . '::' . $storage_hash );
|
976 |
+
if ( isset( $send_cache[ $send_cache_hash ] ) ) {
|
977 |
+
return $send_cache[ $send_cache_hash ];
|
978 |
+
}
|
979 |
+
|
980 |
+
$errors = array();
|
981 |
+
$email_fields = array();
|
982 |
+
$post_vars = stripslashes_deep( $_POST );
|
983 |
+
|
984 |
+
$field_ids = array();
|
985 |
+
foreach ( $instance['fields'] as $i => $field ) {
|
986 |
+
if ( empty( $field['type'] ) ) {
|
987 |
+
continue;
|
988 |
+
}
|
989 |
+
$field_name = $this->name_from_label( ! empty( $field['label'] ) ? $field['label'] : $i, $field_ids ) . '-' . $instance['_sow_form_id'];
|
990 |
+
$value = ! empty( $post_vars[ $field_name ] ) ? $post_vars[ $field_name ] : '';
|
991 |
+
|
992 |
+
if ( empty( $value ) ) {
|
993 |
+
if ( $field['required']['required'] ) {
|
994 |
+
// Add in the default subject
|
995 |
+
if ( $field['type'] == 'subject' && ! empty( $instance['settings']['default_subject'] ) ) {
|
996 |
+
$value = $instance['settings']['default_subject'];
|
997 |
+
} else {
|
998 |
+
$errors[ $field_name ] = ! empty( $field['required']['missing_message'] ) ? $field['required']['missing_message'] : __( 'Required field', 'so-widgets-bundle' );
|
999 |
+
continue;
|
1000 |
+
}
|
1001 |
+
} else {
|
1002 |
+
continue; // Don't process an empty field that's not required
|
1003 |
+
}
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
// Type Validation
|
1007 |
+
switch ( $field['type'] ) {
|
1008 |
+
case 'email':
|
1009 |
+
if ( $value != sanitize_email( $value ) ) {
|
1010 |
+
$errors[ $field_name ] = __( 'Invalid email address.', 'so-widgets-bundle' );
|
1011 |
+
}
|
1012 |
+
$email_fields[ $field['type'] ] = $value;
|
1013 |
+
|
1014 |
+
break;
|
1015 |
+
|
1016 |
+
case 'name':
|
1017 |
+
case 'subject':
|
1018 |
+
$email_fields[ $field['type'] ] = $value;
|
1019 |
+
|
1020 |
+
break;
|
1021 |
+
|
1022 |
+
case 'checkboxes':
|
1023 |
+
$email_fields['message'][] = array(
|
1024 |
+
'label' => $field['label'],
|
1025 |
+
'value' => implode( ', ', $value ),
|
1026 |
+
);
|
1027 |
+
break;
|
1028 |
+
|
1029 |
+
default:
|
1030 |
+
$email_fields['message'][] = array(
|
1031 |
+
'label' => $field['label'],
|
1032 |
+
'value' => $value,
|
1033 |
+
);
|
1034 |
+
break;
|
1035 |
+
}
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
// Add in the default subject if no subject field is defined in the form at all
|
1039 |
+
if ( ! isset( $email_fields['subject'] ) && ! empty( $instance['settings']['default_subject'] ) ) {
|
1040 |
+
$email_fields['subject'] = $instance['settings']['default_subject'];
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
// Add in the default subject prefix
|
1044 |
+
if ( ! empty( $email_fields['subject'] ) && ! empty( $instance['settings']['subject_prefix'] ) ) {
|
1045 |
+
$email_fields['subject'] = $instance['settings']['subject_prefix'] . ' ' . $email_fields['subject'];
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
// Now we do some email message validation
|
1049 |
+
if ( empty( $errors ) ) {
|
1050 |
+
$email_errors = $this->validate_mail( $email_fields );
|
1051 |
+
// Missing subject input and no default subject set. Revert to using a generic default 'SiteName Contact Form'
|
1052 |
+
if ( ! isset( $email_fields['subject'] ) && ! empty( $email_errors['subject'] ) ) {
|
1053 |
+
unset( $email_errors['subject'] );
|
1054 |
+
$email_fields['subject'] = get_bloginfo() . ' ' . __( 'Contact Form', 'siteorigin-widgets' );
|
1055 |
+
}
|
1056 |
+
if ( ! empty( $email_errors ) ) {
|
1057 |
+
$errors['_general'] = $email_errors;
|
1058 |
+
}
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
// And if we get this far, do some spam filtering and Captcha checking
|
1062 |
+
if ( empty( $errors ) ) {
|
1063 |
+
$spam_errors = $this->spam_check( $post_vars, $email_fields, $instance );
|
1064 |
+
if ( ! empty( $spam_errors ) ) {
|
1065 |
+
// Now we can decide how we want to handle this spam status
|
1066 |
+
if ( ! empty( $spam_errors['akismet'] ) && $instance['spam']['akismet']['spam_action'] == 'tag' ) {
|
1067 |
+
unset( $spam_errors['akismet'] );
|
1068 |
+
$email_fields['subject'] = '[spam] ' . $email_fields['subject'];
|
1069 |
+
}
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
if ( ! empty( $spam_errors ) ) {
|
1073 |
+
$errors['_general'] = $spam_errors;
|
1074 |
+
}
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
if ( empty( $errors ) ) {
|
1078 |
+
// We can send the email
|
1079 |
+
$success = $this->send_mail( $email_fields, $instance );
|
1080 |
+
|
1081 |
+
if ( is_wp_error( $success ) ) {
|
1082 |
+
$errors['_general']['send'] = $success->get_error_message();
|
1083 |
+
} else if ( ! $success ) {
|
1084 |
+
$errors['_general']['send'] = __( 'Error sending email, please try again later.', 'so-widgets-bundle' );
|
1085 |
+
} else {
|
1086 |
+
// This action will allow other plugins to run code when contact form has successfully been sent
|
1087 |
+
do_action( 'siteorigin_widgets_contact_sent', $instance, $email_fields );
|
1088 |
+
}
|
1089 |
+
} else {
|
1090 |
+
// This action will allow other plugins to run code when the contact form submission has resulted in error
|
1091 |
+
do_action( 'siteorigin_widgets_contact_error', $instance, $email_fields, $errors );
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
$send_cache[ $send_cache_hash ] = array(
|
1095 |
+
'status' => empty( $errors ) ? 'success' : 'fail',
|
1096 |
+
'errors' => $errors
|
1097 |
+
);
|
1098 |
+
|
1099 |
+
return $send_cache[ $send_cache_hash ];
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
/**
|
1103 |
+
* Validate fields of an email message
|
1104 |
+
*/
|
1105 |
+
function validate_mail( $email_fields ) {
|
1106 |
+
$errors = array();
|
1107 |
+
if ( empty( $email_fields['email'] ) ) {
|
1108 |
+
$errors['email'] = __( 'A valid email is required', 'so-widgets-bundle' );
|
1109 |
+
} elseif ( function_exists( 'filter_var' ) && ! filter_var( $email_fields['email'], FILTER_VALIDATE_EMAIL ) ) {
|
1110 |
+
$errors['email'] = __( 'The email address is invalid', 'so-widgets-bundle' );
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
if ( empty( $email_fields['subject'] ) ) {
|
1114 |
+
$errors['subject'] = __( 'Missing subject', 'so-widgets-bundle' );
|
1115 |
+
}
|
1116 |
+
|
1117 |
+
return $errors;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
/**
|
1121 |
+
* Check the email for spam
|
1122 |
+
*
|
1123 |
+
* @param $email_fields
|
1124 |
+
* @param $instance
|
1125 |
+
*
|
1126 |
+
* @return array
|
1127 |
+
*/
|
1128 |
+
function spam_check( $post_vars, $email_fields, $instance ) {
|
1129 |
+
$errors = array();
|
1130 |
+
|
1131 |
+
$recaptcha_config = $instance['spam']['recaptcha'];
|
1132 |
+
$use_recaptcha = $recaptcha_config['use_captcha'] && ! empty( $recaptcha_config['site_key'] ) && ! empty( $recaptcha_config['secret_key'] );
|
1133 |
+
if ( $use_recaptcha ) {
|
1134 |
+
$result = wp_remote_post(
|
1135 |
+
'https://www.google.com/recaptcha/api/siteverify',
|
1136 |
+
array(
|
1137 |
+
'body' => array(
|
1138 |
+
'secret' => $instance['spam']['recaptcha']['secret_key'],
|
1139 |
+
'response' => $post_vars['g-recaptcha-response'],
|
1140 |
+
'remoteip' => isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null,
|
1141 |
+
)
|
1142 |
+
)
|
1143 |
+
);
|
1144 |
+
|
1145 |
+
if ( ! is_wp_error( $result ) && ! empty( $result['body'] ) ) {
|
1146 |
+
$result = json_decode( $result['body'], true );
|
1147 |
+
if ( isset( $result['success'] ) && ! $result['success'] ) {
|
1148 |
+
$errors['recaptcha'] = __( 'Error validating your Captcha response.', 'so-widgets-bundle' );
|
1149 |
+
}
|
1150 |
+
}
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
if ( $instance['spam']['akismet']['use_akismet'] && class_exists( 'Akismet' ) ) {
|
1154 |
+
$comment = array();
|
1155 |
+
|
1156 |
+
$message_text = array();
|
1157 |
+
foreach ( $email_fields['message'] as $m ) {
|
1158 |
+
$message_text[] = $m['value'];
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
$comment['comment_text'] = $email_fields['subject'] . "\n\n" . implode( "\n\n", $message_text );
|
1162 |
+
$comment['comment_author'] = ! empty( $email_fields['name'] ) ? $email_fields['name'] : '';
|
1163 |
+
$comment['comment_author_email'] = $email_fields['email'];
|
1164 |
+
$comment['comment_post_ID'] = get_the_ID();
|
1165 |
+
|
1166 |
+
$comment['comment_type'] = 'contact-form';
|
1167 |
+
|
1168 |
+
$comment['user_ip'] = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null;
|
1169 |
+
$comment['user_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
1170 |
+
$comment['referrer'] = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : null;
|
1171 |
+
$comment['blog'] = get_option( 'home' );
|
1172 |
+
$comment['blog_lang'] = get_locale();
|
1173 |
+
$comment['blog_charset'] = get_option( 'blog_charset' );
|
1174 |
+
|
1175 |
+
// Pretend to check with Akismet
|
1176 |
+
$response = Akismet::http_post( Akismet::build_query( $comment ), 'comment-check' );
|
1177 |
+
$is_spam = ! empty( $response[1] ) && $response[1] == 'true';
|
1178 |
+
|
1179 |
+
if ( $is_spam ) {
|
1180 |
+
$errors['akismet'] = __( 'Unfortunately our system identified your message as spam.', 'so-widgets-bundle' );
|
1181 |
+
}
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
return $errors;
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
function send_mail( $email_fields, $instance ) {
|
1188 |
+
$body = '<strong>' . __( 'From', 'so-widgets-bundle' ) . ':</strong> <a href="mailto:' . sanitize_email( $email_fields['email'] ) . '">' . esc_html( $email_fields['name'] ) . '</a> <' . sanitize_email( $email_fields['email'] ) . "> \n\n";
|
1189 |
+
foreach ( $email_fields['message'] as $m ) {
|
1190 |
+
$body .= '<strong>' . $m['label'] . ':</strong>';
|
1191 |
+
$body .= "\n";
|
1192 |
+
$body .= htmlspecialchars( $m['value'] );
|
1193 |
+
$body .= "\n\n";
|
1194 |
+
}
|
1195 |
+
$body = wpautop( trim( $body ) );
|
1196 |
+
|
1197 |
+
if ( $instance['settings']['to'] == 'ibrossiter@gmail.com' || $instance['settings']['to'] == 'test@example.com' || empty( $instance['settings']['to'] ) ) {
|
1198 |
+
// Replace default and empty email address.
|
1199 |
+
// Also replaces the email address that comes from the prebuilt layout directory
|
1200 |
+
$instance['settings']['to'] = get_option( 'admin_email' );
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
if ( $instance['settings']['from'] == 'test@example.com' || empty( $instance['settings']['from'] ) ) {
|
1204 |
+
$instance['settings']['from'] = get_option( 'admin_email' );
|
1205 |
+
}
|
1206 |
+
|
1207 |
+
$headers = array(
|
1208 |
+
'Content-Type: text/html; charset=UTF-8',
|
1209 |
+
'From: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . $instance['settings']['from'] . '>',
|
1210 |
+
'Reply-To: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . sanitize_email( $email_fields['email'] ) . '>',
|
1211 |
+
);
|
1212 |
+
|
1213 |
+
// Check if this is a duplicated send
|
1214 |
+
$hash = md5( json_encode( array(
|
1215 |
+
'to' => $instance['settings']['to'],
|
1216 |
+
'subject' => $email_fields['subject'],
|
1217 |
+
'body' => $body,
|
1218 |
+
'headers' => $headers
|
1219 |
+
) ) );
|
1220 |
+
$hash_check = get_option( 'so_contact_hashes', array() );
|
1221 |
+
// Remove expired hashes
|
1222 |
+
foreach ( $hash_check as $h => $t ) {
|
1223 |
+
if ( $t < time() - 5 * 60 ) {
|
1224 |
+
unset( $hash_check[ $h ] );
|
1225 |
+
}
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
if ( isset( $hash_check[ $hash ] ) ) {
|
1229 |
+
// Store the version with the expired hashes removed
|
1230 |
+
update_option( 'so_contact_hashes', $hash_check, true );
|
1231 |
+
|
1232 |
+
// This message has already been sent successfully
|
1233 |
+
return true;
|
1234 |
+
}
|
1235 |
+
|
1236 |
+
$mail_success = wp_mail( $instance['settings']['to'], $email_fields['subject'], $body, $headers );
|
1237 |
+
if ( $mail_success ) {
|
1238 |
+
$hash_check[ $hash ] = time();
|
1239 |
+
update_option( 'so_contact_hashes', $hash_check, true );
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
return $mail_success;
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
/**
|
1246 |
+
* Sanitize a value for an email header.
|
1247 |
+
*
|
1248 |
+
* From Pear Mail https://pear.php.net/package/Mail (BSD Style license - https://pear.php.net/copyright.php).
|
1249 |
+
*
|
1250 |
+
* @param $value
|
1251 |
+
*
|
1252 |
+
* @return mixed
|
1253 |
+
*/
|
1254 |
+
static function sanitize_header( $value ) {
|
1255 |
+
return preg_replace( '=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i', null, $value );
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
siteorigin_widget_register( 'sow-contact-form', __FILE__, 'SiteOrigin_Widgets_ContactForm_Widget' );
|
1261 |
+
|
1262 |
+
// Tell the autoloader where to look for contactform field classes.
|
1263 |
+
function contactform_fields_class_paths( $class_paths ) {
|
1264 |
+
$loader = SiteOrigin_Widget_Field_Class_Loader::single();
|
1265 |
+
|
1266 |
+
$loader->add_class_prefixes(
|
1267 |
+
apply_filters( 'siteorigin_widgets_contact_form_field_class_prefixes', array(
|
1268 |
+
'SiteOrigin_Widget_ContactForm_Field_'
|
1269 |
+
) ),
|
1270 |
+
'contact-form'
|
1271 |
+
);
|
1272 |
+
|
1273 |
+
$loader->add_class_paths(
|
1274 |
+
apply_filters( 'siteorigin_widgets_contact_form_field_class_paths', array(
|
1275 |
+
plugin_dir_path( __FILE__ ) . 'fields/'
|
1276 |
+
) ),
|
1277 |
+
'contact-form'
|
1278 |
+
);
|
1279 |
+
|
1280 |
+
return $class_paths;
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
add_filter( 'init', 'contactform_fields_class_paths' );
|
widgets/contact/js/contact.js
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
var SiteOriginContactForm = {
|
2 |
-
init: function ($, useRecaptcha) {
|
3 |
-
var $contactForms = $('form.sow-contact-form');
|
4 |
-
$contactForms.each(function () {
|
5 |
-
var $el = $(this);
|
6 |
-
var $submitButton = $(this).find('.sow-submit-wrapper > input.sow-submit');
|
7 |
-
if (useRecaptcha) {
|
8 |
-
// Render recaptcha
|
9 |
-
var $recaptchaDiv = $el.find('.sow-recaptcha');
|
10 |
-
if ($recaptchaDiv.length) {
|
11 |
-
var config = $recaptchaDiv.data('config');
|
12 |
-
$submitButton.prop('disabled', true);
|
13 |
-
grecaptcha.render($recaptchaDiv.get(0),
|
14 |
-
{
|
15 |
-
'sitekey': config.sitekey,
|
16 |
-
'theme': config.theme,
|
17 |
-
'type': config.type,
|
18 |
-
'size': config.size,
|
19 |
-
'callback': function (response) {
|
20 |
-
// Enable the submit button once we have a response from recaptcha.
|
21 |
-
$submitButton.prop('disabled', false);
|
22 |
-
},
|
23 |
-
}
|
24 |
-
);
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
// Disable the submit button on click to avoid multiple submits.
|
29 |
-
$contactForms.submit( function () {
|
30 |
-
if ( window.location.hash ) {
|
31 |
-
$( this ).attr( 'action', $( this ).attr( 'action' ) + ',' + window.location.hash.replace( /^#/, '' ) );
|
32 |
-
}
|
33 |
-
$submitButton.prop('disabled', true);
|
34 |
-
} );
|
35 |
-
});
|
36 |
-
},
|
37 |
-
};
|
38 |
-
|
39 |
-
function soContactFormInitialize() {
|
40 |
-
SiteOriginContactForm.init(window.jQuery, true);
|
41 |
-
}
|
42 |
-
|
43 |
-
jQuery(function ($) {
|
44 |
-
|
45 |
-
var $contactForms = $('form.sow-contact-form');
|
46 |
-
// Check if there are any recaptcha placeholders.
|
47 |
-
var useRecaptcha = $contactForms.toArray().some(function (form) {
|
48 |
-
return $(form).find('div').hasClass('sow-recaptcha');
|
49 |
-
});
|
50 |
-
|
51 |
-
if (useRecaptcha) {
|
52 |
-
if (window.recaptcha) {
|
53 |
-
SiteOriginContactForm.init($, useRecaptcha);
|
54 |
-
} else {
|
55 |
-
// Load the recaptcha API
|
56 |
-
var apiUrl = 'https://www.google.com/recaptcha/api.js?onload=soContactFormInitialize&render=explicit';
|
57 |
-
var script = $('<script type="text/javascript" src="' + apiUrl + '" async defer>');
|
58 |
-
$('body').append(script);
|
59 |
-
}
|
60 |
-
} else {
|
61 |
-
SiteOriginContactForm.init($, useRecaptcha);
|
62 |
-
}
|
63 |
-
});
|
1 |
+
var SiteOriginContactForm = {
|
2 |
+
init: function ($, useRecaptcha) {
|
3 |
+
var $contactForms = $('form.sow-contact-form');
|
4 |
+
$contactForms.each(function () {
|
5 |
+
var $el = $(this);
|
6 |
+
var $submitButton = $(this).find('.sow-submit-wrapper > input.sow-submit');
|
7 |
+
if (useRecaptcha) {
|
8 |
+
// Render recaptcha
|
9 |
+
var $recaptchaDiv = $el.find('.sow-recaptcha');
|
10 |
+
if ($recaptchaDiv.length) {
|
11 |
+
var config = $recaptchaDiv.data('config');
|
12 |
+
$submitButton.prop('disabled', true);
|
13 |
+
grecaptcha.render($recaptchaDiv.get(0),
|
14 |
+
{
|
15 |
+
'sitekey': config.sitekey,
|
16 |
+
'theme': config.theme,
|
17 |
+
'type': config.type,
|
18 |
+
'size': config.size,
|
19 |
+
'callback': function (response) {
|
20 |
+
// Enable the submit button once we have a response from recaptcha.
|
21 |
+
$submitButton.prop('disabled', false);
|
22 |
+
},
|
23 |
+
}
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
// Disable the submit button on click to avoid multiple submits.
|
29 |
+
$contactForms.submit( function () {
|
30 |
+
if ( window.location.hash ) {
|
31 |
+
$( this ).attr( 'action', $( this ).attr( 'action' ) + ',' + window.location.hash.replace( /^#/, '' ) );
|
32 |
+
}
|
33 |
+
$submitButton.prop('disabled', true);
|
34 |
+
} );
|
35 |
+
});
|
36 |
+
},
|
37 |
+
};
|
38 |
+
|
39 |
+
function soContactFormInitialize() {
|
40 |
+
SiteOriginContactForm.init(window.jQuery, true);
|
41 |
+
}
|
42 |
+
|
43 |
+
jQuery(function ($) {
|
44 |
+
|
45 |
+
var $contactForms = $('form.sow-contact-form');
|
46 |
+
// Check if there are any recaptcha placeholders.
|
47 |
+
var useRecaptcha = $contactForms.toArray().some(function (form) {
|
48 |
+
return $(form).find('div').hasClass('sow-recaptcha');
|
49 |
+
});
|
50 |
+
|
51 |
+
if (useRecaptcha) {
|
52 |
+
if (window.recaptcha) {
|
53 |
+
SiteOriginContactForm.init($, useRecaptcha);
|
54 |
+
} else {
|
55 |
+
// Load the recaptcha API
|
56 |
+
var apiUrl = 'https://www.google.com/recaptcha/api.js?onload=soContactFormInitialize&render=explicit';
|
57 |
+
var script = $('<script type="text/javascript" src="' + apiUrl + '" async defer>');
|
58 |
+
$('body').append(script);
|
59 |
+
}
|
60 |
+
} else {
|
61 |
+
SiteOriginContactForm.init($, useRecaptcha);
|
62 |
+
}
|
63 |
+
});
|
widgets/contact/styles/default.less
CHANGED
@@ -1,231 +1,231 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
.sow-form-field {
|
6 |
-
display: block;
|
7 |
-
margin-bottom: 1em;
|
8 |
-
.clearfix();
|
9 |
-
|
10 |
-
> label {
|
11 |
-
display: block;
|
12 |
-
margin-bottom: 5px;
|
13 |
-
|
14 |
-
@label_width: default;
|
15 |
-
@label_align: default;
|
16 |
-
width: @label_width;
|
17 |
-
text-align: @label_align;
|
18 |
-
|
19 |
-
strong {
|
20 |
-
@label_font_family: default;
|
21 |
-
@label_font_weight: default;
|
22 |
-
.font(@label_font_family, @label_font_weight);
|
23 |
-
|
24 |
-
@label_font_size: default;
|
25 |
-
@label_font_color: default;
|
26 |
-
font-size: @label_font_size;
|
27 |
-
color: @label_font_color;
|
28 |
-
}
|
29 |
-
|
30 |
-
&.sow-form-field-label-left {
|
31 |
-
float: left;
|
32 |
-
margin-right: 10px;
|
33 |
-
}
|
34 |
-
|
35 |
-
&.sow-form-field-label-right {
|
36 |
-
float: right;
|
37 |
-
margin-left: 10px;
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
.sow-field-container {
|
42 |
-
overflow: hidden;
|
43 |
-
display: block;
|
44 |
-
|
45 |
-
textarea:focus,
|
46 |
-
input:focus,
|
47 |
-
> :focus {
|
48 |
-
@outline_style: solid;
|
49 |
-
@outline_color: default;
|
50 |
-
@outline_width: 1px;
|
51 |
-
|
52 |
-
// NB: Do not optimize this into a single line, otherwise the removal of 'default' values won't work.
|
53 |
-
outline-style: @outline_style;
|
54 |
-
outline-color: @outline_color;
|
55 |
-
outline-width: @outline_width;
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
@field_font_family: default;
|
60 |
-
@field_font_weight: default;
|
61 |
-
@field_font_size: default;
|
62 |
-
@field_font_color: default;
|
63 |
-
|
64 |
-
@field_background: default;
|
65 |
-
|
66 |
-
@field_margin: default;
|
67 |
-
@field_padding: default;
|
68 |
-
@field_border_radius: default;
|
69 |
-
@field_border_color: default;
|
70 |
-
@field_border_width: default;
|
71 |
-
@field_border_style: default;
|
72 |
-
@field_height: default;
|
73 |
-
|
74 |
-
textarea,
|
75 |
-
.sow-text-field {
|
76 |
-
display: block;
|
77 |
-
width: 100%;
|
78 |
-
.box-sizing(border-box);
|
79 |
-
border-radius: @field_border_radius;
|
80 |
-
|
81 |
-
margin: @field_margin;
|
82 |
-
border: @field_border_width @field_border_style @field_border_color;
|
83 |
-
padding: @field_padding;
|
84 |
-
height: @field_height;
|
85 |
-
|
86 |
-
background: @field_background;
|
87 |
-
color: @field_font_color;
|
88 |
-
|
89 |
-
font-size: @field_font_size;
|
90 |
-
.font(@field_font_family, @field_font_weight);
|
91 |
-
}
|
92 |
-
|
93 |
-
&.sow-form-field-checkboxes, &.sow-form-field-radio {
|
94 |
-
ul {
|
95 |
-
list-style: none;
|
96 |
-
margin: 0;
|
97 |
-
padding: 0;
|
98 |
-
|
99 |
-
li {
|
100 |
-
margin: 0;
|
101 |
-
}
|
102 |
-
|
103 |
-
label {
|
104 |
-
margin-bottom: 0;
|
105 |
-
}
|
106 |
-
|
107 |
-
input {
|
108 |
-
float: left;
|
109 |
-
margin: 0.4em 0.5em 0 0;
|
110 |
-
height: auto;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
@description_font_size: 0.9em;
|
116 |
-
@description_font_color: #999999;
|
117 |
-
@description_font_style: italic;
|
118 |
-
|
119 |
-
.sow-form-field-description {
|
120 |
-
font-size: @description_font_size;
|
121 |
-
margin-top: 0.2em;
|
122 |
-
margin-left: 0.2em;
|
123 |
-
color: @description_font_color;
|
124 |
-
font-style: @description_font_style;
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
.sow-recaptcha {
|
129 |
-
margin-bottom: 1em;
|
130 |
-
}
|
131 |
-
|
132 |
-
.sow-contact-form {
|
133 |
-
// Container Background
|
134 |
-
@container_background: default;
|
135 |
-
@container_padding: 10px;
|
136 |
-
|
137 |
-
// Container border
|
138 |
-
@container_border_color: #c0c0c0;
|
139 |
-
@container_border_width: 1px;
|
140 |
-
@container_border_style: solid;
|
141 |
-
|
142 |
-
padding: @container_padding;
|
143 |
-
border: @container_border_color @container_border_style @container_border_width;
|
144 |
-
background-color: @container_background;
|
145 |
-
|
146 |
-
.sow-error {
|
147 |
-
@error_background: #fce4e5;
|
148 |
-
@error_border: #ec666a;
|
149 |
-
@error_text: #ec666a;
|
150 |
-
@error_padding: 5px;
|
151 |
-
@error_margin: 10px;
|
152 |
-
|
153 |
-
background: @error_background;
|
154 |
-
border: 1px solid @error_border;
|
155 |
-
color: @error_text;
|
156 |
-
border-radius: 2px;
|
157 |
-
padding: @error_padding;
|
158 |
-
font-size: 0.8em;
|
159 |
-
list-style: none;
|
160 |
-
margin: 0 0 @error_margin 0;
|
161 |
-
|
162 |
-
li {
|
163 |
-
margin: 0;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
.sow-submit-wrapper {
|
168 |
-
|
169 |
-
.sow-submit {
|
170 |
-
|
171 |
-
}
|
172 |
-
|
173 |
-
.sow-submit:disabled {
|
174 |
-
|
175 |
-
}
|
176 |
-
|
177 |
-
}
|
178 |
-
|
179 |
-
.sow-submit-styled {
|
180 |
-
|
181 |
-
@submit_background_color: #eeeeee;
|
182 |
-
@submit_background_gradient: 10%;
|
183 |
-
@submit_border_color: #989a9c;
|
184 |
-
@submit_border_style: solid;
|
185 |
-
@submit_border_width: 1px;
|
186 |
-
@submit_border_radius: 3px;
|
187 |
-
@submit_text_color: #5a5a5a;
|
188 |
-
@submit_font_size: default;
|
189 |
-
@submit_weight: 500;
|
190 |
-
@submit_padding: 10px;
|
191 |
-
@submit_width: default;
|
192 |
-
@submit_align: left;
|
193 |
-
|
194 |
-
@submit_inset_highlight: 50%;
|
195 |
-
|
196 |
-
text-align: @submit_align;
|
197 |
-
.sow-submit {
|
198 |
-
color: @submit_text_color;
|
199 |
-
& when( @submit_background_gradient > 0% ) {
|
200 |
-
.gradient(
|
201 |
-
lighten(@submit_background_color, @submit_background_gradient),
|
202 |
-
darken(@submit_background_color, @submit_background_gradient),
|
203 |
-
lighten(@submit_background_color, @submit_background_gradient)
|
204 |
-
);
|
205 |
-
}
|
206 |
-
|
207 |
-
border: @submit_border_width @submit_border_style @submit_border_color;
|
208 |
-
border-radius: @submit_border_radius;
|
209 |
-
font-weight: @submit_weight;
|
210 |
-
font-size: @submit_font_size;
|
211 |
-
padding: @submit_padding @submit_padding * 2;
|
212 |
-
display: inline-block;
|
213 |
-
width: @submit_width;
|
214 |
-
|
215 |
-
.sow-submit-box-shadow ( @percent ) when ( @percent > 0% ) {
|
216 |
-
box-shadow: inset 0 -1px 0 fade( #ffffff, @percent );
|
217 |
-
}
|
218 |
-
|
219 |
-
.sow-submit-box-shadow( @submit_inset_highlight );
|
220 |
-
}
|
221 |
-
|
222 |
-
.sow-submit:disabled {
|
223 |
-
color: lighten(@submit_text_color, 20%);
|
224 |
-
background: lighten(@submit_background_color, 20%);
|
225 |
-
border: @submit_border_width @submit_border_style lighten(@submit_border_color, 20%);
|
226 |
-
|
227 |
-
}
|
228 |
-
|
229 |
-
|
230 |
-
}
|
231 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
.sow-form-field {
|
6 |
+
display: block;
|
7 |
+
margin-bottom: 1em;
|
8 |
+
.clearfix();
|
9 |
+
|
10 |
+
> label {
|
11 |
+
display: block;
|
12 |
+
margin-bottom: 5px;
|
13 |
+
|
14 |
+
@label_width: default;
|
15 |
+
@label_align: default;
|
16 |
+
width: @label_width;
|
17 |
+
text-align: @label_align;
|
18 |
+
|
19 |
+
strong {
|
20 |
+
@label_font_family: default;
|
21 |
+
@label_font_weight: default;
|
22 |
+
.font(@label_font_family, @label_font_weight);
|
23 |
+
|
24 |
+
@label_font_size: default;
|
25 |
+
@label_font_color: default;
|
26 |
+
font-size: @label_font_size;
|
27 |
+
color: @label_font_color;
|
28 |
+
}
|
29 |
+
|
30 |
+
&.sow-form-field-label-left {
|
31 |
+
float: left;
|
32 |
+
margin-right: 10px;
|
33 |
+
}
|
34 |
+
|
35 |
+
&.sow-form-field-label-right {
|
36 |
+
float: right;
|
37 |
+
margin-left: 10px;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
.sow-field-container {
|
42 |
+
overflow: hidden;
|
43 |
+
display: block;
|
44 |
+
|
45 |
+
textarea:focus,
|
46 |
+
input:focus,
|
47 |
+
> :focus {
|
48 |
+
@outline_style: solid;
|
49 |
+
@outline_color: default;
|
50 |
+
@outline_width: 1px;
|
51 |
+
|
52 |
+
// NB: Do not optimize this into a single line, otherwise the removal of 'default' values won't work.
|
53 |
+
outline-style: @outline_style;
|
54 |
+
outline-color: @outline_color;
|
55 |
+
outline-width: @outline_width;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
@field_font_family: default;
|
60 |
+
@field_font_weight: default;
|
61 |
+
@field_font_size: default;
|
62 |
+
@field_font_color: default;
|
63 |
+
|
64 |
+
@field_background: default;
|
65 |
+
|
66 |
+
@field_margin: default;
|
67 |
+
@field_padding: default;
|
68 |
+
@field_border_radius: default;
|
69 |
+
@field_border_color: default;
|
70 |
+
@field_border_width: default;
|
71 |
+
@field_border_style: default;
|
72 |
+
@field_height: default;
|
73 |
+
|
74 |
+
textarea,
|
75 |
+
.sow-text-field {
|
76 |
+
display: block;
|
77 |
+
width: 100%;
|
78 |
+
.box-sizing(border-box);
|
79 |
+
border-radius: @field_border_radius;
|
80 |
+
|
81 |
+
margin: @field_margin;
|
82 |
+
border: @field_border_width @field_border_style @field_border_color;
|
83 |
+
padding: @field_padding;
|
84 |
+
height: @field_height;
|
85 |
+
|
86 |
+
background: @field_background;
|
87 |
+
color: @field_font_color;
|
88 |
+
|
89 |
+
font-size: @field_font_size;
|
90 |
+
.font(@field_font_family, @field_font_weight);
|
91 |
+
}
|
92 |
+
|
93 |
+
&.sow-form-field-checkboxes, &.sow-form-field-radio {
|
94 |
+
ul {
|
95 |
+
list-style: none;
|
96 |
+
margin: 0;
|
97 |
+
padding: 0;
|
98 |
+
|
99 |
+
li {
|
100 |
+
margin: 0;
|
101 |
+
}
|
102 |
+
|
103 |
+
label {
|
104 |
+
margin-bottom: 0;
|
105 |
+
}
|
106 |
+
|
107 |
+
input {
|
108 |
+
float: left;
|
109 |
+
margin: 0.4em 0.5em 0 0;
|
110 |
+
height: auto;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
@description_font_size: 0.9em;
|
116 |
+
@description_font_color: #999999;
|
117 |
+
@description_font_style: italic;
|
118 |
+
|
119 |
+
.sow-form-field-description {
|
120 |
+
font-size: @description_font_size;
|
121 |
+
margin-top: 0.2em;
|
122 |
+
margin-left: 0.2em;
|
123 |
+
color: @description_font_color;
|
124 |
+
font-style: @description_font_style;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
.sow-recaptcha {
|
129 |
+
margin-bottom: 1em;
|
130 |
+
}
|
131 |
+
|
132 |
+
.sow-contact-form {
|
133 |
+
// Container Background
|
134 |
+
@container_background: default;
|
135 |
+
@container_padding: 10px;
|
136 |
+
|
137 |
+
// Container border
|
138 |
+
@container_border_color: #c0c0c0;
|
139 |
+
@container_border_width: 1px;
|
140 |
+
@container_border_style: solid;
|
141 |
+
|
142 |
+
padding: @container_padding;
|
143 |
+
border: @container_border_color @container_border_style @container_border_width;
|
144 |
+
background-color: @container_background;
|
145 |
+
|
146 |
+
.sow-error {
|
147 |
+
@error_background: #fce4e5;
|
148 |
+
@error_border: #ec666a;
|
149 |
+
@error_text: #ec666a;
|
150 |
+
@error_padding: 5px;
|
151 |
+
@error_margin: 10px;
|
152 |
+
|
153 |
+
background: @error_background;
|
154 |
+
border: 1px solid @error_border;
|
155 |
+
color: @error_text;
|
156 |
+
border-radius: 2px;
|
157 |
+
padding: @error_padding;
|
158 |
+
font-size: 0.8em;
|
159 |
+
list-style: none;
|
160 |
+
margin: 0 0 @error_margin 0;
|
161 |
+
|
162 |
+
li {
|
163 |
+
margin: 0;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
.sow-submit-wrapper {
|
168 |
+
|
169 |
+
.sow-submit {
|
170 |
+
|
171 |
+
}
|
172 |
+
|
173 |
+
.sow-submit:disabled {
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
178 |
+
|
179 |
+
.sow-submit-styled {
|
180 |
+
|
181 |
+
@submit_background_color: #eeeeee;
|
182 |
+
@submit_background_gradient: 10%;
|
183 |
+
@submit_border_color: #989a9c;
|
184 |
+
@submit_border_style: solid;
|
185 |
+
@submit_border_width: 1px;
|
186 |
+
@submit_border_radius: 3px;
|
187 |
+
@submit_text_color: #5a5a5a;
|
188 |
+
@submit_font_size: default;
|
189 |
+
@submit_weight: 500;
|
190 |
+
@submit_padding: 10px;
|
191 |
+
@submit_width: default;
|
192 |
+
@submit_align: left;
|
193 |
+
|
194 |
+
@submit_inset_highlight: 50%;
|
195 |
+
|
196 |
+
text-align: @submit_align;
|
197 |
+
.sow-submit {
|
198 |
+
color: @submit_text_color;
|
199 |
+
& when( @submit_background_gradient > 0% ) {
|
200 |
+
.gradient(
|
201 |
+
lighten(@submit_background_color, @submit_background_gradient),
|
202 |
+
darken(@submit_background_color, @submit_background_gradient),
|
203 |
+
lighten(@submit_background_color, @submit_background_gradient)
|
204 |
+
);
|
205 |
+
}
|
206 |
+
|
207 |
+
border: @submit_border_width @submit_border_style @submit_border_color;
|
208 |
+
border-radius: @submit_border_radius;
|
209 |
+
font-weight: @submit_weight;
|
210 |
+
font-size: @submit_font_size;
|
211 |
+
padding: @submit_padding @submit_padding * 2;
|
212 |
+
display: inline-block;
|
213 |
+
width: @submit_width;
|
214 |
+
|
215 |
+
.sow-submit-box-shadow ( @percent ) when ( @percent > 0% ) {
|
216 |
+
box-shadow: inset 0 -1px 0 fade( #ffffff, @percent );
|
217 |
+
}
|
218 |
+
|
219 |
+
.sow-submit-box-shadow( @submit_inset_highlight );
|
220 |
+
}
|
221 |
+
|
222 |
+
.sow-submit:disabled {
|
223 |
+
color: lighten(@submit_text_color, 20%);
|
224 |
+
background: lighten(@submit_background_color, 20%);
|
225 |
+
border: @submit_border_width @submit_border_style lighten(@submit_border_color, 20%);
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
}
|
231 |
+
}
|
widgets/contact/tpl/default.php
CHANGED
@@ -1,58 +1,58 @@
|
|
1 |
-
<?php
|
2 |
-
$result = $this->contact_form_action( $instance, $instance_hash );
|
3 |
-
|
4 |
-
// Display the title
|
5 |
-
if( $instance['display_title'] && !empty( $instance['title'] ) ) {
|
6 |
-
echo $args['before_title'] . $instance['title'] . $args['after_title'];
|
7 |
-
}
|
8 |
-
$short_hash = substr( $instance_hash, 0, 4 );
|
9 |
-
if( $result['status'] == 'success' ) {
|
10 |
-
// Display the success message
|
11 |
-
?>
|
12 |
-
<div class="sow-contact-form-success" id="contact-form-<?php echo esc_attr( $short_hash ) ?>">
|
13 |
-
<?php echo wp_kses_post( wpautop( $instance['settings']['success_message'] ) ) ?>
|
14 |
-
</div>
|
15 |
-
<?php
|
16 |
-
}
|
17 |
-
else {
|
18 |
-
$recaptcha_config = $instance['spam']['recaptcha'];
|
19 |
-
$use_recaptcha = $recaptcha_config['use_captcha'] && ! empty( $recaptcha_config['site_key'] ) && ! empty( $recaptcha_config['secret_key'] );
|
20 |
-
|
21 |
-
$settings = null;
|
22 |
-
if( $use_recaptcha ) {
|
23 |
-
$settings = array(
|
24 |
-
'sitekey' => $recaptcha_config['site_key'],
|
25 |
-
'theme' => $recaptcha_config['theme'],
|
26 |
-
'type' => $recaptcha_config['type'],
|
27 |
-
'size' => $recaptcha_config['size']
|
28 |
-
);
|
29 |
-
}
|
30 |
-
?>
|
31 |
-
<form action="<?php echo esc_url( add_query_arg( false, false ) ) ?>#contact-form-<?php echo esc_attr( $short_hash ) ?>"
|
32 |
-
method="POST" class="sow-contact-form" id="contact-form-<?php echo esc_attr( $short_hash ) ?>">
|
33 |
-
|
34 |
-
<?php if( !empty($result['errors']['_general']) ) : ?>
|
35 |
-
<ul class="sow-error">
|
36 |
-
<?php foreach( $result['errors']['_general'] as $type => $message ) : ?>
|
37 |
-
<li><?php echo esc_html( $message ) ?></li>
|
38 |
-
<?php endforeach ?>
|
39 |
-
</ul>
|
40 |
-
<?php endif ?>
|
41 |
-
|
42 |
-
<?php $this->render_form_fields( $instance['fields'], $result['errors'], $instance ) ?>
|
43 |
-
<input type="hidden" name="instance_hash" value="<?php echo esc_attr( $instance_hash ) ?>" />
|
44 |
-
<?php echo wp_nonce_field( '_contact_form_submit' ) ?>
|
45 |
-
|
46 |
-
<?php if( $use_recaptcha ) : ?>
|
47 |
-
<div class="sow-recaptcha"
|
48 |
-
data-config="<?php echo esc_attr( json_encode( $settings ) ) ?>"></div>
|
49 |
-
<?php endif; ?>
|
50 |
-
|
51 |
-
<div class="sow-submit-wrapper <?php if( $instance['design']['submit']['styled'] ) echo 'sow-submit-styled' ?>">
|
52 |
-
<input type="submit" value="<?php echo esc_attr( $instance['settings']['submit_text'] ) ?>" class="sow-submit"
|
53 |
-
<?php foreach( $submit_attributes as $name => $val ) echo $name . '="' . esc_attr( $val ) . '" ' ?>
|
54 |
-
<?php if ( ! empty( $onclick ) ) echo 'onclick="' . esc_js( $onclick ) . '"'; ?>>
|
55 |
-
</div>
|
56 |
-
</form>
|
57 |
-
<?php
|
58 |
-
}
|
1 |
+
<?php
|
2 |
+
$result = $this->contact_form_action( $instance, $instance_hash );
|
3 |
+
|
4 |
+
// Display the title
|
5 |
+
if( $instance['display_title'] && !empty( $instance['title'] ) ) {
|
6 |
+
echo $args['before_title'] . $instance['title'] . $args['after_title'];
|
7 |
+
}
|
8 |
+
$short_hash = substr( $instance_hash, 0, 4 );
|
9 |
+
if( $result['status'] == 'success' ) {
|
10 |
+
// Display the success message
|
11 |
+
?>
|
12 |
+
<div class="sow-contact-form-success" id="contact-form-<?php echo esc_attr( $short_hash ) ?>">
|
13 |
+
<?php echo wp_kses_post( wpautop( $instance['settings']['success_message'] ) ) ?>
|
14 |
+
</div>
|
15 |
+
<?php
|
16 |
+
}
|
17 |
+
else {
|
18 |
+
$recaptcha_config = $instance['spam']['recaptcha'];
|
19 |
+
$use_recaptcha = $recaptcha_config['use_captcha'] && ! empty( $recaptcha_config['site_key'] ) && ! empty( $recaptcha_config['secret_key'] );
|
20 |
+
|
21 |
+
$settings = null;
|
22 |
+
if( $use_recaptcha ) {
|
23 |
+
$settings = array(
|
24 |
+
'sitekey' => $recaptcha_config['site_key'],
|
25 |
+
'theme' => $recaptcha_config['theme'],
|
26 |
+
'type' => $recaptcha_config['type'],
|
27 |
+
'size' => $recaptcha_config['size']
|
28 |
+
);
|
29 |
+
}
|
30 |
+
?>
|
31 |
+
<form action="<?php echo esc_url( add_query_arg( false, false ) ) ?>#contact-form-<?php echo esc_attr( $short_hash ) ?>"
|
32 |
+
method="POST" class="sow-contact-form" id="contact-form-<?php echo esc_attr( $short_hash ) ?>">
|
33 |
+
|
34 |
+
<?php if( !empty($result['errors']['_general']) ) : ?>
|
35 |
+
<ul class="sow-error">
|
36 |
+
<?php foreach( $result['errors']['_general'] as $type => $message ) : ?>
|
37 |
+
<li><?php echo esc_html( $message ) ?></li>
|
38 |
+
<?php endforeach ?>
|
39 |
+
</ul>
|
40 |
+
<?php endif ?>
|
41 |
+
|
42 |
+
<?php $this->render_form_fields( $instance['fields'], $result['errors'], $instance ) ?>
|
43 |
+
<input type="hidden" name="instance_hash" value="<?php echo esc_attr( $instance_hash ) ?>" />
|
44 |
+
<?php echo wp_nonce_field( '_contact_form_submit' ) ?>
|
45 |
+
|
46 |
+
<?php if( $use_recaptcha ) : ?>
|
47 |
+
<div class="sow-recaptcha"
|
48 |
+
data-config="<?php echo esc_attr( json_encode( $settings ) ) ?>"></div>
|
49 |
+
<?php endif; ?>
|
50 |
+
|
51 |
+
<div class="sow-submit-wrapper <?php if( $instance['design']['submit']['styled'] ) echo 'sow-submit-styled' ?>">
|
52 |
+
<input type="submit" value="<?php echo esc_attr( $instance['settings']['submit_text'] ) ?>" class="sow-submit"
|
53 |
+
<?php foreach( $submit_attributes as $name => $val ) echo $name . '="' . esc_attr( $val ) . '" ' ?>
|
54 |
+
<?php if ( ! empty( $onclick ) ) echo 'onclick="' . esc_js( $onclick ) . '"'; ?>>
|
55 |
+
</div>
|
56 |
+
</form>
|
57 |
+
<?php
|
58 |
+
}
|
widgets/cta/css/style.css
CHANGED
@@ -1,42 +1 @@
|
|
1 |
-
.sow-cta-base {
|
2 |
-
zoom: 1;
|
3 |
-
border: 1px solid ;
|
4 |
-
padding: 2em 2.5em;
|
5 |
-
}
|
6 |
-
.sow-cta-base:before {
|
7 |
-
content: '';
|
8 |
-
display: block;
|
9 |
-
}
|
10 |
-
.sow-cta-base:after {
|
11 |
-
content: '';
|
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;
|
27 |
-
}
|
28 |
-
@media screen and (max-width: 640px) {
|
29 |
-
.sow-cta-base {
|
30 |
-
text-align: center;
|
31 |
-
padding: 1.75em;
|
32 |
-
}
|
33 |
-
.sow-cta-base .sow-cta-text {
|
34 |
-
float: none;
|
35 |
-
}
|
36 |
-
.sow-cta-base .so-widget-sow-button {
|
37 |
-
display: inline-block;
|
38 |
-
float: none;
|
39 |
-
margin-top: 2em !important;
|
40 |
-
margin-left: 0!important;
|
41 |
-
}
|
42 |
-
}
|
1 |
+
.sow-cta-base{zoom:1;border:1px solid;padding:2em 2.5em}.sow-cta-base:before{content:'';display:block}.sow-cta-base:after{content:'';display:table;clear:both}.sow-cta-base .sow-cta-text .sow-cta-title,.sow-cta-base .sow-cta-text .sow-cta-subtitle,.sow-cta-base .sow-cta-text p{margin:.4em 0}.sow-cta-base .sow-cta-text .sow-cta-title{margin-top:0}.sow-cta-base .sow-cta-text .sow-cta-subtitle,.sow-cta-base .sow-cta-text p{margin-bottom:0;font-weight:normal}@media screen and (max-width:640px){.sow-cta-base{text-align:center;padding:1.75em}.sow-cta-base .sow-cta-text{float:none}.sow-cta-base .so-widget-sow-button{display:inline-block;float:none;margin-top:2em !important;margin-left:0 !important}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/cta/cta.php
CHANGED
@@ -1,131 +1,139 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Widget Name: Call-To-Action
|
4 |
-
Description: A simple call-to-action widget. You can do what ever you want with a call-to-action widget.
|
5 |
-
Author: SiteOrigin
|
6 |
-
Author URI: https://siteorigin.com
|
7 |
-
*/
|
8 |
-
|
9 |
-
class SiteOrigin_Widget_Cta_Widget extends SiteOrigin_Widget {
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
|
13 |
-
parent::__construct(
|
14 |
-
'sow-cta',
|
15 |
-
__('SiteOrigin Call-to-action', 'so-widgets-bundle'),
|
16 |
-
array(
|
17 |
-
'description' => __('A simple call-to-action widget with massive power.', 'so-widgets-bundle'),
|
18 |
-
'help' => 'https://siteorigin.com/widgets-bundle/call-action-widget/'
|
19 |
-
),
|
20 |
-
array(
|
21 |
-
|
22 |
-
),
|
23 |
-
false ,
|
24 |
-
plugin_dir_path(__FILE__)
|
25 |
-
);
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Initialize the CTA widget
|
30 |
-
*/
|
31 |
-
function initialize(){
|
32 |
-
// This widget requires the button widget
|
33 |
-
if( !class_exists('SiteOrigin_Widget_Button_Widget') ) {
|
34 |
-
SiteOrigin_Widgets_Bundle::single()->include_widget( 'button' );
|
35 |
-
}
|
36 |
-
$this->register_frontend_styles(
|
37 |
-
array(
|
38 |
-
array(
|
39 |
-
'sow-cta-main',
|
40 |
-
plugin_dir_url(__FILE__) . 'css/style.css',
|
41 |
-
array(),
|
42 |
-
SOW_BUNDLE_VERSION
|
43 |
-
)
|
44 |
-
)
|
45 |
-
);
|
46 |
-
$this->register_frontend_scripts(
|
47 |
-
array(
|
48 |
-
array(
|
49 |
-
'sow-cta-main',
|
50 |
-
plugin_dir_url(__FILE__) . 'js/cta' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
51 |
-
array( 'jquery' ),
|
52 |
-
SOW_BUNDLE_VERSION
|
53 |
-
)
|
54 |
-
)
|
55 |
-
);
|
56 |
-
}
|
57 |
-
|
58 |
-
function get_widget_form(){
|
59 |
-
return array(
|
60 |
-
|
61 |
-
'title' => array(
|
62 |
-
'type' => 'text',
|
63 |
-
'label' => __('Title', 'so-widgets-bundle'),
|
64 |
-
),
|
65 |
-
|
66 |
-
'sub_title' => array(
|
67 |
-
'type' => 'text',
|
68 |
-
'label' => __('Subtitle', 'so-widgets-bundle')
|
69 |
-
),
|
70 |
-
|
71 |
-
'design' => array(
|
72 |
-
'type' => 'section',
|
73 |
-
'label' => __('Design', 'so-widgets-bundle'),
|
74 |
-
'fields' => array(
|
75 |
-
'background_color' => array(
|
76 |
-
'type' => 'color',
|
77 |
-
'label' => __('Background color', 'so-widgets-bundle'),
|
78 |
-
),
|
79 |
-
'border_color' => array(
|
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' ),
|
94 |
-
'default' => 'right',
|
95 |
-
'options' => array(
|
96 |
-
'left' => __( 'Left', 'so-widgets-bundle'),
|
97 |
-
'right' => __( 'Right', 'so-widgets-bundle'),
|
98 |
-
)
|
99 |
-
)
|
100 |
-
)
|
101 |
-
),
|
102 |
-
|
103 |
-
'button' => array(
|
104 |
-
'type' => 'widget',
|
105 |
-
'class' => 'SiteOrigin_Widget_Button_Widget',
|
106 |
-
'label' => __('Button', 'so-widgets-bundle'),
|
107 |
-
),
|
108 |
-
|
109 |
-
);
|
110 |
-
}
|
111 |
-
|
112 |
-
function get_less_variables($instance) {
|
113 |
-
if( empty( $instance ) ) return array();
|
114 |
-
|
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 |
-
}
|
123 |
-
|
124 |
-
function modify_child_widget_form($child_widget_form, $child_widget) {
|
125 |
-
unset( $child_widget_form['design']['fields']['align'] );
|
126 |
-
return $child_widget_form;
|
127 |
-
}
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Widget Name: Call-To-Action
|
4 |
+
Description: A simple call-to-action widget. You can do what ever you want with a call-to-action widget.
|
5 |
+
Author: SiteOrigin
|
6 |
+
Author URI: https://siteorigin.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
class SiteOrigin_Widget_Cta_Widget extends SiteOrigin_Widget {
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
|
13 |
+
parent::__construct(
|
14 |
+
'sow-cta',
|
15 |
+
__('SiteOrigin Call-to-action', 'so-widgets-bundle'),
|
16 |
+
array(
|
17 |
+
'description' => __('A simple call-to-action widget with massive power.', 'so-widgets-bundle'),
|
18 |
+
'help' => 'https://siteorigin.com/widgets-bundle/call-action-widget/'
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
|
22 |
+
),
|
23 |
+
false ,
|
24 |
+
plugin_dir_path(__FILE__)
|
25 |
+
);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Initialize the CTA widget
|
30 |
+
*/
|
31 |
+
function initialize(){
|
32 |
+
// This widget requires the button widget
|
33 |
+
if( !class_exists('SiteOrigin_Widget_Button_Widget') ) {
|
34 |
+
SiteOrigin_Widgets_Bundle::single()->include_widget( 'button' );
|
35 |
+
}
|
36 |
+
$this->register_frontend_styles(
|
37 |
+
array(
|
38 |
+
array(
|
39 |
+
'sow-cta-main',
|
40 |
+
plugin_dir_url(__FILE__) . 'css/style.css',
|
41 |
+
array(),
|
42 |
+
SOW_BUNDLE_VERSION
|
43 |
+
)
|
44 |
+
)
|
45 |
+
);
|
46 |
+
$this->register_frontend_scripts(
|
47 |
+
array(
|
48 |
+
array(
|
49 |
+
'sow-cta-main',
|
50 |
+
plugin_dir_url(__FILE__) . 'js/cta' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
51 |
+
array( 'jquery' ),
|
52 |
+
SOW_BUNDLE_VERSION
|
53 |
+
)
|
54 |
+
)
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
function get_widget_form(){
|
59 |
+
return array(
|
60 |
+
|
61 |
+
'title' => array(
|
62 |
+
'type' => 'text',
|
63 |
+
'label' => __('Title', 'so-widgets-bundle'),
|
64 |
+
),
|
65 |
+
|
66 |
+
'sub_title' => array(
|
67 |
+
'type' => 'text',
|
68 |
+
'label' => __('Subtitle', 'so-widgets-bundle')
|
69 |
+
),
|
70 |
+
|
71 |
+
'design' => array(
|
72 |
+
'type' => 'section',
|
73 |
+
'label' => __('Design', 'so-widgets-bundle'),
|
74 |
+
'fields' => array(
|
75 |
+
'background_color' => array(
|
76 |
+
'type' => 'color',
|
77 |
+
'label' => __('Background color', 'so-widgets-bundle'),
|
78 |
+
),
|
79 |
+
'border_color' => array(
|
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' ),
|
94 |
+
'default' => 'right',
|
95 |
+
'options' => array(
|
96 |
+
'left' => __( 'Left', 'so-widgets-bundle'),
|
97 |
+
'right' => __( 'Right', 'so-widgets-bundle'),
|
98 |
+
)
|
99 |
+
)
|
100 |
+
)
|
101 |
+
),
|
102 |
+
|
103 |
+
'button' => array(
|
104 |
+
'type' => 'widget',
|
105 |
+
'class' => 'SiteOrigin_Widget_Button_Widget',
|
106 |
+
'label' => __('Button', 'so-widgets-bundle'),
|
107 |
+
),
|
108 |
+
|
109 |
+
);
|
110 |
+
}
|
111 |
+
|
112 |
+
function get_less_variables($instance) {
|
113 |
+
if( empty( $instance ) ) return array();
|
114 |
+
|
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 |
+
}
|
123 |
+
|
124 |
+
function modify_child_widget_form($child_widget_form, $child_widget) {
|
125 |
+
unset( $child_widget_form['design']['fields']['align'] );
|
126 |
+
return $child_widget_form;
|
127 |
+
}
|
128 |
+
|
129 |
+
function get_form_teaser(){
|
130 |
+
if( class_exists( 'SiteOrigin_Premium' ) ) return false;
|
131 |
+
return sprintf(
|
132 |
+
__( 'Get more font customization options with %sSiteOrigin Premium%s', 'so-widgets-bundle' ),
|
133 |
+
'<a href="https://siteorigin.com/downloads/premium/?featured_addon=plugin/cta" target="_blank" rel="noopener noreferrer">',
|
134 |
+
'</a>'
|
135 |
+
);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
siteorigin_widget_register('sow-cta', __FILE__, 'SiteOrigin_Widget_Cta_Widget');
|
widgets/cta/styles/default.less
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@border_color: #E3E3E3;
|
6 |
-
@background_color: #F8F8F8;
|
7 |
-
@title_color: default;
|
8 |
-
@title_font_family: default;
|
9 |
-
@title_font_weight: default;
|
10 |
-
@title_font_size: default;
|
11 |
-
@subtitle_color: default;
|
12 |
-
@subtitle_font_family: default;
|
13 |
-
@subtitle_font_weight: default;
|
14 |
-
@subtitle_font_size: default;
|
15 |
-
|
16 |
-
.sow-cta-base {
|
17 |
-
border-color: @border_color;
|
18 |
-
background-color: @background_color;
|
19 |
-
|
20 |
-
.sow-cta-text {
|
21 |
-
.sow-cta- {
|
22 |
-
&title {
|
23 |
-
color: @title_color;
|
24 |
-
font-family: @title_font_family;
|
25 |
-
font-weight: @title_font_weight;
|
26 |
-
font-size: @title_font_size;
|
27 |
-
}
|
28 |
-
|
29 |
-
&subtitle {
|
30 |
-
color: @subtitle_color;
|
31 |
-
font-family: @subtitle_font_family;
|
32 |
-
font-weight: @subtitle_font_weight;
|
33 |
-
font-size: @subtitle_font_size;
|
34 |
-
}
|
35 |
-
}
|
36 |
-
}
|
37 |
-
}
|
38 |
-
@button_align: right;
|
39 |
-
|
40 |
-
.sow-cta-base {
|
41 |
-
& when ( @button_align = right ) {
|
42 |
-
.sow-cta-text {
|
43 |
-
float: left;
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
& when ( @button_align = left ) {
|
48 |
-
.sow-cta-text {
|
49 |
-
float: right;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
& when ( @button_align = right ) {
|
54 |
-
.so-widget-sow-button {
|
55 |
-
float: right;
|
56 |
-
margin-left: 1em;
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
& when ( @button_align = left ) {
|
61 |
-
.so-widget-sow-button {
|
62 |
-
float: left;
|
63 |
-
margin-right: 1em;
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@border_color: #E3E3E3;
|
6 |
+
@background_color: #F8F8F8;
|
7 |
+
@title_color: default;
|
8 |
+
@title_font_family: default;
|
9 |
+
@title_font_weight: default;
|
10 |
+
@title_font_size: default;
|
11 |
+
@subtitle_color: default;
|
12 |
+
@subtitle_font_family: default;
|
13 |
+
@subtitle_font_weight: default;
|
14 |
+
@subtitle_font_size: default;
|
15 |
+
|
16 |
+
.sow-cta-base {
|
17 |
+
border-color: @border_color;
|
18 |
+
background-color: @background_color;
|
19 |
+
|
20 |
+
.sow-cta-text {
|
21 |
+
.sow-cta- {
|
22 |
+
&title {
|
23 |
+
color: @title_color;
|
24 |
+
font-family: @title_font_family;
|
25 |
+
font-weight: @title_font_weight;
|
26 |
+
font-size: @title_font_size;
|
27 |
+
}
|
28 |
+
|
29 |
+
&subtitle {
|
30 |
+
color: @subtitle_color;
|
31 |
+
font-family: @subtitle_font_family;
|
32 |
+
font-weight: @subtitle_font_weight;
|
33 |
+
font-size: @subtitle_font_size;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
@button_align: right;
|
39 |
+
|
40 |
+
.sow-cta-base {
|
41 |
+
& when ( @button_align = right ) {
|
42 |
+
.sow-cta-text {
|
43 |
+
float: left;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
& when ( @button_align = left ) {
|
48 |
+
.sow-cta-text {
|
49 |
+
float: right;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
& when ( @button_align = right ) {
|
54 |
+
.so-widget-sow-button {
|
55 |
+
float: right;
|
56 |
+
margin-left: 1em;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
& when ( @button_align = left ) {
|
61 |
+
.so-widget-sow-button {
|
62 |
+
float: left;
|
63 |
+
margin-right: 1em;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
widgets/features/css/style.css
CHANGED
@@ -1,58 +1 @@
|
|
1 |
-
@font-face {
|
2 |
-
font-family: 'feature-background';
|
3 |
-
src: url('fonts/feature-background.eot');
|
4 |
-
src: url('fonts/feature-background.eot') format('embedded-opentype'), url('fonts/feature-background.woff') format('woff'), url('fonts/feature-background.ttf') format('truetype'), url('fonts/feature-background.svg') format('svg');
|
5 |
-
font-weight: normal;
|
6 |
-
font-style: normal;
|
7 |
-
}
|
8 |
-
.sow-features-list {
|
9 |
-
/*
|
10 |
-
The Container Icons
|
11 |
-
*/
|
12 |
-
}
|
13 |
-
.sow-features-list .sow-icon-container {
|
14 |
-
font-family: 'feature-background';
|
15 |
-
speak: none;
|
16 |
-
font-style: normal;
|
17 |
-
font-weight: normal;
|
18 |
-
font-variant: normal;
|
19 |
-
text-transform: none;
|
20 |
-
line-height: 1;
|
21 |
-
/* Better Font Rendering =========== */
|
22 |
-
-webkit-font-smoothing: antialiased;
|
23 |
-
-moz-osx-font-smoothing: grayscale;
|
24 |
-
display: inline-block;
|
25 |
-
font-size: 90px;
|
26 |
-
position: relative;
|
27 |
-
color: #404040;
|
28 |
-
}
|
29 |
-
.sow-features-list .sow-icon-container.sow-container-round:before {
|
30 |
-
content: "\e600";
|
31 |
-
}
|
32 |
-
.sow-features-list .sow-icon-container.sow-container-sticker:before {
|
33 |
-
content: "\e601";
|
34 |
-
}
|
35 |
-
.sow-features-list .sow-icon-container.sow-container-rounded-sticker:before {
|
36 |
-
content: "\e602";
|
37 |
-
}
|
38 |
-
.sow-features-list .sow-icon-container.sow-container-square:before {
|
39 |
-
content: "\e603";
|
40 |
-
}
|
41 |
-
.sow-features-list .sow-icon-container.sow-container-rounded-square:before {
|
42 |
-
content: "\e604";
|
43 |
-
}
|
44 |
-
.sow-features-list .sow-icon-container.sow-container-rounded-hex:before {
|
45 |
-
content: "\e605";
|
46 |
-
}
|
47 |
-
.sow-features-list .sow-icon-container.sow-container-octagon:before {
|
48 |
-
content: "\e606";
|
49 |
-
}
|
50 |
-
.sow-features-list .sow-icon-container.sow-container-hex:before {
|
51 |
-
content: "\e607";
|
52 |
-
}
|
53 |
-
.sow-features-list .sow-icon-container.sow-container-frame:before {
|
54 |
-
content: "\e608";
|
55 |
-
}
|
56 |
-
.sow-features-list .sow-icon-container.sow-container-explode:before {
|
57 |
-
content: "\e609";
|
58 |
-
}
|
1 |
+
@font-face{font-family:'feature-background';src:url('fonts/feature-background.eot');src:url('fonts/feature-background.eot') format('embedded-opentype'),url('fonts/feature-background.woff') format('woff'),url('fonts/feature-background.ttf') format('truetype'),url('fonts/feature-background.svg') format('svg');font-weight:normal;font-style:normal}.sow-features-list .sow-icon-container{font-family:'feature-background';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font-size:90px;position:relative;color:#404040}.sow-features-list .sow-icon-container.sow-container-round:before{content:"\e600"}.sow-features-list .sow-icon-container.sow-container-sticker:before{content:"\e601"}.sow-features-list .sow-icon-container.sow-container-rounded-sticker:before{content:"\e602"}.sow-features-list .sow-icon-container.sow-container-square:before{content:"\e603"}.sow-features-list .sow-icon-container.sow-container-rounded-square:before{content:"\e604"}.sow-features-list .sow-icon-container.sow-container-rounded-hex:before{content:"\e605"}.sow-features-list .sow-icon-container.sow-container-octagon:before{content:"\e606"}.sow-features-list .sow-icon-container.sow-container-hex:before{content:"\e607"}.sow-features-list .sow-icon-container.sow-container-frame:before{content:"\e608"}.sow-features-list .sow-icon-container.sow-container-explode:before{content:"\e609"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/features/features.php
CHANGED
@@ -1,315 +1,315 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Widget Name: Features
|
4 |
-
Description: Displays a block of features with icons.
|
5 |
-
Author: SiteOrigin
|
6 |
-
Author URI: https://siteorigin.com
|
7 |
-
*/
|
8 |
-
|
9 |
-
class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
|
10 |
-
function __construct() {
|
11 |
-
parent::__construct(
|
12 |
-
'sow-features',
|
13 |
-
__( 'SiteOrigin Features', 'so-widgets-bundle' ),
|
14 |
-
array(
|
15 |
-
'description' => __( 'Displays a list of features.', 'so-widgets-bundle' ),
|
16 |
-
'help' => 'https://siteorigin.com/widgets-bundle/features-widget-documentation/'
|
17 |
-
),
|
18 |
-
array(),
|
19 |
-
false,
|
20 |
-
plugin_dir_path(__FILE__)
|
21 |
-
);
|
22 |
-
}
|
23 |
-
|
24 |
-
function initialize() {
|
25 |
-
$this->register_frontend_styles(
|
26 |
-
array(
|
27 |
-
array(
|
28 |
-
'siteorigin-widgets',
|
29 |
-
plugin_dir_url(__FILE__) . 'css/style.css',
|
30 |
-
array(),
|
31 |
-
SOW_BUNDLE_VERSION
|
32 |
-
)
|
33 |
-
)
|
34 |
-
);
|
35 |
-
}
|
36 |
-
|
37 |
-
function get_widget_form(){
|
38 |
-
|
39 |
-
return array(
|
40 |
-
'features' => array(
|
41 |
-
'type' => 'repeater',
|
42 |
-
'label' => __('Features', 'so-widgets-bundle'),
|
43 |
-
'item_name' => __('Feature', 'so-widgets-bundle'),
|
44 |
-
'item_label' => array(
|
45 |
-
'selector' => "[id*='features-title']",
|
46 |
-
'update_event' => 'change',
|
47 |
-
'value_method' => 'val'
|
48 |
-
),
|
49 |
-
'fields' => array(
|
50 |
-
|
51 |
-
// The container shape
|
52 |
-
|
53 |
-
'container_color' => array(
|
54 |
-
'type' => 'color',
|
55 |
-
'label' => __('Container color', 'so-widgets-bundle'),
|
56 |
-
'default' => '#404040',
|
57 |
-
),
|
58 |
-
|
59 |
-
'container_position' => array(
|
60 |
-
'type' => 'select',
|
61 |
-
'label' => __('Container Position', 'so-widgets-bundle'),
|
62 |
-
'options' => array(
|
63 |
-
'top' => __( 'Top', 'so-widgets-bundle' ),
|
64 |
-
'right' => __( 'Right', 'so-widgets-bundle' ),
|
65 |
-
'bottom' => __( 'Bottom', 'so-widgets-bundle' ),
|
66 |
-
'left' => __( 'Left', 'so-widgets-bundle' ),
|
67 |
-
),
|
68 |
-
'default' => 'top',
|
69 |
-
),
|
70 |
-
|
71 |
-
// The Icon
|
72 |
-
|
73 |
-
'icon' => array(
|
74 |
-
'type' => 'icon',
|
75 |
-
'label' => __('Icon', 'so-widgets-bundle'),
|
76 |
-
),
|
77 |
-
|
78 |
-
'icon_title' => array(
|
79 |
-
'type' => 'text',
|
80 |
-
'label' => __( 'Icon title', 'so-widgets-bundle' ),
|
81 |
-
),
|
82 |
-
|
83 |
-
'icon_color' => array(
|
84 |
-
'type' => 'color',
|
85 |
-
'label' => __('Icon color', 'so-widgets-bundle'),
|
86 |
-
'default' => '#FFFFFF',
|
87 |
-
),
|
88 |
-
|
89 |
-
'icon_image' => array(
|
90 |
-
'type' => 'media',
|
91 |
-
'library' => 'image',
|
92 |
-
'label' => __('Icon image', 'so-widgets-bundle'),
|
93 |
-
'description' => __('Use your own icon image.', 'so-widgets-bundle'),
|
94 |
-
),
|
95 |
-
|
96 |
-
'icon_image_size' => array(
|
97 |
-
'type' => 'image-size',
|
98 |
-
'label' => __('Icon image size', 'so-widgets-bundle'),
|
99 |
-
),
|
100 |
-
|
101 |
-
// The text under the icon
|
102 |
-
|
103 |
-
'title' => array(
|
104 |
-
'type' => 'text',
|
105 |
-
'label' => __('Title text', 'so-widgets-bundle'),
|
106 |
-
),
|
107 |
-
|
108 |
-
'text' => array(
|
109 |
-
'type' => 'tinymce',
|
110 |
-
'label' => __('Text', 'so-widgets-bundle')
|
111 |
-
),
|
112 |
-
|
113 |
-
'more_text' => array(
|
114 |
-
'type' => 'text',
|
115 |
-
'label' => __('More link text', 'so-widgets-bundle'),
|
116 |
-
),
|
117 |
-
|
118 |
-
'more_url' => array(
|
119 |
-
'type' => 'link',
|
120 |
-
'label' => __('More link URL', 'so-widgets-bundle'),
|
121 |
-
),
|
122 |
-
),
|
123 |
-
),
|
124 |
-
|
125 |
-
'fonts' => array(
|
126 |
-
'type' => 'section',
|
127 |
-
'label' => __( 'Font Design', 'so-widgets-bundle' ),
|
128 |
-
'hide' => true,
|
129 |
-
'fields' => array(
|
130 |
-
'title_options' => array(
|
131 |
-
'type' => 'section',
|
132 |
-
'label' => __( 'Title', 'so-widgets-bundle' ),
|
133 |
-
'hide' => true,
|
134 |
-
'fields' => array(
|
135 |
-
'font' => array(
|
136 |
-
'type' => 'font',
|
137 |
-
'label' => __( 'Font', 'so-widgets-bundle' ),
|
138 |
-
'default' => 'default'
|
139 |
-
),
|
140 |
-
'size' => array(
|
141 |
-
'type' => 'measurement',
|
142 |
-
'label' => __( 'Size', 'so-widgets-bundle' ),
|
143 |
-
),
|
144 |
-
'color' => array(
|
145 |
-
'type' => 'color',
|
146 |
-
'label' => __( 'Color', 'so-widgets-bundle' ),
|
147 |
-
)
|
148 |
-
)
|
149 |
-
),
|
150 |
-
|
151 |
-
'text_options' => array(
|
152 |
-
'type' => 'section',
|
153 |
-
'label' => __( 'Text', 'so-widgets-bundle' ),
|
154 |
-
'hide' => true,
|
155 |
-
'fields' => array(
|
156 |
-
'font' => array(
|
157 |
-
'type' => 'font',
|
158 |
-
'label' => __( 'Font', 'so-widgets-bundle' ),
|
159 |
-
'default' => 'default'
|
160 |
-
),
|
161 |
-
'size' => array(
|
162 |
-
'type' => 'measurement',
|
163 |
-
'label' => __( 'Size', 'so-widgets-bundle' ),
|
164 |
-
),
|
165 |
-
'color' => array(
|
166 |
-
'type' => 'color',
|
167 |
-
'label' => __( 'Color', 'so-widgets-bundle' ),
|
168 |
-
)
|
169 |
-
)
|
170 |
-
),
|
171 |
-
|
172 |
-
'more_text_options' => array(
|
173 |
-
'type' => 'section',
|
174 |
-
'label' => __( 'More Link', 'so-widgets-bundle' ),
|
175 |
-
'hide' => true,
|
176 |
-
'fields' => array(
|
177 |
-
'font' => array(
|
178 |
-
'type' => 'font',
|
179 |
-
'label' => __( 'Font', 'so-widgets-bundle' ),
|
180 |
-
'default' => 'default'
|
181 |
-
),
|
182 |
-
'size' => array(
|
183 |
-
'type' => 'measurement',
|
184 |
-
'label' => __( 'Size', 'so-widgets-bundle' ),
|
185 |
-
),
|
186 |
-
'color' => array(
|
187 |
-
'type' => 'color',
|
188 |
-
'label' => __( 'Color', 'so-widgets-bundle' ),
|
189 |
-
)
|
190 |
-
)
|
191 |
-
),
|
192 |
-
),
|
193 |
-
),
|
194 |
-
|
195 |
-
'container_shape' => array(
|
196 |
-
'type' => 'select',
|
197 |
-
'label' => __('Container shape', 'so-widgets-bundle'),
|
198 |
-
'default' => 'round',
|
199 |
-
'options' => include dirname( __FILE__ ) . '/inc/containers.php',
|
200 |
-
),
|
201 |
-
|
202 |
-
'container_size' => array(
|
203 |
-
'type' => 'measurement',
|
204 |
-
'label' => __('Container size', 'so-widgets-bundle'),
|
205 |
-
'default' => '84px',
|
206 |
-
),
|
207 |
-
|
208 |
-
'icon_size' => array(
|
209 |
-
'type' => 'measurement',
|
210 |
-
'label' => __('Icon size', 'so-widgets-bundle'),
|
211 |
-
'default' => '24px',
|
212 |
-
),
|
213 |
-
|
214 |
-
'icon_size_custom' => array(
|
215 |
-
'type' => 'checkbox',
|
216 |
-
'label' => __( 'Use icon size for custom icon', 'so-widgets-bundle' ),
|
217 |
-
'default' => false,
|
218 |
-
),
|
219 |
-
|
220 |
-
'per_row' => array(
|
221 |
-
'type' => 'number',
|
222 |
-
'label' => __('Features per row', 'so-widgets-bundle'),
|
223 |
-
'default' => 3,
|
224 |
-
),
|
225 |
-
|
226 |
-
'responsive' => array(
|
227 |
-
'type' => 'checkbox',
|
228 |
-
'label' => __('Responsive layout', 'so-widgets-bundle'),
|
229 |
-
'default' => true,
|
230 |
-
),
|
231 |
-
|
232 |
-
'title_link' => array(
|
233 |
-
'type' => 'checkbox',
|
234 |
-
'label' => __('Link feature title to more URL', 'so-widgets-bundle'),
|
235 |
-
'default' => false,
|
236 |
-
),
|
237 |
-
|
238 |
-
'icon_link' => array(
|
239 |
-
'type' => 'checkbox',
|
240 |
-
'label' => __('Link icon to more URL', 'so-widgets-bundle'),
|
241 |
-
'default' => false,
|
242 |
-
),
|
243 |
-
|
244 |
-
'new_window' => array(
|
245 |
-
'type' => 'checkbox',
|
246 |
-
'label' => __('Open more URL in a new window', 'so-widgets-bundle'),
|
247 |
-
'default' => false,
|
248 |
-
),
|
249 |
-
|
250 |
-
);
|
251 |
-
}
|
252 |
-
|
253 |
-
function get_less_variables( $instance ) {
|
254 |
-
$less_vars = array();
|
255 |
-
|
256 |
-
$fonts = $instance['fonts'];
|
257 |
-
$styleable_text_fields = array( 'title', 'text', 'more_text' );
|
258 |
-
|
259 |
-
foreach ( $styleable_text_fields as $field_name ) {
|
260 |
-
|
261 |
-
if ( ! empty( $fonts[$field_name.'_options'] ) ) {
|
262 |
-
$styles = $fonts[$field_name.'_options'];
|
263 |
-
if ( ! empty( $styles['size'] ) ) {
|
264 |
-
$less_vars[$field_name.'_size'] = $styles['size'];
|
265 |
-
}
|
266 |
-
if ( ! empty( $styles['color'] ) ) {
|
267 |
-
$less_vars[$field_name.'_color'] = $styles['color'];
|
268 |
-
}
|
269 |
-
if ( ! empty( $styles['font'] ) ) {
|
270 |
-
$font = siteorigin_widget_get_font( $styles['font'] );
|
271 |
-
$less_vars[$field_name.'_font'] = $font['family'];
|
272 |
-
if ( ! empty( $font['weight'] ) ) {
|
273 |
-
$less_vars[$field_name.'_font_weight'] = $font['weight'];
|
274 |
-
}
|
275 |
-
}
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
$less_vars['container_size'] = $instance['container_size'];
|
280 |
-
$less_vars['icon_size'] = $instance['icon_size'];
|
281 |
-
$less_vars['use_icon_size'] = empty( $instance['icon_size_custom'] ) ? 'false' : 'true';
|
282 |
-
|
283 |
-
$global_settings = $this->get_global_settings();
|
284 |
-
|
285 |
-
if ( ! empty( $global_settings['responsive_breakpoint'] ) ) {
|
286 |
-
$less_vars['responsive_breakpoint'] = $global_settings['responsive_breakpoint'];
|
287 |
-
}
|
288 |
-
|
289 |
-
return $less_vars;
|
290 |
-
}
|
291 |
-
|
292 |
-
function get_settings_form() {
|
293 |
-
return array(
|
294 |
-
'responsive_breakpoint' => array(
|
295 |
-
'type' => 'measurement',
|
296 |
-
'label' => __( 'Responsive Breakpoint', 'so-widgets-bundle' ),
|
297 |
-
'default' => '520px',
|
298 |
-
'description' => __( 'This setting controls when the features widget will collapse for mobile devices. The default value is 520px', 'so-widgets-bundle' )
|
299 |
-
)
|
300 |
-
);
|
301 |
-
}
|
302 |
-
|
303 |
-
function get_google_font_fields( $instance ) {
|
304 |
-
|
305 |
-
$fonts = $instance['fonts'];
|
306 |
-
|
307 |
-
return array(
|
308 |
-
$fonts['title_options']['font'],
|
309 |
-
$fonts['text_options']['font'],
|
310 |
-
$fonts['more_text_options']['font'],
|
311 |
-
);
|
312 |
-
}
|
313 |
-
}
|
314 |
-
|
315 |
-
siteorigin_widget_register('sow-features', __FILE__, 'SiteOrigin_Widget_Features_Widget');
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Widget Name: Features
|
4 |
+
Description: Displays a block of features with icons.
|
5 |
+
Author: SiteOrigin
|
6 |
+
Author URI: https://siteorigin.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
|
10 |
+
function __construct() {
|
11 |
+
parent::__construct(
|
12 |
+
'sow-features',
|
13 |
+
__( 'SiteOrigin Features', 'so-widgets-bundle' ),
|
14 |
+
array(
|
15 |
+
'description' => __( 'Displays a list of features.', 'so-widgets-bundle' ),
|
16 |
+
'help' => 'https://siteorigin.com/widgets-bundle/features-widget-documentation/'
|
17 |
+
),
|
18 |
+
array(),
|
19 |
+
false,
|
20 |
+
plugin_dir_path(__FILE__)
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
function initialize() {
|
25 |
+
$this->register_frontend_styles(
|
26 |
+
array(
|
27 |
+
array(
|
28 |
+
'siteorigin-widgets',
|
29 |
+
plugin_dir_url(__FILE__) . 'css/style.css',
|
30 |
+
array(),
|
31 |
+
SOW_BUNDLE_VERSION
|
32 |
+
)
|
33 |
+
)
|
34 |
+
);
|
35 |
+
}
|
36 |
+
|
37 |
+
function get_widget_form(){
|
38 |
+
|
39 |
+
return array(
|
40 |
+
'features' => array(
|
41 |
+
'type' => 'repeater',
|
42 |
+
'label' => __('Features', 'so-widgets-bundle'),
|
43 |
+
'item_name' => __('Feature', 'so-widgets-bundle'),
|
44 |
+
'item_label' => array(
|
45 |
+
'selector' => "[id*='features-title']",
|
46 |
+
'update_event' => 'change',
|
47 |
+
'value_method' => 'val'
|
48 |
+
),
|
49 |
+
'fields' => array(
|
50 |
+
|
51 |
+
// The container shape
|
52 |
+
|
53 |
+
'container_color' => array(
|
54 |
+
'type' => 'color',
|
55 |
+
'label' => __('Container color', 'so-widgets-bundle'),
|
56 |
+
'default' => '#404040',
|
57 |
+
),
|
58 |
+
|
59 |
+
'container_position' => array(
|
60 |
+
'type' => 'select',
|
61 |
+
'label' => __('Container Position', 'so-widgets-bundle'),
|
62 |
+
'options' => array(
|
63 |
+
'top' => __( 'Top', 'so-widgets-bundle' ),
|
64 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
65 |
+
'bottom' => __( 'Bottom', 'so-widgets-bundle' ),
|
66 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
67 |
+
),
|
68 |
+
'default' => 'top',
|
69 |
+
),
|
70 |
+
|
71 |
+
// The Icon
|
72 |
+
|
73 |
+
'icon' => array(
|
74 |
+
'type' => 'icon',
|
75 |
+
'label' => __('Icon', 'so-widgets-bundle'),
|
76 |
+
),
|
77 |
+
|
78 |
+
'icon_title' => array(
|
79 |
+
'type' => 'text',
|
80 |
+
'label' => __( 'Icon title', 'so-widgets-bundle' ),
|
81 |
+
),
|
82 |
+
|
83 |
+
'icon_color' => array(
|
84 |
+
'type' => 'color',
|
85 |
+
'label' => __('Icon color', 'so-widgets-bundle'),
|
86 |
+
'default' => '#FFFFFF',
|
87 |
+
),
|
88 |
+
|
89 |
+
'icon_image' => array(
|
90 |
+
'type' => 'media',
|
91 |
+
'library' => 'image',
|
92 |
+
'label' => __('Icon image', 'so-widgets-bundle'),
|
93 |
+
'description' => __('Use your own icon image.', 'so-widgets-bundle'),
|
94 |
+
),
|
95 |
+
|
96 |
+
'icon_image_size' => array(
|
97 |
+
'type' => 'image-size',
|
98 |
+
'label' => __('Icon image size', 'so-widgets-bundle'),
|
99 |
+
),
|
100 |
+
|
101 |
+
// The text under the icon
|
102 |
+
|
103 |
+
'title' => array(
|
104 |
+
'type' => 'text',
|
105 |
+
'label' => __('Title text', 'so-widgets-bundle'),
|
106 |
+
),
|
107 |
+
|
108 |
+
'text' => array(
|
109 |
+
'type' => 'tinymce',
|
110 |
+
'label' => __('Text', 'so-widgets-bundle')
|
111 |
+
),
|
112 |
+
|
113 |
+
'more_text' => array(
|
114 |
+
'type' => 'text',
|
115 |
+
'label' => __('More link text', 'so-widgets-bundle'),
|
116 |
+
),
|
117 |
+
|
118 |
+
'more_url' => array(
|
119 |
+
'type' => 'link',
|
120 |
+
'label' => __('More link URL', 'so-widgets-bundle'),
|
121 |
+
),
|
122 |
+
),
|
123 |
+
),
|
124 |
+
|
125 |
+
'fonts' => array(
|
126 |
+
'type' => 'section',
|
127 |
+
'label' => __( 'Font Design', 'so-widgets-bundle' ),
|
128 |
+
'hide' => true,
|
129 |
+
'fields' => array(
|
130 |
+
'title_options' => array(
|
131 |
+
'type' => 'section',
|
132 |
+
'label' => __( 'Title', 'so-widgets-bundle' ),
|
133 |
+
'hide' => true,
|
134 |
+
'fields' => array(
|
135 |
+
'font' => array(
|
136 |
+
'type' => 'font',
|
137 |
+
'label' => __( 'Font', 'so-widgets-bundle' ),
|
138 |
+
'default' => 'default'
|
139 |
+
),
|
140 |
+
'size' => array(
|
141 |
+
'type' => 'measurement',
|
142 |
+
'label' => __( 'Size', 'so-widgets-bundle' ),
|
143 |
+
),
|
144 |
+
'color' => array(
|
145 |
+
'type' => 'color',
|
146 |
+
'label' => __( 'Color', 'so-widgets-bundle' ),
|
147 |
+
)
|
148 |
+
)
|
149 |
+
),
|
150 |
+
|
151 |
+
'text_options' => array(
|
152 |
+
'type' => 'section',
|
153 |
+
'label' => __( 'Text', 'so-widgets-bundle' ),
|
154 |
+
'hide' => true,
|
155 |
+
'fields' => array(
|
156 |
+
'font' => array(
|
157 |
+
'type' => 'font',
|
158 |
+
'label' => __( 'Font', 'so-widgets-bundle' ),
|
159 |
+
'default' => 'default'
|
160 |
+
),
|
161 |
+
'size' => array(
|
162 |
+
'type' => 'measurement',
|
163 |
+
'label' => __( 'Size', 'so-widgets-bundle' ),
|
164 |
+
),
|
165 |
+
'color' => array(
|
166 |
+
'type' => 'color',
|
167 |
+
'label' => __( 'Color', 'so-widgets-bundle' ),
|
168 |
+
)
|
169 |
+
)
|
170 |
+
),
|
171 |
+
|
172 |
+
'more_text_options' => array(
|
173 |
+
'type' => 'section',
|
174 |
+
'label' => __( 'More Link', 'so-widgets-bundle' ),
|
175 |
+
'hide' => true,
|
176 |
+
'fields' => array(
|
177 |
+
'font' => array(
|
178 |
+
'type' => 'font',
|
179 |
+
'label' => __( 'Font', 'so-widgets-bundle' ),
|
180 |
+
'default' => 'default'
|
181 |
+
),
|
182 |
+
'size' => array(
|
183 |
+
'type' => 'measurement',
|
184 |
+
'label' => __( 'Size', 'so-widgets-bundle' ),
|
185 |
+
),
|
186 |
+
'color' => array(
|
187 |
+
'type' => 'color',
|
188 |
+
'label' => __( 'Color', 'so-widgets-bundle' ),
|
189 |
+
)
|
190 |
+
)
|
191 |
+
),
|
192 |
+
),
|
193 |
+
),
|
194 |
+
|
195 |
+
'container_shape' => array(
|
196 |
+
'type' => 'select',
|
197 |
+
'label' => __('Container shape', 'so-widgets-bundle'),
|
198 |
+
'default' => 'round',
|
199 |
+
'options' => include dirname( __FILE__ ) . '/inc/containers.php',
|
200 |
+
),
|
201 |
+
|
202 |
+
'container_size' => array(
|
203 |
+
'type' => 'measurement',
|
204 |
+
'label' => __('Container size', 'so-widgets-bundle'),
|
205 |
+
'default' => '84px',
|
206 |
+
),
|
207 |
+
|
208 |
+
'icon_size' => array(
|
209 |
+
'type' => 'measurement',
|
210 |
+
'label' => __('Icon size', 'so-widgets-bundle'),
|
211 |
+
'default' => '24px',
|
212 |
+
),
|
213 |
+
|
214 |
+
'icon_size_custom' => array(
|
215 |
+
'type' => 'checkbox',
|
216 |
+
'label' => __( 'Use icon size for custom icon', 'so-widgets-bundle' ),
|
217 |
+
'default' => false,
|
218 |
+
),
|
219 |
+
|
220 |
+
'per_row' => array(
|
221 |
+
'type' => 'number',
|
222 |
+
'label' => __('Features per row', 'so-widgets-bundle'),
|
223 |
+
'default' => 3,
|
224 |
+
),
|
225 |
+
|
226 |
+
'responsive' => array(
|
227 |
+
'type' => 'checkbox',
|
228 |
+
'label' => __('Responsive layout', 'so-widgets-bundle'),
|
229 |
+
'default' => true,
|
230 |
+
),
|
231 |
+
|
232 |
+
'title_link' => array(
|
233 |
+
'type' => 'checkbox',
|
234 |
+
'label' => __('Link feature title to more URL', 'so-widgets-bundle'),
|
235 |
+
'default' => false,
|
236 |
+
),
|
237 |
+
|
238 |
+
'icon_link' => array(
|
239 |
+
'type' => 'checkbox',
|
240 |
+
'label' => __('Link icon to more URL', 'so-widgets-bundle'),
|
241 |
+
'default' => false,
|
242 |
+
),
|
243 |
+
|
244 |
+
'new_window' => array(
|
245 |
+
'type' => 'checkbox',
|
246 |
+
'label' => __('Open more URL in a new window', 'so-widgets-bundle'),
|
247 |
+
'default' => false,
|
248 |
+
),
|
249 |
+
|
250 |
+
);
|
251 |
+
}
|
252 |
+
|
253 |
+
function get_less_variables( $instance ) {
|
254 |
+
$less_vars = array();
|
255 |
+
|
256 |
+
$fonts = $instance['fonts'];
|
257 |
+
$styleable_text_fields = array( 'title', 'text', 'more_text' );
|
258 |
+
|
259 |
+
foreach ( $styleable_text_fields as $field_name ) {
|
260 |
+
|
261 |
+
if ( ! empty( $fonts[$field_name.'_options'] ) ) {
|
262 |
+
$styles = $fonts[$field_name.'_options'];
|
263 |
+
if ( ! empty( $styles['size'] ) ) {
|
264 |
+
$less_vars[$field_name.'_size'] = $styles['size'];
|
265 |
+
}
|
266 |
+
if ( ! empty( $styles['color'] ) ) {
|
267 |
+
$less_vars[$field_name.'_color'] = $styles['color'];
|
268 |
+
}
|
269 |
+
if ( ! empty( $styles['font'] ) ) {
|
270 |
+
$font = siteorigin_widget_get_font( $styles['font'] );
|
271 |
+
$less_vars[$field_name.'_font'] = $font['family'];
|
272 |
+
if ( ! empty( $font['weight'] ) ) {
|
273 |
+
$less_vars[$field_name.'_font_weight'] = $font['weight'];
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
$less_vars['container_size'] = $instance['container_size'];
|
280 |
+
$less_vars['icon_size'] = $instance['icon_size'];
|
281 |
+
$less_vars['use_icon_size'] = empty( $instance['icon_size_custom'] ) ? 'false' : 'true';
|
282 |
+
|
283 |
+
$global_settings = $this->get_global_settings();
|
284 |
+
|
285 |
+
if ( ! empty( $global_settings['responsive_breakpoint'] ) ) {
|
286 |
+
$less_vars['responsive_breakpoint'] = $global_settings['responsive_breakpoint'];
|
287 |
+
}
|
288 |
+
|
289 |
+
return $less_vars;
|
290 |
+
}
|
291 |
+
|
292 |
+
function get_settings_form() {
|
293 |
+
return array(
|
294 |
+
'responsive_breakpoint' => array(
|
295 |
+
'type' => 'measurement',
|
296 |
+
'label' => __( 'Responsive Breakpoint', 'so-widgets-bundle' ),
|
297 |
+
'default' => '520px',
|
298 |
+
'description' => __( 'This setting controls when the features widget will collapse for mobile devices. The default value is 520px', 'so-widgets-bundle' )
|
299 |
+
)
|
300 |
+
);
|
301 |
+
}
|
302 |
+
|
303 |
+
function get_google_font_fields( $instance ) {
|
304 |
+
|
305 |
+
$fonts = $instance['fonts'];
|
306 |
+
|
307 |
+
return array(
|
308 |
+
$fonts['title_options']['font'],
|
309 |
+
$fonts['text_options']['font'],
|
310 |
+
$fonts['more_text_options']['font'],
|
311 |
+
);
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
siteorigin_widget_register('sow-features', __FILE__, 'SiteOrigin_Widget_Features_Widget');
|
widgets/features/styles/default.less
CHANGED
@@ -1,187 +1,187 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@title_font: default;
|
6 |
-
@title_font_weight: 400;
|
7 |
-
@title_size: default;
|
8 |
-
@title_color: default;
|
9 |
-
|
10 |
-
@text_font: default;
|
11 |
-
@text_font_weight: 400;
|
12 |
-
@text_size: default;
|
13 |
-
@text_color: default;
|
14 |
-
|
15 |
-
@more_text_font: default;
|
16 |
-
@more_text_font_weight: 400;
|
17 |
-
@more_text_size: default;
|
18 |
-
@more_text_color: default;
|
19 |
-
|
20 |
-
@container_size: 84px;
|
21 |
-
@icon_size: 24px;
|
22 |
-
@use_icon_size: false;
|
23 |
-
|
24 |
-
@responsive_breakpoint: 520px;
|
25 |
-
|
26 |
-
.sow-features-list {
|
27 |
-
|
28 |
-
margin: 0 -25px;
|
29 |
-
|
30 |
-
.clearfix();
|
31 |
-
|
32 |
-
.sow-features-feature {
|
33 |
-
position: relative;
|
34 |
-
float: left;
|
35 |
-
.box-sizing(border-box);
|
36 |
-
padding: 0 25px;
|
37 |
-
display: flex;
|
38 |
-
|
39 |
-
&.sow-icon-container-position-top {
|
40 |
-
flex-direction: column;
|
41 |
-
text-align: center;
|
42 |
-
|
43 |
-
.sow-icon-container {
|
44 |
-
margin-bottom: 10px;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
&.sow-icon-container-position-right {
|
49 |
-
text-align: left;
|
50 |
-
flex-direction: row;
|
51 |
-
|
52 |
-
.sow-icon-container {
|
53 |
-
margin-right: 10px;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
&.sow-icon-container-position-left {
|
58 |
-
text-align: left;
|
59 |
-
flex-direction: row-reverse;
|
60 |
-
|
61 |
-
.sow-icon-container {
|
62 |
-
margin-left: 10px;
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
&.sow-icon-container-position-bottom {
|
67 |
-
text-align: center;
|
68 |
-
flex-direction: column-reverse;
|
69 |
-
|
70 |
-
.sow-icon-container {
|
71 |
-
margin-top: 10px;
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
.sow-icon-container {
|
76 |
-
width: @container_size;
|
77 |
-
height: @container_size;
|
78 |
-
font-size: @container_size;
|
79 |
-
text-decoration: none;
|
80 |
-
margin: auto;
|
81 |
-
|
82 |
-
[class^="sow-icon-"],
|
83 |
-
.sow-icon-image {
|
84 |
-
text-decoration: none;
|
85 |
-
color: #FFFFFF;
|
86 |
-
width: @container_size;
|
87 |
-
height: @container_size;
|
88 |
-
position: absolute;
|
89 |
-
top: 0;
|
90 |
-
display: flex;
|
91 |
-
align-items: center;
|
92 |
-
justify-content: center;
|
93 |
-
|
94 |
-
.icon_size() when ( @use_icon_size = true) {
|
95 |
-
background-size: @icon_size @icon_size;
|
96 |
-
}
|
97 |
-
.icon_size() when not ( @use_icon_size = true) {
|
98 |
-
background-size: contain;
|
99 |
-
}
|
100 |
-
.icon_size();
|
101 |
-
background-repeat: no-repeat;
|
102 |
-
background-position: center;
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
h5 {
|
107 |
-
margin: 1em 0;
|
108 |
-
|
109 |
-
a{
|
110 |
-
color: inherit;
|
111 |
-
text-decoration: none;
|
112 |
-
|
113 |
-
&:hover {
|
114 |
-
text-decoration: underline;
|
115 |
-
}
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
p.sow-more-text {
|
120 |
-
a {
|
121 |
-
font-weight: 500;
|
122 |
-
color: inherit;
|
123 |
-
text-decoration: none;
|
124 |
-
|
125 |
-
&:hover {
|
126 |
-
text-decoration: underline;
|
127 |
-
}
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
-
p:last-child {
|
132 |
-
margin-bottom: 0;
|
133 |
-
}
|
134 |
-
|
135 |
-
margin-bottom: 40px;
|
136 |
-
|
137 |
-
&.sow-features-feature-last-row {
|
138 |
-
margin-bottom: 0;
|
139 |
-
}
|
140 |
-
|
141 |
-
.textwidget {
|
142 |
-
margin: auto;
|
143 |
-
> h5 {
|
144 |
-
.font(@title_font, @title_font_weight);
|
145 |
-
font-size: @title_size;
|
146 |
-
color: @title_color;
|
147 |
-
}
|
148 |
-
|
149 |
-
> p {
|
150 |
-
.font(@text_font, @text_font_weight);
|
151 |
-
font-size: @text_size;
|
152 |
-
color: @text_color;
|
153 |
-
}
|
154 |
-
|
155 |
-
> p.sow-more-text {
|
156 |
-
.font(@more_text_font, @more_text_font_weight);
|
157 |
-
font-size: @more_text_size;
|
158 |
-
color: @more_text_color;
|
159 |
-
}
|
160 |
-
}
|
161 |
-
}
|
162 |
-
|
163 |
-
.sow-features-clear {
|
164 |
-
clear: both;
|
165 |
-
}
|
166 |
-
|
167 |
-
@media (max-width: @responsive_breakpoint) {
|
168 |
-
&.sow-features-responsive {
|
169 |
-
margin: 0;
|
170 |
-
|
171 |
-
.sow-features-feature {
|
172 |
-
width: 100% !important;
|
173 |
-
float: none;
|
174 |
-
margin-bottom: 40px;
|
175 |
-
|
176 |
-
&:last-child {
|
177 |
-
margin-bottom: 0px;
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
.sow-features-clear {
|
182 |
-
clear: none;
|
183 |
-
}
|
184 |
-
|
185 |
-
}
|
186 |
-
}
|
187 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@title_font: default;
|
6 |
+
@title_font_weight: 400;
|
7 |
+
@title_size: default;
|
8 |
+
@title_color: default;
|
9 |
+
|
10 |
+
@text_font: default;
|
11 |
+
@text_font_weight: 400;
|
12 |
+
@text_size: default;
|
13 |
+
@text_color: default;
|
14 |
+
|
15 |
+
@more_text_font: default;
|
16 |
+
@more_text_font_weight: 400;
|
17 |
+
@more_text_size: default;
|
18 |
+
@more_text_color: default;
|
19 |
+
|
20 |
+
@container_size: 84px;
|
21 |
+
@icon_size: 24px;
|
22 |
+
@use_icon_size: false;
|
23 |
+
|
24 |
+
@responsive_breakpoint: 520px;
|
25 |
+
|
26 |
+
.sow-features-list {
|
27 |
+
|
28 |
+
margin: 0 -25px;
|
29 |
+
|
30 |
+
.clearfix();
|
31 |
+
|
32 |
+
.sow-features-feature {
|
33 |
+
position: relative;
|
34 |
+
float: left;
|
35 |
+
.box-sizing(border-box);
|
36 |
+
padding: 0 25px;
|
37 |
+
display: flex;
|
38 |
+
|
39 |
+
&.sow-icon-container-position-top {
|
40 |
+
flex-direction: column;
|
41 |
+
text-align: center;
|
42 |
+
|
43 |
+
.sow-icon-container {
|
44 |
+
margin-bottom: 10px;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
&.sow-icon-container-position-right {
|
49 |
+
text-align: left;
|
50 |
+
flex-direction: row;
|
51 |
+
|
52 |
+
.sow-icon-container {
|
53 |
+
margin-right: 10px;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
&.sow-icon-container-position-left {
|
58 |
+
text-align: left;
|
59 |
+
flex-direction: row-reverse;
|
60 |
+
|
61 |
+
.sow-icon-container {
|
62 |
+
margin-left: 10px;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
&.sow-icon-container-position-bottom {
|
67 |
+
text-align: center;
|
68 |
+
flex-direction: column-reverse;
|
69 |
+
|
70 |
+
.sow-icon-container {
|
71 |
+
margin-top: 10px;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
.sow-icon-container {
|
76 |
+
width: @container_size;
|
77 |
+
height: @container_size;
|
78 |
+
font-size: @container_size;
|
79 |
+
text-decoration: none;
|
80 |
+
margin: auto;
|
81 |
+
|
82 |
+
[class^="sow-icon-"],
|
83 |
+
.sow-icon-image {
|
84 |
+
text-decoration: none;
|
85 |
+
color: #FFFFFF;
|
86 |
+
width: @container_size;
|
87 |
+
height: @container_size;
|
88 |
+
position: absolute;
|
89 |
+
top: 0;
|
90 |
+
display: flex;
|
91 |
+
align-items: center;
|
92 |
+
justify-content: center;
|
93 |
+
|
94 |
+
.icon_size() when ( @use_icon_size = true) {
|
95 |
+
background-size: @icon_size @icon_size;
|
96 |
+
}
|
97 |
+
.icon_size() when not ( @use_icon_size = true) {
|
98 |
+
background-size: contain;
|
99 |
+
}
|
100 |
+
.icon_size();
|
101 |
+
background-repeat: no-repeat;
|
102 |
+
background-position: center;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
h5 {
|
107 |
+
margin: 1em 0;
|
108 |
+
|
109 |
+
a{
|
110 |
+
color: inherit;
|
111 |
+
text-decoration: none;
|
112 |
+
|
113 |
+
&:hover {
|
114 |
+
text-decoration: underline;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
p.sow-more-text {
|
120 |
+
a {
|
121 |
+
font-weight: 500;
|
122 |
+
color: inherit;
|
123 |
+
text-decoration: none;
|
124 |
+
|
125 |
+
&:hover {
|
126 |
+
text-decoration: underline;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
p:last-child {
|
132 |
+
margin-bottom: 0;
|
133 |
+
}
|
134 |
+
|
135 |
+
margin-bottom: 40px;
|
136 |
+
|
137 |
+
&.sow-features-feature-last-row {
|
138 |
+
margin-bottom: 0;
|
139 |
+
}
|
140 |
+
|
141 |
+
.textwidget {
|
142 |
+
margin: auto;
|
143 |
+
> h5 {
|
144 |
+
.font(@title_font, @title_font_weight);
|
145 |
+
font-size: @title_size;
|
146 |
+
color: @title_color;
|
147 |
+
}
|
148 |
+
|
149 |
+
> p {
|
150 |
+
.font(@text_font, @text_font_weight);
|
151 |
+
font-size: @text_size;
|
152 |
+
color: @text_color;
|
153 |
+
}
|
154 |
+
|
155 |
+
> p.sow-more-text {
|
156 |
+
.font(@more_text_font, @more_text_font_weight);
|
157 |
+
font-size: @more_text_size;
|
158 |
+
color: @more_text_color;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
.sow-features-clear {
|
164 |
+
clear: both;
|
165 |
+
}
|
166 |
+
|
167 |
+
@media (max-width: @responsive_breakpoint) {
|
168 |
+
&.sow-features-responsive {
|
169 |
+
margin: 0;
|
170 |
+
|
171 |
+
.sow-features-feature {
|
172 |
+
width: 100% !important;
|
173 |
+
float: none;
|
174 |
+
margin-bottom: 40px;
|
175 |
+
|
176 |
+
&:last-child {
|
177 |
+
margin-bottom: 0px;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
.sow-features-clear {
|
182 |
+
clear: none;
|
183 |
+
}
|
184 |
+
|
185 |
+
}
|
186 |
+
}
|
187 |
+
}
|
widgets/google-map/css/style.css
CHANGED
@@ -1,11 +1 @@
|
|
1 |
-
.sow-google-map-canvas img
|
2 |
-
-webkit-border-radius: 0 !important;
|
3 |
-
-moz-border-radius: 0 !important;
|
4 |
-
border-radius: 0 !important;
|
5 |
-
-webkit-box-shadow: none !important;
|
6 |
-
-moz-box-shadow: none !important;
|
7 |
-
box-shadow: none !important;
|
8 |
-
line-height: normal !important;
|
9 |
-
max-width: none !important;
|
10 |
-
zoom: normal !important;
|
11 |
-
}
|
1 |
+
.sow-google-map-canvas img{-webkit-border-radius:0 !important;-moz-border-radius:0 !important;border-radius:0 !important;-webkit-box-shadow:none !important;-moz-box-shadow:none !important;box-shadow:none !important;line-height:normal !important;max-width:none !important;zoom:normal !important}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/google-map/google-map.php
CHANGED
@@ -1,694 +1,694 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Widget Name: Google Maps
|
5 |
-
Description: A highly customisable Google Maps widget. Help your site find its place and give it some direction.
|
6 |
-
Author: SiteOrigin
|
7 |
-
Author URI: https://siteorigin.com
|
8 |
-
*/
|
9 |
-
|
10 |
-
class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
11 |
-
|
12 |
-
function __construct() {
|
13 |
-
|
14 |
-
parent::__construct(
|
15 |
-
'sow-google-map',
|
16 |
-
__( 'SiteOrigin Google Maps', 'so-widgets-bundle' ),
|
17 |
-
array(
|
18 |
-
'description' => __( 'A Google Maps widget.', 'so-widgets-bundle' ),
|
19 |
-
'help' => 'https://siteorigin.com/widgets-bundle/google-maps-widget/'
|
20 |
-
),
|
21 |
-
array(),
|
22 |
-
false,
|
23 |
-
plugin_dir_path(__FILE__)
|
24 |
-
);
|
25 |
-
}
|
26 |
-
|
27 |
-
function initialize() {
|
28 |
-
|
29 |
-
add_action( 'siteorigin_widgets_before_widget_sow-google-map', array( $this, 'enqueue_widget_scripts' ) );
|
30 |
-
}
|
31 |
-
|
32 |
-
function get_widget_form(){
|
33 |
-
return array(
|
34 |
-
'map_center' => array(
|
35 |
-
'type' => 'textarea',
|
36 |
-
'rows' => 2,
|
37 |
-
'label' => __( 'Map center', 'so-widgets-bundle' ),
|
38 |
-
'description' => sprintf(
|
39 |
-
__( 'The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the <strong>Geocoding API</strong> in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
|
40 |
-
'<a href="https://console.developers.google.com/apis/dashboard?project=_" target="_blank" rel="noopener noreferrer">',
|
41 |
-
'</a>'
|
42 |
-
),
|
43 |
-
),
|
44 |
-
'api_key_section' => array(
|
45 |
-
'type' => 'section',
|
46 |
-
'label' => __( 'API key', 'so-widgets-bundle' ),
|
47 |
-
'hide' => false,
|
48 |
-
'fields' => array(
|
49 |
-
'api_key' => array(
|
50 |
-
'type' => 'text',
|
51 |
-
'label' => __( 'API key', 'so-widgets-bundle' ),
|
52 |
-
'required' => true,
|
53 |
-
'description' => sprintf(
|
54 |
-
__( 'Enter your %sAPI key%s. Your map may not function correctly without one.', 'so-widgets-bundle' ),
|
55 |
-
'<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank" rel="noopener noreferrer">',
|
56 |
-
'</a>'
|
57 |
-
)
|
58 |
-
)
|
59 |
-
)
|
60 |
-
),
|
61 |
-
'settings' => array(
|
62 |
-
'type' => 'section',
|
63 |
-
'label' => __( 'Settings', 'so-widgets-bundle' ),
|
64 |
-
'hide' => false,
|
65 |
-
'description' => __( 'Set map display options.', 'so-widgets-bundle' ),
|
66 |
-
'fields' => array(
|
67 |
-
'map_type' => array(
|
68 |
-
'type' => 'radio',
|
69 |
-
'default' => 'interactive',
|
70 |
-
'label' => __( 'Map type', 'so-widgets-bundle' ),
|
71 |
-
'state_emitter' => array(
|
72 |
-
'callback' => 'select',
|
73 |
-
'args' => array( 'map_type' )
|
74 |
-
),
|
75 |
-
'options' => array(
|
76 |
-
'interactive' => __( 'Interactive', 'so-widgets-bundle' ),
|
77 |
-
'static' => __( 'Static image', 'so-widgets-bundle' ),
|
78 |
-
)
|
79 |
-
),
|
80 |
-
'width' => array(
|
81 |
-
'type' => 'text',
|
82 |
-
'default' => 640,
|
83 |
-
'hidden' => true,
|
84 |
-
'state_handler' => array(
|
85 |
-
'map_type[static]' => array('show'),
|
86 |
-
'_else[map_type]' => array('hide'),
|
87 |
-
),
|
88 |
-
'label' => __( 'Width', 'so-widgets-bundle' )
|
89 |
-
),
|
90 |
-
'height' => array(
|
91 |
-
'type' => 'text',
|
92 |
-
'default' => 480,
|
93 |
-
'label' => __( 'Height', 'so-widgets-bundle' )
|
94 |
-
),
|
95 |
-
'destination_url' => array(
|
96 |
-
'type' => 'link',
|
97 |
-
'label' => __( 'Destination URL', 'so-widgets-bundle' ),
|
98 |
-
'hidden' => true,
|
99 |
-
'state_handler' => array(
|
100 |
-
'map_type[static]' => array('show'),
|
101 |
-
'_else[map_type]' => array('hide'),
|
102 |
-
),
|
103 |
-
),
|
104 |
-
|
105 |
-
'new_window' => array(
|
106 |
-
'type' => 'checkbox',
|
107 |
-
'default' => false,
|
108 |
-
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
109 |
-
'hidden' => true,
|
110 |
-
'state_handler' => array(
|
111 |
-
'map_type[static]' => array('show'),
|
112 |
-
'_else[map_type]' => array('hide'),
|
113 |
-
),
|
114 |
-
),
|
115 |
-
'zoom' => array(
|
116 |
-
'type' => 'slider',
|
117 |
-
'label' => __( 'Zoom level', 'so-widgets-bundle' ),
|
118 |
-
'description' => __( 'A value from 0 (the world) to 21 (street level).', 'so-widgets-bundle' ),
|
119 |
-
'min' => 0,
|
120 |
-
'max' => 21,
|
121 |
-
'default' => 12,
|
122 |
-
'integer' => true,
|
123 |
-
|
124 |
-
),
|
125 |
-
'scroll_zoom' => array(
|
126 |
-
'type' => 'checkbox',
|
127 |
-
'default' => true,
|
128 |
-
'state_handler' => array(
|
129 |
-
'map_type[interactive]' => array('show'),
|
130 |
-
'_else[map_type]' => array('hide'),
|
131 |
-
),
|
132 |
-
'label' => __( 'Scroll to zoom', 'so-widgets-bundle' ),
|
133 |
-
'description' => __( 'Allow scrolling over the map to zoom in or out.', 'so-widgets-bundle' )
|
134 |
-
),
|
135 |
-
'draggable' => array(
|
136 |
-
'type' => 'checkbox',
|
137 |
-
'default' => true,
|
138 |
-
'state_handler' => array(
|
139 |
-
'map_type[interactive]' => array('show'),
|
140 |
-
'_else[map_type]' => array('hide'),
|
141 |
-
),
|
142 |
-
'label' => __( 'Draggable', 'so-widgets-bundle' ),
|
143 |
-
'description' => __( 'Allow dragging the map to move it around.', 'so-widgets-bundle' )
|
144 |
-
),
|
145 |
-
'disable_default_ui' => array(
|
146 |
-
'type' => 'checkbox',
|
147 |
-
'default' => false,
|
148 |
-
'state_handler' => array(
|
149 |
-
'map_type[interactive]' => array('show'),
|
150 |
-
'_else[map_type]' => array('hide'),
|
151 |
-
),
|
152 |
-
'label' => __( 'Disable default UI', 'so-widgets-bundle' ),
|
153 |
-
'description' => __( 'Hides the default Google Maps controls.', 'so-widgets-bundle' )
|
154 |
-
),
|
155 |
-
'keep_centered' => array(
|
156 |
-
'type' => 'checkbox',
|
157 |
-
'default' => false,
|
158 |
-
'state_handler' => array(
|
159 |
-
'map_type[interactive]' => array('show'),
|
160 |
-
'_else[map_type]' => array('hide'),
|
161 |
-
),
|
162 |
-
'label' => __( 'Keep map centered', 'so-widgets-bundle' ),
|
163 |
-
'description' => __( 'Keeps the map centered when it\'s container is resized.', 'so-widgets-bundle' )
|
164 |
-
),
|
165 |
-
'fallback_image' => array(
|
166 |
-
'type' => 'media',
|
167 |
-
'label' => __( 'Fallback Image', 'so-widgets-bundle' ),
|
168 |
-
'description' => __( 'This image will be displayed if there are any problems with displaying the specified map.', 'so-widgets-bundle' ),
|
169 |
-
'library' => 'image',
|
170 |
-
),
|
171 |
-
'fallback_image_size' => array(
|
172 |
-
'type' => 'image-size',
|
173 |
-
'label' => __( 'Fallback Image Size', 'so-widgets-bundle' ),
|
174 |
-
),
|
175 |
-
)
|
176 |
-
),
|
177 |
-
'markers' => array(
|
178 |
-
'type' => 'section',
|
179 |
-
'label' => __( 'Markers', 'so-widgets-bundle' ),
|
180 |
-
'hide' => true,
|
181 |
-
'description' => __( 'Use markers to identify points of interest on the map.', 'so-widgets-bundle' ),
|
182 |
-
'fields' => array(
|
183 |
-
'marker_at_center' => array(
|
184 |
-
'type' => 'checkbox',
|
185 |
-
'default' => true,
|
186 |
-
'label' => __( 'Show marker at map center', 'so-widgets-bundle' )
|
187 |
-
),
|
188 |
-
'marker_icon' => array(
|
189 |
-
'type' => 'media',
|
190 |
-
'default' => '',
|
191 |
-
'label' => __( 'Marker icon', 'so-widgets-bundle' ),
|
192 |
-
'description' => __( 'Replaces the default map marker with your own image.', 'so-widgets-bundle' )
|
193 |
-
),
|
194 |
-
'markers_draggable' => array(
|
195 |
-
'type' => 'checkbox',
|
196 |
-
'default' => false,
|
197 |
-
'state_handler' => array(
|
198 |
-
'map_type[interactive]' => array('show'),
|
199 |
-
'_else[map_type]' => array('hide'),
|
200 |
-
),
|
201 |
-
'label' => __( 'Draggable markers', 'so-widgets-bundle' )
|
202 |
-
),
|
203 |
-
'marker_positions' => array(
|
204 |
-
'type' => 'repeater',
|
205 |
-
'label' => __( 'Marker positions', 'so-widgets-bundle' ),
|
206 |
-
'description' => __( 'Please be aware that adding more than 10 markers may cause a slight delay before they appear, due to Google Geocoding API rate limits.', 'so-widgets-bundle' ),
|
207 |
-
'item_name' => __( 'Marker', 'so-widgets-bundle' ),
|
208 |
-
'item_label' => array(
|
209 |
-
'selector' => "[id*='marker_positions-place']",
|
210 |
-
'update_event' => 'change',
|
211 |
-
'value_method' => 'val'
|
212 |
-
),
|
213 |
-
'fields' => array(
|
214 |
-
'place' => array(
|
215 |
-
'type' => 'textarea',
|
216 |
-
'rows' => 2,
|
217 |
-
'label' => __( 'Place', 'so-widgets-bundle' )
|
218 |
-
),
|
219 |
-
'info' => array(
|
220 |
-
'type' => 'tinymce',
|
221 |
-
'rows' => 10,
|
222 |
-
'label' => __( 'Info Window Content', 'so-widgets-bundle' )
|
223 |
-
),
|
224 |
-
'info_max_width' => array(
|
225 |
-
'type' => 'text',
|
226 |
-
'label' => __( 'Info Window max width', 'so-widgets-bundle' )
|
227 |
-
),
|
228 |
-
'custom_marker_icon' => array(
|
229 |
-
'type' => 'media',
|
230 |
-
'default' => '',
|
231 |
-
'label' => __( 'Custom Marker icon', 'so-widgets-bundle' ),
|
232 |
-
'description' => __( 'Replace the default map marker with your own image for each marker.', 'so-widgets-bundle' )
|
233 |
-
),
|
234 |
-
)
|
235 |
-
),
|
236 |
-
'info_display' => array(
|
237 |
-
'type' => 'radio',
|
238 |
-
'label' => __( 'When should Info Windows be displayed?', 'so-widgets-bundle' ),
|
239 |
-
'default' => 'click',
|
240 |
-
'options' => array(
|
241 |
-
'click' => __( 'Click', 'so-widgets-bundle' ),
|
242 |
-
'mouseover' => __( 'Mouse over', 'so-widgets-bundle' ),
|
243 |
-
'always' => __( 'Always', 'so-widgets-bundle' ),
|
244 |
-
)
|
245 |
-
),
|
246 |
-
'info_multiple' => array(
|
247 |
-
'type' => 'checkbox',
|
248 |
-
'label' => __( 'Allow multiple simultaneous Info Windows?', 'so-widgets-bundle' ),
|
249 |
-
'default' => true,
|
250 |
-
'description' => __( 'This setting is ignored when Info Windows are set to always display.' )
|
251 |
-
),
|
252 |
-
)
|
253 |
-
),
|
254 |
-
'styles' => array(
|
255 |
-
'type' => 'section',
|
256 |
-
'label' => __( 'Styles', 'so-widgets-bundle' ),
|
257 |
-
'hide' => true,
|
258 |
-
'description' => __( 'Apply custom colors to map features, or hide them completely.', 'so-widgets-bundle' ),
|
259 |
-
'fields' => array(
|
260 |
-
'style_method' => array(
|
261 |
-
'type' => 'radio',
|
262 |
-
'default' => 'normal',
|
263 |
-
'label' => __( 'Map styles', 'so-widgets-bundle' ),
|
264 |
-
'state_emitter' => array(
|
265 |
-
'callback' => 'select',
|
266 |
-
'args' => array( 'style_method' )
|
267 |
-
),
|
268 |
-
'options' => array(
|
269 |
-
'normal' => __( 'Default', 'so-widgets-bundle' ),
|
270 |
-
'custom' => __( 'Custom', 'so-widgets-bundle' ),
|
271 |
-
'raw_json' => __( 'Predefined Styles', 'so-widgets-bundle' ),
|
272 |
-
)
|
273 |
-
),
|
274 |
-
'styled_map_name' => array(
|
275 |
-
'type' => 'text',
|
276 |
-
'state_handler' => array(
|
277 |
-
'style_method[default]' => array('hide'),
|
278 |
-
'_else[style_method]' => array('show'),
|
279 |
-
),
|
280 |
-
'label' => __( 'Styled map name', 'so-widgets-bundle' )
|
281 |
-
),
|
282 |
-
'raw_json_map_styles' => array(
|
283 |
-
'type' => 'textarea',
|
284 |
-
'state_handler' => array(
|
285 |
-
'style_method[raw_json]' => array('show'),
|
286 |
-
'_else[style_method]' => array('hide'),
|
287 |
-
),
|
288 |
-
'rows' => 5,
|
289 |
-
'hidden' => true,
|
290 |
-
'label' => __( 'Raw JSON styles', 'so-widgets-bundle' ),
|
291 |
-
'description' => __( 'Copy and paste predefined styles here from <a href="http://snazzymaps.com/" target="_blank" rel="noopener noreferrer">Snazzy Maps</a>.', 'so-widgets-bundle' )
|
292 |
-
),
|
293 |
-
'custom_map_styles' => array(
|
294 |
-
'type' => 'repeater',
|
295 |
-
'state_handler' => array(
|
296 |
-
'style_method[custom]' => array('show'),
|
297 |
-
'_else[style_method]' => array('hide'),
|
298 |
-
),
|
299 |
-
'label' => __( 'Custom map styles', 'so-widgets-bundle' ),
|
300 |
-
'item_name' => __( 'Style', 'so-widgets-bundle' ),
|
301 |
-
'item_label' => array(
|
302 |
-
'selector' => "[id*='custom_map_styles-map_feature'] :selected",
|
303 |
-
'update_event' => 'change',
|
304 |
-
'value_method' => 'text'
|
305 |
-
),
|
306 |
-
'fields' => array(
|
307 |
-
'map_feature' => array(
|
308 |
-
'type' => 'select',
|
309 |
-
'label' => '',
|
310 |
-
'prompt' => __( 'Select map feature to style', 'so-widgets-bundle' ),
|
311 |
-
'options' => array(
|
312 |
-
'water' => __( 'Water', 'so-widgets-bundle' ),
|
313 |
-
'road_highway' => __( 'Highways', 'so-widgets-bundle' ),
|
314 |
-
'road_arterial' => __( 'Arterial roads', 'so-widgets-bundle' ),
|
315 |
-
'road_local' => __( 'Local roads', 'so-widgets-bundle' ),
|
316 |
-
'transit_line' => __( 'Transit lines', 'so-widgets-bundle' ),
|
317 |
-
'transit_station' => __( 'Transit stations', 'so-widgets-bundle' ),
|
318 |
-
'landscape_man-made' => __( 'Man-made landscape', 'so-widgets-bundle' ),
|
319 |
-
'landscape_natural_landcover' => __( 'Natural landscape landcover', 'so-widgets-bundle' ),
|
320 |
-
'landscape_natural_terrain' => __( 'Natural landscape terrain', 'so-widgets-bundle' ),
|
321 |
-
'poi_attraction' => __( 'Point of interest - Attractions', 'so-widgets-bundle' ),
|
322 |
-
'poi_business' => __( 'Point of interest - Business', 'so-widgets-bundle' ),
|
323 |
-
'poi_government' => __( 'Point of interest - Government', 'so-widgets-bundle' ),
|
324 |
-
'poi_medical' => __( 'Point of interest - Medical', 'so-widgets-bundle' ),
|
325 |
-
'poi_park' => __( 'Point of interest - Parks', 'so-widgets-bundle' ),
|
326 |
-
'poi_place-of-worship' => __( 'Point of interest - Places of worship', 'so-widgets-bundle' ),
|
327 |
-
'poi_school' => __( 'Point of interest - Schools', 'so-widgets-bundle' ),
|
328 |
-
'poi_sports-complex' => __( 'Point of interest - Sports complexes', 'so-widgets-bundle' ),
|
329 |
-
)
|
330 |
-
),
|
331 |
-
'element_type' => array(
|
332 |
-
'type' => 'select',
|
333 |
-
'label' => __( 'Select element type to style', 'so-widgets-bundle' ),
|
334 |
-
'options' => array(
|
335 |
-
'geometry' => __( 'Geometry', 'so-widgets-bundle' ),
|
336 |
-
'labels' => __( 'Labels', 'so-widgets-bundle' ),
|
337 |
-
'all' => __( 'All', 'so-widgets-bundle' ),
|
338 |
-
)
|
339 |
-
),
|
340 |
-
'visibility' => array(
|
341 |
-
'type' => 'checkbox',
|
342 |
-
'default' => true,
|
343 |
-
'label' => __( 'Visible', 'so-widgets-bundle' )
|
344 |
-
),
|
345 |
-
'color' => array(
|
346 |
-
'type' => 'color',
|
347 |
-
'label' => __( 'Color', 'so-widgets-bundle' )
|
348 |
-
)
|
349 |
-
)
|
350 |
-
)
|
351 |
-
)
|
352 |
-
),
|
353 |
-
'directions' => array(
|
354 |
-
'type' => 'section',
|
355 |
-
'label' => __( 'Directions', 'so-widgets-bundle' ),
|
356 |
-
'state_handler' => array(
|
357 |
-
'map_type[interactive]' => array('show'),
|
358 |
-
'_else[map_type]' => array('hide'),
|
359 |
-
),
|
360 |
-
'hide' => true,
|
361 |
-
'description' => sprintf(
|
362 |
-
__( 'Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the <strong>Directions API</strong> in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
|
363 |
-
'<a href="https://console.developers.google.com/apis/dashboard?project=_" target="_blank" rel="noopener noreferrer">',
|
364 |
-
'</a>'
|
365 |
-
),
|
366 |
-
'fields' => array(
|
367 |
-
'origin' => array(
|
368 |
-
'type' => 'text',
|
369 |
-
'label' => __( 'Starting point', 'so-widgets-bundle' )
|
370 |
-
),
|
371 |
-
'destination' => array(
|
372 |
-
'type' => 'text',
|
373 |
-
'label' => __( 'Destination', 'so-widgets-bundle' )
|
374 |
-
),
|
375 |
-
'travel_mode' => array(
|
376 |
-
'type' => 'select',
|
377 |
-
'label' => __( 'Travel mode', 'so-widgets-bundle' ),
|
378 |
-
'default' => 'driving',
|
379 |
-
'options' => array(
|
380 |
-
'driving' => __( 'Driving', 'so-widgets-bundle' ),
|
381 |
-
'walking' => __( 'Walking', 'so-widgets-bundle' ),
|
382 |
-
'bicycling' => __( 'Bicycling', 'so-widgets-bundle' ),
|
383 |
-
'transit' => __( 'Transit', 'so-widgets-bundle' )
|
384 |
-
)
|
385 |
-
),
|
386 |
-
'avoid_highways' => array(
|
387 |
-
'type' => 'checkbox',
|
388 |
-
'label' => __( 'Avoid highways', 'so-widgets-bundle' ),
|
389 |
-
),
|
390 |
-
'avoid_tolls' => array(
|
391 |
-
'type' => 'checkbox',
|
392 |
-
'label' => __( 'Avoid tolls', 'so-widgets-bundle' ),
|
393 |
-
),
|
394 |
-
'preserve_viewport' => array(
|
395 |
-
'type' => 'checkbox',
|
396 |
-
'label' => __( 'Preserve viewport', 'so-widgets-bundle' ),
|
397 |
-
'description' => __( 'This will prevent the map from centering and zooming around the directions. Use this when you have other markers or features on your map.', 'so-widgets-bundle' ),
|
398 |
-
),
|
399 |
-
'waypoints' => array(
|
400 |
-
'type' => 'repeater',
|
401 |
-
'label' => __( 'Waypoints', 'so-widgets-bundle' ),
|
402 |
-
'item_name' => __( 'Waypoint', 'so-widgets-bundle' ),
|
403 |
-
'item_label' => array(
|
404 |
-
'selector' => "[id*='waypoints-location']",
|
405 |
-
'update_event' => 'change',
|
406 |
-
'value_method' => 'val'
|
407 |
-
),
|
408 |
-
'fields' => array(
|
409 |
-
'location' => array(
|
410 |
-
'type' => 'textarea',
|
411 |
-
'rows' => 2,
|
412 |
-
'label' => __( 'Location', 'so-widgets-bundle' )
|
413 |
-
),
|
414 |
-
'stopover' => array(
|
415 |
-
'type' => 'checkbox',
|
416 |
-
'default' => true,
|
417 |
-
'label' => __( 'Stopover', 'so-widgets-bundle' ),
|
418 |
-
'description' => __( 'Whether or not this is a stop on the route or just a route preference.', 'so-widgets-bundle' )
|
419 |
-
)
|
420 |
-
)
|
421 |
-
),
|
422 |
-
'optimize_waypoints' => array(
|
423 |
-
'type' => 'checkbox',
|
424 |
-
'label' => __( 'Optimize waypoints', 'so-widgets-bundle' ),
|
425 |
-
'default' => false,
|
426 |
-
'description' => __( 'Allow the Google Maps service to reorder waypoints for the shortest travelling distance.', 'so-widgets-bundle' )
|
427 |
-
)
|
428 |
-
)
|
429 |
-
),
|
430 |
-
);
|
431 |
-
}
|
432 |
-
|
433 |
-
function get_settings_form() {
|
434 |
-
return array(
|
435 |
-
'api_key' => array(
|
436 |
-
'type' => 'text',
|
437 |
-
'label' => __( 'API key', 'so-widgets-bundle' ),
|
438 |
-
'required' => true,
|
439 |
-
'description' => sprintf(
|
440 |
-
__( 'Enter your %sAPI key%s. Your map won\'t function correctly without one.', 'so-widgets-bundle' ),
|
441 |
-
'<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank" rel="noopener noreferrer">',
|
442 |
-
'</a>'
|
443 |
-
)
|
444 |
-
)
|
445 |
-
);
|
446 |
-
}
|
447 |
-
|
448 |
-
function get_template_name( $instance ) {
|
449 |
-
return $instance['settings']['map_type'] == 'static' ? 'static-map' : 'js-map';
|
450 |
-
}
|
451 |
-
|
452 |
-
function get_style_name( $instance ) {
|
453 |
-
// We aren't using a LESS style for this widget.
|
454 |
-
return false;
|
455 |
-
}
|
456 |
-
|
457 |
-
function get_template_variables( $instance, $args ) {
|
458 |
-
if( empty( $instance ) ) return array();
|
459 |
-
|
460 |
-
$settings = $instance['settings'];
|
461 |
-
|
462 |
-
$mrkr_src = wp_get_attachment_image_src( $instance['markers']['marker_icon'] );
|
463 |
-
|
464 |
-
$styles = $this->get_styles( $instance );
|
465 |
-
|
466 |
-
if ( empty( $instance['api_key_section']['api_key'] ) ) {
|
467 |
-
$global_settings = $this->get_global_settings();
|
468 |
-
if ( ! empty( $global_settings['api_key'] ) ) {
|
469 |
-
$instance['api_key_section']['api_key'] = $global_settings['api_key'];
|
470 |
-
}
|
471 |
-
}
|
472 |
-
|
473 |
-
$fallback_image = '';
|
474 |
-
if ( ! empty ( $instance['settings']['fallback_image'] ) ) {
|
475 |
-
$fallback_image = siteorigin_widgets_get_attachment_image(
|
476 |
-
$instance['settings']['fallback_image'],
|
477 |
-
$instance['settings']['fallback_image_size'],
|
478 |
-
false );
|
479 |
-
}
|
480 |
-
|
481 |
-
if ( $settings['map_type'] == 'static' ) {
|
482 |
-
return array(
|
483 |
-
'src_url' => $this->get_static_image_src( $instance, $settings['width'], $settings['height'], ! empty( $styles ) ? $styles['styles'] : array() ),
|
484 |
-
'destination_url' => $instance['settings']['destination_url'],
|
485 |
-
'new_window' => $instance['settings']['new_window'],
|
486 |
-
'fallback_image_data' => array( 'img' => $fallback_image ),
|
487 |
-
);
|
488 |
-
} else {
|
489 |
-
$markers = $instance['markers'];
|
490 |
-
$directions = '';
|
491 |
-
if ( ! empty( $instance['directions']['origin'] ) && ! empty( $instance['directions']['destination'] ) ) {
|
492 |
-
if ( empty( $instance['directions']['waypoints'] ) ) {
|
493 |
-
unset( $instance['directions']['waypoints'] );
|
494 |
-
}
|
495 |
-
$directions = siteorigin_widgets_underscores_to_camel_case( $instance['directions'] );
|
496 |
-
}
|
497 |
-
|
498 |
-
$markerpos = isset( $markers['marker_positions'] ) ? $markers['marker_positions'] : '';
|
499 |
-
if( ! empty($markerpos)) {
|
500 |
-
foreach ($markerpos as $key => $pos) {
|
501 |
-
if(! empty($pos['custom_marker_icon'])) {
|
502 |
-
$icon_src = wp_get_attachment_image_src( $pos['custom_marker_icon'] );
|
503 |
-
$markerpos[$key]['custom_marker_icon'] = $icon_src[0];
|
504 |
-
}
|
505 |
-
}
|
506 |
-
}
|
507 |
-
|
508 |
-
$map_data = siteorigin_widgets_underscores_to_camel_case( array(
|
509 |
-
'address' => $instance['map_center'],
|
510 |
-
'zoom' => $settings['zoom'],
|
511 |
-
'scroll_zoom' => $settings['scroll_zoom'],
|
512 |
-
'draggable' => $settings['draggable'],
|
513 |
-
'disable_ui' => $settings['disable_default_ui'],
|
514 |
-
'keep_centered' => $settings['keep_centered'],
|
515 |
-
'marker_icon' => ! empty( $mrkr_src ) ? $mrkr_src[0] : '',
|
516 |
-
'markers_draggable' => isset( $markers['markers_draggable'] ) ? $markers['markers_draggable'] : '',
|
517 |
-
'marker_at_center' => !empty( $markers['marker_at_center'] ),
|
518 |
-
'marker_info_display' => $markers['info_display'],
|
519 |
-
'marker_info_multiple' => $markers['info_multiple'],
|
520 |
-
'marker_positions' => ! empty( $markerpos ) ? $markerpos : '',
|
521 |
-
'map_name' => ! empty( $styles ) ? $styles['map_name'] : '',
|
522 |
-
'map_styles' => ! empty( $styles ) ? $styles['styles'] : '',
|
523 |
-
'directions' => $directions,
|
524 |
-
'api_key' => $instance['api_key_section']['api_key'],
|
525 |
-
));
|
526 |
-
|
527 |
-
return array(
|
528 |
-
'map_id' => md5( $instance['map_center'] ),
|
529 |
-
'height' => $settings['height'],
|
530 |
-
'map_data' => $map_data,
|
531 |
-
'fallback_image_data' => array( 'img' => $fallback_image ),
|
532 |
-
);
|
533 |
-
}
|
534 |
-
}
|
535 |
-
|
536 |
-
public function enqueue_widget_scripts( $instance ) {
|
537 |
-
if ( $instance['settings']['map_type'] == 'interactive' ) {
|
538 |
-
wp_enqueue_script( 'sow-google-map' );
|
539 |
-
|
540 |
-
wp_enqueue_style(
|
541 |
-
'sow-google-map',
|
542 |
-
plugin_dir_url(__FILE__) . 'css/style.css',
|
543 |
-
array(),
|
544 |
-
SOW_BUNDLE_VERSION
|
545 |
-
);
|
546 |
-
|
547 |
-
wp_localize_script(
|
548 |
-
'sow-google-map',
|
549 |
-
'soWidgetsGoogleMap',
|
550 |
-
array(
|
551 |
-
'geocode' => array(
|
552 |
-
'noResults' => __( 'There were no results for the place you entered. Please try another.', 'so-widgets-bundle' ),
|
553 |
-
),
|
554 |
-
)
|
555 |
-
);
|
556 |
-
} else {
|
557 |
-
wp_enqueue_script(
|
558 |
-
'sow-google-map-static',
|
559 |
-
plugin_dir_url( __FILE__ ) . 'js/static-map' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
560 |
-
array( 'jquery' ),
|
561 |
-
SOW_BUNDLE_VERSION
|
562 |
-
);
|
563 |
-
}
|
564 |
-
}
|
565 |
-
|
566 |
-
|
567 |
-
private function get_styles( $instance ) {
|
568 |
-
$style_config = $instance['styles'];
|
569 |
-
switch ( $style_config['style_method'] ) {
|
570 |
-
case 'custom':
|
571 |
-
if ( empty( $style_config['custom_map_styles'] ) ) {
|
572 |
-
return array();
|
573 |
-
} else {
|
574 |
-
$map_name = ! empty( $style_config['styled_map_name'] ) ? $style_config['styled_map_name'] : 'Custom Map';
|
575 |
-
$map_styles = $style_config['custom_map_styles'];
|
576 |
-
$styles = array();
|
577 |
-
foreach ( $map_styles as $style_item ) {
|
578 |
-
$map_feature = $style_item['map_feature'];
|
579 |
-
unset( $style_item['map_feature'] );
|
580 |
-
$element_type = $style_item['element_type'];
|
581 |
-
unset( $style_item['element_type'] );
|
582 |
-
|
583 |
-
$stylers = array();
|
584 |
-
foreach ( $style_item as $style_name => $style_value ) {
|
585 |
-
if ( $style_value !== '' && ! is_null( $style_value ) ) {
|
586 |
-
$style_value = $style_value === false ? 'off' : $style_value;
|
587 |
-
array_push( $stylers, array( $style_name => $style_value ) );
|
588 |
-
}
|
589 |
-
}
|
590 |
-
$map_feature = str_replace( '_', '.', $map_feature );
|
591 |
-
$map_feature = str_replace( '-', '_', $map_feature );
|
592 |
-
array_push( $styles, array(
|
593 |
-
'featureType' => $map_feature,
|
594 |
-
'elementType' => $element_type,
|
595 |
-
'stylers' => $stylers
|
596 |
-
) );
|
597 |
-
}
|
598 |
-
|
599 |
-
return array( 'map_name' => $map_name, 'styles' => $styles );
|
600 |
-
}
|
601 |
-
case 'raw_json':
|
602 |
-
if ( empty( $style_config['raw_json_map_styles'] ) ) {
|
603 |
-
return array();
|
604 |
-
} else {
|
605 |
-
$map_name = ! empty( $style_config['styled_map_name'] ) ? $style_config['styled_map_name'] : __( 'Custom Map', 'so-widgets-bundle' );
|
606 |
-
$styles_string = $style_config['raw_json_map_styles'];
|
607 |
-
|
608 |
-
return array( 'map_name' => $map_name, 'styles' => json_decode( $styles_string, true ) );
|
609 |
-
}
|
610 |
-
case 'normal':
|
611 |
-
default:
|
612 |
-
return array();
|
613 |
-
}
|
614 |
-
}
|
615 |
-
|
616 |
-
private function get_static_image_src( $instance, $width, $height, $styles ) {
|
617 |
-
$src_url = "https://maps.googleapis.com/maps/api/staticmap?";
|
618 |
-
$src_url .= "center=" . $instance['map_center'];
|
619 |
-
$src_url .= "&zoom=" . $instance['settings']['zoom'];
|
620 |
-
$src_url .= "&size=" . $width . "x" . $height;
|
621 |
-
|
622 |
-
if ( ! empty( $instance['api_key_section']['api_key'] ) ) {
|
623 |
-
$src_url .= "&key=" . $instance['api_key_section']['api_key'];
|
624 |
-
}
|
625 |
-
|
626 |
-
if ( ! empty( $styles ) ) {
|
627 |
-
foreach ( $styles as $st ) {
|
628 |
-
if ( empty( $st ) || ! isset( $st['stylers'] ) || empty( $st['stylers'] ) ) {
|
629 |
-
continue;
|
630 |
-
}
|
631 |
-
$st_string = '';
|
632 |
-
if ( isset ( $st['featureType'] ) ) {
|
633 |
-
$st_string .= 'feature:' . $st['featureType'];
|
634 |
-
}
|
635 |
-
if ( isset ( $st['elementType'] ) ) {
|
636 |
-
if ( ! empty( $st_string ) ) {
|
637 |
-
$st_string .= "|";
|
638 |
-
}
|
639 |
-
$st_string .= 'element:' . $st['elementType'];
|
640 |
-
}
|
641 |
-
foreach ( $st['stylers'] as $style_prop_arr ) {
|
642 |
-
foreach ( $style_prop_arr as $prop_name => $prop_val ) {
|
643 |
-
if ( ! empty( $st_string ) ) {
|
644 |
-
$st_string .= "|";
|
645 |
-
}
|
646 |
-
if ( $prop_val[0] == "#" ) {
|
647 |
-
$prop_val = "0x" . substr( $prop_val, 1 );
|
648 |
-
}
|
649 |
-
if ( is_bool( $prop_val ) ) {
|
650 |
-
$prop_val = $prop_val ? 'true' : 'false';
|
651 |
-
}
|
652 |
-
$st_string .= $prop_name . ":" . $prop_val;
|
653 |
-
}
|
654 |
-
}
|
655 |
-
$st_string = '&style=' . $st_string;
|
656 |
-
$src_url .= $st_string;
|
657 |
-
}
|
658 |
-
}
|
659 |
-
|
660 |
-
if ( ! empty( $instance['markers'] ) ) {
|
661 |
-
$markers = $instance['markers'];
|
662 |
-
$markers_st = '';
|
663 |
-
|
664 |
-
if ( ! empty( $markers['marker_icon'] ) ) {
|
665 |
-
$mrkr_src = wp_get_attachment_image_src( $markers['marker_icon'] );
|
666 |
-
if ( ! empty( $mrkr_src ) ) {
|
667 |
-
$markers_st .= 'icon:' . $mrkr_src[0];
|
668 |
-
}
|
669 |
-
}
|
670 |
-
|
671 |
-
if ( !empty( $markers['marker_at_center'] ) ) {
|
672 |
-
if ( ! empty( $markers_st ) ) {
|
673 |
-
$markers_st .= "|";
|
674 |
-
}
|
675 |
-
$markers_st .= $instance['map_center'];
|
676 |
-
}
|
677 |
-
|
678 |
-
if ( ! empty( $markers['marker_positions'] ) ) {
|
679 |
-
foreach ( $markers['marker_positions'] as $marker ) {
|
680 |
-
if ( ! empty( $markers_st ) ) {
|
681 |
-
$markers_st .= "|";
|
682 |
-
}
|
683 |
-
$markers_st .= urlencode( $marker['place'] );
|
684 |
-
}
|
685 |
-
}
|
686 |
-
$markers_st = '&markers=' . $markers_st;
|
687 |
-
$src_url .= $markers_st;
|
688 |
-
}
|
689 |
-
|
690 |
-
return $src_url;
|
691 |
-
}
|
692 |
-
}
|
693 |
-
|
694 |
-
siteorigin_widget_register( 'sow-google-map', __FILE__, 'SiteOrigin_Widget_GoogleMap_Widget' );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Widget Name: Google Maps
|
5 |
+
Description: A highly customisable Google Maps widget. Help your site find its place and give it some direction.
|
6 |
+
Author: SiteOrigin
|
7 |
+
Author URI: https://siteorigin.com
|
8 |
+
*/
|
9 |
+
|
10 |
+
class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
11 |
+
|
12 |
+
function __construct() {
|
13 |
+
|
14 |
+
parent::__construct(
|
15 |
+
'sow-google-map',
|
16 |
+
__( 'SiteOrigin Google Maps', 'so-widgets-bundle' ),
|
17 |
+
array(
|
18 |
+
'description' => __( 'A Google Maps widget.', 'so-widgets-bundle' ),
|
19 |
+
'help' => 'https://siteorigin.com/widgets-bundle/google-maps-widget/'
|
20 |
+
),
|
21 |
+
array(),
|
22 |
+
false,
|
23 |
+
plugin_dir_path(__FILE__)
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
function initialize() {
|
28 |
+
|
29 |
+
add_action( 'siteorigin_widgets_before_widget_sow-google-map', array( $this, 'enqueue_widget_scripts' ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
function get_widget_form(){
|
33 |
+
return array(
|
34 |
+
'map_center' => array(
|
35 |
+
'type' => 'textarea',
|
36 |
+
'rows' => 2,
|
37 |
+
'label' => __( 'Map center', 'so-widgets-bundle' ),
|
38 |
+
'description' => sprintf(
|
39 |
+
__( 'The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the <strong>Geocoding API</strong> in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
|
40 |
+
'<a href="https://console.developers.google.com/apis/dashboard?project=_" target="_blank" rel="noopener noreferrer">',
|
41 |
+
'</a>'
|
42 |
+
),
|
43 |
+
),
|
44 |
+
'api_key_section' => array(
|
45 |
+
'type' => 'section',
|
46 |
+
'label' => __( 'API key', 'so-widgets-bundle' ),
|
47 |
+
'hide' => false,
|
48 |
+
'fields' => array(
|
49 |
+
'api_key' => array(
|
50 |
+
'type' => 'text',
|
51 |
+
'label' => __( 'API key', 'so-widgets-bundle' ),
|
52 |
+
'required' => true,
|
53 |
+
'description' => sprintf(
|
54 |
+
__( 'Enter your %sAPI key%s. Your map may not function correctly without one.', 'so-widgets-bundle' ),
|
55 |
+
'<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank" rel="noopener noreferrer">',
|
56 |
+
'</a>'
|
57 |
+
)
|
58 |
+
)
|
59 |
+
)
|
60 |
+
),
|
61 |
+
'settings' => array(
|
62 |
+
'type' => 'section',
|
63 |
+
'label' => __( 'Settings', 'so-widgets-bundle' ),
|
64 |
+
'hide' => false,
|
65 |
+
'description' => __( 'Set map display options.', 'so-widgets-bundle' ),
|
66 |
+
'fields' => array(
|
67 |
+
'map_type' => array(
|
68 |
+
'type' => 'radio',
|
69 |
+
'default' => 'interactive',
|
70 |
+
'label' => __( 'Map type', 'so-widgets-bundle' ),
|
71 |
+
'state_emitter' => array(
|
72 |
+
'callback' => 'select',
|
73 |
+
'args' => array( 'map_type' )
|
74 |
+
),
|
75 |
+
'options' => array(
|
76 |
+
'interactive' => __( 'Interactive', 'so-widgets-bundle' ),
|
77 |
+
'static' => __( 'Static image', 'so-widgets-bundle' ),
|
78 |
+
)
|
79 |
+
),
|
80 |
+
'width' => array(
|
81 |
+
'type' => 'text',
|
82 |
+
'default' => 640,
|
83 |
+
'hidden' => true,
|
84 |
+
'state_handler' => array(
|
85 |
+
'map_type[static]' => array('show'),
|
86 |
+
'_else[map_type]' => array('hide'),
|
87 |
+
),
|
88 |
+
'label' => __( 'Width', 'so-widgets-bundle' )
|
89 |
+
),
|
90 |
+
'height' => array(
|
91 |
+
'type' => 'text',
|
92 |
+
'default' => 480,
|
93 |
+
'label' => __( 'Height', 'so-widgets-bundle' )
|
94 |
+
),
|
95 |
+
'destination_url' => array(
|
96 |
+
'type' => 'link',
|
97 |
+
'label' => __( 'Destination URL', 'so-widgets-bundle' ),
|
98 |
+
'hidden' => true,
|
99 |
+
'state_handler' => array(
|
100 |
+
'map_type[static]' => array('show'),
|
101 |
+
'_else[map_type]' => array('hide'),
|
102 |
+
),
|
103 |
+
),
|
104 |
+
|
105 |
+
'new_window' => array(
|
106 |
+
'type' => 'checkbox',
|
107 |
+
'default' => false,
|
108 |
+
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
109 |
+
'hidden' => true,
|
110 |
+
'state_handler' => array(
|
111 |
+
'map_type[static]' => array('show'),
|
112 |
+
'_else[map_type]' => array('hide'),
|
113 |
+
),
|
114 |
+
),
|
115 |
+
'zoom' => array(
|
116 |
+
'type' => 'slider',
|
117 |
+
'label' => __( 'Zoom level', 'so-widgets-bundle' ),
|
118 |
+
'description' => __( 'A value from 0 (the world) to 21 (street level).', 'so-widgets-bundle' ),
|
119 |
+
'min' => 0,
|
120 |
+
'max' => 21,
|
121 |
+
'default' => 12,
|
122 |
+
'integer' => true,
|
123 |
+
|
124 |
+
),
|
125 |
+
'scroll_zoom' => array(
|
126 |
+
'type' => 'checkbox',
|
127 |
+
'default' => true,
|
128 |
+
'state_handler' => array(
|
129 |
+
'map_type[interactive]' => array('show'),
|
130 |
+
'_else[map_type]' => array('hide'),
|
131 |
+
),
|
132 |
+
'label' => __( 'Scroll to zoom', 'so-widgets-bundle' ),
|
133 |
+
'description' => __( 'Allow scrolling over the map to zoom in or out.', 'so-widgets-bundle' )
|
134 |
+
),
|
135 |
+
'draggable' => array(
|
136 |
+
'type' => 'checkbox',
|
137 |
+
'default' => true,
|
138 |
+
'state_handler' => array(
|
139 |
+
'map_type[interactive]' => array('show'),
|
140 |
+
'_else[map_type]' => array('hide'),
|
141 |
+
),
|
142 |
+
'label' => __( 'Draggable', 'so-widgets-bundle' ),
|
143 |
+
'description' => __( 'Allow dragging the map to move it around.', 'so-widgets-bundle' )
|
144 |
+
),
|
145 |
+
'disable_default_ui' => array(
|
146 |
+
'type' => 'checkbox',
|
147 |
+
'default' => false,
|
148 |
+
'state_handler' => array(
|
149 |
+
'map_type[interactive]' => array('show'),
|
150 |
+
'_else[map_type]' => array('hide'),
|
151 |
+
),
|
152 |
+
'label' => __( 'Disable default UI', 'so-widgets-bundle' ),
|
153 |
+
'description' => __( 'Hides the default Google Maps controls.', 'so-widgets-bundle' )
|
154 |
+
),
|
155 |
+
'keep_centered' => array(
|
156 |
+
'type' => 'checkbox',
|
157 |
+
'default' => false,
|
158 |
+
'state_handler' => array(
|
159 |
+
'map_type[interactive]' => array('show'),
|
160 |
+
'_else[map_type]' => array('hide'),
|
161 |
+
),
|
162 |
+
'label' => __( 'Keep map centered', 'so-widgets-bundle' ),
|
163 |
+
'description' => __( 'Keeps the map centered when it\'s container is resized.', 'so-widgets-bundle' )
|
164 |
+
),
|
165 |
+
'fallback_image' => array(
|
166 |
+
'type' => 'media',
|
167 |
+
'label' => __( 'Fallback Image', 'so-widgets-bundle' ),
|
168 |
+
'description' => __( 'This image will be displayed if there are any problems with displaying the specified map.', 'so-widgets-bundle' ),
|
169 |
+
'library' => 'image',
|
170 |
+
),
|
171 |
+
'fallback_image_size' => array(
|
172 |
+
'type' => 'image-size',
|
173 |
+
'label' => __( 'Fallback Image Size', 'so-widgets-bundle' ),
|
174 |
+
),
|
175 |
+
)
|
176 |
+
),
|
177 |
+
'markers' => array(
|
178 |
+
'type' => 'section',
|
179 |
+
'label' => __( 'Markers', 'so-widgets-bundle' ),
|
180 |
+
'hide' => true,
|
181 |
+
'description' => __( 'Use markers to identify points of interest on the map.', 'so-widgets-bundle' ),
|
182 |
+
'fields' => array(
|
183 |
+
'marker_at_center' => array(
|
184 |
+
'type' => 'checkbox',
|
185 |
+
'default' => true,
|
186 |
+
'label' => __( 'Show marker at map center', 'so-widgets-bundle' )
|
187 |
+
),
|
188 |
+
'marker_icon' => array(
|
189 |
+
'type' => 'media',
|
190 |
+
'default' => '',
|
191 |
+
'label' => __( 'Marker icon', 'so-widgets-bundle' ),
|
192 |
+
'description' => __( 'Replaces the default map marker with your own image.', 'so-widgets-bundle' )
|
193 |
+
),
|
194 |
+
'markers_draggable' => array(
|
195 |
+
'type' => 'checkbox',
|
196 |
+
'default' => false,
|
197 |
+
'state_handler' => array(
|
198 |
+
'map_type[interactive]' => array('show'),
|
199 |
+
'_else[map_type]' => array('hide'),
|
200 |
+
),
|
201 |
+
'label' => __( 'Draggable markers', 'so-widgets-bundle' )
|
202 |
+
),
|
203 |
+
'marker_positions' => array(
|
204 |
+
'type' => 'repeater',
|
205 |
+
'label' => __( 'Marker positions', 'so-widgets-bundle' ),
|
206 |
+
'description' => __( 'Please be aware that adding more than 10 markers may cause a slight delay before they appear, due to Google Geocoding API rate limits.', 'so-widgets-bundle' ),
|
207 |
+
'item_name' => __( 'Marker', 'so-widgets-bundle' ),
|
208 |
+
'item_label' => array(
|
209 |
+
'selector' => "[id*='marker_positions-place']",
|
210 |
+
'update_event' => 'change',
|
211 |
+
'value_method' => 'val'
|
212 |
+
),
|
213 |
+
'fields' => array(
|
214 |
+
'place' => array(
|
215 |
+
'type' => 'textarea',
|
216 |
+
'rows' => 2,
|
217 |
+
'label' => __( 'Place', 'so-widgets-bundle' )
|
218 |
+
),
|
219 |
+
'info' => array(
|
220 |
+
'type' => 'tinymce',
|
221 |
+
'rows' => 10,
|
222 |
+
'label' => __( 'Info Window Content', 'so-widgets-bundle' )
|
223 |
+
),
|
224 |
+
'info_max_width' => array(
|
225 |
+
'type' => 'text',
|
226 |
+
'label' => __( 'Info Window max width', 'so-widgets-bundle' )
|
227 |
+
),
|
228 |
+
'custom_marker_icon' => array(
|
229 |
+
'type' => 'media',
|
230 |
+
'default' => '',
|
231 |
+
'label' => __( 'Custom Marker icon', 'so-widgets-bundle' ),
|
232 |
+
'description' => __( 'Replace the default map marker with your own image for each marker.', 'so-widgets-bundle' )
|
233 |
+
),
|
234 |
+
)
|
235 |
+
),
|
236 |
+
'info_display' => array(
|
237 |
+
'type' => 'radio',
|
238 |
+
'label' => __( 'When should Info Windows be displayed?', 'so-widgets-bundle' ),
|
239 |
+
'default' => 'click',
|
240 |
+
'options' => array(
|
241 |
+
'click' => __( 'Click', 'so-widgets-bundle' ),
|
242 |
+
'mouseover' => __( 'Mouse over', 'so-widgets-bundle' ),
|
243 |
+
'always' => __( 'Always', 'so-widgets-bundle' ),
|
244 |
+
)
|
245 |
+
),
|
246 |
+
'info_multiple' => array(
|
247 |
+
'type' => 'checkbox',
|
248 |
+
'label' => __( 'Allow multiple simultaneous Info Windows?', 'so-widgets-bundle' ),
|
249 |
+
'default' => true,
|
250 |
+
'description' => __( 'This setting is ignored when Info Windows are set to always display.' )
|
251 |
+
),
|
252 |
+
)
|
253 |
+
),
|
254 |
+
'styles' => array(
|
255 |
+
'type' => 'section',
|
256 |
+
'label' => __( 'Styles', 'so-widgets-bundle' ),
|
257 |
+
'hide' => true,
|
258 |
+
'description' => __( 'Apply custom colors to map features, or hide them completely.', 'so-widgets-bundle' ),
|
259 |
+
'fields' => array(
|
260 |
+
'style_method' => array(
|
261 |
+
'type' => 'radio',
|
262 |
+
'default' => 'normal',
|
263 |
+
'label' => __( 'Map styles', 'so-widgets-bundle' ),
|
264 |
+
'state_emitter' => array(
|
265 |
+
'callback' => 'select',
|
266 |
+
'args' => array( 'style_method' )
|
267 |
+
),
|
268 |
+
'options' => array(
|
269 |
+
'normal' => __( 'Default', 'so-widgets-bundle' ),
|
270 |
+
'custom' => __( 'Custom', 'so-widgets-bundle' ),
|
271 |
+
'raw_json' => __( 'Predefined Styles', 'so-widgets-bundle' ),
|
272 |
+
)
|
273 |
+
),
|
274 |
+
'styled_map_name' => array(
|
275 |
+
'type' => 'text',
|
276 |
+
'state_handler' => array(
|
277 |
+
'style_method[default]' => array('hide'),
|
278 |
+
'_else[style_method]' => array('show'),
|
279 |
+
),
|
280 |
+
'label' => __( 'Styled map name', 'so-widgets-bundle' )
|
281 |
+
),
|
282 |
+
'raw_json_map_styles' => array(
|
283 |
+
'type' => 'textarea',
|
284 |
+
'state_handler' => array(
|
285 |
+
'style_method[raw_json]' => array('show'),
|
286 |
+
'_else[style_method]' => array('hide'),
|
287 |
+
),
|
288 |
+
'rows' => 5,
|
289 |
+
'hidden' => true,
|
290 |
+
'label' => __( 'Raw JSON styles', 'so-widgets-bundle' ),
|
291 |
+
'description' => __( 'Copy and paste predefined styles here from <a href="http://snazzymaps.com/" target="_blank" rel="noopener noreferrer">Snazzy Maps</a>.', 'so-widgets-bundle' )
|
292 |
+
),
|
293 |
+
'custom_map_styles' => array(
|
294 |
+
'type' => 'repeater',
|
295 |
+
'state_handler' => array(
|
296 |
+
'style_method[custom]' => array('show'),
|
297 |
+
'_else[style_method]' => array('hide'),
|
298 |
+
),
|
299 |
+
'label' => __( 'Custom map styles', 'so-widgets-bundle' ),
|
300 |
+
'item_name' => __( 'Style', 'so-widgets-bundle' ),
|
301 |
+
'item_label' => array(
|
302 |
+
'selector' => "[id*='custom_map_styles-map_feature'] :selected",
|
303 |
+
'update_event' => 'change',
|
304 |
+
'value_method' => 'text'
|
305 |
+
),
|
306 |
+
'fields' => array(
|
307 |
+
'map_feature' => array(
|
308 |
+
'type' => 'select',
|
309 |
+
'label' => '',
|
310 |
+
'prompt' => __( 'Select map feature to style', 'so-widgets-bundle' ),
|
311 |
+
'options' => array(
|
312 |
+
'water' => __( 'Water', 'so-widgets-bundle' ),
|
313 |
+
'road_highway' => __( 'Highways', 'so-widgets-bundle' ),
|
314 |
+
'road_arterial' => __( 'Arterial roads', 'so-widgets-bundle' ),
|
315 |
+
'road_local' => __( 'Local roads', 'so-widgets-bundle' ),
|
316 |
+
'transit_line' => __( 'Transit lines', 'so-widgets-bundle' ),
|
317 |
+
'transit_station' => __( 'Transit stations', 'so-widgets-bundle' ),
|
318 |
+
'landscape_man-made' => __( 'Man-made landscape', 'so-widgets-bundle' ),
|
319 |
+
'landscape_natural_landcover' => __( 'Natural landscape landcover', 'so-widgets-bundle' ),
|
320 |
+
'landscape_natural_terrain' => __( 'Natural landscape terrain', 'so-widgets-bundle' ),
|
321 |
+
'poi_attraction' => __( 'Point of interest - Attractions', 'so-widgets-bundle' ),
|
322 |
+
'poi_business' => __( 'Point of interest - Business', 'so-widgets-bundle' ),
|
323 |
+
'poi_government' => __( 'Point of interest - Government', 'so-widgets-bundle' ),
|
324 |
+
'poi_medical' => __( 'Point of interest - Medical', 'so-widgets-bundle' ),
|
325 |
+
'poi_park' => __( 'Point of interest - Parks', 'so-widgets-bundle' ),
|
326 |
+
'poi_place-of-worship' => __( 'Point of interest - Places of worship', 'so-widgets-bundle' ),
|
327 |
+
'poi_school' => __( 'Point of interest - Schools', 'so-widgets-bundle' ),
|
328 |
+
'poi_sports-complex' => __( 'Point of interest - Sports complexes', 'so-widgets-bundle' ),
|
329 |
+
)
|
330 |
+
),
|
331 |
+
'element_type' => array(
|
332 |
+
'type' => 'select',
|
333 |
+
'label' => __( 'Select element type to style', 'so-widgets-bundle' ),
|
334 |
+
'options' => array(
|
335 |
+
'geometry' => __( 'Geometry', 'so-widgets-bundle' ),
|
336 |
+
'labels' => __( 'Labels', 'so-widgets-bundle' ),
|
337 |
+
'all' => __( 'All', 'so-widgets-bundle' ),
|
338 |
+
)
|
339 |
+
),
|
340 |
+
'visibility' => array(
|
341 |
+
'type' => 'checkbox',
|
342 |
+
'default' => true,
|
343 |
+
'label' => __( 'Visible', 'so-widgets-bundle' )
|
344 |
+
),
|
345 |
+
'color' => array(
|
346 |
+
'type' => 'color',
|
347 |
+
'label' => __( 'Color', 'so-widgets-bundle' )
|
348 |
+
)
|
349 |
+
)
|
350 |
+
)
|
351 |
+
)
|
352 |
+
),
|
353 |
+
'directions' => array(
|
354 |
+
'type' => 'section',
|
355 |
+
'label' => __( 'Directions', 'so-widgets-bundle' ),
|
356 |
+
'state_handler' => array(
|
357 |
+
'map_type[interactive]' => array('show'),
|
358 |
+
'_else[map_type]' => array('hide'),
|
359 |
+
),
|
360 |
+
'hide' => true,
|
361 |
+
'description' => sprintf(
|
362 |
+
__( 'Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the <strong>Directions API</strong> in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
|
363 |
+
'<a href="https://console.developers.google.com/apis/dashboard?project=_" target="_blank" rel="noopener noreferrer">',
|
364 |
+
'</a>'
|
365 |
+
),
|
366 |
+
'fields' => array(
|
367 |
+
'origin' => array(
|
368 |
+
'type' => 'text',
|
369 |
+
'label' => __( 'Starting point', 'so-widgets-bundle' )
|
370 |
+
),
|
371 |
+
'destination' => array(
|
372 |
+
'type' => 'text',
|
373 |
+
'label' => __( 'Destination', 'so-widgets-bundle' )
|
374 |
+
),
|
375 |
+
'travel_mode' => array(
|
376 |
+
'type' => 'select',
|
377 |
+
'label' => __( 'Travel mode', 'so-widgets-bundle' ),
|
378 |
+
'default' => 'driving',
|
379 |
+
'options' => array(
|
380 |
+
'driving' => __( 'Driving', 'so-widgets-bundle' ),
|
381 |
+
'walking' => __( 'Walking', 'so-widgets-bundle' ),
|
382 |
+
'bicycling' => __( 'Bicycling', 'so-widgets-bundle' ),
|
383 |
+
'transit' => __( 'Transit', 'so-widgets-bundle' )
|
384 |
+
)
|
385 |
+
),
|
386 |
+
'avoid_highways' => array(
|
387 |
+
'type' => 'checkbox',
|
388 |
+
'label' => __( 'Avoid highways', 'so-widgets-bundle' ),
|
389 |
+
),
|
390 |
+
'avoid_tolls' => array(
|
391 |
+
'type' => 'checkbox',
|
392 |
+
'label' => __( 'Avoid tolls', 'so-widgets-bundle' ),
|
393 |
+
),
|
394 |
+
'preserve_viewport' => array(
|
395 |
+
'type' => 'checkbox',
|
396 |
+
'label' => __( 'Preserve viewport', 'so-widgets-bundle' ),
|
397 |
+
'description' => __( 'This will prevent the map from centering and zooming around the directions. Use this when you have other markers or features on your map.', 'so-widgets-bundle' ),
|
398 |
+
),
|
399 |
+
'waypoints' => array(
|
400 |
+
'type' => 'repeater',
|
401 |
+
'label' => __( 'Waypoints', 'so-widgets-bundle' ),
|
402 |
+
'item_name' => __( 'Waypoint', 'so-widgets-bundle' ),
|
403 |
+
'item_label' => array(
|
404 |
+
'selector' => "[id*='waypoints-location']",
|
405 |
+
'update_event' => 'change',
|
406 |
+
'value_method' => 'val'
|
407 |
+
),
|
408 |
+
'fields' => array(
|
409 |
+
'location' => array(
|
410 |
+
'type' => 'textarea',
|
411 |
+
'rows' => 2,
|
412 |
+
'label' => __( 'Location', 'so-widgets-bundle' )
|
413 |
+
),
|
414 |
+
'stopover' => array(
|
415 |
+
'type' => 'checkbox',
|
416 |
+
'default' => true,
|
417 |
+
'label' => __( 'Stopover', 'so-widgets-bundle' ),
|
418 |
+
'description' => __( 'Whether or not this is a stop on the route or just a route preference.', 'so-widgets-bundle' )
|
419 |
+
)
|
420 |
+
)
|
421 |
+
),
|
422 |
+
'optimize_waypoints' => array(
|
423 |
+
'type' => 'checkbox',
|
424 |
+
'label' => __( 'Optimize waypoints', 'so-widgets-bundle' ),
|
425 |
+
'default' => false,
|
426 |
+
'description' => __( 'Allow the Google Maps service to reorder waypoints for the shortest travelling distance.', 'so-widgets-bundle' )
|
427 |
+
)
|
428 |
+
)
|
429 |
+
),
|
430 |
+
);
|
431 |
+
}
|
432 |
+
|
433 |
+
function get_settings_form() {
|
434 |
+
return array(
|
435 |
+
'api_key' => array(
|
436 |
+
'type' => 'text',
|
437 |
+
'label' => __( 'API key', 'so-widgets-bundle' ),
|
438 |
+
'required' => true,
|
439 |
+
'description' => sprintf(
|
440 |
+
__( 'Enter your %sAPI key%s. Your map won\'t function correctly without one.', 'so-widgets-bundle' ),
|
441 |
+
'<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank" rel="noopener noreferrer">',
|
442 |
+
'</a>'
|
443 |
+
)
|
444 |
+
)
|
445 |
+
);
|
446 |
+
}
|
447 |
+
|
448 |
+
function get_template_name( $instance ) {
|
449 |
+
return $instance['settings']['map_type'] == 'static' ? 'static-map' : 'js-map';
|
450 |
+
}
|
451 |
+
|
452 |
+
function get_style_name( $instance ) {
|
453 |
+
// We aren't using a LESS style for this widget.
|
454 |
+
return false;
|
455 |
+
}
|
456 |
+
|
457 |
+
function get_template_variables( $instance, $args ) {
|
458 |
+
if( empty( $instance ) ) return array();
|
459 |
+
|
460 |
+
$settings = $instance['settings'];
|
461 |
+
|
462 |
+
$mrkr_src = wp_get_attachment_image_src( $instance['markers']['marker_icon'] );
|
463 |
+
|
464 |
+
$styles = $this->get_styles( $instance );
|
465 |
+
|
466 |
+
if ( empty( $instance['api_key_section']['api_key'] ) ) {
|
467 |
+
$global_settings = $this->get_global_settings();
|
468 |
+
if ( ! empty( $global_settings['api_key'] ) ) {
|
469 |
+
$instance['api_key_section']['api_key'] = $global_settings['api_key'];
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
$fallback_image = '';
|
474 |
+
if ( ! empty ( $instance['settings']['fallback_image'] ) ) {
|
475 |
+
$fallback_image = siteorigin_widgets_get_attachment_image(
|
476 |
+
$instance['settings']['fallback_image'],
|
477 |
+
$instance['settings']['fallback_image_size'],
|
478 |
+
false );
|
479 |
+
}
|
480 |
+
|
481 |
+
if ( $settings['map_type'] == 'static' ) {
|
482 |
+
return array(
|
483 |
+
'src_url' => $this->get_static_image_src( $instance, $settings['width'], $settings['height'], ! empty( $styles ) ? $styles['styles'] : array() ),
|
484 |
+
'destination_url' => $instance['settings']['destination_url'],
|
485 |
+
'new_window' => $instance['settings']['new_window'],
|
486 |
+
'fallback_image_data' => array( 'img' => $fallback_image ),
|
487 |
+
);
|
488 |
+
} else {
|
489 |
+
$markers = $instance['markers'];
|
490 |
+
$directions = '';
|
491 |
+
if ( ! empty( $instance['directions']['origin'] ) && ! empty( $instance['directions']['destination'] ) ) {
|
492 |
+
if ( empty( $instance['directions']['waypoints'] ) ) {
|
493 |
+
unset( $instance['directions']['waypoints'] );
|
494 |
+
}
|
495 |
+
$directions = siteorigin_widgets_underscores_to_camel_case( $instance['directions'] );
|
496 |
+
}
|
497 |
+
|
498 |
+
$markerpos = isset( $markers['marker_positions'] ) ? $markers['marker_positions'] : '';
|
499 |
+
if( ! empty($markerpos)) {
|
500 |
+
foreach ($markerpos as $key => $pos) {
|
501 |
+
if(! empty($pos['custom_marker_icon'])) {
|
502 |
+
$icon_src = wp_get_attachment_image_src( $pos['custom_marker_icon'] );
|
503 |
+
$markerpos[$key]['custom_marker_icon'] = $icon_src[0];
|
504 |
+
}
|
505 |
+
}
|
506 |
+
}
|
507 |
+
|
508 |
+
$map_data = siteorigin_widgets_underscores_to_camel_case( array(
|
509 |
+
'address' => $instance['map_center'],
|
510 |
+
'zoom' => $settings['zoom'],
|
511 |
+
'scroll_zoom' => $settings['scroll_zoom'],
|
512 |
+
'draggable' => $settings['draggable'],
|
513 |
+
'disable_ui' => $settings['disable_default_ui'],
|
514 |
+
'keep_centered' => $settings['keep_centered'],
|
515 |
+
'marker_icon' => ! empty( $mrkr_src ) ? $mrkr_src[0] : '',
|
516 |
+
'markers_draggable' => isset( $markers['markers_draggable'] ) ? $markers['markers_draggable'] : '',
|
517 |
+
'marker_at_center' => !empty( $markers['marker_at_center'] ),
|
518 |
+
'marker_info_display' => $markers['info_display'],
|
519 |
+
'marker_info_multiple' => $markers['info_multiple'],
|
520 |
+
'marker_positions' => ! empty( $markerpos ) ? $markerpos : '',
|
521 |
+
'map_name' => ! empty( $styles ) ? $styles['map_name'] : '',
|
522 |
+
'map_styles' => ! empty( $styles ) ? $styles['styles'] : '',
|
523 |
+
'directions' => $directions,
|
524 |
+
'api_key' => $instance['api_key_section']['api_key'],
|
525 |
+
));
|
526 |
+
|
527 |
+
return array(
|
528 |
+
'map_id' => md5( $instance['map_center'] ),
|
529 |
+
'height' => $settings['height'],
|
530 |
+
'map_data' => $map_data,
|
531 |
+
'fallback_image_data' => array( 'img' => $fallback_image ),
|
532 |
+
);
|
533 |
+
}
|
534 |
+
}
|
535 |
+
|
536 |
+
public function enqueue_widget_scripts( $instance ) {
|
537 |
+
if ( $instance['settings']['map_type'] == 'interactive' ) {
|
538 |
+
wp_enqueue_script( 'sow-google-map' );
|
539 |
+
|
540 |
+
wp_enqueue_style(
|
541 |
+
'sow-google-map',
|
542 |
+
plugin_dir_url(__FILE__) . 'css/style.css',
|
543 |
+
array(),
|
544 |
+
SOW_BUNDLE_VERSION
|
545 |
+
);
|
546 |
+
|
547 |
+
wp_localize_script(
|
548 |
+
'sow-google-map',
|
549 |
+
'soWidgetsGoogleMap',
|
550 |
+
array(
|
551 |
+
'geocode' => array(
|
552 |
+
'noResults' => __( 'There were no results for the place you entered. Please try another.', 'so-widgets-bundle' ),
|
553 |
+
),
|
554 |
+
)
|
555 |
+
);
|
556 |
+
} else {
|
557 |
+
wp_enqueue_script(
|
558 |
+
'sow-google-map-static',
|
559 |
+
plugin_dir_url( __FILE__ ) . 'js/static-map' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
560 |
+
array( 'jquery' ),
|
561 |
+
SOW_BUNDLE_VERSION
|
562 |
+
);
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
|
567 |
+
private function get_styles( $instance ) {
|
568 |
+
$style_config = $instance['styles'];
|
569 |
+
switch ( $style_config['style_method'] ) {
|
570 |
+
case 'custom':
|
571 |
+
if ( empty( $style_config['custom_map_styles'] ) ) {
|
572 |
+
return array();
|
573 |
+
} else {
|
574 |
+
$map_name = ! empty( $style_config['styled_map_name'] ) ? $style_config['styled_map_name'] : 'Custom Map';
|
575 |
+
$map_styles = $style_config['custom_map_styles'];
|
576 |
+
$styles = array();
|
577 |
+
foreach ( $map_styles as $style_item ) {
|
578 |
+
$map_feature = $style_item['map_feature'];
|
579 |
+
unset( $style_item['map_feature'] );
|
580 |
+
$element_type = $style_item['element_type'];
|
581 |
+
unset( $style_item['element_type'] );
|
582 |
+
|
583 |
+
$stylers = array();
|
584 |
+
foreach ( $style_item as $style_name => $style_value ) {
|
585 |
+
if ( $style_value !== '' && ! is_null( $style_value ) ) {
|
586 |
+
$style_value = $style_value === false ? 'off' : $style_value;
|
587 |
+
array_push( $stylers, array( $style_name => $style_value ) );
|
588 |
+
}
|
589 |
+
}
|
590 |
+
$map_feature = str_replace( '_', '.', $map_feature );
|
591 |
+
$map_feature = str_replace( '-', '_', $map_feature );
|
592 |
+
array_push( $styles, array(
|
593 |
+
'featureType' => $map_feature,
|
594 |
+
'elementType' => $element_type,
|
595 |
+
'stylers' => $stylers
|
596 |
+
) );
|
597 |
+
}
|
598 |
+
|
599 |
+
return array( 'map_name' => $map_name, 'styles' => $styles );
|
600 |
+
}
|
601 |
+
case 'raw_json':
|
602 |
+
if ( empty( $style_config['raw_json_map_styles'] ) ) {
|
603 |
+
return array();
|
604 |
+
} else {
|
605 |
+
$map_name = ! empty( $style_config['styled_map_name'] ) ? $style_config['styled_map_name'] : __( 'Custom Map', 'so-widgets-bundle' );
|
606 |
+
$styles_string = $style_config['raw_json_map_styles'];
|
607 |
+
|
608 |
+
return array( 'map_name' => $map_name, 'styles' => json_decode( $styles_string, true ) );
|
609 |
+
}
|
610 |
+
case 'normal':
|
611 |
+
default:
|
612 |
+
return array();
|
613 |
+
}
|
614 |
+
}
|
615 |
+
|
616 |
+
private function get_static_image_src( $instance, $width, $height, $styles ) {
|
617 |
+
$src_url = "https://maps.googleapis.com/maps/api/staticmap?";
|
618 |
+
$src_url .= "center=" . $instance['map_center'];
|
619 |
+
$src_url .= "&zoom=" . $instance['settings']['zoom'];
|
620 |
+
$src_url .= "&size=" . $width . "x" . $height;
|
621 |
+
|
622 |
+
if ( ! empty( $instance['api_key_section']['api_key'] ) ) {
|
623 |
+
$src_url .= "&key=" . $instance['api_key_section']['api_key'];
|
624 |
+
}
|
625 |
+
|
626 |
+
if ( ! empty( $styles ) ) {
|
627 |
+
foreach ( $styles as $st ) {
|
628 |
+
if ( empty( $st ) || ! isset( $st['stylers'] ) || empty( $st['stylers'] ) ) {
|
629 |
+
continue;
|
630 |
+
}
|
631 |
+
$st_string = '';
|
632 |
+
if ( isset ( $st['featureType'] ) ) {
|
633 |
+
$st_string .= 'feature:' . $st['featureType'];
|
634 |
+
}
|
635 |
+
if ( isset ( $st['elementType'] ) ) {
|
636 |
+
if ( ! empty( $st_string ) ) {
|
637 |
+
$st_string .= "|";
|
638 |
+
}
|
639 |
+
$st_string .= 'element:' . $st['elementType'];
|
640 |
+
}
|
641 |
+
foreach ( $st['stylers'] as $style_prop_arr ) {
|
642 |
+
foreach ( $style_prop_arr as $prop_name => $prop_val ) {
|
643 |
+
if ( ! empty( $st_string ) ) {
|
644 |
+
$st_string .= "|";
|
645 |
+
}
|
646 |
+
if ( $prop_val[0] == "#" ) {
|
647 |
+
$prop_val = "0x" . substr( $prop_val, 1 );
|
648 |
+
}
|
649 |
+
if ( is_bool( $prop_val ) ) {
|
650 |
+
$prop_val = $prop_val ? 'true' : 'false';
|
651 |
+
}
|
652 |
+
$st_string .= $prop_name . ":" . $prop_val;
|
653 |
+
}
|
654 |
+
}
|
655 |
+
$st_string = '&style=' . $st_string;
|
656 |
+
$src_url .= $st_string;
|
657 |
+
}
|
658 |
+
}
|
659 |
+
|
660 |
+
if ( ! empty( $instance['markers'] ) ) {
|
661 |
+
$markers = $instance['markers'];
|
662 |
+
$markers_st = '';
|
663 |
+
|
664 |
+
if ( ! empty( $markers['marker_icon'] ) ) {
|
665 |
+
$mrkr_src = wp_get_attachment_image_src( $markers['marker_icon'] );
|
666 |
+
if ( ! empty( $mrkr_src ) ) {
|
667 |
+
$markers_st .= 'icon:' . $mrkr_src[0];
|
668 |
+
}
|
669 |
+
}
|
670 |
+
|
671 |
+
if ( !empty( $markers['marker_at_center'] ) ) {
|
672 |
+
if ( ! empty( $markers_st ) ) {
|
673 |
+
$markers_st .= "|";
|
674 |
+
}
|
675 |
+
$markers_st .= $instance['map_center'];
|
676 |
+
}
|
677 |
+
|
678 |
+
if ( ! empty( $markers['marker_positions'] ) ) {
|
679 |
+
foreach ( $markers['marker_positions'] as $marker ) {
|
680 |
+
if ( ! empty( $markers_st ) ) {
|
681 |
+
$markers_st .= "|";
|
682 |
+
}
|
683 |
+
$markers_st .= urlencode( $marker['place'] );
|
684 |
+
}
|
685 |
+
}
|
686 |
+
$markers_st = '&markers=' . $markers_st;
|
687 |
+
$src_url .= $markers_st;
|
688 |
+
}
|
689 |
+
|
690 |
+
return $src_url;
|
691 |
+
}
|
692 |
+
}
|
693 |
+
|
694 |
+
siteorigin_widget_register( 'sow-google-map', __FILE__, 'SiteOrigin_Widget_GoogleMap_Widget' );
|
widgets/hero/hero.php
CHANGED
@@ -1,447 +1,447 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Widget Name: Hero Image
|
4 |
-
Description: A big hero image with a few settings to make it your own.
|
5 |
-
Author: SiteOrigin
|
6 |
-
Author URI: https://siteorigin.com
|
7 |
-
*/
|
8 |
-
|
9 |
-
if( !class_exists( 'SiteOrigin_Widget_Base_Slider' ) ) include_once plugin_dir_path(SOW_BUNDLE_BASE_FILE) . '/base/inc/widgets/base-slider.class.php';
|
10 |
-
|
11 |
-
class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
12 |
-
|
13 |
-
protected $buttons = array();
|
14 |
-
|
15 |
-
function __construct() {
|
16 |
-
parent::__construct(
|
17 |
-
'sow-hero',
|
18 |
-
__('SiteOrigin Hero', 'so-widgets-bundle'),
|
19 |
-
array(
|
20 |
-
'description' => __('A big hero image with a few settings to make it your own.', 'so-widgets-bundle'),
|
21 |
-
'help' => 'https://siteorigin.com/widgets-bundle/hero-image-widget/',
|
22 |
-
'panels_title' => false,
|
23 |
-
),
|
24 |
-
array( ),
|
25 |
-
false,
|
26 |
-
plugin_dir_path(__FILE__)
|
27 |
-
);
|
28 |
-
}
|
29 |
-
|
30 |
-
function initialize(){
|
31 |
-
// This widget requires the button widget
|
32 |
-
if( !class_exists('SiteOrigin_Widget_Button_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 |
-
add_filter( 'siteorigin_widgets_wrapper_data_' . $this->id_base, array( $this, 'wrapper_data_filter' ), 10, 2 );
|
38 |
-
|
39 |
-
// Let the slider base class do its initialization
|
40 |
-
parent::initialize();
|
41 |
-
}
|
42 |
-
|
43 |
-
function get_widget_form(){
|
44 |
-
return array(
|
45 |
-
'frames' => array(
|
46 |
-
'type' => 'repeater',
|
47 |
-
'label' => __('Hero frames', 'so-widgets-bundle'),
|
48 |
-
'item_name' => __('Frame', 'so-widgets-bundle'),
|
49 |
-
'item_label' => array(
|
50 |
-
'selector' => "[id*='frames-title']",
|
51 |
-
'update_event' => 'change',
|
52 |
-
'value_method' => 'val'
|
53 |
-
),
|
54 |
-
|
55 |
-
'fields' => array(
|
56 |
-
|
57 |
-
'content' => array(
|
58 |
-
'type' => 'tinymce',
|
59 |
-
'label' => __( 'Content', 'so-widgets-bundle' ),
|
60 |
-
),
|
61 |
-
|
62 |
-
'buttons' => array(
|
63 |
-
'type' => 'repeater',
|
64 |
-
'label' => __('Buttons', 'so-widgets-bundle'),
|
65 |
-
'item_name' => __('Button', 'so-widgets-bundle'),
|
66 |
-
'description' => __('Add [buttons] shortcode to the content to insert these buttons.', 'so-widgets-bundle'),
|
67 |
-
|
68 |
-
'item_label' => array(
|
69 |
-
'selector' => "[id*='buttons-button-text']",
|
70 |
-
'update_event' => 'change',
|
71 |
-
'value_method' => 'val'
|
72 |
-
),
|
73 |
-
'fields' => array(
|
74 |
-
'button' => array(
|
75 |
-
'type' => 'widget',
|
76 |
-
'class' => 'SiteOrigin_Widget_Button_Widget',
|
77 |
-
'label' => __('Button', 'so-widgets-bundle'),
|
78 |
-
'collapsible' => false,
|
79 |
-
)
|
80 |
-
)
|
81 |
-
),
|
82 |
-
|
83 |
-
'background' => array(
|
84 |
-
'type' => 'section',
|
85 |
-
'label' => __('Background', 'so-widgets-bundle'),
|
86 |
-
'fields' => array(
|
87 |
-
'image' => array(
|
88 |
-
'type' => 'media',
|
89 |
-
'label' => __( 'Background image', 'so-widgets-bundle' ),
|
90 |
-
'library' => 'image',
|
91 |
-
'fallback' => true,
|
92 |
-
),
|
93 |
-
|
94 |
-
'size' => array(
|
95 |
-
'type' => 'image-size',
|
96 |
-
'label' => __('Image size', 'so-widgets-bundle'),
|
97 |
-
),
|
98 |
-
|
99 |
-
'image_type' => array(
|
100 |
-
'type' => 'select',
|
101 |
-
'label' => __('Background image type', 'so-widgets-bundle'),
|
102 |
-
'options' => array(
|
103 |
-
'cover' => __('Cover', 'so-widgets-bundle'),
|
104 |
-
),
|
105 |
-
'default' => 'cover',
|
106 |
-
),
|
107 |
-
|
108 |
-
'opacity' => array(
|
109 |
-
'label' => __( 'Background image opacity', 'so-widgets-bundle' ),
|
110 |
-
'type' => 'slider',
|
111 |
-
'min' => 0,
|
112 |
-
'max' => 100,
|
113 |
-
'default' => 100,
|
114 |
-
),
|
115 |
-
|
116 |
-
'color' => array(
|
117 |
-
'type' => 'color',
|
118 |
-
'label' => __( 'Background color', 'so-widgets-bundle' ),
|
119 |
-
'default' => '#333333',
|
120 |
-
),
|
121 |
-
|
122 |
-
'url' => array(
|
123 |
-
'type' => 'link',
|
124 |
-
'label' => __( 'Destination URL', 'so-widgets-bundle' ),
|
125 |
-
),
|
126 |
-
|
127 |
-
'new_window' => array(
|
128 |
-
'type' => 'checkbox',
|
129 |
-
'label' => __( 'Open URL in a new window', 'so-widgets-bundle' ),
|
130 |
-
),
|
131 |
-
|
132 |
-
'videos' => array(
|
133 |
-
'type' => 'repeater',
|
134 |
-
'item_name' => __('Video', 'so-widgets-bundle'),
|
135 |
-
'label' => __('Background videos', 'so-widgets-bundle'),
|
136 |
-
'item_label' => array(
|
137 |
-
'selector' => "[id*='frames-background_videos-url']",
|
138 |
-
'update_event' => 'change',
|
139 |
-
'value_method' => 'val'
|
140 |
-
),
|
141 |
-
'fields' => $this->video_form_fields(),
|
142 |
-
),
|
143 |
-
)
|
144 |
-
),
|
145 |
-
),
|
146 |
-
),
|
147 |
-
|
148 |
-
'controls' => array(
|
149 |
-
'type' => 'section',
|
150 |
-
'label' => __('Slider Controls', 'so-widgets-bundle'),
|
151 |
-
'fields' => $this->control_form_fields()
|
152 |
-
),
|
153 |
-
|
154 |
-
'design' => array(
|
155 |
-
'type' => 'section',
|
156 |
-
'label' => __('Design and Layout', 'so-widgets-bundle'),
|
157 |
-
'fields' => array(
|
158 |
-
|
159 |
-
'height' => array(
|
160 |
-
'type' => 'measurement',
|
161 |
-
'label' => __( 'Height', 'so-widgets-bundle' ),
|
162 |
-
'default' => 'default',
|
163 |
-
),
|
164 |
-
|
165 |
-
'padding' => array(
|
166 |
-
'type' => 'measurement',
|
167 |
-
'label' => __('Top and bottom padding', 'so-widgets-bundle'),
|
168 |
-
'default' => '50px',
|
169 |
-
),
|
170 |
-
|
171 |
-
'extra_top_padding' => array(
|
172 |
-
'type' => 'measurement',
|
173 |
-
'label' => __('Extra top padding', 'so-widgets-bundle'),
|
174 |
-
'description' => __('Additional padding added to the top of the slider', 'so-widgets-bundle'),
|
175 |
-
'default' => '0px',
|
176 |
-
),
|
177 |
-
|
178 |
-
'padding_sides' => array(
|
179 |
-
'type' => 'measurement',
|
180 |
-
'label' => __('Side padding', 'so-widgets-bundle'),
|
181 |
-
'default' => '20px',
|
182 |
-
),
|
183 |
-
|
184 |
-
'width' => array(
|
185 |
-
'type' => 'measurement',
|
186 |
-
'label' => __('Maximum container width', 'so-widgets-bundle'),
|
187 |
-
'default' => '1280px',
|
188 |
-
),
|
189 |
-
|
190 |
-
'heading_font' => array(
|
191 |
-
'type' => 'font',
|
192 |
-
'label' => __('Heading font', 'so-widgets-bundle'),
|
193 |
-
'default' => '',
|
194 |
-
),
|
195 |
-
|
196 |
-
'heading_color' => array(
|
197 |
-
'type' => 'color',
|
198 |
-
'label' => __('Heading color', 'so-widgets-bundle'),
|
199 |
-
'default' => '#FFFFFF',
|
200 |
-
),
|
201 |
-
|
202 |
-
'heading_size' => array(
|
203 |
-
'type' => 'measurement',
|
204 |
-
'label' => __('Heading size', 'so-widgets-bundle'),
|
205 |
-
'default' => '38px',
|
206 |
-
),
|
207 |
-
|
208 |
-
'fittext' => array(
|
209 |
-
'type' => 'checkbox',
|
210 |
-
'label' => __( 'Use FitText', 'so-widgets-bundle' ),
|
211 |
-
'description' => __( 'Dynamically adjust your heading font size based on screen size.', 'so-widgets-bundle' ),
|
212 |
-
'default' => true,
|
213 |
-
'state_emitter' => array(
|
214 |
-
'callback' => 'conditional',
|
215 |
-
'args' => array(
|
216 |
-
'use_fittext[show]: val',
|
217 |
-
'use_fittext[hide]: ! val'
|
218 |
-
),
|
219 |
-
),
|
220 |
-
),
|
221 |
-
|
222 |
-
'fittext_compressor' => array(
|
223 |
-
'type' => 'number',
|
224 |
-
'label' => __( 'FitText Compressor Strength', 'so-widgets-bundle' ),
|
225 |
-
'description' => __( 'How aggressively FitText should resize your heading.', 'so-widgets-bundle' ),
|
226 |
-
'default' => 0.85,
|
227 |
-
'state_handler' => array(
|
228 |
-
'use_fittext[show]' => array( 'show' ),
|
229 |
-
'use_fittext[hide]' => array( 'hide' ),
|
230 |
-
)
|
231 |
-
),
|
232 |
-
|
233 |
-
'heading_shadow' => array(
|
234 |
-
'type' => 'slider',
|
235 |
-
'label' => __( 'Heading shadow intensity', 'so-widgets-bundle' ),
|
236 |
-
'max' => 100,
|
237 |
-
'min' => 0,
|
238 |
-
'default' => 50,
|
239 |
-
),
|
240 |
-
|
241 |
-
'text_color' => array(
|
242 |
-
'type' => 'color',
|
243 |
-
'label' => __( 'Text color', 'so-widgets-bundle' ),
|
244 |
-
'default' => '#F6F6F6',
|
245 |
-
),
|
246 |
-
'text_size' => array(
|
247 |
-
'type' => 'measurement',
|
248 |
-
'label' => __( 'Text size', 'so-widgets-bundle' ),
|
249 |
-
'default' => '16px',
|
250 |
-
),
|
251 |
-
'text_font' => array(
|
252 |
-
'type' => 'font',
|
253 |
-
'label' => __( 'Text font', 'so-widgets-bundle' ),
|
254 |
-
'default' => '',
|
255 |
-
),
|
256 |
-
'text_shadow' => array(
|
257 |
-
'type' => 'slider',
|
258 |
-
'label' => __( 'Text shadow intensity', 'so-widgets-bundle' ),
|
259 |
-
'max' => 1,
|
260 |
-
'min' => 0,
|
261 |
-
'step' => 0.01,
|
262 |
-
'default' => 0.25,
|
263 |
-
),
|
264 |
-
|
265 |
-
'link_color' => array(
|
266 |
-
'type' => 'color',
|
267 |
-
'label' => __( 'Link color', 'so-widgets-bundle' )
|
268 |
-
),
|
269 |
-
|
270 |
-
'link_color_hover' => array(
|
271 |
-
'type' => 'color',
|
272 |
-
'label' => __( 'Link Hover Color', 'so-widgets-bundle' )
|
273 |
-
),
|
274 |
-
|
275 |
-
)
|
276 |
-
),
|
277 |
-
);
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Get everything necessary for the background image.
|
282 |
-
*
|
283 |
-
* @param $i
|
284 |
-
* @param $frame
|
285 |
-
*
|
286 |
-
* @return array
|
287 |
-
*/
|
288 |
-
function get_frame_background( $i, $frame ){
|
289 |
-
$background_image = siteorigin_widgets_get_attachment_image_src(
|
290 |
-
$frame['background']['image'],
|
291 |
-
!empty( $frame['background']['size'] ) ? $frame['background']['size'] : 'full',
|
292 |
-
!empty( $frame['background']['image_fallback'] ) ? $frame['background']['image_fallback'] : ''
|
293 |
-
);
|
294 |
-
|
295 |
-
return array(
|
296 |
-
'color' => !empty( $frame['background']['color'] ) ? $frame['background']['color'] : false,
|
297 |
-
'image' => !empty( $background_image[0] ) ? $background_image[0] : false,
|
298 |
-
'image-width' => !empty( $background_image[1] ) ? $background_image[1] : 0,
|
299 |
-
'image-height' => !empty( $background_image[2] ) ? $background_image[2] : 0,
|
300 |
-
'image-sizing' => $frame['background']['image_type'],
|
301 |
-
'url' => !empty( $frame['background']['url'] ) ? $frame['background']['url'] : false,
|
302 |
-
'new_window' => !empty( $frame['background']['new_window'] ),
|
303 |
-
'videos' => $frame['background']['videos'],
|
304 |
-
'video-sizing' => 'background',
|
305 |
-
'opacity' => intval($frame['background']['opacity'])/100,
|
306 |
-
);
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Render the actual content of the frame
|
311 |
-
*
|
312 |
-
* @param $i
|
313 |
-
* @param $frame
|
314 |
-
*/
|
315 |
-
function render_frame_contents($i, $frame) {
|
316 |
-
?>
|
317 |
-
<div class="sow-slider-image-container">
|
318 |
-
<div class="sow-slider-image-wrapper">
|
319 |
-
<?php echo $this->process_content( $frame['content'], $frame ); ?>
|
320 |
-
</div>
|
321 |
-
</div>
|
322 |
-
<?php
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Process the content. Most importantly add the buttons by replacing [buttons] in the content
|
327 |
-
*
|
328 |
-
* @param $content
|
329 |
-
* @param $frame
|
330 |
-
*
|
331 |
-
* @return string
|
332 |
-
*/
|
333 |
-
function process_content( $content, $frame ) {
|
334 |
-
ob_start();
|
335 |
-
foreach( $frame['buttons'] as $button ) {
|
336 |
-
$this->sub_widget('SiteOrigin_Widget_Button_Widget', array(), $button['button']);
|
337 |
-
}
|
338 |
-
$button_code = ob_get_clean();
|
339 |
-
|
340 |
-
// Add in the button code
|
341 |
-
$san_content = wp_kses_post($content);
|
342 |
-
$content = preg_replace('/(?:<(?:p|h\d|em|strong|li|blockquote) *([^>]*)> *)?\[ *buttons *\](:? *<\/(?:p|h\d|em|strong|li|blockquote)>)?/i', '<div class="sow-hero-buttons" $1>' . $button_code . '</div>', $san_content );
|
343 |
-
|
344 |
-
// Process normal shortcodes
|
345 |
-
$content = do_shortcode( shortcode_unautop( $content ) );
|
346 |
-
return $content;
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* The less variables to control the design of the slider
|
351 |
-
*
|
352 |
-
* @param $instance
|
353 |
-
*
|
354 |
-
* @return array
|
355 |
-
*/
|
356 |
-
function get_less_variables($instance) {
|
357 |
-
$less = array();
|
358 |
-
|
359 |
-
// Slider navigation controls
|
360 |
-
$less['nav_color_hex'] = $instance['controls']['nav_color_hex'];
|
361 |
-
$less['nav_size'] = $instance['controls']['nav_size'];
|
362 |
-
|
363 |
-
// Hero specific design
|
364 |
-
// Measurement field type options
|
365 |
-
$meas_options = array();
|
366 |
-
$meas_options['slide_padding'] = $instance['design']['padding'];
|
367 |
-
$meas_options['slide_padding_extra_top'] = $instance['design']['extra_top_padding'];
|
368 |
-
$meas_options['slide_padding_sides'] = $instance['design']['padding_sides'];
|
369 |
-
$meas_options['slide_width'] = $instance['design']['width'];
|
370 |
-
$meas_options['slide_height'] = $instance['design']['height'];
|
371 |
-
|
372 |
-
$meas_options['heading_size'] = $instance['design']['heading_size'];
|
373 |
-
$meas_options['text_size'] = $instance['design']['text_size'];
|
374 |
-
|
375 |
-
foreach ( $meas_options as $key => $val ) {
|
376 |
-
$less[ $key ] = $this->add_default_measurement_unit( $val );
|
377 |
-
}
|
378 |
-
|
379 |
-
$less['heading_shadow'] = intval( $instance['design']['heading_shadow'] );
|
380 |
-
$less['heading_color'] = $instance['design']['heading_color'];
|
381 |
-
$less['text_shadow'] = isset( $instance['design']['text_shadow'] ) ? floatval( $instance['design']['text_shadow'] ) : 0.25;
|
382 |
-
$less['text_color'] = $instance['design']['text_color'];
|
383 |
-
|
384 |
-
|
385 |
-
$less['link_color'] = ! empty( $instance['design']['link_color'] ) ? $instance['design']['link_color'] : '';
|
386 |
-
$less['link_color_hover'] = ! empty( $instance['design']['link_color_hover'] ) ? $instance['design']['link_color_hover'] : '';
|
387 |
-
|
388 |
-
|
389 |
-
$heading_font = siteorigin_widget_get_font( $instance['design']['heading_font'] );
|
390 |
-
$less['heading_font'] = $heading_font['family'];
|
391 |
-
if ( ! empty( $heading_font['weight'] ) ) {
|
392 |
-
$less['heading_font_weight'] = $heading_font['weight'];
|
393 |
-
}
|
394 |
-
|
395 |
-
if ( ! empty( $instance['design']['text_font'] ) ) {
|
396 |
-
$text_font = siteorigin_widget_get_font( $instance['design']['text_font'] );
|
397 |
-
$less['text_font'] = $text_font['family'];
|
398 |
-
if ( ! empty( $text_font['weight'] ) ) {
|
399 |
-
$less['text_font_weight'] = $text_font['weight'];
|
400 |
-
}
|
401 |
-
}
|
402 |
-
|
403 |
-
return $less;
|
404 |
-
}
|
405 |
-
|
406 |
-
function add_default_measurement_unit($val) {
|
407 |
-
if (!empty($val)) {
|
408 |
-
if (!preg_match('/\d+([a-zA-Z%]+)/', $val)) {
|
409 |
-
$val .= 'px';
|
410 |
-
}
|
411 |
-
}
|
412 |
-
return $val;
|
413 |
-
}
|
414 |
-
|
415 |
-
/**
|
416 |
-
* Less function for importing Google web fonts.
|
417 |
-
*
|
418 |
-
* @param $instance
|
419 |
-
* @param $args
|
420 |
-
*
|
421 |
-
* @return string
|
422 |
-
*/
|
423 |
-
function get_google_font_fields( $instance ) {
|
424 |
-
return array(
|
425 |
-
$instance['design']['heading_font'],
|
426 |
-
! empty( $instance['design']['text_font'] ) ? $instance['design']['text_font'] : '',
|
427 |
-
);
|
428 |
-
}
|
429 |
-
|
430 |
-
function wrapper_class_filter( $classes, $instance ){
|
431 |
-
if( ! empty( $instance['design']['fittext'] ) ) {
|
432 |
-
$classes[] = 'so-widget-fittext-wrapper';
|
433 |
-
wp_enqueue_script( 'sow-fittext' );
|
434 |
-
}
|
435 |
-
return $classes;
|
436 |
-
}
|
437 |
-
|
438 |
-
function wrapper_data_filter( $data, $instance ) {
|
439 |
-
if( ! empty( $instance['design']['fittext'] ) && ! empty( $instance['design']['fittext_compressor'] ) ) {
|
440 |
-
$data['fit-text-compressor'] = $instance['design']['fittext_compressor'];
|
441 |
-
}
|
442 |
-
return $data;
|
443 |
-
}
|
444 |
-
|
445 |
-
}
|
446 |
-
|
447 |
-
siteorigin_widget_register('sow-hero', __FILE__, 'SiteOrigin_Widget_Hero_Widget');
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Widget Name: Hero Image
|
4 |
+
Description: A big hero image with a few settings to make it your own.
|
5 |
+
Author: SiteOrigin
|
6 |
+
Author URI: https://siteorigin.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
if( !class_exists( 'SiteOrigin_Widget_Base_Slider' ) ) include_once plugin_dir_path(SOW_BUNDLE_BASE_FILE) . '/base/inc/widgets/base-slider.class.php';
|
10 |
+
|
11 |
+
class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
12 |
+
|
13 |
+
protected $buttons = array();
|
14 |
+
|
15 |
+
function __construct() {
|
16 |
+
parent::__construct(
|
17 |
+
'sow-hero',
|
18 |
+
__('SiteOrigin Hero', 'so-widgets-bundle'),
|
19 |
+
array(
|
20 |
+
'description' => __('A big hero image with a few settings to make it your own.', 'so-widgets-bundle'),
|
21 |
+
'help' => 'https://siteorigin.com/widgets-bundle/hero-image-widget/',
|
22 |
+
'panels_title' => false,
|
23 |
+
),
|
24 |
+
array( ),
|
25 |
+
false,
|
26 |
+
plugin_dir_path(__FILE__)
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
function initialize(){
|
31 |
+
// This widget requires the button widget
|
32 |
+
if( !class_exists('SiteOrigin_Widget_Button_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 |
+
add_filter( 'siteorigin_widgets_wrapper_data_' . $this->id_base, array( $this, 'wrapper_data_filter' ), 10, 2 );
|
38 |
+
|
39 |
+
// Let the slider base class do its initialization
|
40 |
+
parent::initialize();
|
41 |
+
}
|
42 |
+
|
43 |
+
function get_widget_form(){
|
44 |
+
return array(
|
45 |
+
'frames' => array(
|
46 |
+
'type' => 'repeater',
|
47 |
+
'label' => __('Hero frames', 'so-widgets-bundle'),
|
48 |
+
'item_name' => __('Frame', 'so-widgets-bundle'),
|
49 |
+
'item_label' => array(
|
50 |
+
'selector' => "[id*='frames-title']",
|
51 |
+
'update_event' => 'change',
|
52 |
+
'value_method' => 'val'
|
53 |
+
),
|
54 |
+
|
55 |
+
'fields' => array(
|
56 |
+
|
57 |
+
'content' => array(
|
58 |
+
'type' => 'tinymce',
|
59 |
+
'label' => __( 'Content', 'so-widgets-bundle' ),
|
60 |
+
),
|
61 |
+
|
62 |
+
'buttons' => array(
|
63 |
+
'type' => 'repeater',
|
64 |
+
'label' => __('Buttons', 'so-widgets-bundle'),
|
65 |
+
'item_name' => __('Button', 'so-widgets-bundle'),
|
66 |
+
'description' => __('Add [buttons] shortcode to the content to insert these buttons.', 'so-widgets-bundle'),
|
67 |
+
|
68 |
+
'item_label' => array(
|
69 |
+
'selector' => "[id*='buttons-button-text']",
|
70 |
+
'update_event' => 'change',
|
71 |
+
'value_method' => 'val'
|
72 |
+
),
|
73 |
+
'fields' => array(
|
74 |
+
'button' => array(
|
75 |
+
'type' => 'widget',
|
76 |
+
'class' => 'SiteOrigin_Widget_Button_Widget',
|
77 |
+
'label' => __('Button', 'so-widgets-bundle'),
|
78 |
+
'collapsible' => false,
|
79 |
+
)
|
80 |
+
)
|
81 |
+
),
|
82 |
+
|
83 |
+
'background' => array(
|
84 |
+
'type' => 'section',
|
85 |
+
'label' => __('Background', 'so-widgets-bundle'),
|
86 |
+
'fields' => array(
|
87 |
+
'image' => array(
|
88 |
+
'type' => 'media',
|
89 |
+
'label' => __( 'Background image', 'so-widgets-bundle' ),
|
90 |
+
'library' => 'image',
|
91 |
+
'fallback' => true,
|
92 |
+
),
|
93 |
+
|
94 |
+
'size' => array(
|
95 |
+
'type' => 'image-size',
|
96 |
+
'label' => __('Image size', 'so-widgets-bundle'),
|
97 |
+
),
|
98 |
+
|
99 |
+
'image_type' => array(
|
100 |
+
'type' => 'select',
|
101 |
+
'label' => __('Background image type', 'so-widgets-bundle'),
|
102 |
+
'options' => array(
|
103 |
+
'cover' => __('Cover', 'so-widgets-bundle'),
|
104 |
+
),
|
105 |
+
'default' => 'cover',
|
106 |
+
),
|
107 |
+
|
108 |
+
'opacity' => array(
|
109 |
+
'label' => __( 'Background image opacity', 'so-widgets-bundle' ),
|
110 |
+
'type' => 'slider',
|
111 |
+
'min' => 0,
|
112 |
+
'max' => 100,
|
113 |
+
'default' => 100,
|
114 |
+
),
|
115 |
+
|
116 |
+
'color' => array(
|
117 |
+
'type' => 'color',
|
118 |
+
'label' => __( 'Background color', 'so-widgets-bundle' ),
|
119 |
+
'default' => '#333333',
|
120 |
+
),
|
121 |
+
|
122 |
+
'url' => array(
|
123 |
+
'type' => 'link',
|
124 |
+
'label' => __( 'Destination URL', 'so-widgets-bundle' ),
|
125 |
+
),
|
126 |
+
|
127 |
+
'new_window' => array(
|
128 |
+
'type' => 'checkbox',
|
129 |
+
'label' => __( 'Open URL in a new window', 'so-widgets-bundle' ),
|
130 |
+
),
|
131 |
+
|
132 |
+
'videos' => array(
|
133 |
+
'type' => 'repeater',
|
134 |
+
'item_name' => __('Video', 'so-widgets-bundle'),
|
135 |
+
'label' => __('Background videos', 'so-widgets-bundle'),
|
136 |
+
'item_label' => array(
|
137 |
+
'selector' => "[id*='frames-background_videos-url']",
|
138 |
+
'update_event' => 'change',
|
139 |
+
'value_method' => 'val'
|
140 |
+
),
|
141 |
+
'fields' => $this->video_form_fields(),
|
142 |
+
),
|
143 |
+
)
|
144 |
+
),
|
145 |
+
),
|
146 |
+
),
|
147 |
+
|
148 |
+
'controls' => array(
|
149 |
+
'type' => 'section',
|
150 |
+
'label' => __('Slider Controls', 'so-widgets-bundle'),
|
151 |
+
'fields' => $this->control_form_fields()
|
152 |
+
),
|
153 |
+
|
154 |
+
'design' => array(
|
155 |
+
'type' => 'section',
|
156 |
+
'label' => __('Design and Layout', 'so-widgets-bundle'),
|
157 |
+
'fields' => array(
|
158 |
+
|
159 |
+
'height' => array(
|
160 |
+
'type' => 'measurement',
|
161 |
+
'label' => __( 'Height', 'so-widgets-bundle' ),
|
162 |
+
'default' => 'default',
|
163 |
+
),
|
164 |
+
|
165 |
+
'padding' => array(
|
166 |
+
'type' => 'measurement',
|
167 |
+
'label' => __('Top and bottom padding', 'so-widgets-bundle'),
|
168 |
+
'default' => '50px',
|
169 |
+
),
|
170 |
+
|
171 |
+
'extra_top_padding' => array(
|
172 |
+
'type' => 'measurement',
|
173 |
+
'label' => __('Extra top padding', 'so-widgets-bundle'),
|
174 |
+
'description' => __('Additional padding added to the top of the slider', 'so-widgets-bundle'),
|
175 |
+
'default' => '0px',
|
176 |
+
),
|
177 |
+
|
178 |
+
'padding_sides' => array(
|
179 |
+
'type' => 'measurement',
|
180 |
+
'label' => __('Side padding', 'so-widgets-bundle'),
|
181 |
+
'default' => '20px',
|
182 |
+
),
|
183 |
+
|
184 |
+
'width' => array(
|
185 |
+
'type' => 'measurement',
|
186 |
+
'label' => __('Maximum container width', 'so-widgets-bundle'),
|
187 |
+
'default' => '1280px',
|
188 |
+
),
|
189 |
+
|
190 |
+
'heading_font' => array(
|
191 |
+
'type' => 'font',
|
192 |
+
'label' => __('Heading font', 'so-widgets-bundle'),
|
193 |
+
'default' => '',
|
194 |
+
),
|
195 |
+
|
196 |
+
'heading_color' => array(
|
197 |
+
'type' => 'color',
|
198 |
+
'label' => __('Heading color', 'so-widgets-bundle'),
|
199 |
+
'default' => '#FFFFFF',
|
200 |
+
),
|
201 |
+
|
202 |
+
'heading_size' => array(
|
203 |
+
'type' => 'measurement',
|
204 |
+
'label' => __('Heading size', 'so-widgets-bundle'),
|
205 |
+
'default' => '38px',
|
206 |
+
),
|
207 |
+
|
208 |
+
'fittext' => array(
|
209 |
+
'type' => 'checkbox',
|
210 |
+
'label' => __( 'Use FitText', 'so-widgets-bundle' ),
|
211 |
+
'description' => __( 'Dynamically adjust your heading font size based on screen size.', 'so-widgets-bundle' ),
|
212 |
+
'default' => true,
|
213 |
+
'state_emitter' => array(
|
214 |
+
'callback' => 'conditional',
|
215 |
+
'args' => array(
|
216 |
+
'use_fittext[show]: val',
|
217 |
+
'use_fittext[hide]: ! val'
|
218 |
+
),
|
219 |
+
),
|
220 |
+
),
|
221 |
+
|
222 |
+
'fittext_compressor' => array(
|
223 |
+
'type' => 'number',
|
224 |
+
'label' => __( 'FitText Compressor Strength', 'so-widgets-bundle' ),
|
225 |
+
'description' => __( 'How aggressively FitText should resize your heading.', 'so-widgets-bundle' ),
|
226 |
+
'default' => 0.85,
|
227 |
+
'state_handler' => array(
|
228 |
+
'use_fittext[show]' => array( 'show' ),
|
229 |
+
'use_fittext[hide]' => array( 'hide' ),
|
230 |
+
)
|
231 |
+
),
|
232 |
+
|
233 |
+
'heading_shadow' => array(
|
234 |
+
'type' => 'slider',
|
235 |
+
'label' => __( 'Heading shadow intensity', 'so-widgets-bundle' ),
|
236 |
+
'max' => 100,
|
237 |
+
'min' => 0,
|
238 |
+
'default' => 50,
|
239 |
+
),
|
240 |
+
|
241 |
+
'text_color' => array(
|
242 |
+
'type' => 'color',
|
243 |
+
'label' => __( 'Text color', 'so-widgets-bundle' ),
|
244 |
+
'default' => '#F6F6F6',
|
245 |
+
),
|
246 |
+
'text_size' => array(
|
247 |
+
'type' => 'measurement',
|
248 |
+
'label' => __( 'Text size', 'so-widgets-bundle' ),
|
249 |
+
'default' => '16px',
|
250 |
+
),
|
251 |
+
'text_font' => array(
|
252 |
+
'type' => 'font',
|
253 |
+
'label' => __( 'Text font', 'so-widgets-bundle' ),
|
254 |
+
'default' => '',
|
255 |
+
),
|
256 |
+
'text_shadow' => array(
|
257 |
+
'type' => 'slider',
|
258 |
+
'label' => __( 'Text shadow intensity', 'so-widgets-bundle' ),
|
259 |
+
'max' => 1,
|
260 |
+
'min' => 0,
|
261 |
+
'step' => 0.01,
|
262 |
+
'default' => 0.25,
|
263 |
+
),
|
264 |
+
|
265 |
+
'link_color' => array(
|
266 |
+
'type' => 'color',
|
267 |
+
'label' => __( 'Link color', 'so-widgets-bundle' )
|
268 |
+
),
|
269 |
+
|
270 |
+
'link_color_hover' => array(
|
271 |
+
'type' => 'color',
|
272 |
+
'label' => __( 'Link Hover Color', 'so-widgets-bundle' )
|
273 |
+
),
|
274 |
+
|
275 |
+
)
|
276 |
+
),
|
277 |
+
);
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Get everything necessary for the background image.
|
282 |
+
*
|
283 |
+
* @param $i
|
284 |
+
* @param $frame
|
285 |
+
*
|
286 |
+
* @return array
|
287 |
+
*/
|
288 |
+
function get_frame_background( $i, $frame ){
|
289 |
+
$background_image = siteorigin_widgets_get_attachment_image_src(
|
290 |
+
$frame['background']['image'],
|
291 |
+
!empty( $frame['background']['size'] ) ? $frame['background']['size'] : 'full',
|
292 |
+
!empty( $frame['background']['image_fallback'] ) ? $frame['background']['image_fallback'] : ''
|
293 |
+
);
|
294 |
+
|
295 |
+
return array(
|
296 |
+
'color' => !empty( $frame['background']['color'] ) ? $frame['background']['color'] : false,
|
297 |
+
'image' => !empty( $background_image[0] ) ? $background_image[0] : false,
|
298 |
+
'image-width' => !empty( $background_image[1] ) ? $background_image[1] : 0,
|
299 |
+
'image-height' => !empty( $background_image[2] ) ? $background_image[2] : 0,
|
300 |
+
'image-sizing' => $frame['background']['image_type'],
|
301 |
+
'url' => !empty( $frame['background']['url'] ) ? $frame['background']['url'] : false,
|
302 |
+
'new_window' => !empty( $frame['background']['new_window'] ),
|
303 |
+
'videos' => $frame['background']['videos'],
|
304 |
+
'video-sizing' => 'background',
|
305 |
+
'opacity' => intval($frame['background']['opacity'])/100,
|
306 |
+
);
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Render the actual content of the frame
|
311 |
+
*
|
312 |
+
* @param $i
|
313 |
+
* @param $frame
|
314 |
+
*/
|
315 |
+
function render_frame_contents($i, $frame) {
|
316 |
+
?>
|
317 |
+
<div class="sow-slider-image-container">
|
318 |
+
<div class="sow-slider-image-wrapper">
|
319 |
+
<?php echo $this->process_content( $frame['content'], $frame ); ?>
|
320 |
+
</div>
|
321 |
+
</div>
|
322 |
+
<?php
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Process the content. Most importantly add the buttons by replacing [buttons] in the content
|
327 |
+
*
|
328 |
+
* @param $content
|
329 |
+
* @param $frame
|
330 |
+
*
|
331 |
+
* @return string
|
332 |
+
*/
|
333 |
+
function process_content( $content, $frame ) {
|
334 |
+
ob_start();
|
335 |
+
foreach( $frame['buttons'] as $button ) {
|
336 |
+
$this->sub_widget('SiteOrigin_Widget_Button_Widget', array(), $button['button']);
|
337 |
+
}
|
338 |
+
$button_code = ob_get_clean();
|
339 |
+
|
340 |
+
// Add in the button code
|
341 |
+
$san_content = wp_kses_post($content);
|
342 |
+
$content = preg_replace('/(?:<(?:p|h\d|em|strong|li|blockquote) *([^>]*)> *)?\[ *buttons *\](:? *<\/(?:p|h\d|em|strong|li|blockquote)>)?/i', '<div class="sow-hero-buttons" $1>' . $button_code . '</div>', $san_content );
|
343 |
+
|
344 |
+
// Process normal shortcodes
|
345 |
+
$content = do_shortcode( shortcode_unautop( $content ) );
|
346 |
+
return $content;
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* The less variables to control the design of the slider
|
351 |
+
*
|
352 |
+
* @param $instance
|
353 |
+
*
|
354 |
+
* @return array
|
355 |
+
*/
|
356 |
+
function get_less_variables($instance) {
|
357 |
+
$less = array();
|
358 |
+
|
359 |
+
// Slider navigation controls
|
360 |
+
$less['nav_color_hex'] = $instance['controls']['nav_color_hex'];
|
361 |
+
$less['nav_size'] = $instance['controls']['nav_size'];
|
362 |
+
|
363 |
+
// Hero specific design
|
364 |
+
// Measurement field type options
|
365 |
+
$meas_options = array();
|
366 |
+
$meas_options['slide_padding'] = $instance['design']['padding'];
|
367 |
+
$meas_options['slide_padding_extra_top'] = $instance['design']['extra_top_padding'];
|
368 |
+
$meas_options['slide_padding_sides'] = $instance['design']['padding_sides'];
|
369 |
+
$meas_options['slide_width'] = $instance['design']['width'];
|
370 |
+
$meas_options['slide_height'] = $instance['design']['height'];
|
371 |
+
|
372 |
+
$meas_options['heading_size'] = $instance['design']['heading_size'];
|
373 |
+
$meas_options['text_size'] = $instance['design']['text_size'];
|
374 |
+
|
375 |
+
foreach ( $meas_options as $key => $val ) {
|
376 |
+
$less[ $key ] = $this->add_default_measurement_unit( $val );
|
377 |
+
}
|
378 |
+
|
379 |
+
$less['heading_shadow'] = intval( $instance['design']['heading_shadow'] );
|
380 |
+
$less['heading_color'] = $instance['design']['heading_color'];
|
381 |
+
$less['text_shadow'] = isset( $instance['design']['text_shadow'] ) ? floatval( $instance['design']['text_shadow'] ) : 0.25;
|
382 |
+
$less['text_color'] = $instance['design']['text_color'];
|
383 |
+
|
384 |
+
|
385 |
+
$less['link_color'] = ! empty( $instance['design']['link_color'] ) ? $instance['design']['link_color'] : '';
|
386 |
+
$less['link_color_hover'] = ! empty( $instance['design']['link_color_hover'] ) ? $instance['design']['link_color_hover'] : '';
|
387 |
+
|
388 |
+
|
389 |
+
$heading_font = siteorigin_widget_get_font( $instance['design']['heading_font'] );
|
390 |
+
$less['heading_font'] = $heading_font['family'];
|
391 |
+
if ( ! empty( $heading_font['weight'] ) ) {
|
392 |
+
$less['heading_font_weight'] = $heading_font['weight'];
|
393 |
+
}
|
394 |
+
|
395 |
+
if ( ! empty( $instance['design']['text_font'] ) ) {
|
396 |
+
$text_font = siteorigin_widget_get_font( $instance['design']['text_font'] );
|
397 |
+
$less['text_font'] = $text_font['family'];
|
398 |
+
if ( ! empty( $text_font['weight'] ) ) {
|
399 |
+
$less['text_font_weight'] = $text_font['weight'];
|
400 |
+
}
|
401 |
+
}
|
402 |
+
|
403 |
+
return $less;
|
404 |
+
}
|
405 |
+
|
406 |
+
function add_default_measurement_unit($val) {
|
407 |
+
if (!empty($val)) {
|
408 |
+
if (!preg_match('/\d+([a-zA-Z%]+)/', $val)) {
|
409 |
+
$val .= 'px';
|
410 |
+
}
|
411 |
+
}
|
412 |
+
return $val;
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Less function for importing Google web fonts.
|
417 |
+
*
|
418 |
+
* @param $instance
|
419 |
+
* @param $args
|
420 |
+
*
|
421 |
+
* @return string
|
422 |
+
*/
|
423 |
+
function get_google_font_fields( $instance ) {
|
424 |
+
return array(
|
425 |
+
$instance['design']['heading_font'],
|
426 |
+
! empty( $instance['design']['text_font'] ) ? $instance['design']['text_font'] : '',
|
427 |
+
);
|
428 |
+
}
|
429 |
+
|
430 |
+
function wrapper_class_filter( $classes, $instance ){
|
431 |
+
if( ! empty( $instance['design']['fittext'] ) ) {
|
432 |
+
$classes[] = 'so-widget-fittext-wrapper';
|
433 |
+
wp_enqueue_script( 'sow-fittext' );
|
434 |
+
}
|
435 |
+
return $classes;
|
436 |
+
}
|
437 |
+
|
438 |
+
function wrapper_data_filter( $data, $instance ) {
|
439 |
+
if( ! empty( $instance['design']['fittext'] ) && ! empty( $instance['design']['fittext_compressor'] ) ) {
|
440 |
+
$data['fit-text-compressor'] = $instance['design']['fittext_compressor'];
|
441 |
+
}
|
442 |
+
return $data;
|
443 |
+
}
|
444 |
+
|
445 |
+
}
|
446 |
+
|
447 |
+
siteorigin_widget_register('sow-hero', __FILE__, 'SiteOrigin_Widget_Hero_Widget');
|
widgets/hero/styles/default.less
CHANGED
@@ -1,119 +1,119 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@nav_color_hex: #FFFFFF;
|
6 |
-
@nav_size: 25;
|
7 |
-
|
8 |
-
@slide_padding: 50px;
|
9 |
-
@slide_padding_extra_top: 0px;
|
10 |
-
@slide_padding_sides: 10px;
|
11 |
-
@slide_width: 1280px;
|
12 |
-
@slide_height: default;
|
13 |
-
@heading_size: 38px;
|
14 |
-
@text_size: 16px;
|
15 |
-
@text_color: #F6F6F6;
|
16 |
-
@text_shadow: 0.25;
|
17 |
-
@text_font: default;
|
18 |
-
@text_font_weight: 500;
|
19 |
-
|
20 |
-
@link_color: default;
|
21 |
-
@link_color_hover: default;
|
22 |
-
|
23 |
-
@heading_font: default;
|
24 |
-
@heading_font_weight: 400;
|
25 |
-
@heading_color: #FFFFFF;
|
26 |
-
@heading_shadow: 50;
|
27 |
-
|
28 |
-
.sow-slider-base {
|
29 |
-
|
30 |
-
ul.sow-slider-images {
|
31 |
-
|
32 |
-
.sow-slider-image-wrapper {
|
33 |
-
padding: @slide_padding+@slide_padding_extra_top @slide_padding_sides @slide_padding @slide_padding_sides;
|
34 |
-
|
35 |
-
max-width: @slide_width;
|
36 |
-
height: @slide_height;
|
37 |
-
|
38 |
-
h1,h2,h3,h4,h5,h6{
|
39 |
-
line-height: 1.375em;
|
40 |
-
color: @heading_color;
|
41 |
-
& when not ( @heading_shadow = 0 ) {
|
42 |
-
text-shadow: 0 2px 2px rgba( 0, 0, 0, @heading_shadow/100 );
|
43 |
-
}
|
44 |
-
margin: 0.1em 0;
|
45 |
-
|
46 |
-
.font(@heading_font, @heading_font_weight);
|
47 |
-
}
|
48 |
-
|
49 |
-
h1 {
|
50 |
-
font-size: @heading_size;
|
51 |
-
}
|
52 |
-
|
53 |
-
h2 {
|
54 |
-
font-size: @heading_size * 0.85;
|
55 |
-
}
|
56 |
-
|
57 |
-
h3 {
|
58 |
-
font-size: @heading_size * 0.7;
|
59 |
-
}
|
60 |
-
|
61 |
-
h4 {
|
62 |
-
font-size: @heading_size * 0.6;
|
63 |
-
}
|
64 |
-
|
65 |
-
h5 {
|
66 |
-
font-size: @heading_size * 0.5;
|
67 |
-
}
|
68 |
-
|
69 |
-
h6 {
|
70 |
-
font-size: @heading_size * 0.4;
|
71 |
-
}
|
72 |
-
|
73 |
-
a {
|
74 |
-
color: @link_color;
|
75 |
-
&:hover {
|
76 |
-
color: @link_color_hover;
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
p {
|
81 |
-
color: @text_color;
|
82 |
-
& when not ( @text_shadow = 0 ) {
|
83 |
-
text-shadow: 0 2px 2px rgba( 0, 0, 0, @text_shadow );
|
84 |
-
}
|
85 |
-
margin: 1em 0;
|
86 |
-
font-size: @text_size;
|
87 |
-
|
88 |
-
.font(@text_font, @text_font_weight);
|
89 |
-
}
|
90 |
-
|
91 |
-
.sow-hero-buttons {
|
92 |
-
margin-top: 3em;
|
93 |
-
padding-bottom: 0.2em;
|
94 |
-
|
95 |
-
.so-widget-sow-button {
|
96 |
-
display: inline-block;
|
97 |
-
margin: 3px 6px 0;
|
98 |
-
}
|
99 |
-
|
100 |
-
}
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
.sow-slider-pagination {
|
105 |
-
li a {
|
106 |
-
background: @nav_color_hex;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
.sow-slide-nav {
|
111 |
-
|
112 |
-
font-size: ~"@{nav_size}px";
|
113 |
-
|
114 |
-
a {
|
115 |
-
color: @nav_color_hex;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@nav_color_hex: #FFFFFF;
|
6 |
+
@nav_size: 25;
|
7 |
+
|
8 |
+
@slide_padding: 50px;
|
9 |
+
@slide_padding_extra_top: 0px;
|
10 |
+
@slide_padding_sides: 10px;
|
11 |
+
@slide_width: 1280px;
|
12 |
+
@slide_height: default;
|
13 |
+
@heading_size: 38px;
|
14 |
+
@text_size: 16px;
|
15 |
+
@text_color: #F6F6F6;
|
16 |
+
@text_shadow: 0.25;
|
17 |
+
@text_font: default;
|
18 |
+
@text_font_weight: 500;
|
19 |
+
|
20 |
+
@link_color: default;
|
21 |
+
@link_color_hover: default;
|
22 |
+
|
23 |
+
@heading_font: default;
|
24 |
+
@heading_font_weight: 400;
|
25 |
+
@heading_color: #FFFFFF;
|
26 |
+
@heading_shadow: 50;
|
27 |
+
|
28 |
+
.sow-slider-base {
|
29 |
+
|
30 |
+
ul.sow-slider-images {
|
31 |
+
|
32 |
+
.sow-slider-image-wrapper {
|
33 |
+
padding: @slide_padding+@slide_padding_extra_top @slide_padding_sides @slide_padding @slide_padding_sides;
|
34 |
+
|
35 |
+
max-width: @slide_width;
|
36 |
+
height: @slide_height;
|
37 |
+
|
38 |
+
h1,h2,h3,h4,h5,h6{
|
39 |
+
line-height: 1.375em;
|
40 |
+
color: @heading_color;
|
41 |
+
& when not ( @heading_shadow = 0 ) {
|
42 |
+
text-shadow: 0 2px 2px rgba( 0, 0, 0, @heading_shadow/100 );
|
43 |
+
}
|
44 |
+
margin: 0.1em 0;
|
45 |
+
|
46 |
+
.font(@heading_font, @heading_font_weight);
|
47 |
+
}
|
48 |
+
|
49 |
+
h1 {
|
50 |
+
font-size: @heading_size;
|
51 |
+
}
|
52 |
+
|
53 |
+
h2 {
|
54 |
+
font-size: @heading_size * 0.85;
|
55 |
+
}
|
56 |
+
|
57 |
+
h3 {
|
58 |
+
font-size: @heading_size * 0.7;
|
59 |
+
}
|
60 |
+
|
61 |
+
h4 {
|
62 |
+
font-size: @heading_size * 0.6;
|
63 |
+
}
|
64 |
+
|
65 |
+
h5 {
|
66 |
+
font-size: @heading_size * 0.5;
|
67 |
+
}
|
68 |
+
|
69 |
+
h6 {
|
70 |
+
font-size: @heading_size * 0.4;
|
71 |
+
}
|
72 |
+
|
73 |
+
a {
|
74 |
+
color: @link_color;
|
75 |
+
&:hover {
|
76 |
+
color: @link_color_hover;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
p {
|
81 |
+
color: @text_color;
|
82 |
+
& when not ( @text_shadow = 0 ) {
|
83 |
+
text-shadow: 0 2px 2px rgba( 0, 0, 0, @text_shadow );
|
84 |
+
}
|
85 |
+
margin: 1em 0;
|
86 |
+
font-size: @text_size;
|
87 |
+
|
88 |
+
.font(@text_font, @text_font_weight);
|
89 |
+
}
|
90 |
+
|
91 |
+
.sow-hero-buttons {
|
92 |
+
margin-top: 3em;
|
93 |
+
padding-bottom: 0.2em;
|
94 |
+
|
95 |
+
.so-widget-sow-button {
|
96 |
+
display: inline-block;
|
97 |
+
margin: 3px 6px 0;
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
.sow-slider-pagination {
|
105 |
+
li a {
|
106 |
+
background: @nav_color_hex;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
.sow-slide-nav {
|
111 |
+
|
112 |
+
font-size: ~"@{nav_size}px";
|
113 |
+
|
114 |
+
a {
|
115 |
+
color: @nav_color_hex;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
widgets/image-grid/css/image-grid.css
CHANGED
@@ -1,11 +1 @@
|
|
1 |
-
.sow-image-grid-wrapper {
|
2 |
-
text-align: center;
|
3 |
-
}
|
4 |
-
.sow-image-grid-wrapper .sow-image-grid-image {
|
5 |
-
display: inline-block;
|
6 |
-
}
|
7 |
-
.sow-image-grid-wrapper .sow-image-grid-image img {
|
8 |
-
display: none;
|
9 |
-
max-width: 100%;
|
10 |
-
height: auto;
|
11 |
-
}
|
1 |
+
.sow-image-grid-wrapper{text-align:center}.sow-image-grid-wrapper .sow-image-grid-image{display:inline-block}.sow-image-grid-wrapper .sow-image-grid-image img{display:none;max-width:100%;height:auto}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/post-carousel/css/style.css
CHANGED
@@ -1,160 +1 @@
|
|
1 |
-
@font-face {
|
2 |
-
font-family: 'carousel-arrows';
|
3 |
-
src: url('fonts/carousel-arrows.eot?-95vnmw');
|
4 |
-
src: url('fonts/carousel-arrows.eot?#iefix-95vnmw') format('embedded-opentype'), url('fonts/carousel-arrows.woff?-95vnmw') format('woff'), url('fonts/carousel-arrows.ttf?-95vnmw') format('truetype'), url('fonts/carousel-arrows.svg?-95vnmw#carousel-arrows') format('svg');
|
5 |
-
font-weight: normal;
|
6 |
-
font-style: normal;
|
7 |
-
}
|
8 |
-
.sow-carousel-title .widget-title {
|
9 |
-
display: inline-block;
|
10 |
-
padding-right: 15px;
|
11 |
-
}
|
12 |
-
.sow-carousel-title a.sow-carousel-next,
|
13 |
-
.sow-carousel-title a.sow-carousel-previous {
|
14 |
-
font-family: 'carousel-arrows';
|
15 |
-
speak: none;
|
16 |
-
display: block;
|
17 |
-
float: right;
|
18 |
-
overflow: hidden;
|
19 |
-
margin-left: 2px;
|
20 |
-
margin-top: 3px;
|
21 |
-
font-style: normal;
|
22 |
-
font-weight: normal;
|
23 |
-
font-variant: normal;
|
24 |
-
text-transform: none;
|
25 |
-
font-size: 8px;
|
26 |
-
line-height: 18px;
|
27 |
-
width: 18px;
|
28 |
-
text-align: center;
|
29 |
-
/* Better Font Rendering =========== */
|
30 |
-
-webkit-font-smoothing: antialiased;
|
31 |
-
-moz-osx-font-smoothing: grayscale;
|
32 |
-
text-decoration: none;
|
33 |
-
color: #FFFFFF;
|
34 |
-
background: #333333;
|
35 |
-
border-radius: 2px;
|
36 |
-
}
|
37 |
-
.sow-carousel-title a.sow-carousel-next:hover,
|
38 |
-
.sow-carousel-title a.sow-carousel-previous:hover {
|
39 |
-
background: #444444;
|
40 |
-
}
|
41 |
-
.sow-carousel-title a.sow-carousel-next:before {
|
42 |
-
content: "\e601";
|
43 |
-
}
|
44 |
-
.sow-carousel-title a.sow-carousel-previous:before {
|
45 |
-
content: "\e600";
|
46 |
-
}
|
47 |
-
@media screen and (max-width: 600px) {
|
48 |
-
.sow-carousel-title a.sow-carousel-previous {
|
49 |
-
display: none;
|
50 |
-
}
|
51 |
-
.sow-carousel-title a.sow-carousel-next {
|
52 |
-
display: none;
|
53 |
-
}
|
54 |
-
}
|
55 |
-
.widget_sow-carousel {
|
56 |
-
overflow-x: hidden;
|
57 |
-
overflow-y: hidden;
|
58 |
-
}
|
59 |
-
.sow-carousel-wrapper {
|
60 |
-
overflow: hidden;
|
61 |
-
position: relative;
|
62 |
-
left: 0;
|
63 |
-
right: 0;
|
64 |
-
}
|
65 |
-
.sow-carousel-wrapper ul.sow-carousel-items {
|
66 |
-
list-style: none;
|
67 |
-
-webkit-transition: all 0.45s ease;
|
68 |
-
-moz-transition: all 0.45s ease;
|
69 |
-
-o-transition: all 0.45s ease;
|
70 |
-
transition: all 0.45s ease;
|
71 |
-
height: 200px;
|
72 |
-
margin: 0;
|
73 |
-
padding: 0;
|
74 |
-
zoom: 1;
|
75 |
-
width: 99999px;
|
76 |
-
}
|
77 |
-
.sow-carousel-wrapper ul.sow-carousel-items:before {
|
78 |
-
content: '';
|
79 |
-
display: block;
|
80 |
-
}
|
81 |
-
.sow-carousel-wrapper ul.sow-carousel-items:after {
|
82 |
-
content: '';
|
83 |
-
display: table;
|
84 |
-
clear: both;
|
85 |
-
}
|
86 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item {
|
87 |
-
list-style: none;
|
88 |
-
margin-left: 0;
|
89 |
-
padding: 0;
|
90 |
-
display: block;
|
91 |
-
float: left;
|
92 |
-
margin-right: 15px;
|
93 |
-
overflow-x: hidden;
|
94 |
-
overflow-y: hidden;
|
95 |
-
}
|
96 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item:last-child {
|
97 |
-
margin-right: 0;
|
98 |
-
}
|
99 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item.rtl {
|
100 |
-
float: right;
|
101 |
-
}
|
102 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item.rtl:last-child {
|
103 |
-
margin-right: 15px;
|
104 |
-
}
|
105 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail {
|
106 |
-
line-height: 0;
|
107 |
-
}
|
108 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a {
|
109 |
-
display: block;
|
110 |
-
background-position: center center;
|
111 |
-
}
|
112 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a,
|
113 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a span.overlay {
|
114 |
-
-webkit-transition: all 0.35s ease;
|
115 |
-
-moz-transition: all 0.35s ease;
|
116 |
-
-o-transition: all 0.35s ease;
|
117 |
-
transition: all 0.35s ease;
|
118 |
-
}
|
119 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a span.overlay {
|
120 |
-
display: block;
|
121 |
-
width: 100%;
|
122 |
-
height: 100%;
|
123 |
-
background: #3279BB;
|
124 |
-
opacity: 0;
|
125 |
-
position: static;
|
126 |
-
}
|
127 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a:hover span {
|
128 |
-
opacity: 0.5;
|
129 |
-
}
|
130 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-default-thumbnail {
|
131 |
-
display: block;
|
132 |
-
background: #E8E8E8;
|
133 |
-
background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #E0E0E0), color-stop(1, #E8E8E8));
|
134 |
-
background: -ms-linear-gradient(bottom, #E0E0E0, #E8E8E8);
|
135 |
-
background: -moz-linear-gradient(center bottom, #E0E0E0 0%, #E8E8E8 100%);
|
136 |
-
background: -o-linear-gradient(#E8E8E8, #E0E0E0);
|
137 |
-
}
|
138 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item h3 {
|
139 |
-
font-size: 15px;
|
140 |
-
text-align: center;
|
141 |
-
font-weight: 500;
|
142 |
-
color: #474747;
|
143 |
-
margin: 10px 0 0 0;
|
144 |
-
}
|
145 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item h3 a {
|
146 |
-
text-decoration: none;
|
147 |
-
color: inherit;
|
148 |
-
}
|
149 |
-
.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-loading {
|
150 |
-
display: block;
|
151 |
-
float: left;
|
152 |
-
background: url(images/carousel-loader.gif) #F6F6F6 center center no-repeat;
|
153 |
-
margin: 0;
|
154 |
-
}
|
155 |
-
a.sow-carousel-previous {
|
156 |
-
display: none;
|
157 |
-
}
|
158 |
-
a.sow-carousel-next {
|
159 |
-
display: none;
|
160 |
-
}
|
1 |
+
@font-face{font-family:'carousel-arrows';src:url('fonts/carousel-arrows.eot?-95vnmw');src:url('fonts/carousel-arrows.eot?#iefix-95vnmw') format('embedded-opentype'),url('fonts/carousel-arrows.woff?-95vnmw') format('woff'),url('fonts/carousel-arrows.ttf?-95vnmw') format('truetype'),url('fonts/carousel-arrows.svg?-95vnmw#carousel-arrows') format('svg');font-weight:normal;font-style:normal}.sow-carousel-title .widget-title{display:inline-block;padding-right:15px}.sow-carousel-title a.sow-carousel-next,.sow-carousel-title a.sow-carousel-previous{font-family:'carousel-arrows';speak:none;display:block;float:right;overflow:hidden;margin-left:2px;margin-top:3px;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;font-size:8px;line-height:18px;width:18px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;color:#FFFFFF;background:#333333;border-radius:2px}.sow-carousel-title a.sow-carousel-next:hover,.sow-carousel-title a.sow-carousel-previous:hover{background:#444444}.sow-carousel-title a.sow-carousel-next:before{content:"\e601"}.sow-carousel-title a.sow-carousel-previous:before{content:"\e600"}@media screen and (max-width:600px){.sow-carousel-title a.sow-carousel-previous{display:none}.sow-carousel-title a.sow-carousel-next{display:none}}.widget_sow-carousel{overflow-x:hidden;overflow-y:hidden}.sow-carousel-wrapper{overflow:hidden;position:relative;left:0;right:0}.sow-carousel-wrapper ul.sow-carousel-items{list-style:none;-webkit-transition:all .45s ease;-moz-transition:all .45s ease;-o-transition:all .45s ease;transition:all .45s ease;height:200px;margin:0;padding:0;zoom:1;width:99999px}.sow-carousel-wrapper ul.sow-carousel-items:before{content:'';display:block}.sow-carousel-wrapper ul.sow-carousel-items:after{content:'';display:table;clear:both}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item{list-style:none;margin-left:0;padding:0;display:block;float:left;margin-right:15px;overflow-x:hidden;overflow-y:hidden}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item:last-child{margin-right:0}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item.rtl{float:right}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item.rtl:last-child{margin-right:15px}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail{line-height:0}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a{display:block;background-position:center center}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a,.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a span.overlay{-webkit-transition:all .35s ease;-moz-transition:all .35s ease;-o-transition:all .35s ease;transition:all .35s ease}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a span.overlay{display:block;width:100%;height:100%;background:#3279BB;opacity:0;position:static}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-thumbnail a:hover span{opacity:.5}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item .sow-carousel-default-thumbnail{display:block;background:#E8E8E8;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #E0E0E0), color-stop(1, #E8E8E8));background:-ms-linear-gradient(bottom, #E0E0E0, #E8E8E8);background:-moz-linear-gradient(center bottom, #E0E0E0 0, #E8E8E8 100%);background:-o-linear-gradient(#E8E8E8, #E0E0E0)}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item h3{font-size:15px;text-align:center;font-weight:500;color:#474747;margin:10px 0 0 0}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-item h3 a{text-decoration:none;color:inherit}.sow-carousel-wrapper ul.sow-carousel-items li.sow-carousel-loading{display:block;float:left;background:url(images/carousel-loader.gif) #F6F6F6 center center no-repeat;margin:0}a.sow-carousel-previous{display:none}a.sow-carousel-next{display:none}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/social-media-buttons/social-media-buttons.php
CHANGED
@@ -1,306 +1,306 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Widget Name: Social Media Buttons
|
5 |
-
Description: Customizable buttons which link to all your social media profiles.
|
6 |
-
Author: SiteOrigin
|
7 |
-
Author URI: https://siteorigin.com
|
8 |
-
*/
|
9 |
-
|
10 |
-
|
11 |
-
class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
|
12 |
-
|
13 |
-
private $networks;
|
14 |
-
|
15 |
-
function __construct() {
|
16 |
-
parent::__construct(
|
17 |
-
'sow-social-media-buttons',
|
18 |
-
__( 'SiteOrigin Social Media Buttons', 'so-widgets-bundle' ),
|
19 |
-
array(
|
20 |
-
'description' => __( 'A social media buttons widget.', 'so-widgets-bundle' )
|
21 |
-
),
|
22 |
-
array(),
|
23 |
-
false,
|
24 |
-
plugin_dir_path( __FILE__ )
|
25 |
-
);
|
26 |
-
}
|
27 |
-
|
28 |
-
function get_settings_form() {
|
29 |
-
return array(
|
30 |
-
'responsive_breakpoint' => array(
|
31 |
-
'type' => 'measurement',
|
32 |
-
'label' => __( 'Mobile Collapse Width', 'so-widgets-bundle' ),
|
33 |
-
'default' => 780,
|
34 |
-
'description' => __( 'This setting allows you to set the resoloution for when the Mobile Align setting will be used.', 'so-widgets-bundle' )
|
35 |
-
)
|
36 |
-
);
|
37 |
-
}
|
38 |
-
|
39 |
-
function get_widget_form(){
|
40 |
-
|
41 |
-
if( empty( $this->networks ) ) {
|
42 |
-
$this->networks = include plugin_dir_path( __FILE__ ) . 'data/networks.php';
|
43 |
-
}
|
44 |
-
|
45 |
-
$network_names = array();
|
46 |
-
foreach ( $this->networks as $key => $value ) {
|
47 |
-
$network_names[ $key ] = $value['label'];
|
48 |
-
}
|
49 |
-
|
50 |
-
return array(
|
51 |
-
'title' => array(
|
52 |
-
'type' => 'text',
|
53 |
-
'label' => __( 'Title', 'so-widgets-bundle' ),
|
54 |
-
),
|
55 |
-
'networks' => array(
|
56 |
-
'type' => 'repeater',
|
57 |
-
'label' => __( 'Networks', 'so-widgets-bundle' ),
|
58 |
-
'item_name' => __( 'Network', 'so-widgets-bundle' ),
|
59 |
-
'item_label' => array(
|
60 |
-
'selector' => "[id*='networks-name'] :selected",
|
61 |
-
'update_event' => 'change',
|
62 |
-
'value_method' => 'text'
|
63 |
-
),
|
64 |
-
'fields' => array(
|
65 |
-
'name' => array(
|
66 |
-
'type' => 'select',
|
67 |
-
'label' => '',
|
68 |
-
'prompt' => __( 'Select network', 'so-widgets-bundle' ),
|
69 |
-
'options' => $network_names
|
70 |
-
),
|
71 |
-
'url' => array(
|
72 |
-
'type' => 'text',
|
73 |
-
'label' => __( 'URL', 'so-widgets-bundle' )
|
74 |
-
),
|
75 |
-
'icon_title' => array(
|
76 |
-
'type' => 'text',
|
77 |
-
'label' => __( 'Icon title', 'so-widgets-bundle' ),
|
78 |
-
),
|
79 |
-
'icon_color' => array(
|
80 |
-
'type' => 'color',
|
81 |
-
'label' => __( 'Icon color', 'so-widgets-bundle' )
|
82 |
-
),
|
83 |
-
'button_color' => array(
|
84 |
-
'type' => 'color',
|
85 |
-
'label' => __( 'Background color', 'so-widgets-bundle' )
|
86 |
-
)
|
87 |
-
)
|
88 |
-
),
|
89 |
-
'design' => array(
|
90 |
-
'type' => 'section',
|
91 |
-
'label' => __( 'Design and layout', 'so-widgets-bundle' ),
|
92 |
-
'hide' => true,
|
93 |
-
'fields' => array(
|
94 |
-
'new_window' => array(
|
95 |
-
'type' => 'checkbox',
|
96 |
-
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
97 |
-
'default' => true
|
98 |
-
),
|
99 |
-
'theme' => array(
|
100 |
-
'type' => 'select',
|
101 |
-
'label' => __( 'Button theme', 'so-widgets-bundle' ),
|
102 |
-
'default' => 'atom',
|
103 |
-
'options' => array(
|
104 |
-
'atom' => __( 'Atom', 'so-widgets-bundle' ),
|
105 |
-
'flat' => __( 'Flat', 'so-widgets-bundle' ),
|
106 |
-
'wire' => __( 'Wire', 'so-widgets-bundle' ),
|
107 |
-
),
|
108 |
-
),
|
109 |
-
'hover' => array(
|
110 |
-
'type' => 'checkbox',
|
111 |
-
'label' => __( 'Use hover effects', 'so-widgets-bundle' ),
|
112 |
-
'default' => true
|
113 |
-
),
|
114 |
-
'icon_size' => array(
|
115 |
-
'type' => 'select',
|
116 |
-
'label' => __( 'Icon size', 'so-widgets-bundle' ),
|
117 |
-
'options' => array(
|
118 |
-
'1' => __( 'Normal', 'so-widgets-bundle' ),
|
119 |
-
'1.33' => __( 'Medium', 'so-widgets-bundle' ),
|
120 |
-
'1.66' => __( 'Large', 'so-widgets-bundle' ),
|
121 |
-
'2' => __( 'Extra large', 'so-widgets-bundle' )
|
122 |
-
)
|
123 |
-
),
|
124 |
-
'rounding' => array(
|
125 |
-
'type' => 'select',
|
126 |
-
'label' => __( 'Rounding', 'so-widgets-bundle' ),
|
127 |
-
'default' => '0.25',
|
128 |
-
'options' => array(
|
129 |
-
'0' => __( 'None', 'so-widgets-bundle' ),
|
130 |
-
'0.25' => __( 'Slightly rounded', 'so-widgets-bundle' ),
|
131 |
-
'0.5' => __( 'Very rounded', 'so-widgets-bundle' ),
|
132 |
-
'1.5' => __( 'Completely rounded', 'so-widgets-bundle' ),
|
133 |
-
),
|
134 |
-
),
|
135 |
-
'padding' => array(
|
136 |
-
'type' => 'select',
|
137 |
-
'label' => __( 'Padding', 'so-widgets-bundle' ),
|
138 |
-
'default' => '1',
|
139 |
-
'options' => array(
|
140 |
-
'0.5' => __( 'Low', 'so-widgets-bundle' ),
|
141 |
-
'1' => __( 'Medium', 'so-widgets-bundle' ),
|
142 |
-
'1.4' => __( 'High', 'so-widgets-bundle' ),
|
143 |
-
'1.8' => __( 'Very high', 'so-widgets-bundle' ),
|
144 |
-
),
|
145 |
-
),
|
146 |
-
'align' => array(
|
147 |
-
'type' => 'select',
|
148 |
-
'label' => __( 'Align', 'so-widgets-bundle' ),
|
149 |
-
'default' => 'left',
|
150 |
-
'options' => array(
|
151 |
-
'left' => __( 'Left', 'so-widgets-bundle' ),
|
152 |
-
'right' => __( 'Right', 'so-widgets-bundle' ),
|
153 |
-
'center' => __( 'Center', 'so-widgets-bundle' ),
|
154 |
-
'justify' => __( 'Justify', 'so-widgets-bundle' ),
|
155 |
-
),
|
156 |
-
),
|
157 |
-
'mobile_align' => array(
|
158 |
-
'type' => 'select',
|
159 |
-
'label' => __( 'Mobile Align', 'so-widgets-bundle' ),
|
160 |
-
'default' => 'left',
|
161 |
-
'options' => array(
|
162 |
-
'left' => __( 'Left', 'so-widgets-bundle' ),
|
163 |
-
'right' => __( 'Right', 'so-widgets-bundle' ),
|
164 |
-
'center' => __( 'Center', 'so-widgets-bundle' ),
|
165 |
-
'justify' => __( 'Justify', 'so-widgets-bundle' ),
|
166 |
-
),
|
167 |
-
),
|
168 |
-
'margin' => array(
|
169 |
-
'type' => 'select',
|
170 |
-
'label' => __( 'Margin', 'so-widgets-bundle' ),
|
171 |
-
'default' => '0.1',
|
172 |
-
'options' => array(
|
173 |
-
'0.1' => __( 'Low', 'so-widgets-bundle' ),
|
174 |
-
'0.2' => __( 'Medium', 'so-widgets-bundle' ),
|
175 |
-
'0.3' => __( 'High', 'so-widgets-bundle' ),
|
176 |
-
'0.4' => __( 'Very high', 'so-widgets-bundle' ),
|
177 |
-
),
|
178 |
-
)
|
179 |
-
)
|
180 |
-
),
|
181 |
-
);
|
182 |
-
}
|
183 |
-
|
184 |
-
function modify_form( $form ) {
|
185 |
-
return apply_filters( 'sow_social_media_buttons_form_options', $form );
|
186 |
-
}
|
187 |
-
|
188 |
-
function modify_instance( $instance ) {
|
189 |
-
if ( ! empty( $instance['networks'] ) ) {
|
190 |
-
foreach ( $instance['networks'] as $name => $network ) {
|
191 |
-
$instance['networks'][$name]['icon_name'] = 'fontawesome-' . $network['name'];
|
192 |
-
}
|
193 |
-
}
|
194 |
-
return $instance;
|
195 |
-
}
|
196 |
-
|
197 |
-
function get_javascript_variables() {
|
198 |
-
if( empty( $this->networks ) ) {
|
199 |
-
$this->networks = include plugin_dir_path( __FILE__ ) . 'data/networks.php';
|
200 |
-
}
|
201 |
-
|
202 |
-
return array( 'networks' => $this->networks );
|
203 |
-
}
|
204 |
-
|
205 |
-
function enqueue_admin_scripts() {
|
206 |
-
wp_enqueue_script(
|
207 |
-
'sow-social-media-buttons',
|
208 |
-
plugin_dir_url( __FILE__ ) . 'js/social-media-buttons-admin' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
209 |
-
array( 'jquery' ),
|
210 |
-
SOW_BUNDLE_VERSION
|
211 |
-
);
|
212 |
-
}
|
213 |
-
|
214 |
-
function get_style_name( $instance ) {
|
215 |
-
if ( empty( $instance['design']['theme'] ) ) {
|
216 |
-
return 'atom';
|
217 |
-
}
|
218 |
-
|
219 |
-
return $instance['design']['theme'];
|
220 |
-
}
|
221 |
-
|
222 |
-
function get_less_variables( $instance ) {
|
223 |
-
if( empty( $instance ) ) return;
|
224 |
-
|
225 |
-
$design = $instance['design'];
|
226 |
-
$m = $design['margin'];
|
227 |
-
$top = $right = $bottom = $left = $m . 'em';
|
228 |
-
switch ( $design['align'] ) {
|
229 |
-
case 'left':
|
230 |
-
$left = '0';
|
231 |
-
break;
|
232 |
-
case 'right':
|
233 |
-
$right = '0';
|
234 |
-
break;
|
235 |
-
case 'center':
|
236 |
-
$left = $right = ( $m * 0.5 ) . 'em';
|
237 |
-
break;
|
238 |
-
}
|
239 |
-
$margin = $top . ' ' . $right . ' ' . $bottom . ' ' . $left;
|
240 |
-
|
241 |
-
$global_settings = $this->get_global_settings();
|
242 |
-
return array(
|
243 |
-
'icon_size' => $design['icon_size'] . 'em',
|
244 |
-
'rounding' => $design['rounding'] . 'em',
|
245 |
-
'padding' => $design['padding'] . 'em',
|
246 |
-
'align' => $design['align'],
|
247 |
-
'mobile_align' => ! empty( $design['mobile_align'] ) ? $design['mobile_align'] : '',
|
248 |
-
'responsive_breakpoint' => ! empty( $global_settings['responsive_breakpoint'] ) ? $global_settings['responsive_breakpoint'] : '',
|
249 |
-
'margin' => $margin
|
250 |
-
);
|
251 |
-
}
|
252 |
-
|
253 |
-
function less_generate_calls_to( $instance, $args ) {
|
254 |
-
$networks = $this->get_instance_networks( $instance );
|
255 |
-
$calls = array();
|
256 |
-
foreach ( $networks as $network ) {
|
257 |
-
if ( ! empty( $network['name'] ) ) {
|
258 |
-
$call = $args[0] . '( @name:' . $network['name'];
|
259 |
-
$call .= ! empty( $network['icon_color'] ) ? ', @icon_color:' . $network['icon_color'] : '';
|
260 |
-
$call .= ! empty( $network['button_color'] ) ? ', @button_color:' . $network['button_color'] : '';
|
261 |
-
$call .= ');';
|
262 |
-
$calls[] = $call;
|
263 |
-
}
|
264 |
-
}
|
265 |
-
|
266 |
-
return implode( "\n", $calls );
|
267 |
-
}
|
268 |
-
|
269 |
-
function get_template_variables( $instance, $args ) {
|
270 |
-
return array(
|
271 |
-
'networks' => $this->get_instance_networks( $instance )
|
272 |
-
);
|
273 |
-
}
|
274 |
-
|
275 |
-
private function get_instance_networks( $instance ) {
|
276 |
-
if ( isset( $instance['networks'] ) && ! empty( $instance['networks'] ) ) {
|
277 |
-
$networks = $instance['networks'];
|
278 |
-
} else {
|
279 |
-
$networks = array();
|
280 |
-
}
|
281 |
-
return apply_filters( 'sow_social_media_buttons_networks', $networks, $instance );
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* This is used to generate the hash of the instance.
|
286 |
-
*
|
287 |
-
* @param $instance
|
288 |
-
*
|
289 |
-
* @return array
|
290 |
-
*/
|
291 |
-
protected function get_style_hash_variables( $instance ){
|
292 |
-
$networks = $this->get_instance_networks($instance);
|
293 |
-
|
294 |
-
foreach($networks as $i => $network) {
|
295 |
-
// URL is not important for the styling
|
296 |
-
unset($networks[$i]['url']);
|
297 |
-
}
|
298 |
-
|
299 |
-
return array(
|
300 |
-
'less' => $this->get_less_variables($instance),
|
301 |
-
'networks' => $networks
|
302 |
-
);
|
303 |
-
}
|
304 |
-
}
|
305 |
-
|
306 |
-
siteorigin_widget_register( 'sow-social-media-buttons', __FILE__, 'SiteOrigin_Widget_SocialMediaButtons_Widget' );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Widget Name: Social Media Buttons
|
5 |
+
Description: Customizable buttons which link to all your social media profiles.
|
6 |
+
Author: SiteOrigin
|
7 |
+
Author URI: https://siteorigin.com
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
|
12 |
+
|
13 |
+
private $networks;
|
14 |
+
|
15 |
+
function __construct() {
|
16 |
+
parent::__construct(
|
17 |
+
'sow-social-media-buttons',
|
18 |
+
__( 'SiteOrigin Social Media Buttons', 'so-widgets-bundle' ),
|
19 |
+
array(
|
20 |
+
'description' => __( 'A social media buttons widget.', 'so-widgets-bundle' )
|
21 |
+
),
|
22 |
+
array(),
|
23 |
+
false,
|
24 |
+
plugin_dir_path( __FILE__ )
|
25 |
+
);
|
26 |
+
}
|
27 |
+
|
28 |
+
function get_settings_form() {
|
29 |
+
return array(
|
30 |
+
'responsive_breakpoint' => array(
|
31 |
+
'type' => 'measurement',
|
32 |
+
'label' => __( 'Mobile Collapse Width', 'so-widgets-bundle' ),
|
33 |
+
'default' => 780,
|
34 |
+
'description' => __( 'This setting allows you to set the resoloution for when the Mobile Align setting will be used.', 'so-widgets-bundle' )
|
35 |
+
)
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
function get_widget_form(){
|
40 |
+
|
41 |
+
if( empty( $this->networks ) ) {
|
42 |
+
$this->networks = include plugin_dir_path( __FILE__ ) . 'data/networks.php';
|
43 |
+
}
|
44 |
+
|
45 |
+
$network_names = array();
|
46 |
+
foreach ( $this->networks as $key => $value ) {
|
47 |
+
$network_names[ $key ] = $value['label'];
|
48 |
+
}
|
49 |
+
|
50 |
+
return array(
|
51 |
+
'title' => array(
|
52 |
+
'type' => 'text',
|
53 |
+
'label' => __( 'Title', 'so-widgets-bundle' ),
|
54 |
+
),
|
55 |
+
'networks' => array(
|
56 |
+
'type' => 'repeater',
|
57 |
+
'label' => __( 'Networks', 'so-widgets-bundle' ),
|
58 |
+
'item_name' => __( 'Network', 'so-widgets-bundle' ),
|
59 |
+
'item_label' => array(
|
60 |
+
'selector' => "[id*='networks-name'] :selected",
|
61 |
+
'update_event' => 'change',
|
62 |
+
'value_method' => 'text'
|
63 |
+
),
|
64 |
+
'fields' => array(
|
65 |
+
'name' => array(
|
66 |
+
'type' => 'select',
|
67 |
+
'label' => '',
|
68 |
+
'prompt' => __( 'Select network', 'so-widgets-bundle' ),
|
69 |
+
'options' => $network_names
|
70 |
+
),
|
71 |
+
'url' => array(
|
72 |
+
'type' => 'text',
|
73 |
+
'label' => __( 'URL', 'so-widgets-bundle' )
|
74 |
+
),
|
75 |
+
'icon_title' => array(
|
76 |
+
'type' => 'text',
|
77 |
+
'label' => __( 'Icon title', 'so-widgets-bundle' ),
|
78 |
+
),
|
79 |
+
'icon_color' => array(
|
80 |
+
'type' => 'color',
|
81 |
+
'label' => __( 'Icon color', 'so-widgets-bundle' )
|
82 |
+
),
|
83 |
+
'button_color' => array(
|
84 |
+
'type' => 'color',
|
85 |
+
'label' => __( 'Background color', 'so-widgets-bundle' )
|
86 |
+
)
|
87 |
+
)
|
88 |
+
),
|
89 |
+
'design' => array(
|
90 |
+
'type' => 'section',
|
91 |
+
'label' => __( 'Design and layout', 'so-widgets-bundle' ),
|
92 |
+
'hide' => true,
|
93 |
+
'fields' => array(
|
94 |
+
'new_window' => array(
|
95 |
+
'type' => 'checkbox',
|
96 |
+
'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
|
97 |
+
'default' => true
|
98 |
+
),
|
99 |
+
'theme' => array(
|
100 |
+
'type' => 'select',
|
101 |
+
'label' => __( 'Button theme', 'so-widgets-bundle' ),
|
102 |
+
'default' => 'atom',
|
103 |
+
'options' => array(
|
104 |
+
'atom' => __( 'Atom', 'so-widgets-bundle' ),
|
105 |
+
'flat' => __( 'Flat', 'so-widgets-bundle' ),
|
106 |
+
'wire' => __( 'Wire', 'so-widgets-bundle' ),
|
107 |
+
),
|
108 |
+
),
|
109 |
+
'hover' => array(
|
110 |
+
'type' => 'checkbox',
|
111 |
+
'label' => __( 'Use hover effects', 'so-widgets-bundle' ),
|
112 |
+
'default' => true
|
113 |
+
),
|
114 |
+
'icon_size' => array(
|
115 |
+
'type' => 'select',
|
116 |
+
'label' => __( 'Icon size', 'so-widgets-bundle' ),
|
117 |
+
'options' => array(
|
118 |
+
'1' => __( 'Normal', 'so-widgets-bundle' ),
|
119 |
+
'1.33' => __( 'Medium', 'so-widgets-bundle' ),
|
120 |
+
'1.66' => __( 'Large', 'so-widgets-bundle' ),
|
121 |
+
'2' => __( 'Extra large', 'so-widgets-bundle' )
|
122 |
+
)
|
123 |
+
),
|
124 |
+
'rounding' => array(
|
125 |
+
'type' => 'select',
|
126 |
+
'label' => __( 'Rounding', 'so-widgets-bundle' ),
|
127 |
+
'default' => '0.25',
|
128 |
+
'options' => array(
|
129 |
+
'0' => __( 'None', 'so-widgets-bundle' ),
|
130 |
+
'0.25' => __( 'Slightly rounded', 'so-widgets-bundle' ),
|
131 |
+
'0.5' => __( 'Very rounded', 'so-widgets-bundle' ),
|
132 |
+
'1.5' => __( 'Completely rounded', 'so-widgets-bundle' ),
|
133 |
+
),
|
134 |
+
),
|
135 |
+
'padding' => array(
|
136 |
+
'type' => 'select',
|
137 |
+
'label' => __( 'Padding', 'so-widgets-bundle' ),
|
138 |
+
'default' => '1',
|
139 |
+
'options' => array(
|
140 |
+
'0.5' => __( 'Low', 'so-widgets-bundle' ),
|
141 |
+
'1' => __( 'Medium', 'so-widgets-bundle' ),
|
142 |
+
'1.4' => __( 'High', 'so-widgets-bundle' ),
|
143 |
+
'1.8' => __( 'Very high', 'so-widgets-bundle' ),
|
144 |
+
),
|
145 |
+
),
|
146 |
+
'align' => array(
|
147 |
+
'type' => 'select',
|
148 |
+
'label' => __( 'Align', 'so-widgets-bundle' ),
|
149 |
+
'default' => 'left',
|
150 |
+
'options' => array(
|
151 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
152 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
153 |
+
'center' => __( 'Center', 'so-widgets-bundle' ),
|
154 |
+
'justify' => __( 'Justify', 'so-widgets-bundle' ),
|
155 |
+
),
|
156 |
+
),
|
157 |
+
'mobile_align' => array(
|
158 |
+
'type' => 'select',
|
159 |
+
'label' => __( 'Mobile Align', 'so-widgets-bundle' ),
|
160 |
+
'default' => 'left',
|
161 |
+
'options' => array(
|
162 |
+
'left' => __( 'Left', 'so-widgets-bundle' ),
|
163 |
+
'right' => __( 'Right', 'so-widgets-bundle' ),
|
164 |
+
'center' => __( 'Center', 'so-widgets-bundle' ),
|
165 |
+
'justify' => __( 'Justify', 'so-widgets-bundle' ),
|
166 |
+
),
|
167 |
+
),
|
168 |
+
'margin' => array(
|
169 |
+
'type' => 'select',
|
170 |
+
'label' => __( 'Margin', 'so-widgets-bundle' ),
|
171 |
+
'default' => '0.1',
|
172 |
+
'options' => array(
|
173 |
+
'0.1' => __( 'Low', 'so-widgets-bundle' ),
|
174 |
+
'0.2' => __( 'Medium', 'so-widgets-bundle' ),
|
175 |
+
'0.3' => __( 'High', 'so-widgets-bundle' ),
|
176 |
+
'0.4' => __( 'Very high', 'so-widgets-bundle' ),
|
177 |
+
),
|
178 |
+
)
|
179 |
+
)
|
180 |
+
),
|
181 |
+
);
|
182 |
+
}
|
183 |
+
|
184 |
+
function modify_form( $form ) {
|
185 |
+
return apply_filters( 'sow_social_media_buttons_form_options', $form );
|
186 |
+
}
|
187 |
+
|
188 |
+
function modify_instance( $instance ) {
|
189 |
+
if ( ! empty( $instance['networks'] ) ) {
|
190 |
+
foreach ( $instance['networks'] as $name => $network ) {
|
191 |
+
$instance['networks'][$name]['icon_name'] = 'fontawesome-' . $network['name'];
|
192 |
+
}
|
193 |
+
}
|
194 |
+
return $instance;
|
195 |
+
}
|
196 |
+
|
197 |
+
function get_javascript_variables() {
|
198 |
+
if( empty( $this->networks ) ) {
|
199 |
+
$this->networks = include plugin_dir_path( __FILE__ ) . 'data/networks.php';
|
200 |
+
}
|
201 |
+
|
202 |
+
return array( 'networks' => $this->networks );
|
203 |
+
}
|
204 |
+
|
205 |
+
function enqueue_admin_scripts() {
|
206 |
+
wp_enqueue_script(
|
207 |
+
'sow-social-media-buttons',
|
208 |
+
plugin_dir_url( __FILE__ ) . 'js/social-media-buttons-admin' . SOW_BUNDLE_JS_SUFFIX . '.js',
|
209 |
+
array( 'jquery' ),
|
210 |
+
SOW_BUNDLE_VERSION
|
211 |
+
);
|
212 |
+
}
|
213 |
+
|
214 |
+
function get_style_name( $instance ) {
|
215 |
+
if ( empty( $instance['design']['theme'] ) ) {
|
216 |
+
return 'atom';
|
217 |
+
}
|
218 |
+
|
219 |
+
return $instance['design']['theme'];
|
220 |
+
}
|
221 |
+
|
222 |
+
function get_less_variables( $instance ) {
|
223 |
+
if( empty( $instance ) ) return;
|
224 |
+
|
225 |
+
$design = $instance['design'];
|
226 |
+
$m = $design['margin'];
|
227 |
+
$top = $right = $bottom = $left = $m . 'em';
|
228 |
+
switch ( $design['align'] ) {
|
229 |
+
case 'left':
|
230 |
+
$left = '0';
|
231 |
+
break;
|
232 |
+
case 'right':
|
233 |
+
$right = '0';
|
234 |
+
break;
|
235 |
+
case 'center':
|
236 |
+
$left = $right = ( $m * 0.5 ) . 'em';
|
237 |
+
break;
|
238 |
+
}
|
239 |
+
$margin = $top . ' ' . $right . ' ' . $bottom . ' ' . $left;
|
240 |
+
|
241 |
+
$global_settings = $this->get_global_settings();
|
242 |
+
return array(
|
243 |
+
'icon_size' => $design['icon_size'] . 'em',
|
244 |
+
'rounding' => $design['rounding'] . 'em',
|
245 |
+
'padding' => $design['padding'] . 'em',
|
246 |
+
'align' => $design['align'],
|
247 |
+
'mobile_align' => ! empty( $design['mobile_align'] ) ? $design['mobile_align'] : '',
|
248 |
+
'responsive_breakpoint' => ! empty( $global_settings['responsive_breakpoint'] ) ? $global_settings['responsive_breakpoint'] : '',
|
249 |
+
'margin' => $margin
|
250 |
+
);
|
251 |
+
}
|
252 |
+
|
253 |
+
function less_generate_calls_to( $instance, $args ) {
|
254 |
+
$networks = $this->get_instance_networks( $instance );
|
255 |
+
$calls = array();
|
256 |
+
foreach ( $networks as $network ) {
|
257 |
+
if ( ! empty( $network['name'] ) ) {
|
258 |
+
$call = $args[0] . '( @name:' . $network['name'];
|
259 |
+
$call .= ! empty( $network['icon_color'] ) ? ', @icon_color:' . $network['icon_color'] : '';
|
260 |
+
$call .= ! empty( $network['button_color'] ) ? ', @button_color:' . $network['button_color'] : '';
|
261 |
+
$call .= ');';
|
262 |
+
$calls[] = $call;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
return implode( "\n", $calls );
|
267 |
+
}
|
268 |
+
|
269 |
+
function get_template_variables( $instance, $args ) {
|
270 |
+
return array(
|
271 |
+
'networks' => $this->get_instance_networks( $instance )
|
272 |
+
);
|
273 |
+
}
|
274 |
+
|
275 |
+
private function get_instance_networks( $instance ) {
|
276 |
+
if ( isset( $instance['networks'] ) && ! empty( $instance['networks'] ) ) {
|
277 |
+
$networks = $instance['networks'];
|
278 |
+
} else {
|
279 |
+
$networks = array();
|
280 |
+
}
|
281 |
+
return apply_filters( 'sow_social_media_buttons_networks', $networks, $instance );
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* This is used to generate the hash of the instance.
|
286 |
+
*
|
287 |
+
* @param $instance
|
288 |
+
*
|
289 |
+
* @return array
|
290 |
+
*/
|
291 |
+
protected function get_style_hash_variables( $instance ){
|
292 |
+
$networks = $this->get_instance_networks($instance);
|
293 |
+
|
294 |
+
foreach($networks as $i => $network) {
|
295 |
+
// URL is not important for the styling
|
296 |
+
unset($networks[$i]['url']);
|
297 |
+
}
|
298 |
+
|
299 |
+
return array(
|
300 |
+
'less' => $this->get_less_variables($instance),
|
301 |
+
'networks' => $networks
|
302 |
+
);
|
303 |
+
}
|
304 |
+
}
|
305 |
+
|
306 |
+
siteorigin_widget_register( 'sow-social-media-buttons', __FILE__, 'SiteOrigin_Widget_SocialMediaButtons_Widget' );
|
widgets/social-media-buttons/styles/widget-mixins.less
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
@icon_size: 1.3em;
|
2 |
-
@rounding: 0.25em;
|
3 |
-
@padding: 0.75em;
|
4 |
-
@margin: 0.1em;
|
5 |
-
@align: left;
|
6 |
-
@mobile_align: left;
|
7 |
-
@responsive_breakpoint: 780px;
|
8 |
-
|
9 |
-
.social-media-button-container {
|
10 |
-
.clearfix();
|
11 |
-
|
12 |
-
text-align: @align;
|
13 |
-
|
14 |
-
@media (max-width: @responsive_breakpoint) {
|
15 |
-
text-align: @mobile_align;
|
16 |
-
}
|
17 |
-
|
18 |
-
//this little gem allows justified buttons when there's only one row of buttons or if it's the last row of buttons
|
19 |
-
/*
|
20 |
-
&:after {
|
21 |
-
content:"";
|
22 |
-
display:inline-block;
|
23 |
-
width:100%;
|
24 |
-
}
|
25 |
-
*/
|
26 |
-
}
|
27 |
-
|
28 |
-
.social-media-button-base() {
|
29 |
-
|
30 |
-
font-size: @icon_size;
|
31 |
-
padding: @padding @padding;
|
32 |
-
margin: @margin;
|
33 |
-
|
34 |
-
display: inline-block;
|
35 |
-
text-align: center;
|
36 |
-
vertical-align: middle;
|
37 |
-
|
38 |
-
line-height: 1em;
|
39 |
-
|
40 |
-
.sow-icon-fontawesome {
|
41 |
-
width: 1em;
|
42 |
-
height: 1em;
|
43 |
-
display: inline-block;
|
44 |
-
}
|
45 |
-
|
46 |
-
.rounded(@rounding);
|
47 |
}
|
1 |
+
@icon_size: 1.3em;
|
2 |
+
@rounding: 0.25em;
|
3 |
+
@padding: 0.75em;
|
4 |
+
@margin: 0.1em;
|
5 |
+
@align: left;
|
6 |
+
@mobile_align: left;
|
7 |
+
@responsive_breakpoint: 780px;
|
8 |
+
|
9 |
+
.social-media-button-container {
|
10 |
+
.clearfix();
|
11 |
+
|
12 |
+
text-align: @align;
|
13 |
+
|
14 |
+
@media (max-width: @responsive_breakpoint) {
|
15 |
+
text-align: @mobile_align;
|
16 |
+
}
|
17 |
+
|
18 |
+
//this little gem allows justified buttons when there's only one row of buttons or if it's the last row of buttons
|
19 |
+
/*
|
20 |
+
&:after {
|
21 |
+
content:"";
|
22 |
+
display:inline-block;
|
23 |
+
width:100%;
|
24 |
+
}
|
25 |
+
*/
|
26 |
+
}
|
27 |
+
|
28 |
+
.social-media-button-base() {
|
29 |
+
|
30 |
+
font-size: @icon_size;
|
31 |
+
padding: @padding @padding;
|
32 |
+
margin: @margin;
|
33 |
+
|
34 |
+
display: inline-block;
|
35 |
+
text-align: center;
|
36 |
+
vertical-align: middle;
|
37 |
+
|
38 |
+
line-height: 1em;
|
39 |
+
|
40 |
+
.sow-icon-fontawesome {
|
41 |
+
width: 1em;
|
42 |
+
height: 1em;
|
43 |
+
display: inline-block;
|
44 |
+
}
|
45 |
+
|
46 |
+
.rounded(@rounding);
|
47 |
}
|
widgets/tabs/js/tabs.js
CHANGED
@@ -1,82 +1,82 @@
|
|
1 |
-
/* globals jQuery, sowb */
|
2 |
-
|
3 |
-
var sowb = window.sowb || {};
|
4 |
-
|
5 |
-
jQuery( function ( $ ) {
|
6 |
-
|
7 |
-
sowb.setupTabs = function() {
|
8 |
-
$( '.sow-tabs' ).each( function ( index, element ) {
|
9 |
-
var $this = $( element );
|
10 |
-
var $widget = $this.closest( '.so-widget-sow-tabs' );
|
11 |
-
var useAnchorTags = $widget.data( 'useAnchorTags' );
|
12 |
-
|
13 |
-
var $tabPanelsContainer = $this.find( '> .sow-tabs-panel-container' );
|
14 |
-
|
15 |
-
var $tabs = $this.find( '> .sow-tabs-tab-container > .sow-tabs-tab' );
|
16 |
-
|
17 |
-
var $selectedTab = $this.find( '.sow-tabs-tab-selected' );
|
18 |
-
var selectedIndex = $selectedTab.index();
|
19 |
-
|
20 |
-
var $tabPanels = $tabPanelsContainer.find( '> .sow-tabs-panel' );
|
21 |
-
$tabPanels.not( ':eq(' + selectedIndex + ')' ).hide();
|
22 |
-
|
23 |
-
var selectTab = function ( tab, preventHashChange ) {
|
24 |
-
var $tab = $( tab );
|
25 |
-
if ( $tab.is( '.sow-tabs-tab-selected' ) ) {
|
26 |
-
return true;
|
27 |
-
}
|
28 |
-
var selectedIndex = $tab.index();
|
29 |
-
if ( selectedIndex > -1 ) {
|
30 |
-
var $prevTab = $tabs.filter( '.sow-tabs-tab-selected' );
|
31 |
-
$prevTab.removeClass( 'sow-tabs-tab-selected' );
|
32 |
-
var prevTabIndex = $prevTab.index();
|
33 |
-
$tabPanels.eq( prevTabIndex ).fadeOut( 'fast',
|
34 |
-
function () {
|
35 |
-
$( this ).trigger( 'hide' );
|
36 |
-
$tabPanels.eq( selectedIndex ).fadeIn( 'fast',
|
37 |
-
function () {
|
38 |
-
$( this ).trigger( 'show' );
|
39 |
-
}
|
40 |
-
);
|
41 |
-
}
|
42 |
-
);
|
43 |
-
$tab.addClass( 'sow-tabs-tab-selected' );
|
44 |
-
|
45 |
-
if ( useAnchorTags && !preventHashChange ) {
|
46 |
-
window.location.hash = $tab.data( 'anchor' );
|
47 |
-
}
|
48 |
-
}
|
49 |
-
};
|
50 |
-
|
51 |
-
$tabs.click( function () {
|
52 |
-
selectTab( this );
|
53 |
-
} );
|
54 |
-
|
55 |
-
if ( useAnchorTags ) {
|
56 |
-
var updateSelectedTab = function () {
|
57 |
-
if ( window.location.hash ) {
|
58 |
-
var anchors = window.location.hash.replace( '#', '' ).split( ',' );
|
59 |
-
anchors.forEach( function ( anchor ) {
|
60 |
-
var tab = $tabs.filter( '[data-anchor="' + anchor + '"]' );
|
61 |
-
if ( tab ) {
|
62 |
-
selectTab( tab, true );
|
63 |
-
}
|
64 |
-
} );
|
65 |
-
}
|
66 |
-
};
|
67 |
-
$( window ).on( 'hashchange', updateSelectedTab );
|
68 |
-
if ( window.location.hash ) {
|
69 |
-
updateSelectedTab();
|
70 |
-
} else {
|
71 |
-
window.location.hash = $selectedTab.data( 'anchor' );
|
72 |
-
}
|
73 |
-
}
|
74 |
-
} );
|
75 |
-
};
|
76 |
-
|
77 |
-
sowb.setupTabs();
|
78 |
-
|
79 |
-
$( sowb ).on( 'setup_widgets', sowb.setupTabs );
|
80 |
-
} );
|
81 |
-
|
82 |
-
window.sowb = sowb;
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
|
3 |
+
var sowb = window.sowb || {};
|
4 |
+
|
5 |
+
jQuery( function ( $ ) {
|
6 |
+
|
7 |
+
sowb.setupTabs = function() {
|
8 |
+
$( '.sow-tabs' ).each( function ( index, element ) {
|
9 |
+
var $this = $( element );
|
10 |
+
var $widget = $this.closest( '.so-widget-sow-tabs' );
|
11 |
+
var useAnchorTags = $widget.data( 'useAnchorTags' );
|
12 |
+
|
13 |
+
var $tabPanelsContainer = $this.find( '> .sow-tabs-panel-container' );
|
14 |
+
|
15 |
+
var $tabs = $this.find( '> .sow-tabs-tab-container > .sow-tabs-tab' );
|
16 |
+
|
17 |
+
var $selectedTab = $this.find( '.sow-tabs-tab-selected' );
|
18 |
+
var selectedIndex = $selectedTab.index();
|
19 |
+
|
20 |
+
var $tabPanels = $tabPanelsContainer.find( '> .sow-tabs-panel' );
|
21 |
+
$tabPanels.not( ':eq(' + selectedIndex + ')' ).hide();
|
22 |
+
|
23 |
+
var selectTab = function ( tab, preventHashChange ) {
|
24 |
+
var $tab = $( tab );
|
25 |
+
if ( $tab.is( '.sow-tabs-tab-selected' ) ) {
|
26 |
+
return true;
|
27 |
+
}
|
28 |
+
var selectedIndex = $tab.index();
|
29 |
+
if ( selectedIndex > -1 ) {
|
30 |
+
var $prevTab = $tabs.filter( '.sow-tabs-tab-selected' );
|
31 |
+
$prevTab.removeClass( 'sow-tabs-tab-selected' );
|
32 |
+
var prevTabIndex = $prevTab.index();
|
33 |
+
$tabPanels.eq( prevTabIndex ).fadeOut( 'fast',
|
34 |
+
function () {
|
35 |
+
$( this ).trigger( 'hide' );
|
36 |
+
$tabPanels.eq( selectedIndex ).fadeIn( 'fast',
|
37 |
+
function () {
|
38 |
+
$( this ).trigger( 'show' );
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}
|
42 |
+
);
|
43 |
+
$tab.addClass( 'sow-tabs-tab-selected' );
|
44 |
+
|
45 |
+
if ( useAnchorTags && !preventHashChange ) {
|
46 |
+
window.location.hash = $tab.data( 'anchor' );
|
47 |
+
}
|
48 |
+
}
|
49 |
+
};
|
50 |
+
|
51 |
+
$tabs.click( function () {
|
52 |
+
selectTab( this );
|
53 |
+
} );
|
54 |
+
|
55 |
+
if ( useAnchorTags ) {
|
56 |
+
var updateSelectedTab = function () {
|
57 |
+
if ( window.location.hash ) {
|
58 |
+
var anchors = window.location.hash.replace( '#', '' ).split( ',' );
|
59 |
+
anchors.forEach( function ( anchor ) {
|
60 |
+
var tab = $tabs.filter( '[data-anchor="' + anchor + '"]' );
|
61 |
+
if ( tab ) {
|
62 |
+
selectTab( tab, true );
|
63 |
+
}
|
64 |
+
} );
|
65 |
+
}
|
66 |
+
};
|
67 |
+
$( window ).on( 'hashchange', updateSelectedTab );
|
68 |
+
if ( window.location.hash ) {
|
69 |
+
updateSelectedTab();
|
70 |
+
} else {
|
71 |
+
window.location.hash = $selectedTab.data( 'anchor' );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
} );
|
75 |
+
};
|
76 |
+
|
77 |
+
sowb.setupTabs();
|
78 |
+
|
79 |
+
$( sowb ).on( 'setup_widgets', sowb.setupTabs );
|
80 |
+
} );
|
81 |
+
|
82 |
+
window.sowb = sowb;
|
widgets/tabs/styles/default.less
CHANGED
@@ -1,120 +1,120 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@tabs_container_background_color: default;
|
6 |
-
@tabs_container_border_color: default;
|
7 |
-
@tabs_container_border_width: default;
|
8 |
-
@has_tabs_container_border_width: default;
|
9 |
-
@tabs_container_border_radius: default;
|
10 |
-
@tabs_container_padding: 12px 10px 0px 10px;
|
11 |
-
@tabs_container_tabs_align: default;
|
12 |
-
|
13 |
-
@tabs_background_color: default;
|
14 |
-
@tabs_background_hover_color: default;
|
15 |
-
@tabs_title_color: default;
|
16 |
-
@tabs_title_hover_color: default;
|
17 |
-
@tabs_font_family: default;
|
18 |
-
@tabs_font_weight: default;
|
19 |
-
@tabs_font_size: 18px;
|
20 |
-
@tabs_border_color: default;
|
21 |
-
@tabs_border_hover_color: default;
|
22 |
-
@tabs_border_width: default;
|
23 |
-
@has_tabs_border_width: default;
|
24 |
-
@tabs_border_hover_width: default;
|
25 |
-
@has_tabs_border_hover_width: default;
|
26 |
-
@tabs_border_radius: default;
|
27 |
-
@tabs_padding: 16px 15px 16px 15px;
|
28 |
-
@tabs_margin: 0px 5px 0px 5px;
|
29 |
-
|
30 |
-
@panels_background_color: default;
|
31 |
-
@panels_font_family: default;
|
32 |
-
@panels_font_weight: default;
|
33 |
-
@panels_font_size: 16px;
|
34 |
-
@panels_font_color: default;
|
35 |
-
@panels_border_width: default;
|
36 |
-
@has_panels_border_width: default;
|
37 |
-
@panels_border_color: default;
|
38 |
-
@panels_border_radius: default;
|
39 |
-
@panels_padding: 30px 30px 30px 35px;
|
40 |
-
|
41 |
-
.sow-tabs {
|
42 |
-
.sow-tabs-tab-container {
|
43 |
-
background-color: @tabs_container_background_color;
|
44 |
-
padding: @tabs_container_padding;
|
45 |
-
text-align: @tabs_container_tabs_align;
|
46 |
-
|
47 |
-
//noinspection CssOptimizeSimilarProperties
|
48 |
-
& when ( @has_tabs_container_border_width = true ) {
|
49 |
-
border-style: solid;
|
50 |
-
border-color: @tabs_container_border_color;
|
51 |
-
border-width: @tabs_container_border_width;
|
52 |
-
border-radius: @tabs_container_border_radius;
|
53 |
-
}
|
54 |
-
|
55 |
-
.sow-tabs-tab {
|
56 |
-
display: inline-block;
|
57 |
-
cursor: pointer;
|
58 |
-
background-color: @tabs_background_color;
|
59 |
-
padding: @tabs_padding;
|
60 |
-
margin: @tabs_margin;
|
61 |
-
color: @tabs_title_color;
|
62 |
-
font-family: @tabs_font_family;
|
63 |
-
font-weight: @tabs_font_weight;
|
64 |
-
font-size: @tabs_font_size;
|
65 |
-
transition: all 0.3s;
|
66 |
-
|
67 |
-
//noinspection CssOptimizeSimilarProperties
|
68 |
-
& when ( @has_tabs_border_width = true ) {
|
69 |
-
border-style: solid;
|
70 |
-
border-color: @tabs_border_color;
|
71 |
-
border-width: @tabs_border_width;
|
72 |
-
border-radius: @tabs_border_radius;
|
73 |
-
}
|
74 |
-
|
75 |
-
&.sow-tabs-tab-selected, &:hover {
|
76 |
-
background-color: @tabs_background_hover_color;
|
77 |
-
color: @tabs_title_hover_color;
|
78 |
-
|
79 |
-
//noinspection CssOptimizeSimilarProperties
|
80 |
-
& when ( @has_tabs_border_hover_width = true ) {
|
81 |
-
border-style: solid;
|
82 |
-
border-color: @tabs_border_hover_color;
|
83 |
-
border-width: @tabs_border_hover_width;
|
84 |
-
border-radius: @tabs_border_radius;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
.sow-tabs-title {
|
89 |
-
line-height: 1;
|
90 |
-
}
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
.sow-tabs-panel-container {
|
95 |
-
position: relative;
|
96 |
-
background-color: @panels_background_color;
|
97 |
-
color: @panels_font_color;
|
98 |
-
|
99 |
-
//noinspection CssOptimizeSimilarProperties
|
100 |
-
& when( @has_panels_border_width = true ) {
|
101 |
-
border-style: solid;
|
102 |
-
border-width: @panels_border_width;
|
103 |
-
border-color: @panels_border_color;
|
104 |
-
border-radius: @panels_border_radius;
|
105 |
-
}
|
106 |
-
|
107 |
-
.sow-tabs-panel {
|
108 |
-
padding: @panels_padding;
|
109 |
-
.sow-tabs-panel-content {
|
110 |
-
font-family: @panels_font_family;
|
111 |
-
font-weight: @panels_font_weight;
|
112 |
-
font-size: @panels_font_size;
|
113 |
-
|
114 |
-
> p {
|
115 |
-
margin: 0;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@tabs_container_background_color: default;
|
6 |
+
@tabs_container_border_color: default;
|
7 |
+
@tabs_container_border_width: default;
|
8 |
+
@has_tabs_container_border_width: default;
|
9 |
+
@tabs_container_border_radius: default;
|
10 |
+
@tabs_container_padding: 12px 10px 0px 10px;
|
11 |
+
@tabs_container_tabs_align: default;
|
12 |
+
|
13 |
+
@tabs_background_color: default;
|
14 |
+
@tabs_background_hover_color: default;
|
15 |
+
@tabs_title_color: default;
|
16 |
+
@tabs_title_hover_color: default;
|
17 |
+
@tabs_font_family: default;
|
18 |
+
@tabs_font_weight: default;
|
19 |
+
@tabs_font_size: 18px;
|
20 |
+
@tabs_border_color: default;
|
21 |
+
@tabs_border_hover_color: default;
|
22 |
+
@tabs_border_width: default;
|
23 |
+
@has_tabs_border_width: default;
|
24 |
+
@tabs_border_hover_width: default;
|
25 |
+
@has_tabs_border_hover_width: default;
|
26 |
+
@tabs_border_radius: default;
|
27 |
+
@tabs_padding: 16px 15px 16px 15px;
|
28 |
+
@tabs_margin: 0px 5px 0px 5px;
|
29 |
+
|
30 |
+
@panels_background_color: default;
|
31 |
+
@panels_font_family: default;
|
32 |
+
@panels_font_weight: default;
|
33 |
+
@panels_font_size: 16px;
|
34 |
+
@panels_font_color: default;
|
35 |
+
@panels_border_width: default;
|
36 |
+
@has_panels_border_width: default;
|
37 |
+
@panels_border_color: default;
|
38 |
+
@panels_border_radius: default;
|
39 |
+
@panels_padding: 30px 30px 30px 35px;
|
40 |
+
|
41 |
+
.sow-tabs {
|
42 |
+
.sow-tabs-tab-container {
|
43 |
+
background-color: @tabs_container_background_color;
|
44 |
+
padding: @tabs_container_padding;
|
45 |
+
text-align: @tabs_container_tabs_align;
|
46 |
+
|
47 |
+
//noinspection CssOptimizeSimilarProperties
|
48 |
+
& when ( @has_tabs_container_border_width = true ) {
|
49 |
+
border-style: solid;
|
50 |
+
border-color: @tabs_container_border_color;
|
51 |
+
border-width: @tabs_container_border_width;
|
52 |
+
border-radius: @tabs_container_border_radius;
|
53 |
+
}
|
54 |
+
|
55 |
+
.sow-tabs-tab {
|
56 |
+
display: inline-block;
|
57 |
+
cursor: pointer;
|
58 |
+
background-color: @tabs_background_color;
|
59 |
+
padding: @tabs_padding;
|
60 |
+
margin: @tabs_margin;
|
61 |
+
color: @tabs_title_color;
|
62 |
+
font-family: @tabs_font_family;
|
63 |
+
font-weight: @tabs_font_weight;
|
64 |
+
font-size: @tabs_font_size;
|
65 |
+
transition: all 0.3s;
|
66 |
+
|
67 |
+
//noinspection CssOptimizeSimilarProperties
|
68 |
+
& when ( @has_tabs_border_width = true ) {
|
69 |
+
border-style: solid;
|
70 |
+
border-color: @tabs_border_color;
|
71 |
+
border-width: @tabs_border_width;
|
72 |
+
border-radius: @tabs_border_radius;
|
73 |
+
}
|
74 |
+
|
75 |
+
&.sow-tabs-tab-selected, &:hover {
|
76 |
+
background-color: @tabs_background_hover_color;
|
77 |
+
color: @tabs_title_hover_color;
|
78 |
+
|
79 |
+
//noinspection CssOptimizeSimilarProperties
|
80 |
+
& when ( @has_tabs_border_hover_width = true ) {
|
81 |
+
border-style: solid;
|
82 |
+
border-color: @tabs_border_hover_color;
|
83 |
+
border-width: @tabs_border_hover_width;
|
84 |
+
border-radius: @tabs_border_radius;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
.sow-tabs-title {
|
89 |
+
line-height: 1;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
.sow-tabs-panel-container {
|
95 |
+
position: relative;
|
96 |
+
background-color: @panels_background_color;
|
97 |
+
color: @panels_font_color;
|
98 |
+
|
99 |
+
//noinspection CssOptimizeSimilarProperties
|
100 |
+
& when( @has_panels_border_width = true ) {
|
101 |
+
border-style: solid;
|
102 |
+
border-width: @panels_border_width;
|
103 |
+
border-color: @panels_border_color;
|
104 |
+
border-radius: @panels_border_radius;
|
105 |
+
}
|
106 |
+
|
107 |
+
.sow-tabs-panel {
|
108 |
+
padding: @panels_padding;
|
109 |
+
.sow-tabs-panel-content {
|
110 |
+
font-family: @panels_font_family;
|
111 |
+
font-weight: @panels_font_weight;
|
112 |
+
font-size: @panels_font_size;
|
113 |
+
|
114 |
+
> p {
|
115 |
+
margin: 0;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
widgets/testimonial/css/style.css
CHANGED
@@ -1,56 +1 @@
|
|
1 |
-
.sow-testimonials {
|
2 |
-
margin: -10px;
|
3 |
-
zoom: 1;
|
4 |
-
}
|
5 |
-
.sow-testimonials:before {
|
6 |
-
content: '';
|
7 |
-
display: block;
|
8 |
-
}
|
9 |
-
.sow-testimonials:after {
|
10 |
-
content: '';
|
11 |
-
display: table;
|
12 |
-
clear: both;
|
13 |
-
}
|
14 |
-
.sow-testimonials * {
|
15 |
-
box-sizing: border-box;
|
16 |
-
}
|
17 |
-
.sow-testimonials .sow-testimonial-wrapper {
|
18 |
-
float: left;
|
19 |
-
padding: 10px;
|
20 |
-
}
|
21 |
-
.sow-testimonials .sow-testimonial-user {
|
22 |
-
position: relative;
|
23 |
-
}
|
24 |
-
.sow-testimonials .sow-testimonial-user .sow-round-image-frame {
|
25 |
-
background-size: cover;
|
26 |
-
display: inline-block;
|
27 |
-
}
|
28 |
-
.sow-testimonials .sow-testimonial-user .sow-image-wrapper {
|
29 |
-
display: block;
|
30 |
-
}
|
31 |
-
.sow-testimonials .sow-testimonial-user .sow-text strong {
|
32 |
-
display: block;
|
33 |
-
}
|
34 |
-
.sow-testimonials .sow-testimonial-user .sow-caret {
|
35 |
-
position: absolute;
|
36 |
-
height: 24px;
|
37 |
-
width: 14px;
|
38 |
-
top: 20px;
|
39 |
-
right: -3px;
|
40 |
-
fill: #f0f0f0;
|
41 |
-
}
|
42 |
-
.sow-testimonials .sow-testimonial-text > *:first-child {
|
43 |
-
margin-top: 0;
|
44 |
-
}
|
45 |
-
.sow-testimonials .sow-testimonial-text > *:last-child {
|
46 |
-
margin-bottom: 0;
|
47 |
-
}
|
48 |
-
.sow-testimonials .sow-user-left .sow-testimonial-user {
|
49 |
-
text-align: left;
|
50 |
-
}
|
51 |
-
.sow-testimonials .sow-user-right .sow-testimonial-user {
|
52 |
-
text-align: right;
|
53 |
-
}
|
54 |
-
.sow-testimonials .sow-user-middle .sow-testimonial-user {
|
55 |
-
text-align: center;
|
56 |
-
}
|
1 |
+
.sow-testimonials{margin:-10px;zoom:1}.sow-testimonials:before{content:'';display:block}.sow-testimonials:after{content:'';display:table;clear:both}.sow-testimonials *{box-sizing:border-box}.sow-testimonials .sow-testimonial-wrapper{float:left;padding:10px}.sow-testimonials .sow-testimonial-user{position:relative}.sow-testimonials .sow-testimonial-user .sow-round-image-frame{background-size:cover;display:inline-block}.sow-testimonials .sow-testimonial-user .sow-image-wrapper{display:block}.sow-testimonials .sow-testimonial-user .sow-text strong{display:block}.sow-testimonials .sow-testimonial-user .sow-caret{position:absolute;height:24px;width:14px;top:20px;right:-3px;fill:#f0f0f0}.sow-testimonials .sow-testimonial-text>*:first-child{margin-top:0}.sow-testimonials .sow-testimonial-text>*:last-child{margin-bottom:0}.sow-testimonials .sow-user-left .sow-testimonial-user{text-align:left}.sow-testimonials .sow-user-right .sow-testimonial-user{text-align:right}.sow-testimonials .sow-user-middle .sow-testimonial-user{text-align:center}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/testimonial/styles/default.less
CHANGED
@@ -1,188 +1,188 @@
|
|
1 |
-
@import "../../../base/less/mixins";
|
2 |
-
|
3 |
-
.widget-function('import_google_font');
|
4 |
-
|
5 |
-
@testimonial_padding: 10px;
|
6 |
-
|
7 |
-
@testimonial_background: transparent;
|
8 |
-
@text_background: #f0f0f0;
|
9 |
-
@text_color: #666;
|
10 |
-
@text_border_radius: 4px;
|
11 |
-
|
12 |
-
@title_font_family: default;
|
13 |
-
@title_font_weight: default;
|
14 |
-
@title_font_size: default;
|
15 |
-
@name_font_family: default;
|
16 |
-
@name_font_weight: default;
|
17 |
-
@name_font_size: default;
|
18 |
-
@location_font_family: default;
|
19 |
-
@location_font_weight: default;
|
20 |
-
@location_font_size: default;
|
21 |
-
@text_font_family: default;
|
22 |
-
@text_font_weight: default;
|
23 |
-
@text_font_size: default;
|
24 |
-
|
25 |
-
// Testimonial sizes
|
26 |
-
@testimonial_size: 33.333%;
|
27 |
-
@tablet_testimonial_size: 50%;
|
28 |
-
@mobile_testimonial_size: 100%;
|
29 |
-
|
30 |
-
// Image Sizes
|
31 |
-
@image_size: 75px;
|
32 |
-
@tablet_image_size: default;
|
33 |
-
@mobile_image_size: default;
|
34 |
-
|
35 |
-
// Responsive breakpoints
|
36 |
-
@tablet_width: 800px;
|
37 |
-
@mobile_width: 480px;
|
38 |
-
|
39 |
-
.widget-title {
|
40 |
-
font-family: @title_font_family;
|
41 |
-
font-weight: @title_font_weight;
|
42 |
-
font-size: @title_font_size;
|
43 |
-
}
|
44 |
-
|
45 |
-
.sow-testimonials {
|
46 |
-
|
47 |
-
.sow-testimonial-wrapper {
|
48 |
-
width: @testimonial_size;
|
49 |
-
|
50 |
-
@media screen and (max-width: @tablet_width) {
|
51 |
-
width: @tablet_testimonial_size;
|
52 |
-
}
|
53 |
-
|
54 |
-
@media screen and (max-width: @mobile_width) {
|
55 |
-
width: @mobile_testimonial_size;
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
.sow-testimonial {
|
60 |
-
background: @testimonial_background;
|
61 |
-
}
|
62 |
-
|
63 |
-
.sow-testimonial-name {
|
64 |
-
font-family: @name_font_family;
|
65 |
-
font-weight: @name_font_weight;
|
66 |
-
font-size: @name_font_size;
|
67 |
-
}
|
68 |
-
|
69 |
-
.sow-testimonial-location {
|
70 |
-
font-family: @location_font_family;
|
71 |
-
font-weight: @location_font_weight;
|
72 |
-
font-size: @location_font_size;
|
73 |
-
}
|
74 |
-
|
75 |
-
.sow-testimonial-text {
|
76 |
-
font-family: @text_font_family;
|
77 |
-
font-weight: @text_font_weight;
|
78 |
-
font-size: @text_font_size;
|
79 |
-
background: @text_background;
|
80 |
-
color: @text_color;
|
81 |
-
padding: @testimonial_padding @testimonial_padding*1.5;
|
82 |
-
.rounded(@text_border_radius);
|
83 |
-
}
|
84 |
-
|
85 |
-
.sow-round-image-frame {
|
86 |
-
border-radius: @image_size;
|
87 |
-
width: @image_size;
|
88 |
-
height: @image_size;
|
89 |
-
|
90 |
-
@media screen and (max-width: @tablet_width) {
|
91 |
-
width: @tablet_image_size;
|
92 |
-
height: @tablet_image_size;
|
93 |
-
}
|
94 |
-
|
95 |
-
@media screen and (max-width: @mobile_width) {
|
96 |
-
width: @mobile_image_size;
|
97 |
-
height: @mobile_image_size;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
// All the specific layouts
|
102 |
-
|
103 |
-
.sow-testimonial-wrapper {
|
104 |
-
.clearfix();
|
105 |
-
|
106 |
-
&.sow-layout-side {
|
107 |
-
|
108 |
-
&.sow-user-left,
|
109 |
-
&.sow-user-middle {
|
110 |
-
.sow-testimonial-user {
|
111 |
-
width: 33%;
|
112 |
-
float: left;
|
113 |
-
padding: @testimonial_padding @testimonial_padding*2 @testimonial_padding @testimonial_padding;
|
114 |
-
|
115 |
-
img {
|
116 |
-
margin: 0 auto;
|
117 |
-
max-width: 100%;
|
118 |
-
height: auto;
|
119 |
-
|
120 |
-
@media screen and (max-width: @tablet_width) {
|
121 |
-
width: @tablet_image_size;
|
122 |
-
}
|
123 |
-
|
124 |
-
@media screen and (max-width: @mobile_width) {
|
125 |
-
width: @mobile_image_size;
|
126 |
-
}
|
127 |
-
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
-
.sow-testimonial-text {
|
132 |
-
margin-left: 33%;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
&.sow-user-right {
|
137 |
-
|
138 |
-
.sow-testimonial-user {
|
139 |
-
width: 33%;
|
140 |
-
float: right;
|
141 |
-
padding: @testimonial_padding @testimonial_padding @testimonial_padding @testimonial_padding*2;
|
142 |
-
|
143 |
-
img {
|
144 |
-
width: @image_size;
|
145 |
-
margin: 0 auto;
|
146 |
-
max-width: 100%;
|
147 |
-
height: auto;
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
.sow-testimonial-text {
|
152 |
-
margin-right: 33%;
|
153 |
-
}
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
}
|
158 |
-
|
159 |
-
&.sow-layout-text-above,
|
160 |
-
&.sow-layout-text-below {
|
161 |
-
|
162 |
-
.sow-testimonial-user {
|
163 |
-
width: auto;
|
164 |
-
padding: @testimonial_padding;
|
165 |
-
|
166 |
-
img {
|
167 |
-
width: @image_size;
|
168 |
-
height: auto;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
|
172 |
-
.sow-testimonial-text {
|
173 |
-
|
174 |
-
}
|
175 |
-
|
176 |
-
}
|
177 |
-
|
178 |
-
&.sow-layout-text-below {
|
179 |
-
|
180 |
-
.sow-testimonial-user {
|
181 |
-
padding:@testimonial_padding;
|
182 |
-
}
|
183 |
-
|
184 |
-
}
|
185 |
-
|
186 |
-
}
|
187 |
-
|
188 |
-
}
|
1 |
+
@import "../../../base/less/mixins";
|
2 |
+
|
3 |
+
.widget-function('import_google_font');
|
4 |
+
|
5 |
+
@testimonial_padding: 10px;
|
6 |
+
|
7 |
+
@testimonial_background: transparent;
|
8 |
+
@text_background: #f0f0f0;
|
9 |
+
@text_color: #666;
|
10 |
+
@text_border_radius: 4px;
|
11 |
+
|
12 |
+
@title_font_family: default;
|
13 |
+
@title_font_weight: default;
|
14 |
+
@title_font_size: default;
|
15 |
+
@name_font_family: default;
|
16 |
+
@name_font_weight: default;
|
17 |
+
@name_font_size: default;
|
18 |
+
@location_font_family: default;
|
19 |
+
@location_font_weight: default;
|
20 |
+
@location_font_size: default;
|
21 |
+
@text_font_family: default;
|
22 |
+
@text_font_weight: default;
|
23 |
+
@text_font_size: default;
|
24 |
+
|
25 |
+
// Testimonial sizes
|
26 |
+
@testimonial_size: 33.333%;
|
27 |
+
@tablet_testimonial_size: 50%;
|
28 |
+
@mobile_testimonial_size: 100%;
|
29 |
+
|
30 |
+
// Image Sizes
|
31 |
+
@image_size: 75px;
|
32 |
+
@tablet_image_size: default;
|
33 |
+
@mobile_image_size: default;
|
34 |
+
|
35 |
+
// Responsive breakpoints
|
36 |
+
@tablet_width: 800px;
|
37 |
+
@mobile_width: 480px;
|
38 |
+
|
39 |
+
.widget-title {
|
40 |
+
font-family: @title_font_family;
|
41 |
+
font-weight: @title_font_weight;
|
42 |
+
font-size: @title_font_size;
|
43 |
+
}
|
44 |
+
|
45 |
+
.sow-testimonials {
|
46 |
+
|
47 |
+
.sow-testimonial-wrapper {
|
48 |
+
width: @testimonial_size;
|
49 |
+
|
50 |
+
@media screen and (max-width: @tablet_width) {
|
51 |
+
width: @tablet_testimonial_size;
|
52 |
+
}
|
53 |
+
|
54 |
+
@media screen and (max-width: @mobile_width) {
|
55 |
+
width: @mobile_testimonial_size;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
.sow-testimonial {
|
60 |
+
background: @testimonial_background;
|
61 |
+
}
|
62 |
+
|
63 |
+
.sow-testimonial-name {
|
64 |
+
font-family: @name_font_family;
|
65 |
+
font-weight: @name_font_weight;
|
66 |
+
font-size: @name_font_size;
|
67 |
+
}
|
68 |
+
|
69 |
+
.sow-testimonial-location {
|
70 |
+
font-family: @location_font_family;
|
71 |
+
font-weight: @location_font_weight;
|
72 |
+
font-size: @location_font_size;
|
73 |
+
}
|
74 |
+
|
75 |
+
.sow-testimonial-text {
|
76 |
+
font-family: @text_font_family;
|
77 |
+
font-weight: @text_font_weight;
|
78 |
+
font-size: @text_font_size;
|
79 |
+
background: @text_background;
|
80 |
+
color: @text_color;
|
81 |
+
padding: @testimonial_padding @testimonial_padding*1.5;
|
82 |
+
.rounded(@text_border_radius);
|
83 |
+
}
|
84 |
+
|
85 |
+
.sow-round-image-frame {
|
86 |
+
border-radius: @image_size;
|
87 |
+
width: @image_size;
|
88 |
+
height: @image_size;
|
89 |
+
|
90 |
+
@media screen and (max-width: @tablet_width) {
|
91 |
+
width: @tablet_image_size;
|
92 |
+
height: @tablet_image_size;
|
93 |
+
}
|
94 |
+
|
95 |
+
@media screen and (max-width: @mobile_width) {
|
96 |
+
width: @mobile_image_size;
|
97 |
+
height: @mobile_image_size;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
// All the specific layouts
|
102 |
+
|
103 |
+
.sow-testimonial-wrapper {
|
104 |
+
.clearfix();
|
105 |
+
|
106 |
+
&.sow-layout-side {
|
107 |
+
|
108 |
+
&.sow-user-left,
|
109 |
+
&.sow-user-middle {
|
110 |
+
.sow-testimonial-user {
|
111 |
+
width: 33%;
|
112 |
+
float: left;
|
113 |
+
padding: @testimonial_padding @testimonial_padding*2 @testimonial_padding @testimonial_padding;
|
114 |
+
|
115 |
+
img {
|
116 |
+
margin: 0 auto;
|
117 |
+
max-width: 100%;
|
118 |
+
height: auto;
|
119 |
+
|
120 |
+
@media screen and (max-width: @tablet_width) {
|
121 |
+
width: @tablet_image_size;
|
122 |
+
}
|
123 |
+
|
124 |
+
@media screen and (max-width: @mobile_width) {
|
125 |
+
width: @mobile_image_size;
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
.sow-testimonial-text {
|
132 |
+
margin-left: 33%;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
&.sow-user-right {
|
137 |
+
|
138 |
+
.sow-testimonial-user {
|
139 |
+
width: 33%;
|
140 |
+
float: right;
|
141 |
+
padding: @testimonial_padding @testimonial_padding @testimonial_padding @testimonial_padding*2;
|
142 |
+
|
143 |
+
img {
|
144 |
+
width: @image_size;
|
145 |
+
margin: 0 auto;
|
146 |
+
max-width: 100%;
|
147 |
+
height: auto;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
.sow-testimonial-text {
|
152 |
+
margin-right: 33%;
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
&.sow-layout-text-above,
|
160 |
+
&.sow-layout-text-below {
|
161 |
+
|
162 |
+
.sow-testimonial-user {
|
163 |
+
width: auto;
|
164 |
+
padding: @testimonial_padding;
|
165 |
+
|
166 |
+
img {
|
167 |
+
width: @image_size;
|
168 |
+
height: auto;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
.sow-testimonial-text {
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
&.sow-layout-text-below {
|
179 |
+
|
180 |
+
.sow-testimonial-user {
|
181 |
+
padding:@testimonial_padding;
|
182 |
+
}
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
widgets/testimonial/testimonial.php
CHANGED
@@ -1,361 +1,369 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Widget Name: Testimonials
|
4 |
-
Description: Display some testimonials.
|
5 |
-
Author: SiteOrigin
|
6 |
-
Author URI: https://siteorigin.com
|
7 |
-
*/
|
8 |
-
|
9 |
-
class SiteOrigin_Widgets_Testimonials_Widget extends SiteOrigin_Widget {
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
-
parent::__construct(
|
13 |
-
'sow-testimonials',
|
14 |
-
__('SiteOrigin Testimonials', 'so-widgets-bundle'),
|
15 |
-
array(
|
16 |
-
'description' => __('Share your product/service testimonials in a variety of different ways.', 'so-widgets-bundle'),
|
17 |
-
'help' => 'https://siteorigin.com/widgets-bundle/testimonial-widget-documentation/'
|
18 |
-
),
|
19 |
-
array(
|
20 |
-
|
21 |
-
),
|
22 |
-
false,
|
23 |
-
plugin_dir_path( __FILE__ )
|
24 |
-
);
|
25 |
-
}
|
26 |
-
|
27 |
-
function initialize(){
|
28 |
-
$this->register_frontend_styles( array(
|
29 |
-
array(
|
30 |
-
'sow-testimonial',
|
31 |
-
plugin_dir_url(__FILE__) . 'css/style.css'
|
32 |
-
)
|
33 |
-
) );
|
34 |
-
}
|
35 |
-
|
36 |
-
function get_widget_form(){
|
37 |
-
return array(
|
38 |
-
'title' => array(
|
39 |
-
'type' => 'text',
|
40 |
-
'label' => __('Title', 'so-widgets-bundle'),
|
41 |
-
),
|
42 |
-
'testimonials' => array(
|
43 |
-
'type' => 'repeater',
|
44 |
-
'label' => __( 'Testimonials', 'so-widgets-bundle' ),
|
45 |
-
'item_name' => __( 'Testimonial', 'so-widgets-bundle' ),
|
46 |
-
'item_label' => array(
|
47 |
-
'selector' => "[id*='testimonials-name']",
|
48 |
-
'update_event' => 'change',
|
49 |
-
'value_method' => 'val'
|
50 |
-
),
|
51 |
-
'fields' => array(
|
52 |
-
'name' => array(
|
53 |
-
'type' => 'text',
|
54 |
-
'label' => __('Name', 'so-widgets-bundle'),
|
55 |
-
'description' => __('The author of the testimonial', 'so-widgets-bundle'),
|
56 |
-
),
|
57 |
-
|
58 |
-
'link_name' => array(
|
59 |
-
'type' => 'checkbox',
|
60 |
-
'label' => __('Link name', 'so-widgets-bundle'),
|
61 |
-
),
|
62 |
-
|
63 |
-
'location' => array(
|
64 |
-
'type' => 'text',
|
65 |
-
'label' => __('Location', 'so-widgets-bundle'),
|
66 |
-
'description' => __('Their location or company name', 'so-widgets-bundle'),
|
67 |
-
),
|
68 |
-
|
69 |
-
'image' => array(
|
70 |
-
'type' => 'media',
|
71 |
-
'label' => __('Image', 'so-widgets-bundle'),
|
72 |
-
),
|
73 |
-
|
74 |
-
'link_image' => array(
|
75 |
-
'type' => 'checkbox',
|
76 |
-
'label' => __('Link image', 'so-widgets-bundle'),
|
77 |
-
),
|
78 |
-
|
79 |
-
'text' => array(
|
80 |
-
'type' => 'tinymce',
|
81 |
-
'label' => __('Text', 'so-widgets-bundle'),
|
82 |
-
'description' => __('What your customer had to say', 'so-widgets-bundle'),
|
83 |
-
),
|
84 |
-
|
85 |
-
'url' => array(
|
86 |
-
'type' => 'text',
|
87 |
-
'label' => __('URL', 'so-widgets-bundle'),
|
88 |
-
),
|
89 |
-
|
90 |
-
'new_window' => array(
|
91 |
-
'type' => 'checkbox',
|
92 |
-
'label' => __('Open In New Window', 'so-widgets-bundle'),
|
93 |
-
),
|
94 |
-
)
|
95 |
-
),
|
96 |
-
|
97 |
-
'settings' => array(
|
98 |
-
'type' => 'section',
|
99 |
-
'label' => __('Settings', 'so-widgets-bundle'),
|
100 |
-
'fields' => array(
|
101 |
-
|
102 |
-
'per_line' => array(
|
103 |
-
'type' => 'slider',
|
104 |
-
'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
|
105 |
-
'min' => 1,
|
106 |
-
'max' => 5,
|
107 |
-
'integer' => true,
|
108 |
-
'default' => 3
|
109 |
-
),
|
110 |
-
|
111 |
-
'responsive' => array(
|
112 |
-
'type' => 'section',
|
113 |
-
'label' => __('Responsive', 'so-widgets-bundle'),
|
114 |
-
'hide' => true,
|
115 |
-
'fields' => array(
|
116 |
-
'tablet' => array(
|
117 |
-
'type' => 'section',
|
118 |
-
'label' => __('Tablet', 'so-widgets-bundle'),
|
119 |
-
'fields' => array(
|
120 |
-
'per_line' => array(
|
121 |
-
'type' => 'slider',
|
122 |
-
'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
|
123 |
-
'min' => 1,
|
124 |
-
'max' => 5,
|
125 |
-
'integer' => true,
|
126 |
-
'default' => 2
|
127 |
-
),
|
128 |
-
'image_size' => array(
|
129 |
-
'type' => 'slider',
|
130 |
-
'label' => __( 'Image size', 'so-widgets-bundle' ),
|
131 |
-
'integer' => true,
|
132 |
-
'default' => 50,
|
133 |
-
'max' => 150,
|
134 |
-
'min' => 20,
|
135 |
-
),
|
136 |
-
'width' => array(
|
137 |
-
'type' => 'text',
|
138 |
-
'label' => __( 'Resolution', 'so-widgets-bundle' ),
|
139 |
-
'description' => __( 'The resolution to treat as a mobile resolution.', 'so-widgets-bundle' ),
|
140 |
-
'default' => 800,
|
141 |
-
'sanitize' => 'intval',
|
142 |
-
)
|
143 |
-
)
|
144 |
-
),
|
145 |
-
'mobile' => array(
|
146 |
-
'type' => 'section',
|
147 |
-
'label' => __('Mobile Phone', 'so-widgets-bundle'),
|
148 |
-
'fields' => array(
|
149 |
-
'per_line' => array(
|
150 |
-
'type' => 'slider',
|
151 |
-
'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
|
152 |
-
'min' => 1,
|
153 |
-
'max' => 5,
|
154 |
-
'integer' => true,
|
155 |
-
'default' => 1
|
156 |
-
),
|
157 |
-
'image_size' => array(
|
158 |
-
'type' => 'slider',
|
159 |
-
'label' => __( 'Image size', 'so-widgets-bundle' ),
|
160 |
-
'integer' => true,
|
161 |
-
'default' => 50,
|
162 |
-
'max' => 150,
|
163 |
-
'min' => 20,
|
164 |
-
),
|
165 |
-
'width' => array(
|
166 |
-
'type' => 'text',
|
167 |
-
'label' => __( 'Resolution', 'so-widgets-bundle' ),
|
168 |
-
'description' => __( 'The resolution to treat as a tablet resolution.', 'so-widgets-bundle' ),
|
169 |
-
'default' => 480,
|
170 |
-
'sanitize' => 'intval',
|
171 |
-
)
|
172 |
-
)
|
173 |
-
)
|
174 |
-
|
175 |
-
)
|
176 |
-
),
|
177 |
-
)
|
178 |
-
),
|
179 |
-
|
180 |
-
'design' => array(
|
181 |
-
'type' => 'section',
|
182 |
-
'label' => __('Design', 'so-widgets-bundle'),
|
183 |
-
'fields' => array(
|
184 |
-
|
185 |
-
'image' => array(
|
186 |
-
'type' => 'section',
|
187 |
-
'label' => __('Image', 'so-widgets-bundle'),
|
188 |
-
'fields' => array(
|
189 |
-
'image_shape' => array(
|
190 |
-
'type' => 'select',
|
191 |
-
'label' => __('Testimonial image shape', 'so-widgets-bundle'),
|
192 |
-
'options' => array(
|
193 |
-
'square' => __('Square', 'so-widgets-bundle'),
|
194 |
-
'round' => __('Round', 'so-widgets-bundle'),
|
195 |
-
),
|
196 |
-
'default' => 'square',
|
197 |
-
),
|
198 |
-
|
199 |
-
'image_size' => array(
|
200 |
-
'type' => 'slider',
|
201 |
-
'label' => __('Image size', 'so-widgets-bundle'),
|
202 |
-
'integer' => true,
|
203 |
-
'default' => 50,
|
204 |
-
'max' => 150,
|
205 |
-
'min' => 20,
|
206 |
-
),
|
207 |
-
),
|
208 |
-
),
|
209 |
-
|
210 |
-
'colors' => array(
|
211 |
-
'type' => 'section',
|
212 |
-
'label' => __('Colors', 'so-widgets-bundle'),
|
213 |
-
'fields' => array(
|
214 |
-
'testimonial_background' => array(
|
215 |
-
'type' => 'color',
|
216 |
-
'label' => __('Widget Background', 'so-widgets-bundle'),
|
217 |
-
),
|
218 |
-
'text_background' => array(
|
219 |
-
'type' => 'color',
|
220 |
-
'label' => __('Text Background', 'so-widgets-bundle'),
|
221 |
-
'default' => '#f0f0f0',
|
222 |
-
),
|
223 |
-
'text_color' => array(
|
224 |
-
'type' => 'color',
|
225 |
-
'label' => __('Text Color', 'so-widgets-bundle'),
|
226 |
-
'default' => '#444444',
|
227 |
-
),
|
228 |
-
),
|
229 |
-
),
|
230 |
-
|
231 |
-
'padding' => array(
|
232 |
-
'type' => 'slider',
|
233 |
-
'label' => __('Padding', 'so-widgets-bundle'),
|
234 |
-
'integer' => true,
|
235 |
-
'default' => 10,
|
236 |
-
'max' => 100,
|
237 |
-
'min' => 0,
|
238 |
-
),
|
239 |
-
|
240 |
-
'border_radius' => array(
|
241 |
-
'type' => 'slider',
|
242 |
-
'label' => __( 'Testimonial Radius', 'so-widgets-bundle' ),
|
243 |
-
'integer' => true,
|
244 |
-
'default' => 4,
|
245 |
-
'max' => 100,
|
246 |
-
'min' => 0,
|
247 |
-
),
|
248 |
-
|
249 |
-
'user_position' => array(
|
250 |
-
'type' => 'select',
|
251 |
-
'label' => __('User position', 'so-widgets-bundle'),
|
252 |
-
'options' => array(
|
253 |
-
'left' => __('Left', 'so-widgets-bundle'),
|
254 |
-
'right' => __('Right', 'so-widgets-bundle'),
|
255 |
-
'middle' => __('Middle', 'so-widgets-bundle'),
|
256 |
-
),
|
257 |
-
'default' => 'left',
|
258 |
-
),
|
259 |
-
|
260 |
-
'layout' => array(
|
261 |
-
'type' => 'select',
|
262 |
-
'label' => __('Testimonial layout', 'so-widgets-bundle'),
|
263 |
-
'options' => array(
|
264 |
-
'side' => __('Side by side', 'so-widgets-bundle'),
|
265 |
-
'text_above' => __('Text above user', 'so-widgets-bundle'),
|
266 |
-
'text_below' => __('Text below user', 'so-widgets-bundle'),
|
267 |
-
),
|
268 |
-
'default' => 'side',
|
269 |
-
),
|
270 |
-
),
|
271 |
-
),
|
272 |
-
);
|
273 |
-
}
|
274 |
-
|
275 |
-
function caret_svg(){
|
276 |
-
static $done = false;
|
277 |
-
if( $done ) return;
|
278 |
-
|
279 |
-
?>
|
280 |
-
<svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
281 |
-
<defs>
|
282 |
-
<symbol id="icon-caret-down" viewBox="0 0 585 1024">
|
283 |
-
<title>caret-down</title>
|
284 |
-
<path class="path1" d="M585.143 402.286q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714 25.714-10.857h512q14.857 0 25.714 10.857t10.857 25.714z"></path>
|
285 |
-
</symbol>
|
286 |
-
<symbol id="icon-caret-up" viewBox="0 0 585 1024">
|
287 |
-
<title>caret-up</title>
|
288 |
-
<path class="path1" d="M585.143 694.857q0 14.857-10.857 25.714t-25.714 10.857h-512q-14.857 0-25.714-10.857t-10.857-25.714 10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
|
289 |
-
</symbol>
|
290 |
-
<symbol id="icon-caret-left" viewBox="0 0 366 1024">
|
291 |
-
<title>caret-left</title>
|
292 |
-
<path class="path1" d="M365.714 256v512q0 14.857-10.857 25.714t-25.714 10.857-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857 10.857 25.714z"></path>
|
293 |
-
</symbol>
|
294 |
-
<symbol id="icon-caret-right" viewBox="0 0 366 1024">
|
295 |
-
<title>caret-right</title>
|
296 |
-
<path class="path1" d="M329.143 512q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857-10.857-25.714v-512q0-14.857 10.857-25.714t25.714-10.857 25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
|
297 |
-
</symbol>
|
298 |
-
</defs>
|
299 |
-
</svg>
|
300 |
-
<?php
|
301 |
-
$done = true;
|
302 |
-
}
|
303 |
-
|
304 |
-
function get_less_variables( $instance ){
|
305 |
-
return array (
|
306 |
-
'image_size' => intval($instance['design']['image']['image_size']) . 'px',
|
307 |
-
'testimonial_size' => round(100/$instance['settings']['per_line'], 4) . '%',
|
308 |
-
'testimonial_padding' => intval($instance['design']['padding']) . 'px',
|
309 |
-
'testimonial_background' => $instance['design']['colors']['testimonial_background'],
|
310 |
-
|
311 |
-
// The text block
|
312 |
-
'text_border_radius' => intval($instance['design']['border_radius']) . 'px',
|
313 |
-
'text_background' => $instance['design']['colors']['text_background'],
|
314 |
-
'text_color' => $instance['design']['colors']['text_color'],
|
315 |
-
|
316 |
-
// All the responsive sizes
|
317 |
-
'tablet_testimonial_size' => round(100/$instance['settings']['responsive']['tablet']['per_line'], 4) . '%',
|
318 |
-
'tablet_image_size' => intval( $instance['settings']['responsive']['tablet']['image_size'] ) . 'px',
|
319 |
-
'tablet_width' => intval($instance['settings']['responsive']['tablet']['width']) . 'px',
|
320 |
-
'mobile_testimonial_size' => round(100/$instance['settings']['responsive']['mobile']['per_line'], 4) . '%',
|
321 |
-
'mobile_image_size' => intval( $instance['settings']['responsive']['mobile']['image_size'] ) . 'px',
|
322 |
-
'mobile_width' => intval($instance['settings']['responsive']['mobile']['width']) . 'px',
|
323 |
-
);
|
324 |
-
}
|
325 |
-
|
326 |
-
function get_template_variables( $instance, $args ){
|
327 |
-
return array(
|
328 |
-
'testimonials' => !empty($instance['testimonials']) ? $instance['testimonials'] : array(),
|
329 |
-
'settings' => $instance['settings'],
|
330 |
-
'design' => $instance['design'],
|
331 |
-
);
|
332 |
-
}
|
333 |
-
|
334 |
-
function testimonial_user_image( $image_id, $design ){
|
335 |
-
if ( ! empty( $image_id ) ) {
|
336 |
-
if( $design['image']['image_shape'] == 'square') {
|
337 |
-
return wp_get_attachment_image( $image_id, array( $design['image']['image_size'], $design['image']['image_size'] ), false, array(
|
338 |
-
'class' => 'sow-image-shape-' . $design['image']['image_shape'],
|
339 |
-
) );
|
340 |
-
}
|
341 |
-
else {
|
342 |
-
$src = wp_get_attachment_image_src( $image_id, array( $design['image']['image_size'], $design['image']['image_size'] ) );
|
343 |
-
return '<div class="sow-round-image-frame" style="background-image: url(' . esc_url( $src[0] ) . ');"></div>';
|
344 |
-
}
|
345 |
-
}
|
346 |
-
}
|
347 |
-
|
348 |
-
function testimonial_pointer( $design ){
|
349 |
-
|
350 |
-
}
|
351 |
-
|
352 |
-
function testimonial_wrapper_class($design){
|
353 |
-
$classes = array();
|
354 |
-
$classes[] = 'sow-user-' . sanitize_html_class( $design['user_position'] );
|
355 |
-
$classes[] = 'sow-layout-' . sanitize_html_class( $design['layout'] );
|
356 |
-
return str_replace( '_', '-', implode( ' ', $classes ) );
|
357 |
-
}
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Widget Name: Testimonials
|
4 |
+
Description: Display some testimonials.
|
5 |
+
Author: SiteOrigin
|
6 |
+
Author URI: https://siteorigin.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
class SiteOrigin_Widgets_Testimonials_Widget extends SiteOrigin_Widget {
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
parent::__construct(
|
13 |
+
'sow-testimonials',
|
14 |
+
__('SiteOrigin Testimonials', 'so-widgets-bundle'),
|
15 |
+
array(
|
16 |
+
'description' => __('Share your product/service testimonials in a variety of different ways.', 'so-widgets-bundle'),
|
17 |
+
'help' => 'https://siteorigin.com/widgets-bundle/testimonial-widget-documentation/'
|
18 |
+
),
|
19 |
+
array(
|
20 |
+
|
21 |
+
),
|
22 |
+
false,
|
23 |
+
plugin_dir_path( __FILE__ )
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
function initialize(){
|
28 |
+
$this->register_frontend_styles( array(
|
29 |
+
array(
|
30 |
+
'sow-testimonial',
|
31 |
+
plugin_dir_url(__FILE__) . 'css/style.css'
|
32 |
+
)
|
33 |
+
) );
|
34 |
+
}
|
35 |
+
|
36 |
+
function get_widget_form(){
|
37 |
+
return array(
|
38 |
+
'title' => array(
|
39 |
+
'type' => 'text',
|
40 |
+
'label' => __('Title', 'so-widgets-bundle'),
|
41 |
+
),
|
42 |
+
'testimonials' => array(
|
43 |
+
'type' => 'repeater',
|
44 |
+
'label' => __( 'Testimonials', 'so-widgets-bundle' ),
|
45 |
+
'item_name' => __( 'Testimonial', 'so-widgets-bundle' ),
|
46 |
+
'item_label' => array(
|
47 |
+
'selector' => "[id*='testimonials-name']",
|
48 |
+
'update_event' => 'change',
|
49 |
+
'value_method' => 'val'
|
50 |
+
),
|
51 |
+
'fields' => array(
|
52 |
+
'name' => array(
|
53 |
+
'type' => 'text',
|
54 |
+
'label' => __('Name', 'so-widgets-bundle'),
|
55 |
+
'description' => __('The author of the testimonial', 'so-widgets-bundle'),
|
56 |
+
),
|
57 |
+
|
58 |
+
'link_name' => array(
|
59 |
+
'type' => 'checkbox',
|
60 |
+
'label' => __('Link name', 'so-widgets-bundle'),
|
61 |
+
),
|
62 |
+
|
63 |
+
'location' => array(
|
64 |
+
'type' => 'text',
|
65 |
+
'label' => __('Location', 'so-widgets-bundle'),
|
66 |
+
'description' => __('Their location or company name', 'so-widgets-bundle'),
|
67 |
+
),
|
68 |
+
|
69 |
+
'image' => array(
|
70 |
+
'type' => 'media',
|
71 |
+
'label' => __('Image', 'so-widgets-bundle'),
|
72 |
+
),
|
73 |
+
|
74 |
+
'link_image' => array(
|
75 |
+
'type' => 'checkbox',
|
76 |
+
'label' => __('Link image', 'so-widgets-bundle'),
|
77 |
+
),
|
78 |
+
|
79 |
+
'text' => array(
|
80 |
+
'type' => 'tinymce',
|
81 |
+
'label' => __('Text', 'so-widgets-bundle'),
|
82 |
+
'description' => __('What your customer had to say', 'so-widgets-bundle'),
|
83 |
+
),
|
84 |
+
|
85 |
+
'url' => array(
|
86 |
+
'type' => 'text',
|
87 |
+
'label' => __('URL', 'so-widgets-bundle'),
|
88 |
+
),
|
89 |
+
|
90 |
+
'new_window' => array(
|
91 |
+
'type' => 'checkbox',
|
92 |
+
'label' => __('Open In New Window', 'so-widgets-bundle'),
|
93 |
+
),
|
94 |
+
)
|
95 |
+
),
|
96 |
+
|
97 |
+
'settings' => array(
|
98 |
+
'type' => 'section',
|
99 |
+
'label' => __('Settings', 'so-widgets-bundle'),
|
100 |
+
'fields' => array(
|
101 |
+
|
102 |
+
'per_line' => array(
|
103 |
+
'type' => 'slider',
|
104 |
+
'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
|
105 |
+
'min' => 1,
|
106 |
+
'max' => 5,
|
107 |
+
'integer' => true,
|
108 |
+
'default' => 3
|
109 |
+
),
|
110 |
+
|
111 |
+
'responsive' => array(
|
112 |
+
'type' => 'section',
|
113 |
+
'label' => __('Responsive', 'so-widgets-bundle'),
|
114 |
+
'hide' => true,
|
115 |
+
'fields' => array(
|
116 |
+
'tablet' => array(
|
117 |
+
'type' => 'section',
|
118 |
+
'label' => __('Tablet', 'so-widgets-bundle'),
|
119 |
+
'fields' => array(
|
120 |
+
'per_line' => array(
|
121 |
+
'type' => 'slider',
|
122 |
+
'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
|
123 |
+
'min' => 1,
|
124 |
+
'max' => 5,
|
125 |
+
'integer' => true,
|
126 |
+
'default' => 2
|
127 |
+
),
|
128 |
+
'image_size' => array(
|
129 |
+
'type' => 'slider',
|
130 |
+
'label' => __( 'Image size', 'so-widgets-bundle' ),
|
131 |
+
'integer' => true,
|
132 |
+
'default' => 50,
|
133 |
+
'max' => 150,
|
134 |
+
'min' => 20,
|
135 |
+
),
|
136 |
+
'width' => array(
|
137 |
+
'type' => 'text',
|
138 |
+
'label' => __( 'Resolution', 'so-widgets-bundle' ),
|
139 |
+
'description' => __( 'The resolution to treat as a mobile resolution.', 'so-widgets-bundle' ),
|
140 |
+
'default' => 800,
|
141 |
+
'sanitize' => 'intval',
|
142 |
+
)
|
143 |
+
)
|
144 |
+
),
|
145 |
+
'mobile' => array(
|
146 |
+
'type' => 'section',
|
147 |
+
'label' => __('Mobile Phone', 'so-widgets-bundle'),
|
148 |
+
'fields' => array(
|
149 |
+
'per_line' => array(
|
150 |
+
'type' => 'slider',
|
151 |
+
'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
|
152 |
+
'min' => 1,
|
153 |
+
'max' => 5,
|
154 |
+
'integer' => true,
|
155 |
+
'default' => 1
|
156 |
+
),
|
157 |
+
'image_size' => array(
|
158 |
+
'type' => 'slider',
|
159 |
+
'label' => __( 'Image size', 'so-widgets-bundle' ),
|
160 |
+
'integer' => true,
|
161 |
+
'default' => 50,
|
162 |
+
'max' => 150,
|
163 |
+
'min' => 20,
|
164 |
+
),
|
165 |
+
'width' => array(
|
166 |
+
'type' => 'text',
|
167 |
+
'label' => __( 'Resolution', 'so-widgets-bundle' ),
|
168 |
+
'description' => __( 'The resolution to treat as a tablet resolution.', 'so-widgets-bundle' ),
|
169 |
+
'default' => 480,
|
170 |
+
'sanitize' => 'intval',
|
171 |
+
)
|
172 |
+
)
|
173 |
+
)
|
174 |
+
|
175 |
+
)
|
176 |
+
),
|
177 |
+
)
|
178 |
+
),
|
179 |
+
|
180 |
+
'design' => array(
|
181 |
+
'type' => 'section',
|
182 |
+
'label' => __('Design', 'so-widgets-bundle'),
|
183 |
+
'fields' => array(
|
184 |
+
|
185 |
+
'image' => array(
|
186 |
+
'type' => 'section',
|
187 |
+
'label' => __('Image', 'so-widgets-bundle'),
|
188 |
+
'fields' => array(
|
189 |
+
'image_shape' => array(
|
190 |
+
'type' => 'select',
|
191 |
+
'label' => __('Testimonial image shape', 'so-widgets-bundle'),
|
192 |
+
'options' => array(
|
193 |
+
'square' => __('Square', 'so-widgets-bundle'),
|
194 |
+
'round' => __('Round', 'so-widgets-bundle'),
|
195 |
+
),
|
196 |
+
'default' => 'square',
|
197 |
+
),
|
198 |
+
|
199 |
+
'image_size' => array(
|
200 |
+
'type' => 'slider',
|
201 |
+
'label' => __('Image size', 'so-widgets-bundle'),
|
202 |
+
'integer' => true,
|
203 |
+
'default' => 50,
|
204 |
+
'max' => 150,
|
205 |
+
'min' => 20,
|
206 |
+
),
|
207 |
+
),
|
208 |
+
),
|
209 |
+
|
210 |
+
'colors' => array(
|
211 |
+
'type' => 'section',
|
212 |
+
'label' => __('Colors', 'so-widgets-bundle'),
|
213 |
+
'fields' => array(
|
214 |
+
'testimonial_background' => array(
|
215 |
+
'type' => 'color',
|
216 |
+
'label' => __('Widget Background', 'so-widgets-bundle'),
|
217 |
+
),
|
218 |
+
'text_background' => array(
|
219 |
+
'type' => 'color',
|
220 |
+
'label' => __('Text Background', 'so-widgets-bundle'),
|
221 |
+
'default' => '#f0f0f0',
|
222 |
+
),
|
223 |
+
'text_color' => array(
|
224 |
+
'type' => 'color',
|
225 |
+
'label' => __('Text Color', 'so-widgets-bundle'),
|
226 |
+
'default' => '#444444',
|
227 |
+
),
|
228 |
+
),
|
229 |
+
),
|
230 |
+
|
231 |
+
'padding' => array(
|
232 |
+
'type' => 'slider',
|
233 |
+
'label' => __('Padding', 'so-widgets-bundle'),
|
234 |
+
'integer' => true,
|
235 |
+
'default' => 10,
|
236 |
+
'max' => 100,
|
237 |
+
'min' => 0,
|
238 |
+
),
|
239 |
+
|
240 |
+
'border_radius' => array(
|
241 |
+
'type' => 'slider',
|
242 |
+
'label' => __( 'Testimonial Radius', 'so-widgets-bundle' ),
|
243 |
+
'integer' => true,
|
244 |
+
'default' => 4,
|
245 |
+
'max' => 100,
|
246 |
+
'min' => 0,
|
247 |
+
),
|
248 |
+
|
249 |
+
'user_position' => array(
|
250 |
+
'type' => 'select',
|
251 |
+
'label' => __('User position', 'so-widgets-bundle'),
|
252 |
+
'options' => array(
|
253 |
+
'left' => __('Left', 'so-widgets-bundle'),
|
254 |
+
'right' => __('Right', 'so-widgets-bundle'),
|
255 |
+
'middle' => __('Middle', 'so-widgets-bundle'),
|
256 |
+
),
|
257 |
+
'default' => 'left',
|
258 |
+
),
|
259 |
+
|
260 |
+
'layout' => array(
|
261 |
+
'type' => 'select',
|
262 |
+
'label' => __('Testimonial layout', 'so-widgets-bundle'),
|
263 |
+
'options' => array(
|
264 |
+
'side' => __('Side by side', 'so-widgets-bundle'),
|
265 |
+
'text_above' => __('Text above user', 'so-widgets-bundle'),
|
266 |
+
'text_below' => __('Text below user', 'so-widgets-bundle'),
|
267 |
+
),
|
268 |
+
'default' => 'side',
|
269 |
+
),
|
270 |
+
),
|
271 |
+
),
|
272 |
+
);
|
273 |
+
}
|
274 |
+
|
275 |
+
function caret_svg(){
|
276 |
+
static $done = false;
|
277 |
+
if( $done ) return;
|
278 |
+
|
279 |
+
?>
|
280 |
+
<svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
281 |
+
<defs>
|
282 |
+
<symbol id="icon-caret-down" viewBox="0 0 585 1024">
|
283 |
+
<title>caret-down</title>
|
284 |
+
<path class="path1" d="M585.143 402.286q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714 25.714-10.857h512q14.857 0 25.714 10.857t10.857 25.714z"></path>
|
285 |
+
</symbol>
|
286 |
+
<symbol id="icon-caret-up" viewBox="0 0 585 1024">
|
287 |
+
<title>caret-up</title>
|
288 |
+
<path class="path1" d="M585.143 694.857q0 14.857-10.857 25.714t-25.714 10.857h-512q-14.857 0-25.714-10.857t-10.857-25.714 10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
|
289 |
+
</symbol>
|
290 |
+
<symbol id="icon-caret-left" viewBox="0 0 366 1024">
|
291 |
+
<title>caret-left</title>
|
292 |
+
<path class="path1" d="M365.714 256v512q0 14.857-10.857 25.714t-25.714 10.857-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857 10.857 25.714z"></path>
|
293 |
+
</symbol>
|
294 |
+
<symbol id="icon-caret-right" viewBox="0 0 366 1024">
|
295 |
+
<title>caret-right</title>
|
296 |
+
<path class="path1" d="M329.143 512q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857-10.857-25.714v-512q0-14.857 10.857-25.714t25.714-10.857 25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
|
297 |
+
</symbol>
|
298 |
+
</defs>
|
299 |
+
</svg>
|
300 |
+
<?php
|
301 |
+
$done = true;
|
302 |
+
}
|
303 |
+
|
304 |
+
function get_less_variables( $instance ){
|
305 |
+
return array (
|
306 |
+
'image_size' => intval($instance['design']['image']['image_size']) . 'px',
|
307 |
+
'testimonial_size' => round(100/$instance['settings']['per_line'], 4) . '%',
|
308 |
+
'testimonial_padding' => intval($instance['design']['padding']) . 'px',
|
309 |
+
'testimonial_background' => $instance['design']['colors']['testimonial_background'],
|
310 |
+
|
311 |
+
// The text block
|
312 |
+
'text_border_radius' => intval($instance['design']['border_radius']) . 'px',
|
313 |
+
'text_background' => $instance['design']['colors']['text_background'],
|
314 |
+
'text_color' => $instance['design']['colors']['text_color'],
|
315 |
+
|
316 |
+
// All the responsive sizes
|
317 |
+
'tablet_testimonial_size' => round(100/$instance['settings']['responsive']['tablet']['per_line'], 4) . '%',
|
318 |
+
'tablet_image_size' => intval( $instance['settings']['responsive']['tablet']['image_size'] ) . 'px',
|
319 |
+
'tablet_width' => intval($instance['settings']['responsive']['tablet']['width']) . 'px',
|
320 |
+
'mobile_testimonial_size' => round(100/$instance['settings']['responsive']['mobile']['per_line'], 4) . '%',
|
321 |
+
'mobile_image_size' => intval( $instance['settings']['responsive']['mobile']['image_size'] ) . 'px',
|
322 |
+
'mobile_width' => intval($instance['settings']['responsive']['mobile']['width']) . 'px',
|
323 |
+
);
|
324 |
+
}
|
325 |
+
|
326 |
+
function get_template_variables( $instance, $args ){
|
327 |
+
return array(
|
328 |
+
'testimonials' => !empty($instance['testimonials']) ? $instance['testimonials'] : array(),
|
329 |
+
'settings' => $instance['settings'],
|
330 |
+
'design' => $instance['design'],
|
331 |
+
);
|
332 |
+
}
|
333 |
+
|
334 |
+
function testimonial_user_image( $image_id, $design ){
|
335 |
+
if ( ! empty( $image_id ) ) {
|
336 |
+
if( $design['image']['image_shape'] == 'square') {
|
337 |
+
return wp_get_attachment_image( $image_id, array( $design['image']['image_size'], $design['image']['image_size'] ), false, array(
|
338 |
+
'class' => 'sow-image-shape-' . $design['image']['image_shape'],
|
339 |
+
) );
|
340 |
+
}
|
341 |
+
else {
|
342 |
+
$src = wp_get_attachment_image_src( $image_id, array( $design['image']['image_size'], $design['image']['image_size'] ) );
|
343 |
+
return '<div class="sow-round-image-frame" style="background-image: url(' . esc_url( $src[0] ) . ');"></div>';
|
344 |
+
}
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
function testimonial_pointer( $design ){
|
349 |
+
|
350 |
+
}
|
351 |
+
|
352 |
+
function testimonial_wrapper_class($design){
|
353 |
+
$classes = array();
|
354 |
+
$classes[] = 'sow-user-' . sanitize_html_class( $design['user_position'] );
|
355 |
+
$classes[] = 'sow-layout-' . sanitize_html_class( $design['layout'] );
|
356 |
+
return str_replace( '_', '-', implode( ' ', $classes ) );
|
357 |
+
}
|
358 |
+
|
359 |
+
function get_form_teaser(){
|
360 |
+
if( class_exists( 'SiteOrigin_Premium' ) ) return false;
|
361 |
+
return sprintf(
|
362 |
+
__( 'Get more font customization options with %sSiteOrigin Premium%s', 'so-widgets-bundle' ),
|
363 |
+
'<a href="https://siteorigin.com/downloads/premium/?featured_addon=plugin/testimonial" target="_blank" rel="noopener noreferrer">',
|
364 |
+
'</a>'
|
365 |
+
);
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
siteorigin_widget_register( 'sow-testimonials', __FILE__, 'SiteOrigin_Widgets_Testimonials_Widget' );
|
widgets/testimonial/tpl/default.php
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @var $design
|
4 |
-
* @var $settings
|
5 |
-
* @var $testimonials
|
6 |
-
*/
|
7 |
-
?>
|
8 |
-
<?php if( !empty( $instance['title'] ) ) echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'] ?>
|
9 |
-
<?php $this->caret_svg() ?>
|
10 |
-
<div class="sow-testimonials">
|
11 |
-
<?php foreach( $testimonials as $testimonial ) : ?>
|
12 |
-
<?php
|
13 |
-
$url = $testimonial['url'];
|
14 |
-
$new_window = $testimonial['new_window'];
|
15 |
-
$location = $testimonial['location'];
|
16 |
-
$image_id = $testimonial['image'];
|
17 |
-
$link_location = ! empty( $url );
|
18 |
-
$link_name = ! empty( $testimonial['link_name'] ) && ! empty( $url );
|
19 |
-
$link_image = ! empty( $testimonial['link_image'] ) && ! empty( $url );
|
20 |
-
?>
|
21 |
-
<div class="sow-testimonial-wrapper <?php echo $this->testimonial_wrapper_class($design) ?>">
|
22 |
-
<div class="sow-testimonial">
|
23 |
-
<?php if( strpos($design['layout'], '_above') !== false ) : ?>
|
24 |
-
<div class="sow-testimonial-text">
|
25 |
-
<?php echo wp_kses_post( $testimonial['text'] ) ?>
|
26 |
-
</div>
|
27 |
-
<?php endif; ?>
|
28 |
-
|
29 |
-
<div class="sow-testimonial-user">
|
30 |
-
<?php if( ! empty( $image_id ) ) : ?>
|
31 |
-
<div class="sow-image-wrapper">
|
32 |
-
<?php if( $link_image ) : ?>
|
33 |
-
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank" rel="noopener noreferrer"'; } ?>>
|
34 |
-
<?php endif; ?>
|
35 |
-
<?php echo $this->testimonial_user_image( $image_id, $design ); ?>
|
36 |
-
<?php if( $link_image ) : ?>
|
37 |
-
</a>
|
38 |
-
<?php endif; ?>
|
39 |
-
</div>
|
40 |
-
<?php endif; ?>
|
41 |
-
|
42 |
-
<div class="sow-text">
|
43 |
-
<?php if( $link_name ) : ?>
|
44 |
-
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank" rel="noopener noreferrer"'; } ?>>
|
45 |
-
<?php endif; ?>
|
46 |
-
<span class="sow-testimonial-name"><strong><?php echo esc_html( $testimonial['name'] ) ?></strong></span>
|
47 |
-
<?php if( $link_name ) : ?>
|
48 |
-
</a>
|
49 |
-
<?php endif; ?>
|
50 |
-
<?php if( $link_location ) : ?>
|
51 |
-
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank" rel="noopener noreferrer"'; } ?>>
|
52 |
-
<?php endif; ?>
|
53 |
-
<?php if( ! empty( $location ) ) : ?>
|
54 |
-
<span class="sow-testimonial-location"><?php echo esc_html( $location ) ?></span>
|
55 |
-
<?php endif; ?>
|
56 |
-
<?php if( $link_location ) : ?>
|
57 |
-
</a>
|
58 |
-
<?php endif; ?>
|
59 |
-
</div>
|
60 |
-
|
61 |
-
<?php // $this->testimonial_pointer($design) ?>
|
62 |
-
</div>
|
63 |
-
|
64 |
-
<?php if( strpos($design['layout'], '_above') === false ) : ?>
|
65 |
-
<div class="sow-testimonial-text">
|
66 |
-
<?php echo wp_kses_post( $testimonial['text'] ) ?>
|
67 |
-
</div>
|
68 |
-
<?php endif; ?>
|
69 |
-
</div>
|
70 |
-
</div>
|
71 |
-
<?php endforeach; ?>
|
72 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var $design
|
4 |
+
* @var $settings
|
5 |
+
* @var $testimonials
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<?php if( !empty( $instance['title'] ) ) echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'] ?>
|
9 |
+
<?php $this->caret_svg() ?>
|
10 |
+
<div class="sow-testimonials">
|
11 |
+
<?php foreach( $testimonials as $testimonial ) : ?>
|
12 |
+
<?php
|
13 |
+
$url = $testimonial['url'];
|
14 |
+
$new_window = $testimonial['new_window'];
|
15 |
+
$location = $testimonial['location'];
|
16 |
+
$image_id = $testimonial['image'];
|
17 |
+
$link_location = ! empty( $url );
|
18 |
+
$link_name = ! empty( $testimonial['link_name'] ) && ! empty( $url );
|
19 |
+
$link_image = ! empty( $testimonial['link_image'] ) && ! empty( $url );
|
20 |
+
?>
|
21 |
+
<div class="sow-testimonial-wrapper <?php echo $this->testimonial_wrapper_class($design) ?>">
|
22 |
+
<div class="sow-testimonial">
|
23 |
+
<?php if( strpos($design['layout'], '_above') !== false ) : ?>
|
24 |
+
<div class="sow-testimonial-text">
|
25 |
+
<?php echo wp_kses_post( $testimonial['text'] ) ?>
|
26 |
+
</div>
|
27 |
+
<?php endif; ?>
|
28 |
+
|
29 |
+
<div class="sow-testimonial-user">
|
30 |
+
<?php if( ! empty( $image_id ) ) : ?>
|
31 |
+
<div class="sow-image-wrapper">
|
32 |
+
<?php if( $link_image ) : ?>
|
33 |
+
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank" rel="noopener noreferrer"'; } ?>>
|
34 |
+
<?php endif; ?>
|
35 |
+
<?php echo $this->testimonial_user_image( $image_id, $design ); ?>
|
36 |
+
<?php if( $link_image ) : ?>
|
37 |
+
</a>
|
38 |
+
<?php endif; ?>
|
39 |
+
</div>
|
40 |
+
<?php endif; ?>
|
41 |
+
|
42 |
+
<div class="sow-text">
|
43 |
+
<?php if( $link_name ) : ?>
|
44 |
+
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank" rel="noopener noreferrer"'; } ?>>
|
45 |
+
<?php endif; ?>
|
46 |
+
<span class="sow-testimonial-name"><strong><?php echo esc_html( $testimonial['name'] ) ?></strong></span>
|
47 |
+
<?php if( $link_name ) : ?>
|
48 |
+
</a>
|
49 |
+
<?php endif; ?>
|
50 |
+
<?php if( $link_location ) : ?>
|
51 |
+
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank" rel="noopener noreferrer"'; } ?>>
|
52 |
+
<?php endif; ?>
|
53 |
+
<?php if( ! empty( $location ) ) : ?>
|
54 |
+
<span class="sow-testimonial-location"><?php echo esc_html( $location ) ?></span>
|
55 |
+
<?php endif; ?>
|
56 |
+
<?php if( $link_location ) : ?>
|
57 |
+
</a>
|
58 |
+
<?php endif; ?>
|
59 |
+
</div>
|
60 |
+
|
61 |
+
<?php // $this->testimonial_pointer($design) ?>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<?php if( strpos($design['layout'], '_above') === false ) : ?>
|
65 |
+
<div class="sow-testimonial-text">
|
66 |
+
<?php echo wp_kses_post( $testimonial['text'] ) ?>
|
67 |
+
</div>
|
68 |
+
<?php endif; ?>
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
<?php endforeach; ?>
|
72 |
+
</div>
|
widgets/video/css/html-player-responsive.css
CHANGED
@@ -1,5 +1 @@
|
|
1 |
-
|
2 |
-
iframe.me-plugin {
|
3 |
-
width: 100%;
|
4 |
-
height: 100%;
|
5 |
-
}
|
1 |
+
iframe.me-plugin{width:100%;height:100%}
|
|
|
|
|
|
|
|
widgets/video/css/skin.css
CHANGED
@@ -1,154 +1 @@
|
|
1 |
-
.mejs-overlay-button {
|
2 |
-
display: none;
|
3 |
-
}
|
4 |
-
.mejs-skin_one .mejs-overlay-button {
|
5 |
-
display: none;
|
6 |
-
}
|
7 |
-
.mejs-skin_one .mejs-button,
|
8 |
-
.mejs-skin_one .mejs-time {
|
9 |
-
position: absolute;
|
10 |
-
background: #ddd;
|
11 |
-
}
|
12 |
-
.mejs-skin_one .mejs-controls {
|
13 |
-
background: #eee;
|
14 |
-
height: 65px;
|
15 |
-
}
|
16 |
-
.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-total {
|
17 |
-
background-color: none;
|
18 |
-
background: url('controls-skin.png') repeat-x 0 -52px;
|
19 |
-
height: 6px;
|
20 |
-
}
|
21 |
-
.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-buffering {
|
22 |
-
height: 6px;
|
23 |
-
}
|
24 |
-
.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-loaded {
|
25 |
-
background-color: none;
|
26 |
-
background: url('controls-skin.png') repeat-x 0 -52px;
|
27 |
-
width: 0;
|
28 |
-
height: 6px;
|
29 |
-
}
|
30 |
-
.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-current {
|
31 |
-
width: 0;
|
32 |
-
height: 6px;
|
33 |
-
background-color: none;
|
34 |
-
background: url('controls-skin.png') repeat-x 0 -59px;
|
35 |
-
}
|
36 |
-
.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-handle {
|
37 |
-
display: block;
|
38 |
-
margin: 0;
|
39 |
-
width: 14px;
|
40 |
-
height: 21px;
|
41 |
-
top: -7px;
|
42 |
-
border: 0;
|
43 |
-
background: url('controls-skin.png') no-repeat 0 0;
|
44 |
-
}
|
45 |
-
.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-float {
|
46 |
-
display: none;
|
47 |
-
}
|
48 |
-
.mejs-skin_one .mejs-controls .mejs-playpause-button {
|
49 |
-
top: 29px;
|
50 |
-
left: 9px;
|
51 |
-
width: 49px;
|
52 |
-
height: 28px;
|
53 |
-
}
|
54 |
-
.mejs-skin_one .mejs-controls .mejs-playpause-button button {
|
55 |
-
width: 49px;
|
56 |
-
height: 28px;
|
57 |
-
background: url('controls-skin.png') no-repeat -50px -23px;
|
58 |
-
margin: 0;
|
59 |
-
padding: 0;
|
60 |
-
}
|
61 |
-
.mejs-skin_one .mejs-controls .mejs-pause button {
|
62 |
-
background-position: 0 -23px;
|
63 |
-
}
|
64 |
-
.mejs-skin_one .mejs-controls .mejs-fullscreen-button {
|
65 |
-
top: 34px;
|
66 |
-
right: 9px;
|
67 |
-
width: 17px;
|
68 |
-
height: 15px;
|
69 |
-
background: none;
|
70 |
-
}
|
71 |
-
.mejs-skin_one .mejs-controls .mejs-fullscreen-button button {
|
72 |
-
width: 19px;
|
73 |
-
height: 17px;
|
74 |
-
background: transparent url('controls-skin.png') no-repeat 0 -66px;
|
75 |
-
margin: 0;
|
76 |
-
padding: 0;
|
77 |
-
}
|
78 |
-
.mejs-skin_one .mejs-controls .mejs-unfullscreen button {
|
79 |
-
background: transparent url('controls-skin.png') no-repeat -21px -66px;
|
80 |
-
margin: 0;
|
81 |
-
padding: 0;
|
82 |
-
}
|
83 |
-
.mejs-skin_one .mejs-controls .mejs-volume-button {
|
84 |
-
top: 30px;
|
85 |
-
right: 35px;
|
86 |
-
width: 24px;
|
87 |
-
height: 22px;
|
88 |
-
}
|
89 |
-
.mejs-skin_one .mejs-controls .mejs-mute button {
|
90 |
-
background: url('controls-skin.png') no-repeat -15px 0;
|
91 |
-
width: 24px;
|
92 |
-
height: 22px;
|
93 |
-
margin: 0;
|
94 |
-
padding: 0;
|
95 |
-
}
|
96 |
-
.mejs-skin_one .mejs-controls .mejs-unmute button {
|
97 |
-
background: url('controls-skin.png') no-repeat -40px 0;
|
98 |
-
width: 24px;
|
99 |
-
height: 22px;
|
100 |
-
margin: 0;
|
101 |
-
padding: 0;
|
102 |
-
}
|
103 |
-
.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-slider {
|
104 |
-
background: #fff;
|
105 |
-
border: solid 1px #aaa;
|
106 |
-
border-width: 1px 1px 0 1px;
|
107 |
-
width: 22px;
|
108 |
-
height: 65px;
|
109 |
-
top: -65px;
|
110 |
-
}
|
111 |
-
.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-total {
|
112 |
-
background: url('controls-skin.png') repeat-y -41px -66px;
|
113 |
-
left: 8px;
|
114 |
-
width: 6px;
|
115 |
-
height: 50px;
|
116 |
-
}
|
117 |
-
.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-current {
|
118 |
-
left: 8px;
|
119 |
-
width: 6px;
|
120 |
-
background: url('controls-skin.png') repeat-y -48px -66px;
|
121 |
-
height: 50px;
|
122 |
-
}
|
123 |
-
.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-handle {
|
124 |
-
display: none;
|
125 |
-
}
|
126 |
-
.mejs-skin_one .mejs-controls .mejs-time span {
|
127 |
-
color: #333;
|
128 |
-
}
|
129 |
-
.mejs-skin_one .mejs-controls .mejs-currenttime-container {
|
130 |
-
position: absolute;
|
131 |
-
top: 32px;
|
132 |
-
right: 100px;
|
133 |
-
border: solid 1px #999;
|
134 |
-
background: #fff;
|
135 |
-
padding-top: 2px;
|
136 |
-
border-radius: 3px;
|
137 |
-
color: #333;
|
138 |
-
}
|
139 |
-
.mejs-skin_one .mejs-controls .mejs-duration-container {
|
140 |
-
position: absolute;
|
141 |
-
top: 32px;
|
142 |
-
right: 65px;
|
143 |
-
border: solid 1px #999;
|
144 |
-
background: #fff;
|
145 |
-
padding-top: 2px;
|
146 |
-
border-radius: 3px;
|
147 |
-
color: #333;
|
148 |
-
}
|
149 |
-
.mejs-skin_one .mejs-controls .mejs-time button {
|
150 |
-
color: #333;
|
151 |
-
}
|
152 |
-
.mejs-skin_one .mejs-controls .mejs-captions-button {
|
153 |
-
display: none;
|
154 |
-
}
|
1 |
+
.mejs-overlay-button{display:none}.mejs-skin_one .mejs-overlay-button{display:none}.mejs-skin_one .mejs-button,.mejs-skin_one .mejs-time{position:absolute;background:#ddd}.mejs-skin_one .mejs-controls{background:#eee;height:65px}.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-total{background-color:none;background:url('controls-skin.png') repeat-x 0 -52px;height:6px}.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-buffering{height:6px}.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-loaded{background-color:none;background:url('controls-skin.png') repeat-x 0 -52px;width:0;height:6px}.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-current{width:0;height:6px;background-color:none;background:url('controls-skin.png') repeat-x 0 -59px}.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-handle{display:block;margin:0;width:14px;height:21px;top:-7px;border:0;background:url('controls-skin.png') no-repeat 0 0}.mejs-skin_one .mejs-controls .mejs-time-rail .mejs-time-float{display:none}.mejs-skin_one .mejs-controls .mejs-playpause-button{top:29px;left:9px;width:49px;height:28px}.mejs-skin_one .mejs-controls .mejs-playpause-button button{width:49px;height:28px;background:url('controls-skin.png') no-repeat -50px -23px;margin:0;padding:0}.mejs-skin_one .mejs-controls .mejs-pause button{background-position:0 -23px}.mejs-skin_one .mejs-controls .mejs-fullscreen-button{top:34px;right:9px;width:17px;height:15px;background:none}.mejs-skin_one .mejs-controls .mejs-fullscreen-button button{width:19px;height:17px;background:transparent url('controls-skin.png') no-repeat 0 -66px;margin:0;padding:0}.mejs-skin_one .mejs-controls .mejs-unfullscreen button{background:transparent url('controls-skin.png') no-repeat -21px -66px;margin:0;padding:0}.mejs-skin_one .mejs-controls .mejs-volume-button{top:30px;right:35px;width:24px;height:22px}.mejs-skin_one .mejs-controls .mejs-mute button{background:url('controls-skin.png') no-repeat -15px 0;width:24px;height:22px;margin:0;padding:0}.mejs-skin_one .mejs-controls .mejs-unmute button{background:url('controls-skin.png') no-repeat -40px 0;width:24px;height:22px;margin:0;padding:0}.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-slider{background:#fff;border:solid 1px #aaa;border-width:1px 1px 0 1px;width:22px;height:65px;top:-65px}.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-total{background:url('controls-skin.png') repeat-y -41px -66px;left:8px;width:6px;height:50px}.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-current{left:8px;width:6px;background:url('controls-skin.png') repeat-y -48px -66px;height:50px}.mejs-skin_one .mejs-controls .mejs-volume-button .mejs-volume-handle{display:none}.mejs-skin_one .mejs-controls .mejs-time span{color:#333}.mejs-skin_one .mejs-controls .mejs-currenttime-container{position:absolute;top:32px;right:100px;border:solid 1px #999;background:#fff;padding-top:2px;border-radius:3px;color:#333}.mejs-skin_one .mejs-controls .mejs-duration-container{position:absolute;top:32px;right:65px;border:solid 1px #999;background:#fff;padding-top:2px;border-radius:3px;color:#333}.mejs-skin_one .mejs-controls .mejs-time button{color:#333}.mejs-skin_one .mejs-controls .mejs-captions-button{display:none}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|