Definition at line 35 of file Config.php.
__construct | ( | $ | sourceData = null |
) |
Constructor
Initializes XML for this configuration
string|Varien_Simplexml_Element | $sourceData | |
string | $sourceType |
Reimplemented in Mage_Api_Model_Config, Mage_Api_Model_Wsdl_Config_Base, Mage_Api_Model_Wsdl_Config, Mage_Core_Model_Config_Base, Mage_Core_Model_Config_System, Mage_Core_Model_Config, and Mage_Core_Model_Layout.
Definition at line 110 of file Config.php.
00110 { 00111 if (is_null($sourceData)) { 00112 return; 00113 } 00114 if ($sourceData instanceof Varien_Simplexml_Element) { 00115 $this->setXml($sourceData); 00116 } elseif (is_string($sourceData) && !empty($sourceData)) { 00117 if (strlen($sourceData)<1000 && is_readable($sourceData)) { 00118 $this->loadFile($sourceData); 00119 } else { 00120 $this->loadString($sourceData); 00121 } 00122 } 00123 #$this->setCache(new Varien_Simplexml_Config_Cache_File()); 00124 #$this->getCache()->setConfig($this); 00125 }
_loadCache | ( | $ | id | ) | [protected] |
Enter description here...
string | $id |
Reimplemented in Mage_Api_Model_Config, Mage_Api_Model_Wsdl_Config, and Mage_Core_Model_Config.
Definition at line 452 of file Config.php.
00453 { 00454 return $this->getCache()->load($id); 00455 }
_removeCache | ( | $ | id | ) | [protected] |
Enter description here...
string | $id |
Reimplemented in Mage_Api_Model_Config, Mage_Api_Model_Wsdl_Config, and Mage_Core_Model_Config.
Definition at line 478 of file Config.php.
00479 { 00480 return $this->getCache()->remove($id); 00481 }
_saveCache | ( | $ | data, | |
$ | id, | |||
$ | tags = array() , |
|||
$ | lifetime = false | |||
) | [protected] |
Enter description here...
string | $data | |
string | $id | |
array | $tags | |
int|boolean | $lifetime |
Reimplemented in Mage_Api_Model_Config, Mage_Api_Model_Wsdl_Config, and Mage_Core_Model_Config.
Definition at line 466 of file Config.php.
applyExtends | ( | ) |
Process configuration xml
Definition at line 561 of file Config.php.
00562 { 00563 $targets = $this->getXpath($this->_xpathExtends); 00564 if (!$targets) { 00565 return $this; 00566 } 00567 00568 foreach ($targets as $target) { 00569 $sources = $this->getXpath((string)$target['extends']); 00570 if ($sources) { 00571 foreach ($sources as $source) { 00572 $target->extend($source); 00573 } 00574 } else { 00575 #echo "Not found extend: ".(string)$target['extends']; 00576 } 00577 #unset($target['extends']); 00578 } 00579 return $this; 00580 }
extend | ( | Varien_Simplexml_Config $ | config, | |
$ | overwrite = true | |||
) |
Enter description here...
Varien_Simplexml_Config | $config | |
boolean | $overwrite |
Definition at line 600 of file Config.php.
00601 { 00602 $this->getNode()->extend($config->getNode(), $overwrite); 00603 return $this; 00604 }
fetchCacheChecksum | ( | ) |
getCache | ( | ) |
Enter description here...
Reimplemented in Mage_Api_Model_Config, Mage_Api_Model_Wsdl_Config, and Mage_Core_Model_Config.
Definition at line 193 of file Config.php.
getCacheChecksum | ( | ) |
getCacheChecksumId | ( | ) |
Enter description here...
Definition at line 338 of file Config.php.
00339 { 00340 return $this->getCacheId().'__CHECKSUM'; 00341 }
getCacheId | ( | ) |
getCacheLifetime | ( | ) |
getCacheSaved | ( | ) |
getCacheTags | ( | ) |
getNode | ( | $ | path = null |
) |
Returns node found by the $path
string | $path |
Definition at line 146 of file Config.php.
00147 { 00148 if (!$this->_xml instanceof Varien_Simplexml_Element) { 00149 return false; 00150 } elseif ($path === null) { 00151 return $this->_xml; 00152 } else { 00153 return $this->_xml->descend($path); 00154 } 00155 }
getXmlString | ( | ) |
Return Xml of node as string
Reimplemented in Mage_Api_Model_Wsdl_Config.
Definition at line 429 of file Config.php.
00430 { 00431 return $this->getNode()->asNiceXml('', false); 00432 }
getXpath | ( | $ | xpath | ) |
Returns nodes found by xpath expression
string | $xpath |
Definition at line 163 of file Config.php.
00164 { 00165 if (empty($this->_xml)) { 00166 return false; 00167 } 00168 00169 if (!$result = @$this->_xml->xpath($xpath)) { 00170 return false; 00171 } 00172 00173 return $result; 00174 }
loadCache | ( | ) |
Enter description here...
Definition at line 376 of file Config.php.
00377 { 00378 if (!$this->validateCacheChecksum()) { 00379 return false; 00380 } 00381 00382 $xmlString = $this->_loadCache($this->getCacheId()); 00383 $xml = simplexml_load_string($xmlString, $this->_elementClass); 00384 if ($xml) { 00385 $this->_xml = $xml; 00386 $this->setCacheSaved(true); 00387 return true; 00388 } 00389 00390 return false; 00391 }
loadDom | ( | $ | dom | ) |
Imports DOM node
DOMNode | $dom |
Definition at line 530 of file Config.php.
00531 { 00532 $xml = simplexml_import_dom($dom, $this->_elementClass); 00533 00534 if ($xml) { 00535 $this->_xml = $xml; 00536 return true; 00537 } 00538 00539 return false; 00540 }
loadFile | ( | $ | filePath | ) |
Imports XML file
string | $filePath |
Reimplemented in Mage_Api_Model_Wsdl_Config_Base.
Definition at line 489 of file Config.php.
00490 { 00491 if (!is_readable($filePath)) { 00492 //throw new Exception('Can not read xml file '.$filePath); 00493 return false; 00494 } 00495 00496 $fileData = file_get_contents($filePath); 00497 $fileData = $this->processFileData($fileData); 00498 return $this->loadString($fileData, $this->_elementClass); 00499 }
loadString | ( | $ | string | ) |
Imports XML string
string | $string |
Definition at line 507 of file Config.php.
00508 { 00509 if (!empty($string)) { 00510 $xml = simplexml_load_string($string, $this->_elementClass); 00511 } 00512 else { 00513 throw new Exception('"$string" parameter for simplexml_load_string is empty'); 00514 } 00515 00516 if ($xml instanceof Varien_Simplexml_Element) { 00517 $this->_xml = $xml; 00518 return true; 00519 } 00520 00521 return false; 00522 }
processFileData | ( | $ | text | ) |
Stub method for processing file data right after loading the file text
string | $text |
Reimplemented in Mage_Api_Model_Wsdl_Config_Base.
Definition at line 588 of file Config.php.
removeCache | ( | ) |
Enter description here...
Reimplemented in Mage_Core_Model_Config.
Definition at line 439 of file Config.php.
00440 { 00441 $this->_removeCache($this->getCacheId()); 00442 $this->_removeCache($this->getCacheChecksumId()); 00443 return $this; 00444 }
saveCache | ( | $ | tags = null |
) |
Enter description here...
array | $tags |
Reimplemented in Mage_Core_Model_Config.
Definition at line 399 of file Config.php.
00400 { 00401 if ($this->getCacheSaved()) { 00402 return $this; 00403 } 00404 if (false===$this->getCacheChecksum()) { 00405 return $this; 00406 } 00407 00408 if (is_null($tags)) { 00409 $tags = $this->_cacheTags; 00410 } 00411 00412 if (!is_null($this->getCacheChecksum())) { 00413 $this->_saveCache($this->getCacheChecksum(), $this->getCacheChecksumId(), $tags, $this->getCacheLifetime()); 00414 } 00415 00416 $xmlString = $this->getXmlString(); 00417 $this->_saveCache($xmlString, $this->getCacheId(), $tags, $this->getCacheLifetime()); 00418 00419 $this->setCacheSaved(true); 00420 00421 return $this; 00422 }
setCache | ( | $ | cache | ) |
Enter description here...
Varien_Simplexml_Config_Cache_Abstract | $cache |
Definition at line 182 of file Config.php.
setCacheChecksum | ( | $ | data | ) |
Enter description here...
string | $data |
Definition at line 292 of file Config.php.
00293 { 00294 if (is_null($data)) { 00295 $this->_cacheChecksum = null; 00296 } elseif (false===$data || 0===$data) { 00297 $this->_cacheChecksum = false; 00298 } else { 00299 $this->_cacheChecksum = md5($data); 00300 } 00301 return $this; 00302 }
setCacheId | ( | $ | id | ) |
Enter description here...
string | $id |
Definition at line 226 of file Config.php.
setCacheLifetime | ( | $ | lifetime | ) |
Enter description here...
int | $lifetime |
Definition at line 270 of file Config.php.
setCacheSaved | ( | $ | flag | ) |
Enter description here...
boolean | $flag |
Definition at line 204 of file Config.php.
setCacheTags | ( | $ | tags | ) |
Enter description here...
array | $tags |
Definition at line 248 of file Config.php.
setNode | ( | $ | path, | |
$ | value, | |||
$ | overwrite = true | |||
) |
Create node by $path and set its value.
string | $path separated by slashes | |
string | $value | |
boolean | $overwrite |
Definition at line 550 of file Config.php.
setXml | ( | Varien_Simplexml_Element $ | node | ) |
Sets xml for this configuration
Varien_Simplexml_Element | $sourceData |
Definition at line 133 of file Config.php.
updateCacheChecksum | ( | $ | data | ) |
Enter description here...
string | $data |
Definition at line 310 of file Config.php.
00311 { 00312 if (false===$this->getCacheChecksum()) { 00313 return $this; 00314 } 00315 if (false===$data || 0===$data) { 00316 $this->_cacheChecksum = false; 00317 } else { 00318 $this->setCacheChecksum($this->getCacheChecksum().':'.$data); 00319 } 00320 return $this; 00321 }
validateCacheChecksum | ( | ) |
Enter description here...
Definition at line 358 of file Config.php.
00359 { 00360 $newChecksum = $this->getCacheChecksum(); 00361 if (false===$newChecksum) { 00362 return false; 00363 } 00364 if (is_null($newChecksum)) { 00365 return true; 00366 } 00367 $cachedChecksum = $this->getCache()->load($this->getCacheChecksumId()); 00368 return $newChecksum===false && $cachedChecksum===false || $newChecksum===$cachedChecksum; 00369 }
$_cache = null [protected] |
Definition at line 85 of file Config.php.
$_cacheChecksum = false [protected] |
Definition at line 71 of file Config.php.
$_cacheId = null [protected] |
Definition at line 50 of file Config.php.
$_cacheLifetime = null [protected] |
Definition at line 64 of file Config.php.
$_cacheSaved = false [protected] |
Definition at line 78 of file Config.php.
$_cacheTags = array() [protected] |
Definition at line 57 of file Config.php.
$_elementClass = 'Varien_Simplexml_Element' [protected] |
Definition at line 92 of file Config.php.
$_xml = null [protected] |
Definition at line 43 of file Config.php.
$_xpathExtends = "//*[@extends]" [protected] |
Definition at line 99 of file Config.php.