本文整理汇总了PHP中session::post_var方法的典型用法代码示例。如果您正苦于以下问题:PHP session::post_var方法的具体用法?PHP session::post_var怎么用?PHP session::post_var使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::post_var方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_meta_boxes
/**
* Saves the metaboxes
* @global type $post_type
* @param type $post_id
* @return boolean
*/
public function save_meta_boxes($post_id)
{
global $post_type;
$session = new session();
if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) {
return false;
}
if ($post_type !== 'syn_rest_meal') {
return false;
}
$full_price = $session->post_var('full_price');
$small_plate_price = $session->post_var('small_plate_price');
$display_price = $session->post_var('display_price', 'off');
$calorie_count = $session->post_var('calorie_count');
$new_addition = $session->post_var('new_addition');
$healthy_option = $session->post_var('healthy_option');
$gluten_free = $session->post_var('gluten_free');
$spice_rating = $session->post_var('spice_rating');
update_post_meta($post_id, 'full_price', $full_price);
update_post_meta($post_id, 'small_plate_price', $small_plate_price);
update_post_meta($post_id, 'display_price', $display_price);
update_post_meta($post_id, 'calorie_count', $calorie_count);
update_post_meta($post_id, 'new_addition', $new_addition);
update_post_meta($post_id, 'healthy_option', $healthy_option);
update_post_meta($post_id, 'gluten_free', $gluten_free);
update_post_meta($post_id, 'spice_rating', $spice_rating);
}
示例2: save_meta_boxes
public function save_meta_boxes($post_id)
{
global $post_type, $wpdb;
$session = new session();
if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) {
return false;
}
if ($post_type !== 'syn_rest_reservation') {
return false;
}
$first_name = $session->post_var('first_name');
$last_name = $session->post_var('last_name');
$phone_number = $session->post_var('phone_number');
$email_address = $session->post_var('email_address');
$guests_count = $session->post_var('guests_count');
$reservation_date = $session->post_var('reservation_date');
$reservation_time = $session->post_var('reservation_time');
update_post_meta($post_id, 'first_name', $first_name);
update_post_meta($post_id, 'last_name', $last_name);
update_post_meta($post_id, 'phone_number', $phone_number);
update_post_meta($post_id, 'email_address', $email_address);
update_post_meta($post_id, 'guests_count', $guests_count);
update_post_meta($post_id, 'reservation_date', $reservation_date);
update_post_meta($post_id, 'reservation_time', $reservation_time);
$arrival_time = date('Y-m-d H:i:s', strtotime("{$reservation_date}, {$reservation_time}"));
update_post_meta($post_id, 'arrival_time', $arrival_time);
$title = 'Reservation: ' . $first_name . ' ' . $last_name;
$where = array('ID' => $post_id);
$wpdb->update($wpdb->posts, array('post_title' => $title), $where);
}
示例3: process_status
public function process_status($post_id)
{
global $post_type;
$session = new session();
if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) {
return false;
}
if ($post_type !== 'syn_rest_reservation') {
return false;
}
$event_log = new event_log();
$old_post_status = $session->post_var('original_post_status');
$post = get_post($post_id);
$post_status = $post->post_status;
$email_address = get_post_meta($post_id, 'email_address', true);
//check if the post status has changed
if ($post_status !== $old_post_status) {
$result = syntaxthemes_process_notification_email($post_status, $email_address, $post_id);
$event_log->status_event($post_id, $old_post_status, $post_status, $result);
}
}