@@ -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 = " |
@@ -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 |
@@ -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); |
@@ -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); |
@@ -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; |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | Loader::load('collector', 'image/PhotoCollector'); |
| 42 | 42 | $photo_result = PhotoCollector::getRow($id); |
| 43 | 43 | |
| 44 | - if($photo_result == null) |
|
| 45 | - return; |
|
| 44 | + if($photo_result == null) {
|
|
| 45 | + return; |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | 48 | $name = $photo_result->name; |
| 48 | 49 | $category = $photo_result->category; |
@@ -106,8 +107,9 @@ discard block |
||
| 106 | 107 | { |
| 107 | 108 | $body = $post['body']; |
| 108 | 109 | |
| 109 | - if($trim) |
|
| 110 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
| 110 | + if($trim) {
|
|
| 111 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST);
|
|
| 112 | + } |
|
| 111 | 113 | |
| 112 | 114 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
| 113 | 115 | $body = Content::instance('MarkupCode', $body)->activate(); |
@@ -134,8 +136,9 @@ discard block |
||
| 134 | 136 | $cloud_array = array(); |
| 135 | 137 | foreach($tag_result as $tag) |
| 136 | 138 | { |
| 137 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
| 138 | - continue; |
|
| 139 | + if($tag['count'] < self::$MINIMUM_TAG_COUNT) {
|
|
| 140 | + continue; |
|
| 141 | + } |
|
| 139 | 142 | |
| 140 | 143 | $tag_object = new stdclass(); |
| 141 | 144 | $tag_object->name = $tag['tag']; |
@@ -153,8 +156,9 @@ discard block |
||
| 153 | 156 | |
| 154 | 157 | foreach($tag_result as $tag) |
| 155 | 158 | { |
| 156 | - if($tag['count'] > $maximum) |
|
| 157 | - $maximum = $tag['count']; |
|
| 159 | + if($tag['count'] > $maximum) {
|
|
| 160 | + $maximum = $tag['count']; |
|
| 161 | + } |
|
| 158 | 162 | } |
| 159 | 163 | return $maximum; |
| 160 | 164 | } |
@@ -204,6 +204,9 @@ discard block |
||
| 204 | 204 | exit; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | + /** |
|
| 208 | + * @param string $method |
|
| 209 | + */ |
|
| 207 | 210 | protected function set_header_method($method) |
| 208 | 211 | {
|
| 209 | 212 | $this->headers = $method; |
@@ -214,6 +217,9 @@ discard block |
||
| 214 | 217 | $this->set_head('title', $value);
|
| 215 | 218 | } |
| 216 | 219 | |
| 220 | + /** |
|
| 221 | + * @param string $value |
|
| 222 | + */ |
|
| 217 | 223 | protected function set_author($value) |
| 218 | 224 | {
|
| 219 | 225 | $this->set_head('author', $value);
|
@@ -229,26 +235,41 @@ discard block |
||
| 229 | 235 | $this->set_head('keywords', implode(', ', $array));
|
| 230 | 236 | } |
| 231 | 237 | |
| 238 | + /** |
|
| 239 | + * @param string $url |
|
| 240 | + */ |
|
| 232 | 241 | protected function set_canonical($url) |
| 233 | 242 | {
|
| 234 | 243 | $this->set_head('canonical', $url);
|
| 235 | 244 | } |
| 236 | 245 | |
| 246 | + /** |
|
| 247 | + * @param string $set |
|
| 248 | + */ |
|
| 237 | 249 | protected function set_head($set, $value) |
| 238 | 250 | {
|
| 239 | 251 | $this->data_array['head'][$set] = $value; |
| 240 | 252 | } |
| 241 | 253 | |
| 254 | + /** |
|
| 255 | + * @param string $set |
|
| 256 | + */ |
|
| 242 | 257 | protected function set_body($set, $value) |
| 243 | 258 | {
|
| 244 | 259 | $this->data_array['body'][$set] = $value; |
| 245 | 260 | } |
| 246 | 261 | |
| 262 | + /** |
|
| 263 | + * @param string $file |
|
| 264 | + */ |
|
| 247 | 265 | protected function add_css($file) |
| 248 | 266 | {
|
| 249 | 267 | $this->css_array[] = $file; |
| 250 | 268 | } |
| 251 | 269 | |
| 270 | + /** |
|
| 271 | + * @param string $file |
|
| 272 | + */ |
|
| 252 | 273 | protected function add_js($file) |
| 253 | 274 | {
|
| 254 | 275 | $this->js_array[] = $file; |
@@ -271,6 +292,9 @@ discard block |
||
| 271 | 292 | $this->set_head('js_link_array', $js_array);
|
| 272 | 293 | } |
| 273 | 294 | |
| 295 | + /** |
|
| 296 | + * @param string $view |
|
| 297 | + */ |
|
| 274 | 298 | protected function set_body_view($view) |
| 275 | 299 | {
|
| 276 | 300 | $this->body_view_array[] = $view; |
@@ -315,6 +339,10 @@ discard block |
||
| 315 | 339 | } |
| 316 | 340 | |
| 317 | 341 | private $comment_errors; |
| 342 | + |
|
| 343 | + /** |
|
| 344 | + * @param string $redirect_url |
|
| 345 | + */ |
|
| 318 | 346 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
| 319 | 347 | {
|
| 320 | 348 | if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
|
@@ -102,10 +102,11 @@ discard block |
||
| 102 | 102 | Loader::load('view', '/Head', $this->data_array['head']); |
| 103 | 103 | foreach($this->body_view_array as $view) |
| 104 | 104 | { |
| 105 | - if(substr($view, 0, 1) == '/') |
|
| 106 | - Loader::load('view', $view, $this->data_array['body']); |
|
| 107 | - else |
|
| 108 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 105 | + if(substr($view, 0, 1) == '/') {
|
|
| 106 | + Loader::load('view', $view, $this->data_array['body']);
|
|
| 107 | + } else {
|
|
| 108 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
|
|
| 109 | + } |
|
| 109 | 110 | } |
| 110 | 111 | |
| 111 | 112 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -114,8 +115,9 @@ discard block |
||
| 114 | 115 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | - if($view == '/404' || $view == '/503') |
|
| 118 | - exit; |
|
| 118 | + if($view == '/404' || $view == '/503') {
|
|
| 119 | + exit; |
|
| 120 | + } |
|
| 119 | 121 | } |
| 120 | 122 | |
| 121 | 123 | protected function set_header_method($method) |
@@ -195,14 +197,16 @@ discard block |
||
| 195 | 197 | |
| 196 | 198 | protected function eject() |
| 197 | 199 | { |
| 198 | - if(get_class($this) !== 'Error404Controller') |
|
| 199 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
| 200 | + if(get_class($this) !== 'Error404Controller') {
|
|
| 201 | + Loader::loadNew('controller', '/Error404Controller')->activate();
|
|
| 202 | + } |
|
| 200 | 203 | } |
| 201 | 204 | |
| 202 | 205 | protected function unavailable() |
| 203 | 206 | { |
| 204 | - if(get_class($this) !== 'Error503Controller') |
|
| 205 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
| 207 | + if(get_class($this) !== 'Error503Controller') {
|
|
| 208 | + Loader::loadNew('controller', '/Error503Controller')->activate();
|
|
| 209 | + } |
|
| 206 | 210 | } |
| 207 | 211 | |
| 208 | 212 | protected function redirect($uri, $method = 301) |
@@ -210,12 +214,14 @@ discard block |
||
| 210 | 214 | switch($method) |
| 211 | 215 | { |
| 212 | 216 | case 301 : |
| 213 | - if(get_class($this) !== 'Error301Controller') |
|
| 214 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
| 217 | + if(get_class($this) !== 'Error301Controller') {
|
|
| 218 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
|
|
| 219 | + } |
|
| 215 | 220 | break; |
| 216 | 221 | case 303 : |
| 217 | - if(get_class($this) !== 'Error303Controller') |
|
| 218 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
| 222 | + if(get_class($this) !== 'Error303Controller') {
|
|
| 223 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
|
|
| 224 | + } |
|
| 219 | 225 | break; |
| 220 | 226 | } |
| 221 | 227 | } |
@@ -262,18 +268,19 @@ discard block |
||
| 262 | 268 | $comment_object->url = $comment->url; |
| 263 | 269 | $comment_object->trusted = $comment->trusted; |
| 264 | 270 | |
| 265 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
| 266 | - $comment_object->errors = $this->comment_errors; |
|
| 267 | - else |
|
| 268 | - $comment_object->errors = array(); |
|
| 271 | + if($comment->reply == 0 && Request::getPost('type') == $comment->id) {
|
|
| 272 | + $comment_object->errors = $this->comment_errors; |
|
| 273 | + } else {
|
|
| 274 | + $comment_object->errors = array(); |
|
| 275 | + } |
|
| 269 | 276 | |
| 270 | 277 | if($comment->reply == 0) |
| 271 | 278 | { |
| 272 | 279 | $comment_object->replies = array(); |
| 273 | 280 | $comment_array[$comment->id] = $comment_object; |
| 274 | - } |
|
| 275 | - else |
|
| 276 | - $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
| 281 | + } else {
|
|
| 282 | + $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
| 283 | + } |
|
| 277 | 284 | } |
| 278 | 285 | |
| 279 | 286 | $comment_count = CommentCollector::getCommentCountForURL($site, $path); |
@@ -298,22 +305,26 @@ discard block |
||
| 298 | 305 | $commenter->website = ''; |
| 299 | 306 | |
| 300 | 307 | $commenter_cookie = Cookie::instance('Commenter'); |
| 301 | - if(!$commenter_cookie->exists()) |
|
| 302 | - return $commenter; |
|
| 308 | + if(!$commenter_cookie->exists()) {
|
|
| 309 | + return $commenter; |
|
| 310 | + } |
|
| 303 | 311 | |
| 304 | 312 | $commenter_cookie_value = $commenter_cookie->getValue(); |
| 305 | 313 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
| 306 | 314 | |
| 307 | - if($commenter_cookie_value === NULL) |
|
| 308 | - return $commenter; |
|
| 315 | + if($commenter_cookie_value === NULL) {
|
|
| 316 | + return $commenter; |
|
| 317 | + } |
|
| 309 | 318 | |
| 310 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
| 311 | - return $commenter; |
|
| 319 | + if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) {
|
|
| 320 | + return $commenter; |
|
| 321 | + } |
|
| 312 | 322 | |
| 313 | 323 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
| 314 | 324 | |
| 315 | - if($commenter_object === NULL) |
|
| 316 | - return $commenter; |
|
| 325 | + if($commenter_object === NULL) {
|
|
| 326 | + return $commenter; |
|
| 327 | + } |
|
| 317 | 328 | |
| 318 | 329 | $commenter->id = $commenter_object->id; |
| 319 | 330 | $commenter->name = $commenter_object->name; |
@@ -25,6 +25,9 @@ discard block |
||
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $content |
|
| 30 | + */ |
|
| 28 | 31 | private function wrap_in_list($content) |
| 29 | 32 | {
|
| 30 | 33 | $content_array = explode("\n", $content);
|
@@ -44,6 +47,9 @@ discard block |
||
| 44 | 47 | return $content; |
| 45 | 48 | } |
| 46 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $type |
|
| 52 | + */ |
|
| 47 | 53 | private function highlight_code($content, $type) |
| 48 | 54 | {
|
| 49 | 55 | switch($type) |
@@ -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 | { |
@@ -62,6 +62,9 @@ |
||
| 62 | 62 | $this->is_trimmed = true; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | + /** |
|
| 66 | + * @param string $content |
|
| 67 | + */ |
|
| 65 | 68 | private function trim_html_string($content, $length) |
| 66 | 69 | {
|
| 67 | 70 | $content = preg_replace(self::$PHOTO_PLACEHOLDER_MATCH, '', $content); |
@@ -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]); |
| 121 | - } |
|
| 122 | - else |
|
| 123 | - $open_tags[] = $tag; |
|
| 126 | + } else {
|
|
| 127 | + $open_tags[] = $tag; |
|
| 128 | + } |
|
| 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 | } |
| 135 | - } |
|
| 136 | - else |
|
| 137 | - $content .= $etc; |
|
| 141 | + } else {
|
|
| 142 | + $content .= $etc; |
|
| 143 | + } |
|
| 138 | 144 | |
| 139 | 145 | $this->content = $content; |
| 140 | 146 | } |
@@ -14,9 +14,20 @@ discard block |
||
| 14 | 14 | $this->class_new = $class_name; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @return string |
|
| 19 | + */ |
|
| 17 | 20 | abstract protected function getName(); |
| 18 | 21 | abstract protected function getDuration(); |
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @return string|null |
|
| 25 | + */ |
|
| 19 | 26 | abstract protected function getDomain(); |
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @return string|null |
|
| 30 | + */ |
|
| 20 | 31 | abstract protected function getPath(); |
| 21 | 32 | |
| 22 | 33 | public function setValue($value) |
@@ -28,6 +39,9 @@ discard block |
||
| 28 | 39 | return $this; |
| 29 | 40 | } |
| 30 | 41 | |
| 42 | + /** |
|
| 43 | + * @return string|null |
|
| 44 | + */ |
|
| 31 | 45 | public function getValue() |
| 32 | 46 | {
|
| 33 | 47 | if(!$this->is_loaded) |
@@ -118,6 +132,9 @@ discard block |
||
| 118 | 132 | return $set_cookie; |
| 119 | 133 | } |
| 120 | 134 | |
| 135 | + /** |
|
| 136 | + * @param string $class_name |
|
| 137 | + */ |
|
| 121 | 138 | public static function instance($class_name) |
| 122 | 139 | {
|
| 123 | 140 | return Loader::loadNew('utility', "cookie/{$class_name}Cookie", (array) $class_name);
|
@@ -21,8 +21,9 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function setValue($value) |
| 23 | 23 | { |
| 24 | - if(!$this->is_loaded) |
|
| 25 | - $this->load(); |
|
| 24 | + if(!$this->is_loaded) {
|
|
| 25 | + $this->load(); |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | $this->value = $value; |
| 28 | 29 | return $this; |
@@ -30,8 +31,9 @@ discard block |
||
| 30 | 31 | |
| 31 | 32 | public function getValue() |
| 32 | 33 | { |
| 33 | - if(!$this->is_loaded) |
|
| 34 | - $this->load(); |
|
| 34 | + if(!$this->is_loaded) {
|
|
| 35 | + $this->load(); |
|
| 36 | + } |
|
| 35 | 37 | return $this->value; |
| 36 | 38 | } |
| 37 | 39 | |
@@ -42,24 +44,26 @@ discard block |
||
| 42 | 44 | |
| 43 | 45 | public function exists() |
| 44 | 46 | { |
| 45 | - if(!$this->is_loaded) |
|
| 46 | - $this->load(); |
|
| 47 | + if(!$this->is_loaded) {
|
|
| 48 | + $this->load(); |
|
| 49 | + } |
|
| 47 | 50 | return $this->exists; |
| 48 | 51 | } |
| 49 | 52 | |
| 50 | 53 | private final function load() |
| 51 | 54 | { |
| 52 | 55 | $name = $this->getName(); |
| 53 | - if(isset($_COOKIE[$name])) |
|
| 54 | - $value = $_COOKIE[$name]; |
|
| 56 | + if(isset($_COOKIE[$name])) {
|
|
| 57 | + $value = $_COOKIE[$name]; |
|
| 58 | + } |
|
| 55 | 59 | |
| 56 | 60 | if(isset($value)) |
| 57 | 61 | { |
| 58 | 62 | $this->value = $value; |
| 59 | 63 | $this->exists = true; |
| 60 | - } |
|
| 61 | - else |
|
| 62 | - $this->exists = false; |
|
| 64 | + } else {
|
|
| 65 | + $this->exists = false; |
|
| 66 | + } |
|
| 63 | 67 | |
| 64 | 68 | $this->is_loaded = true; |
| 65 | 69 | } |
@@ -84,24 +88,29 @@ discard block |
||
| 84 | 88 | private final function check_values() |
| 85 | 89 | { |
| 86 | 90 | $name = $this->getName(); |
| 87 | - if(empty($name) || strlen($name) < 1) |
|
| 88 | - return false; |
|
| 91 | + if(empty($name) || strlen($name) < 1) {
|
|
| 92 | + return false; |
|
| 93 | + } |
|
| 89 | 94 | |
| 90 | 95 | $value = $this->getValue(); |
| 91 | - if(!isset($value) || strlen($value) < 1) |
|
| 92 | - return false; |
|
| 96 | + if(!isset($value) || strlen($value) < 1) {
|
|
| 97 | + return false; |
|
| 98 | + } |
|
| 93 | 99 | |
| 94 | 100 | $expiration = $this->getExpiration(); |
| 95 | - if(!isset($expiration) || !is_int($expiration)) |
|
| 96 | - return false; |
|
| 101 | + if(!isset($expiration) || !is_int($expiration)) {
|
|
| 102 | + return false; |
|
| 103 | + } |
|
| 97 | 104 | |
| 98 | 105 | $domain = $this->getDomain(); |
| 99 | - if(!isset($domain) || strlen($domain) < 1) |
|
| 100 | - return false; |
|
| 106 | + if(!isset($domain) || strlen($domain) < 1) {
|
|
| 107 | + return false; |
|
| 108 | + } |
|
| 101 | 109 | |
| 102 | 110 | $path = $this->getPath(); |
| 103 | - if(!isset($path) || strlen($path) < 1) |
|
| 104 | - return false; |
|
| 111 | + if(!isset($path) || strlen($path) < 1) {
|
|
| 112 | + return false; |
|
| 113 | + } |
|
| 105 | 114 | |
| 106 | 115 | return true; |
| 107 | 116 | } |
@@ -34,6 +34,9 @@ |
||
| 34 | 34 | return false; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param string $key |
|
| 39 | + */ |
|
| 37 | 40 | static function getGet($key = null) |
| 38 | 41 | {
|
| 39 | 42 | if($key) |
@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | if($key) |
| 22 | 22 | { |
| 23 | - if(isset(self::$server[$key])) |
|
| 24 | - return self::$server[$key]; |
|
| 23 | + if(isset(self::$server[$key])) {
|
|
| 24 | + return self::$server[$key]; |
|
| 25 | + } |
|
| 25 | 26 | return false; |
| 26 | 27 | } |
| 27 | 28 | return self::$server; |
@@ -29,8 +30,9 @@ discard block |
||
| 29 | 30 | |
| 30 | 31 | static function isAjax() |
| 31 | 32 | { |
| 32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
| 33 | - return true; |
|
| 33 | + if(self::getServer(self::$AJAX_REQUEST)) {
|
|
| 34 | + return true; |
|
| 35 | + } |
|
| 34 | 36 | return false; |
| 35 | 37 | } |
| 36 | 38 | |
@@ -38,8 +40,9 @@ discard block |
||
| 38 | 40 | { |
| 39 | 41 | if($key) |
| 40 | 42 | { |
| 41 | - if(isset(self::$get[$key])) |
|
| 42 | - return self::$get[$key]; |
|
| 43 | + if(isset(self::$get[$key])) {
|
|
| 44 | + return self::$get[$key]; |
|
| 45 | + } |
|
| 43 | 46 | return false; |
| 44 | 47 | } |
| 45 | 48 | return self::$get; |
@@ -49,8 +52,9 @@ discard block |
||
| 49 | 52 | { |
| 50 | 53 | if($key) |
| 51 | 54 | { |
| 52 | - if(isset(self::$post[$key])) |
|
| 53 | - return self::$post[$key]; |
|
| 55 | + if(isset(self::$post[$key])) {
|
|
| 56 | + return self::$post[$key]; |
|
| 57 | + } |
|
| 54 | 58 | return false; |
| 55 | 59 | } |
| 56 | 60 | return self::$post; |