Contact Widgets - Version 1.4.0

Version Description

  • January 10, 2017 =

  • Defer iframe loading by default

  • Remove frameborder from iframe

  • Add filter to change zoom level of map

  • Deprecate YouTube link while maintaining backward compatibility

Download this release

Release Info

Developer jonathanbardo
Plugin Icon 128x128 Contact Widgets
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.4 to 1.4.0

Files changed (43) hide show
  1. assets/css/admin-ie-rtl.css +24 -0
  2. assets/css/admin-ie-rtl.min.css +1 -0
  3. assets/css/admin-rtl.css +95 -0
  4. assets/css/admin-rtl.min.css +1 -0
  5. assets/css/style-rtl.css +30 -0
  6. assets/css/style-rtl.min.css +1 -0
  7. assets/js/admin.js +3 -0
  8. assets/js/admin.min.js +1 -1
  9. contact-widgets.php +1 -1
  10. includes/class-base-widget.php +5 -3
  11. includes/class-contact.php +66 -2
  12. includes/class-social.php +1 -1
  13. includes/social-networks.php +4 -3
  14. languages/contact-widgets-da_DK.mo +0 -0
  15. languages/contact-widgets-de_DE.mo +0 -0
  16. languages/contact-widgets-el.mo +0 -0
  17. languages/contact-widgets-es_ES.mo +0 -0
  18. languages/contact-widgets-es_MX.mo +0 -0
  19. languages/contact-widgets-fi.mo +0 -0
  20. languages/contact-widgets-fr_FR.mo +0 -0
  21. languages/contact-widgets-hi_IN.mo +0 -0
  22. languages/contact-widgets-id_ID.mo +0 -0
  23. languages/contact-widgets-it_IT.mo +0 -0
  24. languages/contact-widgets-ja.mo +0 -0
  25. languages/contact-widgets-ko_KR.mo +0 -0
  26. languages/contact-widgets-mr.mo +0 -0
  27. languages/contact-widgets-ms_MY.mo +0 -0
  28. languages/contact-widgets-nb_NO.mo +0 -0
  29. languages/contact-widgets-nl_NL.mo +0 -0
  30. languages/contact-widgets-pl_PL.mo +0 -0
  31. languages/contact-widgets-pt_BR.mo +0 -0
  32. languages/contact-widgets-pt_PT.mo +0 -0
  33. languages/contact-widgets-ru_RU.mo +0 -0
  34. languages/contact-widgets-sv_SE.mo +0 -0
  35. languages/contact-widgets-th.mo +0 -0
  36. languages/contact-widgets-tl.mo +0 -0
  37. languages/contact-widgets-tr_TR.mo +0 -0
  38. languages/contact-widgets-uk.mo +0 -0
  39. languages/contact-widgets-vi.mo +0 -0
  40. languages/contact-widgets-zh_CN.mo +0 -0
  41. languages/contact-widgets-zh_HK.mo +0 -0
  42. languages/contact-widgets-zh_TW.mo +0 -0
  43. readme.txt +10 -1
