web/wp-admin/themes.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    18 	if ( 'activate' == $_GET['action'] ) {
    18 	if ( 'activate' == $_GET['action'] ) {
    19 		check_admin_referer('switch-theme_' . $_GET['stylesheet']);
    19 		check_admin_referer('switch-theme_' . $_GET['stylesheet']);
    20 		$theme = wp_get_theme( $_GET['stylesheet'] );
    20 		$theme = wp_get_theme( $_GET['stylesheet'] );
    21 		if ( ! $theme->exists() || ! $theme->is_allowed() )
    21 		if ( ! $theme->exists() || ! $theme->is_allowed() )
    22 			wp_die( __( 'Cheatin’ uh?' ) );
    22 			wp_die( __( 'Cheatin’ uh?' ) );
    23 		switch_theme( $theme->get_template(), $theme->get_stylesheet() );
    23 		switch_theme( $theme->get_stylesheet() );
    24 		wp_redirect( admin_url('themes.php?activated=true') );
    24 		wp_redirect( admin_url('themes.php?activated=true') );
    25 		exit;
    25 		exit;
    26 	} elseif ( 'delete' == $_GET['action'] ) {
    26 	} elseif ( 'delete' == $_GET['action'] ) {
    27 		check_admin_referer('delete-theme_' . $_GET['stylesheet']);
    27 		check_admin_referer('delete-theme_' . $_GET['stylesheet']);
    28 		$theme = wp_get_theme( $_GET['stylesheet'] );
    28 		$theme = wp_get_theme( $_GET['stylesheet'] );
   106 <?php
   106 <?php
   107 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
   107 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
   108 <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
   108 <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
   109 <?php elseif ( isset($_GET['activated']) ) :
   109 <?php elseif ( isset($_GET['activated']) ) :
   110 		if ( isset( $_GET['previewed'] ) ) { ?>
   110 		if ( isset( $_GET['previewed'] ) ) { ?>
   111 		<div id="message2" class="updated"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>.' ), home_url( '/' ) ); ?></p></div>
   111 		<div id="message2" class="updated"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div>
   112 		<?php } elseif ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) && current_user_can('edit_theme_options') ) { ?>
   112 		<?php } else { ?>
   113 <div id="message2" class="updated"><p><?php printf( __('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings</a> screen to configure them.'), admin_url( 'widgets.php' ) ); ?></p></div><?php
       
   114 		} else { ?>
       
   115 <div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
   113 <div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
   116 		}
   114 		}
   117 	elseif ( isset($_GET['deleted']) ) : ?>
   115 	elseif ( isset($_GET['deleted']) ) : ?>
   118 <div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
   116 <div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
   119 <?php
   117 <?php
   145 		<ul class="theme-info">
   143 		<ul class="theme-info">
   146 			<li><?php printf( __('By %s'), $ct->display('Author') ); ?></li>
   144 			<li><?php printf( __('By %s'), $ct->display('Author') ); ?></li>
   147 			<li><?php printf( __('Version %s'), $ct->display('Version') ); ?></li>
   145 			<li><?php printf( __('Version %s'), $ct->display('Version') ); ?></li>
   148 		</ul>
   146 		</ul>
   149 		<p class="theme-description"><?php echo $ct->display('Description'); ?></p>
   147 		<p class="theme-description"><?php echo $ct->display('Description'); ?></p>
       
   148 		<?php if ( $ct->parent() ) {
       
   149 			printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>',
       
   150 				__( 'http://codex.wordpress.org/Child_Themes' ),
       
   151 				$ct->parent()->display( 'Name' ) );
       
   152 		} ?>
   150 		<?php theme_update_available( $ct ); ?>
   153 		<?php theme_update_available( $ct ); ?>
   151 	</div>
   154 	</div>
   152 
   155 
   153 	<?php
   156 	<?php
   154 	// Pretend you didn't see this.
   157 	// Pretend you didn't see this.
   167 				if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
   170 				if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
   168 					$options[] = "<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
   171 					$options[] = "<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
   169 				else
   172 				else
   170 					$options[] = "<a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
   173 					$options[] = "<a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
   171 			} else if ( current_user_can($item[1]) ) {
   174 			} else if ( current_user_can($item[1]) ) {
   172 				if ( file_exists(ABSPATH . 'wp-admin/' . $item[2]) ) {
   175 				$menu_file = $item[2];
       
   176 				if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
       
   177 					$menu_file = substr( $menu_file, 0, $pos );
       
   178 				if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
   173 					$options[] = "<a href='{$item[2]}'$class>{$item[0]}</a>";
   179 					$options[] = "<a href='{$item[2]}'$class>{$item[0]}</a>";
   174 				} else {
   180 				} else {
   175 					$options[] = "<a href='themes.php?page={$item[2]}'$class>{$item[0]}</a>";
   181 					$options[] = "<a href='themes.php?page={$item[2]}'$class>{$item[0]}</a>";
   176 				}
   182 				}
   177 			}
   183 			}
   191 		<ul>
   197 		<ul>
   192 			<?php foreach ( $options as $option ) : ?>
   198 			<?php foreach ( $options as $option ) : ?>
   193 				<li><?php echo $option; ?></li>
   199 				<li><?php echo $option; ?></li>
   194 			<?php endforeach; ?>
   200 			<?php endforeach; ?>
   195 		</ul>
   201 		</ul>
       
   202 		<?php
       
   203 		endif; // options
       
   204 		?>
   196 	</div>
   205 	</div>
   197 	<?php
   206 	<?php
   198 		endif; // options
       
   199 	endif; // options || edit_theme_options
   207 	endif; // options || edit_theme_options
   200 	?>
   208 	?>
   201 
   209 
   202 </div>
   210 </div>
   203 
   211