@@ -27,8 +27,9 @@ |
||
27 | 27 | $alias = URLDecode::getPiece(3); |
28 | 28 | $this->tag = LogTagCollector::getTag($alias); |
29 | 29 | |
30 | - if(!$this->tag) |
|
31 | - $this->eject(); |
|
30 | + if(!$this->tag) { |
|
31 | + $this->eject(); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | parent::__construct(); |
34 | 35 | } |
@@ -29,8 +29,9 @@ |
||
29 | 29 | $path = URLDecode::getPiece(1); |
30 | 30 | $this->watercourse = WatercourseCollector::getByAlias($path); |
31 | 31 | |
32 | - if(!$this->watercourse) |
|
33 | - $this->eject(); |
|
32 | + if(!$this->watercourse) { |
|
33 | + $this->eject(); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | parent::__construct(); |
36 | 37 | } |
@@ -20,15 +20,17 @@ discard block |
||
20 | 20 | $this->offset = ($this->page - 1) * $this->get_item_count_per_page(); |
21 | 21 | |
22 | 22 | $items = $this->get_items(); |
23 | - if(count($items) < 1) |
|
24 | - $this->eject(); |
|
23 | + if(count($items) < 1) { |
|
24 | + $this->eject(); |
|
25 | + } |
|
25 | 26 | } |
26 | 27 | |
27 | 28 | final protected function get_page_number() |
28 | 29 | { |
29 | 30 | $page = $this->get_page_number_piece(); |
30 | - if(isset($page) && is_numeric($page)) |
|
31 | - return $page; |
|
31 | + if(isset($page) && is_numeric($page)) { |
|
32 | + return $page; |
|
33 | + } |
|
32 | 34 | return 1; |
33 | 35 | } |
34 | 36 | |
@@ -41,8 +43,9 @@ discard block |
||
41 | 43 | |
42 | 44 | final private function get_introduction() |
43 | 45 | { |
44 | - if($this->page == 1) |
|
45 | - return $this->get_initial_introduction(); |
|
46 | + if($this->page == 1) { |
|
47 | + return $this->get_initial_introduction(); |
|
48 | + } |
|
46 | 49 | |
47 | 50 | return $this->get_subsequent_introduction(); |
48 | 51 | } |
@@ -68,8 +71,9 @@ discard block |
||
68 | 71 | private $item_count; |
69 | 72 | final private function get_item_count() |
70 | 73 | { |
71 | - if(!isset($this->item_count)) |
|
72 | - $this->item_count = $this->get_item_count_result(); |
|
74 | + if(!isset($this->item_count)) { |
|
75 | + $this->item_count = $this->get_item_count_result(); |
|
76 | + } |
|
73 | 77 | return $this->item_count; |
74 | 78 | } |
75 | 79 | |
@@ -82,10 +86,11 @@ discard block |
||
82 | 86 | $this->set_head('next_link', $this->get_list_next_link()); |
83 | 87 | $this->set_head('previous_link', $this->get_list_prev_link()); |
84 | 88 | |
85 | - if($this->page == 1) |
|
86 | - $meta_array = $this->get_initial_meta(); |
|
87 | - else |
|
88 | - $meta_array = $this->get_subsequent_meta(); |
|
89 | + if($this->page == 1) { |
|
90 | + $meta_array = $this->get_initial_meta(); |
|
91 | + } else { |
|
92 | + $meta_array = $this->get_subsequent_meta(); |
|
93 | + } |
|
89 | 94 | |
90 | 95 | $this->set_title($meta_array['title']); |
91 | 96 | $this->set_description($meta_array['description']); |
@@ -119,17 +124,20 @@ discard block |
||
119 | 124 | |
120 | 125 | final private function get_list_prev_link() |
121 | 126 | { |
122 | - if($this->page == 1) |
|
123 | - return; |
|
124 | - if($this->page == 2) |
|
125 | - return $this->get_list_link_root(); |
|
127 | + if($this->page == 1) { |
|
128 | + return; |
|
129 | + } |
|
130 | + if($this->page == 2) { |
|
131 | + return $this->get_list_link_root(); |
|
132 | + } |
|
126 | 133 | return $this->get_list_link_root() . ($this->page - 1) . '/'; |
127 | 134 | } |
128 | 135 | |
129 | 136 | final private function get_list_next_link() |
130 | 137 | { |
131 | - if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
132 | - return; |
|
138 | + if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) { |
|
139 | + return; |
|
140 | + } |
|
133 | 141 | return $this->get_list_link_root() . ($this->page + 1) . '/'; |
134 | 142 | } |
135 | 143 | |
@@ -139,15 +147,17 @@ discard block |
||
139 | 147 | { |
140 | 148 | $link_array = array(); |
141 | 149 | |
142 | - if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
143 | - return $link_array; |
|
150 | + if($this->get_item_count_per_page() >= $this->get_item_count()) { |
|
151 | + return $link_array; |
|
152 | + } |
|
144 | 153 | |
145 | 154 | $link = new stdclass(); |
146 | 155 | $link->anchor = '« previous'; |
147 | - if($this->get_list_prev_link() !== null) |
|
148 | - $link->uri = $this->get_list_prev_link(); |
|
149 | - else |
|
150 | - $link->class = 'inactive'; |
|
156 | + if($this->get_list_prev_link() !== null) { |
|
157 | + $link->uri = $this->get_list_prev_link(); |
|
158 | + } else { |
|
159 | + $link->class = 'inactive'; |
|
160 | + } |
|
151 | 161 | $link_array[] = $link; |
152 | 162 | |
153 | 163 | for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
@@ -155,14 +165,15 @@ discard block |
||
155 | 165 | $link = new stdclass(); |
156 | 166 | $link->anchor = $i; |
157 | 167 | |
158 | - if($i == $this->page) |
|
159 | - $link->class = 'current'; |
|
160 | - else |
|
168 | + if($i == $this->page) { |
|
169 | + $link->class = 'current'; |
|
170 | + } else |
|
161 | 171 | { |
162 | - if($i == 1) |
|
163 | - $link->uri = $this->get_list_link_root(); |
|
164 | - else |
|
165 | - $link->uri = $this->get_list_link_root() . $i . '/'; |
|
172 | + if($i == 1) { |
|
173 | + $link->uri = $this->get_list_link_root(); |
|
174 | + } else { |
|
175 | + $link->uri = $this->get_list_link_root() . $i . '/'; |
|
176 | + } |
|
166 | 177 | } |
167 | 178 | |
168 | 179 | $link_array[] = $link; |
@@ -170,10 +181,11 @@ discard block |
||
170 | 181 | |
171 | 182 | $link = new stdclass(); |
172 | 183 | $link->anchor = 'next »'; |
173 | - if($this->get_list_next_link() !== null) |
|
174 | - $link->uri = $this->get_list_next_link(); |
|
175 | - else |
|
176 | - $link->class = 'inactive'; |
|
184 | + if($this->get_list_next_link() !== null) { |
|
185 | + $link->uri = $this->get_list_next_link(); |
|
186 | + } else { |
|
187 | + $link->class = 'inactive'; |
|
188 | + } |
|
177 | 189 | $link_array[] = $link; |
178 | 190 | |
179 | 191 | return $link_array; |
@@ -27,8 +27,9 @@ |
||
27 | 27 | $alias = URLDecode::getPiece(2); |
28 | 28 | $this->companion = CompanionCollector::getByAlias($alias); |
29 | 29 | |
30 | - if(!$this->companion) |
|
31 | - $this->eject(); |
|
30 | + if(!$this->companion) { |
|
31 | + $this->eject(); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | parent::__construct(); |
34 | 35 | } |
@@ -27,8 +27,9 @@ discard block |
||
27 | 27 | parent::__construct(); |
28 | 28 | |
29 | 29 | $this->post = PostCollector::getPostByURI(URLDecode::getPiece(2)); |
30 | - if($this->post == null) |
|
31 | - $this->eject(); |
|
30 | + if($this->post == null) { |
|
31 | + $this->eject(); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | $this->handle_comment_submit( |
34 | 35 | self::$BLOG_SITE_ID, |
@@ -103,8 +104,9 @@ discard block |
||
103 | 104 | private function get_series_posts() |
104 | 105 | { |
105 | 106 | $series_posts = $this->fetch_series_posts(); |
106 | - if(count($series_posts) < 1) |
|
107 | - return array(); |
|
107 | + if(count($series_posts) < 1) { |
|
108 | + return array(); |
|
109 | + } |
|
108 | 110 | |
109 | 111 | $previous_post = new stdclass(); |
110 | 112 | $next_post = new stdclass(); |
@@ -132,9 +134,9 @@ discard block |
||
132 | 134 | |
133 | 135 | $post->url = Loader::getRootUrl('blog') . "{$post_row->category}/{$post_row->path}/"; |
134 | 136 | |
135 | - if(!$found_current_post) |
|
136 | - $previous_post = $post; |
|
137 | - else |
|
137 | + if(!$found_current_post) { |
|
138 | + $previous_post = $post; |
|
139 | + } else |
|
138 | 140 | { |
139 | 141 | $next_post = $post; |
140 | 142 | break; |
@@ -151,8 +153,9 @@ discard block |
||
151 | 153 | private $series_posts; |
152 | 154 | private function fetch_series_posts() |
153 | 155 | { |
154 | - if(!isset($this->series_posts)) |
|
155 | - $this->series_posts = SeriesCollector::getSeriesForPost($this->post->id); |
|
156 | + if(!isset($this->series_posts)) { |
|
157 | + $this->series_posts = SeriesCollector::getSeriesForPost($this->post->id); |
|
158 | + } |
|
156 | 159 | return $this->series_posts; |
157 | 160 | } |
158 | 161 |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | { |
50 | 50 | $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->query))); |
51 | 51 | $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->query))); |
52 | - } |
|
53 | - else |
|
52 | + } else |
|
54 | 53 | { |
55 | 54 | $this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->query), $this->page, $this->total_pages)); |
56 | 55 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->query))); |
@@ -63,22 +62,24 @@ discard block |
||
63 | 62 | |
64 | 63 | protected function get_introduction() |
65 | 64 | { |
66 | - if($this->total_pages > 1) |
|
67 | - return array( |
|
68 | - 'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}."); |
|
69 | - else if($this->total_pages == 1) |
|
70 | - return array( |
|
71 | - 'title' => "Posts from search '{$this->query}'."); |
|
72 | - else |
|
73 | - return array( |
|
74 | - 'title' => "Sorry, '{$this->query}' didn't return any posts."); |
|
65 | + if($this->total_pages > 1) { |
|
66 | + return array( |
|
67 | + 'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}."); |
|
68 | + } else if($this->total_pages == 1) { |
|
69 | + return array( |
|
70 | + 'title' => "Posts from search '{$this->query}'."); |
|
71 | + } else { |
|
72 | + return array( |
|
73 | + 'title' => "Sorry, '{$this->query}' didn't return any posts."); |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | protected function get_page_number() |
78 | 78 | { |
79 | 79 | $page = URLDecode::getPiece(3); |
80 | - if(isset($page) && is_numeric($page)) |
|
81 | - return $page; |
|
80 | + if(isset($page) && is_numeric($page)) { |
|
81 | + return $page; |
|
82 | + } |
|
82 | 83 | return 1; |
83 | 84 | } |
84 | 85 | |
@@ -113,25 +114,29 @@ discard block |
||
113 | 114 | |
114 | 115 | protected function get_list_next_link() |
115 | 116 | { |
116 | - if($this->page == 1) |
|
117 | - return; |
|
118 | - if($this->page == 2) |
|
119 | - return Content::instance('URLSafe', "/search/{$this->query}/")->activate(); |
|
117 | + if($this->page == 1) { |
|
118 | + return; |
|
119 | + } |
|
120 | + if($this->page == 2) { |
|
121 | + return Content::instance('URLSafe', "/search/{$this->query}/")->activate(); |
|
122 | + } |
|
120 | 123 | return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page - 1) . '/')->activate(); |
121 | 124 | } |
122 | 125 | |
123 | 126 | protected function get_list_prev_link() |
124 | 127 | { |
125 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
126 | - return; |
|
128 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
129 | + return; |
|
130 | + } |
|
127 | 131 | return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page + 1) . '/')->activate(); |
128 | 132 | } |
129 | 133 | |
130 | 134 | private $total_post_count; |
131 | 135 | protected function get_total_post_count() |
132 | 136 | { |
133 | - if(!isset($this->total_post_count)) |
|
134 | - $this->total_post_count = count($this->get_search_result()); |
|
137 | + if(!isset($this->total_post_count)) { |
|
138 | + $this->total_post_count = count($this->get_search_result()); |
|
139 | + } |
|
135 | 140 | return $this->total_post_count; |
136 | 141 | } |
137 | 142 |
@@ -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)); |
@@ -133,8 +130,9 @@ discard block |
||
133 | 130 | protected function get_page_number() |
134 | 131 | { |
135 | 132 | $page = URLDecode::getPiece(2); |
136 | - if(isset($page) && is_numeric($page)) |
|
137 | - return $page; |
|
133 | + if(isset($page) && is_numeric($page)) { |
|
134 | + return $page; |
|
135 | + } |
|
138 | 136 | return 1; |
139 | 137 | } |
140 | 138 | |
@@ -153,25 +151,29 @@ discard block |
||
153 | 151 | |
154 | 152 | protected function get_list_next_link() |
155 | 153 | { |
156 | - if($this->page == 1) |
|
157 | - return; |
|
158 | - if($this->page == 2) |
|
159 | - return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
|
154 | + if($this->page == 1) { |
|
155 | + return; |
|
156 | + } |
|
157 | + if($this->page == 2) { |
|
158 | + return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
|
159 | + } |
|
160 | 160 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page - 1) . '/')->activate(); |
161 | 161 | } |
162 | 162 | |
163 | 163 | protected function get_list_prev_link() |
164 | 164 | { |
165 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
166 | - return; |
|
165 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
166 | + return; |
|
167 | + } |
|
167 | 168 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate(); |
168 | 169 | } |
169 | 170 | |
170 | 171 | private $total_post_count; |
171 | 172 | protected function get_total_post_count() |
172 | 173 | { |
173 | - if(!isset($this->total_post_count)) |
|
174 | - $this->total_post_count = PostCollector::getPostCountForCategory($this->category->link); |
|
174 | + if(!isset($this->total_post_count)) { |
|
175 | + $this->total_post_count = PostCollector::getPostCountForCategory($this->category->link); |
|
176 | + } |
|
175 | 177 | return $this->total_post_count; |
176 | 178 | } |
177 | 179 |
@@ -28,8 +28,9 @@ discard block |
||
28 | 28 | $tag = str_replace('-', ' ', $tag); |
29 | 29 | |
30 | 30 | $tag_result = TagCollector::getSingleTag($tag); |
31 | - if($tag_result === false) |
|
32 | - $this->eject(); |
|
31 | + if($tag_result === false) { |
|
32 | + $this->eject(); |
|
33 | + } |
|
33 | 34 | |
34 | 35 | $this->tag = $tag_result; |
35 | 36 | |
@@ -44,8 +45,7 @@ discard block |
||
44 | 45 | { |
45 | 46 | $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag->tag))); |
46 | 47 | $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag->tag))); |
47 | - } |
|
48 | - else |
|
48 | + } else |
|
49 | 49 | { |
50 | 50 | $this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->tag->tag), $this->page, $this->total_pages)); |
51 | 51 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->tag->tag))); |
@@ -86,8 +86,9 @@ discard block |
||
86 | 86 | protected function get_page_number() |
87 | 87 | { |
88 | 88 | $page = URLDecode::getPiece(3); |
89 | - if(isset($page) && is_numeric($page)) |
|
90 | - return $page; |
|
89 | + if(isset($page) && is_numeric($page)) { |
|
90 | + return $page; |
|
91 | + } |
|
91 | 92 | return 1; |
92 | 93 | } |
93 | 94 | |
@@ -106,25 +107,29 @@ discard block |
||
106 | 107 | |
107 | 108 | protected function get_list_next_link() |
108 | 109 | { |
109 | - if($this->page == 1) |
|
110 | - return; |
|
111 | - if($this->page == 2) |
|
112 | - return Content::instance('URLSafe', "/tag/{$this->tag->tag}/")->activate(); |
|
110 | + if($this->page == 1) { |
|
111 | + return; |
|
112 | + } |
|
113 | + if($this->page == 2) { |
|
114 | + return Content::instance('URLSafe', "/tag/{$this->tag->tag}/")->activate(); |
|
115 | + } |
|
113 | 116 | return Content::instance('URLSafe', "/tag/{$this->tag->tag}/" . ($this->page - 1) . '/')->activate(); |
114 | 117 | } |
115 | 118 | |
116 | 119 | protected function get_list_prev_link() |
117 | 120 | { |
118 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
119 | - return; |
|
121 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
122 | + return; |
|
123 | + } |
|
120 | 124 | return Content::instance('URLSafe', "/tag/{$this->tag->tag}/" . ($this->page + 1) . '/')->activate(); |
121 | 125 | } |
122 | 126 | |
123 | 127 | private $total_post_count; |
124 | 128 | protected function get_total_post_count() |
125 | 129 | { |
126 | - if(!isset($this->total_post_count)) |
|
127 | - $this->total_post_count = PostCollector::getPostCountForTag($this->tag->id); |
|
130 | + if(!isset($this->total_post_count)) { |
|
131 | + $this->total_post_count = PostCollector::getPostCountForTag($this->tag->id); |
|
132 | + } |
|
128 | 133 | return $this->total_post_count; |
129 | 134 | } |
130 | 135 |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | Loader::load('collector', 'image/PhotoCollector'); |
38 | 38 | $photo_result = PhotoCollector::getRow($id); |
39 | 39 | |
40 | - if($photo_result == null) |
|
41 | - return; |
|
40 | + if($photo_result == null) { |
|
41 | + return; |
|
42 | + } |
|
42 | 43 | |
43 | 44 | $name = $photo_result->name; |
44 | 45 | $category = $photo_result->category; |
@@ -101,8 +102,9 @@ discard block |
||
101 | 102 | { |
102 | 103 | $body = $post->body; |
103 | 104 | |
104 | - if($trim) |
|
105 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
105 | + if($trim) { |
|
106 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
107 | + } |
|
106 | 108 | |
107 | 109 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
108 | 110 | $body = Content::instance('MarkupCode', $body)->activate(); |
@@ -128,8 +130,9 @@ discard block |
||
128 | 130 | $cloud_array = array(); |
129 | 131 | foreach($tag_result as $tag) |
130 | 132 | { |
131 | - if($tag->tag_count < self::$MINIMUM_TAG_COUNT) |
|
132 | - continue; |
|
133 | + if($tag->tag_count < self::$MINIMUM_TAG_COUNT) { |
|
134 | + continue; |
|
135 | + } |
|
133 | 136 | |
134 | 137 | $tag_object = new stdclass(); |
135 | 138 | $tag_object->name = $tag->tag; |
@@ -147,8 +150,9 @@ discard block |
||
147 | 150 | |
148 | 151 | foreach($tag_result as $tag) |
149 | 152 | { |
150 | - if($tag->tag_count > $maximum) |
|
151 | - $maximum = $tag->tag_count; |
|
153 | + if($tag->tag_count > $maximum) { |
|
154 | + $maximum = $tag->tag_count; |
|
155 | + } |
|
152 | 156 | } |
153 | 157 | return $maximum; |
154 | 158 | } |