Code Duplication    Length = 7-40 lines in 4 locations

modules/sharedaddy/sharing-sources.php 4 locations

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