Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Bump to version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Huisinga committed Jun 10, 2015
1 parent e75cc28 commit 6ddd02e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 94 deletions.
4 changes: 2 additions & 2 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jQuery('document').ready(function ($) {
$('#' + $(this).attr('id') + '-answer').text($(this).val());
});

$('#price_min,#price_max,#num_baths,#num_beds').each(function () {
var numbers_comma = /^[0-9,]*$/;
$('#price').each(function () {
var numbers_comma = /^[0-9,$+-]*$/;

if (!numbers_comma.test($(this).val())) {
var label = $("label[for='" + $(this).attr('id') + "']").text();
Expand Down
6 changes: 3 additions & 3 deletions assets/vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$baseDir = dirname($vendorDir);

return array(
'ColdTurkey\\HouseHunter\\FrontDesk' => $baseDir . '/../classes/class-frontdesk.php',
'ColdTurkey\\HouseHunter\\HouseHunter' => $baseDir . '/../classes/class-homes-report.php',
'ColdTurkey\\HouseHunter\\HouseHunter_Admin' => $baseDir . '/../classes/class-homes-report-admin.php',
'ColdTurkey\\HomesReport\\FrontDesk' => $baseDir . '/../classes/class-frontdesk.php',
'ColdTurkey\\HomesReport\\HomesReport' => $baseDir . '/../classes/class-homes-report.php',
'ColdTurkey\\HomesReport\\HomesReport_Admin' => $baseDir . '/../classes/class-homes-report-admin.php',
);
8 changes: 1 addition & 7 deletions classes/class-homes-report-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ public function leads_page()
<th scope="col" class="manage-column entry_nowrap">Email</th>
<th scope="col" class="manage-column entry_nowrap">Location</th>
<th scope="col" class="manage-column entry_nowrap">Price Range</th>
<th scope="col" class="manage-column entry_nowrap"># Beds</th>
<th scope="col" class="manage-column entry_nowrap"># Baths</th>
<th scope="col" class="manage-column entry_nowrap">Submitted</th>
</tr>
</thead>
Expand All @@ -294,9 +292,7 @@ public function leads_page()
<td class="entry_nowrap">' . $lead->first_name . '</td>
<td class="entry_nowrap">' . $lead->email . '</td>
<td class="entry_nowrap">' . $lead->location . '</td>
<td class="entry_nowrap">$' . number_format( $lead->price_min ) . ' - $' . number_format( $lead->price_max ) . '</td>
<td class="entry_nowrap">' . $lead->num_beds . '</td>
<td class="entry_nowrap">' . $lead->num_baths . '</td>
<td class="entry_nowrap">' . $lead->price_range . '</td>
<td class="entry_nowrap">' . date( "M j Y, h:i:a", strtotime( $lead->created_at ) ) . '</td>
</tr>';
}
Expand All @@ -309,8 +305,6 @@ public function leads_page()
<th scope="col" class="manage-column entry_nowrap">Email</th>
<th scope="col" class="manage-column entry_nowrap">Location</th>
<th scope="col" class="manage-column entry_nowrap">Price Range</th>
<th scope="col" class="manage-column entry_nowrap"># Beds</th>
<th scope="col" class="manage-column entry_nowrap"># Baths</th>
<th scope="col" class="manage-column entry_nowrap">Submitted</th>
</tr>
</tfoot>
Expand Down
52 changes: 32 additions & 20 deletions classes/class-homes-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@ public function build_database_table()
`first_name` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`location` varchar(255) NOT NULL,
`price_min` varchar(255) DEFAULT NULL,
`price_max` varchar(20) DEFAULT NULL,
`num_beds` int(10) DEFAULT NULL,
`num_baths` int(10) DEFAULT NULL,
`price_range` varchar(255) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) $charset_collate;";
Expand Down Expand Up @@ -284,6 +281,11 @@ public function meta_box_content($post, $meta)
$html .= '<input style="width:100%" name="' . esc_attr($k) . '" id="' . esc_attr($k) . '" placeholder="' . esc_attr($placeholder) . '" type="text" value="' . esc_attr($data) . '" />';
$html .= '<p class="description">' . $v['description'] . '</p>' . "\n";
$html .= '</td><tr/>' . "\n";
} elseif ($type == 'textarea') {
$html .= '<tr valign="top"><th scope="row"><label for="' . esc_attr($k) . '">' . $v['name'] . '</label></th><td>';
$html .= '<textarea style="width:100%" rows="5" name="' . esc_attr($k) . '" id="' . esc_attr($k) . '" placeholder="' . esc_attr($placeholder) . '" type="text">' . esc_attr($data) . '</textarea>';
$html .= '<p class="description">' . $v['description'] . '</p>' . "\n";
$html .= '</td><tr/>' . "\n";
} elseif ($type == 'posts') {
$html .= '<tr valign="top"><th scope="row"><label for="' . esc_attr($k) . '">' . $v['name'] . '</label></th><td>';
$html .= '<select style="width:100%" name="' . esc_attr($k) . '" id="' . esc_attr($k) . '">';
Expand Down Expand Up @@ -440,6 +442,24 @@ public function get_custom_fields_settings($meta_box)
$fields = [];

if ($meta_box == 'basic' || $meta_box == 'all') {
$fields['page_title'] = [
'name' => __('Page Headline', $this->token),
'description' => __('The headline for your page.', $this->token),
'placeholder' => __('You Decide What Your Home Is Worth', $this->token),
'type' => 'text',
'default' => 'You Decide What Your Home Is Worth',
'section' => 'info'
];

$fields['page_subtitle'] = [
'name' => __('Page Sub-Headline', $this->token),
'description' => __('The sub-headline for your page.', $this->token),
'placeholder' => __('Download a custom report of homes in your area that sold in the last 90 days (from the official database of sold listings).', $this->token),
'type' => 'textarea',
'default' => 'Download a custom report of homes in your area that sold in the last 90 days (from the official database of sold listings).',
'section' => 'info'
];

$fields['call_to_action'] = [
'name' => __('Your Call To Action', $this->token),
'description' => __('The call to action for users to give you their contact information.', $this->token),
Expand All @@ -449,12 +469,12 @@ public function get_custom_fields_settings($meta_box)
'section' => 'info'
];

$fields['buyer_quiz'] = [
'name' => __('Link To Buyer Quiz', $this->token),
$fields['seller_quiz'] = [
'name' => __('Link To Seller Quiz', $this->token),
'description' => __('The last step of the funnel allows you to link the user to your HomeBuyer Quiz. Enter the link for the quiz here.', $this->token),
'placeholder' => '',
'type' => 'posts',
'default' => 'pf_buyer_quiz',
'default' => 'pf_seller_quiz',
'section' => 'info'
];

Expand Down Expand Up @@ -638,24 +658,18 @@ public function process_submission()
$email = sanitize_text_field($_POST['email']);
$source = sanitize_text_field($_POST['permalink']);
$location = sanitize_text_field($_POST['location']);
$price_min = str_replace(',', '', sanitize_text_field($_POST['price_min']));
$price_max = str_replace(',', '', sanitize_text_field($_POST['price_max']));
$num_beds = sanitize_text_field($_POST['num_beds']);
$num_baths = sanitize_text_field($_POST['num_baths']);
$price_range = sanitize_text_field($_POST['price']);

$wpdb->query($wpdb->prepare(
'INSERT INTO ' . $this->table_name . '
( blog_id, first_name, email, location, price_min, price_max, num_beds, num_baths, created_at )
VALUES ( %d, %s, %s, %s, %s, %s, %s, %s, NOW() )',
( blog_id, first_name, email, location, price_range, created_at )
VALUES ( %d, %s, %s, %s, %s, NOW() )',
[
$blog_id,
$first_name,
$email,
$location,
$price_min,
$price_max,
$num_beds,
$num_baths
$price_range
]
));

Expand Down Expand Up @@ -683,9 +697,7 @@ public function process_submission()
if ($frontdesk_id != null) {
$content = '<p>
<strong>Location: </strong>' . $location . '<br>
<strong>Price Range: </strong>$' . number_format($price_min) . ' - $' . number_format($price_max) . '<br>
<strong># Bedrooms: </strong>' . $num_beds . '<br>
<strong># Bathrooms: </strong>' . $num_baths . '
<strong>Price Range: </strong>' . $price_range . '
</p>';
$this->frontdesk->createNote($frontdesk_id, 'Homes Report Responses', $content);
}
Expand Down
98 changes: 36 additions & 62 deletions templates/single-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@

global $pf_homes_report, $wp_query;

$id = get_the_ID();
$title = get_the_title();
$permalink = get_permalink();
$broker = get_post_meta( $id, 'legal_broker', true );
$cta = get_post_meta( $id, 'call_to_action', true );
$retargeting = get_post_meta( $id, 'retargeting', true );
$conversion = get_post_meta( $id, 'conversion', true );
$photo = get_post_meta( $id, 'photo', true );
$name = get_post_meta( $id, 'name', true );
$quiz_link = get_post_meta( $id, 'buyer_quiz', true );
$phone = of_get_option( 'phone_number' );
$id = get_the_ID();
$title = get_the_title();
$permalink = get_permalink();
$broker = get_post_meta( $id, 'legal_broker', true );
$page_title = get_post_meta( $id, 'page_title', true );
$page_subtitle = get_post_meta( $id, 'page_subtitle', true );
$cta = get_post_meta( $id, 'call_to_action', true );
$retargeting = get_post_meta( $id, 'retargeting', true );
$conversion = get_post_meta( $id, 'conversion', true );
$photo = get_post_meta( $id, 'photo', true );
$name = get_post_meta( $id, 'name', true );
$quiz_link = get_post_meta( $id, 'seller_quiz', true );
$phone = of_get_option( 'phone_number' );

// Get the background image
if ( has_post_thumbnail( $id ) )
Expand Down Expand Up @@ -94,12 +96,10 @@
<img src="<?= $photo ?>" class="img-responsive img-thumbnail">
</div>
<div class="col-sm-5">
Hey, it's <?= $name ?>. I will send you an updated list of homes for sale within the next 24 hours. <br>
Thanks
for using the house hunter tool! <br> <strong>I'll email you a custom link as soon as I've researched the active
listings that fit your price range.</strong>
Hey, it's <?= $name ?>. I will send you an updated list of homes that sold within the next 24 hours. <br>
Thanks for using the homes report tool! <br> <strong>I'll email you a custom link as soon as I've researched your requested price range.</strong>
<?php if ( $quiz_link != '' ) { ?>
<br> Oh, and one more thing. If you're thinking about buying a home this year, take my 14 question <strong>HomeBuyer Quiz</strong> to find out what you'll qualify for.
<br> Oh, and one more thing. If you're thinking about selling your home this year, take my 14 question <strong>Seller Quiz</strong> to find out if you're ready to sell.
<a href="<?= $quiz_link ?>" class="btn btn-primary btn-block">Take The Quiz</a>
<?php } ?>
</div>
Expand All @@ -109,54 +109,30 @@
<form id="homes-report">
<div class="row page animated fadeIn">
<div class="col-xs-10 col-xs-offset-1 col-sm-12 col-sm-offset-0 col-md-8 col-md-offset-2" id="landing" data-model="landing">
<h1 style="text-align: center;" class="landing-title"><?= $title ?></h1>
<h1 style="text-align: center;" class="landing-title"><?= $page_title ?></h1>

<h2 style="text-align: center;" id="subtitle">Sign up for up to date listings with accurate information taken
directly from the
MLS database.</h2>
<h2 style="text-align: center;" id="subtitle"><?= $page_subtitle ?></h2>

<div class="form-group">
<label class="control-label" for="location">Location</label>
<input type="text" class="form-control validate" id="location" name="location" placeholder="City">
<label class="control-label" for="location">City</label>
<input type="text" class="form-control validate" id="location" name="location" placeholder="Your City">
</div>

<div class="row">
<div class="col-xs-12 col-sm-6">
<label class="control-label">Price</label>

<div class="form-group">
<label class="control-label sr-only" for="price_min">Minimum Price</label>

<div class="input-group">
<span class="input-group-addon">$</span>
<input type="text" class="form-control validate" id="price_min" name="price_min" placeholder="Min Price">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<label class="control-label" style="visibility: hidden">Price</label>

<div class="form-group">
<label class="control-label sr-only" for="price_max">Maximum Price</label>

<div class="input-group">
<span class="input-group-addon">$</span>
<input type="text" class="form-control validate" id="price_max" name="price_max" placeholder="Max Price">
</div>
</div>
</div>
</div>

<div class="row">
<div class="col-xs-12 col-sm-6">
<label class="control-label" for="num_beds">Bedrooms</label>
<input type="text" class="form-control validate" id="num_beds" name="num_beds" placeholder="Any # Beds">
</div>
<div class="col-xs-12 col-sm-6">
<label class="control-label" for="num_baths">Bathrooms</label>
<input type="text" class="form-control validate" id="num_baths" name="num_baths" placeholder="Any # Baths">
</div>
</div>
<div class="form-group">
<label class="control-label" for="price">Price Range</label>
<select class="form-control validate" id="price" name="price">
<option value="$0-$100,000">$0-$100,000</option>
<option value="$150,000-$200,000">$150,000-$200,000</option>
<option value="$200,000-$250,000">$200,000-$250,000</option>
<option value="$250,000-$300,000">$250,000-$300,000</option>
<option value="$300,000-$350,000">$300,000-$350,000</option>
<option value="$350,000-$400,000">$350,000-$400,000</option>
<option value="$400,000-$450,000">$400,000-$450,000</option>
<option value="$450,000-$500,000">$450,000-$500,000</option>
<option value="$500,000-$600,000">$500,000-$600,000</option>
<option value="$600,000+">$600,000+</option>
</select>
</div>

<button class="btn btn-primary btn-lg btn-block" id="get-results"><?= $cta ?></button>
</div>
Expand All @@ -168,9 +144,7 @@
<div class="modal-body">
<h1>Where should we send your search results?</h1>

<p><span id="num_beds-answer"></span> bedroom, <span id="num_baths-answer"></span> bathroom homes in
<span id="location-answer"></span> priced between $<span id="price_min-answer"></span> and
$<span id="price_max-answer"></span></p>
<p>Homes in <span id="location-answer"></span> that sold for between $<span id="price-answer"></span></p>

<div class="form-group" style="margin-top:20px">
<label for="first_name" class="control-label">First Name</label>
Expand Down

0 comments on commit 6ddd02e

Please sign in to comment.