ARC2::inc PHP Method

inc() static public method

static public inc ( $f, $path = '' )
    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;
    }

Usage Example

Example #1
0
 function parse($path, $data = '')
 {
     $this->state = 0;
     /* reader */
     if (!$this->v('reader')) {
         ARC2::inc('Reader');
         $this->reader =& new ARC2_Reader($this->a, $this);
     }
     $this->reader->setAcceptHeader('Accept: sparql-results+xml; q=0.9, */*; q=0.1');
     $this->reader->activate($path, $data);
     $this->x_base = isset($this->a['base']) && $this->a['base'] ? $this->a['base'] : $this->reader->base;
     /* xml parser */
     $this->initXMLParser();
     /* parse */
     $first = true;
     while ($d = $this->reader->readStream()) {
         if (!xml_parse($this->xml_parser, $d, false)) {
             $error_str = xml_error_string(xml_get_error_code($this->xml_parser));
             $line = xml_get_current_line_number($this->xml_parser);
             $this->tmp_error = 'XML error: "' . $error_str . '" at line ' . $line . ' (parsing as ' . $this->getEncoding() . ')';
             return $this->addError($this->tmp_error);
         }
     }
     $this->target_encoding = xml_parser_get_option($this->xml_parser, XML_OPTION_TARGET_ENCODING);
     xml_parser_free($this->xml_parser);
     $this->reader->closeStream();
     return $this->done();
 }
All Usage Examples Of ARC2::inc