PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 2.2.7
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v2.2.7
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/Core/Maintenance.php +17 -55 3.0.32.2.7 View file →
@@ -1,88 +1,50 @@
1 1 <?php
2 2
3 3 namespace Templately\Core;
4 4
5 -use Templately\Admin\Roles;
6 -
7 5 class Maintenance {
8 6 /**
9 7 * Init Maintenance
10 8 *
9 + * @since 2.0.1
11 10 * @return void
12 - * @since 2.0.1
13 11 */
14 - public static function init() {
12 + public static function init(){
15 13 register_activation_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'activation' ] );
16 14 register_uninstall_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'uninstall' ] );
17 - register_deactivation_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'deactivation' ] );
18 - add_action( 'admin_init', [ __CLASS__, 'maybe_redirect_templately' ] );
15 + add_action('plugins_loaded', array(__CLASS__, 'plugin_redirect'), 90);
19 16 }
20 17
21 18 /**
22 19 * Runs on activation
23 20 *
21 + * @since 2.0.1
24 22 * @return void
25 - * @since 2.0.1
26 23 */
27 - public static function activation( $network_wide ) {
28 - // Initialize Roles
29 - ( new Roles() )->setup();
30 -
31 - if ( wp_doing_ajax() ) {
32 - return;
33 - }
34 -
35 - if ( is_multisite() && $network_wide ) {
36 - return;
37 - }
38 -
39 - set_transient( 'templately_activation_redirect', true, MINUTE_IN_SECONDS );
24 + public static function activation(){
25 + update_option('templately_do_activation_redirect', true);
40 26 }
41 27
42 28 /**
43 - * Runs on activation
29 + * Runs on uninstallation.
44 30 *
31 + * @since 2.0.1
45 32 * @return void
46 - * @since 2.0.1
47 33 */
48 - public static function deactivation($network_wide) {
49 - // De-initialize Roles
50 - ( new Roles() )->setup( true );
51 - if ( is_multisite() && $network_wide ) {
52 - return;
53 - }
34 + public static function uninstall(){
54 35
55 - set_transient( 'templately_activation_redirect', true, MINUTE_IN_SECONDS );
56 36 }
57 37
58 -
59 38 /**
60 - * Runs on uninstallation.
39 + * Redirect on installation.
61 40 *
41 + * @since 2.2.7
62 42 * @return void
63 - * @since 2.0.1
64 43 */
65 - public static function uninstall() {
66 -
67 - }
68 -
69 - /**
70 - * Redirect on Active
71 - */
72 - public static function maybe_redirect_templately() {
73 - if ( ! get_transient( 'templately_activation_redirect' ) ) {
74 - return;
75 - }
76 - if ( wp_doing_ajax() ) {
77 - return;
78 - }
79 -
80 - delete_transient( 'templately_activation_redirect' );
81 - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
82 - return;
83 - }
84 - // Safe Redirect to Templately Page
85 - wp_safe_redirect( admin_url( 'admin.php?page=templately&path=elementor/packs' ) );
86 - exit;
87 - }
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 + }
88 50 }