本文整理汇总了PHP中STInput::request方法的典型用法代码示例。如果您正苦于以下问题:PHP STInput::request方法的具体用法?PHP STInput::request怎么用?PHP STInput::request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STInput
的用法示例。
在下文中一共展示了STInput::request方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _top_ajax_search
/**
*
*
*
*
* @since 1.0.9
* */
function _top_ajax_search()
{
if (STInput::request('action') != 'st_top_ajax_search') {
return;
}
//Small security
check_ajax_referer('st_search_security', 'security');
$s = STInput::get('s');
$arg = array('post_type' => array('post', 'st_hotel', 'st_rental', 'location', 'st_tours', 'st_holidays', 'st_cars', 'st_activity'), 'posts_per_page' => 10, 's' => $s, 'suppress_filters' => false);
$query = new WP_Query();
$query->is_admin = false;
$query->query($arg);
$r = array();
while ($query->have_posts()) {
$query->the_post();
$post_type = get_post_type(get_the_ID());
$obj = get_post_type_object($post_type);
$item = array('title' => get_the_title(), 'id' => get_the_ID(), 'type' => $obj->labels->singular_name, 'url' => get_permalink(), 'obj' => $obj);
if ($post_type == 'location') {
$item['url'] = home_url(esc_url_raw('?s=&post_type=st_hotel&location_id=' . get_the_ID()));
}
$r['data'][] = $item;
}
wp_reset_query();
echo json_encode($r);
die;
}
示例2: st_list_hotel_related
function st_list_hotel_related($attr, $content = false)
{
$data_vc = STHotel::get_taxonomy_and_id_term_tour();
$param = array('title' => '', 'sort_taxonomy' => '', 'posts_per_page' => 3, 'orderby' => 'ID', 'order' => 'DESC', 'font_size' => '3', 'number_of_row' => 1);
$param = array_merge($param, $data_vc['list_id_vc']);
$data = shortcode_atts($param, $attr, 'st_list_hotel_related');
extract($data);
$page = STInput::request('paged');
if (!$page) {
$page = get_query_var('paged');
}
$query = array('post_type' => 'st_hotel', 'posts_per_page' => $posts_per_page, 'post_status' => 'publish', 'paged' => $page, 'order' => $order, 'orderby' => $orderby, 'post__not_in' => array(get_the_ID()));
if (!empty($sort_taxonomy)) {
if (isset($attr["id_term_" . $sort_taxonomy])) {
$terms_post = wp_get_post_terms(get_the_ID(), $sort_taxonomy, array('fields' => 'ids'));
$id_term = $attr["id_term_" . $sort_taxonomy];
$id_term = explode(',', $id_term);
$terms = array();
foreach ($id_term as $key => $value) {
if (in_array($value, $terms_post)) {
$terms[] = $value;
}
}
if ($terms) {
$query['tax_query'] = array(array('taxonomy' => $sort_taxonomy, 'field' => 'id', 'terms' => $terms));
}
}
}
$r = "<div class='list_hotel_related'>" . st()->load_template('vc-elements/st-list-hotel/loop-hot', 'deals', array('query' => new Wp_Query($query))) . "</div>";
wp_reset_query();
if (!empty($title) and !empty($r)) {
$r = '<h' . $font_size . '>' . $title . '</h' . $font_size . '>' . $r;
}
return $r;
}
示例3: _save_separated_field
/**
*
*
* @since 1.0
* */
function _save_separated_field($post_id)
{
if (!empty($_POST['st_custom_price_nonce'])) {
if (!wp_verify_nonce($_POST['st_custom_price_nonce'], plugin_basename(__FILE__))) {
return $post_id;
}
if (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
$price_new = STInput::request('st_price');
$price_type = STInput::request('st_price_type');
$start_date = STInput::request('st_start_date');
$end_date = STInput::request('st_end_date');
$status = STInput::request('st_status');
$priority = STInput::request('st_priority');
STAdmin::st_delete_price($post_id);
if ($price_new and $start_date and $end_date) {
foreach ($price_new as $k => $v) {
if (!empty($v)) {
STAdmin::st_add_price($post_id, $price_type[$k], $v, $start_date[$k], $end_date[$k], $status[$k], $priority[$k]);
}
}
}
}
}
示例4: st_vc_list_activity
function st_vc_list_activity($attr, $content = false)
{
$data_vc = STActivity::get_taxonomy_and_id_term_activity();
$param = array('st_ids' => "", 'st_number' => 4, 'st_order' => '', 'st_orderby' => '', 'st_of_row' => 4, 'only_featured_location' => 'no', 'st_location' => '', 'sort_taxonomy' => '');
$param = array_merge($param, $data_vc['list_id_vc']);
$data = shortcode_atts($param, $attr, 'st_list_activity');
extract($data);
$page = STInput::request('paged');
if (!$page) {
$page = get_query_var('paged');
}
$query = array('post_type' => 'st_activity', 'posts_per_page' => $st_number, 'paged' => $page, 'order' => $st_order, 'orderby' => $st_orderby);
if (!empty($st_ids)) {
$query['post__in'] = explode(',', $st_ids);
$query['orderby'] = 'post__in';
}
if ($st_orderby == 'sale') {
$query['meta_key'] = 'price';
$query['orderby'] = 'meta_value';
}
if ($st_orderby == 'rate') {
$query['meta_key'] = 'rate_review';
$query['orderby'] = 'meta_value';
}
if ($st_orderby == 'discount') {
$query['meta_key'] = 'discount';
$query['orderby'] = 'meta_value';
}
$_SESSION['el_only_featured_location'] = $only_featured_location;
$_SESSION['el_st_location'] = $st_location;
$_SESSION['el_featured'] = array();
if ($only_featured_location == 'yes') {
$STLocation = new STLocation();
$featured = $STLocation->get_featured_ids();
$_SESSION['featured'] = $featured;
}
$st_list_activity = new st_list_activity();
if ($only_featured_location == 'yes' || !empty($st_location)) {
add_filter('posts_where', array($st_list_activity, '_get_query_where'));
add_filter('posts_join', array($st_list_activity, '_get_query_join'));
}
if (!empty($sort_taxonomy)) {
if (isset($attr["id_term_" . $sort_taxonomy])) {
$id_term = $attr["id_term_" . $sort_taxonomy];
$query['tax_query'] = array(array('taxonomy' => $sort_taxonomy, 'field' => 'id', 'terms' => explode(',', $id_term)));
}
}
query_posts($query);
remove_filter('posts_where', array($st_list_activity, '_get_query_where'));
remove_filter('posts_join', array($st_list_activity, '_get_query_join'));
unset($_SESSION['el_only_featured_location']);
unset($_SESSION['el_st_location']);
unset($_SESSION['el_featured']);
$r = "<div class='list_tours'>" . st()->load_template('vc-elements/st-list-activity/loop', '', $data) . "</div>";
wp_reset_query();
return $r;
}
示例5: _alter_search_query
function _alter_search_query($where)
{
if (is_admin()) {
return $where;
}
global $wp_query, $wpdb;
$post_type = '';
if (isset($wp_query->query_vars['post_type']) and is_string($wp_query->query_vars['post_type'])) {
$post_type = $wp_query->query_vars['post_type'];
}
if ($post_type == 'hotel_room') {
// Check Woocommerce Booking
$st_is_woocommerce_checkout = apply_filters('st_is_woocommerce_checkout', false);
if (STInput::request('start') and STInput::request('end')) {
$check_in = strtotime(STInput::request('start'));
$check_out = strtotime(STInput::request('end'));
// $where_add=" AND {$wpdb->posts}.ID NOT IN (SELECT room_id FROM (
// SELECT count(st_meta6.meta_value) as total,
// st_meta5.meta_value as total_room,st_meta6.meta_value as room_id ,st_meta2.meta_value as check_in,st_meta3.meta_value as check_out
// FROM {$wpdb->posts}
// JOIN {$wpdb->postmeta} as st_meta2 on st_meta2.post_id={$wpdb->posts}.ID and st_meta2.meta_key='check_in'
// JOIN {$wpdb->postmeta} as st_meta3 on st_meta3.post_id={$wpdb->posts}.ID and st_meta3.meta_key='check_out'
// JOIN {$wpdb->postmeta} as st_meta6 on st_meta6.post_id={$wpdb->posts}.ID and st_meta6.meta_key='room_id'
// JOIN {$wpdb->postmeta} as st_meta5 on st_meta5.post_id=st_meta6.meta_value and st_meta5.meta_key='number_room'
// WHERE {$wpdb->posts}.post_type='st_order'
// GROUP BY st_meta6.meta_value HAVING total>=total_room AND (
//
// ( CAST(st_meta2.meta_value AS DATE)<'{$check_in}' AND CAST(st_meta3.meta_value AS DATE)>'{$check_in}' )
// OR ( CAST(st_meta2.meta_value AS DATE)>='{$check_in}' AND CAST(st_meta2.meta_value AS DATE)<='{$check_out}' )
//
// )
// ) as room_booked)";
$table_name = $wpdb->prefix . 'st_order_item_meta';
if ($st_is_woocommerce_checkout) {
$where_type = " AND type='woocommerce'";
} else {
$where_type = " AND type='normal_booking'";
}
$where_add = " AND {$wpdb->posts}.ID NOT IN (SELECT room_id FROM (\r\n SELECT\r\n room_id,SUM(room_num_search) as total_booked_number,{$wpdb->postmeta}.meta_value\r\n FROM\r\n {$table_name}\r\n JOIN {$wpdb->postmeta} ON {$wpdb->postmeta}.post_id = {$table_name}.room_id and {$wpdb->postmeta}.meta_key='number_room'\r\n AND st_booking_post_type = 'st_hotel'\r\n WHERE (check_in_timestamp<{$check_in} AND check_out_timestamp>{$check_in}) OR\r\n (check_in_timestamp>={$check_in} AND check_in_timestamp<={$check_out})\r\n {$where_type}\r\n GROUP BY room_id\r\n HAVING total_booked_number>={$wpdb->postmeta}.meta_value\r\n\r\n ) as room_booked2 )";
// Woocommerce Booking
if ($st_is_woocommerce_checkout) {
// Woocommerce check Query
$where_add = "";
}
$where .= $where_add;
}
}
return $where;
}
示例6: list_item_post_type
function list_item_post_type()
{
$post_type = STInput::request('post_type', 'location');
$query = array('post_type' => $post_type, 'posts_per_page' => -1);
query_posts($query);
$result = array();
while (have_posts()) {
the_post();
$result[] = array('title' => get_the_title(), 'id' => get_the_ID());
}
wp_reset_query();
wp_reset_postdata();
echo json_encode($result);
die;
}
示例7: _get_disable_date
static function _get_disable_date()
{
$disable = array();
if (!TravelHelper::checkTableDuplicate('st_holidays')) {
echo json_encode($disable);
die;
}
$holiday_id = STInput::request('holiday_id', '');
if (empty($holiday_id)) {
echo json_encode($disable);
die;
}
$year = STInput::request('year', date('Y'));
global $wpdb;
$sql = "SELECT\r\n\t\t\t\tst_booking_id AS holiday_id,\r\n\t\t\t\tcheck_in_timestamp AS check_in,\r\n\t\t\t\tcheck_out_timestamp AS check_out,\r\n\t\t\t\tadult_number,\r\n\t\t\t\tchild_number,\r\n\t\t\t\tinfant_number\r\n\t\t\tFROM\r\n\t\t\t\t{$wpdb->prefix}st_order_item_meta\r\n\t\t\tINNER JOIN {$wpdb->prefix}st_holidays AS mt ON mt.post_id = st_booking_id\r\n\t\t\tWHERE\r\n\t\t\t\tst_booking_post_type = 'st_holidays'\r\n\t\t\tAND mt.type_holiday = 'daily_holiday'\r\n\t\t\tAND st_booking_id = '{$holiday_id}'\r\n\t\t\tAND status NOT IN ('trash', 'canceled')\r\n\t\t\tAND YEAR (\r\n\t\t\t\tFROM_UNIXTIME(check_in_timestamp)\r\n\t\t\t) = {$year}\r\n\t\t\tAND YEAR (\r\n\t\t\t\tFROM_UNIXTIME(check_out_timestamp)\r\n\t\t\t) = {$year}";
$result = $wpdb->get_results($sql, ARRAY_A);
if (is_array($result) && count($result)) {
$list_date = array();
foreach ($result as $key => $val) {
$list_date[] = array('check_in' => $val['check_in'], 'check_out' => $val['check_out'], 'adult_number' => $val['adult_number'], 'child_number' => $val['child_number'], 'infant_number' => $val['infant_number']);
}
}
if (isset($list_date) && count($list_date)) {
$min_max = self::_get_minmax($holiday_id, $year);
if (is_array($min_max) && count($min_max)) {
$max_people = intval(get_post_meta($holiday_id, 'max_people', true));
for ($i = intval($min_max['check_in']); $i <= intval($min_max['check_out']); $i = strtotime('+1 day', $i)) {
$people = 0;
foreach ($result as $key => $date) {
if ($i == intval($date['check_in'])) {
$people += intval($date['adult_number']) + intval($date['child_number']) + intval($date['infant_number']);
}
}
if ($people >= $max_people) {
$disable[] = date(TravelHelper::getDateFormat(), $i);
}
}
}
}
if (count($disable)) {
echo json_encode($disable);
die;
}
echo json_encode($disable);
die;
}
示例8: _alter_search_query
function _alter_search_query($where)
{
if (is_admin()) {
return $where;
}
global $wp_query, $wpdb;
$post_type = '';
if (isset($wp_query->query_vars['post_type']) and is_string($wp_query->query_vars['post_type'])) {
$post_type = $wp_query->query_vars['post_type'];
}
if ($post_type == 'hotel_room') {
if (STInput::request('start') and STInput::request('end')) {
$check_in = date('Y-m-d H:i:s', strtotime(STInput::request('start')));
$check_out = date('Y-m-d H:i:s', strtotime(STInput::request('end')));
$where_add = " AND {$wpdb->posts}.ID NOT IN (SELECT room_id FROM (\r\n SELECT count(st_meta6.meta_value) as total,\r\n st_meta5.meta_value as total_room,st_meta6.meta_value as room_id ,st_meta2.meta_value as check_in,st_meta3.meta_value as check_out\r\n FROM {$wpdb->posts}\r\n JOIN {$wpdb->postmeta} as st_meta2 on st_meta2.post_id={$wpdb->posts}.ID and st_meta2.meta_key='check_in'\r\n JOIN {$wpdb->postmeta} as st_meta3 on st_meta3.post_id={$wpdb->posts}.ID and st_meta3.meta_key='check_out'\r\n JOIN {$wpdb->postmeta} as st_meta6 on st_meta6.post_id={$wpdb->posts}.ID and st_meta6.meta_key='room_id'\r\n JOIN {$wpdb->postmeta} as st_meta5 on st_meta5.post_id=st_meta6.meta_value and st_meta5.meta_key='number_room'\r\n WHERE {$wpdb->posts}.post_type='st_order'\r\n GROUP BY st_meta6.meta_value HAVING total>=total_room AND (\r\n\r\n ( CAST(st_meta2.meta_value AS DATE)<'{$check_in}' AND CAST(st_meta3.meta_value AS DATE)>'{$check_in}' )\r\n OR ( CAST(st_meta2.meta_value AS DATE)>='{$check_in}' AND CAST(st_meta2.meta_value AS DATE)<='{$check_out}' )\r\n\r\n )\r\n ) as room_booked)";
$where .= $where_add;
}
}
return $where;
}
示例9: partnerGetListRoom
public function partnerGetListRoom()
{
$result = array('');
$hotel_id = intval(STInput::request('hotel_id', ''));
if ($hotel_id <= 0 || get_post_type($hotel_id) != 'st_hotel') {
echo json_encode($result);
die;
}
$user_id = STInput::request('user_id');
$query = array('post_type' => 'hotel_room', 'posts_per_page' => -1, 'post_status' => array('publish', 'private'), 'author' => $user_id, 'order_by' => 'title', 'order' => 'DESC', 'meta_query' => array(array('key' => 'room_parent', 'value' => $hotel_id, 'compare' => 'IN')));
query_posts($query);
if (have_posts()) {
$result = array();
$result[] = array('id' => '', 'text' => __('----Select a Room----', ST_TEXTDOMAIN));
while (have_posts()) {
the_post();
$result[] = array('id' => get_the_ID(), 'text' => get_the_title());
}
}
wp_reset_query();
wp_reset_postdata();
echo json_encode($result);
die;
}
示例10: STCars
*/
$cars = new STCars();
$fields = $cars->get_search_fields_box();
?>
<h3><?php
st_the_language('search_for_cars');
?>
</h3>
<form method="get" action="<?php
the_permalink();
?>
">
<div class="row">
<?php
if (!get_option('permalink_structure')) {
echo '<input type="hidden" name="page_id" value="' . STInput::request('page_id') . '">';
}
?>
<input type="hidden" name="layout" value="<?php
echo STInput::get('layout');
?>
">
<input type="hidden" name="style" value="<?php
echo STInput::get('style');
?>
">
<?php
if (!empty($fields)) {
foreach ($fields as $key => $value) {
$name = $value['title'];
$size = $value['layout_col_box'];
示例11: _e
<option <?php
if (STInput::request('drop-off-time') == '10:30 PM') {
echo 'selected';
}
?>
value="10:30 PM"><?php
_e("10:30 PM", ST_TEXTDOMAIN);
?>
</option>
<option <?php
if (STInput::request('drop-off-time') == '11:00 PM') {
echo 'selected';
}
?>
value="11:00 PM"><?php
_e("11:00 PM", ST_TEXTDOMAIN);
?>
</option>
<option <?php
if (STInput::request('drop-off-time') == '11:30 PM') {
echo 'selected';
}
?>
value="11:30 PM"><?php
_e("11:30 PM", ST_TEXTDOMAIN);
?>
</option>
</select>
</div>
示例12: esc_attr
if (!isset($field_size)) {
$field_size = 'lg';
}
if ($is_required == 'on') {
$is_required = 'required';
}
?>
<div class="form-group form-group-<?php
echo esc_attr($field_size);
?>
form-group-icon-left">
<label for="field-holiday-address2"><?php
echo esc_html($title);
?>
</label>
<i class="fa fa-map-marker input-icon"></i>
<input id="field-holiday-address2" <?php
echo esc_attr($is_required);
?>
name="address" value="<?php
echo STInput::request('address');
?>
" class="typeahead_address form-control <?php
echo esc_attr($is_required);
?>
" placeholder="<?php
echo $placeholder ? $placeholder : st_get_language('city_name_or_zip_code');
?>
" type="text" />
</div>
示例13: foreach
</label>
<?php
if (is_array($terms)) {
?>
<?php
foreach ($terms as $k => $v) {
$key_id = $value_name = "";
if (!empty($v->term_id)) {
$key_id = $v->term_id;
$value_name = $v->name;
} else {
$tmp = explode("|", $v);
$key_id = $tmp[0];
$value_name = $tmp[1];
}
$is_taxonomy = STInput::request('taxonomy');
$is_check = '';
if (!empty($is_taxonomy[$taxonomy])) {
$data = explode(',', $is_taxonomy[$taxonomy]);
if (in_array($key_id, $data)) {
$is_check = 'checked';
}
}
?>
<div class="checkbox">
<label>
<input class="i-check item_tanoxomy" <?php
echo esc_html($is_check);
?>
type="checkbox" value="<?php
echo esc_attr($key_id);
示例14: check_anymous_user_email
/**
* @since 1.1.0
*
*/
function check_anymous_user_email()
{
$current_email = STInput::request('email');
if (!$current_email) {
return false;
}
global $wpdb;
$query = "SELECT count({$wpdb->comments}.comment_ID) from {$wpdb->comments} WHERE comment_author_email = '{$current_email}' ";
$count = $wpdb->get_var($query);
if ($count > 1) {
return false;
}
return true;
}
示例15: st_the_language
<label for="field-car-drive-name"><?php
st_the_language('driver_name');
?>
<span class="require">*</span></label>
<input id="field-car-drive-name" name="driver_name" value="<?php
echo STInput::request('driver_name');
?>
" type="text" placeholder="<?php
st_the_language('driver_name');
?>
" class="form-control">
</div>
<div class="form-group">
<label for="field-car-drive-age"><?php
st_the_language('driver_age');
?>
<span class="require">*</span></label>
<input id="field-car-drive-age" name="driver_age" value="<?php
echo STInput::request('driver_age');
?>
" type="text" placeholder="<?php
st_the_language('driver_age');
?>
" class="form-control">
</div>
</div>
</div>
</div>