* @version $Id: is_callable.php,v 1.3 2006/08/21 14:03:15 ggiunta Exp $ * @since PHP 4.0.6 * @require PHP 4.0.0 (true, false, etc...) * @todo add the 3rd parameter syntax... */ if (!function_exists('is_callable')) { function is_callable($var, $syntax_only=false) { if ($syntax_only) { /* from The Manual: * If the syntax_only argument is TRUE the function only verifies * that var might be a function or method. It will only reject simple * variables that are not strings, or an array that does not have a * valid structure to be used as a callback. The valid ones are * supposed to have only 2 entries, the first of which is an object * or a string, and the second a string */ return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); } else { if (is_string($var)) { return function_exists($var); } else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) { $obj = reset($var); if (is_string($obj)) { $methods = get_class_methods($obj); return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); } else if (is_object($obj)) { return method_exists($obj, $method); } } return false; } } } ?>g/central/trunk/changepassword.php'>
path: root/central/trunk/changepassword.php
blob: 1b92666b32486f3325e5af442f8946509a0c7458 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119