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


PHP formatData函数代码示例

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


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

示例1: getData

function getData($file)
{
    $text = file_get_contents($file);
    $text = preg_replace("%//\\s+[^\n]+%", '', $text);
    $data = json_decode($text, true);
    if (empty($data)) {
        return false;
    } else {
        return formatData($data);
    }
}
开发者ID:dx8719,项目名称:ECMobile_Universal,代码行数:11,代码来源:index.php

示例2: read_entry


//.........这里部分代码省略.........
    // 4 byte number of elements
    $count = bin2hex(fread($in, 4));
    if ($intel == 1) {
        $count = intel2Moto($count);
    }
    $bytesofdata = $size * hexdec($count);
    // 4 byte value or pointer to value if larger than 4 bytes
    $value = fread($in, 4);
    if ($bytesofdata <= 4) {
        // if datatype is 4 bytes or less, its the value
        $data = $value;
    } else {
        if ($bytesofdata < 100000) {
            // otherwise its a pointer to the value, so lets go get it
            $value = bin2hex($value);
            if ($intel == 1) {
                $value = intel2Moto($value);
            }
            $v = fseek($seek, $globalOffset + hexdec($value));
            // offsets are from TIFF header which is 12 bytes from the start of the file
            if ($v == 0) {
                $data = fread($seek, $bytesofdata);
            } else {
                if ($v == -1) {
                    $result['Errors'] = $result['Errors'] + 1;
                }
            }
        } else {
            // bytesofdata was too big, so the exif had an error
            $result['Errors'] = $result['Errors'] + 1;
            return;
        }
    }
    if ($tag_name == 'MakerNote') {
        // if its a maker tag, we need to parse this specially
        $make = $result['IFD0']['Make'];
        if ($result['VerboseOutput'] == 1) {
            $result[$ifd_name]['MakerNote']['RawData'] = $data;
        }
        if (preg_match('/NIKON/i', $make)) {
            require_once dirname(__FILE__) . '/makers/nikon.php';
            parseNikon($data, $result);
            $result[$ifd_name]['KnownMaker'] = 1;
        } else {
            if (preg_match('/OLYMPUS/i', $make)) {
                require_once dirname(__FILE__) . '/makers/olympus.php';
                parseOlympus($data, $result, $seek, $globalOffset);
                $result[$ifd_name]['KnownMaker'] = 1;
            } else {
                if (preg_match('/Canon/i', $make)) {
                    require_once dirname(__FILE__) . '/makers/canon.php';
                    parseCanon($data, $result, $seek, $globalOffset);
                    $result[$ifd_name]['KnownMaker'] = 1;
                } else {
                    if (preg_match('/FUJIFILM/i', $make)) {
                        require_once dirname(__FILE__) . '/makers/fujifilm.php';
                        parseFujifilm($data, $result);
                        $result[$ifd_name]['KnownMaker'] = 1;
                    } else {
                        if (preg_match('/SANYO/i', $make)) {
                            require_once dirname(__FILE__) . '/makers/sanyo.php';
                            parseSanyo($data, $result, $seek, $globalOffset);
                            $result[$ifd_name]['KnownMaker'] = 1;
                        } else {
                            if (preg_match('/Panasonic/i', $make)) {
                                require_once dirname(__FILE__) . '/makers/panasonic.php';
                                parsePanasonic($data, $result, $seek, $globalOffset);
                                $result[$ifd_name]['KnownMaker'] = 1;
                            } else {
                                $result[$ifd_name]['KnownMaker'] = 0;
                            }
                        }
                    }
                }
            }
        }
    } else {
        if ($tag_name == 'GPSInfoOffset') {
            require_once dirname(__FILE__) . '/makers/gps.php';
            $formated_data = formatData($type, $tag, $intel, $data);
            $result[$ifd_name]['GPSInfo'] = $formated_data;
            parseGPS($data, $result, $formated_data, $seek, $globalOffset);
        } else {
            // Format the data depending on the type and tag
            $formated_data = formatData($type, $tag, $intel, $data);
            $result[$ifd_name][$tag_name] = $formated_data;
            if ($result['VerboseOutput'] == 1) {
                if ($type == 'URATIONAL' || $type == 'SRATIONAL' || $type == 'USHORT' || $type == 'SSHORT' || $type == 'ULONG' || $type == 'SLONG' || $type == 'FLOAT' || $type == 'DOUBLE') {
                    $data = bin2hex($data);
                    if ($intel == 1) {
                        $data = intel2Moto($data);
                    }
                }
                $result[$ifd_name][$tag_name . '_Verbose']['RawData'] = $data;
                $result[$ifd_name][$tag_name . '_Verbose']['Type'] = $type;
                $result[$ifd_name][$tag_name . '_Verbose']['Bytes'] = $bytesofdata;
            }
        }
    }
}
开发者ID:anqh,项目名称:core,代码行数:101,代码来源:exif.php

