@@ -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 |
@@ -22,13 +22,13 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function activate() |
| 24 | 24 | { |
| 25 | - foreach($this->post_array as $post) |
|
| 25 | + foreach ($this->post_array as $post) |
|
| 26 | 26 | { |
| 27 | 27 | $blog_result = BlogCollector::getBlogByTitle($post->title); |
| 28 | - if($blog_result !== null) |
|
| 28 | + if ($blog_result !== null) |
|
| 29 | 29 | { |
| 30 | 30 | $comments = CommentCollector::getCommentCountForURL(2, $post->path); |
| 31 | - if($blog_result->comments != $comments) |
|
| 31 | + if ($blog_result->comments != $comments) |
|
| 32 | 32 | { |
| 33 | 33 | $query = sprintf(self::$UPDATE_COMMENTS_QUERY, $comments, $blog_result->id); |
| 34 | 34 | Database::execute($query); |
@@ -33,8 +33,7 @@ |
||
| 33 | 33 | $query = sprintf(self::$UPDATE_COMMENTS_QUERY, $comments, $blog_result->id); |
| 34 | 34 | Database::execute($query); |
| 35 | 35 | } |
| 36 | - } |
|
| 37 | - else |
|
| 36 | + } else |
|
| 38 | 37 | { |
| 39 | 38 | $title = Database::escape($post->title); |
| 40 | 39 | $category = Database::escape($post->category); |
@@ -13,23 +13,23 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function __construct() |
| 15 | 15 | { |
| 16 | - if(Loader::isLive()) |
|
| 16 | + if (Loader::isLive()) |
|
| 17 | 17 | $handle[] = self::$live_root; |
| 18 | 18 | else |
| 19 | 19 | $handle[] = self::$test_root; |
| 20 | 20 | |
| 21 | 21 | $i = 0; |
| 22 | - while(isset($handle[$i])) |
|
| 22 | + while (isset($handle[$i])) |
|
| 23 | 23 | { |
| 24 | 24 | $path = $handle[$i]; |
| 25 | 25 | $fh = opendir($path); |
| 26 | - while(false !== ($file = readdir($fh))) |
|
| 26 | + while (false !== ($file = readdir($fh))) |
|
| 27 | 27 | { |
| 28 | - if($file != '.' && $file != '..') |
|
| 28 | + if ($file != '.' && $file != '..') |
|
| 29 | 29 | { |
| 30 | - if(is_dir("{$path}/{$file}")) |
|
| 30 | + if (is_dir("{$path}/{$file}")) |
|
| 31 | 31 | $handle[] = "{$path}/{$file}"; |
| 32 | - if($file == 'error.log') |
|
| 32 | + if ($file == 'error.log') |
|
| 33 | 33 | $this->error_files[] = "{$path}/{$file}"; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $message = ''; |
| 44 | 44 | |
| 45 | - if(count($this->error_files) > 0) |
|
| 45 | + if (count($this->error_files) > 0) |
|
| 46 | 46 | { |
| 47 | 47 | $message .= "Errors from flat-file logs.\n\n"; |
| 48 | - foreach($this->error_files as $error_file) |
|
| 48 | + foreach ($this->error_files as $error_file) |
|
| 49 | 49 | { |
| 50 | 50 | $contents = file_get_contents($error_file); |
| 51 | 51 | $message .= "{$error_file}\n{$contents}\n\n"; |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | $mail->setMessage($message); |
| 61 | 61 | $mail->send(); |
| 62 | 62 | |
| 63 | - if(count($this->error_files) > 0) |
|
| 63 | + if (count($this->error_files) > 0) |
|
| 64 | 64 | { |
| 65 | - foreach($this->error_files as $error_file) |
|
| 65 | + foreach ($this->error_files as $error_file) |
|
| 66 | 66 | { |
| 67 | 67 | // if(file_exists($error_file)) |
| 68 | 68 | // unlink($error_file); |
@@ -13,10 +13,11 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function __construct() |
| 15 | 15 | { |
| 16 | - if(Loader::isLive()) |
|
| 17 | - $handle[] = self::$live_root; |
|
| 18 | - else |
|
| 19 | - $handle[] = self::$test_root; |
|
| 16 | + if(Loader::isLive()) {
|
|
| 17 | + $handle[] = self::$live_root; |
|
| 18 | + } else {
|
|
| 19 | + $handle[] = self::$test_root; |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | 22 | $i = 0; |
| 22 | 23 | while(isset($handle[$i])) |
@@ -27,10 +28,12 @@ discard block |
||
| 27 | 28 | { |
| 28 | 29 | if($file != '.' && $file != '..') |
| 29 | 30 | { |
| 30 | - if(is_dir("{$path}/{$file}")) |
|
| 31 | - $handle[] = "{$path}/{$file}"; |
|
| 32 | - if($file == 'error.log') |
|
| 33 | - $this->error_files[] = "{$path}/{$file}"; |
|
| 31 | + if(is_dir("{$path}/{$file}")) {
|
|
| 32 | + $handle[] = "{$path}/{$file}";
|
|
| 33 | + } |
|
| 34 | + if($file == 'error.log') {
|
|
| 35 | + $this->error_files[] = "{$path}/{$file}";
|
|
| 36 | + } |
|
| 34 | 37 | } |
| 35 | 38 | } |
| 36 | 39 | closedir($fh); |
@@ -50,9 +53,9 @@ discard block |
||
| 50 | 53 | $contents = file_get_contents($error_file); |
| 51 | 54 | $message .= "{$error_file}\n{$contents}\n\n"; |
| 52 | 55 | } |
| 53 | - } |
|
| 54 | - else |
|
| 55 | - $message = 'No errors found in the flat-files!'; |
|
| 56 | + } else {
|
|
| 57 | + $message = 'No errors found in the flat-files!'; |
|
| 58 | + } |
|
| 56 | 59 | |
| 57 | 60 | $mail = new Mail(); |
| 58 | 61 | $mail->setToAddress('EMAIL', 'Jacob Emerick'); |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function activate() |
| 21 | 21 | { |
| 22 | - if(!$this->xml) |
|
| 22 | + if (!$this->xml) |
|
| 23 | 23 | return $this->error('Could not connect to feed.'); |
| 24 | 24 | |
| 25 | - foreach($this->xml->channel->item as $item) |
|
| 25 | + foreach ($this->xml->channel->item as $item) |
|
| 26 | 26 | { |
| 27 | - if(strtotime($item->user_read_at) <= 0) |
|
| 27 | + if (strtotime($item->user_read_at) <= 0) |
|
| 28 | 28 | continue; |
| 29 | 29 | |
| 30 | 30 | $title = $item->title; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $date_added = date('Y-m-d H:i:s', strtotime($item->user_date_created)); |
| 43 | 43 | |
| 44 | 44 | $book_result = BookCollector::getBookByFields($title, $author); |
| 45 | - if($book_result !== null) |
|
| 45 | + if ($book_result !== null) |
|
| 46 | 46 | continue; |
| 47 | 47 | |
| 48 | 48 | $query = sprintf(self::$QUERY, $title, $author, $link, $description, $image, $date_read, $date_added); |
@@ -19,13 +19,15 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function activate() |
| 21 | 21 | { |
| 22 | - if(!$this->xml) |
|
| 23 | - return $this->error('Could not connect to feed.'); |
|
| 22 | + if(!$this->xml) {
|
|
| 23 | + return $this->error('Could not connect to feed.');
|
|
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | foreach($this->xml->channel->item as $item) |
| 26 | 27 | { |
| 27 | - if(strtotime($item->user_read_at) <= 0) |
|
| 28 | - continue; |
|
| 28 | + if(strtotime($item->user_read_at) <= 0) {
|
|
| 29 | + continue; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | $title = $item->title; |
| 31 | 33 | $title = trim($title); |
@@ -42,8 +44,9 @@ discard block |
||
| 42 | 44 | $date_added = date('Y-m-d H:i:s', strtotime($item->user_date_created)); |
| 43 | 45 | |
| 44 | 46 | $book_result = BookCollector::getBookByFields($title, $author); |
| 45 | - if($book_result !== null) |
|
| 46 | - continue; |
|
| 47 | + if($book_result !== null) {
|
|
| 48 | + continue; |
|
| 49 | + } |
|
| 47 | 50 | |
| 48 | 51 | $query = sprintf(self::$QUERY, $title, $author, $link, $description, $image, $date_read, $date_added); |
| 49 | 52 | Database::execute($query); |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function activate() |
| 22 | 22 | { |
| 23 | - if(!$this->json) |
|
| 23 | + if (!$this->json) |
|
| 24 | 24 | return $this->error('Could not connect to feed.'); |
| 25 | 25 | |
| 26 | 26 | $count = 0; |
| 27 | - foreach($this->json->entries as $entry) |
|
| 27 | + foreach ($this->json->entries as $entry) |
|
| 28 | 28 | { |
| 29 | 29 | $type = $entry->workout->activity_type; |
| 30 | 30 | $type = strtolower($type); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $date = date('Y-m-d H:i:s', strtotime($entry->at)); |
| 42 | 42 | |
| 43 | 43 | $distance_result = DistanceCollector::getDistanceByFields($date, $type, $distance); |
| 44 | - if($distance_result !== null) |
|
| 44 | + if ($distance_result !== null) |
|
| 45 | 45 | continue; |
| 46 | 46 | |
| 47 | 47 | $query = sprintf(self::$QUERY, $type, $distance, $url, $felt, $title, $message, $date); |
@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function activate() |
| 22 | 22 | { |
| 23 | - if(!$this->json) |
|
| 24 | - return $this->error('Could not connect to feed.'); |
|
| 23 | + if(!$this->json) {
|
|
| 24 | + return $this->error('Could not connect to feed.');
|
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | $count = 0; |
| 27 | 28 | foreach($this->json->entries as $entry) |
@@ -41,8 +42,9 @@ discard block |
||
| 41 | 42 | $date = date('Y-m-d H:i:s', strtotime($entry->at)); |
| 42 | 43 | |
| 43 | 44 | $distance_result = DistanceCollector::getDistanceByFields($date, $type, $distance); |
| 44 | - if($distance_result !== null) |
|
| 45 | - continue; |
|
| 45 | + if($distance_result !== null) {
|
|
| 46 | + continue; |
|
| 47 | + } |
|
| 46 | 48 | |
| 47 | 49 | $query = sprintf(self::$QUERY, $type, $distance, $url, $felt, $title, $message, $date); |
| 48 | 50 | Database::execute($query); |
@@ -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 | } |
@@ -7,27 +7,27 @@ discard block |
||
| 7 | 7 | class BrowserEnvironment extends Environment |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - private static $MATCH_NOT_OPERA = '/opera|webtv/i'; |
|
| 11 | - private static $MATCH_INTERNET_EXPLORER = '/msie\s([^;\s]+)/i'; |
|
| 12 | - private static $MATCH_FIREFOX = 'firefox/'; |
|
| 13 | - private static $MATCH_FIREFOX_VERSION = '/firefox\/([^\s]+)/i'; |
|
| 10 | + private static $MATCH_NOT_OPERA = '/opera|webtv/i'; |
|
| 11 | + private static $MATCH_INTERNET_EXPLORER = '/msie\s([^;\s]+)/i'; |
|
| 12 | + private static $MATCH_FIREFOX = 'firefox/'; |
|
| 13 | + private static $MATCH_FIREFOX_VERSION = '/firefox\/([^\s]+)/i'; |
|
| 14 | 14 | private static $MATCH_GECKO = 'gecko/'; |
| 15 | 15 | private static $MATCH_OPERA = '/opera(\s|\/)(\d+)/i'; |
| 16 | - private static $MATCH_KONQUEROR = 'konqueror'; |
|
| 16 | + private static $MATCH_KONQUEROR = 'konqueror'; |
|
| 17 | 17 | private static $MATCH_CHROME = 'chrome'; |
| 18 | 18 | private static $MATCH_CHROME_VERSION = '/chrome\/([^\s]+)/i'; |
| 19 | - private static $MATCH_IRON = 'iron'; |
|
| 19 | + private static $MATCH_IRON = 'iron'; |
|
| 20 | 20 | private static $MATCH_SAFARI = 'applewebkit'; |
| 21 | 21 | private static $MATCH_SAFARI_VERSION = '/version\/(\d+)/i'; |
| 22 | - private static $MATCH_MOZILLA = 'mozilla/'; |
|
| 22 | + private static $MATCH_MOZILLA = 'mozilla/'; |
|
| 23 | 23 | |
| 24 | - private static $NAME_INTERNET_EXPLORER = 'explorer'; |
|
| 25 | - private static $NAME_FIREFOX = 'firefox'; |
|
| 24 | + private static $NAME_INTERNET_EXPLORER = 'explorer'; |
|
| 25 | + private static $NAME_FIREFOX = 'firefox'; |
|
| 26 | 26 | private static $NAME_GECKO = 'gecko'; |
| 27 | 27 | private static $NAME_OPERA = 'opera'; |
| 28 | - private static $NAME_KONQUEROR = 'konqueror'; |
|
| 28 | + private static $NAME_KONQUEROR = 'konqueror'; |
|
| 29 | 29 | private static $NAME_CHROME = 'chrome'; |
| 30 | - private static $NAME_IRON = 'iron'; |
|
| 30 | + private static $NAME_IRON = 'iron'; |
|
| 31 | 31 | private static $NAME_SAFARI = 'safari'; |
| 32 | 32 | private static $NAME_MOZILLA = 'mozilla'; |
| 33 | 33 | private static $NAME_UNKNOWN = 'unknown'; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | private $name; |
| 36 | 36 | public function getName() |
| 37 | 37 | { |
| 38 | - if(!isset($this->name)) |
|
| 38 | + if (!isset($this->name)) |
|
| 39 | 39 | $this->process(); |
| 40 | 40 | return $this->name; |
| 41 | 41 | } |
@@ -43,55 +43,55 @@ discard block |
||
| 43 | 43 | private $version; |
| 44 | 44 | public function getVersion() |
| 45 | 45 | { |
| 46 | - if(!isset($this->name)) |
|
| 46 | + if (!isset($this->name)) |
|
| 47 | 47 | $this->process(); |
| 48 | 48 | return $this->version; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | private function process() |
| 52 | 52 | { |
| 53 | - if(!preg_match(self::$MATCH_NOT_OPERA, $this->user_agent) && |
|
| 53 | + if (!preg_match(self::$MATCH_NOT_OPERA, $this->user_agent) && |
|
| 54 | 54 | preg_match(self::$MATCH_INTERNET_EXPLORER, $this->user_agent, $version)) |
| 55 | 55 | { |
| 56 | 56 | $this->name = self::$NAME_INTERNET_EXPLORER; |
| 57 | 57 | $this->version = $version[1]; |
| 58 | 58 | } |
| 59 | - else if(stristr($this->user_agent, self::$MATCH_FIREFOX)) |
|
| 59 | + else if (stristr($this->user_agent, self::$MATCH_FIREFOX)) |
|
| 60 | 60 | { |
| 61 | 61 | $this->name = self::$NAME_FIREFOX; |
| 62 | - if(preg_match(self::$MATCH_FIREFOX_VERSION, $this->user_agent, $version)) |
|
| 62 | + if (preg_match(self::$MATCH_FIREFOX_VERSION, $this->user_agent, $version)) |
|
| 63 | 63 | $this->version = $version[1]; |
| 64 | 64 | } |
| 65 | - else if(stristr($this->user_agent, self::$MATCH_GECKO)) |
|
| 65 | + else if (stristr($this->user_agent, self::$MATCH_GECKO)) |
|
| 66 | 66 | { |
| 67 | 67 | $this->name = self::$NAME_GECKO; |
| 68 | 68 | } |
| 69 | - else if(preg_match(self::$MATCH_OPERA, $this->user_agent, $version)) |
|
| 69 | + else if (preg_match(self::$MATCH_OPERA, $this->user_agent, $version)) |
|
| 70 | 70 | { |
| 71 | 71 | $this->name = self::$NAME_OPERA; |
| 72 | 72 | $this->version = $version[2]; |
| 73 | 73 | } |
| 74 | - else if(stristr($this->user_agent, self::$MATCH_KONQUEROR)) |
|
| 74 | + else if (stristr($this->user_agent, self::$MATCH_KONQUEROR)) |
|
| 75 | 75 | { |
| 76 | 76 | $this->name = self::$NAME_KONQUEROR; |
| 77 | 77 | } |
| 78 | - else if(stristr($this->user_agent, self::$MATCH_CHROME)) |
|
| 78 | + else if (stristr($this->user_agent, self::$MATCH_CHROME)) |
|
| 79 | 79 | { |
| 80 | 80 | $this->name = self::$NAME_CHROME; |
| 81 | - if(preg_match(self::$MATCH_CHROME_VERSION, $this->user_agent, $version)) |
|
| 81 | + if (preg_match(self::$MATCH_CHROME_VERSION, $this->user_agent, $version)) |
|
| 82 | 82 | $this->version = $version[1]; |
| 83 | 83 | } |
| 84 | - else if(stristr($this->user_agent, self::$MATCH_IRON)) |
|
| 84 | + else if (stristr($this->user_agent, self::$MATCH_IRON)) |
|
| 85 | 85 | { |
| 86 | 86 | $this->name = self::$NAME_IRON; |
| 87 | 87 | } |
| 88 | - else if(stristr($this->user_agent, self::$MATCH_SAFARI)) |
|
| 88 | + else if (stristr($this->user_agent, self::$MATCH_SAFARI)) |
|
| 89 | 89 | { |
| 90 | 90 | $this->name = self::$NAME_SAFARI; |
| 91 | - if(preg_match(self::$MATCH_SAFARI_VERSION, $this->user_agent, $version)) |
|
| 91 | + if (preg_match(self::$MATCH_SAFARI_VERSION, $this->user_agent, $version)) |
|
| 92 | 92 | $this->version = $version[1]; |
| 93 | 93 | } |
| 94 | - else if(stristr($this->user_agent, self::$MATCH_MOZILLA)) |
|
| 94 | + else if (stristr($this->user_agent, self::$MATCH_MOZILLA)) |
|
| 95 | 95 | { |
| 96 | 96 | $this->name = self::$NAME_MOZILLA; |
| 97 | 97 | } |
@@ -35,16 +35,18 @@ discard block |
||
| 35 | 35 | private $name; |
| 36 | 36 | public function getName() |
| 37 | 37 | { |
| 38 | - if(!isset($this->name)) |
|
| 39 | - $this->process(); |
|
| 38 | + if(!isset($this->name)) {
|
|
| 39 | + $this->process(); |
|
| 40 | + } |
|
| 40 | 41 | return $this->name; |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | private $version; |
| 44 | 45 | public function getVersion() |
| 45 | 46 | { |
| 46 | - if(!isset($this->name)) |
|
| 47 | - $this->process(); |
|
| 47 | + if(!isset($this->name)) {
|
|
| 48 | + $this->process(); |
|
| 49 | + } |
|
| 48 | 50 | return $this->version; |
| 49 | 51 | } |
| 50 | 52 | |
@@ -55,47 +57,41 @@ discard block |
||
| 55 | 57 | { |
| 56 | 58 | $this->name = self::$NAME_INTERNET_EXPLORER; |
| 57 | 59 | $this->version = $version[1]; |
| 58 | - } |
|
| 59 | - else if(stristr($this->user_agent, self::$MATCH_FIREFOX)) |
|
| 60 | + } else if(stristr($this->user_agent, self::$MATCH_FIREFOX)) |
|
| 60 | 61 | { |
| 61 | 62 | $this->name = self::$NAME_FIREFOX; |
| 62 | - if(preg_match(self::$MATCH_FIREFOX_VERSION, $this->user_agent, $version)) |
|
| 63 | - $this->version = $version[1]; |
|
| 64 | - } |
|
| 65 | - else if(stristr($this->user_agent, self::$MATCH_GECKO)) |
|
| 63 | + if(preg_match(self::$MATCH_FIREFOX_VERSION, $this->user_agent, $version)) {
|
|
| 64 | + $this->version = $version[1]; |
|
| 65 | + } |
|
| 66 | + } else if(stristr($this->user_agent, self::$MATCH_GECKO)) |
|
| 66 | 67 | { |
| 67 | 68 | $this->name = self::$NAME_GECKO; |
| 68 | - } |
|
| 69 | - else if(preg_match(self::$MATCH_OPERA, $this->user_agent, $version)) |
|
| 69 | + } else if(preg_match(self::$MATCH_OPERA, $this->user_agent, $version)) |
|
| 70 | 70 | { |
| 71 | 71 | $this->name = self::$NAME_OPERA; |
| 72 | 72 | $this->version = $version[2]; |
| 73 | - } |
|
| 74 | - else if(stristr($this->user_agent, self::$MATCH_KONQUEROR)) |
|
| 73 | + } else if(stristr($this->user_agent, self::$MATCH_KONQUEROR)) |
|
| 75 | 74 | { |
| 76 | 75 | $this->name = self::$NAME_KONQUEROR; |
| 77 | - } |
|
| 78 | - else if(stristr($this->user_agent, self::$MATCH_CHROME)) |
|
| 76 | + } else if(stristr($this->user_agent, self::$MATCH_CHROME)) |
|
| 79 | 77 | { |
| 80 | 78 | $this->name = self::$NAME_CHROME; |
| 81 | - if(preg_match(self::$MATCH_CHROME_VERSION, $this->user_agent, $version)) |
|
| 82 | - $this->version = $version[1]; |
|
| 83 | - } |
|
| 84 | - else if(stristr($this->user_agent, self::$MATCH_IRON)) |
|
| 79 | + if(preg_match(self::$MATCH_CHROME_VERSION, $this->user_agent, $version)) {
|
|
| 80 | + $this->version = $version[1]; |
|
| 81 | + } |
|
| 82 | + } else if(stristr($this->user_agent, self::$MATCH_IRON)) |
|
| 85 | 83 | { |
| 86 | 84 | $this->name = self::$NAME_IRON; |
| 87 | - } |
|
| 88 | - else if(stristr($this->user_agent, self::$MATCH_SAFARI)) |
|
| 85 | + } else if(stristr($this->user_agent, self::$MATCH_SAFARI)) |
|
| 89 | 86 | { |
| 90 | 87 | $this->name = self::$NAME_SAFARI; |
| 91 | - if(preg_match(self::$MATCH_SAFARI_VERSION, $this->user_agent, $version)) |
|
| 92 | - $this->version = $version[1]; |
|
| 93 | - } |
|
| 94 | - else if(stristr($this->user_agent, self::$MATCH_MOZILLA)) |
|
| 88 | + if(preg_match(self::$MATCH_SAFARI_VERSION, $this->user_agent, $version)) {
|
|
| 89 | + $this->version = $version[1]; |
|
| 90 | + } |
|
| 91 | + } else if(stristr($this->user_agent, self::$MATCH_MOZILLA)) |
|
| 95 | 92 | { |
| 96 | 93 | $this->name = self::$NAME_MOZILLA; |
| 97 | - } |
|
| 98 | - else |
|
| 94 | + } else |
|
| 99 | 95 | { |
| 100 | 96 | $this->name = self::$NAME_UNKNOWN; |
| 101 | 97 | } |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | private static $MATCH_MOBILE = 'j2me'; |
| 11 | 11 | private static $MATCH_IPHONE = 'iphone'; |
| 12 | - private static $MATCH_WINDOWS_PHONE = 'windows ce'; |
|
| 12 | + private static $MATCH_WINDOWS_PHONE = 'windows ce'; |
|
| 13 | 13 | private static $MATCH_NOKIA = 'nokia'; |
| 14 | - private static $MATCH_IPOD = 'ipod'; |
|
| 14 | + private static $MATCH_IPOD = 'ipod'; |
|
| 15 | 15 | private static $MATCH_MAC = 'mac'; |
| 16 | 16 | private static $MATCH_DARWIN = 'darwin'; |
| 17 | 17 | private static $MATCH_WEBTV = 'webtv'; |
@@ -21,23 +21,23 @@ discard block |
||
| 21 | 21 | 'windows nt 4.0', |
| 22 | 22 | 'winnt4.0', |
| 23 | 23 | 'winnt'); |
| 24 | - private static $MATCH_WINDOWS_95 = array( |
|
| 24 | + private static $MATCH_WINDOWS_95 = array( |
|
| 25 | 25 | 'windows 95', |
| 26 | 26 | 'win95', |
| 27 | 27 | 'windows_95'); |
| 28 | - private static $MATCH_WINDOWS_98 = array( |
|
| 28 | + private static $MATCH_WINDOWS_98 = array( |
|
| 29 | 29 | 'windows 98', |
| 30 | 30 | 'win98'); |
| 31 | - private static $MATCH_WINDOWS_2000 = array( |
|
| 31 | + private static $MATCH_WINDOWS_2000 = array( |
|
| 32 | 32 | 'windows nt 5.0', |
| 33 | 33 | 'windows 2000'); |
| 34 | 34 | private static $MATCH_WINDOWS_ME = 'windows me'; |
| 35 | - private static $MATCH_WINDOWS_S_03 = 'windows nt 5.2'; |
|
| 35 | + private static $MATCH_WINDOWS_S_03 = 'windows nt 5.2'; |
|
| 36 | 36 | private static $MATCH_WINDOWS_XP = array( |
| 37 | 37 | 'windows nt 5.1', |
| 38 | 38 | 'windows xp'); |
| 39 | - private static $MATCH_WINDOWS_VISTA = 'windows nt 6.0'; |
|
| 40 | - private static $MATCH_WINDOWS_7 = array( |
|
| 39 | + private static $MATCH_WINDOWS_VISTA = 'windows nt 6.0'; |
|
| 40 | + private static $MATCH_WINDOWS_7 = array( |
|
| 41 | 41 | 'windows nt 6.1', |
| 42 | 42 | 'windows nt 7.0'); |
| 43 | 43 | private static $MATCH_OPENBSD = 'openbsd'; |
@@ -46,53 +46,53 @@ discard block |
||
| 46 | 46 | private static $MATCH_LINUX = array( |
| 47 | 47 | 'linux', |
| 48 | 48 | 'x11'); |
| 49 | - private static $MATCH_GOOGLEBOT = 'googlebot'; |
|
| 49 | + private static $MATCH_GOOGLEBOT = 'googlebot'; |
|
| 50 | 50 | private static $MATCH_GOOGLE_VIEW = 'google web preview'; |
| 51 | - private static $MATCH_GOOGLE_READER = 'feedfetcher-google'; |
|
| 51 | + private static $MATCH_GOOGLE_READER = 'feedfetcher-google'; |
|
| 52 | 52 | private static $MATCH_GOOGLE_DESK = 'google desktop'; |
| 53 | - private static $MATCH_BING = array( |
|
| 53 | + private static $MATCH_BING = array( |
|
| 54 | 54 | 'bingbot', |
| 55 | 55 | 'msnbot'); |
| 56 | - private static $MATCH_ASK = 'ask jeeves'; |
|
| 56 | + private static $MATCH_ASK = 'ask jeeves'; |
|
| 57 | 57 | private static $MATCH_EXABOT = 'exabot'; |
| 58 | - private static $MATCH_GEOHASH = 'geohasher'; |
|
| 59 | - private static $MATCH_POST_RANK = 'postrank'; |
|
| 58 | + private static $MATCH_GEOHASH = 'geohasher'; |
|
| 59 | + private static $MATCH_POST_RANK = 'postrank'; |
|
| 60 | 60 | private static $MATCH_RADIAN = 'r6_commentreader'; |
| 61 | - private static $MATCH_BAIDU_SPIDER = 'baiduspider'; |
|
| 62 | - private static $MATCH_BLEKKO_SPIDER = 'scoutjet'; |
|
| 63 | - private static $MATCH_WLA = 'wla syndication platform'; |
|
| 64 | - private static $MATCH_FACEBOOK = 'facebookexternalhit'; |
|
| 65 | - private static $MATCH_BLOGLINES = 'bloglines'; |
|
| 66 | - private static $MATCH_R6 = 'r6_feedfetcher'; |
|
| 67 | - private static $MATCH_AOL_FAVICON = 'ee://aol/http'; |
|
| 61 | + private static $MATCH_BAIDU_SPIDER = 'baiduspider'; |
|
| 62 | + private static $MATCH_BLEKKO_SPIDER = 'scoutjet'; |
|
| 63 | + private static $MATCH_WLA = 'wla syndication platform'; |
|
| 64 | + private static $MATCH_FACEBOOK = 'facebookexternalhit'; |
|
| 65 | + private static $MATCH_BLOGLINES = 'bloglines'; |
|
| 66 | + private static $MATCH_R6 = 'r6_feedfetcher'; |
|
| 67 | + private static $MATCH_AOL_FAVICON = 'ee://aol/http'; |
|
| 68 | 68 | private static $MATCH_YAHOO = 'slurp'; |
| 69 | - private static $MATCH_YAHOO_FEED = 'yahoocachesystem'; |
|
| 69 | + private static $MATCH_YAHOO_FEED = 'yahoocachesystem'; |
|
| 70 | 70 | private static $MATCH_YANDEX = 'yandexbot'; |
| 71 | 71 | private static $MATCH_HUAWEI = 'huaweisymantecspider'; |
| 72 | 72 | private static $MATCH_SOGOU = 'sogou web spider'; |
| 73 | 73 | private static $MATCH_MLBOT = 'mlbot'; |
| 74 | 74 | private static $MATCH_NETCRAFT = 'netcraftsurveyagent'; |
| 75 | 75 | private static $MATCH_TURNITIN = 'turnitinbot'; |
| 76 | - private static $MATCH_LINKEDINBOT = 'linkedinbot'; |
|
| 76 | + private static $MATCH_LINKEDINBOT = 'linkedinbot'; |
|
| 77 | 77 | private static $MATCH_ABOUT_US = 'aboutusbot'; |
| 78 | 78 | private static $MATCH_COSMIX = 'voyager'; |
| 79 | 79 | private static $MATCH_PYCURL = 'pycurl'; |
| 80 | 80 | private static $MATCH_MAJESTIC = 'mj12bot'; |
| 81 | - private static $MATCH_GIGABOT = 'gigabot'; |
|
| 81 | + private static $MATCH_GIGABOT = 'gigabot'; |
|
| 82 | 82 | private static $MATCH_ZOOKA = 'zookabot'; |
| 83 | - private static $MATCH_PANSCIENT = 'panscient'; |
|
| 83 | + private static $MATCH_PANSCIENT = 'panscient'; |
|
| 84 | 84 | private static $MATCH_LIBWWW = 'libwww-perl'; |
| 85 | 85 | private static $MATCH_DOTBOT = 'dotbot'; |
| 86 | 86 | private static $MATCH_ARCHIVER = 'ia_archiver'; |
| 87 | - private static $MATCH_ZEND = 'zend_http_client'; |
|
| 87 | + private static $MATCH_ZEND = 'zend_http_client'; |
|
| 88 | 88 | private static $MATCH_PYTHON = 'python-urllib'; |
| 89 | 89 | private static $MATCH_JAKARATA = 'jakarta commons'; |
| 90 | 90 | |
| 91 | 91 | private static $NAME_MOBILE = 'mobile'; |
| 92 | 92 | private static $NAME_IPHONE = 'iphone'; |
| 93 | - private static $NAME_WINDOWS_PHONE = 'windows phone'; |
|
| 93 | + private static $NAME_WINDOWS_PHONE = 'windows phone'; |
|
| 94 | 94 | private static $NAME_NOKIA = 'nokia'; |
| 95 | - private static $NAME_IPOD = 'ipod'; |
|
| 95 | + private static $NAME_IPOD = 'ipod'; |
|
| 96 | 96 | private static $NAME_MAC = 'macintosh'; |
| 97 | 97 | private static $NAME_WEBTV = 'webtv'; |
| 98 | 98 | private static $NAME_WII = 'wii'; |
@@ -104,30 +104,30 @@ discard block |
||
| 104 | 104 | private static $NAME_WINDOWS_ME = 'windows me'; |
| 105 | 105 | private static $NAME_WINDOWS_S_03 = 'windows server 2003'; |
| 106 | 106 | private static $NAME_WINDOWS_XP = 'windows xp'; |
| 107 | - private static $NAME_WINDOWS_VISTA = 'windows vista'; |
|
| 108 | - private static $NAME_WINDOWS_7 = 'windows 7'; |
|
| 107 | + private static $NAME_WINDOWS_VISTA = 'windows vista'; |
|
| 108 | + private static $NAME_WINDOWS_7 = 'windows 7'; |
|
| 109 | 109 | private static $NAME_OPENBSD = 'openbsd'; |
| 110 | 110 | private static $NAME_FREEBSD = 'freebsd'; |
| 111 | 111 | private static $NAME_SUNOS = 'sun os'; |
| 112 | 112 | private static $NAME_LINUX = 'linux'; |
| 113 | - private static $NAME_GOOGLEBOT = 'googlebot'; |
|
| 114 | - private static $NAME_GOOGLE_READER = 'google reader'; |
|
| 115 | - private static $NAME_GOOGLE_VIEW = 'google preview'; |
|
| 116 | - private static $NAME_GOOGLE_DESKTOP = 'google desktop'; |
|
| 117 | - private static $NAME_BING = 'bing'; |
|
| 118 | - private static $NAME_ASK = 'ask'; |
|
| 113 | + private static $NAME_GOOGLEBOT = 'googlebot'; |
|
| 114 | + private static $NAME_GOOGLE_READER = 'google reader'; |
|
| 115 | + private static $NAME_GOOGLE_VIEW = 'google preview'; |
|
| 116 | + private static $NAME_GOOGLE_DESKTOP = 'google desktop'; |
|
| 117 | + private static $NAME_BING = 'bing'; |
|
| 118 | + private static $NAME_ASK = 'ask'; |
|
| 119 | 119 | private static $NAME_EXABOT = 'exabot'; |
| 120 | 120 | private static $NAME_GEOHASH = 'geohasher'; |
| 121 | - private static $NAME_POST_RANK = 'post rank'; |
|
| 121 | + private static $NAME_POST_RANK = 'post rank'; |
|
| 122 | 122 | private static $NAME_RADIAN = 'radian comments'; |
| 123 | - private static $NAME_BAIDU_SPIDER = 'baidu'; |
|
| 124 | - private static $NAME_BLEKKO_SPIDER = 'blekko'; |
|
| 123 | + private static $NAME_BAIDU_SPIDER = 'baidu'; |
|
| 124 | + private static $NAME_BLEKKO_SPIDER = 'blekko'; |
|
| 125 | 125 | private static $NAME_WLA = 'wla bot'; |
| 126 | - private static $NAME_FACEBOOK = 'facebook'; |
|
| 127 | - private static $NAME_BLOGLINES = 'bloglines'; |
|
| 126 | + private static $NAME_FACEBOOK = 'facebook'; |
|
| 127 | + private static $NAME_BLOGLINES = 'bloglines'; |
|
| 128 | 128 | private static $NAME_R6 = 'r6 feedfetcher'; |
| 129 | 129 | private static $NAME_AOL_FAVICON = 'aol favicon'; |
| 130 | - private static $NAME_YAHOO = 'yahoo'; |
|
| 130 | + private static $NAME_YAHOO = 'yahoo'; |
|
| 131 | 131 | private static $NAME_YAHOO_FEED = 'yahoo rss'; |
| 132 | 132 | private static $NAME_YANDEX = 'yandexbox'; |
| 133 | 133 | private static $NAME_HUAWEI = 'huawei-symantec'; |
@@ -135,232 +135,232 @@ discard block |
||
| 135 | 135 | private static $NAME_MLBOT = 'mlbot'; |
| 136 | 136 | private static $NAME_NETCRAFT = 'netcraftbot'; |
| 137 | 137 | private static $NAME_TURNITIN = 'turnitinbot'; |
| 138 | - private static $NAME_LINKEDINBOT = 'linkedinbot'; |
|
| 138 | + private static $NAME_LINKEDINBOT = 'linkedinbot'; |
|
| 139 | 139 | private static $NAME_ABOUT_US = 'aboutusbot'; |
| 140 | 140 | private static $NAME_COSMIX = 'cosmixbot'; |
| 141 | 141 | private static $NAME_PYCURL = 'pycurl'; |
| 142 | 142 | private static $NAME_MAJESTIC = 'majestic 12'; |
| 143 | 143 | private static $NAME_GIGABOT = 'gigabot'; |
| 144 | - private static $NAME_ZOOKA = 'zookabot'; |
|
| 145 | - private static $NAME_PANSCIENT = 'panscient'; |
|
| 144 | + private static $NAME_ZOOKA = 'zookabot'; |
|
| 145 | + private static $NAME_PANSCIENT = 'panscient'; |
|
| 146 | 146 | private static $NAME_LIBWWW = 'libwww-perl'; |
| 147 | 147 | private static $NAME_DOTBOT = 'dotbot'; |
| 148 | 148 | private static $NAME_ARCHIVER = 'internet archive'; |
| 149 | - private static $NAME_ZEND = 'zend'; |
|
| 149 | + private static $NAME_ZEND = 'zend'; |
|
| 150 | 150 | private static $NAME_PYTHON = 'python'; |
| 151 | 151 | private static $NAME_JAKARATA = 'jakarata'; |
| 152 | 152 | private static $NAME_UNKNOWN = 'unknown'; |
| 153 | 153 | |
| 154 | 154 | public function getName() |
| 155 | 155 | { |
| 156 | - if(stristr($this->user_agent, self::$MATCH_MOBILE)) |
|
| 156 | + if (stristr($this->user_agent, self::$MATCH_MOBILE)) |
|
| 157 | 157 | return self::$NAME_MOBILE; |
| 158 | 158 | |
| 159 | - if(stristr($this->user_agent, self::$MATCH_IPHONE)) |
|
| 159 | + if (stristr($this->user_agent, self::$MATCH_IPHONE)) |
|
| 160 | 160 | return self::$NAME_IPHONE; |
| 161 | 161 | |
| 162 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_PHONE)) |
|
| 162 | + if (stristr($this->user_agent, self::$MATCH_WINDOWS_PHONE)) |
|
| 163 | 163 | return self::$NAME_WINDOWS_PHONE; |
| 164 | 164 | |
| 165 | - if(stristr($this->user_agent, self::$MATCH_NOKIA)) |
|
| 165 | + if (stristr($this->user_agent, self::$MATCH_NOKIA)) |
|
| 166 | 166 | return self::$NAME_NOKIA; |
| 167 | 167 | |
| 168 | - if(stristr($this->user_agent, self::$MATCH_IPOD)) |
|
| 168 | + if (stristr($this->user_agent, self::$MATCH_IPOD)) |
|
| 169 | 169 | return self::$NAME_IPOD; |
| 170 | 170 | |
| 171 | - if(stristr($this->user_agent, self::$MATCH_MAC)) |
|
| 171 | + if (stristr($this->user_agent, self::$MATCH_MAC)) |
|
| 172 | 172 | return self::$NAME_MAC; |
| 173 | 173 | |
| 174 | - if(stristr($this->user_agent, self::$MATCH_DARWIN)) |
|
| 174 | + if (stristr($this->user_agent, self::$MATCH_DARWIN)) |
|
| 175 | 175 | return self::$NAME_MAC; |
| 176 | 176 | |
| 177 | - if(stristr($this->user_agent, self::$MATCH_WEBTV)) |
|
| 177 | + if (stristr($this->user_agent, self::$MATCH_WEBTV)) |
|
| 178 | 178 | return self::$NAME_WEBTV; |
| 179 | 179 | |
| 180 | - if(stristr($this->user_agent, self::$MATCH_WII)) |
|
| 180 | + if (stristr($this->user_agent, self::$MATCH_WII)) |
|
| 181 | 181 | return self::$NAME_WII; |
| 182 | 182 | |
| 183 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_3)) |
|
| 183 | + if (stristr($this->user_agent, self::$MATCH_WINDOWS_3)) |
|
| 184 | 184 | return self::$NAME_WINDOWS_3; |
| 185 | 185 | |
| 186 | - foreach(self::$MATCH_WINDOWS_4 as $match) |
|
| 186 | + foreach (self::$MATCH_WINDOWS_4 as $match) |
|
| 187 | 187 | { |
| 188 | - if(stristr($this->user_agent, $match)) |
|
| 188 | + if (stristr($this->user_agent, $match)) |
|
| 189 | 189 | return self::$NAME_WINDOWS_4; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - foreach(self::$MATCH_WINDOWS_95 as $match) |
|
| 192 | + foreach (self::$MATCH_WINDOWS_95 as $match) |
|
| 193 | 193 | { |
| 194 | - if(stristr($this->user_agent, $match)) |
|
| 194 | + if (stristr($this->user_agent, $match)) |
|
| 195 | 195 | return self::$NAME_WINDOWS_95; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - foreach(self::$MATCH_WINDOWS_98 as $match) |
|
| 198 | + foreach (self::$MATCH_WINDOWS_98 as $match) |
|
| 199 | 199 | { |
| 200 | - if(stristr($this->user_agent, $match)) |
|
| 200 | + if (stristr($this->user_agent, $match)) |
|
| 201 | 201 | return self::$NAME_WINDOWS_98; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - foreach(self::$MATCH_WINDOWS_2000 as $match) |
|
| 204 | + foreach (self::$MATCH_WINDOWS_2000 as $match) |
|
| 205 | 205 | { |
| 206 | - if(stristr($this->user_agent, $match)) |
|
| 206 | + if (stristr($this->user_agent, $match)) |
|
| 207 | 207 | return self::$NAME_WINDOWS_2000; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_ME)) |
|
| 210 | + if (stristr($this->user_agent, self::$MATCH_WINDOWS_ME)) |
|
| 211 | 211 | return self::$NAME_WINDOWS_ME; |
| 212 | 212 | |
| 213 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_S_03)) |
|
| 213 | + if (stristr($this->user_agent, self::$MATCH_WINDOWS_S_03)) |
|
| 214 | 214 | return self::$NAME_WINDOWS_S_03; |
| 215 | 215 | |
| 216 | - foreach(self::$MATCH_WINDOWS_XP as $match) |
|
| 216 | + foreach (self::$MATCH_WINDOWS_XP as $match) |
|
| 217 | 217 | { |
| 218 | - if(stristr($this->user_agent, $match)) |
|
| 218 | + if (stristr($this->user_agent, $match)) |
|
| 219 | 219 | return self::$NAME_WINDOWS_XP; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_VISTA)) |
|
| 222 | + if (stristr($this->user_agent, self::$MATCH_WINDOWS_VISTA)) |
|
| 223 | 223 | return self::$NAME_WINDOWS_VISTA; |
| 224 | 224 | |
| 225 | - foreach(self::$MATCH_WINDOWS_7 as $match) |
|
| 225 | + foreach (self::$MATCH_WINDOWS_7 as $match) |
|
| 226 | 226 | { |
| 227 | - if(stristr($this->user_agent, $match)) |
|
| 227 | + if (stristr($this->user_agent, $match)) |
|
| 228 | 228 | return self::$NAME_WINDOWS_7; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if(stristr($this->user_agent, self::$MATCH_OPENBSD)) |
|
| 231 | + if (stristr($this->user_agent, self::$MATCH_OPENBSD)) |
|
| 232 | 232 | return self::$NAME_OPENBSD; |
| 233 | 233 | |
| 234 | - if(stristr($this->user_agent, self::$MATCH_FREEBSD)) |
|
| 234 | + if (stristr($this->user_agent, self::$MATCH_FREEBSD)) |
|
| 235 | 235 | return self::$NAME_FREEBSD; |
| 236 | 236 | |
| 237 | - if(stristr($this->user_agent, self::$MATCH_SUNOS)) |
|
| 237 | + if (stristr($this->user_agent, self::$MATCH_SUNOS)) |
|
| 238 | 238 | return self::$NAME_SUNOS; |
| 239 | 239 | |
| 240 | - foreach(self::$MATCH_LINUX as $match) |
|
| 240 | + foreach (self::$MATCH_LINUX as $match) |
|
| 241 | 241 | { |
| 242 | - if(stristr($this->user_agent, $match)) |
|
| 242 | + if (stristr($this->user_agent, $match)) |
|
| 243 | 243 | return self::$NAME_LINUX; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if(stristr($this->user_agent, self::$MATCH_GOOGLEBOT)) |
|
| 246 | + if (stristr($this->user_agent, self::$MATCH_GOOGLEBOT)) |
|
| 247 | 247 | return self::$NAME_GOOGLEBOT; |
| 248 | 248 | |
| 249 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_READER)) |
|
| 249 | + if (stristr($this->user_agent, self::$MATCH_GOOGLE_READER)) |
|
| 250 | 250 | return self::$NAME_GOOGLE_READER; |
| 251 | 251 | |
| 252 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_VIEW)) |
|
| 252 | + if (stristr($this->user_agent, self::$MATCH_GOOGLE_VIEW)) |
|
| 253 | 253 | return self::$NAME_GOOGLE_VIEW; |
| 254 | 254 | |
| 255 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_DESK)) |
|
| 255 | + if (stristr($this->user_agent, self::$MATCH_GOOGLE_DESK)) |
|
| 256 | 256 | return self::$NAME_GOOGLE_DESKTOP; |
| 257 | 257 | |
| 258 | - foreach(self::$MATCH_BING as $match) |
|
| 258 | + foreach (self::$MATCH_BING as $match) |
|
| 259 | 259 | { |
| 260 | - if(stristr($this->user_agent, $match)) |
|
| 260 | + if (stristr($this->user_agent, $match)) |
|
| 261 | 261 | return self::$NAME_BING; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if(stristr($this->user_agent, self::$MATCH_ASK)) |
|
| 264 | + if (stristr($this->user_agent, self::$MATCH_ASK)) |
|
| 265 | 265 | return self::$NAME_ASK; |
| 266 | 266 | |
| 267 | - if(stristr($this->user_agent, self::$MATCH_EXABOT)) |
|
| 267 | + if (stristr($this->user_agent, self::$MATCH_EXABOT)) |
|
| 268 | 268 | return self::$NAME_EXABOT; |
| 269 | 269 | |
| 270 | - if(stristr($this->user_agent, self::$MATCH_GEOHASH)) |
|
| 270 | + if (stristr($this->user_agent, self::$MATCH_GEOHASH)) |
|
| 271 | 271 | return self::$NAME_GEOHASH; |
| 272 | 272 | |
| 273 | - if(stristr($this->user_agent, self::$MATCH_POST_RANK)) |
|
| 273 | + if (stristr($this->user_agent, self::$MATCH_POST_RANK)) |
|
| 274 | 274 | return self::$NAME_POST_RANK; |
| 275 | 275 | |
| 276 | - if(stristr($this->user_agent, self::$MATCH_BAIDU_SPIDER)) |
|
| 276 | + if (stristr($this->user_agent, self::$MATCH_BAIDU_SPIDER)) |
|
| 277 | 277 | return self::$NAME_BAIDU_SPIDER; |
| 278 | 278 | |
| 279 | - if(stristr($this->user_agent, self::$MATCH_RADIAN)) |
|
| 279 | + if (stristr($this->user_agent, self::$MATCH_RADIAN)) |
|
| 280 | 280 | return self::$NAME_RADIAN; |
| 281 | 281 | |
| 282 | - if(stristr($this->user_agent, self::$MATCH_BLEKKO_SPIDER)) |
|
| 282 | + if (stristr($this->user_agent, self::$MATCH_BLEKKO_SPIDER)) |
|
| 283 | 283 | return self::$NAME_BLEKKO_SPIDER; |
| 284 | 284 | |
| 285 | - if(stristr($this->user_agent, self::$MATCH_WLA)) |
|
| 285 | + if (stristr($this->user_agent, self::$MATCH_WLA)) |
|
| 286 | 286 | return self::$NAME_WLA; |
| 287 | 287 | |
| 288 | - if(stristr($this->user_agent, self::$MATCH_FACEBOOK)) |
|
| 288 | + if (stristr($this->user_agent, self::$MATCH_FACEBOOK)) |
|
| 289 | 289 | return self::$NAME_FACEBOOK; |
| 290 | 290 | |
| 291 | - if(stristr($this->user_agent, self::$MATCH_BLOGLINES)) |
|
| 291 | + if (stristr($this->user_agent, self::$MATCH_BLOGLINES)) |
|
| 292 | 292 | return self::$NAME_BLOGLINES; |
| 293 | 293 | |
| 294 | - if(stristr($this->user_agent, self::$MATCH_R6)) |
|
| 294 | + if (stristr($this->user_agent, self::$MATCH_R6)) |
|
| 295 | 295 | return self::$NAME_R6; |
| 296 | 296 | |
| 297 | - if(stristr($this->user_agent, self::$MATCH_AOL_FAVICON)) |
|
| 297 | + if (stristr($this->user_agent, self::$MATCH_AOL_FAVICON)) |
|
| 298 | 298 | return self::$NAME_AOL_FAVICON; |
| 299 | 299 | |
| 300 | - if(stristr($this->user_agent, self::$MATCH_YAHOO)) |
|
| 300 | + if (stristr($this->user_agent, self::$MATCH_YAHOO)) |
|
| 301 | 301 | return self::$NAME_YAHOO; |
| 302 | 302 | |
| 303 | - if(stristr($this->user_agent, self::$MATCH_YAHOO_FEED)) |
|
| 303 | + if (stristr($this->user_agent, self::$MATCH_YAHOO_FEED)) |
|
| 304 | 304 | return self::$NAME_YAHOO_FEED; |
| 305 | 305 | |
| 306 | - if(stristr($this->user_agent, self::$MATCH_YANDEX)) |
|
| 306 | + if (stristr($this->user_agent, self::$MATCH_YANDEX)) |
|
| 307 | 307 | return self::$NAME_YANDEX; |
| 308 | 308 | |
| 309 | - if(stristr($this->user_agent, self::$MATCH_HUAWEI)) |
|
| 309 | + if (stristr($this->user_agent, self::$MATCH_HUAWEI)) |
|
| 310 | 310 | return self::$NAME_HUAWEI; |
| 311 | 311 | |
| 312 | - if(stristr($this->user_agent, self::$MATCH_SOGOU)) |
|
| 312 | + if (stristr($this->user_agent, self::$MATCH_SOGOU)) |
|
| 313 | 313 | return self::$NAME_SOGOU; |
| 314 | 314 | |
| 315 | - if(stristr($this->user_agent, self::$MATCH_MLBOT)) |
|
| 315 | + if (stristr($this->user_agent, self::$MATCH_MLBOT)) |
|
| 316 | 316 | return self::$NAME_MLBOT; |
| 317 | 317 | |
| 318 | - if(stristr($this->user_agent, self::$MATCH_NETCRAFT)) |
|
| 318 | + if (stristr($this->user_agent, self::$MATCH_NETCRAFT)) |
|
| 319 | 319 | return self::$NAME_NETCRAFT; |
| 320 | 320 | |
| 321 | - if(stristr($this->user_agent, self::$MATCH_TURNITIN)) |
|
| 321 | + if (stristr($this->user_agent, self::$MATCH_TURNITIN)) |
|
| 322 | 322 | return self::$NAME_TURNITIN; |
| 323 | 323 | |
| 324 | - if(stristr($this->user_agent, self::$MATCH_LINKEDINBOT)) |
|
| 324 | + if (stristr($this->user_agent, self::$MATCH_LINKEDINBOT)) |
|
| 325 | 325 | return self::$NAME_LINKEDINBOT; |
| 326 | 326 | |
| 327 | - if(stristr($this->user_agent, self::$MATCH_ABOUT_US)) |
|
| 327 | + if (stristr($this->user_agent, self::$MATCH_ABOUT_US)) |
|
| 328 | 328 | return self::$NAME_ABOUT_US; |
| 329 | 329 | |
| 330 | - if(stristr($this->user_agent, self::$MATCH_COSMIX)) |
|
| 330 | + if (stristr($this->user_agent, self::$MATCH_COSMIX)) |
|
| 331 | 331 | return self::$NAME_COSMIX; |
| 332 | 332 | |
| 333 | - if(stristr($this->user_agent, self::$MATCH_PYCURL)) |
|
| 333 | + if (stristr($this->user_agent, self::$MATCH_PYCURL)) |
|
| 334 | 334 | return self::$NAME_PYCURL; |
| 335 | 335 | |
| 336 | - if(stristr($this->user_agent, self::$MATCH_MAJESTIC)) |
|
| 336 | + if (stristr($this->user_agent, self::$MATCH_MAJESTIC)) |
|
| 337 | 337 | return self::$NAME_MAJESTIC; |
| 338 | 338 | |
| 339 | - if(stristr($this->user_agent, self::$MATCH_GIGABOT)) |
|
| 339 | + if (stristr($this->user_agent, self::$MATCH_GIGABOT)) |
|
| 340 | 340 | return self::$NAME_GIGABOT; |
| 341 | 341 | |
| 342 | - if(stristr($this->user_agent, self::$MATCH_ZOOKA)) |
|
| 342 | + if (stristr($this->user_agent, self::$MATCH_ZOOKA)) |
|
| 343 | 343 | return self::$NAME_ZOOKA; |
| 344 | 344 | |
| 345 | - if(stristr($this->user_agent, self::$MATCH_PANSCIENT)) |
|
| 345 | + if (stristr($this->user_agent, self::$MATCH_PANSCIENT)) |
|
| 346 | 346 | return self::$NAME_PANSCIENT; |
| 347 | 347 | |
| 348 | - if(stristr($this->user_agent, self::$MATCH_LIBWWW)) |
|
| 348 | + if (stristr($this->user_agent, self::$MATCH_LIBWWW)) |
|
| 349 | 349 | return self::$NAME_LIBWWW; |
| 350 | 350 | |
| 351 | - if(stristr($this->user_agent, self::$MATCH_DOTBOT)) |
|
| 351 | + if (stristr($this->user_agent, self::$MATCH_DOTBOT)) |
|
| 352 | 352 | return self::$NAME_DOTBOT; |
| 353 | 353 | |
| 354 | - if(stristr($this->user_agent, self::$MATCH_ARCHIVER)) |
|
| 354 | + if (stristr($this->user_agent, self::$MATCH_ARCHIVER)) |
|
| 355 | 355 | return self::$NAME_ARCHIVER; |
| 356 | 356 | |
| 357 | - if(stristr($this->user_agent, self::$MATCH_ZEND)) |
|
| 357 | + if (stristr($this->user_agent, self::$MATCH_ZEND)) |
|
| 358 | 358 | return self::$NAME_ZEND; |
| 359 | 359 | |
| 360 | - if(stristr($this->user_agent, self::$MATCH_PYTHON)) |
|
| 360 | + if (stristr($this->user_agent, self::$MATCH_PYTHON)) |
|
| 361 | 361 | return self::$NAME_PYTHON; |
| 362 | 362 | |
| 363 | - if(stristr($this->user_agent, self::$MATCH_JAKARATA)) |
|
| 363 | + if (stristr($this->user_agent, self::$MATCH_JAKARATA)) |
|
| 364 | 364 | return self::$NAME_JAKARATA; |
| 365 | 365 | |
| 366 | 366 | return self::$NAME_UNKNOWN; |
@@ -153,215 +153,277 @@ |
||
| 153 | 153 | |
| 154 | 154 | public function getName() |
| 155 | 155 | { |
| 156 | - if(stristr($this->user_agent, self::$MATCH_MOBILE)) |
|
| 157 | - return self::$NAME_MOBILE; |
|
| 156 | + if(stristr($this->user_agent, self::$MATCH_MOBILE)) {
|
|
| 157 | + return self::$NAME_MOBILE; |
|
| 158 | + } |
|
| 158 | 159 | |
| 159 | - if(stristr($this->user_agent, self::$MATCH_IPHONE)) |
|
| 160 | - return self::$NAME_IPHONE; |
|
| 160 | + if(stristr($this->user_agent, self::$MATCH_IPHONE)) {
|
|
| 161 | + return self::$NAME_IPHONE; |
|
| 162 | + } |
|
| 161 | 163 | |
| 162 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_PHONE)) |
|
| 163 | - return self::$NAME_WINDOWS_PHONE; |
|
| 164 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_PHONE)) {
|
|
| 165 | + return self::$NAME_WINDOWS_PHONE; |
|
| 166 | + } |
|
| 164 | 167 | |
| 165 | - if(stristr($this->user_agent, self::$MATCH_NOKIA)) |
|
| 166 | - return self::$NAME_NOKIA; |
|
| 168 | + if(stristr($this->user_agent, self::$MATCH_NOKIA)) {
|
|
| 169 | + return self::$NAME_NOKIA; |
|
| 170 | + } |
|
| 167 | 171 | |
| 168 | - if(stristr($this->user_agent, self::$MATCH_IPOD)) |
|
| 169 | - return self::$NAME_IPOD; |
|
| 172 | + if(stristr($this->user_agent, self::$MATCH_IPOD)) {
|
|
| 173 | + return self::$NAME_IPOD; |
|
| 174 | + } |
|
| 170 | 175 | |
| 171 | - if(stristr($this->user_agent, self::$MATCH_MAC)) |
|
| 172 | - return self::$NAME_MAC; |
|
| 176 | + if(stristr($this->user_agent, self::$MATCH_MAC)) {
|
|
| 177 | + return self::$NAME_MAC; |
|
| 178 | + } |
|
| 173 | 179 | |
| 174 | - if(stristr($this->user_agent, self::$MATCH_DARWIN)) |
|
| 175 | - return self::$NAME_MAC; |
|
| 180 | + if(stristr($this->user_agent, self::$MATCH_DARWIN)) {
|
|
| 181 | + return self::$NAME_MAC; |
|
| 182 | + } |
|
| 176 | 183 | |
| 177 | - if(stristr($this->user_agent, self::$MATCH_WEBTV)) |
|
| 178 | - return self::$NAME_WEBTV; |
|
| 184 | + if(stristr($this->user_agent, self::$MATCH_WEBTV)) {
|
|
| 185 | + return self::$NAME_WEBTV; |
|
| 186 | + } |
|
| 179 | 187 | |
| 180 | - if(stristr($this->user_agent, self::$MATCH_WII)) |
|
| 181 | - return self::$NAME_WII; |
|
| 188 | + if(stristr($this->user_agent, self::$MATCH_WII)) {
|
|
| 189 | + return self::$NAME_WII; |
|
| 190 | + } |
|
| 182 | 191 | |
| 183 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_3)) |
|
| 184 | - return self::$NAME_WINDOWS_3; |
|
| 192 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_3)) {
|
|
| 193 | + return self::$NAME_WINDOWS_3; |
|
| 194 | + } |
|
| 185 | 195 | |
| 186 | 196 | foreach(self::$MATCH_WINDOWS_4 as $match) |
| 187 | 197 | { |
| 188 | - if(stristr($this->user_agent, $match)) |
|
| 189 | - return self::$NAME_WINDOWS_4; |
|
| 198 | + if(stristr($this->user_agent, $match)) {
|
|
| 199 | + return self::$NAME_WINDOWS_4; |
|
| 200 | + } |
|
| 190 | 201 | } |
| 191 | 202 | |
| 192 | 203 | foreach(self::$MATCH_WINDOWS_95 as $match) |
| 193 | 204 | { |
| 194 | - if(stristr($this->user_agent, $match)) |
|
| 195 | - return self::$NAME_WINDOWS_95; |
|
| 205 | + if(stristr($this->user_agent, $match)) {
|
|
| 206 | + return self::$NAME_WINDOWS_95; |
|
| 207 | + } |
|
| 196 | 208 | } |
| 197 | 209 | |
| 198 | 210 | foreach(self::$MATCH_WINDOWS_98 as $match) |
| 199 | 211 | { |
| 200 | - if(stristr($this->user_agent, $match)) |
|
| 201 | - return self::$NAME_WINDOWS_98; |
|
| 212 | + if(stristr($this->user_agent, $match)) {
|
|
| 213 | + return self::$NAME_WINDOWS_98; |
|
| 214 | + } |
|
| 202 | 215 | } |
| 203 | 216 | |
| 204 | 217 | foreach(self::$MATCH_WINDOWS_2000 as $match) |
| 205 | 218 | { |
| 206 | - if(stristr($this->user_agent, $match)) |
|
| 207 | - return self::$NAME_WINDOWS_2000; |
|
| 219 | + if(stristr($this->user_agent, $match)) {
|
|
| 220 | + return self::$NAME_WINDOWS_2000; |
|
| 221 | + } |
|
| 208 | 222 | } |
| 209 | 223 | |
| 210 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_ME)) |
|
| 211 | - return self::$NAME_WINDOWS_ME; |
|
| 224 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_ME)) {
|
|
| 225 | + return self::$NAME_WINDOWS_ME; |
|
| 226 | + } |
|
| 212 | 227 | |
| 213 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_S_03)) |
|
| 214 | - return self::$NAME_WINDOWS_S_03; |
|
| 228 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_S_03)) {
|
|
| 229 | + return self::$NAME_WINDOWS_S_03; |
|
| 230 | + } |
|
| 215 | 231 | |
| 216 | 232 | foreach(self::$MATCH_WINDOWS_XP as $match) |
| 217 | 233 | { |
| 218 | - if(stristr($this->user_agent, $match)) |
|
| 219 | - return self::$NAME_WINDOWS_XP; |
|
| 234 | + if(stristr($this->user_agent, $match)) {
|
|
| 235 | + return self::$NAME_WINDOWS_XP; |
|
| 236 | + } |
|
| 220 | 237 | } |
| 221 | 238 | |
| 222 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_VISTA)) |
|
| 223 | - return self::$NAME_WINDOWS_VISTA; |
|
| 239 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_VISTA)) {
|
|
| 240 | + return self::$NAME_WINDOWS_VISTA; |
|
| 241 | + } |
|
| 224 | 242 | |
| 225 | 243 | foreach(self::$MATCH_WINDOWS_7 as $match) |
| 226 | 244 | { |
| 227 | - if(stristr($this->user_agent, $match)) |
|
| 228 | - return self::$NAME_WINDOWS_7; |
|
| 245 | + if(stristr($this->user_agent, $match)) {
|
|
| 246 | + return self::$NAME_WINDOWS_7; |
|
| 247 | + } |
|
| 229 | 248 | } |
| 230 | 249 | |
| 231 | - if(stristr($this->user_agent, self::$MATCH_OPENBSD)) |
|
| 232 | - return self::$NAME_OPENBSD; |
|
| 250 | + if(stristr($this->user_agent, self::$MATCH_OPENBSD)) {
|
|
| 251 | + return self::$NAME_OPENBSD; |
|
| 252 | + } |
|
| 233 | 253 | |
| 234 | - if(stristr($this->user_agent, self::$MATCH_FREEBSD)) |
|
| 235 | - return self::$NAME_FREEBSD; |
|
| 254 | + if(stristr($this->user_agent, self::$MATCH_FREEBSD)) {
|
|
| 255 | + return self::$NAME_FREEBSD; |
|
| 256 | + } |
|
| 236 | 257 | |
| 237 | - if(stristr($this->user_agent, self::$MATCH_SUNOS)) |
|
| 238 | - return self::$NAME_SUNOS; |
|
| 258 | + if(stristr($this->user_agent, self::$MATCH_SUNOS)) {
|
|
| 259 | + return self::$NAME_SUNOS; |
|
| 260 | + } |
|
| 239 | 261 | |
| 240 | 262 | foreach(self::$MATCH_LINUX as $match) |
| 241 | 263 | { |
| 242 | - if(stristr($this->user_agent, $match)) |
|
| 243 | - return self::$NAME_LINUX; |
|
| 264 | + if(stristr($this->user_agent, $match)) {
|
|
| 265 | + return self::$NAME_LINUX; |
|
| 266 | + } |
|
| 244 | 267 | } |
| 245 | 268 | |
| 246 | - if(stristr($this->user_agent, self::$MATCH_GOOGLEBOT)) |
|
| 247 | - return self::$NAME_GOOGLEBOT; |
|
| 269 | + if(stristr($this->user_agent, self::$MATCH_GOOGLEBOT)) {
|
|
| 270 | + return self::$NAME_GOOGLEBOT; |
|
| 271 | + } |
|
| 248 | 272 | |
| 249 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_READER)) |
|
| 250 | - return self::$NAME_GOOGLE_READER; |
|
| 273 | + if(stristr($this->user_agent, self::$MATCH_GOOGLE_READER)) {
|
|
| 274 | + return self::$NAME_GOOGLE_READER; |
|
| 275 | + } |
|
| 251 | 276 | |
| 252 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_VIEW)) |
|
| 253 | - return self::$NAME_GOOGLE_VIEW; |
|
| 277 | + if(stristr($this->user_agent, self::$MATCH_GOOGLE_VIEW)) {
|
|
| 278 | + return self::$NAME_GOOGLE_VIEW; |
|
| 279 | + } |
|
| 254 | 280 | |
| 255 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_DESK)) |
|
| 256 | - return self::$NAME_GOOGLE_DESKTOP; |
|
| 281 | + if(stristr($this->user_agent, self::$MATCH_GOOGLE_DESK)) {
|
|
| 282 | + return self::$NAME_GOOGLE_DESKTOP; |
|
| 283 | + } |
|
| 257 | 284 | |
| 258 | 285 | foreach(self::$MATCH_BING as $match) |
| 259 | 286 | { |
| 260 | - if(stristr($this->user_agent, $match)) |
|
| 261 | - return self::$NAME_BING; |
|
| 287 | + if(stristr($this->user_agent, $match)) {
|
|
| 288 | + return self::$NAME_BING; |
|
| 289 | + } |
|
| 262 | 290 | } |
| 263 | 291 | |
| 264 | - if(stristr($this->user_agent, self::$MATCH_ASK)) |
|
| 265 | - return self::$NAME_ASK; |
|
| 292 | + if(stristr($this->user_agent, self::$MATCH_ASK)) {
|
|
| 293 | + return self::$NAME_ASK; |
|
| 294 | + } |
|
| 266 | 295 | |
| 267 | - if(stristr($this->user_agent, self::$MATCH_EXABOT)) |
|
| 268 | - return self::$NAME_EXABOT; |
|
| 296 | + if(stristr($this->user_agent, self::$MATCH_EXABOT)) {
|
|
| 297 | + return self::$NAME_EXABOT; |
|
| 298 | + } |
|
| 269 | 299 | |
| 270 | - if(stristr($this->user_agent, self::$MATCH_GEOHASH)) |
|
| 271 | - return self::$NAME_GEOHASH; |
|
| 300 | + if(stristr($this->user_agent, self::$MATCH_GEOHASH)) {
|
|
| 301 | + return self::$NAME_GEOHASH; |
|
| 302 | + } |
|
| 272 | 303 | |
| 273 | - if(stristr($this->user_agent, self::$MATCH_POST_RANK)) |
|
| 274 | - return self::$NAME_POST_RANK; |
|
| 304 | + if(stristr($this->user_agent, self::$MATCH_POST_RANK)) {
|
|
| 305 | + return self::$NAME_POST_RANK; |
|
| 306 | + } |
|
| 275 | 307 | |
| 276 | - if(stristr($this->user_agent, self::$MATCH_BAIDU_SPIDER)) |
|
| 277 | - return self::$NAME_BAIDU_SPIDER; |
|
| 308 | + if(stristr($this->user_agent, self::$MATCH_BAIDU_SPIDER)) {
|
|
| 309 | + return self::$NAME_BAIDU_SPIDER; |
|
| 310 | + } |
|
| 278 | 311 | |
| 279 | - if(stristr($this->user_agent, self::$MATCH_RADIAN)) |
|
| 280 | - return self::$NAME_RADIAN; |
|
| 312 | + if(stristr($this->user_agent, self::$MATCH_RADIAN)) {
|
|
| 313 | + return self::$NAME_RADIAN; |
|
| 314 | + } |
|
| 281 | 315 | |
| 282 | - if(stristr($this->user_agent, self::$MATCH_BLEKKO_SPIDER)) |
|
| 283 | - return self::$NAME_BLEKKO_SPIDER; |
|
| 316 | + if(stristr($this->user_agent, self::$MATCH_BLEKKO_SPIDER)) {
|
|
| 317 | + return self::$NAME_BLEKKO_SPIDER; |
|
| 318 | + } |
|
| 284 | 319 | |
| 285 | - if(stristr($this->user_agent, self::$MATCH_WLA)) |
|
| 286 | - return self::$NAME_WLA; |
|
| 320 | + if(stristr($this->user_agent, self::$MATCH_WLA)) {
|
|
| 321 | + return self::$NAME_WLA; |
|
| 322 | + } |
|
| 287 | 323 | |
| 288 | - if(stristr($this->user_agent, self::$MATCH_FACEBOOK)) |
|
| 289 | - return self::$NAME_FACEBOOK; |
|
| 324 | + if(stristr($this->user_agent, self::$MATCH_FACEBOOK)) {
|
|
| 325 | + return self::$NAME_FACEBOOK; |
|
| 326 | + } |
|
| 290 | 327 | |
| 291 | - if(stristr($this->user_agent, self::$MATCH_BLOGLINES)) |
|
| 292 | - return self::$NAME_BLOGLINES; |
|
| 328 | + if(stristr($this->user_agent, self::$MATCH_BLOGLINES)) {
|
|
| 329 | + return self::$NAME_BLOGLINES; |
|
| 330 | + } |
|
| 293 | 331 | |
| 294 | - if(stristr($this->user_agent, self::$MATCH_R6)) |
|
| 295 | - return self::$NAME_R6; |
|
| 332 | + if(stristr($this->user_agent, self::$MATCH_R6)) {
|
|
| 333 | + return self::$NAME_R6; |
|
| 334 | + } |
|
| 296 | 335 | |
| 297 | - if(stristr($this->user_agent, self::$MATCH_AOL_FAVICON)) |
|
| 298 | - return self::$NAME_AOL_FAVICON; |
|
| 336 | + if(stristr($this->user_agent, self::$MATCH_AOL_FAVICON)) {
|
|
| 337 | + return self::$NAME_AOL_FAVICON; |
|
| 338 | + } |
|
| 299 | 339 | |
| 300 | - if(stristr($this->user_agent, self::$MATCH_YAHOO)) |
|
| 301 | - return self::$NAME_YAHOO; |
|
| 340 | + if(stristr($this->user_agent, self::$MATCH_YAHOO)) {
|
|
| 341 | + return self::$NAME_YAHOO; |
|
| 342 | + } |
|
| 302 | 343 | |
| 303 | - if(stristr($this->user_agent, self::$MATCH_YAHOO_FEED)) |
|
| 304 | - return self::$NAME_YAHOO_FEED; |
|
| 344 | + if(stristr($this->user_agent, self::$MATCH_YAHOO_FEED)) {
|
|
| 345 | + return self::$NAME_YAHOO_FEED; |
|
| 346 | + } |
|
| 305 | 347 | |
| 306 | - if(stristr($this->user_agent, self::$MATCH_YANDEX)) |
|
| 307 | - return self::$NAME_YANDEX; |
|
| 348 | + if(stristr($this->user_agent, self::$MATCH_YANDEX)) {
|
|
| 349 | + return self::$NAME_YANDEX; |
|
| 350 | + } |
|
| 308 | 351 | |
| 309 | - if(stristr($this->user_agent, self::$MATCH_HUAWEI)) |
|
| 310 | - return self::$NAME_HUAWEI; |
|
| 352 | + if(stristr($this->user_agent, self::$MATCH_HUAWEI)) {
|
|
| 353 | + return self::$NAME_HUAWEI; |
|
| 354 | + } |
|
| 311 | 355 | |
| 312 | - if(stristr($this->user_agent, self::$MATCH_SOGOU)) |
|
| 313 | - return self::$NAME_SOGOU; |
|
| 356 | + if(stristr($this->user_agent, self::$MATCH_SOGOU)) {
|
|
| 357 | + return self::$NAME_SOGOU; |
|
| 358 | + } |
|
| 314 | 359 | |
| 315 | - if(stristr($this->user_agent, self::$MATCH_MLBOT)) |
|
| 316 | - return self::$NAME_MLBOT; |
|
| 360 | + if(stristr($this->user_agent, self::$MATCH_MLBOT)) {
|
|
| 361 | + return self::$NAME_MLBOT; |
|
| 362 | + } |
|
| 317 | 363 | |
| 318 | - if(stristr($this->user_agent, self::$MATCH_NETCRAFT)) |
|
| 319 | - return self::$NAME_NETCRAFT; |
|
| 364 | + if(stristr($this->user_agent, self::$MATCH_NETCRAFT)) {
|
|
| 365 | + return self::$NAME_NETCRAFT; |
|
| 366 | + } |
|
| 320 | 367 | |
| 321 | - if(stristr($this->user_agent, self::$MATCH_TURNITIN)) |
|
| 322 | - return self::$NAME_TURNITIN; |
|
| 368 | + if(stristr($this->user_agent, self::$MATCH_TURNITIN)) {
|
|
| 369 | + return self::$NAME_TURNITIN; |
|
| 370 | + } |
|
| 323 | 371 | |
| 324 | - if(stristr($this->user_agent, self::$MATCH_LINKEDINBOT)) |
|
| 325 | - return self::$NAME_LINKEDINBOT; |
|
| 372 | + if(stristr($this->user_agent, self::$MATCH_LINKEDINBOT)) {
|
|
| 373 | + return self::$NAME_LINKEDINBOT; |
|
| 374 | + } |
|
| 326 | 375 | |
| 327 | - if(stristr($this->user_agent, self::$MATCH_ABOUT_US)) |
|
| 328 | - return self::$NAME_ABOUT_US; |
|
| 376 | + if(stristr($this->user_agent, self::$MATCH_ABOUT_US)) {
|
|
| 377 | + return self::$NAME_ABOUT_US; |
|
| 378 | + } |
|
| 329 | 379 | |
| 330 | - if(stristr($this->user_agent, self::$MATCH_COSMIX)) |
|
| 331 | - return self::$NAME_COSMIX; |
|
| 380 | + if(stristr($this->user_agent, self::$MATCH_COSMIX)) {
|
|
| 381 | + return self::$NAME_COSMIX; |
|
| 382 | + } |
|
| 332 | 383 | |
| 333 | - if(stristr($this->user_agent, self::$MATCH_PYCURL)) |
|
| 334 | - return self::$NAME_PYCURL; |
|
| 384 | + if(stristr($this->user_agent, self::$MATCH_PYCURL)) {
|
|
| 385 | + return self::$NAME_PYCURL; |
|
| 386 | + } |
|
| 335 | 387 | |
| 336 | - if(stristr($this->user_agent, self::$MATCH_MAJESTIC)) |
|
| 337 | - return self::$NAME_MAJESTIC; |
|
| 388 | + if(stristr($this->user_agent, self::$MATCH_MAJESTIC)) {
|
|
| 389 | + return self::$NAME_MAJESTIC; |
|
| 390 | + } |
|
| 338 | 391 | |
| 339 | - if(stristr($this->user_agent, self::$MATCH_GIGABOT)) |
|
| 340 | - return self::$NAME_GIGABOT; |
|
| 392 | + if(stristr($this->user_agent, self::$MATCH_GIGABOT)) {
|
|
| 393 | + return self::$NAME_GIGABOT; |
|
| 394 | + } |
|
| 341 | 395 | |
| 342 | - if(stristr($this->user_agent, self::$MATCH_ZOOKA)) |
|
| 343 | - return self::$NAME_ZOOKA; |
|
| 396 | + if(stristr($this->user_agent, self::$MATCH_ZOOKA)) {
|
|
| 397 | + return self::$NAME_ZOOKA; |
|
| 398 | + } |
|
| 344 | 399 | |
| 345 | - if(stristr($this->user_agent, self::$MATCH_PANSCIENT)) |
|
| 346 | - return self::$NAME_PANSCIENT; |
|
| 400 | + if(stristr($this->user_agent, self::$MATCH_PANSCIENT)) {
|
|
| 401 | + return self::$NAME_PANSCIENT; |
|
| 402 | + } |
|
| 347 | 403 | |
| 348 | - if(stristr($this->user_agent, self::$MATCH_LIBWWW)) |
|
| 349 | - return self::$NAME_LIBWWW; |
|
| 404 | + if(stristr($this->user_agent, self::$MATCH_LIBWWW)) {
|
|
| 405 | + return self::$NAME_LIBWWW; |
|
| 406 | + } |
|
| 350 | 407 | |
| 351 | - if(stristr($this->user_agent, self::$MATCH_DOTBOT)) |
|
| 352 | - return self::$NAME_DOTBOT; |
|
| 408 | + if(stristr($this->user_agent, self::$MATCH_DOTBOT)) {
|
|
| 409 | + return self::$NAME_DOTBOT; |
|
| 410 | + } |
|
| 353 | 411 | |
| 354 | - if(stristr($this->user_agent, self::$MATCH_ARCHIVER)) |
|
| 355 | - return self::$NAME_ARCHIVER; |
|
| 412 | + if(stristr($this->user_agent, self::$MATCH_ARCHIVER)) {
|
|
| 413 | + return self::$NAME_ARCHIVER; |
|
| 414 | + } |
|
| 356 | 415 | |
| 357 | - if(stristr($this->user_agent, self::$MATCH_ZEND)) |
|
| 358 | - return self::$NAME_ZEND; |
|
| 416 | + if(stristr($this->user_agent, self::$MATCH_ZEND)) {
|
|
| 417 | + return self::$NAME_ZEND; |
|
| 418 | + } |
|
| 359 | 419 | |
| 360 | - if(stristr($this->user_agent, self::$MATCH_PYTHON)) |
|
| 361 | - return self::$NAME_PYTHON; |
|
| 420 | + if(stristr($this->user_agent, self::$MATCH_PYTHON)) {
|
|
| 421 | + return self::$NAME_PYTHON; |
|
| 422 | + } |
|
| 362 | 423 | |
| 363 | - if(stristr($this->user_agent, self::$MATCH_JAKARATA)) |
|
| 364 | - return self::$NAME_JAKARATA; |
|
| 424 | + if(stristr($this->user_agent, self::$MATCH_JAKARATA)) {
|
|
| 425 | + return self::$NAME_JAKARATA; |
|
| 426 | + } |
|
| 365 | 427 | |
| 366 | 428 | return self::$NAME_UNKNOWN; |
| 367 | 429 | } |
@@ -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; |