home *** CD-ROM | disk | FTP | other *** search
/ HTML Examples / WP.iso / wordpress / wp-admin / includes / deprecated.php < prev    next >
Encoding:
PHP Script  |  2017-09-26  |  38.3 KB  |  1,517 lines

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