Exemplo n.º 1
0
Arquivo: entry.php Projeto: anqh/anqh
 /**
  * Create new view.
  *
  * @param  Model_Blog_Entry  $blog_entry
  * @param  boolean           $show_title
  */
 public function __construct(Model_Blog_Entry $blog_entry, $show_title = false)
 {
     parent::__construct();
     $this->blog_entry = $blog_entry;
     if ($show_title) {
         $author = $blog_entry->author();
         //			$this->avatar   = HTML::avatar($author['avatar'], $author['username']);
         $this->title = HTML::anchor(Route::model($blog_entry), HTML::chars($blog_entry->name));
         $this->subtitle = __('By :user, :date', array(':user' => HTML::user($author), ':date' => date('l ', $blog_entry->created) . Date::format(Date::DMY_SHORT, $blog_entry->created)));
         if (Permission::has($blog_entry, Model_Blog_Entry::PERMISSION_COMMENTS)) {
             $this->subtitle .= ' | ' . HTML::anchor(Route::model($blog_entry), __('Comments') . ' (' . (int) $blog_entry->comment_count . ')');
         }
     }
 }
Exemplo n.º 2
0
Arquivo: blog.php Projeto: anqh/anqh
 /**
  * Get anchor to newsfeed item target.
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get_link(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_COMMENT:
         case self::TYPE_ENTRY:
             $entry = Model_Blog_Entry::factory($item->data['entry_id']);
             if ($entry->loaded()) {
                 $text = HTML::anchor(Route::model($entry), '<i class="fa fa-book"></i> ' . HTML::chars($entry->name), array('title' => $entry->name));
             }
             break;
     }
     return $text;
 }
Exemplo n.º 3
0
Arquivo: blog.php Projeto: anqh/blog
 /**
  * Get newsfeed item as HTML
  *
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_COMMENT:
             $entry = Model_Blog_Entry::factory($item->data['entry_id']);
             if ($entry->loaded()) {
                 $text = __('commented to blog<br />:blog', array(':blog' => HTML::anchor(Route::model($entry), '<i class="icon-book icon-white"></i> ' . HTML::chars($entry->name), array('title' => $entry->name))));
             }
             break;
         case self::TYPE_ENTRY:
             $entry = Model_Blog_Entry::factory($item->data['entry_id']);
             if ($entry->loaded()) {
                 $text = __('wrote a new blog entry<br />:blog', array(':blog' => HTML::anchor(Route::model($entry), '<i class="icon-book icon-white"></i> ' . HTML::chars($entry->name), array('title' => $entry->name))));
             }
             break;
     }
     return $text;
 }
Exemplo n.º 4
0
 /**
  * Get user's new comment counts
  *
  * @return  array
  */
 public function find_new_comments()
 {
     $new = array();
     // Profile comments
     if ($this->new_comment_count) {
         $new['new-comments'] = HTML::anchor(URL::user($this), __(':comments', array(':comments' => '<div></div><var>' . $this->new_comment_count . '</var>')), array('title' => __('New comments')));
     }
     // Blog comments
     $blog_comments = Model_Blog_Entry::find_new_comments($this);
     if (count($blog_comments)) {
         $new_comments = 0;
         foreach ($blog_comments as $blog_entry) {
             $new_comments += $blog_entry->new_comment_count;
         }
         $new['new-blog-comments'] = HTML::anchor(Route::model($blog_entry), __(':comments', array(':comments' => '<div></div><var>' . $new_comments . '</var>')), array('title' => __('New blog comments')));
     }
     unset($blog_comments);
     // Forum quotes
     $forum_quotes = Model_Forum_Quote::find_by_user($this);
     if (count($forum_quotes)) {
         $new_quotes = count($forum_quotes);
         $quote = $forum_quotes->current();
         $new['new-forum-quotes'] = HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => Route::model_id($quote->topic), 'id' => $quote->post->id)) . '#post-' . $quote->post->id, __(':quotes', array(':quotes' => '<div></div><var>' . $new_quotes . '</var>')), array('title' => __('Forum quotes')));
     }
     // Images waiting for approval
     if (Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE_WAITING, $this)) {
         $gallery_approvals = Model_Gallery::find_pending(Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE, $this) ? null : $this);
         if (count($gallery_approvals)) {
             $new_approvals = count($gallery_approvals);
             $new['new-gallery-approvals'] = HTML::anchor(Route::get('galleries')->uri(array('action' => 'approval')), __(':galleries', array(':galleries' => '<div></div><var>' . $new_approvals . '</var>')), array('title' => __('Galleries waiting for approval')));
         }
     }
     // Image comments
     $image_comments = Model_Image::find_new_comments($this);
     if (count($image_comments)) {
         $new_comments = 0;
         foreach ($image_comments as $image) {
             $new_comments += $image->new_comment_count;
         }
         $new['new-image-comments'] = HTML::anchor(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id(Model_Gallery::find_by_image($image->id)), 'id' => $image->id, 'action' => '')), __(':comments', array(':comments' => '<div></div><var>' . $new_comments . '</var>')), array('title' => __('New image comments')));
     }
     unset($image_comments);
     // Private messages
     return $new;
 }
