• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fields函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fields函数的典型用法代码示例。如果您正苦于以下问题:PHP fields函数的具体用法?PHP fields怎么用?PHP fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: head

    function head()
    {
        if (!isset($_GET['sql'])) {
            return;
        }
        $suggests = $tables = array_keys(tables_list());
        foreach ($tables as $table) {
            foreach (fields($table) as $field => $foo) {
                $suggests[] = "{$table}.{$field}";
            }
        }
        ?>
<script type="text/javascript" src="static/jquery.min.js"></script>
<script type="text/javascript" src="static/tabcomplete/tabcomplete.js"></script>
<style>.hint { color: #bdc3c7; }</style>
<script type="text/javascript">
$(function(){
	$('.sqlarea').tabcomplete(['<?php 
        echo implode("', '", str_replace("'\\", '', $suggests));
        ?>
']);
});
</script>
<?php 
    }
开发者ID:luminousinfoways,项目名称:pccfoas,代码行数:25,代码来源:autocomplete.php


示例2: head

    function head()
    {
        if (!isset($_GET['sql'])) {
            return;
        }
        $tables = array_keys(tables_list());
        $suggests = array_merge($this->keywords, $tables);
        foreach ($tables as $table) {
            foreach (fields($table) as $field => $foo) {
                $suggests[] = "{$table}.{$field}";
            }
        }
        ?>
<script type="text/javascript" src="static/jquery.min.js"></script>
<script type="text/javascript" src="static/jquery.a-tools.js"></script>
<script type="text/javascript" src="static/jquery.asuggest.js"></script>
<script type="text/javascript">
$(function(){
	if (navigator.appName == 'Microsoft Internet Explorer') {
		return;
	}

    $('.sqlarea').attr('onkeydown', '').asuggest(['<?php 
        echo implode("', '", str_replace("'\\", '', $suggests));
        ?>
'], {
        stopSuggestionKeys: [$.asuggestKeys.TAB, $.asuggestKeys.RETURN, $.asuggestKeys.SPACE, 190 /* PERIOD */],
        ignoreCase: true
    });
});
</script>
<?php 
    }
开发者ID:VNovotna,项目名称:MP2014,代码行数:33,代码来源:autocomplete.php


示例3: head

    function head()
    {
        if (!isset($_GET['sql'])) {
            return;
        }
        $suggests = array();
        foreach ($this->keywords as $keyword) {
            $suggests[] = "{$keyword} ";
        }
        foreach (array_keys(tables_list()) as $table) {
            $suggests[] = $table;
            foreach (fields($table) as $field => $foo) {
                $suggests[] = "{$table}.{$field} ";
            }
        }
        ?>
<script type="text/javascript" src="static/jquery.min.js"></script>
<script type="text/javascript" src="static/tabcomplete/tabcomplete.js"></script>
<style>.hint { color: #bdc3c7; }</style>
<script type="text/javascript">
$(function(){
	$('.sqlarea').tabcomplete(<?php 
        echo json_encode($suggests);
        ?>
);
});
</script>
<?php 
    }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:29,代码来源:autocomplete.php


示例4: update

function update($table = NULL)
{
    if (!$table) {
        $table = $GLOBALS['table'];
    }
    $id = format_int($_REQUEST['id']);
    db_update($table, fields($table), values($table), "where id={$id}");
}
开发者ID:JoshuaGrams,项目名称:wfpl,代码行数:8,代码来源:form.php


示例5: editInput

 function editInput($table, $field, $attrs, $value)
 {
     static $slugify;
     if (!$_GET["select"] && !$_GET["where"]) {
         if ($slugify === null) {
             $slugify = array();
             $prev = null;
             foreach (fields($table) as $name => $val) {
                 if ($prev && preg_match('~(^|_)slug(_|$)~', $name)) {
                     $slugify[$prev] = $name;
                 }
                 $prev = $name;
             }
         }
         $slug = $slugify[$field["field"]];
         if ($slug !== null) {
             return "<input value='" . h($value) . "' maxlength='{$field['length']}' size='40'{$attrs} onchange=\"var find = '{$this->from}'; var repl = '{$this->to}'; this.form['fields[{$slug}]'].value = this.value.toLowerCase().replace(new RegExp('[' + find + ']', 'g'), function (str) { return repl[find.indexOf(str)]; }).replace(/[^a-z0-9_]+/g, '-').replace(/^-|-\$/g, '').substr(0, {$field['length']});\">";
         }
     }
 }
开发者ID:ly95,项目名称:adminer,代码行数:20,代码来源:slugify.php


示例6: if

			jQuery("#in-category-22").attr("checked", "checked");
		}else if(type == 'type'){
			jQuery("#in-category-8").attr("checked", "checked");
			//jQuery("#info_box").hide();
		}else if(type == 'provider'){
			jQuery("#in-category-6").attr("checked", "checked");
		}else if(type == 'new'){
			jQuery("#in-category-25").attr("checked", "checked");
			<?php 
    fields(5, "destination", "p", "", 0);
    ?>
		}else if(type == 'home'){
			jQuery("#aiosp").css("display", "none");
			<?php 
    field_group(3, "photos", "photo_title|photo_link|homepage_photo", "p|p|div", "Φωτογραφίες αρχικής σελίδας", 1);
    fields(7, "popular_destination", "p", "", 0);
    field_group(5, "proposed_travels", "proposed_travel|proposed_title", "p|p", "", 0);
    field_group(8, "types", "type|type_title", "p|p", "", 0);
    field_group(10, "banners", "banner_title|banner_link|banner_photo|banner_active", "p|p|div|div", "", 0);
    ?>
			jQuery("#banner_box").insertAfter("#titlediv");
		}
		
		
	
		<?php 
    //THIS IS NEEDED
    //if type of the entry
    //find the id of this post type (την σειρά δηλαδή με την οποία είναι στο options)
    for ($i = 0; $i < sizeof($names); $i++) {
        if ($names[$i] == $content_type) {
开发者ID:Knorcedger,项目名称:main,代码行数:31,代码来源:script.php


示例7: array

}
$top = 0;
$base_left = -1;
$schema = array();
// table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target))))
$referenced = array();
// target_table => array(table => array(left => target_column))
$lefts = array();
// float => bool
foreach (table_status('', true) as $table => $table_status) {
    if (is_view($table_status)) {
        continue;
    }
    $pos = 0;
    $schema[$table]["fields"] = array();
    foreach (fields($table) as $name => $field) {
        $pos += 1.25;
        $field["pos"] = $pos;
        $schema[$table]["fields"][$name] = $field;
    }
    $schema[$table]["pos"] = $table_pos[$table] ? $table_pos[$table] : array($top, 0);
    foreach ($adminer->foreignKeys($table) as $val) {
        if (!$val["db"]) {
            $left = $base_left;
            if ($table_pos[$table][1] || $table_pos[$val["table"]][1]) {
                $left = min(floatval($table_pos[$table][1]), floatval($table_pos[$val["table"]][1])) - 1;
            } else {
                $base_left -= 0.1;
            }
            while ($lefts[(string) $left]) {
                // find free $left
开发者ID:fsgmhoward,项目名称:ixlab_adminer,代码行数:31,代码来源:schema.inc.php


示例8: ksort

if ($_POST) {
    $row = $_POST;
    ksort($row["source"]);
    if ($_POST["add"]) {
        $row["source"][] = "";
    } elseif ($_POST["change"] || $_POST["change-js"]) {
        $row["target"] = array();
    }
} elseif ($_GET["name"] != "") {
    $foreign_keys = foreign_keys($TABLE);
    $row = $foreign_keys[$_GET["name"]];
    $row["source"][] = "";
}
$source = array_keys(fields($TABLE));
//! no text and blob
$target = $TABLE === $row["table"] ? $source : array_keys(fields($row["table"]));
$referencable = array();
foreach (table_status() as $name => $table_status) {
    if (fk_support($table_status)) {
        $referencable[] = $name;
    }
}
?>

<form action="" method="post">
<p>
<?php 
if ($row["db"] == "" && $row["ns"] == "") {
    echo lang('Target table');
    ?>
:
开发者ID:acepsaepudin,项目名称:adminer,代码行数:31,代码来源:foreign.inc.php


示例9: fields

$username = fields('username');
$pwd1 = fields('pwd1');
$pwd2 = fields('pwd2');
$email = fields('email');
$truename = fields('truename');
$sex = fields('sex');
if ($sex) {
    //重置性别值
    $sex = '女';
} else {
    $sex = '男';
}
//$age=fields('age');
$birthday = fields('birthday');
$phone = fields('phone');
$personalURL = fields('personalURL');
$info = fields('info');
$arr = array('帐号:' => $username, '密码:' => $pwd1, '电子邮件:' => $email, '真实姓名:' => $truename, '性别:' => $sex, '生日:' => $birthday, '手机号码:' => $phone, '个人主页:' => $personalURL, '简介:' => $info);
$str = implode('   ', $arr);
file_put_contents('result.txt', $str);
/* create image code */
$image = imagecreatefromjpeg('images/bg_font.jpg');
$white = imagecolorallocate($image, 255, 255, 255);
imagettftext($image, 60, 0, 170, 200, $white, 'images/hanyi.ttf', '帐号:' . $arr['帐号:']);
imagettftext($image, 60, 0, 170, 270, $white, 'images/hanyi.ttf', '密码:' . $arr['密码:']);
imagettftext($image, 60, 0, 170, 340, $white, 'images/hanyi.ttf', '电子邮件:' . $arr['电子邮件:']);
imagettftext($image, 60, 0, 170, 410, $white, 'images/hanyi.ttf', '生日:' . $arr['生日:']);
imagettftext($image, 60, 0, 170, 480, $white, 'images/hanyi.ttf', '性别:' . $arr['性别:']);
imagejpeg($image, 'result.jpeg');
//end create image
message('注册成功!已生成文件:', 'register.html');
开发者ID:Nihility-Ming,项目名称:Counterfeit-dota2.17173.com,代码行数:31,代码来源:result.php


示例10: array

                }
                $alter[] = array($index["type"], $name, $set);
            }
        }
    }
    // drop removed indexes
    foreach ($indexes as $name => $existing) {
        $alter[] = array($existing["type"], $name, "DROP");
    }
    if (!$alter) {
        redirect(ME . "table=" . urlencode($TABLE));
    }
    queries_redirect(ME . "table=" . urlencode($TABLE), lang('Indexes have been altered.'), alter_indexes($TABLE, $alter));
}
page_header(lang('Indexes'), $error, array("table" => $TABLE), h($TABLE));
$fields = array_keys(fields($TABLE));
if ($_POST["add"]) {
    foreach ($row["indexes"] as $key => $index) {
        if ($index["columns"][count($index["columns"])] != "") {
            $row["indexes"][$key]["columns"][] = "";
        }
    }
    $index = end($row["indexes"]);
    if ($index["type"] || array_filter($index["columns"], 'strlen')) {
        $row["indexes"][] = array("columns" => array(1 => ""));
    }
}
if (!$row) {
    foreach ($indexes as $key => $index) {
        $indexes[$key]["name"] = $key;
        $indexes[$key]["columns"][] = "";
开发者ID:unix4you2,项目名称:pmydb,代码行数:31,代码来源:indexes.inc.php


示例11: foreach

 $failures = "<div id='failures'>";
 echo '<div id="success">';
 foreach ($dbh->query($sql) as $row) {
     $geocode_pending = true;
     while ($geocode_pending) {
         $delay = 100;
         $base_url = "http://" . MAPS_HOST . "/maps/api/geocode/xml?address=";
         $address = $row[fields('address')];
         $request_url = $base_url . urlencode($address) . "&sensor=true";
         $xml = simplexml_load_file($request_url) or die("url not loading");
         $status = $xml->status;
         if (strcmp($status, "OK") == 0) {
             $geocode_pending = false;
             $lat = $xml->result->geometry->location->lat;
             $lng = $xml->result->geometry->location->lng;
             $update_SQL = "UPDATE " . db('tablename') . " SET " . fields('latitude') . "='{$lat}', " . fields('longitude') . "='{$lng}' WHERE " . fields('address') . "='{$address}'";
             $count = $dbh->exec($update_SQL);
             echo '<span><strong>' . $address . '</strong> - Geocode Successful (' . $lat . ',' . $lng . ')</span>';
         } elseif (strcmp($status, "OVER_QUERY_LIMIT") == 0) {
             // sent geocodes too fast
             $delay += 100000;
         } else {
             // failure to geocode
             $geocode_pending = false;
             $failures .= "<span>" . $address . " failed to geocode. ";
             $failures .= "Received status " . $status . "</span>";
         }
         usleep($delay);
     }
 }
 $dbh = null;
开发者ID:niko-lgdcom,项目名称:barrows,代码行数:31,代码来源:geo.php


示例12: search_tables

/** Print results of search in all tables
* @uses $_GET["where"][0]
* @uses $_POST["tables"]
* @return null
*/
function search_tables()
{
    global $adminer, $connection;
    $_GET["where"][0]["op"] = "LIKE %%";
    $_GET["where"][0]["val"] = $_POST["query"];
    $found = false;
    foreach (table_status('', true) as $table => $table_status) {
        $name = $adminer->tableName($table_status);
        if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) {
            $result = $connection->query("SELECT" . limit("1 FROM " . table($table), " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())), 1));
            if (!$result || $result->fetch_row()) {
                if (!$found) {
                    echo "<ul>\n";
                    $found = true;
                }
                echo "<li>" . ($result ? "<a href='" . h(ME . "select=" . urlencode($table) . "&where[0][op]=" . urlencode($_GET["where"][0]["op"]) . "&where[0][val]=" . urlencode($_GET["where"][0]["val"])) . "'>{$name}</a>\n" : "{$name}: <span class='error'>" . error() . "</span>\n");
            }
        }
    }
    echo ($found ? "</ul>" : "<p class='message'>" . lang('No tables.')) . "\n";
}
开发者ID:K0n24d,项目名称:adminer,代码行数:26,代码来源:functions.inc.php


示例13: process_data

function process_data($data, $orderid)
{
    global $language;
    $data = \customer_registration\unfreeze_json($data);
    # collect input
    $input = $data;
    unset($input['js_userobject']);
    unset($input['approve']);
    # js_userobject contains data that Ruben already has set right,
    # like 'on' => title of checkbox. So they are better
    foreach ($data['js_userobject'] as $key => $value) {
        if (empty($value)) {
            continue;
        }
        $input[$key] = $value;
    }
    # these are not used
    unset($input['maz_calc_price']);
    unset($input['mazout_calc_price']);
    unset($input['antifr_calc_price']);
    unset($input['tank_inspection_calc_price']);
    unset($input['total_calc_maz_price']);
    unset($input['birth']);
    unset($input['birth']['birthday']);
    unset($input['birth']['birthmonth']);
    unset($input['birth']['birthyear']);
    # always set values for this one
    if (!empty($input['legal'])) {
        $input['legal'] = $language->language == 'fr' ? 'oui' : 'ja';
    } else {
        // $input['legal'] = ( $language->language == 'fr' ) ? 'non' : 'nee';
        unset($input['legal']);
    }
    # 'Tariefplan: Variabel' => 'Duurtijd: 1 jaar' verbergen
    if (!empty($input['indexation']) && ($input['indexation'] == 'Variabel' || $input['indexation'] == 'Variable')) {
        unset($input['runtime']);
    }
    # process hidden prices
    handle_hidden_prices($input);
    # remove all empty values
    $_input = $input;
    $input = array();
    foreach ($_input as $key => $value) {
        if (empty($value) || $value == 'empty' || preg_match('{^\\s+$}', $value)) {
            continue;
        }
        $input[$key] = $value;
    }
    # structure 'section' > 'fields'
    $fields = fields();
    # add values to the fields structure
    foreach ($input as $key => $value) {
        $main_key = main_key($fields, $key);
        $fields[$main_key][$key] = clean_value($value);
    }
    // echo '<pre>';
    // print_r(trim($fields['personal_data']['salutation']));
    // print_r(trim(tt('No salution')));
    // exit;
    # remove empty block
    if (empty($fields['company_data']['companyname']) && empty($fields['company_data']['juridical_status'])) {
        unset($fields['company_data']);
    }
    // if ( empty( $fields['other'] ) ){
    unset($fields['other']);
    //  }
    # remove unused mazout/energy blocks
    if (empty($fields['system']['productchoice_mazout'])) {
        unset($fields['mazout']);
        unset($fields['mazout_paydata']);
    }
    # remove unused mazout/energy blocks
    if (empty($fields['system']['productchoice_elek']) && empty($fields['system']['productchoice_gas'])) {
        unset($fields['energy']);
        unset($fields['additional_data_elek']);
        unset($fields['additional_data_gas']);
    }
    # annual_calculation_domiciliation
    if (!empty($fields['energy']['annual_calculation_domiciliation'])) {
        $fields['energy']['annual_calculation_domiciliation'] = $language->language == 'fr' ? 'oui' : 'ja';
    }
    # Format leveringsadres Elek and/or gas
    if (!empty($fields['energy']['energy_delivery_street'])) {
        $my_energy_address = $fields['energy']['energy_delivery_street'] . ' ' . $fields['energy']['energy_delivery_housenumber'];
        if ($fields['energy']['energy_delivery_housebus']) {
            $my_energy_address .= '/' . $fields['energy']['energy_delivery_housebus'] . ', ';
        } else {
            $my_energy_address .= ', ';
        }
        $my_energy_address .= $fields['energy']['energy_delivery_postalcode'];
        $fields['energy']['my_delivery_address'] = $my_energy_address;
        unset($fields['energy']['energy_delivery_address']);
        unset($fields['energy']['energy_delivery_street']);
        unset($fields['energy']['energy_delivery_housenumber']);
        unset($fields['energy']['energy_delivery_housebus']);
        unset($fields['energy']['energy_delivery_postalcode']);
    }
    # use correct title for the payment data of Gas and/or Electricity
    # only elek
    if (!empty($fields['system']['productchoice_elek']) && empty($fields['system']['productchoice_gas'])) {
//.........这里部分代码省略.........
开发者ID:bartcornelis,项目名称:comfortenergy,代码行数:101,代码来源:customer_registration_mail.php


示例14: strtolower

<?php

require_once "db.config.php";
//Query String Variables
$extendLat = $_GET['extendLat'];
$extendLng = $_GET['extendLng'];
$southWestLat = $_GET['swLat'] - $extendLat;
$northEastLat = $_GET['neLat'] + $extendLat;
$southWestLng = $_GET['swLng'] - $extendLng;
$northEastLng = $_GET['neLng'] + $extendLng;
$cat = strtolower($_GET['cat']);
try {
    $dbh = new PDO("mysql:host=" . db('hostname') . ";dbname=" . db('dbname'), db('username'), db('password'));
    header("Content-type: text/xml");
    $sql = "SELECT * FROM " . db('tablename') . " WHERE " . fields('latitude') . " BETWEEN '{$southWestLat}' AND '{$northEastLat}' AND " . fields('longitude') . " BETWEEN '{$southWestLng}' AND '{$northEastLng}' and " . fields('category') . " = '{$cat}'";
    $xml_output = "<?xml version=\"1.0\"?>\n";
    $xml_output .= "<markers>\n";
    foreach ($dbh->query($sql) as $row) {
        $xml_output .= '<marker lat="' . $row[fields('latitude')] . '" lng="' . $row[fields('longitude')] . '" title="' . $row[fields('title')] . '" address="' . $row[fields('address')] . '" url="' . htmlentities($row[fields('url')]) . '" html="' . htmlentities($row[fields('html')], ENT_QUOTES) . '" category="' . $row[fields('category')] . '" icon="' . $row[fields('icon')] . '"/>';
    }
    $xml_output .= '<marker lat="0" lng="0" title="Blank" address="" url="" html="" category="' . $row[fields('category')] . '" icon="' . $row[fields('icon')] . '"/>';
    $xml_output .= "</markers>";
    echo $xml_output;
    $dbh = null;
} catch (PDOException $e) {
    echo $e->getMessage();
}
开发者ID:niko-lgdcom,项目名称:barrows,代码行数:27,代码来源:db.php


示例15: array

$TABLE = $_GET["create"];
$partition_by = array();
foreach (array('HASH', 'LINEAR HASH', 'KEY', 'LINEAR KEY', 'RANGE', 'LIST') as $key) {
    $partition_by[$key] = $key;
}
$referencable_primary = referencable_primary($TABLE);
$foreign_keys = array();
foreach ($referencable_primary as $table_name => $field) {
    $foreign_keys[str_replace("`", "``", $table_name) . "`" . str_replace("`", "``", $field["field"])] = $table_name;
    // not idf_escape() - used in JS
}
$orig_fields = array();
$table_status = array();
if ($TABLE != "") {
    $orig_fields = fields($TABLE);
    $table_status = table_status($TABLE);
    if (!$table_status) {
        $error = lang('No tables.');
    }
}
$row = $_POST;
$row["fields"] = (array) $row["fields"];
if ($row["auto_increment_col"]) {
    $row["fields"][$row["auto_increment_col"]]["auto_increment"] = true;
}
if ($_POST && !process_fields($row["fields"]) && !$error) {
    if ($_POST["drop"]) {
        queries_adminer_redirect(substr(ME, 0, -1), lang('Table has been dropped.'), drop_tables(array($TABLE)));
    } else {
        $fields = array();
开发者ID:gigikiri,项目名称:WordPress,代码行数:30,代码来源:create.inc.php


示例16: array

 }
 if ($_POST["table_style"] || $_POST["data_style"]) {
     $views = array();
     foreach (table_status('', true) as $name => $table_status) {
         $table = DB == "" || in_array($name, (array) $_POST["tables"]);
         $data = DB == "" || in_array($name, (array) $_POST["data"]);
         if ($table || $data) {
             if ($ext == "tar") {
                 $tmp_file = new TmpFile();
                 ob_start(array($tmp_file, 'write'), 100000.0);
             }
             $adminer->dumpTable($name, $table ? $_POST["table_style"] : "", is_view($table_status) ? 2 : 0);
             if (is_view($table_status)) {
                 $views[] = $name;
             } elseif ($data) {
                 $fields = fields($name);
                 $adminer->dumpData($name, $_POST["data_style"], "SELECT *" . convert_fields($fields, $fields) . " FROM " . table($name));
             }
             if ($is_sql && $_POST["triggers"] && $table && ($triggers = trigger_sql($name, $_POST["table_style"]))) {
                 echo "\nDELIMITER ;;\n{$triggers}\nDELIMITER ;\n";
             }
             if ($ext == "tar") {
                 ob_end_flush();
                 tar_file((DB != "" ? "" : "{$db}/") . "{$name}.csv", $tmp_file);
             } elseif ($is_sql) {
                 echo "\n";
             }
         }
     }
     foreach ($views as $view) {
         $adminer->dumpTable($view, $_POST["table_style"], 1);
开发者ID:umairriaz90,项目名称:Daschug1,代码行数:31,代码来源:dump.inc.php


示例17: referencable_primary

/** Get referencable tables with single column primary key except self
* @param string
* @return array ($table_name => $field)
*/
function referencable_primary($self)
{
    $return = array();
    // table_name => field
    foreach (table_status('', true) as $table_name => $table) {
        if ($table_name != $self && fk_support($table)) {
            foreach (fields($table_name) as $field) {
                if ($field["primary"]) {
                    if ($return[$table_name]) {
                        // multi column primary key
                        unset($return[$table_name]);
                        break;
                    }
                    $return[$table_name] = $field;
                }
            }
        }
    }
    return $return;
}
开发者ID:ly95,项目名称:adminer,代码行数:24,代码来源:editing.inc.php


示例18: dirname

<?php

require_once dirname(__FILE__) . '/../_lib/tinyTinyFw.php';
require_once dirname(__FILE__) . '/properties.php';
$modules->let('user:join', function () {
    $module = new module();
    $module->let('fields', fields('username', 'email'));
    // Called when there is no form submission.
    $module->let('whenIdle', function ($self) {
        return widget('window')->let('content', dom('div', layout2columns($self->get('fields')), dom('pre')->css(array('border' => 'solid 1px gray', 'padding' => '0.5em'))->append('$_REQUEST = ' . var_export($_REQUEST, true))));
    });
    $module->let('whenError', function ($self) {
        return widget('message:error', "Sorry, there has been an error.");
    });
    // Called after form submission and input validation is ok.
    $module->let('whenOk', function ($self, $values) {
        // $values['username']->property;
        // Each $value has already gone through
        // validators defined by the value's underlying property -- see properties.php.
        $user = user::Create($values);
        // Can return either a layout function or dom.
        return dom('div')->append(dom('message:ok', "Thank you."), dom('message:info', "Don't forget to join a club."));
    });
    return $module;
});
开发者ID:keeyipchan,项目名称:tinyTinyFw,代码行数:25,代码来源:module.user.php


示例19: dumpData

 /** Export table data
  * @param string
  * @param string
  * @param string
  * @return null prints data
  */
 function dumpData($table, $style, $query)
 {
     global $connection, $jush;
     $max_packet = $jush == "sqlite" ? 0 : 1048576;
     // default, minimum is 1024
     if ($style) {
         if ($_POST["format"] == "sql") {
             if ($style == "TRUNCATE+INSERT") {
                 echo truncate_sql($table) . ";\n";
             }
             $fields = fields($table);
         }
         $result = $connection->query($query, 1);
         // 1 - MYSQLI_USE_RESULT //! enum and set as numbers
         if ($result) {
             $insert = "";
             $buffer = "";
             $keys = array();
             $suffix = "";
             $fetch_function = $table != '' ? 'fetch_assoc' : 'fetch_row';
             while ($row = $result->{$fetch_function}()) {
                 if (!$keys) {
                     $values = array();
                     foreach ($row as $val) {
                         $field = $result->fetch_field();
                         $keys[] = $field->name;
                         $key = idf_escape($field->name);
                         $values[] = "{$key} = VALUES({$key})";
                     }
                     $suffix = ($style == "INSERT+UPDATE" ? "\nON DUPLICATE KEY UPDATE " . implode(", ", $values) : "") . ";\n";
                 }
                 if ($_POST["format"] != "sql") {
                     if ($style == "table") {
                         dump_csv($keys);
                         $style = "INSERT";
                     }
                     dump_csv($row);
                 } else {
                     if (!$insert) {
                         $insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', $keys)) . ") VALUES";
                     }
                     foreach ($row as $key => $val) {
                         $field = $fields[$key];
                         $row[$key] = $val !== null ? unconvert_field($field, preg_match('~(^|[^o])int|float|double|decimal~', $field["type"]) && $val != '' ? $val : q($val)) : "NULL";
                     }
                     $s = ($max_packet ? "\n" : " ") . "(" . implode(",\t", $row) . ")";
                     if (!$buffer) {
                         $buffer = $insert . $s;
                     } elseif (strlen($buffer) + 4 + strlen($s) + strlen($suffix) < $max_packet) {
                         // 4 - length specification
                         $buffer .= ",{$s}";
                     } else {
                         echo $buffer . $suffix;
                         $buffer = $insert . $s;
                     }
                 }
             }
             if ($buffer) {
                 echo $buffer . $suffix;
             }
         } elseif ($_POST["format"] == "sql") {
             echo "-- " . str_replace("\n", " ", $connection->error) . "\n";
         }
     }
 }
开发者ID:kamrandotpk,项目名称:adminer,代码行数:71,代码来源:adminer.inc.php


示例20: array

$top = 0;
$base_left = -1;
$schema = array();
// table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target))))
$referenced = array();
// target_table => array(table => array(left => target_column))
$lefts = array();
// float => bool
foreach (table_status() as $table_status) {
    if (!isset($table_status["Engine"])) {
        // view
        continue;
    }
    $pos = 0;
    $schema[$table_status["Name"]]["fields"] = array();
    foreach (fields($table_status["Name"]) as $name => $field) {
        $pos += 1.25;
        $field["pos"] = $pos;
        $schema[$table_status["Name"]]["fields"][$name] = $field;
    }
    $schema[$table_status["Name"]]["pos"] = $table_pos[$table_status["Name"]] ? $table_pos[$table_status["Name"]] : array($top, 0);
    foreach ($adminer->foreignKeys($table_status["Name"]) as $val) {
        if (!$val["db"]) {
            $left = $base_left;
            if ($table_pos[$table_status["Name"]][1] || $table_pos[$val["table"]][1]) {
                $left = min(floatval($table_pos[$table_status["Name"]][1]), floatval($table_pos[$val["table"]][1])) - 1;
            } else {
                $base_left -= 0.1;
            }
            while ($lefts[(string) $left]) {
                // find free $left
开发者ID:acepsaepudin,项目名称:adminer,代码行数:31,代码来源:schema.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fields_check函数代码示例发布时间:2022-05-15
下一篇:
PHP field_view_value函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap