]> git.mxchange.org Git - friendica.git/blob - view/theme/cleanzero/config.php
Merge remote branch 'upstream/master'
[friendica.git] / view / theme / cleanzero / 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         $resize = get_pconfig(local_user(), 'cleanzero', 'resize' );
13         $color = get_pconfig(local_user(), 'cleanzero', 'color' );
14        $font_size = get_pconfig(local_user(), 'cleanzero', 'font_size' );
15         
16         return cleanzero_form($a,$color,$font_size,$resize);
17 }
18
19 function theme_post(&$a){
20         if(! local_user())
21                 return;
22         
23         if (isset($_POST['cleanzero-settings-submit'])){
24                 set_pconfig(local_user(), 'cleanzero', 'resize', $_POST['cleanzero_resize']);   
25                 set_pconfig(local_user(), 'cleanzero', 'color', $_POST['cleanzero_color']);
26                 set_pconfig(local_user(), 'cleanzero', 'font_size', $_POST['cleanzero_font_size']);
27         }
28 }
29
30
31 function theme_admin(&$a){
32         $resize = get_config('cleanzero', 'resize' );
33         $color = get_config('cleanzero', 'color' );
34         $font_size = get_config('cleanzero', 'font_size' );
35         
36         return cleanzero_form($a,$color,$font_size,$resize);
37 }
38
39 function theme_admin_post(&$a){
40         if (isset($_POST['cleanzero-settings-submit'])){
41                 set_config('cleanzero', 'resize', $_POST['cleanzero_resize']);
42                 set_config('cleanzero', 'color', $_POST['cleanzero_color']);
43                 set_config('cleanzero', 'font_size', $_POST['cleanzero_font_size']);
44         }
45 }
46
47
48 function cleanzero_form(&$a, $color,$font_size,$resize){
49         $colors = array(
50                 "cleanzero"=>"cleanzero", 
51                 "cleanzero-green"=>"green",
52                 "cleanzero-purple"=>"purple"
53         );
54         $font_sizes = array(
55                 '12'=>'12',
56                 "---"=>"---",
57                 "16"=>"16",             
58                 "14"=>"14",
59                 '10'=>'10',
60                 );
61         $resizes = array(
62                 "0"=>"0 (no resizing)",
63                 "600"=>"1 (600px)",
64                 "300"=>"2 (300px)",
65                 "250"=>"3 (250px)",
66                 "150"=>"4 (150px)",
67                );
68         
69         $t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
70         $o .= replace_macros($t, array(
71                 '$submit' => t('Submit'),
72                 '$baseurl' => $a->get_baseurl(),
73                 '$title' => t("Theme settings"),
74                 '$resize' => array('cleanzero_resize',t ('Set resize level for images in posts and comments (width and height)'),$resize,'',$resizes),
75                 '$font_size' => array('cleanzero_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
76                 '$color' => array('cleanzero_color', t('Color scheme'), $color, '', $colors),
77         ));
78         return $o;
79 }