modify


  
      function modify_urls()
      {
          preg_match_all("#\s(href|src|action|codebase|url)=([\"\'])?(.*?)([\"\'])?([\s\>])#i", this->response_body, matches, PREG_SET_ORDER);
  
          foreach (matches as match)
          {
              uri = trim(match[3]);
              fragment = (hash_pos = strpos(uri, '#') !== false) ? '#' . substr(uri, hash_pos) : ''; 
  
              if (!preg_match('#^[\w+.-]+://#i', uri))
              {
                  switch (substr(uri, 0, 1))
                  {
                      case '/':
                          uri = this->url_segments['scheme'] . '://' . this->url_segments['host'] . uri;
                          break;
                      case '#':
                          continue 2;
                      default:
                          uri = this->url_segments['base'] . '/' . uri;
                          break;
                  }
              }
  
              uri     = this->encode_url(uri);
              replace = ' ' . match[1] . '=' . match[2] . this->script_url . '?url=' . uri . fragment . match[4] . match[5];
  
              this->response_body = str_replace(match[0], replace, this->response_body);
          }
      }