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) {
?>