@@ -14,10 +14,11 @@ discard block |
||
14 | 14 | preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches); |
15 | 15 | foreach($matches[1] as $key => $match) |
16 | 16 | { |
17 | - if(isset($matches[3][$key])) |
|
18 | - $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
19 | - else |
|
20 | - $link_content = $this->get_link($match, $is_absolute); |
|
17 | + if(isset($matches[3][$key])) { |
|
18 | + $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
19 | + } else { |
|
20 | + $link_content = $this->get_link($match, $is_absolute); |
|
21 | + } |
|
21 | 22 | $this->content = str_replace($matches[0][$key], $link_content, $this->content); |
22 | 23 | } |
23 | 24 | return; |
@@ -35,14 +36,16 @@ discard block |
||
35 | 36 | Loader::load('collector', 'blog/PostCollector'); |
36 | 37 | $post = PostCollector::getPostByURI($uri); |
37 | 38 | |
38 | - if($post === NULL) |
|
39 | - return; |
|
39 | + if($post === NULL) { |
|
40 | + return; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
42 | 44 | $link .= "{$post->category}/{$post->path}/"; |
43 | 45 | |
44 | - if($anchor == '') |
|
45 | - $anchor = $post->title; |
|
46 | + if($anchor == '') { |
|
47 | + $anchor = $post->title; |
|
48 | + } |
|
46 | 49 | |
47 | 50 | break; |
48 | 51 | case 'blog-tag' : |
@@ -61,14 +64,16 @@ discard block |
||
61 | 64 | Loader::load('collector', 'waterfall/LogCollector'); |
62 | 65 | $log = LogCollector::getByAlias($uri); |
63 | 66 | |
64 | - if($log === NULL) |
|
65 | - return; |
|
67 | + if($log === NULL) { |
|
68 | + return; |
|
69 | + } |
|
66 | 70 | |
67 | 71 | $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
68 | 72 | $link .= "journal/{$log->alias}/"; |
69 | 73 | |
70 | - if($anchor == '') |
|
71 | - $anchor = $log->title; |
|
74 | + if($anchor == '') { |
|
75 | + $anchor = $log->title; |
|
76 | + } |
|
72 | 77 | |
73 | 78 | break; |
74 | 79 | case 'falls' : |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | Loader::load('collector', 'image/PhotoCollector'); |
39 | 39 | $photo_result = PhotoCollector::fetchRow($category, $photo); |
40 | - if($photo_result == false) |
|
41 | - return ''; |
|
40 | + if($photo_result == false) { |
|
41 | + return ''; |
|
42 | + } |
|
42 | 43 | |
43 | 44 | $height = $file_size[1]; |
44 | 45 | $width = $file_size[0]; |
@@ -49,8 +50,9 @@ discard block |
||
49 | 50 | } |
50 | 51 | |
51 | 52 | $domain = '/'; |
52 | - if($is_absolute) |
|
53 | - $domain = Loader::getRootUrl('blog'); |
|
53 | + if($is_absolute) { |
|
54 | + $domain = Loader::getRootUrl('blog'); |
|
55 | + } |
|
54 | 56 | |
55 | 57 | return sprintf(self::$PHOTO_CONTENT, $domain, $category, $photo, $size, $height, $width, $description, $description); |
56 | 58 | } |
@@ -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); |