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 {
@@ 1150-1189 (lines=40) @@
1147
		die();
1148
	}
1149
1150
	public function display_footer() {
1151
		global $post;
1152
1153
		if ( $this->smart ) { ?>
1154
			<script>
1155
			function renderGooglePlus1() {
1156
				if ( 'undefined' === typeof gapi ) {
1157
					return;
1158
				}
1159
1160
				jQuery( '.g-plus' ).each(function() {
1161
					var $button = jQuery( this );
1162
1163
					if ( ! $button.data( 'gplus-rendered' ) ) {
1164
						gapi.plusone.render( this, {
1165
							href: $button.attr( 'data-href' ),
1166
							size: $button.attr( 'data-size' ),
1167
							annotation: $button.attr( 'data-annotation' )
1168
						});
1169
1170
						$button.data( 'gplus-rendered', true );
1171
					}
1172
				});
1173
			}
1174
1175
			(function() {
1176
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1177
				po.src = 'https://apis.google.com/js/platform.js';
1178
				po.innerHTML = '{"parsetags": "explicit"}';
1179
				po.onload = renderGooglePlus1;
1180
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1181
			})();
1182
1183
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1184
			</script>
1185
			<?php
1186
		} else {
1187
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1188
		}
1189
	}
1190
1191
	public function get_total( $post = false ) {
1192
		global $wpdb, $blog_id;
@@ 1439-1445 (lines=7) @@
1436
		die();
1437
	}
1438
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1439
	public function display_footer() {
1440
		if ( $this->smart ) {
1441
			?><script type="text/javascript" src="https://platform.tumblr.com/v1/share.js"></script><?php
1442
		} else {
1443
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1444
		}
1445
	}
1446
}
1447
1448
class Share_Pinterest extends Sharing_Source {
@@ 1643-1659 (lines=17) @@
1640
1641
	}
1642
1643
	function display_footer() {
1644
		if ( $this->smart ) :
1645
		?>
1646
		<script>
1647
		// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1648
		function jetpack_sharing_pocket_init() {
1649
			jQuery.getScript( 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1650
		}
1651
		jQuery( document ).ready( jetpack_sharing_pocket_init );
1652
		jQuery( document.body ).on( 'post-load', jetpack_sharing_pocket_init );
1653
		</script>
1654
		<?php
1655
		else :
1656
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1657
		endif;
1658
1659
	}
1660
1661
}
1662
@@ 1762-1787 (lines=26) @@
1759
		die();
1760
	}
1761
1762
	public function display_footer() {
1763
		if ( $this->smart ) :
1764
		?>
1765
		<script>
1766
		(function(r, d, s) {
1767
			r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) {
1768
				var js, sjs = d.getElementsByTagName(s)[0];
1769
				if (d.getElementById(p.id)) { return; }
1770
				js = d.createElement(s);
1771
				js.id = p.id;
1772
				js.src = p.scriptToLoad;
1773
				js.onload = p.callback
1774
				sjs.parentNode.insertBefore(js, sjs);
1775
			};
1776
			var p = {
1777
				scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',
1778
				id: 'skype_web_sdk'
1779
			};
1780
			r.loadSkypeWebSdkAsync(p);
1781
		})(window, document, 'script');
1782
		</script>
1783
		<?php
1784
		else :
1785
			$this->js_dialog( $this->shortname, array( 'width' => 305, 'height' => 665 ) );
1786
		endif;
1787
	}
1788
}
1789