PluginProbe
Redirection / 2.8.1
Redirection v2.8.1
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 / action.php

action.php in Redirection 2.8.1, at models/action.php

46 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Red_Action {
4 function __construct( $values ) {
5 if ( is_array( $values ) ) {
6 foreach ( $values as $key => $value ) {
7 $this->$key = $value;
8 }
9 }
10 }
11
12 static function create( $name, $code ) {
13 $avail = self::available();
14
15 if ( isset( $avail[ $name ] ) ) {
16 if ( ! class_exists( strtolower( $avail[ $name ][1] ) ) ) {
17 include_once dirname( __FILE__ ).'/../actions/'.$avail[ $name ][0];
18 }
19
20 $obj = new $avail[ $name ][1]( array( 'action_code' => $code ) );
21 $obj->type = $name;
22 return $obj;
23 }
24
25 return false;
26 }
27
28 static function available() {
29 return array(
30 'url' => array( 'url.php', 'Url_Action' ),
31 'error' => array( 'error.php', 'Error_Action' ),
32 'nothing' => array( 'nothing.php', 'Nothing_Action' ),
33 'random' => array( 'random.php', 'Random_Action' ),
34 'pass' => array( 'pass.php', 'Pass_Action' ),
35 );
36 }
37
38 public function process_before( $code, $target ) {
39 return $target;
40 }
41
42 public function process_after( $code, $target ) {
43 return true;
44 }
45 }
46