Exemplo n.º 1
1
 /**
  * @param string $sourceFile
  * @throws Exception
  */
 public function __construct($sourceFile)
 {
     $this->sourceFile = $sourceFile;
     $this->originalDir = dirname($sourceFile) . "/original";
     $this->convertedDir = dirname($sourceFile) . "/converted";
     $this->extractXPI($sourceFile, $this->originalDir, true);
     $this->extractXPI($sourceFile, $this->convertedDir, false);
     if (!is_file($this->convertedDir . "/install.rdf")) {
         throw new Exception("install.rdf not found in installer");
     }
     $this->installRdf = new DOMDocument('1.0', 'utf-8');
     $this->installRdf->preserveWhiteSpace = false;
     $this->installRdf->formatOutput = true;
     $result = @$this->installRdf->load($this->convertedDir . "/install.rdf");
     $this->installRdf->encoding = 'utf-8';
     if (!$result) {
         throw new Exception("Cannot parse install.rdf as XML");
     }
     $this->addonName = $this->getAddonNameFromInstallRdf($this->installRdf);
     $this->chromeURLReplacements = array('chrome://browser/content/browser.xul' => 'chrome://navigator/content/navigator.xul', 'chrome://browser/content/pageinfo/pageInfo.xul' => 'chrome://navigator/content/pageinfo/pageInfo.xul', 'chrome://browser/content/preferences/permissions.xul' => 'chrome://communicator/content/permissions/permissionsManager.xul', 'chrome://browser/content/bookmarks/bookmarksPanel.xul' => 'chrome://communicator/content/bookmarks/bm-panel.xul', 'chrome://browser/content/places/places.xul' => 'chrome://communicator/content/bookmarks/bookmarksManager.xul', 'chrome://browser/content/preferences/sanitize.xul' => 'chrome://communicator/content/sanitize.xul', 'chrome://browser/content/nsContextMenu.js' => 'chrome://communicator/content/nsContextMenu.js', 'chrome://browser/content/utilityOverlay.js' => 'chrome://communicator/content/utilityOverlay.js', 'chrome://browser/content/history/history-panel.xul' => 'chrome://communicator/content/history/history-panel.xul', 'chrome://browser/content/places/menu.xml' => 'chrome://communicator/content/places/menu.xml', 'chrome://browser/content/search/engineManager.js' => 'chrome://communicator/content/search/engineManager.js', 'chrome://browser/locale/places/editBookmarkOverlay.dtd' => 'chrome://communicator/locale/bookmarks/editBookmarkOverlay.dtd', 'chrome://browser/locale/places/places.dtd' => 'chrome://communicator/locale/bookmarks/places.dtd', 'chrome://browser/content/places/bookmarkProperties.xul' => 'chrome://communicator/content/bookmarks/bm-props.xul', 'chrome://browser/content/places/bookmarkProperties2.xul' => 'chrome://communicator/content/bookmarks/bm-props.xul', 'chrome://browser/skin/livemark-folder.png' => 'chrome://communicator/skin/bookmarks/livemark-folder.png', 'chrome://browser/content/' => 'chrome://navigator/content/', 'resource:///modules/sessionstore/SessionStore.jsm' => 'resource:///components/nsSessionStore.js');
     foreach (scandir(self::MISSING_FILES_DIR) as $filename) {
         $file = self::MISSING_FILES_DIR . "/{$filename}";
         if ($filename[0] != '.' && is_file($file)) {
             $this->missingChromeURLs[$filename] = 'chrome://' . str_replace('+', '/', $filename);
         }
     }
 }
 /**
  * Load XML file
  *
  * @param string $filepath
  * @return void
  */
 protected function loadFile($filepath)
 {
     $this->xmlDoc = new \DOMDocument('1.0', 'utf-8');
     $this->xmlDoc->load($filepath);
     // @TODO: oliver@typo3.org: I guess this is not required here
     $this->xmlDoc->saveXML();
 }
