Code Duplication    Length = 5-7 lines in 3 locations

modules/publicize/publicize.php 1 location

@@ 1238-1242 (lines=5) @@
1235
1236
function publicize_calypso_url() {
1237
	$calypso_sharing_url = 'https://wordpress.com/sharing/';
1238
	if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'build_raw_urls' ) ) {
1239
		$site_suffix = Jetpack::build_raw_urls( home_url() );
1240
	} elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) {
1241
		$site_suffix = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() );
1242
	}
1243
1244
	if ( $site_suffix ) {
1245
		return $calypso_sharing_url . $site_suffix;

class.jetpack-gutenberg.php 1 location

@@ 566-572 (lines=7) @@
563
			? filemtime( JETPACK__PLUGIN_DIR . $blocks_dir . 'editor.js' )
564
			: JETPACK__VERSION;
565
566
		if ( method_exists( 'Jetpack', 'build_raw_urls' ) ) {
567
			$site_fragment = Jetpack::build_raw_urls( home_url() );
568
		} elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) {
569
			$site_fragment = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() );
570
		} else {
571
			$site_fragment = '';
572
		}
573
574
		wp_enqueue_script(
575
			'jetpack-blocks-editor',

modules/calypsoify/class.jetpack-calypsoify.php 1 location

@@ 337-341 (lines=5) @@
334
	 * @return string
335
	 */
336
	private function get_site_suffix() {
337
		if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'build_raw_urls' ) ) {
338
			$site_suffix = Jetpack::build_raw_urls( home_url() );
339
		} elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) {
340
			$site_suffix = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() );
341
		}
342
343
		if ( $site_suffix ) {
344
			return "/${site_suffix}";