diff --git a/assets/squat-radar.css b/assets/squat-radar.css
index ff69778..bc17894 100644
--- a/assets/squat-radar.css
+++ b/assets/squat-radar.css
@@ -1,72 +1,72 @@
-.squat-radar.radar-event {
- margin-bottom: 1em;
- padding-bottom: 1em;
- border-bottom: 1px solid #ddd;
- text-align:left;
-}
-.squat-radar.radar-event::after {
- content: '';
- display: block;
- float: none;
- clear: both;
-}
-.squat-radar.rader-event:last-child {
- border-bottom: 0;
- padding-bottom: 0;
- margin-bottom: 0;
-}
-.squat-radar.radar-event-cancelled {
- text-decoration: line-through;
-}
-
-.squat-radar .squat-radar-title {
- line-height: 1;
- font-size: 1.4em;
- margin-bottom: 0.2em;
-}
-
-.squat-radar .squat-radar-datetime {
- font-weight: bold;
-}
-
-.squat-radar .squat-radar-datetime.squat-radar-datetime-start::before {
- content: '';
- display: block;
- float: none;
- clear: both;
-}
-
-.squat-radar .squat-radar-event-start-end::after,
-.squat-radar .squat-radar-event-start {
- content: '';
- display: block;
- float: none;
- clear: both;
-}
-
-.squat-radar .squat-radar-list li {
- display: inline;
- list-style: none;
-}
-
-.squat-radar .squat-radar-list li:after {
- content: ", ";
-}
-
-.squat-radar .squat-radar-list li:last-child:after {
- content: "";
-}
-
-.squat-radar a.squat-radar-url-more {
- padding: .4180469716em 1.11575em;
- margin-left: 10px;
-/* margin-bottom: 10px;*/
- float: right;
-}
-.squat-radar a.squat-radar-url-more:hover {
- color: white;
-}
-
-.squat_radar a.squat-radar-url-more:focus {
- outline: 0;
-}
+.squat-radar.radar-event {
+ margin-bottom: 1em;
+ padding-bottom: 1em;
+ border-bottom: 1px solid #ddd;
+ text-align:left;
+}
+.squat-radar.radar-event::after {
+ content: '';
+ display: block;
+ float: none;
+ clear: both;
+}
+.squat-radar.rader-event:last-child {
+ border-bottom: 0;
+ padding-bottom: 0;
+ margin-bottom: 0;
+}
+.squat-radar.radar-event-cancelled {
+ text-decoration: line-through;
+}
+
+.squat-radar .squat-radar-title {
+ line-height: 1;
+ font-size: 1.4em;
+ margin-bottom: 0.2em;
+}
+
+.squat-radar .squat-radar-datetime {
+ font-weight: bold;
+}
+
+.squat-radar .squat-radar-datetime.squat-radar-datetime-start::before {
+ content: '';
+ display: block;
+ float: none;
+ clear: both;
+}
+
+.squat-radar .squat-radar-event-start-end::after,
+.squat-radar .squat-radar-event-start {
+ content: '';
+ display: block;
+ float: none;
+ clear: both;
+}
+
+.squat-radar .squat-radar-list li {
+ display: inline;
+ list-style: none;
+}
+
+.squat-radar .squat-radar-list li:after {
+ content: ", ";
+}
+
+.squat-radar .squat-radar-list li:last-child:after {
+ content: "";
+}
+
+.squat-radar a.squat-radar-url-more {
+ padding: .4180469716em 1.11575em;
+ margin-left: 10px;
+/* margin-bottom: 10px;*/
+ float: right;
+}
+.squat-radar a.squat-radar-url-more:hover {
+ color: white !important;
+}
+
+.squat_radar a.squat-radar-url-more:focus {
+ outline: 0;
+}
diff --git a/assets/squat-radar.js b/assets/squat-radar.js
index 8939ee9..00394f9 100644
--- a/assets/squat-radar.js
+++ b/assets/squat-radar.js
@@ -7,7 +7,7 @@ jQuery(function($){
type: 'POST',
data: {
action: "squat_radar_events",
- instance: squat_radar_widget[widget.id],
+ instance: window[widget.id],
},
success: function(result){
@@ -20,6 +20,17 @@ jQuery(function($){
} else {
$(widget).empty();
$(widget).append(result.html);
+// $(".squat-li a").on('click', function(e){
+
+// if (this.hasAttribute("data-link")) {
+// e.preventDefault();
+// $(this).parent().find('p').show();
+// this.textContent = this.getAttribute('data-nog-meer');
+// this.setAttribute('href', this.getAttribute('data-link'));
+// this.removeAttribute('data-link');
+// }
+//
+// });
}
},
error: function(res){
diff --git a/composer.json b/composer.json
index e4456ca..5963699 100644
--- a/composer.json
+++ b/composer.json
@@ -1,5 +1,5 @@
{
- "name": "radar-wp-custom/squat-radar",
+ "name": "radar-wp/squat-radar",
"description": "Wordpress Calendar widget for https://radar.squat.net/ events",
"type": "wordpress-plugin",
"homepage": "https://radar.squat.net",
diff --git a/includes/squat-radar-formatter.php b/includes/squat-radar-formatter.php
index 06288dc..8481f49 100644
--- a/includes/squat-radar-formatter.php
+++ b/includes/squat-radar-formatter.php
@@ -209,8 +209,7 @@ class Squat_Radar_Formatter {
private static function field_date_format($time, $start_end, $time_only = FALSE) {
- $date_format = get_option('squat_radar_date_format', 'd.m.');
- $year_format = get_option('squat_radar_date_format', 'Y');
+ $date_format = get_option('squat_radar_date_format', 'j M Y');
$time_format = get_option('squat_radar_time_format', 'H:i');
// Remove offset to stop time being converted to UTC.
@@ -221,9 +220,6 @@ class Squat_Radar_Formatter {
$output .= '';
$output .= date_i18n($date_format, strtotime($time));
$output .= ' ';
- $output .= '';
- $output .= date_i18n($year_format, strtotime($time));
- $output .= ' ';
}
$output .= '';
$output .= date_i18n($time_format, strtotime($time));
@@ -305,11 +301,11 @@ class Squat_Radar_Formatter {
*/
static public function field_link_html($value, $original, $field, $context) {
if ( ($field[0] == 'title' || $field[0] == 'title_field') && ! empty($context['event']['url'])) {
- return '' . sanitize_text_field( $value ) . '';
+ return '' . sanitize_text_field( $value ) . '';
}
if ($field[0] == 'url' && count($field) == 1) {
- return '' . __('more…', 'squat-radar') . '';
+ return '' . __('more…', 'squat-radar') . '';
}
elseif ($field[0] == 'url') {
$title = esc_url($value);
diff --git a/includes/squat-radar-widget.php b/includes/squat-radar-widget.php
index 26034ac..f4a6eef 100644
--- a/includes/squat-radar-widget.php
+++ b/includes/squat-radar-widget.php
@@ -25,11 +25,11 @@ class Squat_Radar_Widget extends WP_Widget {
/**
* Register the widget
*/
- public static function register_widget() {
- register_widget( __CLASS__ );
+ public static function register_widget() {
+ register_widget( __CLASS__ );
add_action( 'wp_ajax_squat_radar_events', [__CLASS__, 'ajax_callback'] );
add_action( 'wp_ajax_nopriv_squat_radar_events', [__CLASS__, 'ajax_callback'] );
- wp_register_script( 'squat-radar-widget', SQUAT_RADAR_URL . 'assets/squat-radar.js', ['jquery'] );
+ add_action( 'wp_enqueue_scripts', [__CLASS__, 'widget_script'] );
add_action( 'wp_enqueue_scripts', [__CLASS__, 'widget_style'] );
add_action( 'squat_radar_widget_cache_cron', [__CLASS__, 'cache_cron'] );
@@ -44,6 +44,13 @@ class Squat_Radar_Widget extends WP_Widget {
wp_enqueue_style( 'squat-radar-widget' );
}
+ /**
+ * Enqueue scripts callback, add JS.
+ */
+ static public function widget_script() {
+ wp_register_script( 'squat-radar-widget', SQUAT_RADAR_URL . 'assets/squat-radar.js', ['jquery'] );
+ }
+
/**
* Cron action.
*
@@ -59,7 +66,7 @@ class Squat_Radar_Widget extends WP_Widget {
}
}
}
- update_option('squat_radar_widget_cron_run', $last_run);
+ add_option('squat_radar_widget_cron_run', $last_run);
}
/**
@@ -68,9 +75,9 @@ class Squat_Radar_Widget extends WP_Widget {
protected static function cache_refresh($instance) {
$connector = new Squat_Radar_Connector();
- $languages = apply_filters('wpml_active_languages', NULL);
- $languages = is_array($languages) ? array_keys($languages) : [];
- $languages = array_merge([$instance['url']['keys']['language']], $languages);
+ $languages = apply_filters('wpml_active_languages', NULL);
+ $languages = is_array($languages) ? array_keys($languages) : [];
+ $languages = array_merge($instance['url']['keys']['language'], $languages);
foreach ($languages as $language) {
try {
// Force update. Don't set expire.
@@ -112,12 +119,9 @@ class Squat_Radar_Widget extends WP_Widget {
}
}
else {
- wp_enqueue_script( 'squat-radar-widget');
- wp_add_inline_script('squat-radar-widget',
- 'const squat_radar_widget = ' . json_encode( [
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
- $widget_id => $this->number,
- ] ) . ';', 'before');
+ wp_enqueue_script( 'squat-radar-widget');
+ wp_localize_script( 'squat-radar-widget', 'squat_radar_widget', [ 'ajaxurl' => admin_url( 'admin-ajax.php' ) ] );
+ wp_localize_script( 'squat-radar-widget', $widget_id, ['number' => $this->number] );
echo '