wp/wp-includes/post-template.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-includes/post-template.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/post-template.php	Tue Sep 27 16:37:53 2022 +0200
@@ -9,7 +9,7 @@
  */
 
 /**
- * Display the ID of the current item in the WordPress Loop.
+ * Displays the ID of the current item in the WordPress Loop.
  *
  * @since 0.71
  */
@@ -18,7 +18,7 @@
 }
 
 /**
- * Retrieve the ID of the current item in the WordPress Loop.
+ * Retrieves the ID of the current item in the WordPress Loop.
  *
  * @since 2.1.0
  *
@@ -30,7 +30,7 @@
 }
 
 /**
- * Display or retrieve the current post title with optional markup.
+ * Displays or retrieves the current post title with optional markup.
  *
  * @since 0.71
  *
@@ -56,7 +56,7 @@
 }
 
 /**
- * Sanitize the current title when retrieving or displaying.
+ * Sanitizes the current title when retrieving or displaying.
  *
  * Works like the_title(), except the parameters can be in a string or
  * an array. See the function for what can be override in the $args parameter.
@@ -103,11 +103,11 @@
 }
 
 /**
- * Retrieve post title.
+ * Retrieves the post title.
  *
  * If the post is protected and the visitor is not an admin, then "Protected"
- * will be displayed before the post title. If the post is private, then
- * "Private" will be located before the post title.
+ * will be inserted before the post title. If the post is private, then
+ * "Private" will be inserted before the post title.
  *
  * @since 0.71
  *
@@ -172,7 +172,7 @@
 }
 
 /**
- * Display the Post Global Unique Identifier (guid).
+ * Displays the Post Global Unique Identifier (guid).
  *
  * 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
@@ -204,7 +204,7 @@
 }
 
 /**
- * Retrieve the Post Global Unique Identifier (guid).
+ * Retrieves the Post Global Unique Identifier (guid).
  *
  * The guid will appear to be a link, but should not be used as an link to the
  * post. The reason you should not use it as a link, is because of moving the
@@ -233,7 +233,7 @@
 }
 
 /**
- * Display the post content.
+ * Displays the post content.
  *
  * @since 0.71
  *
@@ -256,7 +256,7 @@
 }
 
 /**
- * Retrieve the post content.
+ * Retrieves the post content.
  *
  * @since 0.71
  * @since 5.2.0 Added the `$post` parameter.
@@ -376,7 +376,7 @@
 }
 
 /**
- * Display the post excerpt.
+ * Displays the post excerpt.
  *
  * @since 0.71
  */
@@ -839,7 +839,7 @@
 }
 
 /**
- * Whether post requires password and correct password has been provided.
+ * Determines whether the post requires password and whether a correct password has been provided.
  *
  * @since 2.7.0
  *
@@ -1005,9 +1005,9 @@
 	 *
 	 * @since 3.6.0
 	 *
-	 * @param string $output HTML output of paginated posts' page links.
-	 * @param array  $args   An array of arguments. See wp_link_pages()
-	 *                       for information on accepted arguments.
+	 * @param string       $output HTML output of paginated posts' page links.
+	 * @param array|string $args   An array or query string of arguments. See wp_link_pages()
+	 *                             for information on accepted arguments.
 	 */
 	$html = apply_filters( 'wp_link_pages', $output, $args );
 
