Skip to content
Browse files

replaced unecessary BUNDLE constant with class_exists checks; dropped…

… use of DIRECTORY_SEPARATOR, also not necessary;
  • Loading branch information...
1 parent 540bcab commit c3fea2d0b944046cf0cd8fe7cfc3163a72f36f28 @nocive committed
Showing with 6 additions and 7 deletions.
  1. +2 −2 lib/Bootstrap/Bootstrap.php
  2. +2 −2 lib/Freesound.php
  3. +2 −3 lib/Utils/Utils.php
View
4 lib/Bootstrap/Bootstrap.php
@@ -29,7 +29,7 @@ class Freesound_Bootstrap
public static function Autoload( $class )
{
if (isset( self::$classmap[$class] )) {
- $classFile = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace( '/', DIRECTORY_SEPARATOR, self::$classmap[$class] ) . self::CLASS_EXTENSION;
+ $classFile = __DIR__ . '/../' . self::$classmap[$class] . self::CLASS_EXTENSION;
include_once( $classFile );
}
}
@@ -41,7 +41,7 @@ public static function AutoloadRegister()
}
}
-if (! defined( '__FREESOUND_BUNDLE__' )) {
+if (! class_exists( 'Freesound' )) {
Freesound_Bootstrap::AutoloadRegister();
}
View
4 lib/Freesound.php
@@ -19,8 +19,8 @@
*
*************************************************************************************************/
-if (! defined( '__FREESOUND_BUNDLE__' )) {
- require_once( __DIR__ . DIRECTORY_SEPARATOR . 'Bootstrap' . DIRECTORY_SEPARATOR . 'Bootstrap.php' );
+if (! class_exists( 'Freesound_Bootstrap' )) {
+ require_once( __DIR__ . '/Bootstrap/Bootstrap.php' );
}
/**
View
5 lib/Utils/Utils.php
@@ -14,7 +14,7 @@ public static function BundleBuild( $file )
throw new Exception( "File '$file' already exists, please remove it before trying to build a new bundle" );
}
- $basepath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
+ $basepath = __DIR__ . '/../';
$classpaths = array_unique( array_values( Freesound_Bootstrap::$classmap ) );
$content = "<?php\n\n";
@@ -25,8 +25,7 @@ public static function BundleBuild( $file )
$content .= " *\n";
$content .= " * Generated at: " . date( 'r' ) . "\n";
$content .= " *\n";
- $content .= " ***********************************************************/\n";
- $content .= "define( '__FREESOUND_BUNDLE__', true );\n\n";
+ $content .= " ***********************************************************/\n\n";
foreach( $classpaths as $path ) {
$f = $basepath . $path . Freesound_Bootstrap::CLASS_EXTENSION;

0 comments on commit c3fea2d

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