/** * Construct a new WPTheme object * * @param string $path The path to the root folder of the theme */ public function __construct($path) { $this->path = WPRequire::THEMES_DIR() . "/" . $path; $themeObject = wp_get_theme($this->path . "/style.css", $this->path); // Extract the theme data into an assosiativ array $this->themeData = array("Name" => $themeObject->get("Name"), "ThemeURI" => $themeObject->get("ThemeURI"), "Description" => $themeObject->get("Description"), "Author" => $themeObject->get("Author"), "AuthorURI" => $themeObject->get("AuthorURI"), "Version" => $themeObject->get("Version"), "Template" => $themeObject->get("Template"), "Status" => $themeObject->get("Status"), "Tags" => $themeObject->get("Tags"), "TextDomain" => $themeObject->get("TextDomain"), "DomainPath" => $themeObject->get("DomainPath")); if (isset($this->themeData['version'])) { $this->version = new Version($this->themeData['version']); } else { // Null if none is spesified $this->version = null; } parent::__construct(); }
/** * The unique name of the plugin */ public function __construct($pluginFile) { $this->pluginFile = $pluginFile; $this->pluginFolder = dirname($this->pluginFile); //If pluginFolder is empty string, the plugin is not a folder //But just a single file if ($this->pluginFolder === "") { $this->pluginFolder = null; } if (function_exists('get_plugin_data')) { $pluginData = get_plugin_data(WPRequire::PLUGINS_DIR() . "/" . $this->pluginFile); $this->version = new Version($pluginData["Version"]); } parent::__construct(); }