public function test()
 {
     if (empty($xml)) {
         $xml = $this->xml_data;
     }
     $module = $this->get_module()->option('module_name');
     $dom = new DOMDocument();
     $item = $dom->createElement('item');
     $dom->appendChild($item);
     $data = array('_wpcf7-form' => 'sfsdf', '_mail_2' => array('active' => 'A', 'subject' => 'B', 'sender' => '1', 'body' => '', 'recipient' => '', 'additional_headers' => ''));
     $ele = HW_Export::array_to_xml_params($data, 0, false);
     #$ele=new DOMElement('a','B');
     $i = $dom->importNode($ele, true);
     $item->appendChild($i);
 }
예제 #2
0
 /**
  * class constructor
  * @param string $module
  */
 public function __construct($module)
 {
     parent::__construct($module);
     $this->export_data = new DOMDocument(self::XML_VERSION, self::XML_ENCODING);
     $this->export_widgets = HWIE_Param::new_root_doc('widgets', null, false);
     $this->importer = new HW_Import($this);
     //HW_Import::get_instance($this );  //create importer instance for each module export class
     //load skins
     #$this->load_skins();
     $this->load_module_skins();
     //preload data
     //do not load all widgets because no enough skins data and this should load separate in method of add_export_widgets for each module
     #$this->load_widgets();
     #$this->add_export_widgets();   //sory you should include in method of module export for 'export_wxr_data'
     //set parser data, use in pre-shortcode... ($this->importer->parser-> = $this->)
     $this->update_variables(array('import_path1' => $module->get_module_file_url(''), 'import_dir1' => $module->option('module_path'), 'import_path' => get_stylesheet_directory_uri() . '/modules/' . $module->option('module_name'), 'import_dir' => get_stylesheet_directory() . '/modules/' . $module->option('module_name')));
 }
 /**
  * add option item
  * @param $data
  * @param $name
  * @param array $atts
  */
 public function add_option($name, $data = array(), $atts = array())
 {
     if ($this->get($name)) {
         return;
     }
     //already exists
     $option = $this->createElement('option');
     $holder = $this->createElement('params');
     $holder->setAttribute('name', $name);
     $option->appendChild($holder);
     //set attributes
     if (is_array($atts)) {
     }
     foreach ($atts as $key => $val) {
         $holder->setAttribute($key, $val);
     }
     HW_Export::array_to_hw_wxr($data, $holder, $this);
     $this->options->appendChild($option);
     $this->add($name, $option);
 }