@@ -39,20 +39,20 @@ discard block |
||
39 | 39 | public function perform() |
40 | 40 | { |
41 | 41 | $weighted_array = array(); |
42 | - foreach($this->result as $row) |
|
42 | + foreach ($this->result as $row) |
|
43 | 43 | { |
44 | 44 | $weight = $this->get_search_weight($row); |
45 | - if($weight > 0) |
|
45 | + if ($weight > 0) |
|
46 | 46 | $weighted_array[$row->id] = $weight; |
47 | 47 | } |
48 | 48 | arsort($weighted_array); |
49 | 49 | |
50 | 50 | $final_array = array(); |
51 | - foreach($weighted_array as $id => $weight) |
|
51 | + foreach ($weighted_array as $id => $weight) |
|
52 | 52 | { |
53 | - foreach($this->result as $row) |
|
53 | + foreach ($this->result as $row) |
|
54 | 54 | { |
55 | - if($row->id == $id) |
|
55 | + if ($row->id == $id) |
|
56 | 56 | $final_array[] = $row; |
57 | 57 | } |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function get_search_weight($row) |
63 | 63 | { |
64 | 64 | $weight = 0; |
65 | - foreach($this->weight as $weight_array) |
|
65 | + foreach ($this->weight as $weight_array) |
|
66 | 66 | { |
67 | 67 | $text = $row->{$weight_array['field']}; |
68 | 68 | $weight += $weight_array['weight'] * substr_count(strtolower($text), strtolower($this->query)); |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | foreach($this->result as $row) |
43 | 43 | { |
44 | 44 | $weight = $this->get_search_weight($row); |
45 | - if($weight > 0) |
|
46 | - $weighted_array[$row->id] = $weight; |
|
45 | + if($weight > 0) { |
|
46 | + $weighted_array[$row->id] = $weight; |
|
47 | + } |
|
47 | 48 | } |
48 | 49 | arsort($weighted_array); |
49 | 50 | |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | { |
53 | 54 | foreach($this->result as $row) |
54 | 55 | { |
55 | - if($row->id == $id) |
|
56 | - $final_array[] = $row; |
|
56 | + if($row->id == $id) { |
|
57 | + $final_array[] = $row; |
|
58 | + } |
|
57 | 59 | } |
58 | 60 | } |
59 | 61 | return $final_array; |
@@ -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 | } |
@@ -60,8 +60,9 @@ |
||
60 | 60 | { |
61 | 61 | $post_array[] = $this->format_post($post, true); |
62 | 62 | } |
63 | - if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
64 | - $this->eject(); |
|
63 | + if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') { |
|
64 | + $this->eject(); |
|
65 | + } |
|
65 | 66 | return $post_array; |
66 | 67 | } |
67 | 68 |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | |
34 | 34 | private function process_form() |
35 | 35 | { |
36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
36 | + if (!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
37 | 37 | return (object) array('display' => 'normal'); |
38 | 38 | |
39 | 39 | Loader::load('utility', 'Validate'); |
40 | 40 | $error_result = array(); |
41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
41 | + if (!Validate::checkRequest('post', 'name', 'string')) |
|
42 | 42 | $error_result['name'] = 'please enter your name'; |
43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
43 | + if (!Validate::checkRequest('post', 'email', 'string')) |
|
44 | 44 | $error_result['email'] = 'please enter a valid email'; |
45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
45 | + if (!Validate::checkRequest('post', 'message', 'string')) |
|
46 | 46 | $error_result['message'] = 'please write a message'; |
47 | 47 | |
48 | 48 | $values = (object) array( |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'email' => Request::getPost('email'), |
51 | 51 | 'message' => Request::getPost('message')); |
52 | 52 | |
53 | - if(count($error_result) > 0) |
|
53 | + if (count($error_result) > 0) |
|
54 | 54 | { |
55 | 55 | return (object) array( |
56 | 56 | 'display' => 'error', |
@@ -33,17 +33,21 @@ |
||
33 | 33 | |
34 | 34 | private function process_form() |
35 | 35 | { |
36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
37 | - return (object) array('display' => 'normal'); |
|
36 | + if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') { |
|
37 | + return (object) array('display' => 'normal'); |
|
38 | + } |
|
38 | 39 | |
39 | 40 | Loader::load('utility', 'Validate'); |
40 | 41 | $error_result = array(); |
41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
42 | - $error_result['name'] = 'please enter your name'; |
|
43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
44 | - $error_result['email'] = 'please enter a valid email'; |
|
45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
46 | - $error_result['message'] = 'please write a message'; |
|
42 | + if(!Validate::checkRequest('post', 'name', 'string')) { |
|
43 | + $error_result['name'] = 'please enter your name'; |
|
44 | + } |
|
45 | + if(!Validate::checkRequest('post', 'email', 'string')) { |
|
46 | + $error_result['email'] = 'please enter a valid email'; |
|
47 | + } |
|
48 | + if(!Validate::checkRequest('post', 'message', 'string')) { |
|
49 | + $error_result['message'] = 'please write a message'; |
|
50 | + } |
|
47 | 51 | |
48 | 52 | $values = (object) array( |
49 | 53 | 'name' => Request::getPost('name'), |
@@ -60,16 +60,16 @@ |
||
60 | 60 | 'values' => $values); |
61 | 61 | } |
62 | 62 | |
63 | - global $container; |
|
64 | - $sent = $container['mail'] |
|
65 | - ->addTo($container['config']->admin_email) |
|
66 | - ->setSubject('Home Page Contact') |
|
67 | - ->setPlainMessage( |
|
68 | - "Name: {$values->name}\n" . |
|
69 | - "Email: {$values->email}\n" . |
|
70 | - "Message: {$values->message}" |
|
71 | - ) |
|
72 | - ->send(); |
|
63 | + global $container; |
|
64 | + $sent = $container['mail'] |
|
65 | + ->addTo($container['config']->admin_email) |
|
66 | + ->setSubject('Home Page Contact') |
|
67 | + ->setPlainMessage( |
|
68 | + "Name: {$values->name}\n" . |
|
69 | + "Email: {$values->email}\n" . |
|
70 | + "Message: {$values->message}" |
|
71 | + ) |
|
72 | + ->send(); |
|
73 | 73 | |
74 | 74 | return (object) array('display' => 'success'); |
75 | 75 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | protected $connections; |
12 | 12 | |
13 | 13 | /** |
14 | - * @param ConnectonLocator $connections |
|
14 | + * @param ConnectionLocator $connections |
|
15 | 15 | */ |
16 | 16 | public function __construct(ConnectionLocator $connections) |
17 | 17 | { |
@@ -41,7 +41,6 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | - * @param string $title |
|
45 | 44 | * |
46 | 45 | * @return array|false |
47 | 46 | */ |
@@ -8,88 +8,88 @@ |
||
8 | 8 | class MysqlYouTubeRepository implements YouTubeRepositoryInterface |
9 | 9 | { |
10 | 10 | |
11 | - /** @var ConnectionLocator */ |
|
12 | - protected $connections; |
|
11 | + /** @var ConnectionLocator */ |
|
12 | + protected $connections; |
|
13 | 13 | |
14 | - /** |
|
15 | - * @param ConnectonLocator $connections |
|
16 | - */ |
|
17 | - public function __construct(ConnectionLocator $connections) |
|
18 | - { |
|
19 | - $this->connections = $connections; |
|
20 | - } |
|
14 | + /** |
|
15 | + * @param ConnectonLocator $connections |
|
16 | + */ |
|
17 | + public function __construct(ConnectionLocator $connections) |
|
18 | + { |
|
19 | + $this->connections = $connections; |
|
20 | + } |
|
21 | 21 | |
22 | - public function getYouTubes($limit = null, $offset = 0) |
|
23 | - { |
|
24 | - $query = " |
|
22 | + public function getYouTubes($limit = null, $offset = 0) |
|
23 | + { |
|
24 | + $query = " |
|
25 | 25 | SELECT `id`, `video_id`, `datetime` |
26 | 26 | FROM `jpemeric_stream`.`youtube` |
27 | 27 | ORDER BY `datetime` DESC"; |
28 | - if (!is_null($limit)) { |
|
29 | - $query .= " |
|
28 | + if (!is_null($limit)) { |
|
29 | + $query .= " |
|
30 | 30 | LIMIT {$offset}, {$limit}"; |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | - return $this |
|
34 | - ->connections |
|
35 | - ->getRead() |
|
36 | - ->fetchAll($query); |
|
37 | - } |
|
33 | + return $this |
|
34 | + ->connections |
|
35 | + ->getRead() |
|
36 | + ->fetchAll($query); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $title |
|
41 | - * |
|
42 | - * @return array|false |
|
43 | - */ |
|
44 | - public function getYouTubeByVideoId($videoId) |
|
45 | - { |
|
46 | - $query = " |
|
39 | + /** |
|
40 | + * @param string $title |
|
41 | + * |
|
42 | + * @return array|false |
|
43 | + */ |
|
44 | + public function getYouTubeByVideoId($videoId) |
|
45 | + { |
|
46 | + $query = " |
|
47 | 47 | SELECT * |
48 | 48 | FROM `jpemeric_stream`.`youtube` |
49 | 49 | WHERE `video_id` = :video_id |
50 | 50 | LIMIT 1"; |
51 | - $bindings = [ |
|
52 | - 'video_id' => $videoId, |
|
53 | - ]; |
|
51 | + $bindings = [ |
|
52 | + 'video_id' => $videoId, |
|
53 | + ]; |
|
54 | 54 | |
55 | - return $this |
|
56 | - ->connections |
|
57 | - ->getRead() |
|
58 | - ->fetchOne($query, $bindings); |
|
59 | - } |
|
55 | + return $this |
|
56 | + ->connections |
|
57 | + ->getRead() |
|
58 | + ->fetchOne($query, $bindings); |
|
59 | + } |
|
60 | 60 | |
61 | - public function getYouTubesUpdatedSince(DateTime $datetime) |
|
62 | - { |
|
63 | - $query = " |
|
61 | + public function getYouTubesUpdatedSince(DateTime $datetime) |
|
62 | + { |
|
63 | + $query = " |
|
64 | 64 | SELECT * |
65 | 65 | FROM `jpemeric_stream`.`youtube` |
66 | 66 | WHERE `updated_at` >= :last_update"; |
67 | - $bindings = [ |
|
68 | - 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
69 | - ]; |
|
70 | - return $this |
|
71 | - ->connections |
|
72 | - ->getRead() |
|
73 | - ->fetchAll($query, $bindings); |
|
74 | - } |
|
67 | + $bindings = [ |
|
68 | + 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
69 | + ]; |
|
70 | + return $this |
|
71 | + ->connections |
|
72 | + ->getRead() |
|
73 | + ->fetchAll($query, $bindings); |
|
74 | + } |
|
75 | 75 | |
76 | - public function insertVideo($videoId, DateTime $datetime, array $metadata) |
|
77 | - { |
|
78 | - $query = " |
|
76 | + public function insertVideo($videoId, DateTime $datetime, array $metadata) |
|
77 | + { |
|
78 | + $query = " |
|
79 | 79 | INSERT INTO `jpemeric_stream`.`youtube` |
80 | 80 | (`video_id`, `datetime`, `metadata`) |
81 | 81 | VALUES |
82 | 82 | (:video_id, :datetime, :metadata)"; |
83 | 83 | |
84 | - $bindings = [ |
|
85 | - 'video_id' => $videoId, |
|
86 | - 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
87 | - 'metadata' => json_encode($metadata), |
|
88 | - ]; |
|
84 | + $bindings = [ |
|
85 | + 'video_id' => $videoId, |
|
86 | + 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
87 | + 'metadata' => json_encode($metadata), |
|
88 | + ]; |
|
89 | 89 | |
90 | - return $this |
|
91 | - ->connections |
|
92 | - ->getWrite() |
|
93 | - ->perform($query, $bindings); |
|
94 | - } |
|
90 | + return $this |
|
91 | + ->connections |
|
92 | + ->getWrite() |
|
93 | + ->perform($query, $bindings); |
|
94 | + } |
|
95 | 95 | } |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | parent::__construct(); |
21 | 21 | |
22 | 22 | $id = URLDecode::getPiece(2); |
23 | - if(!$id || !is_numeric($id)) |
|
23 | + if (!$id || !is_numeric($id)) |
|
24 | 24 | $this->eject(); |
25 | 25 | |
26 | 26 | $post = $this->postRepository->getPostById($id); |
27 | - if(!$post) |
|
27 | + if (!$post) |
|
28 | 28 | $this->eject(); |
29 | 29 | |
30 | - if(URLDecode::getPiece(1) != $post['type']) |
|
30 | + if (URLDecode::getPiece(1) != $post['type']) |
|
31 | 31 | $this->eject(); |
32 | 32 | |
33 | 33 | $this->post = $post; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | private function get_title() |
61 | 61 | { |
62 | - switch($this->post['type']) |
|
62 | + switch ($this->post['type']) |
|
63 | 63 | { |
64 | 64 | case 'blog' : |
65 | 65 | return 'Jacob blogged'; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | private function get_description() |
86 | 86 | { |
87 | - switch($this->post['type']) |
|
87 | + switch ($this->post['type']) |
|
88 | 88 | { |
89 | 89 | case 'blog' : |
90 | 90 | return 'Another awesome blog post from Jacob. Did I mention it was awesome?'; |
@@ -20,15 +20,18 @@ |
||
20 | 20 | parent::__construct(); |
21 | 21 | |
22 | 22 | $id = URLDecode::getPiece(2); |
23 | - if(!$id || !is_numeric($id)) |
|
24 | - $this->eject(); |
|
23 | + if(!$id || !is_numeric($id)) { |
|
24 | + $this->eject(); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | $post = $this->postRepository->getPostById($id); |
27 | - if(!$post) |
|
28 | - $this->eject(); |
|
28 | + if(!$post) { |
|
29 | + $this->eject(); |
|
30 | + } |
|
29 | 31 | |
30 | - if(URLDecode::getPiece(1) != $post['type']) |
|
31 | - $this->eject(); |
|
32 | + if(URLDecode::getPiece(1) != $post['type']) { |
|
33 | + $this->eject(); |
|
34 | + } |
|
32 | 35 | |
33 | 36 | $this->post = $post; |
34 | 37 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | case 'distance' : |
71 | 71 | return 'Jacob ran xor hiked'; |
72 | 72 | break; |
73 | - case 'github' : |
|
74 | - return 'Jacob did code'; |
|
75 | - break; |
|
73 | + case 'github' : |
|
74 | + return 'Jacob did code'; |
|
75 | + break; |
|
76 | 76 | case 'hulu' : |
77 | 77 | return 'What Jacob watched'; |
78 | 78 | break; |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | case 'distance' : |
99 | 99 | return 'Well, it might have been both at the same time if there was a bear.'; |
100 | 100 | break; |
101 | - case 'github' : |
|
102 | - return 'An epic code change by Jacob on the Githubs.'; |
|
103 | - break; |
|
101 | + case 'github' : |
|
102 | + return 'An epic code change by Jacob on the Githubs.'; |
|
103 | + break; |
|
104 | 104 | case 'hulu' : |
105 | 105 | return 'It was a cold, dark night, so Jacob watched something on Hulu.'; |
106 | 106 | break; |
@@ -32,37 +32,37 @@ |
||
32 | 32 | |
33 | 33 | private function get_sites() |
34 | 34 | { |
35 | - return [ |
|
36 | - [ |
|
37 | - 'url' => 'http://home.jacobemerick.com/', |
|
38 | - 'title' => "Jacob Emerick's Home", |
|
39 | - 'name' => 'Home' |
|
40 | - ], |
|
41 | - [ |
|
42 | - 'url' => 'http://blog.jacobemerick.com/', |
|
43 | - 'title' => "Jacob Emerick's Blog", |
|
44 | - 'name' => 'Blog' |
|
45 | - ], |
|
46 | - [ |
|
47 | - 'url' => 'http://lifestream.jacobemerick.com/', |
|
48 | - 'title' => "Jacob Emerick's Lifestream", |
|
49 | - 'name' => 'Lifestream' |
|
50 | - ], |
|
51 | - [ |
|
52 | - 'url' => 'http://map.jacobemerick.com/', |
|
53 | - 'title' => "Jacob Emerick's Hiking Map", |
|
54 | - 'name' => 'Map' |
|
55 | - ], |
|
56 | - [ |
|
57 | - 'url' => 'http://portfolio.jacobemerick.com/', |
|
58 | - 'title' => "Jacob Emerick's Portfolio", |
|
59 | - 'name' => 'Portfolio', |
|
60 | - ], |
|
61 | - [ |
|
62 | - 'url' => 'http://www.waterfallsofthekeweenaw.com/', |
|
63 | - 'title' => 'Waterfalls of the Keweenaw', |
|
64 | - 'name' => 'Waterfalls' |
|
65 | - ] |
|
35 | + return [ |
|
36 | + [ |
|
37 | + 'url' => 'http://home.jacobemerick.com/', |
|
38 | + 'title' => "Jacob Emerick's Home", |
|
39 | + 'name' => 'Home' |
|
40 | + ], |
|
41 | + [ |
|
42 | + 'url' => 'http://blog.jacobemerick.com/', |
|
43 | + 'title' => "Jacob Emerick's Blog", |
|
44 | + 'name' => 'Blog' |
|
45 | + ], |
|
46 | + [ |
|
47 | + 'url' => 'http://lifestream.jacobemerick.com/', |
|
48 | + 'title' => "Jacob Emerick's Lifestream", |
|
49 | + 'name' => 'Lifestream' |
|
50 | + ], |
|
51 | + [ |
|
52 | + 'url' => 'http://map.jacobemerick.com/', |
|
53 | + 'title' => "Jacob Emerick's Hiking Map", |
|
54 | + 'name' => 'Map' |
|
55 | + ], |
|
56 | + [ |
|
57 | + 'url' => 'http://portfolio.jacobemerick.com/', |
|
58 | + 'title' => "Jacob Emerick's Portfolio", |
|
59 | + 'name' => 'Portfolio', |
|
60 | + ], |
|
61 | + [ |
|
62 | + 'url' => 'http://www.waterfallsofthekeweenaw.com/', |
|
63 | + 'title' => 'Waterfalls of the Keweenaw', |
|
64 | + 'name' => 'Waterfalls' |
|
65 | + ] |
|
66 | 66 | ]; |
67 | 67 | } |
68 | 68 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | protected static $WATERFALL_SITE_ID = 5; |
12 | 12 | |
13 | - protected $parent_navigation_item = ''; |
|
13 | + protected $parent_navigation_item = ''; |
|
14 | 14 | |
15 | 15 | protected function set_head_data() |
16 | 16 | { |
@@ -19,45 +19,45 @@ discard block |
||
19 | 19 | $this->add_css('waterfalls'); |
20 | 20 | } |
21 | 21 | |
22 | - protected function add_waterfall_js() |
|
23 | - { |
|
24 | - $this->add_js('jquery'); |
|
25 | - $this->add_js('imagelightbox'); |
|
26 | - $this->add_js('waterfalls'); |
|
27 | - } |
|
22 | + protected function add_waterfall_js() |
|
23 | + { |
|
24 | + $this->add_js('jquery'); |
|
25 | + $this->add_js('imagelightbox'); |
|
26 | + $this->add_js('waterfalls'); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | protected function set_body_data($page_type = 'normal') |
30 | 30 | { |
31 | 31 | $this->set_body('activity_array', $this->get_recent_activity()); |
32 | 32 | |
33 | - $this->set_body('main_navigation', array( |
|
34 | - (object) array( |
|
35 | - 'uri' => '/falls/', |
|
36 | - 'anchor' => 'Falls', |
|
37 | - 'is_active' => $this->parent_navigation_item === 'falls', |
|
38 | - ), |
|
39 | - (object) array( |
|
40 | - 'uri' => '/map/', |
|
41 | - 'anchor' => 'Map', |
|
42 | - 'is_active' => $this->parent_navigation_item === 'map', |
|
43 | - ), |
|
44 | - (object) array( |
|
45 | - 'uri' => '/journal/', |
|
46 | - 'anchor' => 'Journal', |
|
47 | - 'is_active' => $this->parent_navigation_item === 'journal', |
|
48 | - ), |
|
49 | - (object) array( |
|
50 | - 'uri' => '/about/', |
|
51 | - 'anchor' => 'About', |
|
52 | - 'is_active' => $this->parent_navigation_item === 'about', |
|
53 | - ) |
|
54 | - )); |
|
55 | - |
|
56 | - if ($page_type == 'wide') { |
|
57 | - $this->set_body_view('WidePage'); |
|
58 | - } else { |
|
59 | - $this->set_body_view('Page'); |
|
60 | - } |
|
61 | - } |
|
33 | + $this->set_body('main_navigation', array( |
|
34 | + (object) array( |
|
35 | + 'uri' => '/falls/', |
|
36 | + 'anchor' => 'Falls', |
|
37 | + 'is_active' => $this->parent_navigation_item === 'falls', |
|
38 | + ), |
|
39 | + (object) array( |
|
40 | + 'uri' => '/map/', |
|
41 | + 'anchor' => 'Map', |
|
42 | + 'is_active' => $this->parent_navigation_item === 'map', |
|
43 | + ), |
|
44 | + (object) array( |
|
45 | + 'uri' => '/journal/', |
|
46 | + 'anchor' => 'Journal', |
|
47 | + 'is_active' => $this->parent_navigation_item === 'journal', |
|
48 | + ), |
|
49 | + (object) array( |
|
50 | + 'uri' => '/about/', |
|
51 | + 'anchor' => 'About', |
|
52 | + 'is_active' => $this->parent_navigation_item === 'about', |
|
53 | + ) |
|
54 | + )); |
|
55 | + |
|
56 | + if ($page_type == 'wide') { |
|
57 | + $this->set_body_view('WidePage'); |
|
58 | + } else { |
|
59 | + $this->set_body_view('Page'); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -12,9 +12,9 @@ |
||
12 | 12 | |
13 | 13 | $portfolio_result = PortfolioCollector::getImageById($id); |
14 | 14 | |
15 | - $image_path = "portfolio/{$portfolio_result->name}"; |
|
16 | - $image_path = Loader::getImagePath('image', $image_path); |
|
17 | - $image_size = getimagesize($image_path); |
|
15 | + $image_path = "portfolio/{$portfolio_result->name}"; |
|
16 | + $image_path = Loader::getImagePath('image', $image_path); |
|
17 | + $image_size = getimagesize($image_path); |
|
18 | 18 | |
19 | 19 | $main_image = new stdclass(); |
20 | 20 | $main_image->id = $portfolio_result->id; |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
81 | 81 | $redirect_uri .= '/'; |
82 | 82 | |
83 | - if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
84 | - $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
85 | - } |
|
83 | + if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
84 | + $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | if($redirect_uri == URLDecode::getURI()) |
88 | 88 | return; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | URLDecode::getExtension() != 'json' && |
148 | 148 | URLDecode::getExtension() != 'jpg' && |
149 | 149 | URLDecode::getExtension() != 'png' && |
150 | - strstr(URLDecode::getURI(), '#') === false); |
|
150 | + strstr(URLDecode::getURI(), '#') === false); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | } |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
21 | + if (Request::isAJAX()) |
|
22 | 22 | return 'AJAXRouter'; |
23 | 23 | |
24 | - switch(URLDecode::getSite()) |
|
24 | + switch (URLDecode::getSite()) |
|
25 | 25 | { |
26 | 26 | case 'ajax' : |
27 | 27 | return 'AjaxRouter'; |
@@ -66,36 +66,36 @@ discard block |
||
66 | 66 | |
67 | 67 | final protected function check_for_redirect($redirect_uri) |
68 | 68 | { |
69 | - foreach($this->get_redirect_array() as $check) |
|
69 | + foreach ($this->get_redirect_array() as $check) |
|
70 | 70 | { |
71 | 71 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
72 | 72 | } |
73 | 73 | |
74 | 74 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
75 | 75 | |
76 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
76 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
77 | 77 | $redirect_uri .= '/'; |
78 | 78 | |
79 | 79 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
80 | 80 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
81 | 81 | } |
82 | 82 | |
83 | - if($redirect_uri == URLDecode::getURI()) |
|
83 | + if ($redirect_uri == URLDecode::getURI()) |
|
84 | 84 | return; |
85 | 85 | |
86 | 86 | $controller_check = $redirect_uri; |
87 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
87 | + if (substr($redirect_uri, 0, 4) == 'http') |
|
88 | 88 | $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
89 | 89 | |
90 | 90 | $controller = $this->get_controller($controller_check); |
91 | - if($controller == '/Error404Controller') |
|
91 | + if ($controller == '/Error404Controller') |
|
92 | 92 | { |
93 | 93 | Loader::loadNew('controller', '/Error404Controller') |
94 | 94 | ->activate(); |
95 | 95 | exit; |
96 | 96 | } |
97 | 97 | |
98 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
98 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
99 | 99 | { |
100 | 100 | $redirect_uri = substr($redirect_uri, 1); |
101 | 101 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | |
113 | 113 | final private function get_controller($uri) |
114 | 114 | { |
115 | - foreach($this->get_direct_array() as $check) |
|
115 | + foreach ($this->get_direct_array() as $check) |
|
116 | 116 | { |
117 | - if($uri == $check->match) |
|
117 | + if ($uri == $check->match) |
|
118 | 118 | return "{$this->get_primary_folder()}/{$check->controller}"; |
119 | 119 | |
120 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
120 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
121 | 121 | return "{$this->get_primary_folder()}/{$check->controller}"; |
122 | 122 | } |
123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | final private function get_primary_folder() |
128 | 128 | { |
129 | - if(Request::isAjax()) |
|
129 | + if (Request::isAjax()) |
|
130 | 130 | return 'ajax'; |
131 | 131 | |
132 | 132 | return URLDecode::getSite(); |
@@ -18,8 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
22 | - return 'AJAXRouter'; |
|
21 | + if(Request::isAJAX()) { |
|
22 | + return 'AJAXRouter'; |
|
23 | + } |
|
23 | 24 | |
24 | 25 | switch(URLDecode::getSite()) |
25 | 26 | { |
@@ -73,19 +74,22 @@ discard block |
||
73 | 74 | |
74 | 75 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
75 | 76 | |
76 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
77 | - $redirect_uri .= '/'; |
|
77 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') { |
|
78 | + $redirect_uri .= '/'; |
|
79 | + } |
|
78 | 80 | |
79 | 81 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
80 | 82 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
81 | 83 | } |
82 | 84 | |
83 | - if($redirect_uri == URLDecode::getURI()) |
|
84 | - return; |
|
85 | + if($redirect_uri == URLDecode::getURI()) { |
|
86 | + return; |
|
87 | + } |
|
85 | 88 | |
86 | 89 | $controller_check = $redirect_uri; |
87 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
88 | - $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
90 | + if(substr($redirect_uri, 0, 4) == 'http') { |
|
91 | + $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
92 | + } |
|
89 | 93 | |
90 | 94 | $controller = $this->get_controller($controller_check); |
91 | 95 | if($controller == '/Error404Controller') |
@@ -114,11 +118,13 @@ discard block |
||
114 | 118 | { |
115 | 119 | foreach($this->get_direct_array() as $check) |
116 | 120 | { |
117 | - if($uri == $check->match) |
|
118 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
121 | + if($uri == $check->match) { |
|
122 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
123 | + } |
|
119 | 124 | |
120 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
121 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
125 | + if(preg_match("@^{$check->match}$@", $uri)) { |
|
126 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
127 | + } |
|
122 | 128 | } |
123 | 129 | |
124 | 130 | return '/Error404Controller'; |
@@ -126,8 +132,9 @@ discard block |
||
126 | 132 | |
127 | 133 | final private function get_primary_folder() |
128 | 134 | { |
129 | - if(Request::isAjax()) |
|
130 | - return 'ajax'; |
|
135 | + if(Request::isAjax()) { |
|
136 | + return 'ajax'; |
|
137 | + } |
|
131 | 138 | |
132 | 139 | return URLDecode::getSite(); |
133 | 140 | } |