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