Code Duplication    Length = 8-13 lines in 4 locations

extensions/blocks/instagram-gallery/instagram-gallery.php 1 location

@@ 25-32 (lines=8) @@
22
 * This is done via an action so that we can disable
23
 * registration if we need to.
24
 */
25
function register_block() {
26
	if ( ( defined( 'IS_WPCOM' ) && IS_WPCOM ) || Jetpack::is_active() ) {
27
		Blocks::jetpack_register_block(
28
			BLOCK_NAME,
29
			array( 'render_callback' => __NAMESPACE__ . '\render_block' )
30
		);
31
	}
32
}
33
add_action( 'init', __NAMESPACE__ . '\register_block' );
34
35
/**

extensions/blocks/mailchimp/mailchimp.php 1 location

@@ 25-37 (lines=13) @@
22
 * This is done via an action so that we can disable
23
 * registration if we need to.
24
 */
25
function register_block() {
26
	if (
27
		( defined( 'IS_WPCOM' ) && IS_WPCOM )
28
		|| Jetpack::is_active()
29
	) {
30
		Blocks::jetpack_register_block(
31
			BLOCK_NAME,
32
			array(
33
				'render_callback' => __NAMESPACE__ . '\load_assets',
34
			)
35
		);
36
	}
37
}
38
add_action( 'init', __NAMESPACE__ . '\register_block' );
39
40
/**

extensions/blocks/subscriptions/subscriptions.php 1 location

@@ 22-32 (lines=11) @@
19
 * This is done via an action so that we can disable
20
 * registration if we need to.
21
 */
22
function register_block() {
23
	if (
24
		( defined( 'IS_WPCOM' ) && IS_WPCOM )
25
		|| ( Jetpack::is_active() && Jetpack::is_module_active( 'subscriptions' ) )
26
	) {
27
		Blocks::jetpack_register_block(
28
			BLOCK_NAME,
29
			array( 'render_callback' => __NAMESPACE__ . '\render_block' )
30
		);
31
	}
32
}
33
add_action( 'init', __NAMESPACE__ . '\register_block' );
34
35
/**

extensions/blocks/tiled-gallery/tiled-gallery.php 1 location

@@ 35-47 (lines=13) @@
32
	/**
33
	 * Register the block
34
	 */
35
	public static function register() {
36
		if (
37
			( defined( 'IS_WPCOM' ) && IS_WPCOM )
38
			|| Jetpack::is_active()
39
		) {
40
			Blocks::jetpack_register_block(
41
				self::BLOCK_NAME,
42
				array(
43
					'render_callback' => array( __CLASS__, 'render' ),
44
				)
45
			);
46
		}
47
	}
48
49
	/**
50
	 * Tiled gallery block registration