wp/wp-includes/bookmark.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
--- a/wp/wp-includes/bookmark.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/bookmark.php	Fri Sep 05 18:40:08 2025 +0200
@@ -7,11 +7,12 @@
  */
 
 /**
- * Retrieve Bookmark data
+ * Retrieves bookmark data.
  *
  * @since 2.1.0
  *
- * @global wpdb $wpdb WordPress database abstraction object.
+ * @global object $link Current link object.
+ * @global wpdb   $wpdb WordPress database abstraction object.
  *
  * @param int|stdClass $bookmark
  * @param string       $output   Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
@@ -33,7 +34,7 @@
 		wp_cache_add( $bookmark->link_id, $bookmark, 'bookmark' );
 		$_bookmark = $bookmark;
 	} else {
-		if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id == $bookmark ) ) {
+		if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id === $bookmark ) ) {
 			$_bookmark = & $GLOBALS['link'];
 		} else {
 			$_bookmark = wp_cache_get( $bookmark, 'bookmark' );
@@ -65,13 +66,13 @@
 }
 
 /**
- * Retrieve single bookmark data item or field.
+ * Retrieves single bookmark data item or field.
  *
  * @since 2.3.0
  *
  * @param string $field    The name of the data field to return.
  * @param int    $bookmark The bookmark ID to get field.
- * @param string $context  Optional. The context of how the field will be used.
+ * @param string $context  Optional. The context of how the field will be used. Default 'display'.
  * @return string|WP_Error
  */
 function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
@@ -94,7 +95,7 @@
 }
 
 /**
- * Retrieves the list of bookmarks
+ * Retrieves the list of bookmarks.
  *
  * Attempts to retrieve from the cache first based on MD5 hash of arguments. If
  * that fails, then the query will be built from the arguments and executed. The
@@ -306,7 +307,7 @@
 	$query  = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query";
 	$query .= " $exclusions $inclusions $search";
 	$query .= " ORDER BY $orderby $order";
-	if ( -1 != $parsed_args['limit'] ) {
+	if ( -1 !== $parsed_args['limit'] ) {
 		$query .= ' LIMIT ' . absint( $parsed_args['limit'] );
 	}
 
@@ -404,8 +405,10 @@
 	switch ( $field ) {
 		case 'link_category': // array( ints )
 			$value = array_map( 'absint', (array) $value );
-			// We return here so that the categories aren't filtered.
-			// The 'link_category' filter is for the name of a link category, not an array of a link's link categories.
+			/*
+			 * We return here so that the categories aren't filtered.
+			 * The 'link_category' filter is for the name of a link category, not an array of a link's link categories.
+			 */
 			return $value;
 
 		case 'link_visible': // bool stored as Y|N