Initializing the $this-counter array (#3)
This commit is contained in:
parent
7fdc36425d
commit
a8ebfff2f1
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue