/** * Generate html representation for this value. * * The html output is 100% trusted, and no effort is being made to sanitize * it. It's up to the implementor to sanitize user provided values. * * The output must be in UTF-8. * * The baseUri parameter is a url to the root of the application, and can * be used to construct local links. * * @param HtmlOutputHelper $html * @return string */ function toHtml(HtmlOutputHelper $html) { $links = []; foreach ($this->getHrefs() as $href) { $links[] = $html->link($href); } return implode('<br />', $links); }
/** * Generate html representation for this value. * * The html output is 100% trusted, and no effort is being made to sanitize * it. It's up to the implementor to sanitize user provided values. * * The output must be in UTF-8. * * The baseUri parameter is a url to the root of the application, and can * be used to construct local links. * * @param HtmlOutputHelper $html * @return string */ function toHtml(HtmlOutputHelper $html) { ob_start(); echo "<table>"; echo "<tr><th>Principal</th><th>Privilege</th><th></th></tr>"; foreach ($this->privileges as $privilege) { echo '<tr>'; // if it starts with a {, it's a special principal if ($privilege['principal'][0] === '{') { echo '<td>', $html->xmlName($privilege['principal']), '</td>'; } else { echo '<td>', $html->link($privilege['principal']), '</td>'; } echo '<td>', $html->xmlName($privilege['privilege']), '</td>'; echo '<td>'; if (!empty($privilege['protected'])) echo '(protected)'; echo '</td>'; echo '</tr>'; } echo "</table>"; return ob_get_clean(); }