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