本文整理汇总了PHP中gdlr_decode_preventslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP gdlr_decode_preventslashes函数的具体用法?PHP gdlr_decode_preventslashes怎么用?PHP gdlr_decode_preventslashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gdlr_decode_preventslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_page_option_elements
function create_page_option_elements()
{
global $post;
$option_value = gdlr_decode_preventslashes(get_post_meta($post->ID, $this->setting['option_name'], true));
if (!empty($option_value)) {
$option_value = json_decode($option_value, true);
}
$option_generator = new gdlr_admin_option_html();
echo '<div class="gdlr-page-option-wrapper position-' . $this->setting['position'] . '" >';
foreach ($this->option as $option_section) {
echo '<div class="gdlr-page-option">';
echo '<div class="gdlr-page-option-title">' . $option_section['title'] . '</div>';
echo '<div class="gdlr-page-option-input-wrapper">';
foreach ($option_section['options'] as $option_slug => $option) {
$option['slug'] = $option_slug;
$option['name'] = '';
if (!empty($option_value) && isset($option_value[$option_slug])) {
$option['value'] = $option_value[$option_slug];
}
$option_generator->generate_admin_option($option);
}
echo '</div>';
// page-option-input-wrapper
echo '</div>';
// page-option-title
}
echo '<textarea class="gdlr-input-hidden" name="' . $this->setting['option_name'] . '"></textarea>';
echo '</div>';
// gdlr-page-option-wrapper
}
示例2: gdlr_save_post_meta_option
function gdlr_save_post_meta_option($post_id)
{
if (get_post_type() == 'post' && isset($_POST['post-option'])) {
$post_option = gdlr_preventslashes(gdlr_stripslashes($_POST['post-option']));
$post_option = json_decode(gdlr_decode_preventslashes($post_option), true);
if (!empty($post_option['rating'])) {
update_post_meta($post_id, 'gdlr-post-rating', floatval($post_option['rating']) * 100);
} else {
delete_post_meta($post_id, 'gdlr-post-rating');
}
}
}
示例3: widget
function widget($args, $instance)
{
global $theme_option;
$title = apply_filters('widget_title', $instance['title']);
$category = $instance['category'];
$num_fetch = $instance['num_fetch'];
// Opening of widget
echo $args['before_widget'];
// Open of title tag
if (!empty($title)) {
echo $args['before_title'] . $title . $args['after_title'];
}
// Widget Content
$current_post = array(get_the_ID());
$query_args = array('post_type' => 'cause', 'suppress_filters' => false);
$query_args['posts_per_page'] = $num_fetch;
$query_args['orderby'] = 'post_date';
$query_args['order'] = 'desc';
$query_args['paged'] = 1;
$query_args['cause_category'] = $category;
$query_args['ignore_sticky_posts'] = 1;
$query_args['post__not_in'] = array(get_the_ID());
$query = new WP_Query($query_args);
if ($query->have_posts()) {
echo '<div class="gdlr-recent-post-widget">';
while ($query->have_posts()) {
$query->the_post();
echo '<div class="recent-post-widget">';
$thumbnail = gdlr_get_image(get_post_thumbnail_id(), 'thumbnail');
$cause_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true);
if (!empty($thumbnail)) {
echo '<div class="recent-post-widget-thumbnail"><a href="' . get_permalink() . '" >' . $thumbnail . '</a></div>';
}
echo '<div class="recent-post-widget-content">';
echo '<div class="recent-post-widget-title"><a href="' . get_permalink() . '" ><span class="causeWidgetLink">' . get_the_title() . '</span></a></div>';
echo gdlr_cause_donation_amount($cause_option['goal-of-donation'], $cause_option['current-funding']);
echo '<p>' . substr(get_the_excerpt(), 0, 90) . '...</p>';
echo '</div>';
echo '<div class="clear"></div>';
echo '</div>';
}
echo '<div class="clear"></div>';
echo '</div>';
}
wp_reset_postdata();
// Closing of widget
echo $args['after_widget'];
}
示例4: gdlr_set_global_variable
function gdlr_set_global_variable()
{
global $post;
if (is_page()) {
global $above_sidebar_content, $with_sidebar_content, $below_sidebar_content, $gdlr_post_option;
$above_sidebar_content = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'above-sidebar', true)), true);
$above_sidebar_content = empty($above_sidebar_content) ? array() : $above_sidebar_content;
$with_sidebar_content = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'content-with-sidebar', true)), true);
$with_sidebar_content = empty($with_sidebar_content) ? array() : $with_sidebar_content;
$below_sidebar_content = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'below-sidebar', true)), true);
$below_sidebar_content = empty($below_sidebar_content) ? array() : $below_sidebar_content;
$gdlr_post_option = gdlr_decode_preventslashes(get_post_meta($post->ID, 'post-option', true));
} else {
if (is_single() || !empty($post) && $post->post_type == 'portfolio') {
global $gdlr_post_option;
$gdlr_post_option = gdlr_decode_preventslashes(get_post_meta($post->ID, 'post-option', true));
}
}
}
示例5: gdlr_get_coupon_discount
function gdlr_get_coupon_discount($data, $coupon = '')
{
if (empty($coupon)) {
return 0;
}
$posts = get_posts(array('post_type' => 'coupon', 'posts_per_page' => 1, 'meta_key' => 'gdlr-coupon-code', 'meta_value' => $coupon));
$post_option = json_decode(gdlr_decode_preventslashes(get_post_meta($posts[0]->ID, 'post-option', true)), true);
// expire date
if (!empty($post_option['coupon-expiry']) && strtotime(date("Y-m-d")) > strtotime($post_option['coupon-expiry'])) {
return 0;
}
// available num
$coupon_num = get_post_meta($posts[0]->ID, 'gdlr-coupon-num', true);
$coupon_num = empty($coupon_num) ? 0 : intval($coupon_num);
if ($post_option['coupon-amount'] != -1 && $coupon_num >= $post_option['coupon-amount']) {
return 0;
}
update_post_meta($posts[0]->ID, 'gdlr-coupon-num', $coupon_num + 1);
// specify room
if (!empty($post_option['specify-room'])) {
$room_specify = explode(',', $post_option['specify-room']);
foreach ($data['gdlr-room-id'] as $key => $room_id) {
if (!in_array($room_id, $room_specify)) {
unset($data['gdlr-room-id'][$key]);
}
}
}
if (empty($data['gdlr-room-id'])) {
return 0;
}
// number of
if ($post_option['coupon-discount-type'] == 'amount') {
return $post_option['coupon-discount-amount'];
} else {
// percent
$total_price = 0;
for ($i = 0; $i < sizeOf($data['gdlr-room-id']); $i++) {
$room_option = json_decode(gdlr_decode_preventslashes(get_post_meta($data['gdlr-room-id'][$i], 'post-option', true)), true);
$room_option['data'] = array('check-in' => $data['gdlr-check-in'], 'check-out' => $data['gdlr-check-out']);
$price = gdlrs_get_booking_price($room_option);
$total_price += $price['total'];
}
return $total_price * floatval($post_option['coupon-discount-amount']) / 100;
}
}
示例6: gdlr_get_booking_room
function gdlr_get_booking_room($query, $data)
{
global $hotel_option;
global $gdlr_excerpt_length, $gdlr_excerpt_read_more;
$gdlr_excerpt_read_more = false;
$gdlr_excerpt_length = $hotel_option['booking-num-excerpt'];
add_filter('excerpt_length', 'gdlr_set_excerpt_length');
$ret = '<div class="gdlr-booking-room-wrapper" >';
while ($query->have_posts()) {
$query->the_post();
$post_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true);
$post_option['data'] = $data;
$ret .= '<div class="gdlr-item gdlr-room-item gdlr-medium-room">';
$ret .= '<div class="gdlr-ux gdlr-medium-room-ux">';
$ret .= '<div class="gdlr-room-thumbnail">' . gdlr_get_room_thumbnail($post_option, $hotel_option['booking-thumbnail-size']) . '</div>';
$ret .= '<div class="gdlr-room-content-wrapper">';
$ret .= '<h3 class="gdlr-room-title"><a href="' . get_permalink() . '" >' . get_the_title() . '</a></h3>';
if (!empty($hotel_option['enable-hotel-branch']) && $hotel_option['enable-hotel-branch'] == 'enable') {
$terms = get_the_terms(get_the_ID(), 'room_category');
$ret .= '<div class="gdlr-room-hotel-branches">';
foreach ($terms as $term) {
$ret .= '<span class="gdlr-separator">,</span>' . $term->name;
}
$ret .= '</div>';
}
$ret .= gdlr_hotel_room_info($post_option, array('bed', 'max-people', 'view'));
$ret .= '<div class="gdlr-room-content">' . get_the_excerpt() . '</div>';
$ret .= '<a class="gdlr-room-selection gdlr-button with-border" href="#" ';
$ret .= 'data-roomid="' . get_the_ID() . '" >' . __('Select this room', 'gdlr-hotel') . '</a>';
$ret .= gdlr_hotel_room_info($post_option, array('price-break-down'), false);
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
// gdlr-ux
$ret .= '</div>';
// gdlr-item
}
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
wp_reset_postdata();
$gdlr_excerpt_read_more = true;
remove_filter('excerpt_length', 'gdlr_set_excerpt_length');
return $ret;
}
示例7: gdlr_get_post_slider_item
function gdlr_get_post_slider_item($settings)
{
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $gdlr_spaces;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
$slide_order = array();
$slide_data = array();
// query posts section
$settings['post-type'] = empty($settings['post-type']) ? 'post' : $settings['post-type'];
$args = array('post_type' => $settings['post-type'], 'suppress_filters' => false);
$args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch'];
$args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby'];
$args['order'] = empty($settings['order']) ? 'desc' : $settings['order'];
if ($settings['post-type'] == 'cause' && $settings['cause-category']) {
$args['tax_query'] = array(array('terms' => explode(',', $settings['cause-category']), 'taxonomy' => 'cause_category', 'field' => 'slug'));
} else {
if ($settings['post-type'] == 'post') {
$args['tax_query'] = array(array('terms' => explode(',', $settings['category']), 'taxonomy' => 'category', 'field' => 'slug'));
}
}
$args['ignore_sticky_posts'] = 1;
$query = new WP_Query($args);
// set the excerpt length
global $theme_option, $gdlr_excerpt_length, $gdlr_excerpt_read_more;
$gdlr_excerpt_length = $settings['num-excerpt'];
add_filter('excerpt_length', 'gdlr_set_excerpt_length');
global $post;
while ($query->have_posts()) {
$query->the_post();
$image_id = get_post_thumbnail_id();
if (!empty($image_id)) {
$slide_order[] = $image_id;
$slide_data[$image_id] = array('title' => get_the_title(), 'slide-link' => 'url', 'url' => get_permalink(), 'new-tab' => 'disable', 'caption-position' => $settings['caption-style']);
$slide_data[$image_id]['caption'] = '<div class="post-slider-caption-overlay"></div>';
if ($settings['post-type'] == 'post') {
$slide_data[$image_id]['caption'] .= '<div class="blog-info blog-date"><i class="icon-time"></i>';
$slide_data[$image_id]['caption'] .= get_the_time($theme_option['date-format']);
$slide_data[$image_id]['caption'] .= '</div>';
$slide_data[$image_id]['caption'] .= '<div class="blog-info blog-comment"><i class="icon-comment"></i>';
$slide_data[$image_id]['caption'] .= get_comments_number();
$slide_data[$image_id]['caption'] .= '</div>';
$slide_data[$image_id]['caption'] .= '<div class="clear"></div>';
}
$slide_data[$image_id]['caption'] .= get_the_excerpt();
if ($settings['post-type'] == 'cause' && function_exists('gdlr_cause_donation_button')) {
$cause_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true);
$slide_data[$image_id]['caption'] .= gdlr_cause_donation_button($cause_option);
}
}
}
remove_filter('excerpt_length', 'gdlr_set_excerpt_length');
$feature_text = '';
if ($settings['caption-style'] != 'post-bottom post-slider') {
if ($settings['post-type'] == 'cause') {
$feature_text = __('Featured Causes', 'gdlr_translate');
} else {
$feature_text = __('Featured Posts', 'gdlr_translate');
}
}
$ret = '<div class="gdlr-item gdlr-post-slider-item style-' . $settings['caption-style'] . '" ' . $item_id . $margin_style . ' >';
$ret .= gdlr_get_slider(array($slide_order, $slide_data), $settings['thumbnail-size'], 'flexslider', $feature_text);
$ret .= '</div>';
return $ret;
}
示例8: gdlr_get_booking_services
function gdlr_get_booking_services($branches, $selected_service)
{
global $hotel_option, $wpdb;
// get every available services
$services = array();
if (!empty($branches)) {
$sql = "SELECT DISTINCT wpostmeta.post_id FROM {$wpdb->postmeta} wpostmeta ";
$sql .= "WHERE wpostmeta.meta_key = 'gdlr-branches' AND wpostmeta.meta_value LIKE '%\"{$branches}\"%' ";
$sql .= "ORDER BY post_id DESC";
$service_query = $wpdb->get_results($sql, OBJECT);
if (empty($service_query)) {
return;
} else {
foreach ($service_query as $service) {
$services[] = $service->post_id;
}
}
} else {
$args = array('post_type' => 'service', 'posts_per_page' => 99);
$query = new WP_Query($args);
foreach ($query->posts as $post) {
$services[] = $post->ID;
}
}
if (empty($services)) {
return;
}
ob_start();
?>
<div class="gdlr-room-selection-divider"></div>
<div class="gdlr-booking-service-wrapper">
<span class="gdlr-booking-service-head" ><?php
_e('Please select your preferred additional services. (optional)', 'gdlr-hotel');
?>
</span>
<form class="gdlr-booking-service-form" method="post" data-ajax="<?php
echo AJAX_URL;
?>
" >
<?php
$words = array('night' => __('Night', 'gdlr-hotel'), 'trip' => __('Trip', 'gdlr-hotel'), 'car' => __('Car', 'gdlr-hotel'), 'group' => __('Group', 'gdlr-hotel'), 'guest' => __('Guest', 'gdlr-hotel'), 'room' => __('Room', 'gdlr-hotel'));
foreach ($services as $service) {
$active = in_array($service, $selected_service);
$option = json_decode(gdlr_decode_preventslashes(get_post_meta($service, 'post-option', true)), true);
echo '<div class="gdlr-room-service-option">';
echo '<label class="gdlr-room-service-checkbox ' . ($active ? 'gdlr-active' : '') . '">';
echo '<input type="checkbox" name="service-select[]" value="' . $service . '" ' . ($active ? 'checked' : '') . ' />';
echo '</label>';
echo '<span class="gdlr-room-service-title">' . get_the_title($service) . '</span>';
if ($option['service-type'] == 'parking-service' && $option['car'] == 'car') {
echo '<input type="text" name="service-amount[]" value="1" ' . ($active ? '' : 'disabled') . ' />';
echo '<span class="gdlr-room-service-title">' . __('cars', 'gdlr-hotel') . '</span>';
} else {
echo '<input type="hidden" name="service-amount[]" value="1" ' . ($active ? '' : 'disabled') . ' />';
}
echo '<span class="gdlr-room-service-unit">';
echo gdlr_hotel_money_format($option['price']);
echo '<span class="sep">/</span>';
if ($option['service-type'] == 'regular-service') {
echo $words[$option['per']];
} else {
if ($option['service-type'] == 'parking-service') {
echo $words[$option['car']];
}
}
echo '<span class="sep">/</span>';
echo $words[$option['unit']];
echo '</span>';
echo '</div>';
}
?>
</form>
</div>
<?php
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}
示例9: gdlr_get_modern_carousel_portfolio
function gdlr_get_modern_carousel_portfolio($query, $size, $thumbnail_size)
{
global $post;
$ret = '<div class="gdlr-portfolio-carousel-item gdlr-item" >';
$ret .= '<div class="gdlr-ux gdlr-modern-portfolio-ux">';
$ret .= '<div class="flexslider" data-type="carousel" data-nav-container="portfolio-item-wrapper" data-columns="' . $size . '" >';
$ret .= '<ul class="slides" >';
while ($query->have_posts()) {
$query->the_post();
$ret .= '<li class="gdlr-item gdlr-portfolio-item gdlr-modern-portfolio">';
$port_option = json_decode(gdlr_decode_preventslashes(get_post_meta($post->ID, 'post-option', true)), true);
$ret .= '<div class="portfolio-thumbnail ' . gdlr_get_portfolio_thumbnail_class($port_option) . '">';
$ret .= gdlr_get_portfolio_thumbnail($port_option, $thumbnail_size, true);
$ret .= '</div>';
// portfolio-thumbnail
$ret .= '</li>';
}
$ret .= '</ul>';
$ret .= '</div>';
// flexslider
$ret .= '</div>';
// gdlr-ux
$ret .= '</div>';
// gdlr-item
return $ret;
}
示例10: gdlrs_get_summary_form
function gdlrs_get_summary_form($data, $with_form = true, $coupon = '')
{
global $hostel_option;
$total_price = 0;
$ret = '<div class="gdlr-price-summary-wrapper" >';
// display branches if exists
if (!empty($data['gdlr-hotel-branches'])) {
$term = get_term_by('id', $data['gdlr-hotel-branches'], 'hostel_room_category');
$ret .= '<div class="gdlr-price-summary-hotel-branches gdlr-title-font">';
$ret .= $term->name;
$ret .= '</div>';
} else {
$ret .= '<div class="gdlr-price-summary-head">' . __('Price Breakdown', 'gdlr-hotel') . '</div>';
}
// group the customer by room
$customer_rooms = array();
for ($i = 0; $i < intval($data['gdlr-room-number']); $i++) {
$customer_rooms[$data['gdlr-room-id'][$i]] = empty($customer_rooms[$data['gdlr-room-id'][$i]]) ? 1 : $customer_rooms[$data['gdlr-room-id'][$i]] + 1;
}
foreach ($customer_rooms as $room_id => $guest_num) {
$post_option = json_decode(gdlr_decode_preventslashes(get_post_meta($room_id, 'post-option', true)), true);
$post_option['data'] = array('check-in' => $data['gdlr-check-in'], 'check-out' => $data['gdlr-check-out']);
$price = gdlrs_get_booking_price($post_option);
if (empty($post_option['room-type']) || $post_option['room-type'] == 'dorm') {
$price['total'] = $price['total'] * $guest_num;
}
$ret .= '<div class="gdlr-price-room-summary">';
$ret .= '<div class="gdlr-price-room-summary-title">';
$ret .= __('Room', 'gdlr-hotel') . ' : ' . get_the_title($room_id);
$ret .= '<span class="gdlr-price-room-summary-price" href="#" >' . gdlr_hostel_money_format($price['total']) . '</span>';
$ret .= '</div>';
$ret .= '<div class="gdlr-price-room-summary-info gdlr-title-font" >';
$ret .= '<span>' . __('Guest', 'gdlr-hotel') . ' : ' . $guest_num . '</span>';
$ret .= '</div>';
$ret .= '</div>';
$total_price += $price['total'];
}
// service
if (!empty($data['service'])) {
$services_price = gdlrs_calculate_service_price($data);
$ret .= '<div class="gdlr-service-price-summary">';
$ret .= '<div class="gdlr-service-price-summary-head" >' . __('Additional Services', 'gdlr-hotel') . '</div>';
foreach ($services_price as $key => $service_price) {
if ($key == 'total') {
continue;
}
$ret .= '<div class="gdlr-service-price-summary-item">';
$ret .= '<span class="gdlr-head">' . $service_price['title'] . '</span>';
$ret .= '<span class="gdlr-tail">' . gdlr_hostel_money_format($service_price['price']) . '</span>';
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
}
$ret .= '</div>';
$total_price += $services_price['total'];
}
// vat
if (!empty($hostel_option['booking-vat-amount'])) {
$ret .= '<div class="gdlr-price-summary-vat" >';
$ret .= '<div class="gdlr-price-summary-vat-total" >';
$ret .= '<span class="gdlr-head">' . __('Total', 'gdlr-hotel') . '</span>';
$ret .= '<span class="gdlr-tail">' . gdlr_hostel_money_format($total_price) . '</span>';
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
// vat-total
if (!empty($coupon)) {
$discount = gdlr_get_coupon_discount($data, $coupon);
$total_price -= $discount;
$ret .= '<div class="gdlr-price-summary-vat-discount" >';
$ret .= '<span class="gdlr-head">' . __('Coupon Discount', 'gdlr-hotel') . '</span>';
$ret .= '<span class="gdlr-tail">' . gdlr_hostel_money_format($discount) . '</span>';
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
}
$vat_amount = $total_price * floatval($hostel_option['booking-vat-amount']) / 100;
$total_price += $vat_amount;
$ret .= '<div class="gdlr-price-summary-vat-amount" >';
$ret .= '<span class="gdlr-head">' . __('Vat', 'gdlr-hotel') . ' ' . $hostel_option['booking-vat-amount'] . '%</span>';
$ret .= '<span class="gdlr-tail">' . gdlr_hostel_money_format($vat_amount) . '</span>';
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
// vat-amount
$ret .= '</div>';
}
// deposit
if ($with_form && !empty($hostel_option['booking-deposit-amount'])) {
// grand total
$ret .= '<div class="gdlr-price-summary-grand-total gdlr-active" >';
$ret .= '<span class="gdlr-head">' . __('Grand Total', 'gdlr-hotel') . '</span>';
$ret .= '<span class="gdlr-tail">' . gdlr_hostel_money_format($total_price) . '</span>';
$ret .= '</div>';
$deposit_text = $hostel_option['booking-deposit-amount'] . '% ' . __('Deposit', 'gdlr-hotel');
$deposit_amount = $total_price * floatval($hostel_option['booking-deposit-amount']) / 100;
$ret .= '<div class="gdlr-price-deposit-wrapper">';
$ret .= '<div class="gdlr-price-deposit-input" >';
$ret .= '<span class="gdlr-active" ><label class="gdlr-radio-input"><input type="radio" name="pay_deposit" value="false" checked ></label>' . __('Pay Full Amount', 'gdlr-hotel') . '</span>';
$ret .= '<span><label class="gdlr-radio-input"><input type="radio" name="pay_deposit" value="true" ></label>' . __('Pay', 'gdlr-hotel') . ' ' . $deposit_text . '</span>';
$ret .= '</div>';
$ret .= '<div class="gdlr-price-deposit-inner-wrapper">';
$ret .= '<div class="gdlr-price-deposit-title">' . $deposit_text . '</div>';
$ret .= '<div class="gdlr-price-deposit-caption">' . __('*Pay the rest on arrival', 'gdlr-hotel') . '</div>';
//.........这里部分代码省略.........
示例11: gdlr_save_paypal_form
function gdlr_save_paypal_form()
{
$ret = array();
if (false && !check_ajax_referer('gdlr-paypal-create-nonce', 'security', false)) {
$ret['status'] = 'failed';
$ret['message'] = __('The page has been expired. Please refresh the page to try this again.', 'gdlr_translate');
} else {
$record = get_option('gdlr_paypal', array());
$item_id = sizeof($record);
$post_val = gdlr_decode_preventslashes(get_post_meta($_POST['ticket_id'], 'post-option', true));
$post_options = empty($post_val) ? array() : json_decode($post_val, true);
$record[$item_id]['name'] = $_POST['gdlr-name'];
$record[$item_id]['last-name'] = $_POST['gdlr-last-name'];
$record[$item_id]['email'] = $_POST['gdlr-email'];
$record[$item_id]['phone'] = $_POST['gdlr-phone'];
$record[$item_id]['address'] = $_POST['gdlr-address'];
$record[$item_id]['addition'] = $_POST['gdlr-additional-note'];
$record[$item_id]['post-id'] = $_POST['ticket_id'];
$record[$item_id]['amount'] = $post_options['price'];
$ret['status'] = 'success';
$ret['message'] = __('Redirecting to paypal', 'gdlr_translate');
$ret['amount'] = $post_options['price'];
$ret['invoice'] = $item_id;
update_option('gdlr_paypal', $record);
}
die(json_encode($ret));
}
示例12: gdlr_print_urgent_cause
function gdlr_print_urgent_cause($settings)
{
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $post, $gdlr_spaces, $gdlr_excerpt_read_more;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin .= !empty($settings['min-height']) ? ' min-height: ' . $settings['min-height'] . 'px; ' : '';
// excerpt number
if (!empty($settings['num-excerpt'])) {
global $gdlr_excerpt_length;
$gdlr_excerpt_length = $settings['num-excerpt'];
add_filter('excerpt_length', 'gdlr_set_excerpt_length');
}
$posts = get_posts(array('name' => $settings['cause'], 'post_type' => 'cause', 'posts_per_page' => 1));
foreach ($posts as $post) {
setup_postdata($post);
$cause_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true);
$image_id = get_post_thumbnail_id();
if (!empty($image_id)) {
$image_src = wp_get_attachment_image_src($image_id, 'full');
$margin .= ' background: url(' . $image_src[0] . ') center 0px; ';
}
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
$ret = '<div class="urgent-cause-wrapper gdlr-item" ' . $item_id . $margin_style . '>';
$ret .= '<div class="urgent-cause-overlay" ></div>';
$ret .= '<div class="urgent-cause-inner" >';
$ret .= '<div class="urgent-cause-caption">' . $settings['title'] . '</div>';
$ret .= '<h3 class="urgent-cause-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
$ret .= '<div class="urgent-cause-content">' . get_the_excerpt() . '</div>';
$ret .= '<div class="urgent-cause-info">';
$ret .= gdlr_cause_donation_button($cause_option);
$ret .= gdlr_cause_donation_amount($cause_option['goal-of-donation'], $cause_option['current-funding']);
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
// urgent-cause-info
$ret .= '</div>';
// urgent-cause-inner
$ret .= '</div>';
}
remove_filter('excerpt_length', 'gdlr_set_excerpt_length');
wp_reset_postdata();
return $ret;
}
示例13: gdlr_print_small_session
function gdlr_print_small_session($query)
{
global $theme_option;
if (!empty($theme_option['new-fontawesome']) && $theme_option['new-fontawesome'] == 'enable') {
$icon_class = array('time' => 'fa-clock-o');
} else {
$icon_class = array('time' => 'icon-time');
}
echo '<div class="gdlr-session-item gdlr-small-session-item gdlr-item" >';
echo '<div class="gdlr-session-item-head" >';
$current_session_day = 0;
$current_session_date = '';
while ($query->have_posts()) {
$query->the_post();
$session_date_o = strtotime(get_post_meta(get_the_ID(), 'session-date', true));
$session_date = date_i18n($theme_option['date-format'], $session_date_o);
if ($current_session_date != $session_date) {
$current_session_day++;
$current_session_date = $session_date;
echo '<div class="gdlr-session-item-head-info ' . ($current_session_day == 1 ? 'gdlr-active' : '') . '" data-tab="gdlr-tab-' . $current_session_day . '">';
echo '<div class="gdlr-session-head-day">' . sprintf(__('Day %d', 'gdlr-conference'), $current_session_day) . '</div>';
echo '<div class="gdlr-session-head-date">' . $current_session_date . '</div>';
echo '</div>';
}
}
echo '<div class="clear"></div>';
echo '</div>';
// session-item-head
rewind_posts();
$current_session_day = 0;
$current_session_date = '';
while ($query->have_posts()) {
$query->the_post();
$gdlr_post_option = gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true));
$gdlr_post_option = json_decode($gdlr_post_option, true);
$gdlr_speakers = gdlr_get_session_speaker_list($gdlr_post_option['session-speaker']);
$session_date_o = strtotime(get_post_meta(get_the_ID(), 'session-date', true));
$session_date = date_i18n($theme_option['date-format'], $session_date_o);
if ($current_session_date != $session_date) {
$current_session_day++;
$current_session_date = $session_date;
echo $current_session_day == 1 ? '' : '</div>';
// gdlr-session-item-tab-content
echo '<div class="gdlr-session-item-tab-content gdlr-tab-' . $current_session_day . ' ' . ($current_session_day == 1 ? 'gdlr-active' : '') . '">';
}
echo '<div class="gdlr-session-item-content-wrapper">';
echo '<div class="gdlr-session-item-divider"></div>';
if (!empty($gdlr_post_option['session-type']) && $gdlr_post_option['session-type'] == 'break') {
echo '<div class="session-break-content">';
echo '<div class="session-break-info">';
echo '<i class="fa ' . $icon_class['time'] . '" ></i>';
echo $gdlr_post_option['session-time'];
echo '</div>';
echo '<h3 class="gdlr-session-break-title">' . get_the_title() . '</h3>';
echo '</div>';
} else {
echo '<div class="gdlr-session-item-content" >';
if (!empty($gdlr_speakers)) {
echo '<div class="gdlr-session-thumbnail-wrapper">';
echo gdlr_get_speaker_thumbnail('thumbnail', $gdlr_speakers[0]->ID, array(), true, true);
echo '</div>';
}
echo '<div class="gdlr-session-item-content-inner" >';
echo '<h3 class="gdlr-session-item-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
echo '<div class="gdlr-session-item-content-info">';
echo gdlr_get_session_info(array('time', 'location', 'speaker'), $gdlr_post_option, $gdlr_speakers);
echo '</div>';
// session-item-content-info
echo '</div>';
// session-item-content-inner
echo '</div>';
// session-item-content
}
echo '<div class="clear"></div>';
echo '</div>';
// session-item-content-wrapper
}
echo '</div>';
// gdlr-session-item-tab-content
echo '</div>';
// gdlr-tab-session-item
wp_reset_postdata();
}
示例14: gdlr_save_cause_meta_option
function gdlr_save_cause_meta_option($post_id)
{
if (get_post_type() == 'cause' && isset($_POST['post-option'])) {
$post_option = gdlr_preventslashes(gdlr_stripslashes($_POST['post-option']));
$event_option = json_decode(gdlr_decode_preventslashes($post_option), true);
if (!empty($event_option['current-funding'])) {
update_post_meta($post_id, 'gdlr-current-funding', $event_option['current-funding']);
}
if (!empty($event_option['goal-of-donation'])) {
$goal = floatval($event_option['goal-of-donation']);
$current = floatval($event_option['current-funding']);
$percent = intval($current / $goal * 100);
update_post_meta($post_id, 'gdlr-donation-percent', $percent);
}
}
}
示例15: print_page_builder_content
function print_page_builder_content()
{
global $post;
$page_builder_html = new gdlr_page_builder_html($this->merge_page_builder_items());
// head section
echo '<div class="page-builder-head-wrapper">';
echo '<h4 class="page-builder-head page-builder">' . __('Page Builder Section', 'gdlr_translate') . '</h4>';
echo '<div class="command-button-wrapper">';
echo '<input class="undo-button" type="button" value="' . __('Undo', 'gdlr_translate') . '" />';
echo '<input class="redo-button" type="button" value="' . __('Redo', 'gdlr_translate') . '" />';
echo '</div>';
echo '</div>';
// page-builder-head-wrapper
echo '<div class="page-builder-content">';
foreach ($this->setting['section'] as $section_slug => $section) {
$value = gdlr_decode_preventslashes(get_post_meta($post->ID, $section_slug, true));
$array_value = json_decode($value, true);
echo '<div class="content-section-wrapper ' . $section['class'] . '">';
echo '<div class="content-section-head-wrapper active">';
echo '<h6 class="content-section-head">' . $section['title'] . '</h6>';
echo '</div>';
echo '<div class="gdlr-sortable-wrapper" data-type="' . $section['class'] . '" >';
echo '<div class="page-builder-item-area gdlr-sortable clear-fix row ';
echo !empty($array_value) ? '' : 'blank';
echo '" >';
$page_builder_html->print_page_builder($array_value);
echo '</div>';
echo '</div>';
// gdlr-sortable-wrapper
echo '<textarea class="gdlr-input-hidden" name="' . $section_slug . '" >' . esc_textarea($value) . '</textarea>';
echo '</div>';
// content-section-wrapper
echo '<div class="clear"></div>';
}
echo '</div>';
// page-builder-content
}