| Server IP : 108.167.142.43 / Your IP : 216.73.216.223 Web Server : Apache System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64 User : delarice ( 2406) PHP Version : 8.3.36 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home2/delarice/public_html/wp-content/plugins/templately/includes/Core/ |
Upload File : |
<?php
namespace Templately\Core;
use Templately\Admin\Roles;
class Maintenance {
/**
* Init Maintenance
*
* @return void
* @since 2.0.1
*/
public static function init() {
register_activation_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'activation' ] );
register_uninstall_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'uninstall' ] );
register_deactivation_hook( TEMPLATELY_PLUGIN_BASENAME, [ __CLASS__, 'deactivation' ] );
add_action( 'admin_init', [ __CLASS__, 'maybe_redirect_templately' ] );
// Runtime capability hooks — setup() only ever runs on activation, so the
// administrator grant needs a home that runs on every request.
Roles::init();
}
/**
* Runs on activation
*
* @return void
* @since 2.0.1
*/
public static function activation( $network_wide ) {
// Initialize Roles
( new Roles() )->setup();
if ( wp_doing_ajax() ) {
return;
}
if ( is_multisite() && $network_wide ) {
return;
}
set_transient( 'templately_activation_redirect', true, MINUTE_IN_SECONDS );
}
/**
* Runs on activation
*
* @return void
* @since 2.0.1
*/
public static function deactivation($network_wide) {
// De-initialize Roles
( new Roles() )->setup( true );
if ( is_multisite() && $network_wide ) {
return;
}
set_transient( 'templately_activation_redirect', true, MINUTE_IN_SECONDS );
}
/**
* Runs on uninstallation.
*
* @return void
* @since 2.0.1
*/
public static function uninstall() {
}
/**
* Redirect on Active
*/
public static function maybe_redirect_templately() {
if ( ! get_transient( 'templately_activation_redirect' ) ) {
return;
}
if ( wp_doing_ajax() ) {
return;
}
delete_transient( 'templately_activation_redirect' );
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
return;
}
// Safe Redirect to Templately Page
wp_safe_redirect( admin_url( 'admin.php?page=templately&path=elementor/packs' ) );
exit;
}
}