Make WordPress Core

Ticket #23819: 23819.2.2.diff

File 23819.2.2.diff, 2.2 KB (added by obenland, 12 years ago)
  • wp-content/themes/twentythirteen/inc/back-compat.php

     
    11<?php
    22/**
     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/**
    314 * Prevent switching to Twenty Thirteen on old versions of WordPress. Switches
    415 * 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
    522 */
    623function twentythirteen_switch_theme( $theme_name, $theme ) {
    724        if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '>=' ) )
     
    1734}
    1835add_action( 'after_switch_theme', 'twentythirteen_switch_theme', 10, 2 );
    1936
     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 */
    2045function twentythirteen_upgrade_notice() {
    2146        $message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.' ), $GLOBALS['wp_version'] );
    2247        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 */
     57function 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}
     61add_action( 'load-customize.php', 'twentythirteen_customize' );