Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to PHP 8.0 #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require" : {
"squizlabs/php_codesniffer" : "^2.8",
"squizlabs/php_codesniffer" : "^3.0",
"mike42/escpos-php": "^1.5"
},
"autoload" : {
Expand Down
79 changes: 31 additions & 48 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions esc2html.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}
// Block-level formatting such as text justification
$classes = getBlockClasses($formatting);
$classesStr = implode($classes, " ");
$classesStr = implode(" ", $classes);
$outp[] = wrapInline("<div class=\"$classesStr\">", "</div>", $lineHtml);
$lineHtml = "";
}
Expand All @@ -60,14 +60,14 @@
} else if ($sub -> isAvailableAs('PrintBufferredDataGraphicsSubCmd') && $bufferedImg !== null) {
// Append and flush buffer
$classes = getBlockClasses($formatting);
$classesStr = implode($classes, " ");
$classesStr = implode(" ", $classes);
$outp[] = wrapInline("<div class=\"$classesStr\">", "</div>", imgAsDataUrl($bufferedImg));
$lineHtml = "";
}
} else if ($cmd -> isAvailableAs('ImageContainer')) {
// Append and flush buffer
$classes = getBlockClasses($formatting);
$classesStr = implode($classes, " ");
$classesStr = implode(" ", $classes);
$outp[] = wrapInline("<div class=\"$classesStr\">", "</div>", imgAsDataUrl($cmd));
$lineHtml = "";
// Should load into print buffer and print next line break, but we print immediately, so need to skip the next line break.
Expand Down Expand Up @@ -101,7 +101,7 @@ function imgAsDataUrl($bufferedImg)
$imgSrc = "data:image/png;base64," . base64_encode($bufferedImg -> asPng());
$imgWidth = $bufferedImg -> getWidth() / 2; // scaling, images are quite high res and dwarf the text
$bufferedImg = null;
return "<img class=\"esc-bitimage\" src=\"$imgSrc\" alt=\"$imgAlt\" width=\"${imgWidth}px\" />";
return "<img class=\"esc-bitimage\" src=\"$imgSrc\" alt=\"$imgAlt\" width=\"{$imgWidth}px\" />";
}

function wrapInline($tag, $closeTag, $content)
Expand Down Expand Up @@ -169,7 +169,7 @@ function span(InlineFormatting $formatting, $spanContentText = false)
if (count($classes) == 0) {
return $spanContentHtml;
}
return "<span class=\"". implode($classes, " ") . "\">" . $spanContentHtml . "</span>";
return "<span class=\"". implode(" ", $classes) . "\">" . $spanContentHtml . "</span>";
}

function getBlockClasses($formatting)
Expand Down
2 changes: 1 addition & 1 deletion src/Parser/Command/Printout.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@ public function logUnknownCommand(array $searchStack)
$cmdStack[] = $s;
}
}
fwrite(STDERR, "WARNING: Unknown command " . implode($cmdStack, ' ') . "\n");
fwrite(STDERR, "WARNING: Unknown command " . implode(' ', $cmdStack) . "\n");
}
}