1
0
Fork 0

[frio] Fix typo schema -> scheme

This commit is contained in:
Hypolite Petovan 2018-04-24 20:26:14 -04:00
parent eb9b832c3a
commit 3bfa6facfc
12 changed files with 71 additions and 55 deletions

View file

@ -37,11 +37,11 @@ Don't blame me too much for ugly code and hacks. Fix it ;-)
**Theme - Settings**
![Theme - Settings](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-settings.png)
**Red schema**
![Red schema](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-schema-red.png)
**Red scheme**
![Red scheme](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-scheme-red.png)
**Love Music schema**
![Love Music schema](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-schema-love-music.png)
**Love Music scheme**
![Love Music scheme](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-scheme-love-music.png)
**frio on mobile**

View file

@ -15,7 +15,7 @@ function theme_post(App $a)
}
if (isset($_POST['frio-settings-submit'])) {
PConfig::set(local_user(), 'frio', 'schema', $_POST['frio_schema']);
PConfig::set(local_user(), 'frio', 'scheme', $_POST['frio_scheme']);
PConfig::set(local_user(), 'frio', 'nav_bg', $_POST['frio_nav_bg']);
PConfig::set(local_user(), 'frio', 'nav_icon_color', $_POST['frio_nav_icon_color']);
PConfig::set(local_user(), 'frio', 'link_color', $_POST['frio_link_color']);
@ -34,7 +34,7 @@ function theme_admin_post(App $a)
}
if (isset($_POST['frio-settings-submit'])) {
Config::set('frio', 'schema', $_POST['frio_schema']);
Config::set('frio', 'scheme', $_POST['frio_scheme']);
Config::set('frio', 'nav_bg', $_POST['frio_nav_bg']);
Config::set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color']);
Config::set('frio', 'link_color', $_POST['frio_link_color']);
@ -55,7 +55,7 @@ function theme_content(App $a)
}
$arr = [];
$arr['schema'] = PConfig::get(local_user(), 'frio', 'schema');
$arr['scheme'] = PConfig::get(local_user(), 'frio', 'scheme');
$arr['nav_bg'] = PConfig::get(local_user(), 'frio', 'nav_bg');
$arr['nav_icon_color'] = PConfig::get(local_user(), 'frio', 'nav_icon_color');
$arr['link_color'] = PConfig::get(local_user(), 'frio', 'link_color');
@ -74,7 +74,7 @@ function theme_admin(App $a)
}
$arr = [];
$arr['schema'] = Config::get('frio', 'schema');
$arr['scheme'] = Config::get('frio', 'scheme');
$arr['nav_bg'] = Config::get('frio', 'nav_bg');
$arr['nav_icon_color'] = Config::get('frio', 'nav_icon_color');
$arr['link_color'] = Config::get('frio', 'link_color');
@ -90,9 +90,9 @@ function theme_admin(App $a)
function frio_form($arr)
{
require_once 'view/theme/frio/php/schema.php';
require_once 'view/theme/frio/php/scheme.php';
$scheme_info = get_schema_info($arr['schema']);
$scheme_info = get_scheme_info($arr['scheme']);
$disable = $scheme_info['overwrites'];
if (!is_array($disable)) {
$disable = [];
@ -100,7 +100,7 @@ function frio_form($arr)
$scheme_choices = [];
$scheme_choices['---'] = L10n::t('Default');
$files = glob('view/theme/frio/schema/*.php');
$files = glob('view/theme/frio/scheme/*.php');
if ($files) {
foreach ($files as $file) {
$f = basename($file, '.php');
@ -118,7 +118,7 @@ function frio_form($arr)
'$submit' => L10n::t('Submit'),
'$baseurl' => System::baseUrl(),
'$title' => L10n::t('Theme settings'),
'$schema' => ['frio_schema', L10n::t('Select scheme'), $arr['schema'], '', $scheme_choices],
'$scheme' => ['frio_scheme', L10n::t('Select scheme'), $arr['scheme'], '', $scheme_choices],
'$nav_bg' => array_key_exists('nav_bg', $disable) ? '' : ['frio_nav_bg', L10n::t('Navigation bar background color'), $arr['nav_bg'], '', false],
'$nav_icon_color' => array_key_exists('nav_icon_color', $disable) ? '' : ['frio_nav_icon_color', L10n::t('Navigation bar icon color '), $arr['nav_icon_color'], '', false],
'$link_color' => array_key_exists('link_color', $disable) ? '' : ['frio_link_color', L10n::t('Link color'), $arr['link_color'], '', false],

View file

Before

Width:  |  Height:  |  Size: 239 KiB

After

Width:  |  Height:  |  Size: 239 KiB

View file

Before

Width:  |  Height:  |  Size: 750 KiB

After

Width:  |  Height:  |  Size: 750 KiB

View file

@ -43,10 +43,10 @@ if (!isset($minimal)) {
if (is_null($uid)) {
$uid = Profile::getThemeUid();
}
$schema = PConfig::get($uid, 'frio', 'schema');
if (($schema) && ($schema != '---')) {
if (file_exists('view/theme/frio/schema/' . $schema . '.php')) {
$schemefile = 'view/theme/frio/schema/' . $schema . '.php';
$scheme = PConfig::get($uid, 'frio', 'scheme');
if (($scheme) && ($scheme != '---')) {
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
$schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
require_once $schemefile;
}
} else {

View file

@ -1,41 +1,41 @@
<?php
/**
* @brief: Get info header of the shema
* @brief: Get info header of the scheme
*
* This function parses the header of the shemename.php file for inormations like
* This function parses the header of the schemename.php file for informations like
* Author, Description and Overwrites. Most of the code comes from the Addon::getInfo()
* function. We use this to get the variables which get overwritten through the shema.
* function. We use this to get the variables which get overwritten through the scheme.
* All color variables which get overwritten through the theme have to be
* listed (comma seperated) in the shema header under Overwrites:
* This seemst not to be the best solution. We need to investigate further.
* listed (comma separated) in the scheme header under Overwrites:
* This seems not to be the best solution. We need to investigate further.
*
* @param string $schema Name of the shema
* @param string $scheme Name of the scheme
* @return array With theme information
* 'author' => Author Name
* 'description' => Schema description
* 'version' => Schema version
* 'description' => Scheme description
* 'version' => Scheme version
* 'overwrites' => Variables which overwriting custom settings
*/
use Friendica\Core\PConfig;
function get_schema_info($schema)
function get_scheme_info($scheme)
{
$theme = current_theme();
$themepath = 'view/theme/' . $theme . '/';
$schema = PConfig::get(local_user(), 'frio', 'schema');
$scheme = PConfig::get(local_user(), 'frio', 'scheme');
$info = [
'name' => $schema,
'name' => $scheme,
'description' => '',
'author' => [],
'version' => '',
'overwrites' => []
];
if (!is_file($themepath . 'schema/' . $schema . '.php')) return $info;
if (!is_file($themepath . 'scheme/' . $scheme . '.php')) return $info;
$f = file_get_contents($themepath . 'schema/' . $schema . '.php');
$f = file_get_contents($themepath . 'scheme/' . $scheme . '.php');
$r = preg_match('|/\*.*\*/|msU', $f, $m);

View file

@ -0,0 +1,16 @@
<?php
/*
* Name: Blue
* Author: Rabuzarus
*
* List here all variables which will get overwritten through this scheme
* Overwrites: nav_bg, nav_icon_color, link_color, background_color, login_bg_color, contentbg_transp
*/
$nav_bg = "#708fa0";
$nav_icon_color = "#fff";
$link_color = "#6fdbe8";
$background_color = "#ededed";
$login_bg_color = "#ededed";
$contentbg_transp = 100;

View file

@ -1,13 +1,13 @@
<?php
/* Licence: AGP
* Author: rabuzarus
* Overwrites: nav_bg, nav_icon_color, link_color, bgcolor, contentbg_transp, background_image, bg_image_option, link_hover_color
* Overwrites: nav_bg, nav_icon_color, link_color, background_color, contentbg_transp, background_image, bg_image_option, link_hover_color
*/
$nav_bg = "#000";
$nav_icon_color = "#e355e0";
$link_color = "#e355e0";
$bgcolor = "#fff";
$background_color = "#fff";
$contentbg_transp = 100;
$background_image = "img/bg_circle.png";
$bg_image_option = "repeat";

View file

@ -3,13 +3,13 @@
* Name: Red
* Author: Rabuzarus
*
* List here all variables which will get overwritten through this schema
* Overwrites: nav_bg, nav_icon_color, link_color, bgcolor, contentbg_transp
* List here all variables which will get overwritten through this scheme
* Overwrites: nav_bg, nav_icon_color, link_color, background_color, contentbg_transp
*/
$nav_bg = "#870000";
$nav_icon_color = "#f5f5f5";
$link_color = "#b50404";
$bgcolor = "#ededed";
$background_color = "#ededed";
$contentbg_transp = 95;

View file

@ -19,7 +19,7 @@ if ($a->module !== 'install') {
PConfig::load($uid, 'frio');
// Load the profile owners pconfig.
$schema = PConfig::get($uid, 'frio', 'schema');
$scheme = PConfig::get($uid, 'frio', 'scheme');
$nav_bg = PConfig::get($uid, 'frio', 'nav_bg');
$nav_icon_color = PConfig::get($uid, 'frio', 'nav_icon_color');
$link_color = PConfig::get($uid, 'frio', 'link_color');
@ -38,7 +38,7 @@ if ($a->module !== 'install') {
Config::load('frio');
// Load frios system config.
$schema = Config::get('frio', 'schema');
$scheme = Config::get('frio', 'scheme');
$nav_bg = Config::get('frio', 'nav_bg');
$nav_icon_color = Config::get('frio', 'nav_icon_color');
$link_color = Config::get('frio', 'link_color');
@ -59,38 +59,38 @@ if ($a->module !== 'install') {
}
// Now load the scheme. If a value is changed above, we'll keep the settings
// If not, we'll keep those defined by the schema
// Setting $schema to '' wasn't working for some reason, so we'll check it's
// If not, we'll keep those defined by the scheme
// Setting $scheme to '' wasn't working for some reason, so we'll check it's
// not --- like the mobile theme does instead.
// Allow layouts to over-ride the schema.
if (x($_REQUEST, 'schema')) {
$schema = $_REQUEST['schema'];
// Allow layouts to over-ride the scheme.
if (x($_REQUEST, 'scheme')) {
$scheme = $_REQUEST['scheme'];
}
// Sanitize the data.
$schema = !empty($schema) ? basename($schema) : '';
$scheme = !empty($scheme) ? basename($scheme) : '';
if (($schema) && ($schema != '---')) {
if (file_exists('view/theme/frio/schema/' . $schema . '.php')) {
$schemefile = 'view/theme/frio/schema/' . $schema . '.php';
if (($scheme) && ($scheme != '---')) {
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
$schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
require_once $schemefile;
}
if (file_exists('view/theme/frio/schema/' . $schema . '.css')) {
$schemecssfile = 'view/theme/frio/schema/' . $schema . '.css';
if (file_exists('view/theme/frio/scheme/' . $scheme . '.css')) {
$schemecssfile = 'view/theme/frio/scheme/' . $scheme . '.css';
}
}
// If we haven't got a schema, load the default. We shouldn't touch this - we
// If we haven't got a scheme, load the default. We shouldn't touch this - we
// should leave it for admins to define for themselves.
// default.php and default.css MUST be symlinks to existing schema files.
if (!$schema) {
if (file_exists('view/theme/frio/schema/default.php')) {
$schemefile = 'view/theme/frio/schema/default.php';
// default.php and default.css MUST be symlinks to existing scheme files.
if (!$scheme) {
if (file_exists('view/theme/frio/scheme/default.php')) {
$schemefile = 'view/theme/frio/scheme/default.php';
require_once $schemefile;
}
if (file_exists('view/theme/frio/schema/default.css')) {
$schemecssfile = 'view/theme/frio/schema/default.css';
if (file_exists('view/theme/frio/scheme/default.css')) {
$schemecssfile = 'view/theme/frio/scheme/default.css';
}
}

View file

@ -4,7 +4,7 @@
<script src="{{$baseurl}}/view/theme/frio/frameworks/jRange/jquery.range.js"></script>
<script type="text/javascript" src="{{$baseurl}}/view/js/ajaxupload.js" ></script>
{{include file="field_select.tpl" field=$schema}}
{{include file="field_select.tpl" field=$scheme}}
{{if $nav_bg}}{{include file="field_colorinput.tpl" field=$nav_bg}}{{/if}}
{{if $nav_icon_color}}{{include file="field_colorinput.tpl" field=$nav_icon_color}}{{/if}}