Changeset 878480
- Timestamp:
- 03/20/2014 02:32:31 AM (12 years ago)
- Location:
- dutch-auction-masters/trunk
- Files:
-
- 6 added
- 8 edited
-
assets/css/front.css (modified) (2 diffs)
-
assets/css/jquery.jqzoom.css (added)
-
assets/css/my-auctions.css (added)
-
assets/images/zoomloader.gif (added)
-
assets/js/jquery.jqzoom-core-pack.js (added)
-
assets/js/jquery.jqzoom-core.js (added)
-
dutch-auction-masters.php (modified) (4 diffs)
-
inc/CustomPost.php (modified) (8 diffs)
-
inc/DataProvider.php (modified) (1 diff)
-
inc/DefaultViews.php (modified) (2 diffs)
-
inc/Functions.php (modified) (34 diffs)
-
inc/Settings.php (modified) (1 diff)
-
modules/UserModule.php (added)
-
readme.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dutch-auction-masters/trunk/assets/css/front.css
r840348 r878480 280 280 } 281 281 282 .auction-detail .main-pic-wrap283 {284 width: 290px;285 height:300px;286 }287 288 .auction-detail .main-pic-wrap > img289 {290 max-width: 290px;291 max-height:290px;292 }293 294 295 282 .main-pic-wrap.no-pics 296 283 { … … 468 455 max-height:150px; 469 456 } 457 458 459 460 461 /*.site-content*/ 462 /*{*/ 463 /*width: 100% !important;*/ 464 /*}*/ 465 466 .auction-detail >.column 467 { 468 width: 100%; 469 } 470 471 .picture.column 472 { 473 width: 55%; 474 } 475 476 .auction-detail >.column >.wrap 477 { 478 width: 40%; 479 } 480 481 .auction-detail .main-pic-wrap 482 { 483 width: 85%; 484 position: relative; 485 float: left; 486 display: inline; 487 } 488 489 .auction-detail .picture ul 490 { 491 width: 15%; 492 float: left; 493 display: inline; 494 position: relative; 495 padding-left: 10px; 496 } 497 498 .zoomWrapper > .zoomWrapperImage > img 499 { 500 max-width: inherit; 501 } 502 503 .main-pic-wrap-a .zoomPad 504 { 505 max-width: 100%; 506 } 507 508 .wrap.column 509 { 510 padding-left: 10px; 511 } -
dutch-auction-masters/trunk/dutch-auction-masters.php
r842205 r878480 6 6 * Author: Dutch auction masters team. 7 7 * Author URI: http://www.dutchauctionmasters.com/ 8 * Version: 1. 6.1.08 * Version: 1.7.0.0 9 9 * Copyright (c) 2013 Second Company B.V. http://www.secondcompany.nl/ 10 10 */ … … 20 20 { 21 21 #region constance 22 const PLUGIN_VERSION = "1. 6.1.0";22 const PLUGIN_VERSION = "1.7.0.0"; 23 23 const CRON_JOB_INTERVAL = 5; 24 24 const TEXT_DOMAIN = "dam-auction-masters"; … … 140 140 ), //front.css 141 141 array( 142 'handle' => 'jquery.jqzoom.css', 143 'src' => $this->pluginUri. 'assets/css/jquery.jqzoom.css', 144 'deps' => '', 145 'ver' => self::PLUGIN_VERSION, 146 ), 147 array( 148 'handle' => 'my-auctions.css', 149 'src' => $this->pluginUri. 'assets/css/my-auctions.css', 150 'deps' => '', 151 'ver' => self::PLUGIN_VERSION, 152 ), 153 array( 142 154 'handle' => 'admin.css', 143 155 'src' => $this->pluginUri . 'assets/css/admin.css', … … 182 194 'in_footer' => true, 183 195 ), //jquery.multiselect.js 196 array( 197 'handle' => 'jquery.jqzoom-core.js', 198 'src' => $this->pluginUri . 'assets/js/jquery.jqzoom-core.js', 199 'deps' => array('jquery'), 200 'ver' => self::PLUGIN_VERSION, 201 'in_footer' => true, 202 ), 184 203 array( 185 204 'handle' => 'admin.js', -
dutch-auction-masters/trunk/inc/CustomPost.php
r840348 r878480 8 8 { 9 9 const TEXT_DOMAIN = "dam-auction-masters"; 10 const DAM_AUCTION = "dam_auction";10 const DAM_AUCTION = "dam_auction"; 11 11 public $customPostTypes; 12 12 public $auctions; … … 44 44 add_action('wp_trash_post', array($this, 'trashCustomPost')); 45 45 add_action('untrash_post', array($this, 'untrashCustomPost')); 46 add_action( 'admin_notices',array($this, 'displayWarningMessage') ); 47 } 48 46 add_action('admin_notices', array($this, 'displayWarningMessage')); 47 } 49 48 50 49 51 50 public function displayWarningMessage() 52 51 { 53 if(isset($_GET['post'])) 54 { 52 if (isset($_GET['post'])) { 55 53 $id = $_GET['post']; 56 54 $post = get_post($id); 57 if($post && $post->post_type ==self::DAM_AUCTION && $post->post_status =="publish" ) 58 { 55 if ($post && $post->post_type == self::DAM_AUCTION && $post->post_status == "publish") { 59 56 $message = __("The auction has started, continue editing that will lose bids and winner information", self::TEXT_DOMAIN); 60 echo "<div class='wrap'><div class='error'><p>$message</p></div></div>";57 echo "<div class='wrap'><div class='error'><p>$message</p></div></div>"; 61 58 } 62 59 } … … 110 107 { 111 108 $post = get_post($post_id); 112 if ($post->post_type == self::DAM_AUCTION ) {109 if ($post->post_type == self::DAM_AUCTION) { 113 110 $default = array( 114 111 'id' => 0, … … 150 147 } 151 148 152 if($post->post_status == "publish") 153 { 149 if ($post->post_status == "publish") { 154 150 $item['notified'] = 0; 155 151 $item['winner'] = ''; … … 244 240 $fieldRequires = array( 245 241 'original_price' => true, 246 // 'reserve_price' => true,242 // 'reserve_price' => true, 247 243 'shipping_fee' => true, 248 244 'start_price' => true, … … 271 267 private function getValue($postId, $columnName) 272 268 { 273 $auctions = $this->auctions; 274 if (count($auctions) > 0) { 275 foreach ($auctions as $auction) { 269 if (is_array($this->auctions)) { 270 foreach ($this->auctions as $auction) { 276 271 if ($auction->post_id == $postId) { 277 272 if ($columnName == "picture") { … … 281 276 } else if ($columnName == "last_bids") { 282 277 return SC_functions::displayLastBids((array)$auction); 283 } else if ($columnName == "winner") {278 } else if ($columnName == "winner") { 284 279 return $this->displayWinner((array)$auction); 285 } else {280 } else { 286 281 return $auction->$columnName; 287 282 } … … 295 290 { 296 291 $result = ""; 297 if ( $auction ['deal_state'] == DealState::PAID && $auction ['winner']) {292 if ($auction ['deal_state'] == DealState::PAID && $auction ['winner']) { 298 293 $address = SC_DataProvider::get_address_by_auction_id($auction['id']); 299 294 if ($address) { -
dutch-auction-masters/trunk/inc/DataProvider.php
r840348 r878480 889 889 return false; 890 890 } 891 892 public static function getProfileAddress($userId, $auctionId) 893 { 894 global $wpdb; 895 /** @var $wpdb wpdb */ 896 $table = $wpdb->prefix . DutchAuctionMasters::DAM_TABLE_SHIPPING_ADDRESS; 897 $auctionId = isset($auctionId)?intval($auctionId):0; 898 $where = " `user_id`= %d and `auction_id` in (0,%d) order by `auction_id` desc limit 0,1"; 899 $query = "select * from `" . $table . "` WHERE " . $where; 900 $sql = $wpdb->prepare ( $query, $userId, $auctionId); 901 $items = $wpdb->get_results ( $sql ); 902 if (count ( $items ) > 0) 903 return $items [0]; 904 905 return false; 906 } 891 907 } 892 908 } -
dutch-auction-masters/trunk/inc/DefaultViews.php
r840348 r878480 189 189 //--> 190 190 </script> 191 192 <script type="text/javascript"> 193 jQuery(document).ready(function($){ 194 var options = { 195 zoomType: 'standard', 196 lens:true, 197 preloadImages: true, 198 alwaysOn:false, 199 zoomWidth: 420, 200 zoomHeight:420, 201 xOffset:8, 202 yOffset:0, 203 position:'right' 204 //...MORE OPTIONS 205 }; 206 $('.zoom-a').jqzoom(options); 207 }); 208 </script> 191 209 <?php 192 210 } … … 212 230 } 213 231 $src = preg_replace('/-\d+x\d+/', '', $picture); 232 $title = $auction->title; 214 233 echo "<div class='picture column'>"; 215 if($display_action) 216 echo "<div class='main-pic-wrap $disablePicture $displayLink'><a href='$url'><img class='main-picture' src='$src' /></a></div>"; 217 else 218 echo "<div class='main-pic-wrap $disablePicture $displayLink'><img class='main-picture' src='$src' /></div>"; 234 echo "<div class='main-pic-wrap $disablePicture $displayLink'><a rel='gal1' href='$src' title='$title' class='main-pic-wrap-a zoom-a'><img class='main-picture' src='$src' /></a></div>"; 235 219 236 if(isset($pictures) && $display_pictures) 220 237 { 238 $first = true; 221 239 echo "<ul>"; 222 240 foreach($pictures as $picture) 223 echo "<li><img src='$picture' style='max-height: 50px;max-width: 50px;' /></li>"; 241 { 242 $largePic = preg_replace('/-\d+x\d+/', '', $picture); 243 $class = $first?"class='zoomThumbActive'":""; 244 echo "<li><a $class href='javascript:void(0);' rel=\"{gallery: 'gal1', smallimage:'$largePic',largeimage: '$largePic' }\" >"; 245 echo "<img src='$picture' style='max-height: 50px;max-width: 50px;' /></a></li>"; 246 $first = false; 247 } 224 248 echo "</ul>"; 225 249 } -
dutch-auction-masters/trunk/inc/Functions.php
r840348 r878480 42 42 } 43 43 44 public static function frontTimeFormat($time) 45 { 46 return $time; //TODO 47 } 48 44 49 public static function displayLastBids($auction) 45 50 { … … 47 52 $last_bids = $auction['last_bids']; 48 53 $auction_id = $auction['id']; 49 if (! empty ( $last_bids)) {50 $last_bids_array = json_decode ( stripslashes ( $last_bids ));51 $text = __('View all bids', DutchAuctionMasters::TEXT_DOMAIN);54 if (!empty ($last_bids)) { 55 $last_bids_array = json_decode(stripslashes($last_bids)); 56 $text = __('View all bids', DutchAuctionMasters::TEXT_DOMAIN); 52 57 $result .= "<a href='./admin.php?page=dam_auction_masters_bids&auctionid=$auction_id'>$text</a>"; 53 58 $result .= "<ul>"; 54 foreach ($last_bids_array as $bid) 55 { 56 if(property_exists($bid, "user_name") && property_exists($bid, "created") && property_exists($bid, "price") ) 57 { 58 $result .= "<li> <em>$bid->created</em> <span>".$bid->price." </span> <span>$bid->user_name </span> </li>"; 59 foreach ($last_bids_array as $bid) { 60 if (property_exists($bid, "user_name") && property_exists($bid, "created") && property_exists($bid, "price")) { 61 $result .= "<li> <em>$bid->created</em> <span>" . $bid->price . " </span> <span>$bid->user_name </span> </li>"; 59 62 } 60 63 } … … 67 70 { 68 71 $mapping = array( 69 0 => __("draft", DutchAuctionMasters::TEXT_DOMAIN),70 10 => __("publish", DutchAuctionMasters::TEXT_DOMAIN),71 20 => __("trash", DutchAuctionMasters::TEXT_DOMAIN),72 30 => __("pending", DutchAuctionMasters::TEXT_DOMAIN),72 0 => __("draft", DutchAuctionMasters::TEXT_DOMAIN), 73 10 => __("publish", DutchAuctionMasters::TEXT_DOMAIN), 74 20 => __("trash", DutchAuctionMasters::TEXT_DOMAIN), 75 30 => __("pending", DutchAuctionMasters::TEXT_DOMAIN), 73 76 ); 74 $begin = strtotime ( $auction ['begin']);75 $end = strtotime ( $auction ['end']);77 $begin = strtotime($auction ['begin']); 78 $end = strtotime($auction ['end']); 76 79 $status = $auction ['status']; 77 $current_time = current_time ( 'timestamp');80 $current_time = current_time('timestamp'); 78 81 $display_name = null; 79 82 if ($status == AuctionStatus::NORMAL) { 80 83 if ($begin > $current_time) { 81 $display_name = __ ( "Upcoming", DutchAuctionMasters::TEXT_DOMAIN);84 $display_name = __("Upcoming", DutchAuctionMasters::TEXT_DOMAIN); 82 85 } else if ($begin <= $current_time && $current_time <= $end) { 83 $display_name = __ ( "Running", DutchAuctionMasters::TEXT_DOMAIN);84 } else if ($end < $current_time ) {85 $display_name = __ ( "Closed", DutchAuctionMasters::TEXT_DOMAIN);86 } 87 } else{86 $display_name = __("Running", DutchAuctionMasters::TEXT_DOMAIN); 87 } else if ($end < $current_time) { 88 $display_name = __("Closed", DutchAuctionMasters::TEXT_DOMAIN); 89 } 90 } else { 88 91 $display_name = $mapping[$status]; 89 92 } 90 return '<b>' . $display_name . '</b>';93 return '<b>' . $display_name . '</b>'; 91 94 } 92 95 … … 94 97 { 95 98 $picture = $auction->$columnName; 96 if (strpos($picture, ',') !== false) {99 if (strpos($picture, ',') !== false) { 97 100 $pictures = explode(',', $picture); 98 101 $picture = $pictures[0]; … … 104 107 public static function getRelatedPostIdsByTag($auction, $limit = 5) 105 108 { 106 if (empty($auction))109 if (empty($auction)) 107 110 return null; 108 111 … … 110 113 $tags = array_filter($tags); 111 114 112 $categories = explode(',', $auction->category);115 $categories = explode(',', $auction->category); 113 116 $categories = array_filter($categories); 114 117 115 118 $args = array( 116 'numberposts' => $limit,119 'numberposts' => $limit, 117 120 'post_type' => 'dam_auction', 118 'exclude' => $auction->post_id,121 'exclude' => $auction->post_id, 119 122 'tax_query' => array( 120 123 'relation' => 'OR', … … 130 133 ), 131 134 ), 132 'fields' => 'ids',135 'fields' => 'ids', 133 136 ); 134 137 $postIds = get_posts($args); … … 138 141 public static function getRelatedAuction($auction_id, $limit = null) 139 142 { 140 if (!$auction_id)143 if (!$auction_id) 141 144 return false; 142 145 $auction = SC_DataProvider::get_auction($auction_id); 143 146 $postIds = self::getRelatedPostIdsByTag($auction, $limit); 144 if(count($postIds)>0) 145 { 147 if (count($postIds) > 0) { 146 148 $auctions = SC_DataProvider::getAuctionByPostIds($postIds); 147 149 return $auctions; 148 } else{150 } else { 149 151 return false; 150 152 } … … 158 160 'post_author' => 1, 159 161 'post_content' => $content, 160 'post_date' => date ( 'Y-m-d H:i:59', current_time ( "timestamp" )),161 'post_date_gmt' => date ( 'Y-m-d H:i:59', current_time ( "timestamp") - 160379),162 'post_name' => $title ,162 'post_date' => date('Y-m-d H:i:59', current_time("timestamp")), 163 'post_date_gmt' => date('Y-m-d H:i:59', current_time("timestamp") - 160379), 164 'post_name' => $title, 163 165 'post_status' => 'future', 164 'post_title' => ucfirst($title) ,165 'post_type' => 'page',166 'post_title' => ucfirst($title), 167 'post_type' => 'page', 166 168 ); 167 $page_id = wp_insert_post( $post);169 $page_id = wp_insert_post($post); 168 170 return $page_id; 169 171 } … … 171 173 public static function getMainPictureUrl($picture) 172 174 { 173 if(strpos($picture, ',') !== false) 174 { 175 if (strpos($picture, ',') !== false) { 175 176 $pictures = explode(',', $picture); 176 177 $picture = $pictures[0]; … … 182 183 { 183 184 global $current_user; 184 get_current_user ();185 get_current_user(); 185 186 186 187 $new_state = SC_DataProvider::updateDealState($auction_id, DealState::ACCEPTED, DealState::DELIVERED, $current_user->ID); … … 197 198 { 198 199 global $current_user; 199 get_current_user ();200 get_current_user(); 200 201 201 202 $new_state = SC_DataProvider::updateDealState($auction_id, DealState::PAYING, null, $current_user->ID); … … 211 212 public static function is_active_auction_page($page) 212 213 { 213 $current = isset($_REQUEST["state"])? $_REQUEST["state"]:''; 214 if($page == $current) 215 { 214 $current = isset($_REQUEST["state"]) ? $_REQUEST["state"] : ''; 215 if ($page == $current) { 216 216 return "active"; 217 217 } … … 219 219 } 220 220 221 public static function add_property_key($key) { 222 $keys = get_option ( "dam_property_keys" ); 221 public static function add_property_key($key) 222 { 223 $keys = get_option("dam_property_keys"); 223 224 $new_key = '"' . $key . '",'; 224 if (! $keys) { 225 update_option ( "dam_property_keys", ',' . $new_key ); 226 } else if (! strpos ( $keys, $new_key )) { 227 update_option ( "dam_property_keys", $keys . $new_key ); 228 } 229 } 230 231 public static function get_property_keys() { 232 return trim(get_option("dam_property_keys"),','); 225 if (!$keys) { 226 update_option("dam_property_keys", ',' . $new_key); 227 } else if (!strpos($keys, $new_key)) { 228 update_option("dam_property_keys", $keys . $new_key); 229 } 230 } 231 232 public static function get_property_keys() 233 { 234 return trim(get_option("dam_property_keys"), ','); 233 235 } 234 236 … … 236 238 { 237 239 $bids = SC_DataProvider::get_last_bids($auctionId, $bidCount); 238 return self::formatBids($bids, $hidePartialName);240 return self::formatBids($bids, $hidePartialName); 239 241 } 240 242 … … 244 246 foreach ($bids as $bid) { 245 247 $bid->price = self::money_format($bid->price); 246 if ($hidePartialName)247 $bid->user_name = substr_replace($bid->user_name, '***', 1, 3) ;248 if ($hidePartialName) 249 $bid->user_name = substr_replace($bid->user_name, '***', 1, 3); 248 250 } 249 251 } … … 251 253 } 252 254 253 public static function money_format($number) { 254 $decimal_point = get_option ( 'dam_currency_decimal_point', ',' ); 255 $thousands_sep = get_option ( 'dam_currency_thousands_step', '.' ); 256 $symbol = get_option ( 'dam_currency_symbol', '€' ); 257 258 $money = number_format ( $number, 2, $decimal_point, $thousands_sep ); 255 public static function money_format($number) 256 { 257 $decimal_point = get_option('dam_currency_decimal_point', ','); 258 $thousands_sep = get_option('dam_currency_thousands_step', '.'); 259 $symbol = get_option('dam_currency_symbol', '€'); 260 261 $money = number_format($number, 2, $decimal_point, $thousands_sep); 259 262 return $symbol . ' ' . $money; 260 263 } 261 264 262 public static function get_auction_winnerId($auction) { 263 if (! empty ( $auction ) && ! empty ( $auction->winner )) { 264 $winner = json_decode ( $auction->winner ); 265 public static function get_auction_winnerId($auction) 266 { 267 if (!empty ($auction) && !empty ($auction->winner)) { 268 $winner = json_decode($auction->winner); 265 269 return $winner->id; 266 270 } … … 268 272 } 269 273 270 public static function Is_winner($auction) { 274 public static function Is_winner($auction) 275 { 271 276 global $current_user; 272 get_current_user ();273 274 $winner_id = self::get_auction_winnerId ( $auction);277 get_current_user(); 278 279 $winner_id = self::get_auction_winnerId($auction); 275 280 276 281 if ($winner_id == $current_user->ID) { … … 280 285 } 281 286 282 public static function get_auction_closed_message($auction) { 287 public static function get_auction_closed_message($auction) 288 { 283 289 global $current_user; 284 get_current_user ();285 $left_time = strtotime ( $auction->end ) - current_time ( 'timestamp');290 get_current_user(); 291 $left_time = strtotime($auction->end) - current_time('timestamp'); 286 292 $closed = $left_time < 0; 287 293 if ($closed) { 288 if ($current_user->ID && ! empty ( $auction->winner)) {289 $is_winner = self::Is_winner ( $auction);294 if ($current_user->ID && !empty ($auction->winner)) { 295 $is_winner = self::Is_winner($auction); 290 296 if ($is_winner) { 291 297 $defaultMessage = __("You've won the auction, an email will be sent to you shortly, please refer to it to know more details.", "dam-auction-masters"); 292 $message = apply_filters("dam_auction_won_message", $defaultMessage, $auction->id);298 $message = apply_filters("dam_auction_won_message", $defaultMessage, $auction->id); 293 299 } else { 294 $message = __ ( "Sorry, the auction is closed and you are not the winner.", "dam-auction-masters");300 $message = __("Sorry, the auction is closed and you are not the winner.", "dam-auction-masters"); 295 301 } 296 302 } else { 297 $message = __ ( "The auction is closed", "dam-auction-masters");298 } 299 } 300 $message = isset($message) ? $message:"";303 $message = __("The auction is closed", "dam-auction-masters"); 304 } 305 } 306 $message = isset($message) ? $message : ""; 301 307 return $message; 302 308 } 303 309 304 public static function get_auction_detail_url($auction_id) { 305 $page_id = get_option ( "dam_auction_detail_page" ); 306 307 if (empty ( $page_id )) { 310 311 public static function getPayUrl($auctionId) 312 { 313 $defaultUrl = admin_url('admin.php?page=shipping-address'); 314 $payUrlSetting = get_option("dam_pay_url"); 315 $payUrlSetting = empty($payUrlSetting) ? $defaultUrl : $payUrlSetting; 316 $url = add_query_arg(array("auction_id" => $auctionId), $payUrlSetting); 317 return $url; 318 } 319 320 public static function get_auction_detail_url($auction_id) 321 { 322 $page_id = get_option("dam_auction_detail_page"); 323 324 if (empty ($page_id)) { 308 325 return "javascript:nonepage();"; 309 326 } else { 310 327 311 $detail_page_url = get_permalink ( $page_id);312 $detail_url = add_query_arg(array("id" =>$auction_id), $detail_page_url);328 $detail_page_url = get_permalink($page_id); 329 $detail_url = add_query_arg(array("id" => $auction_id), $detail_page_url); 313 330 return $detail_url; 314 331 } 315 332 } 316 333 317 public static function get_auction_list_url($category_name) { 318 $page_id = get_option ( "dam_auction_list_page" ); 319 320 if (empty ( $page_id )) { 334 public static function get_auction_list_url($category_name) 335 { 336 $page_id = get_option("dam_auction_list_page"); 337 338 if (empty ($page_id)) { 321 339 return "javascript:nonepage();"; 322 340 } else { 323 341 324 $page_url = get_permalink ( $page_id);325 326 $result = add_query_arg(array("category" =>$category_name), $page_url);342 $page_url = get_permalink($page_id); 343 344 $result = add_query_arg(array("category" => $category_name), $page_url); 327 345 328 346 return $result; … … 330 348 } 331 349 332 public static function get_adjusted_auctions($items) { 333 334 if ($items && count ( $items ) > 0) { 335 336 $auctions = array (); 337 foreach ( $items as $auction ) { 350 public static function get_adjusted_auctions($items) 351 { 352 353 if ($items && count($items) > 0) { 354 355 $auctions = array(); 356 foreach ($items as $auction) { 338 357 $item = new stdClass (); 339 $item->title = (strlen ( $auction->title ) > 18) ? substr ( $auction->title, 0, 16) . '...' : $auction->title;358 $item->title = (strlen($auction->title) > 18) ? substr($auction->title, 0, 16) . '...' : $auction->title; 340 359 $item->alttitle = $auction->title; 341 360 $item->auction_link = get_permalink($auction->post_id); … … 343 362 $item->description = $auction->description; 344 363 $item->auction_ID = $auction->id; 345 $item->end = strtotime ( $auction->end ) - current_time ( 'timestamp');346 $item ->originalPrice = self::money_format ( $auction->original_price);347 $item->advicePrice = self::money_format ( $auction->start_price);348 $item->biddingPrice = self::money_format ( floatval($auction->bid_price) > 0 ? $auction->bid_price : $auction->start_price);364 $item->end = strtotime($auction->end) - current_time('timestamp'); 365 $item->originalPrice = self::money_format($auction->original_price); 366 $item->advicePrice = self::money_format($auction->start_price); 367 $item->biddingPrice = self::money_format(floatval($auction->bid_price) > 0 ? $auction->bid_price : $auction->start_price); 349 368 $item->category = $auction->category; 350 $item->start_time = date ( 'Y-m-d H:i', strtotime ( $auction->begin ));351 $item->started = strtotime ( $auction->begin ) <= current_time ( 'timestamp');369 $item->start_time = date('Y-m-d H:i', strtotime($auction->begin)); 370 $item->started = strtotime($auction->begin) <= current_time('timestamp'); 352 371 $auctions [] = $item; 353 372 } … … 359 378 } 360 379 361 public static function get_auctions($status, $category = null, $keyword = null) { 362 363 $total = SC_DataProvider::get_auction_count ( $category, $status, $keyword ); 380 public static function get_auctions($status, $category = null, $keyword = null) 381 { 382 383 $total = SC_DataProvider::get_auction_count($category, $status, $keyword); 364 384 365 385 $per_page = 20; 366 386 367 $items = SC_DataProvider::get_auction_list ( $category, $status, $per_page, 0, $keyword);387 $items = SC_DataProvider::get_auction_list($category, $status, $per_page, 0, $keyword); 368 388 369 389 $result = new stdClass (); … … 380 400 } 381 401 382 public static function get_auction_list($status, $category = null, $start = 0, $keyword = null) { 383 $total = SC_DataProvider::get_auction_count ( $category, $status, $keyword ); 402 public static function get_auction_list($status, $category = null, $start = 0, $keyword = null) 403 { 404 $total = SC_DataProvider::get_auction_count($category, $status, $keyword); 384 405 385 406 $per_page = 20; 386 407 387 $offset = $start + $per_page ; //alway start from second page.388 389 $items = SC_DataProvider::get_auction_list ( $category, $status, $per_page, $offset, $keyword);408 $offset = $start + $per_page; //alway start from second page. 409 410 $items = SC_DataProvider::get_auction_list($category, $status, $per_page, $offset, $keyword); 390 411 391 412 $result = new stdClass (); … … 411 432 } 412 433 413 public static function notify_to_admin($email, $auction, $email_template) { 414 415 if (! empty ( $email_template )) { 434 public static function notify_to_admin($email, $auction, $email_template) 435 { 436 437 if (!empty ($email_template)) { 416 438 417 439 $user_name = $auction->winner; 418 $last_bids_array = json_decode ( stripslashes ( $auction->last_bids ));440 $last_bids_array = json_decode(stripslashes($auction->last_bids)); 419 441 $admin_name = $last_bids_array [0]->user_name; 420 442 $auction_name = $auction->title; 421 443 422 444 $auction_detail_url = get_permalink($auction->post_id); 423 $data = array (445 $data = array( 424 446 "UserName" => $user_name, 425 447 "AdminName" => $admin_name, 426 448 "AuctionName" => $auction_name, 427 "SiteName" => get_option ( 'blogname'),428 "SiteUrl" => get_option ( 'siteurl'),449 "SiteName" => get_option('blogname'), 450 "SiteUrl" => get_option('siteurl'), 429 451 "Logo" => "", 430 452 "AuctionDate" => $auction->end, … … 433 455 ); 434 456 435 $email_template = self::apply_template ( $data, $email_template);457 $email_template = self::apply_template($data, $email_template); 436 458 $subject = $email_template['subject']; 437 459 $email_body = $email_template['content']; 438 460 439 $email = array (461 $email = array( 440 462 "to" => $email, 441 "from" => get_option ( 'dam_auction_admin'),442 "from_name" => get_option ( 'dam_auction_admin_name'),463 "from" => get_option('dam_auction_admin'), 464 "from_name" => get_option('dam_auction_admin_name'), 443 465 "subject" => $subject, 444 466 "body" => $email_body 445 467 ); 446 468 447 return self::sendEmail ( $email);469 return self::sendEmail($email); 448 470 } 449 471 return false; 450 472 } 451 473 452 public static function notify_to_user($email, $username, $auction, $email_template) { 453 require_once (ABSPATH . WPINC . '/class-phpmailer.php'); 454 455 if (! empty ( $email_template )) { 474 public static function notify_to_user($email, $username, $auction, $email_template) 475 { 476 require_once(ABSPATH . WPINC . '/class-phpmailer.php'); 477 478 if (!empty ($email_template)) { 456 479 457 480 $user_name = $username; … … 459 482 $auction_detail_url = get_permalink($auction->post_id); 460 483 461 $data = array (484 $data = array( 462 485 "UserName" => $user_name, 463 486 "AdminName" => get_option('dam_auction_admin_name'), 464 487 "AuctionName" => $auction_name, 465 "SiteName" => get_option ( 'blogname'),466 "SiteUrl" => get_option ( 'siteurl'),488 "SiteName" => get_option('blogname'), 489 "SiteUrl" => get_option('siteurl'), 467 490 "Logo" => "", 468 491 "AuctionDate" => $auction->end, … … 470 493 "Email" => $email 471 494 ); 472 $email_template = self::apply_template ( $data, $email_template);495 $email_template = self::apply_template($data, $email_template); 473 496 $subject = $email_template['subject']; 474 497 $email_body = $email_template['content']; 475 $email = array (498 $email = array( 476 499 "to" => $email, 477 "from" => get_option ( 'dam_auction_admin'),478 "from_name" => get_option ( 'dam_auction_admin_name'),500 "from" => get_option('dam_auction_admin'), 501 "from_name" => get_option('dam_auction_admin_name'), 479 502 "subject" => $subject, 480 503 "body" => $email_body 481 504 ); 482 505 483 return self::sendEmail ( $email);506 return self::sendEmail($email); 484 507 } 485 508 return false; 486 509 } 487 510 488 public static function apply_template($data, $template) { 489 if (! empty ( $template )) { 490 foreach ( $data as $key => $value ) { 491 if (is_string ( $value )) { 492 $template['subject'] = str_replace ( "[$key]", $value, $template['subject'] ); 493 $template['content'] = str_replace ( "[$key]", $value, $template['content'] ); 511 public static function apply_template($data, $template) 512 { 513 if (!empty ($template)) { 514 foreach ($data as $key => $value) { 515 if (is_string($value)) { 516 $template['subject'] = str_replace("[$key]", $value, $template['subject']); 517 $template['content'] = str_replace("[$key]", $value, $template['content']); 494 518 } else { 495 519 } … … 499 523 } 500 524 501 public static function sendEmail($email) { 502 require_once (ABSPATH . WPINC . '/class-phpmailer.php'); 525 public static function sendEmail($email) 526 { 527 require_once(ABSPATH . WPINC . '/class-phpmailer.php'); 503 528 $mail = new PHPMailer (); 504 $mail->AddAddress ( $email ["to"]);505 $mail->IsMail ();506 $mail->IsHTML ();529 $mail->AddAddress($email ["to"]); 530 $mail->IsMail(); 531 $mail->IsHTML(); 507 532 $mail->From = $email ["from"]; 508 533 $mail->FromName = $email ["from_name"]; 509 534 $mail->Subject = $email ["subject"]; 510 535 $mail->Body = $email ["body"]; 511 $rst = $mail->Send ();536 $rst = $mail->Send(); 512 537 return $rst; 513 538 } … … 517 542 global $current_user; 518 543 519 if (isset($user))544 if (isset($user)) 520 545 $current_user = $user; 521 546 else … … 525 550 return false; 526 551 527 $allow_bid_roles = get_option ( "dam_user_role", "subscriber");552 $allow_bid_roles = get_option("dam_user_role", "subscriber"); 528 553 $current_roles = $current_user->roles; 529 554 530 if(is_array($allow_bid_roles)) 531 { 532 $has_role = count(array_intersect($current_roles, $allow_bid_roles)) > 0 ; 533 }else 534 { 555 if (is_array($allow_bid_roles)) { 556 $has_role = count(array_intersect($current_roles, $allow_bid_roles)) > 0; 557 } else { 535 558 $has_role = in_array($allow_bid_roles, $current_roles); 536 559 } … … 539 562 } 540 563 541 public static function authenticated_place_bid($auction_id, $bid_price) { 564 public static function authenticated_place_bid($auction_id, $bid_price) 565 { 542 566 global $current_user; 543 get_currentuserinfo ();567 get_currentuserinfo(); 544 568 $result = new stdClass (); 545 569 $can_user_bid = self::can_user_bid(); … … 548 572 $userid = $current_user->ID; 549 573 $email = $current_user->user_email; 550 $result = SC_DataProvider::placeBid ( $auction_id, $bid_price, $userid, $name, $email);574 $result = SC_DataProvider::placeBid($auction_id, $bid_price, $userid, $name, $email); 551 575 } else { 552 576 $result->error = "unsign"; … … 555 579 } 556 580 557 public static function get_plugin_url() { 558 return plugin_dir_url ( __FILE__ ); 559 } 560 561 public static function unauthenticated_place_bid($auction_id, $bid_price) { 581 public static function get_plugin_url() 582 { 583 return plugin_dir_url(__FILE__); 584 } 585 586 public static function unauthenticated_place_bid($auction_id, $bid_price) 587 { 562 588 global $dam_cookie; 563 589 564 $user_name = $dam_cookie->value ( "user_name");565 $user_email = $dam_cookie->value ( "user_email");590 $user_name = $dam_cookie->value("user_name"); 591 $user_email = $dam_cookie->value("user_email"); 566 592 $result = new stdClass (); 567 if (! empty ( $user_name ) && ! empty ( $user_email)) {568 $result = SC_DataProvider::placeBid ( $auction_id, $bid_price, 0, $user_name, $user_email);593 if (!empty ($user_name) && !empty ($user_email)) { 594 $result = SC_DataProvider::placeBid($auction_id, $bid_price, 0, $user_name, $user_email); 569 595 } else { 570 596 $result->error = "unactived"; … … 576 602 { 577 603 $user_id = get_current_user_id(); 578 $address = SC_DataProvider::get_address($user_id,$auction_id); 579 if($address) 580 { 581 SC_DataProvider::updateAddress($data, compact('user_id','auction_id')); 582 }else{ 604 $address = SC_DataProvider::get_address($user_id, $auction_id); 605 if ($address) { 606 SC_DataProvider::updateAddress($data, compact('user_id', 'auction_id')); 607 } else { 583 608 $data['user_id'] = $user_id; 584 609 $data['auction_id'] = $auction_id; -
dutch-auction-masters/trunk/inc/Settings.php
r840348 r878480 81 81 ), 82 82 ), 83 ), 84 'dam_pay_url'=> array( 85 'label' => __('Pay url', self::TEXT_DOMAIN), 86 'type' => 'input', 87 'maxlength' => "355", 88 'required' => false, 89 'style'=>'width:300px', 90 'title' => __(' Pay url is required', self::TEXT_DOMAIN), 91 'description' => __('The url will change the default pay url.', self::TEXT_DOMAIN), 83 92 ), 84 93 'dam_auction_powered_by' => array( -
dutch-auction-masters/trunk/readme.txt
r842359 r878480 3 3 Tags: auction, auctioning, bidding, online auction, auction plugin, veiling, veilen, bieden, online veiling, veiling plugin, auction scripts, wordpress auction, wordpress auctioning, wp auction 4 4 Requires at least: 3.3 5 Tested up to: 3.8. 05 Tested up to: 3.8.1 6 6 License: GPLv2 or later 7 Stable tag: 1. 2.3.87 Stable tag: 1.6.1.0 8 8 9 9 Get ready for exciting online auctioning websites! … … 33 33 11. Show specified auction in a post or page. 34 34 12. Show hits of each auction on back office. 35 13. Compatible WordPress category. 36 14. Compatible WordPress comment. 37 15. Compatible WordPress tags. 38 16. Searchable Auction. 35 13. Compatible WordPress category. 36 14. Compatible WordPress comment. 37 15. Compatible WordPress tags. 38 16. Searchable Auction. 39 17. images zoom. 39 40 and there are more for you to experience... 40 41 … … 112 113 113 114 == Changelog == 115 1.7.0.0 114 116 115 = 1.6.0.0 = 117 * Add images zoom. 118 * Add front short code for my auctions (pro add ons ). 119 * Add front short code for shipping address (pro add ons ). 120 121 122 1.6.1.0 123 124 * Fixed bugs. 125 126 1.6.0.0 116 127 117 128 * Add a modules manage panel on settings. … … 122 133 * Reconstructed codex. 123 134 124 = 1.2.3.8 = 135 1.2.3.8 125 136 126 137 * Bugs fixing. 127 138 128 = 1.2.3.7 = 139 1.2.3.7 129 140 130 141 * Bugs fixing. 131 142 132 = 1.2.3.6 = 143 1.2.3.6 133 144 134 145 * Add new feature of configurable auction detail ui. … … 138 149 139 150 140 = 1.2.3.5 = 151 1.2.3.5 141 152 142 153 * UI improved. … … 156 167 157 168 158 = 1.2.3.2 = 169 1.2.3.2 159 170 160 171 * Fix PHP shortcode issue. … … 162 173 * Adjusted the icons. 163 174 164 = 1.2.3.1 = 175 1.2.3.1 165 176 166 177 * Bug fixing. 167 178 168 = 1.2.3 = 179 1.2.3 169 180 170 181 * Remove extra breaks from source code to solve compatibility issue. 171 182 * Fix image uploading. 172 183 173 = 1.2.2 = 184 1.2.2 174 185 175 186 * First version
Note: See TracChangeset
for help on using the changeset viewer.