1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 09:54:03 +00:00

Better function name

This commit is contained in:
Mischa Sigtermans 2024-08-23 20:04:57 +02:00 committed by GitHub
parent 50591bf706
commit f633d23755
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,7 +188,7 @@ class SEOManager
public function previewLinks(string $alias, int|string|array $data = null): string|static public function previewLinks(string $alias, int|string|array $data = null): string|static
{ {
if (is_string($data) || is_int($data)) { if (is_string($data) || is_int($data)) {
$this->meta("previewlinks.templates.$alias", (string) $data); $this->meta("previewlink.templates.$alias", (string) $data);
return $this; return $this;
} }
@ -208,7 +208,7 @@ class SEOManager
$query = base64_encode(json_encode($data, JSON_THROW_ON_ERROR)); $query = base64_encode(json_encode($data, JSON_THROW_ON_ERROR));
/** @var string $template */ /** @var string $template */
$template = $this->meta("previewlinks.templates.$alias"); $template = $this->meta("previewlink.templates.$alias");
$signature = hash_hmac('sha256', $query, config('services.previewlinks.key')); $signature = hash_hmac('sha256', $query, config('services.previewlinks.key'));
@ -337,10 +337,10 @@ class SEOManager
public function render(...$args): array|string|null public function render(...$args): array|string|null
{ {
// Flipp and PreviewLinks support more arguments // Flipp and PreviewLinks support more arguments
if (in_array($args[0], ['flipp', 'previewlinks'], true)) { if (in_array($args[0], ['flipp', 'previewlink'], true)) {
$method = array_shift($args); $method = array_shift($args);
// The `flipp` and `previewlinks` methods return image URLs // The `flipp` and `previewlink` methods return image URLs
// so we don't sanitize the returned value with e() here // so we don't sanitize the returned value with e() here
return $this->{$method}(...$args); return $this->{$method}(...$args);
} }
@ -353,7 +353,7 @@ class SEOManager
// An array means we don't return anything, e.g. `@seo(['title' => 'foo']) // An array means we don't return anything, e.g. `@seo(['title' => 'foo'])
if (is_array($args[0])) { if (is_array($args[0])) {
foreach ($args[0] as $type => $value) { foreach ($args[0] as $type => $value) {
if (in_array($type, ['flipp', 'previewlinks'], true)) { if (in_array($type, ['flipp', 'previewlink'], true)) {
$this->{$type}(...Arr::wrap($value)); $this->{$type}(...Arr::wrap($value));
} else { } else {
$this->set($type, $value); $this->set($type, $value);