Example #1
0
 /**
  * Load settings
  *
  * Load settings using file path provided. A file path can be an absolute
  * path, relative path to AnEngine root directory (the one with index.php in
  * it) or relative path to include path. File path must contain the target
  * file name including extension.
  *
  * @param string $data setting file path. Defaults to current {@link
  *                     AeSettings_Driver_Xml::_filename} property value
  *
  * @return bool true on success, false otherwise
  */
 public function load($data = null)
 {
     $data = $data === null ? $this->_filename : $data;
     // *** Check extension and add if required
     if (strpos($data, '.') === false) {
         $data .= '.' . self::EXTENSION;
     }
     if ($data === null || !file_exists($data) || !is_readable($data)) {
         return false;
     }
     $xml = AeXml::getContents($data);
     if ($xml->hasChildren()) {
         foreach ($xml->getChildren() as $section) {
             $this->_properties[$section->getName()] = $this->_stringToValue($section);
         }
     }
     return $this;
 }