diff --git a/CHANGELOG.md b/CHANGELOG.md index 692f0ab7e24025fd0fbcfe1995fdbb9527252ebb..20f105b7d3ca72139b59a406c0c975cd6530a210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.3.0] - 2019-09-18 +### Added +- Plugin classes from wp-requirements + ## [1.2.0] - 2019-06-26 ### Added - InfoActivationBuilder with capability to set info if plugin subscription is active diff --git a/apigen.neon b/apigen.neon index 3cddd91f341529a26febc4c6fac4562edffcb9f0..340d000110827966e5e0804cc7a4db19907c5767 100644 --- a/apigen.neon +++ b/apigen.neon @@ -2,15 +2,15 @@ destination: docs templateConfig: /app/theme-woocommerce/config.neon extensions: [php] source: - - classes + - src exclude: - vendor - tests - languages charset: [UTF-8] -main: Wordpress plugin -title: Plugin template more info +main: Library wp-builder +title: Library that provides basic info how build a plugin and what a plugin is baseUrl: "/" templateTheme: default @@ -21,7 +21,7 @@ deprecated: false todo: false download: false -accessLevels: +accessLevels: - public - private - - protected \ No newline at end of file + - protected diff --git a/composer.json b/composer.json index 0cab621023fe5ddf441065dca9f3e225cb4b15eb..50e7f9ea30a251a128ee434f01cc34cff1dca606 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ "wimg/php-compatibility": "^8" }, "autoload": { - "psr-4": {"WPDesk\\PluginBuilder\\": "src/"} + "psr-4": {"WPDesk\\PluginBuilder\\": "src/"}, + "classmap": ["src/Plugin/WithoutNamespace"] }, "autoload-dev": { }, diff --git a/src/Plugin/WithoutNamespace/Buildable.php b/src/Plugin/WithoutNamespace/Buildable.php new file mode 100644 index 0000000000000000000000000000000000000000..78c73224961af9592e346b83fd58f360d06971fa --- /dev/null +++ b/src/Plugin/WithoutNamespace/Buildable.php @@ -0,0 +1,11 @@ +<?php + +/** + * Have info about what class should be built by WPDesk_Builder + * + * have to be compatible with PHP 5.2.x + */ +interface WPDesk_Buildable { + /** @return string */ + public function get_class_name(); +} \ No newline at end of file diff --git a/src/Plugin/WithoutNamespace/Has_Plugin_Info.php b/src/Plugin/WithoutNamespace/Has_Plugin_Info.php new file mode 100644 index 0000000000000000000000000000000000000000..5ecf98d525474f04c37ff04a64ec6926e653e5c4 --- /dev/null +++ b/src/Plugin/WithoutNamespace/Has_Plugin_Info.php @@ -0,0 +1,29 @@ +<?php + +if ( ! interface_exists( 'WPDesk_Translatable' ) ) { + require_once __DIR__ . '/../Translatable.php'; +} + + +/** + * Have MUST HAVE info for plugin instantion + * + * have to be compatible with PHP 5.2.x + */ +interface WPDesk_Has_Plugin_Info extends WPDesk_Translatable { + /** + * @return string + */ + public function get_plugin_file_name(); + + /** + * @return string + */ + public function get_plugin_dir(); + + /** + * @return string + */ + public function get_version(); + +} \ No newline at end of file diff --git a/src/Plugin/WithoutNamespace/Plugin_Info.php b/src/Plugin/WithoutNamespace/Plugin_Info.php new file mode 100644 index 0000000000000000000000000000000000000000..693b408066013e55319f7b6ca32159849081ffea --- /dev/null +++ b/src/Plugin/WithoutNamespace/Plugin_Info.php @@ -0,0 +1,171 @@ +<?php + +if ( ! interface_exists( 'WPDesk_Translatable' ) ) { + require_once __DIR__ . '/../Translatable.php'; +} +if ( ! class_exists( 'WPDesk_Buildable' ) ) { + require_once __DIR__ . '/../Buildable.php'; +} +if ( ! class_exists( 'WPDesk_Has_Plugin_Info' ) ) { + require_once 'Has_Plugin_Info.php'; +} + +/** + * Structure with core info about plugin + * + * have to be compatible with PHP 5.2.x + */ +class WPDesk_Plugin_Info implements WPDesk_Translatable, WPDesk_Buildable, WPDesk_Has_Plugin_Info { + /** @var string */ + private $plugin_file_name; + + /** @var string */ + private $plugin_dir; + + /** @var string */ + private $plugin_url; + + /** @var string */ + private $class_name; + + /** @var string */ + private $version; + + /** @var string */ + private $product_id; + + /** @var string */ + private $plugin_name; + + /** @var \DateTimeInterface */ + private $release_date; + + /** string */ + private $text_domain; + + /** + * @return string + */ + public function get_plugin_file_name() { + return $this->plugin_file_name; + } + + /** + * @param string $plugin_name + */ + public function set_plugin_file_name( $plugin_name ) { + $this->plugin_file_name = $plugin_name; + } + + /** + * @return string + */ + public function get_plugin_dir() { + return $this->plugin_dir; + } + + /** + * @param string $plugin_dir + */ + public function set_plugin_dir( $plugin_dir ) { + $this->plugin_dir = $plugin_dir; + } + + /** + * @return string + */ + public function get_plugin_url() { + return $this->plugin_url; + } + + /** + * @param string $plugin_url + */ + public function set_plugin_url( $plugin_url ) { + $this->plugin_url = $plugin_url; + } + + /** + * @return string + */ + public function get_version() { + return $this->version; + } + + /** + * @param string $version + */ + public function set_version( $version ) { + $this->version = $version; + } + + /** + * @return string + */ + public function get_product_id() { + return $this->product_id; + } + + /** + * @param string $product_id + */ + public function set_product_id( $product_id ) { + $this->product_id = $product_id; + } + + /** + * @return string + */ + public function get_plugin_name() { + return $this->plugin_name; + } + + /** + * @param string $plugin_name + */ + public function set_plugin_name( $plugin_name ) { + $this->plugin_name = $plugin_name; + } + + /** + * @return DateTimeInterface + */ + public function get_release_date() { + return $this->release_date; + } + + /** + * @param \DateTimeInterface $release_date + */ + public function set_release_date( $release_date ) { + $this->release_date = $release_date; + } + + /** + * @return string + */ + public function get_class_name() { + return $this->class_name; + } + + /** + * @param string $class_name + */ + public function set_class_name( $class_name ) { + $this->class_name = $class_name; + } + + /** + * @return string + */ + public function get_text_domain() { + return $this->text_domain; + } + + /** + * @param $value + */ + public function set_text_domain( $value ) { + $this->text_domain = $value; + } +} \ No newline at end of file