]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/deprecated.php
Wordpress 3.5.2
[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 = stripslashes( $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->prepare_vars_for_template_usage();
483                 $this->do_paging();
484         }
485
486         /**
487          * {@internal Missing Short Description}}
488          *
489          * {@internal Missing Long Description}}
490          *
491          * @since 2.1.0
492          * @access public
493          */
494         function prepare_query() {
495                 global $wpdb;
496                 $this->first_user = ($this->page - 1) * $this->users_per_page;
497
498                 $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
499                 $this->query_orderby = ' ORDER BY user_login';
500
501                 $search_sql = '';
502                 if ( $this->search_term ) {
503                         $searches = array();
504                         $search_sql = 'AND (';
505                         foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
506                                 $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
507                         $search_sql .= implode(' OR ', $searches);
508                         $search_sql .= ')';
509                 }
510
511                 $this->query_from = " FROM $wpdb->users";
512                 $this->query_where = " WHERE 1=1 $search_sql";
513
514                 if ( $this->role ) {
515                         $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
516                         $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
517                 } elseif ( is_multisite() ) {
518                         $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
519                         $this->query_from .= ", $wpdb->usermeta";
520                         $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
521                 }
522
523                 do_action_ref_array( 'pre_user_search', array( &$this ) );
524         }
525
526         /**
527          * {@internal Missing Short Description}}
528          *
529          * {@internal Missing Long Description}}
530          *
531          * @since 2.1.0
532          * @access public
533          */
534         function query() {
535                 global $wpdb;
536
537                 $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
538
539                 if ( $this->results )
540                         $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
541                 else
542                         $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
543         }
544
545         /**
546          * {@internal Missing Short Description}}
547          *
548          * {@internal Missing Long Description}}
549          *
550          * @since 2.1.0
551          * @access public
552          */
553         function prepare_vars_for_template_usage() {
554                 $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
555         }
556
557         /**
558          * {@internal Missing Short Description}}
559          *
560          * {@internal Missing Long Description}}
561          *
562          * @since 2.1.0
563          * @access public
564          */
565         function do_paging() {
566                 if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
567                         $args = array();
568                         if( ! empty($this->search_term) )
569                                 $args['usersearch'] = urlencode($this->search_term);
570                         if( ! empty($this->role) )
571                                 $args['role'] = urlencode($this->role);
572
573                         $this->paging_text = paginate_links( array(
574                                 'total' => ceil($this->total_users_for_query / $this->users_per_page),
575                                 'current' => $this->page,
576                                 'base' => 'users.php?%_%',
577                                 'format' => 'userspage=%#%',
578                                 'add_args' => $args
579                         ) );
580                         if ( $this->paging_text ) {
581                                 $this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
582                                         number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
583                                         number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
584                                         number_format_i18n( $this->total_users_for_query ),
585                                         $this->paging_text
586                                 );
587                         }
588                 }
589         }
590
591         /**
592          * {@internal Missing Short Description}}
593          *
594          * {@internal Missing Long Description}}
595          *
596          * @since 2.1.0
597          * @access public
598          *
599          * @return unknown
600          */
601         function get_results() {
602                 return (array) $this->results;
603         }
604
605         /**
606          * Displaying paging text.
607          *
608          * @see do_paging() Builds paging text.
609          *
610          * @since 2.1.0
611          * @access public
612          */
613         function page_links() {
614                 echo $this->paging_text;
615         }
616
617         /**
618          * Whether paging is enabled.
619          *
620          * @see do_paging() Builds paging text.
621          *
622          * @since 2.1.0
623          * @access public
624          *
625          * @return bool
626          */
627         function results_are_paged() {
628                 if ( $this->paging_text )
629                         return true;
630                 return false;
631         }
632
633         /**
634          * Whether there are search terms.
635          *
636          * @since 2.1.0
637          * @access public
638          *
639          * @return bool
640          */
641         function is_search() {
642                 if ( $this->search_term )
643                         return true;
644                 return false;
645         }
646 }
647 endif;
648
649 /**
650  * Retrieve editable posts from other users.
651  *
652  * @deprecated 3.1.0
653  *
654  * @param int $user_id User ID to not retrieve posts from.
655  * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
656  * @return array List of posts from others.
657  */
658 function get_others_unpublished_posts($user_id, $type='any') {
659         _deprecated_function( __FUNCTION__, '3.1' );
660
661         global $wpdb;
662
663         $editable = get_editable_user_ids( $user_id );
664
665         if ( in_array($type, array('draft', 'pending')) )
666                 $type_sql = " post_status = '$type' ";
667         else
668                 $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
669
670         $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
671
672         if ( !$editable ) {
673                 $other_unpubs = '';
674         } else {
675                 $editable = join(',', $editable);
676                 $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) );
677         }
678
679         return apply_filters('get_others_drafts', $other_unpubs);
680 }
681
682 /**
683  * Retrieve drafts from other users.
684  *
685  * @deprecated 3.1.0
686  *
687  * @param int $user_id User ID.
688  * @return array List of drafts from other users.
689  */
690 function get_others_drafts($user_id) {
691         _deprecated_function( __FUNCTION__, '3.1' );
692
693         return get_others_unpublished_posts($user_id, 'draft');
694 }
695
696 /**
697  * Retrieve pending review posts from other users.
698  *
699  * @deprecated 3.1.0
700  *
701  * @param int $user_id User ID.
702  * @return array List of posts with pending review post type from other users.
703  */
704 function get_others_pending($user_id) {
705         _deprecated_function( __FUNCTION__, '3.1' );
706
707         return get_others_unpublished_posts($user_id, 'pending');
708 }
709
710 /**
711  * Output the QuickPress dashboard widget.
712  *
713  * @since 3.0.0
714  * @deprecated 3.2.0
715  * @deprecated Use wp_dashboard_quick_press()
716  * @see wp_dashboard_quick_press()
717  */
718 function wp_dashboard_quick_press_output() {
719         _deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' );
720         wp_dashboard_quick_press();
721 }
722
723 /**
724  * @since 2.7.0
725  * @deprecated 3.3
726  * @deprecated Use wp_editor()
727  * @see wp_editor()
728  */
729 function wp_tiny_mce( $teeny = false, $settings = false ) {
730         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
731
732         static $num = 1;
733
734         if ( ! class_exists('_WP_Editors' ) )
735                 require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
736
737         $editor_id = 'content' . $num++;
738
739         $set = array(
740                 'teeny' => $teeny,
741                 'tinymce' => $settings ? $settings : true,
742                 'quicktags' => false
743         );
744
745         $set = _WP_Editors::parse_settings($editor_id, $set);
746         _WP_Editors::editor_settings($editor_id, $set);
747 }
748
749 /**
750  * @deprecated 3.3.0
751  * @deprecated Use wp_editor()
752  * @see wp_editor()
753  */
754 function wp_preload_dialogs() {
755         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
756 }
757
758 /**
759  * @deprecated 3.3.0
760  * @deprecated Use wp_editor()
761  * @see wp_editor()
762  */
763 function wp_print_editor_js() {
764         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
765 }
766
767 /**
768  * @deprecated 3.3.0
769  * @deprecated Use wp_editor()
770  * @see wp_editor()
771  */
772 function wp_quicktags() {
773         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
774 }
775
776 /**
777  * Returns the screen layout options.
778  *
779  * @since 2.8.0
780  * @deprecated 3.3.0
781  * @deprecated Use $current_screen->render_screen_layout()
782  * @see WP_Screen::render_screen_layout()
783  */
784 function screen_layout( $screen ) {
785         _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_layout()' );
786
787         $current_screen = get_current_screen();
788
789         if ( ! $current_screen )
790                 return '';
791
792         ob_start();
793         $current_screen->render_screen_layout();
794         return ob_get_clean();
795 }
796
797 /**
798  * Returns the screen's per-page options.
799  *
800  * @since 2.8.0
801  * @deprecated 3.3.0
802  * @deprecated Use $current_screen->render_per_page_options()
803  * @see WP_Screen::render_per_page_options()
804  */
805 function screen_options( $screen ) {
806         _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_per_page_options()' );
807
808         $current_screen = get_current_screen();
809
810         if ( ! $current_screen )
811                 return '';
812
813         ob_start();
814         $current_screen->render_per_page_options();
815         return ob_get_clean();
816 }
817
818 /**
819  * Renders the screen's help.
820  *
821  * @since 2.7.0
822  * @deprecated 3.3.0
823  * @deprecated Use $current_screen->render_screen_meta()
824  * @see WP_Screen::render_screen_meta()
825  */
826 function screen_meta( $screen ) {
827         $current_screen = get_current_screen();
828         $current_screen->render_screen_meta();
829 }
830
831 /**
832  * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
833  *
834  * @since 2.7.0
835  * @deprecated 3.2.0
836  */
837 function favorite_actions() {
838         _deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' );
839 }
840
841 function media_upload_image() {
842         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
843         return wp_media_upload_handler();
844 }
845
846 function media_upload_audio() {
847         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
848         return wp_media_upload_handler();
849 }
850
851 function media_upload_video() {
852         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
853         return wp_media_upload_handler();
854 }
855
856 function media_upload_file() {
857         __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
858         return wp_media_upload_handler();
859 }
860
861 function type_url_form_image() {
862         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('image')" );
863         return wp_media_insert_url_form( 'image' );
864 }
865
866 function type_url_form_audio() {
867         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('audio')" );
868         return wp_media_insert_url_form( 'audio' );
869 }
870
871 function type_url_form_video() {
872         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('video')" );
873         return wp_media_insert_url_form( 'video' );
874 }
875
876 function type_url_form_file() {
877         __deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('file')" );
878         return wp_media_insert_url_form( 'file' );
879 }
880
881 /**
882  * Add contextual help text for a page.
883  *
884  * Creates an 'Overview' help tab.
885  *
886  * @since 2.7.0
887  * @deprecated 3.3.0
888  * @deprecated Use get_current_screen()->add_help_tab()
889  * @see WP_Screen
890  *
891  * @param string    $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
892  * @param string    $help   The content of an 'Overview' help tab.
893  */
894 function add_contextual_help( $screen, $help ) {
895         _deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' );
896
897         if ( is_string( $screen ) )
898                 $screen = convert_to_screen( $screen );
899
900         WP_Screen::add_old_compat_help( $screen, $help );
901 }
902
903 /**
904  * Get the allowed themes for the current blog.
905  *
906  * @since 3.0.0
907  * @deprecated 3.4.0
908  * @deprecated Use wp_get_themes()
909  * @see wp_get_themes()
910  *
911  * @return array $themes Array of allowed themes.
912  */
913 function get_allowed_themes() {
914         _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )" );
915
916         $themes = wp_get_themes( array( 'allowed' => true ) );
917
918         $wp_themes = array();
919         foreach ( $themes as $theme ) {
920                 $wp_themes[ $theme->get('Name') ] = $theme;
921         }
922
923         return $wp_themes;
924 }
925
926 /**
927  * {@internal Missing Short Description}}
928  *
929  * @since 1.5.0
930  *
931  * @return unknown
932  */
933 function get_broken_themes() {
934         _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )" );
935
936         $themes = wp_get_themes( array( 'errors' => true ) );
937         $broken = array();
938         foreach ( $themes as $theme ) {
939                 $name = $theme->get('Name');
940                 $broken[ $name ] = array(
941                         'Name' => $name,
942                         'Title' => $name,
943                         'Description' => $theme->errors()->get_error_message(),
944                 );
945         }
946         return $broken;
947 }
948
949 /**
950  * {@internal Missing Short Description}}
951  *
952  * @since 2.0.0
953  *
954  * @return unknown
955  */
956 function current_theme_info() {
957         _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
958
959         return wp_get_theme();
960 }
961
962 /**
963  * This was once used to display an 'Insert into Post' button. Now it is deprecated and stubbed.
964  *
965  * @deprecated 3.5.0
966  */
967 function _insert_into_post_button( $type ) {
968         _deprecated_function( __FUNCTION__, '3.5' );
969 }
970
971 /**
972  * This was once used to display a media button. Now it is deprecated and stubbed.
973  *
974  * @deprecated 3.5.0
975  */
976 function _media_button($title, $icon, $type, $id) {
977         _deprecated_function( __FUNCTION__, '3.5' );
978 }
979
980 /**
981  * Get an existing post and format it for editing.
982  *
983  * @since 2.0.0
984  * @deprecated 3.5.0
985  *
986  * @param int $id
987  * @return object
988  */
989 function get_post_to_edit( $id ) {
990         _deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
991
992         return get_post( $id, OBJECT, 'edit' );
993 }
994
995 /**
996  * Get the default page information to use.
997  *
998  * @since 2.5.0
999  * @deprecated 3.5.0
1000  * @deprecated Use get_default_post_to_edit()
1001  *
1002  * @return WP_Post Post object containing all the default post data as attributes
1003  */
1004 function get_default_page_to_edit() {
1005         _deprecated_function( __FUNCTION__, '3.5', "get_default_post_to_edit( 'page' )" );
1006
1007         $page = get_default_post_to_edit();
1008         $page->post_type = 'page';
1009         return $page;
1010 }
1011
1012 /**
1013  * This was once used to create a thumbnail from an Image given a maximum side size.
1014  *
1015  * @since 1.2.0
1016  * @deprecated 3.5.0
1017  * @deprecated Use image_resize()
1018  * @see  image_resize()
1019  *
1020  * @param mixed $file Filename of the original image, Or attachment id.
1021  * @param int $max_side Maximum length of a single side for the thumbnail.
1022  * @param mixed $deprecated Never used.
1023  * @return string Thumbnail path on success, Error string on failure.
1024  */
1025 function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
1026         _deprecated_function( __FUNCTION__, '3.5', 'image_resize' );
1027         return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
1028 }