Code Duplication    Length = 7-40 lines in 4 locations

modules/sharedaddy/sharing-sources.php 4 locations

@@ 861-877 (lines=17) @@
858
		die();
859
	}
860
861
	public function display_footer() {
862
		if ( ! $this->smart ) {
863
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
864
		} else {
865
			?><script type="text/javascript">
866
			jQuery( document ).ready( function() {
867
				jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
868
					IN.init();
869
				});
870
			});
871
			jQuery( document.body ).on( 'post-load', function() {
872
				if ( typeof IN != 'undefined' )
873
					IN.parse();
874
			});
875
			</script><?php
876
		}
877
	}
878
}
879
880
class Share_Facebook extends Sharing_Source {
@@ 1164-1203 (lines=40) @@
1161
		die();
1162
	}
1163
1164
	public function display_footer() {
1165
		global $post;
1166
1167
		if ( $this->smart ) { ?>
1168
			<script>
1169
			function renderGooglePlus1() {
1170
				if ( 'undefined' === typeof gapi ) {
1171
					return;
1172
				}
1173
1174
				jQuery( '.g-plus' ).each(function() {
1175
					var $button = jQuery( this );
1176
1177
					if ( ! $button.data( 'gplus-rendered' ) ) {
1178
						gapi.plusone.render( this, {
1179
							href: $button.attr( 'data-href' ),
1180
							size: $button.attr( 'data-size' ),
1181
							annotation: $button.attr( 'data-annotation' )
1182
						});
1183
1184
						$button.data( 'gplus-rendered', true );
1185
					}
1186
				});
1187
			}
1188
1189
			(function() {
1190
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1191
				po.src = 'https://apis.google.com/js/platform.js';
1192
				po.innerHTML = '{"parsetags": "explicit"}';
1193
				po.onload = renderGooglePlus1;
1194
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1195
			})();
1196
1197
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1198
			</script>
1199
			<?php
1200
		} else {
1201
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1202
		}
1203
	}
1204
1205
	public function get_total( $post = false ) {
1206
		global $wpdb, $blog_id;
@@ 1453-1459 (lines=7) @@
1450
		die();
1451
	}
1452
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1453
	public function display_footer() {
1454
		if ( $this->smart ) {
1455
			?><script type="text/javascript" src="https://platform.tumblr.com/v1/share.js"></script><?php
1456
		} else {
1457
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1458
		}
1459
	}
1460
}
1461
1462
class Share_Pinterest extends Sharing_Source {
@@ 1657-1673 (lines=17) @@
1654
1655
	}
1656
1657
	function display_footer() {
1658
		if ( $this->smart ) :
1659
		?>
1660
		<script>
1661
		// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1662
		function jetpack_sharing_pocket_init() {
1663
			jQuery.getScript( 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1664
		}
1665
		jQuery( document ).ready( jetpack_sharing_pocket_init );
1666
		jQuery( document.body ).on( 'post-load', jetpack_sharing_pocket_init );
1667
		</script>
1668
		<?php
1669
		else :
1670
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1671
		endif;
1672
1673
	}
1674
1675
}
1676