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