Plugin Directory

Changeset 878480


Ignore:
Timestamp:
03/20/2014 02:32:31 AM (12 years ago)
Author:
vellengs
Message:

Add image zoom.

Location:
dutch-auction-masters/trunk
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • dutch-auction-masters/trunk/assets/css/front.css

    r840348 r878480  
    280280}
    281281
    282 .auction-detail .main-pic-wrap
    283 {
    284     width: 290px;
    285     height:300px;
    286 }
    287 
    288 .auction-detail .main-pic-wrap > img
    289 {
    290     max-width: 290px;
    291     max-height:290px;
    292 }
    293 
    294 
    295282.main-pic-wrap.no-pics
    296283{
     
    468455    max-height:150px;
    469456}
     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  
    66 * Author: Dutch auction masters team.
    77 * Author URI: http://www.dutchauctionmasters.com/
    8  * Version: 1.6.1.0
     8 * Version: 1.7.0.0
    99 * Copyright (c) 2013 Second Company B.V. http://www.secondcompany.nl/
    1010*/
     
    2020    {
    2121        #region constance
    22         const PLUGIN_VERSION = "1.6.1.0";
     22        const PLUGIN_VERSION = "1.7.0.0";
    2323        const CRON_JOB_INTERVAL = 5;
    2424        const TEXT_DOMAIN = "dam-auction-masters";
     
    140140                    ), //front.css
    141141                    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(
    142154                        'handle' => 'admin.css',
    143155                        'src' => $this->pluginUri . 'assets/css/admin.css',
     
    182194                        'in_footer' => true,
    183195                    ), //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                    ),
    184203                    array(
    185204                        'handle' => 'admin.js',
  • dutch-auction-masters/trunk/inc/CustomPost.php

    r840348 r878480  
    88    {
    99        const TEXT_DOMAIN = "dam-auction-masters";
    10         const DAM_AUCTION ="dam_auction";
     10        const DAM_AUCTION = "dam_auction";
    1111        public $customPostTypes;
    1212        public $auctions;
     
    4444            add_action('wp_trash_post', array($this, 'trashCustomPost'));
    4545            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        }
    4948
    5049
    5150        public function displayWarningMessage()
    5251        {
    53             if(isset($_GET['post']))
    54             {
     52            if (isset($_GET['post'])) {
    5553                $id = $_GET['post'];
    5654                $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") {
    5956                    $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>";
    6158                }
    6259            }
     
    110107        {
    111108            $post = get_post($post_id);
    112             if ($post->post_type == self::DAM_AUCTION ) {
     109            if ($post->post_type == self::DAM_AUCTION) {
    113110                $default = array(
    114111                    'id' => 0,
     
    150147                }
    151148
    152                 if($post->post_status == "publish")
    153                 {
     149                if ($post->post_status == "publish") {
    154150                    $item['notified'] = 0;
    155151                    $item['winner'] = '';
     
    244240            $fieldRequires = array(
    245241                'original_price' => true,
    246             //  'reserve_price' => true,
     242                //  'reserve_price' => true,
    247243                'shipping_fee' => true,
    248244                'start_price' => true,
     
    271267        private function getValue($postId, $columnName)
    272268        {
    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) {
    276271                    if ($auction->post_id == $postId) {
    277272                        if ($columnName == "picture") {
     
    281276                        } else if ($columnName == "last_bids") {
    282277                            return SC_functions::displayLastBids((array)$auction);
    283                         }  else if ($columnName == "winner") {
     278                        } else if ($columnName == "winner") {
    284279                            return $this->displayWinner((array)$auction);
    285                         }else {
     280                        } else {
    286281                            return $auction->$columnName;
    287282                        }
     
    295290        {
    296291            $result = "";
    297             if (  $auction ['deal_state'] == DealState::PAID && $auction ['winner']) {
     292            if ($auction ['deal_state'] == DealState::PAID && $auction ['winner']) {
    298293                $address = SC_DataProvider::get_address_by_auction_id($auction['id']);
    299294                if ($address) {
  • dutch-auction-masters/trunk/inc/DataProvider.php

    r840348 r878480  
    889889            return false;
    890890        }
     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        }
    891907    }
    892908}
  • dutch-auction-masters/trunk/inc/DefaultViews.php

    r840348 r878480  
    189189                //-->
    190190            </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>
    191209        <?php
    192210        }
     
    212230            }
    213231            $src = preg_replace('/-\d+x\d+/', '', $picture);
     232            $title = $auction->title;
    214233            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
    219236            if(isset($pictures) && $display_pictures)
    220237            {
     238                $first = true;
    221239                echo "<ul>";
    222240                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                }
    224248                echo "</ul>";
    225249            }
  • dutch-auction-masters/trunk/inc/Functions.php

    r840348 r878480  
    4242        }
    4343
     44        public static function frontTimeFormat($time)
     45        {
     46            return $time; //TODO
     47        }
     48
    4449        public static function displayLastBids($auction)
    4550        {
     
    4752            $last_bids = $auction['last_bids'];
    4853            $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);
    5257                $result .= "<a href='./admin.php?page=dam_auction_masters_bids&auctionid=$auction_id'>$text</a>";
    5358                $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> &nbsp; <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> &nbsp; <span>" . $bid->price . " </span> <span>$bid->user_name </span> </li>";
    5962                    }
    6063                }
     
    6770        {
    6871            $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),
    7376            );
    74             $begin = strtotime ( $auction ['begin'] );
    75             $end = strtotime ( $auction ['end'] );
     77            $begin = strtotime($auction ['begin']);
     78            $end = strtotime($auction ['end']);
    7679            $status = $auction ['status'];
    77             $current_time =  current_time ( 'timestamp' );
     80            $current_time = current_time('timestamp');
    7881            $display_name = null;
    7982            if ($status == AuctionStatus::NORMAL) {
    8083                if ($begin > $current_time) {
    81                     $display_name = __ ( "Upcoming", DutchAuctionMasters::TEXT_DOMAIN );
     84                    $display_name = __("Upcoming", DutchAuctionMasters::TEXT_DOMAIN);
    8285                } 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 {
    8891                $display_name = $mapping[$status];
    8992            }
    90             return '<b>' .$display_name . '</b>';
     93            return '<b>' . $display_name . '</b>';
    9194        }
    9295
     
    9497        {
    9598            $picture = $auction->$columnName;
    96             if (strpos($picture, ',')!== false) {
     99            if (strpos($picture, ',') !== false) {
    97100                $pictures = explode(',', $picture);
    98101                $picture = $pictures[0];
     
    104107        public static function getRelatedPostIdsByTag($auction, $limit = 5)
    105108        {
    106             if(empty($auction))
     109            if (empty($auction))
    107110                return null;
    108111
     
    110113            $tags = array_filter($tags);
    111114
    112             $categories = explode(',',$auction->category);
     115            $categories = explode(',', $auction->category);
    113116            $categories = array_filter($categories);
    114117
    115118            $args = array(
    116                 'numberposts'=> $limit,
     119                'numberposts' => $limit,
    117120                'post_type' => 'dam_auction',
    118                 'exclude'=> $auction->post_id,
     121                'exclude' => $auction->post_id,
    119122                'tax_query' => array(
    120123                    'relation' => 'OR',
     
    130133                    ),
    131134                ),
    132                 'fields'=> 'ids',
     135                'fields' => 'ids',
    133136            );
    134137            $postIds = get_posts($args);
     
    138141        public static function getRelatedAuction($auction_id, $limit = null)
    139142        {
    140             if(!$auction_id)
     143            if (!$auction_id)
    141144                return false;
    142145            $auction = SC_DataProvider::get_auction($auction_id);
    143146            $postIds = self::getRelatedPostIdsByTag($auction, $limit);
    144             if(count($postIds)>0)
    145             {
     147            if (count($postIds) > 0) {
    146148                $auctions = SC_DataProvider::getAuctionByPostIds($postIds);
    147149                return $auctions;
    148             }else{
     150            } else {
    149151                return false;
    150152            }
     
    158160                'post_author' => 1,
    159161                '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,
    163165                'post_status' => 'future',
    164                 'post_title' => ucfirst($title) ,
    165                 'post_type' =>  'page' ,
     166                'post_title' => ucfirst($title),
     167                'post_type' => 'page',
    166168            );
    167             $page_id = wp_insert_post( $post );
     169            $page_id = wp_insert_post($post);
    168170            return $page_id;
    169171        }
     
    171173        public static function getMainPictureUrl($picture)
    172174        {
    173             if(strpos($picture, ',') !== false)
    174             {
     175            if (strpos($picture, ',') !== false) {
    175176                $pictures = explode(',', $picture);
    176177                $picture = $pictures[0];
     
    182183        {
    183184            global $current_user;
    184             get_current_user ();
     185            get_current_user();
    185186
    186187            $new_state = SC_DataProvider::updateDealState($auction_id, DealState::ACCEPTED, DealState::DELIVERED, $current_user->ID);
     
    197198        {
    198199            global $current_user;
    199             get_current_user ();
     200            get_current_user();
    200201
    201202            $new_state = SC_DataProvider::updateDealState($auction_id, DealState::PAYING, null, $current_user->ID);
     
    211212        public static function is_active_auction_page($page)
    212213        {
    213             $current = isset($_REQUEST["state"])? $_REQUEST["state"]:'';
    214             if($page == $current)
    215             {
     214            $current = isset($_REQUEST["state"]) ? $_REQUEST["state"] : '';
     215            if ($page == $current) {
    216216                return "active";
    217217            }
     
    219219        }
    220220
    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");
    223224            $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"), ',');
    233235        }
    234236
     
    236238        {
    237239            $bids = SC_DataProvider::get_last_bids($auctionId, $bidCount);
    238             return self::formatBids($bids,$hidePartialName);
     240            return self::formatBids($bids, $hidePartialName);
    239241        }
    240242
     
    244246                foreach ($bids as $bid) {
    245247                    $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);
    248250                }
    249251            }
     
    251253        }
    252254
    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', '&euro;' );
    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', '&euro;');
     260
     261            $money = number_format($number, 2, $decimal_point, $thousands_sep);
    259262            return $symbol . ' ' . $money;
    260263        }
    261264
    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);
    265269                return $winner->id;
    266270            }
     
    268272        }
    269273
    270         public static function Is_winner($auction) {
     274        public static function Is_winner($auction)
     275        {
    271276            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);
    275280
    276281            if ($winner_id == $current_user->ID) {
     
    280285        }
    281286
    282         public static function get_auction_closed_message($auction) {
     287        public static function get_auction_closed_message($auction)
     288        {
    283289            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');
    286292            $closed = $left_time < 0;
    287293            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);
    290296                    if ($is_winner) {
    291297                        $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);
    293299                    } 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");
    295301                    }
    296302                } 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 : "";
    301307            return $message;
    302308        }
    303309
    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)) {
    308325                return "javascript:nonepage();";
    309326            } else {
    310327
    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);
    313330                return $detail_url;
    314331            }
    315332        }
    316333
    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)) {
    321339                return "javascript:nonepage();";
    322340            } else {
    323341
    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);
    327345
    328346                return $result;
     
    330348        }
    331349
    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) {
    338357                    $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;
    340359                    $item->alttitle = $auction->title;
    341360                    $item->auction_link = get_permalink($auction->post_id);
     
    343362                    $item->description = $auction->description;
    344363                    $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);
    349368                    $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');
    352371                    $auctions [] = $item;
    353372                }
     
    359378        }
    360379
    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);
    364384
    365385            $per_page = 20;
    366386
    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);
    368388
    369389            $result = new stdClass ();
     
    380400        }
    381401
    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);
    384405
    385406            $per_page = 20;
    386407
    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);
    390411
    391412            $result = new stdClass ();
     
    411432        }
    412433
    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)) {
    416438
    417439                $user_name = $auction->winner;
    418                 $last_bids_array = json_decode ( stripslashes ( $auction->last_bids ) );
     440                $last_bids_array = json_decode(stripslashes($auction->last_bids));
    419441                $admin_name = $last_bids_array [0]->user_name;
    420442                $auction_name = $auction->title;
    421443
    422444                $auction_detail_url = get_permalink($auction->post_id);
    423                 $data = array (
     445                $data = array(
    424446                    "UserName" => $user_name,
    425447                    "AdminName" => $admin_name,
    426448                    "AuctionName" => $auction_name,
    427                     "SiteName" => get_option ( 'blogname' ),
    428                     "SiteUrl" => get_option ( 'siteurl' ),
     449                    "SiteName" => get_option('blogname'),
     450                    "SiteUrl" => get_option('siteurl'),
    429451                    "Logo" => "",
    430452                    "AuctionDate" => $auction->end,
     
    433455                );
    434456
    435                 $email_template = self::apply_template ( $data, $email_template );
     457                $email_template = self::apply_template($data, $email_template);
    436458                $subject = $email_template['subject'];
    437459                $email_body = $email_template['content'];
    438460
    439                 $email = array (
     461                $email = array(
    440462                    "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'),
    443465                    "subject" => $subject,
    444466                    "body" => $email_body
    445467                );
    446468
    447                 return self::sendEmail ( $email );
     469                return self::sendEmail($email);
    448470            }
    449471            return false;
    450472        }
    451473
    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)) {
    456479
    457480                $user_name = $username;
     
    459482                $auction_detail_url = get_permalink($auction->post_id);
    460483
    461                 $data = array (
     484                $data = array(
    462485                    "UserName" => $user_name,
    463486                    "AdminName" => get_option('dam_auction_admin_name'),
    464487                    "AuctionName" => $auction_name,
    465                     "SiteName" => get_option ( 'blogname' ),
    466                     "SiteUrl" => get_option ( 'siteurl' ),
     488                    "SiteName" => get_option('blogname'),
     489                    "SiteUrl" => get_option('siteurl'),
    467490                    "Logo" => "",
    468491                    "AuctionDate" => $auction->end,
     
    470493                    "Email" => $email
    471494                );
    472                 $email_template = self::apply_template ( $data, $email_template );
     495                $email_template = self::apply_template($data, $email_template);
    473496                $subject = $email_template['subject'];
    474497                $email_body = $email_template['content'];
    475                 $email = array (
     498                $email = array(
    476499                    "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'),
    479502                    "subject" => $subject,
    480503                    "body" => $email_body
    481504                );
    482505
    483                 return self::sendEmail ( $email );
     506                return self::sendEmail($email);
    484507            }
    485508            return false;
    486509        }
    487510
    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']);
    494518                    } else {
    495519                    }
     
    499523        }
    500524
    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');
    503528            $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();
    507532            $mail->From = $email ["from"];
    508533            $mail->FromName = $email ["from_name"];
    509534            $mail->Subject = $email ["subject"];
    510535            $mail->Body = $email ["body"];
    511             $rst = $mail->Send ();
     536            $rst = $mail->Send();
    512537            return $rst;
    513538        }
     
    517542            global $current_user;
    518543
    519             if(isset($user))
     544            if (isset($user))
    520545                $current_user = $user;
    521546            else
     
    525550                return false;
    526551
    527             $allow_bid_roles = get_option ( "dam_user_role", "subscriber" );
     552            $allow_bid_roles = get_option("dam_user_role", "subscriber");
    528553            $current_roles = $current_user->roles;
    529554
    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 {
    535558                $has_role = in_array($allow_bid_roles, $current_roles);
    536559            }
     
    539562        }
    540563
    541         public static function authenticated_place_bid($auction_id, $bid_price) {
     564        public static function authenticated_place_bid($auction_id, $bid_price)
     565        {
    542566            global $current_user;
    543             get_currentuserinfo ();
     567            get_currentuserinfo();
    544568            $result = new stdClass ();
    545569            $can_user_bid = self::can_user_bid();
     
    548572                $userid = $current_user->ID;
    549573                $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);
    551575            } else {
    552576                $result->error = "unsign";
     
    555579        }
    556580
    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        {
    562588            global $dam_cookie;
    563589
    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");
    566592            $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);
    569595            } else {
    570596                $result->error = "unactived";
     
    576602        {
    577603            $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 {
    583608                $data['user_id'] = $user_id;
    584609                $data['auction_id'] = $auction_id;
  • dutch-auction-masters/trunk/inc/Settings.php

    r840348 r878480  
    8181                        ),
    8282                    ),
     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),
    8392                ),
    8493                'dam_auction_powered_by' => array(
  • dutch-auction-masters/trunk/readme.txt

    r842359 r878480  
    33Tags: auction, auctioning, bidding, online auction, auction plugin, veiling, veilen, bieden, online veiling, veiling plugin, auction scripts, wordpress auction, wordpress auctioning, wp auction
    44Requires at least: 3.3
    5 Tested up to: 3.8.0
     5Tested up to: 3.8.1
    66License: GPLv2 or later
    7 Stable tag: 1.2.3.8
     7Stable tag: 1.6.1.0
    88
    99Get ready for exciting online auctioning websites!
     
    3333    11. Show specified auction in a post or page.
    3434    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.
    3940    and there are more for you to experience...
    4041
     
    112113
    113114== Changelog ==
     1151.7.0.0
    114116
    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
     1221.6.1.0
     123
     124*  Fixed bugs.
     125
     1261.6.0.0
    116127
    117128*  Add a modules manage panel on settings.
     
    122133*  Reconstructed codex.
    123134
    124 = 1.2.3.8 =
     1351.2.3.8
    125136
    126137* Bugs fixing.
    127138
    128 = 1.2.3.7 =
     1391.2.3.7
    129140
    130141*   Bugs fixing.
    131142
    132 = 1.2.3.6 =
     1431.2.3.6
    133144
    134145*   Add new feature of configurable auction detail ui.
     
    138149
    139150
    140 = 1.2.3.5 =
     1511.2.3.5
    141152
    142153*   UI improved.
     
    156167   
    157168
    158 = 1.2.3.2 =
     1691.2.3.2
    159170
    160171*   Fix PHP shortcode issue.
     
    162173*   Adjusted the icons.
    163174
    164 = 1.2.3.1 =
     1751.2.3.1
    165176
    166177*   Bug fixing.
    167178
    168 = 1.2.3 =
     1791.2.3
    169180   
    170181*   Remove extra breaks from source code to solve compatibility issue.
    171182*   Fix image uploading.
    172183
    173 = 1.2.2 =
     1841.2.2
    174185
    175186*   First version
Note: See TracChangeset for help on using the changeset viewer.