Code Duplication    Length = 7-40 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

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