Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created August 16, 2012 13:46
Show Gist options
  • Select an option

  • Save wpsmith/3370196 to your computer and use it in GitHub Desktop.

Select an option

Save wpsmith/3370196 to your computer and use it in GitHub Desktop.
Shopp Referrer
<?php
/*
* Gets previous page
*
* If the previous page is a page outside the site, returns the storefront page.
*
* @param $args array Optional Args
* @return $referrer string
*/
function lordsnet_shopp_referrer( $args = array() ) {
$referrer = $_SERVER['HTTP_REFERER'];
$parsed_url = parse_url( $referrer );
echo $parsed_url['host'] . '///';
if ( false === strpos( $parsed_url['host'], 'lordsnet' ) )
$referrer = shopp( 'storefront', 'url', 'return=1' );
if ( $args['return'] )
return $referrer;
echo $referrer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment