protected function displayContent() { $stats = $this->getPhotoStats(); if ($stats->last_date === null) { echo Pinhole::_('No photos have been added.'); } else { $locale = SwatI18NLocale::get(); $first_date = new SwatDate($stats->first_date); $last_date = new SwatDate($stats->last_date); echo '<ul>'; $li_tag = new SwatHtmlTag('li'); $li_tag->setContent(sprintf(Pinhole::_('%s photos have been uploaded since ' . '<a href="%stag?date.date=%s">%s</a>'), $locale->formatNumber($stats->photo_count), $this->app->config->pinhole->path, $first_date->formatLikeIntl('yyyy-MM-dd'), $first_date->formatLikeIntl(SwatDate::DF_DATE)), 'text/xml'); $li_tag->display(); $days = $last_date->diff($first_date)->days; $avg = round((double) $stats->photo_count / (double) $days, 2); $li_tag = new SwatHtmlTag('li'); $li_tag->setContent(sprintf(Pinhole::_('Approximately %s photos have been uploaded ' . 'per day'), $locale->formatNumber($avg))); $li_tag->display(); $li_tag->setContent(sprintf(Pinhole::_('Last photo uploaded on ' . '<a href="%stag?date=%s">%s</a>'), $this->app->config->pinhole->path, $last_date->formatLikeIntl('yyyy-MM-dd'), $last_date->formatLikeIntl(SwatDate::DF_DATE)), 'text/xml'); $li_tag->display(); $tag_stats = $this->getTagStats(); if ($tag_stats->tag_count > 0) { $li_tag = new SwatHtmlTag('li'); $li_tag->setContent(sprintf(Pinhole::_('<a href="%s/tags/alphabetical">%s tags</a> ' . 'have been added'), $this->app->config->pinhole->path, $locale->formatNumber($tag_stats->tag_count)), 'text/xml'); $li_tag->display(); $a_tag = new SwatHtmlTag('a'); $a_tag->setContent($tag_stats->popular_tag_title); $a_tag->href = $this->app->config->pinhole->path . 'tag?' . SwatString::minimizeEntities($tag_stats->popular_tag_name); $li_tag = new SwatHtmlTag('li'); $li_tag->setContent(sprintf(Pinhole::_('The most popular tag “%s” has %s photos'), (string) $a_tag, $locale->formatNumber($tag_stats->popular_tag_count)), 'text/xml'); $li_tag->display(); } echo '</ul>'; } }
public function display() { if (!$this->visible) { return; } if ($this->tag_list === null) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = 'pinhole-browser-page-menu'; $div_tag->open(); $a_tag = new SwatHtmlTag('a'); $a_tag->href = $this->appendTagPath(sprintf('%stags/alphabetical', $this->base)); $a_tag->setContent(Pinhole::_('Alphabetical')); $a_tag->display(); $a_tag = new SwatHtmlTag('a'); $a_tag->href = $this->appendTagPath(sprintf('%stags/date', $this->base)); $a_tag->setContent(Pinhole::_('By Date Added')); $a_tag->display(); $a_tag = new SwatHtmlTag('a'); $a_tag->href = $this->appendTagPath(sprintf('%stags/popular', $this->base)); $a_tag->setContent(Pinhole::_('By Popularity')); $a_tag->display(); $a_tag = new SwatHtmlTag('a'); $a_tag->href = $this->appendTagPath(sprintf('%stags/cloud', $this->base)); $a_tag->setContent(Pinhole::_('Cloud View')); $a_tag->display(); $div_tag->close(); }
protected function displayContent() { $comments = $this->getComments(); if (count($comments) == 0) { echo Pinhole::_('No comments have been made.'); } else { $locale = SwatI18NLocale::get(); echo '<ul>'; foreach ($comments as $comment) { echo '<li>'; $date = new SwatDate($comment->createdate); $date->convertTZById($this->app->config->date->time_zone); $date_diff = $date->getHumanReadableDateDiff(); $author = $comment->photographer === null ? $comment->fullname : $comment->photographer->fullname; $a_tag = new SwatHtmlTag('a'); $a_tag->href = sprintf('photo/%s#comment%s', $comment->getInternalValue('photo'), $comment->id); $a_tag->setContent(sprintf('%s ago by %s', $date_diff, $author)); $a_tag->display(); $div_tag = new SwatHtmlTag('div'); $div_tag->setContent(SwatString::ellipsizeRight(SwatString::condense($comment->bodytext), 100)); $div_tag->display(); echo '</li>'; } echo '</ul>'; } }
protected function displayAuthor(SiteComment $comment) { if ($this->getMode('author') > SiteView::MODE_NONE) { $link = $this->getLink('author'); if ($comment->author === null) { parent::displayAuthor($comment); } else { // System author // // Don't link to non-visible system authors but still show // their name on the comment. if ($comment->author->visible && $link !== false) { $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'vcard author'; $span_tag->open(); $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->class = 'comment-author system-comment-author fn url'; if (is_string($link)) { $anchor_tag->href = $link; } else { $anchor_tag->href = $this->getAuthorRelativeUri($comment->author); } $anchor_tag->setContent($comment->author->name); $anchor_tag->display(); $span_tag->close(); } else { $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'comment-author system-comment-author'; $span_tag->setContent($comment->author->name); $span_tag->display(); } } } }
protected function displayPermalink(BlorgComment $comment) { if ($this->getMode('permalink') > SiteView::MODE_NONE) { $link = $this->getLink('permalink'); if ($link === false) { $permalink_tag = new SwatHtmlTag('span'); } else { $permalink_tag = new SwatHtmlTag('a'); if ($link === true) { $permalink_tag->href = $this->getRelativeUri($comment); } else { $permalink_tag->href = $link; } } $permalink_tag->class = 'permalink'; $permalink_tag->open(); // display machine-readable date in UTC $abbr_tag = new SwatHtmlTag('abbr'); $abbr_tag->class = 'comment-published'; $abbr_tag->title = $comment->createdate->getISO8601(); // display human-readable date in local time $date = clone $comment->createdate; $date->convertTZ($this->app->default_time_zone); $abbr_tag->setContent($date->formatLikeIntl('h:mm a • d MMMM yyyy')); $abbr_tag->display(); $permalink_tag->close(); } }
public static function displayCalendarMonth(SiteWebApplication $app, SwatDate $date) { $a_tag = new SwatHtmlTag('a'); $a_tag->setContent($date->formatLikeIntl('MMMM, yyyy')); $a_tag->title = sprintf('View photos taken during %s', $date->formatLikeIntl('MMMM, yyyy')); $a_tag->href = sprintf('%stag?date.month=%s/date.year=%s', $app->config->pinhole->path, $date->getMonth(), $date->getYear()); $h4 = new SwatHtmlTag('h4'); $h4->setContent((string) $a_tag, 'text/xml'); $h4->display(); }
public function display() { parent::display(); $span_tag = new SwatHtmlTag('span'); $span_tag->id = $this->id; $span_tag->class = 'blorg-file-attach-status'; $span_tag->setContent(''); $span_tag->display(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
protected function displayHeader() { $header_div = new SwatHtmlTag('div'); $header_div->class = 'site-comment-display-header'; $header_div->open(); $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->href = sprintf('Post/Details?id=%s', $this->comment->post->id); $anchor_tag->setContent($this->comment->post->getTitle()); printf(Blorg::_('Comment on %s'), $anchor_tag); $this->displayStatusSpan(); $header_div->close(); }
public function display() { if (!$this->visible) { return; } if ($this->tag_list === null) { return; } if ($this->sub_tag_list === null || count($this->sub_tag_list) == 0) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'pinhole-sub-tag-list-view'; $div_tag->id = $this->id; $div_tag->open(); if (count($this->tag_list) > 0) { $titles = array(); foreach ($this->tag_list as $tag) { $titles[] = $tag->getTitle(); } $header_tag = new SwatHtmlTag('h2'); $header_tag->setContent(sprintf(Pinhole::_('View photos tagged “%s” and:'), implode('”, “', $titles))); $header_tag->display(); } elseif ($this->title !== null) { $header_tag = new SwatHtmlTag('h2'); $header_tag->setContent($this->title); $header_tag->display(); } $ul_tag = new SwatHtmlTag('ul'); $ul_tag->id = $this->id . '_list'; $ul_tag->open(); $li_tag = new SwatHtmlTag('li'); foreach ($this->sub_tag_list as $tag) { $add_list = clone $this->tag_list; $add_list->add($tag); $li_tag->open(); $add_anchor_tag = new SwatHtmlTag('a'); $add_anchor_tag->class = 'pinhole-tag-list-view-tag'; $add_anchor_tag->rel = 'tag'; $add_anchor_tag->href = $this->base . '?' . $add_list->__toString(); $add_anchor_tag->setContent($tag->getTitle()); if ($tag->photo_count !== null) { $add_anchor_tag->title = sprintf('%s %s', SwatString::minimizeEntities(SwatString::numberFormat($tag->photo_count)), SwatString::minimizeEntities(Pinhole::ngettext('Photo', 'Photos', $tag->photo_count))); } $add_anchor_tag->display(); $li_tag->close(); unset($add_list); } $ul_tag->close(); $div_tag->close(); }
protected function displayAuthor(SiteComment $comment) { if ($this->getMode('author') > SiteView::MODE_NONE) { if ($comment->photographer === null) { parent::displayAuthor($comment); } else { // System author $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'comment-author system-comment-author'; $span_tag->setContent($comment->photographer->fullname); $span_tag->display(); } } }
public function getBody() { ob_start(); echo '<strong>'; $anchor = new SwatHtmlTag('a'); $anchor->href = $this->element->{'link-url'}; $anchor->setContent($this->element->{'link-text'}); $anchor->display(); echo '</strong>'; if (isset($this->element->{'link-description'}) && $this->element->{'link-description'} != '') { echo '<p>', $this->element->{'link-description'}, '</p>'; } return ob_get_clean(); }
protected function displayContent() { $base_href = $this->app->config->blorg->path; echo '<ul class="blorg-syndication"><li>'; $a_tag = new SwatHtmlTag('a'); $a_tag->href = $base_href . 'feed'; $a_tag->setContent(Blorg::_('Recent Posts')); $a_tag->display(); echo '</li><li>'; $a_tag = new SwatHtmlTag('a'); $a_tag->href = $base_href . 'feed/comments'; $a_tag->setContent(Blorg::_('Recent Comments')); $a_tag->display(); echo '</li></ul>'; }
protected function displayContent() { $comment = $this->data_object; $div_tag = new SwatHtmlTag('div'); $div_tag->setContent($this->data_object->post->getTitle()); $div_tag->display(); $h2_tag = new SwatHtmlTag('h2'); $h2_tag->setContent($this->data_object->fullname); $h2_tag->display(); $abbr_tag = new SwatHtmlTag('abbr'); $date = clone $comment->createdate; $date->convertTZ($this->app->default_time_zone); $abbr_tag->setContent(sprintf(Blorg::_('Posted: %s'), $date->formatLikeIntl(SwatDate::DF_DATE))); $abbr_tag->display(); echo SwatString::toXHTML($comment->bodytext); }
protected function displayBody(BuildingBlock $block) { if ($block->bodytext != '') { if ($this->getMode('body') === SiteView::MODE_ALL) { $div = new SwatHtmlTag('div'); $div->class = 'building-block-bodytext'; $div->setContent($block->bodytext, 'text/xml'); $div->display(); } elseif ($this->getMode('body') === SiteView::MODE_SUMMARY) { $bodytext = SwatString::condense($block->bodytext, $this->body_summary_length); $div = new SwatHtmlTag('div'); $div->class = 'building-block-bodytext'; $div->setContent($bodytext, 'text/xml'); $div->display(); } } }
protected function displayContent() { $conversations = $this->getActiveConversations(); if (count($conversations) > 0) { // get last visited date based on cookie value if ($this->app->hasModule('SiteCookieModule')) { $cookie = $this->app->getModule('SiteCookieModule'); try { if (isset($cookie->last_visit_date)) { $last_visit_date = new SwatDate($cookie->last_visit_date); } else { $last_visit_date = new SwatDate(); } } catch (SiteCookieException $e) { $last_visit_date = new SwatDate(); } } else { $last_visit_date = new SwatDate(); } echo '<ul>'; $locale = SwatI18NLocale::get(); $class_name = SwatDBClassMap::get('BlorgPost'); foreach ($conversations as $conversation) { $post = new $class_name($conversation); $last_comment_date = new SwatDate($conversation->last_comment_date); $last_comment_date->setTZById('UTC'); $li_tag = new SwatHtmlTag('li'); // is last comment is later than last visit date, mark as new if (SwatDate::compare($last_comment_date, $last_visit_date) > 0) { $li_tag->class = 'new'; } $li_tag->open(); $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->href = $this->getPostRelativeUri($post); $anchor_tag->setContent($post->getTitle()); $span_tag = new SwatHtmlTag('span'); $span_tag->setContent(sprintf(Blorg::ngettext('(%s comment)', '(%s comments)', $post->getVisibleCommentCount()), $locale->formatNumber($post->getVisibleCommentCount()))); $anchor_tag->display(); echo ' '; $span_tag->display(); $li_tag->close(); } echo '</ul>'; } }
protected function buildInternal() { parent::buildInternal(); $item_list = $this->getItemList('integer'); $blocks = SwatDB::query($this->app->db, sprintf('select * from Block where id in (%s)', $this->getItemList('integer')), SwatDBClassMap::get('BuildingBlockWrapper')); $view = SiteViewFactory::get($this->app, 'building-block'); $view->getImageView()->setImageDimensionShortname('thumb'); ob_start(); $header = new SwatHtmlTag('h1'); $header->setContent('Delete the following content?'); $header->display(); foreach ($blocks as $block) { $view->display($block); } $message = $this->ui->getWidget('confirmation_message'); $message->content = ob_get_clean(); $message->content_type = 'text/xml'; }
/** * Displays an article as a sub-article * * @param SiteArticle $article the article to display. * @param string $path an optional string containing the path to the * article being displayed. If no path is provided, * the path of the current page is used. */ protected function displaySubArticle(SiteArticle $article, $path = null) { if ($path === null) { $path = $this->path; } $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->href = 'article/' . $path . '/' . $article->shortname; $anchor_tag->class = 'sub-article'; $anchor_tag->setContent($article->title); $dt_tag = new SwatHtmlTag('dt'); $dt_tag->id = sprintf('sub_article_%s', $article->shortname); $dt_tag->open(); $anchor_tag->display(); $dt_tag->close(); if ($article->description != '') { echo '<dd>', $article->description, '</dd>'; } }
protected function getContainer() { if (isset($this->app->memcache)) { $cache_key = sprintf('PinholeMetaDataGadget.getContainer.%s', $this->app->session->isLoggedIn() ? 'private' : 'public'); $container = $this->app->memcache->getNs('photos', $cache_key); if ($container !== false) { return $container; } } $sections = $this->getMetaDataSections(); $values = $this->getMetaDataValues(); $locale = SwatI18NLocale::get(); $container = new SwatContainer(); foreach ($sections as $section) { $disclosure = new SwatDisclosure(); $disclosure->title = $section->title; $disclosure->open = false; ob_start(); echo '<ul>'; foreach ($values as $value) { if ($value->meta_data == $section->id) { echo '<li class="clearfix"><div>'; $a_tag = new SwatHtmlTag('a'); $a_tag->href = sprintf('%stag?meta.%s=%s', $this->app->config->pinhole->path, $section->shortname, PinholePhotoMetaDataBinding::escapeValue($value->value)); $a_tag->setContent(PinholePhotoMetaDataBinding::getFormattedValue($section->shortname, $value->value)); $a_tag->display(); echo ' <span>' . $locale->formatNumber($value->photo_count) . '</span>'; echo '</div></li>'; } } echo '</ul>'; $content = new SwatContentBlock(); $content->content_type = 'text/xml'; $content->content = ob_get_clean(); $disclosure->add($content); $container->add($disclosure); } if (isset($this->app->memcache)) { $this->app->memcache->setNs('photos', $cache_key, $container); } return $container; }
protected function displayHeaderTitleText() { $site_title = $this->app->config->site->title; $h1_tag = new SwatHtmlTag('h1'); $h1_tag->title = $site_title; $h1_tag->open(); echo '<span>'; $source = $this->app->getPage()->getSource(); if ($source != '') { $a_tag = new SwatHtmlTag('a'); $a_tag->accesskey = '1'; $a_tag->href = '.'; $a_tag->open(); } $words = explode(' ', $site_title); $count = 0; $word_span = new SwatHtmlTag('span'); $letter_span = new SwatHtmlTag('span'); $letter_span->class = 'first-letter'; $num_words = count($words); foreach ($words as $word) { $word = trim($word); if ($word != '') { $count++; $word_span->class = sprintf('title-%s', $count); $word_span->open(); $letter_span->setContent(substr($word, 0, 1)); $letter_span->display(); echo SwatString::minimizeEntities(substr($word, 1)); $word_span->close(); // don't display a space for the last word if ($count < $num_words) { echo ' '; } } } if ($source != '') { $a_tag->close(); } echo '</span>'; $h1_tag->close(); }
protected function displayContent() { $articles = $this->getArticles(); if (count($articles) > 0) { echo '<ul>'; $locale = SwatI18NLocale::get(); foreach ($articles as $article) { echo '<li>'; $title_div = new SwatHtmlTag('div'); $title_div->open(); $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->href = $this->getArticleRelativeUri($article); $anchor_tag->setContent($article->title); $anchor_tag->display(); $title_div->close(); $content_div = new SwatHtmlTag('div'); $content_div->setContent($article->description, 'text/xml'); $content_div->display(); echo '</li>'; } echo '</ul>'; } }
protected function displayContent() { $range = new SwatDBRange($this->getValue('limit')); $cache_module = isset($this->app->memcache) ? $this->app->memcache : null; $tag_list = new PinholeTagList($this->app, null, $this->app->session->isLoggedIn()); $sub_tag_list = $tag_list->getSubTags($range); $sub_tag_count = $tag_list->getSubTagCount(); $this->tag_list_view = new PinholeSubTagListView(); $base_path = $this->app->config->pinhole->path; $this->tag_list_view->base = $base_path . 'tag'; $this->tag_list_view->setTagList($tag_list); $this->tag_list_view->setSubTagList($sub_tag_list); $this->tag_list_view->display(); if ($sub_tag_count > count($sub_tag_list)) { $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'pinhole-sub-tag-more-link'; $div_tag->open(); $a_tag = new SwatHtmlTag('a'); $a_tag->href = $base_path . 'tags/date'; $a_tag->setContent(sprintf(Pinhole::_('View All %s Tags'), $sub_tag_count)); $a_tag->display(); $div_tag->close(); } }
/** * Displays this embed markup view */ public function display() { if (!$this->visible) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->open(); $label_tag = new SwatHtmlTag('label'); $label_tag->for = $this->id . '_textarea'; $label_tag->class = 'blorg-markup-view-label'; $label_tag->open(); $span_tag = new SwatHtmlTag('span'); $span_tag->setContent(Blorg::_('Embed:')); $span_tag->display(); $label_tag->close(); $first_option = reset($this->getOptions()); $textarea = $this->getCompositeWidget('textarea'); $textarea->value = $first_option->value; $textarea->display(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
protected function displayHomeLink() { if ($this->home_title !== null) { $tag_anchor_tag = new SwatHtmlTag('a'); $tag_anchor_tag->class = 'tag'; $tag_anchor_tag->href = $this->base; $tag_anchor_tag->setContent($this->home_title); echo '<span class="tag-wrapper">'; $tag_anchor_tag->display(); if (count($this->tag_list) > 0) { echo ' » '; } echo '</span>'; } }
protected function displayTag(PinholeTag $tag) { $add_list = clone $this->tag_list; $add_list->add($tag); $add_anchor_tag = new SwatHtmlTag('a'); $add_anchor_tag->rel = 'tag'; $add_anchor_tag->href = $this->app->config->pinhole->path . 'tag?' . $add_list->__toString(); $add_anchor_tag->setContent($tag->getTitle()); if ($tag->photo_count !== null) { $add_anchor_tag->title = sprintf('%s %s', SwatString::minimizeEntities(SwatString::numberFormat($tag->photo_count)), SwatString::minimizeEntities(Pinhole::ngettext('Photo', 'Photos', $tag->photo_count))); } $add_anchor_tag->display(); }
protected function displayFooter() { echo '<div class="footer">'; $path = $this->app->config->blorg->path; $post_count = $this->loader->getPostCount(); $this->pager = new SwatPagination(); $this->pager->display_parts ^= SwatPagination::POSITION; $this->pager->total_records = $post_count; $this->pager->page_size = self::MAX_POSTS; $this->pager->setCurrentPage($this->getArgument('page')); /* These strings include a non-breaking space */ $this->pager->previous_label = Blorg::_('« Newer'); $this->pager->next_label = Blorg::_('Older »'); $this->pager->link = $path . 'page%s'; $this->pager->display(); echo '<div class="results-message">'; echo $this->pager->getResultsMessage(Blorg::_('post'), Blorg::_('posts')); echo '</div>'; echo '<div class="archive-link">'; $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->href = $path . 'archive'; $anchor_tag->setContent(Blorg::_('Archive')); $anchor_tag->display(); echo '</div>'; echo '</div>'; }
protected function displaySummary(BuildingBlock $block) { if ($this->getMode('summary') > SiteView::MODE_NONE) { $type = BuildingBlockViewFactory::getViewType($block); switch ($type) { case 'building-block-audio': $summary = Building::_('Audio Content'); break; case 'building-block-video': $summary = Building::_('Video Content'); break; case 'building-block-image': $summary = Building::_('Image Content'); break; case 'building-block-attachment': $summary = Building::_('Attachment'); break; case 'building-block-xhtml': default: $summary = Building::_('Text Content'); break; } $header = new SwatHtmlTag('h4'); $header->setContent($summary); $header->class = 'building-block-admin-summary'; $header->display(); } }
protected function getContainer() { $date = new SwatDate(); if (isset($this->app->memcache)) { $cache_key = sprintf('PinholeDateBrowserGadget.getContent.%s.%s', $date->formatLikeIntl('MM/yyyy'), $this->app->session->isLoggedIn() ? 'private' : 'public'); $container = $this->app->memcache->getNs('photos', $cache_key); if ($container !== false) { return $container; } } $container = new SwatContainer(); $months = $this->getMonths(); if (count($months) == 0) { $content = new SwatContentBlock(); $content->content = Pinhole::_('No photos have been uploaded yet.'); $container->add($content); return $container; } $months_array = array(); foreach ($months as $month) { $date = new SwatDate($month->photo_date); $key = $date->getYear() . '/' . $date->getMonth(); $months_array[$key] = $month; } $locale = SwatI18NLocale::get(); $start_date = new SwatDate($months->getFirst()->photo_date); $start_year = $start_date->getYear(); $index = count($months) - 1; $end_date = new SwatDate($months->getByIndex($index)->photo_date); $end_year = $end_date->getYear(); $date = new SwatDate(); $date->clearTime(); for ($year = $start_year; $year >= $end_year; $year--) { $year_count = 0; $disclosure = new SwatDisclosure(); $disclosure->title = $year; $disclosure->open = false; ob_start(); echo '<ul>'; for ($i = 1; $i <= 12; $i++) { echo '<li class="clearfix"><div>'; $date->setDate($year, $i, 1); if (isset($months_array[$year . '/' . $i])) { $a_tag = new SwatHtmlTag('a'); $a_tag->setContent($date->getMonthName()); $a_tag->href = $this->app->config->pinhole->path . 'tag?date.year=' . $year . '/date.month=' . $i; $a_tag->display(); $photo_count = $months_array[$year . '/' . $i]->photo_count; echo '<span>' . $locale->formatNumber($photo_count) . '</span>'; $year_count += $photo_count; } else { $div_tag = new SwatHtmlTag('div'); $div_tag->setContent($date->getMonthName()); $div_tag->display(); } echo '</div></li>'; if ($i == 12 && $year_count > 0) { echo '<li class="clearfix"><div>'; $a_tag = new SwatHtmlTag('a'); $a_tag->setContent(sprintf(Pinhole::_('View all photos from %s'), $year)); $a_tag->href = $this->app->config->pinhole->path . 'tag?date.year=' . $year; $a_tag->display(); echo '<span>' . $locale->formatNumber($year_count) . '</span>'; echo '</div></li>'; } } echo '</ul>'; $content = new SwatContentBlock(); $content->content_type = 'text/xml'; $content->content = ob_get_clean(); $disclosure->add($content); $container->add($disclosure); } if (isset($this->app->memcache)) { $this->app->memcache->setNs('photos', $cache_key, $container); } return $container; }
protected function displayComments() { if ($this->post->comment_status != SiteCommentStatus::CLOSED) { Blorg::displayAd($this->app, 'post_comments'); $div_tag = new SwatHtmlTag('div'); $div_tag->id = 'comments'; $div_tag->class = 'entry-comments'; $div_tag->open(); $comments = $this->post->getVisibleComments(); $view = SiteViewFactory::get($this->app, 'post-comment'); $count = count($comments); if ($count > 0) { echo '<h3 class="comments-title">', Blorg::_('Comments'), '</h3>'; } // display message for locked comments if ($this->post->comment_status == SiteCommentStatus::LOCKED) { $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'comments-locked-message'; $div_tag->setContent(Blorg::_('Comments are locked. No additional comments may be ' . 'posted.')); $div_tag->display(); } foreach ($comments as $i => $comment) { if ($i == $count - 1) { $div_tag = new SwatHtmlTag('div'); $div_tag->id = 'last_comment'; $div_tag->open(); $view->display($comment); $div_tag->close(); } else { $view->display($comment); } } $div_tag->close(); } }
protected function displayFiles(BlorgPost $post) { if ($this->getMode('files') > SiteView::MODE_NONE) { $files = $post->getVisibleFiles(); if (count($files) > 0) { $link = $this->getLink('files'); echo '<ul class="attachments">'; foreach ($files as $file) { $li_tag = new SwatHtmlTag('li'); $li_tag->class = 'type-' . $file->mime_type; $li_tag->open(); if ($link === false) { $span_tag = new SwatHtmlTag('span'); $span_tag->setContent($file->getDescription()); $span_tag->display(); } else { $a_tag = new SwatHtmlTag('a'); $a_tag->href = $file->getRelativeUri($this->app->config->blorg->path, $this->path_prefix); $a_tag->setContent($file->getDescription()); $a_tag->display(); } echo ' ' . SwatString::byteFormat($file->filesize); $li_tag->close(); } echo '</ul>'; } } }
protected function displayNext(PinholePhoto $photo = null) { if ($photo === null) { $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'next'; $span_tag->setContent(Pinhole::_('Next')); $span_tag->display(); } else { $a_tag = new SwatHtmlTag('a'); $href = $this->appendTagPath(sprintf('%sphoto/%s', $this->base, $photo->id)); $a_tag->href = $href; $a_tag->title = $photo->title; $a_tag->class = 'next'; $a_tag->setContent(Pinhole::_('Next')); $a_tag->display(); $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($href, 'prefetch', null, null, Pinhole::PACKAGE_ID)); $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($photo->getUri('large'), 'prefetch', null, null, Pinhole::PACKAGE_ID)); $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($href, 'next', null, $photo->title, Pinhole::PACKAGE_ID)); } }