Skip to content

Instantly share code, notes, and snippets.

@fprochazka
Created August 11, 2010 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fprochazka/519136 to your computer and use it in GitHub Desktop.
Save fprochazka/519136 to your computer and use it in GitHub Desktop.
<?php
private function getExtension($name)
{
if( !isset($this->extensions[$name]) ){
$classes = array_keys($this->getRobotLoader()->indexedClasses);
foreach( $classes AS $item ){ //echo "<hr>"; _dump($item);
if( $match = String::match($item, '~^kdyby\\\\(?P<type>modifications|addons)\\\\(?P<name>[^\\\\]+)\\\\loader$~i') ){
$extension = array('name' => $match['name']);
switch($match['type']){
case 'addons':
$extension['type'] = self::ADDON;
$extension['loader'] = $this->formatAddonLoader($extension['name']);
break;
case 'modifications':
$extension['type'] = self::MODIFICATION;
$extension['loader'] = $this->formatModificationLoader($extension['name']);
break;
default:
continue;
}
$this->extensions[$extension['name']] = (object)$extension;
}
}
_dump($this->extensions); die();
if( !isset($this->extensions[$name]) ){
throw new ExtensionException("Extension with key '$name' was not found.");
}
}
return $this->extensions[$name];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment