Rev 1190 | Rev 1231 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1190 | Rev 1219 | ||
---|---|---|---|
Line 613... | Line 613... | ||
613 | function isFileOrPathWritable(string $path): bool { |
613 | function isFileOrPathWritable(string $path): bool { |
614 | if ($writable_file = (file_exists($path) && is_writable($path))) return true; |
614 | if ($writable_file = (file_exists($path) && is_writable($path))) return true; |
615 | if ($writable_directory = (!file_exists($path) && is_writable(dirname($path)))) return true; |
615 | if ($writable_directory = (!file_exists($path) && is_writable(dirname($path)))) return true; |
616 | return false; |
616 | return false; |
617 | } |
617 | } |
- | 618 | ||
- | 619 | /** |
|
- | 620 | * @param string $html |
|
- | 621 | * @return string |
|
- | 622 | */ |
|
- | 623 | function html_to_text(string $html): string { |
|
- | 624 | $html = str_replace("\n", "", $html); |
|
- | 625 | $html = str_ireplace('<br', "\n<br", $html); |
|
- | 626 | $html = str_ireplace('<p', "\n\n<p", $html); |
|
- | 627 | $html = strip_tags($html); |
|
- | 628 | $html = html_entity_decode($html, ENT_QUOTES, 'UTF-8'); |
|
- | 629 | return $html; |
|
- | 630 | } |