get_theme_object is only used once, move it closer to where it's used

This commit is contained in:
Shish
2012-03-05 14:21:41 +00:00
parent 171a4b7c85
commit 88ee6ea148
2 changed files with 18 additions and 19 deletions

View File

@@ -89,7 +89,24 @@ abstract class Extension {
/** @private */
public function i_am(Extension $child) {
$this->_child = $child;
if(is_null($this->theme)) $this->theme = get_theme_object($child, false);
if(is_null($this->theme)) $this->theme = $this->get_theme_object($child, false);
}
/**
* Find the theme object for a given extension
*/
private function get_theme_object(Extension $class, $fatal=true) {
$base = get_class($class);
if(class_exists('Custom'.$base.'Theme')) {
$class = 'Custom'.$base.'Theme';
return new $class();
}
elseif ($fatal || class_exists($base.'Theme')) {
$class = $base.'Theme';
return new $class();
} else {
return false;
}
}
/**