| @@ -1,10 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Kits\Manager; | |
| 5 | -use Elementor\Core\Upgrade\Manager as Upgrade_Manager; | |
| 6 | - | |
| 7 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 5 | exit; // Exit if accessed directly. |
| 9 | 6 | } |
| 10 | 7 | |
| @@ -24,9 +21,8 @@ | ||
| 24 | 21 | * Set Elementor activation hook. |
| 25 | 22 | * |
| 26 | 23 | * Fired by `register_activation_hook` when the plugin is activated. |
| 27 | 24 | * |
| 28 | - * @param bool $network_wide | |
| 29 | 25 | * @since 1.0.0 |
| 30 | 26 | * @access public |
| 31 | 27 | * @static |
| 32 | 28 | */ |
| @@ -36,41 +32,14 @@ | ||
| 36 | 32 | wp_schedule_event( time(), 'daily', 'elementor/tracker/send_event' ); |
| 37 | 33 | flush_rewrite_rules(); |
| 38 | 34 | |
| 39 | 35 | if ( is_multisite() && $network_wide ) { |
| 40 | - static::create_default_kit( | |
| 41 | - get_sites( [ | |
| 42 | - 'fields' => 'ids', | |
| 43 | - ] ) | |
| 44 | - ); | |
| 45 | - | |
| 46 | 36 | return; |
| 47 | 37 | } |
| 48 | 38 | |
| 49 | - static::create_default_kit(); | |
| 50 | - static::insert_defaults_options(); | |
| 51 | - | |
| 52 | 39 | set_transient( 'elementor_activation_redirect', true, MINUTE_IN_SECONDS ); |
| 53 | 40 | } |
| 54 | 41 | |
| 55 | - public static function insert_defaults_options() { | |
| 56 | - $history = Upgrade_Manager::get_installs_history(); | |
| 57 | - if ( empty( $history ) ) { | |
| 58 | - $default_options = [ | |
| 59 | - 'elementor_font_display' => 'swap', | |
| 60 | - ]; | |
| 61 | - foreach ( $default_options as $option_name => $option_value ) { | |
| 62 | - if ( \Elementor\Utils::is_empty( get_option( $option_name ) ) ) { | |
| 63 | - add_option( $option_name, $option_value ); | |
| 64 | - } | |
| 65 | - } | |
| 66 | - } | |
| 67 | - } | |
| 68 | - | |
| 69 | - public static function deactivation() { | |
| 70 | - Api::get_deactivation_data(); | |
| 71 | - } | |
| 72 | - | |
| 73 | 42 | /** |
| 74 | 43 | * Uninstall Elementor. |
| 75 | 44 | * |
| 76 | 45 | * Set Elementor uninstallation hook. |
| @@ -82,10 +51,8 @@ | ||
| 82 | 51 | * @static |
| 83 | 52 | */ |
| 84 | 53 | public static function uninstall() { |
| 85 | 54 | wp_clear_scheduled_hook( 'elementor/tracker/send_event' ); |
| 86 | - | |
| 87 | - Api::get_uninstalled_data(); | |
| 88 | 55 | } |
| 89 | 56 | |
| 90 | 57 | /** |
| 91 | 58 | * Init. |
| @@ -97,35 +64,7 @@ | ||
| 97 | 64 | * @static |
| 98 | 65 | */ |
| 99 | 66 | public static function init() { |
| 100 | 67 | register_activation_hook( ELEMENTOR_PLUGIN_BASE, [ __CLASS__, 'activation' ] ); |
| 101 | - register_deactivation_hook( ELEMENTOR_PLUGIN_BASE, [ __CLASS__, 'deactivation' ] ); | |
| 102 | 68 | register_uninstall_hook( ELEMENTOR_PLUGIN_BASE, [ __CLASS__, 'uninstall' ] ); |
| 103 | - | |
| 104 | - add_action( 'wpmu_new_blog', function ( $site_id ) { | |
| 105 | - if ( ! is_plugin_active_for_network( ELEMENTOR_PLUGIN_BASE ) ) { | |
| 106 | - return; | |
| 107 | - } | |
| 108 | - | |
| 109 | - static::create_default_kit( [ $site_id ] ); | |
| 110 | - } ); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * @param array $site_ids | |
| 115 | - */ | |
| 116 | - private static function create_default_kit( array $site_ids = [] ) { | |
| 117 | - if ( ! empty( $site_ids ) ) { | |
| 118 | - foreach ( $site_ids as $site_id ) { | |
| 119 | - switch_to_blog( $site_id ); | |
| 120 | - | |
| 121 | - Manager::create_default_kit(); | |
| 122 | - | |
| 123 | - restore_current_blog(); | |
| 124 | - } | |
| 125 | - | |
| 126 | - return; | |
| 127 | - } | |
| 128 | - | |
| 129 | - Manager::create_default_kit(); | |
| 130 | 69 | } |
| 131 | 70 | } |