Skip to content

Commit

Permalink
Super Cache: be more defensive when fetching promo links (#34962)
Browse files Browse the repository at this point in the history
Fixes #34960

Avoid trying to fetch specific links when the global is not set.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/7543612799
  • Loading branch information
jeherve authored and matticbot committed Jan 16, 2024
1 parent 8795e78 commit 76c23cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This is an alpha version! The changes listed here are not final.
- Code Modernization: Replace usage of strpos() with str_starts_with().
- Code Modernization: Replace usage of substr() with str_starts_with() and str_ends_with().
- Fix blurry Automattic logo.
- General: avoid deprecation warnings when trying to get URLs in PHP 8.2
- General: updated PHP requirement to PHP 7.0+
- General: update WordPress version requirements to WordPress 6.3.
- Updated package dependencies.
Expand Down
13 changes: 7 additions & 6 deletions wp-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1292,14 +1292,15 @@ function toggleLayer( whichLayer ) {
</td><td valign='top' style='width: 300px'>
<!-- TODO: Hide #wpsc-callout from all pages except the Easy tab -->
<div class="wpsc-card" id="wpsc-callout">
<h4><?php _e( 'Other Site Tools', 'wp-super-cache' ); ?></h4>
<?php if ( ! empty( $wpsc_promo_links ) && is_array( $wpsc_promo_links ) ) : ?>
<h4><?php esc_html_e( 'Other Site Tools', 'wp-super-cache' ); ?></h4>
<ul style="list-style: square; margin-left: 2em;">

<li><a href="<?php echo esc_url( $wpsc_promo_links['boost'] ); ?>"><?php esc_html_e( 'Boost your page speed scores', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['photon'] ); ?>"><?php esc_html_e( 'Speed up images and photos (free)', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['videopress'] ); ?>"><?php esc_html_e( 'Fast video hosting (paid)', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['crowdsignal'] ); ?>"><?php esc_html_e( 'Add Surveys and Polls to your site', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['boost'] ); ?>"><?php esc_html_e( 'Boost your page speed scores', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['photon'] ); ?>"><?php esc_html_e( 'Speed up images and photos (free)', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['videopress'] ); ?>"><?php esc_html_e( 'Fast video hosting (paid)', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['crowdsignal'] ); ?>"><?php esc_html_e( 'Add Surveys and Polls to your site', 'wp-super-cache' ); ?></a></li>
</ul>
<?php endif; ?>
<h4><?php _e( 'Need Help?', 'wp-super-cache' ); ?></h4>
<ol>
<li><?php printf( __( 'Use the <a href="%1$s">Debug tab</a> for diagnostics.', 'wp-super-cache' ), admin_url( 'options-general.php?page=wpsupercache&tab=debug' ) ); ?></li>
Expand Down

0 comments on commit 76c23cd

Please sign in to comment.