equal
deleted
inserted
replaced
113 ); |
113 ); |
114 $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); |
114 $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); |
115 |
115 |
116 $install_actions = array(); |
116 $install_actions = array(); |
117 |
117 |
118 if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { |
118 if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) && ! $theme_info->is_block_theme() ) { |
119 $customize_url = add_query_arg( |
119 $customize_url = add_query_arg( |
120 array( |
120 array( |
121 'theme' => urlencode( $stylesheet ), |
121 'theme' => urlencode( $stylesheet ), |
122 'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ), |
122 'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ), |
123 ), |
123 ), |
221 return false; |
221 return false; |
222 } |
222 } |
223 |
223 |
224 echo '<h2 class="update-from-upload-heading">' . esc_html__( 'This theme is already installed.' ) . '</h2>'; |
224 echo '<h2 class="update-from-upload-heading">' . esc_html__( 'This theme is already installed.' ) . '</h2>'; |
225 |
225 |
226 // Check errors for current theme. |
226 // Check errors for active theme. |
227 if ( is_wp_error( $current_theme_data->errors() ) ) { |
227 if ( is_wp_error( $current_theme_data->errors() ) ) { |
228 $this->feedback( 'current_theme_has_errors', $current_theme_data->errors()->get_error_message() ); |
228 $this->feedback( 'current_theme_has_errors', $current_theme_data->errors()->get_error_message() ); |
229 } |
229 } |
230 |
230 |
231 $this->is_downgrading = version_compare( $current_theme_data['Version'], $new_theme_data['Version'], '>' ); |
231 $this->is_downgrading = version_compare( $current_theme_data['Version'], $new_theme_data['Version'], '>' ); |
243 'RequiresPHP' => __( 'Required PHP version' ), |
243 'RequiresPHP' => __( 'Required PHP version' ), |
244 'Template' => __( 'Parent theme' ), |
244 'Template' => __( 'Parent theme' ), |
245 ); |
245 ); |
246 |
246 |
247 $table = '<table class="update-from-upload-comparison"><tbody>'; |
247 $table = '<table class="update-from-upload-comparison"><tbody>'; |
248 $table .= '<tr><th></th><th>' . esc_html_x( 'Current', 'theme' ) . '</th><th>' . esc_html_x( 'Uploaded', 'theme' ) . '</th></tr>'; |
248 $table .= '<tr><th></th><th>' . esc_html_x( 'Active', 'theme' ) . '</th><th>' . esc_html_x( 'Uploaded', 'theme' ) . '</th></tr>'; |
249 |
249 |
250 $is_same_theme = true; // Let's consider only these rows. |
250 $is_same_theme = true; // Let's consider only these rows. |
251 |
251 |
252 foreach ( $rows as $field => $label ) { |
252 foreach ( $rows as $field => $label ) { |
253 $old_value = $current_theme_data->display( $field, false ); |
253 $old_value = $current_theme_data->display( $field, false ); |
280 /** |
280 /** |
281 * Filters the compare table output for overwriting a theme package on upload. |
281 * Filters the compare table output for overwriting a theme package on upload. |
282 * |
282 * |
283 * @since 5.5.0 |
283 * @since 5.5.0 |
284 * |
284 * |
285 * @param string $table The output table with Name, Version, Author, RequiresWP, and RequiresPHP info. |
285 * @param string $table The output table with Name, Version, Author, RequiresWP, and RequiresPHP info. |
286 * @param array $current_theme_data Array with current theme data. |
286 * @param WP_Theme $current_theme_data Active theme data. |
287 * @param array $new_theme_data Array with uploaded theme data. |
287 * @param array $new_theme_data Array with uploaded theme data. |
288 */ |
288 */ |
289 echo apply_filters( 'install_theme_overwrite_comparison', $table, $current_theme_data, $new_theme_data ); |
289 echo apply_filters( 'install_theme_overwrite_comparison', $table, $current_theme_data, $new_theme_data ); |
290 |
290 |
291 $install_actions = array(); |
291 $install_actions = array(); |
292 $can_update = true; |
292 $can_update = true; |
325 |
325 |
326 if ( $can_update ) { |
326 if ( $can_update ) { |
327 if ( $this->is_downgrading ) { |
327 if ( $this->is_downgrading ) { |
328 $warning = sprintf( |
328 $warning = sprintf( |
329 /* translators: %s: Documentation URL. */ |
329 /* translators: %s: Documentation URL. */ |
330 __( 'You are uploading an older version of a current theme. You can continue to install the older version, but be sure to <a href="%s">back up your database and files</a> first.' ), |
330 __( 'You are uploading an older version of the active theme. You can continue to install the older version, but be sure to <a href="%s">back up your database and files</a> first.' ), |
331 __( 'https://wordpress.org/support/article/wordpress-backups/' ) |
331 __( 'https://wordpress.org/support/article/wordpress-backups/' ) |
332 ); |
332 ); |
333 } else { |
333 } else { |
334 $warning = sprintf( |
334 $warning = sprintf( |
335 /* translators: %s: Documentation URL. */ |
335 /* translators: %s: Documentation URL. */ |
343 $overwrite = $this->is_downgrading ? 'downgrade-theme' : 'update-theme'; |
343 $overwrite = $this->is_downgrading ? 'downgrade-theme' : 'update-theme'; |
344 |
344 |
345 $install_actions['overwrite_theme'] = sprintf( |
345 $install_actions['overwrite_theme'] = sprintf( |
346 '<a class="button button-primary update-from-upload-overwrite" href="%s" target="_parent">%s</a>', |
346 '<a class="button button-primary update-from-upload-overwrite" href="%s" target="_parent">%s</a>', |
347 wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'theme-upload' ), |
347 wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'theme-upload' ), |
348 _x( 'Replace current with uploaded', 'theme' ) |
348 _x( 'Replace active with uploaded', 'theme' ) |
349 ); |
349 ); |
350 } else { |
350 } else { |
351 echo $blocked_message; |
351 echo $blocked_message; |
352 } |
352 } |
353 |
353 |