getRequestURI() static public method

static public getRequestURI ( )
 function parse($q, $src = '', $iso_fallback = 'ignore')
 {
     $this->setDefaultPrefixes();
     $this->base = $src ? $this->calcBase($src) : ARC2::getRequestURI();
     $this->r = array('base' => '', 'vars' => array(), 'prefixes' => array());
     $this->unparsed_code = $q;
     list($r, $v) = $this->xQuery($q);
     if ($r) {
         $this->r['query'] = $r;
         $this->unparsed_code = trim($v);
     } elseif (!$this->getErrors() && !$this->unparsed_code) {
         $this->addError('Query not properly closed');
     }
     $this->r['prefixes'] = $this->prefixes;
     $this->r['base'] = $this->base;
     /* remove trailing comments */
     while (preg_match('/^\\s*(\\#[^\\xd\\xa]*)(.*)$/si', $this->unparsed_code, $m)) {
         $this->unparsed_code = $m[2];
     }
     if ($this->unparsed_code && !$this->getErrors()) {
         $rest = preg_replace('/[\\x0a|\\x0d]/i', ' ', substr($this->unparsed_code, 0, 30));
         $msg = trim($rest) ? 'Could not properly handle "' . $rest . '"' : 'Syntax error, probably an incomplete pattern';
         $this->addError($msg);
     }
 }
 public function testGetRequestURI()
 {
     $tmp = $_SERVER;
     unset($_SERVER);
     $actual = ARC2::getRequestURI();
     $this->assertEquals(ARC2::getScriptURI(), $actual);
     $_SERVER = $tmp;
     $_SERVER = array('SERVER_PROTOCOL' => 'http', 'SERVER_PORT' => 1234, 'HTTP_HOST' => 'example.com', 'REQUEST_URI' => '/foo');
     $actual = ARC2::getRequestURI();
     $this->assertEquals('http://example.com:1234/foo', $actual);
     $_SERVER = $tmp;
 }
 function __init()
 {
     /* base, time_limit */
     if (!$_POST && isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $_POST);
     }
     /* php5 bug */
     $this->inc_path = ARC2::getIncPath();
     $this->ns_count = 0;
     $this->nsp = array('http://www.w3.org/1999/02/22-rdf-syntax-ns#' => 'rdf');
     $this->used_ns = array('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
     $this->ns = $this->v('ns', array(), $this->a);
     $this->base = $this->v('base', ARC2::getRequestURI(), $this->a);
     $this->errors = array();
     $this->warnings = array();
     $this->adjust_utf8 = $this->v('adjust_utf8', 0, $this->a);
     $this->max_errors = $this->v('max_errors', 25, $this->a);
 }
Example #4
0
 function __init()
 {
     /* base, time_limit */
     if (!$_POST && isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $_POST);
     }
     /* php5 bug */
     $this->inc_path = ARC2::getIncPath();
     $this->ns_count = 0;
     $rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
     $this->nsp = array($rdf => 'rdf');
     $this->used_ns = array($rdf);
     $this->ns = array_merge(array('rdf' => $rdf), $this->v('ns', array(), $this->a));
     $this->base = $this->v('base', ARC2::getRequestURI(), $this->a);
     $this->errors = array();
     $this->warnings = array();
     $this->adjust_utf8 = $this->v('adjust_utf8', 0, $this->a);
     $this->max_errors = $this->v('max_errors', 25, $this->a);
     $this->has_pcre_unicode = @preg_match('/\\pL/u', 'test');
     /* \pL = block/point which is a Letter */
 }