2010-01-25 19:50:01 +01:00
< ? php
2010-01-25 20:46:24 +01:00
/**
* Deprecated admin functions from past WordPress versions . You shouldn ' t use these
2010-01-27 15:10:32 +01:00
* functions and look for the alternatives instead . The functions will be removed
* in a later version .
2010-01-25 20:46:24 +01:00
*
* @ package WordPress
* @ subpackage Deprecated
*/
2010-01-25 19:50:01 +01:00
2010-01-27 15:10:32 +01:00
/*
* Deprecated functions come here to die .
*/
/**
2013-09-02 13:19:10 +02:00
* @ since 2.1 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 2.1 . 0 Use wp_editor ()
2011-08-03 12:19:00 +02:00
* @ see wp_editor ()
2010-01-27 15:10:32 +01:00
*/
function tinymce_include () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '2.1.0' , 'wp_editor()' );
2010-01-27 15:10:32 +01:00
2011-11-22 22:47:01 +01:00
wp_tiny_mce ();
2010-01-27 15:10:32 +01:00
}
/**
* Unused Admin function .
*
2013-09-02 13:19:10 +02:00
* @ since 2.0 . 0
* @ deprecated 2.5 . 0
2010-01-27 15:10:32 +01:00
*
*/
function documentation_link () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '2.5.0' );
2010-01-27 15:10:32 +01:00
}
2010-01-25 19:50:01 +01:00
/**
2011-09-03 16:18:10 +02:00
* Calculates the new dimensions for a downsampled image .
2010-01-25 19:50:01 +01:00
*
* @ since 2.0 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.0 . 0 Use wp_constrain_dimensions ()
2012-09-13 19:09:41 +02:00
* @ see wp_constrain_dimensions ()
2010-01-25 19:50:01 +01:00
*
* @ param int $width Current width of the image
* @ param int $height Current height of the image
* @ param int $wmax Maximum wanted width
* @ param int $hmax Maximum wanted height
2012-09-13 19:09:41 +02:00
* @ return array Shrunk dimensions ( width , height ) .
2010-01-25 19:50:01 +01:00
*/
function wp_shrink_dimensions ( $width , $height , $wmax = 128 , $hmax = 96 ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.0.0' , 'wp_constrain_dimensions()' );
2010-01-25 19:50:01 +01:00
return wp_constrain_dimensions ( $width , $height , $wmax , $hmax );
}
2012-09-11 03:38:26 +02:00
/**
* Calculated the new dimensions for a downsampled image .
*
* @ since 2.0 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.5 . 0 Use wp_constrain_dimensions ()
2012-09-11 03:38:26 +02:00
* @ see wp_constrain_dimensions ()
*
* @ param int $width Current width of the image
* @ param int $height Current height of the image
2012-09-13 19:09:41 +02:00
* @ return array Shrunk dimensions ( width , height ) .
2012-09-11 03:38:26 +02:00
*/
function get_udims ( $width , $height ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.5.0' , 'wp_constrain_dimensions()' );
2012-09-11 03:38:26 +02:00
return wp_constrain_dimensions ( $width , $height , 128 , 96 );
}
2010-02-13 08:42:02 +01:00
/**
2015-10-05 04:29:26 +02:00
* Legacy function used to generate the categories checklist control .
2010-02-13 08:42:02 +01:00
*
2010-12-20 10:25:21 +01:00
* @ since 0.71
2015-08-20 23:23:25 +02:00
* @ deprecated 2.6 . 0 Use wp_category_checklist ()
2010-02-13 08:42:02 +01:00
* @ see wp_category_checklist ()
*
2015-10-05 04:29:26 +02:00
* @ param int $default Unused .
* @ param int $parent Unused .
* @ param array $popular_ids Unused .
2010-02-13 08:42:02 +01:00
*/
function dropdown_categories ( $default = 0 , $parent = 0 , $popular_ids = array () ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '2.6.0' , 'wp_category_checklist()' );
2010-02-13 08:42:02 +01:00
global $post_ID ;
wp_category_checklist ( $post_ID );
}
/**
2015-10-05 04:29:26 +02:00
* Legacy function used to generate a link categories checklist control .
2010-02-13 08:42:02 +01:00
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 2.6 . 0 Use wp_link_category_checklist ()
2010-02-13 08:42:02 +01:00
* @ see wp_link_category_checklist ()
*
2015-10-05 04:29:26 +02:00
* @ param int $default Unused .
2010-02-13 08:42:02 +01:00
*/
function dropdown_link_categories ( $default = 0 ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '2.6.0' , 'wp_link_category_checklist()' );
2010-02-13 08:42:02 +01:00
global $link_id ;
wp_link_category_checklist ( $link_id );
}
2013-09-02 13:19:10 +02:00
/**
* Get the real filesystem path to a file to edit within the admin .
*
* @ since 1.5 . 0
* @ deprecated 2.9 . 0
* @ uses WP_CONTENT_DIR Full filesystem path to the wp - content directory .
2013-09-17 11:08:08 +02:00
*
2013-09-02 13:19:10 +02:00
* @ param string $file Filesystem path relative to the wp - content directory .
* @ return string Full filesystem path to edit .
*/
function get_real_file_to_edit ( $file ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '2.9.0' );
2013-09-02 13:19:10 +02:00
return WP_CONTENT_DIR . $file ;
}
2010-02-13 08:42:02 +01:00
/**
2015-10-05 04:29:26 +02:00
* Legacy function used for generating a categories drop - down control .
2010-02-13 08:42:02 +01:00
*
2010-12-20 10:25:21 +01:00
* @ since 1.2 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.0 . 0 Use wp_dropdown_categories ()
2010-02-13 08:42:02 +01:00
* @ see wp_dropdown_categories ()
*
2015-10-05 04:29:26 +02:00
* @ param int $currentcat Optional . ID of the current category . Default 0.
* @ param int $currentparent Optional . Current parent category ID . Default 0.
* @ param int $parent Optional . Parent ID to retrieve categories for . Default 0.
* @ param int $level Optional . Number of levels deep to display . Default 0.
* @ param array $categories Optional . Categories to include in the control . Default 0.
* @ return bool | null False if no categories were found .
2010-02-13 08:42:02 +01:00
*/
function wp_dropdown_cats ( $currentcat = 0 , $currentparent = 0 , $parent = 0 , $level = 0 , $categories = 0 ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.0.0' , 'wp_dropdown_categories()' );
2010-02-13 08:42:02 +01:00
if ( ! $categories )
$categories = get_categories ( array ( 'hide_empty' => 0 ) );
if ( $categories ) {
foreach ( $categories as $category ) {
if ( $currentcat != $category -> term_id && $parent == $category -> parent ) {
$pad = str_repeat ( '– ' , $level );
$category -> name = esc_html ( $category -> name );
echo " \n \t <option value=' $category->term_id ' " ;
if ( $currentparent == $category -> term_id )
echo " selected='selected' " ;
echo " > $pad $category->name </option> " ;
wp_dropdown_cats ( $currentcat , $currentparent , $category -> term_id , $level + 1 , $categories );
}
}
} else {
return false ;
}
}
2010-03-23 00:03:31 +01:00
/**
* Register a setting and its sanitization callback
*
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.0 . 0 Use register_setting ()
2010-03-23 00:03:31 +01:00
* @ see register_setting ()
*
2011-12-14 00:45:31 +01:00
* @ param string $option_group A settings group name . Should correspond to a whitelisted option key name .
2020-02-01 23:01:07 +01:00
* Default whitelisted option key names include 'general' , 'discussion' , 'media' ,
* 'reading' , 'writing' , 'misc' , 'options' , and 'privacy' .
2010-03-23 00:03:31 +01:00
* @ param string $option_name The name of an option to sanitize and save .
2014-11-03 07:08:22 +01:00
* @ param callable $sanitize_callback A callback function that sanitizes the option ' s value .
2010-03-23 00:03:31 +01:00
*/
function add_option_update_handler ( $option_group , $option_name , $sanitize_callback = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.0.0' , 'register_setting()' );
2014-11-03 07:08:22 +01:00
register_setting ( $option_group , $option_name , $sanitize_callback );
2010-03-23 00:03:31 +01:00
}
/**
* Unregister a setting
*
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.0 . 0 Use unregister_setting ()
2010-03-23 00:03:31 +01:00
* @ see unregister_setting ()
*
2014-11-03 07:08:22 +01:00
* @ param string $option_group
* @ param string $option_name
* @ param callable $sanitize_callback
2010-03-23 00:03:31 +01:00
*/
function remove_option_update_handler ( $option_group , $option_name , $sanitize_callback = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.0.0' , 'unregister_setting()' );
2014-11-03 07:08:22 +01:00
unregister_setting ( $option_group , $option_name , $sanitize_callback );
2010-03-23 00:03:31 +01:00
}
2010-05-18 05:48:22 +02:00
/**
* Determines the language to use for CodePress syntax highlighting .
*
* @ since 2.8 . 0
* @ deprecated 3.0 . 0
*
* @ param string $filename
**/
function codepress_get_lang ( $filename ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.0.0' );
2010-05-18 05:48:22 +02:00
}
/**
2014-12-02 01:31:22 +01:00
* Adds JavaScript required to make CodePress work on the theme / plugin editors .
2010-05-18 05:48:22 +02:00
*
* @ since 2.8 . 0
* @ deprecated 3.0 . 0
**/
function codepress_footer_js () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.0.0' );
2010-05-18 05:48:22 +02:00
}
/**
* Determine whether to use CodePress .
*
2013-09-02 13:19:10 +02:00
* @ since 2.8 . 0
2010-05-18 05:48:22 +02:00
* @ deprecated 3.0 . 0
**/
function use_codepress () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.0.0' );
2010-05-18 05:48:22 +02:00
}
2010-08-27 02:22:29 +02:00
/**
2015-08-20 23:23:25 +02:00
* Get all user IDs .
*
* @ deprecated 3.1 . 0 Use get_users ()
2010-08-27 02:22:29 +02:00
*
2017-07-20 16:02:44 +02:00
* @ global wpdb $wpdb WordPress database abstraction object .
*
2010-08-27 02:22:29 +02:00
* @ return array List of user IDs .
*/
function get_author_user_ids () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' , 'get_users()' );
2010-08-27 02:22:29 +02:00
global $wpdb ;
if ( ! is_multisite () )
$level_key = $wpdb -> get_blog_prefix () . 'user_level' ;
else
2020-01-18 01:54:04 +01:00
$level_key = $wpdb -> get_blog_prefix () . 'capabilities' ; // WPMU site admins don't have user_levels.
2010-08-27 02:22:29 +02:00
return $wpdb -> get_col ( $wpdb -> prepare ( " SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0' " , $level_key ) );
}
/**
2015-08-20 23:23:25 +02:00
* Gets author users who can edit posts .
*
* @ deprecated 3.1 . 0 Use get_users ()
2010-08-27 02:22:29 +02:00
*
2017-07-20 16:02:44 +02:00
* @ global wpdb $wpdb WordPress database abstraction object .
*
2010-08-27 02:22:29 +02:00
* @ param int $user_id User ID .
* @ return array | bool List of editable authors . False if no editable users .
*/
function get_editable_authors ( $user_id ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' , 'get_users()' );
2010-08-27 02:22:29 +02:00
global $wpdb ;
$editable = get_editable_user_ids ( $user_id );
if ( ! $editable ) {
return false ;
} else {
$editable = join ( ',' , $editable );
$authors = $wpdb -> get_results ( " SELECT * FROM $wpdb->users WHERE ID IN ( $editable ) ORDER BY display_name " );
}
return apply_filters ( 'get_editable_authors' , $authors );
}
2010-08-27 03:07:21 +02:00
/**
2015-08-20 23:23:25 +02:00
* Gets the IDs of any users who can edit posts .
*
* @ deprecated 3.1 . 0 Use get_users ()
2010-08-27 03:07:21 +02:00
*
2017-07-20 16:02:44 +02:00
* @ global wpdb $wpdb WordPress database abstraction object .
*
2015-12-23 07:53:26 +01:00
* @ param int $user_id User ID .
* @ param bool $exclude_zeros Optional . Whether to exclude zeroes . Default true .
* @ return array Array of editable user IDs , empty array otherwise .
2010-08-27 03:07:21 +02:00
*/
function get_editable_user_ids ( $user_id , $exclude_zeros = true , $post_type = 'post' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' , 'get_users()' );
2010-08-27 03:07:21 +02:00
global $wpdb ;
2012-08-03 03:06:05 +02:00
if ( ! $user = get_userdata ( $user_id ) )
return array ();
2010-08-27 03:07:21 +02:00
$post_type_obj = get_post_type_object ( $post_type );
if ( ! $user -> has_cap ( $post_type_obj -> cap -> edit_others_posts ) ) {
if ( $user -> has_cap ( $post_type_obj -> cap -> edit_posts ) || ! $exclude_zeros )
2011-08-04 05:09:27 +02:00
return array ( $user -> ID );
2010-08-27 03:07:21 +02:00
else
return array ();
}
if ( ! is_multisite () )
$level_key = $wpdb -> get_blog_prefix () . 'user_level' ;
else
2020-01-18 01:54:04 +01:00
$level_key = $wpdb -> get_blog_prefix () . 'capabilities' ; // WPMU site admins don't have user_levels.
2010-08-27 03:07:21 +02:00
$query = $wpdb -> prepare ( " SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s " , $level_key );
if ( $exclude_zeros )
$query .= " AND meta_value != '0' " ;
return $wpdb -> get_col ( $query );
}
/**
2015-08-20 23:23:25 +02:00
* Gets all users who are not authors .
*
* @ deprecated 3.1 . 0 Use get_users ()
2017-07-20 16:02:44 +02:00
*
* @ global wpdb $wpdb WordPress database abstraction object .
2010-08-27 03:07:21 +02:00
*/
function get_nonauthor_user_ids () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' , 'get_users()' );
2010-08-27 03:07:21 +02:00
global $wpdb ;
if ( ! is_multisite () )
$level_key = $wpdb -> get_blog_prefix () . 'user_level' ;
else
2020-01-18 01:54:04 +01:00
$level_key = $wpdb -> get_blog_prefix () . 'capabilities' ; // WPMU site admins don't have user_levels.
2010-08-27 03:07:21 +02:00
return $wpdb -> get_col ( $wpdb -> prepare ( " SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0' " , $level_key ) );
}
2015-09-20 05:52:25 +02:00
if ( ! class_exists ( 'WP_User_Search' , false ) ) :
2010-10-07 22:13:11 +02:00
/**
* WordPress User Search class .
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.1 . 0 Use WP_User_Query
2010-10-07 22:13:11 +02:00
*/
class WP_User_Search {
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
2014-11-03 07:08:22 +01:00
* @ var mixed
2010-10-07 22:13:11 +02:00
*/
var $results ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
2014-11-03 07:08:22 +01:00
* @ var string
2010-10-07 22:13:11 +02:00
*/
var $search_term ;
/**
* Page number .
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
* @ var int
*/
var $page ;
/**
* Role name that users have .
*
2010-12-20 10:25:21 +01:00
* @ since 2.5 . 0
2010-10-07 22:13:11 +02:00
* @ access private
* @ var string
*/
var $role ;
/**
* Raw page number .
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
* @ var int | bool
*/
var $raw_page ;
/**
* Amount of users to display per page .
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
* @ var int
*/
var $users_per_page = 50 ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
2014-11-03 07:08:22 +01:00
* @ var int
2010-10-07 22:13:11 +02:00
*/
var $first_user ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
* @ var int
*/
var $last_user ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
* @ var string
*/
var $query_limit ;
/**
* { @ internal Missing Description }}
*
* @ since 3.0 . 0
* @ access private
* @ var string
*/
var $query_orderby ;
/**
* { @ internal Missing Description }}
*
* @ since 3.0 . 0
* @ access private
* @ var string
*/
var $query_from ;
/**
* { @ internal Missing Description }}
*
* @ since 3.0 . 0
* @ access private
* @ var string
*/
var $query_where ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
* @ var int
*/
var $total_users_for_query = 0 ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
* @ var bool
*/
var $too_many_total_users = false ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access private
2014-11-03 07:08:22 +01:00
* @ var WP_Error
2010-10-07 22:13:11 +02:00
*/
var $search_errors ;
/**
* { @ internal Missing Description }}
*
2010-12-20 10:25:21 +01:00
* @ since 2.7 . 0
2010-10-07 22:13:11 +02:00
* @ access private
2014-11-03 07:08:22 +01:00
* @ var string
2010-10-07 22:13:11 +02:00
*/
var $paging_text ;
/**
2015-06-28 17:27:24 +02:00
* PHP5 Constructor - Sets up the object properties .
2010-10-07 22:13:11 +02:00
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
*
* @ param string $search_term Search terms string .
* @ param int $page Optional . Page ID .
* @ param string $role Role name .
* @ return WP_User_Search
*/
2015-06-28 17:27:24 +02:00
function __construct ( $search_term = '' , $page = '' , $role = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' , 'WP_User_Query' );
2010-10-07 22:13:11 +02:00
2013-03-01 18:00:25 +01:00
$this -> search_term = wp_unslash ( $search_term );
2010-10-07 22:13:11 +02:00
$this -> raw_page = ( '' == $page ) ? false : ( int ) $page ;
$this -> page = ( int ) ( '' == $page ) ? 1 : $page ;
$this -> role = $role ;
$this -> prepare_query ();
$this -> query ();
$this -> do_paging ();
}
2015-06-28 17:27:24 +02:00
/**
* PHP4 Constructor - Sets up the object properties .
*
* @ since 2.1 . 0
*
* @ param string $search_term Search terms string .
* @ param int $page Optional . Page ID .
* @ param string $role Role name .
* @ return WP_User_Search
*/
public function WP_User_Search ( $search_term = '' , $page = '' , $role = '' ) {
self :: __construct ( $search_term , $page , $role );
}
2010-10-07 22:13:11 +02:00
/**
2015-10-05 04:35:25 +02:00
* Prepares the user search query ( legacy ) .
2010-10-07 22:13:11 +02:00
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*/
2015-10-05 04:35:25 +02:00
public function prepare_query () {
2010-10-07 22:13:11 +02:00
global $wpdb ;
$this -> first_user = ( $this -> page - 1 ) * $this -> users_per_page ;
$this -> query_limit = $wpdb -> prepare ( " LIMIT %d, %d " , $this -> first_user , $this -> users_per_page );
$this -> query_orderby = ' ORDER BY user_login' ;
$search_sql = '' ;
if ( $this -> search_term ) {
$searches = array ();
$search_sql = 'AND (' ;
foreach ( array ( 'user_login' , 'user_nicename' , 'user_email' , 'user_url' , 'display_name' ) as $col )
2011-06-27 22:47:04 +02:00
$searches [] = $wpdb -> prepare ( $col . ' LIKE %s' , '%' . like_escape ( $this -> search_term ) . '%' );
2010-10-07 22:13:11 +02:00
$search_sql .= implode ( ' OR ' , $searches );
$search_sql .= ')' ;
}
$this -> query_from = " FROM $wpdb->users " ;
$this -> query_where = " WHERE 1=1 $search_sql " ;
if ( $this -> role ) {
$this -> query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users .ID = $wpdb->usermeta .user_id " ;
$this -> query_where .= $wpdb -> prepare ( " AND $wpdb->usermeta .meta_key = ' { $wpdb -> prefix } capabilities' AND $wpdb->usermeta .meta_value LIKE %s " , '%' . $this -> role . '%' );
} elseif ( is_multisite () ) {
2020-01-18 01:54:04 +01:00
$level_key = $wpdb -> prefix . 'capabilities' ; // WPMU site admins don't have user_levels.
2010-10-07 22:13:11 +02:00
$this -> query_from .= " , $wpdb->usermeta " ;
$this -> query_where .= " AND $wpdb->users .ID = $wpdb->usermeta .user_id AND meta_key = ' { $level_key } ' " ;
}
do_action_ref_array ( 'pre_user_search' , array ( & $this ) );
}
/**
2015-10-05 04:35:25 +02:00
* Executes the user search query .
2010-10-07 22:13:11 +02:00
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*/
2015-10-05 04:35:25 +02:00
public function query () {
2010-10-07 22:13:11 +02:00
global $wpdb ;
$this -> results = $wpdb -> get_col ( " SELECT DISTINCT( $wpdb->users .ID) " . $this -> query_from . $this -> query_where . $this -> query_orderby . $this -> query_limit );
if ( $this -> results )
2020-01-18 01:54:04 +01:00
$this -> total_users_for_query = $wpdb -> get_var ( " SELECT COUNT(DISTINCT( $wpdb->users .ID)) " . $this -> query_from . $this -> query_where ); // No limit.
2010-10-07 22:13:11 +02:00
else
2015-03-11 16:25:28 +01:00
$this -> search_errors = new WP_Error ( 'no_matching_users_found' , __ ( 'No users found.' ));
2010-10-07 22:13:11 +02:00
}
/**
2015-10-05 04:35:25 +02:00
* Prepares variables for use in templates .
2010-10-07 22:13:11 +02:00
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*/
2013-03-01 18:57:49 +01:00
function prepare_vars_for_template_usage () {}
2010-10-07 22:13:11 +02:00
/**
2015-10-05 04:35:25 +02:00
* Handles paging for the user search query .
2010-10-07 22:13:11 +02:00
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*/
2015-10-05 04:35:25 +02:00
public function do_paging () {
2020-01-18 01:54:04 +01:00
if ( $this -> total_users_for_query > $this -> users_per_page ) { // Have to page the results.
2010-10-07 22:13:11 +02:00
$args = array ();
2015-06-16 22:01:25 +02:00
if ( ! empty ( $this -> search_term ) )
2010-10-07 22:13:11 +02:00
$args [ 'usersearch' ] = urlencode ( $this -> search_term );
2015-06-16 22:01:25 +02:00
if ( ! empty ( $this -> role ) )
2010-10-07 22:13:11 +02:00
$args [ 'role' ] = urlencode ( $this -> role );
$this -> paging_text = paginate_links ( array (
'total' => ceil ( $this -> total_users_for_query / $this -> users_per_page ),
'current' => $this -> page ,
'base' => 'users.php?%_%' ,
'format' => 'userspage=%#%' ,
'add_args' => $args
) );
if ( $this -> paging_text ) {
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 19:13:59 +02:00
$this -> paging_text = sprintf (
2019-09-03 02:41:05 +02:00
/* translators: 1: Starting number of users on the current page, 2: Ending number of users, 3: Total number of users. */
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 19:13:59 +02:00
'<span class="displaying-num">' . __ ( 'Displaying %1$s–%2$s of %3$s' ) . '</span>%s' ,
2010-10-07 22:13:11 +02:00
number_format_i18n ( ( $this -> page - 1 ) * $this -> users_per_page + 1 ),
number_format_i18n ( min ( $this -> page * $this -> users_per_page , $this -> total_users_for_query ) ),
number_format_i18n ( $this -> total_users_for_query ),
$this -> paging_text
);
}
}
}
/**
2015-10-05 04:35:25 +02:00
* Retrieves the user search query results .
2010-10-07 22:13:11 +02:00
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*
2014-11-03 07:17:22 +01:00
* @ return array
2010-10-07 22:13:11 +02:00
*/
2015-10-05 04:35:25 +02:00
public function get_results () {
2010-10-07 22:13:11 +02:00
return ( array ) $this -> results ;
}
/**
* Displaying paging text .
*
* @ see do_paging () Builds paging text .
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*/
function page_links () {
echo $this -> paging_text ;
}
/**
* Whether paging is enabled .
*
* @ see do_paging () Builds paging text .
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*
* @ return bool
*/
function results_are_paged () {
if ( $this -> paging_text )
return true ;
return false ;
}
/**
* Whether there are search terms .
*
2010-12-20 10:25:21 +01:00
* @ since 2.1 . 0
2010-10-07 22:13:11 +02:00
* @ access public
*
* @ return bool
*/
function is_search () {
if ( $this -> search_term )
return true ;
return false ;
}
}
endif ;
2010-08-27 03:07:21 +02:00
/**
2015-12-23 07:58:25 +01:00
* Retrieves editable posts from other users .
2010-08-27 03:07:21 +02:00
*
2015-12-23 07:58:25 +01:00
* @ since 2.3 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.1 . 0 Use get_posts ()
* @ see get_posts ()
2010-08-27 03:07:21 +02:00
*
2017-07-20 16:02:44 +02:00
* @ global wpdb $wpdb WordPress database abstraction object .
*
2015-12-23 07:58:25 +01:00
* @ param int $user_id User ID to not retrieve posts from .
* @ param string $type Optional . Post type to retrieve . Accepts 'draft' , 'pending' or 'any' ( all ) .
* Default 'any' .
2010-08-27 03:07:21 +02:00
* @ return array List of posts from others .
*/
2015-12-23 07:58:25 +01:00
function get_others_unpublished_posts ( $user_id , $type = 'any' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' );
2010-08-27 03:07:21 +02:00
global $wpdb ;
$editable = get_editable_user_ids ( $user_id );
if ( in_array ( $type , array ( 'draft' , 'pending' )) )
$type_sql = " post_status = ' $type ' " ;
else
$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) " ;
$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC' ;
if ( ! $editable ) {
$other_unpubs = '' ;
} else {
$editable = join ( ',' , $editable );
$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 ) );
}
return apply_filters ( 'get_others_drafts' , $other_unpubs );
}
/**
* Retrieve drafts from other users .
*
2015-08-20 23:23:25 +02:00
* @ deprecated 3.1 . 0 Use get_posts ()
* @ see get_posts ()
2010-08-27 03:07:21 +02:00
*
* @ param int $user_id User ID .
* @ return array List of drafts from other users .
*/
function get_others_drafts ( $user_id ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' );
2010-08-27 03:07:21 +02:00
return get_others_unpublished_posts ( $user_id , 'draft' );
}
/**
* Retrieve pending review posts from other users .
*
2015-08-20 23:23:25 +02:00
* @ deprecated 3.1 . 0 Use get_posts ()
* @ see get_posts ()
2010-08-27 03:07:21 +02:00
*
* @ param int $user_id User ID .
* @ return array List of posts with pending review post type from other users .
*/
function get_others_pending ( $user_id ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.1.0' );
2010-08-27 03:07:21 +02:00
return get_others_unpublished_posts ( $user_id , 'pending' );
}
2011-04-28 14:02:24 +02:00
/**
* Output the QuickPress dashboard widget .
*
* @ since 3.0 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.2 . 0 Use wp_dashboard_quick_press ()
2011-04-28 14:02:24 +02:00
* @ see wp_dashboard_quick_press ()
*/
function wp_dashboard_quick_press_output () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.2.0' , 'wp_dashboard_quick_press()' );
2013-11-15 21:15:10 +01:00
wp_dashboard_quick_press ();
2011-06-27 22:47:04 +02:00
}
2011-08-03 12:19:00 +02:00
/**
2015-08-20 23:23:25 +02:00
* Outputs the TinyMCE editor .
*
2011-10-01 20:07:41 +02:00
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.3 . 0 Use wp_editor ()
2011-08-03 12:19:00 +02:00
* @ see wp_editor ()
2015-05-29 17:43:29 +02:00
*
* @ staticvar int $num
2011-08-03 12:19:00 +02:00
*/
2011-11-22 22:47:01 +01:00
function wp_tiny_mce ( $teeny = false , $settings = false ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_editor()' );
2011-10-24 21:13:23 +02:00
2011-11-22 22:47:01 +01:00
static $num = 1 ;
2016-08-31 18:31:29 +02:00
if ( ! class_exists ( '_WP_Editors' , false ) )
2020-02-06 07:33:11 +01:00
require_once ABSPATH . WPINC . '/class-wp-editor.php' ;
2016-08-31 18:31:29 +02:00
2011-11-23 20:06:52 +01:00
$editor_id = 'content' . $num ++ ;
2011-11-22 22:47:01 +01:00
$set = array (
'teeny' => $teeny ,
'tinymce' => $settings ? $settings : true ,
'quicktags' => false
);
2011-11-23 20:06:52 +01:00
$set = _WP_Editors :: parse_settings ( $editor_id , $set );
_WP_Editors :: editor_settings ( $editor_id , $set );
2011-08-03 12:19:00 +02:00
}
2011-10-01 20:07:41 +02:00
/**
2015-08-20 23:23:25 +02:00
* Preloads TinyMCE dialogs .
*
* @ deprecated 3.3 . 0 Use wp_editor ()
2011-10-01 20:07:41 +02:00
* @ see wp_editor ()
*/
2011-08-03 12:19:00 +02:00
function wp_preload_dialogs () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_editor()' );
2011-08-03 12:19:00 +02:00
}
2011-10-01 20:07:41 +02:00
/**
2015-08-20 23:23:25 +02:00
* Prints TinyMCE editor JS .
*
* @ deprecated 3.3 . 0 Use wp_editor ()
2011-10-01 20:07:41 +02:00
* @ see wp_editor ()
*/
2011-08-03 12:19:00 +02:00
function wp_print_editor_js () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_editor()' );
2011-08-03 12:19:00 +02:00
}
2011-10-01 20:07:41 +02:00
/**
2015-08-20 23:23:25 +02:00
* Handles quicktags .
*
* @ deprecated 3.3 . 0 Use wp_editor ()
2011-10-01 20:07:41 +02:00
* @ see wp_editor ()
*/
2011-08-03 12:19:00 +02:00
function wp_quicktags () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_editor()' );
2011-08-03 12:19:00 +02:00
}
2011-10-01 20:07:41 +02:00
/**
* Returns the screen layout options .
*
2011-10-06 18:24:14 +02:00
* @ since 2.8 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.3 . 0 WP_Screen :: render_screen_layout ()
2011-10-01 20:07:41 +02:00
* @ see WP_Screen :: render_screen_layout ()
*/
function screen_layout ( $screen ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , '$current_screen->render_screen_layout()' );
2011-10-01 20:07:41 +02:00
$current_screen = get_current_screen ();
if ( ! $current_screen )
return '' ;
ob_start ();
$current_screen -> render_screen_layout ();
return ob_get_clean ();
2011-08-03 12:19:00 +02:00
}
2011-10-01 20:07:41 +02:00
/**
* Returns the screen ' s per - page options .
*
2011-10-06 18:24:14 +02:00
* @ since 2.8 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.3 . 0 Use WP_Screen :: render_per_page_options ()
2011-10-01 20:07:41 +02:00
* @ see WP_Screen :: render_per_page_options ()
*/
function screen_options ( $screen ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , '$current_screen->render_per_page_options()' );
2011-10-01 20:07:41 +02:00
$current_screen = get_current_screen ();
if ( ! $current_screen )
return '' ;
ob_start ();
$current_screen -> render_per_page_options ();
return ob_get_clean ();
2011-10-01 20:13:27 +02:00
}
/**
* Renders the screen ' s help .
*
2011-10-06 18:24:14 +02:00
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.3 . 0 Use WP_Screen :: render_screen_meta ()
2011-10-01 20:13:27 +02:00
* @ see WP_Screen :: render_screen_meta ()
*/
function screen_meta ( $screen ) {
$current_screen = get_current_screen ();
$current_screen -> render_screen_meta ();
2011-10-23 19:58:06 +02:00
}
2011-10-24 08:10:36 +02:00
/**
* Favorite actions were deprecated in version 3.2 . Use the admin bar instead .
*
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.2 . 0 Use WP_Admin_Bar
* @ see WP_Admin_Bar
2011-10-24 08:10:36 +02:00
*/
function favorite_actions () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.2.0' , 'WP_Admin_Bar' );
2011-10-24 08:10:36 +02:00
}
2015-08-20 23:23:25 +02:00
/**
* Handles uploading an image .
*
* @ deprecated 3.3 . 0 Use wp_media_upload_handler ()
* @ see wp_media_upload_handler ()
*
* @ return null | string
*/
2011-10-23 19:58:06 +02:00
function media_upload_image () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_media_upload_handler()' );
2011-10-23 19:58:06 +02:00
return wp_media_upload_handler ();
}
2015-08-20 23:23:25 +02:00
/**
* Handles uploading an audio file .
*
* @ deprecated 3.3 . 0 Use wp_media_upload_handler ()
* @ see wp_media_upload_handler ()
*
* @ return null | string
*/
2011-10-23 19:58:06 +02:00
function media_upload_audio () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_media_upload_handler()' );
2011-10-23 19:58:06 +02:00
return wp_media_upload_handler ();
}
2015-08-20 23:23:25 +02:00
/**
* Handles uploading a video file .
*
* @ deprecated 3.3 . 0 Use wp_media_upload_handler ()
* @ see wp_media_upload_handler ()
*
* @ return null | string
*/
2011-10-23 19:58:06 +02:00
function media_upload_video () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_media_upload_handler()' );
2011-10-23 19:58:06 +02:00
return wp_media_upload_handler ();
}
2015-08-20 23:23:25 +02:00
/**
* Handles uploading a generic file .
*
* @ deprecated 3.3 . 0 Use wp_media_upload_handler ()
* @ see wp_media_upload_handler ()
*
* @ return null | string
*/
2011-10-23 19:58:06 +02:00
function media_upload_file () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'wp_media_upload_handler()' );
2011-10-23 19:58:06 +02:00
return wp_media_upload_handler ();
}
2015-08-20 23:23:25 +02:00
/**
* Handles retrieving the insert - from - URL form for an image .
*
* @ deprecated 3.3 . 0 Use wp_media_insert_url_form ()
* @ see wp_media_insert_url_form ()
*
* @ return string
*/
2011-10-23 19:58:06 +02:00
function type_url_form_image () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , " wp_media_insert_url_form('image') " );
2011-10-23 19:58:06 +02:00
return wp_media_insert_url_form ( 'image' );
}
2015-08-20 23:23:25 +02:00
/**
* Handles retrieving the insert - from - URL form for an audio file .
*
* @ deprecated 3.3 . 0 Use wp_media_insert_url_form ()
* @ see wp_media_insert_url_form ()
*
* @ return string
*/
2011-10-23 19:58:06 +02:00
function type_url_form_audio () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , " wp_media_insert_url_form('audio') " );
2011-10-23 19:58:06 +02:00
return wp_media_insert_url_form ( 'audio' );
}
2015-08-20 23:23:25 +02:00
/**
* Handles retrieving the insert - from - URL form for a video file .
*
* @ deprecated 3.3 . 0 Use wp_media_insert_url_form ()
* @ see wp_media_insert_url_form ()
*
* @ return string
*/
2011-10-23 19:58:06 +02:00
function type_url_form_video () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , " wp_media_insert_url_form('video') " );
2011-10-23 19:58:06 +02:00
return wp_media_insert_url_form ( 'video' );
}
2015-08-20 23:23:25 +02:00
/**
* Handles retrieving the insert - from - URL form for a generic file .
*
* @ deprecated 3.3 . 0 Use wp_media_insert_url_form ()
* @ see wp_media_insert_url_form ()
*
* @ return string
*/
2011-10-23 19:58:06 +02:00
function type_url_form_file () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , " wp_media_insert_url_form('file') " );
2011-10-23 19:58:06 +02:00
return wp_media_insert_url_form ( 'file' );
2011-11-22 22:47:01 +01:00
}
2011-12-01 04:29:55 +01:00
/**
* Add contextual help text for a page .
*
* Creates an 'Overview' help tab .
*
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.3 . 0 Use WP_Screen :: add_help_tab ()
* @ see WP_Screen :: add_help_tab ()
2011-12-01 04:29:55 +01:00
*
2011-12-14 00:45:31 +01:00
* @ param string $screen The handle for the screen to add help to . This is usually the hook name returned by the add_ * _page () functions .
2011-12-01 04:29:55 +01:00
* @ param string $help The content of an 'Overview' help tab .
*/
function add_contextual_help ( $screen , $help ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.3.0' , 'get_current_screen()->add_help_tab()' );
2011-12-01 04:29:55 +01:00
if ( is_string ( $screen ) )
$screen = convert_to_screen ( $screen );
WP_Screen :: add_old_compat_help ( $screen , $help );
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
}
/**
2016-01-28 04:35:27 +01:00
* Get the allowed themes for the current site .
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*
* @ since 3.0 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.4 . 0 Use wp_get_themes ()
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
* @ see wp_get_themes ()
*
2019-11-03 23:23:01 +01:00
* @ return WP_Theme [] Array of WP_Theme objects keyed by their name .
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*/
function get_allowed_themes () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.4.0' , " wp_get_themes( array( 'allowed' => true ) ) " );
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
$themes = wp_get_themes ( array ( 'allowed' => true ) );
$wp_themes = array ();
foreach ( $themes as $theme ) {
$wp_themes [ $theme -> get ( 'Name' ) ] = $theme ;
}
return $wp_themes ;
}
/**
2015-08-20 23:23:25 +02:00
* Retrieves a list of broken themes .
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*
* @ since 1.5 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.4 . 0 Use wp_get_themes ()
* @ see wp_get_themes ()
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*
2014-11-03 07:17:22 +01:00
* @ return array
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*/
function get_broken_themes () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.4.0' , " wp_get_themes( array( 'errors' => true ) " );
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
$themes = wp_get_themes ( array ( 'errors' => true ) );
$broken = array ();
foreach ( $themes as $theme ) {
Updates to WP_Theme, wp_get_themes(), and related deprecated functions, after [UT570] [UT578] [UT579]. see #20103.
* ['Template Files'] and ['Stylesheet Files'] need to return files from the parent theme as well.
* Don't strip links from the Author header. Some themes rely on the previous behavior, such as to link multiple authors (Sandbox, for example.) Don't restore links to the Name, that's just a bad idea.
* Ensure we are always passing around arrays in get_files/scandir.
* Better inline doc for wp_get_themes() arguments.
* Introduce a 'force' flag for search_theme_directories() to re-scan, rather than return the cache. We will use this to re-build the theme_roots transient in get_theme_roots(), but it is more helpful for unit tests. Since search_theme_directories() is cached, don't cache again in wp_get_themes(). (Again benefits testing.)
* Handle duplicate theme names in the old get_themes() when two themes match (and neither are a default theme, which is already handled). wp_get_themes() will consider both names to be the same; this is just for back compat since get_themes() is keyed by name.
* Include an old array key in wp_broken_themes().
git-svn-id: http://svn.automattic.com/wordpress/trunk@20193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 16:39:21 +01:00
$name = $theme -> get ( 'Name' );
$broken [ $name ] = array (
'Name' => $name ,
'Title' => $name ,
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
'Description' => $theme -> errors () -> get_error_message (),
);
}
return $broken ;
}
/**
2015-08-20 23:23:25 +02:00
* Retrieves information on the current active theme .
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*
* @ since 2.0 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.4 . 0 Use wp_get_theme ()
* @ see wp_get_theme ()
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*
2014-11-03 07:17:22 +01:00
* @ return WP_Theme
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
*/
function current_theme_info () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.4.0' , 'wp_get_theme()' );
Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
* Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
* Error Handling: Broken themes have a WP_Error object attached to them.
* Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
* Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
* i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
* PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.
Functions deprecated:
* get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
* get_theme() and current_theme_info() -- use wp_get_theme()
* get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
* wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()
see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.
see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 22:24:44 +01:00
return wp_get_theme ();
2012-07-26 23:30:06 +02:00
}
/**
2015-08-20 23:23:25 +02:00
* This was once used to display an 'Insert into Post' button .
*
* Now it is deprecated and stubbed .
2012-08-28 21:08:28 +02:00
*
2012-07-26 23:30:06 +02:00
* @ deprecated 3.5 . 0
*/
function _insert_into_post_button ( $type ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.5.0' );
2012-07-26 23:30:06 +02:00
}
2012-07-26 23:33:01 +02:00
/**
2015-08-20 23:23:25 +02:00
* This was once used to display a media button .
*
* Now it is deprecated and stubbed .
2012-08-28 21:08:28 +02:00
*
2012-07-26 23:33:01 +02:00
* @ deprecated 3.5 . 0
*/
function _media_button ( $title , $icon , $type , $id ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.5.0' );
2012-07-26 23:33:01 +02:00
}
2012-08-28 21:08:28 +02:00
/**
2015-08-20 23:23:25 +02:00
* Gets an existing post and format it for editing .
2012-08-28 21:08:28 +02:00
*
* @ since 2.0 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.5 . 0 Use get_post ()
* @ see get_post ()
2012-08-28 21:08:28 +02:00
*
* @ param int $id
* @ return object
*/
function get_post_to_edit ( $id ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.5.0' , 'get_post()' );
2012-08-28 21:08:28 +02:00
return get_post ( $id , OBJECT , 'edit' );
}
2012-09-10 22:39:45 +02:00
/**
2015-08-20 23:23:25 +02:00
* Gets the default page information to use .
2012-09-10 22:39:45 +02:00
*
* @ since 2.5 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.5 . 0 Use get_default_post_to_edit ()
* @ see get_default_post_to_edit ()
2012-09-10 22:39:45 +02:00
*
* @ return WP_Post Post object containing all the default post data as attributes
*/
function get_default_page_to_edit () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.5.0' , " get_default_post_to_edit( 'page' ) " );
2012-09-10 22:39:45 +02:00
$page = get_default_post_to_edit ();
$page -> post_type = 'page' ;
return $page ;
}
2012-09-23 19:48:24 +02:00
/**
* This was once used to create a thumbnail from an Image given a maximum side size .
*
* @ since 1.2 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.5 . 0 Use image_resize ()
2013-02-16 03:52:57 +01:00
* @ see image_resize ()
2012-09-23 19:48:24 +02:00
*
* @ param mixed $file Filename of the original image , Or attachment id .
* @ param int $max_side Maximum length of a single side for the thumbnail .
* @ param mixed $deprecated Never used .
* @ return string Thumbnail path on success , Error string on failure .
*/
function wp_create_thumbnail ( $file , $max_side , $deprecated = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.5.0' , 'image_resize()' );
2012-09-23 19:48:24 +02:00
return apply_filters ( 'wp_create_thumbnail' , image_resize ( $file , $max_side , $max_side ) );
}
2013-09-02 13:26:09 +02:00
/**
2016-07-10 02:56:28 +02:00
* This was once used to display a meta box for the nav menu theme locations .
2013-09-02 13:26:09 +02:00
*
* Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen .
*
* @ since 3.0 . 0
* @ deprecated 3.6 . 0
*/
function wp_nav_menu_locations_meta_box () {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.6.0' );
2013-09-02 13:26:09 +02:00
}
2013-09-09 08:45:08 +02:00
/**
* This was once used to kick - off the Core Updater .
*
* Deprecated in favor of instantating a Core_Upgrader instance directly ,
* and calling the 'upgrade' method .
*
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.7 . 0 Use Core_Upgrader
2013-10-30 15:39:10 +01:00
* @ see Core_Upgrader
2013-09-09 08:45:08 +02:00
*/
function wp_update_core ( $current , $feedback = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.7.0' , 'new Core_Upgrader();' );
2013-09-09 08:45:08 +02:00
if ( ! empty ( $feedback ) )
add_filter ( 'update_feedback' , $feedback );
2020-02-06 07:33:11 +01:00
require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ;
2013-09-09 08:45:08 +02:00
$upgrader = new Core_Upgrader ();
return $upgrader -> upgrade ( $current );
}
/**
* This was once used to kick - off the Plugin Updater .
*
* Deprecated in favor of instantating a Plugin_Upgrader instance directly ,
* and calling the 'upgrade' method .
* Unused since 2.8 . 0.
*
* @ since 2.5 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.7 . 0 Use Plugin_Upgrader
2013-10-30 15:39:10 +01:00
* @ see Plugin_Upgrader
2013-09-09 08:45:08 +02:00
*/
function wp_update_plugin ( $plugin , $feedback = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.7.0' , 'new Plugin_Upgrader();' );
2013-09-09 08:45:08 +02:00
if ( ! empty ( $feedback ) )
add_filter ( 'update_feedback' , $feedback );
2020-02-06 07:33:11 +01:00
require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ;
2013-09-09 08:45:08 +02:00
$upgrader = new Plugin_Upgrader ();
return $upgrader -> upgrade ( $plugin );
}
/**
2013-10-30 15:39:10 +01:00
* This was once used to kick - off the Theme Updater .
2013-09-09 08:45:08 +02:00
*
2016-04-13 09:27:28 +02:00
* Deprecated in favor of instantiating a Theme_Upgrader instance directly ,
2013-09-09 08:45:08 +02:00
* and calling the 'upgrade' method .
* Unused since 2.8 . 0.
*
* @ since 2.7 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.7 . 0 Use Theme_Upgrader
2013-10-30 15:39:10 +01:00
* @ see Theme_Upgrader
2013-09-09 08:45:08 +02:00
*/
function wp_update_theme ( $theme , $feedback = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.7.0' , 'new Theme_Upgrader();' );
2013-09-09 08:45:08 +02:00
if ( ! empty ( $feedback ) )
add_filter ( 'update_feedback' , $feedback );
2020-02-06 07:33:11 +01:00
require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ;
2013-09-09 08:45:08 +02:00
$upgrader = new Theme_Upgrader ();
return $upgrader -> upgrade ( $theme );
}
2013-09-17 11:08:08 +02:00
/**
* This was once used to display attachment links . Now it is deprecated and stubbed .
*
2013-10-25 04:29:52 +02:00
* @ since 2.0 . 0
2013-09-17 11:08:08 +02:00
* @ deprecated 3.7 . 0
*
2014-11-03 07:08:22 +01:00
* @ param int | bool $id
2013-09-17 11:08:08 +02:00
*/
function the_attachment_links ( $id = false ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.7.0' );
2013-09-17 11:08:08 +02:00
}
2013-12-02 04:53:11 +01:00
2015-08-20 23:23:25 +02:00
/**
2013-12-02 04:53:11 +01:00
* Displays a screen icon .
*
* @ since 2.7 . 0
2017-08-20 06:03:45 +02:00
* @ deprecated 3.8 . 0
2013-12-02 04:53:11 +01:00
*/
2013-12-02 21:00:11 +01:00
function screen_icon () {
2017-08-20 06:03:45 +02:00
_deprecated_function ( __FUNCTION__ , '3.8.0' );
2013-12-02 21:00:11 +01:00
echo get_screen_icon ();
2013-12-02 04:53:11 +01:00
}
2015-08-20 23:23:25 +02:00
/**
* Retrieves the screen icon ( no longer used in 3.8 + ) .
*
2017-08-20 06:03:45 +02:00
* @ since 3.2 . 0
2015-08-20 23:23:25 +02:00
* @ deprecated 3.8 . 0
*
2017-08-20 06:04:44 +02:00
* @ return string An HTML comment explaining that icons are no longer used .
2015-08-20 23:23:25 +02:00
*/
2013-12-02 21:00:11 +01:00
function get_screen_icon () {
2017-08-20 06:03:45 +02:00
_deprecated_function ( __FUNCTION__ , '3.8.0' );
2013-12-02 21:00:11 +01:00
return '<!-- Screen icons are no longer used as of WordPress 3.8. -->' ;
}
2013-12-05 22:23:10 +01:00
2015-08-20 23:23:25 +02:00
/**
2013-12-05 22:23:10 +01:00
* Deprecated dashboard widget controls .
*
* @ since 2.5 . 0
* @ deprecated 3.8 . 0
*/
function wp_dashboard_incoming_links_output () {}
2015-08-20 23:23:25 +02:00
/**
* Deprecated dashboard secondary output .
*
* @ deprecated 3.8 . 0
*/
2013-12-05 22:23:10 +01:00
function wp_dashboard_secondary_output () {}
2015-08-20 23:23:25 +02:00
/**
2013-12-05 22:23:10 +01:00
* Deprecated dashboard widget controls .
*
* @ since 2.7 . 0
* @ deprecated 3.8 . 0
*/
function wp_dashboard_incoming_links () {}
2015-08-20 23:23:25 +02:00
/**
* Deprecated dashboard incoming links control .
*
* @ deprecated 3.8 . 0
*/
2013-12-05 22:23:10 +01:00
function wp_dashboard_incoming_links_control () {}
2015-08-20 23:23:25 +02:00
/**
* Deprecated dashboard plugins control .
*
* @ deprecated 3.8 . 0
*/
2013-12-05 22:23:10 +01:00
function wp_dashboard_plugins () {}
2015-08-20 23:23:25 +02:00
/**
* Deprecated dashboard primary control .
*
* @ deprecated 3.8 . 0
*/
2013-12-05 22:23:10 +01:00
function wp_dashboard_primary_control () {}
2015-08-20 23:23:25 +02:00
/**
* Deprecated dashboard recent comments control .
*
* @ deprecated 3.8 . 0
*/
2013-12-05 22:23:10 +01:00
function wp_dashboard_recent_comments_control () {}
2015-08-20 23:23:25 +02:00
/**
* Deprecated dashboard secondary section .
*
* @ deprecated 3.8 . 0
*/
2013-12-05 22:23:10 +01:00
function wp_dashboard_secondary () {}
2015-08-20 23:23:25 +02:00
/**
* Deprecated dashboard secondary control .
*
* @ deprecated 3.8 . 0
*/
2013-12-05 22:23:10 +01:00
function wp_dashboard_secondary_control () {}
2014-02-25 18:10:14 +01:00
Dashboard: Update the existing WordPress News dashboard widget to also include upcoming meetup events and WordCamps near the current user’s location.
Props @afercia, @andreamiddleton, @azaozz, @camikaos, @coreymckrill, @chanthaboune, @courtneypk, @dd32, @iandunn, @iseulde, @mapk, @mayukojpn, @melchoyce, @nao, @obenland, @pento, @samuelsidler, @stephdau, @tellyworth.
See #40702.
Built from https://develop.svn.wordpress.org/trunk@40607
git-svn-id: http://core.svn.wordpress.org/trunk@40477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 22:04:42 +02:00
/**
* Display plugins text for the WordPress news widget .
*
* @ since 2.5 . 0
* @ deprecated 4.8 . 0
*
* @ param string $rss The RSS feed URL .
* @ param array $args Array of arguments for this RSS feed .
*/
function wp_dashboard_plugins_output ( $rss , $args = array () ) {
_deprecated_function ( __FUNCTION__ , '4.8.0' );
2020-01-18 01:54:04 +01:00
// Plugin feeds plus link to install them.
Dashboard: Update the existing WordPress News dashboard widget to also include upcoming meetup events and WordCamps near the current user’s location.
Props @afercia, @andreamiddleton, @azaozz, @camikaos, @coreymckrill, @chanthaboune, @courtneypk, @dd32, @iandunn, @iseulde, @mapk, @mayukojpn, @melchoyce, @nao, @obenland, @pento, @samuelsidler, @stephdau, @tellyworth.
See #40702.
Built from https://develop.svn.wordpress.org/trunk@40607
git-svn-id: http://core.svn.wordpress.org/trunk@40477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 22:04:42 +02:00
$popular = fetch_feed ( $args [ 'url' ][ 'popular' ] );
if ( false === $plugin_slugs = get_transient ( 'plugin_slugs' ) ) {
$plugin_slugs = array_keys ( get_plugins () );
set_transient ( 'plugin_slugs' , $plugin_slugs , DAY_IN_SECONDS );
}
echo '<ul>' ;
foreach ( array ( $popular ) as $feed ) {
if ( is_wp_error ( $feed ) || ! $feed -> get_item_quantity () )
continue ;
$items = $feed -> get_items ( 0 , 5 );
2020-01-18 01:54:04 +01:00
// Pick a random, non-installed plugin.
Dashboard: Update the existing WordPress News dashboard widget to also include upcoming meetup events and WordCamps near the current user’s location.
Props @afercia, @andreamiddleton, @azaozz, @camikaos, @coreymckrill, @chanthaboune, @courtneypk, @dd32, @iandunn, @iseulde, @mapk, @mayukojpn, @melchoyce, @nao, @obenland, @pento, @samuelsidler, @stephdau, @tellyworth.
See #40702.
Built from https://develop.svn.wordpress.org/trunk@40607
git-svn-id: http://core.svn.wordpress.org/trunk@40477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 22:04:42 +02:00
while ( true ) {
2020-01-18 01:54:04 +01:00
// Abort this foreach loop iteration if there's no plugins left of this type.
Dashboard: Update the existing WordPress News dashboard widget to also include upcoming meetup events and WordCamps near the current user’s location.
Props @afercia, @andreamiddleton, @azaozz, @camikaos, @coreymckrill, @chanthaboune, @courtneypk, @dd32, @iandunn, @iseulde, @mapk, @mayukojpn, @melchoyce, @nao, @obenland, @pento, @samuelsidler, @stephdau, @tellyworth.
See #40702.
Built from https://develop.svn.wordpress.org/trunk@40607
git-svn-id: http://core.svn.wordpress.org/trunk@40477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 22:04:42 +02:00
if ( 0 == count ( $items ) )
continue 2 ;
$item_key = array_rand ( $items );
$item = $items [ $item_key ];
list ( $link , $frag ) = explode ( '#' , $item -> get_link () );
$link = esc_url ( $link );
if ( preg_match ( '|/([^/]+?)/?$|' , $link , $matches ) )
$slug = $matches [ 1 ];
else {
unset ( $items [ $item_key ] );
continue ;
}
// Is this random plugin's slug already installed? If so, try again.
reset ( $plugin_slugs );
foreach ( $plugin_slugs as $plugin_slug ) {
if ( $slug == substr ( $plugin_slug , 0 , strlen ( $slug ) ) ) {
unset ( $items [ $item_key ] );
continue 2 ;
}
}
// If we get to this point, then the random plugin isn't installed and we can stop the while().
break ;
}
2020-01-18 01:54:04 +01:00
// Eliminate some common badly formed plugin descriptions.
Dashboard: Update the existing WordPress News dashboard widget to also include upcoming meetup events and WordCamps near the current user’s location.
Props @afercia, @andreamiddleton, @azaozz, @camikaos, @coreymckrill, @chanthaboune, @courtneypk, @dd32, @iandunn, @iseulde, @mapk, @mayukojpn, @melchoyce, @nao, @obenland, @pento, @samuelsidler, @stephdau, @tellyworth.
See #40702.
Built from https://develop.svn.wordpress.org/trunk@40607
git-svn-id: http://core.svn.wordpress.org/trunk@40477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 22:04:42 +02:00
while ( ( null !== $item_key = array_rand ( $items ) ) && false !== strpos ( $items [ $item_key ] -> get_description (), 'Plugin Name:' ) )
unset ( $items [ $item_key ]);
if ( ! isset ( $items [ $item_key ]) )
continue ;
$raw_title = $item -> get_title ();
$ilink = wp_nonce_url ( 'plugin-install.php?tab=plugin-information&plugin=' . $slug , 'install-plugin_' . $slug ) . '&TB_iframe=true&width=600&height=800' ;
echo '<li class="dashboard-news-plugin"><span>' . __ ( 'Popular Plugin' ) . ':</span> ' . esc_html ( $raw_title ) .
' <a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
2019-09-03 02:41:05 +02:00
/* translators: %s: Plugin name. */
Dashboard: Update the existing WordPress News dashboard widget to also include upcoming meetup events and WordCamps near the current user’s location.
Props @afercia, @andreamiddleton, @azaozz, @camikaos, @coreymckrill, @chanthaboune, @courtneypk, @dd32, @iandunn, @iseulde, @mapk, @mayukojpn, @melchoyce, @nao, @obenland, @pento, @samuelsidler, @stephdau, @tellyworth.
See #40702.
Built from https://develop.svn.wordpress.org/trunk@40607
git-svn-id: http://core.svn.wordpress.org/trunk@40477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 22:04:42 +02:00
esc_attr ( sprintf ( __ ( 'Install %s' ), $raw_title ) ) . '">(' . __ ( 'Install' ) . ')</a></li>' ;
$feed -> __destruct ();
unset ( $feed );
}
echo '</ul>' ;
}
2014-02-25 18:10:14 +01:00
/**
* This was once used to move child posts to a new parent .
*
* @ since 2.3 . 0
* @ deprecated 3.9 . 0
* @ access private
*
* @ param int $old_ID
* @ param int $new_ID
*/
function _relocate_children ( $old_ID , $new_ID ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '3.9.0' );
2014-02-25 18:10:14 +01:00
}
2015-12-11 23:12:26 +01:00
/**
* Add a top - level menu page in the 'objects' section .
*
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu .
*
* The function which is hooked in to handle the output of the page must check
* that the user has the required capability as well .
*
* @ since 2.7 . 0
*
* @ deprecated 4.5 . 0 Use add_menu_page ()
* @ see add_menu_page ()
* @ global int $_wp_last_object_menu
*
* @ param string $page_title The text to be displayed in the title tags of the page when the menu is selected .
* @ param string $menu_title The text to be used for the menu .
* @ param string $capability The capability required for this menu to be displayed to the user .
* @ param string $menu_slug The slug name to refer to this menu by ( should be unique for this menu ) .
* @ param callable $function The function to be called to output the content for this page .
* @ param string $icon_url The url to the icon to be used for this menu .
* @ return string The resulting page ' s hook_suffix .
*/
function add_object_page ( $page_title , $menu_title , $capability , $menu_slug , $function = '' , $icon_url = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '4.5.0' , 'add_menu_page()' );
2015-12-11 23:12:26 +01:00
global $_wp_last_object_menu ;
$_wp_last_object_menu ++ ;
return add_menu_page ( $page_title , $menu_title , $capability , $menu_slug , $function , $icon_url , $_wp_last_object_menu );
}
/**
* Add a top - level menu page in the 'utility' section .
*
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu .
*
* The function which is hooked in to handle the output of the page must check
* that the user has the required capability as well .
*
* @ since 2.7 . 0
*
* @ deprecated 4.5 . 0 Use add_menu_page ()
* @ see add_menu_page ()
* @ global int $_wp_last_utility_menu
*
* @ param string $page_title The text to be displayed in the title tags of the page when the menu is selected .
* @ param string $menu_title The text to be used for the menu .
* @ param string $capability The capability required for this menu to be displayed to the user .
* @ param string $menu_slug The slug name to refer to this menu by ( should be unique for this menu ) .
* @ param callable $function The function to be called to output the content for this page .
* @ param string $icon_url The url to the icon to be used for this menu .
* @ return string The resulting page ' s hook_suffix .
*/
function add_utility_page ( $page_title , $menu_title , $capability , $menu_slug , $function = '' , $icon_url = '' ) {
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '4.5.0' , 'add_menu_page()' );
2015-12-11 23:12:26 +01:00
global $_wp_last_utility_menu ;
$_wp_last_utility_menu ++ ;
return add_menu_page ( $page_title , $menu_title , $capability , $menu_slug , $function , $icon_url , $_wp_last_utility_menu );
}
2016-06-02 03:30:27 +02:00
/**
* Disables autocomplete on the 'post' form ( Add / Edit Post screens ) for WebKit browsers ,
* as they disregard the autocomplete setting on the editor textarea . That can break the editor
* when the user navigates to it with the browser ' s Back button . See #28037
*
* Replaced with wp_page_reload_on_back_button_js () that also fixes this problem .
*
* @ since 4.0 . 0
2017-06-22 19:48:45 +02:00
* @ deprecated 4.6 . 0
*
* @ link https :// core . trac . wordpress . org / ticket / 35852
2016-06-02 03:30:27 +02:00
*
* @ global bool $is_safari
* @ global bool $is_chrome
*/
function post_form_autocomplete_off () {
global $is_safari , $is_chrome ;
2016-07-06 14:40:29 +02:00
_deprecated_function ( __FUNCTION__ , '4.6.0' );
2016-06-02 03:30:27 +02:00
if ( $is_safari || $is_chrome ) {
echo ' autocomplete="off"' ;
}
}
2017-09-26 10:24:46 +02:00
/**
* Display JavaScript on the page .
*
* @ since 3.5 . 0
* @ deprecated 4.9 . 0
*/
function options_permalink_add_js () {
?>
< script type = " text/javascript " >
jQuery ( document ) . ready ( function () {
jQuery ( '.permalink-structure input:radio' ) . change ( function () {
if ( 'custom' == this . value )
return ;
jQuery ( '#permalink_structure' ) . val ( this . value );
});
jQuery ( '#permalink_structure' ) . on ( 'click input' , function () {
jQuery ( '#custom_selection' ) . prop ( 'checked' , true );
});
});
</ script >
< ? php
}
2019-05-26 22:50:53 +02:00
/**
* Previous class for list table for privacy data export requests .
*
* @ since 4.9 . 6
* @ deprecated 5.3 . 0
*/
class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Data_Export_Requests_List_Table {
function __construct ( $args ) {
_deprecated_function ( __CLASS__ , '5.3.0' , 'WP_Privacy_Data_Export_Requests_List_Table' );
if ( ! isset ( $args [ 'screen' ] ) || $args [ 'screen' ] === 'export_personal_data' ) {
$args [ 'screen' ] = 'export-personal-data' ;
}
parent :: __construct ( $args );
}
}
/**
* Previous class for list table for privacy data erasure requests .
*
* @ since 4.9 . 6
* @ deprecated 5.3 . 0
*/
class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Data_Removal_Requests_List_Table {
function __construct ( $args ) {
_deprecated_function ( __CLASS__ , '5.3.0' , 'WP_Privacy_Data_Removal_Requests_List_Table' );
if ( ! isset ( $args [ 'screen' ] ) || $args [ 'screen' ] === 'remove_personal_data' ) {
$args [ 'screen' ] = 'erase-personal-data' ;
}
parent :: __construct ( $args );
}
}
/**
* Was used to add options for the privacy requests screens before they were separate files .
*
* @ since 4.9 . 8
* @ access private
* @ deprecated 5.3 . 0
*/
function _wp_privacy_requests_screen_options () {
_deprecated_function ( __FUNCTION__ , '5.3.0' );
}