nettoyage module search

This commit is contained in:
Fred Tempez 2022-08-30 20:29:50 +02:00
parent e4916fa9cc
commit e0414c83dc
1 changed files with 5 additions and 10 deletions

View File

@ -217,7 +217,7 @@ class search extends common {
} }
// Articles d'une sous-page blog ou de news // Articles d'une sous-page blog ou de news
if ( $this->getData([ 'module', $childId, 'posts']) if ( $this->getData([ 'module', $childId, 'posts'])
) { ) {
foreach($this->getData(['module',$childId,'posts']) as $articleId => $article) { foreach($this->getData(['module',$childId,'posts']) as $articleId => $article) {
if($this->getData(['module',$childId,'posts',$articleId,'state']) === true) { if($this->getData(['module',$childId,'posts',$articleId,'state']) === true) {
@ -235,8 +235,8 @@ class search extends common {
} }
// Articles d'un blog ou de news // Articles d'un blog ou de news
if ( $this->getData([ 'module', $parentId, 'posts']) if ( $this->getData([ 'module', $parentId, 'posts'])
) { ) {
foreach($this->getData(['module',$parentId,'posts']) as $articleId => $article) { foreach($this->getData(['module',$parentId,'posts']) as $articleId => $article) {
if($this->getData(['module',$parentId,'posts',$articleId,'state']) === true) if($this->getData(['module',$parentId,'posts',$articleId,'state']) === true)
@ -273,8 +273,8 @@ class search extends common {
'view' => 'index', 'view' => 'index',
'showBarEditButton' => true, 'showBarEditButton' => true,
'showPageContent' => !$this->getData(['module', $this->getUrl(0), 'config', 'resultHideContent']), 'showPageContent' => !$this->getData(['module', $this->getUrl(0), 'config', 'resultHideContent']),
'style' => file_exists($this->getData(['module', $this->getUrl(0), 'theme', 'style'])) 'style' => file_exists($this->getData(['module', $this->getUrl(0), 'theme', 'style']))
? $this->getData(['module', $this->getUrl(0), 'theme', 'style']) ? $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
: '' : ''
]); ]);
} else { } else {
@ -337,9 +337,4 @@ class search extends common {
} }
} }
// Requête de traduction avec le script Google
private function translate($from_lan, $to_lan, $text) {
$arrayjson = json_decode(file_get_contents('https://translate.googleapis.com/translate_a/single?client=gtx&sl='.$from_lan.'&tl=fr&dt=t&q='.$text),true);
return $arrayjson[0][0][0];
}
} }