Issues (4967)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/wp-admin/includes/deprecated.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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.0', '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.0' );
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.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.0', '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.0', '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.0', '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.0' );
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.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.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.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.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.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.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 View Code Duplication
function get_author_user_ids() {
228
	_deprecated_function( __FUNCTION__, '3.1.0', '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.0', '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. Whether to exclude zeroes. Default true.
271
 * @return array Array of editable user IDs, empty array otherwise.
272
 */
273
function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
274
	_deprecated_function( __FUNCTION__, '3.1.0', '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 View Code Duplication
function get_nonauthor_user_ids() {
307
	_deprecated_function( __FUNCTION__, '3.1.0', '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.0', '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
 * Retrieves editable posts from other users.
662
 *
663
 * @since 2.3.0
664
 * @deprecated 3.1.0 Use get_posts()
665
 * @see get_posts()
666
 *
667
 * @param int    $user_id User ID to not retrieve posts from.
668
 * @param string $type    Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all).
669
 *                        Default 'any'.
670
 * @return array List of posts from others.
671
 */
672
function get_others_unpublished_posts( $user_id, $type = 'any' ) {
673
	_deprecated_function( __FUNCTION__, '3.1.0' );
674
675
	global $wpdb;
676
677
	$editable = get_editable_user_ids( $user_id );
678
679
	if ( in_array($type, array('draft', 'pending')) )
680
		$type_sql = " post_status = '$type' ";
681
	else
682
		$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
683
684
	$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
685
686
	if ( !$editable ) {
687
		$other_unpubs = '';
688
	} else {
689
		$editable = join(',', $editable);
690
		$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) );
691
	}
692
693
	return apply_filters('get_others_drafts', $other_unpubs);
694
}
695
696
/**
697
 * Retrieve drafts from other users.
698
 *
699
 * @deprecated 3.1.0 Use get_posts()
700
 * @see get_posts()
701
 *
702
 * @param int $user_id User ID.
703
 * @return array List of drafts from other users.
704
 */
705
function get_others_drafts($user_id) {
706
	_deprecated_function( __FUNCTION__, '3.1.0' );
707
708
	return get_others_unpublished_posts($user_id, 'draft');
709
}
710
711
/**
712
 * Retrieve pending review posts from other users.
713
 *
714
 * @deprecated 3.1.0 Use get_posts()
715
 * @see get_posts()
716
 *
717
 * @param int $user_id User ID.
718
 * @return array List of posts with pending review post type from other users.
719
 */
720
function get_others_pending($user_id) {
721
	_deprecated_function( __FUNCTION__, '3.1.0' );
722
723
	return get_others_unpublished_posts($user_id, 'pending');
724
}
725
726
/**
727
 * Output the QuickPress dashboard widget.
728
 *
729
 * @since 3.0.0
730
 * @deprecated 3.2.0 Use wp_dashboard_quick_press()
731
 * @see wp_dashboard_quick_press()
732
 */
733
function wp_dashboard_quick_press_output() {
734
	_deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' );
735
	wp_dashboard_quick_press();
736
}
737
738
/**
739
 * Outputs the TinyMCE editor.
740
 *
741
 * @since 2.7.0
742
 * @deprecated 3.3.0 Use wp_editor()
743
 * @see wp_editor()
744
 *
745
 * @staticvar int $num
746
 */
747
function wp_tiny_mce( $teeny = false, $settings = false ) {
748
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
749
750
	static $num = 1;
751
752
	if ( ! class_exists( '_WP_Editors', false ) )
753
		require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
754
755
	$editor_id = 'content' . $num++;
756
757
	$set = array(
758
		'teeny' => $teeny,
759
		'tinymce' => $settings ? $settings : true,
760
		'quicktags' => false
761
	);
762
763
	$set = _WP_Editors::parse_settings($editor_id, $set);
764
	_WP_Editors::editor_settings($editor_id, $set);
765
}
766
767
/**
768
 * Preloads TinyMCE dialogs.
769
 *
770
 * @deprecated 3.3.0 Use wp_editor()
771
 * @see wp_editor()
772
 */
773
function wp_preload_dialogs() {
774
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
775
}
776
777
/**
778
 * Prints TinyMCE editor JS.
779
 *
780
 * @deprecated 3.3.0 Use wp_editor()
781
 * @see wp_editor()
782
 */
783
function wp_print_editor_js() {
784
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
785
}
786
787
/**
788
 * Handles quicktags.
789
 *
790
 * @deprecated 3.3.0 Use wp_editor()
791
 * @see wp_editor()
792
 */
793
function wp_quicktags() {
794
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
795
}
796
797
/**
798
 * Returns the screen layout options.
799
 *
800
 * @since 2.8.0
801
 * @deprecated 3.3.0 WP_Screen::render_screen_layout()
802
 * @see WP_Screen::render_screen_layout()
803
 */
804 View Code Duplication
function screen_layout( $screen ) {
805
	_deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );
806
807
	$current_screen = get_current_screen();
808
809
	if ( ! $current_screen )
810
		return '';
811
812
	ob_start();
813
	$current_screen->render_screen_layout();
814
	return ob_get_clean();
815
}
816
817
/**
818
 * Returns the screen's per-page options.
819
 *
820
 * @since 2.8.0
821
 * @deprecated 3.3.0 Use WP_Screen::render_per_page_options()
822
 * @see WP_Screen::render_per_page_options()
823
 */
824 View Code Duplication
function screen_options( $screen ) {
825
	_deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
826
827
	$current_screen = get_current_screen();
828
829
	if ( ! $current_screen )
830
		return '';
831
832
	ob_start();
833
	$current_screen->render_per_page_options();
834
	return ob_get_clean();
835
}
836
837
/**
838
 * Renders the screen's help.
839
 *
840
 * @since 2.7.0
841
 * @deprecated 3.3.0 Use WP_Screen::render_screen_meta()
842
 * @see WP_Screen::render_screen_meta()
843
 */
844
function screen_meta( $screen ) {
845
	$current_screen = get_current_screen();
846
	$current_screen->render_screen_meta();
847
}
848
849
/**
850
 * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
851
 *
852
 * @since 2.7.0
853
 * @deprecated 3.2.0 Use WP_Admin_Bar
854
 * @see WP_Admin_Bar
855
 */
856
function favorite_actions() {
857
	_deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' );
858
}
859
860
/**
861
 * Handles uploading an image.
862
 *
863
 * @deprecated 3.3.0 Use wp_media_upload_handler()
864
 * @see wp_media_upload_handler()
865
 *
866
 * @return null|string
867
 */
868
function media_upload_image() {
869
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
870
	return wp_media_upload_handler();
871
}
872
873
/**
874
 * Handles uploading an audio file.
875
 *
876
 * @deprecated 3.3.0 Use wp_media_upload_handler()
877
 * @see wp_media_upload_handler()
878
 *
879
 * @return null|string
880
 */
881
function media_upload_audio() {
882
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
883
	return wp_media_upload_handler();
884
}
885
886
/**
887
 * Handles uploading a video file.
888
 *
889
 * @deprecated 3.3.0 Use wp_media_upload_handler()
890
 * @see wp_media_upload_handler()
891
 *
892
 * @return null|string
893
 */
894
function media_upload_video() {
895
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
896
	return wp_media_upload_handler();
897
}
898
899
/**
900
 * Handles uploading a generic file.
901
 *
902
 * @deprecated 3.3.0 Use wp_media_upload_handler()
903
 * @see wp_media_upload_handler()
904
 *
905
 * @return null|string
906
 */
907
function media_upload_file() {
908
	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
909
	return wp_media_upload_handler();
910
}
911
912
/**
913
 * Handles retrieving the insert-from-URL form for an image.
914
 *
915
 * @deprecated 3.3.0 Use wp_media_insert_url_form()
916
 * @see wp_media_insert_url_form()
917
 *
918
 * @return string
919
 */
920
function type_url_form_image() {
921
	_deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" );
922
	return wp_media_insert_url_form( 'image' );
923
}
924
925
/**
926
 * Handles retrieving the insert-from-URL form for an audio file.
927
 *
928
 * @deprecated 3.3.0 Use wp_media_insert_url_form()
929
 * @see wp_media_insert_url_form()
930
 *
931
 * @return string
932
 */
933
function type_url_form_audio() {
934
	_deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" );
935
	return wp_media_insert_url_form( 'audio' );
936
}
937
938
/**
939
 * Handles retrieving the insert-from-URL form for a video file.
940
 *
941
 * @deprecated 3.3.0 Use wp_media_insert_url_form()
942
 * @see wp_media_insert_url_form()
943
 *
944
 * @return string
945
 */
946
function type_url_form_video() {
947
	_deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" );
948
	return wp_media_insert_url_form( 'video' );
949
}
950
951
/**
952
 * Handles retrieving the insert-from-URL form for a generic file.
953
 *
954
 * @deprecated 3.3.0 Use wp_media_insert_url_form()
955
 * @see wp_media_insert_url_form()
956
 *
957
 * @return string
958
 */
959
function type_url_form_file() {
960
	_deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" );
961
	return wp_media_insert_url_form( 'file' );
962
}
963
964
/**
965
 * Add contextual help text for a page.
966
 *
967
 * Creates an 'Overview' help tab.
968
 *
969
 * @since 2.7.0
970
 * @deprecated 3.3.0 Use WP_Screen::add_help_tab()
971
 * @see WP_Screen::add_help_tab()
972
 *
973
 * @param string    $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
974
 * @param string    $help   The content of an 'Overview' help tab.
975
 */
976
function add_contextual_help( $screen, $help ) {
977
	_deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
978
979
	if ( is_string( $screen ) )
980
		$screen = convert_to_screen( $screen );
981
982
	WP_Screen::add_old_compat_help( $screen, $help );
983
}
984
985
/**
986
 * Get the allowed themes for the current site.
987
 *
988
 * @since 3.0.0
989
 * @deprecated 3.4.0 Use wp_get_themes()
990
 * @see wp_get_themes()
991
 *
992
 * @return array $themes Array of allowed themes.
993
 */
994
function get_allowed_themes() {
995
	_deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );
996
997
	$themes = wp_get_themes( array( 'allowed' => true ) );
998
999
	$wp_themes = array();
1000
	foreach ( $themes as $theme ) {
1001
		$wp_themes[ $theme->get('Name') ] = $theme;
1002
	}
1003
1004
	return $wp_themes;
1005
}
1006
1007
/**
1008
 * Retrieves a list of broken themes.
1009
 *
1010
 * @since 1.5.0
1011
 * @deprecated 3.4.0 Use wp_get_themes()
1012
 * @see wp_get_themes()
1013
 *
1014
 * @return array
1015
 */
