]> git.mxchange.org Git - friendica.git/blob - view/theme/diabook/config.php
Merge branch 'master' of git://github.com/friendica/friendica
[friendica.git] / view / theme / diabook / config.php
1 <?php
2 /**
3  * Theme settings
4  */
5
6
7
8 function theme_content(&$a){
9         if(!local_user())
10                 return;         
11         
12         $font_size = get_pconfig(local_user(), 'diabook', 'font_size' );
13         $line_height = get_pconfig(local_user(), 'diabook', 'line_height' );
14         $resolution = get_pconfig(local_user(), 'diabook', 'resolution' );
15         $color = get_pconfig(local_user(), 'diabook', 'color' );
16         
17         return diabook_form($a,$font_size, $line_height, $resolution, $color);
18 }
19
20 function theme_post(&$a){
21         if(! local_user())
22                 return;
23         
24         if (isset($_POST['diabook-settings-submit'])){
25                 set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
26                 set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
27                 set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
28                 set_pconfig(local_user(), 'diabook', 'color', $_POST['diabook_color']); 
29         }
30 }
31
32
33 function theme_admin(&$a){
34         $font_size = get_config('diabook', 'font_size' );
35         $line_height = get_config('diabook', 'line_height' );
36         $resolution = get_config('diabook', 'resolution' );
37         $color = get_config('diabook', 'color' );       
38         
39         return diabook_form($a,$font_size, $line_height, $resolution, $color);
40 }
41
42 function theme_admin_post(&$a){
43         if (isset($_POST['diabook-settings-submit'])){
44                 set_config('diabook', 'font_size', $_POST['diabook_font_size']);
45                 set_config('diabook', 'line_height', $_POST['diabook_line_height']);
46                 set_config('diabook', 'resolution', $_POST['diabook_resolution']);
47                 set_config('diabook', 'color', $_POST['diabook_color']);
48         }
49 }
50
51
52 function diabook_form(&$a, $font_size, $line_height, $resolution, $color){
53         $line_heights = array(
54                 "1.3"=>"1.3",
55                 "---"=>"---",
56                 "1.6"=>"1.6",                           
57                 "1.5"=>"1.5",           
58                 "1.4"=>"1.4",
59                 "1.2"=>"1.2",
60                 "1.1"=>"1.1",
61         );
62         
63         $font_sizes = array(
64                 '14'=>'14',
65                 "---"=>"---",
66                 "16"=>"16",             
67                 "15"=>"15",
68                 '13.5'=>'13.5',
69                 '13'=>'13',             
70                 '12.5'=>'12.5',
71                 '12'=>'12',
72                 );
73         $resolutions = array(
74                 'normal'=>'normal',
75                 'wide'=>'wide',         
76                 );
77         $colors = array(
78                 'diabook'=>'diabook',
79                 'aerith'=>'aerith',             
80                 'blue'=>'blue',         
81                 'green'=>'green',
82                 'pink'=>'pink', 
83                 'red'=>'red',
84                 'dark'=>'dark',                                         
85                 );
86         
87         
88         
89         $t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
90         $o .= replace_macros($t, array(
91                 '$submit' => t('Submit'),
92                 '$baseurl' => $a->get_baseurl(),
93                 '$title' => t("Theme settings"),
94                 '$font_size' => array('diabook_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
95                 '$line_height' => array('diabook_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights),
96                 '$resolution' => array('diabook_resolution', t('Set resolution for middle column'), $resolution, '', $resolutions),
97                 '$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors), 
98         ));
99         return $o;
100 }