本文整理汇总了PHP中SearchEngine::Execute方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchEngine::Execute方法的具体用法?PHP SearchEngine::Execute怎么用?PHP SearchEngine::Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchEngine
的用法示例。
在下文中一共展示了SearchEngine::Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UniversalFeedCreator
require_once 'geograph/imagelist.class.php';
$format = 'KML';
$rss = new UniversalFeedCreator();
$rss->title = 'Geograph British Isles';
$rss->link = "http://{$_SERVER['HTTP_HOST']}";
require_once 'geograph/searchcriteria.class.php';
require_once 'geograph/searchengine.class.php';
$pg = $_GET['page'];
if ($pg == '' or $pg < 1) {
$pg = 1;
}
$images = new SearchEngine($_GET['i']);
$images->criteria->resultsperpage = min(100, $images->criteria->resultsperpage);
$rss->description = "Images" . $images->criteria->searchdesc;
$rss->syndicationURL = "http://{$_SERVER['HTTP_HOST']}/syndicator.php?format={$format}&i=" . $_GET['i'] . ($pg > 1 ? "&page={$pg}" : '');
$images->Execute($pg);
if (count($images->results)) {
//create some feed items
foreach ($images->results as $img) {
$item = new FeedItem();
$item->guid = $img->gridimage_id;
$item->title = $img->grid_reference . " : " . $img->title;
$item->link = "http://{$_SERVER['HTTP_HOST']}/photo/{$img->gridimage_id}";
if (!empty($img->dist_string) || !empty($img->imagetakenString)) {
$item->description = $img->dist_string . (!empty($img->imagetakenString) ? ' Taken: ' . $img->imagetakenString : '') . "<br/>" . $img->comment;
$item->descriptionHtmlSyndicated = true;
} else {
$item->description = $img->comment;
}
if (!empty($img->imagetaken) && strpos($img->imagetaken, '-00') === FALSE) {
$item->imageTaken = $img->imagetaken;
示例2: intval
$UrlTag = $NetworkLink->useUrl($url);
$NetworkLink->setItem('visibility', 0);
if ($_REQUEST['type'] == 'time') {
$UrlTag->setItem('refreshMode', 'onInterval');
$UrlTag->setItem('refreshInterval', intval($_REQUEST['refresh']));
} else {
$UrlTag->setItem('viewRefreshMode', 'onStop');
$UrlTag->setItem('viewRefreshTime', 4);
$UrlTag->setItem('viewFormat', 'BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]&LOOKAT=[lookatLon],[lookatLat],[lookatRange],[lookatTilt],[lookatHeading],[horizFov],[vertFov]');
}
$kml->outputKML();
exit;
}
} else {
$engine->countOnly = true;
$smarty->assign('querytime', $engine->Execute($pg));
$smarty->assign('i', $i);
$smarty->assign('currentPage', $pg);
$smarty->assign_by_ref('engine', $engine);
}
} else {
$is = array(1522 => 'Recent Submissions', 46131 => 'Selection of Photos across the British Isles', -1 => 'Your Pictures', 25680 => 'one random image from each myriad, in Great Britain', 25681 => 'one random image from each myriad, in Ireland', 25677 => 'one random image from every user', 25678 => 'one random image from each category', 46002 => 'Random Images', 44622 => 'Moderated in the last 24 Hours');
$smarty->assign_by_ref('is', $is);
$smarty->assign('currentPage', 1);
$db = NewADOConnection($GLOBALS['DSN']);
$updatetime = $db->getOne("select avg(unix_timestamp(ts))-stddev(unix_timestamp(ts)) from kmlcache where rendered = 1");
$smarty->assign('superlayer_updated', strftime("%A, %d %b at %H:%M", intval($updatetime)));
$smarty->assign('coverage_updated', strftime("%A, %d %b at %H:%M", @filemtime("kml/hectads-points.kmz")));
}
$smarty->assign('adv', $_GET['adv']);
$smarty->display($template, $cacheid);
示例3: join
$where[] = 'approved = 1';
}
if (count($where)) {
$where_sql = " where " . join(' AND ', $where);
}
$dol = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$queries =& $db->getAll("\r\n\tselect\r\n\t\tid,searchdesc,`count`,comment,created,approved,orderby,stickied\r\n\tfrom\r\n\t\tqueries_featured\r\n\t\tinner join queries using (id)\r\n\t\tleft join queries_count using (id)\r\n\t{$where_sql}\r\n\torder by \r\n\t\tstickied desc, updated desc");
$ADODB_FETCH_MODE = $dol;
if (!empty($CONF['memcache']['app'])) {
//without memcache this would suck
require_once 'geograph/searchcriteria.class.php';
require_once 'geograph/searchengine.class.php';
foreach ($queries as $idx => $row) {
$mkey = $row['id'];
$queries[$idx]['image'] =& $memcache->name_get('fse', $mkey);
if (empty($queries[$idx]['image'])) {
$engine = new SearchEngine($row['id']);
$engine->criteria->resultsperpage = 1;
//override it
$engine->Execute($pg);
if ($engine->resultCount && $engine->results) {
$queries[$idx]['image'] = $engine->results[0];
$memcache->name_set('fse', $mkey, $queries[$idx]['image'], $memcache->compress, 3600 * 6 * rand(3, 10));
}
}
}
}
$smarty->assign_by_ref('queries', $queries);
}
$smarty->display($template, $cacheid);
示例4: handleLatLong
function handleLatLong()
{
$_GET['key'] = $this->params[2];
if (preg_match("/\\b(-?\\d+\\.?\\d*)[, ]+(-?\\d+\\.?\\d*)\\b/", $this->params[1], $ll)) {
$this->beginResponse();
//todo - we could do this directly rather than via the search engine
require_once 'geograph/searchcriteria.class.php';
require_once 'geograph/searchengine.class.php';
$engine = new SearchEngineBuilder('#');
$engine->searchuse = "syndicator";
$_GET['i'] = $engine->buildSimpleQuery($this->params[1], floatval($this->params[0]), false, isset($_GET['u']) ? $_GET['u'] : 0);
$images = new SearchEngine($_GET['i']);
$images->Execute($pg);
if (!empty($images->results)) {
$images =& $images->results;
$count = count($images);
#FIXME title1,title2,comment1,comment2
if ($this->output == 'json') {
require_once '3rdparty/JSON.php';
$json = new Services_JSON();
$whitelist = array('gridimage_id' => 1, 'seq_no' => 1, 'user_id' => 1, 'ftf' => 1, 'moderation_status' => 1, 'title' => 1, 'comment' => 1, 'submitted' => 1, 'realname' => 1, 'nateastings' => 1, 'natnorthings' => 1, 'natgrlen' => 1, 'imageclass' => 1, 'imagetaken' => 1, 'upd_timestamp' => 1, 'viewpoint_eastings' => 1, 'viewpoint_northings' => 1, 'viewpoint_grlen' => 1, 'view_direction' => 1, 'use6fig' => 1, 'credit_realname' => 1, 'profile_link' => 1, 'wgs84_lat' => 1, 'wgs84_long' => 1);
foreach ($images as $i => $image) {
foreach ($image as $k => $v) {
if (empty($v) || empty($whitelist[$k])) {
unset($images[$i]->{$k});
}
}
$images[$i]->image = $image->_getFullpath(true, true);
$images[$i]->thumbnail = $image->getThumbnail(120, 120, true);
}
print $json->encode($images);
} else {
echo '<status state="ok" count="' . $count . '" total="' . $images->resultCount . '"/>';
foreach ($images as $i => $image) {
if ($image->moderation_status == 'geograph' || $image->moderation_status == 'accepted') {
echo " <image url=\"http://{$_SERVER['HTTP_HOST']}/photo/{$image->gridimage_id}\">";
echo ' <title>' . utf8_encode(htmlentities($image->title)) . '</title>';
echo " <user profile=\"http://{$_SERVER['HTTP_HOST']}{$image->profile_link}\">" . utf8_encode(htmlentities($image->realname)) . '</user>';
echo ' ' . preg_replace('/alt=".*?" /', '', $image->getThumbnail(120, 120));
if (!empty($image->nateastings)) {
echo ' <location grid="' . $image->reference_index . '" eastings="' . $image->nateastings . '" northings="' . $image->natnorthings . '" figures="' . $image->natgrlen . '"/>';
}
if (!empty($image->wgs84_lat)) {
echo ' <location grid="' . $image->reference_index . '" lat="' . $image->wgs84_lat . '" long="' . $image->wgs84_long . '"/>';
}
echo '</image>';
}
}
}
} else {
if ($this->output == 'json') {
print "{error: '0 results'}";
} else {
echo '<status state="ok" count="0"/>';
}
}
$this->endResponse();
} else {
$this->error("Invalid grid reference " . $this->params[0]);
}
}