| 1 |
<?php |
| 2 |
namespace Elementor; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly. |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Elementor maintenance. |
| 10 |
* |
| 11 |
* Elementor maintenance handler class is responsible for setting up Elementor |
| 12 |
* activation and uninstallation hooks. |
| 13 |
* |
| 14 |
* @since 1.0.0 |
| 15 |
*/ |
| 16 |
class Maintenance { |
| 17 |
|
| 18 |
/** |
| 19 |
* Activate Elementor. |
| 20 |
* |
| 21 |
* Set Elementor activation hook. |
| 22 |
* |
| 23 |
* Fired by `register_activation_hook` when the plugin is activated. |
| 24 |
* |
| 25 |
* @since 1.0.0 |
| 26 |
* @access public |
| 27 |
* @static |
| 28 |
*/ |
| 29 |
public static function activation( $network_wide ) { |
| 30 |
wp_clear_scheduled_hook( 'elementor/tracker/send_event' ); |
| 31 |
|
| 32 |
wp_schedule_event( time(), 'daily', 'elementor/tracker/send_event' ); |
| 33 |
flush_rewrite_rules(); |
| 34 |
|
| 35 |
if ( is_multisite() && $network_wide ) { |
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
set_transient( 'elementor_activation_redirect', true, MINUTE_IN_SECONDS ); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Uninstall Elementor. |
| 44 |
* |
| 45 |
* Set Elementor uninstallation hook. |
| 46 |
* |
| 47 |
* Fired by `register_uninstall_hook` when the plugin is uninstalled. |
| 48 |
* |
| 49 |
* @since 1.0.0 |
| 50 |
* @access public |
| 51 |
* @static |
| 52 |
*/ |
| 53 |
public static function uninstall() { |
| 54 |
wp_clear_scheduled_hook( 'elementor/tracker/send_event' ); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Init. |
| 59 |
* |
| 60 |
* Initialize Elementor Maintenance. |
| 61 |
* |
| 62 |
* @since 1.0.0 |
| 63 |
* @access public |
| 64 |
* @static |
| 65 |
*/ |
| 66 |
public static function init() { |
| 67 |
register_activation_hook( ELEMENTOR_PLUGIN_BASE, [ __CLASS__, 'activation' ] ); |
| 68 |
register_uninstall_hook( ELEMENTOR_PLUGIN_BASE, [ __CLASS__, 'uninstall' ] ); |
| 69 |
} |
| 70 |
} |
| 71 |
|