Code Duplication    Length = 20-20 lines in 2 locations

class.jetpack-gutenberg.php 2 locations

@@ 42-61 (lines=20) @@
39
		 *
40
		 * @param bool false Whether to load Gutenberg blocks from CDN
41
		 */
42
		if ( apply_filters( 'jetpack_gutenberg_cdn', false ) ) {
43
			$cdn_base    = 'https://s0.wp.com/wp-content/mu-plugins/jetpack/_inc/blocks';
44
			$view_script = "$cdn_base/view.js";
45
			$view_style  = "$cdn_base/view$rtl.css";
46
47
			/**
48
			 * Filter to modify cache busting for Gutenberg block assets loaded from CDN
49
			 *
50
			 * @since 6.5.0
51
			 *
52
			 * @param string
53
			 */
54
			$version = apply_filters( 'jetpack_gutenberg_cdn_cache_buster', sprintf( '%s-%s', gmdate( 'd-m-Y' ), JETPACK__VERSION ) );
55
		} else {
56
			$view_script = plugins_url( '_inc/blocks/view.js', JETPACK__PLUGIN_FILE );
57
			$view_style  = plugins_url( "_inc/blocks/view$rtl.css", JETPACK__PLUGIN_FILE );
58
			$version     = Jetpack::is_development_version() && file_exists( JETPACK__PLUGIN_DIR . '_inc/blocks/view.js' )
59
				? filemtime( JETPACK__PLUGIN_DIR . '_inc/blocks/view.js' )
60
				: JETPACK__VERSION;
61
		}
62
63
		wp_enqueue_script( 'jetpack-blocks-view', $view_script, array(), $version );
64
		wp_enqueue_style( 'jetpack-blocks-view', $view_style, array(), $version );
@@ 82-101 (lines=20) @@
79
		$rtl = is_rtl() ? '.rtl' : '';
80
81
		/** This filter is already documented above */
82
		if ( apply_filters( 'jetpack_gutenberg_cdn', false ) ) {
83
			$cdn_base      = 'https://s0.wp.com/wp-content/mu-plugins/jetpack/_inc/blocks';
84
			$editor_script = "$cdn_base/editor.js";
85
			$editor_style  = "$cdn_base/editor$rtl.css";
86
87
			/** This filter is already documented above */
88
			$version = apply_filters( 'jetpack_gutenberg_cdn_cache_buster', sprintf( '%s-%s', gmdate( 'd-m-Y' ), JETPACK__VERSION ) );
89
		} else {
90
			$editor_script = plugins_url( '_inc/blocks/editor.js', JETPACK__PLUGIN_FILE );
91
			$editor_style  = plugins_url( "_inc/blocks/editor$rtl.css", JETPACK__PLUGIN_FILE );
92
			$version       = Jetpack::is_development_version() && file_exists( JETPACK__PLUGIN_DIR . '_inc/blocks/editor.js' )
93
				? filemtime( JETPACK__PLUGIN_DIR . '_inc/blocks/editor.js' )
94
				: JETPACK__VERSION;
95
		}
96
97
		wp_enqueue_script(
98
			'jetpack-blocks-editor',
99
			$editor_script,
100
			array(
101
				'lodash',
102
				'wp-api-fetch',
103
				'wp-blocks',
104
				'wp-components',