/** * Render view. * * @return string */ public function content() { ob_start(); $foursquare = $this->venue->foursquare(); if (!$foursquare) { echo new View_Alert(__('This venue has not been linked to Foursquare yet.'), null, View_Alert::INFO); } else { // Homepage echo HTML::anchor(Arr::path($foursquare, 'short_url'), HTML::image(Arr::path($foursquare, 'primarycategory.iconurl'), array('alt' => HTML::chars(Arr::path($foursquare, 'primarycategory.nodename')), 'title' => HTML::chars(Arr::path($foursquare, 'primarycategory.nodename')))) . ' ' . HTML::chars(Arr::path($foursquare, 'primarycategory.nodename'))), '<br />'; // Mayor if ($mayor = Arr::path($foursquare, 'stats.mayor.user')) { echo __('Mayor: :mayor, :city', array(':mayor' => HTML::anchor('http://foursquare.com/user/' . Arr::get($mayor, 'id'), HTML::chars(Arr::get($mayor, 'firstname')) . ' ' . HTML::chars(Arr::get($mayor, 'lastname'))), ':city' => HTML::chars($mayor['homecity']))), '<br />'; } // Checkins echo __('Check-ins: :checkins', array(':checkins' => '<var>' . Arr::path($foursquare, 'stats.checkins') . '</var>')), '<br />'; // Here now echo __('Here now: :herenow', array(':herenow' => '<var>' . Arr::path($foursquare, 'stats.herenow') . '</var>')), '<br />'; // Tips if ($tips = Arr::path($foursquare, 'tips')) { echo '<h5>', __('Tips (:tips)', array(':tips' => '<var>' . count($tips) . '</var>')), '</h5><dl>'; foreach (array_slice($tips, 0, 5) as $tip) { echo '<dt>', HTML::anchor('http://foursquare.com/user/' . Arr::path($tip, 'user.id'), HTML::chars(Arr::path($tip, 'user.firstname')) . ' ' . HTML::chars(Arr::path($tip, 'user.lastname'))), ', ', HTML::chars(Arr::path($tip, 'user.homecity')), ':</dt>'; echo '<dd>', Text::auto_p(HTML::chars(Arr::path($tip, 'text'))), '</dd>'; } echo '</dl>'; } } // Admin controls if (Permission::has($this->venue, Model_Venue::PERMISSION_UPDATE)) { echo HTML::anchor('#map', __('Link to Foursquare'), array('class' => 'action', 'id' => 'link-foursquare')); echo $this->form(); } return ob_get_clean(); }
/** * Render content. * * @return string */ public function content() { ob_start(); // Stamp echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true); // Location if ($this->event->venue) { echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name); } elseif ($this->event->venue_name) { echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : ''; } elseif ($this->event->city_name) { echo ' @ ', HTML::chars($this->event->city_name); } // Flyer if ($this->event->flyer_front) { echo '<figure>', HTML::image($this->event->flyer_front->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>'; } elseif ($this->event->flyer_back) { echo '<figure>', HTML::image($this->event->flyer_back->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>'; } elseif (Valid::url($this->event->flyer_front_url)) { echo '<br /><figure>', HTML::image($this->event->flyer_front_url, array('width' => 160)), '</figure>'; } // Favorites if ($this->event->favorite_count) { echo '<span class="stats"><i class="icon-heart"></i> ' . $this->event->favorite_count . '</span>'; } return ob_get_clean(); }
/** * Render content. * * @return string */ public function content() { ob_start(); // Stamp echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true); // Location if ($this->event->venue) { echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name); } elseif ($this->event->venue_name) { echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : ''; } elseif ($this->event->city_name) { echo ' @ ', HTML::chars($this->event->city_name); } // Flyer if ($flyer = $this->event->flyer()) { echo '<figure>', HTML::image($flyer->image_url(Model_Image::SIZE_THUMBNAIL)), '</figure>'; } elseif ($this->event->flyer_front_url) { echo '<figure>', HTML::image($this->event->flyer_front_url, ['class' => 'img-responsive']), '</figure>'; } // Favorites if ($this->event->favorite_count) { echo '<span class="stats"><i class="fa fa-heart"></i> ' . $this->event->favorite_count . '</span>'; } return ob_get_clean(); }
/** * Render content. * * @return string */ public function content() { ob_start(); // Cover if (Valid::url($this->track->cover)) { echo HTML::image($this->track->cover, array('class' => 'cover img-responsive', 'alt' => __('Cover'))); } // Time if ($this->track->size_time) { echo '<i class="fa fa-fw fa-clock-o"></i> ' . $this->track->size_time . '<br />'; } // Listen count if ($this->track->listen_count > 1) { echo '<i class="fa fa-fw fa-play"></i> ' . ($this->track->listen_count == 1 ? __(':count play', array(':count' => $this->track->listen_count)) : __(':count plays', array(':count' => $this->track->listen_count))) . '<br />'; } // Tags if ($tags = $this->track->tags()) { echo '<i class="fa fa-fw fa-music"></i> ' . implode(', ', $tags) . '<br />'; } elseif (!empty($this->track->music)) { echo '<i class="fa fa-fw fa-music"></i> ' . $this->track->music . '<br />'; } // Meta echo '<footer class="meta text-muted">'; echo __('Added :date', array(':date' => HTML::time(Date::format(Date::DMY_SHORT, $this->track->created), $this->track->created))); echo '</footer>'; return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); echo '<figure>', HTML::image($this->image->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>'; // Tagged people $notes = $this->image->notes(); if (count($notes)) { $names = array(); /** @var Model_Image_Note $note */ foreach ($notes as $note) { $user = $note->user(); $names[] = $user ? HTML::user($user['username']) : HTML::chars($note->name); } echo implode(', ', $names); } // Copyright if ($this->image->author_id) { echo '<br />© ', HTML::user($this->image->author_id); } // Comments if ($this->image->comment_count) { echo '<span class="stats"><i class="icon-comment"></i> ' . $this->image->comment_count . '</span>'; } return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); ?> <ul class="thumbnails"> <?php foreach ($this->flyers as $flyer) { $name = $flyer->event ? $flyer->event->name : $flyer->name; ?> <li class="span2"> <?php echo HTML::anchor(Route::get('flyer')->uri(array('id' => $flyer->id)), HTML::image($flyer->image->get_url('thumbnail')), array('class' => 'thumbnail')); ?> <h4><?php echo HTML::anchor(Route::get('flyer')->uri(array('id' => $flyer->id)), HTML::chars($name), array('title' => HTML::chars($name))); ?> </h4> </li> <?php } ?> </ul> <?php return ob_get_clean(); }
public static function star_loop_yellow($stars) { for ($x = 0; $x < $stars; $x++) { $img_path = 'images/star_yellow.png'; echo HTML::image($img_path, ''); } }
public function image($data, $name, $default = NULL, $attrs = array()) { $default_attrs = array('property' => $name, 'property-type' => 'image'); $attrs = Arr::merge($default_attrs, $attrs); $href = $this->get($data, $name, $default); return HTML::image($href, $attrs); }
/** * Render view. * * @return string */ public function content() { ob_start(); if ($this->image) { $image = HTML::image(is_string($this->image) ? $this->image : $this->image->get_url(), array('width' => 290)); ?> <div id="slideshow-image"> <?php echo isset($this->link) && $this->link ? HTML::anchor($this->link, $image) : $image; ?> </div> <?php } else { ?> <div class="well"> <?php echo __('No images yet.'); ?> </div> <?php } return ob_get_clean(); }
public function input($name, $value, array $attr = NULL) { $input = Form::file($name, $attr); if ($value) { $input .= HTML::image($this->verbose($value)); } return $input; }
/** * If values is yes/no * @param string $value * @return string */ public function on_show($value) { if (isset($this->item['yesno'])) { return HTML::image('media/gfx/' . $value . '.png'); } else { return $value; } }
/** * Render view. * * @return string */ public function content() { ob_start(); ?> <div class="row"> <?php foreach ($this->images as $image) { $gallery = $image->gallery(); ?> <div class="<?php echo $this->wide ? 'col-xs-6 col-sm-4 col-md-3 col-lg-2' : 'col-xs-12 col-sm-6'; ?> "> <div class="thumbnail"> <?php echo HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id)), HTML::image($image->get_url('thumbnail', $gallery->dir))); ?> <div class="caption"> <h4><?php echo HTML::anchor(Route::model($gallery), HTML::chars($gallery->name)); ?> </h4> </div> <small class="stats label label-default"> <?php switch ($this->type) { case Model_Image::TOP_COMMENTED: echo '<i class="fa fa-comment"></i> ', Num::format($image->comment_count, 0); break; case Model_Image::TOP_RATED: echo '<i class="fa fa-star"></i> ', round($image->rate_total / $image->rate_count, 2); break; case Model_Image::TOP_VIEWED: echo '<i class="fa fa-eye"></i> ', Num::format($image->view_count, 0); break; } ?> </small> </div> </div> <?php } ?> </div> <?php return ob_get_clean(); }
public function __construct() { parent::__construct(); $editorial = Model_Editorial::getRandom(); $this->template->title = $editorial->title; $this->template->image = HTML::image($editorial->image, array('alt' => $editorial->image_alt)); $this->template->text = $editorial->text; $this->template->link = HTML::anchor($editorial->link, $editorial->link_text); }
public function postPracticeLogo($practice_id) { $practice = Practiceinfo::find($practice_id); $html = ""; if ($practice->practice_logo != '') { $html = HTML::image($practice->practice_logo, 'Practice Logo', array('border' => '0')); } echo $html; }
public function input($name, array $attr = array()) { $attr['type'] = 'file'; $r = Form::input($name, '', $attr); if ($this->value != '') { $r .= HTML::image($this->__toString()); } return $r; }
public function __construct() { parent::__construct(); $modules = array(array('title' => 'Adorable Cats', 'text' => 'These felines seem to enjoy posing for pictures!', 'image' => HTML::image('public/images/graphics/editorial_modules/calico-cat.jpg', array('alt' => 'Cat')), 'link' => HTML::anchor('http://kids.nationalgeographic.com/kids/photos/gallery/cats/', 'See More Photos')), array('title' => 'Fall Scenes', 'text' => 'Pumpkins brighten up the fall!', 'image' => HTML::image('public/images/graphics/editorial_modules/pumpkins.jpg', array('alt' => 'Pumpkins')), 'link' => HTML::anchor('http://kids.nationalgeographic.com/kids/photos/gallery/fall-scenes/', 'Look at Photos!')), array('title' => 'Gecko Puzzler', 'text' => 'Put together jigsaw puzzles.', 'image' => HTML::image('public/images/graphics/editorial_modules/blue-orange-tokay-gecko.jpg', array('alt' => 'Gecko eye')), 'link' => HTML::anchor('http://kids.nationalgeographic.com/kids/games/puzzlesquizzes/geckos-puzzler/', 'Check It Out!')), array('title' => 'Snowflakes Puzzler', 'text' => 'Solve snowflake slider puzzles.', 'image' => HTML::image('public/images/graphics/editorial_modules/snowflake.jpg', array('alt' => 'Snowflake')), 'link' => HTML::anchor('http://kids.nationalgeographic.com/kids/games/puzzlesquizzes/snowflakes-puzzler/', 'Try Now!'))); $item = $modules[array_rand($modules)]; $this->template->title = $item['title']; $this->template->image = $item['image']; $this->template->text = $item['text']; $this->template->link = $item['link']; }
public function pics($data) { $name = HTML::link('products/view/' . $data['_id'], $data['productName']); if (isset($data['thumbnail_url']) && count($data['thumbnail_url'])) { $display = HTML::image($data['thumbnail_url'][0] . '?' . time(), $data['filename'][0], array('style' => 'min-width:100px;', 'id' => $data['_id'])); return $display . '<br /><span class="img-more" id="' . $data['_id'] . '">more images</span>'; } else { return $name; } }
/** * Render view. * * @return string */ public function content() { ob_start(); echo '<figure>', HTML::image($this->image->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>'; // Comments if ($this->image->comment_count) { echo '<span class="stats"><i class="icon-comment"></i> ' . $this->image->comment_count . '</span>'; } return ob_get_clean(); }
public function pics($data) { $name = HTML::link('products/view/' . $data['_id'], $data['productName']); if (isset($data['thumbnail_url']) && count($data['thumbnail_url'])) { $display = HTML::image($data['thumbnail_url'][0] . '?' . time(), $data['filename'][0], array('style' => 'min-width:100px;', 'id' => $data['_id'])); return $data['songTitle'] . '<br />' . $display; } else { return $name; } }
/** * string _percBar(int $percentage, int $scale = 1, string $label = "") * * Returns a percentage bar * * @param int $percentage * @param int $scale (optional) * @param string $label (optional) alternative text of the images * @return string * @access private * @static */ private static function _percBar($percentage, $scale = 1, $label = "") { //$leftSize = getimagesize("../img/leftbar.gif"); //$mainSize = getimagesize("../img/mainbar.gif"); //$rightSize = getimagesize("../img/rightbar.gif"); $perc = round($scale * $percentage, 0); $html = HTML::image('../img/leftbar.gif', $label, array('width' => 7, 'height' => 14)); $html .= HTML::image('../img/mainbar.gif', $label, array('width' => $perc, 'height' => 14)); $html .= HTML::image('../img/rightbar.gif', $label, array('width' => 7, 'height' => 14)); $html = str_replace(PHP_EOL, '', $html); return $html; }
/** * Print user avatar * * @param string $avatar * @param string $title * @param bool $mini * @return string */ public static function avatar($avatar, $title = '', $mini = false) { if (empty($avatar) || strpos($avatar, '/') === false) { $avatar = 'avatar/unknown.png'; } $class = $mini ? 'avatar small' : 'avatar'; if (empty($title)) { return '<div class="' . $class . '">' . HTML::image($avatar, array('alt' => 'Avatar')) . '</div>'; } else { return '<div class="' . $class . '">' . HTML::anchor(URL::user($title), HTML::image($avatar, array('title' => $title, 'alt' => $title, 'class' => 'hoverable'))) . '</div>'; } }
/** * Render view. * * @return string */ public function content() { ob_start(); // Title if ($this->user['title']) { echo HTML::chars(trim($this->user['title'])) . '<br>'; } // Image if ($this->user['thumb']) { echo '<figure>' . HTML::image($this->user['thumb'], array('width' => 160)) . '</figure>'; } return ob_get_clean(); }
/** * Creates a <picture> tag with <source> elements and final <img> element. * * echo HTML::picture('media/img/logo.png', array('w' => 179, 'h' => 179), array('1200px' => array('w' => '169', 'h' => '169'), '992px' => array('w' => '132', 'h' => '132'), '768px' => array('w' => '138', 'h' => '138'), '480px' => array('w' => '324', 'h' => '324'), '320px' => array('w' => '180', 'h' => '180')), array('alt' => 'My Company')) * * @param string $file file name * @param array $size resize image with Core::imagefly * @param array $sources image sources with size and media braking point * @param array $attributes default attributes * @return string * @uses Core::imagefly * @uses HTML::image * @uses HTML::attributes */ public static function picture($file, array $size = NULL, array $sources = NULL, array $attributes = NULL) { if (empty($sources)) { return ''; } $ret = ''; foreach ($sources as $key => $value) { $media = '(min-width: ' . $key . ')'; $srcset = Core::imagefly($file, isset($value['w']) ? $value['w'] : NULL, isset($value['h']) ? $value['h'] : NULL); $ret .= '<source' . HTML::attributes(compact('media', 'srcset')) . '>'; } $image = HTML::image(Core::imagefly($file, isset($size['w']) ? $size['w'] : NULL, isset($size['h']) ? $size['h'] : NULL), $attributes); return '<picture>' . $ret . $image . '</picture>'; }
public function testWithClosure() { $thumbnails = Thumbnail::create($this->richImages, function ($image) { $image = (object) $image; $return = '<li class="thumbnail"><figure>' . HTML::image($image->image) . '</figure>'; if (isset($image->label)) { $return .= '<h2>' . $image->label . '</h2>'; } $return .= '</li>'; return $return; }); $matcher = $this->matcher('<li class="thumbnail"><figure>' . $this->image('foo') . '</figure></li>' . '<li class="thumbnail"><figure>' . $this->image('bar') . '</figure><h2>bar</h2></li>' . '<li class="thumbnail"><figure>' . $this->image('den') . '</figure><h2>den</h2></li>'); $this->assertEquals($matcher, $thumbnails); }
/** * Render view. * * @return string */ public function content() { ob_start(); // Title if ($this->user['title']) { echo HTML::chars(trim($this->user['title'])) . '<br />'; } // Image if ($this->user['thumb']) { echo '<figure>' . HTML::image($this->user['thumb'], array('width' => 160)) . '</figure>'; } // Last login echo __('Last login: :login', array(':login' => HTML::time(Date::fuzzy_span($this->user['last_login']), $this->user['last_login']))); return ob_get_clean(); }
/** * * @param string $email * @param integer $size * @param string $default * @param array $attributes * @return string */ public static function load($email, $size = 40, $default = NULL, array $attributes = NULL) { if (empty($email)) { $email = '*****@*****.**'; } if ($default === NULL) { $default = 'mm'; } $hash = md5(strtolower(trim($email))); $query_params = URL::query(array('d' => $default, 's' => (int) $size)); if (!isset(self::$_cache[$email][$size])) { self::$_cache[$email][$size] = HTML::image('http://www.gravatar.com/avatar/' . $hash . $query_params, $attributes); } return self::$_cache[$email][$size]; }
/** * Returns fully formed img HTML tag * * @param string $file * @param string $type * @param string $default * @param array $attributes img attributes * @return unknown */ public static function img($file, $type, $default = NULL, $attributes = array()) { $filepath = Spot_Image::find_file($file); if (is_file($filepath)) { if (is_string($type)) { return HTML::image(Kohana::config("spot_image.prefix") . "/" . $type . "/" . $file, $attributes); } elseif (is_array($type)) { $type = URL::query($type); return HTML::image(Kohana::config("spot_image.prefix") . "/" . $file . "/" . $type, $attributes); } } else { return HTML::image($default, $attributes); } return FALSE; }
/** * * @param string $email * @param integer $size * @param string $default * @param array $attributes * @return string */ public static function load($email, $size = 100, $default = NULL, array $attributes = NULL) { if (empty($email)) { $email = '*****@*****.**'; } if ($default === NULL) { $default = 'mm'; } $hash = md5(strtolower(trim($email))); $queryParams = http_build_query(['d' => urlencode($default), 's' => (int) $size]); if (!isset(self::$cache[$email][$size])) { self::$cache[$email][$size] = \HTML::image('http://www.gravatar.com/avatar/' . $hash . '?' . $queryParams, NULL, $attributes); } return self::$cache[$email][$size]; }
/** * Print user avatar * * @param string $avatar * @param string $title * @param string $class * @return string */ public static function avatar($avatar, $title = '', $class = null) { if (empty($avatar) || strpos($avatar, '/') === false) { $avatar = 'avatar/unknown.png'; } if (!$class) { $class = 'avatar'; } else { $class = 'avatar ' . ($class === true ? ' small' : $class); } if (empty($title)) { return '<span class="' . $class . '">' . HTML::image($avatar, array('alt' => __('Avatar'))) . '</span>'; } else { return HTML::anchor(URL::user($title), HTML::image($avatar, array('title' => $title, 'alt' => $title)), array('class' => $class . ' hoverable')); } }
/** * Return text with smileys * * @param string $text */ public static function smileys($text) { static $smileys; // Load smileys if (!is_array($smileys)) { $smileys = array(); $config = Kohana::config('site.smiley'); if (!empty($config)) { $url = $config['dir'] . '/'; foreach ($config['smileys'] as $name => $smiley) { $smileys[$name] = HTML::image($url . $smiley['src'], array('class' => 'smiley', 'alt' => HTML::chars($name), 'title' => HTML::chars($name))); } } } // Smile! return empty($smileys) ? $text : str_replace(array_keys($smileys), $smileys, $text); }