'. __('Settings','amr-ical-events-list').'' ); } return $links; } // end plugin_action() function amr_ical_support_links () { echo '

'; _e('Documentation', 'amr-ical-events-list'); echo '   '; _e('Support', 'amr-ical-events-list'); /* echo '   '; _e('Videos', 'amr-ical-events-list'); */ echo '   '; _e('Rate or Review', 'amr-ical-events-list'); echo '  '; _e('Plugin feed', 'amr-ical-events-list'); echo ' Rss icon'; echo '

'; echo '

'; _e('To edit events in wordpress:','amr-ical-events-list'); echo ' '; _e('Upgrade to amr-events at ','amr-ical-events-list'); echo ' icalevents.com'; echo '
'; _e('Need help remembering shortcodes?', 'amr-ical-events-list'); ?>


'; if (function_exists('timezone_version_get')) printf('
  • '.__('Your timezone db version is: %s','amr-ical-events-list').'
  • ', timezone_version_get()); else echo '
  • '.'' .__('Plugin cannot determine timezonedb version in php < 5.3.' ,'amr-ical-events-list') .''; echo '
  • '; _e('Php timezonedb versions', 'amr-ical-events-list'); echo '   '; _e('Info on what changes are in which timezonedb version', 'amr-ical-events-list'); echo '
  • '; if (!(isset($amr_globaltz))) { echo ''.__('No global timezone - is there a problem here? ','amr-ical-events-list').''; return; } $tz = get_option('timezone_string'); $settingslink = ''.__('Go to settings','amr-ical-events-list').''; if ($tz == '') { $gmtoffset = get_option('gmt_offset'); if (!empty($gmtoffset ) ) { printf('
  • '.__('You are using the "old" gmt_offset setting ','amr-ical-events-list').'
  • ', $gmtoffset ); _e('Consider changing to the more accurate timezone setting','amr-ical-events-list'); echo '
  • '; } } $now = date_create('now', $amr_globaltz); echo '
  • '.__('The plugin thinks your timezone is: ','amr-ical-events-list') . timezone_name_get($amr_globaltz) .' '.$settingslink .'
  • ' .'
  • '.__('The current UTC offset for that timezone is: ','amr-ical-events-list').$now->getoffset()/(60*60).'
  • '; if (function_exists('timezone_transitions_get') ) { foreach (timezone_transitions_get($amr_globaltz) as $tr) { //2018 06 24 remove the break code just in case if (empty($nexttransition) and ($tr['ts'] > time())) { $nexttransition = $tr; } } $tr = $nexttransition; } $utctz= new DateTimeZone('UTC'); if (isset ($tr['ts']) ) { $d = amr_create_date_time ( "@{$tr['ts']}",$utctz ); //try {$d = new DateTime( "@{$tr['ts']}",$utctz );} //catch(Exception $e) { break;} date_timezone_set ($d,$amr_globaltz ); printf('
  • '.__('Switches to %s on %s. GMT offset: %d', 'amr-ical-events-list').'
  • ', $tr['isdst'] ? "DST" : "standard time", $d->format('d M Y @ H:i'), $tr['offset']/(60*60) ); } echo '
  • '; _e('Current time (unlocalised): ','amr-ical-events-list'); echo $now->format('r'); echo '
  • '; } function amr_ical_submit_buttons ($resettext='') { if (empty($resettext)) $resettext=__('Reset all listing options', 'amr-ical-events-list'); echo '
    '; echo '    
    '; } function amrical_listing_options_page() { global $amr_options; if (isset ($_POST['reset'])) $amr_options = amr_getset_options (true); else $amr_options = amr_getset_options(false); /* options will be set to defaults here if not already existing */ if (!isset($_REQUEST["list"]) ) { amrical_admin_heading(__('Manage Event List Types', 'amr-ical-events-list') ) ; if (!empty($_POST['delete']) ) /* Validate the input and save */ amrical_delete_listings(); elseif ((isset ($_POST['action']) and ($_POST['action'] == "save")) and !isset($_POST['reset'])) /* Validate the input and save */ amrical_validate_manage_listings(); amr_ical_submit_buttons (); amrical_manage_listings(); amrical_admin_footer(); return; } else { $listtype = intval( $_REQUEST["list"]); amrical_admin_heading(__('Configure event list type: ', 'amr-ical-events-list'). $listtype ) ; amrical_admin_navigation(); $calendar_preview_url = get_option('amr-ical-calendar_preview_url' ); if ($calendar_preview_url) { echo '' .__('Preview','amr-ical-events-list').''; } if ((isset ($_POST['action']) and ($_POST['action'] == "save")) and !isset($_POST['reset'])) {/* Validate the input and save */ echo '

    '; _e('Saving....','amr-ical-events-list'); $result = amr_ical_validate_list_options($listtype); /* messages are in the function */ if ($result) _e('Lists saved','amr-ical-events-list'); else _e('No change to options or unexpected error in saving','amr-ical-events-list'); echo '

    '; } amr_ical_submit_buttons (); amr_configure_list($listtype); amrical_admin_footer(); } } //end amrical_option_page function amrical_delete_listings () { global $amr_options; $nonce = $_REQUEST['_wpnonce']; if (! wp_verify_nonce($nonce, 'amr-ical-events-list')) die ("Cancelled due to failed security check"); echo '

    '.__('Check for lists to delete','amr-ical-events-list').'

    '; // ------------------- deleted lists if (!empty($_POST['deletelist'])) { foreach ($_POST['deletelist'] as $i=>$del) { $d = (int) $del; unset ($amr_options['listtypes'][$d]); echo '

    ' .sprintf(__('List %s will be deleted','amr-ical-events-list'),$d) .'

    '; } } update_option('amr-ical-events-list', $amr_options); } function amrical_col_headings($i) { /* for component properties only */ global $amr_options; global $amr_csize; $listtype = $amr_options['listtypes'][$i]; echo '

    '; _e('Column Headings:','amr-ical-events-list'); echo '

    '; $j = 0; while ($j < 8) { $j = $j + 1; if (isset ( $listtype['heading'][$j] )) { $h = $listtype['heading'][$j]; } else $h = ''; echo ''; } echo "\n\t".'
    '; return; } function amrical_calpropsoption($i) { global $amr_options; global $amr_csize; $listtype = $amr_options['listtypes'][$i]; echo '

    '; _e('Calendar properties' , 'amr-ical-events-list'); echo '

    '; foreach ( $listtype['calprop'] as $c => $v ) { echo "\n\t\t".'
    '.$c.''; foreach ( $v as $si => $sv ) /* for each specification */ { echo '' .''; } echo "\n\t\t".'
    '; } echo "\n\t".'
    '; return; } function amrical_compropsoption($i) { global $amr_options; global $amr_csize; $inuse = amr_whats_in_use(); $listtype = $amr_options['listtypes'][$i]; $desc = amr_set_helpful_descriptions(); echo '

    '; _e('Specify fields to show:' , 'amr-ical-events-list'); echo '

    '; _e('Note: a 0 (zero) in column = do not show that field.', 'amr-ical-events-list'); echo '

    '; _e('Uppercase fields are those defined in the iCal specification.', 'amr-ical-events-list'); echo ' RFC 5545

    '; _e('Lowercase fields are additional fields added by this plugin and derived from the iCal fields for your convenience.' , 'amr-ical-events-list'); _e('Fields show if "column" > 0 and if there is data available in your event or ics file.', 'amr-ical-events-list'); echo '

    '; echo ''; $thead = '' .'' .'' .'' .'' .'' .''; echo ''.$thead.''; echo ''.$thead.''; echo ''; $listtype['compprop'] = apply_filters('amr_ics_component_properties', $listtype['compprop']); // add arrays of field array('Column' => 0, 'Order' => 510, 'Before' => '', 'After' => ''); foreach ($inuse as $f=> $bool) { if (!isset($listtype['compprop'][$f])) { // we got a new field $listtype['compprop'][$f] = array('Column' => 0, 'Order' => 510, 'Before' => '', 'After' => ''); } } foreach ( $listtype['compprop'] as $p => $pv ) {/* for each specification, eg: p= SUMMARY */ if (!empty($inuse[$p])) { $text = ''.(!empty($desc[$p])? $desc[$p] : '').''; echo "\n\t\t".''; } echo ''; echo "\n\t\t".''; } } echo "\n".'
    '.__('Field','amr-ical-events-list').''.__('Column','amr-ical-events-list').'
    ' .__('(0 to hide)', 'amr-ical-events-list') .'
    '.__('Order','amr-ical-events-list').''.__('Before','amr-ical-events-list').''.__('After','amr-ical-events-list').'
    '.$p.''; foreach ( $pv as $s => $sv ) {/* for each specification eg $s = column*/ echo '' .'' .'
    '.$text.'
    '; return; } function amrical_groupingsoption($i) { global $amr_options; $listtype = $amr_options['listtypes'][$i]; $groupings = amr_define_possible_groupings (); $taxonomies = amr_define_possible_taxonomies (); echo '

    '; _e('Define grouping:', 'amr-ical-events-list'); echo '

    '; echo ''; $nolevel1 = false; $nolevel2 = false; if (empty($listtype['grouping'])) { echo 'No groupings ?'; $nolevel1 = true; $nolevel2 = true; } else { if (count($listtype['grouping']) < 2) $nolevel2 = true; } echo ''; $sel = checked($nolevel1,true, false); echo ""; $sel = checked($nolevel2,true, false); echo ""; echo ''; echo ''; foreach ( $taxonomies as $i => $taxonomy ) { $taxo = get_taxonomy($taxonomy); $c = $taxo->label; if (!empty($listtype['grouping'][$taxonomy])) $v= $listtype['grouping'][$taxonomy]; else $v = false; echo ''; $sel = checked($v,1, false); echo ""; $sel = checked($v,2, false); echo ""; echo ''; } echo ''; foreach ( $groupings as $c => $tmp ) { if (in_array($c,$taxonomies )) continue; // don't repeat if (!empty($listtype['grouping'][$c])) $v= $listtype['grouping'][$c]; else $v = false; echo ''; $sel = checked($v,1, false); echo ""; $sel = checked($v,2, false); echo ""; echo ''; } echo "\n\t".'
    '.__('Possible Groupings', 'amr-ical-events-list').''.__('Level','amr-ical-events-list').' 1 '.__('Level','amr-ical-events-list').' 2
    '.__('No grouping','amr-ical-events-list').'
    '.__('Taxonomies','amr-ical-events-list').''.__('(Requires amr-events)','amr-ical-events-list').'
    '.$c.'
    '.__('Date based','amr-ical-events-list').''.__('(See also date and time formats)','amr-ical-events-list').'
    '.$c.'
    '; return; } function amrical_componentsoption($i) { global $amr_options; $listtype = $amr_options['listtypes'][$i]; echo '

    '; _e('Select components to show:', 'amr-ical-events-list'); echo ' ?

    '; $desc = amr_set_helpful_descriptions (); if (! isset($listtype['component'])) echo 'No default components set'; else { foreach ( $listtype['component'] as $c => $v ) { echo '
    '.$desc[$c].''; } } echo "\n\t".'
    '; return ; } function amrical_limits($i) { global $amr_options; $listtype = $amr_options['listtypes'][$i]; echo '

    ' . __('Define maximums:', 'amr-ical-events-list') .'

    '. __('Note cache times are in hours','amr-ical-events-list') .'

    '; if (! isset($listtype['limit'])) echo 'No default limits set'; else { foreach ( $listtype['limit'] as $c => $v ) { echo ''; echo ''; } } echo "\n\t".'
    '; return ; } function amrical_admin_heading($title) { echo '

    '.$title.' v'.AMR_ICAL_LIST_VERSION.'

    '; wp_nonce_field('amr-ical-events-list'); /* outputs hidden field */ ; } function amrical_admin_footer() { echo '
    '; } function amrical_admin_navigation() { global $amr_options; echo '
    '; if (!isset($_REQUEST["list"]) ) { $list = '';} else $list = intval( $_REQUEST["list"]); $url = remove_query_arg('list'); _e('Configure another list type: ','amr-ical-events-list'); foreach ($amr_options['listtypes'] as $i => $listtype) { if ($i > 1) echo ' '; $text = ' '.$i // .$listtype['general']['name'] .''; if ($list==$i) echo ''.$text.''; else echo $text; } if (isset($_GET["list"]) ) { echo ''.__('Return to manage list types','amr-ical-events-list' ).''; } echo '
    '; } function amrical_validate_manage_listings() { global $amr_options; $nonce = $_REQUEST['_wpnonce']; if (! wp_verify_nonce($nonce, 'amr-ical-events-list')) die ("Cancelled due to failed security check"); if (!empty($_POST['calendar_preview_url'])) { if (!filter_var($_POST['calendar_preview_url'],FILTER_VALIDATE_URL)) { amr_invalid_url(); } else { $url = filter_var($_POST['calendar_preview_url'],FILTER_SANITIZE_URL); $sticky_url = amr_make_sticky_url($url); if (!$sticky_url) $calendar_preview_url = $url ; //might be external else $calendar_preview_url = $sticky_url ; update_option('amr-ical-calendar_preview_url', $calendar_preview_url); } } else { update_option('amr-ical-calendar_preview_url', ''); } //----- list numbers $dupcheck = array(); // clear it out if (!empty($_POST['listnumber'])) { foreach ($_POST['listnumber'] as $i=> $n) { if ($n === '') break; $nn = abs (intval ( $n)); if ($nn === 0){ echo '
    '.__('Please use numbers > 1','amr-ical-events-list').'
    '; return; } if (in_array($nn, $dupcheck)) echo 'Duplicate List Number was entered - please ensure all list numbers are unique.'; else { $listnumber[$i] = $nn; $dupcheck[$nn] = $nn; // keep a record of the numbers if (empty ($_POST['prevnumber'][$i]) or ($_POST['prevnumber'][$i] === '')) { // if we have no listtype for the existing number, then must be new $amr_options['listtypes'][$nn] = new_listtype(); $amr_options['listtypes'][$nn]['Id'] = $nn; $amr_options['listtypes'][$nn]['general']['name'] .= $nn; $amr_options['listtypes'][$nn] = customise_listtype($nn); // includes the fix, need till we drop away old compatibility echo '
    Create new '.$nn; } else {// we are changing a list number, copy the list type to the new number $prev = $_POST['prevnumber'][$i]; if (!($prev == $nn)) { $amr_options['listtypes'][$nn] = $amr_options['listtypes'][$prev]; $amr_options['listtypes'][$nn]['Id'] = $nn; unset($amr_options['listtypes'][$prev]); } } } } ksort ($amr_options['listtypes']); } // ---------------------- imported lists if (isset($_POST['import'])) { $import = $_POST['import']; foreach ($import as $i=>$il) { if (!empty($il)) { //var_dump($il); $importedlist = unserialize(base64_decode($il)); $importedlist['Id'] = $i; // use the id just pasted into if ((!is_array($importedlist)) or empty($importedlist['general'])) echo '

    ' .sprintf(__('Imported settings for list %s invalid - not saved','amr-ical-events-list'),$i) .'

    ' .sprintf(__('List %s will be saved with imported data','amr-ical-events-list'),$i) .'

    '; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if (!empty($listtype['general']) ) { echo ''; echo '' .$listtype['general']['name'].'' .'
    '; echo '' .__('Configure', 'amr-ical-events-list').' | '; if ($calendar_preview_url) { echo '' .__('Preview','amr-ical-events-list').''; } else { echo '' .__('n/a','amr-ical-events-list').''; } echo '
    '; echo ''; echo ''.$listtype['general']['ListHTMLStyle']; echo ''; echo ''; echo ''; } else { echo ''; _e('Enter a list number to start a list type with new default settings.','amr-ical-events-list'); echo '' .__('After that, cut and paste from the list type closest to what you want to get you started','amr-ical-events-list') .''; } echo ''; } function amrical_option_page() { global $amr_options; //$nonce = wp_create_nonce('amr-ical-events-list'); /* used for security to verify that any action request comes from this plugin's forms */ amrical_admin_heading(__('iCal Events List ', 'amr-ical-events-list')); if (isset ($_POST['reset'])) $amr_options = amr_getset_options (true); else $amr_options = amr_getset_options(false); /* options will be set to defaults here if not already existing */ if (!(isset ($_POST['reset'])) and (isset ($_POST['action']) and ($_POST['action'] == "save"))) {/* Validate the input and save */ echo '

    '; _e('Saving....','amr-ical-events-list'); if (!isset($_REQUEST['list'])) { if (! amr_ical_validate_general_options() ) {echo '

    Error validating general options

    ';} else _e('List saved','amr-ical-events-list'); } echo '

    '; } //amr_request_acknowledgement(); amr_ical_support_links (); //amrical_mimic_meta_box('acknowledge', 'About', 'amr_request_acknowledgement' , true); //if (!(is_plugin_active('amr-events/amr-events.php'))) {amr_getting_started();} amr_ical_submit_buttons (); amr_ical_general_form(); echo '
    '; } //end amrical_option_page function amrical_add_options_panel() { global $wp_version, $current_user, $events_menu_added; /* add the options page at admin level of access */ $parent_slug = 'amr-events'; $capability = 'manage_event_settings'; $menu_title = $page_title = __('iCal Events List', 'amr-ical-events-list'); $function = 'amrical_option_page'; $menu_slug = 'manage_amr_ical'; if (function_exists('amr_events_settings_menu')) { $menu_title = $page_title = __('Listing Events', 'amr-ical-events-list'); if (empty($events_menu_added) or (!$events_menu_added)) { amr_events_settings_menu(); $events_menu_added = true; } add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); if (!(current_user_can('manage_event_settings'))) add_submenu_page( $parent_slug, $page_title, $menu_title, 'manage_options', $menu_slug, $function); // some sites need this } else { $capability = 'manage_options'; add_menu_page($page_title, $menu_title , $capability, $menu_slug, $function); $parent_slug = $menu_slug; // $page = add_options_page($page_title, $menu_title , 'manage_options', $menu_slug, $function); } $function = 'amrical_choose_fields'; $menu_slug = 'manage_event_fields'; $page_title = __('iCal Fields', 'amr-ical-events-list'); $menu_title = __('Fields for lists', 'amr-ical-events-list'); add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); $function = 'amrical_listing_options_page'; $menu_slug = 'manage_event_listing'; $page_title = __('iCal Events Lists', 'amr-ical-events-list'); $menu_title = __('List types', 'amr-ical-events-list'); add_submenu_page( $parent_slug, $page_title, $menu_title,$capability, $menu_slug, $function); amr_ical_updates_menu($parent_slug); } //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; foreach (array( 'noeventsmessage', 'lookmoremessage', 'lookprevmessage', 'resetmessage', 'freebusymessage' // was missing 20141119 ) as $message) { if (isset($_POST[$message])) $amr_options[$message] = $_POST[$message]; else $amr_options[$message] = ''; } if (isset($_POST["usehumantime"])) $amr_options['usehumantime'] = true; else $amr_options['usehumantime'] = false; if (isset($_POST["do_grouping_js"])) $amr_options['do_grouping_js'] = true; else $amr_options['do_grouping_js'] = false; if (isset($_POST["js_only_these_pages"])) { $tmp = explode (',',$_POST["js_only_these_pages"]); foreach ($tmp as $i) {$i = (int) $i;} $amr_options['js_only_these_pages'] = $tmp; } else $amr_options['js_only_these_pages'] = false; 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'; if (isset($_POST['timeout'])) { $amr_options['timeout'] = (int) ($_POST['timeout']) ; /* from dropdown */ } else $amr_options['timeout'] = '5'; 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['listtypes'][$i]['general'][$c] = $url ; //might be external else $amr_options['listtypes'][$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['listtypes'][$i]['general']['customHTMLstylefile'] = ' '; } else { $amr_options['listtypes'][$i]['general']['customHTMLstylefile'] = $custom_htmlstyle_file; } break; } default: { $amr_options['listtypes'][$i]['general'][$c] = filter_var($_POST['general'][$i][$c],FILTER_SANITIZE_STRING) ; } } } else $amr_options['listtypes'][$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['listtypes'][$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['listtypes'][$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['listtypes'][$i]['component'] as $k => $c) { if (isset($_POST['component'][$i][$k])) { $amr_options['listtypes'][$i]['component'][$k] = true; } else { $amr_options['listtypes'][$i]['component'][$k] = false; } } unset ($amr_options['listtypes'][$i]['grouping']); if (isset($_POST['level'][1])) { $k = esc_attr($_POST['level']['1']); if (!($k === 'none')) $amr_options['listtypes'][$i]['grouping'][$k] = '1'; } if (isset($_POST['level'][2])) { $k = esc_attr($_POST['level']['2']); if (!($k === 'none')) $amr_options['listtypes'][$i]['grouping'][$k] = '2'; } if (isset($_POST['ColH'])) { if (is_array($_POST['ColH'][$i])) { foreach ($_POST['ColH'][$i] as $c => $v) { $amr_options['listtypes'][$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['listtypes'][$i]['calprop'][$c][$p]= $pv; else $amr_options['listtypes'][$i]['calprop'][$c][$p]= 0; } else $amr_options['listtypes'][$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['listtypes'][$i]['calprop'][$c][$p] = $pv;break; } else $amr_options['listtypes'][$i]['calprop'][$c][$p] = $pv;break; case 'Before': $amr_options['listtypes'][$i]['calprop'][$c][$p] = wp_kses($pv, amr_allowed_html()); break; case 'After': $amr_options['listtypes'][$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'])) { foreach ($_POST['ComP'] 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['listtypes'][$i]['compprop'][$c][$p]= $pv; else $amr_options['listtypes'][$i]['compprop'][$c][$p]= 0; break; } else $amr_options['listtypes'][$i]['compprop'][$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['listtypes'][$i]['compprop'][$c][$p] = $pv; else $amr_options['listtypes'][$i]['compprop'][$c][$p]= 0; break; } else $amr_options['listtypes'][$i]['compprop'][$c][$p] = $pv; break; case 'Before': $bef = wp_kses($pv, amr_allowed_html()); $bef = wp_kses_stripslashes($bef); //if (stripos($bef, '\\"')) echo 'YES still there'; $bef = str_replace('\\"', '"', $bef); $amr_options['listtypes'][$i]['compprop'][$c][$p] = $bef; //if ($c == 'URL') echo 'TEST:'. $bef.' else '.$amr_options['listtypes'][$i]['compprop'][$c][$p]; break; case 'After': $amr_options['listtypes'][$i]['compprop'][$c][$p] = wp_kses_stripslashes(wp_kses($pv, amr_allowed_html())); break; endswitch; } } } $amr_options['listtypes'][$i]['compprop'] = amr_sort_by_two_cols_asc('Column','Order',$amr_options['listtypes'][$i]['compprop']); } 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; //http://localhost/wpbeta/wp-admin/post-new.php?post_type=page $listtype = $amr_options['listtypes'][$i]; ?>



    ' . __('Other:', 'amr-ical-events-list') .'

    '; if (! isset($listtype['general'])) echo 'No general specifications set'; else {?>


    ' .$gentext.' | ' .'' .$styletext.' | ' .'' .$advtext .' | ' .'' .$managetext .'

    '.$gentext.'

    '; echo '

    />

    />

    />

    />

    />





    */?>

    ')) { echo( '

    '.__('Minimum Php version 5.3 required for events cacheing. ','amr-ical-events-list'). ''); _e('Cacheing of generated events for re-use on same page (eg: widget plus list) will not be attempted. ','amr-ical-events-list') ; _e('Apparently objects do not serialise correctly in php < 5.3.','amr-ical-events-list') ; echo '

    '; } echo '

    '; _e('Http timeout for external ics files:', 'amr-ical-events-list'); $options = array('5','8','10','20','30','1'); if (!isset($amr_options['timeout'])) $amr_options['timeout'] = 5; ?>




    ?







    '; echo '
    '; $url = remove_query_arg('list'); echo '

    '.__('Click the name of each list type below to configure that list.','amr-ical-events-list').'

    '; echo '

    ' .'' .__('Configuration help','amr-ical-events-list' ).' ' .__('Be careful when editing or deleting - some listtypes are defaults for shortcodes and widgets. ','amr-ical-events-list' ) .'
    '.__('Add listtype=n in the parameters of the shortcode or widget to use another list type.','amr-ical-events-list' ) .'

    '; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($amr_options['listtypes'] as $i=>$listtype) { amr_manage_listtypes_row ($listtype, $i); } amr_manage_listtypes_row ($listtype=null, ''); echo '
    X'.__('List','amr-ical-events-list').''.__('Name','amr-ical-events-list').''.__('List HTML Style','amr-ical-events-list').''.__('To export or copy a list type','amr-ical-events-list') .'
    '.__('Select ALL the content, and COPY.','amr-ical-events-list') .' '.__('Why encode?','amr-ical-events-list').'' .'' .'
    '.__('To import or paste a list type','amr-ical-events-list') .'
    '.__('PASTE list type string','amr-ical-events-list') .' '.__('Test decode','amr-ical-events-list').'' .'' .'
    '; /*?> */ ?>

    ' .__('See php date function format strings' , 'amr-ical-events-list').'' .__(' (will localise) ' , 'amr-ical-events-list') // . ' ' // .__('strftime' , 'amr-ical-events-list').'' ;?>

    '; foreach ( $amr_options['listtypes'][$i]['format'] as $c => $v ) { $l = str_replace(' ','', $c).$i; echo '
  • '; echo ' '; echo amr_format_date( $v, $date); //a* amr ***/ echo '
  • '; } echo ''; } ?>
    ' ; // echo ''. __('List Type ', 'amr-ical-events-list').$i.''; echo ''.__('Expand/Contract all', 'amr-ical-events-list').''; // echo ''.__('go back','amr-ical-events-list').''; if (!(isset($amr_options['listtypes'])) ) echo 'Error in saved options'; else { amrical_general_form($i); amrical_compropsoption($i); amrical_limits ($i); amrical_formats ($i); if (!(in_array($amr_options['listtypes'][$i]['general']['ListHTMLStyle'], array('smallcalendar','largecalendar', 'weekscalendar')))) { amrical_groupingsoption($i); amrical_col_headings($i); } // amrical_calpropsoption($i); amrical_componentsoption($i); amrical_other_form($i); } echo "\n\t".' '; ?>