Exemplo n.º 5
0
 /**
  * Destroy controller
  */
 public function after()
 {
     if ($this->ajax || $this->internal) {
         // AJAX and HMVC requests
         $this->response->body($this->response->body() . '');
     } else {
         if ($this->auto_render) {
             // Normal requests
             $session = Session::instance();
             // Save current URI
             /* Moved to Controller
             			if ($this->history && $this->response->status() < 400) {
             				$uri = $this->request->current_uri();
             				unset($this->breadcrumb[$uri]);
             				$this->breadcrumb = array_slice($this->breadcrumb, -9, 9, true);
             				$this->breadcrumb[$uri] = $this->page_title;
             				$session
             					->set('history', $uri . ($_GET ? URL::query($_GET) : ''))
             					->set('breadcrumb', $this->breadcrumb);
             			}
             			 */
             // Controller name as the default page id if none set
             empty($this->page_id) and $this->page_id = $this->request->controller();
             // Stylesheets
             $styles = array('ui/boot.css' => null, 'ui/typo.css' => null, 'ui/base.css' => null, 'ui/jquery-ui.css' => null, 'http://fonts.googleapis.com/css?family=Nobile:regular,bold' => null);
             // Generic views
             Widget::add('breadcrumb', View::factory('generic/breadcrumb', array('breadcrumb' => $this->breadcrumb, 'last' => !$this->history)));
             Widget::add('actions', View::factory('generic/actions', array('actions' => $this->page_actions)));
             Widget::add('navigation', View::factory('generic/navigation', array('items' => Kohana::$config->load('site.menu'), 'selected' => $this->page_id)));
             if (!empty($this->tabs)) {
                 Widget::add('subnavigation', View::factory('generic/navigation', array('items' => $this->tabs, 'selected' => $this->tab_id)));
             }
             /*
             			Widget::add('tabs', View::factory('generic/tabs_top', array(
             				'tabs'     => $this->tabs,
             				'selected' => $this->tab_id
             			)));
             */
             // Footer
             Widget::add('footer', View_Module::factory('events/event_list', array('mod_id' => 'footer-events-new', 'mod_class' => 'article grid4 first cut events', 'mod_title' => __('New events'), 'events' => Model_Event::factory()->find_new(10))));
             Widget::add('footer', View_Module::factory('forum/topiclist', array('mod_id' => 'footer-topics-active', 'mod_class' => 'article grid4 cut topics', 'mod_title' => __('New posts'), 'topics' => Model_Forum_Topic::factory()->find_by_latest_post(10))));
             Widget::add('footer', View_Module::factory('blog/entry_list', array('mod_id' => 'footer-blog-entries', 'mod_class' => 'article grid4 cut blogentries', 'mod_title' => __('New blogs'), 'entries' => Model_Blog_Entry::factory()->find_new(10))));
             // Skin
             $skins = Kohana::$config->load('site.skins');
             $skin = 'dark';
             //$session->get('skin', 'dark');
             $skin_imports = array('ui/mixin.less', 'ui/grid.less', 'ui/layout.less', 'ui/widget.less', 'ui/custom.less');
             // Dock
             $classes = array();
             foreach ($skins as $skin_name => &$skin_config) {
                 $skin_config['path'] = 'ui/' . $skin_name . '/skin.less';
                 $classes[] = HTML::anchor(Route::get('setting')->uri(array('action' => 'skin', 'value' => $skin_name)), $skin_config['name'], array('class' => 'theme', 'rel' => $skin_name));
             }
             //Widget::add('dock', __('Theme') . ': ' . implode(', ', $classes));
             // Language selection
             $available_languages = Kohana::$config->load('locale.languages');
             if (count($available_languages)) {
                 $languages = array();
                 foreach ($available_languages as $lang => $locale) {
                     $languages[] = HTML::anchor('set/lang/' . $lang, HTML::chars($locale[2]));
                 }
                 //				Widget::add('dock', ' | ' . __('Language: ') . implode(', ', $languages));
             }
             // Search
             /*
             			Widget::add('search', View_Module::factory('generic/search', array(
             				'mod_id' => 'search'
             			)));
             */
             // Visitor card
             Widget::add('visitor', View::factory('generic/visitor', array('user' => self::$user)));
             // Time & weather
             Widget::add('dock', ' | ' . View::factory('generic/clock', array('user' => self::$user)));
             // Pin
             Widget::add('dock', ' | ' . HTML::anchor('#pin', '&#9650;', array('title' => __('Lock menu'), 'class' => 'icon unlock', 'onclick' => '$("#header").toggleClass("pinned"); return false;')));
             // End
             Widget::add('end', View::factory('generic/end'));
             // Analytics
             if ($google_analytics = Kohana::$config->load('site.google_analytics')) {
                 Widget::add('head', HTML::script_source("\nvar tracker;\nhead.js(\n\t{ 'google-analytics': 'http://www.google-analytics.com/ga.js' },\n\tfunction() {\n\t\ttracker = _gat._getTracker('" . $google_analytics . "');\n\t\ttracker._trackPageview();\n\t}\n);\n"));
             }
             // Open Graph
             $og = array();
             foreach ((array) Anqh::open_graph() as $key => $value) {
                 $og[] = '<meta property="' . $key . '" content="' . HTML::chars($value) . '" />';
             }
             if (!empty($og)) {
                 Widget::add('head', implode("\n", $og));
             }
             // Share
             if (Anqh::share()) {
                 if ($share = Kohana::$config->load('site.share')) {
                     // 3rd party share
                     Widget::add('share', View_Module::factory('share/share', array('mod_class' => 'like', 'id' => $share)));
                     Widget::add('foot', View::factory('share/foot', array('id' => $share)));
                 } else {
                     if ($facebook = Kohana::$config->load('site.facebook')) {
                         // Facebook Like
                         Widget::add('share', View_Module::factory('facebook/like'));
                         Widget::add('ad_top', View::factory('facebook/connect', array('id' => $facebook)));
                     }
                 }
             }
             // Ads
             $ads = Kohana::$config->load('site.ads');
             if ($ads && $ads['enabled']) {
                 foreach ($ads['slots'] as $ad => $slot) {
                     Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE);
                 }
             }
             // And finally the profiler stats
             if (self::$user && self::$user->has_role('admin')) {
                 //in_array(Kohana::$environment, array(Kohana::DEVELOPMENT, Kohana::TESTING))) {
                 Widget::add('foot', View::factory('generic/debug'));
                 Widget::add('foot', View::factory('profiler/stats'));
             }
             // Do some CSS magic to page class
             $page_class = explode(' ', $this->language . ' ' . $session->get('page_width', 'fixed') . ' ' . $session->get('page_main', 'left') . ' ' . $this->request->action() . ' ' . $this->page_class);
             // Controller set classes
             $page_class = implode(' ', array_unique(array_map('trim', $page_class)));
             // Bind the generic page variables
             $this->template->set('styles', $styles)->set('skin', $skin)->set('skins', $skins)->set('skin_imports', $skin_imports)->set('language', $this->language)->set('page_id', $this->page_id)->set('page_class', $page_class)->set('page_title', $this->page_title)->set('page_subtitle', $this->page_subtitle);
             // Add statistics
             $queries = 0;
             if (Kohana::$profiling) {
                 foreach (Profiler::groups() as $group => $benchmarks) {
                     if (strpos($group, 'database') === 0) {
                         $queries += count($benchmarks);
                     }
                 }
             }
             $total = array('{memory_usage}' => number_format((memory_get_peak_usage() - KOHANA_START_MEMORY) / 1024, 2) . 'KB', '{execution_time}' => number_format(microtime(true) - KOHANA_START_TIME, 5), '{database_queries}' => $queries, '{included_files}' => count(get_included_files()));
             $this->template = strtr($this->template, $total);
             // Render page
             if ($this->auto_render === true) {
                 $this->response->body($this->template);
             }
         }
     }
     return parent::after();
 }
