Docs: Document the $link global in get_bookmark().

Follow-up to [8758].

Props upadalavipul, mukesh27.
See .

git-svn-id: https://develop.svn.wordpress.org/trunk@57191 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-12-15 12:57:07 +00:00
parent 7914d30555
commit bd88eafee1

@ -11,7 +11,8 @@
* *
* @since 2.1.0 * @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 int|stdClass $bookmark
* @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
@ -21,11 +22,11 @@
* @return array|object|null Type returned depends on $output value. * @return array|object|null Type returned depends on $output value.
*/ */
function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) { function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
global $wpdb; global $link, $wpdb;
if ( empty( $bookmark ) ) { if ( empty( $bookmark ) ) {
if ( isset( $GLOBALS['link'] ) ) { if ( isset( $link ) ) {
$_bookmark = & $GLOBALS['link']; $_bookmark = &$link;
} else { } else {
$_bookmark = null; $_bookmark = null;
} }
@ -33,8 +34,8 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
wp_cache_add( $bookmark->link_id, $bookmark, 'bookmark' ); wp_cache_add( $bookmark->link_id, $bookmark, 'bookmark' );
$_bookmark = $bookmark; $_bookmark = $bookmark;
} else { } else {
if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id == $bookmark ) ) { if ( isset( $link ) && ( $link->link_id == $bookmark ) ) {
$_bookmark = & $GLOBALS['link']; $_bookmark = &$link;
} else { } else {
$_bookmark = wp_cache_get( $bookmark, 'bookmark' ); $_bookmark = wp_cache_get( $bookmark, 'bookmark' );
if ( ! $_bookmark ) { if ( ! $_bookmark ) {