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 index 41de3b0..fd2f927 100644 --- 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 @@ -53,9 +53,6 @@ class Google_Calendar_Events_Admin { // 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 ); } @@ -76,20 +73,6 @@ class Google_Calendar_Events_Admin { 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 * 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 index 4307deb..cd25c7d 100644 --- a/wp-content/plugins/google-calendar-events/class-google-calendar-events.php +++ b/wp-content/plugins/google-calendar-events/class-google-calendar-events.php @@ -18,7 +18,7 @@ class Google_Calendar_Events { * * @var string */ - protected $version = '2.0.1'; + protected $version = '2.0.6'; /** * Unique identifier for the plugin. @@ -64,12 +64,9 @@ class Google_Calendar_Events { 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' ) ); - + $this->plugin_textdomain(); } /** @@ -140,7 +137,8 @@ class Google_Calendar_Events { wp_localize_script( $this->plugin_slug . '-public', 'gce', array( - 'ajaxurl' => admin_url( 'admin-ajax.php' ) + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'ajaxnonce' => wp_create_nonce( 'gce_ajax_nonce' ) ) ); } diff --git a/wp-content/plugins/google-calendar-events/css/admin.css b/wp-content/plugins/google-calendar-events/css/admin.css index b9052f5..3317676 100644 --- a/wp-content/plugins/google-calendar-events/css/admin.css +++ b/wp-content/plugins/google-calendar-events/css/admin.css @@ -50,3 +50,7 @@ color: #8a6d3b; padding: 15px; } + +#gce_feed_meta .inside code { + word-break: break-all; +} 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 cc8b528..8dbf949 100644 --- a/wp-content/plugins/google-calendar-events/css/gce-style.css +++ b/wp-content/plugins/google-calendar-events/css/gce-style.css @@ -1,222 +1,219 @@ -/** - * 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; -} +/** + * Public facing CSS file + * + * @package GCE + * @author Phil Derksen , Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ + +/* Base line-height for all views & tooltip */ + +.gce-page-grid, +.gce-page-list, +.gce-widget-grid, +.gce-widget-list, +.gce-event-info { + line-height: 1.5; +} + +/* Month & list titles for all views */ + +.gce-month-title, +.gce-list-title { + font-weight: bold; + padding-bottom: 5px; +} + +/* Event titles with shaded background for all views */ + +.gce-list-event, +.gce-tooltip-event { + background-color: #ddd; + padding: 0 5px; +} + +/* 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 th abbr{ /* Day letter abbreviation */ + border-bottom:none; +} + +/* PAGE LIST */ + +.gce-page-list .gce-feed { + padding-bottom: 10px; +} + +.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; +} + +/* 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 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; +} + +/* 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; +} + +/** Calendar navigation bar, Prev/Next links & month title. **/ + +.gce-navbar { + width: 100%; + text-align: center; + clear: both; + overflow: hidden; +} + +.gce-next, +.gce-prev { + white-space: nowrap; +} + +.gce-prev { + float: left; +} + +.gce-next { + float: right; +} + +.gce-month-title { + display: inline-block; + margin: 0 auto; + white-space: nowrap; +} + +/* Grouped List */ + +.gce-list-grouped .gce-feed { + margin-left: 5%; +} 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 585506d..4239d1c 100644 --- a/wp-content/plugins/google-calendar-events/google-calendar-events.php +++ b/wp-content/plugins/google-calendar-events/google-calendar-events.php @@ -1,60 +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: 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' ) ); -} +, 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.6 + * 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/includes/admin/admin-functions.php b/wp-content/plugins/google-calendar-events/includes/admin/admin-functions.php index 5889e87..b35bc0d 100644 --- a/wp-content/plugins/google-calendar-events/includes/admin/admin-functions.php +++ b/wp-content/plugins/google-calendar-events/includes/admin/admin-functions.php @@ -43,6 +43,14 @@ function gce_default_editor_content( $content, $post ) { 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 ); + add_post_meta( $post->ID, 'gce_paging', 1 ); + add_post_meta( $post->ID, 'gce_list_max_num', 7 ); + add_post_meta( $post->ID, 'gce_list_max_length', 'days' ); + add_post_meta( $post->ID, 'gce_list_start_offset_num', '0' ); + add_post_meta( $post->ID, 'gce_feed_start', '1' ); + add_post_meta( $post->ID, 'gce_feed_start_interval', 'months' ); + add_post_meta( $post->ID, 'gce_feed_end', '2' ); + add_post_meta( $post->ID, 'gce_feed_end_interval', 'years' ); // Default Simple Display Options add_post_meta( $post->ID, 'gce_display_start', 'time' ); @@ -60,3 +68,19 @@ function gce_default_editor_content( $content, $post ) { return $content; } add_filter( 'default_content', 'gce_default_editor_content', 10, 2 ); + + +function gce_add_cache_button() { + global $post; + + if( $post->post_type == 'gce_feed' ) { + $html = ''; + + echo $html; + } +} +add_action( 'post_submitbox_start', 'gce_add_cache_button' ); + + diff --git a/wp-content/plugins/google-calendar-events/includes/admin/upgrade.php b/wp-content/plugins/google-calendar-events/includes/admin/upgrade.php index 11a57fe..5902395 100644 --- a/wp-content/plugins/google-calendar-events/includes/admin/upgrade.php +++ b/wp-content/plugins/google-calendar-events/includes/admin/upgrade.php @@ -26,6 +26,16 @@ function gce_upgrade() { if( version_compare( $version, '2.0.0-beta1', '<' ) && false === get_option( 'gce_upgrade_has_run' ) ) { gce_v2_upgrade(); } + + // Version 2.0.4 upgrade + if( version_compare( $version, '2.0.4', '<' ) ) { + gce_v204_upgrade(); + } + + // Version 2.0.6 upgrade + if( version_compare( $version, '2.0.6', '<' ) ) { + gce_v206_upgrade(); + } } $new_version = Google_Calendar_Events::get_instance()->get_plugin_version(); @@ -34,6 +44,73 @@ function gce_upgrade() { add_option( 'gce_upgrade_has_run', 1 ); } +/* + * Run the upgrade to version 2.0.6 + * + * @since 2.0.4 + */ +function gce_v206_upgrade() { + + // Update feeds + $q = new WP_Query( 'post_type=gce_feed' ); + + if( $q->have_posts() ) { + while( $q->have_posts() ) { + $q->the_post(); + + update_post_meta( get_the_ID(), 'gce_feed_start', '1' ); + update_post_meta( get_the_ID(), 'gce_feed_start_interval', 'months' ); + update_post_meta( get_the_ID(), 'gce_feed_end', '2' ); + update_post_meta( get_the_ID(), 'gce_feed_end_interval', 'years' ); + } + } +} + +/* + * Run the upgrade to version 2.0.4 + * + * @since 2.0.4 + */ +function gce_v204_upgrade() { + + // Update feeds + $q = new WP_Query( 'post_type=gce_feed' ); + + if( $q->have_posts() ) { + while( $q->have_posts() ) { + $q->the_post(); + + update_post_meta( get_the_ID(), 'gce_paging', '1' ); + update_post_meta( get_the_ID(), 'gce_list_max_num', '7' ); + update_post_meta( get_the_ID(), 'gce_list_max_length', 'days' ); + update_post_meta( get_the_ID(), 'gce_list_start_offset_num', '0' ); + update_post_meta( get_the_ID(), 'gce_list_start_offset_direction', 'back' ); + } + } + + + // Update widgets + $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 ) { + $widget[$a]['paging'] = '1'; + $widget[$a]['list_max_num'] = '7'; + $widget[$a]['list_max_length'] = 'days'; + $widget[$a]['list_start_offset_num'] = '0'; + $widget[$a]['list_start_offset_direction'] = 'back'; + } + } + + update_option( 'widget_gce_widget', $widget ); + } +} + /* * Run the upgrade to version 2.0.0 * @@ -43,9 +120,11 @@ 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 ); + + if( ! empty( $old_options ) ) { + foreach( $old_options as $key => $value ) { + convert_to_cpt_posts( $value ); + } } update_widget_feed_ids(); @@ -140,9 +219,8 @@ function create_cpt_meta( $id, $args ) { '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_multi_day_events' => ( $args['multiple_day'] != 'false' ? '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'] ), @@ -217,9 +295,9 @@ function update_widget_feed_ids() { $id = $v; - $multi = str_replace( ' ', '', $v ); + //$multi = str_replace( ' ', '', $v ); - $multi = explode( ',', $id ); + $multi = explode( ',', str_replace( ' ', '', $id ) ); if( is_array( $multi ) ) { 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 index a3a74cf..28c3454 100644 --- a/wp-content/plugins/google-calendar-events/includes/class-gce-display.php +++ b/wp-content/plugins/google-calendar-events/includes/class-gce-display.php @@ -13,11 +13,10 @@ class GCE_Display { private $feeds, $merged_feeds; - public function __construct( $ids, $title_text = null, $max_events = 0, $sort_order = 'asc' ) { + public function __construct( $ids, $title_text = null, $sort_order = 'asc' ) { $this->id = $ids; $this->title = $title_text; - $this->max_events = $max_events; $this->sort = $sort_order; foreach( $ids as $id ) { @@ -61,25 +60,17 @@ class GCE_Display { //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++ ) { + for ( $i = 0; $i < $count; $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 ) { + //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; } @@ -88,7 +79,7 @@ class GCE_Display { * * @since 2.0.0 */ - public function get_grid ( $year = null, $month = null, $widget = false ) { + public function get_grid ( $year = null, $month = null, $widget = false, $paging = null ) { require_once 'php-calendar.php'; $time_now = current_time( 'timestamp' ); @@ -118,8 +109,16 @@ class GCE_Display { //Get events data $event_days = $this->get_event_days(); + + //Array of previous and next link stuff for use in gce_generate_calendar (below) + foreach( $event_days as $key => $event_day ) { + + if( $paging == null && $paging != 0 ) { + $paging = get_post_meta( $event_day[0]->feed->id, 'gce_paging', true ); + } + } - $today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); + $start = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) ); $i = 1; @@ -156,9 +155,9 @@ class GCE_Display { $css_classes[] = 'gce-multiple'; //If event day is today, add gce-today CSS class, otherwise add past or future class - if ( $key == $today ) { + if ( $key == $start ) { $css_classes[] = 'gce-today gce-today-has-events'; - } elseif ( $key < $today ) { + } elseif ( $key < $start ) { $css_classes[] = 'gce-day-past'; } else { $css_classes[] = 'gce-day-future'; @@ -178,23 +177,24 @@ class GCE_Display { } //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 ); + if ( ! isset( $event_days[$start] ) ) + $event_days[$start] = array( null, 'gce-today gce-today-no-events', null ); + $pn = array(); + + if( $paging ) { + // Add previous / next functionality + //If there are events to display in a previous month, add previous month link + $prev_key = __( 'Back', 'gce' ); + $prev = date( 'm-Y', mktime( 0, 0, 0, $month - 1, 1, $year ) ); + + //If there are events to display in a future month, add next month link + $next_key = __( 'Next', 'gce' ); + $next = date( 'm-Y', mktime( 0, 0, 0, $month + 1, 1, $year ) ); + + //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' ); @@ -207,52 +207,172 @@ class GCE_Display { * * @since 2.0.0 */ - public function get_list( $grouped = false ) { - $time_now = current_time( 'timestamp' ); + public function get_list( $grouped = false, $start = null, $paging = null, $paging_interval = null, $start_offset = null, $max_events = null, $paging_type = null ) { + $paging_type = $paging_type; + + $max_length = null; + + if( $paging_type == 'events' ) { + $max_length = 'events'; + } + + if( $start == null ) { + $start = mktime( 0, 0, 0, date( 'm', current_time( 'timestamp' ) ), 1, date( 'Y', current_time( 'timestamp' ) ) ); + } // Get all the event days $event_days = $this->get_event_days(); + + foreach( $event_days as $key => $event_day ) { + if( $paging_interval == null ) { + $max_num = get_post_meta( $event_day[0]->feed->id, 'gce_list_max_num', true ); + + if( $paging_type == null ) { + $max_length = get_post_meta( $event_day[0]->feed->id, 'gce_list_max_length', true ); + $paging_type = $max_length; + } + } - //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' ) . '

'; + if( $paging == null && $paging != 0 ) { + $paging = get_post_meta( $event_day[0]->feed->id, 'gce_paging', true ); + } + + if( $start_offset == null && $start_offset != 0 ) { + $start_offset_num = get_post_meta( $event_day[0]->feed->id, 'gce_list_start_offset_num', true ); + $start_offset_direction = get_post_meta( $event_day[0]->feed->id, 'gce_list_start_offset_direction', true ); + } } - $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 ) . '
    ' . - '
      '; + if( empty( $max_num ) || $max_num == 0 ) { + $max_num = 7; + } + + if( $max_length == 'days' ) { + $paging_interval = $max_num * 86400; + } + + if( $start_offset == null && $start_offset != 0 ) { + if( $start_offset_direction == 'back' ) { + $start_offset_direction = -1; + } else { + $start_offset_direction = 1; } - 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 .= '
    '; - } + $start_offset = $start_offset_num * 86400 * $start_offset_direction; + + $start = $start + $start_offset; } - $markup .= '
'; + $start = mktime( 0, 0, 0, date( 'm', $start ), date( 'd', $start ), date( 'Y', $start ) ); + + $end_time = $start + $paging_interval; + + $i = 1; + + $feeds = implode( $this->id, '-' ); + + $markup = '
' . "\n"; + + if( ( $paging != 0 ) && $max_length != 'events' ) { + $p = ''; + $n = ''; + + $markup .= '' . + '
' . + $p . + $n . + '
' . + '
' . + '' . "\n"; + } + $max_count = 1; + $has_events = false; + + if( $max_length == 'events' ) { + if( $start_offset === null ) { + $time_now = current_time( 'timestamp' ); + } else { + + $time_now = current_time( 'timestamp' ); + + $time_now = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'j', $time_now ), date( 'Y', $time_now ) ) + $start_offset; + + } + + $event_counter = 0; + + if( $max_events == null ) { + $max_events = $max_num; + } + } + + if ( $grouped ) { + $markup .= + '
' ; + } + + foreach ( $event_days as $key => $event_day ) { + + if( $max_length != 'events' ) { + + if( $grouped && $key >= $start && $key < $end_time ) { + $markup .= '
' . stripslashes( $this->title ) . ' ' . date_i18n( $event_day[0]->feed->date_format, $key ) . '
'; + } + + foreach ( $event_day as $num_in_day => $event ) { + //Create the markup for this event + if( ( $event->start_time >= $start && $event->end_time <= $end_time ) || ( $event->day_type == 'MWD' && $event->start_time > $start && $event->start_time < $end_time ) ) { + + $markup .= + '
' . + //If this isn't a grouped list and a date title should be displayed, add the date title + ( ( ! $grouped && isset( $event->title ) ) ? '
' . stripslashes( $this->title ) . '
' : '' ) . + //Add the event markup + $event->get_event_markup( 'list', $num_in_day, $i ) . + '
'; + + $has_events = true; + + $i++; + } + } + } else { + + if( $grouped && $key >= $start && $event_counter < $max_events ) { + $markup .= '
' . stripslashes( $this->title ) . ' ' . date_i18n( $event_day[0]->feed->date_format, $key ) . '
'; + } + + foreach ( $event_day as $num_in_day => $event ) { + //Create the markup for this event + if( ( $event->start_time >= $time_now ) && ( $event_counter < $max_events ) ) { + $markup .= + '
' . + '
' . stripslashes( $this->title ) . '
' . + //Add the event markup + $event->get_event_markup( 'list', $num_in_day, $i ) . + '
'; + + $has_events = true; + + $i++; + + $event_counter++; + } + } + } + + $max_count++; + } + + if ( $grouped ) { + $markup .= '
'; + } + + if( ! $has_events ) { + $markup .= __( 'No events to display.', 'gce' ); + } + + $markup .= '
'; return $markup; } diff --git a/wp-content/plugins/google-calendar-events/includes/class-gce-event.php b/wp-content/plugins/google-calendar-events/includes/class-gce-event.php index 2352e35..3a1f1d9 100644 --- a/wp-content/plugins/google-calendar-events/includes/class-gce-event.php +++ b/wp-content/plugins/google-calendar-events/includes/class-gce-event.php @@ -64,10 +64,7 @@ class GCE_Event { 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; - } + $days[] = $next_day; } else { $on_next_day = false; } @@ -192,7 +189,12 @@ class GCE_Event { //If link should be displayed add to $markup if ( isset($display_options['display_link'] ) ) { $target = ( ! empty( $display_options['display_link_target'] ) ? 'target="blank"' : '' ); - $markup .= ''; + + $ctz = get_option( 'timezone_string' ); + + $link = $this->link . ( ! empty( $ctz ) ? '&ctz=' . $ctz : '' ); + + $markup .= ''; } return $markup; @@ -361,10 +363,12 @@ class GCE_Event { case 'link': $new_window = ( $newwindow ) ? ' target="_blank"' : ''; - return $m[1] . '' . $this->look_for_shortcodes( $m[5] ) . '' . $m[6]; + $ctz = get_option( 'timezone_string' ); + $link = $this->link . ( ! empty( $ctz ) ? '&ctz=' . $ctz : '' ); + 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]; + return $m[1] . esc_url( $this->link ) . $m[6]; case 'feed-id': return $m[1] . intval( $this->feed->id ) . $m[6]; 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 index 50db4a4..209c08b 100644 --- a/wp-content/plugins/google-calendar-events/includes/class-gce-feed.php +++ b/wp-content/plugins/google-calendar-events/includes/class-gce-feed.php @@ -13,12 +13,8 @@ class GCE_Feed { public $id, $feed_url, - $start, - $end, - $max, $date_format, $time_format, - $timezone_offset, $cache, $multiple_day_events, $display_url, @@ -42,10 +38,7 @@ class GCE_Feed { // Now create the Feed $this->create_feed(); - - if( $this->cache > 0 ) { - $this->cache_events(); - } + } /** @@ -67,12 +60,8 @@ class GCE_Feed { $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 ); @@ -106,22 +95,30 @@ class GCE_Feed { $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'; + $query = '?alt=json&sortorder=ascending&orderby=starttime'; + + $start = $this->get_feed_start(); + + $end = $this->get_feed_end(); + + $gmt_offset = abs( get_option( 'gmt_offset' ) * 3600 ); + + $query .= '&start-min=' . date( 'Y-m-d\TH:i:s', $start - $gmt_offset ); + + $query .= '&start-max=' . date( 'Y-m-d\TH:i:s', $end - $gmt_offset ); + - $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; + // Max results limit for performance. + $query .= '&max-results=10000'; + + $ctz = get_option( 'timezone_string' ); + + if( ! empty( $ctz ) ) { + $query .= '&ctz=' . $ctz; } if ( ! empty( $this->search_query ) ) { - $query .= '&q=' . rawurlencode( $this->search_query ); + $query .= '&q=' . rawurlencode( $this->search_query ); } if ( $this->expand_recurring ) { @@ -140,16 +137,20 @@ class GCE_Feed { * * @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 - ) ); + private function get_feed_data( $url ) { // First check for transient data to use if( false !== get_transient( 'gce_feed_' . $this->id ) ) { $this->events = get_transient( 'gce_feed_' . $this->id ); } else { + + // Moved the remote get here to be more efficient + // Pointed out to us by John McManigle ( github.com/mcmanigle ) + $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 @@ -203,6 +204,10 @@ class GCE_Feed { echo $this->error; return; } + } else { + if( $this->cache > 0 && false === get_transient( 'gce_feed_' . $this->id ) ) { + $this->cache_events(); + } } } @@ -216,52 +221,40 @@ class GCE_Feed { 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; - } + private function get_feed_start() { + + $start = get_post_meta( $this->id, 'gce_feed_start', true ); + $interval = get_post_meta( $this->id, 'gce_feed_start_interval', true ); + + switch( $interval ) { + case 'days': + return time() - ( $start * 86400 ); + case 'months': + return time() - ( $start * 2629743 ); + case 'years': + return time() - ( $start * 31556926 ); } - return $return; + // fall back just in case. Falls back to 1 year ago + return time() - 31556926; + } + + private function get_feed_end() { + + $end = get_post_meta( $this->id, 'gce_feed_end', true ); + $interval = get_post_meta( $this->id, 'gce_feed_end_interval', true ); + + switch( $interval ) { + case 'days': + return time() + ( $end * 86400 ); + case 'months': + return time() + ( $end * 2629743 ); + case 'years': + return time() + ( $end * 31556926 ); + } + + // Falls back to 1 year ahead just in case + return time() + 31556926; } function get_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 index f3917dc..8e4751b 100644 --- a/wp-content/plugins/google-calendar-events/includes/gce-feed-cpt.php +++ b/wp-content/plugins/google-calendar-events/includes/gce-feed-cpt.php @@ -140,12 +140,8 @@ function gce_save_meta( $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', @@ -153,6 +149,15 @@ function gce_save_meta( $post_id ) { 'gce_custom_until', 'gce_search_query', 'gce_expand_recurring', + 'gce_paging', + 'gce_list_max_num', + 'gce_list_max_length', + 'gce_list_start_offset_num', + 'gce_list_start_offset_direction', + 'gce_feed_start', + 'gce_feed_start_interval', + 'gce_feed_end', + 'gce_feed_end_interval', // Display options 'gce_display_start', 'gce_display_start_text', @@ -182,12 +187,7 @@ function gce_save_meta( $post_id ) { 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 ); - } + delete_post_meta( $post_id, $pmf ); } } } @@ -206,10 +206,9 @@ 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' + 'feed-id' => __( 'Feed ID', 'gce' ), + 'feed-sc' => __( 'Feed Shortcode', 'gce' ), + 'display-type' => __( 'Display Type', 'gce' ) ); return array_merge( $defaults, $new_columns ); @@ -232,19 +231,15 @@ function gce_column_content( $column_name, $post_ID ) { 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'; + echo __( 'Grid', 'gce' ); } else if( $display == 'list' ) { - echo 'List'; + echo __( 'List', 'gce' ); } else { - echo 'Grouped List'; + echo __( 'Grouped List', 'gce' ); } break; } @@ -258,7 +253,7 @@ add_action( 'manage_gce_feed_posts_custom_column', 'gce_column_content', 10, 2 ) */ function gce_cpt_actions( $actions, $post ) { if( $post->post_type == 'gce_feed' ) { - $actions['clear_cache'] = 'Clear Cache'; + $actions['clear_cache'] = '' . __( 'Clear Cache', 'gce' ) . ''; } return $actions; diff --git a/wp-content/plugins/google-calendar-events/includes/misc-functions.php b/wp-content/plugins/google-calendar-events/includes/misc-functions.php index ee5dbd1..3623b8d 100644 --- a/wp-content/plugins/google-calendar-events/includes/misc-functions.php +++ b/wp-content/plugins/google-calendar-events/includes/misc-functions.php @@ -8,29 +8,64 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $widget = false ) { $defaults = array( - 'title_text' => '', - 'max_events' => 25, - 'sort' => 'asc', - 'grouped' => 0, - 'month' => null, - 'year' => null, - 'widget' => 0 + 'title_text' => '', + 'sort' => 'asc', + 'grouped' => 0, + 'month' => null, + 'year' => null, + 'widget' => 0, + 'paging_interval' => null, + 'max_events' => null, + 'start_offset' => null, + 'paging_type' => null, + 'paging' => null ); $args = array_merge( $defaults, $args ); extract( $args ); - $ids = explode( '-', $feed_ids ); + $ids = explode( '-', str_replace( ' ', '', $feed_ids ) ); //Create new display object, passing array of feed id(s) - $d = new GCE_Display( $ids, $title_text, $max_events, $sort ); + $d = new GCE_Display( $ids, $title_text, $sort ); $markup = ''; + $start = current_time( 'timestamp' ); + + if( $widget ) { + foreach( $ids as $f ) { + $paging = get_post_meta( $f, 'gce_paging_widget', true ); + $old_paging[] = get_post_meta( $f, 'gce_paging', true ); + + if( $paging ) { + update_post_meta( $f, 'gce_paging', true ); + } + + $paging_interval = get_post_meta( $f, 'gce_widget_paging_interval', true ); + } + } + + // If paging is not set then we need to set it now + foreach( $ids as $id ) { + if( $paging == null && $paging != 0 ) { + $paging = get_post_meta( $id, 'gce_paging', true ); + } + } if( 'grid' == $display ) { - $markup = ''; + global $localize; + + $target = ( $widget == 1 ? 'gce-widget-' : 'gce-page-grid-' ) . $feed_ids; + + $localize[$target] = array( + 'target_element' => $target, + 'feed_ids' => $feed_ids, + 'title_text' => $title_text, + 'type' => ( $widget == 1 ? 'widget' : 'page' ) + ); + + wp_localize_script( GCE_PLUGIN_SLUG . '-public', 'gce_grid', $localize ); if( $widget == 1 ) { $markup .= '
'; @@ -38,11 +73,26 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid $markup .= '
'; } - $markup .= $d->get_grid( $year, $month, $widget ); + $markup .= $d->get_grid( $year, $month, $widget, $paging ); $markup .= '
'; } else if( 'list' == $display || 'list-grouped' == $display ) { - $markup = '
' . $d->get_list( $grouped ) . '
'; + + if( $widget ) { + $markup = '
' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type ) . '
'; + } else { + $markup = '
' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type ) . '
'; + } + } + + // Reset post meta + if( $widget ) { + $i = 0; + foreach( $ids as $f ) { + update_post_meta( $f, 'gce_paging', $old_paging[$i] ); + + $i++; + } } return $markup; @@ -54,34 +104,106 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid * @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']; + + $nonce = $_POST['gce_nonce']; + + // check to see if the submitted nonce matches with the + // generated nonce we created earlier + if ( ! wp_verify_nonce( $nonce, 'gce_ajax_nonce' ) ) { + die ( 'Request has failed.'); + } + + $ids = esc_html( $_POST['gce_feed_ids'] ); + $title = esc_html( $_POST['gce_title_text'] ); + $month = esc_html( $_POST['gce_month'] ); + $year = esc_html( $_POST['gce_year'] ); + $paging = esc_html( $_POST['gce_paging'] ); + $type = esc_html( $_POST['gce_type'] ); $title = ( 'null' == $title ) ? null : $title; $args = array( 'title_text' => $title, - 'max_events' => $max, 'month' => $month, 'year' => $year, + 'paging' => $paging ); - if ( 'page' == $_GET['gce_type'] ) { + if ( 'page' == $type ) { echo gce_print_calendar( $ids, 'grid', $args ); - } elseif ( 'widget' == $_GET['gce_type'] ) { + } elseif ( 'widget' == $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' ); + +/** +* AJAX function for grid pagination +* +* @since 2.0.0 +*/ +function gce_ajax_list() { + + $nonce = $_POST['gce_nonce']; + + // check to see if the submitted nonce matches with the + // generated nonce we created earlier + if ( ! wp_verify_nonce( $nonce, 'gce_ajax_nonce' ) ) { + die ( 'Request has failed.'); + } + + $grouped = esc_html( $_POST['gce_grouped'] ); + $start = esc_html( $_POST['gce_start'] ); + $ids = esc_html( $_POST['gce_feed_ids'] ); + $title_text = esc_html( $_POST['gce_title_text'] ); + $sort = esc_html( $_POST['gce_sort'] ); + $paging = esc_html( $_POST['gce_paging'] ); + $paging_interval = esc_html( $_POST['gce_paging_interval'] ); + $paging_direction = esc_html( $_POST['gce_paging_direction'] ); + $start_offset = esc_html( $_POST['gce_start_offset'] ); + $paging_type = esc_html( $_POST['gce_paging_type'] ); + + if( $paging_direction == 'back' ) { + if( $paging_type == 'month' ) { + + $this_month = mktime( 0, 0, 0, date( 'm', $start ) - 1, 1, date( 'Y', $start ) ); + $prev_month = mktime( 0, 0, 0, date( 'm', $start ) - 2, 1, date( 'Y', $start ) ); + $prev_interval_days = date( 't', $prev_month ); + $month_days = date( 't', $this_month ); + + $int = $month_days + $prev_interval_days; + $int = $int * 86400; + + $start = $start - ( $int ); + + $changed_month_days = date( 't', $start ); + $paging_interval = $changed_month_days * 86400; + } else { + $start = $start - ( $paging_interval * 2 ); + } + + } else { + if( $paging_type == 'month' ) { + $days_in_month = date( 't', $start ); + $paging_interval = 86400 * $days_in_month; + } + } + + $d = new GCE_Display( explode( '-', $ids ), $title_text, $sort ); + + echo $d->get_list( $grouped, $start, $paging, $paging_interval, $start_offset ); + + die(); +} +add_action( 'wp_ajax_nopriv_gce_ajax_list', 'gce_ajax_list' ); +add_action( 'wp_ajax_gce_ajax_list', 'gce_ajax_list' ); + + function gce_feed_content( $content ) { global $post; diff --git a/wp-content/plugins/google-calendar-events/includes/php-calendar.php b/wp-content/plugins/google-calendar-events/includes/php-calendar.php index 16f1ee1..70c4744 100644 --- a/wp-content/plugins/google-calendar-events/includes/php-calendar.php +++ b/wp-content/plugins/google-calendar-events/includes/php-calendar.php @@ -19,6 +19,12 @@ Changes made to original PHP Calendar script by me (Ross Hanney): function gce_generate_calendar( $year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array(), $widget = false ) { global $wp_locale; + + $paging = false; + + if( ! empty( $pn ) ) { + $paging = true; + } $first_of_month = mktime( 0, 0, 0, $month, 1, $year ); #remember that mktime will automatically correct if invalid dates are entered @@ -39,23 +45,27 @@ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length 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( $widget ) { + $p = '
' . ( ( $pl ) ? ( '' . $p . '' ) : $p ) . '
'; + } else { + $p = '
' . ( ( $pl ) ? ( '' . $p . '' ) : $p ) . '
'; } - if ( $n ) { - if( $widget ) { - $n = ' ' . ( ( $nl ) ? ( '' . $n . '' ) : $n ) . ''; - } else { - $n = ' ' . ( ( $nl ) ? ( 'Next ' . $n . '' ) : $n ) . ''; - } + if( $widget ) { + $n = '
' . ( ( $nl ) ? ( '' . $n . '' ) : $n ) . '
'; + } else { + $n = '
' . ( ( $nl ) ? ( '' . $n . '' ) : $n ) . '
'; } - $calendar = '' . "\n" . '\n"; + $calendar = '
' . $p . '' . ( ( $month_href ) ? ( '' . $title . '' ) : $title ) . '' . $n . "
' . "\n" . + '' . "\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 @@ -91,4 +101,4 @@ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length return $calendar . "\n
' . + '
' . + $p . + $n . + '
' . ( ( $month_href ) ? ( '' . $title . '' ) : $title ) . '
' . + '
' . + '
\n"; } -?> \ 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 index e43ee8a..e739478 100644 --- a/wp-content/plugins/google-calendar-events/includes/shortcodes.php +++ b/wp-content/plugins/google-calendar-events/includes/shortcodes.php @@ -9,7 +9,6 @@ * @copyright 2014 Phil Derksen */ - /** * Adds support for the new [gcal] shortcode * @@ -20,12 +19,16 @@ function gce_gcal_shortcode( $attr ) { extract( shortcode_atts( array( - 'id' => null, - 'display' => '', - 'max' => 0, - 'order' => 'asc', - 'title' => null, - 'type' => null, + 'id' => null, + 'display' => '', + 'order' => 'asc', + 'title' => null, + 'type' => null, + 'paging' => null, + 'interval' => null, + 'interval_count' => null, + 'offset_interval_count' => null, + 'offset_direction' => null ), $attr, 'gce_feed' ) ); // If no ID is specified then return @@ -33,7 +36,10 @@ function gce_gcal_shortcode( $attr ) { return; } - $feed_ids = explode( ',', $id ); + $paging_interval = null; + $max_events = null; + + $feed_ids = explode( ',', str_replace( ' ', '', $id ) ); foreach( $feed_ids as $k => $v ) { // Check for an old ID attached to this feed ID first @@ -49,6 +55,49 @@ function gce_gcal_shortcode( $attr ) { if( empty( $display ) ) { $display = get_post_meta( $v, 'gce_display_mode', true ); } + + if( $interval == null ) { + $interval = get_post_meta( $v, 'gce_list_max_length', true ); + } + + if( $interval_count == null ) { + $interval_count = get_post_meta( $v, 'gce_list_max_num', true ); + } + + if( $offset_interval_count == null ) { + $offset_interval_count = get_post_meta( $v, 'gce_list_start_offset_num', true ); + } + + if( $offset_direction == null ) { + $offset_direction = get_post_meta( $v, 'gce_list_start_offset_direction', true ); + } + + if( $paging == null ) { + $paging = get_post_meta( $v, 'gce_paging', true ); + } + } + + if( $paging == 'false' ) { + $paging = 0; + } else if( $paging == 'true' ) { + $paging = 1; + } + + + if( $offset_direction == 'back' ) { + $offset_direction = -1; + } else { + $offset_direction = 1; + } + + $start_offset = $offset_interval_count * 86400 * $offset_direction; + + if( $interval == 'days' ) { + $paging_interval = $interval_count * 86400; + $paging_type = 'days'; + } else if( $interval == 'events' ) { + $max_events = $interval_count; + $paging_type = 'events'; } // Port over old options @@ -59,17 +108,29 @@ function gce_gcal_shortcode( $attr ) { $display = $type; } } + + if( $display == 'grouped-list' ) { + $display = 'list-grouped'; + } $args = array( 'title_text' => $title, - 'max_events' => $max, 'sort' => $order, 'grouped' => ( $display == 'list-grouped' ? 1 : 0 ), 'month' => null, 'year' => null, - 'widget' => 0 + 'widget' => 0, + 'paging_interval' => $paging_interval, + 'max_events' => $max_events, + 'paging' => $paging ); + $args['start_offset'] = $start_offset; + + if( ! empty( $paging_type ) ) { + $args['paging_type'] = $paging_type; + } + $feed_ids = implode( '-', $feed_ids ); return gce_print_calendar( $feed_ids, $display, $args ); diff --git a/wp-content/plugins/google-calendar-events/js/admin.js b/wp-content/plugins/google-calendar-events/js/admin.js deleted file mode 100644 index 1dc7676..0000000 --- a/wp-content/plugins/google-calendar-events/js/admin.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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-script.js b/wp-content/plugins/google-calendar-events/js/gce-script.js index f8453dd..88cea4b 100644 --- a/wp-content/plugins/google-calendar-events/js/gce-script.js +++ b/wp-content/plugins/google-calendar-events/js/gce-script.js @@ -1,58 +1,106 @@ - -/** - * 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 + +/** + * Public JS functions + * + * @package GCE + * @author Phil Derksen , Nick Young + * @license GPL-2.0+ + * @copyright 2014 Phil Derksen + */ +(function($) { + 'use strict'; + + $(function() { + + gce_tooltips('.gce-has-events'); + + if( typeof gce_grid != 'undefined' ) { + + $('body').on( 'click', '.gce-change-month', function(e) { + + var id = $(this).closest('.gce-calendar').parent().attr('id'); + + e.preventDefault(); + + //Extract month and year + var month_year = $(this).attr('name').split('-', 2); + var paging = $(this).attr('data-gce-grid-paging'); + + //Add loading text to table caption + $('#' + gce_grid[id].target_element + ' caption').html('Loading...'); + //Send AJAX request + $.post(gce.ajaxurl,{ + action:'gce_ajax', + gce_type: gce_grid[id].type, + gce_feed_ids: gce_grid[id].feed_ids, + gce_title_text: gce_grid[id].title_text, + gce_widget_id: gce_grid[id].target_element, + gce_month: month_year[0], + gce_year: month_year[1], + gce_paging: paging, + gce_nonce: gce.ajaxnonce + }, function(data){ + //Replace existing data with returned AJAX data + if(gce_grid[id].type == 'widget'){ + $('#' + gce_grid[id].target_element).html(data); + }else{ + $('#' + gce_grid[id].target_element).replaceWith(data); + } + gce_tooltips('#' + gce_grid[id].target_element + ' .gce-has-events'); + }); + }); + } + + $('body').on( 'click', '.gce-change-month-list', function(e) { + + e.preventDefault(); + + var element = $(this); + + var start = $(this).parent().parent().parent().data('gce-start'); + var grouped = $(this).parent().parent().parent().data('gce-grouped'); + var title_text = $(this).parent().parent().parent().data('gce-title'); + var feed_ids = $(this).parent().parent().parent().data( 'gce-feeds'); + var sort = $(this).parent().parent().parent().data('gce-sort'); + var paging = $(this).parent().parent().parent().data('gce-paging'); + var paging_interval = $(this).parent().parent().parent().data('gce-paging-interval'); + var paging_direction = $(this).data('gce-paging-direction'); + var start_offset = $(this).parent().parent().parent().data('gce-start-offset'); + var paging_type = $(this).data('gce-paging-type'); + + //Add loading text to table caption + $(this).parent().parent().parent().find('.gce-month-title').html('Loading...'); + + //Send AJAX request + jQuery.post(gce.ajaxurl,{ + action:'gce_ajax_list', + gce_feed_ids:feed_ids, + gce_title_text:title_text, + gce_start: start, + gce_grouped: grouped, + gce_sort: sort, + gce_paging: paging, + gce_paging_interval: paging_interval, + gce_paging_direction: paging_direction, + gce_start_offset: start_offset, + gce_paging_type: paging_type, + gce_nonce: gce.ajaxnonce + }, function(data){ + element.parent().parent().parent().html(data); + }); + }); + + function gce_tooltips(target_items) { + $(target_items).each(function(){ + //Add qtip to all target items + $(this).qtip({ + content: $(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)) \ 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 26a8c77..1b9e74a 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='