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_Connect_Adminhtml_Extension_CustomController
  • Mage_Connect_Adminhtml_Extension_LocalController
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Form
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Abstract
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Authors
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Contents
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Depends
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Grid
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Load
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Local
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Package
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Release
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tabs
  • Mage_Connect_Helper_Data
  • Mage_Connect_Model_Extension
  • Mage_Connect_Model_Extension_Collection
  • Mage_Connect_Model_Session
  • 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_Connect
 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:  * Default helper of the module
 29:  *
 30:  * @category    Mage
 31:  * @package     Mage_Connect
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Connect_Helper_Data extends Mage_Core_Helper_Data
 35: {
 36:     /**
 37:      * Retrieve file system path for local extension packages
 38:      * Return path with last directory separator
 39:      *
 40:      * @return string
 41:      */
 42:     public function getLocalPackagesPath()
 43:     {
 44:         return Mage::getBaseDir('var') . DS . 'connect' . DS;
 45:     }
 46: 
 47:     /**
 48:      * Retrieve file system path for local extension packages (for version 1 packages only)
 49:      * Return path with last directory separator
 50:      *
 51:      * @return string
 52:      */
 53:     public function getLocalPackagesPathV1x()
 54:     {
 55:         return Mage::getBaseDir('var') . DS . 'pear' . DS;
 56:     }
 57: 
 58:     /**
 59:      * Retrieve a map to convert a channel from previous version of Magento Connect Manager
 60:      *
 61:      * @return array
 62:      */
 63:     public function getChannelMapFromV1x()
 64:     {
 65:         return array(
 66:             'connect.magentocommerce.com/community' => 'community',
 67:             'connect.magentocommerce.com/core' => 'community'
 68:         );
 69:     }
 70: 
 71:     /**
 72:      * Retrieve a map to convert a channel to previous version of Magento Connect Manager
 73:      *
 74:      * @return array
 75:      */
 76:     public function getChannelMapToV1x()
 77:     {
 78:         return array(
 79:             'community' => 'connect.magentocommerce.com/community'
 80:         );
 81:     }
 82: 
 83:     /**
 84:      * Convert package channel in order for it to be compatible with current version of Magento Connect Manager
 85:      *
 86:      * @param string $channel
 87:      *
 88:      * @return string
 89:      */
 90:     public function convertChannelFromV1x($channel)
 91:     {
 92:         $channelMap = $this->getChannelMapFromV1x();
 93:         if (isset($channelMap[$channel])) {
 94:             $channel = $channelMap[$channel];
 95:         }
 96:         return $channel;
 97:     }
 98: 
 99:     /**
100:      * Convert package channel in order for it to be compatible with previous version of Magento Connect Manager
101:      *
102:      * @param string $channel
103:      *
104:      * @return string
105:      */
106:     public function convertChannelToV1x($channel)
107:     {
108:         $channelMap = $this->getChannelMapToV1x();
109:         if (isset($channelMap[$channel])) {
110:             $channel = $channelMap[$channel];
111:         }
112:         return $channel;
113:     }
114: 
115:     /**
116:      * Load local package data array
117:      *
118:      * @param string $packageName without extension
119:      * @return array|false
120:      */
121:     public function loadLocalPackage($packageName)
122:     {
123:         //check LFI protection
124:         $this->checkLfiProtection($packageName);
125: 
126:         $path = $this->getLocalPackagesPath();
127:         $xmlFile = $path . $packageName . '.xml';
128:         $serFile = $path . $packageName . '.ser';
129: 
130:         if (file_exists($xmlFile) && is_readable($xmlFile)) {
131:             $xml  = simplexml_load_file($xmlFile);
132:             $data = Mage::helper('core')->xmlToAssoc($xml);
133:             if (!empty($data)) {
134:                 return $data;
135:             }
136:         }
137: 
138:         if (file_exists($serFile) && is_readable($xmlFile)) {
139:             $data = unserialize(file_get_contents($serFile));
140:             if (!empty($data)) {
141:                 return $data;
142:             }
143:         }
144: 
145:         return false;
146:     }
147: }
148: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0