Version Notes
Version 0.1.0
Download this release
Release Info
Developer | Magento Core Team |
Extension | Magedebugger |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Magestore/Magedebuger/Block/Adminhtml/Magedebuger.php +20 -0
- app/code/local/Magestore/Magedebuger/Block/Magedebuger.php +16 -0
- app/code/local/Magestore/Magedebuger/Helper/Data.php +42 -0
- app/code/local/Magestore/Magedebuger/Model/File.php +90 -0
- app/code/local/Magestore/Magedebuger/Model/Magedebuger.php +95 -0
- app/code/local/Magestore/Magedebuger/Model/Session.php +6 -0
- app/code/local/Magestore/Magedebuger/controllers/Adminhtml/MagedebugerController.php +33 -0
- app/code/local/Magestore/Magedebuger/controllers/IndexController.php +32 -0
- app/code/local/Magestore/Magedebuger/etc/config.xml +119 -0
- app/code/local/Magestore/Magedebuger/etc/system.xml +41 -0
- app/design/adminhtml/default/default/layout/magedebuger.xml +8 -0
- app/design/adminhtml/default/default/template/magedebuger/magedebuger.phtml +57 -0
- app/design/frontend/default/default/layout/magedebuger.xml +18 -0
- app/design/frontend/default/default/template/magedebuger/magedebuger.phtml +70 -0
- app/etc/modules/Magestore_Magedebuger.xml +9 -0
- package.xml +24 -0
- skin/frontend/default/default/css/magestore/magedebuger.css +67 -0
app/code/local/Magestore/Magedebuger/Block/Adminhtml/Magedebuger.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magestore_Magedebuger_Block_Adminhtml_Magedebuger extends Mage_Adminhtml_Block_Widget_Form
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
parent::_prepareLayout();
|
7 |
+
$this->setTemplate('magedebuger/magedebuger.phtml');
|
8 |
+
return $this;
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getBugFiles()
|
12 |
+
{
|
13 |
+
if (!$this->hasData('bug_files')) {
|
14 |
+
$bug_files = Mage::getModel('magedebuger/file')
|
15 |
+
->getBugFiles();
|
16 |
+
$this->setData('bug_files', $bug_files);
|
17 |
+
}
|
18 |
+
return $this->getData('bug_files');
|
19 |
+
}
|
20 |
+
}
|
app/code/local/Magestore/Magedebuger/Block/Magedebuger.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magestore_Magedebuger_Block_Magedebuger extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getMageBugs()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('magebugs')) {
|
12 |
+
$this->setData('magebugs', Mage::registry('magebugs'));
|
13 |
+
}
|
14 |
+
return $this->getData('magebugs');
|
15 |
+
}
|
16 |
+
}
|
app/code/local/Magestore/Magedebuger/Helper/Data.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Magestore_Magedebuger_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getIpAddress()
|
6 |
+
{
|
7 |
+
return $_SERVER['REMOTE_ADDR'];
|
8 |
+
}
|
9 |
+
|
10 |
+
public function is_allowedIP()
|
11 |
+
{
|
12 |
+
$allowed_ips = Mage::getStoreConfig('magedebuger/general/allowed_ips');
|
13 |
+
$allowed_ips = explode(',',$allowed_ips);
|
14 |
+
if(!count($allowed_ips))
|
15 |
+
return false;
|
16 |
+
$ip = $this->getIpAddress();
|
17 |
+
if(in_array($ip,$allowed_ips))
|
18 |
+
return true;
|
19 |
+
else
|
20 |
+
return false;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function var_dump($value,$name=null)
|
24 |
+
{
|
25 |
+
Mage::getSingleton('magedebuger/magedebuger')->call('var_dump',$value,$name);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function print_r($value,$name=null)
|
29 |
+
{
|
30 |
+
Mage::getSingleton('magedebuger/magedebuger')->call('print_r',$value,$name);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function echo_m($value,$name=null)
|
34 |
+
{
|
35 |
+
Mage::getSingleton('magedebuger/magedebuger')->call('echo',$value,$name);
|
36 |
+
}
|
37 |
+
|
38 |
+
public function print_m($value,$name=null)
|
39 |
+
{
|
40 |
+
Mage::getSingleton('magedebuger/magedebuger')->call('print',$value,$name);
|
41 |
+
}
|
42 |
+
}
|
app/code/local/Magestore/Magedebuger/Model/File.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Magestore_Magedebuger_Model_File extends Varien_Object{
|
4 |
+
|
5 |
+
private $_file = null;
|
6 |
+
private $_filepath = null;
|
7 |
+
|
8 |
+
public function open($fileId,$mode = 'w')
|
9 |
+
{
|
10 |
+
$this->_createFolder();
|
11 |
+
$this->_filepath = $this->_getFolder().DS.$fileId.".mbg";
|
12 |
+
$this->_file = fopen($this->_filepath,$mode);
|
13 |
+
return $this;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function save($content)
|
17 |
+
{
|
18 |
+
if(!$this->_file)
|
19 |
+
return $this;
|
20 |
+
try{
|
21 |
+
fwrite($this->_file,$content);
|
22 |
+
return $this;
|
23 |
+
} catch(Exception $e){
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getContent()
|
29 |
+
{
|
30 |
+
if(!$this->_file)
|
31 |
+
return $this;
|
32 |
+
try{
|
33 |
+
$contents = file_get_contents($this->_filepath);
|
34 |
+
return $contents;
|
35 |
+
} catch(Exception $e){
|
36 |
+
return null;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function close()
|
41 |
+
{
|
42 |
+
if($this->_file)
|
43 |
+
fclose($this->_file);
|
44 |
+
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getBugFiles()
|
49 |
+
{
|
50 |
+
return $this->_readdir($this->_getFolder());
|
51 |
+
}
|
52 |
+
|
53 |
+
protected function _readdir($dir)
|
54 |
+
{
|
55 |
+
$files = array();
|
56 |
+
if(!is_dir($dir))
|
57 |
+
return $files;
|
58 |
+
foreach( scandir( $dir ) as $item ){
|
59 |
+
if( !strcmp( $item, '.' ) || !strcmp( $item, '..' ) )
|
60 |
+
continue;
|
61 |
+
$size = filesize($dir.DS.$item);
|
62 |
+
$files[] = new Varien_Object(array('name'=>$item,'size'=>$size));
|
63 |
+
}
|
64 |
+
return $files;
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function _createFolder()
|
68 |
+
{
|
69 |
+
if(!is_dir($this->_getFolder()))
|
70 |
+
{
|
71 |
+
try{
|
72 |
+
mkdir($this->_getFolder());
|
73 |
+
chmod($this->_getFolder(),0755);
|
74 |
+
return true;
|
75 |
+
}catch(Exception $e){
|
76 |
+
return false;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _getFolder()
|
82 |
+
{
|
83 |
+
if(!$this->getData('folder'))
|
84 |
+
{
|
85 |
+
$folder = Mage::getBaseDir('var').DS.'magedebuger';
|
86 |
+
$this->setData('folder',$folder);
|
87 |
+
}
|
88 |
+
return $this->getData('folder');
|
89 |
+
}
|
90 |
+
}
|
app/code/local/Magestore/Magedebuger/Model/Magedebuger.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Magestore_Magedebuger_Model_Magedebuger extends Varien_Object
|
4 |
+
{
|
5 |
+
public function var_dump($value,$name=null)
|
6 |
+
{
|
7 |
+
$this->call('var_dump',$value,$name);
|
8 |
+
}
|
9 |
+
|
10 |
+
public function print_r($value,$name=null)
|
11 |
+
{
|
12 |
+
$this->call('print_r',$value,$name);
|
13 |
+
}
|
14 |
+
|
15 |
+
public function echo_m($value,$name=null)
|
16 |
+
{
|
17 |
+
$this->call('echo',$value,$name);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function print_m($value,$name=null)
|
21 |
+
{
|
22 |
+
$this->call('print',$value,$name);
|
23 |
+
}
|
24 |
+
|
25 |
+
public function call($fval,$value,$name=null)
|
26 |
+
{
|
27 |
+
if(!Mage::helper('magedebuger')->is_allowedIP())
|
28 |
+
return $this;
|
29 |
+
$this->save($fval,$value,$name);
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getBugSession()
|
34 |
+
{
|
35 |
+
if(!Mage::getSingleton('magedebuger/session')->getData('bug_session'))
|
36 |
+
{
|
37 |
+
$bug_session = Mage::helper('magedebuger')->getIpAddress();
|
38 |
+
$bug_session .= '_'.md5(time());
|
39 |
+
Mage::getSingleton('magedebuger/session')->setData('bug_session',$bug_session);
|
40 |
+
}
|
41 |
+
return Mage::getSingleton('magedebuger/session')->getData('bug_session');
|
42 |
+
}
|
43 |
+
|
44 |
+
public function loadBugs($params = array())
|
45 |
+
{
|
46 |
+
$bug_session = Mage::getSingleton('magedebuger/session')
|
47 |
+
->getData('bug_session');
|
48 |
+
if(!$bug_session)
|
49 |
+
return array();
|
50 |
+
$file = Mage::getModel('magedebuger/file');
|
51 |
+
$file->open($bug_session,'a');
|
52 |
+
$serialized_bug = $file->getContent();
|
53 |
+
$file->close();
|
54 |
+
return $this->_parse($serialized_bug);
|
55 |
+
}
|
56 |
+
|
57 |
+
public function clear()
|
58 |
+
{
|
59 |
+
$bug_session = Mage::getSingleton('magedebuger/session')
|
60 |
+
->getData('bug_session');
|
61 |
+
if(!$bug_session)
|
62 |
+
return $this;
|
63 |
+
$file = Mage::getModel('magedebuger/file');
|
64 |
+
$file->open($bug_session,'w');
|
65 |
+
$file->save(null);
|
66 |
+
$file->close();
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function save($fval,$value,$name=null)
|
71 |
+
{
|
72 |
+
$serialized_value = serialize($value);
|
73 |
+
$bug = $fval."****".$serialized_value."****".$name."\n";
|
74 |
+
$file = Mage::getModel('magedebuger/file');
|
75 |
+
$file->open($this->getBugSession(),'a');
|
76 |
+
$file->save($bug);
|
77 |
+
$file->close();
|
78 |
+
return $this;
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _parse($serialized_bug)
|
82 |
+
{
|
83 |
+
$bugs = array();
|
84 |
+
$bugArr = explode("\n",$serialized_bug);
|
85 |
+
if(! count($bugArr))
|
86 |
+
return $this;
|
87 |
+
|
88 |
+
$i = 0;
|
89 |
+
foreach($bugArr as $bug)
|
90 |
+
{
|
91 |
+
$bugs[$i++] = explode('****',$bug);
|
92 |
+
}
|
93 |
+
return $bugs;
|
94 |
+
}
|
95 |
+
}
|
app/code/local/Magestore/Magedebuger/Model/Session.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Magestore_Magedebuger_Model_Session extends Mage_Core_Model_Session
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Magestore/Magedebuger/controllers/Adminhtml/MagedebugerController.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Magestore_Magedebuger_Adminhtml_MagedebugerController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected function _initAction() {
|
6 |
+
$this->loadLayout()
|
7 |
+
->_setActiveMenu('system/magedebuger')
|
8 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Cache Magebugs'), Mage::helper('adminhtml')->__('Cache Magebugs'));
|
9 |
+
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function indexAction() {
|
14 |
+
$this->_initAction()
|
15 |
+
->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function clearAction()
|
19 |
+
{
|
20 |
+
$cache_path = Mage::getBaseDir('var').DS.'magedebuger';
|
21 |
+
$ioFile = new Varien_Io_File();
|
22 |
+
try{
|
23 |
+
$ioFile->rmdir($cache_path,true);
|
24 |
+
Mage::getSingleton('core/session')
|
25 |
+
->addSuccess(Mage::helper('adminhtml')->__('removed successful'));
|
26 |
+
$this->_redirect('*/*/index');
|
27 |
+
} catch(Exception $e){
|
28 |
+
Mage::getSingleton('core/session')
|
29 |
+
->addSuccess(Mage::helper('adminhtml')->__('removed failed'));
|
30 |
+
$this->_redirect('*/*/index');
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
app/code/local/Magestore/Magedebuger/controllers/IndexController.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magestore_Magedebuger_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
if(!Mage::helper('magedebuger')->is_allowedIP())
|
7 |
+
{
|
8 |
+
$this->_redirect('');
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
|
12 |
+
$debugger = Mage::getModel('magedebuger/magedebuger');
|
13 |
+
|
14 |
+
$magebugs = $debugger->loadBugs();
|
15 |
+
|
16 |
+
Mage::register('magebugs',$magebugs);
|
17 |
+
|
18 |
+
$this->loadLayout();
|
19 |
+
$this->renderLayout();
|
20 |
+
}
|
21 |
+
|
22 |
+
public function clearAction()
|
23 |
+
{
|
24 |
+
if(!Mage::helper('magedebuger')->is_allowedIP())
|
25 |
+
{
|
26 |
+
$this->_redirect('');
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
Mage::getModel('magedebuger/magedebuger')->clear();
|
30 |
+
$this->_redirect('*/*/index',array());
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Magestore/Magedebuger/etc/config.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magestore_Magedebuger>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Magestore_Magedebuger>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<magedebuger>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Magestore_Magedebuger</module>
|
14 |
+
<frontName>magedebugger</frontName>
|
15 |
+
</args>
|
16 |
+
</magedebuger>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<magedebuger>
|
21 |
+
<file>magedebuger.xml</file>
|
22 |
+
</magedebuger>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<magedebuger>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Magestore_Magedebuger</module>
|
32 |
+
<frontName>magedebuger</frontName>
|
33 |
+
</args>
|
34 |
+
</magedebuger>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<system>
|
40 |
+
<children>
|
41 |
+
<magedebuger module="magedebuger">
|
42 |
+
<title>Magebugger Cache</title>
|
43 |
+
<sort_order>100</sort_order>
|
44 |
+
<action>magedebuger/adminhtml_magedebuger</action>
|
45 |
+
</magedebuger>
|
46 |
+
</children>
|
47 |
+
</system>
|
48 |
+
</menu>
|
49 |
+
<acl>
|
50 |
+
<resources>
|
51 |
+
<all>
|
52 |
+
<title>Allow Everything</title>
|
53 |
+
</all>
|
54 |
+
<admin>
|
55 |
+
<children>
|
56 |
+
<Magestore_Magedebuger>
|
57 |
+
<title>Magedebugger Module</title>
|
58 |
+
<sort_order>10</sort_order>
|
59 |
+
</Magestore_Magedebuger>
|
60 |
+
</children>
|
61 |
+
</admin>
|
62 |
+
</resources>
|
63 |
+
</acl>
|
64 |
+
<acl>
|
65 |
+
<resources>
|
66 |
+
<all>
|
67 |
+
<title>Allow Everything</title>
|
68 |
+
</all>
|
69 |
+
<admin>
|
70 |
+
<children>
|
71 |
+
<system>
|
72 |
+
<children>
|
73 |
+
<config>
|
74 |
+
<children>
|
75 |
+
<magedebuger translate="title" module="magedebuger">
|
76 |
+
<title>Magede bugger</title>
|
77 |
+
<sort_order>50</sort_order>
|
78 |
+
</magedebuger>
|
79 |
+
</children>
|
80 |
+
</config>
|
81 |
+
</children>
|
82 |
+
</system>
|
83 |
+
</children>
|
84 |
+
</admin>
|
85 |
+
</resources>
|
86 |
+
</acl>
|
87 |
+
<layout>
|
88 |
+
<updates>
|
89 |
+
<magedebuger>
|
90 |
+
<file>magedebuger.xml</file>
|
91 |
+
</magedebuger>
|
92 |
+
</updates>
|
93 |
+
</layout>
|
94 |
+
</adminhtml>
|
95 |
+
<global>
|
96 |
+
<models>
|
97 |
+
<magedebuger>
|
98 |
+
<class>Magestore_Magedebuger_Model</class>
|
99 |
+
</magedebuger>
|
100 |
+
</models>
|
101 |
+
<blocks>
|
102 |
+
<magedebuger>
|
103 |
+
<class>Magestore_Magedebuger_Block</class>
|
104 |
+
</magedebuger>
|
105 |
+
</blocks>
|
106 |
+
<helpers>
|
107 |
+
<magedebuger>
|
108 |
+
<class>Magestore_Magedebuger_Helper</class>
|
109 |
+
</magedebuger>
|
110 |
+
</helpers>
|
111 |
+
</global>
|
112 |
+
<default>
|
113 |
+
<magedebuger>
|
114 |
+
<general>
|
115 |
+
<allowed_ips>127.0.0.1,127.0.0.1</allowed_ips>
|
116 |
+
</general>
|
117 |
+
</magedebuger>
|
118 |
+
</default>
|
119 |
+
</config>
|
app/code/local/Magestore/Magedebuger/etc/system.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<magestore translate="label">
|
5 |
+
<label>Magestore Extension</label>
|
6 |
+
<sort_order>400</sort_order>
|
7 |
+
</magestore>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<magedebuger translate="label" module="magedebuger">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>Mage debugger</label>
|
13 |
+
<tab>magestore</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>299</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<general translate="label">
|
21 |
+
<label>General Infomation</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>1</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 |
+
<fields>
|
28 |
+
<allowed_ips translate="label">
|
29 |
+
<label>Allowed IP Address</label>
|
30 |
+
<frontend_type>textarea</frontend_type>
|
31 |
+
<sort_order>0</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</allowed_ips>
|
36 |
+
</fields>
|
37 |
+
</general>
|
38 |
+
</groups>
|
39 |
+
</magedebuger>
|
40 |
+
</sections>
|
41 |
+
</config>
|
app/design/adminhtml/default/default/layout/magedebuger.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<magedebuger_adminhtml_magedebuger_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="magedebuger/adminhtml_magedebuger" name="magedebuger" />
|
6 |
+
</reference>
|
7 |
+
</magedebuger_adminhtml_magedebuger_index>
|
8 |
+
</layout>
|
app/design/adminhtml/default/default/template/magedebuger/magedebuger.phtml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php $bugFiles = $this->getBugFiles() ?>
|
3 |
+
<div class="entry-edit">
|
4 |
+
<div class="entry-edit-head">
|
5 |
+
<h4 class="icon-head head-account"><?php echo $this->__('Magebugger Cache Information')?></h4>
|
6 |
+
</div>
|
7 |
+
<div class="fieldset">
|
8 |
+
<table class="magebug-files-bound" ><tr><td>
|
9 |
+
<div id="magebug-files">
|
10 |
+
<?php if(count($bugFiles)):?>
|
11 |
+
<table class="magebug-files" cellpadding="0" cellspacing="0" >
|
12 |
+
<tr><th class="title"><?php echo $this->__('File Name')?></th>
|
13 |
+
<th class="value"><?php echo $this->__('Size')?></th></tr>
|
14 |
+
<?php foreach($bugFiles as $file): ?>
|
15 |
+
<tr><td class="title"><?php echo $file->getName() ?></td>
|
16 |
+
<td class="value"><?php echo $file->getSize() ?></td></tr>
|
17 |
+
<?php endforeach; ?>
|
18 |
+
</table>
|
19 |
+
<?php else: ?>
|
20 |
+
<div class="notice-msg" style="width:600px;font-weight:bold;padding:5px 20px 5px 50px;margin:0 0 10px 0;">
|
21 |
+
<?php echo $this->__('There are no bugs cache.') ?>
|
22 |
+
</div>
|
23 |
+
<?php endif; ?>
|
24 |
+
</div>
|
25 |
+
</td></tr>
|
26 |
+
<tr><td>
|
27 |
+
<form action="<?php echo $this->getUrl('*/*/clear') ?>" method="post" >
|
28 |
+
<button type="submit" >
|
29 |
+
<span>Clear Magebug Cache</span>
|
30 |
+
</button>
|
31 |
+
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey()?>" />
|
32 |
+
</form>
|
33 |
+
</td></tr>
|
34 |
+
</table>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
<style>
|
38 |
+
.magebug-files-bound{
|
39 |
+
margin:0 0 0 150px;
|
40 |
+
}
|
41 |
+
#magebug-files table.magebug-files{
|
42 |
+
width:600px;
|
43 |
+
margin:10px 0 10px 0;
|
44 |
+
border-top:1px solid #7f7f7f;
|
45 |
+
border-left:1px solid #7f7f7f;
|
46 |
+
}
|
47 |
+
.magebug-files th{
|
48 |
+
padding:5px 20px 5px 20px;
|
49 |
+
}
|
50 |
+
.magebug-files td{
|
51 |
+
padding:2px 20px 2px 20px;
|
52 |
+
}
|
53 |
+
.magebug-files th, .magebug-files td{
|
54 |
+
border-bottom:1px solid #7f7f7f;
|
55 |
+
border-right:1px solid #7f7f7f;
|
56 |
+
}
|
57 |
+
</style>
|
app/design/frontend/default/default/layout/magedebuger.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addCss"><styleSheet>css/magestore/magedebuger.css</styleSheet></action>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
<magedebuger_index_index>
|
9 |
+
<remove name="header"/>
|
10 |
+
<remove name="footer"/>
|
11 |
+
<reference name="root">
|
12 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
13 |
+
</reference>
|
14 |
+
<reference name="content">
|
15 |
+
<block type="magedebuger/magedebuger" name="magedebug" template="magedebuger/magedebuger.phtml" />
|
16 |
+
</reference>
|
17 |
+
</magedebuger_index_index>
|
18 |
+
</layout>
|
app/design/frontend/default/default/template/magedebuger/magedebuger.phtml
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php $magebugs = $this->getMageBugs() ?>
|
3 |
+
<div id="magebugs">
|
4 |
+
<h2><?php echo $this->__('Mage Debugger')?></h2>
|
5 |
+
<?php if(!count($magebugs)):?>
|
6 |
+
<div class="note-msg">
|
7 |
+
<?php echo $this->__('The debug content is empty now.') ?>
|
8 |
+
</div>
|
9 |
+
<?php else: ?>
|
10 |
+
<table cellpadding="0" cellspacing="0">
|
11 |
+
<tr>
|
12 |
+
<th class="num"><?php echo $this->__('No')?></th>
|
13 |
+
<th class="title"><?php echo $this->__('Variable Name') ?></th>
|
14 |
+
<th class="value"><?php echo $this->__('Debug Value') ?></th>
|
15 |
+
</tr>
|
16 |
+
<?php $i=0 ?>
|
17 |
+
<?php for($j=count($magebugs);$j>0;$j--): ?>
|
18 |
+
<?php $bug = $magebugs[$j-1] ?>
|
19 |
+
<?php if(isset($bug[0]) && isset($bug[1])):?>
|
20 |
+
<?php $var_name = isset($bug[2]) ? $bug[2] : 'var' ?>
|
21 |
+
<?php $fval = $bug[0] ?>
|
22 |
+
<?php $value = unserialize($bug[1])?>
|
23 |
+
<?php $i++ ?>
|
24 |
+
<tr>
|
25 |
+
<td class="num"><?php echo $j?></td>
|
26 |
+
<td class="title"><?php echo $var_name?></td>
|
27 |
+
<td class="value">
|
28 |
+
<?php switch($fval) {
|
29 |
+
case 'var_dump':
|
30 |
+
var_dump($value);
|
31 |
+
break;
|
32 |
+
case 'echo':
|
33 |
+
echo($value);
|
34 |
+
break;
|
35 |
+
case 'print':
|
36 |
+
print($value);
|
37 |
+
break;
|
38 |
+
case 'print_r':
|
39 |
+
print_r($value);
|
40 |
+
break;
|
41 |
+
default:
|
42 |
+
var_dump($value);
|
43 |
+
} ?>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
<?php endif; ?>
|
47 |
+
<?php endfor; ?>
|
48 |
+
</table>
|
49 |
+
|
50 |
+
<?php endif;?>
|
51 |
+
<div id="bound-button-clear-magebug">
|
52 |
+
<span><a href="<?php echo $this->getUrl('*/*/clear',array())?>">
|
53 |
+
<button type="button" class="form-button button">
|
54 |
+
<span><?php echo $this->__('Clear')?></span></a>
|
55 |
+
</button>
|
56 |
+
</a></span>
|
57 |
+
<span>
|
58 |
+
<a href="<?php echo $this->getUrl('*/*/*',array())?>">
|
59 |
+
<button type="button" class="form-button button">
|
60 |
+
<span><?php echo $this->__('Refresh')?></span></a>
|
61 |
+
</button>
|
62 |
+
</a><span>
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
<div id="magestore-power">
|
66 |
+
<div class="magestore-line right"> </div>
|
67 |
+
<div class="clear fix"> </div>
|
68 |
+
<span><?php echo $this->__('Power by')?></span>
|
69 |
+
<a href="http://www.magestore.com" target="_blank" >Magestore</a>
|
70 |
+
</div>
|
app/etc/modules/Magestore_Magedebuger.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magestore_Magedebuger>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Magestore_Magedebuger>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Magedebugger</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>Our developers sometimes fell crazy when debug on customer live store. It's very hard to debug in silence. Now our Mage Debugger extension is a real magic. You can debug and see the result in your own screen, not the screen of store.</summary>
|
10 |
+
<description>Our developers sometimes fell crazy when debug on customer live store. It's very hard to debug in silence. Now our Mage Debugger extension is a real magic. You can debug and see the result in your own screen, not the screen of store.
|
11 |
+
|
12 |
+
Features:
|
13 |
+
+ Easy to install
|
14 |
+
+ Easy to use with a simple set of method
|
15 |
+
+ Supported method: var_dump, print, print_r, echo.
|
16 |
+
Frontend screen url {your_base_url}magedebugger</description>
|
17 |
+
<notes>Version 0.1.0</notes>
|
18 |
+
<authors><author><name>Magestore.com</name><user>auto-converted</user><email>magestore@gmail.com</email></author></authors>
|
19 |
+
<date>2010-04-13</date>
|
20 |
+
<time>10:04:00</time>
|
21 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="magedebuger.xml" hash="9daf9e9eb6e5d8d96726425171713295"/></dir><dir name="template"><dir name="magedebuger"><file name="magedebuger.phtml" hash="9da03329541e3132c8394d22e96740b6"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="magedebuger.xml" hash="b56dd9a9a48c664f45170f4cea2ce6aa"/></dir><dir name="template"><dir name="magedebuger"><file name="magedebuger.phtml" hash="a516a888215fd5b6e16631b8d08d84a1"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="magestore"><file name="magedebuger.css" hash="e03f2e62658663ad91c09d8666e4f843"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Magestore"><dir name="Magedebuger"><dir name="Block"><file name="Magedebuger.php" hash="b6b190796da2c28ba283d944c2586af2"/><dir name="Adminhtml"><file name="Magedebuger.php" hash="61a648b89054a5500bac753428d2a16d"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="19cb01018f6efee378b145891b96dd68"/><dir name="Adminhtml"><file name="MagedebugerController.php" hash="e69e082b8038e82eaf43bfdc33e0a919"/></dir></dir><dir name="etc"><file name="config.xml" hash="7c6951e1766c336fe01011a18c578ebd"/><file name="system.xml" hash="7d7cd995d313cc94472f8ec405876b63"/></dir><dir name="Helper"><file name="Data.php" hash="bdd3f524ea7f56fe5cc7fa647d921687"/></dir><dir name="Model"><file name="File.php" hash="b2023d1eca6ec21d436036848442ad7a"/><file name="Magedebuger.php" hash="d5fcc83ae0d27ecf52fdb6a99347e526"/><file name="Session.php" hash="6b9afb6c24791e4c6abb57d68aeda7e7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magestore_Magedebuger.xml" hash="96dc1d911bf04c02b2388ca58e71cad6"/></dir></target></contents>
|
22 |
+
<compatible/>
|
23 |
+
<dependencies/>
|
24 |
+
</package>
|
skin/frontend/default/default/css/magestore/magedebuger.css
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
#magebugs{
|
3 |
+
width:100%;
|
4 |
+
}
|
5 |
+
|
6 |
+
#magebugs table{
|
7 |
+
margin:20px auto;
|
8 |
+
border-top:1px solid #1f1f1f;
|
9 |
+
border-right:1px solid #1f1f1f;
|
10 |
+
width:100%;
|
11 |
+
}
|
12 |
+
|
13 |
+
#magebugs th{
|
14 |
+
padding:5px 20px 5px 20px;
|
15 |
+
}
|
16 |
+
|
17 |
+
#magebugs td{
|
18 |
+
padding:3px 20px 3px 20px;
|
19 |
+
}
|
20 |
+
|
21 |
+
#magebugs td.num{
|
22 |
+
width:5%;
|
23 |
+
}
|
24 |
+
|
25 |
+
#magebugs td.title{
|
26 |
+
width:25%;
|
27 |
+
}
|
28 |
+
|
29 |
+
#magebugs td.value{
|
30 |
+
width:70%;
|
31 |
+
}
|
32 |
+
|
33 |
+
#magebugs td, th{
|
34 |
+
border-bottom:1px solid #1f1f1f;
|
35 |
+
border-left:1px solid #1f1f1f;
|
36 |
+
text-align:left;
|
37 |
+
}
|
38 |
+
|
39 |
+
#bound-button-clear-magebug,#magestore-power{
|
40 |
+
width:100%;
|
41 |
+
text-align:right;
|
42 |
+
}
|
43 |
+
|
44 |
+
#bound-button-clear-magebug a{
|
45 |
+
text-decoration:none;
|
46 |
+
}
|
47 |
+
|
48 |
+
#magestore-power{
|
49 |
+
margin:10px 0 0 0;
|
50 |
+
font-family:tahoma;
|
51 |
+
font-size:12px;
|
52 |
+
}
|
53 |
+
#magestore-power span{
|
54 |
+
color:7f7f7f;
|
55 |
+
}
|
56 |
+
#magestore-power a{
|
57 |
+
font-weight:bold;
|
58 |
+
font-size:11px;
|
59 |
+
text-decoration:none;
|
60 |
+
}
|
61 |
+
|
62 |
+
.magestore-line{
|
63 |
+
border-top:1px solid #afafaf;
|
64 |
+
width:350px;
|
65 |
+
height:0px;
|
66 |
+
margin:30px 0 0 0;
|
67 |
+
}
|