当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde::getAccessKey方法代码示例

本文整理汇总了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)) . '&#9658;' . '</a>';
         }
     }
     $this->containers[$container]['rows'][] = $row;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:88,代码来源:Sidebar.php

示例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(' ', '&nbsp;', $tab['title']), $accesskey) . "</a> </li>\n";
     }
     return $html . "</ul></div><br class=\"clear\" />\n";
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:45,代码来源:Tabs.php

示例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');
 }
开发者ID:horde,项目名称:horde,代码行数:12,代码来源:Registry.php

示例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);
 }
开发者ID:justinlyon,项目名称:scc,代码行数:19,代码来源:Horde.php


注:本文中的Horde::getAccessKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。