Exemplo n.º 6
0
Arquivo: blog.php Projeto: anqh/anqh
 /**
  * Get comments section.
  *
  * @param   Model_Blog_Entry  $blog_entry
  * @param   string            $route
  * @return  View_Generic_Comments
  */
 public function section_comments(Model_Blog_Entry $blog_entry, $route = 'blog_comment')
 {
     $section = new View_Generic_Comments($blog_entry->comments(Visitor::$user));
     $section->delete = Route::url($route, array('id' => '%d', 'commentaction' => 'delete')) . '?token=' . Security::csrf();
     $section->private = Route::url($route, array('id' => '%d', 'commentaction' => 'private')) . '?token=' . Security::csrf();
     return $section;
 }
Exemplo n.º 7
0
Arquivo: page.php Projeto: anqh/anqh
 /**
  * Destroy controller.
  */
 public function after()
 {
     if ($this->_request_type !== Controller::REQUEST_INITIAL) {
         // AJAX and HMVC requests
         $this->response->body((string) $this->response->body());
     } else {
         if ($this->auto_render) {
             // Normal requests
             // Footer
             $section = new View_Events_List();
             $section->class .= ' col-sm-4';
             $section->title = __('New events');
             $section->events = Model_Event::factory()->find_new(10);
             $this->view->add(View_Page::COLUMN_FOOTER, $section);
             $section = new View_Topics_List();
             $section->class .= ' col-sm-4';
             $section->topics = Model_Forum_Topic::factory()->find_by_latest_post(10);
             $this->view->add(View_Page::COLUMN_FOOTER, $section);
             $section = new View_Blogs_List();
             $section->class .= ' col-sm-4';
             $section->title = __('New blogs');
             $section->blog_entries = Model_Blog_Entry::factory()->find_new(10);
             $this->view->add(View_Page::COLUMN_FOOTER, $section);
             // Ads
             /*			$ads = Kohana::$config->load('site.ads');
             			if ($ads && $ads['enabled']) {
             				foreach ($ads['slots'] as $ad => $slot) {
             					if ($slot == 'side') {
             						$this->view->add(View_Page::COLUMN_SIDE, View::factory('ads/' . $ad));
             					} else {
             						Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE);
             					}
             				}
             			}*/
             // Theme
             $theme = $this->session->get('theme');
             //Arr::get($_COOKIE, 'theme');
             if (!in_array($theme, array_keys(Kohana::$config->load('site.themes')))) {
                 if (Visitor::$user) {
                     $theme = Visitor::$user->setting('ui.theme');
                 }
                 if (!$theme) {
                     $theme = Kohana::$config->load('site.theme');
                 }
                 $this->session->set('theme', $theme);
             }
             // Do some CSS magic to page class
             $page_class = array_merge(array('theme-' . $theme, Visitor::$user ? 'authenticated' : 'unauthenticated'), explode(' ', $this->page_class));
             $page_class = implode(' ', array_unique($page_class));
             // Set the generic page variables
             $this->view->language = $this->language;
             $this->view->id = $this->page_id;
             $this->view->class = $page_class;
             if ($this->page_actions) {
                 $this->view->tabs = $this->page_actions;
             }
             if ($this->page_breadcrumbs) {
                 $this->view->breadcrumbs = $this->page_breadcrumbs;
             }
             // Set meta data
             if (!Anqh::page_meta('title')) {
                 Anqh::page_meta('title', $this->view->title ? $this->view->title : Kohana::$config->load('site.site_name'));
             }
             // And finally the profiler stats
             if (Visitor::$user && Visitor::$user->has_role('admin')) {
                 Widget::add('foot', new View_Generic_Debug());
                 Widget::add('foot', View::factory('profiler/stats'));
             }
         }
     }
     parent::after();
 }
