%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/sakura-blog/themes/theme-basic/green/v1.1.3/lib/models/
Upload File :
Create Path :
Current File : //usr/local/sakura-blog/themes/theme-basic/green/v1.1.3/lib/models/models.php

<?php

namespace SakuraBlog\Models;

use DateTime;

class BlogOGP
{
	public bool $enabled = false;
	public string $og_image_filename = "";
	public string $twitter_card = "summary";

	public function __construct(array $ogp)
	{
		foreach ([
			"Enabled" => "enabled",
			"OGImageFilename" => "og_image_filename",
			"TwitterCard" => "twitter_card",
		] as $key => $varname) {
			if (isset($ogp[$key])) {
				$this->{$varname} = $ogp[$key];
			}
		}
	}
}
class BlogSNS
{
	public string $x_username = "";
	public string $facebook_username = "";
	public string $instagram_username = "";

	public function __construct(array $sns)
	{
		foreach ([
			"XUsername" => "x_username",
			"FacebookUsername" => "facebook_username",
			"InstagramUsername" => "instagram_username",
		] as $key => $varname) {
			if (isset($sns[$key])) {
				$this->{$varname} = $sns[$key];
			}
		}
	}
}
class Blog
{
	public string $title = "";
	public string $title_display_type = "";
	public string $subtitle = "";
	public string $logo_filename = "";
	public string $icon_filename = "";
	public string $description = "";
	public string $meta_description = "";
	public int $page_size = 10;
	public int $thumbnail_width = 1000;
	public int $thumbnail_height = 1000;
	public string $thumbnail_size = "";
	public ?BlogOGP $ogp;
	public ?BlogSNS $sns;

	public function __construct(array $settings)
	{
		foreach ([
			"Title" => "title",
			"TitleDisplayType" => "title_display_type",
			"Subtitle" => "subtitle",
			"LogoFilename" => "logo_filename",
			"IconFilename" => "icon_filename",
			"Description" => "description",
			"MetaDescription" => "meta_description",
			"PageSize" => "page_size",
			"ThumbnailWidth" => "thumbnail_width",
			"ThumbnailHeight" => "thumbnail_height",
		] as $key => $varname) {
			if (isset($settings[$key])) {
				$this->{$varname} = $settings[$key];
			}
		}
		if ($this->page_size <= 0) {
			$this->page_size = 10;
		}
		if ($this->thumbnail_width <= 0) {
			$this->thumbnail_width = 1000;
		}
		if ($this->thumbnail_height <= 0) {
			$this->thumbnail_height = 1000;
		}
		$this->thumbnail_size = "{$this->thumbnail_width}x{$this->thumbnail_height}";
		if (isset($settings["OGP"])) {
			$this->ogp = new BlogOGP($settings["OGP"]);
		} else {
			$this->ogp = new BlogOGP([]);
		}
		if (isset($settings["SNS"])) {
			$this->sns = new BlogSNS($settings["SNS"]);
		} else {
			$this->sns = new BlogSNS([]);
		}
	}
}

class Article extends Model
{
	public string $title;
	public string $content;
	public string $thumbnail_filename;
	public DateTime $posted_at;
	public DateTime $edited_at;

	public int $category_id;
	public int $author_id;

	public ?Category $category;
	public ?Member $author;

	public ?TagCollection $tags;
}

class Category extends Model
{
	public string $name;
	public string $slug;
	public bool $is_display_sidebar;
}

class Tag extends Model
{
	public string $name;
	public string $slug;
	public bool $is_display_sidebar;
}

class Member extends Model
{
	public string $name;
	public string $bio;
	public string $profile_image_filename;
	public string $x_username;
	public string $facebook_username;
	public string $instagram_username;
}

Zerion Mini Shell 1.0