@@ -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"; |
@@ -39,10 +39,11 @@ discard block |
||
39 | 39 | 'name' => 'Contact', |
40 | 40 | 'link' => Loader::getRootURL() . 'contact/')); |
41 | 41 | |
42 | - if(!URLDecode::getPiece(1)) |
|
43 | - $active_page = 'About'; |
|
44 | - else |
|
45 | - $active_page = ucfirst(URLDecode::getPiece(1)); |
|
42 | + if(!URLDecode::getPiece(1)) { |
|
43 | + $active_page = 'About'; |
|
44 | + } else { |
|
45 | + $active_page = ucfirst(URLDecode::getPiece(1)); |
|
46 | + } |
|
46 | 47 | |
47 | 48 | foreach($menu as $menu_item) |
48 | 49 | { |
@@ -63,10 +64,11 @@ discard block |
||
63 | 64 | { |
64 | 65 | $piece_obj = new stdclass(); |
65 | 66 | $piece_obj->title = $piece->title; |
66 | - if("{$piece->category}" == 1) |
|
67 | - $piece_obj->url = Loader::getRootURL() . "web/{$piece->title_url}/"; |
|
68 | - else |
|
69 | - $piece_obj->url = Loader::getRootURL() . "print/{$piece->title_url}/"; |
|
67 | + if("{$piece->category}" == 1) { |
|
68 | + $piece_obj->url = Loader::getRootURL() . "web/{$piece->title_url}/"; |
|
69 | + } else { |
|
70 | + $piece_obj->url = Loader::getRootURL() . "print/{$piece->title_url}/"; |
|
71 | + } |
|
70 | 72 | $piece_obj->image = "/{$piece->image}"; |
71 | 73 | $piece_array[] = $piece_obj; |
72 | 74 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | else |
49 | 49 | { |
50 | - global $config; |
|
50 | + global $config; |
|
51 | 51 | $mail = new Mail(); |
52 | 52 | $mail->setToAddress($config->admin_email, 'Jacob Emerick'); |
53 | 53 | $mail->setSubject('Portfolio Contact'); |
@@ -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 |
@@ -28,24 +28,26 @@ |
||
28 | 28 | |
29 | 29 | private function process_form_data() |
30 | 30 | { |
31 | - if(!Request::hasPost()) |
|
32 | - return array(); |
|
31 | + if(!Request::hasPost()) { |
|
32 | + return array(); |
|
33 | + } |
|
33 | 34 | |
34 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
35 | - $error_message['name'] = 'Please enter a value for your name.'; |
|
36 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
37 | - $error_message['email'] = 'Please enter a valid email address.'; |
|
38 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
39 | - $error_message['message'] = 'Please enter a message.'; |
|
35 | + if(!Validate::checkRequest('post', 'name', 'string')) { |
|
36 | + $error_message['name'] = 'Please enter a value for your name.'; |
|
37 | + } |
|
38 | + if(!Validate::checkRequest('post', 'email', 'string')) { |
|
39 | + $error_message['email'] = 'Please enter a valid email address.'; |
|
40 | + } |
|
41 | + if(!Validate::checkRequest('post', 'message', 'string')) { |
|
42 | + $error_message['message'] = 'Please enter a message.'; |
|
43 | + } |
|
40 | 44 | |
41 | 45 | if(!empty($error_message)) |
42 | 46 | { |
43 | 47 | return array( |
44 | 48 | 'error_message' => $error_message, |
45 | 49 | 'value' => Request::getPost()); |
46 | - } |
|
47 | - |
|
48 | - else |
|
50 | + } else |
|
49 | 51 | { |
50 | 52 | global $config; |
51 | 53 | $mail = new Mail(); |
@@ -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 | } |
@@ -36,8 +36,9 @@ |
||
36 | 36 | Loader::load('collector', 'portfolio/PortfolioCollector'); |
37 | 37 | $portfolio_result = PortfolioCollector::getPieceByURI($this->title_url); |
38 | 38 | |
39 | - if($portfolio_result === null) |
|
40 | - $this->eject(); |
|
39 | + if($portfolio_result === null) { |
|
40 | + $this->eject(); |
|
41 | + } |
|
41 | 42 | |
42 | 43 | $portfolio_image_result = PortfolioCollector::getImagesForPiece($portfolio_result->id, 2); |
43 | 44 | $image = new ImageOld("portfolio/{$portfolio_image_result[0]->name}"); |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | $portfolio_image_result = PortfolioCollector::getImagesForPiece($portfolio_result->id, 2); |
42 | 42 | |
43 | - $image_path = "portfolio/{$portfolio_image_result[0]->name}"; |
|
44 | - $image_path = Loader::getImagePath('image', $image_path); |
|
45 | - $image_size = getimagesize($image_path); |
|
43 | + $image_path = "portfolio/{$portfolio_image_result[0]->name}"; |
|
44 | + $image_path = Loader::getImagePath('image', $image_path); |
|
45 | + $image_size = getimagesize($image_path); |
|
46 | 46 | |
47 | 47 | $main_image = new stdclass(); |
48 | 48 | $main_image->id = $portfolio_image_result[0]->id; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | $thumb_array = explode('.', $thumb); |
58 | 58 | $thumb = "{$thumb_array[0]}_clip.{$thumb_array[1]}"; |
59 | 59 | |
60 | - $image_path = "portfolio/{$thumb}"; |
|
61 | - $image_path = Loader::getImagePath('image', $image_path); |
|
62 | - $image_size = getimagesize($image_path); |
|
60 | + $image_path = "portfolio/{$thumb}"; |
|
61 | + $image_path = Loader::getImagePath('image', $image_path); |
|
62 | + $image_size = getimagesize($image_path); |
|
63 | 63 | |
64 | 64 | $image_obj = new stdclass(); |
65 | 65 | $image_obj->id = $portfolio_image->id; |
@@ -172,24 +172,24 @@ |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - $site = URLDecode::getSite(); |
|
175 | + $site = URLDecode::getSite(); |
|
176 | 176 | |
177 | - if ($site == 'blog') { |
|
178 | - $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. 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!"; |
|
179 | - } else if ($site == 'waterfalls') { |
|
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 | - } |
|
177 | + if ($site == 'blog') { |
|
178 | + $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. 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!"; |
|
179 | + } else if ($site == 'waterfalls') { |
|
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 | + } |
|
182 | 182 | |
183 | 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']); |
187 | 187 | |
188 | - if ($site == 'blog') { |
|
189 | - $mail->setSubject("New Comment on Jacob Emerick's Blog"); |
|
190 | - } else if ($site == 'waterfalls') { |
|
191 | - $mail->setSubject("New Comment on Waterfalls of the Keweenaw"); |
|
192 | - } |
|
188 | + if ($site == 'blog') { |
|
189 | + $mail->setSubject("New Comment on Jacob Emerick's Blog"); |
|
190 | + } else if ($site == 'waterfalls') { |
|
191 | + $mail->setSubject("New Comment on Waterfalls of the Keweenaw"); |
|
192 | + } |
|
193 | 193 | |
194 | 194 | $mail->setMessage($message); |
195 | 195 | $mail->send(); |
@@ -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']); |
@@ -26,16 +26,20 @@ discard block |
||
26 | 26 | |
27 | 27 | public function activate() |
28 | 28 | { |
29 | - if(!Request::hasPost()) |
|
30 | - return false; |
|
31 | - if(!Request::getPost('submit') == 'Submit Comment') |
|
32 | - return false; |
|
29 | + if(!Request::hasPost()) { |
|
30 | + return false; |
|
31 | + } |
|
32 | + if(!Request::getPost('submit') == 'Submit Comment') { |
|
33 | + return false; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | $errors = $this->fetch_errors(); |
35 | - if(count($errors) > 0) |
|
36 | - return $errors; |
|
37 | - if(Request::getPost('catch') !== '') |
|
38 | - return false; |
|
37 | + if(count($errors) > 0) { |
|
38 | + return $errors; |
|
39 | + } |
|
40 | + if(Request::getPost('catch') !== '') { |
|
41 | + return false; |
|
42 | + } |
|
39 | 43 | |
40 | 44 | $page_id = $this->save_comment_page(); |
41 | 45 | $commenter_id = $this->save_commenter(); |
@@ -50,18 +54,24 @@ discard block |
||
50 | 54 | private function fetch_errors() |
51 | 55 | { |
52 | 56 | $errors = array(); |
53 | - if(!Validate::checkRequest('post', 'name', 'name')) |
|
54 | - $errors['name'] = 'You must include a valid name'; |
|
55 | - if(!Validate::checkRequest('post', 'email', 'email')) |
|
56 | - $errors['email'] = 'You must include a valid email'; |
|
57 | - if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) |
|
58 | - $errors['website'] = 'Please enter a valid website'; |
|
59 | - if(!Validate::checkRequest('post', 'comment', 'string')) |
|
60 | - $errors['comment'] = 'You must enter a comment'; |
|
61 | - if(Request::getPost('notify') && Request::getPost('notify') != 'check') |
|
62 | - $errors['notify'] = 'You entered an invalid notify request'; |
|
63 | - if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) |
|
64 | - $errors['reply'] = 'You entered an invalid reply request'; |
|
57 | + if(!Validate::checkRequest('post', 'name', 'name')) { |
|
58 | + $errors['name'] = 'You must include a valid name'; |
|
59 | + } |
|
60 | + if(!Validate::checkRequest('post', 'email', 'email')) { |
|
61 | + $errors['email'] = 'You must include a valid email'; |
|
62 | + } |
|
63 | + if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) { |
|
64 | + $errors['website'] = 'Please enter a valid website'; |
|
65 | + } |
|
66 | + if(!Validate::checkRequest('post', 'comment', 'string')) { |
|
67 | + $errors['comment'] = 'You must enter a comment'; |
|
68 | + } |
|
69 | + if(Request::getPost('notify') && Request::getPost('notify') != 'check') { |
|
70 | + $errors['notify'] = 'You entered an invalid notify request'; |
|
71 | + } |
|
72 | + if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) { |
|
73 | + $errors['reply'] = 'You entered an invalid reply request'; |
|
74 | + } |
|
65 | 75 | |
66 | 76 | return $errors; |
67 | 77 | } |
@@ -69,8 +79,9 @@ discard block |
||
69 | 79 | private function save_comment_page() |
70 | 80 | { |
71 | 81 | $page_result = CommentCollector::getCommentPageByURL($this->path, $this->site); |
72 | - if($page_result !== null) |
|
73 | - return $page_result->id; |
|
82 | + if($page_result !== null) { |
|
83 | + return $page_result->id; |
|
84 | + } |
|
74 | 85 | |
75 | 86 | $query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site`, `path`) VALUES ('%d', '%s')"; |
76 | 87 | $query = sprintf($query, $this->site, $this->path); |
@@ -85,8 +96,9 @@ discard block |
||
85 | 96 | 'name' => Request::getPost('name'), |
86 | 97 | 'email' => Request::getPost('email')); |
87 | 98 | |
88 | - if(Request::getPost('website') != '') |
|
89 | - $cookie_value['website'] = Request::getPost('website'); |
|
99 | + if(Request::getPost('website') != '') { |
|
100 | + $cookie_value['website'] = Request::getPost('website'); |
|
101 | + } |
|
90 | 102 | |
91 | 103 | $cookie_value = json_encode($cookie_value); |
92 | 104 | |
@@ -95,8 +107,9 @@ discard block |
||
95 | 107 | ->save(); |
96 | 108 | |
97 | 109 | $commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website')); |
98 | - if($commenter_result !== null) |
|
99 | - return $commenter_result->id; |
|
110 | + if($commenter_result !== null) { |
|
111 | + return $commenter_result->id; |
|
112 | + } |
|
100 | 113 | |
101 | 114 | $query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`) VALUES ('%s','%s','%s')"; |
102 | 115 | |
@@ -112,8 +125,9 @@ discard block |
||
112 | 125 | private function save_comment() |
113 | 126 | { |
114 | 127 | $comment_result = CommentCollector::getCommentByBody(Request::getPost('comment')); |
115 | - if($comment_result !== null) |
|
116 | - return $comment_result->id; |
|
128 | + if($comment_result !== null) { |
|
129 | + return $comment_result->id; |
|
130 | + } |
|
117 | 131 | |
118 | 132 | $query = "INSERT INTO `jpemeric_comment`.`comment` (`body`, `body_format`) VALUES ('%s', '%s')"; |
119 | 133 | |
@@ -133,8 +147,9 @@ discard block |
||
133 | 147 | $query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter`,`comment`,`reply`,`notify`,`comment_page`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')"; |
134 | 148 | |
135 | 149 | $reply = Database::escape(Request::getPost('type')); |
136 | - if($reply == 'new') |
|
137 | - $reply = 0; |
|
150 | + if($reply == 'new') { |
|
151 | + $reply = 0; |
|
152 | + } |
|
138 | 153 | // else check to make sure value is legit |
139 | 154 | |
140 | 155 | $notify = (Request::getPost('notify') == 'check') ? 1 : 0; |
@@ -163,8 +178,9 @@ discard block |
||
163 | 178 | |
164 | 179 | foreach($notification_result as $notification_row) |
165 | 180 | { |
166 | - if($notification_row->email == Request::getPost('email')) |
|
167 | - continue; |
|
181 | + if($notification_row->email == Request::getPost('email')) { |
|
182 | + continue; |
|
183 | + } |
|
168 | 184 | |
169 | 185 | $email_recipient_array[$notification_row->email] = array( |
170 | 186 | 'email' => $notification_row->email, |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | |
17 | 17 | private function __construct($write_params, $read_params) |
18 | 18 | { |
19 | - $this->write_connection = $this->connect( |
|
20 | - $write_params->host, |
|
21 | - $write_params->user, |
|
22 | - $write_params->password |
|
23 | - ); |
|
24 | - |
|
25 | - $this->read_connection = $this->connect( |
|
26 | - $read_params->host, |
|
27 | - $read_params->user, |
|
28 | - $read_params->password |
|
29 | - ); |
|
19 | + $this->write_connection = $this->connect( |
|
20 | + $write_params->host, |
|
21 | + $write_params->user, |
|
22 | + $write_params->password |
|
23 | + ); |
|
24 | + |
|
25 | + $this->read_connection = $this->connect( |
|
26 | + $read_params->host, |
|
27 | + $read_params->user, |
|
28 | + $read_params->password |
|
29 | + ); |
|
30 | 30 | |
31 | 31 | return $this; |
32 | 32 | } |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | public static function instance() |
46 | 46 | { |
47 | 47 | if(!isset(self::$instance)) { |
48 | - global $config; |
|
49 | - self::$instance = new Database( |
|
50 | - $config->database->master, |
|
51 | - $config->database->slave |
|
52 | - ); |
|
53 | - } |
|
48 | + global $config; |
|
49 | + self::$instance = new Database( |
|
50 | + $config->database->master, |
|
51 | + $config->database->slave |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | return self::$instance; |
56 | 56 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $mysqli = new mysqli($host, $username, $password); |
37 | 37 | |
38 | 38 | $has_connection_error = $mysqli->connect_error; |
39 | - if(isset($has_connection_error)) |
|
39 | + if (isset($has_connection_error)) |
|
40 | 40 | $this->has_connection_error = true; |
41 | 41 | |
42 | 42 | return $mysqli; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public static function instance() |
46 | 46 | { |
47 | - if(!isset(self::$instance)) { |
|
47 | + if (!isset(self::$instance)) { |
|
48 | 48 | global $config; |
49 | 49 | self::$instance = new Database( |
50 | 50 | $config->database->master, |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | public static function select($query) |
64 | 64 | { |
65 | 65 | $start = microtime(true); |
66 | - if($result = self::instance()->read_connection->query($query)) |
|
66 | + if ($result = self::instance()->read_connection->query($query)) |
|
67 | 67 | { |
68 | 68 | self::instance()->log_query($query, $start); |
69 | 69 | $array = array(); |
70 | - while($row = $result->fetch_object()) |
|
70 | + while ($row = $result->fetch_object()) |
|
71 | 71 | $array[] = $row; |
72 | 72 | $result->close(); |
73 | 73 | return $array; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public static function selectRow($query) |
80 | 80 | { |
81 | 81 | $result = self::select($query); |
82 | - if(is_array($result)) |
|
82 | + if (is_array($result)) |
|
83 | 83 | return array_pop($result); |
84 | 84 | return false; |
85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public static function execute($query) |
88 | 88 | { |
89 | 89 | $start = microtime(true); |
90 | - if(self::instance()->write_connection->query($query)) |
|
90 | + if (self::instance()->write_connection->query($query)) |
|
91 | 91 | { |
92 | 92 | self::instance()->log_query($query, $start); |
93 | 93 | return true; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public static function lastInsertID() |
100 | 100 | { |
101 | 101 | $id = self::instance()->write_connection->insert_id; |
102 | - if($id == 0) |
|
102 | + if ($id == 0) |
|
103 | 103 | return false; |
104 | 104 | return $id; |
105 | 105 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | private function gather_query_data() |
120 | 120 | { |
121 | 121 | $query_data = array(); |
122 | - foreach($this->query_log as $query) |
|
122 | + foreach ($this->query_log as $query) |
|
123 | 123 | { |
124 | 124 | $query = self::explain($query); |
125 | 125 | $query_data[] = $query; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | $sql = 'EXPLAIN ' . $query['sql']; |
133 | 133 | |
134 | - if($result = self::instance()->read_connection->query($sql)) |
|
134 | + if ($result = self::instance()->read_connection->query($sql)) |
|
135 | 135 | { |
136 | 136 | $row = $result->fetch_assoc(); |
137 | 137 | $query['explain'] = $row; |
@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | $mysqli = new mysqli($host, $username, $password); |
37 | 37 | |
38 | 38 | $has_connection_error = $mysqli->connect_error; |
39 | - if(isset($has_connection_error)) |
|
40 | - $this->has_connection_error = true; |
|
39 | + if(isset($has_connection_error)) { |
|
40 | + $this->has_connection_error = true; |
|
41 | + } |
|
41 | 42 | |
42 | 43 | return $mysqli; |
43 | 44 | } |
@@ -67,8 +68,9 @@ discard block |
||
67 | 68 | { |
68 | 69 | self::instance()->log_query($query, $start); |
69 | 70 | $array = array(); |
70 | - while($row = $result->fetch_object()) |
|
71 | - $array[] = $row; |
|
71 | + while($row = $result->fetch_object()) { |
|
72 | + $array[] = $row; |
|
73 | + } |
|
72 | 74 | $result->close(); |
73 | 75 | return $array; |
74 | 76 | } |
@@ -79,8 +81,9 @@ discard block |
||
79 | 81 | public static function selectRow($query) |
80 | 82 | { |
81 | 83 | $result = self::select($query); |
82 | - if(is_array($result)) |
|
83 | - return array_pop($result); |
|
84 | + if(is_array($result)) { |
|
85 | + return array_pop($result); |
|
86 | + } |
|
84 | 87 | return false; |
85 | 88 | } |
86 | 89 | |
@@ -99,8 +102,9 @@ discard block |
||
99 | 102 | public static function lastInsertID() |
100 | 103 | { |
101 | 104 | $id = self::instance()->write_connection->insert_id; |
102 | - if($id == 0) |
|
103 | - return false; |
|
105 | + if($id == 0) { |
|
106 | + return false; |
|
107 | + } |
|
104 | 108 | return $id; |
105 | 109 | } |
106 | 110 |
@@ -84,6 +84,9 @@ |
||
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | |
87 | + /** |
|
88 | + * @param string $query |
|
89 | + */ |
|
87 | 90 | public static function execute($query) |
88 | 91 | { |
89 | 92 | $start = microtime(true); |
@@ -22,10 +22,10 @@ |
||
22 | 22 | |
23 | 23 | protected function getDomain() |
24 | 24 | { |
25 | - $site = URLDecode::getSite(); |
|
26 | - if ($site == 'waterfalls' && Loader::isLive()) { |
|
27 | - return 'waterfallsofthekeweenaw.com'; |
|
28 | - } |
|
25 | + $site = URLDecode::getSite(); |
|
26 | + if ($site == 'waterfalls' && Loader::isLive()) { |
|
27 | + return 'waterfallsofthekeweenaw.com'; |
|
28 | + } |
|
29 | 29 | return self::$COOKIE_DOMAIN; |
30 | 30 | } |
31 | 31 |
@@ -6,8 +6,8 @@ |
||
6 | 6 | { |
7 | 7 | |
8 | 8 | private static $COOKIE_NAME = 'commenter'; |
9 | - private static $COOKIE_DURATION = 31536000; // one year |
|
10 | - private static $COOKIE_DOMAIN = 'jacobemerick.com'; |
|
9 | + private static $COOKIE_DURATION = 31536000; // one year |
|
10 | + private static $COOKIE_DOMAIN = 'jacobemerick.com'; |
|
11 | 11 | private static $COOKIE_PATH = '/'; |
12 | 12 | |
13 | 13 | protected function getName() |
@@ -179,16 +179,16 @@ |
||
179 | 179 | return self::instance()->is_live; |
180 | 180 | } |
181 | 181 | |
182 | - public static function getRootURL($site = '') |
|
183 | - { |
|
184 | - if (strlen($site) > 0) { |
|
185 | - if ($site == 'waterfalls' && self::instance()->is_live) { |
|
186 | - return 'http://www.waterfallsofthekeweenaw.com/'; |
|
187 | - } else { |
|
188 | - return 'http://' . (self::instance()->is_live ? '' : 'dev.') . $site . '.jacobemerick.com/'; |
|
189 | - } |
|
190 | - } |
|
191 | - return '/'; |
|
192 | - } |
|
182 | + public static function getRootURL($site = '') |
|
183 | + { |
|
184 | + if (strlen($site) > 0) { |
|
185 | + if ($site == 'waterfalls' && self::instance()->is_live) { |
|
186 | + return 'http://www.waterfallsofthekeweenaw.com/'; |
|
187 | + } else { |
|
188 | + return 'http://' . (self::instance()->is_live ? '' : 'dev.') . $site . '.jacobemerick.com/'; |
|
189 | + } |
|
190 | + } |
|
191 | + return '/'; |
|
192 | + } |
|
193 | 193 | |
194 | 194 | } |
@@ -59,6 +59,9 @@ discard block |
||
59 | 59 | $this->add_posts($youtube_result, 'youtube'); |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $type |
|
64 | + */ |
|
62 | 65 | private function remove_existing($result, $type) |
63 | 66 | { |
64 | 67 | foreach($result as $key => $row) |
@@ -70,6 +73,9 @@ discard block |
||
70 | 73 | return $result; |
71 | 74 | } |
72 | 75 | |
76 | + /** |
|
77 | + * @param string $type |
|
78 | + */ |
|
73 | 79 | private function add_posts($result, $type) |
74 | 80 | { |
75 | 81 | foreach($result as $row) |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function instance() |
19 | 19 | { |
20 | - if(!isset(self::$instance)) |
|
20 | + if (!isset(self::$instance)) |
|
21 | 21 | self::$instance = new Loader(); |
22 | 22 | return self::$instance; |
23 | 23 | } |
24 | 24 | |
25 | 25 | private function get_root() |
26 | 26 | { |
27 | - if(!isset($this->root)) |
|
27 | + if (!isset($this->root)) |
|
28 | 28 | { |
29 | 29 | $current_directory = dirname(__FILE__); |
30 | 30 | $current_directory = substr($current_directory, 0, -7); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | private static function get_extension($type) |
54 | 54 | { |
55 | - switch($type) |
|
55 | + switch ($type) |
|
56 | 56 | { |
57 | 57 | case 'collector' : |
58 | 58 | case 'controller' : |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | |
105 | 105 | public static function load($type, $files, $data = array()) |
106 | 106 | { |
107 | - foreach((array) $files as $file) |
|
107 | + foreach ((array) $files as $file) |
|
108 | 108 | { |
109 | 109 | $file_path = self::instance()->get_path($type, $file); |
110 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
110 | + if (in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
111 | 111 | continue; |
112 | 112 | |
113 | 113 | // if(!file_exists($file_path)) |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | self::instance()->add_included_file($file_path); |
117 | 117 | |
118 | - switch($type) |
|
118 | + switch ($type) |
|
119 | 119 | { |
120 | 120 | case 'images' : |
121 | 121 | case 'scripts' : |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $reflectionObject = self::create_reflection_class($file); |
147 | 147 | |
148 | - if( |
|
148 | + if ( |
|
149 | 149 | $reflectionObject->hasMethod('instance') && |
150 | 150 | $reflectionObject->getMethod('instance')->isStatic()) |
151 | 151 | { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | $reflectionObject = self::create_reflection_class($file); |
162 | 162 | |
163 | - if($reflectionObject->hasMethod('__construct')) |
|
163 | + if ($reflectionObject->hasMethod('__construct')) |
|
164 | 164 | return $reflectionObject->newInstanceArgs($data); |
165 | 165 | else |
166 | 166 | return $reflectionObject->newInstance(); |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function instance() |
19 | 19 | { |
20 | - if(!isset(self::$instance)) |
|
21 | - self::$instance = new Loader(); |
|
20 | + if(!isset(self::$instance)) { |
|
21 | + self::$instance = new Loader(); |
|
22 | + } |
|
22 | 23 | return self::$instance; |
23 | 24 | } |
24 | 25 | |
@@ -107,8 +108,9 @@ discard block |
||
107 | 108 | foreach((array) $files as $file) |
108 | 109 | { |
109 | 110 | $file_path = self::instance()->get_path($type, $file); |
110 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
111 | - continue; |
|
111 | + if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') { |
|
112 | + continue; |
|
113 | + } |
|
112 | 114 | |
113 | 115 | // if(!file_exists($file_path)) |
114 | 116 | // Debugger::logMessage("Requested file does not exist: {$type}, {$file}"); |
@@ -160,10 +162,11 @@ discard block |
||
160 | 162 | |
161 | 163 | $reflectionObject = self::create_reflection_class($file); |
162 | 164 | |
163 | - if($reflectionObject->hasMethod('__construct')) |
|
164 | - return $reflectionObject->newInstanceArgs($data); |
|
165 | - else |
|
166 | - return $reflectionObject->newInstance(); |
|
165 | + if($reflectionObject->hasMethod('__construct')) { |
|
166 | + return $reflectionObject->newInstanceArgs($data); |
|
167 | + } else { |
|
168 | + return $reflectionObject->newInstance(); |
|
169 | + } |
|
167 | 170 | } |
168 | 171 | |
169 | 172 | public static function getRoot() |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | static private function form_url_array($host, $uri) |
16 | 16 | { |
17 | 17 | $uri = substr($uri, 1); |
18 | - if(strpos($uri, '?')) |
|
18 | + if (strpos($uri, '?')) |
|
19 | 19 | $uri = substr($uri, 0, strpos($uri, '?')); |
20 | 20 | $uri_array = explode('/', $uri); |
21 | 21 | |
22 | - if(!Loader::isLive()) |
|
22 | + if (!Loader::isLive()) |
|
23 | 23 | $host = substr($host, strpos($host, '.') + 1); |
24 | 24 | |
25 | 25 | self::$array['host'] = $host; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/'; |
34 | 34 | self::$array['uri'] = '/' . implode('/', $uri_array); |
35 | 35 | |
36 | - if(end($uri_array) == '') |
|
36 | + if (end($uri_array) == '') |
|
37 | 37 | $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
38 | 38 | self::$array['pieces'] = (array) $uri_array; |
39 | 39 | } |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | static function getExtension() |
62 | 62 | { |
63 | 63 | $file = self::getPiece(-1); |
64 | - if(substr($file, -1) == '/') |
|
64 | + if (substr($file, -1) == '/') |
|
65 | 65 | return false; |
66 | - return substr($file, strrpos($file, '.') + 1);; |
|
66 | + return substr($file, strrpos($file, '.') + 1); ; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | static function getPiece($piece = null) |
70 | 70 | { |
71 | - if(!$piece) |
|
71 | + if (!$piece) |
|
72 | 72 | return self::$array['pieces']; |
73 | 73 | |
74 | - if($piece == -1) |
|
74 | + if ($piece == -1) |
|
75 | 75 | return end(self::$array['pieces']); |
76 | 76 | |
77 | 77 | $piece = $piece - 1; |
78 | - if(array_key_exists($piece, self::$array['pieces'])) |
|
78 | + if (array_key_exists($piece, self::$array['pieces'])) |
|
79 | 79 | return self::$array['pieces'][$piece]; |
80 | 80 | return; |
81 | 81 | } |
@@ -15,12 +15,14 @@ discard block |
||
15 | 15 | static private function form_url_array($host, $uri) |
16 | 16 | { |
17 | 17 | $uri = substr($uri, 1); |
18 | - if(strpos($uri, '?')) |
|
19 | - $uri = substr($uri, 0, strpos($uri, '?')); |
|
18 | + if(strpos($uri, '?')) { |
|
19 | + $uri = substr($uri, 0, strpos($uri, '?')); |
|
20 | + } |
|
20 | 21 | $uri_array = explode('/', $uri); |
21 | 22 | |
22 | - if(!Loader::isLive()) |
|
23 | - $host = substr($host, strpos($host, '.') + 1); |
|
23 | + if(!Loader::isLive()) { |
|
24 | + $host = substr($host, strpos($host, '.') + 1); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | self::$array['host'] = $host; |
26 | 28 | |
@@ -33,8 +35,9 @@ discard block |
||
33 | 35 | self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/'; |
34 | 36 | self::$array['uri'] = '/' . implode('/', $uri_array); |
35 | 37 | |
36 | - if(end($uri_array) == '') |
|
37 | - $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
|
38 | + if(end($uri_array) == '') { |
|
39 | + $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
|
40 | + } |
|
38 | 41 | self::$array['pieces'] = (array) $uri_array; |
39 | 42 | } |
40 | 43 | |
@@ -61,22 +64,26 @@ discard block |
||
61 | 64 | static function getExtension() |
62 | 65 | { |
63 | 66 | $file = self::getPiece(-1); |
64 | - if(substr($file, -1) == '/') |
|
65 | - return false; |
|
67 | + if(substr($file, -1) == '/') { |
|
68 | + return false; |
|
69 | + } |
|
66 | 70 | return substr($file, strrpos($file, '.') + 1);; |
67 | 71 | } |
68 | 72 | |
69 | 73 | static function getPiece($piece = null) |
70 | 74 | { |
71 | - if(!$piece) |
|
72 | - return self::$array['pieces']; |
|
75 | + if(!$piece) { |
|
76 | + return self::$array['pieces']; |
|
77 | + } |
|
73 | 78 | |
74 | - if($piece == -1) |
|
75 | - return end(self::$array['pieces']); |
|
79 | + if($piece == -1) { |
|
80 | + return end(self::$array['pieces']); |
|
81 | + } |
|
76 | 82 | |
77 | 83 | $piece = $piece - 1; |
78 | - if(array_key_exists($piece, self::$array['pieces'])) |
|
79 | - return self::$array['pieces'][$piece]; |
|
84 | + if(array_key_exists($piece, self::$array['pieces'])) { |
|
85 | + return self::$array['pieces'][$piece]; |
|
86 | + } |
|
80 | 87 | return; |
81 | 88 | } |
82 | 89 |
@@ -24,10 +24,10 @@ |
||
24 | 24 | |
25 | 25 | self::$array['host'] = $host; |
26 | 26 | |
27 | - if ( |
|
28 | - $host == 'www.waterfallsofthekeweenaw.com' || |
|
29 | - $host == 'waterfallsofthekeweenaw.com' |
|
30 | - ) { |
|
27 | + if ( |
|
28 | + $host == 'www.waterfallsofthekeweenaw.com' || |
|
29 | + $host == 'waterfallsofthekeweenaw.com' |
|
30 | + ) { |
|
31 | 31 | self::$array['site'] = 'waterfalls'; |
32 | 32 | } else { |
33 | 33 | self::$array['site'] = substr($host, 0, strpos($host, '.')); |
@@ -69,6 +69,9 @@ |
||
69 | 69 | return substr($file, strrpos($file, '.') + 1);; |
70 | 70 | } |
71 | 71 | |
72 | + /** |
|
73 | + * @param integer $piece |
|
74 | + */ |
|
72 | 75 | static function getPiece($piece = null) |
73 | 76 | { |
74 | 77 | if(!$piece) |
@@ -5,56 +5,56 @@ |
||
5 | 5 | final class ImperialUnitContent extends Content |
6 | 6 | { |
7 | 7 | |
8 | - protected function execute($type = '') |
|
9 | - { |
|
10 | - $number = floatval($this->content); |
|
11 | - $number *= 39.37; // convert to inches |
|
8 | + protected function execute($type = '') |
|
9 | + { |
|
10 | + $number = floatval($this->content); |
|
11 | + $number *= 39.37; // convert to inches |
|
12 | 12 | |
13 | - if ($type == '') { |
|
14 | - if ($number > (12 * 3 * 1760 * 5)) { |
|
15 | - $type = 'full miles'; |
|
16 | - } else if ($number > (12 * 3 * 1760 * .5)) { |
|
17 | - $type = 'tenth miles'; |
|
18 | - } else if ($number > (12 * 3 * 150)) { |
|
19 | - $type = 'yards'; |
|
20 | - } else if ($number > (12 * 10)) { |
|
21 | - $type = 'feet'; |
|
22 | - } else { |
|
23 | - $type = 'inches'; |
|
24 | - } |
|
25 | - } |
|
13 | + if ($type == '') { |
|
14 | + if ($number > (12 * 3 * 1760 * 5)) { |
|
15 | + $type = 'full miles'; |
|
16 | + } else if ($number > (12 * 3 * 1760 * .5)) { |
|
17 | + $type = 'tenth miles'; |
|
18 | + } else if ($number > (12 * 3 * 150)) { |
|
19 | + $type = 'yards'; |
|
20 | + } else if ($number > (12 * 10)) { |
|
21 | + $type = 'feet'; |
|
22 | + } else { |
|
23 | + $type = 'inches'; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | |
27 | - switch ($type) { |
|
28 | - case 'full miles' : |
|
29 | - $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles'; |
|
30 | - break; |
|
31 | - case 'tenth miles' : |
|
32 | - $this->content = round($number / (12 * 3 * 1760), 1) . ' miles'; |
|
33 | - break; |
|
34 | - case 'yards' : |
|
35 | - $this->content = number_format(round($number / (12 * 3))) . ' yards'; |
|
36 | - break; |
|
37 | - case 'feet' : |
|
38 | - $this->content = number_format(round($number / 12)) . "'"; |
|
39 | - break; |
|
40 | - case 'inches' : |
|
41 | - $feet = floor($number / 12); |
|
27 | + switch ($type) { |
|
28 | + case 'full miles' : |
|
29 | + $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles'; |
|
30 | + break; |
|
31 | + case 'tenth miles' : |
|
32 | + $this->content = round($number / (12 * 3 * 1760), 1) . ' miles'; |
|
33 | + break; |
|
34 | + case 'yards' : |
|
35 | + $this->content = number_format(round($number / (12 * 3))) . ' yards'; |
|
36 | + break; |
|
37 | + case 'feet' : |
|
38 | + $this->content = number_format(round($number / 12)) . "'"; |
|
39 | + break; |
|
40 | + case 'inches' : |
|
41 | + $feet = floor($number / 12); |
|
42 | 42 | |
43 | - $inches = $number - $feet * 12; |
|
44 | - $inches = round($inches); |
|
43 | + $inches = $number - $feet * 12; |
|
44 | + $inches = round($inches); |
|
45 | 45 | |
46 | - if ($inches == 12) { |
|
47 | - $feet++; |
|
48 | - $inches = 0; |
|
49 | - } |
|
46 | + if ($inches == 12) { |
|
47 | + $feet++; |
|
48 | + $inches = 0; |
|
49 | + } |
|
50 | 50 | |
51 | - $this->content = ''; |
|
52 | - $this->content .= number_format($feet) . "'"; |
|
53 | - if (isset($inches) && $inches > 0) { |
|
54 | - $this->content .= " {$inches}\""; |
|
55 | - } |
|
56 | - break; |
|
57 | - } |
|
58 | - } |
|
51 | + $this->content = ''; |
|
52 | + $this->content .= number_format($feet) . "'"; |
|
53 | + if (isset($inches) && $inches > 0) { |
|
54 | + $this->content .= " {$inches}\""; |
|
55 | + } |
|
56 | + break; |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | \ No newline at end of file |