示例3: oneFilterBuilder

function oneFilterBuilder($rowData, $columnField)
{
    //Creates the HTML for each filter option. Example : Color --> Navy
    $HTMLBlock = "";
    $HTMLBlock .= "<div class='filterLabel'>";
    $HTMLBlock .= "<label>" . formatData($rowData) . "</label>";
    //Format data capitalize the first letter of each word. Location : PHPScripts/helperFunctions.php
    $HTMLBlock .= "</div>";
    $HTMLBlock .= "<div class='filterCheckBox'>";
    $HTMLBlock .= "<input id='" . $columnField . "_" . formatId($rowData) . "_CheckBox' class='classUncheck' type='checkbox' />";
    $HTMLBlock .= "</div>";
    return $HTMLBlock;
}
开发者ID:1ogica1,项目名称:fullQuiver,代码行数:13,代码来源:helperFunctions.php

示例4: read_entry

function read_entry(&$result, $in, $seek, $intel, $ifd_name, $globalOffset)
{
    if (feof($in)) {
        //test to make sure we can still read.
        $result['Errors'] = $result['Errors'] + 1;
        return;
    }
    //2 byte tag
    $tag = bin2hex(fread($in, 2));
    if ($intel == 1) {
        $tag = intel2Moto($tag);
    }
    $tag_name = lookup_tag($tag);
    //2 byte datatype
    $type = bin2hex(fread($in, 2));
    if ($intel == 1) {
        $type = intel2Moto($type);
    }
    lookup_type($type, $size);
    //4 byte number of elements
    $count = bin2hex(fread($in, 4));
    if ($intel == 1) {
        $count = intel2Moto($count);
    }
    $bytesofdata = $size * hexdec($count);
    //4 byte value or pointer to value if larger than 4 bytes
    $value = fread($in, 4);
    if ($bytesofdata <= 4) {
        //if datatype is 4 bytes or less, its the value
        $data = $value;
    } else {
        if ($bytesofdata < 100000) {
            //otherwise its a pointer to the value, so lets go get it
            $value = bin2hex($value);
            if ($intel == 1) {
                $value = intel2Moto($value);
            }
            $v = fseek($seek, $globalOffset + hexdec($value));
            //offsets are from TIFF header which is 12 bytes from the start of the file
            if ($v == 0) {
                $data = fread($seek, $bytesofdata);
            } else {
                if ($v == -1) {
                    $result['Errors'] = $result['Errors'] + 1;
                }
            }
        } else {
            //bytesofdata was too big, so the exif had an error
            $result['Errors'] = $result['Errors'] + 1;
            return;
        }
    }
    if ($tag_name == "MakerNote") {
        //if its a maker tag, we need to parse this specially
        $make = $result['IFD0']['Make'];
        if ($result['VerboseOutput'] == 1) {
            $result[$ifd_name]['MakerNote']['RawData'] = $data;
        }
        if (eregi("NIKON", $make)) {
            require_once 'makers/nikon.php';
            parseNikon($data, $result);
            $result[$ifd_name]['KnownMaker'] = 1;
        } else {
            if (eregi("OLYMPUS", $make)) {
                require_once 'makers/olympus.php';
                parseOlympus($data, $result, $seek, $globalOffset);
                $result[$ifd_name]['KnownMaker'] = 1;
            } else {
                if (eregi("Canon", $make)) {
                    require_once 'makers/canon.php';
                    parseCanon($data, $result, $seek, $globalOffset);
                    $result[$ifd_name]['KnownMaker'] = 1;
                } else {
                    if (eregi("FUJIFILM", $make)) {
                        require_once 'makers/fujifilm.php';
                        parseFujifilm($data, $result);
                        $result[$ifd_name]['KnownMaker'] = 1;
                    } else {
                        if (eregi("SANYO", $make)) {
                            require_once 'makers/sanyo.php';
                            parseSanyo($data, $result, $seek, $globalOffset);
                            $result[$ifd_name]['KnownMaker'] = 1;
                        } else {
                            $result[$ifd_name]['KnownMaker'] = 0;
                        }
                    }
                }
            }
        }
    } else {
        if ($tag_name == "GPSInfoOffset") {
            require_once 'makers/gps.php';
            $formated_data = formatData($type, $tag, $intel, $data);
            $result[$ifd_name]['GPSInfo'] = $formated_data;
            parseGPS($data, $result, $formated_data, $seek, $globalOffset);
        } else {
            //Format the data depending on the type and tag
            $formated_data = formatData($type, $tag, $intel, $data);
            $result[$ifd_name][$tag_name] = $formated_data;
            if ($result['VerboseOutput'] == 1) {
//.........这里部分代码省略.........
开发者ID:alanhaggai,项目名称:plogger,代码行数:101,代码来源:exif.php

示例5: searchCondition


//.........这里部分代码省略.........
             }
             if (!is_array($_REQUEST[$field]) && trim($_REQUEST[$field]) == '') {
                 continue;
             }
             switch ($detail['type']) {
                 case 'numberfield':
                     if (is_array($_REQUEST[$field])) {
                         $min = trim($_REQUEST[$field]['min']);
                         $max = trim($_REQUEST[$field]['max']);
                         $min = preg_match("/^[0-9]+\\.[0-9]+\$/", $min) ? floatval($min) : intval($min);
                         $max = preg_match("/^[0-9]+\\.[0-9]+\$/", $max) ? floatval($max) : intval($max);
                         if ($min === $max) {
                             if ($not) {
                                 $subQuery[$field]['$ne'] = $min;
                             } else {
                                 $subQuery[$field] = $min;
                             }
                         } else {
                             if ($not) {
                                 if (!empty($min)) {
                                     $subQuery['$or'][][$field]['$lte'] = $min;
                                 }
                                 if (!empty($max)) {
                                     $subQuery['$or'][][$field]['$gte'] = $max;
                                 }
                             } else {
                                 if (!empty($min)) {
                                     $subQuery[$field]['$gte'] = $min;
                                 }
                                 if (!empty($max)) {
                                     $subQuery[$field]['$lte'] = $max;
                                 }
                             }
                         }
                     } else {
                         $value = preg_match("/^[0-9]+\\.[0-9]+\$/", $_REQUEST[$field]) ? floatval($_REQUEST[$field]) : intval($_REQUEST[$field]);
                         if ($not) {
                             $subQuery[$field]['$ne'] = $value;
                         } else {
                             $subQuery[$field] = $value;
                         }
                     }
                     break;
                 case 'datefield':
                     $start = trim($_REQUEST[$field]['start']);
                     $end = trim($_REQUEST[$field]['end']);
                     $start = preg_match("/^[0-9]+\$/", $start) ? new \MongoDate(intval($start)) : new \MongoDate(strtotime($start));
                     $end = preg_match("/^[0-9]+\$/", $end) ? new \MongoDate(intval($end)) : new \MongoDate(strtotime($end));
                     if ($not) {
                         if (!empty($start)) {
                             $subQuery['$or'][][$field]['$lte'] = $start;
                         }
                         if (!empty($end)) {
                             $subQuery['$or'][][$field]['$gte'] = $end;
                         }
                     } else {
                         if (!empty($start)) {
                             $subQuery[$field]['$gte'] = $start;
                         }
                         if (!empty($end)) {
                             $subQuery[$field]['$lte'] = $end;
                         }
                     }
                     break;
                 case '2dfield':
                     $lng = floatval(trim($_REQUEST[$field]['lng']));
                     $lat = floatval(trim($_REQUEST[$field]['lat']));
                     $distance = !empty($_REQUEST[$field]['distance']) ? floatval($_REQUEST[$field]['distance']) : 10;
                     $subQuery = array('$near' => array($lng, $lat), '$maxDistance' => $distance / 111.12);
                     break;
                 case 'boolfield':
                     $subQuery[$field] = filter_var(trim($_REQUEST[$field]), FILTER_VALIDATE_BOOLEAN);
                     break;
                 case 'arrayfield':
                     $rshCollection = $detail['rshCollection'];
                     if (!empty($rshCollection)) {
                         $rowType = $this->_rshCollection[$rshCollection]['rshCollectionValueFieldType'];
                         if ($not) {
                             $subQuery[$field]['$ne'] = formatData($_REQUEST[$field], $rowType, $field);
                         } else {
                             $subQuery[$field] = formatData($_REQUEST[$field], $rowType, $field);
                         }
                     }
                     break;
                 default:
                     if ($not) {
                         $subQuery[$field]['$ne'] = trim($_REQUEST[$field]);
                     } else {
                         $subQuery[$field] = $exact ? trim($_REQUEST[$field]) : myMongoRegex($_REQUEST[$field]);
                     }
                     break;
             }
             $query['$and'][] = $subQuery;
         }
     }
     if (empty($query['$and'])) {
         return array();
     }
     return $query;
 }
