From dca8164b8f0f2babd7f224215bcc8e99616ee720 Mon Sep 17 00:00:00 2001 From: jeanlalouttre <211577579+jeanlalouttre@users.noreply.github.com> Date: Tue, 13 May 2025 22:55:45 +0200 Subject: [PATCH 1/2] Create HelloAssoBridge It allows to list fundraising forms on HelloAsso. Useful for organisations that are using one form per event, to get new events notifications. --- bridges/HelloAssoBridge.php | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 bridges/HelloAssoBridge.php diff --git a/bridges/HelloAssoBridge.php b/bridges/HelloAssoBridge.php new file mode 100644 index 00000000..c64c171f --- /dev/null +++ b/bridges/HelloAssoBridge.php @@ -0,0 +1,68 @@ + [ + 'name' => 'Organization slug', + 'type' => 'text', + 'required' => true, + 'title' => 'Insert Organization short name (found in the URL)', + 'exampleValue' => 'ligue-contre-le-cancer-comite-essonne' + ] + ]]; + + private $orgname; + + public function getURI() + { + $slug = $this->getInput('slug') ?: ''; + return static::URI . '/associations/' . $slug; + } + + public function getName() + { + return $this->orgname ? $this->orgname . ' - ' . static::NAME : static::NAME; + } + + public function getDescription() + { + if (!is_null($this->getInput('search'))) { + return 'Latest torrents for "' . $this->getInput('search') . '"'; + } + return parent::getDescription(); + } + + public function collectData() + { + $html = getSimpleHTMLDOM($this->getURI()); + $html = defaultLinkTo($html, $this->getURI()); + + $orgname = $html->find('[class~="Intro--Name"]', 0) + or returnServerError('Could not find org name!'); + $this->orgname = $orgname->plaintext; + + foreach ($html->find('ul[class~="ActionList"] li') as $element) { + $uri = $element->find('.ActionWrapper a', 0) + or returnServerError('Could not find action uri!'); + + $title = $element->find('.ActionContent--Text h3', 0); + + $date = $element->find('[class~="Number-Date"]', 0); + $address = $element->find('[class~="Data-AddressName"]', 0); + + $item = []; + $item['uri'] = $uri->href; + $item['title'] = $title->plaintext ?? ''; + $item['content'] = ($date->plaintext ?? '') + . ('
' . $address->plaintext ?? ''); + + $this->items[] = $item; + } + } +} From 56401538e83dfca127d32b71d68c4a24eade3a10 Mon Sep 17 00:00:00 2001 From: jeanlalouttre <211577579+jeanlalouttre@users.noreply.github.com> Date: Thu, 15 May 2025 00:25:02 +0200 Subject: [PATCH 2/2] [HelloAssoBridge.php] remove unused function --- bridges/HelloAssoBridge.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bridges/HelloAssoBridge.php b/bridges/HelloAssoBridge.php index c64c171f..16aeaabe 100644 --- a/bridges/HelloAssoBridge.php +++ b/bridges/HelloAssoBridge.php @@ -30,14 +30,6 @@ class HelloAssoBridge extends BridgeAbstract return $this->orgname ? $this->orgname . ' - ' . static::NAME : static::NAME; } - public function getDescription() - { - if (!is_null($this->getInput('search'))) { - return 'Latest torrents for "' . $this->getInput('search') . '"'; - } - return parent::getDescription(); - } - public function collectData() { $html = getSimpleHTMLDOM($this->getURI());