Current File : /var/www/kurt6690.2978.w2868/site96340/wp-includes/block-template-utils.php
<?php
/**
 * Utilities used to fetch and create templates and template parts.
 *
 * @package WordPress
 * @since 5.8.0
 */

// Define constants for supported wp_template_part_area taxonomy.
if ( ! defined( 'WP_TEMPLATE_PART_AREA_HEADER' ) ) {
	define( 'WP_TEMPLATE_PART_AREA_HEADER', 'header' );
}
if ( ! defined( 'WP_TEMPLATE_PART_AREA_FOOTER' ) ) {
	define( 'WP_TEMPLATE_PART_AREA_FOOTER', 'footer' );
}
if ( ! defined( 'WP_TEMPLATE_PART_AREA_SIDEBAR' ) ) {
	define( 'WP_TEMPLATE_PART_AREA_SIDEBAR', 'sidebar' );
}
if ( ! defined( 'WP_TEMPLATE_PART_AREA_UNCATEGORIZED' ) ) {
	define( 'WP_TEMPLATE_PART_AREA_UNCATEGORIZED', 'uncategorized' );
}

/**
 * For backward compatibility reasons,
 * block themes might be using block-templates or block-template-parts,
 * this function ensures we fallback to these folders properly.
 *
 * @since 5.9.0
 *
 * @param string $theme_stylesheet The stylesheet. Default is to leverage the main theme root.
 *
 * @return string[] {
 *     Folder names used by block themes.
 *
 *     @type string $wp_template      Theme-relative directory name for block templates.
 *     @type string $wp_template_part Theme-relative directory name for block template parts.
 * }
 */
function get_block_theme_folders( $theme_stylesheet = null ) {
	$theme = wp_get_theme( (string) $theme_stylesheet );
	if ( ! $theme->exists() ) {
		// Return the default folders if the theme doesn't exist.
		return array(
			'wp_template'      => 'templates',
			'wp_template_part' => 'parts',
		);
	}
	return $theme->get_block_template_folders();
}

/**
 * Returns a filtered list of allowed area values for template parts.
 *
 * @since 5.9.0
 *
 * @return array[] {
 *     The allowed template part area values.
 *
 *     @type array ...$0 {
 *         Data for the allowed template part area.
 *
 *         @type string $area        Template part area name.
 *         @type string $label       Template part area label.
 *         @type string $description Template part area description.
 *         @type string $icon        Template part area icon.
 *         @type string $area_tag    Template part area tag.
 *     }
 * }
 */
function get_allowed_block_template_part_areas() {
	$default_area_definitions = array(
		array(
			'area'        => WP_TEMPLATE_PART_AREA_UNCATEGORIZED,
			'label'       => _x( 'General', 'template part area' ),
			'description' => __(
				'General templates often perform a specific role like displaying post content, and are not tied to any particular area.'
			),
			'icon'        => 'layout',
			'area_tag'    => 'div',
		),
		array(
			'area'        => WP_TEMPLATE_PART_AREA_HEADER,
			'label'       => _x( 'Header', 'template part area' ),
			'description' => __(
				'The Header template defines a page area that typically contains a title, logo, and main navigation.'
			),
			'icon'        => 'header',
			'area_tag'    => 'header',
		),
		array(
			'area'        => WP_TEMPLATE_PART_AREA_FOOTER,
			'label'       => _x( 'Footer', 'template part area' ),
			'description' => __(
				'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'
			),
			'icon'        => 'footer',
			'area_tag'    => 'footer',
		),
	);

	/**
	 * Filters the list of allowed template part area values.
	 *
	 * @since 5.9.0
	 *
	 * @param array[] $default_area_definitions {
	 *     The allowed template part area values.
	 *
	 *     @type array ...$0 {
	 *         Data for the template part area.
	 *
	 *         @type string $area        Template part area name.
	 *         @type string $label       Template part area label.
	 *         @type string $description Template part area description.
	 *         @type string $icon        Template part area icon.
	 *         @type string $area_tag    Template part area tag.
	 *     }
	 * }
	 */
	return apply_filters( 'default_wp_template_part_areas', $default_area_definitions );
}


/**
 * Returns a filtered list of default template types, containing their
 * localized titles and descriptions.
 *
 * @since 5.9.0
 *
 * @return array[] {
 *     The default template types.
 *
 *     @type array ...$0 {
 *         Data for the template type.
 *
 *         @type string $title       Template type title.
 *         @type string $description Template type description.
 *    }
 * }
 */
function get_default_block_template_types() {
	$default_template_types = array(
		'index'          => array(
			'title'       => _x( 'Index', 'Template name' ),
			'description' => __( 'Used as a fallback template for all pages when a more specific template is not defined.' ),
		),
		'home'           => array(
			'title'       => _x( 'Blog Home', 'Template name' ),
			'description' => __( 'Displays the latest posts as either the site homepage or as the "Posts page" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.' ),
		),
		'front-page'     => array(
			'title'       => _x( 'Front Page', 'Template name' ),
			'description' => __( 'Displays your site\'s homepage, whether it is set to display latest posts or a static page. The Front Page template takes precedence over all templates.' ),
		),
		'singular'       => array(
			'title'       => _x( 'Single Entries', 'Template name' ),
			'description' => __( 'Displays any single entry, such as a post or a page. This template will serve as a fallback when a more specific template (e.g. Single Post, Page, or Attachment) cannot be found.' ),
		),
		'single'         => array(
			'title'       => _x( 'Single Posts', 'Template name' ),
			'description' => __( 'Displays a single post on your website unless a custom template has been applied to that post or a dedicated template exists.' ),
		),
		'page'           => array(
			'title'       => _x( 'Pages', 'Template name' ),
			'description' => __( 'Displays a static page unless a custom template has been applied to that page or a dedicated template exists.' ),
		),
		'archive'        => array(
			'title'       => _x( 'All Archives', 'Template name' ),
			'description' => __( 'Displays any archive, including posts by a single author, category, tag, taxonomy, custom post type, and date. This template will serve as a fallback when more specific templates (e.g. Category or Tag) cannot be found.' ),
		),
		'author'         => array(
			'title'       => _x( 'Author Archives', 'Template name' ),
			'description' => __( 'Displays a single author\'s post archive. This template will serve as a fallback when a more specific template (e.g. Author: Admin) cannot be found.' ),
		),
		'category'       => array(
			'title'       => _x( 'Category Archives', 'Template name' ),
			'description' => __( 'Displays a post category archive. This template will serve as a fallback when a more specific template (e.g. Category: Recipes) cannot be found.' ),
		),
		'taxonomy'       => array(
			'title'       => _x( 'Taxonomy', 'Template name' ),
			'description' => __( 'Displays a custom taxonomy archive. Like categories and tags, taxonomies have terms which you use to classify things. For example: a taxonomy named "Art" can have multiple terms, such as "Modern" and "18th Century." This template will serve as a fallback when a more specific template (e.g. Taxonomy: Art) cannot be found.' ),
		),
		'date'           => array(
			'title'       => _x( 'Date Archives', 'Template name' ),
			'description' => __( 'Displays a post archive when a specific date is visited (e.g., example.com/2023/).' ),
		),
		'tag'            => array(
			'title'       => _x( 'Tag Archives', 'Template name' ),
			'description' => __( 'Displays a post tag archive. This template will serve as a fallback when a more specific template (e.g. Tag: Pizza) cannot be found.' ),
		),
		'attachment'     => array(
			'title'       => __( 'Attachment Pages' ),
			'description' => __( 'Displays when a visitor views the dedicated page that exists for any media attachment.' ),
		),
		'search'         => array(
			'title'       => _x( 'Search Results', 'Template name' ),
			'description' => __( 'Displays when a visitor performs a search on your website.' ),
		),
		'privacy-policy' => array(
			'title'       => __( 'Privacy Policy' ),
			'description' => __( 'Displays your site\'s Privacy Policy page.' ),
		),
		'404'            => array(
			'title'       => _x( 'Page: 404', 'Template name' ),
			'description' => __( 'Displays when a visitor views a non-existent page, such as a dead link or a mistyped URL.' ),
		),
	);

	/**
	 * Filters the list of default template types.
	 *
	 * @since 5.9.0
	 *
	 * @param array[] $default_template_types {
	 *     The default template types.
	 *
	 *     @type array ...$0 {
	 *         Data for the template type.
	 *
	 *         @type string $title       Template type title.
	 *         @type string $description Template type description.
	 *    }
	 * }
	 */
	return apply_filters( 'default_template_types', $default_template_types );
}

/**
 * Checks whether the input 'area' is a supported value.
 * Returns the input if supported, otherwise returns the 'uncategorized' value.
 *
 * @since 5.9.0
 * @access private
 *
 * @param string $type Template part area name.
 * @return string Input if supported, else the uncategorized value.
 */
function _filter_block_template_part_area( $type ) {
	$allowed_areas = array_map(
		static function ( $item ) {
			return $item['area'];
		},
		get_allowed_block_template_part_areas()
	);
	if ( in_array( $type, $allowed_areas, true ) ) {
		return $type;
	}

	$warning_message = sprintf(
		/* translators: %1$s: Template area type, %2$s: the uncategorized template area value. */
		__( '"%1$s" is not a supported wp_template_part area value and has been added as "%2$s".' ),
		$type,
		WP_TEMPLATE_PART_AREA_UNCATEGORIZED
	);
	wp_trigger_error( __FUNCTION__, $warning_message );
	return WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
}

/**
 * Finds all nested template part file paths in a theme's directory.
 *
 * @since 5.9.0
 * @access private
 *
 * @param string $base_directory The theme's file path.
 * @return string[] A list of paths to all template part files.
 */
function _get_block_templates_paths( $base_directory ) {
	static $template_path_list = array();
	if ( isset( $template_path_list[ $base_directory ] ) ) {
		return $template_path_list[ $base_directory ];
	}
	$path_list = array();
	if ( is_dir( $base_directory ) ) {
		$nested_files      = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) );
		$nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH );
		foreach ( $nested_html_files as $path => $file ) {
			$path_list[] = $path;
		}
	}
	$template_path_list[ $base_directory ] = $path_list;
	return $path_list;
}

/**
 * Retrieves the template file from the theme for a given slug.
 *
 * @since 5.9.0
 * @access private
 *
 * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
 * @param string $slug          Template slug.
 * @return array|null {
 *     Array with template metadata if $template_type is one of 'wp_template' or 'wp_template_part',
 *     null otherwise.
 *
 *     @type string   $slug      Template slug.
 *     @type string   $path      Template file path.
 *     @type string   $theme     Theme slug.
 *     @type string   $type      Template type.
 *     @type string   $area      Template area. Only for 'wp_template_part'.
 *     @type string   $title     Optional. Template title.
 *     @type string[] $postTypes Optional. List of post types that the template supports. Only for 'wp_template'.
 * }
 */
function _get_block_template_file( $template_type, $slug ) {
	if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) {
		return null;
	}

	$themes = array(
		get_stylesheet() => get_stylesheet_directory(),
		get_template()   => get_template_directory(),
	);
	foreach ( $themes as $theme_slug => $theme_dir ) {
		$template_base_paths = get_block_theme_folders( $theme_slug );
		$file_path           = $theme_dir . '/' . $template_base_paths[ $template_type ] . '/' . $slug . '.html';
		if ( file_exists( $file_path ) ) {
			$new_template_item = array(
				'slug'  => $slug,
				'path'  => $file_path,
				'theme' => $theme_slug,
				'type'  => $template_type,
			);

			if ( 'wp_template_part' === $template_type ) {
				return _add_block_template_part_area_info( $new_template_item );
			}

			if ( 'wp_template' === $template_type ) {
				return _add_block_template_info( $new_template_item );
			}

			return $new_template_item;
		}
	}

	return null;
}

/**
 * Retrieves the template files from the theme.
 *
 * @since 5.9.0
 * @since 6.3.0 Added the `$query` parameter.
 * @access private
 *
 * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
 * @param array  $query {
 *     Arguments to retrieve templates. Optional, empty by default.
 *
 *     @type string[] $slug__in     List of slugs to include.
 *     @type string[] $slug__not_in List of slugs to skip.
 *     @type string   $area         A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only).
 *     @type string   $post_type    Post type to get the templates for.
 * }
 *
 * @return array|null Template files on success, null if `$template_type` is not matched.
 */
