release 1.17.2 (#3135)
* allow to input password interactively in console * added block to simplify overwriting export template parts * prevent installation in PHP 8.1 * composer update * phpunit version to 9 * support negative amounts in excel export * added system configuration actions for calendar, weekly timesheet, users * added method to render text with full markdown support
This commit is contained in:
@@ -33,14 +33,14 @@ class Duration
|
||||
* @param string $format
|
||||
* @return string|null
|
||||
*/
|
||||
public function format($seconds, $format = self::FORMAT_NO_SECONDS)
|
||||
public function format(?int $seconds, string $format = self::FORMAT_NO_SECONDS)
|
||||
{
|
||||
if (null === $seconds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$hour = floor($seconds / 3600);
|
||||
$minute = floor(($seconds / 60) % 60);
|
||||
$hour = (int) floor($seconds / 3600);
|
||||
$minute = (int) floor((int) ($seconds / 60) % 60);
|
||||
|
||||
$hour = $hour > 9 ? $hour : '0' . $hour;
|
||||
$minute = $minute > 9 ? $minute : '0' . $minute;
|
||||
@@ -60,7 +60,7 @@ class Duration
|
||||
* @param string $duration
|
||||
* @return int
|
||||
*/
|
||||
public function parseDurationString($duration): int
|
||||
public function parseDurationString(string $duration): int
|
||||
{
|
||||
if (false !== stripos($duration, ':')) {
|
||||
return $this->parseDuration($duration, self::FORMAT_COLON);
|
||||
|
||||
@@ -83,7 +83,6 @@ class MPdfConverter implements HtmlToPdfConverter
|
||||
for ($i = 0; $i < \count($parts); $i++) {
|
||||
if (stripos($parts[$i], '<!-- CONTENT_PART -->') !== false) {
|
||||
$subParts = explode('<!-- CONTENT_PART -->', $parts[$i]);
|
||||
$run = 0;
|
||||
foreach ($subParts as $subPart) {
|
||||
$mpdf->WriteHTML($subPart);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Utils;
|
||||
|
||||
/**
|
||||
* A simple class to parse markdown syntax and return HTML.
|
||||
* Parse markdown syntax and return HTML.
|
||||
*/
|
||||
final class Markdown
|
||||
{
|
||||
@@ -19,20 +19,14 @@ final class Markdown
|
||||
*/
|
||||
private $parser;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->parser = new ParsedownExtension();
|
||||
$this->parser->setUrlsLinked(true);
|
||||
$this->parser->setBreaksEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @param bool $safe
|
||||
* @return string
|
||||
*/
|
||||
public function toHtml(string $text, bool $safe = true): string
|
||||
{
|
||||
if ($this->parser === null) {
|
||||
$this->parser = new ParsedownExtension();
|
||||
$this->parser->setUrlsLinked(true);
|
||||
$this->parser->setBreaksEnabled(true);
|
||||
}
|
||||
|
||||
if ($safe !== true) {
|
||||
@trigger_error('Only safe mode is supported in Markdown since 1.16.3 to prevent XSS attacks. Parameter $safe will be removed with 2.0', E_USER_DEPRECATED);
|
||||
}
|
||||
@@ -42,4 +36,15 @@ final class Markdown
|
||||
|
||||
return $this->parser->text($text);
|
||||
}
|
||||
|
||||
public function withFullMarkdownSupport(string $text): string
|
||||
{
|
||||
$parser = new \Parsedown();
|
||||
$parser->setUrlsLinked(true);
|
||||
$parser->setBreaksEnabled(true);
|
||||
$parser->setSafeMode(true);
|
||||
$parser->setMarkupEscaped(true);
|
||||
|
||||
return $parser->text($text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class ParsedownExtension extends \Parsedown
|
||||
protected $BlockTypes = [
|
||||
'*' => ['Rule', 'List'],
|
||||
'+' => ['List'],
|
||||
'-' => ['SetextHeader', 'Table', 'Rule', 'List'],
|
||||
'-' => ['Table', 'Rule', 'List'],
|
||||
'0' => ['List'],
|
||||
'1' => ['List'],
|
||||
'2' => ['List'],
|
||||
@@ -37,7 +37,6 @@ class ParsedownExtension extends \Parsedown
|
||||
'9' => ['List'],
|
||||
':' => ['Table'],
|
||||
'<' => ['Comment', 'Markup'],
|
||||
'=' => ['SetextHeader'],
|
||||
'>' => ['Quote'],
|
||||
'[' => ['Reference'],
|
||||
'_' => ['Rule'],
|
||||
@@ -124,7 +123,7 @@ class ParsedownExtension extends \Parsedown
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
private function getIDfromText($text)
|
||||
private function getIDfromText($text): string
|
||||
{
|
||||
$text = strtolower($text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user