WordPressを読む 53-3 /blog/wp-includes/deprecated.php 3
2015/02/19
目次
- 1 /blog/wp-includes/deprecated.php 3
- 2 関数 get_links()
- 3 関数 get_links_list()
- 4 関数 links_popup_script()
- 5 関数 get_linkrating()
- 6 関数 get_linkcatname()
- 7 関数 comments_rss_link()
- 8 関数 get_category_rss_link()
- 9 関数 get_author_rss_link()
- 10 関数 comments_rss()
- 11 関数 create_user()
- 12 関数 gzip_compression()
- 13 関数 get_commentdata()
- 14 関数 get_catname()
- 15 関数 get_category_children()
- 16 関数 get_all_category_ids()
- 17 関数 get_the_author_description()
- 18 関数 the_author_description()
- 19 関数 get_the_author_login()
- 20 関数 the_author_login()
- 21 関数 get_the_author_firstname()
- 22 関数 the_author_firstname()
- 23 関数 get_the_author_lastname()
- 24 関数 the_author_lastname()
/blog/wp-includes/deprecated.php 3
関数 get_links()
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | /** * Gets the links associated with category by id. * * @since 0.71 * @deprecated 2.1.0 * @deprecated Use get_bookmarks() * @see get_bookmarks() * * @param int $category The category to use. If no category supplied uses all * @param string $before the html to output before the link * @param string $after the html to output after the link * @param string $between the html to output between the link/image and its description. * Not used if no image or show_images == true * @param bool $show_images whether to show images (if defined). * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', * 'description', or 'rating'. Or maybe owner. If you start the name with an * underscore the order will be reversed. You can also specify 'rand' as the order * which will return links in a random order. * @param bool $show_description whether to show the description if show_images=false/not defined. * @param bool $show_rating show rating stars/chars * @param int $limit Limit to X entries. If not specified, all entries are shown. * @param int $show_updated whether to show last updated timestamp * @param bool $echo whether to echo the results, or return them instead * @return null|string */ function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' ); $order = 'ASC'; if ( substr($orderby, 0, 1) == '_' ) { $order = 'DESC'; $orderby = substr($orderby, 1); } if ( $category == -1 ) //get_bookmarks uses '' to signify all categories $category = ''; $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); if ( !$results ) return; $output = ''; foreach ( (array) $results as $row ) { if ( !isset($row->recently_updated) ) $row->recently_updated = false; $output .= $before; if ( $show_updated && $row->recently_updated ) $output .= get_option('links_recently_updated_prepend'); $the_link = '#'; if ( !empty($row->link_url) ) $the_link = esc_url($row->link_url); $rel = $row->link_rel; if ( '' != $rel ) $rel = ' rel="' . $rel . '"'; $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); $title = $desc; if ( $show_updated ) if (substr($row->link_updated_f, 0, 2) != '00') $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; if ( '' != $title ) $title = ' title="' . $title . '"'; $alt = ' alt="' . $name . '"'; $target = $row->link_target; if ( '' != $target ) $target = ' target="' . $target . '"'; $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; if ( $row->link_image != null && $show_images ) { if ( strpos($row->link_image, 'http') !== false ) $output .= "<img src=\"$row->link_image\" $alt $title />"; else // If it's a relative path $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; } else { $output .= $name; } $output .= '</a>'; if ( $show_updated && $row->recently_updated ) $output .= get_option('links_recently_updated_append'); if ( $show_description && '' != $desc ) $output .= $between . $desc; if ($show_rating) { $output .= $between . get_linkrating($row); } $output .= "$after\n"; } // end while if ( !$echo ) return $output; echo $output; } |
関数 get_links_list()
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 45 | /** * Output entire list of links by category. * * Output a list of all links, listed by category, using the settings in * $wpdb->linkcategories and output it as a nested HTML unordered list. * * @since 1.0.1 * @deprecated 2.1.0 * @deprecated Use wp_list_bookmarks() * @see wp_list_bookmarks() * * @param string $order Sort link categories by 'name' or 'id' */ function get_links_list($order = 'name') { _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' ); $order = strtolower($order); // Handle link category sorting $direction = 'ASC'; if ( '_' == substr($order,0,1) ) { $direction = 'DESC'; $order = substr($order,1); } if ( !isset($direction) ) $direction = ''; $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); // Display each category if ( $cats ) { foreach ( (array) $cats as $cat ) { // Handle each category. // Display the category name echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; // Call get_links() with all the appropriate params get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); // Close the last category echo "\n\t</ul>\n</li>\n"; } } } |
関数 links_popup_script()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /** * Show the link to the links popup and the number of links. * * @since 0.71 * @deprecated 2.1.0 * @deprecated {@internal Use function instead is unknown}} * * @param string $text the text of the link * @param int $width the width of the popup window * @param int $height the height of the popup window * @param string $file the page to open in the popup window * @param bool $count the number of links in the db */ function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { _deprecated_function( __FUNCTION__, '2.1' ); } |
関数 get_linkrating()
1 2 3 4 5 6 7 8 9 10 11 12 13 | /** * @since 1.0.1 * @deprecated 2.1.0 * @deprecated Use sanitize_bookmark_field() * @see sanitize_bookmark_field() * * @param object $link * @return unknown */ function get_linkrating($link) { _deprecated_function( __FUNCTION__, '2.1', 'sanitize_bookmark_field()' ); return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); } |
関数 get_linkcatname()
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 | /** * Gets the name of category by id. * * @since 0.71 * @deprecated 2.1.0 * @deprecated Use get_category() * @see get_category() * * @param int $id The category to get. If no category supplied uses 0 * @return string */ function get_linkcatname($id = 0) { _deprecated_function( __FUNCTION__, '2.1', 'get_category()' ); $id = (int) $id; if ( empty($id) ) return ''; $cats = wp_get_link_cats($id); if ( empty($cats) || ! is_array($cats) ) return ''; $cat_id = (int) $cats[0]; // Take the first cat. $cat = get_category($cat_id); return $cat->name; } |
関数 comments_rss_link()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Print RSS comment feed link. * * @since 1.0.1 * @deprecated 2.5.0 * @deprecated Use post_comments_feed_link() * @see post_comments_feed_link() * * @param string $link_text */ function comments_rss_link($link_text = 'Comments RSS') { _deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' ); post_comments_feed_link($link_text); } |
関数 get_category_rss_link()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /** * Print/Return link to category RSS2 feed. * * @since 1.2.0 * @deprecated 2.5.0 * @deprecated Use get_category_feed_link() * @see get_category_feed_link() * * @param bool $echo * @param int $cat_ID * @return string|null */ function get_category_rss_link($echo = false, $cat_ID = 1) { _deprecated_function( __FUNCTION__, '2.5', 'get_category_feed_link()' ); $link = get_category_feed_link($cat_ID, 'rss2'); if ( $echo ) echo $link; return $link; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * Print/Return link to author RSS feed. * * @since 1.2.0 * @deprecated 2.5.0 * @deprecated Use get_author_feed_link() * @see get_author_feed_link() * * @param bool $echo * @param int $author_id * @return string|null */ function get_author_rss_link($echo = false, $author_id = 1) { _deprecated_function( __FUNCTION__, '2.5', 'get_author_feed_link()' ); $link = get_author_feed_link($author_id); if ( $echo ) echo $link; return $link; } |
関数 comments_rss()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Return link to the post RSS feed. * * @since 1.5.0 * @deprecated 2.2.0 * @deprecated Use get_post_comments_feed_link() * @see get_post_comments_feed_link() * * @return string */ function comments_rss() { _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' ); return esc_url( get_post_comments_feed_link() ); } |
関数 create_user()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /** * An alias of wp_create_user(). * * @since 2.0.0 * @deprecated 2.0.0 * @deprecated Use wp_create_user() * @see wp_create_user() * * @param string $username The user's username. * @param string $password The user's password. * @param string $email The user's email (optional). * @return int The new user's ID. */ function create_user($username, $password, $email) { _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' ); return wp_create_user($username, $password, $email); } |
関数 gzip_compression()
1 2 3 4 5 6 7 8 9 | /** * Unused function. * * @deprecated 2.5.0 */ function gzip_compression() { _deprecated_function( __FUNCTION__, '2.5' ); return false; } |
関数 get_commentdata()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /** * Retrieve an array of comment data about comment $comment_ID. * * @since 0.71 * @deprecated 2.7.0 * @deprecated Use get_comment() * @see get_comment() * * @param int $comment_ID The ID of the comment * @param int $no_cache Whether to use the cache (cast to bool) * @param bool $include_unapproved Whether to include unapproved comments * @return array The comment data */ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' ); return get_comment($comment_ID, ARRAY_A); } |
関数 get_catname()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Retrieve the category name by the category ID. * * @since 0.71 * @deprecated 2.8.0 * @deprecated Use get_cat_name() * @see get_cat_name() * * @param int $cat_ID Category ID * @return string category name */ function get_catname( $cat_ID ) { _deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' ); return get_cat_name( $cat_ID ); } |
関数 get_category_children()
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 | /** * Retrieve category children list separated before and after the term IDs. * * @since 1.2.0 * @deprecated 2.8.0 * @deprecated Use get_term_children() * @see get_term_children() * * @param int $id Category ID to retrieve children. * @param string $before Optional. Prepend before category term ID. * @param string $after Optional, default is empty string. Append after category term ID. * @param array $visited Optional. Category Term IDs that have already been added. * @return string */ function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { _deprecated_function( __FUNCTION__, '2.8', 'get_term_children()' ); if ( 0 == $id ) return ''; $chain = ''; /** TODO: consult hierarchy */ $cat_ids = get_all_category_ids(); foreach ( (array) $cat_ids as $cat_id ) { if ( $cat_id == $id ) continue; $category = get_category( $cat_id ); if ( is_wp_error( $category ) ) return $category; if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { $visited[] = $category->term_id; $chain .= $before.$category->term_id.$after; $chain .= get_category_children( $category->term_id, $before, $after ); } } return $chain; } |
関数 get_all_category_ids()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * Retrieves all category IDs. * * @since 2.0.0 * @deprecated 4.0.0 Use get_terms() instead. * @see get_terms() * @link http://codex.wordpress.org/Function_Reference/get_all_category_ids * * @return object List of all of the category IDs. */ function get_all_category_ids() { _deprecated_function( __FUNCTION__, '4.0', 'get_terms()' ); if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) { $cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') ); wp_cache_add( 'all_category_ids', $cat_ids, 'category' ); } return $cat_ids; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Retrieve the description of the author of the current post. * * @since 1.5.0 * @deprecated 2.8.0 * @deprecated Use get_the_author_meta('description') * @see get_the_author_meta() * * @return string The author's description. */ function get_the_author_description() { _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' ); return get_the_author_meta('description'); } |
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Display the description of the author of the current post. * * @since 1.0.0 * @deprecated 2.8.0 * @deprecated Use the_author_meta('description') * @see the_author_meta() */ function the_author_description() { _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'description\')' ); the_author_meta('description'); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Retrieve the login name of the author of the current post. * * @since 1.5.0 * @deprecated 2.8.0 * @deprecated Use get_the_author_meta('login') * @see get_the_author_meta() * * @return string The author's login name (username). */ function get_the_author_login() { _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' ); return get_the_author_meta('login'); } |
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Display the login name of the author of the current post. * * @since 0.71 * @deprecated 2.8.0 * @deprecated Use the_author_meta('login') * @see the_author_meta() */ function the_author_login() { _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'login\')' ); the_author_meta('login'); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Retrieve the first name of the author of the current post. * * @since 1.5.0 * @deprecated 2.8.0 * @deprecated Use get_the_author_meta('first_name') * @see get_the_author_meta() * * @return string The author's first name. */ function get_the_author_firstname() { _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' ); return get_the_author_meta('first_name'); } |
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Display the first name of the author of the current post. * * @since 0.71 * @deprecated 2.8.0 * @deprecated Use the_author_meta('first_name') * @see the_author_meta() */ function the_author_firstname() { _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' ); the_author_meta('first_name'); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Retrieve the last name of the author of the current post. * * @since 1.5.0 * @deprecated 2.8.0 * @deprecated Use get_the_author_meta('last_name') * @see get_the_author_meta() * * @return string The author's last name. */ function get_the_author_lastname() { _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' ); return get_the_author_meta('last_name'); } |
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Display the last name of the author of the current post. * * @since 0.71 * @deprecated 2.8.0 * @deprecated Use the_author_meta('last_name') * @see the_author_meta() */ function the_author_lastname() { _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' ); the_author_meta('last_name'); } |