Version Notes
- Upgrade Proof Module.
- Tested for Magento version 1.3.2.4 - 1.6.0.0
- Easy to install
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Easy_Template_Path_Hints |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
- app/code/local/Mage/Core/Block/Template.php +367 -0
- app/code/local/MagePsycho/Easypathhints/Block/Easypathhints.php +5 -0
- app/code/local/MagePsycho/Easypathhints/Block/System/Config/Info.php +35 -0
- app/code/local/MagePsycho/Easypathhints/Helper/Data.php +26 -0
- app/code/local/MagePsycho/Easypathhints/Model/Easypathhints.php +12 -0
- app/code/local/MagePsycho/Easypathhints/controllers/IndexController.php +29 -0
- app/code/local/MagePsycho/Easypathhints/etc/adminhtml.xml +34 -0
- app/code/local/MagePsycho/Easypathhints/etc/config.xml +82 -0
- app/code/local/MagePsycho/Easypathhints/etc/system.xml +78 -0
- app/etc/modules/MagePsycho_Easypathhints.xml +18 -0
- package.xml +20 -0
app/code/local/Mage/Core/Block/Template.php
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_Core
|
| 23 |
+
* @copyright Copyright (c) 2010 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 |
+
* Base html block
|
| 30 |
+
*
|
| 31 |
+
* @category Mage
|
| 32 |
+
* @package Mage_Core
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
class Mage_Core_Block_Template extends Mage_Core_Block_Abstract
|
| 36 |
+
{
|
| 37 |
+
const XML_PATH_DEBUG_TEMPLATE_HINTS = 'dev/debug/template_hints';
|
| 38 |
+
const XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS = 'dev/debug/template_hints_blocks';
|
| 39 |
+
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink';
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* View scripts directory
|
| 43 |
+
*
|
| 44 |
+
* @var string
|
| 45 |
+
*/
|
| 46 |
+
protected $_viewDir = '';
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Assigned variables for view
|
| 50 |
+
*
|
| 51 |
+
* @var array
|
| 52 |
+
*/
|
| 53 |
+
protected $_viewVars = array();
|
| 54 |
+
|
| 55 |
+
protected $_baseUrl;
|
| 56 |
+
|
| 57 |
+
protected $_jsUrl;
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Is allowed symlinks flag
|
| 61 |
+
*
|
| 62 |
+
* @var bool
|
| 63 |
+
*/
|
| 64 |
+
protected $_allowSymlinks = null;
|
| 65 |
+
|
| 66 |
+
protected static $_showTemplateHints;
|
| 67 |
+
protected static $_showTemplateHintsBlocks;
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Path to template file in theme.
|
| 71 |
+
*
|
| 72 |
+
* @var string
|
| 73 |
+
*/
|
| 74 |
+
protected $_template;
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Internal constructor, that is called from real constructor
|
| 78 |
+
*
|
| 79 |
+
*/
|
| 80 |
+
protected function _construct()
|
| 81 |
+
{
|
| 82 |
+
parent::_construct();
|
| 83 |
+
|
| 84 |
+
/*
|
| 85 |
+
* In case template was passed through constructor
|
| 86 |
+
* we assign it to block's property _template
|
| 87 |
+
* Mainly for those cases when block created
|
| 88 |
+
* not via Mage_Core_Model_Layout::addBlock()
|
| 89 |
+
*/
|
| 90 |
+
if ($this->hasData('template')) {
|
| 91 |
+
$this->setTemplate($this->getData('template'));
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Get relevant path to template
|
| 97 |
+
*
|
| 98 |
+
* @return string
|
| 99 |
+
*/
|
| 100 |
+
public function getTemplate()
|
| 101 |
+
{
|
| 102 |
+
return $this->_template;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Set path to template used for generating block's output.
|
| 107 |
+
*
|
| 108 |
+
* @param string $template
|
| 109 |
+
* @return Mage_Core_Block_Template
|
| 110 |
+
*/
|
| 111 |
+
public function setTemplate($template)
|
| 112 |
+
{
|
| 113 |
+
$this->_template = $template;
|
| 114 |
+
return $this;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* Get absolute path to template
|
| 119 |
+
*
|
| 120 |
+
* @return string
|
| 121 |
+
*/
|
| 122 |
+
public function getTemplateFile()
|
| 123 |
+
{
|
| 124 |
+
$params = array('_relative'=>true);
|
| 125 |
+
$area = $this->getArea();
|
| 126 |
+
if ($area) {
|
| 127 |
+
$params['_area'] = $area;
|
| 128 |
+
}
|
| 129 |
+
$templateName = Mage::getDesign()->getTemplateFilename($this->getTemplate(), $params);
|
| 130 |
+
return $templateName;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/**
|
| 134 |
+
* Get design area
|
| 135 |
+
* @return string
|
| 136 |
+
*/
|
| 137 |
+
public function getArea()
|
| 138 |
+
{
|
| 139 |
+
return $this->_getData('area');
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
/**
|
| 143 |
+
* Assign variable
|
| 144 |
+
*
|
| 145 |
+
* @param string|array $key
|
| 146 |
+
* @param mixed $value
|
| 147 |
+
* @return Mage_Core_Block_Template
|
| 148 |
+
*/
|
| 149 |
+
public function assign($key, $value=null)
|
| 150 |
+
{
|
| 151 |
+
if (is_array($key)) {
|
| 152 |
+
foreach ($key as $k=>$v) {
|
| 153 |
+
$this->assign($k, $v);
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
else {
|
| 157 |
+
$this->_viewVars[$key] = $value;
|
| 158 |
+
}
|
| 159 |
+
return $this;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/**
|
| 163 |
+
* Set template location dire
|
| 164 |
+
*
|
| 165 |
+
* @param string $dir
|
| 166 |
+
* @return Mage_Core_Block_Template
|
| 167 |
+
*/
|
| 168 |
+
public function setScriptPath($dir)
|
| 169 |
+
{
|
| 170 |
+
$this->_viewDir = $dir;
|
| 171 |
+
return $this;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
/**
|
| 175 |
+
* Check if dirrect output is allowed for block
|
| 176 |
+
* @return bool
|
| 177 |
+
*/
|
| 178 |
+
public function getDirectOutput()
|
| 179 |
+
{
|
| 180 |
+
if ($this->getLayout()) {
|
| 181 |
+
return $this->getLayout()->getDirectOutput();
|
| 182 |
+
}
|
| 183 |
+
return false;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
public function getShowTemplateHints()
|
| 187 |
+
{
|
| 188 |
+
if (is_null(self::$_showTemplateHints)) {
|
| 189 |
+
$helper = Mage::helper('easypathhints');
|
| 190 |
+
$isActive = $helper->getConfig('active');
|
| 191 |
+
$tp = Mage::app()->getRequest()->getParam('tp');
|
| 192 |
+
$accessCode = Mage::app()->getRequest()->getParam('code');
|
| 193 |
+
$dbAccessCode = $helper->getConfig('code');
|
| 194 |
+
if(!empty($dbAccessCode)){
|
| 195 |
+
$checkAccessCode = ($dbAccessCode == $accessCode) ? true : false;
|
| 196 |
+
}else{
|
| 197 |
+
$checkAccessCode = true;
|
| 198 |
+
}
|
| 199 |
+
if($tp && $isActive && $checkAccessCode){
|
| 200 |
+
self::$_showTemplateHints = true;
|
| 201 |
+
self::$_showTemplateHintsBlocks = true;
|
| 202 |
+
}else{
|
| 203 |
+
self::$_showTemplateHints = Mage::getStoreConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS)
|
| 204 |
+
&& Mage::helper('core')->isDevAllowed();
|
| 205 |
+
self::$_showTemplateHintsBlocks = Mage::getStoreConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS)
|
| 206 |
+
&& Mage::helper('core')->isDevAllowed();
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
return self::$_showTemplateHints;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
/**
|
| 213 |
+
* Retrieve block view from file (template)
|
| 214 |
+
*
|
| 215 |
+
* @param string $fileName
|
| 216 |
+
* @return string
|
| 217 |
+
*/
|
| 218 |
+
public function fetchView($fileName)
|
| 219 |
+
{
|
| 220 |
+
Varien_Profiler::start($fileName);
|
| 221 |
+
|
| 222 |
+
// EXTR_SKIP protects from overriding
|
| 223 |
+
// already defined variables
|
| 224 |
+
extract ($this->_viewVars, EXTR_SKIP);
|
| 225 |
+
$do = $this->getDirectOutput();
|
| 226 |
+
|
| 227 |
+
if (!$do) {
|
| 228 |
+
ob_start();
|
| 229 |
+
}
|
| 230 |
+
if ($this->getShowTemplateHints()) {
|
| 231 |
+
echo <<<HTML
|
| 232 |
+
<div style="position:relative; border:1px dotted red; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;">
|
| 233 |
+
<div style="position:absolute; left:0; top:0; padding:2px 5px; background:red; color:white; font:normal 11px Arial;
|
| 234 |
+
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex='999'"
|
| 235 |
+
onmouseout="this.style.zIndex='998'" title="{$fileName}">{$fileName}</div>
|
| 236 |
+
HTML;
|
| 237 |
+
if (self::$_showTemplateHintsBlocks) {
|
| 238 |
+
$thisClass = get_class($this);
|
| 239 |
+
echo <<<HTML
|
| 240 |
+
<div style="position:absolute; right:0; top:0; padding:2px 5px; background:red; color:blue; font:normal 11px Arial;
|
| 241 |
+
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex='999'" onmouseout="this.style.zIndex='998'"
|
| 242 |
+
title="{$thisClass}">{$thisClass}</div>
|
| 243 |
+
HTML;
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
try {
|
| 248 |
+
$includeFilePath = realpath($this->_viewDir . DS . $fileName);
|
| 249 |
+
if (strpos($includeFilePath, realpath($this->_viewDir)) === 0 || $this->_getAllowSymlinks()) {
|
| 250 |
+
include $includeFilePath;
|
| 251 |
+
} else {
|
| 252 |
+
Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, null, true);
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
} catch (Exception $e) {
|
| 256 |
+
ob_get_clean();
|
| 257 |
+
throw $e;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
if ($this->getShowTemplateHints()) {
|
| 261 |
+
echo '</div>';
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
if (!$do) {
|
| 265 |
+
$html = ob_get_clean();
|
| 266 |
+
} else {
|
| 267 |
+
$html = '';
|
| 268 |
+
}
|
| 269 |
+
Varien_Profiler::stop($fileName);
|
| 270 |
+
return $html;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
/**
|
| 274 |
+
* Render block
|
| 275 |
+
*
|
| 276 |
+
* @return string
|
| 277 |
+
*/
|
| 278 |
+
public function renderView()
|
| 279 |
+
{
|
| 280 |
+
$this->setScriptPath(Mage::getBaseDir('design'));
|
| 281 |
+
$html = $this->fetchView($this->getTemplateFile());
|
| 282 |
+
return $html;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
/**
|
| 286 |
+
* Render block HTML
|
| 287 |
+
*
|
| 288 |
+
* @return string
|
| 289 |
+
*/
|
| 290 |
+
protected function _toHtml()
|
| 291 |
+
{
|
| 292 |
+
if (!$this->getTemplate()) {
|
| 293 |
+
return '';
|
| 294 |
+
}
|
| 295 |
+
$html = $this->renderView();
|
| 296 |
+
return $html;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
/**
|
| 300 |
+
* Get base url of the application
|
| 301 |
+
*
|
| 302 |
+
* @return string
|
| 303 |
+
*/
|
| 304 |
+
public function getBaseUrl()
|
| 305 |
+
{
|
| 306 |
+
if (!$this->_baseUrl) {
|
| 307 |
+
$this->_baseUrl = Mage::getBaseUrl();
|
| 308 |
+
}
|
| 309 |
+
return $this->_baseUrl;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
/**
|
| 313 |
+
* Get url of base javascript file
|
| 314 |
+
*
|
| 315 |
+
* To get url of skin javascript file use getSkinUrl()
|
| 316 |
+
*
|
| 317 |
+
* @param string $fileName
|
| 318 |
+
* @return string
|
| 319 |
+
*/
|
| 320 |
+
public function getJsUrl($fileName='')
|
| 321 |
+
{
|
| 322 |
+
if (!$this->_jsUrl) {
|
| 323 |
+
$this->_jsUrl = Mage::getBaseUrl('js');
|
| 324 |
+
}
|
| 325 |
+
return $this->_jsUrl.$fileName;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
/**
|
| 329 |
+
* Get data from specified object
|
| 330 |
+
*
|
| 331 |
+
* @param Varien_Object $object
|
| 332 |
+
* @param string $key
|
| 333 |
+
* @return mixed
|
| 334 |
+
*/
|
| 335 |
+
public function getObjectData(Varien_Object $object, $key)
|
| 336 |
+
{
|
| 337 |
+
return $object->getDataUsingMethod((string)$key);
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
/**
|
| 341 |
+
* Get cache key informative items
|
| 342 |
+
*
|
| 343 |
+
* @return array
|
| 344 |
+
*/
|
| 345 |
+
public function getCacheKeyInfo()
|
| 346 |
+
{
|
| 347 |
+
return array(
|
| 348 |
+
'BLOCK_TPL',
|
| 349 |
+
Mage::app()->getStore()->getCode(),
|
| 350 |
+
$this->getTemplateFile(),
|
| 351 |
+
'template' => $this->getTemplate()
|
| 352 |
+
);
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
/**
|
| 356 |
+
* Get is allowed symliks flag
|
| 357 |
+
*
|
| 358 |
+
* @return bool
|
| 359 |
+
*/
|
| 360 |
+
protected function _getAllowSymlinks()
|
| 361 |
+
{
|
| 362 |
+
if (is_null($this->_allowSymlinks)) {
|
| 363 |
+
$this->_allowSymlinks = Mage::getStoreConfigFlag(self::XML_PATH_TEMPLATE_ALLOW_SYMLINK);
|
| 364 |
+
}
|
| 365 |
+
return $this->_allowSymlinks;
|
| 366 |
+
}
|
| 367 |
+
}
|
app/code/local/MagePsycho/Easypathhints/Block/Easypathhints.php
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class MagePsycho_Easypathhints_Block_Easypathhints extends Mage_Core_Block_Template
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
}
|
app/code/local/MagePsycho/Easypathhints/Block/System/Config/Info.php
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category MagePsycho
|
| 4 |
+
* @package MagePsycho_Easypathhints
|
| 5 |
+
* @author magepsycho@gmail.com
|
| 6 |
+
* @website http://www.magepsycho.com
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 8 |
+
*/
|
| 9 |
+
class MagePsycho_Easypathhints_Block_System_Config_Info
|
| 10 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 11 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 12 |
+
{
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Render fieldset html
|
| 16 |
+
*
|
| 17 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 18 |
+
* @return string
|
| 19 |
+
*/
|
| 20 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 21 |
+
{
|
| 22 |
+
$html = '<div style="background:url(\'http://www.magepsycho.com/_logo.png\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
|
| 23 |
+
<h4>About MagePsycho</h4>
|
| 24 |
+
<p>A Professional Zend PHP5 Certified Developer / Freelancer with specialization in CMS + E-Commerce Solutions.<br />
|
| 25 |
+
View more extensions @ <a href="http://www.magentocommerce.com/magento-connect/developer/MagePsycho" target="_blank">MagentoConnect</a><br />
|
| 26 |
+
<a href="http://www.magepsycho.com/contacts" target="_blank">Request a Quote / Contact Us</a><br />
|
| 27 |
+
Skype me @ magentopycho<br />
|
| 28 |
+
Email me @ <a href="mailto:info@magepsycho.com">info@magepsycho.com</a><br />
|
| 29 |
+
Follow me on <a href="http://twitter.com/magepsycho" target="_blank">Twitter</a><br />
|
| 30 |
+
Visit my website: <a href="http://www.magepsycho.com" target="_blank">www.magespycho.com</a></p>
|
| 31 |
+
</div>';
|
| 32 |
+
|
| 33 |
+
return $html;
|
| 34 |
+
}
|
| 35 |
+
}
|
app/code/local/MagePsycho/Easypathhints/Helper/Data.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category MagePsycho
|
| 4 |
+
* @package MagePsycho_Easypathhints
|
| 5 |
+
* @author magepsycho@gmail.com
|
| 6 |
+
* @website http://www.magepsycho.com
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 8 |
+
*/
|
| 9 |
+
class MagePsycho_Easypathhints_Helper_Data extends Mage_Core_Helper_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function getConfig($field, $default = null){
|
| 12 |
+
$value = Mage::getStoreConfig('easypathhints/option/'.$field);
|
| 13 |
+
if(!isset($value) or trim($value) == ''){
|
| 14 |
+
return $default;
|
| 15 |
+
}else{
|
| 16 |
+
return $value;
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function log($data){
|
| 21 |
+
if(is_array($data) || is_object($data)){
|
| 22 |
+
$data = print_r($data, true);
|
| 23 |
+
}
|
| 24 |
+
Mage::log($data, null, 'easypathhints.log');
|
| 25 |
+
}
|
| 26 |
+
}
|
app/code/local/MagePsycho/Easypathhints/Model/Easypathhints.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category MagePsycho
|
| 4 |
+
* @package MagePsycho_Easypathhints
|
| 5 |
+
* @author magepsycho@gmail.com
|
| 6 |
+
* @website http://www.magepsycho.com
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 8 |
+
*/
|
| 9 |
+
class MagePsycho_Easypathhints_Model_Easypathhints extends Mage_Core_Model_Abstract
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
}
|
app/code/local/MagePsycho/Easypathhints/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category MagePsycho
|
| 4 |
+
* @package MagePsycho_Easypathhints
|
| 5 |
+
* @author magepsycho@gmail.com
|
| 6 |
+
* @website http://www.magepsycho.com
|
| 7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 8 |
+
*/
|
| 9 |
+
class MagePsycho_Easypathhints_IndexController extends Mage_Core_Controller_Front_Action
|
| 10 |
+
{
|
| 11 |
+
public function indexAction()
|
| 12 |
+
{
|
| 13 |
+
//create a groups array that has the value we want at the rigth location
|
| 14 |
+
$groups_value = array();
|
| 15 |
+
$groups_value['debug']['fields']['template_hints']['value'] = 1;
|
| 16 |
+
$groups_value['debug']['fields']['template_hints_blocks']['value'] = 1;
|
| 17 |
+
|
| 18 |
+
$website = $this->getRequest()->getParam('website');
|
| 19 |
+
$store = $this->getRequest()->getParam('store');
|
| 20 |
+
Mage::getModel('adminhtml/config_data')
|
| 21 |
+
->setSection('dev')
|
| 22 |
+
->setWebsite($website)
|
| 23 |
+
->setStore($store)
|
| 24 |
+
->setGroups($groups_value)
|
| 25 |
+
->save();
|
| 26 |
+
Mage::getConfig()->reinit();
|
| 27 |
+
Mage::app()->reinitStores();
|
| 28 |
+
}
|
| 29 |
+
}
|
app/code/local/MagePsycho/Easypathhints/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* @category MagePsycho
|
| 5 |
+
* @package MagePsycho_Storerestrictionpro
|
| 6 |
+
* @author info@magepsycho.com
|
| 7 |
+
* @website http://www.magepsycho.com
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
<config>
|
| 12 |
+
<acl>
|
| 13 |
+
<resources>
|
| 14 |
+
<admin>
|
| 15 |
+
<children>
|
| 16 |
+
<system>
|
| 17 |
+
<children>
|
| 18 |
+
<config>
|
| 19 |
+
<children>
|
| 20 |
+
<magepychoinfo>
|
| 21 |
+
<title>MagePsycho - All</title>
|
| 22 |
+
</magepychoinfo>
|
| 23 |
+
<easypathhints>
|
| 24 |
+
<title>Easy Path Hints Area</title>
|
| 25 |
+
</easypathhints>
|
| 26 |
+
</children>
|
| 27 |
+
</config>
|
| 28 |
+
</children>
|
| 29 |
+
</system>
|
| 30 |
+
</children>
|
| 31 |
+
</admin>
|
| 32 |
+
</resources>
|
| 33 |
+
</acl>
|
| 34 |
+
</config>
|
app/code/local/MagePsycho/Easypathhints/etc/config.xml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* @category MagePsycho
|
| 5 |
+
* @package MagePsycho_Easypathhints
|
| 6 |
+
* @author info@magepsycho.com
|
| 7 |
+
* @website http://www.magepsycho.com
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
<config>
|
| 12 |
+
<modules>
|
| 13 |
+
<MagePsycho_Easypathhints>
|
| 14 |
+
<version>0.1.0</version>
|
| 15 |
+
</MagePsycho_Easypathhints>
|
| 16 |
+
</modules>
|
| 17 |
+
<global>
|
| 18 |
+
<models>
|
| 19 |
+
<easypathhints>
|
| 20 |
+
<class>MagePsycho_Easypathhints_Model</class>
|
| 21 |
+
</easypathhints>
|
| 22 |
+
</models>
|
| 23 |
+
<blocks>
|
| 24 |
+
<easypathhints>
|
| 25 |
+
<class>MagePsycho_Easypathhints_Block</class>
|
| 26 |
+
</easypathhints>
|
| 27 |
+
<core>
|
| 28 |
+
<rewrite>
|
| 29 |
+
<template>MagePsycho_Easypathhints_Block_Template</template>
|
| 30 |
+
</rewrite>
|
| 31 |
+
</core>
|
| 32 |
+
</blocks>
|
| 33 |
+
<helpers>
|
| 34 |
+
<easypathhints>
|
| 35 |
+
<class>MagePsycho_Easypathhints_Helper</class>
|
| 36 |
+
</easypathhints>
|
| 37 |
+
</helpers>
|
| 38 |
+
</global>
|
| 39 |
+
<frontend>
|
| 40 |
+
<routers>
|
| 41 |
+
<easypathhints>
|
| 42 |
+
<use>standard</use>
|
| 43 |
+
<args>
|
| 44 |
+
<module>MagePsycho_Easypathhints</module>
|
| 45 |
+
<frontName>easypathhints</frontName>
|
| 46 |
+
</args>
|
| 47 |
+
</easypathhints>
|
| 48 |
+
</routers>
|
| 49 |
+
</frontend>
|
| 50 |
+
<adminhtml>
|
| 51 |
+
<acl>
|
| 52 |
+
<resources>
|
| 53 |
+
<admin>
|
| 54 |
+
<children>
|
| 55 |
+
<system>
|
| 56 |
+
<children>
|
| 57 |
+
<config>
|
| 58 |
+
<children>
|
| 59 |
+
<magepychoinfo>
|
| 60 |
+
<title>MagePsycho - All</title>
|
| 61 |
+
</magepychoinfo>
|
| 62 |
+
<easypathhints>
|
| 63 |
+
<title>Easy Path Hints Area</title>
|
| 64 |
+
</easypathhints>
|
| 65 |
+
</children>
|
| 66 |
+
</config>
|
| 67 |
+
</children>
|
| 68 |
+
</system>
|
| 69 |
+
</children>
|
| 70 |
+
</admin>
|
| 71 |
+
</resources>
|
| 72 |
+
</acl>
|
| 73 |
+
</adminhtml>
|
| 74 |
+
<default>
|
| 75 |
+
<easypathhints>
|
| 76 |
+
<option>
|
| 77 |
+
<active>1</active>
|
| 78 |
+
<code>magento</code>
|
| 79 |
+
</option>
|
| 80 |
+
</easypathhints>
|
| 81 |
+
</default>
|
| 82 |
+
</config>
|
app/code/local/MagePsycho/Easypathhints/etc/system.xml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* @category MagePsycho
|
| 5 |
+
* @package MagePsycho_Easypathhints
|
| 6 |
+
* @author info@magepsycho.com
|
| 7 |
+
* @website http://www.magepsycho.com
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
<config>
|
| 12 |
+
<tabs>
|
| 13 |
+
<magepychoall translate="label" module="easypathhints">
|
| 14 |
+
<label>MagePsycho Extensions</label>
|
| 15 |
+
<sort_order>400</sort_order>
|
| 16 |
+
</magepychoall>
|
| 17 |
+
</tabs>
|
| 18 |
+
<sections>
|
| 19 |
+
<magepychoinfo translate="label" module="easypathhints">
|
| 20 |
+
<label>Info</label>
|
| 21 |
+
<tab>magepychoall</tab>
|
| 22 |
+
<frontend_type>text</frontend_type>
|
| 23 |
+
<sort_order>99999999999</sort_order>
|
| 24 |
+
<show_in_default>1</show_in_default>
|
| 25 |
+
<show_in_website>1</show_in_website>
|
| 26 |
+
<show_in_store>1</show_in_store>
|
| 27 |
+
<groups>
|
| 28 |
+
<info>
|
| 29 |
+
<frontend_model>easypathhints/system_config_info</frontend_model>
|
| 30 |
+
<sort_order>10</sort_order>
|
| 31 |
+
<show_in_default>1</show_in_default>
|
| 32 |
+
<show_in_website>1</show_in_website>
|
| 33 |
+
<show_in_store>1</show_in_store>
|
| 34 |
+
</info>
|
| 35 |
+
</groups>
|
| 36 |
+
</magepychoinfo>
|
| 37 |
+
|
| 38 |
+
<easypathhints module="easypathhints">
|
| 39 |
+
<label>Easy Template Path Hints</label>
|
| 40 |
+
<tab>magepychoall</tab>
|
| 41 |
+
<frontend_type>text</frontend_type>
|
| 42 |
+
<sort_order>1200</sort_order>
|
| 43 |
+
<show_in_default>1</show_in_default>
|
| 44 |
+
<show_in_website>1</show_in_website>
|
| 45 |
+
<show_in_store>1</show_in_store>
|
| 46 |
+
<groups>
|
| 47 |
+
<option translate="label">
|
| 48 |
+
<label>General Settings</label>
|
| 49 |
+
<frontend_type>text</frontend_type>
|
| 50 |
+
<sort_order>10</sort_order>
|
| 51 |
+
<show_in_default>1</show_in_default>
|
| 52 |
+
<show_in_website>1</show_in_website>
|
| 53 |
+
<show_in_store>1</show_in_store>
|
| 54 |
+
<fields>
|
| 55 |
+
<active translate="label">
|
| 56 |
+
<label>Enabled</label>
|
| 57 |
+
<frontend_type>select</frontend_type>
|
| 58 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 59 |
+
<sort_order>10</sort_order>
|
| 60 |
+
<show_in_default>1</show_in_default>
|
| 61 |
+
<show_in_website>1</show_in_website>
|
| 62 |
+
<show_in_store>1</show_in_store>
|
| 63 |
+
</active>
|
| 64 |
+
<code translate="label">
|
| 65 |
+
<label>Access Code</label>
|
| 66 |
+
<frontend_type>text</frontend_type>
|
| 67 |
+
<sort_order>20</sort_order>
|
| 68 |
+
<show_in_default>1</show_in_default>
|
| 69 |
+
<show_in_website>1</show_in_website>
|
| 70 |
+
<show_in_store>1</show_in_store>
|
| 71 |
+
<comment><![CDATA[If access code is used then you need to add query string as:<br />http://magento-url/any-page<strong>?tp=1&code=code-entered-above</strong> in order to turn on the template path hints. Else you can simply use <strong>?tp=1</strong>.<br /> Note that this technique works well both for frontend and admin part.]]></comment>
|
| 72 |
+
</code>
|
| 73 |
+
</fields>
|
| 74 |
+
</option>
|
| 75 |
+
</groups>
|
| 76 |
+
</easypathhints>
|
| 77 |
+
</sections>
|
| 78 |
+
</config>
|
app/etc/modules/MagePsycho_Easypathhints.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* @category MagePsycho
|
| 5 |
+
* @package MagePsycho_Easypathhints
|
| 6 |
+
* @author info@magepsycho.com
|
| 7 |
+
* @website http://www.magepsycho.com
|
| 8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
<config>
|
| 12 |
+
<modules>
|
| 13 |
+
<MagePsycho_Easypathhints>
|
| 14 |
+
<active>true</active>
|
| 15 |
+
<codePool>local</codePool>
|
| 16 |
+
</MagePsycho_Easypathhints>
|
| 17 |
+
</modules>
|
| 18 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Easy_Template_Path_Hints</name>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Easy Template Path Hints extension is used to turn on the template path hints for frontend</summary>
|
| 10 |
+
<description>Easy Template Path Hints extension is used to turn on the template path hints for frontend</description>
|
| 11 |
+
<notes>- Upgrade Proof Module.<br />
|
| 12 |
+
- Tested for Magento version 1.3.2.4 - 1.6.0.0<br />
|
| 13 |
+
- Easy to install</notes>
|
| 14 |
+
<authors><author><name>MagePsycho</name><user>auto-converted</user><email>rajen_k_bhtt@hotmail.com</email></author></authors>
|
| 15 |
+
<date>2011-09-05</date>
|
| 16 |
+
<time>11:06:20</time>
|
| 17 |
+
<contents><target name="magelocal"><dir name="MagePsycho"><dir name="Easypathhints"><dir name="Block"><dir name="System"><dir name="Config"><file name="Info.php" hash="541b37aa5dcff6158f57b5739da9daf8"/></dir></dir><file name="Easypathhints.php" hash="381199984579583785f0d7a69d487a63"/></dir><dir name="Helper"><file name="Data.php" hash="304cfe70948c0735e6379df029c36ce2"/></dir><dir name="Model"><file name="Easypathhints.php" hash="c4dfd676133eb413d6191f43c17e008f"/></dir><dir name="controllers"><file name="IndexController.php" hash="6e81d09bbf332a458d9e9de104f9ac33"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8da089ff158017163228bab689b3e992"/><file name="config.xml" hash="dc42bcf895b4296e4ebc2d873ba2252b"/><file name="system.xml" hash="6477a7d85c3ae053e8c8670f087e6930"/></dir></dir></dir><dir name="Mage"><dir name="Core"><dir name="Block"><file name="Template.php" hash="e4d0040d0c01528ca9b7ac99e76953d9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MagePsycho_Easypathhints.xml" hash="f758539550c2ed5c83e195eaa7c244a2"/></dir></target></contents>
|
| 18 |
+
<compatible/>
|
| 19 |
+
<dependencies/>
|
| 20 |
+
</package>
|
