-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use autoloadhelper as we need inis anyway; Fix integer and flo…
…at datatype checkers; Tag release 0.2
- Loading branch information
gggeek
committed
Mar 11, 2014
1 parent
065177e
commit 10bdc70
Showing
8 changed files
with
133 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
/** | ||
* A custom autoloader, provided in case this extension is not properly activated in eZ4 | ||
*/ | ||
class ezdbiAutoloadHelper | ||
{ | ||
protected static $ezpClasses = null; | ||
|
||
public static function autoload( $className ) | ||
{ | ||
if ( !is_array( self::$ezpClasses ) ) | ||
{ | ||
self::initializeAutoload(); | ||
} | ||
if ( isset( self::$ezpClasses[$className] ) ) | ||
{ | ||
require( self::$ezpClasses[$className] ); | ||
} | ||
} | ||
|
||
protected static function initializeAutoload() | ||
{ | ||
$autoloadOptions = new ezpAutoloadGeneratorOptions(); | ||
|
||
$autoloadOptions->basePath = 'extension/ezdbintegrity'; | ||
|
||
$autoloadOptions->searchKernelFiles = false; | ||
$autoloadOptions->searchKernelOverride = false; | ||
$autoloadOptions->searchExtensionFiles = true; | ||
$autoloadOptions->searchTestFiles = false; | ||
$autoloadOptions->writeFiles = false; | ||
$autoloadOptions->displayProgress = false; | ||
|
||
$autoloadGenerator = new eZAutoloadGenerator( $autoloadOptions ); | ||
// We have to jump through hoops to get eZAutoloadGenerator give us back an array | ||
$autoloadGenerator->setOutputCallback( array( 'ezdbiAutoloadHelper', 'autoloadCallback' ) ); | ||
|
||
try | ||
{ | ||
$autoloadGenerator->buildAutoloadArrays(); | ||
$autoloadGenerator->printAutoloadArray(); | ||
} | ||
catch ( Exception $e ) | ||
{ | ||
echo $e->getMessage() . "\n"; | ||
} | ||
} | ||
|
||
/** | ||
* Used as callback for eZAutoloadGenerator | ||
*/ | ||
public static function autoloadCallback( $php, $label ) | ||
{ | ||
// callback is called many times with info messages, only use the good one | ||
if ( strpos( $php, '<?php' ) !== 0 ) | ||
{ | ||
return; | ||
} | ||
$php = str_replace( array( '<?php', '?>', ), '', $php ); | ||
self::$ezpClasses = eval( $php ); | ||
// fix path to be proper relative to eZ root | ||
foreach ( self::$ezpClasses as $key => $val ) | ||
{ | ||
self::$ezpClasses[$key] = 'extension/ezdbintegrity/' . $val; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters