← All changes
|
json-endpoints/jetpack/class.jetpack-json-api-themes-endpoint.php
+9
-3
12.1.3
→
16.3-a.5
View file →
| @@ -1,5 +1,12 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | + | |
| 3 | +use Automattic\Jetpack\Image_CDN\Image_CDN_Core; | |
| 4 | + | |
| 5 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 6 | + exit( 0 ); | |
| 7 | +} | |
| 8 | + | |
| 2 | 9 | /** |
| 3 | 10 | * Base class for working with themes, has useful helper functions. |
| 4 | 11 | */ |
| 5 | 12 | abstract class Jetpack_JSON_API_Themes_Endpoint extends Jetpack_JSON_API_Endpoint { |
| @@ -138,9 +145,9 @@ | ||
| 138 | 145 | |
| 139 | 146 | $id = $theme->get_stylesheet(); |
| 140 | 147 | $formatted_theme = array( |
| 141 | 148 | 'id' => $id, |
| 142 | - 'screenshot' => jetpack_photon_url( $theme->get_screenshot(), array(), 'network_path' ), | |
| 149 | + 'screenshot' => Image_CDN_Core::cdn_url( $theme->get_screenshot(), array(), 'network_path' ), | |
| 143 | 150 | 'active' => $id === $this->current_theme_id, |
| 144 | 151 | ); |
| 145 | 152 | |
| 146 | 153 | foreach ( $fields as $key => $field ) { |
| @@ -147,9 +154,9 @@ | ||
| 147 | 154 | $formatted_theme[ $key ] = $theme->get( $field ); |
| 148 | 155 | } |
| 149 | 156 | |
| 150 | 157 | $update_themes = get_site_transient( 'update_themes' ); |
| 151 | - $formatted_theme['update'] = ( isset( $update_themes->response[ $id ] ) ) ? $update_themes->response[ $id ] : null; | |
| 158 | + $formatted_theme['update'] = $update_themes->response[ $id ] ?? null; | |
| 152 | 159 | |
| 153 | 160 | $autoupdate = in_array( $id, Jetpack_Options::get_option( 'autoupdate_themes', array() ), true ); |
| 154 | 161 | $formatted_theme['autoupdate'] = $autoupdate; |
| 155 | 162 | |
| @@ -210,6 +217,5 @@ | ||
| 210 | 217 | $this->current_theme_id = wp_get_theme()->get_stylesheet(); |
| 211 | 218 | |
| 212 | 219 | return array_map( array( $this, 'format_theme' ), $themes ); |
| 213 | 220 | } |
| 214 | - | |
| 215 | 221 | } |