function _get_block_templates_files( $template_type, $query = array() ) {
	if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) {
		return null;
	}

	$default_template_types = array();
	if ( 'wp_template' === $template_type ) {
		$default_template_types = get_default_block_template_types();
	}

	// Prepare metadata from $query.
	$slugs_to_include = isset( $query['slug__in'] ) ? $query['slug__in'] : array();
	$slugs_to_skip    = isset( $query['slug__not_in'] ) ? $query['slug__not_in'] : array();
	$area             = isset( $query['area'] ) ? $query['area'] : null;
	$post_type        = isset( $query['post_type'] ) ? $query['post_type'] : '';

	$stylesheet = get_stylesheet();
	$template   = get_template();
	$themes     = array(
		$stylesheet => get_stylesheet_directory(),
	);
	// Add the parent theme if it's not the same as the current theme.
	if ( $stylesheet !== $template ) {
		$themes[ $template ] = get_template_directory();
	}
	$template_files = array();
	foreach ( $themes as $theme_slug => $theme_dir ) {
		$template_base_paths  = get_block_theme_folders( $theme_slug );
		$theme_template_files = _get_block_templates_paths( $theme_dir . '/' . $template_base_paths[ $template_type ] );
		foreach ( $theme_template_files as $template_file ) {
			$template_base_path = $template_base_paths[ $template_type ];
			$template_slug      = substr(
				$template_file,
				// Starting position of slug.
				strpos( $template_file, $template_base_path . DIRECTORY_SEPARATOR ) + 1 + strlen( $template_base_path ),
				// Subtract ending '.html'.
				-5
			);

			// Skip this item if its slug doesn't match any of the slugs to include.
			if ( ! empty( $slugs_to_include ) && ! in_array( $template_slug, $slugs_to_include, true ) ) {
				continue;
			}

			// Skip this item if its slug matches any of the slugs to skip.
			if ( ! empty( $slugs_to_skip ) && in_array( $template_slug, $slugs_to_skip, true ) ) {
				continue;
			}

			/*
			 * The child theme items (stylesheet) are processed before the parent theme's (template).
			 * If a child theme defines a template, prevent the parent template from being added to the list as well.
			 */
			if ( isset( $template_files[ $template_slug ] ) ) {
				continue;
			}

			$new_template_item = array(
				'slug'  => $template_slug,
				'path'  => $template_file,
				'theme' => $theme_slug,
				'type'  => $template_type,
			);

			if ( 'wp_template_part' === $template_type ) {
				$candidate = _add_block_template_part_area_info( $new_template_item );
				if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) {
					$template_files[ $template_slug ] = $candidate;
				}
			}

			if ( 'wp_template' === $template_type ) {
				$candidate = _add_block_template_info( $new_template_item );
				$is_custom = ! isset( $default_template_types[ $candidate['slug'] ] );

				if (
					! $post_type ||
					( $post_type && isset( $candidate['postTypes'] ) && in_array( $post_type, $candidate['postTypes'], true ) )
				) {
					$template_files[ $template_slug ] = $candidate;
				}

				// The custom templates with no associated post types are available for all post types.
				if ( $post_type && ! isset( $candidate['postTypes'] ) && $is_custom ) {
					$template_files[ $template_slug ] = $candidate;
				}
			}
		}
	}

	return array_values( $template_files );
}

/**
 * Attempts to add custom template information to the template item.
 *
 * @since 5.9.0
 * @access private
 *
 * @param array $template_item Template to add information to (requires 'slug' field).
 * @return array Template item.
 */
function _add_block_template_info( $template_item ) {
	if ( ! wp_theme_has_theme_json() ) {
		return $template_item;
	}

	$theme_data = wp_get_theme_data_custom_templates();
	if ( isset( $theme_data[ $template_item['slug'] ] ) ) {
		$template_item['title']     = $theme_data[ $template_item['slug'] ]['title'];
		$template_item['postTypes'] = $theme_data[ $template_item['slug'] ]['postTypes'];
	}

	return $template_item;
}

/**
 * Attempts to add the template part's area information to the input template.
 *
 * @since 5.9.0
 * @access private
 *
 * @param array $template_info Template to add information to (requires 'type' and 'slug' fields).
 * @return array Template info.
 */
function _add_block_template_part_area_info( $template_info ) {
	if ( wp_theme_has_theme_json() ) {
		$theme_data = wp_get_theme_data_template_parts();
	}

	if ( isset( $theme_data[ $template_info['slug'] ]['area'] ) ) {
		$template_info['title'] = $theme_data[ $template_info['slug'] ]['title'];
		$template_info['area']  = _filter_block_template_part_area( $theme_data[ $template_info['slug'] ]['area'] );
	} else {
		$template_info['area'] = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
	}

	return $template_info;
}

/**
 * Returns an array containing the references of
 * the passed blocks and their inner blocks.
 *
 * @since 5.9.0
 * @access private
 *
 * @param array $blocks array of blocks.
 * @return array block references to the passed blocks and their inner blocks.
 */
function _flatten_blocks( &$blocks ) {
	$all_blocks = array();
	$queue      = array();
	foreach ( $blocks as &$block ) {
		$queue[] = &$block;
	}

	while ( count( $queue ) > 0 ) {
		$block = &$queue[0];
		array_shift( $queue );
		$all_blocks[] = &$block;

		if ( ! empty( $block['innerBlocks'] ) ) {
			foreach ( $block['innerBlocks'] as &$inner_block ) {
				$queue[] = &$inner_block;
			}
		}
	}

	return $all_blocks;
}

/**
 * Injects the active theme's stylesheet as a `theme` attribute
 * into a given template part block.
 *
 * @since 6.4.0
 * @access private
 *
 * @param array $block a parsed block.
 */
function _inject_theme_attribute_in_template_part_block( &$block ) {
	if (
		'core/template-part' === $block['blockName'] &&
		! isset( $block['attrs']['theme'] )
	) {
		$block['attrs']['theme'] = get_stylesheet();
	}
}

/**
 * Removes the `theme` attribute from a given template part block.
 *
 * @since 6.4.0
 * @access private
 *
 * @param array $block a parsed block.
 */
function _remove_theme_attribute_from_template_part_block( &$block ) {
	if (
		'core/template-part' === $block['blockName'] &&
		isset( $block['attrs']['theme'] )
	) {
		unset( $block['attrs']['theme'] );
	}
}

/**
 * Builds a unified template object based on a theme file.
 *
 * @since 5.9.0
 * @since 6.3.0 Added `modified` property to template objects.
 * @access private
 *
 * @param array  $template_file Theme file.
 * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
 * @return WP_Block_Template Template.
 */
function _build_block_template_result_from_file( $template_file, $template_type ) {
	$default_template_types = get_default_block_template_types();
	$theme                  = get_stylesheet();

	$template                 = new WP_Block_Template();
	$template->id             = $theme . '//' . $template_file['slug'];
	$template->theme          = $theme;
	$template->content        = file_get_contents( $template_file['path'] );
	$template->slug           = $template_file['slug'];
	$template->source         = 'theme';
	$template->type           = $template_type;
	$template->title          = ! empty( $template_file['title'] ) ? $template_file['title'] : $template_file['slug'];
	$template->status         = 'publish';
	$template->has_theme_file = true;
	$template->is_custom      = true;
	$template->modified       = null;

	if ( 'wp_template' === $template_type ) {
		$registered_template = WP_Block_Templates_Registry::get_instance()->get_by_slug( $template_file['slug'] );
		if ( $registered_template ) {
			$template->plugin      = $registered_template->plugin;
			$template->title       = empty( $template->title ) || $template->title === $template->slug ? $registered_template->title : $template->title;
			$template->description = empty( $template->description ) ? $registered_template->description : $template->description;
		}
	}

	if ( 'wp_template' === $template_type && isset( $default_template_types[ $template_file['slug'] ] ) ) {
		$template->description = $default_template_types[ $template_file['slug'] ]['description'];
		$template->title       = $default_template_types[ $template_file['slug'] ]['title'];
		$template->is_custom   = false;
	}

	if ( 'wp_template' === $template_type && isset( $template_file['postTypes'] ) ) {
		$template->post_types = $template_file['postTypes'];
	}

	if ( 'wp_template_part' === $template_type && isset( $template_file['area'] ) ) {
		$template->area = $template_file['area'];
	}

	if ( 'wp_template_part' === $template->type ) {
		/*
		 * In order for hooked blocks to be inserted at positions first_child and last_child in a template part,
		 * we need to wrap its content a mock template part block and traverse it.
		 */
		$content           = get_comment_delimited_block_content(
			'core/template-part',
			array(),
			$template->content
		);
		$content           = apply_block_hooks_to_content(
			$content,
			$template,
			'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata'
		);
		$template->content = remove_serialized_parent_block( $content );
	} else {
		$template->content = apply_block_hooks_to_content(
			$template->content,
			$template,
			'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata'
		);
	}

	return $template;
}

/**
 * Builds the title and description of a post-specific template based on the underlying referenced post.
 *
 * Mutates the underlying template object.
 *
 * @since 6.1.0
 * @access private
 *
 * @param string            $post_type Post type, e.g. page, post, product.
 * @param string            $slug      Slug of the post, e.g. a-story-about-shoes.
 * @param WP_Block_Template $template  Template to mutate adding the description and title computed.
 * @return bool Returns true if the referenced post was found and false otherwise.
 */
function _wp_build_title_and_description_for_single_post_type_block_template( $post_type, $slug, WP_Block_Template $template ) {
	$post_type_object = get_post_type_object( $post_type );

	$default_args = array(
		'post_type'              => $post_type,
		'post_status'            => 'publish',
		'posts_per_page'         => 1,
		'update_post_meta_cache' => false,
		'update_post_term_cache' => false,
		'ignore_sticky_posts'    => true,
		'no_found_rows'          => true,
	);

	$args = array(
		'name' => $slug,
	);
	$args = wp_parse_args( $args, $default_args );

	$posts_query = new WP_Query( $args );

	if ( empty( $posts_query->posts ) ) {
		$template->title = sprintf(
			/* translators: Custom template title in the Site Editor referencing a post that was not found. 1: Post type singular name, 2: Post type slug. */
			__( 'Not found: %1$s (%2$s)' ),
			$post_type_object->labels->singular_name,
			$slug
		);

		return false;
	}

	$post_title = $posts_query->posts[0]->post_title;

	$template->title = sprintf(
		/* translators: Custom template title in the Site Editor. 1: Post type singular name, 2: Post title. */
		__( '%1$s: %2$s' ),
		$post_type_object->labels->singular_name,
		$post_title
	);

	$template->description = sprintf(
		/* translators: Custom template description in the Site Editor. %s: Post title. */
		__( 'Template for %s' ),
		$post_title
	);

	$args = array(
		'title' => $post_title,
	);
	$args = wp_parse_args( $args, $default_args );

	$posts_with_same_title_query = new WP_Query( $args );

	if ( count( $posts_with_same_title_query->posts ) > 1 ) {
		$template->title = sprintf(
			/* translators: Custom template title in the Site Editor. 1: Template title, 2: Post type slug. */
			__( '%1$s (%2$s)' ),
			$template->title,
			$slug
		);
	}

	return true;
}

/**
 * Builds the title and description of a taxonomy-specific template based on the underlying entity referenced.
 *
 * Mutates the underlying template object.
 *
 * @since 6.1.0
 * @access private
 *
 * @param string            $taxonomy Identifier of the taxonomy, e.g. category.
 * @param string            $slug     Slug of the term, e.g. shoes.
 * @param WP_Block_Template $template Template to mutate adding the description and title computed.
 * @return bool True if the term referenced was found and false otherwise.
 */
