Created
August 16, 2012 13:46
-
-
Save wpsmith/3370196 to your computer and use it in GitHub Desktop.
Shopp Referrer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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