@@ -1063,7 +1063,7 @@
 //
 
 /**
- * Retrieve post custom meta data field.
+ * Retrieves post custom meta data field.
  *
  * @since 1.5.0
  *
@@ -1084,13 +1084,14 @@
 }
 
 /**
- * Display a list of post custom fields.
+ * Displays a list of post custom fields.
  *
  * @since 1.2.0
  *
- * @internal This will probably change at some point...
+ * @deprecated 6.0.2 Use get_post_meta() to retrieve post meta and render manually.
  */
 function the_meta() {
+	_deprecated_function( __FUNCTION__, '6.0.2', 'get_post_meta()' );
 	$keys = get_post_custom_keys();
 	if ( $keys ) {
 		$li_html = '';
@@ -1106,8 +1107,8 @@
 			$html = sprintf(
 				"<li><span class='post-meta-key'>%s</span> %s</li>\n",
 				/* translators: %s: Post custom field name. */
-				sprintf( _x( '%s:', 'Post custom field name' ), $key ),
-				$value
+				esc_html( sprintf( _x( '%s:', 'Post custom field name' ), $key ) ),
+				esc_html( $value )
 			);
 
 			/**
@@ -1133,7 +1134,7 @@
 //
 
 /**
- * Retrieve or display a list of pages as a dropdown (select list).
+ * Retrieves or displays a list of pages as a dropdown (select list).
  *
  * @since 2.1.0
  * @since 4.2.0 The `$value_field` argument was added.
@@ -1224,7 +1225,7 @@
 }
 
 /**
- * Retrieve or display a list of pages (or hierarchical post type items) in list (li) format.
+ * Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format.
  *
  * @since 1.5.0
  * @since 4.7.0 Added the `item_spacing` argument.
@@ -1259,7 +1260,8 @@
  *                                      will not be wrapped with unordered list `<ul>` tags. Default 'Pages'.
  *     @type string       $item_spacing Whether to preserve whitespace within the menu's HTML. Accepts 'preserve' or 'discard'.
  *                                      Default 'preserve'.
- *     @type Walker       $walker       Walker instance to use for listing pages. Default empty (Walker_Page).
+ *     @type Walker       $walker       Walker instance to use for listing pages. Default empty which results in a
+ *                                      Walker_Page instance being used.
  * }
  * @return void|string Void if 'echo' argument is true, HTML list of pages if 'echo' is false.
  */
@@ -1381,7 +1383,8 @@
  *     @type string          $after        The HTML or text to append to the menu. Default is '</ul>'.
  *     @type string          $item_spacing Whether to preserve whitespace within the menu's HTML. Accepts 'preserve'
  *                                         or 'discard'. Default 'discard'.
- *     @type Walker          $walker       Walker instance to use for listing pages. Default empty (Walker_Page).
+ *     @type Walker          $walker       Walker instance to use for listing pages. Default empty which results in a
+ *                                         Walker_Page instance being used.
  * }
  * @return void|string Void if 'echo' argument is true, HTML menu if 'echo' is false.
  */
@@ -1513,7 +1516,7 @@
 //
 
 /**
- * Retrieve HTML list content for page list.
+ * Retrieves HTML list content for page list.
  *
  * @uses Walker_Page to create HTML list content.
  * @since 2.1.0
@@ -1521,30 +1524,30 @@
  * @param array $pages
  * @param int   $depth
  * @param int   $current_page
- * @param array $r
+ * @param array $args
  * @return string
  */
-function walk_page_tree( $pages, $depth, $current_page, $r ) {
-	if ( empty( $r['walker'] ) ) {
+function walk_page_tree( $pages, $depth, $current_page, $args ) {
+	if ( empty( $args['walker'] ) ) {
 		$walker = new Walker_Page;
 	} else {
 		/**
 		 * @var Walker $walker
 		 */
-		$walker = $r['walker'];
+		$walker = $args['walker'];
 	}
 
 	foreach ( (array) $pages as $page ) {
 		if ( $page->post_parent ) {
-			$r['pages_with_children'][ $page->post_parent ] = true;
+			$args['pages_with_children'][ $page->post_parent ] = true;
 		}
 	}
 
-	return $walker->walk( $pages, $depth, $r, $current_page );
+	return $walker->walk( $pages, $depth, $args, $current_page );
 }
 
 /**
- * Retrieve HTML dropdown (select) content for page list.
+ * Retrieves HTML dropdown (select) content for page list.
  *
  * @since 2.1.0
  * @since 5.3.0 Formalized the existing `...$args` parameter by adding it
@@ -1574,7 +1577,7 @@
 //
 
 /**
- * Display an attachment page link using an image or icon.
+ * Displays an attachment page link using an image or icon.
  *
  * @since 2.0.0
  *
@@ -1596,7 +1599,7 @@
 }
 
 /**
- * Retrieve an attachment page link using an image or icon, if possible.
+ * Retrieves an attachment page link using an image or icon, if possible.
  *
  * @since 2.5.0
  * @since 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object.
@@ -1646,7 +1649,7 @@
 	 * @since 5.1.0 Added the `$attr` parameter.
 	 *
 	 * @param string       $link_html The page link HTML output.
-	 * @param int          $id        Post ID.
+	 * @param int|WP_Post  $id        Post ID or object. Can be 0 for the current global post.
 	 * @param string|int[] $size      Requested image size. Can be any registered image size name, or
 	 *                                an array of width and height values in pixels (in that order).
 	 * @param bool         $permalink Whether to add permalink to image. Default false.
@@ -1658,7 +1661,7 @@
 }
 
 /**
- * Wrap attachment in paragraph tag before content.
+ * Wraps attachment in paragraph tag before content.
  *
  * @since 2.0.0
  *
@@ -1711,7 +1714,7 @@
 //
 
 /**
- * Retrieve protected post password form content.
+ * Retrieves protected post password form content.
  *
  * @since 1.0.0
  *
@@ -1743,7 +1746,7 @@
 }
 
 /**
- * Determines whether currently in a page template.
+ * Determines whether the current post uses a page template.
  *
  * This template tag allows you to determine if you are in a page template.
  * You can optionally provide a template filename or array of template filenames
@@ -1787,7 +1790,7 @@
 }
 
 /**
- * Get the specific template filename for a given post.
+ * Gets the specific template filename for a given post.
  *
  * @since 3.4.0
  * @since 4.7.0 Now works with any post type, not just pages.
@@ -1813,7 +1816,7 @@
 }
 
 /**
- * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
+ * Retrieves formatted date timestamp of a revision (linked to that revisions's page).
  *
  * @since 2.6.0
  *
@@ -1854,7 +1857,7 @@
 }
 
 /**
- * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
+ * Retrieves formatted date timestamp of a revision (linked to that revisions's page).
  *
  * @since 3.6.0
  *
@@ -1918,7 +1921,7 @@
 }
 
 /**
- * Display a list of a post's revisions.
+ * Displays a list of a post's revisions.
  *
  * Can output either a UL with edit links or a TABLE with diff interface, and
  * restore action links.