Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_bookmark [ WordPress Function ]

get_bookmark ( $bookmark, $output = OBJECT, $filter = 'raw' )
Parameters:
  • (mixed) $bookmark
  • (string) $output Optional. Either OBJECT, ARRAY_N, or ARRAY_A constant
  • (string) $filter Optional, default is 'raw'.
Uses:
  • $wpdb
Returns:
  • (array|object) Type returned depends on $output value.
Defined at:



Retrieve Bookmark data

Source


<?php
function get_bookmark($bookmark$output OBJECT$filter 'raw') {
    global 
$wpdb;

    if ( empty(
$bookmark) ) {
        if ( isset(
$GLOBALS['link']) )
            
$_bookmark = & $GLOBALS['link'];
        else
            
$_bookmark null;
    } elseif ( 
is_object($bookmark) ) {
        
wp_cache_add($bookmark->link_id$bookmark'bookmark');
        
$_bookmark $bookmark;
    } else {
        if ( isset(
$GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark) ) {
            
$_bookmark = & $GLOBALS['link'];
        } elseif ( ! 
$_bookmark wp_cache_get($bookmark'bookmark') ) {
            
$_bookmark $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1"$bookmark));
            
$_bookmark->link_category array_uniquewp_get_object_terms($_bookmark->link_id'link_category', array('fields' => 'ids')) );
            
wp_cache_add($_bookmark->link_id$_bookmark'bookmark');
        }
    }

    
$_bookmark sanitize_bookmark($_bookmark$filter);

    if ( 
$output == OBJECT ) {
        return 
$_bookmark;
    } elseif ( 
$output == ARRAY_A ) {
        return 
get_object_vars($_bookmark);
    } elseif ( 
$output == ARRAY_N ) {
        return 
array_values(get_object_vars($_bookmark));
    } else {
        return 
$_bookmark;
    }
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics