Ticket #23819: 23819.2.2.diff
File 23819.2.2.diff, 2.2 KB (added by , 12 years ago) |
---|
-
wp-content/themes/twentythirteen/inc/back-compat.php
1 1 <?php 2 2 /** 3 * Prevents Twenty Thirteen from running on WordPress versions prior to 3.6. 4 * 5 * Twenty Thirteen is meant to be not backwards compatible, since it relies on 6 * a lot of new functions and markup changes that were introduced in 3.6. 7 * 8 * @package WordPress 9 * @subpackage Twenty_Thirteen 10 * @since Twenty Thirteen 1.0 11 */ 12 13 /** 3 14 * Prevent switching to Twenty Thirteen on old versions of WordPress. Switches 4 15 * to the previously activated theme or the default theme. 16 * 17 * @since Twenty Thirteen 1.0 18 * 19 * @param string $theme_name 20 * @param WP_Theme $theme 21 * @return void 5 22 */ 6 23 function twentythirteen_switch_theme( $theme_name, $theme ) { 7 24 if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '>=' ) ) … … 17 34 } 18 35 add_action( 'after_switch_theme', 'twentythirteen_switch_theme', 10, 2 ); 19 36 37 /** 38 * Prints an update nag after an unsuccessful attempt to switch to 39 * Twenty Thirteen on WordPress versions prior to 3.6. 40 * 41 * @since Twenty Thirteen 1.0 42 * 43 * @return void 44 */ 20 45 function twentythirteen_upgrade_notice() { 21 46 $message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.' ), $GLOBALS['wp_version'] ); 22 47 printf( '<div class="error"><p>%s</p></div>', $message ); 23 } 24 No newline at end of file 48 } 49 50 /** 51 * Prevents the Customizer from being loaded on WordPress versions prior to 3.6. 52 * 53 * @since Twenty Thirteen 1.0 54 * 55 * @return void 56 */ 57 function twentythirteen_customize() { 58 if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) ) 59 wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.' ), $GLOBALS['wp_version'] ) . sprintf( ' <a href="javascript:history.go(-1)">%s</a>', __( 'Go back.' ) ) ); 60 } 61 add_action( 'load-customize.php', 'twentythirteen_customize' );