'; foreach ($options as $i => $option) { // $sel = selected($i, $selected, false); //wordpress function returns with single quotes, not double $html .= ''; } $html .= ''; return ($html); } } // //build admin interface ======================================================= function amr_ical_validate_general_options(){ global $amr_options, $amr_calprop, $amr_limits, $amr_compprop, $amr_groupings, $amr_components; $nonce = $_REQUEST['_wpnonce']; if (! wp_verify_nonce($nonce, 'amr-ical-events-list')) die ("Cancelled due to failed security check"); if (isset($_POST['ngiyabonga'])) $amr_options['ngiyabonga'] = true; else $amr_options['ngiyabonga'] = false; if (isset($_POST['noeventsmessage'])) $amr_options['noeventsmessage'] = $_POST['noeventsmessage']; if (isset($_POST["own_css"])) $amr_options['own_css'] = true; else $amr_options['own_css'] = false; if ((isset($_POST["date_localise"])) and (in_array($_POST["date_localise"], array('none', 'wp', 'wpgmt', 'amr')) )) $amr_options['date_localise'] = $_POST["date_localise"]; /* from dropdown */ else $amr_options['date_localise'] = 'none'; if (isset($_POST["cssfile"])) $amr_options['cssfile'] = $_POST["cssfile"]; /* from dropdown */ else $amr_options['cssfile'] = ''; if (isset($_POST["no_images"])) $amr_options['no_images'] = true; /* from dropdown */ else $amr_options['no_images'] = false; if (isset($_POST['images_size'])) $amr_ical_image_settings['images_size'] = (int) ($_POST['images_size']) ; /* from dropdown */ else $amr_ical_image_settings['images_size'] = '16'; /* check if no types updated, do not process other stuff if it has been */ if (isset($_POST["no_types"]) && (!($_POST["no_types"]== $amr_options['no_types']))){ if (function_exists( 'filter_var') ){ $int_ok = (filter_var($_POST["no_types"], FILTER_VALIDATE_INT, array("options" => array("min_range"=>1, "max_range"=>10)))); } else $int_ok = (is_numeric($_POST["no_types"]) ? (int) $_POST["no_types"] : false); if ($int_ok) { for ($i = $amr_options['no_types']+1; $i <= $int_ok; $i++) { $amr_options[$i] = new_listtype(); $amr_options[$i] = customise_listtype($i); } $amr_options['no_types'] = $int_ok; } else { _e('Invalid Number of Lists', 'amr-ical-events-list'); return(false); } } update_option('amr-ical-events-list', $amr_options); update_option('amr_ical_images_to_use', $amr_ical_image_settings); amr_ical_events_list_record_version(); return(true); } /* ---------------------------------------------------------------------- */ function amr_ical_validate_list_options($i) { global $amr_options; if (isset($_POST['general'])) { if (is_array($_POST['general'][$i])){ foreach ($_POST['general'][$i] as $c => $v) { if (!empty($_POST['general'][$i][$c])) { switch ($c) { case 'Default Event URL' : { if (!filter_var($_POST['general'][$i][$c],FILTER_VALIDATE_URL)) { amr_invalid_url(); } else { $url = filter_var($_POST['general'][$i][$c],FILTER_SANITIZE_URL); $sticky_url = amr_make_sticky_url($url); if (!$sticky_url) $amr_options[$i]['general'][$c] = $url ; //might be external else $amr_options[$i]['general'][$c] = $sticky_url ; } break; } case 'customHTMLstylefile': { $custom_htmlstyle_file = esc_attr($_POST['general'][$i]['customHTMLstylefile']); if (!($custom_htmlstyle_file[0] === '/')) $custom_htmlstyle_file = '/'.$custom_htmlstyle_file; $uploads = wp_upload_dir(); if (!file_exists($uploads['basedir'].$custom_htmlstyle_file)) { amr_invalid_file(); $amr_options[$i]['general']['customHTMLstylefile'] = ' '; } else { $amr_options[$i]['general']['customHTMLstylefile'] = $custom_htmlstyle_file; } } break; default: { $amr_options[$i]['general'][$c] = filter_var($_POST['general'][$i][$c],FILTER_SANITIZE_STRING) ; } } } else $amr_options[$i]['general'][$c] = ''; } } else echo 'Error in form - general array not found'; } if (isset($_POST['limit'])) { if (is_array($_POST['limit'][$i])) { foreach ($_POST['limit'][$i] as $c => $v) { $amr_options[$i]['limit'][$c] = (isset($_POST['limit'][$i][$c])) ? $_POST['limit'][$i][$c] :11; } } else echo 'Error in form - limit array not found'; } if (isset($_POST['format'])) { if (is_array($_POST['format'][$i])) { foreach ($_POST['format'][$i] as $c => $v) { /* amr - how should we validate this ? accepting any input for now */ $amr_options[$i]['format'][$c] = (isset($_POST['format'][$i][$c])) ? stripslashes_deep($_POST['format'][$i][$c]) :''; } } else echo 'Error in form - format array not found'; } foreach ($amr_options[$i]['component'] as $k => $c) { if (isset($_POST['component'][$i][$k])) { $amr_options[$i]['component'][$k] = true; } else { $amr_options[$i]['component'][$k] = false; } } foreach ($amr_options[$i]['grouping'] as $k => $c) { if (isset($_POST['grouping'][$i][$k])) { $amr_options[$i]['grouping'][$k] = true; } else { $amr_options[$i]['grouping'][$k] = false; } } if (isset($_POST['ColH'])) { if (is_array($_POST['ColH'][$i])) { foreach ($_POST['ColH'][$i] as $c => $v) { $amr_options[$i]['heading'][$c] = $v; } } // else echo 'Error in form - grouping array not found'; /* May not want any groupings ? } if (isset($_POST['CalP'])) { if (is_array($_POST['CalP'][$i])) { foreach ($_POST['CalP'][$i] as $c => $v) { if (is_array($v)) foreach ($v as $p => $pv){ /*need to validate these */ switch ($p): case 'Column': if (function_exists( 'filter_var') ) { if (filter_var($pv, FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>20)))) $amr_options[$i]['calprop'][$c][$p]= $pv; else $amr_options[$i]['calprop'][$c][$p]= 0; } else $amr_options[$i]['calprop'][$c][$p]= $pv; break; case 'Order': if (function_exists( 'filter_var') ) { if (filter_var($pv, FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>99)))) $amr_options[$i]['calprop'][$c][$p] = $pv;break; } else $amr_options[$i]['calprop'][$c][$p] = $pv;break; case 'Before': $amr_options[$i]['calprop'][$c][$p] = wp_kses($pv, amr_allowed_html()); break; case 'After': $amr_options[$i]['calprop'][$c][$p] = wp_kses($pv, amr_allowed_html()); break; endswitch; } } } else _e('Error in form - calprop array not found', 'amr-ical-events-list'); } if (isset($_POST['ComP'])) { if (is_array($_POST['ComP'][$i])) { foreach ($_POST['ComP'][$i] as $si => $sv) { /* eg si = descriptve */ foreach ($sv as $c => $v) {/* eg c= summary */ if (is_array($v)) foreach ($v as $p => $pv) { /*need to validate these */ switch ($p): case 'Column': if (function_exists( 'filter_var') ) { if (filter_var($pv, FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>20)))) $amr_options[$i]['compprop'][$si][$c][$p]= $pv; else $amr_options[$i]['compprop'][$si][$c][$p]= 0; break; } else $amr_options[$i]['compprop'][$si][$c][$p]= $pv; break; case 'Order': if (function_exists( 'filter_var') ) { if (filter_var($pv, FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>99)))) $amr_options[$i]['compprop'][$si][$c][$p] = $pv; else $amr_options[$i]['compprop'][$si][$c][$p]= 0; break; } else $amr_options[$i]['compprop'][$si][$c][$p] = $pv; break; case 'Before': $amr_options[$i]['compprop'][$si][$c][$p] = wp_kses($pv, amr_allowed_html()); break; case 'After': $amr_options[$i]['compprop'][$si][$c][$p] = wp_kses($pv, amr_allowed_html()); break; endswitch; } } } } else echo 'Error in form - compprop array not found'; } $result = update_option( 'amr-ical-events-list', $amr_options); return($result); } /* ---------------------------------------------------------------------*/ function amrical_general_form ($i) { global $amr_options; update_option('amr-ical-events-list-version', AMR_ICAL_LIST_VERSION); // for upgrade checks ?>
'; return ; } /* ---------------------------------------------------------------------*/ function amrical_componentsoption($i) { global $amr_options; ?>'; return ; } /* ---------------------------------------------------------------------*/ function amrical_groupingsoption($i) { global $amr_options; ?> '; return; } /* ---------------------------------------------------------------------*/ function amrical_calpropsoption($i) { global $amr_options; global $amr_csize; ?>'; return; } /* ---------------------------------------------------------------------*/ function amrical_compropsoption($i) { global $amr_options; global $amr_csize; ?>
0 and if there is data available in your event or ics file.', 'amr-ical-events-list'); ?>
$section ) { /* s= descriptive */ ?>' .__('See php date function format strings' , 'amr-ical-events-list').'' .__(' (will localise) ' , 'amr-ical-events-list') // . ' ' // .__('strftime' , 'amr-ical-events-list').'' ;?>
'; foreach ( $amr_options[$i]['format'] as $c => $v ) { $l = str_replace(' ','', $c).$i; echo '