run:R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
23.8 KB
2026-03-11 16:18:51
R W Run
7.8 KB
2026-03-11 16:18:52
R W Run
36.1 KB
2026-03-11 16:18:51
R W Run
11.9 KB
2026-03-11 16:18:52
R W Run
18.94 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:52
R W Run
28.6 KB
2026-03-11 16:18:51
R W Run
316 By
2026-03-11 16:18:51
R W Run
12.9 KB
2026-03-11 16:18:51
R W Run
61.02 KB
2026-03-11 16:18:52
R W Run
15 KB
2026-03-11 16:18:51
R W Run
112.05 KB
2026-03-11 16:18:51
R W Run
12.47 KB
2026-03-11 16:18:51
R W Run
15.07 KB
2026-03-11 16:18:52
R W Run
9.84 KB
2026-03-11 16:18:52
R W Run
13.17 KB
2026-03-11 16:18:52
R W Run
33.83 KB
2026-03-11 16:18:51
R W Run
42.63 KB
2026-03-11 16:18:51
R W Run
55.71 KB
2026-03-11 16:18:52
R W Run
12.53 KB
2026-03-11 16:18:51
R W Run
2.55 KB
2026-03-11 16:18:52
R W Run
28.92 KB
2026-03-11 16:18:52
R W Run
539 By
2026-03-11 16:18:51
R W Run
367 By
2026-03-11 16:18:52
R W Run
42.65 KB
2026-03-11 16:18:51
R W Run
401 By
2026-03-11 16:18:51
R W Run
6.61 KB
2026-03-11 16:18:51
R W Run
664 By
2026-03-11 16:18:52
R W Run
20.63 KB
2026-03-11 16:18:51
R W Run
2.18 KB
2026-03-11 16:18:52
R W Run
453 By
2026-03-11 16:18:52
R W Run
457 By
2026-03-11 16:18:51
R W Run
36.83 KB
2026-03-11 16:18:52
R W Run
2.41 KB
2026-03-11 16:18:52
R W Run
8.28 KB
2026-03-11 16:18:51
R W Run
13.89 KB
2026-03-11 16:18:51
R W Run
11.76 KB
2026-03-11 16:18:51
R W Run
2.65 KB
2026-03-11 16:18:51
R W Run
7.43 KB
2026-03-11 16:18:51
R W Run
17.46 KB
2026-03-11 16:18:51
R W Run
5.14 KB
2026-03-11 16:18:52
R W Run
16.7 KB
2026-03-11 16:18:51
R W Run
8.28 KB
2026-03-11 16:18:52
R W Run
2.92 KB
2026-03-11 16:18:52
R W Run
1.32 KB
2026-03-11 16:18:51
R W Run
4.6 KB
2026-03-11 16:18:52
R W Run
11.62 KB
2026-03-11 16:18:52
R W Run
2.5 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
11.25 KB
2026-03-11 16:18:52
R W Run
5.32 KB
2026-03-11 16:18:51
R W Run
10.99 KB
2026-03-11 16:18:52
R W Run
68.32 KB
2026-03-11 16:18:51
R W Run
6.34 KB
2026-03-11 16:18:51
R W Run
5.49 KB
2026-03-11 16:18:51
R W Run
1.99 KB
2026-03-11 16:18:52
R W Run
7.02 KB
2026-03-11 16:18:51
R W Run
4.91 KB
2026-03-11 16:18:52
R W Run
16.86 KB
2026-03-11 16:18:51
R W Run
24.23 KB
2026-03-11 16:18:51
R W Run
3.97 KB
2026-03-11 16:18:51
R W Run
47.66 KB
2026-03-11 16:18:51
R W Run
9.22 KB
2026-03-11 16:18:51
R W Run
25.51 KB
2026-03-11 16:18:51
R W Run
198.38 KB
2026-03-11 16:18:52
R W Run
56.65 KB
2026-03-11 16:18:51
R W Run
10.46 KB
2026-03-11 16:18:51
R W Run
10.95 KB
2026-03-11 16:18:52
R W Run
29.26 KB
2026-03-11 16:18:51
R W Run
70.91 KB
2026-03-11 16:18:52
R W Run
35.3 KB
2026-03-11 16:18:52
R W Run
16.61 KB
2026-03-11 16:18:52
R W Run
2.57 KB
2026-03-11 16:18:52
R W Run
39.83 KB
2026-03-11 16:18:51
R W Run
70.64 KB
2026-03-11 16:18:51
R W Run
15.56 KB
2026-03-11 16:18:52
R W Run
7.33 KB
2026-03-11 16:18:52
R W Run
253 By
2026-03-11 16:18:51
R W Run
7.96 KB
2026-03-11 16:18:52
R W Run
3.23 KB
2026-03-11 16:18:52
R W Run
969 By
2026-03-11 16:18:52
R W Run
16.28 KB
2026-03-11 16:18:51
R W Run
7.22 KB
2026-03-11 16:18:51
R W Run
12.95 KB
2026-03-11 16:18:51
R W Run
6.53 KB
2026-03-11 16:18:51
R W Run
3.42 KB
2026-03-11 16:18:52
R W Run
5.84 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
4.3 KB
2026-03-11 16:18:52
R W Run
2.91 KB
2026-03-11 16:18:51
R W Run
16.46 KB
2026-03-11 16:18:52
R W Run
40.6 KB
2026-03-11 16:18:51
R W Run
20.22 KB
2026-03-11 16:18:51
R W Run
36.11 KB
2026-03-11 16:18:52
R W Run
17.01 KB
2026-03-11 16:18:51
R W Run
7.27 KB
2026-03-11 16:18:52
R W Run
6.62 KB
2026-03-11 16:18:52
R W Run
16.49 KB
2026-03-11 16:18:52
R W Run
1.79 KB
2026-03-11 16:18:52
R W Run
29.82 KB
2026-03-11 16:18:51
R W Run
6.67 KB
2026-03-11 16:18:52
R W Run
8.98 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:51
R W Run
12.01 KB
2026-03-11 16:18:51
R W Run
17.11 KB
2026-03-11 16:18:51
R W Run
6.74 KB
2026-03-11 16:18:52
R W Run
30.93 KB
2026-03-11 16:18:51
R W Run
4.99 KB
2026-03-11 16:18:51
R W Run
4.25 KB
2026-03-11 16:18:51
R W Run
24.72 KB
2026-03-11 16:18:51
R W Run
29.96 KB
2026-03-11 16:18:52
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
160 KB
2026-03-11 16:18:51
R W Run
6.72 KB
2026-03-11 16:18:52
R W Run
10.92 KB
2026-03-11 16:18:51
R W Run
4.77 KB
2026-03-11 16:18:51
R W Run
3.38 KB
2026-03-11 16:18:51
R W Run
11.18 KB
2026-03-11 16:18:51
R W Run
62.19 KB
2026-03-11 16:18:51
R W Run
2.46 KB
2026-03-11 16:18:51
R W Run
9.17 KB
2026-03-11 16:18:51
R W Run
32.15 KB
2026-03-11 16:18:51
R W Run
34.05 KB
2026-03-11 16:18:52
R W Run
7.15 KB
2026-03-11 16:18:51
R W Run
3.47 KB
2026-03-11 16:18:52
R W Run
1.87 KB
2026-03-11 16:18:52
R W Run
30.91 KB
2026-03-11 16:18:51
R W Run
7.29 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:51
R W Run
12.54 KB
2026-03-11 16:18:51
R W Run
19.12 KB
2026-03-11 16:18:51
R W Run
18.12 KB
2026-03-11 16:18:52
R W Run
39.99 KB
2026-03-11 16:18:52
R W Run
5.17 KB
2026-03-11 16:18:52
R W Run
979 By
2026-03-11 16:18:51
R W Run
18.44 KB
2026-03-11 16:18:52
R W Run
10.24 KB
2026-03-11 16:18:51
R W Run
1.77 KB
2026-03-11 16:18:52
R W Run
34.9 KB
2026-03-11 16:18:51
R W Run
7.19 KB
2026-03-11 16:18:52
R W Run
160.5 KB
2026-03-11 16:18:51
R W Run
64.27 KB
2026-03-11 16:18:51
R W Run
27.95 KB
2026-03-11 16:18:51
R W Run
4.69 KB
2026-03-11 16:18:51
R W Run
2.94 KB
2026-03-11 16:18:51
R W Run
43.13 KB
2026-03-11 16:18:52
R W Run
2.25 KB
2026-03-11 16:18:52
R W Run
22.5 KB
2026-03-11 16:18:51
R W Run
13.01 KB
2026-03-11 16:18:52
R W Run
3.27 KB
2026-03-11 16:18:51
R W Run
18 KB
2026-03-11 16:18:51
R W Run
210.4 KB
2026-03-11 16:18:52
R W Run
25.86 KB
2026-03-11 16:18:52
R W Run
115.85 KB
2026-03-11 16:18:51
R W Run
373 By
2026-03-11 16:18:52
R W Run
343 By
2026-03-11 16:18:52
R W Run
338 By
2026-03-11 16:18:51
R W Run
100.73 KB
2026-03-11 16:18:52
R W Run
130.93 KB
2026-03-11 16:18:51
R W Run
19.1 KB
2026-03-11 16:18:51
R W Run
17.41 KB
2026-03-11 16:18:52
R W Run
41.98 KB
2026-03-11 16:18:52
R W Run
400 By
2026-03-11 16:18:52
R W Run
11.1 KB
2026-03-11 16:18:52
R W Run
37.02 KB
2026-03-11 16:18:51
R W Run
2.24 KB
2026-03-11 16:18:51
R W Run
188.13 KB
2026-03-11 16:18:51
R W Run
338 By
2026-03-11 16:18:51
R W Run
38 KB
2026-03-11 16:18:51
R W Run
4.02 KB
2026-03-11 16:18:52
R W Run
5.38 KB
2026-03-11 16:18:51
R W Run
3.05 KB
2026-03-11 16:18:52
R W Run
2.61 KB
2026-03-11 16:18:51
R W Run
1.16 KB
2026-03-11 16:18:52
R W Run
4.04 KB
2026-03-11 16:18:51
R W Run
3.71 KB
2026-03-11 16:18:51
R W Run
24.6 KB
2026-03-11 16:18:51
R W Run
9.56 KB
2026-03-11 16:18:51
R W Run
346.43 KB
2026-03-11 16:18:52
R W Run
281.84 KB
2026-03-11 16:18:52
R W Run
14.95 KB
2026-03-11 16:18:51
R W Run
8.44 KB
2026-03-11 16:18:52
R W Run
168.95 KB
2026-03-11 16:18:52
R W Run
20.71 KB
2026-03-11 16:18:52
R W Run
25.27 KB
2026-03-11 16:18:51
R W Run
5.72 KB
2026-03-11 16:18:51
R W Run
4.63 KB
2026-03-11 16:18:52
R W Run
81.73 KB
2026-03-11 16:18:51
R W Run
67.18 KB
2026-03-11 16:18:51
R W Run
156.36 KB
2026-03-11 16:18:52
R W Run
55.19 KB
2026-03-11 16:18:51
R W Run
162 By
2026-03-11 16:18:51
R W Run
61.72 KB
2026-03-11 16:18:51
R W Run
216.06 KB
2026-03-11 16:18:52
R W Run
65.09 KB
2026-03-11 16:18:51
R W Run
25.24 KB
2026-03-11 16:18:52
R W Run
4.81 KB
2026-03-11 16:18:51
R W Run
6.48 KB
2026-03-11 16:18:52
R W Run
21.25 KB
2026-03-11 16:18:51
R W Run
2.79 KB
2026-03-11 16:18:52
R W Run
89.69 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:52
R W Run
3.69 KB
2026-03-11 16:18:52
R W Run
4.11 KB
2026-03-11 16:18:51
R W Run
40.74 KB
2026-03-11 16:18:51
R W Run
25.38 KB
2026-03-11 16:18:51
R W Run
43.31 KB
2026-03-11 16:18:52
R W Run
102.57 KB
2026-03-11 16:18:52
R W Run
6.18 KB
2026-03-11 16:18:51
R W Run
124.47 KB
2026-03-11 16:18:52
R W Run
35.65 KB
2026-03-11 16:18:52
R W Run
6.94 KB
2026-03-11 16:18:52
R W Run
67.04 KB
2026-03-11 16:18:52
R W Run
10.62 KB
2026-03-11 16:18:51
R W Run
289.35 KB
2026-03-11 16:18:52
R W Run
36.23 KB
2026-03-11 16:18:51
R W Run
200 By
2026-03-11 16:18:52
R W Run
200 By
2026-03-11 16:18:52
R W Run
98.29 KB
2026-03-11 16:18:52
R W Run
30.02 KB
2026-03-11 16:18:52
R W Run
19.03 KB
2026-03-11 16:18:52
R W Run
5.06 KB
2026-03-11 16:18:52
R W Run
255 By
2026-03-11 16:18:51
R W Run
22.66 KB
2026-03-11 16:18:52
R W Run
154.63 KB
2026-03-11 16:18:51
R W Run
9.68 KB
2026-03-11 16:18:51
R W Run
258 By
2026-03-11 16:18:51
R W Run
23.49 KB
2026-03-11 16:18:51
R W Run
3.16 KB
2026-03-11 16:18:51
R W Run
8.4 KB
2026-03-11 16:18:52
R W Run
441 By
2026-03-11 16:18:51
R W Run
7.39 KB
2026-03-11 16:18:51
R W Run
173 KB
2026-03-11 16:18:52
R W Run
544 By
2026-03-11 16:18:52
R W Run
4.17 KB
2026-03-11 16:18:51
R W Run
35.97 KB
2026-03-11 16:18:52
R W Run
1.69 KB
2026-03-11 16:18:51
R W Run
2.84 KB
2026-03-11 16:18:52
R W Run
6.09 KB
2026-03-11 16:18:51
R W Run
8.71 KB
2026-03-11 16:18:51
R W Run
131.84 KB
2026-03-11 16:18:51
R W Run
37.45 KB
2026-03-11 16:18:51
R W Run
173.89 KB
2026-03-11 16:18:51
R W Run
7.09 KB
2026-03-11 16:18:51
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
1.08 KB
2026-03-11 16:18:51
R W Run
69.46 KB
2026-03-11 16:18:52
R W Run
445 By
2026-03-11 16:18:51
R W Run
799 By
2026-03-11 16:18:52
R W Run
error_log
📄deprecated.php
1<?php
2/**
3 * Deprecated functions from past WordPress versions. You shouldn't use these
4 * functions and look for the alternatives instead. The functions will be
5 * removed in a later version.
6 *
7 * @package WordPress
8 * @subpackage Deprecated
9 */
10
11/*
12 * Deprecated functions come here to die.
13 */
14
15/**
16 * Retrieves all post data for a given post.
17 *
18 * @since 0.71
19 * @deprecated 1.5.1 Use get_post()
20 * @see get_post()
21 *
22 * @param int $postid Post ID.
23 * @return array Post data.
24 */
25function get_postdata($postid) {
26 _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
27
28 $post = get_post($postid);
29
30 $postdata = array (
31 'ID' => $post->ID,
32 'Author_ID' => $post->post_author,
33 'Date' => $post->post_date,
34 'Content' => $post->post_content,
35 'Excerpt' => $post->post_excerpt,
36 'Title' => $post->post_title,
37 'Category' => $post->post_category,
38 'post_status' => $post->post_status,
39 'comment_status' => $post->comment_status,
40 'ping_status' => $post->ping_status,
41 'post_password' => $post->post_password,
42 'to_ping' => $post->to_ping,
43 'pinged' => $post->pinged,
44 'post_type' => $post->post_type,
45 'post_name' => $post->post_name
46 );
47
48 return $postdata;
49}
50
51/**
52 * Sets up the WordPress Loop.
53 *
54 * Use The Loop instead.
55 *
56 * @link https://developer.wordpress.org/themes/basics/the-loop/
57 *
58 * @since 1.0.1
59 * @deprecated 1.5.0
60 *
61 * @global WP_Query $wp_query WordPress Query object.
62 */
63function start_wp() {
64 global $wp_query;
65
66 _deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') );
67
68 // Since the old style loop is being used, advance the query iterator here.
69 $wp_query->next_post();
70
71 setup_postdata( get_post() );
72}
73
74/**
75 * Returns or prints a category ID.
76 *
77 * @since 0.71
78 * @deprecated 0.71 Use get_the_category()
79 * @see get_the_category()
80 *
81 * @param bool $display Optional. Whether to display the output. Default true.
82 * @return int Category ID.
83 */
84function the_category_ID($display = true) {
85 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
86
87 // Grab the first cat in the list.
88 $categories = get_the_category();
89 $cat = $categories[0]->term_id;
90
91 if ( $display )
92 echo $cat;
93
94 return $cat;
95}
96
97/**
98 * Prints a category with optional text before and after.
99 *
100 * @since 0.71
101 * @deprecated 0.71 Use get_the_category_by_ID()
102 * @see get_the_category_by_ID()
103 *
104 * @param string $before Optional. Text to display before the category. Default empty.
105 * @param string $after Optional. Text to display after the category. Default empty.
106 */
107function the_category_head( $before = '', $after = '' ) {
108 global $currentcat, $previouscat;
109
110 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
111
112 // Grab the first cat in the list.
113 $categories = get_the_category();
114 $currentcat = $categories[0]->category_id;
115 if ( $currentcat != $previouscat ) {
116 echo $before;
117 echo get_the_category_by_ID($currentcat);
118 echo $after;
119 $previouscat = $currentcat;
120 }
121}
122
123/**
124 * Prints a link to the previous post.
125 *
126 * @since 1.5.0
127 * @deprecated 2.0.0 Use previous_post_link()
128 * @see previous_post_link()
129 *
130 * @param string $format
131 * @param string $previous
132 * @param string $title
133 * @param string $in_same_cat
134 * @param int $limitprev
135 * @param string $excluded_categories
136 */
137function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
138
139 _deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );
140
141 if ( empty($in_same_cat) || 'no' == $in_same_cat )
142 $in_same_cat = false;
143 else
144 $in_same_cat = true;
145
146 $post = get_previous_post($in_same_cat, $excluded_categories);
147
148 if ( !$post )
149 return;
150
151 $string = '<a href="'.get_permalink($post->ID).'">'.$previous;
152 if ( 'yes' == $title )
153 $string .= apply_filters('the_title', $post->post_title, $post->ID);
154 $string .= '</a>';
155 $format = str_replace('%', $string, $format);
156 echo $format;
157}
158
159/**
160 * Prints link to the next post.
161 *
162 * @since 0.71
163 * @deprecated 2.0.0 Use next_post_link()
164 * @see next_post_link()
165 *
166 * @param string $format
167 * @param string $next
168 * @param string $title
169 * @param string $in_same_cat
170 * @param int $limitnext
171 * @param string $excluded_categories
172 */
173function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
174 _deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' );
175
176 if ( empty($in_same_cat) || 'no' == $in_same_cat )
177 $in_same_cat = false;
178 else
179 $in_same_cat = true;
180
181 $post = get_next_post($in_same_cat, $excluded_categories);
182
183 if ( !$post )
184 return;
185
186 $string = '<a href="'.get_permalink($post->ID).'">'.$next;
187 if ( 'yes' == $title )
188 $string .= apply_filters('the_title', $post->post_title, $post->ID);
189 $string .= '</a>';
190 $format = str_replace('%', $string, $format);
191 echo $format;
192}
193
194/**
195 * Whether user can create a post.
196 *
197 * @since 1.5.0
198 * @deprecated 2.0.0 Use current_user_can()
199 * @see current_user_can()
200 *
201 * @param int $user_id
202 * @param int $blog_id Not Used
203 * @param int $category_id Not Used
204 * @return bool
205 */
206function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
207 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
208
209 $author_data = get_userdata($user_id);
210 return ($author_data->user_level > 1);
211}
212
213/**
214 * Whether user can create a post.
215 *
216 * @since 1.5.0
217 * @deprecated 2.0.0 Use current_user_can()
218 * @see current_user_can()
219 *
220 * @param int $user_id
221 * @param int $blog_id Not Used
222 * @param int $category_id Not Used
223 * @return bool
224 */
225function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
226 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
227
228 $author_data = get_userdata($user_id);
229 return ($author_data->user_level >= 1);
230}
231
232/**
233 * Whether user can edit a post.
234 *
235 * @since 1.5.0
236 * @deprecated 2.0.0 Use current_user_can()
237 * @see current_user_can()
238 *
239 * @param int $user_id
240 * @param int $post_id
241 * @param int $blog_id Not Used
242 * @return bool
243 */
244function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
245 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
246
247 $author_data = get_userdata($user_id);
248 $post = get_post($post_id);
249 $post_author_data = get_userdata($post->post_author);
250
251 if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
252 || ($author_data->user_level > $post_author_data->user_level)
253 || ($author_data->user_level >= 10) ) {
254 return true;
255 } else {
256 return false;
257 }
258}
259
260/**
261 * Whether user can delete a post.
262 *
263 * @since 1.5.0
264 * @deprecated 2.0.0 Use current_user_can()
265 * @see current_user_can()
266 *
267 * @param int $user_id
268 * @param int $post_id
269 * @param int $blog_id Not Used
270 * @return bool
271 */
272function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
273 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
274
275 // Right now if one can edit, one can delete.
276 return user_can_edit_post($user_id, $post_id, $blog_id);
277}
278
279/**
280 * Whether user can set new posts' dates.
281 *
282 * @since 1.5.0
283 * @deprecated 2.0.0 Use current_user_can()
284 * @see current_user_can()
285 *
286 * @param int $user_id
287 * @param int $blog_id Not Used
288 * @param int $category_id Not Used
289 * @return bool
290 */
291function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
292 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
293
294 $author_data = get_userdata($user_id);
295 return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
296}
297
298/**
299 * Whether user can delete a post.
300 *
301 * @since 1.5.0
302 * @deprecated 2.0.0 Use current_user_can()
303 * @see current_user_can()
304 *
305 * @param int $user_id
306 * @param int $post_id
307 * @param int $blog_id Not Used
308 * @return bool returns true if $user_id can edit $post_id's date
309 */
310function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
311 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
312
313 $author_data = get_userdata($user_id);
314 return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
315}
316
317/**
318 * Whether user can delete a post.
319 *
320 * @since 1.5.0
321 * @deprecated 2.0.0 Use current_user_can()
322 * @see current_user_can()
323 *
324 * @param int $user_id
325 * @param int $post_id
326 * @param int $blog_id Not Used
327 * @return bool returns true if $user_id can edit $post_id's comments
328 */
329function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
330 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
331
332 // Right now if one can edit a post, one can edit comments made on it.
333 return user_can_edit_post($user_id, $post_id, $blog_id);
334}
335
336/**
337 * Whether user can delete a post.
338 *
339 * @since 1.5.0
340 * @deprecated 2.0.0 Use current_user_can()
341 * @see current_user_can()
342 *
343 * @param int $user_id
344 * @param int $post_id
345 * @param int $blog_id Not Used
346 * @return bool returns true if $user_id can delete $post_id's comments
347 */
348function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
349 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
350
351 // Right now if one can edit comments, one can delete comments.
352 return user_can_edit_post_comments($user_id, $post_id, $blog_id);
353}
354
355/**
356 * Can user can edit other user.
357 *
358 * @since 1.5.0
359 * @deprecated 2.0.0 Use current_user_can()
360 * @see current_user_can()
361 *
362 * @param int $user_id
363 * @param int $other_user
364 * @return bool
365 */
366function user_can_edit_user($user_id, $other_user) {
367 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
368
369 $user = get_userdata($user_id);
370 $other = get_userdata($other_user);
371 if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
372 return true;
373 else
374 return false;
375}
376
377/**
378 * Gets the links associated with category $cat_name.
379 *
380 * @since 0.71
381 * @deprecated 2.1.0 Use get_bookmarks()
382 * @see get_bookmarks()
383 *
384 * @param string $cat_name Optional. The category name to use. If no match is found, uses all.
385 * Default 'noname'.
386 * @param string $before Optional. The HTML to output before the link. Default empty.
387 * @param string $after Optional. The HTML to output after the link. Default '<br />'.
388 * @param string $between Optional. The HTML to output between the link/image and its description.
389 * Not used if no image or $show_images is true. Default ' '.
390 * @param bool $show_images Optional. Whether to show images (if defined). Default true.
391 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
392 * 'description', 'rating', or 'owner'. Default 'id'.
393 * If you start the name with an underscore, the order will be reversed.
394 * Specifying 'rand' as the order will return links in a random order.
395 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
396 * Default true.
397 * @param bool $show_rating Optional. Show rating stars/chars. Default false.
398 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
399 * Default -1.
400 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0.
401 */
402function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
403 $show_description = true, $show_rating = false,
404 $limit = -1, $show_updated = 0) {
405 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
406
407 $cat_id = -1;
408 $cat = get_term_by('name', $cat_name, 'link_category');
409 if ( $cat )
410 $cat_id = $cat->term_id;
411
412 get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
413}
414
415/**
416 * Gets the links associated with the named category.
417 *
418 * @since 1.0.1
419 * @deprecated 2.1.0 Use wp_list_bookmarks()
420 * @see wp_list_bookmarks()
421 *
422 * @param string $category The category to use.
423 * @param string $args
424 * @return string|null
425 */
426function wp_get_linksbyname($category, $args = '') {
427 _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
428
429 $defaults = array(
430 'after' => '<br />',
431 'before' => '',
432 'categorize' => 0,
433 'category_after' => '',
434 'category_before' => '',
435 'category_name' => $category,
436 'show_description' => 1,
437 'title_li' => '',
438 );
439
440 $parsed_args = wp_parse_args( $args, $defaults );
441
442 return wp_list_bookmarks($parsed_args);
443}
444
445/**
446 * Gets an array of link objects associated with category $cat_name.
447 *
448 * $links = get_linkobjectsbyname( 'fred' );
449 * foreach ( $links as $link ) {
450 * echo '<li>' . $link->link_name . '</li>';
451 * }
452 *
453 * @since 1.0.1
454 * @deprecated 2.1.0 Use get_bookmarks()
455 * @see get_bookmarks()
456 *
457 * @param string $cat_name Optional. The category name to use. If no match is found, uses all.
458 * Default 'noname'.
459 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
460 * 'description', 'rating', or 'owner'. Default 'name'.
461 * If you start the name with an underscore, the order will be reversed.
462 * Specifying 'rand' as the order will return links in a random order.
463 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
464 * Default -1.
465 * @return array
466 */
467function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
468 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
469
470 $cat_id = -1;
471 $cat = get_term_by('name', $cat_name, 'link_category');
472 if ( $cat )
473 $cat_id = $cat->term_id;
474
475 return get_linkobjects($cat_id, $orderby, $limit);
476}
477
478/**
479 * Gets an array of link objects associated with category n.
480 *
481 * Usage:
482 *
483 * $links = get_linkobjects(1);
484 * if ($links) {
485 * foreach ($links as $link) {
486 * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';
487 * }
488 * }
489 *
490 * Fields are:
491 *
492 * - link_id
493 * - link_url
494 * - link_name
495 * - link_image
496 * - link_target
497 * - link_category
498 * - link_description
499 * - link_visible
500 * - link_owner
501 * - link_rating
502 * - link_updated
503 * - link_rel
504 * - link_notes
505 *
506 * @since 1.0.1
507 * @deprecated 2.1.0 Use get_bookmarks()
508 * @see get_bookmarks()
509 *
510 * @param int $category Optional. The category to use. If no category supplied, uses all.
511 * Default 0.
512 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
513 * 'description', 'rating', or 'owner'. Default 'name'.
514 * If you start the name with an underscore, the order will be reversed.
515 * Specifying 'rand' as the order will return links in a random order.
516 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
517 * Default 0.
518 * @return array
519 */
520function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
521 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
522
523 $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
524
525 $links_array = array();
526 foreach ($links as $link)
527 $links_array[] = $link;
528
529 return $links_array;
530}
531
532/**
533 * Gets the links associated with category 'cat_name' and display rating stars/chars.
534 *
535 * @since 0.71
536 * @deprecated 2.1.0 Use get_bookmarks()
537 * @see get_bookmarks()
538 *
539 * @param string $cat_name Optional. The category name to use. If no match is found, uses all.
540 * Default 'noname'.
541 * @param string $before Optional. The HTML to output before the link. Default empty.
542 * @param string $after Optional. The HTML to output after the link. Default '<br />'.
543 * @param string $between Optional. The HTML to output between the link/image and its description.
544 * Not used if no image or $show_images is true. Default ' '.
545 * @param bool $show_images Optional. Whether to show images (if defined). Default true.
546 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
547 * 'description', 'rating', or 'owner'. Default 'id'.
548 * If you start the name with an underscore, the order will be reversed.
549 * Specifying 'rand' as the order will return links in a random order.
550 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
551 * Default true.
552 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
553 * Default -1.
554 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0.
555 */
556function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
557 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
558 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
559
560 get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
561}
562
563/**
564 * Gets the links associated with category n and display rating stars/chars.
565 *
566 * @since 0.71
567 * @deprecated 2.1.0 Use get_bookmarks()
568 * @see get_bookmarks()
569 *
570 * @param int $category Optional. The category to use. If no category supplied, uses all.
571 * Default 0.
572 * @param string $before Optional. The HTML to output before the link. Default empty.
573 * @param string $after Optional. The HTML to output after the link. Default '<br />'.
574 * @param string $between Optional. The HTML to output between the link/image and its description.
575 * Not used if no image or $show_images is true. Default ' '.
576 * @param bool $show_images Optional. Whether to show images (if defined). Default true.
577 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
578 * 'description', 'rating', or 'owner'. Default 'id'.
579 * If you start the name with an underscore, the order will be reversed.
580 * Specifying 'rand' as the order will return links in a random order.
581 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
582 * Default true.
583 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
584 * Default -1.
585 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0.
586 */
587function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
588 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
589 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
590
591 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
592}
593
594/**
595 * Gets the auto_toggle setting.
596 *
597 * @since 0.71
598 * @deprecated 2.1.0
599 *
600 * @param int $id The category to get. If no category supplied uses 0
601 * @return int Only returns 0.
602 */
603function get_autotoggle($id = 0) {
604 _deprecated_function( __FUNCTION__, '2.1.0' );
605 return 0;
606}
607
608/**
609 * Lists categories.
610 *
611 * @since 0.71
612 * @deprecated 2.1.0 Use wp_list_categories()
613 * @see wp_list_categories()
614 *
615 * @param int $optionall
616 * @param string $all
617 * @param string $sort_column
618 * @param string $sort_order
619 * @param string $file
620 * @param bool $list
621 * @param int $optiondates
622 * @param int $optioncount
623 * @param int $hide_empty
624 * @param int $use_desc_for_title
625 * @param bool $children
626 * @param int $child_of
627 * @param int $categories
628 * @param int $recurse
629 * @param string $feed
630 * @param string $feed_image
631 * @param string $exclude
632 * @param bool $hierarchical
633 * @return null|false
634 */
635function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
636 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
637 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
638 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
639
640 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
641 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
642 return wp_list_cats($query);
643}
644
645/**
646 * Lists categories.
647 *
648 * @since 1.2.0
649 * @deprecated 2.1.0 Use wp_list_categories()
650 * @see wp_list_categories()
651 *
652 * @param string|array $args
653 * @return null|string|false
654 */
655function wp_list_cats($args = '') {
656 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
657
658 $parsed_args = wp_parse_args( $args );
659
660 // Map to new names.
661 if ( isset($parsed_args['optionall']) && isset($parsed_args['all']))
662 $parsed_args['show_option_all'] = $parsed_args['all'];
663 if ( isset($parsed_args['sort_column']) )
664 $parsed_args['orderby'] = $parsed_args['sort_column'];
665 if ( isset($parsed_args['sort_order']) )
666 $parsed_args['order'] = $parsed_args['sort_order'];
667 if ( isset($parsed_args['optiondates']) )
668 $parsed_args['show_last_update'] = $parsed_args['optiondates'];
669 if ( isset($parsed_args['optioncount']) )
670 $parsed_args['show_count'] = $parsed_args['optioncount'];
671 if ( isset($parsed_args['list']) )
672 $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break';
673 $parsed_args['title_li'] = '';
674
675 return wp_list_categories($parsed_args);
676}
677
678/**
679 * Deprecated method for generating a drop-down of categories.
680 *
681 * @since 0.71
682 * @deprecated 2.1.0 Use wp_dropdown_categories()
683 * @see wp_dropdown_categories()
684 *
685 * @param int $optionall
686 * @param string $all
687 * @param string $orderby
688 * @param string $order
689 * @param int $show_last_update
690 * @param int $show_count
691 * @param int $hide_empty
692 * @param bool $optionnone
693 * @param int $selected
694 * @param int $exclude
695 * @return string
696 */
697function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
698 $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
699 $selected = 0, $exclude = 0) {
700 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' );
701
702 $show_option_all = '';
703 if ( $optionall )
704 $show_option_all = $all;
705
706 $show_option_none = '';
707 if ( $optionnone )
708 $show_option_none = _x( 'None', 'Categories dropdown (show_option_none parameter)' );
709
710 $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
711 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
712 $query = add_query_arg($vars, '');
713 return wp_dropdown_categories($query);
714}
715
716/**
717 * Lists authors.
718 *
719 * @since 1.2.0
720 * @deprecated 2.1.0 Use wp_list_authors()
721 * @see wp_list_authors()
722 *
723 * @param bool $optioncount
724 * @param bool $exclude_admin
725 * @param bool $show_fullname
726 * @param bool $hide_empty
727 * @param string $feed
728 * @param string $feed_image
729 * @return null|string
730 */
731function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
732 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' );
733
734 $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
735 return wp_list_authors($args);
736}
737
738/**
739 * Retrieves a list of post categories.
740 *
741 * @since 1.0.1
742 * @deprecated 2.1.0 Use wp_get_post_categories()
743 * @see wp_get_post_categories()
744 *
745 * @param int $blogid Not Used
746 * @param int $post_id
747 * @return array
748 */
749function wp_get_post_cats($blogid = '1', $post_id = 0) {
750 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' );
751 return wp_get_post_categories($post_id);
752}
753
754/**
755 * Sets the categories that the post ID belongs to.
756 *
757 * @since 1.0.1
758 * @deprecated 2.1.0
759 * @deprecated Use wp_set_post_categories()
760 * @see wp_set_post_categories()
761 *
762 * @param int $blogid Not used
763 * @param int $post_id
764 * @param array $post_categories
765 * @return bool|mixed
766 */
767function wp_set_post_cats($blogid = '1', $post_id = 0, $post_categories = array()) {
768 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' );
769 return wp_set_post_categories($post_id, $post_categories);
770}
771
772/**
773 * Retrieves a list of archives.
774 *
775 * @since 0.71
776 * @deprecated 2.1.0 Use wp_get_archives()
777 * @see wp_get_archives()
778 *
779 * @param string $type
780 * @param string $limit
781 * @param string $format
782 * @param string $before
783 * @param string $after
784 * @param bool $show_post_count
785 * @return string|null
786 */
787function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
788 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' );
789 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
790 return wp_get_archives($args);
791}
792
793/**
794 * Returns or Prints link to the author's posts.
795 *
796 * @since 1.2.0
797 * @deprecated 2.1.0 Use get_author_posts_url()
798 * @see get_author_posts_url()
799 *
800 * @param bool $display
801 * @param int $author_id
802 * @param string $author_nicename Optional.
803 * @return string|null
804 */
805function get_author_link($display, $author_id, $author_nicename = '') {
806 _deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' );
807
808 $link = get_author_posts_url($author_id, $author_nicename);
809
810 if ( $display )
811 echo $link;
812 return $link;
813}
814
815/**
816 * Print list of pages based on arguments.
817 *
818 * @since 0.71
819 * @deprecated 2.1.0 Use wp_link_pages()
820 * @see wp_link_pages()
821 *
822 * @param string $before
823 * @param string $after
824 * @param string $next_or_number
825 * @param string $nextpagelink
826 * @param string $previouspagelink
827 * @param string $pagelink
828 * @param string $more_file
829 * @return string
830 */
831function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
832 $pagelink='%', $more_file='') {
833 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' );
834
835 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
836 return wp_link_pages($args);
837}
838
839/**
840 * Get value based on option.
841 *
842 * @since 0.71
843 * @deprecated 2.1.0 Use get_option()
844 * @see get_option()
845 *
846 * @param string $option
847 * @return string
848 */
849function get_settings($option) {
850 _deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' );
851
852 return get_option($option);
853}
854
855/**
856 * Print the permalink of the current post in the loop.
857 *
858 * @since 0.71
859 * @deprecated 1.2.0 Use the_permalink()
860 * @see the_permalink()
861 */
862function permalink_link() {
863 _deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' );
864 the_permalink();
865}
866
867/**
868 * Print the permalink to the RSS feed.
869 *
870 * @since 0.71
871 * @deprecated 2.3.0 Use the_permalink_rss()
872 * @see the_permalink_rss()
873 *
874 * @param string $deprecated
875 */
876function permalink_single_rss($deprecated = '') {
877 _deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' );
878 the_permalink_rss();
879}
880
881/**
882 * Gets the links associated with category.
883 *
884 * @since 1.0.1
885 * @deprecated 2.1.0 Use wp_list_bookmarks()
886 * @see wp_list_bookmarks()
887 *
888 * @param string $args a query string
889 * @return null|string
890 */
891function wp_get_links($args = '') {
892 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
893
894 if ( ! str_contains( $args, '=' ) ) {
895 $cat_id = $args;
896 $args = add_query_arg( 'category', $cat_id, $args );
897 }
898
899 $defaults = array(
900 'after' => '<br />',
901 'before' => '',
902 'between' => ' ',
903 'categorize' => 0,
904 'category' => '',
905 'echo' => true,
906 'limit' => -1,
907 'orderby' => 'name',
908 'show_description' => true,
909 'show_images' => true,
910 'show_rating' => false,
911 'show_updated' => true,
912 'title_li' => '',
913 );
914
915 $parsed_args = wp_parse_args( $args, $defaults );
916
917 return wp_list_bookmarks($parsed_args);
918}
919
920/**
921 * Gets the links associated with category by ID.
922 *
923 * @since 0.71
924 * @deprecated 2.1.0 Use get_bookmarks()
925 * @see get_bookmarks()
926 *
927 * @param int $category Optional. The category to use. If no category supplied uses all.
928 * Default 0.
929 * @param string $before Optional. The HTML to output before the link. Default empty.
930 * @param string $after Optional. The HTML to output after the link. Default '<br />'.
931 * @param string $between Optional. The HTML to output between the link/image and its description.
932 * Not used if no image or $show_images is true. Default ' '.
933 * @param bool $show_images Optional. Whether to show images (if defined). Default true.
934 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
935 * 'description', 'rating', or 'owner'. Default 'name'.
936 * If you start the name with an underscore, the order will be reversed.
937 * Specifying 'rand' as the order will return links in a random order.
938 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
939 * Default true.
940 * @param bool $show_rating Optional. Show rating stars/chars. Default false.
941 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
942 * Default -1.
943 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 1.
944 * @param bool $display Whether to display the results, or return them instead.
945 * @return null|string
946 */
947function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
948 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $display = true) {
949 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
950
951 $order = 'ASC';
952 if ( str_starts_with($orderby, '_') ) {
953 $order = 'DESC';
954 $orderby = substr($orderby, 1);
955 }
956
957 if ( $category == -1 ) // get_bookmarks() uses '' to signify all categories.
958 $category = '';
959
960 $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
961
962 if ( !$results )
963 return;
964
965 $output = '';
966
967 foreach ( (array) $results as $row ) {
968 if ( !isset($row->recently_updated) )
969 $row->recently_updated = false;
970 $output .= $before;
971 if ( $show_updated && $row->recently_updated )
972 $output .= get_option('links_recently_updated_prepend');
973 $the_link = '#';
974 if ( !empty($row->link_url) )
975 $the_link = esc_url($row->link_url);
976 $rel = $row->link_rel;
977 if ( '' != $rel )
978 $rel = ' rel="' . $rel . '"';
979
980 $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
981 $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
982 $title = $desc;
983
984 if ( $show_updated )
985 if ( !str_starts_with($row->link_updated_f, '00') )
986 $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
987
988 if ( '' != $title )
989 $title = ' title="' . $title . '"';
990
991 $alt = ' alt="' . $name . '"';
992
993 $target = $row->link_target;
994 if ( '' != $target )
995 $target = ' target="' . $target . '"';
996
997 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
998
999 if ( '' != $row->link_image && $show_images ) {
1000 if ( str_contains( $row->link_image, 'http' ) )
1001 $output .= '<img src="' . $row->link_image . '"' . $alt . $title . ' />';
1002 else // If it's a relative path.
1003 $output .= '<img src="' . get_option('siteurl') . $row->link_image . '"' . $alt . $title . ' />';
1004 } else {
1005 $output .= $name;
1006 }
1007
1008 $output .= '</a>';
1009
1010 if ( $show_updated && $row->recently_updated )
1011 $output .= get_option('links_recently_updated_append');
1012
1013 if ( $show_description && '' != $desc )
1014 $output .= $between . $desc;
1015
1016 if ($show_rating) {
1017 $output .= $between . get_linkrating($row);
1018 }
1019
1020 $output .= "$after\n";
1021 } // End while.
1022
1023 if ( !$display )
1024 return $output;
1025 echo $output;
1026}
1027
1028/**
1029 * Output entire list of links by category.
1030 *
1031 * Output a list of all links, listed by category, using the settings in
1032 * $wpdb->linkcategories and output it as a nested HTML unordered list.
1033 *
1034 * @since 1.0.1
1035 * @deprecated 2.1.0 Use wp_list_bookmarks()
1036 * @see wp_list_bookmarks()
1037 *
1038 * @param string $order Sort link categories by 'name' or 'id'
1039 */
1040function get_links_list($order = 'name') {
1041 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
1042
1043 $order = strtolower($order);
1044
1045 // Handle link category sorting.
1046 $direction = 'ASC';
1047 if ( str_starts_with( $order, '_' ) ) {
1048 $direction = 'DESC';
1049 $order = substr($order,1);
1050 }
1051
1052 if ( !isset($direction) )
1053 $direction = '';
1054
1055 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
1056
1057 // Display each category.
1058 if ( $cats ) {
1059 foreach ( (array) $cats as $cat ) {
1060 // Handle each category.
1061
1062 // Display the category name.
1063 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
1064 // Call get_links() with all the appropriate params.
1065 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
1066
1067 // Close the last category.
1068 echo "\n\t</ul>\n</li>\n";
1069 }
1070 }
1071}
1072
1073/**
1074 * Show the link to the links popup and the number of links.
1075 *
1076 * @since 0.71
1077 * @deprecated 2.1.0
1078 *
1079 * @param string $text the text of the link
1080 * @param int $width the width of the popup window
1081 * @param int $height the height of the popup window
1082 * @param string $file the page to open in the popup window
1083 * @param bool $count the number of links in the db
1084 */
1085function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
1086 _deprecated_function( __FUNCTION__, '2.1.0' );
1087}
1088
1089/**
1090 * Legacy function that retrieved the value of a link's link_rating field.
1091 *
1092 * @since 1.0.1
1093 * @deprecated 2.1.0 Use sanitize_bookmark_field()
1094 * @see sanitize_bookmark_field()
1095 *
1096 * @param object $link Link object.
1097 * @return mixed Value of the 'link_rating' field, false otherwise.
1098 */
1099function get_linkrating( $link ) {
1100 _deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' );
1101 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
1102}
1103
1104/**
1105 * Gets the name of category by ID.
1106 *
1107 * @since 0.71
1108 * @deprecated 2.1.0 Use get_category()
1109 * @see get_category()
1110 *
1111 * @param int $id The category to get. If no category supplied uses 0
1112 * @return string
1113 */
1114function get_linkcatname($id = 0) {
1115 _deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' );
1116
1117 $id = (int) $id;
1118
1119 if ( empty($id) )
1120 return '';
1121
1122 $cats = wp_get_link_cats($id);
1123
1124 if ( empty($cats) || ! is_array($cats) )
1125 return '';
1126
1127 $cat_id = (int) $cats[0]; // Take the first cat.
1128
1129 $cat = get_category($cat_id);
1130 return $cat->name;
1131}
1132
1133/**
1134 * Print RSS comment feed link.
1135 *
1136 * @since 1.0.1
1137 * @deprecated 2.5.0 Use post_comments_feed_link()
1138 * @see post_comments_feed_link()
1139 *
1140 * @param string $link_text
1141 */
1142function comments_rss_link($link_text = 'Comments RSS') {
1143 _deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' );
1144 post_comments_feed_link($link_text);
1145}
1146
1147/**
1148 * Print/Return link to category RSS2 feed.
1149 *
1150 * @since 1.2.0
1151 * @deprecated 2.5.0 Use get_category_feed_link()
1152 * @see get_category_feed_link()
1153 *
1154 * @param bool $display
1155 * @param int $cat_id
1156 * @return string
1157 */
1158function get_category_rss_link($display = false, $cat_id = 1) {
1159 _deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' );
1160
1161 $link = get_category_feed_link($cat_id, 'rss2');
1162
1163 if ( $display )
1164 echo $link;
1165 return $link;
1166}
1167
1168/**
1169 * Print/Return link to author RSS feed.
1170 *
1171 * @since 1.2.0
1172 * @deprecated 2.5.0 Use get_author_feed_link()
1173 * @see get_author_feed_link()
1174 *
1175 * @param bool $display
1176 * @param int $author_id
1177 * @return string
1178 */
1179function get_author_rss_link($display = false, $author_id = 1) {
1180 _deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' );
1181
1182 $link = get_author_feed_link($author_id);
1183 if ( $display )
1184 echo $link;
1185 return $link;
1186}
1187
1188/**
1189 * Return link to the post RSS feed.
1190 *
1191 * @since 1.5.0
1192 * @deprecated 2.2.0 Use get_post_comments_feed_link()
1193 * @see get_post_comments_feed_link()
1194 *
1195 * @return string
1196 */
1197function comments_rss() {
1198 _deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' );
1199 return esc_url( get_post_comments_feed_link() );
1200}
1201
1202/**
1203 * An alias of wp_create_user().
1204 *
1205 * @since 2.0.0
1206 * @deprecated 2.0.0 Use wp_create_user()
1207 * @see wp_create_user()
1208 *
1209 * @param string $username The user's username.
1210 * @param string $password The user's password.
1211 * @param string $email The user's email.
1212 * @return int The new user's ID.
1213 */
1214function create_user($username, $password, $email) {
1215 _deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' );
1216 return wp_create_user($username, $password, $email);
1217}
1218
1219/**
1220 * Unused function.
1221 *
1222 * @deprecated 2.5.0
1223 */
1224function gzip_compression() {
1225 _deprecated_function( __FUNCTION__, '2.5.0' );
1226 return false;
1227}
1228
1229/**
1230 * Retrieve an array of comment data about comment $comment_id.
1231 *
1232 * @since 0.71
1233 * @deprecated 2.7.0 Use get_comment()
1234 * @see get_comment()
1235 *
1236 * @param int $comment_id The ID of the comment
1237 * @param int $no_cache Whether to use the cache (cast to bool)
1238 * @param bool $include_unapproved Whether to include unapproved comments
1239 * @return array The comment data
1240 */
1241function get_commentdata( $comment_id, $no_cache = 0, $include_unapproved = false ) {
1242 _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
1243 return get_comment($comment_id, ARRAY_A);
1244}
1245
1246/**
1247 * Retrieve the category name by the category ID.
1248 *
1249 * @since 0.71
1250 * @deprecated 2.8.0 Use get_cat_name()
1251 * @see get_cat_name()
1252 *
1253 * @param int $cat_id Category ID
1254 * @return string category name
1255 */
1256function get_catname( $cat_id ) {
1257 _deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' );
1258 return get_cat_name( $cat_id );
1259}
1260
1261/**
1262 * Retrieve category children list separated before and after the term IDs.
1263 *
1264 * @since 1.2.0
1265 * @deprecated 2.8.0 Use get_term_children()
1266 * @see get_term_children()
1267 *
1268 * @param int $id Category ID to retrieve children.
1269 * @param string $before Optional. Prepend before category term ID. Default '/'.
1270 * @param string $after Optional. Append after category term ID. Default empty string.
1271 * @param array $visited Optional. Category Term IDs that have already been added.
1272 * Default empty array.
1273 * @return string
1274 */
1275function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
1276 _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
1277 if ( 0 == $id )
1278 return '';
1279
1280 $chain = '';
1281 /** TODO: Consult hierarchy */
1282 $cat_ids = get_all_category_ids();
1283 foreach ( (array) $cat_ids as $cat_id ) {
1284 if ( $cat_id == $id )
1285 continue;
1286
1287 $category = get_category( $cat_id );
1288 if ( is_wp_error( $category ) )
1289 return $category;
1290 if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
1291 $visited[] = $category->term_id;
1292 $chain .= $before.$category->term_id.$after;
1293 $chain .= get_category_children( $category->term_id, $before, $after );
1294 }
1295 }
1296 return $chain;
1297}
1298
1299/**
1300 * Retrieves all category IDs.
1301 *
1302 * @since 2.0.0
1303 * @deprecated 4.0.0 Use get_terms()
1304 * @see get_terms()
1305 *
1306 * @link https://developer.wordpress.org/reference/functions/get_all_category_ids/
1307 *
1308 * @return int[] List of all of the category IDs.
1309 */
1310function get_all_category_ids() {
1311 _deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );
1312
1313 $cat_ids = get_terms(
1314 array(
1315 'taxonomy' => 'category',
1316 'fields' => 'ids',
1317 'get' => 'all',
1318 )
1319 );
1320
1321 return $cat_ids;
1322}
1323
1324/**
1325 * Retrieve the description of the author of the current post.
1326 *
1327 * @since 1.5.0
1328 * @deprecated 2.8.0 Use get_the_author_meta()
1329 * @see get_the_author_meta()
1330 *
1331 * @return string The author's description.
1332 */
1333function get_the_author_description() {
1334 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' );
1335 return get_the_author_meta('description');
1336}
1337
1338/**
1339 * Display the description of the author of the current post.
1340 *
1341 * @since 1.0.0
1342 * @deprecated 2.8.0 Use the_author_meta()
1343 * @see the_author_meta()
1344 */
1345function the_author_description() {
1346 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' );
1347 the_author_meta('description');
1348}
1349
1350/**
1351 * Retrieve the login name of the author of the current post.
1352 *
1353 * @since 1.5.0
1354 * @deprecated 2.8.0 Use get_the_author_meta()
1355 * @see get_the_author_meta()
1356 *
1357 * @return string The author's login name (username).
1358 */
1359function get_the_author_login() {
1360 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' );
1361 return get_the_author_meta('login');
1362}
1363
1364/**
1365 * Display the login name of the author of the current post.
1366 *
1367 * @since 0.71
1368 * @deprecated 2.8.0 Use the_author_meta()
1369 * @see the_author_meta()
1370 */
1371function the_author_login() {
1372 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' );
1373 the_author_meta('login');
1374}
1375
1376/**
1377 * Retrieve the first name of the author of the current post.
1378 *
1379 * @since 1.5.0
1380 * @deprecated 2.8.0 Use get_the_author_meta()
1381 * @see get_the_author_meta()
1382 *
1383 * @return string The author's first name.
1384 */
1385function get_the_author_firstname() {
1386 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' );
1387 return get_the_author_meta('first_name');
1388}
1389
1390/**
1391 * Display the first name of the author of the current post.
1392 *
1393 * @since 0.71
1394 * @deprecated 2.8.0 Use the_author_meta()
1395 * @see the_author_meta()
1396 */
1397function the_author_firstname() {
1398 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' );
1399 the_author_meta('first_name');
1400}
1401
1402/**
1403 * Retrieve the last name of the author of the current post.
1404 *
1405 * @since 1.5.0
1406 * @deprecated 2.8.0 Use get_the_author_meta()
1407 * @see get_the_author_meta()
1408 *
1409 * @return string The author's last name.
1410 */
1411function get_the_author_lastname() {
1412 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' );
1413 return get_the_author_meta('last_name');
1414}
1415
1416/**
1417 * Display the last name of the author of the current post.
1418 *
1419 * @since 0.71
1420 * @deprecated 2.8.0 Use the_author_meta()
1421 * @see the_author_meta()
1422 */
1423function the_author_lastname() {
1424 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' );
1425 the_author_meta('last_name');
1426}
1427
1428/**
1429 * Retrieve the nickname of the author of the current post.
1430 *
1431 * @since 1.5.0
1432 * @deprecated 2.8.0 Use get_the_author_meta()
1433 * @see get_the_author_meta()
1434 *
1435 * @return string The author's nickname.
1436 */
1437function get_the_author_nickname() {
1438 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' );
1439 return get_the_author_meta('nickname');
1440}
1441
1442/**
1443 * Display the nickname of the author of the current post.
1444 *
1445 * @since 0.71
1446 * @deprecated 2.8.0 Use the_author_meta()
1447 * @see the_author_meta()
1448 */
1449function the_author_nickname() {
1450 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' );
1451 the_author_meta('nickname');
1452}
1453
1454/**
1455 * Retrieve the email of the author of the current post.
1456 *
1457 * @since 1.5.0
1458 * @deprecated 2.8.0 Use get_the_author_meta()
1459 * @see get_the_author_meta()
1460 *
1461 * @return string The author's username.
1462 */
1463function get_the_author_email() {
1464 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' );
1465 return get_the_author_meta('email');
1466}
1467
1468/**
1469 * Display the email of the author of the current post.
1470 *
1471 * @since 0.71
1472 * @deprecated 2.8.0 Use the_author_meta()
1473 * @see the_author_meta()
1474 */
1475function the_author_email() {
1476 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' );
1477 the_author_meta('email');
1478}
1479
1480/**
1481 * Retrieve the ICQ number of the author of the current post.
1482 *
1483 * @since 1.5.0
1484 * @deprecated 2.8.0 Use get_the_author_meta()
1485 * @see get_the_author_meta()
1486 *
1487 * @return string The author's ICQ number.
1488 */
1489function get_the_author_icq() {
1490 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' );
1491 return get_the_author_meta('icq');
1492}
1493
1494/**
1495 * Display the ICQ number of the author of the current post.
1496 *
1497 * @since 0.71
1498 * @deprecated 2.8.0 Use the_author_meta()
1499 * @see the_author_meta()
1500 */
1501function the_author_icq() {
1502 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' );
1503 the_author_meta('icq');
1504}
1505
1506/**
1507 * Retrieve the Yahoo! IM name of the author of the current post.
1508 *
1509 * @since 1.5.0
1510 * @deprecated 2.8.0 Use get_the_author_meta()
1511 * @see get_the_author_meta()
1512 *
1513 * @return string The author's Yahoo! IM name.
1514 */
1515function get_the_author_yim() {
1516 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' );
1517 return get_the_author_meta('yim');
1518}
1519
1520/**
1521 * Display the Yahoo! IM name of the author of the current post.
1522 *
1523 * @since 0.71
1524 * @deprecated 2.8.0 Use the_author_meta()
1525 * @see the_author_meta()
1526 */
1527function the_author_yim() {
1528 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' );
1529 the_author_meta('yim');
1530}
1531
1532/**
1533 * Retrieve the MSN address of the author of the current post.
1534 *
1535 * @since 1.5.0
1536 * @deprecated 2.8.0 Use get_the_author_meta()
1537 * @see get_the_author_meta()
1538 *
1539 * @return string The author's MSN address.
1540 */
1541function get_the_author_msn() {
1542 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' );
1543 return get_the_author_meta('msn');
1544}
1545
1546/**
1547 * Display the MSN address of the author of the current post.
1548 *
1549 * @since 0.71
1550 * @deprecated 2.8.0 Use the_author_meta()
1551 * @see the_author_meta()
1552 */
1553function the_author_msn() {
1554 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' );
1555 the_author_meta('msn');
1556}
1557
1558/**
1559 * Retrieve the AIM address of the author of the current post.
1560 *
1561 * @since 1.5.0
1562 * @deprecated 2.8.0 Use get_the_author_meta()
1563 * @see get_the_author_meta()
1564 *
1565 * @return string The author's AIM address.
1566 */
1567function get_the_author_aim() {
1568 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' );
1569 return get_the_author_meta('aim');
1570}
1571
1572/**
1573 * Display the AIM address of the author of the current post.
1574 *
1575 * @since 0.71
1576 * @deprecated 2.8.0 Use the_author_meta('aim')
1577 * @see the_author_meta()
1578 */
1579function the_author_aim() {
1580 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' );
1581 the_author_meta('aim');
1582}
1583
1584/**
1585 * Retrieve the specified author's preferred display name.
1586 *
1587 * @since 1.0.0
1588 * @deprecated 2.8.0 Use get_the_author_meta()
1589 * @see get_the_author_meta()
1590 *
1591 * @param int $auth_id The ID of the author.
1592 * @return string The author's display name.
1593 */
1594function get_author_name( $auth_id = false ) {
1595 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' );
1596 return get_the_author_meta('display_name', $auth_id);
1597}
1598
1599/**
1600 * Retrieve the URL to the home page of the author of the current post.
1601 *
1602 * @since 1.5.0
1603 * @deprecated 2.8.0 Use get_the_author_meta()
1604 * @see get_the_author_meta()
1605 *
1606 * @return string The URL to the author's page.
1607 */
1608function get_the_author_url() {
1609 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' );
1610 return get_the_author_meta('url');
1611}
1612
1613/**
1614 * Display the URL to the home page of the author of the current post.
1615 *
1616 * @since 0.71
1617 * @deprecated 2.8.0 Use the_author_meta()
1618 * @see the_author_meta()
1619 */
1620function the_author_url() {
1621 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' );
1622 the_author_meta('url');
1623}
1624
1625/**
1626 * Retrieve the ID of the author of the current post.
1627 *
1628 * @since 1.5.0
1629 * @deprecated 2.8.0 Use get_the_author_meta()
1630 * @see get_the_author_meta()
1631 *
1632 * @return string|int The author's ID.
1633 */
1634function get_the_author_ID() {
1635 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' );
1636 return get_the_author_meta('ID');
1637}
1638
1639/**
1640 * Display the ID of the author of the current post.
1641 *
1642 * @since 0.71
1643 * @deprecated 2.8.0 Use the_author_meta()
1644 * @see the_author_meta()
1645 */
1646function the_author_ID() {
1647 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' );
1648 the_author_meta('ID');
1649}
1650
1651/**
1652 * Display the post content for the feed.
1653 *
1654 * For encoding the HTML or the $encode_html parameter, there are three possible values:
1655 * - '0' will make urls footnotes and use make_url_footnote().
1656 * - '1' will encode special characters and automatically display all of the content.
1657 * - '2' will strip all HTML tags from the content.
1658 *
1659 * Also note that you cannot set the amount of words and not set the HTML encoding.
1660 * If that is the case, then the HTML encoding will default to 2, which will strip
1661 * all HTML tags.
1662 *
1663 * To restrict the amount of words of the content, you can use the cut parameter.
1664 * If the content is less than the amount, then there won't be any dots added to the end.
1665 * If there is content left over, then dots will be added and the rest of the content
1666 * will be removed.
1667 *
1668 * @since 0.71
1669 *
1670 * @deprecated 2.9.0 Use the_content_feed()
1671 * @see the_content_feed()
1672 *
1673 * @param string $more_link_text Optional. Text to display when more content is available
1674 * but not displayed. Default '(more...)'.
1675 * @param int $stripteaser Optional. Default 0.
1676 * @param string $more_file Optional.
1677 * @param int $cut Optional. Amount of words to keep for the content.
1678 * @param int $encode_html Optional. How to encode the content.
1679 */
1680function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
1681 _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' );
1682 $content = get_the_content($more_link_text, $stripteaser);
1683
1684 /**
1685 * Filters the post content in the context of an RSS feed.
1686 *
1687 * @since 0.71
1688 *
1689 * @param string $content Content of the current post.
1690 */
1691 $content = apply_filters('the_content_rss', $content);
1692 if ( $cut && !$encode_html )
1693 $encode_html = 2;
1694 if ( 1== $encode_html ) {
1695 $content = esc_html($content);
1696 $cut = 0;
1697 } elseif ( 0 == $encode_html ) {
1698 $content = make_url_footnote($content);
1699 } elseif ( 2 == $encode_html ) {
1700 $content = strip_tags($content);
1701 }
1702 if ( $cut ) {
1703 $blah = explode(' ', $content);
1704 if ( count($blah) > $cut ) {
1705 $k = $cut;
1706 $use_dotdotdot = 1;
1707 } else {
1708 $k = count($blah);
1709 $use_dotdotdot = 0;
1710 }
1711
1712 /** @todo Check performance, might be faster to use array slice instead. */
1713 for ( $i=0; $i<$k; $i++ )
1714 $excerpt .= $blah[$i].' ';
1715 $excerpt .= ($use_dotdotdot) ? '...' : '';
1716 $content = $excerpt;
1717 }
1718 $content = str_replace(']]>', ']]&gt;', $content);
1719 echo $content;
1720}
1721
1722/**
1723 * Strip HTML and put links at the bottom of stripped content.
1724 *
1725 * Searches for all of the links, strips them out of the content, and places
1726 * them at the bottom of the content with numbers.
1727 *
1728 * @since 0.71
1729 * @deprecated 2.9.0
1730 *
1731 * @param string $content Content to get links.
1732 * @return string HTML stripped out of content with links at the bottom.
1733 */
1734function make_url_footnote( $content ) {
1735 _deprecated_function( __FUNCTION__, '2.9.0', '' );
1736 preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
1737 $links_summary = "\n";
1738 for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) {
1739 $link_match = $matches[0][$i];
1740 $link_number = '['.($i+1).']';
1741 $link_url = $matches[2][$i];
1742 $link_text = $matches[4][$i];
1743 $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
1744 $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) !== 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) !== 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
1745 $links_summary .= "\n" . $link_number . ' ' . $link_url;
1746 }
1747 $content = strip_tags( $content );
1748 $content .= $links_summary;
1749 return $content;
1750}
1751
1752/**
1753 * Retrieve translated string with vertical bar context
1754 *
1755 * Quite a few times, there will be collisions with similar translatable text
1756 * found in more than two places but with different translated context.
1757 *
1758 * In order to use the separate contexts, the _c() function is used and the
1759 * translatable string uses a pipe ('|') which has the context the string is in.
1760 *
1761 * When the translated string is returned, it is everything before the pipe, not
1762 * including the pipe character. If there is no pipe in the translated text then
1763 * everything is returned.
1764 *
1765 * @since 2.2.0
1766 * @deprecated 2.9.0 Use _x()
1767 * @see _x()
1768 *
1769 * @param string $text Text to translate.
1770 * @param string $domain Optional. Domain to retrieve the translated text.
1771 * @return string Translated context string without pipe.
1772 */
1773function _c( $text, $domain = 'default' ) {
1774 _deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
1775 return before_last_bar( translate( $text, $domain ) );
1776}
1777
1778/**
1779 * Translates $text like translate(), but assumes that the text
1780 * contains a context after its last vertical bar.
1781 *
1782 * @since 2.5.0
1783 * @deprecated 3.0.0 Use _x()
1784 * @see _x()
1785 *
1786 * @param string $text Text to translate.
1787 * @param string $domain Domain to retrieve the translated text.
1788 * @return string Translated text.
1789 */
1790function translate_with_context( $text, $domain = 'default' ) {
1791 _deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
1792 return before_last_bar( translate( $text, $domain ) );
1793}
1794
1795/**
1796 * Legacy version of _n(), which supports contexts.
1797 *
1798 * Strips everything from the translation after the last bar.
1799 *
1800 * @since 2.7.0
1801 * @deprecated 3.0.0 Use _nx()
1802 * @see _nx()
1803 *
1804 * @param string $single The text to be used if the number is singular.
1805 * @param string $plural The text to be used if the number is plural.
1806 * @param int $number The number to compare against to use either the singular or plural form.
1807 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
1808 * Default 'default'.
1809 * @return string The translated singular or plural form.
1810 */
1811function _nc( $single, $plural, $number, $domain = 'default' ) {
1812 _deprecated_function( __FUNCTION__, '2.9.0', '_nx()' );
1813 return before_last_bar( _n( $single, $plural, $number, $domain ) );
1814}
1815
1816/**
1817 * Retrieve the plural or single form based on the amount.
1818 *
1819 * @since 1.2.0
1820 * @deprecated 2.8.0 Use _n()
1821 * @see _n()
1822 */
1823function __ngettext( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
1824 _deprecated_function( __FUNCTION__, '2.8.0', '_n()' );
1825 return _n( ...$args );
1826}
1827
1828/**
1829 * Register plural strings in POT file, but don't translate them.
1830 *
1831 * @since 2.5.0
1832 * @deprecated 2.8.0 Use _n_noop()
1833 * @see _n_noop()
1834 */
1835function __ngettext_noop( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
1836 _deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' );
1837 return _n_noop( ...$args );
1838
1839}
1840
1841/**
1842 * Retrieve all autoload options, or all options if no autoloaded ones exist.
1843 *
1844 * @since 1.0.0
1845 * @deprecated 3.0.0 Use wp_load_alloptions())
1846 * @see wp_load_alloptions()
1847 *
1848 * @return array List of all options.
1849 */
1850function get_alloptions() {
1851 _deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' );
1852 return wp_load_alloptions();
1853}
1854
1855/**
1856 * Retrieve HTML content of attachment image with link.
1857 *
1858 * @since 2.0.0
1859 * @deprecated 2.5.0 Use wp_get_attachment_link()
1860 * @see wp_get_attachment_link()
1861 *
1862 * @param int $id Optional. Post ID.
1863 * @param bool $fullsize Optional. Whether to use full size image. Default false.
1864 * @param array $max_dims Optional. Max image dimensions.
1865 * @param bool $permalink Optional. Whether to include permalink to image. Default false.
1866 * @return string
1867 */
1868function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
1869 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' );
1870 $id = (int) $id;
1871 $_post = get_post($id);
1872
1873 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
1874 return __('Missing Attachment');
1875
1876 if ( $permalink )
1877 $url = get_attachment_link($_post->ID);
1878
1879 $post_title = esc_attr($_post->post_title);
1880
1881 $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
1882 return "<a href='$url' title='$post_title'>$innerHTML</a>";
1883}
1884
1885/**
1886 * Retrieve icon URL and Path.
1887 *
1888 * @since 2.1.0
1889 * @deprecated 2.5.0 Use wp_get_attachment_image_src()
1890 * @see wp_get_attachment_image_src()
1891 *
1892 * @param int $id Optional. Post ID.
1893 * @param bool $fullsize Optional. Whether to have full image. Default false.
1894 * @return array Icon URL and full path to file, respectively.
1895 */
1896function get_attachment_icon_src( $id = 0, $fullsize = false ) {
1897 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
1898 $id = (int) $id;
1899 if ( !$post = get_post($id) )
1900 return false;
1901
1902 $file = get_attached_file( $post->ID );
1903
1904 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
1905 // We have a thumbnail desired, specified and existing.
1906
1907 $src_file = wp_basename($src);
1908 } elseif ( wp_attachment_is_image( $post->ID ) ) {
1909 // We have an image without a thumbnail.
1910
1911 $src = wp_get_attachment_url( $post->ID );
1912 $src_file = & $file;
1913 } elseif ( $src = wp_mime_type_icon( $post->ID, '.svg' ) ) {
1914 // No thumb, no image. We'll look for a mime-related icon instead.
1915
1916 /** This filter is documented in wp-includes/post.php */
1917 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
1918 $src_file = $icon_dir . '/' . wp_basename($src);
1919 }
1920
1921 if ( !isset($src) || !$src )
1922 return false;
1923
1924 return array($src, $src_file);
1925}
1926
1927/**
1928 * Retrieve HTML content of icon attachment image element.
1929 *
1930 * @since 2.0.0
1931 * @deprecated 2.5.0 Use wp_get_attachment_image()
1932 * @see wp_get_attachment_image()
1933 *
1934 * @param int $id Optional. Post ID.
1935 * @param bool $fullsize Optional. Whether to have full size image. Default false.
1936 * @param array $max_dims Optional. Dimensions of image.
1937 * @return string|false HTML content.
1938 */
1939function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
1940 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1941 $id = (int) $id;
1942 if ( !$post = get_post($id) )
1943 return false;
1944
1945 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
1946 return false;
1947
1948 list($src, $src_file) = $src;
1949
1950 // Do we need to constrain the image?
1951 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
1952
1953 $imagesize = wp_getimagesize($src_file);
1954
1955 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
1956 $actual_aspect = $imagesize[0] / $imagesize[1];
1957 $desired_aspect = $max_dims[0] / $max_dims[1];
1958
1959 if ( $actual_aspect >= $desired_aspect ) {
1960 $height = $actual_aspect * $max_dims[0];
1961 $constraint = "width='{$max_dims[0]}' ";
1962 $post->iconsize = array($max_dims[0], $height);
1963 } else {
1964 $width = $max_dims[1] / $actual_aspect;
1965 $constraint = "height='{$max_dims[1]}' ";
1966 $post->iconsize = array($width, $max_dims[1]);
1967 }
1968 } else {
1969 $post->iconsize = array($imagesize[0], $imagesize[1]);
1970 $constraint = '';
1971 }
1972 } else {
1973 $constraint = '';
1974 }
1975
1976 $post_title = esc_attr($post->post_title);
1977
1978 $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
1979
1980 return apply_filters( 'attachment_icon', $icon, $post->ID );
1981}
1982
1983/**
1984 * Retrieve HTML content of image element.
1985 *
1986 * @since 2.0.0
1987 * @deprecated 2.5.0 Use wp_get_attachment_image()
1988 * @see wp_get_attachment_image()
1989 *
1990 * @param int $id Optional. Post ID.
1991 * @param bool $fullsize Optional. Whether to have full size image. Default false.
1992 * @param array $max_dims Optional. Dimensions of image.
1993 * @return string|false
1994 */
1995function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
1996 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1997 $id = (int) $id;
1998 if ( !$post = get_post($id) )
1999 return false;
2000
2001 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
2002 return $innerHTML;
2003
2004 $innerHTML = esc_attr($post->post_title);
2005
2006 return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
2007}
2008
2009/**
2010 * Retrieves bookmark data based on ID.
2011 *
2012 * @since 2.0.0
2013 * @deprecated 2.1.0 Use get_bookmark()
2014 * @see get_bookmark()
2015 *
2016 * @param int $bookmark_id ID of link
2017 * @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A.
2018 * Default OBJECT.
2019 * @param string $filter Optional. How to filter the link for output. Accepts 'raw', 'edit',
2020 * 'attribute', 'js', 'db', or 'display'. Default 'raw'.
2021 * @return object|array Bookmark object or array, depending on the type specified by `$output`.
2022 */
2023function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) {
2024 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' );
2025 return get_bookmark($bookmark_id, $output, $filter);
2026}
2027
2028/**
2029 * Checks and cleans a URL.
2030 *
2031 * A number of characters are removed from the URL. If the URL is for displaying
2032 * (the default behavior) ampersands are also replaced. The 'clean_url' filter
2033 * is applied to the returned cleaned URL.
2034 *
2035 * @since 1.2.0
2036 * @deprecated 3.0.0 Use esc_url()
2037 * @see esc_url()
2038 *
2039 * @param string $url The URL to be cleaned.
2040 * @param array $protocols Optional. An array of acceptable protocols.
2041 * @param string $context Optional. How the URL will be used. Default is 'display'.
2042 * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
2043 */
2044function clean_url( $url, $protocols = null, $context = 'display' ) {
2045 if ( $context == 'db' )
2046 _deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'sanitize_url()' );
2047 else
2048 _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
2049 return esc_url( $url, $protocols, $context );
2050}
2051
2052/**
2053 * Escape single quotes, specialchar double quotes, and fix line endings.
2054 *
2055 * The filter {@see 'js_escape'} is also applied by esc_js().
2056 *
2057 * @since 2.0.4
2058 * @deprecated 2.8.0 Use esc_js()
2059 * @see esc_js()
2060 *
2061 * @param string $text The text to be escaped.
2062 * @return string Escaped text.
2063 */
2064function js_escape( $text ) {
2065 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
2066 return esc_js( $text );
2067}
2068
2069/**
2070 * Legacy escaping for HTML blocks.
2071 *
2072 * @deprecated 2.8.0 Use esc_html()
2073 * @see esc_html()
2074 *
2075 * @param string $text Text to escape.
2076 * @param string $quote_style Unused.
2077 * @param false|string $charset Unused.
2078 * @param false $double_encode Whether to double encode. Unused.
2079 * @return string Escaped `$text`.
2080 */
2081function wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
2082 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
2083 if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
2084 return _wp_specialchars( $text, $quote_style, $charset, $double_encode );
2085 } else {
2086 return esc_html( $text );
2087 }
2088}
2089
2090/**
2091 * Escaping for HTML attributes.
2092 *
2093 * @since 2.0.6
2094 * @deprecated 2.8.0 Use esc_attr()
2095 * @see esc_attr()
2096 *
2097 * @param string $text
2098 * @return string
2099 */
2100function attribute_escape( $text ) {
2101 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' );
2102 return esc_attr( $text );
2103}
2104
2105/**
2106 * Register widget for sidebar with backward compatibility.
2107 *
2108 * Allows $name to be an array that accepts either three elements to grab the
2109 * first element and the third for the name or just uses the first element of
2110 * the array for the name.
2111 *
2112 * Passes to wp_register_sidebar_widget() after argument list and backward
2113 * compatibility is complete.
2114 *
2115 * @since 2.2.0
2116 * @deprecated 2.8.0 Use wp_register_sidebar_widget()
2117 * @see wp_register_sidebar_widget()
2118 *
2119 * @param string|int $name Widget ID.
2120 * @param callable $output_callback Run when widget is called.
2121 * @param string $classname Optional. Classname widget option. Default empty.
2122 * @param mixed ...$params Widget parameters.
2123 */
2124function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) {
2125 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
2126 // Compat.
2127 if ( is_array( $name ) ) {
2128 if ( count( $name ) === 3 ) {
2129 $name = sprintf( $name[0], $name[2] );
2130 } else {
2131 $name = $name[0];
2132 }
2133 }
2134
2135 $id = sanitize_title( $name );
2136 $options = array();
2137 if ( ! empty( $classname ) && is_string( $classname ) ) {
2138 $options['classname'] = $classname;
2139 }
2140
2141 wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params );
2142}
2143
2144/**
2145 * Serves as an alias of wp_unregister_sidebar_widget().
2146 *
2147 * @since 2.2.0
2148 * @deprecated 2.8.0 Use wp_unregister_sidebar_widget()
2149 * @see wp_unregister_sidebar_widget()
2150 *
2151 * @param int|string $id Widget ID.
2152 */
2153function unregister_sidebar_widget($id) {
2154 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' );
2155 return wp_unregister_sidebar_widget($id);
2156}
2157
2158/**
2159 * Registers widget control callback for customizing options.
2160 *
2161 * Allows $name to be an array that accepts either three elements to grab the
2162 * first element and the third for the name or just uses the first element of
2163 * the array for the name.
2164 *
2165 * Passes to wp_register_widget_control() after the argument list has
2166 * been compiled.
2167 *
2168 * @since 2.2.0
2169 * @deprecated 2.8.0 Use wp_register_widget_control()
2170 * @see wp_register_widget_control()
2171 *
2172 * @param int|string $name Sidebar ID.
2173 * @param callable $control_callback Widget control callback to display and process form.
2174 * @param int $width Widget width.
2175 * @param int $height Widget height.
2176 * @param mixed ...$params Widget parameters.
2177 */
2178function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) {
2179 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
2180 // Compat.
2181 if ( is_array( $name ) ) {
2182 if ( count( $name ) === 3 ) {
2183 $name = sprintf( $name[0], $name[2] );
2184 } else {
2185 $name = $name[0];
2186 }
2187 }
2188
2189 $id = sanitize_title( $name );
2190 $options = array();
2191 if ( ! empty( $width ) ) {
2192 $options['width'] = $width;
2193 }
2194 if ( ! empty( $height ) ) {
2195 $options['height'] = $height;
2196 }
2197
2198 wp_register_widget_control( $id, $name, $control_callback, $options, ...$params );
2199}
2200
2201/**
2202 * Alias of wp_unregister_widget_control().
2203 *
2204 * @since 2.2.0
2205 * @deprecated 2.8.0 Use wp_unregister_widget_control()
2206 * @see wp_unregister_widget_control()
2207 *
2208 * @param int|string $id Widget ID.
2209 */
2210function unregister_widget_control($id) {
2211 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' );
2212 return wp_unregister_widget_control($id);
2213}
2214
2215/**
2216 * Remove user meta data.
2217 *
2218 * @since 2.0.0
2219 * @deprecated 3.0.0 Use delete_user_meta()
2220 * @see delete_user_meta()
2221 *
2222 * @global wpdb $wpdb WordPress database abstraction object.
2223 *
2224 * @param int $user_id User ID.
2225 * @param string $meta_key Metadata key.
2226 * @param mixed $meta_value Optional. Metadata value. Default empty.
2227 * @return bool True deletion completed and false if user_id is not a number.
2228 */
2229function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
2230 _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' );
2231 global $wpdb;
2232 if ( !is_numeric( $user_id ) )
2233 return false;
2234 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2235
2236 if ( is_array($meta_value) || is_object($meta_value) )
2237 $meta_value = serialize($meta_value);
2238 $meta_value = trim( $meta_value );
2239
2240 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2241
2242 if ( $cur && $cur->umeta_id )
2243 do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2244
2245 if ( ! empty($meta_value) )
2246 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
2247 else
2248 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2249
2250 clean_user_cache( $user_id );
2251 wp_cache_delete( $user_id, 'user_meta' );
2252
2253 if ( $cur && $cur->umeta_id )
2254 do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2255
2256 return true;
2257}
2258
2259/**
2260 * Retrieve user metadata.
2261 *
2262 * If $user_id is not a number, then the function will fail over with a 'false'
2263 * boolean return value. Other returned values depend on whether there is only
2264 * one item to be returned, which be that single item type. If there is more
2265 * than one metadata value, then it will be list of metadata values.
2266 *
2267 * @since 2.0.0
2268 * @deprecated 3.0.0 Use get_user_meta()
2269 * @see get_user_meta()
2270 *
2271 * @global wpdb $wpdb WordPress database abstraction object.
2272 *
2273 * @param int $user_id User ID
2274 * @param string $meta_key Optional. Metadata key. Default empty.
2275 * @return mixed
2276 */
2277function get_usermeta( $user_id, $meta_key = '' ) {
2278 _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' );
2279 global $wpdb;
2280 $user_id = (int) $user_id;
2281
2282 if ( !$user_id )
2283 return false;
2284
2285 if ( !empty($meta_key) ) {
2286 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2287 $user = wp_cache_get($user_id, 'users');
2288 // Check the cached user object.
2289 if ( false !== $user && isset($user->$meta_key) )
2290 $metas = array($user->$meta_key);
2291 else
2292 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2293 } else {
2294 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
2295 }
2296
2297 if ( empty($metas) ) {
2298 if ( empty($meta_key) )
2299 return array();
2300 else
2301 return '';
2302 }
2303
2304 $metas = array_map('maybe_unserialize', $metas);
2305
2306 if ( count($metas) === 1 )
2307 return $metas[0];
2308 else
2309 return $metas;
2310}
2311
2312/**
2313 * Update metadata of user.
2314 *
2315 * There is no need to serialize values, they will be serialized if it is
2316 * needed. The metadata key can only be a string with underscores. All else will
2317 * be removed.
2318 *
2319 * Will remove the metadata, if the meta value is empty.
2320 *
2321 * @since 2.0.0
2322 * @deprecated 3.0.0 Use update_user_meta()
2323 * @see update_user_meta()
2324 *
2325 * @global wpdb $wpdb WordPress database abstraction object.
2326 *
2327 * @param int $user_id User ID
2328 * @param string $meta_key Metadata key.
2329 * @param mixed $meta_value Metadata value.
2330 * @return bool True on successful update, false on failure.
2331 */
2332function update_usermeta( $user_id, $meta_key, $meta_value ) {
2333 _deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' );
2334 global $wpdb;
2335 if ( !is_numeric( $user_id ) )
2336 return false;
2337 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2338
2339 /** @todo Might need fix because usermeta data is assumed to be already escaped */
2340 if ( is_string($meta_value) )
2341 $meta_value = stripslashes($meta_value);
2342 $meta_value = maybe_serialize($meta_value);
2343
2344 if (empty($meta_value)) {
2345 return delete_usermeta($user_id, $meta_key);
2346 }
2347
2348 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2349
2350 if ( $cur )
2351 do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2352
2353 if ( !$cur )
2354 $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2355 elseif ( $cur->meta_value != $meta_value )
2356 $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2357 else
2358 return false;
2359
2360 clean_user_cache( $user_id );
2361 wp_cache_delete( $user_id, 'user_meta' );
2362
2363 if ( !$cur )
2364 do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2365 else
2366 do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2367
2368 return true;
2369}
2370
2371/**
2372 * Get users for the site.
2373 *
2374 * For setups that use the multisite feature. Can be used outside of the
2375 * multisite feature.
2376 *
2377 * @since 2.2.0
2378 * @deprecated 3.1.0 Use get_users()
2379 * @see get_users()
2380 *
2381 * @global wpdb $wpdb WordPress database abstraction object.
2382 *
2383 * @param int $id Site ID.
2384 * @return array List of users that are part of that site ID
2385 */
2386function get_users_of_blog( $id = '' ) {
2387 _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
2388
2389 global $wpdb;
2390 if ( empty( $id ) ) {
2391 $id = get_current_blog_id();
2392 }
2393 $blog_prefix = $wpdb->get_blog_prefix($id);
2394 $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
2395 return $users;
2396}
2397
2398/**
2399 * Enable/disable automatic general feed link outputting.
2400 *
2401 * @since 2.8.0
2402 * @deprecated 3.0.0 Use add_theme_support()
2403 * @see add_theme_support()
2404 *
2405 * @param bool $add Optional. Add or remove links. Default true.
2406 */
2407function automatic_feed_links( $add = true ) {
2408 _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
2409
2410 if ( $add )
2411 add_theme_support( 'automatic-feed-links' );
2412 else
2413 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+.
2414}
2415
2416/**
2417 * Retrieve user data based on field.
2418 *
2419 * @since 1.5.0
2420 * @deprecated 3.0.0 Use get_the_author_meta()
2421 * @see get_the_author_meta()
2422 *
2423 * @param string $field User meta field.
2424 * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user).
2425 * @return string The author's field from the current author's DB object.
2426 */
2427function get_profile( $field, $user = false ) {
2428 _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' );
2429 if ( $user ) {
2430 $user = get_user_by( 'login', $user );
2431 $user = $user->ID;
2432 }
2433 return get_the_author_meta( $field, $user );
2434}
2435
2436/**
2437 * Retrieves the number of posts a user has written.
2438 *
2439 * @since 0.71
2440 * @deprecated 3.0.0 Use count_user_posts()
2441 * @see count_user_posts()
2442 *
2443 * @param int $userid User to count posts for.
2444 * @return int Number of posts the given user has written.
2445 */
2446function get_usernumposts( $userid ) {
2447 _deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' );
2448 return count_user_posts( $userid );
2449}
2450
2451/**
2452 * Callback used to change %uXXXX to &#YYY; syntax
2453 *
2454 * @since 2.8.0
2455 * @access private
2456 * @deprecated 3.0.0
2457 *
2458 * @param array $matches Single Match
2459 * @return string An HTML entity
2460 */
2461function funky_javascript_callback($matches) {
2462 return "&#".base_convert($matches[1],16,10).";";
2463}
2464
2465/**
2466 * Fixes JavaScript bugs in browsers.
2467 *
2468 * Converts unicode characters to HTML numbered entities.
2469 *
2470 * @since 1.5.0
2471 * @deprecated 3.0.0
2472 *
2473 * @global $is_macIE
2474 * @global $is_winIE
2475 *
2476 * @param string $text Text to be made safe.
2477 * @return string Fixed text.
2478 */
2479function funky_javascript_fix($text) {
2480 _deprecated_function( __FUNCTION__, '3.0.0' );
2481 // Fixes for browsers' JavaScript bugs.
2482 global $is_macIE, $is_winIE;
2483
2484 if ( $is_winIE || $is_macIE )
2485 $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2486 "funky_javascript_callback",
2487 $text);
2488
2489 return $text;
2490}
2491
2492/**
2493 * Checks that the taxonomy name exists.
2494 *
2495 * @since 2.3.0
2496 * @deprecated 3.0.0 Use taxonomy_exists()
2497 * @see taxonomy_exists()
2498 *
2499 * @param string $taxonomy Name of taxonomy object
2500 * @return bool Whether the taxonomy exists.
2501 */
2502function is_taxonomy( $taxonomy ) {
2503 _deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' );
2504 return taxonomy_exists( $taxonomy );
2505}
2506
2507/**
2508 * Check if Term exists.
2509 *
2510 * @since 2.3.0
2511 * @deprecated 3.0.0 Use term_exists()
2512 * @see term_exists()
2513 *
2514 * @param int|string $term The term to check
2515 * @param string $taxonomy The taxonomy name to use
2516 * @param int $parent ID of parent term under which to confine the exists search.
2517 * @return mixed Get the term ID or term object, if exists.
2518 */
2519function is_term( $term, $taxonomy = '', $parent = 0 ) {
2520 _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
2521 return term_exists( $term, $taxonomy, $parent );
2522}
2523
2524/**
2525 * Determines whether the current admin page is generated by a plugin.
2526 *
2527 * Use global $plugin_page and/or get_plugin_page_hookname() hooks.
2528 *
2529 * For more information on this and similar theme functions, check out
2530 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
2531 * Conditional Tags} article in the Theme Developer Handbook.
2532 *
2533 * @since 1.5.0
2534 * @deprecated 3.1.0
2535 *
2536 * @global $plugin_page
2537 *
2538 * @return bool
2539 */
2540function is_plugin_page() {
2541 _deprecated_function( __FUNCTION__, '3.1.0' );
2542
2543 global $plugin_page;
2544
2545 if ( isset($plugin_page) )
2546 return true;
2547
2548 return false;
2549}
2550
2551/**
2552 * Update the categories cache.
2553 *
2554 * This function does not appear to be used anymore or does not appear to be
2555 * needed. It might be a legacy function left over from when there was a need
2556 * for updating the category cache.
2557 *
2558 * @since 1.5.0
2559 * @deprecated 3.1.0
2560 *
2561 * @return bool Always return True
2562 */
2563function update_category_cache() {
2564 _deprecated_function( __FUNCTION__, '3.1.0' );
2565
2566 return true;
2567}
2568
2569/**
2570 * Check for PHP timezone support
2571 *
2572 * @since 2.9.0
2573 * @deprecated 3.2.0
2574 *
2575 * @return bool
2576 */
2577function wp_timezone_supported() {
2578 _deprecated_function( __FUNCTION__, '3.2.0' );
2579
2580 return true;
2581}
2582
2583/**
2584 * Displays an editor: TinyMCE, HTML, or both.
2585 *
2586 * @since 2.1.0
2587 * @deprecated 3.3.0 Use wp_editor()
2588 * @see wp_editor()
2589 *
2590 * @param string $content Textarea content.
2591 * @param string $id Optional. HTML ID attribute value. Default 'content'.
2592 * @param string $prev_id Optional. Unused.
2593 * @param bool $media_buttons Optional. Whether to display media buttons. Default true.
2594 * @param int $tab_index Optional. Unused.
2595 * @param bool $extended Optional. Unused.
2596 */
2597function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
2598 _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
2599
2600 wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
2601}
2602
2603/**
2604 * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users
2605 *
2606 * @since 3.0.0
2607 * @deprecated 3.3.0
2608 *
2609 * @param array $ids User ID numbers list.
2610 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
2611 */
2612function get_user_metavalues($ids) {
2613 _deprecated_function( __FUNCTION__, '3.3.0' );
2614
2615 $objects = array();
2616
2617 $ids = array_map('intval', $ids);
2618 foreach ( $ids as $id )
2619 $objects[$id] = array();
2620
2621 $metas = update_meta_cache('user', $ids);
2622
2623 foreach ( $metas as $id => $meta ) {
2624 foreach ( $meta as $key => $metavalues ) {
2625 foreach ( $metavalues as $value ) {
2626 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value);
2627 }
2628 }
2629 }
2630
2631 return $objects;
2632}
2633
2634/**
2635 * Sanitize every user field.
2636 *
2637 * If the context is 'raw', then the user object or array will get minimal sanitization of the int fields.
2638 *
2639 * @since 2.3.0
2640 * @deprecated 3.3.0
2641 *
2642 * @param object|array $user The user object or array.
2643 * @param string $context Optional. How to sanitize user fields. Default 'display'.
2644 * @return object|array The now sanitized user object or array (will be the same type as $user).
2645 */
2646function sanitize_user_object($user, $context = 'display') {
2647 _deprecated_function( __FUNCTION__, '3.3.0' );
2648
2649 if ( is_object($user) ) {
2650 if ( !isset($user->ID) )
2651 $user->ID = 0;
2652 if ( ! ( $user instanceof WP_User ) ) {
2653 $vars = get_object_vars($user);
2654 foreach ( array_keys($vars) as $field ) {
2655 if ( is_string($user->$field) || is_numeric($user->$field) )
2656 $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2657 }
2658 }
2659 $user->filter = $context;
2660 } else {
2661 if ( !isset($user['ID']) )
2662 $user['ID'] = 0;
2663 foreach ( array_keys($user) as $field )
2664 $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2665 $user['filter'] = $context;
2666 }
2667
2668 return $user;
2669}
2670
2671/**
2672 * Get boundary post relational link.
2673 *
2674 * Can either be start or end post relational link.
2675 *
2676 * @since 2.8.0
2677 * @deprecated 3.3.0
2678 *
2679 * @param string $title Optional. Link title format. Default '%title'.
2680 * @param bool $in_same_cat Optional. Whether link should be in a same category.
2681 * Default false.
2682 * @param string $excluded_categories Optional. Excluded categories IDs. Default empty.
2683 * @param bool $start Optional. Whether to display link to first or last post.
2684 * Default true.
2685 * @return string
2686 */
2687function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
2688 _deprecated_function( __FUNCTION__, '3.3.0' );
2689
2690 $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
2691 // If there is no post, stop.
2692 if ( empty($posts) )
2693 return;
2694
2695 // Even though we limited get_posts() to return only 1 item it still returns an array of objects.
2696 $post = $posts[0];
2697
2698 if ( empty($post->post_title) )
2699 $post->post_title = $start ? __('First Post') : __('Last Post');
2700
2701 $date = mysql2date(get_option('date_format'), $post->post_date);
2702
2703 $title = str_replace('%title', $post->post_title, $title);
2704 $title = str_replace('%date', $date, $title);
2705 $title = apply_filters('the_title', $title, $post->ID);
2706
2707 $link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
2708 $link .= esc_attr($title);
2709 $link .= "' href='" . get_permalink($post) . "' />\n";
2710
2711 $boundary = $start ? 'start' : 'end';
2712 return apply_filters( "{$boundary}_post_rel_link", $link );
2713}
2714
2715/**
2716 * Display relational link for the first post.
2717 *
2718 * @since 2.8.0
2719 * @deprecated 3.3.0
2720 *
2721 * @param string $title Optional. Link title format.
2722 * @param bool $in_same_cat Optional. Whether link should be in a same category.
2723 * @param string $excluded_categories Optional. Excluded categories IDs.
2724 */
2725function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
2726 _deprecated_function( __FUNCTION__, '3.3.0' );
2727
2728 echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
2729}
2730
2731/**
2732 * Get site index relational link.
2733 *
2734 * @since 2.8.0
2735 * @deprecated 3.3.0
2736 *
2737 * @return string
2738 */
2739function get_index_rel_link() {
2740 _deprecated_function( __FUNCTION__, '3.3.0' );
2741
2742 $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
2743 return apply_filters( "index_rel_link", $link );
2744}
2745
2746/**
2747 * Display relational link for the site index.
2748 *
2749 * @since 2.8.0
2750 * @deprecated 3.3.0
2751 */
2752function index_rel_link() {
2753 _deprecated_function( __FUNCTION__, '3.3.0' );
2754
2755 echo get_index_rel_link();
2756}
2757
2758/**
2759 * Get parent post relational link.
2760 *
2761 * @since 2.8.0
2762 * @deprecated 3.3.0
2763 *
2764 * @global WP_Post $post Global post object.
2765 *
2766 * @param string $title Optional. Link title format. Default '%title'.
2767 * @return string
2768 */
2769function get_parent_post_rel_link( $title = '%title' ) {
2770 _deprecated_function( __FUNCTION__, '3.3.0' );
2771
2772 if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
2773 $post = get_post($GLOBALS['post']->post_parent);
2774
2775 if ( empty($post) )
2776 return;
2777
2778 $date = mysql2date(get_option('date_format'), $post->post_date);
2779
2780 $title = str_replace('%title', $post->post_title, $title);
2781 $title = str_replace('%date', $date, $title);
2782 $title = apply_filters('the_title', $title, $post->ID);
2783
2784 $link = "<link rel='up' title='";
2785 $link .= esc_attr( $title );
2786 $link .= "' href='" . get_permalink($post) . "' />\n";
2787
2788 return apply_filters( "parent_post_rel_link", $link );
2789}
2790
2791/**
2792 * Display relational link for parent item
2793 *
2794 * @since 2.8.0
2795 * @deprecated 3.3.0
2796 *
2797 * @param string $title Optional. Link title format. Default '%title'.
2798 */
2799function parent_post_rel_link( $title = '%title' ) {
2800 _deprecated_function( __FUNCTION__, '3.3.0' );
2801
2802 echo get_parent_post_rel_link($title);
2803}
2804
2805/**
2806 * Add the "Dashboard"/"Visit Site" menu.
2807 *
2808 * @since 3.2.0
2809 * @deprecated 3.3.0
2810 *
2811 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
2812 */
2813function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
2814 _deprecated_function( __FUNCTION__, '3.3.0' );
2815
2816 $user_id = get_current_user_id();
2817
2818 if ( 0 != $user_id ) {
2819 if ( is_admin() )
2820 $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2821 elseif ( is_multisite() )
2822 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2823 else
2824 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2825 }
2826}
2827
2828/**
2829 * Checks if the current user belong to a given site.
2830 *
2831 * @since MU (3.0.0)
2832 * @deprecated 3.3.0 Use is_user_member_of_blog()
2833 * @see is_user_member_of_blog()
2834 *
2835 * @param int $blog_id Site ID
2836 * @return bool True if the current users belong to $blog_id, false if not.
2837 */
2838function is_blog_user( $blog_id = 0 ) {
2839 _deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' );
2840
2841 return is_user_member_of_blog( get_current_user_id(), $blog_id );
2842}
2843
2844/**
2845 * Open the file handle for debugging.
2846 *
2847 * @since 0.71
2848 * @deprecated 3.4.0 Use error_log()
2849 * @see error_log()
2850 *
2851 * @link https://www.php.net/manual/en/function.error-log.php
2852 *
2853 * @param string $filename File name.
2854 * @param string $mode Type of access you required to the stream.
2855 * @return false Always false.
2856 */
2857function debug_fopen( $filename, $mode ) {
2858 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
2859 return false;
2860}
2861
2862/**
2863 * Write contents to the file used for debugging.
2864 *
2865 * @since 0.71
2866 * @deprecated 3.4.0 Use error_log()
2867 * @see error_log()
2868 *
2869 * @link https://www.php.net/manual/en/function.error-log.php
2870 *
2871 * @param mixed $fp Unused.
2872 * @param string $message Message to log.
2873 */
2874function debug_fwrite( $fp, $message ) {
2875 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
2876 if ( ! empty( $GLOBALS['debug'] ) )
2877 error_log( $message );
2878}
2879
2880/**
2881 * Close the debugging file handle.
2882 *
2883 * @since 0.71
2884 * @deprecated 3.4.0 Use error_log()
2885 * @see error_log()
2886 *
2887 * @link https://www.php.net/manual/en/function.error-log.php
2888 *
2889 * @param mixed $fp Unused.
2890 */
2891function debug_fclose( $fp ) {
2892 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
2893}
2894
2895/**
2896 * Retrieve list of themes with theme data in theme directory.
2897 *
2898 * The theme is broken, if it doesn't have a parent theme and is missing either
2899 * style.css and, or index.php. If the theme has a parent theme then it is
2900 * broken, if it is missing style.css; index.php is optional.
2901 *
2902 * @since 1.5.0
2903 * @deprecated 3.4.0 Use wp_get_themes()
2904 * @see wp_get_themes()
2905 *
2906 * @return array Theme list with theme data.
2907 */
2908function get_themes() {
2909 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' );
2910
2911 global $wp_themes;
2912 if ( isset( $wp_themes ) )
2913 return $wp_themes;
2914
2915 $themes = wp_get_themes();
2916 $wp_themes = array();
2917
2918 foreach ( $themes as $theme ) {
2919 $name = $theme->get('Name');
2920 if ( isset( $wp_themes[ $name ] ) )
2921 $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2922 else
2923 $wp_themes[ $name ] = $theme;
2924 }
2925
2926 return $wp_themes;
2927}
2928
2929/**
2930 * Retrieve theme data.
2931 *
2932 * @since 1.5.0
2933 * @deprecated 3.4.0 Use wp_get_theme()
2934 * @see wp_get_theme()
2935 *
2936 * @param string $theme Theme name.
2937 * @return array|null Null, if theme name does not exist. Theme data, if exists.
2938 */
2939function get_theme( $theme ) {
2940 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' );
2941
2942 $themes = get_themes();
2943 if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
2944 return $themes[ $theme ];
2945 return null;
2946}
2947
2948/**
2949 * Retrieve current theme name.
2950 *
2951 * @since 1.5.0
2952 * @deprecated 3.4.0 Use wp_get_theme()
2953 * @see wp_get_theme()
2954 *
2955 * @return string
2956 */
2957function get_current_theme() {
2958 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
2959
2960 if ( $theme = get_option( 'current_theme' ) )
2961 return $theme;
2962
2963 return wp_get_theme()->get('Name');
2964}
2965
2966/**
2967 * Accepts matches array from preg_replace_callback in wpautop() or a string.
2968 *
2969 * Ensures that the contents of a `<pre>...</pre>` HTML block are not
2970 * converted into paragraphs or line breaks.
2971 *
2972 * @since 1.2.0
2973 * @deprecated 3.4.0
2974 *
2975 * @param array|string $matches The array or string
2976 * @return string The pre block without paragraph/line break conversion.
2977 */
2978function clean_pre($matches) {
2979 _deprecated_function( __FUNCTION__, '3.4.0' );
2980
2981 if ( is_array($matches) )
2982 $text = $matches[1] . $matches[2] . "</pre>";
2983 else
2984 $text = $matches;
2985
2986 $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
2987 $text = str_replace('<p>', "\n", $text);
2988 $text = str_replace('</p>', '', $text);
2989
2990 return $text;
2991}
2992
2993
2994/**
2995 * Add callbacks for image header display.
2996 *
2997 * @since 2.1.0
2998 * @deprecated 3.4.0 Use add_theme_support()
2999 * @see add_theme_support()
3000 *
3001 * @param callable $wp_head_callback Call on the {@see 'wp_head'} action.
3002 * @param callable $admin_head_callback Call on custom header administration screen.
3003 * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional.
3004 */
3005function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) {
3006 _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' );
3007 $args = array(
3008 'wp-head-callback' => $wp_head_callback,
3009 'admin-head-callback' => $admin_head_callback,
3010 );
3011 if ( $admin_preview_callback )
3012 $args['admin-preview-callback'] = $admin_preview_callback;
3013 return add_theme_support( 'custom-header', $args );
3014}
3015
3016/**
3017 * Remove image header support.
3018 *
3019 * @since 3.1.0
3020 * @deprecated 3.4.0 Use remove_theme_support()
3021 * @see remove_theme_support()
3022 *
3023 * @return null|bool Whether support was removed.
3024 */
3025function remove_custom_image_header() {
3026 _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' );
3027 return remove_theme_support( 'custom-header' );
3028}
3029
3030/**
3031 * Add callbacks for background image display.
3032 *
3033 * @since 3.0.0
3034 * @deprecated 3.4.0 Use add_theme_support()
3035 * @see add_theme_support()
3036 *
3037 * @param callable $wp_head_callback Call on the {@see 'wp_head'} action.
3038 * @param callable $admin_head_callback Call on custom background administration screen.
3039 * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional.
3040 */
3041function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
3042 _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' );
3043 $args = array();
3044 if ( $wp_head_callback )
3045 $args['wp-head-callback'] = $wp_head_callback;
3046 if ( $admin_head_callback )
3047 $args['admin-head-callback'] = $admin_head_callback;
3048 if ( $admin_preview_callback )
3049 $args['admin-preview-callback'] = $admin_preview_callback;
3050 return add_theme_support( 'custom-background', $args );
3051}
3052
3053/**
3054 * Remove custom background support.
3055 *
3056 * @since 3.1.0
3057 * @deprecated 3.4.0 Use add_custom_background()
3058 * @see add_custom_background()
3059 *
3060 * @return null|bool Whether support was removed.
3061 */
3062function remove_custom_background() {
3063 _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' );
3064 return remove_theme_support( 'custom-background' );
3065}
3066
3067/**
3068 * Retrieve theme data from parsed theme file.
3069 *
3070 * @since 1.5.0
3071 * @deprecated 3.4.0 Use wp_get_theme()
3072 * @see wp_get_theme()
3073 *
3074 * @param string $theme_file Theme file path.
3075 * @return array Theme data.
3076 */
3077function get_theme_data( $theme_file ) {
3078 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
3079 $theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
3080
3081 $theme_data = array(
3082 'Name' => $theme->get('Name'),
3083 'URI' => $theme->display('ThemeURI', true, false),
3084 'Description' => $theme->display('Description', true, false),
3085 'Author' => $theme->display('Author', true, false),
3086 'AuthorURI' => $theme->display('AuthorURI', true, false),
3087 'Version' => $theme->get('Version'),
3088 'Template' => $theme->get('Template'),
3089 'Status' => $theme->get('Status'),
3090 'Tags' => $theme->get('Tags'),
3091 'Title' => $theme->get('Name'),
3092 'AuthorName' => $theme->get('Author'),
3093 );
3094
3095 foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
3096 if ( ! isset( $theme_data[ $extra_header ] ) )
3097 $theme_data[ $extra_header ] = $theme->get( $extra_header );
3098 }
3099
3100 return $theme_data;
3101}
3102
3103/**
3104 * Alias of update_post_cache().
3105 *
3106 * @see update_post_cache() Posts and pages are the same, alias is intentional
3107 *
3108 * @since 1.5.1
3109 * @deprecated 3.4.0 Use update_post_cache()
3110 * @see update_post_cache()
3111 *
3112 * @param array $pages list of page objects
3113 */
3114function update_page_cache( &$pages ) {
3115 _deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' );
3116
3117 update_post_cache( $pages );
3118}
3119
3120/**
3121 * Will clean the page in the cache.
3122 *
3123 * Clean (read: delete) page from cache that matches $id. Will also clean cache
3124 * associated with 'all_page_ids' and 'get_pages'.
3125 *
3126 * @since 2.0.0
3127 * @deprecated 3.4.0 Use clean_post_cache
3128 * @see clean_post_cache()
3129 *
3130 * @param int $id Page ID to clean
3131 */
3132function clean_page_cache( $id ) {
3133 _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' );
3134
3135 clean_post_cache( $id );
3136}
3137
3138/**
3139 * Retrieve nonce action "Are you sure" message.
3140 *
3141 * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3.
3142 *
3143 * @since 2.0.4
3144 * @deprecated 3.4.1 Use wp_nonce_ays()
3145 * @see wp_nonce_ays()
3146 *
3147 * @param string $action Nonce action.
3148 * @return string Are you sure message.
3149 */
3150function wp_explain_nonce( $action ) {
3151 _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' );
3152 return __( 'Are you sure you want to do this?' );
3153}
3154
3155/**
3156 * Display "sticky" CSS class, if a post is sticky.
3157 *
3158 * @since 2.7.0
3159 * @deprecated 3.5.0 Use post_class()
3160 * @see post_class()
3161 *
3162 * @param int $post_id An optional post ID.
3163 */
3164function sticky_class( $post_id = null ) {
3165 _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
3166 if ( is_sticky( $post_id ) )
3167 echo ' sticky';
3168}
3169
3170/**
3171 * Retrieve post ancestors.
3172 *
3173 * This is no longer needed as WP_Post lazy-loads the ancestors
3174 * property with get_post_ancestors().
3175 *
3176 * @since 2.3.4
3177 * @deprecated 3.5.0 Use get_post_ancestors()
3178 * @see get_post_ancestors()
3179 *
3180 * @param WP_Post $post Post object, passed by reference (unused).
3181 */
3182function _get_post_ancestors( &$post ) {
3183 _deprecated_function( __FUNCTION__, '3.5.0' );
3184}
3185
3186/**
3187 * Load an image from a string, if PHP supports it.
3188 *
3189 * @since 2.1.0
3190 * @deprecated 3.5.0 Use wp_get_image_editor()
3191 * @see wp_get_image_editor()
3192 *
3193 * @param string $file Filename of the image to load.
3194 * @return resource|GdImage|string The resulting image resource or GdImage instance on success,
3195 * error string on failure.
3196 */
3197function wp_load_image( $file ) {
3198 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3199
3200 if ( is_numeric( $file ) )
3201 $file = get_attached_file( $file );
3202
3203 if ( ! is_file( $file ) ) {
3204 /* translators: %s: File name. */
3205 return sprintf( __( 'File &#8220;%s&#8221; does not exist?' ), $file );
3206 }
3207
3208 if ( ! function_exists('imagecreatefromstring') )
3209 return __('The GD image library is not installed.');
3210
3211 // Set artificially high because GD uses uncompressed images in memory.
3212 wp_raise_memory_limit( 'image' );
3213
3214 $image = imagecreatefromstring( file_get_contents( $file ) );
3215
3216 if ( ! is_gd_image( $image ) ) {
3217 /* translators: %s: File name. */
3218 return sprintf( __( 'File &#8220;%s&#8221; is not an image.' ), $file );
3219 }
3220
3221 return $image;
3222}
3223
3224/**
3225 * Scale down an image to fit a particular size and save a new copy of the image.
3226 *
3227 * The PNG transparency will be preserved using the function, as well as the
3228 * image type. If the file going in is PNG, then the resized image is going to
3229 * be PNG. The only supported image types are PNG, GIF, and JPEG.
3230 *
3231 * Some functionality requires API to exist, so some PHP version may lose out
3232 * support. This is not the fault of WordPress (where functionality is
3233 * downgraded, not actual defects), but of your PHP version.
3234 *
3235 * @since 2.5.0
3236 * @deprecated 3.5.0 Use wp_get_image_editor()
3237 * @see wp_get_image_editor()
3238 *
3239 * @param string $file Image file path.
3240 * @param int $max_w Maximum width to resize to.
3241 * @param int $max_h Maximum height to resize to.
3242 * @param bool $crop Optional. Whether to crop image or resize. Default false.
3243 * @param string $suffix Optional. File suffix. Default null.
3244 * @param string $dest_path Optional. New image file path. Default null.
3245 * @param int $jpeg_quality Optional. Image quality percentage. Default 90.
3246 * @return mixed WP_Error on failure. String with new destination path.
3247 */
3248function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
3249 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3250
3251 $editor = wp_get_image_editor( $file );
3252 if ( is_wp_error( $editor ) )
3253 return $editor;
3254 $editor->set_quality( $jpeg_quality );
3255
3256 $resized = $editor->resize( $max_w, $max_h, $crop );
3257 if ( is_wp_error( $resized ) )
3258 return $resized;
3259
3260 $dest_file = $editor->generate_filename( $suffix, $dest_path );
3261 $saved = $editor->save( $dest_file );
3262
3263 if ( is_wp_error( $saved ) )
3264 return $saved;
3265
3266 return $dest_file;
3267}
3268
3269/**
3270 * Retrieve a single post, based on post ID.
3271 *
3272 * Has categories in 'post_category' property or key. Has tags in 'tags_input'
3273 * property or key.
3274 *
3275 * @since 1.0.0
3276 * @deprecated 3.5.0 Use get_post()
3277 * @see get_post()
3278 *
3279 * @param int $postid Post ID.
3280 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
3281 * @return WP_Post|null Post object or array holding post contents and information
3282 */
3283function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
3284 _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
3285 return get_post( $postid, $mode );
3286}
3287
3288/**
3289 * Check that the user login name and password is correct.
3290 *
3291 * @since 0.71
3292 * @deprecated 3.5.0 Use wp_authenticate()
3293 * @see wp_authenticate()
3294 *
3295 * @param string $user_login User name.
3296 * @param string $user_pass User password.
3297 * @return bool False if does not authenticate, true if username and password authenticates.
3298 */
3299function user_pass_ok($user_login, $user_pass) {
3300 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
3301 $user = wp_authenticate( $user_login, $user_pass );
3302 if ( is_wp_error( $user ) )
3303 return false;
3304
3305 return true;
3306}
3307
3308/**
3309 * Callback formerly fired on the save_post hook. No longer needed.
3310 *
3311 * @since 2.3.0
3312 * @deprecated 3.5.0
3313 */
3314function _save_post_hook() {}
3315
3316/**
3317 * Check if the installed version of GD supports particular image type
3318 *
3319 * @since 2.9.0
3320 * @deprecated 3.5.0 Use wp_image_editor_supports()
3321 * @see wp_image_editor_supports()
3322 *
3323 * @param string $mime_type
3324 * @return bool
3325 */
3326function gd_edit_image_support($mime_type) {
3327 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' );
3328
3329 if ( function_exists('imagetypes') ) {
3330 switch( $mime_type ) {
3331 case 'image/jpeg':
3332 return (imagetypes() & IMG_JPG) != 0;
3333 case 'image/png':
3334 return (imagetypes() & IMG_PNG) != 0;
3335 case 'image/gif':
3336 return (imagetypes() & IMG_GIF) != 0;
3337 case 'image/webp':
3338 return (imagetypes() & IMG_WEBP) != 0;
3339 case 'image/avif':
3340 return (imagetypes() & IMG_AVIF) != 0;
3341 }
3342 } else {
3343 switch( $mime_type ) {
3344 case 'image/jpeg':
3345 return function_exists('imagecreatefromjpeg');
3346 case 'image/png':
3347 return function_exists('imagecreatefrompng');
3348 case 'image/gif':
3349 return function_exists('imagecreatefromgif');
3350 case 'image/webp':
3351 return function_exists('imagecreatefromwebp');
3352 case 'image/avif':
3353 return function_exists('imagecreatefromavif');
3354 }
3355 }
3356 return false;
3357}
3358
3359/**
3360 * Converts an integer byte value to a shorthand byte value.
3361 *
3362 * @since 2.3.0
3363 * @deprecated 3.6.0 Use size_format()
3364 * @see size_format()
3365 *
3366 * @param int $bytes An integer byte value.
3367 * @return string A shorthand byte value.
3368 */
3369function wp_convert_bytes_to_hr( $bytes ) {
3370 _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' );
3371
3372 $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
3373 $log = log( $bytes, KB_IN_BYTES );
3374 $power = ! is_nan( $log ) && ! is_infinite( $log ) ? (int) $log : 0;
3375 $size = KB_IN_BYTES ** ( $log - $power );
3376
3377 if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
3378 $unit = $units[ $power ];
3379 } else {
3380 $size = $bytes;
3381 $unit = $units[0];
3382 }
3383
3384 return $size . $unit;
3385}
3386
3387/**
3388 * Formerly used internally to tidy up the search terms.
3389 *
3390 * @since 2.9.0
3391 * @access private
3392 * @deprecated 3.7.0
3393 *
3394 * @param string $t Search terms to "tidy", e.g. trim.
3395 * @return string Trimmed search terms.
3396 */
3397function _search_terms_tidy( $t ) {
3398 _deprecated_function( __FUNCTION__, '3.7.0' );
3399 return trim( $t, "\"'\n\r " );
3400}
3401
3402/**
3403 * Determine if TinyMCE is available.
3404 *
3405 * Checks to see if the user has deleted the tinymce files to slim down
3406 * their WordPress installation.
3407 *
3408 * @since 2.1.0
3409 * @deprecated 3.9.0
3410 *
3411 * @return bool Whether TinyMCE exists.
3412 */
3413function rich_edit_exists() {
3414 global $wp_rich_edit_exists;
3415 _deprecated_function( __FUNCTION__, '3.9.0' );
3416
3417 if ( ! isset( $wp_rich_edit_exists ) )
3418 $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3419
3420 return $wp_rich_edit_exists;
3421}
3422
3423/**
3424 * Old callback for tag link tooltips.
3425 *
3426 * @since 2.7.0
3427 * @access private
3428 * @deprecated 3.9.0
3429 *
3430 * @param int $count Number of topics.
3431 * @return int Number of topics.
3432 */
3433function default_topic_count_text( $count ) {
3434 return $count;
3435}
3436
3437/**
3438 * Formerly used to escape strings before inserting into the DB.
3439 *
3440 * Has not performed this function for many, many years. Use wpdb::prepare() instead.
3441 *
3442 * @since 0.71
3443 * @deprecated 3.9.0
3444 *
3445 * @param string $content The text to format.
3446 * @return string The very same text.
3447 */
3448function format_to_post( $content ) {
3449 _deprecated_function( __FUNCTION__, '3.9.0' );
3450 return $content;
3451}
3452
3453/**
3454 * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.
3455 *
3456 * @since 2.5.0
3457 * @deprecated 4.0.0 Use wpdb::esc_like()
3458 * @see wpdb::esc_like()
3459 *
3460 * @param string $text The text to be escaped.
3461 * @return string text, safe for inclusion in LIKE query.
3462 */
3463function like_escape($text) {
3464 _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' );
3465 return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
3466}
3467
3468/**
3469 * Determines if the URL can be accessed over SSL.
3470 *
3471 * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access
3472 * the URL using https as the scheme.
3473 *
3474 * @since 2.5.0
3475 * @deprecated 4.0.0
3476 *
3477 * @param string $url The URL to test.
3478 * @return bool Whether SSL access is available.
3479 */
3480function url_is_accessable_via_ssl( $url ) {
3481 _deprecated_function( __FUNCTION__, '4.0.0' );
3482
3483 $response = wp_remote_get( set_url_scheme( $url, 'https' ) );
3484
3485 if ( !is_wp_error( $response ) ) {
3486 $status = wp_remote_retrieve_response_code( $response );
3487 if ( 200 == $status || 401 == $status ) {
3488 return true;
3489 }
3490 }
3491
3492 return false;
3493}
3494
3495/**
3496 * Start preview theme output buffer.
3497 *
3498 * Will only perform task if the user has permissions and template and preview
3499 * query variables exist.
3500 *
3501 * @since 2.6.0
3502 * @deprecated 4.3.0
3503 */
3504function preview_theme() {
3505 _deprecated_function( __FUNCTION__, '4.3.0' );
3506}
3507
3508/**
3509 * Private function to modify the current template when previewing a theme
3510 *
3511 * @since 2.9.0
3512 * @deprecated 4.3.0
3513 * @access private
3514 *
3515 * @return string
3516 */
3517function _preview_theme_template_filter() {
3518 _deprecated_function( __FUNCTION__, '4.3.0' );
3519 return '';
3520}
3521
3522/**
3523 * Private function to modify the current stylesheet when previewing a theme
3524 *
3525 * @since 2.9.0
3526 * @deprecated 4.3.0
3527 * @access private
3528 *
3529 * @return string
3530 */
3531function _preview_theme_stylesheet_filter() {
3532 _deprecated_function( __FUNCTION__, '4.3.0' );
3533 return '';
3534}
3535
3536/**
3537 * Callback function for ob_start() to capture all links in the theme.
3538 *
3539 * @since 2.6.0
3540 * @deprecated 4.3.0
3541 * @access private
3542 *
3543 * @param string $content
3544 * @return string
3545 */
3546function preview_theme_ob_filter( $content ) {
3547 _deprecated_function( __FUNCTION__, '4.3.0' );
3548 return $content;
3549}
3550
3551/**
3552 * Manipulates preview theme links in order to control and maintain location.
3553 *
3554 * Callback function for preg_replace_callback() to accept and filter matches.
3555 *
3556 * @since 2.6.0
3557 * @deprecated 4.3.0
3558 * @access private
3559 *
3560 * @param array $matches
3561 * @return string
3562 */
3563function preview_theme_ob_filter_callback( $matches ) {
3564 _deprecated_function( __FUNCTION__, '4.3.0' );
3565 return '';
3566}
3567
3568/**
3569 * Formats text for the rich text editor.
3570 *
3571 * The {@see 'richedit_pre'} filter is applied here. If `$text` is empty the filter will
3572 * be applied to an empty string.
3573 *
3574 * @since 2.0.0
3575 * @deprecated 4.3.0 Use format_for_editor()
3576 * @see format_for_editor()
3577 *
3578 * @param string $text The text to be formatted.
3579 * @return string The formatted text after filter is applied.
3580 */
3581function wp_richedit_pre($text) {
3582 _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3583
3584 if ( empty( $text ) ) {
3585 /**
3586 * Filters text returned for the rich text editor.
3587 *
3588 * This filter is first evaluated, and the value returned, if an empty string
3589 * is passed to wp_richedit_pre(). If an empty string is passed, it results
3590 * in a break tag and line feed.
3591 *
3592 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
3593 * return after being formatted.
3594 *
3595 * @since 2.0.0
3596 * @deprecated 4.3.0
3597 *
3598 * @param string $output Text for the rich text editor.
3599 */
3600 return apply_filters( 'richedit_pre', '' );
3601 }
3602
3603 $output = convert_chars($text);
3604 $output = wpautop($output);
3605 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3606
3607 /** This filter is documented in wp-includes/deprecated.php */
3608 return apply_filters( 'richedit_pre', $output );
3609}
3610
3611/**
3612 * Formats text for the HTML editor.
3613 *
3614 * Unless $output is empty it will pass through htmlspecialchars before the
3615 * {@see 'htmledit_pre'} filter is applied.
3616 *
3617 * @since 2.5.0
3618 * @deprecated 4.3.0 Use format_for_editor()
3619 * @see format_for_editor()
3620 *
3621 * @param string $output The text to be formatted.
3622 * @return string Formatted text after filter applied.
3623 */
3624function wp_htmledit_pre($output) {
3625 _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3626
3627 if ( !empty($output) )
3628 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // Convert only '< > &'.
3629
3630 /**
3631 * Filters the text before it is formatted for the HTML editor.
3632 *
3633 * @since 2.5.0
3634 * @deprecated 4.3.0
3635 *
3636 * @param string $output The HTML-formatted text.
3637 */
3638 return apply_filters( 'htmledit_pre', $output );
3639}
3640
3641/**
3642 * Retrieve permalink from post ID.
3643 *
3644 * @since 1.0.0
3645 * @deprecated 4.4.0 Use get_permalink()
3646 * @see get_permalink()
3647 *
3648 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3649 * @return string|false
3650 */
3651function post_permalink( $post = 0 ) {
3652 _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' );
3653
3654 return get_permalink( $post );
3655}
3656
3657/**
3658 * Perform a HTTP HEAD or GET request.
3659 *
3660 * If $file_path is a writable filename, this will do a GET request and write
3661 * the file to that path.
3662 *
3663 * @since 2.5.0
3664 * @deprecated 4.4.0 Use WP_Http
3665 * @see WP_Http
3666 *
3667 * @param string $url URL to fetch.
3668 * @param string|bool $file_path Optional. File path to write request to. Default false.
3669 * @param int $red Optional. The number of Redirects followed, Upon 5 being hit,
3670 * returns false. Default 1.
3671 * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|false Headers on success, false on failure.
3672 */
3673function wp_get_http( $url, $file_path = false, $red = 1 ) {
3674 _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' );
3675
3676 // Add 60 seconds to the script timeout to ensure the remote request has enough time.
3677 if ( function_exists( 'set_time_limit' ) ) {
3678 @set_time_limit( 60 );
3679 }
3680
3681 if ( $red > 5 )
3682 return false;
3683
3684 $options = array();
3685 $options['redirection'] = 5;
3686
3687 if ( false == $file_path )
3688 $options['method'] = 'HEAD';
3689 else
3690 $options['method'] = 'GET';
3691
3692 $response = wp_safe_remote_request( $url, $options );
3693
3694 if ( is_wp_error( $response ) )
3695 return false;
3696
3697 $headers = wp_remote_retrieve_headers( $response );
3698 $headers['response'] = wp_remote_retrieve_response_code( $response );
3699
3700 // WP_HTTP no longer follows redirects for HEAD requests.
3701 if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
3702 return wp_get_http( $headers['location'], $file_path, ++$red );
3703 }
3704
3705 if ( false == $file_path )
3706 return $headers;
3707
3708 // GET request - write it to the supplied filename.
3709 $out_fp = fopen($file_path, 'w');
3710 if ( !$out_fp )
3711 return $headers;
3712
3713 fwrite( $out_fp, wp_remote_retrieve_body( $response ) );
3714 fclose($out_fp);
3715 clearstatcache();
3716
3717 return $headers;
3718}
3719
3720/**
3721 * Whether SSL login should be forced.
3722 *
3723 * @since 2.6.0
3724 * @deprecated 4.4.0 Use force_ssl_admin()
3725 * @see force_ssl_admin()
3726 *
3727 * @param string|bool $force Optional Whether to force SSL login. Default null.
3728 * @return bool True if forced, false if not forced.
3729 */
3730function force_ssl_login( $force = null ) {
3731 _deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' );
3732 return force_ssl_admin( $force );
3733}
3734
3735/**
3736 * Retrieve path of comment popup template in current or parent template.
3737 *
3738 * @since 1.5.0
3739 * @deprecated 4.5.0
3740 *
3741 * @return string Full path to comments popup template file.
3742 */
3743function get_comments_popup_template() {
3744 _deprecated_function( __FUNCTION__, '4.5.0' );
3745
3746 return '';
3747}
3748
3749/**
3750 * Determines whether the current URL is within the comments popup window.
3751 *
3752 * For more information on this and similar theme functions, check out
3753 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
3754 * Conditional Tags} article in the Theme Developer Handbook.
3755 *
3756 * @since 1.5.0
3757 * @deprecated 4.5.0
3758 *
3759 * @return false Always returns false.
3760 */
3761function is_comments_popup() {
3762 _deprecated_function( __FUNCTION__, '4.5.0' );
3763
3764 return false;
3765}
3766
3767/**
3768 * Display the JS popup script to show a comment.
3769 *
3770 * @since 0.71
3771 * @deprecated 4.5.0
3772 */
3773function comments_popup_script() {
3774 _deprecated_function( __FUNCTION__, '4.5.0' );
3775}
3776
3777/**
3778 * Adds element attributes to open links in new tabs.
3779 *
3780 * @since 0.71
3781 * @deprecated 4.5.0
3782 *
3783 * @param string $text Content to replace links to open in a new tab.
3784 * @return string Content that has filtered links.
3785 */
3786function popuplinks( $text ) {
3787 _deprecated_function( __FUNCTION__, '4.5.0' );
3788 $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
3789 return $text;
3790}
3791
3792/**
3793 * The Google Video embed handler callback.
3794 *
3795 * Deprecated function that previously assisted in turning Google Video URLs
3796 * into embeds but that service has since been shut down.
3797 *
3798 * @since 2.9.0
3799 * @deprecated 4.6.0
3800 *
3801 * @return string An empty string.
3802 */
3803function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {
3804 _deprecated_function( __FUNCTION__, '4.6.0' );
3805
3806 return '';
3807}
3808
3809/**
3810 * Retrieve path of paged template in current or parent template.
3811 *
3812 * @since 1.5.0
3813 * @deprecated 4.7.0 The paged.php template is no longer part of the theme template hierarchy.
3814 *
3815 * @return string Full path to paged template file.
3816 */
3817function get_paged_template() {
3818 _deprecated_function( __FUNCTION__, '4.7.0' );
3819
3820 return get_query_template( 'paged' );
3821}
3822
3823/**
3824 * Removes the HTML JavaScript entities found in early versions of Netscape 4.
3825 *
3826 * Previously, this function was pulled in from the original
3827 * import of kses and removed a specific vulnerability only
3828 * existent in early version of Netscape 4. However, this
3829 * vulnerability never affected any other browsers and can
3830 * be considered safe for the modern web.
3831 *
3832 * The regular expression which sanitized this vulnerability
3833 * has been removed in consideration of the performance and
3834 * energy demands it placed, now merely passing through its
3835 * input to the return.
3836 *
3837 * @since 1.0.0
3838 * @deprecated 4.7.0 Officially dropped security support for Netscape 4.
3839 *
3840 * @param string $content
3841 * @return string
3842 */
3843function wp_kses_js_entities( $content ) {
3844 _deprecated_function( __FUNCTION__, '4.7.0' );
3845
3846 return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $content );
3847}
3848
3849/**
3850 * Sort categories by ID.
3851 *
3852 * Used by usort() as a callback, should not be used directly. Can actually be
3853 * used to sort any term object.
3854 *
3855 * @since 2.3.0
3856 * @deprecated 4.7.0 Use wp_list_sort()
3857 * @access private
3858 *
3859 * @param object $a
3860 * @param object $b
3861 * @return int
3862 */
3863function _usort_terms_by_ID( $a, $b ) {
3864 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' );
3865
3866 if ( $a->term_id > $b->term_id )
3867 return 1;
3868 elseif ( $a->term_id < $b->term_id )
3869 return -1;
3870 else
3871 return 0;
3872}
3873
3874/**
3875 * Sort categories by name.
3876 *
3877 * Used by usort() as a callback, should not be used directly. Can actually be
3878 * used to sort any term object.
3879 *
3880 * @since 2.3.0
3881 * @deprecated 4.7.0 Use wp_list_sort()
3882 * @access private
3883 *
3884 * @param object $a
3885 * @param object $b
3886 * @return int
3887 */
3888function _usort_terms_by_name( $a, $b ) {
3889 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' );
3890
3891 return strcmp( $a->name, $b->name );
3892}
3893
3894/**
3895 * Sort menu items by the desired key.
3896 *
3897 * @since 3.0.0
3898 * @deprecated 4.7.0 Use wp_list_sort()
3899 * @access private
3900 *
3901 * @global string $_menu_item_sort_prop
3902 *
3903 * @param object $a The first object to compare
3904 * @param object $b The second object to compare
3905 * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b.
3906 */
3907function _sort_nav_menu_items( $a, $b ) {
3908 global $_menu_item_sort_prop;
3909
3910 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' );
3911
3912 if ( empty( $_menu_item_sort_prop ) )
3913 return 0;
3914
3915 if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) )
3916 return 0;
3917
3918 $_a = (int) $a->$_menu_item_sort_prop;
3919 $_b = (int) $b->$_menu_item_sort_prop;
3920
3921 if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop )
3922 return 0;
3923 elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop )
3924 return $_a < $_b ? -1 : 1;
3925 else
3926 return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
3927}
3928
3929/**
3930 * Retrieves the Press This bookmarklet link.
3931 *
3932 * @since 2.6.0
3933 * @deprecated 4.9.0
3934 * @return string
3935 */
3936function get_shortcut_link() {
3937 _deprecated_function( __FUNCTION__, '4.9.0' );
3938
3939 $link = '';
3940
3941 /**
3942 * Filters the Press This bookmarklet link.
3943 *
3944 * @since 2.6.0
3945 * @deprecated 4.9.0
3946 *
3947 * @param string $link The Press This bookmarklet link.
3948 */
3949 return apply_filters( 'shortcut_link', $link );
3950}
3951
3952/**
3953 * Ajax handler for saving a post from Press This.
3954 *
3955 * @since 4.2.0
3956 * @deprecated 4.9.0
3957 */
3958function wp_ajax_press_this_save_post() {
3959 _deprecated_function( __FUNCTION__, '4.9.0' );
3960 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
3961 include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
3962 $wp_press_this = new WP_Press_This_Plugin();
3963 $wp_press_this->save_post();
3964 } else {
3965 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
3966 }
3967}
3968
3969/**
3970 * Ajax handler for creating new category from Press This.
3971 *
3972 * @since 4.2.0
3973 * @deprecated 4.9.0
3974 */
3975function wp_ajax_press_this_add_category() {
3976 _deprecated_function( __FUNCTION__, '4.9.0' );
3977 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
3978 include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
3979 $wp_press_this = new WP_Press_This_Plugin();
3980 $wp_press_this->add_category();
3981 } else {
3982 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
3983 }
3984}
3985
3986/**
3987 * Return the user request object for the specified request ID.
3988 *
3989 * @since 4.9.6
3990 * @deprecated 5.4.0 Use wp_get_user_request()
3991 * @see wp_get_user_request()
3992 *
3993 * @param int $request_id The ID of the user request.
3994 * @return WP_User_Request|false
3995 */
3996function wp_get_user_request_data( $request_id ) {
3997 _deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' );
3998 return wp_get_user_request( $request_id );
3999}
4000
4001/**
4002 * Filters 'img' elements in post content to add 'srcset' and 'sizes' attributes.
4003 *
4004 * @since 4.4.0
4005 * @deprecated 5.5.0
4006 *
4007 * @see wp_image_add_srcset_and_sizes()
4008 *
4009 * @param string $content The raw post content to be filtered.
4010 * @return string Converted content with 'srcset' and 'sizes' attributes added to images.
4011 */
4012function wp_make_content_images_responsive( $content ) {
4013 _deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' );
4014
4015 // This will also add the `loading` attribute to `img` tags, if enabled.
4016 return wp_filter_content_tags( $content );
4017}
4018
4019/**
4020 * Turn register globals off.
4021 *
4022 * @since 2.1.0
4023 * @access private
4024 * @deprecated 5.5.0
4025 */
4026function wp_unregister_GLOBALS() {
4027 // register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4.
4028 _deprecated_function( __FUNCTION__, '5.5.0' );
4029}
4030
4031/**
4032 * Does comment contain disallowed characters or words.
4033 *
4034 * @since 1.5.0
4035 * @deprecated 5.5.0 Use wp_check_comment_disallowed_list() instead.
4036 * Please consider writing more inclusive code.
4037 *
4038 * @param string $author The author of the comment
4039 * @param string $email The email of the comment
4040 * @param string $url The url used in the comment
4041 * @param string $comment The comment content
4042 * @param string $user_ip The comment author's IP address
4043 * @param string $user_agent The author's browser user agent
4044 * @return bool True if comment contains disallowed content, false if comment does not
4045 */
4046function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) {
4047 _deprecated_function( __FUNCTION__, '5.5.0', 'wp_check_comment_disallowed_list()' );
4048
4049 return wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent );
4050}
4051
4052/**
4053 * Filters out `register_meta()` args based on an allowed list.
4054 *
4055 * `register_meta()` args may change over time, so requiring the allowed list
4056 * to be explicitly turned off is a warranty seal of sorts.
4057 *
4058 * @access private
4059 * @since 4.6.0
4060 * @deprecated 5.5.0 Use _wp_register_meta_args_allowed_list() instead.
4061 * Please consider writing more inclusive code.
4062 *
4063 * @param array $args Arguments from `register_meta()`.
4064 * @param array $default_args Default arguments for `register_meta()`.
4065 * @return array Filtered arguments.
4066 */
4067function _wp_register_meta_args_whitelist( $args, $default_args ) {
4068 _deprecated_function( __FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()' );
4069
4070 return _wp_register_meta_args_allowed_list( $args, $default_args );
4071}
4072
4073/**
4074 * Adds an array of options to the list of allowed options.
4075 *
4076 * @since 2.7.0
4077 * @deprecated 5.5.0 Use add_allowed_options() instead.
4078 * Please consider writing more inclusive code.
4079 *
4080 * @param array $new_options
4081 * @param string|array $options
4082 * @return array
4083 */
4084function add_option_whitelist( $new_options, $options = '' ) {
4085 _deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' );
4086
4087 return add_allowed_options( $new_options, $options );
4088}
4089
4090/**
4091 * Removes a list of options from the allowed options list.
4092 *
4093 * @since 2.7.0
4094 * @deprecated 5.5.0 Use remove_allowed_options() instead.
4095 * Please consider writing more inclusive code.
4096 *
4097 * @param array $del_options
4098 * @param string|array $options
4099 * @return array
4100 */
4101function remove_option_whitelist( $del_options, $options = '' ) {
4102 _deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' );
4103
4104 return remove_allowed_options( $del_options, $options );
4105}
4106
4107/**
4108 * Adds slashes to only string values in an array of values.
4109 *
4110 * This should be used when preparing data for core APIs that expect slashed data.
4111 * This should not be used to escape data going directly into an SQL query.
4112 *
4113 * @since 5.3.0
4114 * @deprecated 5.6.0 Use wp_slash()
4115 *
4116 * @see wp_slash()
4117 *
4118 * @param mixed $value Scalar or array of scalars.
4119 * @return mixed Slashes $value
4120 */
4121function wp_slash_strings_only( $value ) {
4122 return map_deep( $value, 'addslashes_strings_only' );
4123}
4124
4125/**
4126 * Adds slashes only if the provided value is a string.
4127 *
4128 * @since 5.3.0
4129 * @deprecated 5.6.0
4130 *
4131 * @see wp_slash()
4132 *
4133 * @param mixed $value
4134 * @return mixed
4135 */
4136function addslashes_strings_only( $value ) {
4137 return is_string( $value ) ? addslashes( $value ) : $value;
4138}
4139
4140/**
4141 * Displays a `noindex` meta tag if required by the blog configuration.
4142 *
4143 * If a blog is marked as not being public then the `noindex` meta tag will be
4144 * output to tell web robots not to index the page content.
4145 *
4146 * Typical usage is as a {@see 'wp_head'} callback:
4147 *
4148 * add_action( 'wp_head', 'noindex' );
4149 *
4150 * @see wp_no_robots()
4151 *
4152 * @since 2.1.0
4153 * @deprecated 5.7.0 Use wp_robots_noindex() instead on 'wp_robots' filter.
4154 */
4155function noindex() {
4156 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' );
4157
4158 // If the blog is not public, tell robots to go away.
4159 if ( '0' == get_option( 'blog_public' ) ) {
4160 wp_no_robots();
4161 }
4162}
4163
4164/**
4165 * Display a `noindex` meta tag.
4166 *
4167 * Outputs a `noindex` meta tag that tells web robots not to index the page content.
4168 *
4169 * Typical usage is as a {@see 'wp_head'} callback:
4170 *
4171 * add_action( 'wp_head', 'wp_no_robots' );
4172 *
4173 * @since 3.3.0
4174 * @since 5.3.0 Echo `noindex,nofollow` if search engine visibility is discouraged.
4175 * @deprecated 5.7.0 Use wp_robots_no_robots() instead on 'wp_robots' filter.
4176 */
4177function wp_no_robots() {
4178 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' );
4179
4180 if ( get_option( 'blog_public' ) ) {
4181 echo "<meta name='robots' content='noindex,follow' />\n";
4182 return;
4183 }
4184
4185 echo "<meta name='robots' content='noindex,nofollow' />\n";
4186}
4187
4188/**
4189 * Display a `noindex,noarchive` meta tag and referrer `strict-origin-when-cross-origin` meta tag.
4190 *
4191 * Outputs a `noindex,noarchive` meta tag that tells web robots not to index or cache the page content.
4192 * Outputs a referrer `strict-origin-when-cross-origin` meta tag that tells the browser not to send
4193 * the full URL as a referrer to other sites when cross-origin assets are loaded.
4194 *
4195 * Typical usage is as a {@see 'wp_head'} callback:
4196 *
4197 * add_action( 'wp_head', 'wp_sensitive_page_meta' );
4198 *
4199 * @since 5.0.1
4200 * @deprecated 5.7.0 Use wp_robots_sensitive_page() instead on 'wp_robots' filter
4201 * and wp_strict_cross_origin_referrer() on 'wp_head' action.
4202 *
4203 * @see wp_robots_sensitive_page()
4204 */
4205function wp_sensitive_page_meta() {
4206 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_sensitive_page()' );
4207
4208 ?>
4209 <meta name='robots' content='noindex,noarchive' />
4210 <?php
4211 wp_strict_cross_origin_referrer();
4212}
4213
4214/**
4215 * Render inner blocks from the `core/columns` block for generating an excerpt.
4216 *
4217 * @since 5.2.0
4218 * @access private
4219 * @deprecated 5.8.0 Use _excerpt_render_inner_blocks() introduced in 5.8.0.
4220 *
4221 * @see _excerpt_render_inner_blocks()
4222 *
4223 * @param array $columns The parsed columns block.
4224 * @param array $allowed_blocks The list of allowed inner blocks.
4225 * @return string The rendered inner blocks.
4226 */
4227function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) {
4228 _deprecated_function( __FUNCTION__, '5.8.0', '_excerpt_render_inner_blocks()' );
4229
4230 return _excerpt_render_inner_blocks( $columns, $allowed_blocks );
4231}
4232
4233/**
4234 * Renders the duotone filter SVG and returns the CSS filter property to
4235 * reference the rendered SVG.
4236 *
4237 * @since 5.9.0
4238 * @deprecated 5.9.1 Use wp_get_duotone_filter_property() introduced in 5.9.1.
4239 *
4240 * @see wp_get_duotone_filter_property()
4241 *
4242 * @param array $preset Duotone preset value as seen in theme.json.
4243 * @return string Duotone CSS filter property.
4244 */
4245function wp_render_duotone_filter_preset( $preset ) {
4246 _deprecated_function( __FUNCTION__, '5.9.1', 'wp_get_duotone_filter_property()' );
4247
4248 return wp_get_duotone_filter_property( $preset );
4249}
4250
4251/**
4252 * Checks whether serialization of the current block's border properties should occur.
4253 *
4254 * @since 5.8.0
4255 * @access private
4256 * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0.
4257 *
4258 * @see wp_should_skip_block_supports_serialization()
4259 *
4260 * @param WP_Block_Type $block_type Block type.
4261 * @return bool Whether serialization of the current block's border properties
4262 * should occur.
4263 */
4264function wp_skip_border_serialization( $block_type ) {
4265 _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
4266
4267 $border_support = isset( $block_type->supports['__experimentalBorder'] )
4268 ? $block_type->supports['__experimentalBorder']
4269 : false;
4270
4271 return is_array( $border_support ) &&
4272 array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
4273 $border_support['__experimentalSkipSerialization'];
4274}
4275
4276/**
4277 * Checks whether serialization of the current block's dimensions properties should occur.
4278 *
4279 * @since 5.9.0
4280 * @access private
4281 * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0.
4282 *
4283 * @see wp_should_skip_block_supports_serialization()
4284 *
4285 * @param WP_Block_type $block_type Block type.
4286 * @return bool Whether to serialize spacing support styles & classes.
4287 */
4288function wp_skip_dimensions_serialization( $block_type ) {
4289 _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
4290
4291 $dimensions_support = isset( $block_type->supports['__experimentalDimensions'] )
4292 ? $block_type->supports['__experimentalDimensions']
4293 : false;
4294
4295 return is_array( $dimensions_support ) &&
4296 array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
4297 $dimensions_support['__experimentalSkipSerialization'];
4298}
4299
4300/**
4301 * Checks whether serialization of the current block's spacing properties should occur.
4302 *
4303 * @since 5.9.0
4304 * @access private
4305 * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0.
4306 *
4307 * @see wp_should_skip_block_supports_serialization()
4308 *
4309 * @param WP_Block_Type $block_type Block type.
4310 * @return bool Whether to serialize spacing support styles & classes.
4311 */
4312function wp_skip_spacing_serialization( $block_type ) {
4313 _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
4314
4315 $spacing_support = isset( $block_type->supports['spacing'] )
4316 ? $block_type->supports['spacing']
4317 : false;
4318
4319 return is_array( $spacing_support ) &&
4320 array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&
4321 $spacing_support['__experimentalSkipSerialization'];
4322}
4323
4324/**
4325 * Inject the block editor assets that need to be loaded into the editor's iframe as an inline script.
4326 *
4327 * @since 5.8.0
4328 * @deprecated 6.0.0
4329 */
4330function wp_add_iframed_editor_assets_html() {
4331 _deprecated_function( __FUNCTION__, '6.0.0' );
4332}
4333
4334/**
4335 * Retrieves thumbnail for an attachment.
4336 * Note that this works only for the (very) old image metadata style where 'thumb' was set,
4337 * and the 'sizes' array did not exist. This function returns false for the newer image metadata style
4338 * despite that 'thumbnail' is present in the 'sizes' array.
4339 *
4340 * @since 2.1.0
4341 * @deprecated 6.1.0
4342 *
4343 * @param int $post_id Optional. Attachment ID. Default is the ID of the global `$post`.
4344 * @return string|false Thumbnail file path on success, false on failure.
4345 */
4346function wp_get_attachment_thumb_file( $post_id = 0 ) {
4347 _deprecated_function( __FUNCTION__, '6.1.0' );
4348
4349 $post_id = (int) $post_id;
4350 $post = get_post( $post_id );
4351
4352 if ( ! $post ) {
4353 return false;
4354 }
4355
4356 // Use $post->ID rather than $post_id as get_post() may have used the global $post object.
4357 $imagedata = wp_get_attachment_metadata( $post->ID );
4358
4359 if ( ! is_array( $imagedata ) ) {
4360 return false;
4361 }
4362
4363 $file = get_attached_file( $post->ID );
4364
4365 if ( ! empty( $imagedata['thumb'] ) ) {
4366 $thumbfile = str_replace( wp_basename( $file ), $imagedata['thumb'], $file );
4367 if ( file_exists( $thumbfile ) ) {
4368 /**
4369 * Filters the attachment thumbnail file path.
4370 *
4371 * @since 2.1.0
4372 *
4373 * @param string $thumbfile File path to the attachment thumbnail.
4374 * @param int $post_id Attachment ID.
4375 */
4376 return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
4377 }
4378 }
4379
4380 return false;
4381}
4382
4383/**
4384 * Gets the path to a translation file for loading a textdomain just in time.
4385 *
4386 * Caches the retrieved results internally.
4387 *
4388 * @since 4.7.0
4389 * @deprecated 6.1.0
4390 * @access private
4391 *
4392 * @see _load_textdomain_just_in_time()
4393 *
4394 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
4395 * @param bool $reset Whether to reset the internal cache. Used by the switch to locale functionality.
4396 * @return string|false The path to the translation file or false if no translation file was found.
4397 */
4398function _get_path_to_translation( $domain, $reset = false ) {
4399 _deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );
4400
4401 static $available_translations = array();
4402
4403 if ( true === $reset ) {
4404 $available_translations = array();
4405 }
4406
4407 if ( ! isset( $available_translations[ $domain ] ) ) {
4408 $available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain );
4409 }
4410
4411 return $available_translations[ $domain ];
4412}
4413
4414/**
4415 * Gets the path to a translation file in the languages directory for the current locale.
4416 *
4417 * Holds a cached list of available .mo files to improve performance.
4418 *
4419 * @since 4.7.0
4420 * @deprecated 6.1.0
4421 * @access private
4422 *
4423 * @see _get_path_to_translation()
4424 *
4425 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
4426 * @return string|false The path to the translation file or false if no translation file was found.
4427 */
4428function _get_path_to_translation_from_lang_dir( $domain ) {
4429 _deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );
4430
4431 static $cached_mofiles = null;
4432
4433 if ( null === $cached_mofiles ) {
4434 $cached_mofiles = array();
4435
4436 $locations = array(
4437 WP_LANG_DIR . '/plugins',
4438 WP_LANG_DIR . '/themes',
4439 );
4440
4441 foreach ( $locations as $location ) {
4442 $mofiles = glob( $location . '/*.mo' );
4443 if ( $mofiles ) {
4444 $cached_mofiles = array_merge( $cached_mofiles, $mofiles );
4445 }
4446 }
4447 }
4448
4449 $locale = determine_locale();
4450 $mofile = "{$domain}-{$locale}.mo";
4451
4452 $path = WP_LANG_DIR . '/plugins/' . $mofile;
4453 if ( in_array( $path, $cached_mofiles, true ) ) {
4454 return $path;
4455 }
4456
4457 $path = WP_LANG_DIR . '/themes/' . $mofile;
4458 if ( in_array( $path, $cached_mofiles, true ) ) {
4459 return $path;
4460 }
4461
4462 return false;
4463}
4464
4465/**
4466 * Allows multiple block styles.
4467 *
4468 * @since 5.9.0
4469 * @deprecated 6.1.0
4470 *
4471 * @param array $metadata Metadata for registering a block type.
4472 * @return array Metadata for registering a block type.
4473 */
4474function _wp_multiple_block_styles( $metadata ) {
4475 _deprecated_function( __FUNCTION__, '6.1.0' );
4476 return $metadata;
4477}
4478
4479/**
4480 * Generates an inline style for a typography feature e.g. text decoration,
4481 * text transform, and font style.
4482 *
4483 * @since 5.8.0
4484 * @access private
4485 * @deprecated 6.1.0 Use wp_style_engine_get_styles() introduced in 6.1.0.
4486 *
4487 * @see wp_style_engine_get_styles()
4488 *
4489 * @param array $attributes Block's attributes.
4490 * @param string $feature Key for the feature within the typography styles.
4491 * @param string $css_property Slug for the CSS property the inline style sets.
4492 * @return string CSS inline style.
4493 */
4494function wp_typography_get_css_variable_inline_style( $attributes, $feature, $css_property ) {
4495 _deprecated_function( __FUNCTION__, '6.1.0', 'wp_style_engine_get_styles()' );
4496
4497 // Retrieve current attribute value or skip if not found.
4498 $style_value = _wp_array_get( $attributes, array( 'style', 'typography', $feature ), false );
4499 if ( ! $style_value ) {
4500 return;
4501 }
4502
4503 // If we don't have a preset CSS variable, we'll assume it's a regular CSS value.
4504 if ( ! str_contains( $style_value, "var:preset|{$css_property}|" ) ) {
4505 return sprintf( '%s:%s;', $css_property, $style_value );
4506 }
4507
4508 /*
4509 * We have a preset CSS variable as the style.
4510 * Get the style value from the string and return CSS style.
4511 */
4512 $index_to_splice = strrpos( $style_value, '|' ) + 1;
4513 $slug = substr( $style_value, $index_to_splice );
4514
4515 // Return the actual CSS inline style e.g. `text-decoration:var(--wp--preset--text-decoration--underline);`.
4516 return sprintf( '%s:var(--wp--preset--%s--%s);', $css_property, $css_property, $slug );
4517}
4518
4519/**
4520 * Determines whether global terms are enabled.
4521 *
4522 * @since 3.0.0
4523 * @since 6.1.0 This function now always returns false.
4524 * @deprecated 6.1.0
4525 *
4526 * @return bool Always returns false.
4527 */
4528function global_terms_enabled() {
4529 _deprecated_function( __FUNCTION__, '6.1.0' );
4530
4531 return false;
4532}
4533
4534/**
4535 * Filter the SQL clauses of an attachment query to include filenames.
4536 *
4537 * @since 4.7.0
4538 * @deprecated 6.0.3
4539 * @access private
4540 *
4541 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
4542 * DISTINCT, fields (SELECT), and LIMITS clauses.
4543 * @return array The unmodified clauses.
4544 */
4545function _filter_query_attachment_filenames( $clauses ) {
4546 _deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
4547 remove_filter( 'posts_clauses', __FUNCTION__ );
4548 return $clauses;
4549}
4550
4551/**
4552 * Retrieves a page given its title.
4553 *
4554 * If more than one post uses the same title, the post with the smallest ID will be returned.
4555 * Be careful: in case of more than one post having the same title, it will check the oldest
4556 * publication date, not the smallest ID.
4557 *
4558 * Because this function uses the MySQL '=' comparison, $page_title will usually be matched
4559 * as case-insensitive with default collation.
4560 *
4561 * @since 2.1.0
4562 * @since 3.0.0 The `$post_type` parameter was added.
4563 * @deprecated 6.2.0 Use WP_Query.
4564 *
4565 * @global wpdb $wpdb WordPress database abstraction object.
4566 *
4567 * @param string $page_title Page title.
4568 * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
4569 * correspond to a WP_Post object, an associative array, or a numeric array,
4570 * respectively. Default OBJECT.
4571 * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
4572 * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
4573 */
4574function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
4575 _deprecated_function( __FUNCTION__, '6.2.0', 'WP_Query' );
4576 global $wpdb;
4577
4578 if ( is_array( $post_type ) ) {
4579 $post_type = esc_sql( $post_type );
4580 $post_type_in_string = "'" . implode( "','", $post_type ) . "'";
4581 $sql = $wpdb->prepare(
4582 "SELECT ID
4583 FROM $wpdb->posts
4584 WHERE post_title = %s
4585 AND post_type IN ($post_type_in_string)",
4586 $page_title
4587 );
4588 } else {
4589 $sql = $wpdb->prepare(
4590 "SELECT ID
4591 FROM $wpdb->posts
4592 WHERE post_title = %s
4593 AND post_type = %s",
4594 $page_title,
4595 $post_type
4596 );
4597 }
4598
4599 $page = $wpdb->get_var( $sql );
4600
4601 if ( $page ) {
4602 return get_post( $page, $output );
4603 }
4604
4605 return null;
4606}
4607
4608/**
4609 * Returns the correct template for the site's home page.
4610 *
4611 * @access private
4612 * @since 6.0.0
4613 * @deprecated 6.2.0 Site Editor's server-side redirect for missing postType and postId
4614 * query args is removed. Thus, this function is no longer used.
4615 *
4616 * @return array|null A template object, or null if none could be found.
4617 */
4618function _resolve_home_block_template() {
4619 _deprecated_function( __FUNCTION__, '6.2.0' );
4620
4621 $show_on_front = get_option( 'show_on_front' );
4622 $front_page_id = get_option( 'page_on_front' );
4623
4624 if ( 'page' === $show_on_front && $front_page_id ) {
4625 return array(
4626 'postType' => 'page',
4627 'postId' => $front_page_id,
4628 );
4629 }
4630
4631 $hierarchy = array( 'front-page', 'home', 'index' );
4632 $template = resolve_block_template( 'home', $hierarchy, '' );
4633
4634 if ( ! $template ) {
4635 return null;
4636 }
4637
4638 return array(
4639 'postType' => 'wp_template',
4640 'postId' => $template->id,
4641 );
4642}
4643
4644/**
4645 * Displays the link to the Windows Live Writer manifest file.
4646 *
4647 * @link https://msdn.microsoft.com/en-us/library/bb463265.aspx
4648 * @since 2.3.1
4649 * @deprecated 6.3.0 WLW manifest is no longer in use and no longer included in core,
4650 * so the output from this function is removed.
4651 */
4652function wlwmanifest_link() {
4653 _deprecated_function( __FUNCTION__, '6.3.0' );
4654}
4655
4656/**
4657 * Queues comments for metadata lazy-loading.
4658 *
4659 * @since 4.5.0
4660 * @deprecated 6.3.0 Use wp_lazyload_comment_meta() instead.
4661 *
4662 * @param WP_Comment[] $comments Array of comment objects.
4663 */
4664function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
4665 _deprecated_function( __FUNCTION__, '6.3.0', 'wp_lazyload_comment_meta()' );
4666 // Don't use `wp_list_pluck()` to avoid by-reference manipulation.
4667 $comment_ids = array();
4668 if ( is_array( $comments ) ) {
4669 foreach ( $comments as $comment ) {
4670 if ( $comment instanceof WP_Comment ) {
4671 $comment_ids[] = $comment->comment_ID;
4672 }
4673 }
4674 }
4675
4676 wp_lazyload_comment_meta( $comment_ids );
4677}
4678
4679/**
4680 * Gets the default value to use for a `loading` attribute on an element.
4681 *
4682 * This function should only be called for a tag and context if lazy-loading is generally enabled.
4683 *
4684 * The function usually returns 'lazy', but uses certain heuristics to guess whether the current element is likely to
4685 * appear above the fold, in which case it returns a boolean `false`, which will lead to the `loading` attribute being
4686 * omitted on the element. The purpose of this refinement is to avoid lazy-loading elements that are within the initial
4687 * viewport, which can have a negative performance impact.
4688 *
4689 * Under the hood, the function uses {@see wp_increase_content_media_count()} every time it is called for an element
4690 * within the main content. If the element is the very first content element, the `loading` attribute will be omitted.
4691 * This default threshold of 3 content elements to omit the `loading` attribute for can be customized using the
4692 * {@see 'wp_omit_loading_attr_threshold'} filter.
4693 *
4694 * @since 5.9.0
4695 * @deprecated 6.3.0 Use wp_get_loading_optimization_attributes() instead.
4696 * @see wp_get_loading_optimization_attributes()
4697 *
4698 * @global WP_Query $wp_query WordPress Query object.
4699 *
4700 * @param string $context Context for the element for which the `loading` attribute value is requested.
4701 * @return string|bool The default `loading` attribute value. Either 'lazy', 'eager', or a boolean `false`, to indicate
4702 * that the `loading` attribute should be skipped.
4703 */
4704function wp_get_loading_attr_default( $context ) {
4705 _deprecated_function( __FUNCTION__, '6.3.0', 'wp_get_loading_optimization_attributes()' );
4706 global $wp_query;
4707
4708 // Skip lazy-loading for the overall block template, as it is handled more granularly.
4709 if ( 'template' === $context ) {
4710 return false;
4711 }
4712
4713 /*
4714 * Do not lazy-load images in the header block template part, as they are likely above the fold.
4715 * For classic themes, this is handled in the condition below using the 'get_header' action.
4716 */
4717 $header_area = WP_TEMPLATE_PART_AREA_HEADER;
4718 if ( "template_part_{$header_area}" === $context ) {
4719 return false;
4720 }
4721
4722 // Special handling for programmatically created image tags.
4723 if ( 'the_post_thumbnail' === $context || 'wp_get_attachment_image' === $context ) {
4724 /*
4725 * Skip programmatically created images within post content as they need to be handled together with the other
4726 * images within the post content.
4727 * Without this clause, they would already be counted below which skews the number and can result in the first
4728 * post content image being lazy-loaded only because there are images elsewhere in the post content.
4729 */
4730 if ( doing_filter( 'the_content' ) ) {
4731 return false;
4732 }
4733
4734 // Conditionally skip lazy-loading on images before the loop.
4735 if (
4736 // Only apply for main query but before the loop.
4737 $wp_query->before_loop && $wp_query->is_main_query()
4738 /*
4739 * Any image before the loop, but after the header has started should not be lazy-loaded,
4740 * except when the footer has already started which can happen when the current template
4741 * does not include any loop.
4742 */
4743 && did_action( 'get_header' ) && ! did_action( 'get_footer' )
4744 ) {
4745 return false;
4746 }
4747 }
4748
4749 /*
4750 * The first elements in 'the_content' or 'the_post_thumbnail' should not be lazy-loaded,
4751 * as they are likely above the fold.
4752 */
4753 if ( 'the_content' === $context || 'the_post_thumbnail' === $context ) {
4754 // Only elements within the main query loop have special handling.
4755 if ( is_admin() || ! in_the_loop() || ! is_main_query() ) {
4756 return 'lazy';
4757 }
4758
4759 // Increase the counter since this is a main query content element.
4760 $content_media_count = wp_increase_content_media_count();
4761
4762 // If the count so far is below the threshold, return `false` so that the `loading` attribute is omitted.
4763 if ( $content_media_count <= wp_omit_loading_attr_threshold() ) {
4764 return false;
4765 }
4766
4767 // For elements after the threshold, lazy-load them as usual.
4768 return 'lazy';
4769 }
4770
4771 // Lazy-load by default for any unknown context.
4772 return 'lazy';
4773}
4774
4775/**
4776 * Adds `loading` attribute to an `img` HTML tag.
4777 *
4778 * @since 5.5.0
4779 * @deprecated 6.3.0 Use wp_img_tag_add_loading_optimization_attrs() instead.
4780 * @see wp_img_tag_add_loading_optimization_attrs()
4781 *
4782 * @param string $image The HTML `img` tag where the attribute should be added.
4783 * @param string $context Additional context to pass to the filters.
4784 * @return string Converted `img` tag with `loading` attribute added.
4785 */
4786function wp_img_tag_add_loading_attr( $image, $context ) {
4787 _deprecated_function( __FUNCTION__, '6.3.0', 'wp_img_tag_add_loading_optimization_attrs()' );
4788 /*
4789 * Get loading attribute value to use. This must occur before the conditional check below so that even images that
4790 * are ineligible for being lazy-loaded are considered.
4791 */
4792 $value = wp_get_loading_attr_default( $context );
4793
4794 // Images should have source and dimension attributes for the `loading` attribute to be added.
4795 if ( ! str_contains( $image, ' src="' ) || ! str_contains( $image, ' width="' ) || ! str_contains( $image, ' height="' ) ) {
4796 return $image;
4797 }
4798
4799 /** This filter is documented in wp-admin/includes/media.php */
4800 $value = apply_filters( 'wp_img_tag_add_loading_attr', $value, $image, $context );
4801
4802 if ( $value ) {
4803 if ( ! in_array( $value, array( 'lazy', 'eager' ), true ) ) {
4804 $value = 'lazy';
4805 }
4806
4807 return str_replace( '<img', '<img loading="' . esc_attr( $value ) . '"', $image );
4808 }
4809
4810 return $image;
4811}
4812
4813/**
4814 * Takes input from [0, n] and returns it as [0, 1].
4815 *
4816 * Direct port of TinyColor's function, lightly simplified to maintain
4817 * consistency with TinyColor.
4818 *
4819 * @link https://github.com/bgrins/TinyColor
4820 *
4821 * @since 5.8.0
4822 * @deprecated 6.3.0
4823 *
4824 * @access private
4825 *
4826 * @param mixed $n Number of unknown type.
4827 * @param int $max Upper value of the range to bound to.
4828 * @return float Value in the range [0, 1].
4829 */
4830function wp_tinycolor_bound01( $n, $max ) {
4831 _deprecated_function( __FUNCTION__, '6.3.0' );
4832 if ( 'string' === gettype( $n ) && str_contains( $n, '.' ) && 1 === (float) $n ) {
4833 $n = '100%';
4834 }
4835
4836 $n = min( $max, max( 0, (float) $n ) );
4837
4838 // Automatically convert percentage into number.
4839 if ( 'string' === gettype( $n ) && str_contains( $n, '%' ) ) {
4840 $n = (int) ( $n * $max ) / 100;
4841 }
4842
4843 // Handle floating point rounding errors.
4844 if ( ( abs( $n - $max ) < 0.000001 ) ) {
4845 return 1.0;
4846 }
4847
4848 // Convert into [0, 1] range if it isn't already.
4849 return ( $n % $max ) / (float) $max;
4850}
4851
4852/**
4853 * Direct port of tinycolor's boundAlpha function to maintain consistency with
4854 * how tinycolor works.
4855 *
4856 * @link https://github.com/bgrins/TinyColor
4857 *
4858 * @since 5.9.0
4859 * @deprecated 6.3.0
4860 *
4861 * @access private
4862 *
4863 * @param mixed $n Number of unknown type.
4864 * @return float Value in the range [0,1].
4865 */
4866function _wp_tinycolor_bound_alpha( $n ) {
4867 _deprecated_function( __FUNCTION__, '6.3.0' );
4868
4869 if ( is_numeric( $n ) ) {
4870 $n = (float) $n;
4871 if ( $n >= 0 && $n <= 1 ) {
4872 return $n;
4873 }
4874 }
4875 return 1;
4876}
4877
4878/**
4879 * Rounds and converts values of an RGB object.
4880 *
4881 * Direct port of TinyColor's function, lightly simplified to maintain
4882 * consistency with TinyColor.
4883 *
4884 * @link https://github.com/bgrins/TinyColor
4885 *
4886 * @since 5.8.0
4887 * @deprecated 6.3.0
4888 *
4889 * @access private
4890 *
4891 * @param array $rgb_color RGB object.
4892 * @return array Rounded and converted RGB object.
4893 */
4894function wp_tinycolor_rgb_to_rgb( $rgb_color ) {
4895 _deprecated_function( __FUNCTION__, '6.3.0' );
4896
4897 return array(
4898 'r' => wp_tinycolor_bound01( $rgb_color['r'], 255 ) * 255,
4899 'g' => wp_tinycolor_bound01( $rgb_color['g'], 255 ) * 255,
4900 'b' => wp_tinycolor_bound01( $rgb_color['b'], 255 ) * 255,
4901 );
4902}
4903
4904/**
4905 * Helper function for hsl to rgb conversion.
4906 *
4907 * Direct port of TinyColor's function, lightly simplified to maintain
4908 * consistency with TinyColor.
4909 *
4910 * @link https://github.com/bgrins/TinyColor
4911 *
4912 * @since 5.8.0
4913 * @deprecated 6.3.0
4914 *
4915 * @access private
4916 *
4917 * @param float $p first component.
4918 * @param float $q second component.
4919 * @param float $t third component.
4920 * @return float R, G, or B component.
4921 */
4922function wp_tinycolor_hue_to_rgb( $p, $q, $t ) {
4923 _deprecated_function( __FUNCTION__, '6.3.0' );
4924
4925 if ( $t < 0 ) {
4926 ++$t;
4927 }
4928 if ( $t > 1 ) {
4929 --$t;
4930 }
4931 if ( $t < 1 / 6 ) {
4932 return $p + ( $q - $p ) * 6 * $t;
4933 }
4934 if ( $t < 1 / 2 ) {
4935 return $q;
4936 }
4937 if ( $t < 2 / 3 ) {
4938 return $p + ( $q - $p ) * ( 2 / 3 - $t ) * 6;
4939 }
4940 return $p;
4941}
4942
4943/**
4944 * Converts an HSL object to an RGB object with converted and rounded values.
4945 *
4946 * Direct port of TinyColor's function, lightly simplified to maintain
4947 * consistency with TinyColor.
4948 *
4949 * @link https://github.com/bgrins/TinyColor
4950 *
4951 * @since 5.8.0
4952 * @deprecated 6.3.0
4953 *
4954 * @access private
4955 *
4956 * @param array $hsl_color HSL object.
4957 * @return array Rounded and converted RGB object.
4958 */
4959function wp_tinycolor_hsl_to_rgb( $hsl_color ) {
4960 _deprecated_function( __FUNCTION__, '6.3.0' );
4961
4962 $h = wp_tinycolor_bound01( $hsl_color['h'], 360 );
4963 $s = wp_tinycolor_bound01( $hsl_color['s'], 100 );
4964 $l = wp_tinycolor_bound01( $hsl_color['l'], 100 );
4965
4966 if ( 0 === $s ) {
4967 // Achromatic.
4968 $r = $l;
4969 $g = $l;
4970 $b = $l;
4971 } else {
4972 $q = $l < 0.5 ? $l * ( 1 + $s ) : $l + $s - $l * $s;
4973 $p = 2 * $l - $q;
4974 $r = wp_tinycolor_hue_to_rgb( $p, $q, $h + 1 / 3 );
4975 $g = wp_tinycolor_hue_to_rgb( $p, $q, $h );
4976 $b = wp_tinycolor_hue_to_rgb( $p, $q, $h - 1 / 3 );
4977 }
4978
4979 return array(
4980 'r' => $r * 255,
4981 'g' => $g * 255,
4982 'b' => $b * 255,
4983 );
4984}
4985
4986/**
4987 * Parses hex, hsl, and rgb CSS strings using the same regex as TinyColor v1.4.2
4988 * used in the JavaScript. Only colors output from react-color are implemented.
4989 *
4990 * Direct port of TinyColor's function, lightly simplified to maintain
4991 * consistency with TinyColor.
4992 *
4993 * @link https://github.com/bgrins/TinyColor
4994 * @link https://github.com/casesandberg/react-color/
4995 *
4996 * @since 5.8.0
4997 * @since 5.9.0 Added alpha processing.
4998 * @deprecated 6.3.0
4999 *
5000 * @access private
5001 *
5002 * @param string $color_str CSS color string.
5003 * @return array RGB object.
5004 */
5005function wp_tinycolor_string_to_rgb( $color_str ) {
5006 _deprecated_function( __FUNCTION__, '6.3.0' );
5007
5008 $color_str = strtolower( trim( $color_str ) );
5009
5010 $css_integer = '[-\\+]?\\d+%?';
5011 $css_number = '[-\\+]?\\d*\\.\\d+%?';
5012
5013 $css_unit = '(?:' . $css_number . ')|(?:' . $css_integer . ')';
5014
5015 $permissive_match3 = '[\\s|\\(]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')\\s*\\)?';
5016 $permissive_match4 = '[\\s|\\(]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')[,|\\s]+(' . $css_unit . ')\\s*\\)?';
5017
5018 $rgb_regexp = '/^rgb' . $permissive_match3 . '$/';
5019 if ( preg_match( $rgb_regexp, $color_str, $match ) ) {
5020 $rgb = wp_tinycolor_rgb_to_rgb(
5021 array(
5022 'r' => $match[1],
5023 'g' => $match[2],
5024 'b' => $match[3],
5025 )
5026 );
5027
5028 $rgb['a'] = 1;
5029
5030 return $rgb;
5031 }
5032
5033 $rgba_regexp = '/^rgba' . $permissive_match4 . '$/';
5034 if ( preg_match( $rgba_regexp, $color_str, $match ) ) {
5035 $rgb = wp_tinycolor_rgb_to_rgb(
5036 array(
5037 'r' => $match[1],
5038 'g' => $match[2],
5039 'b' => $match[3],
5040 )
5041 );
5042
5043 $rgb['a'] = _wp_tinycolor_bound_alpha( $match[4] );
5044
5045 return $rgb;
5046 }
5047
5048 $hsl_regexp = '/^hsl' . $permissive_match3 . '$/';
5049 if ( preg_match( $hsl_regexp, $color_str, $match ) ) {
5050 $rgb = wp_tinycolor_hsl_to_rgb(
5051 array(
5052 'h' => $match[1],
5053 's' => $match[2],
5054 'l' => $match[3],
5055 )
5056 );
5057
5058 $rgb['a'] = 1;
5059
5060 return $rgb;
5061 }
5062
5063 $hsla_regexp = '/^hsla' . $permissive_match4 . '$/';
5064 if ( preg_match( $hsla_regexp, $color_str, $match ) ) {
5065 $rgb = wp_tinycolor_hsl_to_rgb(
5066 array(
5067 'h' => $match[1],
5068 's' => $match[2],
5069 'l' => $match[3],
5070 )
5071 );
5072
5073 $rgb['a'] = _wp_tinycolor_bound_alpha( $match[4] );
5074
5075 return $rgb;
5076 }
5077
5078 $hex8_regexp = '/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/';
5079 if ( preg_match( $hex8_regexp, $color_str, $match ) ) {
5080 $rgb = wp_tinycolor_rgb_to_rgb(
5081 array(
5082 'r' => base_convert( $match[1], 16, 10 ),
5083 'g' => base_convert( $match[2], 16, 10 ),
5084 'b' => base_convert( $match[3], 16, 10 ),
5085 )
5086 );
5087
5088 $rgb['a'] = _wp_tinycolor_bound_alpha(
5089 base_convert( $match[4], 16, 10 ) / 255
5090 );
5091
5092 return $rgb;
5093 }
5094
5095 $hex6_regexp = '/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/';
5096 if ( preg_match( $hex6_regexp, $color_str, $match ) ) {
5097 $rgb = wp_tinycolor_rgb_to_rgb(
5098 array(
5099 'r' => base_convert( $match[1], 16, 10 ),
5100 'g' => base_convert( $match[2], 16, 10 ),
5101 'b' => base_convert( $match[3], 16, 10 ),
5102 )
5103 );
5104
5105 $rgb['a'] = 1;
5106
5107 return $rgb;
5108 }
5109
5110 $hex4_regexp = '/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/';
5111 if ( preg_match( $hex4_regexp, $color_str, $match ) ) {
5112 $rgb = wp_tinycolor_rgb_to_rgb(
5113 array(
5114 'r' => base_convert( $match[1] . $match[1], 16, 10 ),
5115 'g' => base_convert( $match[2] . $match[2], 16, 10 ),
5116 'b' => base_convert( $match[3] . $match[3], 16, 10 ),
5117 )
5118 );
5119
5120 $rgb['a'] = _wp_tinycolor_bound_alpha(
5121 base_convert( $match[4] . $match[4], 16, 10 ) / 255
5122 );
5123
5124 return $rgb;
5125 }
5126
5127 $hex3_regexp = '/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/';
5128 if ( preg_match( $hex3_regexp, $color_str, $match ) ) {
5129 $rgb = wp_tinycolor_rgb_to_rgb(
5130 array(
5131 'r' => base_convert( $match[1] . $match[1], 16, 10 ),
5132 'g' => base_convert( $match[2] . $match[2], 16, 10 ),
5133 'b' => base_convert( $match[3] . $match[3], 16, 10 ),
5134 )
5135 );
5136
5137 $rgb['a'] = 1;
5138
5139 return $rgb;
5140 }
5141
5142 /*
5143 * The JS color picker considers the string "transparent" to be a hex value,
5144 * so we need to handle it here as a special case.
5145 */
5146 if ( 'transparent' === $color_str ) {
5147 return array(
5148 'r' => 0,
5149 'g' => 0,
5150 'b' => 0,
5151 'a' => 0,
5152 );
5153 }
5154}
5155
5156/**
5157 * Returns the prefixed id for the duotone filter for use as a CSS id.
5158 *
5159 * @since 5.9.1
5160 * @deprecated 6.3.0
5161 *
5162 * @access private
5163 *
5164 * @param array $preset Duotone preset value as seen in theme.json.
5165 * @return string Duotone filter CSS id.
5166 */
5167function wp_get_duotone_filter_id( $preset ) {
5168 _deprecated_function( __FUNCTION__, '6.3.0' );
5169 return WP_Duotone::get_filter_id_from_preset( $preset );
5170}
5171
5172/**
5173 * Returns the CSS filter property url to reference the rendered SVG.
5174 *
5175 * @since 5.9.0
5176 * @since 6.1.0 Allow unset for preset colors.
5177 * @deprecated 6.3.0
5178 *
5179 * @access private
5180 *
5181 * @param array $preset Duotone preset value as seen in theme.json.
5182 * @return string Duotone CSS filter property url value.
5183 */
5184function wp_get_duotone_filter_property( $preset ) {
5185 _deprecated_function( __FUNCTION__, '6.3.0' );
5186 return WP_Duotone::get_filter_css_property_value_from_preset( $preset );
5187}
5188
5189/**
5190 * Returns the duotone filter SVG string for the preset.
5191 *
5192 * @since 5.9.1
5193 * @deprecated 6.3.0 Use WP_Duotone::get_filter_svg_from_preset() instead.
5194 *
5195 * @access private
5196 *
5197 * @param array $preset Duotone preset value as seen in theme.json.
5198 * @return string Duotone SVG filter.
5199 */
5200function wp_get_duotone_filter_svg( $preset ) {
5201 _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::get_filter_svg_from_preset()' );
5202 return WP_Duotone::get_filter_svg_from_preset( $preset );
5203}
5204
5205/**
5206 * Registers the style and colors block attributes for block types that support it.
5207 *
5208 * @since 5.8.0
5209 * @deprecated 6.3.0 Use WP_Duotone::register_duotone_support() instead.
5210 *
5211 * @access private
5212 *
5213 * @param WP_Block_Type $block_type Block Type.
5214 */
5215function wp_register_duotone_support( $block_type ) {
5216 _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::register_duotone_support()' );
5217 return WP_Duotone::register_duotone_support( $block_type );
5218}
5219
5220/**
5221 * Renders out the duotone stylesheet and SVG.
5222 *
5223 * @since 5.8.0
5224 * @since 6.1.0 Allow unset for preset colors.
5225 * @deprecated 6.3.0 Use WP_Duotone::render_duotone_support() instead.
5226 *
5227 * @access private
5228 *
5229 * @param string $block_content Rendered block content.
5230 * @param array $block Block object.
5231 * @return string Filtered block content.
5232 */
5233function wp_render_duotone_support( $block_content, $block ) {
5234 _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::render_duotone_support()' );
5235 $wp_block = new WP_Block( $block );
5236 return WP_Duotone::render_duotone_support( $block_content, $block, $wp_block );
5237}
5238
5239/**
5240 * Returns a string containing the SVGs to be referenced as filters (duotone).
5241 *
5242 * @since 5.9.1
5243 * @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
5244 *
5245 * @return string
5246 */
5247function wp_get_global_styles_svg_filters() {
5248 _deprecated_function( __FUNCTION__, '6.3.0' );
5249
5250 /*
5251 * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
5252 * developer's workflow.
5253 */
5254 $can_use_cached = ! wp_is_development_mode( 'theme' );
5255 $cache_group = 'theme_json';
5256 $cache_key = 'wp_get_global_styles_svg_filters';
5257 if ( $can_use_cached ) {
5258 $cached = wp_cache_get( $cache_key, $cache_group );
5259 if ( $cached ) {
5260 return $cached;
5261 }
5262 }
5263
5264 $supports_theme_json = wp_theme_has_theme_json();
5265
5266 $origins = array( 'default', 'theme', 'custom' );
5267 if ( ! $supports_theme_json ) {
5268 $origins = array( 'default' );
5269 }
5270
5271 $tree = WP_Theme_JSON_Resolver::get_merged_data();
5272 $svgs = $tree->get_svg_filters( $origins );
5273
5274 if ( $can_use_cached ) {
5275 wp_cache_set( $cache_key, $svgs, $cache_group );
5276 }
5277
5278 return $svgs;
5279}
5280
5281/**
5282 * Renders the SVG filters supplied by theme.json.
5283 *
5284 * Note that this doesn't render the per-block user-defined
5285 * filters which are handled by wp_render_duotone_support,
5286 * but it should be rendered before the filtered content
5287 * in the body to satisfy Safari's rendering quirks.
5288 *
5289 * @since 5.9.1
5290 * @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
5291 */
5292function wp_global_styles_render_svg_filters() {
5293 _deprecated_function( __FUNCTION__, '6.3.0' );
5294
5295 /*
5296 * When calling via the in_admin_header action, we only want to render the
5297 * SVGs on block editor pages.
5298 */
5299 if (
5300 is_admin() &&
5301 ! get_current_screen()->is_block_editor()
5302 ) {
5303 return;
5304 }
5305
5306 $filters = wp_get_global_styles_svg_filters();
5307 if ( ! empty( $filters ) ) {
5308 echo $filters;
5309 }
5310}
5311
5312/**
5313 * Build an array with CSS classes and inline styles defining the colors
5314 * which will be applied to the navigation markup in the front-end.
5315 *
5316 * @since 5.9.0
5317 * @deprecated 6.3.0 This was removed from the Navigation Submenu block in favour of `wp_apply_colors_support()`.
5318 * `wp_apply_colors_support()` returns an array with similar class and style values,
5319 * but with different keys: `class` and `style`.
5320 *
5321 * @param array $context Navigation block context.
5322 * @param array $attributes Block attributes.
5323 * @param bool $is_sub_menu Whether the block is a sub-menu.
5324 * @return array Colors CSS classes and inline styles.
5325 */
5326function block_core_navigation_submenu_build_css_colors( $context, $attributes, $is_sub_menu = false ) {
5327 _deprecated_function( __FUNCTION__, '6.3.0' );
5328 $colors = array(
5329 'css_classes' => array(),
5330 'inline_styles' => '',
5331 );
5332
5333 // Text color.
5334 $named_text_color = null;
5335 $custom_text_color = null;
5336
5337 if ( $is_sub_menu && array_key_exists( 'customOverlayTextColor', $context ) ) {
5338 $custom_text_color = $context['customOverlayTextColor'];
5339 } elseif ( $is_sub_menu && array_key_exists( 'overlayTextColor', $context ) ) {
5340 $named_text_color = $context['overlayTextColor'];
5341 } elseif ( array_key_exists( 'customTextColor', $context ) ) {
5342 $custom_text_color = $context['customTextColor'];
5343 } elseif ( array_key_exists( 'textColor', $context ) ) {
5344 $named_text_color = $context['textColor'];
5345 } elseif ( isset( $context['style']['color']['text'] ) ) {
5346 $custom_text_color = $context['style']['color']['text'];
5347 }
5348
5349 // If has text color.
5350 if ( ! is_null( $named_text_color ) ) {
5351 // Add the color class.
5352 array_push( $colors['css_classes'], 'has-text-color', sprintf( 'has-%s-color', $named_text_color ) );
5353 } elseif ( ! is_null( $custom_text_color ) ) {
5354 // Add the custom color inline style.
5355 $colors['css_classes'][] = 'has-text-color';
5356 $colors['inline_styles'] .= sprintf( 'color: %s;', $custom_text_color );
5357 }
5358
5359 // Background color.
5360 $named_background_color = null;
5361 $custom_background_color = null;
5362
5363 if ( $is_sub_menu && array_key_exists( 'customOverlayBackgroundColor', $context ) ) {
5364 $custom_background_color = $context['customOverlayBackgroundColor'];
5365 } elseif ( $is_sub_menu && array_key_exists( 'overlayBackgroundColor', $context ) ) {
5366 $named_background_color = $context['overlayBackgroundColor'];
5367 } elseif ( array_key_exists( 'customBackgroundColor', $context ) ) {
5368 $custom_background_color = $context['customBackgroundColor'];
5369 } elseif ( array_key_exists( 'backgroundColor', $context ) ) {
5370 $named_background_color = $context['backgroundColor'];
5371 } elseif ( isset( $context['style']['color']['background'] ) ) {
5372 $custom_background_color = $context['style']['color']['background'];
5373 }
5374
5375 // If has background color.
5376 if ( ! is_null( $named_background_color ) ) {
5377 // Add the background-color class.
5378 array_push( $colors['css_classes'], 'has-background', sprintf( 'has-%s-background-color', $named_background_color ) );
5379 } elseif ( ! is_null( $custom_background_color ) ) {
5380 // Add the custom background-color inline style.
5381 $colors['css_classes'][] = 'has-background';
5382 $colors['inline_styles'] .= sprintf( 'background-color: %s;', $custom_background_color );
5383 }
5384
5385 return $colors;
5386}
5387
5388/**
5389 * Runs the theme.json webfonts handler.
5390 *
5391 * Using `WP_Theme_JSON_Resolver`, it gets the fonts defined
5392 * in the `theme.json` for the current selection and style
5393 * variations, validates the font-face properties, generates
5394 * the '@font-face' style declarations, and then enqueues the
5395 * styles for both the editor and front-end.
5396 *
5397 * Design Notes:
5398 * This is not a public API, but rather an internal handler.
5399 * A future public Webfonts API will replace this stopgap code.
5400 *
5401 * This code design is intentional.
5402 * a. It hides the inner-workings.
5403 * b. It does not expose API ins or outs for consumption.
5404 * c. It only works with a theme's `theme.json`.
5405 *
5406 * Why?
5407 * a. To avoid backwards-compatibility issues when
5408 * the Webfonts API is introduced in Core.
5409 * b. To make `fontFace` declarations in `theme.json` work.
5410 *
5411 * @link https://github.com/WordPress/gutenberg/issues/40472
5412 *
5413 * @since 6.0.0
5414 * @deprecated 6.4.0 Use wp_print_font_faces() instead.
5415 * @access private
5416 */
5417function _wp_theme_json_webfonts_handler() {
5418 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_print_font_faces' );
5419
5420 // Block themes are unavailable during installation.
5421 if ( wp_installing() ) {
5422 return;
5423 }
5424
5425 if ( ! wp_theme_has_theme_json() ) {
5426 return;
5427 }
5428
5429 // Webfonts to be processed.
5430 $registered_webfonts = array();
5431
5432 /**
5433 * Gets the webfonts from theme.json.
5434 *
5435 * @since 6.0.0
5436 *
5437 * @return array Array of defined webfonts.
5438 */
5439 $fn_get_webfonts_from_theme_json = static function() {
5440 // Get settings from theme.json.
5441 $settings = WP_Theme_JSON_Resolver::get_merged_data()->get_settings();
5442
5443 // If in the editor, add webfonts defined in variations.
5444 if ( is_admin() || wp_is_rest_endpoint() ) {
5445 $variations = WP_Theme_JSON_Resolver::get_style_variations();
5446 foreach ( $variations as $variation ) {
5447 // Skip if fontFamilies are not defined in the variation.
5448 if ( empty( $variation['settings']['typography']['fontFamilies'] ) ) {
5449 continue;
5450 }
5451
5452 // Initialize the array structure.
5453 if ( empty( $settings['typography'] ) ) {
5454 $settings['typography'] = array();
5455 }
5456 if ( empty( $settings['typography']['fontFamilies'] ) ) {
5457 $settings['typography']['fontFamilies'] = array();
5458 }
5459 if ( empty( $settings['typography']['fontFamilies']['theme'] ) ) {
5460 $settings['typography']['fontFamilies']['theme'] = array();
5461 }
5462
5463 // Combine variations with settings. Remove duplicates.
5464 $settings['typography']['fontFamilies']['theme'] = array_merge( $settings['typography']['fontFamilies']['theme'], $variation['settings']['typography']['fontFamilies']['theme'] );
5465 $settings['typography']['fontFamilies'] = array_unique( $settings['typography']['fontFamilies'] );
5466 }
5467 }
5468
5469 // Bail out early if there are no settings for webfonts.
5470 if ( empty( $settings['typography']['fontFamilies'] ) ) {
5471 return array();
5472 }
5473
5474 $webfonts = array();
5475
5476 // Look for fontFamilies.
5477 foreach ( $settings['typography']['fontFamilies'] as $font_families ) {
5478 foreach ( $font_families as $font_family ) {
5479
5480 // Skip if fontFace is not defined.
5481 if ( empty( $font_family['fontFace'] ) ) {
5482 continue;
5483 }
5484
5485 // Skip if fontFace is not an array of webfonts.
5486 if ( ! is_array( $font_family['fontFace'] ) ) {
5487 continue;
5488 }
5489
5490 $webfonts = array_merge( $webfonts, $font_family['fontFace'] );
5491 }
5492 }
5493
5494 return $webfonts;
5495 };
5496
5497 /**
5498 * Transforms each 'src' into an URI by replacing 'file:./'
5499 * placeholder from theme.json.
5500 *
5501 * The absolute path to the webfont file(s) cannot be defined in
5502 * theme.json. `file:./` is the placeholder which is replaced by
5503 * the theme's URL path to the theme's root.
5504 *
5505 * @since 6.0.0
5506 *
5507 * @param array $src Webfont file(s) `src`.
5508 * @return array Webfont's `src` in URI.
5509 */
5510 $fn_transform_src_into_uri = static function( array $src ) {
5511 foreach ( $src as $key => $url ) {
5512 // Tweak the URL to be relative to the theme root.
5513 if ( ! str_starts_with( $url, 'file:./' ) ) {
5514 continue;
5515 }
5516
5517 $src[ $key ] = get_theme_file_uri( str_replace( 'file:./', '', $url ) );
5518 }
5519
5520 return $src;
5521 };
5522
5523 /**
5524 * Converts the font-face properties (i.e. keys) into kebab-case.
5525 *
5526 * @since 6.0.0
5527 *
5528 * @param array $font_face Font face to convert.
5529 * @return array Font faces with each property in kebab-case format.
5530 */
5531 $fn_convert_keys_to_kebab_case = static function( array $font_face ) {
5532 foreach ( $font_face as $property => $value ) {
5533 $kebab_case = _wp_to_kebab_case( $property );
5534 $font_face[ $kebab_case ] = $value;
5535 if ( $kebab_case !== $property ) {
5536 unset( $font_face[ $property ] );
5537 }
5538 }
5539
5540 return $font_face;
5541 };
5542
5543 /**
5544 * Validates a webfont.
5545 *
5546 * @since 6.0.0
5547 *
5548 * @param array $webfont The webfont arguments.
5549 * @return array|false The validated webfont arguments, or false if the webfont is invalid.
5550 */
5551 $fn_validate_webfont = static function( $webfont ) {
5552 $webfont = wp_parse_args(
5553 $webfont,
5554 array(
5555 'font-family' => '',
5556 'font-style' => 'normal',
5557 'font-weight' => '400',
5558 'font-display' => 'fallback',
5559 'src' => array(),
5560 )
5561 );
5562
5563 // Check the font-family.
5564 if ( empty( $webfont['font-family'] ) || ! is_string( $webfont['font-family'] ) ) {
5565 trigger_error( __( 'Webfont font family must be a non-empty string.' ) );
5566
5567 return false;
5568 }
5569
5570 // Check that the `src` property is defined and a valid type.
5571 if ( empty( $webfont['src'] ) || ( ! is_string( $webfont['src'] ) && ! is_array( $webfont['src'] ) ) ) {
5572 trigger_error( __( 'Webfont src must be a non-empty string or an array of strings.' ) );
5573
5574 return false;
5575 }
5576
5577 // Validate the `src` property.
5578 foreach ( (array) $webfont['src'] as $src ) {
5579 if ( ! is_string( $src ) || '' === trim( $src ) ) {
5580 trigger_error( __( 'Each webfont src must be a non-empty string.' ) );
5581
5582 return false;
5583 }
5584 }
5585
5586 // Check the font-weight.
5587 if ( ! is_string( $webfont['font-weight'] ) && ! is_int( $webfont['font-weight'] ) ) {
5588 trigger_error( __( 'Webfont font weight must be a properly formatted string or integer.' ) );
5589
5590 return false;
5591 }
5592
5593 // Check the font-display.
5594 if ( ! in_array( $webfont['font-display'], array( 'auto', 'block', 'fallback', 'optional', 'swap' ), true ) ) {
5595 $webfont['font-display'] = 'fallback';
5596 }
5597
5598 $valid_props = array(
5599 'ascend-override',
5600 'descend-override',
5601 'font-display',
5602 'font-family',
5603 'font-stretch',
5604 'font-style',
5605 'font-weight',
5606 'font-variant',
5607 'font-feature-settings',
5608 'font-variation-settings',
5609 'line-gap-override',
5610 'size-adjust',
5611 'src',
5612 'unicode-range',
5613 );
5614
5615 foreach ( $webfont as $prop => $value ) {
5616 if ( ! in_array( $prop, $valid_props, true ) ) {
5617 unset( $webfont[ $prop ] );
5618 }
5619 }
5620
5621 return $webfont;
5622 };
5623
5624 /**
5625 * Registers webfonts declared in theme.json.
5626 *
5627 * @since 6.0.0
5628 *
5629 * @uses $registered_webfonts To access and update the registered webfonts registry (passed by reference).
5630 * @uses $fn_get_webfonts_from_theme_json To run the function that gets the webfonts from theme.json.
5631 * @uses $fn_convert_keys_to_kebab_case To run the function that converts keys into kebab-case.
5632 * @uses $fn_validate_webfont To run the function that validates each font-face (webfont) from theme.json.
5633 */
5634 $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 ) {
5635 $registered_webfonts = array();
5636
5637 foreach ( $fn_get_webfonts_from_theme_json() as $webfont ) {
5638 if ( ! is_array( $webfont ) ) {
5639 continue;
5640 }
5641
5642 $webfont = $fn_convert_keys_to_kebab_case( $webfont );
5643
5644 $webfont = $fn_validate_webfont( $webfont );
5645
5646 $webfont['src'] = $fn_transform_src_into_uri( (array) $webfont['src'] );
5647
5648 // Skip if not valid.
5649 if ( empty( $webfont ) ) {
5650 continue;
5651 }
5652
5653 $registered_webfonts[] = $webfont;
5654 }
5655 };
5656
5657 /**
5658 * Orders 'src' items to optimize for browser support.
5659 *
5660 * @since 6.0.0
5661 *
5662 * @param array $webfont Webfont to process.
5663 * @return array Ordered `src` items.
5664 */
5665 $fn_order_src = static function( array $webfont ) {
5666 $src = array();
5667 $src_ordered = array();
5668
5669 foreach ( $webfont['src'] as $url ) {
5670 // Add data URIs first.
5671 if ( str_starts_with( trim( $url ), 'data:' ) ) {
5672 $src_ordered[] = array(
5673 'url' => $url,
5674 'format' => 'data',
5675 );
5676 continue;
5677 }
5678 $format = pathinfo( $url, PATHINFO_EXTENSION );
5679 $src[ $format ] = $url;
5680 }
5681
5682 // Add woff2.
5683 if ( ! empty( $src['woff2'] ) ) {
5684 $src_ordered[] = array(
5685 'url' => sanitize_url( $src['woff2'] ),
5686 'format' => 'woff2',
5687 );
5688 }
5689
5690 // Add woff.
5691 if ( ! empty( $src['woff'] ) ) {
5692 $src_ordered[] = array(
5693 'url' => sanitize_url( $src['woff'] ),
5694 'format' => 'woff',
5695 );
5696 }
5697
5698 // Add ttf.
5699 if ( ! empty( $src['ttf'] ) ) {
5700 $src_ordered[] = array(
5701 'url' => sanitize_url( $src['ttf'] ),
5702 'format' => 'truetype',
5703 );
5704 }
5705
5706 // Add eot.
5707 if ( ! empty( $src['eot'] ) ) {
5708 $src_ordered[] = array(
5709 'url' => sanitize_url( $src['eot'] ),
5710 'format' => 'embedded-opentype',
5711 );
5712 }
5713
5714 // Add otf.
5715 if ( ! empty( $src['otf'] ) ) {
5716 $src_ordered[] = array(
5717 'url' => sanitize_url( $src['otf'] ),
5718 'format' => 'opentype',
5719 );
5720 }
5721 $webfont['src'] = $src_ordered;
5722
5723 return $webfont;
5724 };
5725
5726 /**
5727 * Compiles the 'src' into valid CSS.
5728 *
5729 * @since 6.0.0
5730 * @since 6.2.0 Removed local() CSS.
5731 *
5732 * @param string $font_family Font family.
5733 * @param array $value Value to process.
5734 * @return string The CSS.
5735 */
5736 $fn_compile_src = static function( $font_family, array $value ) {
5737 $src = '';
5738
5739 foreach ( $value as $item ) {
5740 $src .= ( 'data' === $item['format'] )
5741 ? ", url({$item['url']})"
5742 : ", url('{$item['url']}') format('{$item['format']}')";
5743 }
5744
5745 $src = ltrim( $src, ', ' );
5746
5747 return $src;
5748 };
5749
5750 /**
5751 * Compiles the font variation settings.
5752 *
5753 * @since 6.0.0
5754 *
5755 * @param array $font_variation_settings Array of font variation settings.
5756 * @return string The CSS.
5757 */
5758 $fn_compile_variations = static function( array $font_variation_settings ) {
5759 $variations = '';
5760
5761 foreach ( $font_variation_settings as $key => $value ) {
5762 $variations .= "$key $value";
5763 }
5764
5765 return $variations;
5766 };
5767
5768 /**
5769 * Builds the font-family's CSS.
5770 *
5771 * @since 6.0.0
5772 *
5773 * @uses $fn_compile_src To run the function that compiles the src.
5774 * @uses $fn_compile_variations To run the function that compiles the variations.
5775 *
5776 * @param array $webfont Webfont to process.
5777 * @return string This font-family's CSS.
5778 */
5779 $fn_build_font_face_css = static function( array $webfont ) use ( $fn_compile_src, $fn_compile_variations ) {
5780 $css = '';
5781
5782 // Wrap font-family in quotes if it contains spaces.
5783 if (
5784 str_contains( $webfont['font-family'], ' ' ) &&
5785 ! str_contains( $webfont['font-family'], '"' ) &&
5786 ! str_contains( $webfont['font-family'], "'" )
5787 ) {
5788 $webfont['font-family'] = '"' . $webfont['font-family'] . '"';
5789 }
5790
5791 foreach ( $webfont as $key => $value ) {
5792 /*
5793 * Skip "provider", since it's for internal API use,
5794 * and not a valid CSS property.
5795 */
5796 if ( 'provider' === $key ) {
5797 continue;
5798 }
5799
5800 // Compile the "src" parameter.
5801 if ( 'src' === $key ) {
5802 $value = $fn_compile_src( $webfont['font-family'], $value );
5803 }
5804
5805 // If font-variation-settings is an array, convert it to a string.
5806 if ( 'font-variation-settings' === $key && is_array( $value ) ) {
5807 $value = $fn_compile_variations( $value );
5808 }
5809
5810 if ( ! empty( $value ) ) {
5811 $css .= "$key:$value;";
5812 }
5813 }
5814
5815 return $css;
5816 };
5817
5818 /**
5819 * Gets the '@font-face' CSS styles for locally-hosted font files.
5820 *
5821 * @since 6.0.0
5822 *
5823 * @uses $registered_webfonts To access and update the registered webfonts registry (passed by reference).
5824 * @uses $fn_order_src To run the function that orders the src.
5825 * @uses $fn_build_font_face_css To run the function that builds the font-face CSS.
5826 *
5827 * @return string The `@font-face` CSS.
5828 */
5829 $fn_get_css = static function() use ( &$registered_webfonts, $fn_order_src, $fn_build_font_face_css ) {
5830 $css = '';
5831
5832 foreach ( $registered_webfonts as $webfont ) {
5833 // Order the webfont's `src` items to optimize for browser support.
5834 $webfont = $fn_order_src( $webfont );
5835
5836 // Build the @font-face CSS for this webfont.
5837 $css .= '@font-face{' . $fn_build_font_face_css( $webfont ) . '}';
5838 }
5839
5840 return $css;
5841 };
5842
5843 /**
5844 * Generates and enqueues webfonts styles.
5845 *
5846 * @since 6.0.0
5847 *
5848 * @uses $fn_get_css To run the function that gets the CSS.
5849 */
5850 $fn_generate_and_enqueue_styles = static function() use ( $fn_get_css ) {
5851 // Generate the styles.
5852 $styles = $fn_get_css();
5853
5854 // Bail out if there are no styles to enqueue.
5855 if ( '' === $styles ) {
5856 return;
5857 }
5858
5859 // Enqueue the stylesheet.
5860 wp_register_style( 'wp-webfonts', '' );
5861 wp_enqueue_style( 'wp-webfonts' );
5862
5863 // Add the styles to the stylesheet.
5864 wp_add_inline_style( 'wp-webfonts', $styles );
5865 };
5866
5867 /**
5868 * Generates and enqueues editor styles.
5869 *
5870 * @since 6.0.0
5871 *
5872 * @uses $fn_get_css To run the function that gets the CSS.
5873 */
5874 $fn_generate_and_enqueue_editor_styles = static function() use ( $fn_get_css ) {
5875 // Generate the styles.
5876 $styles = $fn_get_css();
5877
5878 // Bail out if there are no styles to enqueue.
5879 if ( '' === $styles ) {
5880 return;
5881 }
5882
5883 wp_add_inline_style( 'wp-block-library', $styles );
5884 };
5885
5886 add_action( 'wp_loaded', $fn_register_webfonts );
5887 add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles );
5888 add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
5889}
5890
5891/**
5892 * Prints the CSS in the embed iframe header.
5893 *
5894 * @since 4.4.0
5895 * @deprecated 6.4.0 Use wp_enqueue_embed_styles() instead.
5896 */
5897function print_embed_styles() {
5898 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_embed_styles' );
5899
5900 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
5901 $suffix = SCRIPT_DEBUG ? '' : '.min';
5902 ?>
5903 <style<?php echo $type_attr; ?>>
5904 <?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?>
5905 </style>
5906 <?php
5907}
5908
5909/**
5910 * Prints the important emoji-related styles.
5911 *
5912 * @since 4.2.0
5913 * @deprecated 6.4.0 Use wp_enqueue_emoji_styles() instead.
5914 */
5915function print_emoji_styles() {
5916 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_emoji_styles' );
5917 static $printed = false;
5918
5919 if ( $printed ) {
5920 return;
5921 }
5922
5923 $printed = true;
5924
5925 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
5926 ?>
5927 <style<?php echo $type_attr; ?>>
5928 img.wp-smiley,
5929 img.emoji {
5930 display: inline !important;
5931 border: none !important;
5932 box-shadow: none !important;
5933 height: 1em !important;
5934 width: 1em !important;
5935 margin: 0 0.07em !important;
5936 vertical-align: -0.1em !important;
5937 background: none !important;
5938 padding: 0 !important;
5939 }
5940 </style>
5941 <?php
5942}
5943
5944/**
5945 * Prints style and scripts for the admin bar.
5946 *
5947 * @since 3.1.0
5948 * @deprecated 6.4.0 Use wp_enqueue_admin_bar_header_styles() instead.
5949 */
5950function wp_admin_bar_header() {
5951 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_header_styles' );
5952 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
5953 ?>
5954 <style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style>
5955 <?php
5956}
5957
5958/**
5959 * Prints default admin bar callback.
5960 *
5961 * @since 3.1.0
5962 * @deprecated 6.4.0 Use wp_enqueue_admin_bar_bump_styles() instead.
5963 */
5964function _admin_bar_bump_cb() {
5965 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_bump_styles' );
5966 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
5967 ?>
5968 <style<?php echo $type_attr; ?> media="screen">
5969 html { margin-top: 32px !important; }
5970 @media screen and ( max-width: 782px ) {
5971 html { margin-top: 46px !important; }
5972 }
5973 </style>
5974 <?php
5975}
5976
5977/**
5978 * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.
5979 *
5980 * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained.
5981 *
5982 * @since 5.7.0
5983 * @deprecated 6.4.0 The `wp_update_https_detection_errors()` function is no longer used and has been replaced by
5984 * `wp_get_https_detection_errors()`. Previously the function was called by a regular Cron hook to
5985 * update the `https_detection_errors` option, but this is no longer necessary as the errors are
5986 * retrieved directly in Site Health and no longer used outside of Site Health.
5987 * @access private
5988 */
5989function wp_update_https_detection_errors() {
5990 _deprecated_function( __FUNCTION__, '6.4.0' );
5991
5992 /**
5993 * Short-circuits the process of detecting errors related to HTTPS support.
5994 *
5995 * Returning a `WP_Error` from the filter will effectively short-circuit the default logic of trying a remote
5996 * request to the site over HTTPS, storing the errors array from the returned `WP_Error` instead.
5997 *
5998 * @since 5.7.0
5999 * @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`.
6000 *
6001 * @param null|WP_Error $pre Error object to short-circuit detection,
6002 * or null to continue with the default behavior.
6003 */
6004 $support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null );
6005 if ( is_wp_error( $support_errors ) ) {
6006 update_option( 'https_detection_errors', $support_errors->errors, false );
6007 return;
6008 }
6009
6010 $support_errors = wp_get_https_detection_errors();
6011
6012 update_option( 'https_detection_errors', $support_errors );
6013}
6014
6015/**
6016 * Adds `decoding` attribute to an `img` HTML tag.
6017 *
6018 * The `decoding` attribute allows developers to indicate whether the
6019 * browser can decode the image off the main thread (`async`), on the
6020 * main thread (`sync`) or as determined by the browser (`auto`).
6021 *
6022 * By default WordPress adds `decoding="async"` to images but developers
6023 * can use the {@see 'wp_img_tag_add_decoding_attr'} filter to modify this
6024 * to remove the attribute or set it to another accepted value.
6025 *
6026 * @since 6.1.0
6027 * @deprecated 6.4.0 Use wp_img_tag_add_loading_optimization_attrs() instead.
6028 * @see wp_img_tag_add_loading_optimization_attrs()
6029 *
6030 * @param string $image The HTML `img` tag where the attribute should be added.
6031 * @param string $context Additional context to pass to the filters.
6032 * @return string Converted `img` tag with `decoding` attribute added.
6033 */
6034function wp_img_tag_add_decoding_attr( $image, $context ) {
6035 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_img_tag_add_loading_optimization_attrs()' );
6036
6037 /*
6038 * Only apply the decoding attribute to images that have a src attribute that
6039 * starts with a double quote, ensuring escaped JSON is also excluded.
6040 */
6041 if ( ! str_contains( $image, ' src="' ) ) {
6042 return $image;
6043 }
6044
6045 /** This action is documented in wp-includes/media.php */
6046 $value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );
6047
6048 if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
6049 $image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
6050 }
6051
6052 return $image;
6053}
6054
6055/**
6056 * Parses wp_template content and injects the active theme's
6057 * stylesheet as a theme attribute into each wp_template_part
6058 *
6059 * @since 5.9.0
6060 * @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_inject_theme_attribute_in_template_part_block' ) instead.
6061 * @access private
6062 *
6063 * @param string $template_content serialized wp_template content.
6064 * @return string Updated 'wp_template' content.
6065 */
6066function _inject_theme_attribute_in_block_template_content( $template_content ) {
6067 _deprecated_function(
6068 __FUNCTION__,
6069 '6.4.0',
6070 'traverse_and_serialize_blocks( parse_blocks( $template_content ), "_inject_theme_attribute_in_template_part_block" )'
6071 );
6072
6073 $has_updated_content = false;
6074 $new_content = '';
6075 $template_blocks = parse_blocks( $template_content );
6076
6077 $blocks = _flatten_blocks( $template_blocks );
6078 foreach ( $blocks as &$block ) {
6079 if (
6080 'core/template-part' === $block['blockName'] &&
6081 ! isset( $block['attrs']['theme'] )
6082 ) {
6083 $block['attrs']['theme'] = get_stylesheet();
6084 $has_updated_content = true;
6085 }
6086 }
6087
6088 if ( $has_updated_content ) {
6089 foreach ( $template_blocks as &$block ) {
6090 $new_content .= serialize_block( $block );
6091 }
6092
6093 return $new_content;
6094 }
6095
6096 return $template_content;
6097}
6098
6099/**
6100 * Parses a block template and removes the theme attribute from each template part.
6101 *
6102 * @since 5.9.0
6103 * @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_remove_theme_attribute_from_template_part_block' ) instead.
6104 * @access private
6105 *
6106 * @param string $template_content Serialized block template content.
6107 * @return string Updated block template content.
6108 */
6109function _remove_theme_attribute_in_block_template_content( $template_content ) {
6110 _deprecated_function(
6111 __FUNCTION__,
6112 '6.4.0',
6113 'traverse_and_serialize_blocks( parse_blocks( $template_content ), "_remove_theme_attribute_from_template_part_block" )'
6114 );
6115
6116 $has_updated_content = false;
6117 $new_content = '';
6118 $template_blocks = parse_blocks( $template_content );
6119
6120 $blocks = _flatten_blocks( $template_blocks );
6121 foreach ( $blocks as $key => $block ) {
6122 if ( 'core/template-part' === $block['blockName'] && isset( $block['attrs']['theme'] ) ) {
6123 unset( $blocks[ $key ]['attrs']['theme'] );
6124 $has_updated_content = true;
6125 }
6126 }
6127
6128 if ( ! $has_updated_content ) {
6129 return $template_content;
6130 }
6131
6132 foreach ( $template_blocks as $block ) {
6133 $new_content .= serialize_block( $block );
6134 }
6135
6136 return $new_content;
6137}
6138
6139/**
6140 * Prints the skip-link script & styles.
6141 *
6142 * @since 5.8.0
6143 * @access private
6144 * @deprecated 6.4.0 Use wp_enqueue_block_template_skip_link() instead.
6145 *
6146 * @global string $_wp_current_template_content
6147 */
6148function the_block_template_skip_link() {
6149 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_block_template_skip_link()' );
6150
6151 global $_wp_current_template_content;
6152
6153 // Early exit if not a block theme.
6154 if ( ! current_theme_supports( 'block-templates' ) ) {
6155 return;
6156 }
6157
6158 // Early exit if not a block template.
6159 if ( ! $_wp_current_template_content ) {
6160 return;
6161 }
6162 ?>
6163
6164 <?php
6165 /**
6166 * Print the skip-link styles.
6167 */
6168 ?>
6169 <style id="skip-link-styles">
6170 .skip-link.screen-reader-text {
6171 border: 0;
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-path: none;
6185 color: #444;
6186 display: block;
6187 font-size: 1em;
6188 height: auto;
6189 left: 5px;
6190 line-height: normal;
6191 padding: 15px 23px 14px;
6192 text-decoration: none;
6193 top: 5px;
6194 width: auto;
6195 z-index: 100000;
6196 }
6197 </style>
6198 <?php
6199 /**
6200 * Print the skip-link script.
6201 */
6202 ?>
6203 <script>
6204 ( function() {
6205 var skipLinkTarget = document.querySelector( 'main' ),
6206 sibling,
6207 skipLinkTargetID,
6208 skipLink;
6209
6210 // Early exit if a skip-link target can't be located.
6211 if ( ! skipLinkTarget ) {
6212 return;
6213 }
6214
6215 /*
6216 * Get the site wrapper.
6217 * The skip-link will be injected in the beginning of it.
6218 */
6219 sibling = document.querySelector( '.wp-site-blocks' );
6220
6221 // Early exit if the root element was not found.
6222 if ( ! sibling ) {
6223 return;
6224 }
6225
6226 // Get the skip-link target's ID, and generate one if it doesn't exist.
6227 skipLinkTargetID = skipLinkTarget.id;
6228 if ( ! skipLinkTargetID ) {
6229 skipLinkTargetID = 'wp--skip-link--target';
6230 skipLinkTarget.id = skipLinkTargetID;
6231 }
6232
6233 // Create the skip link.
6234 skipLink = document.createElement( 'a' );
6235 skipLink.classList.add( 'skip-link', 'screen-reader-text' );
6236 skipLink.href = '#' + skipLinkTargetID;
6237 skipLink.innerHTML = '<?php /* translators: Hidden accessibility text. */ esc_html_e( 'Skip to content' ); ?>';
6238
6239 // Inject the skip link.
6240 sibling.parentElement.insertBefore( skipLink, sibling );
6241 }() );
6242 </script>
6243 <?php
6244}
6245
6246/**
6247 * Ensure that the view script has the `wp-interactivity` dependency.
6248 *
6249 * @since 6.4.0
6250 * @deprecated 6.5.0
6251 */
6252function block_core_query_ensure_interactivity_dependency() {
6253 _deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
6254}
6255
6256/**
6257 * Ensure that the view script has the `wp-interactivity` dependency.
6258 *
6259 * @since 6.4.0
6260 * @deprecated 6.5.0
6261 */
6262function block_core_file_ensure_interactivity_dependency() {
6263 _deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
6264}
6265
6266/**
6267 * Ensures that the view script has the `wp-interactivity` dependency.
6268 *
6269 * @since 6.4.0
6270 * @deprecated 6.5.0
6271 */
6272function block_core_image_ensure_interactivity_dependency() {
6273 _deprecated_function( __FUNCTION__, '6.5.0', 'wp_register_script_module' );
6274}
6275
6276/**
6277 * Updates the block content with elements class names.
6278 *
6279 * @deprecated 6.6.0 Generation of element class name is handled via `render_block_data` filter.
6280 *
6281 * @since 5.8.0
6282 * @since 6.4.0 Added support for button and heading element styling.
6283 * @access private
6284 *
6285 * @param string $block_content Rendered block content.
6286 * @param array $block Block object.
6287 * @return string Filtered block content.
6288 */
6289function wp_render_elements_support( $block_content, $block ) {
6290 _deprecated_function( __FUNCTION__, '6.6.0', 'wp_render_elements_class_name' );
6291 return $block_content;
6292}
6293
6294/**
6295 * Processes the directives on the rendered HTML of the interactive blocks.
6296 *
6297 * This processes only one root interactive block at a time because the
6298 * rendered HTML of that block contains the rendered HTML of all its inner
6299 * blocks, including any interactive block. It does so by ignoring all the
6300 * interactive inner blocks until the root interactive block is processed.
6301 *
6302 * @since 6.5.0
6303 * @deprecated 6.6.0
6304 *
6305 * @param array $parsed_block The parsed block.
6306 * @return array The same parsed block.
6307 */
6308function wp_interactivity_process_directives_of_interactive_blocks( array $parsed_block ): array {
6309 _deprecated_function( __FUNCTION__, '6.6.0' );
6310 return $parsed_block;
6311}
6312
6313/**
6314 * Gets the global styles custom CSS from theme.json.
6315 *
6316 * @since 6.2.0
6317 * @deprecated 6.7.0 Use {@see 'wp_get_global_stylesheet'} instead for top-level custom CSS, or {@see 'WP_Theme_JSON::get_styles_for_block'} for block-level custom CSS.
6318 *
6319 * @return string The global styles custom CSS.
6320 */
6321function wp_get_global_styles_custom_css() {
6322 _deprecated_function( __FUNCTION__, '6.7.0', 'wp_get_global_stylesheet' );
6323 if ( ! wp_theme_has_theme_json() ) {
6324 return '';
6325 }
6326 /*
6327 * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
6328 * developer's workflow.
6329 */
6330 $can_use_cached = ! wp_is_development_mode( 'theme' );
6331
6332 /*
6333 * By using the 'theme_json' group, this data is marked to be non-persistent across requests.
6334 * @see `wp_cache_add_non_persistent_groups()`.
6335 *
6336 * The rationale for this is to make sure derived data from theme.json
6337 * is always fresh from the potential modifications done via hooks
6338 * that can use dynamic data (modify the stylesheet depending on some option,
6339 * settings depending on user permissions, etc.).
6340 * See some of the existing hooks to modify theme.json behavior:
6341 * @see https://make.wordpress.org/core/2022/10/10/filters-for-theme-json-data/
6342 *
6343 * A different alternative considered was to invalidate the cache upon certain
6344 * events such as options add/update/delete, user meta, etc.
6345 * It was judged not enough, hence this approach.
6346 * @see https://github.com/WordPress/gutenberg/pull/45372
6347 */
6348 $cache_key = 'wp_get_global_styles_custom_css';
6349 $cache_group = 'theme_json';
6350 if ( $can_use_cached ) {
6351 $cached = wp_cache_get( $cache_key, $cache_group );
6352 if ( $cached ) {
6353 return $cached;
6354 }
6355 }
6356
6357 $tree = WP_Theme_JSON_Resolver::get_merged_data();
6358 $stylesheet = $tree->get_custom_css();
6359
6360 if ( $can_use_cached ) {
6361 wp_cache_set( $cache_key, $stylesheet, $cache_group );
6362 }
6363
6364 return $stylesheet;
6365}
6366
6367/**
6368 * Enqueues the global styles custom css defined via theme.json.
6369 *
6370 * @since 6.2.0
6371 * @deprecated 6.7.0 Use {@see 'wp_enqueue_global_styles'} instead.
6372 */
6373function wp_enqueue_global_styles_custom_css() {
6374 _deprecated_function( __FUNCTION__, '6.7.0', 'wp_enqueue_global_styles' );
6375 if ( ! wp_is_block_theme() ) {
6376 return;
6377 }
6378
6379 // Don't enqueue Customizer's custom CSS separately.
6380 remove_action( 'wp_head', 'wp_custom_css_cb', 101 );
6381
6382 $custom_css = wp_get_custom_css();
6383 $custom_css .= wp_get_global_styles_custom_css();
6384
6385 if ( ! empty( $custom_css ) ) {
6386 wp_add_inline_style( 'global-styles', $custom_css );
6387 }
6388}
6389
6390/**
6391 * Generate block style variation instance name.
6392 *
6393 * @since 6.6.0
6394 * @deprecated 6.7.0 Use `wp_unique_id( $variation . '--' )` instead.
6395 *
6396 * @access private
6397 *
6398 * @param array $block Block object.
6399 * @param string $variation Slug for the block style variation.
6400 *
6401 * @return string The unique variation name.
6402 */
6403function wp_create_block_style_variation_instance_name( $block, $variation ) {
6404 _deprecated_function( __FUNCTION__, '6.7.0', 'wp_unique_id' );
6405 return $variation . '--' . md5( serialize( $block ) );
6406}
6407
6408/**
6409 * Returns whether the current user has the specified capability for a given site.
6410 *
6411 * @since 3.0.0
6412 * @since 5.3.0 Formalized the existing and already documented `...$args` parameter
6413 * by adding it to the function signature.
6414 * @since 5.8.0 Wraps current_user_can() after switching to blog.
6415 * @deprecated 6.7.0 Use current_user_can_for_site() instead.
6416 *
6417 * @param int $blog_id Site ID.
6418 * @param string $capability Capability name.
6419 * @param mixed ...$args Optional further parameters, typically starting with an object ID.
6420 * @return bool Whether the user has the given capability.
6421 */
6422function current_user_can_for_blog( $blog_id, $capability, ...$args ) {
6423 return current_user_can_for_site( $blog_id, $capability, ...$args );
6424}
6425
6426/**
6427 * Loads classic theme styles on classic themes in the editor.
6428 *
6429 * This is used for backwards compatibility for Button and File blocks specifically.
6430 *
6431 * @since 6.1.0
6432 * @since 6.2.0 Added File block styles.
6433 * @deprecated 6.8.0 Styles are enqueued, not printed in the body element.
6434 *
6435 * @param array $editor_settings The array of editor settings.
6436 * @return array A filtered array of editor settings.
6437 */
6438function wp_add_editor_classic_theme_styles( $editor_settings ) {
6439 _deprecated_function( __FUNCTION__, '6.8.0', 'wp_enqueue_classic_theme_styles' );
6440
6441 if ( wp_theme_has_theme_json() ) {
6442 return $editor_settings;
6443 }
6444
6445 $suffix = wp_scripts_get_suffix();
6446 $classic_theme_styles = ABSPATH . WPINC . "/css/classic-themes$suffix.css";
6447
6448 /*
6449 * This follows the pattern of get_block_editor_theme_styles,
6450 * but we can't use get_block_editor_theme_styles directly as it
6451 * only handles external files or theme files.
6452 */
6453 $classic_theme_styles_settings = array(
6454 'css' => file_get_contents( $classic_theme_styles ),
6455 '__unstableType' => 'core',
6456 'isGlobalStyles' => false,
6457 );
6458
6459 // Add these settings to the start of the array so that themes can override them.
6460 array_unshift( $editor_settings['styles'], $classic_theme_styles_settings );
6461
6462 return $editor_settings;
6463}
6464
6465/**
6466 * Prints a CSS rule to fix potential visual issues with images using `sizes=auto`.
6467 *
6468 * This rule overrides the similar rule in the default user agent stylesheet, to avoid images that use e.g.
6469 * `width: auto` or `width: fit-content` to appear smaller.
6470 *
6471 * @since 6.7.1
6472 * @deprecated 6.9.0 Use wp_enqueue_img_auto_sizes_contain_css_fix() instead.
6473 * @see wp_enqueue_img_auto_sizes_contain_css_fix()
6474 *
6475 * @see https://html.spec.whatwg.org/multipage/rendering.html#img-contain-size
6476 * @see https://core.trac.wordpress.org/ticket/62413
6477 * @see https://core.trac.wordpress.org/ticket/62731
6478 */
6479function wp_print_auto_sizes_contain_css_fix() {
6480 _deprecated_function( __FUNCTION__, '6.9.0', 'wp_enqueue_img_auto_sizes_contain_css_fix' );
6481
6482 /** This filter is documented in wp-includes/media.php */
6483 $add_auto_sizes = apply_filters( 'wp_img_tag_add_auto_sizes', true );
6484 if ( ! $add_auto_sizes ) {
6485 return;
6486 }
6487
6488 ?>
6489 <style>img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px }</style>
6490 <?php
6491}
6492