| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for the Welcome step of the MLSImport onboarding wizard |
| 4 |
* |
| 5 |
* @link https://mlsimport.com/ |
| 6 |
* @since 6.1.0 |
| 7 |
* |
| 8 |
* @package Mlsimport |
| 9 |
* @subpackage Mlsimport/admin/partials/mlsimport-onboarding-steps |
| 10 |
*/ |
| 11 |
|
| 12 |
// If this file is called directly, abort. |
| 13 |
if (!defined('WPINC')) { |
| 14 |
die; |
| 15 |
} |
| 16 |
|
| 17 |
// Get server info |
| 18 |
$php_version = phpversion(); |
| 19 |
$wp_version = get_bloginfo('version'); |
| 20 |
$memory_limit = WP_MEMORY_LIMIT; |
| 21 |
$max_execution_time = ini_get('max_execution_time'); |
| 22 |
$upload_max_filesize = ini_get('upload_max_filesize'); |
| 23 |
$post_max_size = ini_get('post_max_size'); |
| 24 |
|
| 25 |
// Check requirements |
| 26 |
$requirements = array( |
| 27 |
'php_version' => array( |
| 28 |
'name' => __('PHP Version', 'mlsimport'), |
| 29 |
'value' => $php_version, |
| 30 |
'required' => '7.2', |
| 31 |
'status' => version_compare($php_version, '7.2', '>='), |
| 32 |
'help' => __('MLSImport requires PHP 7.2 or higher.', 'mlsimport'), |
| 33 |
), |
| 34 |
'memory_limit' => array( |
| 35 |
'name' => __('Memory Limit', 'mlsimport'), |
| 36 |
'value' => $memory_limit, |
| 37 |
'required' => '64M', |
| 38 |
'status' => intval($memory_limit) >= 256 || $memory_limit === '-1', |
| 39 |
'help' => __('We recommend setting memory to at least 64MB if not more.', 'mlsimport'), |
| 40 |
), |
| 41 |
'max_execution_time' => array( |
| 42 |
'name' => __('Max Execution Time', 'mlsimport'), |
| 43 |
'value' => $max_execution_time . 's', |
| 44 |
'required' => '120s', |
| 45 |
'status' => $max_execution_time >= 120 || $max_execution_time == 0, |
| 46 |
'help' => __('We recommend setting max execution time to at least 120 seconds.', 'mlsimport'), |
| 47 |
), |
| 48 |
); |
| 49 |
|
| 50 |
// Check if theme is supported |
| 51 |
$current_theme = wp_get_theme(); |
| 52 |
$theme_name = $current_theme->get('Name'); |
| 53 |
$supported_themes = array( |
| 54 |
'WpResidence' => 'WP Residence', |
| 55 |
'houzez' => 'Houzez', |
| 56 |
'RealHomes' => 'Real Homes', |
| 57 |
'Wpestate' => 'WP Estate', |
| 58 |
); |
| 59 |
|
| 60 |
$theme_detected = false; |
| 61 |
$detected_theme_name = ''; |
| 62 |
|
| 63 |
foreach ($supported_themes as $theme_key => $theme_label) { |
| 64 |
if (strtolower($theme_name) === strtolower($theme_key) || strpos(strtolower($theme_name), strtolower($theme_key)) !== false) { |
| 65 |
$theme_detected = true; |
| 66 |
$detected_theme_name = $theme_label; |
| 67 |
break; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
// Theme requirement |
| 72 |
$requirements['theme'] = array( |
| 73 |
'name' => __('Theme Compatibility', 'mlsimport'), |
| 74 |
'value' => $theme_name, |
| 75 |
'required' => implode(', ', $supported_themes), |
| 76 |
'status' => $theme_detected, |
| 77 |
'help' => $theme_detected |
| 78 |
? sprintf(__('Great! We detected your theme as %s, which is supported by MLSImport.', 'mlsimport'), $detected_theme_name) |
| 79 |
: __('MLSImport works best with WP Residence, Houzez, Real Homes, or WP Estate themes.', 'mlsimport'), |
| 80 |
); |
| 81 |
|
| 82 |
// Calculate overall status |
| 83 |
$all_requirements_met = true; |
| 84 |
foreach ($requirements as $req) { |
| 85 |
if (!$req['status']) { |
| 86 |
$all_requirements_met = false; |
| 87 |
break; |
| 88 |
} |
| 89 |
} |
| 90 |
?> |
| 91 |
|
| 92 |
<div class="mlsimport-welcome-content "> |
| 93 |
<p class="mlsimport-welcome-intro"> |
| 94 |
<?php _e('Welcome to the MLSImport Setup Wizard! This will guide you through connecting to your MLS provider, configuring how property data is imported, and setting up your first import.', 'mlsimport'); ?> |
| 95 |
</p> |
| 96 |
|
| 97 |
<div class="mlsimport-welcome-note"> |
| 98 |
<p> |
| 99 |
<?php _e('Before you begin, make sure you have:', 'mlsimport'); ?> |
| 100 |
</p> |
| 101 |
<ul> |
| 102 |
<li><?php _e('Your MLSImport.com account credentials', 'mlsimport'); ?></li> |
| 103 |
<li><?php _e('Your MLS provider information and access credentials', 'mlsimport'); ?></li> |
| 104 |
<li><?php _e('Approximately 10 minutes to complete the setup', 'mlsimport'); ?></li> |
| 105 |
</ul> |
| 106 |
</div> |
| 107 |
|
| 108 |
|
| 109 |
<button type="submit" class="button button-primary mlsimport-wizard-next mlsimport_button"> |
| 110 |
<?php _e('Start the Wizard', 'mlsimport'); ?> |
| 111 |
</button> |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
<div class="mlsimport-requirements-check"> |
| 116 |
<h3><?php _e('System Requirements Check', 'mlsimport'); ?></h3> |
| 117 |
|
| 118 |
<table class="mlsimport-requirements-table widefat"> |
| 119 |
<thead> |
| 120 |
<tr> |
| 121 |
<th><?php _e('Requirement', 'mlsimport'); ?></th> |
| 122 |
<th><?php _e('Your Value', 'mlsimport'); ?></th> |
| 123 |
<th><?php _e('Required', 'mlsimport'); ?></th> |
| 124 |
<th><?php _e('Status', 'mlsimport'); ?></th> |
| 125 |
</tr> |
| 126 |
</thead> |
| 127 |
<tbody> |
| 128 |
<?php foreach ($requirements as $req_key => $req) : ?> |
| 129 |
<tr> |
| 130 |
<td><?php echo esc_html($req['name']); ?></td> |
| 131 |
<td><?php echo esc_html($req['value']); ?></td> |
| 132 |
<td><?php echo esc_html($req['required']); ?></td> |
| 133 |
<td> |
| 134 |
<?php if ($req['status']) : ?> |
| 135 |
<span class="mlsimport-requirement-status success dashicons dashicons-yes"></span> |
| 136 |
<?php else : ?> |
| 137 |
<span class="mlsimport-requirement-status error dashicons dashicons-warning"></span> |
| 138 |
<?php endif; ?> |
| 139 |
</td> |
| 140 |
</tr> |
| 141 |
<?php if (!$req['status']) : ?> |
| 142 |
<tr class="mlsimport-requirement-help"> |
| 143 |
<td colspan="4"><?php echo esc_html($req['help']); ?></td> |
| 144 |
</tr> |
| 145 |
<?php endif; ?> |
| 146 |
<?php endforeach; ?> |
| 147 |
</tbody> |
| 148 |
</table> |
| 149 |
|
| 150 |
<?php if (!$all_requirements_met) : ?> |
| 151 |
<div class="mlsimport-warning-message"> |
| 152 |
<p> |
| 153 |
<?php _e('Some system requirements are not met. You can still proceed, but you might encounter issues during import.', 'mlsimport'); ?> |
| 154 |
</p> |
| 155 |
</div> |
| 156 |
<?php else : ?> |
| 157 |
<div class="mlsimport-success-message"> |
| 158 |
<p> |
| 159 |
<?php _e('Great! Your system meets all the requirements for MLSImport.', 'mlsimport'); ?> |
| 160 |
</p> |
| 161 |
</div> |
| 162 |
<?php endif; ?> |
| 163 |
</div> |
| 164 |
|
| 165 |
|
| 166 |
</div> |
| 167 |
|
| 168 |
<style> |
| 169 |
|
| 170 |
</style> |