PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 2.2.13
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v2.2.13
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
templately / includes / Core / Maintenance.php

Maintenance.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! 2.2.13, at includes/Core/Maintenance.php

69 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 register_deactivation_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'deactivation' ] );
16 add_action( 'admin_init', [ __CLASS__, 'maybe_redirect_templately' ] );
17 }
18
19 /**
20 * Runs on activation
21 *
22 * @since 2.0.1
23 */
24 public static function activation( $network_wide ) {
25 if ( wp_doing_ajax() ) {
26 return;
27 }
28
29 if ( is_multisite() && $network_wide ) {
30 return;
31 }
32
33 set_transient( 'templately_activation_redirect', true, MINUTE_IN_SECONDS );
34 }
35
36 public static function deactivation() {
37 }
38
39 /**
40 * Runs on uninstallation.
41 *
42 * @since 2.0.1
43 * @return void
44 */
45 public static function uninstall(){
46
47 }
48
49 /**
50 * Redirect on Active
51 */
52 public static function maybe_redirect_templately() {
53 if ( ! get_transient( 'templately_activation_redirect' ) ) {
54 return;
55 }
56 if ( wp_doing_ajax() ) {
57 return;
58 }
59
60 delete_transient( 'templately_activation_redirect' );
61 if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
62 return;
63 }
64 // Safe Redirect to Templately Page
65 wp_safe_redirect( admin_url( 'admin.php?page=templately&path=elementor/packs' ) );
66 exit;
67 }
68 }
69