Version Description
March 15, 2015 =
Added option to always enqueue scripts and styles on every post and page.
Added custom date range grid option to display modes.
Added option to disable the plugin CSS file.
Fixed bug with list intervals.
Fixed bug with event list showing past events.
Minor public JavaScript performance updates.
Download this release
Release Info
Developer | pderksen |
Plugin | Simple Calendar – Google Calendar Plugin |
Version | 2.2.2 |
Comparing to | |
See all releases |
Code changes from version 2.2.1 to 2.2.2
- README.txt +9 -0
- class-google-calendar-events.php +29 -25
- google-calendar-events.php +2 -2
- includes/class-gce-display.php +10 -10
- includes/class-gce-event.php +5 -1
- includes/class-gce-feed.php +4 -2
- includes/gce-feed-cpt.php +6 -3
- includes/misc-functions.php +20 -5
- includes/register-settings.php +9 -2
- includes/shortcodes.php +1 -1
- js/gce-admin.js +2 -2
- js/gce-script.js +25 -18
- languages/gce-de_DE.mo +0 -0
- languages/gce-de_DE.po +4 -2
- views/admin/gce-feed-meta-display.php +4 -3
- views/widgets.php +12 -6
README.txt
CHANGED
@@ -89,6 +89,15 @@ There are three ways to install this plugin.
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= 2.2.1 - February 28, 2015 =
|
93 |
|
94 |
* Enqueue scripts & styles on all posts & pages temporarily until better detection can be put in place.
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 2.2.2 - March 15, 2015 =
|
93 |
+
|
94 |
+
* Added option to always enqueue scripts and styles on every post and page.
|
95 |
+
* Added custom date range grid option to display modes.
|
96 |
+
* Added option to disable the plugin CSS file.
|
97 |
+
* Fixed bug with list intervals.
|
98 |
+
* Fixed bug with event list showing past events.
|
99 |
+
* Minor public JavaScript performance updates.
|
100 |
+
|
101 |
= 2.2.1 - February 28, 2015 =
|
102 |
|
103 |
* Enqueue scripts & styles on all posts & pages temporarily until better detection can be put in place.
|
class-google-calendar-events.php
CHANGED
@@ -18,7 +18,7 @@ class Google_Calendar_Events {
|
|
18 |
*
|
19 |
* @var string
|
20 |
*/
|
21 |
-
protected $version = '2.2.
|
22 |
|
23 |
/**
|
24 |
* Unique identifier for the plugin.
|
@@ -77,7 +77,7 @@ class Google_Calendar_Events {
|
|
77 |
|
78 |
public function localize_main_script() {
|
79 |
|
80 |
-
|
81 |
global $localize;
|
82 |
|
83 |
wp_localize_script( GCE_PLUGIN_SLUG . '-public', 'gce_grid', $localize );
|
@@ -89,40 +89,44 @@ class Google_Calendar_Events {
|
|
89 |
'ajaxnonce' => wp_create_nonce( 'gce_ajax_nonce' ),
|
90 |
'loadingText' => __( 'Loading...', 'gce' )
|
91 |
) );
|
92 |
-
|
93 |
}
|
94 |
|
95 |
public function load_scripts( $posts ) {
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
//
|
100 |
-
|
101 |
-
wp_enqueue_style( $this->plugin_slug . '-public' );
|
102 |
-
|
103 |
-
// Load JS
|
104 |
-
wp_enqueue_script( $this->plugin_slug . '-public' );
|
105 |
-
|
106 |
-
//$this->show_scripts = true;
|
107 |
-
|
108 |
-
//return $posts;
|
109 |
-
//}
|
110 |
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
120 |
|
121 |
// Load JS
|
122 |
wp_enqueue_script( $this->plugin_slug . '-public' );
|
123 |
|
124 |
$this->show_scripts = true;
|
125 |
-
}
|
126 |
|
127 |
return $posts;
|
128 |
}
|
18 |
*
|
19 |
* @var string
|
20 |
*/
|
21 |
+
protected $version = '2.2.2';
|
22 |
|
23 |
/**
|
24 |
* Unique identifier for the plugin.
|
77 |
|
78 |
public function localize_main_script() {
|
79 |
|
80 |
+
if( $this->show_scripts ) {
|
81 |
global $localize;
|
82 |
|
83 |
wp_localize_script( GCE_PLUGIN_SLUG . '-public', 'gce_grid', $localize );
|
89 |
'ajaxnonce' => wp_create_nonce( 'gce_ajax_nonce' ),
|
90 |
'loadingText' => __( 'Loading...', 'gce' )
|
91 |
) );
|
92 |
+
}
|
93 |
}
|
94 |
|
95 |
public function load_scripts( $posts ) {
|
96 |
|
97 |
+
global $gce_options;
|
98 |
+
|
99 |
+
// Init enqueue flag.
|
100 |
+
$do_enqueue = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
if ( isset( $gce_options['always_enqueue'] ) ) {
|
103 |
+
|
104 |
+
$do_enqueue = true;
|
105 |
+
|
106 |
+
} elseif ( ! empty( $posts ) ) {
|
107 |
+
|
108 |
+
foreach ( $posts as $post ) {
|
109 |
+
|
110 |
+
if ( ( strpos( $post->post_content, '[gcal' ) !== false ) || ( $post->post_type == 'gce_feed' ) ) {
|
111 |
+
|
112 |
+
$do_enqueue = true;
|
113 |
+
break;
|
114 |
+
}
|
115 |
+
}
|
116 |
}
|
117 |
+
|
118 |
+
if ( true == $do_enqueue ) {
|
119 |
+
|
120 |
+
// Load CSS after checking to see if it is supposed to be disabled or not (based on settings)
|
121 |
+
if( ! isset( $gce_options['disable_css'] ) ) {
|
122 |
+
wp_enqueue_style( $this->plugin_slug . '-public' );
|
123 |
+
}
|
124 |
|
125 |
// Load JS
|
126 |
wp_enqueue_script( $this->plugin_slug . '-public' );
|
127 |
|
128 |
$this->show_scripts = true;
|
129 |
+
}
|
130 |
|
131 |
return $posts;
|
132 |
}
|
google-calendar-events.php
CHANGED
@@ -11,8 +11,8 @@
|
|
11 |
* @wordpress-plugin
|
12 |
* Plugin Name: Google Calendar Events
|
13 |
* Plugin URI: https://github.com/pderksen/WP-Google-Calendar-Events
|
14 |
-
* Description:
|
15 |
-
* Version: 2.2.
|
16 |
* Author: Phil Derksen
|
17 |
* Author URI: http://philderksen.com
|
18 |
* License: GPL-2.0+
|
11 |
* @wordpress-plugin
|
12 |
* Plugin Name: Google Calendar Events
|
13 |
* Plugin URI: https://github.com/pderksen/WP-Google-Calendar-Events
|
14 |
+
* Description: Show off your Google calendar in grid (month) or list view, in a post, page or widget, and in a style that matches your site.
|
15 |
+
* Version: 2.2.2
|
16 |
* Author: Phil Derksen
|
17 |
* Author URI: http://philderksen.com
|
18 |
* License: GPL-2.0+
|
includes/class-gce-display.php
CHANGED
@@ -202,7 +202,7 @@ class GCE_Display {
|
|
202 |
$paging_type = $paging_type;
|
203 |
|
204 |
$max_length = null;
|
205 |
-
|
206 |
if( $paging_type == 'events' ) {
|
207 |
$max_length = 'events';
|
208 |
}
|
@@ -226,7 +226,7 @@ class GCE_Display {
|
|
226 |
}
|
227 |
}
|
228 |
|
229 |
-
$use_range = (
|
230 |
|
231 |
if( $use_range ) {
|
232 |
$max_length = 'date-range';
|
@@ -244,18 +244,18 @@ class GCE_Display {
|
|
244 |
if( empty( $max_num ) || $max_num == 0 ) {
|
245 |
$max_num = 7;
|
246 |
}
|
247 |
-
|
248 |
-
$max_length = get_post_meta( $an_event_feed_id, 'gce_events_per_page', true );
|
249 |
|
250 |
-
if( $
|
251 |
-
$paging_interval
|
252 |
-
|
|
|
|
|
253 |
$paging_interval = 604800;
|
254 |
|
255 |
// Set week start here too
|
256 |
$start_of_week = get_option( 'start_of_week' );
|
257 |
$start = mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) + $start_of_week ), date( 'Y' ) );
|
258 |
-
} else if( $
|
259 |
$paging_interval = 2629743;
|
260 |
|
261 |
// Set month start here too
|
@@ -304,9 +304,9 @@ class GCE_Display {
|
|
304 |
$max_count = 1;
|
305 |
$has_events = false;
|
306 |
$event_counter = 0;
|
307 |
-
|
308 |
if( $max_length == 'events' ) {
|
309 |
-
if( $start_offset === null ) {
|
310 |
$time_now = current_time( 'timestamp' );
|
311 |
} else {
|
312 |
|
202 |
$paging_type = $paging_type;
|
203 |
|
204 |
$max_length = null;
|
205 |
+
|
206 |
if( $paging_type == 'events' ) {
|
207 |
$max_length = 'events';
|
208 |
}
|
226 |
}
|
227 |
}
|
228 |
|
229 |
+
$use_range = ( $paging_interval == 'date-range' ? true : false );
|
230 |
|
231 |
if( $use_range ) {
|
232 |
$max_length = 'date-range';
|
244 |
if( empty( $max_num ) || $max_num == 0 ) {
|
245 |
$max_num = 7;
|
246 |
}
|
|
|
|
|
247 |
|
248 |
+
if( $paging_type == 'days' ) {
|
249 |
+
if( $paging_interval == null ) {
|
250 |
+
$paging_interval = $max_num * 86400;
|
251 |
+
}
|
252 |
+
} else if( $paging_type == 'week' ) {
|
253 |
$paging_interval = 604800;
|
254 |
|
255 |
// Set week start here too
|
256 |
$start_of_week = get_option( 'start_of_week' );
|
257 |
$start = mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) + $start_of_week ), date( 'Y' ) );
|
258 |
+
} else if( $paging_type == 'month' ) {
|
259 |
$paging_interval = 2629743;
|
260 |
|
261 |
// Set month start here too
|
304 |
$max_count = 1;
|
305 |
$has_events = false;
|
306 |
$event_counter = 0;
|
307 |
+
|
308 |
if( $max_length == 'events' ) {
|
309 |
+
if( $start_offset === null || $start_offset == 0 ) {
|
310 |
$time_now = current_time( 'timestamp' );
|
311 |
} else {
|
312 |
|
includes/class-gce-event.php
CHANGED
@@ -35,7 +35,11 @@ class GCE_Event {
|
|
35 |
$this->day_type = 'SWD';
|
36 |
} else {
|
37 |
if ( ( '12:00 am' == date( 'g:i a', $start_time ) ) && ( '12:00 am' == date( 'g:i a', $end_time ) ) ) {
|
38 |
-
$
|
|
|
|
|
|
|
|
|
39 |
} else {
|
40 |
$this->day_type = 'MPD';
|
41 |
}
|
35 |
$this->day_type = 'SWD';
|
36 |
} else {
|
37 |
if ( ( '12:00 am' == date( 'g:i a', $start_time ) ) && ( '12:00 am' == date( 'g:i a', $end_time ) ) ) {
|
38 |
+
if( $end_time - $start_time > 86400 ) {
|
39 |
+
$this->day_type = 'MWD';
|
40 |
+
} else {
|
41 |
+
$this->day_type = 'SWD';
|
42 |
+
}
|
43 |
} else {
|
44 |
$this->day_type = 'MPD';
|
45 |
}
|
includes/class-gce-feed.php
CHANGED
@@ -230,7 +230,8 @@ class GCE_Feed {
|
|
230 |
|
231 |
private function get_feed_start() {
|
232 |
|
233 |
-
$
|
|
|
234 |
|
235 |
if( $use_range ) {
|
236 |
$start = get_post_meta( $this->id, 'gce_feed_range_start', true );
|
@@ -265,7 +266,8 @@ class GCE_Feed {
|
|
265 |
|
266 |
private function get_feed_end() {
|
267 |
|
268 |
-
$
|
|
|
269 |
|
270 |
if( $use_range ) {
|
271 |
$end = get_post_meta( $this->id, 'gce_feed_range_end', true );
|
230 |
|
231 |
private function get_feed_start() {
|
232 |
|
233 |
+
$range = get_post_meta( $this->id, 'gce_display_mode', true );
|
234 |
+
$use_range = ( ( $range == 'date-range-list' || $range == 'date-range-grid' ) ? true : false );
|
235 |
|
236 |
if( $use_range ) {
|
237 |
$start = get_post_meta( $this->id, 'gce_feed_range_start', true );
|
266 |
|
267 |
private function get_feed_end() {
|
268 |
|
269 |
+
$range = get_post_meta( $this->id, 'gce_display_mode', true );
|
270 |
+
$use_range = ( ( $range == 'date-range-list' || $range == 'date-range-grid' ) ? true : false );
|
271 |
|
272 |
if( $use_range ) {
|
273 |
$end = get_post_meta( $this->id, 'gce_feed_range_end', true );
|
includes/gce-feed-cpt.php
CHANGED
@@ -266,13 +266,16 @@ function gce_column_content( $column_name, $post_ID ) {
|
|
266 |
case 'display-type':
|
267 |
$display = get_post_meta( $post_ID, 'gce_display_mode', true );
|
268 |
|
269 |
-
if( $display == 'grid' ) {
|
270 |
echo __( 'Grid', 'gce' );
|
271 |
-
}
|
272 |
echo __( 'List', 'gce' );
|
273 |
-
}
|
274 |
echo __( 'Grouped List', 'gce' );
|
|
|
|
|
275 |
}
|
|
|
276 |
break;
|
277 |
}
|
278 |
}
|
266 |
case 'display-type':
|
267 |
$display = get_post_meta( $post_ID, 'gce_display_mode', true );
|
268 |
|
269 |
+
if ( $display == 'grid' ) {
|
270 |
echo __( 'Grid', 'gce' );
|
271 |
+
} elseif ( $display == 'list' ) {
|
272 |
echo __( 'List', 'gce' );
|
273 |
+
} elseif ( $display == 'list-grouped' ) {
|
274 |
echo __( 'Grouped List', 'gce' );
|
275 |
+
} elseif ( $display == 'date-range' ) {
|
276 |
+
echo __( 'Custom Date Range', 'gce' );
|
277 |
}
|
278 |
+
|
279 |
break;
|
280 |
}
|
281 |
}
|
includes/misc-functions.php
CHANGED
@@ -46,10 +46,6 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid
|
|
46 |
$markup = '';
|
47 |
$start = current_time( 'timestamp' );
|
48 |
|
49 |
-
if( $range_start === null ) {
|
50 |
-
$range_start = $d->feeds[$feed_ids]->feed_start;
|
51 |
-
}
|
52 |
-
|
53 |
if( $widget ) {
|
54 |
foreach( $ids as $f ) {
|
55 |
$paging = get_post_meta( $f, 'gce_paging_widget', true );
|
@@ -113,7 +109,7 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid
|
|
113 |
} else {
|
114 |
$markup = '<div class="gce-page-list gce-page-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type ) . '</div>';
|
115 |
}
|
116 |
-
} else if( 'date-range' == $display ) {
|
117 |
|
118 |
$paging_interval = 'date-range';
|
119 |
|
@@ -122,6 +118,25 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid
|
|
122 |
} else {
|
123 |
$markup = '<div class="gce-page-list gce-page-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, $range_start, false, $paging_interval, $start_offset, INF, $paging_type, INF ) . '</div>';
|
124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
// Reset post meta
|
46 |
$markup = '';
|
47 |
$start = current_time( 'timestamp' );
|
48 |
|
|
|
|
|
|
|
|
|
49 |
if( $widget ) {
|
50 |
foreach( $ids as $f ) {
|
51 |
$paging = get_post_meta( $f, 'gce_paging_widget', true );
|
109 |
} else {
|
110 |
$markup = '<div class="gce-page-list gce-page-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type ) . '</div>';
|
111 |
}
|
112 |
+
} else if( 'date-range-list' == $display ) {
|
113 |
|
114 |
$paging_interval = 'date-range';
|
115 |
|
118 |
} else {
|
119 |
$markup = '<div class="gce-page-list gce-page-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, $range_start, false, $paging_interval, $start_offset, INF, $paging_type, INF ) . '</div>';
|
120 |
}
|
121 |
+
} elseif ( 'date-range-grid' == $display ) {
|
122 |
+
|
123 |
+
global $localize;
|
124 |
+
|
125 |
+
$target = 'gce-' . $uid;
|
126 |
+
|
127 |
+
$localize[$target] = array(
|
128 |
+
'target_element' => $target,
|
129 |
+
'feed_ids' => $feed_ids,
|
130 |
+
'title_text' => $title_text,
|
131 |
+
'type' => ( $widget == 1 ? 'widget' : 'page' ),
|
132 |
+
'show_tooltips' => ( $show_tooltips == 'true' || $show_tooltips == '1' ? 'true' : 'false' )
|
133 |
+
);
|
134 |
+
|
135 |
+
if( $widget ) {
|
136 |
+
$markup = '<div class="gce-widget-grid gce-widget-grid-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $markup .= $d->get_grid( $year, $month, $widget, $paging ) . '</div>';
|
137 |
+
} else {
|
138 |
+
$markup = '<div class="gce-page-grid gce-page-grid-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $markup .= $d->get_grid( $year, $month, $widget, $paging ) . '</div>';
|
139 |
+
}
|
140 |
}
|
141 |
|
142 |
// Reset post meta
|
includes/register-settings.php
CHANGED
@@ -34,12 +34,18 @@ function gce_register_settings() {
|
|
34 |
'size' => 'regular-text',
|
35 |
'type' => 'text'
|
36 |
),
|
37 |
-
|
38 |
'id' => 'always_enqueue',
|
39 |
'name' => __( 'Always Enqueue Scripts & Styles', 'sc' ),
|
40 |
'desc' => __( sprintf( 'Enqueue this plugin\'s scripts and styles on every post and page. Useful if using shortcodes in widgets or other non-standard locations.' ), 'gce' ),
|
41 |
'type' => 'checkbox'
|
42 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
'save_settings' => array(
|
44 |
'id' => 'save_settings',
|
45 |
'name' => __( 'Save Settings', 'gce' ),
|
@@ -190,6 +196,7 @@ function gce_get_settings() {
|
|
190 |
$general = get_option( 'gce_settings_general' );
|
191 |
|
192 |
$general['save_settings'] = 1;
|
|
|
193 |
|
194 |
update_option( 'gce_settings_general', $general );
|
195 |
}
|
34 |
'size' => 'regular-text',
|
35 |
'type' => 'text'
|
36 |
),
|
37 |
+
'always_enqueue' => array(
|
38 |
'id' => 'always_enqueue',
|
39 |
'name' => __( 'Always Enqueue Scripts & Styles', 'sc' ),
|
40 |
'desc' => __( sprintf( 'Enqueue this plugin\'s scripts and styles on every post and page. Useful if using shortcodes in widgets or other non-standard locations.' ), 'gce' ),
|
41 |
'type' => 'checkbox'
|
42 |
+
),
|
43 |
+
'disable_css' => array(
|
44 |
+
'id' => 'disable_css',
|
45 |
+
'name' => __( 'Disable Plugin CSS', 'sc' ),
|
46 |
+
'desc' => __( "If this option is checked, this plugin's CSS file will not be referenced.", 'gce' ),
|
47 |
+
'type' => 'checkbox'
|
48 |
+
),
|
49 |
'save_settings' => array(
|
50 |
'id' => 'save_settings',
|
51 |
'name' => __( 'Save Settings', 'gce' ),
|
196 |
$general = get_option( 'gce_settings_general' );
|
197 |
|
198 |
$general['save_settings'] = 1;
|
199 |
+
$general['always_enqueue'] = 1;
|
200 |
|
201 |
update_option( 'gce_settings_general', $general );
|
202 |
}
|
includes/shortcodes.php
CHANGED
@@ -112,7 +112,7 @@ function gce_gcal_shortcode( $attr ) {
|
|
112 |
$start_offset = $offset_interval_count * 86400 * $offset_direction;
|
113 |
|
114 |
if( $interval == 'days' ) {
|
115 |
-
$paging_interval =
|
116 |
$paging_type = 'days';
|
117 |
} else if( $interval == 'events' ) {
|
118 |
$max_events = $interval_count;
|
112 |
$start_offset = $offset_interval_count * 86400 * $offset_direction;
|
113 |
|
114 |
if( $interval == 'days' ) {
|
115 |
+
$paging_interval = $interval_count * 86400;
|
116 |
$paging_type = 'days';
|
117 |
} else if( $interval == 'events' ) {
|
118 |
$max_events = $interval_count;
|
js/gce-admin.js
CHANGED
@@ -27,7 +27,7 @@
|
|
27 |
|
28 |
$('body').on('change', 'select[id*=display_type]', function() {
|
29 |
|
30 |
-
if( $(this).val() == 'date-range' ) {
|
31 |
$(this).parent().parent().children('.gce-display-option').hide();
|
32 |
$(this).parent().parent().children('.gce-custom-range').show();
|
33 |
} else {
|
@@ -38,7 +38,7 @@
|
|
38 |
|
39 |
// For main settings page
|
40 |
$('body').on('change', 'select[id*=gce_display_mode]', function() {
|
41 |
-
if( $(this).val() == 'date-range' ) {
|
42 |
$('.gce-display-option').hide();
|
43 |
$('.gce-custom-range').show();
|
44 |
} else {
|
27 |
|
28 |
$('body').on('change', 'select[id*=display_type]', function() {
|
29 |
|
30 |
+
if( $(this).val() == 'date-range-list' || $(this).val() == 'date-range-grid' ) {
|
31 |
$(this).parent().parent().children('.gce-display-option').hide();
|
32 |
$(this).parent().parent().children('.gce-custom-range').show();
|
33 |
} else {
|
38 |
|
39 |
// For main settings page
|
40 |
$('body').on('change', 'select[id*=gce_display_mode]', function() {
|
41 |
+
if( $(this).val() == 'date-range-list' || $(this).val() == 'date-range-grid' ) {
|
42 |
$('.gce-display-option').hide();
|
43 |
$('.gce-custom-range').show();
|
44 |
} else {
|
js/gce-script.js
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
/* global jQuery, gce, gce_grid */
|
2 |
-
|
3 |
/**
|
4 |
* Public JS functions
|
5 |
*
|
@@ -8,6 +6,9 @@
|
|
8 |
* @license GPL-2.0+
|
9 |
* @copyright 2014 Phil Derksen
|
10 |
*/
|
|
|
|
|
|
|
11 |
(function($) {
|
12 |
'use strict';
|
13 |
|
@@ -16,6 +17,8 @@
|
|
16 |
|
17 |
$(function() {
|
18 |
|
|
|
|
|
19 |
if( typeof gce_grid != 'undefined' ) {
|
20 |
|
21 |
if (script_debug) {
|
@@ -24,7 +27,7 @@
|
|
24 |
|
25 |
var tooltip_elements = '';
|
26 |
|
27 |
-
$('.gce-page-grid, .gce-widget-grid').each( function() {
|
28 |
var id = $(this).attr('id');
|
29 |
|
30 |
if( gce_grid[id].show_tooltips == 'true' || gce_grid[id].show_tooltips == true ) {
|
@@ -37,9 +40,10 @@
|
|
37 |
gce_tooltips(tooltip_elements);
|
38 |
|
39 |
// Month nav link click for Grid view.
|
40 |
-
|
|
|
41 |
|
42 |
-
|
43 |
|
44 |
var navLink = $(this);
|
45 |
|
@@ -54,7 +58,7 @@
|
|
54 |
var paging = navLink.attr('data-gce-grid-paging');
|
55 |
|
56 |
//Add loading text to table caption
|
57 |
-
$('#' + gce_grid[id].target_element + ' caption').html(gce.loadingText);
|
58 |
|
59 |
//Send AJAX request
|
60 |
$.post(gce.ajaxurl,{
|
@@ -68,12 +72,16 @@
|
|
68 |
gce_year: month_year[1],
|
69 |
gce_paging: paging,
|
70 |
gce_nonce: gce.ajaxnonce
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
gce_tooltips(tooltip_elements);
|
@@ -81,15 +89,14 @@
|
|
81 |
}).fail(function(data) {
|
82 |
console.log( data );
|
83 |
});
|
84 |
-
|
85 |
-
e.stopPropagation();
|
86 |
});
|
87 |
}
|
88 |
|
89 |
// Month nav link click for List view.
|
90 |
-
|
|
|
91 |
|
92 |
-
|
93 |
|
94 |
var navLink = $(this);
|
95 |
|
@@ -123,13 +130,13 @@
|
|
123 |
gce_start_offset: start_offset,
|
124 |
gce_paging_type: paging_type,
|
125 |
gce_nonce: gce.ajaxnonce
|
|
|
126 |
}, function(data){
|
127 |
navLink.parents('.gce-list').replaceWith(data);
|
|
|
128 |
}).fail(function(data) {
|
129 |
console.log( data );
|
130 |
});
|
131 |
-
|
132 |
-
e.stopPropagation();
|
133 |
});
|
134 |
|
135 |
// Tooltip config using qTip2 jQuery plugin.
|
|
|
|
|
1 |
/**
|
2 |
* Public JS functions
|
3 |
*
|
6 |
* @license GPL-2.0+
|
7 |
* @copyright 2014 Phil Derksen
|
8 |
*/
|
9 |
+
|
10 |
+
/* global jQuery, gce, gce_grid */
|
11 |
+
|
12 |
(function($) {
|
13 |
'use strict';
|
14 |
|
17 |
|
18 |
$(function() {
|
19 |
|
20 |
+
var $body = $( 'body' );
|
21 |
+
|
22 |
if( typeof gce_grid != 'undefined' ) {
|
23 |
|
24 |
if (script_debug) {
|
27 |
|
28 |
var tooltip_elements = '';
|
29 |
|
30 |
+
$body.find('.gce-page-grid, .gce-widget-grid').each( function() {
|
31 |
var id = $(this).attr('id');
|
32 |
|
33 |
if( gce_grid[id].show_tooltips == 'true' || gce_grid[id].show_tooltips == true ) {
|
40 |
gce_tooltips(tooltip_elements);
|
41 |
|
42 |
// Month nav link click for Grid view.
|
43 |
+
// TODO Unbind other attached clicks here?
|
44 |
+
$body.on( 'click.gceNavLink', '.gce-change-month', function( event ) {
|
45 |
|
46 |
+
event.preventDefault();
|
47 |
|
48 |
var navLink = $(this);
|
49 |
|
58 |
var paging = navLink.attr('data-gce-grid-paging');
|
59 |
|
60 |
//Add loading text to table caption
|
61 |
+
$body.find('#' + gce_grid[id].target_element + ' caption').html(gce.loadingText);
|
62 |
|
63 |
//Send AJAX request
|
64 |
$.post(gce.ajaxurl,{
|
72 |
gce_year: month_year[1],
|
73 |
gce_paging: paging,
|
74 |
gce_nonce: gce.ajaxnonce
|
75 |
+
|
76 |
+
}, function(data) {
|
77 |
+
|
78 |
+
//Replace existing data with returned AJAX data.
|
79 |
+
var targetEle = $body.find('#' + gce_grid[id].target_element);
|
80 |
+
|
81 |
+
if (gce_grid[id].type == 'widget') {
|
82 |
+
targetEle.html(data);
|
83 |
+
} else {
|
84 |
+
targetEle.replaceWith(data);
|
85 |
}
|
86 |
|
87 |
gce_tooltips(tooltip_elements);
|
89 |
}).fail(function(data) {
|
90 |
console.log( data );
|
91 |
});
|
|
|
|
|
92 |
});
|
93 |
}
|
94 |
|
95 |
// Month nav link click for List view.
|
96 |
+
// TODO Unbind other attached clicks here?
|
97 |
+
$body.on( 'click.gceNavLink', '.gce-change-month-list', function( event ) {
|
98 |
|
99 |
+
event.preventDefault();
|
100 |
|
101 |
var navLink = $(this);
|
102 |
|
130 |
gce_start_offset: start_offset,
|
131 |
gce_paging_type: paging_type,
|
132 |
gce_nonce: gce.ajaxnonce
|
133 |
+
|
134 |
}, function(data){
|
135 |
navLink.parents('.gce-list').replaceWith(data);
|
136 |
+
|
137 |
}).fail(function(data) {
|
138 |
console.log( data );
|
139 |
});
|
|
|
|
|
140 |
});
|
141 |
|
142 |
// Tooltip config using qTip2 jQuery plugin.
|
languages/gce-de_DE.mo
CHANGED
Binary file
|
languages/gce-de_DE.po
CHANGED
@@ -13,7 +13,7 @@ msgstr ""
|
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
16 |
-
"X-Generator: Poedit 1.
|
17 |
"X-Poedit-Basepath: ..\n"
|
18 |
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
19 |
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
|
@@ -21,6 +21,8 @@ msgstr ""
|
|
21 |
"X-Poedit-SourceCharset: UTF-8\n"
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
23 |
|
|
|
|
|
24 |
# changelog 2014-10-26:
|
25 |
# removed inactive French translations from file
|
26 |
# switched translation header to de_DE
|
@@ -54,7 +56,7 @@ msgstr "Cache leeren"
|
|
54 |
#: google-calendar-events/views/admin/gce-feed-meta-display.php:170
|
55 |
#: google-calendar-events/views/widgets.php:252
|
56 |
msgid "Back"
|
57 |
-
msgstr "
|
58 |
|
59 |
#: google-calendar-events/includes/class-gce-display.php:192
|
60 |
#: google-calendar-events/includes/class-gce-display.php:278
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
16 |
+
"X-Generator: Poedit 1.7.4\n"
|
17 |
"X-Poedit-Basepath: ..\n"
|
18 |
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
19 |
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
|
21 |
"X-Poedit-SourceCharset: UTF-8\n"
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
23 |
|
24 |
+
# changelog 2015-03-02:
|
25 |
+
# see https://github.com/pderksen/WP-Google-Calendar-Events/pull/30
|
26 |
# changelog 2014-10-26:
|
27 |
# removed inactive French translations from file
|
28 |
# switched translation header to de_DE
|
56 |
#: google-calendar-events/views/admin/gce-feed-meta-display.php:170
|
57 |
#: google-calendar-events/views/widgets.php:252
|
58 |
msgid "Back"
|
59 |
+
msgstr "Zurück"
|
60 |
|
61 |
#: google-calendar-events/includes/class-gce-display.php:192
|
62 |
#: google-calendar-events/includes/class-gce-display.php:278
|
views/admin/gce-feed-meta-display.php
CHANGED
@@ -39,8 +39,8 @@
|
|
39 |
$gce_feed_range_start = get_post_meta( $post->ID, 'gce_feed_range_start', true );
|
40 |
$gce_feed_range_end = get_post_meta( $post->ID, 'gce_feed_range_end', true );
|
41 |
|
42 |
-
|
43 |
-
$use_range = (
|
44 |
|
45 |
if( empty( $gce_events_per_page ) ) {
|
46 |
$gce_events_per_page = 'days';
|
@@ -136,7 +136,8 @@
|
|
136 |
<option value="grid" <?php selected( $gce_display_mode, 'grid', true ); ?>><?php _e( 'Grid (Month view)', 'gce' ); ?></option>
|
137 |
<option value="list" <?php selected( $gce_display_mode, 'list', true ); ?>><?php _e( 'List', 'gce' ); ?></option>
|
138 |
<option value="list-grouped" <?php selected( $gce_display_mode, 'list-grouped', true ); ?>><?php _e( 'Grouped List', 'gce' ); ?></option>
|
139 |
-
<option value="date-range" <?php selected( $gce_display_mode, 'date-range', true ); ?>><?php _e( 'Custom Date Range (List)', 'gce' ); ?></option>
|
|
|
140 |
</select>
|
141 |
<p class="description"><?php _e( 'Select how to display this feed.', 'gce' ); ?></p>
|
142 |
</td>
|
39 |
$gce_feed_range_start = get_post_meta( $post->ID, 'gce_feed_range_start', true );
|
40 |
$gce_feed_range_end = get_post_meta( $post->ID, 'gce_feed_range_end', true );
|
41 |
|
42 |
+
$range = selected( $gce_display_mode, 'date-range-list', false ) || selected( $gce_display_mode, 'date-range-grid', false );
|
43 |
+
$use_range = ( $range ? true : false );
|
44 |
|
45 |
if( empty( $gce_events_per_page ) ) {
|
46 |
$gce_events_per_page = 'days';
|
136 |
<option value="grid" <?php selected( $gce_display_mode, 'grid', true ); ?>><?php _e( 'Grid (Month view)', 'gce' ); ?></option>
|
137 |
<option value="list" <?php selected( $gce_display_mode, 'list', true ); ?>><?php _e( 'List', 'gce' ); ?></option>
|
138 |
<option value="list-grouped" <?php selected( $gce_display_mode, 'list-grouped', true ); ?>><?php _e( 'Grouped List', 'gce' ); ?></option>
|
139 |
+
<option value="date-range-list" <?php selected( $gce_display_mode, 'date-range-list', true ); ?>><?php _e( 'Custom Date Range (List)', 'gce' ); ?></option>
|
140 |
+
<option value="date-range-grid" <?php selected( $gce_display_mode, 'date-range-grid', true ); ?>><?php _e( 'Custom Date Range (Grid)', 'gce' ); ?></option>
|
141 |
</select>
|
142 |
<p class="description"><?php _e( 'Select how to display this feed.', 'gce' ); ?></p>
|
143 |
</td>
|
views/widgets.php
CHANGED
@@ -41,8 +41,13 @@ class GCE_Widget extends WP_Widget {
|
|
41 |
}
|
42 |
|
43 |
function gce_widget_add_styles() {
|
|
|
|
|
|
|
44 |
// Load CSS
|
45 |
-
|
|
|
|
|
46 |
}
|
47 |
|
48 |
/**
|
@@ -71,7 +76,7 @@ class GCE_Widget extends WP_Widget {
|
|
71 |
|
72 |
|
73 |
// Get custom date range if set
|
74 |
-
if( 'date-range' == $display_type ) {
|
75 |
$range_start = ( isset( $instance['feed_range_start'] ) ? $instance['feed_range_start'] : null );
|
76 |
$range_end = ( isset( $instance['feed_range_end'] ) ? $instance['feed_range_end'] : null );
|
77 |
|
@@ -101,7 +106,7 @@ class GCE_Widget extends WP_Widget {
|
|
101 |
|
102 |
$paging_interval = null;
|
103 |
|
104 |
-
if( $display_type == 'date-range' ) {
|
105 |
$max_length = 'date-range';
|
106 |
}
|
107 |
|
@@ -188,7 +193,7 @@ class GCE_Widget extends WP_Widget {
|
|
188 |
$args['grouped'] = 1;
|
189 |
}
|
190 |
|
191 |
-
if( 'date-range' == $display_type ) {
|
192 |
$args['max_events'] = INF;
|
193 |
$args['max_num'] = INF;
|
194 |
}
|
@@ -269,7 +274,7 @@ class GCE_Widget extends WP_Widget {
|
|
269 |
$list_start_offset_direction = ( isset( $instance['list_start_offset_direction'] ) ? $instance['list_start_offset_direction'] : 'back' );
|
270 |
$show_tooltips = ( isset( $instance['show_tooltips'] ) ? $instance['show_tooltips'] : 1 );
|
271 |
|
272 |
-
$use_range = ( selected( $display_type, 'date-range', false ) ? true : false );
|
273 |
|
274 |
?>
|
275 |
<p>
|
@@ -289,7 +294,8 @@ class GCE_Widget extends WP_Widget {
|
|
289 |
<option value="grid" <?php selected( $display_type, 'grid' ); ?>><?php _e( 'Grid (Month view)', 'gce' ); ?></option>
|
290 |
<option value="list" <?php selected( $display_type, 'list' ); ?>><?php _e( 'List', 'gce' ); ?></option>
|
291 |
<option value="list-grouped" <?php selected( $display_type, 'list-grouped' );?>><?php _e( 'Grouped List', 'gce' ); ?></option>
|
292 |
-
<option value="date-range" <?php selected( $display_type, 'date-range' );?>><?php _e( 'Custom Date Range (List)', 'gce' ); ?></option>
|
|
|
293 |
</select>
|
294 |
</p>
|
295 |
|
41 |
}
|
42 |
|
43 |
function gce_widget_add_styles() {
|
44 |
+
|
45 |
+
global $gce_options;
|
46 |
+
|
47 |
// Load CSS
|
48 |
+
if( ! isset( $gce_options['disable_css'] ) ) {
|
49 |
+
wp_enqueue_style( 'google-calendar-events-public' );
|
50 |
+
}
|
51 |
}
|
52 |
|
53 |
/**
|
76 |
|
77 |
|
78 |
// Get custom date range if set
|
79 |
+
if( 'date-range-list' == $display_type || 'date-range-grid' == $display_type ) {
|
80 |
$range_start = ( isset( $instance['feed_range_start'] ) ? $instance['feed_range_start'] : null );
|
81 |
$range_end = ( isset( $instance['feed_range_end'] ) ? $instance['feed_range_end'] : null );
|
82 |
|
106 |
|
107 |
$paging_interval = null;
|
108 |
|
109 |
+
if( $display_type == 'date-range-list' || $display_type == 'date-range-grid' ) {
|
110 |
$max_length = 'date-range';
|
111 |
}
|
112 |
|
193 |
$args['grouped'] = 1;
|
194 |
}
|
195 |
|
196 |
+
if( 'date-range-list' == $display_type ) {
|
197 |
$args['max_events'] = INF;
|
198 |
$args['max_num'] = INF;
|
199 |
}
|
274 |
$list_start_offset_direction = ( isset( $instance['list_start_offset_direction'] ) ? $instance['list_start_offset_direction'] : 'back' );
|
275 |
$show_tooltips = ( isset( $instance['show_tooltips'] ) ? $instance['show_tooltips'] : 1 );
|
276 |
|
277 |
+
$use_range = ( ( selected( $display_type, 'date-range-list', false ) || selected( $display_type, 'date-range-grid', false ) ) ? true : false );
|
278 |
|
279 |
?>
|
280 |
<p>
|
294 |
<option value="grid" <?php selected( $display_type, 'grid' ); ?>><?php _e( 'Grid (Month view)', 'gce' ); ?></option>
|
295 |
<option value="list" <?php selected( $display_type, 'list' ); ?>><?php _e( 'List', 'gce' ); ?></option>
|
296 |
<option value="list-grouped" <?php selected( $display_type, 'list-grouped' );?>><?php _e( 'Grouped List', 'gce' ); ?></option>
|
297 |
+
<option value="date-range-list" <?php selected( $display_type, 'date-range-list' );?>><?php _e( 'Custom Date Range (List)', 'gce' ); ?></option>
|
298 |
+
<option value="date-range-grid" <?php selected( $display_type, 'date-range-grid' );?>><?php _e( 'Custom Date Range (Grid)', 'gce' ); ?></option>
|
299 |
</select>
|
300 |
</p>
|
301 |
|