Plugin Directory

Changeset 712486


Ignore:
Timestamp:
05/13/2013 04:23:34 PM (13 years ago)
Author:
markpdxt
Message:

Fix date conversion issue

Location:
sync-facebook-events/tags/1.0.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sync-facebook-events/tags/1.0.8/readme.txt

    r634434 r712486  
    33Tags: facebook, events, synchronize, calendar
    44Requires at least: 3.0
    5 Tested up to: 3.4.2
     5Tested up to: 3.5.1
    66Stable tag: 1.0.8
    77
  • sync-facebook-events/tags/1.0.8/sync-facebook-events.php

    r634434 r712486  
    55Description: Sync Facebook Events to The Events Calendar Plugin
    66Author: Mark Nelson
    7 Version: 1.0.6
     7Version: 1.0.8
    88Author URI: http://pdxt.com
    99*/
    1010 
    11 /*  Copyright 2012 PDX Technologies, LLC. (mark.nelson@pdxt.com)
     11/*  Copyright 2013 PDX Technologies, LLC. (mark.nelson@pdxt.com)
    1212
    1313    This program is free software; you can redistribute it and/or modify
     
    6464        'cookie' => true,
    6565    ));
     66Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
     67Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;
    6668
    6769    $ret = array();
     
    103105        'posts_per_page'=>'-1'
    104106    ));
    105 
     107   
     108   
     109   
    106110    foreach($query->posts as $post) {
    107111        if(!empty($post->to_ping)) {
     
    110114            $eids[$eid] = $post->ID;
    111115        }
    112 //if you're reading this and you want to delete all those duplicate events, uncomment this temporarially. Note, it will also delete all manually made events since June 13
    113 //http://codex.wordpress.org/Version_3.4 - June 13, 2012
    114 //depending on many duplicates you had, you might end up re-loading this script a bunch of times after it times out. Me, I had 14k duplicates. Had to run the script like 10 times.
    115 /*
    116         else {
    117             $post_date = trim(substr($post->post_date, 0, 10));
    118             if($post->post_date > '2012-06-12')
    119                 wp_delete_post($post->ID);
    120         }
    121 */
    122116    }
    123117    //file_put_contents($_SERVER['DOCUMENT_ROOT'].'/fbevent.log', print_r(array(time(),$events,$eids),1)."\n".str_repeat('=',40)."\n", FILE_APPEND);
    124118   
    125119    foreach($events as $event) {
    126        
    127120        $args['post_title'] = $event['name'];
    128121       
    129122        $offset = get_option('gmt_offset')*3600;
    130123       
    131         $offsetStart = $event['start_time']+$offset;
     124        //$offsetStart = strtotime($event['start_time'])+$offset;
     125        $offsetStart =($event['start_time'])+$offset;
     126       
    132127        $offsetEnd = $event['end_time']+$offset;
    133128       
    134129        //don't update or insert events from the past.
    135         if($offsetEnd > time()) {
    136                
     130        if($offsetStart > time()) {
    137131            $args['EventStartDate'] = date("m/d/Y", $offsetStart);
    138132            $args['EventStartHour'] = date("H", $offsetStart);
     
    182176                //eid, name, start_time, end_time, location, description
    183177        }
    184         reset($eids);
     178        //reset($eids);
    185179    }
    186180}
     
    283277    <?php if(isset($events)) { ?>
    284278        <div style="margin-top:20px;font-size:14px;color:#444;border:1px solid #999;padding:15px;width:95%;font-face:couriernew;">
    285         <span style="color:red;">Updaing all facebook events...</span><br />
     279        <span style="color:red;">Updating all facebook events...</span><br />
    286280        <?php fbes_send_events($events); ?><br />
    287281        <span style="color:red;">Events Calendar updated with current Facebook events.</span><br /><br />
    288282        </div>
    289     <? } ?>
     283    <?php } ?>
    290284<?php   
    291285}
Note: See TracChangeset for help on using the changeset viewer.