Skip to content

Instantly share code, notes, and snippets.

@rodrigophpweb
Last active August 18, 2022 21:16
Show Gist options
  • Save rodrigophpweb/6bdb9800f49fd70eb16d191a7fceffb1 to your computer and use it in GitHub Desktop.
Save rodrigophpweb/6bdb9800f49fd70eb16d191a7fceffb1 to your computer and use it in GitHub Desktop.
URL from Google Calendar
<?php
$urlGoogle = 'https://calendar.google.com/calendar/render?action=TEMPLATE';
$urlOutlook = 'https://outlook.office.com/calendar/0/deeplink/compose?allday=false&';
$target = '_blank';
$text = get_the_title();
$titleGoogle = 'Salvar atividade no Google Calendar';
$titleOutlook = 'Salvar atividade no Outlook Calendar';
$details = get_the_content();
$iconUrlGoogle = 'https://upload.wikimedia.org/wikipedia/commons/a/a5/Google_Calendar_icon_%282020%29.svg';
$iconUrlOutlook = 'https://upload.wikimedia.org/wikipedia/commons/9/90/Outlook.com_icon_%282012-2019%29.svg';
$timezone = new DateTimeZone('America/Sao_Paulo');
$initial_date = DateTime::createFromFormat('d/m/Y', get_field('task_day'))->format('Ymd');
$hour_initial = DateTime::createFromFormat('H:i', get_field('hour_initial'))->format('his');
$final_hour = DateTime::createFromFormat('H:i', get_field('hour_final'))->format('his');
$dateHourInitial = $initial_date.'T'.$hour_initial.'00\Z';
$dateHourFinal = $initial_date.'T'.$final_hour.':00\Z';
$urlGoogle = $urlGoogle.'&text='.urldecode_deep($text).'&dates='.$dateHourInitial.'%2F'.$dateHourFinal.'&details='.urldecode_deep($details).'&location='.urldecode_deep($location_extern);
$urlOutlook = $urlOutlook.'subject='.urldecode_deep($text).'&body='.urldecode_deep($details).'&startdt='.urldecode_deep($dateHourInitial).'&enddt='.urldecode_deep($dateHourFinal).'&location='.urldecode_deep($location_extern);
$local = seeLocation();
var_dump($urlGoogle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment