public function __construct($filename = null, $default_root = 'email_messages') { parent::__construct($filename, $default_root); $this->messages = array(); if ($this->docLoaded) { $this->messages = parent::asArray(); } }
public function __construct($filename, $root_node, db_update_page $db_upd) { parent::__construct($filename, $root_node); $this->updates = new DOMDocument(); $this->updates->formatOutput = true; $this->updates->preserveWhiteSpace = false; $this->updates->load(XML_UPDATES_FILE); $this->db_update_obj = $db_upd; }
public function __construct($page_id, $config_dir, $old_conf_array = array()) { // old $settings_new var global $app; $this->page_id = $page_id; $this->config_dir = $config_dir; $pages = array_flip($app->configObj->query("//*[@section='pages']")); if (isset($pages[$page_id]) && $page_id != 0) { $config_file = strtolower(substr($pages[$page_id], 5)) . '.xml'; // already defind page name constant with removed 'PAGE_' prefix } else { if (!isset($pages[$page_id]) && $page_id != 0) { throw new ConfigurablePageException("Page name constant not defined for page with this ID:" . $page_id . ' in constants.php file!' . '<br />' . "If this ID number represents an existing dynamic page, please define a page name constant" . '<br />' . 'in constants.php file.'); } else { $config_file = 'new_page.xml'; // fake name } } $filename = $this->config_dir . "/{$config_file}"; if (file_exists(PA::$project_dir . DIRECTORY_SEPARATOR . $filename)) { $this->xml_file = PA::$project_dir . DIRECTORY_SEPARATOR . $filename; } else { if (file_exists(PA::$core_dir . DIRECTORY_SEPARATOR . $filename)) { $this->xml_file = PA::$core_dir . DIRECTORY_SEPARATOR . $filename; } else { $this->xml_file = PA::$project_dir . DIRECTORY_SEPARATOR . $filename; } } parent::__construct(null, 'root'); if (!$this->docLoaded) { // if(!$this->modified) { // do nothing because no page settings loaded - so, this is a new page $this->loadXML('<page></page>'); $file_info = pathinfo($config_file); $this->initialize(array('page_name' => $file_info['filename'])); $this->saveToFile(); $this->docLoaded = true; $this->modified = true; // } } }