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


PHP config::reg_section方法代码示例

本文整理汇总了PHP中config::reg_section方法的典型用法代码示例。如果您正苦于以下问题:PHP config::reg_section方法的具体用法?PHP config::reg_section怎么用?PHP config::reg_section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config的用法示例。


在下文中一共展示了config::reg_section方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

<?php

/**
 * Configuration file for locale
 */
config::reg_section("locale", array("title" => "Locale"));
config::reg_subsection("locale", "options", array("title" => "Localization and internationalization options", "advanced" => true));
config::reg_subsection("locale", "retreive", array("title" => "Locale retreive mode", "advanced" => true));
config::reg_subsection("locale", "langs", array("title" => "Available languages"));
//// mode
config::reg_field("locale", "options", "locale_enabled", array("title" => "Enable translations", "type" => "checkbox", "label" => "Parse language blocks in pages ", "cast" => "bool", "default" => true, "desc" => "Look for multilanguage tags in page files and translate "));
config::reg_field("locale", "options", "locale_set_php", array("title" => "Use PHP locale", "type" => "checkbox", "label" => "Set PHP locale on every page ", "cast" => "bool", "default" => true, "advanced" => true, "desc" => "Desactivate if locale is enabled but host does not support php's set_locale "));
config::reg_field("locale", "retreive", "locale_use_session", array("title" => "Store with session", "type" => "checkbox", "default" => false, "advanced" => true, "desc" => "Use session to store locale and retrieve on each page. This is transparent to user"));
config::reg_field("locale", "retreive", "locale_use_cookie", array("title" => "Store with cookie", "type" => "checkbox", "default" => true, "advanced" => true, "desc" => "Use cookie to store locale and retrieve on each page. This will be kept across sessions"));
config::reg_field("locale", "retreive", "locale_use_url", array("title" => "Store in URL", "type" => "checkbox", "default" => false, "advanced" => true, "desc" => "Use URL to store locale and retrieve on each page. Will add a 'virtual' top folder for each language. This is a good solution for search engines."));
config::reg_field("locale", "retreive", "locale_url_syntax", array("title" => "URL only: syntax", "type" => "radio", "options" => array("lang_country" => "lang_country (eg. /en_US/)", "lang-country" => "language-country (eg. /en-US/)", "lang" => "language only (eg. /en/)", "country" => "country only (eg. /US/)"), "default" => "lang", "advanced" => true, "desc" => "Define here how to write locale in the URL. Note that this does not affect URL parsing, all syntax are valid for setting the locale"));
config::reg_field("locale", "retreive", "locale_use_get", array("title" => "Store in GET params", "type" => "checkbox", "default" => false, "advanced" => true, "desc" => "Use GET params to store locale and retrieve on each page. This is not as nice as in URL storing but can be used if in URL is not possible."));
config::reg_field("locale", "retreive", "locale_get_param_name", array("title" => "GET param only: locale param name", "type" => "text", "default" => "locale", "advanced" => true, "desc" => "If using GET param to store locale, then define the name of the GET param"));
config::reg_field("locale", "retreive", "locale_use_user", array("title" => "Store in user DB", "type" => "checkbox", "default" => false, "advanced" => true, "desc" => "Use user DB to store logged users locale and retrieve on each page. This will be kept across sessions. User object must have locale_lang and locale_country fields (which can either be real DB entries or an overloaded fields)"));
//// langs
config::reg_field("locale", "langs", "locale_languages", array("title" => "Languages", "type" => "table", "columns" => array("lang" => array("title" => "Language code", "width" => "30%"), "countries" => array("title" => "Countries code")), "num" => "auto", "onsave" => "config_langs_table_save", "onload" => "config_langs_table_load", "default" => array("lang" => array(0 => "en"), "countries" => array(0 => "US|UK")), "example" => array("lang" => "en", "countries" => "US|UK|CA|SG"), "desc" => "Table of all languages available (2 letters ID). First will be default if detection fails.<br/>For each language: list of all countries available (2 letters ID), separated by |. First will be default if detection fails.<br/>Warning: If you use php locales (see Use PHP locale in advanced locale options), each pair of language / first country, must be a valid PHP locale, otherwise, the language won't be available and an error will be thrown"));
function config_langs_table_load($field_id, $raw)
{
    $output = array();
    if (is_array($raw)) {
        foreach ($raw as $lang => $countries) {
            $output[] = array("lang" => $lang, "countries" => $countries);
        }
    }
    return $output;
}
开发者ID:laiello,项目名称:phpbf,代码行数:31,代码来源:core.locale.php

