]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/post-template.php
WordPress 4.5.1
[autoinstalls/wordpress.git] / wp-includes / post-template.php
index 3164509b8e4fda1d3986c0c0a1b1be04277b079a..3da42457c8c74cdaea5435909bc1b9345a9d58c9 100644 (file)
@@ -161,17 +161,22 @@ function get_the_title( $post = 0 ) {
 /**
  * Display the Post Global Unique Identifier (guid).
  *
- * The guid will appear to be a link, but should not be used as an link to the
+ * The guid will appear to be a link, but should not be used as a link to the
  * post. The reason you should not use it as a link, is because of moving the
  * blog across domains.
  *
- * Url is escaped to make it xml safe
+ * URL is escaped to make it XML-safe.
  *
  * @since 1.5.0
  *
- * @param int|WP_Post $id Optional. Post ID or post object.
+ * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
  */
-function the_guid( $id = 0 ) {
+function the_guid( $post = 0 ) {
+       $post = get_post( $post );
+
+       $guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
+       $id   = isset( $post->ID ) ? $post->ID : 0;
+
        /**
         * Filter the escaped Global Unique Identifier (guid) of the post.
         *
@@ -179,9 +184,10 @@ function the_guid( $id = 0 ) {
         *
         * @see get_the_guid()
         *
-        * @param string $post_guid Escaped Global Unique Identifier (guid) of the post.
+        * @param string $guid Escaped Global Unique Identifier (guid) of the post.
+        * @param int    $id   The post ID.
         */
-       echo apply_filters( 'the_guid', get_the_guid( $id ) );
+       echo apply_filters( 'the_guid', $guid, $id );
 }
 
 /**
@@ -193,20 +199,24 @@ function the_guid( $id = 0 ) {
  *
  * @since 1.5.0
  *
- * @param int|WP_Post $id Optional. Post ID or post object.
+ * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
  * @return string
  */
-function get_the_guid( $id = 0 ) {
-       $post = get_post($id);
+function get_the_guid( $post = 0 ) {
+       $post = get_post( $post );
+
+       $guid = isset( $post->guid ) ? $post->guid : '';
+       $id   = isset( $post->ID ) ? $post->ID : 0;
 
        /**
         * Filter the Global Unique Identifier (guid) of the post.
         *
         * @since 1.5.0
         *
-        * @param string $post_guid Global Unique Identifier (guid) of the post.
+        * @param string $guid Global Unique Identifier (guid) of the post.
+        * @param int    $id   The post ID.
         */
-       return apply_filters( 'get_the_guid', $post->guid );
+       return apply_filters( 'get_the_guid', $guid, $id );
 }
 
 /**
@@ -344,23 +354,25 @@ function the_excerpt() {
 }
 
 /**
- * Retrieve the post excerpt.
+ * Retrieves the post excerpt.
  *
  * @since 0.71
+ * @since 4.5.0 Introduced the `$post` parameter.
  *
- * @param mixed $deprecated Not used.
- * @return string
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return string Post excerpt.
  */
-function get_the_excerpt( $deprecated = '' ) {
-       if ( !empty( $deprecated ) )
+function get_the_excerpt( $post = null ) {
+       if ( is_bool( $post ) ) {
                _deprecated_argument( __FUNCTION__, '2.3' );
+       }
 
-       $post = get_post();
+       $post = get_post( $post );
        if ( empty( $post ) ) {
                return '';
        }
 
-       if ( post_password_required() ) {
+       if ( post_password_required( $post ) ) {
                return __( 'There is no excerpt because this is a protected post.' );
        }
 
@@ -368,10 +380,12 @@ function get_the_excerpt( $deprecated = '' ) {
         * Filter the retrieved post excerpt.
         *
         * @since 1.2.0
+        * @since 4.5.0 Introduced the `$post` parameter.
         *
         * @param string $post_excerpt The post excerpt.
+        * @param WP_Post $post Post object.
         */
-       return apply_filters( 'get_the_excerpt', $post->post_excerpt );
+       return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
 }
 
 /**
@@ -689,6 +703,10 @@ function get_body_class( $class = '' ) {
        if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() )
                $classes[] = 'custom-background';
 
+       if ( has_custom_logo() ) {
+               $classes[] = 'wp-custom-logo';
+       }
+
        $page = $wp_query->get( 'page' );
 
        if ( ! $page || $page < 2 )
@@ -1515,7 +1533,7 @@ function get_the_password_form( $post = 0 ) {
        $label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
        $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
        <p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
-       <p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__( 'Submit' ) . '" /></p></form>
+       <p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form>
        ';
 
        /**