@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $handle = @fopen($configuration_path, 'r'); |
9 | 9 | if ($handle === false) { |
10 | - throw new RuntimeException("Could not load configuration"); |
|
10 | + throw new RuntimeException("Could not load configuration"); |
|
11 | 11 | } |
12 | 12 | $configuration = fread($handle, filesize($configuration_path)); |
13 | 13 | fclose($handle); |
@@ -15,34 +15,34 @@ discard block |
||
15 | 15 | $configuration = json_decode($configuration); |
16 | 16 | $last_json_error = json_last_error(); |
17 | 17 | if ($last_json_error !== JSON_ERROR_NONE) { |
18 | - throw new RuntimeException("Could not parse configuration - JSON error detected"); |
|
18 | + throw new RuntimeException("Could not parse configuration - JSON error detected"); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | // configure the db connections holder |
22 | 22 | $db_connections = new Aura\Sql\ConnectionLocator(); |
23 | 23 | $db_connections->setDefault(function () use ($configuration) { |
24 | - $connection = $configuration->database->slave; |
|
25 | - return new Aura\Sql\ExtendedPdo( |
|
26 | - "mysql:host={$connection->host}", |
|
27 | - $connection->user, |
|
28 | - $connection->password |
|
29 | - ); |
|
24 | + $connection = $configuration->database->slave; |
|
25 | + return new Aura\Sql\ExtendedPdo( |
|
26 | + "mysql:host={$connection->host}", |
|
27 | + $connection->user, |
|
28 | + $connection->password |
|
29 | + ); |
|
30 | 30 | }); |
31 | 31 | $db_connections->setWrite('master', function () use ($configuration) { |
32 | - $connection = $configuration->database->master; |
|
33 | - return new Aura\Sql\ExtendedPdo( |
|
34 | - "mysql:host={$connection->host}", |
|
35 | - $connection->user, |
|
36 | - $connection->password |
|
37 | - ); |
|
32 | + $connection = $configuration->database->master; |
|
33 | + return new Aura\Sql\ExtendedPdo( |
|
34 | + "mysql:host={$connection->host}", |
|
35 | + $connection->user, |
|
36 | + $connection->password |
|
37 | + ); |
|
38 | 38 | }); |
39 | 39 | $db_connections->setRead('slave', function () use ($configuration) { |
40 | - $connection = $configuration->database->slave; |
|
41 | - return new Aura\Sql\ExtendedPdo( |
|
42 | - "mysql:host={$connection->host}", |
|
43 | - $connection->user, |
|
44 | - $connection->password |
|
45 | - ); |
|
40 | + $connection = $configuration->database->slave; |
|
41 | + return new Aura\Sql\ExtendedPdo( |
|
42 | + "mysql:host={$connection->host}", |
|
43 | + $connection->user, |
|
44 | + $connection->password |
|
45 | + ); |
|
46 | 46 | }); |
47 | 47 | |
48 | 48 | // setup the service locator |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // configure the db connections holder |
22 | 22 | $db_connections = new Aura\Sql\ConnectionLocator(); |
23 | -$db_connections->setDefault(function () use ($configuration) { |
|
23 | +$db_connections->setDefault(function() use ($configuration) { |
|
24 | 24 | $connection = $configuration->database->slave; |
25 | 25 | return new Aura\Sql\ExtendedPdo( |
26 | 26 | "mysql:host={$connection->host}", |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $connection->password |
29 | 29 | ); |
30 | 30 | }); |
31 | -$db_connections->setWrite('master', function () use ($configuration) { |
|
31 | +$db_connections->setWrite('master', function() use ($configuration) { |
|
32 | 32 | $connection = $configuration->database->master; |
33 | 33 | return new Aura\Sql\ExtendedPdo( |
34 | 34 | "mysql:host={$connection->host}", |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $connection->password |
37 | 37 | ); |
38 | 38 | }); |
39 | -$db_connections->setRead('slave', function () use ($configuration) { |
|
39 | +$db_connections->setRead('slave', function() use ($configuration) { |
|
40 | 40 | $connection = $configuration->database->slave; |
41 | 41 | return new Aura\Sql\ExtendedPdo( |
42 | 42 | "mysql:host={$connection->host}", |
@@ -153,9 +153,9 @@ |
||
153 | 153 | return self::run_query($query); |
154 | 154 | } |
155 | 155 | |
156 | - public static function getParentWatercourse($watercourse) |
|
157 | - { |
|
158 | - } |
|
156 | + public static function getParentWatercourse($watercourse) |
|
157 | + { |
|
158 | + } |
|
159 | 159 | |
160 | 160 | public static function getLogCountForWatercourse($watercourse) |
161 | 161 | { |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | protected function set_response($message, $type = 'internal') |
30 | 30 | { |
31 | - switch($type) |
|
31 | + switch ($type) |
|
32 | 32 | { |
33 | 33 | case 'internal' : |
34 | 34 | $this->response['internal'] = $message; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | Loader::load('collector', 'SiteCollector'); |
36 | 36 | $site_result = SiteCollector::getSitesForMenu(); |
37 | 37 | |
38 | - foreach($site_result as $site) |
|
38 | + foreach ($site_result as $site) |
|
39 | 39 | { |
40 | 40 | $site_array[] = array( |
41 | 41 | 'url' => $site->url, |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | protected function addURL($loc, $lastmod = false, $changefreq = 'monthly', $priority = .5) |
24 | 24 | { |
25 | - if(!$lastmod) |
|
25 | + if (!$lastmod) |
|
26 | 26 | $lastmod = $this->default_lastmod; |
27 | 27 | |
28 | 28 | $url = $this->xml->addChild('url'); |
@@ -22,8 +22,9 @@ |
||
22 | 22 | |
23 | 23 | protected function addURL($loc, $lastmod = false, $changefreq = 'monthly', $priority = .5) |
24 | 24 | { |
25 | - if(!$lastmod) |
|
26 | - $lastmod = $this->default_lastmod; |
|
25 | + if(!$lastmod) { |
|
26 | + $lastmod = $this->default_lastmod; |
|
27 | + } |
|
27 | 28 | |
28 | 29 | $url = $this->xml->addChild('url'); |
29 | 30 |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | |
15 | 15 | protected function set_data() |
16 | 16 | { |
17 | - if(!Validate::checkRequest('post', 'name', 'name')) |
|
17 | + if (!Validate::checkRequest('post', 'name', 'name')) |
|
18 | 18 | return $this->fail_response('You must include a valid name.'); |
19 | - if(!Validate::checkRequest('post', 'email', 'email')) |
|
19 | + if (!Validate::checkRequest('post', 'email', 'email')) |
|
20 | 20 | return $this->fail_response('You must include a valid email.'); |
21 | - if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) |
|
21 | + if (Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) |
|
22 | 22 | return $this->fail_response('Please include a valid website.'); |
23 | - if(!Validate::checkRequest('post', 'comment', 'string')) |
|
23 | + if (!Validate::checkRequest('post', 'comment', 'string')) |
|
24 | 24 | return $this->fail_response('You must enter a comment.'); |
25 | - if(!Validate::checkRequest('post', 'save', 'boolean')) |
|
25 | + if (!Validate::checkRequest('post', 'save', 'boolean')) |
|
26 | 26 | return $this->fail_response('You entered an invalid save request.'); |
27 | - if(!Validate::checkRequest('post', 'notify', 'boolean')) |
|
27 | + if (!Validate::checkRequest('post', 'notify', 'boolean')) |
|
28 | 28 | return $this->fail_response('You entered an invalid notify request.'); |
29 | - if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) |
|
29 | + if (Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) |
|
30 | 30 | return $this->fail_response('You entered an invalid reply value.'); |
31 | 31 | |
32 | 32 | $referer_url = Request::getServer('HTTP_REFERER'); |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | $url = array_pop($url); |
36 | 36 | $post = PostCollector::getPostByURI($url); |
37 | 37 | |
38 | - if($post === null) |
|
38 | + if ($post === null) |
|
39 | 39 | return $this->fail_response('There seems to be a problem with this page.', 'error'); |
40 | 40 | |
41 | 41 | $commentpage_result = CommentCollector::getCommentPageByURL($post->path, 2); |
42 | - if($commentpage_result === null) |
|
42 | + if ($commentpage_result === null) |
|
43 | 43 | { |
44 | 44 | $query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site_id`, `url`) VALUES ('%d', '%s')"; |
45 | 45 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $save = (Request::getPost('save') == 'true') ? 1 : 0; |
57 | 57 | |
58 | 58 | $commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website')); |
59 | - if($commenter_result === null) |
|
59 | + if ($commenter_result === null) |
|
60 | 60 | { |
61 | 61 | $query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`,`save`) VALUES ('%s','%s','%s','%s')"; |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | else |
72 | 72 | { |
73 | - if($commenter_result->save !== $save) |
|
73 | + if ($commenter_result->save !== $save) |
|
74 | 74 | { |
75 | 75 | $query = "UPDATE `jpemeric_comment`.`commenter` SET `save` = '%s' WHERE `id` = '%d'"; |
76 | 76 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | $comment_result = CommentCollector::getCommentByBody(Request::getPost('comment')); |
84 | - if($comment_result === null) |
|
84 | + if ($comment_result === null) |
|
85 | 85 | { |
86 | 86 | $query = "INSERT INTO `jpemeric_comment`.`comment` (`body`) VALUES ('%s')"; |
87 | 87 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | |
113 | 113 | $notification_result = CommentCollector::getNotificationForPage($commentpage_id); |
114 | 114 | |
115 | - foreach($notification_result as $notification_row) |
|
115 | + foreach ($notification_result as $notification_row) |
|
116 | 116 | { |
117 | - if($notification_row->email == $email) |
|
117 | + if ($notification_row->email == $email) |
|
118 | 118 | continue; |
119 | 119 | |
120 | 120 | $email_recipient_array[$notification_row->email] = array( |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | $message = "Hello!\nThere has been a new post on the post '{$post->title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to {$config->admin_email} if you do would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$referer_url}#comments to see and reply to all the comments on this post.\nThank you!"; |
126 | - foreach($email_recipient_array as $email_recipient) |
|
126 | + foreach ($email_recipient_array as $email_recipient) |
|
127 | 127 | { |
128 | 128 | $mail = new Mail(); |
129 | 129 | $mail->setToAddress($email_recipient['email'], $email_recipient['name']); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $mail->send(); |
133 | 133 | } |
134 | 134 | |
135 | - if(Request::getPost('save') == true) |
|
135 | + if (Request::getPost('save') == true) |
|
136 | 136 | { |
137 | 137 | /* |
138 | 138 | $cookie = new Cookie('jpe_commenter'); |
@@ -14,20 +14,27 @@ discard block |
||
14 | 14 | |
15 | 15 | protected function set_data() |
16 | 16 | { |
17 | - if(!Validate::checkRequest('post', 'name', 'name')) |
|
18 | - return $this->fail_response('You must include a valid name.'); |
|
19 | - if(!Validate::checkRequest('post', 'email', 'email')) |
|
20 | - return $this->fail_response('You must include a valid email.'); |
|
21 | - if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) |
|
22 | - return $this->fail_response('Please include a valid website.'); |
|
23 | - if(!Validate::checkRequest('post', 'comment', 'string')) |
|
24 | - return $this->fail_response('You must enter a comment.'); |
|
25 | - if(!Validate::checkRequest('post', 'save', 'boolean')) |
|
26 | - return $this->fail_response('You entered an invalid save request.'); |
|
27 | - if(!Validate::checkRequest('post', 'notify', 'boolean')) |
|
28 | - return $this->fail_response('You entered an invalid notify request.'); |
|
29 | - if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) |
|
30 | - return $this->fail_response('You entered an invalid reply value.'); |
|
17 | + if(!Validate::checkRequest('post', 'name', 'name')) { |
|
18 | + return $this->fail_response('You must include a valid name.'); |
|
19 | + } |
|
20 | + if(!Validate::checkRequest('post', 'email', 'email')) { |
|
21 | + return $this->fail_response('You must include a valid email.'); |
|
22 | + } |
|
23 | + if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) { |
|
24 | + return $this->fail_response('Please include a valid website.'); |
|
25 | + } |
|
26 | + if(!Validate::checkRequest('post', 'comment', 'string')) { |
|
27 | + return $this->fail_response('You must enter a comment.'); |
|
28 | + } |
|
29 | + if(!Validate::checkRequest('post', 'save', 'boolean')) { |
|
30 | + return $this->fail_response('You entered an invalid save request.'); |
|
31 | + } |
|
32 | + if(!Validate::checkRequest('post', 'notify', 'boolean')) { |
|
33 | + return $this->fail_response('You entered an invalid notify request.'); |
|
34 | + } |
|
35 | + if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) { |
|
36 | + return $this->fail_response('You entered an invalid reply value.'); |
|
37 | + } |
|
31 | 38 | |
32 | 39 | $referer_url = Request::getServer('HTTP_REFERER'); |
33 | 40 | $url = explode('/', $referer_url); |
@@ -35,8 +42,9 @@ discard block |
||
35 | 42 | $url = array_pop($url); |
36 | 43 | $post = PostCollector::getPostByURI($url); |
37 | 44 | |
38 | - if($post === null) |
|
39 | - return $this->fail_response('There seems to be a problem with this page.', 'error'); |
|
45 | + if($post === null) { |
|
46 | + return $this->fail_response('There seems to be a problem with this page.', 'error'); |
|
47 | + } |
|
40 | 48 | |
41 | 49 | $commentpage_result = CommentCollector::getCommentPageByURL($post->path, 2); |
42 | 50 | if($commentpage_result === null) |
@@ -49,9 +57,9 @@ discard block |
||
49 | 57 | $query = sprintf($query, $site_id, $url); |
50 | 58 | Database::execute($query); |
51 | 59 | $commentpage_id = Database::lastInsertID(); |
60 | + } else { |
|
61 | + $commentpage_id = $commentpage_result->id; |
|
52 | 62 | } |
53 | - else |
|
54 | - $commentpage_id = $commentpage_result->id; |
|
55 | 63 | |
56 | 64 | $save = (Request::getPost('save') == 'true') ? 1 : 0; |
57 | 65 | |
@@ -67,8 +75,7 @@ discard block |
||
67 | 75 | $query = sprintf($query, $name, $email, $website, $save); |
68 | 76 | Database::execute($query); |
69 | 77 | $commenter_id = Database::lastInsertID(); |
70 | - } |
|
71 | - else |
|
78 | + } else |
|
72 | 79 | { |
73 | 80 | if($commenter_result->save !== $save) |
74 | 81 | { |
@@ -90,9 +97,9 @@ discard block |
||
90 | 97 | $query = sprintf($query, $body); |
91 | 98 | Database::execute($query); |
92 | 99 | $comment_id = Database::lastInsertID(); |
100 | + } else { |
|
101 | + $comment_id = $comment_result->id; |
|
93 | 102 | } |
94 | - else |
|
95 | - $comment_id = $comment_result->id; |
|
96 | 103 | |
97 | 104 | $query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter_id`,`comment_id`,`reply`,`notify`,`commentpage_id`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')"; |
98 | 105 | |
@@ -114,8 +121,9 @@ discard block |
||
114 | 121 | |
115 | 122 | foreach($notification_result as $notification_row) |
116 | 123 | { |
117 | - if($notification_row->email == $email) |
|
118 | - continue; |
|
124 | + if($notification_row->email == $email) { |
|
125 | + continue; |
|
126 | + } |
|
119 | 127 | |
120 | 128 | $email_recipient_array[$notification_row->email] = array( |
121 | 129 | 'email' => $notification_row->email, |
@@ -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; |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | { |
68 | 68 | parent::set_head_data(); |
69 | 69 | |
70 | - switch($this->category->display) |
|
70 | + switch ($this->category->display) |
|
71 | 71 | { |
72 | 72 | case 'Hiking' : |
73 | - if($this->page == 1) |
|
73 | + if ($this->page == 1) |
|
74 | 74 | { |
75 | 75 | $this->set_title(self::$TITLE_MAIN_HIKING); |
76 | 76 | $this->set_description(self::$DESCRIPTION_MAIN_HIKING); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->set_keywords(self::$KEYWORD_ARRAY_HIKING); |
84 | 84 | break; |
85 | 85 | case 'Personal' : |
86 | - if($this->page == 1) |
|
86 | + if ($this->page == 1) |
|
87 | 87 | { |
88 | 88 | $this->set_title(self::$TITLE_MAIN_PERSONAL); |
89 | 89 | $this->set_description(self::$DESCRIPTION_MAIN_PERSONAL); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->set_keywords(self::$KEYWORD_ARRAY_PERSONAL); |
97 | 97 | break; |
98 | 98 | case 'Web Development' : |
99 | - if($this->page == 1) |
|
99 | + if ($this->page == 1) |
|
100 | 100 | { |
101 | 101 | $this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT); |
102 | 102 | $this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | protected function get_introduction() |
115 | 115 | { |
116 | - if($this->page == 1) |
|
116 | + if ($this->page == 1) |
|
117 | 117 | { |
118 | 118 | Loader::load('collector', 'blog/IntroductionCollector'); |
119 | 119 | $introduction_result = IntroductionCollector::getRow('category', $this->category->link); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | protected function get_page_number() |
134 | 134 | { |
135 | 135 | $page = URLDecode::getPiece(2); |
136 | - if(isset($page) && is_numeric($page)) |
|
136 | + if (isset($page) && is_numeric($page)) |
|
137 | 137 | return $page; |
138 | 138 | return 1; |
139 | 139 | } |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | |
154 | 154 | protected function get_list_next_link() |
155 | 155 | { |
156 | - if($this->page == 1) |
|
156 | + if ($this->page == 1) |
|
157 | 157 | return; |
158 | - if($this->page == 2) |
|
158 | + if ($this->page == 2) |
|
159 | 159 | return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
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()) |
|
165 | + if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
166 | 166 | return; |
167 | 167 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate(); |
168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | private $total_post_count; |
171 | 171 | protected function get_total_post_count() |
172 | 172 | { |
173 | - if(!isset($this->total_post_count)) |
|
173 | + if (!isset($this->total_post_count)) |
|
174 | 174 | $this->total_post_count = PostCollector::getPostCountForCategory($this->category->link); |
175 | 175 | return $this->total_post_count; |
176 | 176 | } |
@@ -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 |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | { |
33 | 33 | parent::set_head_data(); |
34 | 34 | |
35 | - if($this->page == 1) |
|
35 | + if ($this->page == 1) |
|
36 | 36 | $this->set_title(self::$TITLE_MAIN); |
37 | 37 | else |
38 | 38 | $this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages)); |
39 | 39 | |
40 | - if($this->page == 1) |
|
40 | + if ($this->page == 1) |
|
41 | 41 | $this->set_description(self::$DESCRIPTION_MAIN); |
42 | 42 | else |
43 | 43 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages)); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | protected function get_introduction() |
49 | 49 | { |
50 | - if($this->page == 1) |
|
50 | + if ($this->page == 1) |
|
51 | 51 | { |
52 | 52 | Loader::load('collector', 'blog/IntroductionCollector'); |
53 | 53 | $introduction_result = IntroductionCollector::getRow('home'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | protected function get_page_number() |
68 | 68 | { |
69 | 69 | $page = URLDecode::getPiece(1); |
70 | - if(isset($page) && is_numeric($page)) |
|
70 | + if (isset($page) && is_numeric($page)) |
|
71 | 71 | return $page; |
72 | 72 | return 1; |
73 | 73 | } |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | |
88 | 88 | protected function get_list_next_link() |
89 | 89 | { |
90 | - if($this->page == 1) |
|
90 | + if ($this->page == 1) |
|
91 | 91 | return; |
92 | - if($this->page == 2) |
|
92 | + if ($this->page == 2) |
|
93 | 93 | return '/'; |
94 | 94 | return '/' . ($this->page - 1) . '/'; |
95 | 95 | } |
96 | 96 | |
97 | 97 | protected function get_list_prev_link() |
98 | 98 | { |
99 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
99 | + if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
100 | 100 | return; |
101 | 101 | return '/' . ($this->page + 1) . '/'; |
102 | 102 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | private $total_post_count; |
105 | 105 | protected function get_total_post_count() |
106 | 106 | { |
107 | - if(!isset($this->total_post_count)) |
|
107 | + if (!isset($this->total_post_count)) |
|
108 | 108 | $this->total_post_count = PostCollector::getMainPostCount(); |
109 | 109 | return $this->total_post_count; |
110 | 110 | } |
@@ -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 | } |
@@ -67,8 +69,9 @@ discard block |
||
67 | 69 | protected function get_page_number() |
68 | 70 | { |
69 | 71 | $page = URLDecode::getPiece(1); |
70 | - if(isset($page) && is_numeric($page)) |
|
71 | - return $page; |
|
72 | + if(isset($page) && is_numeric($page)) { |
|
73 | + return $page; |
|
74 | + } |
|
72 | 75 | return 1; |
73 | 76 | } |
74 | 77 | |
@@ -87,25 +90,29 @@ discard block |
||
87 | 90 | |
88 | 91 | protected function get_list_next_link() |
89 | 92 | { |
90 | - if($this->page == 1) |
|
91 | - return; |
|
92 | - if($this->page == 2) |
|
93 | - return '/'; |
|
93 | + if($this->page == 1) { |
|
94 | + return; |
|
95 | + } |
|
96 | + if($this->page == 2) { |
|
97 | + return '/'; |
|
98 | + } |
|
94 | 99 | return '/' . ($this->page - 1) . '/'; |
95 | 100 | } |
96 | 101 | |
97 | 102 | protected function get_list_prev_link() |
98 | 103 | { |
99 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
100 | - return; |
|
104 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
105 | + return; |
|
106 | + } |
|
101 | 107 | return '/' . ($this->page + 1) . '/'; |
102 | 108 | } |
103 | 109 | |
104 | 110 | private $total_post_count; |
105 | 111 | protected function get_total_post_count() |
106 | 112 | { |
107 | - if(!isset($this->total_post_count)) |
|
108 | - $this->total_post_count = PostCollector::getMainPostCount(); |
|
113 | + if(!isset($this->total_post_count)) { |
|
114 | + $this->total_post_count = PostCollector::getMainPostCount(); |
|
115 | + } |
|
109 | 116 | return $this->total_post_count; |
110 | 117 | } |
111 | 118 |