Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Api_Controller_Action
  • Mage_Api_Helper_Data
  • Mage_Api_IndexController
  • Mage_Api_Model_Acl
  • Mage_Api_Model_Acl_Assert_Ip
  • Mage_Api_Model_Acl_Assert_Time
  • Mage_Api_Model_Acl_Resource
  • Mage_Api_Model_Acl_Role
  • Mage_Api_Model_Acl_Role_Generic
  • Mage_Api_Model_Acl_Role_Group
  • Mage_Api_Model_Acl_Role_Registry
  • Mage_Api_Model_Acl_Role_User
  • Mage_Api_Model_Config
  • Mage_Api_Model_Mysql4_Acl
  • Mage_Api_Model_Mysql4_Acl_Role
  • Mage_Api_Model_Mysql4_Acl_Role_Collection
  • Mage_Api_Model_Mysql4_Permissions_Collection
  • Mage_Api_Model_Mysql4_Role
  • Mage_Api_Model_Mysql4_Role_Collection
  • Mage_Api_Model_Mysql4_Roles
  • Mage_Api_Model_Mysql4_Roles_Collection
  • Mage_Api_Model_Mysql4_Roles_User_Collection
  • Mage_Api_Model_Mysql4_Rules
  • Mage_Api_Model_Mysql4_Rules_Collection
  • Mage_Api_Model_Mysql4_User
  • Mage_Api_Model_Mysql4_User_Collection
  • Mage_Api_Model_Resource_Abstract
  • Mage_Api_Model_Resource_Acl
  • Mage_Api_Model_Resource_Acl_Role
  • Mage_Api_Model_Resource_Acl_Role_Collection
  • Mage_Api_Model_Resource_Permissions_Collection
  • Mage_Api_Model_Resource_Role
  • Mage_Api_Model_Resource_Role_Collection
  • Mage_Api_Model_Resource_Roles
  • Mage_Api_Model_Resource_Roles_Collection
  • Mage_Api_Model_Resource_Roles_User_Collection
  • Mage_Api_Model_Resource_Rules
  • Mage_Api_Model_Resource_Rules_Collection
  • Mage_Api_Model_Resource_User
  • Mage_Api_Model_Resource_User_Collection
  • Mage_Api_Model_Role
  • Mage_Api_Model_Roles
  • Mage_Api_Model_Rules
  • Mage_Api_Model_Server
  • Mage_Api_Model_Server_Adapter_Soap
  • Mage_Api_Model_Server_Adapter_Xmlrpc
  • Mage_Api_Model_Server_Handler
  • Mage_Api_Model_Server_Handler_Abstract
  • Mage_Api_Model_Server_V2_Adapter_Soap
  • Mage_Api_Model_Server_V2_Handler
  • Mage_Api_Model_Server_WSI_Adapter_Soap
  • Mage_Api_Model_Server_WSI_Handler
  • Mage_Api_Model_Session
  • Mage_Api_Model_User
  • Mage_Api_Model_Wsdl_Config
  • Mage_Api_Model_Wsdl_Config_Base
  • Mage_Api_SoapController
  • Mage_Api_V2_SoapController
  • Mage_Api_XmlrpcController

Interfaces

  • Mage_Api_Model_Server_Adapter_Interface

