Skip to content

Instantly share code, notes, and snippets.

@supercleanse
Created January 29, 2013 06:38
Show Gist options
  • Save supercleanse/4662296 to your computer and use it in GitHub Desktop.
Save supercleanse/4662296 to your computer and use it in GitHub Desktop.
<?php
// TRIM PARAMS FROM REQUEST_URI
$request_uri = preg_replace('#\?.*#','',$_SERVER['REQUEST_URI']);
preg_match('#^https?://[^/]+(/.*)?#', home_url(), $matches);
$pre_slug = isset($matches[1])?$matches[1]:'';
if( !empty($plugin) and $plugin == 'wafp' and
!empty($controller) and !empty($action) )
{
self::standalone_route($controller, $action);
exit;
}
else if( isset( $_POST ) and isset( $_POST['wafp_process_login_form'] ) )
WafpUsersController::process_login_form();
else if( $wafp_options->pretty_affiliate_links and
preg_match( '#^' . $pre_slug . '/([^/]*)/([^/]*)/?$#', $request_uri, $matches ) and
isset( $matches[1] ) and isset( $matches[2] ) and
!is_null( $affiliate_id = username_exists( $matches[1] ) ) and
$link = WafpLink::get_link_from_slug( $matches[2] ) ) {
WafpLinksController::redirect_link( $link->rec->id, $affiliate_id );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment