本文整理汇总了PHP中STInput::post方法的典型用法代码示例。如果您正苦于以下问题:PHP STInput::post方法的具体用法?PHP STInput::post怎么用?PHP STInput::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STInput
的用法示例。
在下文中一共展示了STInput::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: like_review
function like_review()
{
$comment_id = STInput::post('comment_ID');
if ($this->find_by($comment_id)) {
$comment_like_count = get_comment_meta($comment_id, "_comment_like_count", true);
// comment like count
$data = array('like_status' => true, 'message' => __('You like this', ST_TEXTDOMAIN), 'like_count' => $comment_like_count);
//For logged user
if (is_user_logged_in()) {
$user_id = get_current_user_id();
// current user
$meta_COMMENTS = get_user_option("_liked_comments", $user_id);
// comments ids from user meta
$meta_USERS = get_comment_meta($comment_id, "_user_liked");
// user ids from comment meta
$liked_COMMENTS = NULL;
// setup array variable
$liked_USERS = NULL;
// setup array variable
if (count($meta_COMMENTS) != 0) {
// meta exists, set up values
$liked_COMMENTS = $meta_COMMENTS;
}
if (!is_array($liked_COMMENTS)) {
// make array just in case
$liked_COMMENTS = array();
}
if (count($meta_USERS) != 0) {
// meta exists, set up values
$liked_USERS = $meta_USERS[0];
}
if (!is_array($liked_USERS)) {
// make array just in case
$liked_USERS = array();
}
$liked_COMMENTS['comment-' . $comment_id] = $comment_id;
// Add comment id to user meta array
$liked_USERS['user-' . $user_id] = $user_id;
// add user id to comment meta array
$user_likes = count($liked_COMMENTS);
// count user likes
if (!$this->check_like($comment_id)) {
// like the comment
update_comment_meta($comment_id, "_user_liked", $liked_USERS);
// Add user ID to comment meta
update_comment_meta($comment_id, "_comment_like_count", ++$comment_like_count);
// +1 count comment meta
update_user_option($user_id, "_liked_comments", $liked_COMMENTS);
// Add comment ID to user meta
update_user_option($user_id, "_user_like_count", $user_likes);
// +1 count user meta
$data['like_count'] = $comment_like_count;
} else {
// unlike the comment
$pid_key = array_search($comment_id, $liked_COMMENTS);
// find the key
$uid_key = array_search($user_id, $liked_USERS);
// find the key
unset($liked_COMMENTS[$pid_key]);
// remove from array
unset($liked_USERS[$uid_key]);
// remove from array
$user_likes = count($liked_COMMENTS);
// recount user likes
update_comment_meta($comment_id, "_user_liked", $liked_USERS);
// Remove user ID from comment meta
update_comment_meta($comment_id, "_comment_like_count", --$comment_like_count);
// -1 count comment meta
update_user_option($user_id, "_liked_comments", $liked_COMMENTS);
// Remove comment ID from user meta
update_user_option($user_id, "_user_like_count", $user_likes);
// -1 count user meta
$data['like_status'] = false;
$data['like_count'] = $comment_like_count;
$data['message'] = false;
}
} else {
// user is not logged in (anonymous)
$ip = STInput::ip_address();
// user IP address
$meta_IPS = get_comment_meta($comment_id, "_user_IP");
// stored IP addresses
$liked_IPS = NULL;
// set up array variable
if (count($meta_IPS) != 0) {
// meta exists, set up values
$liked_IPS = $meta_IPS[0];
}
if (!is_array($liked_IPS)) {
// make array just in case
$liked_IPS = array();
}
if (!in_array($ip, $liked_IPS)) {
// if IP not in array
$liked_IPS['ip-' . $ip] = $ip;
}
// add IP to array
if (!$this->check_like($comment_id)) {
// like the comment
update_comment_meta($comment_id, "_user_IP", $liked_IPS);
//.........这里部分代码省略.........
示例3: _save_booking
function _save_booking($order_id)
{
if (!check_admin_referer('shb_action', 'shb_field')) {
die('shb_action');
}
//Update Order
$orderitem = array('item_number', 'item_id', 'item_price', 'check_in', 'check_out');
$data = wp_parse_args($_POST, $orderitem);
foreach ($orderitem as $val) {
if ($val == 'check_in' or $val == 'check_out') {
update_post_meta($order_id, $val, date('Y-m-d', strtotime($data[$val])));
} else {
update_post_meta($order_id, $val, $data[$val]);
}
}
//Update User
$order_parent = $order_id;
$id_user = isset($_POST['id_user']) ? $_POST['id_user'] : false;
if ($order_parent and $id_user) {
update_post_meta($order_parent, 'id_user', $id_user);
}
$check_out_field = STCart::get_checkout_fields();
if (!empty($check_out_field)) {
foreach ($check_out_field as $field_name => $field_desc) {
update_post_meta($order_id, $field_name, STInput::post($field_name));
}
}
$user_fields = array('status' => '', 'st_tax' => '');
$data = wp_parse_args($_POST, $user_fields);
if ($order_parent) {
foreach ($user_fields as $val => $value) {
update_post_meta($order_parent, $val, $data[$val]);
}
}
STAdmin::set_message('Update Success', 'updated');
}
示例4: _save_review_stats
/**
* @since 1.1.9
* @param $comment_id
*/
function _save_review_stats($comment_id)
{
$comemntObj = get_comment($comment_id);
$post_id = $comemntObj->comment_post_ID;
if (get_post_type($post_id) == 'st_holidays') {
$all_stats = $this->get_review_stats();
$st_review_stats = STInput::post('st_review_stats');
if (!empty($all_stats) and is_array($all_stats)) {
$total_point = 0;
foreach ($all_stats as $key => $value) {
if (isset($st_review_stats[$value['title']])) {
$total_point += $st_review_stats[$value['title']];
//Now Update the Each Stat Value
update_comment_meta($comment_id, 'st_stat_' . sanitize_title($value['title']), $st_review_stats[$value['title']]);
}
}
$avg = round($total_point / count($all_stats), 1);
//Update comment rate with avg point
$rate = wp_filter_nohtml_kses($avg);
if ($rate > 5) {
//Max rate is 5
$rate = 5;
}
update_comment_meta($comment_id, 'comment_rate', $rate);
//Now Update the Stats Value
update_comment_meta($comment_id, 'st_review_stats', $st_review_stats);
}
if (STInput::post('comment_rate')) {
update_comment_meta($comment_id, 'comment_rate', STInput::post('comment_rate'));
}
//review_stats
$avg = STReview::get_avg_rate($post_id);
update_post_meta($post_id, 'rate_review', $avg);
}
}
示例5: get_post_meta
" type="hidden">
<input type="hidden" name="item_id" value="<?php
echo get_post_meta(get_the_ID(), 'room_parent', true);
?>
">
<input type="hidden" name="room_id" value="<?php
echo get_the_ID();
?>
">
<input type="hidden" name="room_num_search" value="<?php
echo STInput::request('room_num_search') ? STInput::request('room_num_search') : 1;
?>
">
<input type="hidden" name="room_num_config" value="<?php
echo esc_attr(serialize(STInput::post('room_num_config')));
?>
">
<input type="hidden" name="adult_num" value="<?php
echo esc_attr(serialize(STInput::request('adult_num')));
?>
">
<?php
$start = STInput::request('start');
$end = STInput::request('end');
?>
<?php
if ($start and $end) {
?>
<?php
$data_price = STRoom::get_room_price(get_the_ID(), $start, $end);
示例6: _update_avg_price
/**
*
*
* @since 1.0.9
*
*/
static function _update_avg_price($post_id = false)
{
if (empty($post_id)) {
$post_id = get_the_ID();
}
$post_type = get_post_type($post_id);
if ($post_type == 'hotel_room') {
$hotel_id = get_post_meta($post_id, 'room_parent', true);
if (!empty($hotel_id)) {
$is_auto_caculate = get_post_meta($hotel_id, 'is_auto_caculate', true);
if ($is_auto_caculate != 'off') {
$query = array('post_type' => 'hotel_room', 'posts_per_page' => 100, 'meta_key' => 'room_parent', 'meta_value' => $hotel_id);
$traver = new WP_Query($query);
$price = STInput::post('price');
while ($traver->have_posts()) {
$traver->the_post();
if (get_the_ID() != STInput::post('price')) {
$price += get_post_meta(get_the_ID(), 'price', true);
}
}
wp_reset_query();
$avg_price = 0;
if ($traver->post_count) {
$avg_price = $price / $traver->post_count;
}
update_post_meta($hotel_id, 'price_avg', $avg_price);
}
}
}
}
示例7: _add_cart_check_available
function _add_cart_check_available($post_id = false, $data = array())
{
if (!$post_id or get_post_status($post_id) != 'publish') {
STTemplate::set_message(__('Rental doese not exists', ST_TEXTDOMAIN), 'danger');
return false;
}
$validator = new STValidate();
$validator->set_rules('start', __('Check in', ST_TEXTDOMAIN), 'required');
$validator->set_rules('end', __('Check out', ST_TEXTDOMAIN), 'required');
if (!$validator->run()) {
STTemplate::set_message($validator->error_string(), 'danger');
return false;
}
$check_in = date('Y-m-d H:i:s', strtotime(STInput::post('start')));
$check_out = date('Y-m-d H:i:s', strtotime(STInput::post('end')));
if (!$this->_is_slot_available($post_id, $check_in, $check_out)) {
STTemplate::set_message(__('Sorry! This rental is not available.', ST_TEXTDOMAIN), 'danger');
return false;
}
return true;
}
示例8: selected
echo 'hidden';
}
?>
" name="adult_number">
<?php
$max = 14;
for ($i = 1; $i <= $adult_max; $i++) {
echo "<option " . selected($i, $old, false) . " value='{$i}'>{$i}</option>";
}
?>
</select>
</div>
</div>
<div class="col-sm-6">
<?php
$old = STInput::post('child_number', STInput::get('child_number', 0));
?>
<div class="form-group form-group-<?php
echo esc_attr($field_size);
?>
form-group-select-plus">
<label for="field-rental-children"><?php
st_the_language('rental_children');
?>
</label>
<div class="btn-group btn-group-select-num <?php
if ($old >= 3) {
echo 'hidden';
}
?>
" data-toggle="buttons">
示例9: st_write_review
function st_write_review()
{
if (STInput::request('write_review')) {
if (!STInput::request('item_id')) {
$user_url = st()->get_option('page_my_account_dashboard');
if ($user_url) {
wp_safe_redirect(get_permalink($user_url));
} else {
wp_safe_redirect(home_url());
}
die;
//wp_safe_redirect();
} else {
if (!get_post_status(STInput::request('item_id'))) {
$user_url = st()->get_option('page_my_account_dashboard');
if ($user_url) {
wp_safe_redirect(get_permalink($user_url));
} else {
wp_safe_redirect(home_url());
}
die;
}
}
}
if (STInput::post() and STInput::post('comment_post_ID') and STInput::post('_wp_unfiltered_html_comment')) {
if (wp_verify_nonce(STInput::post('st_user_write_review'), 'st_user_settings')) {
global $current_user;
$comment_data['comment_post_ID'] = STInput::post('comment_post_ID');
$comment_data['comment_author'] = $current_user->data->user_nicename;
$comment_data['comment_author_email'] = $current_user->data->user_email;
$comment_data['comment_content'] = STInput::post('comment');
$comment_data['comment_type'] = 'st_reviews';
$comment_data['user_id'] = $current_user->ID;
if (STInput::post('item_id')) {
$comment_data['comment_post_ID'] = STInput::post('item_id');
}
if (STReview::check_reviewable(STInput::post('comment_post_ID'))) {
$comment_id = wp_new_comment($comment_data);
if ($comment_id) {
update_comment_meta($comment_id, 'comment_title', STInput::post('comment_title'));
if (STInput::post('comment_rate')) {
update_comment_meta($comment_id, 'comment_rate', STInput::post('comment_rate'));
}
}
wp_safe_redirect(get_permalink(STInput::post('comment_post_ID')));
die;
}
}
}
}
示例10: ajax_search_room
function ajax_search_room()
{
if (st_is_ajax() and STInput::post('room_search')) {
if (!wp_verify_nonce(STInput::post('room_search'), 'room_search')) {
$result = array('status' => 0, 'data' => "");
echo json_encode($result);
die;
}
$result = array('status' => 1, 'data' => "");
$hotel_id = get_the_ID();
$post = STInput::request();
$post['room_parent'] = $hotel_id;
//Check Date
$today = date('m/d/Y');
$check_in = TravelHelper::convertDateFormat($post['start']);
$check_out = TravelHelper::convertDateFormat($post['end']);
$date_diff = TravelHelper::dateDiff($check_in, $check_out);
$booking_period = intval(get_post_meta($hotel_id, 'hotel_booking_period', TRUE));
$period = TravelHelper::dateDiff($today, $check_in);
if ($booking_period && $period < $booking_period) {
$result = array('status' => 0, 'data' => st()->load_template('hotel/elements/loop-room-none'), 'message' => sprintf(__('This hotel allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period));
echo json_encode($result);
die;
}
if ($date_diff < 1) {
$result = array('status' => 0, 'data' => "", 'message' => __('Make sure your check-out date is at least 1 day after check-in.', ST_TEXTDOMAIN), 'more-data' => $date_diff);
echo json_encode($result);
die;
}
add_filter('posts_where', array($this, '_alter_search_query_ajax'));
$page = STInput::request('paged_room');
if (!$page) {
$page = get_query_var('paged_room');
}
$arg = array('post_type' => 'hotel_room', 'posts_per_page' => '10', 'paged' => $page, 'meta_query' => array(array('key' => 'room_parent', 'value' => $hotel_id, 'compare' => 'IN')));
query_posts($arg);
remove_filter('posts_where', array($this, '_alter_search_query_ajax'));
global $wp_query;
if (have_posts()) {
while (have_posts()) {
the_post();
$result['data'] .= st()->load_template('hotel/elements/loop-room-item');
}
} else {
$result['data'] .= st()->load_template('hotel/elements/loop-room-none');
}
$result['paging'] = TravelHelper::paging_room();
wp_reset_query();
echo json_encode($result);
die;
}
}
示例11: printf
echo 'checked';
}
?>
/><?php
printf(__('Create %s account ', ST_TEXTDOMAIN), get_bloginfo('title'));
?>
<small><?php
st_the_language('password_will_be_send_to_your_email');
?>
</small>
</label>
</div>
<div class="checkbox">
<label>
<input class="i-check" value="1" name="term_condition" type="checkbox" <?php
if (STInput::post('term_condition') == 1) {
echo 'checked';
}
?>
/><?php
echo st_get_language('i_have_read_and_accept_the') . '<a target="_blank" href="' . get_the_permalink(st()->get_option('page_terms_conditions')) . '"> ' . st_get_language('terms_and_conditions') . '</a>';
?>
</label>
</div>
<div class="alert form_alert hidden"></div>
<div class="payment_gateways">
<input type="hidden" name="st_payment_gateway" value="1"/>
<?php
if (!isset($post_id)) {
$post_id = false;
}
示例12: _save_booking
function _save_booking($order_id)
{
if (!check_admin_referer('shb_action', 'shb_field')) {
die;
}
//Update Order
$orderitem = array('item_number' => '', 'item_id' => '', 'item_price' => '', 'check_in' => '', 'check_in_time' => '', 'check_out' => '', 'check_out_time' => '', 'item_equipment' => '', 'pick_up' => '', 'drop_off' => '', 'driver_age' => '', 'driver_name' => '');
$data = wp_parse_args($_POST, $orderitem);
foreach ($orderitem as $val) {
if ($val == 'check_in' or $val == 'check_out') {
update_post_meta($order_id, $val, date('Y-m-d', strtotime($data[$val])));
} else {
if ($val == 'item_equipment') {
$items = $data[$val];
$list_items = array();
if (!empty($items)) {
foreach ($items as $k => $v) {
$tmp = explode("|", $v);
$list_items[$tmp[1]] = $tmp[0];
}
}
update_post_meta($order_id, $val, json_encode($list_items));
} else {
if (isset($data[$val])) {
update_post_meta($order_id, $val, $data[$val]);
}
}
}
}
//Update User
$order_parent = $order_id;
$id_user = isset($_POST['id_user']) ? $_POST['id_user'] : FALSE;
if ($order_parent and $id_user) {
update_post_meta($order_parent, 'id_user', $id_user);
}
$check_out_field = STCart::get_checkout_fields();
if (!empty($check_out_field)) {
foreach ($check_out_field as $field_name => $field_desc) {
update_post_meta($order_id, $field_name, STInput::post($field_name));
}
}
$user_fields = array('status' => '', 'st_tax' => '');
$data = wp_parse_args($_POST, $user_fields);
if ($order_parent) {
foreach ($user_fields as $val => $value) {
update_post_meta($order_parent, $val, $data[$val]);
}
}
STAdmin::set_message('Update Success', 'updated');
}
示例13: _e
?>
</p>
</div>
<?php
}
?>
<input type="hidden" name="st_action" value="apply_coupon">
<div class="form-group">
<label><?php
_e('Coupon Code', ST_TEXTDOMAIN);
?>
</label>
<input value="<?php
echo STInput::post('coupon_code');
?>
" type="text"
class="form-control" name="coupon_code">
</div>
<button class="btn btn-primary"
type="submit"><?php
_e('Apply Coupon', ST_TEXTDOMAIN);
?>
</button>
</form>
</div>
<div class="booking-item-payment-total text-right">
<?php
/*if(st()->get_option('tax_enable','off')=='on'):*/
$tax = st()->get_option('tax_value', 0);
示例14: selected
echo 'hidden';
}
?>
" name="adult">
<?php
$max = 14;
for ($i = 1; $i <= $adult_max; $i++) {
echo "<option " . selected($i, $old) . " value='{$i}'>{$i}</option>";
}
?>
</select>
</div>
</div>
<div class="col-sm-6">
<?php
$old = STInput::post('children', STInput::get('children_num', 0));
?>
<div class="form-group form-group-<?php
echo esc_attr($field_size);
?>
form-group-select-plus">
<label><?php
st_the_language('rental_children');
?>
</label>
<div class="btn-group btn-group-select-num <?php
if ($old >= 3) {
echo 'hidden';
}
?>
" data-toggle="buttons">
示例15: get_checkout_fields
static function get_checkout_fields()
{
//Logged in User Info
global $firstname, $user_email;
get_currentuserinfo();
$st_phone = false;
$first_name = false;
$last_name = false;
$st_address = false;
$st_address2 = false;
$st_city = false;
$st_province = false;
$st_zip_code = false;
$st_country = false;
if (is_user_logged_in()) {
$user_id = get_current_user_id();
$st_phone = get_user_meta($user_id, 'st_phone', true);
$first_name = get_user_meta($user_id, 'first_name', true);
$last_name = get_user_meta($user_id, 'last_name', true);
$st_address = get_user_meta($user_id, 'st_address', true);
$st_address2 = get_user_meta($user_id, 'st_address2', true);
$st_city = get_user_meta($user_id, 'st_city', true);
$st_province = get_user_meta($user_id, 'st_province', true);
$st_zip_code = get_user_meta($user_id, 'st_zip_code', true);
$st_country = get_user_meta($user_id, 'st_country', true);
}
$terms_link = '<a target="_blank" href="' . get_the_permalink(st()->get_option('page_terms_conditions')) . '">' . st_get_language('terms_and_conditions') . '</a>';
$checkout_form_fields = array('st_first_name' => array('label' => st_get_language('first_name'), 'icon' => 'fa-user', 'value' => STInput::post('st_first_name', $first_name), 'validate' => 'required|trim|strip_tags'), 'st_last_name' => array('label' => st_get_language('last_name'), 'placeholder' => st_get_language('last_name'), 'validate' => 'required|trim|strip_tags', 'icon' => 'fa-user', 'value' => STInput::post('st_last_name', $last_name)), 'st_email' => array('label' => st_get_language('Email'), 'placeholder' => st_get_language('email_domain'), 'type' => 'text', 'validate' => 'required|trim|strip_tags|valid_email', 'value' => STInput::post('st_email', $user_email), 'icon' => 'fa-envelope'), 'st_phone' => array('label' => st_get_language('Phone'), 'placeholder' => st_get_language('Your_Phone'), 'validate' => 'required|trim|strip_tags', 'icon' => 'fa-phone', 'value' => STInput::post('st_phone', $st_phone)), 'st_address' => array('label' => st_get_language('address_line_1'), 'placeholder' => st_get_language('your_address_line_1'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_address', $st_address)), 'st_address2' => array('label' => st_get_language('address_line_2'), 'placeholder' => st_get_language('your_address_line_2'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_address2', $st_address2)), 'st_city' => array('label' => st_get_language('city'), 'placeholder' => st_get_language('your_city'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_city', $st_city)), 'st_province' => array('label' => st_get_language('state_province_region'), 'placeholder' => st_get_language('state_province_region'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_province', $st_province)), 'st_zip_code' => array('label' => st_get_language('zip_postal_code'), 'placeholder' => st_get_language('zip_postal_code'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_zip_code', $st_zip_code)), 'st_country' => array('label' => st_get_language('country'), 'icon' => 'fa-globe', 'value' => STInput::post('st_country', $st_country)), 'st_note' => array('label' => st_get_language('special_requirements'), 'icon' => false, 'type' => 'textarea', 'size' => 12, 'value' => STInput::post('st_note'), 'attrs' => array('rows' => 6)));
$checkout_form_fields = apply_filters('st_booking_form_fields', $checkout_form_fields);
return $checkout_form_fields;
}