[JapanExpoBridge] code simplification + use checkbox instead of list
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
f13f44a682
commit
df80500c51
1 changed files with 19 additions and 24 deletions
|
@ -7,12 +7,8 @@ class JapanExpoBridge extends HttpCachingBridgeAbstract {
|
|||
public $description = 'Returns most recent entries from Japan Expo actualités.';
|
||||
public $parameters = array( array(
|
||||
'mode'=>array(
|
||||
'name'=>'Mode',
|
||||
'type'=>'list',
|
||||
'values'=>array(
|
||||
'Titles only'=>'light',
|
||||
'Full Contents'=>'full'
|
||||
)
|
||||
'name'=>'Show full contents',
|
||||
'type'=>'checkbox',
|
||||
)
|
||||
));
|
||||
|
||||
|
@ -46,9 +42,9 @@ class JapanExpoBridge extends HttpCachingBridgeAbstract {
|
|||
}
|
||||
};
|
||||
|
||||
$link = 'http://www.japan-expo-paris.com/fr/actualites';
|
||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request JapanExpo: '.$link);
|
||||
$fullcontent = (!empty($this->getInput('mode')) && $this->getInput('mode') == 'full');
|
||||
$html = $this->getSimpleHTMLDOM($this->uri)
|
||||
or $this->returnServerError('Could not request JapanExpo: '.$this->uri);
|
||||
$fullcontent = $this->getInput('mode');
|
||||
$count = 0;
|
||||
|
||||
foreach ($html->find('a._tile2') as $element) {
|
||||
|
@ -60,7 +56,9 @@ class JapanExpoBridge extends HttpCachingBridgeAbstract {
|
|||
$thumbnail = trim($img_search_result[1], "'");
|
||||
|
||||
if ($fullcontent) {
|
||||
if ($count < 5) {
|
||||
if ($count >= 5) {
|
||||
break;
|
||||
}
|
||||
if($this->get_cached_time($url) <= strtotime('-24 hours'))
|
||||
$this->remove_from_cache($url);
|
||||
|
||||
|
@ -73,9 +71,6 @@ class JapanExpoBridge extends HttpCachingBridgeAbstract {
|
|||
$article = $article_html->find('div.content', 0)->innertext;
|
||||
$article = preg_replace_callback('/<img [^>]+ style="[^\(]+\(\'([^\']+)\'[^>]+>/i', $convert_article_images, $article);
|
||||
$content = $headings.$article;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$date_text = $element->find('span.date', 0)->plaintext;
|
||||
$timestamp = french_pubdate_to_timestamp($date_text);
|
||||
|
|
Loading…
Reference in a new issue