Code Duplication    Length = 7-26 lines in 4 locations

modules/sharedaddy/sharing-sources.php 4 locations

@@ 1023-1039 (lines=17) @@
1020
		die();
1021
	}
1022
1023
	public function display_footer() {
1024
		if ( ! $this->smart ) {
1025
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
1026
		} else {
1027
			?>
1028
			<script type="text/javascript">
1029
				( function () {
1030
					var currentScript = document.currentScript;
1031
1032
					// Helper function to load an external script.
1033
					function loadScript( url, cb ) {
1034
						var script = document.createElement( 'script' );
1035
						var prev = currentScript || document.getElementsByTagName( 'script' )[ 0 ];
1036
						script.setAttribute( 'async', true );
1037
						script.setAttribute( 'src', url );
1038
						script.setAttribute( 'onload', cb );
1039
						prev.parentNode.insertBefore( script, prev );
1040
					}
1041
1042
					function init() {
@@ 1593-1599 (lines=7) @@
1590
		die();
1591
	}
1592
1593
	public function display_footer() {
1594
		if ( $this->smart ) {
1595
			?><script id="tumblr-js" type="text/javascript" src="https://assets.tumblr.com/share-button.js"></script><?php
1596
		} else {
1597
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1598
		}
1599
	}
1600
}
1601
1602
class Share_Pinterest extends Sharing_Source {
@@ 1841-1857 (lines=17) @@
1838
		return $this->build_amp_markup( $attrs );
1839
	}
1840
1841
	function display_footer() {
1842
		if ( $this->smart ) :
1843
		?>
1844
		<script>
1845
		( function () {
1846
			var currentScript = document.currentScript;
1847
1848
			// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1849
			function jetpack_sharing_pocket_init() {
1850
				var script = document.createElement( 'script' );
1851
				var prev = currentScript || document.getElementsByTagName( 'script' )[ 0 ];
1852
				script.setAttribute( 'async', true );
1853
				script.setAttribute( 'src', 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1854
				prev.parentNode.insertBefore( script, prev );
1855
			}
1856
1857
			if ( document.readyState === 'loading' ) {
1858
				document.addEventListener( 'DOMContentLoaded', jetpack_sharing_pocket_init );
1859
			} else {
1860
				jetpack_sharing_pocket_init();
@@ 2033-2058 (lines=26) @@
2030
		die();
2031
	}
2032
2033
	public function display_footer() {
2034
		if ( $this->smart ) :
2035
			?>
2036
			<script>
2037
				(function(r, d, s) {
2038
					r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) {
2039
							var js, sjs = d.getElementsByTagName(s)[0];
2040
							if (d.getElementById(p.id)) { return; }
2041
							js = d.createElement(s);
2042
							js.id = p.id;
2043
							js.src = p.scriptToLoad;
2044
							js.onload = p.callback
2045
							sjs.parentNode.insertBefore(js, sjs);
2046
						};
2047
					var p = {
2048
						scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',
2049
						id: 'skype_web_sdk'
2050
					};
2051
					r.loadSkypeWebSdkAsync(p);
2052
				})(window, document, 'script');
2053
			</script>
2054
			<?php
2055
		else :
2056
			$this->js_dialog( $this->shortname, array( 'width' => 305, 'height' => 665 ) );
2057
		endif;
2058
	}
2059
}
2060