Changeset 1751990
- Timestamp:
- 10/24/2017 05:04:51 PM (8 years ago)
- Location:
- blogdog/trunk
- Files:
-
- 3 edited
-
admin/admin.php (modified) (13 diffs)
-
blogdog.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
blogdog/trunk/admin/admin.php
r1750834 r1751990 175 175 wp_enqueue_script( 'jquery-ui-button' ); 176 176 wp_enqueue_script( 'jquery-ui-sortable' ); 177 wp_enqueue_script( 'blogdog_js' ); 178 179 $this->get_json(); ?> 177 wp_enqueue_script( 'blogdog_js' ); ?> 180 178 181 179 <div id="blogdog_admin" class="wrap"> … … 199 197 200 198 </div><? 201 202 }203 204 public function get_json() {205 206 $this->location_json = true;207 208 if( $location_json = get_transient( 'blogdog_location_json' ) ) {209 210 $this->state_json = $location_json->state_json;211 $this->city_json = $location_json->city_json;212 $this->zip_json = $location_json->zip_json;213 214 } else {215 216 $endpoint = 'json/';217 218 $this->state_json = json_decode( file_get_contents( $this->base_url . $endpoint . 'state.json' ), true );219 $this->city_json = json_decode( file_get_contents( $this->base_url . $endpoint . 'city.json' ), true );220 $this->zip_json = json_decode( file_get_contents( $this->base_url . $endpoint . 'zipcode.json'), true );221 222 set_transient( 'blogdog_location_json', $this, 12 * HOUR_IN_SECONDS );223 224 }225 199 226 200 } … … 640 614 <div id="sortable" class="wait-to-load"> 641 615 642 <? _e( 'Loading . . . ', 'blogdog' ); ?><i class="fa fa-spinner fa-pulse fa-fw fa-2x"></i>616 <? _e( 'Loading . . . Please Wait.', 'blogdog' ); ?><i class="fa fa-spinner fa-pulse fa-fw fa-2x"></i> 643 617 644 618 </div> … … 671 645 check_ajax_referer( 'blogdog_secure_me', 'blogdog_ajax_nonce' ); 672 646 673 $this->get_json();674 675 647 $settings = get_option( 'blogdog_api_settings' ); 676 648 … … 678 650 679 651 if( $locations = get_option( 'blogdog_locations' ) ) { 680 652 681 653 foreach( $locations as $location ) { 682 654 683 655 echo $this->blogdog_location( $location, $location['type'] ); 684 656 685 657 } 686 658 … … 1050 1022 1051 1023 public function blogdog_location( $location, $type, $ajax = false ) { 1052 1053 if( ! isset( $this->location_json ) ) {1054 1055 $this->get_json();1056 1057 }1058 1024 1059 1025 extract( $location ); … … 1152 1118 if( ! empty ( $city ) ) { 1153 1119 1154 $result = $this->blogdog_zipcode_checkbox( $city, $zip, $section ); 1155 1156 if( $result ) echo $result; 1157 else _e( 'No zipcodes available for this city.', 'blogdog' ); 1120 echo $this->blogdog_zipcode_checkbox( $city, $zip, $section ); 1158 1121 1159 1122 } ?> … … 1246 1209 <? _e( ' 4 Bedrooms and 3 Bath', 'blogdog' ); ?></td> 1247 1210 1248 </tr> 1249 1250 <? 1251 $settings = array(); 1211 </tr><? 1212 1252 1213 $settings = get_option( 'blogdog_api_settings' ); 1253 1214 … … 1280 1241 } 1281 1242 1282 1243 /** 1244 * Get Json 1245 * 1246 * Get type of json requestsed and store in transient if not already. 1247 * 1248 * @since 7.0.0 1249 * 1250 * @param string $type Filename of json. 1251 */ 1252 1253 public function get_json( $type ) { 1254 1255 $transient = 'blogdog_json_' . $type; 1256 1257 if( $json = get_transient( $transient ) ) { 1258 1259 return $json; 1260 1261 } else { 1262 1263 $json = json_decode( file_get_contents( $this->base_url . 'json/' . $type . '.json' ), true ); 1264 1265 set_transient( $transient, $json, 12 * HOUR_IN_SECONDS ); 1266 1267 return $json; 1268 1269 } 1270 1271 } 1272 1283 1273 /** 1284 1274 * State select … … 1297 1287 <option value=""><? _e( 'Select One', 'blogdog' ); ?></option><? 1298 1288 1299 foreach ( $this-> state_jsonas $state ) { ?>1289 foreach ( $this->get_json( 'state' ) as $state ) { ?> 1300 1290 1301 1291 <option value="<? echo $state['state_code']; ?>" <? if( $saved_state == $state['state_code'] ) echo 'selected'; ?>> … … 1348 1338 <option value=""><? _e( 'Select City', 'blogdog' ); ?></option><? 1349 1339 1350 foreach ( $this-> city_jsonas $row ) {1340 foreach ( $this->get_json( 'city' ) as $row ) { 1351 1341 1352 1342 if( $row['state_code'] == $state ) { ?> … … 1385 1375 1386 1376 $i = false; 1387 1388 $this->get_json();1389 1377 1390 1378 ob_start(); 1391 1379 1392 foreach ( $this-> zip_jsonas $row ) {1380 foreach ( $this->get_json( 'zipcode' ) as $row ) { 1393 1381 1394 1382 if( $row['city'] == $city && $row['state'] == $state ) { … … 1413 1401 1414 1402 } 1415 1416 if( $i ) return ob_get_clean(); 1417 else return false; 1403 1404 if( ! $i ) 'No zipcodes available for this city.'; 1405 1406 return ob_get_clean(); 1418 1407 1419 1408 } -
blogdog/trunk/blogdog.php
r1750834 r1751990 4 4 Plugin URI: https://reblogdog.com 5 5 Description: Add automated real estate content to your website. We publish an SEO optimized blog post for you everyday. 6 Version: 7.0. 06 Version: 7.0.1 7 7 Author: reblogdog 8 8 Author URI: https://reblogdog.com … … 28 28 29 29 if ( ! defined( 'BLOGDOG_PLUGIN_VERSION' ) ) 30 define( 'BLOGDOG_PLUGIN_VERSION', '7.0. 0' );30 define( 'BLOGDOG_PLUGIN_VERSION', '7.0.1' ); 31 31 32 32 /** … … 156 156 157 157 add_action( 'check_event_schedule', array( $this, 'check_event_schedule' ), 10, 1 ); 158 159 /** 160 * Refresh Transients 161 * 162 * @since 7.0.1 163 */ 164 165 add_action( 'init', array( $this, 'blogdog_refresh_transients' ) ); 158 166 159 167 … … 639 647 640 648 } 649 650 /** 651 * Blogdog Refresh Tarnsients. 652 * 653 * Delete the location json transients. 654 * 655 * @since 7.0.1 656 */ 657 658 public function blogdog_refresh_transients() { 659 660 if( isset( $_GET['blogdog_refresh'] ) ) { 661 delete_transient( 'blogdog_json_city' ); 662 delete_transient( 'blogdog_json_state' ); 663 delete_transient( 'blogdog_json_zipcode' ); 664 } 665 666 } 641 667 642 668 /** -
blogdog/trunk/readme.txt
r1750834 r1751990 63 63 == Changelog == 64 64 65 = 7.0.1 = 66 67 * Bug fix - Storing locations json in separate transients. 68 65 69 = 7.0.0 = 66 70
Note: See TracChangeset
for help on using the changeset viewer.