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