public static function forge($path) { // Prepare $excludes = array('AbstractAdapter.php', 'AdapterInterface.php'); // Browse adapters foreach (lessdir(__DIR__ . '/Adapter') as $file) { if (in_array($file, $excludes)) { continue; } $class = 'Imagix\\Adapter\\' . pathinfo($file, PATHINFO_FILENAME); if ($class::supports($path)) { return new Image(new $class($path)); } } // No adapter found throw new Exception("'{$path}' image file is not supported"); }
public function unpublish($path) { $path = $this->_formatPath($path); if (is_dir($path)) { foreach (lessdir($path) as $file) { $this->unpublish($path . '/' . $file); } } else { $this->__lock->deny($path); } return $this; }
function rrmdir($path) { if (is_dir($path)) { foreach (lessdir($path) as $file) { if (is_dir("{$path}/{$file}")) { rrmdir("{$path}/{$file}"); } else { unlink("{$path}/{$file}"); } } rmdir($path); } }