@@ -17,6 +17,9 @@ discard block |
||
17 | 17 | return self::run_query($query); |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param integer $total |
|
22 | + */ |
|
20 | 23 | public static function getMainList($total, $offset = 0) |
21 | 24 | { |
22 | 25 | $query = "SELECT `post`.`id` AS `id`, `title`, `path`, `date`, `body`, `category` FROM `jpemeric_blog`.`post` WHERE `display` = '1' ORDER BY `date` DESC LIMIT {$offset}, {$total}"; |
@@ -29,6 +32,9 @@ discard block |
||
29 | 32 | return self::get_count($query); |
30 | 33 | } |
31 | 34 | |
35 | + /** |
|
36 | + * @param integer $total |
|
37 | + */ |
|
32 | 38 | public static function getPostsForTag($tag_id, $total, $offset = 0) |
33 | 39 | { |
34 | 40 | $query = "SELECT `post`.`id` AS `id`, `title`, `path`, `date`, `body`, `category` FROM `jpemeric_blog`.`post`,`jpemeric_blog`.`ptlink` WHERE `display` = '1' && `post`.`id` = `ptlink`.`post_id` && `ptlink`.`tag_id` = '{$tag_id}' ORDER BY `date` DESC LIMIT {$offset}, {$total}"; |
@@ -41,6 +47,9 @@ discard block |
||
41 | 47 | return self::get_count($query); |
42 | 48 | } |
43 | 49 | |
50 | + /** |
|
51 | + * @param integer $total |
|
52 | + */ |
|
44 | 53 | public static function getPostsForCategory($category, $total, $offset = 0) |
45 | 54 | { |
46 | 55 | $category = self::escape($category); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | $tag_clause = "'{$tag_clause}'"; |
81 | 81 | |
82 | 82 | $exclude_clause = ''; |
83 | - if(count($exclude_posts) > 0) |
|
83 | + if (count($exclude_posts) > 0) |
|
84 | 84 | { |
85 | 85 | $exclude_clause .= " && `ptlink`.`post_id` NOT IN ('"; |
86 | 86 | $exclude_clause .= implode("', '", $exclude_posts); |
@@ -83,6 +83,9 @@ |
||
83 | 83 | return self::run_query($query); |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @param integer $count |
|
88 | + */ |
|
86 | 89 | public static function getRecentBlogComments($count) |
87 | 90 | { |
88 | 91 | $query = " |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | return self::run_query($query); |
115 | 115 | } |
116 | 116 | |
117 | - public static function getRecentWaterfallComments($count = 5) |
|
118 | - { |
|
119 | - $query = " |
|
117 | + public static function getRecentWaterfallComments($count = 5) |
|
118 | + { |
|
119 | + $query = " |
|
120 | 120 | SELECT |
121 | 121 | `comment_meta`.`id`, |
122 | 122 | CONCAT('journal/', `log`.`alias`) AS `log_path`, |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | `comment_meta`.`date` DESC |
157 | 157 | LIMIT {$count}"; |
158 | 158 | |
159 | - return self::run_query($query); |
|
160 | - } |
|
159 | + return self::run_query($query); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | public static function getCommentsForURL($site, $path, $commenter = 0) |
163 | 163 | { |
@@ -163,7 +163,7 @@ |
||
163 | 163 | { |
164 | 164 | $path = self::escape($path); |
165 | 165 | |
166 | - if($commenter != 0) |
|
166 | + if ($commenter != 0) |
|
167 | 167 | $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; |
168 | 168 | else |
169 | 169 | $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
@@ -163,10 +163,11 @@ |
||
163 | 163 | { |
164 | 164 | $path = self::escape($path); |
165 | 165 | |
166 | - if($commenter != 0) |
|
167 | - $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; |
|
168 | - else |
|
169 | - $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
166 | + if($commenter != 0) { |
|
167 | + $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; |
|
168 | + } else { |
|
169 | + $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
170 | + } |
|
170 | 171 | |
171 | 172 | $query = " |
172 | 173 | SELECT |
@@ -12,6 +12,9 @@ |
||
12 | 12 | return self::run_query($query); |
13 | 13 | } |
14 | 14 | |
15 | + /** |
|
16 | + * @param integer $action |
|
17 | + */ |
|
15 | 18 | public static function getHuluByFields($title, $action) |
16 | 19 | { |
17 | 20 | $title = self::escape($title); |
@@ -19,6 +19,9 @@ |
||
19 | 19 | return self::run_row_query($query); |
20 | 20 | } |
21 | 21 | |
22 | + /** |
|
23 | + * @param integer $type |
|
24 | + */ |
|
22 | 25 | public static function getImagesForPiece($piece_id, $type) |
23 | 26 | { |
24 | 27 | $piece_id = self::escape($piece_id); |
@@ -35,6 +35,9 @@ discard block |
||
35 | 35 | return self::get_count($query); |
36 | 36 | } |
37 | 37 | |
38 | + /** |
|
39 | + * @param integer $offset |
|
40 | + */ |
|
38 | 41 | public static function getInRange($offset, $start) |
39 | 42 | { |
40 | 43 | $query = "SELECT * FROM `jpemeric_stream`.`post` ORDER BY `date` DESC LIMIT {$start}, {$offset}"; |
@@ -48,6 +51,9 @@ discard block |
||
48 | 51 | return self::get_count($query); |
49 | 52 | } |
50 | 53 | |
54 | + /** |
|
55 | + * @param integer $offset |
|
56 | + */ |
|
51 | 57 | public static function getByTagInRange($tag, $offset, $start) |
52 | 58 | { |
53 | 59 | $tag = self::escape($tag); |
@@ -17,6 +17,9 @@ |
||
17 | 17 | return self::run_row_query($query); |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $date |
|
22 | + */ |
|
20 | 23 | public static function getTweetByFields($date, $text) |
21 | 24 | { |
22 | 25 | $query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1"; |
@@ -34,6 +34,9 @@ discard block |
||
34 | 34 | return self::run_query($query); |
35 | 35 | } |
36 | 36 | |
37 | + /** |
|
38 | + * @param integer $total |
|
39 | + */ |
|
37 | 40 | public static function getRecentList($total) |
38 | 41 | { |
39 | 42 | $query = " |
@@ -178,6 +181,9 @@ discard block |
||
178 | 181 | return self::run_row_query($query); |
179 | 182 | } |
180 | 183 | |
184 | + /** |
|
185 | + * @param string $date |
|
186 | + */ |
|
181 | 187 | public static function getByDate($date) |
182 | 188 | { |
183 | 189 | $date = self::escape($date); |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | return self::run_query($query); |
35 | 35 | } |
36 | 36 | |
37 | - public static function getRecentList($total) |
|
38 | - { |
|
39 | - $query = " |
|
37 | + public static function getRecentList($total) |
|
38 | + { |
|
39 | + $query = " |
|
40 | 40 | SELECT |
41 | 41 | `log`.`title`, |
42 | 42 | `log`.`alias`, |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | `log`.`date` DESC |
60 | 60 | LIMIT |
61 | 61 | {$total}"; |
62 | - return self::run_query($query); |
|
63 | - } |
|
62 | + return self::run_query($query); |
|
63 | + } |
|
64 | 64 | |
65 | 65 | public static function getListCount() |
66 | 66 | { |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | return self::run_row_query($query); |
179 | 179 | } |
180 | 180 | |
181 | - public static function getByDate($date) |
|
182 | - { |
|
183 | - $date = self::escape($date); |
|
181 | + public static function getByDate($date) |
|
182 | + { |
|
183 | + $date = self::escape($date); |
|
184 | 184 | |
185 | - $query = " |
|
185 | + $query = " |
|
186 | 186 | SELECT |
187 | 187 | `log`.`alias` |
188 | 188 | FROM |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | `log`.`is_public` = '1' |
193 | 193 | LIMIT 1"; |
194 | 194 | |
195 | - return self::run_row_query($query); |
|
196 | - } |
|
195 | + return self::run_row_query($query); |
|
196 | + } |
|
197 | 197 | |
198 | 198 | public static function getById($log) |
199 | 199 | { |
@@ -117,6 +117,9 @@ |
||
117 | 117 | return self::run_query($query); |
118 | 118 | } |
119 | 119 | |
120 | + /** |
|
121 | + * @param string $alias |
|
122 | + */ |
|
120 | 123 | public static function getByOldAlias($alias) |
121 | 124 | { |
122 | 125 | $alias = self::escape($alias); |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | return self::run_query($query); |
44 | 44 | } |
45 | 45 | |
46 | - public static function getMapList() |
|
47 | - { |
|
48 | - $query = " |
|
46 | + public static function getMapList() |
|
47 | + { |
|
48 | + $query = " |
|
49 | 49 | SELECT |
50 | 50 | `waterfall`.`name`, |
51 | 51 | `waterfall`.`alias`, |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | ORDER BY |
72 | 72 | `waterfall`.`name`"; |
73 | 73 | |
74 | - return self::run_query($query); |
|
75 | - } |
|
74 | + return self::run_query($query); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | public static function getListCount() |
78 | 78 | { |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | return self::get_count($query); |
93 | 93 | } |
94 | 94 | |
95 | - public static function getNearbyList($waterfall) |
|
96 | - { |
|
97 | - $query = " |
|
95 | + public static function getNearbyList($waterfall) |
|
96 | + { |
|
97 | + $query = " |
|
98 | 98 | SELECT |
99 | 99 | `waterfall`.`name`, |
100 | 100 | `waterfall`.`alias` AS `alias`, |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | `waterfall`.`name`, |
115 | 115 | `watercourse`.`name`"; |
116 | 116 | |
117 | - return self::run_query($query); |
|
118 | - } |
|
117 | + return self::run_query($query); |
|
118 | + } |
|
119 | 119 | |
120 | - public static function getByOldAlias($alias) |
|
121 | - { |
|
122 | - $alias = self::escape($alias); |
|
120 | + public static function getByOldAlias($alias) |
|
121 | + { |
|
122 | + $alias = self::escape($alias); |
|
123 | 123 | |
124 | - $query = " |
|
124 | + $query = " |
|
125 | 125 | SELECT |
126 | 126 | `waterfall`.`alias`, |
127 | 127 | `watercourse`.`alias` AS `watercourse_alias` |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | `waterfall`.`is_public` = '1' |
135 | 135 | LIMIT 1"; |
136 | 136 | |
137 | - return self::run_row_query($query); |
|
138 | - } |
|
137 | + return self::run_row_query($query); |
|
138 | + } |
|
139 | 139 | |
140 | 140 | public static function getByAlias($watercourse, $waterfall) |
141 | 141 | { |
@@ -97,6 +97,9 @@ |
||
97 | 97 | return $tag_array; |
98 | 98 | } |
99 | 99 | |
100 | + /** |
|
101 | + * @param boolean $trim |
|
102 | + */ |
|
100 | 103 | final private function get_body_for_post($post, $trim) |
101 | 104 | { |
102 | 105 | $body = $post->body; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | Loader::load('collector', 'blog/TagCollector'); |
87 | 87 | |
88 | 88 | $tag_result = TagCollector::getTagsForPost($post->id); |
89 | - $tag_array = array(); |
|
89 | + $tag_array = array(); |
|
90 | 90 | foreach($tag_result as $tag) |
91 | 91 | { |
92 | 92 | $tag_object = new stdclass(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | Loader::load('collector', 'image/PhotoCollector'); |
38 | 38 | $photo_result = PhotoCollector::getRow($id); |
39 | 39 | |
40 | - if($photo_result == null) |
|
40 | + if ($photo_result == null) |
|
41 | 41 | return; |
42 | 42 | |
43 | 43 | $name = $photo_result->name; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $tag_result = TagCollector::getTagsForPost($post->id); |
89 | 89 | $tag_array = array(); |
90 | - foreach($tag_result as $tag) |
|
90 | + foreach ($tag_result as $tag) |
|
91 | 91 | { |
92 | 92 | $tag_object = new stdclass(); |
93 | 93 | $tag_object->name = $tag->tag; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $body = $post->body; |
103 | 103 | |
104 | - if($trim) |
|
104 | + if ($trim) |
|
105 | 105 | $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
106 | 106 | |
107 | 107 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
127 | 127 | |
128 | 128 | $cloud_array = array(); |
129 | - foreach($tag_result as $tag) |
|
129 | + foreach ($tag_result as $tag) |
|
130 | 130 | { |
131 | - if($tag->tag_count < self::$MINIMUM_TAG_COUNT) |
|
131 | + if ($tag->tag_count < self::$MINIMUM_TAG_COUNT) |
|
132 | 132 | continue; |
133 | 133 | |
134 | 134 | $tag_object = new stdclass(); |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | { |
146 | 146 | $maximum = 1; |
147 | 147 | |
148 | - foreach($tag_result as $tag) |
|
148 | + foreach ($tag_result as $tag) |
|
149 | 149 | { |
150 | - if($tag->tag_count > $maximum) |
|
150 | + if ($tag->tag_count > $maximum) |
|
151 | 151 | $maximum = $tag->tag_count; |
152 | 152 | } |
153 | 153 | return $maximum; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $comment_array = CommentCollector::getRecentBlogComments(self::$RECENT_COMMENT_COUNT); |
159 | 159 | |
160 | 160 | $array = array(); |
161 | - foreach($comment_array as $comment) |
|
161 | + foreach ($comment_array as $comment) |
|
162 | 162 | { |
163 | 163 | $body = $comment->body; |
164 | 164 | $body = strip_tags($body); |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | Loader::load('collector', 'image/PhotoCollector'); |
38 | 38 | $photo_result = PhotoCollector::getRow($id); |
39 | 39 | |
40 | - if($photo_result == null) |
|
41 | - return; |
|
40 | + if($photo_result == null) { |
|
41 | + return; |
|
42 | + } |
|
42 | 43 | |
43 | 44 | $name = $photo_result->name; |
44 | 45 | $category = $photo_result->category; |
@@ -101,8 +102,9 @@ discard block |
||
101 | 102 | { |
102 | 103 | $body = $post->body; |
103 | 104 | |
104 | - if($trim) |
|
105 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
105 | + if($trim) { |
|
106 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
107 | + } |
|
106 | 108 | |
107 | 109 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
108 | 110 | $body = Content::instance('MarkupCode', $body)->activate(); |
@@ -128,8 +130,9 @@ discard block |
||
128 | 130 | $cloud_array = array(); |
129 | 131 | foreach($tag_result as $tag) |
130 | 132 | { |
131 | - if($tag->tag_count < self::$MINIMUM_TAG_COUNT) |
|
132 | - continue; |
|
133 | + if($tag->tag_count < self::$MINIMUM_TAG_COUNT) { |
|
134 | + continue; |
|
135 | + } |
|
133 | 136 | |
134 | 137 | $tag_object = new stdclass(); |
135 | 138 | $tag_object->name = $tag->tag; |
@@ -147,8 +150,9 @@ discard block |
||
147 | 150 | |
148 | 151 | foreach($tag_result as $tag) |
149 | 152 | { |
150 | - if($tag->tag_count > $maximum) |
|
151 | - $maximum = $tag->tag_count; |
|
153 | + if($tag->tag_count > $maximum) { |
|
154 | + $maximum = $tag->tag_count; |
|
155 | + } |
|
152 | 156 | } |
153 | 157 | return $maximum; |
154 | 158 | } |