Remove deprecated global helper functions (issue #99)

Squashed commit of the following:

commit 8ff29a8ab51ee5057ef786614ab95b005bf8918c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Feb 1 18:42:05 2019 +0000

    Replace deprecated global helpers with their facade equivalents
This commit is contained in:
Jonny Barnes 2019-02-01 18:49:35 +00:00
parent 7a4ba43b4d
commit fb44afd7ad
15 changed files with 104 additions and 90 deletions

View file

@ -6,6 +6,7 @@ namespace App\Jobs;
use App\Models\Like;
use GuzzleHttp\Client;
use Illuminate\Support\Arr;
use Illuminate\Bus\Queueable;
use Thujohn\Twitter\Facades\Twitter;
use Illuminate\Queue\SerializesModels;
@ -69,15 +70,15 @@ class ProcessLike implements ShouldQueue
$response = $client->request('GET', $this->like->url);
$mf2 = \Mf2\parse((string) $response->getBody(), $this->like->url);
if (array_has($mf2, 'items.0.properties.content')) {
if (Arr::has($mf2, 'items.0.properties.content')) {
$this->like->content = $mf2['items'][0]['properties']['content'][0]['html'];
}
try {
$author = $authorship->findAuthor($mf2);
if (is_array($author)) {
$this->like->author_name = array_get($author, 'properties.name.0');
$this->like->author_url = array_get($author, 'properties.url.0');
$this->like->author_name = Arr::get($author, 'properties.name.0');
$this->like->author_url = Arr::get($author, 'properties.url.0');
}
if (is_string($author) && $author !== '') {
$this->like->author_name = $author;

View file

@ -6,6 +6,7 @@ namespace App\Jobs;
use App\Models\Note;
use GuzzleHttp\Client;
use Illuminate\Support\Str;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@ -66,7 +67,7 @@ class SendWebMentions implements ShouldQueue
if (parse_url($url, PHP_URL_HOST) == config('app.longurl')) {
return;
}
if (starts_with($url, '/notes/tagged/')) {
if (Str::startsWith($url, '/notes/tagged/')) {
return;
}