Exemplo n.º 8
0
Arquivo: page.php Projeto: anqh/core
 /**
  * Destroy controller.
  */
 public function after()
 {
     if ($this->_request_type !== Controller::REQUEST_INITIAL) {
         // AJAX and HMVC requests
         $this->response->body((string) $this->response->body());
     } else {
         if ($this->auto_render) {
             // Normal requests
             // Stylesheets
             $styles = array('ui/jquery-ui.css', 'http://fonts.googleapis.com/css?family=Terminal+Dosis');
             // Skins
             $selected_skin = $this->session->get('skin', 'blue');
             // Less files needed to build a skin
             $less_imports = array('ui/mixin.less', 'ui/anqh.less');
             $skins = array(HTML::style('static/css/bootstrap.css'), HTML::style('static/css/bootstrap-responsive.css'));
             foreach (array('blue') as $skin) {
                 $skinsi[] = Less::style('ui/' . $skin . '.less', array('title' => $skin, 'rel' => $skin == $selected_skin ? 'stylesheet' : 'alternate stylesheet'), false, $less_imports);
             }
             // Footer
             $section = new View_Events_List();
             $section->class .= ' span4';
             $section->title = __('New events');
             $section->events = Model_Event::factory()->find_new(10);
             Widget::add('footer', $section);
             $section = new View_Topics_List();
             $section->class .= ' span4';
             $section->title = __('New posts');
             $section->topics = Model_Forum_Topic::factory()->find_by_latest_post(10);
             Widget::add('footer', $section);
             $section = new View_Blogs_List();
             $section->class .= ' span4';
             $section->title = __('New blogs');
             $section->blog_entries = Model_Blog_Entry::factory()->find_new(10);
             Widget::add('footer', $section);
             // Open Graph
             $og = array();
             foreach ((array) Anqh::open_graph() as $key => $value) {
                 $og[] = '<meta property="' . $key . '" content="' . HTML::chars($value) . '" />';
             }
             if (!empty($og)) {
                 Widget::add('head', implode("\n", $og));
             }
             // Analytics
             if ($google_analytics = Kohana::$config->load('site.google_analytics')) {
                 Widget::add('head', HTML::script_source("\nvar tracker;\nhead.js(\n\t{ 'google-analytics': 'http://www.google-analytics.com/ga.js' },\n\tfunction() {\n\t\ttracker = _gat._getTracker('" . $google_analytics . "');\n\t\ttracker._trackPageview();\n\t}\n);\n"));
             }
             // Ads
             /*			$ads = Kohana::$config->load('site.ads');
             			if ($ads && $ads['enabled']) {
             				foreach ($ads['slots'] as $ad => $slot) {
             					if ($slot == 'side') {
             						$this->view->add(View_Page::COLUMN_SIDE, View::factory('ads/' . $ad));
             					} else {
             						Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE);
             					}
             				}
             			}*/
             // Do some CSS magic to page class
             $page_class = array_merge(array($this->language, $this->request->action(), self::$user ? 'authenticated' : 'unauthenticated'), explode(' ', $this->page_class));
             $page_class = implode(' ', array_unique($page_class));
             // Set the generic page variables
             $this->view->styles = $styles;
             $this->view->skins = $skins;
             $this->view->language = $this->language;
             $this->view->id = $this->page_id;
             $this->view->class = $page_class;
             if ($this->page_actions) {
                 $this->view->tabs = $this->page_actions;
             }
             if ($this->page_breadcrumbs) {
                 $this->view->breadcrumbs = $this->page_breadcrumbs;
             }
             // And finally the profiler stats
             if (self::$user && self::$user->has_role('admin')) {
                 //in_array(Kohana::$environment, array(Kohana::DEVELOPMENT, Kohana::TESTING))) {
                 Widget::add('foot', View::factory('generic/debug'));
                 Widget::add('foot', View::factory('profiler/stats'));
             }
         }
     }
     parent::after();
 }
