aboutsummaryrefslogtreecommitdiff
path: root/bridges/EtsyBridge.php
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2022-07-01 15:10:30 +0200
committerGravatar GitHub <noreply@github.com> 2022-07-01 15:10:30 +0200
commit4f75591060d95208a301bc6bf460d875631b29cc (patch)
tree4e37d86840e8d990a563ba75d3de6f84a53cc2de /bridges/EtsyBridge.php
parent66568e3a39c61546c09a47a5688914a0bdf3c60c (diff)
downloadrss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.gz
rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.zst
rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.zip
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
Diffstat (limited to 'bridges/EtsyBridge.php')
-rw-r--r--bridges/EtsyBridge.php130
1 files changed, 67 insertions, 63 deletions
diff --git a/bridges/EtsyBridge.php b/bridges/EtsyBridge.php
index 7d79b82e..05bf7d26 100644
--- a/bridges/EtsyBridge.php
+++ b/bridges/EtsyBridge.php
@@ -1,81 +1,85 @@
<?php
-class EtsyBridge extends BridgeAbstract {
- const NAME = 'Etsy search';
- const URI = 'https://www.etsy.com';
- const DESCRIPTION = 'Returns feeds for search results';
- const MAINTAINER = 'logmanoriginal';
- const PARAMETERS = array(
- array(
- 'query' => array(
- 'name' => 'Search query',
- 'type' => 'text',
- 'required' => true,
- 'title' => 'Insert your search term here',
- 'exampleValue' => 'lamp'
- ),
- 'queryextension' => array(
- 'name' => 'Query extension',
- 'type' => 'text',
- 'required' => false,
- 'title' => 'Insert additional query parts here
+class EtsyBridge extends BridgeAbstract
+{
+ const NAME = 'Etsy search';
+ const URI = 'https://www.etsy.com';
+ const DESCRIPTION = 'Returns feeds for search results';
+ const MAINTAINER = 'logmanoriginal';
+ const PARAMETERS = [
+ [
+ 'query' => [
+ 'name' => 'Search query',
+ 'type' => 'text',
+ 'required' => true,
+ 'title' => 'Insert your search term here',
+ 'exampleValue' => 'lamp'
+ ],
+ 'queryextension' => [
+ 'name' => 'Query extension',
+ 'type' => 'text',
+ 'required' => false,
+ 'title' => 'Insert additional query parts here
(anything after ?search=<your search query>)',
- 'exampleValue' => '&explicit=1&locationQuery=2921044'
- ),
- 'hideimage' => array(
- 'name' => 'Hide image in content',
- 'type' => 'checkbox',
- 'title' => 'Activate to hide the image in the content',
- )
- )
- );
+ 'exampleValue' => '&explicit=1&locationQuery=2921044'
+ ],
+ 'hideimage' => [
+ 'name' => 'Hide image in content',
+ 'type' => 'checkbox',
+ 'title' => 'Activate to hide the image in the content',
+ ]
+ ]
+ ];
- public function collectData(){
- $html = getSimpleHTMLDOM($this->getURI());
+ public function collectData()
+ {
+ $html = getSimpleHTMLDOM($this->getURI());
- $results = $html->find('li.wt-list-unstyled');
+ $results = $html->find('li.wt-list-unstyled');
- foreach($results as $result) {
- // Remove Lazy loading
- if($result->find('.wt-skeleton-ui', 0))
- continue;
+ foreach ($results as $result) {
+ // Remove Lazy loading
+ if ($result->find('.wt-skeleton-ui', 0)) {
+ continue;
+ }
- $item = array();
+ $item = [];
- $item['title'] = $result->find('a', 0)->title;
- $item['uri'] = $result->find('a', 0)->href;
- $item['author'] = $result->find('p.wt-text-gray > span', 2)->plaintext;
+ $item['title'] = $result->find('a', 0)->title;
+ $item['uri'] = $result->find('a', 0)->href;
+ $item['author'] = $result->find('p.wt-text-gray > span', 2)->plaintext;
- $item['content'] = '<p>'
- . $result->find('span.currency-symbol', 0)->plaintext
- . $result->find('span.currency-value', 0)->plaintext
- . '</p><p>'
- . $result->find('a', 0)->title
- . '</p>';
+ $item['content'] = '<p>'
+ . $result->find('span.currency-symbol', 0)->plaintext
+ . $result->find('span.currency-value', 0)->plaintext
+ . '</p><p>'
+ . $result->find('a', 0)->title
+ . '</p>';
- $image = $result->find('img.wt-display-block', 0)->src;
+ $image = $result->find('img.wt-display-block', 0)->src;
- if(!$this->getInput('hideimage')) {
- $item['content'] .= '<img src="' . $image . '">';
- }
+ if (!$this->getInput('hideimage')) {
+ $item['content'] .= '<img src="' . $image . '">';
+ }
- $item['enclosures'] = array($image);
+ $item['enclosures'] = [$image];
- $this->items[] = $item;
- }
- }
+ $this->items[] = $item;
+ }
+ }
- public function getURI(){
- if(!is_null($this->getInput('query'))) {
- $uri = self::URI . '/search?q=' . urlencode($this->getInput('query'));
+ public function getURI()
+ {
+ if (!is_null($this->getInput('query'))) {
+ $uri = self::URI . '/search?q=' . urlencode($this->getInput('query'));
- if(!is_null($this->getInput('queryextension'))) {
- $uri .= $this->getInput('queryextension');
- }
+ if (!is_null($this->getInput('queryextension'))) {
+ $uri .= $this->getInput('queryextension');
+ }
- return $uri;
- }
+ return $uri;
+ }
- return parent::getURI();
- }
+ return parent::getURI();
+ }
}