Changeset 11118
- Timestamp:
- 07/15/2021 10:45:11 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php
r10945 r11118 9 9 10 10 protected $styles = '<style> .toc-jump { text-align: right; font-size: 12px; } .page .toc-heading { margin-top: -50px; padding-top: 50px !important; }</style>'; 11 12 /** 13 * Array of HTML ids known to exist on the page or that have been auto-generated. 14 * 15 * @var array 16 */ 17 private $used_ids = []; 11 18 12 19 /** … … 104 111 } 105 112 113 $this->used_ids = $this->get_reserved_ids(); 106 114 for ( $i = 1; $i <= 4; $i++ ) 107 115 $content = $this->add_ids_and_jumpto_links( "h$i", $content ); … … 154 162 $matches = array(); 155 163 $replacements = array(); 156 $used_ids = $this->get_reserved_ids();157 164 158 165 foreach ( $items as $item ) { … … 164 171 $count = 2; 165 172 $orig_id = $id; 166 while ( in_array( $id, $ used_ids ) && $count < 50 ) {173 while ( in_array( $id, $this->used_ids ) && $count < 50 ) { 167 174 $id = $orig_id . '-' . $count; 168 175 $count++; 169 176 } 170 $ used_ids[] = $id;177 $this->used_ids[] = $id; 171 178 172 179 if ( ! $first ) {
Note: See TracChangeset
for help on using the changeset viewer.