Version Description
- September 29, 2015 =
- Announcement: Simple Calendar is coming, changes ahead.
- Deprecation: The bundled/default Google API key reached it's quota and was shut off. Using your own API key is now required.
Download this release
Release Info
Developer | nekojira |
Plugin | Simple Calendar – Google Calendar Plugin |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.4.0
- class-google-calendar-events-admin.php +89 -26
- google-calendar-events.php +1 -1
- includes/admin/upgrade.php +89 -89
- includes/class-gce-event.php +8 -3
- includes/register-settings.php +3 -4
- readme.txt +7 -3
- views/admin/gce-feed-meta-display.php +2 -2
- views/admin/gce-feed-sidebar-help.php +2 -2
class-google-calendar-events-admin.php
CHANGED
@@ -20,7 +20,7 @@ class Google_Calendar_Events_Admin {
|
|
20 |
* @var object
|
21 |
*/
|
22 |
protected static $instance = null;
|
23 |
-
|
24 |
protected $version = '';
|
25 |
|
26 |
/**
|
@@ -42,31 +42,93 @@ class Google_Calendar_Events_Admin {
|
|
42 |
|
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
|
51 |
add_action( 'init', array( $this, 'define_admin_constants' ) );
|
52 |
-
|
53 |
// Add admin styles
|
54 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
55 |
-
|
56 |
// Add admin JS
|
57 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
58 |
-
|
59 |
// Add the options page and menu item.
|
60 |
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ), 2 );
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
// Add admin notice after plugin activation. Also check if should be hidden.
|
63 |
-
add_action( 'admin_notices', array( $this, 'show_admin_notice' ) );
|
64 |
|
65 |
// Add media button for adding a shortcode.
|
66 |
add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 100 );
|
67 |
add_action( 'edit_form_after_editor', array( $this, 'add_shortcode_panel' ), 100 );
|
68 |
}
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
/**
|
71 |
* Show notice after plugin install/activate
|
72 |
* Also check if user chooses to hide it.
|
@@ -78,7 +140,7 @@ class Google_Calendar_Events_Admin {
|
|
78 |
if ( false == get_option( 'gce_show_admin_install_notice' ) ) {
|
79 |
return;
|
80 |
}
|
81 |
-
|
82 |
$screen = get_current_screen();
|
83 |
|
84 |
// Delete stored value if "hide" button click detected (custom querystring value set to 1).
|
@@ -92,7 +154,7 @@ class Google_Calendar_Events_Admin {
|
|
92 |
include_once( 'includes/admin/admin-notice.php' );
|
93 |
}
|
94 |
}
|
95 |
-
|
96 |
/**
|
97 |
* Check if viewing one of this plugin's admin pages.
|
98 |
*
|
@@ -104,7 +166,7 @@ class Google_Calendar_Events_Admin {
|
|
104 |
if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
|
105 |
return false;
|
106 |
}
|
107 |
-
|
108 |
$screen = get_current_screen();
|
109 |
|
110 |
if ( $screen->id == 'edit-gce_feed' || $screen->id == 'gce_feed' || in_array( $screen->id, $this->plugin_screen_hook_suffix ) || $screen->id == 'widgets' ) {
|
@@ -113,7 +175,7 @@ class Google_Calendar_Events_Admin {
|
|
113 |
return false;
|
114 |
}
|
115 |
}
|
116 |
-
|
117 |
/**
|
118 |
* Fired when the plugin is activated.
|
119 |
*
|
@@ -121,7 +183,8 @@ class Google_Calendar_Events_Admin {
|
|
121 |
*/
|
122 |
public static function activate() {
|
123 |
flush_rewrite_rules();
|
124 |
-
|
|
|
125 |
}
|
126 |
|
127 |
/**
|
@@ -130,7 +193,7 @@ class Google_Calendar_Events_Admin {
|
|
130 |
public static function deactivate() {
|
131 |
flush_rewrite_rules();
|
132 |
}
|
133 |
-
|
134 |
public function add_plugin_admin_menu() {
|
135 |
// Add Help submenu page
|
136 |
$this->plugin_screen_hook_suffix[] = add_submenu_page(
|
@@ -142,14 +205,14 @@ class Google_Calendar_Events_Admin {
|
|
142 |
array( $this, 'display_admin_page' )
|
143 |
);
|
144 |
}
|
145 |
-
|
146 |
public function display_admin_page() {
|
147 |
include_once( 'views/admin/admin.php' );
|
148 |
}
|
149 |
-
|
150 |
/**
|
151 |
* Enqueue JS for the admin area
|
152 |
-
*
|
153 |
* @since 2.0.0
|
154 |
*/
|
155 |
public function enqueue_admin_scripts() {
|
@@ -162,10 +225,10 @@ class Google_Calendar_Events_Admin {
|
|
162 |
wp_enqueue_script( 'gce-admin', plugins_url( 'js/gce-admin.js', __FILE__ ), array( 'jquery' ), $this->version, true );
|
163 |
}
|
164 |
}
|
165 |
-
|
166 |
/**
|
167 |
* Enqueue styles for the admin area
|
168 |
-
*
|
169 |
* @since 2.0.0
|
170 |
*/
|
171 |
public function enqueue_admin_styles() {
|
@@ -181,14 +244,14 @@ class Google_Calendar_Events_Admin {
|
|
181 |
|
182 |
// Use minified CSS from CDN referenced at https://code.jquery.com/ui/
|
183 |
wp_enqueue_style( 'jquery-ui-smoothness', '//code.jquery.com/ui/' . $queryui->ver . '/themes/smoothness/jquery-ui.min.css', array(), $this->version );
|
184 |
-
|
185 |
wp_enqueue_style( 'gce-admin', plugins_url( 'css/admin.css', __FILE__ ), array(), $this->version, 'all' );
|
186 |
}
|
187 |
}
|
188 |
-
|
189 |
/**
|
190 |
* Define constants that will be used throughout admin specific code
|
191 |
-
*
|
192 |
* @since 2.0.0
|
193 |
*/
|
194 |
public function define_admin_constants() {
|
@@ -213,10 +276,10 @@ class Google_Calendar_Events_Admin {
|
|
213 |
|
214 |
return self::$instance;
|
215 |
}
|
216 |
-
|
217 |
/**
|
218 |
* Return plugin name
|
219 |
-
*
|
220 |
* @since 2.0.0
|
221 |
*/
|
222 |
public function get_plugin_title() {
|
20 |
* @var object
|
21 |
*/
|
22 |
protected static $instance = null;
|
23 |
+
|
24 |
protected $version = '';
|
25 |
|
26 |
/**
|
42 |
|
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
|
51 |
add_action( 'init', array( $this, 'define_admin_constants' ) );
|
52 |
+
|
53 |
// Add admin styles
|
54 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
55 |
+
|
56 |
// Add admin JS
|
57 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
58 |
+
|
59 |
// Add the options page and menu item.
|
60 |
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ), 2 );
|
61 |
+
|
62 |
+
if ( isset( $_GET['gce_dismiss_admin_update_notices'] ) ) {
|
63 |
+
delete_option( 'gce_admin_update_notices' );
|
64 |
+
} elseif ( 'show' == get_option( 'gce_admin_update_notices' ) && current_user_can( 'manage_options' ) ) {
|
65 |
+
add_action( 'admin_head', array( $this, 'dismissible_admin_notices_styles' ) );
|
66 |
+
add_action( 'admin_notices', array( $this, 'show_admin_update_notices' ) );
|
67 |
+
}
|
68 |
+
|
69 |
// Add admin notice after plugin activation. Also check if should be hidden.
|
70 |
+
// add_action( 'admin_notices', array( $this, 'show_admin_notice' ) );
|
71 |
|
72 |
// Add media button for adding a shortcode.
|
73 |
add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 100 );
|
74 |
add_action( 'edit_form_after_editor', array( $this, 'add_shortcode_panel' ), 100 );
|
75 |
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @since 2.4.0
|
79 |
+
*/
|
80 |
+
public function dismissible_admin_notices_styles() {
|
81 |
+
?>
|
82 |
+
<style type="text/css">
|
83 |
+
body a.gce-dismiss-notice {
|
84 |
+
color: #ccc;
|
85 |
+
float: right;
|
86 |
+
margin-top: 9px;
|
87 |
+
text-decoration: none;
|
88 |
+
}
|
89 |
+
body a.gce-dismiss-notice:active,
|
90 |
+
body a.gce-dismiss-notice:focus {
|
91 |
+
outline: 0;
|
92 |
+
}
|
93 |
+
body a.gce-dismiss-notice:hover {
|
94 |
+
color: #aaa;
|
95 |
+
}
|
96 |
+
</style>
|
97 |
+
<?php
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @since 2.4.0
|
102 |
+
*/
|
103 |
+
public function show_admin_update_notices() {
|
104 |
+
|
105 |
+
$message = '';
|
106 |
+
|
107 |
+
$settings = get_option( 'gce_settings_general' );
|
108 |
+
$key = isset( $settings['api_key'] ) ? $settings['api_key'] : '';
|
109 |
+
if ( empty( $key ) || 'AIzaSyAssdKVved1mPVY0UJCrx96OUOF9u17AuY' == $key ) {
|
110 |
+
$message .= '<h3>' . __( 'Google API Key Notice', 'gce' ) . '</h3>' .
|
111 |
+
'<p>' . __( 'This plugin now requires you to use your own Google API key to avoid running into limit requests.', 'gce' ) . '</p>' .
|
112 |
+
'<p><a href="' . admin_url( 'edit.php?post_type=gce_feed&page=google-calendar-events_general_settings' ) . '" class="button-primary">' . __( 'Enter your Google API key', 'gce' ) . '</a> ' .
|
113 |
+
'<a href="' . gce_ga_campaign_url( 'http://wpdocs.philderksen.com/google-calendar-events/getting-started/api-key-settings/', 'gce_lite', 'settings_link', 'docs' ) . '" class="button-secondary" target="_blank">' . __( 'Instructions', 'gce' ) . '</a>' .
|
114 |
+
'</p>';
|
115 |
+
}
|
116 |
+
|
117 |
+
$message .= '<h3>' . __( 'Plugin Upgrade Notice', 'gce' ) . '</h3>' .
|
118 |
+
'<p>' . __( 'Simple Calendar 3.0 is a pretty major update and will be released very soon.', 'gce' ) . '</p>' .
|
119 |
+
'<p>' . __( 'To make sure you\'re prepared, you can ', 'gce' ) .
|
120 |
+
'<a href="https://wordpress.org/support/topic/simple-calendar-30-beta-now-available" target="_blank">' . __( 'read about (and try out) the current beta here', 'gce' ) . '</a></p>' .
|
121 |
+
'<p><a href="https://www.getdrip.com/forms/9434542/submissions/new" class="button-secondary" target="_blank">' .__( 'Get notified of important updates', 'gce' ) . '</a></p>';
|
122 |
+
|
123 |
+
$url = add_query_arg( array( 'gce_dismiss_admin_update_notices' => true ) );
|
124 |
+
$dismiss_icon = sprintf( '<a class="dashicons-before dashicons-dismiss gce-dismiss-notice" href="%s"></a>', $url );
|
125 |
+
$dismiss_link = sprintf( '<p><a href="%s">' . __( 'Dismiss this notice', 'gce' ) . '</a></p>', $url );
|
126 |
+
|
127 |
+
echo '<div class="notice error gce-dismissible-notice">' .
|
128 |
+
$dismiss_icon . $message . $dismiss_link .
|
129 |
+
'</div>';
|
130 |
+
}
|
131 |
+
|
132 |
/**
|
133 |
* Show notice after plugin install/activate
|
134 |
* Also check if user chooses to hide it.
|
140 |
if ( false == get_option( 'gce_show_admin_install_notice' ) ) {
|
141 |
return;
|
142 |
}
|
143 |
+
|
144 |
$screen = get_current_screen();
|
145 |
|
146 |
// Delete stored value if "hide" button click detected (custom querystring value set to 1).
|
154 |
include_once( 'includes/admin/admin-notice.php' );
|
155 |
}
|
156 |
}
|
157 |
+
|
158 |
/**
|
159 |
* Check if viewing one of this plugin's admin pages.
|
160 |
*
|
166 |
if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
|
167 |
return false;
|
168 |
}
|
169 |
+
|
170 |
$screen = get_current_screen();
|
171 |
|
172 |
if ( $screen->id == 'edit-gce_feed' || $screen->id == 'gce_feed' || in_array( $screen->id, $this->plugin_screen_hook_suffix ) || $screen->id == 'widgets' ) {
|
175 |
return false;
|
176 |
}
|
177 |
}
|
178 |
+
|
179 |
/**
|
180 |
* Fired when the plugin is activated.
|
181 |
*
|
183 |
*/
|
184 |
public static function activate() {
|
185 |
flush_rewrite_rules();
|
186 |
+
add_option( 'gce_admin_update_notices', 'show' );
|
187 |
+
//update_option( 'gce_show_admin_install_notice', 1 );
|
188 |
}
|
189 |
|
190 |
/**
|
193 |
public static function deactivate() {
|
194 |
flush_rewrite_rules();
|
195 |
}
|
196 |
+
|
197 |
public function add_plugin_admin_menu() {
|
198 |
// Add Help submenu page
|
199 |
$this->plugin_screen_hook_suffix[] = add_submenu_page(
|
205 |
array( $this, 'display_admin_page' )
|
206 |
);
|
207 |
}
|
208 |
+
|
209 |
public function display_admin_page() {
|
210 |
include_once( 'views/admin/admin.php' );
|
211 |
}
|
212 |
+
|
213 |
/**
|
214 |
* Enqueue JS for the admin area
|
215 |
+
*
|
216 |
* @since 2.0.0
|
217 |
*/
|
218 |
public function enqueue_admin_scripts() {
|
225 |
wp_enqueue_script( 'gce-admin', plugins_url( 'js/gce-admin.js', __FILE__ ), array( 'jquery' ), $this->version, true );
|
226 |
}
|
227 |
}
|
228 |
+
|
229 |
/**
|
230 |
* Enqueue styles for the admin area
|
231 |
+
*
|
232 |
* @since 2.0.0
|
233 |
*/
|
234 |
public function enqueue_admin_styles() {
|
244 |
|
245 |
// Use minified CSS from CDN referenced at https://code.jquery.com/ui/
|
246 |
wp_enqueue_style( 'jquery-ui-smoothness', '//code.jquery.com/ui/' . $queryui->ver . '/themes/smoothness/jquery-ui.min.css', array(), $this->version );
|
247 |
+
|
248 |
wp_enqueue_style( 'gce-admin', plugins_url( 'css/admin.css', __FILE__ ), array(), $this->version, 'all' );
|
249 |
}
|
250 |
}
|
251 |
+
|
252 |
/**
|
253 |
* Define constants that will be used throughout admin specific code
|
254 |
+
*
|
255 |
* @since 2.0.0
|
256 |
*/
|
257 |
public function define_admin_constants() {
|
276 |
|
277 |
return self::$instance;
|
278 |
}
|
279 |
+
|
280 |
/**
|
281 |
* Return plugin name
|
282 |
+
*
|
283 |
* @since 2.0.0
|
284 |
*/
|
285 |
public function get_plugin_title() {
|
google-calendar-events.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* 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.
|
6 |
* Author: Moonstone Media
|
7 |
* Author URI: http://moonstonemediagroup.com
|
8 |
-
* Version: 2.
|
9 |
* Text Domain: gce
|
10 |
* Domain Path: /languages/
|
11 |
*
|
5 |
* 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.
|
6 |
* Author: Moonstone Media
|
7 |
* Author URI: http://moonstonemediagroup.com
|
8 |
+
* Version: 2.4.0
|
9 |
* Text Domain: gce
|
10 |
* Domain Path: /languages/
|
11 |
*
|
includes/admin/upgrade.php
CHANGED
@@ -14,56 +14,56 @@ add_action( 'init', 'gce_upgrade', 20 );
|
|
14 |
|
15 |
/**
|
16 |
* Main GCE Upgrade function. Call this and branch of from here depending on what we need to do
|
17 |
-
*
|
18 |
* @since 2.0.0
|
19 |
*/
|
20 |
function gce_upgrade() {
|
21 |
-
|
22 |
$version = get_option( 'gce_version' );
|
23 |
-
|
24 |
if( ! empty( $version ) ) {
|
25 |
-
|
26 |
// Clear out cache when upgrading no matter the version
|
27 |
gce_upgrade_clear_cache();
|
28 |
-
|
29 |
// Check if under version 2 and run the v2 upgrade if we are
|
30 |
if( version_compare( $version, '2.0.0-beta1', '<' ) && false === get_option( 'gce_upgrade_has_run' ) ) {
|
31 |
gce_v2_upgrade();
|
32 |
}
|
33 |
-
|
34 |
// Version 2.0.4 upgrade
|
35 |
if( version_compare( $version, '2.0.4', '<' ) ) {
|
36 |
gce_v204_upgrade();
|
37 |
}
|
38 |
-
|
39 |
// Version 2.0.6 upgrade
|
40 |
if( version_compare( $version, '2.0.6', '<' ) ) {
|
41 |
gce_v206_upgrade();
|
42 |
}
|
43 |
-
|
44 |
if( version_compare( $version, '2.1.0', '<' ) ) {
|
45 |
gce_v210_upgrade();
|
46 |
}
|
47 |
-
|
48 |
if( version_compare( $version, '2.2.0', '<' ) ) {
|
49 |
gce_v220_upgrade();
|
50 |
}
|
51 |
-
|
52 |
if( version_compare( $version, '2.2.2', '<' ) ) {
|
53 |
gce_v222_upgrade();
|
54 |
}
|
55 |
}
|
56 |
-
|
57 |
$new_version = Google_Calendar_Events::get_instance()->get_plugin_version();
|
58 |
update_option( 'gce_version', $new_version );
|
59 |
-
|
60 |
add_option( 'gce_upgrade_has_run', 1 );
|
61 |
}
|
62 |
|
63 |
function gce_v222_upgrade() {
|
64 |
// Need to set the new option for always enqueuing scripts as default enabled for upgrading users
|
65 |
$options = get_option( 'gce_settings_general' );
|
66 |
-
|
67 |
if( false !== $options ) {
|
68 |
$options['always_enqueue'] = 1;
|
69 |
update_option( 'gce_settings_general', $options );
|
@@ -73,50 +73,50 @@ function gce_v222_upgrade() {
|
|
73 |
function gce_v220_upgrade() {
|
74 |
// Update feeds
|
75 |
$q = new WP_Query( 'post_type=gce_feed' );
|
76 |
-
|
77 |
if( $q->have_posts() ) {
|
78 |
while( $q->have_posts() ) {
|
79 |
-
|
80 |
$q->the_post();
|
81 |
-
|
82 |
$gce_list_max_num = get_post_meta( get_the_ID(), 'gce_list_max_num', true );
|
83 |
$gce_list_max_length = get_post_meta( get_the_ID(), 'gce_list_max_length', true );
|
84 |
$gce_feed_start_interval = get_post_meta( get_the_ID(), 'gce_feed_start_interval', true );
|
85 |
$gce_feed_start = get_post_meta( get_the_ID(), 'gce_feed_start', true );
|
86 |
$gce_feed_end_interval = get_post_meta( get_the_ID(), 'gce_feed_end_interval', true );
|
87 |
$gce_feed_end = get_post_meta( get_the_ID(), 'gce_feed_end', true );
|
88 |
-
|
89 |
update_post_meta( get_the_ID(), 'gce_per_page_num', $gce_list_max_num );
|
90 |
update_post_meta( get_the_ID(), 'gce_events_per_page', $gce_list_max_length );
|
91 |
update_post_meta( get_the_ID(), 'gce_feed_start', $gce_feed_start_interval );
|
92 |
update_post_meta( get_the_ID(), 'gce_feed_start_num', $gce_feed_start );
|
93 |
update_post_meta( get_the_ID(), 'gce_feed_end', $gce_feed_end_interval );
|
94 |
update_post_meta( get_the_ID(), 'gce_feed_end_num', $gce_feed_end );
|
95 |
-
|
96 |
// Add new show tooltips option checked as default
|
97 |
update_post_meta( get_the_ID(), 'gce_show_tooltips', 1 );
|
98 |
-
|
99 |
}
|
100 |
}
|
101 |
-
|
102 |
wp_reset_postdata();
|
103 |
-
|
104 |
|
105 |
// Update widgets for new UI
|
106 |
$widget = get_option( 'widget_gce_widget' );
|
107 |
-
|
108 |
if( is_array( $widget ) && ! empty( $widget ) ) {
|
109 |
foreach( $widget as $a => $b ) {
|
110 |
if( ! is_array( $b ) ) {
|
111 |
continue;
|
112 |
-
}
|
113 |
|
114 |
foreach( $b as $k => $v ) {
|
115 |
$widget[$a]['per_page_num'] = $widget[$a]['list_max_num'];
|
116 |
$widget[$a]['events_per_page'] = $widget[$a]['list_max_length'];
|
117 |
}
|
118 |
}
|
119 |
-
|
120 |
update_option( 'widget_gce_widget', $widget );
|
121 |
}
|
122 |
}
|
@@ -125,66 +125,66 @@ function gce_v220_upgrade() {
|
|
125 |
* Run the upgrade to version 2.1.0
|
126 |
*/
|
127 |
function gce_v210_upgrade() {
|
128 |
-
|
129 |
$q = new WP_Query( 'post_type=gce_feed' );
|
130 |
-
|
131 |
if( $q->have_posts() ) {
|
132 |
while( $q->have_posts() ) {
|
133 |
$q->the_post();
|
134 |
-
|
135 |
$url = get_post_meta( get_the_ID(), 'gce_feed_url', true );
|
136 |
-
|
137 |
// https://www.google.com/calendar/feeds/umsb0ekhivs1a2ubtq6vlqvcjk%40group.calendar.google.com/public/basic
|
138 |
-
|
139 |
$url = str_replace( 'https://www.google.com/calendar/feeds/', '', $url );
|
140 |
$url = str_replace( '/public/basic', '', $url );
|
141 |
$url = str_replace( '%40', '@', $url );
|
142 |
-
|
143 |
update_post_meta( get_the_ID(), 'gce_feed_url', $url );
|
144 |
}
|
145 |
}
|
146 |
-
|
147 |
wp_reset_postdata();
|
148 |
}
|
149 |
|
150 |
/*
|
151 |
* Run the upgrade to version 2.0.6
|
152 |
-
*
|
153 |
* @since 2.0.4
|
154 |
*/
|
155 |
function gce_v206_upgrade() {
|
156 |
-
|
157 |
// Update feeds
|
158 |
$q = new WP_Query( 'post_type=gce_feed' );
|
159 |
-
|
160 |
if( $q->have_posts() ) {
|
161 |
while( $q->have_posts() ) {
|
162 |
$q->the_post();
|
163 |
-
|
164 |
update_post_meta( get_the_ID(), 'gce_feed_start', '1' );
|
165 |
update_post_meta( get_the_ID(), 'gce_feed_start_interval', 'months' );
|
166 |
update_post_meta( get_the_ID(), 'gce_feed_end', '2' );
|
167 |
update_post_meta( get_the_ID(), 'gce_feed_end_interval', 'years' );
|
168 |
}
|
169 |
}
|
170 |
-
|
171 |
wp_reset_postdata();
|
172 |
}
|
173 |
|
174 |
/*
|
175 |
* Run the upgrade to version 2.0.4
|
176 |
-
*
|
177 |
* @since 2.0.4
|
178 |
*/
|
179 |
function gce_v204_upgrade() {
|
180 |
-
|
181 |
// Update feeds
|
182 |
$q = new WP_Query( 'post_type=gce_feed' );
|
183 |
-
|
184 |
if( $q->have_posts() ) {
|
185 |
while( $q->have_posts() ) {
|
186 |
$q->the_post();
|
187 |
-
|
188 |
update_post_meta( get_the_ID(), 'gce_paging', '1' );
|
189 |
update_post_meta( get_the_ID(), 'gce_list_max_num', '7' );
|
190 |
update_post_meta( get_the_ID(), 'gce_list_max_length', 'days' );
|
@@ -192,18 +192,18 @@ function gce_v204_upgrade() {
|
|
192 |
update_post_meta( get_the_ID(), 'gce_list_start_offset_direction', 'back' );
|
193 |
}
|
194 |
}
|
195 |
-
|
196 |
wp_reset_postdata();
|
197 |
-
|
198 |
|
199 |
// Update widgets
|
200 |
$widget = get_option( 'widget_gce_widget' );
|
201 |
-
|
202 |
if( is_array( $widget ) && ! empty( $widget ) ) {
|
203 |
foreach( $widget as $a => $b ) {
|
204 |
if( ! is_array( $b ) ) {
|
205 |
continue;
|
206 |
-
}
|
207 |
|
208 |
foreach( $b as $k => $v ) {
|
209 |
$widget[$a]['paging'] = '1';
|
@@ -213,21 +213,21 @@ function gce_v204_upgrade() {
|
|
213 |
$widget[$a]['list_start_offset_direction'] = 'back';
|
214 |
}
|
215 |
}
|
216 |
-
|
217 |
update_option( 'widget_gce_widget', $widget );
|
218 |
}
|
219 |
}
|
220 |
|
221 |
/*
|
222 |
* Run the upgrade to version 2.0.0
|
223 |
-
*
|
224 |
* @since 2.0.0
|
225 |
*/
|
226 |
function gce_v2_upgrade() {
|
227 |
$old_options = get_option( 'gce_options' );
|
228 |
-
|
229 |
if( false !== $old_options ) {
|
230 |
-
|
231 |
if( ! empty( $old_options ) ) {
|
232 |
foreach( $old_options as $key => $value ) {
|
233 |
convert_to_cpt_posts( $value );
|
@@ -240,7 +240,7 @@ function gce_v2_upgrade() {
|
|
240 |
|
241 |
/**
|
242 |
* Converts the old database options to the new CPT layout for 2.0.0+
|
243 |
-
*
|
244 |
* @since 2.0.0
|
245 |
*/
|
246 |
function convert_to_cpt_posts( $args ) {
|
@@ -251,25 +251,25 @@ function convert_to_cpt_posts( $args ) {
|
|
251 |
'post_status' => 'publish',
|
252 |
'post_type' => 'gce_feed'
|
253 |
);
|
254 |
-
|
255 |
if( $args['use_builder'] == true ) {
|
256 |
$post['post_content'] = $args['builder'];
|
257 |
}
|
258 |
-
|
259 |
$post_id = wp_insert_post( $post );
|
260 |
-
|
261 |
create_cpt_meta( $post_id, $args );
|
262 |
-
|
263 |
clear_old_transients( $args['id'] );
|
264 |
}
|
265 |
|
266 |
/**
|
267 |
* Add the CPT post meta based on options set for the old feeds prior to v2
|
268 |
-
*
|
269 |
* @since 2.0.0
|
270 |
*/
|
271 |
function create_cpt_meta( $id, $args ) {
|
272 |
-
|
273 |
// Convert the dropdown values to the new values for "Retrieve Events From"
|
274 |
switch( $args['retrieve_from'] ) {
|
275 |
case 'now':
|
@@ -288,11 +288,11 @@ function create_cpt_meta( $id, $args ) {
|
|
288 |
case 'date':
|
289 |
$from = 'custom_date';
|
290 |
break;
|
291 |
-
default:
|
292 |
$from = 'start_time';
|
293 |
break;
|
294 |
}
|
295 |
-
|
296 |
// Convert the dropdown values to the new values for "Retrieve Events Until"
|
297 |
switch( $args['retrieve_until'] ) {
|
298 |
case 'now':
|
@@ -311,13 +311,13 @@ function create_cpt_meta( $id, $args ) {
|
|
311 |
case 'date':
|
312 |
$until = 'custom_date';
|
313 |
break;
|
314 |
-
default:
|
315 |
$until = 'end_time';
|
316 |
break;
|
317 |
}
|
318 |
-
|
319 |
$gce_expand_recurring = ( isset( $args['expand_recurring'] ) ? ( $args['expand_recurring'] == 'true' ? '1' : '0' ) : '1' );
|
320 |
-
|
321 |
// An array to hold all of our post meta ids and values so that we can loop through and add as post meta easily
|
322 |
$post_meta_fields = array(
|
323 |
'gce_feed_url' => $args['url'],
|
@@ -335,9 +335,9 @@ function create_cpt_meta( $id, $args ) {
|
|
335 |
'gce_search_query' => ( isset( $args['query'] ) ? $args['query'] : '' ),
|
336 |
'gce_expand_recurring' => $gce_expand_recurring
|
337 |
);
|
338 |
-
|
339 |
if( $args['use_builder'] == 'false' || $args['use_builder'] == false ) {
|
340 |
-
$display_meta = array(
|
341 |
'gce_display_simple' => 1,
|
342 |
'gce_display_start' => $args['display_start'],
|
343 |
'gce_display_start_text' => $args['display_start_text'],
|
@@ -353,10 +353,10 @@ function create_cpt_meta( $id, $args ) {
|
|
353 |
'gce_display_link_tab' => ( $args['display_link_target'] == 'on' ? '1' : '0' ),
|
354 |
'gce_display_link_text' => $args['display_link_text']
|
355 |
);
|
356 |
-
|
357 |
$post_meta_fields = array_merge( $post_meta_fields, $display_meta );
|
358 |
}
|
359 |
-
|
360 |
// Loop through each $post_meta_field and add as an entry
|
361 |
foreach( $post_meta_fields as $k => $v ) {
|
362 |
update_post_meta( $id, $k, $v );
|
@@ -370,30 +370,30 @@ function gce_convert_timestamp( $t ) {
|
|
370 |
|
371 |
/**
|
372 |
* Remove the old transient values from the database
|
373 |
-
*
|
374 |
* @since 2.0.0
|
375 |
*/
|
376 |
function clear_old_transients( $id ) {
|
377 |
-
|
378 |
delete_transient( 'gce_feed_' . $id );
|
379 |
delete_transient( 'gce_feed_' . $id . '_url' );
|
380 |
delete_transient( 'gce_feed_ids' );
|
381 |
}
|
382 |
|
383 |
-
/**
|
384 |
* Update widget IDs
|
385 |
-
*
|
386 |
* @since 2.0.0
|
387 |
*/
|
388 |
function update_widget_feed_ids() {
|
389 |
-
|
390 |
$widget = get_option( 'widget_gce_widget' );
|
391 |
-
|
392 |
if( is_array( $widget ) && ! empty( $widget ) ) {
|
393 |
foreach( $widget as $a => $b ) {
|
394 |
if( ! is_array( $b ) ) {
|
395 |
continue;
|
396 |
-
}
|
397 |
|
398 |
foreach( $b as $k => $v ) {
|
399 |
|
@@ -402,15 +402,15 @@ function update_widget_feed_ids() {
|
|
402 |
}
|
403 |
|
404 |
$id = $v;
|
405 |
-
|
406 |
//$multi = str_replace( ' ', '', $v );
|
407 |
-
|
408 |
$multi = explode( ',', str_replace( ' ', '', $id ) );
|
409 |
-
|
410 |
if( is_array( $multi ) ) {
|
411 |
-
|
412 |
$new_ids = '';
|
413 |
-
|
414 |
foreach( $multi as $m ) {
|
415 |
$q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$m&order=ASC" );
|
416 |
|
@@ -419,13 +419,13 @@ function update_widget_feed_ids() {
|
|
419 |
$q->the_post();
|
420 |
// Set our ID to the old ID if found
|
421 |
$m = get_the_ID();
|
422 |
-
|
423 |
$new_ids .= $m . ',';
|
424 |
}
|
425 |
}
|
426 |
-
|
427 |
wp_reset_postdata();
|
428 |
-
|
429 |
$widget[$a][$k] = substr( $new_ids, 0, -1 );
|
430 |
} else {
|
431 |
|
@@ -437,36 +437,36 @@ function update_widget_feed_ids() {
|
|
437 |
// Set our ID to the old ID if found
|
438 |
$id = get_the_ID();
|
439 |
}
|
440 |
-
|
441 |
wp_reset_postdata();
|
442 |
|
443 |
$widget[$a][$k] = $id;
|
444 |
}
|
445 |
}
|
446 |
}
|
447 |
-
|
448 |
update_option( 'widget_gce_widget', $widget );
|
449 |
}
|
450 |
-
|
451 |
}
|
452 |
|
453 |
-
/**
|
454 |
* Update widget IDs
|
455 |
-
*
|
456 |
* @since 2.0.6.3
|
457 |
*/
|
458 |
function gce_upgrade_clear_cache() {
|
459 |
// Update feeds
|
460 |
$q = new WP_Query( 'post_type=gce_feed' );
|
461 |
-
|
462 |
if( $q->have_posts() ) {
|
463 |
while( $q->have_posts() ) {
|
464 |
-
|
465 |
$q->the_post();
|
466 |
-
|
467 |
delete_transient( 'gce_feed_' . get_the_ID() );
|
468 |
}
|
469 |
}
|
470 |
-
|
471 |
wp_reset_postdata();
|
472 |
-
}
|
14 |
|
15 |
/**
|
16 |
* Main GCE Upgrade function. Call this and branch of from here depending on what we need to do
|
17 |
+
*
|
18 |
* @since 2.0.0
|
19 |
*/
|
20 |
function gce_upgrade() {
|
21 |
+
|
22 |
$version = get_option( 'gce_version' );
|
23 |
+
|
24 |
if( ! empty( $version ) ) {
|
25 |
+
|
26 |
// Clear out cache when upgrading no matter the version
|
27 |
gce_upgrade_clear_cache();
|
28 |
+
|
29 |
// Check if under version 2 and run the v2 upgrade if we are
|
30 |
if( version_compare( $version, '2.0.0-beta1', '<' ) && false === get_option( 'gce_upgrade_has_run' ) ) {
|
31 |
gce_v2_upgrade();
|
32 |
}
|
33 |
+
|
34 |
// Version 2.0.4 upgrade
|
35 |
if( version_compare( $version, '2.0.4', '<' ) ) {
|
36 |
gce_v204_upgrade();
|
37 |
}
|
38 |
+
|
39 |
// Version 2.0.6 upgrade
|
40 |
if( version_compare( $version, '2.0.6', '<' ) ) {
|
41 |
gce_v206_upgrade();
|
42 |
}
|
43 |
+
|
44 |
if( version_compare( $version, '2.1.0', '<' ) ) {
|
45 |
gce_v210_upgrade();
|
46 |
}
|
47 |
+
|
48 |
if( version_compare( $version, '2.2.0', '<' ) ) {
|
49 |
gce_v220_upgrade();
|
50 |
}
|
51 |
+
|
52 |
if( version_compare( $version, '2.2.2', '<' ) ) {
|
53 |
gce_v222_upgrade();
|
54 |
}
|
55 |
}
|
56 |
+
|
57 |
$new_version = Google_Calendar_Events::get_instance()->get_plugin_version();
|
58 |
update_option( 'gce_version', $new_version );
|
59 |
+
|
60 |
add_option( 'gce_upgrade_has_run', 1 );
|
61 |
}
|
62 |
|
63 |
function gce_v222_upgrade() {
|
64 |
// Need to set the new option for always enqueuing scripts as default enabled for upgrading users
|
65 |
$options = get_option( 'gce_settings_general' );
|
66 |
+
|
67 |
if( false !== $options ) {
|
68 |
$options['always_enqueue'] = 1;
|
69 |
update_option( 'gce_settings_general', $options );
|
73 |
function gce_v220_upgrade() {
|
74 |
// Update feeds
|
75 |
$q = new WP_Query( 'post_type=gce_feed' );
|
76 |
+
|
77 |
if( $q->have_posts() ) {
|
78 |
while( $q->have_posts() ) {
|
79 |
+
|
80 |
$q->the_post();
|
81 |
+
|
82 |
$gce_list_max_num = get_post_meta( get_the_ID(), 'gce_list_max_num', true );
|
83 |
$gce_list_max_length = get_post_meta( get_the_ID(), 'gce_list_max_length', true );
|
84 |
$gce_feed_start_interval = get_post_meta( get_the_ID(), 'gce_feed_start_interval', true );
|
85 |
$gce_feed_start = get_post_meta( get_the_ID(), 'gce_feed_start', true );
|
86 |
$gce_feed_end_interval = get_post_meta( get_the_ID(), 'gce_feed_end_interval', true );
|
87 |
$gce_feed_end = get_post_meta( get_the_ID(), 'gce_feed_end', true );
|
88 |
+
|
89 |
update_post_meta( get_the_ID(), 'gce_per_page_num', $gce_list_max_num );
|
90 |
update_post_meta( get_the_ID(), 'gce_events_per_page', $gce_list_max_length );
|
91 |
update_post_meta( get_the_ID(), 'gce_feed_start', $gce_feed_start_interval );
|
92 |
update_post_meta( get_the_ID(), 'gce_feed_start_num', $gce_feed_start );
|
93 |
update_post_meta( get_the_ID(), 'gce_feed_end', $gce_feed_end_interval );
|
94 |
update_post_meta( get_the_ID(), 'gce_feed_end_num', $gce_feed_end );
|
95 |
+
|
96 |
// Add new show tooltips option checked as default
|
97 |
update_post_meta( get_the_ID(), 'gce_show_tooltips', 1 );
|
98 |
+
|
99 |
}
|
100 |
}
|
101 |
+
|
102 |
wp_reset_postdata();
|
103 |
+
|
104 |
|
105 |
// Update widgets for new UI
|
106 |
$widget = get_option( 'widget_gce_widget' );
|
107 |
+
|
108 |
if( is_array( $widget ) && ! empty( $widget ) ) {
|
109 |
foreach( $widget as $a => $b ) {
|
110 |
if( ! is_array( $b ) ) {
|
111 |
continue;
|
112 |
+
}
|
113 |
|
114 |
foreach( $b as $k => $v ) {
|
115 |
$widget[$a]['per_page_num'] = $widget[$a]['list_max_num'];
|
116 |
$widget[$a]['events_per_page'] = $widget[$a]['list_max_length'];
|
117 |
}
|
118 |
}
|
119 |
+
|
120 |
update_option( 'widget_gce_widget', $widget );
|
121 |
}
|
122 |
}
|
125 |
* Run the upgrade to version 2.1.0
|
126 |
*/
|
127 |
function gce_v210_upgrade() {
|
128 |
+
|
129 |
$q = new WP_Query( 'post_type=gce_feed' );
|
130 |
+
|
131 |
if( $q->have_posts() ) {
|
132 |
while( $q->have_posts() ) {
|
133 |
$q->the_post();
|
134 |
+
|
135 |
$url = get_post_meta( get_the_ID(), 'gce_feed_url', true );
|
136 |
+
|
137 |
// https://www.google.com/calendar/feeds/umsb0ekhivs1a2ubtq6vlqvcjk%40group.calendar.google.com/public/basic
|
138 |
+
|
139 |
$url = str_replace( 'https://www.google.com/calendar/feeds/', '', $url );
|
140 |
$url = str_replace( '/public/basic', '', $url );
|
141 |
$url = str_replace( '%40', '@', $url );
|
142 |
+
|
143 |
update_post_meta( get_the_ID(), 'gce_feed_url', $url );
|
144 |
}
|
145 |
}
|
146 |
+
|
147 |
wp_reset_postdata();
|
148 |
}
|
149 |
|
150 |
/*
|
151 |
* Run the upgrade to version 2.0.6
|
152 |
+
*
|
153 |
* @since 2.0.4
|
154 |
*/
|
155 |
function gce_v206_upgrade() {
|
156 |
+
|
157 |
// Update feeds
|
158 |
$q = new WP_Query( 'post_type=gce_feed' );
|
159 |
+
|
160 |
if( $q->have_posts() ) {
|
161 |
while( $q->have_posts() ) {
|
162 |
$q->the_post();
|
163 |
+
|
164 |
update_post_meta( get_the_ID(), 'gce_feed_start', '1' );
|
165 |
update_post_meta( get_the_ID(), 'gce_feed_start_interval', 'months' );
|
166 |
update_post_meta( get_the_ID(), 'gce_feed_end', '2' );
|
167 |
update_post_meta( get_the_ID(), 'gce_feed_end_interval', 'years' );
|
168 |
}
|
169 |
}
|
170 |
+
|
171 |
wp_reset_postdata();
|
172 |
}
|
173 |
|
174 |
/*
|
175 |
* Run the upgrade to version 2.0.4
|
176 |
+
*
|
177 |
* @since 2.0.4
|
178 |
*/
|
179 |
function gce_v204_upgrade() {
|
180 |
+
|
181 |
// Update feeds
|
182 |
$q = new WP_Query( 'post_type=gce_feed' );
|
183 |
+
|
184 |
if( $q->have_posts() ) {
|
185 |
while( $q->have_posts() ) {
|
186 |
$q->the_post();
|
187 |
+
|
188 |
update_post_meta( get_the_ID(), 'gce_paging', '1' );
|
189 |
update_post_meta( get_the_ID(), 'gce_list_max_num', '7' );
|
190 |
update_post_meta( get_the_ID(), 'gce_list_max_length', 'days' );
|
192 |
update_post_meta( get_the_ID(), 'gce_list_start_offset_direction', 'back' );
|
193 |
}
|
194 |
}
|
195 |
+
|
196 |
wp_reset_postdata();
|
197 |
+
|
198 |
|
199 |
// Update widgets
|
200 |
$widget = get_option( 'widget_gce_widget' );
|
201 |
+
|
202 |
if( is_array( $widget ) && ! empty( $widget ) ) {
|
203 |
foreach( $widget as $a => $b ) {
|
204 |
if( ! is_array( $b ) ) {
|
205 |
continue;
|
206 |
+
}
|
207 |
|
208 |
foreach( $b as $k => $v ) {
|
209 |
$widget[$a]['paging'] = '1';
|
213 |
$widget[$a]['list_start_offset_direction'] = 'back';
|
214 |
}
|
215 |
}
|
216 |
+
|
217 |
update_option( 'widget_gce_widget', $widget );
|
218 |
}
|
219 |
}
|
220 |
|
221 |
/*
|
222 |
* Run the upgrade to version 2.0.0
|
223 |
+
*
|
224 |
* @since 2.0.0
|
225 |
*/
|
226 |
function gce_v2_upgrade() {
|
227 |
$old_options = get_option( 'gce_options' );
|
228 |
+
|
229 |
if( false !== $old_options ) {
|
230 |
+
|
231 |
if( ! empty( $old_options ) ) {
|
232 |
foreach( $old_options as $key => $value ) {
|
233 |
convert_to_cpt_posts( $value );
|
240 |
|
241 |
/**
|
242 |
* Converts the old database options to the new CPT layout for 2.0.0+
|
243 |
+
*
|
244 |
* @since 2.0.0
|
245 |
*/
|
246 |
function convert_to_cpt_posts( $args ) {
|
251 |
'post_status' => 'publish',
|
252 |
'post_type' => 'gce_feed'
|
253 |
);
|
254 |
+
|
255 |
if( $args['use_builder'] == true ) {
|
256 |
$post['post_content'] = $args['builder'];
|
257 |
}
|
258 |
+
|
259 |
$post_id = wp_insert_post( $post );
|
260 |
+
|
261 |
create_cpt_meta( $post_id, $args );
|
262 |
+
|
263 |
clear_old_transients( $args['id'] );
|
264 |
}
|
265 |
|
266 |
/**
|
267 |
* Add the CPT post meta based on options set for the old feeds prior to v2
|
268 |
+
*
|
269 |
* @since 2.0.0
|
270 |
*/
|
271 |
function create_cpt_meta( $id, $args ) {
|
272 |
+
|
273 |
// Convert the dropdown values to the new values for "Retrieve Events From"
|
274 |
switch( $args['retrieve_from'] ) {
|
275 |
case 'now':
|
288 |
case 'date':
|
289 |
$from = 'custom_date';
|
290 |
break;
|
291 |
+
default:
|
292 |
$from = 'start_time';
|
293 |
break;
|
294 |
}
|
295 |
+
|
296 |
// Convert the dropdown values to the new values for "Retrieve Events Until"
|
297 |
switch( $args['retrieve_until'] ) {
|
298 |
case 'now':
|
311 |
case 'date':
|
312 |
$until = 'custom_date';
|
313 |
break;
|
314 |
+
default:
|
315 |
$until = 'end_time';
|
316 |
break;
|
317 |
}
|
318 |
+
|
319 |
$gce_expand_recurring = ( isset( $args['expand_recurring'] ) ? ( $args['expand_recurring'] == 'true' ? '1' : '0' ) : '1' );
|
320 |
+
|
321 |
// An array to hold all of our post meta ids and values so that we can loop through and add as post meta easily
|
322 |
$post_meta_fields = array(
|
323 |
'gce_feed_url' => $args['url'],
|
335 |
'gce_search_query' => ( isset( $args['query'] ) ? $args['query'] : '' ),
|
336 |
'gce_expand_recurring' => $gce_expand_recurring
|
337 |
);
|
338 |
+
|
339 |
if( $args['use_builder'] == 'false' || $args['use_builder'] == false ) {
|
340 |
+
$display_meta = array(
|
341 |
'gce_display_simple' => 1,
|
342 |
'gce_display_start' => $args['display_start'],
|
343 |
'gce_display_start_text' => $args['display_start_text'],
|
353 |
'gce_display_link_tab' => ( $args['display_link_target'] == 'on' ? '1' : '0' ),
|
354 |
'gce_display_link_text' => $args['display_link_text']
|
355 |
);
|
356 |
+
|
357 |
$post_meta_fields = array_merge( $post_meta_fields, $display_meta );
|
358 |
}
|
359 |
+
|
360 |
// Loop through each $post_meta_field and add as an entry
|
361 |
foreach( $post_meta_fields as $k => $v ) {
|
362 |
update_post_meta( $id, $k, $v );
|
370 |
|
371 |
/**
|
372 |
* Remove the old transient values from the database
|
373 |
+
*
|
374 |
* @since 2.0.0
|
375 |
*/
|
376 |
function clear_old_transients( $id ) {
|
377 |
+
|
378 |
delete_transient( 'gce_feed_' . $id );
|
379 |
delete_transient( 'gce_feed_' . $id . '_url' );
|
380 |
delete_transient( 'gce_feed_ids' );
|
381 |
}
|
382 |
|
383 |
+
/**
|
384 |
* Update widget IDs
|
385 |
+
*
|
386 |
* @since 2.0.0
|
387 |
*/
|
388 |
function update_widget_feed_ids() {
|
389 |
+
|
390 |
$widget = get_option( 'widget_gce_widget' );
|
391 |
+
|
392 |
if( is_array( $widget ) && ! empty( $widget ) ) {
|
393 |
foreach( $widget as $a => $b ) {
|
394 |
if( ! is_array( $b ) ) {
|
395 |
continue;
|
396 |
+
}
|
397 |
|
398 |
foreach( $b as $k => $v ) {
|
399 |
|
402 |
}
|
403 |
|
404 |
$id = $v;
|
405 |
+
|
406 |
//$multi = str_replace( ' ', '', $v );
|
407 |
+
|
408 |
$multi = explode( ',', str_replace( ' ', '', $id ) );
|
409 |
+
|
410 |
if( is_array( $multi ) ) {
|
411 |
+
|
412 |
$new_ids = '';
|
413 |
+
|
414 |
foreach( $multi as $m ) {
|
415 |
$q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$m&order=ASC" );
|
416 |
|
419 |
$q->the_post();
|
420 |
// Set our ID to the old ID if found
|
421 |
$m = get_the_ID();
|
422 |
+
|
423 |
$new_ids .= $m . ',';
|
424 |
}
|
425 |
}
|
426 |
+
|
427 |
wp_reset_postdata();
|
428 |
+
|
429 |
$widget[$a][$k] = substr( $new_ids, 0, -1 );
|
430 |
} else {
|
431 |
|
437 |
// Set our ID to the old ID if found
|
438 |
$id = get_the_ID();
|
439 |
}
|
440 |
+
|
441 |
wp_reset_postdata();
|
442 |
|
443 |
$widget[$a][$k] = $id;
|
444 |
}
|
445 |
}
|
446 |
}
|
447 |
+
|
448 |
update_option( 'widget_gce_widget', $widget );
|
449 |
}
|
450 |
+
|
451 |
}
|
452 |
|
453 |
+
/**
|
454 |
* Update widget IDs
|
455 |
+
*
|
456 |
* @since 2.0.6.3
|
457 |
*/
|
458 |
function gce_upgrade_clear_cache() {
|
459 |
// Update feeds
|
460 |
$q = new WP_Query( 'post_type=gce_feed' );
|
461 |
+
|
462 |
if( $q->have_posts() ) {
|
463 |
while( $q->have_posts() ) {
|
464 |
+
|
465 |
$q->the_post();
|
466 |
+
|
467 |
delete_transient( 'gce_feed_' . get_the_ID() );
|
468 |
}
|
469 |
}
|
470 |
+
|
471 |
wp_reset_postdata();
|
472 |
+
}
|
includes/class-gce-event.php
CHANGED
@@ -360,9 +360,14 @@ class GCE_Event {
|
|
360 |
|
361 |
$description = trim( $this->description );
|
362 |
|
363 |
-
if (
|
364 |
-
|
365 |
-
|
|
|
|
|
|
|
|
|
|
|
366 |
}
|
367 |
|
368 |
if ( $markdown || $html ) {
|
360 |
|
361 |
$description = trim( $this->description );
|
362 |
|
363 |
+
if ( $limit > 0 ) {
|
364 |
+
if ( str_word_count( $description, 0 ) > $limit ) {
|
365 |
+
$words = str_word_count( $description, 2 );
|
366 |
+
$pos = array_keys( $words );
|
367 |
+
$description = substr( $description, 0, $pos[ $limit ] ) . '...';
|
368 |
+
}
|
369 |
+
//preg_match( '/([\S]+\s*){0,' . $limit . '}/', $this->description, $description );
|
370 |
+
//$description = trim( $description[0] );
|
371 |
}
|
372 |
|
373 |
if ( $markdown || $html ) {
|
includes/register-settings.php
CHANGED
@@ -27,10 +27,9 @@ function gce_register_settings() {
|
|
27 |
'api_key' => array(
|
28 |
'id' => 'api_key',
|
29 |
'name' => __( 'Google API Key', 'gce' ),
|
30 |
-
'desc' => __( '
|
31 |
-
__( '
|
32 |
-
|
33 |
-
gce_ga_campaign_url( 'http://wpdocs.philderksen.com/google-calendar-events/getting-started/api-key-settings/', 'gce_lite', 'settings_link', 'docs' ) ),
|
34 |
'size' => 'regular-text',
|
35 |
'type' => 'text'
|
36 |
),
|
27 |
'api_key' => array(
|
28 |
'id' => 'api_key',
|
29 |
'name' => __( 'Google API Key', 'gce' ),
|
30 |
+
'desc' => __( 'Google now requires you to use your own API key to avoid running into the request limit.', 'gce' ) . '<br/>' .
|
31 |
+
sprintf( __( '<a href="%s" target="_blank">Instructions on how to generate and set your own Google API key.</a>', 'gce' ),
|
32 |
+
gce_ga_campaign_url( 'http://wpdocs.philderksen.com/google-calendar-events/getting-started/api-key-settings/', 'gce_lite', 'settings_link', 'docs' ) ),
|
|
|
33 |
'size' => 'regular-text',
|
34 |
'type' => 'text'
|
35 |
),
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Google Calendar Events ===
|
2 |
-
Contributors: pderksen, nickyoung87, nekojira, rosshanney
|
3 |
Tags: google calendar, google, calendar, events, gcal
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.3
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
|
@@ -26,7 +26,7 @@ Parses Google Calendar feeds and displays the events as a calendar grid or list
|
|
26 |
|
27 |
###Updates###
|
28 |
|
29 |
-
* [Get notified when new features are released](
|
30 |
* [Follow this project on Github](https://github.com/moonstonemedia/WP-Google-Calendar-Events)
|
31 |
|
32 |
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.
|
@@ -90,6 +90,10 @@ There are several ways to install this plugin.
|
|
90 |
|
91 |
== Changelog ==
|
92 |
|
|
|
|
|
|
|
|
|
93 |
= 2.3.2 - September 1, 2015 =
|
94 |
* Fix: Bug in HTML support in events description.
|
95 |
|
1 |
=== Google Calendar Events ===
|
2 |
+
Contributors: moonstonemedia, pderksen, nickyoung87, nekojira, rosshanney
|
3 |
Tags: google calendar, google, calendar, events, gcal
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.3
|
6 |
+
Stable tag: 2.4.0
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
|
26 |
|
27 |
###Updates###
|
28 |
|
29 |
+
* [Get notified when new features are released](https://www.getdrip.com/forms/9434542/submissions/new)
|
30 |
* [Follow this project on Github](https://github.com/moonstonemedia/WP-Google-Calendar-Events)
|
31 |
|
32 |
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.
|
90 |
|
91 |
== Changelog ==
|
92 |
|
93 |
+
= 2.4.0 - September 29, 2015 =
|
94 |
+
* Announcement: Simple Calendar is coming, changes ahead.
|
95 |
+
* Deprecation: The bundled/default Google API key reached it's quota and was shut off. Using your own API key is now required.
|
96 |
+
|
97 |
= 2.3.2 - September 1, 2015 =
|
98 |
* Fix: Bug in HTML support in events description.
|
99 |
|
views/admin/gce-feed-meta-display.php
CHANGED
@@ -68,8 +68,8 @@
|
|
68 |
<div id="gce-admin-promo">
|
69 |
<?php echo __( 'Want to be in the know?', 'gce' ); ?>
|
70 |
<strong>
|
71 |
-
<a href="
|
72 |
-
<?php echo __( 'Get notified
|
73 |
</a>
|
74 |
</strong>
|
75 |
</div>
|
68 |
<div id="gce-admin-promo">
|
69 |
<?php echo __( 'Want to be in the know?', 'gce' ); ?>
|
70 |
<strong>
|
71 |
+
<a href="https://www.getdrip.com/forms/9434542/submissions/new" target="_blank">
|
72 |
+
<?php echo __( 'Get notified of important updates', 'gce' ); ?>
|
73 |
</a>
|
74 |
</strong>
|
75 |
</div>
|
views/admin/gce-feed-sidebar-help.php
CHANGED
@@ -12,8 +12,8 @@
|
|
12 |
</li>
|
13 |
<li>
|
14 |
<div class="dashicons dashicons-arrow-right-alt2"></div>
|
15 |
-
<a href="
|
16 |
-
<?php _e( 'Get notified of
|
17 |
</li>
|
18 |
</ul>
|
19 |
|
12 |
</li>
|
13 |
<li>
|
14 |
<div class="dashicons dashicons-arrow-right-alt2"></div>
|
15 |
+
<a href="https://www.getdrip.com/forms/9434542/submissions/new" target="_blank">
|
16 |
+
<?php _e( 'Get notified of important updates', 'gce' ); ?></a>
|
17 |
</li>
|
18 |
</ul>
|
19 |
|