public function showAddressPage() { if (strlen($this->data) == 0) { return $this->showAddressForm(); } else { $this->getLatLon(); if (strlen($this->error) > 0) { $this->return .= '<p class="wbb-alert wbb-alert-danger">' . $this->error . '</p>'; return $this->showAddressForm(); } else { $data = Neighborhood::getNeighborhoodFromLatLng($this->lat, $this->lng); if ($data['id'] == 0) { if (strlen($data['expires_at']) > 0 && strtotime($data['expires_at']) < strtotime(date('Y-m-d'))) { $this->return .= "\n\t\t\t\t\t\t\t<script>\n\n\t\t\t\t\t\t\t\tvar wbb_popup_width = 450;\n\t\t\t\t\t\t\t\tvar wbb_popup_height = 300;\n\t\t\t\t\t\t\t\tvar wbb_popup_html = 'We are sorry, but registration has ended for the " . $data['title'] . " neighborhood.<br><br>\\\n\t\t\t\t\t\t\t\tSign up for the Walk Bike Bus<br>newsletter to stay informed.<br><br>\\\n\t\t\t\t\t\t\t\tEmail Address:\\\n\t\t\t\t\t\t\t\t<form id=\"wbb-newsletter-form\">\\\n\t\t\t\t\t\t\t\t<input name=\"email\"><br>\\\n\t\t\t\t\t\t\t\t<button class=\"submit\">Submit</button>\\\n\t\t\t\t\t\t\t\t</form>';\n\n\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t"; } else { $this->return .= "\n\t\t\t\t\t\t\t<script>\n\n\t\t\t\t\t\t\t\tvar wbb_popup_width = 450;\n\t\t\t\t\t\t\t\tvar wbb_popup_height = 300;\n\t\t\t\t\t\t\t\tvar wbb_popup_html = '<img src=\"" . plugin_dir_url(dirname(__FILE__)) . "/images/sorry.png\"><br><br>\\\n\t\t\t\t\t\t\t\tSign up for the Walk Bike Bus<br>newsletter to stay informed.<br><br>\\\n\t\t\t\t\t\t\t\tEmail Address:\\\n\t\t\t\t\t\t\t\t<form id=\"wbb-newsletter-form\">\\\n\t\t\t\t\t\t\t\t<input name=\"email\"><br>\\\n\t\t\t\t\t\t\t\t<button class=\"submit\">Submit</button>\\\n\t\t\t\t\t\t\t\t</form>';\n\n\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t"; } //$this->return .= '<p class="wbb-alert wbb-alert-danger">The address you entered does not lie within one of our approved areas.</p>'; return $this->showAddressForm(); } else { $this->return .= "\n\t\t\t\t\t\t<script>\n\n\t\t\t\t\t\t\tvar wbb_popup_width = 450;\n\t\t\t\t\t\t\tvar wbb_popup_height = 200;\n\t\t\t\t\t\t\tvar wbb_popup_html = '<img src=\"" . plugin_dir_url(dirname(__FILE__)) . "/images/congrats.png\"><br><br>\\\n\t\t\t\t\t\t\tYou are part of a very small number of people in " . $data['title'] . " that are eligible to participate in our Walk Bike Bus pilot program!';\n\n\t\t\t\t\t\t</script>\n\t\t\t\t\t"; //$this->return .= '<p class="wbb-alert wbb-alert-success">Congrats! You are eligible to register for the ' . $data['title'] . ' neighborhood!</p>'; $_SESSION['wbb_register_neighborhood_id'] = $data['id']; $_SESSION['wbb_register_neighborhood_title'] = $data['title']; return $this->showRegisterForm(); } } } }