Initializing the $this-counter array (#3)

This commit is contained in:
Eric van der Vlist 2020-05-09 12:09:26 +02:00
förälder 7fdc36425d
incheckning a8ebfff2f1
1 ändrade filer med 2 tillägg och 1 borttagningar

Visa fil

@ -455,6 +455,7 @@ if( !class_exists('ExToC') ) {
$this->minLevel = $matches[0][2]; // lowest level e.g. h3
$currentLevel = $this->minLevel; // $minLevel;
$this->counter[$currentLevel] = 0;
for( $i = 0; $i < count($matches); $i++ ) {
/** get anchor and add to find and replace arrays **/
@ -477,7 +478,7 @@ if( !class_exists('ExToC') ) {
/** Check if header lower current header, then add level and update current header */
if( $matches[$i][2] > $currentLevel && $this->options['show_hierarchy'] == true) {
$currentLevel = $matches[$i][2];
$this->counter[$currentLevel] = 1;
$this->counter[$currentLevel] += 1;
}
else if( $matches[$i][2] < $currentLevel && $matches[$i][2] >= $this->minLevel && $this->options['show_hierarchy'] == true) {
$currentLevel = $matches[$i][2];