當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Ldap_Converter::ascToHex32方法代碼示例

本文整理匯總了PHP中Zend_Ldap_Converter::ascToHex32方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Ldap_Converter::ascToHex32方法的具體用法?PHP Zend_Ldap_Converter::ascToHex32怎麽用?PHP Zend_Ldap_Converter::ascToHex32使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Ldap_Converter的用法示例。


在下文中一共展示了Zend_Ldap_Converter::ascToHex32方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testAsc2hex32

 public function testAsc2hex32()
 {
     $expected = '\\00\\01\\02\\03\\04\\05\\06\\07\\08\\09\\0a\\0b\\0c\\0d\\0e\\0f\\10\\11\\12\\13\\14\\15\\16\\17\\18\\19' . '\\1a\\1b\\1c\\1d\\1e\\1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`' . 'abcdefghijklmnopqrstuvwxyz{|}~';
     $str = '';
     for ($i = 0; $i < 127; $i++) {
         $str .= chr($i);
     }
     $this->assertEquals($expected, Zend_Ldap_Converter::ascToHex32($str));
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:9,代碼來源:ConverterTest.php

示例2: escapeValue

 /**
  * Escapes a DN value according to RFC 2253
  *
  * Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs.
  * The characters ",", "+", """, "\", "<", ">", ";", "#", " = " with a special meaning in RFC 2252
  * are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as \hexpair.
  * Finally all leading and trailing spaces are converted to sequences of \20.
  * @see Net_LDAP2_Util::escape_dn_value() from Benedikt Hallinger <beni@php.net>
  * @link http://pear.php.net/package/Net_LDAP2
  * @author Benedikt Hallinger <beni@php.net>
  *
  * @param  string|array $values An array containing the DN values that should be escaped
  * @return array The array $values, but escaped
  */
 public static function escapeValue($values = array())
 {
     /**
      * @see Zend_Ldap_Converter
      */
     require_once 'Zend/Ldap/Converter.php';
     if (!is_array($values)) {
         $values = array($values);
     }
     foreach ($values as $key => $val) {
         // Escaping of filter meta characters
         $val = str_replace(array('\\', ',', '+', '"', '<', '>', ';', '#', '='), array('\\\\', '\\,', '\\+', '\\"', '\\<', '\\>', '\\;', '\\#', '\\='), $val);
         $val = Zend_Ldap_Converter::ascToHex32($val);
         // Convert all leading and trailing spaces to sequences of \20.
         if (preg_match('/^(\\s*)(.+?)(\\s*)$/', $val, $matches)) {
             $val = $matches[2];
             for ($i = 0; $i < strlen($matches[1]); $i++) {
                 $val = '\\20' . $val;
             }
             for ($i = 0; $i < strlen($matches[3]); $i++) {
                 $val = $val . '\\20';
             }
         }
         if (null === $val) {
             $val = '\\0';
         }
         // apply escaped "null" if string is empty
         $values[$key] = $val;
     }
     return count($values) == 1 ? $values[0] : $values;
 }
開發者ID:conectapb,項目名稱:sysagroweb,代碼行數:45,代碼來源:Dn.php

示例3: escapeValue

 /**
  * Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
  *
  * Any control characters with an ACII code < 32 as well as the characters with special meaning in
  * LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
  * backslash followed by two hex digits representing the hexadecimal value of the character.
  * @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger <beni@php.net>
  * @link http://pear.php.net/package/Net_LDAP2
  * @author Benedikt Hallinger <beni@php.net>
  *
  * @param  string|array $values Array of values to escape
  * @return array Array $values, but escaped
  */
 public static function escapeValue($values = array())
 {
     /**
      * @see Zend_Ldap_Converter
      */
     require_once 'Zend/Ldap/Converter.php';
     if (!is_array($values)) {
         $values = array($values);
     }
     foreach ($values as $key => $val) {
         // Escaping of filter meta characters
         $val = str_replace(array('\\', '*', '(', ')'), array('\\5c', '\\2a', '\\28', '\\29'), $val);
         // ASCII < 32 escaping
         $val = Zend_Ldap_Converter::ascToHex32($val);
         if (null === $val) {
             $val = '\\0';
         }
         // apply escaped "null" if string is empty
         $values[$key] = $val;
     }
     return count($values) == 1 ? $values[0] : $values;
 }
開發者ID:ramonornela,項目名稱:Zebra,代碼行數:35,代碼來源:Abstract.php


注:本文中的Zend_Ldap_Converter::ascToHex32方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。