first commit
[curl-de-sac.git] / web / Obj / curl-de-sac.phh
1 <?php
2 /*
3  *  curl-de-sac - curl-de-sac.phh
4  *
5  *  Copyright (C)      2014 Matteo Nastasi
6  *                          mailto: nastasi@alternativeoutput.it
7  *                                  matteo.nastasi@gmail.com
8  *                          web: http://www.alternativeoutput.it
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details. You should have received a
19  * copy of the GNU General Public License along with this program; if
20  * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21  * Suite 330, Boston, MA 02111-1307, USA.
22  *
23  */
24
25 $G_curl_de_sac_version = "0.1";
26
27 class CDS_cmd_cls {
28     var $name;
29     var $tout;
30     
31     function CDS_cmd_cls($name, $tout)
32     {
33         $this->name = $name;
34         $this->tout = $tout;
35     }
36
37     function cb()
38     {
39         print "THIS MUST BE IMPLEMENTED";
40         exit(123);
41     }
42 }
43
44 class Curl_de_sac {
45     var $mh;
46     var $cmd_cls;
47
48     function Curl_de_sac() {
49         $this->mh = curl_multi_init();
50         $this->cmd_cls = array();
51     }
52
53     function cmd_register($cmd_cls)
54     {
55         if (get_class($cmd_cls) != 'CDS_cmd_cls' || is_subclass_of($cmd_cls, 'CDS_cmd_cls') == FALSE)
56             return FALSE;
57
58         if (isset($this->cmd_cls[$cmd_cls->name]))
59             return FALSE;
60
61         $this->cmd[$cmd_cls->name] = $cmd_cls;
62
63         return TRUE;
64     }
65 }