getIncPath() static public method

*
static public getIncPath ( $f = '' )
Example #1
0
File: ARC2.php Project: p6/arc2
 static function inc($f, $path = '')
 {
     $prefix = 'ARC2';
     if (preg_match('/^([^\\_]+)\\_(.*)$/', $f, $m)) {
         $prefix = $m[1];
         $f = $m[2];
     }
     $inc_path = $path ? $path : ARC2::getIncPath($f);
     $path = $inc_path . $prefix . '_' . urlencode($f) . '.php';
     if (file_exists($path)) {
         return include_once $path;
     }
     /* safe-mode hack */
     if (@(include_once $path)) {
         return 1;
     }
     /* try other path */
     if ($prefix != 'ARC2') {
         $path = $inc_path . strtolower($prefix) . '/' . $prefix . '_' . urlencode($f) . '.php';
         if (file_exists($path)) {
             return include_once $path;
         }
         /* safe-mode hack */
         if (@(include_once $path)) {
             return 1;
         }
     }
     return 0;
 }
Example #2
0
 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();
 }
 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 */
 }
Example #5
0
 function inc($f)
 {
     $prefix = 'ARC2';
     if (preg_match('/^([^\\_]+)\\_(.*)$/', $f, $m)) {
         $prefix = $m[1];
         $f = $m[2];
     }
     $inc_path = ARC2::getIncPath($f);
     $path = $inc_path . $prefix . '_' . urlencode($f) . '.php';
     if (file_exists($path)) {
         include_once $path;
         return 1;
     }
     if ($prefix != 'ARC2') {
         $path = $inc_path . strtolower($prefix) . '/' . $prefix . '_' . urlencode($f) . '.php';
         if (file_exists($path)) {
             include_once $path;
             return 1;
         }
     }
     return 0;
 }
 public function testGetIncPath()
 {
     $actual = ARC2::getIncPath('RDFParser');
     $this->assertStringEndsWith('parsers/', $actual, 'should create correct path');
     $this->assertTrue(is_dir($actual), 'should create correct pointer');
 }