mirror of
https://0xacab.org/radar/radar-wp.git
synced 2025-04-22 07:46:31 +02:00
WIP Now with some formatting.
This commit is contained in:
parent
649f84ad8c
commit
98872a46bc
3 changed files with 328 additions and 81 deletions
|
@ -76,46 +76,12 @@ class Squat_Radar_Widget extends WP_Widget {
|
|||
|
||||
$html = '';
|
||||
foreach ($data['result'] as $id => $event) {
|
||||
$html .= Squat_Radar_Formatter::format_event($event);
|
||||
$output = apply_filters( 'squat_radar_format_event', $event, $instance['fields'], ['instance' => $instance] );
|
||||
$html .= implode($output);
|
||||
}
|
||||
$data['html'] = $html;
|
||||
|
||||
wp_send_json($data);
|
||||
|
||||
$print.="<li class='squat-li'>";
|
||||
|
||||
if ($r->title) {
|
||||
$print.="<h3 class='squat-h3'>";
|
||||
$print.=strip_tags($r->title);
|
||||
$print.="</h3>";
|
||||
}
|
||||
|
||||
if ($r->date_time[0]) {
|
||||
$print.="<span class='squat-tijd'>";
|
||||
$print.=verwerk_datum($r->date_time[0]);
|
||||
$print.="</span>";
|
||||
}
|
||||
|
||||
if ($r->body and $r->body->value) {
|
||||
$print.="<p class='squat-p'>".limit_text(strip_tags($r->body->value), 40) . "</p>";
|
||||
}
|
||||
|
||||
if ($r->title and $r->date_time[0]) {
|
||||
|
||||
$radar_link = "https://radar.squat.net/en/node/$r_id";
|
||||
|
||||
if ( $squat_lang == "nl") {
|
||||
$nog_meer = "zie alles";
|
||||
$meer = "meer";
|
||||
} else {
|
||||
$nog_meer = "see all";
|
||||
$meer = "more";
|
||||
}
|
||||
|
||||
$print.= "<a class='squat-link button' target='_blank' href='#' data-link='$radar_link' data-nog-meer='$nog_meer'>$meer</a>";
|
||||
}
|
||||
|
||||
$print.="</li>";
|
||||
}
|
||||
|
||||
public function form( $instance ) {
|
||||
|
@ -179,7 +145,7 @@ class Squat_Radar_Widget extends WP_Widget {
|
|||
echo '<div class="description">' . __('Go to <a href="https://radar.squat.net/en/events" target="_blank">https://radar.squat.net/en/events</a> and filter for the events you want to show. Then copy the URL from your address bar into here. It will look similar to: https://radar.squat.net/en/events/city/City_Name/group/123', 'squat-radar') . '</div>';
|
||||
}
|
||||
|
||||
if ( ! $instance['url']['error'] && ! empty( $instance['url']['keys'] ) ) {
|
||||
if ( empty($instance['url']['error']) && ! empty( $instance['url']['keys'] ) ) {
|
||||
echo '<hr>';
|
||||
echo '<p>' . __('Currently selecting events:', 'squat-radar') . '</p>';
|
||||
echo '<dl>';
|
||||
|
@ -259,7 +225,7 @@ class Squat_Radar_Widget extends WP_Widget {
|
|||
|
||||
if ( ! empty($new_instance['fields']) ) {
|
||||
$matches = [];
|
||||
preg_match_all('/([a-zA-Z:]+)/', $new_instance['fields'], $matches);
|
||||
preg_match_all('/([a-zA-Z_:]+)/', $new_instance['fields'], $matches);
|
||||
$options['fields'] = $matches[0];
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue