]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/deprecated.php
WordPress 4.4.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 Use wp_editor()
18  * @see wp_editor()
19  */
20 function tinymce_include() {
21         _deprecated_function( __FUNCTION__, '2.1', 'wp_editor()' );
22
23         wp_tiny_mce();
24 }
25
26 /**
27  * Unused Admin function.
28  *
29  * @since 2.0.0
30  * @deprecated 2.5.0
31  *
32  */
33 function documentation_link() {
34         _deprecated_function( __FUNCTION__, '2.5' );
35 }
36
37 /**
38  * Calculates the new dimensions for a downsampled image.
39  *
40  * @since 2.0.0
41  * @deprecated 3.0.0 Use wp_constrain_dimensions()
42  * @see wp_constrain_dimensions()
43  *
44  * @param int $width Current width of the image
45  * @param int $height Current height of the image
46  * @param int $wmax Maximum wanted width
47  * @param int $hmax Maximum wanted height
48  * @return array Shrunk dimensions (width, height).
49  */
50 function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
51         _deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' );
52         return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
53 }
54
55 /**
56  * Calculated the new dimensions for a downsampled image.
57  *
58  * @since 2.0.0
59  * @deprecated 3.5.0 Use wp_constrain_dimensions()
60  * @see wp_constrain_dimensions()
61  *
62  * @param int $width Current width of the image
63  * @param int $height Current height of the image
64  * @return array Shrunk dimensions (width, height).
65  */
66 function get_udims( $width, $height ) {
67         _deprecated_function( __FUNCTION__, '3.5', 'wp_constrain_dimensions()' );
68         return wp_constrain_dimensions( $width, $height, 128, 96 );
69 }
70
71 /**
72  * Legacy function used to generate the categories checklist control.
73  *
74  * @since 0.71
75  * @deprecated 2.6.0 Use wp_category_checklist()
76  * @see wp_category_checklist()
77  *
78  * @param int $default       Unused.
79  * @param int $parent        Unused.
80  * @param array $popular_ids Unused.
81  */
82 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
83         _deprecated_function( __FUNCTION__, '2.6', 'wp_category_checklist()' );
84         global $post_ID;
85         wp_category_checklist( $post_ID );
86 }
87
88 /**
89  * Legacy function used to generate a link categories checklist control.
90  *
91  * @since 2.1.0
92  * @deprecated 2.6.0 Use wp_link_category_checklist()
93  * @see wp_link_category_checklist()
94  *
95  * @param int $default Unused.
96  */
97 function dropdown_link_categories( $default = 0 ) {
98         _deprecated_function( __FUNCTION__, '2.6', 'wp_link_category_checklist()' );
99         global $link_id;
100         wp_link_category_checklist( $link_id );
101 }
102
103 /**
104  * Get the real filesystem path to a file to edit within the admin.
105  *
106  * @since 1.5.0
107  * @deprecated 2.9.0
108  * @uses WP_CONTENT_DIR Full filesystem path to the wp-content directory.
109  *
110  * @param string $file Filesystem path relative to the wp-content directory.
111  * @return string Full filesystem path to edit.
112  */
113 function get_real_file_to_edit( $file ) {
114         _deprecated_function( __FUNCTION__, '2.9' );
115
116         return WP_CONTENT_DIR . $file;
117 }
118
119 /**
120  * Legacy function used for generating a categories drop-down control.
121  *
122  * @since 1.2.0
123  * @deprecated 3.0.0 Use wp_dropdown_categories()
124  * @see wp_dropdown_categories()
125  *
126  * @param int $currentcat    Optional. ID of the current category. Default 0.
127  * @param int $currentparent Optional. Current parent category ID. Default 0.
128  * @param int $parent        Optional. Parent ID to retrieve categories for. Default 0.
129  * @param int $level         Optional. Number of levels deep to display. Default 0.
130  * @param array $categories  Optional. Categories to include in the control. Default 0.
131  * @return bool|null False if no categories were found.
132  */
133 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
134         _deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' );
135         if (!$categories )
136                 $categories = get_categories( array('hide_empty' => 0) );
137
138         if ( $categories ) {
139                 foreach ( $categories as $category ) {
140                         if ( $currentcat != $category->term_id && $parent == $category->parent) {
141                                 $pad = str_repeat( '&#8211; ', $level );
142                                 $category->name = esc_html( $category->name );
143                                 echo "\n\t<option value='$category->term_id'";
144                                 if ( $currentparent == $category->term_id )
145                                         echo " selected='selected'";
146                                 echo ">$pad$category->name</option>";
147                                 wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
148                         }
149                 }
150         } else {
151                 return false;
152         }
153 }
154
155 /**
156  * Register a setting and its sanitization callback
157  *
158  * @since 2.7.0
159  * @deprecated 3.0.0 Use register_setting()
160  * @see register_setting()
161  *
162  * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
163  *      Default whitelisted option key names include "general," "discussion," and "reading," among others.
164  * @param string $option_name The name of an option to sanitize and save.
165  * @param callable $sanitize_callback A callback function that sanitizes the option's value.
166  */
167 function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
168         _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
169         register_setting( $option_group, $option_name, $sanitize_callback );
170 }
171
172 /**
173  * Unregister a setting
174  *
175  * @since 2.7.0
176  * @deprecated 3.0.0 Use unregister_setting()
177  * @see unregister_setting()
178  *
179  * @param string $option_group
180  * @param string $option_name
181  * @param callable $sanitize_callback
182  */
183 function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
184         _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
185         unregister_setting( $option_group, $option_name, $sanitize_callback );
186 }
187
188 /**
189  * Determines the language to use for CodePress syntax highlighting.
190  *
191  * @since 2.8.0
192  * @deprecated 3.0.0
193  *
194  * @param string $filename
195 **/
196 function codepress_get_lang( $filename ) {
197         _deprecated_function( __FUNCTION__, '3.0' );
198 }
199
200 /**
201  * Adds JavaScript required to make CodePress work on the theme/plugin editors.
202  *
203  * @since 2.8.0
204  * @deprecated 3.0.0
205 **/
206 function codepress_footer_js() {
207         _deprecated_function( __FUNCTION__, '3.0' );
208 }
209
210 /**
211  * Determine whether to use CodePress.
212  *
213  * @since 2.8.0
214  * @deprecated 3.0.0
215 **/
216 function use_codepress() {
217         _deprecated_function( __FUNCTION__, '3.0' );
218 }
219
220 /**
221  * Get all user IDs.
222  *
223  * @deprecated 3.1.0 Use get_users()
224  *
225  * @return array List of user IDs.
226  */
227 function get_author_user_ids() {
228         _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
229
230         global $wpdb;
231         if ( !is_multisite() )
232                 $level_key = $wpdb->get_blog_prefix() . 'user_level';
233         else
234                 $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
235
236         return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
237 }
238
239 /**
240  * Gets author users who can edit posts.
241  *
242  * @deprecated 3.1.0 Use get_users()
243  *
244  * @param int $user_id User ID.
245  * @return array|bool List of editable authors. False if no editable users.
246  */
247 function get_editable_authors( $user_id ) {
248         _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
249
250         global $wpdb;
251
252         $editable = get_editable_user_ids( $user_id );
253
254         if ( !$editable ) {
255                 return false;
256         } else {
257                 $editable = join(',', $editable);
258                 $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
259         }
260
261         return apply_filters('get_editable_authors', $authors);
262 }
263
264 /**
265  * Gets the IDs of any users who can edit posts.
266  *
267  * @deprecated 3.1.0 Use get_users()
268  *
269  * @param int $user_id User ID.
270  * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
271  * @return mixed
272  */
273 function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
274         _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
275
276         global $wpdb;
277
278         if ( ! $user = get_userdata( $user_id ) )
279                 return array();
280         $post_type_obj = get_post_type_object($post_type);
281
282         if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
283                 if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
284                         return array($user->ID);
285                 else
286                         return array();
287         }
288
289         if ( !is_multisite() )
290                 $level_key = $wpdb->get_blog_prefix() . 'user_level';
291         else
292                 $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
293
294         $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
295         if ( $exclude_zeros )
296                 $query .= " AND meta_value != '0'";
297
298         return $wpdb->get_col( $query );
299 }
300
301 /**
302  * Gets all users who are not authors.
303  *
304  * @deprecated 3.1.0 Use get_users()
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', false ) ) :
320 /**
321  * WordPress User Search class.
322  *
323  * @since 2.1.0
324  * @deprecated 3.1.0 Use WP_User_Query
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          * Prepares the user search query (legacy).
511          *
512          * @since 2.1.0
513          * @access public
514          */
515         public function prepare_query() {
516                 global $wpdb;
517                 $this->first_user = ($this->page - 1) * $this->users_per_page;
518
519                 $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
520                 $this->query_orderby = ' ORDER BY user_login';
521
522                 $search_sql = '';
523                 if ( $this->search_term ) {
524                         $searches = array();
525                         $search_sql = 'AND (';
526                         foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
527                                 $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
528                         $search_sql .= implode(' OR ', $searches);
529                         $search_sql .= ')';
530                 }
531
532                 $this->query_from = " FROM $wpdb->users";
533                 $this->query_where = " WHERE 1=1 $search_sql";
534
535                 if ( $this->role ) {
536                         $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
537                         $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
538                 } elseif ( is_multisite() ) {
539                         $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
540                         $this->query_from .= ", $wpdb->usermeta";
541                         $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
542                 }
543
544                 do_action_ref_array( 'pre_user_search', array( &$this ) );
545         }
546
547         /**
548          * Executes the user search query.
549          *
550          * @since 2.1.0
551          * @access public
552          */
553         public function query() {
554                 global $wpdb;
555
556                 $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
557
558                 if ( $this->results )
559                         $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
560                 else
561                         $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
562         }
563
564         /**
565          * Prepares variables for use in templates.
566          *
567          * @since 2.1.0
568          * @access public
569          */
570         function prepare_vars_for_template_usage() {}
571
572         /**
573          * Handles paging for the user search query.
574          *
575          * @since 2.1.0
576          * @access public
577          */
578         public function do_paging() {
579                 if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
580                         $args = array();
581                         if ( ! empty($this->search_term) )
582                                 $args['usersearch'] = urlencode($this->search_term);
583                         if ( ! empty($this->role) )
584                                 $args['role'] = urlencode($this->role);
585
586                         $this->paging_text = paginate_links( array(
587                                 'total' => ceil($this->total_users_for_query / $this->users_per_page),
588                                 'current' => $this->page,
589                                 'base' => 'users.php?%_%',
590                                 'format' => 'userspage=%#%',
591                                 'add_args' => $args
592                         ) );
593                         if ( $this->paging_text ) {
594                                 $this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
595                                         number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
596                                         number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
597                                         number_format_i18n( $this->total_users_for_query ),
598                                         $this->paging_text
599                                 );
600                         }
601                 }
602         }
603
604         /**
605          * Retrieves the user search query results.
606          *
607          * @since 2.1.0
608          * @access public
609          *
610          * @return array
611          */
612         public function get_results() {
613                 return (array) $this->results;
614         }
615
616         /**
617          * Displaying paging text.
618          *
619          * @see do_paging() Builds paging text.
620          *
621          * @since 2.1.0
622          * @access public
623          */
624         function page_links() {
625                 echo $this->paging_text;
626         }
627
628         /**
629          * Whether paging is enabled.
630          *
631          * @see do_paging() Builds paging text.
632          *
633          * @since 2.1.0
634          * @access public
635          *
636          * @return bool
637          */
638         function results_are_paged() {
639                 if ( $this->paging_text )
640                         return true;
641                 return false;
642         }
643
644         /**
645          * Whether there are search terms.
646          *
647          * @since 2.1.0
648          * @access public
649          *
650          * @return bool
651          */
652         function is_search() {
653                 if ( $this->search_term )
654                         return true;
655                 return false;
656         }
657 }
658 endif;
659
660 /**
661  * Retrieve editable posts from other users.
662  *
663  * @deprecated 3.1.0 Use get_posts()
664  * @see get_posts()
665  *
666  * @param int $user_id User ID to not retrieve posts from.
667  * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
668  * @return array List of posts from others.
669  */
670 function get_others_unpublished_posts($user_id, $type='any') {
671         _deprecated_function( __FUNCTION__, '3.1' );
672
673         global $wpdb;
674
675         $editable = get_editable_user_ids( $user_id );
676
677         if ( in_array($type, array('draft', 'pending')) )
678                 $type_sql = " post_status = '$type' ";
679         else
680                 $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
681
682         $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
683
684         if ( !$editable ) {
685                 $other_unpubs = '';
686         } else {
687                 $editable = join(',', $editable);
688                 $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) );
689         }
690
691         return apply_filters('get_others_drafts', $other_unpubs);
692 }
693
694 /**
695  * Retrieve drafts from other users.
696  *
697  * @deprecated 3.1.0 Use get_posts()
698  * @see get_posts()
699  *
700  * @param int $user_id User ID.
701  * @return array List of drafts from other users.
702  */
703 function get_others_drafts($user_id) {
704         _deprecated_function( __FUNCTION__, '3.1' );
705
706         return get_others_unpublished_posts($user_id, 'draft');
707 }
708
709 /**
710  * Retrieve pending review posts from other users.
711  *
712  * @deprecated 3.1.0 Use get_posts()
713  * @see get_posts()
714  *
715  * @param int $user_id User ID.
716  * @return array List of posts with pending review post type from other users.
717  */
718 function get_others_pending($user_id) {
719         _deprecated_function( __FUNCTION__, '3.1' );
720
721         return get_others_unpublished_posts($user_id, 'pending');
722 }
723
724 /**
725  * Output the QuickPress dashboard widget.
726  *
727  * @since 3.0.0
728  * @deprecated 3.2.0 Use wp_dashboard_quick_press()
729  * @see wp_dashboard_quick_press()
730  */
731 function wp_dashboard_quick_press_output() {
732         _deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' );
733         wp_dashboard_quick_press();
734 }
735
736 /**
737  * Outputs the TinyMCE editor.
738  *
739  * @since 2.7.0
740  * @deprecated 3.3.0 Use wp_editor()
741  * @see wp_editor()
742  *
743  * @staticvar int $num
744  */
745 function wp_tiny_mce( $teeny = false, $settings = false ) {
746         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
747
748         static $num = 1;
749
750         if ( ! class_exists( '_WP_Editors', false ) )
751                 require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
752
753         $editor_id = 'content' . $num++;
754
755         $set = array(
756                 'teeny' => $teeny,
757                 'tinymce' => $settings ? $settings : true,
758                 'quicktags' => false
759         );
760
761         $set = _WP_Editors::parse_settings($editor_id, $set);
762         _WP_Editors::editor_settings($editor_id, $set);
763 }
764
765 /**
766  * Preloads TinyMCE dialogs.
767  *
768  * @deprecated 3.3.0 Use wp_editor()
769  * @see wp_editor()
770  */
771 function wp_preload_dialogs() {
772         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
773 }
774
775 /**
776  * Prints TinyMCE editor JS.
777  *
778  * @deprecated 3.3.0 Use wp_editor()
779  * @see wp_editor()
780  */
781 function wp_print_editor_js() {
782         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
783 }
784
785 /**
786  * Handles quicktags.
787  *
788  * @deprecated 3.3.0 Use wp_editor()
789  * @see wp_editor()
790  */
791 function wp_quicktags() {
792         _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
793 }
794
795 /**
796  * Returns the screen layout options.
797  *
798  * @since 2.8.0
799  * @deprecated 3.3.0 WP_Screen::render_screen_layout()
800  * @see WP_Screen::render_screen_layout()
801  */
802 function screen_layout( $screen ) {
803         _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_layout()' );
804
805         $current_screen = get_current_screen();
806
807         if ( ! $current_screen )
808                 return '';
809
810         ob_start();
811         $current_screen->render_screen_layout();
812         return ob_get_clean();
813 }
814
815 /**
816  * Returns the screen's per-page options.
817  *
818  * @since 2.8.0
819  * @deprecated 3.3.0 Use WP_Screen::render_per_page_options()
820  * @see WP_Screen::render_per_page_options()
821  */
822 function screen_options( $screen ) {
823         _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_per_page_options()' );
824
825         $current_screen = get_current_screen();
826
827         if ( ! $current_screen )
828                 return '';
829
830         ob_start();
831         $current_screen->render_per_page_options();
832         return ob_get_clean();
833 }
834
835 /**
836  * Renders the screen's help.
837  *
838  * @since 2.7.0
839  * @deprecated 3.3.0 Use WP_Screen::render_screen_meta()
840  * @see WP_Screen::render_screen_meta()
841  */
842 function screen_meta( $screen ) {
843         $current_screen = get_current_screen();
844         $current_screen->render_screen_meta();
845 }
846
847 /**
848  * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
849  *
850  * @since 2.7.0
851  * @deprecated 3.2.0 Use WP_Admin_Bar
852  * @see WP_Admin_Bar
853  */
854 function favorite_actions() {
855         _deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' );
856 }
857
858 /**
859  * Handles uploading an image.
860  *
861  * @deprecated 3.3.0 Use wp_media_upload_handler()
862  * @see wp_media_upload_handler()
863  *
864  * @return null|string
865  */
866 function media_upload_image() {
867         _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
868         return wp_media_upload_handler();
869 }
870
871 /**
872  * Handles uploading an audio file.
873  *
874  * @deprecated 3.3.0 Use wp_media_upload_handler()
875  * @see wp_media_upload_handler()
876  *
877  * @return null|string
878  */
879 function media_upload_audio() {
880         _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
881         return wp_media_upload_handler();
882 }
883
884 /**
885  * Handles uploading a video file.
886  *
887  * @deprecated 3.3.0 Use wp_media_upload_handler()
888  * @see wp_media_upload_handler()
889  *
890  * @return null|string
891  */
892 function media_upload_video() {
893         _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
894         return wp_media_upload_handler();
895 }
896
897 /**
898  * Handles uploading a generic file.
899  *
900  * @deprecated 3.3.0 Use wp_media_upload_handler()
901  * @see wp_media_upload_handler()
902  *
903  * @return null|string
904  */
905 function media_upload_file() {
906         _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
907         return wp_media_upload_handler();
908 }
909
910 /**
911  * Handles retrieving the insert-from-URL form for an image.
912  *
913  * @deprecated 3.3.0 Use wp_media_insert_url_form()
914  * @see wp_media_insert_url_form()
915  *
916  * @return string
917  */
918 function type_url_form_image() {
919         _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('image')" );
920         return wp_media_insert_url_form( 'image' );
921 }
922
923 /**
924  * Handles retrieving the insert-from-URL form for an audio file.
925  *
926  * @deprecated 3.3.0 Use wp_media_insert_url_form()
927  * @see wp_media_insert_url_form()
928  *
929  * @return string
930  */
931 function type_url_form_audio() {
932         _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('audio')" );
933         return wp_media_insert_url_form( 'audio' );
934 }
935
936 /**
937  * Handles retrieving the insert-from-URL form for a video file.
938  *
939  * @deprecated 3.3.0 Use wp_media_insert_url_form()
940  * @see wp_media_insert_url_form()
941  *
942  * @return string
943  */
944 function type_url_form_video() {
945         _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('video')" );
946         return wp_media_insert_url_form( 'video' );
947 }
948
949 /**
950  * Handles retrieving the insert-from-URL form for a generic file.
951  *
952  * @deprecated 3.3.0 Use wp_media_insert_url_form()
953  * @see wp_media_insert_url_form()
954  *
955  * @return string
956  */
957 function type_url_form_file() {
958         _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('file')" );
959         return wp_media_insert_url_form( 'file' );
960 }
961
962 /**
963  * Add contextual help text for a page.
964  *
965  * Creates an 'Overview' help tab.
966  *
967  * @since 2.7.0
968  * @deprecated 3.3.0 Use WP_Screen::add_help_tab()
969  * @see WP_Screen::add_help_tab()
970  *
971  * @param string    $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
972  * @param string    $help   The content of an 'Overview' help tab.
973  */
974 function add_contextual_help( $screen, $help ) {
975         _deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' );
976
977         if ( is_string( $screen ) )
978                 $screen = convert_to_screen( $screen );
979
980         WP_Screen::add_old_compat_help( $screen, $help );
981 }
982
983 /**
984  * Get the allowed themes for the current blog.
985  *
986  * @since 3.0.0
987  * @deprecated 3.4.0 Use wp_get_themes()
988  * @see wp_get_themes()
989  *
990  * @return array $themes Array of allowed themes.
991  */
992 function get_allowed_themes() {
993         _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )" );
994
995         $themes = wp_get_themes( array( 'allowed' => true ) );
996
997         $wp_themes = array();
998         foreach ( $themes as $theme ) {
999                 $wp_themes[ $theme->get('Name') ] = $theme;
1000         }
1001
1002         return $wp_themes;
1003 }
1004
1005 /**
1006  * Retrieves a list of broken themes.
1007  *
1008  * @since 1.5.0
1009  * @deprecated 3.4.0 Use wp_get_themes()
1010  * @see wp_get_themes()
1011  *
1012  * @return array
1013  */
1014 function get_broken_themes() {
1015         _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )" );
1016
1017         $themes = wp_get_themes( array( 'errors' => true ) );
1018         $broken = array();
1019         foreach ( $themes as $theme ) {
1020                 $name = $theme->get('Name');
1021                 $broken[ $name ] = array(
1022                         'Name' => $name,
1023                         'Title' => $name,
1024                         'Description' => $theme->errors()->get_error_message(),
1025                 );
1026         }
1027         return $broken;
1028 }
1029
1030 /**
1031  * Retrieves information on the current active theme.
1032  *
1033  * @since 2.0.0
1034  * @deprecated 3.4.0 Use wp_get_theme()
1035  * @see wp_get_theme()
1036  *
1037  * @return WP_Theme
1038  */
1039 function current_theme_info() {
1040         _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
1041
1042         return wp_get_theme();
1043 }
1044
1045 /**
1046  * This was once used to display an 'Insert into Post' button.
1047  *
1048  * Now it is deprecated and stubbed.
1049  *
1050  * @deprecated 3.5.0
1051  */
1052 function _insert_into_post_button( $type ) {
1053         _deprecated_function( __FUNCTION__, '3.5' );
1054 }
1055
1056 /**
1057  * This was once used to display a media button.
1058  *
1059  * Now it is deprecated and stubbed.
1060  *
1061  * @deprecated 3.5.0
1062  */
1063 function _media_button($title, $icon, $type, $id) {
1064         _deprecated_function( __FUNCTION__, '3.5' );
1065 }
1066
1067 /**
1068  * Gets an existing post and format it for editing.
1069  *
1070  * @since 2.0.0
1071  * @deprecated 3.5.0 Use get_post()
1072  * @see get_post()
1073  *
1074  * @param int $id
1075  * @return object
1076  */
1077 function get_post_to_edit( $id ) {
1078         _deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
1079
1080         return get_post( $id, OBJECT, 'edit' );
1081 }
1082
1083 /**
1084  * Gets the default page information to use.
1085  *
1086  * @since 2.5.0
1087  * @deprecated 3.5.0 Use get_default_post_to_edit()
1088  * @see get_default_post_to_edit()
1089  *
1090  * @return WP_Post Post object containing all the default post data as attributes
1091  */
1092 function get_default_page_to_edit() {
1093         _deprecated_function( __FUNCTION__, '3.5', "get_default_post_to_edit( 'page' )" );
1094
1095         $page = get_default_post_to_edit();
1096         $page->post_type = 'page';
1097         return $page;
1098 }
1099
1100 /**
1101  * This was once used to create a thumbnail from an Image given a maximum side size.
1102  *
1103  * @since 1.2.0
1104  * @deprecated 3.5.0 Use image_resize()
1105  * @see image_resize()
1106  *
1107  * @param mixed $file Filename of the original image, Or attachment id.
1108  * @param int $max_side Maximum length of a single side for the thumbnail.
1109  * @param mixed $deprecated Never used.
1110  * @return string Thumbnail path on success, Error string on failure.
1111  */
1112 function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
1113         _deprecated_function( __FUNCTION__, '3.5', 'image_resize()' );
1114         return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
1115 }
1116
1117 /**
1118  * This was once used to display a metabox for the nav menu theme locations.
1119  *
1120  * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
1121  *
1122  * @since 3.0.0
1123  * @deprecated 3.6.0
1124  */
1125 function wp_nav_menu_locations_meta_box() {
1126         _deprecated_function( __FUNCTION__, '3.6' );
1127 }
1128
1129 /**
1130  * This was once used to kick-off the Core Updater.
1131  *
1132  * Deprecated in favor of instantating a Core_Upgrader instance directly,
1133  * and calling the 'upgrade' method.
1134  *
1135  * @since 2.7.0
1136  * @deprecated 3.7.0 Use Core_Upgrader
1137  * @see Core_Upgrader
1138  */
1139 function wp_update_core($current, $feedback = '') {
1140         _deprecated_function( __FUNCTION__, '3.7', 'new Core_Upgrader();' );
1141
1142         if ( !empty($feedback) )
1143                 add_filter('update_feedback', $feedback);
1144
1145         include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1146         $upgrader = new Core_Upgrader();
1147         return $upgrader->upgrade($current);
1148
1149 }
1150
1151 /**
1152  * This was once used to kick-off the Plugin Updater.
1153  *
1154  * Deprecated in favor of instantating a Plugin_Upgrader instance directly,
1155  * and calling the 'upgrade' method.
1156  * Unused since 2.8.0.
1157  *
1158  * @since 2.5.0
1159  * @deprecated 3.7.0 Use Plugin_Upgrader
1160  * @see Plugin_Upgrader
1161  */
1162 function wp_update_plugin($plugin, $feedback = '') {
1163         _deprecated_function( __FUNCTION__, '3.7', 'new Plugin_Upgrader();' );
1164
1165         if ( !empty($feedback) )
1166                 add_filter('update_feedback', $feedback);
1167
1168         include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1169         $upgrader = new Plugin_Upgrader();
1170         return $upgrader->upgrade($plugin);
1171 }
1172
1173 /**
1174  * This was once used to kick-off the Theme Updater.
1175  *
1176  * Deprecated in favor of instantating a Theme_Upgrader instance directly,
1177  * and calling the 'upgrade' method.
1178  * Unused since 2.8.0.
1179  *
1180  * @since 2.7.0
1181  * @deprecated 3.7.0 Use Theme_Upgrader
1182  * @see Theme_Upgrader
1183  */
1184 function wp_update_theme($theme, $feedback = '') {
1185         _deprecated_function( __FUNCTION__, '3.7', 'new Theme_Upgrader();' );
1186
1187         if ( !empty($feedback) )
1188                 add_filter('update_feedback', $feedback);
1189
1190         include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1191         $upgrader = new Theme_Upgrader();
1192         return $upgrader->upgrade($theme);
1193 }
1194
1195 /**
1196  * This was once used to display attachment links. Now it is deprecated and stubbed.
1197  *
1198  * @since 2.0.0
1199  * @deprecated 3.7.0
1200  *
1201  * @param int|bool $id
1202  */
1203 function the_attachment_links( $id = false ) {
1204         _deprecated_function( __FUNCTION__, '3.7' );
1205 }
1206
1207 /**
1208  * Displays a screen icon.
1209  *
1210  * @since 2.7.0
1211  * @since 3.8.0 Screen icons are no longer used in WordPress. This function no longer produces output.
1212  * @deprecated 3.8.0 Use get_screen_icon()
1213  * @see get_screen_icon()
1214  */
1215 function screen_icon() {
1216         echo get_screen_icon();
1217 }
1218
1219 /**
1220  * Retrieves the screen icon (no longer used in 3.8+).
1221  *
1222  * @deprecated 3.8.0
1223  *
1224  * @return string
1225  */
1226 function get_screen_icon() {
1227         return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
1228 }
1229
1230 /**
1231  * Deprecated dashboard widget controls.
1232  *
1233  * @since 2.5.0
1234  * @deprecated 3.8.0
1235  */
1236 function wp_dashboard_incoming_links_output() {}
1237
1238 /**
1239  * Deprecated dashboard secondary output.
1240  *
1241  * @deprecated 3.8.0
1242  */
1243 function wp_dashboard_secondary_output() {}
1244
1245 /**
1246  * Deprecated dashboard widget controls.
1247  *
1248  * @since 2.7.0
1249  * @deprecated 3.8.0
1250  */
1251 function wp_dashboard_incoming_links() {}
1252
1253 /**
1254  * Deprecated dashboard incoming links control.
1255  *
1256  * @deprecated 3.8.0
1257  */
1258 function wp_dashboard_incoming_links_control() {}
1259
1260 /**
1261  * Deprecated dashboard plugins control.
1262  *
1263  * @deprecated 3.8.0
1264  */
1265 function wp_dashboard_plugins() {}
1266
1267 /**
1268  * Deprecated dashboard primary control.
1269  *
1270  * @deprecated 3.8.0
1271  */
1272 function wp_dashboard_primary_control() {}
1273
1274 /**
1275  * Deprecated dashboard recent comments control.
1276  *
1277  * @deprecated 3.8.0
1278  */
1279 function wp_dashboard_recent_comments_control() {}
1280
1281 /**
1282  * Deprecated dashboard secondary section.
1283  *
1284  * @deprecated 3.8.0
1285  */
1286 function wp_dashboard_secondary() {}
1287
1288 /**
1289  * Deprecated dashboard secondary control.
1290  *
1291  * @deprecated 3.8.0
1292  */
1293 function wp_dashboard_secondary_control() {}
1294
1295 /**
1296  * This was once used to move child posts to a new parent.
1297  *
1298  * @since 2.3.0
1299  * @deprecated 3.9.0
1300  * @access private
1301  *
1302  * @param int $old_ID
1303  * @param int $new_ID
1304  */
1305 function _relocate_children( $old_ID, $new_ID ) {
1306         _deprecated_function( __FUNCTION__, '3.9' );
1307 }