diff --git a/package.json b/package.json index 89ebbf2f..8967595a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sugar-calendar", - "version": "2.2.2", + "version": "2.2.3", "description": "A calendar with a sweet disposition.", "private": true, "license": "GPL-2.0-or-later", @@ -30,7 +30,7 @@ "chosen-js": "^1.8.7" }, "devDependencies": { - "@babel/core": "^7.14.6", + "@babel/core": "^7.14.8", "@wordpress/babel-preset-default": "^4.20.0", "@wordpress/browserslist-config": "^2.7.0", "@wordpress/eslint-plugin": "^2.4.0", diff --git a/readme.txt b/readme.txt index f7e0e5bd..91d10c95 100644 --- a/readme.txt +++ b/readme.txt @@ -9,7 +9,7 @@ Tags: simple calendar, event calendar, event management, event list Requires PHP: 5.6.20 Requires at least: 5.5 Tested up to: 5.8 -Stable tag: 2.2.2 +Stable tag: 2.2.3 You can easily manage events with this lightweight calendar. No complicated configuration. Simple to use. Sweeeet! diff --git a/sugar-calendar-lite.php b/sugar-calendar-lite.php index 3703a1fc..ba98af6c 100644 --- a/sugar-calendar-lite.php +++ b/sugar-calendar-lite.php @@ -11,7 +11,7 @@ * Domain Path: /sugar-calendar/includes/languages/ * Requires PHP: 5.6.20 * Requires at least: 5.5 - * Version: 2.2.2 + * Version: 2.2.3 */ // Exit if accessed directly diff --git a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php index 9c7a5056..0632b1d6 100644 --- a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php +++ b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php @@ -166,7 +166,7 @@ class Base_List_Table extends \WP_List_Table { * * @var int */ - protected $today = ''; + protected $today = 0; /** * The time zone for the current view @@ -803,7 +803,7 @@ protected function get_item_color( $object ) { * * @since 2.0.0 * - * @return string + * @return int */ protected function get_current_time() { return sugar_calendar_get_request_time( 'timestamp', $this->timezone ); @@ -822,6 +822,19 @@ protected function get_start_of_week( $start = '1' ) { return (string) sugar_calendar_get_user_preference( 'sc_start_of_week', (string) $start ); } + /** + * Get the ISO-8601 week number for a Unix timestamp + * + * @since 2.3.0 + * + * @param int $timestamp + * + * @return string + */ + protected function get_week_for_timestamp( $timestamp = 0 ) { + return gmdate( 'W', strtotime( 'this thursday', (int) $timestamp ) ); + } + /** * Get the date format * diff --git a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-day.php b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-day.php index 7716e3df..134ec3eb 100644 --- a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-day.php +++ b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-day.php @@ -88,7 +88,7 @@ public function get_columns() { // Link text $string = esc_html_x( 'Week %s', 'Week number', 'sugar-calendar' ); - $week = gmdate( 'W', $this->today ); + $week = $this->get_week_for_timestamp( $this->today ); $text = sprintf( $string, $week ); // Return Week & Day diff --git a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-list.php b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-list.php index 1ef7751b..c93df8a8 100644 --- a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-list.php +++ b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-list.php @@ -467,7 +467,7 @@ public function column_duration( $item = null ) { if ( $item->is_all_day() ) { $retval = esc_html__( 'All Day', 'sugar-calendar' ); - // Maybe add duration if mulitple all-day days + // Maybe add duration if multiple all-day days if ( $item->is_multi() ) { $retval .= '
' . $this->get_human_diff_time( $item->start, $item->end ); } diff --git a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-month.php b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-month.php index 04bd2308..5a079924 100644 --- a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-month.php +++ b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-month.php @@ -131,10 +131,10 @@ protected function get_row_start() { $year = $start->format( 'Y' ); // Week for row - $week = $start->format( 'W' ); + $week = $this->get_week_for_timestamp( $start->format( 'U' ) ); // Calculate link to week view - $link_to_day = add_query_arg( array( + $link_to_day = add_query_arg( array( 'mode' => 'week', 'cy' => $year, 'cm' => $month, @@ -148,7 +148,7 @@ protected function get_row_start() { ); // Is this the current week? - if ( gmdate( 'W', $this->now ) === $week ) { + if ( $this->get_week_for_timestamp( $this->now ) === $week ) { $classes[] = 'this-week'; } diff --git a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-week.php b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-week.php index 9af88e3e..4e438bc1 100644 --- a/sugar-calendar/includes/admin/list-tables/class-wp-list-table-week.php +++ b/sugar-calendar/includes/admin/list-tables/class-wp-list-table-week.php @@ -44,7 +44,7 @@ public function __construct( $args = array() ) { $days = array_values( $this->get_week_days() ); $first_day = $days[ 0 ]; $last_day = $days[ count( $days ) - 1 ]; - $week_start = ( $this->start_of_week == gmdate( 'w', $this->today ) ); + $week_start = ( $this->start_of_week === gmdate( 'w', $this->today ) ); // Reset the week $where_is_thumbkin = ( true === $week_start ) @@ -85,7 +85,7 @@ public function get_columns() { // Link text $string = esc_html_x( 'Week %s', 'Week number', 'sugar-calendar' ); - $week = gmdate( 'W', $this->today ); + $week = $this->get_week_for_timestamp( $this->today ); $text = sprintf( $string, $week ); // Setup return value diff --git a/sugar-calendar/includes/languages/sugar-calendar.pot b/sugar-calendar/includes/languages/sugar-calendar.pot index 3d436554..48aecc65 100644 --- a/sugar-calendar/includes/languages/sugar-calendar.pot +++ b/sugar-calendar/includes/languages/sugar-calendar.pot @@ -2,9 +2,9 @@ # This file is distributed under the GNU General Public License v2 or later. msgid "" msgstr "" -"Project-Id-Version: Sugar Calendar (Lite) 2.2.2\n" +"Project-Id-Version: Sugar Calendar (Lite) 2.2.3\n" "Report-Msgid-Bugs-To: https://sugarcalendar.com\n" -"POT-Creation-Date: 2021-06-24 17:41:48+00:00\n" +"POT-Creation-Date: 2021-07-23 04:44:05+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -29,7 +29,6 @@ msgid "Verifying" msgstr "" #: sugar-calendar/includes/admin/assets.php:154 -#: sugar-calendar/includes/standard/license.php:752 msgid "Verify" msgstr "" @@ -38,14 +37,13 @@ msgid "Verifying..." msgstr "" #: sugar-calendar/includes/admin/assets.php:156 -#: sugar-calendar/includes/standard/license.php:580 msgid "Please enter a valid license key." msgstr "" #: sugar-calendar/includes/admin/general.php:229 #: sugar-calendar/includes/admin/help.php:34 #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:359 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2973 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2986 #: sugar-calendar/includes/admin/nav.php:22 msgid "Events" msgstr "" @@ -230,7 +228,7 @@ msgstr "" #: sugar-calendar/includes/admin/help.php:112 #: sugar-calendar/includes/admin/help.php:574 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2478 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2491 #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-list.php:468 #: sugar-calendar/includes/admin/meta-boxes.php:1050 #: sugar-calendar/includes/post/functions.php:132 @@ -344,7 +342,7 @@ msgstr "" #: sugar-calendar/includes/admin/help.php:213 #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:420 -#: sugar-calendar/includes/themes/legacy/calendar.php:141 +#: sugar-calendar/includes/themes/legacy/calendar.php:154 msgid "Month" msgstr "" @@ -391,7 +389,7 @@ msgid "28 through 31" msgstr "" #: sugar-calendar/includes/admin/help.php:261 -#: sugar-calendar/includes/themes/legacy/calendar.php:152 +#: sugar-calendar/includes/themes/legacy/calendar.php:165 msgid "Year" msgstr "" @@ -731,99 +729,99 @@ msgstr "" msgid "List" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:1644 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:1657 msgid "(No title)" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2044 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2057 msgid "Restore" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2049 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2062 msgid "Delete Permanently" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2357 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2367 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2370 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2380 #: sugar-calendar/includes/admin/meta-boxes.php:112 msgid "Details" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2358 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2371 msgid "Password protected" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2456 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2463 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2470 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2494 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2501 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2508 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2532 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2469 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2476 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2483 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2507 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2514 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2521 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2545 #: sugar-calendar/includes/admin/meta-boxes.php:1063 msgid "Start" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2458 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2465 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2472 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2496 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2503 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2510 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2551 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2471 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2478 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2485 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2509 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2516 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2523 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2564 #: sugar-calendar/includes/admin/meta-boxes.php:1126 msgid "End" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2627 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2640 #: sugar-calendar/includes/admin/meta-boxes/class-wp-meta-box.php:86 #: sugar-calendar/includes/admin/meta-boxes.php:1246 msgid "Location" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2990 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3003 msgid "Search Events." msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2991 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3004 #: sugar-calendar/includes/post/types.php:73 msgid "Search events..." msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3446 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3459 msgid "Filter by %s" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3506 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3519 msgid "Switch to this month" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3522 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3535 msgid "Set the day" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3537 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3550 msgid "Set the first year" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3540 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3553 #: sugar-calendar/includes/themes/legacy/event-display.php:221 msgid "to" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3542 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3555 msgid "Set the last year" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3550 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3563 msgid "Set the year" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3577 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3590 msgid "Empty Trash" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3614 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3627 #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-day.php:115 #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-list.php:553 #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-month.php:320 @@ -831,23 +829,23 @@ msgstr "" msgid "Today" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3615 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3628 msgid "Next month" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3616 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3629 msgid "Next year" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3617 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3630 msgid "Previous month" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3618 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3631 msgid "Previous year" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3684 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3697 #: sugar-calendar/includes/admin/settings.php:549 #: sugar-calendar/includes/admin/settings.php:606 msgid "Options" @@ -875,7 +873,7 @@ msgstr "" #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-week.php:234 #: sugar-calendar/includes/admin/meta-boxes.php:1056 #: sugar-calendar/includes/themes/legacy/event-display.php:145 -#: sugar-calendar/includes/themes/legacy/events-list.php:144 +#: sugar-calendar/includes/themes/legacy/events-list.php:163 msgid "All-day" msgstr "" @@ -919,7 +917,7 @@ msgstr "" #: sugar-calendar/includes/admin/menu.php:34 #: sugar-calendar/includes/admin/menu.php:35 #: sugar-calendar/includes/post/taxonomies.php:41 -#: sugar-calendar/includes/themes/legacy/calendar.php:163 +#: sugar-calendar/includes/themes/legacy/calendar.php:176 msgid "Calendar" msgstr "" @@ -1556,207 +1554,15 @@ msgstr "" msgid "Event scheduled." msgstr "" -#: sugar-calendar/includes/standard/beta-updates.php:40 -msgid "Updates" -msgstr "" - -#: sugar-calendar/includes/standard/beta-updates.php:74 -msgid "Software Updates" -msgstr "" - -#: sugar-calendar/includes/standard/beta-updates.php:79 -msgid "Get Beta Versions" -msgstr "" - -#: sugar-calendar/includes/standard/beta-updates.php:82 -msgid "Receive update notifications about beta versions instead." -msgstr "" - -#: sugar-calendar/includes/standard/duplicate.php:29 -msgid "Invalid item ID." -msgstr "" - -#: sugar-calendar/includes/standard/duplicate.php:34 -#: sugar-calendar/includes/standard/duplicate.php:57 -msgid "Sorry, this item cannot be copied." -msgstr "" - -#: sugar-calendar/includes/standard/duplicate.php:48 -msgid "The item you are trying to copy no longer exists." -msgstr "" - -#: sugar-calendar/includes/standard/duplicate.php:62 -msgid "Sorry, you are not allowed to copy this item." -msgstr "" - -#: sugar-calendar/includes/standard/duplicate.php:70 -msgid "This post does not have event data." -msgstr "" - -#: sugar-calendar/includes/standard/duplicate.php:87 -#: sugar-calendar/includes/standard/duplicate.php:99 -msgid "Error copying the item." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:271 -msgid "License" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:546 -msgid "This is a lifetime license. That is amazing!" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:552 -msgid " until: " -msgstr "" - -#: sugar-calendar/includes/standard/license.php:581 -msgid "Empty" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:588 -msgid "This license key is valid%s." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:589 -msgid "Valid" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:596 -msgid "This license key is expired" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:597 -msgid "Expired" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:604 -#: sugar-calendar/includes/standard/license.php:612 -msgid "This license key is disabled." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:605 -msgid "Disabled" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:613 -msgid "Revoked" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:620 -msgid "This license key is not valid." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:621 -#: sugar-calendar/includes/standard/license.php:669 -msgid "Invalid" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:628 -#: sugar-calendar/includes/standard/license.php:636 -#: sugar-calendar/includes/standard/license.php:652 -msgid "This license key is saved but has not been verified." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:629 -#: sugar-calendar/includes/standard/license.php:637 -#: sugar-calendar/includes/standard/license.php:653 -msgid "Site Inactive" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:644 -msgid "This license key could not be deactivated." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:645 -msgid "Failed" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:660 -#: sugar-calendar/includes/standard/license.php:668 -msgid "This license key appears to be for another product." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:661 -msgid "Mismatch" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:676 -msgid "This license key has reached its activation limit." -msgstr "" - -#: sugar-calendar/includes/standard/license.php:677 -msgid "Out of Activations" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:738 -msgid "License Key" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:739 -msgid "Enter a valid license key to enable automatic updates" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:742 -msgid "" -"Look for your license key in your SugarCalendar.com account. " -"Don't have one? Purchase one " -"today!" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:753 -msgid "Deactivate" -msgstr "" - -#: sugar-calendar/includes/standard/license.php:758 -msgid "Refresh Status" -msgstr "" - -#: sugar-calendar/includes/standard/recurring.php:93 -msgid "Recurrence" -msgstr "" - -#: sugar-calendar/includes/standard/recurring.php:129 -msgid "Repeat" -msgstr "" - -#: sugar-calendar/includes/standard/recurring.php:134 -#: sugar-calendar/includes/standard/recurring.php:156 -msgid "Never" -msgstr "" - -#: sugar-calendar/includes/standard/recurring.php:152 -msgid "End Repeat" -msgstr "" - -#: sugar-calendar/includes/standard/updater.php:238 -msgid "There is a new version of %1$s available. %2$sView version %3$s details%4$s." -msgstr "" - -#: sugar-calendar/includes/standard/updater.php:246 -msgid "" -"There is a new version of %1$s available. %2$sView version %3$s details%4$s " -"or %5$supdate now%6$s." -msgstr "" - -#: sugar-calendar/includes/standard/updater.php:489 -msgid "You do not have permission to install plugin updates" -msgstr "" - -#: sugar-calendar/includes/standard/updater.php:489 -msgid "Error" -msgstr "" - -#: sugar-calendar/includes/themes/legacy/calendar.php:166 +#: sugar-calendar/includes/themes/legacy/calendar.php:179 msgid "Go" msgstr "" -#: sugar-calendar/includes/themes/legacy/calendar.php:312 +#: sugar-calendar/includes/themes/legacy/calendar.php:326 msgid "Previous" msgstr "" -#: sugar-calendar/includes/themes/legacy/calendar.php:325 +#: sugar-calendar/includes/themes/legacy/calendar.php:339 msgid "Next" msgstr "" @@ -1772,7 +1578,7 @@ msgstr "" msgid "Location:" msgstr "" -#: sugar-calendar/includes/themes/legacy/events-list.php:187 +#: sugar-calendar/includes/themes/legacy/events-list.php:206 msgid "Read More" msgstr "" @@ -1811,7 +1617,7 @@ msgstr "" #: sugar-calendar/includes/themes/legacy/widgets.php:159 #: sugar-calendar/includes/themes/legacy/widgets.php:354 #: sugar-calendar/includes/themes/legacy/widgets.php:511 -#: sugar-calendar/includes/themes/legacy/widgets.php:617 +#: sugar-calendar/includes/themes/legacy/widgets.php:686 msgid "Title:" msgstr "" @@ -1866,7 +1672,7 @@ msgid "Past" msgstr "" #: sugar-calendar/includes/themes/legacy/widgets.php:367 -#: sugar-calendar/includes/themes/legacy/widgets.php:578 +#: sugar-calendar/includes/themes/legacy/widgets.php:646 msgid "Order:" msgstr "" @@ -1910,24 +1716,28 @@ msgstr "" msgid "Event Archive only. Controls for filtering how to list events." msgstr "" -#: sugar-calendar/includes/themes/legacy/widgets.php:574 -msgid "View all events" +#: sugar-calendar/includes/themes/legacy/widgets.php:639 +msgid "Upcoming events" msgstr "" -#: sugar-calendar/includes/themes/legacy/widgets.php:575 -msgid "View upcoming events" +#: sugar-calendar/includes/themes/legacy/widgets.php:640 +msgid "In-progress events" msgstr "" -#: sugar-calendar/includes/themes/legacy/widgets.php:576 -msgid "View past events" +#: sugar-calendar/includes/themes/legacy/widgets.php:641 +msgid "Past events" msgstr "" -#: sugar-calendar/includes/themes/legacy/widgets.php:579 -msgid "ASC" +#: sugar-calendar/includes/themes/legacy/widgets.php:642 +msgid "All events" msgstr "" -#: sugar-calendar/includes/themes/legacy/widgets.php:581 -msgid "DESC" +#: sugar-calendar/includes/themes/legacy/widgets.php:647 +msgid "Newest first" +msgstr "" + +#: sugar-calendar/includes/themes/legacy/widgets.php:649 +msgid "Oldest first" msgstr "" #: sugar-calendar/requirements-check.php:202 @@ -1954,47 +1764,42 @@ msgstr "" msgid "A calendar with a sweet disposition." msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:1372 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:1385 msgctxt "List table: all statuses (excluding trash)" msgid "All (%s)" msgid_plural "All (%s)" msgstr[0] "" msgstr[1] "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2057 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2070 msgctxt "verb" msgid "Edit" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2062 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2075 msgctxt "verb" msgid "Trash" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2067 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3573 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2080 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3586 msgctxt "verb" msgid "View" msgstr "" -#: sugar-calendar/includes/standard/duplicate.php:136 -msgctxt "verb" -msgid "Duplicate" -msgstr "" - -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2406 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2426 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2419 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2439 msgctxt "Time Time Zone" msgid "%s %s" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2522 -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2541 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2535 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2554 msgctxt "20:00 on Friday" msgid "%s on %s" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2563 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2576 #: sugar-calendar/includes/admin/list-tables/class-wp-list-table-list.php:233 msgctxt "Noun" msgid "Repeats" @@ -2020,22 +1825,22 @@ msgctxt "Noun" msgid "Duration" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2572 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2585 msgctxt "Weekly from December 1, 2030 until December 31, 2030" msgid "%s from %s until %s" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2583 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2596 msgctxt "Weekly forever, starting May 15, 1980" msgid "%s starting %s" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2592 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:2605 msgctxt "Weekly forever" msgid "%s" msgstr "" -#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3494 +#: sugar-calendar/includes/admin/list-tables/class-wp-list-table-base.php:3507 msgctxt "Verb" msgid "Filter" msgstr "" @@ -2092,17 +1897,12 @@ msgctxt "event" msgid "Add New" msgstr "" -#: sugar-calendar/includes/standard/duplicate.php:77 -msgctxt "noun" -msgid "Copy" -msgstr "" - -#: sugar-calendar/includes/themes/legacy/calendar.php:241 +#: sugar-calendar/includes/themes/legacy/calendar.php:255 msgctxt "Previous month" msgid "Previous" msgstr "" -#: sugar-calendar/includes/themes/legacy/calendar.php:253 +#: sugar-calendar/includes/themes/legacy/calendar.php:267 msgctxt "Next month" msgid "Next" msgstr "" diff --git a/sugar-calendar/includes/post/query-filters.php b/sugar-calendar/includes/post/query-filters.php index 4ba0bfa1..a87572ce 100644 --- a/sugar-calendar/includes/post/query-filters.php +++ b/sugar-calendar/includes/post/query-filters.php @@ -46,8 +46,16 @@ function sc_modify_events_archive( $query = false ) { // Events table alias $alias = 'sce'; - // Get today, to query before/after - $today = gmdate( 'Y-m-d 00:00:00' ); + // Get timezone + $timezone = sugar_calendar_get_timezone_object( sc_get_timezone() ); + + // Get time, to query before/after/in-progress + $time = ! empty( $_GET['event-time'] ) + ? absint( urldecode( $_GET['event-time'] ) ) + : gmdate( 'Y-m-d H:i:s' ); + + // Get datetime + $datetime = sugar_calendar_get_datetime_object( $time, 'UTC', $timezone ); // Display argument $display_arg = ! empty( $_GET[ 'event-display' ] ) @@ -73,11 +81,11 @@ function sc_modify_events_archive( $query = false ) { $query->set( 'post_type', $post_type ); // Custom query args - $query->set( '_sc_alias', $alias ); - $query->set( '_sc_today', $today ); - $query->set( '_sc_object', $post_type ); - $query->set( '_sc_order', $order_arg ); - $query->set( '_sc_display', $display_arg ); + $query->set( '_sc_datetime', $datetime ); + $query->set( '_sc_alias', $alias ); + $query->set( '_sc_object', $post_type ); + $query->set( '_sc_order', $order_arg ); + $query->set( '_sc_display', $display_arg ); // Add query filters add_filter( 'posts_where', 'sc_modify_events_archive_where', 10, 2 ); @@ -103,23 +111,32 @@ function sc_modify_events_archive( $query = false ) { */ function sc_modify_events_archive_where( $where = '', $query = false ) { - // Get the query args - $alias = $query->get( '_sc_alias' ); - $today = $query->get( '_sc_today' ); - $display = $query->get( '_sc_display' ); + // Get the alias + $alias = $query->get( '_sc_alias' ); - // Bail if no var + // Bail if no alias if ( empty( $alias ) ) { return $where; } - // Upcoming - if ( 'upcoming' === $display ) { - $where .= " AND {$alias}.start >= '{$today}'"; + // Get the other args + $datetime = $query->get( '_sc_datetime' ); + $display = $query->get( '_sc_display' ); + + // Get the time + $time = $datetime->format( 'Y-m-d H:i:s' ); + + // In-Progress + if ( 'in-progress' === $display ) { + $where .= " AND ( {$alias}.start <= '{$time}' AND {$alias}.end >= '{$time}' )"; - // Past + // Upcoming (includes in-progress) + } elseif ( 'upcoming' === $display ) { + $where .= " AND {$alias}.end >= '{$time}'"; + + // Past (excludes in-progress) } elseif ( 'past' === $display ) { - $where .= " AND {$alias}.start <= '{$today}'"; + $where .= " AND {$alias}.end <= '{$time}'"; } // Return new where @@ -141,15 +158,17 @@ function sc_modify_events_archive_where( $where = '', $query = false ) { function sc_modify_events_archive_join( $join = '', $query = false ) { global $wpdb; - // Get the query args + // Get the alias arg $alias = $query->get( '_sc_alias' ); - $pt = $query->get( '_sc_object' ); // Bail if no var if ( empty( $alias ) ) { return $join; } + // Get the object type + $pt = $query->get( '_sc_object' ); + // Add a right join $join .= " RIGHT JOIN {$wpdb->sc_events} AS {$alias} ON ({$wpdb->posts}.ID = {$alias}.object_id AND {$alias}.object_type = 'post' AND {$alias}.object_subtype = '{$pt}')"; @@ -171,15 +190,17 @@ function sc_modify_events_archive_join( $join = '', $query = false ) { */ function sc_modify_events_archive_orderby( $orderby = '', $query = false ) { - // Get the query args + // Get the alias arg $alias = $query->get( '_sc_alias' ); - $order = $query->get( '_sc_order' ); // Bail if no var if ( empty( $alias ) ) { return $orderby; } + // Get the order arg + $order = $query->get( '_sc_order' ); + // Replace orderby $orderby = "{$alias}.start {$order}"; diff --git a/sugar-calendar/includes/themes/legacy/calendar.php b/sugar-calendar/includes/themes/legacy/calendar.php index 4b07c44d..0b0959fd 100644 --- a/sugar-calendar/includes/themes/legacy/calendar.php +++ b/sugar-calendar/includes/themes/legacy/calendar.php @@ -134,9 +134,22 @@ function sc_get_events_calendar( $size = 'large', $category = null, $type = 'mon do_action( 'sc_before_calendar' ); ?> -
-
-
+
+