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