-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for WPML (plugin / add-ons) #42
Conversation
plugins/WPML.php
Outdated
'wpml-translation-management' => 6094, | ||
]; | ||
|
||
if (in_array($this->slug, $packages)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in_array
should be replaced with array_key_exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, my bad!
It's modified! :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this on a project with several WPML add-ons and it seems to work well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature is much appreciated.
I have not tested it myself yet but I propose a few minor changes to match the coding style of the rest of the package.
/** | ||
* ACF Pro Plugin. | ||
* | ||
* @package Junaidbhura\Composer\WPProPlugins\Plugins | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change file block comment to reflect WPML plugin.
/** | |
* ACF Pro Plugin. | |
* | |
* @package Junaidbhura\Composer\WPProPlugins\Plugins | |
*/ | |
/** | |
* WPML Plugin. | |
* | |
* @package Junaidbhura\Composer\WPProPlugins\Plugins | |
*/ |
/** | ||
* AcfPro class. | ||
*/ | ||
class WPML { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change class block comment to reflect WPML plugin.
Rename the class and file name to CamelCase to reflect the other plugin class names.
/** | |
* AcfPro class. | |
*/ | |
class WPML { | |
/** | |
* Wpml class. | |
*/ | |
class Wpml { |
/** | ||
* WpAiPro constructor. | ||
* | ||
* @param string $version | ||
* @param string $slug | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change method block comment to reflect WPML plugin.
/** | |
* WpAiPro constructor. | |
* | |
* @param string $version | |
* @param string $slug | |
*/ | |
/** | |
* Wpml constructor. | |
* | |
* @param string $version | |
* @param string $slug | |
*/ |
$packages = [ | ||
'wpml-sitepress-multilingual-cms' => 6088, | ||
'wpml-string-translation' => 6092, | ||
'wpml-media-translation' => 7474, | ||
'wpml-woocommerce-multilingual' => 637370, | ||
'wpml-gravityforms-multilingual' => 8882, | ||
'wpml-contact-form-7-multilingual' => 3156699, | ||
'wpml-ninja-forms' => 5342487, | ||
'wpml-wpforms' => 5368995, | ||
'wpml-buddypress-multilingual' => 2216259, | ||
'wpml-acfml' => 1097589, | ||
'wpml-all-import' => 720221, | ||
'wpml-mailchimp-for-wp' => 1442229, | ||
'wpml-wp-seo-multilingual' => 3566177, | ||
'wpml-types' => 1385906, | ||
'wpml-sticky-links' => 6090, | ||
'wpml-cms-nav' => 6096, | ||
'wpml-translation-management' => 6094, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to verbose array syntax and aligned array values to match coding style other classes.
$packages = [ | |
'wpml-sitepress-multilingual-cms' => 6088, | |
'wpml-string-translation' => 6092, | |
'wpml-media-translation' => 7474, | |
'wpml-woocommerce-multilingual' => 637370, | |
'wpml-gravityforms-multilingual' => 8882, | |
'wpml-contact-form-7-multilingual' => 3156699, | |
'wpml-ninja-forms' => 5342487, | |
'wpml-wpforms' => 5368995, | |
'wpml-buddypress-multilingual' => 2216259, | |
'wpml-acfml' => 1097589, | |
'wpml-all-import' => 720221, | |
'wpml-mailchimp-for-wp' => 1442229, | |
'wpml-wp-seo-multilingual' => 3566177, | |
'wpml-types' => 1385906, | |
'wpml-sticky-links' => 6090, | |
'wpml-cms-nav' => 6096, | |
'wpml-translation-management' => 6094, | |
]; | |
$packages = array( | |
'wpml-sitepress-multilingual-cms' => 6088, | |
'wpml-string-translation' => 6092, | |
'wpml-media-translation' => 7474, | |
'wpml-woocommerce-multilingual' => 637370, | |
'wpml-gravityforms-multilingual' => 8882, | |
'wpml-contact-form-7-multilingual' => 3156699, | |
'wpml-ninja-forms' => 5342487, | |
'wpml-wpforms' => 5368995, | |
'wpml-buddypress-multilingual' => 2216259, | |
'wpml-acfml' => 1097589, | |
'wpml-all-import' => 720221, | |
'wpml-mailchimp-for-wp' => 1442229, | |
'wpml-wp-seo-multilingual' => 3566177, | |
'wpml-types' => 1385906, | |
'wpml-sticky-links' => 6090, | |
'wpml-cms-nav' => 6096, | |
'wpml-translation-management' => 6094, | |
); |
if (array_key_exists($this->slug, $packages)) { | ||
return 'https://wpml.org/?download='. $packages[$this->slug] .'&user_id='. getenv( 'WPML_USER_ID' ) .'&subscription_key='. getenv( 'WPML_KEY' ) .'&version=' . $this->version; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added spacing to match coding style other classes.
if (array_key_exists($this->slug, $packages)) { | |
return 'https://wpml.org/?download='. $packages[$this->slug] .'&user_id='. getenv( 'WPML_USER_ID' ) .'&subscription_key='. getenv( 'WPML_KEY' ) .'&version=' . $this->version; | |
} | |
if ( array_key_exists( $this->slug, $packages ) ) { | |
return 'https://wpml.org/?download=' . $packages[$this->slug] . '&user_id='. getenv( 'WPML_USER_ID' ) . '&subscription_key=' . getenv( 'WPML_KEY' ) . '&version=' . $this->version; | |
} |
My colleague, @MouseEatsCat, and I have tried it. |
* @param string $version | ||
* @param string $slug | ||
*/ | ||
public function __construct( $version = '', $slug = 'sitepress-multilingual-cms' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the default slug to match the array key below.
public function __construct( $version = '', $slug = 'sitepress-multilingual-cms' ) { | |
public function __construct( $version = '', $slug = 'wpml-sitepress-multilingual-cms' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the Wpml.php
file is using spaces instead of tabs. That should also be fixed.
### WPML Add-Ons | ||
|
||
You can use any WPML add-on by simply adding it's slug like so: | ||
|
||
`junaidbhura/<plugin-slug>` | ||
|
||
For example: | ||
|
||
`junaidbhura/wpml-sitepress-multilingual-cms` | ||
|
||
`junaidbhura/wpml-string-translation` | ||
|
||
`junaidbhura/wpml-media-translation` | ||
|
||
`junaidbhura/wpml-woocommerce-multilingual` | ||
|
||
`junaidbhura/wpml-gravityforms-multilingual` | ||
|
||
`junaidbhura/wpml-contact-form-7-multilingual` | ||
|
||
`junaidbhura/wpml-ninja-forms` | ||
|
||
`junaidbhura/wpml-wpforms` | ||
|
||
`junaidbhura/wpml-buddypress-multilingual` | ||
|
||
`junaidbhura/wpml-acfml` | ||
|
||
`junaidbhura/wpml-all-import` | ||
|
||
`junaidbhura/wpml-mailchimp-for-wp` | ||
|
||
`junaidbhura/wpml-wp-seo-multilingual` | ||
|
||
`junaidbhura/wpml-types` | ||
|
||
`junaidbhura/wpml-sticky-links` | ||
|
||
`junaidbhura/wpml-cms-nav` | ||
|
||
`junaidbhura/wpml-translation-management` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is derived from from WP All Import/Export Pro and both should be rephrased to highlight the fact that only specific add-ons of each plugin are supported. The section should be phrase as so:
### WPML Add-Ons | |
You can use any WPML add-on by simply adding it's slug like so: | |
`junaidbhura/<plugin-slug>` | |
For example: | |
`junaidbhura/wpml-sitepress-multilingual-cms` | |
`junaidbhura/wpml-string-translation` | |
`junaidbhura/wpml-media-translation` | |
`junaidbhura/wpml-woocommerce-multilingual` | |
`junaidbhura/wpml-gravityforms-multilingual` | |
`junaidbhura/wpml-contact-form-7-multilingual` | |
`junaidbhura/wpml-ninja-forms` | |
`junaidbhura/wpml-wpforms` | |
`junaidbhura/wpml-buddypress-multilingual` | |
`junaidbhura/wpml-acfml` | |
`junaidbhura/wpml-all-import` | |
`junaidbhura/wpml-mailchimp-for-wp` | |
`junaidbhura/wpml-wp-seo-multilingual` | |
`junaidbhura/wpml-types` | |
`junaidbhura/wpml-sticky-links` | |
`junaidbhura/wpml-cms-nav` | |
`junaidbhura/wpml-translation-management` | |
### WPML Add-Ons | |
The following WPML plugins and add-ons are supported: | |
* `junaidbhura/wpml-acfml` | |
* `junaidbhura/wpml-all-import` | |
* `junaidbhura/wpml-buddypress-multilingual` | |
* `junaidbhura/wpml-cms-nav` | |
* `junaidbhura/wpml-contact-form-7-multilingual` | |
* `junaidbhura/wpml-gravityforms-multilingual` | |
* `junaidbhura/wpml-mailchimp-for-wp` | |
* `junaidbhura/wpml-media-translation` | |
* `junaidbhura/wpml-ninja-forms` | |
* `junaidbhura/wpml-sitepress-multilingual-cms` | |
* `junaidbhura/wpml-sticky-links` | |
* `junaidbhura/wpml-string-translation` | |
* `junaidbhura/wpml-translation-management` | |
* `junaidbhura/wpml-types` | |
* `junaidbhura/wpml-woocommerce-multilingual` | |
* `junaidbhura/wpml-wp-seo-multilingual` | |
* `junaidbhura/wpml-wpforms` |
}, | ||
|
||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix JSON syntax.
}, | |
], | |
} | |
], |
Hi @Spidlace, I hope you are doing well. Will you be able to work on requested changes any time soon? Thanks and take care, |
I've merged my suggestions in my fork, including some alleviation to the WPML code samples in the README. I could create a separate pull request if we want to merge this feature sooner. |
@mcaskill Shall we close this PR in favour and maybe you could create a new PR instead? |
Closing in favour of #53 |
Checklist:
Description
Add support for WPML plugin and add-ons