web/wp-admin/includes/deprecated.php
changeset 194 32102edaa81b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
       
     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
       
    17  * @deprecated 2.1
       
    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
       
    31  * @deprecated 2.5
       
    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  *
       
    46  * @param int $width Current width of the image
       
    47  * @param int $height Current height of the image
       
    48  * @param int $wmax Maximum wanted width
       
    49  * @param int $hmax Maximum wanted height
       
    50  * @return mixed Array(height,width) of shrunk dimensions.
       
    51  */
       
    52 function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
       
    53 	_deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' );
       
    54 	return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
       
    55 }
       
    56 
       
    57 /**
       
    58  * {@internal Missing Short Description}}
       
    59  *
       
    60  * @since 0.71
       
    61  * @deprecated 2.6.0
       
    62  * @deprecated Use wp_category_checklist()
       
    63  * @see wp_category_checklist()
       
    64  *
       
    65  * @param unknown_type $default
       
    66  * @param unknown_type $parent
       
    67  * @param unknown_type $popular_ids
       
    68  */
       
    69 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
       
    70 	_deprecated_function( __FUNCTION__, '2.6', 'wp_category_checklist()' );
       
    71 	global $post_ID;
       
    72 	wp_category_checklist( $post_ID );
       
    73 }
       
    74 
       
    75 /**
       
    76  * {@internal Missing Short Description}}
       
    77  *
       
    78  * @since 2.1.0
       
    79  * @deprecated 2.6.0
       
    80  * @deprecated Use wp_link_category_checklist()
       
    81  * @see wp_link_category_checklist()
       
    82  *
       
    83  * @param unknown_type $default
       
    84  */
       
    85 function dropdown_link_categories( $default = 0 ) {
       
    86 	_deprecated_function( __FUNCTION__, '2.6', 'wp_link_category_checklist()' );
       
    87 	global $link_id;
       
    88 	wp_link_category_checklist( $link_id );
       
    89 }
       
    90 
       
    91 /**
       
    92  * {@internal Missing Short Description}}
       
    93  *
       
    94  * @since 1.2.0
       
    95  * @deprecated 3.0.0
       
    96  * @deprecated Use wp_dropdown_categories()
       
    97  * @see wp_dropdown_categories()
       
    98  *
       
    99  * @param unknown_type $currentcat
       
   100  * @param unknown_type $currentparent
       
   101  * @param unknown_type $parent
       
   102  * @param unknown_type $level
       
   103  * @param unknown_type $categories
       
   104  * @return unknown
       
   105  */
       
   106 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
       
   107 	_deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' );
       
   108 	if (!$categories )
       
   109 		$categories = get_categories( array('hide_empty' => 0) );
       
   110 
       
   111 	if ( $categories ) {
       
   112 		foreach ( $categories as $category ) {
       
   113 			if ( $currentcat != $category->term_id && $parent == $category->parent) {
       
   114 				$pad = str_repeat( '&#8211; ', $level );
       
   115 				$category->name = esc_html( $category->name );
       
   116 				echo "\n\t<option value='$category->term_id'";
       
   117 				if ( $currentparent == $category->term_id )
       
   118 					echo " selected='selected'";
       
   119 				echo ">$pad$category->name</option>";
       
   120 				wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
       
   121 			}
       
   122 		}
       
   123 	} else {
       
   124 		return false;
       
   125 	}
       
   126 }
       
   127 
       
   128 /**
       
   129  * Register a setting and its sanitization callback
       
   130  *
       
   131  * @since 2.7.0
       
   132  * @deprecated 3.0.0
       
   133  * @deprecated Use register_setting()
       
   134  * @see register_setting()
       
   135  *
       
   136  * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
       
   137  * 	Default whitelisted option key names include "general," "discussion," and "reading," among others.
       
   138  * @param string $option_name The name of an option to sanitize and save.
       
   139  * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
       
   140  * @return unknown
       
   141  */
       
   142 function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
       
   143 	_deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
       
   144 	return register_setting( $option_group, $option_name, $sanitize_callback );
       
   145 }
       
   146 
       
   147 /**
       
   148  * Unregister a setting
       
   149  *
       
   150  * @since 2.7.0
       
   151  * @deprecated 3.0.0
       
   152  * @deprecated Use unregister_setting()
       
   153  * @see unregister_setting()
       
   154  *
       
   155  * @param unknown_type $option_group
       
   156  * @param unknown_type $option_name
       
   157  * @param unknown_type $sanitize_callback
       
   158  * @return unknown
       
   159  */
       
   160 function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
       
   161 	_deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
       
   162 	return unregister_setting( $option_group, $option_name, $sanitize_callback );
       
   163 }
       
   164 
       
   165 /**
       
   166  * Determines the language to use for CodePress syntax highlighting.
       
   167  *
       
   168  * @since 2.8.0
       
   169  * @deprecated 3.0.0
       
   170  *
       
   171  * @param string $filename
       
   172 **/
       
   173 function codepress_get_lang( $filename ) {
       
   174 	_deprecated_function( __FUNCTION__, '3.0' );
       
   175 	return;
       
   176 }
       
   177 
       
   178 /**
       
   179  * Adds Javascript required to make CodePress work on the theme/plugin editors.
       
   180  *
       
   181  * @since 2.8.0
       
   182  * @deprecated 3.0.0
       
   183 **/
       
   184 function codepress_footer_js() {
       
   185 	_deprecated_function( __FUNCTION__, '3.0' );
       
   186 	return;
       
   187 }
       
   188 
       
   189 /**
       
   190  * Determine whether to use CodePress.
       
   191  *
       
   192  * @since 2.8
       
   193  * @deprecated 3.0.0
       
   194 **/
       
   195 function use_codepress() {
       
   196 	_deprecated_function( __FUNCTION__, '3.0' );
       
   197 	return;
       
   198 }
       
   199 
       
   200 /**
       
   201  * @deprecated 3.1.0
       
   202  *
       
   203  * @return array List of user IDs.
       
   204  */
       
   205 function get_author_user_ids() {
       
   206 	_deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
       
   207 
       
   208 	global $wpdb;
       
   209 	if ( !is_multisite() )
       
   210 		$level_key = $wpdb->get_blog_prefix() . 'user_level';
       
   211 	else
       
   212 		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
       
   213 
       
   214 	return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
       
   215 }
       
   216 
       
   217 /**
       
   218  * @deprecated 3.1.0
       
   219  *
       
   220  * @param int $user_id User ID.
       
   221  * @return array|bool List of editable authors. False if no editable users.
       
   222  */
       
   223 function get_editable_authors( $user_id ) {
       
   224 	_deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
       
   225 
       
   226 	global $wpdb;
       
   227 
       
   228 	$editable = get_editable_user_ids( $user_id );
       
   229 
       
   230 	if ( !$editable ) {
       
   231 		return false;
       
   232 	} else {
       
   233 		$editable = join(',', $editable);
       
   234 		$authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
       
   235 	}
       
   236 
       
   237 	return apply_filters('get_editable_authors', $authors);
       
   238 }
       
   239 
       
   240 /**
       
   241  * @deprecated 3.1.0
       
   242  *
       
   243  * @param int $user_id User ID.
       
   244  * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
       
   245  * @return unknown
       
   246  */
       
   247 function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
       
   248 	_deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
       
   249 
       
   250 	global $wpdb;
       
   251 
       
   252 	$user = new WP_User( $user_id );
       
   253 	$post_type_obj = get_post_type_object($post_type);
       
   254 
       
   255 	if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
       
   256 		if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
       
   257 			return array($user->ID);
       
   258 		else
       
   259 			return array();
       
   260 	}
       
   261 
       
   262 	if ( !is_multisite() )
       
   263 		$level_key = $wpdb->get_blog_prefix() . 'user_level';
       
   264 	else
       
   265 		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
       
   266 
       
   267 	$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
       
   268 	if ( $exclude_zeros )
       
   269 		$query .= " AND meta_value != '0'";
       
   270 
       
   271 	return $wpdb->get_col( $query );
       
   272 }
       
   273 
       
   274 /**
       
   275  * @deprecated 3.1.0
       
   276  */
       
   277 function get_nonauthor_user_ids() {
       
   278 	_deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
       
   279 
       
   280 	global $wpdb;
       
   281 
       
   282 	if ( !is_multisite() )
       
   283 		$level_key = $wpdb->get_blog_prefix() . 'user_level';
       
   284 	else
       
   285 		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
       
   286 
       
   287 	return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
       
   288 }
       
   289 
       
   290 if ( !class_exists('WP_User_Search') ) :
       
   291 /**
       
   292  * WordPress User Search class.
       
   293  *
       
   294  * @since 2.1.0
       
   295  * @deprecated 3.1.0
       
   296  */
       
   297 class WP_User_Search {
       
   298 
       
   299 	/**
       
   300 	 * {@internal Missing Description}}
       
   301 	 *
       
   302 	 * @since 2.1.0
       
   303 	 * @access private
       
   304 	 * @var unknown_type
       
   305 	 */
       
   306 	var $results;
       
   307 
       
   308 	/**
       
   309 	 * {@internal Missing Description}}
       
   310 	 *
       
   311 	 * @since 2.1.0
       
   312 	 * @access private
       
   313 	 * @var unknown_type
       
   314 	 */
       
   315 	var $search_term;
       
   316 
       
   317 	/**
       
   318 	 * Page number.
       
   319 	 *
       
   320 	 * @since 2.1.0
       
   321 	 * @access private
       
   322 	 * @var int
       
   323 	 */
       
   324 	var $page;
       
   325 
       
   326 	/**
       
   327 	 * Role name that users have.
       
   328 	 *
       
   329 	 * @since 2.5.0
       
   330 	 * @access private
       
   331 	 * @var string
       
   332 	 */
       
   333 	var $role;
       
   334 
       
   335 	/**
       
   336 	 * Raw page number.
       
   337 	 *
       
   338 	 * @since 2.1.0
       
   339 	 * @access private
       
   340 	 * @var int|bool
       
   341 	 */
       
   342 	var $raw_page;
       
   343 
       
   344 	/**
       
   345 	 * Amount of users to display per page.
       
   346 	 *
       
   347 	 * @since 2.1.0
       
   348 	 * @access public
       
   349 	 * @var int
       
   350 	 */
       
   351 	var $users_per_page = 50;
       
   352 
       
   353 	/**
       
   354 	 * {@internal Missing Description}}
       
   355 	 *
       
   356 	 * @since 2.1.0
       
   357 	 * @access private
       
   358 	 * @var unknown_type
       
   359 	 */
       
   360 	var $first_user;
       
   361 
       
   362 	/**
       
   363 	 * {@internal Missing Description}}
       
   364 	 *
       
   365 	 * @since 2.1.0
       
   366 	 * @access private
       
   367 	 * @var int
       
   368 	 */
       
   369 	var $last_user;
       
   370 
       
   371 	/**
       
   372 	 * {@internal Missing Description}}
       
   373 	 *
       
   374 	 * @since 2.1.0
       
   375 	 * @access private
       
   376 	 * @var string
       
   377 	 */
       
   378 	var $query_limit;
       
   379 
       
   380 	/**
       
   381 	 * {@internal Missing Description}}
       
   382 	 *
       
   383 	 * @since 3.0.0
       
   384 	 * @access private
       
   385 	 * @var string
       
   386 	 */
       
   387 	var $query_orderby;
       
   388 
       
   389 	/**
       
   390 	 * {@internal Missing Description}}
       
   391 	 *
       
   392 	 * @since 3.0.0
       
   393 	 * @access private
       
   394 	 * @var string
       
   395 	 */
       
   396 	var $query_from;
       
   397 
       
   398 	/**
       
   399 	 * {@internal Missing Description}}
       
   400 	 *
       
   401 	 * @since 3.0.0
       
   402 	 * @access private
       
   403 	 * @var string
       
   404 	 */
       
   405 	var $query_where;
       
   406 
       
   407 	/**
       
   408 	 * {@internal Missing Description}}
       
   409 	 *
       
   410 	 * @since 2.1.0
       
   411 	 * @access private
       
   412 	 * @var int
       
   413 	 */
       
   414 	var $total_users_for_query = 0;
       
   415 
       
   416 	/**
       
   417 	 * {@internal Missing Description}}
       
   418 	 *
       
   419 	 * @since 2.1.0
       
   420 	 * @access private
       
   421 	 * @var bool
       
   422 	 */
       
   423 	var $too_many_total_users = false;
       
   424 
       
   425 	/**
       
   426 	 * {@internal Missing Description}}
       
   427 	 *
       
   428 	 * @since 2.1.0
       
   429 	 * @access private
       
   430 	 * @var unknown_type
       
   431 	 */
       
   432 	var $search_errors;
       
   433 
       
   434 	/**
       
   435 	 * {@internal Missing Description}}
       
   436 	 *
       
   437 	 * @since 2.7.0
       
   438 	 * @access private
       
   439 	 * @var unknown_type
       
   440 	 */
       
   441 	var $paging_text;
       
   442 
       
   443 	/**
       
   444 	 * PHP4 Constructor - Sets up the object properties.
       
   445 	 *
       
   446 	 * @since 2.1.0
       
   447 	 *
       
   448 	 * @param string $search_term Search terms string.
       
   449 	 * @param int $page Optional. Page ID.
       
   450 	 * @param string $role Role name.
       
   451 	 * @return WP_User_Search
       
   452 	 */
       
   453 	function WP_User_Search ($search_term = '', $page = '', $role = '') {
       
   454 		_deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' );
       
   455 
       
   456 		$this->search_term = stripslashes( $search_term );
       
   457 		$this->raw_page = ( '' == $page ) ? false : (int) $page;
       
   458 		$this->page = (int) ( '' == $page ) ? 1 : $page;
       
   459 		$this->role = $role;
       
   460 
       
   461 		$this->prepare_query();
       
   462 		$this->query();
       
   463 		$this->prepare_vars_for_template_usage();
       
   464 		$this->do_paging();
       
   465 	}
       
   466 
       
   467 	/**
       
   468 	 * {@internal Missing Short Description}}
       
   469 	 *
       
   470 	 * {@internal Missing Long Description}}
       
   471 	 *
       
   472 	 * @since 2.1.0
       
   473 	 * @access public
       
   474 	 */
       
   475 	function prepare_query() {
       
   476 		global $wpdb;
       
   477 		$this->first_user = ($this->page - 1) * $this->users_per_page;
       
   478 
       
   479 		$this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
       
   480 		$this->query_orderby = ' ORDER BY user_login';
       
   481 
       
   482 		$search_sql = '';
       
   483 		if ( $this->search_term ) {
       
   484 			$searches = array();
       
   485 			$search_sql = 'AND (';
       
   486 			foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
       
   487 				$searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
       
   488 			$search_sql .= implode(' OR ', $searches);
       
   489 			$search_sql .= ')';
       
   490 		}
       
   491 
       
   492 		$this->query_from = " FROM $wpdb->users";
       
   493 		$this->query_where = " WHERE 1=1 $search_sql";
       
   494 
       
   495 		if ( $this->role ) {
       
   496 			$this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
       
   497 			$this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
       
   498 		} elseif ( is_multisite() ) {
       
   499 			$level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
       
   500 			$this->query_from .= ", $wpdb->usermeta";
       
   501 			$this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
       
   502 		}
       
   503 
       
   504 		do_action_ref_array( 'pre_user_search', array( &$this ) );
       
   505 	}
       
   506 
       
   507 	/**
       
   508 	 * {@internal Missing Short Description}}
       
   509 	 *
       
   510 	 * {@internal Missing Long Description}}
       
   511 	 *
       
   512 	 * @since 2.1.0
       
   513 	 * @access public
       
   514 	 */
       
   515 	function query() {
       
   516 		global $wpdb;
       
   517 
       
   518 		$this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
       
   519 
       
   520 		if ( $this->results )
       
   521 			$this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
       
   522 		else
       
   523 			$this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
       
   524 	}
       
   525 
       
   526 	/**
       
   527 	 * {@internal Missing Short Description}}
       
   528 	 *
       
   529 	 * {@internal Missing Long Description}}
       
   530 	 *
       
   531 	 * @since 2.1.0
       
   532 	 * @access public
       
   533 	 */
       
   534 	function prepare_vars_for_template_usage() {
       
   535 		$this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
       
   536 	}
       
   537 
       
   538 	/**
       
   539 	 * {@internal Missing Short Description}}
       
   540 	 *
       
   541 	 * {@internal Missing Long Description}}
       
   542 	 *
       
   543 	 * @since 2.1.0
       
   544 	 * @access public
       
   545 	 */
       
   546 	function do_paging() {
       
   547 		if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
       
   548 			$args = array();
       
   549 			if( ! empty($this->search_term) )
       
   550 				$args['usersearch'] = urlencode($this->search_term);
       
   551 			if( ! empty($this->role) )
       
   552 				$args['role'] = urlencode($this->role);
       
   553 
       
   554 			$this->paging_text = paginate_links( array(
       
   555 				'total' => ceil($this->total_users_for_query / $this->users_per_page),
       
   556 				'current' => $this->page,
       
   557 				'base' => 'users.php?%_%',
       
   558 				'format' => 'userspage=%#%',
       
   559 				'add_args' => $args
       
   560 			) );
       
   561 			if ( $this->paging_text ) {
       
   562 				$this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
       
   563 					number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
       
   564 					number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
       
   565 					number_format_i18n( $this->total_users_for_query ),
       
   566 					$this->paging_text
       
   567 				);
       
   568 			}
       
   569 		}
       
   570 	}
       
   571 
       
   572 	/**
       
   573 	 * {@internal Missing Short Description}}
       
   574 	 *
       
   575 	 * {@internal Missing Long Description}}
       
   576 	 *
       
   577 	 * @since 2.1.0
       
   578 	 * @access public
       
   579 	 *
       
   580 	 * @return unknown
       
   581 	 */
       
   582 	function get_results() {
       
   583 		return (array) $this->results;
       
   584 	}
       
   585 
       
   586 	/**
       
   587 	 * Displaying paging text.
       
   588 	 *
       
   589 	 * @see do_paging() Builds paging text.
       
   590 	 *
       
   591 	 * @since 2.1.0
       
   592 	 * @access public
       
   593 	 */
       
   594 	function page_links() {
       
   595 		echo $this->paging_text;
       
   596 	}
       
   597 
       
   598 	/**
       
   599 	 * Whether paging is enabled.
       
   600 	 *
       
   601 	 * @see do_paging() Builds paging text.
       
   602 	 *
       
   603 	 * @since 2.1.0
       
   604 	 * @access public
       
   605 	 *
       
   606 	 * @return bool
       
   607 	 */
       
   608 	function results_are_paged() {
       
   609 		if ( $this->paging_text )
       
   610 			return true;
       
   611 		return false;
       
   612 	}
       
   613 
       
   614 	/**
       
   615 	 * Whether there are search terms.
       
   616 	 *
       
   617 	 * @since 2.1.0
       
   618 	 * @access public
       
   619 	 *
       
   620 	 * @return bool
       
   621 	 */
       
   622 	function is_search() {
       
   623 		if ( $this->search_term )
       
   624 			return true;
       
   625 		return false;
       
   626 	}
       
   627 }
       
   628 endif;
       
   629 
       
   630 /**
       
   631  * Retrieve editable posts from other users.
       
   632  *
       
   633  * @deprecated 3.1.0
       
   634  *
       
   635  * @param int $user_id User ID to not retrieve posts from.
       
   636  * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
       
   637  * @return array List of posts from others.
       
   638  */
       
   639 function get_others_unpublished_posts($user_id, $type='any') {
       
   640 	_deprecated_function( __FUNCTION__, '3.1' );
       
   641 
       
   642 	global $wpdb;
       
   643 
       
   644 	$editable = get_editable_user_ids( $user_id );
       
   645 
       
   646 	if ( in_array($type, array('draft', 'pending')) )
       
   647 		$type_sql = " post_status = '$type' ";
       
   648 	else
       
   649 		$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
       
   650 
       
   651 	$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
       
   652 
       
   653 	if ( !$editable ) {
       
   654 		$other_unpubs = '';
       
   655 	} else {
       
   656 		$editable = join(',', $editable);
       
   657 		$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) );
       
   658 	}
       
   659 
       
   660 	return apply_filters('get_others_drafts', $other_unpubs);
       
   661 }
       
   662 
       
   663 /**
       
   664  * Retrieve drafts from other users.
       
   665  *
       
   666  * @deprecated 3.1.0
       
   667  *
       
   668  * @param int $user_id User ID.
       
   669  * @return array List of drafts from other users.
       
   670  */
       
   671 function get_others_drafts($user_id) {
       
   672 	_deprecated_function( __FUNCTION__, '3.1' );
       
   673 
       
   674 	return get_others_unpublished_posts($user_id, 'draft');
       
   675 }
       
   676 
       
   677 /**
       
   678  * Retrieve pending review posts from other users.
       
   679  *
       
   680  * @deprecated 3.1.0
       
   681  *
       
   682  * @param int $user_id User ID.
       
   683  * @return array List of posts with pending review post type from other users.
       
   684  */
       
   685 function get_others_pending($user_id) {
       
   686 	_deprecated_function( __FUNCTION__, '3.1' );
       
   687 
       
   688 	return get_others_unpublished_posts($user_id, 'pending');
       
   689 }
       
   690 
       
   691 /**
       
   692  * Output the QuickPress dashboard widget.
       
   693  *
       
   694  * @since 3.0.0
       
   695  * @deprecated 3.2.0
       
   696  * @deprecated Use wp_dashboard_quick_press()
       
   697  * @see wp_dashboard_quick_press()
       
   698  */
       
   699 function wp_dashboard_quick_press_output() {
       
   700 	_deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' );
       
   701 	wp_dashboard_quick_press();
       
   702 }
       
   703 
       
   704 /**
       
   705  * @since 2.7.0
       
   706  * @deprecated 3.3
       
   707  * @deprecated Use wp_editor()
       
   708  * @see wp_editor()
       
   709  */
       
   710 function wp_tiny_mce( $teeny = false, $settings = false ) {
       
   711 	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
       
   712 
       
   713 	static $num = 1;
       
   714 
       
   715 	if ( ! class_exists('_WP_Editors' ) )
       
   716 		require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
       
   717 
       
   718 	$editor_id = 'content' . $num++;
       
   719 
       
   720 	$set = array(
       
   721 		'teeny' => $teeny,
       
   722 		'tinymce' => $settings ? $settings : true,
       
   723 		'quicktags' => false
       
   724 	);
       
   725 
       
   726 	$set = _WP_Editors::parse_settings($editor_id, $set);
       
   727 	_WP_Editors::editor_settings($editor_id, $set);
       
   728 }
       
   729 
       
   730 /**
       
   731  * @deprecated 3.3.0
       
   732  * @deprecated Use wp_editor()
       
   733  * @see wp_editor()
       
   734  */
       
   735 function wp_preload_dialogs() {
       
   736 	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
       
   737 }
       
   738 
       
   739 /**
       
   740  * @deprecated 3.3.0
       
   741  * @deprecated Use wp_editor()
       
   742  * @see wp_editor()
       
   743  */
       
   744 function wp_print_editor_js() {
       
   745 	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
       
   746 }
       
   747 
       
   748 /**
       
   749  * @deprecated 3.3.0
       
   750  * @deprecated Use wp_editor()
       
   751  * @see wp_editor()
       
   752  */
       
   753 function wp_quicktags() {
       
   754 	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
       
   755 }
       
   756 
       
   757 /**
       
   758  * Returns the screen layout options.
       
   759  *
       
   760  * @since 2.8.0
       
   761  * @deprecated 3.3.0
       
   762  * @deprecated Use $current_screen->render_screen_layout()
       
   763  * @see WP_Screen::render_screen_layout()
       
   764  */
       
   765 function screen_layout( $screen ) {
       
   766 	_deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_layout()' );
       
   767 
       
   768 	$current_screen = get_current_screen();
       
   769 
       
   770 	if ( ! $current_screen )
       
   771 		return '';
       
   772 
       
   773 	ob_start();
       
   774 	$current_screen->render_screen_layout();
       
   775 	return ob_get_clean();
       
   776 }
       
   777 
       
   778 /**
       
   779  * Returns the screen's per-page options.
       
   780  *
       
   781  * @since 2.8.0
       
   782  * @deprecated 3.3.0
       
   783  * @deprecated Use $current_screen->render_per_page_options()
       
   784  * @see WP_Screen::render_per_page_options()
       
   785  */
       
   786 function screen_options( $screen ) {
       
   787 	_deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_per_page_options()' );
       
   788 
       
   789 	$current_screen = get_current_screen();
       
   790 
       
   791 	if ( ! $current_screen )
       
   792 		return '';
       
   793 
       
   794 	ob_start();
       
   795 	$current_screen->render_per_page_options();
       
   796 	return ob_get_clean();
       
   797 }
       
   798 
       
   799 /**
       
   800  * Renders the screen's help.
       
   801  *
       
   802  * @since 2.7.0
       
   803  * @deprecated 3.3.0
       
   804  * @deprecated Use $current_screen->render_screen_meta()
       
   805  * @see WP_Screen::render_screen_meta()
       
   806  */
       
   807 function screen_meta( $screen ) {
       
   808 	$current_screen = get_current_screen();
       
   809 	$current_screen->render_screen_meta();
       
   810 }
       
   811 
       
   812 /**
       
   813  * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
       
   814  *
       
   815  * @since 2.7.0
       
   816  * @deprecated 3.2.0
       
   817  */
       
   818 function favorite_actions() {
       
   819 	_deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' );
       
   820 }
       
   821 
       
   822 function media_upload_image() {
       
   823 	__deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
       
   824 	return wp_media_upload_handler();
       
   825 }
       
   826 
       
   827 function media_upload_audio() {
       
   828 	__deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
       
   829 	return wp_media_upload_handler();
       
   830 }
       
   831 
       
   832 function media_upload_video() {
       
   833 	__deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
       
   834 	return wp_media_upload_handler();
       
   835 }
       
   836 
       
   837 function media_upload_file() {
       
   838 	__deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
       
   839 	return wp_media_upload_handler();
       
   840 }
       
   841 
       
   842 function type_url_form_image() {
       
   843 	__deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('image')" );
       
   844 	return wp_media_insert_url_form( 'image' );
       
   845 }
       
   846 
       
   847 function type_url_form_audio() {
       
   848 	__deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('audio')" );
       
   849 	return wp_media_insert_url_form( 'audio' );
       
   850 }
       
   851 
       
   852 function type_url_form_video() {
       
   853 	__deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('video')" );
       
   854 	return wp_media_insert_url_form( 'video' );
       
   855 }
       
   856 
       
   857 function type_url_form_file() {
       
   858 	__deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('file')" );
       
   859 	return wp_media_insert_url_form( 'file' );
       
   860 }
       
   861 
       
   862 /**
       
   863  * Add contextual help text for a page.
       
   864  *
       
   865  * Creates an 'Overview' help tab.
       
   866  *
       
   867  * @since 2.7.0
       
   868  * @deprecated 3.3.0
       
   869  * @deprecated Use get_current_screen()->add_help_tab()
       
   870  * @see WP_Screen
       
   871  *
       
   872  * @param string    $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
       
   873  * @param string    $help   The content of an 'Overview' help tab.
       
   874  */
       
   875 function add_contextual_help( $screen, $help ) {
       
   876 	_deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' );
       
   877 
       
   878 	if ( is_string( $screen ) )
       
   879 		$screen = convert_to_screen( $screen );
       
   880 
       
   881 	WP_Screen::add_old_compat_help( $screen, $help );
       
   882 }
       
   883 
       
   884 /**
       
   885  * Get the allowed themes for the current blog.
       
   886  *
       
   887  * @since 3.0.0
       
   888  * @deprecated 3.4.0
       
   889  * @deprecated Use wp_get_themes()
       
   890  * @see wp_get_themes()
       
   891  *
       
   892  * @return array $themes Array of allowed themes.
       
   893  */
       
   894 function get_allowed_themes() {
       
   895 	_deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )" );
       
   896 
       
   897 	$themes = wp_get_themes( array( 'allowed' => true ) );
       
   898 
       
   899 	$wp_themes = array();
       
   900 	foreach ( $themes as $theme ) {
       
   901 		$wp_themes[ $theme->get('Name') ] = $theme;
       
   902 	}
       
   903 
       
   904 	return $wp_themes;
       
   905 }
       
   906 
       
   907 /**
       
   908  * {@internal Missing Short Description}}
       
   909  *
       
   910  * @since 1.5.0
       
   911  *
       
   912  * @return unknown
       
   913  */
       
   914 function get_broken_themes() {
       
   915 	_deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )" );
       
   916 
       
   917 	$themes = wp_get_themes( array( 'errors' => true ) );
       
   918 	$broken = array();
       
   919 	foreach ( $themes as $theme ) {
       
   920 		$name = $theme->get('Name');
       
   921 		$broken[ $name ] = array(
       
   922 			'Name' => $name,
       
   923 			'Title' => $name,
       
   924 			'Description' => $theme->errors()->get_error_message(),
       
   925 		);
       
   926 	}
       
   927 	return $broken;
       
   928 }
       
   929 
       
   930 /**
       
   931  * {@internal Missing Short Description}}
       
   932  *
       
   933  * @since 2.0.0
       
   934  *
       
   935  * @return unknown
       
   936  */
       
   937 function current_theme_info() {
       
   938 	_deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
       
   939 
       
   940 	return wp_get_theme();
       
   941 }