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')); }
/** * Get an embeddable representation of a URL * @param string $url URL to embed * @param array $params Additional params * @return string HTML */ public static function getEmbedView($url = '', $params = array()) { try { if ($url instanceof ElggEntity) { $url = $url->getURL(); } $embedder = new Embedder($url); return $embedder->getView($params); } catch (Exception $ex) { return elgg_view('output/longtext', array('value' => $url)); } }
<?php namespace hypeJunction\Wall; use hypeJunction\Util\Embedder; $entity = elgg_extract('entity', $vars); if (!elgg_instanceof($entity)) { return; } elgg_push_context('embed'); echo Embedder::getEmbedView($entity->getURL(), $vars); elgg_pop_context();
<?php namespace hypeJunction\Wall; use hypeJunction\Util\Embedder; $value = elgg_extract('value', $vars); elgg_push_context('embed'); echo Embedder::getEmbedView($value, $vars); elgg_pop_context();
foreach ($upload_guids as $upload_guid) { $upload = get_entity($upload_guid); $upload->description = $wall_post->description; $upload->origin = 'wall'; $upload->access_id = $wall_post->access_id; $upload->container_guid = $container->canWriteToContainer($poster->guid, 'object', 'file') ? $container->guid : ELGG_ENTITIES_ANY_VALUE; $upload->save(); add_entity_relationship($upload_guid, 'attached', $wall_post->guid); } } $wall_post->setLocation($location); if ($fp = curl_init($address)) { $wall_post->address = $address; } if ($wall_post->address && get_input('make_bookmark', false)) { $embedder = new Embedder($wall_post->address); $document = $embedder->extractMeta('iframely'); $bookmark = new ElggObject(); $bookmark->subtype = "bookmarks"; $bookmark->container_guid = $container->canWriteToContainer($poster->guid, 'object', 'bookmarks') ? $container->guid : ELGG_ENTITIES_ANY_VALUE; $bookmark->address = $wall_post->address; $bookmark->access_id = $access_id; $bookmark->origin = 'wall'; if (!$document) { $bookmark->title = $wall_post->title; $bookmark->description = $wall_post->description; $bookmark->tags = $wall_post->tags; } else { $bookmark->title = filter_tags($document->meta->title); $bookmark->description = filter_tags($document->meta->description); $bookmark->tags = string_to_tag_array(filter_tags($document->meta->keywords));