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