Merge branch 'develop' into feature/activitystreams
This commit is contained in:
commit
07328c26b7
3 changed files with 9 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue