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