[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/includes/ -> deprecated.php (source)

   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   * @global int $post_ID
  79   *
  80   * @param int   $default_category Unused.
  81   * @param int   $category_parent  Unused.
  82   * @param array $popular_ids      Unused.
  83   */
  84  function dropdown_categories( $default_category = 0, $category_parent = 0, $popular_ids = array() ) {
  85      _deprecated_function( __FUNCTION__, '2.6.0', 'wp_category_checklist()' );
  86      global $post_ID;
  87      wp_category_checklist( $post_ID );
  88  }
  89  
  90  /**
  91   * Legacy function used to generate a link categories checklist control.
  92   *
  93   * @since 2.1.0
  94   * @deprecated 2.6.0 Use wp_link_category_checklist()
  95   * @see wp_link_category_checklist()
  96   *
  97   * @global int $link_id
  98   *
  99   * @param int $default_link_category Unused.
 100   */
 101  function dropdown_link_categories( $default_link_category = 0 ) {
 102      _deprecated_function( __FUNCTION__, '2.6.0', 'wp_link_category_checklist()' );
 103      global $link_id;
 104      wp_link_category_checklist( $link_id );
 105  }
 106  
 107  /**
 108   * Get the real filesystem path to a file to edit within the admin.
 109   *
 110   * @since 1.5.0
 111   * @deprecated 2.9.0
 112   * @uses WP_CONTENT_DIR Full filesystem path to the wp-content directory.
 113   *
 114   * @param string $file Filesystem path relative to the wp-content directory.
 115   * @return string Full filesystem path to edit.
 116   */
 117  function get_real_file_to_edit( $file ) {
 118      _deprecated_function( __FUNCTION__, '2.9.0' );
 119  
 120      return WP_CONTENT_DIR . $file;
 121  }
 122  
 123  /**
 124   * Legacy function used for generating a categories drop-down control.
 125   *
 126   * @since 1.2.0
 127   * @deprecated 3.0.0 Use wp_dropdown_categories()
 128   * @see wp_dropdown_categories()
 129   *
 130   * @param int $current_cat     Optional. ID of the current category. Default 0.
 131   * @param int $current_parent  Optional. Current parent category ID. Default 0.
 132   * @param int $category_parent Optional. Parent ID to retrieve categories for. Default 0.
 133   * @param int $level           Optional. Number of levels deep to display. Default 0.
 134   * @param array $categories    Optional. Categories to include in the control. Default 0.
 135   * @return void|false Void on success, false if no categories were found.
 136   */
 137  function wp_dropdown_cats( $current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0 ) {
 138      _deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' );
 139      if (!$categories )
 140          $categories = get_categories( array('hide_empty' => 0) );
 141  
 142      if ( $categories ) {
 143          foreach ( $categories as $category ) {
 144              if ( $current_cat != $category->term_id && $category_parent == $category->parent) {
 145                  $pad = str_repeat( '&#8211; ', $level );
 146                  $category->name = esc_html( $category->name );
 147                  echo "\n\t<option value='$category->term_id'";
 148                  if ( $current_parent == $category->term_id )
 149                      echo " selected='selected'";
 150                  echo ">$pad$category->name</option>";
 151                  wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories );
 152              }
 153          }
 154      } else {
 155          return false;
 156      }
 157  }
 158  
 159  /**
 160   * Register a setting and its sanitization callback
 161   *
 162   * @since 2.7.0
 163   * @deprecated 3.0.0 Use register_setting()
 164   * @see register_setting()
 165   *
 166   * @param string   $option_group      A settings group name. Should correspond to an allowed option key name.
 167   *                                    Default allowed option key names include 'general', 'discussion', 'media',
 168   *                                    'reading', 'writing', and 'options'.
 169   * @param string   $option_name       The name of an option to sanitize and save.
 170   * @param callable $sanitize_callback Optional. A callback function that sanitizes the option's value.
 171   */
 172  function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
 173      _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' );
 174      register_setting( $option_group, $option_name, $sanitize_callback );
 175  }
 176  
 177  /**
 178   * Unregister a setting
 179   *
 180   * @since 2.7.0
 181   * @deprecated 3.0.0 Use unregister_setting()
 182   * @see unregister_setting()
 183   *
 184   * @param string   $option_group      The settings group name used during registration.
 185   * @param string   $option_name       The name of the option to unregister.
 186   * @param callable $sanitize_callback Optional. Deprecated.
 187   */
 188  function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
 189      _deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' );
 190      unregister_setting( $option_group, $option_name, $sanitize_callback );
 191  }
 192  
 193  /**
 194   * Determines the language to use for CodePress syntax highlighting.
 195   *
 196   * @since 2.8.0
 197   * @deprecated 3.0.0
 198   *
 199   * @param string $filename
 200   */
 201  function codepress_get_lang( $filename ) {
 202      _deprecated_function( __FUNCTION__, '3.0.0' );
 203  }
 204  
 205  /**
 206   * Adds JavaScript required to make CodePress work on the theme/plugin file editors.
 207   *
 208   * @since 2.8.0
 209   * @deprecated 3.0.0
 210   */
 211  function codepress_footer_js() {
 212      _deprecated_function( __FUNCTION__, '3.0.0' );
 213  }
 214  
 215  /**
 216   * Determine whether to use CodePress.
 217   *
 218   * @since 2.8.0
 219   * @deprecated 3.0.0
 220   */
 221  function use_codepress() {
 222      _deprecated_function( __FUNCTION__, '3.0.0' );
 223  }
 224  
 225  /**
 226   * Get all user IDs.
 227   *
 228   * @deprecated 3.1.0 Use get_users()
 229   *
 230   * @global wpdb $wpdb WordPress database abstraction object.
 231   *
 232   * @return array List of user IDs.
 233   */
 234  function get_author_user_ids() {
 235      _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
 236  
 237      global $wpdb;
 238      if ( !is_multisite() )
 239          $level_key = $wpdb->get_blog_prefix() . 'user_level';
 240      else
 241          $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
 242  
 243      return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
 244  }
 245  
 246  /**
 247   * Gets author users who can edit posts.
 248   *
 249   * @deprecated 3.1.0 Use get_users()
 250   *
 251   * @global wpdb $wpdb WordPress database abstraction object.
 252   *
 253   * @param int $user_id User ID.
 254   * @return array|false List of editable authors. False if no editable users.
 255   */
 256  function get_editable_authors( $user_id ) {
 257      _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
 258  
 259      global $wpdb;
 260  
 261      $editable = get_editable_user_ids( $user_id );
 262  
 263      if ( !$editable ) {
 264          return false;
 265      } else {
 266          $editable = join(',', $editable);
 267          $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
 268      }
 269  
 270      return apply_filters('get_editable_authors', $authors);
 271  }
 272  
 273  /**
 274   * Gets the IDs of any users who can edit posts.
 275   *
 276   * @deprecated 3.1.0 Use get_users()
 277   *
 278   * @global wpdb $wpdb WordPress database abstraction object.
 279   *
 280   * @param int  $user_id       User ID.
 281   * @param bool $exclude_zeros Optional. Whether to exclude zeroes. Default true.
 282   * @return array Array of editable user IDs, empty array otherwise.
 283   */
 284  function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
 285      _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
 286  
 287      global $wpdb;
 288  
 289      if ( ! $user = get_userdata( $user_id ) )
 290          return array();
 291      $post_type_obj = get_post_type_object($post_type);
 292  
 293      if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
 294          if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
 295              return array($user->ID);
 296          else
 297              return array();
 298      }
 299  
 300      if ( !is_multisite() )
 301          $level_key = $wpdb->get_blog_prefix() . 'user_level';
 302      else
 303          $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
 304  
 305      $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
 306      if ( $exclude_zeros )
 307          $query .= " AND meta_value != '0'";
 308  
 309      return $wpdb->get_col( $query );
 310  }
 311  
 312  /**
 313   * Gets all users who are not authors.
 314   *
 315   * @deprecated 3.1.0 Use get_users()
 316   *
 317   * @global wpdb $wpdb WordPress database abstraction object.
 318   */
 319  function get_nonauthor_user_ids() {
 320      _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
 321  
 322      global $wpdb;
 323  
 324      if ( !is_multisite() )
 325          $level_key = $wpdb->get_blog_prefix() . 'user_level';
 326      else
 327          $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
 328  
 329      return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
 330  }
 331  
 332  if ( ! class_exists( 'WP_User_Search', false ) ) :
 333  /**
 334   * WordPress User Search class.
 335   *
 336   * @since 2.1.0
 337   * @deprecated 3.1.0 Use WP_User_Query
 338   */
 339  class WP_User_Search {
 340  
 341      /**
 342       * {@internal Missing Description}}
 343       *
 344       * @since 2.1.0
 345       * @access private
 346       * @var mixed
 347       */
 348      var $results;
 349  
 350      /**
 351       * {@internal Missing Description}}
 352       *
 353       * @since 2.1.0
 354       * @access private
 355       * @var string
 356       */
 357      var $search_term;
 358  
 359      /**
 360       * Page number.
 361       *
 362       * @since 2.1.0
 363       * @access private
 364       * @var int
 365       */
 366      var $page;
 367  
 368      /**
 369       * Role name that users have.
 370       *
 371       * @since 2.5.0
 372       * @access private
 373       * @var string
 374       */
 375      var $role;
 376  
 377      /**
 378       * Raw page number.
 379       *
 380       * @since 2.1.0
 381       * @access private
 382       * @var int|bool
 383       */
 384      var $raw_page;
 385  
 386      /**
 387       * Amount of users to display per page.
 388       *
 389       * @since 2.1.0
 390       * @access public
 391       * @var int
 392       */
 393      var $users_per_page = 50;
 394  
 395      /**
 396       * {@internal Missing Description}}
 397       *
 398       * @since 2.1.0
 399       * @access private
 400       * @var int
 401       */
 402      var $first_user;
 403  
 404      /**
 405       * {@internal Missing Description}}
 406       *
 407       * @since 2.1.0
 408       * @access private
 409       * @var int
 410       */
 411      var $last_user;
 412  
 413      /**
 414       * {@internal Missing Description}}
 415       *
 416       * @since 2.1.0
 417       * @access private
 418       * @var string
 419       */
 420      var $query_limit;
 421  
 422      /**
 423       * {@internal Missing Description}}
 424       *
 425       * @since 3.0.0
 426       * @access private
 427       * @var string
 428       */
 429      var $query_orderby;
 430  
 431      /**
 432       * {@internal Missing Description}}
 433       *
 434       * @since 3.0.0
 435       * @access private
 436       * @var string
 437       */
 438      var $query_from;
 439  
 440      /**
 441       * {@internal Missing Description}}
 442       *
 443       * @since 3.0.0
 444       * @access private
 445       * @var string
 446       */
 447      var $query_where;
 448  
 449      /**
 450       * {@internal Missing Description}}
 451       *
 452       * @since 2.1.0
 453       * @access private
 454       * @var int
 455       */
 456      var $total_users_for_query = 0;
 457  
 458      /**
 459       * {@internal Missing Description}}
 460       *
 461       * @since 2.1.0
 462       * @access private
 463       * @var bool
 464       */
 465      var $too_many_total_users = false;
 466  
 467      /**
 468       * {@internal Missing Description}}
 469       *
 470       * @since 2.1.0
 471       * @access private
 472       * @var WP_Error
 473       */
 474      var $search_errors;
 475  
 476      /**
 477       * {@internal Missing Description}}
 478       *
 479       * @since 2.7.0
 480       * @access private
 481       * @var string
 482       */
 483      var $paging_text;
 484  
 485      /**
 486       * PHP5 Constructor - Sets up the object properties.
 487       *
 488       * @since 2.1.0
 489       *
 490       * @param string $search_term Search terms string.
 491       * @param int $page Optional. Page ID.
 492       * @param string $role Role name.
 493       * @return WP_User_Search
 494       */
 495  	function __construct( $search_term = '', $page = '', $role = '' ) {
 496          _deprecated_class( 'WP_User_Search', '3.1.0', 'WP_User_Query' );
 497  
 498          $this->search_term = wp_unslash( $search_term );
 499          $this->raw_page = ( '' == $page ) ? false : (int) $page;
 500          $this->page = ( '' == $page ) ? 1 : (int) $page;
 501          $this->role = $role;
 502  
 503          $this->prepare_query();
 504          $this->query();
 505          $this->do_paging();
 506      }
 507  
 508      /**
 509       * PHP4 Constructor - Sets up the object properties.
 510       *
 511       * @since 2.1.0
 512       *
 513       * @param string $search_term Search terms string.
 514       * @param int $page Optional. Page ID.
 515       * @param string $role Role name.
 516       * @return WP_User_Search
 517       */
 518  	public function WP_User_Search( $search_term = '', $page = '', $role = '' ) {
 519          _deprecated_constructor( 'WP_User_Search', '3.1.0', get_class( $this ) );
 520          self::__construct( $search_term, $page, $role );
 521      }
 522  
 523      /**
 524       * Prepares the user search query (legacy).
 525       *
 526       * @since 2.1.0
 527       * @access public
 528       *
 529       * @global wpdb $wpdb WordPress database abstraction object.
 530       */
 531  	public function prepare_query() {
 532          global $wpdb;
 533          $this->first_user = ($this->page - 1) * $this->users_per_page;
 534  
 535          $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
 536          $this->query_orderby = ' ORDER BY user_login';
 537  
 538          $search_sql = '';
 539          if ( $this->search_term ) {
 540              $searches = array();
 541              $search_sql = 'AND (';
 542              foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
 543                  $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
 544              $search_sql .= implode(' OR ', $searches);
 545              $search_sql .= ')';
 546          }
 547  
 548          $this->query_from = " FROM $wpdb->users";
 549          $this->query_where = " WHERE 1=1 $search_sql";
 550  
 551          if ( $this->role ) {
 552              $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
 553              $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
 554          } elseif ( is_multisite() ) {
 555              $level_key = $wpdb->prefix . 'capabilities'; // WPMU site admins don't have user_levels.
 556              $this->query_from .= ", $wpdb->usermeta";
 557              $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
 558          }
 559  
 560          do_action_ref_array( 'pre_user_search', array( &$this ) );
 561      }
 562  
 563      /**
 564       * Executes the user search query.
 565       *
 566       * @since 2.1.0
 567       * @access public
 568       *
 569       * @global wpdb $wpdb WordPress database abstraction object.
 570       */
 571  	public function query() {
 572          global $wpdb;
 573  
 574          $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
 575  
 576          if ( $this->results )
 577              $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // No limit.
 578          else
 579              $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
 580      }
 581  
 582      /**
 583       * Prepares variables for use in templates.
 584       *
 585       * @since 2.1.0
 586       * @access public
 587       */
 588  	function prepare_vars_for_template_usage() {}
 589  
 590      /**
 591       * Handles paging for the user search query.
 592       *
 593       * @since 2.1.0
 594       * @access public
 595       */
 596  	public function do_paging() {
 597          if ( $this->total_users_for_query > $this->users_per_page ) { // Have to page the results.
 598              $args = array();
 599              if ( ! empty($this->search_term) )
 600                  $args['usersearch'] = urlencode($this->search_term);
 601              if ( ! empty($this->role) )
 602                  $args['role'] = urlencode($this->role);
 603  
 604              $this->paging_text = paginate_links( array(
 605                  'total' => ceil($this->total_users_for_query / $this->users_per_page),
 606                  'current' => $this->page,
 607                  'base' => 'users.php?%_%',
 608                  'format' => 'userspage=%#%',
 609                  'add_args' => $args
 610              ) );
 611              if ( $this->paging_text ) {
 612                  $this->paging_text = sprintf(
 613                      /* translators: 1: Starting number of users on the current page, 2: Ending number of users, 3: Total number of users. */
 614                      '<span class="displaying-num">' . __( 'Displaying %1$s&#8211;%2$s of %3$s' ) . '</span>%s',
 615                      number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
 616                      number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
 617                      number_format_i18n( $this->total_users_for_query ),
 618                      $this->paging_text
 619                  );
 620              }
 621          }
 622      }
 623  
 624      /**
 625       * Retrieves the user search query results.
 626       *
 627       * @since 2.1.0
 628       * @access public
 629       *
 630       * @return array
 631       */
 632  	public function get_results() {
 633          return (array) $this->results;
 634      }
 635  
 636      /**
 637       * Displaying paging text.
 638       *
 639       * @see do_paging() Builds paging text.
 640       *
 641       * @since 2.1.0
 642       * @access public
 643       */
 644  	function page_links() {
 645          echo $this->paging_text;
 646      }
 647  
 648      /**
 649       * Whether paging is enabled.
 650       *
 651       * @see do_paging() Builds paging text.
 652       *
 653       * @since 2.1.0
 654       * @access public
 655       *
 656       * @return bool
 657       */
 658  	function results_are_paged() {
 659          if ( $this->paging_text )
 660              return true;
 661          return false;
 662      }
 663  
 664      /**
 665       * Whether there are search terms.
 666       *
 667       * @since 2.1.0
 668       * @access public
 669       *
 670       * @return bool
 671       */
 672  	function is_search() {
 673          if ( $this->search_term )
 674              return true;
 675          return false;
 676      }
 677  }
 678  endif;
 679  
 680  /**
 681   * Retrieves editable posts from other users.
 682   *
 683   * @since 2.3.0
 684   * @deprecated 3.1.0 Use get_posts()
 685   * @see get_posts()
 686   *
 687   * @global wpdb $wpdb WordPress database abstraction object.
 688   *
 689   * @param int    $user_id User ID to not retrieve posts from.
 690   * @param string $type    Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all).
 691   *                        Default 'any'.
 692   * @return array List of posts from others.
 693   */
 694  function get_others_unpublished_posts( $user_id, $type = 'any' ) {
 695      _deprecated_function( __FUNCTION__, '3.1.0' );
 696  
 697      global $wpdb;
 698  
 699      $editable = get_editable_user_ids( $user_id );
 700  
 701      if ( in_array($type, array('draft', 'pending')) )
 702          $type_sql = " post_status = '$type' ";
 703      else
 704          $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
 705  
 706      $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
 707  
 708      if ( !$editable ) {
 709          $other_unpubs = '';
 710      } else {
 711          $editable = join(',', $editable);
 712          $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) );
 713      }
 714  
 715      return apply_filters('get_others_drafts', $other_unpubs);
 716  }
 717  
 718  /**
 719   * Retrieve drafts from other users.
 720   *
 721   * @deprecated 3.1.0 Use get_posts()
 722   * @see get_posts()
 723   *
 724   * @param int $user_id User ID.
 725   * @return array List of drafts from other users.
 726   */
 727  function get_others_drafts($user_id) {
 728      _deprecated_function( __FUNCTION__, '3.1.0' );
 729  
 730      return get_others_unpublished_posts($user_id, 'draft');
 731  }
 732  
 733  /**
 734   * Retrieve pending review posts from other users.
 735   *
 736   * @deprecated 3.1.0 Use get_posts()
 737   * @see get_posts()
 738   *
 739   * @param int $user_id User ID.
 740   * @return array List of posts with pending review post type from other users.
 741   */
 742  function get_others_pending($user_id) {
 743      _deprecated_function( __FUNCTION__, '3.1.0' );
 744  
 745      return get_others_unpublished_posts($user_id, 'pending');
 746  }
 747  
 748  /**
 749   * Output the QuickPress dashboard widget.
 750   *
 751   * @since 3.0.0
 752   * @deprecated 3.2.0 Use wp_dashboard_quick_press()
 753   * @see wp_dashboard_quick_press()
 754   */
 755  function wp_dashboard_quick_press_output() {
 756      _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' );
 757      wp_dashboard_quick_press();
 758  }
 759  
 760  /**
 761   * Outputs the TinyMCE editor.
 762   *
 763   * @since 2.7.0
 764   * @deprecated 3.3.0 Use wp_editor()
 765   * @see wp_editor()
 766   */
 767  function wp_tiny_mce( $teeny = false, $settings = false ) {
 768      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
 769  
 770      static $num = 1;
 771  
 772      if ( ! class_exists( '_WP_Editors', false ) )
 773          require_once  ABSPATH . WPINC . '/class-wp-editor.php';
 774  
 775      $editor_id = 'content' . $num++;
 776  
 777      $set = array(
 778          'teeny' => $teeny,
 779          'tinymce' => $settings ? $settings : true,
 780          'quicktags' => false
 781      );
 782  
 783      $set = _WP_Editors::parse_settings($editor_id, $set);
 784      _WP_Editors::editor_settings($editor_id, $set);
 785  }
 786  
 787  /**
 788   * Preloads TinyMCE dialogs.
 789   *
 790   * @deprecated 3.3.0 Use wp_editor()
 791   * @see wp_editor()
 792   */
 793  function wp_preload_dialogs() {
 794      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
 795  }
 796  
 797  /**
 798   * Prints TinyMCE editor JS.
 799   *
 800   * @deprecated 3.3.0 Use wp_editor()
 801   * @see wp_editor()
 802   */
 803  function wp_print_editor_js() {
 804      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
 805  }
 806  
 807  /**
 808   * Handles quicktags.
 809   *
 810   * @deprecated 3.3.0 Use wp_editor()
 811   * @see wp_editor()
 812   */
 813  function wp_quicktags() {
 814      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
 815  }
 816  
 817  /**
 818   * Returns the screen layout options.
 819   *
 820   * @since 2.8.0
 821   * @deprecated 3.3.0 WP_Screen::render_screen_layout()
 822   * @see WP_Screen::render_screen_layout()
 823   */
 824  function screen_layout( $screen ) {
 825      _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );
 826  
 827      $current_screen = get_current_screen();
 828  
 829      if ( ! $current_screen )
 830          return '';
 831  
 832      ob_start();
 833      $current_screen->render_screen_layout();
 834      return ob_get_clean();
 835  }
 836  
 837  /**
 838   * Returns the screen's per-page options.
 839   *
 840   * @since 2.8.0
 841   * @deprecated 3.3.0 Use WP_Screen::render_per_page_options()
 842   * @see WP_Screen::render_per_page_options()
 843   */
 844  function screen_options( $screen ) {
 845      _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
 846  
 847      $current_screen = get_current_screen();
 848  
 849      if ( ! $current_screen )
 850          return '';
 851  
 852      ob_start();
 853      $current_screen->render_per_page_options();
 854      return ob_get_clean();
 855  }
 856  
 857  /**
 858   * Renders the screen's help.
 859   *
 860   * @since 2.7.0
 861   * @deprecated 3.3.0 Use WP_Screen::render_screen_meta()
 862   * @see WP_Screen::render_screen_meta()
 863   */
 864  function screen_meta( $screen ) {
 865      $current_screen = get_current_screen();
 866      $current_screen->render_screen_meta();
 867  }
 868  
 869  /**
 870   * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
 871   *
 872   * @since 2.7.0
 873   * @deprecated 3.2.0 Use WP_Admin_Bar
 874   * @see WP_Admin_Bar
 875   */
 876  function favorite_actions() {
 877      _deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' );
 878  }
 879  
 880  /**
 881   * Handles uploading an image.
 882   *
 883   * @deprecated 3.3.0 Use wp_media_upload_handler()
 884   * @see wp_media_upload_handler()
 885   *
 886   * @return null|string
 887   */
 888  function media_upload_image() {
 889      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
 890      return wp_media_upload_handler();
 891  }
 892  
 893  /**
 894   * Handles uploading an audio file.
 895   *
 896   * @deprecated 3.3.0 Use wp_media_upload_handler()
 897   * @see wp_media_upload_handler()
 898   *
 899   * @return null|string
 900   */
 901  function media_upload_audio() {
 902      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
 903      return wp_media_upload_handler();
 904  }
 905  
 906  /**
 907   * Handles uploading a video file.
 908   *
 909   * @deprecated 3.3.0 Use wp_media_upload_handler()
 910   * @see wp_media_upload_handler()
 911   *
 912   * @return null|string
 913   */
 914  function media_upload_video() {
 915      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
 916      return wp_media_upload_handler();
 917  }
 918  
 919  /**
 920   * Handles uploading a generic file.
 921   *
 922   * @deprecated 3.3.0 Use wp_media_upload_handler()
 923   * @see wp_media_upload_handler()
 924   *
 925   * @return null|string
 926   */
 927  function media_upload_file() {
 928      _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
 929      return wp_media_upload_handler();
 930  }
 931  
 932  /**
 933   * Handles retrieving the insert-from-URL form for an image.
 934   *
 935   * @deprecated 3.3.0 Use wp_media_insert_url_form()
 936   * @see wp_media_insert_url_form()
 937   *
 938   * @return string
 939   */
 940  function type_url_form_image() {
 941      _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" );
 942      return wp_media_insert_url_form( 'image' );
 943  }
 944  
 945  /**
 946   * Handles retrieving the insert-from-URL form for an audio file.
 947   *
 948   * @deprecated 3.3.0 Use wp_media_insert_url_form()
 949   * @see wp_media_insert_url_form()
 950   *
 951   * @return string
 952   */
 953  function type_url_form_audio() {
 954      _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" );
 955      return wp_media_insert_url_form( 'audio' );
 956  }
 957  
 958  /**
 959   * Handles retrieving the insert-from-URL form for a video file.
 960   *
 961   * @deprecated 3.3.0 Use wp_media_insert_url_form()
 962   * @see wp_media_insert_url_form()
 963   *
 964   * @return string
 965   */
 966  function type_url_form_video() {
 967      _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" );
 968      return wp_media_insert_url_form( 'video' );
 969  }
 970  
 971  /**
 972   * Handles retrieving the insert-from-URL form for a generic file.
 973   *
 974   * @deprecated 3.3.0 Use wp_media_insert_url_form()
 975   * @see wp_media_insert_url_form()
 976   *
 977   * @return string
 978   */
 979  function type_url_form_file() {
 980      _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" );
 981      return wp_media_insert_url_form( 'file' );
 982  }
 983  
 984  /**
 985   * Add contextual help text for a page.
 986   *
 987   * Creates an 'Overview' help tab.
 988   *
 989   * @since 2.7.0
 990   * @deprecated 3.3.0 Use WP_Screen::add_help_tab()
 991   * @see WP_Screen::add_help_tab()
 992   *
 993   * @param string    $screen The handle for the screen to add help to. This is usually
 994   *                          the hook name returned by the `add_*_page()` functions.
 995   * @param string    $help   The content of an 'Overview' help tab.
 996   */
 997  function add_contextual_help( $screen, $help ) {
 998      _deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
 999  
1000      if ( is_string( $screen ) )
1001          $screen = convert_to_screen( $screen );
1002  
1003      WP_Screen::add_old_compat_help( $screen, $help );
1004  }
1005  
1006  /**
1007   * Get the allowed themes for the current site.
1008   *
1009   * @since 3.0.0
1010   * @deprecated 3.4.0 Use wp_get_themes()
1011   * @see wp_get_themes()
1012   *
1013   * @return WP_Theme[] Array of WP_Theme objects keyed by their name.
1014   */
1015  function get_allowed_themes() {
1016      _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );
1017  
1018      $themes = wp_get_themes( array( 'allowed' => true ) );
1019  
1020      $wp_themes = array();
1021      foreach ( $themes as $theme ) {
1022          $wp_themes[ $theme->get('Name') ] = $theme;
1023      }
1024  
1025      return $wp_themes;
1026  }
1027  
1028  /**
1029   * Retrieves a list of broken themes.
1030   *
1031   * @since 1.5.0
1032   * @deprecated 3.4.0 Use wp_get_themes()
1033   * @see wp_get_themes()
1034   *
1035   * @return array
1036   */
1037  function get_broken_themes() {
1038      _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" );
1039  
1040      $themes = wp_get_themes( array( 'errors' => true ) );
1041      $broken = array();
1042      foreach ( $themes as $theme ) {
1043          $name = $theme->get('Name');
1044          $broken[ $name ] = array(
1045              'Name' => $name,
1046              'Title' => $name,
1047              'Description' => $theme->errors()->get_error_message(),
1048          );
1049      }
1050      return $broken;
1051  }
1052  
1053  /**
1054   * Retrieves information on the current active theme.
1055   *
1056   * @since 2.0.0
1057   * @deprecated 3.4.0 Use wp_get_theme()
1058   * @see wp_get_theme()
1059   *
1060   * @return WP_Theme
1061   */
1062  function current_theme_info() {
1063      _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
1064  
1065      return wp_get_theme();
1066  }
1067  
1068  /**
1069   * This was once used to display an 'Insert into Post' button.
1070   *
1071   * Now it is deprecated and stubbed.
1072   *
1073   * @deprecated 3.5.0
1074   */
1075  function _insert_into_post_button( $type ) {
1076      _deprecated_function( __FUNCTION__, '3.5.0' );
1077  }
1078  
1079  /**
1080   * This was once used to display a media button.
1081   *
1082   * Now it is deprecated and stubbed.
1083   *
1084   * @deprecated 3.5.0
1085   */
1086  function _media_button($title, $icon, $type, $id) {
1087      _deprecated_function( __FUNCTION__, '3.5.0' );
1088  }
1089  
1090  /**
1091   * Gets an existing post and format it for editing.
1092   *
1093   * @since 2.0.0
1094   * @deprecated 3.5.0 Use get_post()
1095   * @see get_post()
1096   *
1097   * @param int $id
1098   * @return WP_Post
1099   */
1100  function get_post_to_edit( $id ) {
1101      _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
1102  
1103      return get_post( $id, OBJECT, 'edit' );
1104  }
1105  
1106  /**
1107   * Gets the default page information to use.
1108   *
1109   * @since 2.5.0
1110   * @deprecated 3.5.0 Use get_default_post_to_edit()
1111   * @see get_default_post_to_edit()
1112   *
1113   * @return WP_Post Post object containing all the default post data as attributes
1114   */
1115  function get_default_page_to_edit() {
1116      _deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" );
1117  
1118      $page = get_default_post_to_edit();
1119      $page->post_type = 'page';
1120      return $page;
1121  }
1122  
1123  /**
1124   * This was once used to create a thumbnail from an Image given a maximum side size.
1125   *
1126   * @since 1.2.0
1127   * @deprecated 3.5.0 Use image_resize()
1128   * @see image_resize()
1129   *
1130   * @param mixed $file Filename of the original image, Or attachment ID.
1131   * @param int $max_side Maximum length of a single side for the thumbnail.
1132   * @param mixed $deprecated Never used.
1133   * @return string Thumbnail path on success, Error string on failure.
1134   */
1135  function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
1136      _deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' );
1137      return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
1138  }
1139  
1140  /**
1141   * This was once used to display a meta box for the nav menu theme locations.
1142   *
1143   * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
1144   *
1145   * @since 3.0.0
1146   * @deprecated 3.6.0
1147   */
1148  function wp_nav_menu_locations_meta_box() {
1149      _deprecated_function( __FUNCTION__, '3.6.0' );
1150  }
1151  
1152  /**
1153   * This was once used to kick-off the Core Updater.
1154   *
1155   * Deprecated in favor of instantiating a Core_Upgrader instance directly,
1156   * and calling the 'upgrade' method.
1157   *
1158   * @since 2.7.0
1159   * @deprecated 3.7.0 Use Core_Upgrader
1160   * @see Core_Upgrader
1161   */
1162  function wp_update_core($current, $feedback = '') {
1163      _deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' );
1164  
1165      if ( !empty($feedback) )
1166          add_filter('update_feedback', $feedback);
1167  
1168      require  ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1169      $upgrader = new Core_Upgrader();
1170      return $upgrader->upgrade($current);
1171  
1172  }
1173  
1174  /**
1175   * This was once used to kick-off the Plugin Updater.
1176   *
1177   * Deprecated in favor of instantiating a Plugin_Upgrader instance directly,
1178   * and calling the 'upgrade' method.
1179   * Unused since 2.8.0.
1180   *
1181   * @since 2.5.0
1182   * @deprecated 3.7.0 Use Plugin_Upgrader
1183   * @see Plugin_Upgrader
1184   */
1185  function wp_update_plugin($plugin, $feedback = '') {
1186      _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' );
1187  
1188      if ( !empty($feedback) )
1189          add_filter('update_feedback', $feedback);
1190  
1191      require  ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1192      $upgrader = new Plugin_Upgrader();
1193      return $upgrader->upgrade($plugin);
1194  }
1195  
1196  /**
1197   * This was once used to kick-off the Theme Updater.
1198   *
1199   * Deprecated in favor of instantiating a Theme_Upgrader instance directly,
1200   * and calling the 'upgrade' method.
1201   * Unused since 2.8.0.
1202   *
1203   * @since 2.7.0
1204   * @deprecated 3.7.0 Use Theme_Upgrader
1205   * @see Theme_Upgrader
1206   */
1207  function wp_update_theme($theme, $feedback = '') {
1208      _deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' );
1209  
1210      if ( !empty($feedback) )
1211          add_filter('update_feedback', $feedback);
1212  
1213      require  ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1214      $upgrader = new Theme_Upgrader();
1215      return $upgrader->upgrade($theme);
1216  }
1217  
1218  /**
1219   * This was once used to display attachment links. Now it is deprecated and stubbed.
1220   *
1221   * @since 2.0.0
1222   * @deprecated 3.7.0
1223   *
1224   * @param int|bool $id
1225   */
1226  function the_attachment_links( $id = false ) {
1227      _deprecated_function( __FUNCTION__, '3.7.0' );
1228  }
1229  
1230  /**
1231   * Displays a screen icon.
1232   *
1233   * @since 2.7.0
1234   * @deprecated 3.8.0
1235   */
1236  function screen_icon() {
1237      _deprecated_function( __FUNCTION__, '3.8.0' );
1238      echo get_screen_icon();
1239  }
1240  
1241  /**
1242   * Retrieves the screen icon (no longer used in 3.8+).
1243   *
1244   * @since 3.2.0
1245   * @deprecated 3.8.0
1246   *
1247   * @return string An HTML comment explaining that icons are no longer used.
1248   */
1249  function get_screen_icon() {
1250      _deprecated_function( __FUNCTION__, '3.8.0' );
1251      return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
1252  }
1253  
1254  /**
1255   * Deprecated dashboard widget controls.
1256   *
1257   * @since 2.5.0
1258   * @deprecated 3.8.0
1259   */
1260  function wp_dashboard_incoming_links_output() {}
1261  
1262  /**
1263   * Deprecated dashboard secondary output.
1264   *
1265   * @deprecated 3.8.0
1266   */
1267  function wp_dashboard_secondary_output() {}
1268  
1269  /**
1270   * Deprecated dashboard widget controls.
1271   *
1272   * @since 2.7.0
1273   * @deprecated 3.8.0
1274   */
1275  function wp_dashboard_incoming_links() {}
1276  
1277  /**
1278   * Deprecated dashboard incoming links control.
1279   *
1280   * @deprecated 3.8.0
1281   */
1282  function wp_dashboard_incoming_links_control() {}
1283  
1284  /**
1285   * Deprecated dashboard plugins control.
1286   *
1287   * @deprecated 3.8.0
1288   */
1289  function wp_dashboard_plugins() {}
1290  
1291  /**
1292   * Deprecated dashboard primary control.
1293   *
1294   * @deprecated 3.8.0
1295   */
1296  function wp_dashboard_primary_control() {}
1297  
1298  /**
1299   * Deprecated dashboard recent comments control.
1300   *
1301   * @deprecated 3.8.0
1302   */
1303  function wp_dashboard_recent_comments_control() {}
1304  
1305  /**
1306   * Deprecated dashboard secondary section.
1307   *
1308   * @deprecated 3.8.0
1309   */
1310  function wp_dashboard_secondary() {}
1311  
1312  /**
1313   * Deprecated dashboard secondary control.
1314   *
1315   * @deprecated 3.8.0
1316   */
1317  function wp_dashboard_secondary_control() {}
1318  
1319  /**
1320   * Display plugins text for the WordPress news widget.
1321   *
1322   * @since 2.5.0
1323   * @deprecated 4.8.0
1324   *
1325   * @param string $rss  The RSS feed URL.
1326   * @param array  $args Array of arguments for this RSS feed.
1327   */
1328  function wp_dashboard_plugins_output( $rss, $args = array() ) {
1329      _deprecated_function( __FUNCTION__, '4.8.0' );
1330  
1331      // Plugin feeds plus link to install them.
1332      $popular = fetch_feed( $args['url']['popular'] );
1333  
1334      if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
1335          $plugin_slugs = array_keys( get_plugins() );
1336          set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
1337      }
1338  
1339      echo '<ul>';
1340  
1341      foreach ( array( $popular ) as $feed ) {
1342          if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1343              continue;
1344  
1345          $items = $feed->get_items(0, 5);
1346  
1347          // Pick a random, non-installed plugin.
1348          while ( true ) {
1349              // Abort this foreach loop iteration if there's no plugins left of this type.
1350              if ( 0 === count($items) )
1351                  continue 2;
1352  
1353              $item_key = array_rand($items);
1354              $item = $items[$item_key];
1355  
1356              list($link, $frag) = explode( '#', $item->get_link() );
1357  
1358              $link = esc_url($link);
1359              if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1360                  $slug = $matches[1];
1361              else {
1362                  unset( $items[$item_key] );
1363                  continue;
1364              }
1365  
1366              // Is this random plugin's slug already installed? If so, try again.
1367              reset( $plugin_slugs );
1368              foreach ( $plugin_slugs as $plugin_slug ) {
1369                  if ( str_starts_with( $plugin_slug, $slug ) ) {
1370                      unset( $items[$item_key] );
1371                      continue 2;
1372                  }
1373              }
1374  
1375              // If we get to this point, then the random plugin isn't installed and we can stop the while().
1376              break;
1377          }
1378  
1379          // Eliminate some common badly formed plugin descriptions.
1380          while ( ( null !== $item_key = array_rand($items) ) && str_contains( $items[$item_key]->get_description(), 'Plugin Name:' ) )
1381              unset($items[$item_key]);
1382  
1383          if ( !isset($items[$item_key]) )
1384              continue;
1385  
1386          $raw_title = $item->get_title();
1387  
1388          $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';
1389          echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
1390              '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
1391              /* translators: %s: Plugin name. */
1392              esc_attr( sprintf( _x( 'Install %s', 'plugin' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
1393  
1394          $feed->__destruct();
1395          unset( $feed );
1396      }
1397  
1398      echo '</ul>';
1399  }
1400  
1401  /**
1402   * This was once used to move child posts to a new parent.
1403   *
1404   * @since 2.3.0
1405   * @deprecated 3.9.0
1406   * @access private
1407   *
1408   * @param int $old_ID
1409   * @param int $new_ID
1410   */
1411  function _relocate_children( $old_ID, $new_ID ) {
1412      _deprecated_function( __FUNCTION__, '3.9.0' );
1413  }
1414  
1415  /**
1416   * Add a top-level menu page in the 'objects' section.
1417   *
1418   * This function takes a capability which will be used to determine whether
1419   * or not a page is included in the menu.
1420   *
1421   * The function which is hooked in to handle the output of the page must check
1422   * that the user has the required capability as well.
1423   *
1424   * @since 2.7.0
1425   *
1426   * @deprecated 4.5.0 Use add_menu_page()
1427   * @see add_menu_page()
1428   * @global int $_wp_last_object_menu
1429   *
1430   * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
1431   * @param string   $menu_title The text to be used for the menu.
1432   * @param string   $capability The capability required for this menu to be displayed to the user.
1433   * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
1434   * @param callable $callback   Optional. The function to be called to output the content for this page.
1435   * @param string   $icon_url   Optional. The URL to the icon to be used for this menu.
1436   * @return string The resulting page's hook_suffix.
1437   */
1438  function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') {
1439      _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
1440  
1441      global $_wp_last_object_menu;
1442  
1443      $_wp_last_object_menu++;
1444  
1445      return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_object_menu);
1446  }
1447  
1448  /**
1449   * Add a top-level menu page in the 'utility' section.
1450   *
1451   * This function takes a capability which will be used to determine whether
1452   * or not a page is included in the menu.
1453   *
1454   * The function which is hooked in to handle the output of the page must check
1455   * that the user has the required capability as well.
1456   *
1457   * @since 2.7.0
1458   *
1459   * @deprecated 4.5.0 Use add_menu_page()
1460   * @see add_menu_page()
1461   * @global int $_wp_last_utility_menu
1462   *
1463   * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
1464   * @param string   $menu_title The text to be used for the menu.
1465   * @param string   $capability The capability required for this menu to be displayed to the user.
1466   * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
1467   * @param callable $callback   Optional. The function to be called to output the content for this page.
1468   * @param string   $icon_url   Optional. The URL to the icon to be used for this menu.
1469   * @return string The resulting page's hook_suffix.
1470   */
1471  function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') {
1472      _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
1473  
1474      global $_wp_last_utility_menu;
1475  
1476      $_wp_last_utility_menu++;
1477  
1478      return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_utility_menu);
1479  }
1480  
1481  /**
1482   * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
1483   * as they disregard the autocomplete setting on the editor textarea. That can break the editor
1484   * when the user navigates to it with the browser's Back button. See #28037
1485   *
1486   * Replaced with wp_page_reload_on_back_button_js() that also fixes this problem.
1487   *
1488   * @since 4.0.0
1489   * @deprecated 4.6.0
1490   *
1491   * @link https://core.trac.wordpress.org/ticket/35852
1492   *
1493   * @global bool $is_safari
1494   * @global bool $is_chrome
1495   */
1496  function post_form_autocomplete_off() {
1497      global $is_safari, $is_chrome;
1498  
1499      _deprecated_function( __FUNCTION__, '4.6.0' );
1500  
1501      if ( $is_safari || $is_chrome ) {
1502          echo ' autocomplete="off"';
1503      }
1504  }
1505  
1506  /**
1507   * Display JavaScript on the page.
1508   *
1509   * @since 3.5.0
1510   * @deprecated 4.9.0
1511   */
1512  function options_permalink_add_js() {
1513      ?>
1514      <script type="text/javascript">
1515          jQuery( function() {
1516              jQuery('.permalink-structure input:radio').change(function() {
1517                  if ( 'custom' == this.value )
1518                      return;
1519                  jQuery('#permalink_structure').val( this.value );
1520              });
1521              jQuery( '#permalink_structure' ).on( 'click input', function() {
1522                  jQuery( '#custom_selection' ).prop( 'checked', true );
1523              });
1524          } );
1525      </script>
1526      <?php
1527  }
1528  
1529  /**
1530   * Previous class for list table for privacy data export requests.
1531   *
1532   * @since 4.9.6
1533   * @deprecated 5.3.0
1534   */
1535  class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Data_Export_Requests_List_Table {
1536  	function __construct( $args ) {
1537          _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Export_Requests_List_Table' );
1538  
1539          if ( ! isset( $args['screen'] ) || $args['screen'] === 'export_personal_data' ) {
1540              $args['screen'] = 'export-personal-data';
1541          }
1542  
1543          parent::__construct( $args );
1544      }
1545  }
1546  
1547  /**
1548   * Previous class for list table for privacy data erasure requests.
1549   *
1550   * @since 4.9.6
1551   * @deprecated 5.3.0
1552   */
1553  class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Data_Removal_Requests_List_Table {
1554  	function __construct( $args ) {
1555          _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Removal_Requests_List_Table' );
1556  
1557          if ( ! isset( $args['screen'] ) || $args['screen'] === 'remove_personal_data' ) {
1558              $args['screen'] = 'erase-personal-data';
1559          }
1560  
1561          parent::__construct( $args );
1562      }
1563  }
1564  
1565  /**
1566   * Was used to add options for the privacy requests screens before they were separate files.
1567   *
1568   * @since 4.9.8
1569   * @access private
1570   * @deprecated 5.3.0
1571   */
1572  function _wp_privacy_requests_screen_options() {
1573      _deprecated_function( __FUNCTION__, '5.3.0' );
1574  }
1575  
1576  /**
1577   * Was used to filter input from media_upload_form_handler() and to assign a default
1578   * post_title from the file name if none supplied.
1579   *
1580   * @since 2.5.0
1581   * @deprecated 6.0.0
1582   *
1583   * @param array $post       The WP_Post attachment object converted to an array.
1584   * @param array $attachment An array of attachment metadata.
1585   * @return array Attachment post object converted to an array.
1586   */
1587  function image_attachment_fields_to_save( $post, $attachment ) {
1588      _deprecated_function( __FUNCTION__, '6.0.0' );
1589  
1590      return $post;
1591  }


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref