HTML row tag > optional

This commit is contained in:
smiley
2015-12-11 01:12:10 +01:00
parent af021975bf
commit d1dd16c1cc
2 changed files with 11 additions and 5 deletions
+5 -3
View File
@@ -85,7 +85,7 @@ 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
@@ -94,8 +94,10 @@ class QRString extends QROutputBase implements QROutputInterface{
$html .= '<'.$tag.'></'.$tag.'>';
}
// the closing <p> tag may be omitted
# $html .= '</p>';
if(!(bool)$this->options->htmlOmitEndTag){
$html .= '</'.$this->options->htmlRowTag.'>';
}
$html .= PHP_EOL;
}
+5 -1
View File
@@ -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;
}