Plugin Updates
This commit is contained in:
@@ -350,7 +350,7 @@ function wpcf7dtx_format_atts($atts)
|
||||
if ($value) {
|
||||
$sanitized_atts[$key] = $key;
|
||||
}
|
||||
} elseif ($value && (is_string($value) || is_numeric($value))) {
|
||||
} elseif (is_numeric($value) || (is_string($value) || !empty($value))) {
|
||||
$sanitized_atts[$key] = $value;
|
||||
}
|
||||
}
|
||||
@@ -396,7 +396,14 @@ function wpcf7dtx_checkbox_html($atts, $label_text = '', $label_ui = true, $reve
|
||||
{
|
||||
// Default field attributes
|
||||
$atts = array_merge(array('value' => '', 'dtx-default' => ''), array_change_key_case((array)$atts, CASE_LOWER));
|
||||
if ($atts['value'] && $atts['dtx-default'] && $atts['value'] == $atts['dtx-default']) {
|
||||
|
||||
// Checkboxes can have multiple values checked, check mine if it's listed as a default value
|
||||
if ($atts['type'] == 'checkbox' && is_string($atts['dtx-default']) && strpos($atts['dtx-default'], '_') !== false) {
|
||||
$default = array_unique(explode('_', $atts['dtx-default']));
|
||||
if (in_array($atts['value'], $default)) {
|
||||
$atts['checked'] = 'checked';
|
||||
}
|
||||
} elseif ((is_numeric($atts['dtx-default']) || $atts['dtx-default']) && $atts['value'] == $atts['dtx-default']) {
|
||||
$atts['checked'] = 'checked';
|
||||
}
|
||||
$input = wpcf7dtx_input_html($atts);
|
||||
@@ -463,7 +470,7 @@ function wpcf7dtx_checkbox_group_html($atts, $options, $label_ui = false, $rever
|
||||
));
|
||||
$dynamic_value = '';
|
||||
$dynamic_label = $label;
|
||||
if ($value && $label && $value === $label) {
|
||||
if (is_string($value) && !empty($value) && $value === $label) {
|
||||
// These are identical, just handle it as one, could also be a raw shortcode
|
||||
$dynamic_option = trim(wpcf7dtx_get_dynamic($value, false, 'none')); // Do not sanitize yet, it may have HTML
|
||||
if (is_string($dynamic_option) && !empty($dynamic_option) && strpos($dynamic_option, '{') === 0 && strpos($dynamic_option, '}') === strlen($dynamic_option) - 1) {
|
||||
@@ -513,7 +520,8 @@ function wpcf7dtx_checkbox_group_html($atts, $options, $label_ui = false, $rever
|
||||
if ($exclusive) {
|
||||
$class[] = 'wpcf7-exclusive-checkbox';
|
||||
}
|
||||
if ($dynamic_value && $atts['dtx-default'] && $dynamic_value == $atts['dtx-default']) {
|
||||
$valid_default = is_numeric($atts['dtx-default']) || (is_string($atts['dtx-default']) && !empty($atts['dtx-default']));
|
||||
if ($valid_default && $dynamic_value == $atts['dtx-default']) {
|
||||
$my_atts['checked'] = 'checked';
|
||||
}
|
||||
$group_html[] = sprintf(
|
||||
|
||||
Reference in New Issue
Block a user