<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
/**
 * CodeIgniter Google Calendar Library 
 * 
 * Author: <NAME> (http://www.seanmcgary.com), <EMAIL>
 *
 * ========================================================
 * REQUIRES: php5, ZendGdata
 * ========================================================
 * 
 * VERSION: Beta 1.0 (2009-06-15)
 * LICENSE: GNU GENERAL PUBLIC LICENSE - Version 2, June 1991
 * 
 **/
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
 
class Gcal {

    // fire up the Zend Loader
    
    // we are going to assume that you have a path in
    // your php.ini set to look for the ZendGdata library
    // if you dont, then do the following:
    //
    // require_once 'path/to/ZendGdata/library';
    
    
	
	function getAuthSubUrl($redirectUrl){	
		// indicates the app will only access Google Calendar feeds
		$scope = 'http://www.google.com/calendar/feeds';
		$secure = false; // if you are registered with SubAuth, then this can be true
		$session = true;
		return Zend_Gdata_AuthSub::getAuthSubTokenUri($redirectUrl, $scope, $secure, $session);	
	}
	
	
	function clientLogin($username, $password){
		$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; 
		$client = Zend_Gdata_ClientLogin::getHttpClient($username,$password,$service);
		
		return $client;
	}
	
	function outputCalendarList($client){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$calFeed = $gdataCal->getCalendarListFeed();
		
		return $calFeed;
	}
	
	function outputCalendarEvents($client){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$eventFeed = $gdataCal->getCalendarEventFeed();
		
		return $eventFeed;
	}
	
	function calEventsByDateRange($client, $startDate, $endDate){
		$gdataCal = Zend_Gdata_Calendar($client);
		$query = $gdataCal->newEventQuery();
		$query->setUser('default');
		$query->setVisibility('private');
		$query->setProjection('full');
		$query->setOrderby('starttime');
		$query->setStartMin($startDate);
		$query->setStartMax($endDate);
		
		$eventFeed = $gdataCal->getCalendarEventFeed($query);
		
		return $eventFeed;
	}
	
	function calFullTextQuery($client, $eventQuery){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$query = $gdataCal->newEventQuery();
		$query->setUser('default');
		$query->setVisibility('private');
		$query->setProjection('full');
		$query->setQuery($eventQuery);
		$eventFeed = $gdataCal->getCalendarEventFeed($query);
	}
	
	function createEvent($client, $eventArray){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$newEvent = $gdataCal->newEventEntry();
		
		$newEvent->title = $gdataCal->newTitle($eventArray['title']);
		$newEvent->where = array($gdataCal->newWhere($eventArray['where']));
		$newEvent->content = $gdataCal->newContent($eventArray['desc']);
		
		$when = $gdataCal->newWhen();
		$when->startTime = "{$eventArray['startDate']}T{$eventArray['startTime']}:00.000{$eventArray['tzOffset']}:00";
		$when->endTime = "{$eventArray['endDate']}T{$eventArray['endTime']}:00.000{$eventArray['tzOffset']}:00";
		$newEvent->when = array($when);
		
		//upload the even to the calendar server
		//a copy of the event as it is recorded on the server is returned
		$createdEvent = $gdataCal->insertEvent($newEvent);
		return $createdEvent->id->text;
		
	}
	
	function createQuickEvent($clientr, $quickAddText){
		$gdataCal = new Zend_Gdata_Calendar($client);<commit_msg>fixed all known typographical errors. Works with example controller<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
/**
 * CodeIgniter Google Calendar Library 
 * 
 * Author: <NAME> (http://www.seanmcgary.com), <EMAIL>
 *
 * ========================================================
 * REQUIRES: php5, ZendGdata
 * ========================================================
 * 
 * VERSION: Beta 1.0 (2009-06-15)
 * LICENSE: GNU GENERAL PUBLIC LICENSE - Version 2, June 1991
 * 
 **/
// fire up the Zend Loader
// we are going to assume that you have a path in
// your php.ini set to look for the ZendGdata library
// if you dont, then do the following:
//
// require_once 'path/to/ZendGdata/library';
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
 
class Gcal {

    
    
    
	
	function getAuthSubUrl($redirectUrl){	
		// indicates the app will only access Google Calendar feeds
		$scope = 'http://www.google.com/calendar/feeds';
		$secure = false; // if you are registered with SubAuth, then this can be true
		$session = true;
		return Zend_Gdata_AuthSub::getAuthSubTokenUri($redirectUrl, $scope, $secure, $session);	
	}
	
	
	function clientLogin($username, $password){
		$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; 
		$client = Zend_Gdata_ClientLogin::getHttpClient($username,$password,$service);
		
		return $client;
	}
	
	function outputCalendarList($client){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$calFeed = $gdataCal->getCalendarListFeed();
		
		return $calFeed;
	}
	
	function outputCalendarEvents($client){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$eventFeed = $gdataCal->getCalendarEventFeed();
		
		return $eventFeed;
	}
	
	function calEventsByDateRange($client, $startDate, $endDate){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$query = $gdataCal->newEventQuery();
		$query->setUser('default');
		$query->setVisibility('private');
		$query->setProjection('full');
		$query->setOrderby('starttime');
		$query->setStartMin($startDate);
		$query->setStartMax($endDate);
		
		$eventFeed = $gdataCal->getCalendarEventFeed($query);
		
		return $eventFeed;
	}
	
	function calFullTextQuery($client, $eventQuery){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$query = $gdataCal->newEventQuery();
		$query->setUser('default');
		$query->setVisibility('private');
		$query->setProjection('full');
		$query->setQuery($eventQuery);
		$eventFeed = $gdataCal->getCalendarEventFeed($query);
		return $eventFeed;
	}
	
	function createEvent($client, $eventArray){
		$gdataCal = new Zend_Gdata_Calendar($client);
		$newEvent = $gdataCal->newEventEntry();
		
		$newEvent->title = $gdataCal->newTitle($eventArray['title']);
		$newEvent->where = array($gdataCal->newWhere($eventArray['where']));
		$newEvent->content = $gdataCal->newContent($eventArray['desc']);
		
		$when = $gdataCal->newWhen();
		$when->startTime = "{$eventArray['startDate']}T{$eventArray['startTime']}:00.000{$eventArray['tzOffset']}:00";
		$when->endTime = "{$eventArray['endDate']}T{$eventArray['endTime']}:00.000{$eventArray['tzOffset']}:00";
		$newEvent->when = array($when);
		
		//upload the even to the calendar server
		//a copy of the event as it is recorded on the server is returned
		$createdEvent = $gdataCal->insertEvent($newEvent);
		return $createdEvent->id->text;
		
	}
	
	function createQuickEvent($client, $quickAddText){
		$gdataCal = new Zend_Gdata_Calendar($client);
{'fraction_non_alphanumeric': 0.18272192663119574, 'fraction_numerical': 0.008401008120974517, 'mean_word_length': 5.383378016085791, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1098012', 'n_tokens_mistral': 2523, 'n_tokens_neox': 2243, 'n_words': 448}