Skip to content
Browse files

Added namespace check to autoloader.

  • Loading branch information...
1 parent 25d5963 commit b2aeed07b93cd42134ca857f41ea7ff9338b17d0 @mvied committed
Showing with 8 additions and 2 deletions.
  1. +8 −2 wordpress-https.php
View
10 wordpress-https.php
@@ -33,8 +33,14 @@
load_plugin_textdomain( 'wordpress-https', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
function wphttps_autoloader($class) {
- $filename = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
- @include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $filename;
+ $namespaces = array(
+ 'Mvied',
+ 'WordPressHTTPS'
+ );
+ if ( preg_match('/([A-Za-z]+)_?/', $class, $match) && in_array($match[1], $namespaces) ) {
+ $filename = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
+ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $filename;
+ }
}
spl_autoload_register('wphttps_autoloader');

0 comments on commit b2aeed0

Please sign in to comment.
Something went wrong with that request. Please try again.