Merged
Conversation
- register plugins with the $slug as array key - ensure that all plugins have defaults registered for the keys not passed - add `$has_forced_activation` and `$has_forced_deactivation` properties to the TGMPA class which are set from the plugin registration method and used to determine whether to add the relevant actions - add `$sort_order` property which holds the plugin names for use in sorting the `$plugins` property for internal use - as - no matter what - we'll always need the file_path, we might as well also set it in the registration method and get rid of the repeated calls to `$this->populate_file_path()` - also made the `populate_file_path()` a little bit more flexible so it can be used in a leaner manner for those cases where it's still needed
- retrieve most information we need from our `$plugins` array rather than pass it through URL or $_POST - properly sanitize and validate received information from URL or $_POST - leverage the use of the WP_filesystem API - show an appropriate error message if user tries to activate an already active plugin - deprecate the `TGMPA_List_Table::_get_plugin_data_from_name()` method which is no longer needed as we have access to the `TGM_Plugin_Activation::_get_plugin_data_from_name()` method - Fix unauthorized issue on bulk installs when not using direct file access caused by #227 - Only prepare some variables and update recently activated plugins option when we actually need to Also: - abstract the regexes which are used a number of times to class constants - combine multiple `isset()`'s if used within the same if statement - don't nest what doesn't need nesting - unset loop variables if the function doesn't return straight after
…ion into feature/simplify-passed-info
This was referenced Apr 28, 2015
Member
There was a problem hiding this comment.
How about if the user has registered slightly incorrect as a string:
required => 'true',
? We should allow a little leeway for 2.5, and then make it stricter for 3.0.
Contributor
Author
There was a problem hiding this comment.
I've added some type casting to the registration method now to account for this. Using some of the filter/filter emulate code I pointed to elsewhere from the WPSEO plugin. Not giving credit to them as I wrote it ;-)
Member
|
Phew! Excellent stuff. I realise some of my suggestions may well be other PRs once this is merged, but wanted to mention them to get them on your radar if they weren't already. |
Most notable addition is a new class with two new validation methods for validating booleans and the use of this code in the plugin registration function
516c3b8 to
5650c61
Compare
GaryJones
added a commit
that referenced
this pull request
Apr 28, 2015
Simplify the handling of information that is passed around.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tested reasonably extensively
Improve plugin registration method
$slugas associative array key$has_forced_activationand$has_forced_deactivationproperties to the TGMPA class which are set from the plugin registration method and used to determine whether to add the relevant actions$sort_orderproperty which holds the plugin names for use in sorting the$pluginsproperty for internal usefile_path, we might as well also set it in the registration method and get rid of the repeated calls to$this->populate_file_path()populate_file_path()a little bit more flexible so it can be used in a leaner manner for those cases where it's still neededSimplify the table generation, install and activate code
$pluginsarray rather than pass it through URL or$_POST$_POSTTGMPA_List_Table::_get_plugin_data_from_name()method which is no longer needed as we have access to theTGM_Plugin_Activation::_get_plugin_data_from_name()methodAlso:
isset()'s if used within the same if statement