|
@@ 396-407 (lines=12) @@
|
| 393 |
|
private function parse_menu_item( $title ) { |
| 394 |
|
$item = array(); |
| 395 |
|
|
| 396 |
|
if ( false !== strpos( $title, 'count-' ) ) { |
| 397 |
|
preg_match( '/<span class=".+\s?count-(\d*).+\s?<\/span><\/span>/', $title, $matches ); |
| 398 |
|
|
| 399 |
|
$count = absint( $matches[1] ); |
| 400 |
|
if ( $count > 0 ) { |
| 401 |
|
// Keep the counter in the item array. |
| 402 |
|
$item['count'] = $count; |
| 403 |
|
} |
| 404 |
|
|
| 405 |
|
// Finally remove the markup. |
| 406 |
|
$title = trim( str_replace( $matches[0], '', $title ) ); |
| 407 |
|
} |
| 408 |
|
|
| 409 |
|
if ( false !== strpos( $title, 'inline-text' ) ) { |
| 410 |
|
preg_match( '/<span class="inline-text".+\s?>(.+)<\/span>/', $title, $matches ); |
|
@@ 409-420 (lines=12) @@
|
| 406 |
|
$title = trim( str_replace( $matches[0], '', $title ) ); |
| 407 |
|
} |
| 408 |
|
|
| 409 |
|
if ( false !== strpos( $title, 'inline-text' ) ) { |
| 410 |
|
preg_match( '/<span class="inline-text".+\s?>(.+)<\/span>/', $title, $matches ); |
| 411 |
|
|
| 412 |
|
$text = $matches[1]; |
| 413 |
|
if ( $text ) { |
| 414 |
|
// Keep the text in the item array. |
| 415 |
|
$item['inlineText'] = $text; |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
// Finally remove the markup. |
| 419 |
|
$title = trim( str_replace( $matches[0], '', $title ) ); |
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
// It's important we sanitize the title after parsing data to remove any unexpected markup but keep the content. |
| 423 |
|
// We are also capilizing the first letter in case there was a counter (now parsed) in front of the title. |