| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} // Exit if accessed directly |
| 5 |
|
| 6 |
add_action( 'wp_head', 'wdm_enqueue_front_script' ); |
| 7 |
|
| 8 |
function wdm_enqueue_front_script() { |
| 9 |
wp_enqueue_style( 'wdm_lightbox_css', plugins_url( 'lightbox/jquery.fs.boxer.css', __FILE__ ), array(), "1.0" ); |
| 10 |
wp_enqueue_script( 'wdm-lightbox-js', plugins_url( 'lightbox/jquery.fs.boxer.js', __FILE__ ), array( 'jquery' ), |
| 11 |
"1.9.0", array("in_footer" => false)); |
| 12 |
wp_enqueue_script( 'wdm-block-ui-js', plugins_url( 'js/wdm-jquery.blockUI.js', __FILE__ ), array( 'jquery' ), "2.66.0-2013.10.09", array("in_footer" => false)); |
| 13 |
wp_enqueue_script( 'wdm-custom-js', plugins_url( 'js/wdm-custom-js.js', __FILE__ ), array( 'jquery' ), "1.0", |
| 14 |
array("in_footer" => false)); |
| 15 |
} |
| 16 |
|
| 17 |
function wdm_auction_listing( $atts = array() ) { |
| 18 |
|
| 19 |
// enqueue css file for front end style |
| 20 |
$wdm_auction_listing_nonce = wp_create_nonce( 'wdm_auction_listing_nonce' ); |
| 21 |
$wdm_layout_style = get_option( 'wdm_layout_style', 'layout_style_two' ); |
| 22 |
|
| 23 |
if ( $wdm_layout_style == 'layout_style_one' ) { |
| 24 |
wp_enqueue_style( 'wdm_auction_front_end_styling', plugins_url( 'css/ua-front-end-one.css', __FILE__ ), array(), |
| 25 |
"1.0" ); |
| 26 |
} else { |
| 27 |
wp_enqueue_style( 'wdm_auction_front_end_styling', plugins_url( 'css/ua-front-end-two.css', __FILE__ ), array(), |
| 28 |
"1.0" ); |
| 29 |
} |
| 30 |
|
| 31 |
ob_start(); |
| 32 |
// check the permalink from database and append variable to the auction single pages accordingly |
| 33 |
$perma_type = get_option( 'permalink_structure' ); |
| 34 |
|
| 35 |
// get currency code |
| 36 |
$currency_code = substr( get_option( 'wdm_currency' ), -3 ); |
| 37 |
$currency_code_display = ''; |
| 38 |
preg_match( '/-([^ ]+)/', get_option( 'wdm_currency' ), $matches ); |
| 39 |
$currency_symbol = isset( $matches[1] ) ? $matches[1] : ''; |
| 40 |
|
| 41 |
if ( empty( $currency_symbol ) ) { |
| 42 |
$currency_symbol = $currency_code . ' '; |
| 43 |
} elseif ( $currency_symbol == '$' || $currency_symbol == 'kr' ) { |
| 44 |
$currency_code_display = $currency_code; |
| 45 |
} |
| 46 |
|
| 47 |
// get Login url if set |
| 48 |
$wdm_login_url = get_option( 'wdm_login_page_url' ); |
| 49 |
if ( empty( $wdm_login_url ) ) { |
| 50 |
$wdm_login_url = wp_login_url( $_SERVER['REQUEST_URI'] ); |
| 51 |
} |
| 52 |
|
| 53 |
if ( is_front_page() || is_home() ) { |
| 54 |
$set_char = '?'; |
| 55 |
} elseif ( empty( $perma_type ) ) { |
| 56 |
$set_char = '&'; |
| 57 |
} else { |
| 58 |
$set_char = '?'; |
| 59 |
} |
| 60 |
|
| 61 |
$auc_time = ''; |
| 62 |
if ( ! isset( $wdm_auction_listing_nonce ) || ! wp_verify_nonce( $wdm_auction_listing_nonce, 'wdm_auction_listing_nonce' ) ) { |
| 63 |
wp_die( esc_html__( 'Nonce verification failed', 'wdm-ultimate-auction' ) ); |
| 64 |
} |
| 65 |
if ( is_user_logged_in() && isset( $_GET['ult_auc_id'] ) && ! empty( $_GET['ult_auc_id'] ) && isset( $_GET['mt'] ) && ! empty( $_GET['mt'] ) ) { |
| 66 |
|
| 67 |
$wdm_auction = get_post( esc_attr( $_GET['ult_auc_id'] ) ); |
| 68 |
$curr_user = wp_get_current_user(); |
| 69 |
$buyer_email = $curr_user->user_email; |
| 70 |
// $winner_name = $curr_user->user_login; |
| 71 |
$ret_url = get_permalink() . $set_char . 'ult_auc_id=' . $wdm_auction->ID; |
| 72 |
|
| 73 |
$check_method = get_post_meta( esc_attr( $_GET['ult_auc_id'] ), 'wdm_payment_method', true ); |
| 74 |
|
| 75 |
esc_html_e( 'Thank you for buying this product.', 'wdm-ultimate-auction' ); |
| 76 |
echo '<br /><br />'; |
| 77 |
|
| 78 |
// $auc_post = get_post($_GET["ult_auc_id"]); |
| 79 |
// $auction_author_id = $auc_post->post_author; |
| 80 |
// $auction_author = new WP_User($auction_author_id); |
| 81 |
|
| 82 |
if ( $check_method === 'method_wire_transfer' ) { |
| 83 |
$mthd = __( 'Wire Transfer', 'wdm-ultimate-auction' ); |
| 84 |
|
| 85 |
// if(in_array('administrator', $auction_author->roles)) |
| 86 |
$det = get_option( 'wdm_wire_transfer' ); |
| 87 |
// else |
| 88 |
// $det = get_user_meta($auction_author_id, 'wdm_wire_transfer', true); |
| 89 |
} elseif ( $check_method === 'method_mailing' ) { |
| 90 |
$mthd = __( 'Cheque', 'wdm-ultimate-auction' ); |
| 91 |
|
| 92 |
// if(in_array('administrator', $auction_author->roles)) |
| 93 |
$det = get_option( 'wdm_mailing_address' ); |
| 94 |
// else |
| 95 |
// $det = get_user_meta($auction_author_id, 'wdm_mailing_address', true); |
| 96 |
} elseif ( $check_method === 'method_cash' ) { |
| 97 |
$mthd = __( 'Cash', 'wdm-ultimate-auction' ); |
| 98 |
|
| 99 |
// if(in_array('administrator', $auction_author->roles)) |
| 100 |
$det = get_option( 'wdm_cash' ); |
| 101 |
// else |
| 102 |
// $det = get_user_meta($auction_author_id, 'wdm_cash', true); |
| 103 |
} |
| 104 |
|
| 105 |
$mthd = '<strong>' . $mthd . '</strong>'; |
| 106 |
|
| 107 |
/* translators: %s is payment method */ |
| 108 |
printf( esc_html( __( 'You can make the payment by %s', 'wdm-ultimate-auction' ) ), esc_html( $mthd ) ); |
| 109 |
|
| 110 |
if ( ! empty( $det ) ) { |
| 111 |
echo '<br /><br /><strong>' . esc_html( __( 'Details' ) ) . ':</strong> <br/>' . esc_html( $det ); |
| 112 |
} |
| 113 |
|
| 114 |
echo '<br /><br /><a href="' . esc_url( get_permalink() ) . esc_html( $set_char ) . 'ult_auc_id=' . esc_attr( $_GET['ult_auc_id'] ) . '">' . esc_html( __( 'Go Back', 'wdm-ultimate-auction' ) ) . '</a>'; |
| 115 |
|
| 116 |
$buy_now_price = get_post_meta( $wdm_auction->ID, 'wdm_buy_it_now', true ); |
| 117 |
|
| 118 |
ultimate_auction_email_template( |
| 119 |
$wdm_auction->post_title, |
| 120 |
$wdm_auction->ID, |
| 121 |
$wdm_auction->post_content, |
| 122 |
$buy_now_price, |
| 123 |
$buyer_email, |
| 124 |
$ret_url |
| 125 |
); |
| 126 |
} elseif ( isset( $_GET['ult_auc_id'] ) && $_GET['ult_auc_id'] ) { |
| 127 |
|
| 128 |
// if single auction page is found do the following |
| 129 |
global $wpdb; |
| 130 |
|
| 131 |
$wpdb->hide_errors(); |
| 132 |
$wdm_auction = get_post( esc_attr( $_GET['ult_auc_id'] ) ); |
| 133 |
if ( $wdm_auction ) { |
| 134 |
|
| 135 |
$auction_author_id = $wdm_auction->post_author; |
| 136 |
$auction_author = new WP_User( $auction_author_id ); |
| 137 |
// update single auction page url on single auction page visit - if the permalink type is updated we should have appropriate url to be sent in email |
| 138 |
update_post_meta( $wdm_auction->ID, 'current_auction_permalink', get_permalink() . $set_char . 'ult_auc_id=' . $wdm_auction->ID ); |
| 139 |
|
| 140 |
// check if start price/opening bid price is set |
| 141 |
$to_bid = get_post_meta( $wdm_auction->ID, 'wdm_opening_bid', true ); |
| 142 |
|
| 143 |
// check if buy now price is set |
| 144 |
$to_buy = get_post_meta( $wdm_auction->ID, 'wdm_buy_it_now', true ); |
| 145 |
|
| 146 |
$no_bid = 0; |
| 147 |
|
| 148 |
// latest highest/current price |
| 149 |
// $wdm_price_flag=false; |
| 150 |
/*$query = "SELECT MAX(bid) FROM " . $wpdb->prefix . "wdm_bidders WHERE auction_id =" . $wdm_auction->ID;*/ |
| 151 |
|
| 152 |
$table = $wpdb->prefix . 'wdm_bidders'; |
| 153 |
$auctionid = $wdm_auction->ID; |
| 154 |
|
| 155 |
$query = $GLOBALS['wpdb']->get_var($wpdb->prepare("SELECT MAX(bid) FROM {$wpdb->prefix}wdm_bidders WHERE auction_id = %d",$auctionid)); |
| 156 |
|
| 157 |
$curr_price = $query; |
| 158 |
|
| 159 |
if ( empty( $curr_price ) ) { |
| 160 |
$curr_price = get_post_meta( $wdm_auction->ID, 'wdm_opening_bid', true ); |
| 161 |
$no_bid = 1; |
| 162 |
} |
| 163 |
|
| 164 |
// total no. of bids |
| 165 |
/*$qry = "SELECT COUNT(bid) FROM " . $wpdb->prefix . "wdm_bidders WHERE auction_id =" . $wdm_auction->ID;*/ |
| 166 |
|
| 167 |
$qry = $GLOBALS['wpdb']->get_var($wpdb->prepare("SELECT COUNT(bid) FROM {$wpdb->prefix}wdm_bidders WHERE auction_id = %d", $auctionid)); |
| 168 |
|
| 169 |
$total_bids = $qry; |
| 170 |
|
| 171 |
// buy now price |
| 172 |
$buy_now_price = get_post_meta( $wdm_auction->ID, 'wdm_buy_it_now', true ); |
| 173 |
|
| 174 |
// get currency code |
| 175 |
$currency_code = substr( get_option( 'wdm_currency' ), -3 ); |
| 176 |
|
| 177 |
$bef_auc = ''; |
| 178 |
$bef_auc = apply_filters( |
| 179 |
'wdm_ua_before_single_auction', |
| 180 |
$bef_auc, |
| 181 |
$wdm_auction->ID |
| 182 |
); |
| 183 |
echo wp_kses_post( $bef_auc ); // Use if $bef_auc contains HTML |
| 184 |
|
| 185 |
$wdm_layout_style = get_option( 'wdm_layout_style', 'layout_style_two' ); |
| 186 |
|
| 187 |
if ( $wdm_layout_style == 'layout_style_one' ) { |
| 188 |
|
| 189 |
?> |
| 190 |
|
| 191 |
<!--main forms container of single auction page--> |
| 192 |
<div class="wdm-ultimate-auction-container clearfix"> |
| 193 |
|
| 194 |
<div class="wdm-image-container clearfix"> |
| 195 |
<?php |
| 196 |
$images = ''; |
| 197 |
|
| 198 |
$mnimg = get_post_meta( $wdm_auction->ID, 'wdm-main-image', true ); |
| 199 |
$img_arr = array( 'png', 'jpg', 'jpeg', 'gif', 'bmp', 'ico' ); |
| 200 |
$vid_arr = array( 'mpg', 'mpeg', 'avi', 'mov', 'wmv', 'wma', 'mp4', '3gp', 'ogm', 'mkv', 'flv' ); |
| 201 |
|
| 202 |
$flg = 0; |
| 203 |
|
| 204 |
$images .= '<div class="auction-main-img-cont">'; |
| 205 |
|
| 206 |
for ( $c = 1; $c <= 4; $c++ ) { |
| 207 |
if ( $mnimg == 'main_image_' . $c ) { |
| 208 |
$img_show = 'display: block'; |
| 209 |
} else { |
| 210 |
$img_show = 'display: none'; |
| 211 |
} |
| 212 |
|
| 213 |
$imgURL = get_post_meta( $wdm_auction->ID, 'wdm-image-' . $c, true ); |
| 214 |
$imgMime = wdm_get_mime_type( $imgURL ); |
| 215 |
$img_ext = explode( '.', $imgURL ); |
| 216 |
$img_ext = end( $img_ext ); |
| 217 |
|
| 218 |
if ( strpos( $img_ext, '?' ) !== false ) { |
| 219 |
$img_ext = strtolower( strstr( $img_ext, '?', true ) ); |
| 220 |
} |
| 221 |
|
| 222 |
if ( empty( $imgURL ) ) { |
| 223 |
$images .= ''; |
| 224 |
} else { |
| 225 |
$flg = 1; |
| 226 |
|
| 227 |
$images .= '<a href="' . get_post_meta( $wdm_auction->ID, 'wdm-image-' . $c, true ) . '" class="auction-main-img-a auction-main-img' . $c . '" rel="gallery" style="' . $img_show . '">'; |
| 228 |
|
| 229 |
if ( ( ! is_null( $imgMime ) && strstr( $imgMime, 'image/' ) ) || in_array( $img_ext, $img_arr ) ) { |
| 230 |
$images .= '<img class="auction-main-img" src="' . get_post_meta( $wdm_auction->ID, 'wdm-image-' . $c, true ) . '" />'; |
| 231 |
|
| 232 |
} elseif ( ( ! is_null( $imgMime ) && strstr( $imgMime, 'video/' ) ) || in_array( $img_ext, $vid_arr ) ) { |
| 233 |
$images .= '<video class="auction-main-img" style="margin-bottom:0;" controls><source src="' . get_post_meta( $wdm_auction->ID, 'wdm-image-' . $c, true ) . '">Your browser does not support the video tag.</video>'; |
| 234 |
} elseif ( ( ! is_null( $imgURL ) && strstr( $imgURL, 'youtube.com' ) ) || ( ! is_null( $imgURL ) && strstr( $imgURL, 'vimeo.com' ) ) ) { |
| 235 |
$images .= '<img class="auction-main-img" src="' . plugins_url( 'img/film.png', __FILE__ ) . '" />'; |
| 236 |
} else { |
| 237 |
$images .= '<img class="auction-main-img" src="' . plugins_url( 'img/docs.png', __FILE__ ) . '" />'; |
| 238 |
} |
| 239 |
|
| 240 |
$images .= '</a>'; |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
$images .= '</div>'; |
| 245 |
|
| 246 |
if ( $flg == 0 ) { |
| 247 |
echo '<style> .wdm-image-container{display: none;} </style>'; |
| 248 |
} |
| 249 |
|
| 250 |
$images .= '<div class="auction-small-img-cont-wrap"><div class="auction-small-img-cont">'; |
| 251 |
|
| 252 |
for ( $c = 1; $c <= 4; $c++ ) { |
| 253 |
|
| 254 |
$imgURL = get_post_meta( $wdm_auction->ID, 'wdm-image-' . $c, true ); |
| 255 |
$imgMime = wdm_get_mime_type( $imgURL ); |
| 256 |
$img_ext = explode( '.', $imgURL ); |
| 257 |
$img_ext = end( $img_ext ); |
| 258 |
|
| 259 |
if ( strpos( $img_ext, '?' ) !== false ) { |
| 260 |
$img_ext = strtolower( strstr( $img_ext, '?', true ) ); |
| 261 |
} |
| 262 |
|
| 263 |
if ( empty( $imgURL ) ) { |
| 264 |
$images .= ''; |
| 265 |
} elseif ( ( ! is_null( $imgMime ) && strstr( $imgMime, 'image/' ) ) || in_array( $img_ext, $img_arr ) ) { |
| 266 |
$images .= '<img class="auction-small-img auction-small-img' . $c . '" src="' . $imgURL . '" />'; |
| 267 |
} elseif ( ( ! is_null( $imgMime ) && strstr( $imgMime, 'video/' ) ) || in_array( $img_ext, $vid_arr ) || ( ! is_null( $imgURL ) && strstr( $imgURL, 'youtube.com' ) ) || ( ! is_null( $imgURL ) && strstr( $imgURL, 'vimeo.com' ) ) ) { |
| 268 |
$images .= '<img class="auction-small-img auction-small-img' . $c . '" src="' . plugins_url( 'img/film.png', __FILE__ ) . '" />'; |
| 269 |
} else { |
| 270 |
$images .= '<img class="auction-small-img auction-small-img' . $c . '" src="' . plugins_url( 'img/docs.png', __FILE__ ) . '" />'; |
| 271 |
} |
| 272 |
} |
| 273 |
$images .= '</div>'; |
| 274 |
|
| 275 |
//echo wp_kses( $images, $allowed_html ); |
| 276 |
|
| 277 |
echo wp_kses_post( $images ); |
| 278 |
?> |
| 279 |
</div> </div><!--wdm-image-container ends here--> |
| 280 |
|
| 281 |
<div class="wdm_single_prod_desc clearfix"> |
| 282 |
|
| 283 |
<div class="wdm-single-auction-title"> |
| 284 |
<?php echo esc_html( $wdm_auction->post_title ); ?> |
| 285 |
</div> <!--wdm-single-auction-title ends here--> |
| 286 |
|
| 287 |
<?php |
| 288 |
$ext_html = ''; |
| 289 |
$ext_html = apply_filters( 'wdm_ua_text_before_bid_section', $ext_html, $wdm_auction->ID ); |
| 290 |
echo wp_kses_post( $ext_html ); // Use if $bef_auc contains HTML |
| 291 |
|
| 292 |
// get auction-status taxonomy value for the current post - live/expired |
| 293 |
$active_terms = wp_get_post_terms( $wdm_auction->ID, 'auction-status', array( 'fields' => 'names' ) ); |
| 294 |
|
| 295 |
// incremented price value |
| 296 |
|
| 297 |
if ( $no_bid == 0 ) { |
| 298 |
$wdm_inc_val = get_post_meta( $wdm_auction->ID, 'wdm_incremental_val', true ); |
| 299 |
$inc_price = (int) $curr_price + (int) $wdm_inc_val; |
| 300 |
} else { |
| 301 |
$inc_price = $curr_price; |
| 302 |
} |
| 303 |
|
| 304 |
// if the auction has reached it's time limit, expire it |
| 305 |
if ( ( current_time( 'timestamp' ) >= strtotime( get_post_meta( $wdm_auction->ID, 'wdm_listing_ends', true ) ) ) ) { |
| 306 |
if ( ! in_array( 'expired', $active_terms ) ) { |
| 307 |
$check_term = term_exists( 'expired', 'auction-status' ); |
| 308 |
wp_set_post_terms( $wdm_auction->ID, $check_term['term_id'], 'auction-status' ); |
| 309 |
} |
| 310 |
} |
| 311 |
|
| 312 |
// $now = time(); |
| 313 |
$now = current_time( 'timestamp' ); |
| 314 |
$ending_date = strtotime( get_post_meta( $wdm_auction->ID, 'wdm_listing_ends', true ) ); |
| 315 |
|
| 316 |
// display message for expired auction |
| 317 |
if ( ( current_time( 'timestamp' ) >= strtotime( get_post_meta( $wdm_auction->ID, 'wdm_listing_ends', true ) ) ) || in_array( 'expired', $active_terms ) ) { |
| 318 |
|
| 319 |
$seconds = $now - $ending_date; |
| 320 |
|
| 321 |
$rem_tm = wdm_ending_time_calculator( $seconds ); |
| 322 |
|
| 323 |
$auc_time = 'exp'; |
| 324 |
?> |
| 325 |
<div class="wdm-auction-ending-time"> |
| 326 |
<?php |
| 327 |
/* translators: %s is remaining time */ |
| 328 |
printf( esc_html( __( 'Ended at', 'wdm-ultimate-auction' ) ) . ': ' . esc_html( __( '%s ago', 'wdm-ultimate-auction' ) ), '<span class="wdm-single-auction-ending">' . wp_kses_post( $rem_tm ) . '</span>' ); |
| 329 |
?> |
| 330 |
</div> |
| 331 |
|
| 332 |
<?php if ( ! empty( $to_bid ) ) { ?> |
| 333 |
|
| 334 |
<div class="wdm_bidding_price wdm-align-left"> |
| 335 |
|
| 336 |
<?php |
| 337 |
$current_bid = $currency_symbol . number_format( $curr_price, 2, '.', ',' ) . ' ' . $currency_code_display; |
| 338 |
|
| 339 |
if ( $no_bid == 1 ) { |
| 340 |
?> |
| 341 |
<strong><?php esc_html_e( 'No Bid', 'wdm-ultimate-auction' ); ?></strong> |
| 342 |
<?php |
| 343 |
} else { |
| 344 |
?> |
| 345 |
<strong><?php echo esc_html( $current_bid ); ?></strong> |
| 346 |
<?php } ?> |
| 347 |
|
| 348 |
</div> |
| 349 |
<div id="wdm-auction-bids-placed" class="wdm_bids_placed wdm-align-right"> |
| 350 |
<a href="#wdm-tab-anchor-id" id="wdm-total-bids-link"> |
| 351 |
<?php |
| 352 |
echo esc_html( $total_bids ) . ' '; |
| 353 |
echo ( $total_bids == 1 ) ? esc_html( __( 'Bid', 'wdm-ultimate-auction' ) ) : esc_html( __( 'Bids', 'wdm-ultimate-auction' ) ); |
| 354 |
?> |
| 355 |
</a> |
| 356 |
</div> |
| 357 |
|
| 358 |
<br /> |
| 359 |
|
| 360 |
<?php |
| 361 |
} |
| 362 |
|
| 363 |
$bought = get_post_meta( $wdm_auction->ID, 'auction_bought_status', true ); |
| 364 |
|
| 365 |
if ( $bought === 'bought' ) { |
| 366 |
$buyer_id = get_post_meta( $wdm_auction->ID, 'wdm_auction_buyer', true ); |
| 367 |
$buyer = get_user_by( 'id', $buyer_id ); |
| 368 |
?> |
| 369 |
<div class="wdm-mark-red"> |
| 370 |
<?php esc_html_e( 'This auction has been bought by', 'wdm-ultimate-auction' ); ?> |
| 371 |
<?php echo esc_html( wdm_ua_display_username ($buyer->user_login) ) . ' [' . esc_html( $currency_symbol ) . number_format( $buy_now_price, 2, '.', ',' ) . ' ' . esc_html( $currency_code_display ) . ']'; ?> |
| 372 |
</div> |
| 373 |
|
| 374 |
<?php |
| 375 |
} else { |
| 376 |
|
| 377 |
/*$cnt_qry = "SELECT COUNT(bid) FROM " . $wpdb->prefix . "wdm_bidders WHERE auction_id =" . $wdm_auction->ID;*/ |
| 378 |
|
| 379 |
$cnt_qry = $GLOBALS['wpdb']->get_var($wpdb->prepare( "SELECT COUNT(bid) FROM {$wpdb->prefix}wdm_bidders WHERE auction_id = %d", $auctionid )); |
| 380 |
|
| 381 |
$cnt_bid = $cnt_qry; |
| 382 |
|
| 383 |
if ( $cnt_bid > 0 ) { |
| 384 |
|
| 385 |
$res_price_met = get_post_meta($wdm_auction->ID, 'wdm_lowest_bid', true); |
| 386 |
$win_bid = ''; |
| 387 |
|
| 388 |
/*$bid_q = "SELECT MAX(bid) FROM " . $wpdb->prefix . "wdm_bidders WHERE auction_id =" . $wdm_auction->ID;*/ |
| 389 |
|
| 390 |
$bid_q = $GLOBALS['wpdb']->get_var($wpdb->prepare( "SELECT MAX(bid) FROM {$wpdb->prefix}wdm_bidders WHERE auction_id = %d", $auctionid )); |
| 391 |
|
| 392 |
$win_bid = $bid_q; |
| 393 |
|
| 394 |
if ( $win_bid >= $res_price_met ) { |
| 395 |
$winner_name = ''; |
| 396 |
|
| 397 |
/*$name_qry = "SELECT name FROM " . $wpdb->prefix . "wdm_bidders WHERE bid =" . $win_bid . " AND auction_id =" . $wdm_auction->ID . " ORDER BY id DESC";*/ |
| 398 |
|
| 399 |
$name_qry = $GLOBALS['wpdb']->get_var($wpdb->prepare("SELECT name FROM {$wpdb->prefix}wdm_bidders WHERE bid = %d AND auction_id = %d ORDER BY id DESC", $win_bid, $auctionid)); |
| 400 |
|
| 401 |
$winner_name = $name_qry; |
| 402 |
/*printf('<div class="wdm-mark-red">' . __("This auction has been sold to %1$s at %2$s.", "wdm-ultimate-auction") . '</div>', $winner_name, $currency_symbol . number_format($win_bid, 2, '.', ',') . " " . $currency_code_display);*/ |
| 403 |
|
| 404 |
/* translators: %1$s is winner name , %2$ is winning price */ |
| 405 |
printf( '<div class="wdm-mark-red">' . esc_html( __( 'This auction has been sold to %1$s at %2$s.', 'wdm-ultimate-auction' ) ) . '</div>', esc_html( wdm_ua_display_username($winner_name) ), esc_html( $currency_symbol ) . number_format( $win_bid, 2, '.', ',' ) . ' ' . esc_html( $currency_code_display ) ); |
| 406 |
} else { |
| 407 |
?> |
| 408 |
<div class="wdm-mark-red"> |
| 409 |
<?php esc_html_e( 'Auction has expired without reaching its reserve price.', 'wdm-ultimate-auction' ); ?> |
| 410 |
</div> |
| 411 |
<?php |
| 412 |
} |
| 413 |
} elseif ( empty( $to_bid ) ) { |
| 414 |
?> |
| 415 |
<div class="wdm-mark-red"> |
| 416 |
<?php esc_html_e( 'Auction has expired without buying.', 'wdm-ultimate-auction' ); ?> |
| 417 |
</div> |
| 418 |
<?php |
| 419 |
} else { |
| 420 |
?> |
| 421 |
<div class="wdm-mark-red"> |
| 422 |
<?php esc_html_e( 'Auction has expired without any bids.', 'wdm-ultimate-auction' ); ?> |
| 423 |
</div> |
| 424 |
<?php |
| 425 |
} |
| 426 |
} |
| 427 |
} else { |
| 428 |
// prepare a format and display remaining time for current auction |
| 429 |
|
| 430 |
$seconds = $ending_date - $now; |
| 431 |
$rem_tm = wdm_ending_time_calculator( $seconds ); |
| 432 |
$auc_time = 'live'; |
| 433 |
|
| 434 |
if ( is_user_logged_in() ) { |
| 435 |
$curr_user = wp_get_current_user(); |
| 436 |
$auction_bidder_name = $curr_user->user_login; |
| 437 |
$auction_bidder_email = $curr_user->user_email; |
| 438 |
} |
| 439 |
|
| 440 |
?> |
| 441 |
|
| 442 |
|
| 443 |
<div class="wdm-auction-ending-time"> |
| 444 |
<?php |
| 445 |
|
| 446 |
/* translators: %s is remaining time */ |
| 447 |
printf( esc_html( __( 'Ending in: %s', 'wdm-ultimate-auction' ) ), '<span class="wdm-single-auction-ending">' . wp_kses_post( $rem_tm ) . '</span>' ); |
| 448 |
|
| 449 |
?></div> |
| 450 |
|
| 451 |
<?php if ( ! empty( $to_bid ) ) { ?> |
| 452 |
<div id="wdm_place_bid_section" class="clearfix"> |
| 453 |
<div class="wdm_bidding_price wdm-align-left"> |
| 454 |
|
| 455 |
<?php |
| 456 |
$current_bid = $currency_symbol . number_format( $curr_price, 2, '.', ',' ) . ' ' . $currency_code_display; |
| 457 |
|
| 458 |
if ( $no_bid == 1 ) { |
| 459 |
?> |
| 460 |
<strong><?php esc_html_e( 'No Bid', 'wdm-ultimate-auction' ); ?></strong> |
| 461 |
<?php |
| 462 |
} else { |
| 463 |
?> |
| 464 |
<strong><?php echo esc_html( $current_bid ); ?></strong> |
| 465 |
<?php } ?> |
| 466 |
|
| 467 |
</div> |
| 468 |
<div id="wdm-auction-bids-placed" class="wdm_bids_placed wdm-align-right"> |
| 469 |
<a href="#wdm-tab-anchor-id" id="wdm-total-bids-link"> |
| 470 |
<?php |
| 471 |
echo esc_html( $total_bids ) . ' '; |
| 472 |
echo ( $total_bids == 1 ) ? esc_html( __( 'Bid', 'wdm-ultimate-auction' ) ) : esc_html( __( 'Bids', 'wdm-ultimate-auction' ) ); |
| 473 |
?> |
| 474 |
</a> |
| 475 |
</div> |
| 476 |
<?php |
| 477 |
if ( $total_bids > 0 && $curr_price >= get_post_meta( $wdm_auction->ID, 'wdm_lowest_bid', true ) ) { |
| 478 |
?> |
| 479 |
<div class="wdm_reserved_note wdm-mark-green wdm-align-left"> |
| 480 |
<em><?php esc_html_e( 'Reserve price has been met.', 'wdm-ultimate-auction' ); ?></em> |
| 481 |
</div> |
| 482 |
<?php |
| 483 |
} else { |
| 484 |
?> |
| 485 |
<div class="wdm_reserved_note wdm-mark-red wdm-align-left"> |
| 486 |
<em><?php esc_html_e( 'Reserve price has not been met by any bid.', 'wdm-ultimate-auction' ); ?></em> |
| 487 |
</div> |
| 488 |
<?php |
| 489 |
} |
| 490 |
|
| 491 |
if ( is_user_logged_in() ) { |
| 492 |
// $curr_user = wp_get_current_user(); |
| 493 |
// $auction_bidder_name = $curr_user->user_login; |
| 494 |
// $auction_bidder_email = $curr_user->user_email; |
| 495 |
|
| 496 |
if ( $curr_user->ID != $wdm_auction->post_author ) { |
| 497 |
?> |
| 498 |
<?php |
| 499 |
$curr_auc_id = esc_attr( $_GET['ult_auc_id'] ); |
| 500 |
|
| 501 |
/* |
| 502 |
if(isset($_SERVER['HTTP_REFERER'])){ |
| 503 |
parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $queries); |
| 504 |
}*/ |
| 505 |
|
| 506 |
if ( isset( $_SERVER['HTTP_REFERER'] ) ) { |
| 507 |
|
| 508 |
$wdm_parse_url = parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_QUERY ); |
| 509 |
if ( ! is_null( $wdm_parse_url ) ) { |
| 510 |
parse_str( parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_QUERY ), $queries ); |
| 511 |
} |
| 512 |
} |
| 513 |
|
| 514 |
$wdm_redirect_url = ( isset( $queries['redirect_to'] ) ) ? $queries['redirect_to'] : ''; |
| 515 |
$str = "ult_auc_id=$curr_auc_id"; |
| 516 |
|
| 517 |
$curr_bid_val = ''; |
| 518 |
|
| 519 |
$pos = strpos( $wdm_redirect_url, $str ); |
| 520 |
if ( $pos !== false ) { |
| 521 |
|
| 522 |
if ( isset( $queries['wdm-bid-val'] ) ) { |
| 523 |
$bid_val = $queries['wdm-bid-val']; |
| 524 |
if ( ! empty( $bid_val ) ) { |
| 525 |
$curr_bid_val = $bid_val; |
| 526 |
} |
| 527 |
} |
| 528 |
} else { |
| 529 |
$curr_bid_val = ''; |
| 530 |
} |
| 531 |
|
| 532 |
|
| 533 |
/* translators: %s is currency symbol */ |
| 534 |
$bidval_placeholder = sprintf(esc_html__( 'in %s', 'wdm-ultimate-auction' ), esc_html( $currency_symbol ) . esc_html( $currency_code_display )); |
| 535 |
?> |
| 536 |
<form action="<?php echo esc_attr( __DIR__ ); ?>" class="wdmua-singleauc-bidform"> |
| 537 |
<div class="clearfix wdmua-clear"> |
| 538 |
<div class="wdm_bid_val clearfix wdm-align-left"> |
| 539 |
<label for="wdm-bidder-bidval" class="wdm-align-left wdmua-singleauc-label wdmua-singleauc-label-alt"><?php esc_html_e( 'Bid Value', 'wdm-ultimate-auction' ); ?>: </label> |
| 540 |
<input type="text" id="wdm-bidder-bidval" placeholder="<?php echo esc_attr($bidval_placeholder); ?>" value="<?php echo esc_attr( $curr_bid_val ); ?>" class="wdm-align-left wdmua-singleauc-input wdmua-singleauc-input-alt"/> |
| 541 |
<span class="wdm_enter_val_text wdm-align-right"> |
| 542 |
<small>(<?php |
| 543 |
|
| 544 |
/* translators: %.2f is minimum value to enter */ |
| 545 |
printf( esc_html__( 'Enter %.2f or more', 'wdm-ultimate-auction' ), esc_html( $inc_price ) ); |
| 546 |
|
| 547 |
?>) |
| 548 |
<?php |
| 549 |
$ehtml = ''; |
| 550 |
$ehtml = apply_filters( 'wdm_ua_text_after_bid_form', $ehtml, $wdm_auction->ID ); |
| 551 |
echo wp_kses_post( $ehtml ); |
| 552 |
?> |
| 553 |
</small> |
| 554 |
</span> |
| 555 |
</div> |
| 556 |
<div class="wdm_place_bid wdm-align-right clearfix"> |
| 557 |
<input type="submit" |
| 558 |
value="<?php echo esc_attr( apply_filters( 'wdm_ultimate_auction_bid_button_text', __( 'Place Bid', 'wdm-ultimate-auction' ) ) ); ?>" id="wdm-place-bid-now" /> |
| 559 |
</div> |
| 560 |
</div> |
| 561 |
</form> |
| 562 |
<?php |
| 563 |
require_once 'ajax-actions/place-bid.php'; // file to handle ajax requests related to bid placing form |
| 564 |
} |
| 565 |
} else { |
| 566 |
$check = get_option( 'wdm_users_login' ); |
| 567 |
if ( $check == 'without_login' ) { |
| 568 |
$auction_bidder_name = ''; |
| 569 |
$auction_bidder_email = ''; |
| 570 |
|
| 571 |
|
| 572 |
/*printf( esc_html__( 'in %s', 'wdm-ultimate-auction' ), esc_html( $currency_symbol ) . esc_html( $currency_code_display ) );*/ |
| 573 |
|
| 574 |
|
| 575 |
/* translators: %s is currency symbol */ |
| 576 |
$wdm_placeholder_str = sprintf( esc_html__( 'in %s', 'wdm-ultimate-auction' ), esc_html( $currency_symbol ) . esc_html( $currency_code_display ) ); |
| 577 |
|
| 578 |
|
| 579 |
?> |
| 580 |
<br /> |
| 581 |
<div class="wdmua-singleauc-fieldmain"> |
| 582 |
|
| 583 |
</div> |
| 584 |
<div class="wdm_bidder_name wdmua-singleauc-fieldwrap clearfix"> |
| 585 |
<label for="wdm-bidder-name" class="wdmua-singleauc-label wdm-align-left"><?php esc_html_e( 'Name', 'wdm-ultimate-auction' ); ?>: </label> |
| 586 |
<input type="text" id="wdm-bidder-name" name="wdm-bidder-name" class="wdm-align-left wdmua-singleauc-input"/> |
| 587 |
</div> |
| 588 |
|
| 589 |
<div class="wdm_bidder_email wdmua-singleauc-fieldwrap clearfix"> |
| 590 |
<label for="wdm-bidder-email" class="wdmua-singleauc-label wdm-align-left"><?php esc_html_e( 'Email', 'wdm-ultimate-auction' ); ?>: </label> |
| 591 |
<input type="text" id="wdm-bidder-email" name="wdm-bidder-email" class="wdm-align-left wdmua-singleauc-input"/> |
| 592 |
</div> |
| 593 |
<div class="clearfix"> |
| 594 |
<div class="wdm_bid_val wdmua-singleauc-fieldwrap clearfix wdm-align-left"> |
| 595 |
<label for="wdm-bidder-bidval" class="wdmua-singleauc-label wdm-align-left wdmua-singleauc-label-alt"><?php esc_html_e( 'Bid Value', 'wdm-ultimate-auction' ); ?>: </label> |
| 596 |
<input type="text" id="wdm-bidder-bidval" placeholder="<?php echo esc_attr($wdm_placeholder_str); ?>" class="wdm-align-left wdmua-singleauc-input wdmua-singleauc-input-alt"/> |
| 597 |
<span class="wdm_enter_val_text wdm-align-right"> |
| 598 |
<small>(<?php |
| 599 |
|
| 600 |
/* translators: %.2f is minimum price to enter */ |
| 601 |
printf( esc_html__( 'Enter %.2f or more', 'wdm-ultimate-auction' ), esc_html( $inc_price ) ); ?>) |
| 602 |
<?php |
| 603 |
$ehtml = ''; |
| 604 |
$ehtml = apply_filters( 'wdm_ua_text_after_bid_form', $ehtml, $wdm_auction->ID ); |
| 605 |
echo wp_kses_post( $ehtml ); |
| 606 |
?> |
| 607 |
|
| 608 |
</small> |
| 609 |
</span> |
| 610 |
</div> |
| 611 |
<div class="wdm_place_bid clearfix wdm-align-right"> |
| 612 |
<input type="submit" value="<?php echo esc_attr( apply_filters( 'wdm_ultimate_auction_bid_button_text', esc_html__( 'Place Bid', 'wdm-ultimate-auction' ) ) ); ?>" id="wdm-place-bid-now" class="wdm-align-right" /> |
| 613 |
</div> |
| 614 |
</div> |
| 615 |
|
| 616 |
<?php |
| 617 |
} else { |
| 618 |
|
| 619 |
if ( ! is_user_logged_in() ) { |
| 620 |
|
| 621 |
$auction_bidder_name = ''; |
| 622 |
$auction_bidder_email = ''; |
| 623 |
|
| 624 |
} |
| 625 |
|
| 626 |
/* translators: %s is currency symbol */ |
| 627 |
$wdm_placeholder_str = sprintf( esc_html__( 'in %s', 'wdm-ultimate-auction' ), esc_html( $currency_symbol ) . esc_html( $currency_code_display ) ); |
| 628 |
|
| 629 |
|
| 630 |
?> |
| 631 |
<div> |
| 632 |
|
| 633 |
</div> |
| 634 |
<div class="clearfix wdmua-clear"> |
| 635 |
<div class="wdm_bid_val clearfix wdm-align-left"> |
| 636 |
<label for="wdm-bidder-bidval" class="wdm-align-left wdmua-singleauc-label wdmua-singleauc-label-alt"><?php esc_html_e( 'Bid Value', 'wdm-ultimate-auction' ); ?>: </label> |
| 637 |
<input type="text" id="wdm-bidder-bidval" placeholder="<?php esc_attr($wdm_placeholder_str); ?>" class="wdm-align-left wdmua-singleauc-input wdmua-singleauc-input-alt"/> |
| 638 |
<span class="wdm_enter_val_text wdm-align-right"> |
| 639 |
<small>( |
| 640 |
<?php |
| 641 |
|
| 642 |
/* translators: %.2f is minimum price to enter */ |
| 643 |
printf( esc_html__( 'Enter %.2f or more', 'wdm-ultimate-auction' ), |
| 644 |
esc_html( $inc_price ) |
| 645 |
); |
| 646 |
?> |
| 647 |
)</small> |
| 648 |
</span> |
| 649 |
</div> |
| 650 |
<div class="wdm_place_bid clearfix wdm-align-right"> |
| 651 |
<a class="wdm-login-to-place-bid wdm-align-right" href="#" title="<?php esc_attr_e( 'Login', 'wdm-ultimate-auction' ); ?>" data-login-url="<?php echo esc_url( $wdm_login_url ); ?>"> |
| 652 |
<?php echo esc_html( apply_filters( 'wdm_ultimate_auction_bid_button_text', __( 'Place Bid', 'wdm-ultimate-auction' ) ) ); ?></a> |
| 653 |
</div> |
| 654 |
</div> |
| 655 |
<?php |
| 656 |
} |
| 657 |
require_once 'ajax-actions/place-bid.php'; |
| 658 |
} |
| 659 |
?> |
| 660 |
</div> <!--wdm_place_bid_section ends here--> |
| 661 |
<?php |
| 662 |
} |
| 663 |
?> |
| 664 |
<?php |
| 665 |
if ( ! empty( $to_buy ) || $to_buy > 0 ) { |
| 666 |
$a_key = get_post_meta( $wdm_auction->ID, 'wdm-auth-key', true ); |
| 667 |
|
| 668 |
$acc_mode = get_option( 'wdm_account_mode' ); |
| 669 |
|
| 670 |
if ( $acc_mode == 'Sandbox' ) { |
| 671 |
$pp_link = 'https://sandbox.paypal.com/cgi-bin/webscr'; |
| 672 |
} else { |
| 673 |
$pp_link = 'https://www.paypal.com/cgi-bin/webscr'; |
| 674 |
} |
| 675 |
if ( is_user_logged_in() ) { |
| 676 |
|
| 677 |
$check_method = get_post_meta( $wdm_auction->ID, 'wdm_payment_method', true ); |
| 678 |
|
| 679 |
if ( $check_method == 'method_paypal' ) { |
| 680 |
?> |
| 681 |
<!--buy now button--> |
| 682 |
<div id="wdm_buy_now_section" class="clearfix"> |
| 683 |
<?php if ( $curr_user->ID != $wdm_auction->post_author ) { ?> |
| 684 |
<div id="wdm-buy-line-above" class="clearfix"> |
| 685 |
<form action="<?php echo esc_html( $pp_link ); ?>" method="post" target="_top"> |
| 686 |
<input type="hidden" name="cmd" value="_xclick"> |
| 687 |
<input type="hidden" name="charset" value="utf-8" /> |
| 688 |
<input type="hidden" name="business" value="<?php echo esc_attr( get_option( 'wdm_paypal_address' ) ); ?>"> |
| 689 |
<!--<input type="hidden" name="lc" value="US">--> |
| 690 |
<input type="hidden" name="item_name" value="<?php echo esc_html( $wdm_auction->post_title ); ?>"> |
| 691 |
<input type="hidden" name="amount" value="<?php echo esc_attr( $buy_now_price ); ?>"> |
| 692 |
<?php |
| 693 |
$shipping_field = ''; |
| 694 |
echo esc_html( apply_filters( 'ua_product_shipping_cost_field', $shipping_field, $wdm_auction->ID ) ); |
| 695 |
|
| 696 |
/* translators: %1$s is currency symbol, %2$s is buynow price, %3$s is currency code */ |
| 697 |
$wdm_buynowbtn_str = sprintf( esc_html__( 'Buy it now for %1$s%2$s %3$s', 'wdm-ultimate-auction' ), esc_html( $currency_symbol ), number_format( $buy_now_price, 2, '.', ',' ), esc_html( $currency_code_display ) ); |
| 698 |
|
| 699 |
?> |
| 700 |
<input type="hidden" name="currency_code" value="<?php echo esc_attr( $currency_code ); ?>"> |
| 701 |
<input type="hidden" name="return" value="<?php echo esc_url( get_permalink() ) . esc_html( $set_char ) . 'ult_auc_id=' . intval( $wdm_auction->ID ); ?>"> |
| 702 |
<input type="hidden" name="button_subtype" value="services"> |
| 703 |
<input type="hidden" name="no_note" value="0"> |
| 704 |
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest"> |
| 705 |
<input type="submit" value="<?php echo esc_attr($wdm_buynowbtn_str); ?>" |
| 706 |
id="wdm-buy-now-button"> |
| 707 |
</form> |
| 708 |
</div> |
| 709 |
<?php |
| 710 |
} |
| 711 |
?> |
| 712 |
</div> <!--wdm_buy_now_section ends here--> |
| 713 |
|
| 714 |
<script type="text/javascript"> |
| 715 |
jQuery(document).ready(function () { |
| 716 |
jQuery("#wdm_buy_now_section form").click(function () { |
| 717 |
var cur_val = jQuery("#wdm_buy_now_section form input[name='return']").val(); |
| 718 |
jQuery("#wdm_buy_now_section form input[name='return']").val(cur_val + "&wdm=" + "<?php echo esc_html( $a_key ); ?>"); |
| 719 |
}); |
| 720 |
|
| 721 |
}); |
| 722 |
</script> |
| 723 |
<?php |
| 724 |
} else { |
| 725 |
if ( $check_method === 'method_wire_transfer' ) { |
| 726 |
$mthd = __( 'Wire Transfer', 'wdm-ultimate-auction' ); |
| 727 |
} elseif ( $check_method === 'method_mailing' ) { |
| 728 |
$mthd = __( 'Cheque', 'wdm-ultimate-auction' ); |
| 729 |
} elseif ( $check_method === 'method_cash' ) { |
| 730 |
$mthd = __( 'Cash', 'wdm-ultimate-auction' ); |
| 731 |
} |
| 732 |
|
| 733 |
|
| 734 |
/* translators: %1$s is currency symbol, %2$s is buynow price, %3$s is currency code */ |
| 735 |
$bn_text = sprintf( __( 'Buy it now for %1$s%2$s %3$s', 'wdm-ultimate-auction' ), |
| 736 |
$currency_symbol, |
| 737 |
number_format( $buy_now_price, 2, '.', ',' ), |
| 738 |
$currency_code_display |
| 739 |
); |
| 740 |
|
| 741 |
$shipAmt = 0; |
| 742 |
$shipAmt = apply_filters( 'ua_shipping_data_invoice', $shipAmt, $wdm_auction->ID, $auction_bidder_email ); |
| 743 |
|
| 744 |
if ( $shipAmt > 0 ) { |
| 745 |
|
| 746 |
/* translators: %1$s is currency symbol, %2$s is buynow price, %3$s is currency code, |
| 747 |
%4$s is currency symbol, %5$s is shipping amount, %6$s is currency code */ |
| 748 |
$bn_text = sprintf( __( 'Buy it now for %1$s%2$s %3$s + %4$s%5$s %6$s(shipping)', 'wdm-ultimate-auction' ), $currency_symbol, number_format( $buy_now_price, 2, '.', ',' ), $currency_code_display, $currency_symbol, number_format( $shipAmt, 2, '.', ',' ), $currency_code_display ); |
| 749 |
} |
| 750 |
?> |
| 751 |
<div id="wdm_buy_now_section" class="clearfix"> |
| 752 |
<?php if ( $curr_user->ID != $wdm_auction->post_author ) { ?> |
| 753 |
<div id="wdm-buy-line-above" class="clearfix"> |
| 754 |
<form action=" |
| 755 |
<?php |
| 756 |
echo esc_url( |
| 757 |
add_query_arg( |
| 758 |
array( |
| 759 |
'mt' => 'bn', |
| 760 |
'wdm' => $a_key, |
| 761 |
), |
| 762 |
get_permalink() . $set_char . 'ult_auc_id=' . $wdm_auction->ID |
| 763 |
) |
| 764 |
); |
| 765 |
?> |
| 766 |
" method="post"> |
| 767 |
<input type="submit" value="<?php echo esc_attr( $bn_text ); ?>" id="wdm-buy-now-button"> |
| 768 |
</form> |
| 769 |
</div> |
| 770 |
<?php } ?> |
| 771 |
</div> |
| 772 |
|
| 773 |
<?php |
| 774 |
|
| 775 |
/* translators: %1$s is currency code, %2$.2f is buynow price, %3$s is payment method, %4$s is auction author login */ |
| 776 |
|
| 777 |
|
| 778 |
$wdm_buyitnow_btn_str = sprintf( esc_html__( 'You need to pay %1$s %2$.2f amount via %3$s to %4$s. If you choose OK, you will receive an email with payment details and auction will expire. Choose Cancel to ignore this buy now transaction.', 'wdm-ultimate-auction' ), esc_html( $currency_code ), esc_html( $buy_now_price ) + $shipAmt, esc_html( $mthd ), esc_html( wdm_ua_display_username($auction_author->user_login) )); |
| 779 |
|
| 780 |
?> |
| 781 |
|
| 782 |
<script type="text/javascript"> |
| 783 |
jQuery(document).ready(function ($) { |
| 784 |
$("#wdm-buy-now-button").click(function () { |
| 785 |
var bcnf = confirm('<?php echo esc_attr($wdm_buyitnow_btn_str); ?>'); |
| 786 |
|
| 787 |
if (bcnf == true) { |
| 788 |
return true; |
| 789 |
} |
| 790 |
return false; |
| 791 |
}); |
| 792 |
}); |
| 793 |
</script> |
| 794 |
<?php |
| 795 |
} |
| 796 |
} else { |
| 797 |
?> |
| 798 |
<div id="wdm_buy_now_section" class="clearfix"> |
| 799 |
<div id="wdm-buy-line-above" class="clearfix"> |
| 800 |
<a class="wdm-login-to-buy-now" href="<?php echo esc_url( $wdm_login_url ); ?>" title="<?php esc_html_e( 'Login', 'wdm-ultimate-auction' ); ?>"> |
| 801 |
<?php |
| 802 |
|
| 803 |
/* translators: %1$s is currency symbol, %2$s is buynow price, %3$s is currency code */ |
| 804 |
printf( esc_html__( 'Buy it now for %1$s%2$s %3$s', 'wdm-ultimate-auction' ), |
| 805 |
esc_html( $currency_symbol ), |
| 806 |
number_format( $buy_now_price, 2, '.', ',' ), |
| 807 |
esc_html( $currency_code_display ) |
| 808 |
); |
| 809 |
?> |
| 810 |
</a> |
| 811 |
</div> |
| 812 |
|
| 813 |
</div> |
| 814 |
<?php |
| 815 |
} |
| 816 |
} |
| 817 |
|
| 818 |
if ( is_user_logged_in() && $curr_user->ID == $wdm_auction->post_author ) { |
| 819 |
echo "<span class='wdm-align-left wdmua-clear wdmua-loggedin-error'>" . esc_html( __( 'Sorry, you can not bid on your own item.', 'wdm-ultimate-auction' ) ) . '</span>'; |
| 820 |
} |
| 821 |
|
| 822 |
do_action( 'wdm_ua_ship_short_link', $wdm_auction->ID ); |
| 823 |
|
| 824 |
// do_action('ua_add_shipping_cost_view_field', $wdm_auction->ID); //SHP-ADD hook to add new product data |
| 825 |
} |
| 826 |
?> |
| 827 |
</div> <!--wdm_single_prod_desc ends here--> |
| 828 |
|
| 829 |
</div> <!--wdm-ultimate-auction-container ends here--> |
| 830 |
|
| 831 |
<!--<div id="wdm_auction_desc_section"> |
| 832 |
<div class="wdm-single-auction-description"> |
| 833 |
<strong><?php // esc_html_e("Description", "wdm-ultimate-auction"); ?></strong> |
| 834 |
<br /> |
| 835 |
<?php // echo apply_filters('the_content', $wdm_auction->post_content); ?> |
| 836 |
</div> |
| 837 |
|
| 838 |
|
| 839 |
</div>--> <!--wdm_auction_desc_section ends here--> |
| 840 |
|
| 841 |
<?php |
| 842 |
|
| 843 |
require_once 'auction-description-tabs.php'; // file to display current auction description tabs section |
| 844 |
|
| 845 |
} else { |
| 846 |
|
| 847 |
include_once 'wdm-second_layout_detail.php'; |
| 848 |
require_once 'auction-description-secondlayout-tabs.php'; // file to display current auction description tabs section |
| 849 |
wp_enqueue_script( 'wdm-slider-js' ); |
| 850 |
} |
| 851 |
|
| 852 |
?> |
| 853 |
<!--script to show small images in main image container--> |
| 854 |
<script type="text/javascript"> |
| 855 |
jQuery(document).ready(function ($) { |
| 856 |
|
| 857 |
$('.wdm-image-container .auction-small-img').each(function (i) { |
| 858 |
$('.auction-small-img' + (i + 1)).click(function () { |
| 859 |
$('.auction-main-img-a').css('display', 'none'); |
| 860 |
$('.auction-main-img' + (i + 1)).css('display', 'block'); |
| 861 |
}); |
| 862 |
}); |
| 863 |
|
| 864 |
//jQuery(".auction-main-img-a").boxer({'fixed': true}); |
| 865 |
|
| 866 |
var eDays = jQuery('#wdm_days'); |
| 867 |
var eHours = jQuery('#wdm_hours'); |
| 868 |
var eMinutes = jQuery('#wdm_minutes'); |
| 869 |
var eSeconds = jQuery('#wdm_seconds'); |
| 870 |
|
| 871 |
var timer; |
| 872 |
timer = setInterval(function () { |
| 873 |
var vDays = parseInt(eDays.html(), 10); |
| 874 |
var vHours = parseInt(eHours.html(), 10); |
| 875 |
var vMinutes = parseInt(eMinutes.html(), 10); |
| 876 |
var vSeconds = parseInt(eSeconds.html(), 10); |
| 877 |
|
| 878 |
var ac_time = '<?php echo esc_html( $auc_time ); ?>'; |
| 879 |
|
| 880 |
if (ac_time == 'live') { |
| 881 |
|
| 882 |
vSeconds--; |
| 883 |
if (vSeconds < 0) { |
| 884 |
vSeconds = 59; |
| 885 |
vMinutes--; |
| 886 |
if (vMinutes < 0) { |
| 887 |
vMinutes = 59; |
| 888 |
vHours--; |
| 889 |
/* if (vHours < 0) { */ |
| 890 |
if (0 > vHours) { |
| 891 |
vHours = 23; |
| 892 |
vDays--; |
| 893 |
} |
| 894 |
} |
| 895 |
} |
| 896 |
else { |
| 897 |
if (vSeconds == 0 && |
| 898 |
vMinutes == 0 && |
| 899 |
vHours == 0 && |
| 900 |
vDays == 0) { |
| 901 |
clearInterval(timer); |
| 902 |
window.location.reload(); |
| 903 |
} |
| 904 |
} |
| 905 |
} |
| 906 |
else if (ac_time == 'exp') { |
| 907 |
vSeconds++; |
| 908 |
if (vSeconds > 59) { |
| 909 |
vSeconds = 0; |
| 910 |
vMinutes++; |
| 911 |
if (vMinutes > 59) { |
| 912 |
vMinutes = 0; |
| 913 |
vHours++; |
| 914 |
if (vHours > 23) { |
| 915 |
vHours = 0; |
| 916 |
vDays++; |
| 917 |
} |
| 918 |
} |
| 919 |
} else { |
| 920 |
if (vSeconds == 0 && |
| 921 |
vMinutes == 0 && |
| 922 |
vHours == 0 && |
| 923 |
vDays == 0) { |
| 924 |
clearInterval(timer); |
| 925 |
window.location.reload(); |
| 926 |
} |
| 927 |
} |
| 928 |
} |
| 929 |
|
| 930 |
eSeconds.html(vSeconds); |
| 931 |
eMinutes.html(vMinutes); |
| 932 |
eHours.html(vHours); |
| 933 |
eDays.html(vDays); |
| 934 |
|
| 935 |
var wdm_layout_style = "<?php echo esc_html( get_option( 'wdm_layout_style', 'layout_style_two' ) ); ?>"; |
| 936 |
|
| 937 |
if (wdm_layout_style == 'layout_style_one') { |
| 938 |
|
| 939 |
|
| 940 |
if (vDays == 0) { |
| 941 |
eDays.hide(); |
| 942 |
jQuery('#wdm_days_text').html(' '); |
| 943 |
} |
| 944 |
else if (vDays == 1 || vDays == -1) { |
| 945 |
eDays.show(); |
| 946 |
jQuery('#wdm_days_text').html(' <?php esc_html_e( 'day', 'wdm-ultimate-auction' ); ?> '); |
| 947 |
} |
| 948 |
else { |
| 949 |
eDays.show(); |
| 950 |
jQuery('#wdm_days_text').html(' <?php esc_html_e( 'days', 'wdm-ultimate-auction' ); ?> '); |
| 951 |
} |
| 952 |
|
| 953 |
if (vHours == 0) { |
| 954 |
eHours.hide(); |
| 955 |
jQuery('#wdm_hrs_text').html(' '); |
| 956 |
} |
| 957 |
else if (vHours == 1 || vHours == -1) { |
| 958 |
eHours.show(); |
| 959 |
jQuery('#wdm_hrs_text').html(' <?php esc_html_e( 'hour', 'wdm-ultimate-auction' ); ?> '); |
| 960 |
} |
| 961 |
else { |
| 962 |
eHours.show(); |
| 963 |
jQuery('#wdm_hrs_text').html(' <?php esc_html_e( 'hours', 'wdm-ultimate-auction' ); ?> '); |
| 964 |
} |
| 965 |
|
| 966 |
if (vMinutes == 0) { |
| 967 |
eMinutes.hide(); |
| 968 |
jQuery('#wdm_mins_text').html(' '); |
| 969 |
} |
| 970 |
else if (vMinutes == 1 || vMinutes == -1) { |
| 971 |
eMinutes.show(); |
| 972 |
jQuery('#wdm_mins_text').html(' <?php esc_html_e( 'minute', 'wdm-ultimate-auction' ); ?> '); |
| 973 |
} |
| 974 |
else { |
| 975 |
eMinutes.show(); |
| 976 |
jQuery('#wdm_mins_text').html(' <?php esc_html_e( 'minutes', 'wdm-ultimate-auction' ); ?> '); |
| 977 |
} |
| 978 |
|
| 979 |
if (vSeconds == 0) { |
| 980 |
eSeconds.hide(); |
| 981 |
jQuery('#wdm_secs_text').html(' '); |
| 982 |
} |
| 983 |
else if (vSeconds == 1 || vSeconds == -1) { |
| 984 |
eSeconds.show(); |
| 985 |
jQuery('#wdm_secs_text').html(' <?php esc_html_e( 'second', 'wdm-ultimate-auction' ); ?>'); |
| 986 |
} |
| 987 |
else { |
| 988 |
eSeconds.show(); |
| 989 |
jQuery('#wdm_secs_text').html(' <?php esc_html_e( 'seconds', 'wdm-ultimate-auction' ); ?>'); |
| 990 |
} |
| 991 |
|
| 992 |
|
| 993 |
} else { |
| 994 |
|
| 995 |
|
| 996 |
if (vDays == 0 || vDays == 1 || vDays == -1) { |
| 997 |
eDays.show(); |
| 998 |
jQuery('#wdm_days_text').html(' <?php esc_html_e( 'day', 'wdm-ultimate-auction' ); ?> '); |
| 999 |
} |
| 1000 |
else { |
| 1001 |
eDays.show(); |
| 1002 |
jQuery('#wdm_days_text').html(' <?php esc_html_e( 'days', 'wdm-ultimate-auction' ); ?> '); |
| 1003 |
} |
| 1004 |
|
| 1005 |
if (vHours == 0 || vHours == 1 || vHours == -1) { |
| 1006 |
eHours.show(); |
| 1007 |
jQuery('#wdm_hrs_text').html(' <?php esc_html_e( 'hour', 'wdm-ultimate-auction' ); ?> '); |
| 1008 |
} |
| 1009 |
else { |
| 1010 |
eHours.show(); |
| 1011 |
jQuery('#wdm_hrs_text').html(' <?php esc_html_e( 'hours', 'wdm-ultimate-auction' ); ?> '); |
| 1012 |
} |
| 1013 |
|
| 1014 |
if (vMinutes == 0 || vMinutes == 1 || vMinutes == -1) { |
| 1015 |
eMinutes.show(); |
| 1016 |
jQuery('#wdm_mins_text').html(' <?php esc_html_e( 'minute', 'wdm-ultimate-auction' ); ?> '); |
| 1017 |
} |
| 1018 |
else { |
| 1019 |
eMinutes.show(); |
| 1020 |
jQuery('#wdm_mins_text').html(' <?php esc_html_e( 'minutes', 'wdm-ultimate-auction' ); ?> '); |
| 1021 |
} |
| 1022 |
|
| 1023 |
if (vSeconds == 0 || vSeconds == 1 || vSeconds == -1) { |
| 1024 |
eSeconds.show(); |
| 1025 |
jQuery('#wdm_secs_text').html(' <?php esc_html_e( 'second', 'wdm-ultimate-auction' ); ?>'); |
| 1026 |
} |
| 1027 |
else { |
| 1028 |
eSeconds.show(); |
| 1029 |
jQuery('#wdm_secs_text').html(' <?php esc_html_e( 'seconds', 'wdm-ultimate-auction' ); ?>'); |
| 1030 |
} |
| 1031 |
|
| 1032 |
|
| 1033 |
} |
| 1034 |
|
| 1035 |
|
| 1036 |
|
| 1037 |
}, 1000); |
| 1038 |
|
| 1039 |
}); |
| 1040 |
</script> |
| 1041 |
<?php |
| 1042 |
} |
| 1043 |
} else { |
| 1044 |
|
| 1045 |
// [wdm_auction_listing type='expired'] |
| 1046 |
if ( ! empty( $atts ) ) { |
| 1047 |
|
| 1048 |
if ( ! empty( $atts['sortby'] ) || ! empty( $atts['order'] ) || ! empty( $atts['type'] ) ) { |
| 1049 |
|
| 1050 |
// e.g. sortby=title order=asc type=expired |
| 1051 |
|
| 1052 |
$sortby_val = 'date'; |
| 1053 |
$order_val = 'DESC'; |
| 1054 |
$auction_status_val = 'live'; |
| 1055 |
|
| 1056 |
if ( ! empty( $atts['sortby'] ) && ! empty( $atts['order'] ) ) { |
| 1057 |
if ( ( $atts['sortby'] == 'date' || $atts['sortby'] == 'title' ) && |
| 1058 |
( $atts['order'] == 'asc' || $atts['order'] == 'desc' ) ) { |
| 1059 |
|
| 1060 |
$sortby_val = $atts['sortby']; |
| 1061 |
$order_val = strtoupper( $atts['order'] ); |
| 1062 |
} |
| 1063 |
} elseif ( ! empty( $atts['sortby'] ) && $atts['sortby'] == 'title' ) { |
| 1064 |
$sortby_val = $atts['sortby']; |
| 1065 |
$order_val = 'ASC'; |
| 1066 |
} elseif ( ! empty( $atts['sortby'] ) && $atts['sortby'] == 'date' ) { |
| 1067 |
$sortby_val = $atts['sortby']; |
| 1068 |
$order_val = 'DESC'; |
| 1069 |
} elseif ( ! empty( $atts['order'] ) && $atts['order'] == 'asc' ) { |
| 1070 |
$sortby_val = 'date'; |
| 1071 |
$order_val = 'ASC'; |
| 1072 |
} elseif ( ! empty( $atts['order'] ) && $atts['order'] == 'desc' ) { |
| 1073 |
$sortby_val = 'date'; |
| 1074 |
$order_val = 'DESC'; |
| 1075 |
} |
| 1076 |
|
| 1077 |
if ( ! empty( $atts['type'] ) && $atts['type'] == 'expired' ) { |
| 1078 |
$auction_status_val = 'expired'; |
| 1079 |
} |
| 1080 |
|
| 1081 |
// listing of auctions using attributes |
| 1082 |
require_once 'auctions-listing-with-attributes.php'; |
| 1083 |
} |
| 1084 |
} else { |
| 1085 |
// file auction listing page |
| 1086 |
require_once 'auction-feeder-page.php'; |
| 1087 |
} |
| 1088 |
} |
| 1089 |
|
| 1090 |
$auc_sc = ob_get_contents(); |
| 1091 |
|
| 1092 |
ob_end_clean(); |
| 1093 |
|
| 1094 |
return $auc_sc; |
| 1095 |
} |
| 1096 |
|
| 1097 |
// shortcode to display entire auction posts on the site |
| 1098 |
add_shortcode( 'wdm_auction_listing', 'wdm_auction_listing' ); |
| 1099 |
|
| 1100 |
function wdm_get_mime_type( $url ) { |
| 1101 |
global $wpdb; |
| 1102 |
|
| 1103 |
/* $new_qry = $wpdb->prepare("SELECT post_mime_type FROM $wpdb->posts WHERE guid = %s", $url);*/ |
| 1104 |
|
| 1105 |
$table_posts = $wpdb->prefix . 'posts'; |
| 1106 |
$table_posts; |
| 1107 |
|
| 1108 |
$new_qry = $wpdb->prepare("SELECT post_mime_type FROM $wpdb->posts WHERE guid = %s", $url); |
| 1109 |
|
| 1110 |
$mime = $new_qry; |
| 1111 |
|
| 1112 |
return $mime; |
| 1113 |
} |
| 1114 |
|
| 1115 |
?> |