Changeset 46548 for trunk/src/wp-includes/class-wp-customize-manager.php
- Timestamp:
- 10/15/2019 04:41:51 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r46225 r46548 1518 1518 // Options. 1519 1519 foreach ( $options as $name => $value ) { 1520 if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) { 1520 1521 // Serialize the value to check for post symbols. 1522 $value = maybe_serialize( $value ); 1523 1524 if ( is_serialized( $value ) ) { 1525 if ( preg_match( '/s:\d+:"{{(?P<symbol>.+)}}"/', $value, $matches ) ) { 1526 if ( isset( $posts[ $matches['symbol'] ] ) ) { 1527 $symbol_match = $posts[ $matches['symbol'] ]['ID']; 1528 } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { 1529 $symbol_match = $attachment_ids[ $matches['symbol'] ]; 1530 } 1531 1532 // If we have any symbol matches, update the values. 1533 if ( isset( $symbol_match ) ) { 1534 // Replace found string matches with post IDs. 1535 $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); 1536 } else { 1537 continue; 1538 } 1539 } 1540 } elseif ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) { 1521 1541 if ( isset( $posts[ $matches['symbol'] ] ) ) { 1522 1542 $value = $posts[ $matches['symbol'] ]['ID']; … … 1528 1548 } 1529 1549 1550 // Unserialize values after checking for post symbols, so they can be properly referenced. 1551 $value = maybe_unserialize( $value ); 1552 1530 1553 if ( empty( $changeset_data[ $name ] ) || ! empty( $changeset_data[ $name ]['starter_content'] ) ) { 1531 1554 $this->set_post_value( $name, $value ); … … 1536 1559 // Theme mods. 1537 1560 foreach ( $theme_mods as $name => $value ) { 1538 if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) { 1561 1562 // Serialize the value to check for post symbols. 1563 $value = maybe_serialize( $value ); 1564 1565 // Check if value was serialized. 1566 if ( is_serialized( $value ) ) { 1567 if ( preg_match( '/s:\d+:"{{(?P<symbol>.+)}}"/', $value, $matches ) ) { 1568 if ( isset( $posts[ $matches['symbol'] ] ) ) { 1569 $symbol_match = $posts[ $matches['symbol'] ]['ID']; 1570 } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { 1571 $symbol_match = $attachment_ids[ $matches['symbol'] ]; 1572 } 1573 1574 // If we have any symbol matches, update the values. 1575 if ( isset( $symbol_match ) ) { 1576 // Replace found string matches with post IDs. 1577 $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); 1578 } else { 1579 continue; 1580 } 1581 } 1582 } elseif ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) { 1539 1583 if ( isset( $posts[ $matches['symbol'] ] ) ) { 1540 1584 $value = $posts[ $matches['symbol'] ]['ID']; … … 1545 1589 } 1546 1590 } 1591 1592 // Unserialize values after checking for post symbols, so they can be properly referenced. 1593 $value = maybe_unserialize( $value ); 1547 1594 1548 1595 // Handle header image as special case since setting has a legacy format.
Note: See TracChangeset
for help on using the changeset viewer.