response ) ) { return false; } $bizznis_update = $bizznis_update->response; if ( ! isset( $bizznis_update['bizznis'] ) ) { return false; } else { $bizznis_update = $bizznis_update['bizznis']; } # If we're already using the latest version, return false if ( version_compare( PARENT_THEME_VERSION, $bizznis_update['new_version'], '>=' ) ) { return false; } return $bizznis_update; } /** * Update Bizznis to the latest version. * * This iterative update function will take a Bizznis installation, no matter * how old, and update its options to the latest version. * * It used to iterate over theme version, but now uses a database version * system, which allows for changes within pre-releases, too. * * @since 1.0.0 */ add_action( 'admin_init', 'bizznis_upgrade', 20 ); function bizznis_upgrade() { # Don't do anything if we're on the latest version if ( bizznis_get_option( 'db_version', null, false ) >= PARENT_DB_VERSION ) { return; } /* ######################### # UPDATE TO VERSION 1.0. ######################### if ( version_compare( bizznis_get_option( 'theme_version', null, false ), '1.9', '<' ) ) { # Vestige nav settings, for backward compatibility if ( 'nav-menu' != bizznis_get_option( 'nav_type' ) ) { _bizznis_vestige( array( 'nav_type', 'nav_superfish', 'nav_home', 'nav_pages_sort', 'nav_categories_sort', 'nav_depth', 'nav_exclude', 'nav_include', ) ); } # Vestige subnav settings, for backward compatibility if ( 'nav-menu' != bizznis_get_option( 'subnav_type' ) ) { _bizznis_vestige( array( 'subnav_type', 'subnav_superfish', 'subnav_home', 'subnav_pages_sort', 'subnav_categories_sort', 'subnav_depth', 'subnav_exclude', 'subnav_include', ) ); } $theme_settings = get_option( BIZZNIS_SETTINGS_FIELD ); $new_settings = array( 'theme_version' => '1.6', ); $settings = wp_parse_args( $new_settings, $theme_settings ); update_option( BIZZNIS_SETTINGS_FIELD, $settings ); } */ # UPDATE DB TO VERSION 1008 if ( bizznis_get_option( 'db_version', null, false ) < '1008' ) { bizznis_upgrade_1008(); } do_action( 'bizznis_upgrade' ); } /** * Upgrade the database to version 1008. * * @since 1.0.8 */ function bizznis_upgrade_1008() { # Update Settings _bizznis_update_settings( array( 'theme_version' => '1.0.8', 'db_version' => '1008', ) ); } /** * Redirects the user back to the theme settings page, refreshing the data and * notifying the user that they have successfully updated. * * @since 1.0.0 */ add_action( 'bizznis_upgrade', 'bizznis_upgrade_redirect' ); function bizznis_upgrade_redirect() { if ( ! is_admin() || ! current_user_can( 'edit_theme_options' ) ) { return; } bizznis_admin_redirect( 'bizznis-about' ); exit; } /** * Displays the notice that the theme settings were successfully updated to the * latest version. * * Currently, only used for pre-release update notices. * * @since 1.0.0 */ add_action( 'admin_notices', 'bizznis_upgraded_notice' ); function bizznis_upgraded_notice() { if ( ! bizznis_is_menu_page( 'bizznis' ) ) { return; } if ( isset( $_REQUEST['upgraded'] ) && 'true' == $_REQUEST['upgraded'] ) { echo '
' . sprintf( __( 'Congratulations! You are now rocking Bizznis %s', 'bizznis' ), bizznis_get_option( 'theme_version' ) ) . '