From 5217785221ebab9a48169884afa248b00435fecf Mon Sep 17 00:00:00 2001 From: Junaid Bhura Date: Wed, 8 Sep 2021 17:27:22 +1000 Subject: [PATCH] WP All Export add-ons support --- Installer.php | 2 +- README.md | 28 +++++++++++++++++++++++++++- plugins/WpAiPro.php | 44 ++++++++++++++++++++++++++++---------------- 3 files changed, 56 insertions(+), 18 deletions(-) diff --git a/Installer.php b/Installer.php index 8babfe9..364de18 100644 --- a/Installer.php +++ b/Installer.php @@ -256,7 +256,7 @@ protected function getDownloadUrl( PackageInterface $package ) { default: if ( 0 === strpos( $package_name, 'junaidbhura/gravityforms' ) ) { $plugin = new Plugins\GravityForms( $package->getPrettyVersion(), str_replace( 'junaidbhura/', '', $package_name ) ); - } elseif ( 0 === strpos( $package_name, 'junaidbhura/wpai-' ) ) { + } elseif ( 0 === strpos( $package_name, 'junaidbhura/wpai-' ) || 0 === strpos( $package_name, 'junaidbhura/wpae-' ) ) { $plugin = new Plugins\WpAiPro( $package->getPrettyVersion(), str_replace( 'junaidbhura/', '', $package_name ) ); } } diff --git a/README.md b/README.md index 67f45cd..f50265e 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,21 @@ Add the following to your composer.json file: "junaidbhura/composer-wp-pro-plugins": "*" } } + }, + { + "type": "package", + "package": { + "name": "junaidbhura/wpae-acf-add-on", + "version": "", + "type": "wordpress-plugin", + "dist": { + "type": "zip", + "url": "https://www.wpallimport.com" + }, + "require": { + "junaidbhura/composer-wp-pro-plugins": "*" + } + } } ], "require": { @@ -160,7 +175,8 @@ Add the following to your composer.json file: "junaidbhura/polylang-pro": "*", "junaidbhura/wp-all-import-pro": "*", "junaidbhura/wp-all-export-pro": "*", - "junaidbhura/wpai-acf-add-on": "*" + "junaidbhura/wpai-acf-add-on": "*", + "junaidbhura/wpae-acf-add-on": "*" }, ``` @@ -185,3 +201,13 @@ You can use any WP All Import Pro add-on by simply adding it's slug like so: For example: `junaidbhura/wpai-acf-add-on` + +### WP All Export Pro Add-Ons + +You can use any WP All Export Pro add-on by simply adding it's slug like so: + +`junaidbhura/` + +For example: + +`junaidbhura/wpae-acf-add-on` diff --git a/plugins/WpAiPro.php b/plugins/WpAiPro.php index 048a919..7c71e16 100644 --- a/plugins/WpAiPro.php +++ b/plugins/WpAiPro.php @@ -45,33 +45,45 @@ public function __construct( $version = '', $slug = 'wp-all-import-pro' ) { * @return string */ public function getDownloadUrl() { - if ( 'wp-all-export-pro' === $this->slug ) { - $license = getenv( 'WP_ALL_EXPORT_PRO_KEY' ); - $url = getenv( 'WP_ALL_EXPORT_PRO_URL' ); - $name = 'WP All Export'; - } else { - $license = getenv( 'WP_ALL_IMPORT_PRO_KEY' ); - $url = getenv( 'WP_ALL_IMPORT_PRO_URL' ); + $url = ''; + $name = ''; + $license = ''; + + if ( 'wp-all-import-pro' === $this->slug || 0 === strpos( $this->slug, 'wpai-' ) ) { + // WP All Import Pro. + $url = getenv( 'WP_ALL_IMPORT_PRO_URL' ); switch ( $this->slug ) { case 'wpai-acf-add-on': - $name = 'ACF Add-On'; - $license = ''; + $name = 'ACF Add-On'; break; case 'wpai-linkcloak-add-on': - $name = 'Link Cloaking Add-On'; - $license = ''; + $name = 'Link Cloaking Add-On'; break; case 'wpai-user-add-on': - $name = 'User Import Add-On'; - $license = ''; + $name = 'User Import Add-On'; break; case 'wpai-woocommerce-add-on': - $name = 'WooCommerce Add-On'; - $license = ''; + $name = 'WooCommerce Add-On'; + break; + default: + $name = 'WP All Import'; + $license = getenv( 'WP_ALL_IMPORT_PRO_KEY' ); + } + } elseif ( 'wp-all-export-pro' === $this->slug || 0 === strpos( $this->slug, 'wpae-' ) ) { + // WP All Export Pro. + $url = getenv( 'WP_ALL_EXPORT_PRO_URL' ); + + switch ( $this->slug ) { + case 'wpae-acf-add-on': + $name = 'ACF Export Add-On Pro'; + break; + case 'wpae-woocommerce-add-on': + $name = 'WooCommerce Export Add-On Pro'; break; default: - $name = 'WP All Import'; + $name = 'WP All Export'; + $license = getenv( 'WP_ALL_EXPORT_PRO_KEY' ); } }