WordPressを読む 53-7 /blog/wp-includes/deprecated.php 7
2015/02/19
目次
- 1 /blog/wp-includes/deprecated.php 7
- 2 関数 get_theme()
- 3 関数 get_current_theme()
- 4 関数 clean_pre()
- 5 関数 add_custom_image_header()
- 6 関数 remove_custom_image_header()
- 7 関数 add_custom_background()
- 8 関数 remove_custom_background()
- 9 関数 get_theme_data()
- 10 関数 update_page_cache()
- 11 関数 clean_page_cache()
- 12 関数 wp_explain_nonce()
- 13 関数 sticky_class()
- 14 関数 _get_post_ancestors()
- 15 関数 wp_load_image()
- 16 関数 image_resize()
- 17 関数 wp_get_single_post()
- 18 関数 user_pass_ok()
- 19 関数 _save_post_hook()
- 20 関数 gd_edit_image_support()
- 21 関数 wp_convert_bytes_to_hr()
- 22 関数 _search_terms_tidy()
- 23 関数 rich_edit_exists()
- 24 関数 default_topic_count_text()
- 25 関数 format_to_post()
- 26 関数 like_escape()
- 27 関数 url_is_accessable_via_ssl()
/blog/wp-includes/deprecated.php 7
関数 get_theme()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /** * Retrieve theme data. * * @since 1.5.0 * @deprecated 3.4.0 * @deprecated Use wp_get_theme() * @see wp_get_theme() * * @param string $theme Theme name. * @return array|null Null, if theme name does not exist. Theme data, if exists. */ function get_theme( $theme ) { _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme( $stylesheet )' ); $themes = get_themes(); if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) return $themes[ $theme ]; return null; } |
関数 get_current_theme()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** * Retrieve current theme name. * * @since 1.5.0 * @deprecated 3.4.0 * @deprecated Use (string) wp_get_theme() * @see wp_get_theme() * * @return string */ function get_current_theme() { _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' ); if ( $theme = get_option( 'current_theme' ) ) return $theme; return wp_get_theme()->get('Name'); } |
関数 clean_pre()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /** * Accepts matches array from preg_replace_callback in wpautop() or a string. * * Ensures that the contents of a <<p re>>...<</p re>> HTML block are not * converted into paragraphs or line-breaks. * * @since 1.2.0 * @deprecated 3.4.0 * * @param array|string $matches The array or string * @return string The pre block without paragraph/line-break conversion. */ function clean_pre($matches) { _deprecated_function( __FUNCTION__, '3.4' ); if ( is_array($matches) ) $text = $matches[1] . $matches[2] . "</p re>"; else $text = $matches; $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); $text = str_replace('<p>', "\n", $text); $text = str_replace('</p>', '', $text); return $text; } |
関数 add_custom_image_header()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /** * Add callbacks for image header display. * * @since 2.1.0 * @deprecated 3.4.0 * @deprecated Use add_theme_support('custom-header', $args) * @see add_theme_support() * * @param callback $wp_head_callback Call on 'wp_head' action. * @param callback $admin_head_callback Call on custom header administration screen. * @param callback $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. */ function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-header\', $args )' ); $args = array( 'wp-head-callback' => $wp_head_callback, 'admin-head-callback' => $admin_head_callback, ); if ( $admin_preview_callback ) $args['admin-preview-callback'] = $admin_preview_callback; return add_theme_support( 'custom-header', $args ); } |
関数 remove_custom_image_header()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Remove image header support. * * @since 3.1.0 * @deprecated 3.4.0 * @deprecated Use remove_theme_support('custom-header') * @see remove_theme_support() * * @return bool Whether support was removed. */ function remove_custom_image_header() { _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-header\' )' ); return remove_theme_support( 'custom-header' ); } |
関数 add_custom_background()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /** * Add callbacks for background image display. * * @since 3.0.0 * @deprecated 3.4.0 * @deprecated Use add_theme_support('custom-background, $args) * @see add_theme_support() * * @param callback $wp_head_callback Call on 'wp_head' action. * @param callback $admin_head_callback Call on custom background administration screen. * @param callback $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. */ function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-background\', $args )' ); $args = array(); if ( $wp_head_callback ) $args['wp-head-callback'] = $wp_head_callback; if ( $admin_head_callback ) $args['admin-head-callback'] = $admin_head_callback; if ( $admin_preview_callback ) $args['admin-preview-callback'] = $admin_preview_callback; return add_theme_support( 'custom-background', $args ); } |
関数 remove_custom_background()
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Remove custom background support. * * @since 3.1.0 * @see add_custom_background() * * @return bool Whether support was removed. */ function remove_custom_background() { _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-background\' )' ); return remove_theme_support( 'custom-background' ); } |
関数 get_theme_data()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /** * Retrieve theme data from parsed theme file. * * @since 1.5.0 * @deprecated 3.4.0 * @deprecated Use wp_get_theme() * @see wp_get_theme() * * @param string $theme_file Theme file path. * @return array Theme data. */ function get_theme_data( $theme_file ) { _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' ); $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); $theme_data = array( 'Name' => $theme->get('Name'), 'URI' => $theme->display('ThemeURI', true, false), 'Description' => $theme->display('Description', true, false), 'Author' => $theme->display('Author', true, false), 'AuthorURI' => $theme->display('AuthorURI', true, false), 'Version' => $theme->get('Version'), 'Template' => $theme->get('Template'), 'Status' => $theme->get('Status'), 'Tags' => $theme->get('Tags'), 'Title' => $theme->get('Name'), 'AuthorName' => $theme->get('Author'), ); foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { if ( ! isset( $theme_data[ $extra_header ] ) ) $theme_data[ $extra_header ] = $theme->get( $extra_header ); } return $theme_data; } |
関数 update_page_cache()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Alias of update_post_cache(). * * @see update_post_cache() Posts and pages are the same, alias is intentional * * @since 1.5.1 * @deprecated 3.4.0 * * @param array $pages list of page objects */ function update_page_cache( &$pages ) { _deprecated_function( __FUNCTION__, '3.4', 'update_post_cache()' ); update_post_cache( $pages ); } |
関数 clean_page_cache()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** * Will clean the page in the cache. * * Clean (read: delete) page from cache that matches $id. Will also clean cache * associated with 'all_page_ids' and 'get_pages'. * * @since 2.0.0 * @deprecated 3.4.0 * * @uses do_action() Will call the 'clean_page_cache' hook action. * * @param int $id Page ID to clean */ function clean_page_cache( $id ) { _deprecated_function( __FUNCTION__, '3.4', 'clean_post_cache()' ); clean_post_cache( $id ); } |
関数 wp_explain_nonce()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /** * Retrieve nonce action "Are you sure" message. * * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. * * @since 2.0.4 * @deprecated 3.4.1 * @deprecated Use wp_nonce_ays() * @see wp_nonce_ays() * * @param string $action Nonce action. * @return string Are you sure message. */ function wp_explain_nonce( $action ) { _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); return __( 'Are you sure you want to do this?' ); } |
関数 sticky_class()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Display "sticky" CSS class, if a post is sticky. * * @since 2.7.0 * @deprecated 3.5.0 * @deprecated Use post_class() * @see post_class() * * @param int $post_id An optional post ID. */ function sticky_class( $post_id = null ) { _deprecated_function( __FUNCTION__, '3.5', 'post_class()' ); if ( is_sticky( $post_id ) ) echo ' sticky'; } |
関数 _get_post_ancestors()
1 2 3 4 5 6 7 8 9 10 11 12 13 | /** * Retrieve post ancestors. * * This is no longer needed as WP_Post lazy-loads the ancestors * property with get_post_ancestors(). * * @since 2.3.4 * @deprecated 3.5.0 * @see get_post_ancestors() */ function _get_post_ancestors( &$post ) { _deprecated_function( __FUNCTION__, '3.5' ); } |
関数 wp_load_image()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /** * Load an image from a string, if PHP supports it. * * @since 2.1.0 * @deprecated 3.5.0 * @see wp_get_image_editor() * * @param string $file Filename of the image to load. * @return resource The resulting image resource on success, Error string on failure. */ function wp_load_image( $file ) { _deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' ); if ( is_numeric( $file ) ) $file = get_attached_file( $file ); if ( ! is_file( $file ) ) return sprintf(__('File “%s” doesn’t exist?'), $file); if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); // Set artificially high because GD uses uncompressed images in memory @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) ); $image = imagecreatefromstring( file_get_contents( $file ) ); if ( !is_resource( $image ) ) return sprintf(__('File “%s” is not an image.'), $file); return $image; } |
関数 image_resize()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /** * Scale down an image to fit a particular size and save a new copy of the image. * * The PNG transparency will be preserved using the function, as well as the * image type. If the file going in is PNG, then the resized image is going to * be PNG. The only supported image types are PNG, GIF, and JPEG. * * Some functionality requires API to exist, so some PHP version may lose out * support. This is not the fault of WordPress (where functionality is * downgraded, not actual defects), but of your PHP version. * * @since 2.5.0 * @deprecated 3.5.0 * @see wp_get_image_editor() * * @param string $file Image file path. * @param int $max_w Maximum width to resize to. * @param int $max_h Maximum height to resize to. * @param bool $crop Optional. Whether to crop image or resize. * @param string $suffix Optional. File suffix. * @param string $dest_path Optional. New image file path. * @param int $jpeg_quality Optional, default is 90. Image quality percentage. * @return mixed WP_Error on failure. String with new destination path. */ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { _deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' ); $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) return $editor; $editor->set_quality( $jpeg_quality ); $resized = $editor->resize( $max_w, $max_h, $crop ); if ( is_wp_error( $resized ) ) return $resized; $dest_file = $editor->generate_filename( $suffix, $dest_path ); $saved = $editor->save( $dest_file ); if ( is_wp_error( $saved ) ) return $saved; return $dest_file; } |
関数 wp_get_single_post()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** * Retrieve a single post, based on post ID. * * Has categories in 'post_category' property or key. Has tags in 'tags_input' * property or key. * * @since 1.0.0 * @deprecated 3.5.0 * @see get_post() * * @param int $postid Post ID. * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. * @return object|array Post object or array holding post contents and information */ function wp_get_single_post( $postid = 0, $mode = OBJECT ) { _deprecated_function( __FUNCTION__, '3.5', 'get_post()' ); return get_post( $postid, $mode ); } |
関数 user_pass_ok()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * Check that the user login name and password is correct. * * @since 0.71 * @deprecated 3.5.0 * @deprecated Use wp_authenticate() * @see wp_authenticate() * * @param string $user_login User name. * @param string $user_pass User password. * @return bool False if does not authenticate, true if username and password authenticates. */ function user_pass_ok($user_login, $user_pass) { _deprecated_function( __FUNCTION__, '3.5', 'wp_authenticate()' ); $user = wp_authenticate( $user_login, $user_pass ); if ( is_wp_error( $user ) ) return false; return true; } |
関数 _save_post_hook()
1 2 3 4 5 6 7 | /** * Callback formerly fired on the save_post hook. No longer needed. * * @since 2.3.0 * @deprecated 3.5.0 */ function _save_post_hook() {} |
関数 gd_edit_image_support()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /** * Check if the installed version of GD supports particular image type * * @since 2.9.0 * @deprecated 3.5.0 * @see wp_image_editor_supports() * * @param string $mime_type * @return bool */ function gd_edit_image_support($mime_type) { _deprecated_function( __FUNCTION__, '3.5', 'wp_image_editor_supports()' ); if ( function_exists('imagetypes') ) { switch( $mime_type ) { case 'image/jpeg': return (imagetypes() & IMG_JPG) != 0; case 'image/png': return (imagetypes() & IMG_PNG) != 0; case 'image/gif': return (imagetypes() & IMG_GIF) != 0; } } else { switch( $mime_type ) { case 'image/jpeg': return function_exists('imagecreatefromjpeg'); case 'image/png': return function_exists('imagecreatefrompng'); case 'image/gif': return function_exists('imagecreatefromgif'); } } return false; } |
関数 wp_convert_bytes_to_hr()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /** * Converts an integer byte value to a shorthand byte value. * * @since 2.3.0 * @deprecated 3.6.0 * @deprecated Use size_format() * * @param int $bytes An integer byte value. * @return string A shorthand byte value. */ function wp_convert_bytes_to_hr( $bytes ) { _deprecated_function( __FUNCTION__, '3.6', 'size_format()' ); $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); $log = log( $bytes, 1024 ); $power = (int) $log; $size = pow( 1024, $log - $power ); if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { $unit = $units[ $power ]; } else { $size = $bytes; $unit = $units[0]; } return $size . $unit; } |
関数 _search_terms_tidy()
1 2 3 4 5 6 7 8 9 10 11 | /** * Formerly used internally to tidy up the search terms. * * @access private * @since 2.9.0 * @deprecated 3.7.0 */ function _search_terms_tidy( $t ) { _deprecated_function( __FUNCTION__, '3.7' ); return trim( $t, "\"'\n\r " ); } |
関数 rich_edit_exists()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * Determine if TinyMCE is available. * * Checks to see if the user has deleted the tinymce files to slim down * their WordPress install. * * @since 2.1.0 * @deprecated 3.9.0 * * @return bool Whether TinyMCE exists. */ function rich_edit_exists() { global $wp_rich_edit_exists; _deprecated_function( __FUNCTION__, '3.9' ); if ( ! isset( $wp_rich_edit_exists ) ) $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); return $wp_rich_edit_exists; } |
関数 default_topic_count_text()
1 2 3 4 5 6 7 8 9 10 | /** * Old callback for tag link tooltips. * * @since 2.7.0 * @deprecated 3.9.0 * @access private */ function default_topic_count_text( $count ) { return $count; } |
関数 format_to_post()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Formerly used to escape strings before inserting into the DB. * * Has not performed this function for many, many years. Use wpdb::prepare() instead. * * @since 0.71 * @deprecated 3.9.0 * * @param string $content The text to format. * @return string The very same text. */ function format_to_post( $content ) { _deprecated_function( __FUNCTION__, '3.9' ); return $content; } |
関数 like_escape()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. * * @since 2.5.0 * @deprecated 4.0.0 * @deprecated Use wpdb::esc_like() * * @param string $text The text to be escaped. * @return string text, safe for inclusion in LIKE query. */ function like_escape($text) { _deprecated_function( __FUNCTION__, '4.0', 'wpdb::esc_like()' ); return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); } |
関数 url_is_accessable_via_ssl()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /** * Determines if the URL can be accessed over SSL. * * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access * the URL using https as the scheme. * * @since 2.5.0 * @deprecated 4.0.0 * * @param string $url The URL to test. * @return bool Whether SSL access is available. */ function url_is_accessable_via_ssl( $url ) { _deprecated_function( __FUNCTION__, '4.0' ); $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); if ( !is_wp_error( $response ) ) { $status = wp_remote_retrieve_response_code( $response ); if ( 200 == $status || 401 == $status ) { return true; } } return false; } |