?? GreyFile — Mystic File Browser

Current path: home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app/Base/



?? Go up: /home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app

?? Viewing: Activate.php

<?php

namespace KS_PAC_DCFH\Base;

if (!defined('ABSPATH')) {
    exit;
}

class Activate
{

    public static function activate($network_wide): void
    {
        self::check_requirements();
        if ($network_wide && function_exists('is_multisite') && is_multisite()) {
            $sites = get_sites();
            foreach ($sites as $site) {
                switch_to_blog($site->blog_id);
                self::add_options();
                ks_pac_dcfh_file_helper()::create_dir(path_join('pwh-dcfh-uploads', 'tmp'));
                restore_current_blog();
            }
        } else {
            self::add_options();
            ks_pac_dcfh_file_helper()::create_dir(path_join('pwh-dcfh-uploads', 'tmp'));
        }
    }

    public static function check_requirements(): void
    {
        if (!self::is_divi()) {
            deactivate_plugins(KS_PAC_DCFH_PLUGIN_BASENAME);
            wp_die('<p>'.sprintf(esc_html__('The Divi Contact Form Helper can not be activated because it requires DIVI Theme. Your current theme is %1$s.', esc_html('divi-contact-form-helper')),
                    esc_html(wp_get_theme()->get('Name'))).'</p> <a href="'.esc_url(admin_url('plugins.php')).'">'.esc_html__('Go Back', 'divi-contact-form-helper').'</a>');
        }
        if (!self::is_php_7x()) {
            deactivate_plugins(KS_PAC_DCFH_PLUGIN_BASENAME);
            wp_die('<p>'.sprintf(esc_html__('The Divi Contact Form Helper can not be activated because it requires at least PHP version %1$s. Please contact your server administrator to update server.',
                    esc_html('divi-contact-form-helper')), esc_html('7.4')).'</p> <a href="'.esc_url(admin_url('plugins.php')).'">'.esc_html__('Go Back',
                    'divi-contact-form-helper').'</a>');
        }
        if (!self::is_dom_document_module_installed()) {
            deactivate_plugins(KS_PAC_DCFH_PLUGIN_BASENAME);
            wp_die('<p>'.esc_html__('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.',
                    esc_html('divi-contact-form-helper')).'</p> <a href="'.esc_url(admin_url('plugins.php')).'">'.esc_html__('Go Back',
                    'divi-contact-form-helper').'</a>');
        }
    }

    public static function is_php_7x(): bool
    {
        $php_version = version_compare(PHP_VERSION, esc_html('7.4'), '>=');
        if ($php_version) {
            return true;
        }

        return false;
    }

    public static function is_divi(): bool
    {
        $active_theme = strtolower(wp_get_theme()->get('Name'));
        $parent_theme = strtolower(wp_get_theme()->get('Template'));
        $divi_builder = is_plugin_active('divi-builder/divi-builder.php');
        $divi_ghoster = is_plugin_active('divi-ghoster/divi-ghoster.php');

        return 'divi' === $active_theme
            || 'divi' === $parent_theme
            || 'extra' === $active_theme
            || 'extra' === $parent_theme
            || $divi_builder
            || $divi_ghoster;
    }

    public static function is_dom_document_module_installed(): bool
    {
        if (class_exists('DOMDocument')) {
            return true;
        }

        return false;
    }

    public static function add_options(): void
    {
        $options = [
            'pwh_dcfh_stats_enabled' => 'off',
            'pwh_dcfh_enable_sent_email_log' => 'off',
            'pwh_dcfh_enable_clone_log' => 'off',
            'pwh_dcfh_delete_plugin_data' => 'off',
            'pwh_dcfh_enable_unique_cookie' => 'off',
            'pwh_dcfh_custom_mimes_types' => 'psd|image/vnd.adobe.photoshop,rar|application/x-rar',
            'pwh_dcfh_entry_list_columns' => 'name',
            'pwh_dcfh_entries_date_format' => 'Y/m/d',
            'pwh_dcfh_entries_time_format' => 'h:i:sa',
            'pwh_dcfh_mergetag_date_format' => 'Y/m/d',
            'pwh_dcfh_mergetag_time_format' => 'h:i:sa',
            'pwh_dcfh_smtp_enabled' => 'off',
            'pwh_dcfh_smtp_host' => '',
            'pwh_dcfh_smtp_encryption' => 'none',
            'pwh_dcfh_smtp_port' => '25',
            'pwh_dcfh_smtp_autotls' => 'off',
            'pwh_dcfh_smtp_authentication' => '',
            'pwh_dcfh_smtp_username' => '',
            'pwh_dcfh_smtp_password' => '',
            'pwh_dcfh_smtp_from_email' => '',
            'pwh_dcfh_smtp_from_name' => '',
            'pwh_dcfh_backup_enabled' => 'off',
            'pwh_dcfh_backup_email' => get_bloginfo('admin_email'),
            'pwh_dcfh_backup_schedule' => 'weekly',
            'pwh_dcfh_delete_entries_enabled' => 'of',
            'pwh_dcfh_delete_entries_status' => ['published' => 'on', 'trash' => 'on'],
            'pwh_dcfh_delete_entries_schedule' => '',
            'pwh_dcfh_file_upload_btn_text' => 'Choose Files',
            'pwh_dcfh_accepted_file_text' => 'Accepted file types:',
            'pwh_dcfh_max_filesize_text' => 'Max. file size:',
            'pwh_dcfh_chosen_file_text' => 'No Files Chosen',
            'pwh_dcfh_selected_files_text' => '{chosen_files_count} file{_s_} selected',
            'pwh_dcfh_uploading_text' => '{percentage} uploaded your files, please wait for the system to continue.',
            'pwh_dcfh_already_attached_text' => 'File {filename} has already attached. Please choose another file.',
            'pwh_dcfh_allow_filesize_text' => 'File {filename} not uploaded. Maximum file size {allowed_filesize}.',
            'pwh_dcfh_x_files_allow_text' => 'Only {allowed_files} files are allowed to upload.',
            'pwh_dcfh_remove_file_text' => 'Are you sure you want to remove {filename}?',
            'pwh_dcfh_delete_file_icon_hover_text' => 'Delete',
            'pwh_dcfh_security_reason_text' => 'File {filename} has failed to upload. Sorry, this file type is not permitted for security reasons.',
            'pwh_dcfh_allowedfilesize_text' => 'File {filename} not uploaded. Maximum file size {filesize}',
            'pwh_dcfh_fill_message_text' => 'Please fill in the following fields:',
            'pwh_dcfh_fix_message_text' => 'Please fix the following errors:',
            'pwh_dcfh_siganture_empty_text' => 'The signature pad is empty. Please sign it and then save.',
            'pwh_dcfh_siganture_before_save_text' => 'Are you sure you want to save the signature?',
            'pwh_dcfh_siganture_save_text' => 'The signature has been saved successfully!',
            'pwh_dcfh_siganture_delete_text' => 'The signature has been deleted successfully!',
            'pwh_dcfh_required_captcha_text' => 'Please complete the CAPTCHA.',
            'pwh_dcfh_wrong_captcha_text' => 'There was a problem with the captcha verification.',
            'pwh_dcfh_invalid_email_text' => 'Please enter a valid email address.',
        ];
        $old_options = get_option('et_divi');
        foreach ($options as $key => $option) {
            if (!isset($old_options[$key])) {
                et_update_option($key, $option);
            }
        }
    }
}


??

??