@@ -15,12 +15,14 @@ discard block |
||
| 15 | 15 | static private function form_url_array($host, $uri) |
| 16 | 16 | {
|
| 17 | 17 | $uri = substr($uri, 1); |
| 18 | - if(strpos($uri, '?')) |
|
| 19 | - $uri = substr($uri, 0, strpos($uri, '?')); |
|
| 18 | + if(strpos($uri, '?')) {
|
|
| 19 | + $uri = substr($uri, 0, strpos($uri, '?')); |
|
| 20 | + } |
|
| 20 | 21 | $uri_array = explode('/', $uri);
|
| 21 | 22 | |
| 22 | - if(!Loader::isLive()) |
|
| 23 | - $host = substr($host, strpos($host, '.') + 1); |
|
| 23 | + if(!Loader::isLive()) {
|
|
| 24 | + $host = substr($host, strpos($host, '.') + 1); |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | 27 | self::$array['host'] = $host; |
| 26 | 28 | |
@@ -33,8 +35,9 @@ discard block |
||
| 33 | 35 | self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/'; |
| 34 | 36 | self::$array['uri'] = '/' . implode('/', $uri_array);
|
| 35 | 37 | |
| 36 | - if(end($uri_array) == '') |
|
| 37 | - $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
|
| 38 | + if(end($uri_array) == '') {
|
|
| 39 | + $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
|
| 40 | + } |
|
| 38 | 41 | self::$array['pieces'] = (array) $uri_array; |
| 39 | 42 | } |
| 40 | 43 | |
@@ -61,22 +64,26 @@ discard block |
||
| 61 | 64 | static function getExtension() |
| 62 | 65 | {
|
| 63 | 66 | $file = self::getPiece(-1); |
| 64 | - if(substr($file, -1) == '/') |
|
| 65 | - return false; |
|
| 67 | + if(substr($file, -1) == '/') {
|
|
| 68 | + return false; |
|
| 69 | + } |
|
| 66 | 70 | return substr($file, strrpos($file, '.') + 1);; |
| 67 | 71 | } |
| 68 | 72 | |
| 69 | 73 | static function getPiece($piece = null) |
| 70 | 74 | {
|
| 71 | - if(!$piece) |
|
| 72 | - return self::$array['pieces']; |
|
| 75 | + if(!$piece) {
|
|
| 76 | + return self::$array['pieces']; |
|
| 77 | + } |
|
| 73 | 78 | |
| 74 | - if($piece == -1) |
|
| 75 | - return end(self::$array['pieces']); |
|
| 79 | + if($piece == -1) {
|
|
| 80 | + return end(self::$array['pieces']); |
|
| 81 | + } |
|
| 76 | 82 | |
| 77 | 83 | $piece = $piece - 1; |
| 78 | - if(array_key_exists($piece, self::$array['pieces'])) |
|
| 79 | - return self::$array['pieces'][$piece]; |
|
| 84 | + if(array_key_exists($piece, self::$array['pieces'])) {
|
|
| 85 | + return self::$array['pieces'][$piece]; |
|
| 86 | + } |
|
| 80 | 87 | return; |
| 81 | 88 | } |
| 82 | 89 | |
@@ -11,40 +11,47 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | public static function isBoolean($value, $strict = false) |
| 13 | 13 | {
|
| 14 | - if($strict && ($value === true || $value === false)) |
|
| 15 | - return true; |
|
| 16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
| 17 | - return true; |
|
| 14 | + if($strict && ($value === true || $value === false)) {
|
|
| 15 | + return true; |
|
| 16 | + } |
|
| 17 | + if(!$strict && ((bool) $value === true || (bool) $value === false)) {
|
|
| 18 | + return true; |
|
| 19 | + } |
|
| 18 | 20 | return false; |
| 19 | 21 | } |
| 20 | 22 | |
| 21 | 23 | public static function isDate($value) |
| 22 | 24 | {
|
| 23 | - if(strtotime($value) !== -1) |
|
| 24 | - return true; |
|
| 25 | - if(date('y', $value) !== false)
|
|
| 26 | - return true; |
|
| 25 | + if(strtotime($value) !== -1) {
|
|
| 26 | + return true; |
|
| 27 | + } |
|
| 28 | + if(date('y', $value) !== false) {
|
|
| 29 | + return true; |
|
| 30 | + } |
|
| 27 | 31 | return false; |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | 34 | public static function isInteger($value, $strict = false) |
| 31 | 35 | {
|
| 32 | - if($strict) |
|
| 33 | - return is_int($value); |
|
| 36 | + if($strict) {
|
|
| 37 | + return is_int($value); |
|
| 38 | + } |
|
| 34 | 39 | return (int) $value == $value; |
| 35 | 40 | } |
| 36 | 41 | |
| 37 | 42 | public static function isIP($value) |
| 38 | 43 | {
|
| 39 | - if(self::isInteger(ip2long($value))) |
|
| 40 | - return true; |
|
| 44 | + if(self::isInteger(ip2long($value))) {
|
|
| 45 | + return true; |
|
| 46 | + } |
|
| 41 | 47 | return false; |
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | public static function isString($value, $strict = false) |
| 45 | 51 | {
|
| 46 | - if($strict) |
|
| 47 | - return is_string($value); |
|
| 52 | + if($strict) {
|
|
| 53 | + return is_string($value); |
|
| 54 | + } |
|
| 48 | 55 | return (string) $value == $value; |
| 49 | 56 | } |
| 50 | 57 | |
@@ -67,8 +74,9 @@ discard block |
||
| 67 | 74 | private static function check_value($pattern, $string) |
| 68 | 75 | {
|
| 69 | 76 | preg_match($pattern, $string, $matches); |
| 70 | - if(empty($matches)) |
|
| 71 | - return false; |
|
| 77 | + if(empty($matches)) {
|
|
| 78 | + return false; |
|
| 79 | + } |
|
| 72 | 80 | return $matches[0] == $string; |
| 73 | 81 | } |
| 74 | 82 | |
@@ -84,8 +92,9 @@ discard block |
||
| 84 | 92 | break; |
| 85 | 93 | } |
| 86 | 94 | |
| 87 | - if($value == false) |
|
| 88 | - return false; |
|
| 95 | + if($value == false) {
|
|
| 96 | + return false; |
|
| 97 | + } |
|
| 89 | 98 | |
| 90 | 99 | switch($validation) |
| 91 | 100 | {
|
@@ -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 | |
@@ -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,8 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected function execute() |
| 12 | 12 | {
|
| 13 | - if(stristr($this->content, '#') === false) |
|
| 14 | - return; |
|
| 13 | + if(stristr($this->content, '#') === false) {
|
|
| 14 | + return; |
|
| 15 | + } |
|
| 15 | 16 | |
| 16 | 17 | // yeah yeah, i'm currently ignoring the link, whatevs |
| 17 | 18 | $parameters = func_get_args(); |
@@ -23,8 +24,9 @@ discard block |
||
| 23 | 24 | $parameters = array_shift($parameters); |
| 24 | 25 | |
| 25 | 26 | $found_hash = preg_match_all(self::$HASH_PATTERN, $this->content, $matches, PREG_SET_ORDER); |
| 26 | - if($found_hash === false || $found_hash === 0) |
|
| 27 | - return; |
|
| 27 | + if($found_hash === false || $found_hash === 0) {
|
|
| 28 | + return; |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | 31 | foreach($matches as $match) |
| 30 | 32 | {
|
@@ -10,8 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected function execute() |
| 12 | 12 | {
|
| 13 | - if(stristr($this->content, 'http') === false) |
|
| 14 | - return; |
|
| 13 | + if(stristr($this->content, 'http') === false) {
|
|
| 14 | + return; |
|
| 15 | + } |
|
| 15 | 16 | |
| 16 | 17 | $parameters = func_get_args(); |
| 17 | 18 | if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0]))) |
@@ -22,8 +23,9 @@ discard block |
||
| 22 | 23 | $parameters = array_shift($parameters); |
| 23 | 24 | |
| 24 | 25 | $found_link = preg_match_all(self::$LINK_PATTERN, $this->content, $matches, PREG_SET_ORDER); |
| 25 | - if($found_link === false || $found_link === 0) |
|
| 26 | - return; |
|
| 26 | + if($found_link === false || $found_link === 0) {
|
|
| 27 | + return; |
|
| 28 | + } |
|
| 27 | 29 | |
| 28 | 30 | foreach($matches as $match) |
| 29 | 31 | {
|
@@ -70,15 +72,17 @@ discard block |
||
| 70 | 72 | private function check_for_redirect($url) |
| 71 | 73 | {
|
| 72 | 74 | $headers = @get_headers($url); |
| 73 | - if($headers === false) |
|
| 74 | - $headers = $this->get_headers($url); |
|
| 75 | + if($headers === false) {
|
|
| 76 | + $headers = $this->get_headers($url); |
|
| 77 | + } |
|
| 75 | 78 | |
| 76 | 79 | if(stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false) |
| 77 | 80 | {
|
| 78 | 81 | foreach($headers as $header) |
| 79 | 82 | {
|
| 80 | - if(substr($header, 0, 9) == 'Location:') |
|
| 81 | - break; |
|
| 83 | + if(substr($header, 0, 9) == 'Location:') {
|
|
| 84 | + break; |
|
| 85 | + } |
|
| 82 | 86 | } |
| 83 | 87 | |
| 84 | 88 | $url = substr($header, 10); |
@@ -10,8 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected function execute() |
| 12 | 12 | {
|
| 13 | - if(stristr($this->content, '@') === false) |
|
| 14 | - return; |
|
| 13 | + if(stristr($this->content, '@') === false) {
|
|
| 14 | + return; |
|
| 15 | + } |
|
| 15 | 16 | |
| 16 | 17 | // yeah yeah, i'm currently ignoring the link, whatevs |
| 17 | 18 | $parameters = func_get_args(); |
@@ -23,8 +24,9 @@ discard block |
||
| 23 | 24 | $parameters = array_shift($parameters); |
| 24 | 25 | |
| 25 | 26 | $found_user = preg_match_all(self::$USER_PATTERN, $this->content, $matches, PREG_SET_ORDER); |
| 26 | - if($found_user === false || $found_user === 0) |
|
| 27 | - return; |
|
| 27 | + if($found_user === false || $found_user === 0) {
|
|
| 28 | + return; |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | 31 | foreach($matches as $match) |
| 30 | 32 | {
|
@@ -40,8 +40,9 @@ discard block |
||
| 40 | 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 | {
|
@@ -79,8 +80,9 @@ discard block |
||
| 79 | 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 | {
|
@@ -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 |