Ticket #15920: 15920.patch
File 15920.patch, 2.7 KB (added by , 15 years ago) |
---|
-
wp-admin/network/themes.php
35 35 switch ( $action ) { 36 36 case 'enable': 37 37 $allowed_themes[ $_GET['theme'] ] = true; 38 $update = 'enabled'; 38 39 update_site_option( 'allowedthemes', $allowed_themes ); 39 wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message40 exit;41 40 break; 42 41 case 'disable': 43 42 unset( $allowed_themes[ $_GET['theme'] ] ); 43 $update = 'disabled'; 44 44 update_site_option( 'allowedthemes', $allowed_themes ); 45 wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message46 exit;47 45 break; 48 46 case 'enable-selected': 49 47 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 50 if ( empty($themes) ) { 51 wp_redirect( wp_get_referer() ); 52 exit; 53 } 54 foreach( (array) $themes as $theme ) 55 $allowed_themes[ $theme ] = true; 56 update_site_option( 'allowedthemes', $allowed_themes ); 48 if ( ! empty($themes) ) { 49 $update = 'enable'; 50 foreach( (array) $themes as $theme ) 51 $allowed_themes[ $theme ] = true; 52 update_site_option( 'allowedthemes', $allowed_themes ); 53 } else { 54 $update = 'error'; 55 } 57 56 break; 58 57 case 'disable-selected': 59 58 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 60 if ( empty($themes) ) { 61 wp_redirect( wp_get_referer() ); 62 exit; 63 } 64 foreach( (array) $themes as $theme ) 65 unset( $allowed_themes[ $theme ] ); 66 update_site_option( 'allowedthemes', $allowed_themes ); 59 if ( ! empty($themes) ) { 60 $update = 'disable'; 61 foreach( (array) $themes as $theme ) 62 unset( $allowed_themes[ $theme ] ); 63 update_site_option( 'allowedthemes', $allowed_themes ); 64 } else { 65 $update = 'error'; 66 } 67 67 break; 68 68 } 69 70 wp_redirect( add_query_arg( 'update', $update, wp_get_referer() ) ); 71 exit; 69 72 } 70 73 71 74 $wp_list_table->prepare_items(); … … 96 99 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); ?> 97 100 </h2> 98 101 102 <?php 103 if ( isset( $_GET['update'] ) ) { 104 switch ( $_GET['update'] ) { 105 case 'enabled': 106 echo '<div id="message" class="updated"><p>' . __( 'Theme enabled.' ) . '</p></div>'; 107 break; 108 case 'disabled': 109 echo '<div id="message" class="updated"><p>' . __( 'Theme disabled.' ) . '</p></div>'; 110 break; 111 case 'error': 112 echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>'; 113 break; 114 } 115 } 116 ?> 117 99 118 <form method="get" action=""> 100 119 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> 101 120 </form>