author | ymh <ymh.work@gmail.com> |
Tue, 15 Dec 2020 13:49:49 +0100 | |
changeset 16 | a86126ab1dd4 |
parent 9 | 177826044cd9 |
child 18 | be944660c56a |
permissions | -rw-r--r-- |
0 | 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 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
16 |
* Retrieves all post data for a given post. |
0 | 17 |
* |
18 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
* @deprecated 1.5.1 Use get_post() |
0 | 20 |
* @see get_post() |
21 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
* @param int $postid Post ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
* @return array Post data. |
0 | 24 |
*/ |
25 |
function 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 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
54 |
* Use The Loop instead. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
55 |
* |
16 | 56 |
* @link https://developer.wordpress.org/themes/basics/the-loop/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
57 |
* |
0 | 58 |
* @since 1.0.1 |
5 | 59 |
* @deprecated 1.5.0 |
0 | 60 |
*/ |
61 |
function start_wp() { |
|
62 |
global $wp_query; |
|
63 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
64 |
_deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') ); |
0 | 65 |
|
66 |
// Since the old style loop is being used, advance the query iterator here. |
|
67 |
$wp_query->next_post(); |
|
68 |
||
69 |
setup_postdata( get_post() ); |
|
70 |
} |
|
71 |
||
72 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
73 |
* Returns or prints a category ID. |
0 | 74 |
* |
75 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
* @deprecated 0.71 Use get_the_category() |
0 | 77 |
* @see get_the_category() |
78 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
79 |
* @param bool $echo Optional. Whether to echo the output. Default true. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
* @return int Category ID. |
0 | 81 |
*/ |
82 |
function the_category_ID($echo = true) { |
|
83 |
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); |
|
84 |
||
85 |
// Grab the first cat in the list. |
|
86 |
$categories = get_the_category(); |
|
87 |
$cat = $categories[0]->term_id; |
|
88 |
||
89 |
if ( $echo ) |
|
90 |
echo $cat; |
|
91 |
||
92 |
return $cat; |
|
93 |
} |
|
94 |
||
95 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
* Prints a category with optional text before and after. |
0 | 97 |
* |
98 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
99 |
* @deprecated 0.71 Use get_the_category_by_ID() |
0 | 100 |
* @see get_the_category_by_ID() |
101 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
102 |
* @param string $before Optional. Text to display before the category. Default empty. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
* @param string $after Optional. Text to display after the category. Default empty. |
0 | 104 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
105 |
function the_category_head( $before = '', $after = '' ) { |
0 | 106 |
global $currentcat, $previouscat; |
107 |
||
108 |
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); |
|
109 |
||
110 |
// Grab the first cat in the list. |
|
111 |
$categories = get_the_category(); |
|
112 |
$currentcat = $categories[0]->category_id; |
|
113 |
if ( $currentcat != $previouscat ) { |
|
114 |
echo $before; |
|
115 |
echo get_the_category_by_ID($currentcat); |
|
116 |
echo $after; |
|
117 |
$previouscat = $currentcat; |
|
118 |
} |
|
119 |
} |
|
120 |
||
121 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
* Prints a link to the previous post. |
0 | 123 |
* |
5 | 124 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
125 |
* @deprecated 2.0.0 Use previous_post_link() |
0 | 126 |
* @see previous_post_link() |
127 |
* |
|
128 |
* @param string $format |
|
129 |
* @param string $previous |
|
130 |
* @param string $title |
|
131 |
* @param string $in_same_cat |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
132 |
* @param int $limitprev |
0 | 133 |
* @param string $excluded_categories |
134 |
*/ |
|
135 |
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { |
|
136 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
137 |
_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' ); |
0 | 138 |
|
139 |
if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
|
140 |
$in_same_cat = false; |
|
141 |
else |
|
142 |
$in_same_cat = true; |
|
143 |
||
144 |
$post = get_previous_post($in_same_cat, $excluded_categories); |
|
145 |
||
146 |
if ( !$post ) |
|
147 |
return; |
|
148 |
||
149 |
$string = '<a href="'.get_permalink($post->ID).'">'.$previous; |
|
150 |
if ( 'yes' == $title ) |
|
151 |
$string .= apply_filters('the_title', $post->post_title, $post->ID); |
|
152 |
$string .= '</a>'; |
|
153 |
$format = str_replace('%', $string, $format); |
|
154 |
echo $format; |
|
155 |
} |
|
156 |
||
157 |
/** |
|
158 |
* Prints link to the next post. |
|
159 |
* |
|
160 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
* @deprecated 2.0.0 Use next_post_link() |
0 | 162 |
* @see next_post_link() |
163 |
* |
|
164 |
* @param string $format |
|
165 |
* @param string $next |
|
166 |
* @param string $title |
|
167 |
* @param string $in_same_cat |
|
168 |
* @param int $limitnext |
|
169 |
* @param string $excluded_categories |
|
170 |
*/ |
|
171 |
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
172 |
_deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' ); |
0 | 173 |
|
174 |
if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
|
175 |
$in_same_cat = false; |
|
176 |
else |
|
177 |
$in_same_cat = true; |
|
178 |
||
179 |
$post = get_next_post($in_same_cat, $excluded_categories); |
|
180 |
||
181 |
if ( !$post ) |
|
182 |
return; |
|
183 |
||
184 |
$string = '<a href="'.get_permalink($post->ID).'">'.$next; |
|
185 |
if ( 'yes' == $title ) |
|
186 |
$string .= apply_filters('the_title', $post->post_title, $post->ID); |
|
187 |
$string .= '</a>'; |
|
188 |
$format = str_replace('%', $string, $format); |
|
189 |
echo $format; |
|
190 |
} |
|
191 |
||
192 |
/** |
|
193 |
* Whether user can create a post. |
|
194 |
* |
|
5 | 195 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 197 |
* @see current_user_can() |
198 |
* |
|
199 |
* @param int $user_id |
|
200 |
* @param int $blog_id Not Used |
|
201 |
* @param int $category_id Not Used |
|
202 |
* @return bool |
|
203 |
*/ |
|
204 |
function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
205 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 206 |
|
207 |
$author_data = get_userdata($user_id); |
|
208 |
return ($author_data->user_level > 1); |
|
209 |
} |
|
210 |
||
211 |
/** |
|
212 |
* Whether user can create a post. |
|
213 |
* |
|
5 | 214 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
215 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 216 |
* @see current_user_can() |
217 |
* |
|
218 |
* @param int $user_id |
|
219 |
* @param int $blog_id Not Used |
|
220 |
* @param int $category_id Not Used |
|
221 |
* @return bool |
|
222 |
*/ |
|
223 |
function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 225 |
|
226 |
$author_data = get_userdata($user_id); |
|
227 |
return ($author_data->user_level >= 1); |
|
228 |
} |
|
229 |
||
230 |
/** |
|
231 |
* Whether user can edit a post. |
|
232 |
* |
|
5 | 233 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
234 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 235 |
* @see current_user_can() |
236 |
* |
|
237 |
* @param int $user_id |
|
238 |
* @param int $post_id |
|
239 |
* @param int $blog_id Not Used |
|
240 |
* @return bool |
|
241 |
*/ |
|
242 |
function user_can_edit_post($user_id, $post_id, $blog_id = 1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
243 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 244 |
|
245 |
$author_data = get_userdata($user_id); |
|
246 |
$post = get_post($post_id); |
|
247 |
$post_author_data = get_userdata($post->post_author); |
|
248 |
||
249 |
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) |
|
16 | 250 |
|| ($author_data->user_level > $post_author_data->user_level) |
251 |
|| ($author_data->user_level >= 10) ) { |
|
0 | 252 |
return true; |
253 |
} else { |
|
254 |
return false; |
|
255 |
} |
|
256 |
} |
|
257 |
||
258 |
/** |
|
259 |
* Whether user can delete a post. |
|
260 |
* |
|
5 | 261 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
262 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 263 |
* @see current_user_can() |
264 |
* |
|
265 |
* @param int $user_id |
|
266 |
* @param int $post_id |
|
267 |
* @param int $blog_id Not Used |
|
268 |
* @return bool |
|
269 |
*/ |
|
270 |
function user_can_delete_post($user_id, $post_id, $blog_id = 1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
271 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 272 |
|
16 | 273 |
// Right now if one can edit, one can delete. |
0 | 274 |
return user_can_edit_post($user_id, $post_id, $blog_id); |
275 |
} |
|
276 |
||
277 |
/** |
|
278 |
* Whether user can set new posts' dates. |
|
279 |
* |
|
5 | 280 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
281 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 282 |
* @see current_user_can() |
283 |
* |
|
284 |
* @param int $user_id |
|
285 |
* @param int $blog_id Not Used |
|
286 |
* @param int $category_id Not Used |
|
287 |
* @return bool |
|
288 |
*/ |
|
289 |
function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
290 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 291 |
|
292 |
$author_data = get_userdata($user_id); |
|
293 |
return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); |
|
294 |
} |
|
295 |
||
296 |
/** |
|
297 |
* Whether user can delete a post. |
|
298 |
* |
|
5 | 299 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
300 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 301 |
* @see current_user_can() |
302 |
* |
|
303 |
* @param int $user_id |
|
304 |
* @param int $post_id |
|
305 |
* @param int $blog_id Not Used |
|
306 |
* @return bool returns true if $user_id can edit $post_id's date |
|
307 |
*/ |
|
308 |
function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
309 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 310 |
|
311 |
$author_data = get_userdata($user_id); |
|
312 |
return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); |
|
313 |
} |
|
314 |
||
315 |
/** |
|
316 |
* Whether user can delete a post. |
|
317 |
* |
|
5 | 318 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
319 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 320 |
* @see current_user_can() |
321 |
* |
|
322 |
* @param int $user_id |
|
323 |
* @param int $post_id |
|
324 |
* @param int $blog_id Not Used |
|
325 |
* @return bool returns true if $user_id can edit $post_id's comments |
|
326 |
*/ |
|
327 |
function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
328 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 329 |
|
16 | 330 |
// Right now if one can edit a post, one can edit comments made on it. |
0 | 331 |
return user_can_edit_post($user_id, $post_id, $blog_id); |
332 |
} |
|
333 |
||
334 |
/** |
|
335 |
* Whether user can delete a post. |
|
336 |
* |
|
5 | 337 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
338 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 339 |
* @see current_user_can() |
340 |
* |
|
341 |
* @param int $user_id |
|
342 |
* @param int $post_id |
|
343 |
* @param int $blog_id Not Used |
|
344 |
* @return bool returns true if $user_id can delete $post_id's comments |
|
345 |
*/ |
|
346 |
function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
347 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 348 |
|
16 | 349 |
// Right now if one can edit comments, one can delete comments. |
0 | 350 |
return user_can_edit_post_comments($user_id, $post_id, $blog_id); |
351 |
} |
|
352 |
||
353 |
/** |
|
354 |
* Can user can edit other user. |
|
355 |
* |
|
5 | 356 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
357 |
* @deprecated 2.0.0 Use current_user_can() |
0 | 358 |
* @see current_user_can() |
359 |
* |
|
360 |
* @param int $user_id |
|
361 |
* @param int $other_user |
|
362 |
* @return bool |
|
363 |
*/ |
|
364 |
function user_can_edit_user($user_id, $other_user) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
365 |
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
0 | 366 |
|
367 |
$user = get_userdata($user_id); |
|
368 |
$other = get_userdata($other_user); |
|
369 |
if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) |
|
370 |
return true; |
|
371 |
else |
|
372 |
return false; |
|
373 |
} |
|
374 |
||
375 |
/** |
|
376 |
* Gets the links associated with category $cat_name. |
|
377 |
* |
|
378 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
379 |
* @deprecated 2.1.0 Use get_bookmarks() |
0 | 380 |
* @see get_bookmarks() |
381 |
* |
|
16 | 382 |
* @param string $cat_name Optional. The category name to use. If no match is found, uses all. |
383 |
* Default 'noname'. |
|
384 |
* @param string $before Optional. The HTML to output before the link. Default empty. |
|
385 |
* @param string $after Optional. The HTML to output after the link. Default '<br />'. |
|
386 |
* @param string $between Optional. The HTML to output between the link/image and its description. |
|
387 |
* Not used if no image or $show_images is true. Default ' '. |
|
388 |
* @param bool $show_images Optional. Whether to show images (if defined). Default true. |
|
389 |
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
|
390 |
* 'description', 'rating', or 'owner'. Default 'id'. |
|
391 |
* If you start the name with an underscore, the order will be reversed. |
|
392 |
* Specifying 'rand' as the order will return links in a random order. |
|
393 |
* @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
|
394 |
* Default true. |
|
395 |
* @param bool $show_rating Optional. Show rating stars/chars. Default false. |
|
396 |
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
397 |
* Default -1. |
|
398 |
* @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. |
|
0 | 399 |
*/ |
400 |
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', |
|
16 | 401 |
$show_description = true, $show_rating = false, |
402 |
$limit = -1, $show_updated = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
403 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
0 | 404 |
|
405 |
$cat_id = -1; |
|
406 |
$cat = get_term_by('name', $cat_name, 'link_category'); |
|
407 |
if ( $cat ) |
|
408 |
$cat_id = $cat->term_id; |
|
409 |
||
410 |
get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); |
|
411 |
} |
|
412 |
||
413 |
/** |
|
414 |
* Gets the links associated with the named category. |
|
415 |
* |
|
416 |
* @since 1.0.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
417 |
* @deprecated 2.1.0 Use wp_list_bookmarks() |
0 | 418 |
* @see wp_list_bookmarks() |
419 |
* |
|
420 |
* @param string $category The category to use. |
|
421 |
* @param string $args |
|
5 | 422 |
* @return string|null |
0 | 423 |
*/ |
424 |
function wp_get_linksbyname($category, $args = '') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
425 |
_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()'); |
0 | 426 |
|
427 |
$defaults = array( |
|
428 |
'after' => '<br />', |
|
429 |
'before' => '', |
|
430 |
'categorize' => 0, |
|
431 |
'category_after' => '', |
|
432 |
'category_before' => '', |
|
433 |
'category_name' => $category, |
|
434 |
'show_description' => 1, |
|
435 |
'title_li' => '', |
|
436 |
); |
|
437 |
||
16 | 438 |
$parsed_args = wp_parse_args( $args, $defaults ); |
439 |
||
440 |
return wp_list_bookmarks($parsed_args); |
|
0 | 441 |
} |
442 |
||
443 |
/** |
|
444 |
* Gets an array of link objects associated with category $cat_name. |
|
445 |
* |
|
5 | 446 |
* $links = get_linkobjectsbyname( 'fred' ); |
447 |
* foreach ( $links as $link ) { |
|
448 |
* echo '<li>' . $link->link_name . '</li>'; |
|
449 |
* } |
|
0 | 450 |
* |
451 |
* @since 1.0.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
452 |
* @deprecated 2.1.0 Use get_bookmarks() |
0 | 453 |
* @see get_bookmarks() |
454 |
* |
|
16 | 455 |
* @param string $cat_name Optional. The category name to use. If no match is found, uses all. |
456 |
* Default 'noname'. |
|
457 |
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
|
458 |
* 'description', 'rating', or 'owner'. Default 'name'. |
|
459 |
* If you start the name with an underscore, the order will be reversed. |
|
460 |
* Specifying 'rand' as the order will return links in a random order. |
|
461 |
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
462 |
* Default -1. |
|
5 | 463 |
* @return array |
0 | 464 |
*/ |
465 |
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
466 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
0 | 467 |
|
468 |
$cat_id = -1; |
|
469 |
$cat = get_term_by('name', $cat_name, 'link_category'); |
|
470 |
if ( $cat ) |
|
471 |
$cat_id = $cat->term_id; |
|
472 |
||
473 |
return get_linkobjects($cat_id, $orderby, $limit); |
|
474 |
} |
|
475 |
||
476 |
/** |
|
477 |
* Gets an array of link objects associated with category n. |
|
478 |
* |
|
479 |
* Usage: |
|
5 | 480 |
* |
481 |
* $links = get_linkobjects(1); |
|
482 |
* if ($links) { |
|
483 |
* foreach ($links as $link) { |
|
484 |
* echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>'; |
|
485 |
* } |
|
486 |
* } |
|
0 | 487 |
* |
488 |
* Fields are: |
|
5 | 489 |
* |
490 |
* - link_id |
|
491 |
* - link_url |
|
492 |
* - link_name |
|
493 |
* - link_image |
|
494 |
* - link_target |
|
495 |
* - link_category |
|
496 |
* - link_description |
|
497 |
* - link_visible |
|
498 |
* - link_owner |
|
499 |
* - link_rating |
|
500 |
* - link_updated |
|
501 |
* - link_rel |
|
502 |
* - link_notes |
|
0 | 503 |
* |
504 |
* @since 1.0.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
505 |
* @deprecated 2.1.0 Use get_bookmarks() |
0 | 506 |
* @see get_bookmarks() |
507 |
* |
|
16 | 508 |
* @param int $category Optional. The category to use. If no category supplied, uses all. |
509 |
* Default 0. |
|
510 |
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
|
511 |
* 'description', 'rating', or 'owner'. Default 'name'. |
|
512 |
* If you start the name with an underscore, the order will be reversed. |
|
513 |
* Specifying 'rand' as the order will return links in a random order. |
|
514 |
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
515 |
* Default 0. |
|
5 | 516 |
* @return array |
0 | 517 |
*/ |
518 |
function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
519 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
0 | 520 |
|
521 |
$links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; |
|
522 |
||
523 |
$links_array = array(); |
|
524 |
foreach ($links as $link) |
|
525 |
$links_array[] = $link; |
|
526 |
||
527 |
return $links_array; |
|
528 |
} |
|
529 |
||
530 |
/** |
|
531 |
* Gets the links associated with category 'cat_name' and display rating stars/chars. |
|
532 |
* |
|
533 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
534 |
* @deprecated 2.1.0 Use get_bookmarks() |
0 | 535 |
* @see get_bookmarks() |
536 |
* |
|
16 | 537 |
* @param string $cat_name Optional. The category name to use. If no match is found, uses all. |
538 |
* Default 'noname'. |
|
539 |
* @param string $before Optional. The HTML to output before the link. Default empty. |
|
540 |
* @param string $after Optional. The HTML to output after the link. Default '<br />'. |
|
541 |
* @param string $between Optional. The HTML to output between the link/image and its description. |
|
542 |
* Not used if no image or $show_images is true. Default ' '. |
|
543 |
* @param bool $show_images Optional. Whether to show images (if defined). Default true. |
|
544 |
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
|
545 |
* 'description', 'rating', or 'owner'. Default 'id'. |
|
546 |
* If you start the name with an underscore, the order will be reversed. |
|
547 |
* Specifying 'rand' as the order will return links in a random order. |
|
548 |
* @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
|
549 |
* Default true. |
|
550 |
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
551 |
* Default -1. |
|
552 |
* @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. |
|
0 | 553 |
*/ |
554 |
function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", |
|
555 |
$show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
556 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
0 | 557 |
|
558 |
get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); |
|
559 |
} |
|
560 |
||
561 |
/** |
|
562 |
* Gets the links associated with category n and display rating stars/chars. |
|
563 |
* |
|
564 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
565 |
* @deprecated 2.1.0 Use get_bookmarks() |
0 | 566 |
* @see get_bookmarks() |
567 |
* |
|
16 | 568 |
* @param int $category Optional. The category to use. If no category supplied, uses all. |
569 |
* Default 0. |
|
570 |
* @param string $before Optional. The HTML to output before the link. Default empty. |
|
571 |
* @param string $after Optional. The HTML to output after the link. Default '<br />'. |
|
572 |
* @param string $between Optional. The HTML to output between the link/image and its description. |
|
573 |
* Not used if no image or $show_images is true. Default ' '. |
|
574 |
* @param bool $show_images Optional. Whether to show images (if defined). Default true. |
|
575 |
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
|
576 |
* 'description', 'rating', or 'owner'. Default 'id'. |
|
577 |
* If you start the name with an underscore, the order will be reversed. |
|
578 |
* Specifying 'rand' as the order will return links in a random order. |
|
579 |
* @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
|
580 |
* Default true. |
|
581 |
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
582 |
* Default -1. |
|
583 |
* @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. |
|
0 | 584 |
*/ |
585 |
function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, |
|
16 | 586 |
$orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
587 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
0 | 588 |
|
589 |
get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); |
|
590 |
} |
|
591 |
||
592 |
/** |
|
593 |
* Gets the auto_toggle setting. |
|
594 |
* |
|
595 |
* @since 0.71 |
|
5 | 596 |
* @deprecated 2.1.0 |
0 | 597 |
* |
598 |
* @param int $id The category to get. If no category supplied uses 0 |
|
599 |
* @return int Only returns 0. |
|
600 |
*/ |
|
601 |
function get_autotoggle($id = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
602 |
_deprecated_function( __FUNCTION__, '2.1.0' ); |
0 | 603 |
return 0; |
604 |
} |
|
605 |
||
606 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
607 |
* Lists categories. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
608 |
* |
0 | 609 |
* @since 0.71 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
610 |
* @deprecated 2.1.0 Use wp_list_categories() |
0 | 611 |
* @see wp_list_categories() |
612 |
* |
|
613 |
* @param int $optionall |
|
614 |
* @param string $all |
|
615 |
* @param string $sort_column |
|
616 |
* @param string $sort_order |
|
617 |
* @param string $file |
|
618 |
* @param bool $list |
|
619 |
* @param int $optiondates |
|
620 |
* @param int $optioncount |
|
621 |
* @param int $hide_empty |
|
622 |
* @param int $use_desc_for_title |
|
623 |
* @param bool $children |
|
624 |
* @param int $child_of |
|
625 |
* @param int $categories |
|
626 |
* @param int $recurse |
|
627 |
* @param string $feed |
|
628 |
* @param string $feed_image |
|
629 |
* @param string $exclude |
|
630 |
* @param bool $hierarchical |
|
16 | 631 |
* @return null|false |
0 | 632 |
*/ |
633 |
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, |
|
16 | 634 |
$optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, |
635 |
$recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
636 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); |
0 | 637 |
|
638 |
$query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', |
|
639 |
'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); |
|
640 |
return wp_list_cats($query); |
|
641 |
} |
|
642 |
||
643 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
644 |
* Lists categories. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
645 |
* |
5 | 646 |
* @since 1.2.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
647 |
* @deprecated 2.1.0 Use wp_list_categories() |
0 | 648 |
* @see wp_list_categories() |
649 |
* |
|
650 |
* @param string|array $args |
|
16 | 651 |
* @return null|string|false |
0 | 652 |
*/ |
653 |
function wp_list_cats($args = '') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
654 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); |
0 | 655 |
|
16 | 656 |
$parsed_args = wp_parse_args( $args ); |
0 | 657 |
|
658 |
// Map to new names. |
|
16 | 659 |
if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) |
660 |
$parsed_args['show_option_all'] = $parsed_args['all']; |
|
661 |
if ( isset($parsed_args['sort_column']) ) |
|
662 |
$parsed_args['orderby'] = $parsed_args['sort_column']; |
|
663 |
if ( isset($parsed_args['sort_order']) ) |
|
664 |
$parsed_args['order'] = $parsed_args['sort_order']; |
|
665 |
if ( isset($parsed_args['optiondates']) ) |
|
666 |
$parsed_args['show_last_update'] = $parsed_args['optiondates']; |
|
667 |
if ( isset($parsed_args['optioncount']) ) |
|
668 |
$parsed_args['show_count'] = $parsed_args['optioncount']; |
|
669 |
if ( isset($parsed_args['list']) ) |
|
670 |
$parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; |
|
671 |
$parsed_args['title_li'] = ''; |
|
672 |
||
673 |
return wp_list_categories($parsed_args); |
|
0 | 674 |
} |
675 |
||
676 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
677 |
* Deprecated method for generating a drop-down of categories. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
678 |
* |
0 | 679 |
* @since 0.71 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
680 |
* @deprecated 2.1.0 Use wp_dropdown_categories() |
0 | 681 |
* @see wp_dropdown_categories() |
682 |
* |
|
683 |
* @param int $optionall |
|
684 |
* @param string $all |
|
685 |
* @param string $orderby |
|
686 |
* @param string $order |
|
687 |
* @param int $show_last_update |
|
688 |
* @param int $show_count |
|
689 |
* @param int $hide_empty |
|
690 |
* @param bool $optionnone |
|
691 |
* @param int $selected |
|
692 |
* @param int $exclude |
|
5 | 693 |
* @return string |
0 | 694 |
*/ |
695 |
function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', |
|
696 |
$show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, |
|
697 |
$selected = 0, $exclude = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
698 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' ); |
0 | 699 |
|
700 |
$show_option_all = ''; |
|
701 |
if ( $optionall ) |
|
702 |
$show_option_all = $all; |
|
703 |
||
704 |
$show_option_none = ''; |
|
705 |
if ( $optionnone ) |
|
706 |
$show_option_none = __('None'); |
|
707 |
||
708 |
$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', |
|
709 |
'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); |
|
710 |
$query = add_query_arg($vars, ''); |
|
711 |
return wp_dropdown_categories($query); |
|
712 |
} |
|
713 |
||
714 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
715 |
* Lists authors. |
5 | 716 |
* |
717 |
* @since 1.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
718 |
* @deprecated 2.1.0 Use wp_list_authors() |
0 | 719 |
* @see wp_list_authors() |
720 |
* |
|
721 |
* @param bool $optioncount |
|
722 |
* @param bool $exclude_admin |
|
723 |
* @param bool $show_fullname |
|
724 |
* @param bool $hide_empty |
|
725 |
* @param string $feed |
|
726 |
* @param string $feed_image |
|
5 | 727 |
* @return null|string |
0 | 728 |
*/ |
729 |
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
730 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' ); |
0 | 731 |
|
732 |
$args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); |
|
733 |
return wp_list_authors($args); |
|
734 |
} |
|
735 |
||
736 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
737 |
* Retrieves a list of post categories. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
738 |
* |
0 | 739 |
* @since 1.0.1 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
740 |
* @deprecated 2.1.0 Use wp_get_post_categories() |
0 | 741 |
* @see wp_get_post_categories() |
742 |
* |
|
743 |
* @param int $blogid Not Used |
|
744 |
* @param int $post_ID |
|
5 | 745 |
* @return array |
0 | 746 |
*/ |
747 |
function wp_get_post_cats($blogid = '1', $post_ID = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
748 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' ); |
0 | 749 |
return wp_get_post_categories($post_ID); |
750 |
} |
|
751 |
||
752 |
/** |
|
16 | 753 |
* Sets the categories that the post ID belongs to. |
0 | 754 |
* |
755 |
* @since 1.0.1 |
|
5 | 756 |
* @deprecated 2.1.0 |
0 | 757 |
* @deprecated Use wp_set_post_categories() |
758 |
* @see wp_set_post_categories() |
|
759 |
* |
|
760 |
* @param int $blogid Not used |
|
761 |
* @param int $post_ID |
|
762 |
* @param array $post_categories |
|
5 | 763 |
* @return bool|mixed |
0 | 764 |
*/ |
765 |
function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
766 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' ); |
0 | 767 |
return wp_set_post_categories($post_ID, $post_categories); |
768 |
} |
|
769 |
||
770 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
771 |
* Retrieves a list of archives. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
772 |
* |
0 | 773 |
* @since 0.71 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
774 |
* @deprecated 2.1.0 Use wp_get_archives() |
0 | 775 |
* @see wp_get_archives() |
776 |
* |
|
777 |
* @param string $type |
|
778 |
* @param string $limit |
|
779 |
* @param string $format |
|
780 |
* @param string $before |
|
781 |
* @param string $after |
|
782 |
* @param bool $show_post_count |
|
5 | 783 |
* @return string|null |
0 | 784 |
*/ |
785 |
function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
786 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' ); |
0 | 787 |
$args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); |
788 |
return wp_get_archives($args); |
|
789 |
} |
|
790 |
||
791 |
/** |
|
792 |
* Returns or Prints link to the author's posts. |
|
793 |
* |
|
5 | 794 |
* @since 1.2.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
795 |
* @deprecated 2.1.0 Use get_author_posts_url() |
0 | 796 |
* @see get_author_posts_url() |
797 |
* |
|
798 |
* @param bool $echo |
|
799 |
* @param int $author_id |
|
800 |
* @param string $author_nicename Optional. |
|
801 |
* @return string|null |
|
802 |
*/ |
|
803 |
function get_author_link($echo, $author_id, $author_nicename = '') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
804 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' ); |
0 | 805 |
|
806 |
$link = get_author_posts_url($author_id, $author_nicename); |
|
807 |
||
808 |
if ( $echo ) |
|
809 |
echo $link; |
|
810 |
return $link; |
|
811 |
} |
|
812 |
||
813 |
/** |
|
814 |
* Print list of pages based on arguments. |
|
815 |
* |
|
816 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
817 |
* @deprecated 2.1.0 Use wp_link_pages() |
0 | 818 |
* @see wp_link_pages() |
819 |
* |
|
820 |
* @param string $before |
|
821 |
* @param string $after |
|
822 |
* @param string $next_or_number |
|
823 |
* @param string $nextpagelink |
|
824 |
* @param string $previouspagelink |
|
825 |
* @param string $pagelink |
|
826 |
* @param string $more_file |
|
827 |
* @return string |
|
828 |
*/ |
|
829 |
function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', |
|
830 |
$pagelink='%', $more_file='') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
831 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' ); |
0 | 832 |
|
833 |
$args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); |
|
834 |
return wp_link_pages($args); |
|
835 |
} |
|
836 |
||
837 |
/** |
|
838 |
* Get value based on option. |
|
839 |
* |
|
840 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
841 |
* @deprecated 2.1.0 Use get_option() |
0 | 842 |
* @see get_option() |
843 |
* |
|
844 |
* @param string $option |
|
845 |
* @return string |
|
846 |
*/ |
|
847 |
function get_settings($option) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
848 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' ); |
0 | 849 |
|
850 |
return get_option($option); |
|
851 |
} |
|
852 |
||
853 |
/** |
|
854 |
* Print the permalink of the current post in the loop. |
|
855 |
* |
|
856 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
857 |
* @deprecated 1.2.0 Use the_permalink() |
0 | 858 |
* @see the_permalink() |
859 |
*/ |
|
860 |
function permalink_link() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
861 |
_deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' ); |
0 | 862 |
the_permalink(); |
863 |
} |
|
864 |
||
865 |
/** |
|
866 |
* Print the permalink to the RSS feed. |
|
867 |
* |
|
868 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
869 |
* @deprecated 2.3.0 Use the_permalink_rss() |
0 | 870 |
* @see the_permalink_rss() |
871 |
* |
|
872 |
* @param string $deprecated |
|
873 |
*/ |
|
874 |
function permalink_single_rss($deprecated = '') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
875 |
_deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' ); |
0 | 876 |
the_permalink_rss(); |
877 |
} |
|
878 |
||
879 |
/** |
|
880 |
* Gets the links associated with category. |
|
881 |
* |
|
882 |
* @since 1.0.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
883 |
* @deprecated 2.1.0 Use wp_list_bookmarks() |
0 | 884 |
* @see wp_list_bookmarks() |
885 |
* |
|
886 |
* @param string $args a query string |
|
887 |
* @return null|string |
|
888 |
*/ |
|
889 |
function wp_get_links($args = '') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
890 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); |
0 | 891 |
|
892 |
if ( strpos( $args, '=' ) === false ) { |
|
893 |
$cat_id = $args; |
|
894 |
$args = add_query_arg( 'category', $cat_id, $args ); |
|
895 |
} |
|
896 |
||
897 |
$defaults = array( |
|
898 |
'after' => '<br />', |
|
899 |
'before' => '', |
|
900 |
'between' => ' ', |
|
901 |
'categorize' => 0, |
|
902 |
'category' => '', |
|
903 |
'echo' => true, |
|
904 |
'limit' => -1, |
|
905 |
'orderby' => 'name', |
|
906 |
'show_description' => true, |
|
907 |
'show_images' => true, |
|
908 |
'show_rating' => false, |
|
909 |
'show_updated' => true, |
|
910 |
'title_li' => '', |
|
911 |
); |
|
912 |
||
16 | 913 |
$parsed_args = wp_parse_args( $args, $defaults ); |
914 |
||
915 |
return wp_list_bookmarks($parsed_args); |
|
0 | 916 |
} |
917 |
||
918 |
/** |
|
16 | 919 |
* Gets the links associated with category by ID. |
0 | 920 |
* |
921 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
922 |
* @deprecated 2.1.0 Use get_bookmarks() |
0 | 923 |
* @see get_bookmarks() |
924 |
* |
|
16 | 925 |
* @param int $category Optional. The category to use. If no category supplied uses all. |
926 |
* Default 0. |
|
927 |
* @param string $before Optional. The HTML to output before the link. Default empty. |
|
928 |
* @param string $after Optional. The HTML to output after the link. Default '<br />'. |
|
929 |
* @param string $between Optional. The HTML to output between the link/image and its description. |
|
930 |
* Not used if no image or $show_images is true. Default ' '. |
|
931 |
* @param bool $show_images Optional. Whether to show images (if defined). Default true. |
|
932 |
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
|
933 |
* 'description', 'rating', or 'owner'. Default 'name'. |
|
934 |
* If you start the name with an underscore, the order will be reversed. |
|
935 |
* Specifying 'rand' as the order will return links in a random order. |
|
936 |
* @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
|
937 |
* Default true. |
|
938 |
* @param bool $show_rating Optional. Show rating stars/chars. Default false. |
|
939 |
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
940 |
* Default -1. |
|
941 |
* @param int $show_updated Optional. Whether to show last updated timestamp. Default 1. |
|
942 |
* @param bool $echo Whether to echo the results, or return them instead. |
|
0 | 943 |
* @return null|string |
944 |
*/ |
|
945 |
function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', |
|
946 |
$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
947 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
0 | 948 |
|
949 |
$order = 'ASC'; |
|
950 |
if ( substr($orderby, 0, 1) == '_' ) { |
|
951 |
$order = 'DESC'; |
|
952 |
$orderby = substr($orderby, 1); |
|
953 |
} |
|
954 |
||
16 | 955 |
if ( $category == -1 ) // get_bookmarks() uses '' to signify all categories. |
0 | 956 |
$category = ''; |
957 |
||
958 |
$results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); |
|
959 |
||
960 |
if ( !$results ) |
|
961 |
return; |
|
962 |
||
963 |
$output = ''; |
|
964 |
||
965 |
foreach ( (array) $results as $row ) { |
|
966 |
if ( !isset($row->recently_updated) ) |
|
967 |
$row->recently_updated = false; |
|
968 |
$output .= $before; |
|
969 |
if ( $show_updated && $row->recently_updated ) |
|
970 |
$output .= get_option('links_recently_updated_prepend'); |
|
971 |
$the_link = '#'; |
|
972 |
if ( !empty($row->link_url) ) |
|
973 |
$the_link = esc_url($row->link_url); |
|
974 |
$rel = $row->link_rel; |
|
975 |
if ( '' != $rel ) |
|
976 |
$rel = ' rel="' . $rel . '"'; |
|
977 |
||
978 |
$desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); |
|
979 |
$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); |
|
980 |
$title = $desc; |
|
981 |
||
982 |
if ( $show_updated ) |
|
983 |
if (substr($row->link_updated_f, 0, 2) != '00') |
|
16 | 984 |
$title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; |
0 | 985 |
|
986 |
if ( '' != $title ) |
|
987 |
$title = ' title="' . $title . '"'; |
|
988 |
||
989 |
$alt = ' alt="' . $name . '"'; |
|
990 |
||
991 |
$target = $row->link_target; |
|
992 |
if ( '' != $target ) |
|
993 |
$target = ' target="' . $target . '"'; |
|
994 |
||
995 |
$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; |
|
996 |
||
997 |
if ( $row->link_image != null && $show_images ) { |
|
998 |
if ( strpos($row->link_image, 'http') !== false ) |
|
999 |
$output .= "<img src=\"$row->link_image\" $alt $title />"; |
|
16 | 1000 |
else // If it's a relative path. |
0 | 1001 |
$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; |
1002 |
} else { |
|
1003 |
$output .= $name; |
|
1004 |
} |
|
1005 |
||
1006 |
$output .= '</a>'; |
|
1007 |
||
1008 |
if ( $show_updated && $row->recently_updated ) |
|
1009 |
$output .= get_option('links_recently_updated_append'); |
|
1010 |
||
1011 |
if ( $show_description && '' != $desc ) |
|
1012 |
$output .= $between . $desc; |
|
1013 |
||
1014 |
if ($show_rating) { |
|
1015 |
$output .= $between . get_linkrating($row); |
|
1016 |
} |
|
1017 |
||
1018 |
$output .= "$after\n"; |
|
16 | 1019 |
} // End while. |
0 | 1020 |
|
1021 |
if ( !$echo ) |
|
1022 |
return $output; |
|
1023 |
echo $output; |
|
1024 |
} |
|
1025 |
||
1026 |
/** |
|
1027 |
* Output entire list of links by category. |
|
1028 |
* |
|
1029 |
* Output a list of all links, listed by category, using the settings in |
|
1030 |
* $wpdb->linkcategories and output it as a nested HTML unordered list. |
|
1031 |
* |
|
1032 |
* @since 1.0.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1033 |
* @deprecated 2.1.0 Use wp_list_bookmarks() |
0 | 1034 |
* @see wp_list_bookmarks() |
1035 |
* |
|
1036 |
* @param string $order Sort link categories by 'name' or 'id' |
|
1037 |
*/ |
|
1038 |
function get_links_list($order = 'name') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1039 |
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); |
0 | 1040 |
|
1041 |
$order = strtolower($order); |
|
1042 |
||
16 | 1043 |
// Handle link category sorting. |
0 | 1044 |
$direction = 'ASC'; |
1045 |
if ( '_' == substr($order,0,1) ) { |
|
1046 |
$direction = 'DESC'; |
|
1047 |
$order = substr($order,1); |
|
1048 |
} |
|
1049 |
||
1050 |
if ( !isset($direction) ) |
|
1051 |
$direction = ''; |
|
1052 |
||
1053 |
$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); |
|
1054 |
||
16 | 1055 |
// Display each category. |
0 | 1056 |
if ( $cats ) { |
1057 |
foreach ( (array) $cats as $cat ) { |
|
1058 |
// Handle each category. |
|
1059 |
||
16 | 1060 |
// Display the category name. |
0 | 1061 |
echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; |
16 | 1062 |
// Call get_links() with all the appropriate params. |
0 | 1063 |
get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); |
1064 |
||
16 | 1065 |
// Close the last category. |
0 | 1066 |
echo "\n\t</ul>\n</li>\n"; |
1067 |
} |
|
1068 |
} |
|
1069 |
} |
|
1070 |
||
1071 |
/** |
|
1072 |
* Show the link to the links popup and the number of links. |
|
1073 |
* |
|
1074 |
* @since 0.71 |
|
5 | 1075 |
* @deprecated 2.1.0 |
0 | 1076 |
* |
1077 |
* @param string $text the text of the link |
|
1078 |
* @param int $width the width of the popup window |
|
1079 |
* @param int $height the height of the popup window |
|
1080 |
* @param string $file the page to open in the popup window |
|
1081 |
* @param bool $count the number of links in the db |
|
1082 |
*/ |
|
1083 |
function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1084 |
_deprecated_function( __FUNCTION__, '2.1.0' ); |
0 | 1085 |
} |
1086 |
||
1087 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1088 |
* Legacy function that retrieved the value of a link's link_rating field. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1089 |
* |
0 | 1090 |
* @since 1.0.1 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1091 |
* @deprecated 2.1.0 Use sanitize_bookmark_field() |
0 | 1092 |
* @see sanitize_bookmark_field() |
1093 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1094 |
* @param object $link Link object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1095 |
* @return mixed Value of the 'link_rating' field, false otherwise. |
0 | 1096 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1097 |
function get_linkrating( $link ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1098 |
_deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' ); |
0 | 1099 |
return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); |
1100 |
} |
|
1101 |
||
1102 |
/** |
|
16 | 1103 |
* Gets the name of category by ID. |
0 | 1104 |
* |
1105 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1106 |
* @deprecated 2.1.0 Use get_category() |
0 | 1107 |
* @see get_category() |
1108 |
* |
|
1109 |
* @param int $id The category to get. If no category supplied uses 0 |
|
1110 |
* @return string |
|
1111 |
*/ |
|
1112 |
function get_linkcatname($id = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1113 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' ); |
0 | 1114 |
|
1115 |
$id = (int) $id; |
|
1116 |
||
1117 |
if ( empty($id) ) |
|
1118 |
return ''; |
|
1119 |
||
1120 |
$cats = wp_get_link_cats($id); |
|
1121 |
||
1122 |
if ( empty($cats) || ! is_array($cats) ) |
|
1123 |
return ''; |
|
1124 |
||
1125 |
$cat_id = (int) $cats[0]; // Take the first cat. |
|
1126 |
||
1127 |
$cat = get_category($cat_id); |
|
1128 |
return $cat->name; |
|
1129 |
} |
|
1130 |
||
1131 |
/** |
|
1132 |
* Print RSS comment feed link. |
|
1133 |
* |
|
1134 |
* @since 1.0.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1135 |
* @deprecated 2.5.0 Use post_comments_feed_link() |
0 | 1136 |
* @see post_comments_feed_link() |
1137 |
* |
|
1138 |
* @param string $link_text |
|
1139 |
*/ |
|
1140 |
function comments_rss_link($link_text = 'Comments RSS') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1141 |
_deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' ); |
0 | 1142 |
post_comments_feed_link($link_text); |
1143 |
} |
|
1144 |
||
1145 |
/** |
|
1146 |
* Print/Return link to category RSS2 feed. |
|
1147 |
* |
|
5 | 1148 |
* @since 1.2.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1149 |
* @deprecated 2.5.0 Use get_category_feed_link() |
0 | 1150 |
* @see get_category_feed_link() |
1151 |
* |
|
1152 |
* @param bool $echo |
|
1153 |
* @param int $cat_ID |
|
5 | 1154 |
* @return string |
0 | 1155 |
*/ |
1156 |
function get_category_rss_link($echo = false, $cat_ID = 1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1157 |
_deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' ); |
0 | 1158 |
|
1159 |
$link = get_category_feed_link($cat_ID, 'rss2'); |
|
1160 |
||
1161 |
if ( $echo ) |
|
1162 |
echo $link; |
|
1163 |
return $link; |
|
1164 |
} |
|
1165 |
||
1166 |
/** |
|
1167 |
* Print/Return link to author RSS feed. |
|
1168 |
* |
|
5 | 1169 |
* @since 1.2.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1170 |
* @deprecated 2.5.0 Use get_author_feed_link() |
0 | 1171 |
* @see get_author_feed_link() |
1172 |
* |
|
1173 |
* @param bool $echo |
|
1174 |
* @param int $author_id |
|
5 | 1175 |
* @return string |
0 | 1176 |
*/ |
1177 |
function get_author_rss_link($echo = false, $author_id = 1) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1178 |
_deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' ); |
0 | 1179 |
|
1180 |
$link = get_author_feed_link($author_id); |
|
1181 |
if ( $echo ) |
|
1182 |
echo $link; |
|
1183 |
return $link; |
|
1184 |
} |
|
1185 |
||
1186 |
/** |
|
1187 |
* Return link to the post RSS feed. |
|
1188 |
* |
|
5 | 1189 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1190 |
* @deprecated 2.2.0 Use get_post_comments_feed_link() |
0 | 1191 |
* @see get_post_comments_feed_link() |
1192 |
* |
|
1193 |
* @return string |
|
1194 |
*/ |
|
1195 |
function comments_rss() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1196 |
_deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' ); |
0 | 1197 |
return esc_url( get_post_comments_feed_link() ); |
1198 |
} |
|
1199 |
||
1200 |
/** |
|
1201 |
* An alias of wp_create_user(). |
|
1202 |
* |
|
5 | 1203 |
* @since 2.0.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1204 |
* @deprecated 2.0.0 Use wp_create_user() |
0 | 1205 |
* @see wp_create_user() |
1206 |
* |
|
1207 |
* @param string $username The user's username. |
|
1208 |
* @param string $password The user's password. |
|
5 | 1209 |
* @param string $email The user's email. |
0 | 1210 |
* @return int The new user's ID. |
1211 |
*/ |
|
1212 |
function create_user($username, $password, $email) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1213 |
_deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' ); |
0 | 1214 |
return wp_create_user($username, $password, $email); |
1215 |
} |
|
1216 |
||
1217 |
/** |
|
1218 |
* Unused function. |
|
1219 |
* |
|
5 | 1220 |
* @deprecated 2.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1221 |
*/ |
0 | 1222 |
function gzip_compression() { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1223 |
_deprecated_function( __FUNCTION__, '2.5.0' ); |
0 | 1224 |
return false; |
1225 |
} |
|
1226 |
||
1227 |
/** |
|
1228 |
* Retrieve an array of comment data about comment $comment_ID. |
|
1229 |
* |
|
1230 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1231 |
* @deprecated 2.7.0 Use get_comment() |
0 | 1232 |
* @see get_comment() |
1233 |
* |
|
1234 |
* @param int $comment_ID The ID of the comment |
|
1235 |
* @param int $no_cache Whether to use the cache (cast to bool) |
|
1236 |
* @param bool $include_unapproved Whether to include unapproved comments |
|
1237 |
* @return array The comment data |
|
1238 |
*/ |
|
1239 |
function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1240 |
_deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' ); |
0 | 1241 |
return get_comment($comment_ID, ARRAY_A); |
1242 |
} |
|
1243 |
||
1244 |
/** |
|
1245 |
* Retrieve the category name by the category ID. |
|
1246 |
* |
|
1247 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1248 |
* @deprecated 2.8.0 Use get_cat_name() |
0 | 1249 |
* @see get_cat_name() |
1250 |
* |
|
1251 |
* @param int $cat_ID Category ID |
|
1252 |
* @return string category name |
|
1253 |
*/ |
|
1254 |
function get_catname( $cat_ID ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1255 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' ); |
0 | 1256 |
return get_cat_name( $cat_ID ); |
1257 |
} |
|
1258 |
||
1259 |
/** |
|
1260 |
* Retrieve category children list separated before and after the term IDs. |
|
1261 |
* |
|
1262 |
* @since 1.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1263 |
* @deprecated 2.8.0 Use get_term_children() |
0 | 1264 |
* @see get_term_children() |
1265 |
* |
|
16 | 1266 |
* @param int $id Category ID to retrieve children. |
1267 |
* @param string $before Optional. Prepend before category term ID. Default '/'. |
|
1268 |
* @param string $after Optional. Append after category term ID. Default empty string. |
|
1269 |
* @param array $visited Optional. Category Term IDs that have already been added. |
|
1270 |
* Default empty array. |
|
0 | 1271 |
* @return string |
1272 |
*/ |
|
1273 |
function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1274 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); |
0 | 1275 |
if ( 0 == $id ) |
1276 |
return ''; |
|
1277 |
||
1278 |
$chain = ''; |
|
16 | 1279 |
/** TODO: Consult hierarchy */ |
0 | 1280 |
$cat_ids = get_all_category_ids(); |
1281 |
foreach ( (array) $cat_ids as $cat_id ) { |
|
1282 |
if ( $cat_id == $id ) |
|
1283 |
continue; |
|
1284 |
||
1285 |
$category = get_category( $cat_id ); |
|
1286 |
if ( is_wp_error( $category ) ) |
|
1287 |
return $category; |
|
1288 |
if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { |
|
1289 |
$visited[] = $category->term_id; |
|
1290 |
$chain .= $before.$category->term_id.$after; |
|
1291 |
$chain .= get_category_children( $category->term_id, $before, $after ); |
|
1292 |
} |
|
1293 |
} |
|
1294 |
return $chain; |
|
1295 |
} |
|
1296 |
||
1297 |
/** |
|
5 | 1298 |
* Retrieves all category IDs. |
1299 |
* |
|
1300 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1301 |
* @deprecated 4.0.0 Use get_terms() |
5 | 1302 |
* @see get_terms() |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1303 |
* |
16 | 1304 |
* @link https://developer.wordpress.org/reference/functions/get_all_category_ids/ |
5 | 1305 |
* |
1306 |
* @return object List of all of the category IDs. |
|
1307 |
*/ |
|
1308 |
function get_all_category_ids() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1309 |
_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' ); |
5 | 1310 |
|
16 | 1311 |
$cat_ids = get_terms( |
1312 |
array( |
|
1313 |
'taxonomy' => 'category', |
|
1314 |
'fields' => 'ids', |
|
1315 |
'get' => 'all', |
|
1316 |
) |
|
1317 |
); |
|
5 | 1318 |
|
1319 |
return $cat_ids; |
|
1320 |
} |
|
1321 |
||
1322 |
/** |
|
0 | 1323 |
* Retrieve the description of the author of the current post. |
1324 |
* |
|
5 | 1325 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1326 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1327 |
* @see get_the_author_meta() |
1328 |
* |
|
1329 |
* @return string The author's description. |
|
1330 |
*/ |
|
1331 |
function get_the_author_description() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1332 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' ); |
0 | 1333 |
return get_the_author_meta('description'); |
1334 |
} |
|
1335 |
||
1336 |
/** |
|
1337 |
* Display the description of the author of the current post. |
|
1338 |
* |
|
1339 |
* @since 1.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1340 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1341 |
* @see the_author_meta() |
1342 |
*/ |
|
1343 |
function the_author_description() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1344 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' ); |
0 | 1345 |
the_author_meta('description'); |
1346 |
} |
|
1347 |
||
1348 |
/** |
|
1349 |
* Retrieve the login name of the author of the current post. |
|
1350 |
* |
|
5 | 1351 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1352 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1353 |
* @see get_the_author_meta() |
1354 |
* |
|
1355 |
* @return string The author's login name (username). |
|
1356 |
*/ |
|
1357 |
function get_the_author_login() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1358 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' ); |
0 | 1359 |
return get_the_author_meta('login'); |
1360 |
} |
|
1361 |
||
1362 |
/** |
|
1363 |
* Display the login name of the author of the current post. |
|
1364 |
* |
|
1365 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1366 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1367 |
* @see the_author_meta() |
1368 |
*/ |
|
1369 |
function the_author_login() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1370 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' ); |
0 | 1371 |
the_author_meta('login'); |
1372 |
} |
|
1373 |
||
1374 |
/** |
|
1375 |
* Retrieve the first name of the author of the current post. |
|
1376 |
* |
|
5 | 1377 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1378 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1379 |
* @see get_the_author_meta() |
1380 |
* |
|
1381 |
* @return string The author's first name. |
|
1382 |
*/ |
|
1383 |
function get_the_author_firstname() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1384 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' ); |
0 | 1385 |
return get_the_author_meta('first_name'); |
1386 |
} |
|
1387 |
||
1388 |
/** |
|
1389 |
* Display the first name of the author of the current post. |
|
1390 |
* |
|
1391 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1392 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1393 |
* @see the_author_meta() |
1394 |
*/ |
|
1395 |
function the_author_firstname() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1396 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' ); |
0 | 1397 |
the_author_meta('first_name'); |
1398 |
} |
|
1399 |
||
1400 |
/** |
|
1401 |
* Retrieve the last name of the author of the current post. |
|
1402 |
* |
|
5 | 1403 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1404 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1405 |
* @see get_the_author_meta() |
1406 |
* |
|
1407 |
* @return string The author's last name. |
|
1408 |
*/ |
|
1409 |
function get_the_author_lastname() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1410 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' ); |
0 | 1411 |
return get_the_author_meta('last_name'); |
1412 |
} |
|
1413 |
||
1414 |
/** |
|
1415 |
* Display the last name of the author of the current post. |
|
1416 |
* |
|
1417 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1418 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1419 |
* @see the_author_meta() |
1420 |
*/ |
|
1421 |
function the_author_lastname() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1422 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' ); |
0 | 1423 |
the_author_meta('last_name'); |
1424 |
} |
|
1425 |
||
1426 |
/** |
|
1427 |
* Retrieve the nickname of the author of the current post. |
|
1428 |
* |
|
5 | 1429 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1430 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1431 |
* @see get_the_author_meta() |
1432 |
* |
|
1433 |
* @return string The author's nickname. |
|
1434 |
*/ |
|
1435 |
function get_the_author_nickname() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1436 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' ); |
0 | 1437 |
return get_the_author_meta('nickname'); |
1438 |
} |
|
1439 |
||
1440 |
/** |
|
1441 |
* Display the nickname of the author of the current post. |
|
1442 |
* |
|
1443 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1444 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1445 |
* @see the_author_meta() |
1446 |
*/ |
|
1447 |
function the_author_nickname() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1448 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' ); |
0 | 1449 |
the_author_meta('nickname'); |
1450 |
} |
|
1451 |
||
1452 |
/** |
|
1453 |
* Retrieve the email of the author of the current post. |
|
1454 |
* |
|
5 | 1455 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1456 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1457 |
* @see get_the_author_meta() |
1458 |
* |
|
1459 |
* @return string The author's username. |
|
1460 |
*/ |
|
1461 |
function get_the_author_email() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1462 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' ); |
0 | 1463 |
return get_the_author_meta('email'); |
1464 |
} |
|
1465 |
||
1466 |
/** |
|
1467 |
* Display the email of the author of the current post. |
|
1468 |
* |
|
1469 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1470 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1471 |
* @see the_author_meta() |
1472 |
*/ |
|
1473 |
function the_author_email() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1474 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' ); |
0 | 1475 |
the_author_meta('email'); |
1476 |
} |
|
1477 |
||
1478 |
/** |
|
1479 |
* Retrieve the ICQ number of the author of the current post. |
|
1480 |
* |
|
5 | 1481 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1482 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1483 |
* @see get_the_author_meta() |
1484 |
* |
|
1485 |
* @return string The author's ICQ number. |
|
1486 |
*/ |
|
1487 |
function get_the_author_icq() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1488 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' ); |
0 | 1489 |
return get_the_author_meta('icq'); |
1490 |
} |
|
1491 |
||
1492 |
/** |
|
1493 |
* Display the ICQ number of the author of the current post. |
|
1494 |
* |
|
1495 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1496 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1497 |
* @see the_author_meta() |
1498 |
*/ |
|
1499 |
function the_author_icq() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1500 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' ); |
0 | 1501 |
the_author_meta('icq'); |
1502 |
} |
|
1503 |
||
1504 |
/** |
|
1505 |
* Retrieve the Yahoo! IM name of the author of the current post. |
|
1506 |
* |
|
5 | 1507 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1508 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1509 |
* @see get_the_author_meta() |
1510 |
* |
|
1511 |
* @return string The author's Yahoo! IM name. |
|
1512 |
*/ |
|
1513 |
function get_the_author_yim() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1514 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' ); |
0 | 1515 |
return get_the_author_meta('yim'); |
1516 |
} |
|
1517 |
||
1518 |
/** |
|
1519 |
* Display the Yahoo! IM name of the author of the current post. |
|
1520 |
* |
|
1521 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1522 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1523 |
* @see the_author_meta() |
1524 |
*/ |
|
1525 |
function the_author_yim() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1526 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' ); |
0 | 1527 |
the_author_meta('yim'); |
1528 |
} |
|
1529 |
||
1530 |
/** |
|
1531 |
* Retrieve the MSN address of the author of the current post. |
|
1532 |
* |
|
5 | 1533 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1534 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1535 |
* @see get_the_author_meta() |
1536 |
* |
|
1537 |
* @return string The author's MSN address. |
|
1538 |
*/ |
|
1539 |
function get_the_author_msn() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1540 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' ); |
0 | 1541 |
return get_the_author_meta('msn'); |
1542 |
} |
|
1543 |
||
1544 |
/** |
|
1545 |
* Display the MSN address of the author of the current post. |
|
1546 |
* |
|
1547 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1548 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1549 |
* @see the_author_meta() |
1550 |
*/ |
|
1551 |
function the_author_msn() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1552 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' ); |
0 | 1553 |
the_author_meta('msn'); |
1554 |
} |
|
1555 |
||
1556 |
/** |
|
1557 |
* Retrieve the AIM address of the author of the current post. |
|
1558 |
* |
|
5 | 1559 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1560 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1561 |
* @see get_the_author_meta() |
1562 |
* |
|
1563 |
* @return string The author's AIM address. |
|
1564 |
*/ |
|
1565 |
function get_the_author_aim() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1566 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' ); |
0 | 1567 |
return get_the_author_meta('aim'); |
1568 |
} |
|
1569 |
||
1570 |
/** |
|
1571 |
* Display the AIM address of the author of the current post. |
|
1572 |
* |
|
1573 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1574 |
* @deprecated 2.8.0 Use the_author_meta('aim') |
0 | 1575 |
* @see the_author_meta() |
1576 |
*/ |
|
1577 |
function the_author_aim() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1578 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' ); |
0 | 1579 |
the_author_meta('aim'); |
1580 |
} |
|
1581 |
||
1582 |
/** |
|
1583 |
* Retrieve the specified author's preferred display name. |
|
1584 |
* |
|
1585 |
* @since 1.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1586 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1587 |
* @see get_the_author_meta() |
1588 |
* |
|
1589 |
* @param int $auth_id The ID of the author. |
|
1590 |
* @return string The author's display name. |
|
1591 |
*/ |
|
1592 |
function get_author_name( $auth_id = false ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1593 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' ); |
0 | 1594 |
return get_the_author_meta('display_name', $auth_id); |
1595 |
} |
|
1596 |
||
1597 |
/** |
|
1598 |
* Retrieve the URL to the home page of the author of the current post. |
|
1599 |
* |
|
5 | 1600 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1601 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1602 |
* @see get_the_author_meta() |
1603 |
* |
|
1604 |
* @return string The URL to the author's page. |
|
1605 |
*/ |
|
1606 |
function get_the_author_url() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1607 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' ); |
0 | 1608 |
return get_the_author_meta('url'); |
1609 |
} |
|
1610 |
||
1611 |
/** |
|
1612 |
* Display the URL to the home page of the author of the current post. |
|
1613 |
* |
|
1614 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1615 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1616 |
* @see the_author_meta() |
1617 |
*/ |
|
1618 |
function the_author_url() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1619 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' ); |
0 | 1620 |
the_author_meta('url'); |
1621 |
} |
|
1622 |
||
1623 |
/** |
|
1624 |
* Retrieve the ID of the author of the current post. |
|
1625 |
* |
|
5 | 1626 |
* @since 1.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1627 |
* @deprecated 2.8.0 Use get_the_author_meta() |
0 | 1628 |
* @see get_the_author_meta() |
1629 |
* |
|
5 | 1630 |
* @return string|int The author's ID. |
0 | 1631 |
*/ |
1632 |
function get_the_author_ID() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1633 |
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' ); |
0 | 1634 |
return get_the_author_meta('ID'); |
1635 |
} |
|
1636 |
||
1637 |
/** |
|
1638 |
* Display the ID of the author of the current post. |
|
1639 |
* |
|
1640 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1641 |
* @deprecated 2.8.0 Use the_author_meta() |
0 | 1642 |
* @see the_author_meta() |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1643 |
*/ |
0 | 1644 |
function the_author_ID() { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1645 |
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' ); |
0 | 1646 |
the_author_meta('ID'); |
1647 |
} |
|
1648 |
||
1649 |
/** |
|
1650 |
* Display the post content for the feed. |
|
1651 |
* |
|
16 | 1652 |
* For encoding the HTML or the $encode_html parameter, there are three possible values: |
1653 |
* - '0' will make urls footnotes and use make_url_footnote(). |
|
1654 |
* - '1' will encode special characters and automatically display all of the content. |
|
1655 |
* - '2' will strip all HTML tags from the content. |
|
1656 |
* |
|
1657 |
* Also note that you cannot set the amount of words and not set the HTML encoding. |
|
1658 |
* If that is the case, then the HTML encoding will default to 2, which will strip |
|
1659 |
* all HTML tags. |
|
1660 |
* |
|
1661 |
* To restrict the amount of words of the content, you can use the cut parameter. |
|
1662 |
* If the content is less than the amount, then there won't be any dots added to the end. |
|
1663 |
* If there is content left over, then dots will be added and the rest of the content |
|
1664 |
* will be removed. |
|
0 | 1665 |
* |
1666 |
* @since 0.71 |
|
1667 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1668 |
* @deprecated 2.9.0 Use the_content_feed() |
0 | 1669 |
* @see the_content_feed() |
1670 |
* |
|
16 | 1671 |
* @param string $more_link_text Optional. Text to display when more content is available |
1672 |
* but not displayed. Default '(more...)'. |
|
1673 |
* @param int $stripteaser Optional. Default 0. |
|
1674 |
* @param string $more_file Optional. |
|
1675 |
* @param int $cut Optional. Amount of words to keep for the content. |
|
1676 |
* @param int $encode_html Optional. How to encode the content. |
|
0 | 1677 |
*/ |
1678 |
function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1679 |
_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' ); |
0 | 1680 |
$content = get_the_content($more_link_text, $stripteaser); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1681 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1682 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1683 |
* Filters the post content in the context of an RSS feed. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1684 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1685 |
* @since 0.71 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1686 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1687 |
* @param string $content Content of the current post. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1688 |
*/ |
0 | 1689 |
$content = apply_filters('the_content_rss', $content); |
1690 |
if ( $cut && !$encode_html ) |
|
1691 |
$encode_html = 2; |
|
1692 |
if ( 1== $encode_html ) { |
|
1693 |
$content = esc_html($content); |
|
1694 |
$cut = 0; |
|
1695 |
} elseif ( 0 == $encode_html ) { |
|
1696 |
$content = make_url_footnote($content); |
|
1697 |
} elseif ( 2 == $encode_html ) { |
|
1698 |
$content = strip_tags($content); |
|
1699 |
} |
|
1700 |
if ( $cut ) { |
|
1701 |
$blah = explode(' ', $content); |
|
1702 |
if ( count($blah) > $cut ) { |
|
1703 |
$k = $cut; |
|
1704 |
$use_dotdotdot = 1; |
|
1705 |
} else { |
|
1706 |
$k = count($blah); |
|
1707 |
$use_dotdotdot = 0; |
|
1708 |
} |
|
1709 |
||
1710 |
/** @todo Check performance, might be faster to use array slice instead. */ |
|
1711 |
for ( $i=0; $i<$k; $i++ ) |
|
1712 |
$excerpt .= $blah[$i].' '; |
|
1713 |
$excerpt .= ($use_dotdotdot) ? '...' : ''; |
|
1714 |
$content = $excerpt; |
|
1715 |
} |
|
1716 |
$content = str_replace(']]>', ']]>', $content); |
|
1717 |
echo $content; |
|
1718 |
} |
|
1719 |
||
1720 |
/** |
|
1721 |
* Strip HTML and put links at the bottom of stripped content. |
|
1722 |
* |
|
1723 |
* Searches for all of the links, strips them out of the content, and places |
|
1724 |
* them at the bottom of the content with numbers. |
|
1725 |
* |
|
1726 |
* @since 0.71 |
|
1727 |
* @deprecated 2.9.0 |
|
1728 |
* |
|
16 | 1729 |
* @param string $content Content to get links. |
0 | 1730 |
* @return string HTML stripped out of content with links at the bottom. |
1731 |
*/ |
|
1732 |
function make_url_footnote( $content ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1733 |
_deprecated_function( __FUNCTION__, '2.9.0', '' ); |
0 | 1734 |
preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); |
1735 |
$links_summary = "\n"; |
|
5 | 1736 |
for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { |
0 | 1737 |
$link_match = $matches[0][$i]; |
1738 |
$link_number = '['.($i+1).']'; |
|
1739 |
$link_url = $matches[2][$i]; |
|
1740 |
$link_text = $matches[4][$i]; |
|
1741 |
$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); |
|
1742 |
$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; |
|
1743 |
$links_summary .= "\n" . $link_number . ' ' . $link_url; |
|
1744 |
} |
|
1745 |
$content = strip_tags( $content ); |
|
1746 |
$content .= $links_summary; |
|
1747 |
return $content; |
|
1748 |
} |
|
1749 |
||
1750 |
/** |
|
1751 |
* Retrieve translated string with vertical bar context |
|
1752 |
* |
|
1753 |
* Quite a few times, there will be collisions with similar translatable text |
|
1754 |
* found in more than two places but with different translated context. |
|
1755 |
* |
|
1756 |
* In order to use the separate contexts, the _c() function is used and the |
|
1757 |
* translatable string uses a pipe ('|') which has the context the string is in. |
|
1758 |
* |
|
1759 |
* When the translated string is returned, it is everything before the pipe, not |
|
1760 |
* including the pipe character. If there is no pipe in the translated text then |
|
1761 |
* everything is returned. |
|
1762 |
* |
|
1763 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1764 |
* @deprecated 2.9.0 Use _x() |
0 | 1765 |
* @see _x() |
1766 |
* |
|
16 | 1767 |
* @param string $text Text to translate. |
1768 |
* @param string $domain Optional. Domain to retrieve the translated text. |
|
1769 |
* @return string Translated context string without pipe. |
|
0 | 1770 |
*/ |
1771 |
function _c( $text, $domain = 'default' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1772 |
_deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); |
0 | 1773 |
return before_last_bar( translate( $text, $domain ) ); |
1774 |
} |
|
1775 |
||
1776 |
/** |
|
1777 |
* Translates $text like translate(), but assumes that the text |
|
1778 |
* contains a context after its last vertical bar. |
|
1779 |
* |
|
5 | 1780 |
* @since 2.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1781 |
* @deprecated 3.0.0 Use _x() |
0 | 1782 |
* @see _x() |
1783 |
* |
|
16 | 1784 |
* @param string $text Text to translate. |
1785 |
* @param string $domain Domain to retrieve the translated text. |
|
1786 |
* @return string Translated text. |
|
0 | 1787 |
*/ |
1788 |
function translate_with_context( $text, $domain = 'default' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1789 |
_deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); |
0 | 1790 |
return before_last_bar( translate( $text, $domain ) ); |
1791 |
} |
|
1792 |
||
1793 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1794 |
* Legacy version of _n(), which supports contexts. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1795 |
* |
0 | 1796 |
* Strips everything from the translation after the last bar. |
1797 |
* |
|
1798 |
* @since 2.7.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1799 |
* @deprecated 3.0.0 Use _nx() |
0 | 1800 |
* @see _nx() |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1801 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1802 |
* @param string $single The text to be used if the number is singular. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1803 |
* @param string $plural The text to be used if the number is plural. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1804 |
* @param int $number The number to compare against to use either the singular or plural form. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1805 |
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1806 |
* Default 'default'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1807 |
* @return string The translated singular or plural form. |
0 | 1808 |
*/ |
1809 |
function _nc( $single, $plural, $number, $domain = 'default' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1810 |
_deprecated_function( __FUNCTION__, '2.9.0', '_nx()' ); |
0 | 1811 |
return before_last_bar( _n( $single, $plural, $number, $domain ) ); |
1812 |
} |
|
1813 |
||
1814 |
/** |
|
1815 |
* Retrieve the plural or single form based on the amount. |
|
1816 |
* |
|
1817 |
* @since 1.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1818 |
* @deprecated 2.8.0 Use _n() |
0 | 1819 |
* @see _n() |
1820 |
*/ |
|
16 | 1821 |
function __ngettext( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1822 |
_deprecated_function( __FUNCTION__, '2.8.0', '_n()' ); |
16 | 1823 |
return _n( ...$args ); |
0 | 1824 |
} |
1825 |
||
1826 |
/** |
|
1827 |
* Register plural strings in POT file, but don't translate them. |
|
1828 |
* |
|
5 | 1829 |
* @since 2.5.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1830 |
* @deprecated 2.8.0 Use _n_noop() |
0 | 1831 |
* @see _n_noop() |
1832 |
*/ |
|
16 | 1833 |
function __ngettext_noop( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1834 |
_deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' ); |
16 | 1835 |
return _n_noop( ...$args ); |
0 | 1836 |
|
1837 |
} |
|
1838 |
||
1839 |
/** |
|
1840 |
* Retrieve all autoload options, or all options if no autoloaded ones exist. |
|
1841 |
* |
|
1842 |
* @since 1.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1843 |
* @deprecated 3.0.0 Use wp_load_alloptions()) |
0 | 1844 |
* @see wp_load_alloptions() |
1845 |
* |
|
1846 |
* @return array List of all options. |
|
1847 |
*/ |
|
1848 |
function get_alloptions() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1849 |
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' ); |
0 | 1850 |
return wp_load_alloptions(); |
1851 |
} |
|
1852 |
||
1853 |
/** |
|
1854 |
* Retrieve HTML content of attachment image with link. |
|
1855 |
* |
|
1856 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1857 |
* @deprecated 2.5.0 Use wp_get_attachment_link() |
0 | 1858 |
* @see wp_get_attachment_link() |
1859 |
* |
|
16 | 1860 |
* @param int $id Optional. Post ID. |
1861 |
* @param bool $fullsize Optional. Whether to use full size image. Default false. |
|
0 | 1862 |
* @param array $max_dims Optional. Max image dimensions. |
16 | 1863 |
* @param bool $permalink Optional. Whether to include permalink to image. Default false. |
0 | 1864 |
* @return string |
1865 |
*/ |
|
1866 |
function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1867 |
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); |
0 | 1868 |
$id = (int) $id; |
1869 |
$_post = get_post($id); |
|
1870 |
||
1871 |
if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) |
|
1872 |
return __('Missing Attachment'); |
|
1873 |
||
1874 |
if ( $permalink ) |
|
1875 |
$url = get_attachment_link($_post->ID); |
|
1876 |
||
1877 |
$post_title = esc_attr($_post->post_title); |
|
1878 |
||
1879 |
$innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); |
|
1880 |
return "<a href='$url' title='$post_title'>$innerHTML</a>"; |
|
1881 |
} |
|
1882 |
||
1883 |
/** |
|
1884 |
* Retrieve icon URL and Path. |
|
1885 |
* |
|
1886 |
* @since 2.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1887 |
* @deprecated 2.5.0 Use wp_get_attachment_image_src() |
0 | 1888 |
* @see wp_get_attachment_image_src() |
1889 |
* |
|
16 | 1890 |
* @param int $id Optional. Post ID. |
1891 |
* @param bool $fullsize Optional. Whether to have full image. Default false. |
|
0 | 1892 |
* @return array Icon URL and full path to file, respectively. |
1893 |
*/ |
|
1894 |
function get_attachment_icon_src( $id = 0, $fullsize = false ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1895 |
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' ); |
0 | 1896 |
$id = (int) $id; |
1897 |
if ( !$post = get_post($id) ) |
|
1898 |
return false; |
|
1899 |
||
1900 |
$file = get_attached_file( $post->ID ); |
|
1901 |
||
1902 |
if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { |
|
16 | 1903 |
// We have a thumbnail desired, specified and existing. |
0 | 1904 |
|
9 | 1905 |
$src_file = wp_basename($src); |
0 | 1906 |
} elseif ( wp_attachment_is_image( $post->ID ) ) { |
16 | 1907 |
// We have an image without a thumbnail. |
0 | 1908 |
|
1909 |
$src = wp_get_attachment_url( $post->ID ); |
|
1910 |
$src_file = & $file; |
|
1911 |
} elseif ( $src = wp_mime_type_icon( $post->ID ) ) { |
|
1912 |
// No thumb, no image. We'll look for a mime-related icon instead. |
|
1913 |
||
1914 |
$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); |
|
9 | 1915 |
$src_file = $icon_dir . '/' . wp_basename($src); |
0 | 1916 |
} |
1917 |
||
1918 |
if ( !isset($src) || !$src ) |
|
1919 |
return false; |
|
1920 |
||
1921 |
return array($src, $src_file); |
|
1922 |
} |
|
1923 |
||
1924 |
/** |
|
1925 |
* Retrieve HTML content of icon attachment image element. |
|
1926 |
* |
|
1927 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1928 |
* @deprecated 2.5.0 Use wp_get_attachment_image() |
0 | 1929 |
* @see wp_get_attachment_image() |
1930 |
* |
|
16 | 1931 |
* @param int $id Optional. Post ID. |
1932 |
* @param bool $fullsize Optional. Whether to have full size image. Default false. |
|
0 | 1933 |
* @param array $max_dims Optional. Dimensions of image. |
16 | 1934 |
* @return string|false HTML content. |
0 | 1935 |
*/ |
1936 |
function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1937 |
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
0 | 1938 |
$id = (int) $id; |
1939 |
if ( !$post = get_post($id) ) |
|
1940 |
return false; |
|
1941 |
||
1942 |
if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) |
|
1943 |
return false; |
|
1944 |
||
1945 |
list($src, $src_file) = $src; |
|
1946 |
||
1947 |
// Do we need to constrain the image? |
|
1948 |
if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { |
|
1949 |
||
16 | 1950 |
$imagesize = @getimagesize($src_file); |
0 | 1951 |
|
1952 |
if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { |
|
1953 |
$actual_aspect = $imagesize[0] / $imagesize[1]; |
|
1954 |
$desired_aspect = $max_dims[0] / $max_dims[1]; |
|
1955 |
||
1956 |
if ( $actual_aspect >= $desired_aspect ) { |
|
1957 |
$height = $actual_aspect * $max_dims[0]; |
|
1958 |
$constraint = "width='{$max_dims[0]}' "; |
|
1959 |
$post->iconsize = array($max_dims[0], $height); |
|
1960 |
} else { |
|
1961 |
$width = $max_dims[1] / $actual_aspect; |
|
1962 |
$constraint = "height='{$max_dims[1]}' "; |
|
1963 |
$post->iconsize = array($width, $max_dims[1]); |
|
1964 |
} |
|
1965 |
} else { |
|
1966 |
$post->iconsize = array($imagesize[0], $imagesize[1]); |
|
1967 |
$constraint = ''; |
|
1968 |
} |
|
1969 |
} else { |
|
1970 |
$constraint = ''; |
|
1971 |
} |
|
1972 |
||
1973 |
$post_title = esc_attr($post->post_title); |
|
1974 |
||
1975 |
$icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>"; |
|
1976 |
||
1977 |
return apply_filters( 'attachment_icon', $icon, $post->ID ); |
|
1978 |
} |
|
1979 |
||
1980 |
/** |
|
1981 |
* Retrieve HTML content of image element. |
|
1982 |
* |
|
1983 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1984 |
* @deprecated 2.5.0 Use wp_get_attachment_image() |
0 | 1985 |
* @see wp_get_attachment_image() |
1986 |
* |
|
16 | 1987 |
* @param int $id Optional. Post ID. |
1988 |
* @param bool $fullsize Optional. Whether to have full size image. Default false. |
|
0 | 1989 |
* @param array $max_dims Optional. Dimensions of image. |
16 | 1990 |
* @return string|false |
0 | 1991 |
*/ |
1992 |
function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1993 |
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
0 | 1994 |
$id = (int) $id; |
1995 |
if ( !$post = get_post($id) ) |
|
1996 |
return false; |
|
1997 |
||
1998 |
if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) |
|
1999 |
return $innerHTML; |
|
2000 |
||
2001 |
$innerHTML = esc_attr($post->post_title); |
|
2002 |
||
2003 |
return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); |
|
2004 |
} |
|
2005 |
||
2006 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2007 |
* Retrieves bookmark data based on ID. |
0 | 2008 |
* |
2009 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2010 |
* @deprecated 2.1.0 Use get_bookmark() |
0 | 2011 |
* @see get_bookmark() |
2012 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2013 |
* @param int $bookmark_id ID of link |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2014 |
* @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2015 |
* Default OBJECT. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2016 |
* @param string $filter Optional. How to filter the link for output. Accepts 'raw', 'edit', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2017 |
* 'attribute', 'js', 'db', or 'display'. Default 'raw'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2018 |
* @return object|array Bookmark object or array, depending on the type specified by `$output`. |
0 | 2019 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2020 |
function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2021 |
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' ); |
0 | 2022 |
return get_bookmark($bookmark_id, $output, $filter); |
2023 |
} |
|
2024 |
||
2025 |
/** |
|
2026 |
* Performs esc_url() for database or redirect usage. |
|
2027 |
* |
|
2028 |
* @since 2.3.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2029 |
* @deprecated 2.8.0 Use esc_url_raw() |
0 | 2030 |
* @see esc_url_raw() |
2031 |
* |
|
2032 |
* @param string $url The URL to be cleaned. |
|
2033 |
* @param array $protocols An array of acceptable protocols. |
|
2034 |
* @return string The cleaned URL. |
|
2035 |
*/ |
|
2036 |
function sanitize_url( $url, $protocols = null ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2037 |
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' ); |
0 | 2038 |
return esc_url_raw( $url, $protocols ); |
2039 |
} |
|
2040 |
||
2041 |
/** |
|
2042 |
* Checks and cleans a URL. |
|
2043 |
* |
|
2044 |
* A number of characters are removed from the URL. If the URL is for displaying |
|
2045 |
* (the default behaviour) ampersands are also replaced. The 'clean_url' filter |
|
2046 |
* is applied to the returned cleaned URL. |
|
2047 |
* |
|
2048 |
* @since 1.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2049 |
* @deprecated 3.0.0 Use esc_url() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2050 |
* @see esc_url() |
0 | 2051 |
* |
2052 |
* @param string $url The URL to be cleaned. |
|
2053 |
* @param array $protocols Optional. An array of acceptable protocols. |
|
2054 |
* @param string $context Optional. How the URL will be used. Default is 'display'. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2055 |
* @return string The cleaned $url after the {@see 'clean_url'} filter is applied. |
0 | 2056 |
*/ |
2057 |
function clean_url( $url, $protocols = null, $context = 'display' ) { |
|
2058 |
if ( $context == 'db' ) |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2059 |
_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' ); |
0 | 2060 |
else |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2061 |
_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); |
0 | 2062 |
return esc_url( $url, $protocols, $context ); |
2063 |
} |
|
2064 |
||
2065 |
/** |
|
2066 |
* Escape single quotes, specialchar double quotes, and fix line endings. |
|
2067 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2068 |
* The filter {@see 'js_escape'} is also applied by esc_js(). |
0 | 2069 |
* |
2070 |
* @since 2.0.4 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2071 |
* @deprecated 2.8.0 Use esc_js() |
0 | 2072 |
* @see esc_js() |
2073 |
* |
|
2074 |
* @param string $text The text to be escaped. |
|
2075 |
* @return string Escaped text. |
|
2076 |
*/ |
|
2077 |
function js_escape( $text ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2078 |
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' ); |
0 | 2079 |
return esc_js( $text ); |
2080 |
} |
|
2081 |
||
2082 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2083 |
* Legacy escaping for HTML blocks. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2084 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2085 |
* @deprecated 2.8.0 Use esc_html() |
0 | 2086 |
* @see esc_html() |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2087 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2088 |
* @param string $string String to escape. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2089 |
* @param string $quote_style Unused. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2090 |
* @param false|string $charset Unused. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2091 |
* @param false $double_encode Whether to double encode. Unused. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2092 |
* @return string Escaped `$string`. |
0 | 2093 |
*/ |
2094 |
function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2095 |
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2096 |
if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments. |
16 | 2097 |
return _wp_specialchars( $string, $quote_style, $charset, $double_encode ); |
0 | 2098 |
} else { |
2099 |
return esc_html( $string ); |
|
2100 |
} |
|
2101 |
} |
|
2102 |
||
2103 |
/** |
|
2104 |
* Escaping for HTML attributes. |
|
2105 |
* |
|
2106 |
* @since 2.0.6 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2107 |
* @deprecated 2.8.0 Use esc_attr() |
0 | 2108 |
* @see esc_attr() |
2109 |
* |
|
2110 |
* @param string $text |
|
2111 |
* @return string |
|
2112 |
*/ |
|
2113 |
function attribute_escape( $text ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2114 |
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' ); |
0 | 2115 |
return esc_attr( $text ); |
2116 |
} |
|
2117 |
||
2118 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2119 |
* Register widget for sidebar with backward compatibility. |
0 | 2120 |
* |
2121 |
* Allows $name to be an array that accepts either three elements to grab the |
|
2122 |
* first element and the third for the name or just uses the first element of |
|
2123 |
* the array for the name. |
|
2124 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2125 |
* Passes to wp_register_sidebar_widget() after argument list and backward |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2126 |
* compatibility is complete. |
0 | 2127 |
* |
2128 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2129 |
* @deprecated 2.8.0 Use wp_register_sidebar_widget() |
0 | 2130 |
* @see wp_register_sidebar_widget() |
2131 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2132 |
* @param string|int $name Widget ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2133 |
* @param callable $output_callback Run when widget is called. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2134 |
* @param string $classname Optional. Classname widget option. Default empty. |
16 | 2135 |
* @param mixed ...$params Widget parameters. |
0 | 2136 |
*/ |
16 | 2137 |
function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2138 |
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' ); |
16 | 2139 |
// Compat. |
2140 |
if ( is_array( $name ) ) { |
|
2141 |
if ( count( $name ) === 3 ) { |
|
2142 |
$name = sprintf( $name[0], $name[2] ); |
|
2143 |
} else { |
|
0 | 2144 |
$name = $name[0]; |
16 | 2145 |
} |
0 | 2146 |
} |
2147 |
||
16 | 2148 |
$id = sanitize_title( $name ); |
0 | 2149 |
$options = array(); |
16 | 2150 |
if ( ! empty( $classname ) && is_string( $classname ) ) { |
0 | 2151 |
$options['classname'] = $classname; |
16 | 2152 |
} |
2153 |
||
2154 |
wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params ); |
|
0 | 2155 |
} |
2156 |
||
2157 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2158 |
* Serves as an alias of wp_unregister_sidebar_widget(). |
0 | 2159 |
* |
2160 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2161 |
* @deprecated 2.8.0 Use wp_unregister_sidebar_widget() |
0 | 2162 |
* @see wp_unregister_sidebar_widget() |
2163 |
* |
|
2164 |
* @param int|string $id Widget ID. |
|
2165 |
*/ |
|
2166 |
function unregister_sidebar_widget($id) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2167 |
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' ); |
0 | 2168 |
return wp_unregister_sidebar_widget($id); |
2169 |
} |
|
2170 |
||
2171 |
/** |
|
2172 |
* Registers widget control callback for customizing options. |
|
2173 |
* |
|
2174 |
* Allows $name to be an array that accepts either three elements to grab the |
|
2175 |
* first element and the third for the name or just uses the first element of |
|
2176 |
* the array for the name. |
|
2177 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2178 |
* Passes to wp_register_widget_control() after the argument list has |
0 | 2179 |
* been compiled. |
2180 |
* |
|
2181 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2182 |
* @deprecated 2.8.0 Use wp_register_widget_control() |
0 | 2183 |
* @see wp_register_widget_control() |
2184 |
* |
|
16 | 2185 |
* @param int|string $name Sidebar ID. |
2186 |
* @param callable $control_callback Widget control callback to display and process form. |
|
2187 |
* @param int $width Widget width. |
|
2188 |
* @param int $height Widget height. |
|
2189 |
* @param mixed ...$params Widget parameters. |
|
0 | 2190 |
*/ |
16 | 2191 |
function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2192 |
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); |
16 | 2193 |
// Compat. |
2194 |
if ( is_array( $name ) ) { |
|
2195 |
if ( count( $name ) === 3 ) { |
|
2196 |
$name = sprintf( $name[0], $name[2] ); |
|
2197 |
} else { |
|
0 | 2198 |
$name = $name[0]; |
16 | 2199 |
} |
0 | 2200 |
} |
2201 |
||
16 | 2202 |
$id = sanitize_title( $name ); |
0 | 2203 |
$options = array(); |
16 | 2204 |
if ( ! empty( $width ) ) { |
0 | 2205 |
$options['width'] = $width; |
16 | 2206 |
} |
2207 |
if ( ! empty( $height ) ) { |
|
0 | 2208 |
$options['height'] = $height; |
16 | 2209 |
} |
2210 |
||
2211 |
wp_register_widget_control( $id, $name, $control_callback, $options, ...$params ); |
|
0 | 2212 |
} |
2213 |
||
2214 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2215 |
* Alias of wp_unregister_widget_control(). |
0 | 2216 |
* |
2217 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2218 |
* @deprecated 2.8.0 Use wp_unregister_widget_control() |
0 | 2219 |
* @see wp_unregister_widget_control() |
2220 |
* |
|
2221 |
* @param int|string $id Widget ID. |
|
2222 |
*/ |
|
2223 |
function unregister_widget_control($id) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2224 |
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' ); |
0 | 2225 |
return wp_unregister_widget_control($id); |
2226 |
} |
|
2227 |
||
2228 |
/** |
|
2229 |
* Remove user meta data. |
|
2230 |
* |
|
2231 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2232 |
* @deprecated 3.0.0 Use delete_user_meta() |
0 | 2233 |
* @see delete_user_meta() |
2234 |
* |
|
2235 |
* @param int $user_id User ID. |
|
2236 |
* @param string $meta_key Metadata key. |
|
16 | 2237 |
* @param mixed $meta_value Optional. Metadata value. Default empty. |
0 | 2238 |
* @return bool True deletion completed and false if user_id is not a number. |
2239 |
*/ |
|
2240 |
function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2241 |
_deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); |
0 | 2242 |
global $wpdb; |
2243 |
if ( !is_numeric( $user_id ) ) |
|
2244 |
return false; |
|
2245 |
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
|
2246 |
||
2247 |
if ( is_array($meta_value) || is_object($meta_value) ) |
|
2248 |
$meta_value = serialize($meta_value); |
|
2249 |
$meta_value = trim( $meta_value ); |
|
2250 |
||
2251 |
$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2252 |
||
2253 |
if ( $cur && $cur->umeta_id ) |
|
2254 |
do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2255 |
||
2256 |
if ( ! empty($meta_value) ) |
|
2257 |
$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) ); |
|
2258 |
else |
|
2259 |
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2260 |
||
2261 |
clean_user_cache( $user_id ); |
|
2262 |
wp_cache_delete( $user_id, 'user_meta' ); |
|
2263 |
||
2264 |
if ( $cur && $cur->umeta_id ) |
|
2265 |
do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2266 |
||
2267 |
return true; |
|
2268 |
} |
|
2269 |
||
2270 |
/** |
|
2271 |
* Retrieve user metadata. |
|
2272 |
* |
|
2273 |
* If $user_id is not a number, then the function will fail over with a 'false' |
|
2274 |
* boolean return value. Other returned values depend on whether there is only |
|
2275 |
* one item to be returned, which be that single item type. If there is more |
|
2276 |
* than one metadata value, then it will be list of metadata values. |
|
2277 |
* |
|
2278 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2279 |
* @deprecated 3.0.0 Use get_user_meta() |
0 | 2280 |
* @see get_user_meta() |
2281 |
* |
|
2282 |
* @param int $user_id User ID |
|
16 | 2283 |
* @param string $meta_key Optional. Metadata key. Default empty. |
0 | 2284 |
* @return mixed |
2285 |
*/ |
|
2286 |
function get_usermeta( $user_id, $meta_key = '' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2287 |
_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' ); |
0 | 2288 |
global $wpdb; |
2289 |
$user_id = (int) $user_id; |
|
2290 |
||
2291 |
if ( !$user_id ) |
|
2292 |
return false; |
|
2293 |
||
2294 |
if ( !empty($meta_key) ) { |
|
2295 |
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
|
2296 |
$user = wp_cache_get($user_id, 'users'); |
|
16 | 2297 |
// Check the cached user object. |
0 | 2298 |
if ( false !== $user && isset($user->$meta_key) ) |
2299 |
$metas = array($user->$meta_key); |
|
2300 |
else |
|
2301 |
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2302 |
} else { |
|
2303 |
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); |
|
2304 |
} |
|
2305 |
||
2306 |
if ( empty($metas) ) { |
|
2307 |
if ( empty($meta_key) ) |
|
2308 |
return array(); |
|
2309 |
else |
|
2310 |
return ''; |
|
2311 |
} |
|
2312 |
||
2313 |
$metas = array_map('maybe_unserialize', $metas); |
|
2314 |
||
2315 |
if ( count($metas) == 1 ) |
|
2316 |
return $metas[0]; |
|
2317 |
else |
|
2318 |
return $metas; |
|
2319 |
} |
|
2320 |
||
2321 |
/** |
|
2322 |
* Update metadata of user. |
|
2323 |
* |
|
2324 |
* There is no need to serialize values, they will be serialized if it is |
|
2325 |
* needed. The metadata key can only be a string with underscores. All else will |
|
2326 |
* be removed. |
|
2327 |
* |
|
2328 |
* Will remove the metadata, if the meta value is empty. |
|
2329 |
* |
|
2330 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2331 |
* @deprecated 3.0.0 Use update_user_meta() |
0 | 2332 |
* @see update_user_meta() |
2333 |
* |
|
2334 |
* @param int $user_id User ID |
|
2335 |
* @param string $meta_key Metadata key. |
|
2336 |
* @param mixed $meta_value Metadata value. |
|
2337 |
* @return bool True on successful update, false on failure. |
|
2338 |
*/ |
|
2339 |
function update_usermeta( $user_id, $meta_key, $meta_value ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2340 |
_deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' ); |
0 | 2341 |
global $wpdb; |
2342 |
if ( !is_numeric( $user_id ) ) |
|
2343 |
return false; |
|
2344 |
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
|
2345 |
||
2346 |
/** @todo Might need fix because usermeta data is assumed to be already escaped */ |
|
2347 |
if ( is_string($meta_value) ) |
|
2348 |
$meta_value = stripslashes($meta_value); |
|
2349 |
$meta_value = maybe_serialize($meta_value); |
|
2350 |
||
2351 |
if (empty($meta_value)) { |
|
2352 |
return delete_usermeta($user_id, $meta_key); |
|
2353 |
} |
|
2354 |
||
2355 |
$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2356 |
||
2357 |
if ( $cur ) |
|
2358 |
do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2359 |
||
2360 |
if ( !$cur ) |
|
2361 |
$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); |
|
5 | 2362 |
elseif ( $cur->meta_value != $meta_value ) |
0 | 2363 |
$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); |
2364 |
else |
|
2365 |
return false; |
|
2366 |
||
2367 |
clean_user_cache( $user_id ); |
|
2368 |
wp_cache_delete( $user_id, 'user_meta' ); |
|
2369 |
||
2370 |
if ( !$cur ) |
|
2371 |
do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); |
|
2372 |
else |
|
2373 |
do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2374 |
||
2375 |
return true; |
|
2376 |
} |
|
2377 |
||
2378 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2379 |
* Get users for the site. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2380 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2381 |
* For setups that use the multisite feature. Can be used outside of the |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2382 |
* multisite feature. |
0 | 2383 |
* |
2384 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2385 |
* @deprecated 3.1.0 Use get_users() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2386 |
* @see get_users() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2387 |
* |
16 | 2388 |
* @global wpdb $wpdb WordPress database abstraction object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2389 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2390 |
* @param int $id Site ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2391 |
* @return array List of users that are part of that site ID |
0 | 2392 |
*/ |
2393 |
function get_users_of_blog( $id = '' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2394 |
_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2395 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2396 |
global $wpdb; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2397 |
if ( empty( $id ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2398 |
$id = get_current_blog_id(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2399 |
} |
0 | 2400 |
$blog_prefix = $wpdb->get_blog_prefix($id); |
2401 |
$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" ); |
|
2402 |
return $users; |
|
2403 |
} |
|
2404 |
||
2405 |
/** |
|
2406 |
* Enable/disable automatic general feed link outputting. |
|
2407 |
* |
|
2408 |
* @since 2.8.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2409 |
* @deprecated 3.0.0 Use add_theme_support() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2410 |
* @see add_theme_support() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2411 |
* |
16 | 2412 |
* @param bool $add Optional. Add or remove links. Default true. |
0 | 2413 |
*/ |
2414 |
function automatic_feed_links( $add = true ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2415 |
_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); |
0 | 2416 |
|
2417 |
if ( $add ) |
|
2418 |
add_theme_support( 'automatic-feed-links' ); |
|
2419 |
else |
|
16 | 2420 |
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+. |
0 | 2421 |
} |
2422 |
||
2423 |
/** |
|
2424 |
* Retrieve user data based on field. |
|
2425 |
* |
|
2426 |
* @since 1.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2427 |
* @deprecated 3.0.0 Use get_the_author_meta() |
0 | 2428 |
* @see get_the_author_meta() |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2429 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2430 |
* @param string $field User meta field. |
16 | 2431 |
* @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2432 |
* @return string The author's field from the current author's DB object. |
0 | 2433 |
*/ |
2434 |
function get_profile( $field, $user = false ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2435 |
_deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); |
0 | 2436 |
if ( $user ) { |
2437 |
$user = get_user_by( 'login', $user ); |
|
2438 |
$user = $user->ID; |
|
2439 |
} |
|
2440 |
return get_the_author_meta( $field, $user ); |
|
2441 |
} |
|
2442 |
||
2443 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2444 |
* Retrieves the number of posts a user has written. |
0 | 2445 |
* |
2446 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2447 |
* @deprecated 3.0.0 Use count_user_posts() |
0 | 2448 |
* @see count_user_posts() |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2449 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2450 |
* @param int $userid User to count posts for. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2451 |
* @return int Number of posts the given user has written. |
0 | 2452 |
*/ |
2453 |
function get_usernumposts( $userid ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2454 |
_deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' ); |
0 | 2455 |
return count_user_posts( $userid ); |
2456 |
} |
|
2457 |
||
2458 |
/** |
|
2459 |
* Callback used to change %uXXXX to &#YYY; syntax |
|
2460 |
* |
|
2461 |
* @since 2.8.0 |
|
2462 |
* @access private |
|
2463 |
* @deprecated 3.0.0 |
|
2464 |
* |
|
2465 |
* @param array $matches Single Match |
|
2466 |
* @return string An HTML entity |
|
2467 |
*/ |
|
2468 |
function funky_javascript_callback($matches) { |
|
2469 |
return "&#".base_convert($matches[1],16,10).";"; |
|
2470 |
} |
|
2471 |
||
2472 |
/** |
|
5 | 2473 |
* Fixes JavaScript bugs in browsers. |
0 | 2474 |
* |
2475 |
* Converts unicode characters to HTML numbered entities. |
|
2476 |
* |
|
2477 |
* @since 1.5.0 |
|
2478 |
* @deprecated 3.0.0 |
|
2479 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2480 |
* @global $is_macIE |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2481 |
* @global $is_winIE |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2482 |
* |
0 | 2483 |
* @param string $text Text to be made safe. |
2484 |
* @return string Fixed text. |
|
2485 |
*/ |
|
2486 |
function funky_javascript_fix($text) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2487 |
_deprecated_function( __FUNCTION__, '3.0.0' ); |
5 | 2488 |
// Fixes for browsers' JavaScript bugs. |
0 | 2489 |
global $is_macIE, $is_winIE; |
2490 |
||
2491 |
if ( $is_winIE || $is_macIE ) |
|
2492 |
$text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", |
|
2493 |
"funky_javascript_callback", |
|
2494 |
$text); |
|
2495 |
||
2496 |
return $text; |
|
2497 |
} |
|
2498 |
||
2499 |
/** |
|
2500 |
* Checks that the taxonomy name exists. |
|
2501 |
* |
|
2502 |
* @since 2.3.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2503 |
* @deprecated 3.0.0 Use taxonomy_exists() |
0 | 2504 |
* @see taxonomy_exists() |
2505 |
* |
|
2506 |
* @param string $taxonomy Name of taxonomy object |
|
2507 |
* @return bool Whether the taxonomy exists. |
|
2508 |
*/ |
|
2509 |
function is_taxonomy( $taxonomy ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2510 |
_deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' ); |
0 | 2511 |
return taxonomy_exists( $taxonomy ); |
2512 |
} |
|
2513 |
||
2514 |
/** |
|
2515 |
* Check if Term exists. |
|
2516 |
* |
|
2517 |
* @since 2.3.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2518 |
* @deprecated 3.0.0 Use term_exists() |
0 | 2519 |
* @see term_exists() |
2520 |
* |
|
2521 |
* @param int|string $term The term to check |
|
2522 |
* @param string $taxonomy The taxonomy name to use |
|
2523 |
* @param int $parent ID of parent term under which to confine the exists search. |
|
16 | 2524 |
* @return mixed Get the term ID or term object, if exists. |
0 | 2525 |
*/ |
2526 |
function is_term( $term, $taxonomy = '', $parent = 0 ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2527 |
_deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); |
0 | 2528 |
return term_exists( $term, $taxonomy, $parent ); |
2529 |
} |
|
2530 |
||
2531 |
/** |
|
9 | 2532 |
* Determines whether the current admin page is generated by a plugin. |
0 | 2533 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2534 |
* Use global $plugin_page and/or get_plugin_page_hookname() hooks. |
16 | 2535 |
* |
9 | 2536 |
* For more information on this and similar theme functions, check out |
16 | 2537 |
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
9 | 2538 |
* Conditional Tags} article in the Theme Developer Handbook. |
16 | 2539 |
* |
0 | 2540 |
* @since 1.5.0 |
2541 |
* @deprecated 3.1.0 |
|
2542 |
* |
|
2543 |
* @global $plugin_page |
|
2544 |
* |
|
2545 |
* @return bool |
|
2546 |
*/ |
|
2547 |
function is_plugin_page() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2548 |
_deprecated_function( __FUNCTION__, '3.1.0' ); |
0 | 2549 |
|
2550 |
global $plugin_page; |
|
2551 |
||
2552 |
if ( isset($plugin_page) ) |
|
2553 |
return true; |
|
2554 |
||
2555 |
return false; |
|
2556 |
} |
|
2557 |
||
2558 |
/** |
|
2559 |
* Update the categories cache. |
|
2560 |
* |
|
2561 |
* This function does not appear to be used anymore or does not appear to be |
|
2562 |
* needed. It might be a legacy function left over from when there was a need |
|
2563 |
* for updating the category cache. |
|
2564 |
* |
|
2565 |
* @since 1.5.0 |
|
2566 |
* @deprecated 3.1.0 |
|
2567 |
* |
|
2568 |
* @return bool Always return True |
|
2569 |
*/ |
|
2570 |
function update_category_cache() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2571 |
_deprecated_function( __FUNCTION__, '3.1.0' ); |
0 | 2572 |
|
2573 |
return true; |
|
2574 |
} |
|
2575 |
||
2576 |
/** |
|
2577 |
* Check for PHP timezone support |
|
2578 |
* |
|
2579 |
* @since 2.9.0 |
|
2580 |
* @deprecated 3.2.0 |
|
2581 |
* |
|
2582 |
* @return bool |
|
2583 |
*/ |
|
2584 |
function wp_timezone_supported() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2585 |
_deprecated_function( __FUNCTION__, '3.2.0' ); |
0 | 2586 |
|
2587 |
return true; |
|
2588 |
} |
|
2589 |
||
2590 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2591 |
* Displays an editor: TinyMCE, HTML, or both. |
0 | 2592 |
* |
2593 |
* @since 2.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2594 |
* @deprecated 3.3.0 Use wp_editor() |
0 | 2595 |
* @see wp_editor() |
2596 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2597 |
* @param string $content Textarea content. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2598 |
* @param string $id Optional. HTML ID attribute value. Default 'content'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2599 |
* @param string $prev_id Optional. Unused. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2600 |
* @param bool $media_buttons Optional. Whether to display media buttons. Default true. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2601 |
* @param int $tab_index Optional. Unused. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2602 |
* @param bool $extended Optional. Unused. |
0 | 2603 |
*/ |
2604 |
function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2605 |
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); |
0 | 2606 |
|
2607 |
wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); |
|
2608 |
} |
|
2609 |
||
2610 |
/** |
|
2611 |
* Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users |
|
2612 |
* |
|
2613 |
* @since 3.0.0 |
|
2614 |
* @deprecated 3.3.0 |
|
2615 |
* |
|
2616 |
* @param array $ids User ID numbers list. |
|
2617 |
* @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. |
|
2618 |
*/ |
|
2619 |
function get_user_metavalues($ids) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2620 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2621 |
|
2622 |
$objects = array(); |
|
2623 |
||
2624 |
$ids = array_map('intval', $ids); |
|
2625 |
foreach ( $ids as $id ) |
|
2626 |
$objects[$id] = array(); |
|
2627 |
||
2628 |
$metas = update_meta_cache('user', $ids); |
|
2629 |
||
2630 |
foreach ( $metas as $id => $meta ) { |
|
2631 |
foreach ( $meta as $key => $metavalues ) { |
|
2632 |
foreach ( $metavalues as $value ) { |
|
2633 |
$objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); |
|
2634 |
} |
|
2635 |
} |
|
2636 |
} |
|
2637 |
||
2638 |
return $objects; |
|
2639 |
} |
|
2640 |
||
2641 |
/** |
|
2642 |
* Sanitize every user field. |
|
2643 |
* |
|
2644 |
* If the context is 'raw', then the user object or array will get minimal santization of the int fields. |
|
2645 |
* |
|
2646 |
* @since 2.3.0 |
|
2647 |
* @deprecated 3.3.0 |
|
2648 |
* |
|
16 | 2649 |
* @param object|array $user The user object or array. |
2650 |
* @param string $context Optional. How to sanitize user fields. Default 'display'. |
|
2651 |
* @return object|array The now sanitized user object or array (will be the same type as $user). |
|
0 | 2652 |
*/ |
2653 |
function sanitize_user_object($user, $context = 'display') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2654 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2655 |
|
2656 |
if ( is_object($user) ) { |
|
2657 |
if ( !isset($user->ID) ) |
|
2658 |
$user->ID = 0; |
|
5 | 2659 |
if ( ! ( $user instanceof WP_User ) ) { |
0 | 2660 |
$vars = get_object_vars($user); |
2661 |
foreach ( array_keys($vars) as $field ) { |
|
2662 |
if ( is_string($user->$field) || is_numeric($user->$field) ) |
|
2663 |
$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); |
|
2664 |
} |
|
2665 |
} |
|
2666 |
$user->filter = $context; |
|
2667 |
} else { |
|
2668 |
if ( !isset($user['ID']) ) |
|
2669 |
$user['ID'] = 0; |
|
2670 |
foreach ( array_keys($user) as $field ) |
|
2671 |
$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); |
|
2672 |
$user['filter'] = $context; |
|
2673 |
} |
|
2674 |
||
2675 |
return $user; |
|
2676 |
} |
|
2677 |
||
2678 |
/** |
|
2679 |
* Get boundary post relational link. |
|
2680 |
* |
|
2681 |
* Can either be start or end post relational link. |
|
2682 |
* |
|
2683 |
* @since 2.8.0 |
|
2684 |
* @deprecated 3.3.0 |
|
2685 |
* |
|
16 | 2686 |
* @param string $title Optional. Link title format. Default '%title'. |
2687 |
* @param bool $in_same_cat Optional. Whether link should be in a same category. |
|
2688 |
* Default false. |
|
2689 |
* @param string $excluded_categories Optional. Excluded categories IDs. Default empty. |
|
2690 |
* @param bool $start Optional. Whether to display link to first or last post. |
|
2691 |
* Default true. |
|
0 | 2692 |
* @return string |
2693 |
*/ |
|
2694 |
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2695 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2696 |
|
2697 |
$posts = get_boundary_post($in_same_cat, $excluded_categories, $start); |
|
16 | 2698 |
// If there is no post, stop. |
0 | 2699 |
if ( empty($posts) ) |
2700 |
return; |
|
2701 |
||
16 | 2702 |
// Even though we limited get_posts() to return only 1 item it still returns an array of objects. |
0 | 2703 |
$post = $posts[0]; |
2704 |
||
2705 |
if ( empty($post->post_title) ) |
|
2706 |
$post->post_title = $start ? __('First Post') : __('Last Post'); |
|
2707 |
||
2708 |
$date = mysql2date(get_option('date_format'), $post->post_date); |
|
2709 |
||
2710 |
$title = str_replace('%title', $post->post_title, $title); |
|
2711 |
$title = str_replace('%date', $date, $title); |
|
2712 |
$title = apply_filters('the_title', $title, $post->ID); |
|
2713 |
||
2714 |
$link = $start ? "<link rel='start' title='" : "<link rel='end' title='"; |
|
2715 |
$link .= esc_attr($title); |
|
2716 |
$link .= "' href='" . get_permalink($post) . "' />\n"; |
|
2717 |
||
2718 |
$boundary = $start ? 'start' : 'end'; |
|
2719 |
return apply_filters( "{$boundary}_post_rel_link", $link ); |
|
2720 |
} |
|
2721 |
||
2722 |
/** |
|
2723 |
* Display relational link for the first post. |
|
2724 |
* |
|
2725 |
* @since 2.8.0 |
|
2726 |
* @deprecated 3.3.0 |
|
2727 |
* |
|
2728 |
* @param string $title Optional. Link title format. |
|
2729 |
* @param bool $in_same_cat Optional. Whether link should be in a same category. |
|
2730 |
* @param string $excluded_categories Optional. Excluded categories IDs. |
|
2731 |
*/ |
|
2732 |
function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2733 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2734 |
|
2735 |
echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); |
|
2736 |
} |
|
2737 |
||
2738 |
/** |
|
2739 |
* Get site index relational link. |
|
2740 |
* |
|
2741 |
* @since 2.8.0 |
|
2742 |
* @deprecated 3.3.0 |
|
2743 |
* |
|
2744 |
* @return string |
|
2745 |
*/ |
|
2746 |
function get_index_rel_link() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2747 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2748 |
|
2749 |
$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n"; |
|
2750 |
return apply_filters( "index_rel_link", $link ); |
|
2751 |
} |
|
2752 |
||
2753 |
/** |
|
2754 |
* Display relational link for the site index. |
|
2755 |
* |
|
2756 |
* @since 2.8.0 |
|
2757 |
* @deprecated 3.3.0 |
|
2758 |
*/ |
|
2759 |
function index_rel_link() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2760 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2761 |
|
2762 |
echo get_index_rel_link(); |
|
2763 |
} |
|
2764 |
||
2765 |
/** |
|
2766 |
* Get parent post relational link. |
|
2767 |
* |
|
2768 |
* @since 2.8.0 |
|
2769 |
* @deprecated 3.3.0 |
|
2770 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2771 |
* @param string $title Optional. Link title format. Default '%title'. |
0 | 2772 |
* @return string |
2773 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2774 |
function get_parent_post_rel_link( $title = '%title' ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2775 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2776 |
|
2777 |
if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) |
|
2778 |
$post = get_post($GLOBALS['post']->post_parent); |
|
2779 |
||
2780 |
if ( empty($post) ) |
|
2781 |
return; |
|
2782 |
||
2783 |
$date = mysql2date(get_option('date_format'), $post->post_date); |
|
2784 |
||
2785 |
$title = str_replace('%title', $post->post_title, $title); |
|
2786 |
$title = str_replace('%date', $date, $title); |
|
2787 |
$title = apply_filters('the_title', $title, $post->ID); |
|
2788 |
||
2789 |
$link = "<link rel='up' title='"; |
|
2790 |
$link .= esc_attr( $title ); |
|
2791 |
$link .= "' href='" . get_permalink($post) . "' />\n"; |
|
2792 |
||
2793 |
return apply_filters( "parent_post_rel_link", $link ); |
|
2794 |
} |
|
2795 |
||
2796 |
/** |
|
2797 |
* Display relational link for parent item |
|
2798 |
* |
|
2799 |
* @since 2.8.0 |
|
2800 |
* @deprecated 3.3.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2801 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2802 |
* @param string $title Optional. Link title format. Default '%title'. |
0 | 2803 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2804 |
function parent_post_rel_link( $title = '%title' ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2805 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2806 |
|
2807 |
echo get_parent_post_rel_link($title); |
|
2808 |
} |
|
2809 |
||
2810 |
/** |
|
2811 |
* Add the "Dashboard"/"Visit Site" menu. |
|
2812 |
* |
|
2813 |
* @since 3.2.0 |
|
2814 |
* @deprecated 3.3.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2815 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2816 |
* @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance. |
0 | 2817 |
*/ |
2818 |
function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2819 |
_deprecated_function( __FUNCTION__, '3.3.0' ); |
0 | 2820 |
|
2821 |
$user_id = get_current_user_id(); |
|
2822 |
||
2823 |
if ( 0 != $user_id ) { |
|
2824 |
if ( is_admin() ) |
|
2825 |
$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); |
|
2826 |
elseif ( is_multisite() ) |
|
2827 |
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); |
|
2828 |
else |
|
2829 |
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); |
|
2830 |
} |
|
2831 |
} |
|
2832 |
||
2833 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2834 |
* Checks if the current user belong to a given site. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2835 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2836 |
* @since MU (3.0.0) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2837 |
* @deprecated 3.3.0 Use is_user_member_of_blog() |
0 | 2838 |
* @see is_user_member_of_blog() |
2839 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2840 |
* @param int $blog_id Site ID |
0 | 2841 |
* @return bool True if the current users belong to $blog_id, false if not. |
2842 |
*/ |
|
2843 |
function is_blog_user( $blog_id = 0 ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2844 |
_deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' ); |
0 | 2845 |
|
2846 |
return is_user_member_of_blog( get_current_user_id(), $blog_id ); |
|
2847 |
} |
|
2848 |
||
2849 |
/** |
|
2850 |
* Open the file handle for debugging. |
|
2851 |
* |
|
2852 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2853 |
* @deprecated 3.4.0 Use error_log() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2854 |
* @see error_log() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2855 |
* |
16 | 2856 |
* @link https://www.php.net/manual/en/function.error-log.php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2857 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2858 |
* @param string $filename File name. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2859 |
* @param string $mode Type of access you required to the stream. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2860 |
* @return false Always false. |
0 | 2861 |
*/ |
2862 |
function debug_fopen( $filename, $mode ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2863 |
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
0 | 2864 |
return false; |
2865 |
} |
|
2866 |
||
2867 |
/** |
|
2868 |
* Write contents to the file used for debugging. |
|
2869 |
* |
|
2870 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2871 |
* @deprecated 3.4.0 Use error_log() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2872 |
* @see error_log() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2873 |
* |
16 | 2874 |
* @link https://www.php.net/manual/en/function.error-log.php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2875 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2876 |
* @param mixed $fp Unused. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2877 |
* @param string $string Message to log. |
0 | 2878 |
*/ |
2879 |
function debug_fwrite( $fp, $string ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2880 |
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
0 | 2881 |
if ( ! empty( $GLOBALS['debug'] ) ) |
2882 |
error_log( $string ); |
|
2883 |
} |
|
2884 |
||
2885 |
/** |
|
2886 |
* Close the debugging file handle. |
|
2887 |
* |
|
2888 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2889 |
* @deprecated 3.4.0 Use error_log() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2890 |
* @see error_log() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2891 |
* |
16 | 2892 |
* @link https://www.php.net/manual/en/function.error-log.php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2893 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2894 |
* @param mixed $fp Unused. |
0 | 2895 |
*/ |
2896 |
function debug_fclose( $fp ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2897 |
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
0 | 2898 |
} |
2899 |
||
2900 |
/** |
|
2901 |
* Retrieve list of themes with theme data in theme directory. |
|
2902 |
* |
|
2903 |
* The theme is broken, if it doesn't have a parent theme and is missing either |
|
2904 |
* style.css and, or index.php. If the theme has a parent theme then it is |
|
2905 |
* broken, if it is missing style.css; index.php is optional. |
|
2906 |
* |
|
2907 |
* @since 1.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2908 |
* @deprecated 3.4.0 Use wp_get_themes() |
0 | 2909 |
* @see wp_get_themes() |
2910 |
* |
|
2911 |
* @return array Theme list with theme data. |
|
2912 |
*/ |
|
2913 |
function get_themes() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2914 |
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); |
0 | 2915 |
|
2916 |
global $wp_themes; |
|
2917 |
if ( isset( $wp_themes ) ) |
|
2918 |
return $wp_themes; |
|
2919 |
||
2920 |
$themes = wp_get_themes(); |
|
2921 |
$wp_themes = array(); |
|
2922 |
||
2923 |
foreach ( $themes as $theme ) { |
|
2924 |
$name = $theme->get('Name'); |
|
2925 |
if ( isset( $wp_themes[ $name ] ) ) |
|
2926 |
$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; |
|
2927 |
else |
|
2928 |
$wp_themes[ $name ] = $theme; |
|
2929 |
} |
|
2930 |
||
2931 |
return $wp_themes; |
|
2932 |
} |
|
2933 |
||
2934 |
/** |
|
2935 |
* Retrieve theme data. |
|
2936 |
* |
|
2937 |
* @since 1.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2938 |
* @deprecated 3.4.0 Use wp_get_theme() |
0 | 2939 |
* @see wp_get_theme() |
2940 |
* |
|
2941 |
* @param string $theme Theme name. |
|
2942 |
* @return array|null Null, if theme name does not exist. Theme data, if exists. |
|
2943 |
*/ |
|
2944 |
function get_theme( $theme ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2945 |
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); |
0 | 2946 |
|
2947 |
$themes = get_themes(); |
|
2948 |
if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) |
|
2949 |
return $themes[ $theme ]; |
|
2950 |
return null; |
|
2951 |
} |
|
2952 |
||
2953 |
/** |
|
2954 |
* Retrieve current theme name. |
|
2955 |
* |
|
2956 |
* @since 1.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2957 |
* @deprecated 3.4.0 Use wp_get_theme() |
0 | 2958 |
* @see wp_get_theme() |
2959 |
* |
|
2960 |
* @return string |
|
2961 |
*/ |
|
2962 |
function get_current_theme() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2963 |
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); |
0 | 2964 |
|
2965 |
if ( $theme = get_option( 'current_theme' ) ) |
|
2966 |
return $theme; |
|
2967 |
||
2968 |
return wp_get_theme()->get('Name'); |
|
2969 |
} |
|
2970 |
||
2971 |
/** |
|
2972 |
* Accepts matches array from preg_replace_callback in wpautop() or a string. |
|
2973 |
* |
|
5 | 2974 |
* Ensures that the contents of a `<pre>...</pre>` HTML block are not |
16 | 2975 |
* converted into paragraphs or line breaks. |
0 | 2976 |
* |
2977 |
* @since 1.2.0 |
|
2978 |
* @deprecated 3.4.0 |
|
2979 |
* |
|
2980 |
* @param array|string $matches The array or string |
|
16 | 2981 |
* @return string The pre block without paragraph/line break conversion. |
0 | 2982 |
*/ |
2983 |
function clean_pre($matches) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2984 |
_deprecated_function( __FUNCTION__, '3.4.0' ); |
0 | 2985 |
|
2986 |
if ( is_array($matches) ) |
|
2987 |
$text = $matches[1] . $matches[2] . "</pre>"; |
|
2988 |
else |
|
2989 |
$text = $matches; |
|
2990 |
||
2991 |
$text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); |
|
2992 |
$text = str_replace('<p>', "\n", $text); |
|
2993 |
$text = str_replace('</p>', '', $text); |
|
2994 |
||
2995 |
return $text; |
|
2996 |
} |
|
2997 |
||
2998 |
||
2999 |
/** |
|
3000 |
* Add callbacks for image header display. |
|
3001 |
* |
|
3002 |
* @since 2.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3003 |
* @deprecated 3.4.0 Use add_theme_support() |
0 | 3004 |
* @see add_theme_support() |
3005 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3006 |
* @param callable $wp_head_callback Call on the {@see 'wp_head'} action. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3007 |
* @param callable $admin_head_callback Call on custom header administration screen. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3008 |
* @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. |
0 | 3009 |
*/ |
3010 |
function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3011 |
_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' ); |
0 | 3012 |
$args = array( |
3013 |
'wp-head-callback' => $wp_head_callback, |
|
3014 |
'admin-head-callback' => $admin_head_callback, |
|
3015 |
); |
|
3016 |
if ( $admin_preview_callback ) |
|
3017 |
$args['admin-preview-callback'] = $admin_preview_callback; |
|
3018 |
return add_theme_support( 'custom-header', $args ); |
|
3019 |
} |
|
3020 |
||
3021 |
/** |
|
3022 |
* Remove image header support. |
|
3023 |
* |
|
3024 |
* @since 3.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3025 |
* @deprecated 3.4.0 Use remove_theme_support() |
0 | 3026 |
* @see remove_theme_support() |
3027 |
* |
|
5 | 3028 |
* @return null|bool Whether support was removed. |
0 | 3029 |
*/ |
3030 |
function remove_custom_image_header() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3031 |
_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' ); |
0 | 3032 |
return remove_theme_support( 'custom-header' ); |
3033 |
} |
|
3034 |
||
3035 |
/** |
|
3036 |
* Add callbacks for background image display. |
|
3037 |
* |
|
3038 |
* @since 3.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3039 |
* @deprecated 3.4.0 Use add_theme_support() |
0 | 3040 |
* @see add_theme_support() |
3041 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3042 |
* @param callable $wp_head_callback Call on the {@see 'wp_head'} action. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3043 |
* @param callable $admin_head_callback Call on custom background administration screen. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3044 |
* @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. |
0 | 3045 |
*/ |
3046 |
function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3047 |
_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' ); |
0 | 3048 |
$args = array(); |
3049 |
if ( $wp_head_callback ) |
|
3050 |
$args['wp-head-callback'] = $wp_head_callback; |
|
3051 |
if ( $admin_head_callback ) |
|
3052 |
$args['admin-head-callback'] = $admin_head_callback; |
|
3053 |
if ( $admin_preview_callback ) |
|
3054 |
$args['admin-preview-callback'] = $admin_preview_callback; |
|
3055 |
return add_theme_support( 'custom-background', $args ); |
|
3056 |
} |
|
3057 |
||
3058 |
/** |
|
3059 |
* Remove custom background support. |
|
3060 |
* |
|
3061 |
* @since 3.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3062 |
* @deprecated 3.4.0 Use add_custom_background() |
0 | 3063 |
* @see add_custom_background() |
3064 |
* |
|
5 | 3065 |
* @return null|bool Whether support was removed. |
0 | 3066 |
*/ |
3067 |
function remove_custom_background() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3068 |
_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' ); |
0 | 3069 |
return remove_theme_support( 'custom-background' ); |
3070 |
} |
|
3071 |
||
3072 |
/** |
|
3073 |
* Retrieve theme data from parsed theme file. |
|
3074 |
* |
|
3075 |
* @since 1.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3076 |
* @deprecated 3.4.0 Use wp_get_theme() |
0 | 3077 |
* @see wp_get_theme() |
3078 |
* |
|
3079 |
* @param string $theme_file Theme file path. |
|
3080 |
* @return array Theme data. |
|
3081 |
*/ |
|
3082 |
function get_theme_data( $theme_file ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3083 |
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); |
9 | 3084 |
$theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); |
0 | 3085 |
|
3086 |
$theme_data = array( |
|
3087 |
'Name' => $theme->get('Name'), |
|
3088 |
'URI' => $theme->display('ThemeURI', true, false), |
|
3089 |
'Description' => $theme->display('Description', true, false), |
|
3090 |
'Author' => $theme->display('Author', true, false), |
|
3091 |
'AuthorURI' => $theme->display('AuthorURI', true, false), |
|
3092 |
'Version' => $theme->get('Version'), |
|
3093 |
'Template' => $theme->get('Template'), |
|
3094 |
'Status' => $theme->get('Status'), |
|
3095 |
'Tags' => $theme->get('Tags'), |
|
3096 |
'Title' => $theme->get('Name'), |
|
3097 |
'AuthorName' => $theme->get('Author'), |
|
3098 |
); |
|
3099 |
||
3100 |
foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { |
|
3101 |
if ( ! isset( $theme_data[ $extra_header ] ) ) |
|
3102 |
$theme_data[ $extra_header ] = $theme->get( $extra_header ); |
|
3103 |
} |
|
3104 |
||
3105 |
return $theme_data; |
|
3106 |
} |
|
3107 |
||
3108 |
/** |
|
3109 |
* Alias of update_post_cache(). |
|
3110 |
* |
|
3111 |
* @see update_post_cache() Posts and pages are the same, alias is intentional |
|
3112 |
* |
|
3113 |
* @since 1.5.1 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3114 |
* @deprecated 3.4.0 Use update_post_cache() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3115 |
* @see update_post_cache() |
0 | 3116 |
* |
3117 |
* @param array $pages list of page objects |
|
3118 |
*/ |
|
3119 |
function update_page_cache( &$pages ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3120 |
_deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' ); |
0 | 3121 |
|
3122 |
update_post_cache( $pages ); |
|
3123 |
} |
|
3124 |
||
3125 |
/** |
|
3126 |
* Will clean the page in the cache. |
|
3127 |
* |
|
3128 |
* Clean (read: delete) page from cache that matches $id. Will also clean cache |
|
3129 |
* associated with 'all_page_ids' and 'get_pages'. |
|
3130 |
* |
|
3131 |
* @since 2.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3132 |
* @deprecated 3.4.0 Use clean_post_cache |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3133 |
* @see clean_post_cache() |
0 | 3134 |
* |
3135 |
* @param int $id Page ID to clean |
|
3136 |
*/ |
|
3137 |
function clean_page_cache( $id ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3138 |
_deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' ); |
0 | 3139 |
|
3140 |
clean_post_cache( $id ); |
|
3141 |
} |
|
3142 |
||
3143 |
/** |
|
3144 |
* Retrieve nonce action "Are you sure" message. |
|
3145 |
* |
|
3146 |
* Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. |
|
3147 |
* |
|
3148 |
* @since 2.0.4 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3149 |
* @deprecated 3.4.1 Use wp_nonce_ays() |
0 | 3150 |
* @see wp_nonce_ays() |
3151 |
* |
|
3152 |
* @param string $action Nonce action. |
|
3153 |
* @return string Are you sure message. |
|
3154 |
*/ |
|
3155 |
function wp_explain_nonce( $action ) { |
|
3156 |
_deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); |
|
3157 |
return __( 'Are you sure you want to do this?' ); |
|
3158 |
} |
|
3159 |
||
3160 |
/** |
|
3161 |
* Display "sticky" CSS class, if a post is sticky. |
|
3162 |
* |
|
3163 |
* @since 2.7.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3164 |
* @deprecated 3.5.0 Use post_class() |
0 | 3165 |
* @see post_class() |
3166 |
* |
|
3167 |
* @param int $post_id An optional post ID. |
|
3168 |
*/ |
|
3169 |
function sticky_class( $post_id = null ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3170 |
_deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' ); |
0 | 3171 |
if ( is_sticky( $post_id ) ) |
3172 |
echo ' sticky'; |
|
3173 |
} |
|
3174 |
||
3175 |
/** |
|
3176 |
* Retrieve post ancestors. |
|
3177 |
* |
|
3178 |
* This is no longer needed as WP_Post lazy-loads the ancestors |
|
3179 |
* property with get_post_ancestors(). |
|
3180 |
* |
|
3181 |
* @since 2.3.4 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3182 |
* @deprecated 3.5.0 Use get_post_ancestors() |
0 | 3183 |
* @see get_post_ancestors() |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3184 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3185 |
* @param WP_Post $post Post object, passed by reference (unused). |
0 | 3186 |
*/ |
3187 |
function _get_post_ancestors( &$post ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3188 |
_deprecated_function( __FUNCTION__, '3.5.0' ); |
0 | 3189 |
} |
3190 |
||
3191 |
/** |
|
3192 |
* Load an image from a string, if PHP supports it. |
|
3193 |
* |
|
3194 |
* @since 2.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3195 |
* @deprecated 3.5.0 Use wp_get_image_editor() |
0 | 3196 |
* @see wp_get_image_editor() |
3197 |
* |
|
3198 |
* @param string $file Filename of the image to load. |
|
3199 |
* @return resource The resulting image resource on success, Error string on failure. |
|
3200 |
*/ |
|
3201 |
function wp_load_image( $file ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3202 |
_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
0 | 3203 |
|
3204 |
if ( is_numeric( $file ) ) |
|
3205 |
$file = get_attached_file( $file ); |
|
3206 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3207 |
if ( ! is_file( $file ) ) { |
16 | 3208 |
/* translators: %s: File name. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3209 |
return sprintf( __( 'File “%s” doesn’t exist?' ), $file ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3210 |
} |
0 | 3211 |
|
3212 |
if ( ! function_exists('imagecreatefromstring') ) |
|
3213 |
return __('The GD image library is not installed.'); |
|
3214 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3215 |
// Set artificially high because GD uses uncompressed images in memory. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3216 |
wp_raise_memory_limit( 'image' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3217 |
|
0 | 3218 |
$image = imagecreatefromstring( file_get_contents( $file ) ); |
3219 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3220 |
if ( ! is_resource( $image ) ) { |
16 | 3221 |
/* translators: %s: File name. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3222 |
return sprintf( __( 'File “%s” is not an image.' ), $file ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3223 |
} |
0 | 3224 |
|
3225 |
return $image; |
|
3226 |
} |
|
3227 |
||
3228 |
/** |
|
3229 |
* Scale down an image to fit a particular size and save a new copy of the image. |
|
3230 |
* |
|
3231 |
* The PNG transparency will be preserved using the function, as well as the |
|
3232 |
* image type. If the file going in is PNG, then the resized image is going to |
|
3233 |
* be PNG. The only supported image types are PNG, GIF, and JPEG. |
|
3234 |
* |
|
3235 |
* Some functionality requires API to exist, so some PHP version may lose out |
|
3236 |
* support. This is not the fault of WordPress (where functionality is |
|
3237 |
* downgraded, not actual defects), but of your PHP version. |
|
3238 |
* |
|
3239 |
* @since 2.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3240 |
* @deprecated 3.5.0 Use wp_get_image_editor() |
0 | 3241 |
* @see wp_get_image_editor() |
3242 |
* |
|
16 | 3243 |
* @param string $file Image file path. |
3244 |
* @param int $max_w Maximum width to resize to. |
|
3245 |
* @param int $max_h Maximum height to resize to. |
|
3246 |
* @param bool $crop Optional. Whether to crop image or resize. Default false. |
|
3247 |
* @param string $suffix Optional. File suffix. Default null. |
|
3248 |
* @param string $dest_path Optional. New image file path. Default null. |
|
3249 |
* @param int $jpeg_quality Optional. Image quality percentage. Default 90. |
|
0 | 3250 |
* @return mixed WP_Error on failure. String with new destination path. |
3251 |
*/ |
|
3252 |
function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3253 |
_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
0 | 3254 |
|
3255 |
$editor = wp_get_image_editor( $file ); |
|
3256 |
if ( is_wp_error( $editor ) ) |
|
3257 |
return $editor; |
|
3258 |
$editor->set_quality( $jpeg_quality ); |
|
3259 |
||
3260 |
$resized = $editor->resize( $max_w, $max_h, $crop ); |
|
3261 |
if ( is_wp_error( $resized ) ) |
|
3262 |
return $resized; |
|
3263 |
||
3264 |
$dest_file = $editor->generate_filename( $suffix, $dest_path ); |
|
3265 |
$saved = $editor->save( $dest_file ); |
|
3266 |
||
3267 |
if ( is_wp_error( $saved ) ) |
|
3268 |
return $saved; |
|
3269 |
||
3270 |
return $dest_file; |
|
3271 |
} |
|
3272 |
||
3273 |
/** |
|
3274 |
* Retrieve a single post, based on post ID. |
|
3275 |
* |
|
3276 |
* Has categories in 'post_category' property or key. Has tags in 'tags_input' |
|
3277 |
* property or key. |
|
3278 |
* |
|
3279 |
* @since 1.0.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3280 |
* @deprecated 3.5.0 Use get_post() |
0 | 3281 |
* @see get_post() |
3282 |
* |
|
3283 |
* @param int $postid Post ID. |
|
3284 |
* @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. |
|
5 | 3285 |
* @return WP_Post|null Post object or array holding post contents and information |
0 | 3286 |
*/ |
3287 |
function wp_get_single_post( $postid = 0, $mode = OBJECT ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3288 |
_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); |
0 | 3289 |
return get_post( $postid, $mode ); |
3290 |
} |
|
3291 |
||
3292 |
/** |
|
3293 |
* Check that the user login name and password is correct. |
|
3294 |
* |
|
3295 |
* @since 0.71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3296 |
* @deprecated 3.5.0 Use wp_authenticate() |
0 | 3297 |
* @see wp_authenticate() |
3298 |
* |
|
3299 |
* @param string $user_login User name. |
|
3300 |
* @param string $user_pass User password. |
|
3301 |
* @return bool False if does not authenticate, true if username and password authenticates. |
|
3302 |
*/ |
|
3303 |
function user_pass_ok($user_login, $user_pass) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3304 |
_deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' ); |
0 | 3305 |
$user = wp_authenticate( $user_login, $user_pass ); |
3306 |
if ( is_wp_error( $user ) ) |
|
3307 |
return false; |
|
3308 |
||
3309 |
return true; |
|
3310 |
} |
|
3311 |
||
3312 |
/** |
|
3313 |
* Callback formerly fired on the save_post hook. No longer needed. |
|
3314 |
* |
|
3315 |
* @since 2.3.0 |
|
3316 |
* @deprecated 3.5.0 |
|
3317 |
*/ |
|
3318 |
function _save_post_hook() {} |
|
3319 |
||
3320 |
/** |
|
3321 |
* Check if the installed version of GD supports particular image type |
|
3322 |
* |
|
3323 |
* @since 2.9.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3324 |
* @deprecated 3.5.0 Use wp_image_editor_supports() |
0 | 3325 |
* @see wp_image_editor_supports() |
3326 |
* |
|
3327 |
* @param string $mime_type |
|
3328 |
* @return bool |
|
3329 |
*/ |
|
3330 |
function gd_edit_image_support($mime_type) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3331 |
_deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' ); |
0 | 3332 |
|
3333 |
if ( function_exists('imagetypes') ) { |
|
3334 |
switch( $mime_type ) { |
|
3335 |
case 'image/jpeg': |
|
3336 |
return (imagetypes() & IMG_JPG) != 0; |
|
3337 |
case 'image/png': |
|
3338 |
return (imagetypes() & IMG_PNG) != 0; |
|
3339 |
case 'image/gif': |
|
3340 |
return (imagetypes() & IMG_GIF) != 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 |
} |
|
3351 |
} |
|
3352 |
return false; |
|
3353 |
} |
|
3354 |
||
3355 |
/** |
|
3356 |
* Converts an integer byte value to a shorthand byte value. |
|
3357 |
* |
|
3358 |
* @since 2.3.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3359 |
* @deprecated 3.6.0 Use size_format() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3360 |
* @see size_format() |
0 | 3361 |
* |
3362 |
* @param int $bytes An integer byte value. |
|
3363 |
* @return string A shorthand byte value. |
|
3364 |
*/ |
|
3365 |
function wp_convert_bytes_to_hr( $bytes ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3366 |
_deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3367 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3368 |
$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3369 |
$log = log( $bytes, KB_IN_BYTES ); |
0 | 3370 |
$power = (int) $log; |
16 | 3371 |
$size = KB_IN_BYTES ** ( $log - $power ); |
0 | 3372 |
|
3373 |
if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { |
|
3374 |
$unit = $units[ $power ]; |
|
3375 |
} else { |
|
3376 |
$size = $bytes; |
|
3377 |
$unit = $units[0]; |
|
3378 |
} |
|
3379 |
||
3380 |
return $size . $unit; |
|
3381 |
} |
|
3382 |
||
3383 |
/** |
|
3384 |
* Formerly used internally to tidy up the search terms. |
|
3385 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3386 |
* @since 2.9.0 |
0 | 3387 |
* @access private |
3388 |
* @deprecated 3.7.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3389 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3390 |
* @param string $t Search terms to "tidy", e.g. trim. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3391 |
* @return string Trimmed search terms. |
0 | 3392 |
*/ |
3393 |
function _search_terms_tidy( $t ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3394 |
_deprecated_function( __FUNCTION__, '3.7.0' ); |
0 | 3395 |
return trim( $t, "\"'\n\r " ); |
3396 |
} |
|
5 | 3397 |
|
3398 |
/** |
|
3399 |
* Determine if TinyMCE is available. |
|
3400 |
* |
|
3401 |
* Checks to see if the user has deleted the tinymce files to slim down |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3402 |
* their WordPress installation. |
5 | 3403 |
* |
3404 |
* @since 2.1.0 |
|
3405 |
* @deprecated 3.9.0 |
|
3406 |
* |
|
3407 |
* @return bool Whether TinyMCE exists. |
|
3408 |
*/ |
|
3409 |
function rich_edit_exists() { |
|
3410 |
global $wp_rich_edit_exists; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3411 |
_deprecated_function( __FUNCTION__, '3.9.0' ); |
5 | 3412 |
|
3413 |
if ( ! isset( $wp_rich_edit_exists ) ) |
|
3414 |
$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); |
|
3415 |
||
3416 |
return $wp_rich_edit_exists; |
|
3417 |
} |
|
3418 |
||
3419 |
/** |
|
3420 |
* Old callback for tag link tooltips. |
|
3421 |
* |
|
3422 |
* @since 2.7.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3423 |
* @access private |
5 | 3424 |
* @deprecated 3.9.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3425 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3426 |
* @param int $count Number of topics. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3427 |
* @return int Number of topics. |
5 | 3428 |
*/ |
3429 |
function default_topic_count_text( $count ) { |
|
3430 |
return $count; |
|
3431 |
} |
|
3432 |
||
3433 |
/** |
|
3434 |
* Formerly used to escape strings before inserting into the DB. |
|
3435 |
* |
|
3436 |
* Has not performed this function for many, many years. Use wpdb::prepare() instead. |
|
3437 |
* |
|
3438 |
* @since 0.71 |
|
3439 |
* @deprecated 3.9.0 |
|
3440 |
* |
|
3441 |
* @param string $content The text to format. |
|
3442 |
* @return string The very same text. |
|
3443 |
*/ |
|
3444 |
function format_to_post( $content ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3445 |
_deprecated_function( __FUNCTION__, '3.9.0' ); |
5 | 3446 |
return $content; |
3447 |
} |
|
3448 |
||
3449 |
/** |
|
3450 |
* Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. |
|
3451 |
* |
|
3452 |
* @since 2.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3453 |
* @deprecated 4.0.0 Use wpdb::esc_like() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3454 |
* @see wpdb::esc_like() |
5 | 3455 |
* |
3456 |
* @param string $text The text to be escaped. |
|
3457 |
* @return string text, safe for inclusion in LIKE query. |
|
3458 |
*/ |
|
3459 |
function like_escape($text) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3460 |
_deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); |
5 | 3461 |
return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); |
3462 |
} |
|
3463 |
||
3464 |
/** |
|
3465 |
* Determines if the URL can be accessed over SSL. |
|
3466 |
* |
|
3467 |
* Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access |
|
3468 |
* the URL using https as the scheme. |
|
3469 |
* |
|
3470 |
* @since 2.5.0 |
|
3471 |
* @deprecated 4.0.0 |
|
3472 |
* |
|
3473 |
* @param string $url The URL to test. |
|
3474 |
* @return bool Whether SSL access is available. |
|
3475 |
*/ |
|
3476 |
function url_is_accessable_via_ssl( $url ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3477 |
_deprecated_function( __FUNCTION__, '4.0.0' ); |
5 | 3478 |
|
3479 |
$response = wp_remote_get( set_url_scheme( $url, 'https' ) ); |
|
3480 |
||
3481 |
if ( !is_wp_error( $response ) ) { |
|
3482 |
$status = wp_remote_retrieve_response_code( $response ); |
|
3483 |
if ( 200 == $status || 401 == $status ) { |
|
3484 |
return true; |
|
3485 |
} |
|
3486 |
} |
|
3487 |
||
3488 |
return false; |
|
3489 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3490 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3491 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3492 |
* Start preview theme output buffer. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3493 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3494 |
* Will only perform task if the user has permissions and template and preview |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3495 |
* query variables exist. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3496 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3497 |
* @since 2.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3498 |
* @deprecated 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3499 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3500 |
function preview_theme() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3501 |
_deprecated_function( __FUNCTION__, '4.3.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3502 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3503 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3504 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3505 |
* Private function to modify the current template when previewing a theme |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3506 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3507 |
* @since 2.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3508 |
* @deprecated 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3509 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3510 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3511 |
* @return string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3512 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3513 |
function _preview_theme_template_filter() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3514 |
_deprecated_function( __FUNCTION__, '4.3.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3515 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3516 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3517 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3518 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3519 |
* Private function to modify the current stylesheet when previewing a theme |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3520 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3521 |
* @since 2.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3522 |
* @deprecated 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3523 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3524 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3525 |
* @return string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3526 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3527 |
function _preview_theme_stylesheet_filter() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3528 |
_deprecated_function( __FUNCTION__, '4.3.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3529 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3530 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3531 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3532 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3533 |
* Callback function for ob_start() to capture all links in the theme. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3534 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3535 |
* @since 2.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3536 |
* @deprecated 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3537 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3538 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3539 |
* @param string $content |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3540 |
* @return string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3541 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3542 |
function preview_theme_ob_filter( $content ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3543 |
_deprecated_function( __FUNCTION__, '4.3.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3544 |
return $content; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3545 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3546 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3547 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3548 |
* Manipulates preview theme links in order to control and maintain location. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3549 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3550 |
* Callback function for preg_replace_callback() to accept and filter matches. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3551 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3552 |
* @since 2.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3553 |
* @deprecated 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3554 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3555 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3556 |
* @param array $matches |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3557 |
* @return string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3558 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3559 |
function preview_theme_ob_filter_callback( $matches ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3560 |
_deprecated_function( __FUNCTION__, '4.3.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3561 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3562 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3563 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3564 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3565 |
* Formats text for the rich text editor. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3566 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3567 |
* The {@see 'richedit_pre'} filter is applied here. If $text is empty the filter will |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3568 |
* be applied to an empty string. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3569 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3570 |
* @since 2.0.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3571 |
* @deprecated 4.3.0 Use format_for_editor() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3572 |
* @see format_for_editor() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3573 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3574 |
* @param string $text The text to be formatted. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3575 |
* @return string The formatted text after filter is applied. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3576 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3577 |
function wp_richedit_pre($text) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3578 |
_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3579 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3580 |
if ( empty( $text ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3581 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3582 |
* Filters text returned for the rich text editor. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3583 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3584 |
* This filter is first evaluated, and the value returned, if an empty string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3585 |
* is passed to wp_richedit_pre(). If an empty string is passed, it results |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3586 |
* in a break tag and line feed. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3587 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3588 |
* If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3589 |
* return after being formatted. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3590 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3591 |
* @since 2.0.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3592 |
* @deprecated 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3593 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3594 |
* @param string $output Text for the rich text editor. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3595 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3596 |
return apply_filters( 'richedit_pre', '' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3597 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3598 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3599 |
$output = convert_chars($text); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3600 |
$output = wpautop($output); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3601 |
$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3602 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3603 |
/** This filter is documented in wp-includes/deprecated.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3604 |
return apply_filters( 'richedit_pre', $output ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3605 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3606 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3607 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3608 |
* Formats text for the HTML editor. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3609 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3610 |
* Unless $output is empty it will pass through htmlspecialchars before the |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3611 |
* {@see 'htmledit_pre'} filter is applied. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3612 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3613 |
* @since 2.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3614 |
* @deprecated 4.3.0 Use format_for_editor() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3615 |
* @see format_for_editor() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3616 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3617 |
* @param string $output The text to be formatted. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3618 |
* @return string Formatted text after filter applied. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3619 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3620 |
function wp_htmledit_pre($output) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3621 |
_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3622 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3623 |
if ( !empty($output) ) |
16 | 3624 |
$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // Convert only '< > &'. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3625 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3626 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3627 |
* Filters the text before it is formatted for the HTML editor. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3628 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3629 |
* @since 2.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3630 |
* @deprecated 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3631 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3632 |
* @param string $output The HTML-formatted text. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3633 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3634 |
return apply_filters( 'htmledit_pre', $output ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3635 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3636 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3637 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3638 |
* Retrieve permalink from post ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3639 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3640 |
* @since 1.0.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3641 |
* @deprecated 4.4.0 Use get_permalink() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3642 |
* @see get_permalink() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3643 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3644 |
* @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3645 |
* @return string|false |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3646 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3647 |
function post_permalink( $post_id = 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3648 |
_deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3649 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3650 |
return get_permalink( $post_id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3651 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3652 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3653 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3654 |
* Perform a HTTP HEAD or GET request. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3655 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3656 |
* If $file_path is a writable filename, this will do a GET request and write |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3657 |
* the file to that path. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3658 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3659 |
* @since 2.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3660 |
* @deprecated 4.4.0 Use WP_Http |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3661 |
* @see WP_Http |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3662 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3663 |
* @param string $url URL to fetch. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3664 |
* @param string|bool $file_path Optional. File path to write request to. Default false. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3665 |
* @param int $red Optional. The number of Redirects followed, Upon 5 being hit, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3666 |
* returns false. Default 1. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3667 |
* @return bool|string False on failure and string of headers if HEAD request. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3668 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3669 |
function wp_get_http( $url, $file_path = false, $red = 1 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3670 |
_deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3671 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3672 |
@set_time_limit( 60 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3673 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3674 |
if ( $red > 5 ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3675 |
return false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3676 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3677 |
$options = array(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3678 |
$options['redirection'] = 5; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3679 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3680 |
if ( false == $file_path ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3681 |
$options['method'] = 'HEAD'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3682 |
else |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3683 |
$options['method'] = 'GET'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3684 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3685 |
$response = wp_safe_remote_request( $url, $options ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3686 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3687 |
if ( is_wp_error( $response ) ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3688 |
return false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3689 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3690 |
$headers = wp_remote_retrieve_headers( $response ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3691 |
$headers['response'] = wp_remote_retrieve_response_code( $response ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3692 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3693 |
// WP_HTTP no longer follows redirects for HEAD requests. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3694 |
if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3695 |
return wp_get_http( $headers['location'], $file_path, ++$red ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3696 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3697 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3698 |
if ( false == $file_path ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3699 |
return $headers; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3700 |
|
16 | 3701 |
// GET request - write it to the supplied filename. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3702 |
$out_fp = fopen($file_path, 'w'); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3703 |
if ( !$out_fp ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3704 |
return $headers; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3705 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3706 |
fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3707 |
fclose($out_fp); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3708 |
clearstatcache(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3709 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3710 |
return $headers; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3711 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3712 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3713 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3714 |
* Whether SSL login should be forced. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3715 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3716 |
* @since 2.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3717 |
* @deprecated 4.4.0 Use force_ssl_admin() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3718 |
* @see force_ssl_admin() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3719 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3720 |
* @param string|bool $force Optional Whether to force SSL login. Default null. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3721 |
* @return bool True if forced, false if not forced. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3722 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3723 |
function force_ssl_login( $force = null ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3724 |
_deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3725 |
return force_ssl_admin( $force ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3726 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3727 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3728 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3729 |
* Retrieve path of comment popup template in current or parent template. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3730 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3731 |
* @since 1.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3732 |
* @deprecated 4.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3733 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3734 |
* @return string Full path to comments popup template file. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3735 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3736 |
function get_comments_popup_template() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3737 |
_deprecated_function( __FUNCTION__, '4.5.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3738 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3739 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3740 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3741 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3742 |
/** |
9 | 3743 |
* Determines whether the current URL is within the comments popup window. |
16 | 3744 |
* |
9 | 3745 |
* For more information on this and similar theme functions, check out |
16 | 3746 |
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
9 | 3747 |
* Conditional Tags} article in the Theme Developer Handbook. |
16 | 3748 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3749 |
* @since 1.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3750 |
* @deprecated 4.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3751 |
* |
16 | 3752 |
* @return false Always returns false. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3753 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3754 |
function is_comments_popup() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3755 |
_deprecated_function( __FUNCTION__, '4.5.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3756 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3757 |
return false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3758 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3759 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3760 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3761 |
* Display the JS popup script to show a comment. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3762 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3763 |
* @since 0.71 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3764 |
* @deprecated 4.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3765 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3766 |
function comments_popup_script() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3767 |
_deprecated_function( __FUNCTION__, '4.5.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3768 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3769 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3770 |
/** |
9 | 3771 |
* Adds element attributes to open links in new tabs. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3772 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3773 |
* @since 0.71 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3774 |
* @deprecated 4.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3775 |
* |
9 | 3776 |
* @param string $text Content to replace links to open in a new tab. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3777 |
* @return string Content that has filtered links. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3778 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3779 |
function popuplinks( $text ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3780 |
_deprecated_function( __FUNCTION__, '4.5.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3781 |
$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3782 |
return $text; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3783 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3784 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3785 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3786 |
* The Google Video embed handler callback. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3787 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3788 |
* Deprecated function that previously assisted in turning Google Video URLs |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3789 |
* into embeds but that service has since been shut down. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3790 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3791 |
* @since 2.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3792 |
* @deprecated 4.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3793 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3794 |
* @return string An empty string. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3795 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3796 |
function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3797 |
_deprecated_function( __FUNCTION__, '4.6.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3798 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3799 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3800 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3801 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3802 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3803 |
* Retrieve path of paged template in current or parent template. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3804 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3805 |
* @since 1.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3806 |
* @deprecated 4.7.0 The paged.php template is no longer part of the theme template hierarchy. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3807 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3808 |
* @return string Full path to paged template file. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3809 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3810 |
function get_paged_template() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3811 |
_deprecated_function( __FUNCTION__, '4.7.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3812 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3813 |
return get_query_template( 'paged' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3814 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3815 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3816 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3817 |
* Removes the HTML JavaScript entities found in early versions of Netscape 4. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3818 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3819 |
* Previously, this function was pulled in from the original |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3820 |
* import of kses and removed a specific vulnerability only |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3821 |
* existent in early version of Netscape 4. However, this |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3822 |
* vulnerability never affected any other browsers and can |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3823 |
* be considered safe for the modern web. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3824 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3825 |
* The regular expression which sanitized this vulnerability |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3826 |
* has been removed in consideration of the performance and |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3827 |
* energy demands it placed, now merely passing through its |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3828 |
* input to the return. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3829 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3830 |
* @since 1.0.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3831 |
* @deprecated 4.7.0 Officially dropped security support for Netscape 4. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3832 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3833 |
* @param string $string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3834 |
* @return string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3835 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3836 |
function wp_kses_js_entities( $string ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3837 |
_deprecated_function( __FUNCTION__, '4.7.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3838 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3839 |
return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3840 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3841 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3842 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3843 |
* Sort categories by ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3844 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3845 |
* Used by usort() as a callback, should not be used directly. Can actually be |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3846 |
* used to sort any term object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3847 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3848 |
* @since 2.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3849 |
* @deprecated 4.7.0 Use wp_list_sort() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3850 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3851 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3852 |
* @param object $a |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3853 |
* @param object $b |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3854 |
* @return int |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3855 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3856 |
function _usort_terms_by_ID( $a, $b ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3857 |
_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3858 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3859 |
if ( $a->term_id > $b->term_id ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3860 |
return 1; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3861 |
elseif ( $a->term_id < $b->term_id ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3862 |
return -1; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3863 |
else |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3864 |
return 0; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3865 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3866 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3867 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3868 |
* Sort categories by name. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3869 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3870 |
* Used by usort() as a callback, should not be used directly. Can actually be |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3871 |
* used to sort any term object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3872 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3873 |
* @since 2.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3874 |
* @deprecated 4.7.0 Use wp_list_sort() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3875 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3876 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3877 |
* @param object $a |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3878 |
* @param object $b |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3879 |
* @return int |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3880 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3881 |
function _usort_terms_by_name( $a, $b ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3882 |
_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3883 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3884 |
return strcmp( $a->name, $b->name ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3885 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3886 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3887 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3888 |
* Sort menu items by the desired key. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3889 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3890 |
* @since 3.0.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3891 |
* @deprecated 4.7.0 Use wp_list_sort() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3892 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3893 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3894 |
* @global string $_menu_item_sort_prop |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3895 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3896 |
* @param object $a The first object to compare |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3897 |
* @param object $b The second object to compare |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3898 |
* @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3899 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3900 |
function _sort_nav_menu_items( $a, $b ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3901 |
global $_menu_item_sort_prop; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3902 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3903 |
_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3904 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3905 |
if ( empty( $_menu_item_sort_prop ) ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3906 |
return 0; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3907 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3908 |
if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3909 |
return 0; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3910 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3911 |
$_a = (int) $a->$_menu_item_sort_prop; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3912 |
$_b = (int) $b->$_menu_item_sort_prop; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3913 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3914 |
if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3915 |
return 0; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3916 |
elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3917 |
return $_a < $_b ? -1 : 1; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3918 |
else |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3919 |
return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3920 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3921 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3922 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3923 |
* Retrieves the Press This bookmarklet link. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3924 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3925 |
* @since 2.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3926 |
* @deprecated 4.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3927 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3928 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3929 |
function get_shortcut_link() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3930 |
_deprecated_function( __FUNCTION__, '4.9.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3931 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3932 |
$link = ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3933 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3934 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3935 |
* Filters the Press This bookmarklet link. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3936 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3937 |
* @since 2.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3938 |
* @deprecated 4.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3939 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3940 |
* @param string $link The Press This bookmarklet link. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3941 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3942 |
return apply_filters( 'shortcut_link', $link ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3943 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3944 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3945 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3946 |
* Ajax handler for saving a post from Press This. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3947 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3948 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3949 |
* @deprecated 4.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3950 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3951 |
function wp_ajax_press_this_save_post() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3952 |
_deprecated_function( __FUNCTION__, '4.9.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3953 |
if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { |
16 | 3954 |
include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3955 |
$wp_press_this = new WP_Press_This_Plugin(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3956 |
$wp_press_this->save_post(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3957 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3958 |
wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3959 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3960 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3961 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3962 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3963 |
* Ajax handler for creating new category from Press This. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3964 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3965 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3966 |
* @deprecated 4.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3967 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3968 |
function wp_ajax_press_this_add_category() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3969 |
_deprecated_function( __FUNCTION__, '4.9.0' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3970 |
if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { |
16 | 3971 |
include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3972 |
$wp_press_this = new WP_Press_This_Plugin(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3973 |
$wp_press_this->add_category(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3974 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3975 |
wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3976 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3977 |
} |
16 | 3978 |
|
3979 |
/** |
|
3980 |
* Return the user request object for the specified request ID. |
|
3981 |
* |
|
3982 |
* @since 4.9.6 |
|
3983 |
* @deprecated 5.4.0 Use wp_get_user_request() |
|
3984 |
* @see wp_get_user_request() |
|
3985 |
* |
|
3986 |
* @param int $request_id The ID of the user request. |
|
3987 |
* @return WP_User_Request|false |
|
3988 |
*/ |
|
3989 |
function wp_get_user_request_data( $request_id ) { |
|
3990 |
_deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' ); |
|
3991 |
return wp_get_user_request( $request_id ); |
|
3992 |
} |
|
3993 |
||
3994 |
/** |
|
3995 |
* Filters 'img' elements in post content to add 'srcset' and 'sizes' attributes. |
|
3996 |
* |
|
3997 |
* @since 4.4.0 |
|
3998 |
* @deprecated 5.5.0 |
|
3999 |
* |
|
4000 |
* @see wp_image_add_srcset_and_sizes() |
|
4001 |
* |
|
4002 |
* @param string $content The raw post content to be filtered. |
|
4003 |
* @return string Converted content with 'srcset' and 'sizes' attributes added to images. |
|
4004 |
*/ |
|
4005 |
function wp_make_content_images_responsive( $content ) { |
|
4006 |
_deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' ); |
|
4007 |
||
4008 |
// This will also add the `loading` attribute to `img` tags, if enabled. |
|
4009 |
return wp_filter_content_tags( $content ); |
|
4010 |
} |
|
4011 |
||
4012 |
/** |
|
4013 |
* Turn register globals off. |
|
4014 |
* |
|
4015 |
* @since 2.1.0 |
|
4016 |
* @access private |
|
4017 |
* @deprecated 5.5.0 |
|
4018 |
*/ |
|
4019 |
function wp_unregister_GLOBALS() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
|
4020 |
// register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4. |
|
4021 |
_deprecated_function( __FUNCTION__, '5.5.0' ); |
|
4022 |
} |
|
4023 |
||
4024 |
/** |
|
4025 |
* Does comment contain disallowed characters or words. |
|
4026 |
* |
|
4027 |
* @since 1.5.0 |
|
4028 |
* @deprecated 5.5.0 Use wp_check_comment_disallowed_list() instead. |
|
4029 |
* Please consider writing more inclusive code. |
|
4030 |
* |
|
4031 |
* @param string $author The author of the comment |
|
4032 |
* @param string $email The email of the comment |
|
4033 |
* @param string $url The url used in the comment |
|
4034 |
* @param string $comment The comment content |
|
4035 |
* @param string $user_ip The comment author's IP address |
|
4036 |
* @param string $user_agent The author's browser user agent |
|
4037 |
* @return bool True if comment contains disallowed content, false if comment does not |
|
4038 |
*/ |
|
4039 |
function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) { |
|
4040 |
_deprecated_function( __FUNCTION__, '5.5.0', 'wp_check_comment_disallowed_list()' ); |
|
4041 |
||
4042 |
return wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ); |
|
4043 |
} |
|
4044 |
||
4045 |
/** |
|
4046 |
* Filters out `register_meta()` args based on an allowed list. |
|
4047 |
* |
|
4048 |
* `register_meta()` args may change over time, so requiring the allowed list |
|
4049 |
* to be explicitly turned off is a warranty seal of sorts. |
|
4050 |
* |
|
4051 |
* @access private |
|
4052 |
* @since 4.6.0 |
|
4053 |
* @deprecated 5.5.0 Use _wp_register_meta_args_allowed_list() instead. |
|
4054 |
* Please consider writing more inclusive code. |
|
4055 |
* |
|
4056 |
* @param array $args Arguments from `register_meta()`. |
|
4057 |
* @param array $default_args Default arguments for `register_meta()`. |
|
4058 |
* @return array Filtered arguments. |
|
4059 |
*/ |
|
4060 |
function _wp_register_meta_args_whitelist( $args, $default_args ) { |
|
4061 |
_deprecated_function( __FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()' ); |
|
4062 |
||
4063 |
return _wp_register_meta_args_allowed_list( $args, $default_args ); |
|
4064 |
} |
|
4065 |
||
4066 |
/** |
|
4067 |
* Adds an array of options to the list of allowed options. |
|
4068 |
* |
|
4069 |
* @since 2.7.0 |
|
4070 |
* @deprecated 5.5.0 Use add_allowed_options() instead. |
|
4071 |
* Please consider writing more inclusive code. |
|
4072 |
* |
|
4073 |
* @global array $allowed_options |
|
4074 |
* |
|
4075 |
* @param array $new_options |
|
4076 |
* @param string|array $options |
|
4077 |
* @return array |
|
4078 |
*/ |
|
4079 |
function add_option_whitelist( $new_options, $options = '' ) { |
|
4080 |
_deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' ); |
|
4081 |
||
4082 |
return add_allowed_options( $new_options, $options ); |
|
4083 |
} |
|
4084 |
||
4085 |
/** |
|
4086 |
* Removes a list of options from the allowed options list. |
|
4087 |
* |
|
4088 |
* @since 2.7.0 |
|
4089 |
* @deprecated 5.5.0 Use remove_allowed_options() instead. |
|
4090 |
* Please consider writing more inclusive code. |
|
4091 |
* |
|
4092 |
* @global array $allowed_options |
|
4093 |
* |
|
4094 |
* @param array $del_options |
|
4095 |
* @param string|array $options |
|
4096 |
* @return array |
|
4097 |
*/ |
|
4098 |
function remove_option_whitelist( $del_options, $options = '' ) { |
|
4099 |
_deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' ); |
|
4100 |
||
4101 |
return remove_allowed_options( $del_options, $options ); |
|
4102 |
} |