@@ -18,36 +18,62 @@ 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'))) { |
|
22 | + $args->order_target = 'regdate'; |
|
23 | + } |
|
22 | 24 | // Sort order |
23 | - if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc'; |
|
25 | + if(!in_array($args->order_type, array('asc','desc'))) { |
|
26 | + $args->order_type = 'asc'; |
|
27 | + } |
|
24 | 28 | // Pages |
25 | 29 | $args->page_count = (int)$args->page_count; |
26 | - if(!$args->page_count) $args->page_count = 1; |
|
30 | + if(!$args->page_count) { |
|
31 | + $args->page_count = 1; |
|
32 | + } |
|
27 | 33 | // The number of displayed lists |
28 | 34 | $args->list_count = (int)$args->list_count; |
29 | - if(!$args->list_count) $args->list_count = 5; |
|
35 | + if(!$args->list_count) { |
|
36 | + $args->list_count = 5; |
|
37 | + } |
|
30 | 38 | // The number of thumbnail columns |
31 | 39 | $args->cols_list_count = (int)$args->cols_list_count; |
32 | - if(!$args->cols_list_count) $args->cols_list_count = 5; |
|
40 | + if(!$args->cols_list_count) { |
|
41 | + $args->cols_list_count = 5; |
|
42 | + } |
|
33 | 43 | // Cut the length of the title |
34 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
44 | + if(!$args->subject_cut_size) { |
|
45 | + $args->subject_cut_size = 0; |
|
46 | + } |
|
35 | 47 | // Cut the length of contents |
36 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
48 | + if(!$args->content_cut_size) { |
|
49 | + $args->content_cut_size = 100; |
|
50 | + } |
|
37 | 51 | // Cut the length of nickname |
38 | - if(!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
52 | + if(!$args->nickname_cut_size) { |
|
53 | + $args->nickname_cut_size = 0; |
|
54 | + } |
|
39 | 55 | // Display time of the latest post |
40 | - if(!$args->duration_new) $args->duration_new = 12; |
|
56 | + if(!$args->duration_new) { |
|
57 | + $args->duration_new = 12; |
|
58 | + } |
|
41 | 59 | // How to create thumbnails |
42 | - if(!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
60 | + if(!$args->thumbnail_type) { |
|
61 | + $args->thumbnail_type = 'crop'; |
|
62 | + } |
|
43 | 63 | // Horizontal size of thumbnails |
44 | - if(!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
64 | + if(!$args->thumbnail_width) { |
|
65 | + $args->thumbnail_width = 100; |
|
66 | + } |
|
45 | 67 | // Vertical size of thumbnails |
46 | - if(!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
68 | + if(!$args->thumbnail_height) { |
|
69 | + $args->thumbnail_height = 75; |
|
70 | + } |
|
47 | 71 | // Viewing options |
48 | 72 | $args->option_view_arr = explode(',',$args->option_view); |
49 | 73 | // markup options |
50 | - if(!$args->markup_type) $args->markup_type = 'table'; |
|
74 | + if(!$args->markup_type) { |
|
75 | + $args->markup_type = 'table'; |
|
76 | + } |
|
51 | 77 | // Set variables used internally |
52 | 78 | $oModuleModel = getModel('module'); |
53 | 79 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
@@ -59,11 +85,12 @@ discard block |
||
59 | 85 | $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
60 | 86 | for($i=0,$c=count($rss_urls);$i<$c;$i++) |
61 | 87 | { |
62 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
88 | + if($rss_urls[$i]) { |
|
89 | + $args->rss_urls[] = $rss_urls[$i]; |
|
90 | + } |
|
63 | 91 | } |
64 | 92 | // Get module information after listing module_srls if the module is not RSS |
65 | - } |
|
66 | - else |
|
93 | + } else |
|
67 | 94 | { |
68 | 95 | $obj = new stdClass(); |
69 | 96 | // Apply to all modules in the site if a target module is not specified |
@@ -84,8 +111,7 @@ discard block |
||
84 | 111 | |
85 | 112 | $args->modules_info = $oModuleModel->getMidList($obj); |
86 | 113 | // Apply to the module only if a target module is specified |
87 | - } |
|
88 | - else |
|
114 | + } else |
|
89 | 115 | { |
90 | 116 | $obj->module_srls = $args->module_srls; |
91 | 117 | $output = executeQueryArray('widgets.content.getMids', $obj); |
@@ -101,13 +127,17 @@ discard block |
||
101 | 127 | for($i=0,$c=count($idx);$i<$c;$i++) |
102 | 128 | { |
103 | 129 | $srl = $idx[$i]; |
104 | - if(!$args->module_srls_info[$srl]) continue; |
|
130 | + if(!$args->module_srls_info[$srl]) { |
|
131 | + continue; |
|
132 | + } |
|
105 | 133 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
106 | 134 | } |
107 | 135 | } |
108 | 136 | } |
109 | 137 | // Exit if no module is found |
110 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
138 | + if(!count($args->modules_info)) { |
|
139 | + return Context::get('msg_not_founded'); |
|
140 | + } |
|
111 | 141 | $args->module_srl = implode(',',$module_srls); |
112 | 142 | } |
113 | 143 | |
@@ -136,8 +166,7 @@ discard block |
||
136 | 166 | break; |
137 | 167 | } |
138 | 168 | // If not a tab type |
139 | - } |
|
140 | - else |
|
169 | + } else |
|
141 | 170 | { |
142 | 171 | $content_items = array(); |
143 | 172 | |
@@ -197,7 +226,9 @@ discard block |
||
197 | 226 | |
198 | 227 | $content_items = array(); |
199 | 228 | |
200 | - if(!count($output)) return; |
|
229 | + if(!count($output)) { |
|
230 | + return; |
|
231 | + } |
|
201 | 232 | |
202 | 233 | foreach($output as $key => $oComment) |
203 | 234 | { |
@@ -244,15 +275,16 @@ discard block |
||
244 | 275 | if($args->order_target == 'list_order' || $args->order_target == 'update_order') |
245 | 276 | { |
246 | 277 | $obj->order_type = $args->order_type=="desc"?"asc":"desc"; |
247 | - } |
|
248 | - else |
|
278 | + } else |
|
249 | 279 | { |
250 | 280 | $obj->order_type = $args->order_type=="desc"?"desc":"asc"; |
251 | 281 | } |
252 | 282 | $obj->list_count = $args->list_count * $args->page_count; |
253 | 283 | $obj->statusList = array('PUBLIC'); |
254 | 284 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
255 | - if(!$output->toBool() || !$output->data) return; |
|
285 | + if(!$output->toBool() || !$output->data) { |
|
286 | + return; |
|
287 | + } |
|
256 | 288 | // If the result exists, make each document as an object |
257 | 289 | $content_items = array(); |
258 | 290 | $first_thumbnail_idx = -1; |
@@ -286,7 +318,9 @@ discard block |
||
286 | 318 | $content_item->setThumbnail($thumbnail); |
287 | 319 | $content_item->setExtraImages($oDocument->printExtraImages($args->duration_new * 60 * 60)); |
288 | 320 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
289 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
321 | + if($first_thumbnail_idx==-1 && $thumbnail) { |
|
322 | + $first_thumbnail_idx = $i; |
|
323 | + } |
|
290 | 324 | $content_items[] = $content_item; |
291 | 325 | } |
292 | 326 | |
@@ -319,15 +353,21 @@ discard block |
||
319 | 353 | $obj->list_count = $args->list_count * $args->page_count; |
320 | 354 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
321 | 355 | $files_count = count($files_output->data); |
322 | - if(!$files_count) return; |
|
356 | + if(!$files_count) { |
|
357 | + return; |
|
358 | + } |
|
323 | 359 | |
324 | 360 | $content_items = array(); |
325 | 361 | |
326 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
362 | + for($i=0;$i<$files_count;$i++) { |
|
363 | + $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
364 | + } |
|
327 | 365 | |
328 | 366 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
329 | 367 | |
330 | - if(!count($tmp_document_list)) return; |
|
368 | + if(!count($tmp_document_list)) { |
|
369 | + return; |
|
370 | + } |
|
331 | 371 | |
332 | 372 | foreach($tmp_document_list as $oDocument) |
333 | 373 | { |
@@ -381,16 +421,20 @@ discard block |
||
381 | 421 | { |
382 | 422 | $date = $v->get('regdate'); |
383 | 423 | $i=0; |
384 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
424 | + while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) { |
|
425 | + $i++; |
|
426 | + } |
|
385 | 427 | $items[sprintf('%s%02d',$date,$i)] = $v; |
386 | 428 | } |
387 | 429 | } |
388 | - if($args->order_type =='asc') ksort($items); |
|
389 | - else krsort($items); |
|
430 | + if($args->order_type =='asc') { |
|
431 | + ksort($items); |
|
432 | + } else { |
|
433 | + krsort($items); |
|
434 | + } |
|
390 | 435 | $content_items = array_slice(array_values($items),0,$args->list_count*$args->page_count); |
391 | 436 | // Tab Type |
392 | - } |
|
393 | - else |
|
437 | + } else |
|
394 | 438 | { |
395 | 439 | foreach($content_items as $key=> $content_item_list) |
396 | 440 | { |
@@ -399,11 +443,16 @@ discard block |
||
399 | 443 | { |
400 | 444 | $date = $content_item->get('regdate'); |
401 | 445 | $i=0; |
402 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
446 | + while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) { |
|
447 | + $i++; |
|
448 | + } |
|
403 | 449 | $items[sprintf('%s%02d',$date,$i)] = $content_item; |
404 | 450 | } |
405 | - if($args->order_type =='asc') ksort($items); |
|
406 | - else krsort($items); |
|
451 | + if($args->order_type =='asc') { |
|
452 | + ksort($items); |
|
453 | + } else { |
|
454 | + krsort($items); |
|
455 | + } |
|
407 | 456 | |
408 | 457 | $content_items[$key] = array_values($items); |
409 | 458 | } |
@@ -413,10 +462,16 @@ discard block |
||
413 | 462 | |
414 | 463 | function _getRssBody($value) |
415 | 464 | { |
416 | - if(!$value || is_string($value)) return $value; |
|
417 | - if(is_object($value)) $value = get_object_vars($value); |
|
465 | + if(!$value || is_string($value)) { |
|
466 | + return $value; |
|
467 | + } |
|
468 | + if(is_object($value)) { |
|
469 | + $value = get_object_vars($value); |
|
470 | + } |
|
418 | 471 | $body = null; |
419 | - if(!count($value)) return; |
|
472 | + if(!count($value)) { |
|
473 | + return; |
|
474 | + } |
|
420 | 475 | foreach($value as $key => $val) |
421 | 476 | { |
422 | 477 | if($key == 'body') |
@@ -424,8 +479,12 @@ discard block |
||
424 | 479 | $body = $val; |
425 | 480 | continue; |
426 | 481 | } |
427 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
428 | - if($body !== null) return $body; |
|
482 | + if(is_object($val)||is_array($val)) { |
|
483 | + $body = $this->_getRssBody($val); |
|
484 | + } |
|
485 | + if($body !== null) { |
|
486 | + return $body; |
|
487 | + } |
|
429 | 488 | } |
430 | 489 | return $body; |
431 | 490 | } |
@@ -468,7 +527,9 @@ discard block |
||
468 | 527 | $buff = $this->requestFeedContents($args->rss_url); |
469 | 528 | |
470 | 529 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
471 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
530 | + if($encoding && stripos($matches[1], "UTF-8") === FALSE) { |
|
531 | + $buff = Context::convertEncodingStr($buff); |
|
532 | + } |
|
472 | 533 | |
473 | 534 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
474 | 535 | |
@@ -481,19 +542,27 @@ discard block |
||
481 | 542 | |
482 | 543 | $items = $xml_doc->rss->channel->item; |
483 | 544 | |
484 | - if(!$items) return; |
|
485 | - if($items && !is_array($items)) $items = array($items); |
|
545 | + if(!$items) { |
|
546 | + return; |
|
547 | + } |
|
548 | + if($items && !is_array($items)) { |
|
549 | + $items = array($items); |
|
550 | + } |
|
486 | 551 | |
487 | 552 | $content_items = array(); |
488 | 553 | |
489 | 554 | foreach ($items as $key => $value) |
490 | 555 | { |
491 | - if($key >= $args->list_count * $args->page_count) break; |
|
556 | + if($key >= $args->list_count * $args->page_count) { |
|
557 | + break; |
|
558 | + } |
|
492 | 559 | unset($item); |
493 | 560 | |
494 | 561 | foreach($value as $key2 => $value2) |
495 | 562 | { |
496 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
563 | + if(is_array($value2)) { |
|
564 | + $value2 = array_shift($value2); |
|
565 | + } |
|
497 | 566 | $item->{$key2} = $this->_getRssBody($value2); |
498 | 567 | } |
499 | 568 | |
@@ -511,8 +580,7 @@ discard block |
||
511 | 580 | |
512 | 581 | $content_items[] = $content_item; |
513 | 582 | } |
514 | - } |
|
515 | - else if($xml_doc->{'rdf:rdf'}) |
|
583 | + } else if($xml_doc->{'rdf:rdf'}) |
|
516 | 584 | { |
517 | 585 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters. Fixed by misol |
518 | 586 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -520,19 +588,27 @@ discard block |
||
520 | 588 | |
521 | 589 | $items = $xml_doc->{'rdf:rdf'}->item; |
522 | 590 | |
523 | - if(!$items) return; |
|
524 | - if($items && !is_array($items)) $items = array($items); |
|
591 | + if(!$items) { |
|
592 | + return; |
|
593 | + } |
|
594 | + if($items && !is_array($items)) { |
|
595 | + $items = array($items); |
|
596 | + } |
|
525 | 597 | |
526 | 598 | $content_items = array(); |
527 | 599 | |
528 | 600 | foreach ($items as $key => $value) |
529 | 601 | { |
530 | - if($key >= $args->list_count * $args->page_count) break; |
|
602 | + if($key >= $args->list_count * $args->page_count) { |
|
603 | + break; |
|
604 | + } |
|
531 | 605 | unset($item); |
532 | 606 | |
533 | 607 | foreach($value as $key2 => $value2) |
534 | 608 | { |
535 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
609 | + if(is_array($value2)) { |
|
610 | + $value2 = array_shift($value2); |
|
611 | + } |
|
536 | 612 | $item->{$key2} = $this->_getRssBody($value2); |
537 | 613 | } |
538 | 614 | |
@@ -550,8 +626,7 @@ discard block |
||
550 | 626 | |
551 | 627 | $content_items[] = $content_item; |
552 | 628 | } |
553 | - } |
|
554 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
629 | + } else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
555 | 630 | { |
556 | 631 | // Atom 1.0 spec supported by misol |
557 | 632 | $rss->title = $xml_doc->feed->title->body; |
@@ -566,24 +641,33 @@ discard block |
||
566 | 641 | break; |
567 | 642 | } |
568 | 643 | } |
644 | + } else if($links->attrs->rel == 'alternate') { |
|
645 | + $rss->link = $links->attrs->href; |
|
569 | 646 | } |
570 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
571 | 647 | |
572 | 648 | $items = $xml_doc->feed->entry; |
573 | 649 | |
574 | - if(!$items) return; |
|
575 | - if($items && !is_array($items)) $items = array($items); |
|
650 | + if(!$items) { |
|
651 | + return; |
|
652 | + } |
|
653 | + if($items && !is_array($items)) { |
|
654 | + $items = array($items); |
|
655 | + } |
|
576 | 656 | |
577 | 657 | $content_items = array(); |
578 | 658 | |
579 | 659 | foreach ($items as $key => $value) |
580 | 660 | { |
581 | - if($key >= $args->list_count * $args->page_count) break; |
|
661 | + if($key >= $args->list_count * $args->page_count) { |
|
662 | + break; |
|
663 | + } |
|
582 | 664 | unset($item); |
583 | 665 | |
584 | 666 | foreach($value as $key2 => $value2) |
585 | 667 | { |
586 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
668 | + if(is_array($value2)) { |
|
669 | + $value2 = array_shift($value2); |
|
670 | + } |
|
587 | 671 | $item->{$key2} = $this->_getRssBody($value2); |
588 | 672 | } |
589 | 673 | |
@@ -599,13 +683,16 @@ discard block |
||
599 | 683 | break; |
600 | 684 | } |
601 | 685 | } |
686 | + } else if($links->attrs->rel == 'alternate') { |
|
687 | + $item->link = $links->attrs->href; |
|
602 | 688 | } |
603 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
604 | 689 | |
605 | 690 | $content_item->setContentsLink($rss->link); |
606 | 691 | if($item->title) |
607 | 692 | { |
608 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
693 | + if(stripos($value->title->attrs->type, "html") === FALSE) { |
|
694 | + $item->title = $value->title->body; |
|
695 | + } |
|
609 | 696 | } |
610 | 697 | $content_item->setTitle($item->title); |
611 | 698 | $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
@@ -640,16 +727,13 @@ discard block |
||
640 | 727 | if($matches[1]) |
641 | 728 | { |
642 | 729 | return $matches[1]; |
643 | - } |
|
644 | - elseif($matches[2]) |
|
730 | + } elseif($matches[2]) |
|
645 | 731 | { |
646 | 732 | return $matches[2]; |
647 | - } |
|
648 | - elseif($matches[3]) |
|
733 | + } elseif($matches[3]) |
|
649 | 734 | { |
650 | 735 | return $matches[3]; |
651 | - } |
|
652 | - else |
|
736 | + } else |
|
653 | 737 | { |
654 | 738 | return NULL; |
655 | 739 | } |
@@ -681,7 +765,9 @@ discard block |
||
681 | 765 | // Get model object from the trackback module and execute getTrackbackList() method |
682 | 766 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
683 | 767 | // If an error occurs, just ignore it. |
684 | - if(!$output->toBool() || !$output->data) return; |
|
768 | + if(!$output->toBool() || !$output->data) { |
|
769 | + return; |
|
770 | + } |
|
685 | 771 | // If the result exists, make each document as an object |
686 | 772 | $content_items = array(); |
687 | 773 | foreach($output->data as $key => $item) |
@@ -743,7 +829,9 @@ discard block |
||
743 | 829 | $tab = array(); |
744 | 830 | foreach($args->mid_lists as $module_srl => $mid) |
745 | 831 | { |
746 | - if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
832 | + if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) { |
|
833 | + continue; |
|
834 | + } |
|
747 | 835 | |
748 | 836 | unset($tab_item); |
749 | 837 | $tab_item = new stdClass(); |
@@ -751,12 +839,13 @@ discard block |
||
751 | 839 | $tab_item->content_items = $content_items[$module_srl]; |
752 | 840 | $tab_item->domain = $content_items[$module_srl][0]->getDomain(); |
753 | 841 | $tab_item->url = $content_items[$module_srl][0]->getContentsLink(); |
754 | - if(!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid); |
|
842 | + if(!$tab_item->url) { |
|
843 | + $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid); |
|
844 | + } |
|
755 | 845 | $tab[] = $tab_item; |
756 | 846 | } |
757 | 847 | $widget_info->tab = $tab; |
758 | - } |
|
759 | - else |
|
848 | + } else |
|
760 | 849 | { |
761 | 850 | $widget_info->content_items = $content_items; |
762 | 851 | } |
@@ -804,7 +893,9 @@ discard block |
||
804 | 893 | static $default_domain = null; |
805 | 894 | if(!$domain) |
806 | 895 | { |
807 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
896 | + if(is_null($default_domain)) { |
|
897 | + $default_domain = Context::getDefaultUrl(); |
|
898 | + } |
|
808 | 899 | $domain = $default_domain; |
809 | 900 | } |
810 | 901 | $this->domain = $domain; |
@@ -872,13 +963,21 @@ discard block |
||
872 | 963 | { |
873 | 964 | $title = strip_tags($this->get('title')); |
874 | 965 | |
875 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
966 | + if($cut_size) { |
|
967 | + $title = cut_str($title, $cut_size, $tail); |
|
968 | + } |
|
876 | 969 | |
877 | 970 | $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'); |
|
971 | + if($this->get('title_bold') == 'Y') { |
|
972 | + $attrs[] = 'font-weight:bold'; |
|
973 | + } |
|
974 | + if($this->get('title_color') && $this->get('title_color') != 'N') { |
|
975 | + $attrs[] = 'color:#'.$this->get('title_color'); |
|
976 | + } |
|
880 | 977 | |
881 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
978 | + if(count($attrs)) { |
|
979 | + $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
980 | + } |
|
882 | 981 | |
883 | 982 | return $title; |
884 | 983 | } |
@@ -892,8 +991,11 @@ discard block |
||
892 | 991 | } |
893 | 992 | function getNickName($cut_size = 0, $tail='...') |
894 | 993 | { |
895 | - if($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
896 | - else $nick_name = $this->get('nick_name'); |
|
994 | + if($cut_size) { |
|
995 | + $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
996 | + } else { |
|
997 | + $nick_name = $this->get('nick_name'); |
|
998 | + } |
|
897 | 999 | |
898 | 1000 | return $nick_name; |
899 | 1001 | } |
@@ -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('','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('', '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(htmlspecialchars($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,'','document_srl',$document_srl) ); |
|
285 | + $content_item->setLink(getSiteUrl($domain, '', '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 onclick="window.open(this.href);return false" href=', $item->description); |
|
505 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" 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 onclick="window.open(this.href);return false" href=', $item->description); |
|
544 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" 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 onclick="window.open(this.href);return false" href=', $item->description); |
|
616 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" 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 = strip_tags($this->get('title')); |
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), htmlspecialchars($title)); |
|
881 | + if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($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 | { |
@@ -19,13 +19,13 @@ |
||
19 | 19 | $oCounterModel = getModel('counter'); |
20 | 20 | |
21 | 21 | $site_module_info = Context::get('site_module_info'); |
22 | - $output = $oCounterModel->getStatus(array('00000000', date('Ymd', $_SERVER['REQUEST_TIME']-60*60*24), date('Ymd')), $site_module_info->site_srl); |
|
23 | - if(count($output)) |
|
22 | + $output = $oCounterModel->getStatus(array('00000000', date('Ymd', $_SERVER['REQUEST_TIME'] - 60 * 60 * 24), date('Ymd')), $site_module_info->site_srl); |
|
23 | + if (count($output)) |
|
24 | 24 | { |
25 | - foreach($output as $key => $val) |
|
25 | + foreach ($output as $key => $val) |
|
26 | 26 | { |
27 | - if(!$key) Context::set('total_counter', $val); |
|
28 | - elseif($key == date("Ymd")) Context::set('today_counter', $val); |
|
27 | + if (!$key) Context::set('total_counter', $val); |
|
28 | + elseif ($key == date("Ymd")) Context::set('today_counter', $val); |
|
29 | 29 | else Context::set('yesterday_counter', $val); |
30 | 30 | } |
31 | 31 | } |
@@ -24,9 +24,13 @@ |
||
24 | 24 | { |
25 | 25 | foreach($output as $key => $val) |
26 | 26 | { |
27 | - if(!$key) Context::set('total_counter', $val); |
|
28 | - elseif($key == date("Ymd")) Context::set('today_counter', $val); |
|
29 | - else Context::set('yesterday_counter', $val); |
|
27 | + if(!$key) { |
|
28 | + Context::set('total_counter', $val); |
|
29 | + } elseif($key == date("Ymd")) { |
|
30 | + Context::set('today_counter', $val); |
|
31 | + } else { |
|
32 | + Context::set('yesterday_counter', $val); |
|
33 | + } |
|
30 | 34 | } |
31 | 35 | } |
32 | 36 | // Set a path of the template skin (values of skin, colorset settings) |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin); |
22 | 22 | Context::set('colorset', $args->colorset); |
23 | 23 | // Specify a template file |
24 | - if(Context::get('is_logged')) $tpl_file = 'login_info'; |
|
24 | + if (Context::get('is_logged')) $tpl_file = 'login_info'; |
|
25 | 25 | else $tpl_file = 'login_form'; |
26 | 26 | // Get the member configuration |
27 | 27 | $oModuleModel = getModel('module'); |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | // Set a flag to check if the https connection is made when using SSL and create https url |
32 | 32 | $ssl_mode = false; |
33 | 33 | $useSsl = Context::getSslStatus(); |
34 | - if($useSsl != 'none') |
|
34 | + if ($useSsl != 'none') |
|
35 | 35 | { |
36 | - if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
36 | + if (strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
37 | 37 | } |
38 | - Context::set('ssl_mode',$ssl_mode); |
|
38 | + Context::set('ssl_mode', $ssl_mode); |
|
39 | 39 | |
40 | 40 | // Compile a template |
41 | 41 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -21,8 +21,11 @@ discard block |
||
21 | 21 | $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin); |
22 | 22 | Context::set('colorset', $args->colorset); |
23 | 23 | // Specify a template file |
24 | - if(Context::get('is_logged')) $tpl_file = 'login_info'; |
|
25 | - else $tpl_file = 'login_form'; |
|
24 | + if(Context::get('is_logged')) { |
|
25 | + $tpl_file = 'login_info'; |
|
26 | + } else { |
|
27 | + $tpl_file = 'login_form'; |
|
28 | + } |
|
26 | 29 | // Get the member configuration |
27 | 30 | $oModuleModel = getModel('module'); |
28 | 31 | $this->member_config = $oModuleModel->getModuleConfig('member'); |
@@ -33,7 +36,9 @@ discard block |
||
33 | 36 | $useSsl = Context::getSslStatus(); |
34 | 37 | if($useSsl != 'none') |
35 | 38 | { |
36 | - if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
39 | + if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) { |
|
40 | + $ssl_mode = true; |
|
41 | + } |
|
37 | 42 | } |
38 | 43 | Context::set('ssl_mode',$ssl_mode); |
39 | 44 |
@@ -18,20 +18,32 @@ discard block |
||
18 | 18 | function proc($args) |
19 | 19 | { |
20 | 20 | // Targets to sort |
21 | - if(!in_array($args->order_target, array('list_order','update_order'))) $args->order_target = 'list_order'; |
|
21 | + if(!in_array($args->order_target, array('list_order','update_order'))) { |
|
22 | + $args->order_target = 'list_order'; |
|
23 | + } |
|
22 | 24 | // Sort order |
23 | - if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc'; |
|
25 | + if(!in_array($args->order_type, array('asc','desc'))) { |
|
26 | + $args->order_type = 'asc'; |
|
27 | + } |
|
24 | 28 | // The number of displayed lists |
25 | 29 | $args->list_count = (int)$args->list_count; |
26 | - if(!$args->list_count) $args->list_count = 5; |
|
30 | + if(!$args->list_count) { |
|
31 | + $args->list_count = 5; |
|
32 | + } |
|
27 | 33 | // Cut the length of the title |
28 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
34 | + if(!$args->subject_cut_size) { |
|
35 | + $args->subject_cut_size = 0; |
|
36 | + } |
|
29 | 37 | // Cut the length of contents |
30 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
38 | + if(!$args->content_cut_size) { |
|
39 | + $args->content_cut_size = 100; |
|
40 | + } |
|
31 | 41 | // Viewing options |
32 | 42 | $args->option_view_arr = explode(',',$args->option_view); |
33 | 43 | // markup options |
34 | - if(!$args->markup_type) $args->markup_type = 'list'; |
|
44 | + if(!$args->markup_type) { |
|
45 | + $args->markup_type = 'list'; |
|
46 | + } |
|
35 | 47 | // Set variables for internal use |
36 | 48 | $oModuleModel = getModel('module'); |
37 | 49 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
@@ -43,11 +55,12 @@ discard block |
||
43 | 55 | $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
44 | 56 | for($i=0,$c=count($rss_urls);$i<$c;$i++) |
45 | 57 | { |
46 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
58 | + if($rss_urls[$i]) { |
|
59 | + $args->rss_urls[] = $rss_urls[$i]; |
|
60 | + } |
|
47 | 61 | } |
48 | 62 | // Get module information after listing module_srls if the module is not RSS |
49 | - } |
|
50 | - else |
|
63 | + } else |
|
51 | 64 | { |
52 | 65 | $obj = new stdClass(); |
53 | 66 | // Apply to all modules in the site if a target module is not specified |
@@ -68,8 +81,7 @@ discard block |
||
68 | 81 | |
69 | 82 | $args->modules_info = $oModuleModel->getMidList($obj); |
70 | 83 | // Apply to the module only if a target module is specified |
71 | - } |
|
72 | - else |
|
84 | + } else |
|
73 | 85 | { |
74 | 86 | $obj->module_srls = $args->module_srls; |
75 | 87 | $output = executeQueryArray('widgets.content.getMids', $obj); |
@@ -85,13 +97,17 @@ discard block |
||
85 | 97 | for($i=0,$c=count($idx);$i<$c;$i++) |
86 | 98 | { |
87 | 99 | $srl = $idx[$i]; |
88 | - if(!$args->module_srls_info[$srl]) continue; |
|
100 | + if(!$args->module_srls_info[$srl]) { |
|
101 | + continue; |
|
102 | + } |
|
89 | 103 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
90 | 104 | } |
91 | 105 | } |
92 | 106 | } |
93 | 107 | // Exit if no module is found |
94 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
108 | + if(!count($args->modules_info)) { |
|
109 | + return Context::get('msg_not_founded'); |
|
110 | + } |
|
95 | 111 | $args->module_srl = implode(',',$module_srls); |
96 | 112 | } |
97 | 113 | |
@@ -120,8 +136,7 @@ discard block |
||
120 | 136 | break; |
121 | 137 | } |
122 | 138 | // If not a tab type |
123 | - } |
|
124 | - else |
|
139 | + } else |
|
125 | 140 | { |
126 | 141 | $content_items = array(); |
127 | 142 | |
@@ -180,7 +195,9 @@ discard block |
||
180 | 195 | |
181 | 196 | $content_items = array(); |
182 | 197 | |
183 | - if(!count($output)) return; |
|
198 | + if(!count($output)) { |
|
199 | + return; |
|
200 | + } |
|
184 | 201 | |
185 | 202 | foreach($output as $key => $oComment) |
186 | 203 | { |
@@ -227,7 +244,9 @@ discard block |
||
227 | 244 | $obj->list_count = $args->list_count; |
228 | 245 | $obj->statusList = array('PUBLIC'); |
229 | 246 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
230 | - if(!$output->toBool() || !$output->data) return; |
|
247 | + if(!$output->toBool() || !$output->data) { |
|
248 | + return; |
|
249 | + } |
|
231 | 250 | // If the result exists, make each document as an object |
232 | 251 | $content_items = array(); |
233 | 252 | $first_thumbnail_idx = -1; |
@@ -258,7 +277,9 @@ discard block |
||
258 | 277 | $content_item->setLink( getSiteUrl($domain,'','document_srl',$document_srl) ); |
259 | 278 | $content_item->setThumbnail($thumbnail); |
260 | 279 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
261 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
280 | + if($first_thumbnail_idx==-1 && $thumbnail) { |
|
281 | + $first_thumbnail_idx = $i; |
|
282 | + } |
|
262 | 283 | $content_items[] = $content_item; |
263 | 284 | } |
264 | 285 | |
@@ -288,15 +309,21 @@ discard block |
||
288 | 309 | $obj->list_count = $args->list_count; |
289 | 310 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
290 | 311 | $files_count = count($files_output->data); |
291 | - if(!$files_count) return; |
|
312 | + if(!$files_count) { |
|
313 | + return; |
|
314 | + } |
|
292 | 315 | |
293 | 316 | $content_items = array(); |
294 | 317 | |
295 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
318 | + for($i=0;$i<$files_count;$i++) { |
|
319 | + $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
320 | + } |
|
296 | 321 | |
297 | 322 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
298 | 323 | |
299 | - if(!count($tmp_document_list)) return; |
|
324 | + if(!count($tmp_document_list)) { |
|
325 | + return; |
|
326 | + } |
|
300 | 327 | |
301 | 328 | foreach($tmp_document_list as $oDocument) |
302 | 329 | { |
@@ -348,22 +375,33 @@ discard block |
||
348 | 375 | { |
349 | 376 | $date = $v->get('regdate'); |
350 | 377 | $i=0; |
351 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
378 | + while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) { |
|
379 | + $i++; |
|
380 | + } |
|
352 | 381 | $items[sprintf('%s%02d',$date,$i)] = $v; |
353 | 382 | } |
354 | 383 | } |
355 | - if($args->order_type =='asc') ksort($items); |
|
356 | - else krsort($items); |
|
384 | + if($args->order_type =='asc') { |
|
385 | + ksort($items); |
|
386 | + } else { |
|
387 | + krsort($items); |
|
388 | + } |
|
357 | 389 | $content_items = array_slice(array_values($items),0,$args->list_count); |
358 | 390 | } return $content_items; |
359 | 391 | } |
360 | 392 | |
361 | 393 | function _getRssBody($value) |
362 | 394 | { |
363 | - if(!$value || is_string($value)) return $value; |
|
364 | - if(is_object($value)) $value = get_object_vars($value); |
|
395 | + if(!$value || is_string($value)) { |
|
396 | + return $value; |
|
397 | + } |
|
398 | + if(is_object($value)) { |
|
399 | + $value = get_object_vars($value); |
|
400 | + } |
|
365 | 401 | $body = null; |
366 | - if(!count($value)) return; |
|
402 | + if(!count($value)) { |
|
403 | + return; |
|
404 | + } |
|
367 | 405 | foreach($value as $key => $val) |
368 | 406 | { |
369 | 407 | if($key == 'body') |
@@ -371,8 +409,12 @@ discard block |
||
371 | 409 | $body = $val; |
372 | 410 | continue; |
373 | 411 | } |
374 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
375 | - if($body !== null) return $body; |
|
412 | + if(is_object($val)||is_array($val)) { |
|
413 | + $body = $this->_getRssBody($val); |
|
414 | + } |
|
415 | + if($body !== null) { |
|
416 | + return $body; |
|
417 | + } |
|
376 | 418 | } |
377 | 419 | return $body; |
378 | 420 | } |
@@ -416,7 +458,9 @@ discard block |
||
416 | 458 | $buff = $this->requestFeedContents($args->rss_url); |
417 | 459 | |
418 | 460 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
419 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
461 | + if($encoding && stripos($matches[1], "UTF-8") === FALSE) { |
|
462 | + $buff = Context::convertEncodingStr($buff); |
|
463 | + } |
|
420 | 464 | |
421 | 465 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
422 | 466 | |
@@ -430,20 +474,28 @@ discard block |
||
430 | 474 | |
431 | 475 | $items = $xml_doc->rss->channel->item; |
432 | 476 | |
433 | - if(!$items) return; |
|
434 | - if($items && !is_array($items)) $items = array($items); |
|
477 | + if(!$items) { |
|
478 | + return; |
|
479 | + } |
|
480 | + if($items && !is_array($items)) { |
|
481 | + $items = array($items); |
|
482 | + } |
|
435 | 483 | |
436 | 484 | $content_items = array(); |
437 | 485 | |
438 | 486 | foreach ($items as $key => $value) |
439 | 487 | { |
440 | - if($key >= $args->list_count) break; |
|
488 | + if($key >= $args->list_count) { |
|
489 | + break; |
|
490 | + } |
|
441 | 491 | unset($item); |
442 | 492 | $item = new stdClass(); |
443 | 493 | |
444 | 494 | foreach($value as $key2 => $value2) |
445 | 495 | { |
446 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
496 | + if(is_array($value2)) { |
|
497 | + $value2 = array_shift($value2); |
|
498 | + } |
|
447 | 499 | $item->{$key2} = $this->_getRssBody($value2); |
448 | 500 | } |
449 | 501 | |
@@ -460,8 +512,7 @@ discard block |
||
460 | 512 | |
461 | 513 | $content_items[] = $content_item; |
462 | 514 | } |
463 | - } |
|
464 | - else if($xml_doc->{'rdf:rdf'}) |
|
515 | + } else if($xml_doc->{'rdf:rdf'}) |
|
465 | 516 | { |
466 | 517 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters) Fixed by misol |
467 | 518 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -469,20 +520,28 @@ discard block |
||
469 | 520 | |
470 | 521 | $items = $xml_doc->{'rdf:rdf'}->item; |
471 | 522 | |
472 | - if(!$items) return; |
|
473 | - if($items && !is_array($items)) $items = array($items); |
|
523 | + if(!$items) { |
|
524 | + return; |
|
525 | + } |
|
526 | + if($items && !is_array($items)) { |
|
527 | + $items = array($items); |
|
528 | + } |
|
474 | 529 | |
475 | 530 | $content_items = array(); |
476 | 531 | |
477 | 532 | foreach ($items as $key => $value) |
478 | 533 | { |
479 | - if($key >= $args->list_count) break; |
|
534 | + if($key >= $args->list_count) { |
|
535 | + break; |
|
536 | + } |
|
480 | 537 | unset($item); |
481 | 538 | $item = new stdClass(); |
482 | 539 | |
483 | 540 | foreach($value as $key2 => $value2) |
484 | 541 | { |
485 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
542 | + if(is_array($value2)) { |
|
543 | + $value2 = array_shift($value2); |
|
544 | + } |
|
486 | 545 | $item->{$key2} = $this->_getRssBody($value2); |
487 | 546 | } |
488 | 547 | |
@@ -499,8 +558,7 @@ discard block |
||
499 | 558 | |
500 | 559 | $content_items[] = $content_item; |
501 | 560 | } |
502 | - } |
|
503 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
561 | + } else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
504 | 562 | { |
505 | 563 | // Atom 1.0 spec supported by misol |
506 | 564 | $rss->title = $xml_doc->feed->title->body; |
@@ -515,24 +573,33 @@ discard block |
||
515 | 573 | break; |
516 | 574 | } |
517 | 575 | } |
576 | + } else if($links->attrs->rel == 'alternate') { |
|
577 | + $rss->link = $links->attrs->href; |
|
518 | 578 | } |
519 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
520 | 579 | |
521 | 580 | $items = $xml_doc->feed->entry; |
522 | 581 | |
523 | - if(!$items) return; |
|
524 | - if($items && !is_array($items)) $items = array($items); |
|
582 | + if(!$items) { |
|
583 | + return; |
|
584 | + } |
|
585 | + if($items && !is_array($items)) { |
|
586 | + $items = array($items); |
|
587 | + } |
|
525 | 588 | |
526 | 589 | $content_items = array(); |
527 | 590 | |
528 | 591 | foreach ($items as $key => $value) |
529 | 592 | { |
530 | - if($key >= $args->list_count) break; |
|
593 | + if($key >= $args->list_count) { |
|
594 | + break; |
|
595 | + } |
|
531 | 596 | unset($item); |
532 | 597 | |
533 | 598 | foreach($value as $key2 => $value2) |
534 | 599 | { |
535 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
600 | + if(is_array($value2)) { |
|
601 | + $value2 = array_shift($value2); |
|
602 | + } |
|
536 | 603 | $item->{$key2} = $this->_getRssBody($value2); |
537 | 604 | } |
538 | 605 | |
@@ -548,13 +615,16 @@ discard block |
||
548 | 615 | break; |
549 | 616 | } |
550 | 617 | } |
618 | + } else if($links->attrs->rel == 'alternate') { |
|
619 | + $item->link = $links->attrs->href; |
|
551 | 620 | } |
552 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
553 | 621 | |
554 | 622 | $content_item->setContentsLink($rss->link); |
555 | 623 | if($item->title) |
556 | 624 | { |
557 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
625 | + if(stripos($value->title->attrs->type, "html") === FALSE) { |
|
626 | + $item->title = $value->title->body; |
|
627 | + } |
|
558 | 628 | } |
559 | 629 | $content_item->setTitle($item->title); |
560 | 630 | $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
@@ -598,7 +668,9 @@ discard block |
||
598 | 668 | $oTrackbackModel = getModel('trackback'); |
599 | 669 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
600 | 670 | // If an error occurs, just ignore it. |
601 | - if(!$output->toBool() || !$output->data) return; |
|
671 | + if(!$output->toBool() || !$output->data) { |
|
672 | + return; |
|
673 | + } |
|
602 | 674 | // If the result exists, make each document as an object |
603 | 675 | $content_items = array(); |
604 | 676 | foreach($output->data as $key => $item) |
@@ -695,7 +767,9 @@ discard block |
||
695 | 767 | static $default_domain = null; |
696 | 768 | if(!$domain) |
697 | 769 | { |
698 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
770 | + if(is_null($default_domain)) { |
|
771 | + $default_domain = Context::getDefaultUrl(); |
|
772 | + } |
|
699 | 773 | $domain = $default_domain; |
700 | 774 | } |
701 | 775 | $this->domain = $domain; |
@@ -764,13 +838,21 @@ discard block |
||
764 | 838 | { |
765 | 839 | $title = strip_tags($this->get('title')); |
766 | 840 | |
767 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
841 | + if($cut_size) { |
|
842 | + $title = cut_str($title, $cut_size, $tail); |
|
843 | + } |
|
768 | 844 | |
769 | 845 | $attrs = array(); |
770 | - if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
771 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
846 | + if($this->get('title_bold') == 'Y') { |
|
847 | + $attrs[] = 'font-weight:bold'; |
|
848 | + } |
|
849 | + if($this->get('title_color') && $this->get('title_color') != 'N') { |
|
850 | + $attrs[] = 'color:#'.$this->get('title_color'); |
|
851 | + } |
|
772 | 852 | |
773 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
853 | + if(count($attrs)) { |
|
854 | + $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
855 | + } |
|
774 | 856 | |
775 | 857 | return $title; |
776 | 858 | } |
@@ -18,32 +18,32 @@ discard block |
||
18 | 18 | function proc($args) |
19 | 19 | { |
20 | 20 | // Targets to sort |
21 | - if(!in_array($args->order_target, array('list_order','update_order'))) $args->order_target = 'list_order'; |
|
21 | + if (!in_array($args->order_target, array('list_order', 'update_order'))) $args->order_target = 'list_order'; |
|
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 | // The number of displayed lists |
25 | - $args->list_count = (int)$args->list_count; |
|
26 | - if(!$args->list_count) $args->list_count = 5; |
|
25 | + $args->list_count = (int) $args->list_count; |
|
26 | + if (!$args->list_count) $args->list_count = 5; |
|
27 | 27 | // Cut the length of the title |
28 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
28 | + if (!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
29 | 29 | // Cut the length of contents |
30 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
30 | + if (!$args->content_cut_size) $args->content_cut_size = 100; |
|
31 | 31 | // Viewing options |
32 | - $args->option_view_arr = explode(',',$args->option_view); |
|
32 | + $args->option_view_arr = explode(',', $args->option_view); |
|
33 | 33 | // markup options |
34 | - if(!$args->markup_type) $args->markup_type = 'list'; |
|
34 | + if (!$args->markup_type) $args->markup_type = 'list'; |
|
35 | 35 | // Set variables for internal use |
36 | 36 | $oModuleModel = getModel('module'); |
37 | 37 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
38 | 38 | $site_module_info = Context::get('site_module_info'); |
39 | 39 | // List URLs if a type is RSS |
40 | - if($args->content_type == 'rss') |
|
40 | + if ($args->content_type == 'rss') |
|
41 | 41 | { |
42 | 42 | $args->rss_urls = array(); |
43 | - $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
|
44 | - for($i=0,$c=count($rss_urls);$i<$c;$i++) |
|
43 | + $rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4)); |
|
44 | + for ($i = 0, $c = count($rss_urls); $i < $c; $i++) |
|
45 | 45 | { |
46 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
46 | + if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
47 | 47 | } |
48 | 48 | // Get module information after listing module_srls if the module is not RSS |
49 | 49 | } |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | { |
52 | 52 | $obj = new stdClass(); |
53 | 53 | // Apply to all modules in the site if a target module is not specified |
54 | - if(!$args->module_srls) |
|
54 | + if (!$args->module_srls) |
|
55 | 55 | { |
56 | - $obj->site_srl = (int)$site_module_info->site_srl; |
|
56 | + $obj->site_srl = (int) $site_module_info->site_srl; |
|
57 | 57 | $output = executeQueryArray('widgets.content.getMids', $obj); |
58 | - if($output->data) |
|
58 | + if ($output->data) |
|
59 | 59 | { |
60 | - foreach($output->data as $key => $val) |
|
60 | + foreach ($output->data as $key => $val) |
|
61 | 61 | { |
62 | 62 | $args->modules_info[$val->mid] = $val; |
63 | 63 | $args->module_srls_info[$val->module_srl] = $val; |
@@ -73,35 +73,35 @@ discard block |
||
73 | 73 | { |
74 | 74 | $obj->module_srls = $args->module_srls; |
75 | 75 | $output = executeQueryArray('widgets.content.getMids', $obj); |
76 | - if($output->data) |
|
76 | + if ($output->data) |
|
77 | 77 | { |
78 | - foreach($output->data as $key => $val) |
|
78 | + foreach ($output->data as $key => $val) |
|
79 | 79 | { |
80 | 80 | $args->modules_info[$val->mid] = $val; |
81 | 81 | $args->module_srls_info[$val->module_srl] = $val; |
82 | 82 | $module_srls[] = $val->module_srl; |
83 | 83 | } |
84 | - $idx = explode(',',$args->module_srls); |
|
85 | - for($i=0,$c=count($idx);$i<$c;$i++) |
|
84 | + $idx = explode(',', $args->module_srls); |
|
85 | + for ($i = 0, $c = count($idx); $i < $c; $i++) |
|
86 | 86 | { |
87 | 87 | $srl = $idx[$i]; |
88 | - if(!$args->module_srls_info[$srl]) continue; |
|
88 | + if (!$args->module_srls_info[$srl]) continue; |
|
89 | 89 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | 93 | // Exit if no module is found |
94 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
95 | - $args->module_srl = implode(',',$module_srls); |
|
94 | + if (!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
95 | + $args->module_srl = implode(',', $module_srls); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist |
100 | 100 | */ |
101 | 101 | // tab mode |
102 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
102 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
103 | 103 | { |
104 | - switch($args->content_type) |
|
104 | + switch ($args->content_type) |
|
105 | 105 | { |
106 | 106 | case 'comment': |
107 | 107 | $content_items = $this->_getCommentItems($args); |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | { |
126 | 126 | $content_items = array(); |
127 | 127 | |
128 | - switch($args->content_type) |
|
128 | + switch ($args->content_type) |
|
129 | 129 | { |
130 | 130 | case 'comment': |
131 | - foreach($args->mid_lists as $module_srl => $mid) |
|
131 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
132 | 132 | { |
133 | 133 | $args->module_srl = $module_srl; |
134 | 134 | $content_items[$module_srl] = $this->_getCommentItems($args); |
135 | 135 | } |
136 | 136 | break; |
137 | 137 | case 'image': |
138 | - foreach($args->mid_lists as $module_srl => $mid) |
|
138 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
139 | 139 | { |
140 | 140 | $args->module_srl = $module_srl; |
141 | 141 | $content_items[$module_srl] = $this->_getImageItems($args); |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | $content_items = $this->getRssItems($args); |
146 | 146 | break; |
147 | 147 | case 'trackback': |
148 | - foreach($args->mid_lists as $module_srl => $mid){ |
|
148 | + foreach ($args->mid_lists as $module_srl => $mid) { |
|
149 | 149 | $args->module_srl = $module_srl; |
150 | 150 | $content_items[$module_srl] = $this->_getTrackbackItems($args); |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | default: |
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->_getDocumentItems($args); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - $output = $this->_compile($args,$content_items); |
|
163 | + $output = $this->_compile($args, $content_items); |
|
164 | 164 | return $output; |
165 | 165 | } |
166 | 166 | |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | |
181 | 181 | $content_items = array(); |
182 | 182 | |
183 | - if(!count($output)) return; |
|
183 | + if (!count($output)) return; |
|
184 | 184 | |
185 | - foreach($output as $key => $oComment) |
|
185 | + foreach ($output as $key => $oComment) |
|
186 | 186 | { |
187 | 187 | $attribute = $oComment->getObjectVars(); |
188 | 188 | $title = $oComment->getSummary($args->content_cut_size); |
189 | 189 | $thumbnail = $oComment->getThumbnail(); |
190 | - $url = sprintf("%s#comment_%s",getUrl('','document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl')); |
|
190 | + $url = sprintf("%s#comment_%s", getUrl('', 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl')); |
|
191 | 191 | |
192 | 192 | $attribute->mid = $args->mid_lists[$attribute->module_srl]; |
193 | 193 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | // Get categories |
213 | 213 | $obj = new stdClass(); |
214 | 214 | $obj->module_srl = $args->module_srl; |
215 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
216 | - if($output->toBool() && $output->data) |
|
215 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
216 | + if ($output->toBool() && $output->data) |
|
217 | 217 | { |
218 | - foreach($output->data as $key => $val) |
|
218 | + foreach ($output->data as $key => $val) |
|
219 | 219 | { |
220 | 220 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
221 | 221 | } |
@@ -223,17 +223,17 @@ discard block |
||
223 | 223 | // Get a list of documents |
224 | 224 | $obj->module_srl = $args->module_srl; |
225 | 225 | $obj->sort_index = $args->order_target; |
226 | - $obj->order_type = $args->order_type=="desc"?"asc":"desc"; |
|
226 | + $obj->order_type = $args->order_type == "desc" ? "asc" : "desc"; |
|
227 | 227 | $obj->list_count = $args->list_count; |
228 | 228 | $obj->statusList = array('PUBLIC'); |
229 | 229 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
230 | - if(!$output->toBool() || !$output->data) return; |
|
230 | + if (!$output->toBool() || !$output->data) return; |
|
231 | 231 | // If the result exists, make each document as an object |
232 | 232 | $content_items = array(); |
233 | 233 | $first_thumbnail_idx = -1; |
234 | - if(count($output->data)) |
|
234 | + if (count($output->data)) |
|
235 | 235 | { |
236 | - foreach($output->data as $key => $attribute) |
|
236 | + foreach ($output->data as $key => $attribute) |
|
237 | 237 | { |
238 | 238 | $oDocument = new documentItem(); |
239 | 239 | $oDocument->setAttribute($attribute, false); |
@@ -242,23 +242,23 @@ discard block |
||
242 | 242 | } |
243 | 243 | $oDocumentModel->setToAllDocumentExtraVars(); |
244 | 244 | |
245 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
245 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
246 | 246 | { |
247 | 247 | $oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]]; |
248 | 248 | $document_srl = $oDocument->document_srl; |
249 | 249 | $module_srl = $oDocument->get('module_srl'); |
250 | 250 | $category_srl = $oDocument->get('category_srl'); |
251 | 251 | $thumbnail = $oDocument->getThumbnail(); |
252 | - $content_item = new mcontentItem( $args->module_srls_info[$module_srl]->browser_title ); |
|
252 | + $content_item = new mcontentItem($args->module_srls_info[$module_srl]->browser_title); |
|
253 | 253 | $content_item->adds($oDocument->getObjectVars()); |
254 | 254 | $content_item->setTitle($oDocument->getTitleText()); |
255 | - $content_item->setCategory( $category_lists[$module_srl][$category_srl]->title ); |
|
256 | - $content_item->setDomain( $args->module_srls_info[$module_srl]->domain ); |
|
255 | + $content_item->setCategory($category_lists[$module_srl][$category_srl]->title); |
|
256 | + $content_item->setDomain($args->module_srls_info[$module_srl]->domain); |
|
257 | 257 | $content_item->setContent($oDocument->getSummary($args->content_cut_size)); |
258 | - $content_item->setLink( getSiteUrl($domain,'','document_srl',$document_srl) ); |
|
258 | + $content_item->setLink(getSiteUrl($domain, '', 'document_srl', $document_srl)); |
|
259 | 259 | $content_item->setThumbnail($thumbnail); |
260 | 260 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
261 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
261 | + if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i; |
|
262 | 262 | $content_items[] = $content_item; |
263 | 263 | } |
264 | 264 | |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | $obj->direct_download = 'Y'; |
277 | 277 | $obj->isvalid = 'Y'; |
278 | 278 | // Get categories |
279 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
280 | - if($output->toBool() && $output->data) |
|
279 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
280 | + if ($output->toBool() && $output->data) |
|
281 | 281 | { |
282 | - foreach($output->data as $key => $val) |
|
282 | + foreach ($output->data as $key => $val) |
|
283 | 283 | { |
284 | 284 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
285 | 285 | } |
@@ -288,24 +288,24 @@ discard block |
||
288 | 288 | $obj->list_count = $args->list_count; |
289 | 289 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
290 | 290 | $files_count = count($files_output->data); |
291 | - if(!$files_count) return; |
|
291 | + if (!$files_count) return; |
|
292 | 292 | |
293 | 293 | $content_items = array(); |
294 | 294 | |
295 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
295 | + for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
296 | 296 | |
297 | 297 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
298 | 298 | |
299 | - if(!count($tmp_document_list)) return; |
|
299 | + if (!count($tmp_document_list)) return; |
|
300 | 300 | |
301 | - foreach($tmp_document_list as $oDocument) |
|
301 | + foreach ($tmp_document_list as $oDocument) |
|
302 | 302 | { |
303 | 303 | $attribute = $oDocument->getObjectVars(); |
304 | 304 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
305 | 305 | $domain = $args->module_srls_info[$attribute->module_srl]->domain; |
306 | 306 | $category = $category_lists[$attribute->module_srl]->text; |
307 | 307 | $content = $oDocument->getSummary($args->content_cut_size); |
308 | - $url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount()); |
|
308 | + $url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount()); |
|
309 | 309 | $thumbnail = $oDocument->getThumbnail(); |
310 | 310 | $content_item = new mcontentItem($browser_title); |
311 | 311 | $content_item->adds($attribute); |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | $content_items = array(); |
328 | 328 | $args->mid_lists = array(); |
329 | 329 | |
330 | - foreach($args->rss_urls as $key => $rss) |
|
330 | + foreach ($args->rss_urls as $key => $rss) |
|
331 | 331 | { |
332 | 332 | $args->rss_url = $rss; |
333 | 333 | $content_item = $this->_getRssItems($args); |
334 | - if(count($content_item) > 0) |
|
334 | + if (count($content_item) > 0) |
|
335 | 335 | { |
336 | 336 | $browser_title = $content_item[0]->getBrowserTitle(); |
337 | 337 | $args->mid_lists[] = $browser_title; |
@@ -339,40 +339,40 @@ discard block |
||
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
342 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
343 | 343 | { |
344 | 344 | $items = array(); |
345 | - foreach($content_items as $key => $val) |
|
345 | + foreach ($content_items as $key => $val) |
|
346 | 346 | { |
347 | - foreach($val as $k => $v) |
|
347 | + foreach ($val as $k => $v) |
|
348 | 348 | { |
349 | 349 | $date = $v->get('regdate'); |
350 | - $i=0; |
|
351 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
352 | - $items[sprintf('%s%02d',$date,$i)] = $v; |
|
350 | + $i = 0; |
|
351 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
352 | + $items[sprintf('%s%02d', $date, $i)] = $v; |
|
353 | 353 | } |
354 | 354 | } |
355 | - if($args->order_type =='asc') ksort($items); |
|
355 | + if ($args->order_type == 'asc') ksort($items); |
|
356 | 356 | else krsort($items); |
357 | - $content_items = array_slice(array_values($items),0,$args->list_count); |
|
357 | + $content_items = array_slice(array_values($items), 0, $args->list_count); |
|
358 | 358 | } return $content_items; |
359 | 359 | } |
360 | 360 | |
361 | 361 | function _getRssBody($value) |
362 | 362 | { |
363 | - if(!$value || is_string($value)) return $value; |
|
364 | - if(is_object($value)) $value = get_object_vars($value); |
|
363 | + if (!$value || is_string($value)) return $value; |
|
364 | + if (is_object($value)) $value = get_object_vars($value); |
|
365 | 365 | $body = null; |
366 | - if(!count($value)) return; |
|
367 | - foreach($value as $key => $val) |
|
366 | + if (!count($value)) return; |
|
367 | + foreach ($value as $key => $val) |
|
368 | 368 | { |
369 | - if($key == 'body') |
|
369 | + if ($key == 'body') |
|
370 | 370 | { |
371 | 371 | $body = $val; |
372 | 372 | continue; |
373 | 373 | } |
374 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
375 | - if($body !== null) return $body; |
|
374 | + if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val); |
|
375 | + if ($body !== null) return $body; |
|
376 | 376 | } |
377 | 377 | return $body; |
378 | 378 | } |
@@ -383,17 +383,17 @@ discard block |
||
383 | 383 | // Replace tags such as </p> , </div> , </li> and others to a whitespace |
384 | 384 | $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); |
385 | 385 | // Remove Tag |
386 | - $content = preg_replace('!<([^>]*?)>!is','', $content); |
|
386 | + $content = preg_replace('!<([^>]*?)>!is', '', $content); |
|
387 | 387 | // Replace tags to < , > , " |
388 | - $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); |
|
388 | + $content = str_replace(array('<', '>', '"', ' '), array('<', '>', '"', ' '), $content); |
|
389 | 389 | // Delete a series of whitespaces |
390 | 390 | $content = preg_replace('/ ( +)/is', ' ', $content); |
391 | 391 | // Truncate string |
392 | 392 | $content = trim(cut_str($content, $str_size, $tail)); |
393 | 393 | // Replace back < , > , " to theoriginal tags |
394 | - $content = str_replace(array('<','>','"'),array('<','>','"'), $content); |
|
394 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
395 | 395 | // Fixed a newline bug on a set of consecutive English letters |
396 | - $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); |
|
396 | + $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content); |
|
397 | 397 | return $content; |
398 | 398 | } |
399 | 399 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | function requestFeedContents($rss_url) |
406 | 406 | { |
407 | - $rss_url = str_replace('&','&',Context::convertEncodingStr($rss_url)); |
|
407 | + $rss_url = str_replace('&', '&', Context::convertEncodingStr($rss_url)); |
|
408 | 408 | return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml'); |
409 | 409 | } |
410 | 410 | |
@@ -416,52 +416,52 @@ discard block |
||
416 | 416 | $buff = $this->requestFeedContents($args->rss_url); |
417 | 417 | |
418 | 418 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
419 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
419 | + if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
420 | 420 | |
421 | 421 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
422 | 422 | |
423 | 423 | $oXmlParser = new XmlParser(); |
424 | 424 | $xml_doc = $oXmlParser->parse($buff); |
425 | 425 | $rss = new stdClass(); |
426 | - if($xml_doc->rss) |
|
426 | + if ($xml_doc->rss) |
|
427 | 427 | { |
428 | 428 | $rss->title = $xml_doc->rss->channel->title->body; |
429 | 429 | $rss->link = $xml_doc->rss->channel->link->body; |
430 | 430 | |
431 | 431 | $items = $xml_doc->rss->channel->item; |
432 | 432 | |
433 | - if(!$items) return; |
|
434 | - if($items && !is_array($items)) $items = array($items); |
|
433 | + if (!$items) return; |
|
434 | + if ($items && !is_array($items)) $items = array($items); |
|
435 | 435 | |
436 | 436 | $content_items = array(); |
437 | 437 | |
438 | 438 | foreach ($items as $key => $value) |
439 | 439 | { |
440 | - if($key >= $args->list_count) break; |
|
440 | + if ($key >= $args->list_count) break; |
|
441 | 441 | unset($item); |
442 | 442 | $item = new stdClass(); |
443 | 443 | |
444 | - foreach($value as $key2 => $value2) |
|
444 | + foreach ($value as $key2 => $value2) |
|
445 | 445 | { |
446 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
446 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
447 | 447 | $item->{$key2} = $this->_getRssBody($value2); |
448 | 448 | } |
449 | 449 | |
450 | 450 | $content_item = new mcontentItem($rss->title); |
451 | 451 | $content_item->setContentsLink($rss->link); |
452 | 452 | $content_item->setTitle($item->title); |
453 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
453 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
454 | 454 | //$content_item->setCategory($item->category); |
455 | - $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description); |
|
455 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description); |
|
456 | 456 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
457 | 457 | $content_item->setLink($item->link); |
458 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
458 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
459 | 459 | $content_item->setRegdate($date); |
460 | 460 | |
461 | 461 | $content_items[] = $content_item; |
462 | 462 | } |
463 | 463 | } |
464 | - else if($xml_doc->{'rdf:rdf'}) |
|
464 | + else if ($xml_doc->{'rdf:rdf'}) |
|
465 | 465 | { |
466 | 466 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters) Fixed by misol |
467 | 467 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -469,102 +469,102 @@ discard block |
||
469 | 469 | |
470 | 470 | $items = $xml_doc->{'rdf:rdf'}->item; |
471 | 471 | |
472 | - if(!$items) return; |
|
473 | - if($items && !is_array($items)) $items = array($items); |
|
472 | + if (!$items) return; |
|
473 | + if ($items && !is_array($items)) $items = array($items); |
|
474 | 474 | |
475 | 475 | $content_items = array(); |
476 | 476 | |
477 | 477 | foreach ($items as $key => $value) |
478 | 478 | { |
479 | - if($key >= $args->list_count) break; |
|
479 | + if ($key >= $args->list_count) break; |
|
480 | 480 | unset($item); |
481 | 481 | $item = new stdClass(); |
482 | 482 | |
483 | - foreach($value as $key2 => $value2) |
|
483 | + foreach ($value as $key2 => $value2) |
|
484 | 484 | { |
485 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
485 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
486 | 486 | $item->{$key2} = $this->_getRssBody($value2); |
487 | 487 | } |
488 | 488 | |
489 | 489 | $content_item = new mcontentItem($rss->title); |
490 | 490 | $content_item->setContentsLink($rss->link); |
491 | 491 | $content_item->setTitle($item->title); |
492 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
492 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
493 | 493 | //$content_item->setCategory($item->category); |
494 | - $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description); |
|
494 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description); |
|
495 | 495 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
496 | 496 | $content_item->setLink($item->link); |
497 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
497 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
498 | 498 | $content_item->setRegdate($date); |
499 | 499 | |
500 | 500 | $content_items[] = $content_item; |
501 | 501 | } |
502 | 502 | } |
503 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
503 | + else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
504 | 504 | { |
505 | 505 | // Atom 1.0 spec supported by misol |
506 | 506 | $rss->title = $xml_doc->feed->title->body; |
507 | 507 | $links = $xml_doc->feed->link; |
508 | - if(is_array($links)) |
|
508 | + if (is_array($links)) |
|
509 | 509 | { |
510 | 510 | foreach ($links as $value) |
511 | 511 | { |
512 | - if($value->attrs->rel == 'alternate') |
|
512 | + if ($value->attrs->rel == 'alternate') |
|
513 | 513 | { |
514 | 514 | $rss->link = $value->attrs->href; |
515 | 515 | break; |
516 | 516 | } |
517 | 517 | } |
518 | 518 | } |
519 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
519 | + else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
520 | 520 | |
521 | 521 | $items = $xml_doc->feed->entry; |
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) break; |
|
530 | + if ($key >= $args->list_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 mcontentItem($rss->title); |
540 | 540 | $links = $value->link; |
541 | - if(is_array($links)) |
|
541 | + if (is_array($links)) |
|
542 | 542 | { |
543 | 543 | foreach ($links as $val) |
544 | 544 | { |
545 | - if($val->attrs->rel == 'alternate') |
|
545 | + if ($val->attrs->rel == 'alternate') |
|
546 | 546 | { |
547 | 547 | $item->link = $val->attrs->href; |
548 | 548 | break; |
549 | 549 | } |
550 | 550 | } |
551 | 551 | } |
552 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
552 | + else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
553 | 553 | |
554 | 554 | $content_item->setContentsLink($rss->link); |
555 | - if($item->title) |
|
555 | + if ($item->title) |
|
556 | 556 | { |
557 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
557 | + if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
558 | 558 | } |
559 | 559 | $content_item->setTitle($item->title); |
560 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
560 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
561 | 561 | $content_item->setAuthorSite($value->author->uri->body); |
562 | 562 | |
563 | 563 | //$content_item->setCategory($item->category); |
564 | 564 | $item->description = ($item->content) ? $item->content : $item->description = $item->summary; |
565 | - $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description); |
|
565 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description); |
|
566 | 566 | |
567 | - if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
567 | + if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
568 | 568 | { |
569 | 569 | $item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
570 | 570 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
574 | 574 | $content_item->setLink($item->link); |
575 | - $date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'}))); |
|
575 | + $date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'}))); |
|
576 | 576 | $content_item->setRegdate($date); |
577 | 577 | |
578 | 578 | $content_items[] = $content_item; |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | return $content_items; |
582 | 582 | } |
583 | 583 | |
584 | - function _getTrackbackItems($args){ |
|
584 | + function _getTrackbackItems($args) { |
|
585 | 585 | // Get categories |
586 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
587 | - if($output->toBool() && $output->data) |
|
586 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
587 | + if ($output->toBool() && $output->data) |
|
588 | 588 | { |
589 | - foreach($output->data as $key => $val) { |
|
589 | + foreach ($output->data as $key => $val) { |
|
590 | 590 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
591 | 591 | } |
592 | 592 | } |
@@ -598,14 +598,14 @@ discard block |
||
598 | 598 | $oTrackbackModel = getModel('trackback'); |
599 | 599 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
600 | 600 | // If an error occurs, just ignore it. |
601 | - if(!$output->toBool() || !$output->data) return; |
|
601 | + if (!$output->toBool() || !$output->data) return; |
|
602 | 602 | // If the result exists, make each document as an object |
603 | 603 | $content_items = array(); |
604 | - foreach($output->data as $key => $item) |
|
604 | + foreach ($output->data as $key => $item) |
|
605 | 605 | { |
606 | 606 | $domain = $args->module_srls_info[$item->module_srl]->domain; |
607 | 607 | $category = $category_lists[$item->module_srl]->text; |
608 | - $url = getSiteUrl($domain,'','document_srl',$item->document_srl); |
|
608 | + $url = getSiteUrl($domain, '', 'document_srl', $item->document_srl); |
|
609 | 609 | $browser_title = $args->module_srls_info[$item->module_srl]->browser_title; |
610 | 610 | |
611 | 611 | $content_item = new mcontentItem($browser_title); |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | $content_item->setTitle($item->title); |
614 | 614 | $content_item->setCategory($category); |
615 | 615 | $content_item->setNickName($item->blog_name); |
616 | - $content_item->setContent($item->excerpt); ///<< |
|
617 | - $content_item->setDomain($domain); ///<< |
|
616 | + $content_item->setContent($item->excerpt); ///<< |
|
617 | + $content_item->setDomain($domain); ///<< |
|
618 | 618 | $content_item->setLink($url); |
619 | 619 | $content_item->add('mid', $args->mid_lists[$item->module_srl]); |
620 | 620 | $content_item->setRegdate($item->regdate); |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | return $content_items; |
624 | 624 | } |
625 | 625 | |
626 | - function _compile($args,$content_items) |
|
626 | + function _compile($args, $content_items) |
|
627 | 627 | { |
628 | 628 | $oTemplate = &TemplateHandler::getInstance(); |
629 | 629 | // Set variables for widget |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | var $contents_link = null; |
672 | 672 | var $domain = null; |
673 | 673 | |
674 | - function mcontentItem($browser_title='') |
|
674 | + function mcontentItem($browser_title = '') |
|
675 | 675 | { |
676 | 676 | $this->browser_title = $browser_title; |
677 | 677 | } |
@@ -681,58 +681,58 @@ discard block |
||
681 | 681 | } |
682 | 682 | function setFirstThumbnailIdx($first_thumbnail_idx) |
683 | 683 | { |
684 | - if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1) { |
|
684 | + if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1) { |
|
685 | 685 | $this->has_first_thumbnail_idx = true; |
686 | - $this->first_thumbnail_idx= $first_thumbnail_idx; |
|
686 | + $this->first_thumbnail_idx = $first_thumbnail_idx; |
|
687 | 687 | } |
688 | 688 | } |
689 | 689 | function setExtraImages($extra_images) |
690 | 690 | { |
691 | - $this->add('extra_images',$extra_images); |
|
691 | + $this->add('extra_images', $extra_images); |
|
692 | 692 | } |
693 | 693 | function setDomain($domain) |
694 | 694 | { |
695 | 695 | static $default_domain = null; |
696 | - if(!$domain) |
|
696 | + if (!$domain) |
|
697 | 697 | { |
698 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
698 | + if (is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
699 | 699 | $domain = $default_domain; |
700 | 700 | } |
701 | 701 | $this->domain = $domain; |
702 | 702 | } |
703 | 703 | function setLink($url) |
704 | 704 | { |
705 | - $this->add('url',$url); |
|
705 | + $this->add('url', $url); |
|
706 | 706 | } |
707 | 707 | function setTitle($title) |
708 | 708 | { |
709 | - $this->add('title',$title); |
|
709 | + $this->add('title', $title); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | function setThumbnail($thumbnail) |
713 | 713 | { |
714 | - $this->add('thumbnail',$thumbnail); |
|
714 | + $this->add('thumbnail', $thumbnail); |
|
715 | 715 | } |
716 | 716 | function setContent($content) |
717 | 717 | { |
718 | - $this->add('content',$content); |
|
718 | + $this->add('content', $content); |
|
719 | 719 | } |
720 | 720 | function setRegdate($regdate) |
721 | 721 | { |
722 | - $this->add('regdate',$regdate); |
|
722 | + $this->add('regdate', $regdate); |
|
723 | 723 | } |
724 | 724 | function setNickName($nick_name) |
725 | 725 | { |
726 | - $this->add('nick_name',$nick_name); |
|
726 | + $this->add('nick_name', $nick_name); |
|
727 | 727 | } |
728 | 728 | // Save author's homepage url by misol |
729 | 729 | function setAuthorSite($site_url) |
730 | 730 | { |
731 | - $this->add('author_site',$site_url); |
|
731 | + $this->add('author_site', $site_url); |
|
732 | 732 | } |
733 | 733 | function setCategory($category) |
734 | 734 | { |
735 | - $this->add('category',$category); |
|
735 | + $this->add('category', $category); |
|
736 | 736 | } |
737 | 737 | function getBrowserTitle() |
738 | 738 | { |
@@ -760,17 +760,17 @@ discard block |
||
760 | 760 | { |
761 | 761 | return $this->get('module_srl'); |
762 | 762 | } |
763 | - function getTitle($cut_size = 0, $tail='...') |
|
763 | + function getTitle($cut_size = 0, $tail = '...') |
|
764 | 764 | { |
765 | 765 | $title = strip_tags($this->get('title')); |
766 | 766 | |
767 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
767 | + if ($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
768 | 768 | |
769 | 769 | $attrs = array(); |
770 | - if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
771 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
770 | + if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
771 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
772 | 772 | |
773 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
773 | + if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
774 | 774 | |
775 | 775 | return $title; |
776 | 776 | } |
@@ -793,12 +793,12 @@ discard block |
||
793 | 793 | function getCommentCount() |
794 | 794 | { |
795 | 795 | $comment_count = $this->get('comment_count'); |
796 | - return $comment_count>0 ? $comment_count : ''; |
|
796 | + return $comment_count > 0 ? $comment_count : ''; |
|
797 | 797 | } |
798 | 798 | function getTrackbackCount() |
799 | 799 | { |
800 | 800 | $trackback_count = $this->get('trackback_count'); |
801 | - return $trackback_count>0 ? $trackback_count : ''; |
|
801 | + return $trackback_count > 0 ? $trackback_count : ''; |
|
802 | 802 | } |
803 | 803 | function getRegdate($format = 'Y.m.d H:i:s') |
804 | 804 | { |
@@ -286,6 +286,9 @@ |
||
286 | 286 | exit(); |
287 | 287 | } |
288 | 288 | |
289 | + /** |
|
290 | + * @param string $string |
|
291 | + */ |
|
289 | 292 | function createCaptchaAudio($string) |
290 | 293 | { |
291 | 294 | $data = ''; |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if(!defined("__XE__")) { |
|
5 | + exit(); |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * @file captcha.addon.php |
@@ -85,8 +87,7 @@ discard block |
||
85 | 87 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); |
86 | 88 | $ModuleHandler->_setInputValueToSession(); |
87 | 89 | } |
88 | - } |
|
89 | - else |
|
90 | + } else |
|
90 | 91 | { |
91 | 92 | Context::addHtmlHeader('<script> |
92 | 93 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
@@ -216,8 +217,7 @@ discard block |
||
216 | 217 | |
217 | 218 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
218 | 219 | imagecolortransparent($im[$i + 1], $background_color); |
219 | - } |
|
220 | - else |
|
220 | + } else |
|
221 | 221 | { |
222 | 222 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); |
223 | 223 | } |
@@ -315,7 +315,9 @@ discard block |
||
315 | 315 | |
316 | 316 | function compareCaptcha() |
317 | 317 | { |
318 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
318 | + if(!in_array(Context::get('act'), $this->target_acts)) { |
|
319 | + return true; |
|
320 | + } |
|
319 | 321 | |
320 | 322 | if($_SESSION['member_captcha_authed']) |
321 | 323 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if (!defined("__XE__")) exit(); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @file captcha.addon.php |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | * @brief Captcha for a particular action |
10 | 10 | * English alphabets and voice verification added |
11 | 11 | * */ |
12 | -if(!class_exists('AddonCaptcha', false)) |
|
12 | +if (!class_exists('AddonCaptcha', false)) |
|
13 | 13 | { |
14 | 14 | // On the mobile mode, XE Core does not load jquery and xe.js as normal. |
15 | - if(Mobile::isFromMobilePhone()) |
|
15 | + if (Mobile::isFromMobilePhone()) |
|
16 | 16 | { |
17 | 17 | Context::loadFile(array('./common/js/jquery.min.js', 'head', NULL, -100000), true); |
18 | 18 | Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | function before_module_proc() |
33 | 33 | { |
34 | - if($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
34 | + if ($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
35 | 35 | { |
36 | 36 | unset($_SESSION['captcha_authed']); |
37 | 37 | } |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | function before_module_init(&$ModuleHandler) |
41 | 41 | { |
42 | 42 | $logged_info = Context::get('logged_info'); |
43 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
43 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
44 | 44 | { |
45 | 45 | return false; |
46 | 46 | } |
47 | - if($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
47 | + if ($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
48 | 48 | { |
49 | 49 | return false; |
50 | 50 | } |
51 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
51 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
52 | 52 | { |
53 | 53 | $_SESSION['captcha_authed'] = false; |
54 | 54 | } |
55 | - if($_SESSION['captcha_authed']) |
|
55 | + if ($_SESSION['captcha_authed']) |
|
56 | 56 | { |
57 | 57 | return false; |
58 | 58 | } |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | |
62 | 62 | $this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); |
63 | 63 | |
64 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
64 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
65 | 65 | { |
66 | - if($type == 'inline') |
|
66 | + if ($type == 'inline') |
|
67 | 67 | { |
68 | - if(!$this->compareCaptcha()) |
|
68 | + if (!$this->compareCaptcha()) |
|
69 | 69 | { |
70 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
70 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
71 | 71 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; |
72 | 72 | $_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); |
73 | 73 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | { |
80 | 80 | Context::addHtmlHeader('<script> |
81 | 81 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
82 | - captchaTargetAct.push("' . implode('","', $this->target_acts) . '"); |
|
82 | + captchaTargetAct.push("' . implode('","', $this->target_acts).'"); |
|
83 | 83 | </script>'); |
84 | 84 | Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | 88 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module |
89 | - if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
89 | + if (!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
90 | 90 | { |
91 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
91 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
92 | 92 | $ModuleHandler->error = "captcha_denied"; |
93 | 93 | } |
94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | function createKeyword() |
99 | 99 | { |
100 | 100 | $type = Context::get('captchaType'); |
101 | - if($type == 'inline' && $_SESSION['captcha_keyword']) |
|
101 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) |
|
102 | 102 | { |
103 | 103 | return; |
104 | 104 | } |
@@ -111,19 +111,19 @@ discard block |
||
111 | 111 | |
112 | 112 | function before_module_init_setCaptchaSession() |
113 | 113 | { |
114 | - if($_SESSION['captcha_authed']) |
|
114 | + if ($_SESSION['captcha_authed']) |
|
115 | 115 | { |
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | // Load language files |
119 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
119 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
120 | 120 | // Generate keywords |
121 | 121 | $this->createKeyword(); |
122 | 122 | |
123 | 123 | $target = Context::getLang('target_captcha'); |
124 | 124 | header("Content-Type: text/xml; charset=UTF-8"); |
125 | 125 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
126 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
126 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
127 | 127 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
128 | 128 | header("Cache-Control: post-check=0, pre-check=0", false); |
129 | 129 | header("Pragma: no-cache"); |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | |
141 | 141 | function before_module_init_captchaImage() |
142 | 142 | { |
143 | - if($_SESSION['captcha_authed']) |
|
143 | + if ($_SESSION['captcha_authed']) |
|
144 | 144 | { |
145 | 145 | return false; |
146 | 146 | } |
147 | - if(Context::get('renew')) |
|
147 | + if (Context::get('renew')) |
|
148 | 148 | { |
149 | 149 | $this->createKeyword(); |
150 | 150 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | function createCaptchaImage($string) |
167 | 167 | { |
168 | 168 | $arr = array(); |
169 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
169 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
170 | 170 | { |
171 | 171 | $arr[] = $string{$i}; |
172 | 172 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | shuffle($deg); |
189 | 189 | |
190 | 190 | // Create an image for each letter |
191 | - foreach($arr as $i => $str) |
|
191 | + foreach ($arr as $i => $str) |
|
192 | 192 | { |
193 | 193 | $im[$i + 1] = @imagecreate($w, $h); |
194 | 194 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $ran = range(1, 20); |
199 | 199 | shuffle($ran); |
200 | 200 | |
201 | - if(function_exists('imagerotate')) |
|
201 | + if (function_exists('imagerotate')) |
|
202 | 202 | { |
203 | 203 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); |
204 | 204 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | // Combine images of each character |
216 | - for($i = 1, $c = count($im); $i<$c; $i++) |
|
216 | + for ($i = 1, $c = count($im); $i < $c; $i++) |
|
217 | 217 | { |
218 | 218 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); |
219 | 219 | imagedestroy($im[$i]); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); |
226 | 226 | imagedestroy($im[0]); |
227 | 227 | |
228 | - if(function_exists('imageantialias')) |
|
228 | + if (function_exists('imageantialias')) |
|
229 | 229 | { |
230 | 230 | imageantialias($big, true); |
231 | 231 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $h = $h * $big_count; |
238 | 238 | $d = array_pop($deg); |
239 | 239 | |
240 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
240 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
241 | 241 | { |
242 | 242 | imageline($big, 0, $i + $d, $w, $i, $line_color); |
243 | 243 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $x = range(0, ($w - 10)); |
246 | 246 | shuffle($x); |
247 | 247 | |
248 | - for($i = 0; $i < 200; $i++) |
|
248 | + for ($i = 0; $i < 200; $i++) |
|
249 | 249 | { |
250 | 250 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); |
251 | 251 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | function before_module_init_captchaAudio() |
257 | 257 | { |
258 | - if($_SESSION['captcha_authed']) |
|
258 | + if ($_SESSION['captcha_authed']) |
|
259 | 259 | { |
260 | 260 | return false; |
261 | 261 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\""); |
268 | 268 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
269 | 269 | header('Expires: Sun, 1 Jan 2000 12:00:00 GMT'); |
270 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); |
|
271 | - header('Content-Length: ' . strlen($data)); |
|
270 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); |
|
271 | + header('Content-Length: '.strlen($data)); |
|
272 | 272 | |
273 | 273 | echo $data; |
274 | 274 | Context::close(); |
@@ -279,17 +279,17 @@ discard block |
||
279 | 279 | { |
280 | 280 | $data = ''; |
281 | 281 | $_audio = './addons/captcha/audio/F_%s.mp3'; |
282 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
282 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
283 | 283 | { |
284 | 284 | $_data = FileHandler::readFile(sprintf($_audio, $string{$i})); |
285 | 285 | |
286 | 286 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data |
287 | 287 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes |
288 | 288 | |
289 | - for($j = $start; $j < $datalen; $j+=64) |
|
289 | + for ($j = $start; $j < $datalen; $j += 64) |
|
290 | 290 | { |
291 | 291 | $ch = ord($_data{$j}); |
292 | - if($ch < 9 || $ch > 119) |
|
292 | + if ($ch < 9 || $ch > 119) |
|
293 | 293 | { |
294 | 294 | continue; |
295 | 295 | } |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | |
305 | 305 | function compareCaptcha() |
306 | 306 | { |
307 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
307 | + if (!in_array(Context::get('act'), $this->target_acts)) return true; |
|
308 | 308 | |
309 | - if($_SESSION['captcha_authed']) |
|
309 | + if ($_SESSION['captcha_authed']) |
|
310 | 310 | { |
311 | 311 | return true; |
312 | 312 | } |
313 | 313 | |
314 | - if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
314 | + if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
315 | 315 | { |
316 | 316 | $_SESSION['captcha_authed'] = true; |
317 | 317 | return true; |
@@ -324,14 +324,14 @@ discard block |
||
324 | 324 | |
325 | 325 | function before_module_init_captchaCompare() |
326 | 326 | { |
327 | - if(!$this->compareCaptcha()) |
|
327 | + if (!$this->compareCaptcha()) |
|
328 | 328 | { |
329 | 329 | return false; |
330 | 330 | } |
331 | 331 | |
332 | 332 | header("Content-Type: text/xml; charset=UTF-8"); |
333 | 333 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
334 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
334 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
335 | 335 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
336 | 336 | header("Cache-Control: post-check=0, pre-check=0", false); |
337 | 337 | header("Pragma: no-cache"); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | unset($_SESSION['captcha_authed']); |
347 | 347 | $this->createKeyword(); |
348 | 348 | |
349 | - $swfURL = getUrl() . 'addons/captcha/swf/play.swf'; |
|
349 | + $swfURL = getUrl().'addons/captcha/swf/play.swf'; |
|
350 | 350 | Context::unloadFile('./addons/captcha/captcha.min.js'); |
351 | 351 | Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body')); |
352 | 352 | |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | |
385 | 385 | $oAddonCaptcha = &$GLOBALS['__AddonCaptcha__']; |
386 | 386 | |
387 | -if(method_exists($oAddonCaptcha, $called_position)) |
|
387 | +if (method_exists($oAddonCaptcha, $called_position)) |
|
388 | 388 | { |
389 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
389 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
390 | 390 | { |
391 | 391 | return false; |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | 395 | $addon_act = Context::get('captcha_action'); |
396 | -if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act)) |
|
396 | +if ($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act)) |
|
397 | 397 | { |
398 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
398 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this))) |
|
399 | 399 | { |
400 | 400 | return false; |
401 | 401 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * Display point level icon before user name when point system is enabled. |
13 | 13 | * */ |
14 | 14 | // return unless before_display_content |
15 | -if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
15 | +if ($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
16 | 16 | { |
17 | 17 | return; |
18 | 18 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | require_once(_XE_PATH_ . 'addons/point_level_icon/point_level_icon.lib.php'); |
21 | 21 | |
22 | 22 | $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output); |
23 | -if($temp_output) |
|
23 | +if ($temp_output) |
|
24 | 24 | { |
25 | 25 | $output = $temp_output; |
26 | 26 | } |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | * Enter your open ID service information on the configuration. |
14 | 14 | * */ |
15 | 15 | // Execute only wen called_position is before_module_init |
16 | -if($called_position != 'before_module_init') |
|
16 | +if ($called_position != 'before_module_init') |
|
17 | 17 | { |
18 | 18 | return; |
19 | 19 | } |
20 | 20 | // Get add-on settings(openid_delegation_id) |
21 | -if(!$addon_info->server || !$addon_info->delegate || !$addon_info->xrds) |
|
21 | +if (!$addon_info->server || !$addon_info->delegate || !$addon_info->xrds) |
|
22 | 22 | { |
23 | 23 | return; |
24 | 24 | } |
25 | 25 | |
26 | 26 | $header_script = sprintf( |
27 | - '<link rel="openid.server" href="%s" />' . "\n" . |
|
28 | - '<link rel="openid.delegate" href="%s" />' . "\n" . |
|
27 | + '<link rel="openid.server" href="%s" />'."\n". |
|
28 | + '<link rel="openid.delegate" href="%s" />'."\n". |
|
29 | 29 | '<meta http-equiv="X-XRDS-Location" content="%s" />', |
30 | 30 | $addon_info->server, |
31 | 31 | $addon_info->delegate, |
@@ -21,8 +21,7 @@ |
||
21 | 21 | if($absolute_url) |
22 | 22 | { |
23 | 23 | return getFullUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
24 | - } |
|
25 | - else |
|
24 | + } else |
|
26 | 25 | { |
27 | 26 | return getUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
28 | 27 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function getInstance($url) |
24 | 24 | { |
25 | - if(!$GLOBALS['__CacheMemcache__']) |
|
25 | + if (!$GLOBALS['__CacheMemcache__']) |
|
26 | 26 | { |
27 | 27 | $GLOBALS['__CacheMemcache__'] = new CacheMemcache($url); |
28 | 28 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $config['url'] = is_array($url) ? $url : array($url); |
43 | 43 | $this->Memcache = new Memcache; |
44 | 44 | |
45 | - foreach($config['url'] as $url) |
|
45 | + foreach ($config['url'] as $url) |
|
46 | 46 | { |
47 | 47 | $info = parse_url($url); |
48 | 48 | $this->Memcache->addServer($info['host'], $info['port']); |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | */ |
57 | 57 | function isSupport() |
58 | 58 | { |
59 | - if(isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
59 | + if (isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
60 | 60 | { |
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | |
64 | - if($this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1)) |
|
64 | + if ($this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1)) |
|
65 | 65 | { |
66 | 66 | $GLOBALS['XE_MEMCACHE_SUPPORT'] = true; |
67 | 67 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | function getKey($key) |
83 | 83 | { |
84 | - return md5(_XE_PATH_ . $key); |
|
84 | + return md5(_XE_PATH_.$key); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function put($key, $buff, $valid_time = 0) |
105 | 105 | { |
106 | - if($valid_time == 0) |
|
106 | + if ($valid_time == 0) |
|
107 | 107 | { |
108 | 108 | $valid_time = $this->valid_time; |
109 | 109 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | $_key = $this->getKey($key); |
125 | 125 | |
126 | 126 | $obj = $this->Memcache->get($_key); |
127 | - if(!$obj || !is_array($obj)) |
|
127 | + if (!$obj || !is_array($obj)) |
|
128 | 128 | { |
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | unset($obj[1]); |
132 | 132 | |
133 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
133 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
134 | 134 | { |
135 | 135 | $this->_delete($_key); |
136 | 136 | return false; |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | { |
154 | 154 | $_key = $this->getKey($key); |
155 | 155 | $obj = $this->Memcache->get($_key); |
156 | - if(!$obj || !is_array($obj)) |
|
156 | + if (!$obj || !is_array($obj)) |
|
157 | 157 | { |
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | |
161 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
161 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
162 | 162 | { |
163 | 163 | $this->_delete($_key); |
164 | 164 | return false; |
@@ -111,8 +111,7 @@ |
||
111 | 111 | if($this->limit) |
112 | 112 | { |
113 | 113 | return $this->limit->toString(); |
114 | - } |
|
115 | - else |
|
114 | + } else |
|
116 | 115 | { |
117 | 116 | return ""; |
118 | 117 | } |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | function ConditionGroup($conditions, $pipe = "") |
33 | 33 | { |
34 | 34 | $this->conditions = array(); |
35 | - foreach($conditions as $condition) |
|
35 | + foreach ($conditions as $condition) |
|
36 | 36 | { |
37 | - if($condition->show()) |
|
37 | + if ($condition->show()) |
|
38 | 38 | { |
39 | 39 | $this->conditions[] = $condition; |
40 | 40 | } |
41 | 41 | } |
42 | - if(count($this->conditions) === 0) |
|
42 | + if (count($this->conditions) === 0) |
|
43 | 43 | { |
44 | 44 | $this->_show = false; |
45 | 45 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | function setPipe($pipe) |
60 | 60 | { |
61 | - if($this->pipe !== $pipe) |
|
61 | + if ($this->pipe !== $pipe) |
|
62 | 62 | { |
63 | 63 | $this->_group = null; |
64 | 64 | } |
@@ -72,24 +72,24 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function toString($with_value = true) |
74 | 74 | { |
75 | - if(!isset($this->_group)) |
|
75 | + if (!isset($this->_group)) |
|
76 | 76 | { |
77 | 77 | $cond_indx = 0; |
78 | 78 | $group = ''; |
79 | 79 | |
80 | - foreach($this->conditions as $condition) |
|
80 | + foreach ($this->conditions as $condition) |
|
81 | 81 | { |
82 | - if($cond_indx === 0) |
|
82 | + if ($cond_indx === 0) |
|
83 | 83 | { |
84 | 84 | $condition->setPipe(""); |
85 | 85 | } |
86 | - $group .= $condition->toString($with_value) . ' '; |
|
86 | + $group .= $condition->toString($with_value).' '; |
|
87 | 87 | $cond_indx++; |
88 | 88 | } |
89 | 89 | |
90 | - if($this->pipe !== "" && trim($group) !== '') |
|
90 | + if ($this->pipe !== "" && trim($group) !== '') |
|
91 | 91 | { |
92 | - $group = $this->pipe . ' (' . $group . ')'; |
|
92 | + $group = $this->pipe.' ('.$group.')'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $this->_group = $group; |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | function getArguments() |
105 | 105 | { |
106 | 106 | $args = array(); |
107 | - foreach($this->conditions as $condition) |
|
107 | + foreach ($this->conditions as $condition) |
|
108 | 108 | { |
109 | 109 | $arg = $condition->getArgument(); |
110 | - if($arg) |
|
110 | + if ($arg) |
|
111 | 111 | { |
112 | 112 | $args[] = $arg; |
113 | 113 | } |