As the sun rises and the forest mist clears, and the clouds return and the caves darken, these changes of light and shadow are the morning and evening in the mountains. Wildflowers bloom with their subtle fragrance, fine trees flourish with their dense shade, the wind and frost are pure and clean, and the water recedes to reveal the rocks—these are the four seasons in the mountains. Going out in the morning and returning in the evening, the scenery of the four seasons is different, and the joy is endless.至于负者歌于途,行者休于树,前者呼,后者应,伛偻提携,往来而不绝者,滁人游也。临溪而渔,溪深而鱼肥,酿泉为酒,泉香而酒洌,山肴野蔌,杂然而前陈者,太守宴也。宴酣之乐,非丝非竹,射者中,弈者胜,觥筹交错,起坐而喧哗者,众宾欢也。苍颜白发,颓然乎其间者,太守醉也。
<?php
namespace Hostinger;
defined( 'ABSPATH' ) || exit;
class Settings {
public const MYSELF = 'myself';
public const FREELANCER = 'freelancer';
public const DEVELOPER = 'developer';
public const OTHER = 'other';
public const BUSINESS_BEGINNER_SEGMENT = 'business_beginner';
public const LEARNER_SEGMENT = 'learner';
public const BUSINESS_OWNER_SEGMENT = 'business_owner';
public const WEBSITE_TYPE_BUSINESS = 'business';
public const WEBSITE_TYPE_PORTFOLIO = 'portfolio';
public const WEBSITE_TYPE_BLOG = 'blog';
public const SITE_TITLE_OPTION = 'blogname';
public function __construct() {
if ( ! $this->get_setting( 'user_segment' ) ) {
$this->set_user_segment();
}
}
public function set_user_segment(): void {
$created_by = self::get_setting( 'survey.website.created_by' );
$created_for = self::get_setting( 'survey.website.for' );
$need_help = self::get_setting( 'survey.website.need_help' );
$work_at = self::get_setting( 'survey.work_at' );
if ( $this->is_business_beginner( $created_by, $created_for, $need_help ) ) {
self::update_setting( 'user_segment', self::BUSINESS_BEGINNER_SEGMENT );
}
if ( $this->is_learner( $work_at, $need_help ) ) {
self::update_setting( 'user_segment', self::LEARNER_SEGMENT );
}
if ( $this->is_bussiness_owner( $created_for, $created_by ) ) {
self::update_setting( 'user_segment', self::BUSINESS_OWNER_SEGMENT );
}
}
private function is_business_beginner( string $created_by, string $created_for, bool $need_help ): bool {
return $created_by === self::MYSELF && $created_for === self::MYSELF && $need_help;
}
private function is_learner( string $work_at, bool $need_help ): bool {
return $work_at === self::FREELANCER && $need_help;
}
private function is_bussiness_owner( string $created_for, string $created_by ): bool {
return $created_for === self::MYSELF && ( $created_by === self::DEVELOPER || $created_by === self::OTHER );
}
public static function get_setting( string $setting ): string {
if ( $setting ) {
return get_option( 'hostinger_' . $setting, '' );
}
return '';
}
public static function update_setting( string $setting, $value, $autoload = null ): void {
if ( $setting ) {
update_option( 'hostinger_' . $setting, $value, $autoload );
}
}
}
new Settings();