original_string: private static function _findRoute($locale, $path, $attribute, $value, &$temp)
      {
          // load locale file if not already in cache
          // needed for alias tag when referring to other locale
          if (empty(self::$_ldml[(string) $locale])) {
              $filename = dirname(__FILE__) . '/Data/' . $locale . '.xml';
              if (!file_exists($filename)) {
  
                  throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale.");
              }
  
              self::$_ldml[(string) $locale] = simplexml_load_file($filename);
          }
  
          // search for 'alias' tag in the search path for redirection
          $search = '';
          $tok = strtok($path, '/');
  
          // parse the complete path
          if (!empty(self::$_ldml[(string) $locale])) {
              while ($tok !== false) {
                  $search .=  '/' . $tok;
                  if (strpos($search, '[@') !== false) {
                      while (strrpos($search, '[@') > strrpos($search, ']')) {
                          $tok = strtok('/');
                          if (empty($tok)) {
                              $search .= '/';
                          }
                          $search = $search . '/' . $tok;
                      }
                  }
                  $result = self::$_ldml[(string) $locale]->xpath($search . '/alias');
  
                  // alias found
                  if (!empty($result)) {
  
                      $source = $result[0]['source'];
                      $newpath = $result[0]['path'];
  
                      // new path - path //ldml is to ignore
                      if ($newpath != '//ldml') {
                          // other path - parse to make real path
  
                          while (substr($newpath,0,3) == '../') {
                              $newpath = substr($newpath, 3);
                              $search = substr($search, 0, strrpos($search, '/'));
                          }
  
                          // truncate ../ to realpath otherwise problems with alias
                          $path = $search . '/' . $newpath;
                          while (($tok = strtok('/'))!== false) {
                              $path = $path . '/' . $tok;
                          }
                      }
  
                      // reroute to other locale
                      if ($source != 'locale') {
                          $locale = $source;
                      }
  
                      $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
                      return false;
                  }
  
                  $tok = strtok('/');
              }
          }
          return true;
      }
code: private static function _findRoute($locale, $path, $attribute, $value, &$temp)
      {
          // load locale file if not already in cache
          // needed for alias tag when referring to other locale
          if (empty(self::$_ldml[(string) $locale])) {
              $filename = dirname(__FILE__) . '/Data/' . $locale . '.xml';
              if (!file_exists($filename)) {
  
                  throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale.");
              }
  
              self::$_ldml[(string) $locale] = simplexml_load_file($filename);
          }
  
          // search for 'alias' tag in the search path for redirection
          $search = '';
          $tok = strtok($path, '/');
  
          // parse the complete path
          if (!empty(self::$_ldml[(string) $locale])) {
              while ($tok !== false) {
                  $search .=  '/' . $tok;
                  if (strpos($search, '[@') !== false) {
                      while (strrpos($search, '[@') > strrpos($search, ']')) {
                          $tok = strtok('/');
                          if (empty($tok)) {
                              $search .= '/';
                          }
                          $search = $search . '/' . $tok;
                      }
                  }
                  $result = self::$_ldml[(string) $locale]->xpath($search . '/alias');
  
                  // alias found
                  if (!empty($result)) {
  
                      $source = $result[0]['source'];
                      $newpath = $result[0]['path'];
  
                      // new path - path //ldml is to ignore
                      if ($newpath != '//ldml') {
                          // other path - parse to make real path
  
                          while (substr($newpath,0,3) == '../') {
                              $newpath = substr($newpath, 3);
                              $search = substr($search, 0, strrpos($search, '/'));
                          }
  
                          // truncate ../ to realpath otherwise problems with alias
                          $path = $search . '/' . $newpath;
                          while (($tok = strtok('/'))!== false) {
                              $path = $path . '/' . $tok;
                          }
                      }
  
                      // reroute to other locale
                      if ($source != 'locale') {
                          $locale = $source;
                      }
  
                      $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
                      return false;
                  }
  
                  $tok = strtok('/');
              }
          }
          return true;
      }
code_tokens: private static function _findRoute ( $ locale , $ path , $ attribute , $ value , & $ temp ) { // load locale file if not already in cache // needed for alias tag when referring to other locale if ( empty ( self :: $ _ldml [ ( string ) $ locale ] ) ) { $ filename = dirname ( __FILE__ ) . '/Data/' . $ locale . '.xml' ; if ( ! file_exists ( $ filename ) ) { throw new Zend_Locale_Exception ( "Missing locale file '$filename' for '$locale' locale." ) ; } self :: $ _ldml [ ( string ) $ locale ] = simplexml_load_file ( $ filename ) ; } // search for 'alias' tag in the search path for redirection $ search = '' ; $ tok = strtok ( $ path , '/' ) ; // parse the complete path if ( ! empty ( self :: $ _ldml [ ( string ) $ locale ] ) ) { while ( $ tok !== false ) { $ search .= '/' . $ tok ; if ( strpos ( $ search , '[@' ) !== false ) { while ( strrpos ( $ search , '[@' ) > strrpos ( $ search , ']' ) ) { $ tok = strtok ( '/' ) ; if ( empty ( $ tok ) ) { $ search .= '/' ; } $ search = $ search . '/' . $ tok ; } } $ result = self :: $ _ldml [ ( string ) $ locale ] -> xpath ( $ search . '/alias' ) ; // alias found if ( ! empty ( $ result ) ) { $ source = $ result [ 0 ] [ 'source' ] ; $ newpath = $ result [ 0 ] [ 'path' ] ; // new path - path //ldml is to ignore if ( $ newpath != '//ldml' ) { // other path - parse to make real path while ( substr ( $ newpath , 0 , 3 ) == '../' ) { $ newpath = substr ( $ newpath , 3 ) ; $ search = substr ( $ search , 0 , strrpos ( $ search , '/' ) ) ; } // truncate ../ to realpath otherwise problems with alias $ path = $ search . '/' . $ newpath ; while ( ( $ tok = strtok ( '/' ) ) !== false ) { $ path = $ path . '/' . $ tok ; } } // reroute to other locale if ( $ source != 'locale' ) { $ locale = $ source ; } $ temp = self :: _getFile ( $ locale , $ path , $ attribute , $ value , $ temp ) ; return false ; } $ tok = strtok ( '/' ) ; } } return true ; }
docstring: Find possible routing to other path or locale
  
  @param  string $locale
  @param  string $path
  @param  string $attribute
  @param  string $value
  @param  array  $temp
  @throws Zend_Locale_Exception
  @access private
docstring_tokens: Find possible routing to other path or locale