コード例 #1
0
ファイル: Options.php プロジェクト: densem-2013/exikom
 /**
  * @return RokCommon_XMLElement
  */
 public function getJoinedXml()
 {
     foreach ($this->files as $priority => $filegroup) {
         foreach ($filegroup as $file) {
             $this->logger->debug(rc__('Adding file %s.', $file));
             $file_xml = RokCommon_Utils_XMLHelper::getXML($file);
             self::mergeNodes($this->xml, $file_xml);
         }
     }
     foreach ($this->sections as $identifier => &$section) {
         $this->logger->debug(rc__('Adding options section %s.', $identifier));
         $section_xml = $section->getXML();
         self::mergeNodes($this->xml, $section_xml);
     }
     $this->xml = self::sortFields($this->xml);
     return $this->xml;
 }
コード例 #2
0
 /**
  * @param      $parent_identifier
  * @param      $file
  *
  * @param null $xml
  *
  * @throws \RokCommon_Config_Exception
  */
 protected function __construct($parent_identifier, $file = null, $xml = null)
 {
     $this->parent_identifier = $parent_identifier;
     $this->joined_xml = new RokCommon_XMLElement('<config/>');
     $this->container = RokCommon_Service::getContainer();
     $this->root_file = $file;
     if (empty($xml)) {
         $xml = RokCommon_Utils_XMLHelper::getXML($file);
     }
     $this->initialize($xml);
     $this->process();
 }
コード例 #3
0
ファイル: Section.php プロジェクト: TeamCodeStudio/fpmoz
 /**
  * @return RokCommon_XMLElement
  * @throws RokCommon_Config_Exception
  */
 public function getXml()
 {
     $context = RokCommon_Composite::get(self::CONTEXT_PREFIX . $this->identifier);
     if ($context) {
         if ($this->searchMode == self::SEARCH_MODE_BASEDIRS) {
             $ret = $context->getAll($this->filename);
         } elseif ($this->searchMode == self::SEARCH_MODE_CHILDIRS) {
             $ret = $context->getAllSubFiles($this->filename);
         } else {
             throw new RokCommon_Config_Exception(rc__('Unknown mode of %s on config', $this->searchMode));
         }
         ksort($ret, SORT_NUMERIC);
         foreach ($ret as $priority => $files) {
             foreach ($files as $file) {
                 $file_xml = RokCommon_Utils_XMLHelper::getXML($file, true);
                 RokCommon_Options::mergeNodes($this->xml, $file_xml);
             }
         }
     }
     return $this->xml;
 }
コード例 #4
0
 /**
  * Method to load the form description from an XML file.
  *
  * The reset option works on a group basis. If the XML file references
  * groups that have already been created they will be replaced with the
  * fields in the new XML file unless the $reset parameter has been set
  * to false.
  *
  * @param   string  $file   The filesystem path of an XML file.
  * @param   string  $reset  Flag to toggle whether form fields should be replaced if a field
  *                          already exists with the same group/name.
  * @param   string  $xpath  An optional xpath to search for the fields.
  *
  * @return  boolean  True on success, false otherwise.
  *
  * @since   11.1
  */
 public function loadFile($file, $reset = true, $xpath = false)
 {
     // Check to see if the path is an absolute path.
     if (!is_file($file)) {
         $file = RokCommon_Composite::get(self::FORM_PATH_PACKAGE)->get($file . '.xml');
         // If unable to find the file return false.
         if (!$file) {
             return false;
         }
     }
     // Attempt to load the XML file.
     $xml = RokCommon_Utils_XMLHelper::getXML($file, true);
     return $this->load($xml, $reset, $xpath);
 }