コード例 #1
0
 public static function renderURLHTML($url)
 {
     $favicon = "http://g.etfv.co/{$url}";
     if (class_exists('UFCOE\\Elgg\\Url')) {
         $sniffer = new Url();
         $guid = $sniffer->getGuid($url);
         if ($entity = get_entity($guid)) {
             $favicon = $entity->getIconURL('tiny');
             if (elgg_instanceof($entity->user)) {
                 $text = "@{$entity->username}";
             } else {
                 $text = isset($entity->name) ? $entity->name : $entity->title;
             }
         }
     }
     if (!$text) {
         $embedder = new Embedder($url);
         $meta = $embedder->extractMeta('oembed');
         if ($meta->title) {
             $text = $meta->title;
         } else {
             $text = elgg_get_excerpt($url, 35);
         }
     }
     return elgg_view('output/url', array('text' => "<span class=\"favicon\" style=\"background-image:url({$favicon})\"></span><span class=\"link\">{$text}</span>", 'href' => $url, 'class' => 'extractor-link'));
 }
コード例 #2
0
 function __construct($url = '')
 {
     if (!self::isValidURL($url)) {
         throw new Exception("Embedder class expects a valid URL");
     }
     $this->url = $url;
     $sniffer = new Url();
     $guid = $sniffer->getGuid($this->url);
     if ($guid) {
         $this->guid = $guid;
         $this->entity = get_entity($guid);
     }
 }