Skip to content

Commit

Permalink
release: nps fix
Browse files Browse the repository at this point in the history
### Bug Fixes

- **Fix NPS Survey**: Fixed survey appearing instantly when theme installed programmatically.
- **Fix Google Maps Block ID Escaping**: Fixes ID of Google Maps block not being escaped properly.
  • Loading branch information
HardeepAsrani authored Mar 13, 2024
2 parents fa72233 + 4ce1c44 commit bbe6216
Show file tree
Hide file tree
Showing 5 changed files with 1,682 additions and 1,423 deletions.
130 changes: 67 additions & 63 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inc/plugins/class-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function enqueue_options_assets() {
'showFeedbackNotice' => $this->should_show_feedback_notice(),
'deal' => ! Pro::is_pro_installed() ? $offer->get_localized_data() : array(),
'hasOnboarding' => false !== get_theme_support( FSE_Onboarding::SUPPORT_KEY ),
'days_since_install' => round( ( time() - get_option( 'otter_blocks_install', 0 ) ) / DAY_IN_SECONDS ),
'days_since_install' => round( ( time() - get_option( 'otter_blocks_install', time() ) ) / DAY_IN_SECONDS ),
'rootUrl' => get_site_url(),
)
)
Expand Down
6 changes: 3 additions & 3 deletions inc/render/class-google-map-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function render( $attributes ) {
return $output;
}

$id = isset( $attributes['id'] ) ? $attributes['id'] : 'wp-block-themeisle-blocks-google-map-' . wp_rand( 10, 100 );
$id = isset( $attributes['id'] ) ? esc_attr( $attributes['id'] ) : 'wp-block-themeisle-blocks-google-map-' . wp_rand( 10, 100 );
$class = '';
$style = '';

Expand All @@ -54,14 +54,14 @@ public function render( $attributes ) {
array(
'class' => $class,
'style' => $style,
)
)
);

$output = '<div ' . $wrapper_attributes . ' id="' . esc_attr( $id ) . '"></div>' . "\n";
$output .= '<script type="text/javascript">' . "\n";
$output .= ' /* <![CDATA[ */' . "\n";
$output .= ' if ( ! window.themeisleGoogleMaps ) window.themeisleGoogleMaps =[];' . "\n";
$output .= ' window.themeisleGoogleMaps.push( { container: "' . $id . '", attributes: ' . wp_json_encode( $attributes ) . ' } );' . "\n";
$output .= ' window.themeisleGoogleMaps.push( { container: "' . esc_attr( $id ) . '", attributes: ' . wp_json_encode( $attributes ) . ' } );' . "\n";
$output .= ' /* ]]> */' . "\n";
$output .= '</script>' . "\n";

Expand Down
Loading

0 comments on commit bbe6216

Please sign in to comment.