get_theme_object is only used once, move it closer to where it's used
This commit is contained in:
parent
171a4b7c85
commit
88ee6ea148
@ -89,7 +89,24 @@ abstract class Extension {
|
|||||||
/** @private */
|
/** @private */
|
||||||
public function i_am(Extension $child) {
|
public function i_am(Extension $child) {
|
||||||
$this->_child = $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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -344,7 +344,6 @@ function make_http(/*string*/ $link) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a form tag with relevant auth token and stuff
|
* Make a form tag with relevant auth token and stuff
|
||||||
* (Added optional Form ID field for helping jquery.)
|
|
||||||
*
|
*
|
||||||
* @retval string
|
* @retval string
|
||||||
*/
|
*/
|
||||||
@ -507,23 +506,6 @@ function _count_execs($db, $sql, $inputarray) {
|
|||||||
$null = null; return $null;
|
$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
|
* Compare two Block objects, used to sort them before being displayed
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user