43 lines
828 B
PHP
Executable file
43 lines
828 B
PHP
Executable file
#!/usr/bin/php7.1
|
|
<?php
|
|
|
|
require __DIR__.'/base/block.php';
|
|
|
|
$rss = $argv[1] ?? null;
|
|
$title = $argv[2] ?? null;
|
|
|
|
if (empty($rss) || empty($title)) {
|
|
die;
|
|
}
|
|
|
|
$content = @file_get_contents($rss);
|
|
|
|
if (empty($content)) {
|
|
die;
|
|
}
|
|
|
|
preg_match_all('/<entry/isU', $content, $matches, PREG_SET_ORDER);
|
|
|
|
$title = IntlChar::chr(0xf09e);
|
|
$count = count($matches);
|
|
|
|
if ($count > 0) {
|
|
$title .= ' +'.$count;
|
|
}
|
|
|
|
$fullText = span(' '.$title.' ', $count ? color('normal') : color('info'), '#333'); // sprintf('[%s] %s', $title, $count = count($matches));
|
|
|
|
$blockButton = (int) getenv('BLOCK_BUTTON');
|
|
|
|
if ($blockButton === 1) {
|
|
shell_exec('xdg-open "https://tiny.deblan.org/index.php"');
|
|
}
|
|
|
|
echo block(
|
|
'rss',
|
|
[
|
|
'full_text' => $fullText,
|
|
// 'color' => $count ? color('normal') : color('info'),
|
|
]
|
|
);
|