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;
}
}
/**

View file

@ -344,7 +344,6 @@ function make_http(/*string*/ $link) {
/**
* Make a form tag with relevant auth token and stuff
* (Added optional Form ID field for helping jquery.)
*
* @retval string
*/
@ -507,23 +506,6 @@ function _count_execs($db, $sql, $inputarray) {
$null = null; return $null;
}
/**
* Find the theme object for a given extension
*/
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;
}
}
/**
* Compare two Block objects, used to sort them before being displayed
*