开发者ID:im286er,项目名称:ent,代码行数:101,代码来源:DataController.php

示例6: importAction

 /**
  * 导入数据到集合内
  */
 public function importAction()
 {
     try {
         $importSheetName = trim($this->params()->fromPost('sheetName', null));
         $file = $this->params()->fromFiles('import', null);
         if ($importSheetName == null) {
             return $this->msg(false, '请设定需要导入的sheet');
         }
         if ($file == null) {
             return $this->msg(false, '请上传Excel数据表格文件');
         }
         if ($file['error'] === UPLOAD_ERR_OK) {
             $fileName = $file['name'];
             $filePath = $file['tmp_name'];
             $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
             switch ($ext) {
                 case 'xlsx':
                     $inputFileType = 'Excel2007';
                     break;
                 default:
                     return $this->msg(false, '很抱歉,您上传的文件格式无法识别,格式要求:*.xlsx');
             }
             $objReader = \PHPExcel_IOFactory::createReader($inputFileType);
             $objReader->setReadDataOnly(true);
             $objReader->setLoadSheetsOnly($importSheetName);
             $objPHPExcel = $objReader->load($filePath);
             if (!in_array($importSheetName, array_values($objPHPExcel->getSheetNames()))) {
                 return $this->msg(false, 'Sheet:"' . $importSheetName . '",不存在,请检查您导入的Excel表格');
             }
             $objPHPExcel->setActiveSheetIndexByName($importSheetName);
             $objActiveSheet = $objPHPExcel->getActiveSheet();
             $sheetData = $objActiveSheet->toArray(null, true, true, true);
             $objPHPExcel->disconnectWorksheets();
             unset($objReader, $objPHPExcel, $objActiveSheet);
             if (empty($sheetData)) {
                 return $this->msg(false, '请确认表格中未包含有效数据,请复核');
             }
             $firstRow = array_shift($sheetData);
             if (count($firstRow) == 0) {
                 return $this->msg(false, '标题行数据为空');
             }
             $titles = array();
             foreach ($firstRow as $col => $value) {
                 $value = trim($value);
                 if (in_array($value, array_keys($this->_schema), true)) {
                     $titles[$col] = $this->_schema[$value];
                 } else {
                     if (in_array($value, array_values($this->_schema), true)) {
                         $titles[$col] = $value;
                     }
                 }
             }
             if (count($titles) == 0) {
                 return $this->msg(false, '无匹配的标题或者标题字段,请检查导入数据的格式是否正确');
             }
             array_walk($sheetData, function ($row, $rowNumber) use($titles) {
                 $insertData = array();
                 foreach ($titles as $col => $colName) {
                     $insertData[$colName] = formatData($row[$col], $this->_fields[$colName]);
                 }
                 $this->_data->insertByFindAndModify($insertData);
                 unset($insertData);
             });
             unset($sheetData);
             return $this->msg(true, '导入成功');
         } else {
             return $this->msg(false, '上传文件失败');
         }
     } catch (\Exception $e) {
         fb(exceptionMsg($e), \FirePHP::LOG);
         return $this->msg(false, '导入失败,发生异常');
     }
 }
