format required for
processing by the sapi handlers. They create an array called $_POST['aspen_main_settings']. Each
setting in that array corresponds to a Aspen option value, and will be passed to the
validation function.
We will wrap the two main forms (Main Options and most Advanced Options with our functions
aspen_sapi_form_top() and aspen_sapi_form_bottom() that generates required calls to sapi.
All other forms will use submit buttons that include their own nonce definition. Other forms generally
do not change individual settings, but take actions such as save/restore or setting a subtheme.
*/
/*
================= Main SAPI helper functions =================
*/
function aspen_sapi_form_top($group, $form_name='') {
/* beginning of a form */
$name = '';
if ($form_name != '') $name = 'name="' . $form_name . '"';
echo("
$val) {
if ($opt[0] == '_')
$theme_opts['aspen_base'][$opt] = false;
}
return $header . serialize($theme_opts); /* serialize full set of options right now */
} else {
$header = 'ABU-V01.00'; /* Save all settings: 10 byte header */
$theme_opts = array();
$theme_opts['aspen_base'] = $aspen_opts_cache;
return $header . serialize($theme_opts); /* serialize full set of options right now */
}
}
function aspen_clear_cache_settings() {
/* clear all settings */
global $aspen_opts_cache;
foreach ($aspen_opts_cache as $key => $value) {
$aspen_opts_cache[$key] = false; // clear everything
}
}
function aspen_save_msg($msg) {
echo '
' . $msg .
'
';
}
function aspen_error_msg($msg) {
echo '
' . $msg .
'
';
}
//============================================ form builder ====================================
function aspen_form_show_options($aspen_olist, $begin_table = true, $end_table = true) {
/* output a list of options - this really does the layout for the options defined in an array */
if ($begin_table) {
?>
You can enter CSS rules, enclosed in {}'s, and separated by ;.
See CSS Help for more details.
Custom CSS styling:
You can enter CSS rules, enclosed in {}'s, and separated by ;.
See CSS Help for more details.
' . $name . ' Widget Mobile Width';
$val['id'] = $value['id'] . '_w_mobile_int';
$val['type'] = 'val_pc';
$val['info'] = 'Width of ' . $name . ' widget on mobile devices. (Use 0 to hide. Allows different widgets on regular and mobile views.)';
aspen_form_row_val($val,'%');
}
function aspen_form_row_color($value) {
$pclass = 'color {hash:true, adjust:false}'; // starting with V 1.3, allow text in color pickers
?>
:
" />
'.$value['name'].'';
aspen_form_help($value);
?>
'. "\n");
else echo ('
'. "\n");
if ($value['info'] != '') {
echo('
'); echo $value['info'];
echo("
\n");
}
?>
'.$value['name'].'';
aspen_form_help($value);
?>
'); echo $value['info'];
echo("\n");
}
?>
'.$value['name'].'';
aspen_form_help($value);
?>
'); echo $value['info'];
echo("\n");
}
?>
:
:
:
:
:
:
:
>
:
:
'default', 'desc'=> 'Use Default' ),
array('val' => 'right-1-col', 'desc'=> 'Single column sidebar on Right' ),
array('val' => 'left-1-col', 'desc' => 'Single column sidebar on Left'),
array('val' => 'right-2-col', 'desc' => 'Double Cols, Right (top wide)'),
array('val' => 'left-2-col', 'desc' => 'Double Cols, Left (top wide)'),
array('val' => 'right-2-col-bottom', 'desc' => 'Double Cols, Right (bottom wide)'),
array('val' => 'left-2-col-bottom', 'desc' => 'Double Cols, Left (bottom wide)'),
array('val' => 'split', 'desc' => 'Split - sidebars on Right and Left'),
array('val' => 'one-column', 'desc' => 'No sidebars, one column content')
);
$value['value'] = $list;
aspen_form_row_select_id($value);
}
function aspen_form_row_link($value) {
$link = array ('name' => 'Link', 'id' => $value['id'].'_color', 'type' => 'ctext', 'info' => 'Color of link');
$strong = array ('name' => 'Bold', 'id' => $value['id'].'_strong', 'type' => 'checkbox', 'info' => 'Bold link');
$em = array ('name' => 'Italic', 'id' => $value['id'].'_em', 'type' => 'checkbox', 'info' => 'Italic link');
$visit = array ('name' => 'Visited', 'id' => $value['id'].'_visited_color', 'type' => 'ctext', 'info' => 'Color when link has been visited (this option is generally falling out of use)');
$hover = array ('name' => 'Hover', 'id' => $value['id'].'_hover_color', 'type' => 'ctext', 'info' => 'Color when hovering');
$under = array ('name' => 'Underline', 'id' => $value['id'].'_u', 'type' => 'checkbox', 'info' => 'Underline on hover');
aspen_form_row_subheader_alt($value);
aspen_form_row_ctext($link);
aspen_form_row_checkbox($strong);
aspen_form_row_checkbox($em);
aspen_form_row_ctext($visit);
aspen_form_row_ctext($hover);
aspen_form_row_checkbox($under);
}
function aspen_form_row_note($value) {
?>
','
');
}
function aspen_form_row_info($value) {
if ($value['info'] != '') {
echo('