@@ -44,9 +44,9 @@ |
||
| 44 | 44 | $width = $file_size[0]; |
| 45 | 45 | $description = $photo_result->description; |
| 46 | 46 | |
| 47 | - if ($description == '') { |
|
| 48 | - Debugger::logMessage("No description for {$category}/{$photo}"); |
|
| 49 | - } |
|
| 47 | + if ($description == '') { |
|
| 48 | + Debugger::logMessage("No description for {$category}/{$photo}"); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | $domain = '/'; |
| 52 | 52 | if($is_absolute) |
@@ -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); |
@@ -37,8 +37,9 @@ 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]; |
@@ -49,8 +50,9 @@ discard block |
||
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | $domain = '/'; |
| 52 | - if($is_absolute) |
|
| 53 | - $domain = Loader::getRootUrl('blog'); |
|
| 53 | + if($is_absolute) {
|
|
| 54 | + $domain = Loader::getRootUrl('blog');
|
|
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | return sprintf(self::$PHOTO_CONTENT, $domain, $category, $photo, $size, $height, $width, $description, $description); |
| 56 | 58 | } |
@@ -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 |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | private static function send($array, $gzip = true) |
| 188 | 188 | { |
| 189 | - if($gzip) |
|
| 189 | + if ($gzip) |
|
| 190 | 190 | self::start_gzipping(); |
| 191 | 191 | |
| 192 | - foreach($array as $row) |
|
| 192 | + foreach ($array as $row) |
|
| 193 | 193 | { |
| 194 | 194 | header($row, TRUE); |
| 195 | 195 | } |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | private static function get_date($timestamp = false) |
| 199 | 199 | { |
| 200 | - if($timestamp == 0) |
|
| 200 | + if ($timestamp == 0) |
|
| 201 | 201 | $timestamp = time(); |
| 202 | 202 | return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | private static function start_gzipping() |
| 206 | 206 | { |
| 207 | - if(!ob_start('ob_gzhandler')) |
|
| 207 | + if (!ob_start('ob_gzhandler')) |
|
| 208 | 208 | ob_start(); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -131,6 +131,9 @@ |
||
| 131 | 131 | self::send($array); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | + /** |
|
| 135 | + * @param string[] $array |
|
| 136 | + */ |
|
| 134 | 137 | private static function send($array, $gzip = true) |
| 135 | 138 | { |
| 136 | 139 | if($gzip) |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | private static function start_gzipping() |
| 153 | 153 | { |
| 154 | 154 | if(!ob_start('ob_gzhandler')) |
| 155 | - ob_start(); |
|
| 155 | + ob_start(); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | } |
@@ -133,8 +133,9 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | private static function send($array, $gzip = true) |
| 135 | 135 | { |
| 136 | - if($gzip) |
|
| 137 | - self::start_gzipping(); |
|
| 136 | + if($gzip) {
|
|
| 137 | + self::start_gzipping(); |
|
| 138 | + } |
|
| 138 | 139 | |
| 139 | 140 | foreach($array as $row) |
| 140 | 141 | { |
@@ -144,15 +145,17 @@ discard block |
||
| 144 | 145 | |
| 145 | 146 | private static function get_date($timestamp = false) |
| 146 | 147 | { |
| 147 | - if($timestamp == 0) |
|
| 148 | - $timestamp = time(); |
|
| 148 | + if($timestamp == 0) {
|
|
| 149 | + $timestamp = time(); |
|
| 150 | + } |
|
| 149 | 151 | return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
| 150 | 152 | } |
| 151 | 153 | |
| 152 | 154 | private static function start_gzipping() |
| 153 | 155 | { |
| 154 | - if(!ob_start('ob_gzhandler')) |
|
| 155 | - ob_start(); |
|
| 156 | + if(!ob_start('ob_gzhandler')) {
|
|
| 157 | + ob_start(); |
|
| 158 | + } |
|
| 156 | 159 | } |
| 157 | 160 | |
| 158 | 161 | } |
@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | public function perform() |
| 40 | 40 | { |
| 41 | 41 | $weighted_array = array(); |
| 42 | - foreach($this->result as $row) |
|
| 42 | + foreach ($this->result as $row) |
|
| 43 | 43 | { |
| 44 | 44 | $weight = $this->get_search_weight($row); |
| 45 | - if($weight > 0) |
|
| 45 | + if ($weight > 0) |
|
| 46 | 46 | $weighted_array[$row->id] = $weight; |
| 47 | 47 | } |
| 48 | 48 | arsort($weighted_array); |
| 49 | 49 | |
| 50 | 50 | $final_array = array(); |
| 51 | - foreach($weighted_array as $id => $weight) |
|
| 51 | + foreach ($weighted_array as $id => $weight) |
|
| 52 | 52 | { |
| 53 | - foreach($this->result as $row) |
|
| 53 | + foreach ($this->result as $row) |
|
| 54 | 54 | { |
| 55 | - if($row->id == $id) |
|
| 55 | + if ($row->id == $id) |
|
| 56 | 56 | $final_array[] = $row; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | private function get_search_weight($row) |
| 63 | 63 | { |
| 64 | 64 | $weight = 0; |
| 65 | - foreach($this->weight as $weight_array) |
|
| 65 | + foreach ($this->weight as $weight_array) |
|
| 66 | 66 | { |
| 67 | 67 | $text = $row->{$weight_array['field']}; |
| 68 | 68 | $weight += $weight_array['weight'] * substr_count(strtolower($text), strtolower($this->query)); |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | foreach($this->result as $row) |
| 43 | 43 | { |
| 44 | 44 | $weight = $this->get_search_weight($row); |
| 45 | - if($weight > 0) |
|
| 46 | - $weighted_array[$row->id] = $weight; |
|
| 45 | + if($weight > 0) {
|
|
| 46 | + $weighted_array[$row->id] = $weight; |
|
| 47 | + } |
|
| 47 | 48 | } |
| 48 | 49 | arsort($weighted_array); |
| 49 | 50 | |
@@ -52,8 +53,9 @@ discard block |
||
| 52 | 53 | { |
| 53 | 54 | foreach($this->result as $row) |
| 54 | 55 | { |
| 55 | - if($row->id == $id) |
|
| 56 | - $final_array[] = $row; |
|
| 56 | + if($row->id == $id) {
|
|
| 57 | + $final_array[] = $row; |
|
| 58 | + } |
|
| 57 | 59 | } |
| 58 | 60 | } |
| 59 | 61 | return $final_array; |
@@ -56,11 +56,11 @@ |
||
| 56 | 56 | final private function get_list_posts() |
| 57 | 57 | { |
| 58 | 58 | $post_array = array(); |
| 59 | - foreach($this->get_list_results() as $post) |
|
| 59 | + foreach ($this->get_list_results() as $post) |
|
| 60 | 60 | { |
| 61 | 61 | $post_array[] = $this->format_post($post, true); |
| 62 | 62 | } |
| 63 | - if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
| 63 | + if (count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
| 64 | 64 | $this->eject(); |
| 65 | 65 | return $post_array; |
| 66 | 66 | } |
@@ -60,8 +60,9 @@ |
||
| 60 | 60 | { |
| 61 | 61 | $post_array[] = $this->format_post($post, true); |
| 62 | 62 | } |
| 63 | - if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
| 64 | - $this->eject(); |
|
| 63 | + if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') {
|
|
| 64 | + $this->eject(); |
|
| 65 | + } |
|
| 65 | 66 | return $post_array; |
| 66 | 67 | } |
| 67 | 68 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | - global $config; |
|
| 15 | + global $config; |
|
| 16 | 16 | $this->headers['From'] = self::$FROM; |
| 17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>"; |
| 18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>"; |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | private function process_form() |
| 35 | 35 | { |
| 36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
| 36 | + if (!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
| 37 | 37 | return (object) array('display' => 'normal'); |
| 38 | 38 | |
| 39 | 39 | Loader::load('utility', 'Validate'); |
| 40 | 40 | $error_result = array(); |
| 41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
| 41 | + if (!Validate::checkRequest('post', 'name', 'string')) |
|
| 42 | 42 | $error_result['name'] = 'please enter your name'; |
| 43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
| 43 | + if (!Validate::checkRequest('post', 'email', 'string')) |
|
| 44 | 44 | $error_result['email'] = 'please enter a valid email'; |
| 45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
| 45 | + if (!Validate::checkRequest('post', 'message', 'string')) |
|
| 46 | 46 | $error_result['message'] = 'please write a message'; |
| 47 | 47 | |
| 48 | 48 | $values = (object) array( |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | 'email' => Request::getPost('email'), |
| 51 | 51 | 'message' => Request::getPost('message')); |
| 52 | 52 | |
| 53 | - if(count($error_result) > 0) |
|
| 53 | + if (count($error_result) > 0) |
|
| 54 | 54 | { |
| 55 | 55 | return (object) array( |
| 56 | 56 | 'display' => 'error', |
@@ -33,17 +33,21 @@ |
||
| 33 | 33 | |
| 34 | 34 | private function process_form() |
| 35 | 35 | { |
| 36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
| 37 | - return (object) array('display' => 'normal'); |
|
| 36 | + if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') {
|
|
| 37 | + return (object) array('display' => 'normal');
|
|
| 38 | + } |
|
| 38 | 39 | |
| 39 | 40 | Loader::load('utility', 'Validate'); |
| 40 | 41 | $error_result = array(); |
| 41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
| 42 | - $error_result['name'] = 'please enter your name'; |
|
| 43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
| 44 | - $error_result['email'] = 'please enter a valid email'; |
|
| 45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
| 46 | - $error_result['message'] = 'please write a message'; |
|
| 42 | + if(!Validate::checkRequest('post', 'name', 'string')) {
|
|
| 43 | + $error_result['name'] = 'please enter your name'; |
|
| 44 | + } |
|
| 45 | + if(!Validate::checkRequest('post', 'email', 'string')) {
|
|
| 46 | + $error_result['email'] = 'please enter a valid email'; |
|
| 47 | + } |
|
| 48 | + if(!Validate::checkRequest('post', 'message', 'string')) {
|
|
| 49 | + $error_result['message'] = 'please write a message'; |
|
| 50 | + } |
|
| 47 | 51 | |
| 48 | 52 | $values = (object) array( |
| 49 | 53 | 'name' => Request::getPost('name'), |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $handle = @fopen($config_path, 'r'); |
| 9 | 9 | if ($handle === false) { |
| 10 | - throw new RuntimeException("Could not load config"); |
|
| 10 | + throw new RuntimeException("Could not load config"); |
|
| 11 | 11 | } |
| 12 | 12 | $config = fread($handle, filesize($config_path)); |
| 13 | 13 | fclose($handle); |
@@ -15,40 +15,40 @@ discard block |
||
| 15 | 15 | $config = json_decode($config); |
| 16 | 16 | $last_json_error = json_last_error(); |
| 17 | 17 | if ($last_json_error !== JSON_ERROR_NONE) { |
| 18 | - throw new RuntimeException("Could not parse config - JSON error detected"); |
|
| 18 | + throw new RuntimeException("Could not parse config - JSON error detected"); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // configure the db connections holder |
| 22 | 22 | $db_connections = new Aura\Sql\ConnectionLocator(); |
| 23 | 23 | $db_connections->setDefault(function () use ($config) { |
| 24 | - $connection = $config->database->slave; |
|
| 25 | - return new Aura\Sql\ExtendedPdo( |
|
| 26 | - "mysql:host={$connection->host}", |
|
| 27 | - $connection->user, |
|
| 28 | - $connection->password |
|
| 29 | - ); |
|
| 24 | + $connection = $config->database->slave; |
|
| 25 | + return new Aura\Sql\ExtendedPdo( |
|
| 26 | + "mysql:host={$connection->host}", |
|
| 27 | + $connection->user, |
|
| 28 | + $connection->password |
|
| 29 | + ); |
|
| 30 | 30 | }); |
| 31 | 31 | $db_connections->setWrite('master', function () use ($config) { |
| 32 | - $connection = $config->database->master; |
|
| 33 | - return new Aura\Sql\ExtendedPdo( |
|
| 34 | - "mysql:host={$connection->host}", |
|
| 35 | - $connection->user, |
|
| 36 | - $connection->password |
|
| 37 | - ); |
|
| 32 | + $connection = $config->database->master; |
|
| 33 | + return new Aura\Sql\ExtendedPdo( |
|
| 34 | + "mysql:host={$connection->host}", |
|
| 35 | + $connection->user, |
|
| 36 | + $connection->password |
|
| 37 | + ); |
|
| 38 | 38 | }); |
| 39 | 39 | $db_connections->setRead('slave', function () use ($config) { |
| 40 | - $connection = $config->database->slave; |
|
| 41 | - $pdo = new Aura\Sql\ExtendedPdo( |
|
| 42 | - "mysql:host={$connection->host}", |
|
| 43 | - $connection->user, |
|
| 44 | - $connection->password |
|
| 45 | - ); |
|
| 46 | - |
|
| 47 | - $profiler = new Aura\Sql\Profiler(); |
|
| 48 | - $profiler->setActive(true); |
|
| 49 | - $pdo->setProfiler($profiler); |
|
| 50 | - |
|
| 51 | - return $pdo; |
|
| 40 | + $connection = $config->database->slave; |
|
| 41 | + $pdo = new Aura\Sql\ExtendedPdo( |
|
| 42 | + "mysql:host={$connection->host}", |
|
| 43 | + $connection->user, |
|
| 44 | + $connection->password |
|
| 45 | + ); |
|
| 46 | + |
|
| 47 | + $profiler = new Aura\Sql\Profiler(); |
|
| 48 | + $profiler->setActive(true); |
|
| 49 | + $pdo->setProfiler($profiler); |
|
| 50 | + |
|
| 51 | + return $pdo; |
|
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | 54 | // setup the service locator |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | // configure the db connections holder |
| 22 | 22 | $db_connections = new Aura\Sql\ConnectionLocator(); |
| 23 | -$db_connections->setDefault(function () use ($config) { |
|
| 23 | +$db_connections->setDefault(function() use ($config) { |
|
| 24 | 24 | $connection = $config->database->slave; |
| 25 | 25 | return new Aura\Sql\ExtendedPdo( |
| 26 | 26 | "mysql:host={$connection->host}", |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $connection->password |
| 29 | 29 | ); |
| 30 | 30 | }); |
| 31 | -$db_connections->setWrite('master', function () use ($config) { |
|
| 31 | +$db_connections->setWrite('master', function() use ($config) { |
|
| 32 | 32 | $connection = $config->database->master; |
| 33 | 33 | return new Aura\Sql\ExtendedPdo( |
| 34 | 34 | "mysql:host={$connection->host}", |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $connection->password |
| 37 | 37 | ); |
| 38 | 38 | }); |
| 39 | -$db_connections->setRead('slave', function () use ($config) { |
|
| 39 | +$db_connections->setRead('slave', function() use ($config) { |
|
| 40 | 40 | $connection = $config->database->slave; |
| 41 | 41 | $pdo = new Aura\Sql\ExtendedPdo( |
| 42 | 42 | "mysql:host={$connection->host}", |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | protected $connections; |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @param ConnectonLocator $connections |
|
| 14 | + * @param ConnectionLocator $connections |
|
| 15 | 15 | */ |
| 16 | 16 | public function __construct(ConnectionLocator $connections) |
| 17 | 17 | { |
@@ -41,7 +41,6 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * @param string $title |
|
| 45 | 44 | * |
| 46 | 45 | * @return array|false |
| 47 | 46 | */ |
@@ -8,88 +8,88 @@ |
||
| 8 | 8 | class MysqlYouTubeRepository implements YouTubeRepositoryInterface |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - /** @var ConnectionLocator */ |
|
| 12 | - protected $connections; |
|
| 11 | + /** @var ConnectionLocator */ |
|
| 12 | + protected $connections; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @param ConnectonLocator $connections |
|
| 16 | - */ |
|
| 17 | - public function __construct(ConnectionLocator $connections) |
|
| 18 | - { |
|
| 19 | - $this->connections = $connections; |
|
| 20 | - } |
|
| 14 | + /** |
|
| 15 | + * @param ConnectonLocator $connections |
|
| 16 | + */ |
|
| 17 | + public function __construct(ConnectionLocator $connections) |
|
| 18 | + { |
|
| 19 | + $this->connections = $connections; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - public function getYouTubes($limit = null, $offset = 0) |
|
| 23 | - { |
|
| 24 | - $query = " |
|
| 22 | + public function getYouTubes($limit = null, $offset = 0) |
|
| 23 | + { |
|
| 24 | + $query = " |
|
| 25 | 25 | SELECT `id`, `video_id`, `datetime` |
| 26 | 26 | FROM `jpemeric_stream`.`youtube` |
| 27 | 27 | ORDER BY `datetime` DESC"; |
| 28 | - if (!is_null($limit)) { |
|
| 29 | - $query .= " |
|
| 28 | + if (!is_null($limit)) { |
|
| 29 | + $query .= " |
|
| 30 | 30 | LIMIT {$offset}, {$limit}"; |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - return $this |
|
| 34 | - ->connections |
|
| 35 | - ->getRead() |
|
| 36 | - ->fetchAll($query); |
|
| 37 | - } |
|
| 33 | + return $this |
|
| 34 | + ->connections |
|
| 35 | + ->getRead() |
|
| 36 | + ->fetchAll($query); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param string $title |
|
| 41 | - * |
|
| 42 | - * @return array|false |
|
| 43 | - */ |
|
| 44 | - public function getYouTubeByVideoId($videoId) |
|
| 45 | - { |
|
| 46 | - $query = " |
|
| 39 | + /** |
|
| 40 | + * @param string $title |
|
| 41 | + * |
|
| 42 | + * @return array|false |
|
| 43 | + */ |
|
| 44 | + public function getYouTubeByVideoId($videoId) |
|
| 45 | + { |
|
| 46 | + $query = " |
|
| 47 | 47 | SELECT * |
| 48 | 48 | FROM `jpemeric_stream`.`youtube` |
| 49 | 49 | WHERE `video_id` = :video_id |
| 50 | 50 | LIMIT 1"; |
| 51 | - $bindings = [ |
|
| 52 | - 'video_id' => $videoId, |
|
| 53 | - ]; |
|
| 51 | + $bindings = [ |
|
| 52 | + 'video_id' => $videoId, |
|
| 53 | + ]; |
|
| 54 | 54 | |
| 55 | - return $this |
|
| 56 | - ->connections |
|
| 57 | - ->getRead() |
|
| 58 | - ->fetchOne($query, $bindings); |
|
| 59 | - } |
|
| 55 | + return $this |
|
| 56 | + ->connections |
|
| 57 | + ->getRead() |
|
| 58 | + ->fetchOne($query, $bindings); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function getYouTubesUpdatedSince(DateTime $datetime) |
|
| 62 | - { |
|
| 63 | - $query = " |
|
| 61 | + public function getYouTubesUpdatedSince(DateTime $datetime) |
|
| 62 | + { |
|
| 63 | + $query = " |
|
| 64 | 64 | SELECT * |
| 65 | 65 | FROM `jpemeric_stream`.`youtube` |
| 66 | 66 | WHERE `updated_at` >= :last_update"; |
| 67 | - $bindings = [ |
|
| 68 | - 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 69 | - ]; |
|
| 70 | - return $this |
|
| 71 | - ->connections |
|
| 72 | - ->getRead() |
|
| 73 | - ->fetchAll($query, $bindings); |
|
| 74 | - } |
|
| 67 | + $bindings = [ |
|
| 68 | + 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 69 | + ]; |
|
| 70 | + return $this |
|
| 71 | + ->connections |
|
| 72 | + ->getRead() |
|
| 73 | + ->fetchAll($query, $bindings); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - public function insertVideo($videoId, DateTime $datetime, array $metadata) |
|
| 77 | - { |
|
| 78 | - $query = " |
|
| 76 | + public function insertVideo($videoId, DateTime $datetime, array $metadata) |
|
| 77 | + { |
|
| 78 | + $query = " |
|
| 79 | 79 | INSERT INTO `jpemeric_stream`.`youtube` |
| 80 | 80 | (`video_id`, `datetime`, `metadata`) |
| 81 | 81 | VALUES |
| 82 | 82 | (:video_id, :datetime, :metadata)"; |
| 83 | 83 | |
| 84 | - $bindings = [ |
|
| 85 | - 'video_id' => $videoId, |
|
| 86 | - 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 87 | - 'metadata' => json_encode($metadata), |
|
| 88 | - ]; |
|
| 84 | + $bindings = [ |
|
| 85 | + 'video_id' => $videoId, |
|
| 86 | + 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 87 | + 'metadata' => json_encode($metadata), |
|
| 88 | + ]; |
|
| 89 | 89 | |
| 90 | - return $this |
|
| 91 | - ->connections |
|
| 92 | - ->getWrite() |
|
| 93 | - ->perform($query, $bindings); |
|
| 94 | - } |
|
| 90 | + return $this |
|
| 91 | + ->connections |
|
| 92 | + ->getWrite() |
|
| 93 | + ->perform($query, $bindings); |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | parent::__construct(); |
| 21 | 21 | |
| 22 | 22 | $id = URLDecode::getPiece(2); |
| 23 | - if(!$id || !is_numeric($id)) |
|
| 23 | + if (!$id || !is_numeric($id)) |
|
| 24 | 24 | $this->eject(); |
| 25 | 25 | |
| 26 | 26 | $post = $this->postRepository->getPostById($id); |
| 27 | - if(!$post) |
|
| 27 | + if (!$post) |
|
| 28 | 28 | $this->eject(); |
| 29 | 29 | |
| 30 | - if(URLDecode::getPiece(1) != $post['type']) |
|
| 30 | + if (URLDecode::getPiece(1) != $post['type']) |
|
| 31 | 31 | $this->eject(); |
| 32 | 32 | |
| 33 | 33 | $this->post = $post; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function get_title() |
| 61 | 61 | { |
| 62 | - switch($this->post['type']) |
|
| 62 | + switch ($this->post['type']) |
|
| 63 | 63 | { |
| 64 | 64 | case 'blog' : |
| 65 | 65 | return 'Jacob blogged'; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | private function get_description() |
| 86 | 86 | { |
| 87 | - switch($this->post['type']) |
|
| 87 | + switch ($this->post['type']) |
|
| 88 | 88 | { |
| 89 | 89 | case 'blog' : |
| 90 | 90 | return 'Another awesome blog post from Jacob. Did I mention it was awesome?'; |
@@ -20,15 +20,18 @@ |
||
| 20 | 20 | parent::__construct(); |
| 21 | 21 | |
| 22 | 22 | $id = URLDecode::getPiece(2); |
| 23 | - if(!$id || !is_numeric($id)) |
|
| 24 | - $this->eject(); |
|
| 23 | + if(!$id || !is_numeric($id)) {
|
|
| 24 | + $this->eject(); |
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | $post = $this->postRepository->getPostById($id); |
| 27 | - if(!$post) |
|
| 28 | - $this->eject(); |
|
| 28 | + if(!$post) {
|
|
| 29 | + $this->eject(); |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | - if(URLDecode::getPiece(1) != $post['type']) |
|
| 31 | - $this->eject(); |
|
| 32 | + if(URLDecode::getPiece(1) != $post['type']) {
|
|
| 33 | + $this->eject(); |
|
| 34 | + } |
|
| 32 | 35 | |
| 33 | 36 | $this->post = $post; |
| 34 | 37 | } |