Changeset 1263744
- Timestamp:
- 10/12/2015 02:41:11 AM (10 years ago)
- Location:
- rets-rabbit/trunk
- Files:
-
- 8 edited
-
docs/rets_rabbit_for_wordpress_user_guide.md (modified) (3 diffs)
-
docs/rets_rabbit_for_wordpress_user_guide.pdf (modified) (previous)
-
readme.txt (modified) (2 diffs)
-
retsrabbit.php (modified) (1 diff)
-
rr_actions.php (modified) (1 diff)
-
rr_adapter.php (modified) (2 diffs)
-
rr_shortcodes.php (modified) (5 diffs)
-
template/search-form.example.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rets-rabbit/trunk/docs/rets_rabbit_for_wordpress_user_guide.md
r1102919 r1263744 3 3 *Author:* Patrick Pohler 4 4 5 *Version:* 1.0. 05 *Version:* 1.0.6 6 6 7 7 *URL:* <http://retsrabbit.com> … … 115 115 - **paginate** (default:true): used w/ the **limit** parameter, setting this to true will generate pagination links for the results 116 116 - **num_photos** (default: 1): the max number of photos for each listing. Default is **-1** (all photos) while **0** will display no photos 117 - **cache** (default: false): enable cache 118 - **cache_duration** (default: 4 hrs) 117 119 118 120 ### Displaying a single listing … … 127 129 - **template** (default: 'detail.php'): the template file in the `plugins\retsrabbit\template` directory used to show the detail page for the listing 128 130 - **num_photos** (default: -1): the max number of photos for each listing. Default is **-1** (all photos) while **0** will display none 131 - **cache** (default: false): enable cache 132 - **cache_duration** (default: 4 hrs) 133 129 134 130 135 The **detail.php** template can be modified to display the listing details. The listing data will be in an array called **$result**: -
rets-rabbit/trunk/readme.txt
r1263706 r1263744 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.3 6 Stable tag: 1.0. 56 Stable tag: 1.0.6 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 103 103 == Changelog == 104 104 105 = 1.0.6 - Add caching options 106 105 107 = 1.0.4 - Updated for new API changes 106 108 -
rets-rabbit/trunk/retsrabbit.php
r1263706 r1263744 4 4 Plugin URI: http://retsrabbit.com/wordpress 5 5 Description: Plugin to integrate the real estate cloud service, Rets Rabbit, with Wordpress. 6 Version: 1.0. 56 Version: 1.0.6 7 7 Author: Patrick Pohler 8 8 Author URI: http://www.anecka.com -
rets-rabbit/trunk/rr_actions.php
r1263706 r1263744 52 52 53 53 function retsrabbit_clear_transients($option, $oldvalue, $_newvalue) { 54 delete_transient('rr-search-query'); 55 delete_transient('retsrabbit-access-code'); 56 delete_transient('rr-metadata'); 54 if($option == "rr-client-id"){ 55 delete_transient('retsrabbit-access-code'); 56 delete_transient('rr-metadata'); 57 } 57 58 } 58 59 ?> -
rets-rabbit/trunk/rr_adapter.php
r1263335 r1263744 53 53 } 54 54 55 public function get_listing($mls_id, $num_photos = -1 ) {55 public function get_listing($mls_id, $num_photos = -1, $cache = false, $cache_duration = 4) { 56 56 $client = new Client($this->access_token, true); 57 57 $servers = $client->getServers(); 58 58 $server_hash = $servers[0]['server_hash']; //dangerous, need to adjust this 59 $response = $client->getListing($server_hash, $mls_id); 59 $response = null; 60 $query_key = ""; 61 62 if($cache) { 63 $key = "$server_hash:$mls_id"; 64 $query_key = hash('sha256', serialize($key)); 65 66 $response = get_transient($query_key); 67 } 68 69 if($response == null) { 70 $response = $client->getListing($server_hash, $mls_id); 71 72 if($cache) { 73 set_transient($query_key, $response, $cache_duration * HOUR_IN_SECONDS); 74 } 75 } 60 76 61 77 $variables = array(); … … 74 90 } 75 91 76 public function run_search($params, $limit, $num_photos, $orderby = "", $sort_order = "", $sort_option = "" ) {92 public function run_search($params, $limit, $num_photos, $orderby = "", $sort_order = "", $sort_option = "", $cache = false, $cache_duration = 4) { 77 93 $client = new Client($this->access_token, true); 78 94 $servers = $client->getServers(); 79 95 $server_hash = $servers[0]['server_hash']; //dangerous, need to adjust this 96 $response = null; 97 $query_key = ""; 80 98 81 99 $query = $this->_prepare_query($params, $limit, $orderby, $sort_order, $sort_option); 82 $response = $client->getSearchListings($server_hash, $query); 100 101 if($cache) { 102 $query_key = hash('sha256', $server_hash.serialize($query)); 103 104 $response = get_transient($query_key); 105 } 106 107 if($response == null) { 108 $response = $client->getSearchListings($server_hash, $query); 109 110 if($cache) { 111 set_transient($query_key, $response, $cache_duration * HOUR_IN_SECONDS); 112 } 113 } 114 83 115 84 116 $variables = array(); -
rets-rabbit/trunk/rr_shortcodes.php
r1238274 r1263744 11 11 $orderby = (isset($atts['orderby']) ? $atts['orderby'] : ""); 12 12 $sort_order = (isset($atts['sort_order']) ? $atts['sort_order'] : ""); 13 $cache = (isset($atts['cache']) ? $atts['cache'] : false); 14 $cache_duration = (isset($atts['cache_duration']) ? $atts['cache_duration'] : 4); 13 15 14 16 $params = json_decode($atts['params'], true); 15 17 16 18 $rr_adapter = new rr_adapter(); 17 $results = $rr_adapter->run_search($params, $limit, $num_photos, $orderby, $sort_order );19 $results = $rr_adapter->run_search($params, $limit, $num_photos, $orderby, $sort_order, $cache, $cache_duration); 18 20 //$results = $response->results; 19 21 return $rr_adapter->parse($results, $template, $paginate, $limit); … … 25 27 $template = (isset($atts['template']) ? $atts['template'] : 'detail.php'); 26 28 $num_photos = (isset($atts['num_photos']) ? $atts['num_photos'] : -1); 29 $cache = (isset($atts['cache']) ? $atts['cache'] : false); 30 $cache_duration = (isset($atts['cache_duration']) ? $atts['cache_duration'] : 4); 27 31 28 32 if(!$mls_id = get_query_var('mls_id')) … … 30 34 31 35 $rr_adapter = new rr_adapter(); 32 $result = $rr_adapter->get_listing($mls_id, $num_photos );36 $result = $rr_adapter->get_listing($mls_id, $num_photos, $cache, $cache_duration); 33 37 return $rr_adapter->parse_single($result, $template); 34 38 } … … 48 52 $num_photos = (isset($atts['num_photos']) ? $atts['num_photos'] : 1); 49 53 $paginate = (isset($atts['paginate']) ? $atts['paginate'] === 'true' : true); 54 $cache = (isset($atts['cache']) ? $atts['cache'] : false); 55 $cache_duration = (isset($atts['cache_duration']) ? $atts['cache_duration'] : 4); 50 56 51 57 $query_params = get_transient('rr-search-query'); … … 58 64 if($params != null && sizeof($params) > 0) { 59 65 $rr_adapter = new rr_adapter(); 60 $results = $rr_adapter->run_search($params, $limit, $num_photos, $orderby, $sort_order, $sort_option );66 $results = $rr_adapter->run_search($params, $limit, $num_photos, $orderby, $sort_order, $sort_option, $cache, $cache_duration); 61 67 62 68 return $rr_adapter->parse($results, $template, $paginate, $limit); -
rets-rabbit/trunk/template/search-form.example.php
r1263706 r1263744 39 39 </select> 40 40 </div> 41 <!-- 41 42 <div> 42 43 <Label>MLS number</label> 43 44 <input type="text" name="rets:Matrix_Unique_ID:nocase" value="51209969"> 44 45 </div> 46 --> 45 47 <?php 46 48 /*
Note: See TracChangeset
for help on using the changeset viewer.