original_string: public function referer($local = false)
      {
          $ref = $this->getEnv('HTTP_REFERER');
  
          $base = Configure::read('App.fullBaseUrl') . $this->webroot;
          if (!empty($ref) && !empty($base)) {
              if ($local && strpos($ref, $base) === 0) {
                  $ref = substr($ref, strlen($base));
                  if (!strlen($ref) || strpos($ref, '//') === 0) {
                      $ref = '/';
                  }
                  if ($ref[0] !== '/') {
                      $ref = '/' . $ref;
                  }
  
                  return $ref;
              }
              if (!$local) {
                  return $ref;
              }
          }
  
          return '/';
      }
code: public function referer($local = false)
      {
          $ref = $this->getEnv('HTTP_REFERER');
  
          $base = Configure::read('App.fullBaseUrl') . $this->webroot;
          if (!empty($ref) && !empty($base)) {
              if ($local && strpos($ref, $base) === 0) {
                  $ref = substr($ref, strlen($base));
                  if (!strlen($ref) || strpos($ref, '//') === 0) {
                      $ref = '/';
                  }
                  if ($ref[0] !== '/') {
                      $ref = '/' . $ref;
                  }
  
                  return $ref;
              }
              if (!$local) {
                  return $ref;
              }
          }
  
          return '/';
      }
code_tokens: public function referer ( $ local = false ) { $ ref = $ this -> getEnv ( 'HTTP_REFERER' ) ; $ base = Configure :: read ( 'App.fullBaseUrl' ) . $ this -> webroot ; if ( ! empty ( $ ref ) && ! empty ( $ base ) ) { if ( $ local && strpos ( $ ref , $ base ) === 0 ) { $ ref = substr ( $ ref , strlen ( $ base ) ) ; if ( ! strlen ( $ ref ) || strpos ( $ ref , '//' ) === 0 ) { $ ref = '/' ; } if ( $ ref [ 0 ] !== '/' ) { $ ref = '/' . $ ref ; } return $ ref ; } if ( ! $ local ) { return $ ref ; } } return '/' ; }
docstring: Returns the referer that referred this request.
  
  @param bool $local Attempt to return a local address.
  Local addresses do not contain hostnames.
  @return string The referring address for this request.
docstring_tokens: Returns the referer that referred this request .