assets/css/admin-ie-rtl.css ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpcw-widget .form p {
2
+ margin: 0 1px 10px 0;
3
+ }
4
+ .wpcw-widget .form p.sortable-placeholder {
5
+ margin: 0 1px 8px 0;
6
+ }
7
+ .wpcw-widget .form.ui-sortable p span.dashicons {
8
+ top: 25px;
9
+ }
10
+ .wpcw-widget .form.ui-sortable p.textarea span.dashicons {
11
+ top: 80px;
12
+ }
13
+ .wpcw-widget .ui-sortable.form > p .widefat {
14
+ display: inline;
15
+ }
16
+ /**
17
+ * IE8 fix and woraround
18
+ */
19
+ .ie8 .wpcw-widget .form.ui-sortable p span.dashicons {
20
+ top: 0;
21
+ }
22
+ .ie8 .wpcw-widget-social .icons a.inactive {
23
+ color: #ccc;
24
+ }
assets/css/admin-ie-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .wpcw-widget .form p{margin:0 1px 10px 0}.wpcw-widget .form p.sortable-placeholder{margin:0 1px 8px 0}.wpcw-widget .form.ui-sortable p span.dashicons{top:25px}.wpcw-widget .form.ui-sortable p.textarea span.dashicons{top:80px}.wpcw-widget .ui-sortable.form>p .widefat{display:inline}.ie8 .wpcw-widget .form.ui-sortable p span.dashicons{top:0}.ie8 .wpcw-widget-social .icons a.inactive{color:#ccc}
assets/css/admin-rtl.css ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Form fields
3
+ */
4
+ .wpcw-widget .form {
5
+ overflow: auto;
6
+ margin-bottom: 1em;
7
+ }
8
+ .wpcw-widget .title {
9
+ margin-top: 1em;
10
+ }
11
+ .wpcw-widget .form p {
12
+ margin: 0 0 10px 0;
13
+ }
14
+ .wpcw-widget .form p.sortable-placeholder {
15
+ margin: 0 0 8px 0;
16
+ }
17
+ .wpcw-widget .form label i {
18
+ margin: 0 3px 0 7px;
19
+ }
20
+ .wpcw-widget .form > p > span {
21
+ display: table;
22
+ width: 100%;
23
+ }
24
+ .wpcw-widget .form > p textarea {
25
+ min-height: 80px;
26
+ resize: none;
27
+ vertical-align: top; /* Bottom margin fix for webkit */
28
+ }
29
+ .wpcw-widget .form.ui-sortable > p .widefat {
30
+ display: table-cell;
31
+ width: 100%; /* Customizer compat */
32
+ }
33
+ .wpcw-widget .form.ui-sortable .wpcw-widget-sortable-handle {
34
+ display: table-cell;
35
+ position: relative;
36
+ width: 25px;
37
+ background-color: #f7f7f7;
38
+ border: 1px solid #ddd;
39
+ border-right: none;
40
+ cursor: row-resize;
41
+ cursor: grab;
42
+ cursor: -moz-grab;
43
+ cursor: -webkit-grab;
44
+
45
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
46
+ -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
47
+ box-shadow: 0 1px 1px rgba(0,0,0,0.04);
48
+ }
49
+ .wpcw-widget .form.ui-sortable .wpcw-widget-sortable-handle:active,
50
+ .wpcw-widget .form.ui-sortable .ui-sortable-helper * {
51
+ cursor: row-resize;
52
+ cursor: grabbing;
53
+ cursor: -moz-grabbing;
54
+ cursor: -webkit-grabbing;
55
+ }
56
+ .wpcw-widget .form.ui-sortable span.dashicons {
57
+ position: absolute;
58
+ margin: auto;
59
+ top: 0;
60
+ left: 0;
61
+ bottom: 0;
62
+ right: 0;
63
+ overflow: auto;
64
+ font-size: 18px;
65
+ color: #a0a5aa;
66
+ }
67
+ .wpcw-widget .form.ui-sortable span.dashicons:before {
68
+ position: relative;
69
+ top: 1px;
70
+ }
71
+
72
+ /**
73
+ * Default fields
74
+ */
75
+ .wpcw-widget .default-fields {
76
+ display: none;
77
+ }
78
+
79
+ /**
80
+ * Icons
81
+ */
82
+ .wpcw-widget-social .icons {
83
+ margin: 10px 0;
84
+ }
85
+ .wpcw-widget-social .icons a {
86
+ margin: 5px;
87
+ font-size: 20px;
88
+ display: inline-block;
89
+ }
90
+ .wpcw-widget-social .icons a:focus {
91
+ box-shadow: none;
92
+ }
93
+ .wpcw-widget-social .icons a.inactive:not(:hover) {
94
+ color: #ccc;
95
+ }
assets/css/admin-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .wpcw-widget .form{overflow:auto;margin-bottom:1em}.wpcw-widget .title{margin-top:1em}.wpcw-widget .form p{margin:0 0 10px}.wpcw-widget .form p.sortable-placeholder{margin:0 0 8px}.wpcw-widget .form label i{margin:0 3px 0 7px}.wpcw-widget .form>p>span{display:table;width:100%}.wpcw-widget .form>p textarea{min-height:80px;resize:none;vertical-align:top}.wpcw-widget .form.ui-sortable>p .widefat{display:table-cell;width:100%}.wpcw-widget .form.ui-sortable .wpcw-widget-sortable-handle{display:table-cell;position:relative;width:25px;background-color:#f7f7f7;border:1px solid #ddd;border-right:none;cursor:row-resize;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);-moz-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04)}.wpcw-widget .form.ui-sortable .ui-sortable-helper *,.wpcw-widget .form.ui-sortable .wpcw-widget-sortable-handle:active{cursor:row-resize;cursor:grabbing;cursor:-moz-grabbing;cursor:-webkit-grabbing}.wpcw-widget .form.ui-sortable span.dashicons{position:absolute;margin:auto;top:0;left:0;bottom:0;right:0;overflow:auto;font-size:18px;color:#a0a5aa}.wpcw-widget .form.ui-sortable span.dashicons:before{position:relative;top:1px}.wpcw-widget .default-fields{display:none}.wpcw-widget-social .icons{margin:10px 0}.wpcw-widget-social .icons a{margin:5px;font-size:20px;display:inline-block}.wpcw-widget-social .icons a:focus{box-shadow:none}.wpcw-widget-social .icons a.inactive:not(:hover){color:#ccc}
assets/css/style-rtl.css ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpcw-widget-contact ul,
2
+ .wpcw-widget-social ul {
3
+ margin: 0;
4
+ padding: 0;
5
+ list-style: none;
6
+ }
7
+ .wpcw-widget-contact ul li,
8
+ .wpcw-widget-social ul li.has-label {
9
+ padding: 10px 0;
10
+ }
11
+ .wpcw-widget-contact ul li:before,
12
+ .wpcw-widget-contact ul li:after,
13
+ .wpcw-widget-social ul li:before,
14
+ .wpcw-widget-social ul li:after {
15
+ display: none;
16
+ }
17
+ .wpcw-widget-contact ul li div {
18
+ display: inline;
19
+ }
20
+ .wpcw-widget-social ul li:not(.has-label) {
21
+ display: inline-block;
22
+ margin: 0 0 0.75em 0.75em;
23
+ border: none;
24
+ }
25
+ .wpcw-widget-social ul li.has-label a {
26
+ display: block;
27
+ }
28
+ .wpcw-widget-social ul li.has-label span {
29
+ margin-left: 0.25em;
30
+ }
assets/css/style-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .wpcw-widget-contact ul,.wpcw-widget-social ul{margin:0;padding:0;list-style:none}.wpcw-widget-contact ul li,.wpcw-widget-social ul li.has-label{padding:10px 0}.wpcw-widget-contact ul li:after,.wpcw-widget-contact ul li:before,.wpcw-widget-social ul li:after,.wpcw-widget-social ul li:before{display:none}.wpcw-widget-contact ul li div{display:inline}.wpcw-widget-social ul li:not(.has-label){display:inline-block;margin:0 0 .75em .75em;border:none}.wpcw-widget-social ul li.has-label a{display:block}.wpcw-widget-social ul li.has-label span{margin-left:.25em}
assets/js/admin.js CHANGED
@@ -48,6 +48,9 @@
48
  tolerance: 'pointer',
49
  forcePlaceholderSize: true,
50
  cursorAt: { top: 40 },
 
 
 
51
  stop: function ( e, ui ) {
52
  // Trigger change for customizer
53
  $contact_form.find( '.customizer_update' ).val( ui.item.index() ).trigger( 'change' );
48
  tolerance: 'pointer',
49
  forcePlaceholderSize: true,
50
  cursorAt: { top: 40 },
51
+ start: function( e, ui ) {
52
+ ui.placeholder.height( ui.helper.height() );
53
+ },
54
  stop: function ( e, ui ) {
55
  // Trigger change for customizer
56
  $contact_form.find( '.customizer_update' ).val( ui.item.index() ).trigger( 'change' );
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(a){function b(){var b=a(".wpcw-widget .form");b.sortable({items:"> *:not(.not-sortable)",handle:".wpcw-widget-sortable-handle",containment:"parent",placeholder:"sortable-placeholder",axis:"y",tolerance:"pointer",forcePlaceholderSize:!0,cursorAt:{top:40},stop:function(a,c){b.find(".customizer_update").val(c.item.index()).trigger("change")}})}a.fn.selectString=function(b){var c=a(this)[0],d=c.value.indexOf(b),e=d+b.length;if(c&&!(0>d))if(c.setSelectionRange)c.focus(),c.setSelectionRange(d,e);else if(c.createTextRange){var f=c.createTextRange();f.collapse(!0),f.moveEnd("character",e),f.moveStart("character",d),f.select()}else c.selectionStart&&(c.selectionStart=d,c.selectionEnd=e)};var c={$btn:null,$widget:null,$template:null,init:function(b){b.preventDefault();var d=c;return d.$btn=a(this),d.$widget=d.$btn.parents(".wpcw-widget"),d.$widget.find("."+d.$btn.data("key")).is(":animated")?!1:d.$btn.hasClass("inactive")?(d.$template=d.$widget.find(".default-fields"),d.$template=a(a.trim(d.$template.clone().html())),void d.add()):void d.remove()},add:function(){this.$btn.removeClass("inactive");var a=this.$btn.data();this.$template.addClass(a.key).find("label").prop("for",a.id),this.$template.find("input").prop("id",a.id).prop("name",a.name).prop("value",a.value),this.$template.find("label span.fa").prop("class",this.$btn.find("i").attr("class")),this.$template.find("label span.text").text(a.label),this.$template.hide().prependTo(this.$widget.find(".form")).stop(!0,!0).animate({height:"toggle",opacity:"toggle"},250),this.$template.find("input").selectString(a.select),this.update_customizer()},remove:function(){this.$btn.addClass("inactive"),this.$widget.find(".form ."+this.$btn.data("key")).stop(!0,!0).animate({height:"toggle",opacity:"toggle"},250,function(){a(this).remove()}),this.update_customizer()},update_customizer:function(){var a=this.$widget.find("div > div").length;this.$widget.find(".customizer_update").val(a).trigger("change")}};a(document).ready(function(a){a(document).on("click",".wpcw-widget-social .icons a",c.init),a(document).on("wpcw.change",b),a(document).on("click.widgets-toggle",b),a(document).on("widget-updated",b)})}(jQuery);
1
+ !function(a){function b(){var b=a(".wpcw-widget .form");b.sortable({items:"> *:not(.not-sortable)",handle:".wpcw-widget-sortable-handle",containment:"parent",placeholder:"sortable-placeholder",axis:"y",tolerance:"pointer",forcePlaceholderSize:!0,cursorAt:{top:40},start:function(a,b){b.placeholder.height(b.helper.height())},stop:function(a,c){b.find(".customizer_update").val(c.item.index()).trigger("change")}})}a.fn.selectString=function(b){var c=a(this)[0],d=c.value.indexOf(b),e=d+b.length;if(c&&!(d<0))if(c.setSelectionRange)c.focus(),c.setSelectionRange(d,e);else if(c.createTextRange){var f=c.createTextRange();f.collapse(!0),f.moveEnd("character",e),f.moveStart("character",d),f.select()}else c.selectionStart&&(c.selectionStart=d,c.selectionEnd=e)};var c={$btn:null,$widget:null,$template:null,init:function(b){b.preventDefault();var d=c;return d.$btn=a(this),d.$widget=d.$btn.parents(".wpcw-widget"),!d.$widget.find("."+d.$btn.data("key")).is(":animated")&&(d.$btn.hasClass("inactive")?(d.$template=d.$widget.find(".default-fields"),d.$template=a(a.trim(d.$template.clone().html())),void d.add()):void d.remove())},add:function(){this.$btn.removeClass("inactive");var a=this.$btn.data();this.$template.addClass(a.key).find("label").prop("for",a.id),this.$template.find("input").prop("id",a.id).prop("name",a.name).prop("value",a.value),this.$template.find("label span.fa").prop("class",this.$btn.find("i").attr("class")),this.$template.find("label span.text").text(a.label),this.$template.hide().prependTo(this.$widget.find(".form")).stop(!0,!0).animate({height:"toggle",opacity:"toggle"},250),this.$template.find("input").selectString(a.select),this.update_customizer()},remove:function(){this.$btn.addClass("inactive"),this.$widget.find(".form ."+this.$btn.data("key")).stop(!0,!0).animate({height:"toggle",opacity:"toggle"},250,function(){a(this).remove()}),this.update_customizer()},update_customizer:function(){var a=this.$widget.find("div > div").length;this.$widget.find(".customizer_update").val(a).trigger("change")}};a(document).ready(function(a){a(document).on("click",".wpcw-widget-social .icons a",c.init),a(document).on("wpcw.change",b),a(document).on("click.widgets-toggle",b),a(document).on("widget-updated",b)})}(jQuery);
contact-widgets.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Contact Widgets
4
  * Description: Beautifully display social media and contact information on your website with these simple widgets.
5
- * Version: 1.3.4
6
  * Author: GoDaddy
7
  * Author URI: https://godaddy.com
8
  * Text Domain: contact-widgets
2
  /**
3
  * Plugin Name: Contact Widgets
4
  * Description: Beautifully display social media and contact information on your website with these simple widgets.
5
+ * Version: 1.4.0
6
  * Author: GoDaddy
7
  * Author URI: https://godaddy.com
8
  * Text Domain: contact-widgets
includes/class-base-widget.php CHANGED
@@ -515,15 +515,16 @@ abstract class Base_Widget extends \WP_Widget {
515
  */
516
  public function enqueue_scripts() {
517
 
 
518
  $suffix = SCRIPT_DEBUG ? '' : '.min';
519
 
520
  wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', [], '4.5.0' );
521
- wp_enqueue_style( 'wpcw-admin', \Contact_Widgets::$assets_url . "css/admin{$suffix}.css", [ 'font-awesome' ], Plugin::$version );
522
  wp_enqueue_script( 'wpcw-admin', \Contact_Widgets::$assets_url . "js/admin{$suffix}.js", [ 'jquery' ], Plugin::$version, true );
523
 
524
  if ( $GLOBALS['is_IE'] ) {
525
 
526
- wp_enqueue_style( 'wpcw-admin-ie', \Contact_Widgets::$assets_url . "css/admin-ie{$suffix}.css", [ 'wpcw-admin' ], Plugin::$version );
527
 
528
  }
529
 
@@ -548,9 +549,10 @@ abstract class Base_Widget extends \WP_Widget {
548
  */
549
  public function front_end_enqueue_scripts() {
550
 
 
551
  $suffix = SCRIPT_DEBUG ? '' : '.min';
552
 
553
- wp_enqueue_style( 'wpcw', \Contact_Widgets::$assets_url . "css/style{$suffix}.css", [], Plugin::$version );
554
 
555
  if ( is_customize_preview() ) {
556
 
515
  */
516
  public function enqueue_scripts() {
517
 
518
+ $rtl = is_rtl() ? '-rtl' : '';
519
  $suffix = SCRIPT_DEBUG ? '' : '.min';
520
 
521
  wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', [], '4.5.0' );
522
+ wp_enqueue_style( 'wpcw-admin', \Contact_Widgets::$assets_url . "css/admin{$rtl}{$suffix}.css", [ 'font-awesome' ], Plugin::$version );
523
  wp_enqueue_script( 'wpcw-admin', \Contact_Widgets::$assets_url . "js/admin{$suffix}.js", [ 'jquery' ], Plugin::$version, true );
524
 
525
  if ( $GLOBALS['is_IE'] ) {
526
 
527
+ wp_enqueue_style( 'wpcw-admin-ie', \Contact_Widgets::$assets_url . "css/admin-ie{$rtl}{$suffix}.css", [ 'wpcw-admin' ], Plugin::$version );
528
 
529
  }
530
 
549
  */
550
  public function front_end_enqueue_scripts() {
551
 
552
+ $rtl = is_rtl() ? '-rtl' : '';
553
  $suffix = SCRIPT_DEBUG ? '' : '.min';
554
 
555
+ wp_enqueue_style( 'wpcw', \Contact_Widgets::$assets_url . "css/style{$rtl}{$suffix}.css", [], Plugin::$version );
556
 
557
  if ( is_customize_preview() ) {
558
 
includes/class-contact.php CHANGED
@@ -10,6 +10,15 @@ if ( ! defined( 'ABSPATH' ) ) {
10
 
11
  final class Contact extends Base_Widget {
12
 
 
 
 
 
 
 
 
 
 
13
  /**
14
  * Widget constructor
15
  */
@@ -27,6 +36,18 @@ final class Contact extends Base_Widget {
27
  $widget_options
28
  );
29
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
  /**
@@ -116,10 +137,18 @@ final class Contact extends Base_Widget {
116
 
117
  if ( 'yes' === $instance['map']['value'] && ! empty( $fields['address']['value'] ) ) {
118
 
 
 
 
 
 
 
119
  printf(
120
- '<li class="has-map"><iframe src="//www.google.com/maps?q=%s&output=embed&hl=%s"></iframe></li>',
 
121
  urlencode( trim( strip_tags( $fields['address']['value'] ) ) ),
122
- urlencode( $this->get_google_maps_locale() )
 
123
  );
124
 
125
  }
@@ -191,6 +220,16 @@ final class Contact extends Base_Widget {
191
  'type' => 'checkbox',
192
  'sortable' => false,
193
  'value' => 'yes',
 
 
 
 
 
 
 
 
 
 
194
  'atts' => $this->checked( 'yes', isset( $instance['map']['value'] ) ? $instance['map']['value'] : 'yes' ),
195
  'show_front_end' => false,
196
  ],
@@ -249,4 +288,29 @@ final class Contact extends Base_Widget {
249
 
250
  }
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  }
10
 
11
  final class Contact extends Base_Widget {
12
 
13
+ /**
14
+ * Defer Google Maps iframes until pages have fully loaded.
15
+ *
16
+ * @since 1.4.0
17
+ *
18
+ * @var bool
19
+ */
20
+ private $defer_map_iframes = true;
21
+
22
  /**
23
  * Widget constructor
24
  */
36
  $widget_options
37
  );
38
 
39
+ /**
40
+ * Filter whether to defer Google Maps iframes until
41
+ * pages have fully loaded.
42
+ *
43
+ * Note: Will always be `false` on customize preview.
44
+ *
45
+ * @since 1.4.0
46
+ *
47
+ * @var bool
48
+ */
49
+ $this->defer_map_iframes = is_customize_preview() ? false : (bool) apply_filters( 'wpcw_contact_defer_map_iframes', $this->defer_map_iframes );
50
+
51
  }
52
 
53
  /**
137
 
138
  if ( 'yes' === $instance['map']['value'] && ! empty( $fields['address']['value'] ) ) {
139
 
140
+ if ( $this->defer_map_iframes && ! has_action( 'wp_footer', [ $this, 'defer_map_iframes_js' ] ) ) {
141
+
142
+ add_action( 'wp_footer', [ $this, 'defer_map_iframes_js' ] );
143
+
144
+ }
145
+
146
  printf(
147
+ '<li class="has-map"><iframe %s="https://www.google.com/maps?q=%s&output=embed&hl=%s&z=%d" frameborder="0" class="wpcw-widget-contact-map"></iframe></li>',
148
+ ( $this->defer_map_iframes ) ? 'src="" data-src' : 'src',
149
  urlencode( trim( strip_tags( $fields['address']['value'] ) ) ),
150
+ urlencode( $this->get_google_maps_locale() ),
151
+ absint( $fields['map']['zoom'] )
152
  );
153
 
154
  }
220
  'type' => 'checkbox',
221
  'sortable' => false,
222
  'value' => 'yes',
223
+ /**
224
+ * Filter Google Map default zoom level of 14 to something else.
225
+ *
226
+ * @since 1.4.0
227
+ *
228
+ * @param array $instance Widget instance
229
+ *
230
+ * @var int
231
+ */
232
+ 'zoom' => absint( apply_filters( 'wpcw_widget_contact_map_zoom', 14, $instance ) ),
233
  'atts' => $this->checked( 'yes', isset( $instance['map']['value'] ) ? $instance['map']['value'] : 'yes' ),
234
  'show_front_end' => false,
235
  ],
288
 
289
  }
290
 
291
+ /**
292
+ * Defer Google Maps iframes with JavaScript.
293
+ *
294
+ * @action wp_footer
295
+ * @since 1.4.0
296
+ */
297
+ public function defer_map_iframes_js() {
298
+
299
+ ?>
300
+ <script type="text/javascript">
301
+ window.onload = ( function() {
302
+ var maps = document.getElementsByClassName( 'wpcw-widget-contact-map' );
303
+ for ( var i = 0; i < maps.length; i++ ) {
304
+ var src = maps[i].getAttribute( 'data-src' );
305
+ if ( src ) {
306
+ maps[i].setAttribute( 'src', src );
307
+ maps[i].removeAttribute( 'data-src' );
308
+ }
309
+ }
310
+ } );
311
+ </script>
312
+ <?php
313
+
314
+ }
315
+
316
  }
includes/class-social.php CHANGED
@@ -56,7 +56,7 @@ final class Social extends Base_Widget {
56
 
57
  foreach ( $fields as $key => $field ) {
58
 
59
- if ( ! isset( $field['social'] ) ) {
60
 
61
  continue;
62
 
56
 
57
  foreach ( $fields as $key => $field ) {
58
 
59
+ if ( ( ! empty( $field['deprecated'] ) && empty( $field['value'] ) ) || ! isset( $field['social'] ) ) {
60
 
61
  continue;
62
 
includes/social-networks.php CHANGED
@@ -45,9 +45,10 @@ $fields = [
45
  'select' => $username,
46
  ],
47
  'youtube' => [
48
- 'label' => __( 'YouTube', 'contact-widgets' ),
49
- 'default' => "https://www.youtube.com/user/{$username}",
50
- 'select' => $username,
 
51
  ],
52
  'vimeo' => [
53
  'label' => __( 'Vimeo', 'contact-widgets' ),
45
  'select' => $username,
46
  ],
47
  'youtube' => [
48
+ 'label' => __( 'YouTube', 'contact-widgets' ),
49
+ 'default' => "https://www.youtube.com/user/{$username}",
50
+ 'select' => $username,
51
+ 'deprecated' => true,
52
  ],
53
  'vimeo' => [
54
  'label' => __( 'Vimeo', 'contact-widgets' ),
languages/contact-widgets-da_DK.mo CHANGED
Binary file
languages/contact-widgets-de_DE.mo CHANGED
Binary file
languages/contact-widgets-el.mo CHANGED
Binary file
languages/contact-widgets-es_ES.mo CHANGED
Binary file
languages/contact-widgets-es_MX.mo CHANGED
Binary file
languages/contact-widgets-fi.mo CHANGED
Binary file
languages/contact-widgets-fr_FR.mo CHANGED
Binary file
languages/contact-widgets-hi_IN.mo CHANGED
Binary file
languages/contact-widgets-id_ID.mo CHANGED
Binary file
languages/contact-widgets-it_IT.mo CHANGED
Binary file
languages/contact-widgets-ja.mo CHANGED
Binary file
languages/contact-widgets-ko_KR.mo CHANGED
Binary file
languages/contact-widgets-mr.mo CHANGED
Binary file
languages/contact-widgets-ms_MY.mo CHANGED
Binary file
languages/contact-widgets-nb_NO.mo CHANGED
Binary file
languages/contact-widgets-nl_NL.mo CHANGED
Binary file
languages/contact-widgets-pl_PL.mo CHANGED
Binary file
languages/contact-widgets-pt_BR.mo CHANGED
Binary file
languages/contact-widgets-pt_PT.mo CHANGED
Binary file
languages/contact-widgets-ru_RU.mo CHANGED
Binary file
languages/contact-widgets-sv_SE.mo CHANGED
Binary file
languages/contact-widgets-th.mo CHANGED
Binary file
languages/contact-widgets-tl.mo CHANGED
Binary file
languages/contact-widgets-tr_TR.mo CHANGED
Binary file
languages/contact-widgets-uk.mo CHANGED
Binary file
languages/contact-widgets-vi.mo CHANGED
Binary file
languages/contact-widgets-zh_CN.mo CHANGED
Binary file
languages/contact-widgets-zh_HK.mo CHANGED
Binary file
languages/contact-widgets-zh_TW.mo CHANGED
Binary file
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: godaddy, jonathanbardo, fjarrett
3
  Tags: widget, contact, social, sharing, share button, share buttons, share links, social icons, social media, facebook, twitter, google plus, instagram
4
  Requires at least: 4.4.2
5
  Tested up to: 4.7
6
- Stable tag: 1.3.4
7
  License: GPL-2.0
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -20,6 +20,8 @@ This plugin adds two new widgets to your WordPress website:
20
 
21
  Both widgets are compatible with the WordPress Customizer and will automatically refresh when changes are made.
22
 
 
 
23
  **Languages Supported:**
24
 
25
  * English
@@ -111,6 +113,13 @@ add_filter( 'wpcw_widget_social_custom_fields', function( $fields, $instance ) {
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
 
 
114
  = 1.3.3 - October 14, 2016 =
115
 
116
  * Minor bug fixes
3
  Tags: widget, contact, social, sharing, share button, share buttons, share links, social icons, social media, facebook, twitter, google plus, instagram
4
  Requires at least: 4.4.2
5
  Tested up to: 4.7
6
+ Stable tag: 1.4.0
7
  License: GPL-2.0
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
20
 
21
  Both widgets are compatible with the WordPress Customizer and will automatically refresh when changes are made.
22
 
23
+ [youtube https://www.youtube.com/watch?v=Y3NsrWHd_us]
24
+
25
  **Languages Supported:**
26
 
27
  * English
113
 
114
  == Changelog ==
115
 
116
+ = 1.4.0 - January 10, 2017 =
117
+
118
+ * Defer iframe loading by default
119
+ * Remove frameborder from iframe
120
+ * Add filter to change zoom level of map
121
+ * Deprecate YouTube link while maintaining backward compatibility
122
+
123
  = 1.3.3 - October 14, 2016 =
124
 
125
  * Minor bug fixes