Exemplo n.º 3
0
 /**
  * @param $templateName
  * @param $distributionProfile
  */
 public function __construct($templateName)
 {
     $xmlTemplate = realpath(dirname(__FILE__) . '/../') . '/xml/' . $templateName;
     $this->doc = new KDOMDocument();
     $this->doc->formatOutput = true;
     $this->doc->preserveWhiteSpace = false;
     $this->doc->load($xmlTemplate);
     $this->xpath = new DOMXPath($this->doc);
     $this->xpath->registerNamespace('media', 'http://search.yahoo.com/mrss/');
     $this->xpath->registerNamespace('dcterms', 'http://purl.org/dc/terms/');
     $this->xpath->registerNamespace('cim', 'http://labs.comcast.net/cim_mrss/');
     // item node template
     $node = $this->xpath->query('/rss/channel/item')->item(0);
     $this->item = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // content node template
     $node = $this->xpath->query('media:group/media:content', $this->item)->item(0);
     $this->content = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // thumbnail node template
     $node = $this->xpath->query('media:group/media:thumbnail', $this->item)->item(0);
     $this->thumbnail = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // category node template
     $node = $this->xpath->query('media:group/media:category', $this->item)->item(0);
     $this->category = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
 }
 private function initRepository()
 {
     $this->repository = new \DOMDocument('1.0', 'UTF-8');
     $this->repository->load(__DIR__ . '/../templates/phive.xml');
     $this->xp = new \DOMXPath($this->repository);
     $this->xp->registerNamespace('phive', 'https://phar.io/repository');
 }
