| 1 |
<?php |
| 2 |
|
| 3 |
namespace Templately\Core; |
| 4 |
|
| 5 |
class Maintenance { |
| 6 |
/** |
| 7 |
* Init Maintenance |
| 8 |
* |
| 9 |
* @since 2.0.1 |
| 10 |
* @return void |
| 11 |
*/ |
| 12 |
public static function init(){ |
| 13 |
register_activation_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'activation' ] ); |
| 14 |
register_uninstall_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'uninstall' ] ); |
| 15 |
add_action('plugins_loaded', array(__CLASS__, 'plugin_redirect'), 90); |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Runs on activation |
| 20 |
* |
| 21 |
* @since 2.0.1 |
| 22 |
* @return void |
| 23 |
*/ |
| 24 |
public static function activation(){ |
| 25 |
update_option('templately_do_activation_redirect', true); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Runs on uninstallation. |
| 30 |
* |
| 31 |
* @since 2.0.1 |
| 32 |
* @return void |
| 33 |
*/ |
| 34 |
public static function uninstall(){ |
| 35 |
|
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Redirect on installation. |
| 40 |
* |
| 41 |
* @since 2.2.7 |
| 42 |
* @return void |
| 43 |
*/ |
| 44 |
public static function plugin_redirect(){ |
| 45 |
if (get_option('templately_do_activation_redirect', false)) { |
| 46 |
delete_option('templately_do_activation_redirect'); |
| 47 |
wp_safe_redirect(admin_url('admin.php?page=templately&path=elementor/packs')); |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
|