Simple Calendar – Google Calendar Plugin - Version 2.0.0

Version Description

  • Plugin rewritten from scratch.
  • Now using custom post types for storing and customizing Google calendar feeds.
  • Introduced the shortcode [gcal] (old shortcode still supported).
Download this release

Release Info

Developer pderksen
Plugin Icon 128x128 Simple Calendar – Google Calendar Plugin
Version 2.0.0
Comparing to
See all releases

Code changes from version 2.0.0-beta1 to 2.0.0

assets/banner-772x250.jpg ADDED
Binary file
assets/gcal-icon-16x16.png ADDED
Binary file
assets/icon-128x128.png CHANGED
Binary file
assets/icon-256x256.png CHANGED
Binary file
class-google-calendar-events-admin.php CHANGED
@@ -20,6 +20,8 @@ class Google_Calendar_Events_Admin {
20
  * @var object
21
  */
22
  protected static $instance = null;
 
 
23
 
24
  /**
25
  * Slug of the plugin screen.
@@ -41,6 +43,8 @@ class Google_Calendar_Events_Admin {
41
  $plugin = Google_Calendar_Events::get_instance();
42
  $this->plugin_slug = $plugin->get_plugin_slug();
43
 
 
 
44
  add_filter( 'plugin_action_links_' . plugin_basename( plugin_dir_path( __FILE__ ) . $this->plugin_slug . '.php' ), array( $this, 'add_action_links' ) );
45
 
46
  // Setup admin side constants
@@ -77,13 +81,13 @@ class Google_Calendar_Events_Admin {
77
  *
78
  * @since 2.0.0
79
  */
80
- public static function enqueue_admin_scripts() {
81
 
82
  wp_enqueue_script( 'jquery' );
83
 
84
  wp_enqueue_script( 'jquery-ui-datepicker' );
85
 
86
- wp_enqueue_script( 'gce-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), null, true );
87
  }
88
 
89
  /**
@@ -91,11 +95,11 @@ class Google_Calendar_Events_Admin {
91
  *
92
  * @since 2.0.0
93
  */
94
- public static function enqueue_admin_styles() {
95
 
96
- wp_enqueue_style( 'jquery-ui-datepicker-css', plugins_url( 'css/jquery-ui-1.10.4.custom.min.css', __FILE__ ) );
97
 
98
- wp_enqueue_style( 'gce-admin', plugins_url( 'css/admin.css', __FILE__ ) );
99
  }
100
 
101
  /**
@@ -103,7 +107,7 @@ class Google_Calendar_Events_Admin {
103
  *
104
  * @since 2.0.0
105
  */
106
- public static function define_admin_constants() {
107
  if( ! defined( 'GCE_DIR' ) ) {
108
  define( 'GCE_DIR', dirname( __FILE__ ) );
109
  }
@@ -131,7 +135,7 @@ class Google_Calendar_Events_Admin {
131
  *
132
  * @since 2.0.0
133
  */
134
- function get_plugin_title() {
135
  return __( 'Google Calendar Events', 'gce' );
136
  }
137
 
@@ -144,8 +148,8 @@ class Google_Calendar_Events_Admin {
144
 
145
  return array_merge(
146
  array(
147
- 'settings' => '<a href="' . admin_url( 'edit.php?post_type=gce_feed&page=google-calendar-events_general_settings' ) . '">' . __( 'Settings', 'gce' ) . '</a>',
148
  'feeds' => '<a href="' . admin_url( 'edit.php?post_type=gce_feed' ) . '">' . __( 'Feeds', 'gce' ) . '</a>'
 
149
  ),
150
  $links
151
  );
20
  * @var object
21
  */
22
  protected static $instance = null;
23
+
24
+ protected $version = '';
25
 
26
  /**
27
  * Slug of the plugin screen.
43
  $plugin = Google_Calendar_Events::get_instance();
44
  $this->plugin_slug = $plugin->get_plugin_slug();
45
 
46
+ $this->version = $plugin->get_plugin_version();
47
+
48
  add_filter( 'plugin_action_links_' . plugin_basename( plugin_dir_path( __FILE__ ) . $this->plugin_slug . '.php' ), array( $this, 'add_action_links' ) );
49
 
50
  // Setup admin side constants
81
  *
82
  * @since 2.0.0
83
  */
84
+ public function enqueue_admin_scripts() {
85
 
86
  wp_enqueue_script( 'jquery' );
87
 
88
  wp_enqueue_script( 'jquery-ui-datepicker' );
89
 
90
+ wp_enqueue_script( 'gce-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), $this->version, true );
91
  }
92
 
93
  /**
95
  *
96
  * @since 2.0.0
97
  */
98
+ public function enqueue_admin_styles() {
99
 
100
+ wp_enqueue_style( 'jquery-ui-datepicker-css', plugins_url( 'css/jquery-ui-1.10.4.custom.min.css', __FILE__ ), array(), $this->version );
101
 
102
+ wp_enqueue_style( 'gce-admin', plugins_url( 'css/admin.css', __FILE__ ), array(), $this->version, 'all' );
103
  }
104
 
105
  /**
107
  *
108
  * @since 2.0.0
109
  */
110
+ public function define_admin_constants() {
111
  if( ! defined( 'GCE_DIR' ) ) {
112
  define( 'GCE_DIR', dirname( __FILE__ ) );
113
  }
135
  *
136
  * @since 2.0.0
137
  */
138
+ public function get_plugin_title() {
139
  return __( 'Google Calendar Events', 'gce' );
140
  }
141
 
148
 
149
  return array_merge(
150
  array(
 
151
  'feeds' => '<a href="' . admin_url( 'edit.php?post_type=gce_feed' ) . '">' . __( 'Feeds', 'gce' ) . '</a>'
152
+ //'settings' => '<a href="' . admin_url( 'edit.php?post_type=gce_feed&page=google-calendar-events_general_settings' ) . '">' . __( 'Settings', 'gce' ) . '</a>',
153
  ),
154
  $links
155
  );
class-google-calendar-events.php CHANGED
@@ -14,16 +14,16 @@ class Google_Calendar_Events {
14
  /**
15
  * Plugin version, used for cache-busting of style and script file references.
16
  *
17
- * @since 1.0.0
18
  *
19
  * @var string
20
  */
21
- const VERSION = '2.0.0-beta1';
22
 
23
  /**
24
  * Unique identifier for the plugin.
25
  *
26
- * @since 1.0.0
27
  *
28
  * @var string
29
  */
@@ -32,7 +32,7 @@ class Google_Calendar_Events {
32
  /**
33
  * Instance of this class.
34
  *
35
- * @since 1.0.0
36
  *
37
  * @var object
38
  */
@@ -42,12 +42,18 @@ class Google_Calendar_Events {
42
  * Initialize the plugin by setting localization and loading public scripts
43
  * and styles.
44
  *
45
- * @since 1.0.0
46
  */
47
  private function __construct() {
48
 
49
  $this->includes();
50
 
 
 
 
 
 
 
51
  if( false === get_option( 'gce_upgrade_has_run' ) ) {
52
  $this->upgrade();
53
  }
@@ -73,8 +79,6 @@ class Google_Calendar_Events {
73
  */
74
  private function upgrade() {
75
  include_once( 'includes/admin/upgrade.php' );
76
-
77
- update_option( 'gce_version', self::VERSION );
78
  }
79
 
80
  /**
@@ -131,8 +135,8 @@ class Google_Calendar_Events {
131
  */
132
  public function enqueue_public_scripts() {
133
 
134
- wp_enqueue_script( $this->plugin_slug . '-qtip', plugins_url( 'js/jquery-qtip.js', __FILE__ ), array( 'jquery' ), self::VERSION, true );
135
- wp_enqueue_script( $this->plugin_slug . '-public', plugins_url( 'js/gce-script.js', __FILE__ ), array( 'jquery', $this->plugin_slug . '-qtip' ), self::VERSION, true );
136
 
137
  wp_localize_script( $this->plugin_slug . '-public', 'gce',
138
  array(
@@ -146,19 +150,30 @@ class Google_Calendar_Events {
146
  * @since 2.0.0
147
  */
148
  public function enqueue_public_styles() {
149
- wp_enqueue_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array(), self::VERSION );
150
  }
151
 
152
  /**
153
  * Return the plugin slug.
154
  *
155
- * @since 1.0.0
156
  *
157
- * @return Plugin slug variable.
158
  */
159
  public function get_plugin_slug() {
160
  return $this->plugin_slug;
161
  }
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  /**
164
  * Return an instance of this class.
14
  /**
15
  * Plugin version, used for cache-busting of style and script file references.
16
  *
17
+ * @since 2.0.0
18
  *
19
  * @var string
20
  */
21
+ protected $version = '2.0.0';
22
 
23
  /**
24
  * Unique identifier for the plugin.
25
  *
26
+ * @since 2.0.0
27
  *
28
  * @var string
29
  */
32
  /**
33
  * Instance of this class.
34
  *
35
+ * @since 2.0.0
36
  *
37
  * @var object
38
  */
42
  * Initialize the plugin by setting localization and loading public scripts
43
  * and styles.
44
  *
45
+ * @since 2.0.0
46
  */
47
  private function __construct() {
48
 
49
  $this->includes();
50
 
51
+ $old = get_option( 'gce_version' );
52
+
53
+ if( version_compare( $old, $this->version, '<' ) ) {
54
+ delete_option( 'gce_upgrade_has_run' );
55
+ }
56
+
57
  if( false === get_option( 'gce_upgrade_has_run' ) ) {
58
  $this->upgrade();
59
  }
79
  */
80
  private function upgrade() {
81
  include_once( 'includes/admin/upgrade.php' );
 
 
82
  }
83
 
84
  /**
135
  */
136
  public function enqueue_public_scripts() {
137
 
138
+ wp_enqueue_script( $this->plugin_slug . '-qtip', plugins_url( 'js/jquery-qtip.js', __FILE__ ), array( 'jquery' ), $this->version, true );
139
+ wp_enqueue_script( $this->plugin_slug . '-public', plugins_url( 'js/gce-script.js', __FILE__ ), array( 'jquery', $this->plugin_slug . '-qtip' ), $this->version, true );
140
 
141
  wp_localize_script( $this->plugin_slug . '-public', 'gce',
142
  array(
150
  * @since 2.0.0
151
  */
152
  public function enqueue_public_styles() {
153
+ wp_enqueue_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array(), $this->version );
154
  }
155
 
156
  /**
157
  * Return the plugin slug.
158
  *
159
+ * @since 2.0.0
160
  *
161
+ * @return Plugin version variable.
162
  */
163
  public function get_plugin_slug() {
164
  return $this->plugin_slug;
165
  }
166
+
167
+ /**
168
+ * Return the plugin version.
169
+ *
170
+ * @since 1.0.0
171
+ *
172
+ * @return Plugin slug variable.
173
+ */
174
+ public function get_plugin_version() {
175
+ return $this->version;
176
+ }
177
 
178
  /**
179
  * Return an instance of this class.
css/admin.css CHANGED
@@ -26,6 +26,11 @@
26
  display: inline;
27
  }
28
 
 
 
 
 
 
29
  .gce-admin-hidden {
30
  display: none;
31
  }
26
  display: inline;
27
  }
28
 
29
+ #gce-display-options-wrap .gce-meta-control label#gce-simple-display-label {
30
+ font-weight: bold;
31
+ color: #cb4d4d;
32
+ }
33
+
34
  .gce-admin-hidden {
35
  display: none;
36
  }
css/gce-style.css CHANGED
@@ -57,12 +57,17 @@
57
  .gce-page-grid .gce-calendar .gce-prev{ /* Previous and next month links */
58
  cursor:pointer;
59
  display:inline-block;
60
- width:3%;
 
 
 
 
 
61
  }
62
 
63
  .gce-page-grid .gce-calendar .gce-month-title{ /* Month title */
64
  display:inline-block;
65
- width:90%;
66
  }
67
 
68
  .gce-page-grid .gce-calendar th abbr{ /* Day letter abbreviation */
@@ -137,6 +142,11 @@
137
  cursor:pointer;
138
  display:inline-block;
139
  width:5%;
 
 
 
 
 
140
  }
141
 
142
  .gce-widget-grid .gce-calendar .gce-month-title{ /* Month title in caption at top of table */
@@ -209,4 +219,4 @@
209
  .gce-event-info .gce-tooltip-event{ /* The event title */
210
  background-color:#DDDDDD;
211
  font-weight:bold;
212
- }
57
  .gce-page-grid .gce-calendar .gce-prev{ /* Previous and next month links */
58
  cursor:pointer;
59
  display:inline-block;
60
+ width:5%;
61
+ white-space: nowrap;
62
+ }
63
+
64
+ .gce-page-grid .gce-calendar .gce-prev{
65
+ float: left;
66
  }
67
 
68
  .gce-page-grid .gce-calendar .gce-month-title{ /* Month title */
69
  display:inline-block;
70
+ width:80%;
71
  }
72
 
73
  .gce-page-grid .gce-calendar th abbr{ /* Day letter abbreviation */
142
  cursor:pointer;
143
  display:inline-block;
144
  width:5%;
145
+ white-space: nowrap;
146
+ }
147
+
148
+ .gce-widget-grid .gce-calendar .gce-prev{
149
+ float: left;
150
  }
151
 
152
  .gce-widget-grid .gce-calendar .gce-month-title{ /* Month title in caption at top of table */
219
  .gce-event-info .gce-tooltip-event{ /* The event title */
220
  background-color:#DDDDDD;
221
  font-weight:bold;
222
+ }
google-calendar-events.php CHANGED
@@ -2,23 +2,23 @@
2
  /**
3
  * Google Calendar Events
4
  *
5
- * @package GCE
6
- * @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
7
- * @license GPL-2.0+
8
- * @link http://philderksen.com
9
- * @copyright 2014 Phil Derksen
10
  *
11
  * @wordpress-plugin
12
- * Plugin Name: Google Calendar Events
13
- * Plugin URI: https://github.com/pderksen/WP-Google-Calendar-Events
14
- * Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
15
- * Version: 2.0.0-beta1
16
- * Author: Phil Derksen
17
- * Author URI: http://philderksen.com
18
- * License: GPL-2.0+
19
- * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
20
- * Text Domain: gce
21
- * Domain Path: /languages
22
  */
23
 
24
  // If this file is called directly, abort.
2
  /**
3
  * Google Calendar Events
4
  *
5
+ * @package GCE
6
+ * @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
7
+ * @license GPL-2.0+
8
+ * @link http://philderksen.com
9
+ * @copyright 2014 Phil Derksen
10
  *
11
  * @wordpress-plugin
12
+ * Plugin Name: Google Calendar Events
13
+ * Plugin URI: https://github.com/pderksen/WP-Google-Calendar-Events
14
+ * Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
15
+ * Version: 2.0.0
16
+ * Author: Phil Derksen
17
+ * Author URI: http://philderksen.com
18
+ * License: GPL-2.0+
19
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
20
+ * Text Domain: gce
21
+ * Domain Path: /languages
22
  */
23
 
24
  // If this file is called directly, abort.
includes/admin/upgrade.php CHANGED
@@ -19,14 +19,19 @@ add_action( 'init', 'gce_upgrade', 20 );
19
  */
20
  function gce_upgrade() {
21
 
22
- //delete_option( 'gce_upgrade_has_run' );
23
-
24
  $version = get_option( 'gce_version' );
25
 
26
- // Check if under version 2 and run the v2 upgrade if we are
27
- if( version_compare( $version, '2.0.0', '<' ) && false === get_option( 'gce_upgrade_has_run' ) ) {
28
- gce_v2_upgrade();
 
 
29
  }
 
 
 
 
 
30
  }
31
 
32
  /*
@@ -37,11 +42,6 @@ function gce_upgrade() {
37
  function gce_v2_upgrade() {
38
  $old_options = get_option( 'gce_options' );
39
 
40
-
41
- //echo '<pre>' . print_r( $old_options, true ) . '</pre>';
42
-
43
- //die();
44
-
45
  if( false !== $old_options ) {
46
 
47
  foreach( $old_options as $key => $value ) {
@@ -50,8 +50,6 @@ function gce_v2_upgrade() {
50
 
51
  update_widget_feed_ids();
52
  }
53
-
54
- add_option( 'gce_upgrade_has_run', 1 );
55
  }
56
 
57
  /**
@@ -174,10 +172,6 @@ function create_cpt_meta( $id, $args ) {
174
  $post_meta_fields = array_merge( $post_meta_fields, $display_meta );
175
  }
176
 
177
- //echo '<pre>' . print_r( $post_meta_fields, true ) . '</pre>';
178
-
179
- //die();
180
-
181
  // Loop through each $post_meta_field and add as an entry
182
  foreach( $post_meta_fields as $k => $v ) {
183
  update_post_meta( $id, $k, $v );
@@ -189,7 +183,6 @@ function gce_convert_timestamp( $t ) {
189
  return date( 'm/d/Y', $t );
190
  }
191
 
192
-
193
  /**
194
  * Remove the old transient values from the database
195
  *
@@ -201,7 +194,6 @@ function clear_old_transients( $id ) {
201
  delete_transient( 'gce_feed_' . $id . '_url' );
202
  }
203
 
204
-
205
  /**
206
  * Update widget IDs
207
  *
@@ -224,17 +216,42 @@ function update_widget_feed_ids() {
224
  }
225
 
226
  $id = $v;
 
 
 
 
 
 
 
 
 
 
 
227
 
228
- $q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$id&order=ASC" );
229
 
230
- if( $q->have_posts() ) {
 
 
 
 
 
 
 
 
 
231
 
232
- $q->the_post();
233
- // Set our ID to the old ID if found
234
- $id = get_the_ID();
235
- }
236
 
237
- $widget[$a][$k] = $id;
 
 
 
 
 
 
238
  }
239
  }
240
 
19
  */
20
  function gce_upgrade() {
21
 
 
 
22
  $version = get_option( 'gce_version' );
23
 
24
+ if( ! empty( $version ) ) {
25
+ // Check if under version 2 and run the v2 upgrade if we are
26
+ if( version_compare( $version, '2.0.0-beta1', '<' ) && false === get_option( 'gce_upgrade_has_run' ) ) {
27
+ gce_v2_upgrade();
28
+ }
29
  }
30
+
31
+ $new_version = Google_Calendar_Events::get_instance()->get_plugin_version();
32
+ update_option( 'gce_version', $new_version );
33
+
34
+ add_option( 'gce_upgrade_has_run', 1 );
35
  }
36
 
37
  /*
42
  function gce_v2_upgrade() {
43
  $old_options = get_option( 'gce_options' );
44
 
 
 
 
 
 
45
  if( false !== $old_options ) {
46
 
47
  foreach( $old_options as $key => $value ) {
50
 
51
  update_widget_feed_ids();
52
  }
 
 
53
  }
54
 
55
  /**
172
  $post_meta_fields = array_merge( $post_meta_fields, $display_meta );
173
  }
174
 
 
 
 
 
175
  // Loop through each $post_meta_field and add as an entry
176
  foreach( $post_meta_fields as $k => $v ) {
177
  update_post_meta( $id, $k, $v );
183
  return date( 'm/d/Y', $t );
184
  }
185
 
 
186
  /**
187
  * Remove the old transient values from the database
188
  *
194
  delete_transient( 'gce_feed_' . $id . '_url' );
195
  }
196
 
 
197
  /**
198
  * Update widget IDs
199
  *
216
  }
217
 
218
  $id = $v;
219
+
220
+ $multi = str_replace( ' ', '', $v );
221
+
222
+ $multi = explode( ',', $id );
223
+
224
+ if( is_array( $multi ) ) {
225
+
226
+ $new_ids = '';
227
+
228
+ foreach( $multi as $m ) {
229
+ $q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$m&order=ASC" );
230
 
231
+ if( $q->have_posts() ) {
232
 
233
+ $q->the_post();
234
+ // Set our ID to the old ID if found
235
+ $m = get_the_ID();
236
+
237
+ $new_ids .= $m . ',';
238
+ }
239
+ }
240
+
241
+ $widget[$a][$k] = substr( $new_ids, 0, -1 );
242
+ } else {
243
 
244
+ $q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$id&order=ASC" );
245
+
246
+ if( $q->have_posts() ) {
 
247
 
248
+ $q->the_post();
249
+ // Set our ID to the old ID if found
250
+ $id = get_the_ID();
251
+ }
252
+
253
+ $widget[$a][$k] = $id;
254
+ }
255
  }
256
  }
257
 
includes/class-gce-display.php CHANGED
@@ -88,7 +88,7 @@ class GCE_Display {
88
  *
89
  * @since 2.0.0
90
  */
91
- public function get_grid ( $year = null, $month = null ) {
92
  require_once 'php-calendar.php';
93
 
94
  $time_now = current_time( 'timestamp' );
@@ -140,7 +140,7 @@ class GCE_Display {
140
  $markup .= '<ul>';
141
 
142
  foreach ( $event_day as $num_in_day => $event ) {
143
- $feed_id = absint( $event->id );
144
  $markup .= '<li class="gce-tooltip-feed-' . $feed_id . '">' . $event->get_event_markup( 'tooltip', $num_in_day, $i ) . '</li>';
145
 
146
  //Add CSS class for the feed from which this event comes. If there are multiple events from the same feed on the same day, the CSS class will only be added once.
@@ -199,7 +199,7 @@ class GCE_Display {
199
  $start_day = get_option( 'start_of_week' );
200
 
201
  //Generate the calendar markup and return it
202
- return gce_generate_calendar( $year, $month, $event_days, 1, null, $start_day, $pn );
203
  }
204
 
205
  /**
88
  *
89
  * @since 2.0.0
90
  */
91
+ public function get_grid ( $year = null, $month = null, $widget = false ) {
92
  require_once 'php-calendar.php';
93
 
94
  $time_now = current_time( 'timestamp' );
140
  $markup .= '<ul>';
141
 
142
  foreach ( $event_day as $num_in_day => $event ) {
143
+ $feed_id = absint( $event->feed->id );
144
  $markup .= '<li class="gce-tooltip-feed-' . $feed_id . '">' . $event->get_event_markup( 'tooltip', $num_in_day, $i ) . '</li>';
145
 
146
  //Add CSS class for the feed from which this event comes. If there are multiple events from the same feed on the same day, the CSS class will only be added once.
199
  $start_day = get_option( 'start_of_week' );
200
 
201
  //Generate the calendar markup and return it
202
+ return gce_generate_calendar( $year, $month, $event_days, 1, null, $start_day, $pn, $widget );
203
  }
204
 
205
  /**
includes/gce-feed-cpt.php CHANGED
@@ -43,7 +43,7 @@ function gce_setup_cpt() {
43
  'capability_type' => 'post',
44
  'has_archive' => false,
45
  'hierarchical' => false,
46
- 'menu_icon' => 'dashicons-calendar',
47
  'supports' => array( 'title', 'editor' )
48
  );
49
 
43
  'capability_type' => 'post',
44
  'has_archive' => false,
45
  'hierarchical' => false,
46
+ 'menu_icon' => plugins_url( '/assets/gcal-icon-16x16.png', GCE_MAIN_FILE ),
47
  'supports' => array( 'title', 'editor' )
48
  );
49
 
includes/misc-functions.php CHANGED
@@ -5,7 +5,7 @@
5
  *
6
  * @since 2.0.0
7
  */
8
- function gce_print_calendar( $feed_ids, $display = 'grid', $args = array() ) {
9
 
10
  $defaults = array(
11
  'title_text' => '',
@@ -38,7 +38,7 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array() ) {
38
  $markup .= '<div class="gce-page-grid" id="gce-page-grid-' . $feed_ids . '">';
39
  }
40
 
41
- $markup .= $d->get_grid( $year, $month );
42
  $markup .= '</div>';
43
 
44
  } else if( 'list' == $display || 'list-grouped' == $display ) {
5
  *
6
  * @since 2.0.0
7
  */
8
+ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $widget = false ) {
9
 
10
  $defaults = array(
11
  'title_text' => '',
38
  $markup .= '<div class="gce-page-grid" id="gce-page-grid-' . $feed_ids . '">';
39
  }
40
 
41
+ $markup .= $d->get_grid( $year, $month, $widget );
42
  $markup .= '</div>';
43
 
44
  } else if( 'list' == $display || 'list-grouped' == $display ) {
includes/php-calendar.php CHANGED
@@ -17,7 +17,7 @@ Changes made to original PHP Calendar script by me (Ross Hanney):
17
  - Replaced gmmktime() with mktime()
18
  */
19
 
20
- function gce_generate_calendar( $year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array() ) {
21
  global $wp_locale;
22
 
23
  $first_of_month = mktime( 0, 0, 0, $month, 1, $year );
@@ -38,12 +38,23 @@ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length
38
  #Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
39
  list( $p, $pl ) = each( $pn );
40
  list( $n, $nl ) = each( $pn ); #previous and next links, if applicable
41
-
42
- if ( $p )
43
- $p = '<span class="gce-prev">' . ( ( $pl ) ? ( '<a class="gce-change-month" title="Previous month" name="' . $pl . '">' . $p . '</a>' ) : $p ) . '</span>&nbsp;';
44
- if ( $n )
45
- $n = '&nbsp;<span class="gce-next">' . ( ( $nl ) ? ( '<a class="gce-change-month" title="Next month" name="' . $nl . '">' . $n . '</a>' ) : $n ) . '</span>';
46
-
 
 
 
 
 
 
 
 
 
 
 
47
  $calendar = '<table class="gce-calendar">' . "\n" . '<caption class="gce-caption">' . $p . '<span class="gce-month-title">' . ( ( $month_href ) ? ( '<a href="' . esc_attr( $month_href ) . '">' . $title . '</a>' ) : $title ) . '</span>' . $n . "</caption>\n<tr>";
48
 
49
  if ( $day_name_length ) { #if the day names should be shown ($day_name_length > 0)
17
  - Replaced gmmktime() with mktime()
18
  */
19
 
20
+ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array(), $widget = false ) {
21
  global $wp_locale;
22
 
23
  $first_of_month = mktime( 0, 0, 0, $month, 1, $year );
38
  #Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
39
  list( $p, $pl ) = each( $pn );
40
  list( $n, $nl ) = each( $pn ); #previous and next links, if applicable
41
+
42
+ if ( $p ) {
43
+ if( $widget ) {
44
+ $p = '<span class="gce-prev">' . ( ( $pl ) ? ( '<a class="gce-change-month" title="Previous month" name="' . $pl . '">' . $p . '</a>' ) : $p ) . '</span>&nbsp;';
45
+ } else {
46
+ $p = '<span class="gce-prev">' . ( ( $pl ) ? ( '<a class="gce-change-month" title="Previous month" name="' . $pl . '">' . $p . ' Back</a>' ) : $p ) . '</span>&nbsp;';
47
+ }
48
+ }
49
+
50
+ if ( $n ) {
51
+ if( $widget ) {
52
+ $n = '&nbsp;<span class="gce-next">' . ( ( $nl ) ? ( '<a class="gce-change-month" title="Next month" name="' . $nl . '">' . $n . '</a>' ) : $n ) . '</span>';
53
+ } else {
54
+ $n = '&nbsp;<span class="gce-next">' . ( ( $nl ) ? ( '<a class="gce-change-month" title="Next month" name="' . $nl . '">Next ' . $n . '</a>' ) : $n ) . '</span>';
55
+ }
56
+ }
57
+
58
  $calendar = '<table class="gce-calendar">' . "\n" . '<caption class="gce-caption">' . $p . '<span class="gce-month-title">' . ( ( $month_href ) ? ( '<a href="' . esc_attr( $month_href ) . '">' . $title . '</a>' ) : $title ) . '</span>' . $n . "</caption>\n<tr>";
59
 
60
  if ( $day_name_length ) { #if the day names should be shown ($day_name_length > 0)
index.php DELETED
@@ -1 +0,0 @@
1
- <?php // Silence is golden
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: pderksen, nickyoung87, rosshanney
3
  Tags: google calendar, google, calendar, events, gcal
4
  Requires at least: 3.7.4
5
  Tested up to: 4.0
6
- Stable tag: 0.7.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -27,8 +27,8 @@ Parses Google Calendar feeds and displays the events as a calendar grid or list
27
 
28
  ###Feature Requests and Updates###
29
 
30
- * [Submit feature requests in our support forums](https://wordpress.org/support/plugin/google-calendar-events)
31
- * [Get notified of major feature updates](http://eepurl.com/0_VsT)
32
  * [Follow this project on Github](https://github.com/pderksen/WP-Google-Calendar-Events)
33
 
34
  This plugin was originally created by [Ross Hanney](http://www.rhanney.co.uk), a web developer based in the UK specialising in WordPress and PHP.
@@ -67,15 +67,19 @@ There are three ways to install this plugin.
67
 
68
  == Screenshots ==
69
 
70
- 1. The main plugin admin screen.
71
- 1. The add feed admin screen.
72
- 1. A page showing a full page calendar grid and various widgets.
 
 
 
 
73
 
74
  == Changelog ==
75
 
76
  = 2.0.0 =
77
 
78
- * Plugin architecture/code rewrite.
79
  * Now using custom post types for storing and customizing Google calendar feeds.
80
  * Introduced the shortcode `[gcal]` (old shortcode still supported).
81
 
3
  Tags: google calendar, google, calendar, events, gcal
4
  Requires at least: 3.7.4
5
  Tested up to: 4.0
6
+ Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
27
 
28
  ###Feature Requests and Updates###
29
 
30
+ * [Public roadmap/feature requests](https://trello.com/b/ZQSzsarY)
31
+ * [Get notified of major plugin updates](http://eepurl.com/0_VsT)
32
  * [Follow this project on Github](https://github.com/pderksen/WP-Google-Calendar-Events)
33
 
34
  This plugin was originally created by [Ross Hanney](http://www.rhanney.co.uk), a web developer based in the UK specialising in WordPress and PHP.
67
 
68
  == Screenshots ==
69
 
70
+ 1. Grid display in full page with tooltip
71
+ 1. Grid display in widget
72
+ 1. List display in widget
73
+ 1. Simple display options
74
+ 1. Calendar feed settings
75
+ 1. Calendar widget settings
76
+ 1. Event display builder editor
77
 
78
  == Changelog ==
79
 
80
  = 2.0.0 =
81
 
82
+ * Plugin rewritten from scratch.
83
  * Now using custom post types for storing and customizing Google calendar feeds.
84
  * Introduced the shortcode `[gcal]` (old shortcode still supported).
85
 
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file
screenshot-4.png ADDED
Binary file
screenshot-5.png ADDED
Binary file
screenshot-6.png ADDED
Binary file
screenshot-7.png ADDED
Binary file
uninstall.php CHANGED
@@ -66,4 +66,5 @@ if ( empty( $general['save_settings'] ) ) {
66
  delete_option( 'gce_options' );
67
  delete_option( 'gce_general' );
68
  delete_option( 'gce_clear_old_transients' );
 
69
  }
66
  delete_option( 'gce_options' );
67
  delete_option( 'gce_general' );
68
  delete_option( 'gce_clear_old_transients' );
69
+ delete_option( 'gce_show_upgrade_notice' );
70
  }
views/admin/display-options-meta.php CHANGED
@@ -36,7 +36,7 @@
36
  <div class="gce-meta-control">
37
  <p>
38
  <input type="checkbox" name="gce_display_simple" id="gce_display_simple" value="1" <?php checked( $gce_display_simple, '1' ); ?> />
39
- <label for="gce_display_simple"><?php _e( 'Use the simple display options below instead of the Event Builder', 'gce' ); ?></label>
40
  </p>
41
  </div>
42
 
36
  <div class="gce-meta-control">
37
  <p>
38
  <input type="checkbox" name="gce_display_simple" id="gce_display_simple" value="1" <?php checked( $gce_display_simple, '1' ); ?> />
39
+ <label for="gce_display_simple" id="gce-simple-display-label"><?php _e( 'Check this box to use the simple display options below instead of the Event Builder code on the left.', 'gce' ); ?></label>
40
  </p>
41
  </div>
42
 
views/admin/gce-feed-meta-display.php CHANGED
@@ -37,8 +37,8 @@
37
  <div id="gce-admin-promo">
38
  <?php echo __( 'We\'re <strong>smack dab</strong> in the middle of building additional features for this plugin. Have ideas?', 'gce' ); ?>
39
  <strong>
40
- <a href="http://wordpress.org/support/topic/what-features-would-you-like-to-see-2" target="_blank">
41
- <?php echo __( 'Tell us what you\'re looking for', 'gce' ); ?>
42
  </a>
43
  </strong>
44
  <br/>
37
  <div id="gce-admin-promo">
38
  <?php echo __( 'We\'re <strong>smack dab</strong> in the middle of building additional features for this plugin. Have ideas?', 'gce' ); ?>
39
  <strong>
40
+ <a href="https://trello.com/b/ZQSzsarY" target="_blank">
41
+ <?php echo __( 'Visit our roadmap and tell us what you\'re looking for', 'gce' ); ?>
42
  </a>
43
  </strong>
44
  <br/>
views/widgets.php CHANGED
@@ -95,7 +95,7 @@ class GCE_Widget extends WP_Widget {
95
  $args['grouped'] = 1;
96
  }
97
 
98
- $markup = gce_print_calendar( $feed_ids, $instance['display_type'], $args );
99
 
100
  echo $markup;
101
  }
95
  $args['grouped'] = 1;
96
  }
97
 
98
+ $markup = gce_print_calendar( $feed_ids, $instance['display_type'], $args, true );
99
 
100
  echo $markup;
101
  }