Exemplo n.º 5
0
 /**
  * @param $templateName
  * @param $distributionProfile
  */
 public function __construct($templateName)
 {
     $xmlTemplate = realpath(dirname(__FILE__) . '/../') . '/xml/' . $templateName;
     $this->doc = new KDOMDocument();
     $this->doc->formatOutput = true;
     $this->doc->preserveWhiteSpace = false;
     $this->doc->load($xmlTemplate);
     $this->xpath = new DOMXPath($this->doc);
     $this->xpath->registerNamespace('media', 'http://search.yahoo.com/mrss/');
     $this->xpath->registerNamespace('dcterms', 'http://purl.org/dc/terms/');
     $this->xpath->registerNamespace('pl', 'http://xml.theplatform.com/data/object');
     $this->xpath->registerNamespace('pllist', 'http://xml.theplatform.com/data/list');
     $this->xpath->registerNamespace('plfile', 'http://xml.theplatform.com/media/data/MediaFile');
     $this->xpath->registerNamespace('plmedia', 'http://xml.theplatform.com/media/data/Media');
     $this->xpath->registerNamespace('pla', 'http://xml.theplatform.com/data/object/admin');
     $this->xpath->registerNamespace('twcable', 'http://twcable.com/customfields');
     // item node template
     $node = $this->xpath->query('/rss/channel/item')->item(0);
     $this->item = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // content node template
     $node = $this->xpath->query('media:group/media:content', $this->item)->item(0);
     $this->content = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // category node template
     $node = $this->xpath->query('media:category', $this->item)->item(0);
     $this->category = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
 }
 /**
  * @param $templateName
  * @param DoubleClickDistributionProfile $profile
  * @param $distributionProfile
  */
 public function __construct($templateName, DoubleClickDistributionProfile $profile)
 {
     $xmlTemplate = realpath(dirname(__FILE__) . '/../') . '/xml/' . $templateName;
     $this->distributionProfile = $profile;
     $this->doc = new KDOMDocument('1.0', 'UTF-8');
     $this->doc->formatOutput = true;
     $this->doc->preserveWhiteSpace = false;
     $this->doc->load($xmlTemplate);
     $this->xpath = new DOMXPath($this->doc);
     $this->xpath->registerNamespace('media', 'http://search.yahoo.com/mrss/');
     $this->xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
     $this->xpath->registerNamespace('openSearch', 'http://a9.com/-/spec/opensearchrss/1.0/');
     $this->xpath->registerNamespace('dfpvideo', 'http://api.google.com/dfpvideo');
     // item node template
     $node = $this->xpath->query('/rss/channel/item')->item(0);
     $this->item = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // content node template
     $node = $this->xpath->query('media:group/media:content', $this->item)->item(0);
     $this->content = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // thumbnail node template
     $node = $this->xpath->query('media:group/media:thumbnail', $this->item)->item(0);
     $this->thumbnail = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // category node template
     $node = $this->xpath->query('media:group/media:category', $this->item)->item(0);
     $this->category = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // set profile properties
     $this->setNodeValue('/rss/channel/title', $profile->getChannelTitle());
     $this->setNodeValue('/rss/channel/description', $profile->getChannelDescription());
     $this->setNodeValue('/rss/channel/link', $profile->getChannelLink());
     $this->setItemsPerPage($profile->getItemsPerPage());
 }
 /**
  * get product reviews from feefo
  *
  * @return array
  */
 public function getProductsReview()
 {
     $check = true;
     $reviews = array();
     $feefo_dir = Mage::getModel('core/config_options')->getLibDir() . DS . 'connector' . DS . 'feefo';
     $helper = Mage::helper('ddg');
     $logon = $helper->getFeefoLogon();
     $limit = $helper->getFeefoReviewsPerProduct();
     $products = $this->getQuoteProducts();
     foreach ($products as $sku => $name) {
         $url = "http://www.feefo.com/feefo/xmlfeed.jsp?logon=" . $logon . "&limit=" . $limit . "&vendorref=" . $sku . "&mode=productonly";
         $doc = new DOMDocument();
         $xsl = new XSLTProcessor();
         if ($check) {
             $doc->load($feefo_dir . DS . "feedback.xsl");
         } else {
             $doc->load($feefo_dir . DS . "feedback-no-th.xsl");
         }
         $xsl->importStyleSheet($doc);
         $doc->load($url);
         $productReview = $xsl->transformToXML($doc);
         if (strpos($productReview, '<td')) {
             $reviews[$name] = $xsl->transformToXML($doc);
         }
         $check = false;
     }
     return $reviews;
 }
 /**
  * @param $templateName
  * @param $distributionProfile
  */
 public function __construct($templateName)
 {
     $xmlTemplate = realpath(dirname(__FILE__) . '/../') . '/xml_templates/' . $templateName;
     $this->doc = new KDOMDocument();
     $this->doc->load($xmlTemplate);
     $this->xpath = new DOMXPath($this->doc);
 }
Exemplo n.º 9
0
 function __construct($xmlPath, Zend_Config $config, $sourcePath = "sources/java")
 {
     parent::__construct($xmlPath, $sourcePath, $config);
     $this->_usePrivateAttributes = isset($config->usePrivateAttributes) ? $config->usePrivateAttributes : false;
     $this->_doc = new KDOMDocument();
     $this->_doc->load($this->_xmlFile);
 }
Exemplo n.º 10
0
 /**
  * @param Set    $set
  * @param string $path
  */
 public function __construct(Set $set, $path)
 {
     $this->set = $set;
     $this->path = $path;
     $this->dom = new \DOMDocument();
     $this->dom->load($path);
     $xpath = new \DOMXPath($this->dom);
     $xpath->registerNamespace('link', 'http://www.xbrl.org/2003/linkbase');
     $xpath->registerNamespace('linkbase', 'http://www.xbrl.org/2003/linkbase');
     $lls = array();
     /** @var $element \DOMElement */
     foreach ($xpath->evaluate('//link:linkbase/*') as $element) {
         switch ($element->nodeName) {
             case 'labelLink':
                 $lls[] = new Label\Link($this, $element);
                 break;
             case 'referenceLink':
                 $lls[] = new Reference\Link($this, $element);
                 break;
             case 'presentationLink':
                 $lls[] = new Presentation\Link($this, $element);
                 break;
             case 'calculationLink':
                 $lls[] = new Calculation\Link($this, $element);
                 break;
             case 'definitionLink':
                 $lls[] = new Definition\Link($this, $element);
                 break;
         }
     }
     $this->links = $lls;
 }
