/**
* Create a property table for standard/custom properties.
*
* @since 1.2
*
* @param array $properties Array of post type properties.
* @param array $names Array of post type names.
* @param string $table_name Translated name for this table.
* @param bool $double Whether or not to repeat the row labels at the end of the table.
*/
protected function render_property_table($properties, $names, $table_name, $double)
{
/* Create header row. */
$header_row = '
<tr>
<th>' . esc_html__('Property', self::DBPT_NAME) . '</th>';
foreach ($names as $name) {
$header_row .= '
<th>' . esc_html($name) . '</th>';
}
unset($name);
if ($double === true) {
$header_row .= '
<th class="' . self::DBPT_NAME . '-table-end">' . esc_html__('Property', self::DBPT_NAME) . '</th>';
}
$header_row .= '
</tr>';
echo '
<h3>', esc_html($table_name), '</h3>
<table class="debug-bar-table ', self::DBPT_NAME, '">
<thead>
', $header_row, '
</thead>
<tfoot>
', $header_row, '
</tfoot>
<tbody>';
unset($header_row);
/* Sort. */
uksort($properties, 'strnatcasecmp');
/* Output. */
foreach ($properties as $key => $value) {
echo '
<tr>
<th>', esc_html($key), '</th>';
foreach ($names as $name) {
echo '
<td>';
if (isset($value[$name])) {
if (defined('Debug_Bar_Pretty_Output::VERSION')) {
echo Debug_Bar_Pretty_Output::get_output($value[$name], '', true, '', true);
// WPCS: XSS ok.
} else {
// An old version of the pretty output class was loaded.
Debug_Bar_Pretty_Output::output($value[$name], '', true, '', true);
}
} else {
echo ' ';
}
echo '
</td>';
}
unset($name);
if ($double === true) {
echo '
<th class="', self::DBPT_NAME, '-table-end">', esc_html($key), '</th>';
// WPCS: XSS ok.
}
echo '
</tr>';
}
unset($key, $value);
echo '
</tbody>
</table>
';
}