Blame view

pma/libraries/transformations/application_octetstream__hex.inc.php 865 Bytes
a1684257   Administrator   first commit
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
  <?php
  /* vim: set expandtab sw=4 ts=4 sts=4: */
  /**
   * @package PhpMyAdmin-Transformation
   */
  
  function PMA_transformation_application_octetstream__hex_info()
  {
      return array(
          'info' =>  __('Displays hexadecimal representation of data. Optional first parameter specifies how often space will be added (defaults to 2 nibbles).'),
          );
  }
  
  /**
   *
   */
  function PMA_transformation_application_octetstream__hex($buffer, $options = array(), $meta = '')
  {
      // possibly use a global transform and feed it with special options:
      // include './libraries/transformations/global.inc.php';
      if (!isset($options[0])) {
          $options[0] = 2;
      } else {
          $options[0] = (int)$options[0];
      }
  
      if ($options[0] < 1) {
          return bin2hex($buffer);
      } else {
          return chunk_split(bin2hex($buffer), $options[0], ' ');
      }
  
  }
  
  ?>