Exemplo n.º 11
0
 /**
  * get product reviews from feefo
  *
  * @return array
  */
 public function getProductsReview()
 {
     $check = true;
     $reviews = array();
     $feefoDir = BP . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'Dotdigitalgroup' . DIRECTORY_SEPARATOR . 'Email' . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'feefo';
     $logon = $this->helper->getFeefoLogon();
     $limit = $this->helper->getFeefoReviewsPerProduct();
     $products = $this->getQuoteProducts();
     foreach ($products as $sku => $name) {
         $url = "http://www.feefo.com/feefo/xmlfeed.jsp?logon=" . $logon . "&limit=" . $limit . "&vendorref=" . $sku . "&mode=productonly";
         $doc = new \DOMDocument();
         $xsl = new \XSLTProcessor();
         if ($check) {
             $doc->load($feefoDir . DIRECTORY_SEPARATOR . "feedback.xsl");
         } else {
             $doc->load($feefoDir . DIRECTORY_SEPARATOR . "feedback-no-th.xsl");
         }
         $xsl->importStyleSheet($doc);
         $doc->loadXML(file_get_contents($url));
         $productReview = $xsl->transformToXML($doc);
         if (strpos($productReview, '<td') !== false) {
             $reviews[$name] = $xsl->transformToXML($doc);
         }
         $check = false;
     }
     return $reviews;
 }
 /**
  * Pre-execute action - before every action
  *
  * @author Sergey Startsev
  */
 public function preExecute()
 {
     $module_name = $this->getModuleName();
     $action_name = $this->getActionName();
     // init widget uri
     $this->widgetUri = "{$module_name}/{$action_name}";
     // getting xml file path
     $xmlCU = new afConfigUtils($module_name);
     $xml_path = $xmlCU->getConfigFilePath($action_name . '.xml', true);
     // initialize dom document
     $this->dom_xml = new DOMDocument();
     $this->dom_xml->preserveWhiteSpace = false;
     $this->dom_xml->formatOutput = true;
     $this->dom_xml->load($xml_path);
     $this->dom_xml_xpath = new DOMXPath($this->dom_xml);
     // getting datasource class
     $peerClassName = $this->getDatasource();
     if (!empty($peerClassName) && class_exists($peerClassName)) {
         $modelClassName = constant("{$peerClassName}::OM_CLASS");
         $formClassName = "{$modelClassName}Form";
         $this->tryToLoadObjectFromRequest($peerClassName);
         if (!$this->object) {
             $this->createNewObject($modelClassName);
         }
         $this->createAndConfigureForm($formClassName);
     }
 }
 /**
  * @param $templateName
  * @param $distributionProfile
  */
 public function __construct($templateName)
 {
     $xmlTemplate = realpath(dirname(__FILE__) . '/../') . '/xml/' . $templateName;
     $this->doc = new KDOMDocument();
     $this->doc->formatOutput = true;
     $this->doc->preserveWhiteSpace = false;
     $this->doc->load($xmlTemplate);
     //namespaces
     $this->xpath = new DOMXPath($this->doc);
     $this->xpath->registerNamespace('live', 'http://live.com/schema/media/');
     $this->xpath->registerNamespace('media', 'http://search.yahoo.com/mrss/');
     $this->xpath->registerNamespace('abcnews', 'http://abcnews.com/content/');
     // item node template
     $node = $this->xpath->query('/rss/channel/item')->item(0);
     $this->item = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // thumbnail node template
     $node = $this->xpath->query('media:thumbnail', $this->item)->item(0);
     $this->thumbnail = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
     // category node template
     $node = $this->xpath->query('media:category', $this->item)->item(0);
     $this->category = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
 }
