forked from lino/radar-wp
Compare commits
No commits in common. "custom" and "fix/support--topic--getting-a-lot-of-errors-3" have entirely different histories.
custom
...
fix/suppor
8 changed files with 120 additions and 167 deletions
|
@ -1,72 +1,72 @@
|
||||||
.squat-radar.radar-event {
|
.squat-radar.radar-event {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
padding-bottom: 1em;
|
padding-bottom: 1em;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
text-align:left;
|
text-align:left;
|
||||||
}
|
}
|
||||||
.squat-radar.radar-event::after {
|
.squat-radar.radar-event::after {
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
float: none;
|
float: none;
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
.squat-radar.rader-event:last-child {
|
.squat-radar.rader-event:last-child {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
.squat-radar.radar-event-cancelled {
|
.squat-radar.radar-event-cancelled {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar .squat-radar-title {
|
.squat-radar .squat-radar-title {
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
font-size: 1.4em;
|
font-size: 1.4em;
|
||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar .squat-radar-datetime {
|
.squat-radar .squat-radar-datetime {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar .squat-radar-datetime.squat-radar-datetime-start::before {
|
.squat-radar .squat-radar-datetime.squat-radar-datetime-start::before {
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
float: none;
|
float: none;
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar .squat-radar-event-start-end::after,
|
.squat-radar .squat-radar-event-start-end::after,
|
||||||
.squat-radar .squat-radar-event-start {
|
.squat-radar .squat-radar-event-start {
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
float: none;
|
float: none;
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar .squat-radar-list li {
|
.squat-radar .squat-radar-list li {
|
||||||
display: inline;
|
display: inline;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar .squat-radar-list li:after {
|
.squat-radar .squat-radar-list li:after {
|
||||||
content: ", ";
|
content: ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar .squat-radar-list li:last-child:after {
|
.squat-radar .squat-radar-list li:last-child:after {
|
||||||
content: "";
|
content: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat-radar a.squat-radar-url-more {
|
.squat-radar a.squat-radar-url-more {
|
||||||
padding: .4180469716em 1.11575em;
|
padding: .4180469716em 1.11575em;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
/* margin-bottom: 10px;*/
|
/* margin-bottom: 10px;*/
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.squat-radar a.squat-radar-url-more:hover {
|
.squat-radar a.squat-radar-url-more:hover {
|
||||||
color: white;
|
color: white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.squat_radar a.squat-radar-url-more:focus {
|
.squat_radar a.squat-radar-url-more:focus {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ jQuery(function($){
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
action: "squat_radar_events",
|
action: "squat_radar_events",
|
||||||
instance: squat_radar_widget[widget.id],
|
instance: window[widget.id],
|
||||||
},
|
},
|
||||||
success: function(result){
|
success: function(result){
|
||||||
|
|
||||||
|
@ -20,6 +20,17 @@ jQuery(function($){
|
||||||
} else {
|
} else {
|
||||||
$(widget).empty();
|
$(widget).empty();
|
||||||
$(widget).append(result.html);
|
$(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){
|
error: function(res){
|
||||||
|
|
|
@ -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",
|
"description": "Wordpress Calendar widget for https://radar.squat.net/ events",
|
||||||
"type": "wordpress-plugin",
|
"type": "wordpress-plugin",
|
||||||
"homepage": "https://radar.squat.net",
|
"homepage": "https://radar.squat.net",
|
||||||
|
|
|
@ -209,8 +209,7 @@ class Squat_Radar_Formatter {
|
||||||
|
|
||||||
private static function field_date_format($time, $start_end, $time_only = FALSE) {
|
private static function field_date_format($time, $start_end, $time_only = FALSE) {
|
||||||
|
|
||||||
$date_format = get_option('squat_radar_date_format', 'd.m.');
|
$date_format = get_option('squat_radar_date_format', 'j M Y');
|
||||||
$year_format = get_option('squat_radar_date_format', 'Y');
|
|
||||||
$time_format = get_option('squat_radar_time_format', 'H:i');
|
$time_format = get_option('squat_radar_time_format', 'H:i');
|
||||||
|
|
||||||
// Remove offset to stop time being converted to UTC.
|
// Remove offset to stop time being converted to UTC.
|
||||||
|
@ -221,9 +220,6 @@ class Squat_Radar_Formatter {
|
||||||
$output .= '<span class="squat-radar-date">';
|
$output .= '<span class="squat-radar-date">';
|
||||||
$output .= date_i18n($date_format, strtotime($time));
|
$output .= date_i18n($date_format, strtotime($time));
|
||||||
$output .= '</span> ';
|
$output .= '</span> ';
|
||||||
$output .= '<span class="squat-radar-year">';
|
|
||||||
$output .= date_i18n($year_format, strtotime($time));
|
|
||||||
$output .= '</span> ';
|
|
||||||
}
|
}
|
||||||
$output .= '<span class="squat-radar-time">';
|
$output .= '<span class="squat-radar-time">';
|
||||||
$output .= date_i18n($time_format, strtotime($time));
|
$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) {
|
static public function field_link_html($value, $original, $field, $context) {
|
||||||
if ( ($field[0] == 'title' || $field[0] == 'title_field') && ! empty($context['event']['url'])) {
|
if ( ($field[0] == 'title' || $field[0] == 'title_field') && ! empty($context['event']['url'])) {
|
||||||
return '<a href="' . esc_url($context['event']['url']) . '" class="squat-radar-url squat-radar-url-title" target="_blank">' . sanitize_text_field( $value ) . '</a>';
|
return '<a href="' . esc_url($context['event']['url']) . '" class="squat-radar-url squat-radar-url-title">' . sanitize_text_field( $value ) . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($field[0] == 'url' && count($field) == 1) {
|
if ($field[0] == 'url' && count($field) == 1) {
|
||||||
return '<a href="' . esc_url_raw($value) . '" class="squat-radar-url squat-radar-url-more" target="_blank">' . __('more…', 'squat-radar') . '</a>';
|
return '<a href="' . esc_url_raw($value) . '" class="squat-radar-url squat-radar-url-more">' . __('more…', 'squat-radar') . '</a>';
|
||||||
}
|
}
|
||||||
elseif ($field[0] == 'url') {
|
elseif ($field[0] == 'url') {
|
||||||
$title = esc_url($value);
|
$title = esc_url($value);
|
||||||
|
|
|
@ -25,11 +25,11 @@ class Squat_Radar_Widget extends WP_Widget {
|
||||||
/**
|
/**
|
||||||
* Register the widget
|
* Register the widget
|
||||||
*/
|
*/
|
||||||
public static function register_widget() {
|
public static function register_widget() {
|
||||||
register_widget( __CLASS__ );
|
register_widget( __CLASS__ );
|
||||||
add_action( 'wp_ajax_squat_radar_events', [__CLASS__, 'ajax_callback'] );
|
add_action( 'wp_ajax_squat_radar_events', [__CLASS__, 'ajax_callback'] );
|
||||||
add_action( 'wp_ajax_nopriv_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( 'wp_enqueue_scripts', [__CLASS__, 'widget_style'] );
|
||||||
|
|
||||||
add_action( 'squat_radar_widget_cache_cron', [__CLASS__, 'cache_cron'] );
|
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' );
|
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.
|
* 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) {
|
protected static function cache_refresh($instance) {
|
||||||
$connector = new Squat_Radar_Connector();
|
$connector = new Squat_Radar_Connector();
|
||||||
|
|
||||||
$languages = apply_filters('wpml_active_languages', NULL);
|
$languages = apply_filters('wpml_active_languages', NULL);
|
||||||
$languages = is_array($languages) ? array_keys($languages) : [];
|
$languages = is_array($languages) ? array_keys($languages) : [];
|
||||||
$languages = array_merge([$instance['url']['keys']['language']], $languages);
|
$languages = array_merge($instance['url']['keys']['language'], $languages);
|
||||||
foreach ($languages as $language) {
|
foreach ($languages as $language) {
|
||||||
try {
|
try {
|
||||||
// Force update. Don't set expire.
|
// Force update. Don't set expire.
|
||||||
|
@ -112,12 +119,9 @@ class Squat_Radar_Widget extends WP_Widget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wp_enqueue_script( 'squat-radar-widget');
|
wp_enqueue_script( 'squat-radar-widget');
|
||||||
wp_add_inline_script('squat-radar-widget',
|
wp_localize_script( 'squat-radar-widget', 'squat_radar_widget', [ 'ajaxurl' => admin_url( 'admin-ajax.php' ) ] );
|
||||||
'const squat_radar_widget = ' . json_encode( [
|
wp_localize_script( 'squat-radar-widget', $widget_id, ['number' => $this->number] );
|
||||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
|
||||||
$widget_id => $this->number,
|
|
||||||
] ) . ';', 'before');
|
|
||||||
|
|
||||||
echo '<div id="' . $widget_id . '" class="squat-radar-widget squat-radar-ajax"><a href="' . esc_url_raw( $instance['url']['value'] ) . '">'
|
echo '<div id="' . $widget_id . '" class="squat-radar-widget squat-radar-ajax"><a href="' . esc_url_raw( $instance['url']['value'] ) . '">'
|
||||||
. esc_url( $instance['url']['value'] )
|
. esc_url( $instance['url']['value'] )
|
||||||
|
@ -138,7 +142,7 @@ class Squat_Radar_Widget extends WP_Widget {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
// Load instance configuration from ID.
|
// Load instance configuration from ID.
|
||||||
$instance_number = (int) $_POST['instance'];
|
$instance_number = (int) $_POST['instance']['number'];
|
||||||
$widget_options_all = get_option('widget_squat_radar');
|
$widget_options_all = get_option('widget_squat_radar');
|
||||||
if ( ! isset($widget_options_all[$instance_number]) ) {
|
if ( ! isset($widget_options_all[$instance_number]) ) {
|
||||||
wp_die();
|
wp_die();
|
||||||
|
@ -177,6 +181,7 @@ class Squat_Radar_Widget extends WP_Widget {
|
||||||
* Widget options.
|
* Widget options.
|
||||||
*/
|
*/
|
||||||
public function form( $instance ) {
|
public function form( $instance ) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Title.
|
// Title.
|
||||||
//
|
//
|
||||||
|
@ -324,7 +329,8 @@ class Squat_Radar_Widget extends WP_Widget {
|
||||||
* Save widget options.
|
* Save widget options.
|
||||||
*/
|
*/
|
||||||
public function update( $new_instance, $old_instance ) {
|
public function update( $new_instance, $old_instance ) {
|
||||||
$options = [];
|
$options = [];
|
||||||
|
|
||||||
if ( ! empty( $new_instance['title'] ) ) {
|
if ( ! empty( $new_instance['title'] ) ) {
|
||||||
$options['title'] = sanitize_text_field( $new_instance['title'] );
|
$options['title'] = sanitize_text_field( $new_instance['title'] );
|
||||||
}
|
}
|
||||||
|
@ -332,18 +338,10 @@ class Squat_Radar_Widget extends WP_Widget {
|
||||||
$options['title'] = '';
|
$options['title'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty($new_instance['url']) ) {
|
if ( ! empty($new_instance['url']) ) {
|
||||||
// The value passed here changes somewhere post WP5.4.
|
$keys = $this->connector->decode_search_url($new_instance['url']);
|
||||||
// More recent versions have the options array in the instance.
|
|
||||||
if (is_string($new_instance['url'])) {
|
|
||||||
$url = $new_instance['url'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$url = $new_instance['url']['value'];
|
|
||||||
}
|
|
||||||
$keys = $this->connector->decode_search_url($url);
|
|
||||||
$options['url']['keys'] = $keys;
|
$options['url']['keys'] = $keys;
|
||||||
$options['url']['value'] = $url;
|
$options['url']['value'] = $new_instance['url'];
|
||||||
if (empty($keys)) {
|
if (empty($keys)) {
|
||||||
$options['url']['error'] = 'URL not recognised';
|
$options['url']['error'] = 'URL not recognised';
|
||||||
}
|
}
|
||||||
|
@ -352,20 +350,14 @@ class Squat_Radar_Widget extends WP_Widget {
|
||||||
$options['url'] = ['value' => '', 'keys' => []];
|
$options['url'] = ['value' => '', 'keys' => []];
|
||||||
}
|
}
|
||||||
|
|
||||||
// When called by 5.9 ajax this contains the already set array.
|
$options['fields'] = [];
|
||||||
// Just check it's sane.
|
|
||||||
$options['fields'] = is_array($new_instance['fields']) ? $new_instance['fields'] : [];
|
|
||||||
array_filter($options['fields'], function ($v, $k) {
|
|
||||||
return ($v == $k) && (preg_match('([^a-zA-Z_:])', $k) === 0);
|
|
||||||
}, ARRAY_FILTER_USE_BOTH);
|
|
||||||
|
|
||||||
foreach ($this->preset_fields() as $field_name => $field_label) {
|
foreach ($this->preset_fields() as $field_name => $field_label) {
|
||||||
if ( ! empty($new_instance['field-' . $field_name]) ) {
|
if ( ! empty($new_instance['field-' . $field_name]) ) {
|
||||||
$options['fields'][$field_name] = $field_name;
|
$options['fields'][$field_name] = $field_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty($new_instance['fields']) && is_string($new_instance['fields']) ) {
|
if ( ! empty($new_instance['fields']) ) {
|
||||||
$matches = [];
|
$matches = [];
|
||||||
preg_match_all('/([a-zA-Z_:]+)/', $new_instance['fields'], $matches);
|
preg_match_all('/([a-zA-Z_:]+)/', $new_instance['fields'], $matches);
|
||||||
$options['fields'] += array_combine($matches[0], $matches[0]);
|
$options['fields'] += array_combine($matches[0], $matches[0]);
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
PATH: /wp-content/plugins/squat-radar-calendar-integration/includes/squat-radar-formatter.php
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
In dem Block der Datumsangabe wurde das Tag/Monat und Jahr separiert. (Und deutsche Zeitangaben)
|
|
||||||
|
|
||||||
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');
|
|
||||||
$time_format = get_option('squat_radar_time_format', 'H:i');
|
|
||||||
|
|
||||||
// Remove offset to stop time being converted to UTC.
|
|
||||||
$time = substr($time, 0, -6);
|
|
||||||
|
|
||||||
$output = '<span class="squat-radar-datetime squat-radar-datetime-' . $start_end .'">';
|
|
||||||
if ( ! $time_only ) {
|
|
||||||
$output .= '<span class="squat-radar-date">';
|
|
||||||
$output .= date_i18n($date_format, strtotime($time));
|
|
||||||
$output .= '</span> ';
|
|
||||||
$output .= '<span class="squat-radar-year">';
|
|
||||||
$output .= date_i18n($year_format, strtotime($time));
|
|
||||||
$output .= '</span> ';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Links werden im anderen Tab geöffnet (target="_blank" hinzufügen)
|
|
||||||
|
|
||||||
static public function field_link_html($value, $original, $field, $context) {
|
|
||||||
if ( ($field[0] == 'title' || $field[0] == 'title_field') && ! empty($context['event']['url'])) {
|
|
||||||
return '<a href="' . esc_url($context['event']['url']) . '" class="squat-radar-url squat-radar-url-title" target="_blank">' . sanitize_text_field( $value ) . '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($field[0] == 'url' && count($field) == 1) {
|
|
||||||
return '<a href="' . esc_url_raw($value) . '" class="squat-radar-url squat-radar-url-more" target="_blank">' . __('more…', 'squat-radar') . '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
css squat-radar.css
|
|
||||||
important entfernen
|
|
||||||
.squat-radar a.squat-radar-url-more:hover {
|
|
||||||
color: white !important;
|
|
||||||
}
|
|
|
@ -1,9 +1,9 @@
|
||||||
=== squat-radar ===
|
=== squat-radar ===
|
||||||
Tags: calendar,events
|
Tags: calendar,events
|
||||||
Requires at least: 5.3
|
Requires at least: 4.0
|
||||||
Tested up to: 5.9
|
Tested up to: 5.8
|
||||||
Requires PHP: 7.4.0
|
Requires PHP: 5.4.0
|
||||||
Stable tag: 2.0.9
|
Stable tag: 2.0.8
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,15 @@
|
||||||
* @package Squat_Radar
|
* @package Squat_Radar
|
||||||
*
|
*
|
||||||
* @wordpress-plugin
|
* @wordpress-plugin
|
||||||
* Plugin Name: Squat Radar calendar integration custom
|
* Plugin Name: Squat Radar calendar integration
|
||||||
* Plugin URI: https://0xacab.org/radar/radar-wp
|
* Plugin URI: https://0xacab.org/radar/radar-wp
|
||||||
* Description: Provides widget, and shortcode, integration for displaying events from https://radar.squat.net/ agenda.
|
* Description: Provides widget, and shortcode, integration for displaying events from https://radar.squat.net/ agenda.
|
||||||
* Version: 2.0.9
|
* Version: 2.0.8
|
||||||
* Author: Radar contributors
|
* Author: Radar contributors
|
||||||
* License: GPL-2.0+
|
* License: GPL-2.0+
|
||||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||||
* Text Domain: squat-radar
|
* Text Domain: squat-radar
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
* Gitea Plugin URI: https://git.systemausfall.org/newyorck/radar-wp-custom
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue