Trean::getFavicon PHP Method

getFavicon() static public method

Returns an apropriate icon for the given bookmark.
static public getFavicon ( Trean_Bookmark $bookmark ) : Horde_Url
$bookmark Trean_Bookmark The bookmark object.
return Horde_Url The URL for the image.
    static function getFavicon($bookmark)
    {
        if ($bookmark->favicon_url) {
            return Horde::url('favicon.php')->add('bookmark_id', $bookmark->id);
        } else {
            // Default to the protocol icon.
            $protocol = substr($bookmark->url, 0, strpos($bookmark->url, '://'));
            return Horde_Themes::img('protocol/' . (empty($protocol) ? 'http' : $protocol) . '.png');
        }
    }

Usage Example

示例#1
0
echo _("Clicks");
?>
</th>
  <th width="10%" class="horde-split-left nosort"></th>
 </tr>
</thead>
<tbody id="BookmarkList-body">
 <?php 
foreach ($this->bookmarks as $bookmark) {
    ?>
 <tr>
  <td>
   <div class="trean-bookmarks-title">
    <div class="trean-favicon-container">
     <?php 
    echo Horde::img(Trean::getFavicon($bookmark), '', array('class' => 'trean-favicon'));
    ?>
    </div>
    <?php 
    if ($bookmark->http_status == 'error') {
        echo Horde::img('http/error.png');
    } elseif ($bookmark->http_status) {
        echo Horde::img('http/' . (int) substr($bookmark->http_status, 0, 1) . 'xx.png');
    }
    ?>
    <?php 
    echo $this->redirectUrl->add('b', $bookmark->id)->link(array('target' => $this->target)) . $this->h($bookmark->title ? $bookmark->title : $bookmark->url);
    ?>
</a>
    <small>
      <?php 
All Usage Examples Of Trean::getFavicon