diff --git a/lam/lib/pdf.inc b/lam/lib/pdf.inc index 478317b3a..966de7ad6 100644 --- a/lam/lib/pdf.inc +++ b/lam/lib/pdf.inc @@ -228,7 +228,7 @@ function printTable(&$pdf, $table, $fontName) { foreach ($table->rows as $row) { foreach ($row->cells as $cell) { $width = $cell->width; - if (!empty($width) && (strpos($width, '%') !== false)) { + if (!empty($width) && (str_contains($width, '%'))) { $width = ceil(LAMPDF_LINEWIDTH * substr($width, 0, -1) / 100); } if ($cell->bold) { @@ -336,9 +336,9 @@ class PDFTableRow { */ class PDFTableCell { - const ALIGN_LEFT = 'L'; - const ALIGN_RIGHT = 'R'; - const ALIGN_CENTER = 'C'; + public const ALIGN_LEFT = 'L'; + public const ALIGN_RIGHT = 'R'; + public const ALIGN_CENTER = 'C'; /** content text of cell */ public $content = ''; diff --git a/lam/lib/pdfstruct.inc b/lam/lib/pdfstruct.inc index bbc04c5ad..42f073a42 100644 --- a/lam/lib/pdfstruct.inc +++ b/lam/lib/pdfstruct.inc @@ -723,7 +723,7 @@ class PdfStructurePersistenceStrategyFiles implements PdfStructurePersistenceStr if ($templateDir) { $entry = $templateDir->read(); while ($entry) { - if ((strpos($entry, '.') !== 0) && is_file($templatePath . '/' . $entry)) { + if ((!str_starts_with($entry, '.')) && is_file($templatePath . '/' . $entry)) { $logos[] = $entry; } $entry = $templateDir->read(); @@ -945,10 +945,10 @@ class PdfStructurePersistenceStrategyFiles implements PdfStructurePersistenceStr */ class PdfStructurePersistenceStrategyPdo implements PdfStructurePersistenceStrategy { - const TABLE_NAME = 'pdf_structures'; - const TABLE_NAME_LOGOS = 'pdf_logos'; - const TABLE_NAME_TEMPLATES = 'pdf_structures_templates'; - const TABLE_NAME_TEMPLATES_LOGOS = 'pdf_logos_templates'; + private const TABLE_NAME = 'pdf_structures'; + private const TABLE_NAME_LOGOS = 'pdf_logos'; + private const TABLE_NAME_TEMPLATES = 'pdf_structures_templates'; + private const TABLE_NAME_TEMPLATES_LOGOS = 'pdf_logos_templates'; /** * @var PDO @@ -1388,9 +1388,9 @@ class PDFStructureWriter { class PDFStructure { /** no folding marks */ - const FOLDING_NONE = 'no'; + public const FOLDING_NONE = 'no'; /** standard folding marks */ - const FOLDING_STANDARD = 'standard'; + public const FOLDING_STANDARD = 'standard'; private $logo; diff --git a/lam/templates/pdfedit/pdfpage.php b/lam/templates/pdfedit/pdfpage.php index 78c331b09..0dc296860 100644 --- a/lam/templates/pdfedit/pdfpage.php +++ b/lam/templates/pdfedit/pdfpage.php @@ -263,7 +263,10 @@ if (isset($_SESSION['currentPDFStructure'])) { $foldingMarks = $_SESSION['currentPDFStructure']->getFoldingMarks(); } -$possibleFoldingMarks = [_('No') => 'no', _('Yes') => 'standard']; +$possibleFoldingMarks = [ + _('No') => PDFStructure::FOLDING_NONE, + _('Yes') => PDFStructure::FOLDING_STANDARD +]; $foldingMarksSelect = new htmlResponsiveSelect('foldingmarks', $possibleFoldingMarks, [$foldingMarks], _('Folding marks')); $foldingMarksSelect->setHasDescriptiveElements(true); $mainContent->add($foldingMarksSelect, 12);