| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
class Hostinger_Onboarding { |
| 8 |
private function load_steps(): array { |
| 9 |
$steps = array(); |
| 10 |
$path = HOSTINGER_ABSPATH . 'includes/admin/onboarding/steps/'; |
| 11 |
$website_type = Hostinger_Settings::get_setting( 'survey.website.type' ); |
| 12 |
$helper = new Hostinger_Helper(); |
| 13 |
|
| 14 |
require_once $path . 'abstract-hostinger-onboarding-step.php'; |
| 15 |
|
| 16 |
if ( get_theme_support( 'custom-logo' ) ) { |
| 17 |
require_once $path . 'class-hostinger-onboarding-logo-step.php'; |
| 18 |
$steps[] = new Hostinger_Onboarding_Logo_Step(); |
| 19 |
} |
| 20 |
|
| 21 |
require_once $path . 'class-hostinger-onboarding-logo-step.php'; |
| 22 |
require_once $path . 'class-hostinger-onboarding-image-step.php'; |
| 23 |
require_once $path . 'class-hostinger-onboarding-heading.php'; |
| 24 |
require_once $path . 'class-hostinger-onboarding-add-page.php'; |
| 25 |
require_once $path . 'class-hostinger-onboarding-connect-domain.php'; |
| 26 |
|
| 27 |
if ( $website_type === Hostinger_Settings::WEBSITE_TYPE_BLOG ) { |
| 28 |
require_once $path . 'class-hostinger-onboarding-add-post.php'; |
| 29 |
$steps[] = new Hostinger_Onboarding_Add_Post(); |
| 30 |
} else { |
| 31 |
require_once $path . 'class-hostinger-onboarding-description.php'; |
| 32 |
$steps[] = new Hostinger_Onboarding_Description(); |
| 33 |
} |
| 34 |
|
| 35 |
$steps[] = new Hostinger_Onboarding_Image_Step(); |
| 36 |
$steps[] = new Hostinger_Onboarding_Heading(); |
| 37 |
$steps[] = new Hostinger_Onboarding_Add_Page(); |
| 38 |
|
| 39 |
if ( Hostinger_Helper::is_plugin_active( 'hostinger-affiliate-plugin' ) ) { |
| 40 |
require_once $path . 'class-hostinger-onboarding-connect-affiliate-settings.php'; |
| 41 |
$steps[] = new Hostinger_Onboarding_Connect_Affiliate_Settings(); |
| 42 |
} |
| 43 |
|
| 44 |
if ( class_exists( 'WooCommerce' ) ) { |
| 45 |
require_once $path . 'class-hostinger-onboarding-setup-store.php'; |
| 46 |
$steps[] = new Hostinger_Onboarding_Setup_Store(); |
| 47 |
} |
| 48 |
|
| 49 |
$steps[] = new Hostinger_Onboarding_Connect_Domain_Step(); |
| 50 |
|
| 51 |
return $steps; |
| 52 |
} |
| 53 |
|
| 54 |
public function get_steps(): array { |
| 55 |
return $this->load_steps(); |
| 56 |
} |
| 57 |
|
| 58 |
public function maintenance_mode_enabled(): bool { |
| 59 |
$published = get_option( 'hostinger_maintenance_mode' ); |
| 60 |
|
| 61 |
return (bool) $published; |
| 62 |
} |
| 63 |
|
| 64 |
public function get_content(): array { |
| 65 |
if ( ! $this->maintenance_mode_enabled() ) { |
| 66 |
return array( |
| 67 |
'title' => __( 'Website is published', 'hostinger' ), |
| 68 |
'description' => __( 'You can access this guide material any time when updating your website', 'hostinger' ), |
| 69 |
'btn' => array( |
| 70 |
'text' => __( 'Preview website', 'hostinger' ), |
| 71 |
'class' => 'hsr-btn hsr-primary-btn hsr-publish-btn', |
| 72 |
'url' => home_url(), |
| 73 |
), |
| 74 |
); |
| 75 |
} |
| 76 |
|
| 77 |
return array( |
| 78 |
'title' => __( 'Set up your website', 'hostinger' ), |
| 79 |
'description' => __( 'Follow our guided checklist to setup your website', 'hostinger' ), |
| 80 |
'btn_text' => __( 'Publish website', 'hostinger' ), |
| 81 |
'btn' => array( |
| 82 |
'text' => __( 'Publish website', 'hostinger' ), |
| 83 |
'class' => 'hsr-btn hsr-primary-btn hsr-publish-btn', |
| 84 |
'url' => '#', |
| 85 |
), |
| 86 |
); |
| 87 |
} |
| 88 |
} |
| 89 |
|