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