aboutsummaryrefslogtreecommitdiff
path: root/bridges/TinyLetterBridge.php
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/TinyLetterBridge.php')
-rw-r--r--bridges/TinyLetterBridge.php108
1 files changed, 56 insertions, 52 deletions
diff --git a/bridges/TinyLetterBridge.php b/bridges/TinyLetterBridge.php
index 96c53331..0ba9bf1d 100644
--- a/bridges/TinyLetterBridge.php
+++ b/bridges/TinyLetterBridge.php
@@ -1,54 +1,58 @@
<?php
-class TinyLetterBridge extends BridgeAbstract {
- const NAME = 'Tiny Letter';
- const URI = 'https://tinyletter.com/';
- const DESCRIPTION = 'Tiny Letter is a mailing list service';
- const MAINTAINER = 'somini';
- const PARAMETERS = array(
- array(
- 'username' => array(
- 'name' => 'User Name',
- 'required' => true,
- 'exampleValue' => 'forwards',
- )
- )
- );
-
- public function getName() {
- $username = $this->getInput('username');
- if (!is_null($username)) {
- return static::NAME . ' | ' . $username;
- }
-
- return parent::getName();
- }
-
- public function getURI() {
- $username = $this->getInput('username');
- if (!is_null($username)) {
- return static::URI . urlencode($username);
- }
-
- return parent::getURI();
- }
-
- public function collectData() {
- $archives = self::getURI() . '/archive';
- $html = getSimpleHTMLDOMCached($archives);
-
- foreach($html->find('.message-list li') as $element) {
- $item = array();
-
- $snippet = $element->find('p.message-snippet', 0);
- $link = $element->find('.message-link', 0);
-
- $item['title'] = $link->plaintext;
- $item['content'] = $snippet->innertext;
- $item['uri'] = $link->href;
- $item['timestamp'] = strtotime($element->find('.message-date', 0)->plaintext);
-
- $this->items[] = $item;
- }
-
- }
+
+class TinyLetterBridge extends BridgeAbstract
+{
+ const NAME = 'Tiny Letter';
+ const URI = 'https://tinyletter.com/';
+ const DESCRIPTION = 'Tiny Letter is a mailing list service';
+ const MAINTAINER = 'somini';
+ const PARAMETERS = [
+ [
+ 'username' => [
+ 'name' => 'User Name',
+ 'required' => true,
+ 'exampleValue' => 'forwards',
+ ]
+ ]
+ ];
+
+ public function getName()
+ {
+ $username = $this->getInput('username');
+ if (!is_null($username)) {
+ return static::NAME . ' | ' . $username;
+ }
+
+ return parent::getName();
+ }
+
+ public function getURI()
+ {
+ $username = $this->getInput('username');
+ if (!is_null($username)) {
+ return static::URI . urlencode($username);
+ }
+
+ return parent::getURI();
+ }
+
+ public function collectData()
+ {
+ $archives = self::getURI() . '/archive';
+ $html = getSimpleHTMLDOMCached($archives);
+
+ foreach ($html->find('.message-list li') as $element) {
+ $item = [];
+
+ $snippet = $element->find('p.message-snippet', 0);
+ $link = $element->find('.message-link', 0);
+
+ $item['title'] = $link->plaintext;
+ $item['content'] = $snippet->innertext;
+ $item['uri'] = $link->href;
+ $item['timestamp'] = strtotime($element->find('.message-date', 0)->plaintext);
+
+ $this->items[] = $item;
+ }
+ }
}