forked from anchorcms/anchor-cms
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Based on issue anchorcms#58
- Loading branch information
Baylor Rae
committed
Feb 16, 2012
1 parent
30bbdc1
commit 89462f5
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php defined('IN_CMS') or die('No direct access allowed.'); | ||
|
||
/* | ||
An extension of the Config class | ||
designed to focus specifically on configuring themes | ||
*/ | ||
class ThemeConfig extends Config { | ||
|
||
/* | ||
has to be public so Config can read it | ||
*/ | ||
public static $items = array(); | ||
|
||
/* | ||
* Allows a default config file | ||
* to be created within the theme directory | ||
* | ||
* @author Baylor Rae' | ||
* @package AnchorCMS | ||
* @since 0.5 | ||
*/ | ||
public static function load() { | ||
$theme_config_file = Template::path() . 'config.php'; | ||
if( file_exists($theme_config_file) ) { | ||
static::$items = require $theme_config_file; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php defined('IN_CMS') or die('No direct access allowed.'); | ||
|
||
/* | ||
Functions for theme configuration | ||
*/ | ||
function set_theme_options(array $options) { | ||
|
||
foreach( $options as $option => $value ) | ||
ThemeConfig::set($option, $value); | ||
} | ||
|
||
function theme_option($option, $default_value = false) { | ||
return ThemeConfig::get($option, $default_value); | ||
} |