From 73eb2bed7d77bd9b6c9fd003f667d5d84a9fb300 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Tue, 15 Oct 2024 12:40:07 +0200 Subject: [PATCH] Delete old scoped lib file --- .../Modularity/Properties/ThemeProperties.php | 131 ------------------ 1 file changed, 131 deletions(-) delete mode 100644 lib/packages/Inpsyde/Modularity/Properties/ThemeProperties.php diff --git a/lib/packages/Inpsyde/Modularity/Properties/ThemeProperties.php b/lib/packages/Inpsyde/Modularity/Properties/ThemeProperties.php deleted file mode 100644 index 7f0f9af3..00000000 --- a/lib/packages/Inpsyde/Modularity/Properties/ThemeProperties.php +++ /dev/null @@ -1,131 +0,0 @@ - 'Author', - self::PROP_AUTHOR_URI => 'AuthorURI', - self::PROP_DESCRIPTION => 'Description', - self::PROP_DOMAIN_PATH => 'DomainPath', - self::PROP_NAME => 'Name', - self::PROP_TEXTDOMAIN => 'TextDomain', - self::PROP_URI => 'ThemeURI', - self::PROP_VERSION => 'Version', - self::PROP_REQUIRES_WP => 'RequiresWP', - self::PROP_REQUIRES_PHP => 'RequiresPHP', - - // additional headers - self::PROP_STATUS => 'Status', - self::PROP_TAGS => 'Tags', - self::PROP_TEMPLATE => 'Template', - ]; - - /** - * @param string $themeDirectory - * - * @return ThemeProperties - */ - public static function new(string $themeDirectory): ThemeProperties - { - return new self($themeDirectory); - } - - /** - * ThemeProperties constructor. - * - * @param string $themeDirectory - */ - protected function __construct(string $themeDirectory) - { - if (!function_exists('wp_get_theme')) { - require_once ABSPATH . 'wp-includes/theme.php'; - } - - $theme = wp_get_theme($themeDirectory); - $properties = Properties::DEFAULT_PROPERTIES; - - foreach (self::HEADERS as $key => $themeKey) { - /** @psalm-suppress DocblockTypeContradiction */ - $properties[$key] = $theme->get($themeKey) ?? ''; - } - - $baseName = $theme->get_stylesheet(); - $basePath = $theme->get_stylesheet_directory(); - $baseUrl = (string) trailingslashit($theme->get_stylesheet_directory_uri()); - - parent::__construct( - $baseName, - $basePath, - $baseUrl, - $properties - ); - } - - /** - * If the theme is published. - * - * @return string - */ - public function status(): string - { - return (string) $this->get(self::PROP_STATUS); - } - - public function template(): string - { - return (string) $this->get(self::PROP_TEMPLATE); - } - - /** - * @return bool - */ - public function isChildTheme(): bool - { - return (bool) $this->template(); - } - - /** - * @return bool - */ - public function isCurrentTheme(): bool - { - return get_stylesheet() === $this->baseName(); - } - - /** - * @return ThemeProperties|null - */ - public function parentThemeProperties(): ?ThemeProperties - { - $template = $this->template(); - if (!$template) { - return null; - } - - $parent = wp_get_theme($template, get_theme_root($template)); - - return static::new($parent->get_template_directory()); - } -}