本文整理汇总了PHP中ARC2::getScriptURI方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getScriptURI方法的具体用法?PHP ARC2::getScriptURI怎么用?PHP ARC2::getScriptURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::getScriptURI方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
function parse($q, $src = '')
{
$this->setDefaultPrefixes();
$this->base = $src ? $this->calcBase($src) : ARC2::getScriptURI();
$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);
}
}
示例2: getRequestURI
function getRequestURI()
{
if (isset($_SERVER) && isset($_SERVER['REQUEST_URI'])) {
return preg_replace('/^([a-z]+)\\/.*$/', '\\1', strtolower($_SERVER['SERVER_PROTOCOL'])) . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '') . $_SERVER['REQUEST_URI'];
}
return ARC2::getScriptURI();
}
示例3: __init
function __init()
{
/* base, time_limit */
$this->inc_path = ARC2::getIncPath();
$this->base = $this->v('base', ARC2::getScriptURI(), $this->a);
$this->errors = array();
$this->warnings = array();
}
示例4: testGetRequestURI
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;
}
示例5: parse
function parse($v, $src = '', $iso_fallback = 'ignore')
{
$this->setDefaultPrefixes();
$this->base = $src ? $this->calcBase($src) : ARC2::getScriptURI();
$this->blocks = array();
$this->r = array('base' => '', 'vars' => array(), 'prefixes' => $this->prefixes);
do {
$proceed = 0;
if ((list($r, $v) = $this->xScriptBlock($v)) && $r) {
$this->blocks[] = $r;
$proceed = 1;
}
$this->unparsed_code = trim($v);
} while ($proceed);
if (trim($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';
$this->addError($msg);
}
}
示例6: parseData
function parseData($data)
{
return $this->parse(ARC2::getScriptURI(), $data);
}
示例7: processQueryBlock
function processQueryBlock($block)
{
$ep_uri = $this->env['endpoint'];
/* q */
$q = 'BASE <' . $block['base'] . '>';
foreach ($block['prefixes'] as $k => $v) {
$q .= "\n" . 'PREFIX ' . $k . ' <' . $v . '>';
}
$q .= "\n" . $block['query'];
/* placeholders */
$q = $this->replacePlaceholders($q);
/* local store */
if ((!$ep_uri || $ep_uri == ARC2::getScriptURI()) && $this->v('sparqlscript_default_endpoint', '', $this->a) == 'local') {
$store = ARC2::getStore($this->a);
/* @@todo error checking */
return $store->query($q);
} elseif ($ep_uri) {
ARC2::inc('RemoteStore');
$conf = array_merge($this->a, array('remote_store_endpoint' => $ep_uri));
$store =& new ARC2_RemoteStore($conf, $this);
return $store->query($q, '', $ep_uri);
} else {
return $this->addError("no store");
}
}
示例8: getStore
function getStore($ep_uri)
{
/* local store */
if ((!$ep_uri || $ep_uri == ARC2::getScriptURI()) && $this->v('sparqlscript_default_endpoint', '', $this->a) == 'local') {
if (!isset($this->local_store)) {
$this->local_store = ARC2::getStore($this->a);
}
/* @@todo error checking */
return $this->local_store;
} elseif ($ep_uri) {
ARC2::inc('RemoteStore');
$conf = array_merge($this->a, array('remote_store_endpoint' => $ep_uri, 'reader_timeout' => 10));
return new ARC2_RemoteStore($conf, $this);
}
return 0;
}
示例9: getAbsBase
function getAbsBase()
{
return preg_replace('/index\\.php$/', '', ARC2::getScriptURI());
}
示例10: processQueryBlock
function processQueryBlock($block)
{
if ($this->max_queries && $this->env['query_count'] >= $this->max_queries) {
return $this->addError('Number of ' . $this->max_queries . ' allowed queries exceeded.');
}
$this->env['query_count']++;
$ep_uri = $this->env['endpoint'];
/* q */
$q = 'BASE <' . $block['base'] . '>';
$ns = isset($this->a['ns']) ? array_merge($this->a['ns'], $block['prefixes']) : $block['prefixes'];
foreach ($ns as $k => $v) {
$k = rtrim($k, ':');
$q .= strpos($block['query'], $k . ':') !== false ? "\n" . 'PREFIX ' . $k . ': <' . $v . '>' : '';
}
$q .= "\n" . $block['query'];
/* placeholders */
$q = $this->replacePlaceholders($q, 'query');
$this->env['query_log'][] = '(' . $ep_uri . ') ' . $q;
/* local store */
if ((!$ep_uri || $ep_uri == ARC2::getScriptURI()) && $this->v('sparqlscript_default_endpoint', '', $this->a) == 'local') {
if (!isset($this->local_store)) {
$this->local_store = ARC2::getStore($this->a);
}
/* @@todo error checking */
return $this->local_store->query($q);
} elseif ($ep_uri) {
ARC2::inc('RemoteStore');
$conf = array_merge($this->a, array('remote_store_endpoint' => $ep_uri));
$store =& new ARC2_RemoteStore($conf, $this);
return $store->query($q, '', $ep_uri);
} else {
return $this->addError("no store");
}
}