@@ -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 &&
|
@@ -64,8 +64,9 @@ |
||
| 64 | 64 | foreach($result as $key => $row) |
| 65 | 65 | {
|
| 66 | 66 | $stream_result = ActivityCollector::getPostByFields($row->id, $type); |
| 67 | - if($stream_result) |
|
| 68 | - unset($result[$key]); |
|
| 67 | + if($stream_result) {
|
|
| 68 | + unset($result[$key]); |
|
| 69 | + } |
|
| 69 | 70 | } |
| 70 | 71 | return $result; |
| 71 | 72 | } |
@@ -127,8 +127,9 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function activate() |
| 129 | 129 | {
|
| 130 | - if(!$this->json) |
|
| 131 | - return $this->error('Could not connect to twitter json feed.');
|
|
| 130 | + if(!$this->json) {
|
|
| 131 | + return $this->error('Could not connect to twitter json feed.');
|
|
| 132 | + } |
|
| 132 | 133 | |
| 133 | 134 | $count = 0; |
| 134 | 135 | foreach($this->json as $status) |
@@ -152,8 +153,7 @@ discard block |
||
| 152 | 153 | $query = sprintf(self::$UPDATE_RETWEETS_QUERY, $retweets, $tweet_result->id); |
| 153 | 154 | Database::execute($query); |
| 154 | 155 | } |
| 155 | - } |
|
| 156 | - else |
|
| 156 | + } else |
|
| 157 | 157 | {
|
| 158 | 158 | $twitter_id = (string) $status->id_str; |
| 159 | 159 | |
@@ -164,8 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $text_formatted = $this->prepend_original_user($status->retweeted_status->user, $text_formatted); |
| 166 | 166 | $text_formatted_full = $this->prepend_original_user($status->retweeted_status->user, $text_formatted_full); |
| 167 | - } |
|
| 168 | - else |
|
| 167 | + } else |
|
| 169 | 168 | {
|
| 170 | 169 | $text_formatted = $this->get_formatted($status->text, $status->entities); |
| 171 | 170 | $text_formatted_full = $this->get_formatted($status->text, $status->entities, 'full'); |
@@ -200,12 +199,14 @@ discard block |
||
| 200 | 199 | |
| 201 | 200 | private function get_source($source) |
| 202 | 201 | {
|
| 203 | - if(stristr($source, 'tweetdeck')) |
|
| 204 | - return 'tweetdeck'; |
|
| 205 | - if(stristr($source, 'windows phone')) |
|
| 206 | - return 'phone'; |
|
| 207 | - else |
|
| 208 | - return ''; |
|
| 202 | + if(stristr($source, 'tweetdeck')) {
|
|
| 203 | + return 'tweetdeck'; |
|
| 204 | + } |
|
| 205 | + if(stristr($source, 'windows phone')) {
|
|
| 206 | + return 'phone'; |
|
| 207 | + } else {
|
|
| 208 | + return ''; |
|
| 209 | + } |
|
| 209 | 210 | } |
| 210 | 211 | |
| 211 | 212 | private function get_formatted($text, $entities, $type = 'short') |
@@ -253,10 +254,11 @@ discard block |
||
| 253 | 254 | $replace = sprintf(self::$USER_MENTION_LINK, $entity->screen_name, $entity->name); |
| 254 | 255 | break; |
| 255 | 256 | case 'media' : |
| 256 | - if($type == 'full') |
|
| 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 | - else |
|
| 259 | - $replace = sprintf(self::$URL_LINK, $entity->url, $entity->expanded_url, $entity->display_url); |
|
| 257 | + if($type == 'full') {
|
|
| 258 | + $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); |
|
| 259 | + } else {
|
|
| 260 | + $replace = sprintf(self::$URL_LINK, $entity->url, $entity->expanded_url, $entity->display_url); |
|
| 261 | + } |
|
| 260 | 262 | break; |
| 261 | 263 | default : |
| 262 | 264 | $replace = ''; |
@@ -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); |
@@ -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 | } |
@@ -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 | } |
@@ -570,8 +570,7 @@ discard block |
||
| 570 | 570 | |
| 571 | 571 | if($logCount == 0) {
|
| 572 | 572 | echo '<h3>This panel has no log items.</h3>'; |
| 573 | -} |
|
| 574 | -else {
|
|
| 573 | +} else {
|
|
| 575 | 574 | echo '<table class="side" cellspacing="0"> |
| 576 | 575 | <tr> |
| 577 | 576 | <td class="alt1"><var>'.$output['logs']['log_count'].'</var><h4>Logs</h4></td> |
@@ -591,20 +590,20 @@ discard block |
||
| 591 | 590 | <td class="'.$class.'">'; |
| 592 | 591 | if($log['type'] == 'log') {
|
| 593 | 592 | echo '<div><pre>'.$log['data'].'</pre></div>'; |
| 594 | - } |
|
| 595 | - elseif($log['type'] == 'memory') {
|
|
| 593 | + } elseif($log['type'] == 'memory') {
|
|
| 596 | 594 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['dataType'].'</em>: '.$log['name'].' </div>'; |
| 597 | - } |
|
| 598 | - elseif($log['type'] == 'speed') {
|
|
| 595 | + } elseif($log['type'] == 'speed') {
|
|
| 599 | 596 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
| 600 | - } |
|
| 601 | - elseif($log['type'] == 'error') {
|
|
| 597 | + } elseif($log['type'] == 'error') {
|
|
| 602 | 598 | echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>'; |
| 603 | 599 | } |
| 604 | 600 | |
| 605 | 601 | echo '</td></tr>'; |
| 606 | - if($class == '') $class = 'alt'; |
|
| 607 | - else $class = ''; |
|
| 602 | + if($class == '') {
|
|
| 603 | + $class = 'alt'; |
|
| 604 | + } else {
|
|
| 605 | + $class = ''; |
|
| 606 | + } |
|
| 608 | 607 | } |
| 609 | 608 | |
| 610 | 609 | echo '</table>'; |
@@ -616,8 +615,7 @@ discard block |
||
| 616 | 615 | |
| 617 | 616 | if($output['logs']['speedCount'] == 0) {
|
| 618 | 617 | echo '<h3>This panel has no log items.</h3>'; |
| 619 | -} |
|
| 620 | -else {
|
|
| 618 | +} else {
|
|
| 621 | 619 | echo '<table class="side" cellspacing="0"> |
| 622 | 620 | <tr><td><var>'.$output['speedTotals']['total'].'</var><h4>Load Time</h4></td></tr> |
| 623 | 621 | <tr><td class="alt"><var>'.$output['speedTotals']['allowed'].'</var> <h4>Max Execution Time</h4></td></tr> |
@@ -631,8 +629,11 @@ discard block |
||
| 631 | 629 | <td class="'.$class.'">'; |
| 632 | 630 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
| 633 | 631 | echo '</td></tr>'; |
| 634 | - if($class == '') $class = 'alt'; |
|
| 635 | - else $class = ''; |
|
| 632 | + if($class == '') {
|
|
| 633 | + $class = 'alt'; |
|
| 634 | + } else {
|
|
| 635 | + $class = ''; |
|
| 636 | + } |
|
| 636 | 637 | } |
| 637 | 638 | } |
| 638 | 639 | |
@@ -645,8 +646,7 @@ discard block |
||
| 645 | 646 | |
| 646 | 647 | if($output['queryTotals']['count'] == 0) {
|
| 647 | 648 | echo '<h3>This panel has no log items.</h3>'; |
| 648 | -} |
|
| 649 | -else {
|
|
| 649 | +} else {
|
|
| 650 | 650 | echo '<table class="side" cellspacing="0"> |
| 651 | 651 | <tr><td><var>'.$output['queryTotals']['count'].'</var><h4>Total Queries</h4></td></tr> |
| 652 | 652 | <tr><td class="alt"><var>'.$output['queryTotals']['time'].'</var> <h4>Total Time</h4></td></tr> |
@@ -668,8 +668,11 @@ discard block |
||
| 668 | 668 | </em>'; |
| 669 | 669 | } |
| 670 | 670 | echo '</td></tr>'; |
| 671 | - if($class == '') $class = 'alt'; |
|
| 672 | - else $class = ''; |
|
| 671 | + if($class == '') {
|
|
| 672 | + $class = 'alt'; |
|
| 673 | + } else {
|
|
| 674 | + $class = ''; |
|
| 675 | + } |
|
| 673 | 676 | } |
| 674 | 677 | |
| 675 | 678 | echo '</table>'; |
@@ -681,8 +684,7 @@ discard block |
||
| 681 | 684 | |
| 682 | 685 | if($output['logs']['memoryCount'] == 0) {
|
| 683 | 686 | echo '<h3>This panel has no log items.</h3>'; |
| 684 | -} |
|
| 685 | -else {
|
|
| 687 | +} else {
|
|
| 686 | 688 | echo '<table class="side" cellspacing="0"> |
| 687 | 689 | <tr><td><var>'.$output['memoryTotals']['used'].'</var><h4>Used Memory</h4></td></tr> |
| 688 | 690 | <tr><td class="alt"><var>'.$output['memoryTotals']['total'].'</var> <h4>Total Available</h4></td></tr> |
@@ -695,8 +697,11 @@ discard block |
||
| 695 | 697 | echo '<tr class="log-'.$log['type'].'">'; |
| 696 | 698 | echo '<td class="'.$class.'"><b>'.$log['data'].'</b> <em>'.$log['dataType'].'</em>: '.$log['name'].'</td>'; |
| 697 | 699 | echo '</tr>'; |
| 698 | - if($class == '') $class = 'alt'; |
|
| 699 | - else $class = ''; |
|
| 700 | + if($class == '') {
|
|
| 701 | + $class = 'alt'; |
|
| 702 | + } else {
|
|
| 703 | + $class = ''; |
|
| 704 | + } |
|
| 700 | 705 | } |
| 701 | 706 | } |
| 702 | 707 | |
@@ -709,8 +714,7 @@ discard block |
||
| 709 | 714 | |
| 710 | 715 | if($output['fileTotals']['count'] == 0) {
|
| 711 | 716 | echo '<h3>This panel has no log items.</h3>'; |
| 712 | -} |
|
| 713 | -else {
|
|
| 717 | +} else {
|
|
| 714 | 718 | echo '<table class="side" cellspacing="0"> |
| 715 | 719 | <tr><td><var>'.$output['fileTotals']['count'].'</var><h4>Total Files</h4></td></tr> |
| 716 | 720 | <tr><td class="alt"><var>'.$output['fileTotals']['size'].'</var> <h4>Total Size</h4></td></tr> |
@@ -721,8 +725,11 @@ discard block |
||
| 721 | 725 | $class =''; |
| 722 | 726 | foreach($output['files'] as $file) {
|
| 723 | 727 | echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>'; |
| 724 | - if($class == '') $class = 'alt'; |
|
| 725 | - else $class = ''; |
|
| 728 | + if($class == '') {
|
|
| 729 | + $class = 'alt'; |
|
| 730 | + } else {
|
|
| 731 | + $class = ''; |
|
| 732 | + } |
|
| 726 | 733 | } |
| 727 | 734 | |
| 728 | 735 | echo '</table>'; |
@@ -27,8 +27,9 @@ discard block |
||
| 27 | 27 | private function get_console_log() |
| 28 | 28 | {
|
| 29 | 29 | $log = $this->console->getLog(); |
| 30 | - if(!isset($log['debugger_log'])) |
|
| 31 | - return; |
|
| 30 | + if(!isset($log['debugger_log'])) {
|
|
| 31 | + return; |
|
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | foreach($log['debugger_log'] as $key => $log_item) |
| 34 | 35 | {
|
@@ -78,8 +79,9 @@ discard block |
||
| 78 | 79 | {
|
| 79 | 80 | $file_size = filesize($file); |
| 80 | 81 | $total_file_size += $file_size; |
| 81 | - if($file_size > $largest_file_size) |
|
| 82 | - $largest_file_size = $file_size; |
|
| 82 | + if($file_size > $largest_file_size) {
|
|
| 83 | + $largest_file_size = $file_size; |
|
| 84 | + } |
|
| 83 | 85 | } |
| 84 | 86 | |
| 85 | 87 | return array( |
@@ -132,14 +134,17 @@ discard block |
||
| 132 | 134 | {
|
| 133 | 135 | foreach(self::$MEMORY_SIZE_ARRAY as $key => $memory_size) |
| 134 | 136 | {
|
| 135 | - if($memory < 1024) |
|
| 136 | - break; |
|
| 137 | - if(count(self::$MEMORY_SIZE_ARRAY) != $key + 1) |
|
| 138 | - $memory /= 1024; |
|
| 137 | + if($memory < 1024) {
|
|
| 138 | + break; |
|
| 139 | + } |
|
| 140 | + if(count(self::$MEMORY_SIZE_ARRAY) != $key + 1) {
|
|
| 141 | + $memory /= 1024; |
|
| 142 | + } |
|
| 139 | 143 | } |
| 140 | 144 | |
| 141 | - if($memory_size == 'bytes') |
|
| 142 | - return sprintf('%01d %s', $memory, $memory_size);
|
|
| 145 | + if($memory_size == 'bytes') {
|
|
| 146 | + return sprintf('%01d %s', $memory, $memory_size);
|
|
| 147 | + } |
|
| 143 | 148 | return sprintf('%01.2f %s', $memory, $memory_size);
|
| 144 | 149 | } |
| 145 | 150 | |
@@ -154,12 +159,13 @@ discard block |
||
| 154 | 159 | |
| 155 | 160 | private function get_readable_time($time) |
| 156 | 161 | {
|
| 157 | - if($time >= 60000) |
|
| 158 | - return number_format(($time / 60000), 3, '.', '') . ' m'; |
|
| 159 | - else if($time >= 1000 && $time < 60000) |
|
| 160 | - return number_format(($time / 1000), 3, '.', '') . ' s'; |
|
| 161 | - else |
|
| 162 | - return number_format($time, 3, '.', '') . ' ms'; |
|
| 162 | + if($time >= 60000) {
|
|
| 163 | + return number_format(($time / 60000), 3, '.', '') . ' m'; |
|
| 164 | + } else if($time >= 1000 && $time < 60000) {
|
|
| 165 | + return number_format(($time / 1000), 3, '.', '') . ' s'; |
|
| 166 | + } else {
|
|
| 167 | + return number_format($time, 3, '.', '') . ' ms'; |
|
| 168 | + } |
|
| 163 | 169 | } |
| 164 | 170 | |
| 165 | 171 | private function collect_profile_array() |