Skip to content
Merged
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
27 changes: 15 additions & 12 deletions com_connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ function com_connect($atts, $thing = '')
'thanks_form' => ''
), $atts));

$doctype = get_pref('doctype', 'xhtml');

if (!empty($lang)) {
$strings = com_connect_load_lang($lang);
$current = Txp::get('\Textpattern\L10n\Lang')->getStrings();
Expand Down Expand Up @@ -430,12 +432,13 @@ function com_connect($atts, $thing = '')
$form = ($form) ? fetch_form($form) : $thing;

if (empty($form)) {
$br = ($doctype === 'xhtml') ? '<br />' : '<br>';
$form = '
<txp:com_connect_text label="'.gTxt('com_connect_name').'" /><br />
<txp:com_connect_email /><br />'.
($send_article ? '<txp:com_connect_email send_article="1" label="'.gTxt('com_connect_recipient').'" /><br />' : '').
'<txp:com_connect_textarea /><br />
<txp:com_connect_submit />
<txp:com_connect_text label="'.gTxt('com_connect_name').'" />'.$br.
'<txp:com_connect_email />'.$br.
($send_article ? '<txp:com_connect_email send_article="1" label="'.gTxt('com_connect_recipient').'" />'.$br : '').
'<txp:com_connect_textarea />'.$br.
'<txp:com_connect_submit />
';
}

Expand Down Expand Up @@ -618,8 +621,8 @@ function com_connect($atts, $thing = '')
($label ? n . '<fieldset>' : '') .
($label ? n . '<legend>' . txpspecialchars($label) . '</legend>' : '') .
$out .
n . '<input type="hidden" name="com_connect_nonce" value="' . $com_connect_nonce . '" />' .
n . '<input type="hidden" name="com_connect_form_id" value="' . $com_connect_form_id . '" />' .
n . '<input type="hidden" name="com_connect_nonce" value="' . $com_connect_nonce . '"' . (($doctype === 'xhtml') ? ' />' : '>') .
n . '<input type="hidden" name="com_connect_form_id" value="' . $com_connect_form_id . '"' . (($doctype === 'xhtml') ? ' />' : '>') .
$form .
callback_event('comconnect.form') .
($label ? (n . '</fieldset>') : '') .
Expand Down Expand Up @@ -841,7 +844,7 @@ function com_connect_text($atts)
$labelStr = ($label) ? '<label for="' . $name . '"' . $classStr . '>' . txpspecialchars($label) . '</label>' : '';

return ($labelStr && $label_position === 'before' ? $labelStr . $break : '') .
'<input' . $classStr . ($attr ? ' ' . implode(' ', $attr) : '') . ' />' .
'<input' . $classStr . ($attr ? ' ' . implode(' ', $attr) : '') . (($doctype === 'xhtml') ? ' />' : '>') .
($labelStr && $label_position === 'after' ? $break . $labelStr : '');
}

Expand Down Expand Up @@ -1317,7 +1320,7 @@ function com_connect_checkbox($atts)

return ($labelStr && $label_position === 'before' ? $labelStr . $break : '') .
'<input type="checkbox"' . $classStr .
($theValue ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : '') : '') . ($attr ? ' ' . implode(' ', $attr) : '') . ' />' .
($theValue ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : '') : '') . ($attr ? ' ' . implode(' ', $attr) : '') . (($doctype === 'xhtml') ? ' />' : '>') .
($labelStr && $label_position === 'after' ? $break . $labelStr : '');
}

Expand Down Expand Up @@ -1439,7 +1442,7 @@ function com_connect_radio($atts)

return ($labelStr && $label_position === 'before' ? $labelStr . $break : '') .
'<input type="radio"'. $classStr . ($attr ? ' ' . implode(' ', $attr) : '') .
( $is_checked ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : ''). ' />' : ' />') .
( $is_checked ? ' checked' . (($doctype === 'xhtml') ? '="checked"' : '') : '') . (($doctype === 'xhtml') ? ' />' : '>') .
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this line. I might be reading it wrong but there seems to be an additional : '') that's snuck in and I can't see the corresponding ternary ?. What am I missing?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, ignore me. Spotted it.

($labelStr && $label_position === 'after' ? $break . $labelStr : '');
}

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

Expand Down Expand Up @@ -1677,7 +1680,7 @@ function com_connect_lAtts($pairs, $atts)
}

if (isset($atts['break']) && $atts['break'] === 'br') {
$atts['break'] = '<br />';
$atts['break'] = ($doctype === 'xhtml') ? '<br />' : '<br>';
}

$com_connect_globals = array(
Expand Down