⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.php

📁 FP2 CRM code+Mysql DB
💻 PHP
📖 第 1 页 / 共 3 页
字号:
     */    function set($key, $value, $layer = 'user')    {        if (empty($this->configuration_info[$key])) {            return false;        }        extract($this->configuration_info[$key]);        switch ($type) {            case 'integer':                $value = (int)$value;                break;            case 'set': {                // If a valid_set is specified, require the value to                // be in the set.  If there is no valid_set, accept                // any value.                if ($valid_set) {                    reset($valid_set);                    if ((key($valid_set) === 0 && !in_array($value, $valid_set)) ||                        (key($valid_set) !== 0 && empty($valid_set[$value])))                    {                        return false;                    }                }                break;            }        }        $this->configuration[$layer][$key] = $value;        return true;    }    // }}}    // {{{ getType(key)    /**     * Get the type of a config value.     *     * @param string  config key     *     * @return string type, one of "string", "integer", "file",     * "directory", "set" or "password".     *     * @access public     *     */    function getType($key)    {        if (isset($this->configuration_info[$key])) {            return $this->configuration_info[$key]['type'];        }        return false;    }    // }}}    // {{{ getDocs(key)    /**     * Get the documentation for a config value.     *     * @param string  config key     *     * @return string documentation string     *     * @access public     *     */    function getDocs($key)    {        if (isset($this->configuration_info[$key])) {            return $this->configuration_info[$key]['doc'];        }        return false;    }       // }}}    // {{{ getPrompt(key)    /**     * Get the short documentation for a config value.     *     * @param string  config key     *     * @return string short documentation string     *     * @access public     *     */    function getPrompt($key)    {        if (isset($this->configuration_info[$key])) {            return $this->configuration_info[$key]['prompt'];        }        return false;    }    // }}}    // {{{ getGroup(key)    /**     * Get the parameter group for a config key.     *     * @param string  config key     *     * @return string parameter group     *     * @access public     *     */    function getGroup($key)    {        if (isset($this->configuration_info[$key])) {            return $this->configuration_info[$key]['group'];        }        return false;    }    // }}}    // {{{ getGroups()    /**     * Get the list of parameter groups.     *     * @return array list of parameter groups     *     * @access public     *     */    function getGroups()    {        $tmp = array();        foreach ($this->configuration_info as $key => $info) {            $tmp[$info['group']] = 1;        }        return array_keys($tmp);    }    // }}}    // {{{ getGroupKeys()    /**     * Get the list of the parameters in a group.     *     * @param string $group parameter group     *     * @return array list of parameters in $group     *     * @access public     *     */    function getGroupKeys($group)    {        $keys = array();        foreach ($this->configuration_info as $key => $info) {            if ($info['group'] == $group) {                $keys[] = $key;            }        }        return $keys;    }    // }}}    // {{{ getSetValues(key)    /**     * Get the list of allowed set values for a config value.  Returns     * NULL for config values that are not sets.     *     * @param string  config key     *     * @return array enumerated array of set values, or NULL if the     *               config key is unknown or not a set     *     * @access public     *     */    function getSetValues($key)    {        if (isset($this->configuration_info[$key]) &&            isset($this->configuration_info[$key]['type']) &&            $this->configuration_info[$key]['type'] == 'set')        {            $valid_set = $this->configuration_info[$key]['valid_set'];            reset($valid_set);            if (key($valid_set) === 0) {                return $valid_set;            }            return array_keys($valid_set);        }        return false;    }    // }}}    // {{{ getKeys()    /**     * Get all the current config keys.     *     * @return array simple array of config keys     *     * @access public     */    function getKeys()    {        $keys = array();        foreach ($this->layers as $layer) {            $keys = array_merge($keys, $this->configuration[$layer]);        }        return array_keys($keys);    }    // }}}    // {{{ remove(key, [layer])    /**     * Remove the a config key from a specific config layer.     *     * @param string config key     *     * @param string (optional) config layer     *     * @return bool TRUE on success, FALSE on failure     *     * @access public     */    function remove($key, $layer = 'user')    {        if (isset($this->configuration[$layer][$key])) {            unset($this->configuration[$layer][$key]);            return true;        }        return false;    }    // }}}    // {{{ removeLayer(layer)    /**     * Temporarily remove an entire config layer.  USE WITH CARE!     *     * @param string config key     *     * @param string (optional) config layer     *     * @return bool TRUE on success, FALSE on failure     *     * @access public     */    function removeLayer($layer)    {        if (isset($this->configuration[$layer])) {            $this->configuration[$layer] = array();            return true;        }        return false;    }    // }}}    // {{{ store([layer])    /**     * Stores configuration data in a layer.     *     * @param string config layer to store     *     * @return bool TRUE on success, or PEAR error on failure     *     * @access public     */    function store($layer = 'user', $data = null)    {        return $this->writeConfigFile(null, $layer, $data);    }    // }}}    // {{{ toDefault(key)    /**     * Unset the user-defined value of a config key, reverting the     * value to the system-defined one.     *     * @param string config key     *     * @return bool TRUE on success, FALSE on failure     *     * @access public     */    function toDefault($key)    {        trigger_error("PEAR_Config::toDefault() deprecated, use PEAR_Config::remove() instead", E_USER_NOTICE);        return $this->remove($key, 'user');    }    // }}}    // {{{ definedBy(key)    /**     * Tells what config layer that gets to define a key.     *     * @param string config key     *     * @return string the config layer, or an empty string if not found     *     * @access public     */    function definedBy($key)    {        foreach ($this->layers as $layer) {            if (isset($this->configuration[$layer][$key])) {                return $layer;            }        }        return '';    }    // }}}    // {{{ isDefaulted(key)    /**     * Tells whether a config value has a system-defined value.     *     * @param string   config key     *     * @return bool     *     * @access public     *     * @deprecated     */    function isDefaulted($key)    {        trigger_error("PEAR_Config::isDefaulted() deprecated, use PEAR_Config::definedBy() instead", E_USER_NOTICE);        return $this->definedBy($key) == 'system';    }    // }}}    // {{{ isDefined(key)    /**     * Tells whether a given key exists as a config value.     *     * @param string config key     *     * @return bool whether <config key> exists in this object     *     * @access public     */    function isDefined($key)    {        foreach ($this->layers as $layer) {            if (isset($this->configuration[$layer][$key])) {                return true;            }        }        return false;    }    // }}}    // {{{ isDefinedLayer(key)    /**     * Tells whether a given config layer exists.     *     * @param string config layer     *     * @return bool whether <config layer> exists in this object     *     * @access public     */    function isDefinedLayer($layer)    {        return isset($this->configuration[$layer]);    }    // }}}    // {{{ getLayers()    /**     * Returns the layers defined (except the 'default' one)     *     * @return array of the defined layers     */    function getLayers()    {        $cf = $this->configuration;        unset($cf['default']);        return array_keys($cf);    }    // }}}}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -