| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | // message class
|
|---|
| 4 | // Date: 2012-06-19
|
|---|
| 5 | //this class regist function to message
|
|---|
| 6 |
|
|---|
| 7 | class Message
|
|---|
| 8 | {
|
|---|
| 9 |
|
|---|
| 10 | protected $method_name;
|
|---|
| 11 | protected $obj;
|
|---|
| 12 | protected $par0 = -1;
|
|---|
| 13 | protected $par1 = -1;
|
|---|
| 14 | protected $par2 = -1;
|
|---|
| 15 | protected $par3 = -1;
|
|---|
| 16 | protected $method;
|
|---|
| 17 | protected $key;
|
|---|
| 18 |
|
|---|
| 19 | function __construct($method,$key,$obj,$method_name,$par0 = -1,$par1 = -1,$par2 = -1,$par3 = -1)
|
|---|
| 20 | {
|
|---|
| 21 | $this->method_name = $method_name;
|
|---|
| 22 | $this->obj = $obj;
|
|---|
| 23 | $this->method = $method;
|
|---|
| 24 | $this->key = $key;
|
|---|
| 25 |
|
|---|
| 26 | if ($this->method == 'post') {
|
|---|
| 27 | $arraytest = $_POST;
|
|---|
| 28 | } else $arraytest = $_GET;
|
|---|
| 29 |
|
|---|
| 30 | if (isset($arraytest[$par0])) $this->par0 = $arraytest[$par0];
|
|---|
| 31 | if (isset($arraytest[$par1])) $this->par1 = $arraytest[$par1];
|
|---|
| 32 | if (isset($arraytest[$par2])) $this->par2 = $arraytest[$par2];
|
|---|
| 33 | if (isset($arraytest[$par3])) $this->par3 = $arraytest[$par3];
|
|---|
| 34 |
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | //returns actual page
|
|---|
| 38 | function Activate() {
|
|---|
| 39 | if ($this->method == 'post') {
|
|---|
| 40 | $arraytest = $_POST;
|
|---|
| 41 | } else $arraytest = $_GET;
|
|---|
| 42 |
|
|---|
| 43 | if (array_key_exists($this->key,$arraytest)) {
|
|---|
| 44 | if ($this->par0 == -1) return call_user_func(array($this->obj,$this->method_name));
|
|---|
| 45 | if ($this->par1 == -1) return call_user_func(array($this->obj,$this->method_name),$this->par0);
|
|---|
| 46 | if ($this->par2 == -1) return call_user_func(array($this->obj,$this->method_name),$this->par0,$this->par1);
|
|---|
| 47 | if ($this->par3 == -1) return call_user_func(array($this->obj,$this->method_name),$this->par0,$this->par1,$this->par2);
|
|---|
| 48 | return call_user_func(array($this->obj,$this->method_name),$this->par0,$this->par1,$this->par2,$this->par3);
|
|---|
| 49 | }
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | }
|
|---|
| 53 | ?>
|
|---|