Horde_Registry::get PHP Method

get() public method

If that is not present, we return null.
public get ( string $parameter, string $app = null ) : string
$parameter string The configuration value to retrieve.
$app string The application to get the value for.
return string The requested parameter, or null if it is not set.
    public function get($parameter, $app = null)
    {
        if (is_null($app)) {
            $app = $this->getApp();
        }
        if (isset($this->applications[$app][$parameter])) {
            $pval = $this->applications[$app][$parameter];
        } else {
            switch ($parameter) {
                case 'icon':
                    $pval = Horde_Themes::img($app . '.png', $app);
                    if ((string) $pval == '') {
                        $pval = Horde_Themes::img('app-unknown.png', 'horde');
                    }
                    break;
                case 'initial_page':
                    $pval = null;
                    break;
                default:
                    $pval = isset($this->applications['horde'][$parameter]) ? $this->applications['horde'][$parameter] : null;
                    break;
            }
        }
        return $parameter == 'name' ? strlen($pval) ? _($pval) : '' : $pval;
    }

Usage Example

コード例 #1
0
ファイル: Perms.php プロジェクト: horde/horde
 /**
  * Given a permission name, returns the title for that permission by
  * looking it up in the applications's permission api.
  *
  * @param string $name  The permissions's name.
  *
  * @return string  The title for the permission.
  */
 public function getTitle($name)
 {
     if ($name === Horde_Perms::ROOT) {
         return Horde_Core_Translation::t("All Permissions");
     }
     $levels = explode(':', $name);
     if (count($levels) == 1) {
         return $this->_registry->get('name', $name) . ' (' . $name . ')';
     }
     array_pop($levels);
     // This is the permission name
     /* First level is always app. */
     $app = $levels[0];
     $app_perms = $this->getApplicationPermissions($app);
     return isset($app_perms['title'][$name]) ? $app_perms['title'][$name] . ' (' . $this->_perms->getShortName($name) . ')' : $this->_perms->getShortName($name);
 }