@@ -2,15 +2,15 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Content'); |
4 | 4 | |
5 | -final class FixPhotoContent extends Content |
|
6 | -{ |
|
5 | +final class FixPhotoContent extends Content |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $PHOTO_PLACEHOLDER_MATCH = '@{{photo="(.*)"}}@'; |
9 | 9 | private static $ERROR_CONTENT = '<div class="photo-holder"><p class="photo-caption">Image (%s) could not be found!</p></div>'; |
10 | 10 | private static $PHOTO_CONTENT = '<div class="photo-holder"><img src="%sphoto/%s/%s-size-%s.jpg" height="%d" width="%d" alt="%s" /><p class="photo-caption">%s</p></div>'; |
11 | 11 | |
12 | - protected function execute($is_absolute = false, $size = 'medium') |
|
13 | - { |
|
12 | + protected function execute($is_absolute = false, $size = 'medium') |
|
13 | + { |
|
14 | 14 | preg_match_all(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $matches); |
15 | 15 | foreach($matches[1] as $key => $match) |
16 | 16 | { |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
23 | - private function get_file_path($category, $photo, $size, $extension) |
|
24 | - { |
|
23 | + private function get_file_path($category, $photo, $size, $extension) |
|
24 | + { |
|
25 | 25 | $path = "{$category}/{$photo}-size-{$size}.{$extension}"; |
26 | 26 | return Loader::getImagePath('photo', $path); |
27 | 27 | } |
28 | 28 | |
29 | - private function get_photo_content($string, $size, $is_absolute) |
|
30 | - { |
|
29 | + private function get_photo_content($string, $size, $is_absolute) |
|
30 | + { |
|
31 | 31 | list($category, $file_name) = explode('/', $string); |
32 | 32 | list($photo, $extension) = explode('.', $file_name); |
33 | 33 | |
@@ -37,16 +37,18 @@ discard block |
||
37 | 37 | |
38 | 38 | Loader::load('collector', 'image/PhotoCollector'); |
39 | 39 | $photo_result = PhotoCollector::fetchRow($category, $photo); |
40 | - if($photo_result == false) |
|
41 | - return ''; |
|
40 | + if($photo_result == false) { |
|
41 | + return ''; |
|
42 | + } |
|
42 | 43 | |
43 | 44 | $height = $file_size[1]; |
44 | 45 | $width = $file_size[0]; |
45 | 46 | $description = $photo_result->description; |
46 | 47 | |
47 | 48 | $domain = '/'; |
48 | - if($is_absolute) |
|
49 | - $domain = Loader::getRootUrl('blog'); |
|
49 | + if($is_absolute) { |
|
50 | + $domain = Loader::getRootUrl('blog'); |
|
51 | + } |
|
50 | 52 | |
51 | 53 | return sprintf(self::$PHOTO_CONTENT, $domain, $category, $photo, $size, $height, $width, $description, $description); |
52 | 54 | } |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Content'); |
4 | 4 | |
5 | -class URLSafeContent extends Content |
|
6 | -{ |
|
5 | +class URLSafeContent extends Content |
|
6 | +{ |
|
7 | 7 | |
8 | - protected function execute() |
|
9 | - { |
|
8 | + protected function execute() |
|
9 | + { |
|
10 | 10 | $this->content = strtolower(str_replace(' ', '-', $this->content)); |
11 | 11 | } |
12 | 12 |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Content'); |
4 | 4 | |
5 | -final class CleanCommentContent extends Content |
|
6 | -{ |
|
5 | +final class CleanCommentContent extends Content |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $LINK_PATTERN = '@<a.*href=["\']([^"\']*)["\'].*>(.*)</a>@i'; |
9 | 9 | private static $BOLD_PATTERN = '@<b.*>(.*)</b>@i'; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | |
23 | 23 | private $replacement_array = array(); |
24 | 24 | |
25 | - protected function execute() |
|
26 | - { |
|
25 | + protected function execute() |
|
26 | + { |
|
27 | 27 | $this->process_element(self::$CODE_PATTERN, self::$CODE_REPLACE); |
28 | 28 | $this->process_element(self::$LINK_PATTERN, self::$LINK_REPLACE); |
29 | 29 | $this->process_element(self::$ITALIC_PATTERN, self::$ITALIC_REPLACE); |
@@ -36,12 +36,13 @@ discard block |
||
36 | 36 | $this->replace_element_patterns(); |
37 | 37 | } |
38 | 38 | |
39 | - private function process_element($pattern, $replace) |
|
40 | - { |
|
39 | + private function process_element($pattern, $replace) |
|
40 | + { |
|
41 | 41 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
42 | 42 | |
43 | - if($match_count < 1) |
|
44 | - return; |
|
43 | + if($match_count < 1) { |
|
44 | + return; |
|
45 | + } |
|
45 | 46 | |
46 | 47 | foreach($matches as $match) |
47 | 48 | { |
@@ -54,13 +55,13 @@ discard block |
||
54 | 55 | } |
55 | 56 | } |
56 | 57 | |
57 | - private function create_placeholder($text) |
|
58 | - { |
|
58 | + private function create_placeholder($text) |
|
59 | + { |
|
59 | 60 | return md5($text . rand()); |
60 | 61 | } |
61 | 62 | |
62 | - private function create_full_match_pattern($text) |
|
63 | - { |
|
63 | + private function create_full_match_pattern($text) |
|
64 | + { |
|
64 | 65 | $pattern = ''; |
65 | 66 | $pattern .= '@'; |
66 | 67 | $pattern .= preg_quote($text, '@'); |
@@ -70,17 +71,18 @@ discard block |
||
70 | 71 | return $pattern; |
71 | 72 | } |
72 | 73 | |
73 | - private function strip_extra_tags() |
|
74 | - { |
|
74 | + private function strip_extra_tags() |
|
75 | + { |
|
75 | 76 | $this->content = strip_tags($this->content); |
76 | 77 | } |
77 | 78 | |
78 | - private function link_unlinked_urls($pattern, $replace) |
|
79 | - { |
|
79 | + private function link_unlinked_urls($pattern, $replace) |
|
80 | + { |
|
80 | 81 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
81 | 82 | |
82 | - if($match_count < 1) |
|
83 | - return; |
|
83 | + if($match_count < 1) { |
|
84 | + return; |
|
85 | + } |
|
84 | 86 | |
85 | 87 | foreach($matches as $match) |
86 | 88 | { |
@@ -92,13 +94,13 @@ discard block |
||
92 | 94 | } |
93 | 95 | } |
94 | 96 | |
95 | - private function add_line_breaks() |
|
96 | - { |
|
97 | + private function add_line_breaks() |
|
98 | + { |
|
97 | 99 | $this->content = preg_replace(self::$LINE_BREAK_PATTERN, self::$LINE_BREAK_REPLACE, $this->content); |
98 | 100 | } |
99 | 101 | |
100 | - private function replace_element_patterns() |
|
101 | - { |
|
102 | + private function replace_element_patterns() |
|
103 | + { |
|
102 | 104 | foreach($this->replacement_array as $key => $replace) |
103 | 105 | { |
104 | 106 | $this->content = str_replace($key, $replace, $this->content); |
@@ -2,30 +2,31 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Content'); |
4 | 4 | |
5 | -final class FetchFirstPhotoContent extends Content |
|
6 | -{ |
|
5 | +final class FetchFirstPhotoContent extends Content |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $PHOTO_PLACEHOLDER_MATCH = '@{{photo="(.*)"}}@'; |
9 | 9 | private static $IMAGE_NODE = '<img src="%sphoto/%s/%s-size-%s.%s" height="%d" width="%d" alt="%s" />'; |
10 | 10 | private static $DEFAULT_RETURN = ''; |
11 | 11 | |
12 | - protected function execute($is_absolute = false, $size = 'thumb') |
|
13 | - { |
|
14 | - if(preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1) |
|
15 | - $this->content = $this->get_thumb($match[1], $is_absolute, $size); |
|
16 | - else |
|
17 | - $this->content = self::$DEFAULT_RETURN; |
|
12 | + protected function execute($is_absolute = false, $size = 'thumb') |
|
13 | + { |
|
14 | + if(preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1) { |
|
15 | + $this->content = $this->get_thumb($match[1], $is_absolute, $size); |
|
16 | + } else { |
|
17 | + $this->content = self::$DEFAULT_RETURN; |
|
18 | + } |
|
18 | 19 | return; |
19 | 20 | } |
20 | 21 | |
21 | - private function get_file_path($category, $photo, $size, $extension) |
|
22 | - { |
|
22 | + private function get_file_path($category, $photo, $size, $extension) |
|
23 | + { |
|
23 | 24 | $path = "{$category}/{$photo}-size-{$size}.{$extension}"; |
24 | 25 | return Loader::getImagePath('photo', $path); |
25 | 26 | } |
26 | 27 | |
27 | - private function get_thumb($string, $is_absolute, $size) |
|
28 | - { |
|
28 | + private function get_thumb($string, $is_absolute, $size) |
|
29 | + { |
|
29 | 30 | list($category, $file_name) = explode('/', $string); |
30 | 31 | list($photo, $extension) = explode('.', $file_name); |
31 | 32 | |
@@ -34,16 +35,18 @@ discard block |
||
34 | 35 | |
35 | 36 | Loader::load('collector', 'image/PhotoCollector'); |
36 | 37 | $photo_result = PhotoCollector::fetchRow($category, $photo); |
37 | - if($photo_result == false) |
|
38 | - return ''; |
|
38 | + if($photo_result == false) { |
|
39 | + return ''; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $height = $file_size[1]; |
41 | 43 | $width = $file_size[0]; |
42 | 44 | $description = $photo_result->description; |
43 | 45 | |
44 | 46 | $domain = '/'; |
45 | - if($is_absolute) |
|
46 | - $domain = Loader::getRootURL(URLDecode::getSite()); |
|
47 | + if($is_absolute) { |
|
48 | + $domain = Loader::getRootURL(URLDecode::getSite()); |
|
49 | + } |
|
47 | 50 | |
48 | 51 | return sprintf(self::$IMAGE_NODE, $domain, $category, $photo, $size, $extension, $height, $width, $description); |
49 | 52 | } |
@@ -2,29 +2,30 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Content'); |
4 | 4 | |
5 | -final class FixInternalLinkContent extends Content |
|
6 | -{ |
|
5 | +final class FixInternalLinkContent extends Content |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $LINK_PLACEHOLDER_MATCH = '@{{link="([a-z0-9/-]*)"( anchor="([a-zA-Z0-9\s]*)")?}}@'; |
9 | 9 | private static $ERROR_CONTENT = '<span>%s</span>'; |
10 | 10 | private static $LINK_CONTENT = '<a href="%s" target="_blank" />%s</a>'; |
11 | 11 | |
12 | - protected function execute($is_absolute = true) |
|
13 | - { |
|
12 | + protected function execute($is_absolute = true) |
|
13 | + { |
|
14 | 14 | preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches); |
15 | 15 | foreach($matches[1] as $key => $match) |
16 | 16 | { |
17 | - if(isset($matches[3][$key])) |
|
18 | - $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
19 | - else |
|
20 | - $link_content = $this->get_link($match, $is_absolute); |
|
17 | + if(isset($matches[3][$key])) { |
|
18 | + $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
19 | + } else { |
|
20 | + $link_content = $this->get_link($match, $is_absolute); |
|
21 | + } |
|
21 | 22 | $this->content = str_replace($matches[0][$key], $link_content, $this->content); |
22 | 23 | } |
23 | 24 | return; |
24 | 25 | } |
25 | 26 | |
26 | - private function get_link($string, $is_absolute, $anchor = '') |
|
27 | - { |
|
27 | + private function get_link($string, $is_absolute, $anchor = '') |
|
28 | + { |
|
28 | 29 | list($type, $uri) = explode('/', $string, 2); |
29 | 30 | |
30 | 31 | $link = ''; |
@@ -36,14 +37,16 @@ discard block |
||
36 | 37 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
37 | 38 | $post = $repository->findPostByPath($uri); |
38 | 39 | |
39 | - if($post === NULL) |
|
40 | - return; |
|
40 | + if($post === NULL) { |
|
41 | + return; |
|
42 | + } |
|
41 | 43 | |
42 | 44 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
43 | 45 | $link .= "{$post['category']}/{$post['path']}/"; |
44 | 46 | |
45 | - if($anchor == '') |
|
46 | - $anchor = $post['title']; |
|
47 | + if($anchor == '') { |
|
48 | + $anchor = $post['title']; |
|
49 | + } |
|
47 | 50 | |
48 | 51 | break; |
49 | 52 | case 'blog-tag' : |
@@ -62,14 +65,16 @@ discard block |
||
62 | 65 | Loader::load('collector', 'waterfall/LogCollector'); |
63 | 66 | $log = LogCollector::getByAlias($uri); |
64 | 67 | |
65 | - if($log === NULL) |
|
66 | - return; |
|
68 | + if($log === NULL) { |
|
69 | + return; |
|
70 | + } |
|
67 | 71 | |
68 | 72 | $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
69 | 73 | $link .= "journal/{$log->alias}/"; |
70 | 74 | |
71 | - if($anchor == '') |
|
72 | - $anchor = $log->title; |
|
75 | + if($anchor == '') { |
|
76 | + $anchor = $log->title; |
|
77 | + } |
|
73 | 78 | |
74 | 79 | break; |
75 | 80 | case 'falls' : |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Content'); |
4 | 4 | |
5 | -final class ImperialUnitContent extends Content |
|
6 | -{ |
|
5 | +final class ImperialUnitContent extends Content |
|
6 | +{ |
|
7 | 7 | |
8 | - protected function execute($type = '') |
|
9 | - { |
|
8 | + protected function execute($type = '') |
|
9 | + { |
|
10 | 10 | $number = floatval($this->content); |
11 | 11 | $number *= 39.37; // convert to inches |
12 | 12 |
@@ -1,49 +1,50 @@ discard block |
||
1 | 1 | <? |
2 | 2 | |
3 | -final class Search |
|
4 | -{ |
|
3 | +final class Search |
|
4 | +{ |
|
5 | 5 | |
6 | 6 | private $query; |
7 | 7 | private $result; |
8 | 8 | private $weight; |
9 | 9 | |
10 | - function __construct() |
|
11 | - { |
|
10 | + function __construct() |
|
11 | + { |
|
12 | 12 | return $this; |
13 | 13 | } |
14 | 14 | |
15 | - public function setQuery($query) |
|
16 | - { |
|
15 | + public function setQuery($query) |
|
16 | + { |
|
17 | 17 | $this->query = $query; |
18 | 18 | return $this; |
19 | 19 | } |
20 | 20 | |
21 | - public function setResult($array) |
|
22 | - { |
|
21 | + public function setResult($array) |
|
22 | + { |
|
23 | 23 | $this->result = $array; |
24 | 24 | return $this; |
25 | 25 | } |
26 | 26 | |
27 | - public function setWeight($weight) |
|
28 | - { |
|
27 | + public function setWeight($weight) |
|
28 | + { |
|
29 | 29 | $this->weight = $weight; |
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public static function instance() |
|
34 | - { |
|
33 | + public static function instance() |
|
34 | + { |
|
35 | 35 | $reflection = new ReflectionClass('Search'); |
36 | 36 | return $reflection->newInstance(); |
37 | 37 | } |
38 | 38 | |
39 | - public function perform() |
|
40 | - { |
|
39 | + public function perform() |
|
40 | + { |
|
41 | 41 | $weighted_array = array(); |
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,15 +53,16 @@ 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; |
60 | 62 | } |
61 | 63 | |
62 | - private function get_search_weight($row) |
|
63 | - { |
|
64 | + private function get_search_weight($row) |
|
65 | + { |
|
64 | 66 | $weight = 0; |
65 | 67 | foreach($this->weight as $weight_array) |
66 | 68 | { |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <? |
2 | 2 | |
3 | -final class Header |
|
4 | -{ |
|
3 | +final class Header |
|
4 | +{ |
|
5 | 5 | |
6 | - public static function sendJSON() |
|
7 | - { |
|
6 | + public static function sendJSON() |
|
7 | + { |
|
8 | 8 | $array = array( |
9 | 9 | 'HTTP/1.1 200 OK', |
10 | 10 | 'Cache-Control: no-cache', |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | self::send($array); |
17 | 17 | } |
18 | 18 | |
19 | - public static function sendHTML() |
|
20 | - { |
|
19 | + public static function sendHTML() |
|
20 | + { |
|
21 | 21 | $array = array( |
22 | 22 | 'HTTP/1.1 200 OK', |
23 | 23 | 'Cache-Control: no-cache', |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | self::send($array); |
30 | 30 | } |
31 | 31 | |
32 | - public static function redirect($location, $method = 301) |
|
33 | - { |
|
32 | + public static function redirect($location, $method = 301) |
|
33 | + { |
|
34 | 34 | header("Location: {$location}", TRUE, $method); |
35 | 35 | exit(); |
36 | 36 | } |
37 | 37 | |
38 | - public static function send404() |
|
39 | - { |
|
38 | + public static function send404() |
|
39 | + { |
|
40 | 40 | $array = array( |
41 | 41 | 'HTTP/1.1 404 Not Found', |
42 | 42 | 'Cache-Control: no-cache', |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | self::send($array); |
49 | 49 | } |
50 | 50 | |
51 | - public static function send503() |
|
52 | - { |
|
51 | + public static function send503() |
|
52 | + { |
|
53 | 53 | $array = array( |
54 | 54 | 'HTTP/1.1 503 Service Unavailable', |
55 | 55 | 'Cache-Control: no-cache', |
@@ -61,10 +61,11 @@ discard block |
||
61 | 61 | self::send($array); |
62 | 62 | } |
63 | 63 | |
64 | - private static function send($array, $gzip = true) |
|
65 | - { |
|
66 | - if($gzip) |
|
67 | - self::start_gzipping(); |
|
64 | + private static function send($array, $gzip = true) |
|
65 | + { |
|
66 | + if($gzip) { |
|
67 | + self::start_gzipping(); |
|
68 | + } |
|
68 | 69 | |
69 | 70 | foreach($array as $row) |
70 | 71 | { |
@@ -72,17 +73,19 @@ discard block |
||
72 | 73 | } |
73 | 74 | } |
74 | 75 | |
75 | - private static function get_date($timestamp = false) |
|
76 | - { |
|
77 | - if($timestamp == 0) |
|
78 | - $timestamp = time(); |
|
76 | + private static function get_date($timestamp = false) |
|
77 | + { |
|
78 | + if($timestamp == 0) { |
|
79 | + $timestamp = time(); |
|
80 | + } |
|
79 | 81 | return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
80 | 82 | } |
81 | 83 | |
82 | - private static function start_gzipping() |
|
83 | - { |
|
84 | - if(!ob_start('ob_gzhandler')) |
|
85 | - ob_start(); |
|
84 | + private static function start_gzipping() |
|
85 | + { |
|
86 | + if(!ob_start('ob_gzhandler')) { |
|
87 | + ob_start(); |
|
88 | + } |
|
86 | 89 | } |
87 | 90 | |
88 | 91 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -final class Loader |
|
4 | -{ |
|
3 | +final class Loader |
|
4 | +{ |
|
5 | 5 | |
6 | 6 | private $root; |
7 | 7 | private $is_live; |
@@ -9,21 +9,22 @@ discard block |
||
9 | 9 | |
10 | 10 | private static $instance; |
11 | 11 | |
12 | - private function __construct() |
|
13 | - { |
|
12 | + private function __construct() |
|
13 | + { |
|
14 | 14 | $this->is_live = (isset($_SERVER['HTTP_HOST']) && substr($_SERVER['HTTP_HOST'], 0, 4) !== 'dev.'); |
15 | 15 | return $this; |
16 | 16 | } |
17 | 17 | |
18 | - public static function instance() |
|
19 | - { |
|
20 | - if(!isset(self::$instance)) |
|
21 | - self::$instance = new Loader(); |
|
18 | + public static function instance() |
|
19 | + { |
|
20 | + if(!isset(self::$instance)) { |
|
21 | + self::$instance = new Loader(); |
|
22 | + } |
|
22 | 23 | return self::$instance; |
23 | 24 | } |
24 | 25 | |
25 | - private function get_root() |
|
26 | - { |
|
26 | + private function get_root() |
|
27 | + { |
|
27 | 28 | if(!isset($this->root)) |
28 | 29 | { |
29 | 30 | $current_directory = dirname(__FILE__); |
@@ -34,24 +35,24 @@ discard block |
||
34 | 35 | return $this->root; |
35 | 36 | } |
36 | 37 | |
37 | - private function get_delimiter() |
|
38 | - { |
|
38 | + private function get_delimiter() |
|
39 | + { |
|
39 | 40 | return (true || $this->is_live) ? '/' : '\\'; |
40 | 41 | } |
41 | 42 | |
42 | - private function check_delimiters($path) |
|
43 | - { |
|
43 | + private function check_delimiters($path) |
|
44 | + { |
|
44 | 45 | return (true || $this->is_live) ? $path : str_replace('/', '\\', $path); |
45 | 46 | } |
46 | 47 | |
47 | - private static function get_class_name($path) |
|
48 | - { |
|
48 | + private static function get_class_name($path) |
|
49 | + { |
|
49 | 50 | $path_array = explode('/', $path); |
50 | 51 | return array_pop($path_array); |
51 | 52 | } |
52 | 53 | |
53 | - private static function get_extension($type) |
|
54 | - { |
|
54 | + private static function get_extension($type) |
|
55 | + { |
|
55 | 56 | switch($type) |
56 | 57 | { |
57 | 58 | case 'collector' : |
@@ -69,8 +70,8 @@ discard block |
||
69 | 70 | return $extension; |
70 | 71 | } |
71 | 72 | |
72 | - public static function getImagePath($type, $file) |
|
73 | - { |
|
73 | + public static function getImagePath($type, $file) |
|
74 | + { |
|
74 | 75 | $path = self::instance()->get_root(); |
75 | 76 | $path .= 'public'; |
76 | 77 | $path .= self::instance()->get_delimiter(); |
@@ -81,8 +82,8 @@ discard block |
||
81 | 82 | return $path; |
82 | 83 | } |
83 | 84 | |
84 | - private static function get_path($type, $file) |
|
85 | - { |
|
85 | + private static function get_path($type, $file) |
|
86 | + { |
|
86 | 87 | $path = self::instance()->get_root(); |
87 | 88 | $path .= $type; |
88 | 89 | $path .= self::instance()->get_delimiter(); |
@@ -92,23 +93,24 @@ discard block |
||
92 | 93 | return $path; |
93 | 94 | } |
94 | 95 | |
95 | - private function get_included_files() |
|
96 | - { |
|
96 | + private function get_included_files() |
|
97 | + { |
|
97 | 98 | return $this->included_files; |
98 | 99 | } |
99 | 100 | |
100 | - private function add_included_file($path) |
|
101 | - { |
|
101 | + private function add_included_file($path) |
|
102 | + { |
|
102 | 103 | $this->included_files[] = $path; |
103 | 104 | } |
104 | 105 | |
105 | - public static function load($type, $files, $data = array()) |
|
106 | - { |
|
106 | + public static function load($type, $files, $data = array()) |
|
107 | + { |
|
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 | self::instance()->add_included_file($file_path); |
114 | 116 | |
@@ -130,14 +132,14 @@ discard block |
||
130 | 132 | } |
131 | 133 | } |
132 | 134 | |
133 | - private static function create_reflection_class($file) |
|
134 | - { |
|
135 | + private static function create_reflection_class($file) |
|
136 | + { |
|
135 | 137 | $class_name = self::instance()->get_class_name($file); |
136 | 138 | return new ReflectionClass($class_name); |
137 | 139 | } |
138 | 140 | |
139 | - public static function loadInstance($type, $file) |
|
140 | - { |
|
141 | + public static function loadInstance($type, $file) |
|
142 | + { |
|
141 | 143 | self::load($type, $file); |
142 | 144 | |
143 | 145 | $reflectionObject = self::create_reflection_class($file); |
@@ -151,30 +153,31 @@ discard block |
||
151 | 153 | trigger_error("Requested class cannot be instance'd: {$type}, {$file}"); |
152 | 154 | } |
153 | 155 | |
154 | - public static function loadNew($type, $file, $data = array()) |
|
155 | - { |
|
156 | + public static function loadNew($type, $file, $data = array()) |
|
157 | + { |
|
156 | 158 | self::load($type, $file); |
157 | 159 | |
158 | 160 | $reflectionObject = self::create_reflection_class($file); |
159 | 161 | |
160 | - if($reflectionObject->hasMethod('__construct')) |
|
161 | - return $reflectionObject->newInstanceArgs($data); |
|
162 | - else |
|
163 | - return $reflectionObject->newInstance(); |
|
162 | + if($reflectionObject->hasMethod('__construct')) { |
|
163 | + return $reflectionObject->newInstanceArgs($data); |
|
164 | + } else { |
|
165 | + return $reflectionObject->newInstance(); |
|
166 | + } |
|
164 | 167 | } |
165 | 168 | |
166 | - public static function getRoot() |
|
167 | - { |
|
169 | + public static function getRoot() |
|
170 | + { |
|
168 | 171 | return self::instance()->get_root(); |
169 | 172 | } |
170 | 173 | |
171 | - public static function isLive() |
|
172 | - { |
|
174 | + public static function isLive() |
|
175 | + { |
|
173 | 176 | return self::instance()->is_live; |
174 | 177 | } |
175 | 178 | |
176 | - public static function getRootURL($site = '') |
|
177 | - { |
|
179 | + public static function getRootURL($site = '') |
|
180 | + { |
|
178 | 181 | if (strlen($site) > 0) { |
179 | 182 | $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
180 | 183 | if ($site == 'waterfalls' && self::instance()->is_live) { |