Ejemplo n.º 1
0
  public  function loadUrl()
  {
    /* init cache object */
    $cCache = new CCache($this->m_cConfig, $this->m_xmlFile); 

    /* if it can use the cache, I use it or I cache it! */
    if ($cCache->useCache == true) {
      $urlX   = $cCache->getCache();
    }
    /**
     * Cache config */
    else {
      $xmlData = new CXmlController($this->m_xmlFile);
      $xmlData->setDefaultType("string-utf8");

      $xmlData->startParser();
      $urlX    = $xmlData->getXmlData();

      /* cache it for next one */
      $cCache->setCache($urlX);
    }

    /* erstelle m_urlXml */
    $this->assocUrl($urlX);
  }
Ejemplo n.º 2
0
  public function loadConfig($xmlFile)
  {
    try {
      $xmlData = new CXmlController($xmlFile);
      $xmlData->setDefaultType("string-iso");

      $xmlData->startParser();
      $this->m_config = $xmlData->getXmlData();
    }
    /**
     * Exceptions handling between parser error and config error */
    catch (CError $error) {

      /* switch erroCode (lib/core/Error.php) */
      switch ($error->m_errCode) {
        case ERROR_XML_FILE_NOT_FOUND :
        case ERROR_XML_FILE           :
          throw new CError(ERROR_CONFIG_XML_NOT_FOUND, 
                           array($xmlFile, $error->m_errCode, 
                                 $error->m_arrArg));

        default                       :
          throw new CError(ERROR_CONFIG_XML_ERROR, 
                           array($xmlFile, $error->m_errCode, 
                                 $error->m_arrArg));
      }
    }
  }
Ejemplo n.º 3
0
  private function loadPageXml($xmlFile)
  {
    /* init */
    $file   = CONTROLLER_PATH . $xmlFile;
    $this->m_fileName = $xmlFile;
    $cCache = new CCache($this->m_cConfig, $file);
    $retXml = array();

    /**
     * Can it use cache? */
    if ($cCache->useCache() == true) {
      $retXml   = $cCache->getCache();
    }
    /**
     * Read the xml file and cache it */
    else {
      $xmlData  = new CXmlController($file);
      $xmlData->setDefaultType("string-iso");

      $xmlData->startParser();
      $retXml   = $xmlData->getXmlData();

      /* cache */
      $cCache->setCache($retXml);
    }

    return $retXml;
  }