diff --git a/wp-content/plugins/google-calendar-events/admin/add.php b/wp-content/plugins/google-calendar-events/admin/add.php deleted file mode 100644 index 1c58e04..0000000 --- a/wp-content/plugins/google-calendar-events/admin/add.php +++ /dev/null @@ -1,376 +0,0 @@ - -

- - - - - -
- - - http://www.google.com/calendar/feeds/your-email@gmail.com/public/basic. -
- http://www.google.com/calendar/feeds/your-email@gmail.com/private-d65741b037h695ff274247f90746b2ty/basic. -
- - - - - - - -
- - - - -
- - - - -
- - - PHP date format. Leave this blank if you\'d rather stick with the default format for your blog.', GCE_TEXT_DOMAIN ); ?> -
- - - PHP date format. Again, leave this blank to stick with the default.', GCE_TEXT_DOMAIN ); ?> -
- - Default', '', $timezone_list ); - ?> - -
- - - -
- - - -
- -

- -

- - -
- - -

- - -

- - -
-

- - ) -

-

- -

- -

-

- -

-

- - -

- - -
- -

- -
- - - -
- -

- -
- - - -
- - - - -

- -
- - - - -

- -
- -

- -
- - - - -
- - -

- -
- - \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/admin/delete.php b/wp-content/plugins/google-calendar-events/admin/delete.php deleted file mode 100644 index 1e43e73..0000000 --- a/wp-content/plugins/google-calendar-events/admin/delete.php +++ /dev/null @@ -1,39 +0,0 @@ - -

- - - - - - \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/admin/edit.php b/wp-content/plugins/google-calendar-events/admin/edit.php deleted file mode 100644 index c90a542..0000000 --- a/wp-content/plugins/google-calendar-events/admin/edit.php +++ /dev/null @@ -1,389 +0,0 @@ - -

- - - - - -
- - - http://www.google.com/calendar/feeds/your-email@gmail.com/public/full.', GCE_TEXT_DOMAIN); ?> -
- http://www.google.com/calendar/feeds/your-email@gmail.com/private-d65741b037h695ff274247f90746b2ty/basic.', GCE_TEXT_DOMAIN); ?> -
- - - UNIX timestamp in the text-box.', GCE_TEXT_DOMAIN); ?> -
- - - - -
- - - - -
- - - PHP date format. Leave this blank if you\'d rather stick with the default format for your blog.', GCE_TEXT_DOMAIN); ?> -
- - - PHP date format. Again, leave this blank to stick with the default.', GCE_TEXT_DOMAIN); ?> -
- - - -
- - - -
- - - -
- /> -

- -

- - -
- - -

event display builder guide.', GCE_TEXT_DOMAIN); ?>

- - -
-

event display builder guide)', GCE_TEXT_DOMAIN); ?>

-

- -

- -

-

- -

-

- - -

- - -
- -

- -
- - - -
- -

- -
- - - -
- - - value="on" /> - -

- -
- - - value="on" /> - -

- -
- -

- -
- - - value="on" /> - -
- value="on" /> - -

- -
- - \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/admin/main.php b/wp-content/plugins/google-calendar-events/admin/main.php deleted file mode 100644 index 23333b4..0000000 --- a/wp-content/plugins/google-calendar-events/admin/main.php +++ /dev/null @@ -1,120 +0,0 @@ -
-

- - - -

-

- - - -

- - - - - - - - - - - - - - - - - - - - - - - - $event){ ?> - - - - - - - - - -
-  |  |  -
- - - -
-

- - - - - - - - - - - - - - - - - - - - - - - - - -
- google-calendar-events directory) and then enter its URL below.', GCE_TEXT_DOMAIN); ?> -
- -
- -
- value="on" /> -
- -
- -
- -
- -
- -
- value="on" /> -
- -
- value="on" /> -
- -
- value="on" /> -
- -
- - -
\ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/admin/refresh.php b/wp-content/plugins/google-calendar-events/admin/refresh.php deleted file mode 100644 index b74c32a..0000000 --- a/wp-content/plugins/google-calendar-events/admin/refresh.php +++ /dev/null @@ -1,40 +0,0 @@ - -

-

- - - - - - \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/assets/banner-772x250.jpg b/wp-content/plugins/google-calendar-events/assets/banner-772x250.jpg new file mode 100644 index 0000000..bbe92b1 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/assets/banner-772x250.jpg differ diff --git a/wp-content/plugins/google-calendar-events/assets/gcal-icon-16x16.png b/wp-content/plugins/google-calendar-events/assets/gcal-icon-16x16.png new file mode 100644 index 0000000..6524ff7 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/assets/gcal-icon-16x16.png differ diff --git a/wp-content/plugins/google-calendar-events/assets/icon-128x128.png b/wp-content/plugins/google-calendar-events/assets/icon-128x128.png new file mode 100644 index 0000000..7466b61 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/assets/icon-128x128.png differ diff --git a/wp-content/plugins/google-calendar-events/assets/icon-256x256.png b/wp-content/plugins/google-calendar-events/assets/icon-256x256.png new file mode 100644 index 0000000..7dceced Binary files /dev/null and b/wp-content/plugins/google-calendar-events/assets/icon-256x256.png differ diff --git a/wp-content/plugins/google-calendar-events/class-google-calendar-events-admin.php b/wp-content/plugins/google-calendar-events/class-google-calendar-events-admin.php new file mode 100644 index 0000000..41de3b0 --- /dev/null +++ b/wp-content/plugins/google-calendar-events/class-google-calendar-events-admin.php @@ -0,0 +1,158 @@ +, Nick Young + * @license GPL-2.0+ + * @link http://philderksen.com + * @copyright 2014 Phil Derksen + */ + + +class Google_Calendar_Events_Admin { + + /** + * Instance of this class. + * + * @since 2.0.0 + * + * @var object + */ + protected static $instance = null; + + protected $version = ''; + + /** + * Slug of the plugin screen. + * + * @since 2.0.0 + * + * @var string + */ + protected $plugin_screen_hook_suffix = null; + + /** + * Initialize the plugin by loading admin scripts & styles and adding a + * settings page and menu. + * + * @since 2.0.0 + */ + private function __construct() { + + $plugin = Google_Calendar_Events::get_instance(); + $this->plugin_slug = $plugin->get_plugin_slug(); + + $this->version = $plugin->get_plugin_version(); + + add_filter( 'plugin_action_links_' . plugin_basename( plugin_dir_path( __FILE__ ) . $this->plugin_slug . '.php' ), array( $this, 'add_action_links' ) ); + + // Setup admin side constants + add_action( 'init', array( $this, 'define_admin_constants' ) ); + + // Add admin styles + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); + + // Add admin scripts + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); + + // Add the options page and menu item. + add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ), 2 ); + } + + public function add_plugin_admin_menu() { + // Add Help submenu page + $this->plugin_screen_hook_suffix[] = add_submenu_page( + 'edit.php?post_type=gce_feed', + __( 'General Settings', 'gce' ), + __( 'General Settings', 'gce' ), + 'manage_options', + $this->plugin_slug . '_general_settings', + array( $this, 'display_admin_page' ) + ); + } + + public function display_admin_page() { + include_once( 'views/admin/admin.php' ); + } + + /** + * Enqueue scripts for the admin area + * + * @since 2.0.0 + */ + public function enqueue_admin_scripts() { + + wp_enqueue_script( 'jquery' ); + + wp_enqueue_script( 'jquery-ui-datepicker' ); + + wp_enqueue_script( 'gce-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), $this->version, true ); + } + + /** + * Enqueue styles for the admin area + * + * @since 2.0.0 + */ + public function enqueue_admin_styles() { + + wp_enqueue_style( 'jquery-ui-datepicker-css', plugins_url( 'css/jquery-ui-1.10.4.custom.min.css', __FILE__ ), array(), $this->version ); + + wp_enqueue_style( 'gce-admin', plugins_url( 'css/admin.css', __FILE__ ), array(), $this->version, 'all' ); + } + + /** + * Define constants that will be used throughout admin specific code + * + * @since 2.0.0 + */ + public function define_admin_constants() { + if( ! defined( 'GCE_DIR' ) ) { + define( 'GCE_DIR', dirname( __FILE__ ) ); + } + } + + /** + * Return an instance of this class. + * + * @since 2.0.0 + * + * @return object A single instance of this class. + */ + public static function get_instance() { + + // If the single instance hasn't been set, set it now. + if ( null == self::$instance ) { + self::$instance = new self; + } + + return self::$instance; + } + + /** + * Return plugin name + * + * @since 2.0.0 + */ + public function get_plugin_title() { + return __( 'Google Calendar Events', 'gce' ); + } + + /** + * Add settings action link to the plugins page. + * + * @since 2.0.0 + */ + public function add_action_links( $links ) { + + return array_merge( + array( + 'feeds' => '' . __( 'Feeds', 'gce' ) . '' + //'settings' => '' . __( 'Settings', 'gce' ) . '', + ), + $links + ); + + } +} diff --git a/wp-content/plugins/google-calendar-events/class-google-calendar-events.php b/wp-content/plugins/google-calendar-events/class-google-calendar-events.php new file mode 100644 index 0000000..4307deb --- /dev/null +++ b/wp-content/plugins/google-calendar-events/class-google-calendar-events.php @@ -0,0 +1,223 @@ +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + + +class Google_Calendar_Events { + + /** + * Plugin version, used for cache-busting of style and script file references. + * + * @since 2.0.0 + * + * @var string + */ + protected $version = '2.0.1'; + + /** + * Unique identifier for the plugin. + * + * @since 2.0.0 + * + * @var string + */ + protected $plugin_slug = 'google-calendar-events'; + + /** + * Instance of this class. + * + * @since 2.0.0 + * + * @var object + */ + protected static $instance = null; + + /** + * Initialize the plugin by setting localization and loading public scripts + * and styles. + * + * @since 2.0.0 + */ + private function __construct() { + + $this->includes(); + + $old = get_option( 'gce_version' ); + + if( version_compare( $old, $this->version, '<' ) ) { + delete_option( 'gce_upgrade_has_run' ); + } + + if( false === get_option( 'gce_upgrade_has_run' ) ) { + $this->upgrade(); + } + + + $this->setup_constants(); + + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_public_scripts' ) ); + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_public_styles' ) ); + + // AJAX + + + // Load plugin text domain + add_action( 'plugins_loaded', array( $this, 'plugin_textdomain' ) ); + + } + + /** + * Load the upgrade file + * + * @since 2.0.0 + */ + private function upgrade() { + include_once( 'includes/admin/upgrade.php' ); + } + + /** + * Setup public constants + * + * @since 2.0.0 + */ + public function setup_constants() { + if( ! defined( 'GCE_DIR' ) ) { + define( 'GCE_DIR', dirname( __FILE__ ) ); + } + + if( ! defined( 'GCE_PLUGIN_SLUG' ) ) { + define( 'GCE_PLUGIN_SLUG', $this->plugin_slug ); + } + } + + /** + * Include all necessary files + * + * @since 2.0.0 + */ + public static function includes() { + global $gce_options; + + // First include common files between admin and public + include_once( 'includes/misc-functions.php' ); + include_once( 'includes/gce-feed-cpt.php' ); + include_once( 'includes/class-gce-feed.php' ); + include_once( 'includes/class-gce-event.php' ); + include_once( 'includes/shortcodes.php' ); + include_once( 'includes/class-gce-display.php' ); + + include_once( 'views/widgets.php' ); + + // Now include files specifically for public or admin + if( is_admin() ) { + // Admin includes + include_once( 'includes/admin/admin-functions.php' ); + } else { + // Public includes + } + + // Setup our main settings options + include_once( 'includes/register-settings.php' ); + + $gce_options = gce_get_settings(); + } + + /** + * Load public facing scripts + * + * @since 2.0.0 + */ + public function enqueue_public_scripts() { + + wp_enqueue_script( $this->plugin_slug . '-qtip', plugins_url( 'js/jquery-qtip.js', __FILE__ ), array( 'jquery' ), $this->version, true ); + wp_enqueue_script( $this->plugin_slug . '-public', plugins_url( 'js/gce-script.js', __FILE__ ), array( 'jquery', $this->plugin_slug . '-qtip' ), $this->version, true ); + + wp_localize_script( $this->plugin_slug . '-public', 'gce', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ) + ) ); + } + + /* + * Load public facing styles + * + * @since 2.0.0 + */ + public function enqueue_public_styles() { + wp_enqueue_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array(), $this->version ); + } + + /** + * Return the plugin slug. + * + * @since 2.0.0 + * + * @return Plugin version variable. + */ + public function get_plugin_slug() { + return $this->plugin_slug; + } + + /** + * Return the plugin version. + * + * @since 1.0.0 + * + * @return Plugin slug variable. + */ + public function get_plugin_version() { + return $this->version; + } + + /** + * Return an instance of this class. + * + * @since 1.0.0 + * + * @return object A single instance of this class. + */ + public static function get_instance() { + + // If the single instance hasn't been set, set it now. + if ( null == self::$instance ) { + self::$instance = new self; + } + + return self::$instance; + } + + /** + * Load the plugin text domain for translation. + * + * @since 2.0.0 + */ + public function plugin_textdomain() { + // Set filter for plugin's languages directory + $gce_lang_dir = dirname( plugin_basename( GCE_MAIN_FILE ) ) . '/languages/'; + $gce_lang_dir = apply_filters( 'gce_languages_directory', $gce_lang_dir ); + + // Traditional WordPress plugin locale filter + $locale = apply_filters( 'plugin_locale', get_locale(), 'gce' ); + $mofile = sprintf( '%1$s-%2$s.mo', 'gce', $locale ); + + // Setup paths to current locale file + $mofile_local = $gce_lang_dir . $mofile; + $mofile_global = WP_LANG_DIR . '/gce/' . $mofile; + + if ( file_exists( $mofile_global ) ) { + load_textdomain( 'gce', $mofile_global ); + } elseif ( file_exists( $mofile_local ) ) { + load_textdomain( 'gce', $mofile_local ); + } else { + // Load the default language files + load_plugin_textdomain( 'gce', false, $gce_lang_dir ); + } + + } +} diff --git a/wp-content/plugins/google-calendar-events/css/admin.css b/wp-content/plugins/google-calendar-events/css/admin.css new file mode 100644 index 0000000..b9052f5 --- /dev/null +++ b/wp-content/plugins/google-calendar-events/css/admin.css @@ -0,0 +1,52 @@ +/** + * Admin CSS file + * + * @package GCE + * @author Phil Derksen , Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +.gce-meta-control { + margin-bottom: 15px; +} + +.gce-meta-control label { + display: block; + font-weight: bold; +} + +#gce-display-options-wrap .gce-meta-control label { + font-weight: normal; + margin-top: 10px; + margin-bottom: 5px; +} + +#gce-display-options-wrap .gce-meta-control p label { + display: inline; +} + +#gce-display-options-wrap .gce-meta-control label#gce-simple-display-label { + font-weight: bold; + color: #cb4d4d; +} + +.gce-admin-hidden { + display: none; +} + +#gce-display-options-wrap .gce-meta-control span.description { + display: block; + margin-top: 5px; +} + +#gce-display-options-wrap .gce-meta-control span.description p { + margin-top: 5px; +} + +#gce-admin-promo { + background-color: #fcf8e3; + border: 1px solid #faebbe; + color: #8a6d3b; + padding: 15px; +} diff --git a/wp-content/plugins/google-calendar-events/css/gce-old-style.css b/wp-content/plugins/google-calendar-events/css/gce-old-style.css deleted file mode 100644 index 75e343d..0000000 --- a/wp-content/plugins/google-calendar-events/css/gce-old-style.css +++ /dev/null @@ -1,28 +0,0 @@ -.gce-page-grid .gce-calendar th{ - padding:0 !important; -} - -.gce-page-grid .gce-calendar th abbr, -.gce-widget-grid .gce-calendar th abbr{ - border-bottom:none !important; -} - -.gce-page-list .gce-list p{ - margin:0 !important; -} - -.gce-page-list .gce-list ul, -.gce-widget-list .gce-list ul{ - margin:0 !important; - padding:0 !important; -} - -.gce-event-info .gce-tooltip-title{ - margin:5px !important; -} - -.gce-event-info ul{ - padding:0 !important; - margin:5px !important; - list-style-type:none !important; -} \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/css/gce-style.css b/wp-content/plugins/google-calendar-events/css/gce-style.css index fd36360..cc8b528 100644 --- a/wp-content/plugins/google-calendar-events/css/gce-style.css +++ b/wp-content/plugins/google-calendar-events/css/gce-style.css @@ -1,203 +1,222 @@ -/* PAGE GRID */ - -.gce-page-grid .gce-calendar .gce-caption{ /* Caption at top of calendar */ - color:#333333; - text-align:center; -} - -.gce-page-grid .gce-calendar{ /* Main calendar table */ - width:100%; - border-collapse:collapse; - border:1px solid #CCCCCC; - color:#CCCCCC; -} - -.gce-page-grid .gce-calendar th{ /* Day headings (S, M etc.) */ - border:1px solid #CCCCCC; - text-align:center; - width:14.29%; - padding:0; -} - -.gce-page-grid .gce-calendar td{ /* Day table cells */ - border:1px solid #CCCCCC; - text-align:center; - height:80px; - vertical-align:middle; - padding:0; -} - -.gce-page-grid .gce-calendar .gce-has-events{ /* Table cells with events */ - color:#333333; - cursor:pointer; -} - -.gce-page-grid .gce-calendar .gce-event-info{ /* Event information */ - display:none; /* Important! */ -} - -.gce-page-grid .gce-calendar .gce-day-number{ /* Day number span */ - font-size:2em; -} - -.gce-page-grid .gce-calendar .gce-today{ /* Table cell that represents today */ - background-color:#DDDDDD; -} - -.gce-page-grid .gce-calendar .gce-next, -.gce-page-grid .gce-calendar .gce-prev{ /* Previous and next month links */ - cursor:pointer; - display:inline-block; - width:3%; -} - -.gce-page-grid .gce-calendar .gce-month-title{ /* Month title */ - display:inline-block; - width:90%; -} - -.gce-page-grid .gce-calendar th abbr{ /* Day letter abbreviation */ - border-bottom:none; -} - -/* PAGE LIST */ - -.gce-page-list .gce-list p{ /* Each piece of information in the list */ - margin:0; -} - -.gce-page-list .gce-list p span, -.gce-page-list .gce-list div span{ /* The text displayed before each piece of info, 'Starts:' for example */ - color:#999999; -} - -.gce-page-list .gce-list .gce-list-event{ /* The event title */ - background-color:#DDDDDD; -} - -.gce-page-list .gce-list .gce-list-title{ /* The title (not the same as event title) */ - font-weight:bold; -} - -.gce-page-list .gce-list ul{ - list-style-type:none; - margin:0; - padding:0; -} - -/* WIDGET GRID */ - -.gce-widget-grid .gce-calendar .gce-caption{ - text-align:center; -} - -.gce-widget-grid .gce-calendar{ /* Main calendar table */ - width:100%; - border:1px solid #CCCCCC; - border-collapse:collapse; -} - -.gce-widget-grid .gce-calendar th{ /* Day headings (S, M etc.) */ - width:14.29%; - border:1px solid #CCCCCC; - text-align:center; -} - -.gce-widget-grid .gce-calendar td{ /* Day table cells */ - color:#CCCCCC; - width:14.29%; - border:1px solid #CCCCCC; - text-align:center; -} - -.gce-widget-grid .gce-calendar .gce-has-events{ /* Table cells with events */ - cursor:pointer; - color:#666666; -} - -.gce-widget-grid .gce-calendar .gce-today{ /* Table cell that represents today */ - background-color:#DDDDDD; -} - -.gce-widget-grid .gce-calendar .gce-event-info{ /* Event information */ - display:none; /* Important! */ -} - -.gce-widget-grid .gce-calendar .gce-next, -.gce-widget-grid .gce-calendar .gce-prev{ /* Prev and next month links */ - cursor:pointer; - display:inline-block; - width:5%; -} - -.gce-widget-grid .gce-calendar .gce-month-title{ /* Month title in caption at top of table */ - display:inline-block; - width:80%; -} - -.gce-widget-grid .gce-calendar th abbr{ /* Day name abbreviations */ - border-bottom:none; -} - -/* WIDGET LIST */ - -.gce-widget-list .gce-list p{ /* Each piece of information in the list */ - margin:0; -} - -.gce-widget-list .gce-list p span, -.gce-widget-list .gce-list div span{ /* The text displayed before each piece of info, 'Starts:' for example */ - color:#999999; -} - -.gce-widget-list .gce-list .gce-list-event{ /* The event title */ - background-color:#DDDDDD; -} - -.gce-widget-list .gce-list .gce-list-title{ /* The title (not the same as event title) */ - font-weight:bold; -} - -.gce-widget-list .gce-list ul{ - list-style-type:none; - margin:0; - padding:0; -} - -/* TOOLTIP */ - -.gce-event-info{ /* Tooltip container */ - background-color:#FFFFFF; - border:1px solid #333333; - max-width:300px; -} - -.gce-event-info .gce-tooltip-title{ /* 'Events on...' text */ - margin:5px; - font-weight:bold; - font-size:1.2em; -} - -.gce-event-info ul{ /* Events list */ - padding:0; - margin:5px; - list-style-type:none; -} - -.gce-event-info ul li{ /* Event list item */ - margin:10px 0 0 0; -} - -.gce-event-info ul li p{ /* Each piece of information */ - margin:0; -} - -.gce-event-info ul li p span, -.gce-event-info ul li div span{ /* The text displayed before each piece of info, 'Starts:' for example */ - color:#999999; -} - -.gce-event-info .gce-tooltip-event{ /* The event title */ - background-color:#DDDDDD; - font-weight:bold; -} \ No newline at end of file +/** + * Public facing CSS file + * + * @package GCE + * @author Phil Derksen , Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +/* PAGE GRID */ + +.gce-page-grid .gce-calendar .gce-caption{ /* Caption at top of calendar */ + color:#333333; + text-align:center; +} + +.gce-page-grid .gce-calendar{ /* Main calendar table */ + width:100%; + border-collapse:collapse; + border:1px solid #CCCCCC; + color:#CCCCCC; +} + +.gce-page-grid .gce-calendar th{ /* Day headings (S, M etc.) */ + border:1px solid #CCCCCC; + text-align:center; + width:14.29%; + padding:0; +} + +.gce-page-grid .gce-calendar td{ /* Day table cells */ + border:1px solid #CCCCCC; + text-align:center; + height:80px; + vertical-align:middle; + padding:0; +} + +.gce-page-grid .gce-calendar .gce-has-events{ /* Table cells with events */ + color:#333333; + cursor:pointer; +} + +.gce-page-grid .gce-calendar .gce-event-info{ /* Event information */ + display:none; /* Important! */ +} + +.gce-page-grid .gce-calendar .gce-day-number{ /* Day number span */ + font-size:2em; +} + +.gce-page-grid .gce-calendar .gce-today{ /* Table cell that represents today */ + background-color:#DDDDDD; +} + +.gce-page-grid .gce-calendar .gce-next, +.gce-page-grid .gce-calendar .gce-prev{ /* Previous and next month links */ + cursor:pointer; + display:inline-block; + width:5%; + white-space: nowrap; +} + +.gce-page-grid .gce-calendar .gce-prev{ + float: left; +} + +.gce-page-grid .gce-calendar .gce-month-title{ /* Month title */ + display:inline-block; + width:80%; +} + +.gce-page-grid .gce-calendar th abbr{ /* Day letter abbreviation */ + border-bottom:none; +} + +/* PAGE LIST */ + +.gce-page-list .gce-list p{ /* Each piece of information in the list */ + margin:0; +} + +.gce-page-list .gce-list p span, +.gce-page-list .gce-list div span{ /* The text displayed before each piece of info, 'Starts:' for example */ + color:#999999; +} + +.gce-page-list .gce-list .gce-list-event{ /* The event title */ + background-color:#DDDDDD; +} + +.gce-page-list .gce-list .gce-list-title{ /* The title (not the same as event title) */ + font-weight:bold; +} + +.gce-page-list .gce-list ul{ + list-style-type:none; + margin:0; + padding:0; +} + +/* WIDGET GRID */ + +.gce-widget-grid .gce-calendar .gce-caption{ + text-align:center; +} + +.gce-widget-grid .gce-calendar{ /* Main calendar table */ + width:100%; + border:1px solid #CCCCCC; + border-collapse:collapse; +} + +.gce-widget-grid .gce-calendar th{ /* Day headings (S, M etc.) */ + width:14.29%; + border:1px solid #CCCCCC; + text-align:center; +} + +.gce-widget-grid .gce-calendar td{ /* Day table cells */ + color:#CCCCCC; + width:14.29%; + border:1px solid #CCCCCC; + text-align:center; +} + +.gce-widget-grid .gce-calendar .gce-has-events{ /* Table cells with events */ + cursor:pointer; + color:#666666; +} + +.gce-widget-grid .gce-calendar .gce-today{ /* Table cell that represents today */ + background-color:#DDDDDD; +} + +.gce-widget-grid .gce-calendar .gce-event-info{ /* Event information */ + display:none; /* Important! */ +} + +.gce-widget-grid .gce-calendar .gce-next, +.gce-widget-grid .gce-calendar .gce-prev{ /* Prev and next month links */ + cursor:pointer; + display:inline-block; + width:5%; + white-space: nowrap; +} + +.gce-widget-grid .gce-calendar .gce-prev{ + float: left; +} + +.gce-widget-grid .gce-calendar .gce-month-title{ /* Month title in caption at top of table */ + display:inline-block; + width:80%; +} + +.gce-widget-grid .gce-calendar th abbr{ /* Day name abbreviations */ + border-bottom:none; +} + +/* WIDGET LIST */ + +.gce-widget-list .gce-list p{ /* Each piece of information in the list */ + margin:0; +} + +.gce-widget-list .gce-list p span, +.gce-widget-list .gce-list div span{ /* The text displayed before each piece of info, 'Starts:' for example */ + color:#999999; +} + +.gce-widget-list .gce-list .gce-list-event{ /* The event title */ + background-color:#DDDDDD; +} + +.gce-widget-list .gce-list .gce-list-title{ /* The title (not the same as event title) */ + font-weight:bold; +} + +.gce-widget-list .gce-list ul{ + list-style-type:none; + margin:0; + padding:0; +} + +/* TOOLTIP */ + +.gce-event-info{ /* Tooltip container */ + background-color:#FFFFFF; + border:1px solid #333333; + max-width:300px; +} + +.gce-event-info .gce-tooltip-title{ /* 'Events on...' text */ + margin:5px; + font-weight:bold; + font-size:1.2em; +} + +.gce-event-info ul{ /* Events list */ + padding:0; + margin:5px; + list-style-type:none; +} + +.gce-event-info ul li{ /* Event list item */ + margin:10px 0 0 0; +} + +.gce-event-info ul li p{ /* Each piece of information */ + margin:0; +} + +.gce-event-info ul li p span, +.gce-event-info ul li div span{ /* The text displayed before each piece of info, 'Starts:' for example */ + color:#999999; +} + +.gce-event-info .gce-tooltip-event{ /* The event title */ + background-color:#DDDDDD; + font-weight:bold; +} diff --git a/wp-content/plugins/google-calendar-events/css/images/animated-overlay.gif b/wp-content/plugins/google-calendar-events/css/images/animated-overlay.gif new file mode 100644 index 0000000..d441f75 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/animated-overlay.gif differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_flat_0_aaaaaa_40x100.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 0000000..4fa0418 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_flat_75_ffffff_40x100.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 0000000..cb911e7 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_55_fbf9ee_1x400.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 0000000..44b629d Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_65_ffffff_1x400.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 0000000..fc96e91 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_75_dadada_1x400.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 0000000..20fbc66 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_75_e6e6e6_1x400.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 0000000..b0abea7 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_95_fef1ec_1x400.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 0000000..f595883 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/wp-content/plugins/google-calendar-events/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 0000000..98a2431 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-icons_222222_256x240.png b/wp-content/plugins/google-calendar-events/css/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000..c1cb117 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-icons_222222_256x240.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-icons_2e83ff_256x240.png b/wp-content/plugins/google-calendar-events/css/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000..84b601b Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-icons_2e83ff_256x240.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-icons_454545_256x240.png b/wp-content/plugins/google-calendar-events/css/images/ui-icons_454545_256x240.png new file mode 100644 index 0000000..b6db1ac Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-icons_454545_256x240.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-icons_888888_256x240.png b/wp-content/plugins/google-calendar-events/css/images/ui-icons_888888_256x240.png new file mode 100644 index 0000000..feea0e2 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-icons_888888_256x240.png differ diff --git a/wp-content/plugins/google-calendar-events/css/images/ui-icons_cd0a0a_256x240.png b/wp-content/plugins/google-calendar-events/css/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 0000000..ed5b6b0 Binary files /dev/null and b/wp-content/plugins/google-calendar-events/css/images/ui-icons_cd0a0a_256x240.png differ diff --git a/wp-content/plugins/google-calendar-events/css/jquery-ui-1.10.4.custom.min.css b/wp-content/plugins/google-calendar-events/css/jquery-ui-1.10.4.custom.min.css new file mode 100644 index 0000000..ffbd04d --- /dev/null +++ b/wp-content/plugins/google-calendar-events/css/jquery-ui-1.10.4.custom.min.css @@ -0,0 +1,7 @@ +/*! jQuery UI - v1.10.4 - 2014-05-14 +* http://jqueryui.com +* Includes: jquery.ui.core.css, jquery.ui.datepicker.css, jquery.ui.theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ + +.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_888888_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_2e83ff_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cd0a0a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px} \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/google-calendar-events.php b/wp-content/plugins/google-calendar-events/google-calendar-events.php index 754b033..585506d 100644 --- a/wp-content/plugins/google-calendar-events/google-calendar-events.php +++ b/wp-content/plugins/google-calendar-events/google-calendar-events.php @@ -1,719 +1,60 @@ -, Nick Young - * @license GPL-2.0+ - * @link http://philderksen.com - * @copyright 2014 Phil Derksen - * - * @wordpress-plugin - * Plugin Name: Google Calendar Events - * Plugin URI: http://philderksen.com/google-calendar-events-version-2/ - * Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget. - * Version: 0.7.3.1 - * Author: Phil Derksen - * Author URI: http://philderksen.com - * License: GPL-2.0+ - * License URI: http://www.gnu.org/licenses/gpl-2.0.txt - */ - -define( 'GCE_PLUGIN_NAME', str_replace( '.php', '', basename( __FILE__ ) ) ); -define( 'GCE_TEXT_DOMAIN', 'google-calendar-events' ); -define( 'GCE_OPTIONS_NAME', 'gce_options' ); -define( 'GCE_GENERAL_OPTIONS_NAME', 'gce_general' ); -define( 'GCE_VERSION', '0.7.3' ); - -if ( ! class_exists( 'Google_Calendar_Events' ) ) { - class Google_Calendar_Events { - function __construct() { - - register_activation_hook( __FILE__, array( $this, 'activate_plugin' ) ); - - register_deactivation_hook( __FILE__, array( $this, 'deactivate_plugin' ) ); - - add_action( 'init', array( $this, 'init_plugin' ) ); - add_action( 'wp_ajax_gce_ajax', array( $this, 'gce_ajax' ) ); - add_action( 'wp_ajax_nopriv_gce_ajax', array( $this, 'gce_ajax' ) ); - add_action( 'widgets_init', array( $this, 'add_widget' ) ); - - //No point doing any of this if currently processing an AJAX request - if ( ! defined( 'DOING_AJAX' ) || !DOING_AJAX ) { - add_action( 'admin_menu', array( $this, 'setup_admin' ) ); - add_action( 'admin_init', array( $this, 'init_admin' ) ); - add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ) ); - add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts' ) ); - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) ); - add_shortcode( 'google-calendar-events', array( $this, 'shortcode_handler' ) ); - - if( false === get_option( 'gce_show_upgrade_notice' ) ) { - add_action( 'admin_notices', array( $this, 'show_upgrade_notice' ) ); - } - } - } - - // Show an upgrade warning notice to users for the 2.0.0 release - function show_upgrade_notice() { - - if ( ! empty( $_REQUEST['gce-dismiss-install-nag'] ) ) { - add_option( 'gce_show_upgrade_notice', 1 ); - remove_action( 'admin_notices', array( $this, 'show_upgrade_notice' ) ); - return; - } - - include_once( 'inc/upgrade-notice.php' ); - } - - function deactivate_plugin(){ - delete_option( 'gce_show_upgrade_notice' ); - } - - //PHP 5.2 is required (json_decode), so if PHP version is lower then 5.2, display an error message and deactivate the plugin - function activate_plugin(){ - if( version_compare( PHP_VERSION, '5.2', '<' ) ) { - if( is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX ) ) { - require_once ABSPATH . '/wp-admin/includes/plugin.php'; - deactivate_plugins( basename( __FILE__ ) ); - wp_die( 'Google Calendar Events requires the server on which your site resides to be running PHP 5.2 or higher. As of version 3.2, WordPress itself will also have this requirement. You should get in touch with your web hosting provider and ask them to update PHP.

