| 1 |
<?php |
| 2 |
/** |
| 3 |
* Redirection |
| 4 |
* |
| 5 |
* @package Redirection |
| 6 |
* @author John Godley |
| 7 |
* @copyright Copyright( C ) John Godley |
| 8 |
**/ |
| 9 |
|
| 10 |
/* |
| 11 |
============================================================================================================ |
| 12 |
This software is provided "as is" and any express or implied warranties, including, but not limited to, the |
| 13 |
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall |
| 14 |
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or |
| 15 |
consequential damages( including, but not limited to, procurement of substitute goods or services; loss of |
| 16 |
use, data, or profits; or business interruption ) however caused and on any theory of liability, whether in |
| 17 |
contract, strict liability, or tort( including negligence or otherwise ) arising in any way out of the use of |
| 18 |
this software, even if advised of the possibility of such damage. |
| 19 |
|
| 20 |
For full license details see license.txt |
| 21 |
============================================================================================================ */ |
| 22 |
|
| 23 |
class Red_Match { |
| 24 |
var $url; |
| 25 |
|
| 26 |
function Red_Match( $values = '' ) { |
| 27 |
if ( $values ) { |
| 28 |
$obj = @unserialize( $values ); |
| 29 |
if ( $obj === false ) |
| 30 |
$this->url = $values; |
| 31 |
else { |
| 32 |
foreach ( $obj AS $key => $value ) { |
| 33 |
$this->$key = $value; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
function data( $details ) { |
| 40 |
$data = $this->save( $details ); |
| 41 |
if ( count( $data ) == 1 && !is_array( current( $data ) ) ) |
| 42 |
$data = current( $data ); |
| 43 |
else |
| 44 |
$data = serialize( $data ); |
| 45 |
return $data; |
| 46 |
} |
| 47 |
|
| 48 |
function save( $details ) { |
| 49 |
return array(); |
| 50 |
} |
| 51 |
|
| 52 |
function name() { |
| 53 |
return ''; |
| 54 |
} |
| 55 |
|
| 56 |
function show() { |
| 57 |
} |
| 58 |
|
| 59 |
function wants_it() { |
| 60 |
return true; |
| 61 |
} |
| 62 |
|
| 63 |
function get_target( $url, $matched_url, $regex ) { |
| 64 |
return $false; |
| 65 |
} |
| 66 |
|
| 67 |
function create( $name, $data = '' ) { |
| 68 |
$avail = Red_Match::available(); |
| 69 |
if ( isset( $avail[strtolower( $name )] ) ) { |
| 70 |
$classname = $name.'_match'; |
| 71 |
|
| 72 |
if ( !class_exists( strtolower( $classname ) ) ) |
| 73 |
include( dirname( __FILE__ ).'/../matches/'.$avail[strtolower( $name )] ); |
| 74 |
return new $classname( $data ); |
| 75 |
} |
| 76 |
|
| 77 |
return false; |
| 78 |
} |
| 79 |
|
| 80 |
function all() { |
| 81 |
$data = array(); |
| 82 |
|
| 83 |
$avail = Red_Match::available(); |
| 84 |
foreach ( $avail AS $name => $file ) { |
| 85 |
$obj = Red_Match::create( $name ); |
| 86 |
$data[$name] = $obj->name(); |
| 87 |
} |
| 88 |
|
| 89 |
return $data; |
| 90 |
} |
| 91 |
|
| 92 |
function available() { |
| 93 |
return array ( |
| 94 |
'url' => 'url.php', |
| 95 |
'referrer' => 'referrer.php', |
| 96 |
'agent' => 'user_agent.php', |
| 97 |
'login' => 'login.php', |
| 98 |
); |
| 99 |
} |
| 100 |
|
| 101 |
function match_name() { |
| 102 |
return ''; |
| 103 |
} |
| 104 |
} |
| 105 |
|