X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/607b7e02d77e7326161e8ec15639052d2040f745..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-includes/deprecated.php diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 0d30113b..f35ea0ce 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2015,7 +2015,7 @@ function sanitize_url( $url, $protocols = null ) { * * @since 1.2.0 * @deprecated 3.0.0 Use esc_url() - * @see Alias for esc_url() + * @see esc_url() * * @param string $url The URL to be cleaned. * @param array $protocols Optional. An array of acceptable protocols. @@ -2357,7 +2357,6 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) { * @see get_users() * * @global wpdb $wpdb WordPress database abstraction object. - * @global int $blog_id The site ID of the site for those that use more than one site. * * @param int $id Site ID. * @return array List of users that are part of that site ID @@ -2365,9 +2364,10 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) { function get_users_of_blog( $id = '' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); - global $wpdb, $blog_id; - if ( empty($id) ) - $id = (int) $blog_id; + global $wpdb; + if ( empty( $id ) ) { + $id = get_current_blog_id(); + } $blog_prefix = $wpdb->get_blog_prefix($id); $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); return $users; @@ -3169,8 +3169,10 @@ function wp_load_image( $file ) { if ( is_numeric( $file ) ) $file = get_attached_file( $file ); - if ( ! is_file( $file ) ) - return sprintf(__('File “%s” doesn’t exist?'), $file); + if ( ! is_file( $file ) ) { + /* translators: %s: file name */ + return sprintf( __( 'File “%s” doesn’t exist?' ), $file ); + } if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); @@ -3180,8 +3182,10 @@ function wp_load_image( $file ) { $image = imagecreatefromstring( file_get_contents( $file ) ); - if ( !is_resource( $image ) ) - return sprintf(__('File “%s” is not an image.'), $file); + if ( ! is_resource( $image ) ) { + /* translators: %s: file name */ + return sprintf( __( 'File “%s” is not an image.' ), $file ); + } return $image; } @@ -3754,3 +3758,123 @@ function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { return ''; } + +/** + * Retrieve path of paged template in current or parent template. + * + * @since 1.5.0 + * @deprecated 4.7.0 The paged.php template is no longer part of the theme template hierarchy. + * + * @return string Full path to paged template file. + */ +function get_paged_template() { + _deprecated_function( __FUNCTION__, '4.7.0' ); + + return get_query_template( 'paged' ); +} + +/** + * Removes the HTML JavaScript entities found in early versions of Netscape 4. + * + * Previously, this function was pulled in from the original + * import of kses and removed a specific vulnerability only + * existent in early version of Netscape 4. However, this + * vulnerability never affected any other browsers and can + * be considered safe for the modern web. + * + * The regular expression which sanitized this vulnerability + * has been removed in consideration of the performance and + * energy demands it placed, now merely passing through its + * input to the return. + * + * @since 1.0.0 + * @deprecated deprecated since 4.7 + * + * @param string $string + * @return string + */ +function wp_kses_js_entities( $string ) { + _deprecated_function( __FUNCTION__, '4.7.0' ); + + return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string ); +} + +/** + * Sort categories by ID. + * + * Used by usort() as a callback, should not be used directly. Can actually be + * used to sort any term object. + * + * @since 2.3.0 + * @deprecated 4.7.0 Use wp_list_sort() + * @access private + * + * @param object $a + * @param object $b + * @return int + */ +function _usort_terms_by_ID( $a, $b ) { + _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' ); + + if ( $a->term_id > $b->term_id ) + return 1; + elseif ( $a->term_id < $b->term_id ) + return -1; + else + return 0; +} + +/** + * Sort categories by name. + * + * Used by usort() as a callback, should not be used directly. Can actually be + * used to sort any term object. + * + * @since 2.3.0 + * @deprecated 4.7.0 Use wp_list_sort() + * @access private + * + * @param object $a + * @param object $b + * @return int + */ +function _usort_terms_by_name( $a, $b ) { + _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' ); + + return strcmp( $a->name, $b->name ); +} + +/** + * Sort menu items by the desired key. + * + * @since 3.0.0 + * @deprecated 4.7.0 Use wp_list_sort() + * @access private + * + * @global string $_menu_item_sort_prop + * + * @param object $a The first object to compare + * @param object $b The second object to compare + * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. + */ +function _sort_nav_menu_items( $a, $b ) { + global $_menu_item_sort_prop; + + _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' ); + + if ( empty( $_menu_item_sort_prop ) ) + return 0; + + if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) + return 0; + + $_a = (int) $a->$_menu_item_sort_prop; + $_b = (int) $b->$_menu_item_sort_prop; + + if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) + return 0; + elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) + return $_a < $_b ? -1 : 1; + else + return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); +}