function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy, $slug, WP_Block_Template $template ) {
	$taxonomy_object = get_taxonomy( $taxonomy );

	$default_args = array(
		'taxonomy'               => $taxonomy,
		'hide_empty'             => false,
		'update_term_meta_cache' => false,
	);

	$term_query = new WP_Term_Query();

	$args = array(
		'number' => 1,
		'slug'   => $slug,
	);
	$args = wp_parse_args( $args, $default_args );

	$terms_query = $term_query->query( $args );

	if ( empty( $terms_query ) ) {
		$template->title = sprintf(
			/* translators: Custom template title in the Site Editor, referencing a taxonomy term that was not found. 1: Taxonomy singular name, 2: Term slug. */
			__( 'Not found: %1$s (%2$s)' ),
			$taxonomy_object->labels->singular_name,
			$slug
		);
		return false;
	}

	$term_title = $terms_query[0]->name;

	$template->title = sprintf(
		/* translators: Custom template title in the Site Editor. 1: Taxonomy singular name, 2: Term title. */
		__( '%1$s: %2$s' ),
		$taxonomy_object->labels->singular_name,
		$term_title
	);

	$template->description = sprintf(
		/* translators: Custom template description in the Site Editor. %s: Term title. */
		__( 'Template for %s' ),
		$term_title
	);

	$term_query = new WP_Term_Query();

	$args = array(
		'number' => 2,
		'name'   => $term_title,
	);
	$args = wp_parse_args( $args, $default_args );

	$terms_with_same_title_query = $term_query->query( $args );

	if ( count( $terms_with_same_title_query ) > 1 ) {
		$template->title = sprintf(
			/* translators: Custom template title in the Site Editor. 1: Template title, 2: Term slug. */
			__( '%1$s (%2$s)' ),
			$template->title,
			$slug
		);
	}

	return true;
}

/**
 * Builds a block template object from a post object.
 *
 * This is a helper function that creates a block template object from a given post object.
 * It is self-sufficient in that it only uses information passed as arguments; it does not
 * query the database for additional information.
 *
 * @since 6.5.3
 * @access private
 *
 * @param WP_Post $post  Template post.
 * @param array   $terms Additional terms to inform the template object.
 * @param array   $meta  Additional meta fields to inform the template object.
 * @return WP_Block_Template|WP_Error Template or error object.
 */
function _build_block_template_object_from_post_object( $post, $terms = array(), $meta = array() ) {
	if ( empty( $terms['wp_theme'] ) ) {
		return new WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.' ) );
	}
	$theme = $terms['wp_theme'];

	$default_template_types = get_default_block_template_types();

	$template_file  = _get_block_template_file( $post->post_type, $post->post_name );
	$has_theme_file = get_stylesheet() === $theme && null !== $template_file;

	$template                 = new WP_Block_Template();
	$template->wp_id          = $post->ID;
	$template->id             = $theme . '//' . $post->post_name;
	$template->theme          = $theme;
	$template->content        = $post->post_content;
	$template->slug           = $post->post_name;
	$template->source         = 'custom';
	$template->origin         = ! empty( $meta['origin'] ) ? $meta['origin'] : null;
	$template->type           = $post->post_type;
	$template->description    = $post->post_excerpt;
	$template->title          = $post->post_title;
	$template->status         = $post->post_status;
	$template->has_theme_file = $has_theme_file;
	$template->is_custom      = empty( $meta['is_wp_suggestion'] );
	$template->author         = $post->post_author;
	$template->modified       = $post->post_modified;

	if ( 'wp_template' === $post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) {
		$template->post_types = $template_file['postTypes'];
	}

	if ( 'wp_template' === $post->post_type && isset( $default_template_types[ $template->slug ] ) ) {
		$template->is_custom = false;
	}

	if ( 'wp_template_part' === $post->post_type && isset( $terms['wp_template_part_area'] ) ) {
		$template->area = $terms['wp_template_part_area'];
	}

	return $template;
}

/**
 * Builds a unified template object based a post Object.
 *
 * @since 5.9.0
 * @since 6.3.0 Added `modified` property to template objects.
 * @since 6.4.0 Added support for a revision post to be passed to this function.
 * @access private
 *
 * @param WP_Post $post Template post.
 * @return WP_Block_Template|WP_Error Template or error object.
 */
function _build_block_template_result_from_post( $post ) {
	$post_id = wp_is_post_revision( $post );
	if ( ! $post_id ) {
		$post_id = $post;
	}
	$parent_post     = get_post( $post_id );
	$post->post_name = $parent_post->post_name;
	$post->post_type = $parent_post->post_type;

	$terms = get_the_terms( $parent_post, 'wp_theme' );

	if ( is_wp_error( $terms ) ) {
		return $terms;
	}

	if ( ! $terms ) {
		return new WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.' ) );
	}

	$terms = array(
		'wp_theme' => $terms[0]->name,
	);

	if ( 'wp_template_part' === $parent_post->post_type ) {
		$type_terms = get_the_terms( $parent_post, 'wp_template_part_area' );
		if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) {
			$terms['wp_template_part_area'] = $type_terms[0]->name;
		}
	}

	$meta = array(
		'origin'           => get_post_meta( $parent_post->ID, 'origin', true ),
		'is_wp_suggestion' => get_post_meta( $parent_post->ID, 'is_wp_suggestion', true ),
	);

	$template = _build_block_template_object_from_post_object( $post, $terms, $meta );

	if ( is_wp_error( $template ) ) {
		return $template;
	}

	// Check for a block template without a description and title or with a title equal to the slug.
	if ( 'wp_template' === $parent_post->post_type && empty( $template->description ) && ( empty( $template->title ) || $template->title === $template->slug ) ) {
		$matches = array();

		// Check for a block template for a single author, page, post, tag, category, custom post type, or custom taxonomy.
		if ( preg_match( '/(author|page|single|tag|category|taxonomy)-(.+)/', $template->slug, $matches ) ) {
			$type           = $matches[1];
			$slug_remaining = $matches[2];

			switch ( $type ) {
				case 'author':
					$nice_name = $slug_remaining;
					$users     = get_users(
						array(
							'capability'     => 'edit_posts',
							'search'         => $nice_name,
							'search_columns' => array( 'user_nicename' ),
							'fields'         => 'display_name',
						)
					);

					if ( empty( $users ) ) {
						$template->title = sprintf(
							/* translators: Custom template title in the Site Editor, referencing a deleted author. %s: Author nicename. */
							__( 'Deleted author: %s' ),
							$nice_name
						);
					} else {
						$author_name = $users[0];

						$template->title = sprintf(
							/* translators: Custom template title in the Site Editor. %s: Author name. */
							__( 'Author: %s' ),
							$author_name
						);

						$template->description = sprintf(
							/* translators: Custom template description in the Site Editor. %s: Author name. */
							__( 'Template for %s' ),
							$author_name
						);

						$users_with_same_name = get_users(
							array(
								'capability'     => 'edit_posts',
								'search'         => $author_name,
								'search_columns' => array( 'display_name' ),
								'fields'         => 'display_name',
							)
						);

						if ( count( $users_with_same_name ) > 1 ) {
							$template->title = sprintf(
								/* translators: Custom template title in the Site Editor. 1: Template title of an author template, 2: Author nicename. */
								__( '%1$s (%2$s)' ),
								$template->title,
								$nice_name
							);
						}
					}
					break;
				case 'page':
					_wp_build_title_and_description_for_single_post_type_block_template( 'page', $slug_remaining, $template );
					break;
				case 'single':
					$post_types = get_post_types();

					foreach ( $post_types as $post_type ) {
						$post_type_length = strlen( $post_type ) + 1;

						// If $slug_remaining starts with $post_type followed by a hyphen.
						if ( 0 === strncmp( $slug_remaining, $post_type . '-', $post_type_length ) ) {
							$slug  = substr( $slug_remaining, $post_type_length, strlen( $slug_remaining ) );
							$found = _wp_build_title_and_description_for_single_post_type_block_template( $post_type, $slug, $template );

							if ( $found ) {
								break;
							}
						}
					}
					break;
				case 'tag':
					_wp_build_title_and_description_for_taxonomy_block_template( 'post_tag', $slug_remaining, $template );
					break;
				case 'category':
					_wp_build_title_and_description_for_taxonomy_block_template( 'category', $slug_remaining, $template );
					break;
				case 'taxonomy':
					$taxonomies = get_taxonomies();

					foreach ( $taxonomies as $taxonomy ) {
						$taxonomy_length = strlen( $taxonomy ) + 1;

						// If $slug_remaining starts with $taxonomy followed by a hyphen.
						if ( 0 === strncmp( $slug_remaining, $taxonomy . '-', $taxonomy_length ) ) {
							$slug  = substr( $slug_remaining, $taxonomy_length, strlen( $slug_remaining ) );
							$found = _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy, $slug, $template );

							if ( $found ) {
								break;
							}
						}
					}
					break;
			}
		}
	}

	if ( 'wp_template' === $post->post_type ) {
		$registered_template = WP_Block_Templates_Registry::get_instance()->get_by_slug( $template->slug );
		if ( $registered_template ) {
			$template->plugin      = $registered_template->plugin;
			$template->origin      =
				'theme' !== $template->origin && 'theme' !== $template->source ?
				'plugin' :
				$template->origin;
			$template->title       = empty( $template->title ) || $template->title === $template->slug ? $registered_template->title : $template->title;
			$template->description = empty( $template->description ) ? $registered_template->description : $template->description;
		}
	}

	if ( 'wp_template_part' === $template->type ) {
		$existing_ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true );
		$attributes                     = ! empty( $existing_ignored_hooked_blocks ) ? array( 'metadata' => array( 'ignoredHookedBlocks' => json_decode( $existing_ignored_hooked_blocks, true ) ) ) : array();

		/*
		 * In order for hooked blocks to be inserted at positions first_child and last_child in a template part,
		 * we need to wrap its content a mock template part block and traverse it.
		 */
		$content           = get_comment_delimited_block_content(
			'core/template-part',
			$attributes,
			$template->content
		);
		$content           = apply_block_hooks_to_content(
			$content,
			$template,
			'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata'
		);
		$template->content = remove_serialized_parent_block( $content );
	} else {
		$template->content = apply_block_hooks_to_content(
			$template->content,
			$template,
			'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata'
		);
	}

	return $template;
}

/**
 * Retrieves a list of unified template objects based on a query.
 *
 * @since 5.8.0
 *
 * @param array  $query {
 *     Optional. Arguments to retrieve templates.
 *
 *     @type string[] $slug__in  List of slugs to include.
 *     @type int      $wp_id     Post ID of customized template.
 *     @type string   $area      A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only).
 *     @type string   $post_type Post type to get the templates for.
 * }
 * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
 * @return WP_Block_Template[] Array of block templates.
 */