1016
function get_broken_themes() {
1017
	_deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" );
1018
1019
	$themes = wp_get_themes( array( 'errors' => true ) );
1020
	$broken = array();
1021
	foreach ( $themes as $theme ) {
1022
		$name = $theme->get('Name');
1023
		$broken[ $name ] = array(
1024
			'Name' => $name,
1025
			'Title' => $name,
1026
			'Description' => $theme->errors()->get_error_message(),
1027
		);
1028
	}
1029
	return $broken;
1030
}
1031
1032
/**
1033
 * Retrieves information on the current active theme.
1034
 *
1035
 * @since 2.0.0
1036
 * @deprecated 3.4.0 Use wp_get_theme()
1037
 * @see wp_get_theme()
1038
 *
1039
 * @return WP_Theme
1040
 */
1041
function current_theme_info() {
1042
	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
1043
1044
	return wp_get_theme();
1045
}
1046
1047
/**
1048
 * This was once used to display an 'Insert into Post' button.
1049
 *
1050
 * Now it is deprecated and stubbed.
1051
 *
1052
 * @deprecated 3.5.0
1053
 */
1054
function _insert_into_post_button( $type ) {
1055
	_deprecated_function( __FUNCTION__, '3.5.0' );
1056
}
1057
1058
/**
1059
 * This was once used to display a media button.
1060
 *
1061
 * Now it is deprecated and stubbed.
1062
 *
1063
 * @deprecated 3.5.0
1064
 */
