本文整理汇总了PHP中fields函数的典型用法代码示例。如果您正苦于以下问题:PHP fields函数的具体用法?PHP fields怎么用?PHP fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fields函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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
}
示例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
}
示例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}");
}
示例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']});\">";
}
}
}
示例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) {
示例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
示例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');
?>
:
示例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');
示例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"][] = "";
示例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;
示例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";
}
示例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'])) {
//.........这里部分代码省略.........
示例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();
}
示例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();