Exemplo n.º 9
0
Arquivo: core.php Projeto: anqh/core
 /**
  * Get user's new comment counts.
  *
  * @param   Model_User  $user
  * @return  array
  */
 public static function notifications(Model_User $user)
 {
     $new = array();
     // Profile comments
     if ($user->new_comment_count) {
         $new['new-comments'] = HTML::anchor(URL::user($user), '<i class="icon-comment icon-white"></i> ' . $user->new_comment_count, array('class' => 'badge badge-info', 'title' => __('New comments')));
     }
     // Forum private messages
     $private_messages = Forum::find_new_private_messages($user);
     if (count($private_messages)) {
         $new_messages = 0;
         foreach ($private_messages as $private_message) {
             $new_messages += $private_message->unread;
         }
         $new['new-private-messages'] = HTML::anchor(Route::model($private_message->topic()) . '?page=last#last', '<i class="icon-comment icon-white"></i> ' . $new_messages, array('class' => 'badge badge-info', 'title' => __('New private messages')));
     }
     unset($private_messages);
     // Blog comments
     $blog_comments = Model_Blog_Entry::factory()->find_new_comments($user);
     if (count($blog_comments)) {
         $new_comments = 0;
         foreach ($blog_comments as $blog_entry) {
             $new_comments += $blog_entry->new_comment_count;
         }
         $new['new-blog-comments'] = HTML::anchor(Route::model($blog_entry), '<i class="icon-comment icon-white"></i> ' . $new_comments, array('class' => 'badge badge-info', 'title' => __('New blog comments')));
     }
     unset($blog_comments);
     // Forum quotes
     $forum_quotes = Model_Forum_Quote::factory()->find_by_user($user);
     if (count($forum_quotes)) {
         $new_quotes = count($forum_quotes);
         $quote = $forum_quotes->current();
         $new['new-forum-quotes'] = HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => $quote->forum_topic_id, 'id' => $quote->forum_post_id)) . '#post-' . $quote->forum_post_id, '<i class="icon-comment icon-white"></i> ' . $new_quotes, array('class' => 'badge badge-info', 'title' => __('Forum quotes')));
     }
     // Images waiting for approval
     if (Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE_WAITING, $user)) {
         $gallery_approvals = Model_Gallery::factory()->find_pending(Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE, $user) ? null : $user);
         if (count($gallery_approvals)) {
             $new_approvals = count($gallery_approvals);
             $new['new-gallery-approvals'] = HTML::anchor(Route::get('galleries')->uri(array('action' => 'approval')), '<i class="icon-exclamation-sign icon-white"></i> ' . $new_approvals, array('class' => 'badge badge-warning', 'title' => __('Galleries waiting for approval')));
         }
     }
     // Flyer comments
     $flyer_comments = Model_Flyer::factory()->find_new_comments($user);
     $flyers = array();
     if (count($flyer_comments)) {
         $new_comments = 0;
         foreach ($flyer_comments as $flyer) {
             $flyers[$flyer->image_id] = true;
             $new_comments += $flyer->image()->new_comment_count;
         }
         $new['new-flyer-comments'] = HTML::anchor(Route::get('flyer')->uri(array('id' => $flyer->id, 'action' => '')), '<i class="icon-picture icon-white"></i> ' . $new_comments, array('class' => 'badge badge-info', 'title' => __('New flyer comments')));
     }
     unset($flyer_comments);
     // Image comments
     $image_comments = Model_Image::factory()->find_new_comments($user);
     $note_comments = Model_Image_Note::factory()->find_new_comments($user);
     if (count($image_comments) || count($note_comments)) {
         $new_comments = 0;
         $new_image = null;
         foreach ($image_comments as $image) {
             // @TODO: Until flyer comments are fixed..
             if (!isset($flyers[$image->id])) {
                 $new_comments += $image->new_comment_count;
                 $new_image_id = $image->id;
             }
         }
         foreach ($note_comments as $note) {
             $new_comments += $note->new_comment_count;
             $new_image_id = $note->image_id;
         }
         if ($new_comments) {
             $new['new-image-comments'] = HTML::anchor(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id(Model_Gallery::find_by_image($new_image_id)), 'id' => $new_image_id, 'action' => '')), '<i class="icon-camera icon-white"></i> ' . $new_comments, array('class' => 'badge badge-info', 'title' => __('New image comments')));
         }
     }
     unset($image_comments, $note_comments, $new_image);
     // Image tags
     $notes = Model_Image_Note::factory()->find_new_notes($user);
     if (count($notes)) {
         $new_notes = 0;
         $new_note_image_id = null;
         /** @var  Model_Image_Note  $note */
         foreach ($notes as $note) {
             $new_notes++;
             $new_note_image_id = $note->image_id;
         }
         if ($new_notes) {
             $new['new-image-notes'] = HTML::anchor(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id(Model_Gallery::find_by_image($new_note_image_id)), 'id' => $new_note_image_id, 'action' => '')), '<i class="icon-tag icon-white"></i> ' . $new_notes, array('class' => 'badge badge-info', 'title' => __('New image tags')));
         }
     }
     unset($note_comments, $new_note_image_id);
     return $new;
 }