00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Api_Model_Wsdl_Config extends Mage_Api_Model_Wsdl_Config_Base
00035 {
00036 protected static $_namespacesPrefix = null;
00037
00038 public function __construct($sourceData=null)
00039 {
00040 $this->setCacheId('wsdl_config_global');
00041 parent::__construct($sourceData);
00042 }
00043
00044
00045
00046
00047
00048
00049 public function getWsdlContent()
00050 {
00051 return $this->_xml->asXML();
00052 }
00053
00054
00055
00056
00057
00058
00059 public static function getNamespacesPrefix()
00060 {
00061 if (is_null(self::$_namespacesPrefix)) {
00062 self::$_namespacesPrefix = array();
00063 $config = Mage::getSingleton('api/config')->getNode('v2/wsdl/prefix')->children();
00064 foreach ($config as $prefix => $namespace) {
00065 self::$_namespacesPrefix[$namespace->asArray()] = $prefix;
00066 }
00067 }
00068 return self::$_namespacesPrefix;
00069 }
00070
00071 public function getCache()
00072 {
00073 return Mage::app()->getCache();
00074 }
00075
00076 protected function _loadCache($id)
00077 {
00078 return Mage::app()->loadCache($id);
00079 }
00080
00081 protected function _saveCache($data, $id, $tags=array(), $lifetime=false)
00082 {
00083 return Mage::app()->saveCache($data, $id, $tags, $lifetime);
00084 }
00085
00086 protected function _removeCache($id)
00087 {
00088 return Mage::app()->removeCache($id);
00089 }
00090
00091 public function init()
00092 {
00093 $this->setCacheChecksum(null);
00094 $saveCache = true;
00095
00096 if (Mage::app()->useCache('config')) {
00097 $loaded = $this->loadCache();
00098 if ($loaded) {
00099 return $this;
00100 }
00101 }
00102
00103 $mergeWsdl = new Mage_Api_Model_Wsdl_Config_Base();
00104 $mergeWsdl->setHandler($this->getHandler());
00105
00106
00107
00108
00109
00110 $mergeWsdl->addLoadedFile(Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsdl.xml');
00111
00112 $baseWsdlFile = Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsdl2.xml';
00113 $this->loadFile($baseWsdlFile);
00114 Mage::getConfig()->loadModulesConfiguration('wsdl.xml', $this, $mergeWsdl);
00115
00116 if (Mage::app()->useCache('config')) {
00117 $this->saveCache(array('config'));
00118 }
00119
00120 return $this;
00121 }
00122
00123
00124
00125
00126
00127
00128 public function getXmlString()
00129 {
00130 return $this->getNode()->asXML();
00131 }
00132 }