Code Duplication    Length = 7-40 lines in 4 locations

modules/sharedaddy/sharing-sources.php 4 locations

@@ 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
@@ 860-876 (lines=17) @@
857
		die();
858
	}
859
860
	public function display_footer() {
861
		if ( ! $this->smart ) {
862
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
863
		} else {
864
			?><script type="text/javascript">
865
			jQuery( document ).ready( function() {
866
				jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
867
					IN.init();
868
				});
869
			});
870
			jQuery( document.body ).on( 'post-load', function() {
871
				if ( typeof IN != 'undefined' )
872
					IN.parse();
873
			});
874
			</script><?php
875
		}
876
	}
877
}
878
879
class Share_Facebook extends Sharing_Source {
@@ 1163-1202 (lines=40) @@
1160
		die();
1161
	}
1162
1163
	public function display_footer() {
1164
		global $post;
1165
1166
		if ( $this->smart ) { ?>
1167
			<script>
1168
			function renderGooglePlus1() {
1169
				if ( 'undefined' === typeof gapi ) {
1170
					return;
1171
				}
1172
1173
				jQuery( '.g-plus' ).each(function() {
1174
					var $button = jQuery( this );
1175
1176
					if ( ! $button.data( 'gplus-rendered' ) ) {
1177
						gapi.plusone.render( this, {
1178
							href: $button.attr( 'data-href' ),
1179
							size: $button.attr( 'data-size' ),
1180
							annotation: $button.attr( 'data-annotation' )
1181
						});
1182
1183
						$button.data( 'gplus-rendered', true );
1184
					}
1185
				});
1186
			}
1187
1188
			(function() {
1189
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1190
				po.src = 'https://apis.google.com/js/platform.js';
1191
				po.innerHTML = '{"parsetags": "explicit"}';
1192
				po.onload = renderGooglePlus1;
1193
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1194
			})();
1195
1196
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1197
			</script>
1198
			<?php
1199
		} else {
1200
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1201
		}
1202
	}
1203
1204
	public function get_total( $post = false ) {
1205
		global $wpdb, $blog_id;