original_string: public function history($url){
      if ( !empty($url) &&
        ( $dir = $this->dir_from_url($url) ) &&
        ( $dir_cfg = $this->dir($dir) ) &&
        \defined('BBN_USER_PATH')
      ){
        $res = [];
        $all = [];
        // IDE backup path
        $path = BBN_USER_PATH."ide/backup/$dir";
        // Remove dir name from url
        $file = substr($url, \strlen($dir), \strlen($url));
        // MVC
        if ( !empty($dir_cfg['tabs']) ){
          foreach ( $dir_cfg['tabs'] as $t ){
            if ( empty($t['fixed']) ){
              // The file's backup path of the MVC's tab
              $p = $path . $t['path'] . $file . '/';
              // Get history
              $all = self::get_history($p, $t, $all, true);
            }
          }
        }
        else {
          // The file's backup path of the MVC's tab
          $p = $path . $file . '/';
          // Get history
          $all = self::get_history($p, $dir_cfg, $all);
        }
        if ( !empty($all) ){
          foreach ( $all as $i => $a ){
            if ( !empty($dir_cfg['tabs']) ){
              $tmp = [];
              foreach ( $a as $k => $b ){
                array_push($tmp, [
                  'text' => $k,
                  'items' => $b
                ]);
              }
            }
            array_push($res, [
              'text' => $i,
              'items' => !empty($tmp) ? $tmp : $a
            ]);
          }
        }
        return ['list' => $res];
      }
    }
code: public function history($url){
      if ( !empty($url) &&
        ( $dir = $this->dir_from_url($url) ) &&
        ( $dir_cfg = $this->dir($dir) ) &&
        \defined('BBN_USER_PATH')
      ){
        $res = [];
        $all = [];
        // IDE backup path
        $path = BBN_USER_PATH."ide/backup/$dir";
        // Remove dir name from url
        $file = substr($url, \strlen($dir), \strlen($url));
        // MVC
        if ( !empty($dir_cfg['tabs']) ){
          foreach ( $dir_cfg['tabs'] as $t ){
            if ( empty($t['fixed']) ){
              // The file's backup path of the MVC's tab
              $p = $path . $t['path'] . $file . '/';
              // Get history
              $all = self::get_history($p, $t, $all, true);
            }
          }
        }
        else {
          // The file's backup path of the MVC's tab
          $p = $path . $file . '/';
          // Get history
          $all = self::get_history($p, $dir_cfg, $all);
        }
        if ( !empty($all) ){
          foreach ( $all as $i => $a ){
            if ( !empty($dir_cfg['tabs']) ){
              $tmp = [];
              foreach ( $a as $k => $b ){
                array_push($tmp, [
                  'text' => $k,
                  'items' => $b
                ]);
              }
            }
            array_push($res, [
              'text' => $i,
              'items' => !empty($tmp) ? $tmp : $a
            ]);
          }
        }
        return ['list' => $res];
      }
    }
code_tokens: public function history ( $ url ) { if ( ! empty ( $ url ) && ( $ dir = $ this -> dir_from_url ( $ url ) ) && ( $ dir_cfg = $ this -> dir ( $ dir ) ) && \ defined ( 'BBN_USER_PATH' ) ) { $ res = [ ] ; $ all = [ ] ; // IDE backup path $ path = BBN_USER_PATH . "ide/backup/$dir" ; // Remove dir name from url $ file = substr ( $ url , \ strlen ( $ dir ) , \ strlen ( $ url ) ) ; // MVC if ( ! empty ( $ dir_cfg [ 'tabs' ] ) ) { foreach ( $ dir_cfg [ 'tabs' ] as $ t ) { if ( empty ( $ t [ 'fixed' ] ) ) { // The file's backup path of the MVC's tab $ p = $ path . $ t [ 'path' ] . $ file . '/' ; // Get history $ all = self :: get_history ( $ p , $ t , $ all , true ) ; } } } else { // The file's backup path of the MVC's tab $ p = $ path . $ file . '/' ; // Get history $ all = self :: get_history ( $ p , $ dir_cfg , $ all ) ; } if ( ! empty ( $ all ) ) { foreach ( $ all as $ i => $ a ) { if ( ! empty ( $ dir_cfg [ 'tabs' ] ) ) { $ tmp = [ ] ; foreach ( $ a as $ k => $ b ) { array_push ( $ tmp , [ 'text' => $ k , 'items' => $ b ] ) ; } } array_push ( $ res , [ 'text' => $ i , 'items' => ! empty ( $ tmp ) ? $ tmp : $ a ] ) ; } } return [ 'list' => $ res ] ; } }
docstring: Returns all backup history of a file.
  
  @param string $url The file's URL
  @return array|bool
docstring_tokens: Returns all backup history of a file .