Code Duplication    Length = 7-40 lines in 4 locations

modules/sharedaddy/sharing-sources.php 4 locations

@@ 846-862 (lines=17) @@
843
		die();
844
	}
845
846
	public function display_footer() {
847
		if ( ! $this->smart ) {
848
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
849
		} else {
850
			?><script type="text/javascript">
851
			jQuery( document ).ready( function() {
852
				jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
853
					IN.init();
854
				});
855
			});
856
			jQuery( document.body ).on( 'post-load', function() {
857
				if ( typeof IN != 'undefined' )
858
					IN.parse();
859
			});
860
			</script><?php
861
		}
862
	}
863
}
864
865
class Share_Facebook extends Sharing_Source {
@@ 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
@@ 1149-1188 (lines=40) @@
1146
		die();
1147
	}
1148
1149
	public function display_footer() {
1150
		global $post;
1151
1152
		if ( $this->smart ) { ?>
1153
			<script>
1154
			function renderGooglePlus1() {
1155
				if ( 'undefined' === typeof gapi ) {
1156
					return;
1157
				}
1158
1159
				jQuery( '.g-plus' ).each(function() {
1160
					var $button = jQuery( this );
1161
1162
					if ( ! $button.data( 'gplus-rendered' ) ) {
1163
						gapi.plusone.render( this, {
1164
							href: $button.attr( 'data-href' ),
1165
							size: $button.attr( 'data-size' ),
1166
							annotation: $button.attr( 'data-annotation' )
1167
						});
1168
1169
						$button.data( 'gplus-rendered', true );
1170
					}
1171
				});
1172
			}
1173
1174
			(function() {
1175
				var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1176
				po.src = 'https://apis.google.com/js/platform.js';
1177
				po.innerHTML = '{"parsetags": "explicit"}';
1178
				po.onload = renderGooglePlus1;
1179
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1180
			})();
1181
1182
			jQuery( document.body ).on( 'post-load', renderGooglePlus1 );
1183
			</script>
1184
			<?php
1185
		} else {
1186
			$this->js_dialog( 'google-plus-1', array( 'width' => 480, 'height' => 550 ) );
1187
		}
1188
	}
1189
1190
	public function get_total( $post = false ) {
1191
		global $wpdb, $blog_id;