本文整理汇总了PHP中Horde::_noAccessKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::_noAccessKey方法的具体用法?PHP Horde::_noAccessKey怎么用?PHP Horde::_noAccessKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::_noAccessKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAccessKey
/**
* Returns an un-used access key from the label given.
*
* @param string $label The label to choose an access key from.
* @param boolean $nocheck Don't check if the access key already has been
* used?
*
* @return string A single lower case character access key or empty
* string if none can be found
*/
public static function getAccessKey($label, $nocheck = false, $shutdown = false)
{
/* Shutdown call for translators? */
if ($shutdown) {
if (!count(self::$_labels)) {
return;
}
$script = basename($_SERVER['PHP_SELF']);
$labels = array_keys(self::$_labels);
sort($labels);
$used = array_keys(self::$_used);
sort($used);
$remaining = str_replace($used, array(), 'abcdefghijklmnopqrstuvwxyz');
self::log('Access key information for ' . $script);
self::log('Used labels: ' . implode(',', $labels));
self::log('Used keys: ' . implode('', $used));
self::log('Free keys: ' . $remaining);
return;
}
/* Use access keys at all? */
if (!isset(self::$_noAccessKey)) {
self::$_noAccessKey = !$GLOBALS['browser']->hasFeature('accesskey') || !$GLOBALS['prefs']->getValue('widget_accesskey');
}
if (self::$_noAccessKey || !preg_match('/_([A-Za-z])/', $label, $match)) {
return '';
}
$key = $match[1];
/* Has this key already been used? */
if (isset(self::$_used[strtolower($key)]) && !($nocheck && isset(self::$_labels[$label]))) {
return '';
}
/* Save key and label. */
self::$_used[strtolower($key)] = true;
self::$_labels[$label] = true;
return $key;
}