1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-05 08:07:33 +02:00

fix(html_format): add spacing below date if author is missing (#3425)

* small ui tweak

* remove unused <div>

* refactor: rename method

* refactor: inline const

* refactor
This commit is contained in:
Dag
2023-06-08 23:04:16 +02:00
committed by GitHub
parent 95071d0134
commit fbaf26e8bf
11 changed files with 14 additions and 31 deletions

View File

@@ -2,18 +2,16 @@
final class BridgeFactory
{
private $folder;
/** @var array<class-string<BridgeInterface>> */
private $bridgeClassNames = [];
/** @var array<class-string<BridgeInterface>> */
private $whitelist = [];
public function __construct(string $folder = PATH_LIB_BRIDGES)
public function __construct()
{
$this->folder = $folder;
// create names
foreach (scandir($this->folder) as $file) {
foreach (scandir(__DIR__ . '/../bridges/') as $file) {
if (preg_match('/^([^.]+Bridge)\.php$/U', $file, $m)) {
$this->bridgeClassNames[] = $m[1];
}
@@ -27,6 +25,7 @@ final class BridgeFactory
} else {
$contents = '';
}
if ($contents === '*') {
// Whitelist all bridges
$this->whitelist = $this->getBridgeClassNames();

View File

@@ -16,7 +16,6 @@
const PATH_ROOT = __DIR__ . '/../';
/** Path to the bridges library */
const PATH_LIB_BRIDGES = __DIR__ . '/../bridges/';
/** Path to the formats library */
const PATH_LIB_FORMATS = __DIR__ . '/../formats/';

View File

@@ -124,7 +124,7 @@ function sanitize(
return $htmlContent;
}
function sanitize_html(string $html): string
function break_annoying_html_tags(string $html): string
{
$html = str_replace('<script', '<&zwnj;script', $html); // Disable scripts, but leave them visible.
$html = str_replace('<iframe', '<&zwnj;iframe', $html);