@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | private function process_form() |
| 35 | 35 | { |
| 36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
| 36 | + if (!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
| 37 | 37 | return (object) array('display' => 'normal'); |
| 38 | 38 | |
| 39 | 39 | Loader::load('utility', 'Validate'); |
| 40 | 40 | $error_result = array(); |
| 41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
| 41 | + if (!Validate::checkRequest('post', 'name', 'string')) |
|
| 42 | 42 | $error_result['name'] = 'please enter your name'; |
| 43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
| 43 | + if (!Validate::checkRequest('post', 'email', 'string')) |
|
| 44 | 44 | $error_result['email'] = 'please enter a valid email'; |
| 45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
| 45 | + if (!Validate::checkRequest('post', 'message', 'string')) |
|
| 46 | 46 | $error_result['message'] = 'please write a message'; |
| 47 | 47 | |
| 48 | 48 | $values = (object) array( |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | 'email' => Request::getPost('email'), |
| 51 | 51 | 'message' => Request::getPost('message')); |
| 52 | 52 | |
| 53 | - if(count($error_result) > 0) |
|
| 53 | + if (count($error_result) > 0) |
|
| 54 | 54 | { |
| 55 | 55 | return (object) array( |
| 56 | 56 | 'display' => 'error', |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $alias = URLDecode::getPiece(3); |
| 28 | 28 | $this->tag = LogTagCollector::getTag($alias); |
| 29 | 29 | |
| 30 | - if(!$this->tag) |
|
| 30 | + if (!$this->tag) |
|
| 31 | 31 | $this->eject(); |
| 32 | 32 | |
| 33 | 33 | parent::__construct(); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $path = URLDecode::getPiece(1); |
| 30 | 30 | $this->watercourse = WatercourseCollector::getByAlias($path); |
| 31 | 31 | |
| 32 | - if(!$this->watercourse) |
|
| 32 | + if (!$this->watercourse) |
|
| 33 | 33 | $this->eject(); |
| 34 | 34 | |
| 35 | 35 | parent::__construct(); |
@@ -20,14 +20,14 @@ 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) |
|
| 23 | + if (count($items) < 1) |
|
| 24 | 24 | $this->eject(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | final protected function get_page_number() |
| 28 | 28 | { |
| 29 | 29 | $page = $this->get_page_number_piece(); |
| 30 | - if(isset($page) && is_numeric($page)) |
|
| 30 | + if (isset($page) && is_numeric($page)) |
|
| 31 | 31 | return $page; |
| 32 | 32 | return 1; |
| 33 | 33 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | final private function get_introduction() |
| 43 | 43 | { |
| 44 | - if($this->page == 1) |
|
| 44 | + if ($this->page == 1) |
|
| 45 | 45 | return $this->get_initial_introduction(); |
| 46 | 46 | |
| 47 | 47 | return $this->get_subsequent_introduction(); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | private $items; |
| 54 | 54 | protected function get_items() |
| 55 | 55 | { |
| 56 | - if(!isset($this->items)) |
|
| 56 | + if (!isset($this->items)) |
|
| 57 | 57 | { |
| 58 | 58 | $total = $this->get_item_count_per_page(); |
| 59 | 59 | $offset = ($this->page - 1) * $this->get_item_count_per_page(); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | private $item_count; |
| 69 | 69 | final private function get_item_count() |
| 70 | 70 | { |
| 71 | - if(!isset($this->item_count)) |
|
| 71 | + if (!isset($this->item_count)) |
|
| 72 | 72 | $this->item_count = $this->get_item_count_result(); |
| 73 | 73 | return $this->item_count; |
| 74 | 74 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->set_head('next_link', $this->get_list_next_link()); |
| 83 | 83 | $this->set_head('previous_link', $this->get_list_prev_link()); |
| 84 | 84 | |
| 85 | - if($this->page == 1) |
|
| 85 | + if ($this->page == 1) |
|
| 86 | 86 | $meta_array = $this->get_initial_meta(); |
| 87 | 87 | else |
| 88 | 88 | $meta_array = $this->get_subsequent_meta(); |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | final private function get_list_prev_link() |
| 121 | 121 | { |
| 122 | - if($this->page == 1) |
|
| 122 | + if ($this->page == 1) |
|
| 123 | 123 | return; |
| 124 | - if($this->page == 2) |
|
| 124 | + if ($this->page == 2) |
|
| 125 | 125 | return $this->get_list_link_root(); |
| 126 | 126 | return $this->get_list_link_root() . ($this->page - 1) . '/'; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | final private function get_list_next_link() |
| 130 | 130 | { |
| 131 | - if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
| 131 | + if (($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
| 132 | 132 | return; |
| 133 | 133 | return $this->get_list_link_root() . ($this->page + 1) . '/'; |
| 134 | 134 | } |
@@ -139,27 +139,27 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $link_array = array(); |
| 141 | 141 | |
| 142 | - if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
| 142 | + if ($this->get_item_count_per_page() >= $this->get_item_count()) |
|
| 143 | 143 | return $link_array; |
| 144 | 144 | |
| 145 | 145 | $link = new stdclass(); |
| 146 | 146 | $link->anchor = '« previous'; |
| 147 | - if($this->get_list_prev_link() !== null) |
|
| 147 | + if ($this->get_list_prev_link() !== null) |
|
| 148 | 148 | $link->uri = $this->get_list_prev_link(); |
| 149 | 149 | else |
| 150 | 150 | $link->class = 'inactive'; |
| 151 | 151 | $link_array[] = $link; |
| 152 | 152 | |
| 153 | - for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
|
| 153 | + for ($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
|
| 154 | 154 | { |
| 155 | 155 | $link = new stdclass(); |
| 156 | 156 | $link->anchor = $i; |
| 157 | 157 | |
| 158 | - if($i == $this->page) |
|
| 158 | + if ($i == $this->page) |
|
| 159 | 159 | $link->class = 'current'; |
| 160 | 160 | else |
| 161 | 161 | { |
| 162 | - if($i == 1) |
|
| 162 | + if ($i == 1) |
|
| 163 | 163 | $link->uri = $this->get_list_link_root(); |
| 164 | 164 | else |
| 165 | 165 | $link->uri = $this->get_list_link_root() . $i . '/'; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $link = new stdclass(); |
| 172 | 172 | $link->anchor = 'next »'; |
| 173 | - if($this->get_list_next_link() !== null) |
|
| 173 | + if ($this->get_list_next_link() !== null) |
|
| 174 | 174 | $link->uri = $this->get_list_next_link(); |
| 175 | 175 | else |
| 176 | 176 | $link->class = 'inactive'; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | final protected function get_image_element($category, $path, $description, $size = 'small') |
| 194 | 194 | { |
| 195 | - switch($size) |
|
| 195 | + switch ($size) |
|
| 196 | 196 | { |
| 197 | 197 | case 'medium' : |
| 198 | 198 | $height = 375; |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $alias = URLDecode::getPiece(2); |
| 28 | 28 | $this->companion = CompanionCollector::getByAlias($alias); |
| 29 | 29 | |
| 30 | - if(!$this->companion) |
|
| 30 | + if (!$this->companion) |
|
| 31 | 31 | $this->eject(); |
| 32 | 32 | |
| 33 | 33 | parent::__construct(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | final protected function setLink($url = null) |
| 27 | 27 | { |
| 28 | - if(!isset($url)) |
|
| 28 | + if (!isset($url)) |
|
| 29 | 29 | $url = URLDecode::getBase(); |
| 30 | 30 | $this->xml->channel->addChild('link', $url); |
| 31 | 31 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | final protected function setCopyright($copyright = null) |
| 52 | 52 | { |
| 53 | - if(!isset($copyright)) |
|
| 53 | + if (!isset($copyright)) |
|
| 54 | 54 | $copyright = 'Copyright ' . date('Y') . ' Jacob Emerick'; |
| 55 | 55 | $this->xml->channel->addChild('copyright', $copyright); |
| 56 | 56 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | final protected function setPubDate($date = null) |
| 68 | 68 | { |
| 69 | - if(!isset($date)) |
|
| 69 | + if (!isset($date)) |
|
| 70 | 70 | $date = date('r'); |
| 71 | 71 | $this->xml->channel->addChild('pubDate', $date); |
| 72 | 72 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | parent::__construct(); |
| 28 | 28 | |
| 29 | 29 | $this->post = PostCollector::getPostByURI(URLDecode::getPiece(2)); |
| 30 | - if($this->post == null) |
|
| 30 | + if ($this->post == null) |
|
| 31 | 31 | $this->eject(); |
| 32 | 32 | |
| 33 | 33 | $this->handle_comment_submit( |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $keyword_array = array(); |
| 90 | 90 | $keywords = $this->tags; |
| 91 | 91 | |
| 92 | - foreach($keywords as $keyword) |
|
| 92 | + foreach ($keywords as $keyword) |
|
| 93 | 93 | { |
| 94 | 94 | $keyword_array[] = $keyword->tag; |
| 95 | 95 | } |
@@ -103,16 +103,16 @@ discard block |
||
| 103 | 103 | private function get_series_posts() |
| 104 | 104 | { |
| 105 | 105 | $series_posts = $this->fetch_series_posts(); |
| 106 | - if(count($series_posts) < 1) |
|
| 106 | + if (count($series_posts) < 1) |
|
| 107 | 107 | return array(); |
| 108 | 108 | |
| 109 | 109 | $previous_post = new stdclass(); |
| 110 | 110 | $next_post = new stdclass(); |
| 111 | 111 | |
| 112 | 112 | $found_current_post = false; |
| 113 | - foreach($series_posts as $post_row) |
|
| 113 | + foreach ($series_posts as $post_row) |
|
| 114 | 114 | { |
| 115 | - if($post_row->post == $this->post->id) |
|
| 115 | + if ($post_row->post == $this->post->id) |
|
| 116 | 116 | { |
| 117 | 117 | $found_current_post = true; |
| 118 | 118 | continue; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $post->url = Loader::getRootUrl('blog') . "{$post_row->category}/{$post_row->path}/"; |
| 134 | 134 | |
| 135 | - if(!$found_current_post) |
|
| 135 | + if (!$found_current_post) |
|
| 136 | 136 | $previous_post = $post; |
| 137 | 137 | else |
| 138 | 138 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | private $series_posts; |
| 152 | 152 | private function fetch_series_posts() |
| 153 | 153 | { |
| 154 | - if(!isset($this->series_posts)) |
|
| 154 | + if (!isset($this->series_posts)) |
|
| 155 | 155 | $this->series_posts = SeriesCollector::getSeriesForPost($this->post->id); |
| 156 | 156 | return $this->series_posts; |
| 157 | 157 | } |
@@ -159,14 +159,14 @@ discard block |
||
| 159 | 159 | private function get_related_posts() |
| 160 | 160 | { |
| 161 | 161 | $tag_array = array(); |
| 162 | - foreach($this->tags as $tag) |
|
| 162 | + foreach ($this->tags as $tag) |
|
| 163 | 163 | { |
| 164 | 164 | $tag_array[] = $tag->id; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $series_posts = $this->fetch_series_posts(); |
| 168 | 168 | $exclude_post_array = array(); |
| 169 | - foreach($series_posts as $series_post) |
|
| 169 | + foreach ($series_posts as $series_post) |
|
| 170 | 170 | { |
| 171 | 171 | $exclude_post_array[] = $series_post->post; |
| 172 | 172 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $post_array = array(); |
| 175 | 175 | $post_result = PostCollector::getRelatedPosts($this->post->id, $tag_array, $exclude_post_array); |
| 176 | 176 | |
| 177 | - foreach($post_result as $post_row) |
|
| 177 | + foreach ($post_result as $post_row) |
|
| 178 | 178 | { |
| 179 | 179 | $post = new stdclass(); |
| 180 | 180 | $post->title = $post_row->title; |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | Loader::load('collector', 'blog/IntroductionCollector'); |
| 37 | 37 | $introduction_result = IntroductionCollector::getRow('about'); |
| 38 | 38 | |
| 39 | - if($introduction_result !== null) |
|
| 39 | + if ($introduction_result !== null) |
|
| 40 | 40 | { |
| 41 | 41 | $introduction = array(); |
| 42 | 42 | $introduction['title'] = $introduction_result->title; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | parent::set_head_data(); |
| 47 | 47 | |
| 48 | - if($this->page == 1) |
|
| 48 | + if ($this->page == 1) |
|
| 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))); |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | protected function get_introduction() |
| 65 | 65 | { |
| 66 | - if($this->total_pages > 1) |
|
| 66 | + if ($this->total_pages > 1) |
|
| 67 | 67 | return array( |
| 68 | 68 | 'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}."); |
| 69 | - else if($this->total_pages == 1) |
|
| 69 | + else if ($this->total_pages == 1) |
|
| 70 | 70 | return array( |
| 71 | 71 | 'title' => "Posts from search '{$this->query}'."); |
| 72 | 72 | else |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | protected function get_page_number() |
| 78 | 78 | { |
| 79 | 79 | $page = URLDecode::getPiece(3); |
| 80 | - if(isset($page) && is_numeric($page)) |
|
| 80 | + if (isset($page) && is_numeric($page)) |
|
| 81 | 81 | return $page; |
| 82 | 82 | return 1; |
| 83 | 83 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | private $search_result; |
| 86 | 86 | private function get_search_result() |
| 87 | 87 | { |
| 88 | - if(!isset($this->search_result)) |
|
| 88 | + if (!isset($this->search_result)) |
|
| 89 | 89 | { |
| 90 | 90 | $posts = PostCollector::getMainList(self::$MAXIMUM_SEARCH_POSTS); |
| 91 | 91 | |
@@ -113,16 +113,16 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | protected function get_list_next_link() |
| 115 | 115 | { |
| 116 | - if($this->page == 1) |
|
| 116 | + if ($this->page == 1) |
|
| 117 | 117 | return; |
| 118 | - if($this->page == 2) |
|
| 118 | + if ($this->page == 2) |
|
| 119 | 119 | return Content::instance('URLSafe', "/search/{$this->query}/")->activate(); |
| 120 | 120 | return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page - 1) . '/')->activate(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | protected function get_list_prev_link() |
| 124 | 124 | { |
| 125 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 125 | + if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 126 | 126 | return; |
| 127 | 127 | return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page + 1) . '/')->activate(); |
| 128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | private $total_post_count; |
| 131 | 131 | protected function get_total_post_count() |
| 132 | 132 | { |
| 133 | - if(!isset($this->total_post_count)) |
|
| 133 | + if (!isset($this->total_post_count)) |
|
| 134 | 134 | $this->total_post_count = count($this->get_search_result()); |
| 135 | 135 | return $this->total_post_count; |
| 136 | 136 | } |