1 | <?php |
||
15 | class LdapHelper |
||
16 | { |
||
17 | /** |
||
18 | * Converts a string distinguished name into its separate pieces. |
||
19 | * |
||
20 | * @param string $dn |
||
21 | * @param int $withAttributes Set to 0 to get the attribute names along with the value. |
||
22 | * @return array |
||
23 | */ |
||
24 | public static function explodeDn($dn, $withAttributes = 1) |
||
34 | |||
35 | /** |
||
36 | * Given a DN as an array in ['cn=Name', 'ou=Employees', 'dc=example', 'dc=com'] form, return it as its string |
||
37 | * representation that is safe to pass back to a query or to save back to LDAP for a DN. |
||
38 | * |
||
39 | * @param array $dn |
||
40 | * @return string |
||
41 | */ |
||
42 | public static function implodeDn(array $dn) |
||
54 | |||
55 | /** |
||
56 | * Given a full escaped DN return the RDN in escaped form. |
||
57 | * |
||
58 | * @param string $dn |
||
59 | * @return string |
||
60 | */ |
||
61 | public static function getRdnFromDn($dn) |
||
68 | |||
69 | /** |
||
70 | * Recursively implodes an array with optional key inclusion |
||
71 | * |
||
72 | * Example of $include_keys output: key, value, key, value, key, value |
||
73 | * |
||
74 | * @access public |
||
75 | * @param array $array multi-dimensional array to recursively implode |
||
76 | * @param string $glue value that glues elements together |
||
77 | * @param bool $include_keys include keys before their values |
||
78 | * @param bool $trim_all trim ALL whitespace from string |
||
79 | * @return string imploded array |
||
80 | */ |
||
81 | public static function recursive_implode(array $array, $glue = ',', $include_keys = false, $trim_all = true) |
||
99 | |||
100 | } |
||
101 |