Skip to content
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

Validate MIME type against extensions #120

Merged
merged 10 commits into from
Oct 2, 2017
2 changes: 2 additions & 0 deletions command.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
return;
}

require 'vendor/autoload.php';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to check for the existence of this file first, because the folder will not exist if the package is used as a dependency, not a root package:

$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
if ( file_exists( $autoload ) ) {
	require_once $autoload;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies. I made the necessary changes.


spl_autoload_register( function( $class ) {
$class = ltrim( $class, '\\' );
if ( 0 !== stripos( $class, 'runcommand\\Doctor\\' ) ) {
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"files": [ "command.php" ]
},
"require": {
"wp-cli/wp-cli": "*"
"wp-cli/wp-cli": "*",
"brightnucleus/mime-types": "^0.1.1"
},
"require-dev": {
"behat/behat": "~2.5"
Expand Down
Loading