function get_block_templates( $query = array(), $template_type = 'wp_template' ) {
	/**
	 * Filters the block templates array before the query takes place.
	 *
	 * Return a non-null value to bypass the WordPress queries.
	 *
	 * @since 5.9.0
	 *
	 * @param WP_Block_Template[]|null $block_templates Return an array of block templates to short-circuit the default query,
	 *                                                  or null to allow WP to run its normal queries.
	 * @param array  $query {
	 *     Arguments to retrieve templates. All arguments are optional.
	 *
	 *     @type string[] $slug__in  List of slugs to include.
	 *     @type int      $wp_id     Post ID of customized template.
	 *     @type string   $area      A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only).
	 *     @type string   $post_type Post type to get the templates for.
	 * }
	 * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
	 */
	$templates = apply_filters( 'pre_get_block_templates', null, $query, $template_type );
	if ( ! is_null( $templates ) ) {
		return $templates;
	}

	$post_type     = isset( $query['post_type'] ) ? $query['post_type'] : '';
	$wp_query_args = array(
		'post_status'         => array( 'auto-draft', 'draft', 'publish' ),
		'post_type'           => $template_type,
		'posts_per_page'      => -1,
		'no_found_rows'       => true,
		'lazy_load_term_meta' => false,
		'tax_query'           => array(
			array(
				'taxonomy' => 'wp_theme',
				'field'    => 'name',
				'terms'    => get_stylesheet(),
			),
		),
	);

	if ( 'wp_template_part' === $template_type && isset( $query['area'] ) ) {
		$wp_query_args['tax_query'][]           = array(
			'taxonomy' => 'wp_template_part_area',
			'field'    => 'name',
			'terms'    => $query['area'],
		);
		$wp_query_args['tax_query']['relation'] = 'AND';
	}

	if ( ! empty( $query['slug__in'] ) ) {
		$wp_query_args['post_name__in']  = $query['slug__in'];
		$wp_query_args['posts_per_page'] = count( array_unique( $query['slug__in'] ) );
	}

	// This is only needed for the regular templates/template parts post type listing and editor.
	if ( isset( $query['wp_id'] ) ) {
		$wp_query_args['p'] = $query['wp_id'];
	} else {
		$wp_query_args['post_status'] = 'publish';
	}

	$template_query = new WP_Query( $wp_query_args );
	$query_result   = array();
	foreach ( $template_query->posts as $post ) {
		$template = _build_block_template_result_from_post( $post );

		if ( is_wp_error( $template ) ) {
			continue;
		}

		if ( $post_type && ! $template->is_custom ) {
			continue;
		}

		if (
			$post_type &&
			isset( $template->post_types ) &&
			! in_array( $post_type, $template->post_types, true )
		) {
			continue;
		}

		$query_result[] = $template;
	}

	if ( ! isset( $query['wp_id'] ) ) {
		/*
		 * If the query has found some user templates, those have priority
		 * over the theme-provided ones, so we skip querying and building them.
		 */
		$query['slug__not_in'] = wp_list_pluck( $query_result, 'slug' );
		$template_files        = _get_block_templates_files( $template_type, $query );
		foreach ( $template_files as $template_file ) {
			$query_result[] = _build_block_template_result_from_file( $template_file, $template_type );
		}

		if ( 'wp_template' === $template_type ) {
			// Add templates registered in the template registry. Filtering out the ones which have a theme file.
			$registered_templates          = WP_Block_Templates_Registry::get_instance()->get_by_query( $query );
			$matching_registered_templates = array_filter(
				$registered_templates,
				function ( $registered_template ) use ( $template_files ) {
					foreach ( $template_files as $template_file ) {
						if ( $template_file['slug'] === $registered_template->slug ) {
							return false;
						}
					}
					return true;
				}
			);
			$query_result                  = array_merge( $query_result, $matching_registered_templates );
		}
	}

	/**
	 * Filters the array of queried block templates array after they've been fetched.
	 *
	 * @since 5.9.0
	 *
	 * @param WP_Block_Template[] $query_result Array of found block templates.
	 * @param array               $query {
	 *     Arguments to retrieve templates. All arguments are optional.
	 *
	 *     @type string[] $slug__in  List of slugs to include.
	 *     @type int      $wp_id     Post ID of customized template.
	 *     @type string   $area      A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only).
	 *     @type string   $post_type Post type to get the templates for.
	 * }
	 * @param string              $template_type wp_template or wp_template_part.
	 */
	return apply_filters( 'get_block_templates', $query_result, $query, $template_type );
}

/**
 * Retrieves a single unified template object using its id.
 *
 * @since 5.8.0
 *
 * @param string $id            Template unique identifier (example: 'theme_slug//template_slug').
 * @param string $template_type Optional. Template type. Either 'wp_template' or 'wp_template_part'.
 *                              Default 'wp_template'.
 * @return WP_Block_Template|null Template.
 */
function get_block_template( $id, $template_type = 'wp_template' ) {
	/**
	 * Filters the block template object before the query takes place.
	 *
	 * Return a non-null value to bypass the WordPress queries.
	 *
	 * @since 5.9.0
	 *
	 * @param WP_Block_Template|null $block_template Return block template object to short-circuit the default query,
	 *                                               or null to allow WP to run its normal queries.
	 * @param string                 $id             Template unique identifier (example: 'theme_slug//template_slug').
	 * @param string                 $template_type  Template type. Either 'wp_template' or 'wp_template_part'.
	 */
	$block_template = apply_filters( 'pre_get_block_template', null, $id, $template_type );
	if ( ! is_null( $block_template ) ) {
		return $block_template;
	}

	$parts = explode( '//', $id, 2 );
	if ( count( $parts ) < 2 ) {
		return null;
	}
	list( $theme, $slug ) = $parts;
	$wp_query_args        = array(
		'post_name__in'  => array( $slug ),
		'post_type'      => $template_type,
		'post_status'    => array( 'auto-draft', 'draft', 'publish', 'trash' ),
		'posts_per_page' => 1,
		'no_found_rows'  => true,
		'tax_query'      => array(
			array(
				'taxonomy' => 'wp_theme',
				'field'    => 'name',
				'terms'    => $theme,
			),
		),
	);
	$template_query       = new WP_Query( $wp_query_args );
	$posts                = $template_query->posts;

	if ( count( $posts ) > 0 ) {
		$template = _build_block_template_result_from_post( $posts[0] );

		if ( ! is_wp_error( $template ) ) {
			return $template;
		}
	}

	$block_template = get_block_file_template( $id, $template_type );

	/**
	 * Filters the queried block template object after it's been fetched.
	 *
	 * @since 5.9.0
	 *
	 * @param WP_Block_Template|null $block_template The found block template, or null if there isn't one.
	 * @param string                 $id             Template unique identifier (example: 'theme_slug//template_slug').
	 * @param string                 $template_type  Template type. Either 'wp_template' or 'wp_template_part'.
	 */
	return apply_filters( 'get_block_template', $block_template, $id, $template_type );
}

/**
 * Retrieves a unified template object based on a theme file.
 *
 * This is a fallback of get_block_template(), used when no templates are found in the database.
 *
 * @since 5.9.0
 *
 * @param string $id            Template unique identifier (example: 'theme_slug//template_slug').
 * @param string $template_type Optional. Template type. Either 'wp_template' or 'wp_template_part'.
 *                              Default 'wp_template'.
 * @return WP_Block_Template|null The found block template, or null if there isn't one.
 */
function get_block_file_template( $id, $template_type = 'wp_template' ) {
	/**
	 * Filters the block template object before the theme file discovery takes place.
	 *
	 * Return a non-null value to bypass the WordPress theme file discovery.
	 *
	 * @since 5.9.0
	 *
	 * @param WP_Block_Template|null $block_template Return block template object to short-circuit the default query,
	 *                                               or null to allow WP to run its normal queries.
	 * @param string                 $id             Template unique identifier (example: 'theme_slug//template_slug').
	 * @param string                 $template_type  Template type. Either 'wp_template' or 'wp_template_part'.
	 */
	$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );
	if ( ! is_null( $block_template ) ) {
		return $block_template;
	}

	$parts = explode( '//', $id, 2 );
	if ( count( $parts ) < 2 ) {
		/** This filter is documented in wp-includes/block-template-utils.php */
		return apply_filters( 'get_block_file_template', null, $id, $template_type );
	}
	list( $theme, $slug ) = $parts;

	if ( get_stylesheet() === $theme ) {
		$template_file = _get_block_template_file( $template_type, $slug );
		if ( null !== $template_file ) {
			$block_template = _build_block_template_result_from_file( $template_file, $template_type );

			/** This filter is documented in wp-includes/block-template-utils.php */
			return apply_filters( 'get_block_file_template', $block_template, $id, $template_type );
		}
	}

	$block_template = WP_Block_Templates_Registry::get_instance()->get_by_slug( $slug );

	/**
	 * Filters the block template object after it has been (potentially) fetched from the theme file.
	 *
	 * @since 5.9.0
	 *
	 * @param WP_Block_Template|null $block_template The found block template, or null if there is none.
	 * @param string                 $id             Template unique identifier (example: 'theme_slug//template_slug').
	 * @param string                 $template_type  Template type. Either 'wp_template' or 'wp_template_part'.
	 */
	return apply_filters( 'get_block_file_template', $block_template, $id, $template_type );
}

/**
 * Prints a block template part.
 *
 * @since 5.9.0
 *
 * @param string $part The block template part to print, for example 'header' or 'footer'.
 */
function block_template_part( $part ) {
	$template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' );
	if ( ! $template_part || empty( $template_part->content ) ) {
		return;
	}
	echo do_blocks( $template_part->content );
}

/**
 * Prints the header block template part.
 *
 * @since 5.9.0
 */
function block_header_area() {
	block_template_part( 'header' );
}

/**
 * Prints the footer block template part.
 *
 * @since 5.9.0
 */
function block_footer_area() {
	block_template_part( 'footer' );
}

/**
 * Determines whether a theme directory should be ignored during export.
 *
 * @since 6.0.0
 *
 * @param string $path The path of the file in the theme.
 * @return bool Whether this file is in an ignored directory.
 */
function wp_is_theme_directory_ignored( $path ) {
	$directories_to_ignore = array( '.DS_Store', '.svn', '.git', '.hg', '.bzr', 'node_modules', 'vendor' );

	foreach ( $directories_to_ignore as $directory ) {
		if ( str_starts_with( $path, $directory ) ) {
			return true;
		}
	}

	return false;
}

/**
 * Creates an export of the current templates and
 * template parts from the site editor at the
 * specified path in a ZIP file.
 *
 * @since 5.9.0
 * @since 6.0.0 Adds the whole theme to the export archive.
 *
 * @return WP_Error|string Path of the ZIP file or error on failure.
 */
function wp_generate_block_templates_export_file() {
	$wp_version = wp_get_wp_version();

	if ( ! class_exists( 'ZipArchive' ) ) {
		return new WP_Error( 'missing_zip_package', __( 'Zip Export not supported.' ) );
	}

	$obscura    = wp_generate_password( 12, false, false );
	$theme_name = basename( get_stylesheet() );
	$filename   = get_temp_dir() . $theme_name . $obscura . '.zip';

	$zip = new ZipArchive();
	if ( true !== $zip->open( $filename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) ) {
		return new WP_Error( 'unable_to_create_zip', __( 'Unable to open export file (archive) for writing.' ) );
	}

	$zip->addEmptyDir( 'templates' );
	$zip->addEmptyDir( 'parts' );

	// Get path of the theme.
	$theme_path = wp_normalize_path( get_stylesheet_directory() );

	// Create recursive directory iterator.
	$theme_files = new RecursiveIteratorIterator(
		new RecursiveDirectoryIterator( $theme_path ),
		RecursiveIteratorIterator::LEAVES_ONLY
	);

	// Make a copy of the current theme.
	foreach ( $theme_files as $file ) {
		// Skip directories as they are added automatically.
		if ( ! $file->isDir() ) {
			// Get real and relative path for current file.
			$file_path     = wp_normalize_path( $file );
			$relative_path = substr( $file_path, strlen( $theme_path ) + 1 );

			if ( ! wp_is_theme_directory_ignored( $relative_path ) ) {
				$zip->addFile( $file_path, $relative_path );
			}
		}
	}

	// Load templates into the zip file.
	$templates = get_block_templates();
	foreach ( $templates as $template ) {
		$template->content = traverse_and_serialize_blocks(
			parse_blocks( $template->content ),
			'_remove_theme_attribute_from_template_part_block'
		);

		$zip->addFromString(
			'templates/' . $template->slug . '.html',
			$template->content
		);
	}

	// Load template parts into the zip file.
	$template_parts = get_block_templates( array(), 'wp_template_part' );
	foreach ( $template_parts as $template_part ) {
		$zip->addFromString(
			'parts/' . $template_part->slug . '.html',
			$template_part->content
		);
	}

	// Load theme.json into the zip file.
	$tree = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) );
	// Merge with user data.
	$tree->merge( WP_Theme_JSON_Resolver::get_user_data() );

	$theme_json_raw = $tree->get_data();
	// If a version is defined, add a schema.
	if ( $theme_json_raw['version'] ) {
		$theme_json_version = 'wp/' . substr( $wp_version, 0, 3 );
		$schema             = array( '$schema' => 'https://schemas.wp.org/' . $theme_json_version . '/theme.json' );
		$theme_json_raw     = array_merge( $schema, $theme_json_raw );
	}

	// Convert to a string.
	$theme_json_encoded = wp_json_encode( $theme_json_raw, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );

	// Replace 4 spaces with a tab.
	$theme_json_tabbed = preg_replace( '~(?:^|\G)\h{4}~m', "\t", $theme_json_encoded );

	// Add the theme.json file to the zip.
	$zip->addFromString(
		'theme.json',
		$theme_json_tabbed
	);

	// Save changes to the zip file.
	$zip->close();

	return $filename;
}

