本文整理汇总了PHP中TravelHelper::getLocationByParent方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::getLocationByParent方法的具体用法?PHP TravelHelper::getLocationByParent怎么用?PHP TravelHelper::getLocationByParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TravelHelper
的用法示例。
在下文中一共展示了TravelHelper::getLocationByParent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: balanceTags
">
<img title="logo" alt="logo" src="<?php
echo balanceTags($img);
?>
">
</div>
<?php
}
?>
<div class="text-small img-left">
<h5><?php
the_title();
?>
</h5>
<?php
$list = TravelHelper::getLocationByParent(get_the_ID());
if (is_array($list) and !empty($list)) {
$result = STLocation::get_info_by_post_type(get_the_ID(), $st_type, $list);
} else {
$result = STLocation::get_info_by_post_type(get_the_ID(), $st_type);
}
/*$min_price = get_post_meta(get_the_ID() , 'min_price_'.$st_type , true );
$offer = get_post_meta(get_the_ID() , 'offer_'.$st_type , true );
$review = get_post_meta(get_the_ID() , 'review_'.$st_type , true );*/
$min_max_price = $result['min_max_price'];
$min_price = $min_max_price['price_min'];
$offer = $result['offers'];
$review = $result['reviews'];
?>
<?php
if (!empty($review)) {
示例2: _get_where_query_tab_location
/**
* @update 1.1.8
*/
function _get_where_query_tab_location($where)
{
// if in location tab location id = get_the_ID();
$location_id = get_the_ID();
if (!TravelHelper::checkTableDuplicate('st_activity')) {
return $where;
}
$list = TravelHelper::getLocationByParent($location_id);
if (is_array($list) && count($list)) {
$where .= " AND (";
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.id_location IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.id_location IN ('{$location_id}')) ";
}
return $where;
}
示例3: _get_where_query
function _get_where_query($where)
{
if (!TravelHelper::checkTableDuplicate('st_holidays')) {
return $where;
}
global $wpdb;
if (isset($_REQUEST['location_id']) && !empty($_REQUEST['location_id'])) {
$location_id = STInput::get('location_id', '');
$list = TravelHelper::getLocationByParent($location_id);
if (is_array($list) && count($list)) {
$where .= " AND (";
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.id_location IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.id_location IN ('{$location_id}')) ";
}
} elseif (isset($_REQUEST['location_name']) && !empty($_REQUEST['location_name'])) {
$location_name = STInput::get('location_name', '');
$ids_location = TravelerObject::_get_location_by_name($location_name);
if (is_array($ids_location) && count($ids_location)) {
$ids_location_tmp = array();
foreach ($ids_location as $item) {
$list = TravelHelper::getLocationByParent($item);
if (is_array($list) && count($list)) {
foreach ($list as $item) {
$ids_location_tmp[] = $item;
}
}
}
if (count($ids_location_tmp)) {
$ids_location = $ids_location_tmp;
}
}
if (is_array($ids_location) && count($ids_location)) {
$where .= " AND ((";
$where_tmp = "";
foreach ($ids_location as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$ids_location = implode(',', $ids_location);
$where_tmp .= " OR tb.id_location IN ({$ids_location})";
$where .= $where_tmp . ")";
$where .= " OR (tb.address LIKE '%{$location_name}%'";
$where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%'))";
} else {
if (!empty($_REQUEST['search_all'])) {
$where .= " AND (tb.address LIKE '%{$location_name}%'";
$where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%')";
}
}
} elseif (isset($_REQUEST['address']) && !empty($_REQUEST['address'])) {
$address = STInput::request('address', '');
$value = STInput::request('address');
$value = explode(",", $value);
if (!empty($value[0]) and !empty($value[2])) {
$where .= " AND ( tb.address LIKE '%{$value[0]}%' OR tb.address LIKE '%{$value[2]}%')";
} else {
$where .= " AND ( tb.address LIKE '%{$address}%')";
}
}
if (isset($_REQUEST['item_id']) and !empty($_REQUEST['item_id'])) {
$item_id = STInput::request('item_id', '');
$where .= " AND ({$wpdb->prefix}posts.ID = '{$item_id}')";
}
if (isset($_REQUEST['item_name']) and !empty($_REQUEST['item_name'])) {
$item_name = STInput::request('item_name', '');
$where .= " AND ({$wpdb->prefix}posts.post_title LIKE '%{$item_name}%')";
}
if (isset($_REQUEST['people']) && !empty($_REQUEST['people'])) {
$people = STInput::get('people', 1);
$where .= " AND (tb.max_people >= {$people})";
}
if (isset($_REQUEST['duration']) && !empty($_REQUEST['duration'])) {
$duration = intval(STInput::get('duration', 1));
$today = time();
$where .= "AND (\r\n (\r\n tb.duration_day = {$duration}\r\n AND tb.type_holiday = 'daily_holiday'\r\n )\r\n )";
/*$where .= "AND (
(
tb.duration_day >= {$duration}
AND tb.type_holiday = 'daily_holiday'
)
OR (
(
(UNIX_TIMESTAMP(STR_TO_DATE(tb.check_out, '%Y-%m-%d')) - UNIX_TIMESTAMP(STR_TO_DATE(tb.check_in, '%Y-%m-%d'))) / (60*60*24) + 1
) >= {$duration}
)
)";*/
//.........这里部分代码省略.........
示例4: _get_where_query
function _get_where_query($where)
{
if (!TravelHelper::checkTableDuplicate('st_rental')) {
return $where;
}
global $wpdb;
if ($location_id = STInput::get('location_id') and STInput::get('location_id') or get_post_type(get_the_ID()) == 'location') {
if (!$location_id) {
$location_id = get_the_ID();
}
$list = TravelHelper::getLocationByParent($location_id);
if (is_array($list) && count($list)) {
$where .= " AND (";
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.location_id IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.location_id IN ('{$location_id}')) ";
}
} elseif ($location_name = STInput::request('location_name')) {
$ids_location = TravelerObject::_get_location_by_name($location_name);
if (is_array($ids_location) && count($ids_location)) {
$ids_location_tmp = array();
foreach ($ids_location as $item) {
$list = TravelHelper::getLocationByParent($item);
if (is_array($list) && count($list)) {
foreach ($list as $item) {
$ids_location_tmp[] = $item;
}
}
}
if (count($ids_location_tmp)) {
$ids_location = $ids_location_tmp;
}
}
if (!empty($ids_location)) {
$where .= " AND ((";
$where_tmp = "";
foreach ($ids_location as $id) {
if (empty($where_tmp)) {
$where_tmp .= " tb.multi_location LIKE '%_{$id}_%' ";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$id}_%' ";
}
}
$ids_location = implode(',', $ids_location);
$where_tmp .= " OR (tb.location_id IN ({$ids_location})";
$where .= $where_tmp . ")";
$where .= " OR (tb.address LIKE '%{$location_name}%'";
$where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%')))";
} else {
if (!empty($_REQUEST['search_all'])) {
$where .= " AND (tb.address LIKE '%{$location_name}%'";
$where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%')";
}
}
} elseif ($address = STInput::request('address', '')) {
$value = STInput::request('address');
$value = explode(",", $value);
if (!empty($value[0]) and !empty($value[2])) {
$where .= " AND (tb.address LIKE '%{$value[0]}%' OR tb.address LIKE '%{$value[2]}%')";
} else {
$where .= " AND (tb.address LIKE '%{$address}%')";
}
}
if (isset($_GET['start']) && isset($_GET['end']) and !empty($_GET['start']) and !empty($_GET['end'])) {
$check_in = date('Y-m-d', strtotime(TravelHelper::convertDateFormat($_GET['start'])));
$check_out = date('Y-m-d', strtotime(TravelHelper::convertDateFormat($_GET['end'])));
$today = date('m/d/Y');
$period = TravelHelper::dateDiff($today, $check_in);
$adult_number = STInput::get('adult_number', 0);
if (intval($adult_number) < 0) {
$adult_number = 0;
}
$children_number = STInput::get('children_num', 0);
if (intval($children_number) < 0) {
$children_number = 0;
}
$list_rental = RentalHelper::_rentalValidate($check_in, $check_out, $adult_number, $children_number, 1);
if (!is_array($list_rental) || count($list_rental) <= 0) {
$list_rental = "''";
} else {
$list_rental = implode(',', $list_rental);
}
$where .= " AND {$wpdb->posts}.ID NOT IN ({$list_rental}) AND CAST(tb.rentals_booking_period AS UNSIGNED) <= {$period}";
}
if ($star = STInput::get('star_rate')) {
$stars = STInput::get('star_rate', 1);
$stars = explode(',', $stars);
$all_star = array();
if (!empty($stars) && is_array($stars)) {
foreach ($stars as $val) {
//.........这里部分代码省略.........
示例5: __
}
?>
<h4><?php
if (!$title) {
echo __("Largest Selection", ST_TEXTDOMAIN);
} else {
echo esc_html($title);
}
?>
</h4>
<p>
<?php
if (!empty($post_type) and is_array($post_type)) {
$count_review = 0;
foreach ($post_type as $key => $value) {
$list = TravelHelper::getLocationByParent($location);
$result = STLocation::get_info_by_post_type(get_the_ID(), $value, $list);
if (STLocation::round_count_reviews($result['offers'])) {
echo "<br>";
echo STLocation::round_count_reviews($result['offers']) . " " . $result['post_type_name'];
}
$count_review += $result['reviews'];
}
}
?>
<?php
if (!empty($count_review_s) and $count_review_s == "on" and STLocation::round_count_reviews($count_review)) {
?>
<br><?php
echo __("Over", ST_TEXTDOMAIN);
?>
示例6: _get_query_where
static function _get_query_where($where)
{
$st_type = $_SESSION['el_st_type'];
$location_id = $_SESSION['el_location_id'];
if (!TravelHelper::checkTableDuplicate($st_type)) {
return $where;
}
global $wpdb;
$location_field = 'id_location';
if ($st_type == 'st_rental') {
$location_field = 'location_id';
}
if (is_array($location_id)) {
$where .= " AND (";
foreach ($location_id as $k => $v) {
$list = TravelHelper::getLocationByParent($v);
if (is_array($list) && count($list)) {
if ($k == 0) {
$where .= " (";
} else {
$where .= " OR (";
}
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.{$location_field} IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.{$location_field} IN ('{$location_id}')) ";
}
}
$where .= " )";
} else {
$list = TravelHelper::getLocationByParent($location_id);
if (is_array($list) && count($list)) {
$where .= " AND (";
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.{$location_field} IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.{$location_field} IN ('{$location_id}')) ";
}
}
return $where;
}
示例7: _get_query_where
static function _get_query_where($where)
{
if (!TravelHelper::checkTableDuplicate('st_rental')) {
return $where;
}
global $wpdb;
$location_id = $_SESSION['el_location_id'];
$list = TravelHelper::getLocationByParent($location_id);
if (is_array($list) && count($list)) {
$where .= " AND (";
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.location_id IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.location_id IN ('{$location_id}')) ";
}
return $where;
}
示例8: _get_query_where
static function _get_query_where($where)
{
if (!TravelHelper::checkTableDuplicate('st_holidays')) {
return $where;
}
global $wpdb;
$only_featured_location = $_SESSION['el_only_featured_location'];
$st_location = $_SESSION['el_st_location'];
$featured = $_SESSION['el_featured'];
if ($only_featured_location == 'yes') {
if (is_array($featured) && count($featured)) {
$where .= " AND (";
$where_tmp = "";
foreach ($featured as $item) {
if (empty($where_tmp)) {
$where_tmp .= " tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$featured = implode(',', $featured);
$where_tmp .= " OR tb.id_location IN ({$featured})";
$where .= $where_tmp . ")";
}
} else {
if (!empty($st_location)) {
$list = TravelHelper::getLocationByParent($st_location);
if (is_array($list) && count($list)) {
$where .= " AND (";
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.id_location IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where .= " AND (tb.multi_location LIKE '%_{$st_location}_%' OR tb.id_location IN ('{$st_location}')) ";
}
}
}
return $where;
}