@@ -13,8 +13,9 @@ |
||
13 | 13 | { |
14 | 14 | foreach(self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace) |
15 | 15 | { |
16 | - if(stristr($this->content, $match)) |
|
17 | - $this->content = str_replace($match, $replace, $this->content); |
|
16 | + if(stristr($this->content, $match)) { |
|
17 | + $this->content = str_replace($match, $replace, $this->content); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | return; |
20 | 21 | } |
@@ -10,8 +10,9 @@ |
||
10 | 10 | protected function execute($title = '') |
11 | 11 | { |
12 | 12 | preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches); |
13 | - if(count($matches[1]) == 0) |
|
14 | - return; |
|
13 | + if(count($matches[1]) == 0) { |
|
14 | + return; |
|
15 | + } |
|
15 | 16 | |
16 | 17 | foreach($matches[3] as $key => $match) |
17 | 18 | { |
@@ -33,17 +33,19 @@ discard block |
||
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if(count($args) == 2) |
|
37 | - $etc = $args[1]; |
|
38 | - else |
|
39 | - $etc = self::$ETC; |
|
36 | + if(count($args) == 2) { |
|
37 | + $etc = $args[1]; |
|
38 | + } else { |
|
39 | + $etc = self::$ETC; |
|
40 | + } |
|
40 | 41 | |
41 | 42 | $length = $args[0]; |
42 | 43 | |
43 | - if($length < strlen($this->content)) |
|
44 | - $this->trim_string($length); |
|
45 | - else |
|
46 | - $etc = ''; |
|
44 | + if($length < strlen($this->content)) { |
|
45 | + $this->trim_string($length); |
|
46 | + } else { |
|
47 | + $etc = ''; |
|
48 | + } |
|
47 | 49 | $this->check_exclude_tags(); |
48 | 50 | $this->close_tags($etc); |
49 | 51 | } |
@@ -54,8 +56,9 @@ discard block |
||
54 | 56 | |
55 | 57 | $last_right_bracket_position = strripos($content, self::$RIGHT_BRACKET); |
56 | 58 | $last_left_bracket_position = strripos($content, self::$LEFT_BRACKET); |
57 | - if($last_left_bracket_position > $last_right_bracket_position) |
|
58 | - $content = substr($content, 0, $last_left_bracket_position); |
|
59 | + if($last_left_bracket_position > $last_right_bracket_position) { |
|
60 | + $content = substr($content, 0, $last_left_bracket_position); |
|
61 | + } |
|
59 | 62 | $content = trim($content); |
60 | 63 | |
61 | 64 | $this->content = $content; |
@@ -76,14 +79,16 @@ discard block |
||
76 | 79 | foreach($matches[0] as $match) |
77 | 80 | { |
78 | 81 | $max_length += strlen($match[0]); |
79 | - if($max_length <= $match[1]) |
|
80 | - break; |
|
82 | + if($max_length <= $match[1]) { |
|
83 | + break; |
|
84 | + } |
|
81 | 85 | |
82 | 86 | $content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]); |
83 | 87 | } |
84 | 88 | |
85 | - if(substr($content, -7) == '</p><p>') |
|
86 | - $content = substr($content, 0, -7); |
|
89 | + if(substr($content, -7) == '</p><p>') { |
|
90 | + $content = substr($content, 0, -7); |
|
91 | + } |
|
87 | 92 | |
88 | 93 | return $content; |
89 | 94 | } |
@@ -118,9 +123,9 @@ discard block |
||
118 | 123 | { |
119 | 124 | $key = array_search($tag, $open_tags); |
120 | 125 | unset($open_tags[$key]); |
126 | + } else { |
|
127 | + $open_tags[] = $tag; |
|
121 | 128 | } |
122 | - else |
|
123 | - $open_tags[] = $tag; |
|
124 | 129 | } |
125 | 130 | |
126 | 131 | $open_tags = array_reverse($open_tags); |
@@ -128,13 +133,14 @@ discard block |
||
128 | 133 | { |
129 | 134 | foreach($open_tags as $key => $open_tag) |
130 | 135 | { |
131 | - if($key == count($open_tags) - 1) |
|
132 | - $content .= $etc; |
|
136 | + if($key == count($open_tags) - 1) { |
|
137 | + $content .= $etc; |
|
138 | + } |
|
133 | 139 | $content .= "</{$open_tag}>"; |
134 | 140 | } |
141 | + } else { |
|
142 | + $content .= $etc; |
|
135 | 143 | } |
136 | - else |
|
137 | - $content .= $etc; |
|
138 | 144 | |
139 | 145 | $this->content = $content; |
140 | 146 | } |
@@ -33,8 +33,7 @@ |
||
33 | 33 | $query = sprintf(self::$UPDATE_COMMENTS_QUERY, $comments, $blog_result->id); |
34 | 34 | Database::execute($query); |
35 | 35 | } |
36 | - } |
|
37 | - else |
|
36 | + } else |
|
38 | 37 | { |
39 | 38 | $title = Database::escape($post->title); |
40 | 39 | $category = Database::escape($post->category); |
@@ -19,13 +19,15 @@ discard block |
||
19 | 19 | |
20 | 20 | public function activate() |
21 | 21 | { |
22 | - if(!$this->xml) |
|
23 | - return $this->error('Could not connect to feed.'); |
|
22 | + if(!$this->xml) { |
|
23 | + return $this->error('Could not connect to feed.'); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | foreach($this->xml->channel->item as $item) |
26 | 27 | { |
27 | - if(strtotime($item->user_read_at) <= 0) |
|
28 | - continue; |
|
28 | + if(strtotime($item->user_read_at) <= 0) { |
|
29 | + continue; |
|
30 | + } |
|
29 | 31 | |
30 | 32 | $title = $item->title; |
31 | 33 | $title = trim($title); |
@@ -42,8 +44,9 @@ discard block |
||
42 | 44 | $date_added = date('Y-m-d H:i:s', strtotime($item->user_date_created)); |
43 | 45 | |
44 | 46 | $book_result = BookCollector::getBookByFields($title, $author); |
45 | - if($book_result !== null) |
|
46 | - continue; |
|
47 | + if($book_result !== null) { |
|
48 | + continue; |
|
49 | + } |
|
47 | 50 | |
48 | 51 | $query = sprintf(self::$QUERY, $title, $author, $link, $description, $image, $date_read, $date_added); |
49 | 52 | Database::execute($query); |
@@ -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]; |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | public function activate() |
22 | 22 | { |
23 | - if(!$this->json) |
|
24 | - return $this->error('Could not connect to feed.'); |
|
23 | + if(!$this->json) { |
|
24 | + return $this->error('Could not connect to feed.'); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | $count = 0; |
27 | 28 | foreach($this->json->entries as $entry) |
@@ -41,8 +42,9 @@ discard block |
||
41 | 42 | $date = date('Y-m-d H:i:s', strtotime($entry->at)); |
42 | 43 | |
43 | 44 | $distance_result = DistanceCollector::getDistanceByFields($date, $type, $distance); |
44 | - if($distance_result !== null) |
|
45 | - continue; |
|
45 | + if($distance_result !== null) { |
|
46 | + continue; |
|
47 | + } |
|
46 | 48 | |
47 | 49 | $query = sprintf(self::$QUERY, $type, $distance, $url, $felt, $title, $message, $date); |
48 | 50 | Database::execute($query); |
@@ -13,10 +13,11 @@ discard block |
||
13 | 13 | |
14 | 14 | function __construct() |
15 | 15 | { |
16 | - if(Loader::isLive()) |
|
17 | - $handle[] = self::$live_root; |
|
18 | - else |
|
19 | - $handle[] = self::$test_root; |
|
16 | + if(Loader::isLive()) { |
|
17 | + $handle[] = self::$live_root; |
|
18 | + } else { |
|
19 | + $handle[] = self::$test_root; |
|
20 | + } |
|
20 | 21 | |
21 | 22 | $i = 0; |
22 | 23 | while(isset($handle[$i])) |
@@ -27,10 +28,12 @@ discard block |
||
27 | 28 | { |
28 | 29 | if($file != '.' && $file != '..') |
29 | 30 | { |
30 | - if(is_dir("{$path}/{$file}")) |
|
31 | - $handle[] = "{$path}/{$file}"; |
|
32 | - if($file == 'error.log') |
|
33 | - $this->error_files[] = "{$path}/{$file}"; |
|
31 | + if(is_dir("{$path}/{$file}")) { |
|
32 | + $handle[] = "{$path}/{$file}"; |
|
33 | + } |
|
34 | + if($file == 'error.log') { |
|
35 | + $this->error_files[] = "{$path}/{$file}"; |
|
36 | + } |
|
34 | 37 | } |
35 | 38 | } |
36 | 39 | closedir($fh); |
@@ -50,9 +53,9 @@ discard block |
||
50 | 53 | $contents = file_get_contents($error_file); |
51 | 54 | $message .= "{$error_file}\n{$contents}\n\n"; |
52 | 55 | } |
56 | + } else { |
|
57 | + $message = 'No errors found in the flat-files!'; |
|
53 | 58 | } |
54 | - else |
|
55 | - $message = 'No errors found in the flat-files!'; |
|
56 | 59 | |
57 | 60 | $mail = new Mail(); |
58 | 61 | $mail->setToAddress('EMAIL', 'Jacob Emerick'); |
@@ -20,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 && |