public function __construct() { $tag = URLDecode::getPiece(2); $tag = str_replace('-', ' ', $tag); global $container; $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); $tag_result = $repository->findTagByTitle($tag); if($tag_result === false) $this->eject(); $this->tag = $tag_result; parent::__construct(); }
public function __construct() { parent::__construct(); global $container; $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); if($this->post == null) $this->eject(); $this->handle_comment_submit( self::$BLOG_SITE_ID, $this->post['path'], Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', $this->post['title']); global $container; $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); $this->tags = $repository->getTagsForPost($this->post['id']); }
final private function get_tag_cloud() { global $container; $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); $tag_result = $repository->getTagCloud(); $maximum_tag_count = $this->get_maximum_tag_count($tag_result); $cloud_array = array(); foreach($tag_result as $tag) { if($tag['count'] < self::$MINIMUM_TAG_COUNT) continue; $tag_object = new stdclass(); $tag_object->name = $tag['tag']; $tag_object->link = Content::instance('URLSafe', "/tag/{$tag['tag']}/")->activate(); $tag_object->scalar = floor(($tag['count'] - 1) * (9 / ($maximum_tag_count - self::$MINIMUM_TAG_COUNT))); $cloud_array[] = $tag_object; } return $cloud_array; }