Merge branch 'develop' into feature/activitystreams

This commit is contained in:
Jonny Barnes 2017-09-13 16:14:21 +01:00
commit 07328c26b7
3 changed files with 9 additions and 4 deletions

View file

@ -37,7 +37,7 @@ class NoteService
);
if (array_key_exists('published', $data) && empty($data['published']) === false) {
$carbon = new \Carbon\Carbon($data['published']);
$carbon = carbon($data['published']);
$note->created_at = $note->updated_at = $carbon->toDateTimeString();
}

View file

@ -5,7 +5,6 @@ namespace App;
use Cache;
use Twitter;
use HTMLPurifier;
use Carbon\Carbon;
use HTMLPurifier_Config;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Database\Eloquent\Model;
@ -63,10 +62,9 @@ class WebMention extends Model
public function getPublishedAttribute()
{
$microformats = json_decode($this->mf2, true);
$carbon = new Carbon();
if (isset($microformats['items'][0]['properties']['published'][0])) {
try {
$published = $carbon->parse(
$published = carbon()->parse(
$microformats['items'][0]['properties']['published'][0]
)->toDayDateTimeString();
} catch (\Exception $exception) {

View file

@ -204,3 +204,10 @@ if (! function_exists('prettyPrintJson')) {
return str_replace("\t", ' ', $result);
}
}
// sourced from https://twitter.com/jrubsc/status/907776591320764416/photo/1
if (! function_exists('carbon')) {
function carbon(...$args) {
return new Carbon\Carbon(...$args);
}
}