This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
share = [[GooglePlusShare alloc] initWithClientID:clientId]; | |
share.delegate = self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@synthesize share; | |
.... | |
- (BOOL)application:(UIApplication *)application | |
openURL:(NSURL *)url | |
sourceApplication:(NSString *)sourceApplication | |
annotation:(id)annotation { | |
// Handle Google+ share dialog URL. | |
if ([share handleURL:url | |
sourceApplication:sourceApplication |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
{ | |
GooglePlusShare *share; | |
} | |
@property (strong, nonatomic) UIWindow *window; | |
@property (retain, nonatomic) GooglePlusShare *share; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSString *clientId = [AppDelegate clientId]; | |
share = [[GooglePlusShare alloc] initWithClientID:clientId]; | |
share.delegate = self; | |
AppDelegate *appDelegate = (AppDelegate *) | |
[[UIApplication sharedApplication] delegate]; | |
appDelegate.share = share; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new Google_Client(); | |
$client->setApplicationName("Oyster+"); | |
$client->setClientId('YOUR_CLIENT_ID_HERE'); | |
$client->setClientSecret('YOUR_CLIENT_SECRET_HERE'); | |
$client->setRedirectUri('http://localhost:8080/oyster'); | |
$client->setDeveloperKey('YOUR_DEVELOPER_KEY'); | |
$client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/plus.moments.write')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_GET['code'])) { | |
$client->authenticate(); | |
$_SESSION['access_token'] = $client->getAccessToken(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function write_moments_from_file($file, $client) { | |
$plus = new Google_PlusService($client); | |
$history = new Google_PlusMomentsService($client); | |
$log = array(); | |
$fh = fopen($file, 'r'); | |
while(($record = fgetcsv($fh)) && $record !== false) { | |
// Skip the header row |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function write_moments_from_file($file, $client) { | |
$plus = new Google_PlusService($client); | |
$history = new Google_PlusMomentsService($client); | |
$log = array(); | |
$fh = fopen($file, 'r'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
while(($record = fgetcsv($fh)) && $record !== false) { | |
// Skip the header row | |
if($record[0] === "Date") { | |
continue; | |
} | |
// Create the moment and target | |
$moment = new Google_Moment(); | |
$moment->setType("http://schemas.google.com/CheckInActivity"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Extract fields from the record | |
list($date, $start, $end, $journey, $rest) = $record; | |
// Extract dates | |
$startdt = strtotime($date . " " . $start); | |
$enddt = strtotime($date . " " . $end); | |
// If we cross over midnight | |
if($enddt < $startdt) { | |
$enddt = strtotime("+1 day", $enddt); |