Bug fixes

This commit is contained in:
2011-04-22 00:26:07 +01:00
parent 177ed337b0
commit 75c6ff2ad8
4 changed files with 15 additions and 7 deletions

View File

@@ -8,6 +8,12 @@ class SihnonFramework_Exception_AlreadyInitialisted extends SihnonFramework_E
class SihnonFramework_Exception_NotImplemented extends SihnonFramework_Exception {};
class SihnonFramework_Exception_MissingDefinition extends SihnonFramework_Exception {};
class SihnonFramework_Exception_TemplateException extends SihnonFramework_Exception {};
class SihnonFramework_Exception_AbortEntirePage extends SihnonFramework_Exception_TemplateException {};
class SihnonFramework_Exception_Unauthorized extends SihnonFramework_Exception_TemplateException {};
class SihnonFramework_Exception_FileNotFound extends SihnonFramework_Exception_TemplateException {};
class SihnonFramework_Exception_InvalidParameters extends SihnonFramework_Exception_TemplateException {};
class SihnonFramework_Exception_DatabaseException extends SihnonFramework_Exception {};
class SihnonFramework_Exception_DatabaseConfigMissing extends SihnonFramework_Exception_DatabaseException {};
class SihnonFramework_Exception_DatabaseConnectFailed extends SihnonFramework_Exception_DatabaseException {};
@@ -24,6 +30,5 @@ class SihnonFramework_Exception_CacheObjectNotFound extends SihnonFramework_E
class SihnonFramework_Exception_InvalidPluginName extends SihnonFramework_Exception {};
class SihnonFramework_Exception_FileNotFound extends SihnonFramework_Exception {};
?>

View File

@@ -116,7 +116,10 @@ class SihnonFramework_Main {
if (preg_match("/^{$class['base']}_/", $classname)) {
// Special case: all related exceptions are grouped into a single file
if (preg_match("/^({$class['base']}_(?:.*?_)?)Exception/", $classname, $matches)) {
require_once($class['base_dir_prefix'] . preg_replace('/_/', '/', $matches[1]) . 'Exceptions.class.php');
$exceptions_filename = $class['base_dir_prefix'] . preg_replace('/_/', '/', $matches[1]) . 'Exceptions.class.php';
if (file_exists($exceptions_filename)) {
require_once($exceptions_filename);
}
return;
}
@@ -231,7 +234,7 @@ class SihnonFramework_Main {
return $var;
}
if (is_string($default) && preg_match('/^Sihnon(Framework)?_Exception/', $default) && class_exists($default) && is_subclass_of($default, SihnonFramework_Exception)) {
if (is_string($default) && preg_match('/^Sihnon(Framework)?_Exception/', $default) && class_exists($default) && is_subclass_of($default, 'SihnonFramework_Exception')) {
throw new $default();
}

View File

@@ -36,7 +36,7 @@ abstract class SihnonFramework_PluginFactory implements Sihnon_IPluginFactory {
$plugins = array();
if (! is_array($directories)) {
$directories = array(SihnonLib => $directories);
$directories = array(Sihnon_Lib => $directories);
}
foreach ($directories as $base_dir => $directory) {

View File

@@ -73,7 +73,7 @@ class SihnonFramework_RequestParser {
}
public function exists($key) {
return isset($this->vars[$key]);
return array_key_exists($key, $this->vars);
}
public function get($key, $default = null) {
@@ -81,7 +81,7 @@ class SihnonFramework_RequestParser {
return $this->vars[$key];
}
if (is_string($default) && preg_match('/^[a-zA-Z_]+_Exception/', $default) && class_exists($default) && is_subclass_of($default, SihnonFramework_Exception)) {
if (is_string($default) && preg_match('/^[a-zA-Z_]+_Exception/', $default) && class_exists($default) && is_subclass_of($default, 'SihnonFramework_Exception')) {
throw new $default();
}