@@ -113,6 +113,9 @@ discard block |
||
| 113 | 113 | exit; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | + /** |
|
| 117 | + * @param string $method |
|
| 118 | + */ |
|
| 116 | 119 | protected function set_header_method($method) |
| 117 | 120 | { |
| 118 | 121 | $this->headers = $method; |
@@ -123,6 +126,9 @@ discard block |
||
| 123 | 126 | $this->set_head('title', $value); |
| 124 | 127 | } |
| 125 | 128 | |
| 129 | + /** |
|
| 130 | + * @param string $value |
|
| 131 | + */ |
|
| 126 | 132 | protected function set_author($value) |
| 127 | 133 | { |
| 128 | 134 | $this->set_head('author', $value); |
@@ -138,26 +144,41 @@ discard block |
||
| 138 | 144 | $this->set_head('keywords', implode(', ', $array)); |
| 139 | 145 | } |
| 140 | 146 | |
| 147 | + /** |
|
| 148 | + * @param string $url |
|
| 149 | + */ |
|
| 141 | 150 | protected function set_canonical($url) |
| 142 | 151 | { |
| 143 | 152 | $this->set_head('canonical', $url); |
| 144 | 153 | } |
| 145 | 154 | |
| 155 | + /** |
|
| 156 | + * @param string $set |
|
| 157 | + */ |
|
| 146 | 158 | protected function set_head($set, $value) |
| 147 | 159 | { |
| 148 | 160 | $this->data_array['head'][$set] = $value; |
| 149 | 161 | } |
| 150 | 162 | |
| 163 | + /** |
|
| 164 | + * @param string $set |
|
| 165 | + */ |
|
| 151 | 166 | protected function set_body($set, $value) |
| 152 | 167 | { |
| 153 | 168 | $this->data_array['body'][$set] = $value; |
| 154 | 169 | } |
| 155 | 170 | |
| 171 | + /** |
|
| 172 | + * @param string $file |
|
| 173 | + */ |
|
| 156 | 174 | protected function add_css($file, $version = 1) |
| 157 | 175 | { |
| 158 | 176 | $this->css_array[] = [$file, $version]; |
| 159 | 177 | } |
| 160 | 178 | |
| 179 | + /** |
|
| 180 | + * @param string $file |
|
| 181 | + */ |
|
| 161 | 182 | protected function add_js($file) |
| 162 | 183 | { |
| 163 | 184 | $this->js_array[] = $file; |
@@ -183,6 +204,9 @@ discard block |
||
| 183 | 204 | $this->set_head('js_link_array', $js_array); |
| 184 | 205 | } |
| 185 | 206 | |
| 207 | + /** |
|
| 208 | + * @param string $view |
|
| 209 | + */ |
|
| 186 | 210 | protected function set_body_view($view) |
| 187 | 211 | { |
| 188 | 212 | $this->body_view_array[] = $view; |
@@ -227,6 +251,10 @@ discard block |
||
| 227 | 251 | } |
| 228 | 252 | |
| 229 | 253 | private $comment_errors; |
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * @param string $redirect_url |
|
| 257 | + */ |
|
| 230 | 258 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
| 231 | 259 | { |
| 232 | 260 | if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
@@ -238,6 +266,9 @@ discard block |
||
| 238 | 266 | return; |
| 239 | 267 | } |
| 240 | 268 | |
| 269 | + /** |
|
| 270 | + * @param string $site |
|
| 271 | + */ |
|
| 241 | 272 | protected function get_comment_array($site, $path) |
| 242 | 273 | { |
| 243 | 274 | global $container; |
@@ -5,52 +5,52 @@ discard block |
||
| 5 | 5 | abstract class PageController |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - private static $TRACKING_CODE = 'UA-11745070-1'; |
|
| 8 | + private static $TRACKING_CODE = 'UA-11745070-1'; |
|
| 9 | 9 | |
| 10 | - protected static $DEPRECATED_BLOGS = array( |
|
| 11 | - 10 => 63, |
|
| 12 | - 55 => 67, |
|
| 13 | - ); |
|
| 14 | - |
|
| 15 | - private $headers; |
|
| 16 | - private $css_array = array(); |
|
| 17 | - private $font_css_array = array(); |
|
| 18 | - private $js_array = array(); |
|
| 19 | - |
|
| 20 | - private $data_array = array(); |
|
| 21 | - private $body_view_array = array(); |
|
| 22 | - |
|
| 23 | - protected function set_head_data() {} |
|
| 24 | - protected function set_body_data() {} |
|
| 25 | - protected function set_data() {} |
|
| 26 | - |
|
| 27 | - public function __construct() |
|
| 28 | - { |
|
| 29 | - $this->set_header_method('sendHTML'); |
|
| 10 | + protected static $DEPRECATED_BLOGS = array( |
|
| 11 | + 10 => 63, |
|
| 12 | + 55 => 67, |
|
| 13 | + ); |
|
| 14 | + |
|
| 15 | + private $headers; |
|
| 16 | + private $css_array = array(); |
|
| 17 | + private $font_css_array = array(); |
|
| 18 | + private $js_array = array(); |
|
| 19 | + |
|
| 20 | + private $data_array = array(); |
|
| 21 | + private $body_view_array = array(); |
|
| 22 | + |
|
| 23 | + protected function set_head_data() {} |
|
| 24 | + protected function set_body_data() {} |
|
| 25 | + protected function set_data() {} |
|
| 26 | + |
|
| 27 | + public function __construct() |
|
| 28 | + { |
|
| 29 | + $this->set_header_method('sendHTML'); |
|
| 30 | 30 | |
| 31 | - $this->set_head('google_verification', 'sgAISiuoWfK54KXnOfm2oU4vQdad8eyNCQX7LkZ1OxM'); |
|
| 32 | - $this->set_head('bing_verification', 'AF1A4CEA30A7589590E9294C4B512607'); |
|
| 31 | + $this->set_head('google_verification', 'sgAISiuoWfK54KXnOfm2oU4vQdad8eyNCQX7LkZ1OxM'); |
|
| 32 | + $this->set_head('bing_verification', 'AF1A4CEA30A7589590E9294C4B512607'); |
|
| 33 | 33 | |
| 34 | - $this->set_body('domain_container', $this->get_domain_container()); |
|
| 35 | - $this->set_body('footer', array( |
|
| 36 | - 'link' => Loader::getRootUrl('site'), |
|
| 37 | - 'anchor' => 'jacobemerick.com', |
|
| 38 | - 'date' => date('Y'))); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - protected function get_domain_container() |
|
| 42 | - { |
|
| 43 | - $domain_container = new stdclass(); |
|
| 34 | + $this->set_body('domain_container', $this->get_domain_container()); |
|
| 35 | + $this->set_body('footer', array( |
|
| 36 | + 'link' => Loader::getRootUrl('site'), |
|
| 37 | + 'anchor' => 'jacobemerick.com', |
|
| 38 | + 'date' => date('Y'))); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + protected function get_domain_container() |
|
| 42 | + { |
|
| 43 | + $domain_container = new stdclass(); |
|
| 44 | 44 | |
| 45 | - $domain_container->blog = Loader::getRootUrl('blog'); |
|
| 46 | - $domain_container->home = Loader::getRootUrl('home'); |
|
| 47 | - $domain_container->lifestream = Loader::getRootUrl('lifestream'); |
|
| 48 | - $domain_container->map = Loader::getRootUrl('map'); |
|
| 49 | - $domain_container->portfolio = Loader::getRootUrl('portfolio'); |
|
| 50 | - $domain_container->waterfalls = Loader::getRootUrl('waterfalls'); |
|
| 45 | + $domain_container->blog = Loader::getRootUrl('blog'); |
|
| 46 | + $domain_container->home = Loader::getRootUrl('home'); |
|
| 47 | + $domain_container->lifestream = Loader::getRootUrl('lifestream'); |
|
| 48 | + $domain_container->map = Loader::getRootUrl('map'); |
|
| 49 | + $domain_container->portfolio = Loader::getRootUrl('portfolio'); |
|
| 50 | + $domain_container->waterfalls = Loader::getRootUrl('waterfalls'); |
|
| 51 | 51 | |
| 52 | - return $domain_container; |
|
| 53 | - } |
|
| 52 | + return $domain_container; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | protected function get_recent_activity() |
| 56 | 56 | { |
@@ -84,24 +84,24 @@ discard block |
||
| 84 | 84 | return (object) $post; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function activate() |
|
| 88 | - { |
|
| 89 | - $this->set_head_data(); |
|
| 90 | - $this->set_body_data(); |
|
| 91 | - $this->set_data(); |
|
| 87 | + public function activate() |
|
| 88 | + { |
|
| 89 | + $this->set_head_data(); |
|
| 90 | + $this->set_body_data(); |
|
| 91 | + $this->set_data(); |
|
| 92 | 92 | |
| 93 | - $this->load_assets(); |
|
| 93 | + $this->load_assets(); |
|
| 94 | 94 | |
| 95 | - $headers = $this->headers; |
|
| 96 | - Header::$headers(); |
|
| 97 | - Loader::load('view', '/Head', $this->data_array['head']); |
|
| 98 | - foreach($this->body_view_array as $view) |
|
| 99 | - { |
|
| 100 | - if(substr($view, 0, 1) == '/') |
|
| 101 | - Loader::load('view', $view, $this->data_array['body']); |
|
| 102 | - else |
|
| 103 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 104 | - } |
|
| 95 | + $headers = $this->headers; |
|
| 96 | + Header::$headers(); |
|
| 97 | + Loader::load('view', '/Head', $this->data_array['head']); |
|
| 98 | + foreach($this->body_view_array as $view) |
|
| 99 | + { |
|
| 100 | + if(substr($view, 0, 1) == '/') |
|
| 101 | + Loader::load('view', $view, $this->data_array['body']); |
|
| 102 | + else |
|
| 103 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | if (URLDecode::getSite() == 'waterfalls') { |
| 107 | 107 | Loader::load('view', '/WaterfallFoot'); |
@@ -109,134 +109,134 @@ discard block |
||
| 109 | 109 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if($view == '/404' || $view == '/503') |
|
| 113 | - exit; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - protected function set_header_method($method) |
|
| 117 | - { |
|
| 118 | - $this->headers = $method; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - protected function set_title($value) |
|
| 122 | - { |
|
| 123 | - $this->set_head('title', $value); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - protected function set_author($value) |
|
| 127 | - { |
|
| 128 | - $this->set_head('author', $value); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - protected function set_description($value) |
|
| 132 | - { |
|
| 133 | - $this->set_head('description', $value); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - protected function set_keywords($array) |
|
| 137 | - { |
|
| 138 | - $this->set_head('keywords', implode(', ', $array)); |
|
| 139 | - } |
|
| 112 | + if($view == '/404' || $view == '/503') |
|
| 113 | + exit; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + protected function set_header_method($method) |
|
| 117 | + { |
|
| 118 | + $this->headers = $method; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + protected function set_title($value) |
|
| 122 | + { |
|
| 123 | + $this->set_head('title', $value); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + protected function set_author($value) |
|
| 127 | + { |
|
| 128 | + $this->set_head('author', $value); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + protected function set_description($value) |
|
| 132 | + { |
|
| 133 | + $this->set_head('description', $value); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + protected function set_keywords($array) |
|
| 137 | + { |
|
| 138 | + $this->set_head('keywords', implode(', ', $array)); |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - protected function set_canonical($url) |
|
| 142 | - { |
|
| 143 | - $this->set_head('canonical', $url); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - protected function set_head($set, $value) |
|
| 147 | - { |
|
| 148 | - $this->data_array['head'][$set] = $value; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - protected function set_body($set, $value) |
|
| 152 | - { |
|
| 153 | - $this->data_array['body'][$set] = $value; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - protected function add_css($file, $version = 1) |
|
| 157 | - { |
|
| 158 | - $this->css_array[] = [$file, $version]; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - protected function add_js($file) |
|
| 162 | - { |
|
| 163 | - $this->js_array[] = $file; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - private function load_assets() |
|
| 167 | - { |
|
| 141 | + protected function set_canonical($url) |
|
| 142 | + { |
|
| 143 | + $this->set_head('canonical', $url); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + protected function set_head($set, $value) |
|
| 147 | + { |
|
| 148 | + $this->data_array['head'][$set] = $value; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + protected function set_body($set, $value) |
|
| 152 | + { |
|
| 153 | + $this->data_array['body'][$set] = $value; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + protected function add_css($file, $version = 1) |
|
| 157 | + { |
|
| 158 | + $this->css_array[] = [$file, $version]; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + protected function add_js($file) |
|
| 162 | + { |
|
| 163 | + $this->js_array[] = $file; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + private function load_assets() |
|
| 167 | + { |
|
| 168 | 168 | $css_array = array_map(function ($stylesheet) { |
| 169 | - $path = "/css/{$stylesheet[0]}.css"; |
|
| 170 | - if ($stylesheet[1] > 1) { |
|
| 169 | + $path = "/css/{$stylesheet[0]}.css"; |
|
| 170 | + if ($stylesheet[1] > 1) { |
|
| 171 | 171 | $path .= "?v={$stylesheet[1]}"; |
| 172 | - } |
|
| 173 | - return $path; |
|
| 172 | + } |
|
| 173 | + return $path; |
|
| 174 | 174 | }, $this->css_array); |
| 175 | 175 | $js_array = array_map(function ($script) { |
| 176 | - if (substr($script, 0, 4) == 'http') { |
|
| 176 | + if (substr($script, 0, 4) == 'http') { |
|
| 177 | 177 | return $script; |
| 178 | - } |
|
| 179 | - return "/js/{$script}.min.js"; |
|
| 178 | + } |
|
| 179 | + return "/js/{$script}.min.js"; |
|
| 180 | 180 | }, $this->js_array); |
| 181 | 181 | |
| 182 | - $this->set_head('css_link_array', $css_array); |
|
| 183 | - $this->set_head('js_link_array', $js_array); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - protected function set_body_view($view) |
|
| 187 | - { |
|
| 188 | - $this->body_view_array[] = $view; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - protected function eject() |
|
| 192 | - { |
|
| 193 | - if(get_class($this) !== 'Error404Controller') |
|
| 194 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - protected function unavailable() |
|
| 198 | - { |
|
| 199 | - if(get_class($this) !== 'Error503Controller') |
|
| 200 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - protected function redirect($uri, $method = 301) |
|
| 204 | - { |
|
| 205 | - switch($method) |
|
| 206 | - { |
|
| 207 | - case 301 : |
|
| 208 | - if(get_class($this) !== 'Error301Controller') |
|
| 209 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
| 210 | - break; |
|
| 211 | - case 303 : |
|
| 212 | - if(get_class($this) !== 'Error303Controller') |
|
| 213 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
| 214 | - break; |
|
| 215 | - } |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - final protected function get_parsed_date($date) |
|
| 219 | - { |
|
| 220 | - $parsed_date = new stdclass(); |
|
| 182 | + $this->set_head('css_link_array', $css_array); |
|
| 183 | + $this->set_head('js_link_array', $js_array); |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + protected function set_body_view($view) |
|
| 187 | + { |
|
| 188 | + $this->body_view_array[] = $view; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + protected function eject() |
|
| 192 | + { |
|
| 193 | + if(get_class($this) !== 'Error404Controller') |
|
| 194 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + protected function unavailable() |
|
| 198 | + { |
|
| 199 | + if(get_class($this) !== 'Error503Controller') |
|
| 200 | + Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + protected function redirect($uri, $method = 301) |
|
| 204 | + { |
|
| 205 | + switch($method) |
|
| 206 | + { |
|
| 207 | + case 301 : |
|
| 208 | + if(get_class($this) !== 'Error301Controller') |
|
| 209 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
| 210 | + break; |
|
| 211 | + case 303 : |
|
| 212 | + if(get_class($this) !== 'Error303Controller') |
|
| 213 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
| 214 | + break; |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + final protected function get_parsed_date($date) |
|
| 219 | + { |
|
| 220 | + $parsed_date = new stdclass(); |
|
| 221 | 221 | |
| 222 | - $parsed_date->stamp = date('c', strtotime($date)); |
|
| 223 | - $parsed_date->friendly = date('F j, Y', strtotime($date)); |
|
| 224 | - $parsed_date->elapsed = Content::instance('ElapsedTime', $date)->activate(); |
|
| 222 | + $parsed_date->stamp = date('c', strtotime($date)); |
|
| 223 | + $parsed_date->friendly = date('F j, Y', strtotime($date)); |
|
| 224 | + $parsed_date->elapsed = Content::instance('ElapsedTime', $date)->activate(); |
|
| 225 | 225 | |
| 226 | - return $parsed_date; |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - private $comment_errors; |
|
| 230 | - protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
| 231 | - { |
|
| 232 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 233 | - { |
|
| 234 | - $parameters = array($site_id, $path, $redirect_url, $page_title); |
|
| 235 | - $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
|
| 236 | - } |
|
| 226 | + return $parsed_date; |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + private $comment_errors; |
|
| 230 | + protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
| 231 | + { |
|
| 232 | + if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 233 | + { |
|
| 234 | + $parameters = array($site_id, $path, $redirect_url, $page_title); |
|
| 235 | + $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - return; |
|
| 239 | - } |
|
| 238 | + return; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | protected function get_comment_array($site, $path) |
| 242 | 242 | { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $post_result = $activityRepository->getActivities(5); |
| 60 | 60 | |
| 61 | 61 | $post_array = array(); |
| 62 | - foreach($post_result as $row) { |
|
| 62 | + foreach ($post_result as $row) { |
|
| 63 | 63 | array_push($post_array, $this->expand_post($row)); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ]; |
| 76 | 76 | |
| 77 | 77 | if ($format != 'short') { |
| 78 | - $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/"; |
|
| 78 | + $post['url'] = Loader::getRootUrl('lifestream')."{$raw_post['type']}/{$raw_post['id']}/"; |
|
| 79 | 79 | |
| 80 | 80 | $metadata = json_decode($raw_post['metadata'], true); |
| 81 | 81 | $post = array_merge($post, $metadata); |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | $headers = $this->headers; |
| 96 | 96 | Header::$headers(); |
| 97 | 97 | Loader::load('view', '/Head', $this->data_array['head']); |
| 98 | - foreach($this->body_view_array as $view) |
|
| 98 | + foreach ($this->body_view_array as $view) |
|
| 99 | 99 | { |
| 100 | - if(substr($view, 0, 1) == '/') |
|
| 100 | + if (substr($view, 0, 1) == '/') |
|
| 101 | 101 | Loader::load('view', $view, $this->data_array['body']); |
| 102 | 102 | else |
| 103 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 103 | + Loader::load('view', URLDecode::getSite().'/'.$view, $this->data_array['body']); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if($view == '/404' || $view == '/503') |
|
| 112 | + if ($view == '/404' || $view == '/503') |
|
| 113 | 113 | exit; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | private function load_assets() |
| 167 | 167 | { |
| 168 | - $css_array = array_map(function ($stylesheet) { |
|
| 168 | + $css_array = array_map(function($stylesheet) { |
|
| 169 | 169 | $path = "/css/{$stylesheet[0]}.css"; |
| 170 | 170 | if ($stylesheet[1] > 1) { |
| 171 | 171 | $path .= "?v={$stylesheet[1]}"; |
| 172 | 172 | } |
| 173 | 173 | return $path; |
| 174 | 174 | }, $this->css_array); |
| 175 | - $js_array = array_map(function ($script) { |
|
| 175 | + $js_array = array_map(function($script) { |
|
| 176 | 176 | if (substr($script, 0, 4) == 'http') { |
| 177 | 177 | return $script; |
| 178 | 178 | } |
@@ -190,26 +190,26 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | protected function eject() |
| 192 | 192 | { |
| 193 | - if(get_class($this) !== 'Error404Controller') |
|
| 193 | + if (get_class($this) !== 'Error404Controller') |
|
| 194 | 194 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | protected function unavailable() |
| 198 | 198 | { |
| 199 | - if(get_class($this) !== 'Error503Controller') |
|
| 199 | + if (get_class($this) !== 'Error503Controller') |
|
| 200 | 200 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | protected function redirect($uri, $method = 301) |
| 204 | 204 | { |
| 205 | - switch($method) |
|
| 205 | + switch ($method) |
|
| 206 | 206 | { |
| 207 | 207 | case 301 : |
| 208 | - if(get_class($this) !== 'Error301Controller') |
|
| 208 | + if (get_class($this) !== 'Error301Controller') |
|
| 209 | 209 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
| 210 | 210 | break; |
| 211 | 211 | case 303 : |
| 212 | - if(get_class($this) !== 'Error303Controller') |
|
| 212 | + if (get_class($this) !== 'Error303Controller') |
|
| 213 | 213 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
| 214 | 214 | break; |
| 215 | 215 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | private $comment_errors; |
| 230 | 230 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
| 231 | 231 | { |
| 232 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 232 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 233 | 233 | { |
| 234 | 234 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
| 235 | 235 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $container['logger']->info("CommentService | Path | {$elapsed}"); |
| 262 | 262 | |
| 263 | 263 | $array = array(); |
| 264 | - foreach((array) $comment_response as $comment) |
|
| 264 | + foreach ((array) $comment_response as $comment) |
|
| 265 | 265 | { |
| 266 | 266 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
| 267 | 267 | $body = strip_tags($body); |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('utility', 'Header'); |
| 4 | 4 | |
| 5 | -abstract class PageController |
|
| 6 | -{ |
|
| 5 | +abstract class PageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | 8 | private static $TRACKING_CODE = 'UA-11745070-1'; |
| 9 | 9 | |
@@ -20,12 +20,18 @@ discard block |
||
| 20 | 20 | private $data_array = array(); |
| 21 | 21 | private $body_view_array = array(); |
| 22 | 22 | |
| 23 | - protected function set_head_data() {} |
|
| 24 | - protected function set_body_data() {} |
|
| 25 | - protected function set_data() {} |
|
| 23 | + protected function set_head_data() |
|
| 24 | + {
|
|
| 25 | +} |
|
| 26 | + protected function set_body_data() |
|
| 27 | + {
|
|
| 28 | +} |
|
| 29 | + protected function set_data() |
|
| 30 | + {
|
|
| 31 | +} |
|
| 26 | 32 | |
| 27 | - public function __construct() |
|
| 28 | - { |
|
| 33 | + public function __construct() |
|
| 34 | + {
|
|
| 29 | 35 | $this->set_header_method('sendHTML'); |
| 30 | 36 | |
| 31 | 37 | $this->set_head('google_verification', 'sgAISiuoWfK54KXnOfm2oU4vQdad8eyNCQX7LkZ1OxM'); |
@@ -38,8 +44,8 @@ discard block |
||
| 38 | 44 | 'date' => date('Y'))); |
| 39 | 45 | } |
| 40 | 46 | |
| 41 | - protected function get_domain_container() |
|
| 42 | - { |
|
| 47 | + protected function get_domain_container() |
|
| 48 | + {
|
|
| 43 | 49 | $domain_container = new stdclass(); |
| 44 | 50 | |
| 45 | 51 | $domain_container->blog = Loader::getRootUrl('blog'); |
@@ -52,8 +58,8 @@ discard block |
||
| 52 | 58 | return $domain_container; |
| 53 | 59 | } |
| 54 | 60 | |
| 55 | - protected function get_recent_activity() |
|
| 56 | - { |
|
| 61 | + protected function get_recent_activity() |
|
| 62 | + {
|
|
| 57 | 63 | global $container; |
| 58 | 64 | $activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']); |
| 59 | 65 | $post_result = $activityRepository->getActivities(5); |
@@ -66,8 +72,8 @@ discard block |
||
| 66 | 72 | return $post_array; |
| 67 | 73 | } |
| 68 | 74 | |
| 69 | - protected function expand_post($raw_post, $format = 'short') |
|
| 70 | - { |
|
| 75 | + protected function expand_post($raw_post, $format = 'short') |
|
| 76 | + {
|
|
| 71 | 77 | $post = [ |
| 72 | 78 | 'type' => $raw_post['type'], |
| 73 | 79 | 'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'], |
@@ -84,8 +90,8 @@ discard block |
||
| 84 | 90 | return (object) $post; |
| 85 | 91 | } |
| 86 | 92 | |
| 87 | - public function activate() |
|
| 88 | - { |
|
| 93 | + public function activate() |
|
| 94 | + {
|
|
| 89 | 95 | $this->set_head_data(); |
| 90 | 96 | $this->set_body_data(); |
| 91 | 97 | $this->set_data(); |
@@ -97,10 +103,11 @@ discard block |
||
| 97 | 103 | Loader::load('view', '/Head', $this->data_array['head']); |
| 98 | 104 | foreach($this->body_view_array as $view) |
| 99 | 105 | { |
| 100 | - if(substr($view, 0, 1) == '/') |
|
| 101 | - Loader::load('view', $view, $this->data_array['body']); |
|
| 102 | - else |
|
| 103 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 106 | + if(substr($view, 0, 1) == '/') {
|
|
| 107 | + Loader::load('view', $view, $this->data_array['body']);
|
|
| 108 | + } else {
|
|
| 109 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
|
|
| 110 | + } |
|
| 104 | 111 | } |
| 105 | 112 | |
| 106 | 113 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -109,62 +116,63 @@ discard block |
||
| 109 | 116 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 110 | 117 | } |
| 111 | 118 | |
| 112 | - if($view == '/404' || $view == '/503') |
|
| 113 | - exit; |
|
| 119 | + if($view == '/404' || $view == '/503') {
|
|
| 120 | + exit; |
|
| 121 | + } |
|
| 114 | 122 | } |
| 115 | 123 | |
| 116 | - protected function set_header_method($method) |
|
| 117 | - { |
|
| 124 | + protected function set_header_method($method) |
|
| 125 | + {
|
|
| 118 | 126 | $this->headers = $method; |
| 119 | 127 | } |
| 120 | 128 | |
| 121 | - protected function set_title($value) |
|
| 122 | - { |
|
| 129 | + protected function set_title($value) |
|
| 130 | + {
|
|
| 123 | 131 | $this->set_head('title', $value); |
| 124 | 132 | } |
| 125 | 133 | |
| 126 | - protected function set_author($value) |
|
| 127 | - { |
|
| 134 | + protected function set_author($value) |
|
| 135 | + {
|
|
| 128 | 136 | $this->set_head('author', $value); |
| 129 | 137 | } |
| 130 | 138 | |
| 131 | - protected function set_description($value) |
|
| 132 | - { |
|
| 139 | + protected function set_description($value) |
|
| 140 | + {
|
|
| 133 | 141 | $this->set_head('description', $value); |
| 134 | 142 | } |
| 135 | 143 | |
| 136 | - protected function set_keywords($array) |
|
| 137 | - { |
|
| 144 | + protected function set_keywords($array) |
|
| 145 | + {
|
|
| 138 | 146 | $this->set_head('keywords', implode(', ', $array)); |
| 139 | 147 | } |
| 140 | 148 | |
| 141 | - protected function set_canonical($url) |
|
| 142 | - { |
|
| 149 | + protected function set_canonical($url) |
|
| 150 | + {
|
|
| 143 | 151 | $this->set_head('canonical', $url); |
| 144 | 152 | } |
| 145 | 153 | |
| 146 | - protected function set_head($set, $value) |
|
| 147 | - { |
|
| 154 | + protected function set_head($set, $value) |
|
| 155 | + {
|
|
| 148 | 156 | $this->data_array['head'][$set] = $value; |
| 149 | 157 | } |
| 150 | 158 | |
| 151 | - protected function set_body($set, $value) |
|
| 152 | - { |
|
| 159 | + protected function set_body($set, $value) |
|
| 160 | + {
|
|
| 153 | 161 | $this->data_array['body'][$set] = $value; |
| 154 | 162 | } |
| 155 | 163 | |
| 156 | - protected function add_css($file, $version = 1) |
|
| 157 | - { |
|
| 164 | + protected function add_css($file, $version = 1) |
|
| 165 | + {
|
|
| 158 | 166 | $this->css_array[] = [$file, $version]; |
| 159 | 167 | } |
| 160 | 168 | |
| 161 | - protected function add_js($file) |
|
| 162 | - { |
|
| 169 | + protected function add_js($file) |
|
| 170 | + {
|
|
| 163 | 171 | $this->js_array[] = $file; |
| 164 | 172 | } |
| 165 | 173 | |
| 166 | - private function load_assets() |
|
| 167 | - { |
|
| 174 | + private function load_assets() |
|
| 175 | + {
|
|
| 168 | 176 | $css_array = array_map(function ($stylesheet) { |
| 169 | 177 | $path = "/css/{$stylesheet[0]}.css"; |
| 170 | 178 | if ($stylesheet[1] > 1) { |
@@ -183,40 +191,44 @@ discard block |
||
| 183 | 191 | $this->set_head('js_link_array', $js_array); |
| 184 | 192 | } |
| 185 | 193 | |
| 186 | - protected function set_body_view($view) |
|
| 187 | - { |
|
| 194 | + protected function set_body_view($view) |
|
| 195 | + {
|
|
| 188 | 196 | $this->body_view_array[] = $view; |
| 189 | 197 | } |
| 190 | 198 | |
| 191 | - protected function eject() |
|
| 192 | - { |
|
| 193 | - if(get_class($this) !== 'Error404Controller') |
|
| 194 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
| 199 | + protected function eject() |
|
| 200 | + {
|
|
| 201 | + if(get_class($this) !== 'Error404Controller') {
|
|
| 202 | + Loader::loadNew('controller', '/Error404Controller')->activate();
|
|
| 203 | + } |
|
| 195 | 204 | } |
| 196 | 205 | |
| 197 | - protected function unavailable() |
|
| 198 | - { |
|
| 199 | - if(get_class($this) !== 'Error503Controller') |
|
| 200 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
| 206 | + protected function unavailable() |
|
| 207 | + {
|
|
| 208 | + if(get_class($this) !== 'Error503Controller') {
|
|
| 209 | + Loader::loadNew('controller', '/Error503Controller')->activate();
|
|
| 210 | + } |
|
| 201 | 211 | } |
| 202 | 212 | |
| 203 | - protected function redirect($uri, $method = 301) |
|
| 204 | - { |
|
| 213 | + protected function redirect($uri, $method = 301) |
|
| 214 | + {
|
|
| 205 | 215 | switch($method) |
| 206 | 216 | { |
| 207 | 217 | case 301 : |
| 208 | - if(get_class($this) !== 'Error301Controller') |
|
| 209 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
| 218 | + if(get_class($this) !== 'Error301Controller') {
|
|
| 219 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
|
|
| 220 | + } |
|
| 210 | 221 | break; |
| 211 | 222 | case 303 : |
| 212 | - if(get_class($this) !== 'Error303Controller') |
|
| 213 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
| 223 | + if(get_class($this) !== 'Error303Controller') {
|
|
| 224 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
|
|
| 225 | + } |
|
| 214 | 226 | break; |
| 215 | 227 | } |
| 216 | 228 | } |
| 217 | 229 | |
| 218 | - final protected function get_parsed_date($date) |
|
| 219 | - { |
|
| 230 | + final protected function get_parsed_date($date) |
|
| 231 | + {
|
|
| 220 | 232 | $parsed_date = new stdclass(); |
| 221 | 233 | |
| 222 | 234 | $parsed_date->stamp = date('c', strtotime($date)); |
@@ -227,8 +239,8 @@ discard block |
||
| 227 | 239 | } |
| 228 | 240 | |
| 229 | 241 | private $comment_errors; |
| 230 | - protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
| 231 | - { |
|
| 242 | + protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
| 243 | + {
|
|
| 232 | 244 | if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
| 233 | 245 | { |
| 234 | 246 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
@@ -238,8 +250,8 @@ discard block |
||
| 238 | 250 | return; |
| 239 | 251 | } |
| 240 | 252 | |
| 241 | - protected function get_comment_array($site, $path) |
|
| 242 | - { |
|
| 253 | + protected function get_comment_array($site, $path) |
|
| 254 | + {
|
|
| 243 | 255 | global $container; |
| 244 | 256 | $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']); |
| 245 | 257 | $start = microtime(true); |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | $container['logger']->info("CommentService | Sidebar | {$elapsed}"); |
| 83 | 83 | |
| 84 | 84 | $array = array(); |
| 85 | - foreach($comment_response as $comment) |
|
| 85 | + foreach ($comment_response as $comment) |
|
| 86 | 86 | { |
| 87 | 87 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
| 88 | 88 | $body = strip_tags($body); |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | )); |
| 7 | 7 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
| 8 | 8 | |
| 9 | -final class HomeController extends DefaultPageController |
|
| 10 | -{ |
|
| 9 | +final class HomeController extends DefaultPageController |
|
| 10 | +{
|
|
| 11 | 11 | |
| 12 | 12 | private static $TITLE = 'Waterfalls of the Keweenaw | Stories and Tips from Jacob Emerick'; |
| 13 | 13 | private static $DESCRIPTION = 'Stories, maps, and details about many of the waterfalls in the Upper Peninsula of Michigan, compiled by Jacob Emerick.'; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | private static $BANNER_IMAGE = 2661; |
| 22 | 22 | |
| 23 | - protected function set_head_data() |
|
| 24 | - { |
|
| 23 | + protected function set_head_data() |
|
| 24 | + {
|
|
| 25 | 25 | parent::set_head_data(); |
| 26 | 26 | |
| 27 | 27 | $this->set_title(self::$TITLE); |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | $this->set_keywords(self::$KEYWORD_ARRAY); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - protected function set_body_data($page_type = 'wide') |
|
| 33 | - { |
|
| 32 | + protected function set_body_data($page_type = 'wide') |
|
| 33 | + {
|
|
| 34 | 34 | parent::set_body_data($page_type); |
| 35 | 35 | |
| 36 | 36 | $photo = PhotoCollector::getRow(self::$BANNER_IMAGE); |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | $this->set_body('view', 'Home'); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - protected function get_comments() |
|
| 63 | - { |
|
| 62 | + protected function get_comments() |
|
| 63 | + {
|
|
| 64 | 64 | global $container; |
| 65 | 65 | $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']); |
| 66 | 66 | $start = microtime(true); |
@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | use Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository; |
| 9 | 9 | |
| 10 | -class CommentSubmitModule |
|
| 11 | -{ |
|
| 10 | +class CommentSubmitModule |
|
| 11 | +{
|
|
| 12 | 12 | |
| 13 | 13 | private $site; |
| 14 | 14 | private $path; |
| 15 | 15 | private $fullPath; |
| 16 | 16 | |
| 17 | - public function __construct($site, $path, $fullPath, $pageTitle) |
|
| 18 | - { |
|
| 17 | + public function __construct($site, $path, $fullPath, $pageTitle) |
|
| 18 | + {
|
|
| 19 | 19 | $this->site = $site; |
| 20 | 20 | $this->path = $path; |
| 21 | 21 | $this->fullPath = $fullPath; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function activate() |
|
| 25 | - { |
|
| 24 | + public function activate() |
|
| 25 | + {
|
|
| 26 | 26 | // todo why is this responsible for checking on valid calls |
| 27 | 27 | if (!Request::hasPost()) { |
| 28 | 28 | return false; |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | $this->redirectToComment($commentId); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - private function checkValidation() |
|
| 48 | - { |
|
| 47 | + private function checkValidation() |
|
| 48 | + {
|
|
| 49 | 49 | $errors = array(); |
| 50 | 50 | if (!Validate::checkRequest('post', 'name', 'name')) { |
| 51 | 51 | $errors['name'] = 'You must include a valid name'; |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | return $errors; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - private function save(array $data) |
|
| 73 | - { |
|
| 72 | + private function save(array $data) |
|
| 73 | + {
|
|
| 74 | 74 | $path = $_SERVER['REQUEST_URI']; |
| 75 | 75 | $path = explode('/', $path); |
| 76 | 76 | $path = array_filter($path); |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | return $response->getId(); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - private function redirectToComment($commentId) |
|
| 110 | - { |
|
| 109 | + private function redirectToComment($commentId) |
|
| 110 | + {
|
|
| 111 | 111 | $url = ''; |
| 112 | 112 | $url .= $this->fullPath; |
| 113 | 113 | $url .= "#comment-{$commentId}"; |
@@ -107,6 +107,9 @@ |
||
| 107 | 107 | return $response['id']; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | + /** |
|
| 111 | + * @param null|string $commentId |
|
| 112 | + */ |
|
| 110 | 113 | private function redirectToComment($commentId) |
| 111 | 114 | { |
| 112 | 115 | $url = ''; |