@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $mysqli = new mysqli($host, $username, $password); |
37 | 37 | |
38 | 38 | $has_connection_error = $mysqli->connect_error; |
39 | - if(isset($has_connection_error)) |
|
39 | + if (isset($has_connection_error)) |
|
40 | 40 | $this->has_connection_error = true; |
41 | 41 | |
42 | 42 | return $mysqli; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public static function instance() |
46 | 46 | { |
47 | - if(!isset(self::$instance)) { |
|
47 | + if (!isset(self::$instance)) { |
|
48 | 48 | global $config; |
49 | 49 | self::$instance = new Database( |
50 | 50 | $config->database->master, |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | public static function select($query) |
64 | 64 | { |
65 | 65 | $start = microtime(true); |
66 | - if($result = self::instance()->read_connection->query($query)) |
|
66 | + if ($result = self::instance()->read_connection->query($query)) |
|
67 | 67 | { |
68 | 68 | self::instance()->log_query($query, $start); |
69 | 69 | $array = array(); |
70 | - while($row = $result->fetch_object()) |
|
70 | + while ($row = $result->fetch_object()) |
|
71 | 71 | $array[] = $row; |
72 | 72 | $result->close(); |
73 | 73 | return $array; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public static function selectRow($query) |
80 | 80 | { |
81 | 81 | $result = self::select($query); |
82 | - if(is_array($result)) |
|
82 | + if (is_array($result)) |
|
83 | 83 | return array_pop($result); |
84 | 84 | return false; |
85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public static function execute($query) |
88 | 88 | { |
89 | 89 | $start = microtime(true); |
90 | - if(self::instance()->write_connection->query($query)) |
|
90 | + if (self::instance()->write_connection->query($query)) |
|
91 | 91 | { |
92 | 92 | self::instance()->log_query($query, $start); |
93 | 93 | return true; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public static function lastInsertID() |
100 | 100 | { |
101 | 101 | $id = self::instance()->write_connection->insert_id; |
102 | - if($id == 0) |
|
102 | + if ($id == 0) |
|
103 | 103 | return false; |
104 | 104 | return $id; |
105 | 105 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | private function gather_query_data() |
120 | 120 | { |
121 | 121 | $query_data = array(); |
122 | - foreach($this->query_log as $query) |
|
122 | + foreach ($this->query_log as $query) |
|
123 | 123 | { |
124 | 124 | $query = self::explain($query); |
125 | 125 | $query_data[] = $query; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | $sql = 'EXPLAIN ' . $query['sql']; |
133 | 133 | |
134 | - if($result = self::instance()->read_connection->query($sql)) |
|
134 | + if ($result = self::instance()->read_connection->query($sql)) |
|
135 | 135 | { |
136 | 136 | $row = $result->fetch_assoc(); |
137 | 137 | $query['explain'] = $row; |
@@ -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() |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | static private function form_url_array($host, $uri) |
16 | 16 | { |
17 | 17 | $uri = substr($uri, 1); |
18 | - if(strpos($uri, '?')) |
|
18 | + if (strpos($uri, '?')) |
|
19 | 19 | $uri = substr($uri, 0, strpos($uri, '?')); |
20 | 20 | $uri_array = explode('/', $uri); |
21 | 21 | |
22 | - if(!Loader::isLive()) |
|
22 | + if (!Loader::isLive()) |
|
23 | 23 | $host = substr($host, strpos($host, '.') + 1); |
24 | 24 | |
25 | 25 | self::$array['host'] = $host; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/'; |
34 | 34 | self::$array['uri'] = '/' . implode('/', $uri_array); |
35 | 35 | |
36 | - if(end($uri_array) == '') |
|
36 | + if (end($uri_array) == '') |
|
37 | 37 | $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
38 | 38 | self::$array['pieces'] = (array) $uri_array; |
39 | 39 | } |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | static function getExtension() |
62 | 62 | { |
63 | 63 | $file = self::getPiece(-1); |
64 | - if(substr($file, -1) == '/') |
|
64 | + if (substr($file, -1) == '/') |
|
65 | 65 | return false; |
66 | - return substr($file, strrpos($file, '.') + 1);; |
|
66 | + return substr($file, strrpos($file, '.') + 1); ; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | static function getPiece($piece = null) |
70 | 70 | { |
71 | - if(!$piece) |
|
71 | + if (!$piece) |
|
72 | 72 | return self::$array['pieces']; |
73 | 73 | |
74 | - if($piece == -1) |
|
74 | + if ($piece == -1) |
|
75 | 75 | return end(self::$array['pieces']); |
76 | 76 | |
77 | 77 | $piece = $piece - 1; |
78 | - if(array_key_exists($piece, self::$array['pieces'])) |
|
78 | + if (array_key_exists($piece, self::$array['pieces'])) |
|
79 | 79 | return self::$array['pieces'][$piece]; |
80 | 80 | return; |
81 | 81 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function setValue($value) |
23 | 23 | { |
24 | - if(!$this->is_loaded) |
|
24 | + if (!$this->is_loaded) |
|
25 | 25 | $this->load(); |
26 | 26 | |
27 | 27 | $this->value = $value; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function getValue() |
32 | 32 | { |
33 | - if(!$this->is_loaded) |
|
33 | + if (!$this->is_loaded) |
|
34 | 34 | $this->load(); |
35 | 35 | return $this->value; |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function exists() |
44 | 44 | { |
45 | - if(!$this->is_loaded) |
|
45 | + if (!$this->is_loaded) |
|
46 | 46 | $this->load(); |
47 | 47 | return $this->exists; |
48 | 48 | } |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | private final function load() |
51 | 51 | { |
52 | 52 | $name = $this->getName(); |
53 | - if(isset($_COOKIE[$name])) |
|
53 | + if (isset($_COOKIE[$name])) |
|
54 | 54 | $value = $_COOKIE[$name]; |
55 | 55 | |
56 | - if(isset($value)) |
|
56 | + if (isset($value)) |
|
57 | 57 | { |
58 | 58 | $this->value = $value; |
59 | 59 | $this->exists = true; |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | |
67 | 67 | public final function save() |
68 | 68 | { |
69 | - if(!$this->check_values()) |
|
69 | + if (!$this->check_values()) |
|
70 | 70 | { |
71 | 71 | Debugger::error('Attempt to create a cookie without all of the values being set!'); |
72 | 72 | return false; |
73 | 73 | } |
74 | 74 | |
75 | - if(!$this->set_cookie()) |
|
75 | + if (!$this->set_cookie()) |
|
76 | 76 | { |
77 | 77 | Debugger::log('There was a problem saving the cookie.'); |
78 | 78 | return false; |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | private final function check_values() |
85 | 85 | { |
86 | 86 | $name = $this->getName(); |
87 | - if(empty($name) || strlen($name) < 1) |
|
87 | + if (empty($name) || strlen($name) < 1) |
|
88 | 88 | return false; |
89 | 89 | |
90 | 90 | $value = $this->getValue(); |
91 | - if(!isset($value) || strlen($value) < 1) |
|
91 | + if (!isset($value) || strlen($value) < 1) |
|
92 | 92 | return false; |
93 | 93 | |
94 | 94 | $expiration = $this->getExpiration(); |
95 | - if(!isset($expiration) || !is_int($expiration)) |
|
95 | + if (!isset($expiration) || !is_int($expiration)) |
|
96 | 96 | return false; |
97 | 97 | |
98 | 98 | $domain = $this->getDomain(); |
99 | - if(!isset($domain) || strlen($domain) < 1) |
|
99 | + if (!isset($domain) || strlen($domain) < 1) |
|
100 | 100 | return false; |
101 | 101 | |
102 | 102 | $path = $this->getPath(); |
103 | - if(!isset($path) || strlen($path) < 1) |
|
103 | + if (!isset($path) || strlen($path) < 1) |
|
104 | 104 | return false; |
105 | 105 | |
106 | 106 | return true; |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | protected function execute($title = '') |
11 | 11 | { |
12 | 12 | preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches); |
13 | - if(count($matches[1]) == 0) |
|
13 | + if (count($matches[1]) == 0) |
|
14 | 14 | return; |
15 | 15 | |
16 | - foreach($matches[3] as $key => $match) |
|
16 | + foreach ($matches[3] as $key => $match) |
|
17 | 17 | { |
18 | 18 | $replacement = $match; |
19 | 19 | $replacement = $this->wrap_in_list($replacement); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $content_array = explode("\n", $content); |
31 | 31 | |
32 | - foreach($content_array as $key => $row) |
|
32 | + foreach ($content_array as $key => $row) |
|
33 | 33 | { |
34 | 34 | $new_row = ($key % 2 == 0) ? '<li class="even">' : '<li class="odd">'; |
35 | 35 | $new_row .= '<p>'; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | private function highlight_code($content, $type) |
48 | 48 | { |
49 | - switch($type) |
|
49 | + switch ($type) |
|
50 | 50 | { |
51 | 51 | default : |
52 | 52 | return $content; |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | protected function execute($is_absolute = true) |
13 | 13 | { |
14 | 14 | preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches); |
15 | - foreach($matches[1] as $key => $match) |
|
15 | + foreach ($matches[1] as $key => $match) |
|
16 | 16 | { |
17 | - if(isset($matches[3][$key])) |
|
17 | + if (isset($matches[3][$key])) |
|
18 | 18 | $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
19 | 19 | else |
20 | 20 | $link_content = $this->get_link($match, $is_absolute); |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | |
30 | 30 | $link = ''; |
31 | 31 | |
32 | - switch($type) |
|
32 | + switch ($type) |
|
33 | 33 | { |
34 | 34 | case 'blog' : |
35 | 35 | Loader::load('collector', 'blog/PostCollector'); |
36 | 36 | $post = PostCollector::getPostByURI($uri); |
37 | 37 | |
38 | - if($post === NULL) |
|
38 | + if ($post === NULL) |
|
39 | 39 | return; |
40 | 40 | |
41 | 41 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
42 | 42 | $link .= "{$post->category}/{$post->path}/"; |
43 | 43 | |
44 | - if($anchor == '') |
|
44 | + if ($anchor == '') |
|
45 | 45 | $anchor = $post->title; |
46 | 46 | |
47 | 47 | break; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
50 | 50 | $link .= "tag/{$uri}/"; |
51 | 51 | |
52 | - if($anchor == '') |
|
52 | + if ($anchor == '') |
|
53 | 53 | { |
54 | 54 | $anchor = $uri; |
55 | 55 | $anchor = str_replace('-', ' ', $anchor); |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | Loader::load('collector', 'waterfall/LogCollector'); |
62 | 62 | $log = LogCollector::getByAlias($uri); |
63 | 63 | |
64 | - if($log === NULL) |
|
64 | + if ($log === NULL) |
|
65 | 65 | return; |
66 | 66 | |
67 | 67 | $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
68 | 68 | $link .= "journal/{$log->alias}/"; |
69 | 69 | |
70 | - if($anchor == '') |
|
70 | + if ($anchor == '') |
|
71 | 71 | $anchor = $log->title; |
72 | 72 | |
73 | 73 | break; |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | protected function execute() |
28 | 28 | { |
29 | 29 | $args = func_get_args(); |
30 | - if(count($args) < 1) |
|
30 | + if (count($args) < 1) |
|
31 | 31 | { |
32 | 32 | trigger_error('Someone called SmartTrimContent w/o defining a length... bad!'); |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if(count($args) == 2) |
|
36 | + if (count($args) == 2) |
|
37 | 37 | $etc = $args[1]; |
38 | 38 | else |
39 | 39 | $etc = self::$ETC; |
40 | 40 | |
41 | 41 | $length = $args[0]; |
42 | 42 | |
43 | - if($length < strlen($this->content)) |
|
43 | + if ($length < strlen($this->content)) |
|
44 | 44 | $this->trim_string($length); |
45 | 45 | else |
46 | 46 | $etc = ''; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $last_right_bracket_position = strripos($content, self::$RIGHT_BRACKET); |
56 | 56 | $last_left_bracket_position = strripos($content, self::$LEFT_BRACKET); |
57 | - if($last_left_bracket_position > $last_right_bracket_position) |
|
57 | + if ($last_left_bracket_position > $last_right_bracket_position) |
|
58 | 58 | $content = substr($content, 0, $last_left_bracket_position); |
59 | 59 | $content = trim($content); |
60 | 60 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | $content = current($content); |
74 | 74 | |
75 | 75 | $max_length = $length; |
76 | - foreach($matches[0] as $match) |
|
76 | + foreach ($matches[0] as $match) |
|
77 | 77 | { |
78 | 78 | $max_length += strlen($match[0]); |
79 | - if($max_length <= $match[1]) |
|
79 | + if ($max_length <= $match[1]) |
|
80 | 80 | break; |
81 | 81 | |
82 | 82 | $content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]); |
83 | 83 | } |
84 | 84 | |
85 | - if(substr($content, -7) == '</p><p>') |
|
85 | + if (substr($content, -7) == '</p><p>') |
|
86 | 86 | $content = substr($content, 0, -7); |
87 | 87 | |
88 | 88 | return $content; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $tags_preg = $this->get_tags_preg(self::$EXCLUDE_TAGS); |
95 | 95 | preg_match_all($tags_preg, $content, $matches, PREG_OFFSET_CAPTURE); |
96 | 96 | |
97 | - if(count($matches[1]) % 2 == 1) |
|
97 | + if (count($matches[1]) % 2 == 1) |
|
98 | 98 | { |
99 | 99 | $cut_tag = end($matches[1]); |
100 | 100 | $cut_tag_position = $cut_tag[1] - 1; |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | preg_match_all($tags_preg, $content, $matches); |
113 | 113 | $open_tags = array(); |
114 | 114 | |
115 | - foreach($matches[1] as $tag) |
|
115 | + foreach ($matches[1] as $tag) |
|
116 | 116 | { |
117 | - if(in_array($tag, $open_tags)) |
|
117 | + if (in_array($tag, $open_tags)) |
|
118 | 118 | { |
119 | 119 | $key = array_search($tag, $open_tags); |
120 | 120 | unset($open_tags[$key]); |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | $open_tags = array_reverse($open_tags); |
127 | - if(count($open_tags) > 0) |
|
127 | + if (count($open_tags) > 0) |
|
128 | 128 | { |
129 | - foreach($open_tags as $key => $open_tag) |
|
129 | + foreach ($open_tags as $key => $open_tag) |
|
130 | 130 | { |
131 | - if($key == count($open_tags) - 1) |
|
131 | + if ($key == count($open_tags) - 1) |
|
132 | 132 | $content .= $etc; |
133 | 133 | $content .= "</{$open_tag}>"; |
134 | 134 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | protected function execute($is_absolute = false, $size = 'medium') |
13 | 13 | { |
14 | 14 | preg_match_all(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $matches); |
15 | - foreach($matches[1] as $key => $match) |
|
15 | + foreach ($matches[1] as $key => $match) |
|
16 | 16 | { |
17 | 17 | $photo_content = $this->get_photo_content($match, $size, $is_absolute); |
18 | 18 | $this->content = str_replace($matches[0][$key], $photo_content, $this->content); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | Loader::load('collector', 'image/PhotoCollector'); |
39 | 39 | $photo_result = PhotoCollector::fetchRow($category, $photo); |
40 | - if($photo_result == false) |
|
40 | + if ($photo_result == false) |
|
41 | 41 | return ''; |
42 | 42 | |
43 | 43 | $height = $file_size[1]; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $domain = '/'; |
52 | - if($is_absolute) |
|
52 | + if ($is_absolute) |
|
53 | 53 | $domain = Loader::getRootUrl('blog'); |
54 | 54 | |
55 | 55 | return sprintf(self::$PHOTO_CONTENT, $domain, $category, $photo, $size, $height, $width, $description, $description); |
@@ -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'; |