Exemplo n.º 14
0
 function __construct($xmlPath, Zend_Config $config, $sourcePath = "sources/bpmn")
 {
     parent::__construct($xmlPath, $sourcePath, $config);
     $this->template = file_get_contents("{$sourcePath}/action.template.bpmn");
     $this->excludeSourcePaths[] = 'action.template.bpmn';
     $this->_doc = new KDOMDocument();
     $this->_doc->load($this->_xmlFile);
 }
Exemplo n.º 15
0
 function getValuesFromXML()
 {
     $xml_location = $this->get('xml_location');
     $cache_life = (int) $this->get('cache');
     require TOOLKIT . '/util.validators.php';
     // allow use of choice params in URL
     $xml_location = preg_replace('/{\\$root}/', URL, $xml_location);
     $xml_location = preg_replace('/{\\$workspace}/', WORKSPACE, $xml_location);
     $doc = new DOMDocument();
     if (preg_match($validators['URI'], $xml_location)) {
         // is a URL, check cache
         $cache_id = md5('xml_selectbox_' . $xml_location);
         $cache = new Cacheable($this->_Parent->_Parent->Database);
         $cachedData = $cache->check($cache_id);
         if (!$cachedData) {
             $ch = new Gateway();
             $ch->init();
             $ch->setopt('URL', $xml_location);
             $ch->setopt('TIMEOUT', 6);
             $xml = $ch->exec();
             $writeToCache = true;
             $cache->write($cache_id, $xml, $cache_life);
             // Cache life is in minutes not seconds e.g. 2 = 2 minutes
             $xml = trim($xml);
             if (empty($xml) && $cachedData) {
                 $xml = $cachedData['data'];
             }
         } else {
             $xml = $cachedData['data'];
         }
         $doc->loadXML($xml);
     } elseif (substr($xml_location, 0, 1) == '/') {
         // relative to DOCROOT
         $doc->load(DOCROOT . $this->get('xml_location'));
     } else {
         // in extension's /xml folder
         $doc->load(EXTENSIONS . '/xml_selectbox/xml/' . $this->get('xml_location'));
     }
     $xpath = new DOMXPath($doc);
     $options = array();
     foreach ($xpath->query($this->get('item_xpath')) as $item) {
         $option = array();
         $option['text'] = $this->run($xpath, $item, $this->get('text_xpath'));
         $option['value'] = $this->run($xpath, $item, $this->get('value_xpath'));
         if (is_null($option['value'])) {
             $option['value'] = $option['text'];
         }
         $options[] = $option;
         if ($item->hasChildNodes()) {
             foreach ($xpath->query('*', $item) as $child) {
                 $text = $this->run($xpath, $child, $this->get('text_xpath'));
                 $value = $this->run($xpath, $child, $this->get('value_xpath'));
                 $options[] = array('text' => $option['text'] . " / " . $text, 'value' => $option['value'] . "-" . (!is_null($value) ? $value : $text));
             }
         }
     }
     return $options;
 }
 function PhpZendClientGenerator($xmlPath, $sourcePath = null)
 {
     if (!$sourcePath) {
         $sourcePath = realpath("sources/zend");
     }
     parent::ClientGeneratorFromXml($xmlPath, $sourcePath);
     $this->_doc = new KDOMDocument();
     $this->_doc->load($this->_xmlFile);
 }