Back to Plugins' ); - } - } - } - - //If any new options have been added between versions, this will update any saved feeds with defaults for new options (shouldn't overwrite anything saved) - function update_settings() { - //If there are some plugin options in the database, but no version info, then this must be an upgrade from version 0.5 or below, so add flag that will provide user with option to clear old transients - if ( get_option( GCE_OPTIONS_NAME ) && ! get_option( 'gce_version' ) ) - add_option( 'gce_clear_old_transients', true ); - - add_option( 'gce_version', GCE_VERSION ); - - add_option( GCE_OPTIONS_NAME ); - add_option( GCE_GENERAL_OPTIONS_NAME ); - - //Get feed options - $options = get_option( GCE_OPTIONS_NAME ); - - if ( ! empty( $options ) ) { - foreach ( $options as $key => $saved_feed_options ) { - $defaults = array( - 'id' => 1, - 'title' => '', - 'url' => '', - 'retrieve_from' => 'today', - 'retrieve_from_value' => 0, - 'retrieve_until' => 'any', - 'retrieve_until_value' => 0, - 'max_events' => 25, - 'date_format' => '', - 'time_format' => '', - 'timezone' => 'default', - 'cache_duration' => 43200, - 'multiple_day' => 'false', - 'display_start' => 'time', - 'display_end' => 'time-date', - 'display_location' => '', - 'display_desc' => '', - 'display_link' => 'on', - 'display_start_text' => 'Starts:', - 'display_end_text' => 'Ends:', - 'display_location_text' => 'Location:', - 'display_desc_text' => 'Description:', - 'display_desc_limit' => '', - 'display_link_text' => 'More details', - 'display_link_target' => '', - 'display_separator' => ', ', - 'use_builder' => 'false', - 'builder' => '' - ); - - //If necessary, copy saved behaviour of old show_past_events and day_limit options into the new from / until options - if ( isset( $saved_feed_options['show_past_events'] ) ) { - if ( 'true' == $saved_feed_options['show_past_events'] ) { - $saved_feed_options['retrieve_from'] = 'month-start'; - } else { - $saved_feed_options['retrieve_from'] = 'today'; - } - } - - if ( isset( $saved_feed_options['day_limit'] ) && '' != $saved_feed_options['day_limit'] ) { - $saved_feed_options['retrieve_until'] = 'today'; - $saved_feed_options['retrieve_until_value'] = (int) $saved_feed_options['day_limit'] * 86400; - } - - //Update old display_start / display_end values - if ( ! isset( $saved_feed_options['display_start'] ) ) - $saved_feed_options['display_start'] = 'none'; - elseif ( 'on' == $saved_feed_options['display_start'] ) - $saved_feed_options['display_start'] = 'time'; - - if( ! isset( $saved_feed_options['display_end'] ) ) - $saved_feed_options['display_end'] = 'none'; - elseif ( 'on' == $saved_feed_options['display_end'] ) - $saved_feed_options['display_end'] = 'time-date'; - - //Merge saved options with defaults - foreach ( $saved_feed_options as $option_name => $option ) { - $defaults[$option_name] = $saved_feed_options[$option_name]; - } - - $options[$key] = $defaults; - } - } - - //Save feed options - update_option( GCE_OPTIONS_NAME, $options ); - - //Get general options - $options = get_option( GCE_GENERAL_OPTIONS_NAME ); - - $defaults = array( - 'stylesheet' => '', - 'javascript' => false, - 'loading' => 'Loading...', - 'error' => 'Events cannot currently be displayed, sorry! Please check back later.', - 'fields' => true, - 'old_stylesheet' => false, - 'save_settings' => true - ); - - $old_stylesheet_option = get_option( 'gce_stylesheet' ); - - //If old custom stylesheet option was set, add it to general options, then delete old option - if( false !== $old_stylesheet_option ) { - $defaults['stylesheet'] = $old_stylesheet_option; - delete_option( 'gce_stylesheet' ); - } elseif ( isset($options['stylesheet'] ) ) { - $defaults['stylesheet'] = $options['stylesheet']; - } - - if ( isset($options['javascript'] ) ) - $defaults['javascript'] = $options['javascript']; - - if ( isset( $options['loading'] ) ) - $defaults['loading'] = $options['loading']; - - if ( isset($options['error'] ) ) - $defaults['error'] = $options['error']; - - if ( isset($options['fields'] ) ) - $defaults['fields'] = $options['fields']; - - if( isset( $options['old_stylesheet'] ) ) - $defaults['old_stylesheet'] = $options['old_stylesheet']; - - if( isset( $options['save_settings'] ) ) - $defaults['save_settings'] = $options['save_settings']; - - //Save general options - update_option( GCE_GENERAL_OPTIONS_NAME, $defaults ); - } - - function init_plugin() { - //Load text domain for i18n - load_plugin_textdomain( GCE_TEXT_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); - } - - //Adds 'Settings' link to main WordPress Plugins page - function add_settings_link( $links ) { - array_unshift( $links, '' . __( 'Settings', GCE_TEXT_DOMAIN ) . '' ); - return $links; - } - - //Setup admin settings page - function setup_admin(){ - global $gce_settings_page; - - $gce_settings_page = add_options_page( 'Google Calendar Events', 'Google Calendar Events', 'manage_options', basename( __FILE__ ), array( $this, 'admin_page' ) ); - - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); - } - - //Add admin JavaScript (to GCE settings page only) - function enqueue_admin_scripts( $hook_suffix ) { - global $gce_settings_page; - - if ( $gce_settings_page == $hook_suffix ) - wp_enqueue_script( 'gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-admin-script.js', array( 'jquery' ) ); - } - - //Prints admin settings page - function admin_page() { - ?> -
-

- -

- - -
-

-

-

-

-
- - -
-

-

-

-

-

-
-
- update_settings(); - - //If the message about old transients was displayed, check authority and intention, and then either clear transients or clear flag - if ( isset( $_GET['gce_action'] ) && current_user_can( 'manage_options' ) ) { - switch ( $_GET['gce_action'] ) { - case 'clear_old_transients': - check_admin_referer( 'gce_action_clear_old_transients' ); - $this->clear_old_transients(); - add_settings_error( 'gce_options', 'gce_cleared_old_transients', __( 'Old cached data cleared.', GCE_TEXT_DOMAIN ), 'updated' ); - break; - case 'ignore_old_transients': - check_admin_referer( 'gce_action_ignore_old_transients' ); - delete_option( 'gce_clear_old_transients' ); - } - } - - register_setting( 'gce_options', 'gce_options', array( $this, 'validate_feed_options' ) ); - register_setting( 'gce_general', 'gce_general', array( $this, 'validate_general_options' ) ); - - require_once 'admin/add.php'; - require_once 'admin/edit.php'; - require_once 'admin/delete.php'; - require_once 'admin/refresh.php'; - } - - //Clears any expired transients from the database - function clear_old_transients() { - global $wpdb; - - //Retrieve names of all transients - $transients = $wpdb->get_results( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%transient%' AND option_name NOT LIKE '%transient_timeout%'" ); - - if ( ! empty( $transients ) ) { - foreach ( $transients as $transient ) { - //Attempt to retrieve the transient. If it has expired, it will be deleted - get_transient( str_replace( '_transient_', '', $transient->option_name ) ); - } - } - - //Remove the flag - delete_option( 'gce_clear_old_transients' ); - } - - //Register the widget - function add_widget() { - require_once 'widget/gce-widget.php'; - return register_widget( 'GCE_Widget' ); - } - - //Check / validate submitted feed options data before being stored - function validate_feed_options( $input ) { - //Get saved options - $options = get_option( GCE_OPTIONS_NAME ); - - if ( isset( $input['submit_delete'] ) ) { - //If delete button was clicked, delete feed from options array and remove associated transients - unset( $options[$input['id']] ); - $this->delete_feed_transients( (int) $input['id'] ); - add_settings_error( 'gce_options', 'gce_deleted', __( sprintf('Feed %s deleted.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' ); - } elseif ( isset($input['submit_refresh'] ) ) { - //If refresh button was clicked, delete transients associated with feed - $this->delete_feed_transients( (int) $input['id'] ); - add_settings_error( 'gce_options', 'gce_refreshed', __( sprintf('Cached data for feed %s cleared.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' ); - } else { - //Otherwise, validate options and add / update them - - //Check id is positive integer - $id = absint( $input['id'] ); - //Escape title text - $title = esc_html( $input['title'] ); - //Escape feed url - $url = esc_url( $input['url'] ); - - //Array of valid options for retrieve_from and retrieve_until settings - $valid_retrieve_options = array( 'now', 'today', 'week', 'month-start', 'month-end', 'any', 'date' ); - - $retrieve_from = 'today'; - $retrieve_from_value = 0; - - //Ensure retrieve_from is valid - if( in_array( $input['retrieve_from'], $valid_retrieve_options ) ) { - $retrieve_from = $input['retrieve_from']; - $retrieve_from_value = (int) $input['retrieve_from_value']; - } - - $retrieve_until = 'any'; - $retrieve_until_value = 0; - - //Ensure retrieve_until is valid - if ( in_array( $input['retrieve_until'], $valid_retrieve_options ) ) { - $retrieve_until = $input['retrieve_until']; - $retrieve_until_value = (int) $input['retrieve_until_value']; - } - - //Check max events is a positive integer. If absint returns 0, reset to default (25) - $max_events = ( 0 == absint($input['max_events'] ) ) ? 25 : absint( $input['max_events'] ); - - $date_format = wp_filter_kses( $input['date_format'] ); - $time_format = wp_filter_kses( $input['time_format'] ); - - //Escape timezone - $timezone = esc_html( $input['timezone'] ); - - //Make sure cache duration is a positive integer or 0. If user has typed 0, leave as 0 but if 0 is returned from absint, set to default (43200) - $cache_duration = $input['cache_duration']; - if ( '0' != $cache_duration ) - $cache_duration = ( 0 == absint( $cache_duration ) ) ? 43200 : absint( $cache_duration ); - - $multiple_day = ( isset( $input['multiple_day'] ) ) ? 'true' : 'false'; - - $display_start = esc_html( $input['display_start'] ); - $display_end = esc_html( $input['display_end'] ); - - //Display options must be 'on' or null - $display_location = ( isset( $input['display_location'] ) ) ? 'on' : null; - $display_desc = ( isset( $input['display_desc'] ) ) ? 'on' : null; - $display_link = ( isset( $input['display_link'] ) ) ? 'on' : null; - $display_link_target = ( isset( $input['display_link_target'] ) ) ? 'on' : null; - - //Filter display text - $display_start_text = wp_filter_kses( $input['display_start_text'] ); - $display_end_text = wp_filter_kses( $input['display_end_text'] ); - $display_location_text = wp_filter_kses( $input['display_location_text'] ); - $display_desc_text = wp_filter_kses( $input['display_desc_text'] ); - $display_link_text = wp_filter_kses( $input['display_link_text'] ); - - $display_separator = wp_filter_kses( $input['display_separator'] ); - - $display_desc_limit = ( 0 == absint( $input['display_desc_limit'] ) ) ? '' : absint( $input['display_desc_limit'] ); - - $use_builder = ( 'false' == $input['use_builder'] ) ? 'false' : 'true'; - $builder = wp_kses_post( $input['builder'] ); - - //Fill options array with validated values - $options[$id] = array( - 'id' => $id, - 'title' => $title, - 'url' => $url, - 'retrieve_from' => $retrieve_from, - 'retrieve_until' => $retrieve_until, - 'retrieve_from_value' => $retrieve_from_value, - 'retrieve_until_value' => $retrieve_until_value, - 'max_events' => $max_events, - 'date_format' => $date_format, - 'time_format' => $time_format, - 'timezone' => $timezone, - 'cache_duration' => $cache_duration, - 'multiple_day' => $multiple_day, - 'display_start' => $display_start, - 'display_end' => $display_end, - 'display_location' => $display_location, - 'display_desc' => $display_desc, - 'display_link' => $display_link, - 'display_start_text' => $display_start_text, - 'display_end_text' => $display_end_text, - 'display_location_text' => $display_location_text, - 'display_desc_text' => $display_desc_text, - 'display_desc_limit' => $display_desc_limit, - 'display_link_text' => $display_link_text, - 'display_link_target' => $display_link_target, - 'display_separator' => $display_separator, - 'use_builder' => $use_builder, - 'builder' => $builder - ); - - if ( isset( $input['submit_add'] ) ) - add_settings_error( 'gce_options', 'gce_added', __( sprintf( 'Feed %s added.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' ); - else - add_settings_error( 'gce_options', 'gce_edited', __( sprintf( 'Settings for feed %s updated.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' ); - } - - return $options; - } - - //Validate submitted general options - function validate_general_options( $input ) { - $options = get_option(GCE_GENERAL_OPTIONS_NAME); - - $options['stylesheet'] = esc_url( $input['stylesheet'] ); - $options['javascript'] = ( isset( $input['javascript'] ) ) ? true : false; - $options['loading'] = esc_html( $input['loading'] ); - $options['error'] = wp_filter_kses( $input['error'] ); - $options['fields'] = ( isset( $input['fields'] ) ) ? true : false; - $options['old_stylesheet'] = ( isset( $input['old_stylesheet'] ) ) ? true : false; - $options['save_settings'] = ( isset( $input['save_settings'] ) ) ? true : false; - - add_settings_error( 'gce_general', 'gce_general_updated', __( 'General options updated.', GCE_TEXT_DOMAIN ), 'updated' ); - - return $options; - } - - //Delete all transients (cached feed data) associated with feed specified - function delete_feed_transients( $id ) { - delete_transient( 'gce_feed_' . $id ); - delete_transient( 'gce_feed_' . $id . '_url' ); - } - - //Handles the shortcode stuff - function shortcode_handler( $atts ) { - $options = get_option( GCE_OPTIONS_NAME ); - - //Check that any feeds have been added - if ( is_array( $options ) && ! empty( $options ) ) { - extract( shortcode_atts( array( - 'id' => '', - 'type' => 'grid', - 'title' => null, - 'max' => 0, - 'order' => 'asc' - ), $atts ) ); - - $no_feeds_exist = true; - $feed_ids = array(); - - if ( '' != $id ) { - //Break comma delimited list of feed ids into array - $feed_ids = explode( ',', str_replace( ' ', '', $id ) ); - - //Check each id is an integer, if not, remove it from the array - foreach ( $feed_ids as $key => $feed_id ) { - if ( 0 == absint( $feed_id ) ) - unset( $feed_ids[$key] ); - } - - //If at least one of the feed ids entered exists, set no_feeds_exist to false - foreach ( $feed_ids as $feed_id ) { - if ( isset($options[$feed_id] ) ) - $no_feeds_exist = false; - } - } else { - foreach ( $options as $feed ) { - $feed_ids[] = $feed['id']; - } - - $no_feeds_exist = false; - } - - //Ensure max events is a positive integer - $max_events = absint( $max ); - - //Ensure sort order is asc or desc - $sort_order = ( 'desc' == $order ) ? 'desc' : 'asc'; - - //Check that at least one valid feed id has been entered - if ( empty( $feed_ids ) || $no_feeds_exist ) { - return __( 'No valid Feed IDs have been entered for this shortcode. Please check that you have entered the IDs correctly and that the Feeds have not been deleted.', GCE_TEXT_DOMAIN ); - } else { - //Turns feed_ids back into string of feed ids delimited by '-' ('1-2-3-4' for example) - $feed_ids = implode( '-', $feed_ids ); - - //If title has been omitted from shortcode, set title_text to null, otherwise set to title (even if empty string) - $title_text = ( false === $title ) ? null : $title; - - switch ( $type ) { - case 'grid': - return gce_print_grid( $feed_ids, $title_text, $max_events ); - case 'ajax': - return gce_print_grid( $feed_ids, $title_text, $max_events, true ); - case 'list': - return gce_print_list( $feed_ids, $title_text, $max_events, $sort_order ); - case 'list-grouped': - return gce_print_list( $feed_ids, $title_text, $max_events, $sort_order, true ); - } - } - } else { - return __( 'No feeds have been added yet. You can add a feed in the Google Calendar Events settings.', GCE_TEXT_DOMAIN ); - } - } - - //Adds the required CSS - function add_styles() { - wp_enqueue_style( 'gce_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-style.css' ); - - $options = get_option( GCE_GENERAL_OPTIONS_NAME ); - - //If old stylesheet option is enabled, enqueue old styles - if ( $options['old_stylesheet'] ) - wp_enqueue_style( 'gce_old_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-old-style.css' ); - - //If user has entered a URL to a custom stylesheet, enqueue it too - if( '' != $options['stylesheet'] ) - wp_enqueue_style( 'gce_custom_styles', $options['stylesheet'] ); - } - - //Adds the required scripts - function add_scripts() { - $options = get_option( GCE_GENERAL_OPTIONS_NAME ); - $add_to_footer = (bool) $options['javascript']; - - wp_enqueue_script( 'jquery' ); - wp_enqueue_script( 'gce_jquery_qtip', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/jquery-qtip.js', array( 'jquery' ), null, $add_to_footer ); - wp_enqueue_script( 'gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-script.js', array( 'jquery' ), null, $add_to_footer ); - wp_localize_script( 'gce_scripts', 'GoogleCalendarEvents', array( - 'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ), - 'loading' => $options['loading'] - ) ); - } - - //AJAX stuffs - function gce_ajax() { - if ( isset( $_GET['gce_feed_ids'] ) ) { - $ids = $_GET['gce_feed_ids']; - $title = $_GET['gce_title_text']; - $max = $_GET['gce_max_events']; - $month = $_GET['gce_month']; - $year = $_GET['gce_year']; - - $title = ( 'null' == $title ) ? null : $title; - - if ( 'page' == $_GET['gce_type'] ) { - //The page grid markup to be returned via AJAX - echo gce_print_grid( $ids, $title, $max, true, $month, $year ); - } elseif ( 'widget' == $_GET['gce_type'] ) { - $widget = esc_html( $_GET['gce_widget_id'] ); - - //The widget grid markup to be returned via AJAX - gce_widget_content_grid( $ids, $title, $max, $widget, true, $month, $year ); - } - } - die(); - } - } -} - -function gce_print_list( $feed_ids, $title_text, $max_events, $sort_order, $grouped = false ) { - require_once 'inc/gce-parser.php'; - - $ids = explode( '-', $feed_ids ); - - //Create new GCE_Parser object, passing array of feed id(s) - $list = new GCE_Parser( $ids, $title_text, $max_events, $sort_order ); - - $num_errors = $list->get_num_errors(); - - //If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the list - if ( $num_errors < count( $ids ) ) { - $markup = '
' . $list->get_list( $grouped ) . '
'; - - //If there was at least one error, return the list markup with error messages (for admins only) - if ( $num_errors > 0 && current_user_can( 'manage_options' ) ) - return $list->error_messages() . $markup; - - //Otherwise just return the list markup - return $markup; - } else { - //If current user is an admin, display an error message explaining problem(s). Otherwise, display a 'nice' error messsage - if ( current_user_can( 'manage_options' ) ) { - return $list->error_messages(); - } else { - $options = get_option( GCE_GENERAL_OPTIONS_NAME ); - return wp_kses_post( $options['error'] ); - } - } -} - -function gce_print_grid( $feed_ids, $title_text, $max_events, $ajaxified = false, $month = null, $year = null ) { - require_once 'inc/gce-parser.php'; - - $ids = explode( '-', $feed_ids ); - - //Create new GCE_Parser object, passing array of feed id(s) returned from gce_get_feed_ids() - $grid = new GCE_Parser( $ids, $title_text, $max_events ); - - $num_errors = $grid->get_num_errors(); - - //If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the grid - if ( $num_errors < count( $ids ) ) { - $feed_ids = esc_attr( $feed_ids ); - $title_text = isset( $title_text ) ? esc_html( $title_text) : 'null'; - - $markup = '
'; - - //Add AJAX script if required - if ( $ajaxified ) - $markup .= ''; - - $markup .= $grid->get_grid( $year, $month, $ajaxified ) . '
'; - - //If there was at least one error, return the grid markup with an error message (for admins only) - if ( $num_errors > 0 && current_user_can( 'manage_options' ) ) - return $grid->error_messages() . $markup; - - //Otherwise just return the grid markup - return $markup; - } else { - //If current user is an admin, display an error message explaining problem. Otherwise, display a 'nice' error messsage - if ( current_user_can( 'manage_options' ) ) { - return $grid->error_messages(); - } else { - $options = get_option( GCE_GENERAL_OPTIONS_NAME ); - return wp_kses_post( $options['error'] ); - } - } -} - -$gce = new Google_Calendar_Events(); - - - - - -?> +, Nick Young + * @license GPL-2.0+ + * @link http://philderksen.com + * @copyright 2014 Phil Derksen + * + * @wordpress-plugin + * Plugin Name: Google Calendar Events + * Plugin URI: https://github.com/pderksen/WP-Google-Calendar-Events + * Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget. + * Version: 2.0.1 + * Author: Phil Derksen + * Author URI: http://philderksen.com + * License: GPL-2.0+ + * License URI: http://www.gnu.org/licenses/gpl-2.0.txt + * Text Domain: gce + * Domain Path: /languages + */ + +// If this file is called directly, abort. +if ( ! defined( 'WPINC' ) ) { + die; +} + +/* + * Include the main plugin file + * + * @since 2.0.0 + */ +require_once( 'class-google-calendar-events.php' ); + +/** + * Define constant pointing to this file + * + * @since 2.0.0 + */ +if( ! defined( 'GCE_MAIN_FILE' ) ) { + define( 'GCE_MAIN_FILE', __FILE__ ); +} + +/* + * Get instance of our plugin + * + * @since 2.0.0 + */ +add_action( 'plugins_loaded', array( 'Google_Calendar_Events', 'get_instance' ) ); + +/* + * If we are in admin then load the Admin class + * + * @since 2.0.0 + */ +if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { + require_once( 'class-google-calendar-events-admin.php' ); + add_action( 'plugins_loaded', array( 'Google_Calendar_Events_Admin', 'get_instance' ) ); +} diff --git a/wp-content/plugins/google-calendar-events/inc/gce-feed.php b/wp-content/plugins/google-calendar-events/inc/gce-feed.php deleted file mode 100644 index d7a277b..0000000 --- a/wp-content/plugins/google-calendar-events/inc/gce-feed.php +++ /dev/null @@ -1,248 +0,0 @@ -feed_url ); - - $scheme_and_host = $url_parts['scheme'] . '://' . $url_parts['host']; - - //Remove the exisitng projection from the path, and replace it with '/full-noattendees' - $path = substr( $url_parts['path'], 0, strrpos( $url_parts['path'], '/' ) ) . '/full-noattendees'; - - //Add the default parameters to the querystring (retrieving JSON, not XML) - $query = '?alt=json&singleevents=true&sortorder=ascending&orderby=starttime'; - - $gmt_offset = get_option( 'gmt_offset' ) * 3600; - - //Append the feed specific parameters to the querystring - $query .= '&start-min=' . date( 'Y-m-d\TH:i:s', $this->feed_start - $gmt_offset ); - $query .= '&start-max=' . date( 'Y-m-d\TH:i:s', $this->feed_end - $gmt_offset ); - $query .= '&max-results=' . $this->max_events; - - if ( ! empty( $this->timezone ) ) - $query .= '&ctz=' . $this->timezone; - - //If enabled, use experimental 'fields' parameter of Google Data API, so that only necessary data is retrieved. This *significantly* reduces amount of data to retrieve and process - $general_options = get_option( GCE_GENERAL_OPTIONS_NAME ); - if ( $general_options['fields'] ) - $query .= '&fields=entry(title,link[@rel="alternate"],content,gd:where,gd:when,gCal:uid)'; - - //Put the URL back together - $url = $scheme_and_host . $path . $query; - - //Attempt to retrieve the cached feed data - $this->events = get_transient( 'gce_feed_' . $this->feed_id ); - - //If the cached feed data isn't valid any more (has expired), or the URL has changed (settings have changed), then the feed data needs to be retrieved and decoded again - if ( false === $this->events || 0 == $this->cache_duration || get_transient( 'gce_feed_' . $this->feed_id . '_url' ) != $url ) { - $this->events = array(); - - //Retrieve the feed data - $raw_data = wp_remote_get( $url, array( - 'sslverify' => false, //sslverify is set to false to ensure https URLs work reliably. Data source is Google's servers, so is trustworthy - 'timeout' => 10 //Increase timeout from the default 5 seconds to ensure even large feeds are retrieved successfully - ) ); - - //If $raw_data is a WP_Error, something went wrong - if ( ! is_wp_error( $raw_data ) ) { - //If response code isn't 200, something went wrong - if ( 200 == $raw_data['response']['code'] ) { - //Attempt to convert the returned JSON into an array - $raw_data = json_decode( $raw_data['body'], true ); - - //If decoding was successful - if ( ! empty( $raw_data ) ) { - //If there are some entries (events) to process - if ( isset( $raw_data['feed']['entry'] ) ) { - //Loop through each event, extracting the relevant information - foreach ( $raw_data['feed']['entry'] as $event ) { - $id = esc_html( substr( $event['gCal$uid']['value'], 0, strpos( $event['gCal$uid']['value'], '@' ) ) ); - $title = esc_html( $event['title']['$t'] ); - $description = esc_html( $event['content']['$t'] ); - $link = esc_url( $event['link'][0]['href'] ); - $location = esc_html( $event['gd$where'][0]['valueString'] ); - $start_time = $this->iso_to_ts( $event['gd$when'][0]['startTime'] ); - $end_time = $this->iso_to_ts( $event['gd$when'][0]['endTime'] ); - - //Create a GCE_Event using the above data. Add it to the array of events - $this->events[] = new GCE_Event( $id, $title, $description, $location, $start_time, $end_time, $link ); - } - } - - if ( 0 != $this->cache_duration ) { - //Cache the feed data - set_transient( 'gce_feed_' . $this->feed_id, $this->events, $this->cache_duration ); - set_transient( 'gce_feed_' . $this->feed_id . '_url', $url, $this->cache_duration ); - } - } else { - //json_decode failed - $this->error = __( 'Some data was retrieved, but could not be parsed successfully. Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN ); - } - } else { - //The response code wasn't 200, so generate a helpful(ish) error message depending on error code - switch ( $raw_data['response']['code'] ) { - case 404: - $this->error = __( 'The feed could not be found (404). Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN ); - break; - case 403: - $this->error = __( 'Access to this feed was denied (403). Please ensure you have public sharing enabled for your calendar.', GCE_TEXT_DOMAIN ); - break; - default: - $this->error = sprintf( __( 'The feed data could not be retrieved. Error code: %s. Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN ), $raw_data['response']['code'] ); - } - } - }else{ - //Generate an error message from the returned WP_Error - $this->error = $raw_data->get_error_message() . ' Please ensure your feed URL is correct.'; - } - } - - //Makes sure each event knows it came from this feed - foreach ( $this->events as $event ) { - $event->set_feed( $this ); - } - } - - //Convert an ISO date/time to a UNIX timestamp - function iso_to_ts( $iso ) { - sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second ); - return mktime( $hour, $minute, $second, $month, $day, $year ); - } - - //Return error message, or false if no error occurred - function error() { - return $this->error; - } - - //Setters - - function set_feed_id( $v ) { - $this->feed_id = $v; - } - - function set_feed_title( $v ) { - $this->feed_title = $v; - } - - function set_feed_url( $v ) { - $this->feed_url = $v; - } - - function set_max_events( $v ) { - $this->max_events = $v; - } - - function set_cache_duration( $v ) { - $this->cache_duration = $v; - } - - function set_date_format( $v ) { - $this->date_format = $v; - } - - function set_time_format( $v ) { - $this->time_format = $v; - } - - function set_timezone( $v ) { - $this->timezone = $v; - } - - function set_display_options( $v ) { - $this->display_opts = $v; - } - - function set_multi_day( $v ) { - $this->multi_day = $v; - } - - function set_feed_start( $v ) { - $this->feed_start = $v; - } - - function set_feed_end( $v ) { - $this->feed_end = $v; - } - - function set_use_builder( $v ) { - $this->use_builder = $v; - } - - function set_builder( $v ) { - $this->builder = $v; - } - - //Getters - - function get_events() { - return $this->events; - } - - function get_feed_id() { - return $this->feed_id; - } - - function get_feed_title() { - return $this->feed_title; - } - - function get_feed_url() { - return $this->feed_url; - } - - function get_date_format() { - return $this->date_format; - } - - function get_time_format() { - return $this->time_format; - } - - function get_display_options() { - return $this->display_opts; - } - - function get_multi_day() { - return $this->multi_day; - } - - function get_feed_start() { - return $this->feed_start; - } - - function get_feed_end() { - return $this->feed_end; - } - - function get_timezone() { - return $this->timezone; - } - - function get_use_builder() { - return $this->use_builder; - } - - function get_builder() { - return $this->builder; - } -} -?> \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/inc/gce-parser.php b/wp-content/plugins/google-calendar-events/inc/gce-parser.php deleted file mode 100644 index bff4c3f..0000000 --- a/wp-content/plugins/google-calendar-events/inc/gce-parser.php +++ /dev/null @@ -1,355 +0,0 @@ -title = $title_text; - $this->max_events_display = $max_events; - $this->sort_order = $sort_order; - - //Get the feed options - $options = get_option( GCE_OPTIONS_NAME ); - - $this->start_of_week = get_option( 'start_of_week' ); - - foreach ( $feed_ids as $single_feed ) { - //Get the options for this particular feed - if ( isset( $options[$single_feed] ) ) { - $feed_options = $options[$single_feed]; - - $feed = new GCE_Feed(); - - $feed->set_feed_id( $feed_options['id'] ); - $feed->set_feed_title( $feed_options['title'] ); - $feed->set_feed_url( $feed_options['url'] ); - $feed->set_max_events( $feed_options['max_events'] ); - $feed->set_cache_duration( $feed_options['cache_duration'] ); - - //Set the timezone if anything other than default - if ( 'default' != $feed_options['timezone'] ) - $feed->set_timezone( $feed_options['timezone'] ); - - //Set the start date to the appropriate value based on the retrieve_from option - switch ( $feed_options['retrieve_from'] ) { - //Don't just use time() for 'now', as this will effectively make cache duration 1 second. Instead set to previous minute. Events in Google Calendar cannot be set to precision of seconds anyway - case 'now': - $feed->set_feed_start( mktime( date( 'H' ), date( 'i' ), 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_from_value'] ); - break; - case 'today': - $feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_from_value'] ); - break; - case 'week': - $feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) + $this->start_of_week ), date( 'Y' ) ) + $feed_options['retrieve_from_value'] ); - break; - case 'month-start': - $feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ), 1, date( 'Y' ) ) + $feed_options['retrieve_from_value'] ); - break; - case 'month-end': - $feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ) + 1, 1, date( 'Y' ) ) + $feed_options['retrieve_from_value'] ); - break; - case 'date': - $feed->set_feed_start( $feed_options['retrieve_from_value'] ); - break; - default: - $feed->set_feed_start( 0 ); //any - 1970-01-01 00:00 - } - - //Set the end date to the appropriate value based on the retrieve_until option - switch ( $feed_options['retrieve_until'] ) { - case 'now': - $feed->set_feed_end( mktime( date( 'H' ), date( 'i' ), 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_until_value'] ); - break; - case 'today': - $feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_until_value'] ); - break; - case 'week': - $feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) + $this->start_of_week ), date( 'Y' ) ) + $feed_options['retrieve_until_value'] ); - break; - case 'month-start': - $feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ), 1, date( 'Y' ) ) + $feed_options['retrieve_until_value'] ); - break; - case 'month-end': - $feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ) + 1, 1, date( 'Y' ) ) + $feed_options['retrieve_until_value'] ); - break; - case 'date': - $feed->set_feed_end( $feed_options['retrieve_until_value'] ); - break; - case 'any': - $feed->set_feed_end( 2145916800 ); //any - 2038-01-01 00:00 - } - - //Set date and time formats. If they have not been set by user, set to global WordPress formats - $feed->set_date_format( ( empty( $feed_options['date_format'] ) ) ? get_option( 'date_format' ) : $feed_options['date_format'] ); - $feed->set_time_format( ( empty( $feed_options['time_format'] ) ) ? get_option( 'time_format' ) : $feed_options['time_format'] ); - //Set whether to handle multiple day events - $feed->set_multi_day( ( 'true' == $feed_options['multiple_day'] ) ? true : false ); - - //Sets all display options - $feed->set_display_options( array( - 'display_start' => $feed_options['display_start'], - 'display_end' => $feed_options['display_end'], - 'display_location' => $feed_options['display_location'], - 'display_desc' => $feed_options['display_desc'], - 'display_link' => $feed_options['display_link'], - 'display_start_text' => $feed_options['display_start_text'], - 'display_end_text' => $feed_options['display_end_text'], - 'display_location_text' => $feed_options['display_location_text'], - 'display_desc_text' => $feed_options['display_desc_text'], - 'display_desc_limit' => $feed_options['display_desc_limit'], - 'display_link_text' => $feed_options['display_link_text'], - 'display_link_target' => $feed_options['display_link_target'], - 'display_separator' => $feed_options['display_separator'] - ) ); - - $feed->set_use_builder( ( 'true' == $feed_options['use_builder'] ) ? true : false ); - $feed->set_builder( $feed_options['builder'] ); - - //Parse the feed - $feed->init(); - - //Add feed object to array of feeds - $this->feeds[$single_feed] = $feed; - } - } - - $this->merged_feed_data = array(); - - //Merge the feeds together into one array of events - foreach ( $this->feeds as $feed_id => $feed ) { - $errors_occurred = $feed->error(); - - if ( false === $errors_occurred ) - $this->merged_feed_data = array_merge( $this->merged_feed_data, $feed->get_events() ); - else - $this->errors[$feed_id] = $errors_occurred; - } - - //Sort the items into date order - if ( ! empty( $this->merged_feed_data ) ) - usort( $this->merged_feed_data, array( $this, 'compare' ) ); - } - - //Comparison function for use when sorting merged feed data (with usort) - function compare( $event1, $event2 ) { - //Sort ascending or descending - if ( 'asc' == $this->sort_order ) - return $event1->get_start_time() - $event2->get_start_time(); - - return $event2->get_start_time() - $event1->get_start_time(); - } - - //Returns number of errors that have occurred - function get_num_errors() { - return count( $this->errors ); - } - - //Outputs a message describing each error that has occurred - function error_messages() { - $message = '

' . __( '1 or more of your feeds could not be displayed. The following errors occurred:', GCE_TEXT_DOMAIN ) . '

    '; - - foreach ( $this->errors as $feed_id => $error ) { - $message .= '
  • ' . sprintf( __( 'Feed %s:', GCE_TEXT_DOMAIN ), $feed_id ) . ' ' . $error . '
  • '; - } - - return $message . '
'; - } - - //Returns array of days with events, with sub-arrays of events for that day - function get_event_days() { - $event_days = array(); - - //Total number of events retrieved - $count = count( $this->merged_feed_data ); - - //If maximum events to display is 0 (unlimited) set $max to 1, otherwise use maximum of events specified by user - $max = ( 0 == $this->max_events_display ) ? 1 : $this->max_events_display; - - //Loop through entire array of events, or until maximum number of events to be displayed has been reached - for ( $i = 0; $i < $count && $max > 0; $i++ ) { - $event = $this->merged_feed_data[$i]; - - //Check that event ends, or starts (or both) within the required date range. This prevents all-day events from before / after date range from showing up. - if ( $event->get_end_time() > $event->get_feed()->get_feed_start() && $event->get_start_time() < $event->get_feed()->get_feed_end() ) { - foreach ( $event->get_days() as $day ) { - $event_days[$day][] = $event; - } - - //If maximum events to display isn't 0 (unlimited) decrement $max counter - if ( 0 != $this->max_events_display ) - $max--; - } - } - - return $event_days; - } - - //Returns grid markup - function get_grid ( $year = null, $month = null, $ajaxified = false ) { - require_once 'php-calendar.php'; - - $time_now = current_time( 'timestamp' ); - - //If year and month have not been passed as paramaters, use current month and year - if( ! isset( $year ) ) - $year = date( 'Y', $time_now ); - - if( ! isset( $month ) ) - $month = date( 'm', $time_now ); - - //Get timestamps for the start and end of current month - $current_month_start = mktime( 0, 0, 0, date( 'm', $time_now ), 1, date( 'Y', $time_now ) ); - $current_month_end = mktime( 0, 0, 0, date( 'm', $time_now ) + 1, 1, date( 'Y', $time_now ) ); - - //Get timestamps for the start and end of the month to be displayed in the grid - $display_month_start = mktime( 0, 0, 0, $month, 1, $year ); - $display_month_end = mktime( 0, 0, 0, $month + 1, 1, $year ); - - //It should always be possible to navigate to the current month, even if it doesn't have any events - //So, if the display month is before the current month, set $nav_next to true, otherwise false - //If the display month is after the current month, set $nav_prev to true, otherwise false - $nav_next = ( $display_month_start < $current_month_start ); - $nav_prev = ( $display_month_start >= $current_month_end ); - - //Get events data - $event_days = $this->get_event_days(); - - //If event_days is empty, then there are no events in the feed(s), so set ajaxified to false (Prevents AJAX calendar from allowing to endlessly click through months with no events) - if ( empty( $event_days ) ) - $ajaxified = false; - - $today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); - - $i = 1; - - foreach ( $event_days as $key => $event_day ) { - //If event day is in the month and year specified (by $month and $year) - if ( $key >= $display_month_start && $key < $display_month_end ) { - //Create array of CSS classes. Add gce-has-events - $css_classes = array( 'gce-has-events' ); - - //Create markup for display - $markup = '
'; - - //If title option has been set for display, add it - if ( isset( $this->title ) ) - $markup .= '
' . esc_html( $this->title ) . ' ' . date_i18n( $event_day[0]->get_feed()->get_date_format(), $key ) . '
'; - - $markup .= '
    '; - - foreach ( $event_day as $num_in_day => $event ) { - $feed_id = absint( $event->get_feed()->get_feed_id() ); - $markup .= '
  • ' . $event->get_event_markup( 'tooltip', $num_in_day, $i ) . '
  • '; - - //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. - $css_classes['feed-' . $feed_id] = 'gce-feed-' . $feed_id; - - $i++; - } - - $markup .= '