/**
 * Gets the template hierarchy for the given template slug to be created.
 *
 * Note: Always add `index` as the last fallback template.
 *
 * @since 6.1.0
 *
 * @param string $slug            The template slug to be created.
 * @param bool   $is_custom       Optional. Indicates if a template is custom or
 *                                part of the template hierarchy. Default false.
 * @param string $template_prefix Optional. The template prefix for the created template.
 *                                Used to extract the main template type, e.g.
 *                                in `taxonomy-books` the `taxonomy` is extracted.
 *                                Default empty string.
 * @return string[] The template hierarchy.
 */
function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '' ) {
	if ( 'index' === $slug ) {
		/** This filter is documented in wp-includes/template.php */
		return apply_filters( 'index_template_hierarchy', array( 'index' ) );
	}
	if ( $is_custom ) {
		/** This filter is documented in wp-includes/template.php */
		return apply_filters( 'page_template_hierarchy', array( 'page', 'singular', 'index' ) );
	}
	if ( 'front-page' === $slug ) {
		/** This filter is documented in wp-includes/template.php */
		return apply_filters( 'frontpage_template_hierarchy', array( 'front-page', 'home', 'index' ) );
	}

	$matches = array();

	$template_hierarchy = array( $slug );
	// Most default templates don't have `$template_prefix` assigned.
	if ( ! empty( $template_prefix ) ) {
		list( $type ) = explode( '-', $template_prefix );
		// We need these checks because we always add the `$slug` above.
		if ( ! in_array( $template_prefix, array( $slug, $type ), true ) ) {
			$template_hierarchy[] = $template_prefix;
		}
		if ( $slug !== $type ) {
			$template_hierarchy[] = $type;
		}
	} elseif ( preg_match( '/^(author|category|archive|tag|page)-.+$/', $slug, $matches ) ) {
		$template_hierarchy[] = $matches[1];
	} elseif ( preg_match( '/^(taxonomy|single)-(.+)$/', $slug, $matches ) ) {
		$type           = $matches[1];
		$slug_remaining = $matches[2];

		$items = 'single' === $type ? get_post_types() : get_taxonomies();
		foreach ( $items as $item ) {
			if ( ! str_starts_with( $slug_remaining, $item ) ) {
					continue;
			}

			// If $slug_remaining is equal to $post_type or $taxonomy we have
			// the single-$post_type template or the taxonomy-$taxonomy template.
			if ( $slug_remaining === $item ) {
				$template_hierarchy[] = $type;
				break;
			}

			// If $slug_remaining is single-$post_type-$slug template.
			if ( strlen( $slug_remaining ) > strlen( $item ) + 1 ) {
				$template_hierarchy[] = "$type-$item";
				$template_hierarchy[] = $type;
				break;
			}
		}
	}
	// Handle `archive` template.
	if (
		str_starts_with( $slug, 'author' ) ||
		str_starts_with( $slug, 'taxonomy' ) ||
		str_starts_with( $slug, 'category' ) ||
		str_starts_with( $slug, 'tag' ) ||
		'date' === $slug
	) {
		$template_hierarchy[] = 'archive';
	}
	// Handle `single` template.
	if ( 'attachment' === $slug ) {
		$template_hierarchy[] = 'single';
	}
	// Handle `singular` template.
	if (
		str_starts_with( $slug, 'single' ) ||
		str_starts_with( $slug, 'page' ) ||
		'attachment' === $slug
	) {
		$template_hierarchy[] = 'singular';
	}
	$template_hierarchy[] = 'index';

	$template_type = '';
	if ( ! empty( $template_prefix ) ) {
		list( $template_type ) = explode( '-', $template_prefix );
	} else {
		list( $template_type ) = explode( '-', $slug );
	}
	$valid_template_types = array( '404', 'archive', 'attachment', 'author', 'category', 'date', 'embed', 'frontpage', 'home', 'index', 'page', 'paged', 'privacypolicy', 'search', 'single', 'singular', 'tag', 'taxonomy' );
	if ( in_array( $template_type, $valid_template_types, true ) ) {
		/** This filter is documented in wp-includes/template.php */
		return apply_filters( "{$template_type}_template_hierarchy", $template_hierarchy );
	}
	return $template_hierarchy;
}

/**
 * Inject ignoredHookedBlocks metadata attributes into a template or template part.
 *
 * Given an object that represents a `wp_template` or `wp_template_part` post object
 * prepared for inserting or updating the database, locate all blocks that have
 * hooked blocks, and inject a `metadata.ignoredHookedBlocks` attribute into the anchor
 * blocks to reflect the latter.
 *
 * @since 6.5.0
 * @access private
 *
 * @param stdClass        $changes    An object representing a template or template part
 *                                    prepared for inserting or updating the database.
 * @param WP_REST_Request $deprecated Deprecated. Not used.
 * @return stdClass|WP_Error The updated object representing a template or template part.
 */
function inject_ignored_hooked_blocks_metadata_attributes( $changes, $deprecated = null ) {
	if ( null !== $deprecated ) {
		_deprecated_argument( __FUNCTION__, '6.5.3' );
	}

	if ( ! isset( $changes->post_content ) ) {
		return $changes;
	}

	$hooked_blocks = get_hooked_blocks();
	if ( empty( $hooked_blocks ) && ! has_filter( 'hooked_block_types' ) ) {
		return $changes;
	}

	$meta  = isset( $changes->meta_input ) ? $changes->meta_input : array();
	$terms = isset( $changes->tax_input ) ? $changes->tax_input : array();

	if ( empty( $changes->ID ) ) {
		// There's no post object for this template in the database for this template yet.
		$post = $changes;
	} else {
		// Find the existing post object.
		$post = get_post( $changes->ID );

		// If the post is a revision, use the parent post's post_name and post_type.
		$post_id = wp_is_post_revision( $post );
		if ( $post_id ) {
			$parent_post     = get_post( $post_id );
			$post->post_name = $parent_post->post_name;
			$post->post_type = $parent_post->post_type;
		}

		// Apply the changes to the existing post object.
		$post = (object) array_merge( (array) $post, (array) $changes );

		$type_terms        = get_the_terms( $changes->ID, 'wp_theme' );
		$terms['wp_theme'] = ! is_wp_error( $type_terms ) && ! empty( $type_terms ) ? $type_terms[0]->name : null;
	}

	// Required for the WP_Block_Template. Update the post object with the current time.
	$post->post_modified = current_time( 'mysql' );

	// If the post_author is empty, set it to the current user.
	if ( empty( $post->post_author ) ) {
		$post->post_author = get_current_user_id();
	}

	if ( 'wp_template_part' === $post->post_type && ! isset( $terms['wp_template_part_area'] ) ) {
		$area_terms                     = get_the_terms( $changes->ID, 'wp_template_part_area' );
		$terms['wp_template_part_area'] = ! is_wp_error( $area_terms ) && ! empty( $area_terms ) ? $area_terms[0]->name : null;
	}

	$template = _build_block_template_object_from_post_object( new WP_Post( $post ), $terms, $meta );

	if ( is_wp_error( $template ) ) {
		return $template;
	}

	if ( 'wp_template_part' === $post->post_type ) {
		$attributes                     = array();
		$existing_ignored_hooked_blocks = isset( $post->ID ) ? get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true ) : '';

		if ( ! empty( $existing_ignored_hooked_blocks ) ) {
			$attributes['metadata'] = array(
				'ignoredHookedBlocks' => json_decode( $existing_ignored_hooked_blocks, true ),
			);
		}

		$content               = get_comment_delimited_block_content(
			'core/template-part',
			$attributes,
			$changes->post_content
		);
		$content               = apply_block_hooks_to_content( $content, $template, 'set_ignored_hooked_blocks_metadata' );
		$changes->post_content = remove_serialized_parent_block( $content );

		$wrapper_block_markup  = extract_serialized_parent_block( $content );
		$wrapper_block         = parse_blocks( $wrapper_block_markup )[0];
		$ignored_hooked_blocks = $wrapper_block['attrs']['metadata']['ignoredHookedBlocks'] ?? array();
		if ( ! empty( $ignored_hooked_blocks ) ) {
			if ( ! isset( $changes->meta_input ) ) {
				$changes->meta_input = array();
			}
			$changes->meta_input['_wp_ignored_hooked_blocks'] = wp_json_encode( $ignored_hooked_blocks );
		}
	} else {
		$changes->post_content = apply_block_hooks_to_content( $changes->post_content, $template, 'set_ignored_hooked_blocks_metadata' );
	}

	return $changes;
}
winterrad.com : Panduan Waktu Gacor untuk Jackpot
banner
24/03/2025

Jungle Mayhem Bergabunglah dengan Petualangan Seru di Hutan dengan Kemenangan Menggoda

Pernahkah kamu membayangkan berada di tengah hutan tropis yang rimbun, penuh dengan kehidupan liar dan misteri yang menanti untuk ditemukan? Jungle Mayhem adalah permainan slot yang membawa kamu ke dalam dunia petualangan yang penuh dengan tantangan dan keberuntungan. Dengan latar belakang hutan lebat yang dipenuhi dengan berbagai makhluk liar, suara alam yang menggugah, dan simbol-simbol […]

23/03/2025

Zillard King – Menerima Tantangan Sang Raja Dinosaurus di Dunia Slot

Dalam dunia permainan slot, tak jarang kita menemukan tema-tema yang penuh dengan keberuntungan, petualangan, dan kekuatan. Namun, ada satu permainan yang benar-benar menguji keberanian Anda untuk menghadapi tantangan besar di dunia yang penuh dengan dinosaurus raksasa. Ya, kami berbicara tentang Zillard King – permainan slot yang membawa Anda ke dunia prasejarah penuh dengan raksasa dinosaurus […]

21/03/2025

Cobra Queen – Rahasia Keberuntungan Terbesar Tersembunyi di Dunia Cobra Queen

Di dunia permainan slot, Cobra Queen adalah sebuah petualangan penuh misteri, di mana simbol ular cobra yang mematikan dipadukan dengan keberuntungan besar. Permainan ini mengajak Anda untuk menggali rahasia yang tersembunyi di balik Cobra Queen, sang ratu ular yang memimpin kerajaan mistis yang penuh dengan harta karun dan kekayaan. Apakah Anda berani untuk menemui Cobra […]

20/03/2025

Takdir Berpihak Padamu – Madame Destiny Megaways Menyajikan Keberuntungan di Setiap Putaran

Keberuntungan seringkali datang dengan cara yang tak terduga, dan di Madame Destiny Megaways, takdir berpihak padamu dengan membuka peluang luar biasa untuk meraih kemenangan besar. Permainan slot ini membawa kamu ke dalam dunia penuh misteri, di mana ramalan dan kekuatan magis bisa mengubah nasibmu dalam sekejap. Dengan fitur Megaways yang memberikan ribuan cara untuk menang, […]

19/03/2025

Rise of Samurai 4 – Menangkan Kejayaan di Era Samurai dengan Jackpot yang Tak Terbantahkan!

Siapa yang tidak terpesona dengan kisah keberanian para samurai yang legendaris? Rise of Samurai 4 membawa kamu kembali ke masa lalu, di mana para samurai berjuang untuk kehormatan, kemenangan, dan tentu saja, harta yang melimpah. Dalam permainan ini, kamu akan merasakan sendiri atmosfer era samurai yang penuh dengan keberanian, strategi, dan peluang besar untuk memenangkan […]

18/03/2025

PIZZA PIZZA PIZZA – Rasakan Sensasi Jackpot dengan Setiap Potongan Pizza yang Menggoda

Siapa yang bisa menolak sensasi menggigit sepotong pizza lezat dengan topping yang menggugah selera? Kini, bayangkan sensasi itu dipadukan dengan kegembiraan permainan slot yang penuh dengan peluang jackpot besar. PIZZA PIZZA PIZZA adalah permainan slot yang membawa kamu ke dunia penuh dengan cita rasa menggoda dari pizza, dengan setiap putaran memberikan kesempatan untuk meraih jackpot […]

