PluginProbe
Redirection / 2.3.14
Redirection v2.3.14
5.10.0 5.9.0 5.8.1 5.8.0 3.7.2 3.7.3 4.0 4.0.1 4.1 4.1.1 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6.2 4.7.1 All 130 releases
redirection / models / match.php

match.php in Redirection 2.3.14, at models/match.php

106 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $this->url = $values;
29
30 $obj = maybe_unserialize( $values );
31
32 if ( is_array( $obj ) ) {
33 foreach ( $obj AS $key => $value ) {
34 $this->$key = $value;
35 }
36 }
37 }
38 }
39
40 function data( $details ) {
41 $data = $this->save( $details );
42 if ( count( $data ) == 1 && !is_array( current( $data ) ) )
43 $data = current( $data );
44 else
45 $data = serialize( $data );
46 return $data;
47 }
48
49 function save( $details ) {
50 return array();
51 }
52
53 function name() {
54 return '';
55 }
56
57 function show() {
58 }
59
60 function wants_it() {
61 return true;
62 }
63
64 function get_target( $url, $matched_url, $regex ) {
65 return false;
66 }
67
68 static function create( $name, $data = '' ) {
69 $avail = self::available();
70 if ( isset( $avail[strtolower( $name )] ) ) {
71 $classname = $name.'_match';
72
73 if ( !class_exists( strtolower( $classname ) ) )
74 include( dirname( __FILE__ ).'/../matches/'.$avail[strtolower( $name )] );
75 return new $classname( $data );
76 }
77
78 return false;
79 }
80
81 static function all() {
82 $data = array();
83
84 $avail = self::available();
85 foreach ( $avail AS $name => $file ) {
86 $obj = self::create( $name );
87 $data[$name] = $obj->name();
88 }
89
90 return $data;
91 }
92
93 static function available() {
94 return array (
95 'url' => 'url.php',
96 'referrer' => 'referrer.php',
97 'agent' => 'user_agent.php',
98 'login' => 'login.php',
99 );
100 }
101
102 function match_name() {
103 return '';
104 }
105 }
106