<?php

require_once 'class-processor.php';
require_once 'class-route.php';
require_once '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);

if (!function_exists('alt_enviar_email_lp')) {

    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');

}