Changeset 708983
- Timestamp:
- 05/07/2013 02:27:16 AM (13 years ago)
- Location:
- soldpress/branches/0.9.5A
- Files:
-
- 6 edited
-
adapter.php (modified) (9 diffs)
-
custom_field_types.php (modified) (3 diffs)
-
settings.php (modified) (6 diffs)
-
single-property.php (modified) (1 diff)
-
soldpress.php (modified) (5 diffs)
-
template/template.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
soldpress/branches/0.9.5A/adapter.php
r704538 r708983 17 17 $this->log = new Logging(); 18 18 $wp_upload_dir = wp_upload_dir(); 19 $this->log->lfile($wp_upload_dir[ basedir]. '/soldpress/soldpress-log.txt');19 $this->log->lfile($wp_upload_dir['basedir']. '/soldpress/soldpress-log.txt'); 20 20 21 21 $this->service= new phRETS(); … … 26 26 27 27 $cookie_file = 'soldpress'; 28 @touch( cookie_file);29 if (is_writable( cookie_file)) {28 @touch('cookie_file'); 29 if (is_writable('cookie_file')) { 30 30 $this->service->SetParam('cookie_file', 'soldpress'); 31 31 } … … 106 106 107 107 public function sync_residentialproperty($crit, $culture) 108 { 109 110 //OPTIMIXATION: Get All Listing That Are Type property in a Array 111 $this->WriteLog('OPTIMIXATION'); 112 $args2 = array( 113 'post_type' => 'property' 114 ); 115 116 $this->WriteLog('Get Data from service'); 117 $posts_array2 = get_posts( $args2 ); // This can be optimized. //Reterive Only Once 118 $this->WriteLog('Data Get'); 119 var_dump(count($posts_array2)); 120 //var_dump($posts_array2); 108 { 109 $this->WriteLog('Sync Start'); 121 110 global $wpdb; 122 $privates = $wpdb->get_results("select ID,post_name from $wpdb->posts where post_type = 'property'"); 123 var_dump(count($privates)); 124 var_dump($privates); 125 126 //11937214 127 128 // SELECT *,$wpdb->postmeta FROM $wpdb->posts $wpdb->postmeta WHERE $wpdb->posts.post_type = 'property'; 129 130 // AND $wpdb->postmeta.meta_key = 'key1' 131 // AND $wpdb->postmeta.meta_value = 'value1'*/ 132 return; 133 111 $wpdb->query("set wait_timeout = 1200"); //Thank You (johnorourke) http://stackoverflow.com/questions/14782494/keep-losing-the-database-in-wordpress 112 $syncenabled = get_option("sc-sync-enabled",true); 113 if($syncenabled != true){ 114 $this->WriteLog('Sync Disabled'); 115 return; 116 } 117 134 118 //Get Time 135 119 //Get Culture … … 138 122 update_option( 'sc-sync-start',time() ); 139 123 update_option( 'sc-sync-end','' ); 140 141 $this->WriteLog('Sync Start');142 143 echo $crit;144 124 145 125 if($culture =='') … … 148 128 } 149 129 150 $this->WriteLog('Getting Results'); 151 152 $results = $this->service->SearchQuery("Property","Property",$crit,array("Limit" => '100',"Culture" => $culture)); 153 154 $this->WriteLog('Reterived Results'); 155 156 157 158 159 while ($rets = $this->service->FetchRow($results)) { 160 130 $this->WriteLog('service->Search' . $crit); 131 132 //Get As Disconnect Array So We Don't Worry Abour Releasing The Adapter 133 $properties = $this->service->Search("Property","Property",$crit,array("Limit" => '100',"Culture" => $culture)); 134 $this->WriteLog('Retrieved Results'); 135 136 //Get Disconnect Array of Current Post 137 $posts_array = $wpdb->get_results("select ID,post_name from $wpdb->posts where post_type = 'property'"); 138 //Reset Data 139 $total = count($properties); 140 $count = 0; 141 $user_id = get_current_user_id(); 142 //Loop Data 143 foreach ($properties as &$rets) { 144 145 $count = $count + 1; 146 161 147 $ListingKey = $rets['ListingKey']; 162 echo 'ListingKey: ' . $ListingKey .'<br>';// 163 164 //Check And See If We Have A Post Mathing The Listing Key 165 $args = array( 166 'post_type' => 'property', 167 'meta_query' => array( 168 array( 169 'key' => 'ListingKey', 170 'value' => $ListingKey,) 171 ) 172 ); 173 174 $posts_array = get_posts( $args ); // This can be optimized. //Reterive Only Once 175 148 $this->WriteLog('$ListingKey' . $ListingKey); 149 $post = ''; //Want To Mat use unset 150 foreach($posts_array as $struct) { 151 if ($ListingKey == $struct->post_name) { 152 $post = $struct; 153 break; 154 } 155 } 156 176 157 $title = $rets['UnparsedAddress'] .' (' . $rets['ListingId'] .')'; 177 158 $content = time(); 178 179 if( $posts_array ) { 180 181 182 $post = $posts_array[0]; 183 184 /* if($post->ModificationTimestamp == $rets['ModificationTimestamp']) 185 { 186 $this->WriteLog($post->ID . ' No Change To Record' . $post->ModificationTimestamp ); 187 188 } 189 else 190 {*/ 159 160 if($post != '') 161 { 191 162 $post->post_title = $title; 192 163 $post->post_content = $content . 'Updated'; 193 164 $post->post_name = $ListingKey; 194 wp_update_post($post);// 165 $post->post_date = $rets['ModificationTimestamp']; 166 167 wp_update_post($post); 168 $post_id = $post->ID; 169 $this->WriteLog('Update Post' . $ListingKey . '-' . $post_id . ' Record -' .$count . ' of ' . $total); 195 170 196 $post_id = $post->ID; 197 $this->WriteLog('Update ' . $ListingKey . '-' . $post_id); 171 //$this->WriteLog('Delete PostMeta' . $ListingKey . '-' . $post_id); 172 $deleteQuery = $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key like %s",$post_id,'dfd_%'); //Delte Only ListingData 173 $wpdb->query($deleteQuery); 174 175 //$this->WriteLog('Insert PostMeta' . $ListingKey . '-' . $post_id); 176 $meta_values = array(); 198 177 199 foreach($rets as $key => &$val) { 200 //update_post_meta($post_id,$key, $val); 201 202 //Don't Update Listing Key 203 if($key != 'ListingKey'){ 204 //Direct Query Still Causing Problems 205 global $wpdb; 206 $wpdb->query("UPDATE $wpdb->postmeta 207 SET meta_value = '$val' 208 WHERE post_id = $post_id 209 AND meta_key = '$key'"); 178 //For Speed Optimization we Only Update Records That Have Values This Cuts down on the number of quires we will send to the server 179 foreach($rets as $key => &$value){ 180 if($value != ''){ 181 $meta_values[] = $wpdb->prepare('(%s, %s, %s)', $post_id, 'dfd_'.$key, $value); 210 182 } 211 212 } 213 //} 214 215 } 216 else{ 183 } 184 $values = implode(', ', $meta_values); 185 $wpdb->query("INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES $values"); 186 } 187 else 188 { 189 217 190 218 191 $post = array( … … 220 193 'post_content' => $content, 221 194 'post_status' => 'publish', 222 'post_author' => 1, 223 'post_type' => 'property' 195 'post_author' => $user_id, 196 'post_type' => 'property', 197 'post_name' => $ListingKey, 198 'post_date' => $rets['ModificationTimestamp'] 224 199 ); 225 226 $post_id = wp_insert_post( $post ); 227 228 $this->WriteLog('Insert ' . $ListingKey); 229 // try{ 230 231 /* foreach($rets as $key => &$val) { 232 233 try 234 { 235 add_post_meta($post_id,$key, $val); 236 } 237 catch(Exception $e){ 238 239 $this->WriteLog('Error Post Meta Insert ' . $ListingKey . $key . $e); 240 } 241 }*/ 242 243 global $wpdb; 200 201 $post_id = wp_insert_post( $post, $wp_error); 202 203 if($post_id == 0){ 204 $this->WriteLog('Insert Post' . $ListingKey . '-' . $post_id . ' Record -' .$count . ' of ' . $total . "Error:" . $wp_error . 'User:' . $user_id); 205 //$this->WriteLog($wpdb->last_error); 206 } 207 else 208 { 209 210 $this->WriteLog('Insert Post' . $ListingKey . '-' . $post_id . ' Record -' .$count . ' of ' . $total); 211 244 212 $meta_values = array(); 245 213 foreach($rets as $key => &$value){ 246 $meta_values[] = $wpdb->prepare('(%s, %s, %s)', $post_id, $key, $value);247 }248 $values = implode(', ', $meta_values); 214 $meta_values[] = $wpdb->prepare('(%s, %s, %s)', $post_id,'dfd_'. $key, $value); 215 } 216 $values = implode(', ', $meta_values); 249 217 $wpdb->query("INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES $values"); 250 // } 251 // catch (Exception $e){ 252 // update_option( 'sc-sync-error',$e ); 253 // } 254 255 } 256 257 // $this->sync_propertyobject($rets['ListingKey'], 'Photo',$post_id); 218 } 219 } 220 258 221 update_post_meta($post_id,'sc-sync-meta-end', time()); 259 222 } 223 260 224 261 225 $this->WriteLog('End Sync'); 262 263 $this->service->FreeResult($results); 264 226 265 227 update_option( 'sc-sync-end',time() ); 266 228 update_option( 'sc-status', false ); … … 269 231 } 270 232 233 public function sync_pictures() 234 { 235 echo 'pics'; 236 global $wpdb; 237 $wpdb->query("set wait_timeout = 1200"); 238 $this->WriteLog('Begin Picture Sync'); 239 //TODO:// we should be able to speed this up by only joining to the key 240 $posts_array = $wpdb->get_results("select ID,post_name from $wpdb->posts where post_type = 'property'"); 241 242 foreach($posts_array as $listing) 243 { 244 $post_id = $listing->ID; 245 //Check and see if there if property data needs to be synced 246 $meta = get_post_meta( $post_id ,'sc-sync-picture'); 247 248 $listingKey = $listing->post_name; 249 if($listingKey){ //If Someone manually adds a listing the key is wrong 250 if($meta) 251 { 252 $this->WriteLog('Photo Record is Synced' .$meta . 'listingkey' .$listingKey ); 253 }else 254 { 255 256 $this->WriteLog('Meta' .$meta . 'listingkey' .$listingKey ); 257 $this->WriteLog('Begin Picture Sync' . $post_id ); 258 $this->sync_propertyobject($listingKey, 'Photo',$post_id); 259 update_post_meta($post_id,'sc-sync-picture', true); 260 261 } 262 } 263 } 264 265 $this->WriteLog('End Picture Sync'); 266 } 267 271 268 public function sync_propertyobject($id, $type, $post_id) 272 { 273 269 { 274 270 $args = array( 275 271 'post_type' => 'attachment', … … 283 279 if ( $attachments ) { 284 280 foreach ( $attachments as $attachment ) { 285 // echo '<li>';286 // echo wp_get_attachment_image( $attachment->ID, 'full' );287 // echo '<p>';288 // echo apply_filters( 'the_title', $attachment->post_title );289 // echo '</p></li>';290 281 wp_delete_attachment( $attachment->ID, true ); 291 //Let's Delete All The Attachments292 282 } 293 283 } 294 284 295 285 $record = $this->service->GetObject("Property", $type, $id); 296 297 286 $isAttached = false; 298 287 foreach($record as &$image) 299 288 { 300 // echo $image["Content-Type"];301 // echo $image["Object-ID"];302 // echo $image["Content-ID"];303 289 304 290 $filename = $image["Content-ID"] .'-' . $type .'-'.$image["Object-ID"]. '.jpg'; 305 291 $wp_upload_dir = wp_upload_dir(); 306 //Check Directory 307 $filePath = $wp_upload_dir[basedir]. '/soldpress/'.$filename; 308 309 file_put_contents($filePath,$image["Data"]); //We Change This In Settings 310 311 312 //Need a little work 313 //Check if files exists 314 //If attachement is already attached do nothing with the meta data just update the file. 315 316 // echo "Attachmet" . $filePath; 317 292 $filePath = $wp_upload_dir['basedir']. '/soldpress/'.$filename; 293 file_put_contents($filePath,$image["Data"]); //We Change This In Settings 318 294 $wp_filetype = wp_check_filetype(basename($filename), null ); 319 295 $wp_upload_dir = wp_upload_dir(); … … 397 373 private function WriteLog($text) 398 374 { 399 update_option( 'sc-sync-status',$text );375 //update_option( 'sc-sync-status',$text ); 400 376 $this->log->lwrite($text.PHP_EOL); 401 377 } -
soldpress/branches/0.9.5A/custom_field_types.php
r704538 r708983 35 35 'has_archive' => true, 36 36 'exclude_from_search' => false, 37 'publicly_queryable' => true, 37 'publicly_queryable' => true, 38 38 'capability_type' => 'page', 39 39 ); … … 41 41 register_post_type( 'property', $args ); 42 42 } 43 44 // Hook into the 'init' action45 add_action('init', 'custom_post_type', 0 );46 add_action("admin_init", "admin_init");47 48 function admin_init()49 {50 // add_meta_box( 'listing_meta_boxes', 'Property Details', 'listing_meta_boxes', 'property', 'normal', 'high' );51 }52 43 53 44 function listing_meta_boxes() { … … 68 59 } 69 60 61 // Hook into the 'init' action 62 add_action('init', 'custom_post_type', 0 ); 63 add_action("admin_init", "admin_init"); 64 65 function admin_init() 66 { 67 // add_meta_box( 'listing_meta_boxes', 'Property Details', 'listing_meta_boxes', 'property', 'normal', 'high' ); 68 } 69 70 70 71 ?> -
soldpress/branches/0.9.5A/settings.php
r703015 r708983 13 13 register_setting( 'sc-settings-group', 'sc-url' ); 14 14 register_setting( 'sc-settings-group', 'sc-template' ); 15 // register_setting( 'sc-settings-group', 'sc-lastupdate' );16 // register_setting( 'sc-settings-group', 'sc-status' );15 register_setting( 'sc-settings-group', 'sc-language' ); 16 register_setting( 'sc-settings-group', 'sc-sync-enabled' ); 17 17 } 18 18 … … 44 44 <td><input type="text" class="regular-text" name="sc-template" value="<?php echo get_option('sc-template','wp-content/plugins/soldpress/template/'); ?>" /></td> 45 45 </tr> 46 <tr valign="top"> 47 <th scope="row">Language</th> 48 <td><input type="text" class="regular-text" name="sc-template" value="<?php echo get_option('sc-language','en-CA'); ?>" /></td> 49 </tr> 50 <tr valign="top"> 51 <th scope="row">Sync Enabled</th> 52 <td><input type="text" class="regular-text" name="sc-template" value="<?php echo get_option('sc-sync-enabled','1'); ?>" /></td> 53 </tr> 46 54 <tr valign="top"> 47 55 <th scope="row">Last Update</th> … … 49 57 </tr> 50 58 </table> 51 Status : <?php echo get_option('sc-status' ) ?>52 Start : <?php echo get_option('sc-sync-start' ) ?>53 End : <?php echo get_option('sc-sync-end' ) ?>54 Error : <?php echo get_option('sc-sync-error' ) ?>55 59 <?php submit_button(); ?> 56 60 </form> … … 60 64 <?php submit_button('Manual Sync', 'secondary', 'sync', false); ?> 61 65 <?php submit_button('Clear Listings', 'secondary', 'delete', false); ?> 62 63 64 66 </form> 67 <br><br> 68 <?php if (get_option('sc-status' ) == true) { ?> 69 <div id="message" class="updated"><p>CREA Data Sync Active</p> 70 <ul> 71 <li>Status : <?php echo get_option('sc-status' ) ?></li> 72 <li>Start : <?php echo get_option('sc-sync-start' ) ?></li> 73 <li>End : <?php echo get_option('sc-sync-end' ) ?></li> 74 <li>Error : <?php echo get_option('sc-sync-error' ) ?> </li> 75 <li>Discription : <?php echo get_option('sc-sync-status' ) ?> </li> 76 </ul> 77 </div> 78 <?php } ?> 65 79 <br><br> 66 80 <div> … … 68 82 <br> 69 83 © 2013 Sanskript Solution, Inc.</div> 84 85 <div class = "postbox"> 86 <div class = "handlediv"> 87 <br> 88 </div> 89 <h3 class = "hndle"><span><?php _e('Debug Information', 'bulk-delete'); ?></span></h3> 90 <div class = "inside"> 91 <p>Debug</p> 92 <table cellspacing="10"> 93 <tr> 94 <th align = "right"><?php _e('Available memory size ', 'bulk-delete');?></th> 95 <td><?php echo ini_get( 'memory_limit' ); ?></td> 96 </tr> 97 <tr> 98 <th align = "right"><?php _e('Script time out ', 'bulk-delete');?></th> 99 <td><?php echo ini_get( 'max_execution_time' ); ?></td> 100 </tr> 101 <tr> 102 <th align = "right"><?php _e('Script input time ', 'bulk-delete'); ?></th> 103 <td><?php echo ini_get( 'max_input_time' ); ?></td> 104 </tr> 105 <tr> 106 <th align = "right"><?php _e('My Sql Connect Timeou ', 'bulk-delete'); ?></th> 107 <td><?php echo ini_get( 'mysql.connect_timeout' ); ?></td> 108 </tr> 109 110 </table> 111 </div> 112 </div> 113 70 114 <?php 71 115 116 add_action( 'in_admin_footer', 'admin_footer' ); 117 /** 118 * Adds Footer links. Based on http://striderweb.com/nerdaphernalia/2008/06/give-your-wordpress-plugin-credit/ 119 */ 120 function admin_footer() { 121 $plugin_data = get_plugin_data( __FILE__ ); 122 printf('%1$s ' . __("plugin", 'soldpress') .' | ' . __("Version", 'soldpress') . ' %2$s | '. __('by', 'soldpress') . ' %3$s<br />', $plugin_data['Title'], $plugin_data['Version'], $plugin_data['Author']); 123 } 72 124 //$date = new DateTime(); 73 125 //echo $date->getTimestamp(); … … 84 136 if (isset($_POST["sync"])) { 85 137 86 $adapter= new soldpress_adapter(); 87 if($adapter->connect()) 88 { 89 return $adapter-> sync_residentialproperty("LastUpdated=2011-05-08T22:00:17Z",""); 90 } 138 soldpress_listintgs(); 91 139 } 92 140 93 141 if (isset($_POST["delete"])) { 142 143 /* global $wpdb; 144 $meta_values = array(); 145 foreach ($metadata as $key => $value) { 146 $meta_values[] = $wpdb->prepare('( %s, %s, %s)', $post_id, $key, $value); 147 } 148 $values = implode(', ', $meta_values); 149 $wpdb->query("INSERT INTO $wpdb->postmeta ($post_id, meta_key, meta_value) VALUES $values"); 150 */ 151 94 152 echo 'delete'; 95 153 $mycustomposts = get_posts( array( 'post_type' => 'property', 'numberposts' => 500) ); -
soldpress/branches/0.9.5A/single-property.php
r704538 r708983 1 <?php 2 get_header(); 3 ?> 1 <div class="alert alert-warning"><strong>This is a template for a simple listing website. Use it as a starting point to create something more unique </div> 4 2 5 <div class="sixteen columns outercontainer bigheading"> 6 <div class="four columns alpha"> 7 8 </div> 9 <div class="twelve columns omega"> 10 <h2 id="title" class="blogtitle"><?php the_title(); ?></h2> 11 </div> 12 </div> 3 <?php get_header(); ?> 4 <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"> 5 <h1><?php the_title(); ?></h1> 6 <div class="container-fluid"> 7 <div class="alert alert-success"> 8 <div class="row"> 9 <div class="span4">MLS®: <?php echo get_post_meta($post->ID,'dfd_ListingId',true); ?> </div> 10 <div class="span4 pull-left">For Sale: $<?php echo get_post_meta($post->ID,'dfd_ListPrice',true); ?></div> 11 </div></div> 12 13 <div class="row-fluid"> 14 <div class="span8"> 15 <p> 16 <div class="cycle-slideshow" 17 data-cycle-fx=scrollHorz 18 data-cycle-timeout=0 19 data-cycle-pager="#adv-custom-pager" 20 data-cycle-pager-template="<a href='#'><img src='{{src}}' width=40 height=40></a>"> 21 <?php 22 $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') ); 23 if($photos){ 24 foreach ($photos as $photo) { 25 echo '<image src="' . wp_get_attachment_url($photo->ID,'thumbnail') . '">'; 26 } 27 } 28 ?> 29 <div id=adv-custom-pager class="center external"></div> 30 </div></p> 31 32 <p><div class="alert alert-success"><?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); ?></div></p> 33 <p><?php echo get_post_meta($post->ID,'dfd_PublicRemarks',true); ?></p> 13 34 14 35 15 <div class="sixteen columns outercontainer" id="content"> 16 <div class="four columns alpha" id="leftsidebar"> 17 <?php get_sidebar() ?> 18 </div> 19 20 <div class="twelve columns omega"> 21 22 <?php 23 $arr_sliderimages = get_gallery_images(); 24 ?> 25 <?php if (count($arr_sliderimages) > 0) { ?> 26 <div id="sliderimage"> 27 <?php if(count($arr_sliderimages) > 1) { ?> 28 <div class="imagehover"></div> 29 <?php } ?> 30 31 <?php 32 $count = 1; 33 $hide = ""; 34 foreach ($arr_sliderimages as $image) { 35 if($count != 1) { 36 $hide = "style='display: none;'"; 37 } 38 $resized = aq_resize($image, 700, 400,true); 39 $resizedthumb = aq_resize($image, 62, 62,true); 40 ?> 41 42 <div class="image" <?php echo $hide; ?>> 43 <img class="detailpagebigimage" alt="" rel="<?php echo $resizedthumb ?>" src="<?php echo $resized ?>" /> 44 </div> 45 46 <?php 47 $count = $count + 1; 48 } ?> 49 </div><!-- end sliderimage --> 50 <?php } ?> 51 52 <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 53 <div <?php post_class() ?> id="post-<?php echo the_ID(); ?>"> 54 55 <?php if (get_option('wp_showblogimage') == 'show') { ?> 56 <?php 57 if ( has_post_thumbnail() ) { 58 59 the_post_thumbnail('medium'); 60 } ?> 61 <?php } ?> 62 63 <?php include get_template_directory() . '/includes/postmeta.php'; ?> 64 <?php the_tags() ?> 65 <?php the_content(); ?> 66 <?php if ($post->comment_status == "open") { ?> 67 <?php comments_template('', true); ?> 68 <?php } ?> 69 70 </div> 71 <?php endwhile; else: ?> 72 73 74 <?php endif; ?> 36 <p> 37 <table class="table table-striped table-condensed "> 38 <tbody> 39 <tr> 40 <td>Bathrooms</td> 41 <td><?php echo get_post_meta($post->ID,'dfd_BathroomsTotal',true); ?></td> 42 <td>Bedrooms</td> 43 <td><?php echo get_post_meta($post->ID,'dfd_BedroomsTotal',true); ?></td> 44 45 </tr> 46 <tr> 47 <td>Property Type</td> 48 <td><?php echo get_post_meta($post->ID,'dfd_PropertyType',true); ?></td> 49 <td>Built in</td> 50 <td><?php echo get_post_meta($post->ID,'dfd_YearBuilt',true); ?></td> 51 </tr> 52 <tr> 53 <td>LotSize:</td> 54 <td><?php echo get_post_meta($post->ID,'dfd_LotSizeArea',true); ?> <?php echo get_post_meta($post->ID,'dfd_LotSizeUnits',true); ?></td> 55 <td>Building Area</td> 56 <td><?php echo get_post_meta($post->ID,'dfd_BuildingAreaTotal',true); ?> <?php echo get_post_meta($post->ID,'dfd_BuildingAreaUnits',true); ?></td> 57 </tr> 58 </tbody></table></p> 59 60 <table class="table table-striped table-condensed "> 61 <caption>Rooms</caption> 62 <tbody> 63 <tr> 64 <th>Level</th> 65 <th>Type</th> 66 <th>Dimensions</th> 67 </tr> 68 <?php 69 for ($i=1; $i<=20; $i++) 70 { 71 echo "<tr data-dp='".'dfd_RoomLevel' . $i . "'>"; 72 echo "<td>" . get_post_meta($post->ID,'dfd_RoomLevel' . $i ,true) . "</td>"; 73 echo "<td>" . get_post_meta($post->ID,'dfd_RoomType' . $i ,true) . "</td>"; 74 echo "<td>" . get_post_meta($post->ID,'dfd_RoomDimensions' . $i ,true) . "</td>"; 75 echo "</tr>"; 76 } 77 ?> 78 </tbody></table></p> 79 </div> 80 <div class="span4"> 81 <!-- Agent --><h3>Agent Details</h3> 82 <div class="row-fluid"> 83 <div class="span6"> 84 <address> 85 <strong><?php echo get_post_meta($post->ID,'dfd_ListAgentFullName',true); ?></strong><br> 86 <?php echo get_post_meta($post->ID,'dfd_ListAgentDesignation',true); ?><br> 87 88 <abbr title="Phone">O:</abbr> <?php echo get_post_meta($post->ID,'dfd_ListAgentOfficePhone',true); ?> 89 <abbr title="Pager">P:</abbr> <?php echo get_post_meta($post->ID,'dfd_ListAgentPager',true); ?> 90 <abbr title="Fax">H:</abbr> <?php echo get_post_meta($post->ID,'dfd_ListAgentFax',true); ?> 91 <abbr title="Web">W:</abbr> <?php echo get_post_meta($post->ID,'dfd_ListAgentURL',true); ?> 92 <abbr title="Cell">C:</abbr> <?php echo get_post_meta($post->ID,'dfd_ListAgentCellPhone',true); ?> 93 </address> 94 <address> 95 <?php echo get_post_meta($post->ID,'dfd_ListOfficeName',true); ?> 96 <?php echo get_post_meta($post->ID,'dfd_ListOfficePhone',true); ?> 97 <?php echo get_post_meta($post->ID,'dfd_ListOfficeURL',true); ?> 98 </address></div> 99 <div class="span6"> <!-- Co Agent --> 100 <address> 101 <strong><?php echo get_post_meta($post->ID,'dfd_CoListAgentFullName',true); ?></strong><br> 102 <?php echo get_post_meta($post->ID,'dfd_CoListAgentDesignation',true); ?><br> 103 <abbr title="Phone">O:</abbr> <?php echo get_post_meta($post->ID,'dfd_CoListAgentOfficePhone',true); ?> 104 <abbr title="Pager">P:</abbr> <?php echo get_post_meta($post->ID,'dfd_CoListAgentPager',true); ?> 105 <abbr title="Fax">H:</abbr> <?php echo get_post_meta($post->ID,'dfd_CoListAgentFax',true); ?> 106 <abbr title="Web">W:</abbr> <?php echo get_post_meta($post->ID,'dfd_CoListAgentURL',true); ?> 107 <abbr title="Cell">C:</abbr> <?php echo get_post_meta($post->ID,'dfd_CoListAgentCellPhone',true); ?> 108 </address> 109 <address> 110 <?php echo get_post_meta($post->ID,'dfd_CoListOfficeName',true); ?> 111 <?php echo get_post_meta($post->ID,'dfd_CoListOfficePhone',true); ?> 112 <?php echo get_post_meta($post->ID,'dfd_CoListOfficeURL',true); ?> 113 </address> 75 114 </div> 76 115 </div> 116 </div> 117 </div> 118 </div> 119 <!-- empty element for pager links --> 120 <?php //echo get_post_meta($post->ID,'dfd_AnalyticsClick',true); ?> 121 <?php //echo get_post_meta($post->ID,'dfd_AnalyticsView',true); ?> 122 <script src="http://code.jquery.com/jquery.js"></script> 123 <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script> 124 <script src="http://malsup.github.com/jquery.cycle2.js"></script> 125 77 126 78 127 <?php get_footer(); ?> 128 129 ©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®. 130 ©2013 Soldpress Plugin -
soldpress/branches/0.9.5A/soldpress.php
r703015 r708983 4 4 Plugin URI: http://www.sanskript.com/products/soldpress 5 5 Description: SoldPress is a WordPress plugin to enable CREA’s members to easily disseminate MLS® listing content on WordPress Sites. 6 Version: 0.9.5 A6 Version: 0.9.5 A M1 7 7 Author: Amer Gill 8 8 Author URI: http://www.sanskript.com … … 10 10 */ 11 11 12 ini_set('max_execution_time', 600); 13 ini_set('mysql.connect_timeout', 600); 14 ini_set('default_socket_timeout', 600); 15 12 16 add_filter( 'query_vars','soldpress_query_vars' ); 17 //add_theme_support('post-thumbnails'); 13 18 14 19 require_once(dirname(__FILE__)."/adapter.php"); … … 27 32 28 33 function deactivate_cron_hook(){ 29 wp_clear_scheduled_hook('soldpress_listing_sync'); 34 wp_clear_scheduled_hook('soldpress_listing_sync'); 35 wp_clear_scheduled_hook('soldpress_photo_sync'); 30 36 } 31 32 /*register_deactivation_hook(__FILE__, soldpress_deactivate);33 34 function soldpress_deactivate()35 {36 unregister_setting( 'sc-settings-group', 'sc-username' );37 unregister_setting( 'sc-settings-group', 'sc-password' );38 unregister_setting( 'sc-settings-group', 'sc-url' );39 unregister_setting( 'sc-settings-group', 'sc-template' );40 }*/41 37 42 38 register_activation_hook(__FILE__, 'soldpress_activation'); 43 39 44 add_action('soldpress_listing_sync', 'soldpress_hourly'); 40 add_action('soldpress_listing_sync', 'soldpress_listintgs'); 41 add_action('soldpress_photo_sync', 'soldpress_photo'); 45 42 46 43 function soldpress_activation() { 47 44 48 //wp_schedule_event( time(), 'daily', 'soldpress_listing_sync'); 49 wp_schedule_event( time(), 'hourly', 'soldpress_listing_sync'); 45 update_option( 'sc-status', ''); 46 update_option( 'sc-sync-start','' ); 47 update_option( 'sc-sync-end','' ); 48 49 //Create SoldPress Directory 50 $wp_upload_dir = wp_upload_dir(); 51 $target = $wp_upload_dir['basedir']. '/soldpress/'; 52 // if ( wp_mkdir_p( $target ) === TRUE ) //Future Error 53 wp_mkdir_p( $target ); 54 55 //Schedule The Events 56 wp_schedule_event( time(), 'daily', 'soldpress_listing_sync'); 57 wp_schedule_event( time(), 'hourly', 'soldpress_photo_sync'); 50 58 } 51 59 52 function soldpress_hourly() { 53 // do something every hour 54 update_option( 'sc-lastupdate', time() ); 60 function soldpress_listintgs() { 61 62 date_default_timezone_set('UTC'); 63 $lastupdate = get_option('sc-lastupdate'); 55 64 65 if(!$lastupdate){ 66 //Sync Last 90 days 67 $days = 90; 68 $date = new DateTime(); 69 $date->sub(new DateInterval('P' . $days . 'D')); 70 update_option( 'sc-lastupdate', new DateTime()); 71 }else 72 { 73 $date = $lastupdate ; 74 $date->add(new DateInterval('P' . 1 . 'D')); 75 update_option( 'sc-lastupdate', $date); 76 } 77 78 //Do a future check/ if the date time is before now don't do any thing the usemay have reactivate the plugin. 79 $adapter= new soldpress_adapter(); 80 81 if($adapter->connect()) 82 { 83 return $adapter-> sync_residentialproperty("LastUpdated=2011-05-08T22:00:17Z",""); 84 //return $adapter-> sync_residentialproperty("LastUpdated=" . $date->format('Y-m-d'),""); 85 } 86 87 88 } 89 90 function soldpress_photo() { 91 echo 'soldpress_photo'; 56 92 $adapter= new soldpress_adapter(); 57 93 if($adapter->connect()) 58 94 { 59 return $adapter-> sync_ residentialproperty("LastUpdated=2011-05-08T22:00:17Z",""); //HardCode Time For Testing95 return $adapter-> sync_pictures(); 60 96 } 61 62 97 } 63 98 … … 65 100 66 101 function include_template_function( $template_path ) { 102 103 //Thanks Brother : http://wp.tutsplus.com/tutorials/plugins/a-guide-to-wordpress-custom-post-types-taxonomies-admin-columns-filters-and-archives/ 67 104 if ( get_post_type() == 'property' ) { 68 105 if ( is_single() ) { … … 75 112 } 76 113 } 114 elseif ( is_archive() ) { 115 if ( $theme_file = locate_template( array ( 'archive-property.php' ) ) ) { 116 $template_path = $theme_file; 117 } else { $template_path = plugin_dir_path( __FILE__ ) . '/archive-property.php'; 118 119 } 120 } 77 121 } 78 122 return $template_path; -
soldpress/branches/0.9.5A/template/template.html
r693468 r708983 1 <h1>${$rets['ListPrice']}</h1>1 <h1>${$rets['ListPrice']}</h1> 2 2 <h3>{$rets['UnparsedAddress']}, {$rets['City']}</h3> 3 3 {$rets['BedroomsTotal']} Bedrooms | {$rets['BathroomsTotal']} Bathrooms | {$rets['LotSizeArea']} {$rets['LotSizeUnits']}.
Note: See TracChangeset
for help on using the changeset viewer.