@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | public function __construct($user_agent = null) |
11 | 11 | { |
12 | - if(!isset($user_agent)) |
|
12 | + if (!isset($user_agent)) |
|
13 | 13 | $user_agent = Request::getServer('HTTP_USER_AGENT'); |
14 | 14 | $this->user_agent = $user_agent; |
15 | 15 | } |
@@ -9,8 +9,9 @@ |
||
9 | 9 | |
10 | 10 | public function __construct($user_agent = null) |
11 | 11 | { |
12 | - if(!isset($user_agent)) |
|
13 | - $user_agent = Request::getServer('HTTP_USER_AGENT'); |
|
12 | + if(!isset($user_agent)) { |
|
13 | + $user_agent = Request::getServer('HTTP_USER_AGENT'); |
|
14 | + } |
|
14 | 15 | $this->user_agent = $user_agent; |
15 | 16 | } |
16 | 17 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function setSize($size) |
54 | 54 | { |
55 | - if($this->get_version() > 1) |
|
55 | + if ($this->get_version() > 1) |
|
56 | 56 | $position = strrpos($this->file, '-v'); |
57 | 57 | else |
58 | 58 | $position = strrpos($this->file, '.'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | public function getDimensions() |
64 | 64 | { |
65 | - if(!$this->isValid()) |
|
65 | + if (!$this->isValid()) |
|
66 | 66 | return false; |
67 | 67 | $imageinfo = getimagesize($this->getInternalPath()); |
68 | 68 | return array($imageinfo[0], $imageinfo[1]); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | private function get_image($image) |
87 | 87 | { |
88 | - if(preg_match(self::$VERSION_PREG_MATCH, $image)) |
|
88 | + if (preg_match(self::$VERSION_PREG_MATCH, $image)) |
|
89 | 89 | return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
90 | 90 | else |
91 | 91 | return $image; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | private function get_file($image) |
101 | 101 | { |
102 | - if($this->get_version() > 1) |
|
102 | + if ($this->get_version() > 1) |
|
103 | 103 | { |
104 | 104 | $position = strrpos($image, '.'); |
105 | 105 | return substr($image, 0, $position) . '-v' . $this->get_version() . substr($image, $position); |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | private $version; |
112 | 112 | private function get_version() |
113 | 113 | { |
114 | - if(!$this->version) |
|
114 | + if (!$this->version) |
|
115 | 115 | { |
116 | - $path = Loader::getRoot() .'/images/' . substr($this->image, 0, strrpos($this->image, '.')) . '*'; |
|
116 | + $path = Loader::getRoot() . '/images/' . substr($this->image, 0, strrpos($this->image, '.')) . '*'; |
|
117 | 117 | $files = glob($path); |
118 | - if(count($files) > 0) |
|
118 | + if (count($files) > 0) |
|
119 | 119 | { |
120 | 120 | preg_match(self::$VERSION_PREG_MATCH, $files[0], $matches); |
121 | - if(count($matches)) |
|
121 | + if (count($matches)) |
|
122 | 122 | $this->version = $matches[1]; |
123 | 123 | else |
124 | 124 | $this->version = 1; |
@@ -52,18 +52,20 @@ discard block |
||
52 | 52 | |
53 | 53 | public function setSize($size) |
54 | 54 | { |
55 | - if($this->get_version() > 1) |
|
56 | - $position = strrpos($this->file, '-v'); |
|
57 | - else |
|
58 | - $position = strrpos($this->file, '.'); |
|
55 | + if($this->get_version() > 1) { |
|
56 | + $position = strrpos($this->file, '-v'); |
|
57 | + } else { |
|
58 | + $position = strrpos($this->file, '.'); |
|
59 | + } |
|
59 | 60 | |
60 | 61 | $this->file = substr($this->file, 0, $position) . '-s' . $size . substr($this->file, $position); |
61 | 62 | } |
62 | 63 | |
63 | 64 | public function getDimensions() |
64 | 65 | { |
65 | - if(!$this->isValid()) |
|
66 | - return false; |
|
66 | + if(!$this->isValid()) { |
|
67 | + return false; |
|
68 | + } |
|
67 | 69 | $imageinfo = getimagesize($this->getInternalPath()); |
68 | 70 | return array($imageinfo[0], $imageinfo[1]); |
69 | 71 | } |
@@ -85,10 +87,11 @@ discard block |
||
85 | 87 | |
86 | 88 | private function get_image($image) |
87 | 89 | { |
88 | - if(preg_match(self::$VERSION_PREG_MATCH, $image)) |
|
89 | - return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
|
90 | - else |
|
91 | - return $image; |
|
90 | + if(preg_match(self::$VERSION_PREG_MATCH, $image)) { |
|
91 | + return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
|
92 | + } else { |
|
93 | + return $image; |
|
94 | + } |
|
92 | 95 | } |
93 | 96 | |
94 | 97 | private function get_image_meta($image) |
@@ -103,9 +106,9 @@ discard block |
||
103 | 106 | { |
104 | 107 | $position = strrpos($image, '.'); |
105 | 108 | return substr($image, 0, $position) . '-v' . $this->get_version() . substr($image, $position); |
109 | + } else { |
|
110 | + return $image; |
|
106 | 111 | } |
107 | - else |
|
108 | - return $image; |
|
109 | 112 | } |
110 | 113 | |
111 | 114 | private $version; |
@@ -118,10 +121,11 @@ discard block |
||
118 | 121 | if(count($files) > 0) |
119 | 122 | { |
120 | 123 | preg_match(self::$VERSION_PREG_MATCH, $files[0], $matches); |
121 | - if(count($matches)) |
|
122 | - $this->version = $matches[1]; |
|
123 | - else |
|
124 | - $this->version = 1; |
|
124 | + if(count($matches)) { |
|
125 | + $this->version = $matches[1]; |
|
126 | + } else { |
|
127 | + $this->version = 1; |
|
128 | + } |
|
125 | 129 | } |
126 | 130 | } |
127 | 131 | return $this->version; |
@@ -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; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public static function instance() |
28 | 28 | { |
29 | - if(!isset(self::$instance)) |
|
29 | + if (!isset(self::$instance)) |
|
30 | 30 | self::$instance = new Visitor(); |
31 | 31 | return self::$instance; |
32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public static function getBrowser() |
36 | 36 | { |
37 | 37 | Loader::load('utility', 'environment/BrowserEnvironment'); |
38 | - if(!isset(self::instance()->browser)) |
|
38 | + if (!isset(self::instance()->browser)) |
|
39 | 39 | self::instance()->browser = new BrowserEnvironment(); |
40 | 40 | return self::instance()->browser; |
41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public static function getPlatform() |
45 | 45 | { |
46 | 46 | Loader::load('utility', 'environment/PlatformEnvironment'); |
47 | - if(!isset(self::instance()->platform)) |
|
47 | + if (!isset(self::instance()->platform)) |
|
48 | 48 | self::instance()->platform = new PlatformEnvironment(); |
49 | 49 | return self::instance()->platform; |
50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public static function getIP() |
54 | 54 | { |
55 | 55 | Loader::load('utility', 'Request'); |
56 | - if(!isset(self::instance()->ip_address)) |
|
56 | + if (!isset(self::instance()->ip_address)) |
|
57 | 57 | self::instance()->ip_address = Request::getServer('REMOTE_ADDR'); |
58 | 58 | return self::instance()->ip_address; |
59 | 59 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | Loader::loadInstance('utility', 'Database'); |
80 | 80 | |
81 | 81 | $query = $this->get_tracking_query(); |
82 | - if(Database::execute($query) == true) |
|
82 | + if (Database::execute($query) == true) |
|
83 | 83 | { |
84 | 84 | $this->raw_visit_log_id = Database::lastInsertID(); |
85 | 85 | return true; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $columns = '`'; |
96 | 96 | $values = "'"; |
97 | - foreach(self::$tracking_field_array as $field_column => $server_array_key) |
|
97 | + foreach (self::$tracking_field_array as $field_column => $server_array_key) |
|
98 | 98 | { |
99 | 99 | $value = Request::getServer($server_array_key); |
100 | 100 | $value = Database::escape($value); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $values .= "{$value}','"; |
104 | 104 | } |
105 | 105 | |
106 | - if(Request::hasPost()) |
|
106 | + if (Request::hasPost()) |
|
107 | 107 | { |
108 | 108 | $value = Request::getPost(); |
109 | 109 | $value = serialize($value); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | private function track_response_error($code) |
123 | 123 | { |
124 | - if(isset($this->raw_visit_log_id) && $this->raw_visit_log_id > 0) |
|
124 | + if (isset($this->raw_visit_log_id) && $this->raw_visit_log_id > 0) |
|
125 | 125 | { |
126 | 126 | $query = "UPDATE `jpemeric_stat`.`raw_visit_log` SET `code` = '{$code}' WHERE `id` = '{$this->raw_visit_log_id}' LIMIT 1"; |
127 | 127 | return Database::execute($query); |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | public static function instance() |
28 | 28 | { |
29 | - if(!isset(self::$instance)) |
|
30 | - self::$instance = new Visitor(); |
|
29 | + if(!isset(self::$instance)) { |
|
30 | + self::$instance = new Visitor(); |
|
31 | + } |
|
31 | 32 | return self::$instance; |
32 | 33 | } |
33 | 34 | |
@@ -35,8 +36,9 @@ discard block |
||
35 | 36 | public static function getBrowser() |
36 | 37 | { |
37 | 38 | Loader::load('utility', 'environment/BrowserEnvironment'); |
38 | - if(!isset(self::instance()->browser)) |
|
39 | - self::instance()->browser = new BrowserEnvironment(); |
|
39 | + if(!isset(self::instance()->browser)) { |
|
40 | + self::instance()->browser = new BrowserEnvironment(); |
|
41 | + } |
|
40 | 42 | return self::instance()->browser; |
41 | 43 | } |
42 | 44 | |
@@ -44,8 +46,9 @@ discard block |
||
44 | 46 | public static function getPlatform() |
45 | 47 | { |
46 | 48 | Loader::load('utility', 'environment/PlatformEnvironment'); |
47 | - if(!isset(self::instance()->platform)) |
|
48 | - self::instance()->platform = new PlatformEnvironment(); |
|
49 | + if(!isset(self::instance()->platform)) { |
|
50 | + self::instance()->platform = new PlatformEnvironment(); |
|
51 | + } |
|
49 | 52 | return self::instance()->platform; |
50 | 53 | } |
51 | 54 | |
@@ -53,8 +56,9 @@ discard block |
||
53 | 56 | public static function getIP() |
54 | 57 | { |
55 | 58 | Loader::load('utility', 'Request'); |
56 | - if(!isset(self::instance()->ip_address)) |
|
57 | - self::instance()->ip_address = Request::getServer('REMOTE_ADDR'); |
|
59 | + if(!isset(self::instance()->ip_address)) { |
|
60 | + self::instance()->ip_address = Request::getServer('REMOTE_ADDR'); |
|
61 | + } |
|
58 | 62 | return self::instance()->ip_address; |
59 | 63 | } |
60 | 64 |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | protected function execute() |
10 | 10 | { |
11 | 11 | $is_acceptable = true; |
12 | - foreach($this->getUnacceptableWords() as $unacceptableWord) |
|
12 | + foreach ($this->getUnacceptableWords() as $unacceptableWord) |
|
13 | 13 | { |
14 | - if(stristr($unacceptableWord->word, $this->content)) |
|
14 | + if (stristr($unacceptableWord->word, $this->content)) |
|
15 | 15 | $is_acceptable = false; |
16 | 16 | } |
17 | 17 | return $is_acceptable; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | private $unacceptableWords; |
21 | 21 | private function getUnacceptableWords() |
22 | 22 | { |
23 | - if(!$this->unacceptableWords) |
|
23 | + if (!$this->unacceptableWords) |
|
24 | 24 | $this->unacceptableWords = UnacceptableWordCollector::getWords(); |
25 | 25 | return $this->unacceptableWords; |
26 | 26 | } |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | $is_acceptable = true; |
12 | 12 | foreach($this->getUnacceptableWords() as $unacceptableWord) |
13 | 13 | { |
14 | - if(stristr($unacceptableWord->word, $this->content)) |
|
15 | - $is_acceptable = false; |
|
14 | + if(stristr($unacceptableWord->word, $this->content)) { |
|
15 | + $is_acceptable = false; |
|
16 | + } |
|
16 | 17 | } |
17 | 18 | return $is_acceptable; |
18 | 19 | } |
@@ -20,8 +21,9 @@ discard block |
||
20 | 21 | private $unacceptableWords; |
21 | 22 | private function getUnacceptableWords() |
22 | 23 | { |
23 | - if(!$this->unacceptableWords) |
|
24 | - $this->unacceptableWords = UnacceptableWordCollector::getWords(); |
|
24 | + if(!$this->unacceptableWords) { |
|
25 | + $this->unacceptableWords = UnacceptableWordCollector::getWords(); |
|
26 | + } |
|
25 | 27 | return $this->unacceptableWords; |
26 | 28 | } |
27 | 29 |
@@ -10,61 +10,61 @@ |
||
10 | 10 | $previous_time = strtotime($this->content); |
11 | 11 | $current_time = time(); |
12 | 12 | |
13 | - if($current_time <= $previous_time) |
|
13 | + if ($current_time <= $previous_time) |
|
14 | 14 | $this->content = 'few seconds ago'; |
15 | - else if(($current_time - $previous_time) < 30) |
|
15 | + else if (($current_time - $previous_time) < 30) |
|
16 | 16 | $this->content = 'few seconds ago'; |
17 | - else if(($current_time - $previous_time) < 1.5 * 60) |
|
17 | + else if (($current_time - $previous_time) < 1.5 * 60) |
|
18 | 18 | $this->content = 'a minute ago'; |
19 | - else if(($current_time - $previous_time) < 4 * 60) |
|
19 | + else if (($current_time - $previous_time) < 4 * 60) |
|
20 | 20 | $this->content = 'few minutes ago'; |
21 | - else if(($current_time - $previous_time) < 7 * 60) |
|
21 | + else if (($current_time - $previous_time) < 7 * 60) |
|
22 | 22 | $this->content = 'five minutes ago'; |
23 | - else if(($current_time - $previous_time) < 12 * 60) |
|
23 | + else if (($current_time - $previous_time) < 12 * 60) |
|
24 | 24 | $this->content = 'ten minutes ago'; |
25 | - else if(($current_time - $previous_time) < 17 * 60) |
|
25 | + else if (($current_time - $previous_time) < 17 * 60) |
|
26 | 26 | $this->content = 'fifteen minutes ago'; |
27 | - else if(($current_time - $previous_time) < 22 * 60) |
|
27 | + else if (($current_time - $previous_time) < 22 * 60) |
|
28 | 28 | $this->content = 'twenty minutes ago'; |
29 | - else if(($current_time - $previous_time) < 37 * 60) |
|
29 | + else if (($current_time - $previous_time) < 37 * 60) |
|
30 | 30 | $this->content = 'half hour ago'; |
31 | - else if(($current_time - $previous_time) < 52 * 60) |
|
31 | + else if (($current_time - $previous_time) < 52 * 60) |
|
32 | 32 | $this->content = 'forty-five minutes ago'; |
33 | - else if(($current_time - $previous_time) < 1.5 * 60 * 60) |
|
33 | + else if (($current_time - $previous_time) < 1.5 * 60 * 60) |
|
34 | 34 | $this->content = 'an hour ago'; |
35 | - else if(($current_time - $previous_time) < 2.5 * 60 * 60) |
|
35 | + else if (($current_time - $previous_time) < 2.5 * 60 * 60) |
|
36 | 36 | $this->content = 'two hours ago'; |
37 | - else if(($current_time - $previous_time) < 3.5 * 60 * 60) |
|
37 | + else if (($current_time - $previous_time) < 3.5 * 60 * 60) |
|
38 | 38 | $this->content = 'three hours ago'; |
39 | - else if(($current_time - $previous_time) < 4.5 * 60 * 60) |
|
39 | + else if (($current_time - $previous_time) < 4.5 * 60 * 60) |
|
40 | 40 | $this->content = 'few hours ago'; |
41 | - else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm') |
|
41 | + else if (($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm') |
|
42 | 42 | $this->content = 'this afternoon'; |
43 | - else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am') |
|
43 | + else if (($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am') |
|
44 | 44 | $this->content = 'this morning'; |
45 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17) |
|
45 | + else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17) |
|
46 | 46 | $this->content = 'yesterday evening'; |
47 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm') |
|
47 | + else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm') |
|
48 | 48 | $this->content = 'yesterday afternoon'; |
49 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am') |
|
49 | + else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am') |
|
50 | 50 | $this->content = 'yesterday morning'; |
51 | - else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2) |
|
51 | + else if (($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2) |
|
52 | 52 | $this->content = 'two days ago'; |
53 | - else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3) |
|
53 | + else if (($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3) |
|
54 | 54 | $this->content = 'three days ago'; |
55 | - else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time)) |
|
55 | + else if (($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time)) |
|
56 | 56 | $this->content = 'earlier this week'; |
57 | - else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3) |
|
57 | + else if (($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3) |
|
58 | 58 | $this->content = 'late last week'; |
59 | - else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1) |
|
59 | + else if (($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1) |
|
60 | 60 | $this->content = 'early last week'; |
61 | - else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) |
|
61 | + else if (($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) |
|
62 | 62 | $this->content = 'few weeks ago'; |
63 | - else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time)) |
|
63 | + else if (($current_time - $previous_time) < 1.25 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time)) |
|
64 | 64 | $this->content = 'earlier this month'; |
65 | - else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1) |
|
65 | + else if (($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1) |
|
66 | 66 | $this->content = 'last month'; |
67 | - else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) |
|
67 | + else if (($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) |
|
68 | 68 | $this->content = 'several months ago'; |
69 | 69 | else |
70 | 70 | $this->content = 'long ago'; |
@@ -10,64 +10,65 @@ |
||
10 | 10 | $previous_time = strtotime($this->content); |
11 | 11 | $current_time = time(); |
12 | 12 | |
13 | - if($current_time <= $previous_time) |
|
14 | - $this->content = 'few seconds ago'; |
|
15 | - else if(($current_time - $previous_time) < 30) |
|
16 | - $this->content = 'few seconds ago'; |
|
17 | - else if(($current_time - $previous_time) < 1.5 * 60) |
|
18 | - $this->content = 'a minute ago'; |
|
19 | - else if(($current_time - $previous_time) < 4 * 60) |
|
20 | - $this->content = 'few minutes ago'; |
|
21 | - else if(($current_time - $previous_time) < 7 * 60) |
|
22 | - $this->content = 'five minutes ago'; |
|
23 | - else if(($current_time - $previous_time) < 12 * 60) |
|
24 | - $this->content = 'ten minutes ago'; |
|
25 | - else if(($current_time - $previous_time) < 17 * 60) |
|
26 | - $this->content = 'fifteen minutes ago'; |
|
27 | - else if(($current_time - $previous_time) < 22 * 60) |
|
28 | - $this->content = 'twenty minutes ago'; |
|
29 | - else if(($current_time - $previous_time) < 37 * 60) |
|
30 | - $this->content = 'half hour ago'; |
|
31 | - else if(($current_time - $previous_time) < 52 * 60) |
|
32 | - $this->content = 'forty-five minutes ago'; |
|
33 | - else if(($current_time - $previous_time) < 1.5 * 60 * 60) |
|
34 | - $this->content = 'an hour ago'; |
|
35 | - else if(($current_time - $previous_time) < 2.5 * 60 * 60) |
|
36 | - $this->content = 'two hours ago'; |
|
37 | - else if(($current_time - $previous_time) < 3.5 * 60 * 60) |
|
38 | - $this->content = 'three hours ago'; |
|
39 | - else if(($current_time - $previous_time) < 4.5 * 60 * 60) |
|
40 | - $this->content = 'few hours ago'; |
|
41 | - else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm') |
|
42 | - $this->content = 'this afternoon'; |
|
43 | - else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am') |
|
44 | - $this->content = 'this morning'; |
|
45 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17) |
|
46 | - $this->content = 'yesterday evening'; |
|
47 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm') |
|
48 | - $this->content = 'yesterday afternoon'; |
|
49 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am') |
|
50 | - $this->content = 'yesterday morning'; |
|
51 | - else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2) |
|
52 | - $this->content = 'two days ago'; |
|
53 | - else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3) |
|
54 | - $this->content = 'three days ago'; |
|
55 | - else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time)) |
|
56 | - $this->content = 'earlier this week'; |
|
57 | - else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3) |
|
58 | - $this->content = 'late last week'; |
|
59 | - else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1) |
|
60 | - $this->content = 'early last week'; |
|
61 | - else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) |
|
62 | - $this->content = 'few weeks ago'; |
|
63 | - else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time)) |
|
64 | - $this->content = 'earlier this month'; |
|
65 | - else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1) |
|
66 | - $this->content = 'last month'; |
|
67 | - else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) |
|
68 | - $this->content = 'several months ago'; |
|
69 | - else |
|
70 | - $this->content = 'long ago'; |
|
13 | + if($current_time <= $previous_time) { |
|
14 | + $this->content = 'few seconds ago'; |
|
15 | + } else if(($current_time - $previous_time) < 30) { |
|
16 | + $this->content = 'few seconds ago'; |
|
17 | + } else if(($current_time - $previous_time) < 1.5 * 60) { |
|
18 | + $this->content = 'a minute ago'; |
|
19 | + } else if(($current_time - $previous_time) < 4 * 60) { |
|
20 | + $this->content = 'few minutes ago'; |
|
21 | + } else if(($current_time - $previous_time) < 7 * 60) { |
|
22 | + $this->content = 'five minutes ago'; |
|
23 | + } else if(($current_time - $previous_time) < 12 * 60) { |
|
24 | + $this->content = 'ten minutes ago'; |
|
25 | + } else if(($current_time - $previous_time) < 17 * 60) { |
|
26 | + $this->content = 'fifteen minutes ago'; |
|
27 | + } else if(($current_time - $previous_time) < 22 * 60) { |
|
28 | + $this->content = 'twenty minutes ago'; |
|
29 | + } else if(($current_time - $previous_time) < 37 * 60) { |
|
30 | + $this->content = 'half hour ago'; |
|
31 | + } else if(($current_time - $previous_time) < 52 * 60) { |
|
32 | + $this->content = 'forty-five minutes ago'; |
|
33 | + } else if(($current_time - $previous_time) < 1.5 * 60 * 60) { |
|
34 | + $this->content = 'an hour ago'; |
|
35 | + } else if(($current_time - $previous_time) < 2.5 * 60 * 60) { |
|
36 | + $this->content = 'two hours ago'; |
|
37 | + } else if(($current_time - $previous_time) < 3.5 * 60 * 60) { |
|
38 | + $this->content = 'three hours ago'; |
|
39 | + } else if(($current_time - $previous_time) < 4.5 * 60 * 60) { |
|
40 | + $this->content = 'few hours ago'; |
|
41 | + } else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm') { |
|
42 | + $this->content = 'this afternoon'; |
|
43 | + } else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am') { |
|
44 | + $this->content = 'this morning'; |
|
45 | + } else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17) { |
|
46 | + $this->content = 'yesterday evening'; |
|
47 | + } else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm') { |
|
48 | + $this->content = 'yesterday afternoon'; |
|
49 | + } else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am') { |
|
50 | + $this->content = 'yesterday morning'; |
|
51 | + } else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2) { |
|
52 | + $this->content = 'two days ago'; |
|
53 | + } else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3) { |
|
54 | + $this->content = 'three days ago'; |
|
55 | + } else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time)) { |
|
56 | + $this->content = 'earlier this week'; |
|
57 | + } else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3) { |
|
58 | + $this->content = 'late last week'; |
|
59 | + } else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1) { |
|
60 | + $this->content = 'early last week'; |
|
61 | + } else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) { |
|
62 | + $this->content = 'few weeks ago'; |
|
63 | + } else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time)) { |
|
64 | + $this->content = 'earlier this month'; |
|
65 | + } else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1) { |
|
66 | + $this->content = 'last month'; |
|
67 | + } else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) { |
|
68 | + $this->content = 'several months ago'; |
|
69 | + } else { |
|
70 | + $this->content = 'long ago'; |
|
71 | + } |
|
71 | 72 | } |
72 | 73 | |
73 | 74 | } |
74 | 75 | \ No newline at end of file |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | protected function execute() |
13 | 13 | { |
14 | - foreach(self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace) |
|
14 | + foreach (self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace) |
|
15 | 15 | { |
16 | - if(stristr($this->content, $match)) |
|
16 | + if (stristr($this->content, $match)) |
|
17 | 17 | $this->content = str_replace($match, $replace, $this->content); |
18 | 18 | } |
19 | 19 | return; |
@@ -13,8 +13,9 @@ |
||
13 | 13 | { |
14 | 14 | foreach(self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace) |
15 | 15 | { |
16 | - if(stristr($this->content, $match)) |
|
17 | - $this->content = str_replace($match, $replace, $this->content); |
|
16 | + if(stristr($this->content, $match)) { |
|
17 | + $this->content = str_replace($match, $replace, $this->content); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | return; |
20 | 21 | } |
@@ -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 |
@@ -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() |