2018-04-15 14:02:37 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-04-15 14:02:37 +03:00
|
|
|
class NotAlwaysBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const MAINTAINER = 'mozes';
|
|
|
|
const NAME = 'Not Always family Bridge';
|
|
|
|
const URI = 'https://notalwaysright.com/';
|
|
|
|
const DESCRIPTION = 'Returns the latest stories';
|
|
|
|
const CACHE_TIMEOUT = 1800; // 30 minutes
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-04-15 14:02:37 +03:00
|
|
|
const PARAMETERS = [ [
|
|
|
|
'filter' => [
|
|
|
|
'type' => 'list',
|
|
|
|
'name' => 'Filter',
|
|
|
|
'values' => [
|
2022-06-05 03:56:51 +03:00
|
|
|
'All' => '',
|
2018-04-15 14:02:37 +03:00
|
|
|
'Right' => 'right',
|
|
|
|
'Working' => 'working',
|
|
|
|
'Romantic' => 'romantic',
|
|
|
|
'Related' => 'related',
|
|
|
|
'Learning' => 'learning',
|
|
|
|
'Hopeless' => 'hopeless',
|
2023-06-30 16:50:54 +03:00
|
|
|
'Healthy' => 'healthy',
|
|
|
|
'Legal' => 'legal',
|
|
|
|
'Friendly' => 'friendly',
|
2018-04-15 14:02:37 +03:00
|
|
|
'Unfiltered' => 'unfiltered'
|
2022-07-01 16:10:30 +03:00
|
|
|
]
|
|
|
|
]
|
2018-04-15 14:02:37 +03:00
|
|
|
]];
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-10-26 19:07:34 +03:00
|
|
|
public function getIcon()
|
|
|
|
{
|
|
|
|
return self::URI . 'favicon_nar.png';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-04-15 14:02:37 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
2022-01-02 12:36:09 +03:00
|
|
|
$html = getSimpleHTMLDOM($this->getURI());
|
2018-04-15 14:02:37 +03:00
|
|
|
foreach ($html->find('.post') as $post) {
|
|
|
|
#print_r($post);
|
|
|
|
$item = [];
|
|
|
|
$item['uri'] = $post->find('h1', 0)->find('a', 0)->href;
|
2023-06-30 16:50:54 +03:00
|
|
|
$postHeader = $post->find('.post_header', 0);
|
|
|
|
$storyContent = $post->find('.storycontent', 0);
|
|
|
|
$item['content'] = $postHeader . '<br/><br/>' . $storyContent;
|
2018-04-15 14:02:37 +03:00
|
|
|
$item['title'] = $post->find('h1', 0)->find('a', 0)->innertext;
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
Fix coding style missed by phpbcf (#2901)
$ composer require --dev friendsofphp/php-cs-fixer
$ echo >.php-cs-fixer.dist.php "<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__);
$rules = [
'@PSR12' => true,
// '@PSR12:risky' => true,
'@PHP74Migration' => true,
// '@PHP74Migration:risky' => true,
// buggy, duplicates existing comment sometimes
'no_break_comment' => false,
'array_syntax' => true,
'lowercase_static_reference' => true,
'visibility_required' => false,
// Too much noise
'binary_operator_spaces' => false,
'heredoc_indentation' => false,
'trailing_comma_in_multiline' => false,
];
$config = new PhpCsFixer\Config();
return $config
->setRules($rules)
// ->setRiskyAllowed(true)
->setFinder($finder);
"
$ vendor/bin/php-cs-fixer --version
PHP CS Fixer 3.8.0 BerSzcz against war! by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.7
$ vendor/bin/php-cs-fixer fix
$ rm .php-cs-fixer.cache
$ vendor/bin/php-cs-fixer fix
2022-07-08 14:00:52 +03:00
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-04-15 14:02:37 +03:00
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
if (!is_null($this->getInput('filter'))) {
|
|
|
|
return $this->getInput('filter') . ' - NotAlways Bridge';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-06-30 00:55:33 +03:00
|
|
|
return parent::getName();
|
2018-04-15 14:02:37 +03:00
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-04-15 14:02:37 +03:00
|
|
|
public function getURI()
|
Fix coding style missed by phpbcf (#2901)
$ composer require --dev friendsofphp/php-cs-fixer
$ echo >.php-cs-fixer.dist.php "<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__);
$rules = [
'@PSR12' => true,
// '@PSR12:risky' => true,
'@PHP74Migration' => true,
// '@PHP74Migration:risky' => true,
// buggy, duplicates existing comment sometimes
'no_break_comment' => false,
'array_syntax' => true,
'lowercase_static_reference' => true,
'visibility_required' => false,
// Too much noise
'binary_operator_spaces' => false,
'heredoc_indentation' => false,
'trailing_comma_in_multiline' => false,
];
$config = new PhpCsFixer\Config();
return $config
->setRules($rules)
// ->setRiskyAllowed(true)
->setFinder($finder);
"
$ vendor/bin/php-cs-fixer --version
PHP CS Fixer 3.8.0 BerSzcz against war! by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.7
$ vendor/bin/php-cs-fixer fix
$ rm .php-cs-fixer.cache
$ vendor/bin/php-cs-fixer fix
2022-07-08 14:00:52 +03:00
|
|
|
{
|
2018-04-15 14:02:37 +03:00
|
|
|
if (!is_null($this->getInput('filter'))) {
|
|
|
|
return self::URI . $this->getInput('filter') . '/';
|
|
|
|
}
|
Fix coding style missed by phpbcf (#2901)
$ composer require --dev friendsofphp/php-cs-fixer
$ echo >.php-cs-fixer.dist.php "<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__);
$rules = [
'@PSR12' => true,
// '@PSR12:risky' => true,
'@PHP74Migration' => true,
// '@PHP74Migration:risky' => true,
// buggy, duplicates existing comment sometimes
'no_break_comment' => false,
'array_syntax' => true,
'lowercase_static_reference' => true,
'visibility_required' => false,
// Too much noise
'binary_operator_spaces' => false,
'heredoc_indentation' => false,
'trailing_comma_in_multiline' => false,
];
$config = new PhpCsFixer\Config();
return $config
->setRules($rules)
// ->setRiskyAllowed(true)
->setFinder($finder);
"
$ vendor/bin/php-cs-fixer --version
PHP CS Fixer 3.8.0 BerSzcz against war! by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.7
$ vendor/bin/php-cs-fixer fix
$ rm .php-cs-fixer.cache
$ vendor/bin/php-cs-fixer fix
2022-07-08 14:00:52 +03:00
|
|
|
|
2018-04-15 14:02:37 +03:00
|
|
|
return parent::getURI();
|
Fix coding style missed by phpbcf (#2901)
$ composer require --dev friendsofphp/php-cs-fixer
$ echo >.php-cs-fixer.dist.php "<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__);
$rules = [
'@PSR12' => true,
// '@PSR12:risky' => true,
'@PHP74Migration' => true,
// '@PHP74Migration:risky' => true,
// buggy, duplicates existing comment sometimes
'no_break_comment' => false,
'array_syntax' => true,
'lowercase_static_reference' => true,
'visibility_required' => false,
// Too much noise
'binary_operator_spaces' => false,
'heredoc_indentation' => false,
'trailing_comma_in_multiline' => false,
];
$config = new PhpCsFixer\Config();
return $config
->setRules($rules)
// ->setRiskyAllowed(true)
->setFinder($finder);
"
$ vendor/bin/php-cs-fixer --version
PHP CS Fixer 3.8.0 BerSzcz against war! by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.7
$ vendor/bin/php-cs-fixer fix
$ rm .php-cs-fixer.cache
$ vendor/bin/php-cs-fixer fix
2022-07-08 14:00:52 +03:00
|
|
|
}
|
2018-04-15 14:02:37 +03:00
|
|
|
}
|