Code Duplication    Length = 7-40 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 824-840 (lines=17) @@
821
		die();
822
	}
823
824
	public function display_footer() {
825
		if ( !$this->smart ) {
826
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
827
		} else {
828
			?><script type="text/javascript">
829
			jQuery( document ).ready( function() {
830
			    jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
831
			        IN.init();
832
			    });
833
			});
834
			jQuery( document.body ).on( 'post-load', function() {
835
				if ( typeof IN != 'undefined' )
836
					IN.parse();
837
			});
838
			</script><?php
839
		}
840
	}
841
}
842
843
class Share_Facebook extends Sharing_Source {
@@ 1109-1148 (lines=40) @@
1106
		die();
1107
	}
1108
1109
	public function display_footer() {
1110
		global $post;
1111
1112
		if ( $this->smart ) { ?>
1113
			<script>
1114
			function renderGooglePlus1() {
1115
				if ( 'undefined' === typeof gapi ) {
1116
					return;
1117
				}
1118
1119
				jQuery( '.g-plus' ).each(function() {
1120
					var $button = jQuery( this );
1121
1122
					if ( ! $button.data( 'gplus-rendered' ) ) {
1123
						gapi.plusone.render( this, {
1124
							href: $button.attr( 'data-href' ),
1125
							size: $button.attr( 'data-size' ),
1126
							annotation: $button.attr( 'data-annotation' )
1127
						});
1128
1129
						$button.data( 'gplus-rendered', true );
1130
					}
1131
				});
1132
			}
1133
1134
			(function() {
1135
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1136
				po.src = 'https://apis.google.com/js/plusone.js';
1137
				po.innerHTML = '{"parsetags": "explicit"}';
1138
				po.onload = renderGooglePlus1;
1139
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1140
			})();
1141
1142
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1143
			</script>
1144
			<?php
1145
		} else {
1146
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1147
		}
1148
	}
1149
1150
	public function get_total( $post = false ) {
1151
		global $wpdb, $blog_id;
@@ 1384-1390 (lines=7) @@
1381
		die();
1382
	}
1383
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1384
	public function display_footer() {
1385
		if ( $this->smart ) {
1386
			?><script type="text/javascript" src="https://platform.tumblr.com/v1/share.js"></script><?php
1387
		} else {
1388
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1389
		}
1390
	}
1391
}
1392
1393
class Share_Pinterest extends Sharing_Source {
@@ 1584-1600 (lines=17) @@
1581
1582
	}
1583
1584
	function display_footer() {
1585
		if ( $this->smart ) :
1586
		?>
1587
		<script>
1588
		// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1589
		function jetpack_sharing_pocket_init() {
1590
			jQuery.getScript( 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1591
		}
1592
		jQuery( document ).ready( jetpack_sharing_pocket_init );
1593
		jQuery( document.body ).on( 'post-load', jetpack_sharing_pocket_init );
1594
		</script>
1595
		<?php
1596
		else :
1597
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1598
		endif;
1599
1600
	}
1601
1602
}
1603
@@ 1703-1728 (lines=26) @@
1700
		die();
1701
	}
1702
1703
	public function display_footer() {
1704
		if ( $this->smart ) :
1705
		?>
1706
		<script>
1707
		(function(r, d, s) {
1708
			r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) {
1709
				var js, sjs = d.getElementsByTagName(s)[0];
1710
				if (d.getElementById(p.id)) { return; }
1711
				js = d.createElement(s);
1712
				js.id = p.id;
1713
				js.src = p.scriptToLoad;
1714
				js.onload = p.callback
1715
				sjs.parentNode.insertBefore(js, sjs);
1716
			};
1717
			var p = {
1718
				scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',
1719
				id: 'skype_web_sdk'
1720
			};
1721
			r.loadSkypeWebSdkAsync(p);
1722
		})(window, document, 'script');
1723
		</script>
1724
		<?php
1725
		else :
1726
			$this->js_dialog( $this->shortname, array( 'width' => 305, 'height' => 665 ) );
1727
		endif;
1728
	}
1729
}
1730