Api::setCache(Files::mkdir(protected_path('cache/azure_translate')));
$translateAPI = new Api(env('AZURE_TRANSLATE_API_KEY'));
- $data = Json::decode($this->seo, Json::TYPE_ARRAY);
+ $data = $this->getTranslations('seo');
$data[$mainLocale] = $this->api['seo'];
$seoTranslateProps = ['og_title', 'og_description', 'seo_title', 'seo_description'];
foreach ($locales as $locale) {
}
}
-
$url = '/' . $url;
-
$seo = [
'id' => $pageID,
'url' => $url,
$html = str_replace('<br>', "\n", $html);
$texts = Html::getTextNodes($html);
self::addTexts($texts, $res['texts']);
+ // dump($url, $texts);
} else if ($node['type'] === 'image') {
if (!isset($node['image']['assetId'])) {
if (is_file($mirrorPath . $url)) {
$texts = Html::getTextNodes(file_get_contents($mirrorPath . $url));
self::addTexts($texts, $res['texts']);
+ // dump('--' . $url, $texts);
}
}
$texts = Html::getTextNodes($t);
}
self::addTexts($texts, $res['texts']);
+ //dump( $texts);
}
}
}
$this->addField('url', HiddenVisible::class, __('URL'));
$this->addField('type', HiddenVisible::class, __('Type'));
$this->addField('draft', Checkbox::class, __('Brouillon'), ['when' => ['type' => ['operator' => 'not', 'value' => 'page_html']]]);
- $this->addField('slug', Text::class, __('Slug') . ' (' . __('slug') . ')', ['when' => ['type' => 'page', 'url' => ['operator' => '!', 'value' => '/index.html']]]);
+ $this->addField('slug', Text::class, __('Slug') . ' (' . __('slug') . ')', ['when' => ['url' => ['operator' => '!', 'value' => '/index.html']]]);
$this->addField('seo_title', Text::class, __('Titre'), ['when' => ['type' => ['page', 'page_html']]]);
$this->addField('og_title_copied', Checkbox::class, __('Utiliser le titre ci-dessus pour les réseaux sociaux'), ['when' => ['type' => ['page_html', 'page']]]);
$this->addField('og_title', Text::class, __('Titre pour les réseaux sociaux'), ['when' => ['og_title_copied' => '0', 'type' => ['page_html', 'page']]]);