1065
function _media_button($title, $icon, $type, $id) {
1066
	_deprecated_function( __FUNCTION__, '3.5.0' );
1067
}
1068
1069
/**
1070
 * Gets an existing post and format it for editing.
1071
 *
1072
 * @since 2.0.0
1073
 * @deprecated 3.5.0 Use get_post()
1074
 * @see get_post()
1075
 *
1076
 * @param int $id
1077
 * @return object
1078
 */
1079
function get_post_to_edit( $id ) {
1080
	_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
1081
1082
	return get_post( $id, OBJECT, 'edit' );
1083
}
1084
1085
/**
1086
 * Gets the default page information to use.
1087
 *
1088
 * @since 2.5.0
1089
 * @deprecated 3.5.0 Use get_default_post_to_edit()
1090
 * @see get_default_post_to_edit()
1091
 *
1092
 * @return WP_Post Post object containing all the default post data as attributes
1093
 */
1094
function get_default_page_to_edit() {
1095
	_deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" );
1096
1097
	$page = get_default_post_to_edit();
1098
	$page->post_type = 'page';
1099
	return $page;
1100
}
1101
1102
/**
1103
 * This was once used to create a thumbnail from an Image given a maximum side size.
1104
 *
1105
 * @since 1.2.0
1106
 * @deprecated 3.5.0 Use image_resize()
1107
 * @see image_resize()
1108
 *
1109
 * @param mixed $file Filename of the original image, Or attachment id.
1110
 * @param int $max_side Maximum length of a single side for the thumbnail.
1111
 * @param mixed $deprecated Never used.
1112
 * @return string Thumbnail path on success, Error string on failure.
1113
 */
