本文整理汇总了PHP中Horde::getAccessKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::getAccessKey方法的具体用法?PHP Horde::getAccessKey怎么用?PHP Horde::getAccessKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::getAccessKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRow
/**
* Adds a row to the sidebar.
*
* If containers/sections are not added explicitly to the view
* through the "containers" property, these rows will be used
* instead.
*
* @param array $row A hash with the row information. Possible
* values:
* - label: (string) The row text.
* - selected: (boolean) Whether to mark the row as active.
* - style: (string) Additional CSS styles to apply to the row.
* - url (string) URL to link the row to.
* - type (string, optional) The row type, defaults to "tree". Further
* $row properties depending on the type:
* - tree:
* - cssClass: (string) CSS class for the icon.
* - id: (string) DOM ID for the row link.
* - checkbox:
* - radiobox:
* - color: (string, optional) Background color.
* - edit: (string, optional) URL for extra edit icon.
* @param string $container If using multiple sidebar sections, the ID of
* the section to add the row to. Sections will
* be rendered in the order of their first usage.
*/
public function addRow(array $row, $container = '')
{
if (!isset($this->containers[$container])) {
$this->containers[$container] = array('rows' => array());
if ($container) {
$this->containers[$container]['id'] = $container;
}
}
$boxrow = isset($row['type']) && ($row['type'] == 'checkbox' || $row['type'] == 'radiobox');
$label = htmlspecialchars($row['label']);
if (isset($row['url'])) {
$url = empty($row['url']) ? new Horde_Url() : $row['url'];
if ($boxrow) {
$attributes = array();
} else {
$ak = Horde::getAccessKey($label);
$attributes = $ak ? array('accesskey' => $ak) : array();
}
foreach (array('onclick', 'target', 'class') as $attribute) {
if (!empty($row[$attribute])) {
$attributes[$attribute] = $row[$attribute];
}
}
if ($boxrow) {
$class = 'horde-resource-' . (empty($row['selected']) ? 'off' : 'on');
if ($row['type'] == 'radiobox') {
$class .= ' horde-radiobox';
}
if (empty($attributes['class'])) {
$attributes['class'] = $class;
} else {
$attributes['class'] .= ' ' . $class;
}
$row['link'] = $url->link($attributes) . $label . '</a>';
} else {
$row['link'] = $url->link($attributes) . Horde::highlightAccessKey($label, $ak) . '</a>';
}
} else {
$row['link'] = '<span class="horde-resource-none">' . $label . '</span>';
}
if ($boxrow) {
$this->containers[$container]['type'] = $row['type'];
if (!isset($row['style'])) {
$row['style'] = '';
}
if (!isset($row['color'])) {
$row['color'] = '#dddddd';
}
$foreground = '000';
if (Horde_Image::brightness($row['color']) < 128) {
$foreground = 'fff';
}
if (strlen($row['style'])) {
$row['style'] .= ';';
}
$row['style'] .= 'background-color:' . $row['color'] . ';color:#' . $foreground;
if (isset($row['edit'])) {
$row['editLink'] = $row['edit']->link(array('title' => _("Edit"), 'class' => 'horde-resource-edit-' . $foreground)) . '►' . '</a>';
}
}
$this->containers[$container]['rows'][] = $row;
}
示例2: render
/**
* Renders the tabs.
*
* @param string $active_tab If specified, the name of the active tab. If
* not, the active tab is determined
* automatically.
* @param string $class The CSS class of the tabset.
*/
public function render($active_tab = null, $class = 'tabset')
{
$html = "<div class=\"{$class}\"><ul>\n";
$active = $_SERVER['PHP_SELF'] . $this->_vars->get($this->_name);
foreach ($this->_tabs as $tab) {
$link = $this->_addPreserved($tab['link']);
if (!is_null($this->_name) && !is_null($tab['tabname'])) {
$link->add($this->_name, $tab['tabname']);
}
$classes = array();
if (isset($tab['class'])) {
$classes[] = $tab['class'];
}
if (!is_null($active_tab) && (string) $active_tab == (string) $tab['tabname'] || $active == $tab['link'] . $tab['tabname']) {
$classes[] = 'horde-active';
}
$class = $classes ? ' class="' . implode(' ', $classes) . '"' : '';
$id = '';
if (!empty($tab['id'])) {
$id = ' id="' . htmlspecialchars($tab['id']) . '"';
}
if (!isset($tab['target'])) {
$tab['target'] = '';
}
if (!isset($tab['onclick'])) {
$tab['onclick'] = '';
}
$accesskey = Horde::getAccessKey($tab['title']);
if (!empty($tab['img'])) {
$img = Horde_Themes_Image::tag($tab['img']);
} else {
$img = '';
}
$html .= '<li' . $class . $id . '>' . $link->link(array('target' => $tab['target'], 'onclick' => $tab['onclick'], 'accesskey' => $accesskey)) . $img . Horde::highlightAccessKey(str_replace(' ', ' ', $tab['title']), $accesskey) . "</a> </li>\n";
}
return $html . "</ul></div><br class=\"clear\" />\n";
}
示例3: shutdown
/**
* Events to do on shutdown.
*/
public function shutdown()
{
/* Register access key logger for translators. */
if (!empty($GLOBALS['conf']['log_accesskeys'])) {
Horde::getAccessKey(null, null, true);
}
/* Register memory tracker if logging in debug mode. */
Horde::log('Max memory usage: ' . memory_get_peak_usage(true) . ' bytes', 'DEBUG');
}
示例4: label
/**
* Returns a label element including an access key for usage in conjuction
* with a form field. User preferences regarding access keys are respected.
*
* @param string $for The form field's id attribute.
* @param string $label The label text.
* @param string $ak The access key to use. If null a new access key
* will be generated.
*
* @return string The html code for the label element.
*/
function label($for, $label, $ak = null)
{
if ($ak === null) {
$ak = Horde::getAccessKey($label, 1);
}
$label = Horde::highlightAccessKey($label, $ak);
return sprintf('<label for="%s"%s>%s</label>', $for, !empty($ak) ? ' accesskey="' . $ak . '"' : '', $label);
}