Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberroland committed Jul 11, 2024
1 parent 8e33747 commit 29dec3a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lam/lib/pdf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 = '';
Expand Down
14 changes: 7 additions & 7 deletions lam/lib/pdfstruct.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
5 changes: 4 additions & 1 deletion lam/templates/pdfedit/pdfpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 29dec3a

Please sign in to comment.