Skip to content

Commit

Permalink
Release/2.2.3 (#226)
Browse files Browse the repository at this point in the history
* Admin: Introduce Base_List_Table::get_week_for_timestamp(). (#220)
* Legacy: styling improvements for all Default themes. (#222)
* Legacy: more theme compatibility improvements. See #221.
* Add widgets.php to Legacy loader (#228)
* Legacy: add missing $order parameter to sc_get_events_list docs
* Legacy: rename $today variable to $now in sc_get_events_list().
* Load: add widgets.php to admin pages that load legacy files.
* WordPress 5.8 widget fixes, and "in progress" filter (#229)
* Legacy: add missing $order parameter to sc_get_events_list docs
* Legacy: rename $today variable to $now in sc_get_events_list().
* Load: add widgets.php to admin pages that load legacy files.
* Widgets: add support for WordPress 5.8, and "in-progress" status.
* Bump dependencies.
  • Loading branch information
JJJ authored Jul 23, 2021
1 parent 7155c47 commit 1dc7079
Show file tree
Hide file tree
Showing 16 changed files with 360 additions and 381 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
2 changes: 1 addition & 1 deletion sugar-calendar-lite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand All @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= '<br>' . $this->get_human_diff_time( $item->start, $item->end );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 1dc7079

Please sign in to comment.