From e9f18d0cd963005963c26800391d929f7f489383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Saraiva?= Date: Thu, 15 Mar 2012 22:36:37 +0000 Subject: [PATCH] added a header in the generated bundle file. improved regex for php tags removal. --- lib/Freesound.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/Freesound.php b/lib/Freesound.php index e9cb6d9..1772c1c 100644 --- a/lib/Freesound.php +++ b/lib/Freesound.php @@ -20,13 +20,15 @@ *************************************************************************************************/ /** - * Autoloader class + * Utilities class * - * @package Freesound + * @package Freesound + * @subpackage Freesound_Utils */ class Freesound_Utils { public static $classmap = array( + 'Freesound' => 'Freesound', 'Freesound_Base' => 'Base/Base', 'Freesound_Config' => 'Config/Config', 'Freesound_API_Base' => 'API/Base', @@ -50,13 +52,20 @@ public static function BundleBuild( $file ) $classpaths = array_unique( array_values( self::$classmap ) ); $content = "#s', '\\1', $c ); + $c = preg_replace( array( '#<\?(?:php)?\s*#s', '#\?\>(?=([\s\n]+)?$(?!\n))#s' ), null, $c ); $content .= "$c\n\n"; } $content .= "?>"; @@ -80,8 +89,9 @@ public static function AutoloadRegister() } } -// register autoload -Freesound_Utils::AutoloadRegister(); +if (! defined( 'FREESOUND_BUNDLE' )) { + Freesound_Utils::AutoloadRegister(); +} /**