Browse files

Updated URL check from a basic |^http(s)?://| to /^((https?|ftp)\:\/\…

…/)?([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?([a-z0-9-.]*)\.([a-z]{2,3})(\:[0-9]{2,5})?(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:@&%=+\/\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?/ in order to validate all URLs (http://, https://, ftp://, ftps:// www.domain.com, domain.com, subdomain.domain.com
  • Loading branch information...
1 parent 0089f4d commit 1ecba8a45ae88c86a74146b5f283f83f3f87e683 @wpsmith committed May 20, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 tgm-plugin-activation/class-tgm-plugin-activation.php
View
2 tgm-plugin-activation/class-tgm-plugin-activation.php
@@ -1164,7 +1164,7 @@ protected function _gather_plugin_data() {
}
elseif ( isset( $plugin['source'] ) ) {
/** The plugin must be from a private repository */
- if ( preg_match( '|^http(s)?://|', $plugin['source'] ) )
+ if ( preg_match( '/^((https?|ftps?)\:\/\/)?([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?([a-z0-9-.]*)\.([a-z]{2,3})(\:[0-9]{2,5})?(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:@&%=+\/\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?/', $plugin['source'] ) )
$table_data[$i]['source'] = __( 'Private Repository', TGM_Plugin_Activation::$instance->domain );
/** The plugin is pre-packaged with the theme */
else

0 comments on commit 1ecba8a

Please sign in to comment.