Beispiel #1
0
/**
 * Settings data validation
 *
 * @param array $data
 * @return array
 */
function fastblog_validate($data)
{
    global $fastblog_options, $fastblog_options_defaults;
    $data = tb_array_map('tb_trim_string', $data);
    $data['_build'] = FASTBLOG_BUILD;
    $data['_update_data'] = $fastblog_options['_update_data'];
    $data['header']['height'] = tb_range($data['header']['height'], 20);
    $data['header']['logo']['center'] = (int) (isset($data['header']['logo']['center']) && $data['header']['logo']['center']);
    $data['tagline'] = (int) (isset($data['tagline']) && $data['tagline']);
    $data['search'] = (int) (isset($data['search']) && $data['search']);
    $data['post']['hide_title'] = (int) (isset($data['post']['hide_title']) && $data['post']['hide_title']);
    $data['post']['about'] = (int) (isset($data['post']['about']) && $data['post']['about']);
    $data['post']['meta'] = tb_set_default($data['post']['meta'], $fastblog_options_defaults['post']['meta']);
    $data['post']['disable_short_url'] = (int) (isset($data['post']['disable_short_url']) && $data['post']['disable_short_url']);
    $data['page']['hide_title'] = (int) (isset($data['page']['hide_title']) && $data['page']['hide_title']);
    $data['page']['meta'] = tb_set_default($data['page']['meta'], $fastblog_options_defaults['page']['meta']);
    $data['contact_form']['from_header'] = (int) (isset($data['contact_form']['from_header']) && $data['contact_form']['from_header']);
    $data['fancybox']['enabled'] = (int) (isset($data['fancybox']['enabled']) && $data['fancybox']['enabled']);
    $data['fancybox']['show_title'] = (int) (isset($data['fancybox']['show_title']) && $data['fancybox']['show_title']);
    return $data;
}
Beispiel #2
0
 function update($new_instance, $old_instance)
 {
     $instance = $old_instance;
     $instance['username'] = strip_tags($new_instance['username']);
     $instance['count'] = tb_range($new_instance['count'], 1, 100);
     $instance['interval'] = tb_range($new_instance['interval'], 1);
     $instance['target'] = $new_instance['target'];
     $instance['time'] = time();
     return $instance;
 }