/home/desid573/verdenaturopathy.com.au/wp-content/themes/Divi/d5-readiness
Edit: /home/desid573/verdenaturopathy.com.au/wp-content/themes/Divi/d5-readiness/d5-readiness.php (5730B)
array(
'et_d5_readiness_get_overview_status',
'et_d5_readiness_get_result_list',
'et_d5_readiness_rollback_d5_to_d4',
),
];
}
/**
* Callback for `et_should_load_shortcode_framework` filter to force shortcode framework to be loaded
* when AJAX request is made for getting post check result list on D5 Readiness app. Shortcode framework
* is not loaded on AJAX requests by default for performance reason.
*
* @since ??
*
* @param bool $value The current value.
*
* @return bool
*/
public static function force_load_shortcode_framework( $value ) {
global $pagenow;
$is_d5_readiness_page = 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'et_d5_readiness' === $_GET['page'];
// phpcs:disable WordPress.Security.NonceVerification -- It just need to figure out if this is get result list.
if ( $is_d5_readiness_page || ( wp_doing_ajax() && isset( $_POST['action'] ) && 'et_d5_readiness_get_result_list' === $_POST['action'] ) ) {
return true;
}
return $value;
}
/**
* Clear module cache transient when theme is switched.
*
* This ensures that when users switch from D4 to D5 after editing content in D4,
* the migrator starts with fresh data and doesn't show stale module counts.
*
* @since ??
*
* @return void
*/
public static function clear_module_cache_on_theme_switch() {
Helpers\clear_modules_conversation_cache();
}
/**
* Clear module cache transient when Divi theme is updated.
*
* This ensures that after a theme update, the migrator uses fresh data since
* module conversion capabilities may have changed in the new version.
*
* @since ??
*
* @param WP_Upgrader $upgrader WP_Upgrader instance.
* @param array $options Array of bulk item update data.
*
* @return void
*/
public static function clear_module_cache_on_upgrade( $upgrader, $options ) {
// Only clear cache if this is a theme update.
if ( ! isset( $options['action'], $options['type'] ) || 'update' !== $options['action'] || 'theme' !== $options['type'] ) {
return;
}
/*
* Check if the current (parent) theme was updated.
*
* WordPress passes:
* - `$options['themes']` (array) for bulk theme updates,
* - `$options['theme']` (string) for single theme updates / auto-updates.
*/
$updated_themes = [];
if ( isset( $options['themes'] ) && is_array( $options['themes'] ) ) {
$updated_themes = array_merge( $updated_themes, $options['themes'] );
}
if ( isset( $options['theme'] ) && is_string( $options['theme'] ) ) {
$updated_themes[] = $options['theme'];
}
$updated_themes = array_values(
array_unique(
array_filter( $updated_themes, 'is_string' )
)
);
if ( empty( $updated_themes ) ) {
return;
}
$current_theme = get_template();
if ( in_array( $current_theme, $updated_themes, true ) ) {
Helpers\clear_modules_conversation_cache();
}
}
}
ET_D5_Readiness::instance();