Exceptions

  • Mage_Api_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Api
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Webservice api config model
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_Api
 32:  * @author     Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Api_Model_Config extends Varien_Simplexml_Config
 35: {
 36:     const CACHE_TAG         = 'config_api';
 37: 
 38:     /**
 39:      * Constructor
 40:      *
 41:      * @see Varien_Simplexml_Config
 42:      */
 43:     public function __construct($sourceData=null)
 44:     {
 45:         $this->setCacheId('config_api');
 46:         $this->setCacheTags(array(self::CACHE_TAG));
 47: 
 48:         parent::__construct($sourceData);
 49:         $this->_construct();
 50:     }
 51: 
 52:     /**
 53:      * Init configuration for webservices api
 54:      *
 55:      * @return Mage_Api_Model_Config
 56:      */
 57:     protected function _construct()
 58:     {
 59:         if (Mage::app()->useCache('config_api')) {
 60:             if ($this->loadCache()) {
 61:                 return $this;
 62:             }
 63:         }
 64: 
 65:         $config = Mage::getConfig()->loadModulesConfiguration('api.xml');
 66:         $this->setXml($config->getNode('api'));
 67: 
 68:         if (Mage::app()->useCache('config_api')) {
 69:             $this->saveCache();
 70:         }
 71:         return $this;
 72:     }
 73: 
 74:     /**
 75:      * Retrieve adapter aliases from config.
 76:      *
 77:      * @return array
 78:      */
 79:     public function getAdapterAliases()
 80:     {
 81:         $aliases = array();
 82: 
 83:         foreach ($this->getNode('adapter_aliases')->children() as $alias => $adapter) {
 84:             $aliases[$alias] = array(
 85:                 (string) $adapter->suggest_class, // model class name
 86:                 (string) $adapter->suggest_method // model method name
 87:             );
 88:         }
 89:         return $aliases;
 90:     }
 91: 
 92:     /**
 93:      * Retrieve all adapters
 94:      *
 95:      * @return array
 96:      */
 97:     public function getAdapters()
 98:     {
 99:         $adapters = array();
100:         foreach ($this->getNode('adapters')->children() as $adapterName => $adapter) {
101:             /* @var $adapter Varien_SimpleXml_Element */
102:             if (isset($adapter->use)) {
103:                 $adapter = $this->getNode('adapters/' . (string) $adapter->use);
104:             }
105:             $adapters[$adapterName] = $adapter;
106:         }
107:         return $adapters;
108:     }
109: 
110:     /**
111:      * Retrieve active adapters
112:      *
113:      * @return array
114:      */
115:     public function getActiveAdapters()
116:     {
117:         $adapters = array();
118:         foreach ($this->getAdapters() as $adapterName => $adapter) {
119:             if (!isset($adapter->active) || $adapter->active == '0') {
120:                 continue;
121:             }
122: 
123:             if (isset($adapter->required) && isset($adapter->required->extensions)) {
124:                 foreach ($adapter->required->extensions->children() as $extension=>$data) {
125:                     if (!extension_loaded($extension)) {
126:                         continue;
127:                     }
128:                 }
129:             }
130: 
131:             $adapters[$adapterName] = $adapter;
132:         }
133: 
134:         return $adapters;
135:     }
136: 
137:     /**
138:      * Retrieve handlers
139:      *
140:      * @return Varien_Simplexml_Element
141:      */
142:     public function getHandlers()
143:     {
144:         return $this->getNode('handlers')->children();
145:     }
146: 
147:     /**
148:      * Retrieve resources
149:      *
150:      * @return Varien_Simplexml_Element
151:      */
152:     public function getResources()
153:     {
154:         return $this->getNode('resources')->children();
155:     }
156: 
157:     /**
158:      * Retrieve resources alias
159:      *
160:      * @return Varien_Simplexml_Element
161:      */
162:     public function getResourcesAlias()
163:     {
164:         return $this->getNode('resources_alias')->children();
165:     }
166: 
167: 
168:     /**
169:      * Load Acl resources from config
170:      *
171:      * @param Mage_Api_Model_Acl $acl
172:      * @param Mage_Core_Model_Config_Element $resource
173:      * @param string $parentName
174:      * @return Mage_Api_Model_Config
175:      */
176:     public function loadAclResources(Mage_Api_Model_Acl $acl, $resource=null, $parentName=null)
177:     {
178:         $resourceName = null;
179:         if (is_null($resource)) {
180:             $resource = $this->getNode('acl/resources');
181:         } else {
182:             $resourceName = (is_null($parentName) ? '' : $parentName.'/').$resource->getName();
183:             $acl->add(Mage::getModel('api/acl_resource', $resourceName), $parentName);
184:         }
185: 
186:         $children = $resource->children();
187: 
188:         if (empty($children)) {
189:             return $this;
190:         }
191: 
192:         foreach ($children as $res) {
193:             if ($res->getName() != 'title' && $res->getName() != 'sort_order') {
194:                 $this->loadAclResources($acl, $res, $resourceName);
195:             }
196:         }
197:         return $this;
198:     }
199: 
200:     /**
201:      * Get acl assert config
202:      *
203:      * @param string $name
204:      * @return Mage_Core_Model_Config_Element|boolean
205:      */
206:     public function getAclAssert($name='')
207:     {
208:         $asserts = $this->getNode('acl/asserts');
209:         if (''===$name) {
210:             return $asserts;
211:         }
212: 
213:         if (isset($asserts->$name)) {
214:             return $asserts->$name;
215:         }
216: 
217:         return false;
218:     }
219: 
220:     /**
221:      * Retrieve privilege set by name
222:      *
223:      * @param string $name
224:      * @return Mage_Core_Model_Config_Element|boolean
225:      */
226:     public function getAclPrivilegeSet($name='')
227:     {
228:         $sets = $this->getNode('acl/privilegeSets');
229:         if (''===$name) {
230:             return $sets;
231:         }
232: 
233:         if (isset($sets->$name)) {
234:             return $sets->$name;
235:         }
236: 
237:         return false;
238:     }
239: 
240:     public function getFaults($resourceName=null)
241:     {
242:         if (is_null($resourceName)
243:             || !isset($this->getResources()->$resourceName)
244:             || !isset($this->getResources()->$resourceName->faults)) {
245:             $faultsNode = $this->getNode('faults');
246:         } else {
247:             $faultsNode = $this->getResources()->$resourceName->faults;
248:         }
249:         /* @var $faultsNode Varien_Simplexml_Element */
250: 
251:         $translateModule = 'api';
252:         if (isset($faultsNode['module'])) {
253:            $translateModule = (string) $faultsNode['module'];
254:         }
255: 
256:         $faults = array();
257:         foreach ($faultsNode->children() as $faultName => $fault) {
258:             $faults[$faultName] = array(
259:                 'code'    => (string) $fault->code,
260:                 'message' => Mage::helper($translateModule)->__((string)$fault->message)
261:             );
262:         }
263: 
264:         return $faults;
265:     }
266: 
267:     /**
268:      * Retrieve cache object
269:      *
270:      * @return Zend_Cache_Frontend_File
271:      */
272:     public function getCache()
273:     {
274:         return Mage::app()->getCache();
275:     }
276: 
277:     protected function _loadCache($id)
278:     {
279:         return Mage::app()->loadCache($id);
280:     }
281: 
282:     protected function _saveCache($data, $id, $tags=array(), $lifetime=false)
283:     {
284:         return Mage::app()->saveCache($data, $id, $tags, $lifetime);
285:     }
286: 
287:     protected function _removeCache($id)
288:     {
289:         return Mage::app()->removeCache($id);
290:     }
291: } // Class Mage_Api_Model_Config End
292: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0