Make WordPress Core


Ignore:
Timestamp:
12/14/2018 04:42:55 AM (6 years ago)
Author:
pento
Message:

Build Tools: Update the @wordpress/* packages.

Merges [43801,43803] from the 5.0 branch to trunk.

See #45145.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/blocks/latest-comments.php

    r43752 r44163  
    66 */
    77
    8 /**
    9  * Get the post title.
    10  *
    11  * The post title is fetched and if it is blank then a default string is
    12  * returned.
    13  *
    14  * Copied from `wp-admin/includes/template.php`, but we can't include that
    15  * file because:
    16  *
    17  * 1. It causes bugs with test fixture generation and strange Docker 255 error
    18  *    codes.
    19  * 2. It's in the admin; ideally we *shouldn't* be including files from the
    20  *    admin for a block's output. It's a very small/simple function as well,
    21  *    so duplicating it isn't too terrible.
    22  *
    23  * @since 3.3.0
    24  *
    25  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
    26  * @return string The post title if set; "(no title)" if no title is set.
    27  */
    28 function gutenberg_draft_or_post_title( $post = 0 ) {
    29     $title = get_the_title( $post );
    30     if ( empty( $title ) ) {
    31         $title = __( '(no title)', 'gutenberg' );
     8if ( ! function_exists( 'gutenberg_draft_or_post_title' ) ) {
     9    /**
     10     * Get the post title.
     11     *
     12     * The post title is fetched and if it is blank then a default string is
     13     * returned.
     14     *
     15     * Copied from `wp-admin/includes/template.php`, but we can't include that
     16     * file because:
     17     *
     18     * 1. It causes bugs with test fixture generation and strange Docker 255 error
     19     *    codes.
     20     * 2. It's in the admin; ideally we *shouldn't* be including files from the
     21     *    admin for a block's output. It's a very small/simple function as well,
     22     *    so duplicating it isn't too terrible.
     23     *
     24     * @since 3.3.0
     25     *
     26     * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
     27     * @return string The post title if set; "(no title)" if no title is set.
     28     */
     29    function gutenberg_draft_or_post_title( $post = 0 ) {
     30        $title = get_the_title( $post );
     31        if ( empty( $title ) ) {
     32            $title = __( '(no title)', 'gutenberg' );
     33        }
     34        return esc_html( $title );
    3235    }
    33     return esc_html( $title );
    3436}
    3537
Note: See TracChangeset for help on using the changeset viewer.