Code Duplication    Length = 7-40 lines in 4 locations

modules/sharedaddy/sharing-sources.php 4 locations

@@ 848-864 (lines=17) @@
845
		die();
846
	}
847
848
	public function display_footer() {
849
		if ( ! $this->smart ) {
850
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
851
		} else {
852
			?><script type="text/javascript">
853
			jQuery( document ).ready( function() {
854
				jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
855
					IN.init();
856
				});
857
			});
858
			jQuery( document.body ).on( 'post-load', function() {
859
				if ( typeof IN != 'undefined' )
860
					IN.parse();
861
			});
862
			</script><?php
863
		}
864
	}
865
}
866
867
class Share_Facebook extends Sharing_Source {
@@ 1151-1190 (lines=40) @@
1148
		die();
1149
	}
1150
1151
	public function display_footer() {
1152
		global $post;
1153
1154
		if ( $this->smart ) { ?>
1155
			<script>
1156
			function renderGooglePlus1() {
1157
				if ( 'undefined' === typeof gapi ) {
1158
					return;
1159
				}
1160
1161
				jQuery( '.g-plus' ).each(function() {
1162
					var $button = jQuery( this );
1163
1164
					if ( ! $button.data( 'gplus-rendered' ) ) {
1165
						gapi.plusone.render( this, {
1166
							href: $button.attr( 'data-href' ),
1167
							size: $button.attr( 'data-size' ),
1168
							annotation: $button.attr( 'data-annotation' )
1169
						});
1170
1171
						$button.data( 'gplus-rendered', true );
1172
					}
1173
				});
1174
			}
1175
1176
			(function() {
1177
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1178
				po.src = 'https://apis.google.com/js/plusone.min.js';
1179
				po.innerHTML = '{"parsetags": "explicit"}';
1180
				po.onload = renderGooglePlus1;
1181
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1182
			})();
1183
1184
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1185
			</script>
1186
			<?php
1187
		} else {
1188
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1189
		}
1190
	}
1191
1192
	public function get_total( $post = false ) {
1193
		global $wpdb, $blog_id;
@@ 1440-1446 (lines=7) @@
1437
		die();
1438
	}
1439
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1440
	public function display_footer() {
1441
		if ( $this->smart ) {
1442
			?><script type="text/javascript" src="https://platform.tumblr.com/v1/share.js"></script><?php
1443
		} else {
1444
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1445
		}
1446
	}
1447
}
1448
1449
class Share_Pinterest extends Sharing_Source {
@@ 1644-1660 (lines=17) @@
1641
1642
	}
1643
1644
	function display_footer() {
1645
		if ( $this->smart ) :
1646
		?>
1647
		<script>
1648
		// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1649
		function jetpack_sharing_pocket_init() {
1650
			jQuery.getScript( 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1651
		}
1652
		jQuery( document ).ready( jetpack_sharing_pocket_init );
1653
		jQuery( document.body ).on( 'post-load', jetpack_sharing_pocket_init );
1654
		</script>
1655
		<?php
1656
		else :
1657
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1658
		endif;
1659
1660
	}
1661
1662
}
1663