@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | private function remove_existing($result, $type) |
| 63 | 63 | {
|
| 64 | - foreach($result as $key => $row) |
|
| 64 | + foreach ($result as $key => $row) |
|
| 65 | 65 | {
|
| 66 | 66 | $stream_result = ActivityCollector::getPostByFields($row->id, $type); |
| 67 | - if($stream_result) |
|
| 67 | + if ($stream_result) |
|
| 68 | 68 | unset($result[$key]); |
| 69 | 69 | } |
| 70 | 70 | return $result; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | private function add_posts($result, $type) |
| 74 | 74 | {
|
| 75 | - foreach($result as $row) |
|
| 75 | + foreach ($result as $row) |
|
| 76 | 76 | {
|
| 77 | 77 | $query = sprintf(self::$QUERY, $type, $row->id, $row->date); |
| 78 | 78 | Database::execute($query); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | private $oauth_array; |
| 84 | 84 | private function get_oauth_array() |
| 85 | 85 | {
|
| 86 | - if(!isset($this->oauth_array)) |
|
| 86 | + if (!isset($this->oauth_array)) |
|
| 87 | 87 | {
|
| 88 | 88 | $this->oauth_array = array( |
| 89 | 89 | 'screen_name' => self::$SCREEN_NAME, |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | {
|
| 117 | 117 | $encoded_array = array(); |
| 118 | 118 | ksort($array); |
| 119 | - foreach($array as $key => $value) |
|
| 119 | + foreach ($array as $key => $value) |
|
| 120 | 120 | {
|
| 121 | 121 | $value = rawurlencode($value); |
| 122 | 122 | $value = ($wrap_values) ? '"' . $value . '"' : $value; |
@@ -127,27 +127,27 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function activate() |
| 129 | 129 | {
|
| 130 | - if(!$this->json) |
|
| 130 | + if (!$this->json) |
|
| 131 | 131 | return $this->error('Could not connect to twitter json feed.');
|
| 132 | 132 | |
| 133 | 133 | $count = 0; |
| 134 | - foreach($this->json as $status) |
|
| 134 | + foreach ($this->json as $status) |
|
| 135 | 135 | {
|
| 136 | 136 | $text = Database::escape($status->text); |
| 137 | 137 | $date = date('Y-m-d H:i:s', strtotime($status->created_at));
|
| 138 | 138 | |
| 139 | 139 | $tweet_result = TwitterCollector::getTweetByFields($date, $text); |
| 140 | - if($tweet_result !== null) |
|
| 140 | + if ($tweet_result !== null) |
|
| 141 | 141 | {
|
| 142 | 142 | $favorites = (int) $status->favorite_count; |
| 143 | - if($favorites != 0 && $tweet_result->favorites != $favorites) |
|
| 143 | + if ($favorites != 0 && $tweet_result->favorites != $favorites) |
|
| 144 | 144 | {
|
| 145 | 145 | $query = sprintf(self::$UPDATE_FAVORITES_QUERY, $favorites, $tweet_result->id); |
| 146 | 146 | Database::execute($query); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $retweets = (int) $status->retweet_count; |
| 150 | - if($retweets != 0 && $tweet_result->retweets != $retweets) |
|
| 150 | + if ($retweets != 0 && $tweet_result->retweets != $retweets) |
|
| 151 | 151 | {
|
| 152 | 152 | $query = sprintf(self::$UPDATE_RETWEETS_QUERY, $retweets, $tweet_result->id); |
| 153 | 153 | Database::execute($query); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | {
|
| 158 | 158 | $twitter_id = (string) $status->id_str; |
| 159 | 159 | |
| 160 | - if(isset($status->retweeted_status)) |
|
| 160 | + if (isset($status->retweeted_status)) |
|
| 161 | 161 | {
|
| 162 | 162 | $text_formatted = $this->get_formatted($status->retweeted_status->text, $status->retweeted_status->entities); |
| 163 | 163 | $text_formatted_full = $this->get_formatted($status->retweeted_status->text, $status->retweeted_status->entities, 'full'); |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | private function get_source($source) |
| 202 | 202 | {
|
| 203 | - if(stristr($source, 'tweetdeck')) |
|
| 203 | + if (stristr($source, 'tweetdeck')) |
|
| 204 | 204 | return 'tweetdeck'; |
| 205 | - if(stristr($source, 'windows phone')) |
|
| 205 | + if (stristr($source, 'windows phone')) |
|
| 206 | 206 | return 'phone'; |
| 207 | 207 | else |
| 208 | 208 | return ''; |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | private function get_formatted($text, $entities, $type = 'short') |
| 212 | 212 | {
|
| 213 | 213 | $holder = array(); |
| 214 | - foreach($entities as $entity_type => $entity_collection) |
|
| 214 | + foreach ($entities as $entity_type => $entity_collection) |
|
| 215 | 215 | {
|
| 216 | - foreach($entity_collection as $entity) |
|
| 216 | + foreach ($entity_collection as $entity) |
|
| 217 | 217 | {
|
| 218 | 218 | $start = $entity->indices[0]; |
| 219 | 219 | $end = $entity->indices[1]; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | krsort($holder); |
| 230 | 230 | |
| 231 | - foreach($holder as $entity) |
|
| 231 | + foreach ($holder as $entity) |
|
| 232 | 232 | {
|
| 233 | 233 | $text = mb_substr($text, 0, $entity->start, 'UTF-8') . $entity->replace . mb_substr($text, $entity->end, 5000, 'UTF-8'); |
| 234 | 234 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | private function get_replace_text($entity_type, $entity, $type) |
| 243 | 243 | {
|
| 244 | - switch($entity_type) |
|
| 244 | + switch ($entity_type) |
|
| 245 | 245 | {
|
| 246 | 246 | case 'hashtags' : |
| 247 | 247 | $replace = sprintf(self::$HASHTAG_LINK, $entity->text); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $replace = sprintf(self::$USER_MENTION_LINK, $entity->screen_name, $entity->name); |
| 254 | 254 | break; |
| 255 | 255 | case 'media' : |
| 256 | - if($type == 'full') |
|
| 256 | + if ($type == 'full') |
|
| 257 | 257 | $replace = sprintf(self::$MEDIA_LINK, $entity->url, $entity->display_url, $entity->media_url, 'large', 'Photo from Twitter', $entity->sizes->large->h, $entity->sizes->large->w); |
| 258 | 258 | else |
| 259 | 259 | $replace = sprintf(self::$URL_LINK, $entity->url, $entity->expanded_url, $entity->display_url); |
@@ -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); |
@@ -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 | } |
@@ -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; |
@@ -568,42 +568,42 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | echo '<div id="pqp-console" class="pqp-box">'; |
| 570 | 570 | |
| 571 | -if($logCount == 0) {
|
|
| 571 | +if ($logCount == 0) {
|
|
| 572 | 572 | echo '<h3>This panel has no log items.</h3>'; |
| 573 | 573 | } |
| 574 | 574 | else {
|
| 575 | 575 | echo '<table class="side" cellspacing="0"> |
| 576 | 576 | <tr> |
| 577 | - <td class="alt1"><var>'.$output['logs']['log_count'].'</var><h4>Logs</h4></td> |
|
| 578 | - <td class="alt2"><var>'.$output['logs']['error_count'].'</var> <h4>Errors</h4></td> |
|
| 577 | + <td class="alt1"><var>'.$output['logs']['log_count'] . '</var><h4>Logs</h4></td> |
|
| 578 | + <td class="alt2"><var>'.$output['logs']['error_count'] . '</var> <h4>Errors</h4></td> |
|
| 579 | 579 | </tr> |
| 580 | 580 | <tr> |
| 581 | - <td class="alt3"><var>'.$output['logs']['memory_count'].'</var> <h4>Memory</h4></td> |
|
| 582 | - <td class="alt4"><var>'.$output['logs']['speed_count'].'</var> <h4>Speed</h4></td> |
|
| 581 | + <td class="alt3"><var>'.$output['logs']['memory_count'] . '</var> <h4>Memory</h4></td> |
|
| 582 | + <td class="alt4"><var>'.$output['logs']['speed_count'] . '</var> <h4>Speed</h4></td> |
|
| 583 | 583 | </tr> |
| 584 | 584 | </table> |
| 585 | 585 | <table class="main" cellspacing="0">'; |
| 586 | 586 | |
| 587 | 587 | $class = ''; |
| 588 | - foreach($output['logs']['debugger_log'] as $log) {
|
|
| 589 | - echo '<tr class="log-'.$log['type'].'"> |
|
| 590 | - <td class="type">'.$log['type'].'</td> |
|
| 591 | - <td class="'.$class.'">'; |
|
| 592 | - if($log['type'] == 'log') {
|
|
| 593 | - echo '<div><pre>'.$log['data'].'</pre></div>'; |
|
| 588 | + foreach ($output['logs']['debugger_log'] as $log) {
|
|
| 589 | + echo '<tr class="log-' . $log['type'] . '"> |
|
| 590 | + <td class="type">'.$log['type'] . '</td> |
|
| 591 | + <td class="'.$class . '">'; |
|
| 592 | + if ($log['type'] == 'log') {
|
|
| 593 | + echo '<div><pre>' . $log['data'] . '</pre></div>'; |
|
| 594 | 594 | } |
| 595 | - elseif($log['type'] == 'memory') {
|
|
| 596 | - echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['dataType'].'</em>: '.$log['name'].' </div>'; |
|
| 595 | + elseif ($log['type'] == 'memory') {
|
|
| 596 | + echo '<div><pre>' . $log['data'] . '</pre> <em>' . $log['dataType'] . '</em>: ' . $log['name'] . ' </div>'; |
|
| 597 | 597 | } |
| 598 | - elseif($log['type'] == 'speed') {
|
|
| 599 | - echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
|
| 598 | + elseif ($log['type'] == 'speed') {
|
|
| 599 | + echo '<div><pre>' . $log['data'] . '</pre> <em>' . $log['name'] . '</em></div>'; |
|
| 600 | 600 | } |
| 601 | - elseif($log['type'] == 'error') {
|
|
| 602 | - echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>'; |
|
| 601 | + elseif ($log['type'] == 'error') {
|
|
| 602 | + echo '<div><em>Line ' . $log['line'] . '</em> : ' . $log['data'] . ' <pre>' . $log['file'] . '</pre></div>'; |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | echo '</td></tr>'; |
| 606 | - if($class == '') $class = 'alt'; |
|
| 606 | + if ($class == '') $class = 'alt'; |
|
| 607 | 607 | else $class = ''; |
| 608 | 608 | } |
| 609 | 609 | |
@@ -614,24 +614,24 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | echo '<div id="pqp-speed" class="pqp-box">'; |
| 616 | 616 | |
| 617 | -if($output['logs']['speedCount'] == 0) {
|
|
| 617 | +if ($output['logs']['speedCount'] == 0) {
|
|
| 618 | 618 | echo '<h3>This panel has no log items.</h3>'; |
| 619 | 619 | } |
| 620 | 620 | else {
|
| 621 | 621 | echo '<table class="side" cellspacing="0"> |
| 622 | - <tr><td><var>'.$output['speedTotals']['total'].'</var><h4>Load Time</h4></td></tr> |
|
| 623 | - <tr><td class="alt"><var>'.$output['speedTotals']['allowed'].'</var> <h4>Max Execution Time</h4></td></tr> |
|
| 622 | + <tr><td><var>'.$output['speedTotals']['total'] . '</var><h4>Load Time</h4></td></tr> |
|
| 623 | + <tr><td class="alt"><var>'.$output['speedTotals']['allowed'] . '</var> <h4>Max Execution Time</h4></td></tr> |
|
| 624 | 624 | </table> |
| 625 | 625 | <table class="main" cellspacing="0">'; |
| 626 | 626 | |
| 627 | 627 | $class = ''; |
| 628 | - foreach($output['logs']['console'] as $log) {
|
|
| 629 | - if($log['type'] == 'speed') {
|
|
| 630 | - echo '<tr class="log-'.$log['type'].'"> |
|
| 631 | - <td class="'.$class.'">'; |
|
| 632 | - echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
|
| 628 | + foreach ($output['logs']['console'] as $log) {
|
|
| 629 | + if ($log['type'] == 'speed') {
|
|
| 630 | + echo '<tr class="log-' . $log['type'] . '"> |
|
| 631 | + <td class="'.$class . '">'; |
|
| 632 | + echo '<div><pre>' . $log['data'] . '</pre> <em>' . $log['name'] . '</em></div>'; |
|
| 633 | 633 | echo '</td></tr>'; |
| 634 | - if($class == '') $class = 'alt'; |
|
| 634 | + if ($class == '') $class = 'alt'; |
|
| 635 | 635 | else $class = ''; |
| 636 | 636 | } |
| 637 | 637 | } |
@@ -643,32 +643,32 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | echo '<div id="pqp-queries" class="pqp-box">'; |
| 645 | 645 | |
| 646 | -if($output['queryTotals']['count'] == 0) {
|
|
| 646 | +if ($output['queryTotals']['count'] == 0) {
|
|
| 647 | 647 | echo '<h3>This panel has no log items.</h3>'; |
| 648 | 648 | } |
| 649 | 649 | else {
|
| 650 | 650 | echo '<table class="side" cellspacing="0"> |
| 651 | - <tr><td><var>'.$output['queryTotals']['count'].'</var><h4>Total Queries</h4></td></tr> |
|
| 652 | - <tr><td class="alt"><var>'.$output['queryTotals']['time'].'</var> <h4>Total Time</h4></td></tr> |
|
| 651 | + <tr><td><var>'.$output['queryTotals']['count'] . '</var><h4>Total Queries</h4></td></tr> |
|
| 652 | + <tr><td class="alt"><var>'.$output['queryTotals']['time'] . '</var> <h4>Total Time</h4></td></tr> |
|
| 653 | 653 | <tr><td><var>0</var> <h4>Duplicates</h4></td></tr> |
| 654 | 654 | </table> |
| 655 | 655 | <table class="main" cellspacing="0">'; |
| 656 | 656 | |
| 657 | 657 | $class = ''; |
| 658 | - foreach($output['queries'] as $query) {
|
|
| 658 | + foreach ($output['queries'] as $query) {
|
|
| 659 | 659 | echo '<tr> |
| 660 | - <td class="'.$class.'">'.$query['sql']; |
|
| 661 | - if($query['explain']) {
|
|
| 660 | + <td class="'.$class . '">' . $query['sql']; |
|
| 661 | + if ($query['explain']) {
|
|
| 662 | 662 | echo '<em> |
| 663 | - Possible keys: <b>'.$query['explain']['possible_keys'].'</b> · |
|
| 664 | - Key Used: <b>'.$query['explain']['key'].'</b> · |
|
| 665 | - Type: <b>'.$query['explain']['type'].'</b> · |
|
| 666 | - Rows: <b>'.$query['explain']['rows'].'</b> · |
|
| 667 | - Speed: <b>'.$query['time'].'</b> |
|
| 663 | + Possible keys: <b>'.$query['explain']['possible_keys'] . '</b> · |
|
| 664 | + Key Used: <b>'.$query['explain']['key'] . '</b> · |
|
| 665 | + Type: <b>'.$query['explain']['type'] . '</b> · |
|
| 666 | + Rows: <b>'.$query['explain']['rows'] . '</b> · |
|
| 667 | + Speed: <b>'.$query['time'] . '</b> |
|
| 668 | 668 | </em>'; |
| 669 | 669 | } |
| 670 | 670 | echo '</td></tr>'; |
| 671 | - if($class == '') $class = 'alt'; |
|
| 671 | + if ($class == '') $class = 'alt'; |
|
| 672 | 672 | else $class = ''; |
| 673 | 673 | } |
| 674 | 674 | |
@@ -679,23 +679,23 @@ discard block |
||
| 679 | 679 | |
| 680 | 680 | echo '<div id="pqp-memory" class="pqp-box">'; |
| 681 | 681 | |
| 682 | -if($output['logs']['memoryCount'] == 0) {
|
|
| 682 | +if ($output['logs']['memoryCount'] == 0) {
|
|
| 683 | 683 | echo '<h3>This panel has no log items.</h3>'; |
| 684 | 684 | } |
| 685 | 685 | else {
|
| 686 | 686 | echo '<table class="side" cellspacing="0"> |
| 687 | - <tr><td><var>'.$output['memoryTotals']['used'].'</var><h4>Used Memory</h4></td></tr> |
|
| 688 | - <tr><td class="alt"><var>'.$output['memoryTotals']['total'].'</var> <h4>Total Available</h4></td></tr> |
|
| 687 | + <tr><td><var>'.$output['memoryTotals']['used'] . '</var><h4>Used Memory</h4></td></tr> |
|
| 688 | + <tr><td class="alt"><var>'.$output['memoryTotals']['total'] . '</var> <h4>Total Available</h4></td></tr> |
|
| 689 | 689 | </table> |
| 690 | 690 | <table class="main" cellspacing="0">'; |
| 691 | 691 | |
| 692 | 692 | $class = ''; |
| 693 | - foreach($output['logs']['console'] as $log) {
|
|
| 694 | - if($log['type'] == 'memory') {
|
|
| 695 | - echo '<tr class="log-'.$log['type'].'">'; |
|
| 696 | - echo '<td class="'.$class.'"><b>'.$log['data'].'</b> <em>'.$log['dataType'].'</em>: '.$log['name'].'</td>'; |
|
| 693 | + foreach ($output['logs']['console'] as $log) {
|
|
| 694 | + if ($log['type'] == 'memory') {
|
|
| 695 | + echo '<tr class="log-' . $log['type'] . '">'; |
|
| 696 | + echo '<td class="' . $class . '"><b>' . $log['data'] . '</b> <em>' . $log['dataType'] . '</em>: ' . $log['name'] . '</td>'; |
|
| 697 | 697 | echo '</tr>'; |
| 698 | - if($class == '') $class = 'alt'; |
|
| 698 | + if ($class == '') $class = 'alt'; |
|
| 699 | 699 | else $class = ''; |
| 700 | 700 | } |
| 701 | 701 | } |
@@ -707,21 +707,21 @@ discard block |
||
| 707 | 707 | |
| 708 | 708 | echo '<div id="pqp-files" class="pqp-box">'; |
| 709 | 709 | |
| 710 | -if($output['fileTotals']['count'] == 0) {
|
|
| 710 | +if ($output['fileTotals']['count'] == 0) {
|
|
| 711 | 711 | echo '<h3>This panel has no log items.</h3>'; |
| 712 | 712 | } |
| 713 | 713 | else {
|
| 714 | 714 | echo '<table class="side" cellspacing="0"> |
| 715 | - <tr><td><var>'.$output['fileTotals']['count'].'</var><h4>Total Files</h4></td></tr> |
|
| 716 | - <tr><td class="alt"><var>'.$output['fileTotals']['size'].'</var> <h4>Total Size</h4></td></tr> |
|
| 717 | - <tr><td><var>'.$output['fileTotals']['largest'].'</var> <h4>Largest</h4></td></tr> |
|
| 715 | + <tr><td><var>'.$output['fileTotals']['count'] . '</var><h4>Total Files</h4></td></tr> |
|
| 716 | + <tr><td class="alt"><var>'.$output['fileTotals']['size'] . '</var> <h4>Total Size</h4></td></tr> |
|
| 717 | + <tr><td><var>'.$output['fileTotals']['largest'] . '</var> <h4>Largest</h4></td></tr> |
|
| 718 | 718 | </table> |
| 719 | 719 | <table class="main" cellspacing="0">'; |
| 720 | 720 | |
| 721 | - $class =''; |
|
| 722 | - foreach($output['files'] as $file) {
|
|
| 723 | - echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>'; |
|
| 724 | - if($class == '') $class = 'alt'; |
|
| 721 | + $class = ''; |
|
| 722 | + foreach ($output['files'] as $file) {
|
|
| 723 | + echo '<tr><td class="' . $class . '"><b>' . $file['size'] . '</b> ' . $file['name'] . '</td></tr>'; |
|
| 724 | + if ($class == '') $class = 'alt'; |
|
| 725 | 725 | else $class = ''; |
| 726 | 726 | } |
| 727 | 727 | |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | private function get_console_log() |
| 28 | 28 | {
|
| 29 | 29 | $log = $this->console->getLog(); |
| 30 | - if(!isset($log['debugger_log'])) |
|
| 30 | + if (!isset($log['debugger_log'])) |
|
| 31 | 31 | return; |
| 32 | 32 | |
| 33 | - foreach($log['debugger_log'] as $key => $log_item) |
|
| 33 | + foreach ($log['debugger_log'] as $key => $log_item) |
|
| 34 | 34 | {
|
| 35 | - switch($log_item['type']) |
|
| 35 | + switch ($log_item['type']) |
|
| 36 | 36 | {
|
| 37 | 37 | case 'log' : |
| 38 | 38 | case 'error' : |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $included_files = $this->get_files(); |
| 56 | 56 | $file_array = array(); |
| 57 | 57 | |
| 58 | - foreach($included_files as $file) |
|
| 58 | + foreach ($included_files as $file) |
|
| 59 | 59 | {
|
| 60 | 60 | $file_size = filesize($file); |
| 61 | 61 | $file_array[] = array( |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | $total_file_size = 0; |
| 75 | 75 | $largest_file_size = 0; |
| 76 | 76 | |
| 77 | - foreach($included_files as $file) |
|
| 77 | + foreach ($included_files as $file) |
|
| 78 | 78 | {
|
| 79 | 79 | $file_size = filesize($file); |
| 80 | 80 | $total_file_size += $file_size; |
| 81 | - if($file_size > $largest_file_size) |
|
| 81 | + if ($file_size > $largest_file_size) |
|
| 82 | 82 | $largest_file_size = $file_size; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -130,15 +130,15 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | private function get_readable_memory_usage($memory) |
| 132 | 132 | {
|
| 133 | - foreach(self::$MEMORY_SIZE_ARRAY as $key => $memory_size) |
|
| 133 | + foreach (self::$MEMORY_SIZE_ARRAY as $key => $memory_size) |
|
| 134 | 134 | {
|
| 135 | - if($memory < 1024) |
|
| 135 | + if ($memory < 1024) |
|
| 136 | 136 | break; |
| 137 | - if(count(self::$MEMORY_SIZE_ARRAY) != $key + 1) |
|
| 137 | + if (count(self::$MEMORY_SIZE_ARRAY) != $key + 1) |
|
| 138 | 138 | $memory /= 1024; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if($memory_size == 'bytes') |
|
| 141 | + if ($memory_size == 'bytes') |
|
| 142 | 142 | return sprintf('%01d %s', $memory, $memory_size);
|
| 143 | 143 | return sprintf('%01.2f %s', $memory, $memory_size);
|
| 144 | 144 | } |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | private function get_readable_time($time) |
| 156 | 156 | {
|
| 157 | - if($time >= 60000) |
|
| 157 | + if ($time >= 60000) |
|
| 158 | 158 | return number_format(($time / 60000), 3, '.', '') . ' m'; |
| 159 | - else if($time >= 1000 && $time < 60000) |
|
| 159 | + else if ($time >= 1000 && $time < 60000) |
|
| 160 | 160 | return number_format(($time / 1000), 3, '.', '') . ' s'; |
| 161 | 161 | else |
| 162 | 162 | return number_format($time, 3, '.', '') . ' ms'; |