本文整理汇总了PHP中var_Dump函数的典型用法代码示例。如果您正苦于以下问题:PHP var_Dump函数的具体用法?PHP var_Dump怎么用?PHP var_Dump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了var_Dump函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: exportPdfAction
public function exportPdfAction()
{
/*$this->loadLayout()->_setActiveMenu('Iways/Assistant/Overview')
->_title('Iways Assistant / ' . $this->__('Overview'));
$modules = $this->helper->getLoadedModules('Iways', 'local');
if ($extend = Mage::getStoreConfig('Iways_Assistant/General/Extend')) {
foreach (explode(",", $extend) as $module)
$modules = array_merge($modules,
$this->helper->getLoadedModules(trim($module)));
}
$block = $this->getLayout()
->createBlock('Iways_Assistant/adminhtml_assistant_overview',
'',
array('modules' => $modules))
->setTemplate('iways_assistant/overview.phtml');
$this->_addContent($block);
$this->renderLayout();*/
var_Dump("TEST!");
die;
$fileName = 'orders.csv';
$grid = $this->getLayout()->createBlock('adminhtml/sales_order_grid');
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
}
开发者ID:TheB3Rt0z,项目名称:assistance,代码行数:28,代码来源:GridPlusController.php
示例2: test
function test()
{
$database = model::factory('database');
$r = $database->safe_query('select * from user where user_id in :user_id', array('user_id' => array(329, 339)));
var_Dump($r);
var_dump($r->fetchAll());
}
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:7,代码来源:dev.php
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('Starting to fetch github-Usernames');
$data = parse_ini_file(__DIR__ . '/../../../.env');
$pdo = new \PDO('mysql:dbname=' . $data['DB_DBNAME'] . ';host=' . $data['DB_HOSTNAME'], $data['DB_USERNAME'], $data['DB_PASSWORD']);
$select = $pdo->prepare('SELECT * FROM `users` WHERE `githubName` = ""');
$update = $pdo->prepare('UPDATE `users` SET `githubName`= :githubName WHERE githubUid = :githubUid');
$select->execute();
$result = $select->fetchAll();
foreach ($result as $row) {
$output->writeln(sprintf('Fetching username for user %s (%s)', $row['githubUid'], $row['name']));
$ch = curl_init('https://api.github.com/users?per_page=1&since=' . ($row['githubUid'] - 1));
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: PHPMentoring-App'));
$info = curl_exec($ch);
// get curl response
curl_close($ch);
var_Dump($info);
$info = json_decode($info, true);
var_Dump($info);
if (!isset($info[0])) {
throw new \Exception('Transport Error occured');
}
$update->execute(array(':githubUid' => $row['githubUid'], ':githubName' => $info[0]['login']));
}
$output->writeln('Finished');
}
开发者ID:dw250100785,项目名称:webapp,代码行数:29,代码来源:AddMissingGithubUsernamesCommand.php
示例4: dump
function dump()
{
if ($this->curfunc) {
var_Dump($this->curfunc);
}
echo "Profiling period: " . ($this->profstart - $this->api->start_time) . ' .. ' . (time() + microtime() - $this->api->start_time) . '<br/>';
echo "Profiled (ms): <b>" . round(1000 * (time() + microtime() - $this->profstart - $this->timetable['Profiling']['total']), 2) . '</b><br/>';
uasort($this->timetable, function ($l, $r) {
$l = $l['total'];
///$l['calls'];
$r = $r['total'];
///$r['calls'];
if ($l > $r) {
return -1;
}
if ($l < $r) {
return 1;
}
});
$x = 0;
foreach ($this->timetable as $activity => $detail) {
if ($activity == 'Profiling') {
$activity = '<font color="gray">' . $activity . '</font>';
$detail['calls'] = $this->calls * 2;
}
$x += $detail['total'];
echo '+' . number_format($detail['total'] * 1000, 2) . ' ' . $activity . ' x ' . $detail['calls'] . '<br/>';
}
}
开发者ID:xavoctechnocratspvtltd,项目名称:svc,代码行数:29,代码来源:Profiler.php
示例5: createFatalRedirectRequest
function createFatalRedirectRequest(ezcMvcRequest $request, ezcMvcResult $result, Exception $response)
{
var_Dump($request);
$req = clone $request;
$req->uri = '/FATAL';
return $req;
}
开发者ID:bmdevel,项目名称:ezc,代码行数:7,代码来源:config.php
示例6: tesdt
function tesdt()
{
$tab = array('sdaf' => 'dsafad');
$tab[] = 'safas';
$tab[] = $tab;
$tab['wtf'] = new KontoBankMillenium();
var_Dump($tab);
}
开发者ID:sparrow41,项目名称:training,代码行数:8,代码来源:start.php
示例7: __invoke
public function __invoke($str, $find)
{
var_Dump($this->view->basePath());
if (!is_string($str)) {
return 'must be string';
}
if (strpos($str, $find) === false) {
return 'not found';
}
return 'found';
}
开发者ID:Patinger,项目名称:Browsergame,代码行数:11,代码来源:Findstring.php
示例8: testMain
public function testMain()
{
$b = Browser::create()->get('http://localhost')->get('http://localhost')->get('http://localhost')->get('http://localhost')->get('http://localhost')->get('http://localhost');
// 結果
foreach ($b->getResults() as $r) {
echo $r->header();
echo strip_tags($r->body());
}
// クッキー
var_Dump($b->getCookie());
}
开发者ID:hossy78,项目名称:nora,代码行数:11,代码来源:BrowserTest.php
示例9: page_callback
function page_callback()
{
$r = $this->op->recall('result', null);
$this->op->forget('result');
$this->opauth = new \Opauth($this->config, false);
$response = $_SESSION['opauth'];
// Controller_Opauth or it's descendand (which you can tweak)
// will determine, what should be done upon successful initialization.
// See documentation of
if ($this->api->auth->opauth) {
$res = $this->op->callback($response, $this->opauth);
if (is_array($res) && isset($res['force_callback']) && $res['force_callback']) {
$r = $res;
} else {
$r = $r ?: $res;
}
} else {
$r = $r ?: 'dump';
}
if ($r === 'dump') {
echo '<h2>default_action is not specified fo OPauth Controller. Dumping...</h2>';
echo "<pre>";
var_Dump($response);
exit;
}
if (is_array($r) && isset($r['error'])) {
echo '<h2>Unable to authenticate</h2>';
echo "<p>" . htmlspecialchars($r['error']) . "</p>";
exit;
}
if ($r === 'close') {
echo '<script>window.opener.location.reload(true);window.close()</script>';
exit;
}
if (is_array($r) && isset($r['redirect_me'])) {
if ($r['redirect_me']['0'] == '/' && strlen($r['redirect_me']) != 1) {
header('Location: ' . $r['redirect_me']);
exit;
}
$this->api->redirect($r['redirect_me']);
}
if (is_array($r) && isset($r['redirect'])) {
echo '<script>window.opener.location="' . $this->api->url($r['redirect']) . '";window.close()</script>';
exit;
}
if (is_array($r) && isset($r['custom_script'])) {
echo $r['custom_script'];
exit;
}
$this->add('View_Info')->set('Authentication is successful, but no action is defined');
}
开发者ID:romaninsh,项目名称:opauth,代码行数:51,代码来源:index.php
示例10: testMain
public function testMain()
{
// セットアップ
Nora::Configure(TEST_DIR, 'dev', ['config' => 'config/test']);
Nora::getService('logger')->err('エラーだよ');
$this->assertEquals(spl_object_hash(Nora::getService('logger')), spl_object_hash(Nora::getService('logger')));
// 既存クラスをサービスにする
Nora::setService('mysql', ['class' => 'PDO', 'params' => ['dsn' => 'mysql:dbname=test;host=127.0.0.1']]);
// サービスを読み込む
Nora::setService('hoge', ['callback' => function ($db) {
return $db;
}, 'params' => ['db' => '@mysql']]);
var_Dump(Nora::getService('hoge')->prepare('SHOW TABLES;')->fetch());
}
开发者ID:hossy78,项目名称:nora,代码行数:14,代码来源:NoraTest.php
示例11: var_dump
function &getDB($bNew = false, $bPersistent = false)
{
// Get the database object
$oDB =& DB::connect(CONST_Database_DSN . ($bNew ? '?new_link=true' : ''), $bPersistent);
if (PEAR::IsError($oDB)) {
var_dump(CONST_Database_DSN);
var_Dump($oDB);
fail($oDB->getMessage());
}
$oDB->setFetchMode(DB_FETCHMODE_ASSOC);
$oDB->query("SET DateStyle TO 'sql,european'");
$oDB->query("SET client_encoding TO 'utf-8'");
return $oDB;
}
开发者ID:acand01x,项目名称:Nominatim,代码行数:14,代码来源:db.php
示例12: find
public function find($data, $find)
{
$dom = new DOMDocument();
@$dom->loadHTML($data);
$xpath = new DOMXPath($dom);
$elements = $xpath->evaluate($find);
var_Dump($elements);
die;
return $elements;
$urls = array();
foreach ($elements as $e) {
$url = $e->nodeValue;
$urls[] = $url;
}
return array_unique($urls);
}
开发者ID:nike-17,项目名称:SiteRunner,代码行数:16,代码来源:Xpath.php
示例13: test
function test()
{
echo "<pre>";
for ($x = 0; $x < 10; $x++) {
$n = rand(1, 100000);
echo "here";
$a = rand(1, 10000);
$b = rand(1, 10000);
$c = $a + 1;
$d = $b + 1;
echo "== {$n} {$a}, {$b}, {$c}, {$d} ==\n";
$c = $this->add('Controller_Roses');
$res = $c->solve($n, $a, $b, $c, $d);
var_dump($res);
var_Dump($c->distance);
}
}
开发者ID:romaninsh,项目名称:roses,代码行数:17,代码来源:RoseTester.php
示例14: page_index
function page_index($p) {
$tabs=$p->add('Tabs');
$p=$tabs->addTab('Jobs');
$crud=$p->add('CRUD');
$crud->setModel('Job_Admin',null,array('id','category','type','company','position','location',
'is_public','is_activated','expires_at','email'));
if($crud->grid){
$crud->grid->addPaginator();
$crud->grid->getColumn('type')->makeSortable();
$crud->grid->getColumn('location')->makeSortable();
$crud->grid->dq->field('description');
$crud->grid->addColumn('button','extend');
if($_GET['extend']){
$new_expires=$crud->grid->getModel()->loadData($_GET['extend'])
->extend()->get('expires_at');
$new_expires=date($this->api->getConfig('locale/date','d/m/Y'),
strtotime($new_expires));
$crud->grid->js(null,$crud->grid->js()->univ()->successMessage('Extended job #'.
$_GET['extend'].' till '.$new_expires))->reload()->execute();
}
$crud->grid->addQuickSearch(array('company','position','location','description'));
$action_form=$crud->add('Form',null,null,array('form_empty'));
$ids=$action_form->addField('hidden','ids');
$crud->grid->addSelectable($ids);
$d=$action_form->addSubmit('Delete Selected');
$d=$action_form->addSubmit('Extend Selected');
$action_form->onSubmit(function($f) use ($crud,$d){
$ids=json_decode($f->get('ids'));
//$m=$crud->grid->getModel()->dsql(null,false)->where('id in',$ids)->do_delete();
var_Dump($d->isClicked());
exit;
return $f->js(null,$crud->grid->js()->reload())
->univ()->successMessage('Success');
});
}
$p=$tabs->addTab('Categories')->add('CRUD')->setModel('Category');
}
开发者ID:romaninsh,项目名称:jobeet,代码行数:40,代码来源:Admin.php
示例15: run
/**
* Run a module controller method
* Output from module is buffered and returned.
**/
public static function run($module)
{
$method = 'index';
if (($pos = strrpos($module, '/')) != FALSE) {
$method = substr($module, $pos + 1);
$module = substr($module, 0, $pos);
}
if ($module == 'tasks/reviews') {
$class = self::load($module);
var_Dump(get_class_methods($class));
}
if ($class = self::load($module)) {
if (method_exists($class, $method)) {
ob_start();
$args = func_get_args();
$output = call_user_func_array(array($class, $method), array_slice($args, 1));
$buffer = ob_get_clean();
return $output !== NULL ? $output : $buffer;
}
}
log_message('error', "Module controller failed to run: {$module}/{$method}");
}
开发者ID:andrewkrug,项目名称:repucaution,代码行数:26,代码来源:Modules.php
示例16: get_message
public function get_message()
{
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 0);
$url = 'https://vpn.shanghai-cis.com.cn/+webvpn+/index.html';
$post_data = array('tgroup' => '', 'next' => '', 'tgcookieset' => '', 'username' => 'shcljradmin', 'password' => 'xm8hwvax', 'Login' => '登录');
$headers = array("Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Encoding:gzip, deflate", "Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3", "Connection:keep-alive", "Cookie:webvpnx=; webvpnlogin=1; webvpn_state=7@B765E4B420124F7716AA4EA6E75577BC397E7B19; csc_next=%2F%2BCSCO\n%2B00756767633A2F2F6A6A6A2E617370662E70627A%2B%2B%2Fwebservice%2Fbatchcredit%3Fwsdl; webvpnlogin=1; webvpnLang=en", "Host:vpn.shanghai-cis.com.cn", "Referer:https://vpn.shanghai-cis.com.cn/+CSCOE+/logon.html", "User-Agent:Mozilla/5.0 (Windows NT 6.1; rv:39.0) Gecko/20100101 Firefox/39.0");
$link = $this->curl($url, $headers, $post_data);
$reg = '/webvpn=\\s*([^;]+);/is';
if (preg_match_all($reg, $link['header'], $p)) {
$cookiestr = implode(';', $p[1]);
}
/*
$options = array(
'location'=>'',
'uri'=>'',
'login'=>'shcljradmin',
'password'=>'z9vpzzu0',
'trace'=>true,
'targetNamespace'=>'http://webservice.creditreport.p2p.sino.com/',
'cookies'=>array('webvpn='.$cookiestr)
);
*/
$context = stream_context_create(array('ssl' => array('verify_peer' => false, 'allow_self_signed' => true)));
$client = new SoapClientAuth("../../web/www/wsdl.txt", array('location' => 'https://vpn.shanghai-cis.com.cn/+CSCO+00756767633A2F2F6A6A6A2E61737066677266672E70627A3A38303830++/webservice/batchcredit?wsdl', 'uri' => 'https://vpn.shanghai-cis.com.cn/+CSCO+00756767633A2F2F6A6A6A2E61737066677266672E70627A3A38303830++/webservice/batchcredit?wsdl', 'login' => 'shcljradmin', 'password' => 'z9vpzzu0', 'trace' => true, 'targetNamespace' => 'http://webservice.creditreport.p2p.sino.com/', 'stream_context' => $context, 'cookies' => array('webvpn=' . $cookiestr)));
//$client->__setCookie('webvpn',$cookiestr);
// $u = new SoapHeader('http://webservice.creditreport.p2p.sino.com/','MySoapHeader',array('UserName'=>'shcljradmin','PassWord'=>'z9vpzzu0','Accept'=>'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8','Content-Type'=>'application/x-www-form-urlencoded'),false);
//添加soapheader
//$client->__setSoapHeaders($u);
$param = array('orgcode' => 'Q10152900H5C00', 'secret' => '7lr9mgem', 'plate' => '1', 'certtype' => '0', 'certno' => '330823198205055517', 'name' => '王红华', 'reason' => '06', 'createtype' => '1');
$ret = $client->queryCredit($param);
$array = $this->objectToArray($ret);
$result = json_decode($array['return'], true);
var_Dump($result);
//var_Dump($result[0]['result']);
exit;
}
开发者ID:GStepOne,项目名称:CI,代码行数:37,代码来源:class.chaxun.php
示例17: conv
public function conv()
{
var_Dump(44);
exit;
}
开发者ID:andrewkrug,项目名称:repucaution,代码行数:5,代码来源:tests.php
示例18: geocodeReverse
function geocodeReverse($fLat, $fLon, $iZoom = 18)
{
$oDB =& getDB();
$sPointSQL = "ST_SetSRID(ST_Point({$fLon},{$fLat}),4326)";
// Zoom to rank, this could probably be calculated but a lookup gives fine control
$aZoomRank = array(0 => 2, 1 => 2, 2 => 2, 3 => 4, 4 => 4, 5 => 8, 6 => 10, 7 => 10, 8 => 12, 9 => 12, 10 => 17, 11 => 17, 12 => 18, 13 => 18, 14 => 22, 15 => 22, 16 => 26, 17 => 26, 18 => 30, 19 => 30);
$iMaxRank = isset($aZoomRank[$iZoom]) ? $aZoomRank[$iZoom] : 28;
// Find the nearest point
$fSearchDiam = 0.0001;
$iPlaceID = null;
$aArea = false;
$fMaxAreaDistance = 1;
while (!$iPlaceID && $fSearchDiam < $fMaxAreaDistance) {
$fSearchDiam = $fSearchDiam * 2;
// If we have to expand the search area by a large amount then we need a larger feature
// then there is a limit to how small the feature should be
if ($fSearchDiam > 2 && $iMaxRank > 4) {
$iMaxRank = 4;
}
if ($fSearchDiam > 1 && $iMaxRank > 9) {
$iMaxRank = 8;
}
if ($fSearchDiam > 0.8 && $iMaxRank > 10) {
$iMaxRank = 10;
}
if ($fSearchDiam > 0.6 && $iMaxRank > 12) {
$iMaxRank = 12;
}
if ($fSearchDiam > 0.2 && $iMaxRank > 17) {
$iMaxRank = 17;
}
if ($fSearchDiam > 0.1 && $iMaxRank > 18) {
$iMaxRank = 18;
}
if ($fSearchDiam > 0.008 && $iMaxRank > 22) {
$iMaxRank = 22;
}
if ($fSearchDiam > 0.001 && $iMaxRank > 26) {
$iMaxRank = 26;
}
$sSQL = 'select place_id,parent_place_id from placex';
$sSQL .= ' WHERE ST_DWithin(' . $sPointSQL . ', geometry, ' . $fSearchDiam . ')';
$sSQL .= ' and rank_search != 28 and rank_search >= ' . $iMaxRank;
$sSQL .= ' and (name is not null or housenumber is not null)';
$sSQL .= ' and class not in (\'waterway\')';
$sSQL .= ' and (ST_GeometryType(geometry) not in (\'ST_Polygon\',\'ST_MultiPolygon\') ';
$sSQL .= ' OR ST_DWithin(' . $sPointSQL . ', ST_Centroid(geometry), ' . $fSearchDiam . '))';
$sSQL .= ' ORDER BY ST_distance(' . $sPointSQL . ', geometry) ASC limit 1';
//var_dump($sSQL);
$aPlace = $oDB->getRow($sSQL);
$iPlaceID = $aPlace['place_id'];
if (PEAR::IsError($iPlaceID)) {
var_Dump($sSQL, $iPlaceID);
exit;
}
}
// The point we found might be too small - use the address to find what it is a child of
if ($iPlaceID) {
$sSQL = "select address_place_id from place_addressline where cached_rank_address <= {$iMaxRank} and place_id = {$iPlaceID} order by cached_rank_address desc,isaddress desc,distance desc limit 1";
$iPlaceID = $oDB->getOne($sSQL);
if (PEAR::IsError($iPlaceID)) {
var_Dump($sSQL, $iPlaceID);
exit;
}
if ($iPlaceID && $aPlace['place_id'] && $iMaxRank < 28) {
$sSQL = "select address_place_id from place_addressline where cached_rank_address <= {$iMaxRank} and place_id = " . $aPlace['place_id'] . " order by cached_rank_address desc,isaddress desc,distance desc";
$iPlaceID = $oDB->getOne($sSQL);
if (PEAR::IsError($iPlaceID)) {
var_Dump($sSQL, $iPlaceID);
exit;
}
}
if (!$iPlaceID) {
$iPlaceID = $aPlace['place_id'];
}
}
return $iPlaceID;
}
开发者ID:runderwood,项目名称:Nominatim,代码行数:78,代码来源:lib.php
示例19: lookup
function lookup()
{
if (!$this->sQuery && !$this->aStructuredQuery) {
return false;
}
$sLanguagePrefArraySQL = "ARRAY[" . join(',', array_map("getDBQuoted", $this->aLangPrefOrder)) . "]";
$sCountryCodesSQL = false;
if ($this->aCountryCodes && sizeof($this->aCountryCodes)) {
$sCountryCodesSQL = join(',', array_map('addQuotes', $this->aCountryCodes));
}
$sQuery = $this->sQuery;
// Conflicts between US state abreviations and various words for 'the' in different languages
if (isset($this->aLangPrefOrder['name:en'])) {
$sQuery = preg_replace('/(^|,)\\s*il\\s*(,|$)/', '\\1illinois\\2', $sQuery);
$sQuery = preg_replace('/(^|,)\\s*al\\s*(,|$)/', '\\1alabama\\2', $sQuery);
$sQuery = preg_replace('/(^|,)\\s*la\\s*(,|$)/', '\\1louisiana\\2', $sQuery);
}
// View Box SQL
$sViewboxCentreSQL = false;
$bBoundingBoxSearch = false;
if ($this->aViewBox) {
$fHeight = $this->aViewBox[0] - $this->aViewBox[2];
$fWidth = $this->aViewBox[1] - $this->aViewBox[3];
$aBigViewBox[0] = $this->aViewBox[0] + $fHeight;
$aBigViewBox[2] = $this->aViewBox[2] - $fHeight;
$aBigViewBox[1] = $this->aViewBox[1] + $fWidth;
$aBigViewBox[3] = $this->aViewBox[3] - $fWidth;
$this->sViewboxSmallSQL = "ST_SetSRID(ST_MakeBox2D(ST_Point(" . (double) $this->aViewBox[0] . "," . (double) $this->aViewBox[1] . "),ST_Point(" . (double) $this->aViewBox[2] . "," . (double) $this->aViewBox[3] . ")),4326)";
$this->sViewboxLargeSQL = "ST_SetSRID(ST_MakeBox2D(ST_Point(" . (double) $aBigViewBox[0] . "," . (double) $aBigViewBox[1] . "),ST_Point(" . (double) $aBigViewBox[2] . "," . (double) $aBigViewBox[3] . ")),4326)";
$bBoundingBoxSearch = $this->bBoundedSearch;
}
// Route SQL
if ($this->aRoutePoints) {
$sViewboxCentreSQL = "ST_SetSRID('LINESTRING(";
$bFirst = true;
foreach ($this->aRoutePoints as $aPoint) {
if (!$bFirst) {
$sViewboxCentreSQL .= ",";
}
$sViewboxCentreSQL .= $aPoint[0] . ' ' . $aPoint[1];
$bFirst = false;
}
$sViewboxCentreSQL .= ")'::geometry,4326)";
$sSQL = "select st_buffer(" . $sViewboxCentreSQL . "," . (double) ($_GET['routewidth'] / 69) . ")";
$this->sViewboxSmallSQL = $this->oDB->getOne($sSQL);
if (PEAR::isError($this->sViewboxSmallSQL)) {
failInternalError("Could not get small viewbox.", $sSQL, $this->sViewboxSmallSQL);
}
$this->sViewboxSmallSQL = "'" . $this->sViewboxSmallSQL . "'::geometry";
$sSQL = "select st_buffer(" . $sViewboxCentreSQL . "," . (double) ($_GET['routewidth'] / 30) . ")";
$this->sViewboxLargeSQL = $this->oDB->getOne($sSQL);
if (PEAR::isError($this->sViewboxLargeSQL)) {
failInternalError("Could not get large viewbox.", $sSQL, $this->sViewboxLargeSQL);
}
$this->sViewboxLargeSQL = "'" . $this->sViewboxLargeSQL . "'::geometry";
$bBoundingBoxSearch = $this->bBoundedSearch;
}
// Do we have anything that looks like a lat/lon pair?
if ($aLooksLike = looksLikeLatLonPair($sQuery)) {
$this->setNearPoint(array($aLooksLike['lat'], $aLooksLike['lon']));
$sQuery = $aLooksLike['query'];
}
$aSearchResults = array();
if ($sQuery || $this->aStructuredQuery) {
// Start with a blank search
$aSearches = array(array('iSearchRank' => 0, 'iNamePhrase' => -1, 'sCountryCode' => false, 'aName' => array(), 'aAddress' => array(), 'aFullNameAddress' => array(), 'aNameNonSearch' => array(), 'aAddressNonSearch' => array(), 'sOperator' => '', 'aFeatureName' => array(), 'sClass' => '', 'sType' => '', 'sHouseNumber' => '', 'fLat' => '', 'fLon' => '', 'fRadius' => ''));
// Do we have a radius search?
$sNearPointSQL = false;
if ($this->aNearPoint) {
$sNearPointSQL = "ST_SetSRID(ST_Point(" . (double) $this->aNearPoint[1] . "," . (double) $this->aNearPoint[0] . "),4326)";
$aSearches[0]['fLat'] = (double) $this->aNearPoint[0];
$aSearches[0]['fLon'] = (double) $this->aNearPoint[1];
$aSearches[0]['fRadius'] = (double) $this->aNearPoint[2];
}
// Any 'special' terms in the search?
$bSpecialTerms = false;
preg_match_all('/\\[(.*)=(.*)\\]/', $sQuery, $aSpecialTermsRaw, PREG_SET_ORDER);
$aSpecialTerms = array();
foreach ($aSpecialTermsRaw as $aSpecialTerm) {
$sQuery = str_replace($aSpecialTerm[0], ' ', $sQuery);
$aSpecialTerms[strtolower($aSpecialTerm[1])] = $aSpecialTerm[2];
}
preg_match_all('/\\[([\\w ]*)\\]/u', $sQuery, $aSpecialTermsRaw, PREG_SET_ORDER);
$aSpecialTerms = array();
if (isset($this->aStructuredQuery['amenity']) && $this->aStructuredQuery['amenity']) {
$aSpecialTermsRaw[] = array('[' . $this->aStructuredQuery['amenity'] . ']', $this->aStructuredQuery['amenity']);
unset($this->aStructuredQuery['amenity']);
}
foreach ($aSpecialTermsRaw as $aSpecialTerm) {
$sQuery = str_replace($aSpecialTerm[0], ' ', $sQuery);
$sToken = $this->oDB->getOne("select make_standard_name('" . $aSpecialTerm[1] . "') as string");
$sSQL = 'select * from (select word_id,word_token, word, class, type, country_code, operator';
$sSQL .= ' from word where word_token in (\' ' . $sToken . '\')) as x where (class is not null and class not in (\'place\')) or country_code is not null';
if (CONST_Debug) {
var_Dump($sSQL);
}
$aSearchWords = $this->oDB->getAll($sSQL);
$aNewSearches = array();
foreach ($aSearches as $aSearch) {
foreach ($aSearchWords as $aSearchTerm) {
//.........这里部分代码省略.........
开发者ID:leforestier,项目名称:Nominatim,代码行数:101,代码来源:Geocode.php
示例20: add
/**
* Adds a document to the index.
*
* @param array documents or fields
* @param bool commit after adding
* @param bool ignore missing fields
*/
public function add($documents, $commit = true, $ignoreMissingFields = false)
{
$this->loadFieldData();
if (LWUtil::getDimensionCount($documents) == 1) {
$documents = array($documents);
}
foreach ($documents as $fields) {
$document = new Zend_Search_Lucene_Document();
foreach ($this->fields as $fieldName => $fieldType) {
if (!isset($fields[$fieldName])) {
if (!$ignoreMissingFields) {
var_Dump($fields);
require_once WCF_DIR . 'lib/system/exception/SystemException.class.php';
throw new SystemException('missing field ' . $fieldName);
}
}
$field = call_user_func_array(array('Zend_Search_Lucene_Field', $fieldType), array($fieldName, $fields[$fieldName]));
$document->addField($field);
}
$this->getIndex()->addDocument($document);
}
if ($commit) {
$this->getIndex()->commit();
}
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:32,代码来源:Lucene.class.php
注:本文中的var_Dump函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论