@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | protected $connections; |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @param Aura\Sql\ConnectionLocator $connections |
|
| 14 | + * @param ConnectionLocator $connections |
|
| 15 | 15 | */ |
| 16 | 16 | public function __construct(ConnectionLocator $connections) |
| 17 | 17 | { |
@@ -41,6 +41,9 @@ discard block |
||
| 41 | 41 | ->fetchOne($query, $bindings); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + /** |
|
| 45 | + * @param integer $limit |
|
| 46 | + */ |
|
| 44 | 47 | public function getActivePosts($limit = null, $offset = 0) |
| 45 | 48 | { |
| 46 | 49 | $query = " |
@@ -79,6 +82,9 @@ discard block |
||
| 79 | 82 | ->fetchValue($query, $bindings); |
| 80 | 83 | } |
| 81 | 84 | |
| 85 | + /** |
|
| 86 | + * @param integer $limit |
|
| 87 | + */ |
|
| 82 | 88 | public function getActivePostsByTag($tag, $limit = null, $offset = 0) |
| 83 | 89 | { |
| 84 | 90 | $query = " |
@@ -122,6 +128,9 @@ discard block |
||
| 122 | 128 | ->fetchValue($query, $bindings); |
| 123 | 129 | } |
| 124 | 130 | |
| 131 | + /** |
|
| 132 | + * @param integer $limit |
|
| 133 | + */ |
|
| 125 | 134 | public function getActivePostsByCategory($category, $limit = null, $offset = 0) |
| 126 | 135 | { |
| 127 | 136 | $query = " |
@@ -14,10 +14,11 @@ discard block |
||
| 14 | 14 | preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches); |
| 15 | 15 | foreach($matches[1] as $key => $match) |
| 16 | 16 | { |
| 17 | - if(isset($matches[3][$key])) |
|
| 18 | - $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
| 19 | - else |
|
| 20 | - $link_content = $this->get_link($match, $is_absolute); |
|
| 17 | + if(isset($matches[3][$key])) {
|
|
| 18 | + $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
| 19 | + } else {
|
|
| 20 | + $link_content = $this->get_link($match, $is_absolute); |
|
| 21 | + } |
|
| 21 | 22 | $this->content = str_replace($matches[0][$key], $link_content, $this->content); |
| 22 | 23 | } |
| 23 | 24 | return; |
@@ -36,14 +37,16 @@ discard block |
||
| 36 | 37 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
| 37 | 38 | $post = $repository->findPostByPath($post_uri); |
| 38 | 39 | |
| 39 | - if($post === NULL) |
|
| 40 | - return; |
|
| 40 | + if($post === NULL) {
|
|
| 41 | + return; |
|
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
| 43 | 45 | $link .= "{$post['category']}/{$post['path']}/"; |
| 44 | 46 | |
| 45 | - if($anchor == '') |
|
| 46 | - $anchor = $post['title']; |
|
| 47 | + if($anchor == '') {
|
|
| 48 | + $anchor = $post['title']; |
|
| 49 | + } |
|
| 47 | 50 | |
| 48 | 51 | break; |
| 49 | 52 | case 'blog-tag' : |
@@ -62,14 +65,16 @@ discard block |
||
| 62 | 65 | Loader::load('collector', 'waterfall/LogCollector'); |
| 63 | 66 | $log = LogCollector::getByAlias($uri); |
| 64 | 67 | |
| 65 | - if($log === NULL) |
|
| 66 | - return; |
|
| 68 | + if($log === NULL) {
|
|
| 69 | + return; |
|
| 70 | + } |
|
| 67 | 71 | |
| 68 | 72 | $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
| 69 | 73 | $link .= "journal/{$log->alias}/"; |
| 70 | 74 | |
| 71 | - if($anchor == '') |
|
| 72 | - $anchor = $log->title; |
|
| 75 | + if($anchor == '') {
|
|
| 76 | + $anchor = $log->title; |
|
| 77 | + } |
|
| 73 | 78 | |
| 74 | 79 | break; |
| 75 | 80 | case 'falls' : |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | foreach($this->result as $row) |
| 43 | 43 | { |
| 44 | 44 | $weight = $this->get_search_weight($row); |
| 45 | - if($weight > 0) |
|
| 46 | - $weighted_array[$row['id']] = $weight; |
|
| 45 | + if($weight > 0) {
|
|
| 46 | + $weighted_array[$row['id']] = $weight; |
|
| 47 | + } |
|
| 47 | 48 | } |
| 48 | 49 | arsort($weighted_array); |
| 49 | 50 | |
@@ -52,8 +53,9 @@ discard block |
||
| 52 | 53 | { |
| 53 | 54 | foreach($this->result as $row) |
| 54 | 55 | { |
| 55 | - if($row['id'] == $id) |
|
| 56 | - $final_array[] = $row; |
|
| 56 | + if($row['id'] == $id) {
|
|
| 57 | + $final_array[] = $row; |
|
| 58 | + } |
|
| 57 | 59 | } |
| 58 | 60 | } |
| 59 | 61 | return $final_array; |
@@ -32,15 +32,17 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | parent::set_head_data(); |
| 34 | 34 | |
| 35 | - if($this->page == 1) |
|
| 36 | - $this->set_title(self::$TITLE_MAIN); |
|
| 37 | - else |
|
| 38 | - $this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages)); |
|
| 35 | + if($this->page == 1) {
|
|
| 36 | + $this->set_title(self::$TITLE_MAIN); |
|
| 37 | + } else {
|
|
| 38 | + $this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages)); |
|
| 39 | + } |
|
| 39 | 40 | |
| 40 | - if($this->page == 1) |
|
| 41 | - $this->set_description(self::$DESCRIPTION_MAIN); |
|
| 42 | - else |
|
| 43 | - $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages)); |
|
| 41 | + if($this->page == 1) {
|
|
| 42 | + $this->set_description(self::$DESCRIPTION_MAIN); |
|
| 43 | + } else {
|
|
| 44 | + $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages)); |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | $this->set_keywords(self::$KEYWORD_ARRAY); |
| 46 | 48 | } |
@@ -68,8 +70,9 @@ discard block |
||
| 68 | 70 | protected function get_page_number() |
| 69 | 71 | { |
| 70 | 72 | $page = URLDecode::getPiece(1); |
| 71 | - if(isset($page) && is_numeric($page)) |
|
| 72 | - return $page; |
|
| 73 | + if(isset($page) && is_numeric($page)) {
|
|
| 74 | + return $page; |
|
| 75 | + } |
|
| 73 | 76 | return 1; |
| 74 | 77 | } |
| 75 | 78 | |
@@ -90,17 +93,20 @@ discard block |
||
| 90 | 93 | |
| 91 | 94 | protected function get_list_next_link() |
| 92 | 95 | { |
| 93 | - if($this->page == 1) |
|
| 94 | - return; |
|
| 95 | - if($this->page == 2) |
|
| 96 | - return '/'; |
|
| 96 | + if($this->page == 1) {
|
|
| 97 | + return; |
|
| 98 | + } |
|
| 99 | + if($this->page == 2) {
|
|
| 100 | + return '/'; |
|
| 101 | + } |
|
| 97 | 102 | return '/' . ($this->page - 1) . '/'; |
| 98 | 103 | } |
| 99 | 104 | |
| 100 | 105 | protected function get_list_prev_link() |
| 101 | 106 | { |
| 102 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 103 | - return; |
|
| 107 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
|
|
| 108 | + return; |
|
| 109 | + } |
|
| 104 | 110 | return '/' . ($this->page + 1) . '/'; |
| 105 | 111 | } |
| 106 | 112 | |
@@ -30,8 +30,9 @@ discard block |
||
| 30 | 30 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
| 31 | 31 | $tag_result = $repository->findTagByTitle($tag); |
| 32 | 32 | |
| 33 | - if($tag_result === false) |
|
| 34 | - $this->eject(); |
|
| 33 | + if($tag_result === false) {
|
|
| 34 | + $this->eject(); |
|
| 35 | + } |
|
| 35 | 36 | |
| 36 | 37 | $this->tag = $tag_result; |
| 37 | 38 | |
@@ -46,8 +47,7 @@ discard block |
||
| 46 | 47 | { |
| 47 | 48 | $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag['tag']))); |
| 48 | 49 | $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag['tag']))); |
| 49 | - } |
|
| 50 | - else |
|
| 50 | + } else |
|
| 51 | 51 | { |
| 52 | 52 | $this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->tag['tag']), $this->page, $this->total_pages)); |
| 53 | 53 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->tag['tag']))); |
@@ -89,8 +89,9 @@ discard block |
||
| 89 | 89 | protected function get_page_number() |
| 90 | 90 | { |
| 91 | 91 | $page = URLDecode::getPiece(3); |
| 92 | - if(isset($page) && is_numeric($page)) |
|
| 93 | - return $page; |
|
| 92 | + if(isset($page) && is_numeric($page)) {
|
|
| 93 | + return $page; |
|
| 94 | + } |
|
| 94 | 95 | return 1; |
| 95 | 96 | } |
| 96 | 97 | |
@@ -111,17 +112,20 @@ discard block |
||
| 111 | 112 | |
| 112 | 113 | protected function get_list_next_link() |
| 113 | 114 | { |
| 114 | - if($this->page == 1) |
|
| 115 | - return; |
|
| 116 | - if($this->page == 2) |
|
| 117 | - return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate(); |
|
| 115 | + if($this->page == 1) {
|
|
| 116 | + return; |
|
| 117 | + } |
|
| 118 | + if($this->page == 2) {
|
|
| 119 | + return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate();
|
|
| 120 | + } |
|
| 118 | 121 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page - 1) . '/')->activate(); |
| 119 | 122 | } |
| 120 | 123 | |
| 121 | 124 | protected function get_list_prev_link() |
| 122 | 125 | { |
| 123 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 124 | - return; |
|
| 126 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
|
|
| 127 | + return; |
|
| 128 | + } |
|
| 125 | 129 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate(); |
| 126 | 130 | } |
| 127 | 131 | |
@@ -74,8 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $this->set_title(self::$TITLE_MAIN_HIKING); |
| 76 | 76 | $this->set_description(self::$DESCRIPTION_MAIN_HIKING); |
| 77 | - } |
|
| 78 | - else |
|
| 77 | + } else |
|
| 79 | 78 | { |
| 80 | 79 | $this->set_title(sprintf(self::$TITLE_PAGINATED_HIKING, $this->page, $this->total_pages)); |
| 81 | 80 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_HIKING, $this->page, $this->total_pages)); |
@@ -87,8 +86,7 @@ discard block |
||
| 87 | 86 | { |
| 88 | 87 | $this->set_title(self::$TITLE_MAIN_PERSONAL); |
| 89 | 88 | $this->set_description(self::$DESCRIPTION_MAIN_PERSONAL); |
| 90 | - } |
|
| 91 | - else |
|
| 89 | + } else |
|
| 92 | 90 | { |
| 93 | 91 | $this->set_title(sprintf(self::$TITLE_PAGINATED_PERSONAL, $this->page, $this->total_pages)); |
| 94 | 92 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_PERSONAL, $this->page, $this->total_pages)); |
@@ -100,8 +98,7 @@ discard block |
||
| 100 | 98 | { |
| 101 | 99 | $this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT); |
| 102 | 100 | $this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT); |
| 103 | - } |
|
| 104 | - else |
|
| 101 | + } else |
|
| 105 | 102 | { |
| 106 | 103 | $this->set_title(sprintf(self::$TITLE_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages)); |
| 107 | 104 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages)); |
@@ -134,8 +131,9 @@ discard block |
||
| 134 | 131 | protected function get_page_number() |
| 135 | 132 | { |
| 136 | 133 | $page = URLDecode::getPiece(2); |
| 137 | - if(isset($page) && is_numeric($page)) |
|
| 138 | - return $page; |
|
| 134 | + if(isset($page) && is_numeric($page)) {
|
|
| 135 | + return $page; |
|
| 136 | + } |
|
| 139 | 137 | return 1; |
| 140 | 138 | } |
| 141 | 139 | |
@@ -156,17 +154,20 @@ discard block |
||
| 156 | 154 | |
| 157 | 155 | protected function get_list_next_link() |
| 158 | 156 | { |
| 159 | - if($this->page == 1) |
|
| 160 | - return; |
|
| 161 | - if($this->page == 2) |
|
| 162 | - return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
|
| 157 | + if($this->page == 1) {
|
|
| 158 | + return; |
|
| 159 | + } |
|
| 160 | + if($this->page == 2) {
|
|
| 161 | + return Content::instance('URLSafe', "/{$this->category->link}/")->activate();
|
|
| 162 | + } |
|
| 163 | 163 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page - 1) . '/')->activate(); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | protected function get_list_prev_link() |
| 167 | 167 | { |
| 168 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 169 | - return; |
|
| 168 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
|
|
| 169 | + return; |
|
| 170 | + } |
|
| 170 | 171 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate(); |
| 171 | 172 | } |
| 172 | 173 | |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | Loader::load('collector', 'image/PhotoCollector'); |
| 42 | 42 | $photo_result = PhotoCollector::getRow($id); |
| 43 | 43 | |
| 44 | - if($photo_result == null) |
|
| 45 | - return; |
|
| 44 | + if($photo_result == null) {
|
|
| 45 | + return; |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | 48 | $name = $photo_result->name; |
| 48 | 49 | $category = $photo_result->category; |
@@ -106,8 +107,9 @@ discard block |
||
| 106 | 107 | { |
| 107 | 108 | $body = $post['body']; |
| 108 | 109 | |
| 109 | - if($trim) |
|
| 110 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
| 110 | + if($trim) {
|
|
| 111 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST);
|
|
| 112 | + } |
|
| 111 | 113 | |
| 112 | 114 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
| 113 | 115 | $body = Content::instance('MarkupCode', $body)->activate(); |
@@ -134,8 +136,9 @@ discard block |
||
| 134 | 136 | $cloud_array = array(); |
| 135 | 137 | foreach($tag_result as $tag) |
| 136 | 138 | { |
| 137 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
| 138 | - continue; |
|
| 139 | + if($tag['count'] < self::$MINIMUM_TAG_COUNT) {
|
|
| 140 | + continue; |
|
| 141 | + } |
|
| 139 | 142 | |
| 140 | 143 | $tag_object = new stdclass(); |
| 141 | 144 | $tag_object->name = $tag['tag']; |
@@ -153,8 +156,9 @@ discard block |
||
| 153 | 156 | |
| 154 | 157 | foreach($tag_result as $tag) |
| 155 | 158 | { |
| 156 | - if($tag['count'] > $maximum) |
|
| 157 | - $maximum = $tag['count']; |
|
| 159 | + if($tag['count'] > $maximum) {
|
|
| 160 | + $maximum = $tag['count']; |
|
| 161 | + } |
|
| 158 | 162 | } |
| 159 | 163 | return $maximum; |
| 160 | 164 | } |