'; - - //If number of CSS classes is greater than 2 ('gce-has-events' plus one specific feed class) then there must be events from multiple feeds on this day, so add gce-multiple CSS class - if ( count( $css_classes ) > 2 ) - $css_classes[] = 'gce-multiple'; - - //If event day is today, add gce-today CSS class, otherwise add past or future class - if ( $key == $today ) - $css_classes[] = 'gce-today gce-today-has-events'; - elseif ( $key < $today ) - $css_classes[] = 'gce-day-past'; - else - $css_classes[] = 'gce-day-future'; - - //Change array entry to array of link href, CSS classes, and markup for use in gce_generate_calendar (below) - $event_days[$key] = array( null, implode( ' ', $css_classes ), $markup ); - } elseif ( $key < $display_month_start ) { - //This day is before the display month, so set $nav_prev to true. Remove the day from $event_days, as it's no use for displaying this month - $nav_prev = true; - unset( $event_days[$key] ); - } else { - //This day is after the display month, so set $nav_next to true. Remove the day from $event_days, as it's no use for displaying this month - $nav_next = true; - unset( $event_days[$key] ); - } - } - - //Ensures that gce-today CSS class is added even if there are no events for 'today'. A bit messy :( - if ( ! isset( $event_days[$today] ) ) - $event_days[$today] = array( null, 'gce-today gce-today-no-events', null ); - - $pn = array(); - - //Only add previous / next functionality if AJAX grid is enabled - if ( $ajaxified ) { - //If there are events to display in a previous month, add previous month link - $prev_key = ( $nav_prev ) ? '«' : ' '; - $prev = ( $nav_prev ) ? date( 'm-Y', mktime( 0, 0, 0, $month - 1, 1, $year ) ) : null; - - //If there are events to display in a future month, add next month link - $next_key = ( $nav_next ) ? '»' : ' '; - $next = ( $nav_next ) ? date( 'm-Y', mktime( 0, 0, 0, $month + 1, 1, $year ) ) : null; - - //Array of previous and next link stuff for use in gce_generate_calendar (below) - $pn = array( $prev_key => $prev, $next_key => $next ); - } - - //Generate the calendar markup and return it - return gce_generate_calendar( $year, $month, $event_days, 1, null, $this->start_of_week, $pn ); - } - - function get_list( $grouped = false ) { - $time_now = current_time( 'timestamp' ); - - $event_days = $this->get_event_days(); - - //If event_days is empty, there are no events in the feed(s), so return a message indicating this - if( empty( $event_days) ) - return '

' . __( 'There are currently no events to display.', GCE_TEXT_DOMAIN ) . '

'; - - $today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); - - $i = 1; - - $markup = '
    '; - - foreach ( $event_days as $key => $event_day ) { - //If this is a grouped list, add the date title and begin the nested list for this day - if ( $grouped ) { - $markup .= - '' . - '
    ' . esc_html( $this->title ) . ' ' . date_i18n( $event_day[0]->get_feed()->get_date_format(), $key ) . '
    ' . - '
      '; - } - - foreach ( $event_day as $num_in_day => $event ) { - //Create the markup for this event - $markup .= - '
    • ' . - //If this isn't a grouped list and a date title should be displayed, add the date title - ( ( ! $grouped && isset( $this->title ) ) ? '
      ' . esc_html( $this->title ) . ' ' . date_i18n( $event->get_feed()->get_date_format(), $key ) . '
      ' : '' ) . - //Add the event markup - $event->get_event_markup( 'list', $num_in_day, $i ) . - '
    • '; - - $i++; - } - - //If this is a grouped list, close the nested list for this day - if ( $grouped ) - $markup .= '
    '; - } - - $markup .= '
'; - - return $markup; - } -} -?> \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/inc/upgrade-notice.php b/wp-content/plugins/google-calendar-events/inc/upgrade-notice.php deleted file mode 100644 index d243d07..0000000 --- a/wp-content/plugins/google-calendar-events/inc/upgrade-notice.php +++ /dev/null @@ -1,31 +0,0 @@ -, Nick Young - */ - -// Exit if accessed directly. -if ( ! defined( 'ABSPATH' ) ) { - exit; -} - -?> - - - - diff --git a/wp-content/plugins/google-calendar-events/includes/admin/admin-functions.php b/wp-content/plugins/google-calendar-events/includes/admin/admin-functions.php new file mode 100644 index 0000000..5889e87 --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/admin/admin-functions.php @@ -0,0 +1,62 @@ +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +/** + * Function to clear the cache out + * + * @since 2.0.0 + */ +function gce_clear_cache( $id ) { + + delete_transient( 'gce_feed_' . $id ); + + add_settings_error( 'gce-notices', 'gce-cache-updated', __( 'Cache has been cleared for this feed.', 'gce' ), 'updated' ); +} + +/** + * Function that runs when a new Feed CPT is made + * Adds the default editor content for the event builder + * Adds default post meta options + * + * @since 2.0.0 + */ + +function gce_default_editor_content( $content, $post ) { + + if( $post->post_type == 'gce_feed' ) { + $content = '
[event-title]
' . "\n"; + $content .= '
Starts: [start-time]
' . "\n"; + $content .= '
Ends: [end-date] - [end-time]
' . "\n"; + $content .= '[if-location]
Location: [location]
[/if-location]' . "\n"; + $content .= '[if-description]
Description: [description]
[/if-description]' . "\n"; + $content .= '
[link newwindow="true"]More details...[/link]
' . "\n"; + + // Default Post Meta Options + add_post_meta( $post->ID, 'gce_expand_recurring', 1 ); + add_post_meta( $post->ID, 'gce_retrieve_from', 'today' ); + add_post_meta( $post->ID, 'gce_retrieve_until', 'end_time' ); + add_post_meta( $post->ID, 'gce_cache', 43200 ); + + // Default Simple Display Options + add_post_meta( $post->ID, 'gce_display_start', 'time' ); + add_post_meta( $post->ID, 'gce_display_start_text', 'Starts:' ); + add_post_meta( $post->ID, 'gce_display_end', 'time-date' ); + add_post_meta( $post->ID, 'gce_display_end_text', 'Ends:' ); + add_post_meta( $post->ID, 'gce_display_separator', ', ' ); + add_post_meta( $post->ID, 'gce_display_location_text', 'Location:' ); + add_post_meta( $post->ID, 'gce_display_description_text', 'Description:' ); + add_post_meta( $post->ID, 'gce_display_link', 1 ); + add_post_meta( $post->ID, 'gce_display_link_text', 'More Details' ); + + } + + return $content; +} +add_filter( 'default_content', 'gce_default_editor_content', 10, 2 ); diff --git a/wp-content/plugins/google-calendar-events/includes/admin/upgrade.php b/wp-content/plugins/google-calendar-events/includes/admin/upgrade.php new file mode 100644 index 0000000..11a57fe --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/admin/upgrade.php @@ -0,0 +1,261 @@ +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +// I put the priority to 20 here so it runs after the gce_feed CPT code and we don't get errors +add_action( 'init', 'gce_upgrade', 20 ); + +/** + * Main GCE Upgrade function. Call this and branch of from here depending on what we need to do + * + * @since 2.0.0 + */ +function gce_upgrade() { + + $version = get_option( 'gce_version' ); + + if( ! empty( $version ) ) { + // Check if under version 2 and run the v2 upgrade if we are + if( version_compare( $version, '2.0.0-beta1', '<' ) && false === get_option( 'gce_upgrade_has_run' ) ) { + gce_v2_upgrade(); + } + } + + $new_version = Google_Calendar_Events::get_instance()->get_plugin_version(); + update_option( 'gce_version', $new_version ); + + add_option( 'gce_upgrade_has_run', 1 ); +} + +/* + * Run the upgrade to version 2.0.0 + * + * @since 2.0.0 + */ +function gce_v2_upgrade() { + $old_options = get_option( 'gce_options' ); + + if( false !== $old_options ) { + + foreach( $old_options as $key => $value ) { + convert_to_cpt_posts( $value ); + } + + update_widget_feed_ids(); + } +} + +/** + * Converts the old database options to the new CPT layout for 2.0.0+ + * + * @since 2.0.0 + */ +function convert_to_cpt_posts( $args ) { + // Setup our new post + $post = array( + 'post_name' => $args['title'], + 'post_title' => $args['title'], + 'post_status' => 'publish', + 'post_type' => 'gce_feed' + ); + + if( $args['use_builder'] == true ) { + $post['post_content'] = $args['builder']; + } + + $post_id = wp_insert_post( $post ); + + create_cpt_meta( $post_id, $args ); + + clear_old_transients( $args['id'] ); +} + +/** + * Add the CPT post meta based on options set for the old feeds prior to v2 + * + * @since 2.0.0 + */ +function create_cpt_meta( $id, $args ) { + + // Convert the dropdown values to the new values for "Retrieve Events From" + switch( $args['retrieve_from'] ) { + case 'now': + case 'today': + $from = 'today'; + break; + case 'week': + $from = 'start_week'; + break; + case 'month-start': + $from = 'start_month'; + break; + case 'month-end': + $from = 'end_month'; + break; + case 'date': + $from = 'custom_date'; + break; + default: + $from = 'start_time'; + break; + } + + // Convert the dropdown values to the new values for "Retrieve Events Until" + switch( $args['retrieve_until'] ) { + case 'now': + case 'today': + $until = 'today'; + break; + case 'week': + $until = 'start_week'; + break; + case 'month-start': + $until = 'start_month'; + break; + case 'month-end': + $until = 'end_month'; + break; + case 'date': + $until = 'custom_date'; + break; + default: + $until = 'end_time'; + break; + } + + $gce_expand_recurring = ( isset( $args['expand_recurring'] ) ? ( $args['expand_recurring'] == 'true' ? '1' : '0' ) : '1' ); + + // An array to hold all of our post meta ids and values so that we can loop through and add as post meta easily + $post_meta_fields = array( + 'gce_feed_url' => $args['url'], + 'gce_retrieve_from' => $from, + 'gce_retrieve_until' => $until, + 'gce_retrieve_max' => $args['max_events'], + 'gce_date_format' => $args['date_format'], + 'gce_time_format' => $args['time_format'], + 'gce_timezone_offset' => $args['timezone'], + 'gce_cache' => $args['cache_duration'], + 'gce_multi_day_events' => ( $args['multiple_day'] == 'true' || $args['multiple_day'] == true ? '1' : '0' ), + 'gce_display_mode' => 'grid', + 'gce_custom_from' => gce_convert_timestamp( $args['retrieve_from_value'] ), + 'gce_custom_until' => gce_convert_timestamp( $args['retrieve_until_value'] ), + 'old_gce_id' => $args['id'], + 'gce_search_query' => ( isset( $args['query'] ) ? $args['query'] : '' ), + 'gce_expand_recurring' => $gce_expand_recurring + ); + + if( $args['use_builder'] == 'false' || $args['use_builder'] == false ) { + $display_meta = array( + 'gce_display_simple' => 1, + 'gce_display_start' => $args['display_start'], + 'gce_display_start_text' => $args['display_start_text'], + 'gce_display_end' => $args['display_end'], + 'gce_display_end_text' => $args['display_end_text'], + 'gce_display_separator' => $args['display_separator'], + 'gce_display_location' => ( $args['display_location'] == 'on' ? '1' : '0' ), + 'gce_display_location_text' => $args['display_location_text'], + 'gce_display_description' => ( $args['display_desc'] == 'on' ? '1' : '0' ), + 'gce_display_description_text' => $args['display_desc_text'], + 'gce_display_description_max' => $args['display_desc_limit'], + 'gce_display_link' => ( $args['display_link'] == 'on' ? '1' : '0' ), + 'gce_display_link_tab' => ( $args['display_link_target'] == 'on' ? '1' : '0' ), + 'gce_display_link_text' => $args['display_link_text'] + ); + + $post_meta_fields = array_merge( $post_meta_fields, $display_meta ); + } + + // Loop through each $post_meta_field and add as an entry + foreach( $post_meta_fields as $k => $v ) { + update_post_meta( $id, $k, $v ); + } +} + +function gce_convert_timestamp( $t ) { + // mm/dd/yyyy + return date( 'm/d/Y', $t ); +} + +/** + * Remove the old transient values from the database + * + * @since 2.0.0 + */ +function clear_old_transients( $id ) { + + delete_transient( 'gce_feed_' . $id ); + delete_transient( 'gce_feed_' . $id . '_url' ); +} + +/** + * Update widget IDs + * + * @since 2.0.0 + */ +function update_widget_feed_ids() { + + $widget = get_option( 'widget_gce_widget' ); + + if( is_array( $widget ) && ! empty( $widget ) ) { + foreach( $widget as $a => $b ) { + if( ! is_array( $b ) ) { + continue; + } + + foreach( $b as $k => $v ) { + + if( $k != 'id' ) { + continue; + } + + $id = $v; + + $multi = str_replace( ' ', '', $v ); + + $multi = explode( ',', $id ); + + if( is_array( $multi ) ) { + + $new_ids = ''; + + foreach( $multi as $m ) { + $q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$m&order=ASC" ); + + if( $q->have_posts() ) { + + $q->the_post(); + // Set our ID to the old ID if found + $m = get_the_ID(); + + $new_ids .= $m . ','; + } + } + + $widget[$a][$k] = substr( $new_ids, 0, -1 ); + } else { + + $q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$id&order=ASC" ); + + if( $q->have_posts() ) { + + $q->the_post(); + // Set our ID to the old ID if found + $id = get_the_ID(); + } + + $widget[$a][$k] = $id; + } + } + } + + update_option( 'widget_gce_widget', $widget ); + } + +} \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/includes/class-gce-display.php b/wp-content/plugins/google-calendar-events/includes/class-gce-display.php new file mode 100644 index 0000000..a3a74cf --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/class-gce-display.php @@ -0,0 +1,259 @@ +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +class GCE_Display { + + private $feeds, $merged_feeds; + + public function __construct( $ids, $title_text = null, $max_events = 0, $sort_order = 'asc' ) { + + $this->id = $ids; + $this->title = $title_text; + $this->max_events = $max_events; + $this->sort = $sort_order; + + foreach( $ids as $id ) { + $this->feeds[$id] = new GCE_Feed( $id ); + } + + $this->merged_feeds = array(); + + //Merge the feeds together into one array of events + foreach ( $this->feeds as $feed_id => $feed ) { + $this->merged_feeds = array_merge( $this->merged_feeds, $feed->events ); + } + + // Sort the items into date order + if ( ! empty( $this->merged_feeds ) ) { + usort( $this->merged_feeds, array( $this, 'compare' ) ); + } + } + + /** + * Comparison function for use when sorting merged feed data (with usort) + * + * @since 2.0.0 + */ + function compare( $event1, $event2 ) { + //Sort ascending or descending + if ( 'asc' == $this->sort ) + return $event1->start_time - $event2->start_time; + + return $event2->start_time - $event1->start_time; + } + + /** + * Returns array of days with events, with sub-arrays of events for that day + * + * @since 2.0.0 + */ + private function get_event_days() { + $event_days = array(); + + //Total number of events retrieved + $count = count( $this->merged_feeds ); + + //If maximum events to display is 0 (unlimited) set $max to 1, otherwise use maximum of events specified by user + $max = ( 0 == $this->max_events ) ? 1 : $this->max_events; + + //Loop through entire array of events, or until maximum number of events to be displayed has been reached + for ( $i = 0; $i < $count && $max > 0; $i++ ) { + $event = $this->merged_feeds[$i]; + + //Check that event ends, or starts (or both) within the required date range. This prevents all-day events from before / after date range from showing up. + if ( $event->end_time > $event->start_time && $event->start_time < $event->end_time ) { + foreach ( $event->get_days() as $day ) { + $event_days[$day][] = $event; + } + + //If maximum events to display isn't 0 (unlimited) decrement $max counter + if ( 0 != $this->max_events ) + $max--; + } + } + + return $event_days; + } + + /** + * Return the markup for the 'Grid' display + * + * @since 2.0.0 + */ + public function get_grid ( $year = null, $month = null, $widget = false ) { + require_once 'php-calendar.php'; + + $time_now = current_time( 'timestamp' ); + + //If year and month have not been passed as paramaters, use current month and year + if( ! isset( $year ) ) { + $year = date( 'Y', $time_now ); + } + + if( ! isset( $month ) ) { + $month = date( 'm', $time_now ); + } + + //Get timestamps for the start and end of current month + $current_month_start = mktime( 0, 0, 0, date( 'm', $time_now ), 1, date( 'Y', $time_now ) ); + $current_month_end = mktime( 0, 0, 0, date( 'm', $time_now ) + 1, 1, date( 'Y', $time_now ) ); + + //Get timestamps for the start and end of the month to be displayed in the grid + $display_month_start = mktime( 0, 0, 0, $month, 1, $year ); + $display_month_end = mktime( 0, 0, 0, $month + 1, 1, $year ); + + //It should always be possible to navigate to the current month, even if it doesn't have any events + //So, if the display month is before the current month, set $nav_next to true, otherwise false + //If the display month is after the current month, set $nav_prev to true, otherwise false + $nav_next = ( $display_month_start < $current_month_start ); + $nav_prev = ( $display_month_start >= $current_month_end ); + + //Get events data + $event_days = $this->get_event_days(); + + $today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); + + $i = 1; + + foreach ( $event_days as $key => $event_day ) { + //If event day is in the month and year specified (by $month and $year) + if ( $key >= $display_month_start && $key < $display_month_end ) { + //Create array of CSS classes. Add gce-has-events + $css_classes = array( 'gce-has-events' ); + + //Create markup for display + $markup = '
'; + + //If title option has been set for display, add it + if ( isset( $this->title ) ) { + $markup .= '
' . esc_html( $this->title ) . ' ' . date_i18n( $event_day[0]->feed->date_format, $key ) . '
'; + } + + $markup .= '
    '; + + foreach ( $event_day as $num_in_day => $event ) { + $feed_id = absint( $event->feed->id ); + $markup .= '
  • ' . $event->get_event_markup( 'tooltip', $num_in_day, $i ) . '
  • '; + + //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. + $css_classes['feed-' . $feed_id] = 'gce-feed-' . $feed_id; + + $i++; + } + + $markup .= '
'; + + //If number of CSS classes is greater than 2 ('gce-has-events' plus one specific feed class) then there must be events from multiple feeds on this day, so add gce-multiple CSS class + if ( count( $css_classes ) > 2 ) + $css_classes[] = 'gce-multiple'; + + //If event day is today, add gce-today CSS class, otherwise add past or future class + if ( $key == $today ) { + $css_classes[] = 'gce-today gce-today-has-events'; + } elseif ( $key < $today ) { + $css_classes[] = 'gce-day-past'; + } else { + $css_classes[] = 'gce-day-future'; + } + + //Change array entry to array of link href, CSS classes, and markup for use in gce_generate_calendar (below) + $event_days[$key] = array( null, implode( ' ', $css_classes ), $markup ); + } elseif ( $key < $display_month_start ) { + //This day is before the display month, so set $nav_prev to true. Remove the day from $event_days, as it's no use for displaying this month + $nav_prev = true; + unset( $event_days[$key] ); + } else { + //This day is after the display month, so set $nav_next to true. Remove the day from $event_days, as it's no use for displaying this month + $nav_next = true; + unset( $event_days[$key] ); + } + } + + //Ensures that gce-today CSS class is added even if there are no events for 'today'. A bit messy :( + if ( ! isset( $event_days[$today] ) ) + $event_days[$today] = array( null, 'gce-today gce-today-no-events', null ); + + $pn = array(); + + // Add previous / next functionality + //If there are events to display in a previous month, add previous month link + $prev_key = ( $nav_prev ) ? '«' : ' '; + $prev = ( $nav_prev ) ? date( 'm-Y', mktime( 0, 0, 0, $month - 1, 1, $year ) ) : null; + + //If there are events to display in a future month, add next month link + $next_key = ( $nav_next ) ? '»' : ' '; + $next = ( $nav_next ) ? date( 'm-Y', mktime( 0, 0, 0, $month + 1, 1, $year ) ) : null; + + //Array of previous and next link stuff for use in gce_generate_calendar (below) + $pn = array( $prev_key => $prev, $next_key => $next ); + + + $start_day = get_option( 'start_of_week' ); + + //Generate the calendar markup and return it + return gce_generate_calendar( $year, $month, $event_days, 1, null, $start_day, $pn, $widget ); + } + + /** + * Return the markup for the 'List' display + * + * @since 2.0.0 + */ + public function get_list( $grouped = false ) { + $time_now = current_time( 'timestamp' ); + + // Get all the event days + $event_days = $this->get_event_days(); + + //If event_days is empty, there are no events in the feed(s), so return a message indicating this + if( empty( $event_days) ) { + return '

' . __( 'There are currently no events to display.', 'gce' ) . '

'; + } + + $today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); + + $i = 1; + + $markup = '
    '; + + foreach ( $event_days as $key => $event_day ) { + //If this is a grouped list, add the date title and begin the nested list for this day + if ( $grouped ) { + $markup .= + '' . + '
    ' . date_i18n( $event_day[0]->feed->date_format, $key ) . '
    ' . + '
      '; + } + + foreach ( $event_day as $num_in_day => $event ) { + //Create the markup for this event + $markup .= + '
    • ' . + //If this isn't a grouped list and a date title should be displayed, add the date title + ( ( ! $grouped && isset( $event->title ) ) ? '
      ' . esc_html( $this->title ) . ' ' . date_i18n( $event->feed->date_format, $key ) . '
      ' : '' ) . + //Add the event markup + $event->get_event_markup( 'list', $num_in_day, $i ) . + '
    • '; + + $i++; + } + + //If this is a grouped list, close the nested list for this day + if ( $grouped ) { + $markup .= '
    '; + } + } + + $markup .= '
'; + + return $markup; + } +} diff --git a/wp-content/plugins/google-calendar-events/inc/gce-event.php b/wp-content/plugins/google-calendar-events/includes/class-gce-event.php similarity index 74% rename from wp-content/plugins/google-calendar-events/inc/gce-event.php rename to wp-content/plugins/google-calendar-events/includes/class-gce-event.php index e0765b5..2352e35 100644 --- a/wp-content/plugins/google-calendar-events/inc/gce-event.php +++ b/wp-content/plugins/google-calendar-events/includes/class-gce-event.php @@ -1,527 +1,541 @@ -id = $id; - $this->title = $title; - $this->description = $description; - $this->location = $location; - $this->start_time = $start_time; - $this->end_time = $end_time; - $this->link = $link; - - //Calculate which day type this event is (SWD = single whole day, SPD = single part day, MWD = multiple whole day, MPD = multiple part day) - if ( ( $start_time + 86400 ) <= $end_time ) { - if ( ( $start_time + 86400 ) == $end_time ) { - $this->day_type = 'SWD'; - } else { - if ( ( '12:00 am' == date( 'g:i a', $start_time ) ) && ( '12:00 am' == date( 'g:i a', $end_time ) ) ) { - $this->day_type = 'MWD'; - } else { - $this->day_type = 'MPD'; - } - } - } else { - $this->day_type = 'SPD'; - } - } - - function set_feed( $feed ) { - $this->feed = $feed; - } - - function get_feed() { - return $this->feed; - } - - function get_start_time() { - return $this->start_time; - } - - function get_end_time() { - return $this->end_time; - } - - function get_day_type() { - return $this->day_type; - } - - //Returns an array of days (as UNIX timestamps) that this events spans - function get_days() { - //Round start date to nearest day - $start_time = mktime( 0, 0, 0, date( 'm', $this->start_time ), date( 'd', $this->start_time ) , date( 'Y', $this->start_time ) ); - - $days = array(); - - //If multiple day events should be handled, and this event is a multi-day event, add multiple day event to required days - if ( $this->feed->get_multi_day() && ( 'MPD' == $this->day_type || 'MWD' == $this->day_type ) ) { - $on_next_day = true; - $next_day = $start_time; - - while ( $on_next_day ) { - //If the end time of the event is after 00:00 on the next day (therefore, not doesn't end on this day) - if ( $this->end_time > $next_day ) { - //If $next_day is within the event retrieval date range (specified by retrieve events from / until settings) - if ( $next_day >= $this->feed->get_feed_start() && $next_day < $this->feed->get_feed_end() ) { - $days[] = $next_day; - } - } else { - $on_next_day = false; - } - $next_day += 86400; - } - } else { - //Add event into array of events for that day - $days[] = $start_time; - } - - return $days; - } - - //Returns the markup for this event, so that it can be used in the construction of a grid / list - function get_event_markup( $display_type, $num_in_day, $num ) { - //Set the display type (either tooltip or list) - $this->type = $display_type; - - //Set which number event this is in day (first in day etc) - $this->num_in_day = $num_in_day; - - //Set the position of this event in array of events currently being processed - $this->pos = $num; - - $this->time_now = current_time( 'timestamp' ); - - //Use the builder or the old display options to create the markup, depending on user choice - if ( $this->feed->get_use_builder() ) - return $this->use_builder(); - - return $this->use_old_display_options(); - } - - //Return the event markup using the builder - function use_builder() { - //Array of valid shortcodes - $shortcodes = array( - //Event / feed information shortcodes - - 'event-title', //The event title - 'start-time', //The start time of the event (uses the time format from the feed options, if it is set. Otherwise uses the default WordPress time format) - 'start-date', //The start date of the event (uses the date format from the feed options, if it is set. Otherwise uses the default WordPress date format) - 'start-custom', //The start time / date of the event (uses a custom PHP date format, specified in the 'format' attribute) - 'start-human', //The difference between the start time of the event and the time now, in human-readable format, such as '1 hour', '4 days', '15 mins' - 'end-time', //The end time of the event (uses the time format from the feed options, if it is set. Otherwise uses the default WordPress time format) - 'end-date', //The end date of the event (uses the date format from the feed options, if it is set. Otherwise uses the default WordPress date format) - 'end-custom', //The end time / date of the event (uses a custom PHP date format, specified in the 'format' attribute) - 'end-human', //The difference between the end time of the event and the time now, in human-readable format, such as '1 hour', '4 days', '15 mins' - 'location', //The event location - 'description', //The event deescription (number of words can be limited by the 'limit' attribute) - 'link', //Anything within this shortcode (including further shortcodes) will be linked to the Google Calendar page for this event - 'url', //The raw link URL to the Google Calendar page for this event (can be used to construct more customized links) - 'feed-id', //The ID of this feed (Can be useful for constructing feed specific CSS classes) - 'feed-title', //The feed title - 'maps-link', //Anything within this shortcode (including further shortcodes) will be linked to a Google Maps page based on whatever is specified for the event location - 'length', //How long the events lasts, in human-readable format - 'event-num', //The position of the event in the current list, or the position of the event in the current month (for grids) - 'event-id', //The event UID (unique identifier assigned by Google) - 'cal-id', //The calendar ID - - //Anything between the opening and closing tags of the following logical shortcodes (including further shortcodes) will only be displayed if: - - 'if-all-day', //This is an all-day event - 'if-not-all-day', //This is not an all-day event - 'if-title', //The event has a title - 'if-description', //The event has a description - 'if-location', //The event has a location - 'if-tooltip', //The current display type is 'tooltip' - 'if-list', //The current display type is 'list' - 'if-now', //The event is taking place now (after the start time, but before the end time) - 'if-not-now', //The event is not taking place now (may have ended or not yet started) - 'if-started', //The event has started (and even if it has ended) - 'if-not-started', //The event has not yet started - 'if-ended', //The event has ended - 'if-not-ended', //The event has not ended (and even if it hasn't started) - 'if-first', //The event is the first in the day - 'if-not-first', //The event is not the first in the day - 'if-multi-day', //The event spans multiple days - 'if-single-day' //The event does not span multiple days - ); - - $this->regex = '/(.?)\[(' . implode( '|', $shortcodes ) . ')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s'; - - return $this->look_for_shortcodes( $this->feed->get_builder() ); - } - - //Look through the EDB markup for shortcodes - function look_for_shortcodes( $markup ) { - return preg_replace_callback( $this->regex, array( $this, 'process_shortcode' ), $markup ); - } - - //Parse a shortcode, returning the appropriate event information - //Much of this code is 'borrowed' from WordPress' own shortcode handling stuff! - function process_shortcode( $m ) { - if ( '[' == $m[1] && ']' == $m[6] ) - return substr( $m[0], 1, -1 ); - - //Extract any attributes contained in the shortcode - extract( shortcode_atts( array( - 'newwindow' => 'false', - 'format' => '', - 'limit' => '0', - 'html' => 'false', - 'markdown' => 'false', - 'precision' => '1', - 'offset' => '0', - 'autolink' => 'true' - ), shortcode_parse_atts( $m[3] ) ) ); - - //Sanitize the attributes - $newwindow = ( 'true' === $newwindow ); - $format = esc_attr( $format ); - $limit = absint( $limit ); - $html = ( 'true' === $html ); - $markdown = ( 'true' === $markdown ); - $precision = absint( $precision ); - $offset = intval( $offset ); - $autolink = ( 'true' === $autolink ); - - //Do the appropriate stuff depending on which shortcode we're looking at. See valid shortcode list (above) for explanation of each shortcode - switch ( $m[2] ) { - case 'event-title': - $title = esc_html( trim( $this->title ) ); - - if ( $markdown && function_exists( 'Markdown' ) ) - $title = Markdown( $title ); - - if ( $html ) - $title = wp_kses_post( html_entity_decode( $title ) ); - - return $m[1] . $title . $m[6]; - - case 'start-time': - return $m[1] . date_i18n( $this->feed->get_time_format(), $this->start_time + $offset ) . $m[6]; - - case 'start-date': - return $m[1] . date_i18n( $this->feed->get_date_format(), $this->start_time + $offset ) . $m[6]; - - case 'start-custom': - return $m[1] . date_i18n( $format, $this->start_time + $offset ) . $m[6]; - - case 'start-human': - return $m[1] . $this->gce_human_time_diff( $this->start_time + $offset, $this->time_now, $precision ) . $m[6]; - - case 'end-time': - return $m[1] . date_i18n( $this->feed->get_time_format(), $this->end_time + $offset ) . $m[6]; - - case 'end-date': - return $m[1] . date_i18n( $this->feed->get_date_format(), $this->end_time + $offset ) . $m[6]; - - case 'end-custom': - return $m[1] . date_i18n( $format, $this->end_time + $offset ) . $m[6]; - - case 'end-human': - return $m[1] . $this->gce_human_time_diff( $this->end_time + $offset, $this->time_now, $precision ) . $m[6]; - - case 'location': - $location = esc_html( trim( $this->location ) ); - - if ( $markdown && function_exists( 'Markdown' ) ) - $location = Markdown( $location ); - - if ( $html ) - $location = wp_kses_post( html_entity_decode( $location ) ); - - return $m[1] . $location . $m[6]; - - case 'description': - $description = esc_html( trim( $this->description ) ); - - //If a word limit has been set, trim the description to the required length - if ( 0 != $limit ) { - preg_match( '/([\S]+\s*){0,' . $limit . '}/', esc_html( $this->description ), $description ); - $description = trim( $description[0] ); - } - - if ( $markdown || $html ) { - if ( $markdown && function_exists( 'Markdown' ) ) - $description = Markdown( $description ); - - if ( $html ) - $description = wp_kses_post( html_entity_decode( $description ) ); - }else{ - //Otherwise, preserve line breaks - $description = nl2br( $description ); - - //Make URLs clickable if required - if ( $autolink ) - $description = make_clickable( $description ); - } - - return $m[1] . $description . $m[6]; - - case 'link': - $new_window = ( $newwindow ) ? ' target="_blank"' : ''; - return $m[1] . '' . $this->look_for_shortcodes( $m[5] ) . '' . $m[6]; - - case 'url': - return $m[1] . esc_url( $this->link . '&ctz=' . $this->feed->get_timezone() ) . $m[6]; - - case 'feed-id': - return $m[1] . intval( $this->feed->get_feed_id() ) . $m[6]; - - case 'feed-title': - return $m[1] . esc_html( $this->feed->get_feed_title() ) . $m[6]; - - case 'maps-link': - $new_window = ( $newwindow ) ? ' target="_blank"' : ''; - return $m[1] . '' . $this->look_for_shortcodes( $m[5] ) . '' . $m[6]; - - case 'length': - return $m[1] . $this->gce_human_time_diff( $this->start_time, $this->end_time, $precision ) . $m[6]; - - case 'event-num': - return $m[1] . intval( $this->pos ) . $m[6]; - - case 'event-id': - return $m[1] . esc_html( $this->id ) . $m[6]; - - case 'cal-id': - $cal_id = explode( '/', $this->feed->get_feed_url() ); - return $m[1] . esc_html( $cal_id[5] ) . $m[6]; - - case 'if-all-day': - if ( 'SWD' == $this->day_type || 'MWD' == $this->day_type ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-not-all-day': - if ( 'SPD' == $this->day_type || 'MPD' == $this->day_type ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-title': - if ( '' != $this->title ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-description': - if ( '' != $this->description ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-location': - if ( '' != $this->location ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-tooltip': - if ( 'tooltip' == $this->type ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-list': - if ( 'list' == $this->type ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-now': - if ( $this->time_now >= $this->start_time && $this->time_now < $this->end_time ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-not-now': - if ( $this->end_time < $this->time_now || $this->start_time > $this->time_now ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-started': - if ( $this->start_time < $this->time_now ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-not-started': - if ( $this->start_time > $this->time_now ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-ended': - if ( $this->end_time < $this->time_now ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-not-ended': - if ( $this->end_time > $this->time_now ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-first': - if ( 0 == $this->num_in_day ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-not-first': - if ( 0 != $this->num_in_day ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-multi-day': - if ( 'MPD' == $this->day_type || 'MWD' == $this->day_type ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - - case 'if-single-day': - if ( 'SPD' == $this->day_type || 'SWD' == $this->day_type ) - return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; - - return ''; - } - } - - //Return the event markup using the old display options - function use_old_display_options() { - $display_options = $this->feed->get_display_options(); - - $markup = '

' . esc_html( $this->title ) . '

'; - - $start_end = array(); - - //If start date / time should be displayed, set up array of start date and time - if ( 'none' != $display_options['display_start'] ) { - $sd = $this->start_time; - $start_end['start'] = array( - 'time' => date_i18n( $this->feed->get_time_format(), $sd ), - 'date' => date_i18n( $this->feed->get_date_format(), $sd ) - ); - } - - //If end date / time should be displayed, set up array of end date and time - if ( 'none' != $display_options['display_end'] ) { - $ed = $this->end_time; - $start_end['end'] = array( - 'time' => date_i18n( $this->feed->get_time_format(), $ed ), - 'date' => date_i18n( $this->feed->get_date_format(), $ed ) - ); - } - - //Add the correct start / end, date / time information to $markup - foreach ( $start_end as $start_or_end => $info ) { - $markup .= '

' . esc_html( $display_options['display_' . $start_or_end . '_text'] ) . ' '; - - switch ( $display_options['display_' . $start_or_end] ) { - case 'time': $markup .= esc_html( $info['time'] ); - break; - case 'date': $markup .= esc_html( $info['date'] ); - break; - case 'time-date': $markup .= esc_html( $info['time'] . $display_options['display_separator'] . $info['date'] ); - break; - case 'date-time': $markup .= esc_html( $info['date'] . $display_options['display_separator'] . $info['time'] ); - } - - $markup .= '

'; - } - - //If location should be displayed (and is not empty) add to $markup - if ( isset( $display_options['display_location'] ) ) { - $event_location = $this->location; - if ( '' != $event_location ) - $markup .= '

' . esc_html( $display_options['display_location_text'] ) . ' ' . esc_html( $event_location ) . '

'; - } - - //If description should be displayed (and is not empty) add to $markup - if ( isset($display_options['display_desc'] ) ) { - $event_desc = $this->description; - - if ( '' != $event_desc ) { - //Limit number of words of description to display, if required - if ( '' != $display_options['display_desc_limit'] ) { - preg_match( '/([\S]+\s*){0,' . $display_options['display_desc_limit'] . '}/', $this->description, $event_desc ); - $event_desc = trim( $event_desc[0] ); - } - - $markup .= '

' . $display_options['display_desc_text'] . ' ' . make_clickable( nl2br( esc_html( $event_desc ) ) ) . '

'; - } - } - - //If link should be displayed add to $markup - if ( isset($display_options['display_link'] ) ) - $markup .= ''; - - return $markup; - } - - //Returns the difference between two times in human-readable format. Based on a patch for human_time_diff posted in the WordPress trac (http://core.trac.wordpress.org/ticket/9272) by Viper007Bond - function gce_human_time_diff( $from, $to = '', $limit = 1 ) { - $units = array( - 31556926 => array( __( '%s year', GCE_TEXT_DOMAIN ), __( '%s years', GCE_TEXT_DOMAIN ) ), - 2629744 => array( __( '%s month', GCE_TEXT_DOMAIN ), __( '%s months', GCE_TEXT_DOMAIN ) ), - 604800 => array( __( '%s week', GCE_TEXT_DOMAIN ), __( '%s weeks', GCE_TEXT_DOMAIN ) ), - 86400 => array( __( '%s day', GCE_TEXT_DOMAIN ), __( '%s days', GCE_TEXT_DOMAIN ) ), - 3600 => array( __( '%s hour', GCE_TEXT_DOMAIN ), __( '%s hours', GCE_TEXT_DOMAIN ) ), - 60 => array( __( '%s min', GCE_TEXT_DOMAIN ), __( '%s mins', GCE_TEXT_DOMAIN ) ), - ); - - if ( empty( $to ) ) - $to = time(); - - $from = (int) $from; - $to = (int) $to; - $diff = (int) abs( $to - $from ); - - $items = 0; - $output = array(); - - foreach ( $units as $unitsec => $unitnames ) { - if ( $items >= $limit ) - break; - - if ( $diff < $unitsec ) - continue; - - $numthisunits = floor( $diff / $unitsec ); - $diff = $diff - ( $numthisunits * $unitsec ); - $items++; - - if ( $numthisunits > 0 ) - $output[] = sprintf( _n( $unitnames[0], $unitnames[1], $numthisunits ), $numthisunits ); - } - - $seperator = _x( ', ', 'human_time_diff' ); - - if ( ! empty( $output ) ) { - return implode( $seperator, $output ); - } else { - $smallest = array_pop( $units ); - return sprintf( $smallest[0], 1 ); - } - } -} -?> \ No newline at end of file +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +class GCE_Event { + + public $feed; + + /** + * Class constructor + * + * @since 2.0.0 + */ + function __construct( GCE_Feed $feed, $id, $title, $description, $location, $start_time, $end_time, $link ) { + + $this->feed = $feed; + $this->id = $id; + $this->title = $title; + $this->description = $description; + $this->location = $location; + $this->start_time = $start_time; + $this->end_time = $end_time; + $this->link = $link; + + //Calculate which day type this event is (SWD = single whole day, SPD = single part day, MWD = multiple whole day, MPD = multiple part day) + if ( ( $start_time + 86400 ) <= $end_time ) { + if ( ( $start_time + 86400 ) == $end_time ) { + $this->day_type = 'SWD'; + } else { + if ( ( '12:00 am' == date( 'g:i a', $start_time ) ) && ( '12:00 am' == date( 'g:i a', $end_time ) ) ) { + $this->day_type = 'MWD'; + } else { + $this->day_type = 'MPD'; + } + } + } else { + $this->day_type = 'SPD'; + } + } + + /** + * Returns an array of days (as UNIX timestamps) that this events spans + * + * @since 2.0.0 + */ + function get_days() { + //Round start date to nearest day + $start_time = mktime( 0, 0, 0, date( 'm', $this->start_time ), date( 'd', $this->start_time ) , date( 'Y', $this->start_time ) ); + + $days = array(); + + //If multiple day events should be handled, and this event is a multi-day event, add multiple day event to required days + if ( $this->feed->multiple_day_events && ( 'MPD' == $this->day_type || 'MWD' == $this->day_type ) ) { + $on_next_day = true; + $next_day = $start_time; + + while ( $on_next_day ) { + //If the end time of the event is after 00:00 on the next day (therefore, not doesn't end on this day) + if ( $this->end_time > $next_day ) { + //If $next_day is within the event retrieval date range (specified by retrieve events from / until settings) + if ( $next_day >= $this->feed->start && $next_day < $this->feed->end ) { + $days[] = $next_day; + } + } else { + $on_next_day = false; + } + $next_day += 86400; + } + } else { + //Add event into array of events for that day + $days[] = $start_time; + } + + return $days; + } + + /** + * Returns the markup for this event, so that it can be used in the construction of a grid / list + * + * @since 2.0.0 + */ + function get_event_markup( $display_type, $num_in_day, $num ) { + + + + + //Set the display type (either tooltip or list) + $this->type = $display_type; + + //Set which number event this is in day (first in day etc) + $this->num_in_day = $num_in_day; + + //Set the position of this event in array of events currently being processed + $this->pos = $num; + + $this->time_now = current_time( 'timestamp' ); + + // First check if we use the builder or not + $use_simple = get_post_meta( $this->feed->id, 'gce_display_simple', true ); + + if( empty( $use_simple ) ) { + return $this->use_builder(); + } + + // Setup the markup to return + //$display_options = get_option( 'gce_settings_general' ); + + $display_options['display_start'] = get_post_meta( $this->feed->id, 'gce_display_start', true ); + $display_options['display_start_text'] = get_post_meta( $this->feed->id, 'gce_display_start_text', true ); + $display_options['display_end'] = get_post_meta( $this->feed->id, 'gce_display_end', true ); + $display_options['display_end_text'] = get_post_meta( $this->feed->id, 'gce_display_end_text', true ); + $display_options['display_location'] = get_post_meta( $this->feed->id, 'gce_display_location', true ); + $display_options['display_location_text'] = get_post_meta( $this->feed->id, 'gce_display_location_text', true ); + $display_options['display_desc'] = get_post_meta( $this->feed->id, 'gce_display_description', true ); + $display_options['display_desc_text'] = get_post_meta( $this->feed->id, 'gce_display_description_text', true ); + $display_options['display_desc_limit'] = get_post_meta( $this->feed->id, 'gce_display_description_max', true ); + $display_options['display_link'] = get_post_meta( $this->feed->id, 'gce_display_link', true ); + $display_options['display_link_text'] = get_post_meta( $this->feed->id, 'gce_display_link_text', true ); + $display_options['display_separator'] = get_post_meta( $this->feed->id, 'gce_display_separator', true ); + $display_options['display_link_target'] = get_post_meta( $this->feed->id, 'gce_display_link_tab', true ); + + $markup = '

' . esc_html( $this->title ) . '

'; + + $start_end = array(); + + //If start date / time should be displayed, set up array of start date and time + if ( ! empty( $display_options['display_start'] ) && 'none' != $display_options['display_start'] ) { + $sd = $this->start_time; + $start_end['start'] = array( + 'time' => date_i18n( $this->feed->time_format, $sd ), + 'date' => date_i18n( $this->feed->date_format, $sd ) + ); + } + + //If end date / time should be displayed, set up array of end date and time + if ( ! empty( $display_options['display_end'] ) && 'none' != $display_options['display_end'] ) { + $ed = $this->end_time; + $start_end['end'] = array( + 'time' => date_i18n( $this->feed->time_format, $ed ), + 'date' => date_i18n( $this->feed->date_format, $ed ) + ); + } + + //Add the correct start / end, date / time information to $markup + foreach ( $start_end as $start_or_end => $info ) { + $markup .= '

' . esc_html( $display_options['display_' . $start_or_end . '_text'] ) . ' '; + + if( ! empty( $display_options['display_' . $start_or_end] ) ) { + switch ( $display_options['display_' . $start_or_end] ) { + case 'time': $markup .= esc_html( $info['time'] ); + break; + case 'date': $markup .= esc_html( $info['date'] ); + break; + case 'time-date': $markup .= esc_html( $info['time'] . $display_options['display_separator'] . $info['date'] ); + break; + case 'date-time': $markup .= esc_html( $info['date'] . $display_options['display_separator'] . $info['time'] ); + } + } + + $markup .= '

'; + } + + //If location should be displayed (and is not empty) add to $markup + if ( isset( $display_options['display_location'] ) ) { + $event_location = $this->location; + if ( '' != $event_location ) + $markup .= '

' . esc_html( $display_options['display_location_text'] ) . ' ' . esc_html( $event_location ) . '

'; + } + + //If description should be displayed (and is not empty) add to $markup + if ( isset($display_options['display_desc'] ) ) { + $event_desc = $this->description; + + if ( '' != $event_desc ) { + //Limit number of words of description to display, if required + if ( '' != $display_options['display_desc_limit'] ) { + preg_match( '/([\S]+\s*){0,' . $display_options['display_desc_limit'] . '}/', $this->description, $event_desc ); + $event_desc = trim( $event_desc[0] ); + } + + $markup .= '

' . $display_options['display_desc_text'] . ' ' . make_clickable( nl2br( esc_html( $event_desc ) ) ) . '

'; + } + } + + //If link should be displayed add to $markup + if ( isset($display_options['display_link'] ) ) { + $target = ( ! empty( $display_options['display_link_target'] ) ? 'target="blank"' : '' ); + $markup .= ''; + } + + return $markup; + + } + + //Return the event markup using the builder + function use_builder() { + //Array of valid shortcodes + $shortcodes = array( + //Event / feed information shortcodes + + 'event-title', //The event title + 'start-time', //The start time of the event (uses the time format from the feed options, if it is set. Otherwise uses the default WordPress time format) + 'start-date', //The start date of the event (uses the date format from the feed options, if it is set. Otherwise uses the default WordPress date format) + 'start-custom', //The start time / date of the event (uses a custom PHP date format, specified in the 'format' attribute) + 'start-human', //The difference between the start time of the event and the time now, in human-readable format, such as '1 hour', '4 days', '15 mins' + 'end-time', //The end time of the event (uses the time format from the feed options, if it is set. Otherwise uses the default WordPress time format) + 'end-date', //The end date of the event (uses the date format from the feed options, if it is set. Otherwise uses the default WordPress date format) + 'end-custom', //The end time / date of the event (uses a custom PHP date format, specified in the 'format' attribute) + 'end-human', //The difference between the end time of the event and the time now, in human-readable format, such as '1 hour', '4 days', '15 mins' + 'location', //The event location + 'description', //The event deescription (number of words can be limited by the 'limit' attribute) + 'link', //Anything within this shortcode (including further shortcodes) will be linked to the Google Calendar page for this event + 'url', //The raw link URL to the Google Calendar page for this event (can be used to construct more customized links) + 'feed-id', //The ID of this feed (Can be useful for constructing feed specific CSS classes) + 'feed-title', //The feed title + 'maps-link', //Anything within this shortcode (including further shortcodes) will be linked to a Google Maps page based on whatever is specified for the event location + 'length', //How long the events lasts, in human-readable format + 'event-num', //The position of the event in the current list, or the position of the event in the current month (for grids) + 'event-id', //The event UID (unique identifier assigned by Google) + 'cal-id', //The calendar ID + + //Anything between the opening and closing tags of the following logical shortcodes (including further shortcodes) will only be displayed if: + + 'if-all-day', //This is an all-day event + 'if-not-all-day', //This is not an all-day event + 'if-title', //The event has a title + 'if-description', //The event has a description + 'if-location', //The event has a location + 'if-tooltip', //The current display type is 'tooltip' + 'if-list', //The current display type is 'list' + 'if-now', //The event is taking place now (after the start time, but before the end time) + 'if-not-now', //The event is not taking place now (may have ended or not yet started) + 'if-started', //The event has started (and even if it has ended) + 'if-not-started', //The event has not yet started + 'if-ended', //The event has ended + 'if-not-ended', //The event has not ended (and even if it hasn't started) + 'if-first', //The event is the first in the day + 'if-not-first', //The event is not the first in the day + 'if-multi-day', //The event spans multiple days + 'if-single-day' //The event does not span multiple days + ); + + $this->regex = '/(.?)\[(' . implode( '|', $shortcodes ) . ')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s'; + + return $this->look_for_shortcodes( $this->feed->get_builder() ); + } + + //Look through the EDB markup for shortcodes + function look_for_shortcodes( $markup ) { + return preg_replace_callback( $this->regex, array( $this, 'process_shortcode' ), $markup ); + } + + //Parse a shortcode, returning the appropriate event information + //Much of this code is 'borrowed' from WordPress' own shortcode handling stuff! + function process_shortcode( $m ) { + if ( '[' == $m[1] && ']' == $m[6] ) + return substr( $m[0], 1, -1 ); + + //Extract any attributes contained in the shortcode + extract( shortcode_atts( array( + 'newwindow' => 'false', + 'format' => '', + 'limit' => '0', + 'html' => 'false', + 'markdown' => 'false', + 'precision' => '1', + 'offset' => '0', + 'autolink' => 'true' + ), shortcode_parse_atts( $m[3] ) ) ); + + //Sanitize the attributes + $newwindow = ( 'true' === $newwindow ); + $format = esc_attr( $format ); + $limit = absint( $limit ); + $html = ( 'true' === $html ); + $markdown = ( 'true' === $markdown ); + $precision = absint( $precision ); + $offset = intval( $offset ); + $autolink = ( 'true' === $autolink ); + + //Do the appropriate stuff depending on which shortcode we're looking at. See valid shortcode list (above) for explanation of each shortcode + switch ( $m[2] ) { + case 'event-title': + $title = esc_html( trim( $this->title ) ); + + if ( $markdown && function_exists( 'Markdown' ) ) + $title = Markdown( $title ); + + if ( $html ) + $title = wp_kses_post( html_entity_decode( $title ) ); + + return $m[1] . $title . $m[6]; + + case 'start-time': + return $m[1] . date_i18n( $this->feed->time_format, $this->start_time + $offset ) . $m[6]; + + case 'start-date': + return $m[1] . date_i18n( $this->feed->date_format, $this->start_time + $offset ) . $m[6]; + + case 'start-custom': + return $m[1] . date_i18n( $format, $this->start_time + $offset ) . $m[6]; + + case 'start-human': + return $m[1] . $this->gce_human_time_diff( $this->start_time + $offset, $this->time_now, $precision ) . $m[6]; + + case 'end-time': + return $m[1] . date_i18n( $this->feed->time_format, $this->end_time + $offset ) . $m[6]; + + case 'end-date': + return $m[1] . date_i18n( $this->feed->date_format, $this->end_time + $offset ) . $m[6]; + + case 'end-custom': + return $m[1] . date_i18n( $format, $this->end_time + $offset ) . $m[6]; + + case 'end-human': + return $m[1] . $this->gce_human_time_diff( $this->end_time + $offset, $this->time_now, $precision ) . $m[6]; + + case 'location': + $location = esc_html( trim( $this->location ) ); + + if ( $markdown && function_exists( 'Markdown' ) ) + $location = Markdown( $location ); + + if ( $html ) + $location = wp_kses_post( html_entity_decode( $location ) ); + + return $m[1] . $location . $m[6]; + + case 'description': + $description = esc_html( trim( $this->description ) ); + + //If a word limit has been set, trim the description to the required length + if ( 0 != $limit ) { + preg_match( '/([\S]+\s*){0,' . $limit . '}/', esc_html( $this->description ), $description ); + $description = trim( $description[0] ); + } + + if ( $markdown || $html ) { + if ( $markdown && function_exists( 'Markdown' ) ) + $description = Markdown( $description ); + + if ( $html ) + $description = wp_kses_post( html_entity_decode( $description ) ); + }else{ + //Otherwise, preserve line breaks + $description = nl2br( $description ); + + //Make URLs clickable if required + if ( $autolink ) + $description = make_clickable( $description ); + } + + return $m[1] . $description . $m[6]; + + case 'link': + $new_window = ( $newwindow ) ? ' target="_blank"' : ''; + return $m[1] . '' . $this->look_for_shortcodes( $m[5] ) . '' . $m[6]; + + case 'url': + return $m[1] . esc_url( $this->link . '&ctz=' . $this->feed->timezone_offset ) . $m[6]; + + case 'feed-id': + return $m[1] . intval( $this->feed->id ) . $m[6]; + + case 'feed-title': + return $m[1] . esc_html( $this->feed->title ) . $m[6]; + + case 'maps-link': + $new_window = ( $newwindow ) ? ' target="_blank"' : ''; + return $m[1] . '' . $this->look_for_shortcodes( $m[5] ) . '' . $m[6]; + + case 'length': + return $m[1] . $this->gce_human_time_diff( $this->start_time, $this->end_time, $precision ) . $m[6]; + + case 'event-num': + return $m[1] . intval( $this->pos ) . $m[6]; + + case 'event-id': + return $m[1] . esc_html( $this->id ) . $m[6]; + + case 'cal-id': + $cal_id = explode( '/', $this->feed->feed_url ); + return $m[1] . esc_html( $cal_id[5] ) . $m[6]; + + case 'if-all-day': + if ( 'SWD' == $this->day_type || 'MWD' == $this->day_type ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-not-all-day': + if ( 'SPD' == $this->day_type || 'MPD' == $this->day_type ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-title': + if ( '' != $this->title ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-description': + if ( '' != $this->description ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-location': + if ( '' != $this->location ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-tooltip': + if ( 'tooltip' == $this->type ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-list': + if ( 'list' == $this->type ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-now': + if ( $this->time_now >= $this->start_time && $this->time_now < $this->end_time ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-not-now': + if ( $this->end_time < $this->time_now || $this->start_time > $this->time_now ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-started': + if ( $this->start_time < $this->time_now ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-not-started': + if ( $this->start_time > $this->time_now ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-ended': + if ( $this->end_time < $this->time_now ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-not-ended': + if ( $this->end_time > $this->time_now ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-first': + if ( 0 == $this->num_in_day ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-not-first': + if ( 0 != $this->num_in_day ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-multi-day': + if ( 'MPD' == $this->day_type || 'MWD' == $this->day_type ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + + case 'if-single-day': + if ( 'SPD' == $this->day_type || 'SWD' == $this->day_type ) + return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6]; + + return ''; + } + } + + //Returns the difference between two times in human-readable format. Based on a patch for human_time_diff posted in the WordPress trac (http://core.trac.wordpress.org/ticket/9272) by Viper007Bond + function gce_human_time_diff( $from, $to = '', $limit = 1 ) { + $units = array( + 31556926 => array( __( '%s year', 'gce' ), __( '%s years', 'gce' ) ), + 2629744 => array( __( '%s month', 'gce' ), __( '%s months', 'gce' ) ), + 604800 => array( __( '%s week', 'gce' ), __( '%s weeks', 'gce' ) ), + 86400 => array( __( '%s day', 'gce' ), __( '%s days', 'gce' ) ), + 3600 => array( __( '%s hour', 'gce' ), __( '%s hours', 'gce' ) ), + 60 => array( __( '%s min', 'gce' ), __( '%s mins', 'gce' ) ), + ); + + if ( empty( $to ) ) + $to = time(); + + $from = (int) $from; + $to = (int) $to; + $diff = (int) abs( $to - $from ); + + $items = 0; + $output = array(); + + foreach ( $units as $unitsec => $unitnames ) { + if ( $items >= $limit ) + break; + + if ( $diff < $unitsec ) + continue; + + $numthisunits = floor( $diff / $unitsec ); + $diff = $diff - ( $numthisunits * $unitsec ); + $items++; + + if ( $numthisunits > 0 ) + $output[] = sprintf( _n( $unitnames[0], $unitnames[1], $numthisunits ), $numthisunits ); + } + + $seperator = _x( ', ', 'human_time_diff' ); + + if ( ! empty( $output ) ) { + return implode( $seperator, $output ); + } else { + $smallest = array_pop( $units ); + return sprintf( $smallest[0], 1 ); + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/includes/class-gce-feed.php b/wp-content/plugins/google-calendar-events/includes/class-gce-feed.php new file mode 100644 index 0000000..50db4a4 --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/class-gce-feed.php @@ -0,0 +1,273 @@ +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +class GCE_Feed { + + public $id, + $feed_url, + $start, + $end, + $max, + $date_format, + $time_format, + $timezone_offset, + $cache, + $multiple_day_events, + $display_url, + $search_query, + $expand_recurring, + $title; + + public $events = array(); + + /** + * Class constructor + * + * @since 2.0.0 + */ + public function __construct( $id ) { + // Set the ID + $this->id = $id; + + // Set up all other data based on the ID + $this->setup_attributes(); + + // Now create the Feed + $this->create_feed(); + + if( $this->cache > 0 ) { + $this->cache_events(); + } + } + + /** + * Set the transient to cache the events + * + * @since 2.0.0 + */ + private function cache_events() { + set_transient( 'gce_feed_' . $this->id, $this->events, $this->cache ); + } + + /** + * Set all of the feed attributes from the post meta options + * + * @since 2.0.0 + */ + private function setup_attributes() { + $date_format = get_post_meta( $this->id, 'gce_date_format', true ); + $time_format = get_post_meta( $this->id, 'gce_time_format', true ); + + $this->feed_url = get_post_meta( $this->id, 'gce_feed_url', true ); + $this->start = $this->set_feed_length( get_post_meta( $this->id, 'gce_retrieve_from', true ), 'start' ); + $this->end = $this->set_feed_length( get_post_meta( $this->id, 'gce_retrieve_until', true ), 'end' ); + $this->max = get_post_meta( $this->id, 'gce_retrieve_max', true ); + $this->date_format = ( ! empty( $date_format ) ? $date_format : get_option( 'date_format' ) ); + $this->time_format = ( ! empty( $time_format ) ? $time_format : get_option( 'time_format' ) ); + $this->timezone_offset = get_post_meta( $this->id, 'gce_timezone_offset', true ); + $this->cache = get_post_meta( $this->id, 'gce_cache', true ); + $this->multiple_day_events = get_post_meta( $this->id, 'gce_multi_day_events', true ); + $this->search_query = get_post_meta( $this->id, 'gce_search_query', true ); + $this->expand_recurring = get_post_meta( $this->id, 'gce_expand_recurring', true ); + $this->title = get_the_title( $this->id ); + } + + /** + * Create the feed URL + * + * @since 2.0.0 + */ + private function create_feed() { + //Break the feed URL up into its parts (scheme, host, path, query) + + if( empty( $this->feed_url ) ) { + if( current_user_can( 'manage_options' ) ) { + echo '

' . __( 'The feed URL has not been set. Please make sure to set it correctly in the Feed settings.', 'gce' ) . '

'; + } + + return; + } + + $url_parts = parse_url( $this->feed_url ); + + $scheme = ( is_ssl() ? 'https://' : 'http://' ); + + $scheme_and_host = $scheme . $url_parts['host']; + + //Remove the exisitng projection from the path, and replace it with '/full-noattendees' + $path = substr( $url_parts['path'], 0, strrpos( $url_parts['path'], '/' ) ) . '/full-noattendees'; + + //Add the default parameters to the querystring (retrieving JSON, not XML) + $query = '?alt=json&singleevents=true&sortorder=ascending&orderby=starttime'; + + $gmt_offset = $this->timezone_offset * 3600; + + //Append the feed specific parameters to the querystring + $query .= '&start-min=' . date( 'Y-m-d\TH:i:s', $this->start - $gmt_offset ); + $query .= '&start-max=' . date( 'Y-m-d\TH:i:s', $this->end - $gmt_offset ); + $query .= '&max-results=' . $this->max; + + // Set the timezone offset + if ( ! empty( $this->timezone_offset ) && $this->timezone_offset != 'default' ) { + $query .= '&ctz=' . $this->timezone_offset; + } + + if ( ! empty( $this->search_query ) ) { + $query .= '&q=' . rawurlencode( $this->search_query ); + } + + if ( $this->expand_recurring ) { + $query .= '&singleevents=true'; + } + + //Put the URL back together + $this->display_url = $scheme_and_host . $path . $query; + + // Get all the feed data + $this->get_feed_data( $this->display_url ); + } + + /** + * Make remote call to get the feed data + * + * @since 2.0.0 + */ + private function get_feed_data( $url ) { + $raw_data = wp_remote_get( $url, array( + 'sslverify' => false, //sslverify is set to false to ensure https URLs work reliably. Data source is Google's servers, so is trustworthy + 'timeout' => 10 //Increase timeout from the default 5 seconds to ensure even large feeds are retrieved successfully + ) ); + + // First check for transient data to use + if( false !== get_transient( 'gce_feed_' . $this->id ) ) { + $this->events = get_transient( 'gce_feed_' . $this->id ); + } else { + //If $raw_data is a WP_Error, something went wrong + if ( ! is_wp_error( $raw_data ) ) { + //If response code isn't 200, something went wrong + if ( 200 == $raw_data['response']['code'] ) { + //Attempt to convert the returned JSON into an array + $raw_data = json_decode( $raw_data['body'], true ); + + //If decoding was successful + if ( ! empty( $raw_data ) ) { + //If there are some entries (events) to process + if ( isset( $raw_data['feed']['entry'] ) ) { + //Loop through each event, extracting the relevant information + foreach ( $raw_data['feed']['entry'] as $event ) { + $id = ( isset( $event['gCal$uid']['value'] ) ? esc_html( substr( $event['gCal$uid']['value'], 0, strpos( $event['gCal$uid']['value'], '@' ) ) ) : '' ); + $title = ( isset( $event['title']['$t'] ) ? esc_html( $event['title']['$t'] ) : '' ); + $description = ( isset( $event['content']['$t'] ) ? esc_html( $event['content']['$t'] ) : '' ); + $link = ( isset( $event['link'][0]['href'] ) ? esc_url( $event['link'][0]['href'] ) : '' ); + $location = ( isset( $event['gd$where'][0]['valueString'] ) ? esc_html( $event['gd$where'][0]['valueString'] ) : '' ); + $start_time = ( isset( $event['gd$when'][0]['startTime'] ) ? $this->iso_to_ts( $event['gd$when'][0]['startTime'] ) : '' ); + $end_time = ( isset( $event['gd$when'][0]['endTime'] ) ? $this->iso_to_ts( $event['gd$when'][0]['endTime'] ) : '' ); + + //Create a GCE_Event using the above data. Add it to the array of events + $this->events[] = new GCE_Event( $this, $id, $title, $description, $location, $start_time, $end_time, $link ); + } + } + } else { + //json_decode failed + $this->error = __( 'Some data was retrieved, but could not be parsed successfully. Please ensure your feed URL is correct.', 'gce' ); + } + } else { + //The response code wasn't 200, so generate a helpful(ish) error message depending on error code + switch ( $raw_data['response']['code'] ) { + case 404: + $this->error = __( 'The feed could not be found (404). Please ensure your feed URL is correct.', 'gce' ); + break; + case 403: + $this->error = __( 'Access to this feed was denied (403). Please ensure you have public sharing enabled for your calendar.', 'gce' ); + break; + default: + $this->error = sprintf( __( 'The feed data could not be retrieved. Error code: %s. Please ensure your feed URL is correct.', 'gce' ), $raw_data['response']['code'] ); + } + } + }else{ + //Generate an error message from the returned WP_Error + $this->error = $raw_data->get_error_message() . __( ' Please ensure your feed URL is correct.', 'gce' ); + } + } + + if( ! empty( $this->error ) ) { + if( current_user_can( 'manage_options' ) ) { + echo $this->error; + return; + } + } + } + + /** + * Convert an ISO date/time to a UNIX timestamp + * + * @since 2.0.0 + */ + private function iso_to_ts( $iso ) { + sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second ); + return mktime( $hour, $minute, $second, $month, $day, $year ); + } + + /** + * Return feed start/end + * + * @since 2.0.0 + */ + private function set_feed_length( $value, $type ) { + // All times start at 00:00 + switch ( $value ) { + case 'today': + $return = mktime( 0, 0, 0, date( 'm' ), date( 'j' ), date( 'Y' ) ); + break; + case 'start_week': + $return = mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) ), date( 'Y' ) ); + break; + case 'start_month': + $return = mktime( 0, 0, 0, date( 'm' ), 1, date( 'Y' ) ); + break; + case 'end_month': + $return = mktime( 0, 0, 0, date( 'm' ) + 1, 1, date( 'Y' ) ); + break; + case 'custom_date': + if( $type == 'start' ) { + $date = get_post_meta( $this->id, 'gce_custom_from', true ); + $fallback = mktime( 0, 0, 0, date( 'm' ), 1, date( 'Y' ) ); + } else { + $date = get_post_meta( $this->id, 'gce_custom_until', true ); + $fallback = mktime( 0, 0, 0, date( 'm' ) + 1, 1, date( 'Y' ) ); + } + + if( ! empty( $date ) ) { + $date = explode( '/', $date ); + $return = mktime( 0, 0, 0, $date[0], $date[1], $date[2] ); + } else { + $return = $fallback; + } + break; + default: + if( $type == 'start' ) { + $return = 0; //any - 1970-01-01 00:00 + } else { + // Set default end time + $return = 2145916800; + } + } + + return $return; + } + + function get_builder() { + + $this->builder = get_post( $this->id )->post_content; + + return $this->builder; + } +} diff --git a/wp-content/plugins/google-calendar-events/includes/gce-feed-cpt.php b/wp-content/plugins/google-calendar-events/includes/gce-feed-cpt.php new file mode 100644 index 0000000..f3917dc --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/gce-feed-cpt.php @@ -0,0 +1,289 @@ +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + + +/** + * Register Google Calendar Events custom post type + * + * @since 2.0.0 + */ +function gce_setup_cpt() { + + $labels = array( + 'name' => __( 'Google Calendar Feeds', 'gce' ), + 'singular_name' => __( 'Feed', 'gce' ), + 'menu_name' => __( 'GCal Events', 'gce' ), + 'name_admin_bar' => __( 'Feed', 'gce' ), + 'add_new' => __( 'Add New', 'gce' ), + 'add_new_item' => __( 'Add New Feed', 'gce' ), + 'new_item' => __( 'New Feed', 'gce' ), + 'edit_item' => __( 'Edit Feed', 'gce' ), + 'view_item' => __( 'View Feed', 'gce' ), + 'all_items' => __( 'All GCal Feeds', 'gce' ), + 'search_items' => __( 'Search GCal Feeds', 'gce' ), + 'not_found' => __( 'No feeds found.', 'gce' ), + 'not_found_in_trash' => __( 'No feeds found in Trash.', 'gce' ) + ); + + $args = array( + 'labels' => $labels, + 'public' => true, // This removes the 'view' and 'preview' links from what I can tell + 'publicly_queryable' => true, + 'show_ui' => true, + 'show_in_menu' => true, + 'query_var' => true, + 'capability_type' => 'post', + 'has_archive' => false, + 'hierarchical' => false, + 'menu_icon' => plugins_url( '/assets/gcal-icon-16x16.png', GCE_MAIN_FILE ), + 'supports' => array( 'title', 'editor' ) + ); + + register_post_type( 'gce_feed', $args ); + + // MUST ONLY RUN ONCE! + if( false === get_option( 'gce_cpt_setup' ) ) { + flush_rewrite_rules(); + update_option( 'gce_cpt_setup', 1 ); + } + +} +add_action( 'init', 'gce_setup_cpt' ); + +/** + * Messages for Feed actions + * + * @since 2.0.0 + */ +function gce_feed_messages( $messages ) { + global $post, $post_ID; + + $url1 = ''; + $url2 = 'feed'; + $url3 = ''; + $s1 = 'Feed'; + + $messages['gce_feed'] = array( + 1 => sprintf( __( '%4$s updated. %1$sView %2$s%3$s', 'gce' ), $url1, $url2, $url3, $s1 ), + 4 => sprintf( __( '%4$s updated. %1$sView %2$s%3$s', 'gce' ), $url1, $url2, $url3, $s1 ), + 6 => sprintf( __( '%4$s published. %1$sView %2$s%3$s', 'gce' ), $url1, $url2, $url3, $s1 ), + 7 => sprintf( __( '%4$s saved. %1$sView %2$s%3$s', 'gce' ), $url1, $url2, $url3, $s1 ), + 8 => sprintf( __( '%4$s submitted. %1$sView %2$s%3$s', 'gce' ), $url1, $url2, $url3, $s1 ), + 10 => sprintf( __( '%4$s draft updated. %1$sView %2$s%3$s', 'gce' ), $url1, $url2, $url3, $s1 ) + ); + + return $messages; +} +add_filter( 'post_updated_messages', 'gce_feed_messages' ); + + +/** + * Add post meta to tie in with the Google Calendar Events custom post type + * + * @since 2.0.0 + */ +function gce_cpt_meta() { + add_meta_box( 'gce_feed_meta', 'Feed Settings', 'gce_display_meta', 'gce_feed', 'advanced', 'core' ); + + // Sidebar meta box below publish section. + add_meta_box( 'gce_feed_sidebar_help', 'Helpful Links', 'gce_feed_sidebar_help', 'gce_feed', 'side', 'core' ); + + add_meta_box( 'gce_display_options_meta', 'Display Options', 'gce_display_options_meta', 'gce_feed', 'side', 'core' ); +} +add_action( 'add_meta_boxes', 'gce_cpt_meta' ); + +/** + * Function called to display post meta + * + * @since 2.0.0 + */ +function gce_display_meta() { + include_once( GCE_DIR . '/views/admin/gce-feed-meta-display.php' ); +} + +/** + * Function called to display help in sidebar. + * + * @since 2.0.0 + */ +function gce_feed_sidebar_help() { + include_once( GCE_DIR . '/views/admin/gce-feed-sidebar-help.php' ); +} + +/** + * Function called to display post meta + * + * @since 2.0.0 + */ +function gce_display_options_meta() { + include_once( GCE_DIR . '/views/admin/display-options-meta.php' ); +} + +/** + * Function to save post meta for the feed CPT + * + * @since 2.0.0 + */ +function gce_save_meta( $post_id ) { + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { + return $post_id; + } + + // An array to hold all of our post meta ids so we can run them through a loop + $post_meta_fields = array( + 'gce_feed_url', + 'gce_retrieve_from', + 'gce_retrieve_until', + 'gce_retrieve_max', + 'gce_date_format', + 'gce_time_format', + 'gce_timezone_offset', + 'gce_cache', + 'gce_multi_day_events', + 'gce_display_mode', + 'gce_custom_from', + 'gce_custom_until', + 'gce_search_query', + 'gce_expand_recurring', + // Display options + 'gce_display_start', + 'gce_display_start_text', + 'gce_display_end', + 'gce_display_end_text', + 'gce_display_separator', + 'gce_display_location', + 'gce_display_location_text', + 'gce_display_description', + 'gce_display_description_text', + 'gce_display_description_max', + 'gce_display_link', + 'gce_display_link_tab', + 'gce_display_link_text', + 'gce_display_simple' + ); + + $post_meta_fields = apply_filters( 'gce_feed_meta', $post_meta_fields ); + + if ( current_user_can( 'edit_post', $post_id ) ) { + // Loop through our array and make sure it is posted and not empty in order to update it, otherwise we delete it + foreach ( $post_meta_fields as $pmf ) { + if ( isset( $_POST[$pmf] ) && ! empty( $_POST[$pmf] ) ) { + if( $pmf == 'gce_feed_url' ) { + update_post_meta( $post_id, $pmf, esc_url( $_POST[$pmf] ) ); + } else { + update_post_meta( $post_id, $pmf, stripslashes( $_POST[$pmf] ) ); + } + } else { + // We want max to be set to 25 by default if nothing is entered + if( $pmf == 'gce_retrieve_max' ) { + update_post_meta( $post_id, $pmf, 25 ); + } else { + delete_post_meta( $post_id, $pmf ); + } + } + } + } + + return $post_id; +} +add_action( 'save_post', 'gce_save_meta' ); + + +/** + * Add column headers to our "All Feeds" CPT page + * + * @since 2.0.0 + */ +function gce_add_column_headers( $defaults ) { + + $new_columns = array( + 'cb' => $defaults['cb'], + 'feed-id' => 'Feed ID', + 'feed-sc' => 'Feed Shortcode', + 'max-events' => 'Max Events', + 'display-type' => 'Display Type' + ); + + return array_merge( $defaults, $new_columns ); +} +add_filter( 'manage_gce_feed_posts_columns', 'gce_add_column_headers' ); + + +/** + * Fill out the columns + * + * @since 2.0.0 + */ +function gce_column_content( $column_name, $post_ID ) { + + switch ( $column_name ) { + + case 'feed-id': + echo $post_ID; + break; + case 'feed-sc': + echo '[gcal id="' . $post_ID . '"]'; + break; + case 'max-events': + $max = get_post_meta( $post_ID, 'gce_retrieve_max', true ); + echo $max; + break; + case 'display-type': + $display = get_post_meta( $post_ID, 'gce_display_mode', true ); + + if( $display == 'grid' ) { + echo 'Grid'; + } else if( $display == 'list' ) { + echo 'List'; + } else { + echo 'Grouped List'; + } + break; + } +} +add_action( 'manage_gce_feed_posts_custom_column', 'gce_column_content', 10, 2 ); + +/** + * Add the "Clear Cache" action to the CPT action links + * + * @since 2.0.0 + */ +function gce_cpt_actions( $actions, $post ) { + if( $post->post_type == 'gce_feed' ) { + $actions['clear_cache'] = 'Clear Cache'; + } + + return $actions; +} +add_filter( 'post_row_actions', 'gce_cpt_actions', 10, 2 ); + + +/** + * Function to clear cache if on the post listing page + * + * @since 2.0.0 + */ +function gce_clear_cache_link() { + if( isset( $_REQUEST['clear_cache'] ) ) { + $post_id = absint( $_REQUEST['clear_cache'] ); + + gce_clear_cache( $post_id ); + + settings_errors( 'gce-notices' ); + } +} +add_action( 'admin_init', 'gce_clear_cache_link' ); + + +function gce_clear_cache_on_save( $post_id ) { + delete_transient( 'gce_feed_' . $post_id ); +} +add_action( 'save_post_gce_feed', 'gce_clear_cache_on_save' ); diff --git a/wp-content/plugins/google-calendar-events/includes/misc-functions.php b/wp-content/plugins/google-calendar-events/includes/misc-functions.php new file mode 100644 index 0000000..ee5dbd1 --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/misc-functions.php @@ -0,0 +1,117 @@ + '', + 'max_events' => 25, + 'sort' => 'asc', + 'grouped' => 0, + 'month' => null, + 'year' => null, + 'widget' => 0 + ); + + $args = array_merge( $defaults, $args ); + + extract( $args ); + + $ids = explode( '-', $feed_ids ); + + //Create new display object, passing array of feed id(s) + $d = new GCE_Display( $ids, $title_text, $max_events, $sort ); + $markup = ''; + + if( 'grid' == $display ) { + + $markup = ''; + + if( $widget == 1 ) { + $markup .= '
'; + } else { + $markup .= '
'; + } + + $markup .= $d->get_grid( $year, $month, $widget ); + $markup .= '
'; + + } else if( 'list' == $display || 'list-grouped' == $display ) { + $markup = '
' . $d->get_list( $grouped ) . '
'; + } + + return $markup; +} + +/** +* AJAX function for grid pagination +* +* @since 2.0.0 +*/ +function gce_ajax() { + if ( isset( $_GET['gce_feed_ids'] ) ) { + $ids = $_GET['gce_feed_ids']; + $title = $_GET['gce_title_text']; + $max = $_GET['gce_max_events']; + $month = $_GET['gce_month']; + $year = $_GET['gce_year']; + + $title = ( 'null' == $title ) ? null : $title; + + $args = array( + 'title_text' => $title, + 'max_events' => $max, + 'month' => $month, + 'year' => $year, + ); + + if ( 'page' == $_GET['gce_type'] ) { + echo gce_print_calendar( $ids, 'grid', $args ); + } elseif ( 'widget' == $_GET['gce_type'] ) { + $args['widget'] = 1; + echo gce_print_calendar( $ids, 'grid', $args ); + } + } + die(); +} +add_action( 'wp_ajax_nopriv_gce_ajax', 'gce_ajax' ); +add_action( 'wp_ajax_gce_ajax', 'gce_ajax' ); + +function gce_feed_content( $content ) { + global $post; + + if( $post->post_type == 'gce_feed' ) { + $content = '[gcal id="' . $post->ID . '"]'; + } + + return $content; +} +add_filter( 'the_content', 'gce_feed_content' ); + +/** + * Google Analytics campaign URL. + * + * @since 2.0.0 + * + * @param string $base_url Plain URL to navigate to + * @param string $source GA "source" tracking value + * @param string $medium GA "medium" tracking value + * @param string $campaign GA "campaign" tracking value + * @return string $url Full Google Analytics campaign URL + */ +function gce_ga_campaign_url( $base_url, $source, $medium, $campaign ) { + // $medium examples: 'sidebar_link', 'banner_image' + + $url = add_query_arg( array( + 'utm_source' => $source, + 'utm_medium' => $medium, + 'utm_campaign' => $campaign + ), $base_url ); + + return $url; +} diff --git a/wp-content/plugins/google-calendar-events/inc/php-calendar.php b/wp-content/plugins/google-calendar-events/includes/php-calendar.php similarity index 82% rename from wp-content/plugins/google-calendar-events/inc/php-calendar.php rename to wp-content/plugins/google-calendar-events/includes/php-calendar.php index 87fc946..16f1ee1 100644 --- a/wp-content/plugins/google-calendar-events/inc/php-calendar.php +++ b/wp-content/plugins/google-calendar-events/includes/php-calendar.php @@ -1,83 +1,94 @@ -get_weekday_initial( date_i18n( 'l', $t, true ) ); - } - - list( $month, $year, $month_name, $weekday ) = explode( ',', date_i18n( 'm, Y, F, w', $first_of_month ) ); - $weekday = ( $weekday + 7 - $first_day ) % 7; #adjust for $first_day - $title = esc_html( $month_name ) . ' ' . $year; #note that some locales don't capitalize month and day names - - #Begin calendar. Uses a real . See http://diveintomark.org/archives/2002/07/03 - list( $p, $pl ) = each( $pn ); - list( $n, $nl ) = each( $pn ); #previous and next links, if applicable - - if ( $p ) - $p = '' . ( ( $pl ) ? ( '' . $p . '' ) : $p ) . ' '; - if ( $n ) - $n = ' ' . ( ( $nl ) ? ( '' . $n . '' ) : $n ) . ''; - - $calendar = '' . "\n" . '\n"; - - if ( $day_name_length ) { #if the day names should be shown ($day_name_length > 0) - #if day_name_length is >3, the full name of the day will be printed - foreach ( $day_names as $d ) { - $calendar .= ''; - } - - $calendar .= "\n"; - } - - $time_now = current_time( 'timestamp' ); - $today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); - - if ( $weekday > 0 ) $calendar .= ''; #initial 'empty' days - for ( $day = 1, $days_in_month = date( 't', $first_of_month ); $day <= $days_in_month; $day++, $weekday++ ) { - if ( 7 == $weekday ) { - $weekday = 0; #start a new week - $calendar .= "\n"; - } - - $timestamp = mktime( 0, 0, 0, $month, $day, $year ); - - if ( isset( $days[$timestamp] ) && is_array( $days[$timestamp] ) ) { - list( $link, $classes, $content ) = $days[$timestamp]; - $calendar .= '' ) : '>' ) . ( ( $link ) ? ( '' . $day . '' . $content ) : '' . $day . '' . $content ) . ''; - }else{ - $css_class = ( $timestamp < $time_now ) ? 'gce-day-past' : 'gce-day-future'; - $calendar .= ''; - } - } - - if ( 7 != $weekday ) $calendar .= ''; #remaining "empty" days - - return $calendar . "\n
' . $p . '' . ( ( $month_href ) ? ( '' . $title . '' ) : $title ) . '' . $n . "
' . esc_html( $d['initial'] ) . '
 
' . $day . ' 
\n"; -} +get_weekday_initial( date_i18n( 'l', $t, true ) ); + } + + list( $month, $year, $month_name, $weekday ) = explode( ',', date_i18n( 'm, Y, F, w', $first_of_month ) ); + $weekday = ( $weekday + 7 - $first_day ) % 7; #adjust for $first_day + $title = esc_html( $month_name ) . ' ' . $year; #note that some locales don't capitalize month and day names + + #Begin calendar. Uses a real . See http://diveintomark.org/archives/2002/07/03 + list( $p, $pl ) = each( $pn ); + list( $n, $nl ) = each( $pn ); #previous and next links, if applicable + + if ( $p ) { + if( $widget ) { + $p = '' . ( ( $pl ) ? ( '' . $p . '' ) : $p ) . ' '; + } else { + $p = '' . ( ( $pl ) ? ( '' . $p . ' Back' ) : $p ) . ' '; + } + } + + if ( $n ) { + if( $widget ) { + $n = ' ' . ( ( $nl ) ? ( '' . $n . '' ) : $n ) . ''; + } else { + $n = ' ' . ( ( $nl ) ? ( 'Next ' . $n . '' ) : $n ) . ''; + } + } + + $calendar = '' . "\n" . '\n"; + + if ( $day_name_length ) { #if the day names should be shown ($day_name_length > 0) + #if day_name_length is >3, the full name of the day will be printed + foreach ( $day_names as $d ) { + $calendar .= ''; + } + + $calendar .= "\n"; + } + + $time_now = current_time( 'timestamp' ); + $today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); + + if ( $weekday > 0 ) $calendar .= ''; #initial 'empty' days + for ( $day = 1, $days_in_month = date( 't', $first_of_month ); $day <= $days_in_month; $day++, $weekday++ ) { + if ( 7 == $weekday ) { + $weekday = 0; #start a new week + $calendar .= "\n"; + } + + $timestamp = mktime( 0, 0, 0, $month, $day, $year ); + + if ( isset( $days[$timestamp] ) && is_array( $days[$timestamp] ) ) { + list( $link, $classes, $content ) = $days[$timestamp]; + $calendar .= '' ) : '>' ) . ( ( $link ) ? ( '' . $day . '' . $content ) : '' . $day . '' . $content ) . ''; + }else{ + $css_class = ( $timestamp < $time_now ) ? 'gce-day-past' : 'gce-day-future'; + $calendar .= ''; + } + } + + if ( 7 != $weekday ) $calendar .= ''; #remaining "empty" days + + return $calendar . "\n
' . $p . '' . ( ( $month_href ) ? ( '' . $title . '' ) : $title ) . '' . $n . "
' . esc_html( $d['initial'] ) . '
 
' . $day . ' 
\n"; +} ?> \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/includes/register-settings.php b/wp-content/plugins/google-calendar-events/includes/register-settings.php new file mode 100644 index 0000000..1b9732b --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/register-settings.php @@ -0,0 +1,157 @@ +, Nick Young + */ + +// Exit if accessed directly. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Main function to register all of the plugin settings + * + * @since 2.0.0 + */ +function gce_register_settings() { + + $gce_settings = array( + + /* General Settings */ + 'general' => array( + 'save_settings' => array( + 'id' => 'save_settings', + 'name' => __( 'Save Settings', 'gce' ), + 'desc' => __( 'Save your settings when uninstalling this plugin. Useful when upgrading or re-installing.', 'gce' ), + 'type' => 'checkbox' + ) + ) + ); + + /* If the options do not exist then create them for each section */ + if ( false == get_option( 'gce_settings_general' ) ) { + add_option( 'gce_settings_general' ); + } + + /* Add the General Settings section */ + add_settings_section( + 'gce_settings_general', + __( 'General Settings', 'gce' ), + '__return_false', + 'gce_settings_general' + ); + + foreach ( $gce_settings['general'] as $option ) { + add_settings_field( + 'gce_settings_general[' . $option['id'] . ']', + $option['name'], + function_exists( 'gce_' . $option['type'] . '_callback' ) ? 'gce_' . $option['type'] . '_callback' : 'gce_missing_callback', + 'gce_settings_general', + 'gce_settings_general', + gce_get_settings_field_args( $option, 'general' ) + ); + } + + /* Register all settings or we will get an error when trying to save */ + register_setting( 'gce_settings_general', 'gce_settings_general', 'gce_settings_sanitize' ); + +} +add_action( 'admin_init', 'gce_register_settings' ); + +/* + * Return generic add_settings_field $args parameter array. + * + * @since 2.0.0 + * + * @param string $option Single settings option key. + * @param string $section Section of settings apge. + * @return array $args parameter to use with add_settings_field call. + */ +function gce_get_settings_field_args( $option, $section ) { + $settings_args = array( + 'id' => $option['id'], + 'desc' => $option['desc'], + 'name' => $option['name'], + 'section' => $section, + 'size' => isset( $option['size'] ) ? $option['size'] : null, + 'options' => isset( $option['options'] ) ? $option['options'] : '', + 'std' => isset( $option['std'] ) ? $option['std'] : '' + ); + + // Link label to input using 'label_for' argument if text, textarea, password, select, or variations of. + // Just add to existing settings args array if needed. + if ( in_array( $option['type'], array( 'text', 'select', 'textarea', 'password', 'number' ) ) ) { + $settings_args = array_merge( $settings_args, array( 'label_for' => 'gce_settings_' . $section . '[' . $option['id'] . ']' ) ); + } + + return $settings_args; +} + +/* + * Single checkbox callback function + * + * @since 2.0.0 + * + */ +function gce_checkbox_callback( $args ) { + global $gce_options; + + $checked = isset( $gce_options[$args['id']] ) ? checked( 1, $gce_options[$args['id']], false ) : ''; + $html = "\n" . '' . "\n"; + + // Render description text directly to the right in a label if it exists. + if ( ! empty( $args['desc'] ) ) + $html .= '' . "\n"; + + echo $html; +} + +/* + * Function we can use to sanitize the input data and return it when saving options + * + * @since 2.0.0 + * + */ +function gce_settings_sanitize( $input ) { + //add_settings_error( 'gce-notices', '', '', '' ); + return $input; +} + +/* + * Default callback function if correct one does not exist + * + * @since 2.0.0 + * + */ +function gce_missing_callback( $args ) { + printf( __( 'The callback function used for the %s setting is missing.', 'gce' ), $args['id'] ); +} + +/* + * Function used to return an array of all of the plugin settings + * + * @since 2.0.0 + * + */ +function gce_get_settings() { + + // Set default settings + // If this is the first time running we need to set the defaults + if ( ! get_option( 'gce_upgrade_has_run' ) ) { + + $general = get_option( 'gce_settings_general' ); + + $general['save_settings'] = 1; + + update_option( 'gce_settings_general', $general ); + } + + $general_settings = is_array( get_option( 'gce_settings_general' ) ) ? get_option( 'gce_settings_general' ) : array(); + + return $general_settings; +} \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/includes/shortcodes.php b/wp-content/plugins/google-calendar-events/includes/shortcodes.php new file mode 100644 index 0000000..e43ee8a --- /dev/null +++ b/wp-content/plugins/google-calendar-events/includes/shortcodes.php @@ -0,0 +1,79 @@ +, Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + + +/** + * Adds support for the new [gcal] shortcode + * + * Supports the old [google-calendar-events] shortcode + * + * @since 2.0.0 + */ +function gce_gcal_shortcode( $attr ) { + + extract( shortcode_atts( array( + 'id' => null, + 'display' => '', + 'max' => 0, + 'order' => 'asc', + 'title' => null, + 'type' => null, + ), $attr, 'gce_feed' ) ); + + // If no ID is specified then return + if( empty( $id ) ) { + return; + } + + $feed_ids = explode( ',', $id ); + + foreach( $feed_ids as $k => $v ) { + // Check for an old ID attached to this feed ID first + $q = new WP_Query( "post_type=gce_feed&meta_key=old_gce_id&meta_value=$v&order=ASC" ); + + if( $q->have_posts() ) { + $q->the_post(); + // Set our ID to the old ID if found + $feed_ids[$k] = get_the_ID(); + $v = get_the_ID(); + } + + if( empty( $display ) ) { + $display = get_post_meta( $v, 'gce_display_mode', true ); + } + } + + // Port over old options + if( $type != null ) { + if( 'ajax' == $type ) { + $display = 'grid'; + } else { + $display = $type; + } + } + + $args = array( + 'title_text' => $title, + 'max_events' => $max, + 'sort' => $order, + 'grouped' => ( $display == 'list-grouped' ? 1 : 0 ), + 'month' => null, + 'year' => null, + 'widget' => 0 + ); + + $feed_ids = implode( '-', $feed_ids ); + + return gce_print_calendar( $feed_ids, $display, $args ); + +} +add_shortcode( 'gcal', 'gce_gcal_shortcode' ); +add_shortcode( 'google-calendar-events', 'gce_gcal_shortcode' ); diff --git a/wp-content/plugins/google-calendar-events/js/admin.js b/wp-content/plugins/google-calendar-events/js/admin.js new file mode 100644 index 0000000..1dc7676 --- /dev/null +++ b/wp-content/plugins/google-calendar-events/js/admin.js @@ -0,0 +1,41 @@ +/** + * Admin JavaScript functions + * + * @package GCE + * @author Phil Derksen , Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +(function ($) { + "use strict"; + $(function () { + + // Show the hidden text box if custom date is selected (Retrieve From) + $('#gce_retrieve_from').on('change', function() { + + if( $(this).val() == 'custom_date' ) { + $('#gce_custom_from').show(); + } else { + $('#gce_custom_from').hide(); + } + }); + + // Show the hidden text box if custom date is selected (Retrieve Until) + $('#gce_retrieve_until').on('change', function() { + + if( $(this).val() == 'custom_date' ) { + $('#gce_custom_until').show(); + } else { + $('#gce_custom_until').hide(); + } + }); + + // Add jQuery date picker to our 2 custom date fields + $('#gce_custom_from').datepicker(); + $('#gce_custom_until').datepicker(); + + }); +}(jQuery)); + + diff --git a/wp-content/plugins/google-calendar-events/js/gce-admin-script.js b/wp-content/plugins/google-calendar-events/js/gce-admin-script.js deleted file mode 100644 index 94ecd1d..0000000 --- a/wp-content/plugins/google-calendar-events/js/gce-admin-script.js +++ /dev/null @@ -1,29 +0,0 @@ -function correct_options(){ - val = jQuery('select[name="gce_options[use_builder]"]').val(); - - if(val == 'true'){ - jQuery('.gce-simple-display-options').next('.form-table').hide(); - jQuery('.gce-simple-display-options').hide(); - jQuery('.gce-simple-display-options').prev('h3').hide(); - - jQuery('.gce-event-builder').next('.form-table').show(); - jQuery('.gce-event-builder').show(); - jQuery('.gce-event-builder').prev('h3').show(); - }else{ - jQuery('.gce-simple-display-options').next('.form-table').show(); - jQuery('.gce-simple-display-options').show(); - jQuery('.gce-simple-display-options').prev('h3').show(); - - jQuery('.gce-event-builder').next('.form-table').hide(); - jQuery('.gce-event-builder').hide(); - jQuery('.gce-event-builder').prev('h3').hide(); - } -} - -jQuery(document).ready(function(){ - correct_options(); - - jQuery('select[name="gce_options[use_builder]"]').change(function(e){ - correct_options(); - }); -}); \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/js/gce-script.js b/wp-content/plugins/google-calendar-events/js/gce-script.js index 5f5ae87..f8453dd 100644 --- a/wp-content/plugins/google-calendar-events/js/gce-script.js +++ b/wp-content/plugins/google-calendar-events/js/gce-script.js @@ -1,45 +1,58 @@ -function gce_ajaxify(target, feed_ids, max_events, title_text, type){ - //Add click event to change month links - jQuery('#' + target + ' .gce-change-month').click(function(){ - //Extract month and year - var month_year = jQuery(this).attr('name').split('-', 2); - //Add loading text to table caption - jQuery('#' + target + ' caption').html(GoogleCalendarEvents.loading); - //Send AJAX request - jQuery.get(GoogleCalendarEvents.ajaxurl,{ - action:'gce_ajax', - gce_type:type, - gce_feed_ids:feed_ids, - gce_title_text:title_text, - gce_widget_id:target, - gce_max_events:max_events, - gce_month:month_year[0], - gce_year:month_year[1] - }, function(data){ - //Replace existing data with returned AJAX data - if(type == 'widget'){ - jQuery('#' + target).html(data); - }else{ - jQuery('#' + target).replaceWith(data); - } - gce_tooltips('#' + target + ' .gce-has-events'); - }); - }); -} - -function gce_tooltips(target_items){ - jQuery(target_items).each(function(){ - //Add qtip to all target items - jQuery(this).qtip({ - content: jQuery(this).children('.gce-event-info'), - position: { corner: { target: 'center', tooltip: 'bottomLeft' }, adjust: { screen: true } }, - hide: { fixed: true, delay: 100, effect: { length: 0 } }, - show: { solo: true, delay: 0, effect: { length: 0 } }, - style: { padding: "0", classes: { tooltip: 'gce-qtip', tip: 'gce-qtip-tip', title: 'gce-qtip-title', content: 'gce-qtip-content', active: 'gce-qtip-active' }, border: { width: 0 } } - }); - }); -} - -jQuery(document).ready(function(){ - gce_tooltips('.gce-has-events'); + +/** + * Public JS functions + * + * @package GCE + * @author Phil Derksen , Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + + +function gce_ajaxify(target, feed_ids, max_events, title_text, type){ + + //Add click event to change month links + jQuery('#' + target + ' .gce-change-month').click(function(){ + //Extract month and year + var month_year = jQuery(this).attr('name').split('-', 2); + //Add loading text to table caption + jQuery('#' + target + ' caption').html('Loading...'); + //Send AJAX request + jQuery.get(gce.ajaxurl,{ + action:'gce_ajax', + gce_type:type, + gce_feed_ids:feed_ids, + gce_title_text:title_text, + gce_widget_id:target, + gce_max_events:max_events, + gce_month:month_year[0], + gce_year:month_year[1] + }, function(data){ + //Replace existing data with returned AJAX data + if(type == 'widget'){ + jQuery('#' + target).html(data); + }else{ + //console.log( 'Replacing content...' ); + jQuery('#' + target).replaceWith(data); + } + gce_tooltips('#' + target + ' .gce-has-events'); + }); + }); +} + +function gce_tooltips(target_items){ + jQuery(target_items).each(function(){ + //Add qtip to all target items + jQuery(this).qtip({ + content: jQuery(this).children('.gce-event-info'), + position: { corner: { target: 'center', tooltip: 'bottomLeft' }, adjust: { screen: true } }, + hide: { fixed: true, delay: 100, effect: { length: 0 } }, + show: { solo: true, delay: 0, effect: { length: 0 } }, + style: { padding: "0", classes: { tooltip: 'gce-qtip', tip: 'gce-qtip-tip', title: 'gce-qtip-title', content: 'gce-qtip-content', active: 'gce-qtip-active' }, border: { width: 0 } } + }); + }); +} + +jQuery(document).ready(function(){ + gce_tooltips('.gce-has-events'); }); \ No newline at end of file diff --git a/wp-content/plugins/google-calendar-events/js/jquery-qtip.js b/wp-content/plugins/google-calendar-events/js/jquery-qtip.js index 1b9e74a..26a8c77 100644 --- a/wp-content/plugins/google-calendar-events/js/jquery-qtip.js +++ b/wp-content/plugins/google-calendar-events/js/jquery-qtip.js @@ -1,15 +1,15 @@ -/*! - * jquery.qtip. The jQuery tooltip plugin - * - * Copyright (c) 2009 Craig Thompson - * http://craigsworks.com - * - * Licensed under MIT - * http://www.opensource.org/licenses/mit-license.php - * - * Launch : February 2009 - * Version : 1.0.0-rc3 - * Released: Tuesday 12th May, 2009 - 00:00 - * Debug: jquery.qtip.debug.js - */ +/*! + * jquery.qtip. The jQuery tooltip plugin + * + * Copyright (c) 2009 Craig Thompson + * http://craigsworks.com + * + * Licensed under MIT + * http://www.opensource.org/licenses/mit-license.php + * + * Launch : February 2009 + * Version : 1.0.0-rc3 + * Released: Tuesday 12th May, 2009 - 00:00 + * Debug: jquery.qtip.debug.js + */ (function(f){f.fn.qtip=function(B,u){var y,t,A,s,x,w,v,z;if(typeof B=="string"){if(typeof f(this).data("qtip")!=="object"){f.fn.qtip.log.error.call(self,1,f.fn.qtip.constants.NO_TOOLTIP_PRESENT,false)}if(B=="api"){return f(this).data("qtip").interfaces[f(this).data("qtip").current]}else{if(B=="interfaces"){return f(this).data("qtip").interfaces}}}else{if(!B){B={}}if(typeof B.content!=="object"||(B.content.jquery&&B.content.length>0)){B.content={text:B.content}}if(typeof B.content.title!=="object"){B.content.title={text:B.content.title}}if(typeof B.position!=="object"){B.position={corner:B.position}}if(typeof B.position.corner!=="object"){B.position.corner={target:B.position.corner,tooltip:B.position.corner}}if(typeof B.show!=="object"){B.show={when:B.show}}if(typeof B.show.when!=="object"){B.show.when={event:B.show.when}}if(typeof B.show.effect!=="object"){B.show.effect={type:B.show.effect}}if(typeof B.hide!=="object"){B.hide={when:B.hide}}if(typeof B.hide.when!=="object"){B.hide.when={event:B.hide.when}}if(typeof B.hide.effect!=="object"){B.hide.effect={type:B.hide.effect}}if(typeof B.style!=="object"){B.style={name:B.style}}B.style=c(B.style);s=f.extend(true,{},f.fn.qtip.defaults,B);s.style=a.call({options:s},s.style);s.user=f.extend(true,{},B)}return f(this).each(function(){if(typeof B=="string"){w=B.toLowerCase();A=f(this).qtip("interfaces");if(typeof A=="object"){if(u===true&&w=="destroy"){while(A.length>0){A[A.length-1].destroy()}}else{if(u!==true){A=[f(this).qtip("api")]}for(y=0;y0))}if(typeof s.options.show.solo=="object"){z=f(s.options.show.solo)}else{if(s.options.show.solo===true){z=f("div.qtip").not(s.elements.tooltip)}}if(z){z.each(function(){if(f(this).qtip("api").status.rendered===true){f(this).qtip("api").hide()}})}if(typeof s.options.show.effect.type=="function"){s.options.show.effect.type.call(s.elements.tooltip,s.options.show.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.show.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeIn(s.options.show.effect.length,w);break;case"slide":s.elements.tooltip.slideDown(s.options.show.effect.length,function(){w();if(s.options.position.type!=="static"){s.updatePosition(y,true)}});break;case"grow":s.elements.tooltip.show(s.options.show.effect.length,w);break;default:s.elements.tooltip.show(null,w);break}s.elements.tooltip.addClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(y){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"hide")}else{if(s.elements.tooltip.css("display")==="none"){return s}}clearTimeout(s.timers.show);s.elements.tooltip.stop(true,false);x=s.beforeHide.call(s,y);if(x===false){return s}function w(){s.onHide.call(s,y)}s.cache.toggle=0;if(typeof s.options.hide.effect.type=="function"){s.options.hide.effect.type.call(s.elements.tooltip,s.options.hide.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.hide.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeOut(s.options.hide.effect.length,w);break;case"slide":s.elements.tooltip.slideUp(s.options.hide.effect.length,w);break;case"grow":s.elements.tooltip.hide(s.options.hide.effect.length,w);break;default:s.elements.tooltip.hide(null,w);break}s.elements.tooltip.removeClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_HIDDEN,"hide")},updatePosition:function(w,x){var C,G,L,J,H,E,y,I,B,D,K,A,F,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updatePosition")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_POSITION_STATIC,"updatePosition")}}G={position:{left:0,top:0},dimensions:{height:0,width:0},corner:s.options.position.corner.target};L={position:s.getPosition(),dimensions:s.getDimensions(),corner:s.options.position.corner.tooltip};if(s.options.position.target!=="mouse"){if(s.options.position.target.get(0).nodeName.toLowerCase()=="area"){J=s.options.position.target.attr("coords").split(",");for(C=0;CG.dimensions.width){G.dimensions.width=J[C]}if(J[C]G.dimensions.height){G.dimensions.height=J[C]}if(J[C]0){if(L.corner.search(/Left/)!==-1){y.left-=s.options.style.border.radius}else{if(L.corner.search(/Right/)!==-1){y.left+=s.options.style.border.radius}}if(L.corner.search(/Top/)!==-1){y.top-=s.options.style.border.radius}else{if(L.corner.search(/Bottom/)!==-1){y.top+=s.options.style.border.radius}}}if(I){if(L.corner.search(/top/)!==-1){y.top-=I}else{if(L.corner.search(/bottom/)!==-1){y.top+=I}}if(L.corner.search(/left/)!==-1){y.left-=I}else{if(L.corner.search(/right/)!==-1){y.left+=I}}if(L.corner.search(/leftMiddle|rightMiddle/)!==-1){y.top-=1}}if(s.options.position.adjust.screen===true){y=o.call(s,y,G,L)}if(s.options.position.target==="mouse"&&s.options.position.adjust.mouse===true){if(s.options.position.adjust.screen===true&&s.elements.tip){K=s.elements.tip.attr("rel")}else{K=s.options.position.corner.tooltip}y.left+=(K.search(/right/i)!==-1)?-6:6;y.top+=(K.search(/bottom/i)!==-1)?-6:6}if(!s.elements.bgiframe&&f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){f("select, object").each(function(){A=f(this).offset();A.bottom=A.top+f(this).height();A.right=A.left+f(this).width();if(y.top+L.dimensions.height>=A.top&&y.left+L.dimensions.width>=A.left){k.call(s)}})}y.left+=s.options.position.adjust.x;y.top+=s.options.position.adjust.y;F=s.getPosition();if(y.left!=F.left||y.top!=F.top){z=s.beforePositionUpdate.call(s,w);if(z===false){return s}s.cache.position=y;if(x===true){s.status.animated=true;s.elements.tooltip.animate(y,200,"swing",function(){s.status.animated=false})}else{s.elements.tooltip.css(y)}s.onPositionUpdate.call(s,w);if(typeof w!=="undefined"&&w.type&&w.type!=="mousemove"){f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_POSITION_UPDATED,"updatePosition")}}return s},updateWidth:function(w){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateWidth")}else{if(w&&typeof w!=="number"){return f.fn.qtip.log.error.call(s,2,"newWidth must be of type number","updateWidth")}}x=s.elements.contentWrapper.siblings().add(s.elements.tip).add(s.elements.button);if(!w){if(typeof s.options.style.width.value=="number"){w=s.options.style.width.value}else{s.elements.tooltip.css({width:"auto"});x.hide();if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"normal"})}w=s.getDimensions().width+1;if(!s.options.style.width.value){if(w>s.options.style.width.max){w=s.options.style.width.max}if(w").get(0).getContext){z=s.elements.tooltip.find(".qtip-tip canvas:first");x=z.get(0).getContext("2d");x.clearRect(0,0,300,300);y=z.parent("div[rel]:first").attr("rel");B=b(y,s.options.style.tip.size.width,s.options.style.tip.size.height);h.call(s,z,B,s.options.style.tip.color||s.options.style.border.color)}else{if(f.browser.msie){z=s.elements.tooltip.find('.qtip-tip [nodeName="shape"]');z.attr("fillcolor",s.options.style.tip.color||s.options.style.border.color)}}}if(s.options.style.border.radius>0){s.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:s.options.style.border.color});if(f("").get(0).getContext){A=g(s.options.style.border.radius);s.elements.tooltip.find(".qtip-wrapper canvas").each(function(){x=f(this).get(0).getContext("2d");x.clearRect(0,0,300,300);y=f(this).parent("div[rel]:first").attr("rel");r.call(s,f(this),A[y],s.options.style.border.radius,s.options.style.border.color)})}else{if(f.browser.msie){s.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function(){f(this).attr("fillcolor",s.options.style.border.color)})}}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_STYLE_UPDATED,"updateStyle")},updateContent:function(A,y){var z,x,w;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateContent")}else{if(!A){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateContent")}}z=s.beforeContentUpdate.call(s,A);if(typeof z=="string"){A=z}else{if(z===false){return}}if(f.browser.msie){s.elements.contentWrapper.children().css({zoom:"normal"})}if(A.jquery&&A.length>0){A.clone(true).appendTo(s.elements.content).show()}else{s.elements.content.html(A)}x=s.elements.content.find("img[complete=false]");if(x.length>0){w=0;x.each(function(C){f('').load(function(){if(++w==x.length){B()}})})}else{B()}function B(){s.updateWidth();if(y!==false){if(s.options.position.type!=="static"){s.updatePosition(s.elements.tooltip.is(":visible"),true)}if(s.options.style.tip.corner!==false){n.call(s)}}}s.onContentUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_UPDATED,"loadContent")},loadContent:function(w,z,A){var y;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"loadContent")}y=s.beforeContentLoad.call(s);if(y===false){return s}if(A=="post"){f.post(w,z,x)}else{f.get(w,z,x)}function x(B){s.onContentLoad.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_LOADED,"loadContent");s.updateContent(B)}return s},updateTitle:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateTitle")}else{if(!w){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateTitle")}}returned=s.beforeTitleUpdate.call(s);if(returned===false){return s}if(s.elements.button){s.elements.button=s.elements.button.clone(true)}s.elements.title.html(w);if(s.elements.button){s.elements.title.prepend(s.elements.button)}s.onTitleUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_TITLE_UPDATED,"updateTitle")},focus:function(A){var y,x,w,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"focus")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_FOCUS_STATIC,"focus")}}y=parseInt(s.elements.tooltip.css("z-index"));x=6000+f("div.qtip[qtip]").length-1;if(!s.status.focused&&y!==x){z=s.beforeFocus.call(s,A);if(z===false){return s}f("div.qtip[qtip]").not(s.elements.tooltip).each(function(){if(f(this).qtip("api").status.rendered===true){w=parseInt(f(this).css("z-index"));if(typeof w=="number"&&w>-1){f(this).css({zIndex:parseInt(f(this).css("z-index"))-1})}f(this).qtip("api").status.focused=false}});s.elements.tooltip.css({zIndex:x});s.status.focused=true;s.onFocus.call(s,A);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_FOCUSED,"focus")}return s},disable:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"disable")}if(w){if(!s.status.disabled){s.status.disabled=true;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DISABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,"disable")}}else{if(s.status.disabled){s.status.disabled=false;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_ENABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,"disable")}}return s},destroy:function(){var w,x,y;x=s.beforeDestroy.call(s);if(x===false){return s}if(s.status.rendered){s.options.show.when.target.unbind("mousemove.qtip",s.updatePosition);s.options.show.when.target.unbind("mouseout.qtip",s.hide);s.options.show.when.target.unbind(s.options.show.when.event+".qtip");s.options.hide.when.target.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind("mouseover.qtip",s.focus);s.elements.tooltip.remove()}else{s.options.show.when.target.unbind(s.options.show.when.event+".qtip-create")}if(typeof s.elements.target.data("qtip")=="object"){y=s.elements.target.data("qtip").interfaces;if(typeof y=="object"&&y.length>0){for(w=0;w0){s.elements.target.data("qtip").current=y.length-1}else{s.elements.target.removeData("qtip")}s.onDestroy.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DESTROYED,"destroy");return s.elements.target},getPosition:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getPosition")}w=(s.elements.tooltip.css("display")!=="none")?false:true;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x=s.elements.tooltip.offset();if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x},getDimensions:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getDimensions")}w=(!s.elements.tooltip.is(":visible"))?true:false;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x={height:s.elements.tooltip.outerHeight(),width:s.elements.tooltip.outerWidth()};if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x}})}function p(){var s,w,u,t,v,y,x;s=this;s.beforeRender.call(s);s.status.rendered=true;s.elements.tooltip='';s.elements.tooltip=f(s.elements.tooltip);s.elements.tooltip.appendTo(s.options.position.container);s.elements.tooltip.data("qtip",{current:0,interfaces:[s]});s.elements.wrapper=s.elements.tooltip.children("div:first");s.elements.contentWrapper=s.elements.wrapper.children("div:first").css({background:s.options.style.background});s.elements.content=s.elements.contentWrapper.children("div:first").css(q(s.options.style));if(f.browser.msie){s.elements.wrapper.add(s.elements.content).css({zoom:1})}if(s.options.hide.when.event=="unfocus"){s.elements.tooltip.attr("unfocus",true)}if(typeof s.options.style.width.value=="number"){s.updateWidth()}if(f("").get(0).getContext||f.browser.msie){if(s.options.style.border.radius>0){m.call(s)}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color})}if(s.options.style.tip.corner!==false){e.call(s)}}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color});s.options.style.border.radius=0;s.options.style.tip.corner=false;f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,"render")}if((typeof s.options.content.text=="string"&&s.options.content.text.length>0)||(s.options.content.text.jquery&&s.options.content.text.length>0)){u=s.options.content.text}else{if(typeof s.elements.target.attr("title")=="string"&&s.elements.target.attr("title").length>0){u=s.elements.target.attr("title").replace("\\n","
");s.elements.target.attr("title","")}else{if(typeof s.elements.target.attr("alt")=="string"&&s.elements.target.attr("alt").length>0){u=s.elements.target.attr("alt").replace("\\n","
");s.elements.target.attr("alt","")}else{u=" ";f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.NO_VALID_CONTENT,"render")}}}if(s.options.content.title.text!==false){j.call(s)}s.updateContent(u);l.call(s);if(s.options.show.ready===true){s.show()}if(s.options.content.url!==false){t=s.options.content.url;v=s.options.content.data;y=s.options.content.method||"get";s.loadContent(t,v,y)}s.onRender.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_RENDERED,"render")}function m(){var F,z,t,B,x,E,u,G,D,y,w,C,A,s,v;F=this;F.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();t=F.options.style.border.width;B=F.options.style.border.radius;x=F.options.style.border.color||F.options.style.tip.color;E=g(B);u={};for(z in E){u[z]='
';if(f("").get(0).getContext){u[z]+=''}else{if(f.browser.msie){G=B*2+3;u[z]+=''}}u[z]+="
"}D=F.getDimensions().width-(Math.max(t,B)*2);y='
';w='
'+u.topLeft+u.topRight+y;F.elements.wrapper.prepend(w);C='
'+u.bottomLeft+u.bottomRight+y;F.elements.wrapper.append(C);if(f("").get(0).getContext){F.elements.wrapper.find("canvas").each(function(){A=E[f(this).parent("[rel]:first").attr("rel")];r.call(F,f(this),A,B,x)})}else{if(f.browser.msie){F.elements.tooltip.append('')}}s=Math.max(B,(B+(t-B)));v=Math.max(t-B,0);F.elements.contentWrapper.css({border:"0px solid "+x,borderWidth:v+"px "+s+"px"})}function r(u,w,s,t){var v=u.get(0).getContext("2d");v.fillStyle=t;v.beginPath();v.arc(w[0],w[1],s,0,Math.PI*2,false);v.fill()}function e(v){var t,s,x,u,w;t=this;if(t.elements.tip!==null){t.elements.tip.remove()}s=t.options.style.tip.color||t.options.style.border.color;if(t.options.style.tip.corner===false){return}else{if(!v){v=t.options.style.tip.corner}}x=b(v,t.options.style.tip.size.width,t.options.style.tip.size.height);t.elements.tip='
';if(f("").get(0).getContext){t.elements.tip+=''}else{if(f.browser.msie){u=t.options.style.tip.size.width+","+t.options.style.tip.size.height;w="m"+x[0][0]+","+x[0][1];w+=" l"+x[1][0]+","+x[1][1];w+=" "+x[2][0]+","+x[2][1];w+=" xe";t.elements.tip+='';t.elements.tip+='';t.elements.contentWrapper.css("position","relative")}}t.elements.tooltip.prepend(t.elements.tip+"
");t.elements.tip=t.elements.tooltip.find("."+t.options.style.classes.tip).eq(0);if(f("").get(0).getContext){h.call(t,t.elements.tip.find("canvas:first"),x,s)}if(v.search(/top/)!==-1&&f.browser.msie&&parseInt(f.browser.version.charAt(0))===6){t.elements.tip.css({marginTop:-4})}n.call(t,v)}function h(t,v,s){var u=t.get(0).getContext("2d");u.fillStyle=s;u.beginPath();u.moveTo(v[0][0],v[0][1]);u.lineTo(v[1][0],v[1][1]);u.lineTo(v[2][0],v[2][1]);u.fill()}function n(u){var t,w,s,x,v;t=this;if(t.options.style.tip.corner===false||!t.elements.tip){return}if(!u){u=t.elements.tip.attr("rel")}w=positionAdjust=(f.browser.msie)?1:0;t.elements.tip.css(u.match(/left|right|top|bottom/)[0],0);if(u.search(/top|bottom/)!==-1){if(f.browser.msie){if(parseInt(f.browser.version.charAt(0))===6){positionAdjust=(u.search(/top/)!==-1)?-3:1}else{positionAdjust=(u.search(/top/)!==-1)?1:2}}if(u.search(/Middle/)!==-1){t.elements.tip.css({left:"50%",marginLeft:-(t.options.style.tip.size.width/2)})}else{if(u.search(/Left/)!==-1){t.elements.tip.css({left:t.options.style.border.radius-w})}else{if(u.search(/Right/)!==-1){t.elements.tip.css({right:t.options.style.border.radius+w})}}}if(u.search(/top/)!==-1){t.elements.tip.css({top:-positionAdjust})}else{t.elements.tip.css({bottom:positionAdjust})}}else{if(u.search(/left|right/)!==-1){if(f.browser.msie){positionAdjust=(parseInt(f.browser.version.charAt(0))===6)?1:((u.search(/left/)!==-1)?1:2)}if(u.search(/Middle/)!==-1){t.elements.tip.css({top:"50%",marginTop:-(t.options.style.tip.size.height/2)})}else{if(u.search(/Top/)!==-1){t.elements.tip.css({top:t.options.style.border.radius-w})}else{if(u.search(/Bottom/)!==-1){t.elements.tip.css({bottom:t.options.style.border.radius+w})}}}if(u.search(/left/)!==-1){t.elements.tip.css({left:-positionAdjust})}else{t.elements.tip.css({right:positionAdjust})}}}s="padding-"+u.match(/left|right|top|bottom/)[0];x=t.options.style.tip.size[(s.search(/left|right/)!==-1)?"width":"height"];t.elements.tooltip.css("padding",0);t.elements.tooltip.css(s,x);if(f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){v=parseInt(t.elements.tip.css("margin-top"))||0;v+=parseInt(t.elements.content.css("margin-top"))||0;t.elements.tip.css({marginTop:v})}}function j(){var s=this;if(s.elements.title!==null){s.elements.title.remove()}s.elements.title=f('
').css(q(s.options.style.title,true)).css({zoom:(f.browser.msie)?1:0}).prependTo(s.elements.contentWrapper);if(s.options.content.title.text){s.updateTitle.call(s,s.options.content.title.text)}if(s.options.content.title.button!==false&&typeof s.options.content.title.button=="string"){s.elements.button=f('').css(q(s.options.style.button,true)).html(s.options.content.title.button).prependTo(s.elements.title).click(function(t){if(!s.status.disabled){s.hide(t)}})}}function l(){var t,v,u,s;t=this;v=t.options.show.when.target;u=t.options.hide.when.target;if(t.options.hide.fixed){u=u.add(t.elements.tooltip)}if(t.options.hide.when.event=="inactive"){s=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter","mouseleave","mouseover"];function y(z){if(t.status.disabled===true){return}clearTimeout(t.timers.inactive);t.timers.inactive=setTimeout(function(){f(s).each(function(){u.unbind(this+".qtip-inactive");t.elements.content.unbind(this+".qtip-inactive")});t.hide(z)},t.options.hide.delay)}}else{if(t.options.hide.fixed===true){t.elements.tooltip.bind("mouseover.qtip",function(){if(t.status.disabled===true){return}clearTimeout(t.timers.hide)})}}function x(z){if(t.status.disabled===true){return}if(t.options.hide.when.event=="inactive"){f(s).each(function(){u.bind(this+".qtip-inactive",y);t.elements.content.bind(this+".qtip-inactive",y)});y()}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.timers.show=setTimeout(function(){t.show(z)},t.options.show.delay)}function w(z){if(t.status.disabled===true){return}if(t.options.hide.fixed===true&&t.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&f(z.relatedTarget).parents("div.qtip[qtip]").length>0){z.stopPropagation();z.preventDefault();clearTimeout(t.timers.hide);return false}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.elements.tooltip.stop(true,true);t.timers.hide=setTimeout(function(){t.hide(z)},t.options.hide.delay)}if((t.options.show.when.target.add(t.options.hide.when.target).length===1&&t.options.show.when.event==t.options.hide.when.event&&t.options.hide.when.event!=="inactive")||t.options.hide.when.event=="unfocus"){t.cache.toggle=0;v.bind(t.options.show.when.event+".qtip",function(z){if(t.cache.toggle==0){x(z)}else{w(z)}})}else{v.bind(t.options.show.when.event+".qtip",x);if(t.options.hide.when.event!=="inactive"){u.bind(t.options.hide.when.event+".qtip",w)}}if(t.options.position.type.search(/(fixed|absolute)/)!==-1){t.elements.tooltip.bind("mouseover.qtip",t.focus)}if(t.options.position.target==="mouse"&&t.options.position.type!=="static"){v.bind("mousemove.qtip",function(z){t.cache.mouse={x:z.pageX,y:z.pageY};if(t.status.disabled===false&&t.options.position.adjust.mouse===true&&t.options.position.type!=="static"&&t.elements.tooltip.css("display")!=="none"){t.updatePosition(z)}})}}function o(u,v,A){var z,s,x,y,t,w;z=this;if(A.corner=="center"){return v.position}s=f.extend({},u);y={x:false,y:false};t={left:(s.left=f.fn.qtip.cache.screen.width+f.fn.qtip.cache.screen.scroll.left),top:(s.top=f.fn.qtip.cache.screen.height+f.fn.qtip.cache.screen.scroll.top)};x={left:(t.left&&(A.corner.search(/right/i)!=-1||(A.corner.search(/right/i)==-1&&!t.right))),right:(t.right&&(A.corner.search(/left/i)!=-1||(A.corner.search(/left/i)==-1&&!t.left))),top:(t.top&&A.corner.search(/top/i)==-1),bottom:(t.bottom&&A.corner.search(/bottom/i)==-1)};if(x.left){if(z.options.position.target!=="mouse"){s.left=v.position.left+v.dimensions.width}else{s.left=z.cache.mouse.x}y.x="Left"}else{if(x.right){if(z.options.position.target!=="mouse"){s.left=v.position.left-A.dimensions.width}else{s.left=z.cache.mouse.x-A.dimensions.width}y.x="Right"}}if(x.top){if(z.options.position.target!=="mouse"){s.top=v.position.top+v.dimensions.height}else{s.top=z.cache.mouse.y}y.y="top"}else{if(x.bottom){if(z.options.position.target!=="mouse"){s.top=v.position.top-A.dimensions.height}else{s.top=z.cache.mouse.y-A.dimensions.height}y.y="bottom"}}if(s.left<0){s.left=u.left;y.x=false}if(s.top<0){s.top=u.top;y.y=false}if(z.options.style.tip.corner!==false){s.corner=new String(A.corner);if(y.x!==false){s.corner=s.corner.replace(/Left|Right|Middle/,y.x)}if(y.y!==false){s.corner=s.corner.replace(/top|bottom/,y.y)}if(s.corner!==z.elements.tip.attr("rel")){e.call(z,s.corner)}}return s}function q(u,t){var v,s;v=f.extend(true,{},u);for(s in v){if(t===true&&s.search(/(tip|classes)/i)!==-1){delete v[s]}else{if(!t&&s.search(/(width|border|tip|title|classes|user)/i)!==-1){delete v[s]}}}return v}function c(s){if(typeof s.tip!=="object"){s.tip={corner:s.tip}}if(typeof s.tip.size!=="object"){s.tip.size={width:s.tip.size,height:s.tip.size}}if(typeof s.border!=="object"){s.border={width:s.border}}if(typeof s.width!=="object"){s.width={value:s.width}}if(typeof s.width.max=="string"){s.width.max=parseInt(s.width.max.replace(/([0-9]+)/i,"$1"))}if(typeof s.width.min=="string"){s.width.min=parseInt(s.width.min.replace(/([0-9]+)/i,"$1"))}if(typeof s.tip.size.x=="number"){s.tip.size.width=s.tip.size.x;delete s.tip.size.x}if(typeof s.tip.size.y=="number"){s.tip.size.height=s.tip.size.y;delete s.tip.size.y}return s}function a(){var s,t,u,x,v,w;s=this;u=[true,{}];for(t=0;t0){v.tip.size.width+=1}if(v.tip.size.height%2>0){v.tip.size.height+=1}if(v.tip.corner===true){v.tip.corner=(s.options.position.corner.tooltip==="center")?false:s.options.position.corner.tooltip}return v}function b(v,u,t){var s={bottomRight:[[0,0],[u,t],[u,0]],bottomLeft:[[0,0],[u,0],[0,t]],topRight:[[0,t],[u,0],[u,t]],topLeft:[[0,0],[0,t],[u,t]],topMiddle:[[0,t],[u/2,0],[u,t]],bottomMiddle:[[0,0],[u,0],[u/2,t]],rightMiddle:[[0,0],[u,t/2],[0,t]],leftMiddle:[[u,0],[u,t],[0,t/2]]};s.leftTop=s.bottomRight;s.rightTop=s.bottomLeft;s.leftBottom=s.topRight;s.rightBottom=s.topLeft;return s[v]}function g(s){var t;if(f("").get(0).getContext){t={topLeft:[s,s],topRight:[0,s],bottomLeft:[s,0],bottomRight:[0,0]}}else{if(f.browser.msie){t={topLeft:[-90,90,0],topRight:[-90,90,-s],bottomLeft:[90,270,0],bottomRight:[90,270,-s]}}}return t}function k(){var s,t,u;s=this;u=s.getDimensions();t='