Esempio n. 1
0
 /**
  * Returns nodes found by xpath expression
  *
  * @param string $xpath
  * @return \SimpleXMLElement[]|bool
  */
 public function getXpath($xpath)
 {
     if (empty($this->_xml)) {
         return false;
     }
     if (!($result = @$this->_xml->xpath($xpath))) {
         return false;
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * Delete nodes that have "acl" attribute but value is "not allowed"
  * In any case, the "acl" attribute will be unset
  *
  * @param \Magento\Framework\Simplexml\Element $xml
  * @return void
  */
 public function filterAclNodes(\Magento\Framework\Simplexml\Element $xml)
 {
     $limitations = $xml->xpath('//*[@acl]') ?: array();
     foreach ($limitations as $node) {
         if (!$this->_authorization->isAllowed($node['acl'])) {
             $node->unsetSelf();
         } else {
             unset($node['acl']);
         }
     }
 }
Esempio n. 3
0
File: X.php Progetto: mage2pro/core
 /**
  * @param string|string[] $path
  * @return X[]
  */
 public function xpathA($path)
 {
     if (1 < func_num_args()) {
         $path = df_cc_path(func_get_args());
     } else {
         if (is_array($path)) {
             $path = df_cc_path($path);
         }
     }
     df_param_string_not_empty($path, 0);
     /** @var X[] $result */
     $result = parent::xpath($path);
     df_result_array($result);
     return $result;
 }