| 1 |
<?php |
| 2 |
|
| 3 |
namespace Hostinger\Admin\Onboarding; |
| 4 |
|
| 5 |
use Hostinger\Admin\Onboarding\Steps\AddDescription; |
| 6 |
use Hostinger\Admin\Onboarding\Steps\AddHeading; |
| 7 |
use Hostinger\Admin\Onboarding\Steps\AddImage; |
| 8 |
use Hostinger\Admin\Onboarding\Steps\ConnectAffiliate; |
| 9 |
use Hostinger\Admin\Onboarding\Steps\SetupStore; |
| 10 |
use Hostinger\Settings; |
| 11 |
use Hostinger\Helper; |
| 12 |
use Hostinger\Admin\Onboarding\Steps\AddLogo; |
| 13 |
use Hostinger\Admin\Onboarding\Steps\AddPost; |
| 14 |
use Hostinger\Admin\Onboarding\Steps\AddPage; |
| 15 |
use Hostinger\Admin\Onboarding\Steps\ConnectDomain; |
| 16 |
|
| 17 |
defined( 'ABSPATH' ) || exit; |
| 18 |
|
| 19 |
class Onboarding { |
| 20 |
private function load_steps(): array { |
| 21 |
$steps = array(); |
| 22 |
$website_type = Settings::get_setting( 'survey.website.type' ); |
| 23 |
|
| 24 |
if ( get_theme_support( 'custom-logo' ) ) { |
| 25 |
$steps[] = new AddLogo(); |
| 26 |
} |
| 27 |
|
| 28 |
if ( $website_type === Settings::WEBSITE_TYPE_BLOG ) { |
| 29 |
$steps[] = new AddPost(); |
| 30 |
} else { |
| 31 |
$steps[] = new AddDescription(); |
| 32 |
} |
| 33 |
|
| 34 |
$steps[] = new AddImage(); |
| 35 |
$steps[] = new AddHeading(); |
| 36 |
$steps[] = new AddPage(); |
| 37 |
|
| 38 |
if ( Helper::is_plugin_active( 'hostinger-affiliate-plugin' ) ) { |
| 39 |
$steps[] = new ConnectAffiliate(); |
| 40 |
} |
| 41 |
|
| 42 |
if ( class_exists( 'WooCommerce' ) ) { |
| 43 |
$steps[] = new SetupStore(); |
| 44 |
} |
| 45 |
|
| 46 |
$steps[] = new ConnectDomain(); |
| 47 |
|
| 48 |
return $steps; |
| 49 |
} |
| 50 |
|
| 51 |
public function get_steps(): array { |
| 52 |
return $this->load_steps(); |
| 53 |
} |
| 54 |
|
| 55 |
public function maintenance_mode_enabled(): bool { |
| 56 |
$published = get_option( 'hostinger_maintenance_mode' ); |
| 57 |
|
| 58 |
return (bool) $published; |
| 59 |
} |
| 60 |
|
| 61 |
public function get_content(): array { |
| 62 |
if ( ! $this->maintenance_mode_enabled() ) { |
| 63 |
return array( |
| 64 |
'title' => __( 'Website is published', 'hostinger' ), |
| 65 |
'description' => __( 'You can access this guide material any time when updating your website', 'hostinger' ), |
| 66 |
'btn' => array( |
| 67 |
'text' => __( 'Preview website', 'hostinger' ), |
| 68 |
'class' => 'hsr-btn hsr-primary-btn hsr-publish-btn', |
| 69 |
'url' => home_url(), |
| 70 |
), |
| 71 |
); |
| 72 |
} |
| 73 |
|
| 74 |
return array( |
| 75 |
'title' => __( 'Set up your website', 'hostinger' ), |
| 76 |
'description' => __( 'Follow our guided checklist to setup your website', 'hostinger' ), |
| 77 |
'btn_text' => __( 'Publish website', 'hostinger' ), |
| 78 |
'btn' => array( |
| 79 |
'text' => __( 'Publish website', 'hostinger' ), |
| 80 |
'class' => 'hsr-btn hsr-primary-btn hsr-publish-btn', |
| 81 |
'url' => '#', |
| 82 |
), |
| 83 |
); |
| 84 |
} |
| 85 |
} |
| 86 |
|