17/03/2025

Challenge-Golden Pig – Kumpulkan Emas Bersama Golden Pig yang Menguntungkan

Siapa yang tidak ingin merasakan keberuntungan yang berlimpah? Dalam dunia slot online, banyak game yang menawarkan keseruan dan peluang besar untuk menang, tetapi tidak banyak yang mampu mengkombinasikan tema beruntung dengan hadiah emas yang melimpah. Salah satu game yang menawarkan pengalaman tersebut adalah Challenge-Golden Pig. Dengan tema yang penuh dengan emas, keberuntungan, dan harta karun, […]

16/03/2025

Release the Kraken 2 Siap Membawa Kamu ke Kedalaman Laut untuk Mencari Jackpot!

Jika kamu menyukai petualangan di bawah laut, bertemu dengan makhluk-makhluk legendaris, dan meraih jackpot besar, maka Release the Kraken 2 adalah permainan slot yang tak boleh kamu lewatkan! Sekuel dari permainan populer Release the Kraken, kali ini game ini membawa pemain untuk menyelami kedalaman lautan yang penuh dengan misteri dan peluang luar biasa. Dengan grafis […]

14/03/2025

Situs KKSLOT777 Terbaik Akan Memberi Kemenangan Penuh Kasih Sayanag Di Morganite Slot

Morganite Slot adalah permainan yang membawa kamu dalam perjalanan magis yang dipenuhi dengan keindahan, kebahagiaan, dan peluang kemenangan yang luar biasa. Seperti halnya permata morganite yang dikenal dengan warna pinknya yang lembut dan energi positifnya, permainan ini memberi kesempatan untuk meraih hadiah besar yang mengubah perjalanan permainanmu menjadi pengalaman yang tak terlupakan. Morganite Slot tidak […]

13/03/2025

xBomb – Ledakan Keberuntungan yang Membuka Jalan Menuju Jackpot Besar

Siapa yang tidak suka dengan sedikit ledakan keberuntungan? Jika kamu mencari permainan slot yang penuh dengan keseruan, ledakan, dan peluang kemenangan besar, maka xBomb adalah pilihan yang tepat. Permainan slot ini menawarkan pengalaman yang penuh dengan simbol-simbol yang meledak, fitur-fitur seru, dan yang paling penting, jackpot besar yang siap menghampirimu. Jadi, siap untuk merasakan ledakan […]

11/03/2025

Menangkan Danger Zone – Keberuntungan Berbahaya Menunggu di Setiap Putaran Slot!

Siapa yang tidak suka tantangan? Danger Zone adalah permainan slot yang hadir dengan janji keberuntungan berbahaya yang siap mengubah permainanmu menjadi petualangan yang mendebarkan. Setiap putaran memberi kesempatan untuk menggali lebih dalam ke dalam zona penuh dengan risiko, tetapi juga hadiah besar yang menanti bagi mereka yang berani menghadapi tantangan. Dalam Danger Zone, keberuntungan tidak […]

10/03/2025

Keberuntungan Menantimu di Slot Wild Bandito Online Dunia Bandito yang Penuh Hadiah!

Siap untuk memasuki dunia penuh aksi dan peluang kemenangan besar? Slot Wild Bandito membawa kamu ke dalam petualangan seru yang penuh dengan koboi, bandit, dan keberuntungan yang tak terduga! Dengan tema yang terinspirasi oleh dunia koboi dan bandit, permainan ini menawarkan pengalaman bermain yang tidak hanya menghibur tetapi juga sangat menguntungkan. Dari simbol yang menggambarkan […]

09/03/2025

Ayo Cobalah Keberuntunganmu dengan Bermain Slot Alchemist’s Gold dengan Keajaiban Emas!

Siapa yang tidak terpesona dengan keajaiban alkimia dan harta karun yang tak ternilai? Di dunia permainan slot, ada satu game yang mengajakmu untuk memasuki dunia magis penuh dengan kekayaan dan rahasia alkimia yang tersembunyi. Slot Alchemist’s Gold adalah permainan slot yang menawarkan lebih dari sekadar hiburan – ini adalah petualangan luar biasa ke dalam dunia […]

07/03/2025

Ayo Temukan Berlian yang Menguntungkan di Setiap Putaran Slot Diamond Strike Gacor

Dunia permainan slot online selalu menawarkan berbagai tema menarik yang bisa memikat pemain dari berbagai penjuru dunia, namun Diamond Strike Gacor hadir dengan sebuah tema yang penuh dengan kilauan, keberuntungan, dan peluang besar—berlian yang sangat menguntungkan. Dalam permainan ini, kamu akan dibawa untuk menemukan berlian yang tersembunyi di setiap putaran, sambil menikmati sensasi menegangkan yang […]

06/03/2025

Gunakan Samuraimu Untuk Meraih Keuntungan Besara di Selot Shogun’s Secret

Di dunia permainan slot online, ada banyak tema yang menarik dan menggugah imajinasi. Salah satunya adalah tema Shogun, yang membawa kita ke zaman Jepang feodal dengan pahlawan-pahlawan samurai yang tangguh, peperangan yang penuh strategi, dan tentu saja, harta yang berlimpah. Jika kamu ingin merasakan sensasi petualangan ala samurai dan peluang keuntungan yang besar, Slot Shogun’s […]

05/03/2025

Keberuntungan di Slot Hot Hot Fruits 40 Mengalir dalam Setiap Putaran 40 Baris Wild

Siapa yang tidak menyukai permainan slot dengan buah-buahan segar yang memikat dan kesempatan menang besar yang menunggu di setiap putaran? Hot Hot Fruits 40 adalah permainan slot yang menawarkan sensasi panas dengan 40 garis pembayaran dan wilds yang semakin meningkatkan peluang untuk meraih kemenangan besar. Apakah kamu siap untuk menemukan keberuntungan dan menikmati setiap putaran […]

04/03/2025

Buruan Masuki Piramida Fortune of Giza dan Temukan Harta yang Tak Terkalahkan!

Pernahkah kamu membayangkan menemukan harta karun yang tersembunyi di dalam piramida Mesir kuno? Piramida Fortune of Giza adalah permainan slot yang membawa kamu ke dalam petualangan luar biasa yang penuh dengan misteri, sihir, dan tentu saja, harta yang tak terkalahkan. Mengusung tema Mesir kuno yang penuh dengan rahasia dan kekayaan yang tersembunyi, permainan ini menawarkan […]

03/03/2025

Nikmati Buah-Buahan di slot Fruit Shop dan Raih Keuntungan Manis dalam Setiap Putaran!

Siapa yang tidak suka buah-buahan segar dan manis? Bayangkan jika kesegaran buah-buahan ini bisa membawa kamu menuju kemenangan besar di dunia slot. Di Fruit Shop, permainan slot yang ceria ini, kamu bisa menikmati segala kebaikan dari buah-buahan segar sambil meraih keuntungan yang manis di setiap putaran! Dengan grafis yang berwarna-warni, suara latar yang menyenangkan, dan […]

02/03/2025

Buruan Masuki Dunia Egyptian Fortunes – Mesir Kuno dan Temukan Harta Karun Penuh Keberuntungan Besar!

Selamat datang di dunia Egyptian Fortunes, di mana sejarah Mesir kuno yang megah bertemu dengan potensi keberuntungan dan harta karun yang berlimpah. Game ini adalah petualangan slot yang membawa kamu ke dalam dunia penuh dengan piramida, dewa-dewa Mesir, dan tentu saja, harta karun tersembunyi yang menunggu untuk ditemukan. Egyptian Fortunes mengajak kamu untuk menjelajahi kuil-kuil […]

01/03/2025

Rasakan Sensasi kemenagan di Golden Tiger Live Casino dan Raih Keberuntunganmu di Setiap Putaran

Apakah Anda siap untuk merasakan sensasi bermain yang penuh ketegangan dan kesenangan? Jika iya, maka Golden Tiger Live Casino adalah tempat yang tepat untuk Anda! Di dunia perjudian online, tidak ada yang lebih menggembirakan daripada merasakan keberuntungan berpihak pada Anda. Dengan teknologi canggih, dealer langsung, dan beragam permainan kasino yang menantang, Golden Tiger Live Casino […]

28/02/2025

Buruan Gabung Dengan Situs Deep Sea Mahjong Quest – Dalam Setiap Putaran Mahjong dan Menangkan Keberuntunganmu

Siapa yang tidak suka merasakan sensasi seru saat bermain Mahjong? Permainan yang telah lama ada ini terus berkembang, dan kini hadir dengan sentuhan tema baru yang sangat menarik, yaitu Deep Sea Mahjong Quest! Jika kamu pencinta Mahjong yang juga tertarik pada tema laut dalam penuh misteri, maka game ini akan memberikan pengalaman yang luar biasa. […]

26/02/2025

Ayo Bermain di Phoenix Rising Jackpot Raih Hadiah Terbesar dengan Putaran Burung Phoenix

Dunia permainan kasino selalu penuh dengan kejutan, dan salah satu permainan yang paling menarik perhatian pemain saat ini adalah Phoenix Rising Jackpot. Mengusung tema legendaris burung Phoenix, yang dikenal sebagai simbol kebangkitan dan keabadian, permainan ini menawarkan pengalaman yang penuh dengan petualangan, keajaiban, dan tentu saja, peluang untuk meraih hadiah besar yang bisa mengubah hidup […]

25/02/2025

Poker All-in Arena Tempat Pemain Poker Berani All-In untuk Menangkan Jackpot

Poker adalah permainan yang sudah mendunia dan digemari oleh banyak orang karena kombinasi antara strategi, keberuntungan, dan keterampilan yang dibutuhkan untuk menang. Salah satu elemen yang paling mendebarkan dalam permainan poker adalah all-in—saat seorang pemain memutuskan untuk bertaruh semua chip mereka dalam satu taruhan besar, mempertaruhkan segalanya untuk meraih kemenangan. Poker All-in Arena adalah tempat […]

24/02/2025

Great Rhino Megaways – Keberuntungan Besar dengan Badak Megaways yang Penuh Potensi

Jika kamu mencari permainan slot yang menawarkan sensasi petualangan liar, visual yang memukau, dan tentu saja peluang menang besar, Great Rhino Megaways adalah jawabannya. Dikembangkan oleh Pragmatic Play, slot ini menggabungkan gameplay yang menarik dengan tema alam liar yang penuh dengan keajaiban dan potensi kemenangan luar biasa. Dalam artikel ini, kita akan mengeksplorasi segala hal […]

23/02/2025

Madame Destiny – Takdir Ada di Tanganmu, Coba Keberuntunganmu dalam Dunia Misterius

Keberuntungan adalah sesuatu yang tidak bisa diprediksi, namun dalam dunia penuh misteri dan takdir, kesempatan besar bisa datang kapan saja. Dalam permainan slot Madame Destiny, kamu akan memasuki dunia yang penuh dengan kekuatan mistik, ramalan, dan takdir yang bisa mengubah hidupmu. Bersiaplah untuk bertemu dengan Madame Destiny, seorang peramal yang penuh dengan kebijaksanaan dan kekuatan […]

22/02/2025

Wild Fortune – Keberuntungan Liar yang Menantimu di Setiap Langkah

Di dunia perjudian, ada sedikit yang lebih menggembirakan daripada tema yang penuh dengan petualangan dan keberuntungan besar. Wild Fortune adalah permainan slot yang dirancang untuk para pemain yang ingin merasakan sensasi keberuntungan yang liar dan tak terduga. Dengan grafis yang memukau, simbol yang penuh makna, dan fitur-fitur bonus yang menarik, permainan ini menawarkan pengalaman bermain […]

21/02/2025

Chilli Heat – Rasakan Panasnya Kemenangan yang Memikat dengan Setiap Spin Slot

Siapa yang tidak suka dengan rasa pedas yang menggugah selera? Begitu juga dengan Chilli Heat, permainan slot yang membangkitkan semangat dan adrenalin dengan panasnya kemenangan yang bisa kamu rasakan di setiap putaran. Mengusung tema makanan pedas yang penuh cita rasa dan simbol-simbol khas Meksiko, Chilli Heat tidak hanya menawarkan sensasi bermain yang seru, tetapi juga […]