1114
function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
1115
	_deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' );
1116
	return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
1117
}
1118
1119
/**
1120
 * This was once used to display a meta box for the nav menu theme locations.
1121
 *
1122
 * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
1123
 *
1124
 * @since 3.0.0
1125
 * @deprecated 3.6.0
1126
 */
1127
function wp_nav_menu_locations_meta_box() {
1128
	_deprecated_function( __FUNCTION__, '3.6.0' );
1129
}
1130
1131
/**
1132
 * This was once used to kick-off the Core Updater.
1133
 *
1134
 * Deprecated in favor of instantating a Core_Upgrader instance directly,
1135
 * and calling the 'upgrade' method.
1136
 *
1137
 * @since 2.7.0
1138
 * @deprecated 3.7.0 Use Core_Upgrader
1139
 * @see Core_Upgrader
1140
 */
1141 View Code Duplication
function wp_update_core($current, $feedback = '') {
1142
	_deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' );
1143
1144
	if ( !empty($feedback) )
1145
		add_filter('update_feedback', $feedback);
1146
1147
	include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1148
	$upgrader = new Core_Upgrader();
1149
	return $upgrader->upgrade($current);
1150
1151
}
1152
1153
/**
1154
 * This was once used to kick-off the Plugin Updater.
1155
 *
1156
 * Deprecated in favor of instantating a Plugin_Upgrader instance directly,
1157
 * and calling the 'upgrade' method.
1158
 * Unused since 2.8.0.
1159
 *
1160
 * @since 2.5.0
1161
 * @deprecated 3.7.0 Use Plugin_Upgrader
1162
 * @see Plugin_Upgrader
1163
 */
1164 View Code Duplication
function wp_update_plugin($plugin, $feedback = '') {
1165
	_deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' );
1166
1167
	if ( !empty($feedback) )
1168
		add_filter('update_feedback', $feedback);
1169
1170
	include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1171
	$upgrader = new Plugin_Upgrader();
1172
	return $upgrader->upgrade($plugin);
1173
}
1174
1175
/**
1176
 * This was once used to kick-off the Theme Updater.
1177
 *
1178
 * Deprecated in favor of instantiating a Theme_Upgrader instance directly,
1179
 * and calling the 'upgrade' method.
1180
 * Unused since 2.8.0.
1181
 *
1182
 * @since 2.7.0
1183
 * @deprecated 3.7.0 Use Theme_Upgrader
1184
 * @see Theme_Upgrader
1185
 */
1186 View Code Duplication
function wp_update_theme($theme, $feedback = '') {
1187
	_deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' );
1188
1189
	if ( !empty($feedback) )
1190
		add_filter('update_feedback', $feedback);
1191
1192
	include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1193
	$upgrader = new Theme_Upgrader();
1194
	return $upgrader->upgrade($theme);
1195
}
1196
1197
/**
1198
 * This was once used to display attachment links. Now it is deprecated and stubbed.
1199
 *
1200
 * @since 2.0.0
1201
 * @deprecated 3.7.0
1202
 *
1203
 * @param int|bool $id
1204
 */
