Plugin Directory

Changeset 1841072


Ignore:
Timestamp:
03/16/2018 12:37:15 AM (8 years ago)
Author:
esserq
Message:

Fixed date compare bug.

Location:
openmat
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • openmat/trunk/README.txt

    r1564790 r1841072  
    33Tags: bjj,jiujitsu,jiu,jitsu,brazilian,openmat,training,calendar,schedule,karate,taekwondoe,wrestling,yoga,krav,maga,martial arts,bjj
    44Requires at least: 4.7
    5 Tested up to: 4.7
    6 Stable tag: 1.0
     5Tested up to: 4.9
     6Stable tag: 1.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3636= 1.0 =
    3737* First version released
     38
     39= 1.1 =
     40* Fixed date compare bug
  • openmat/trunk/openmat.php

    r1564790 r1841072  
    22/*
    33Plugin Name: Openmat
    4 Plugin URI: http://blog.openmat.training/2016/12/28/openmat-wordpress-plugin/
     4Plugin URI: //blog.openmat.training/2016/12/28/openmat-wordpress-plugin/
    55Description: Display your training calendar as a widget.
    6 Version: 1.0
     6Version: 1.1
    77Author: B. Jordan
    88Author URI: https://openmat.training
     
    5050        $day = date('w',$now);
    5151       
    52         $week_start = date('d', strtotime('-'.$day.' days'));
    53         $week_end = date('d', strtotime('+'.(6-$day).' days'));
    54        
     52        $week_start = date("Y-m-d", strtotime('monday this week'));
     53        $week_end = date("Y-m-d", strtotime('sunday this week'));
     54       
    5555        $APIKey = get_option('openmat_api_key');
    5656        $sharedSecret = get_option('openmat_shared_secret');
     
    6464       
    6565        $weekly_schedule = array();
    66        
    6766        if( is_array($response) ) {
    6867            $header = $response['headers'];
     
    7978                foreach ($json_response->events as $event) {
    8079                   
    81                     if (($event->month == $month) &&
    82                         ($event->year == $year) &&
    83                         ($event->day >= $week_start) &&
    84                         ($event->day <= $week_end)){
    85                        
     80                    $event_ts = strtotime($event->year. '-' . $event->month . '-' . $event->day);
     81                    $event_date = date("Y-m-d", $event_ts);
     82                   
     83                    if ($event_date >= $week_start && $event_date <= $week_end) {
    8684                        $day = (date('l',strtotime($event->year.'/'.$event->month.'/'.$event->day)));
    87                        
    8885                        $weekly_schedule[$day][] = $event;
    8986                    }
Note: See TracChangeset for help on using the changeset viewer.