turn theme configuration into a class object
This commit is contained in:
parent
e5c077243c
commit
b3efdf2109
@ -276,9 +276,9 @@ class Settings extends \Zotlabs\Web\Controller {
|
||||
$newschema = $_POST['schema'];
|
||||
if($newschema === '---')
|
||||
$newschema = '';
|
||||
}
|
||||
|
||||
theme_post($a);
|
||||
$theme_config->post();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1042,10 +1042,10 @@ class Settings extends \Zotlabs\Web\Controller {
|
||||
require_once($themeconfigfile);
|
||||
if(class_exists(ucfirst($theme) . 'Config')) {
|
||||
$clsname = ucfirst($theme) . 'Config';
|
||||
$theme_config = new $clsname();
|
||||
$schemas = $theme_config->get_schemas();
|
||||
$thm_config = new $clsname();
|
||||
$schemas = $thm_config->get_schemas();
|
||||
$theme_config = $thm_config->get();
|
||||
}
|
||||
$theme_config = theme_content($a);
|
||||
}
|
||||
|
||||
// logger('schemas: ' . print_r($schemas,true));
|
||||
|
@ -24,9 +24,8 @@ class Theme_info extends \Zotlabs\Web\Controller {
|
||||
$schemalist[] = [ 'key' => $k, 'val' => $v ];
|
||||
}
|
||||
}
|
||||
|
||||
$theme_config = $th_config->get();
|
||||
}
|
||||
$theme_config = theme_content($a);
|
||||
}
|
||||
$info = get_theme_info($theme);
|
||||
if($info) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class RedbasicConfig {
|
||||
|
||||
function get_schemas() {
|
||||
$scheme_choices = array();
|
||||
$scheme_choices["---"] = t("Focus (Hubzilla default)");
|
||||
@ -16,15 +17,13 @@ class RedbasicConfig {
|
||||
}
|
||||
return $scheme_choices;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function theme_content(&$a) {
|
||||
if(!local_channel()) { return;}
|
||||
function get() {
|
||||
if(!local_channel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$arr = array();
|
||||
|
||||
// $arr['schema'] = get_pconfig(local_channel(),'redbasic', 'schema' );
|
||||
$arr['narrow_navbar'] = get_pconfig(local_channel(),'redbasic', 'narrow_navbar' );
|
||||
$arr['nav_bg'] = get_pconfig(local_channel(),'redbasic', 'nav_bg' );
|
||||
$arr['nav_gradient_top'] = get_pconfig(local_channel(),'redbasic', 'nav_gradient_top' );
|
||||
@ -54,14 +53,15 @@ function theme_content(&$a) {
|
||||
$arr['nav_min_opacity']=get_pconfig(local_channel(),"redbasic","nav_min_opacity");
|
||||
$arr['top_photo']=get_pconfig(local_channel(),"redbasic","top_photo");
|
||||
$arr['reply_photo']=get_pconfig(local_channel(),"redbasic","reply_photo");
|
||||
return redbasic_form($a, $arr);
|
||||
}
|
||||
return $this->form($arr);
|
||||
}
|
||||
|
||||
function theme_post(&$a) {
|
||||
if(!local_channel()) { return;}
|
||||
function post() {
|
||||
if(!local_channel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['redbasic-settings-submit'])) {
|
||||
// set_pconfig(local_channel(), 'redbasic', 'schema', $_POST['redbasic_schema']);
|
||||
set_pconfig(local_channel(), 'redbasic', 'narrow_navbar', $_POST['redbasic_narrow_navbar']);
|
||||
set_pconfig(local_channel(), 'redbasic', 'nav_bg', $_POST['redbasic_nav_bg']);
|
||||
set_pconfig(local_channel(), 'redbasic', 'nav_gradient_top', $_POST['redbasic_nav_gradient_top']);
|
||||
@ -92,17 +92,15 @@ function theme_post(&$a) {
|
||||
set_pconfig(local_channel(), 'redbasic', 'top_photo', $_POST['redbasic_top_photo']);
|
||||
set_pconfig(local_channel(), 'redbasic', 'reply_photo', $_POST['redbasic_reply_photo']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function redbasic_form(&$a, $arr) {
|
||||
function form($arr) {
|
||||
|
||||
if(feature_enabled(local_channel(),'advanced_theming'))
|
||||
$expert = 1;
|
||||
|
||||
$t = get_markup_template('theme_settings.tpl');
|
||||
$o .= replace_macros($t, array(
|
||||
|
||||
$o .= replace_macros(get_markup_template('theme_settings.tpl'), array(
|
||||
'$submit' => t('Submit'),
|
||||
'$baseurl' => z_root(),
|
||||
'$theme' => App::$channel['channel_theme'],
|
||||
@ -140,4 +138,12 @@ function redbasic_form(&$a, $arr) {
|
||||
));
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user