Code Duplication    Length = 7-40 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 848-864 (lines=17) @@
845
		die();
846
	}
847
848
	public function display_footer() {
849
		if ( ! $this->smart ) {
850
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
851
		} else {
852
			?><script type="text/javascript">
853
			jQuery( document ).ready( function() {
854
				jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
855
					IN.init();
856
				});
857
			});
858
			jQuery( document.body ).on( 'post-load', function() {
859
				if ( typeof IN != 'undefined' )
860
					IN.parse();
861
			});
862
			</script><?php
863
		}
864
	}
865
}
866
867
class Share_Facebook extends Sharing_Source {
@@ 1139-1178 (lines=40) @@
1136
		die();
1137
	}
1138
1139
	public function display_footer() {
1140
		global $post;
1141
1142
		if ( $this->smart ) { ?>
1143
			<script>
1144
			function renderGooglePlus1() {
1145
				if ( 'undefined' === typeof gapi ) {
1146
					return;
1147
				}
1148
1149
				jQuery( '.g-plus' ).each(function() {
1150
					var $button = jQuery( this );
1151
1152
					if ( ! $button.data( 'gplus-rendered' ) ) {
1153
						gapi.plusone.render( this, {
1154
							href: $button.attr( 'data-href' ),
1155
							size: $button.attr( 'data-size' ),
1156
							annotation: $button.attr( 'data-annotation' )
1157
						});
1158
1159
						$button.data( 'gplus-rendered', true );
1160
					}
1161
				});
1162
			}
1163
1164
			(function() {
1165
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1166
				po.src = 'https://apis.google.com/js/plusone.js';
1167
				po.innerHTML = '{"parsetags": "explicit"}';
1168
				po.onload = renderGooglePlus1;
1169
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1170
			})();
1171
1172
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1173
			</script>
1174
			<?php
1175
		} else {
1176
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1177
		}
1178
	}
1179
1180
	public function get_total( $post = false ) {
1181
		global $wpdb, $blog_id;
@@ 1428-1434 (lines=7) @@
1425
		die();
1426
	}
1427
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1428
	public function display_footer() {
1429
		if ( $this->smart ) {
1430
			?><script type="text/javascript" src="https://platform.tumblr.com/v1/share.js"></script><?php
1431
		} else {
1432
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1433
		}
1434
	}
1435
}
1436
1437
class Share_Pinterest extends Sharing_Source {
@@ 1632-1648 (lines=17) @@
1629
1630
	}
1631
1632
	function display_footer() {
1633
		if ( $this->smart ) :
1634
		?>
1635
		<script>
1636
		// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1637
		function jetpack_sharing_pocket_init() {
1638
			jQuery.getScript( 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1639
		}
1640
		jQuery( document ).ready( jetpack_sharing_pocket_init );
1641
		jQuery( document.body ).on( 'post-load', jetpack_sharing_pocket_init );
1642
		</script>
1643
		<?php
1644
		else :
1645
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1646
		endif;
1647
1648
	}
1649
1650
}
1651
@@ 1751-1776 (lines=26) @@
1748
		die();
1749
	}
1750
1751
	public function display_footer() {
1752
		if ( $this->smart ) :
1753
		?>
1754
		<script>
1755
		(function(r, d, s) {
1756
			r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) {
1757
				var js, sjs = d.getElementsByTagName(s)[0];
1758
				if (d.getElementById(p.id)) { return; }
1759
				js = d.createElement(s);
1760
				js.id = p.id;
1761
				js.src = p.scriptToLoad;
1762
				js.onload = p.callback
1763
				sjs.parentNode.insertBefore(js, sjs);
1764
			};
1765
			var p = {
1766
				scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',
1767
				id: 'skype_web_sdk'
1768
			};
1769
			r.loadSkypeWebSdkAsync(p);
1770
		})(window, document, 'script');
1771
		</script>
1772
		<?php
1773
		else :
1774
			$this->js_dialog( $this->shortname, array( 'width' => 305, 'height' => 665 ) );
1775
		endif;
1776
	}
1777
}
1778