Skip to content

Commit f38015d

Browse files
authored
Merge pull request #85 from jools-r/main
Self-closing tag ending as per doctype setting Thanks, jools-r.
2 parents 7b6b307 + 48c7a71 commit f38015d

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

com_connect.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ function com_connect($atts, $thing = '')
329329
'thanks_form' => ''
330330
), $atts));
331331

332+
$doctype = get_pref('doctype', 'xhtml');
333+
332334
if (!empty($lang)) {
333335
$strings = com_connect_load_lang($lang);
334336
$current = Txp::get('\Textpattern\L10n\Lang')->getStrings();
@@ -430,12 +432,13 @@ function com_connect($atts, $thing = '')
430432
$form = ($form) ? fetch_form($form) : $thing;
431433

432434
if (empty($form)) {
435+
$br = ($doctype === 'xhtml') ? '<br />' : '<br>';
433436
$form = '
434-
<txp:com_connect_text label="'.gTxt('com_connect_name').'" /><br />
435-
<txp:com_connect_email /><br />'.
436-
($send_article ? '<txp:com_connect_email send_article="1" label="'.gTxt('com_connect_recipient').'" /><br />' : '').
437-
'<txp:com_connect_textarea /><br />
438-
<txp:com_connect_submit />
437+
<txp:com_connect_text label="'.gTxt('com_connect_name').'" />'.$br.
438+
'<txp:com_connect_email />'.$br.
439+
($send_article ? '<txp:com_connect_email send_article="1" label="'.gTxt('com_connect_recipient').'" />'.$br : '').
440+
'<txp:com_connect_textarea />'.$br.
441+
'<txp:com_connect_submit />
439442
';
440443
}
441444

@@ -618,8 +621,8 @@ function com_connect($atts, $thing = '')
618621
($label ? n . '<fieldset>' : '') .
619622
($label ? n . '<legend>' . txpspecialchars($label) . '</legend>' : '') .
620623
$out .
621-
n . '<input type="hidden" name="com_connect_nonce" value="' . $com_connect_nonce . '" />' .
622-
n . '<input type="hidden" name="com_connect_form_id" value="' . $com_connect_form_id . '" />' .
624+
n . '<input type="hidden" name="com_connect_nonce" value="' . $com_connect_nonce . '"' . (($doctype === 'xhtml') ? ' />' : '>') .
625+
n . '<input type="hidden" name="com_connect_form_id" value="' . $com_connect_form_id . '"' . (($doctype === 'xhtml') ? ' />' : '>') .
623626
$form .
624627
callback_event('comconnect.form') .
625628
($label ? (n . '</fieldset>') : '') .
@@ -841,7 +844,7 @@ function com_connect_text($atts)
841844
$labelStr = ($label) ? '<label for="' . $name . '"' . $classStr . '>' . txpspecialchars($label) . '</label>' : '';
842845

843846
return ($labelStr && $label_position === 'before' ? $labelStr . $break : '') .
844-
'<input' . $classStr . ($attr ? ' ' . implode(' ', $attr) : '') . ' />' .
847+
'<input' . $classStr . ($attr ? ' ' . implode(' ', $attr) : '') . (($doctype === 'xhtml') ? ' />' : '>') .
845848
($labelStr && $label_position === 'after' ? $break . $labelStr : '');
846849
}
847850

@@ -1317,7 +1320,7 @@ function com_connect_checkbox($atts)
13171320

13181321
return ($labelStr && $label_position === 'before' ? $labelStr . $break : '') .
13191322
'<input type="checkbox"' . $classStr .
1320-
($theValue ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : '') : '') . ($attr ? ' ' . implode(' ', $attr) : '') . ' />' .
1323+
($theValue ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : '') : '') . ($attr ? ' ' . implode(' ', $attr) : '') . (($doctype === 'xhtml') ? ' />' : '>') .
13211324
($labelStr && $label_position === 'after' ? $break . $labelStr : '');
13221325
}
13231326

@@ -1439,7 +1442,7 @@ function com_connect_radio($atts)
14391442

14401443
return ($labelStr && $label_position === 'before' ? $labelStr . $break : '') .
14411444
'<input type="radio"'. $classStr . ($attr ? ' ' . implode(' ', $attr) : '') .
1442-
( $is_checked ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : ''). ' />' : ' />') .
1445+
( $is_checked ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : '') : '') . (($doctype === 'xhtml') ? ' />' : '>') .
14431446
($labelStr && $label_position === 'after' ? $break . $labelStr : '');
14441447
}
14451448

@@ -1541,7 +1544,7 @@ function com_connect_submit($atts, $thing = '')
15411544
if ($thing) {
15421545
return '<button type="submit"' . $classStr . ' name="com_connect_submit" value="' . $label . '"' . ($attr ? ' ' . implode(' ', $attr) : '') . '>' . ($thing ? trim(parse($thing)) : $label) . '</button>';
15431546
} else {
1544-
return '<input type="submit"' . $classStr . ' name="com_connect_submit" value="' . $label . '"' . ($attr ? ' ' . implode(' ', $attr) : '') . ' />';
1547+
return '<input type="submit"' . $classStr . ' name="com_connect_submit" value="' . $label . '"' . ($attr ? ' ' . implode(' ', $attr) : '') . (($doctype === 'xhtml') ? ' />' : '>');
15451548
}
15461549
}
15471550

@@ -1677,7 +1680,7 @@ function com_connect_lAtts($pairs, $atts)
16771680
}
16781681

16791682
if (isset($atts['break']) && $atts['break'] === 'br') {
1680-
$atts['break'] = '<br />';
1683+
$atts['break'] = ($doctype === 'xhtml') ? '<br />' : '<br>';
16811684
}
16821685

16831686
$com_connect_globals = array(

0 commit comments

Comments
 (0)