20/02/2025

Siberian Storm – Badai Salju Keberuntungan yang Membawa Harta Karun

Dalam dunia permainan slot, ada banyak tema yang bisa menarik perhatian pemain, namun hanya beberapa yang mampu menyajikan pengalaman bermain yang penuh dengan kejutan dan peluang besar seperti yang ditawarkan oleh Siberian Storm. Dikembangkan oleh IGT (International Game Technology), Siberian Storm mengajak pemain untuk memasuki dunia salju yang dingin namun penuh dengan keberuntungan. Dengan latar […]

19/02/2025

Dragon Warrior : Bertempur dengan Naga untuk Menggapai Keberuntungan

Dunia permainan selalu menawarkan pengalaman yang penuh petualangan dan tantangan, tetapi tidak ada yang sebanding dengan sensasi bertempur melawan makhluk legendaris yang dikenal akan kekuatan dan keberuntungannya, seperti naga. Di dunia Dragon Warrior, Anda akan dihadapkan pada dunia mistis yang dipenuhi dengan api, besi, dan tekad baja. Di sini, menjadi seorang Dragon Warrior bukan hanya […]

18/02/2025

Cash Noire : Petualangan Misteri di Dunia Noir dengan Keberuntungan yang Tersembunyi

Masuki dunia gelap yang penuh misteri dan intrik dalam Cash Noire, sebuah permainan slot yang mengajakmu menyelami dunia noir yang penuh dengan teka-teki, ketegangan, dan keberuntungan yang tersembunyi di balik bayang-bayang kota malam. Dengan suasana ala film detektif klasik yang dipenuhi dengan karakter-karakter misterius dan jalanan kota yang sepi, Cash Noire menawarkan pengalaman bermain yang […]

15/02/2025

Scarab Temple : Kuil Mesir yang Penuh Dengan Keberuntungan yang Mengundang Kemenangan

Dunia permainan slot online selalu menawarkan petualangan seru dan pengalaman tak terlupakan, dan salah satu tema yang paling digemari oleh para pemain adalah mitologi Mesir Kuno. Scarab Temple adalah salah satu permainan slot yang mengangkat tema tersebut, membawa pemain ke dalam kuil misterius yang tersembunyi di padang pasir Mesir. Dalam permainan ini, pemain tidak hanya […]

14/02/2025

Mega Wheel : Keberuntungan Menghampiri dengan Setiap Putaran di Roda Keberuntungan

Di dunia perjudian online, permainan yang sederhana namun penuh ketegangan selalu menjadi favorit banyak pemain. Salah satu permainan yang memadukan keberuntungan dan sensasi permainan interaktif dengan cara yang unik adalah Mega Wheel. Terinspirasi oleh roda keberuntungan yang klasik, Mega Wheel hadir dengan sentuhan modern yang memberi pemain kesempatan untuk merasakan pengalaman kasino langsung yang menyenangkan […]

13/02/2025

Live Slingshot Roulette : Roulette dengan Gaya Seru dan Kecepatan Ekstra untuk Keberuntunganmu

Roulette adalah permainan kasino yang sudah sangat terkenal dan selalu berhasil menarik perhatian banyak pemain di seluruh dunia. Dari kasino fisik hingga platform kasino online, roulette tetap menjadi salah satu permainan yang paling dicari oleh para penjudi. Dengan roda yang berputar, bola yang meluncur, dan ketegangan yang meningkat di setiap putaran, roulette menawarkan pengalaman bermain […]

12/02/2025

Chilli Heat : Rasakan Sensasi Panasnya Keberuntungan dalam Setiap Putaran

Dunia permainan slot online penuh dengan tema yang beragam, tetapi sedikit yang dapat menyaingi energi dan sensasi panas yang ditawarkan oleh permainan Chilli Heat. Dengan tema masakan pedas yang menggugah selera, permainan ini mengajak pemain untuk merasakan keberuntungan besar yang datang seiring dengan semangat panasnya rasa. Seperti halnya makanan pedas yang menantang lidah, Chilli Heat […]

11/02/2025

Mammoth Gold : Jelajahi Dunia Pra-Sejarah dan Temukan Harta Karun dari Zaman Dinosaurus yang Menanti

Di dunia yang penuh dengan keajaiban dan misteri, “Mammoth Gold” mengajak kita untuk berpetualang ke zaman prasejarah. Melalui tema yang terinspirasi oleh kehidupan dinosaurus dan makhluk purba lainnya, kita dibawa dalam perjalanan yang tidak hanya menegangkan tetapi juga penuh dengan keindahan. Menyelami dunia zaman purba, kita akan mencari harta karun yang tersembunyi, yang konon katanya […]

10/02/2025

Deal or No Deal Dream Catcher : Kejar Hadiah Besar dalam Roda Keberuntungan

Dunia permainan kasino terus berkembang dengan berbagai inovasi yang menarik bagi para pemain yang mencari pengalaman yang berbeda dan mendalam. Salah satu permainan yang telah memikat banyak pemain adalah Deal or No Deal Dream Catcher. Menggabungkan elemen-elemen dari acara TV legendaris Deal or No Deal dan roda keberuntungan Dream Catcher, permainan ini menawarkan peluang besar […]

09/02/2025

Paytable : Panduan Lengkap untuk Menavigasi Permainan dan Menemukan Kemenangan

Dalam dunia mesin slot, salah satu aspek yang sangat penting dan sering diabaikan oleh banyak pemain adalah Paytable. Paytable adalah alat yang sangat berguna yang memberikan informasi penting tentang bagaimana permainan slot berfungsi, termasuk simbol-simbol yang ada, nilai masing-masing simbol, dan cara memenangkan hadiah. Tanpa pemahaman yang tepat tentang Paytable, pemain mungkin kehilangan peluang untuk […]

08/02/2025

Spin On The Fly : Putaran Instan yang Membawa Kamu ke Kemenangan Tanpa Menunggu Lama

Di dunia permainan slot, terkadang yang terbaik adalah yang datang dengan cepat dan tanpa rintangan. Spin On The Fly adalah permainan slot yang menawarkan pengalaman bermain penuh dengan kecepatan, keberuntungan, dan tentu saja, kemenangan yang datang dalam waktu singkat. Dengan putaran instan yang membawa kamu lebih dekat menuju kemenangan besar, permainan ini memberi sensasi tanpa […]

07/02/2025

Big Kahuna : Snakes & Ladders: Petualangan Seru di Dunia Suku Hawaii

Bergabunglah dalam petualangan yang tak terlupakan di dunia tropis yang penuh dengan keindahan alam, kekayaan budaya, dan tentu saja, peluang besar untuk meraih kemenangan besar! Big Kahuna: Snakes & Ladders adalah permainan slot yang menggabungkan elemen klasik permainan ular tangga dengan tema eksotis dari suku Hawaii. Dalam permainan ini, kamu akan memulai petualangan seru melalui […]

06/02/2025

Bonus Wheel : Putar Roda Keberuntungan untuk Menang Hadiah Menarik

Dalam dunia permainan slot, fitur bonus selalu menjadi daya tarik utama bagi pemain, karena memberikan kesempatan untuk mendapatkan hadiah besar di luar putaran reguler. Salah satu fitur bonus yang paling populer, interaktif, dan mendebarkan adalah Bonus Wheel, atau roda keberuntungan. Fitur ini tidak hanya menawarkan sensasi bermain yang unik, tetapi juga memberikan peluang untuk memenangkan berbagai […]

05/02/2025

Treasure Tomb : Jelajahi Kuburan Kuno dan Temukan Harta Karun Berharga

Masuki dunia penuh misteri dan harta karun tersembunyi dengan Treasure Tomb, permainan slot yang membawa pemain dalam sebuah petualangan menuju kuburan kuno yang dipenuhi dengan rahasia. Di balik setiap simbol dan putaran reel, ada kisah-kisah legenda yang menanti untuk diungkap. Dengan desain yang menggugah imajinasi, game ini memadukan elemen sejarah, mitos, dan peluang menang besar […]

04/02/2025

Queen of Bounty : Menangkan Harta Karun Ratu Bajak Laut yang Tersembunyi

Dunia bajak laut dan harta karun selalu menjadi tema yang menarik dalam cerita-cerita petualangan. Sejak zaman dahulu, kisah-kisah tentang pencarian harta karun yang tersembunyi dan perjuangan untuk menemukannya selalu menarik perhatian banyak orang. Salah satu permainan slot yang mengusung tema petualangan bajak laut dan harta karun yang menunggu untuk ditemukan adalah Queen of Bounty, sebuah […]

03/02/2025

Chilli Heat : Sensasi Panas dalam Setiap Putaran

Jika kamu mencari slot yang bukan hanya memberikan kemenangan besar, tetapi juga pengalaman bermain yang penuh warna, maka Chilli Heat adalah jawabannya! Dengan tema khas Meksiko yang penuh semangat, permainan ini menghadirkan sensasi panas dalam setiap putaran. Bayangkan dirimu berada di tengah-tengah festival Meksiko, di mana musik mariachi menggema, hidangan pedas tersaji di setiap meja, […]

01/02/2025

Sbook Online : Judi Olahraga Paling Gila, Taruhan Kecil, Kemenangan Besar

Pernahkah kamu membayangkan bisa menang besar hanya dengan modal taruhan kecil? Itulah yang ditawarkan oleh Sbook Online, tempat taruhan olahraga paling gila yang memberikan kesempatan luar biasa bagi siapa saja yang ingin meraih Big Win tanpa harus mengeluarkan banyak modal. Dengan berbagai opsi taruhan yang fleksibel, odds terbaik, dan sistem yang transparan, Sbook Online menjadi […]

31/01/2025

RNG Slot Online : Mainkan Slot Terpercaya, Nikmati MegaWin dan Raih Hadiah Besar

Industri perjudian online terus berkembang, dan salah satu permainan yang paling diminati adalah RNG Slot Online. Dikenal dengan sistem acak yang dapat dipercaya dan peluang besar untuk memenangkan hadiah, RNG Slot Online memberikan pengalaman bermain yang menyenangkan dan menguntungkan bagi para pemain. Dengan algoritma Random Number Generator (RNG) yang memastikan keadilan dalam permainan, pemain dapat […]

30/01/2025

Baccarat Online : Nikmati Permainan Cerdas dan Raih Kemenangan Besar Setiap Waktu

Baccarat Online adalah salah satu permainan kasino paling ikonik yang telah bertahan dan berkembang di era perjudian digital. Dengan sejarah yang panjang dan popularitas yang terus meningkat, baccarat telah menjadi pilihan favorit banyak pemain yang mencari permainan dengan aturan sederhana namun tetap menawarkan tantangan yang menyenangkan dan peluang kemenangan besar. Permainan ini tidak hanya mengandalkan […]

28/01/2025

Gates of Olympus : Dewa-dewi Menanti, Jackpot Fantastis di Setiap Putaran

Permainan slot online telah menjadi salah satu bentuk hiburan paling populer di kalangan penggemar judi. Salah satu permainan yang menonjol di antara yang lain adalah Gates of Olympus, yang dikembangkan oleh Pragmatic Play. Dengan tema mitologi Yunani yang kaya, permainan ini membawa pemain ke dunia dewa-dewi kuno, di mana jackpot fantastis menanti di setiap putaran. Dalam […]

27/01/2025

Togel Online : Prediksi Akurat, Hadiah Fantastis, dan Jackpot Menanti Kamu

Di dunia perjudian online, Togel Online telah menjadi salah satu permainan yang paling digemari, berkat kesederhanaannya, peluang menang yang menggiurkan, dan hadiah besar yang bisa diraih. Permainan ini telah mengalami transformasi dari bentuk tradisional yang dimainkan di pasar togel konvensional menjadi versi digital yang lebih mudah diakses. Dengan adanya prediksi akurat, pemain dapat meningkatkan peluang […]

14/01/2025

China4D : Langkah Cerdas Menuju Hadiah Impian

