/** * Get a comma separated, URI encoded string of ZIP codes currently entered in settings */ public static function getZipsEncoded() { $zip_codes = Bizyhood_Utility::getOption(Bizyhood_Core::KEY_ZIP_CODES); if ($zip_codes) { return urlencode(implode(',', $zip_codes)); } else { return; } }
/** * Handler used for modifying the way business listings are displayed * @param string $content The post content * @return string Content */ public function postTemplate($content) { global $post, $wp_query; $api_url = Bizyhood_Utility::getApiUrl(); # Override content for the view business page $post_name = $post->post_name; if ($post_name === 'business-overview') { $signup_page_id = Bizyhood_Utility::getOption(self::KEY_SIGNUP_PAGE_ID); // get the bizyhood_id if (isset($wp_query->query_vars['bizyhood_id'])) { $bizyhood_id = urldecode($wp_query->query_vars['bizyhood_id']); } else { $bizyhood_id = isset($_REQUEST['bizyhood_id']) ? $_REQUEST['bizyhood_id'] : ''; } $response = wp_remote_retrieve_body(wp_remote_get($api_url . "/business/" . $bizyhood_id)); $business = json_decode($response); return Bizyhood_View::load('listings/single/default', array('content' => $content, 'business' => $business, 'signup_page_id' => $signup_page_id), true); } return $content; }