]> git.mxchange.org Git - friendica.git/blob - view/theme/diabook/config.php
diabook: theme-settings: add a wide-option
[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         
16         return diabook_form($a,$font_size, $line_height, $resolution);
17 }
18
19 function theme_post(&$a){
20         if(! local_user())
21                 return;
22         
23         if (isset($_POST['diabook-settings-submit'])){
24                 set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
25                 set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
26                 set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
27         }
28 }
29
30
31 function theme_admin(&$a){
32         $font_size = get_config('diabook', 'font_size' );
33         $line_height = get_config('diabook', 'line_height' );
34         $resolution = get_config('diabook', 'resolution' );
35         
36         return diabook_form($a,$font_size, $line_height, $resolution);
37 }
38
39 function theme_admin_post(&$a){
40         if (isset($_POST['diabook-settings-submit'])){
41                 set_config('diabook', 'font_size', $_POST['diabook_font_size']);
42                 set_config('diabook', 'line_height', $_POST['diabook_line_height']);
43                 set_config('diabook', 'resolution', $_POST['diabook_resolution']);
44         }
45 }
46
47
48 function diabook_form(&$a, $font_size, $line_height, $resolution){
49         $line_heights = array(
50                 "1.3"=>"1.3",
51                 "---"=>"---",
52                 "1.5"=>"1.5",           
53                 "1.4"=>"1.4",
54                 "1.2"=>"1.2",
55                 "1.1"=>"1.1",
56         );
57         
58         $font_sizes = array(
59                 '13'=>'13',
60                 "---"=>"---",
61                 "15"=>"15",
62                 '14'=>'14',
63                 '13.5'=>'13.5',         
64                 '12.5'=>'12.5',
65                 '12'=>'12',
66                 );
67         $resolutions = array(
68                 'normal'=>'normal',
69                 'wide'=>'wide',         
70                 );
71         
72         
73         
74         $t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
75         $o .= replace_macros($t, array(
76                 '$submit' => t('Submit'),
77                 '$baseurl' => $a->get_baseurl(),
78                 '$title' => t("Theme settings"),
79                 '$font_size' => array('diabook_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
80                 '$line_height' => array('diabook_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights),
81                 '$resolution' => array('diabook_resolution', t('Set resolution for middle column'), $resolution, '', $resolutions),
82         ));
83         return $o;
84 }