本文整理汇总了PHP中STInput类的典型用法代码示例。如果您正苦于以下问题:PHP STInput类的具体用法?PHP STInput怎么用?PHP STInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了STInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _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;
}
示例3: st_post_select_func
function st_post_select_func()
{
if (!current_user_can('upload_files')) {
return;
}
$result = array('total_count' => 0, 'items' => array());
$q = STInput::get('q');
$post_type = STInput::get('post_type');
if ($q) {
if (!$post_type) {
$post_type = 'st_hotel';
}
$arg = array('post_type' => $post_type, 'posts_per_page' => 20, 's' => $q, 'post_status' => 'publish');
$author = STInput::get('author');
if ($author) {
$arg = array('post_type' => $post_type, 'posts_per_page' => 20, 's' => $q, 'author' => $author, 'post_status' => 'publish');
}
$query = new WP_Query($arg);
while ($query->have_posts()) {
$query->the_post();
$result['items'][] = array('id' => get_the_ID(), 'name' => get_the_title(), 'description' => "ID: " . get_the_ID());
}
global $wp_query;
$result['total_count'] = $wp_query->found_posts;
wp_reset_query();
}
echo json_encode($result);
die;
}
示例4: _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]);
}
}
}
}
}
示例5: _shop_product_style
function _shop_product_style()
{
$style = st()->get_option('shop_default_list_view', 'grid');
if (STInput::get('view_style')) {
$style = STInput::get('view_style');
}
return $style;
}
示例6: 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;
}
示例7: _format_money
/**
*
*
* @since 1.1.3
* */
static function _format_money()
{
$data = STInput::post('money_data', array());
if (!empty($data)) {
foreach ($data as $key => $value) {
$data[$key] = TravelHelper::format_money($value);
}
}
echo json_encode(array('status' => 1, 'money_data' => $data));
die;
}
示例8: _get_image
static function _get_image()
{
if (STInput::get('st_get_captcha')) {
$key = STInput::get('key');
$captcha = new SimpleCaptcha();
if ($key) {
$captcha->session_var = $key;
}
$captcha->CreateImage();
die;
}
}
示例9: _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;
}
示例10: content
protected function content($arg, $content = null)
{
$data = shortcode_atts(array('st_title_form' => '', 'st_post_type' => "st_hotel", 'st_button_search' => __("Search", ST_TEXTDOMAIN)), $arg, 'st_search_form');
extract($data);
$content = st_remove_wpautop($content);
$text = ' <h2>' . $st_title_form . '</h2>
<form role="search" method="get" class="search" action="' . home_url('/') . '">
<input type="hidden" name="s" value="">
<input type="hidden" name="post_type" value="' . $st_post_type . '">
<input type="hidden" name="layout" value="' . STInput::get('layout') . '">
<div class="row">' . $content . '</div>
<button class="btn btn-primary btn-lg" type="submit">' . $st_button_search . '</button>
</form>';
return $text;
}
示例11: _javascript_reload_parentwindow
static function _javascript_reload_parentwindow()
{
if (STInput::get('social_login_success') == 1) {
?>
<script>
window.opener.location.reload();
window.close();
</script>
<?php
die;
}
}
示例12: 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;
}
示例13: _init
/**
* @since 1.1.8
*/
static function _init()
{
self::$table_columns = apply_filters('st_order_meta_table_columns', self::$table_columns);
add_action('after_setup_theme', array(__CLASS__, '_check_is_working'));
add_action('st_traveler_do_upgrade_table', array(__CLASS__, '_upgrade_table'));
add_action('st_save_order_item_meta', array(__CLASS__, '_save_data'), 10, 3);
// Re update the Order Meta
add_action('save_post', array(__CLASS__, '_reupdate_normal_booking'), 50);
// Update Status
add_action('st_booking_change_status', array(__CLASS__, '_st_booking_change_status'), 10, 3);
add_action('woocommerce_order_status_changed', array(__CLASS__, '_woocommerce_order_status_changed'), 10, 3);
if (STInput::get('_upgrade_table') and current_user_can('manage_options')) {
self::_upgrade_table();
die;
}
}
示例14: _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;
}
示例15: search_location
function search_location()
{
//Small security
check_ajax_referer('st_search_security', 'security');
$s = STInput::get('s');
$arg = array('post_type' => 'location', 'posts_per_page' => 10, 's' => $s);
if ($s) {
}
global $wp_query;
query_posts($arg);
$r = array();
while (have_posts()) {
the_post();
$r['data'][] = array('title' => get_the_title(), 'id' => get_the_ID(), 'type' => __('Location', ST_TEXTDOMAIN));
}
wp_reset_query();
echo json_encode($r);
die;
}