commit | author | age
|
175a52
|
1 |
<?php |
JK |
2 |
interface ibd_module { |
|
3 |
//static $name; |
|
4 |
function szukaj_info($tytul=NULL, $autor=NULL, $wydawnictwo=NULL); |
|
5 |
function szukaj_ISBN($ISBN); |
|
6 |
function szukaj_ISSN($ISSN); |
|
7 |
} |
|
8 |
|
|
9 |
class ibd implements Countable { |
|
10 |
static $providers = array( |
|
11 |
'ibd_BN', |
|
12 |
); |
|
13 |
|
|
14 |
static $timelimit = 25; |
|
15 |
|
|
16 |
function __call($function, $args) { |
|
17 |
$stop = time() + self::$timelimit; |
|
18 |
$return = array(); |
|
19 |
|
|
20 |
foreach(self::$providers as $provider) { |
|
21 |
if(time() >= $stop) break; |
|
22 |
|
|
23 |
$name = new $provider; |
|
24 |
if(!method_exists($name, $function)) { |
|
25 |
continue; |
|
26 |
} |
|
27 |
|
|
28 |
$results = call_user_func_array(array($name, $function), $args); |
|
29 |
|
|
30 |
if(!empty($results)) { |
|
31 |
$return[$name->name] = $results; |
|
32 |
} |
|
33 |
} |
|
34 |
|
|
35 |
return $return; |
|
36 |
} |
|
37 |
|
|
38 |
function count() { |
|
39 |
return count(self::$providers); |
|
40 |
} |
|
41 |
} |
|
42 |
?> |