@@ -17,11 +17,9 @@ discard block |
||
17 | 17 | public function getValues($year = null, $month = null){ |
18 | 18 | if($year && $month){ |
19 | 19 | $this->setYear($year)->setMonth($month); |
20 | - } |
|
21 | - else if(isset($_GET['year']) && isset($_GET['month'])){ |
|
20 | + } else if(isset($_GET['year']) && isset($_GET['month'])){ |
|
22 | 21 | $this->setYear($_GET['year'])->setMonth($_GET['month']); |
23 | - } |
|
24 | - else { |
|
22 | + } else { |
|
25 | 23 | $this->setYear(date('Y'))->setMonth(date('m')); |
26 | 24 | } |
27 | 25 | } |
@@ -270,8 +268,7 @@ discard block |
||
270 | 268 | } else { |
271 | 269 | if($count[$day->getDayOfMonthNumber()] == null){ |
272 | 270 | $id = 0; |
273 | - } |
|
274 | - else{ |
|
271 | + } else{ |
|
275 | 272 | $id = $day->getDayOfMonthNumber(); |
276 | 273 | } |
277 | 274 |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | $parser =& $parser_list[$parser_class]; |
39 | 39 | |
40 | 40 | # create the parser it not already set |
41 | - if (!$parser) |
|
42 | - $parser = new $parser_class; |
|
41 | + if (!$parser) { |
|
42 | + $parser = new $parser_class; |
|
43 | + } |
|
43 | 44 | |
44 | 45 | # Transform text using parser. |
45 | 46 | return $parser->transform($text); |
@@ -241,7 +242,9 @@ discard block |
||
241 | 242 | |
242 | 243 | |
243 | 244 | protected function hashHTMLBlocks($text) { |
244 | - if ($this->no_markup) return $text; |
|
245 | + if ($this->no_markup) { |
|
246 | + return $text; |
|
247 | + } |
|
245 | 248 | |
246 | 249 | $less_than_tab = $this->tab_width - 1; |
247 | 250 | |
@@ -529,7 +532,9 @@ discard block |
||
529 | 532 | # |
530 | 533 | # Turn Markdown link shortcuts into XHTML <a> tags. |
531 | 534 | # |
532 | - if ($this->in_anchor) return $text; |
|
535 | + if ($this->in_anchor) { |
|
536 | + return $text; |
|
537 | + } |
|
533 | 538 | $this->in_anchor = true; |
534 | 539 | |
535 | 540 | # |
@@ -623,8 +628,7 @@ discard block |
||
623 | 628 | $link_text = $this->runSpanGamut($link_text); |
624 | 629 | $result .= ">$link_text</a>"; |
625 | 630 | $result = $this->hashPart($result); |
626 | - } |
|
627 | - else { |
|
631 | + } else { |
|
628 | 632 | $result = $whole_match; |
629 | 633 | } |
630 | 634 | return $result; |
@@ -638,8 +642,9 @@ discard block |
||
638 | 642 | // if the URL was of the form <s p a c e s> it got caught by the HTML |
639 | 643 | // tag parser and hashed. Need to reverse the process before using the URL. |
640 | 644 | $unhashed = $this->unhash($url); |
641 | - if ($unhashed != $url) |
|
642 | - $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); |
|
645 | + if ($unhashed != $url) { |
|
646 | + $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); |
|
647 | + } |
|
643 | 648 | |
644 | 649 | $url = $this->encodeURLAttribute($url); |
645 | 650 | |
@@ -731,8 +736,7 @@ discard block |
||
731 | 736 | } |
732 | 737 | $result .= $this->empty_element_suffix; |
733 | 738 | $result = $this->hashPart($result); |
734 | - } |
|
735 | - else { |
|
739 | + } else { |
|
736 | 740 | # If there's no such link ID, leave intact: |
737 | 741 | $result = $whole_match; |
738 | 742 | } |
@@ -791,8 +795,9 @@ discard block |
||
791 | 795 | |
792 | 796 | protected function _doHeaders_callback_setext($matches) { |
793 | 797 | # Terrible hack to check we haven't found an empty list item. |
794 | - if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1])) |
|
795 | - return $matches[0]; |
|
798 | + if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1])) { |
|
799 | + return $matches[0]; |
|
800 | + } |
|
796 | 801 | |
797 | 802 | $level = $matches[2]{0} == '=' ? 1 : 2; |
798 | 803 | |
@@ -823,7 +828,9 @@ discard block |
||
823 | 828 | return ""; |
824 | 829 | } |
825 | 830 | $idValue = call_user_func($this->header_id_func, $headerValue); |
826 | - if (!$idValue) return ""; |
|
831 | + if (!$idValue) { |
|
832 | + return ""; |
|
833 | + } |
|
827 | 834 | |
828 | 835 | return ' id="' . $this->encodeAttribute($idValue) . '"'; |
829 | 836 | |
@@ -882,8 +889,7 @@ discard block |
||
882 | 889 | '.$whole_list_re.' |
883 | 890 | }mx', |
884 | 891 | array($this, '_doLists_callback'), $text); |
885 | - } |
|
886 | - else { |
|
892 | + } else { |
|
887 | 893 | $text = preg_replace_callback('{ |
888 | 894 | (?:(?<=\n)\n|\A\n?) # Must eat the newline |
889 | 895 | '.$whole_list_re.' |
@@ -990,8 +996,7 @@ discard block |
||
990 | 996 | # Replace marker with the appropriate whitespace indentation |
991 | 997 | $item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item; |
992 | 998 | $item = $this->runBlockGamut($this->outdent($item)."\n"); |
993 | - } |
|
994 | - else { |
|
999 | + } else { |
|
995 | 1000 | # Recursion for sub-lists: |
996 | 1001 | $item = $this->doLists($this->outdent($item)); |
997 | 1002 | $item = preg_replace('/\n+$/', '', $item); |
@@ -1261,8 +1266,7 @@ discard block |
||
1261 | 1266 | $value = preg_replace('/^([ ]*)/', "<p>", $value); |
1262 | 1267 | $value .= "</p>"; |
1263 | 1268 | $grafs[$key] = $this->unhash($value); |
1264 | - } |
|
1265 | - else { |
|
1269 | + } else { |
|
1266 | 1270 | # Is a block. |
1267 | 1271 | # Modify elements of @grafs in-place... |
1268 | 1272 | $graf = $value; |
@@ -1329,17 +1333,17 @@ discard block |
||
1329 | 1333 | # representation for the URL (removing mailto: or tel:) storing it in $text. |
1330 | 1334 | # This function is *not* suitable for attributes enclosed in single quotes. |
1331 | 1335 | # |
1332 | - if ($this->url_filter_func) |
|
1333 | - $url = call_user_func($this->url_filter_func, $url); |
|
1336 | + if ($this->url_filter_func) { |
|
1337 | + $url = call_user_func($this->url_filter_func, $url); |
|
1338 | + } |
|
1334 | 1339 | |
1335 | - if (preg_match('{^mailto:}i', $url)) |
|
1336 | - $url = $this->encodeEntityObfuscatedAttribute($url, $text, 7); |
|
1337 | - else if (preg_match('{^tel:}i', $url)) |
|
1340 | + if (preg_match('{^mailto:}i', $url)) { |
|
1341 | + $url = $this->encodeEntityObfuscatedAttribute($url, $text, 7); |
|
1342 | + } else if (preg_match('{^tel:}i', $url)) |
|
1338 | 1343 | { |
1339 | 1344 | $url = $this->encodeAttribute($url); |
1340 | 1345 | $text = substr($url, 4); |
1341 | - } |
|
1342 | - else |
|
1346 | + } else |
|
1343 | 1347 | { |
1344 | 1348 | $url = $this->encodeAttribute($url); |
1345 | 1349 | $text = $url; |
@@ -1429,7 +1433,9 @@ discard block |
||
1429 | 1433 | # With some optimizations by Milian Wolff. Forced encoding of HTML |
1430 | 1434 | # attribute special characters by Allan Odgaard. |
1431 | 1435 | # |
1432 | - if ($text == "") return $tail = ""; |
|
1436 | + if ($text == "") { |
|
1437 | + return $tail = ""; |
|
1438 | + } |
|
1433 | 1439 | |
1434 | 1440 | $chars = preg_split('/(?<!^)(?!$)/', $text); |
1435 | 1441 | $seed = (int)abs(crc32($text) / strlen($text)); # Deterministic seed. |
@@ -1443,8 +1449,11 @@ discard block |
||
1443 | 1449 | # '@' *must* be encoded. I insist. |
1444 | 1450 | # '"' and '>' have to be encoded inside the attribute |
1445 | 1451 | if ($r > 90 && strpos('@"&>', $char) === false) /* do nothing */; |
1446 | - else if ($r < 45) $chars[$key] = '&#x'.dechex($ord).';'; |
|
1447 | - else $chars[$key] = '&#'.$ord.';'; |
|
1452 | + else if ($r < 45) { |
|
1453 | + $chars[$key] = '&#x'.dechex($ord).';'; |
|
1454 | + } else { |
|
1455 | + $chars[$key] = '&#'.$ord.';'; |
|
1456 | + } |
|
1448 | 1457 | } |
1449 | 1458 | } |
1450 | 1459 | |
@@ -1505,8 +1514,7 @@ discard block |
||
1505 | 1514 | if (isset($parts[1])) { |
1506 | 1515 | $output .= $this->handleSpanToken($parts[1], $parts[2]); |
1507 | 1516 | $str = $parts[2]; |
1508 | - } |
|
1509 | - else { |
|
1517 | + } else { |
|
1510 | 1518 | break; |
1511 | 1519 | } |
1512 | 1520 | } |
@@ -1588,7 +1596,9 @@ discard block |
||
1588 | 1596 | # function that will loosely count the number of UTF-8 characters with a |
1589 | 1597 | # regular expression. |
1590 | 1598 | # |
1591 | - if (function_exists($this->utf8_strlen)) return; |
|
1599 | + if (function_exists($this->utf8_strlen)) { |
|
1600 | + return; |
|
1601 | + } |
|
1592 | 1602 | $this->utf8_strlen = create_function('$text', 'return preg_match_all( |
1593 | 1603 | "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/", |
1594 | 1604 | $text, $m);'); |
@@ -106,8 +106,9 @@ discard block |
||
106 | 106 | $this->footnote_counter = 1; |
107 | 107 | |
108 | 108 | foreach ($this->predef_abbr as $abbr_word => $abbr_desc) { |
109 | - if ($this->abbr_word_re) |
|
110 | - $this->abbr_word_re .= '|'; |
|
109 | + if ($this->abbr_word_re) { |
|
110 | + $this->abbr_word_re .= '|'; |
|
111 | + } |
|
111 | 112 | $this->abbr_word_re .= preg_quote($abbr_word); |
112 | 113 | $this->abbr_desciptions[$abbr_word] = trim($abbr_desc); |
113 | 114 | } |
@@ -145,7 +146,9 @@ discard block |
||
145 | 146 | # In addition, this method also supports supplying a default Id value, |
146 | 147 | # which will be used to populate the id attribute in case it was not |
147 | 148 | # overridden. |
148 | - if (empty($attr) && !$defaultIdValue) return ""; |
|
149 | + if (empty($attr) && !$defaultIdValue) { |
|
150 | + return ""; |
|
151 | + } |
|
149 | 152 | |
150 | 153 | # Split on components |
151 | 154 | preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', $attr, $matches); |
@@ -159,14 +162,18 @@ discard block |
||
159 | 162 | if ($element{0} == '.') { |
160 | 163 | $classes[] = substr($element, 1); |
161 | 164 | } else if ($element{0} == '#') { |
162 | - if ($id === false) $id = substr($element, 1); |
|
165 | + if ($id === false) { |
|
166 | + $id = substr($element, 1); |
|
167 | + } |
|
163 | 168 | } else if (strpos($element, '=') > 0) { |
164 | 169 | $parts = explode('=', $element, 2); |
165 | 170 | $attributes[] = $parts[0] . '="' . $parts[1] . '"'; |
166 | 171 | } |
167 | 172 | } |
168 | 173 | |
169 | - if (!$id) $id = $defaultIdValue; |
|
174 | + if (!$id) { |
|
175 | + $id = $defaultIdValue; |
|
176 | + } |
|
170 | 177 | |
171 | 178 | # compose attributes as string |
172 | 179 | $attr_str = ""; |
@@ -263,7 +270,9 @@ discard block |
||
263 | 270 | # _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag. |
264 | 271 | # These two functions are calling each other. It's recursive! |
265 | 272 | # |
266 | - if ($this->no_markup) return $text; |
|
273 | + if ($this->no_markup) { |
|
274 | + return $text; |
|
275 | + } |
|
267 | 276 | |
268 | 277 | # |
269 | 278 | # Call the HTML-in-Markdown hasher. |
@@ -300,7 +309,9 @@ discard block |
||
300 | 309 | # |
301 | 310 | # Returns an array of that form: ( processed text , remaining text ) |
302 | 311 | # |
303 | - if ($text === '') return array('', ''); |
|
312 | + if ($text === '') { |
|
313 | + return array('', ''); |
|
314 | + } |
|
304 | 315 | |
305 | 316 | # Regex to check for the presense of newlines around a block tag. |
306 | 317 | $newline_before_re = '/(?:^\n?|\n\n)*$/'; |
@@ -420,8 +431,7 @@ discard block |
||
420 | 431 | # End marker found: pass text unchanged until marker. |
421 | 432 | $parsed .= $tag . $matches[0]; |
422 | 433 | $text = substr($text, strlen($matches[0])); |
423 | - } |
|
424 | - else { |
|
434 | + } else { |
|
425 | 435 | # No end marker: just skip it. |
426 | 436 | $parsed .= $tag; |
427 | 437 | } |
@@ -447,8 +457,7 @@ discard block |
||
447 | 457 | # End marker found: pass text unchanged until marker. |
448 | 458 | $parsed .= $tag . $matches[0]; |
449 | 459 | $text = substr($text, strlen($matches[0])); |
450 | - } |
|
451 | - else { |
|
460 | + } else { |
|
452 | 461 | # Unmatched marker: just skip it. |
453 | 462 | $parsed .= $tag; |
454 | 463 | } |
@@ -495,8 +504,11 @@ discard block |
||
495 | 504 | # |
496 | 505 | # Increase/decrease nested tag count. |
497 | 506 | # |
498 | - if ($tag{1} == '/') $depth--; |
|
499 | - else if ($tag{strlen($tag)-2} != '/') $depth++; |
|
507 | + if ($tag{1} == '/') { |
|
508 | + $depth--; |
|
509 | + } else if ($tag{strlen($tag)-2} != '/') { |
|
510 | + $depth++; |
|
511 | + } |
|
500 | 512 | |
501 | 513 | if ($depth < 0) { |
502 | 514 | # |
@@ -508,8 +520,7 @@ discard block |
||
508 | 520 | } |
509 | 521 | |
510 | 522 | $parsed .= $tag; |
511 | - } |
|
512 | - else { |
|
523 | + } else { |
|
513 | 524 | $parsed .= $tag; |
514 | 525 | } |
515 | 526 | } while ($depth >= 0); |
@@ -527,7 +538,9 @@ discard block |
||
527 | 538 | # |
528 | 539 | # Returns an array of that form: ( processed text , remaining text ) |
529 | 540 | # |
530 | - if ($text === '') return array('', ''); |
|
541 | + if ($text === '') { |
|
542 | + return array('', ''); |
|
543 | + } |
|
531 | 544 | |
532 | 545 | # Regex to match `markdown` attribute inside of a tag. |
533 | 546 | $markdown_attr_re = ' |
@@ -578,8 +591,9 @@ discard block |
||
578 | 591 | # Get the name of the starting tag. |
579 | 592 | # (This pattern makes $base_tag_name_re safe without quoting.) |
580 | 593 | # |
581 | - if (preg_match('/^<([\w:$]*)\b/', $text, $matches)) |
|
582 | - $base_tag_name_re = $matches[1]; |
|
594 | + if (preg_match('/^<([\w:$]*)\b/', $text, $matches)) { |
|
595 | + $base_tag_name_re = $matches[1]; |
|
596 | + } |
|
583 | 597 | |
584 | 598 | # |
585 | 599 | # Loop through every tag until we find the corresponding closing tag. |
@@ -616,15 +630,17 @@ discard block |
||
616 | 630 | { |
617 | 631 | # Just add the tag to the block as if it was text. |
618 | 632 | $block_text .= $tag; |
619 | - } |
|
620 | - else { |
|
633 | + } else { |
|
621 | 634 | # |
622 | 635 | # Increase/decrease nested tag count. Only do so if |
623 | 636 | # the tag's name match base tag's. |
624 | 637 | # |
625 | 638 | if (preg_match('{^</?'.$base_tag_name_re.'\b}', $tag)) { |
626 | - if ($tag{1} == '/') $depth--; |
|
627 | - else if ($tag{strlen($tag)-2} != '/') $depth++; |
|
639 | + if ($tag{1} == '/') { |
|
640 | + $depth--; |
|
641 | + } else if ($tag{strlen($tag)-2} != '/') { |
|
642 | + $depth++; |
|
643 | + } |
|
628 | 644 | } |
629 | 645 | |
630 | 646 | # |
@@ -671,13 +687,17 @@ discard block |
||
671 | 687 | } |
672 | 688 | |
673 | 689 | # Append tag content to parsed text. |
674 | - if (!$span_mode) $parsed .= "\n\n$block_text\n\n"; |
|
675 | - else $parsed .= "$block_text"; |
|
690 | + if (!$span_mode) { |
|
691 | + $parsed .= "\n\n$block_text\n\n"; |
|
692 | + } else { |
|
693 | + $parsed .= "$block_text"; |
|
694 | + } |
|
676 | 695 | |
677 | 696 | # Start over with a new block. |
678 | 697 | $block_text = ""; |
679 | - } |
|
680 | - else $block_text .= $tag; |
|
698 | + } else { |
|
699 | + $block_text .= $tag; |
|
700 | + } |
|
681 | 701 | } |
682 | 702 | |
683 | 703 | } while ($depth > 0); |
@@ -705,7 +725,9 @@ discard block |
||
705 | 725 | # |
706 | 726 | # Turn Markdown link shortcuts into XHTML <a> tags. |
707 | 727 | # |
708 | - if ($this->in_anchor) return $text; |
|
728 | + if ($this->in_anchor) { |
|
729 | + return $text; |
|
730 | + } |
|
709 | 731 | $this->in_anchor = true; |
710 | 732 | |
711 | 733 | # |
@@ -796,14 +818,14 @@ discard block |
||
796 | 818 | $title = $this->encodeAttribute($title); |
797 | 819 | $result .= " title=\"$title\""; |
798 | 820 | } |
799 | - if (isset($this->ref_attr[$link_id])) |
|
800 | - $result .= $this->ref_attr[$link_id]; |
|
821 | + if (isset($this->ref_attr[$link_id])) { |
|
822 | + $result .= $this->ref_attr[$link_id]; |
|
823 | + } |
|
801 | 824 | |
802 | 825 | $link_text = $this->runSpanGamut($link_text); |
803 | 826 | $result .= ">$link_text</a>"; |
804 | 827 | $result = $this->hashPart($result); |
805 | - } |
|
806 | - else { |
|
828 | + } else { |
|
807 | 829 | $result = $whole_match; |
808 | 830 | } |
809 | 831 | return $result; |
@@ -818,8 +840,9 @@ discard block |
||
818 | 840 | // if the URL was of the form <s p a c e s> it got caught by the HTML |
819 | 841 | // tag parser and hashed. Need to reverse the process before using the URL. |
820 | 842 | $unhashed = $this->unhash($url); |
821 | - if ($unhashed != $url) |
|
822 | - $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); |
|
843 | + if ($unhashed != $url) { |
|
844 | + $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); |
|
845 | + } |
|
823 | 846 | |
824 | 847 | $url = $this->encodeURLAttribute($url); |
825 | 848 | |
@@ -911,12 +934,12 @@ discard block |
||
911 | 934 | $title = $this->encodeAttribute($title); |
912 | 935 | $result .= " title=\"$title\""; |
913 | 936 | } |
914 | - if (isset($this->ref_attr[$link_id])) |
|
915 | - $result .= $this->ref_attr[$link_id]; |
|
937 | + if (isset($this->ref_attr[$link_id])) { |
|
938 | + $result .= $this->ref_attr[$link_id]; |
|
939 | + } |
|
916 | 940 | $result .= $this->empty_element_suffix; |
917 | 941 | $result = $this->hashPart($result); |
918 | - } |
|
919 | - else { |
|
942 | + } else { |
|
920 | 943 | # If there's no such link ID, leave intact: |
921 | 944 | $result = $whole_match; |
922 | 945 | } |
@@ -985,8 +1008,9 @@ discard block |
||
985 | 1008 | return $text; |
986 | 1009 | } |
987 | 1010 | protected function _doHeaders_callback_setext($matches) { |
988 | - if ($matches[3] == '-' && preg_match('{^- }', $matches[1])) |
|
989 | - return $matches[0]; |
|
1011 | + if ($matches[3] == '-' && preg_match('{^- }', $matches[1])) { |
|
1012 | + return $matches[0]; |
|
1013 | + } |
|
990 | 1014 | |
991 | 1015 | $level = $matches[3]{0} == '=' ? 1 : 2; |
992 | 1016 | |
@@ -1079,8 +1103,9 @@ discard block |
||
1079 | 1103 | } |
1080 | 1104 | protected function _doTable_makeAlignAttr($alignname) |
1081 | 1105 | { |
1082 | - if (empty($this->table_align_class_tmpl)) |
|
1083 | - return " align=\"$alignname\""; |
|
1106 | + if (empty($this->table_align_class_tmpl)) { |
|
1107 | + return " align=\"$alignname\""; |
|
1108 | + } |
|
1084 | 1109 | |
1085 | 1110 | $classname = str_replace('%%', $alignname, $this->table_align_class_tmpl); |
1086 | 1111 | return " class=\"$classname\""; |
@@ -1098,14 +1123,15 @@ discard block |
||
1098 | 1123 | # Reading alignement from header underline. |
1099 | 1124 | $separators = preg_split('/ *[|] */', $underline); |
1100 | 1125 | foreach ($separators as $n => $s) { |
1101 | - if (preg_match('/^ *-+: *$/', $s)) |
|
1102 | - $attr[$n] = $this->_doTable_makeAlignAttr('right'); |
|
1103 | - else if (preg_match('/^ *:-+: *$/', $s)) |
|
1104 | - $attr[$n] = $this->_doTable_makeAlignAttr('center'); |
|
1105 | - else if (preg_match('/^ *:-+ *$/', $s)) |
|
1106 | - $attr[$n] = $this->_doTable_makeAlignAttr('left'); |
|
1107 | - else |
|
1108 | - $attr[$n] = ''; |
|
1126 | + if (preg_match('/^ *-+: *$/', $s)) { |
|
1127 | + $attr[$n] = $this->_doTable_makeAlignAttr('right'); |
|
1128 | + } else if (preg_match('/^ *:-+: *$/', $s)) { |
|
1129 | + $attr[$n] = $this->_doTable_makeAlignAttr('center'); |
|
1130 | + } else if (preg_match('/^ *:-+ *$/', $s)) { |
|
1131 | + $attr[$n] = $this->_doTable_makeAlignAttr('left'); |
|
1132 | + } else { |
|
1133 | + $attr[$n] = ''; |
|
1134 | + } |
|
1109 | 1135 | } |
1110 | 1136 | |
1111 | 1137 | # Parsing span elements, including code spans, character escapes, |
@@ -1119,8 +1145,9 @@ discard block |
||
1119 | 1145 | $text = "<table>\n"; |
1120 | 1146 | $text .= "<thead>\n"; |
1121 | 1147 | $text .= "<tr>\n"; |
1122 | - foreach ($headers as $n => $header) |
|
1123 | - $text .= " <th$attr[$n]>".$this->runSpanGamut(trim($header))."</th>\n"; |
|
1148 | + foreach ($headers as $n => $header) { |
|
1149 | + $text .= " <th$attr[$n]>".$this->runSpanGamut(trim($header))."</th>\n"; |
|
1150 | + } |
|
1124 | 1151 | $text .= "</tr>\n"; |
1125 | 1152 | $text .= "</thead>\n"; |
1126 | 1153 | |
@@ -1138,8 +1165,9 @@ discard block |
||
1138 | 1165 | $row_cells = array_pad($row_cells, $col_count, ''); |
1139 | 1166 | |
1140 | 1167 | $text .= "<tr>\n"; |
1141 | - foreach ($row_cells as $n => $cell) |
|
1142 | - $text .= " <td$attr[$n]>".$this->runSpanGamut(trim($cell))."</td>\n"; |
|
1168 | + foreach ($row_cells as $n => $cell) { |
|
1169 | + $text .= " <td$attr[$n]>".$this->runSpanGamut(trim($cell))."</td>\n"; |
|
1170 | + } |
|
1143 | 1171 | $text .= "</tr>\n"; |
1144 | 1172 | } |
1145 | 1173 | $text .= "</tbody>\n"; |
@@ -1265,8 +1293,7 @@ discard block |
||
1265 | 1293 | $def = str_repeat(' ', strlen($marker_space)) . $def; |
1266 | 1294 | $def = $this->runBlockGamut($this->outdent($def . "\n\n")); |
1267 | 1295 | $def = "\n". $def ."\n"; |
1268 | - } |
|
1269 | - else { |
|
1296 | + } else { |
|
1270 | 1297 | $def = rtrim($def); |
1271 | 1298 | $def = $this->runSpanGamut($this->outdent($def)); |
1272 | 1299 | } |
@@ -1323,8 +1350,9 @@ discard block |
||
1323 | 1350 | array($this, '_doFencedCodeBlocks_newlines'), $codeblock); |
1324 | 1351 | |
1325 | 1352 | if ($classname != "") { |
1326 | - if ($classname{0} == '.') |
|
1327 | - $classname = substr($classname, 1); |
|
1353 | + if ($classname{0} == '.') { |
|
1354 | + $classname = substr($classname, 1); |
|
1355 | + } |
|
1328 | 1356 | $attr_str = ' class="'.$this->code_class_prefix.$classname.'"'; |
1329 | 1357 | } else { |
1330 | 1358 | $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs); |
@@ -1573,8 +1601,9 @@ discard block |
||
1573 | 1601 | protected function _stripAbbreviations_callback($matches) { |
1574 | 1602 | $abbr_word = $matches[1]; |
1575 | 1603 | $abbr_desc = $matches[2]; |
1576 | - if ($this->abbr_word_re) |
|
1577 | - $this->abbr_word_re .= '|'; |
|
1604 | + if ($this->abbr_word_re) { |
|
1605 | + $this->abbr_word_re .= '|'; |
|
1606 | + } |
|
1578 | 1607 | $this->abbr_word_re .= preg_quote($abbr_word); |
1579 | 1608 | $this->abbr_desciptions[$abbr_word] = trim($abbr_desc); |
1580 | 1609 | return ''; # String that will replace the block |
@@ -13,7 +13,9 @@ |
||
13 | 13 | |
14 | 14 | public function __construct($proc = false) |
15 | 15 | { |
16 | - if ($proc === false) $proc = new XSLTProcessor(); |
|
16 | + if ($proc === false) { |
|
17 | + $proc = new XSLTProcessor(); |
|
18 | + } |
|
17 | 19 | $this->xsltProcessor = $proc; |
18 | 20 | } |
19 | 21 |
@@ -81,7 +81,9 @@ discard block |
||
81 | 81 | /** Opens file's handle */ |
82 | 82 | public function open($mode) |
83 | 83 | { |
84 | - if ($this->handle) $this->close(); |
|
84 | + if ($this->handle) { |
|
85 | + $this->close(); |
|
86 | + } |
|
85 | 87 | $this->handle = $this->fs->fopen($this->name, $mode); |
86 | 88 | return true; |
87 | 89 | } |
@@ -89,7 +91,9 @@ discard block |
||
89 | 91 | /** Closes file's handle */ |
90 | 92 | public function close() |
91 | 93 | { |
92 | - if (!$this->handle) return false; |
|
94 | + if (!$this->handle) { |
|
95 | + return false; |
|
96 | + } |
|
93 | 97 | $status = $this->fs->fclose($this->handle); |
94 | 98 | $this->handle = false; |
95 | 99 | return $status; |
@@ -98,42 +102,57 @@ discard block |
||
98 | 102 | /** Retrieves a line from an open file, with optional max length $length */ |
99 | 103 | public function getLine($length = null) |
100 | 104 | { |
101 | - if (!$this->handle) $this->open('r'); |
|
102 | - if ($length === null) return $this->fs->fgets($this->handle); |
|
103 | - else return $this->fs->fgets($this->handle, $length); |
|
105 | + if (!$this->handle) { |
|
106 | + $this->open('r'); |
|
107 | + } |
|
108 | + if ($length === null) { |
|
109 | + return $this->fs->fgets($this->handle); |
|
110 | + } else { |
|
111 | + return $this->fs->fgets($this->handle, $length); |
|
112 | + } |
|
104 | 113 | } |
105 | 114 | |
106 | 115 | /** Retrieves a character from an open file */ |
107 | 116 | public function getChar() |
108 | 117 | { |
109 | - if (!$this->handle) $this->open('r'); |
|
118 | + if (!$this->handle) { |
|
119 | + $this->open('r'); |
|
120 | + } |
|
110 | 121 | return $this->fs->fgetc($this->handle); |
111 | 122 | } |
112 | 123 | |
113 | 124 | /** Retrieves an $length bytes of data from an open data */ |
114 | 125 | public function read($length) |
115 | 126 | { |
116 | - if (!$this->handle) $this->open('r'); |
|
127 | + if (!$this->handle) { |
|
128 | + $this->open('r'); |
|
129 | + } |
|
117 | 130 | return $this->fs->fread($this->handle, $length); |
118 | 131 | } |
119 | 132 | |
120 | 133 | /** Writes to an open file */ |
121 | 134 | public function put($string) |
122 | 135 | { |
123 | - if (!$this->handle) $this->open('a'); |
|
136 | + if (!$this->handle) { |
|
137 | + $this->open('a'); |
|
138 | + } |
|
124 | 139 | return $this->fs->fwrite($this->handle, $string); |
125 | 140 | } |
126 | 141 | |
127 | 142 | /** Returns TRUE if the end of the file has been reached */ |
128 | 143 | public function eof() |
129 | 144 | { |
130 | - if (!$this->handle) return true; |
|
145 | + if (!$this->handle) { |
|
146 | + return true; |
|
147 | + } |
|
131 | 148 | return $this->fs->feof($this->handle); |
132 | 149 | } |
133 | 150 | |
134 | 151 | public function __destruct() |
135 | 152 | { |
136 | - if ($this->handle) $this->close(); |
|
153 | + if ($this->handle) { |
|
154 | + $this->close(); |
|
155 | + } |
|
137 | 156 | } |
138 | 157 | |
139 | 158 | } |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | public static function autoload($class) |
11 | 11 | { |
12 | 12 | $path = HTMLPurifierExtras::getPath($class); |
13 | - if (!$path) return false; |
|
13 | + if (!$path) { |
|
14 | + return false; |
|
15 | + } |
|
14 | 16 | require $path; |
15 | 17 | return true; |
16 | 18 | } |
@@ -20,7 +22,9 @@ discard block |
||
20 | 22 | if ( |
21 | 23 | strncmp('FSTools', $class, 7) !== 0 && |
22 | 24 | strncmp('ConfigDoc', $class, 9) !== 0 |
23 | - ) return false; |
|
25 | + ) { |
|
26 | + return false; |
|
27 | + } |
|
24 | 28 | // Custom implementations can go here |
25 | 29 | // Standard implementation: |
26 | 30 | return str_replace('_', '/', $class) . '.php'; |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public static function singleton() |
19 | 19 | { |
20 | - if (empty(FSTools::$singleton)) FSTools::$singleton = new FSTools(); |
|
20 | + if (empty(FSTools::$singleton)) { |
|
21 | + FSTools::$singleton = new FSTools(); |
|
22 | + } |
|
21 | 23 | return FSTools::$singleton; |
22 | 24 | } |
23 | 25 | |
@@ -139,9 +141,13 @@ discard block |
||
139 | 141 | public function globr($dir, $pattern, $flags = NULL) |
140 | 142 | { |
141 | 143 | $files = $this->glob("$dir/$pattern", $flags); |
142 | - if ($files === false) $files = array(); |
|
144 | + if ($files === false) { |
|
145 | + $files = array(); |
|
146 | + } |
|
143 | 147 | $sub_dirs = $this->glob("$dir/*", GLOB_ONLYDIR); |
144 | - if ($sub_dirs === false) $sub_dirs = array(); |
|
148 | + if ($sub_dirs === false) { |
|
149 | + $sub_dirs = array(); |
|
150 | + } |
|
145 | 151 | foreach ($sub_dirs as $sub_dir) { |
146 | 152 | $sub_files = $this->globr($sub_dir, $pattern, $flags); |
147 | 153 | $files = array_merge($files, $sub_files); |
@@ -169,8 +169,12 @@ discard block |
||
169 | 169 | $replacements = array(); |
170 | 170 | // we need to remove add <phorum break> as that is the form these |
171 | 171 | // extra bits are in. |
172 | - if ($signature) $replacements[str_replace("\n", "<phorum break>\n", $signature)] = ''; |
|
173 | - if ($editmessage) $replacements[str_replace("\n", "<phorum break>\n", $editmessage)] = ''; |
|
172 | + if ($signature) { |
|
173 | + $replacements[str_replace("\n", "<phorum break>\n", $signature)] = ''; |
|
174 | + } |
|
175 | + if ($editmessage) { |
|
176 | + $replacements[str_replace("\n", "<phorum break>\n", $editmessage)] = ''; |
|
177 | + } |
|
174 | 178 | $row['body'] = strtr($row['body'], $replacements); |
175 | 179 | return array($signature, $editmessage); |
176 | 180 | } |
@@ -273,7 +277,9 @@ discard block |
||
273 | 277 | } |
274 | 278 | return; |
275 | 279 | } |
276 | - if (!empty($GLOBALS['PHORUM']['mod_htmlpurifier']['suppress_message'])) return; |
|
280 | + if (!empty($GLOBALS['PHORUM']['mod_htmlpurifier']['suppress_message'])) { |
|
281 | + return; |
|
282 | + } |
|
277 | 283 | ?><div class="htmlpurifier-help"> |
278 | 284 | <p> |
279 | 285 | <strong>HTML input</strong> is enabled. Make sure you escape all HTML and |
@@ -290,7 +296,9 @@ discard block |
||
290 | 296 | } |
291 | 297 | $html_definition = $config->getDefinition('HTML'); |
292 | 298 | $allowed = array(); |
293 | - foreach ($html_definition->info as $name => $x) $allowed[] = "<code>$name</code>"; |
|
299 | + foreach ($html_definition->info as $name => $x) { |
|
300 | + $allowed[] = "<code>$name</code>"; |
|
301 | + } |
|
294 | 302 | sort($allowed); |
295 | 303 | $allowed_text = implode(', ', $allowed); |
296 | 304 | ?><p><strong>Allowed tags:</strong> <?php |
@@ -9,7 +9,9 @@ |
||
9 | 9 | * by creating a 'config.php' file. |
10 | 10 | */ |
11 | 11 | |
12 | -if(!defined("PHORUM_ADMIN")) exit; |
|
12 | +if(!defined("PHORUM_ADMIN")) { |
|
13 | + exit; |
|
14 | +} |
|
13 | 15 | |
14 | 16 | // error reporting is good! |
15 | 17 | error_reporting(E_ALL ^ E_NOTICE); |