wp/wp-includes/deprecated.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    55  *
    55  *
    56  * @link https://developer.wordpress.org/themes/basics/the-loop/
    56  * @link https://developer.wordpress.org/themes/basics/the-loop/
    57  *
    57  *
    58  * @since 1.0.1
    58  * @since 1.0.1
    59  * @deprecated 1.5.0
    59  * @deprecated 1.5.0
       
    60  *
       
    61  * @global WP_Query $wp_query WordPress Query object.
    60  */
    62  */
    61 function start_wp() {
    63 function start_wp() {
    62 	global $wp_query;
    64 	global $wp_query;
    63 
    65 
    64 	_deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') );
    66 	_deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') );
   701 	if ( $optionall )
   703 	if ( $optionall )
   702 		$show_option_all = $all;
   704 		$show_option_all = $all;
   703 
   705 
   704 	$show_option_none = '';
   706 	$show_option_none = '';
   705 	if ( $optionnone )
   707 	if ( $optionnone )
   706 		$show_option_none = __('None');
   708 	$show_option_none = _x( 'None', 'Categories dropdown (show_option_none parameter)' );
   707 
   709 
   708 	$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
   710 	$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
   709 					'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
   711 					'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
   710 	$query = add_query_arg($vars, '');
   712 	$query = add_query_arg($vars, '');
   711 	return wp_dropdown_categories($query);
   713 	return wp_dropdown_categories($query);
   739  * @since 1.0.1
   741  * @since 1.0.1
   740  * @deprecated 2.1.0 Use wp_get_post_categories()
   742  * @deprecated 2.1.0 Use wp_get_post_categories()
   741  * @see wp_get_post_categories()
   743  * @see wp_get_post_categories()
   742  *
   744  *
   743  * @param int $blogid Not Used
   745  * @param int $blogid Not Used
   744  * @param int $post_ID
   746  * @param int $post_id
   745  * @return array
   747  * @return array
   746  */
   748  */
   747 function wp_get_post_cats($blogid = '1', $post_ID = 0) {
   749 function wp_get_post_cats($blogid = '1', $post_id = 0) {
   748 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' );
   750 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' );
   749 	return wp_get_post_categories($post_ID);
   751 	return wp_get_post_categories($post_id);
   750 }
   752 }
   751 
   753 
   752 /**
   754 /**
   753  * Sets the categories that the post ID belongs to.
   755  * Sets the categories that the post ID belongs to.
   754  *
   756  *
   756  * @deprecated 2.1.0
   758  * @deprecated 2.1.0
   757  * @deprecated Use wp_set_post_categories()
   759  * @deprecated Use wp_set_post_categories()
   758  * @see wp_set_post_categories()
   760  * @see wp_set_post_categories()
   759  *
   761  *
   760  * @param int $blogid Not used
   762  * @param int $blogid Not used
   761  * @param int $post_ID
   763  * @param int $post_id
   762  * @param array $post_categories
   764  * @param array $post_categories
   763  * @return bool|mixed
   765  * @return bool|mixed
   764  */
   766  */
   765 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
   767 function wp_set_post_cats($blogid = '1', $post_id = 0, $post_categories = array()) {
   766 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' );
   768 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' );
   767 	return wp_set_post_categories($post_ID, $post_categories);
   769 	return wp_set_post_categories($post_id, $post_categories);
   768 }
   770 }
   769 
   771 
   770 /**
   772 /**
   771  * Retrieves a list of archives.
   773  * Retrieves a list of archives.
   772  *
   774  *
   887  * @return null|string
   889  * @return null|string
   888  */
   890  */
   889 function wp_get_links($args = '') {
   891 function wp_get_links($args = '') {
   890 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
   892 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
   891 
   893 
   892 	if ( strpos( $args, '=' ) === false ) {
   894 	if ( ! str_contains( $args, '=' ) ) {
   893 		$cat_id = $args;
   895 		$cat_id = $args;
   894 		$args = add_query_arg( 'category', $cat_id, $args );
   896 		$args = add_query_arg( 'category', $cat_id, $args );
   895 	}
   897 	}
   896 
   898 
   897 	$defaults = array(
   899 	$defaults = array(
   945 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
   947 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
   946 			$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $display = true) {
   948 			$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $display = true) {
   947 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   949 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   948 
   950 
   949 	$order = 'ASC';
   951 	$order = 'ASC';
   950 	if ( substr($orderby, 0, 1) == '_' ) {
   952 	if ( str_starts_with($orderby, '_') ) {
   951 		$order = 'DESC';
   953 		$order = 'DESC';
   952 		$orderby = substr($orderby, 1);
   954 		$orderby = substr($orderby, 1);
   953 	}
   955 	}
   954 
   956 
   955 	if ( $category == -1 ) // get_bookmarks() uses '' to signify all categories.
   957 	if ( $category == -1 ) // get_bookmarks() uses '' to signify all categories.
   978 		$desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
   980 		$desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
   979 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
   981 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
   980 		$title = $desc;
   982 		$title = $desc;
   981 
   983 
   982 		if ( $show_updated )
   984 		if ( $show_updated )
   983 			if (substr($row->link_updated_f, 0, 2) != '00')
   985 			if ( !str_starts_with($row->link_updated_f, '00') )
   984 				$title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
   986 				$title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
   985 
   987 
   986 		if ( '' != $title )
   988 		if ( '' != $title )
   987 			$title = ' title="' . $title . '"';
   989 			$title = ' title="' . $title . '"';
   988 
   990 
   992 		if ( '' != $target )
   994 		if ( '' != $target )
   993 			$target = ' target="' . $target . '"';
   995 			$target = ' target="' . $target . '"';
   994 
   996 
   995 		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
   997 		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
   996 
   998 
   997 		if ( $row->link_image != null && $show_images ) {
   999 		if ( '' != $row->link_image && $show_images ) {
   998 			if ( strpos($row->link_image, 'http') !== false )
  1000 			if ( str_contains( $row->link_image, 'http' ) )
   999 				$output .= "<img src=\"$row->link_image\" $alt $title />";
  1001 				$output .= '<img src="' . $row->link_image . '"' . $alt . $title . ' />';
  1000 			else // If it's a relative path.
  1002 			else // If it's a relative path.
  1001 				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
  1003 				$output .= '<img src="' . get_option('siteurl') . $row->link_image . '"' . $alt . $title . ' />';
  1002 		} else {
  1004 		} else {
  1003 			$output .= $name;
  1005 			$output .= $name;
  1004 		}
  1006 		}
  1005 
  1007 
  1006 		$output .= '</a>';
  1008 		$output .= '</a>';
  1040 
  1042 
  1041 	$order = strtolower($order);
  1043 	$order = strtolower($order);
  1042 
  1044 
  1043 	// Handle link category sorting.
  1045 	// Handle link category sorting.
  1044 	$direction = 'ASC';
  1046 	$direction = 'ASC';
  1045 	if ( '_' == substr($order,0,1) ) {
  1047 	if ( str_starts_with( $order, '_' ) ) {
  1046 		$direction = 'DESC';
  1048 		$direction = 'DESC';
  1047 		$order = substr($order,1);
  1049 		$order = substr($order,1);
  1048 	}
  1050 	}
  1049 
  1051 
  1050 	if ( !isset($direction) )
  1052 	if ( !isset($direction) )
  1148  * @since 1.2.0
  1150  * @since 1.2.0
  1149  * @deprecated 2.5.0 Use get_category_feed_link()
  1151  * @deprecated 2.5.0 Use get_category_feed_link()
  1150  * @see get_category_feed_link()
  1152  * @see get_category_feed_link()
  1151  *
  1153  *
  1152  * @param bool $display
  1154  * @param bool $display
  1153  * @param int $cat_ID
  1155  * @param int $cat_id
  1154  * @return string
  1156  * @return string
  1155  */
  1157  */
  1156 function get_category_rss_link($display = false, $cat_ID = 1) {
  1158 function get_category_rss_link($display = false, $cat_id = 1) {
  1157 	_deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' );
  1159 	_deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' );
  1158 
  1160 
  1159 	$link = get_category_feed_link($cat_ID, 'rss2');
  1161 	$link = get_category_feed_link($cat_id, 'rss2');
  1160 
  1162 
  1161 	if ( $display )
  1163 	if ( $display )
  1162 		echo $link;
  1164 		echo $link;
  1163 	return $link;
  1165 	return $link;
  1164 }
  1166 }
  1223 	_deprecated_function( __FUNCTION__, '2.5.0' );
  1225 	_deprecated_function( __FUNCTION__, '2.5.0' );
  1224 	return false;
  1226 	return false;
  1225 }
  1227 }
  1226 
  1228 
  1227 /**
  1229 /**
  1228  * Retrieve an array of comment data about comment $comment_ID.
  1230  * Retrieve an array of comment data about comment $comment_id.
  1229  *
  1231  *
  1230  * @since 0.71
  1232  * @since 0.71
  1231  * @deprecated 2.7.0 Use get_comment()
  1233  * @deprecated 2.7.0 Use get_comment()
  1232  * @see get_comment()
  1234  * @see get_comment()
  1233  *
  1235  *
  1234  * @param int $comment_ID The ID of the comment
  1236  * @param int $comment_id The ID of the comment
  1235  * @param int $no_cache Whether to use the cache (cast to bool)
  1237  * @param int $no_cache Whether to use the cache (cast to bool)
  1236  * @param bool $include_unapproved Whether to include unapproved comments
  1238  * @param bool $include_unapproved Whether to include unapproved comments
  1237  * @return array The comment data
  1239  * @return array The comment data
  1238  */
  1240  */
  1239 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
  1241 function get_commentdata( $comment_id, $no_cache = 0, $include_unapproved = false ) {
  1240 	_deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
  1242 	_deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
  1241 	return get_comment($comment_ID, ARRAY_A);
  1243 	return get_comment($comment_id, ARRAY_A);
  1242 }
  1244 }
  1243 
  1245 
  1244 /**
  1246 /**
  1245  * Retrieve the category name by the category ID.
  1247  * Retrieve the category name by the category ID.
  1246  *
  1248  *
  1247  * @since 0.71
  1249  * @since 0.71
  1248  * @deprecated 2.8.0 Use get_cat_name()
  1250  * @deprecated 2.8.0 Use get_cat_name()
  1249  * @see get_cat_name()
  1251  * @see get_cat_name()
  1250  *
  1252  *
  1251  * @param int $cat_ID Category ID
  1253  * @param int $cat_id Category ID
  1252  * @return string category name
  1254  * @return string category name
  1253  */
  1255  */
  1254 function get_catname( $cat_ID ) {
  1256 function get_catname( $cat_id ) {
  1255 	_deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' );
  1257 	_deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' );
  1256 	return get_cat_name( $cat_ID );
  1258 	return get_cat_name( $cat_id );
  1257 }
  1259 }
  1258 
  1260 
  1259 /**
  1261 /**
  1260  * Retrieve category children list separated before and after the term IDs.
  1262  * Retrieve category children list separated before and after the term IDs.
  1261  *
  1263  *
  1737 		$link_match = $matches[0][$i];
  1739 		$link_match = $matches[0][$i];
  1738 		$link_number = '['.($i+1).']';
  1740 		$link_number = '['.($i+1).']';
  1739 		$link_url = $matches[2][$i];
  1741 		$link_url = $matches[2][$i];
  1740 		$link_text = $matches[4][$i];
  1742 		$link_text = $matches[4][$i];
  1741 		$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
  1743 		$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
  1742 		$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
  1744 		$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) !== 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) !== 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
  1743 		$links_summary .= "\n" . $link_number . ' ' . $link_url;
  1745 		$links_summary .= "\n" . $link_number . ' ' . $link_url;
  1744 	}
  1746 	}
  1745 	$content  = strip_tags( $content );
  1747 	$content  = strip_tags( $content );
  1746 	$content .= $links_summary;
  1748 	$content .= $links_summary;
  1747 	return $content;
  1749 	return $content;
  1906 	} elseif ( wp_attachment_is_image( $post->ID ) ) {
  1908 	} elseif ( wp_attachment_is_image( $post->ID ) ) {
  1907 		// We have an image without a thumbnail.
  1909 		// We have an image without a thumbnail.
  1908 
  1910 
  1909 		$src = wp_get_attachment_url( $post->ID );
  1911 		$src = wp_get_attachment_url( $post->ID );
  1910 		$src_file = & $file;
  1912 		$src_file = & $file;
  1911 	} elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
  1913 	} elseif ( $src = wp_mime_type_icon( $post->ID, '.svg' ) ) {
  1912 		// No thumb, no image. We'll look for a mime-related icon instead.
  1914 		// No thumb, no image. We'll look for a mime-related icon instead.
  1913 
  1915 
  1914 		/** This filter is documented in wp-includes/post.php */
  1916 		/** This filter is documented in wp-includes/post.php */
  1915 		$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
  1917 		$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
  1916 		$src_file = $icon_dir . '/' . wp_basename($src);
  1918 		$src_file = $icon_dir . '/' . wp_basename($src);
  2025 
  2027 
  2026 /**
  2028 /**
  2027  * Checks and cleans a URL.
  2029  * Checks and cleans a URL.
  2028  *
  2030  *
  2029  * A number of characters are removed from the URL. If the URL is for displaying
  2031  * A number of characters are removed from the URL. If the URL is for displaying
  2030  * (the default behaviour) ampersands are also replaced. The 'clean_url' filter
  2032  * (the default behavior) ampersands are also replaced. The 'clean_url' filter
  2031  * is applied to the returned cleaned URL.
  2033  * is applied to the returned cleaned URL.
  2032  *
  2034  *
  2033  * @since 1.2.0
  2035  * @since 1.2.0
  2034  * @deprecated 3.0.0 Use esc_url()
  2036  * @deprecated 3.0.0 Use esc_url()
  2035  * @see esc_url()
  2037  * @see esc_url()
  2039  * @param string $context Optional. How the URL will be used. Default is 'display'.
  2041  * @param string $context Optional. How the URL will be used. Default is 'display'.
  2040  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
  2042  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
  2041  */
  2043  */
  2042 function clean_url( $url, $protocols = null, $context = 'display' ) {
  2044 function clean_url( $url, $protocols = null, $context = 'display' ) {
  2043 	if ( $context == 'db' )
  2045 	if ( $context == 'db' )
  2044 		_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
  2046 		_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'sanitize_url()' );
  2045 	else
  2047 	else
  2046 		_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
  2048 		_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
  2047 	return esc_url( $url, $protocols, $context );
  2049 	return esc_url( $url, $protocols, $context );
  2048 }
  2050 }
  2049 
  2051 
  2215  *
  2217  *
  2216  * @since 2.0.0
  2218  * @since 2.0.0
  2217  * @deprecated 3.0.0 Use delete_user_meta()
  2219  * @deprecated 3.0.0 Use delete_user_meta()
  2218  * @see delete_user_meta()
  2220  * @see delete_user_meta()
  2219  *
  2221  *
       
  2222  * @global wpdb $wpdb WordPress database abstraction object.
       
  2223  *
  2220  * @param int $user_id User ID.
  2224  * @param int $user_id User ID.
  2221  * @param string $meta_key Metadata key.
  2225  * @param string $meta_key Metadata key.
  2222  * @param mixed $meta_value Optional. Metadata value. Default empty.
  2226  * @param mixed $meta_value Optional. Metadata value. Default empty.
  2223  * @return bool True deletion completed and false if user_id is not a number.
  2227  * @return bool True deletion completed and false if user_id is not a number.
  2224  */
  2228  */
  2261  * than one metadata value, then it will be list of metadata values.
  2265  * than one metadata value, then it will be list of metadata values.
  2262  *
  2266  *
  2263  * @since 2.0.0
  2267  * @since 2.0.0
  2264  * @deprecated 3.0.0 Use get_user_meta()
  2268  * @deprecated 3.0.0 Use get_user_meta()
  2265  * @see get_user_meta()
  2269  * @see get_user_meta()
       
  2270  *
       
  2271  * @global wpdb $wpdb WordPress database abstraction object.
  2266  *
  2272  *
  2267  * @param int $user_id User ID
  2273  * @param int $user_id User ID
  2268  * @param string $meta_key Optional. Metadata key. Default empty.
  2274  * @param string $meta_key Optional. Metadata key. Default empty.
  2269  * @return mixed
  2275  * @return mixed
  2270  */
  2276  */
  2295 			return '';
  2301 			return '';
  2296 	}
  2302 	}
  2297 
  2303 
  2298 	$metas = array_map('maybe_unserialize', $metas);
  2304 	$metas = array_map('maybe_unserialize', $metas);
  2299 
  2305 
  2300 	if ( count($metas) == 1 )
  2306 	if ( count($metas) === 1 )
  2301 		return $metas[0];
  2307 		return $metas[0];
  2302 	else
  2308 	else
  2303 		return $metas;
  2309 		return $metas;
  2304 }
  2310 }
  2305 
  2311 
  2313  * Will remove the metadata, if the meta value is empty.
  2319  * Will remove the metadata, if the meta value is empty.
  2314  *
  2320  *
  2315  * @since 2.0.0
  2321  * @since 2.0.0
  2316  * @deprecated 3.0.0 Use update_user_meta()
  2322  * @deprecated 3.0.0 Use update_user_meta()
  2317  * @see update_user_meta()
  2323  * @see update_user_meta()
       
  2324  *
       
  2325  * @global wpdb $wpdb WordPress database abstraction object.
  2318  *
  2326  *
  2319  * @param int $user_id User ID
  2327  * @param int $user_id User ID
  2320  * @param string $meta_key Metadata key.
  2328  * @param string $meta_key Metadata key.
  2321  * @param mixed $meta_value Metadata value.
  2329  * @param mixed $meta_value Metadata value.
  2322  * @return bool True on successful update, false on failure.
  2330  * @return bool True on successful update, false on failure.
  2528  * @global $plugin_page
  2536  * @global $plugin_page
  2529  *
  2537  *
  2530  * @return bool
  2538  * @return bool
  2531  */
  2539  */
  2532 function is_plugin_page() {
  2540 function is_plugin_page() {
  2533 	_deprecated_function( __FUNCTION__, '3.1.0'  );
  2541 	_deprecated_function( __FUNCTION__, '3.1.0' );
  2534 
  2542 
  2535 	global $plugin_page;
  2543 	global $plugin_page;
  2536 
  2544 
  2537 	if ( isset($plugin_page) )
  2545 	if ( isset($plugin_page) )
  2538 		return true;
  2546 		return true;
  2551  * @deprecated 3.1.0
  2559  * @deprecated 3.1.0
  2552  *
  2560  *
  2553  * @return bool Always return True
  2561  * @return bool Always return True
  2554  */
  2562  */
  2555 function update_category_cache() {
  2563 function update_category_cache() {
  2556 	_deprecated_function( __FUNCTION__, '3.1.0'  );
  2564 	_deprecated_function( __FUNCTION__, '3.1.0' );
  2557 
  2565 
  2558 	return true;
  2566 	return true;
  2559 }
  2567 }
  2560 
  2568 
  2561 /**
  2569 /**
  2624 }
  2632 }
  2625 
  2633 
  2626 /**
  2634 /**
  2627  * Sanitize every user field.
  2635  * Sanitize every user field.
  2628  *
  2636  *
  2629  * If the context is 'raw', then the user object or array will get minimal santization of the int fields.
  2637  * If the context is 'raw', then the user object or array will get minimal sanitization of the int fields.
  2630  *
  2638  *
  2631  * @since 2.3.0
  2639  * @since 2.3.0
  2632  * @deprecated 3.3.0
  2640  * @deprecated 3.3.0
  2633  *
  2641  *
  2634  * @param object|array $user    The user object or array.
  2642  * @param object|array $user    The user object or array.
  2751  * Get parent post relational link.
  2759  * Get parent post relational link.
  2752  *
  2760  *
  2753  * @since 2.8.0
  2761  * @since 2.8.0
  2754  * @deprecated 3.3.0
  2762  * @deprecated 3.3.0
  2755  *
  2763  *
       
  2764  * @global WP_Post $post Global post object.
       
  2765  *
  2756  * @param string $title Optional. Link title format. Default '%title'.
  2766  * @param string $title Optional. Link title format. Default '%title'.
  2757  * @return string
  2767  * @return string
  2758  */
  2768  */
  2759 function get_parent_post_rel_link( $title = '%title' ) {
  2769 function get_parent_post_rel_link( $title = '%title' ) {
  2760 	_deprecated_function( __FUNCTION__, '3.3.0' );
  2770 	_deprecated_function( __FUNCTION__, '3.3.0' );
  3324 				return (imagetypes() & IMG_PNG) != 0;
  3334 				return (imagetypes() & IMG_PNG) != 0;
  3325 			case 'image/gif':
  3335 			case 'image/gif':
  3326 				return (imagetypes() & IMG_GIF) != 0;
  3336 				return (imagetypes() & IMG_GIF) != 0;
  3327 			case 'image/webp':
  3337 			case 'image/webp':
  3328 				return (imagetypes() & IMG_WEBP) != 0;
  3338 				return (imagetypes() & IMG_WEBP) != 0;
  3329 		}
  3339 			case 'image/avif':
       
  3340 				return (imagetypes() & IMG_AVIF) != 0;
       
  3341 			}
  3330 	} else {
  3342 	} else {
  3331 		switch( $mime_type ) {
  3343 		switch( $mime_type ) {
  3332 			case 'image/jpeg':
  3344 			case 'image/jpeg':
  3333 				return function_exists('imagecreatefromjpeg');
  3345 				return function_exists('imagecreatefromjpeg');
  3334 			case 'image/png':
  3346 			case 'image/png':
  3335 				return function_exists('imagecreatefrompng');
  3347 				return function_exists('imagecreatefrompng');
  3336 			case 'image/gif':
  3348 			case 'image/gif':
  3337 				return function_exists('imagecreatefromgif');
  3349 				return function_exists('imagecreatefromgif');
  3338 			case 'image/webp':
  3350 			case 'image/webp':
  3339 				return function_exists('imagecreatefromwebp');
  3351 				return function_exists('imagecreatefromwebp');
       
  3352 			case 'image/avif':
       
  3353 				return function_exists('imagecreatefromavif');
  3340 		}
  3354 		}
  3341 	}
  3355 	}
  3342 	return false;
  3356 	return false;
  3343 }
  3357 }
  3344 
  3358 
  3629  *
  3643  *
  3630  * @since 1.0.0
  3644  * @since 1.0.0
  3631  * @deprecated 4.4.0 Use get_permalink()
  3645  * @deprecated 4.4.0 Use get_permalink()
  3632  * @see get_permalink()
  3646  * @see get_permalink()
  3633  *
  3647  *
  3634  * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
  3648  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
  3635  * @return string|false
  3649  * @return string|false
  3636  */
  3650  */
  3637 function post_permalink( $post_id = 0 ) {
  3651 function post_permalink( $post = 0 ) {
  3638 	_deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' );
  3652 	_deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' );
  3639 
  3653 
  3640 	return get_permalink( $post_id );
  3654 	return get_permalink( $post );
  3641 }
  3655 }
  3642 
  3656 
  3643 /**
  3657 /**
  3644  * Perform a HTTP HEAD or GET request.
  3658  * Perform a HTTP HEAD or GET request.
  3645  *
  3659  *
  3652  *
  3666  *
  3653  * @param string      $url       URL to fetch.
  3667  * @param string      $url       URL to fetch.
  3654  * @param string|bool $file_path Optional. File path to write request to. Default false.
  3668  * @param string|bool $file_path Optional. File path to write request to. Default false.
  3655  * @param int         $red       Optional. The number of Redirects followed, Upon 5 being hit,
  3669  * @param int         $red       Optional. The number of Redirects followed, Upon 5 being hit,
  3656  *                               returns false. Default 1.
  3670  *                               returns false. Default 1.
  3657  * @return bool|string False on failure and string of headers if HEAD request.
  3671  * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|false Headers on success, false on failure.
  3658  */
  3672  */
  3659 function wp_get_http( $url, $file_path = false, $red = 1 ) {
  3673 function wp_get_http( $url, $file_path = false, $red = 1 ) {
  3660 	_deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' );
  3674 	_deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' );
  3661 
  3675 
  3662 	@set_time_limit( 60 );
  3676 	if ( function_exists( 'set_time_limit' ) ) {
       
  3677 		@set_time_limit( 60 );
       
  3678 	}
  3663 
  3679 
  3664 	if ( $red > 5 )
  3680 	if ( $red > 5 )
  3665 		return false;
  3681 		return false;
  3666 
  3682 
  3667 	$options = array();
  3683 	$options = array();
  3912 /**
  3928 /**
  3913  * Retrieves the Press This bookmarklet link.
  3929  * Retrieves the Press This bookmarklet link.
  3914  *
  3930  *
  3915  * @since 2.6.0
  3931  * @since 2.6.0
  3916  * @deprecated 4.9.0
  3932  * @deprecated 4.9.0
  3917  *
  3933  * @return string
  3918  */
  3934  */
  3919 function get_shortcut_link() {
  3935 function get_shortcut_link() {
  3920 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3936 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3921 
  3937 
  3922 	$link = '';
  3938 	$link = '';
  3931 	 */
  3947 	 */
  3932 	return apply_filters( 'shortcut_link', $link );
  3948 	return apply_filters( 'shortcut_link', $link );
  3933 }
  3949 }
  3934 
  3950 
  3935 /**
  3951 /**
  3936 * Ajax handler for saving a post from Press This.
  3952  * Ajax handler for saving a post from Press This.
  3937 *
  3953  *
  3938 * @since 4.2.0
  3954  * @since 4.2.0
  3939 * @deprecated 4.9.0
  3955  * @deprecated 4.9.0
  3940 */
  3956  */
  3941 function wp_ajax_press_this_save_post() {
  3957 function wp_ajax_press_this_save_post() {
  3942 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3958 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3943 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3959 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3944 		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
  3960 		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
  3945 		$wp_press_this = new WP_Press_This_Plugin();
  3961 		$wp_press_this = new WP_Press_This_Plugin();
  3948 		wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
  3964 		wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
  3949 	}
  3965 	}
  3950 }
  3966 }
  3951 
  3967 
  3952 /**
  3968 /**
  3953 * Ajax handler for creating new category from Press This.
  3969  * Ajax handler for creating new category from Press This.
  3954 *
  3970  *
  3955 * @since 4.2.0
  3971  * @since 4.2.0
  3956 * @deprecated 4.9.0
  3972  * @deprecated 4.9.0
  3957 */
  3973  */
  3958 function wp_ajax_press_this_add_category() {
  3974 function wp_ajax_press_this_add_category() {
  3959 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3975 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3960 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3976 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3961 		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
  3977 		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
  3962 		$wp_press_this = new WP_Press_This_Plugin();
  3978 		$wp_press_this = new WP_Press_This_Plugin();
  4004  *
  4020  *
  4005  * @since 2.1.0
  4021  * @since 2.1.0
  4006  * @access private
  4022  * @access private
  4007  * @deprecated 5.5.0
  4023  * @deprecated 5.5.0
  4008  */
  4024  */
  4009 function wp_unregister_GLOBALS() {  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
  4025 function wp_unregister_GLOBALS() {
  4010 	// register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4.
  4026 	// register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4.
  4011 	_deprecated_function( __FUNCTION__, '5.5.0' );
  4027 	_deprecated_function( __FUNCTION__, '5.5.0' );
  4012 }
  4028 }
  4013 
  4029 
  4014 /**
  4030 /**
  4058  *
  4074  *
  4059  * @since 2.7.0
  4075  * @since 2.7.0
  4060  * @deprecated 5.5.0 Use add_allowed_options() instead.
  4076  * @deprecated 5.5.0 Use add_allowed_options() instead.
  4061  *                   Please consider writing more inclusive code.
  4077  *                   Please consider writing more inclusive code.
  4062  *
  4078  *
  4063  * @global array $allowed_options
       
  4064  *
       
  4065  * @param array        $new_options
  4079  * @param array        $new_options
  4066  * @param string|array $options
  4080  * @param string|array $options
  4067  * @return array
  4081  * @return array
  4068  */
  4082  */
  4069 function add_option_whitelist( $new_options, $options = '' ) {
  4083 function add_option_whitelist( $new_options, $options = '' ) {
  4076  * Removes a list of options from the allowed options list.
  4090  * Removes a list of options from the allowed options list.
  4077  *
  4091  *
  4078  * @since 2.7.0
  4092  * @since 2.7.0
  4079  * @deprecated 5.5.0 Use remove_allowed_options() instead.
  4093  * @deprecated 5.5.0 Use remove_allowed_options() instead.
  4080  *                   Please consider writing more inclusive code.
  4094  *                   Please consider writing more inclusive code.
  4081  *
       
  4082  * @global array $allowed_options
       
  4083  *
  4095  *
  4084  * @param array        $del_options
  4096  * @param array        $del_options
  4085  * @param string|array $options
  4097  * @param string|array $options
  4086  * @return array
  4098  * @return array
  4087  */
  4099  */
  4249  *              should occur.
  4261  *              should occur.
  4250  */
  4262  */
  4251 function wp_skip_border_serialization( $block_type ) {
  4263 function wp_skip_border_serialization( $block_type ) {
  4252 	_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
  4264 	_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
  4253 
  4265 
  4254 	$border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false );
  4266 	$border_support = isset( $block_type->supports['__experimentalBorder'] )
       
  4267 		? $block_type->supports['__experimentalBorder']
       
  4268 		: false;
  4255 
  4269 
  4256 	return is_array( $border_support ) &&
  4270 	return is_array( $border_support ) &&
  4257 		array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
  4271 		array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
  4258 		$border_support['__experimentalSkipSerialization'];
  4272 		$border_support['__experimentalSkipSerialization'];
  4259 }
  4273 }
  4271  * @return bool Whether to serialize spacing support styles & classes.
  4285  * @return bool Whether to serialize spacing support styles & classes.
  4272  */
  4286  */
  4273 function wp_skip_dimensions_serialization( $block_type ) {
  4287 function wp_skip_dimensions_serialization( $block_type ) {
  4274 	_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
  4288 	_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
  4275 
  4289 
  4276 	$dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false );
  4290 	$dimensions_support = isset( $block_type->supports['__experimentalDimensions'] )
       
  4291 		? $block_type->supports['__experimentalDimensions']
       
  4292 		: false;
  4277 
  4293 
  4278 	return is_array( $dimensions_support ) &&
  4294 	return is_array( $dimensions_support ) &&
  4279 		array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
  4295 		array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
  4280 		$dimensions_support['__experimentalSkipSerialization'];
  4296 		$dimensions_support['__experimentalSkipSerialization'];
  4281 }
  4297 }
  4293  * @return bool Whether to serialize spacing support styles & classes.
  4309  * @return bool Whether to serialize spacing support styles & classes.
  4294  */
  4310  */
  4295 function wp_skip_spacing_serialization( $block_type ) {
  4311 function wp_skip_spacing_serialization( $block_type ) {
  4296 	_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
  4312 	_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
  4297 
  4313 
  4298 	$spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false );
  4314 	$spacing_support = isset( $block_type->supports['spacing'] )
       
  4315 		? $block_type->supports['spacing']
       
  4316 		: false;
  4299 
  4317 
  4300 	return is_array( $spacing_support ) &&
  4318 	return is_array( $spacing_support ) &&
  4301 		array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&
  4319 		array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&
  4302 		$spacing_support['__experimentalSkipSerialization'];
  4320 		$spacing_support['__experimentalSkipSerialization'];
  4303 }
  4321 }
  4309  * @deprecated 6.0.0
  4327  * @deprecated 6.0.0
  4310  */
  4328  */
  4311 function wp_add_iframed_editor_assets_html() {
  4329 function wp_add_iframed_editor_assets_html() {
  4312 	_deprecated_function( __FUNCTION__, '6.0.0' );
  4330 	_deprecated_function( __FUNCTION__, '6.0.0' );
  4313 }
  4331 }
       
  4332 
       
  4333 /**
       
  4334  * Retrieves thumbnail for an attachment.
       
  4335  * Note that this works only for the (very) old image metadata style where 'thumb' was set,
       
  4336  * and the 'sizes' array did not exist. This function returns false for the newer image metadata style
       
  4337  * despite that 'thumbnail' is present in the 'sizes' array.
       
  4338  *
       
  4339  * @since 2.1.0
       
  4340  * @deprecated 6.1.0
       
  4341  *
       
  4342  * @param int $post_id Optional. Attachment ID. Default is the ID of the global `$post`.
       
  4343  * @return string|false Thumbnail file path on success, false on failure.
       
  4344  */
       
  4345 function wp_get_attachment_thumb_file( $post_id = 0 ) {
       
  4346 	_deprecated_function( __FUNCTION__, '6.1.0' );
       
  4347 
       
  4348 	$post_id = (int) $post_id;
       
  4349 	$post    = get_post( $post_id );
       
  4350 
       
  4351 	if ( ! $post ) {
       
  4352 		return false;
       
  4353 	}
       
  4354 
       
  4355 	// Use $post->ID rather than $post_id as get_post() may have used the global $post object.
       
  4356 	$imagedata = wp_get_attachment_metadata( $post->ID );
       
  4357 
       
  4358 	if ( ! is_array( $imagedata ) ) {
       
  4359 		return false;
       
  4360 	}
       
  4361 
       
  4362 	$file = get_attached_file( $post->ID );
       
  4363 
       
  4364 	if ( ! empty( $imagedata['thumb'] ) ) {
       
  4365 		$thumbfile = str_replace( wp_basename( $file ), $imagedata['thumb'], $file );
       
  4366 		if ( file_exists( $thumbfile ) ) {
       
  4367 			/**
       
  4368 			 * Filters the attachment thumbnail file path.
       
  4369 			 *
       
  4370 			 * @since 2.1.0
       
  4371 			 *
       
  4372 			 * @param string $thumbfile File path to the attachment thumbnail.
       
  4373 			 * @param int    $post_id   Attachment ID.
       
  4374 			 */
       
  4375 			return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
       
  4376 		}
       
  4377 	}
       
  4378 
       
  4379 	return false;
       
  4380 }
       
  4381 
       
  4382 /**
       
  4383  * Gets the path to a translation file for loading a textdomain just in time.
       
  4384  *
       
  4385  * Caches the retrieved results internally.
       
  4386  *
       
  4387  * @since 4.7.0
       
  4388  * @deprecated 6.1.0
       
  4389  * @access private
       
  4390  *
       
  4391  * @see _load_textdomain_just_in_time()
       
  4392  *
       
  4393  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
       
  4394  * @param bool   $reset  Whether to reset the internal cache. Used by the switch to locale functionality.
       
  4395  * @return string|false The path to the translation file or false if no translation file was found.
       
  4396  */
       
  4397 function _get_path_to_translation( $domain, $reset = false ) {
       
  4398 	_deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );
       
  4399 
       
  4400 	static $available_translations = array();
       
  4401 
       
  4402 	if ( true === $reset ) {
       
  4403 		$available_translations = array();
       
  4404 	}
       
  4405 
       
  4406 	if ( ! isset( $available_translations[ $domain ] ) ) {
       
  4407 		$available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain );
       
  4408 	}
       
  4409 
       
  4410 	return $available_translations[ $domain ];
       
  4411 }
       
  4412 
       
  4413 /**
       
  4414  * Gets the path to a translation file in the languages directory for the current locale.
       
  4415  *
       
  4416  * Holds a cached list of available .mo files to improve performance.
       
  4417  *
       
  4418  * @since 4.7.0
       
  4419  * @deprecated 6.1.0
       
  4420  * @access private
       
  4421  *
       
  4422  * @see _get_path_to_translation()
       
  4423  *
       
  4424  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
       
  4425  * @return string|false The path to the translation file or false if no translation file was found.
       
  4426  */
       
  4427 function _get_path_to_translation_from_lang_dir( $domain ) {
       
  4428 	_deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );
       
  4429 
       
  4430 	static $cached_mofiles = null;
       
  4431 
       
  4432 	if ( null === $cached_mofiles ) {
       
  4433 		$cached_mofiles = array();
       
  4434 
       
  4435 		$locations = array(
       
  4436 			WP_LANG_DIR . '/plugins',
       
  4437 			WP_LANG_DIR . '/themes',
       
  4438 		);
       
  4439 
       
  4440 		foreach ( $locations as $location ) {
       
  4441 			$mofiles = glob( $location . '/*.mo' );
       
  4442 			if ( $mofiles ) {
       
  4443 				$cached_mofiles = array_merge( $cached_mofiles, $mofiles );
       
  4444 			}
       
  4445 		}
       
  4446 	}
       
  4447 
       
  4448 	$locale = determine_locale();
       
  4449 	$mofile = "{$domain}-{$locale}.mo";
       
  4450 
       
  4451 	$path = WP_LANG_DIR . '/plugins/' . $mofile;
       
  4452 	if ( in_array( $path, $cached_mofiles, true ) ) {
       
  4453 		return $path;
       
  4454 	}
       
  4455 
       
  4456 	$path = WP_LANG_DIR . '/themes/' . $mofile;
       
  4457 	if ( in_array( $path, $cached_mofiles, true ) ) {
       
  4458 		return $path;
       
  4459 	}
       
  4460 
       
  4461 	return false;
       
  4462 }
       
  4463 
       
  4464 /**
       
  4465  * Allows multiple block styles.
       
  4466  *
       
  4467  * @since 5.9.0
       
  4468  * @deprecated 6.1.0
       
  4469  *
       
  4470  * @param array $metadata Metadata for registering a block type.
       
  4471  * @return array Metadata for registering a block type.
       
  4472  */
       
  4473 function _wp_multiple_block_styles( $metadata ) {
       
  4474 	_deprecated_function( __FUNCTION__, '6.1.0' );
       
  4475 	return $metadata;
       
  4476 }
       
  4477 
       
  4478 /**
       
  4479  * Generates an inline style for a typography feature e.g. text decoration,
       
  4480  * text transform, and font style.
       
  4481  *
       
  4482  * @since 5.8.0
       
  4483  * @access private
       
  4484  * @deprecated 6.1.0 Use wp_style_engine_get_styles() introduced in 6.1.0.
       
  4485  *
       
  4486  * @see wp_style_engine_get_styles()
       
  4487  *
       
  4488  * @param array  $attributes   Block's attributes.
       
  4489  * @param string $feature      Key for the feature within the typography styles.
       
  4490  * @param string $css_property Slug for the CSS property the inline style sets.
       
  4491  * @return string CSS inline style.
       
  4492  */
       
  4493 function wp_typography_get_css_variable_inline_style( $attributes, $feature, $css_property ) {
       
  4494 	_deprecated_function( __FUNCTION__, '6.1.0', 'wp_style_engine_get_styles()' );
       
  4495 
       
  4496 	// Retrieve current attribute value or skip if not found.
       
  4497 	$style_value = _wp_array_get( $attributes, array( 'style', 'typography', $feature ), false );
       
  4498 	if ( ! $style_value ) {
       
  4499 		return;
       
  4500 	}
       
  4501 
       
  4502 	// If we don't have a preset CSS variable, we'll assume it's a regular CSS value.
       
  4503 	if ( ! str_contains( $style_value, "var:preset|{$css_property}|" ) ) {
       
  4504 		return sprintf( '%s:%s;', $css_property, $style_value );
       
  4505 	}
       
  4506 
       
  4507 	/*
       
  4508 	 * We have a preset CSS variable as the style.
       
  4509 	 * Get the style value from the string and return CSS style.
       
  4510 	 */
       
  4511 	$index_to_splice = strrpos( $style_value, '|' ) + 1;
       
  4512 	$slug            = substr( $style_value, $index_to_splice );
       
  4513 
       
  4514 	// Return the actual CSS inline style e.g. `text-decoration:var(--wp--preset--text-decoration--underline);`.
       
  4515 	return sprintf( '%s:var(--wp--preset--%s--%s);', $css_property, $css_property, $slug );
       
  4516 }
       
  4517 
       
  4518 /**
       
  4519  * Determines whether global terms are enabled.
       
  4520  *
       
  4521  * @since 3.0.0
       
  4522  * @since 6.1.0 This function now always returns false.
       
  4523  * @deprecated 6.1.0
       
  4524  *
       
  4525  * @return bool Always returns false.
       
  4526  */
       
  4527 function global_terms_enabled() {
       
  4528 	_deprecated_function( __FUNCTION__, '6.1.0' );
       
  4529 
       
  4530 	return false;
       
  4531 }
       
  4532 
       
  4533 /**
       
  4534  * Filter the SQL clauses of an attachment query to include filenames.
       
  4535  *
       
  4536  * @since 4.7.0
       
  4537  * @deprecated 6.0.3
       
  4538  * @access private
       
  4539  *
       
  4540  * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
       
  4541  *                       DISTINCT, fields (SELECT), and LIMITS clauses.
       
  4542  * @return array The unmodified clauses.
       
  4543  */
       
  4544 function _filter_query_attachment_filenames( $clauses ) {
       
  4545 	_deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
       
  4546 	remove_filter( 'posts_clauses', __FUNCTION__ );
       
  4547 	return $clauses;
       
  4548 }
       
  4549 
       
  4550 /**
       
  4551  * Retrieves a page given its title.
       
  4552  *
       
  4553  * If more than one post uses the same title, the post with the smallest ID will be returned.
       
  4554  * Be careful: in case of more than one post having the same title, it will check the oldest
       
  4555  * publication date, not the smallest ID.
       
  4556  *
       
  4557  * Because this function uses the MySQL '=' comparison, $page_title will usually be matched
       
  4558  * as case-insensitive with default collation.
       
  4559  *
       
  4560  * @since 2.1.0
       
  4561  * @since 3.0.0 The `$post_type` parameter was added.
       
  4562  * @deprecated 6.2.0 Use WP_Query.
       
  4563  *
       
  4564  * @global wpdb $wpdb WordPress database abstraction object.
       
  4565  *
       
  4566  * @param string       $page_title Page title.
       
  4567  * @param string       $output     Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
       
  4568  *                                 correspond to a WP_Post object, an associative array, or a numeric array,
       
  4569  *                                 respectively. Default OBJECT.
       
  4570  * @param string|array $post_type  Optional. Post type or array of post types. Default 'page'.
       
  4571  * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
       
  4572  */
       
  4573 function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
       
  4574 	_deprecated_function( __FUNCTION__, '6.2.0', 'WP_Query' );
       
  4575 	global $wpdb;
       
  4576 
       
  4577 	if ( is_array( $post_type ) ) {
       
  4578 		$post_type           = esc_sql( $post_type );
       
  4579 		$post_type_in_string = "'" . implode( "','", $post_type ) . "'";
       
  4580 		$sql                 = $wpdb->prepare(
       
  4581 			"SELECT ID
       
  4582 			FROM $wpdb->posts
       
  4583 			WHERE post_title = %s
       
  4584 			AND post_type IN ($post_type_in_string)",
       
  4585 			$page_title
       
  4586 		);
       
  4587 	} else {
       
  4588 		$sql = $wpdb->prepare(
       
  4589 			"SELECT ID
       
  4590 			FROM $wpdb->posts
       
  4591 			WHERE post_title = %s
       
  4592 			AND post_type = %s",
       
  4593 			$page_title,
       
  4594 			$post_type
       
  4595 		);
       
  4596 	}
       
  4597 
       
  4598 	$page = $wpdb->get_var( $sql );
       
  4599 
       
  4600 	if ( $page ) {
       
  4601 		return get_post( $page, $output );
       
  4602 	}
       
  4603 
       
  4604 	return null;
       
  4605 }
       
  4606 
       
  4607 /**
       
  4608  * Returns the correct template for the site's home page.
       
  4609  *
       
  4610  * @access private
       
  4611  * @since 6.0.0
       
  4612  * @deprecated 6.2.0 Site Editor's server-side redirect for missing postType and postId
       
  4613  *                   query args is removed. Thus, this function is no longer used.
       
  4614  *
       
  4615  * @return array|null A template object, or null if none could be found.
       
  4616  */
       
  4617 function _resolve_home_block_template() {
       
  4618 	_deprecated_function( __FUNCTION__, '6.2.0' );
       
  4619 
       
  4620 	$show_on_front = get_option( 'show_on_front' );
       
  4621 	$front_page_id = get_option( 'page_on_front' );
       
  4622 
       
  4623 	if ( 'page' === $show_on_front && $front_page_id ) {
       
  4624 		return array(
       
  4625 				'postType' => 'page',
       
  4626 				'postId'   => $front_page_id,
       
  4627 		);
       
  4628 	}
       
  4629 
       
  4630 	$hierarchy = array( 'front-page', 'home', 'index' );
       
  4631 	$template  = resolve_block_template( 'home', $hierarchy, '' );
       
  4632 
       
  4633 	if ( ! $template ) {
       
  4634 		return null;
       
  4635 	}
       
  4636 
       
  4637 	return array(
       
  4638 			'postType' => 'wp_template',
       
  4639 			'postId'   => $template->id,
       
  4640 	);
       
  4641 }
       
  4642 
       
  4643 /**
       
  4644  * Displays the link to the Windows Live Writer manifest file.
       
  4645  *
       
  4646  * @link https://msdn.microsoft.com/en-us/library/bb463265.aspx
       
  4647  * @since 2.3.1
       
  4648  * @deprecated 6.3.0 WLW manifest is no longer in use and no longer included in core,
       
  4649  *                   so the output from this function is removed.
       
  4650  */
       
  4651 function wlwmanifest_link() {
       
  4652 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  4653 }
       
  4654 
       
  4655 /**
       
  4656  * Queues comments for metadata lazy-loading.
       
  4657  *
       
  4658  * @since 4.5.0
       
  4659  * @deprecated 6.3.0 Use wp_lazyload_comment_meta() instead.
       
  4660  *
       
  4661  * @param WP_Comment[] $comments Array of comment objects.
       
  4662  */
       
  4663 function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
       
  4664 	_deprecated_function( __FUNCTION__, '6.3.0', 'wp_lazyload_comment_meta()' );
       
  4665 	// Don't use `wp_list_pluck()` to avoid by-reference manipulation.
       
  4666 	$comment_ids = array();
       
  4667 	if ( is_array( $comments ) ) {
       
  4668 		foreach ( $comments as $comment ) {
       
  4669 			if ( $comment instanceof WP_Comment ) {
       
  4670 				$comment_ids[] = $comment->comment_ID;
       
  4671 			}
       
  4672 		}
       
  4673 	}
       
  4674 
       
  4675 	wp_lazyload_comment_meta( $comment_ids );
       
  4676 }
       
  4677 
       
  4678 /**
       
  4679  * Gets the default value to use for a `loading` attribute on an element.
       
  4680  *
       
  4681  * This function should only be called for a tag and context if lazy-loading is generally enabled.
       
  4682  *
       
  4683  * The function usually returns 'lazy', but uses certain heuristics to guess whether the current element is likely to
       
  4684  * appear above the fold, in which case it returns a boolean `false`, which will lead to the `loading` attribute being
       
  4685  * omitted on the element. The purpose of this refinement is to avoid lazy-loading elements that are within the initial
       
  4686  * viewport, which can have a negative performance impact.
       
  4687  *
       
  4688  * Under the hood, the function uses {@see wp_increase_content_media_count()} every time it is called for an element
       
  4689  * within the main content. If the element is the very first content element, the `loading` attribute will be omitted.
       
  4690  * This default threshold of 3 content elements to omit the `loading` attribute for can be customized using the
       
  4691  * {@see 'wp_omit_loading_attr_threshold'} filter.
       
  4692  *
       
  4693  * @since 5.9.0
       
  4694  * @deprecated 6.3.0 Use wp_get_loading_optimization_attributes() instead.
       
  4695  * @see wp_get_loading_optimization_attributes()
       
  4696  *
       
  4697  * @global WP_Query $wp_query WordPress Query object.
       
  4698  *
       
  4699  * @param string $context Context for the element for which the `loading` attribute value is requested.
       
  4700  * @return string|bool The default `loading` attribute value. Either 'lazy', 'eager', or a boolean `false`, to indicate
       
  4701  *                     that the `loading` attribute should be skipped.
       
  4702  */
       
  4703 function wp_get_loading_attr_default( $context ) {
       
  4704 	_deprecated_function( __FUNCTION__, '6.3.0', 'wp_get_loading_optimization_attributes()' );
       
  4705 	global $wp_query;
       
  4706 
       
  4707 	// Skip lazy-loading for the overall block template, as it is handled more granularly.
       
  4708 	if ( 'template' === $context ) {
       
  4709 		return false;
       
  4710 	}
       
  4711 
       
  4712 	/*
       
  4713 	 * Do not lazy-load images in the header block template part, as they are likely above the fold.
       
  4714 	 * For classic themes, this is handled in the condition below using the 'get_header' action.
       
  4715 	 */
       
  4716 	$header_area = WP_TEMPLATE_PART_AREA_HEADER;
       
  4717 	if ( "template_part_{$header_area}" === $context ) {
       
  4718 		return false;
       
  4719 	}
       
  4720 
       
  4721 	// Special handling for programmatically created image tags.
       
  4722 	if ( 'the_post_thumbnail' === $context || 'wp_get_attachment_image' === $context ) {
       
  4723 		/*
       
  4724 		 * Skip programmatically created images within post content as they need to be handled together with the other
       
  4725 		 * images within the post content.
       
  4726 		 * Without this clause, they would already be counted below which skews the number and can result in the first
       
  4727 		 * post content image being lazy-loaded only because there are images elsewhere in the post content.
       
  4728 		 */
       
  4729 		if ( doing_filter( 'the_content' ) ) {
       
  4730 			return false;
       
  4731 		}
       
  4732 
       
  4733 		// Conditionally skip lazy-loading on images before the loop.
       
  4734 		if (
       
  4735 			// Only apply for main query but before the loop.
       
  4736 			$wp_query->before_loop && $wp_query->is_main_query()
       
  4737 			/*
       
  4738 			 * Any image before the loop, but after the header has started should not be lazy-loaded,
       
  4739 			 * except when the footer has already started which can happen when the current template
       
  4740 			 * does not include any loop.
       
  4741 			 */
       
  4742 			&& did_action( 'get_header' ) && ! did_action( 'get_footer' )
       
  4743 		) {
       
  4744 			return false;
       
  4745 		}
       
  4746 	}
       
  4747 
       
  4748 	/*
       
  4749 	 * The first elements in 'the_content' or 'the_post_thumbnail' should not be lazy-loaded,
       
  4750 	 * as they are likely above the fold.
       
  4751 	 */
       
  4752 	if ( 'the_content' === $context || 'the_post_thumbnail' === $context ) {
       
  4753 		// Only elements within the main query loop have special handling.
       
  4754 		if ( is_admin() || ! in_the_loop() || ! is_main_query() ) {
       
  4755 			return 'lazy';
       
  4756 		}
       
  4757 
       
  4758 		// Increase the counter since this is a main query content element.
       
  4759 		$content_media_count = wp_increase_content_media_count();
       
  4760 
       
  4761 		// If the count so far is below the threshold, return `false` so that the `loading` attribute is omitted.
       
  4762 		if ( $content_media_count <= wp_omit_loading_attr_threshold() ) {
       
  4763 			return false;
       
  4764 		}
       
  4765 
       
  4766 		// For elements after the threshold, lazy-load them as usual.
       
  4767 		return 'lazy';
       
  4768 	}
       
  4769 
       
  4770 	// Lazy-load by default for any unknown context.
       
  4771 	return 'lazy';
       
  4772 }
       
  4773 
       
  4774 /**
       
  4775  * Adds `loading` attribute to an `img` HTML tag.
       
  4776  *
       
  4777  * @since 5.5.0
       
  4778  * @deprecated 6.3.0 Use wp_img_tag_add_loading_optimization_attrs() instead.
       
  4779  * @see wp_img_tag_add_loading_optimization_attrs()
       
  4780  *
       
  4781  * @param string $image   The HTML `img` tag where the attribute should be added.
       
  4782  * @param string $context Additional context to pass to the filters.
       
  4783  * @return string Converted `img` tag with `loading` attribute added.
       
  4784  */
       
  4785 function wp_img_tag_add_loading_attr( $image, $context ) {
       
  4786 	_deprecated_function( __FUNCTION__, '6.3.0', 'wp_img_tag_add_loading_optimization_attrs()' );
       
  4787 	/*
       
  4788 	 * Get loading attribute value to use. This must occur before the conditional check below so that even images that
       
  4789 	 * are ineligible for being lazy-loaded are considered.
       
  4790 	 */
       
  4791 	$value = wp_get_loading_attr_default( $context );
       
  4792 
       
  4793 	// Images should have source and dimension attributes for the `loading` attribute to be added.
       
  4794 	if ( ! str_contains( $image, ' src="' ) || ! str_contains( $image, ' width="' ) || ! str_contains( $image, ' height="' ) ) {
       
  4795 		return $image;
       
  4796 	}
       
  4797 
       
  4798 	/** This filter is documented in wp-admin/includes/media.php */
       
  4799 	$value = apply_filters( 'wp_img_tag_add_loading_attr', $value, $image, $context );
       
  4800 
       
  4801 	if ( $value ) {
       
  4802 		if ( ! in_array( $value, array( 'lazy', 'eager' ), true ) ) {
       
  4803 			$value = 'lazy';
       
  4804 		}
       
  4805 
       
  4806 		return str_replace( '<img', '<img loading="' . esc_attr( $value ) . '"', $image );
       
  4807 	}
       
  4808 
       
  4809 	return $image;
       
  4810 }
       
  4811 
       
  4812 /**
       
  4813  * Takes input from [0, n] and returns it as [0, 1].
       
  4814  *
       
  4815  * Direct port of TinyColor's function, lightly simplified to maintain
       
  4816  * consistency with TinyColor.
       
  4817  *
       
  4818  * @link https://github.com/bgrins/TinyColor
       
  4819  *
       
  4820  * @since 5.8.0
       
  4821  * @deprecated 6.3.0
       
  4822  *
       
  4823  * @access private
       
  4824  *
       
  4825  * @param mixed $n   Number of unknown type.
       
  4826  * @param int   $max Upper value of the range to bound to.
       
  4827  * @return float Value in the range [0, 1].
       
  4828  */
       
  4829 function wp_tinycolor_bound01( $n, $max ) {
       
  4830 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  4831 	if ( 'string' === gettype( $n ) && str_contains( $n, '.' ) && 1 === (float) $n ) {
       
  4832 		$n = '100%';
       
  4833 	}
       
  4834 
       
  4835 	$n = min( $max, max( 0, (float) $n ) );
       
  4836 
       
  4837 	// Automatically convert percentage into number.
       
  4838 	if ( 'string' === gettype( $n ) && str_contains( $n, '%' ) ) {
       
  4839 		$n = (int) ( $n * $max ) / 100;
       
  4840 	}
       
  4841 
       
  4842 	// Handle floating point rounding errors.
       
  4843 	if ( ( abs( $n - $max ) < 0.000001 ) ) {
       
  4844 		return 1.0;
       
  4845 	}
       
  4846 
       
  4847 	// Convert into [0, 1] range if it isn't already.
       
  4848 	return ( $n % $max ) / (float) $max;
       
  4849 }
       
  4850 
       
  4851 /**
       
  4852  * Direct port of tinycolor's boundAlpha function to maintain consistency with
       
  4853  * how tinycolor works.
       
  4854  *
       
  4855  * @link https://github.com/bgrins/TinyColor
       
  4856  *
       
  4857  * @since 5.9.0
       
  4858  * @deprecated 6.3.0
       
  4859  *
       
  4860  * @access private
       
  4861  *
       
  4862  * @param mixed $n Number of unknown type.
       
  4863  * @return float Value in the range [0,1].
       
  4864  */
       
  4865 function _wp_tinycolor_bound_alpha( $n ) {
       
  4866 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  4867 
       
  4868 	if ( is_numeric( $n ) ) {
       
  4869 		$n = (float) $n;
       
  4870 		if ( $n >= 0 && $n <= 1 ) {
       
  4871 			return $n;
       
  4872 		}
       
  4873 	}
       
  4874 	return 1;
       
  4875 }
       
  4876 
       
  4877 /**
       
  4878  * Rounds and converts values of an RGB object.
       
  4879  *
       
  4880  * Direct port of TinyColor's function, lightly simplified to maintain
       
  4881  * consistency with TinyColor.
       
  4882  *
       
  4883  * @link https://github.com/bgrins/TinyColor
       
  4884  *
       
  4885  * @since 5.8.0
       
  4886  * @deprecated 6.3.0
       
  4887  *
       
  4888  * @access private
       
  4889  *
       
  4890  * @param array $rgb_color RGB object.
       
  4891  * @return array Rounded and converted RGB object.
       
  4892  */
       
  4893 function wp_tinycolor_rgb_to_rgb( $rgb_color ) {
       
  4894 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  4895 
       
  4896 	return array(
       
  4897 		'r' => wp_tinycolor_bound01( $rgb_color['r'], 255 ) * 255,
       
  4898 		'g' => wp_tinycolor_bound01( $rgb_color['g'], 255 ) * 255,
       
  4899 		'b' => wp_tinycolor_bound01( $rgb_color['b'], 255 ) * 255,
       
  4900 	);
       
  4901 }
       
  4902 
       
  4903 /**
       
  4904  * Helper function for hsl to rgb conversion.
       
  4905  *
       
  4906  * Direct port of TinyColor's function, lightly simplified to maintain
       
  4907  * consistency with TinyColor.
       
  4908  *
       
  4909  * @link https://github.com/bgrins/TinyColor
       
  4910  *
       
  4911  * @since 5.8.0
       
  4912  * @deprecated 6.3.0
       
  4913  *
       
  4914  * @access private
       
  4915  *
       
  4916  * @param float $p first component.
       
  4917  * @param float $q second component.
       
  4918  * @param float $t third component.
       
  4919  * @return float R, G, or B component.
       
  4920  */
       
  4921 function wp_tinycolor_hue_to_rgb( $p, $q, $t ) {
       
  4922 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  4923 
       
  4924 	if ( $t < 0 ) {
       
  4925 		++$t;
       
  4926 	}
       
  4927 	if ( $t > 1 ) {
       
  4928 		--$t;
       
  4929 	}
       
  4930 	if ( $t < 1 / 6 ) {
       
  4931 		return $p + ( $q - $p ) * 6 * $t;
       
  4932 	}
       
  4933 	if ( $t < 1 / 2 ) {
       
  4934 		return $q;
       
  4935 	}
       
  4936 	if ( $t < 2 / 3 ) {
       
  4937 		return $p + ( $q - $p ) * ( 2 / 3 - $t ) * 6;
       
  4938 	}
       
  4939 	return $p;
       
  4940 }
       
  4941 
       
  4942 /**
       
  4943  * Converts an HSL object to an RGB object with converted and rounded values.
       
  4944  *
       
  4945  * Direct port of TinyColor's function, lightly simplified to maintain
       
  4946  * consistency with TinyColor.
       
  4947  *
       
  4948  * @link https://github.com/bgrins/TinyColor
       
  4949  *
       
  4950  * @since 5.8.0
       
  4951  * @deprecated 6.3.0
       
  4952  *
       
  4953  * @access private
       
  4954  *
       
  4955  * @param array $hsl_color HSL object.
       
  4956  * @return array Rounded and converted RGB object.
       
  4957  */
       
  4958 function wp_tinycolor_hsl_to_rgb( $hsl_color ) {
       
  4959 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  4960 
       
  4961 	$h = wp_tinycolor_bound01( $hsl_color['h'], 360 );
       
  4962 	$s = wp_tinycolor_bound01( $hsl_color['s'], 100 );
       
  4963 	$l = wp_tinycolor_bound01( $hsl_color['l'], 100 );
       
  4964 
       
  4965 	if ( 0 === $s ) {
       
  4966 		// Achromatic.
       
  4967 		$r = $l;
       
  4968 		$g = $l;
       
  4969 		$b = $l;
       
  4970 	} else {
       
  4971 		$q = $l < 0.5 ? $l * ( 1 + $s ) : $l + $s - $l * $s;
       
  4972 		$p = 2 * $l - $q;
       
  4973 		$r = wp_tinycolor_hue_to_rgb( $p, $q, $h + 1 / 3 );
       
  4974 		$g = wp_tinycolor_hue_to_rgb( $p, $q, $h );
       
  4975 		$b = wp_tinycolor_hue_to_rgb( $p, $q, $h - 1 / 3 );
       
  4976 	}
       
  4977 
       
  4978 	return array(
       
  4979 		'r' => $r * 255,
       
  4980 		'g' => $g * 255,
       
  4981 		'b' => $b * 255,
       
  4982 	);
       
  4983 }
       
  4984 
       
  4985 /**
       
  4986  * Parses hex, hsl, and rgb CSS strings using the same regex as TinyColor v1.4.2
       
  4987  * used in the JavaScript. Only colors output from react-color are implemented.
       
  4988  *
       
  4989  * Direct port of TinyColor's function, lightly simplified to maintain
       
  4990  * consistency with TinyColor.
       
  4991  *
       
  4992  * @link https://github.com/bgrins/TinyColor
       
  4993  * @link https://github.com/casesandberg/react-color/
       
  4994  *
       
  4995  * @since 5.8.0
       
  4996  * @since 5.9.0 Added alpha processing.
       
  4997  * @deprecated 6.3.0
       
  4998  *
       
  4999  * @access private
       
  5000  *
       
  5001  * @param string $color_str CSS color string.
       
  5002  * @return array RGB object.
       
  5003  */
       
  5004 function wp_tinycolor_string_to_rgb( $color_str ) {
       
  5005 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  5006 
       
  5007 	$color_str = strtolower( trim( $color_str ) );
       
  5008 
       
  5009 	$css_integer = '[-\\+]?\\d+%?';
       
  5010 	$css_number  = '[-\\+]?\\d*\\.\\d+%?';
       
  5011 
       
  5012 	$css_unit = '(?:' . $css_number . ')|(?:' . $css_integer . ')';
       
  5013 
       
  5014 	$permissive_match3 = '[\\s|\\(]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')\\s*\\)?';
       
  5015 	$permissive_match4 = '[\\s|\\(]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')\\s*\\)?';
       
  5016 
       
  5017 	$rgb_regexp = '/^rgb' . $permissive_match3 . '$/';
       
  5018 	if ( preg_match( $rgb_regexp, $color_str, $match ) ) {
       
  5019 		$rgb = wp_tinycolor_rgb_to_rgb(
       
  5020 			array(
       
  5021 				'r' => $match[1],
       
  5022 				'g' => $match[2],
       
  5023 				'b' => $match[3],
       
  5024 			)
       
  5025 		);
       
  5026 
       
  5027 		$rgb['a'] = 1;
       
  5028 
       
  5029 		return $rgb;
       
  5030 	}
       
  5031 
       
  5032 	$rgba_regexp = '/^rgba' . $permissive_match4 . '$/';
       
  5033 	if ( preg_match( $rgba_regexp, $color_str, $match ) ) {
       
  5034 		$rgb = wp_tinycolor_rgb_to_rgb(
       
  5035 			array(
       
  5036 				'r' => $match[1],
       
  5037 				'g' => $match[2],
       
  5038 				'b' => $match[3],
       
  5039 			)
       
  5040 		);
       
  5041 
       
  5042 		$rgb['a'] = _wp_tinycolor_bound_alpha( $match[4] );
       
  5043 
       
  5044 		return $rgb;
       
  5045 	}
       
  5046 
       
  5047 	$hsl_regexp = '/^hsl' . $permissive_match3 . '$/';
       
  5048 	if ( preg_match( $hsl_regexp, $color_str, $match ) ) {
       
  5049 		$rgb = wp_tinycolor_hsl_to_rgb(
       
  5050 			array(
       
  5051 				'h' => $match[1],
       
  5052 				's' => $match[2],
       
  5053 				'l' => $match[3],
       
  5054 			)
       
  5055 		);
       
  5056 
       
  5057 		$rgb['a'] = 1;
       
  5058 
       
  5059 		return $rgb;
       
  5060 	}
       
  5061 
       
  5062 	$hsla_regexp = '/^hsla' . $permissive_match4 . '$/';
       
  5063 	if ( preg_match( $hsla_regexp, $color_str, $match ) ) {
       
  5064 		$rgb = wp_tinycolor_hsl_to_rgb(
       
  5065 			array(
       
  5066 				'h' => $match[1],
       
  5067 				's' => $match[2],
       
  5068 				'l' => $match[3],
       
  5069 			)
       
  5070 		);
       
  5071 
       
  5072 		$rgb['a'] = _wp_tinycolor_bound_alpha( $match[4] );
       
  5073 
       
  5074 		return $rgb;
       
  5075 	}
       
  5076 
       
  5077 	$hex8_regexp = '/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/';
       
  5078 	if ( preg_match( $hex8_regexp, $color_str, $match ) ) {
       
  5079 		$rgb = wp_tinycolor_rgb_to_rgb(
       
  5080 			array(
       
  5081 				'r' => base_convert( $match[1], 16, 10 ),
       
  5082 				'g' => base_convert( $match[2], 16, 10 ),
       
  5083 				'b' => base_convert( $match[3], 16, 10 ),
       
  5084 			)
       
  5085 		);
       
  5086 
       
  5087 		$rgb['a'] = _wp_tinycolor_bound_alpha(
       
  5088 			base_convert( $match[4], 16, 10 ) / 255
       
  5089 		);
       
  5090 
       
  5091 		return $rgb;
       
  5092 	}
       
  5093 
       
  5094 	$hex6_regexp = '/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/';
       
  5095 	if ( preg_match( $hex6_regexp, $color_str, $match ) ) {
       
  5096 		$rgb = wp_tinycolor_rgb_to_rgb(
       
  5097 			array(
       
  5098 				'r' => base_convert( $match[1], 16, 10 ),
       
  5099 				'g' => base_convert( $match[2], 16, 10 ),
       
  5100 				'b' => base_convert( $match[3], 16, 10 ),
       
  5101 			)
       
  5102 		);
       
  5103 
       
  5104 		$rgb['a'] = 1;
       
  5105 
       
  5106 		return $rgb;
       
  5107 	}
       
  5108 
       
  5109 	$hex4_regexp = '/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/';
       
  5110 	if ( preg_match( $hex4_regexp, $color_str, $match ) ) {
       
  5111 		$rgb = wp_tinycolor_rgb_to_rgb(
       
  5112 			array(
       
  5113 				'r' => base_convert( $match[1] . $match[1], 16, 10 ),
       
  5114 				'g' => base_convert( $match[2] . $match[2], 16, 10 ),
       
  5115 				'b' => base_convert( $match[3] . $match[3], 16, 10 ),
       
  5116 			)
       
  5117 		);
       
  5118 
       
  5119 		$rgb['a'] = _wp_tinycolor_bound_alpha(
       
  5120 			base_convert( $match[4] . $match[4], 16, 10 ) / 255
       
  5121 		);
       
  5122 
       
  5123 		return $rgb;
       
  5124 	}
       
  5125 
       
  5126 	$hex3_regexp = '/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/';
       
  5127 	if ( preg_match( $hex3_regexp, $color_str, $match ) ) {
       
  5128 		$rgb = wp_tinycolor_rgb_to_rgb(
       
  5129 			array(
       
  5130 				'r' => base_convert( $match[1] . $match[1], 16, 10 ),
       
  5131 				'g' => base_convert( $match[2] . $match[2], 16, 10 ),
       
  5132 				'b' => base_convert( $match[3] . $match[3], 16, 10 ),
       
  5133 			)
       
  5134 		);
       
  5135 
       
  5136 		$rgb['a'] = 1;
       
  5137 
       
  5138 		return $rgb;
       
  5139 	}
       
  5140 
       
  5141 	/*
       
  5142 	 * The JS color picker considers the string "transparent" to be a hex value,
       
  5143 	 * so we need to handle it here as a special case.
       
  5144 	 */
       
  5145 	if ( 'transparent' === $color_str ) {
       
  5146 		return array(
       
  5147 			'r' => 0,
       
  5148 			'g' => 0,
       
  5149 			'b' => 0,
       
  5150 			'a' => 0,
       
  5151 		);
       
  5152 	}
       
  5153 }
       
  5154 
       
  5155 /**
       
  5156  * Returns the prefixed id for the duotone filter for use as a CSS id.
       
  5157  *
       
  5158  * @since 5.9.1
       
  5159  * @deprecated 6.3.0
       
  5160  *
       
  5161  * @access private
       
  5162  *
       
  5163  * @param array $preset Duotone preset value as seen in theme.json.
       
  5164  * @return string Duotone filter CSS id.
       
  5165  */
       
  5166 function wp_get_duotone_filter_id( $preset ) {
       
  5167 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  5168 	return WP_Duotone::get_filter_id_from_preset( $preset );
       
  5169 }
       
  5170 
       
  5171 /**
       
  5172  * Returns the CSS filter property url to reference the rendered SVG.
       
  5173  *
       
  5174  * @since 5.9.0
       
  5175  * @since 6.1.0 Allow unset for preset colors.
       
  5176  * @deprecated 6.3.0
       
  5177  *
       
  5178  * @access private
       
  5179  *
       
  5180  * @param array $preset Duotone preset value as seen in theme.json.
       
  5181  * @return string Duotone CSS filter property url value.
       
  5182  */
       
  5183 function wp_get_duotone_filter_property( $preset ) {
       
  5184 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  5185 	return WP_Duotone::get_filter_css_property_value_from_preset( $preset );
       
  5186 }
       
  5187 
       
  5188 /**
       
  5189  * Returns the duotone filter SVG string for the preset.
       
  5190  *
       
  5191  * @since 5.9.1
       
  5192  * @deprecated 6.3.0
       
  5193  *
       
  5194  * @access private
       
  5195  *
       
  5196  * @param array $preset Duotone preset value as seen in theme.json.
       
  5197  * @return string Duotone SVG filter.
       
  5198  */
       
  5199 function wp_get_duotone_filter_svg( $preset ) {
       
  5200 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  5201 	return WP_Duotone::get_filter_svg_from_preset( $preset );
       
  5202 }
       
  5203 
       
  5204 /**
       
  5205  * Registers the style and colors block attributes for block types that support it.
       
  5206  *
       
  5207  * @since 5.8.0
       
  5208  * @deprecated 6.3.0 Use WP_Duotone::register_duotone_support() instead.
       
  5209  *
       
  5210  * @access private
       
  5211  *
       
  5212  * @param WP_Block_Type $block_type Block Type.
       
  5213  */
       
  5214 function wp_register_duotone_support( $block_type ) {
       
  5215 	_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::register_duotone_support()' );
       
  5216 	return WP_Duotone::register_duotone_support( $block_type );
       
  5217 }
       
  5218 
       
  5219 /**
       
  5220  * Renders out the duotone stylesheet and SVG.
       
  5221  *
       
  5222  * @since 5.8.0
       
  5223  * @since 6.1.0 Allow unset for preset colors.
       
  5224  * @deprecated 6.3.0 Use WP_Duotone::render_duotone_support() instead.
       
  5225  *
       
  5226  * @access private
       
  5227  *
       
  5228  * @param string $block_content Rendered block content.
       
  5229  * @param array  $block         Block object.
       
  5230  * @return string Filtered block content.
       
  5231  */
       
  5232 function wp_render_duotone_support( $block_content, $block ) {
       
  5233 	_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::render_duotone_support()' );
       
  5234 	$wp_block = new WP_Block( $block );
       
  5235 	return WP_Duotone::render_duotone_support( $block_content, $block, $wp_block );
       
  5236 }
       
  5237 
       
  5238 /**
       
  5239  * Returns a string containing the SVGs to be referenced as filters (duotone).
       
  5240  *
       
  5241  * @since 5.9.1
       
  5242  * @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
       
  5243  *
       
  5244  * @return string
       
  5245  */
       
  5246 function wp_get_global_styles_svg_filters() {
       
  5247 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  5248 
       
  5249 	/*
       
  5250 	 * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
       
  5251 	 * developer's workflow.
       
  5252 	 */
       
  5253 	$can_use_cached = ! wp_is_development_mode( 'theme' );
       
  5254 	$cache_group    = 'theme_json';
       
  5255 	$cache_key      = 'wp_get_global_styles_svg_filters';
       
  5256 	if ( $can_use_cached ) {
       
  5257 		$cached = wp_cache_get( $cache_key, $cache_group );
       
  5258 		if ( $cached ) {
       
  5259 			return $cached;
       
  5260 		}
       
  5261 	}
       
  5262 
       
  5263 	$supports_theme_json = wp_theme_has_theme_json();
       
  5264 
       
  5265 	$origins = array( 'default', 'theme', 'custom' );
       
  5266 	if ( ! $supports_theme_json ) {
       
  5267 		$origins = array( 'default' );
       
  5268 	}
       
  5269 
       
  5270 	$tree = WP_Theme_JSON_Resolver::get_merged_data();
       
  5271 	$svgs = $tree->get_svg_filters( $origins );
       
  5272 
       
  5273 	if ( $can_use_cached ) {
       
  5274 		wp_cache_set( $cache_key, $svgs, $cache_group );
       
  5275 	}
       
  5276 
       
  5277 	return $svgs;
       
  5278 }
       
  5279 
       
  5280 /**
       
  5281  * Renders the SVG filters supplied by theme.json.
       
  5282  *
       
  5283  * Note that this doesn't render the per-block user-defined
       
  5284  * filters which are handled by wp_render_duotone_support,
       
  5285  * but it should be rendered before the filtered content
       
  5286  * in the body to satisfy Safari's rendering quirks.
       
  5287  *
       
  5288  * @since 5.9.1
       
  5289  * @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
       
  5290  */
       
  5291 function wp_global_styles_render_svg_filters() {
       
  5292 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  5293 
       
  5294 	/*
       
  5295 	 * When calling via the in_admin_header action, we only want to render the
       
  5296 	 * SVGs on block editor pages.
       
  5297 	 */
       
  5298 	if (
       
  5299 		is_admin() &&
       
  5300 		! get_current_screen()->is_block_editor()
       
  5301 	) {
       
  5302 		return;
       
  5303 	}
       
  5304 
       
  5305 	$filters = wp_get_global_styles_svg_filters();
       
  5306 	if ( ! empty( $filters ) ) {
       
  5307 		echo $filters;
       
  5308 	}
       
  5309 }
       
  5310 
       
  5311 /**
       
  5312  * Build an array with CSS classes and inline styles defining the colors
       
  5313  * which will be applied to the navigation markup in the front-end.
       
  5314  *
       
  5315  * @since 5.9.0
       
  5316  * @deprecated 6.3.0 This was removed from the Navigation Submenu block in favour of `wp_apply_colors_support()`.
       
  5317  *                   `wp_apply_colors_support()` returns an array with similar class and style values,
       
  5318  *                   but with different keys: `class` and `style`.
       
  5319  *
       
  5320  * @param  array $context     Navigation block context.
       
  5321  * @param  array $attributes  Block attributes.
       
  5322  * @param  bool  $is_sub_menu Whether the block is a sub-menu.
       
  5323  * @return array Colors CSS classes and inline styles.
       
  5324  */
       
  5325 function block_core_navigation_submenu_build_css_colors( $context, $attributes, $is_sub_menu = false ) {
       
  5326 	_deprecated_function( __FUNCTION__, '6.3.0' );
       
  5327 	$colors = array(
       
  5328 		'css_classes'   => array(),
       
  5329 		'inline_styles' => '',
       
  5330 	);
       
  5331 
       
  5332 	// Text color.
       
  5333 	$named_text_color  = null;
       
  5334 	$custom_text_color = null;
       
  5335 
       
  5336 	if ( $is_sub_menu && array_key_exists( 'customOverlayTextColor', $context ) ) {
       
  5337 		$custom_text_color = $context['customOverlayTextColor'];
       
  5338 	} elseif ( $is_sub_menu && array_key_exists( 'overlayTextColor', $context ) ) {
       
  5339 		$named_text_color = $context['overlayTextColor'];
       
  5340 	} elseif ( array_key_exists( 'customTextColor', $context ) ) {
       
  5341 		$custom_text_color = $context['customTextColor'];
       
  5342 	} elseif ( array_key_exists( 'textColor', $context ) ) {
       
  5343 		$named_text_color = $context['textColor'];
       
  5344 	} elseif ( isset( $context['style']['color']['text'] ) ) {
       
  5345 		$custom_text_color = $context['style']['color']['text'];
       
  5346 	}
       
  5347 
       
  5348 	// If has text color.
       
  5349 	if ( ! is_null( $named_text_color ) ) {
       
  5350 		// Add the color class.
       
  5351 		array_push( $colors['css_classes'], 'has-text-color', sprintf( 'has-%s-color', $named_text_color ) );
       
  5352 	} elseif ( ! is_null( $custom_text_color ) ) {
       
  5353 		// Add the custom color inline style.
       
  5354 		$colors['css_classes'][]  = 'has-text-color';
       
  5355 		$colors['inline_styles'] .= sprintf( 'color: %s;', $custom_text_color );
       
  5356 	}
       
  5357 
       
  5358 	// Background color.
       
  5359 	$named_background_color  = null;
       
  5360 	$custom_background_color = null;
       
  5361 
       
  5362 	if ( $is_sub_menu && array_key_exists( 'customOverlayBackgroundColor', $context ) ) {
       
  5363 		$custom_background_color = $context['customOverlayBackgroundColor'];
       
  5364 	} elseif ( $is_sub_menu && array_key_exists( 'overlayBackgroundColor', $context ) ) {
       
  5365 		$named_background_color = $context['overlayBackgroundColor'];
       
  5366 	} elseif ( array_key_exists( 'customBackgroundColor', $context ) ) {
       
  5367 		$custom_background_color = $context['customBackgroundColor'];
       
  5368 	} elseif ( array_key_exists( 'backgroundColor', $context ) ) {
       
  5369 		$named_background_color = $context['backgroundColor'];
       
  5370 	} elseif ( isset( $context['style']['color']['background'] ) ) {
       
  5371 		$custom_background_color = $context['style']['color']['background'];
       
  5372 	}
       
  5373 
       
  5374 	// If has background color.
       
  5375 	if ( ! is_null( $named_background_color ) ) {
       
  5376 		// Add the background-color class.
       
  5377 		array_push( $colors['css_classes'], 'has-background', sprintf( 'has-%s-background-color', $named_background_color ) );
       
  5378 	} elseif ( ! is_null( $custom_background_color ) ) {
       
  5379 		// Add the custom background-color inline style.
       
  5380 		$colors['css_classes'][]  = 'has-background';
       
  5381 		$colors['inline_styles'] .= sprintf( 'background-color: %s;', $custom_background_color );
       
  5382 	}
       
  5383 
       
  5384 	return $colors;
       
  5385 }
       
  5386 
       
  5387 /**
       
  5388  * Runs the theme.json webfonts handler.
       
  5389  *
       
  5390  * Using `WP_Theme_JSON_Resolver`, it gets the fonts defined
       
  5391  * in the `theme.json` for the current selection and style
       
  5392  * variations, validates the font-face properties, generates
       
  5393  * the '@font-face' style declarations, and then enqueues the
       
  5394  * styles for both the editor and front-end.
       
  5395  *
       
  5396  * Design Notes:
       
  5397  * This is not a public API, but rather an internal handler.
       
  5398  * A future public Webfonts API will replace this stopgap code.
       
  5399  *
       
  5400  * This code design is intentional.
       
  5401  *    a. It hides the inner-workings.
       
  5402  *    b. It does not expose API ins or outs for consumption.
       
  5403  *    c. It only works with a theme's `theme.json`.
       
  5404  *
       
  5405  * Why?
       
  5406  *    a. To avoid backwards-compatibility issues when
       
  5407  *       the Webfonts API is introduced in Core.
       
  5408  *    b. To make `fontFace` declarations in `theme.json` work.
       
  5409  *
       
  5410  * @link  https://github.com/WordPress/gutenberg/issues/40472
       
  5411  *
       
  5412  * @since 6.0.0
       
  5413  * @deprecated 6.4.0 Use wp_print_font_faces() instead.
       
  5414  * @access private
       
  5415  */
       
  5416 function _wp_theme_json_webfonts_handler() {
       
  5417 	_deprecated_function( __FUNCTION__, '6.4.0', 'wp_print_font_faces' );
       
  5418 
       
  5419 	// Block themes are unavailable during installation.
       
  5420 	if ( wp_installing() ) {
       
  5421 		return;
       
  5422 	}
       
  5423 
       
  5424 	if ( ! wp_theme_has_theme_json() ) {
       
  5425 		return;
       
  5426 	}
       
  5427 
       
  5428 	// Webfonts to be processed.
       
  5429 	$registered_webfonts = array();
       
  5430 
       
  5431 	/**
       
  5432 	 * Gets the webfonts from theme.json.
       
  5433 	 *
       
  5434 	 * @since 6.0.0
       
  5435 	 *
       
  5436 	 * @return array Array of defined webfonts.
       
  5437 	 */
       
  5438 	$fn_get_webfonts_from_theme_json = static function() {
       
  5439 		// Get settings from theme.json.
       
  5440 		$settings = WP_Theme_JSON_Resolver::get_merged_data()->get_settings();
       
  5441 
       
  5442 		// If in the editor, add webfonts defined in variations.
       
  5443 		if ( is_admin() || wp_is_rest_endpoint() ) {
       
  5444 			$variations = WP_Theme_JSON_Resolver::get_style_variations();
       
  5445 			foreach ( $variations as $variation ) {
       
  5446 				// Skip if fontFamilies are not defined in the variation.
       
  5447 				if ( empty( $variation['settings']['typography']['fontFamilies'] ) ) {
       
  5448 					continue;
       
  5449 				}
       
  5450 
       
  5451 				// Initialize the array structure.
       
  5452 				if ( empty( $settings['typography'] ) ) {
       
  5453 					$settings['typography'] = array();
       
  5454 				}
       
  5455 				if ( empty( $settings['typography']['fontFamilies'] ) ) {
       
  5456 					$settings['typography']['fontFamilies'] = array();
       
  5457 				}
       
  5458 				if ( empty( $settings['typography']['fontFamilies']['theme'] ) ) {
       
  5459 					$settings['typography']['fontFamilies']['theme'] = array();
       
  5460 				}
       
  5461 
       
  5462 				// Combine variations with settings. Remove duplicates.
       
  5463 				$settings['typography']['fontFamilies']['theme'] = array_merge( $settings['typography']['fontFamilies']['theme'], $variation['settings']['typography']['fontFamilies']['theme'] );
       
  5464 				$settings['typography']['fontFamilies']          = array_unique( $settings['typography']['fontFamilies'] );
       
  5465 			}
       
  5466 		}
       
  5467 
       
  5468 		// Bail out early if there are no settings for webfonts.
       
  5469 		if ( empty( $settings['typography']['fontFamilies'] ) ) {
       
  5470 			return array();
       
  5471 		}
       
  5472 
       
  5473 		$webfonts = array();
       
  5474 
       
  5475 		// Look for fontFamilies.
       
  5476 		foreach ( $settings['typography']['fontFamilies'] as $font_families ) {
       
  5477 			foreach ( $font_families as $font_family ) {
       
  5478 
       
  5479 				// Skip if fontFace is not defined.
       
  5480 				if ( empty( $font_family['fontFace'] ) ) {
       
  5481 					continue;
       
  5482 				}
       
  5483 
       
  5484 				// Skip if fontFace is not an array of webfonts.
       
  5485 				if ( ! is_array( $font_family['fontFace'] ) ) {
       
  5486 					continue;
       
  5487 				}
       
  5488 
       
  5489 				$webfonts = array_merge( $webfonts, $font_family['fontFace'] );
       
  5490 			}
       
  5491 		}
       
  5492 
       
  5493 		return $webfonts;
       
  5494 	};
       
  5495 
       
  5496 	/**
       
  5497 	 * Transforms each 'src' into an URI by replacing 'file:./'
       
  5498 	 * placeholder from theme.json.
       
  5499 	 *
       
  5500 	 * The absolute path to the webfont file(s) cannot be defined in
       
  5501 	 * theme.json. `file:./` is the placeholder which is replaced by
       
  5502 	 * the theme's URL path to the theme's root.
       
  5503 	 *
       
  5504 	 * @since 6.0.0
       
  5505 	 *
       
  5506 	 * @param array $src Webfont file(s) `src`.
       
  5507 	 * @return array Webfont's `src` in URI.
       
  5508 	 */
       
  5509 	$fn_transform_src_into_uri = static function( array $src ) {
       
  5510 		foreach ( $src as $key => $url ) {
       
  5511 			// Tweak the URL to be relative to the theme root.
       
  5512 			if ( ! str_starts_with( $url, 'file:./' ) ) {
       
  5513 				continue;
       
  5514 			}
       
  5515 
       
  5516 			$src[ $key ] = get_theme_file_uri( str_replace( 'file:./', '', $url ) );
       
  5517 		}
       
  5518 
       
  5519 		return $src;
       
  5520 	};
       
  5521 
       
  5522 	/**
       
  5523 	 * Converts the font-face properties (i.e. keys) into kebab-case.
       
  5524 	 *
       
  5525 	 * @since 6.0.0
       
  5526 	 *
       
  5527 	 * @param array $font_face Font face to convert.
       
  5528 	 * @return array Font faces with each property in kebab-case format.
       
  5529 	 */
       
  5530 	$fn_convert_keys_to_kebab_case = static function( array $font_face ) {
       
  5531 		foreach ( $font_face as $property => $value ) {
       
  5532 			$kebab_case               = _wp_to_kebab_case( $property );
       
  5533 			$font_face[ $kebab_case ] = $value;
       
  5534 			if ( $kebab_case !== $property ) {
       
  5535 				unset( $font_face[ $property ] );
       
  5536 			}
       
  5537 		}
       
  5538 
       
  5539 		return $font_face;
       
  5540 	};
       
  5541 
       
  5542 	/**
       
  5543 	 * Validates a webfont.
       
  5544 	 *
       
  5545 	 * @since 6.0.0
       
  5546 	 *
       
  5547 	 * @param array $webfont The webfont arguments.
       
  5548 	 * @return array|false The validated webfont arguments, or false if the webfont is invalid.
       
  5549 	 */
       
  5550 	$fn_validate_webfont = static function( $webfont ) {
       
  5551 		$webfont = wp_parse_args(
       
  5552 				$webfont,
       
  5553 				array(
       
  5554 						'font-family'  => '',
       
  5555 						'font-style'   => 'normal',
       
  5556 						'font-weight'  => '400',
       
  5557 						'font-display' => 'fallback',
       
  5558 						'src'          => array(),
       
  5559 				)
       
  5560 		);
       
  5561 
       
  5562 		// Check the font-family.
       
  5563 		if ( empty( $webfont['font-family'] ) || ! is_string( $webfont['font-family'] ) ) {
       
  5564 			trigger_error( __( 'Webfont font family must be a non-empty string.' ) );
       
  5565 
       
  5566 			return false;
       
  5567 		}
       
  5568 
       
  5569 		// Check that the `src` property is defined and a valid type.
       
  5570 		if ( empty( $webfont['src'] ) || ( ! is_string( $webfont['src'] ) && ! is_array( $webfont['src'] ) ) ) {
       
  5571 			trigger_error( __( 'Webfont src must be a non-empty string or an array of strings.' ) );
       
  5572 
       
  5573 			return false;
       
  5574 		}
       
  5575 
       
  5576 		// Validate the `src` property.
       
  5577 		foreach ( (array) $webfont['src'] as $src ) {
       
  5578 			if ( ! is_string( $src ) || '' === trim( $src ) ) {
       
  5579 				trigger_error( __( 'Each webfont src must be a non-empty string.' ) );
       
  5580 
       
  5581 				return false;
       
  5582 			}
       
  5583 		}
       
  5584 
       
  5585 		// Check the font-weight.
       
  5586 		if ( ! is_string( $webfont['font-weight'] ) && ! is_int( $webfont['font-weight'] ) ) {
       
  5587 			trigger_error( __( 'Webfont font weight must be a properly formatted string or integer.' ) );
       
  5588 
       
  5589 			return false;
       
  5590 		}
       
  5591 
       
  5592 		// Check the font-display.
       
  5593 		if ( ! in_array( $webfont['font-display'], array( 'auto', 'block', 'fallback', 'optional', 'swap' ), true ) ) {
       
  5594 			$webfont['font-display'] = 'fallback';
       
  5595 		}
       
  5596 
       
  5597 		$valid_props = array(
       
  5598 				'ascend-override',
       
  5599 				'descend-override',
       
  5600 				'font-display',
       
  5601 				'font-family',
       
  5602 				'font-stretch',
       
  5603 				'font-style',
       
  5604 				'font-weight',
       
  5605 				'font-variant',
       
  5606 				'font-feature-settings',
       
  5607 				'font-variation-settings',
       
  5608 				'line-gap-override',
       
  5609 				'size-adjust',
       
  5610 				'src',
       
  5611 				'unicode-range',
       
  5612 		);
       
  5613 
       
  5614 		foreach ( $webfont as $prop => $value ) {
       
  5615 			if ( ! in_array( $prop, $valid_props, true ) ) {
       
  5616 				unset( $webfont[ $prop ] );
       
  5617 			}
       
  5618 		}
       
  5619 
       
  5620 		return $webfont;
       
  5621 	};
       
  5622 
       
  5623 	/**
       
  5624 	 * Registers webfonts declared in theme.json.
       
  5625 	 *
       
  5626 	 * @since 6.0.0
       
  5627 	 *
       
  5628 	 * @uses $registered_webfonts To access and update the registered webfonts registry (passed by reference).
       
  5629 	 * @uses $fn_get_webfonts_from_theme_json To run the function that gets the webfonts from theme.json.
       
  5630 	 * @uses $fn_convert_keys_to_kebab_case To run the function that converts keys into kebab-case.
       
  5631 	 * @uses $fn_validate_webfont To run the function that validates each font-face (webfont) from theme.json.
       
  5632 	 */
       
  5633 	$fn_register_webfonts = static function() use ( &$registered_webfonts, $fn_get_webfonts_from_theme_json, $fn_convert_keys_to_kebab_case, $fn_validate_webfont, $fn_transform_src_into_uri ) {
       
  5634 		$registered_webfonts = array();
       
  5635 
       
  5636 		foreach ( $fn_get_webfonts_from_theme_json() as $webfont ) {
       
  5637 			if ( ! is_array( $webfont ) ) {
       
  5638 				continue;
       
  5639 			}
       
  5640 
       
  5641 			$webfont = $fn_convert_keys_to_kebab_case( $webfont );
       
  5642 
       
  5643 			$webfont = $fn_validate_webfont( $webfont );
       
  5644 
       
  5645 			$webfont['src'] = $fn_transform_src_into_uri( (array) $webfont['src'] );
       
  5646 
       
  5647 			// Skip if not valid.
       
  5648 			if ( empty( $webfont ) ) {
       
  5649 				continue;
       
  5650 			}
       
  5651 
       
  5652 			$registered_webfonts[] = $webfont;
       
  5653 		}
       
  5654 	};
       
  5655 
       
  5656 	/**
       
  5657 	 * Orders 'src' items to optimize for browser support.
       
  5658 	 *
       
  5659 	 * @since 6.0.0
       
  5660 	 *
       
  5661 	 * @param array $webfont Webfont to process.
       
  5662 	 * @return array Ordered `src` items.
       
  5663 	 */
       
  5664 	$fn_order_src = static function( array $webfont ) {
       
  5665 		$src         = array();
       
  5666 		$src_ordered = array();
       
  5667 
       
  5668 		foreach ( $webfont['src'] as $url ) {
       
  5669 			// Add data URIs first.
       
  5670 			if ( str_starts_with( trim( $url ), 'data:' ) ) {
       
  5671 				$src_ordered[] = array(
       
  5672 						'url'    => $url,
       
  5673 						'format' => 'data',
       
  5674 				);
       
  5675 				continue;
       
  5676 			}
       
  5677 			$format         = pathinfo( $url, PATHINFO_EXTENSION );
       
  5678 			$src[ $format ] = $url;
       
  5679 		}
       
  5680 
       
  5681 		// Add woff2.
       
  5682 		if ( ! empty( $src['woff2'] ) ) {
       
  5683 			$src_ordered[] = array(
       
  5684 					'url'    => sanitize_url( $src['woff2'] ),
       
  5685 					'format' => 'woff2',
       
  5686 			);
       
  5687 		}
       
  5688 
       
  5689 		// Add woff.
       
  5690 		if ( ! empty( $src['woff'] ) ) {
       
  5691 			$src_ordered[] = array(
       
  5692 					'url'    => sanitize_url( $src['woff'] ),
       
  5693 					'format' => 'woff',
       
  5694 			);
       
  5695 		}
       
  5696 
       
  5697 		// Add ttf.
       
  5698 		if ( ! empty( $src['ttf'] ) ) {
       
  5699 			$src_ordered[] = array(
       
  5700 					'url'    => sanitize_url( $src['ttf'] ),
       
  5701 					'format' => 'truetype',
       
  5702 			);
       
  5703 		}
       
  5704 
       
  5705 		// Add eot.
       
  5706 		if ( ! empty( $src['eot'] ) ) {
       
  5707 			$src_ordered[] = array(
       
  5708 					'url'    => sanitize_url( $src['eot'] ),
       
  5709 					'format' => 'embedded-opentype',
       
  5710 			);
       
  5711 		}
       
  5712 
       
  5713 		// Add otf.
       
  5714 		if ( ! empty( $src['otf'] ) ) {
       
  5715 			$src_ordered[] = array(
       
  5716 					'url'    => sanitize_url( $src['otf'] ),
       
  5717 					'format' => 'opentype',
       
  5718 			);
       
  5719 		}
       
  5720 		$webfont['src'] = $src_ordered;
       
  5721 
       
  5722 		return $webfont;
       
  5723 	};
       
  5724 
       
  5725 	/**
       
  5726 	 * Compiles the 'src' into valid CSS.
       
  5727 	 *
       
  5728 	 * @since 6.0.0
       
  5729 	 * @since 6.2.0 Removed local() CSS.
       
  5730 	 *
       
  5731 	 * @param string $font_family Font family.
       
  5732 	 * @param array  $value       Value to process.
       
  5733 	 * @return string The CSS.
       
  5734 	 */
       
  5735 	$fn_compile_src = static function( $font_family, array $value ) {
       
  5736 		$src = '';
       
  5737 
       
  5738 		foreach ( $value as $item ) {
       
  5739 			$src .= ( 'data' === $item['format'] )
       
  5740 					? ", url({$item['url']})"
       
  5741 					: ", url('{$item['url']}') format('{$item['format']}')";
       
  5742 		}
       
  5743 
       
  5744 		$src = ltrim( $src, ', ' );
       
  5745 
       
  5746 		return $src;
       
  5747 	};
       
  5748 
       
  5749 	/**
       
  5750 	 * Compiles the font variation settings.
       
  5751 	 *
       
  5752 	 * @since 6.0.0
       
  5753 	 *
       
  5754 	 * @param array $font_variation_settings Array of font variation settings.
       
  5755 	 * @return string The CSS.
       
  5756 	 */
       
  5757 	$fn_compile_variations = static function( array $font_variation_settings ) {
       
  5758 		$variations = '';
       
  5759 
       
  5760 		foreach ( $font_variation_settings as $key => $value ) {
       
  5761 			$variations .= "$key $value";
       
  5762 		}
       
  5763 
       
  5764 		return $variations;
       
  5765 	};
       
  5766 
       
  5767 	/**
       
  5768 	 * Builds the font-family's CSS.
       
  5769 	 *
       
  5770 	 * @since 6.0.0
       
  5771 	 *
       
  5772 	 * @uses $fn_compile_src To run the function that compiles the src.
       
  5773 	 * @uses $fn_compile_variations To run the function that compiles the variations.
       
  5774 	 *
       
  5775 	 * @param array $webfont Webfont to process.
       
  5776 	 * @return string This font-family's CSS.
       
  5777 	 */
       
  5778 	$fn_build_font_face_css = static function( array $webfont ) use ( $fn_compile_src, $fn_compile_variations ) {
       
  5779 		$css = '';
       
  5780 
       
  5781 		// Wrap font-family in quotes if it contains spaces.
       
  5782 		if (
       
  5783 				str_contains( $webfont['font-family'], ' ' ) &&
       
  5784 				! str_contains( $webfont['font-family'], '"' ) &&
       
  5785 				! str_contains( $webfont['font-family'], "'" )
       
  5786 		) {
       
  5787 			$webfont['font-family'] = '"' . $webfont['font-family'] . '"';
       
  5788 		}
       
  5789 
       
  5790 		foreach ( $webfont as $key => $value ) {
       
  5791 			/*
       
  5792 			 * Skip "provider", since it's for internal API use,
       
  5793 			 * and not a valid CSS property.
       
  5794 			 */
       
  5795 			if ( 'provider' === $key ) {
       
  5796 				continue;
       
  5797 			}
       
  5798 
       
  5799 			// Compile the "src" parameter.
       
  5800 			if ( 'src' === $key ) {
       
  5801 				$value = $fn_compile_src( $webfont['font-family'], $value );
       
  5802 			}
       
  5803 
       
  5804 			// If font-variation-settings is an array, convert it to a string.
       
  5805 			if ( 'font-variation-settings' === $key && is_array( $value ) ) {
       
  5806 				$value = $fn_compile_variations( $value );
       
  5807 			}
       
  5808 
       
  5809 			if ( ! empty( $value ) ) {
       
  5810 				$css .= "$key:$value;";
       
  5811 			}
       
  5812 		}
       
  5813 
       
  5814 		return $css;
       
  5815 	};
       
  5816 
       
  5817 	/**
       
  5818 	 * Gets the '@font-face' CSS styles for locally-hosted font files.
       
  5819 	 *
       
  5820 	 * @since 6.0.0
       
  5821 	 *
       
  5822 	 * @uses $registered_webfonts To access and update the registered webfonts registry (passed by reference).
       
  5823 	 * @uses $fn_order_src To run the function that orders the src.
       
  5824 	 * @uses $fn_build_font_face_css To run the function that builds the font-face CSS.
       
  5825 	 *
       
  5826 	 * @return string The `@font-face` CSS.
       
  5827 	 */
       
  5828 	$fn_get_css = static function() use ( &$registered_webfonts, $fn_order_src, $fn_build_font_face_css ) {
       
  5829 		$css = '';
       
  5830 
       
  5831 		foreach ( $registered_webfonts as $webfont ) {
       
  5832 			// Order the webfont's `src` items to optimize for browser support.
       
  5833 			$webfont = $fn_order_src( $webfont );
       
  5834 
       
  5835 			// Build the @font-face CSS for this webfont.
       
  5836 			$css .= '@font-face{' . $fn_build_font_face_css( $webfont ) . '}';
       
  5837 		}
       
  5838 
       
  5839 		return $css;
       
  5840 	};
       
  5841 
       
  5842 	/**
       
  5843 	 * Generates and enqueues webfonts styles.
       
  5844 	 *
       
  5845 	 * @since 6.0.0
       
  5846 	 *
       
  5847 	 * @uses $fn_get_css To run the function that gets the CSS.
       
  5848 	 */
       
  5849 	$fn_generate_and_enqueue_styles = static function() use ( $fn_get_css ) {
       
  5850 		// Generate the styles.
       
  5851 		$styles = $fn_get_css();
       
  5852 
       
  5853 		// Bail out if there are no styles to enqueue.
       
  5854 		if ( '' === $styles ) {
       
  5855 			return;
       
  5856 		}
       
  5857 
       
  5858 		// Enqueue the stylesheet.
       
  5859 		wp_register_style( 'wp-webfonts', '' );
       
  5860 		wp_enqueue_style( 'wp-webfonts' );
       
  5861 
       
  5862 		// Add the styles to the stylesheet.
       
  5863 		wp_add_inline_style( 'wp-webfonts', $styles );
       
  5864 	};
       
  5865 
       
  5866 	/**
       
  5867 	 * Generates and enqueues editor styles.
       
  5868 	 *
       
  5869 	 * @since 6.0.0
       
  5870 	 *
       
  5871 	 * @uses $fn_get_css To run the function that gets the CSS.
       
  5872 	 */
       
  5873 	$fn_generate_and_enqueue_editor_styles = static function() use ( $fn_get_css ) {
       
  5874 		// Generate the styles.
       
  5875 		$styles = $fn_get_css();
       
  5876 
       
  5877 		// Bail out if there are no styles to enqueue.
       
  5878 		if ( '' === $styles ) {
       
  5879 			return;
       
  5880 		}
       
  5881 
       
  5882 		wp_add_inline_style( 'wp-block-library', $styles );
       
  5883 	};
       
  5884 
       
  5885 	add_action( 'wp_loaded', $fn_register_webfonts );
       
  5886 	add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles );
       
  5887 	add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
       
  5888 }
       
  5889 
       
  5890 /**
       
  5891  * Prints the CSS in the embed iframe header.
       
  5892  *
       
  5893  * @since 4.4.0
       
  5894  * @deprecated 6.4.0 Use wp_enqueue_embed_styles() instead.
       
  5895  */
       
  5896 function print_embed_styles() {
       
  5897 	_deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_embed_styles' );
       
  5898 
       
  5899 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
       
  5900 	$suffix    = SCRIPT_DEBUG ? '' : '.min';
       
  5901 	?>
       
  5902 	<style<?php echo $type_attr; ?>>
       
  5903 		<?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?>
       
  5904 	</style>
       
  5905 	<?php
       
  5906 }
       
  5907 
       
  5908 /**
       
  5909  * Prints the important emoji-related styles.
       
  5910  *
       
  5911  * @since 4.2.0
       
  5912  * @deprecated 6.4.0 Use wp_enqueue_emoji_styles() instead.
       
  5913  */
       
  5914 function print_emoji_styles() {
       
  5915 	_deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_emoji_styles' );
       
  5916 	static $printed = false;
       
  5917 
       
  5918 	if ( $printed ) {
       
  5919 		return;
       
  5920 	}
       
  5921 
       
  5922 	$printed = true;
       
  5923 
       
  5924 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
       
  5925 	?>
       
  5926 	<style<?php echo $type_attr; ?>>
       
  5927 	img.wp-smiley,
       
  5928 	img.emoji {
       
  5929 		display: inline !important;
       
  5930 		border: none !important;
       
  5931 		box-shadow: none !important;
       
  5932 		height: 1em !important;
       
  5933 		width: 1em !important;
       
  5934 		margin: 0 0.07em !important;
       
  5935 		vertical-align: -0.1em !important;
       
  5936 		background: none !important;
       
  5937 		padding: 0 !important;
       
  5938 	}
       
  5939 	</style>
       
  5940 	<?php
       
  5941 }
       
  5942 
       
  5943 /**
       
  5944  * Prints style and scripts for the admin bar.
       
  5945  *
       
  5946  * @since 3.1.0
       
  5947  * @deprecated 6.4.0 Use wp_enqueue_admin_bar_header_styles() instead.
       
  5948  */
       
  5949 function wp_admin_bar_header() {
       
  5950 	_deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_header_styles' );
       
  5951 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
       
  5952 	?>
       
  5953 	<style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style>
       
  5954 	<?php
       
  5955 }
       
  5956 
       
  5957 /**
       
  5958  * Prints default admin bar callback.
       
  5959  *
       
  5960  * @since 3.1.0
       
  5961  * @deprecated 6.4.0 Use wp_enqueue_admin_bar_bump_styles() instead.
       
  5962  */
       
  5963 function _admin_bar_bump_cb() {
       
  5964 	_deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_bump_styles' );
       
  5965 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
       
  5966 	?>
       
  5967 	<style<?php echo $type_attr; ?> media="screen">
       
  5968 	html { margin-top: 32px !important; }
       
  5969 	@media screen and ( max-width: 782px ) {
       
  5970 	  html { margin-top: 46px !important; }
       
  5971 	}
       
  5972 	</style>
       
  5973 	<?php
       
  5974 }
       
  5975 
       
  5976 /**
       
  5977  * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.
       
  5978  *
       
  5979  * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained.
       
  5980  *
       
  5981  * @since 5.7.0
       
  5982  * @deprecated 6.4.0 The `wp_update_https_detection_errors()` function is no longer used and has been replaced by
       
  5983  *                   `wp_get_https_detection_errors()`. Previously the function was called by a regular Cron hook to
       
  5984  *                    update the `https_detection_errors` option, but this is no longer necessary as the errors are
       
  5985  *                    retrieved directly in Site Health and no longer used outside of Site Health.
       
  5986  * @access private
       
  5987  */
       
  5988 function wp_update_https_detection_errors() {
       
  5989 	_deprecated_function( __FUNCTION__, '6.4.0' );
       
  5990 
       
  5991 	/**
       
  5992 	 * Short-circuits the process of detecting errors related to HTTPS support.
       
  5993 	 *
       
  5994 	 * Returning a `WP_Error` from the filter will effectively short-circuit the default logic of trying a remote
       
  5995 	 * request to the site over HTTPS, storing the errors array from the returned `WP_Error` instead.
       
  5996 	 *
       
  5997 	 * @since 5.7.0
       
  5998 	 * @deprecated 6.4.0 The `wp_update_https_detection_errors` filter is no longer used and has been replaced by `pre_wp_get_https_detection_errors`.
       
  5999 	 *
       
  6000 	 * @param null|WP_Error $pre Error object to short-circuit detection,
       
  6001 	 *                           or null to continue with the default behavior.
       
  6002 	 */
       
  6003 	$support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null );
       
  6004 	if ( is_wp_error( $support_errors ) ) {
       
  6005 		update_option( 'https_detection_errors', $support_errors->errors );
       
  6006 		return;
       
  6007 	}
       
  6008 
       
  6009 	$support_errors = wp_get_https_detection_errors();
       
  6010 
       
  6011 	update_option( 'https_detection_errors', $support_errors );
       
  6012 }
       
  6013 
       
  6014 /**
       
  6015  * Adds `decoding` attribute to an `img` HTML tag.
       
  6016  *
       
  6017  * The `decoding` attribute allows developers to indicate whether the
       
  6018  * browser can decode the image off the main thread (`async`), on the
       
  6019  * main thread (`sync`) or as determined by the browser (`auto`).
       
  6020  *
       
  6021  * By default WordPress adds `decoding="async"` to images but developers
       
  6022  * can use the {@see 'wp_img_tag_add_decoding_attr'} filter to modify this
       
  6023  * to remove the attribute or set it to another accepted value.
       
  6024  *
       
  6025  * @since 6.1.0
       
  6026  * @deprecated 6.4.0 Use wp_img_tag_add_loading_optimization_attrs() instead.
       
  6027  * @see wp_img_tag_add_loading_optimization_attrs()
       
  6028  *
       
  6029  * @param string $image   The HTML `img` tag where the attribute should be added.
       
  6030  * @param string $context Additional context to pass to the filters.
       
  6031  * @return string Converted `img` tag with `decoding` attribute added.
       
  6032  */
       
  6033 function wp_img_tag_add_decoding_attr( $image, $context ) {
       
  6034 	_deprecated_function( __FUNCTION__, '6.4.0', 'wp_img_tag_add_loading_optimization_attrs()' );
       
  6035 
       
  6036 	/*
       
  6037 	 * Only apply the decoding attribute to images that have a src attribute that
       
  6038 	 * starts with a double quote, ensuring escaped JSON is also excluded.
       
  6039 	 */
       
  6040 	if ( ! str_contains( $image, ' src="' ) ) {
       
  6041 		return $image;
       
  6042 	}
       
  6043 
       
  6044 	/** This action is documented in wp-includes/media.php */
       
  6045 	$value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );
       
  6046 
       
  6047 	if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
       
  6048 		$image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
       
  6049 	}
       
  6050 
       
  6051 	return $image;
       
  6052 }
       
  6053 
       
  6054 /**
       
  6055  * Parses wp_template content and injects the active theme's
       
  6056  * stylesheet as a theme attribute into each wp_template_part
       
  6057  *
       
  6058  * @since 5.9.0
       
  6059  * @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_inject_theme_attribute_in_template_part_block' ) instead.
       
  6060  * @access private
       
  6061  *
       
  6062  * @param string $template_content serialized wp_template content.
       
  6063  * @return string Updated 'wp_template' content.
       
  6064  */
       
  6065 function _inject_theme_attribute_in_block_template_content( $template_content ) {
       
  6066 	_deprecated_function(
       
  6067 		__FUNCTION__,
       
  6068 		'6.4.0',
       
  6069 		'traverse_and_serialize_blocks( parse_blocks( $template_content ), "_inject_theme_attribute_in_template_part_block" )'
       
  6070 	);
       
  6071 
       
  6072 	$has_updated_content = false;
       
  6073 	$new_content         = '';
       
  6074 	$template_blocks     = parse_blocks( $template_content );
       
  6075 
       
  6076 	$blocks = _flatten_blocks( $template_blocks );
       
  6077 	foreach ( $blocks as &$block ) {
       
  6078 		if (
       
  6079 			'core/template-part' === $block['blockName'] &&
       
  6080 			! isset( $block['attrs']['theme'] )
       
  6081 		) {
       
  6082 			$block['attrs']['theme'] = get_stylesheet();
       
  6083 			$has_updated_content     = true;
       
  6084 		}
       
  6085 	}
       
  6086 
       
  6087 	if ( $has_updated_content ) {
       
  6088 		foreach ( $template_blocks as &$block ) {
       
  6089 			$new_content .= serialize_block( $block );
       
  6090 		}
       
  6091 
       
  6092 		return $new_content;
       
  6093 	}
       
  6094 
       
  6095 	return $template_content;
       
  6096 }
       
  6097 
       
  6098 /**
       
  6099  * Parses a block template and removes the theme attribute from each template part.
       
  6100  *
       
  6101  * @since 5.9.0
       
  6102  * @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_remove_theme_attribute_from_template_part_block' ) instead.
       
  6103  * @access private
       
  6104  *
       
  6105  * @param string $template_content Serialized block template content.
       
  6106  * @return string Updated block template content.
       
  6107  */
       
  6108 function _remove_theme_attribute_in_block_template_content( $template_content ) {
       
  6109 	_deprecated_function(
       
  6110 		__FUNCTION__,
       
  6111 		'6.4.0',
       
  6112 		'traverse_and_serialize_blocks( parse_blocks( $template_content ), "_remove_theme_attribute_from_template_part_block" )'
       
  6113 	);
       
  6114 
       
  6115 	$has_updated_content = false;
       
  6116 	$new_content         = '';
       
  6117 	$template_blocks     = parse_blocks( $template_content );
       
  6118 
       
  6119 	$blocks = _flatten_blocks( $template_blocks );
       
  6120 	foreach ( $blocks as $key => $block ) {
       
  6121 		if ( 'core/template-part' === $block['blockName'] && isset( $block['attrs']['theme'] ) ) {
       
  6122 			unset( $blocks[ $key ]['attrs']['theme'] );
       
  6123 			$has_updated_content = true;
       
  6124 		}
       
  6125 	}
       
  6126 
       
  6127 	if ( ! $has_updated_content ) {
       
  6128 		return $template_content;
       
  6129 	}
       
  6130 
       
  6131 	foreach ( $template_blocks as $block ) {
       
  6132 		$new_content .= serialize_block( $block );
       
  6133 	}
       
  6134 
       
  6135 	return $new_content;
       
  6136 }
       
  6137 
       
  6138 /**
       
  6139  * Prints the skip-link script & styles.
       
  6140  *
       
  6141  * @since 5.8.0
       
  6142  * @access private
       
  6143  * @deprecated 6.4.0 Use wp_enqueue_block_template_skip_link() instead.
       
  6144  *
       
  6145  * @global string $_wp_current_template_content
       
  6146  */
       
  6147 function the_block_template_skip_link() {
       
  6148 	_deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_block_template_skip_link()' );
       
  6149 
       
  6150 	global $_wp_current_template_content;
       
  6151 
       
  6152 	// Early exit if not a block theme.
       
  6153 	if ( ! current_theme_supports( 'block-templates' ) ) {
       
  6154 		return;
       
  6155 	}
       
  6156 
       
  6157 	// Early exit if not a block template.
       
  6158 	if ( ! $_wp_current_template_content ) {
       
  6159 		return;
       
  6160 	}
       
  6161 	?>
       
  6162 
       
  6163 	<?php
       
  6164 	/**
       
  6165 	 * Print the skip-link styles.
       
  6166 	 */
       
  6167 	?>
       
  6168 	<style id="skip-link-styles">
       
  6169 		.skip-link.screen-reader-text {
       
  6170 			border: 0;
       
  6171 			clip: rect(1px,1px,1px,1px);
       
  6172 			clip-path: inset(50%);
       
  6173 			height: 1px;
       
  6174 			margin: -1px;
       
  6175 			overflow: hidden;
       
  6176 			padding: 0;
       
  6177 			position: absolute !important;
       
  6178 			width: 1px;
       
  6179 			word-wrap: normal !important;
       
  6180 		}
       
  6181 
       
  6182 		.skip-link.screen-reader-text:focus {
       
  6183 			background-color: #eee;
       
  6184 			clip: auto !important;
       
  6185 			clip-path: none;
       
  6186 			color: #444;
       
  6187 			display: block;
       
  6188 			font-size: 1em;
       
  6189 			height: auto;
       
  6190 			left: 5px;
       
  6191 			line-height: normal;
       
  6192 			padding: 15px 23px 14px;
       
  6193 			text-decoration: none;
       
  6194 			top: 5px;
       
  6195 			width: auto;
       
  6196 			z-index: 100000;
       
  6197 		}
       
  6198 	</style>
       
  6199 	<?php
       
  6200 	/**
       
  6201 	 * Print the skip-link script.
       
  6202 	 */
       
  6203 	?>
       
  6204 	<script>
       
  6205 	( function() {
       
  6206 		var skipLinkTarget = document.querySelector( 'main' ),
       
  6207 			sibling,
       
  6208 			skipLinkTargetID,
       
  6209 			skipLink;
       
  6210 
       
  6211 		// Early exit if a skip-link target can't be located.
       
  6212 		if ( ! skipLinkTarget ) {
       
  6213 			return;
       
  6214 		}
       
  6215 
       
  6216 		/*
       
  6217 		 * Get the site wrapper.
       
  6218 		 * The skip-link will be injected in the beginning of it.
       
  6219 		 */
       
  6220 		sibling = document.querySelector( '.wp-site-blocks' );
       
  6221 
       
  6222 		// Early exit if the root element was not found.
       
  6223 		if ( ! sibling ) {
       
  6224 			return;
       
  6225 		}
       
  6226 
       
  6227 		// Get the skip-link target's ID, and generate one if it doesn't exist.
       
  6228 		skipLinkTargetID = skipLinkTarget.id;
       
  6229 		if ( ! skipLinkTargetID ) {
       
  6230 			skipLinkTargetID = 'wp--skip-link--target';
       
  6231 			skipLinkTarget.id = skipLinkTargetID;
       
  6232 		}
       
  6233 
       
  6234 		// Create the skip link.
       
  6235 		skipLink = document.createElement( 'a' );
       
  6236 		skipLink.classList.add( 'skip-link', 'screen-reader-text' );
       
  6237 		skipLink.href = '#' + skipLinkTargetID;
       
  6238 		skipLink.innerHTML = '<?php /* translators: Hidden accessibility text. */ esc_html_e( 'Skip to content' ); ?>';
       
  6239 
       
  6240 		// Inject the skip link.
       
  6241 		sibling.parentElement.insertBefore( skipLink, sibling );
       
  6242 	}() );
       
  6243 	</script>
       
  6244 	<?php
       
  6245 }
       
  6246 
       
  6247 /**
       
  6248  * Ensure that the view script has the `wp-interactivity` dependency.
       
  6249  *
       
  6250  * @since 6.4.0
       
  6251  * @deprecated 6.5.0
       
  6252  */
       
  6253 function block_core_query_ensure_interactivity_dependency() {
       
  6254 	_deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
       
  6255 }
       
  6256 
       
  6257 /**
       
  6258  * Ensure that the view script has the `wp-interactivity` dependency.
       
  6259  *
       
  6260  * @since 6.4.0
       
  6261  * @deprecated 6.5.0
       
  6262  */
       
  6263 function block_core_file_ensure_interactivity_dependency() {
       
  6264 	_deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
       
  6265 }
       
  6266 
       
  6267 /**
       
  6268  * Ensures that the view script has the `wp-interactivity` dependency.
       
  6269  *
       
  6270  * @since 6.4.0
       
  6271  * @deprecated 6.5.0
       
  6272  */
       
  6273 function block_core_image_ensure_interactivity_dependency() {
       
  6274 	_deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
       
  6275 }
       
  6276 
       
  6277 /**
       
  6278  * Updates the block content with elements class names.
       
  6279  *
       
  6280  * @deprecated 6.6.0 Generation of element class name is handled via `render_block_data` filter.
       
  6281  *
       
  6282  * @since 5.8.0
       
  6283  * @since 6.4.0 Added support for button and heading element styling.
       
  6284  * @access private
       
  6285  *
       
  6286  * @param string $block_content Rendered block content.
       
  6287  * @param array  $block         Block object.
       
  6288  * @return string Filtered block content.
       
  6289  */
       
  6290 function wp_render_elements_support( $block_content, $block ) {
       
  6291 	_deprecated_function( __FUNCTION__, '6.6.0', 'wp_render_elements_class_name' );
       
  6292 	return $block_content;
       
  6293 }
       
  6294 
       
  6295 /**
       
  6296  * Processes the directives on the rendered HTML of the interactive blocks.
       
  6297  *
       
  6298  * This processes only one root interactive block at a time because the
       
  6299  * rendered HTML of that block contains the rendered HTML of all its inner
       
  6300  * blocks, including any interactive block. It does so by ignoring all the
       
  6301  * interactive inner blocks until the root interactive block is processed.
       
  6302  *
       
  6303  * @since 6.5.0
       
  6304  * @deprecated 6.6.0
       
  6305  *
       
  6306  * @param array $parsed_block The parsed block.
       
  6307  * @return array The same parsed block.
       
  6308  */
       
  6309 function wp_interactivity_process_directives_of_interactive_blocks( array $parsed_block ): array {
       
  6310 	_deprecated_function( __FUNCTION__, '6.6.0' );
       
  6311 	return $parsed_block;
       
  6312 }