开发者ID:im286er,项目名称:ent,代码行数:76,代码来源:ImportController.php

示例7: error_reporting

<?php

error_reporting(E_ALL);
// $emailaddress = 'androidhub@intel.com';
$emailaddress = 'androidhub@intel.com';
define("DEBUG_MODE", FALSE);
if (!$_SERVER || $_SERVER['REQUEST_METHOD'] != "POST") {
    die("go away\n\n");
}
$json = stream_get_contents(detectRequestBody());
$body = formatData(json_decode($json));
$headers = 'From: ' . $emailaddress . "\r\n" . 'Reply-To: ' . $emailaddress . "\r\n" . 'X-Mailer: PHP/' . phpversion();
$args = '-f' . $emailaddress;
if (!email($emailaddress, "Someone wants to commit to the Android Hub!", $body, $headers, $args)) {
    header('HTTP/1.1 400 Internal Server Error');
    echo json_encode(array('success' => false));
} else {
    header('HTTP/1.1 200 OK');
    echo json_encode(array('success' => true));
}
function formatData($data)
{
    $emailBody = array();
    foreach ($data as $key => $value) {
        $emailBody[] = $key . ': ' . $value;
    }
    return implode("\r\n", $emailBody);
}
function email($to, $subject, $body, $headers, $args)
{
    if (DEBUG_MODE) {
开发者ID:blundell,项目名称:androidhub,代码行数:31,代码来源:commit.php

示例8: formatData

		<td><?php 
echo formatData($cookies_7);
?>
</td>
		<td><?php 
echo formatData($cookies_30);
?>
</td>
		<td><?php 
echo formatData($cookies_180);
?>
</td>
	</tr>
	<tr>
		<td>ip</td>
		<td><?php 
echo formatData($ip_7);
?>
</td>
		<td><?php 
echo formatData($ip_30);
?>
</td>
		<td><?php 
echo formatData($ip_180);
?>
</td>
	</tr>
	
</table>
</div>
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:genericStatsSuccess.php

示例9: array

/* Get Param */
$params = $this->getWidgetParams();
/* Get DB */
$dbM = $this->getMonitoringDb();
$db = $this->getConfigurationDb();
/* Init Params */
$data = array();
/* Get Data */
$query = "SELECT host_name, service_description, service_id, host_id, size.current_value AS size, used.current_value AS used, (used.current_value/size.current_value*100) AS percent FROM index_data, metrics used, metrics size WHERE service_description LIKE 'Disk%' AND used.index_id = id AND size.index_id = id AND size.metric_name = 'size' AND used.metric_name = 'used' ORDER BY percent DESC LIMIT 10";
$stmt = $dbM->prepare($query);
$stmt->execute();
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
    $row["percent"] = round($row["percent"]);
    $unit = getUnit($row['size']);
    $row['used'] = formatData($row['used'], $unit);
    $row['size'] = formatData($row['size'], $unit);
    $data[] = $row;
}
function getUnit($value)
{
    $unit = array('o', 'Ko', 'Mo', 'Go', 'To', 'Po');
    $i = 0;
    while ($value > 1024) {
        $value = $value / 1024;
        $i++;
    }
    return array($i, $unit[$i]);
}
function formatData($value, $unit)
{
    for ($i = 0; $i != $unit[0]; $i++) {
开发者ID:NicolasLarrouy,项目名称:centreon,代码行数:31,代码来源:CentreonTop10DiskWidget.php

示例10: mysqli_fetch_row

    $count = mysqli_fetch_row(mysqli_query($link, "SELECT  count(*) FROM heatmap WHERE (screen = '{$screen}' {$alternative} ) AND page_id = '{$id_page}' "));
    $total_pages = $count[0] > 0 ? ceil($count[0] / $limit) : 1;
    for ($page = 1; $page <= $total_pages; $page++) {
        $offset = $limit * $page - $limit;
        $queryLimit = "LIMIT {$offset},{$limit} ";
        $query = "SELECT  data_serial FROM heatmap WHERE (screen = '{$screen}' {$alternative}) AND page_id = '{$id_page}' " . $queryLimit;
        $result = mysqli_query($link, $query, MYSQLI_USE_RESULT);
        if ($result) {
            while ($row = $result->fetch_assoc()) {
                $dataResult[] = $row;
            }
        }
    }
    //mysqli_close($link);
    // paginador end
    $array = formatData($dataResult);
    $point = formarDataXY($array);
    $xScreen = $screen;
    if (isset($screenEquiv[$xScreen])) {
        $xScreen = $screenEquiv[$xScreen];
    }
    ?>
<!-- html -->
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Heatmap for page <?php 
    echo $id_page;
    ?>
 - Resolution <?php 
    echo $xScreen;
开发者ID:beeznest,项目名称:heatmap,代码行数:31,代码来源:report.php

示例11: parseData

function parseData($data)
{
    global $debugMode;
    if ($debugMode) {
        echo "<p>Checking to see if the data doesn't return null.</p>";
    }
    // if the data is null, somewhere along the line we had a problem
    if (!is_null($data)) {
        if ($debugMode) {
            echo "<p>The data is not null. Checking if the length > 0.";
        }
        if (count($data) > 0) {
            if ($debugMode) {
                echo "<p>There is data! Starting to format it!</p>";
            }
            formatData($data);
        } else {
            if ($debugMode) {
                echo "<p>Uh oh! The data has a length of 0. This means that there are no future events on the calendar.</p>";
            } else {
                echo "<p>Sorry, there are no events on our calendar currently. You can see our full calendar by clicking the button below.</p>";
                // give the user a nice error message
            }
        }
    } else {
        if ($debugMode) {
            echo "<p>Uh oh! The data is null. This probably is because there was a problem with your API key, which should have raised a <code>Google_Service_Exception</code>.</p>";
        } else {
            echo "<p>Sorry, we couldn't get data from the calendar. Please click the button bellow to look at our full calendar.</p>";
            // give the user a nice error message
        }
    }
}
开发者ID:gnarlyharly,项目名称:1294-Website,代码行数:33,代码来源:upcoming_events.php

示例12: searchCondition


//.........这里部分代码省略.........
                                 }
                             }
                         }
                     } else {
                         $value = preg_match("/^[0-9]+\\.[0-9]+\$/", $_REQUEST[$field]) ? floatval($_REQUEST[$field]) : intval($_REQUEST[$field]);
                         if ($not) {
                             $subQuery[$field]['$ne'] = $value;
                         } else {
                             $subQuery[$field] = $value;
                         }
                     }
                     break;
                 case 'datefield':
                     $start = isset($_REQUEST[$field]['start']) ? trim($_REQUEST[$field]['start']) : null;
                     $end = isset($_REQUEST[$field]['end']) ? trim($_REQUEST[$field]['end']) : null;
                     if (!empty($start)) {
                         $start = preg_match("/^[0-9]+\$/", $start) ? new \MongoDate(intval($start)) : new \MongoDate(strtotime($start));
                     }
                     if (!empty($end)) {
                         $end = preg_match("/^[0-9]+\$/", $end) ? new \MongoDate(intval($end)) : new \MongoDate(strtotime($end));
                     }
                     if ($not) {
                         if (!empty($start)) {
                             $subQuery['$or'][][$field]['$lte'] = $start;
                         }
                         if (!empty($end)) {
                             $subQuery['$or'][][$field]['$gte'] = $end;
                         }
                     } else {
                         if (!empty($start)) {
                             $subQuery[$field]['$gte'] = $start;
                         }
                         if (!empty($end)) {
                             $subQuery[$field]['$lte'] = $end;
                         }
                     }
                     break;
                 case '2dfield':
                     // $lng = floatval(trim($_REQUEST[$field]['lng']));
                     // $lat = floatval(trim($_REQUEST[$field]['lat']));
                     // $distance = ! empty($_REQUEST[$field]['distance']) ? floatval($_REQUEST[$field]['distance']) : 10;
                     // $subQuery[$field] = array(
                     // '$near' => array(
                     // $lng,
                     // $lat
                     // ),
                     // '$maxDistance' => $distance / 111.12
                     // );
                     // // 在mognodb2.5.5以前,无法支持$and查询故如果进行地理位置信息检索,则强制其他检索条件失效。
                     // // 迁移到2.6以后,请注释掉该部分代码
                     // $geoQuery = array();
                     // $geoQuery[$field] = array(
                     // '$near' => array(
                     // $lng,
                     // $lat
                     // ),
                     // '$maxDistance' => $distance / 111.12
                     // );
                     // return $geoQuery;
                     break;
                 case 'boolfield':
                     $subQuery[$field] = filter_var(trim($_REQUEST[$field]), FILTER_VALIDATE_BOOLEAN);
                     break;
                 case 'arrayfield':
                     $rshCollection = $detail['rshCollection'];
                     if (!empty($rshCollection)) {
                         $rowType = $this->_rshCollection[$rshCollection]['rshCollectionValueFieldType'];
                         if ($not) {
                             $subQuery[$field]['$ne'] = formatData($_REQUEST[$field], $rowType, $field);
                         } else {
                             $subQuery[$field] = formatData($_REQUEST[$field], $rowType, $field);
                         }
                     }
                     break;
                 default:
                     if ($field == '__ID__') {
                         if ($not) {
                             $subQuery["_id"]['$ne'] = new \MongoId($_REQUEST[$field]);
                         } else {
                             $subQuery["_id"] = new \MongoId($_REQUEST[$field]);
                         }
                     } else {
                         if ($not) {
                             $subQuery[$field]['$ne'] = trim($_REQUEST[$field]);
                         } else {
                             $subQuery[$field] = $exact ? trim($_REQUEST[$field]) : myMongoRegex($_REQUEST[$field]);
                         }
                     }
                     break;
             }
             if (!empty($subQuery)) {
                 $query['$and'][] = $subQuery;
             }
         }
     }
     if (empty($query['$and'])) {
         return array();
     }
     return $query;
 }
开发者ID:im286er,项目名称:ent,代码行数:101,代码来源:DataController.php

示例13: foreach

    ?>
<img src="images/right-arrow-icon.gif" width="32" height="32" border="0" /><?php 
}
?>
			</div>
			<br />
			<div class="list-container">
			   <ul class="list-container-ul">
			      <li class="list-item">Sensore</li>
			      <?php 
foreach ($vdata as $var => $value) {
    ?>
				<li class="list-item">
				    <ul>
					<li class="list-subitem"><?php 
    echo formatData($_GET['data'], $var);
    ?>
</li>
					<li class="list-subitem"><?php 
    echo $value;
    ?>
</li>
			            </ul>
			         </li>
			      <?php 
}
?>
			   </ul>
			</div>
		</div>
	</body>
开发者ID:WeMakecc,项目名称:OrtoYun,代码行数:31,代码来源:data.php


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