Changeset 44524 for trunk/src/wp-admin/themes.php
- Timestamp:
- 01/09/2019 08:04:55 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/themes.php
r43571 r44524 33 33 switch_theme( $theme->get_stylesheet() ); 34 34 wp_redirect( admin_url( 'themes.php?activated=true' ) ); 35 exit; 36 } elseif ( 'resume' === $_GET['action'] ) { 37 check_admin_referer( 'resume-theme_' . $_GET['stylesheet'] ); 38 $theme = wp_get_theme( $_GET['stylesheet'] ); 39 40 if ( ! current_user_can( 'resume_themes' ) ) { 41 wp_die( 42 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . 43 '<p>' . __( 'Sorry, you are not allowed to resume this theme.' ) . '</p>', 44 403 45 ); 46 } 47 48 $result = resume_theme( $theme->get_stylesheet() ); 49 50 if ( is_wp_error( $result ) ) { 51 wp_die( $result ); 52 } 53 54 wp_redirect( admin_url( 'themes.php?resumed=true' ) ); 35 55 exit; 36 56 } elseif ( 'delete' == $_GET['action'] ) { … … 174 194 <hr class="wp-header-end"> 175 195 <?php 176 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) :196 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) { 177 197 ?> 178 <div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div>198 <div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div> 179 199 <?php 180 elseif ( isset( $_GET['activated'] ) ) : 200 } elseif ( isset( $_GET['activated'] ) ) { 181 201 if ( isset( $_GET['previewed'] ) ) { 182 202 ?> 183 203 <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> 184 <?php } else { ?> 185 <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> 186 <?php 187 } 188 elseif ( isset( $_GET['deleted'] ) ) : 204 <?php 205 } else { 189 206 ?> 190 <div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div> 191 <?php elseif ( isset( $_GET['delete-active-child'] ) ) : ?> 207 <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> 208 <?php 209 } 210 } elseif ( isset( $_GET['deleted'] ) ) { 211 ?> 212 <div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div> 213 <?php 214 } elseif ( isset( $_GET['delete-active-child'] ) ) { 215 ?> 192 216 <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div> 193 217 <?php 194 endif; 218 } elseif ( isset( $_GET['resumed'] ) ) { 219 ?> 220 <div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div> 221 <?php 222 } 195 223 196 224 $ct = wp_get_theme(); … … 345 373 346 374 <?php 375 $can_resume = current_user_can( 'resume_themes' ); 347 376 $can_delete = current_user_can( 'delete_themes' ); 348 377 $can_install = current_user_can( 'install_themes' ); … … 352 381 <th><?php _ex( 'Name', 'theme name' ); ?></th> 353 382 <th><?php _e( 'Description' ); ?></th> 383 <?php if ( $can_resume ) { ?> 384 <td></td> 385 <?php } ?> 354 386 <?php if ( $can_delete ) { ?> 355 387 <td></td> … … 364 396 <td><?php echo $broken_theme->errors()->get_error_message(); ?></td> 365 397 <?php 398 if ( $can_resume ) { 399 if ( 'theme_paused' === $broken_theme->errors()->get_error_code() ) { 400 $stylesheet = $broken_theme->get_stylesheet(); 401 $resume_url = add_query_arg( 402 array( 403 'action' => 'resume', 404 'stylesheet' => urlencode( $stylesheet ), 405 ), 406 admin_url( 'themes.php' ) 407 ); 408 $resume_url = wp_nonce_url( $resume_url, 'resume-theme_' . $stylesheet ); 409 ?> 410 <td><a href="<?php echo esc_url( $resume_url ); ?>" class="button resume-theme"><?php _e( 'Resume' ); ?></a></td> 411 <?php 412 } else { 413 ?> 414 <td></td> 415 <?php 416 } 417 } 418 366 419 if ( $can_delete ) { 367 420 $stylesheet = $broken_theme->get_stylesheet();
Note: See TracChangeset
for help on using the changeset viewer.