2012-04-13 15:34:21 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Theme settings
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function theme_content(&$a){
|
|
|
|
if(!local_user())
|
|
|
|
return;
|
|
|
|
|
|
|
|
$font_size = get_pconfig(local_user(), 'diabook', 'font_size' );
|
|
|
|
$line_height = get_pconfig(local_user(), 'diabook', 'line_height' );
|
2012-04-14 20:50:16 -04:00
|
|
|
$resolution = get_pconfig(local_user(), 'diabook', 'resolution' );
|
2012-04-19 19:44:20 -04:00
|
|
|
$color = get_pconfig(local_user(), 'diabook', 'color' );
|
2012-05-05 14:01:38 -04:00
|
|
|
$TSearchTerm = get_pconfig(local_user(), 'diabook', 'TSearchTerm' );
|
2012-05-06 20:24:43 -04:00
|
|
|
$ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' );
|
|
|
|
$ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' );
|
|
|
|
$ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' );
|
2012-04-13 15:34:21 -04:00
|
|
|
|
2012-05-06 20:24:43 -04:00
|
|
|
return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY);
|
2012-04-13 15:34:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function theme_post(&$a){
|
|
|
|
if(! local_user())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (isset($_POST['diabook-settings-submit'])){
|
|
|
|
set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
|
|
|
|
set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
|
2012-04-14 20:50:16 -04:00
|
|
|
set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
|
2012-04-19 19:44:20 -04:00
|
|
|
set_pconfig(local_user(), 'diabook', 'color', $_POST['diabook_color']);
|
2012-05-05 14:01:38 -04:00
|
|
|
set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
|
2012-05-06 20:24:43 -04:00
|
|
|
set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);
|
|
|
|
set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);
|
|
|
|
set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
|
2012-04-13 15:34:21 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function theme_admin(&$a){
|
|
|
|
$font_size = get_config('diabook', 'font_size' );
|
|
|
|
$line_height = get_config('diabook', 'line_height' );
|
2012-04-14 20:50:16 -04:00
|
|
|
$resolution = get_config('diabook', 'resolution' );
|
2012-04-19 19:44:20 -04:00
|
|
|
$color = get_config('diabook', 'color' );
|
2012-05-05 14:01:38 -04:00
|
|
|
$TSearchTerm = get_config('diabook', 'TSearchTerm' );
|
2012-05-06 20:24:43 -04:00
|
|
|
$ELZoom = get_config('diabook', 'ELZoom' );
|
|
|
|
$ELPosX = get_config('diabook', 'ELPosX' );
|
|
|
|
$ELPosY = get_config('diabook', 'ELPosY' );
|
2012-04-13 15:34:21 -04:00
|
|
|
|
2012-05-06 20:24:43 -04:00
|
|
|
return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY);
|
2012-04-13 15:34:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function theme_admin_post(&$a){
|
|
|
|
if (isset($_POST['diabook-settings-submit'])){
|
|
|
|
set_config('diabook', 'font_size', $_POST['diabook_font_size']);
|
|
|
|
set_config('diabook', 'line_height', $_POST['diabook_line_height']);
|
2012-04-14 20:50:16 -04:00
|
|
|
set_config('diabook', 'resolution', $_POST['diabook_resolution']);
|
2012-04-19 19:44:20 -04:00
|
|
|
set_config('diabook', 'color', $_POST['diabook_color']);
|
2012-05-05 14:01:38 -04:00
|
|
|
set_config('diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
|
2012-05-06 20:24:43 -04:00
|
|
|
set_config('diabook', 'ELZoom', $_POST['diabook_ELZoom']);
|
|
|
|
set_config('diabook', 'ELPosX', $_POST['diabook_ELPosX']);
|
|
|
|
set_config('diabook', 'ELPosY', $_POST['diabook_ELPosY']);
|
2012-04-13 15:34:21 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-06 20:24:43 -04:00
|
|
|
function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY){
|
2012-04-13 15:34:21 -04:00
|
|
|
$line_heights = array(
|
|
|
|
"1.3"=>"1.3",
|
2012-04-14 20:50:16 -04:00
|
|
|
"---"=>"---",
|
2012-04-20 11:16:42 -04:00
|
|
|
"1.6"=>"1.6",
|
2012-04-14 20:50:16 -04:00
|
|
|
"1.5"=>"1.5",
|
|
|
|
"1.4"=>"1.4",
|
2012-04-13 15:34:21 -04:00
|
|
|
"1.2"=>"1.2",
|
|
|
|
"1.1"=>"1.1",
|
|
|
|
);
|
|
|
|
|
|
|
|
$font_sizes = array(
|
2012-04-20 11:16:42 -04:00
|
|
|
'14'=>'14',
|
2012-04-14 20:50:16 -04:00
|
|
|
"---"=>"---",
|
2012-04-20 11:16:42 -04:00
|
|
|
"16"=>"16",
|
2012-04-14 20:50:16 -04:00
|
|
|
"15"=>"15",
|
2012-04-20 11:16:42 -04:00
|
|
|
'13.5'=>'13.5',
|
|
|
|
'13'=>'13',
|
2012-04-13 15:34:21 -04:00
|
|
|
'12.5'=>'12.5',
|
|
|
|
'12'=>'12',
|
|
|
|
);
|
2012-04-14 20:50:16 -04:00
|
|
|
$resolutions = array(
|
|
|
|
'normal'=>'normal',
|
|
|
|
'wide'=>'wide',
|
|
|
|
);
|
2012-04-19 19:44:20 -04:00
|
|
|
$colors = array(
|
|
|
|
'diabook'=>'diabook',
|
|
|
|
'aerith'=>'aerith',
|
|
|
|
'blue'=>'blue',
|
2012-04-20 11:16:42 -04:00
|
|
|
'green'=>'green',
|
|
|
|
'pink'=>'pink',
|
2012-04-20 19:06:17 -04:00
|
|
|
'red'=>'red',
|
|
|
|
'dark'=>'dark',
|
2012-04-19 19:44:20 -04:00
|
|
|
);
|
2012-04-13 15:34:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
|
|
|
|
$o .= replace_macros($t, array(
|
|
|
|
'$submit' => t('Submit'),
|
|
|
|
'$baseurl' => $a->get_baseurl(),
|
|
|
|
'$title' => t("Theme settings"),
|
|
|
|
'$font_size' => array('diabook_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
|
|
|
|
'$line_height' => array('diabook_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights),
|
2012-04-14 20:50:16 -04:00
|
|
|
'$resolution' => array('diabook_resolution', t('Set resolution for middle column'), $resolution, '', $resolutions),
|
2012-04-19 19:44:20 -04:00
|
|
|
'$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors),
|
2012-05-05 14:01:38 -04:00
|
|
|
'$TSearchTerm' => array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm),
|
2012-05-06 20:24:43 -04:00
|
|
|
'$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom),
|
|
|
|
'$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX),
|
|
|
|
'$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY),
|
2012-04-13 15:34:21 -04:00
|
|
|
));
|
|
|
|
return $o;
|
|
|
|
}
|