@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | { |
| 363 | 363 | $str = ''; |
| 364 | 364 | asort($ext['highlight_lines_extra']); |
| 365 | - foreach($ext['highlight_lines_extra'] as $hle) |
|
| 365 | + foreach ($ext['highlight_lines_extra'] as $hle) |
|
| 366 | 366 | { |
| 367 | 367 | if ($str) $str .= ','; |
| 368 | 368 | if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
@@ -428,17 +428,17 @@ discard block |
||
| 428 | 428 | $node = new Node('rss'); |
| 429 | 429 | $node->attr('url', hsc($url)); |
| 430 | 430 | $node->attr('max', $params['max']); |
| 431 | - $node->attr('reverse', (bool)$params['reverse']); |
|
| 432 | - $node->attr('author', (bool)$params['author']); |
|
| 433 | - $node->attr('date', (bool)$params['date']); |
|
| 434 | - $node->attr('details', (bool)$params['details']); |
|
| 431 | + $node->attr('reverse', (bool) $params['reverse']); |
|
| 432 | + $node->attr('author', (bool) $params['author']); |
|
| 433 | + $node->attr('date', (bool) $params['date']); |
|
| 434 | + $node->attr('details', (bool) $params['details']); |
|
| 435 | 435 | |
| 436 | 436 | if ($params['refresh'] % 86400 === 0) { |
| 437 | - $refresh = $params['refresh']/86400 . 'd'; |
|
| 437 | + $refresh = $params['refresh'] / 86400 . 'd'; |
|
| 438 | 438 | } else if ($params['refresh'] % 3600 === 0) { |
| 439 | - $refresh = $params['refresh']/3600 . 'h'; |
|
| 439 | + $refresh = $params['refresh'] / 3600 . 'h'; |
|
| 440 | 440 | } else { |
| 441 | - $refresh = $params['refresh']/60 . 'm'; |
|
| 441 | + $refresh = $params['refresh'] / 60 . 'm'; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $node->attr('refresh', trim($refresh)); |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | public function smiley($smiley) |
| 591 | 591 | { |
| 592 | - if(array_key_exists($smiley, $this->smileys)) { |
|
| 592 | + if (array_key_exists($smiley, $this->smileys)) { |
|
| 593 | 593 | $node = new Node('smiley'); |
| 594 | 594 | $node->attr('icon', $this->smileys[$smiley]); |
| 595 | 595 | $node->attr('syntax', $smiley); |
@@ -353,8 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | $node->attr('data-sln', $start_line_numbers_at); |
| 355 | 355 | $node->attr('data-sln-old', $start_line_numbers_at); |
| 356 | - } |
|
| 357 | - else |
|
| 356 | + } else |
|
| 358 | 357 | { |
| 359 | 358 | $node->attr('data-sln-old', '1'); |
| 360 | 359 | } |
@@ -364,8 +363,12 @@ discard block |
||
| 364 | 363 | asort($ext['highlight_lines_extra']); |
| 365 | 364 | foreach($ext['highlight_lines_extra'] as $hle) |
| 366 | 365 | { |
| 367 | - if ($str) $str .= ','; |
|
| 368 | - if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
|
| 366 | + if ($str) { |
|
| 367 | + $str .= ','; |
|
| 368 | + } |
|
| 369 | + if ($start_line_numbers_at > 0) { |
|
| 370 | + $hle += $start_line_numbers_at - 1; |
|
| 371 | + } |
|
| 369 | 372 | $str .= $hle; |
| 370 | 373 | } |
| 371 | 374 | $node->attr('data-hle', $str); |
@@ -341,36 +341,36 @@ |
||
| 341 | 341 | $node = new Node('code_block'); |
| 342 | 342 | $node->attr('class', 'code ' . $lang); |
| 343 | 343 | $node->attr('data-language', $lang); |
| 344 | - $node->attr('data-filename', rtrim($file)); |
|
| 345 | - if ($ext) |
|
| 346 | - { |
|
| 347 | - if (isset($ext['start_line_numbers_at'])) |
|
| 348 | - { |
|
| 349 | - $start_line_numbers_at = $ext['start_line_numbers_at']; |
|
| 350 | - if (isset($ext['enable_line_numbers']) && ($ext['enable_line_numbers'] === false)) |
|
| 351 | - { |
|
| 352 | - $start_line_numbers_at = -$start_line_numbers_at; |
|
| 353 | - } |
|
| 354 | - $node->attr('data-sln', $start_line_numbers_at); |
|
| 355 | - $node->attr('data-sln-old', $start_line_numbers_at); |
|
| 356 | - } |
|
| 357 | - else |
|
| 358 | - { |
|
| 359 | - $node->attr('data-sln-old', '1'); |
|
| 360 | - } |
|
| 361 | - if (isset($ext['highlight_lines_extra'])) |
|
| 362 | - { |
|
| 363 | - $str = ''; |
|
| 364 | - asort($ext['highlight_lines_extra']); |
|
| 365 | - foreach($ext['highlight_lines_extra'] as $hle) |
|
| 366 | - { |
|
| 367 | - if ($str) $str .= ','; |
|
| 368 | - if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
|
| 369 | - $str .= $hle; |
|
| 370 | - } |
|
| 371 | - $node->attr('data-hle', $str); |
|
| 372 | - } |
|
| 373 | - } |
|
| 344 | + $node->attr('data-filename', rtrim($file)); |
|
| 345 | + if ($ext) |
|
| 346 | + { |
|
| 347 | + if (isset($ext['start_line_numbers_at'])) |
|
| 348 | + { |
|
| 349 | + $start_line_numbers_at = $ext['start_line_numbers_at']; |
|
| 350 | + if (isset($ext['enable_line_numbers']) && ($ext['enable_line_numbers'] === false)) |
|
| 351 | + { |
|
| 352 | + $start_line_numbers_at = -$start_line_numbers_at; |
|
| 353 | + } |
|
| 354 | + $node->attr('data-sln', $start_line_numbers_at); |
|
| 355 | + $node->attr('data-sln-old', $start_line_numbers_at); |
|
| 356 | + } |
|
| 357 | + else |
|
| 358 | + { |
|
| 359 | + $node->attr('data-sln-old', '1'); |
|
| 360 | + } |
|
| 361 | + if (isset($ext['highlight_lines_extra'])) |
|
| 362 | + { |
|
| 363 | + $str = ''; |
|
| 364 | + asort($ext['highlight_lines_extra']); |
|
| 365 | + foreach($ext['highlight_lines_extra'] as $hle) |
|
| 366 | + { |
|
| 367 | + if ($str) $str .= ','; |
|
| 368 | + if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
|
| 369 | + $str .= $hle; |
|
| 370 | + } |
|
| 371 | + $node->attr('data-hle', $str); |
|
| 372 | + } |
|
| 373 | + } |
|
| 374 | 374 | $this->nodestack->addTop($node); |
| 375 | 375 | $this->cdata(trim($text, "\n")); |
| 376 | 376 | $this->nodestack->drop('code_block'); |
@@ -25,63 +25,63 @@ |
||
| 25 | 25 | if (!empty($this->data['attrs']['data-filename'])) { |
| 26 | 26 | $openingTag .= ' ' . $this->data['attrs']['data-filename']; |
| 27 | 27 | } |
| 28 | - $extraTag = ''; |
|
| 29 | - if (isset($this->data['attrs']['data-sln-old'])) |
|
| 30 | - { |
|
| 31 | - $sln_old = $this->data['attrs']['data-sln-old']; |
|
| 32 | - if (is_numeric($sln_old)) |
|
| 33 | - { |
|
| 34 | - $sln_old = (int) $sln_old; |
|
| 35 | - } |
|
| 36 | - else |
|
| 37 | - { |
|
| 38 | - $sln_old = 1; |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - if (isset($this->data['attrs']['data-sln'])) |
|
| 42 | - { |
|
| 43 | - $start_line_numbers_at = $this->data['attrs']['data-sln']; |
|
| 44 | - if (is_numeric($start_line_numbers_at)) |
|
| 45 | - { |
|
| 46 | - $start_line_numbers_at = (int) $start_line_numbers_at; |
|
| 47 | - if ($start_line_numbers_at > 0) |
|
| 48 | - $extraTag .= 'enable_line_numbers="true", '; |
|
| 49 | - else |
|
| 50 | - $extraTag .= 'enable_line_numbers="false", '; |
|
| 51 | - $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
|
| 52 | - } |
|
| 53 | - else |
|
| 54 | - { |
|
| 55 | - $extraTag = 'enable_line_numbers="false"'; |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - if (isset($this->data['attrs']['data-hle'])) |
|
| 59 | - { |
|
| 60 | - $highlight_lines_extra = $this->data['attrs']['data-hle']; |
|
| 61 | - $arr = explode(',', $highlight_lines_extra); |
|
| 62 | - $str = ''; |
|
| 63 | - foreach($arr as $val) |
|
| 64 | - { |
|
| 65 | - if ($str) $str .= ','; |
|
| 66 | - if (is_numeric($val)) |
|
| 67 | - { |
|
| 68 | - $ival = (int) $val; |
|
| 69 | - if ($sln_old > 0 && $ival > 0) |
|
| 70 | - $str .= $ival - $sln_old + 1; |
|
| 71 | - else |
|
| 72 | - $str .= abs($ival); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - if ($str) |
|
| 76 | - { |
|
| 77 | - if (!$extraTag) |
|
| 78 | - $extraTag = '['; |
|
| 79 | - else |
|
| 80 | - $extraTag .= ', '; |
|
| 81 | - $extraTag .= 'highlight_lines_extra="' . $str . '"'; |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - if ($extraTag) $openingTag .= ' [' . $extraTag . ']'; |
|
| 28 | + $extraTag = ''; |
|
| 29 | + if (isset($this->data['attrs']['data-sln-old'])) |
|
| 30 | + { |
|
| 31 | + $sln_old = $this->data['attrs']['data-sln-old']; |
|
| 32 | + if (is_numeric($sln_old)) |
|
| 33 | + { |
|
| 34 | + $sln_old = (int) $sln_old; |
|
| 35 | + } |
|
| 36 | + else |
|
| 37 | + { |
|
| 38 | + $sln_old = 1; |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | + if (isset($this->data['attrs']['data-sln'])) |
|
| 42 | + { |
|
| 43 | + $start_line_numbers_at = $this->data['attrs']['data-sln']; |
|
| 44 | + if (is_numeric($start_line_numbers_at)) |
|
| 45 | + { |
|
| 46 | + $start_line_numbers_at = (int) $start_line_numbers_at; |
|
| 47 | + if ($start_line_numbers_at > 0) |
|
| 48 | + $extraTag .= 'enable_line_numbers="true", '; |
|
| 49 | + else |
|
| 50 | + $extraTag .= 'enable_line_numbers="false", '; |
|
| 51 | + $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
|
| 52 | + } |
|
| 53 | + else |
|
| 54 | + { |
|
| 55 | + $extraTag = 'enable_line_numbers="false"'; |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + if (isset($this->data['attrs']['data-hle'])) |
|
| 59 | + { |
|
| 60 | + $highlight_lines_extra = $this->data['attrs']['data-hle']; |
|
| 61 | + $arr = explode(',', $highlight_lines_extra); |
|
| 62 | + $str = ''; |
|
| 63 | + foreach($arr as $val) |
|
| 64 | + { |
|
| 65 | + if ($str) $str .= ','; |
|
| 66 | + if (is_numeric($val)) |
|
| 67 | + { |
|
| 68 | + $ival = (int) $val; |
|
| 69 | + if ($sln_old > 0 && $ival > 0) |
|
| 70 | + $str .= $ival - $sln_old + 1; |
|
| 71 | + else |
|
| 72 | + $str .= abs($ival); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + if ($str) |
|
| 76 | + { |
|
| 77 | + if (!$extraTag) |
|
| 78 | + $extraTag = '['; |
|
| 79 | + else |
|
| 80 | + $extraTag .= ', '; |
|
| 81 | + $extraTag .= 'highlight_lines_extra="' . $str . '"'; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + if ($extraTag) $openingTag .= ' [' . $extraTag . ']'; |
|
| 85 | 85 | |
| 86 | 86 | $openingTag .= '>'; |
| 87 | 87 | return $openingTag . "\n" . $this->data['content'][0]['text'] . "\n</code>"; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $extraTag .= 'enable_line_numbers="true", '; |
| 49 | 49 | else |
| 50 | 50 | $extraTag .= 'enable_line_numbers="false", '; |
| 51 | - $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
|
| 51 | + $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) . '"'; |
|
| 52 | 52 | } |
| 53 | 53 | else |
| 54 | 54 | { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $highlight_lines_extra = $this->data['attrs']['data-hle']; |
| 61 | 61 | $arr = explode(',', $highlight_lines_extra); |
| 62 | 62 | $str = ''; |
| 63 | - foreach($arr as $val) |
|
| 63 | + foreach ($arr as $val) |
|
| 64 | 64 | { |
| 65 | 65 | if ($str) $str .= ','; |
| 66 | 66 | if (is_numeric($val)) |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | if (is_numeric($sln_old)) |
| 33 | 33 | { |
| 34 | 34 | $sln_old = (int) $sln_old; |
| 35 | - } |
|
| 36 | - else |
|
| 35 | + } else |
|
| 37 | 36 | { |
| 38 | 37 | $sln_old = 1; |
| 39 | 38 | } |
@@ -44,13 +43,13 @@ discard block |
||
| 44 | 43 | if (is_numeric($start_line_numbers_at)) |
| 45 | 44 | { |
| 46 | 45 | $start_line_numbers_at = (int) $start_line_numbers_at; |
| 47 | - if ($start_line_numbers_at > 0) |
|
| 48 | - $extraTag .= 'enable_line_numbers="true", '; |
|
| 49 | - else |
|
| 50 | - $extraTag .= 'enable_line_numbers="false", '; |
|
| 46 | + if ($start_line_numbers_at > 0) { |
|
| 47 | + $extraTag .= 'enable_line_numbers="true", '; |
|
| 48 | + } else { |
|
| 49 | + $extraTag .= 'enable_line_numbers="false", '; |
|
| 50 | + } |
|
| 51 | 51 | $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
| 52 | - } |
|
| 53 | - else |
|
| 52 | + } else |
|
| 54 | 53 | { |
| 55 | 54 | $extraTag = 'enable_line_numbers="false"'; |
| 56 | 55 | } |
@@ -62,26 +61,32 @@ discard block |
||
| 62 | 61 | $str = ''; |
| 63 | 62 | foreach($arr as $val) |
| 64 | 63 | { |
| 65 | - if ($str) $str .= ','; |
|
| 64 | + if ($str) { |
|
| 65 | + $str .= ','; |
|
| 66 | + } |
|
| 66 | 67 | if (is_numeric($val)) |
| 67 | 68 | { |
| 68 | 69 | $ival = (int) $val; |
| 69 | - if ($sln_old > 0 && $ival > 0) |
|
| 70 | - $str .= $ival - $sln_old + 1; |
|
| 71 | - else |
|
| 72 | - $str .= abs($ival); |
|
| 70 | + if ($sln_old > 0 && $ival > 0) { |
|
| 71 | + $str .= $ival - $sln_old + 1; |
|
| 72 | + } else { |
|
| 73 | + $str .= abs($ival); |
|
| 74 | + } |
|
| 73 | 75 | } |
| 74 | 76 | } |
| 75 | 77 | if ($str) |
| 76 | 78 | { |
| 77 | - if (!$extraTag) |
|
| 78 | - $extraTag = '['; |
|
| 79 | - else |
|
| 80 | - $extraTag .= ', '; |
|
| 79 | + if (!$extraTag) { |
|
| 80 | + $extraTag = '['; |
|
| 81 | + } else { |
|
| 82 | + $extraTag .= ', '; |
|
| 83 | + } |
|
| 81 | 84 | $extraTag .= 'highlight_lines_extra="' . $str . '"'; |
| 82 | 85 | } |
| 83 | 86 | } |
| 84 | - if ($extraTag) $openingTag .= ' [' . $extraTag . ']'; |
|
| 87 | + if ($extraTag) { |
|
| 88 | + $openingTag .= ' [' . $extraTag . ']'; |
|
| 89 | + } |
|
| 85 | 90 | |
| 86 | 91 | $openingTag .= '>'; |
| 87 | 92 | return $openingTag . "\n" . $this->data['content'][0]['text'] . "\n</code>"; |