base theme added
This commit is contained in:
128
plusfuture/php/config.php
Normal file
128
plusfuture/php/config.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace Zotlabs\Theme;
|
||||
|
||||
class plusfutureConfig {
|
||||
|
||||
function get_schemas() {
|
||||
$files = glob('view/theme/plusfuture/schema/*.php');
|
||||
|
||||
$scheme_choices = [];
|
||||
|
||||
if($files) {
|
||||
|
||||
if(in_array('view/theme/plusfuture/schema/default.php', $files)) {
|
||||
$scheme_choices['---'] = t('Default');
|
||||
$scheme_choices['focus'] = t('Focus (Hubzilla default)');
|
||||
}
|
||||
else {
|
||||
$scheme_choices['---'] = t('Focus (Hubzilla default)');
|
||||
}
|
||||
|
||||
foreach($files as $file) {
|
||||
$f = basename($file, ".php");
|
||||
if($f != 'default') {
|
||||
$scheme_name = $f;
|
||||
$scheme_choices[$f] = $scheme_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $scheme_choices;
|
||||
}
|
||||
|
||||
function get() {
|
||||
if(! local_channel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$arr = array();
|
||||
$arr['narrow_navbar'] = get_pconfig(local_channel(),'plusfuture', 'narrow_navbar' );
|
||||
$arr['nav_bg'] = get_pconfig(local_channel(),'plusfuture', 'nav_bg' );
|
||||
$arr['nav_icon_colour'] = get_pconfig(local_channel(),'plusfuture', 'nav_icon_colour' );
|
||||
$arr['nav_active_icon_colour'] = get_pconfig(local_channel(),'plusfuture', 'nav_active_icon_colour' );
|
||||
$arr['link_colour'] = get_pconfig(local_channel(),'plusfuture', 'link_colour' );
|
||||
$arr['banner_colour'] = get_pconfig(local_channel(),'plusfuture', 'banner_colour' );
|
||||
$arr['bgcolour'] = get_pconfig(local_channel(),'plusfuture', 'background_colour' );
|
||||
$arr['background_image'] = get_pconfig(local_channel(),'plusfuture', 'background_image' );
|
||||
$arr['item_colour'] = get_pconfig(local_channel(),'plusfuture', 'item_colour' );
|
||||
$arr['comment_item_colour'] = get_pconfig(local_channel(),'plusfuture', 'comment_item_colour' );
|
||||
$arr['font_size'] = get_pconfig(local_channel(),'plusfuture', 'font_size' );
|
||||
$arr['font_colour'] = get_pconfig(local_channel(),'plusfuture', 'font_colour' );
|
||||
$arr['radius'] = get_pconfig(local_channel(),'plusfuture', 'radius' );
|
||||
$arr['shadow'] = get_pconfig(local_channel(),'plusfuture', 'photo_shadow' );
|
||||
$arr['converse_width']=get_pconfig(local_channel(),"plusfuture","converse_width");
|
||||
$arr['top_photo']=get_pconfig(local_channel(),"plusfuture","top_photo");
|
||||
$arr['reply_photo']=get_pconfig(local_channel(),"plusfuture","reply_photo");
|
||||
$arr['advanced_theming'] = get_pconfig(local_channel(), 'plusfuture', 'advanced_theming');
|
||||
return $this->form($arr);
|
||||
}
|
||||
|
||||
function post() {
|
||||
if(!local_channel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['plusfuture-settings-submit'])) {
|
||||
set_pconfig(local_channel(), 'plusfuture', 'narrow_navbar', $_POST['plusfuture_narrow_navbar']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'nav_bg', $_POST['plusfuture_nav_bg']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'nav_icon_colour', $_POST['plusfuture_nav_icon_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'nav_active_icon_colour', $_POST['plusfuture_nav_active_icon_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'link_colour', $_POST['plusfuture_link_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'background_colour', $_POST['plusfuture_background_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'banner_colour', $_POST['plusfuture_banner_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'background_image', $_POST['plusfuture_background_image']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'item_colour', $_POST['plusfuture_item_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'comment_item_colour', $_POST['plusfuture_comment_item_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'font_size', $_POST['plusfuture_font_size']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'font_colour', $_POST['plusfuture_font_colour']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'radius', $_POST['plusfuture_radius']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'photo_shadow', $_POST['plusfuture_shadow']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'converse_width', $_POST['plusfuture_converse_width']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'top_photo', $_POST['plusfuture_top_photo']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'reply_photo', $_POST['plusfuture_reply_photo']);
|
||||
set_pconfig(local_channel(), 'plusfuture', 'advanced_theming', $_POST['plusfuture_advanced_theming']);
|
||||
}
|
||||
}
|
||||
|
||||
function form($arr) {
|
||||
|
||||
if(get_pconfig(local_channel(), 'plusfuture', 'advanced_theming'))
|
||||
$expert = 1;
|
||||
|
||||
$o .= replace_macros(get_markup_template('theme_settings.tpl'), array(
|
||||
'$submit' => t('Submit'),
|
||||
'$baseurl' => z_root(),
|
||||
'$theme' => \App::$channel['channel_theme'],
|
||||
'$expert' => $expert,
|
||||
'$title' => t("Theme settings"),
|
||||
'$narrow_navbar' => array('plusfuture_narrow_navbar',t('Narrow navbar'),$arr['narrow_navbar'], '', array(t('No'),t('Yes'))),
|
||||
'$nav_bg' => array('plusfuture_nav_bg', t('Navigation bar background color'), $arr['nav_bg']),
|
||||
'$nav_icon_colour' => array('plusfuture_nav_icon_colour', t('Navigation bar icon color '), $arr['nav_icon_colour']),
|
||||
'$nav_active_icon_colour' => array('plusfuture_nav_active_icon_colour', t('Navigation bar active icon color '), $arr['nav_active_icon_colour']),
|
||||
'$link_colour' => array('plusfuture_link_colour', t('Link color'), $arr['link_colour'], '', $link_colours),
|
||||
'$banner_colour' => array('plusfuture_banner_colour', t('Set font-color for banner'), $arr['banner_colour']),
|
||||
'$bgcolour' => array('plusfuture_background_colour', t('Set the background color'), $arr['bgcolour']),
|
||||
'$background_image' => array('plusfuture_background_image', t('Set the background image'), $arr['background_image']),
|
||||
'$item_colour' => array('plusfuture_item_colour', t('Set the background color of items'), $arr['item_colour']),
|
||||
'$comment_item_colour' => array('plusfuture_comment_item_colour', t('Set the background color of comments'), $arr['comment_item_colour']),
|
||||
'$font_size' => array('plusfuture_font_size', t('Set font-size for the entire application'), $arr['font_size'], t('Examples: 1rem, 100%, 16px')),
|
||||
'$font_colour' => array('plusfuture_font_colour', t('Set font-color for posts and comments'), $arr['font_colour']),
|
||||
'$radius' => array('plusfuture_radius', t('Set radius of corners'), $arr['radius'], t('Example: 4px')),
|
||||
'$shadow' => array('plusfuture_shadow', t('Set shadow depth of photos'), $arr['shadow']),
|
||||
'$converse_width' => array('plusfuture_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')),
|
||||
'$top_photo' => array('plusfuture_top_photo', t('Set size of conversation author photo'), $arr['top_photo']),
|
||||
'$reply_photo' => array('plusfuture_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']),
|
||||
'$advanced_theming' => ['plusfuture_advanced_theming', t('Show advanced settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]]
|
||||
));
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
163
plusfuture/php/style.php
Normal file
163
plusfuture/php/style.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
if(! App::$install) {
|
||||
|
||||
// Get the UID of the channel owner
|
||||
$uid = get_theme_uid();
|
||||
|
||||
if($uid) {
|
||||
load_pconfig($uid,'plusfuture');
|
||||
}
|
||||
|
||||
// Load the owners pconfig
|
||||
$nav_bg = get_pconfig($uid, 'plusfuture', 'nav_bg');
|
||||
$nav_icon_colour = get_pconfig($uid, 'plusfuture', 'nav_icon_colour');
|
||||
$nav_active_icon_colour = get_pconfig($uid, 'plusfuture', 'nav_active_icon_colour');
|
||||
$banner_colour = get_pconfig($uid,'plusfuture','banner_colour');
|
||||
$narrow_navbar = get_pconfig($uid,'plusfuture','narrow_navbar');
|
||||
$link_colour = get_pconfig($uid, 'plusfuture', 'link_colour');
|
||||
$schema = get_pconfig($uid,'plusfuture','schema');
|
||||
$bgcolour = get_pconfig($uid, 'plusfuture', 'background_colour');
|
||||
$background_image = get_pconfig($uid, 'plusfuture', 'background_image');
|
||||
$item_colour = get_pconfig($uid, 'plusfuture', 'item_colour');
|
||||
$comment_item_colour = get_pconfig($uid, 'plusfuture', 'comment_item_colour');
|
||||
$font_size = get_pconfig($uid, 'plusfuture', 'font_size');
|
||||
$font_colour = get_pconfig($uid, 'plusfuture', 'font_colour');
|
||||
$radius = get_pconfig($uid, 'plusfuture', 'radius');
|
||||
$shadow = get_pconfig($uid,'plusfuture','photo_shadow');
|
||||
$converse_width=get_pconfig($uid,'plusfuture','converse_width');
|
||||
$top_photo=get_pconfig($uid,'plusfuture','top_photo');
|
||||
$reply_photo=get_pconfig($uid,'plusfuture','reply_photo');
|
||||
}
|
||||
|
||||
// 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
|
||||
// not --- like the mobile theme does instead.
|
||||
|
||||
// Allow layouts to over-ride the schema
|
||||
|
||||
if($_REQUEST['schema']) {
|
||||
$schema = $_REQUEST['schema'];
|
||||
}
|
||||
|
||||
if (($schema) && ($schema != '---')) {
|
||||
|
||||
// Check it exists, because this setting gets distributed to clones
|
||||
if(file_exists('view/theme/plusfuture/schema/' . $schema . '.php')) {
|
||||
$schemefile = 'view/theme/plusfuture/schema/' . $schema . '.php';
|
||||
require_once ($schemefile);
|
||||
}
|
||||
|
||||
if(file_exists('view/theme/plusfuture/schema/' . $schema . '.css')) {
|
||||
$schemecss = file_get_contents('view/theme/plusfuture/schema/' . $schema . '.css');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Allow admins to set a default schema for the hub.
|
||||
// default.php and default.css MUST be symlinks to existing schema files in view/theme/plusfuture/schema
|
||||
if ((!$schema) || ($schema == '---')) {
|
||||
|
||||
if(file_exists('view/theme/plusfuture/schema/default.php')) {
|
||||
$schemefile = 'view/theme/plusfuture/schema/default.php';
|
||||
require_once ($schemefile);
|
||||
}
|
||||
|
||||
if(file_exists('view/theme/plusfuture/schema/default.css')) {
|
||||
$schemecss = file_get_contents('view/theme/plusfuture/schema/default.css');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Set some defaults - we have to do this after pulling owner settings, and we have to check for each setting
|
||||
//individually. If we don't, we'll have problems if a user has set one, but not all options.
|
||||
if (! $nav_bg)
|
||||
$nav_bg = '#343a40';
|
||||
if (! $nav_icon_colour)
|
||||
$nav_icon_colour = 'rgba(255, 255, 255, 0.5)';
|
||||
if (! $nav_active_icon_colour)
|
||||
$nav_active_icon_colour = 'rgba(255, 255, 255, 0.75)';
|
||||
if (! $link_colour)
|
||||
$link_colour = '#007bff';
|
||||
if (! $banner_colour)
|
||||
$banner_colour = '#fff';
|
||||
if (! $bgcolour)
|
||||
$bgcolour = 'rgb(254,254,254)';
|
||||
if (! $background_image)
|
||||
$background_image ='';
|
||||
if (! $item_colour)
|
||||
$item_colour = 'rgb(238,238,238)';
|
||||
if (! $comment_item_colour)
|
||||
$comment_item_colour = 'rgb(255,255,255)';
|
||||
if (! $item_opacity)
|
||||
$item_opacity = '1';
|
||||
if (! $font_size)
|
||||
$font_size = '0.875rem';
|
||||
if (! $font_colour)
|
||||
$font_colour = '#4d4d4d';
|
||||
if (! $radius)
|
||||
$radius = '0.25rem';
|
||||
if (! $shadow)
|
||||
$shadow = '0';
|
||||
if (! $converse_width)
|
||||
$converse_width = '790';
|
||||
if(! $top_photo)
|
||||
$top_photo = '2.3rem';
|
||||
if(! $reply_photo)
|
||||
$reply_photo = '2.3rem';
|
||||
|
||||
// Apply the settings
|
||||
if(file_exists('view/theme/plusfuture/css/style.css')) {
|
||||
|
||||
$x = file_get_contents('view/theme/plusfuture/css/style.css');
|
||||
|
||||
if($narrow_navbar && file_exists('view/theme/plusfuture/css/narrow_navbar.css')) {
|
||||
$x .= file_get_contents('view/theme/plusfuture/css/narrow_navbar.css');
|
||||
}
|
||||
|
||||
if($schemecss) {
|
||||
$x .= $schemecss;
|
||||
}
|
||||
|
||||
$aside_width = 288;
|
||||
|
||||
// left aside and right aside are 285px + converse width
|
||||
$main_width = (($aside_width * 2) + intval($converse_width));
|
||||
|
||||
// prevent main_width smaller than 768px
|
||||
$main_width = (($main_width < 768) ? 768 : $main_width);
|
||||
|
||||
$options = array (
|
||||
'$nav_bg' => $nav_bg,
|
||||
'$nav_icon_colour' => $nav_icon_colour,
|
||||
'$nav_active_icon_colour' => $nav_active_icon_colour,
|
||||
'$link_colour' => $link_colour,
|
||||
'$banner_colour' => $banner_colour,
|
||||
'$bgcolour' => $bgcolour,
|
||||
'$background_image' => $background_image,
|
||||
'$item_colour' => $item_colour,
|
||||
'$comment_item_colour' => $comment_item_colour,
|
||||
'$font_size' => $font_size,
|
||||
'$font_colour' => $font_colour,
|
||||
'$radius' => $radius,
|
||||
'$shadow' => $shadow,
|
||||
'$converse_width' => $converse_width,
|
||||
'$nav_float_min_opacity' => $nav_float_min_opacity,
|
||||
'$nav_percent_min_opacity' => $nav_percent_min_opacity,
|
||||
'$top_photo' => $top_photo,
|
||||
'$reply_photo' => $reply_photo,
|
||||
'$pmenu_top' => $pmenu_top,
|
||||
'$pmenu_reply' => $pmenu_reply,
|
||||
'$main_width' => $main_width,
|
||||
'$aside_width' => $aside_width
|
||||
);
|
||||
|
||||
echo str_replace(array_keys($options), array_values($options), $x);
|
||||
|
||||
}
|
||||
|
||||
// Set the schema to the default schema in derived themes. See the documentation for creating derived themes how to override this.
|
||||
|
||||
if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'plusfuture')
|
||||
set_pconfig(local_channel(), 'plusfuture', 'schema', '---');
|
||||
15
plusfuture/php/theme.php
Normal file
15
plusfuture/php/theme.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* * Name: plusfuture
|
||||
* * Description: Hubzilla to Google+ theme
|
||||
* * Version: 1.0
|
||||
* * MinVersion: 2.3.1
|
||||
* * MaxVersion: 6.0
|
||||
* * Author: harukin
|
||||
* * Maintainer: harukin
|
||||
*/
|
||||
|
||||
function plusfuture_init(&$a) {
|
||||
|
||||
}
|
||||
17
plusfuture/php/theme_init.php
Normal file
17
plusfuture/php/theme_init.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
head_add_css('/library/fork-awesome/css/fork-awesome.min.css');
|
||||
head_add_css('/vendor/twbs/bootstrap/dist/css/bootstrap.min.css');
|
||||
head_add_css('/library/bootstrap-tagsinput/bootstrap-tagsinput.css');
|
||||
head_add_css('/view/css/bootstrap-red.css');
|
||||
head_add_css('/library/datetimepicker/jquery.datetimepicker.css');
|
||||
head_add_css('/library/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css');
|
||||
require_once('view/php/theme_init.php');
|
||||
|
||||
head_add_js('/vendor/twbs/bootstrap/dist/js/bootstrap.bundle.min.js');
|
||||
head_add_js('/library/bootbox/bootbox.min.js');
|
||||
head_add_js('/library/bootstrap-tagsinput/bootstrap-tagsinput.js');
|
||||
head_add_js('/library/datetimepicker/jquery.datetimepicker.js');
|
||||
head_add_js('/library/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user