Browse Source

update home page h-card parsing

pull/10/head
Aaron Parecki 9 years ago
parent
commit
01d6a25db7
2 changed files with 10 additions and 12 deletions
  1. +5
    -5
      composer.lock
  2. +5
    -7
      controllers/auth.php

+ 5
- 5
composer.lock View File

@ -91,16 +91,16 @@
},
{
"name": "indieauth/client",
"version": "0.1.7",
"version": "0.1.8",
"source": {
"type": "git",
"url": "https://github.com/indieweb/indieauth-client-php.git",
"reference": "dec4f2f77ddaab11b00537db0a5fe52cc0bc3296"
"reference": "f979f8ee0fc6daaa6a393e7afdac894000d09544"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/dec4f2f77ddaab11b00537db0a5fe52cc0bc3296",
"reference": "dec4f2f77ddaab11b00537db0a5fe52cc0bc3296",
"url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/f979f8ee0fc6daaa6a393e7afdac894000d09544",
"reference": "f979f8ee0fc6daaa6a393e7afdac894000d09544",
"shasum": ""
},
"require": {
@ -126,7 +126,7 @@
}
],
"description": "IndieAuth Client Library",
"time": "2014-10-06 06:25:22"
"time": "2014-10-06 07:37:10"
},
{
"name": "indieweb/date-formatter",

+ 5
- 7
controllers/auth.php View File

@ -64,12 +64,10 @@ function hostname($url) {
function add_hcard_info($user, $hCard) {
if($user && $hCard) {
// Update the user's h-card info if present
if(array_key_exists('name', $hCard)) {
$user->name = $hCard['name'];
}
if(array_key_exists('photo', $hCard)) {
$user->photo_url = $hCard['photo'];
}
if(BarnabyWalters\Mf2\hasProp($hCard, 'name'))
$user->name = BarnabyWalters\Mf2\getPlaintext($hCard, 'name');
if(BarnabyWalters\Mf2\hasProp($hCard, 'photo'))
$user->photo_url = BarnabyWalters\Mf2\getPlaintext($hCard, 'photo');
}
}
@ -107,7 +105,7 @@ $app->get('/auth/start', function() use($app) {
$authorizationEndpoint = IndieAuth\Client::discoverAuthorizationEndpoint($me);
$tokenEndpoint = IndieAuth\Client::discoverTokenEndpoint($me);
$micropubEndpoint = IndieAuth\Client::discoverMicropubEndpoint($me);
$hCard = IndieAuth\Client::getHCard($me);
$hCard = IndieAuth\Client::representativeHCard($me);
// Generate a "state" parameter for the request
$state = IndieAuth\Client::generateStateParameter();

Loading…
Cancel
Save