protected function removeCasTicket($uri) {
      $parsed_url = parse_url($uri);
      // If there are no query parameters, then there is nothing to do.
      if (empty($parsed_url['query'])) {
          return $uri;
      }
      parse_str($parsed_url['query'], $query_params);
      // If there is no 'ticket' parameter, there is nothing to do.
      if (!isset($query_params[$this->query_ticket_parameter])) {
          return $uri;
      }
      // Remove the ticket parameter and rebuild the query string.
      unset($query_params[$this->query_ticket_parameter]);
      if (empty($query_params)) {
          unset($parsed_url['query']);
      } else {
          $parsed_url['query'] = http_build_query($query_params);
      }

      // Rebuild the URI from the parsed components.
      // Source: https://secure.php.net/manual/en/function.parse-url.php#106731
      $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
      $host     = isset($parsed_url['host']) ? $parsed_url['host'] : '';
      $port     = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
      $user     = isset($parsed_url['user']) ? $parsed_url['user'] : '';
      $pass     = isset($parsed_url['pass']) ? ':' . $parsed_url['pass']  : '';
      $pass     = ($user || $pass) ? "$pass@" : '';
      $path     = isset($parsed_url['path']) ? $parsed_url['path'] : '';
      $query    = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
      $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
      return "$scheme$user$pass$host$port$path$query$fragment";
    }
protected function removeCasTicket($uri) {
      $parsed_url = parse_url($uri);
      // If there are no query parameters, then there is nothing to do.
      if (empty($parsed_url['query'])) {
          return $uri;
      }
      parse_str($parsed_url['query'], $query_params);
      // If there is no 'ticket' parameter, there is nothing to do.
      if (!isset($query_params[$this->query_ticket_parameter])) {
          return $uri;
      }
      // Remove the ticket parameter and rebuild the query string.
      unset($query_params[$this->query_ticket_parameter]);
      if (empty($query_params)) {
          unset($parsed_url['query']);
      } else {
          $parsed_url['query'] = http_build_query($query_params);
      }

      // Rebuild the URI from the parsed components.
      // Source: https://secure.php.net/manual/en/function.parse-url.php#106731
      $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
      $host     = isset($parsed_url['host']) ? $parsed_url['host'] : '';
      $port     = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
      $user     = isset($parsed_url['user']) ? $parsed_url['user'] : '';
      $pass     = isset($parsed_url['pass']) ? ':' . $parsed_url['pass']  : '';
      $pass     = ($user || $pass) ? "$pass@" : '';
      $path     = isset($parsed_url['path']) ? $parsed_url['path'] : '';
      $query    = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
      $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
      return "$scheme$user$pass$host$port$path$query$fragment";
    }
protected function removeCasTicket ( $ uri ) { $ parsed_url = parse_url ( $ uri ) ; // If there are no query parameters, then there is nothing to do. if ( empty ( $ parsed_url [ 'query' ] ) ) { return $ uri ; } parse_str ( $ parsed_url [ 'query' ] , $ query_params ) ; // If there is no 'ticket' parameter, there is nothing to do. if ( ! isset ( $ query_params [ $ this -> query_ticket_parameter ] ) ) { return $ uri ; } // Remove the ticket parameter and rebuild the query string. unset ( $ query_params [ $ this -> query_ticket_parameter ] ) ; if ( empty ( $ query_params ) ) { unset ( $ parsed_url [ 'query' ] ) ; } else { $ parsed_url [ 'query' ] = http_build_query ( $ query_params ) ; } // Rebuild the URI from the parsed components. // Source: https://secure.php.net/manual/en/function.parse-url.php#106731 $ scheme = isset ( $ parsed_url [ 'scheme' ] ) ? $ parsed_url [ 'scheme' ] . '://' : '' ; $ host = isset ( $ parsed_url [ 'host' ] ) ? $ parsed_url [ 'host' ] : '' ; $ port = isset ( $ parsed_url [ 'port' ] ) ? ':' . $ parsed_url [ 'port' ] : '' ; $ user = isset ( $ parsed_url [ 'user' ] ) ? $ parsed_url [ 'user' ] : '' ; $ pass = isset ( $ parsed_url [ 'pass' ] ) ? ':' . $ parsed_url [ 'pass' ] : '' ; $ pass = ( $ user || $ pass ) ? "$pass@" : '' ; $ path = isset ( $ parsed_url [ 'path' ] ) ? $ parsed_url [ 'path' ] : '' ; $ query = isset ( $ parsed_url [ 'query' ] ) ? '?' . $ parsed_url [ 'query' ] : '' ; $ fragment = isset ( $ parsed_url [ 'fragment' ] ) ? '#' . $ parsed_url [ 'fragment' ] : '' ; return "$scheme$user$pass$host$port$path$query$fragment" ; }
Strip the CAS 'ticket' parameter from a uri.
Strip the CAS ticket parameter from a uri .