64 * Hides the `process_failed` error when updating a theme by uploading a zip file. |
70 * Hides the `process_failed` error when updating a theme by uploading a zip file. |
65 * |
71 * |
66 * @since 5.5.0 |
72 * @since 5.5.0 |
67 * |
73 * |
68 * @param WP_Error $wp_error WP_Error object. |
74 * @param WP_Error $wp_error WP_Error object. |
69 * @return bool |
75 * @return bool True if the error should be hidden, false otherwise. |
70 */ |
76 */ |
71 public function hide_process_failed( $wp_error ) { |
77 public function hide_process_failed( $wp_error ) { |
72 if ( |
78 if ( |
73 'upload' === $this->type && |
79 'upload' === $this->type && |
74 '' === $this->overwrite && |
80 '' === $this->overwrite && |
127 $install_actions['preview'] = sprintf( |
133 $install_actions['preview'] = sprintf( |
128 '<a href="%s" class="hide-if-no-customize load-customize">' . |
134 '<a href="%s" class="hide-if-no-customize load-customize">' . |
129 '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>', |
135 '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>', |
130 esc_url( $customize_url ), |
136 esc_url( $customize_url ), |
131 __( 'Live Preview' ), |
137 __( 'Live Preview' ), |
132 /* translators: %s: Theme name. */ |
138 /* translators: Hidden accessibility text. %s: Theme name. */ |
133 sprintf( __( 'Live Preview “%s”' ), $name ) |
139 sprintf( __( 'Live Preview “%s”' ), $name ) |
134 ); |
140 ); |
135 } |
141 } |
136 |
142 |
137 $install_actions['activate'] = sprintf( |
143 $install_actions['activate'] = sprintf( |
138 '<a href="%s" class="activatelink">' . |
144 '<a href="%s" class="activatelink">' . |
139 '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>', |
145 '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>', |
140 esc_url( $activate_link ), |
146 esc_url( $activate_link ), |
141 __( 'Activate' ), |
147 _x( 'Activate', 'theme' ), |
142 /* translators: %s: Theme name. */ |
148 /* translators: Hidden accessibility text. %s: Theme name. */ |
143 sprintf( _x( 'Activate “%s”', 'theme' ), $name ) |
149 sprintf( _x( 'Activate “%s”', 'theme' ), $name ) |
144 ); |
150 ); |
145 |
151 |
146 if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) { |
152 if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) { |
147 $install_actions['network_enable'] = sprintf( |
153 $install_actions['network_enable'] = sprintf( |
299 |
305 |
300 if ( ! is_php_version_compatible( $requires_php ) ) { |
306 if ( ! is_php_version_compatible( $requires_php ) ) { |
301 $error = sprintf( |
307 $error = sprintf( |
302 /* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */ |
308 /* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */ |
303 __( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ), |
309 __( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ), |
304 phpversion(), |
310 PHP_VERSION, |
305 $requires_php |
311 $requires_php |
306 ); |
312 ); |
307 |
313 |
308 $blocked_message .= '<li>' . esc_html( $error ) . '</li>'; |
314 $blocked_message .= '<li>' . esc_html( $error ) . '</li>'; |
309 $can_update = false; |
315 $can_update = false; |
326 if ( $can_update ) { |
332 if ( $can_update ) { |
327 if ( $this->is_downgrading ) { |
333 if ( $this->is_downgrading ) { |
328 $warning = sprintf( |
334 $warning = sprintf( |
329 /* translators: %s: Documentation URL. */ |
335 /* translators: %s: Documentation URL. */ |
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.' ), |
336 __( '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/' ) |
337 __( 'https://developer.wordpress.org/advanced-administration/security/backup/' ) |
332 ); |
338 ); |
333 } else { |
339 } else { |
334 $warning = sprintf( |
340 $warning = sprintf( |
335 /* translators: %s: Documentation URL. */ |
341 /* translators: %s: Documentation URL. */ |
336 __( 'You are updating a theme. Be sure to <a href="%s">back up your database and files</a> first.' ), |
342 __( 'You are updating a theme. Be sure to <a href="%s">back up your database and files</a> first.' ), |
337 __( 'https://wordpress.org/support/article/wordpress-backups/' ) |
343 __( 'https://developer.wordpress.org/advanced-administration/security/backup/' ) |
338 ); |
344 ); |
339 } |
345 } |
340 |
346 |
341 echo '<p class="update-from-upload-notice">' . $warning . '</p>'; |
347 echo '<p class="update-from-upload-notice">' . $warning . '</p>'; |
342 |
348 |