1205
function the_attachment_links( $id = false ) {
1206
	_deprecated_function( __FUNCTION__, '3.7.0' );
1207
}
1208
1209
/**
1210
 * Displays a screen icon.
1211
 *
1212
 * @since 2.7.0
1213
 * @since 3.8.0 Screen icons are no longer used in WordPress. This function no longer produces output.
1214
 * @deprecated 3.8.0 Use get_screen_icon()
1215
 * @see get_screen_icon()
1216
 */
1217
function screen_icon() {
1218
	echo get_screen_icon();
1219
}
1220
1221
/**
1222
 * Retrieves the screen icon (no longer used in 3.8+).
1223
 *
1224
 * @deprecated 3.8.0
1225
 *
1226
 * @return string
1227
 */
1228
function get_screen_icon() {
1229
	return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
1230
}
1231
1232
/**
1233
 * Deprecated dashboard widget controls.
1234
 *
1235
 * @since 2.5.0
1236
 * @deprecated 3.8.0
1237
 */
1238
function wp_dashboard_incoming_links_output() {}
1239
1240
/**
1241
 * Deprecated dashboard secondary output.
1242
 *
1243
 * @deprecated 3.8.0
1244
 */
1245
function wp_dashboard_secondary_output() {}
1246
1247
/**
1248
 * Deprecated dashboard widget controls.
1249
 *
1250
 * @since 2.7.0
1251
 * @deprecated 3.8.0
1252
 */
1253
function wp_dashboard_incoming_links() {}
1254
1255
/**
1256
 * Deprecated dashboard incoming links control.
1257
 *
1258
 * @deprecated 3.8.0
1259
 */
1260
function wp_dashboard_incoming_links_control() {}
1261
1262
/**
1263
 * Deprecated dashboard plugins control.
1264
 *
1265
 * @deprecated 3.8.0
1266
 */
1267
function wp_dashboard_plugins() {}
1268
1269
/**
1270
 * Deprecated dashboard primary control.
1271
 *
1272
 * @deprecated 3.8.0
1273
 */
1274
function wp_dashboard_primary_control() {}
1275
1276
/**
1277
 * Deprecated dashboard recent comments control.
1278
 *
1279
 * @deprecated 3.8.0
1280
 */
1281
function wp_dashboard_recent_comments_control() {}
1282
1283
/**
1284
 * Deprecated dashboard secondary section.
1285
 *
1286
 * @deprecated 3.8.0
1287
 */
1288
function wp_dashboard_secondary() {}
1289
1290
/**
1291
 * Deprecated dashboard secondary control.
1292
 *
1293
 * @deprecated 3.8.0
1294
 */
1295
function wp_dashboard_secondary_control() {}
1296
1297
/**
1298
 * Display plugins text for the WordPress news widget.
1299
 *
1300
 * @since 2.5.0
1301
 * @deprecated 4.8.0
1302
 *
1303
 * @param string $rss  The RSS feed URL.
1304
 * @param array  $args Array of arguments for this RSS feed.
1305
 */
1306
function wp_dashboard_plugins_output( $rss, $args = array() ) {
1307
	_deprecated_function( __FUNCTION__, '4.8.0' );
1308
1309
	// Plugin feeds plus link to install them
1310
	$popular = fetch_feed( $args['url']['popular'] );
1311
1312
	if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
1313
		$plugin_slugs = array_keys( get_plugins() );
1314
		set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
1315
	}
1316
1317
	echo '<ul>';
1318
1319
	foreach ( array( $popular ) as $feed ) {
1320
		if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1321
			continue;
1322
1323
		$items = $feed->get_items(0, 5);
1324
1325
		// Pick a random, non-installed plugin
1326
		while ( true ) {
1327
			// Abort this foreach loop iteration if there's no plugins left of this type
1328
			if ( 0 == count($items) )
1329
				continue 2;
1330
1331
			$item_key = array_rand($items);
1332
			$item = $items[$item_key];
1333
1334
			list($link, $frag) = explode( '#', $item->get_link() );
1335
1336
			$link = esc_url($link);
1337
			if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1338
				$slug = $matches[1];
1339
			else {
1340
				unset( $items[$item_key] );
1341
				continue;
1342
			}
1343
1344
			// Is this random plugin's slug already installed? If so, try again.
1345
			reset( $plugin_slugs );
1346
			foreach ( $plugin_slugs as $plugin_slug ) {
1347
				if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
1348
					unset( $items[$item_key] );
1349
					continue 2;
1350
				}
1351
			}
1352
1353
			// If we get to this point, then the random plugin isn't installed and we can stop the while().
1354
			break;
1355
		}
