add_render_attribute( 'title', 'class', 'alpha-map-title' );
// Check and add size class if provided.
if ( ! empty( $settings['size'] ) ) {
$this->add_render_attribute( 'title', 'class', 'elementor-size-' . sanitize_html_class( $settings['size'] ) );
}
// Allow inline editing of the title.
$this->add_inline_editing_attributes( 'title' );
// Sanitize the title.
$title = sanitize_text_field( $settings['title'] );
// If a link is provided, sanitize and set attributes.
if ( ! empty( $settings['link']['url'] ) ) {
$settings['link'] = wp_parse_args(
$settings['link'],
array(
'url' => '',
'is_external' => '',
'nofollow' => '',
)
);
$this->add_link_attributes( 'url', $settings['link'] );
$title = sprintf(
'
%2$s',
$this->get_render_attribute_string( 'url' ),
esc_html( $title )
);
}
// Validate and sanitize the header size tag.
$header_tag = Utils::validate_html_tag( $settings['header_size'] );
// Construct the title HTML with proper escaping.
$title_html = sprintf(
'<%1$s %2$s>%3$s%1$s>',
esc_html( $header_tag ),
$this->get_render_attribute_string( 'title' ),
$title
);
// Sanitize the entire output.
echo wp_kses(
$title_html,
array(
'a' => array(
'href' => array(),
'target' => array(),
'rel' => array(),
'class' => array(),
),
$header_tag => array(
'class' => array(),
'id' => array(),
'style' => array(),
),
)
);
}
?>
get_render_attribute_string( 'style_wrapper' ) ); ?>>
$pin ) {
$key = 'map_marker_' . $index;
// Sanitize data before use.
$latitude = $this->normalize_coordinate( $pin['map_latitude'] ?? '', '', -90, 90 );
$longitude = $this->normalize_coordinate( $pin['map_longitude'] ?? '', '', -180, 180 );
$icon_url = isset( $pin['pin_icon']['url'] ) ? esc_url( $pin['pin_icon']['url'] ) : '';
$icon_active_url = isset( $pin['pin_active_icon']['url'] ) ? esc_url( $pin['pin_active_icon']['url'] ) : '';
$icon_size = isset( $pin['pin_icon_size']['size'] ) ? intval( $pin['pin_icon_size']['size'] ) : '';
$data_max_width = isset( $marker_width ) ? intval( $marker_width ) : '';
$data_id = intval( $index );
$this->add_render_attribute(
$key,
array(
'class' => 'alpha-pin',
'data-lng' => $longitude,
'data-lat' => $latitude,
'data-icon' => $icon_url,
'data-icon-active' => $icon_active_url,
'data-icon-size' => $icon_size,
'data-max-width' => $data_max_width,
'data-id' => $data_id,
)
);
// Sanitize IDs.
$gallery_ids = ! empty( $pin['pin_desc_gallery'] ) && is_array( $pin['pin_desc_gallery'] ) ? $pin['pin_desc_gallery'] : array();
$ids = array_map( 'intval', wp_list_pluck( $gallery_ids, 'id' ) );
$count = count( $ids );
$data_count = max( 0, $count - 4 );
$this->add_render_attribute( 'shortcode' . $index, 'ids', implode( ',', $ids ) );
?>
get_render_attribute_string( $key ) ); ?>>
get_render_attribute_string( 'shortcode' . $index ) . ']' );
remove_filter( 'wp_get_attachment_link', array( $this, 'add_lightbox_data_to_image_link' ) );
?>