Code Duplication    Length = 7-40 lines in 4 locations

modules/sharedaddy/sharing-sources.php 4 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