';
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 '
'.__('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 '';
}
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').'
';
_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 = '
'
.'
'.__('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').'
'
.'
';
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".'
'.$p.'';
foreach ( $pv as $s => $sv ) {/* for each specification eg $s = column*/
echo '
';
return ;
}
function amrical_admin_heading($title) {
echo '
'.$title.' v'.AMR_ICAL_LIST_VERSION.'
';
}
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)
.'
';
_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 '
'.__('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;
?>
'.__('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 '
X
';
echo '
'.__('List','amr-ical-events-list').'
';
echo '
'.__('Name','amr-ical-events-list').'
';
echo '
'.__('List HTML Style','amr-ical-events-list').'
';
echo '
'.__('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').''
.''
.'