@@ -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); |
@@ -34,8 +34,7 @@ discard block |
||
34 | 34 | if (is_numeric($sln_old)) |
35 | 35 | { |
36 | 36 | $sln_old = (int) $sln_old; |
37 | - } |
|
38 | - else |
|
37 | + } else |
|
39 | 38 | { |
40 | 39 | $sln_old = 1; |
41 | 40 | } |
@@ -46,14 +45,16 @@ discard block |
||
46 | 45 | if (is_numeric($start_line_numbers_at)) |
47 | 46 | { |
48 | 47 | $start_line_numbers_at = (int) $start_line_numbers_at; |
49 | - if (!$extraTag) $extraTag = '['; |
|
50 | - if ($start_line_numbers_at > 0) |
|
51 | - $extraTag .= 'enable_line_numbers="true", '; |
|
52 | - else |
|
53 | - $extraTag .= 'enable_line_numbers="false", '; |
|
48 | + if (!$extraTag) { |
|
49 | + $extraTag = '['; |
|
50 | + } |
|
51 | + if ($start_line_numbers_at > 0) { |
|
52 | + $extraTag .= 'enable_line_numbers="true", '; |
|
53 | + } else { |
|
54 | + $extraTag .= 'enable_line_numbers="false", '; |
|
55 | + } |
|
54 | 56 | $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
55 | - } |
|
56 | - else |
|
57 | + } else |
|
57 | 58 | { |
58 | 59 | $extraTag = '[enable_line_numbers="false"'; |
59 | 60 | } |
@@ -65,28 +66,35 @@ discard block |
||
65 | 66 | $str = ''; |
66 | 67 | foreach($arr as $val) |
67 | 68 | { |
68 | - if ($str) $str .= ','; |
|
69 | + if ($str) { |
|
70 | + $str .= ','; |
|
71 | + } |
|
69 | 72 | if (is_numeric($val)) |
70 | 73 | { |
71 | 74 | $ival = (int) $val; |
72 | - if ($sln_old > 0 && $ival > 0) |
|
73 | - $str .= $ival - $sln_old + 1; |
|
74 | - else |
|
75 | - $str .= abs($ival); |
|
75 | + if ($sln_old > 0 && $ival > 0) { |
|
76 | + $str .= $ival - $sln_old + 1; |
|
77 | + } else { |
|
78 | + $str .= abs($ival); |
|
79 | + } |
|
76 | 80 | } |
77 | 81 | } |
78 | 82 | if ($str) |
79 | 83 | { |
80 | - if (!$extraTag) |
|
81 | - $extraTag = '['; |
|
82 | - else |
|
83 | - $extraTag .= ', '; |
|
84 | + if (!$extraTag) { |
|
85 | + $extraTag = '['; |
|
86 | + } else { |
|
87 | + $extraTag .= ', '; |
|
88 | + } |
|
84 | 89 | $extraTag .= 'highlight_lines_extra="' . $str . '"]'; |
90 | + } elseif ($extraTag) { |
|
91 | + $extraTag .= ']'; |
|
85 | 92 | } |
86 | - elseif ($extraTag) $extraTag .= ']'; |
|
87 | 93 | } |
88 | - if ($extraTag) $openingTag .= ' ' . $extraTag; |
|
89 | -// 555--- |
|
94 | + if ($extraTag) { |
|
95 | + $openingTag .= ' ' . $extraTag; |
|
96 | + } |
|
97 | + // 555--- |
|
90 | 98 | $openingTag .= '>'; |
91 | 99 | return $openingTag . "\n" . $this->data['content'][0]['text'] . "\n</code>"; |
92 | 100 | } |