1 | <?PHP
|
---|
2 |
|
---|
3 | /* RDFInt.php - RDF Interfaces for PHP
|
---|
4 | * Copyright 2011 netlabs.org
|
---|
5 | * Author: Christian Langanke, Adrian Gschwend
|
---|
6 | *
|
---|
7 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
8 | * you may not use this file except in compliance with the License.
|
---|
9 | * You may obtain a copy of the License at
|
---|
10 | *
|
---|
11 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
12 | *
|
---|
13 | * Unless required by applicable law or agreed to in writing, software
|
---|
14 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
16 | * See the License for the specific language governing permissions and
|
---|
17 | * limitations under the License.
|
---|
18 | */
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * @page page_appendix_arc2_patch Appendix: Patch for ARC2 for usage under Windows operating systems
|
---|
22 | *
|
---|
23 | * For usage under Windows operating systems, the method
|
---|
24 | * ARC2_Class::calcBase($path) needs a patch in order to cope with
|
---|
25 | * Windows style pathnames including backslashes.
|
---|
26 | *
|
---|
27 | * The reason for this is that the PHP function \c realpath returns
|
---|
28 | * path names including backslashes. Such path names are however invalid
|
---|
29 | * for other PHP functions. As the time of this writing, this behaviour
|
---|
30 | * has been reproduced up to PHP V5.3.5..
|
---|
31 | *
|
---|
32 | * The patched method from v2.0.0-0-g270696b looks as follows:
|
---|
33 | \code
|
---|
34 | function calcBase($path) {
|
---|
35 | $r = $path;
|
---|
36 | $r = preg_replace('/\#.*$/', '', $r);/* remove hash */
|
---|
37 | $r = preg_replace('/^\/\//', 'http://', $r);/* net path (//), assume http */
|
---|
38 | if (preg_match('/^[a-z0-9]+\:/', $r)) {/* scheme, abs path */
|
---|
39 | while (preg_match('/^(.+\/)(\.\.\/.*)$/U', $r, $m)) {
|
---|
40 | $r = $this->calcURI($m[1], $m[2]);
|
---|
41 | }
|
---|
42 | return $r;
|
---|
43 | }
|
---|
44 | // return realpath, but take care for windows systems
|
---|
45 | $realpath = realpath($r);
|
---|
46 | if (substr( realpath($r), 1, 2) == ':\\')
|
---|
47 | $realpath = str_replace( '\\', '/', $realpath);
|
---|
48 | return 'file://' . $realpath;/* real path */
|
---|
49 | }
|
---|
50 | \endcode
|
---|
51 | */
|
---|
52 |
|
---|
53 |
|
---|
54 | ?>
|
---|