@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
| 42 | 42 | |
| 43 | - if($match_count < 1) |
|
| 44 | - return; |
|
| 43 | + if($match_count < 1) {
|
|
| 44 | + return; |
|
| 45 | + } |
|
| 45 | 46 | |
| 46 | 47 | foreach($matches as $match) |
| 47 | 48 | { |
@@ -79,8 +80,9 @@ discard block |
||
| 79 | 80 | { |
| 80 | 81 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
| 81 | 82 | |
| 82 | - if($match_count < 1) |
|
| 83 | - return; |
|
| 83 | + if($match_count < 1) {
|
|
| 84 | + return; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | foreach($matches as $match) |
| 86 | 88 | { |
@@ -10,8 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected function execute() |
| 12 | 12 | { |
| 13 | - if(stristr($this->content, '@') === false) |
|
| 14 | - return; |
|
| 13 | + if(stristr($this->content, '@') === false) {
|
|
| 14 | + return; |
|
| 15 | + } |
|
| 15 | 16 | |
| 16 | 17 | // yeah yeah, i'm currently ignoring the link, whatevs |
| 17 | 18 | $parameters = func_get_args(); |
@@ -23,8 +24,9 @@ discard block |
||
| 23 | 24 | $parameters = array_shift($parameters); |
| 24 | 25 | |
| 25 | 26 | $found_user = preg_match_all(self::$USER_PATTERN, $this->content, $matches, PREG_SET_ORDER); |
| 26 | - if($found_user === false || $found_user === 0) |
|
| 27 | - return; |
|
| 27 | + if($found_user === false || $found_user === 0) {
|
|
| 28 | + return; |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | 31 | foreach($matches as $match) |
| 30 | 32 | { |
@@ -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); |
@@ -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 = ''; |
@@ -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 | } |
@@ -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); |
| 36 | - } |
|
| 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; |
|
| 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 | + } |
|
| 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); |
| 52 | - } |
|
| 53 | - else |
|
| 54 | - $description = ''; |
|
| 53 | + } else {
|
|
| 54 | + $description = ''; |
|
| 55 | + } |
|
| 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,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); |
@@ -21,12 +21,14 @@ discard block |
||
| 21 | 21 | $changeset_to_check = $this->get_changeset_to_check(); |
| 22 | 22 | $data = $this->get_changeset_page_data($changeset_to_check); |
| 23 | 23 | |
| 24 | - if(!isset($data)) |
|
| 25 | - break; |
|
| 24 | + if(!isset($data)) {
|
|
| 25 | + break; |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | $this->save_changeset_data($data); |
| 28 | - if($loop_count > 20) |
|
| 29 | - exit; |
|
| 29 | + if($loop_count > 20) {
|
|
| 30 | + exit; |
|
| 31 | + } |
|
| 30 | 32 | } |
| 31 | 33 | |
| 32 | 34 | return true; |
@@ -53,8 +55,9 @@ discard block |
||
| 53 | 55 | { |
| 54 | 56 | $changeset = ChangelogCollector::getMostRecentChange(); |
| 55 | 57 | |
| 56 | - if($changeset === null) |
|
| 57 | - return 1; |
|
| 58 | + if($changeset === null) {
|
|
| 59 | + return 1; |
|
| 60 | + } |
|
| 58 | 61 | |
| 59 | 62 | $number = $changeset->number; |
| 60 | 63 | $number++; |
@@ -66,8 +69,9 @@ discard block |
||
| 66 | 69 | $changeset_page = $this->get_changeset_page($page); |
| 67 | 70 | |
| 68 | 71 | preg_match('@<h1>(.+)</h1>@', $changeset_page, $match); |
| 69 | - if(stristr($match[1], 'Error: Invalid Changeset Number') !== false) |
|
| 70 | - return; |
|
| 72 | + if(stristr($match[1], 'Error: Invalid Changeset Number') !== false) {
|
|
| 73 | + return; |
|
| 74 | + } |
|
| 71 | 75 | |
| 72 | 76 | preg_match('@<h1>Changeset (\d+)</h1>@', $changeset_page, $match); |
| 73 | 77 | $number = $match[1]; |
@@ -13,10 +13,11 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function __construct() |
| 15 | 15 | { |
| 16 | - if(Loader::isLive()) |
|
| 17 | - $handle[] = self::$live_root; |
|
| 18 | - else |
|
| 19 | - $handle[] = self::$test_root; |
|
| 16 | + if(Loader::isLive()) {
|
|
| 17 | + $handle[] = self::$live_root; |
|
| 18 | + } else {
|
|
| 19 | + $handle[] = self::$test_root; |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | 22 | $i = 0; |
| 22 | 23 | while(isset($handle[$i])) |
@@ -27,10 +28,12 @@ discard block |
||
| 27 | 28 | { |
| 28 | 29 | if($file != '.' && $file != '..') |
| 29 | 30 | { |
| 30 | - if(is_dir("{$path}/{$file}")) |
|
| 31 | - $handle[] = "{$path}/{$file}"; |
|
| 32 | - if($file == 'error.log') |
|
| 33 | - $this->error_files[] = "{$path}/{$file}"; |
|
| 31 | + if(is_dir("{$path}/{$file}")) {
|
|
| 32 | + $handle[] = "{$path}/{$file}";
|
|
| 33 | + } |
|
| 34 | + if($file == 'error.log') {
|
|
| 35 | + $this->error_files[] = "{$path}/{$file}";
|
|
| 36 | + } |
|
| 34 | 37 | } |
| 35 | 38 | } |
| 36 | 39 | closedir($fh); |
@@ -50,9 +53,9 @@ discard block |
||
| 50 | 53 | $contents = file_get_contents($error_file); |
| 51 | 54 | $message .= "{$error_file}\n{$contents}\n\n"; |
| 52 | 55 | } |
| 53 | - } |
|
| 54 | - else |
|
| 55 | - $message = 'No errors found in the flat-files!'; |
|
| 56 | + } else {
|
|
| 57 | + $message = 'No errors found in the flat-files!'; |
|
| 58 | + } |
|
| 56 | 59 | |
| 57 | 60 | $mail = new Mail(); |
| 58 | 61 | $mail->setToAddress('EMAIL', 'Jacob Emerick'); |