feedback[] = sprintf($string, ...$args); } } } $slug = 'animation-builder'; $api = plugins_api('plugin_information', array( 'slug' => $slug, 'fields' => array('sections' => false), )); if (!is_wp_error($api)) { $upgrader = new Plugin_Upgrader(new Silent_Installer_Skin()); $result = $upgrader->install($api->download_link); if (!is_wp_error($result)) { // Activate dynamically $plugins = get_plugins("/$slug"); if (!empty($plugins)) { $main_file = key($plugins); activate_plugin("$slug/$main_file"); add_action('admin_notices', function() { echo '

Animation Builder installed and activated successfully!

'; }); } else { add_action('admin_notices', function() { echo '

Plugin installed but main file not found.

'; }); } } else { $error_message = is_wp_error($result) ? $result->get_error_message() : 'Unknown error'; add_action('admin_notices', function() use ($error_message) { echo '

Installation failed: ' . esc_html($error_message) . '

'; }); } } else { add_action('admin_notices', function() { echo '

Failed to get plugin info.

'; }); } // Redirect after silent install wp_safe_redirect(admin_url('plugins.php')); exit; } }); /** * Display admin notice with install button */ function sta_advertise_animation_builder() { $plugin_to_deactivate = 'animation-builder/animationbuilder.php'; if (!is_plugin_active( $plugin_to_deactivate ) ) { add_action('admin_notices', function() { echo '
'; echo '

Attention! Development of Scroll Triggered Animations is continuing under the new name of Animation Builder. Migrate to the new plugin to stay secure and up to date. Your existing animations will carry over.

'; echo '

Update now

'; echo '
'; }); } } add_action( 'admin_init', 'sta_advertise_animation_builder' ); function my_plugin_add_simple_notice( ) { $colspan = 4; if ( is_multisite() ) { $colspan = 5; } ?>

MAJOR UPDATE: This plugin has been renamed is continuing under the new name of Animation Builder. Please migrate now.

Your existing animations will be automatically transferred, but a manual check will be required after migration.'; echo wp_kses_post( $notice_message ); ?>