Plugin Directory

Changeset 714737


Ignore:
Timestamp:
05/18/2013 05:11:45 AM (13 years ago)
Author:
Sanskript
Message:

0.95 Beta 2 Enhancement Added All Payload fields.
Improvement to sync.

Location:
soldpress/branches/0.9.5A
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • soldpress/branches/0.9.5A/adapter.php

    r712951 r714737  
    263263                $listingKey = $listing->post_name;
    264264                if($listingKey){ //If Someone manually adds a listing the key is wrong
    265                 if($meta)
    266                 {       
    267                     $this->WriteLog('Photo Record is Synced' .$meta . 'listingkey' .$listingKey );
    268                 }else
     265                    if($meta)
     266                    {       
     267                        //$this->WriteLog('Photo Record is Synced' .$meta . 'listingkey' .$listingKey );
     268                    }else
     269                    {
     270                       
     271                        $this->WriteLog('Meta' .$meta . 'listingkey' .$listingKey );
     272                        $this->WriteLog('Begin Picture Sync' . $post_id );
     273                        $this->sync_propertyobject($listingKey, 'Photo',$post_id);
     274                        update_post_meta($post_id,'sc-sync-picture', true);
     275                   
     276                    }               
     277                }
     278               
     279                $metaagent = get_post_meta( $post_id ,'sc-sync-picture-agent',true);
     280                $metaagent = false;
     281                if(!$metaagent)
    269282                {
    270                    
    271                     $this->WriteLog('Meta' .$meta . 'listingkey' .$listingKey );
    272                     $this->WriteLog('Begin Picture Sync' . $post_id );
    273                     $this->sync_propertyobject($listingKey, 'Photo',$post_id);
    274                     update_post_meta($post_id,'sc-sync-picture', true);
     283                    //List Agent
     284                   
     285                    $agentKey = get_post_meta( $post_id ,'dfd_ListAgentKey',true); 
     286                    $this->WriteLog('Begin Agent Picture Sync' . $post_id . 'AgentKey' . $agentKey);                   
     287                    $this->sync_agentobject($agentKey, 'ThumbnailPhoto',$post_id,'agent');
     288                   
     289                    //Co Agent
     290                    $coagentKey = get_post_meta( $post_id ,'dfd_CoListAgentKey',true);
     291                    if($coagentKey != "")
     292                    {                   
     293                        $this->WriteLog('Begin CoAgent Picture Sync' . $post_id . 'CoAgentKey' . $coagentKey);                 
     294                        $this->sync_agentobject($coagentKey, 'ThumbnailPhoto',$post_id,'coagent');
     295                        update_post_meta($post_id,'sc-sync-picture-agent', true,'coagent');
     296                    }
     297
     298                }
    275299               
    276                 }
     300                $metaoffice = get_post_meta( $post_id ,'sc-sync-picture-office',true);
     301                $metaoffice = false;
     302                if(!$metaoffice)
     303                {
     304                    //List Agent
     305                   
     306                    $officeKey = get_post_meta( $post_id ,'dfd_ListOfficeKey',true);   
     307                    $this->WriteLog('Begin Office Picture Sync' . $post_id . 'AgentKey' . $officeKey);                 
     308                    $this->sync_listingobject($officeKey, 'ThumbnailPhoto',$post_id,'office');
     309                   
    277310                }
    278311        }
     
    331364    }   
    332365   
     366    public function sync_agentobject($id, $type, $post_id,$metatype)
     367    {   
     368        $record = $this->service->GetObject("Agent", $type, $id);
     369        foreach($record as &$image)
     370        {   
     371            $filename = $id .'-agent-' . $type . '.jpg';               
     372            $wp_upload_dir = wp_upload_dir();
     373            $filePath = $wp_upload_dir['basedir']. '/soldpress/'.$filename;     
     374            file_put_contents($filePath,$image["Data"]); //We Change This In Settings
     375            update_post_meta($post_id,'sc-sync-picture-'.$metatype.'-file', $filename);     
     376        }   
     377       
     378        return true;
     379    }
     380   
     381    public function sync_listingobject($id, $type, $post_id)
     382    {   
     383        $record = $this->service->GetObject("Office", $type, $id);
     384        foreach($record as &$image)
     385        {   
     386            $filename = $id .'-listing-' . $type . '.jpg';             
     387            $wp_upload_dir = wp_upload_dir();
     388            $filePath = $wp_upload_dir['basedir']. '/soldpress/'.$filename;     
     389            file_put_contents($filePath,$image["Data"]); //We Change This In Settings
     390            update_post_meta($post_id,'sc-sync-picture-listing-file', $filename);                   
     391        }   
     392       
     393        return true;
     394    }
     395   
    333396    public function searchresidentialproperty($crit, $template, $culture)
    334397    {   
  • soldpress/branches/0.9.5A/settings.php

    r712951 r714737  
    125125                                    echo '<tr>';
    126126                                    //echo '<th scope="row" class="check-column"><input type="checkbox" name="schedules[]" class="entries" value="1"></th>';
    127                                     echo '<td><strong>'.$job.'</strong><div class="row-actions" style="margin:0; padding:0;"><a href="/wp-admin/options-general.php?page=soldpress&tab=sync_options&spa=runevt&job='.$job.'">Run Now</a> || <a href="/wp-admin/options-general.php?page=soldpress&tab=sync_options">Disable</a></div></td>';                               
     127                                    echo '<td><strong>'.$job.'</strong><div class="row-actions" style="margin:0; padding:0;"><a href="/wp-admin/options-general.php?page=soldpress&tab=sync_options&spa=runevt&job='.$job.'">Run Now</a></div></td>';                               
    128128                                    echo '<td>'.date("r", $key).'</td>';                           
    129129                                    $schedule = $value[key($value)];
     
    150150    <?php if( $active_tab == 'debug_options' ) {  ?>
    151151    <h3 class="title">Log File</h3>
    152     <a target="_blank" href="/wp-content/uploads/soldpress/soldpress-log.txt">debug log</a>
     152    <a target="_blank" href="wp-content/uploads/soldpress/soldpress-log.txt">debug log</a>
    153153    <h3 class="title">Debug</h3>
    154154     <div class = "postbox">
     
    184184                        <?php submit_button('Manual Sync', 'secondary', 'sync', false); ?>
    185185                        <?php submit_button('Clear Listings', 'secondary', 'delete', false); ?>
     186                        <?php submit_button('Delete Log', 'secondary', 'deletelog', false); ?>
    186187                    </form>
    187188            <?php if (get_option('sc-status' ) == true) { ?>
     
    202203            <div>&copy; 2013 Sanskript Solution, Inc.</div>
    203204        </p>
    204        
     205   
    205206    <?php
    206207        //Process Get Actions First
     
    248249        }
    249250       
     251        if (isset($_POST["deletelog"])) {   
     252                $wp_upload_dir = wp_upload_dir();
     253                unlink($wp_upload_dir['basedir']. '/soldpress/soldpress-log.txt');
     254        }
     255       
    250256        if (isset($_POST["delete"])) { 
    251257            $mycustomposts = get_posts( array( 'post_type' => 'sp_property', 'numberposts' => 500) );
  • soldpress/branches/0.9.5A/single-sp_property-t2.php

    r714386 r714737  
    1111        '2.3.1',
    1212        true);
     13       
    1314    wp_enqueue_script(
    1415        'jquery.cycle2',
     
    9899
    99100        .container-fluid {
    100 padding-right: 0px;
    101 padding-left: 0px;
    102 }
     101            padding-right: 0px;
     102            padding-left: 0px;
     103        }
    103104
    104105.cycle-prev, .cycle-next { position: absolute; top: 0; width: 30%; opacity: 0; filter: alpha(opacity=0); z-index: 800; height: 100%; cursor: pointer; }
     
    110111    </style>
    111112    <h2><?php the_title(); ?></h2> 
    112         <div class="well2">
    113             <div class="cycle-slideshow" data-cycle-fx="carousel" data-cycle-timeout="2000">
     113    <div class="well2">
     114        <div class="cycle-slideshow" data-cycle-fx="carousel" data-cycle-timeout="2000">
    114115            <div class="cycle-prev"></div>
    115116            <div class="cycle-next"></div>
    116                             <?php
    117                                 $photos = get_children( array('post_parent' => get_the_ID(), 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
    118                                 if($photos){
    119                                     foreach ($photos as $photo) {
    120                                         echo '<image src="' . wp_get_attachment_url($photo->ID,'thumbnail') . '">';
    121                                     }
    122                                 }
    123                             ?>         
    124                         </div>
    125             <div class="well3">
    126                         <div class="row">
    127                             <div class="span4">MLS®: <?php echo get_post_meta($post->ID,'dfd_ListingId',true); ?> </div>   
    128                             <div class="span4 pull-right"><span class="pull-right">For Sale: $<?php echo get_post_meta($post->ID,'dfd_ListPrice',true); ?></span></div>
    129                         </div>
    130                        
    131             </div> 
    132            
    133            
    134             <i class="icon-camera"></i><i class="icon-map-marker"></i>
    135         </div> 
     117            <?php
     118                $photos = get_children( array('post_parent' => get_the_ID(), 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
     119                if($photos){
     120                    foreach ($photos as $photo) {
     121                        echo '<image src="' . wp_get_attachment_url($photo->ID,'thumbnail') . '">';
     122                    }
     123                }
     124            ?>         
     125        </div>
     126        <div class="well3">
     127            <div class="row">
     128                <div class="span4">MLS®: <?php echo get_post_meta($post->ID,'dfd_ListingId',true); ?> </div>   
     129                <div class="span4 pull-right"><span class="pull-right"><strong>For Sale: $<?php echo get_post_meta($post->ID,'dfd_ListPrice',true); ?></strong></span></div>
     130            </div>                 
     131        </div>     
     132        <img src="http://www.realtor.ca/presentation/images/en-CA/various/realtor.jpg"> MLS®
     133    </div> 
    136134    <div class="container-fluid">   
    137135        <div class="row-fluid">
    138136            <div class="span8">
    139137                <div class="well3">                                 
    140                     <table class="table">
    141                          <caption><?php echo get_post_meta($post->ID,'dfd_UnparsedAddress',true); ?> , <?php echo get_post_meta($post->ID,'dfd_City',true); ?> , <?php echo get_post_meta($post->ID,'dfd_StateOrProvince',true); ?> <?php echo get_post_meta($post->ID,'dfd_PostalCode',true); ?></caption>
    142                             <tbody>
    143                                 <tr>
    144                                     <td><span class="sp_key">Bathrooms</span><span><?php echo get_post_meta($post->ID,'dfd_BathroomsTotal',true);?></span></td>
    145                                     <td><span class="sp_key">Bedrooms</span><span><?php echo get_post_meta($post->ID,'dfd_BedroomsTotal',true);?></span></td>
    146                                 </tr>
    147                                 <tr>
    148                                     <td><span class="sp_key">Property Type</span><span><?php echo get_post_meta($post->ID,'dfd_PropertyType',true);?></span></td>
    149                                     <td><span class="sp_key">Built in</span><span><?php echo get_post_meta($post->ID,'dfd_YearBuilt',true);?></span></td>
    150                                 </tr>
    151                                 <tr>
    152                                     <td><span class="sp_key">LotSize</span><span><?php echo get_post_meta($post->ID,'dfd_LotSizeArea',true); ?> <?php echo get_post_meta($post->ID,'dfd_LotSizeUnits',true); ?></span></td>
    153                                     <td><span class="sp_key">Building Area</span><span><?php echo get_post_meta($post->ID,'dfd_BuildingAreaTotal',true); ?> <?php echo get_post_meta($post->ID,'dfd_BuildingAreaUnits',true); ?></span></td>
    154                                 </tr>                                           
    155                             </tbody>
    156                     </table>
    157138                        <?php
    158139               
     
    161142                echo '<table class="table"><caption>' . get_post_meta($post->ID,'dfd_UnparsedAddress',true) . ',' . get_post_meta($post->ID,'dfd_City',true) . ',' . get_post_meta($post->ID,'dfd_StateOrProvince',true) . get_post_meta($post->ID,'dfd_PostalCode',true) . '</caption><tbody>';
    162143                echo '<tr>';
    163                 $array = array("dfd_BathroomsTotal" => "Bathrooms", "dfd_BedroomsTotal" => "Bedrooms", "dfd_PropertyType" => "Property Type","dfd_PropertyType" => "Attached Garage", "dfd_YearBuilt" => "Built in", "dfd_LotSizeArea" => "LotSize","dfd_BuildingAreaTotal" => "Building Area");
     144                $array = array("dfd_BathroomsTotal" => "Bathrooms", "dfd_BedroomsTotal" => "Bedrooms", "dfd_PropertyType" => "Property Type","dfd_YearBuilt" => "Built in", "dfd_LotSizeArea" => "LotSize","dfd_BuildingAreaTotal" => "Building Area");
    164145                foreach ($array as $i => $value) {
    165146                    if ($item_count == $max_per_row)
     
    170151                    $meta = get_post_meta($post->ID,$i,true);
    171152                    $meta = trim($meta,",");
    172                     if($meta != "0"){   
    173                             if($meta != ""){
    174                                 $name = $value;
    175                                 echo '<td><span class="sp_key">' .$name.'</span><span>' .$meta .'</span></td>';                 
    176                                 $item_count++; 
    177                             }                           
    178                         }
     153                                   
     154                    if($meta != "0"){
     155                        if($meta != ""){
     156                            if($i == 'dfd_LotSizeArea'){
     157                                $meta =  $meta . ' ' .get_post_meta($post->ID,'dfd_LotSizeUnits',true);
     158                            }
     159                   
     160                            if($i == 'dfd_BuildingAreaTotal'){
     161                                $meta =  $meta . ' ' .get_post_meta($post->ID,'dfd_BuildingAreaUnits',true);
     162                            }
     163                           
     164                            $name = $value;
     165                            echo '<td><span class="sp_key">' .$name.'</span><span>' .$meta .'</span></td>';                 
     166                            $item_count++; 
     167                        }                           
     168                    }
    179169                }
    180170                if ($item_count != $max_per_row )
     
    211201                echo '<table class="table"><caption>Details</caption><tbody>';
    212202                echo '<tr>';
    213                 $array = array("dfd_GarageYN" => "Garage", "dfd_CarportYN" => "Carport", "dfd_CoveredSpaces" => "Coverd Spaces","dfd_AttachedGarageYN" => "Attached Garage", "dfd_OpenParkingYN" => "Open Parking", "dfd_LotFeatures" => "Features","dfd_WaterfrontYN" => "Waterfront","dfd_PoolYN" => "Pool");
     203                $array = array("dfd_GarageYN" => "Garage",
     204                    "dfd_CarportYN" => "Carport",
     205                    "dfd_CarportSpaces" => "Carport Spaces",
     206                    "dfd_CoveredSpaces" => "Coverd Spaces",
     207                    "dfd_AttachedGarageYN" => "Attached Garage",
     208                    "dfd_OpenParkingYN" => "Open Parking",
     209                    "dfd_OpenParkingSpaces" => "Open Parking Spaces",
     210                    "dfd_ParkingTotal" => "Parking Total",
     211                    "dfd_GarageYN" => "Garage",
     212                    "dfd_LotFeatures" => "Features",
     213                    "dfd_WaterfrontYN" => "Waterfront",             
     214                    "dfd_ArchitecturalStyle" => "Architectural Style",
     215                    ,"dfd_CommunityFeatures" => "Community Features",
     216                    ,"dfd_ConstructionMaterials" => "Construction Materials",
     217                    ,"dfd_Fencing" => "Fencing",
     218                    ,"dfd_FrontageLength" => "Frontage Length",
     219                    ,"dfd_FrontageType" => "Frontage Type",
     220                    ,"dfd_GreenBuildingCertification" => "Green Building Certification",
     221                    ,"dfd_GreenCertificationRating" => "Green CertificationRating",
     222                    ,"dfd_Roof" => "Roof",
     223                    ,"dfd_View" => "View",
     224                    ,"dfd_ViewYN" => "View",
     225                    ,"dfd_WaterBodyName" => "Water Body Name",
     226                    ,"dfd_WaterfrontYN" => "Waterfront",
     227                    ,"dfd_Zoning" => "Zoning");
    214228                foreach ($array as $i => $value) {
    215229                    if ($item_count == $max_per_row)
     
    248262                    echo '<table class="table"><caption>Building</caption><tbody>';
    249263                    echo '<tr>';
    250                     $array = array("dfd_BathroomsHalf" => "Bathrooms(Half)", "dfd_Flooring" => "Flooring", "dfd_Cooling" => "Cooling","dfd_Heating" => "Heating", "dfd_HeatingFuel" => "Heating Fuel", "dfd_FireplaceFuel" => "Fireplace Fuel","dfd_FireplaceFeatures" => "Fireplace Features","dfd_FireplacesTotal" => "Fireplaces");
     264                                   
     265                    $array = array("dfd_BathroomsHalf" => "Bathrooms(Half)",
     266                    "dfd_Flooring" => "Flooring",
     267                    "dfd_Cooling" => "Cooling",
     268                    "dfd_CoolingYN" => "CoolingYN",
     269                    "dfd_Heating" => "Heating",
     270                    "dfd_HeatingFuel" => "Heating Fuel",
     271                    "dfd_FireplaceFuel" => "Fireplace Fuel",
     272                    "dfd_FireplacesTotal" => "Fireplaces",
     273                    "dfd_Levels" => "Levels",
     274                    "dfd_NumberOfUnitsTotal" => "Number Of Units Total",
     275                    "dfd_PoolYN" => "Pool",                 
     276                    "dfd_PoolFeatures" => "Pool Features",
     277                    "dfd_Sewer" => "Sewer",
     278                    "dfd_Stories" => "Stories");
     279                   
    251280                    foreach ($array as $i => $value) {
    252281                        if ($item_count == $max_per_row)
     
    300329                                ?>
    301330                        </tbody>
    302                     </table>
    303                    
    304                     <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&"></script> <!-- &language=ja -->
     331                </table>                   
     332                <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&"></script> <!-- &language=ja -->
    305333                <script>
    306334                    // Enable the visual refresh
     
    348376                   
    349377                    google.maps.event.addDomListener(window, 'load', initialize);
    350                 </script>
    351 
    352                
     378                </script>               
    353379                <table class="table table-striped table-condensed ">
    354380                         <caption>Map</caption>
     
    368394                <div class="row-fluid">
    369395                    <div class="well3 span12">
     396                        <?php if(get_post_meta($post->ID,'sc-sync-picture-agent',true) != ''){ ?>
     397                            <img src="<?php $wp_upload_dir = wp_upload_dir();  echo $wp_upload_dir[baseurl] .'/soldpress/'. get_post_meta($post->ID,'sc-sync-picture-agent-file',true); ?>">
     398                        <?php }?>
    370399                        <address>
    371400                          <strong><?php echo get_post_meta($post->ID,'dfd_ListAgentFullName',true); ?></strong><br>
     
    387416                        <?php }?>
    388417                        </address>
     418                        <?php if(get_post_meta($post->ID,'sc-sync-picture-office',true) != ''){ ?>
     419                            <img src="<?php $wp_upload_dir = wp_upload_dir();  echo $wp_upload_dir[baseurl] .'/soldpress/'. get_post_meta($post->ID,'sc-sync-picture-office-file',true); ?>">
     420                        <?php }?>
    389421                        <address>
    390422                        <small><?php echo get_post_meta($post->ID,'dfd_ListOfficeName',true); ?></small></br>
     
    398430                <div class="row-fluid">         
    399431                    <div class="well3 span12"> 
    400                         <!-- Co Agent -->
     432                        <?php if(get_post_meta($post->ID,'sc-sync-picture-agent',true) != ''){ ?>
     433                            <img src="<?php $wp_upload_dir = wp_upload_dir();  echo $wp_upload_dir[baseurl] .'/soldpress/'. get_post_meta($post->ID,'sc-sync-picture-coagent-file',true); ?>">
     434                        <?php }?>
    401435                        <address>
    402436                            <strong><?php echo get_post_meta($post->ID,'dfd_CoListAgentFullName',true); ?></strong><br>
     
    442476<p><small>
    443477©1998-2013 The Canadian Real Estate Association. All rights reserved. MLS®, Multiple Listing Service®, and all related graphics are trademarks of The Canadian Real Estate Association. REALTOR®, REALTORS®, and all related graphics are trademarks of REALTOR® Canada Inc. a corporation owned by The Canadian Real Estate Association and the National Association of REALTORS®.</small> </p>
    444 <p><small>©2013 Sanskript Solutions, Inc. All rights reserved. Powered by SoldPress.</small></p>
     478<p><small>Powered by SoldPress. ©2013 Sanskript Solutions, Inc. All rights reserved. </small></p>
    445479<?php get_footer(); ?>
    446480<script src="http://malsup.github.com/jquery.cycle2.carousel.js"></script>
  • soldpress/branches/0.9.5A/soldpress.php

    r712951 r714737  
    44Plugin URI: http://www.sanskript.com/products/soldpress
    55Description: SoldPress is a WordPress plugin to enable CREA’s members to easily disseminate MLS® listing content on WordPress Sites.
    6 Version:  0.9.5 Beta
     6Version:  0.9.5.2 Beta
    77Author: Amer Gill
    88Author URI: http://www.sanskript.com
     
    6161       
    6262        //Schedule The Events
    63         wp_schedule_event( time(), 'twicedaily', 'soldpress_listing_sync');
     63        wp_schedule_event( time(), 'daily', 'soldpress_listing_sync');
    6464        wp_schedule_event( time(), 'hourly', 'soldpress_photo_sync');
    6565       
     
    8080        }else
    8181        {
    82             $date = $lastupdate ;
    83             $date->add(new DateInterval('P' . 1 . 'D'));
     82            $date = new DateTime();
     83            //$date = $lastupdate ;         
     84            //$date->add(new DateInterval('P' . 1 . 'D'));
    8485            update_option( 'sc-lastupdate', $date);
    8586        }
Note: See TracChangeset for help on using the changeset viewer.