mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-17 16:11:10 +00:00
HTML row tag > optional
This commit is contained in:
@@ -85,17 +85,19 @@ class QRString extends QROutputBase implements QROutputInterface{
|
||||
|
||||
foreach($this->matrix as &$row){
|
||||
// in order to not bloat the output too much, we use the shortest possible valid HTML tags
|
||||
$html .= '<p>';
|
||||
$html .= '<'.$this->options->htmlRowTag.'>';
|
||||
foreach($row as &$col){
|
||||
$tag = $col
|
||||
? 'b' // dark
|
||||
: 'i'; // light
|
||||
|
||||
$html .= '<'.$tag.'></'.$tag.'>';
|
||||
$html .= '<'.$tag.'></'.$tag.'>';
|
||||
}
|
||||
|
||||
if(!(bool)$this->options->htmlOmitEndTag){
|
||||
$html .= '</'.$this->options->htmlRowTag.'>';
|
||||
}
|
||||
|
||||
// the closing <p> tag may be omitted
|
||||
# $html .= '</p>';
|
||||
$html .= PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use chillerlan\QRCode\QRCode;
|
||||
*/
|
||||
class QRStringOptions{
|
||||
|
||||
public $type = QRCode::OUTPUT_STRING_TEXT;
|
||||
public $type = QRCode::OUTPUT_STRING_HTML;
|
||||
|
||||
public $textDark = '#';
|
||||
|
||||
@@ -26,4 +26,8 @@ class QRStringOptions{
|
||||
|
||||
public $textNewline = PHP_EOL;
|
||||
|
||||
public $htmlRowTag = 'p';
|
||||
|
||||
public $htmlOmitEndTag = true;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user