@@ -5,56 +5,56 @@ |
||
5 | 5 | final class ImperialUnitContent extends Content |
6 | 6 | { |
7 | 7 | |
8 | - protected function execute($type = '') |
|
9 | - { |
|
10 | - $number = floatval($this->content); |
|
11 | - $number *= 39.37; // convert to inches |
|
8 | + protected function execute($type = '') |
|
9 | + { |
|
10 | + $number = floatval($this->content); |
|
11 | + $number *= 39.37; // convert to inches |
|
12 | 12 | |
13 | - if ($type == '') { |
|
14 | - if ($number > (12 * 3 * 1760 * 5)) { |
|
15 | - $type = 'full miles'; |
|
16 | - } else if ($number > (12 * 3 * 1760 * .5)) { |
|
17 | - $type = 'tenth miles'; |
|
18 | - } else if ($number > (12 * 3 * 150)) { |
|
19 | - $type = 'yards'; |
|
20 | - } else if ($number > (12 * 10)) { |
|
21 | - $type = 'feet'; |
|
22 | - } else { |
|
23 | - $type = 'inches'; |
|
24 | - } |
|
25 | - } |
|
13 | + if ($type == '') { |
|
14 | + if ($number > (12 * 3 * 1760 * 5)) { |
|
15 | + $type = 'full miles'; |
|
16 | + } else if ($number > (12 * 3 * 1760 * .5)) { |
|
17 | + $type = 'tenth miles'; |
|
18 | + } else if ($number > (12 * 3 * 150)) { |
|
19 | + $type = 'yards'; |
|
20 | + } else if ($number > (12 * 10)) { |
|
21 | + $type = 'feet'; |
|
22 | + } else { |
|
23 | + $type = 'inches'; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | |
27 | - switch ($type) { |
|
28 | - case 'full miles' : |
|
29 | - $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles'; |
|
30 | - break; |
|
31 | - case 'tenth miles' : |
|
32 | - $this->content = round($number / (12 * 3 * 1760), 1) . ' miles'; |
|
33 | - break; |
|
34 | - case 'yards' : |
|
35 | - $this->content = number_format(round($number / (12 * 3))) . ' yards'; |
|
36 | - break; |
|
37 | - case 'feet' : |
|
38 | - $this->content = number_format(round($number / 12)) . "'"; |
|
39 | - break; |
|
40 | - case 'inches' : |
|
41 | - $feet = floor($number / 12); |
|
27 | + switch ($type) { |
|
28 | + case 'full miles' : |
|
29 | + $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles'; |
|
30 | + break; |
|
31 | + case 'tenth miles' : |
|
32 | + $this->content = round($number / (12 * 3 * 1760), 1) . ' miles'; |
|
33 | + break; |
|
34 | + case 'yards' : |
|
35 | + $this->content = number_format(round($number / (12 * 3))) . ' yards'; |
|
36 | + break; |
|
37 | + case 'feet' : |
|
38 | + $this->content = number_format(round($number / 12)) . "'"; |
|
39 | + break; |
|
40 | + case 'inches' : |
|
41 | + $feet = floor($number / 12); |
|
42 | 42 | |
43 | - $inches = $number - $feet * 12; |
|
44 | - $inches = round($inches); |
|
43 | + $inches = $number - $feet * 12; |
|
44 | + $inches = round($inches); |
|
45 | 45 | |
46 | - if ($inches == 12) { |
|
47 | - $feet++; |
|
48 | - $inches = 0; |
|
49 | - } |
|
46 | + if ($inches == 12) { |
|
47 | + $feet++; |
|
48 | + $inches = 0; |
|
49 | + } |
|
50 | 50 | |
51 | - $this->content = ''; |
|
52 | - $this->content .= number_format($feet) . "'"; |
|
53 | - if (isset($inches) && $inches > 0) { |
|
54 | - $this->content .= " {$inches}\""; |
|
55 | - } |
|
56 | - break; |
|
57 | - } |
|
58 | - } |
|
51 | + $this->content = ''; |
|
52 | + $this->content .= number_format($feet) . "'"; |
|
53 | + if (isset($inches) && $inches > 0) { |
|
54 | + $this->content .= " {$inches}\""; |
|
55 | + } |
|
56 | + break; |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -22,10 +22,10 @@ |
||
22 | 22 | |
23 | 23 | protected function getDomain() |
24 | 24 | { |
25 | - $site = URLDecode::getSite(); |
|
26 | - if ($site == 'waterfalls' && Loader::isLive()) { |
|
27 | - return 'waterfallsofthekeweenaw.com'; |
|
28 | - } |
|
25 | + $site = URLDecode::getSite(); |
|
26 | + if ($site == 'waterfalls' && Loader::isLive()) { |
|
27 | + return 'waterfallsofthekeweenaw.com'; |
|
28 | + } |
|
29 | 29 | return self::$COOKIE_DOMAIN; |
30 | 30 | } |
31 | 31 |
@@ -6,8 +6,8 @@ |
||
6 | 6 | { |
7 | 7 | |
8 | 8 | private static $COOKIE_NAME = 'commenter'; |
9 | - private static $COOKIE_DURATION = 31536000; // one year |
|
10 | - private static $COOKIE_DOMAIN = 'jacobemerick.com'; |
|
9 | + private static $COOKIE_DURATION = 31536000; // one year |
|
10 | + private static $COOKIE_DOMAIN = 'jacobemerick.com'; |
|
11 | 11 | private static $COOKIE_PATH = '/'; |
12 | 12 | |
13 | 13 | protected function getName() |
@@ -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); |
@@ -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); |
@@ -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 | } |
56 | + } else { |
|
57 | + $message = 'No errors found in the flat-files!'; |
|
53 | 58 | } |
54 | - else |
|
55 | - $message = 'No errors found in the flat-files!'; |
|
56 | 59 | |
57 | 60 | $mail = new Mail(); |
58 | 61 | $mail->setToAddress('EMAIL', 'Jacob Emerick'); |
@@ -20,28 +20,28 @@ discard block |
||
20 | 20 | |
21 | 21 | public function activate() |
22 | 22 | { |
23 | - if(!$this->xml) |
|
23 | + if (!$this->xml) |
|
24 | 24 | return $this->error('Could not connect to feed.'); |
25 | 25 | |
26 | 26 | $count = 0; |
27 | - foreach($this->xml->channel->item as $item) |
|
27 | + foreach ($this->xml->channel->item as $item) |
|
28 | 28 | { |
29 | 29 | $date = date('Y-m-d H:i:s', strtotime($item->pubDate)); |
30 | 30 | |
31 | - if(preg_match_all('/((rated)|(wrote a review about)|(subscribed to)|(watched) )(.+)/', $item->title, $title_array) > 0) |
|
31 | + if (preg_match_all('/((rated)|(wrote a review about)|(subscribed to)|(watched) )(.+)/', $item->title, $title_array) > 0) |
|
32 | 32 | { |
33 | 33 | $video = array_pop($title_array); |
34 | 34 | $video = current($video); |
35 | 35 | $video = substr($video, 0, -1); |
36 | 36 | } |
37 | - else if(preg_match_all('/(.*) - (s\d+) | (e\d+) - (.*)/', $item->title, $title_array) > 0) |
|
37 | + else if (preg_match_all('/(.*) - (s\d+) | (e\d+) - (.*)/', $item->title, $title_array) > 0) |
|
38 | 38 | $video = "{$title_array[1][0]}: {$title_array[4][1]}"; |
39 | 39 | else |
40 | 40 | $video = $item->title; |
41 | 41 | |
42 | 42 | $url = $item->link; |
43 | 43 | |
44 | - if($item->category == 'Vote') |
|
44 | + if ($item->category == 'Vote') |
|
45 | 45 | { |
46 | 46 | $description = stristr($video, 'and gave it'); |
47 | 47 | $description = substr($description, 12); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | else |
54 | 54 | $description = ''; |
55 | 55 | |
56 | - switch($item->category) |
|
56 | + switch ($item->category) |
|
57 | 57 | { |
58 | 58 | case 'ActivityViewedVideo' : |
59 | 59 | $action = 1; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | $hulu_result = HuluCollector::getHuluByFields($video, $action); |
76 | - if($hulu_result !== null) |
|
76 | + if ($hulu_result !== null) |
|
77 | 77 | continue; |
78 | 78 | |
79 | 79 | $display = ( |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | public function activate() |
22 | 22 | { |
23 | - if(!$this->xml) |
|
24 | - return $this->error('Could not connect to feed.'); |
|
23 | + if(!$this->xml) { |
|
24 | + return $this->error('Could not connect to feed.'); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | $count = 0; |
27 | 28 | foreach($this->xml->channel->item as $item) |
@@ -33,11 +34,11 @@ discard block |
||
33 | 34 | $video = array_pop($title_array); |
34 | 35 | $video = current($video); |
35 | 36 | $video = substr($video, 0, -1); |
37 | + } else if(preg_match_all('/(.*) - (s\d+) | (e\d+) - (.*)/', $item->title, $title_array) > 0) { |
|
38 | + $video = "{$title_array[1][0]}: {$title_array[4][1]}"; |
|
39 | + } else { |
|
40 | + $video = $item->title; |
|
36 | 41 | } |
37 | - else if(preg_match_all('/(.*) - (s\d+) | (e\d+) - (.*)/', $item->title, $title_array) > 0) |
|
38 | - $video = "{$title_array[1][0]}: {$title_array[4][1]}"; |
|
39 | - else |
|
40 | - $video = $item->title; |
|
41 | 42 | |
42 | 43 | $url = $item->link; |
43 | 44 | |
@@ -49,9 +50,9 @@ discard block |
||
49 | 50 | $description = substr($description, 0, 1); |
50 | 51 | $text = substr($video, 0, strpos($video, 'and gave it') - 1); |
51 | 52 | $video = trim($video); |
53 | + } else { |
|
54 | + $description = ''; |
|
52 | 55 | } |
53 | - else |
|
54 | - $description = ''; |
|
55 | 56 | |
56 | 57 | switch($item->category) |
57 | 58 | { |
@@ -73,8 +74,9 @@ discard block |
||
73 | 74 | } |
74 | 75 | |
75 | 76 | $hulu_result = HuluCollector::getHuluByFields($video, $action); |
76 | - if($hulu_result !== null) |
|
77 | - continue; |
|
77 | + if($hulu_result !== null) { |
|
78 | + continue; |
|
79 | + } |
|
78 | 80 | |
79 | 81 | $display = ( |
80 | 82 | Content::instance('Acceptable', $video)->check() === true && |
@@ -20,18 +20,18 @@ |
||
20 | 20 | |
21 | 21 | public function activate() |
22 | 22 | { |
23 | - if(!$this->xml) |
|
23 | + if (!$this->xml) |
|
24 | 24 | return $this->error('Could not connect to youtube xml feed.'); |
25 | 25 | |
26 | 26 | $count = 0; |
27 | - foreach($this->xml->entry as $entry) |
|
27 | + foreach ($this->xml->entry as $entry) |
|
28 | 28 | { |
29 | 29 | $video_id = $entry->id; |
30 | 30 | $video_id = explode('/', $video_id); |
31 | 31 | $video_id = array_pop($video_id); |
32 | 32 | |
33 | 33 | $video_exists = YouTubeCollector::checkForVideoByVideoID($video_id); |
34 | - if($video_exists) |
|
34 | + if ($video_exists) |
|
35 | 35 | continue; |
36 | 36 | |
37 | 37 | $title = Database::escape($entry->title); |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | public function activate() |
22 | 22 | { |
23 | - if(!$this->xml) |
|
24 | - return $this->error('Could not connect to youtube xml feed.'); |
|
23 | + if(!$this->xml) { |
|
24 | + return $this->error('Could not connect to youtube xml feed.'); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | $count = 0; |
27 | 28 | foreach($this->xml->entry as $entry) |
@@ -31,8 +32,9 @@ discard block |
||
31 | 32 | $video_id = array_pop($video_id); |
32 | 33 | |
33 | 34 | $video_exists = YouTubeCollector::checkForVideoByVideoID($video_id); |
34 | - if($video_exists) |
|
35 | - continue; |
|
35 | + if($video_exists) { |
|
36 | + continue; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | $title = Database::escape($entry->title); |
38 | 40 | $content = Database::escape($entry->content); |
@@ -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 | } |