# redirection/2.6/actions/pass.php

Redirection, version 2.6. 41 lines.

- Page: https://pluginprobe.com/plugins/redirection/2.6/code/actions/pass.php
- Raw: https://pluginprobe.com/plugins/redirection/2.6/raw/actions/pass.php
- Modified: 2016-06-15T09:38:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/redirection/2.6/code/actions/pass.php#L10-L20`.

```php
<?php

class Pass_Action extends Red_Action {
	function process_before( $code, $target ) {
		// Determine what we are passing to:  local URL, remote URL, file
		if ( substr( $target, 0, 7 ) === 'http://' || substr( $target, 0, 8 ) === 'https://' ) {
			echo @wp_remote_fopen( $target );
			die();
		}
		else if ( substr( $target, 0, 7 ) === 'file://' ) {
			$parts = explode( '?', substr( $target, 7 ) );
			if ( count( $parts ) > 1 ) {
				// Put parameters into the environment
				$args = explode( '&', $parts[1] );

				if ( count( $args ) > 0 ) {
					foreach ( $args as $arg ) {
						$tmp = explode( '=', $arg );
						if ( count( $tmp ) === 1 )
							$_GET[ $arg ] = '';
						else
							$_GET[ $tmp[0] ] = $tmp[1];
					}
				}
			}

			include( $parts[0] );
			exit();
		}
		else {
			$_SERVER['REQUEST_URI'] = $target;
			if ( strpos( $target, '?' ) ) {
				$_SERVER['QUERY_STRING'] = substr( $target, strpos( $target, '?' ) + 1 );
				parse_str( $_SERVER['QUERY_STRING'], $_GET );
			}
		}

		return true;
	}
}

```