Exemplo n.º 17
0
 /**
  * @param string $definition
  * @param string $type
  * @return SPInstaller
  */
 public function __construct($definition, $type = null)
 {
     $this->type = $type;
     $this->xmlFile = $definition;
     $this->definition = new DOMDocument(Sobi::Cfg('xml.version', '1.0'), Sobi::Cfg('xml.encoding', 'UTF-8'));
     $this->definition->load($this->xmlFile);
     $this->xdef = new DOMXPath($this->definition);
     $this->root = dirname($this->xmlFile);
 }
 function __construct($xmlPath, $sourcePath = null)
 {
     if (!$sourcePath) {
         $sourcePath = realpath("sources/objc");
     }
     parent::ClientGeneratorFromXml($xmlPath, $sourcePath);
     $this->_doc = new KDOMDocument();
     $this->_doc->load($this->_xmlFile);
 }
Exemplo n.º 19
0
 /**
  * @constructor
  * @param ObjectManagerInterface $objectManager
  */
 public function __construct(ObjectManagerInterface $objectManager)
 {
     $this->objectManager = $objectManager;
     $this->fieldsProvider = $this->objectManager->create('Magento\\Mtf\\Util\\Generate\\Fixture\\FieldsProvider');
     $this->dom = new \DOMDocument('1.0');
     $this->dom->load(dirname(__FILE__) . '/template.xml');
     $this->dom->preserveWhiteSpace = false;
     $this->dom->formatOutput = true;
 }
Exemplo n.º 20
0
 /**
  * Leer el archivo a un objeto XML.
  *
  * @throws SPException
  * @return \SimpleXMLElement Con los datos del archivo XML
  */
 protected function readXMLFile()
 {
     $this->_xml = simplexml_load_file($this->_file->getTmpFile());
     // Cargar el XML con DOM
     $this->_xmlDOM = new \DOMDocument();
     $this->_xmlDOM->load($this->_file->getTmpFile());
     if ($this->_xml === false) {
         throw new SPException(SPException::SP_CRITICAL, _('Error interno'), _('No es posible procesar el archivo XML'));
     }
 }
 /**
  * XML based import constructor
  *
  * @param string $filename XML file name
  *
  * @throws CMbException
  */
 function __construct($filename)
 {
     if (!is_readable($filename)) {
         throw new CMbException("File '{$filename}' is not readable");
     }
     $this->filename = $filename;
     $this->dom = new DOMDocument();
     $this->dom->load($this->filename);
     $this->xpath = new DOMXPath($this->dom);
 }
Exemplo n.º 22
0
 private function loadPackageManifest()
 {
     if ($this->manifest) {
         return $this->manifest;
     }
     $this->manifest = new DOMDocument('1.0');
     $this->manifest->formatOutput = true;
     $this->manifest->preserveWhiteSpace = false;
     $this->manifest->load($this->getPackageManifestUri());
     return $this->manifest;
 }
 /**
  * @param string $serviceConfigurationFile
  * @param array $storage
  */
 public function __construct($serviceConfigurationFile, array $storage = array())
 {
     if (!file_exists($serviceConfigurationFile)) {
         throw new \InvalidArgumentException(sprintf("No valid file-path given. The ServiceConfiguration should be at %s but could not be found.", $serviceConfigurationFile));
     }
     $this->serviceConfigurationFile = $serviceConfigurationFile;
     $this->storage = $storage;
     $this->dom = new \DOMDocument('1.0', 'UTF-8');
     $this->dom->formatOutput = true;
     $this->dom->load($this->serviceConfigurationFile);
 }
 /**
  * @param $templateName
  * @param $distributionProfile
  */
 public function __construct($templateName)
 {
     $xmlTemplate = realpath(dirname(__FILE__) . '/../') . '/xml/' . $templateName;
     $this->doc = new KDOMDocument();
     $this->doc->load($xmlTemplate);
     $this->xpath = new DOMXPath($this->doc);
     $this->xpath->registerNamespace('media', 'http://search.yahoo.com/mrss/');
     $this->xpath->registerNamespace('dcterms', 'http://purl.org/dc/terms/');
     $node = $this->xpath->query('/rss/channel/item')->item(0);
     $this->item = $node->cloneNode(true);
     $node->parentNode->removeChild($node);
 }
