@@ -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 | } |
@@ -56,11 +56,11 @@ |
||
56 | 56 | final private function get_list_posts() |
57 | 57 | { |
58 | 58 | $post_array = array(); |
59 | - foreach($this->get_list_results() as $post) |
|
59 | + foreach ($this->get_list_results() as $post) |
|
60 | 60 | { |
61 | 61 | $post_array[] = $this->format_post($post, true); |
62 | 62 | } |
63 | - if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
63 | + if (count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
64 | 64 | $this->eject(); |
65 | 65 | return $post_array; |
66 | 66 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $active_page = $this->get_active_page(); |
42 | 42 | |
43 | 43 | $menu = array(); |
44 | - foreach(self::$MENU as $item) |
|
44 | + foreach (self::$MENU as $item) |
|
45 | 45 | { |
46 | 46 | $menu[] = (object) array( |
47 | 47 | 'name' => $item['name'], |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | { |
57 | 57 | $current_uri = URLDecode::getPiece(1); |
58 | 58 | |
59 | - if(!isset($current_uri)) |
|
59 | + if (!isset($current_uri)) |
|
60 | 60 | return 'About'; |
61 | 61 | |
62 | 62 | $menu = self::$MENU; |
63 | - foreach($menu as $link) |
|
63 | + foreach ($menu as $link) |
|
64 | 64 | { |
65 | - if($link['uri'] == $current_uri) |
|
65 | + if ($link['uri'] == $current_uri) |
|
66 | 66 | return $link['name']; |
67 | 67 | } |
68 | 68 |
@@ -29,17 +29,17 @@ |
||
29 | 29 | |
30 | 30 | private function get_form_results() |
31 | 31 | { |
32 | - if(!Request::hasPost()) |
|
32 | + if (!Request::hasPost()) |
|
33 | 33 | return array(); |
34 | 34 | |
35 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
35 | + if (!Validate::checkRequest('post', 'name', 'string')) |
|
36 | 36 | $error_message['name'] = 'Please enter a value for your name.'; |
37 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
37 | + if (!Validate::checkRequest('post', 'email', 'string')) |
|
38 | 38 | $error_message['email'] = 'Please enter a valid email address.'; |
39 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
39 | + if (!Validate::checkRequest('post', 'message', 'string')) |
|
40 | 40 | $error_message['message'] = 'Please enter a message.'; |
41 | 41 | |
42 | - if(!empty($error_message)) |
|
42 | + if (!empty($error_message)) |
|
43 | 43 | { |
44 | 44 | return array( |
45 | 45 | 'error_message' => $error_message, |
@@ -29,7 +29,7 @@ |
||
29 | 29 | Loader::load('collector', 'data/ChangelogCollector'); |
30 | 30 | $changelog_result = ChangelogCollector::getLast20Changes(); |
31 | 31 | |
32 | - foreach($changelog_result as $change) |
|
32 | + foreach ($changelog_result as $change) |
|
33 | 33 | { |
34 | 34 | $changelog[] = (object) array( |
35 | 35 | 'date' => (object) array( |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | 'name' => 'Contact', |
40 | 40 | 'link' => Loader::getRootURL() . 'contact/')); |
41 | 41 | |
42 | - if(!URLDecode::getPiece(1)) |
|
42 | + if (!URLDecode::getPiece(1)) |
|
43 | 43 | $active_page = 'About'; |
44 | 44 | else |
45 | 45 | $active_page = ucfirst(URLDecode::getPiece(1)); |
46 | 46 | |
47 | - foreach($menu as $menu_item) |
|
47 | + foreach ($menu as $menu_item) |
|
48 | 48 | { |
49 | 49 | $menu_item = (object) $menu_item; |
50 | 50 | $menu_item->active = ($menu_item->name == $active_page); |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | Loader::load('collector', 'portfolio/PortfolioCollector'); |
60 | 60 | $portfolio_result = PortfolioCollector::getPiecesForCategory($category_id); |
61 | 61 | |
62 | - foreach($portfolio_result as $piece) |
|
62 | + foreach ($portfolio_result as $piece) |
|
63 | 63 | { |
64 | 64 | $piece_obj = new stdclass(); |
65 | 65 | $piece_obj->title = $piece->title; |
66 | - if("{$piece->category}" == 1) |
|
66 | + if ("{$piece->category}" == 1) |
|
67 | 67 | $piece_obj->url = Loader::getRootURL() . "web/{$piece->title_url}/"; |
68 | 68 | else |
69 | 69 | $piece_obj->url = Loader::getRootURL() . "print/{$piece->title_url}/"; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $piece_array[] = $piece_obj; |
72 | 72 | } |
73 | 73 | |
74 | - switch($category_id) |
|
74 | + switch ($category_id) |
|
75 | 75 | { |
76 | 76 | case 1 : |
77 | 77 | $title = "Sites I've worked on"; |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | private function process_form_data() |
30 | 30 | { |
31 | - if(!Request::hasPost()) |
|
31 | + if (!Request::hasPost()) |
|
32 | 32 | return array(); |
33 | 33 | |
34 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
34 | + if (!Validate::checkRequest('post', 'name', 'string')) |
|
35 | 35 | $error_message['name'] = 'Please enter a value for your name.'; |
36 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
36 | + if (!Validate::checkRequest('post', 'email', 'string')) |
|
37 | 37 | $error_message['email'] = 'Please enter a valid email address.'; |
38 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
38 | + if (!Validate::checkRequest('post', 'message', 'string')) |
|
39 | 39 | $error_message['message'] = 'Please enter a message.'; |
40 | 40 | |
41 | - if(!empty($error_message)) |
|
41 | + if (!empty($error_message)) |
|
42 | 42 | { |
43 | 43 | return array( |
44 | 44 | 'error_message' => $error_message, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $mail->send(); |
59 | 59 | |
60 | 60 | return array( |
61 | - 'success_message' => "Thank you for your message, ".Request::getPost('name')."! I'll get back to you as soon as possible."); |
|
61 | + 'success_message' => "Thank you for your message, " . Request::getPost('name') . "! I'll get back to you as soon as possible."); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | Loader::load('collector', 'portfolio/PortfolioCollector'); |
37 | 37 | $portfolio_result = PortfolioCollector::getPieceByURI($this->title_url); |
38 | 38 | |
39 | - if($portfolio_result === null) |
|
39 | + if ($portfolio_result === null) |
|
40 | 40 | $this->eject(); |
41 | 41 | |
42 | 42 | $portfolio_image_result = PortfolioCollector::getImagesForPiece($portfolio_result->id, 2); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $main_image->width = $dimensions[0]; |
52 | 52 | $main_image->height = $dimensions[1]; |
53 | 53 | |
54 | - foreach($portfolio_image_result as $portfolio_image) |
|
54 | + foreach ($portfolio_image_result as $portfolio_image) |
|
55 | 55 | { |
56 | 56 | $thumb = $portfolio_image->name; |
57 | 57 | $thumb_array = explode('.', $thumb); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $portfolio_tag_result = PortfolioCollector::getTagsForPiece($portfolio_result->id); |
74 | 74 | |
75 | - foreach($portfolio_tag_result as $portfolio_tag) |
|
75 | + foreach ($portfolio_tag_result as $portfolio_tag) |
|
76 | 76 | { |
77 | 77 | $tag_array[] = $portfolio_tag->name; |
78 | 78 | } |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | |
27 | 27 | public function activate() |
28 | 28 | { |
29 | - if(!Request::hasPost()) |
|
29 | + if (!Request::hasPost()) |
|
30 | 30 | return false; |
31 | - if(!Request::getPost('submit') == 'Submit Comment') |
|
31 | + if (!Request::getPost('submit') == 'Submit Comment') |
|
32 | 32 | return false; |
33 | 33 | |
34 | 34 | $errors = $this->fetch_errors(); |
35 | - if(count($errors) > 0) |
|
35 | + if (count($errors) > 0) |
|
36 | 36 | return $errors; |
37 | - if(Request::getPost('catch') !== '') |
|
37 | + if (Request::getPost('catch') !== '') |
|
38 | 38 | return false; |
39 | 39 | |
40 | 40 | $page_id = $this->save_comment_page(); |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | private function fetch_errors() |
51 | 51 | { |
52 | 52 | $errors = array(); |
53 | - if(!Validate::checkRequest('post', 'name', 'name')) |
|
53 | + if (!Validate::checkRequest('post', 'name', 'name')) |
|
54 | 54 | $errors['name'] = 'You must include a valid name'; |
55 | - if(!Validate::checkRequest('post', 'email', 'email')) |
|
55 | + if (!Validate::checkRequest('post', 'email', 'email')) |
|
56 | 56 | $errors['email'] = 'You must include a valid email'; |
57 | - if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) |
|
57 | + if (Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) |
|
58 | 58 | $errors['website'] = 'Please enter a valid website'; |
59 | - if(!Validate::checkRequest('post', 'comment', 'string')) |
|
59 | + if (!Validate::checkRequest('post', 'comment', 'string')) |
|
60 | 60 | $errors['comment'] = 'You must enter a comment'; |
61 | - if(Request::getPost('notify') && Request::getPost('notify') != 'check') |
|
61 | + if (Request::getPost('notify') && Request::getPost('notify') != 'check') |
|
62 | 62 | $errors['notify'] = 'You entered an invalid notify request'; |
63 | - if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) |
|
63 | + if (Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) |
|
64 | 64 | $errors['reply'] = 'You entered an invalid reply request'; |
65 | 65 | |
66 | 66 | return $errors; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | private function save_comment_page() |
70 | 70 | { |
71 | 71 | $page_result = CommentCollector::getCommentPageByURL($this->path, $this->site); |
72 | - if($page_result !== null) |
|
72 | + if ($page_result !== null) |
|
73 | 73 | return $page_result->id; |
74 | 74 | |
75 | 75 | $query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site`, `path`) VALUES ('%d', '%s')"; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'name' => Request::getPost('name'), |
86 | 86 | 'email' => Request::getPost('email')); |
87 | 87 | |
88 | - if(Request::getPost('website') != '') |
|
88 | + if (Request::getPost('website') != '') |
|
89 | 89 | $cookie_value['website'] = Request::getPost('website'); |
90 | 90 | |
91 | 91 | $cookie_value = json_encode($cookie_value); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ->save(); |
96 | 96 | |
97 | 97 | $commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website')); |
98 | - if($commenter_result !== null) |
|
98 | + if ($commenter_result !== null) |
|
99 | 99 | return $commenter_result->id; |
100 | 100 | |
101 | 101 | $query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`) VALUES ('%s','%s','%s')"; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | private function save_comment() |
113 | 113 | { |
114 | 114 | $comment_result = CommentCollector::getCommentByBody(Request::getPost('comment')); |
115 | - if($comment_result !== null) |
|
115 | + if ($comment_result !== null) |
|
116 | 116 | return $comment_result->id; |
117 | 117 | |
118 | 118 | $query = "INSERT INTO `jpemeric_comment`.`comment` (`body`, `body_format`) VALUES ('%s', '%s')"; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter`,`comment`,`reply`,`notify`,`comment_page`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')"; |
134 | 134 | |
135 | 135 | $reply = Database::escape(Request::getPost('type')); |
136 | - if($reply == 'new') |
|
136 | + if ($reply == 'new') |
|
137 | 137 | $reply = 0; |
138 | 138 | // else check to make sure value is legit |
139 | 139 | |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | |
158 | 158 | $commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website')); |
159 | 159 | |
160 | - if($commenter_result->trusted == 1) |
|
160 | + if ($commenter_result->trusted == 1) |
|
161 | 161 | { |
162 | 162 | $notification_result = CommentCollector::getNotificationForPage($page); |
163 | 163 | |
164 | - foreach($notification_result as $notification_row) |
|
164 | + foreach ($notification_result as $notification_row) |
|
165 | 165 | { |
166 | - if($notification_row->email == Request::getPost('email')) |
|
166 | + if ($notification_row->email == Request::getPost('email')) |
|
167 | 167 | continue; |
168 | 168 | |
169 | 169 | $email_recipient_array[$notification_row->email] = array( |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $message = "Hello!\nThere has been a new comment on the page '{$this->page_title}' at Waterfalls of the Keweenaw. You have chosen to be notified of it - please reply to [email protected] if you 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 {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
181 | 181 | } |
182 | 182 | |
183 | - foreach($email_recipient_array as $email_recipient) |
|
183 | + foreach ($email_recipient_array as $email_recipient) |
|
184 | 184 | { |
185 | 185 | $mail = new Mail(); |
186 | 186 | $mail->setToAddress($email_recipient['email'], $email_recipient['name']); |