diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php index 0a213fec..6d170312 100644 --- a/bridges/KonachanBridge.php +++ b/bridges/KonachanBridge.php @@ -1,46 +1,11 @@ array( - 'name'=>'page', - 'defaultValue'=>1, - 'type'=>'number' - ), - 't'=>array('name'=>'tags') - )); - - public function collectData(){ - $html = $this->getSimpleHTMLDOM( - self::URI.'/post?' - .'&page='.$this->getInput('p') - .'&tags='.urlencode($this->getInput('t')) - ) or $this->returnServerError('Could not request Konachan.'); - - $input_json = explode('Post.register(', $html); - foreach($input_json as $element) - $data[] = preg_replace('/}\)(.*)/', '}', $element); - unset($data[0]); - - foreach($data as $datai) { - $json = json_decode($datai, TRUE); - $item = array(); - $item['uri'] = self::URI.'/post/show/'.$json['id']; - $item['postid'] = $json['id']; - $item['timestamp'] = $json['created_at']; - $item['imageUri'] = $json['file_url']; - $item['title'] = 'Konachan | '.$json['id']; - $item['content'] = '
Tags: '.$json['tags']; - $this->items[] = $item; - } - } - - public function getCacheDuration(){ - return 1800; // 30 minutes - } } diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php index d2f90668..781bc238 100644 --- a/bridges/LolibooruBridge.php +++ b/bridges/LolibooruBridge.php @@ -1,46 +1,11 @@ array( - 'name'=>'page', - 'defaultValue'=>1, - 'type'=>'number' - ), - 't'=>array('name'=>'tags') - )); - - public function collectData(){ - $html = $this->getSimpleHTMLDOM( - self::URI.'post?' - .'&page='.$this->getInput('p') - .'&tags='.urlencode($this->getInput('t')) - ) or $this->returnServerError('Could not request Lolibooru.'); - - $input_json = explode('Post.register(', $html); - foreach($input_json as $element) - $data[] = preg_replace('/}\)(.*)/', '}', $element); - unset($data[0]); - - foreach($data as $datai) { - $json = json_decode($datai, TRUE); - $item = array(); - $item['uri'] = self::URI.'post/show/'.$json['id']; - $item['postid'] = $json['id']; - $item['timestamp'] = $json['created_at']; - $item['imageUri'] = $json['file_url']; - $item['title'] = 'Lolibooru | '.$json['id']; - $item['content'] = '
Tags: '.$json['tags']; - $this->items[] = $item; - } - } - - public function getCacheDuration(){ - return 1800; // 30 minutes - } } diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php index 86ffa5d6..11c56036 100644 --- a/bridges/SakugabooruBridge.php +++ b/bridges/SakugabooruBridge.php @@ -1,46 +1,11 @@ array( - 'name'=>'page', - 'defaultValue'=>1, - 'type'=>'number' - ), - 't'=>array('name'=>'tags') - )); - - public function collectData(){ - $html = $this->getSimpleHTMLDOM( - self::URI.'post?' - .'&page='.$this->getInput('p') - .'&tags='.urlencode($this->getInput('t')) - ) or $this->returnServerError('Could not request Sakugabooru.'); - - $input_json = explode('Post.register(', $html); - foreach($input_json as $element) - $data[] = preg_replace('/}\)(.*)/', '}', $element); - unset($data[0]); - - foreach($data as $datai) { - $json = json_decode($datai, TRUE); - $item = array(); - $item['uri'] = self::URI.'/post/show/'.$json['id']; - $item['postid'] = $json['id']; - $item['timestamp'] = $json['created_at']; - $item['imageUri'] = $json['file_url']; - $item['title'] = 'Sakugabooru | '.$json['id']; - $item['content'] = '
Tags: '.$json['tags']; - $this->items[] = $item; - } - } - - public function getCacheDuration(){ - return 1800; // 30 minutes - } } diff --git a/bridges/YandereBridge.php b/bridges/YandereBridge.php index 44a6ca12..61b59620 100644 --- a/bridges/YandereBridge.php +++ b/bridges/YandereBridge.php @@ -1,46 +1,11 @@ array( - 'name'=>'page', - 'type'=>'number', - 'defaultValue'=>1 - ), - 't'=>array('name'=>'tags') - )); - - public function collectData(){ - $html = $this->getSimpleHTMLDOM( - self::URI.'post?' - .'&page='.$this->getInput('p') - .'&tags='.urlencode($this->getInput('t')) - ) or $this->returnServerError('Could not request Yander.'); - - $input_json = explode('Post.register(', $html); - foreach($input_json as $element) - $data[] = preg_replace('/}\)(.*)/', '}', $element); - unset($data[0]); - - foreach($data as $datai) { - $json = json_decode($datai, TRUE); - $item = array(); - $item['uri'] = self::URI.'post/show/'.$json['id']; - $item['postid'] = $json['id']; - $item['timestamp'] = $json['created_at']; - $item['imageUri'] = $json['file_url']; - $item['title'] = 'Yandere | '.$json['id']; - $item['content'] = '
Tags: '.$json['tags']; - $this->items[] = $item; - } - } - - public function getCacheDuration(){ - return 1800; // 30 minutes - } }