[JapanExpoBridge] Remove nested function

This commit is contained in:
Lyra 2019-10-03 21:45:51 +02:00
parent 4622d9be1e
commit 3dae4e0801

View file

@ -19,28 +19,6 @@ class JapanExpoBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
function frenchPubDateToTimestamp($date_to_parse) {
return strtotime(
strtr(
strtolower(str_replace('Publié le ', '', $date_to_parse)),
array(
'janvier' => 'jan',
'février' => 'feb',
'mars' => 'march',
'avril' => 'apr',
'mai' => 'may',
'juin' => 'jun',
'juillet' => 'jul',
'août' => 'aug',
'septembre' => 'sep',
'octobre' => 'oct',
'novembre' => 'nov',
'décembre' => 'dec'
)
)
);
}
$convert_article_images = function($matches){ $convert_article_images = function($matches){
if(is_array($matches) && count($matches) > 1) { if(is_array($matches) && count($matches) > 1) {
return '<img src="' . $matches[1] . '" />'; return '<img src="' . $matches[1] . '" />';
@ -82,7 +60,7 @@ class JapanExpoBridge extends BridgeAbstract {
$content = $headings . $article; $content = $headings . $article;
} else { } else {
$date_text = $element->find('span.date', 0)->plaintext; $date_text = $element->find('span.date', 0)->plaintext;
$timestamp = frenchPubDateToTimestamp($date_text); $timestamp = $this->frenchPubDateToTimestamp($date_text);
$title = trim($element->find('span._title', 0)->plaintext); $title = trim($element->find('span._title', 0)->plaintext);
$content = '<img src="' $content = '<img src="'
. $thumbnail . $thumbnail
@ -103,4 +81,26 @@ class JapanExpoBridge extends BridgeAbstract {
$count++; $count++;
} }
} }
private function frenchPubDateToTimestamp($date_to_parse) {
return strtotime(
strtr(
strtolower(str_replace('Publié le ', '', $date_to_parse)),
array(
'janvier' => 'jan',
'février' => 'feb',
'mars' => 'march',
'avril' => 'apr',
'mai' => 'may',
'juin' => 'jun',
'juillet' => 'jul',
'août' => 'aug',
'septembre' => 'sep',
'octobre' => 'oct',
'novembre' => 'nov',
'décembre' => 'dec'
)
)
);
}
} }