Bagi para pecinta permainan angka, China4D adalah tempat di mana keberuntungan dan strategi bertemu untuk membawa Anda lebih dekat ke hadiah impian. Dengan berbagai pilihan taruhan, fitur canggih, dan peluang besar untuk menang, platform ini menjadi pilihan favorit bagi pemain yang menginginkan pengalaman bermain angka yang menyenangkan sekaligus menguntungkan. Mengapa Memilih China4D? China4D dirancang untuk […]

14/01/2025

Slot Thailand Gacor : Temukan Keberuntungan Tanpa Batas

Bagi Anda yang mencari pengalaman bermain slot online yang seru dan penuh kejutan, Slot Thailand Gacor adalah jawabannya. Dengan fitur-fitur modern, tingkat pengembalian tinggi, dan peluang besar untuk meraih jackpot, platform ini menawarkan keberuntungan tanpa batas di setiap putaran. Mengapa Memilih Slot Thailand Gacor? Slot Thailand Gacor dikenal sebagai salah satu platform terbaik untuk menikmati […]

14/01/2025

Slot Server Thailand : Sensasi Bermain dengan Peluang Tinggi

Jika Anda mencari pengalaman bermain slot online yang seru dan menguntungkan, Slot Server Thailand adalah destinasi yang tepat. Dengan server yang stabil, tingkat pengembalian tinggi, dan pilihan permainan yang beragam, platform ini menawarkan sensasi bermain yang berbeda dan memberikan peluang besar untuk meraih jackpot di setiap putaran. Mengapa Memilih Slot Server Thailand? Slot Server Thailand […]

14/01/2025

Slot Thailand : Nikmati Putaran dengan Keberuntungan Maksimal

Bagi para pecinta slot online, Slot Thailand adalah destinasi terbaik untuk merasakan pengalaman bermain yang penuh keseruan dan peluang besar. Dengan tema yang menawan, fitur-fitur inovatif, dan tingkat pengembalian yang tinggi, platform ini memberikan keberuntungan maksimal di setiap putaran. Saatnya Anda mencoba keberuntungan dan menikmati perjalanan menuju jackpot besar. Mengapa Memilih Slot Thailand? Slot Thailand […]

13/01/2025

Situs Judi Slot : Keberuntungan Besar Menanti di Ujung Jari

Bayangkan jika hanya dengan beberapa kali klik, kamu bisa membuka peluang untuk memenangkan jackpot besar. Di Situs Judi Slot, keberuntungan besar benar-benar ada di ujung jarimu. Dengan berbagai fitur unggulan, permainan berkualitas tinggi, dan peluang menang yang nyata, platform ini menawarkan pengalaman bermain slot online yang seru dan menguntungkan. Mengapa Memilih Situs Judi Slot? Situs […]

12/01/2025

Judi Slot Gacor : Pengalaman Bermain yang Membawa Maxwin

Siapa yang tidak menginginkan pengalaman bermain slot yang bukan hanya seru, tetapi juga membawa peluang besar untuk meraih Maxwin? Di Judi Slot Gacor, setiap putaran adalah langkah menuju pengalaman bermain yang memukau, di mana Maxwin bukan sekadar impian, melainkan tujuan nyata yang bisa kamu capai. Dengan desain permainan yang menarik, fitur-fitur bonus yang menggiurkan, dan […]

10/01/2025

Judi Online : Main Cerdas, Menang Fantastis

Judi online bukan hanya soal keberuntungan, tapi juga soal bermain dengan cerdas. Di situs judi online terpercaya, kamu bisa memanfaatkan strategi dan pengetahuan untuk meningkatkan peluang kemenanganmu. Dengan berbagai pilihan permainan yang ada, mulai dari slot hingga taruhan olahraga, ada banyak cara untuk meraih kemenangan besar. Tapi ingat, kemenangan bukan hanya tentang keberuntungan strategi yang […]

08/01/2025

Slot Gacor : Kegembiraan Pesta Carnaval dalam Setiap Putaran

Menyambut Keberuntungan di Pesta yang Tak Terlupakan Bayangkan dirimu berada di tengah-tengah carnaval yang penuh dengan keceriaan, musik yang memukau, serta tawa yang mengalir dari setiap sudut. Setiap langkah terasa ringan, dan setiap suara memanggil kamu untuk ikut berpartisipasi dalam kemeriahan yang tak ada habisnya. Inilah suasana yang tercipta saat kamu bermain Slot Gacor di […]

07/01/2025

Demo Slot Gacor : Latihan Seru Menuju Jackpot Fantastis

Bagi Kamu yang ingin merasakan keseruan bermain slot tanpa risiko sekaligus mempersiapkan diri untuk kemenangan besar, Gacor Demo Slot adalah pilihan yang tepat. Mode ini dirancang untuk memberi pengalaman bermain yang menyenangkan sekaligus mengasah kemampuanmu dalam memahami permainan. Dengan demo slot, setiap putaran adalah langkah menuju jackpot fantastis! Apa Itu Gacor Demo Slot? Gacor Demo […]

05/01/2025

Slot Thailand Gacor | Mesin Slot Terpopuler di Thailand yang Selalu Memberikan Hadiah Besar

Mesin Slot Terpopuler di Thailand yang Selalu Memberikan Hadiah Besar Perjudian online, khususnya permainan slot, telah menjadi salah satu hiburan paling populer di dunia, dan Thailand tidak terkecuali. Mesin slot online semakin menarik perhatian para pemain di seluruh dunia karena berbagai alasan, seperti kesederhanaannya, desain yang menarik, dan tentu saja, peluang untuk memenangkan hadiah besar. […]

31/12/2024

Live Casino : Pengalaman Judi Real-Time dari Rumah Anda

Perjudian online telah berkembang dengan pesat dalam beberapa tahun terakhir, dan salah satu inovasi terbesar dalam dunia perjudian adalah munculnya live casino. Berbeda dengan permainan kasino tradisional yang dimainkan secara offline, live casino menawarkan pengalaman judi yang lebih imersif dan realistis dengan menggunakan teknologi streaming langsung. Pemain dapat menikmati permainan kasino favorit mereka, seperti blackjack, […]

28/12/2024

Slot Online : Game Terbaik dari Yggdrasil dan Provider Lainnya

Dalam dunia permainan kasino online, slot adalah salah satu jenis permainan yang paling populer. Tidak hanya karena gameplay yang mudah dipahami, tetapi juga karena potensi besar untuk memenangkan hadiah yang menggiurkan. Salah satu pengembang perangkat lunak yang sangat terkenal dalam menciptakan game slot online adalah Yggdrasil. Namun, selain Yggdrasil, ada banyak provider lain yang turut […]

25/12/2024

Togel Online, Baccarat, dan Sabung Ayam : Semua Bisa Dapetin Maxwin Dengan Deposit Pulsa, Gak Percaya?

Bagi para penggemar judi online, peluang untuk meraih kemenangan besar atau yang dikenal dengan maxwin menjadi hal yang sangat menarik. Berbicara tentang cara untuk mendapatkan maxwin, terdapat berbagai jenis permainan judi online yang menawarkan kesempatan besar untuk menang, seperti togel online, baccarat, dan sabung ayam. Lebih menariknya lagi, sekarang kamu bisa melakukan deposit pulsa untuk […]

23/12/2024

Kombinasi Travel dan Slot Gacor: Menang Sambil Berpetualang

Menggabungkan perjalanan ke destinasi impian dengan bermain slot gacor adalah cara menarik untuk menciptakan pengalaman liburan yang tidak terlupakan. Selain menikmati keindahan tempat baru, Anda juga bisa membawa pulang kemenangan dari permainan slot favorit. Mengapa Travel dan Slot Gacor Cocok? Perjalanan ke tempat baru sering kali memberikan energi positif dan inspirasi. Dalam suasana santai, bermain […]

17/12/2024

Dari Eksotisme Thailand ke Dunia Slot Gacor Online: Pengalaman Tak Terlupakan

Thailand, negeri yang dikenal dengan keindahan alam, budaya yang memukau, dan kuliner yang lezat, adalah salah satu destinasi wisata terpopuler di dunia. Namun, perjalanan tidak lagi terbatas pada pengalaman fisik. Seiring perkembangan teknologi, hiburan digital seperti slot gacor online kini melengkapi petualangan Anda, menghadirkan sensasi baru yang bisa dinikmati kapan saja dan di mana saja. […]

14/12/2024

Kehidupan Mahasiswa di Vietnam : Antara Studi Serius dan Slot Online Seru

Vietnam telah menjadi destinasi populer untuk pendidikan tinggi berkat universitas-universitas berkualitas yang menawarkan program studi dengan pengakuan global. Di tengah kesibukan akademik, mahasiswa sering mencari cara untuk bersantai dan menikmati hiburan. Salah satu pilihan populer adalah bermain slot online, yang menawarkan hiburan seru dan potensi hadiah menarik. 1. Kehidupan Akademik Mahasiswa di Vietnam Vietnam menawarkan […]

13/12/2024

Binance Jackpot : Slot Gacor Berbasis Blockchain

Pendahuluan Dalam dunia permainan kasino digital yang terus berkembang, Binance Jackpot muncul sebagai salah satu slot gacor berbasis blockchain yang menggabungkan teknologi blockchain dan permainan slot online untuk menciptakan pengalaman bermain yang aman, transparan, dan menguntungkan. Dengan jackpot progresif, fitur bonus menarik, dan pembayaran berbasis kripto, Binance Jackpot menghadirkan potensi kemenangan besar bagi pemain dari […]

12/12/2024

Dewa Olympus Jackpot : Slot Gacor Bertema Mitologi Yunani

Permainan slot online telah menjadi fenomena global dalam dunia perjudian daring. Salah satu yang paling populer di kalangan penggemar adalah “Dewa Olympus Jackpot: Slot Gacor Bertema Mitologi Yunani.” Dengan inspirasi yang kuat dari mitologi Yunani dan fitur permainan yang menarik, slot ini menawarkan pengalaman bermain yang mendebarkan dan peluang untuk memenangkan jackpot besar. Artikel ini […]

11/12/2024

Jackpot Abadi Mae Nak Phra Khanong : Cinta yang Tak Mati, Keberuntungan yang Tak Habis

Dalam dunia legenda rakyat Thailand, nama Mae Nak Phra Khanong adalah simbol cinta abadi yang melegenda sepanjang masa. Kisah tragis namun romantis ini telah diceritakan dari generasi ke generasi dan diadaptasi dalam banyak bentuk seni seperti film, drama, dan literatur. Tetapi apa yang terjadi jika legenda cinta mistis ini dipadukan dengan konsep jackpot dalam dunia […]

04/12/2024

Slotopia: Dunia Slot dengan Nuansa Seni Kreatif

Selamat datang di Slotopia, dunia slot online yang memadukan seni kreatif dengan hiburan digital. Platform ini tidak hanya menawarkan peluang besar untuk menang, tetapi juga membawa Anda ke dalam pengalaman bermain yang unik dengan desain visual yang memukau dan tema penuh imajinasi. Setiap permainan di Slotopia adalah perjalanan kreatif, di mana seni dan teknologi bersatu […]

03/12/2024

Hotel Slot Gacor: Ciptakan Kenangan dan Kemenangan Bersama

Hotel Slot Gacor: Ciptakan Kenangan dan Kemenangan Bersama adalah destinasi liburan yang sempurna untuk Anda yang mencari pengalaman luar biasa, menggabungkan kenyamanan hotel mewah dengan keseruan kasino yang penuh dengan peluang kemenangan. Di sini, setiap putaran mesin slot membawa harapan baru untuk meraih jackpot, sementara fasilitas hotel yang luar biasa membuat liburan Anda semakin berkesan. […]

30/11/2024

Rahasia Oasis: Slot Gacor Mesir

Rahasia Oasis: Slot Gacor Mesir mengajak pemain untuk memasuki dunia penuh misteri dan keajaiban Mesir Kuno. Dalam permainan ini, Anda akan menjelajahi oasis tersembunyi di padang pasir yang luas, tempat dewa-dewa Mesir bersemayam dan harta karun yang tak terhitung jumlahnya menanti untuk ditemukan. Keajaiban Oasis dalam Slot Gacor Mesir Oasis di padang pasir Mesir Kuno […]