Code Duplication    Length = 7-40 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 825-841 (lines=17) @@
822
		die();
823
	}
824
825
	public function display_footer() {
826
		if ( !$this->smart ) {
827
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
828
		} else {
829
			?><script type="text/javascript">
830
			jQuery( document ).ready( function() {
831
			    jQuery.getScript( '//platform.linkedin.com/in.js?async=true', function success() {
832
			        IN.init();
833
			    });
834
			});
835
			jQuery( document.body ).on( 'post-load', function() {
836
				if ( typeof IN != 'undefined' )
837
					IN.parse();
838
			});
839
			</script><?php
840
		}
841
	}
842
}
843
844
class Share_Facebook extends Sharing_Source {
@@ 1110-1149 (lines=40) @@
1107
		die();
1108
	}
1109
1110
	public function display_footer() {
1111
		global $post;
1112
1113
		if ( $this->smart ) { ?>
1114
			<script>
1115
			function renderGooglePlus1() {
1116
				if ( 'undefined' === typeof gapi ) {
1117
					return;
1118
				}
1119
1120
				jQuery( '.g-plus' ).each(function() {
1121
					var $button = jQuery( this );
1122
1123
					if ( ! $button.data( 'gplus-rendered' ) ) {
1124
						gapi.plusone.render( this, {
1125
							href: $button.attr( 'data-href' ),
1126
							size: $button.attr( 'data-size' ),
1127
							annotation: $button.attr( 'data-annotation' )
1128
						});
1129
1130
						$button.data( 'gplus-rendered', true );
1131
					}
1132
				});
1133
			}
1134
1135
			(function() {
1136
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1137
				po.src = 'https://apis.google.com/js/plusone.js';
1138
				po.innerHTML = '{"parsetags": "explicit"}';
1139
				po.onload = renderGooglePlus1;
1140
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1141
			})();
1142
1143
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1144
			</script>
1145
			<?php
1146
		} else {
1147
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1148
		}
1149
	}
1150
1151
	public function get_total( $post = false ) {
1152
		global $wpdb, $blog_id;
@@ 1385-1391 (lines=7) @@
1382
		die();
1383
	}
1384
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1385
	public function display_footer() {
1386
		if ( $this->smart ) {
1387
			?><script type="text/javascript" src="//platform.tumblr.com/v1/share.js"></script><?php
1388
		} else {
1389
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1390
		}
1391
	}
1392
}
1393
1394
class Share_Pinterest extends Sharing_Source {
@@ 1585-1601 (lines=17) @@
1582
1583
	}
1584
1585
	function display_footer() {
1586
		if ( $this->smart ) :
1587
		?>
1588
		<script>
1589
		// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1590
		function jetpack_sharing_pocket_init() {
1591
			jQuery.getScript( 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1592
		}
1593
		jQuery( document ).on( 'ready', jetpack_sharing_pocket_init );
1594
		jQuery( document.body ).on( 'post-load', jetpack_sharing_pocket_init );
1595
		</script>
1596
		<?php
1597
		else :
1598
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1599
		endif;
1600
1601
	}
1602
1603
}
1604
@@ 1662-1687 (lines=26) @@
1659
		die();
1660
	}
1661
1662
	public function display_footer() {
1663
		if ( $this->smart ) :
1664
		?>
1665
		<script>
1666
		(function(r, d, s) {
1667
			r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) {
1668
				var js, sjs = d.getElementsByTagName(s)[0];
1669
				if (d.getElementById(p.id)) { return; }
1670
				js = d.createElement(s);
1671
				js.id = p.id;
1672
				js.src = p.scriptToLoad;
1673
				js.onload = p.callback
1674
				sjs.parentNode.insertBefore(js, sjs);
1675
			};
1676
			var p = {
1677
				scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',
1678
				id: 'skype_web_sdk'
1679
			};
1680
			r.loadSkypeWebSdkAsync(p);
1681
		})(window, document, 'script');
1682
		</script>
1683
		<?php
1684
		else :
1685
			$this->js_dialog( $this->shortname, array( 'width' => 305, 'height' => 665 ) );
1686
		endif;
1687
	}
1688
}
1689