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 {
@@ 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
@@ 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;