????
| Current Path : /home2/morganrand/www/wp-content-bkp/themes/wanderfuls/framework/updates/ |
| Current File : /home2/morganrand/www/wp-content-bkp/themes/wanderfuls/framework/updates/after-update.php |
<?php
/**
* Perform actions after updating the theme
*
* @package Wanderfuls WordPress Theme
* @subpackage Framework
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Hook to init to prevent any possible conflicts in main theme class
function tb_after_update() {
// Define dir
$dir = TB_FRAMEWORK_DIR .'updates/';
// Get theme version
$theme_version = TB_THEME_VERSION;
// Get user version
$version = get_option( 'wanderfuls_version' );
$version = $version ? $version : '2.1.3'; // needs something
// Include useful classes
require_once( $dir .'update-front-end-notice.php' );
// Migrate redux options
if ( ! get_option( 'tb_customizer_migration_complete' ) && get_option( 'tb_options' ) ) {
require_once( $dir .'redux-migrate.php' );
} else {
update_option( 'tb_customizer_migration_complete', 'completed' );
}
// Reset plugin notification and enable
if ( $version != TB_THEME_VERSION ) {
set_theme_mod( 'recommend_plugins_enable', true );
delete_metadata( 'user', null, 'tgmpa_dismissed_notice_tb_theme', null, true );
}
// Display Notice if Supported version of VC is smaller then current version
if ( defined( 'WPB_VC_VERSION' )
&& apply_filters( 'tb_display_outdated_vc_notice', true )
&& ( TB_VC_SUPPORTED_VERSION > WPB_VC_VERSION )
) {
// Make sure TGMA is running
set_theme_mod( 'recommend_plugins_enable', true );
delete_metadata( 'user', null, 'tgmpa_dismissed_notice_tb_theme', null, true );
// Displayu notice
new TB_Update_Front_End_Notice( array(
'title' => 'Wanderfuls v'. $theme_version,
'content' => 'vc_notice',
) );
}
// Lets add an initial version that tells me when they first activated the theme, this never changes
if ( ! get_option( 'wanderfuls_initial_version' ) ) {
update_option( 'wanderfuls_initial_version', $theme_version );
}
// Save all mods to a backup option incase something goes wrong
function tb_backup_mods() {
global $tb_theme_mods;
update_option( 'tb_wanderfuls_customizer_backup' , $tb_theme_mods );
}
// Version 3.0.0 Update
if ( $version < '3.0.0' ) {
tb_backup_mods(); // Backup first
$file = TB_FRAMEWORK_DIR .'updates/update-3_0_0.php';
if ( file_exists( $file ) ) {
require_once( $file );
}
}
// Update theme version
update_option( 'wanderfuls_version', $theme_version );
}
add_action( 'init', 'tb_after_update' );