public function test()
 {
     $xml = '<root><child1 /><child2 /><child3 /></root>';
     $node = simpledom_load_file($this->file($xml));
     $this->assertSame('SimpleDOM', get_class($node), 'Wrong class returned');
     $this->assertXmlStringEqualsXmlString($xml, $node->asXML());
 }
Example #2
0
 protected function _collectCoreModulesLayouts()
 {
     $this->log("COLLECTING M1 LAYOUTS...")->log('');
     $layoutFiles = glob($this->_env['mage1_dir'] . '/app/design/*/*/*/layout/*.xml');
     foreach ($layoutFiles as $file) {
         preg_match('#/app/design/([^/]+)/([^/]+/[^/]+)#', $file, $m);
         $xml = simpledom_load_file($file);
         $blocks = $xml->xpath('//block');
         foreach ($blocks as $blockNode) {
             if ($blockNode['type'] && $blockNode['name']) {
                 $className = $this->_getClassName('blocks', (string) $blockNode['type'], false);
                 $this->_layouts[$m[1]]['blocks'][(string) $blockNode['name']] = $className;
             }
         }
     }
 }
Example #3
0
	/**
	 * @throws Exception
	 * @param  $file
	 * @return Shopware_Components_Xml_SimpleXml
	 */
	public function loadFile($file){
		if (!is_file($file)){
			throw new Exception("File $file not found");
		}
		$this->filename = $file;
		$this->SimpleXML = simpledom_load_file($file);
		return $this;
	}
Example #4
0
 public function __construct($services_file, $servicename)
 {
     $this->fields = array();
     $servicename = htmlspecialchars($servicename);
     $service_doc = simpledom_load_file($services_file);
     $FIELDS = array();
     foreach ($service_doc as $service) {
         if ($service->getAttribute('name') == $servicename) {
             $settings_content = "";
             if (isset($service->settingsfile)) {
                 $settings_content = $service->settingsfile->innerXML();
             }
             $this->settings = $settings_content;
             preg_match_all("#{{(.*?)}}#", $settings_content, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 if (count($match) == 2) {
                     // fieldspec:
                     // 1|2|3|4|5
                     // 1 = fieldname
                     // 2 = field text
                     // 3 = field help area text
                     // 4 = default value
                     // 5 = image value (for help)
                     // 6 = special script/actions
                     // 7 = universality (true|false) = dictates whether or not this field will show in matchentry interfaces inside his
                     $full_field_spec = $match[1];
                     $fieldvals = explode("|||", $full_field_spec);
                     //preg_match_all("#(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*)#",$full_field_spec,$fieldvals,PREG_SET_ORDER);
                     if (count($fieldvals) == 7) {
                         $field_name = $fieldvals[0];
                         $field_text = $fieldvals[1];
                         $field_help_text = $fieldvals[2];
                         $field_default_value = $fieldvals[3];
                         $image_value = $fieldvals[4];
                         $special_content = $fieldvals[5];
                         $universal_setting = $fieldvals[6];
                         $SETUP_FIELD = new SetupField($field_name, $field_text, $field_help_text, $field_default_value, $image_value, $special_content, $universal_setting, "{{" . $full_field_spec . "}}");
                         if (isset($_POST[$field_name])) {
                             $SETUP_FIELD->value = htmlspecialchars($_POST[$field_name]);
                         } else {
                             $SETUP_FIELD->value = $SETUP_FIELD->defaultvalue;
                         }
                         $FIELDS[] = $SETUP_FIELD;
                     }
                     // END ALL FIELD
                 }
                 // end if (right number of entries in match array)
             }
             // END FOR - ALL MATCHES:  {{  }}
         }
         // end if matching service
     }
     // / end foreach (all services
     // end pasted code
     $this->fields = $FIELDS;
 }