Current path: home/webdevt/www/demo2/wp-content/plugins/divi-contact-form-helper/d5/server/Admin/Setup/
?? Go up: /home/webdevt/www/demo2/wp-content/plugins/divi-contact-form-helper/d5/server/Admin
<?php
namespace KS_PAC_DCFH\Admin\Setup;
use KS_PAC_DCFH\Admin\Dashboard\DashboardSettingsMigration;
if (!defined('ABSPATH')) {
exit;
}
class PluginActivation
{
public static function activate($network_wide): void
{
self::ensure_divi_theme_active();
self::ensure_min_php_version();
self::ensure_dom_document_module();
self::migrate_settings($network_wide);
}
public static function ensure_min_php_version(): void
{
if (PHP_VERSION_ID < 70400) {
wp_die(
sprintf(
'<p>The Divi Contact Form Helper requires PHP version 7.4 or higher. Please upgrade your PHP version.</p><a href="%s">Go Back</a>',
esc_url(admin_url('plugins.php'))
)
);
}
}
public static function ensure_divi_theme_active(): void
{
$theme_info = wp_get_theme();
$active_theme = is_child_theme()
? $theme_info->parent()->get('Name')
: $theme_info->get('Name');
if (strtolower($active_theme) !== 'divi') {
deactivate_plugins(KS_PAC_DCFH_PLUGIN_BASENAME);
wp_die(
sprintf(
'<p>The Divi Contact Form Helper plugin only works with the Divi Theme. Your current active theme is <b>%s</b>. The plugin has been deactivated. Please return to your WordPress dashboard.</p><a href="%s">Go Back</a>',
esc_html($active_theme),
esc_url(admin_url('plugins.php'))
)
);
}
}
public static function migrate_settings($network_wide): void
{
$migrator = new DashboardSettingsMigration();
$migrator->maybe_migrate();
}
public static function ensure_dom_document_module(): void
{
if (!class_exists('DOMDocument')) {
wp_die(
sprintf(
'<p>The Divi Contact Form Helper can not be activated because it requires DomDocument module to be installed. Please contact your server administrator to update server.</p><a href="%s">Go Back</a>',
esc_url(admin_url('plugins.php'))
)
);
}
}
}