move more theme related functionality into the theme class (addresses #46)
This commit is contained in:
parent
fcea03a800
commit
ded7232146
3 changed files with 43 additions and 24 deletions
|
@ -28,6 +28,8 @@
|
|||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require('includes/template.class.php');
|
||||
|
||||
/**
|
||||
* Theme class.
|
||||
*/
|
||||
|
@ -52,6 +54,9 @@ class Theme {
|
|||
*/
|
||||
var $thumbsize;
|
||||
|
||||
var $name;
|
||||
var $template;
|
||||
|
||||
/**
|
||||
* Constructor for themes. Expects a theme name and initializes the
|
||||
* internal state of the instance from the 'theme.ini' file in the
|
||||
|
@ -61,10 +66,25 @@ class Theme {
|
|||
function __construct($name) {
|
||||
$themeconfig = parse_ini_file(
|
||||
realpath(implode(DIRECTORY_SEPARATOR,
|
||||
array('themes', $name, 'theme.ini'))));
|
||||
array('themes', $name, 'theme.ini'))));
|
||||
$this->name = $name;
|
||||
$this->themetype = $themeconfig['themetype'];
|
||||
$this->previewsize = intval($themeconfig['previewsize']);
|
||||
$this->thumbsize = intval($themeconfig['thumbsize']);
|
||||
}
|
||||
|
||||
function getTemplate() {
|
||||
if (!$this->template) {
|
||||
$this->template = new Template();
|
||||
$this->template->assign('themepath',
|
||||
implode(DIRECTORY_SEPARATOR, array('themes', $this->name)));
|
||||
}
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
function display() {
|
||||
$this->template->display(implode(DIRECTORY_SEPARATOR,
|
||||
array('themes', $this->name, 'theme.php')));
|
||||
}
|
||||
}
|
||||
?>
|
Reference in a new issue