A WordPress-centric search engine for devs and theme authors



wp_privacy_generate_personal_data_export_group_html ›

Since4.9.6
Deprecatedn/a
wp_privacy_generate_personal_data_export_group_html ( $group_data )
Parameters:
  • (array) $group_data { The group data to render.
    Required: Yes
Returns:
  • (string) The HTML for this group and its items.
Defined at:
Codex:

Generate a single group for the personal data export report.



Source

function wp_privacy_generate_personal_data_export_group_html( $group_data ) {
	$allowed_tags      = array(
		'a' => array(
			'href'   => array(),
			'target' => array()
		),
		'br' => array()
	);
	$allowed_protocols = array( 'http', 'https' );
	$group_html        = '';

	$group_html .= '<h2>' . esc_html( $group_data['group_label'] ) . '</h2>';
	$group_html .= '<div>';

	foreach ( (array) $group_data['items'] as $group_item_id => $group_item_data ) {
		$group_html .= '<table>';
		$group_html .= '<tbody>';

		foreach ( (array) $group_item_data as $group_item_datum ) {
			$value = $group_item_datum['value'];
			// If it looks like a link, make it a link
			if ( false === strpos( $value, ' ' ) && ( 0 === strpos( $value, 'http://' ) || 0 === strpos( $value, 'https://' ) ) ) {
				$value = '<a href="' . esc_url( $value ) . '">' . esc_html( $value ) . '</a>';
			}

			$group_html .= '<tr>';
			$group_html .= '<th>' . esc_html( $group_item_datum['name'] ) . '</th>';
			$group_html .= '<td>' . wp_kses( $value, $allowed_tags, $allowed_protocols ) . '</td>';
			$group_html .= '</tr>';
		}

		$group_html .= '</tbody>';
		$group_html .= '</table>';
	}

	$group_html .= '</div>';

	return $group_html;
}