@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function _loadFromDB() |
51 | 51 | { |
52 | - if(!$this->comment_srl) |
|
52 | + if (!$this->comment_srl) |
|
53 | 53 | { |
54 | 54 | return; |
55 | 55 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function setAttribute($attribute) |
69 | 69 | { |
70 | - if(!$attribute->comment_srl) |
|
70 | + if (!$attribute->comment_srl) |
|
71 | 71 | { |
72 | 72 | $this->comment_srl = NULL; |
73 | 73 | return; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $this->adds($attribute); |
78 | 78 | |
79 | 79 | // define vars on the object for backward compatibility of skins |
80 | - if(count($attribute)) |
|
80 | + if (count($attribute)) |
|
81 | 81 | { |
82 | - foreach($attribute as $key => $val) |
|
82 | + foreach ($attribute as $key => $val) |
|
83 | 83 | { |
84 | 84 | $this->{$key} = $val; |
85 | 85 | } |
@@ -93,29 +93,29 @@ discard block |
||
93 | 93 | |
94 | 94 | function isGranted() |
95 | 95 | { |
96 | - if($_SESSION['own_comment'][$this->comment_srl]) |
|
96 | + if ($_SESSION['own_comment'][$this->comment_srl]) |
|
97 | 97 | { |
98 | 98 | return TRUE; |
99 | 99 | } |
100 | 100 | |
101 | - if(!Context::get('is_logged')) |
|
101 | + if (!Context::get('is_logged')) |
|
102 | 102 | { |
103 | 103 | return FALSE; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $logged_info = Context::get('logged_info'); |
107 | - if($logged_info->is_admin == 'Y') |
|
107 | + if ($logged_info->is_admin == 'Y') |
|
108 | 108 | { |
109 | 109 | return TRUE; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $grant = Context::get('grant'); |
113 | - if($grant->manager) |
|
113 | + if ($grant->manager) |
|
114 | 114 | { |
115 | 115 | return TRUE; |
116 | 116 | } |
117 | 117 | |
118 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
118 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
119 | 119 | { |
120 | 120 | return TRUE; |
121 | 121 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | function isEditable() |
138 | 138 | { |
139 | - if($this->isGranted() || !$this->get('member_srl')) |
|
139 | + if ($this->isGranted() || !$this->get('member_srl')) |
|
140 | 140 | { |
141 | 141 | return TRUE; |
142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | |
151 | 151 | function isAccessible() |
152 | 152 | { |
153 | - if($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
153 | + if ($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
154 | 154 | { |
155 | 155 | return TRUE; |
156 | 156 | } |
157 | 157 | |
158 | - if($this->isGranted() || !$this->isSecret()) |
|
158 | + if ($this->isGranted() || !$this->isSecret()) |
|
159 | 159 | { |
160 | 160 | $this->setAccessible(); |
161 | 161 | return TRUE; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $oDocumentModel = getModel('document'); |
165 | 165 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
166 | - if($oDocument->isGranted()) |
|
166 | + if ($oDocument->isGranted()) |
|
167 | 167 | { |
168 | 168 | $this->setAccessible(); |
169 | 169 | return TRUE; |
@@ -184,20 +184,20 @@ discard block |
||
184 | 184 | function notify($type, $content) |
185 | 185 | { |
186 | 186 | // return if not useNotify |
187 | - if(!$this->useNotify()) |
|
187 | + if (!$this->useNotify()) |
|
188 | 188 | { |
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | 192 | // pass if the author is not logged-in user |
193 | - if(!$this->get('member_srl')) |
|
193 | + if (!$this->get('member_srl')) |
|
194 | 194 | { |
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // return if the currently logged-in user is an author of the comment. |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if($logged_info->member_srl == $this->get('member_srl')) |
|
200 | + if ($logged_info->member_srl == $this->get('member_srl')) |
|
201 | 201 | { |
202 | 202 | return; |
203 | 203 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
208 | 208 | |
209 | 209 | // Variables |
210 | - if($type) |
|
210 | + if ($type) |
|
211 | 211 | { |
212 | - $title = "[" . $type . "] "; |
|
212 | + $title = "[".$type."] "; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $title .= cut_str(strip_tags($content), 30, '...'); |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | |
225 | 225 | function getIpAddress() |
226 | 226 | { |
227 | - if($this->isGranted()) |
|
227 | + if ($this->isGranted()) |
|
228 | 228 | { |
229 | 229 | return $this->get('ipaddress'); |
230 | 230 | } |
231 | 231 | |
232 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
232 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | function isExistsHomepage() |
236 | 236 | { |
237 | - if(trim($this->get('homepage'))) |
|
237 | + if (trim($this->get('homepage'))) |
|
238 | 238 | { |
239 | 239 | return TRUE; |
240 | 240 | } |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | function getHomepageUrl() |
246 | 246 | { |
247 | 247 | $url = trim($this->get('homepage')); |
248 | - if(!$url) |
|
248 | + if (!$url) |
|
249 | 249 | { |
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | - if(strncasecmp('http://', $url, 7) !== 0) |
|
253 | + if (strncasecmp('http://', $url, 7) !== 0) |
|
254 | 254 | { |
255 | - $url = "http://" . $url; |
|
255 | + $url = "http://".$url; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function getContentText($strlen = 0) |
286 | 286 | { |
287 | - if($this->isSecret() && !$this->isAccessible()) |
|
287 | + if ($this->isSecret() && !$this->isAccessible()) |
|
288 | 288 | { |
289 | 289 | return Context::getLang('msg_is_secret'); |
290 | 290 | } |
291 | 291 | |
292 | 292 | $content = $this->get('content'); |
293 | 293 | |
294 | - if($strlen) |
|
294 | + if ($strlen) |
|
295 | 295 | { |
296 | 296 | return cut_str(strip_tags($content), $strlen, '...'); |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE) |
307 | 307 | { |
308 | - if($this->isSecret() && !$this->isAccessible()) |
|
308 | + if ($this->isSecret() && !$this->isAccessible()) |
|
309 | 309 | { |
310 | 310 | return Context::getLang('msg_is_secret'); |
311 | 311 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | stripEmbedTagForAdmin($content, $this->get('member_srl')); |
315 | 315 | |
316 | 316 | // when displaying the comment on the pop-up menu |
317 | - if($add_popup_menu && Context::get('is_logged')) |
|
317 | + if ($add_popup_menu && Context::get('is_logged')) |
|
318 | 318 | { |
319 | 319 | $content = sprintf( |
320 | 320 | '%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do') |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | // if additional information which can access contents is set |
325 | - if($add_content_info) |
|
325 | + if ($add_content_info) |
|
326 | 326 | { |
327 | 327 | $memberSrl = $this->get('member_srl'); |
328 | - if($memberSrl < 0) |
|
328 | + if ($memberSrl < 0) |
|
329 | 329 | { |
330 | 330 | $memberSrl = 0; |
331 | 331 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | else |
338 | 338 | { |
339 | - if($add_xe_content_class) |
|
339 | + if ($add_xe_content_class) |
|
340 | 340 | { |
341 | 341 | $content = sprintf('<div class="xe_content">%s</div>', $content); |
342 | 342 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | function getRegdateGM() |
398 | 398 | { |
399 | - return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone']; |
|
399 | + return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone']; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | function getPermanentUrl() |
408 | 408 | { |
409 | - return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl'); |
|
409 | + return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl'); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | function getUpdateTime() |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | function hasUploadedFiles() |
429 | 429 | { |
430 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
430 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
431 | 431 | { |
432 | 432 | return FALSE; |
433 | 433 | } |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | |
437 | 437 | function getUploadedFiles() |
438 | 438 | { |
439 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
439 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
440 | 440 | { |
441 | 441 | return; |
442 | 442 | } |
443 | 443 | |
444 | - if(!$this->get('uploaded_count')) |
|
444 | + if (!$this->get('uploaded_count')) |
|
445 | 445 | { |
446 | 446 | return; |
447 | 447 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | function getEditor() |
459 | 459 | { |
460 | 460 | $module_srl = $this->get('module_srl'); |
461 | - if(!$module_srl) |
|
461 | + if (!$module_srl) |
|
462 | 462 | { |
463 | 463 | $module_srl = Context::get('module_srl'); |
464 | 464 | } |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | */ |
473 | 473 | function getProfileImage() |
474 | 474 | { |
475 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
475 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
476 | 476 | { |
477 | 477 | return; |
478 | 478 | } |
479 | 479 | $oMemberModel = getModel('member'); |
480 | 480 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
481 | - if(!$profile_info) |
|
481 | + if (!$profile_info) |
|
482 | 482 | { |
483 | 483 | return; |
484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | function getSignature() |
494 | 494 | { |
495 | 495 | // pass if the posting not exists. |
496 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
496 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
497 | 497 | { |
498 | 498 | return; |
499 | 499 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
504 | 504 | |
505 | 505 | // check if max height of the signiture is specified on the member module |
506 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
506 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
507 | 507 | { |
508 | 508 | $oModuleModel = getModel('module'); |
509 | 509 | $member_config = $oModuleModel->getModuleConfig('member'); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
514 | 514 | |
515 | - if($max_signature_height) |
|
515 | + if ($max_signature_height) |
|
516 | 516 | { |
517 | 517 | $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
518 | 518 | } |
@@ -522,12 +522,12 @@ discard block |
||
522 | 522 | |
523 | 523 | function thumbnailExists($width = 80, $height = 0, $type = '') |
524 | 524 | { |
525 | - if(!$this->comment_srl) |
|
525 | + if (!$this->comment_srl) |
|
526 | 526 | { |
527 | 527 | return FALSE; |
528 | 528 | } |
529 | 529 | |
530 | - if(!$this->getThumbnail($width, $height, $type)) |
|
530 | + if (!$this->getThumbnail($width, $height, $type)) |
|
531 | 531 | { |
532 | 532 | return FALSE; |
533 | 533 | } |
@@ -538,42 +538,42 @@ discard block |
||
538 | 538 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
539 | 539 | { |
540 | 540 | // return false if no doc exists |
541 | - if(!$this->comment_srl) |
|
541 | + if (!$this->comment_srl) |
|
542 | 542 | { |
543 | 543 | return; |
544 | 544 | } |
545 | 545 | |
546 | - if($this->isSecret() && !$this->isGranted()) |
|
546 | + if ($this->isSecret() && !$this->isGranted()) |
|
547 | 547 | { |
548 | 548 | return; |
549 | 549 | } |
550 | 550 | |
551 | 551 | // If signiture height setting is omitted, create a square |
552 | - if(!$height) |
|
552 | + if (!$height) |
|
553 | 553 | { |
554 | 554 | $height = $width; |
555 | 555 | } |
556 | 556 | |
557 | 557 | $content = $this->get('content'); |
558 | - if(!$this->hasUploadedFiles()) |
|
558 | + if (!$this->hasUploadedFiles()) |
|
559 | 559 | { |
560 | - if(!$content) |
|
560 | + if (!$content) |
|
561 | 561 | { |
562 | 562 | $args = new stdClass(); |
563 | 563 | $args->comment_srl = $this->comment_srl; |
564 | 564 | $output = executeQuery('document.getComment', $args, array('content')); |
565 | - if($output->toBool() && $output->data) |
|
565 | + if ($output->toBool() && $output->data) |
|
566 | 566 | { |
567 | 567 | $content = $output->data->content; |
568 | 568 | $this->add('content', $content); |
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | - if(!preg_match("!<img!is", $content)) return; |
|
572 | + if (!preg_match("!<img!is", $content)) return; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | // get thumbail generation info on the doc module configuration. |
576 | - if(!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
576 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
577 | 577 | { |
578 | 578 | $thumbnail_type = 'crop'; |
579 | 579 | } |
@@ -582,12 +582,12 @@ discard block |
||
582 | 582 | $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3)); |
583 | 583 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
584 | 584 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
585 | - $thumbnail_url = Context::getRequestUri() . $thumbnail_file; |
|
585 | + $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
|
586 | 586 | |
587 | 587 | // return false if a size of existing thumbnail file is 0. otherwise return the file path |
588 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
588 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
589 | 589 | { |
590 | - if(filesize($thumbnail_file) < 1) |
|
590 | + if (filesize($thumbnail_file) < 1) |
|
591 | 591 | { |
592 | 592 | return FALSE; |
593 | 593 | } |
@@ -605,33 +605,33 @@ discard block |
||
605 | 605 | $is_tmp_file = FALSE; |
606 | 606 | |
607 | 607 | // find an image file among attached files |
608 | - if($this->hasUploadedFiles()) |
|
608 | + if ($this->hasUploadedFiles()) |
|
609 | 609 | { |
610 | 610 | $file_list = $this->getUploadedFiles(); |
611 | 611 | |
612 | 612 | $first_image = null; |
613 | - foreach($file_list as $file) |
|
613 | + foreach ($file_list as $file) |
|
614 | 614 | { |
615 | - if($file->direct_download !== 'Y') continue; |
|
615 | + if ($file->direct_download !== 'Y') continue; |
|
616 | 616 | |
617 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
617 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
618 | 618 | { |
619 | 619 | $source_file = $file->uploaded_filename; |
620 | 620 | break; |
621 | 621 | } |
622 | 622 | |
623 | - if($first_image) continue; |
|
623 | + if ($first_image) continue; |
|
624 | 624 | |
625 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
625 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
626 | 626 | { |
627 | - if(file_exists($file->uploaded_filename)) |
|
627 | + if (file_exists($file->uploaded_filename)) |
|
628 | 628 | { |
629 | 629 | $first_image = $file->uploaded_filename; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
633 | 633 | |
634 | - if(!$source_file && $first_image) |
|
634 | + if (!$source_file && $first_image) |
|
635 | 635 | { |
636 | 636 | $source_file = $first_image; |
637 | 637 | } |
@@ -639,31 +639,31 @@ discard block |
||
639 | 639 | |
640 | 640 | // get an image file from the doc content if no file attached. |
641 | 641 | $is_tmp_file = false; |
642 | - if(!$source_file) |
|
642 | + if (!$source_file) |
|
643 | 643 | { |
644 | 644 | $random = new Password(); |
645 | 645 | |
646 | 646 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
647 | 647 | |
648 | - foreach($matches as $target_image) |
|
648 | + foreach ($matches as $target_image) |
|
649 | 649 | { |
650 | 650 | $target_src = trim($target_image[1]); |
651 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
651 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
652 | 652 | |
653 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
653 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
654 | 654 | { |
655 | 655 | $target_src = Context::getRequestUri().$target_src; |
656 | 656 | } |
657 | 657 | |
658 | 658 | $target_src = htmlspecialchars_decode($target_src); |
659 | 659 | |
660 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
660 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
661 | 661 | FileHandler::getRemoteFile($target_src, $tmp_file); |
662 | - if(!file_exists($tmp_file)) continue; |
|
662 | + if (!file_exists($tmp_file)) continue; |
|
663 | 663 | |
664 | 664 | $imageinfo = getimagesize($tmp_file); |
665 | 665 | list($_w, $_h) = $imageinfo; |
666 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
666 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
667 | 667 | FileHandler::removeFile($tmp_file); |
668 | 668 | continue; |
669 | 669 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
678 | 678 | |
679 | 679 | // Remove source file if it was temporary |
680 | - if($is_tmp_file) |
|
680 | + if ($is_tmp_file) |
|
681 | 681 | { |
682 | 682 | FileHandler::removeFile($source_file); |
683 | 683 | } |
@@ -686,14 +686,14 @@ discard block |
||
686 | 686 | FileHandler::removeFile($thumbnail_lockfile); |
687 | 687 | |
688 | 688 | // Return the thumbnail path if it was successfully generated |
689 | - if($output) |
|
689 | + if ($output) |
|
690 | 690 | { |
691 | 691 | return $thumbnail_url; |
692 | 692 | } |
693 | 693 | // Create an empty file if thumbnail generation failed |
694 | 694 | else |
695 | 695 | { |
696 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
696 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | function _loadFromDB($load_extra_vars = true) |
81 | 81 | { |
82 | - if(!$this->document_srl) return; |
|
82 | + if (!$this->document_srl) return; |
|
83 | 83 | |
84 | 84 | $document_item = false; |
85 | 85 | $cache_put = false; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | // cache controll |
90 | 90 | $oCacheHandler = CacheHandler::getInstance('object'); |
91 | - if($oCacheHandler->isSupport()) |
|
91 | + if ($oCacheHandler->isSupport()) |
|
92 | 92 | { |
93 | - $cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl; |
|
93 | + $cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl; |
|
94 | 94 | $document_item = $oCacheHandler->get($cache_key); |
95 | - if($document_item !== false) |
|
95 | + if ($document_item !== false) |
|
96 | 96 | { |
97 | 97 | $columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count'); |
98 | 98 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $args->document_srl = $this->document_srl; |
103 | 103 | $output = executeQuery('document.getDocument', $args, $columnList); |
104 | 104 | |
105 | - if($document_item === false) |
|
105 | + if ($document_item === false) |
|
106 | 106 | { |
107 | 107 | $document_item = $output->data; |
108 | 108 | |
109 | 109 | //insert in cache |
110 | - if($document_item && $oCacheHandler->isSupport()) |
|
110 | + if ($document_item && $oCacheHandler->isSupport()) |
|
111 | 111 | { |
112 | 112 | $oCacheHandler->put($cache_key, $document_item); |
113 | 113 | } |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | $this->setAttribute($document_item, $load_extra_vars); |
125 | 125 | } |
126 | 126 | |
127 | - function setAttribute($attribute, $load_extra_vars=true) |
|
127 | + function setAttribute($attribute, $load_extra_vars = true) |
|
128 | 128 | { |
129 | - if(!$attribute->document_srl) |
|
129 | + if (!$attribute->document_srl) |
|
130 | 130 | { |
131 | 131 | $this->document_srl = null; |
132 | 132 | return; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $this->adds($attribute); |
137 | 137 | |
138 | 138 | // Tags |
139 | - if($this->get('tags')) |
|
139 | + if ($this->get('tags')) |
|
140 | 140 | { |
141 | 141 | $tag_list = explode(',', $this->get('tags')); |
142 | 142 | $tag_list = array_map('trim', $tag_list); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | $oDocumentModel = getModel('document'); |
147 | - if($load_extra_vars) |
|
147 | + if ($load_extra_vars) |
|
148 | 148 | { |
149 | 149 | $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this; |
150 | 150 | $oDocumentModel->setToAllDocumentExtraVars(); |
@@ -159,23 +159,23 @@ discard block |
||
159 | 159 | |
160 | 160 | function isGranted() |
161 | 161 | { |
162 | - if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true; |
|
162 | + if ($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true; |
|
163 | 163 | |
164 | - if($this->grant_cache !== null) |
|
164 | + if ($this->grant_cache !== null) |
|
165 | 165 | { |
166 | 166 | return $this->grant_cache; |
167 | 167 | } |
168 | 168 | |
169 | - if(!Context::get('is_logged')) return $this->grant_cache = false; |
|
169 | + if (!Context::get('is_logged')) return $this->grant_cache = false; |
|
170 | 170 | |
171 | 171 | $logged_info = Context::get('logged_info'); |
172 | - if($logged_info->is_admin == 'Y') return $this->grant_cache = true; |
|
172 | + if ($logged_info->is_admin == 'Y') return $this->grant_cache = true; |
|
173 | 173 | |
174 | 174 | $oModuleModel = getModel('module'); |
175 | 175 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info); |
176 | - if($grant->manager) return $this->grant_cache = true; |
|
176 | + if ($grant->manager) return $this->grant_cache = true; |
|
177 | 177 | |
178 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return $this->grant_cache = true; |
|
178 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return $this->grant_cache = true; |
|
179 | 179 | |
180 | 180 | return $this->grant_cache = false; |
181 | 181 | } |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | |
189 | 189 | function isAccessible() |
190 | 190 | { |
191 | - return $_SESSION['accessible'][$this->document_srl]==true?true:false; |
|
191 | + return $_SESSION['accessible'][$this->document_srl] == true ?true:false; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | function allowComment() |
195 | 195 | { |
196 | 196 | // init write, document is not exists. so allow comment status is true |
197 | - if(!$this->isExists()) return true; |
|
197 | + if (!$this->isExists()) return true; |
|
198 | 198 | |
199 | 199 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
200 | 200 | } |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | function allowTrackback() |
203 | 203 | { |
204 | 204 | static $allow_trackback_status = null; |
205 | - if(is_null($allow_trackback_status)) |
|
205 | + if (is_null($allow_trackback_status)) |
|
206 | 206 | { |
207 | 207 | |
208 | 208 | // Check the tarckback module exist |
209 | - if(!getClass('trackback')) |
|
209 | + if (!getClass('trackback')) |
|
210 | 210 | { |
211 | 211 | $allow_trackback_status = false; |
212 | 212 | } |
@@ -216,20 +216,20 @@ discard block |
||
216 | 216 | $oModuleModel = getModel('module'); |
217 | 217 | $trackback_config = $oModuleModel->getModuleConfig('trackback'); |
218 | 218 | |
219 | - if(!$trackback_config) |
|
219 | + if (!$trackback_config) |
|
220 | 220 | { |
221 | 221 | $trackback_config = new stdClass(); |
222 | 222 | } |
223 | 223 | |
224 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
225 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
224 | + if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
225 | + if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
226 | 226 | else |
227 | 227 | { |
228 | 228 | $module_srl = $this->get('module_srl'); |
229 | 229 | // Check settings of each module |
230 | 230 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
231 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
232 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
231 | + if ($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
232 | + else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | } |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | |
239 | 239 | function isLocked() |
240 | 240 | { |
241 | - if(!$this->isExists()) return false; |
|
241 | + if (!$this->isExists()) return false; |
|
242 | 242 | |
243 | 243 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
244 | 244 | } |
245 | 245 | |
246 | 246 | function isEditable() |
247 | 247 | { |
248 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
248 | + if ($this->isGranted() || !$this->get('member_srl')) return true; |
|
249 | 249 | return false; |
250 | 250 | } |
251 | 251 | |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | function useNotify() |
264 | 264 | { |
265 | - return $this->get('notify_message')=='Y' ? true : false; |
|
265 | + return $this->get('notify_message') == 'Y' ? true : false; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | function doCart() |
269 | 269 | { |
270 | - if(!$this->document_srl) return false; |
|
271 | - if($this->isCarted()) $this->removeCart(); |
|
270 | + if (!$this->document_srl) return false; |
|
271 | + if ($this->isCarted()) $this->removeCart(); |
|
272 | 272 | else $this->addCart(); |
273 | 273 | } |
274 | 274 | |
@@ -295,18 +295,18 @@ discard block |
||
295 | 295 | */ |
296 | 296 | function notify($type, $content) |
297 | 297 | { |
298 | - if(!$this->document_srl) return; |
|
298 | + if (!$this->document_srl) return; |
|
299 | 299 | // return if it is not useNotify |
300 | - if(!$this->useNotify()) return; |
|
300 | + if (!$this->useNotify()) return; |
|
301 | 301 | // Pass if an author is not a logged-in user |
302 | - if(!$this->get('member_srl')) return; |
|
302 | + if (!$this->get('member_srl')) return; |
|
303 | 303 | // Return if the currently logged-in user is an author |
304 | 304 | $logged_info = Context::get('logged_info'); |
305 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
305 | + if ($logged_info->member_srl == $this->get('member_srl')) return; |
|
306 | 306 | // List variables |
307 | - if($type) $title = "[".$type."] "; |
|
307 | + if ($type) $title = "[".$type."] "; |
|
308 | 308 | $title .= cut_str(strip_tags($content), 10, '...'); |
309 | - $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
|
309 | + $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl)); |
|
310 | 310 | $receiver_srl = $this->get('member_srl'); |
311 | 311 | $sender_member_srl = $logged_info->member_srl; |
312 | 312 | // Send a message |
@@ -321,26 +321,26 @@ discard block |
||
321 | 321 | |
322 | 322 | function getIpAddress() |
323 | 323 | { |
324 | - if($this->isGranted()) |
|
324 | + if ($this->isGranted()) |
|
325 | 325 | { |
326 | 326 | return $this->get('ipaddress'); |
327 | 327 | } |
328 | 328 | |
329 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
329 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | function isExistsHomepage() |
333 | 333 | { |
334 | - if(trim($this->get('homepage'))) return true; |
|
334 | + if (trim($this->get('homepage'))) return true; |
|
335 | 335 | return false; |
336 | 336 | } |
337 | 337 | |
338 | 338 | function getHomepageUrl() |
339 | 339 | { |
340 | 340 | $url = trim($this->get('homepage')); |
341 | - if(!$url) return; |
|
341 | + if (!$url) return; |
|
342 | 342 | |
343 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
343 | + if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://'.$url; |
|
344 | 344 | |
345 | 345 | return $url; |
346 | 346 | } |
@@ -370,52 +370,52 @@ discard block |
||
370 | 370 | return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
371 | 371 | } |
372 | 372 | |
373 | - function getTitleText($cut_size = 0, $tail='...') |
|
373 | + function getTitleText($cut_size = 0, $tail = '...') |
|
374 | 374 | { |
375 | - if(!$this->document_srl) return; |
|
375 | + if (!$this->document_srl) return; |
|
376 | 376 | |
377 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
377 | + if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
378 | 378 | else $title = $this->get('title'); |
379 | 379 | |
380 | 380 | return $title; |
381 | 381 | } |
382 | 382 | |
383 | - function getTitle($cut_size = 0, $tail='...') |
|
383 | + function getTitle($cut_size = 0, $tail = '...') |
|
384 | 384 | { |
385 | - if(!$this->document_srl) return; |
|
385 | + if (!$this->document_srl) return; |
|
386 | 386 | |
387 | 387 | $title = $this->getTitleText($cut_size, $tail); |
388 | 388 | |
389 | 389 | $attrs = array(); |
390 | 390 | $this->add('title_color', trim($this->get('title_color'))); |
391 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
392 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
391 | + if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;"; |
|
392 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
393 | 393 | |
394 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
394 | + if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
395 | 395 | else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
396 | 396 | } |
397 | 397 | |
398 | 398 | function getContentText($strlen = 0) |
399 | 399 | { |
400 | - if(!$this->document_srl) return; |
|
400 | + if (!$this->document_srl) return; |
|
401 | 401 | |
402 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
402 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
403 | 403 | |
404 | 404 | $result = $this->_checkAccessibleFromStatus(); |
405 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
405 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
406 | 406 | |
407 | 407 | $content = $this->get('content'); |
408 | 408 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
409 | 409 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
410 | 410 | |
411 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
411 | + if ($strlen) return cut_str(strip_tags($content), $strlen, '...'); |
|
412 | 412 | |
413 | 413 | return htmlspecialchars($content); |
414 | 414 | } |
415 | 415 | |
416 | 416 | function _addAllowScriptAccess($m) |
417 | 417 | { |
418 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
418 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
419 | 419 | { |
420 | 420 | $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
421 | 421 | } |
@@ -425,26 +425,26 @@ discard block |
||
425 | 425 | |
426 | 426 | function _checkAllowScriptAccess($m) |
427 | 427 | { |
428 | - if($m[1] == 'object') |
|
428 | + if ($m[1] == 'object') |
|
429 | 429 | { |
430 | 430 | $this->allowscriptaccessList[] = 1; |
431 | 431 | } |
432 | 432 | |
433 | - if($m[1] == 'param') |
|
433 | + if ($m[1] == 'param') |
|
434 | 434 | { |
435 | - if(stripos($m[0], 'allowscriptaccess')) |
|
435 | + if (stripos($m[0], 'allowscriptaccess')) |
|
436 | 436 | { |
437 | 437 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
438 | - if(substr($m[0], -1) == '/') |
|
438 | + if (substr($m[0], -1) == '/') |
|
439 | 439 | { |
440 | 440 | $m[0] .= '/'; |
441 | 441 | } |
442 | - $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
|
442 | + $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
|
443 | 443 | } |
444 | 444 | } |
445 | - else if($m[1] == 'embed') |
|
445 | + else if ($m[1] == 'embed') |
|
446 | 446 | { |
447 | - if(stripos($m[0], 'allowscriptaccess')) |
|
447 | + if (stripos($m[0], 'allowscriptaccess')) |
|
448 | 448 | { |
449 | 449 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
450 | 450 | } |
@@ -458,24 +458,24 @@ discard block |
||
458 | 458 | |
459 | 459 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
460 | 460 | { |
461 | - if(!$this->document_srl) return; |
|
461 | + if (!$this->document_srl) return; |
|
462 | 462 | |
463 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
463 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
464 | 464 | |
465 | 465 | $result = $this->_checkAccessibleFromStatus(); |
466 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
466 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
467 | 467 | |
468 | 468 | $content = $this->get('content'); |
469 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
469 | + if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
470 | 470 | |
471 | 471 | // Define a link if using a rewrite module |
472 | 472 | $oContext = &Context::getInstance(); |
473 | - if($oContext->allow_rewrite) |
|
473 | + if ($oContext->allow_rewrite) |
|
474 | 474 | { |
475 | - $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content); |
|
475 | + $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content); |
|
476 | 476 | } |
477 | 477 | // To display a pop-up menu |
478 | - if($add_popup_menu) |
|
478 | + if ($add_popup_menu) |
|
479 | 479 | { |
480 | 480 | $content = sprintf( |
481 | 481 | '%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>', |
@@ -484,10 +484,10 @@ discard block |
||
484 | 484 | ); |
485 | 485 | } |
486 | 486 | // If additional content information is set |
487 | - if($add_content_info) |
|
487 | + if ($add_content_info) |
|
488 | 488 | { |
489 | 489 | $memberSrl = $this->get('member_srl'); |
490 | - if($memberSrl < 0) |
|
490 | + if ($memberSrl < 0) |
|
491 | 491 | { |
492 | 492 | $memberSrl = 0; |
493 | 493 | } |
@@ -503,12 +503,12 @@ discard block |
||
503 | 503 | } |
504 | 504 | else |
505 | 505 | { |
506 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
506 | + if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
507 | 507 | } |
508 | 508 | // Change the image path to a valid absolute path if resource_realpath is true |
509 | - if($resource_realpath) |
|
509 | + if ($resource_realpath) |
|
510 | 510 | { |
511 | - $content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content); |
|
511 | + $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | return $content; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $content = trim(cut_str($content, $str_size, $tail)); |
558 | 558 | |
559 | 559 | // Replace back < , <, " |
560 | - $content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content); |
|
560 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
561 | 561 | |
562 | 562 | return $content; |
563 | 563 | } |
@@ -570,13 +570,13 @@ discard block |
||
570 | 570 | function getRegdateTime() |
571 | 571 | { |
572 | 572 | $regdate = $this->get('regdate'); |
573 | - $year = substr($regdate,0,4); |
|
574 | - $month = substr($regdate,4,2); |
|
575 | - $day = substr($regdate,6,2); |
|
576 | - $hour = substr($regdate,8,2); |
|
577 | - $min = substr($regdate,10,2); |
|
578 | - $sec = substr($regdate,12,2); |
|
579 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
573 | + $year = substr($regdate, 0, 4); |
|
574 | + $month = substr($regdate, 4, 2); |
|
575 | + $day = substr($regdate, 6, 2); |
|
576 | + $hour = substr($regdate, 8, 2); |
|
577 | + $min = substr($regdate, 10, 2); |
|
578 | + $sec = substr($regdate, 12, 2); |
|
579 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | function getRegdateGM() |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | |
587 | 587 | function getRegdateDT() |
588 | 588 | { |
589 | - return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
589 | + return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -596,13 +596,13 @@ discard block |
||
596 | 596 | |
597 | 597 | function getUpdateTime() |
598 | 598 | { |
599 | - $year = substr($this->get('last_update'),0,4); |
|
600 | - $month = substr($this->get('last_update'),4,2); |
|
601 | - $day = substr($this->get('last_update'),6,2); |
|
602 | - $hour = substr($this->get('last_update'),8,2); |
|
603 | - $min = substr($this->get('last_update'),10,2); |
|
604 | - $sec = substr($this->get('last_update'),12,2); |
|
605 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
599 | + $year = substr($this->get('last_update'), 0, 4); |
|
600 | + $month = substr($this->get('last_update'), 4, 2); |
|
601 | + $day = substr($this->get('last_update'), 6, 2); |
|
602 | + $hour = substr($this->get('last_update'), 8, 2); |
|
603 | + $min = substr($this->get('last_update'), 10, 2); |
|
604 | + $sec = substr($this->get('last_update'), 12, 2); |
|
605 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | function getUpdateGM() |
@@ -612,21 +612,21 @@ discard block |
||
612 | 612 | |
613 | 613 | function getUpdateDT() |
614 | 614 | { |
615 | - return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
615 | + return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | function getPermanentUrl() |
619 | 619 | { |
620 | - return getFullUrl('','mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl')); |
|
620 | + return getFullUrl('', 'mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl')); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | function getTrackbackUrl() |
624 | 624 | { |
625 | - if(!$this->document_srl) return; |
|
625 | + if (!$this->document_srl) return; |
|
626 | 626 | |
627 | 627 | // Generate a key to prevent spams |
628 | 628 | $oTrackbackModel = getModel('trackback'); |
629 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
629 | + if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | /** |
@@ -636,24 +636,24 @@ discard block |
||
636 | 636 | function updateReadedCount() |
637 | 637 | { |
638 | 638 | $oDocumentController = getController('document'); |
639 | - if($oDocumentController->updateReadedCount($this)) |
|
639 | + if ($oDocumentController->updateReadedCount($this)) |
|
640 | 640 | { |
641 | 641 | $readed_count = $this->get('readed_count'); |
642 | - $this->add('readed_count', $readed_count+1); |
|
642 | + $this->add('readed_count', $readed_count + 1); |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | |
646 | 646 | function isExtraVarsExists() |
647 | 647 | { |
648 | - if(!$this->get('module_srl')) return false; |
|
648 | + if (!$this->get('module_srl')) return false; |
|
649 | 649 | $oDocumentModel = getModel('document'); |
650 | 650 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
651 | - return count($extra_keys)?true:false; |
|
651 | + return count($extra_keys) ?true:false; |
|
652 | 652 | } |
653 | 653 | |
654 | 654 | function getExtraVars() |
655 | 655 | { |
656 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
656 | + if (!$this->get('module_srl') || !$this->document_srl) return null; |
|
657 | 657 | |
658 | 658 | $oDocumentModel = getModel('document'); |
659 | 659 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | function getExtraValue($idx) |
663 | 663 | { |
664 | 664 | $extra_vars = $this->getExtraVars(); |
665 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
665 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
666 | 666 | { |
667 | 667 | return $extra_vars[$idx]->getValue(); |
668 | 668 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | function getExtraValueHTML($idx) |
676 | 676 | { |
677 | 677 | $extra_vars = $this->getExtraVars(); |
678 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
678 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
679 | 679 | { |
680 | 680 | return $extra_vars[$idx]->getValueHTML(); |
681 | 681 | } |
@@ -689,16 +689,16 @@ discard block |
||
689 | 689 | { |
690 | 690 | $extra_vars = $this->getExtraVars(); |
691 | 691 | |
692 | - if($extra_vars) |
|
692 | + if ($extra_vars) |
|
693 | 693 | { |
694 | 694 | // Handle extra variable(eid) |
695 | - foreach($extra_vars as $idx => $key) |
|
695 | + foreach ($extra_vars as $idx => $key) |
|
696 | 696 | { |
697 | 697 | $extra_eid[$key->eid] = $key; |
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
701 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
701 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
702 | 702 | { |
703 | 703 | return $extra_eid[$eid]->getValue(); |
704 | 704 | } |
@@ -712,12 +712,12 @@ discard block |
||
712 | 712 | { |
713 | 713 | $extra_vars = $this->getExtraVars(); |
714 | 714 | // Handle extra variable(eid) |
715 | - foreach($extra_vars as $idx => $key) |
|
715 | + foreach ($extra_vars as $idx => $key) |
|
716 | 716 | { |
717 | 717 | $extra_eid[$key->eid] = $key; |
718 | 718 | } |
719 | 719 | |
720 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
720 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
721 | 721 | { |
722 | 722 | return $extra_eid[$eid]->getValueHTML(); |
723 | 723 | } |
@@ -741,13 +741,13 @@ discard block |
||
741 | 741 | |
742 | 742 | function getComments() |
743 | 743 | { |
744 | - if(!$this->getCommentCount()) return; |
|
745 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
744 | + if (!$this->getCommentCount()) return; |
|
745 | + if (!$this->isGranted() && $this->isSecret()) return; |
|
746 | 746 | // cpage is a number of comment pages |
747 | 747 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
748 | 748 | $cpage = Context::get($cpageStr); |
749 | 749 | |
750 | - if(!$cpage) |
|
750 | + if (!$cpage) |
|
751 | 751 | { |
752 | 752 | $cpage = Context::get('cpage'); |
753 | 753 | } |
@@ -755,19 +755,19 @@ discard block |
||
755 | 755 | // Get a list of comments |
756 | 756 | $oCommentModel = getModel('comment'); |
757 | 757 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
758 | - if(!$output->toBool() || !count($output->data)) return; |
|
758 | + if (!$output->toBool() || !count($output->data)) return; |
|
759 | 759 | // Create commentItem object from a comment list |
760 | 760 | // If admin priviledge is granted on parent posts, you can read its child posts. |
761 | 761 | $accessible = array(); |
762 | 762 | $comment_list = array(); |
763 | - foreach($output->data as $key => $val) |
|
763 | + foreach ($output->data as $key => $val) |
|
764 | 764 | { |
765 | 765 | $oCommentItem = new commentItem(); |
766 | 766 | $oCommentItem->setAttribute($val); |
767 | 767 | // If permission is granted to the post, you can access it temporarily |
768 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
768 | + if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
769 | 769 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
770 | - if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
|
770 | + if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) |
|
771 | 771 | { |
772 | 772 | $oCommentItem->setAccessible(); |
773 | 773 | } |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | // Variable setting to be displayed on the skin |
777 | 777 | Context::set($cpageStr, $output->page_navigation->cur_page); |
778 | 778 | Context::set('cpage', $output->page_navigation->cur_page); |
779 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
779 | + if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation; |
|
780 | 780 | |
781 | 781 | return $comment_list; |
782 | 782 | } |
@@ -788,9 +788,9 @@ discard block |
||
788 | 788 | |
789 | 789 | function getTrackbacks() |
790 | 790 | { |
791 | - if(!$this->document_srl) return; |
|
791 | + if (!$this->document_srl) return; |
|
792 | 792 | |
793 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
793 | + if (!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
794 | 794 | |
795 | 795 | $oTrackbackModel = getModel('trackback'); |
796 | 796 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -798,47 +798,47 @@ discard block |
||
798 | 798 | |
799 | 799 | function thumbnailExists($width = 80, $height = 0, $type = '') |
800 | 800 | { |
801 | - if(!$this->document_srl) return false; |
|
802 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
801 | + if (!$this->document_srl) return false; |
|
802 | + if (!$this->getThumbnail($width, $height, $type)) return false; |
|
803 | 803 | return true; |
804 | 804 | } |
805 | 805 | |
806 | 806 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
807 | 807 | { |
808 | 808 | // Return false if the document doesn't exist |
809 | - if(!$this->document_srl) return; |
|
809 | + if (!$this->document_srl) return; |
|
810 | 810 | |
811 | - if($this->isSecret() && !$this->isGranted()) |
|
811 | + if ($this->isSecret() && !$this->isGranted()) |
|
812 | 812 | { |
813 | 813 | return; |
814 | 814 | } |
815 | 815 | |
816 | 816 | // If not specify its height, create a square |
817 | - if(!$height) $height = $width; |
|
817 | + if (!$height) $height = $width; |
|
818 | 818 | |
819 | 819 | // Return false if neither attachement nor image files in the document |
820 | 820 | $content = $this->get('content'); |
821 | - if(!$this->get('uploaded_count')) |
|
821 | + if (!$this->get('uploaded_count')) |
|
822 | 822 | { |
823 | - if(!$content) |
|
823 | + if (!$content) |
|
824 | 824 | { |
825 | 825 | $args = new stdClass(); |
826 | 826 | $args->document_srl = $this->document_srl; |
827 | 827 | $output = executeQuery('document.getDocument', $args, array('content')); |
828 | - if($output->toBool() && $output->data) |
|
828 | + if ($output->toBool() && $output->data) |
|
829 | 829 | { |
830 | 830 | $content = $output->data->content; |
831 | 831 | $this->add('content', $content); |
832 | 832 | } |
833 | 833 | } |
834 | 834 | |
835 | - if(!preg_match("!<img!is", $content)) return; |
|
835 | + if (!preg_match("!<img!is", $content)) return; |
|
836 | 836 | } |
837 | 837 | // Get thumbnai_type information from document module's configuration |
838 | - if(!in_array($thumbnail_type, array('crop','ratio'))) |
|
838 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
839 | 839 | { |
840 | 840 | $config = $GLOBALS['__document_config__']; |
841 | - if(!$config) |
|
841 | + if (!$config) |
|
842 | 842 | { |
843 | 843 | $oDocumentModel = getModel('document'); |
844 | 844 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -848,15 +848,15 @@ discard block |
||
848 | 848 | } |
849 | 849 | |
850 | 850 | // Define thumbnail information |
851 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3)); |
|
851 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3)); |
|
852 | 852 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
853 | 853 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
854 | 854 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
855 | 855 | |
856 | 856 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
857 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
857 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
858 | 858 | { |
859 | - if(filesize($thumbnail_file) < 1) |
|
859 | + if (filesize($thumbnail_file) < 1) |
|
860 | 860 | { |
861 | 861 | return FALSE; |
862 | 862 | } |
@@ -874,64 +874,64 @@ discard block |
||
874 | 874 | $is_tmp_file = false; |
875 | 875 | |
876 | 876 | // Find an iamge file among attached files if exists |
877 | - if($this->hasUploadedFiles()) |
|
877 | + if ($this->hasUploadedFiles()) |
|
878 | 878 | { |
879 | 879 | $file_list = $this->getUploadedFiles(); |
880 | 880 | |
881 | 881 | $first_image = null; |
882 | - foreach($file_list as $file) |
|
882 | + foreach ($file_list as $file) |
|
883 | 883 | { |
884 | - if($file->direct_download !== 'Y') continue; |
|
884 | + if ($file->direct_download !== 'Y') continue; |
|
885 | 885 | |
886 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
886 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
887 | 887 | { |
888 | 888 | $source_file = $file->uploaded_filename; |
889 | 889 | break; |
890 | 890 | } |
891 | 891 | |
892 | - if($first_image) continue; |
|
892 | + if ($first_image) continue; |
|
893 | 893 | |
894 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
894 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
895 | 895 | { |
896 | - if(file_exists($file->uploaded_filename)) |
|
896 | + if (file_exists($file->uploaded_filename)) |
|
897 | 897 | { |
898 | 898 | $first_image = $file->uploaded_filename; |
899 | 899 | } |
900 | 900 | } |
901 | 901 | } |
902 | 902 | |
903 | - if(!$source_file && $first_image) |
|
903 | + if (!$source_file && $first_image) |
|
904 | 904 | { |
905 | 905 | $source_file = $first_image; |
906 | 906 | } |
907 | 907 | } |
908 | 908 | // If not exists, file an image file from the content |
909 | 909 | $is_tmp_file = false; |
910 | - if(!$source_file) |
|
910 | + if (!$source_file) |
|
911 | 911 | { |
912 | 912 | $random = new Password(); |
913 | 913 | |
914 | 914 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
915 | 915 | |
916 | - foreach($matches as $target_image) |
|
916 | + foreach ($matches as $target_image) |
|
917 | 917 | { |
918 | 918 | $target_src = trim($target_image[1]); |
919 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
919 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
920 | 920 | |
921 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
921 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
922 | 922 | { |
923 | 923 | $target_src = Context::getRequestUri().$target_src; |
924 | 924 | } |
925 | 925 | |
926 | 926 | $target_src = htmlspecialchars_decode($target_src); |
927 | 927 | |
928 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
928 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
929 | 929 | FileHandler::getRemoteFile($target_src, $tmp_file); |
930 | - if(!file_exists($tmp_file)) continue; |
|
930 | + if (!file_exists($tmp_file)) continue; |
|
931 | 931 | |
932 | 932 | $imageinfo = getimagesize($tmp_file); |
933 | 933 | list($_w, $_h) = $imageinfo; |
934 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
934 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
935 | 935 | FileHandler::removeFile($tmp_file); |
936 | 936 | continue; |
937 | 937 | } |
@@ -942,13 +942,13 @@ discard block |
||
942 | 942 | } |
943 | 943 | } |
944 | 944 | |
945 | - if($source_file) |
|
945 | + if ($source_file) |
|
946 | 946 | { |
947 | 947 | $output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
948 | 948 | } |
949 | 949 | |
950 | 950 | // Remove source file if it was temporary |
951 | - if($is_tmp_file) |
|
951 | + if ($is_tmp_file) |
|
952 | 952 | { |
953 | 953 | FileHandler::removeFile($source_file); |
954 | 954 | } |
@@ -957,14 +957,14 @@ discard block |
||
957 | 957 | FileHandler::removeFile($thumbnail_lockfile); |
958 | 958 | |
959 | 959 | // Return the thumbnail path if it was successfully generated |
960 | - if($output_file) |
|
960 | + if ($output_file) |
|
961 | 961 | { |
962 | 962 | return $thumbnail_url; |
963 | 963 | } |
964 | 964 | // Create an empty file if thumbnail generation failed |
965 | 965 | else |
966 | 966 | { |
967 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
967 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | return; |
@@ -978,21 +978,21 @@ discard block |
||
978 | 978 | */ |
979 | 979 | function getExtraImages($time_interval = 43200) |
980 | 980 | { |
981 | - if(!$this->document_srl) return; |
|
981 | + if (!$this->document_srl) return; |
|
982 | 982 | // variables for icon list |
983 | 983 | $buffs = array(); |
984 | 984 | |
985 | 985 | $check_files = false; |
986 | 986 | |
987 | 987 | // Check if secret post is |
988 | - if($this->isSecret()) $buffs[] = "secret"; |
|
988 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
989 | 989 | |
990 | 990 | // Set the latest time |
991 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
991 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
992 | 992 | |
993 | 993 | // Check new post |
994 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
995 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
994 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
995 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
996 | 996 | |
997 | 997 | /* |
998 | 998 | $content = $this->get('content'); |
@@ -1015,14 +1015,14 @@ discard block |
||
1015 | 1015 | */ |
1016 | 1016 | |
1017 | 1017 | // Check the attachment |
1018 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
1018 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
1019 | 1019 | |
1020 | 1020 | return $buffs; |
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | function getStatus() |
1024 | 1024 | { |
1025 | - if(!$this->get('status')) return $this->getDefaultStatus(); |
|
1025 | + if (!$this->get('status')) return $this->getDefaultStatus(); |
|
1026 | 1026 | return $this->get('status'); |
1027 | 1027 | } |
1028 | 1028 | |
@@ -1033,15 +1033,15 @@ discard block |
||
1033 | 1033 | */ |
1034 | 1034 | function printExtraImages($time_check = 43200) |
1035 | 1035 | { |
1036 | - if(!$this->document_srl) return; |
|
1036 | + if (!$this->document_srl) return; |
|
1037 | 1037 | // Get the icon directory |
1038 | - $path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); |
|
1038 | + $path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/'); |
|
1039 | 1039 | |
1040 | 1040 | $buffs = $this->getExtraImages($time_check); |
1041 | - if(!count($buffs)) return; |
|
1041 | + if (!count($buffs)) return; |
|
1042 | 1042 | |
1043 | 1043 | $buff = array(); |
1044 | - foreach($buffs as $key => $val) |
|
1044 | + foreach ($buffs as $key => $val) |
|
1045 | 1045 | { |
1046 | 1046 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
1047 | 1047 | } |
@@ -1050,20 +1050,20 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | function hasUploadedFiles() |
1052 | 1052 | { |
1053 | - if(!$this->document_srl) return; |
|
1053 | + if (!$this->document_srl) return; |
|
1054 | 1054 | |
1055 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
1056 | - return $this->get('uploaded_count')? true : false; |
|
1055 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
1056 | + return $this->get('uploaded_count') ? true : false; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | function getUploadedFiles($sortIndex = 'file_srl') |
1060 | 1060 | { |
1061 | - if(!$this->document_srl) return; |
|
1061 | + if (!$this->document_srl) return; |
|
1062 | 1062 | |
1063 | - if($this->isSecret() && !$this->isGranted()) return; |
|
1064 | - if(!$this->get('uploaded_count')) return; |
|
1063 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
1064 | + if (!$this->get('uploaded_count')) return; |
|
1065 | 1065 | |
1066 | - if(!$this->uploadedFiles[$sortIndex]) |
|
1066 | + if (!$this->uploadedFiles[$sortIndex]) |
|
1067 | 1067 | { |
1068 | 1068 | $oFileModel = getModel('file'); |
1069 | 1069 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | function getEditor() |
1080 | 1080 | { |
1081 | 1081 | $module_srl = $this->get('module_srl'); |
1082 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
1082 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
1083 | 1083 | |
1084 | 1084 | $oEditorModel = getModel('editor'); |
1085 | 1085 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | { |
1095 | 1095 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
1096 | 1096 | if (!$this->allowComment()) return false; |
1097 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
1097 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
1098 | 1098 | |
1099 | 1099 | return true; |
1100 | 1100 | } |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | */ |
1106 | 1106 | function getCommentEditor() |
1107 | 1107 | { |
1108 | - if(!$this->isEnableComment()) return; |
|
1108 | + if (!$this->isEnableComment()) return; |
|
1109 | 1109 | |
1110 | 1110 | $oEditorModel = getModel('editor'); |
1111 | 1111 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1117,10 +1117,10 @@ discard block |
||
1117 | 1117 | */ |
1118 | 1118 | function getProfileImage() |
1119 | 1119 | { |
1120 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
1120 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
1121 | 1121 | $oMemberModel = getModel('member'); |
1122 | 1122 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
1123 | - if(!$profile_info) return; |
|
1123 | + if (!$profile_info) return; |
|
1124 | 1124 | |
1125 | 1125 | return $profile_info->src; |
1126 | 1126 | } |
@@ -1132,21 +1132,21 @@ discard block |
||
1132 | 1132 | function getSignature() |
1133 | 1133 | { |
1134 | 1134 | // Pass if a document doesn't exist |
1135 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
1135 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
1136 | 1136 | // Get signature information |
1137 | 1137 | $oMemberModel = getModel('member'); |
1138 | 1138 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
1139 | 1139 | // Check if a maximum height of signiture is set in the member module |
1140 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
1140 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
1141 | 1141 | { |
1142 | 1142 | $oModuleModel = getModel('module'); |
1143 | 1143 | $member_config = $oModuleModel->getModuleConfig('member'); |
1144 | 1144 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
1145 | 1145 | } |
1146 | - if($signature) |
|
1146 | + if ($signature) |
|
1147 | 1147 | { |
1148 | 1148 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
1149 | - if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
1149 | + if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | return $signature; |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | function replaceResourceRealPath($matches) |
1161 | 1161 | { |
1162 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
1162 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | /** |
@@ -1170,19 +1170,19 @@ discard block |
||
1170 | 1170 | function _checkAccessibleFromStatus() |
1171 | 1171 | { |
1172 | 1172 | $logged_info = Context::get('logged_info'); |
1173 | - if($logged_info->is_admin == 'Y') return true; |
|
1173 | + if ($logged_info->is_admin == 'Y') return true; |
|
1174 | 1174 | |
1175 | 1175 | $status = $this->get('status'); |
1176 | - if(empty($status)) return false; |
|
1176 | + if (empty($status)) return false; |
|
1177 | 1177 | |
1178 | 1178 | $oDocumentModel = getModel('document'); |
1179 | 1179 | $configStatusList = $oDocumentModel->getStatusList(); |
1180 | 1180 | |
1181 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
1181 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
1182 | 1182 | return true; |
1183 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
1183 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
1184 | 1184 | { |
1185 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
1185 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
1186 | 1186 | return true; |
1187 | 1187 | } |
1188 | 1188 | return false; |
@@ -18,48 +18,48 @@ discard block |
||
18 | 18 | function proc($args) |
19 | 19 | { |
20 | 20 | // Targets to sort |
21 | - if(!in_array($args->order_target, array('regdate','update_order'))) $args->order_target = 'regdate'; |
|
21 | + if (!in_array($args->order_target, array('regdate', 'update_order'))) $args->order_target = 'regdate'; |
|
22 | 22 | // Sort order |
23 | - if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc'; |
|
23 | + if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc'; |
|
24 | 24 | // Pages |
25 | - $args->page_count = (int)$args->page_count; |
|
26 | - if(!$args->page_count) $args->page_count = 1; |
|
25 | + $args->page_count = (int) $args->page_count; |
|
26 | + if (!$args->page_count) $args->page_count = 1; |
|
27 | 27 | // The number of displayed lists |
28 | - $args->list_count = (int)$args->list_count; |
|
29 | - if(!$args->list_count) $args->list_count = 5; |
|
28 | + $args->list_count = (int) $args->list_count; |
|
29 | + if (!$args->list_count) $args->list_count = 5; |
|
30 | 30 | // The number of thumbnail columns |
31 | - $args->cols_list_count = (int)$args->cols_list_count; |
|
32 | - if(!$args->cols_list_count) $args->cols_list_count = 5; |
|
31 | + $args->cols_list_count = (int) $args->cols_list_count; |
|
32 | + if (!$args->cols_list_count) $args->cols_list_count = 5; |
|
33 | 33 | // Cut the length of the title |
34 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
34 | + if (!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
35 | 35 | // Cut the length of contents |
36 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
36 | + if (!$args->content_cut_size) $args->content_cut_size = 100; |
|
37 | 37 | // Cut the length of nickname |
38 | - if(!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
38 | + if (!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
39 | 39 | // Display time of the latest post |
40 | - if(!$args->duration_new) $args->duration_new = 12; |
|
40 | + if (!$args->duration_new) $args->duration_new = 12; |
|
41 | 41 | // How to create thumbnails |
42 | - if(!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
42 | + if (!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
43 | 43 | // Horizontal size of thumbnails |
44 | - if(!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
44 | + if (!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
45 | 45 | // Vertical size of thumbnails |
46 | - if(!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
46 | + if (!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
47 | 47 | // Viewing options |
48 | - $args->option_view_arr = explode(',',$args->option_view); |
|
48 | + $args->option_view_arr = explode(',', $args->option_view); |
|
49 | 49 | // markup options |
50 | - if(!$args->markup_type) $args->markup_type = 'table'; |
|
50 | + if (!$args->markup_type) $args->markup_type = 'table'; |
|
51 | 51 | // Set variables used internally |
52 | 52 | $oModuleModel = getModel('module'); |
53 | 53 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
54 | 54 | $site_module_info = Context::get('site_module_info'); |
55 | 55 | // List URLs if a type is RSS |
56 | - if($args->content_type == 'rss') |
|
56 | + if ($args->content_type == 'rss') |
|
57 | 57 | { |
58 | 58 | $args->rss_urls = array(); |
59 | - $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
|
60 | - for($i=0,$c=count($rss_urls);$i<$c;$i++) |
|
59 | + $rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4)); |
|
60 | + for ($i = 0, $c = count($rss_urls); $i < $c; $i++) |
|
61 | 61 | { |
62 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
62 | + if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
63 | 63 | } |
64 | 64 | // Get module information after listing module_srls if the module is not RSS |
65 | 65 | } |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | { |
68 | 68 | $obj = new stdClass(); |
69 | 69 | // Apply to all modules in the site if a target module is not specified |
70 | - if(!$args->module_srls) |
|
70 | + if (!$args->module_srls) |
|
71 | 71 | { |
72 | - $obj->site_srl = (int)$site_module_info->site_srl; |
|
72 | + $obj->site_srl = (int) $site_module_info->site_srl; |
|
73 | 73 | $output = executeQueryArray('widgets.content.getMids', $obj); |
74 | - if($output->data) |
|
74 | + if ($output->data) |
|
75 | 75 | { |
76 | - foreach($output->data as $key => $val) |
|
76 | + foreach ($output->data as $key => $val) |
|
77 | 77 | { |
78 | 78 | $args->modules_info[$val->mid] = $val; |
79 | 79 | $args->module_srls_info[$val->module_srl] = $val; |
@@ -89,35 +89,35 @@ discard block |
||
89 | 89 | { |
90 | 90 | $obj->module_srls = $args->module_srls; |
91 | 91 | $output = executeQueryArray('widgets.content.getMids', $obj); |
92 | - if($output->data) |
|
92 | + if ($output->data) |
|
93 | 93 | { |
94 | - foreach($output->data as $key => $val) |
|
94 | + foreach ($output->data as $key => $val) |
|
95 | 95 | { |
96 | 96 | $args->modules_info[$val->mid] = $val; |
97 | 97 | $args->module_srls_info[$val->module_srl] = $val; |
98 | 98 | $module_srls[] = $val->module_srl; |
99 | 99 | } |
100 | - $idx = explode(',',$args->module_srls); |
|
101 | - for($i=0,$c=count($idx);$i<$c;$i++) |
|
100 | + $idx = explode(',', $args->module_srls); |
|
101 | + for ($i = 0, $c = count($idx); $i < $c; $i++) |
|
102 | 102 | { |
103 | 103 | $srl = $idx[$i]; |
104 | - if(!$args->module_srls_info[$srl]) continue; |
|
104 | + if (!$args->module_srls_info[$srl]) continue; |
|
105 | 105 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | 109 | // Exit if no module is found |
110 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
111 | - $args->module_srl = implode(',',$module_srls); |
|
110 | + if (!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
111 | + $args->module_srl = implode(',', $module_srls); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist |
116 | 116 | */ |
117 | 117 | // tab type |
118 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
118 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
119 | 119 | { |
120 | - switch($args->content_type) |
|
120 | + switch ($args->content_type) |
|
121 | 121 | { |
122 | 122 | case 'comment': |
123 | 123 | $content_items = $this->_getCommentItems($args); |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | { |
142 | 142 | $content_items = array(); |
143 | 143 | |
144 | - switch($args->content_type) |
|
144 | + switch ($args->content_type) |
|
145 | 145 | { |
146 | 146 | case 'comment': |
147 | - foreach($args->mid_lists as $module_srl => $mid) |
|
147 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
148 | 148 | { |
149 | 149 | $args->module_srl = $module_srl; |
150 | 150 | $content_items[$module_srl] = $this->_getCommentItems($args); |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | case 'image': |
154 | - foreach($args->mid_lists as $module_srl => $mid) |
|
154 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
155 | 155 | { |
156 | 156 | $args->module_srl = $module_srl; |
157 | 157 | $content_items[$module_srl] = $this->_getImageItems($args); |
@@ -161,14 +161,14 @@ discard block |
||
161 | 161 | $content_items = $this->getRssItems($args); |
162 | 162 | break; |
163 | 163 | case 'trackback': |
164 | - foreach($args->mid_lists as $module_srl => $mid) |
|
164 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
165 | 165 | { |
166 | 166 | $args->module_srl = $module_srl; |
167 | 167 | $content_items[$module_srl] = $this->_getTrackbackItems($args); |
168 | 168 | } |
169 | 169 | break; |
170 | 170 | default: |
171 | - foreach($args->mid_lists as $module_srl => $mid) |
|
171 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
172 | 172 | { |
173 | 173 | $args->module_srl = $module_srl; |
174 | 174 | $content_items[$module_srl] = $this->_getDocumentItems($args); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - $output = $this->_compile($args,$content_items); |
|
180 | + $output = $this->_compile($args, $content_items); |
|
181 | 181 | return $output; |
182 | 182 | } |
183 | 183 | |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | |
198 | 198 | $content_items = array(); |
199 | 199 | |
200 | - if(!count($output)) return; |
|
200 | + if (!count($output)) return; |
|
201 | 201 | |
202 | - foreach($output as $key => $oComment) |
|
202 | + foreach ($output as $key => $oComment) |
|
203 | 203 | { |
204 | 204 | $attribute = $oComment->getObjectVars(); |
205 | 205 | $title = $oComment->getSummary($args->content_cut_size); |
206 | - $thumbnail = $oComment->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
207 | - $url = sprintf("%s#comment_%s",getUrl('','mid', $args->mid_lists[$attribute->module_srl], 'document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl')); |
|
206 | + $thumbnail = $oComment->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
207 | + $url = sprintf("%s#comment_%s", getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl')); |
|
208 | 208 | |
209 | 209 | $attribute->mid = $args->mid_lists[$attribute->module_srl]; |
210 | 210 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | // Get categories |
230 | 230 | $obj = new stdClass(); |
231 | 231 | $obj->module_srl = $args->module_srl; |
232 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
233 | - if($output->toBool() && $output->data) |
|
232 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
233 | + if ($output->toBool() && $output->data) |
|
234 | 234 | { |
235 | - foreach($output->data as $key => $val) |
|
235 | + foreach ($output->data as $key => $val) |
|
236 | 236 | { |
237 | 237 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
238 | 238 | } |
@@ -241,24 +241,24 @@ discard block |
||
241 | 241 | $obj->module_srl = $args->module_srl; |
242 | 242 | $obj->category_srl = $args->category_srl; |
243 | 243 | $obj->sort_index = $args->order_target; |
244 | - if($args->order_target == 'list_order' || $args->order_target == 'update_order') |
|
244 | + if ($args->order_target == 'list_order' || $args->order_target == 'update_order') |
|
245 | 245 | { |
246 | - $obj->order_type = $args->order_type=="desc"?"asc":"desc"; |
|
246 | + $obj->order_type = $args->order_type == "desc" ? "asc" : "desc"; |
|
247 | 247 | } |
248 | 248 | else |
249 | 249 | { |
250 | - $obj->order_type = $args->order_type=="desc"?"desc":"asc"; |
|
250 | + $obj->order_type = $args->order_type == "desc" ? "desc" : "asc"; |
|
251 | 251 | } |
252 | 252 | $obj->list_count = $args->list_count * $args->page_count; |
253 | 253 | $obj->statusList = array('PUBLIC'); |
254 | 254 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
255 | - if(!$output->toBool() || !$output->data) return; |
|
255 | + if (!$output->toBool() || !$output->data) return; |
|
256 | 256 | // If the result exists, make each document as an object |
257 | 257 | $content_items = array(); |
258 | 258 | $first_thumbnail_idx = -1; |
259 | - if(count($output->data)) |
|
259 | + if (count($output->data)) |
|
260 | 260 | { |
261 | - foreach($output->data as $key => $attribute) |
|
261 | + foreach ($output->data as $key => $attribute) |
|
262 | 262 | { |
263 | 263 | $oDocument = new documentItem(); |
264 | 264 | $oDocument->setAttribute($attribute, false); |
@@ -267,26 +267,26 @@ discard block |
||
267 | 267 | } |
268 | 268 | $oDocumentModel->setToAllDocumentExtraVars(); |
269 | 269 | |
270 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
270 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
271 | 271 | { |
272 | 272 | $oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]]; |
273 | 273 | $document_srl = $oDocument->document_srl; |
274 | 274 | $module_srl = $oDocument->get('module_srl'); |
275 | 275 | $category_srl = $oDocument->get('category_srl'); |
276 | - $thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
276 | + $thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
277 | 277 | |
278 | - $content_item = new contentItem( $args->module_srls_info[$module_srl]->browser_title ); |
|
278 | + $content_item = new contentItem($args->module_srls_info[$module_srl]->browser_title); |
|
279 | 279 | $content_item->adds($oDocument->getObjectVars()); |
280 | 280 | $content_item->add('original_content', $oDocument->get('content')); |
281 | 281 | $content_item->setTitle($oDocument->getTitleText()); |
282 | - $content_item->setCategory( $category_lists[$module_srl][$category_srl]->title ); |
|
283 | - $content_item->setDomain( $args->module_srls_info[$module_srl]->domain ); |
|
282 | + $content_item->setCategory($category_lists[$module_srl][$category_srl]->title); |
|
283 | + $content_item->setDomain($args->module_srls_info[$module_srl]->domain); |
|
284 | 284 | $content_item->setContent($oDocument->getSummary($args->content_cut_size)); |
285 | - $content_item->setLink( getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl],'document_srl',$document_srl) ); |
|
285 | + $content_item->setLink(getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl], 'document_srl', $document_srl)); |
|
286 | 286 | $content_item->setThumbnail($thumbnail); |
287 | 287 | $content_item->setExtraImages($oDocument->printExtraImages($args->duration_new * 60 * 60)); |
288 | 288 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
289 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
289 | + if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i; |
|
290 | 290 | $content_items[] = $content_item; |
291 | 291 | } |
292 | 292 | |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | $obj->direct_download = 'Y'; |
308 | 308 | $obj->isvalid = 'Y'; |
309 | 309 | // Get categories |
310 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
311 | - if($output->toBool() && $output->data) |
|
310 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
311 | + if ($output->toBool() && $output->data) |
|
312 | 312 | { |
313 | - foreach($output->data as $key => $val) |
|
313 | + foreach ($output->data as $key => $val) |
|
314 | 314 | { |
315 | 315 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
316 | 316 | } |
@@ -319,25 +319,25 @@ discard block |
||
319 | 319 | $obj->list_count = $args->list_count * $args->page_count; |
320 | 320 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
321 | 321 | $files_count = count($files_output->data); |
322 | - if(!$files_count) return; |
|
322 | + if (!$files_count) return; |
|
323 | 323 | |
324 | 324 | $content_items = array(); |
325 | 325 | |
326 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
326 | + for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
327 | 327 | |
328 | 328 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
329 | 329 | |
330 | - if(!count($tmp_document_list)) return; |
|
330 | + if (!count($tmp_document_list)) return; |
|
331 | 331 | |
332 | - foreach($tmp_document_list as $oDocument) |
|
332 | + foreach ($tmp_document_list as $oDocument) |
|
333 | 333 | { |
334 | 334 | $attribute = $oDocument->getObjectVars(); |
335 | 335 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
336 | 336 | $domain = $args->module_srls_info[$attribute->module_srl]->domain; |
337 | 337 | $category = $category_lists[$attribute->module_srl]->text; |
338 | 338 | $content = $oDocument->getSummary($args->content_cut_size); |
339 | - $url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount()); |
|
340 | - $thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
339 | + $url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount()); |
|
340 | + $thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
341 | 341 | $extra_images = $oDocument->printExtraImages($args->duration_new); |
342 | 342 | |
343 | 343 | $content_item = new contentItem($browser_title); |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | $content_items = array(); |
361 | 361 | $args->mid_lists = array(); |
362 | 362 | |
363 | - foreach($args->rss_urls as $key => $rss) |
|
363 | + foreach ($args->rss_urls as $key => $rss) |
|
364 | 364 | { |
365 | 365 | $args->rss_url = $rss; |
366 | 366 | $content_item = $this->_getRssItems($args); |
367 | - if(count($content_item) > 0) |
|
367 | + if (count($content_item) > 0) |
|
368 | 368 | { |
369 | 369 | $browser_title = $content_item[0]->getBrowserTitle(); |
370 | 370 | $args->mid_lists[] = $browser_title; |
@@ -372,37 +372,37 @@ discard block |
||
372 | 372 | } |
373 | 373 | } |
374 | 374 | // If it is not a tab type |
375 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
375 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
376 | 376 | { |
377 | 377 | $items = array(); |
378 | - foreach($content_items as $key => $val) |
|
378 | + foreach ($content_items as $key => $val) |
|
379 | 379 | { |
380 | - foreach($val as $k => $v) |
|
380 | + foreach ($val as $k => $v) |
|
381 | 381 | { |
382 | 382 | $date = $v->get('regdate'); |
383 | - $i=0; |
|
384 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
385 | - $items[sprintf('%s%02d',$date,$i)] = $v; |
|
383 | + $i = 0; |
|
384 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
385 | + $items[sprintf('%s%02d', $date, $i)] = $v; |
|
386 | 386 | } |
387 | 387 | } |
388 | - if($args->order_type =='asc') ksort($items); |
|
388 | + if ($args->order_type == 'asc') ksort($items); |
|
389 | 389 | else krsort($items); |
390 | - $content_items = array_slice(array_values($items),0,$args->list_count*$args->page_count); |
|
390 | + $content_items = array_slice(array_values($items), 0, $args->list_count * $args->page_count); |
|
391 | 391 | // Tab Type |
392 | 392 | } |
393 | 393 | else |
394 | 394 | { |
395 | - foreach($content_items as $key=> $content_item_list) |
|
395 | + foreach ($content_items as $key=> $content_item_list) |
|
396 | 396 | { |
397 | 397 | $items = array(); |
398 | - foreach($content_item_list as $k => $content_item) |
|
398 | + foreach ($content_item_list as $k => $content_item) |
|
399 | 399 | { |
400 | 400 | $date = $content_item->get('regdate'); |
401 | - $i=0; |
|
402 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
403 | - $items[sprintf('%s%02d',$date,$i)] = $content_item; |
|
401 | + $i = 0; |
|
402 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
403 | + $items[sprintf('%s%02d', $date, $i)] = $content_item; |
|
404 | 404 | } |
405 | - if($args->order_type =='asc') ksort($items); |
|
405 | + if ($args->order_type == 'asc') ksort($items); |
|
406 | 406 | else krsort($items); |
407 | 407 | |
408 | 408 | $content_items[$key] = array_values($items); |
@@ -413,19 +413,19 @@ discard block |
||
413 | 413 | |
414 | 414 | function _getRssBody($value) |
415 | 415 | { |
416 | - if(!$value || is_string($value)) return $value; |
|
417 | - if(is_object($value)) $value = get_object_vars($value); |
|
416 | + if (!$value || is_string($value)) return $value; |
|
417 | + if (is_object($value)) $value = get_object_vars($value); |
|
418 | 418 | $body = null; |
419 | - if(!count($value)) return; |
|
420 | - foreach($value as $key => $val) |
|
419 | + if (!count($value)) return; |
|
420 | + foreach ($value as $key => $val) |
|
421 | 421 | { |
422 | - if($key == 'body') |
|
422 | + if ($key == 'body') |
|
423 | 423 | { |
424 | 424 | $body = $val; |
425 | 425 | continue; |
426 | 426 | } |
427 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
428 | - if($body !== null) return $body; |
|
427 | + if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val); |
|
428 | + if ($body !== null) return $body; |
|
429 | 429 | } |
430 | 430 | return $body; |
431 | 431 | } |
@@ -436,17 +436,17 @@ discard block |
||
436 | 436 | // Replace tags such as </p> , </div> , </li> and others to a whitespace |
437 | 437 | $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); |
438 | 438 | // Remove Tag |
439 | - $content = preg_replace('!<([^>]*?)>!is','', $content); |
|
439 | + $content = preg_replace('!<([^>]*?)>!is', '', $content); |
|
440 | 440 | // Replace tags to <, >, " and whitespace |
441 | - $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); |
|
441 | + $content = str_replace(array('<', '>', '"', ' '), array('<', '>', '"', ' '), $content); |
|
442 | 442 | // Delete a series of whitespaces |
443 | 443 | $content = preg_replace('/ ( +)/is', ' ', $content); |
444 | 444 | // Truncate string |
445 | 445 | $content = trim(cut_str($content, $str_size, $tail)); |
446 | 446 | // Replace back <, >, " to the original tags |
447 | - $content = str_replace(array('<','>','"'),array('<','>','"'), $content); |
|
447 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
448 | 448 | // Fixed to a newline bug for consecutive sets of English letters |
449 | - $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); |
|
449 | + $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content); |
|
450 | 450 | return $content; |
451 | 451 | } |
452 | 452 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | function requestFeedContents($rss_url) |
458 | 458 | { |
459 | - $rss_url = str_replace('&','&',Context::convertEncodingStr($rss_url)); |
|
459 | + $rss_url = str_replace('&', '&', Context::convertEncodingStr($rss_url)); |
|
460 | 460 | return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml'); |
461 | 461 | } |
462 | 462 | |
@@ -468,51 +468,51 @@ discard block |
||
468 | 468 | $buff = $this->requestFeedContents($args->rss_url); |
469 | 469 | |
470 | 470 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
471 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
471 | + if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
472 | 472 | |
473 | 473 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
474 | 474 | |
475 | 475 | $oXmlParser = new XmlParser(); |
476 | 476 | $xml_doc = $oXmlParser->parse($buff); |
477 | - if($xml_doc->rss) |
|
477 | + if ($xml_doc->rss) |
|
478 | 478 | { |
479 | 479 | $rss->title = $xml_doc->rss->channel->title->body; |
480 | 480 | $rss->link = $xml_doc->rss->channel->link->body; |
481 | 481 | |
482 | 482 | $items = $xml_doc->rss->channel->item; |
483 | 483 | |
484 | - if(!$items) return; |
|
485 | - if($items && !is_array($items)) $items = array($items); |
|
484 | + if (!$items) return; |
|
485 | + if ($items && !is_array($items)) $items = array($items); |
|
486 | 486 | |
487 | 487 | $content_items = array(); |
488 | 488 | |
489 | 489 | foreach ($items as $key => $value) |
490 | 490 | { |
491 | - if($key >= $args->list_count * $args->page_count) break; |
|
491 | + if ($key >= $args->list_count * $args->page_count) break; |
|
492 | 492 | unset($item); |
493 | 493 | |
494 | - foreach($value as $key2 => $value2) |
|
494 | + foreach ($value as $key2 => $value2) |
|
495 | 495 | { |
496 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
496 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
497 | 497 | $item->{$key2} = $this->_getRssBody($value2); |
498 | 498 | } |
499 | 499 | |
500 | 500 | $content_item = new contentItem($rss->title); |
501 | 501 | $content_item->setContentsLink($rss->link); |
502 | 502 | $content_item->setTitle($item->title); |
503 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
503 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
504 | 504 | //$content_item->setCategory($item->category); |
505 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
505 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
506 | 506 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
507 | 507 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
508 | 508 | $content_item->setLink($item->link); |
509 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
509 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
510 | 510 | $content_item->setRegdate($date); |
511 | 511 | |
512 | 512 | $content_items[] = $content_item; |
513 | 513 | } |
514 | 514 | } |
515 | - else if($xml_doc->{'rdf:rdf'}) |
|
515 | + else if ($xml_doc->{'rdf:rdf'}) |
|
516 | 516 | { |
517 | 517 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters. Fixed by misol |
518 | 518 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -520,102 +520,102 @@ discard block |
||
520 | 520 | |
521 | 521 | $items = $xml_doc->{'rdf:rdf'}->item; |
522 | 522 | |
523 | - if(!$items) return; |
|
524 | - if($items && !is_array($items)) $items = array($items); |
|
523 | + if (!$items) return; |
|
524 | + if ($items && !is_array($items)) $items = array($items); |
|
525 | 525 | |
526 | 526 | $content_items = array(); |
527 | 527 | |
528 | 528 | foreach ($items as $key => $value) |
529 | 529 | { |
530 | - if($key >= $args->list_count * $args->page_count) break; |
|
530 | + if ($key >= $args->list_count * $args->page_count) break; |
|
531 | 531 | unset($item); |
532 | 532 | |
533 | - foreach($value as $key2 => $value2) |
|
533 | + foreach ($value as $key2 => $value2) |
|
534 | 534 | { |
535 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
535 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
536 | 536 | $item->{$key2} = $this->_getRssBody($value2); |
537 | 537 | } |
538 | 538 | |
539 | 539 | $content_item = new contentItem($rss->title); |
540 | 540 | $content_item->setContentsLink($rss->link); |
541 | 541 | $content_item->setTitle($item->title); |
542 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
542 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
543 | 543 | //$content_item->setCategory($item->category); |
544 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
544 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
545 | 545 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
546 | 546 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
547 | 547 | $content_item->setLink($item->link); |
548 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
548 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
549 | 549 | $content_item->setRegdate($date); |
550 | 550 | |
551 | 551 | $content_items[] = $content_item; |
552 | 552 | } |
553 | 553 | } |
554 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
554 | + else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
555 | 555 | { |
556 | 556 | // Atom 1.0 spec supported by misol |
557 | 557 | $rss->title = $xml_doc->feed->title->body; |
558 | 558 | $links = $xml_doc->feed->link; |
559 | - if(is_array($links)) |
|
559 | + if (is_array($links)) |
|
560 | 560 | { |
561 | 561 | foreach ($links as $value) |
562 | 562 | { |
563 | - if($value->attrs->rel == 'alternate') |
|
563 | + if ($value->attrs->rel == 'alternate') |
|
564 | 564 | { |
565 | 565 | $rss->link = $value->attrs->href; |
566 | 566 | break; |
567 | 567 | } |
568 | 568 | } |
569 | 569 | } |
570 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
570 | + else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
571 | 571 | |
572 | 572 | $items = $xml_doc->feed->entry; |
573 | 573 | |
574 | - if(!$items) return; |
|
575 | - if($items && !is_array($items)) $items = array($items); |
|
574 | + if (!$items) return; |
|
575 | + if ($items && !is_array($items)) $items = array($items); |
|
576 | 576 | |
577 | 577 | $content_items = array(); |
578 | 578 | |
579 | 579 | foreach ($items as $key => $value) |
580 | 580 | { |
581 | - if($key >= $args->list_count * $args->page_count) break; |
|
581 | + if ($key >= $args->list_count * $args->page_count) break; |
|
582 | 582 | unset($item); |
583 | 583 | |
584 | - foreach($value as $key2 => $value2) |
|
584 | + foreach ($value as $key2 => $value2) |
|
585 | 585 | { |
586 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
586 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
587 | 587 | $item->{$key2} = $this->_getRssBody($value2); |
588 | 588 | } |
589 | 589 | |
590 | 590 | $content_item = new contentItem($rss->title); |
591 | 591 | $links = $value->link; |
592 | - if(is_array($links)) |
|
592 | + if (is_array($links)) |
|
593 | 593 | { |
594 | 594 | foreach ($links as $val) |
595 | 595 | { |
596 | - if($val->attrs->rel == 'alternate') |
|
596 | + if ($val->attrs->rel == 'alternate') |
|
597 | 597 | { |
598 | 598 | $item->link = $val->attrs->href; |
599 | 599 | break; |
600 | 600 | } |
601 | 601 | } |
602 | 602 | } |
603 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
603 | + else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
604 | 604 | |
605 | 605 | $content_item->setContentsLink($rss->link); |
606 | - if($item->title) |
|
606 | + if ($item->title) |
|
607 | 607 | { |
608 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
608 | + if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
609 | 609 | } |
610 | 610 | $content_item->setTitle($item->title); |
611 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
611 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
612 | 612 | $content_item->setAuthorSite($value->author->uri->body); |
613 | 613 | |
614 | 614 | //$content_item->setCategory($item->category); |
615 | 615 | $item->description = ($item->content) ? $item->content : $item->description = $item->summary; |
616 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
616 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
617 | 617 | |
618 | - if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
618 | + if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
619 | 619 | { |
620 | 620 | $item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
621 | 621 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
625 | 625 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
626 | 626 | $content_item->setLink($item->link); |
627 | - $date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'}))); |
|
627 | + $date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'}))); |
|
628 | 628 | $content_item->setRegdate($date); |
629 | 629 | |
630 | 630 | $content_items[] = $content_item; |
@@ -637,15 +637,15 @@ discard block |
||
637 | 637 | { |
638 | 638 | @preg_match('@<img[^>]+src\s*=\s*(?:"(.+)"|\'(.+)\'|([^\s>(?:/>)]+))@', $content, $matches); |
639 | 639 | |
640 | - if($matches[1]) |
|
640 | + if ($matches[1]) |
|
641 | 641 | { |
642 | 642 | return $matches[1]; |
643 | 643 | } |
644 | - elseif($matches[2]) |
|
644 | + elseif ($matches[2]) |
|
645 | 645 | { |
646 | 646 | return $matches[2]; |
647 | 647 | } |
648 | - elseif($matches[3]) |
|
648 | + elseif ($matches[3]) |
|
649 | 649 | { |
650 | 650 | return $matches[3]; |
651 | 651 | } |
@@ -658,17 +658,17 @@ discard block |
||
658 | 658 | function _getTrackbackItems($args) |
659 | 659 | { |
660 | 660 | $oTrackbackModel = getModel('trackback'); |
661 | - if(!$oTrackbackModel) |
|
661 | + if (!$oTrackbackModel) |
|
662 | 662 | { |
663 | 663 | return; |
664 | 664 | } |
665 | 665 | |
666 | 666 | $obj = new stdClass; |
667 | 667 | // Get categories |
668 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
669 | - if($output->toBool() && $output->data) |
|
668 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
669 | + if ($output->toBool() && $output->data) |
|
670 | 670 | { |
671 | - foreach($output->data as $key => $val) |
|
671 | + foreach ($output->data as $key => $val) |
|
672 | 672 | { |
673 | 673 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
674 | 674 | } |
@@ -681,14 +681,14 @@ discard block |
||
681 | 681 | // Get model object from the trackback module and execute getTrackbackList() method |
682 | 682 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
683 | 683 | // If an error occurs, just ignore it. |
684 | - if(!$output->toBool() || !$output->data) return; |
|
684 | + if (!$output->toBool() || !$output->data) return; |
|
685 | 685 | // If the result exists, make each document as an object |
686 | 686 | $content_items = array(); |
687 | - foreach($output->data as $key => $item) |
|
687 | + foreach ($output->data as $key => $item) |
|
688 | 688 | { |
689 | 689 | $domain = $args->module_srls_info[$item->module_srl]->domain; |
690 | 690 | $category = $category_lists[$item->module_srl]->text; |
691 | - $url = getSiteUrl($domain,'','document_srl',$item->document_srl); |
|
691 | + $url = getSiteUrl($domain, '', 'document_srl', $item->document_srl); |
|
692 | 692 | $browser_title = $args->module_srls_info[$item->module_srl]->browser_title; |
693 | 693 | |
694 | 694 | $content_item = new contentItem($browser_title); |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | $content_item->setTitle($item->title); |
697 | 697 | $content_item->setCategory($category); |
698 | 698 | $content_item->setNickName($item->blog_name); |
699 | - $content_item->setContent($item->excerpt); ///<< |
|
700 | - $content_item->setDomain($domain); ///<< |
|
699 | + $content_item->setContent($item->excerpt); ///<< |
|
700 | + $content_item->setDomain($domain); ///<< |
|
701 | 701 | $content_item->setLink($url); |
702 | 702 | $content_item->add('mid', $args->mid_lists[$item->module_srl]); |
703 | 703 | $content_item->setRegdate($item->regdate); |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | return $content_items; |
707 | 707 | } |
708 | 708 | |
709 | - function _compile($args,$content_items) |
|
709 | + function _compile($args, $content_items) |
|
710 | 710 | { |
711 | 711 | $oTemplate = &TemplateHandler::getInstance(); |
712 | 712 | // Set variables for widget |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | $widget_info->nickname_cut_size = $args->nickname_cut_size; |
721 | 721 | $widget_info->new_window = $args->new_window; |
722 | 722 | |
723 | - $widget_info->duration_new = $args->duration_new * 60*60; |
|
723 | + $widget_info->duration_new = $args->duration_new * 60 * 60; |
|
724 | 724 | $widget_info->thumbnail_type = $args->thumbnail_type; |
725 | 725 | $widget_info->thumbnail_width = $args->thumbnail_width; |
726 | 726 | $widget_info->thumbnail_height = $args->thumbnail_height; |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | |
739 | 739 | $widget_info->markup_type = $args->markup_type; |
740 | 740 | // If it is a tab type, list up tab items and change key value(module_srl) to index |
741 | - if($args->tab_type != 'none' && $args->tab_type) |
|
741 | + if ($args->tab_type != 'none' && $args->tab_type) |
|
742 | 742 | { |
743 | 743 | $tab = array(); |
744 | - foreach($args->mid_lists as $module_srl => $mid) |
|
744 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
745 | 745 | { |
746 | - if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
746 | + if (!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
747 | 747 | |
748 | 748 | unset($tab_item); |
749 | 749 | $tab_item = new stdClass(); |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | $tab_item->content_items = $content_items[$module_srl]; |
752 | 752 | $tab_item->domain = $content_items[$module_srl][0]->getDomain(); |
753 | 753 | $tab_item->url = $content_items[$module_srl][0]->getContentsLink(); |
754 | - if(!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid); |
|
754 | + if (!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '', 'mid', $mid); |
|
755 | 755 | $tab[] = $tab_item; |
756 | 756 | } |
757 | 757 | $widget_info->tab = $tab; |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | var $contents_link = null; |
780 | 780 | var $domain = null; |
781 | 781 | |
782 | - function contentItem($browser_title='') |
|
782 | + function contentItem($browser_title = '') |
|
783 | 783 | { |
784 | 784 | $this->browser_title = $browser_title; |
785 | 785 | } |
@@ -789,22 +789,22 @@ discard block |
||
789 | 789 | } |
790 | 790 | function setFirstThumbnailIdx($first_thumbnail_idx) |
791 | 791 | { |
792 | - if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1) |
|
792 | + if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1) |
|
793 | 793 | { |
794 | 794 | $this->has_first_thumbnail_idx = true; |
795 | - $this->first_thumbnail_idx= $first_thumbnail_idx; |
|
795 | + $this->first_thumbnail_idx = $first_thumbnail_idx; |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | function setExtraImages($extra_images) |
799 | 799 | { |
800 | - $this->add('extra_images',$extra_images); |
|
800 | + $this->add('extra_images', $extra_images); |
|
801 | 801 | } |
802 | 802 | function setDomain($domain) |
803 | 803 | { |
804 | 804 | static $default_domain = null; |
805 | - if(!$domain) |
|
805 | + if (!$domain) |
|
806 | 806 | { |
807 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
807 | + if (is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
808 | 808 | $domain = $default_domain; |
809 | 809 | } |
810 | 810 | $this->domain = $domain; |
@@ -868,17 +868,17 @@ discard block |
||
868 | 868 | { |
869 | 869 | return $this->get('module_srl'); |
870 | 870 | } |
871 | - function getTitle($cut_size = 0, $tail='...') |
|
871 | + function getTitle($cut_size = 0, $tail = '...') |
|
872 | 872 | { |
873 | 873 | $title = htmlspecialchars($this->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
874 | 874 | |
875 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
875 | + if ($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
876 | 876 | |
877 | 877 | $attrs = array(); |
878 | - if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
879 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
878 | + if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
879 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
880 | 880 | |
881 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
881 | + if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
882 | 882 | |
883 | 883 | return $title; |
884 | 884 | } |
@@ -890,9 +890,9 @@ discard block |
||
890 | 890 | { |
891 | 891 | return $this->get('category'); |
892 | 892 | } |
893 | - function getNickName($cut_size = 0, $tail='...') |
|
893 | + function getNickName($cut_size = 0, $tail = '...') |
|
894 | 894 | { |
895 | - if($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
895 | + if ($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
896 | 896 | else $nick_name = $this->get('nick_name'); |
897 | 897 | |
898 | 898 | return $nick_name; |
@@ -904,12 +904,12 @@ discard block |
||
904 | 904 | function getCommentCount() |
905 | 905 | { |
906 | 906 | $comment_count = $this->get('comment_count'); |
907 | - return $comment_count>0 ? $comment_count : ''; |
|
907 | + return $comment_count > 0 ? $comment_count : ''; |
|
908 | 908 | } |
909 | 909 | function getTrackbackCount() |
910 | 910 | { |
911 | 911 | $trackback_count = $this->get('trackback_count'); |
912 | - return $trackback_count>0 ? $trackback_count : ''; |
|
912 | + return $trackback_count > 0 ? $trackback_count : ''; |
|
913 | 913 | } |
914 | 914 | function getRegdate($format = 'Y.m.d H:i:s') |
915 | 915 | { |