Exemplo n.º 25
0
Arquivo: xml.php Projeto: norro/twircd
 /**
  * Construct XML configuration from config file
  * 
  * @param mixed $file 
  * @return void
  */
 public function __construct($file)
 {
     $this->file = $file;
     $this->document = new \DOMDocument();
     $this->document->formatOutput = true;
     $this->document->preserveWhiteSpace = false;
     if (is_file($file)) {
         $this->document->load($file);
     } else {
         $this->document->appendChild($this->document->createElement('config'));
     }
 }
Exemplo n.º 26
0
 protected function setUp()
 {
     $fixturePath = realpath(__DIR__ . '/../../_files') . '/';
     $this->_fileList = [file_get_contents($fixturePath . 'config_one.xml'), file_get_contents($fixturePath . 'config_two.xml')];
     $this->_fileResolverMock = $this->getMock('Magento\\Framework\\App\\Arguments\\FileResolver\\Primary', [], [], '', false);
     $this->_fileResolverMock->expects($this->once())->method('get')->will($this->returnValue($this->_fileList));
     $this->_mapper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\ObjectManager\\Config\\Mapper\\Dom');
     $this->_validationState = new \Magento\Framework\App\Arguments\ValidationState(\Magento\Framework\App\State::MODE_DEFAULT);
     $this->_schemaLocator = new \Magento\Framework\ObjectManager\Config\SchemaLocator();
     $this->_mergedConfig = new \DOMDocument();
     $this->_mergedConfig->load($fixturePath . 'config_merged.xml');
 }
Exemplo n.º 27
0
 /**
  * Get DOM from file
  *
  * @param string $file
  * @return \DOMDocument
  */
 public function getFileDom($file = 'word/document.xml')
 {
     if (null !== $this->dom && $file === $this->file) {
         return $this->dom;
     }
     $this->xpath = null;
     $this->file = $file;
     $file = $this->path . '/' . $file;
     $this->dom = new \DOMDocument();
     $this->dom->load($file);
     return $this->dom;
 }
Exemplo n.º 28
0
 /**
  * Initializes the parsing process
  * @param string $path Were the doxygen xml documentation resides.
  */
 public function Start()
 {
     $this->definitions_path = rtrim($this->definitions_path, "/\\");
     $this->document = new DOMDocument();
     $this->document->load($this->definitions_path . "/index.xml");
     $this->ExtractConstants($this->document);
     $this->ExtractEnumerations($this->document);
     $this->ExtractVariables($this->document);
     $this->ExtractTypeDefinitions($this->document);
     $this->ExtractFunctions($this->document);
     $this->ExtractClasses($this->document);
 }
Exemplo n.º 29
0
 /**
  * 
  * @param string $filename file with xml template data
  */
 public function loadFile($filename)
 {
     $filename = realpath($filename);
     if (file_exists($filename)) {
         $this->_template_data = new DOMDocument();
         $this->_template_data->preserveWhiteSpace = false;
         $this->_template_data->load($filename);
         //note the above instruction to NOT preserve whitespace is required. PHP does not handle cdata sections properly if there is *any* text around them. this could obviously mess up a <pre> section if you have one
         $this->createRestorePoint();
     } else {
         throw new RuntimeException("File not found: " . $filename);
     }
 }
Exemplo n.º 30
0
 /**
  *
  */
 private function init()
 {
     $this->dom = new \DOMDocument('1.0', 'UTF-8');
     $this->dom->preserveWhiteSpace = false;
     $this->dom->formatOutput = true;
     if ($this->filename->exists()) {
         $this->dom->load($this->filename->asString());
     } else {
         $this->dom->appendChild($this->dom->createElementNS($this->getNamespace(), $this->getRootElementName()));
     }
     $this->xPath = new \DOMXPath($this->dom);
     $this->xPath->registerNamespace('phive', $this->getNamespace());
 }