示例2: array

<?php

/**
 * Configuration file for directories
 */
config::reg_section("dir", array("title" => "Directories"));
config::reg_subsection("dir", "base_url", array("title" => "Base URL", "advanced" => true, "desc" => "Website root will not always match server document root, in which case the framework needs to know its base URL"));
config::reg_subsection("dir", "path_to_root", array("title" => "Framework folder", "advanced" => true));
config::reg_subsection("dir", "builtin", array("title" => "Built-in directories", "desc" => '
	Note : All folder paths should end with a trailing slash /. A valid folder path is one of the following:
	<ul>
    	<li>A relative path from the site root directory (where index files is located). It must NOT start with a slash /</li>
    	<li>An absolute path on server starting with a slash /</li>
    	<li>An URL in the form scheme://... (example: <i>http://data.mysite/imagedb/</i> for <i>img</i> folder to host your images elsewhere)</li>
    </ul>
    Do not use backward slashs \\, unless you only use windows based server. Forward slash / always work and is recommended.
'));
config::reg_subsection("dir", "userdefined", array("title" => "User-defined folders"));
//// base_url
config::reg_field("dir", "base_url", "auto_detect_base_url", array("title" => "Autodetect base URL", "type" => "radio", "options" => array(1 => "Automatic", 0 => "Manual"), "default" => true, "cast" => "bool", "advanced" => true, "desc" => "Detection need urlrewrite to be on and .htaccess file from the website root to be processed. Make sure you placed the right .htaccess in website root. Depending on server configuration you might need to set it manually."));
config::reg_field("dir", "base_url", "base_url", array("title" => "Manual Base URL", "default" => "/", "advanced" => true, "desc" => "Base URL to website root. Must be an absolute path, must start and end with a /"));
//// path_to_root
config::reg_field("dir", "path_to_root", "path_to_root", array("title" => "Path to root directory", "default" => "./../../../", "desc" => "Path to site root directory. Must either be a relative path from Framework.php to the root folder (where index files is located) or an absolute path on the server. Must end with a /."));
//// builtin
config::reg_field("dir", "builtin", "folder_framework", array("title" => "Folder : framework", "default" => "core/lib/phpbf/", "desc" => "Folder containing PhpBF Framework (where framework.php and conf.php are)"));
config::reg_field("dir", "builtin", "folder_admin", array("title" => "Folder : admin", "default" => "core/admin/", "desc" => "Folder containing the administration console"));
config::reg_field("dir", "builtin", "folder_tpl", array("title" => "Folder : tpl", "default" => "core/templates/", "desc" => "Folder containing templates"));
config::reg_field("dir", "builtin", "folder_data", array("title" => "Folder : data", "default" => "core/data/", "desc" => "Folder with write permission (for compiled templates, file DB, etc...)"));
config::reg_field("dir", "builtin", "folder_log", array("title" => "Folder : log", "default" => "core/data/log/", "desc" => "Folder containing log file (must be writable)"));
config::reg_field("dir", "builtin", "folder_compiled", array("title" => "Folder : compiled", "default" => "core/data/compiled_templates/", "desc" => "Folder containing compiled templates (must be writable) "));
config::reg_field("dir", "builtin", "folder_cached", array("title" => "Folder : cached", "default" => "core/data/cached_templates/", "desc" => "Folder containing cached templates (must be writable) "));
开发者ID:laiello,项目名称:phpbf,代码行数:31,代码来源:core.2.dir.php

示例3: array

<?php

/**
 * Configuration file for time
 */
config::reg_section("time", array("title" => "Time", "advanced" => false));
config::reg_subsection("time", "time", array("title" => "Server time"));
//// time
config::reg_field("time", "time", "time_default_zone", array("title" => "Server time zone", "type" => "text", "default" => "GMT", "desc" => "Default time zone (Works with PHP versions > 5.1). Must be a <a href='http://php.net/manual/en/timezones.php' target='_blank'>valid PHP Timezone</a>"));
开发者ID:laiello,项目名称:phpbf,代码行数:9,代码来源:core.time.php

示例4: array

<?php

/**
 * Configuration file for mail
 */
config::reg_section("mail", array("title" => "Mail"));
config::reg_subsection("mail", "mode", array("title" => "General settings for sending mails"));
config::reg_subsection("mail", "smtp", array("title" => "SMTP Settings", "advanced" => true));
config::reg_subsection("mail", "sendmail", array("title" => "Sendmail settings", "advanced" => true));
//// mode
config::reg_field("mail", "mode", "mail_default_to", array("title" => "Default To address", "default" => "@", "desc" => "Default address to send mails to, used for contact page."));
config::reg_field("mail", "mode", "mail_method", array("title" => "Mail method", "type" => "radio", "options" => array("mail" => "PHP Mail function", "smtp" => "SMTP", "sendmail" => "Sendmail"), "default" => "mail", "advanced" => true, "desc" => "Determine how user are sorted into groups. See doc for more info"));
//// SMTP
config::reg_field("mail", "smtp", "mail_smtp_host", array("title" => "SMTP Host", "default" => "localhost"));
config::reg_field("mail", "smtp", "mail_smtp_port", array("title" => "SMTP Port number", "default" => "", "Leave blank for default SMTP port"));
config::reg_field("mail", "smtp", "mail_smtp_username", array("title" => "SMTP Username", "default" => ""));
config::reg_field("mail", "smtp", "mail_smtp_password", array("title" => "SMTP Password", "default" => ""));
//// sendmail
config::reg_field("mail", "sendmail", "mail_sendmail_path", array("title" => "Sendmail path", "default" => "", "desc" => "Path to Sendmail on server"));
//// ERROR LOG
config::reg_field("error", "log", "error_send_mail", array("title" => "Mail errors", "type" => "checkbox", "label" => "Send a mail on error", "cast" => "bool", "default" => false, "advanced" => true, "desc" => "Send an email to below address everytime an error occurs (useful in production environment)"));
config::reg_field("error", "log", "error_email", array("title" => "Email for sending errors", "type" => "text", "default" => "", "advanced" => true, "desc" => "Send an email to this address on error with informations for debuging. Need the mail module. Leaving blank will desactivate"));
开发者ID:laiello,项目名称:phpbf,代码行数:22,代码来源:plugin.mail.php

示例5: array

<?php

/**
 * Configuration file for templates
 */
config::reg_section("template", array("title" => "Templates", "advanced" => false));
config::reg_subsection("template", "content", array("title" => "Pages content and organization"));
config::reg_subsection("template", "smarty", array("title" => "Smarty template engine options"));
config::reg_subsection("template", "caching", array("title" => "Caching"));
//// content
config::reg_field("template", "content", "window_title", array("title" => "Window title", "type" => "text", "default" => "My site - %s", "desc" => "Default browser window title. '%s' will be replaced by current page title"));
config::reg_field("template", "content", "template_default_creator", array("title" => "Default template creator meta", "type" => "text", "default" => "My name", "desc" => "Default value for the creator meta tag in header. You can also chage this directly in header.tpl"));
config::reg_field("template", "content", "page_default", array("title" => "Default page", "type" => "text", "default" => "home", "desc" => "Default page to display (site home page)"));
config::reg_field("template", "content", "page_error", array("title" => "Error page", "type" => "text", "default" => "error", "desc" => "Page to display when an error occurs", "advanced" => true));
config::reg_field("template", "content", "page_logged", array("title" => "Logged welcome page", "type" => "text", "default" => "logged", "desc" => "Page to display once user is logged"));
config::reg_field("template", "content", "template_default_content_type", array("title" => "Default content type", "type" => "text", "default" => "text/html", "advanced" => true, "desc" => "Default content type for all templates served by template"));
//// Smarty
config::reg_field("template", "smarty", "template_smarty_debug", array("title" => "Smarty debug mode", "type" => "checkbox", "label" => "Enable", "cast" => "bool", "default" => false, "desc" => "Use Smarty template engine debug mode that display a popup showing all template varaibles assigned on every page"));
config::reg_field("template", "smarty", "template_compile_check", array("title" => "Check templates for modifications", "type" => "radio", "default" => true, "options" => array(0 => "Disabled", 1 => "Enabled"), "cast" => "bool", "desc" => "Upon each invocation of the PHP application, Smarty tests to see if the current template has changed (different time stamp) since the last time it was compiled. If it has changed, it recompiles that template. If the template has not been compiled, it will compile regardless of this setting.", "advanced" => true));
//// Caching
config::reg_field("template", "caching", "template_cache", array("title" => "Caching", "type" => "radio", "options" => array(0 => "Caching disabled", 1 => "Caching enabled"), "default" => false, "cast" => "bool", "desc" => "Cache templates output for better performance. <br/>Note: Make sure all templates can be cached, most dynamic content cannot be cached and need to be escaped"));
config::reg_field("template", "caching", "template_cache_lifetime", array("title" => "Cache lifetime", "type" => "text", "cast" => "int", "default" => 86400, "desc" => "Default lifetime for cached templates. -1 for unlimited, 0 for regenerate on each load (not recommended, disable caching instead)"));
开发者ID:laiello,项目名称:phpbf,代码行数:22,代码来源:core.2.template.php

示例6: array

<?php

/**
 * Configuration file for users
 */
config::reg_section("users", array("title" => "User identification"));
config::reg_subsection("users", "login", array("title" => "User login"));
//// login
config::reg_field("users", "login", "user_login_time", array("title" => "Max logged time", "default" => "24", "desc" => "Time in hours before login expire and user has to login again. 0 for never"));
config::reg_field("users", "login", "user_inactivity_time", array("title" => "Max inactivity time", "default" => "5", "desc" => "Time in hours of inactivity before login expire and user has to login again. 0 for never "));
开发者ID:laiello,项目名称:phpbf,代码行数:10,代码来源:core.users.php

示例7: array

<?php

/**
 * Configuration file for groups and access restriction
 */
config::reg_section("groups", array("title" => "Groups"));
config::reg_subsection("groups", "mode", array("title" => "Groups mode"));
config::reg_subsection("groups", "builtin", array("title" => "Built-in mode only"));
//// mode
config::reg_field("groups", "mode", "user_group", array("title" => "Group mode", "type" => "radio", "options" => array(1 => "Built-in", 2 => "Database", 0 => "None"), "default" => 1, "cast" => "int", "desc" => "Determine how user are sorted into groups. See doc for more info"));
//// builtin
config::reg_field("groups", "builtin", "user_field_id_group", array("title" => "User table group field name", "type" => "text", "default" => "id_group", "desc" => "Name of the user table field containing the group id. Field must be of type integer with length 2"));
config::reg_field("groups", "builtin", "groups", array("title" => "List of groups", "type" => "table", "columns" => array("id" => array("title" => "ID", "type" => "custom", "width" => "10%", "content" => "<b>%s</b>"), "name" => array("title" => "Name", "width" => "30%"), "parents" => array("title" => "Parent groups (names, seperated by |)")), "num" => 32, "onsave" => "config_groups_table_save", "onload" => "config_groups_table_load", "default" => array(), "desc" => "Each user will be associated to a single group ID, but will also belongs to the group's parents, and will inherite their rights"));
function config_groups_table_load($id, $raw)
{
    $groups_names = is_array(config::get('groups')) ? config::get('groups') : array();
    for ($i = 1; $i <= 32; $i++) {
        $output[$i - 1] = array("id" => $i, "name" => $groups_names[$i], "parents" => array());
        for ($j = 1; $j <= 32; $j++) {
            if (config::get('groups_parents', $i) & pow(2, $j - 1)) {
                $output[$i - 1]["parents"][] = $groups_names[$j];
            }
        }
    }
    return $output;
}
function config_groups_table_save($id, $input, &$conf)
{
    // first add all group names
    $conf["groups_id"] = array();
    for ($i = 1; $i <= 32; $i++) {
开发者ID:laiello,项目名称:phpbf,代码行数:31,代码来源:core.groups.php

示例8: array

<?php

/**
 * Configuration file for sections and color schemes
 */
config::reg_section("sections", array("title" => "Sections and schemes"));
config::reg_subsection("sections", "schemes", array("title" => "Color schemes"));
config::reg_subsection("sections", "sections", array("title" => "Sections"));
//// schemes
config::reg_field("sections", "schemes", "colors", array("title" => "Color schemes", "type" => "table", "columns" => array("id" => array("title" => "ID", "width" => "10%"), 0 => array("title" => "0", "width" => "10%", "maxlength" => 7), 1 => array("title" => "1", "width" => "10%", "maxlength" => 7), 2 => array("title" => "2", "width" => "10%", "maxlength" => 7), 3 => array("title" => "3", "width" => "10%", "maxlength" => 7), 4 => array("title" => "4", "width" => "10%", "maxlength" => 7), 5 => array("title" => "5", "width" => "10%", "maxlength" => 7), 6 => array("title" => "6", "width" => "10%", "maxlength" => 7), 7 => array("title" => "7", "width" => "10%", "maxlength" => 7), 8 => array("title" => "8", "width" => "10%", "maxlength" => 7)), "num" => "auto", "onsave" => "config_schemes_table_save", "onload" => "config_schemes_table_load", "default" => array(), "example" => array("id" => "main", 0 => "#000000", 1 => "#7E0C0C", 2 => "#B82626", 3 => "#FB4444", 4 => "#FBCECE", 5 => "#FDECEC", 6 => "#FEFAFA", 7 => "#FFFFFF", 8 => "#FFFFFF"), "desc" => "You can set up to 9 colors for each color scheme. They must be in the form : #XXXXXX.<br/>Colors defined in color scheme may be accessed in CSS and in templates. If using section, you may define more than one color scheme, and associate each color to a section. If not, first color will be used as default."));
function config_schemes_table_load($field_id, $raw)
{
    $output = array();
    if (is_array($raw)) {
        foreach ($raw as $id => $colors) {
            $colors["id"] = $id;
            $output[] = $colors;
        }
    }
    return $output;
}
function config_schemes_table_save($field_id, $input, &$conf)
{
    $output = array();
    for ($i = 0; $i < count($input['id']); $i++) {
        $id = trim($_POST['colors']['id'][$i]);
        if ($id) {
            $output[$id] = array(preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[0][$i]) ? strtoupper($input[0][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[1][$i]) ? strtoupper($input[1][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[2][$i]) ? strtoupper($input[2][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[3][$i]) ? strtoupper($input[3][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[4][$i]) ? strtoupper($input[4][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[5][$i]) ? strtoupper($input[5][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[6][$i]) ? strtoupper($input[6][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[7][$i]) ? strtoupper($input[7][$i]) : '#FFFFFF', preg_match('/^\\#[0-9A-Fa-f]{6}$/', $input[8][$i]) ? strtoupper($input[8][$i]) : '#FFFFFF');
        }
    }
    $conf[$field_id] = $output;
开发者ID:laiello,项目名称:phpbf,代码行数:31,代码来源:core.sections.php

示例9: array

<?php

/**
 * Configuration file for error handling
 */
config::reg_section("error", array("title" => "Error handling"));
config::reg_subsection("error", "mode", array("title" => "Error handling"));
config::reg_subsection("error", "log", array("title" => "Error log"));
//// mode
config::reg_field("error", "mode", "error_reporting", array("title" => "PHP error reporting level", "type" => "select", "default" => E_ALL | E_STRICT, "options" => array(0 => 'None', E_ERROR | E_WARNING | E_PARSE => 'E_ERROR | E_WARNING | E_PARSE', E_ERROR | E_WARNING | E_PARSE | E_NOTICE => 'E_ERROR | E_WARNING | E_PARSE | E_NOTICE', E_ALL ^ E_NOTICE ^ E_STRICT => 'E_ALL ^ E_NOTICE ^ E_STRICT', E_ALL ^ E_STRICT => 'E_ALL ^ E_STRICT', E_ALL | E_STRICT => 'E_ALL | E_STRICT'), "onsave" => "config_error_save", "desc" => "PHP error reporting level refert to php doc on error_reporting() "));
config::reg_field("error", "mode", "error_debug", array("title" => "Debug mode", "type" => "radio", "options" => array(0 => "Hide errors (for production)", 1 => "Display debug informations on error"), "default" => true, "cast" => "bool", "desc" => ""));
function config_error_save($id, $input, &$conf)
{
    if ($input == 0) {
        $conf[$id] = "0";
        return;
    }
    foreach (config::$fields["error"]["mode"][$id]["options"] as $value => $text) {
        if ($value == $input) {
            $conf[$id] = $text;
            return;
        }
    }
}
//// log
config::reg_field("error", "log", "error_log", array("title" => "Log errors", "type" => "checkbox", "label" => "Enabled", "cast" => "bool", "default" => true, "desc" => "Log errors in errorlog.txt which will be created in the Data directory"));
开发者ID:laiello,项目名称:phpbf,代码行数:26,代码来源:core.error.php

示例10: array

<?php

/**
 * Configuration file for time
 */
config::reg_section("general", array("title" => "General"));
config::reg_subsection("general", "general", array("title" => "General settings"));
//// general
config::reg_field("general", "general", "project_id", array("title" => "Project ID", "type" => "text", "default" => "", "desc" => "If more than one project runs the Framework on a single webserver, you may need to set a unique project ID to prevent sessions and coockies form being mixed up"));
config::reg_field("general", "general", "general_file_to_load", array("title" => "File to load", "type" => "text", "default" => "", "advanced" => true, "desc" => "If project requires a file to be loaded every time with some custom contants and function definition (eg. myproject.php), enter the name here, or leave blank. File must be placed in the same directory as framework.php and will be loaded right after the framework"));
config::reg_field("general", "general", "encoding", array("title" => "Encoding", "type" => "select", "default" => 'UTF-8', "options" => array('UTF-8' => "UTF-8", 'ISO-8859-1' => 'ISO-8859-1', 'ISO-8859-15' => 'ISO-8859-15', 'cp866' => 'cp866', 'cp1251' => 'cp1251', 'cp1252' => 'cp1252', 'KOI8-R' => 'KOI8-R', 'BIG5' => 'BIG5', 'GB2312' => 'GB2312', 'BIG5-HKSCS' => 'BIG5-HKSCS', 'Shift_JIS' => 'Shift_JIS', 'EUC-JP' => 'EUC-JP'), "desc" => "Char encoding site wide. UTF-8 is default and is recommended. <br/>Note: All translations files are by default encoded in UTF-8", "advanced" => true));
开发者ID:laiello,项目名称:phpbf,代码行数:11,代码来源:core.0.general.php

示例11: array

<?php

/**
 * Configuration file for time
 */
config::reg_section("db", array("title" => "Database"));
config::reg_subsection("db", "connections", array("title" => "Database connections"));
//config::reg_subsection("db", "tables", array("title" => "Database tables"));
//// connections
config::reg_field("db", "connections", "db", array("title" => "Connections", "type" => "table", "columns" => array("id" => array("title" => "ID", "width" => "15%", "type" => "text"), "type" => array("title" => "Type", "width" => "15%", "type" => "text"), "db" => array("title" => "Database", "width" => "20%", "type" => "text"), "host" => array("title" => "Host", "width" => "20%", "type" => "text"), "user" => array("title" => "Username", "width" => "15%", "type" => "text"), "pass" => array("title" => "Password", "width" => "15%", "type" => "text")), "num" => "auto", "onsave" => "config_db_table_save", "onload" => "config_db_table_load", "default" => array(), "example" => array("id" => "db_loc", "type" => "mysql", "db" => "mydb", "host" => "localhost", "user" => "myusername", "pass" => "mypassword"), "desc" => "All DB connections must be defined here.<br/>The ID must be unique and not contain spaces.<br/>The type is the DB type, for example : mysql, sqlite, etc... The required modules will be loaded."));
function config_db_table_load($field_id, $raw)
{
    $output = array();
    if (is_array($raw)) {
        foreach ($raw as $id => $entry) {
            $output[] = array("id" => $id, "type" => $entry[0], "db" => $entry[1], "host" => $entry[2], "user" => $entry[3], "pass" => $entry[4]);
        }
    }
    return $output;
}
function config_db_table_save($field_id, $input, &$conf)
{
    $output = array();
    for ($i = 0; $i < count($input['id']); $i++) {
        $id = trim($input['id'][$i]);
        if ($id && trim($input['type'][$i])) {
            $output[$id] = array(trim($input['type'][$i]), trim($input['db'][$i]), trim($input['host'][$i]), trim($input['user'][$i]), $input['pass'][$i]);
        }
    }
    $conf[$field_id] = $output;
}
开发者ID:laiello,项目名称:phpbf,代码行数:31,代码来源:core.3.db.php


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