Code Duplication    Length = 8-8 lines in 2 locations

extensions/blocks/donations/donations.php 1 location

@@ 248-255 (lines=8) @@
245
 *
246
 * @return bool Whether to skip the post from AMP.
247
 */
248
function amp_skip_post( $skip, $post_id, $post ) {
249
	// When AMP is on standard mode, there are no non-AMP posts to link to where the donation can be completed, so let's
250
	// prevent the post from being available in AMP.
251
	if ( function_exists( 'amp_is_canonical' ) && \amp_is_canonical() && has_block( BLOCK_NAME, $post->post_content ) ) {
252
		return true;
253
	}
254
	return $skip;
255
}
256
add_filter( 'amp_skip_post', __NAMESPACE__ . '\amp_skip_post', 10, 3 );
257

extensions/blocks/simple-payments/simple-payments.php 1 location

@@ 88-95 (lines=8) @@
85
 *
86
 * @return bool Whether to skip the post from AMP.
87
 */
88
function amp_skip_post( $skip, $post_id, $post ) {
89
	// When AMP is on standard mode, there are no non-AMP posts to link to where the purchase can be completed, so let's
90
	// prevent the post from being available in AMP.
91
	if ( function_exists( 'amp_is_canonical' ) && \amp_is_canonical() && has_block( BLOCK_NAME, $post->post_content ) ) {
92
		return true;
93
	}
94
	return $skip;
95
}
96
add_filter( 'amp_skip_post', __NAMESPACE__ . '\amp_skip_post', 10, 3 );
97