| | 337 | // Display FAQs as a definition list. |
| | 338 | if ( isset( $this->sections['faq'] ) ) { |
| | 339 | $lines = explode( "\n", $this->sections['faq'] ); |
| | 340 | $definition = false; |
| | 341 | |
| | 342 | $this->sections['faq'] = "<dl>\n"; |
| | 343 | while ( ( $line = array_shift( $lines ) ) !== null ) { |
| | 344 | $trimmed = trim( $line ); |
| | 345 | if ( empty( $trimmed ) ) { |
| | 346 | continue; |
| | 347 | } |
| | 348 | |
| | 349 | if ( 0 === strpos( $trimmed, '<h4>' ) ) { |
| | 350 | if ( $definition ) { |
| | 351 | $this->sections['faq'] .= "</dd>\n"; |
| | 352 | $definition = false; |
| | 353 | } |
| | 354 | |
| | 355 | $this->sections['faq'] .= '<dt>' . $this->sanitize_text( strip_tags( $line ) ) . "</dt>\n"; |
| | 356 | continue; |
| | 357 | } |
| | 358 | |
| | 359 | if ( ! $definition ) { |
| | 360 | $this->sections['faq'] .= '<dd>' . $line; |
| | 361 | $definition = true; |
| | 362 | continue; |
| | 363 | } |
| | 364 | |
| | 365 | $this->sections['faq'] .= "\n" . $line; |
| | 366 | } |
| | 367 | |
| | 368 | $this->sections['faq'] .= "</dd>\n</dl>"; |
| | 369 | } |
| | 370 | |