]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/deprecated.php
Wordpress 3.6-scripts
[autoinstalls/wordpress.git] / wp-admin / includes / deprecated.php
1 <?php
2 /**
3  * Deprecated admin functions from past WordPress versions. You shouldn't use these
4  * functions and look for the alternatives instead. The functions will be removed
5  * in a later version.
6  *
7  * @package WordPress
8  * @subpackage Deprecated
9  */
10
11 /*
12  * Deprecated functions come here to die.
13  */
14
15 /**
16  * @since 2.1
17  * @deprecated 2.1
18  * @deprecated Use wp_editor().
19  * @see wp_editor()
20  */
21 function tinymce_include() {
22         _deprecated_function( __FUNCTION__, '2.1', 'wp_editor()' );
23
24         wp_tiny_mce();
25 }
26
27 /**
28  * Unused Admin function.
29  *
30  * @since 2.0
31  * @deprecated 2.5
32  *
33  */
34 function documentation_link() {
35         _deprecated_function( __FUNCTION__, '2.5' );
36         return;
37 }
38
39 /**
40  * Calculates the new dimensions for a downsampled image.
41  *
42  * @since 2.0.0
43  * @deprecated 3.0.0
44  * @deprecated Use wp_constrain_dimensions()
45  * @see wp_constrain_dimensions()
46  *
47  * @param int $width Current width of the image
48  * @param int $height Current height of the image
49  * @param int $wmax Maximum wanted width
50  * @param int $hmax Maximum wanted height
51  * @return array Shrunk dimensions (width, height).
52  */
53 function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
54         _deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' );
55         return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
56 }
57
58 /**
59  * Calculated the new dimensions for a downsampled image.
60  *
61  * @since 2.0.0
62  * @deprecated 3.5.0
63  * @deprecated Use wp_constrain_dimensions()
64  * @see wp_constrain_dimensions()
65  *
66  * @param int $width Current width of the image
67  * @param int $height Current height of the image
68  * @return array Shrunk dimensions (width, height).
69  */
70 function get_udims( $width, $height ) {
71         _deprecated_function( __FUNCTION__, '3.5', 'wp_constrain_dimensions()' );
72         return wp_constrain_dimensions( $width, $height, 128, 96 );
73 }
74
75 /**
76  * {@internal Missing Short Description}}
77  *
78  * @since 0.71
79  * @deprecated 2.6.0
80  * @deprecated Use wp_category_checklist()
81  * @see wp_category_checklist()
82  *
83  * @param unknown_type $default
84  * @param unknown_type $parent
85  * @param unknown_type $popular_ids
86  */
87 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
88         _deprecated_function( __FUNCTION__, '2.6', 'wp_category_checklist()' );
89         global $post_ID;
90         wp_category_checklist( $post_ID );
91 }
92
93 /**
94  * {@internal Missing Short Description}}
95  *
96  * @since 2.1.0
97  * @deprecated 2.6.0
98  * @deprecated Use wp_link_category_checklist()
99  * @see wp_link_category_checklist()
100  *
101  * @param unknown_type $default
102  */
103 function dropdown_link_categories( $default = 0 ) {
104         _deprecated_function( __FUNCTION__, '2.6', 'wp_link_category_checklist()' );
105         global $link_id;
106         wp_link_category_checklist( $link_id );
107 }
108
109 /**
110  * {@internal Missing Short Description}}
111  *
112  * @since 1.2.0
113  * @deprecated 3.0.0
114  * @deprecated Use wp_dropdown_categories()
115  * @see wp_dropdown_categories()
116  *
117  * @param unknown_type $currentcat
118  * @param unknown_type $currentparent
119  * @param unknown_type $parent
120  * @param unknown_type $level
121  * @param unknown_type $categories
122  * @return unknown
123  */
124 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
125         _deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' );
126         if (!$categories )
127                 $categories = get_categories( array('hide_empty' => 0) );
128
129         if ( $categories ) {
130                 foreach ( $categories as $category ) {
131                         if ( $currentcat != $category->term_id && $parent == $category->parent) {
132                                 $pad = str_repeat( '&#8211; ', $level );
133                                 $category->name = esc_html( $category->name );
134                                 echo "\n\t<option value='$category->term_id'";
135                                 if ( $currentparent == $category->term_id )
136                                         echo " selected='selected'";
137                                 echo ">$pad$category->name</option>";
138                                 wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
139                         }
140                 }
141         } else {
142                 return false;
143         }
144 }
145
146 /**
147  * Register a setting and its sanitization callback
148  *
149  * @since 2.7.0
150  * @deprecated 3.0.0
151  * @deprecated Use register_setting()
152  * @see register_setting()
153  *
154  * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
155  *      Default whitelisted option key names include "general," "discussion," and "reading," among others.
156  * @param string $option_name The name of an option to sanitize and save.
157  * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
158  * @return unknown
159  */
160 function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
161         _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
162         return register_setting( $option_group, $option_name, $sanitize_callback );
163 }
164
165 /**
166  * Unregister a setting
167  *
168  * @since 2.7.0
169  * @deprecated 3.0.0
170  * @deprecated Use unregister_setting()
171  * @see unregister_setting()
172  *
173  * @param unknown_type $option_group
174  * @param unknown_type $option_name
175  * @param unknown_type $sanitize_callback
176  * @return unknown
177  */
178 function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
179         _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
180         return unregister_setting( $option_group, $option_name, $sanitize_callback );
181 }
182
183 /**
184  * Determines the language to use for CodePress syntax highlighting.
185  *
186  * @since 2.8.0
187  * @deprecated 3.0.0
188  *
189  * @param string $filename
190 **/
191 function codepress_get_lang( $filename ) {
192         _deprecated_function( __FUNCTION__, '3.0' );
193         return;
194 }
195
196 /**
197  * Adds Javascript required to make CodePress work on the theme/plugin editors.
198  *
199  * @since 2.8.0
200  * @deprecated 3.0.0
201 **/
202 function codepress_footer_js() {
203         _deprecated_function( __FUNCTION__, '3.0' );
204         return;
205 }
206
207 /**
208  * Determine whether to use CodePress.
209  *
210  * @since 2.8
211  * @deprecated 3.0.0
212 **/
213 function use_codepress() {
214         _deprecated_function( __FUNCTION__, '3.0' );
215         return;
216 }
217
218 /**
219  * @deprecated 3.1.0
220  *
221  * @return array List of user IDs.
222  */
223 function get_author_user_ids() {
224         _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
225
226         global $wpdb;
227         if ( !is_multisite() )
228                 $level_key = $wpdb->get_blog_prefix() . 'user_level';
229         else
230                 $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
231
232         return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
233 }
234
235 /**
236  * @deprecated 3.1.0
237  *
238  * @param int $user_id User ID.
239  * @return array|bool List of editable authors. False if no editable users.
240  */
241 function get_editable_authors( $user_id ) {
242         _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
243
244         global $wpdb;
245
246         $editable = get_editable_user_ids( $user_id );
247
248         if ( !$editable ) {
249                 return false;
250         } else {
251                 $editable = join(',', $editable);
252                 $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
253         }
254
255         return apply_filters('get_editable_authors', $authors);
256 }
257
258 /**
259  * @deprecated 3.1.0
260  *
261  * @param int $user_id User ID.
262  * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
263  * @return unknown
264  */
265 function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
266         _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
267
268         global $wpdb;
269
270         if ( ! $user = get_userdata( $user_id ) )
271                 return array();
272         $post_type_obj = get_post_type_object($post_type);
273
274         if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
275                 if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
276                         return array($user->ID);
277                 else
278                         return array();
279         }
280
281         if ( !is_multisite() )
282                 $level_key = $wpdb->get_blog_prefix() . 'user_level';
283         else
284                 $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
285
286         $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
287         if ( $exclude_zeros )
288                 $query .= " AND meta_value != '0'";
289
290         return $wpdb->get_col( $query );
291 }
292
293 /**
294  * @deprecated 3.1.0
295  */
296 function get_nonauthor_user_ids() {
297         _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
298
299         global $wpdb;
300
301         if ( !is_multisite() )
302                 $level_key = $wpdb->get_blog_prefix() . 'user_level';
303         else
304                 $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
305
306         return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
307 }
308
309 if ( !class_exists('WP_User_Search') ) :
310 /**
311  * WordPress User Search class.
312  *
313  * @since 2.1.0
314  * @deprecated 3.1.0
315  */
316 class WP_User_Search {
317
318         /**
319          * {@internal Missing Description}}
320          *
321          * @since 2.1.0
322          * @access private
323          * @var unknown_type
324          */
325         var $results;
326
327         /**
328          * {@internal Missing Description}}
329          *
330          * @since 2.1.0
331          * @access private
332          * @var unknown_type
333          */
334         var $search_term;
335
336         /**
337          * Page number.
338          *
339          * @since 2.1.0
340          * @access private
341          * @var int
342          */
343         var $page;
344
345         /**
346          * Role name that users have.
347          *
348          * @since 2.5.0
349          * @access private
350          * @var string
351          */
352         var $role;
353
354         /**
355          * Raw page number.
356          *
357          * @since 2.1.0
358          * @access private
359          * @var int|bool
360          */
361         var $raw_page;
362
363         /**
364          * Amount of users to display per page.
365          *
366          * @since 2.1.0
367          * @access public
368          * @var int
369          */
370         var $users_per_page = 50;
371
372         /**
373          * {@internal Missing Description}}
374          *
375          * @since 2.1.0
376          * @access private
377          * @var unknown_type
378          */
379         var $first_user;
380
381         /**
382          * {@internal Missing Description}}
383          *
384          * @since 2.1.0
385          * @access private
386          * @var int
387          */
388         var $last_user;
389
390         /**
391          * {@internal Missing Description}}
392          *
393          * @since 2.1.0
394          * @access private
395          * @var string
396          */
397         var $query_limit;
398
399         /**
400          * {@internal Missing Description}}
401          *
402          * @since 3.0.0
403          * @access private
404          * @var string
405          */
406         var $query_orderby;
407
408         /**
409          * {@internal Missing Description}}
410          *
411          * @since 3.0.0
412          * @access private
413          * @var string
414          */
415         var $query_from;
416
417         /**
418          * {@internal Missing Description}}
419          *
420          * @since 3.0.0
421          * @access private
422          * @var string
423          */
424         var $query_where;
425
426         /**
427          * {@internal Missing Description}}
428          *
429          * @since 2.1.0
430          * @access private
431          * @var int
432          */
433         var $total_users_for_query = 0;
434
435         /**
436          * {@internal Missing Description}}
437          *
438          * @since 2.1.0
439          * @access private
440          * @var bool
441          */
442         var $too_many_total_users = false;
443
444         /**
445          * {@internal Missing Description}}
446          *
447          * @since 2.1.0
448          * @access private
449          * @var unknown_type
450          */
451         var $search_errors;
452
453         /**
454          * {@internal Missing Description}}
455          *
456          * @since 2.7.0
457          * @access private
458          * @var unknown_type
459          */
460         var $paging_text;
461
462         /**
463          * PHP4 Constructor - Sets up the object properties.
464          *
465          * @since 2.1.0
466          *
467          * @param string $search_term Search terms string.
468          * @param int $page Optional. Page ID.
469          * @param string $role Role name.
470          * @return WP_User_Search
471          */
472         function WP_User_Search ($search_term = '', $page = '', $role = '') {
473                 _deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' );
474
475                 $this->search_term = wp_unslash( $search_term );
476                 $this->raw_page = ( '' == $page ) ? false : (int) $page;
477                 $this->page = (int) ( '' == $page ) ? 1 : $page;
478                 $this->role = $role;
479
480                 $this->prepare_query();
481                 $this->query();
482                 $this->do_paging();
483         }
484
485         /**
486          * {@internal Missing Short Description}}
487          *
488          * {@internal Missing Long Description}}
489          *
490          * @since 2.1.0
491          * @access public
492          */
493         function prepare_query() {
494                 global $wpdb;
495                 $this->first_user = ($this->page - 1) * $this->users_per_page;
496
497                 $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
498                 $this->query_orderby = ' ORDER BY user_login';
499
500                 $search_sql = '';
501                 if ( $this->search_term ) {
502                         $searches = array();
503                         $search_sql = 'AND (';
504                         foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
505                                 $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
506                         $search_sql .= implode(' OR ', $searches);
507                         $search_sql .= ')';
508                 }
509
510                 $this->query_from = " FROM $wpdb->users";
511                 $this->query_where = " WHERE 1=1 $search_sql";
512
513                 if ( $this->role ) {
514                         $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
515                         $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
516                 } elseif ( is_multisite() ) {
517                         $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
518                         $this->query_from .= ", $wpdb->usermeta";
519                         $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
520                 }
521
522                 do_action_ref_array( 'pre_user_search', array( &$this ) );
523         }
524
525         /**
526          * {@internal Missing Short Description}}
527          *
528          * {@internal Missing Long Description}}
529          *
530          * @since 2.1.0
531          * @access public
532          */
533         function query() {
534                 global $wpdb;
535
536                 $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
537
538                 if ( $this->results )
539                         $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
540                 else
541                         $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
542         }
543
544         /**
545          * {@internal Missing Short Description}}
546          *
547          * {@internal Missing Long Description}}
548          *
549          * @since 2.1.0
550          * @access public
551          */
552         function prepare_vars_for_template_usage() {}
553
554         /**
555          * {@internal Missing Short Description}}
556          *
557          * {@internal Missing Long Description}}
558          *
559          * @since 2.1.0
560          * @access public
561          */
562         function do_paging() {
563                 if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
564                         $args = array();
565                         if( ! empty($this->search_term) )
566                                 $args['usersearch'] = urlencode($this->search_term);
567                         if( ! empty($this->role) )
568                                 $args['role'] = urlencode($this->role);
569
570                         $this->paging_text = paginate_links( array(
571                                 'total' => ceil($this->total_users_for_query / $this->users_per_page),
572                                 'current' => $this->page,
573                                 'base' => 'users.php?%_%',
574                                 'format' => 'userspage=%#%',
575                                 'add_args' => $args
576                         ) );
577                         if ( $this->paging_text ) {
578                                 $this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
579                                         number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
580                                         number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
581                                         number_format_i18n( $this->total_users_for_query ),
582                                         $this->paging_text
583                                 );
584                         }
585                 }
586         }
587
588         /**
589          * {@internal Missing Short Description}}
590          *
591          * {@internal Missing Long Description}}
592          *
593          * @since 2.1.0
594          * @access public
595          *
596          * @return unknown
597          */
598         function get_results() {
599                 return (array) $this->results;
600         }
601
602         /**
603          * Displaying paging text.
604          *
605          * @see do_paging() Builds paging text.
606          *
607          * @since 2.1.0
608          * @access public
609          */
610         function page_links() {
611                 echo $this->paging_text;
612         }
613
614         /**
615          * Whether paging is enabled.
616          *
617          * @see do_paging() Builds paging text.
618          *
619          * @since 2.1.0
620          * @access public
621          *
622          * @return bool
623          */
624         function results_are_paged() {
625                 if ( $this->paging_text )
626                         return true;
627                 return false;
628         }
629
630         /**
631          * Whether there are search terms.
632          *
633          * @since 2.1.0
634          * @access public
635          *
636          * @return bool
637          */
638         function is_search() {
639                 if ( $this->search_term )
640                         return true;
641                 return false;
642         }
643 }
644 endif;
645
646 /**
647  * Retrieve editable posts from other users.
648  *
649  * @deprecated 3.1.0
650  *
651  * @param int $user_id User ID to not retrieve posts from.
652  * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
653  * @return array List of posts from others.
654  */
655 function get_others_unpublished_posts($user_id, $type='any') {
656         _deprecated_function( __FUNCTION__, '3.1' );
657
658         global $wpdb;
659
660         $editable = get_editable_user_ids( $user_id );
661
662         if ( in_array($type, array('draft', 'pending')) )
663                 $type_sql = " post_status = '$type' ";
664         else
665                 $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
666
667         $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
668
669         if ( !$editable ) {
670                 $other_unpubs = '';
671         } else {
672                 $editable = join(',', $editable);
673                 $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
674         }
675
676         return apply_filters('get_others_drafts', $other_unpubs);
677 }
678
679 /**
680  * Retrieve drafts from other users.
681  *
682  * @deprecated 3.1.0
683  *
684  * @param int $user_id User ID.
685  * @return array List of drafts from other users.
686  */
687 function get_others_drafts($user_id) {
688         _deprecated_function( __FUNCTION__, '3.1' );
689
690         return get_others_unpublished_posts($user_id, 'draft');
691 }
692
693 /**
694  * Retrieve pending review posts from other users.
695  *
696  * @deprecated 3.1.0
697  *
698  * @param int $user_id User ID.
699  * @return array List of posts with pending review post type from other users.
700  */
701 function get_others_pending($user_id) {
702         _deprecated_function( __FUNCTION__, '3.1' );
703
704         return get_others_unpublished_posts($user_id, 'pending');
705 }
706
707 /**
708  * Output the QuickPress dashboard widget.
709  *
710  * @since 3.0.0
711  * @deprecated 3.2.0
712  * @deprecated Use wp_dashboard_quick_press()
713  * @see wp_dashboard_quick_press()
714  */
715 function wp_dashboard_quick_press_output() {
716         _deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' );
717         wp_dashboard_quick_press();
718 }
719
720 /**
721  * @since 2.7.0
722  * @deprecated 3.3
723  * @deprecated Use wp_editor()
724  * @see wp_editor()
725  */
726 function wp_tiny_mce( $teeny = false, $settings = false ) {
727         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
728
729         static $num = 1;
730
731         if ( ! class_exists('_WP_Editors' ) )
732                 require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
733
734         $editor_id = 'content' . $num++;
735
736         $set = array(
737                 'teeny' => $teeny,
738                 'tinymce' => $settings ? $settings : true,
739                 'quicktags' => false
740         );
741
742         $set = _WP_Editors::parse_settings($editor_id, $set);
743         _WP_Editors::editor_settings($editor_id, $set);
744 }
745
746 /**
747  * @deprecated 3.3.0
748  * @deprecated Use wp_editor()
749  * @see wp_editor()
750  */
751 function wp_preload_dialogs() {
752         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
753 }
754
755 /**
756  * @deprecated 3.3.0
757  * @deprecated Use wp_editor()
758  * @see wp_editor()
759  */
760 function wp_print_editor_js() {
761         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
762 }
763
764 /**
765  * @deprecated 3.3.0
766  * @deprecated Use wp_editor()
767  * @see wp_editor()
768  */
769 function wp_quicktags() {
770         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
771 }
772
773 /**
774  * Returns the screen layout options.
775  *
776  * @since 2.8.0
777  * @deprecated 3.3.0
778  * @deprecated Use $current_screen->render_screen_layout()
779  * @see WP_Screen::render_screen_layout()
780  */
781 function screen_layout( $screen ) {
782         _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_layout()' );
783
784         $current_screen = get_current_screen();
785
786         if ( ! $current_screen )
787                 return '';
788
789         ob_start();
790         $current_screen->render_screen_layout();
791         return ob_get_clean();
792 }
793
794 /**
795  * Returns the screen's per-page options.
796  *
797  * @since 2.8.0
798  * @deprecated 3.3.0
799  * @deprecated Use $current_screen->render_per_page_options()
800  * @see WP_Screen::render_per_page_options()
801  */
802 function screen_options( $screen ) {
803         _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_per_page_options()' );
804
805         $current_screen = get_current_screen();
806
807         if ( ! $current_screen )
808                 return '';
809
810         ob_start();
811         $current_screen->render_per_page_options();
812         return ob_get_clean();
813 }
814
815 /**
816  * Renders the screen's help.
817  *
818  * @since 2.7.0
819  * @deprecated 3.3.0
820  * @deprecated Use $current_screen->render_screen_meta()
821  * @see WP_Screen::render_screen_meta()
822  */
823 function screen_meta( $screen ) {
824         $current_screen = get_current_screen();
825         $current_screen->render_screen_meta();
826 }
827
828 /**
829  * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
830  *
831  * @since 2.7.0
832  * @deprecated 3.2.0
833  */
834 function favorite_actions() {
835         _deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' );
836 }
837
838 function media_upload_image() {
839         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
840         return wp_media_upload_handler();
841 }
842
843 function media_upload_audio() {
844         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
845         return wp_media_upload_handler();
846 }
847
848 function media_upload_video() {
849         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
850         return wp_media_upload_handler();
851 }
852
853 function media_upload_file() {
854         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
855         return wp_media_upload_handler();
856 }
857
858 function type_url_form_image() {
859         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('image')" );
860         return wp_media_insert_url_form( 'image' );
861 }
862
863 function type_url_form_audio() {
864         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('audio')" );
865         return wp_media_insert_url_form( 'audio' );
866 }
867
868 function type_url_form_video() {
869         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('video')" );
870         return wp_media_insert_url_form( 'video' );
871 }
872
873 function type_url_form_file() {
874         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('file')" );
875         return wp_media_insert_url_form( 'file' );
876 }
877
878 /**
879  * Add contextual help text for a page.
880  *
881  * Creates an 'Overview' help tab.
882  *
883  * @since 2.7.0
884  * @deprecated 3.3.0
885  * @deprecated Use get_current_screen()->add_help_tab()
886  * @see WP_Screen
887  *
888  * @param string    $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
889  * @param string    $help   The content of an 'Overview' help tab.
890  */
891 function add_contextual_help( $screen, $help ) {
892         _deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' );
893
894         if ( is_string( $screen ) )
895                 $screen = convert_to_screen( $screen );
896
897         WP_Screen::add_old_compat_help( $screen, $help );
898 }
899
900 /**
901  * Get the allowed themes for the current blog.
902  *
903  * @since 3.0.0
904  * @deprecated 3.4.0
905  * @deprecated Use wp_get_themes()
906  * @see wp_get_themes()
907  *
908  * @return array $themes Array of allowed themes.
909  */
910 function get_allowed_themes() {
911         _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )" );
912
913         $themes = wp_get_themes( array( 'allowed' => true ) );
914
915         $wp_themes = array();
916         foreach ( $themes as $theme ) {
917                 $wp_themes[ $theme->get('Name') ] = $theme;
918         }
919
920         return $wp_themes;
921 }
922
923 /**
924  * {@internal Missing Short Description}}
925  *
926  * @since 1.5.0
927  *
928  * @return unknown
929  */
930 function get_broken_themes() {
931         _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )" );
932
933         $themes = wp_get_themes( array( 'errors' => true ) );
934         $broken = array();
935         foreach ( $themes as $theme ) {
936                 $name = $theme->get('Name');
937                 $broken[ $name ] = array(
938                         'Name' => $name,
939                         'Title' => $name,
940                         'Description' => $theme->errors()->get_error_message(),
941                 );
942         }
943         return $broken;
944 }
945
946 /**
947  * {@internal Missing Short Description}}
948  *
949  * @since 2.0.0
950  *
951  * @return unknown
952  */
953 function current_theme_info() {
954         _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
955
956         return wp_get_theme();
957 }
958
959 /**
960  * This was once used to display an 'Insert into Post' button. Now it is deprecated and stubbed.
961  *
962  * @deprecated 3.5.0
963  */
964 function _insert_into_post_button( $type ) {
965         _deprecated_function( __FUNCTION__, '3.5' );
966 }
967
968 /**
969  * This was once used to display a media button. Now it is deprecated and stubbed.
970  *
971  * @deprecated 3.5.0
972  */
973 function _media_button($title, $icon, $type, $id) {
974         _deprecated_function( __FUNCTION__, '3.5' );
975 }
976
977 /**
978  * Get an existing post and format it for editing.
979  *
980  * @since 2.0.0
981  * @deprecated 3.5.0
982  *
983  * @param int $id
984  * @return object
985  */
986 function get_post_to_edit( $id ) {
987         _deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
988
989         return get_post( $id, OBJECT, 'edit' );
990 }
991
992 /**
993  * Get the default page information to use.
994  *
995  * @since 2.5.0
996  * @deprecated 3.5.0
997  * @deprecated Use get_default_post_to_edit()
998  *
999  * @return WP_Post Post object containing all the default post data as attributes
1000  */
1001 function get_default_page_to_edit() {
1002         _deprecated_function( __FUNCTION__, '3.5', "get_default_post_to_edit( 'page' )" );
1003
1004         $page = get_default_post_to_edit();
1005         $page->post_type = 'page';
1006         return $page;
1007 }
1008
1009 /**
1010  * This was once used to create a thumbnail from an Image given a maximum side size.
1011  *
1012  * @since 1.2.0
1013  * @deprecated 3.5.0
1014  * @deprecated Use image_resize()
1015  * @see image_resize()
1016  *
1017  * @param mixed $file Filename of the original image, Or attachment id.
1018  * @param int $max_side Maximum length of a single side for the thumbnail.
1019  * @param mixed $deprecated Never used.
1020  * @return string Thumbnail path on success, Error string on failure.
1021  */
1022 function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
1023         _deprecated_function( __FUNCTION__, '3.5', 'image_resize()' );
1024         return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
1025 }