Released under the terms of the GNU General Public License. You should have received a copy of the GNU General Public License. If not, see: . */ /* Direct access denial. */ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"])) exit; /* Include class for Altos Base. */ include_once (dirname (__FILE__) . "/altos-base.php"); /* Class for Altos Post. */ class Altos_Post extends Altos_Base { function __construct () { parent::__construct (); /**/ add_action ("the_content", array (&$this, "on_the_content")); add_action ("wp_print_styles", array (&$this, "on_wp_print_styles")); } /**/ function on_the_content ($content) { global $post; /**/ $altos_chart = array (); /**/ preg_match_all ("#\[(altos_chart|altos_regional_chart|altos_flash_chart|altos_stat_table)\s+([^\]]+)\/\]#si", strip_tags (str_replace ("\n", "", $content)), $match_attributes); /**/ foreach ($match_attributes[1] as $key => $tag) { $options = null; /**/ $string = str_replace (" ", "&", str_replace (array("”" , "″"), "", trim ($match_attributes[2][$key]))); /**/ parse_str ($string, $options); /**/ $markup = $match_attributes[0][$key]; /**/ switch ($tag): /**/ case "altos_flash_chart": /**/ $options["s"] = null; /**/ $response = $this->get_flash_chart ($options["st"], $options["cid"], $options["zid"], $options["rt"], $options["ra"], $options["q"], $options["left"], $options["right"], $options["mini"]); /**/ $flash_chart_html = null; /**/ if ($this->has_error ($response)) { $flash_chart_html = $response->errorMessage; } else { $flashvars = $response->response->url; /**/ $flash_chart_html = ''; $flash_chart_html .= ''; $flash_chart_html .= ''; $flash_chart_html .= ''; $flash_chart_html .= ''; $flash_chart_html .= ''; $flash_chart_html .= ''; $flash_chart_html .= ''; } /**/ $content = str_replace ($markup, $flash_chart_html, $content); /**/ break; /**/ case "altos_stat_table": /**/ $stat_table_html = null; /**/ foreach (explode (",", $options["rt"]) as $rt) { $response = $this->get_stat_table ($options["st"], $options["cid"], $options["zid"], $rt, $options["ra"], $options["q"], $timeframe); /**/ if ($this->has_error ($response)) { $stat_table_html = $response->errorMessage; } else if ($options["format"] === "narrow") { $stat_table = $response->response; /**/ $stat_table_html = ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= '
'; $stat_table_html .= $stat_table->cityName . ', ' . $stat_table->state . ' ' . $stat_table->zipCode . '
'; $stat_table_html .= $stat_table->residenceType . '
'; $stat_table_html .= $stat_table->date; $stat_table_html .= '
Median List Price:' . $stat_table->medianPrice . '
Total Inventory:' . $stat_table->inventory . '
Homes Absorbed:' . $stat_table->medianAbsorbed . '
Days on Market:' . $stat_table->daysOnMarket . '
'; } else { $stat_table = $response->response; /**/ $stat_table_html = ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; $stat_table_html .= ''; /**/ $stat_table_html .= '
'; $stat_table_html .= $stat_table->rollingAverage . ' stats for ' . $stat_table->residenceType . ' properties in
'; $stat_table_html .= $stat_table->cityName . ', ' . $stat_table->state . ' ' . $stat_table->zipCode . ' as of ' . date ("F j, Y", strtotime ($stat_table->date)); $stat_table_html .= '
Median List Price:' . $stat_table->medianPrice . 'Average List Price:' . $stat_table->meanPrice . '
Total Inventory:' . $stat_table->inventory . 'Price per Square Foot:' . $stat_table->pricePerSquareFoot . '
Average Home Size:' . $stat_table->medianSquareFoot . 'Median Lot Size:' . $stat_table->medianLotSize . '
Average # Beds:' . $stat_table->meanBeds . 'Average # Baths:' . $stat_table->meanBaths . '
Homes Absorbed:' . $stat_table->medianAbsorbed . 'Newly Listed:' . $stat_table->newlyListed . '
Days on Market:' . $stat_table->daysOnMarket . 'Average Age:' . $stat_table->meanAge . '
'; } } /**/ $content = str_replace ($markup, $stat_table_html, $content); /**/ break; /**/ case "altos_chart": /**/ $chart_link = $altoschart = $timeframe = null; /**/ $stat_table_nicenames = array ("median_price" => "Median Price", "median_inventory" => "Inventory", "mean_dom" => "Average Days on Market", "median_per_sqft" => "Median Price Per Square Foot", "median_market_heat" => "Median Market Action Index"); $stat_table_varname = array ("median_price" => "medianPrice", "median_inventory" => "inventory", "mean_dom" => "daysOnMarket", "median_per_sqft" => "pricePerSquareFoot", "median_market_heat" => "medianMarketHeat"); /**/ $chart_link = strstr ($options["link"], "http://") ? $options["link"] : "http://" . $options["link"]; $chart_link = ($chart_link == "http://") ? false : $chart_link; /**/ if ($options["endDate"] != "dynamic") { $timeframe = $options["endDate"]; } /**/ $options["s"] = null; /**/ if (strlen ($options["left"])) { $options["s"] = $options["left"] . ":l"; } /**/ if (strlen ($options["right"])) { if (strlen ($options["s"]) > 1) { $options["s"] .= ","; } $options["s"] .= $options["right"] . ":r"; } /**/ $options["sz"] = $options["size"]; $options["ts"] = $options["timeSpan"]; $options["th"] = $options["theme"]; /**/ $response = $this->get_state_city_zip_chart_url ($options["st"], $options["cid"], $options["zid"], $options["s"], $options["sz"], $options["rt"], $options["ra"], $options["q"], $options["ts"], $options["th"], $timeframe); /**/ if ($this->has_error ($response)) { $altos_charts_html = $response->errorMessage; } else { $altoschart = $response->response; } /**/ $altos_charts_html = ($chart_link) ? '' : ''; $altos_charts_html .= '' . $altoschart->alt . ''; $altos_charts_html .= ($chart_link) ? '' : ''; /**/ $content = str_replace ($markup, $altos_charts_html, $content); /**/ break; /**/ case "altos_regional_chart": /**/ $chart_link = $altoschart = $timeframe = null; /**/ $stat_table_nicenames = array ("median_price" => "Median Price", "median_inventory" => "Inventory", "mean_dom" => "Average Days on Market", "median_per_sqft" => "Median Price Per Square Foot", "median_market_heat" => "Median Market Action Index"); $stat_table_varname = array ("median_price" => "medianPrice", "median_inventory" => "inventory", "mean_dom" => "daysOnMarket", "median_per_sqft" => "pricePerSquareFoot", "median_market_heat" => "medianMarketHeat"); /**/ $chart_link = strstr ($options["link"], "http://") ? $options["link"] : "http://" . $options["link"]; $chart_link = ($chart_link == "http://") ? false : $chart_link; /**/ if ($options["endDate"] != "dynamic") { $timeframe = $options["endDate"]; } /**/ $options["s"] = null; /**/ if (strlen ($options["left"])) { $options["s"] = $options["left"] . ":l"; } /**/ if (strlen ($options["right"])) { if (strlen ($options["s"]) > 1) { $options["s"] .= ","; } $options["s"] .= $options["right"] . ":r"; } /**/ $options["sz"] = $options["size"]; $options["ts"] = $options["timeSpan"]; /**/ $response = $this->get_regional_chart_url ($options["regionId"], $options["s"], $options["sz"], $options["rt"], $options["ra"], $options["q"], $options["ts"]); /**/ $altos_regional_charts_html = null; /**/ if ($this->has_error ($response)) { $altos_regional_charts_html = $response->errorMessage; } else { $altos_regional_chart = $response->response; } /**/ $altos_regional_charts_html = ($chart_link) ? '' : ''; $altos_regional_charts_html .= '' . $altos_regional_chart->alt . ''; $altos_regional_charts_html .= ($chart_link) ? '' : ''; /**/ $content = str_replace ($markup, $altos_regional_charts_html, $content); /**/ default: /**/ endswitch; } /**/ return $content; } /**/ function on_wp_print_styles () { echo ''; } } ?>