1356
1357
		// Eliminate some common badly formed plugin descriptions
1358
		while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
1359
			unset($items[$item_key]);
1360
1361
		if ( !isset($items[$item_key]) )
1362
			continue;
1363
1364
		$raw_title = $item->get_title();
1365
1366
		$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
1367
		echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
1368
			'&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
1369
			/* translators: %s: plugin name */
1370
			esc_attr( sprintf( __( 'Install %s' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
1371
1372
		$feed->__destruct();
1373
		unset( $feed );
1374
	}
1375
1376
	echo '</ul>';
1377
}
1378
1379
/**
1380
 * This was once used to move child posts to a new parent.
1381
 *
1382
 * @since 2.3.0
1383
 * @deprecated 3.9.0
1384
 * @access private
1385
 *
1386
 * @param int $old_ID
1387
 * @param int $new_ID
1388
 */
1389
function _relocate_children( $old_ID, $new_ID ) {
1390
	_deprecated_function( __FUNCTION__, '3.9.0' );
1391
}
1392
1393
/**
1394
 * Add a top-level menu page in the 'objects' section.
1395
 *
1396
 * This function takes a capability which will be used to determine whether
1397
 * or not a page is included in the menu.
1398
 *
1399
 * The function which is hooked in to handle the output of the page must check
1400
 * that the user has the required capability as well.
1401
 *
1402
 * @since 2.7.0
1403
 *
1404
 * @deprecated 4.5.0 Use add_menu_page()
1405
 * @see add_menu_page()
1406
 * @global int $_wp_last_object_menu
1407
 *
1408
 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
1409
 * @param string   $menu_title The text to be used for the menu.
1410
 * @param string   $capability The capability required for this menu to be displayed to the user.
1411
 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
1412
 * @param callable $function   The function to be called to output the content for this page.
1413
 * @param string   $icon_url   The url to the icon to be used for this menu.
1414
 * @return string The resulting page's hook_suffix.
1415
 */
1416 View Code Duplication
function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1417
	_deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
1418
1419
	global $_wp_last_object_menu;
1420
1421
	$_wp_last_object_menu++;
1422
1423
	return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu);
1424
}
1425
1426
/**
1427
 * Add a top-level menu page in the 'utility' section.
1428
 *
1429
 * This function takes a capability which will be used to determine whether
1430
 * or not a page is included in the menu.
1431
 *
1432
 * The function which is hooked in to handle the output of the page must check
1433
 * that the user has the required capability as well.
1434
 *
1435
 * @since 2.7.0
1436
 *
1437
 * @deprecated 4.5.0 Use add_menu_page()
1438
 * @see add_menu_page()
1439
 * @global int $_wp_last_utility_menu
1440
 *
1441
 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
1442
 * @param string   $menu_title The text to be used for the menu.
1443
 * @param string   $capability The capability required for this menu to be displayed to the user.
1444
 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
1445
 * @param callable $function   The function to be called to output the content for this page.
1446
 * @param string   $icon_url   The url to the icon to be used for this menu.
1447
 * @return string The resulting page's hook_suffix.
1448
 */
1449 View Code Duplication
function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1450
	_deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
1451
1452
	global $_wp_last_utility_menu;
1453
1454
	$_wp_last_utility_menu++;
1455
1456
	return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);
1457
}
1458
1459
/**
1460
 * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
1461
 * as they disregard the autocomplete setting on the editor textarea. That can break the editor
1462
 * when the user navigates to it with the browser's Back button. See #28037
1463
 *
1464
 * Replaced with wp_page_reload_on_back_button_js() that also fixes this problem.
1465
 *
1466
 * @since 4.0.0
1467
 * $deprecated 4.6.0
1468
 *
1469
 * @global bool $is_safari
1470
 * @global bool $is_chrome
1471
 */
1472
function post_form_autocomplete_off() {
1473
	global $is_safari, $is_chrome;
1474
1475
	_deprecated_function( __FUNCTION__, '4.6.0' );
1476
1477
	if ( $is_safari || $is_chrome ) {
1478
		echo ' autocomplete="off"';
1479
	}
1480
}
1481