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_Catalog_Block_Seo_Sitemap_Tree_Pager
  • Mage_Page_Block_Html
  • Mage_Page_Block_Html_Breadcrumbs
  • Mage_Page_Block_Html_Footer
  • Mage_Page_Block_Html_Head
  • Mage_Page_Block_Html_Header
  • Mage_Page_Block_Html_Notices
  • Mage_Page_Block_Html_Pager
  • Mage_Page_Block_Html_Topmenu
  • Mage_Page_Block_Html_Welcome
  • Mage_Page_Block_Html_Wrapper
  • Mage_Page_Block_Js_Cookie
  • Mage_Page_Block_Redirect
  • Mage_Page_Helper_Data
  • Mage_Page_Helper_Html
  • Mage_Page_Helper_Layout
  • Mage_Page_Model_Config
  • Mage_Page_Model_Source_Layout
  • 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_Page
 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: /**
 29:  * Customer Redirect Page
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Page
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Page_Block_Redirect extends Mage_Core_Block_Template
 36: {
 37: 
 38:     /**
 39:      *  HTML form hidden fields
 40:      */
 41:     protected $_formFields = array();
 42: 
 43:     /**
 44:      *  URL for redirect location
 45:      *
 46:      *  @return   string URL
 47:      */
 48:     public function getTargetURL ()
 49:     {
 50:         return '';
 51:     }
 52: 
 53:     /**
 54:      *  Additional custom message
 55:      *
 56:      *  @return   string Output message
 57:      */
 58:     public function getMessage ()
 59:     {
 60:         return '';
 61:     }
 62: 
 63:     /**
 64:      *  Client-side redirect engine output
 65:      *
 66:      *  @return   string
 67:      */
 68:     public function getRedirectOutput ()
 69:     {
 70:         if ($this->isHtmlFormRedirect()) {
 71:             return $this->getHtmlFormRedirect();
 72:         } else {
 73:             return $this->getJsRedirect();
 74:         }
 75:     }
 76: 
 77:     /**
 78:      *  Redirect via JS location
 79:      *
 80:      *  @return   string
 81:      */
 82:     public function getJsRedirect ()
 83:     {
 84:         $js  = '<script type="text/javascript">';
 85:         $js .= 'document.location.href="' . $this->getTargetURL() . '";';
 86:         $js .= '</script>';
 87:         return $js;
 88:     }
 89: 
 90:     /**
 91:      *  Redirect via HTML form submission
 92:      *
 93:      *  @return   string
 94:      */
 95:     public function getHtmlFormRedirect ()
 96:     {
 97:         $form = new Varien_Data_Form();
 98:         $form->setAction($this->getTargetURL())
 99:             ->setId($this->getFormId())
100:             ->setName($this->getFormId())
101:             ->setMethod($this->getMethod())
102:             ->setUseContainer(true);
103:         foreach ($this->_getFormFields() as $field => $value) {
104:             $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
105:         }
106:         $html = $form->toHtml();
107:         $html.= '<script type="text/javascript">document.getElementById("' . $this->getFormId() . '").submit();</script>';
108:         return $html;
109:     }
110: 
111:     /**
112:      *  HTML form or JS redirect
113:      *
114:      *  @return   boolean
115:      */
116:     public function isHtmlFormRedirect ()
117:     {
118:         return is_array($this->_getFormFields()) && count($this->_getFormFields()) > 0;
119:     }
120: 
121:     /**
122:      *  HTML form id/name attributes
123:      *
124:      *  @return   string Id/name
125:      */
126:     public function getFormId()
127:     {
128:         return '';
129:     }
130: 
131:     /**
132:      *  HTML form method attribute
133:      *
134:      *  @return   string Method
135:      */
136:     public function getFormMethod ()
137:     {
138:         return 'POST';
139:     }
140: 
141:     /**
142:      *  Array of hidden form fields (name => value)
143:      *
144:      *  @return   array
145:      */
146:     public function getFormFields()
147:     {
148:         return array();
149:     }
150: 
151:     /**
152:      *  Optimized getFormFields() method
153:      *
154:      *  @return   array
155:      */
156:     protected function _getFormFields()
157:     {
158:         if (!is_array($this->_formFields) || count($this->_formFields) == 0) {
159:             $this->_formFields = $this->getFormFields();
160:         }
161:         return $this->_formFields;
162:     }
163: 
164: }
165: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0