├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── composer.json └── src ├── Http.php ├── Installer.php ├── Plugins ├── AbstractEddPlugin.php ├── AbstractPlugin.php ├── AcfExtendedPro.php ├── AcfPro.php ├── GravityForms.php ├── NinjaForms.php ├── PolylangPro.php ├── PublishPressPro.php ├── WpAiPro.php └── Wpml.php └── RemoteFilesystem.php /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Checklist: 2 | - [ ] I've read the [Contributing page](https://github.com/junaidbhura/composer-wp-pro-plugins/blob/master/CONTRIBUTING.md). 3 | - [ ] I've created an issue and referenced it here. 4 | - [ ] My code is tested. 5 | - [ ] My code follows the WordPress code style. 6 | - [ ] My code has proper inline documentation. 7 | 8 | ## Description 9 | 10 | 11 | ## How has this been tested? 12 | 13 | 14 | 15 | 16 | ## Screenshots 17 | 18 | ## Types of changes 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | composer.lock 3 | vendor 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you for thinking about contributing to this project. 4 | 5 | I'm open to ideas, and request you to open an Issue on this repository, so we can have a discussion about your bug / idea. Once we agree on a direction to take, I'd welcome a Pull Request from you. 6 | 7 | ## Features, not code cleanup 8 | 9 | Generally speaking, I'm looking to improve the functionality of this plugin, rather than code cleanups or refactoring. 10 | 11 | Although I appreciate the importance of this, I'm also very wary of over-engineering, and believe in simple solutions. 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Junaid Bhura 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Composer Installer for Pro WordPress Plugins. 2 | 3 | A Composer plugin that makes it easy to install commercial WordPress plugins. 4 | 5 | Sensitive credentials (license keys, tokens) are read from environment variables or a `.env` file. 6 | 7 | ## Supported Plugins 8 | 9 | 1. Advanced Custom Fields Pro 10 | 1. Ninja Forms Add-Ons 11 | 1. Gravity Forms / Add-Ons 12 | 1. Polylang Pro 13 | 1. PublishPress Pro 14 | 1. Advanced Custom Fields Extended Pro 15 | 1. WP All Import / Export Pro / Add-Ons 16 | 1. WPML 17 | 18 | ## Overview 19 | 20 | > ⚠️ Note: Most EDD plugins, and Gravity Forms, only allow downloading the latest versions of their plugins, even if you request for a specific version. 21 | 22 | - Packages must use the names defined below otherwise they are ignored by this plugin. 23 | - When installing or updating a package, the package version is appended to the dist URL. 24 | This versioned dist URL is used as the cache key to store ZIP archives of the package. 25 | In Composer 1, the versioned dist URL is added to `composer.lock`. 26 | - Before downloading the package, the package's real download URL is retrieved and formatted with their corresponding environment variables, as defined below. 27 | Environment variables will never be stored inside `composer.lock`. 28 | - If an environment variable can't be resolved, the download will fail and Composer will abort. 29 | 30 | ## Usage 31 | 32 | This Composer plugin requires [Composer](https://getcomposer.org/): 33 | 34 | - 1.0.0 and newer, or 35 | - 2.0.2 and newer 36 | - 2.3+ IMPORTANT: Make sure to add trailing slashes to packages' `dist` URL as below. More info: https://github.com/junaidbhura/composer-wp-pro-plugins/issues/34 37 | 38 | Create a `.env` file in the root of your WordPress site, where the `composer.json` file lives, which has all the license keys and settings: 39 | 40 | ``` 41 | ACF_PRO_KEY="" 42 | ACFE_PRO_KEY="" 43 | ACFE_PRO_URL="" 44 | GRAVITY_FORMS_KEY="" 45 | NINJA_FORMS_KEY="" 46 | NINJA_FORMS_URL="" 47 | NINJA_FORMS__KEY="" 48 | NINJA_FORMS__URL="" 49 | POLYLANG_PRO_KEY="" 50 | POLYLANG_PRO_URL="" 51 | PUBLISHPRESS_PRO_KEY="" 52 | PUBLISHPRESS_PRO_URL="" 53 | PUBLISHPRESS__PRO_KEY="" 54 | PUBLISHPRESS__PRO_URL="" 55 | WP_ALL_IMPORT_PRO_KEY="" 56 | WP_ALL_IMPORT_PRO_URL="" 57 | WP_ALL_EXPORT_PRO_KEY="" 58 | WP_ALL_EXPORT_PRO_URL="" 59 | WPML_USER_ID="" 60 | WPML_KEY="" 61 | ``` 62 | 63 | Add the following to your composer.json file: 64 | 65 | ```json 66 | "repositories": [ 67 | { 68 | "type": "package", 69 | "package": { 70 | "name": "junaidbhura/acf-extended-pro", 71 | "version": "", 72 | "type": "wordpress-plugin", 73 | "dist": { 74 | "type": "zip", 75 | "url": "https://www.acf-extended.com/" 76 | }, 77 | "require": { 78 | "junaidbhura/composer-wp-pro-plugins": "*" 79 | } 80 | } 81 | }, 82 | { 83 | "type": "package", 84 | "package": { 85 | "name": "junaidbhura/advanced-custom-fields-pro", 86 | "version": "", 87 | "type": "wordpress-plugin", 88 | "dist": { 89 | "type": "zip", 90 | "url": "https://www.advancedcustomfields.com/" 91 | }, 92 | "require": { 93 | "junaidbhura/composer-wp-pro-plugins": "*" 94 | } 95 | } 96 | }, 97 | { 98 | "type": "package", 99 | "package": { 100 | "name": "junaidbhura/gravityforms", 101 | "version": "", 102 | "type": "wordpress-plugin", 103 | "dist": { 104 | "type": "zip", 105 | "url": "https://www.gravityforms.com/" 106 | }, 107 | "require": { 108 | "junaidbhura/composer-wp-pro-plugins": "*" 109 | } 110 | } 111 | }, 112 | { 113 | "type": "package", 114 | "package": { 115 | "name": "junaidbhura/gravityformspolls", 116 | "version": "", 117 | "type": "wordpress-plugin", 118 | "dist": { 119 | "type": "zip", 120 | "url": "https://www.gravityforms.com/" 121 | }, 122 | "require": { 123 | "junaidbhura/composer-wp-pro-plugins": "*" 124 | } 125 | } 126 | }, 127 | { 128 | "type": "package", 129 | "package": { 130 | "name": "junaidbhura/ninja-forms-uploads", 131 | "version": "", 132 | "type": "wordpress-plugin", 133 | "dist": { 134 | "type": "zip", 135 | "url": "https://ninjaforms.com/" 136 | }, 137 | "require": { 138 | "junaidbhura/composer-wp-pro-plugins": "*" 139 | } 140 | } 141 | }, 142 | { 143 | "type": "package", 144 | "package": { 145 | "name": "junaidbhura/polylang-pro", 146 | "version": "", 147 | "type": "wordpress-plugin", 148 | "dist": { 149 | "type": "zip", 150 | "url": "https://www.polylang.pro/" 151 | }, 152 | "require": { 153 | "junaidbhura/composer-wp-pro-plugins": "*" 154 | } 155 | } 156 | }, 157 | { 158 | "type": "package", 159 | "package": { 160 | "name": "junaidbhura/publishpress-planner-pro", 161 | "version": "", 162 | "type": "wordpress-plugin", 163 | "dist": { 164 | "type": "zip", 165 | "url": "https://publishpress.com/" 166 | }, 167 | "require": { 168 | "junaidbhura/composer-wp-pro-plugins": "*" 169 | } 170 | } 171 | }, 172 | { 173 | "type": "package", 174 | "package": { 175 | "name": "junaidbhura/wp-all-import-pro", 176 | "version": "", 177 | "type": "wordpress-plugin", 178 | "dist": { 179 | "type": "zip", 180 | "url": "https://www.wpallimport.com/" 181 | }, 182 | "require": { 183 | "junaidbhura/composer-wp-pro-plugins": "*" 184 | } 185 | } 186 | }, 187 | { 188 | "type": "package", 189 | "package": { 190 | "name": "junaidbhura/wp-all-export-pro", 191 | "version": "", 192 | "type": "wordpress-plugin", 193 | "dist": { 194 | "type": "zip", 195 | "url": "https://www.wpallimport.com/" 196 | }, 197 | "require": { 198 | "junaidbhura/composer-wp-pro-plugins": "*" 199 | } 200 | } 201 | }, 202 | { 203 | "type": "package", 204 | "package": { 205 | "name": "junaidbhura/wpai-acf-add-on", 206 | "version": "", 207 | "type": "wordpress-plugin", 208 | "dist": { 209 | "type": "zip", 210 | "url": "https://www.wpallimport.com/" 211 | }, 212 | "require": { 213 | "junaidbhura/composer-wp-pro-plugins": "*" 214 | } 215 | } 216 | }, 217 | { 218 | "type": "package", 219 | "package": { 220 | "name": "junaidbhura/wpae-acf-add-on", 221 | "version": "", 222 | "type": "wordpress-plugin", 223 | "dist": { 224 | "type": "zip", 225 | "url": "https://www.wpallimport.com/" 226 | }, 227 | "require": { 228 | "junaidbhura/composer-wp-pro-plugins": "*" 229 | } 230 | } 231 | }, 232 | { 233 | "type": "package", 234 | "package": { 235 | "name": "junaidbhura/wpae-user-add-on-pro", 236 | "version": "", 237 | "type": "wordpress-plugin", 238 | "dist": { 239 | "type": "zip", 240 | "url": "https://www.wpallimport.com/" 241 | }, 242 | "require": { 243 | "junaidbhura/composer-wp-pro-plugins": "*" 244 | } 245 | } 246 | }, 247 | { 248 | "type": "package", 249 | "package": { 250 | "name": "junaidbhura/wpml-sitepress-multilingual-cms", 251 | "version": "", 252 | "type": "wordpress-plugin", 253 | "dist": { 254 | "type": "zip", 255 | "url": "https://wpml.org/" 256 | }, 257 | "require": { 258 | "junaidbhura/composer-wp-pro-plugins": "*" 259 | } 260 | } 261 | }, 262 | { 263 | "type": "package", 264 | "package": { 265 | "name": "junaidbhura/wpml-string-translation", 266 | "version": "", 267 | "type": "wordpress-plugin", 268 | "dist": { 269 | "type": "zip", 270 | "url": "https://wpml.org/" 271 | }, 272 | "require": { 273 | "junaidbhura/composer-wp-pro-plugins": "*" 274 | } 275 | } 276 | } 277 | ], 278 | "require": { 279 | "junaidbhura/acf-extended-pro": "*", 280 | "junaidbhura/advanced-custom-fields-pro": "*", 281 | "junaidbhura/gravityforms": "*", 282 | "junaidbhura/gravityformspolls": "*", 283 | "junaidbhura/ninja-forms-uploads": "*", 284 | "junaidbhura/polylang-pro": "*", 285 | "junaidbhura/publishpress-planner-pro": "*", 286 | "junaidbhura/wp-all-import-pro": "*", 287 | "junaidbhura/wp-all-export-pro": "*", 288 | "junaidbhura/wpai-acf-add-on": "*", 289 | "junaidbhura/wpae-acf-add-on": "*", 290 | "junaidbhura/wpae-user-add-on-pro": "*", 291 | "junaidbhura/wpml-sitepress-multilingual-cms": "*", 292 | "junaidbhura/wpml-string-translation": "*" 293 | }, 294 | ``` 295 | 296 | ### Gravity Forms Add-Ons 297 | 298 | You can use any Gravity Forms add-on by simply adding it's slug like so: 299 | 300 | `junaidbhura/` 301 | 302 | For example: 303 | 304 | `junaidbhura/gravityformspolls` 305 | 306 | Here's a list of all Gravity Forms add-on slugs: [https://docs.gravityforms.com/gravity-forms-add-on-slugs/](https://docs.gravityforms.com/gravity-forms-add-on-slugs/) 307 | 308 | ### Ninja Forms Add-Ons 309 | 310 | You can use any Ninja Forms add-on by simply adding it's slug like so: 311 | 312 | `junaidbhura/ninja-forms-` 313 | 314 | The following add-ons are supported: 315 | 316 | | Package name | Environment variables | 317 | |:--------------------------------------------- |:---------------------------------------------- | 318 | | `junaidbhura/ninja-forms-activecampaign` | `NINJA_FORMS_ACTIVECAMPAIGN_` | 319 | | `junaidbhura/ninja-forms-advanced-datepicker` | `NINJA_FORMS_ADVANCED_DATEPICKER_` | 320 | | `junaidbhura/ninja-forms-authorize-net` | `NINJA_FORMS_AUTHORIZE_NET_` | 321 | | `junaidbhura/ninja-forms-aweber` | `NINJA_FORMS_AWEBER_` | 322 | | `junaidbhura/ninja-forms-campaign-monitor` | `NINJA_FORMS_CAMPAIGN_MONITOR_` | 323 | | `junaidbhura/ninja-forms-capsule-crm` | `NINJA_FORMS_CAPSULE_CRM_` | 324 | | `junaidbhura/ninja-forms-civicrm` | `NINJA_FORMS_CIVICRM_` | 325 | | `junaidbhura/ninja-forms-cleverreach` | `NINJA_FORMS_CLEVERREACH_` | 326 | | `junaidbhura/ninja-forms-clicksend` | `NINJA_FORMS_CLICKSEND_` | 327 | | `junaidbhura/ninja-forms-conditional-logic` | `NINJA_FORMS_CONDITIONAL_LOGIC_` | 328 | | `junaidbhura/ninja-forms-constant-contact` | `NINJA_FORMS_CONSTANT_CONTACT_` | 329 | | `junaidbhura/ninja-forms-convertkit` | `NINJA_FORMS_CONVERTKIT_` | 330 | | `junaidbhura/ninja-forms-elavon` | `NINJA_FORMS_ELAVON_` | 331 | | `junaidbhura/ninja-forms-emailoctopus` | `NINJA_FORMS_EMAILOCTOPUS_` | 332 | | `junaidbhura/ninja-forms-emma` | `NINJA_FORMS_EMMA_` | 333 | | `junaidbhura/ninja-forms-excel-export` | `NINJA_FORMS_EXCEL_EXPORT_` | 334 | | `junaidbhura/ninja-forms-help-scout` | `NINJA_FORMS_HELP_SCOUT_` | 335 | | `junaidbhura/ninja-forms-hubspot` | `NINJA_FORMS_HUBSPOT_` | 336 | | `junaidbhura/ninja-forms-insightly` | `NINJA_FORMS_INSIGHTLY_` | 337 | | `junaidbhura/ninja-forms-layout-styles` | `NINJA_FORMS_LAYOUT_STYLES_` | 338 | | `junaidbhura/ninja-forms-mailchimp` | `NINJA_FORMS_MAILCHIMP_` | 339 | | `junaidbhura/ninja-forms-mailpoet` | `NINJA_FORMS_MAILPOET_` | 340 | | `junaidbhura/ninja-forms-multi-step` | `NINJA_FORMS_MULTI_STEP_` | 341 | | `junaidbhura/ninja-forms-onepagecrm` | `NINJA_FORMS_ONEPAGECRM_` | 342 | | `junaidbhura/ninja-forms-paypal-express` | `NINJA_FORMS_PAYPAL_EXPRESS_` | 343 | | `junaidbhura/ninja-forms-pdf-submissions` | `NINJA_FORMS_PDF_SUBMISSIONS_` | 344 | | `junaidbhura/ninja-forms-pipeline-crm` | `NINJA_FORMS_PIPELINE_CRM_` | 345 | | `junaidbhura/ninja-forms-post-creation` | `NINJA_FORMS_POST_CREATION_` | 346 | | `junaidbhura/ninja-forms-recurly` | `NINJA_FORMS_RECURLY_` | 347 | | `junaidbhura/ninja-forms-salesforce` | `NINJA_FORMS_SALESFORCE_` | 348 | | `junaidbhura/ninja-forms-save-progress` | `NINJA_FORMS_SAVE_PROGRESS_` | 349 | | `junaidbhura/ninja-forms-scheduled-exports` | `NINJA_FORMS_SCHEDULED_EXPORTS_` | 350 | | `junaidbhura/ninja-forms-slack` | `NINJA_FORMS_SLACK_` | 351 | | `junaidbhura/ninja-forms-stripe` | `NINJA_FORMS_STRIPE_` | 352 | | `junaidbhura/ninja-forms-trello` | `NINJA_FORMS_TRELLO_` | 353 | | `junaidbhura/ninja-forms-twilio` | `NINJA_FORMS_TWILIO_` | 354 | | `junaidbhura/ninja-forms-uploads` | `NINJA_FORMS_UPLOADS_` | 355 | | `junaidbhura/ninja-forms-user-analytics` | `NINJA_FORMS_USER_ANALYTICS_` | 356 | | `junaidbhura/ninja-forms-user-management` | `NINJA_FORMS_USER_MANAGEMENT_` | 357 | | `junaidbhura/ninja-forms-webhooks` | `NINJA_FORMS_WEBHOOKS_` | 358 | | `junaidbhura/ninja-forms-zapier` | `NINJA_FORMS_ZAPIER_` | 359 | | `junaidbhura/ninja-forms-zoho` | `NINJA_FORMS_ZOHO_` | 360 | 361 | ### PublishPress Pro Plugins 362 | 363 | You can use any PublishPress Pro plugins by simply adding it's slug like so: 364 | 365 | `junaidbhura/` 366 | 367 | The following plugins are supported: 368 | 369 | | Package name | Environment variables | 370 | |:------------------------------------------- |:-------------------------------------------- | 371 | | `junaidbhura/publishpress-authors-pro` | `PUBLISHPRESS_AUTHORS_PRO_` | 372 | | `junaidbhura/publishpress-blocks-pro` | `PUBLISHPRESS_BLOCKS_PRO_` | 373 | | `junaidbhura/publishpress-capabilities-pro` | `PUBLISHPRESS_CAPABILITIES_PRO_` | 374 | | `junaidbhura/publishpress-checklists-pro` | `PUBLISHPRESS_CHECKLISTS_PRO_` | 375 | | `junaidbhura/publishpress-future-pro` | `PUBLISHPRESS_FUTURE_PRO_` | 376 | | `junaidbhura/publishpress-permissions-pro` | `PUBLISHPRESS_PERMISSIONS_PRO_` | 377 | | `junaidbhura/publishpress-planner-pro` | `PUBLISHPRESS_PLANNER_PRO_` | 378 | | `junaidbhura/publishpress-revisions-pro` | `PUBLISHPRESS_REVISIONS_PRO_` | 379 | | `junaidbhura/publishpress-series-pro` | `PUBLISHPRESS_SERIES_PRO_` | 380 | 381 | ### WP All Import Pro Add-Ons 382 | 383 | You can use any WP All Import Pro add-on by simply adding it's slug like so: 384 | 385 | `junaidbhura/` 386 | 387 | For example: 388 | 389 | `junaidbhura/wpai-acf-add-on` 390 | 391 | ### WP All Export Pro Add-Ons 392 | 393 | You can use any WP All Export Pro add-on by simply adding it's slug like so: 394 | 395 | `junaidbhura/` 396 | 397 | For example: 398 | 399 | `junaidbhura/wpae-acf-add-on` 400 | 401 | ### WPML Add-Ons 402 | 403 | You can use any WPML add-on by simply adding it's slug like so: 404 | 405 | `junaidbhura/wpml-` 406 | 407 | The following add-ons are supported: 408 | 409 | * `junaidbhura/wpml-acfml` 410 | * `junaidbhura/wpml-all-import` 411 | * `junaidbhura/wpml-buddypress-multilingual` 412 | * `junaidbhura/wpml-cms-nav` 413 | * `junaidbhura/wpml-contact-form-7-multilingual` 414 | * `junaidbhura/wpml-gravityforms-multilingual` 415 | * `junaidbhura/wpml-mailchimp-for-wp` 416 | * `junaidbhura/wpml-media-translation` 417 | * `junaidbhura/wpml-ninja-forms` 418 | * `junaidbhura/wpml-sticky-links` 419 | * `junaidbhura/wpml-string-translation` 420 | * `junaidbhura/wpml-translation-management` 421 | * `junaidbhura/wpml-types` 422 | * `junaidbhura/wpml-woocommerce-multilingual` 423 | * `junaidbhura/wpml-wp-seo-multilingual` 424 | * `junaidbhura/wpml-wpforms` 425 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "junaidbhura/composer-wp-pro-plugins", 3 | "type": "composer-plugin", 4 | "license": "MIT", 5 | "require": { 6 | "composer-plugin-api": "^1.0 || ^2.0", 7 | "composer/semver": "^1.0 || ^2.0 || ^3.0", 8 | "vlucas/phpdotenv": "^3.0 || ^4.0 || ^5.0" 9 | }, 10 | "authors": [ 11 | { 12 | "name": "Junaid Bhura", 13 | "email": "info@junaidbhura.com" 14 | } 15 | ], 16 | "autoload": { 17 | "psr-4": { 18 | "Junaidbhura\\Composer\\WPProPlugins\\": "src/" 19 | } 20 | }, 21 | "extra": { 22 | "class": "Junaidbhura\\Composer\\WPProPlugins\\Installer", 23 | "plugin-modifies-downloads": true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Http.php: -------------------------------------------------------------------------------- 1 | composer = $composer; 50 | $this->io = $io; 51 | 52 | $path = getcwd(); 53 | if ( file_exists( $path . DIRECTORY_SEPARATOR . '.env' ) ) { 54 | $this->loadDotenv( $path ); 55 | } 56 | } 57 | 58 | /** 59 | * Deactivate plugin. 60 | * 61 | * @param Composer $composer 62 | * @param IOInterface $io 63 | */ 64 | public function deactivate( Composer $composer, IOInterface $io ) { 65 | $this->composer = null; 66 | $this->io = null; 67 | } 68 | 69 | /** 70 | * Uninstall plugin. 71 | * 72 | * @param Composer $composer 73 | * @param IOInterface $io 74 | */ 75 | public function uninstall( Composer $composer, IOInterface $io ) { 76 | // no need to uninstall anything 77 | } 78 | 79 | /** 80 | * Activate vlucas/phpdotenv, if available. 81 | * 82 | * @param string $path 83 | */ 84 | protected function loadDotenv( $path ) { 85 | // Dotenv V5 86 | if ( method_exists( 'Dotenv\\Dotenv', 'createUnsafeImmutable' ) ) { 87 | $dotenv = Dotenv::createUnsafeImmutable( $path ); 88 | $dotenv->safeLoad(); 89 | return; 90 | } 91 | 92 | // Dotenv V4 93 | if ( method_exists( 'Dotenv\\Dotenv', 'createImmutable' ) ) { 94 | $dotenv = Dotenv::createImmutable( $path ); 95 | $dotenv->safeLoad(); 96 | return; 97 | } 98 | 99 | // Dotenv V3 100 | if ( method_exists( 'Dotenv\\Dotenv', 'create' ) ) { 101 | $dotenv = Dotenv::create( $path ); 102 | $dotenv->safeLoad(); 103 | return; 104 | } 105 | } 106 | 107 | /** 108 | * Set subscribed events. 109 | * 110 | * @return array 111 | */ 112 | public static function getSubscribedEvents() { 113 | 114 | if ( version_compare( PluginInterface::PLUGIN_API_VERSION, '2.0.0', '<' ) ) { 115 | return array( 116 | PackageEvents::PRE_PACKAGE_INSTALL => 'onPrePackageInstallOrUpdateInComposer1', 117 | PackageEvents::PRE_PACKAGE_UPDATE => 'onPrePackageInstallOrUpdateInComposer1', 118 | PluginEvents::PRE_FILE_DOWNLOAD => array( 'onPreFileDownloadInComposer1', -1 ), 119 | ); 120 | } 121 | 122 | return array( 123 | PluginEvents::PRE_FILE_DOWNLOAD => array( 'onPreFileDownloadInComposer2', -1 ), 124 | ); 125 | } 126 | 127 | /** 128 | * Prepare the dist URL of supported packages in Composer v1. 129 | * 130 | * In Composer v1, the {@see self::$downloadUrl} is used to track the 131 | * processed URL during the iteration of each install/update of a package. 132 | * This is necessary because the `PRE_FILE_DOWNLOAD` event does not receive 133 | * the package as a context. 134 | * 135 | * @param PackageEvent $event 136 | */ 137 | public function onPrePackageInstallOrUpdateInComposer1( PackageEvent $event ) { 138 | $this->downloadUrl = null; 139 | 140 | $operation = $event->getOperation(); 141 | if ( 'update' === $operation->getJobType() ) { 142 | $package = $operation->getTargetPackage(); 143 | } else { 144 | $package = $operation->getPackage(); 145 | } 146 | 147 | $download_url = $this->getDownloadUrl( $package ); 148 | if ( ! empty( $download_url ) ) { 149 | $this->downloadUrl = $download_url; 150 | 151 | $dist_url = $package->getDistUrl(); 152 | $filtered_url = $this->filterDistUrl( $dist_url, $package ); 153 | $package->setDistUrl( $filtered_url ); 154 | } 155 | } 156 | 157 | /** 158 | * Prepare the download URL in Composer v1. 159 | * 160 | * In Composer v1, packages are downloaded, installed/updated, sequentially. 161 | * 162 | * @param PreFileDownloadEvent $event 163 | */ 164 | public function onPreFileDownloadInComposer1( PreFileDownloadEvent $event ) { 165 | if ( empty( $this->downloadUrl ) ) { 166 | return; 167 | } 168 | 169 | $_remote_filesystem = $event->getRemoteFilesystem(); 170 | $remote_filesystem = new RemoteFilesystem( 171 | $this->downloadUrl, 172 | $this->io, 173 | $this->composer->getConfig(), 174 | $_remote_filesystem->getOptions(), 175 | $_remote_filesystem->isTlsDisabled() 176 | ); 177 | $event->setRemoteFilesystem( $remote_filesystem ); 178 | } 179 | 180 | /** 181 | * Prepare the download URL in Composer v2. 182 | * 183 | * In Composer v2, all packages get downloaded first, 184 | * then prepared, then installed/updated. 185 | * 186 | * @param PreFileDownloadEvent $event 187 | */ 188 | public function onPreFileDownloadInComposer2( PreFileDownloadEvent $event ) { 189 | /** 190 | * Bail early if this event is not for a package. 191 | * 192 | * @see https://github.com/composer/composer/pull/8975 193 | */ 194 | if ( $event->getType() !== 'package' ) { 195 | return; 196 | } 197 | 198 | $package = $event->getContext(); 199 | $processed_url = $event->getProcessedUrl(); 200 | $download_url = $this->getDownloadUrl( $package ); 201 | 202 | if ( $download_url ) { 203 | $filtered_url = $this->filterDistUrl( $processed_url, $package ); 204 | 205 | $event->setProcessedUrl( $download_url ); 206 | $event->setCustomCacheKey( $filtered_url ); 207 | $package->setDistUrl( $filtered_url ); 208 | } 209 | } 210 | 211 | /** 212 | * Filter the dist URL for a given package. 213 | * 214 | * The filtered dist URL is stored inside `composer.lock` and is used 215 | * to generate the cache key for the requested package version. 216 | * 217 | * @param string|null $url 218 | * @param PackageInterface $package 219 | * 220 | * @return string|null The filtered dist URL. 221 | */ 222 | protected function filterDistUrl( $url, PackageInterface $package ) { 223 | $package_key = sha1( $package->getUniqueName() ); 224 | if ( false === strpos( $url, $package_key ) ) { 225 | $url .= '#' . $package_key; 226 | } 227 | 228 | return $url; 229 | } 230 | 231 | /** 232 | * Get download URL for our plugins. 233 | * 234 | * @param PackageInterface $package 235 | * 236 | * @return ?string The plugin download URL. 237 | */ 238 | protected function getDownloadUrl( PackageInterface $package ) { 239 | $plugin = null; 240 | $package_name = $package->getName(); 241 | $plugin_name = str_replace( 'junaidbhura/', '', $package_name ); 242 | 243 | switch ( $package_name ) { 244 | case 'junaidbhura/acf-extended-pro': 245 | $plugin = new Plugins\AcfExtendedPro( $package->getPrettyVersion(), $plugin_name ); 246 | break; 247 | 248 | case 'junaidbhura/advanced-custom-fields-pro': 249 | $plugin = new Plugins\AcfPro( $package->getPrettyVersion(), $plugin_name ); 250 | break; 251 | 252 | case 'junaidbhura/polylang-pro': 253 | $plugin = new Plugins\PolylangPro( $package->getPrettyVersion(), $plugin_name ); 254 | break; 255 | 256 | case 'junaidbhura/wp-all-import-pro': 257 | case 'junaidbhura/wp-all-export-pro': 258 | $plugin = new Plugins\WpAiPro( $package->getPrettyVersion(), $plugin_name ); 259 | break; 260 | 261 | default: 262 | if ( 0 === strpos( $package_name, 'junaidbhura/gravityforms' ) ) { 263 | $plugin = new Plugins\GravityForms( $package->getPrettyVersion(), $plugin_name ); 264 | } elseif ( 0 === strpos( $package_name, 'junaidbhura/ninja-forms-' ) ) { 265 | $plugin = new Plugins\NinjaForms( $package->getPrettyVersion(), $plugin_name ); 266 | } elseif ( 0 === strpos( $package_name, 'junaidbhura/publishpress-' ) ) { 267 | $plugin = new Plugins\PublishPressPro( $package->getPrettyVersion(), $plugin_name ); 268 | } elseif ( 0 === strpos( $package_name, 'junaidbhura/wpai-' ) || 0 === strpos( $package_name, 'junaidbhura/wpae-' ) ) { 269 | $plugin = new Plugins\WpAiPro( $package->getPrettyVersion(), $plugin_name ); 270 | } elseif ( 0 === strpos( $package_name, 'junaidbhura/wpml-' ) ) { 271 | $plugin = new Plugins\Wpml( $package->getPrettyVersion(), $plugin_name ); 272 | } 273 | } 274 | 275 | if ( ! empty( $plugin ) ) { 276 | return $plugin->getDownloadUrl(); 277 | } 278 | 279 | return null; 280 | } 281 | 282 | } 283 | -------------------------------------------------------------------------------- /src/Plugins/AbstractEddPlugin.php: -------------------------------------------------------------------------------- 1 | $response The EDD API response. 22 | * @return string 23 | */ 24 | protected function extractDownloadUrl( array $response ) { 25 | if ( empty( $response['download_link'] ) || ! is_string( $response['download_link'] ) ) { 26 | throw new UnexpectedValueException( sprintf( 27 | 'Expected a valid download URL for package %s', 28 | 'junaidbhura/' . $this->slug 29 | ) ); 30 | } 31 | 32 | if ( empty( $response['new_version'] ) || ! is_scalar( $response['new_version'] ) ) { 33 | throw new UnexpectedValueException( sprintf( 34 | 'Expected a valid download version number for package %s', 35 | 'junaidbhura/' . $this->slug 36 | ) ); 37 | } 38 | 39 | if ( ! Semver::satisfies( $response['new_version'], $this->version ) ) { 40 | throw new UnexpectedValueException( sprintf( 41 | 'Expected download version (%s) to match installed version (%s) of package %s', 42 | $response['new_version'], 43 | $this->version, 44 | 'junaidbhura/' . $this->slug 45 | ) ); 46 | } 47 | 48 | return $response['download_link']; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/Plugins/AbstractPlugin.php: -------------------------------------------------------------------------------- 1 | version = $version; 36 | $this->slug = $slug; 37 | } 38 | 39 | /** 40 | * Get the download URL for this plugin. 41 | * 42 | * @return string 43 | */ 44 | abstract public function getDownloadUrl(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/Plugins/AcfExtendedPro.php: -------------------------------------------------------------------------------- 1 | post( 'https://acf-extended.com', array( 25 | 'edd_action' => 'get_version', 26 | 'license' => getenv( 'ACFE_PRO_KEY' ), 27 | 'item_name' => 'ACF Extended Pro', 28 | 'url' => getenv( 'ACFE_PRO_URL' ), 29 | 'version' => $this->version, 30 | ) ), true ); 31 | 32 | return $this->extractDownloadUrl( $response ); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugins/AcfPro.php: -------------------------------------------------------------------------------- 1 | version; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/Plugins/GravityForms.php: -------------------------------------------------------------------------------- 1 | post( 'https://gravityapi.com/wp-content/plugins/gravitymanager/api.php?op=get_plugin&slug=' . $this->slug . '&key=' . getenv( 'GRAVITY_FORMS_KEY' ) ) ); 36 | 37 | if ( empty( $response['download_url_latest'] ) || ! is_string( $response['download_url_latest'] ) ) { 38 | throw new UnexpectedValueException( sprintf( 39 | 'Expected a valid download URL for package %s', 40 | 'junaidbhura/' . $this->slug 41 | ) ); 42 | } 43 | 44 | return str_replace( 'http://', 'https://', $response['download_url_latest'] ); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugins/NinjaForms.php: -------------------------------------------------------------------------------- 1 | slug ) { 44 | case 'ninja-forms-activecampaign': 45 | // NF plugin basename: ninja-forms-active-campaign 46 | $name = 'ActiveCampaign'; 47 | $env = 'ACTIVECAMPAIGN'; 48 | break; 49 | 50 | case 'ninja-forms-advanced-datepicker': 51 | // NF plugin basename: ninja-forms-advanced-datepicker 52 | $name = 'Advanced Datepicker'; 53 | $env = 'ADVANCED_DATEPICKER'; 54 | break; 55 | 56 | case 'ninja-forms-authorize-net': 57 | // NF plugin basename: ninja-forms-authorize-net 58 | $name = 'Authorize.net'; 59 | $env = 'AUTHORIZE_NET'; 60 | break; 61 | 62 | case 'ninja-forms-aweber': 63 | // NF plugin basename: ninja-forms-aweber 64 | $name = 'AWeber'; 65 | $env = 'AWEBER'; 66 | break; 67 | 68 | case 'ninja-forms-campaign-monitor': 69 | // NF plugin basename: ninja-forms-campaign-monitor 70 | $name = 'Campaign Monitor'; 71 | $env = 'CAMPAIGN_MONITOR'; 72 | break; 73 | 74 | case 'ninja-forms-capsule-crm': 75 | // NF plugin basename: ninja-forms-capsule-crm 76 | $name = 'Capsule CRM'; 77 | $env = 'CAPSULE_CRM'; 78 | break; 79 | 80 | case 'ninja-forms-civicrm': 81 | // NF plugin basename: ninja-forms-civicrm 82 | $name = 'CiviCRM'; 83 | $env = 'CIVICRM'; 84 | break; 85 | 86 | case 'ninja-forms-cleverreach': 87 | // NF plugin basename: ninja-forms-cleverreach 88 | $name = 'CleverReach'; 89 | $env = 'CLEVERREACH'; 90 | break; 91 | 92 | case 'ninja-forms-clicksend': 93 | // NF plugin basename: ninja-forms-clicksend 94 | $name = 'ClickSend SMS'; 95 | $env = 'CLICKSEND'; 96 | break; 97 | 98 | case 'ninja-forms-conditional-logic': 99 | // NF plugin basename: ninja-forms-conditionals, ninja-forms-conditional-logic 100 | $name = 'Conditional Logic'; 101 | $env = 'CONDITIONAL_LOGIC'; 102 | break; 103 | 104 | case 'ninja-forms-constant-contact': 105 | // NF plugin basename: ninja-forms-constant-contact 106 | $name = 'Constant Contact'; 107 | $env = 'CONSTANT_CONTACT'; 108 | break; 109 | 110 | case 'ninja-forms-convertkit': 111 | // NF plugin basename: ninja-forms-convertkit 112 | $name = 'ConvertKit'; 113 | $env = 'CONVERTKIT'; 114 | break; 115 | 116 | case 'ninja-forms-elavon': 117 | // NF plugin basename: ninja-forms-elavon-payment-gateway 118 | $name = 'Elavon'; 119 | $env = 'ELAVON'; 120 | break; 121 | 122 | case 'ninja-forms-emailoctopus': 123 | // NF plugin basename: ninja-forms-emailoctopus 124 | $name = 'EmailOctopus'; 125 | $env = 'EMAILOCTOPUS'; 126 | break; 127 | 128 | case 'ninja-forms-emma': 129 | // NF plugin basename: ninja-forms-emma 130 | $name = 'Emma'; 131 | $env = 'EMMA'; 132 | break; 133 | 134 | case 'ninja-forms-excel-export': 135 | // NF plugin basename: ninja-forms-excel-export 136 | $name = 'Excel Export'; 137 | $env = 'EXCEL_EXPORT'; 138 | break; 139 | 140 | case 'ninja-forms-help-scout': 141 | // NF plugin basename: ninja-forms-helpscout 142 | $name = 'Help Scout'; 143 | $env = 'HELP_SCOUT'; 144 | break; 145 | 146 | case 'ninja-forms-hubspot': 147 | // NF plugin basename: ninja-forms-hubspot 148 | $name = 'HubSpot'; 149 | $env = 'HUBSPOT'; 150 | break; 151 | 152 | case 'ninja-forms-insightly': 153 | // NF plugin basename: ninja-forms-insightly-crm 154 | $name = 'Insightly CRM'; 155 | $env = 'INSIGHTLY'; 156 | break; 157 | 158 | case 'ninja-forms-layout-styles': 159 | // NF plugin basename: ninja-forms-style, ninja-forms-layout-styles 160 | $name = 'Layout and Styles'; 161 | $env = 'LAYOUT_STYLES'; 162 | break; 163 | 164 | case 'ninja-forms-mailchimp': 165 | // NF plugin basename: ninja-forms-mail-chimp, ninja-forms-mailchimp 166 | $name = 'Mailchimp'; 167 | $env = 'MAILCHIMP'; 168 | break; 169 | 170 | case 'ninja-forms-mailpoet': 171 | // NF plugin basename: ninja-forms-mailpoet 172 | // Formerly Wysija 173 | $name = 'MailPoet'; 174 | $env = 'MAILPOET'; 175 | break; 176 | 177 | case 'ninja-forms-multi-step': 178 | // NF plugin basename: ninja-forms-multi-part 179 | $name = 'Multi Step Forms'; 180 | $env = 'MULTI_STEP'; 181 | break; 182 | 183 | case 'ninja-forms-onepagecrm': 184 | // NF plugin basename: ninja-forms-onepage-crm, ninja-forms-onepagecrm 185 | $name = 'OnePageCRM'; 186 | $env = 'ONEPAGECRM'; 187 | break; 188 | 189 | case 'ninja-forms-paypal-express': 190 | // NF plugin basename: ninja-forms-paypal-express 191 | $name = 'PayPal Express'; 192 | $env = 'PAYPAL_EXPRESS'; 193 | break; 194 | 195 | case 'ninja-forms-pdf-submissions': 196 | // NF plugin basename: ninja-forms-pdf-submissions 197 | $name = 'PDF Form Submission'; 198 | $env = 'PDF_SUBMISSIONS'; 199 | break; 200 | 201 | case 'ninja-forms-pipeline-crm': 202 | // NF plugin basename: ninja-forms-pipeline-deals-crm 203 | // Formerly PipelineDeals 204 | $name = 'Pipeline CRM'; 205 | $env = 'PIPELINE_CRM'; 206 | break; 207 | 208 | case 'ninja-forms-post-creation': 209 | // NF plugin basename: ninja-forms-post-creation 210 | $name = 'Front-End Posting'; 211 | $env = 'POST_CREATION'; 212 | break; 213 | 214 | case 'ninja-forms-recurly': 215 | // NF plugin basename: ninja-forms-recurly 216 | $name = 'Recurly'; 217 | $env = 'RECURLY'; 218 | break; 219 | 220 | case 'ninja-forms-salesforce': 221 | // NF plugin basename: ninja-forms-salesforce-crm 222 | $name = 'Salesforce CRM'; 223 | $env = 'SALESFORCE'; 224 | break; 225 | 226 | case 'ninja-forms-save-progress': 227 | // NF plugin basename: ninja-forms-save-progress 228 | $name = 'Save Progress'; 229 | $env = 'SAVE_PROGRESS'; 230 | break; 231 | 232 | case 'ninja-forms-scheduled-exports': 233 | // NF plugin basename: ninja-forms-scheduled-exports 234 | $name = 'Scheduled Submissions Export'; 235 | $env = 'SCHEDULED_EXPORTS'; 236 | break; 237 | 238 | case 'ninja-forms-slack': 239 | // NF plugin basename: ninja-forms-slack 240 | $name = 'Slack'; 241 | $env = 'SLACK'; 242 | break; 243 | 244 | case 'ninja-forms-stripe': 245 | // NF plugin basename: ninja-forms-stripe 246 | $name = 'Stripe'; 247 | $env = 'STRIPE'; 248 | break; 249 | 250 | case 'ninja-forms-trello': 251 | // NF plugin basename: ninja-forms-trello 252 | $name = 'Trello'; 253 | $env = 'TRELLO'; 254 | break; 255 | 256 | case 'ninja-forms-twilio': 257 | // NF plugin basename: ninja-forms-twilio 258 | $name = 'Twilio SMS'; 259 | $env = 'TWILIO'; 260 | break; 261 | 262 | case 'ninja-forms-uploads': 263 | // NF plugin basename: ninja-forms-uploads 264 | $name = 'File Uploads'; 265 | $env = 'UPLOADS'; 266 | break; 267 | 268 | case 'ninja-forms-user-analytics': 269 | // NF plugin basename: ninja-forms-user-analytics 270 | $name = 'User Analytics'; 271 | $env = 'USER_ANALYTICS'; 272 | break; 273 | 274 | case 'ninja-forms-user-management': 275 | // NF plugin basename: ninja-forms-user-management 276 | $name = 'User Management'; 277 | $env = 'USER_MANAGEMENT'; 278 | break; 279 | 280 | case 'ninja-forms-webhooks': 281 | // NF plugin basename: ninja-forms-webhooks 282 | $name = 'Webhooks'; 283 | $env = 'WEBHOOKS'; 284 | break; 285 | 286 | case 'ninja-forms-zapier': 287 | // NF plugin basename: ninja-forms-zapier 288 | $name = 'Zapier'; 289 | $env = 'ZAPIER'; 290 | break; 291 | 292 | case 'ninja-forms-zoho': 293 | // NF plugin basename: ninja-forms-zoho-crm 294 | $name = 'Zoho CRM'; 295 | $env = 'ZOHO'; 296 | break; 297 | 298 | default: 299 | throw new UnexpectedValueException( sprintf( 300 | 'Could not find a matching package for %s. Check the package spelling and that the package is supported', 301 | 'junaidbhura/' . $this->slug 302 | ) ); 303 | } 304 | 305 | if ( $env ) { 306 | /** 307 | * Use add-on licensing if available, otherwise use membership licensing. 308 | */ 309 | $license = ( getenv( "NINJA_FORMS_{$env}_KEY" ) ?: $license ); 310 | $url = ( getenv( "NINJA_FORMS_{$env}_URL" ) ?: $url ); 311 | } 312 | 313 | $http = new Http(); 314 | $response = json_decode( $http->get( 'https://ninjaforms.com', array( 315 | 'edd_action' => 'get_version', 316 | 'license' => $license, 317 | 'item_name' => $name, 318 | 'url' => $url, 319 | 'version' => $this->version, 320 | ) ), true ); 321 | 322 | return $this->extractDownloadUrl( $response ); 323 | } 324 | 325 | } 326 | -------------------------------------------------------------------------------- /src/Plugins/PolylangPro.php: -------------------------------------------------------------------------------- 1 | post( 'https://polylang.pro', array( 25 | 'edd_action' => 'get_version', 26 | 'license' => getenv( 'POLYLANG_PRO_KEY' ), 27 | 'item_name' => 'Polylang Pro', 28 | 'url' => getenv( 'POLYLANG_PRO_URL' ), 29 | 'version' => $this->version, 30 | ) ), true ); 31 | 32 | return $this->extractDownloadUrl( $response ); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugins/PublishPressPro.php: -------------------------------------------------------------------------------- 1 | slug ) { 46 | case 'publishpress-authors-pro': 47 | $id = 7203; 48 | $env = 'AUTHORS'; 49 | break; 50 | 51 | case 'publishpress-blocks-pro': 52 | $id = 98972; 53 | $env = 'BLOCKS'; 54 | break; 55 | 56 | case 'publishpress-capabilities-pro': 57 | $id = 44811; 58 | $env = 'CAPABILITIES'; 59 | break; 60 | 61 | case 'publishpress-checklists-pro': 62 | $id = 6465; 63 | $env = 'CHECKLISTS'; 64 | break; 65 | 66 | case 'publishpress-future-pro': 67 | $id = 129032; 68 | $env = 'FUTURE'; 69 | break; 70 | 71 | case 'publishpress-permissions-pro': 72 | $id = 34506; 73 | $env = 'PERMISSIONS'; 74 | break; 75 | 76 | case 'publishpress-planner-pro': 77 | $id = 49742; 78 | $env = 'PLANNER'; 79 | break; 80 | 81 | case 'publishpress-revisions-pro': 82 | $id = 40280; 83 | $env = 'REVISIONS'; 84 | break; 85 | 86 | case 'publishpress-series-pro': 87 | $id = 110550; 88 | $env = 'SERIES'; 89 | break; 90 | 91 | default: 92 | throw new UnexpectedValueException( sprintf( 93 | 'Could not find a matching package for %s. Check the package spelling and that the package is supported', 94 | 'junaidbhura/' . $this->slug 95 | ) ); 96 | } 97 | 98 | if ( $env ) { 99 | /** 100 | * Use add-on licensing if available, otherwise use membership licensing. 101 | */ 102 | $license = ( getenv( "PUBLISHPRESS_{$env}_PRO_KEY" ) ?: $license ); 103 | $url = ( getenv( "PUBLISHPRESS_{$env}_PRO_URL" ) ?: $url ); 104 | } 105 | 106 | $http = new Http(); 107 | $response = json_decode( $http->get( 'https://publishpress.com', array( 108 | 'edd_action' => 'get_version', 109 | 'license' => $license, 110 | 'item_id' => $id, 111 | 'url' => $url, 112 | 'version' => $this->version, 113 | ) ), true ); 114 | 115 | return $this->extractDownloadUrl( $response ); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /src/Plugins/WpAiPro.php: -------------------------------------------------------------------------------- 1 | slug || 0 === strpos( $this->slug, 'wpai-' ) ) { 38 | // WP All Import Pro. 39 | $url = getenv( 'WP_ALL_IMPORT_PRO_URL' ); 40 | 41 | switch ( $this->slug ) { 42 | case 'wpai-acf-add-on': 43 | $name = 'ACF Add-On'; 44 | break; 45 | case 'wpai-linkcloak-add-on': 46 | $name = 'Link Cloaking Add-On'; 47 | break; 48 | case 'wpai-user-add-on': 49 | $name = 'User Import Add-On'; 50 | break; 51 | case 'wpai-woocommerce-add-on': 52 | $name = 'WooCommerce Add-On'; 53 | break; 54 | default: 55 | $name = 'WP All Import'; 56 | $license = getenv( 'WP_ALL_IMPORT_PRO_KEY' ); 57 | } 58 | } elseif ( 'wp-all-export-pro' === $this->slug || 0 === strpos( $this->slug, 'wpae-' ) ) { 59 | // WP All Export Pro. 60 | $url = getenv( 'WP_ALL_EXPORT_PRO_URL' ); 61 | 62 | switch ( $this->slug ) { 63 | case 'wpae-acf-add-on': 64 | $name = 'ACF Export Add-On Pro'; 65 | break; 66 | case 'wpae-woocommerce-add-on': 67 | $name = 'WooCommerce Export Add-On Pro'; 68 | break; 69 | case 'wpae-user-add-on-pro': 70 | $name = 'User Export Add-On Pro'; 71 | break; 72 | default: 73 | $name = 'WP All Export'; 74 | $license = getenv( 'WP_ALL_EXPORT_PRO_KEY' ); 75 | } 76 | } 77 | 78 | $http = new Http(); 79 | $response = json_decode( $http->get( 'https://www.wpallimport.com', array( 80 | 'edd_action' => 'get_version', 81 | 'license' => $license, 82 | 'item_name' => $name, 83 | 'url' => $url, 84 | 'version' => $this->version, 85 | ) ), true ); 86 | 87 | return $this->extractDownloadUrl( $response ); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/Plugins/Wpml.php: -------------------------------------------------------------------------------- 1 | 1097589, 35 | 'wpml-all-import' => 720221, 36 | 'wpml-buddypress-multilingual' => 2216259, 37 | 'wpml-cms-nav' => 6096, 38 | 'wpml-contact-form-7-multilingual' => 3156699, 39 | 'wpml-gravityforms-multilingual' => 8882, 40 | 'wpml-mailchimp-for-wp' => 1442229, 41 | 'wpml-media-translation' => 7474, 42 | 'wpml-ninja-forms' => 5342487, 43 | 'wpml-sitepress-multilingual-cms' => 6088, 44 | 'wpml-sticky-links' => 6090, 45 | 'wpml-string-translation' => 6092, 46 | 'wpml-translation-management' => 6094, 47 | 'wpml-types' => 1385906, 48 | 'wpml-woocommerce-multilingual' => 637370, 49 | 'wpml-wp-seo-multilingual' => 3566177, 50 | 'wpml-wpforms' => 5368995, 51 | ); 52 | 53 | if ( ! array_key_exists( $this->slug, $packages ) ) { 54 | throw new UnexpectedValueException( sprintf( 55 | 'Could not find a matching package for %s. Check the package spelling and that the package is supported', 56 | 'junaidbhura/' . $this->slug 57 | ) ); 58 | } 59 | 60 | return 'https://wpml.org/?download=' . $packages[ $this->slug ] . '&user_id=' . getenv( 'WPML_USER_ID' ) . '&subscription_key=' . getenv( 'WPML_KEY' ) . '&version=' . $this->version; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/RemoteFilesystem.php: -------------------------------------------------------------------------------- 1 | fileUrl = $fileUrl; 44 | parent::__construct( $io, $config, $options, $disableTls ); 45 | } 46 | 47 | /** 48 | * Copy the remote file to local. 49 | * 50 | * @param string $originUrl The origin URL 51 | * @param string $fileUrl The file URL (ignored) 52 | * @param string $fileName the local filename 53 | * @param bool $progress Display the progression 54 | * @param array $options Additional context options 55 | * @return bool true 56 | */ 57 | public function copy( 58 | $originUrl, 59 | $fileUrl, 60 | $fileName, 61 | $progress = true, 62 | $options = [] 63 | ) { 64 | return parent::copy( 65 | $originUrl, 66 | $this->fileUrl, 67 | $fileName, 68 | $progress, 69 | $options 70 | ); 71 | } 72 | 73 | } 74 | --------------------------------------------------------------------------------