private function get_recent_posts() { global $container; $postRepository = new MysqlPostRepository($container['db_connection_locator']); $recentPosts = $postRepository->getActivePosts(3); $recent_post_array = array(); foreach ($recentPosts as $postResult) { $post = new stdclass(); $post->title = $postResult['title']; $post->url = Loader::getRootUrl('blog') . "{$postResult['category']}/{$postResult['path']}/"; $post->category = ucwords(str_replace('-', ' ', $postResult['category'])); $post->thumb = Content::instance('FetchFirstPhoto', $postResult['body'])->activate(); $post->body = Content::instance('SmartTrim', $postResult['body'])->activate($post->thumb !== '' ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); $recent_post_array[] = $post; } return $recent_post_array; }
protected function expand_post($raw_post, $format = 'short') { $post = [ 'type' => $raw_post['type'], 'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'], 'date' => $this->get_parsed_date($raw_post['datetime']), ]; if ($format != 'short') { $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/"; $metadata = json_decode($raw_post['metadata'], true); $post = array_merge($post, $metadata); } return (object) $post; }
public function __construct() { parent::__construct(); $log_path = URLDecode::getPiece(2); $this->log = LogCollector::getByAlias($log_path); if(!$this->log) $this->eject(); $this->parent_navigation_item = 'journal'; $this->handle_comment_submit( self::$WATERFALL_SITE_ID, $this->log->alias, Loader::getRootUrl('waterfalls') . self::$JOURNAL_DIRECTORY . '/' . $this->log->alias . '/', $this->log->title); $this->add_waterfall_js(); }
public function __construct() { parent::__construct(); $path_watercourse = URLDecode::getPiece(1); $path_fall = URLDecode::getPiece(2); $this->waterfall = WaterfallCollector::getByAlias($path_watercourse, $path_fall); if (!$this->waterfall) { $this->eject(); } $this->handle_comment_submit( self::$WATERFALL_SITE_ID, "{$this->waterfall->watercourse_alias}/{$this->waterfall->alias}", Loader::getRootUrl('waterfalls') . "{$this->waterfall->watercourse_alias}/{$this->waterfall->alias}/", $this->waterfall->name); $this->add_waterfall_js(); }
private function get_photo_content($string, $size, $is_absolute) { list($category, $file_name) = explode('/', $string); list($photo, $extension) = explode('.', $file_name); $file_path = $this->get_file_path($category, $photo, $size, $extension); $file_size = getimagesize($file_path); Loader::load('collector', 'image/PhotoCollector'); $photo_result = PhotoCollector::fetchRow($category, $photo); if ($photo_result == false) { return ''; } $height = $file_size[1]; $width = $file_size[0]; $description = $photo_result->description; $domain = '/'; if ($is_absolute) { $domain = Loader::getRootUrl('blog'); } return sprintf(self::$PHOTO_CONTENT, $domain, $category, $photo, $size, $height, $width, $description, $description); }
protected function get_list_prev_link() { if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) return; return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page + 1) . '/'; }
private function get_related_posts() { $tag_array = array(); foreach($this->tags as $tag) { $tag_array[] = $tag['id']; } $series_posts = $this->fetch_series_posts(); $exclude_post_array = array(); foreach($series_posts as $series_post) { $exclude_post_array[] = $series_post['post']; } global $container; $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); $post_result = $repository->getActivePostsByRelatedTags($this->post['id']); $post_array = array(); foreach($post_result as $post_row) { $post = new stdclass(); $post->title = $post_row['title']; $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); $post_array[] = $post; } return $post_array; }