<?php

require 'class-processor.php';
require 'class-route.php';
require 'class-router.php';

$router = new Router('loja_lp_route_name');
$routes = array(
    'loja_lp_alt_enviar_email_lp' => new Route('ofertas/redirect', 'alt_enviar_email_lp'),
    'loja_lp_index' => new Route('oferta/([a-z0-9-]+)[/]?', 'alt_find_car', 'lp'),
);

Processor::init($router, $routes);

function alt_enviar_email_lp()
{

    $location = '/';

    if (!empty($_GET['location'])) {
        $location = $_GET['location'];
    }

    wp_redirect($location);
}
add_action('alt_enviar_email_lp', 'alt_enviar_email_lp');

