use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
+use Friendica\Model\Profile;
use Friendica\Util\Map;
require_once 'include/bbcode.php';
*/
function bbtoevent($s) {
- $ev = array();
+ $ev = [];
$match = '';
if (preg_match("/\[event\-summary\](.*?)\[\/event\-summary\]/is", $s, $match)) {
return;
}
- dba::delete('event', array('id' => $event_id));
+ dba::delete('event', ['id' => $event_id]);
logger("Deleted event ".$event_id, LOGGER_DEBUG);
}
$event = $r[0];
}
- $item_arr = array();
+ $item_arr = [];
$item_arr['uid'] = $arr['uid'];
$item_arr['contact-id'] = $arr['cid'];
// First day of the week (0 = Sunday).
$firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
- $i18n = array(
+ $i18n = [
"firstDay" => $firstDay,
"allday" => t("all-day"),
"dtstart_label" => t("Starts:"),
"dtend_label" => t("Finishes:"),
"location_label" => t("Location:")
- );
+ ];
return $i18n;
}
* @todo We should replace this with a separate update function if there is some time left.
*/
function event_remove_duplicates($dates) {
- $dates2 = array();
+ $dates2 = [];
foreach ($dates as $date) {
if ($date['type'] == 'birthday') {
* @return array Event array for the template.
*/
function process_events($arr) {
- $events=array();
+ $events=[];
$last_date = '';
$fmt = t('l, F j');
$copy = null;
$drop = null;
if (local_user() && local_user() == $rr['uid'] && $rr['type'] == 'event') {
- $edit = ((! $rr['cid']) ? array(System::baseUrl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null);
- $copy = ((! $rr['cid']) ? array(System::baseUrl() . '/events/copy/' . $rr['id'], t('Duplicate event'), '', '') : null);
- $drop = array(System::baseUrl() . '/events/drop/' . $rr['id'], t('Delete event'), '', '');
+ $edit = ((! $rr['cid']) ? [System::baseUrl() . '/events/event/' . $rr['id'], t('Edit event'), '', ''] : null);
+ $copy = ((! $rr['cid']) ? [System::baseUrl() . '/events/copy/' . $rr['id'], t('Duplicate event'), '', ''] : null);
+ $drop = [System::baseUrl() . '/events/drop/' . $rr['id'], t('Delete event'), '', ''];
}
$title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
$html = format_event_html($rr);
$rr['desc'] = bbcode($rr['desc']);
$rr['location'] = bbcode($rr['location']);
- $events[] = array(
+ $events[] = [
'id' => $rr['id'],
'start' => $start,
'end' => $end,
'is_first' => $is_first,
'item' => $rr,
'html' => $html,
- 'plink' => array($rr['plink'], t('link to source'), '', ''),
- );
+ 'plink' => [$rr['plink'], t('link to source'), '', ''],
+ ];
}
}
$file_ext = "";
}
- $arr = array(
+ $arr = [
'success' => $process,
'format' => $format,
'extension' => $file_ext,
'content' => $res,
- );
+ ];
return $arr;
}
return;
}
- return replace_macros(get_markup_template("events_aside.tpl"), array(
+ return replace_macros(get_markup_template("events_aside.tpl"), [
'$etitle' => t("Export"),
'$export_ical' => t("Export calendar as ical"),
'$export_csv' => t("Export calendar as csv"),
'$user' => $user
- ));
+ ]);
}
/**
// Format the event location.
$evloc = event_location2array($item['event-location']);
- $location = array();
+ $location = [];
if (isset($evloc['name'])) {
$location['name'] = prepare_text($evloc['name']);
$profile_link = best_link_url($item, $sp);
if (!$sp) {
- $profile_link = zrl($profile_link);
+ $profile_link = Profile::zrl($profile_link);
}
- $event = replace_macros(get_markup_template('event_stream_item.tpl'), array(
+ $event = replace_macros(get_markup_template('event_stream_item.tpl'), [
'$id' => $item['event-id'],
'$title' => prepare_text($item['event-summary']),
'$dtstart_label' => t('Starts:'),
'$hide_map_label' => t('Hide map'),
'$map_btn_label' => t('Show map'),
'$location' => $location
- ));
+ ]);
return $event;
}
return;
}
- $location = array('name' => $s);
+ $location = ['name' => $s];
// Map tag with location name - e.g. [map]Paris[/map].
if (strpos($s, '[/map]') !== false) {