Make WordPress Core

Ticket #35889: twenty-thirteen.2.patch

File twenty-thirteen.2.patch, 3.3 KB (added by ramiy, 9 years ago)
  • wp-content/themes/twentythirteen/inc/back-compat.php

     
    33 * Twenty Thirteen back compat functionality
    44 *
    55 * Prevents Twenty Thirteen from running on WordPress versions prior to 3.6,
    6  * since this theme is not meant to be backward compatible and relies on
    7  * many new functions and markup changes introduced in 3.6.
     6 * since this theme is not meant to be backward compatible beyond that and
     7 * relies on many newer functions and markup changes introduced in 3.6.
    88 *
    99 * @package WordPress
    1010 * @subpackage Twenty_Thirteen
     
    1212 */
    1313
    1414/**
    15  * Prevent switching to Twenty Thirteen on old versions of WordPress.
     15 * Prevent switching to Twenty Thirteen on unsupported versions of WordPress.
    1616 *
    1717 * Switches to the default theme.
    1818 *
     
    2929 * Add message for unsuccessful theme switch.
    3030 *
    3131 * Prints an update nag after an unsuccessful attempt to switch to
    32  * Twenty Thirteen on WordPress versions prior to 3.6.
     32 * Twenty Thirteen on unsupported versions of WordPress.
    3333 *
    3434 * @since Twenty Thirteen 1.0
    3535 */
    3636function twentythirteen_upgrade_notice() {
    37         $message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] );
    38         printf( '<div class="error"><p>%s</p></div>', $message );
     37        printf( '<div class="error"><p>%s</p></div>', twentythirteen_minimum_required_version_message() );
    3938}
    4039
    4140/**
    42  * Prevent the Customizer from being loaded on WordPress versions prior to 3.6.
     41 * Prevent the Customizer from being loaded on unsupported versions of WordPress.
    4342 *
    4443 * @since Twenty Thirteen 1.0
    4544 */
    4645function twentythirteen_customize() {
    47         wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ), '', array(
     46        wp_die( twentythirteen_minimum_required_version_message(), '', array(
    4847                'back_link' => true,
    4948        ) );
    5049}
     
    5150add_action( 'load-customize.php', 'twentythirteen_customize' );
    5251
    5352/**
    54  * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4.
     53 * Prevent the Theme Preview from being loaded on unsupported versions of WordPress.
    5554 *
    5655 * @since Twenty Thirteen 1.0
    5756 */
    5857function twentythirteen_preview() {
    5958        if ( isset( $_GET['preview'] ) ) {
    60                 wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ) );
     59                wp_die( twentythirteen_minimum_required_version_message() );
    6160        }
    6261}
    6362add_action( 'template_redirect', 'twentythirteen_preview' );
     63
     64/**
     65 * Minimum required WordPress version message.
     66 *
     67 * @since Twenty Thirteen 1.9
     68 *
     69 * @global string $wp_version WordPress version.
     70 * @return string
     71 */
     72function twentythirteen_minimum_required_version_message() {
     73        $message = sprintf(
     74                /* translators: %s: WordPress version */
     75                __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ),
     76                $GLOBALS['wp_version']
     77        );
     78        return $message;
     79}