Config_XML_Browser - Version 1.0.0

Version Notes

Stable v1.0.0

Download this release

Release Info

Developer Alexander Egelsky
Extension Config_XML_Browser
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Bricks/Xmlbrowser/Block/Adminhtml/Preparesearch.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+
13
+ class Bricks_Xmlbrowser_Block_Adminhtml_Preparesearch extends Mage_Core_Block_Template
14
+ {
15
+ public function __construct()
16
+ {
17
+ $this->setTemplate('report/xmlbrowser/preparesearch.phtml');
18
+ }
19
+ }
app/code/community/Bricks/Xmlbrowser/Block/Adminhtml/Report.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+
13
+ class Bricks_Xmlbrowser_Block_Adminhtml_Report extends Mage_Core_Block_Template
14
+ {
15
+ public function __construct()
16
+ {
17
+ $this->setTemplate('report/xmlbrowser/report.phtml');
18
+
19
+ $config = Mage::getModel('xmlbrowser/config');
20
+ $outArray = $config->init();
21
+
22
+ $searchStr = '';
23
+ $params = $this->getRequest()->getParams();
24
+ if (isset($params['search_str'])) {
25
+ $searchStr = (string)$params['search_str'];
26
+ if (strlen($searchStr) > 2) {
27
+ $config->setSearchString($searchStr);
28
+ } else {
29
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Search string must be 3 letters or larger'));
30
+ }
31
+ }
32
+ $this->setSearchString($searchStr);
33
+
34
+ $rootArray = $config->getNodeJson($outArray, 'root');
35
+ if (isset($params['search_str']) && (strlen($searchStr) > 2)) {
36
+ if ($numFound = $config->getNumFound()) {
37
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Total found %s match(es)', $numFound));
38
+ } else {
39
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Search string not found'));
40
+ }
41
+ }
42
+
43
+ $json = Zend_Json::encode(isset($rootArray['children']) ? $rootArray['children'] : array());
44
+
45
+ $this->setTreeData($json);
46
+ }
47
+ }
app/code/community/Bricks/Xmlbrowser/Block/Adminhtml/Search.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+
13
+ class Bricks_Xmlbrowser_Block_Adminhtml_Search extends Mage_Core_Block_Template
14
+ {
15
+ public function __construct()
16
+ {
17
+ $this->setTemplate('report/xmlbrowser/search.phtml');
18
+ }
19
+ }
app/code/community/Bricks/Xmlbrowser/Block/Adminhtml/View.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+
13
+ class Bricks_Xmlbrowser_Block_Adminhtml_View extends Mage_Core_Block_Template
14
+ {
15
+ public function __construct()
16
+ {
17
+ $this->setTemplate('report/xmlbrowser/view.phtml');
18
+ }
19
+ }
app/code/community/Bricks/Xmlbrowser/Helper/Data.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+
13
+ class Bricks_Xmlbrowser_Helper_Data extends Mage_Core_Helper_Data
14
+ {
15
+ protected $_file_types = null;
16
+ protected $_case_sensitive = false;
17
+
18
+ public function setFileTypes($types) {
19
+ if (!$types || !is_array($types)) {
20
+ return false;
21
+ }
22
+
23
+ $this->_file_types = array_map('strtolower', $types);
24
+ return $this;
25
+ }
26
+
27
+ public function setCaseSensitive($var) {
28
+ $this->_case_sensitive = (bool)$var;
29
+ return $this;
30
+ }
31
+
32
+ public function searchFiles($dir, $str, $filesList = array()) {
33
+ $dir = rtrim($dir, '\\\/').DS;
34
+
35
+ $files = scandir($dir);
36
+ foreach ($files as $file) {
37
+ if (is_dir($dir.$file)) {
38
+ if (($file != '.') && ($file != '..')) {
39
+ $this->searchFiles($dir.$file, $str, &$filesList);
40
+ }
41
+ } else {
42
+ $needToSearch = true;
43
+ if ($this->_file_types && is_array($this->_file_types)) {
44
+ $needToSearch = in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), $this->_file_types);
45
+ }
46
+ if ($needToSearch) {
47
+ $fileContent = file_get_contents($dir.$file);
48
+ $result = $this->_case_sensitive? strpos($fileContent, $str) : stripos($fileContent, $str);
49
+
50
+ if ($result !== FALSE) {
51
+ $filesList[] = $dir.$file;
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ return $filesList;
58
+ }
59
+
60
+ public function getSearchPlaces() {
61
+ return array(
62
+ array( 'label'=>'Core code', 'path'=>Mage::getBaseDir('code').DS.'core' ),
63
+ array( 'label'=>'Local code', 'path'=>Mage::getBaseDir('code').DS.'local' ),
64
+ array( 'label'=>'Community code', 'path'=>Mage::getBaseDir('code').DS.'community' ),
65
+ array( 'label'=>'Frontend views', 'path'=>Mage::getBaseDir('design').DS.'frontend' ),
66
+ array( 'label'=>'Admin views', 'path'=>Mage::getBaseDir('design').DS.'adminhtml' )
67
+ );
68
+ }
69
+
70
+ public function getFileTypes() {
71
+ return array(
72
+ array( 'label'=>'PHP Scripts (*.php)', 'extension'=>'php'),
73
+ array( 'label'=>'View templaes (*.phtml)', 'extension'=>'phtml'),
74
+ array( 'label'=>'Config files (*.xml)', 'extension'=>'xml'),
75
+ array( 'label'=>'MySQL installers (*.sql)', 'extension'=>'sql')
76
+ );
77
+ }
78
+ }
app/code/community/Bricks/Xmlbrowser/Model/Config.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+
13
+ // fix for PHP < 5.3
14
+ if (!function_exists('array_replace_recursive'))
15
+ {
16
+ function array_replace_recursive()
17
+ {
18
+ // Get array arguments
19
+ $arrays = func_get_args();
20
+ // Define the original array
21
+ $original = array_shift($arrays);
22
+
23
+ // Loop through arrays
24
+ foreach ($arrays as $array)
25
+ {
26
+ // Loop through array key/value pairs
27
+ foreach ($array as $key => $value)
28
+ {
29
+ // Value is an array
30
+ if (is_array($value))
31
+ {
32
+ // Traverse the array; replace or add result to original array
33
+ @$original[$key] = array_replace_recursive($original[$key], $array[$key]);
34
+ }
35
+ // Value is not an array
36
+ else
37
+ {
38
+ // Replace or add current value to original array
39
+ $original[$key] = $value;
40
+ }
41
+ }
42
+ }
43
+
44
+ // Return the joined array
45
+ return $original;
46
+ }
47
+ }
48
+
49
+ // This class replicates Mage_Core_Model_Config::init() actions, rebuilding config just like it
50
+ // added some Hook-up methods, since it was impossible to just extend that config class
51
+ class Bricks_Xmlbrowser_Model_Config extends Mage_Core_Model_Config
52
+ {
53
+ protected $_useCache = false;
54
+ protected $_allowCacheForInit = false;
55
+ protected $_xmlAsArray = array();
56
+ protected $_filesLoaded = array();
57
+ protected $_filesLoadedData = array();
58
+ protected $_searchString = null;
59
+ protected $_searchStringNumFound = 0;
60
+
61
+ public function setSearchString($str) {
62
+ $this->_searchString = $str;
63
+ }
64
+
65
+ // just like same stock parent method, except $this->loadFileCustom(), which adds config to total report
66
+ public function init($options=array())
67
+ {
68
+ $etcDir = $this->getOptions()->getEtcDir();
69
+ $localConfigLoaded = $this->loadFile($etcDir.DS.'local.xml');
70
+
71
+ $configFile = $etcDir.DS.'config.xml';
72
+ $this->loadFile($configFile);
73
+ $this->loadFileCustom($configFile); // add to report config
74
+
75
+ $this->_loadDeclaredModules();
76
+ // here all configs for modules are loaded
77
+
78
+ $this->loadModulesConfiguration('config.xml', $this);
79
+ $this->loadModulesConfiguration('system.xml', $this);
80
+
81
+ $mergeConfig = new Mage_Core_Model_Config_Base();
82
+ $configFile = $etcDir.DS.'local.xml';
83
+ if (is_readable($configFile)) {
84
+ $mergeConfig->loadFile($configFile);
85
+ $this->loadFileCustom($configFile); // add to report config
86
+ $this->extend($mergeConfig);
87
+ }
88
+
89
+ $this->applyExtends();
90
+
91
+ return $this->_xmlAsArray;
92
+ }
93
+
94
+ public function mergeXmlToArray($xmlObject, $fileID, $out = array())
95
+ {
96
+ foreach ($xmlObject->children() as $index => $node )
97
+ {
98
+ if (count($node->children())) {
99
+ $newData = $this->mergeXmlToArray($node, $fileID);
100
+ // some module config can have duplicate sections, like two <global> in Mage_Centinel module (Mage 1.6)
101
+ // this is fix for it
102
+ if (isset($out[$index])) {
103
+ $out[$index] = array_replace_recursive($out[$index], $newData); // will replace by last found, like it should
104
+ } else {
105
+ $out[$index] = $newData;
106
+ }
107
+ } else {
108
+ $out[$index][$fileID] = $this->parseNode($node);
109
+ }
110
+ }
111
+
112
+ return $out;
113
+ }
114
+
115
+ public function parseNode($node)
116
+ {
117
+ return (string)$node; // this may need some checks, left simple for now
118
+ }
119
+
120
+ public function loadFileCustom($filePath, $isXml = false, $fileFrom = '')
121
+ {
122
+ if (!$isXml)
123
+ {
124
+ if (!is_readable($filePath)) {
125
+ return false;
126
+ }
127
+
128
+ $string = file_get_contents($filePath);
129
+ if (!empty($string)) {
130
+ $xml = new SimpleXMLElement($string, LIBXML_NOBLANKS);
131
+ }
132
+ else {
133
+ throw new Exception('"$string" parameter for simplexml_load_string is empty');
134
+ }
135
+ }
136
+ else
137
+ {
138
+ $xml = $filePath;
139
+ $filePath = $fileFrom;
140
+ }
141
+
142
+ if ($xml instanceof SimpleXMLElement) {
143
+ if (!in_array($filePath, $this->_filesLoaded)) {
144
+ $this->_filesLoaded[] = $filePath;
145
+ }
146
+ $fileID = array_search($filePath, $this->_filesLoaded);
147
+ $this->_filesLoadedData[$fileID] = $this->mergeXmlToArray($xml, $fileID);
148
+
149
+ $this->_xmlAsArray = array_replace_recursive($this->_xmlAsArray, $this->_filesLoadedData[$fileID]);
150
+
151
+ return $this->_xmlAsArray;
152
+ }
153
+
154
+ return false;
155
+ }
156
+
157
+ protected function _loadDeclaredModules($mergeConfig = null)
158
+ {
159
+ $moduleFiles = $this->_getDeclaredModuleFiles();
160
+ if (!$moduleFiles) {
161
+ return ;
162
+ }
163
+
164
+ Varien_Profiler::start('config/load-modules-declaration');
165
+
166
+ $unsortedConfig = new Mage_Core_Model_Config_Base();
167
+ $unsortedConfig->loadString('<config/>');
168
+ $fileConfig = new Mage_Core_Model_Config_Base();
169
+
170
+ // load modules declarations
171
+ foreach ($moduleFiles as $file) {
172
+ $fileConfig->loadFile($file);
173
+ $unsortedConfig->extend($fileConfig);
174
+ }
175
+
176
+ $moduleDepends = array();
177
+ foreach ($unsortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
178
+ $depends = array();
179
+ if ($moduleNode->depends) {
180
+ foreach ($moduleNode->depends->children() as $depend) {
181
+ $depends[$depend->getName()] = true;
182
+ }
183
+ }
184
+ $moduleDepends[$moduleName] = array(
185
+ 'module' => $moduleName,
186
+ 'depends' => $depends,
187
+ 'active' => ('true' === (string)$moduleNode->active ? true : false),
188
+ );
189
+ }
190
+
191
+ // check and sort module dependens
192
+ $moduleDepends = $this->_sortModuleDepends($moduleDepends);
193
+
194
+ // create sorted config
195
+ $sortedConfig = new Mage_Core_Model_Config_Base();
196
+ $sortedConfig->loadString('<config><modules/></config>');
197
+
198
+ foreach ($unsortedConfig->getNode()->children() as $nodeName => $node) {
199
+ if ($nodeName != 'modules') {
200
+ $sortedConfig->getNode()->appendChild($node);
201
+ }
202
+ }
203
+
204
+ foreach ($moduleDepends as $moduleProp) {
205
+ $node = $unsortedConfig->getNode('modules/'.$moduleProp['module']);
206
+ $sortedConfig->getNode('modules')->appendChild($node);
207
+ }
208
+
209
+ $this->loadFileCustom($sortedConfig->getNode(), true, 'MAGE_MODULES_LOADING_PROCESS');
210
+ $this->extend($sortedConfig);
211
+
212
+ Varien_Profiler::stop('config/load-modules-declaration');
213
+ return $this;
214
+ }
215
+
216
+ public function loadModulesConfiguration($fileName, $mergeToObject=null, $mergeModel=null)
217
+ {
218
+ $disableLocalModules = !$this->_canUseLocalModules();
219
+
220
+ if ($mergeModel === null) {
221
+ $mergeModel = new Mage_Core_Model_Config_Base();
222
+ }
223
+ $modules = $this->getNode('modules')->children();
224
+ foreach ($modules as $modName=>$module) {
225
+ if ($module->is('active')) {
226
+ if ($disableLocalModules && ('local' === (string)$module->codePool)) {
227
+ continue;
228
+ }
229
+ $configFile = $this->getModuleDir('etc', $modName).DS.$fileName;
230
+ if ($mergeModel->loadFile($configFile)) {
231
+ $this->loadFileCustom($configFile); // add to report config
232
+ $mergeToObject->extend($mergeModel, true);
233
+ }
234
+ }
235
+ }
236
+ return $mergeToObject;
237
+ }
238
+
239
+ public static function cmp_nodes($a, $b)
240
+ {
241
+ $al = strtolower($a['text']);
242
+ $bl = strtolower($b['text']);
243
+ if ($al == $bl) {
244
+ return 0;
245
+ }
246
+ return ($al > $bl) ? +1 : -1;
247
+ }
248
+
249
+ public function getNodeJson($node, $name)
250
+ {
251
+ $item = array();
252
+ $item['text'] = $name;
253
+
254
+ $item['id'] = uniqid();
255
+ $item['store'] = 1;
256
+
257
+ if (is_array($node)) {
258
+ $children = array();
259
+ foreach ($node as $node_name => $node_item) {
260
+ $children[] = $this->getNodeJson($node_item, $node_name);
261
+ }
262
+ // sort all folders, don't touch files and modules
263
+ if (($name != 'modules') && ($first = current($children)) && isset($first['cls']) && ($first['cls'] != 'file')) {
264
+ usort($children, array(get_class($this), "cmp_nodes"));
265
+ }
266
+
267
+ $item['cls'] = 'folder';
268
+
269
+ foreach ($children as $key=>$child) {
270
+ if (isset($child['expanded'])) {
271
+ $item['expanded'] = true;
272
+ }
273
+ if (strpos($children[$key]['cls'], 'file') !== FALSE) {
274
+ $children[$key]['cls'] .= ' tree-node-crossed';
275
+ }
276
+ }
277
+ if (strpos($children[$key]['cls'], 'file') !== FALSE) {
278
+ $children[$key]['cls'] = str_replace('tree-node-crossed', 'tree-node-last', $children[$key]['cls']);
279
+ }
280
+
281
+ $item['children'] = $children;
282
+
283
+ } else {
284
+ $item['cls'] = 'file';
285
+ $item['text'] = '"'.$node.'"'.' <--- from: '.$this->_filesLoaded[$name];
286
+ }
287
+
288
+ if ($this->_searchString && (stripos($item['text'], $this->_searchString) !== FALSE)) {
289
+ $item['expanded'] = true;
290
+ $item['cls'] .= ' tree-node-matched';
291
+ $this->_searchStringNumFound++;
292
+ }
293
+
294
+ return $item;
295
+ }
296
+
297
+ public function getNumFound() {
298
+ return $this->_searchStringNumFound;
299
+ }
300
+ }
app/code/community/Bricks/Xmlbrowser/controllers/Adminhtml/ReportController.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+
13
+ class Bricks_Xmlbrowser_Adminhtml_ReportController extends Mage_Adminhtml_Controller_Action
14
+ {
15
+ protected function _initAction() {
16
+ $this->loadLayout()
17
+ ->_setActiveMenu('report/xmlbrowser')
18
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Xml Browser'), Mage::helper('adminhtml')->__('Xml Browser'));
19
+ return $this;
20
+ }
21
+
22
+ public function indexAction() {
23
+ $this->_initAction()
24
+ ->_addContent($this->getLayout()->createBlock('xmlbrowser/adminhtml_report'))
25
+ ->_initLayoutMessages('adminhtml/session')
26
+ ->renderLayout();
27
+ }
28
+
29
+ public function preparesearchAction() {
30
+ $searchString = $this->getRequest()->getParam('search_str', '');
31
+
32
+ $this->_initAction()
33
+ ->_addContent(
34
+ $this->getLayout()->createBlock('xmlbrowser/adminhtml_preparesearch')
35
+ ->setSearchString($searchString))
36
+ ->_initLayoutMessages('adminhtml/session')
37
+ ->renderLayout();
38
+ }
39
+
40
+ public function searchAction() {
41
+ $helper = Mage::helper('xmlbrowser');
42
+
43
+ $searchString = $this->getRequest()->getParam('search_string', '');
44
+ $searchCaseSensitive = (bool)$this->getRequest()->getParam('search_case_sensitive', false);
45
+ $searchPlaces = $this->getRequest()->getParam('search_where', $helper->getSearchPlaces());
46
+ $searchFileTypes = $this->getRequest()->getParam('search_filetype', $helper->getFileTypes());
47
+
48
+ $files = array();
49
+
50
+ if (!$searchString || (strlen($searchString) < 3)) {
51
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Search string must be 3 letters or larger'));
52
+ }
53
+ else {
54
+ $helper
55
+ ->setFileTypes($searchFileTypes)
56
+ ->setCaseSensitive($searchCaseSensitive);
57
+
58
+ foreach ($searchPlaces as $place) {
59
+ $helper->searchFiles($place, $searchString, &$files);
60
+ }
61
+
62
+ if ($numFound = count($files)) {
63
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Total found %s match(es)', $numFound));
64
+ } else {
65
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Search string not found'));
66
+ }
67
+ }
68
+
69
+ $this->_initAction()
70
+ ->_addContent(
71
+ $this->getLayout()->createBlock('xmlbrowser/adminhtml_search')
72
+ ->setFiles($files)
73
+ ->setSearchCaseSensitive($searchCaseSensitive)
74
+ ->setSearchString($searchString))
75
+ ->_initLayoutMessages('adminhtml/session')
76
+ ->renderLayout();
77
+ }
78
+
79
+ public function viewAction() {
80
+ $searchString = $this->getRequest()->getParam('search_string', '');
81
+ $searchCaseSensitive = (bool)$this->getRequest()->getParam('search_case_sensitive', false);
82
+ $searchFile = $this->getRequest()->getParam('search_file', '');
83
+
84
+ $this->_initAction()
85
+ ->_addContent(
86
+ $this->getLayout()->createBlock('xmlbrowser/adminhtml_view')
87
+ ->setSearchFile($searchFile)
88
+ ->setSearchCaseSensitive($searchCaseSensitive)
89
+ ->setSearchString($searchString))
90
+ ->_initLayoutMessages('adminhtml/session')
91
+ ->renderLayout();
92
+ }
93
+ }
app/code/community/Bricks/Xmlbrowser/etc/config.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento XML Configuration Browser
5
+ *
6
+ * @category Bricks
7
+ * @package Bricks_Xmlbrowser
8
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
9
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
10
+ *
11
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
12
+ */
13
+ -->
14
+ <config>
15
+ <modules>
16
+ <Bricks_Xmlbrowser>
17
+ <version>1.0.0</version>
18
+ </Bricks_Xmlbrowser>
19
+ </modules>
20
+ <admin>
21
+ <routers>
22
+ <xmlbrowser>
23
+ <use>admin</use>
24
+ <args>
25
+ <module>Bricks_Xmlbrowser</module>
26
+ <frontName>xmlbrowser</frontName>
27
+ </args>
28
+ </xmlbrowser>
29
+ </routers>
30
+ </admin>
31
+ <global>
32
+ <blocks>
33
+ <xmlbrowser>
34
+ <class>Bricks_Xmlbrowser_Block</class>
35
+ </xmlbrowser>
36
+ </blocks>
37
+ <models>
38
+ <xmlbrowser>
39
+ <class>Bricks_Xmlbrowser_Model</class>
40
+ </xmlbrowser>
41
+ </models>
42
+ <helpers>
43
+ <xmlbrowser>
44
+ <class>Bricks_Xmlbrowser_Helper</class>
45
+ </xmlbrowser>
46
+ </helpers>
47
+ </global>
48
+ <adminhtml>
49
+ <menu>
50
+ <report>
51
+ <children>
52
+ <xmlbrowser module="xmlbrowser">
53
+ <title>Config XML Browser Report</title>
54
+ <sort_order>100000</sort_order>
55
+ <action>xmlbrowser/adminhtml_report</action>
56
+ </xmlbrowser>
57
+ </children>
58
+ </report>
59
+ </menu>
60
+ <acl>
61
+ <resources>
62
+ <admin>
63
+ <children>
64
+ <report>
65
+ <children>
66
+ <xmlbrowser module="xmlbrowser">
67
+ <title>Config XML Browser Report</title>
68
+ </xmlbrowser>
69
+ </children>
70
+ </report>
71
+ </children>
72
+ </admin>
73
+ </resources>
74
+ </acl>
75
+ </adminhtml>
76
+ </config>
app/design/adminhtml/default/default/template/report/xmlbrowser/preparesearch.phtml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+ ?>
13
+
14
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>mage/adminhtml/form.js"></script>
15
+
16
+ <script type="text/javascript">
17
+ //<![CDATA[
18
+
19
+ Event.observe(window, 'load', function() {
20
+ window.xmlbrowserForm = new varienForm('xmlbrowser_search_form');
21
+ });
22
+
23
+ function checkAll(name, checked)
24
+ {
25
+ var checkboxes = $$('input.'+name);
26
+ checkboxes.each(function(e){ e.checked = checked });
27
+ }
28
+
29
+ //]]>
30
+ </script>
31
+
32
+ <?php $helper = Mage::helper('xmlbrowser'); ?>
33
+ <div id="xmlbrowser_search_lightbox" class="lightbox" >
34
+ <form id="xmlbrowser_search_form" name="xmlbrowser_search_form" action="<?=Mage::getUrl('*/*/search/')?>" method="post" target="_blank">
35
+ <div>
36
+ <h4><?=$this->__('Search for a substring in project code')?></h3>
37
+ </div>
38
+ <div class="input-box">
39
+ <label for="xmlbrowser_lightbox_search_string"><?=$this->__('Search string') ?></label>:
40
+ <input id="xmlbrowser_lightbox_search_string" name="search_string" type="text" class="required-entry input-text" value="<?=$this->getSearchString()?>" maxlength="255"/>
41
+ </div>
42
+ <br>
43
+ <div>
44
+ <h4><?=$this->__('Search inside')?> ( <a href="javascript:void(0);" onclick="checkAll('search_where',true);return false;"><?=$this->__('Check All')?></a>, <a href="javascript:void(0);" onclick="checkAll('search_where',false);return false;"><?=$this->__('Check None')?></a> ) </h4>
45
+ <?php $i = 0; foreach ($helper->getSearchPlaces() as $place): ?>
46
+ <input type="checkbox" class="search_where <?=(++$i == count($helper->getSearchPlaces()))? 'validate-one-required': ''?>" name="search_where[]" value="<?=$place['path']?>" checked="checked">&nbsp; <?=$place['label']?><br>
47
+ <?php endforeach; ?>
48
+ <br>
49
+ </div>
50
+ <div>
51
+ <h4><?=$this->__('Search for file type')?> ( <a href="javascript:void(0);" onclick="checkAll('search_filetype',true);return false;"><?=$this->__('Check All')?></a>, <a href="javascript:void(0);" onclick="checkAll('search_filetype',false);return false;"><?=$this->__('Check None')?></a> ) </h4>
52
+ <?php $i = 0; foreach ($helper->getFileTypes() as $item): ?>
53
+ <input type="checkbox" class="search_filetype <?=(++$i == count($helper->getFileTypes()))? 'validate-one-required': ''?>" name="search_filetype[]" value="<?=$item['extension']?>" checked="checked">&nbsp; <?=$item['label']?><br>
54
+ <?php endforeach; ?>
55
+ <br>
56
+ </div>
57
+ <br><br>
58
+ <div style="margin-bottom: 30px;">
59
+ <input type="checkbox" name="search_case_sensitive" value="1">&nbsp; <?=$this->__('Search case sensitive')?><br>
60
+ <br>
61
+ </div>
62
+ <input name="form_key" type="hidden" value="<?= Mage::getSingleton('core/session')->getFormKey(); ?>">
63
+ <div class="button-set" >
64
+ <a class="form-button img-btn btn-submit btn-orange" href="javascript:void(0)" onclick="window.xmlbrowserForm.submit(); return false;">
65
+ <span><?=$this->__('Search')?></span>
66
+ </a>
67
+ <span style="margin-left: 10px;">(<?=$this->__('Note: this can take a while')?>)</span>
68
+ <br><br>
69
+ <a class="form-button img-btn btn-gray btn-cancel " href="#" id="close_zipcode_window" onclick="window.close(); return false;" >
70
+ <span><?=$this->__('Cancel')?></span>
71
+ </a>
72
+ </div>
73
+ </form>
74
+ </div>
app/design/adminhtml/default/default/template/report/xmlbrowser/report.phtml ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+ ?>
13
+
14
+ <style type="text/css">
15
+ .tree-node-matched { font-weight: bold; background-color: #6EC462; }
16
+ .tree-node-crossed { text-decoration: line-through; }
17
+ .tree-node-last { }
18
+ </style>
19
+
20
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>index.php?c=auto&amp;f=,prototype/prototype.js" ></script>
21
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>index.php?c=auto&amp;f=,extjs/ext-tree.js,extjs/ext-tree-checkbox.js" ></script>
22
+
23
+ <link rel="stylesheet" type="text/css" href="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>extjs/resources/css/ext-all.css" />
24
+
25
+ <script type="text/javascript">
26
+ //<![CDATA[
27
+ var tree;
28
+
29
+ // Fix ext compatibility with prototype 1.6
30
+ Ext.lib.Event.getTarget = function(e) {
31
+ var ee = e.browserEvent || e;
32
+ return ee.target ? Event.element(ee) : null;
33
+ };
34
+
35
+ Ext.tree.TreePanel.Enhanced = function(el, config)
36
+ {
37
+ Ext.tree.TreePanel.Enhanced.superclass.constructor.call(this, el, config);
38
+ };
39
+
40
+ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, {
41
+
42
+ loadTree : function(config, firstLoad)
43
+ {
44
+ var parameters = config['parameters'];
45
+ var data = config['data'];
46
+
47
+ if ((typeof parameters['root_visible']) != 'undefined') {
48
+ this.rootVisible = parameters['root_visible']*1;
49
+ }
50
+
51
+ var root = new Ext.tree.TreeNode(parameters);
52
+
53
+ this.nodeHash = {};
54
+ this.setRootNode(root);
55
+
56
+ this.addListener('click', this.categoryClick);
57
+
58
+ this.loader.buildCategoryTree(root, data);
59
+ this.el.dom.innerHTML = '';
60
+ // render the tree
61
+ this.render();
62
+ root.expand();
63
+ },
64
+
65
+ collapseTree : function(){ this.collapseAll();},
66
+ expandTree : function(){ this.expandAll(); },
67
+
68
+ categoryClick : function(node, e)
69
+ {
70
+ $('search_str').value = node.text.replace(/<---.*/g, '').trim().replace(/^"/g, '').replace(/"$/g, '');
71
+ }
72
+ });
73
+
74
+ function reRenderTree(config, storeParam)
75
+ {
76
+ if (!config) {
77
+ var config = defaultLoadTreeParams;
78
+ }
79
+ if (tree) {
80
+ tree.purgeListeners();
81
+ tree.el.dom.innerHTML = '';
82
+ }
83
+ tree = new Ext.tree.TreePanel.Enhanced('tree-div', newTreeParams);
84
+ tree.loadTree(config, true);
85
+ }
86
+
87
+ Ext.onReady(function()
88
+ {
89
+ categoryLoader = new Ext.tree.TreeLoader({ dataUrl: '' });
90
+
91
+ categoryLoader.createNode = function(config) {
92
+ var node;
93
+ var _node = Object.clone(config);
94
+ if (config.children && !config.children.length) {
95
+ delete(config.children);
96
+ node = new Ext.tree.AsyncTreeNode(config);
97
+ } else {
98
+ node = new Ext.tree.TreeNode(config);
99
+ }
100
+
101
+ return node;
102
+ };
103
+
104
+ categoryLoader.buildCategoryTree = function(parent, config)
105
+ {
106
+ if (!config) return null;
107
+
108
+ if (parent && config && config.length){
109
+ for (var i = 0; i < config.length; i++) {
110
+ var node;
111
+ var _node = Object.clone(config[i]);
112
+ if (_node.children && !_node.children.length) {
113
+ delete(_node.children);
114
+ node = new Ext.tree.AsyncTreeNode(_node);
115
+ } else {
116
+ node = new Ext.tree.TreeNode(config[i]);
117
+ }
118
+ parent.appendChild(node);
119
+ node.loader = node.getOwnerTree().loader;
120
+ if (_node.children) {
121
+ this.buildCategoryTree(node, _node.children);
122
+ }
123
+ }
124
+ }
125
+ };
126
+
127
+ newTreeParams = {
128
+ animate : false,
129
+ loader : categoryLoader,
130
+ enableDD : false,
131
+ containerScroll : false,
132
+ rootVisible : true,
133
+ useAjax : false,
134
+ switchTreeUrl : '',
135
+ editUrl : '',
136
+ addNodeTo : false,
137
+ };
138
+
139
+ defaultLoadTreeParams = {
140
+ parameters : {
141
+ draggable : false,
142
+ allowDrop : false,
143
+ expanded : false,
144
+ text : 'config',
145
+ },
146
+ data : <?=$this->getTreeData()?>
147
+ };
148
+
149
+ reRenderTree();
150
+ });
151
+
152
+ //]]>
153
+ </script>
154
+
155
+
156
+ <div style="clear: both; ">
157
+ <div style="float: left;">
158
+ <form action="<?=Mage::getUrl('*/*/*/')?>" method="post">
159
+ <span><?=$this->__('Find inside config tree')?>: </span>
160
+ <input type="text" name="search_str" value="<?=$this->getSearchString()?>" size="50">
161
+ <input name="form_key" type="hidden" value="<?=Mage::getSingleton('core/session')->getFormKey()?>">
162
+ <button type="submit"><?=$this->__('Search')?></button>
163
+ </form>
164
+ </div>
165
+ <div style="float: right; margin-right: 200px;">
166
+ <form action="<?=Mage::getUrl('*/*/preparesearch/')?>" method="post" target="_blank">
167
+ <span><?=$this->__('Search inside project code')?>: </span>
168
+ <input type="text" id="search_str" name="search_str" size="50">
169
+ <input name="form_key" type="hidden" value="<?=Mage::getSingleton('core/session')->getFormKey()?>">
170
+ <button type="submit"><?=$this->__('Search')?></button>
171
+ </form>
172
+ </div>
173
+ </div>
174
+ <br>
175
+ <br>
176
+ <a href="javascript:void(0)" onclick="tree.collapseTree();"><?=$this->__('Collapse All')?></a>
177
+ <br>
178
+ <br>
179
+ <div class="tree-holder">
180
+ <div id="tree-div" style="width:100%; overflow:auto;"></div>
181
+ </div>
app/design/adminhtml/default/default/template/report/xmlbrowser/search.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+ ?>
13
+
14
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>index.php?c=auto&amp;f=,prototype/prototype.js" ></script>
15
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>index.php?c=auto&amp;f=,extjs/ext-tree.js,extjs/ext-tree-checkbox.js" ></script>
16
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>mage/adminhtml/form.js"></script>
17
+
18
+ <link rel="stylesheet" type="text/css" href="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>extjs/resources/css/ext-all.css" />
19
+
20
+ <script type="text/javascript">
21
+ Event.observe(window, 'load', function() {
22
+ window.xmlbrowserForm = new varienForm('xmlbrowser_search_form');
23
+ });
24
+ </script>
25
+
26
+ <?php if (count($this->getFiles())): ?>
27
+ <h2><?=$this->__('Files matching "%s" string:', $this->getSearchString())?></h2>
28
+ <form id="xmlbrowser_search_form" action="<?=Mage::getUrl('*/*/view/')?>" method="post" target="_blank">
29
+ <div>
30
+ <select class="validate-select" size="30" name="search_file">
31
+ <?php foreach ($this->getFiles() as $file): ?>
32
+ <option><?=$file?></option>
33
+ <?php endforeach; ?>
34
+ </select>
35
+ <input type="hidden" name="search_string" value="<?=$this->getSearchString()?>">
36
+ <input type="hidden" name="search_case_sensitive" value="<?=$this->getSearchCaseSensitive()?>">
37
+ <input name="form_key" type="hidden" value="<?= Mage::getSingleton('core/session')->getFormKey(); ?>">
38
+ </div>
39
+ <div class="button-set" style="text-align: center; float: left; margin-top: 20px;" >
40
+ <a class="form-button img-btn btn-submit btn-orange" href="javascript:void(0)" onclick="window.xmlbrowserForm.submit(); return false;">
41
+ <span><?=$this->__('View Selected File')?></span>
42
+ </a>
43
+ </div>
44
+ </form>
45
+ <?php endif; ?>
app/design/adminhtml/default/default/template/report/xmlbrowser/view.phtml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento XML Configuration Browser
4
+ *
5
+ * @category Bricks
6
+ * @package Bricks_Xmlbrowser
7
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
8
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
9
+ *
10
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
11
+ */
12
+ ?>
13
+
14
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>index.php?c=auto&amp;f=,prototype/prototype.js" ></script>
15
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>index.php?c=auto&amp;f=,extjs/ext-tree.js,extjs/ext-tree-checkbox.js" ></script>
16
+ <script type="text/javascript" src="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>mage/adminhtml/form.js"></script>
17
+
18
+ <link rel="stylesheet" type="text/css" href="<?=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>extjs/resources/css/ext-all.css" />
19
+
20
+ <script type="text/javascript">
21
+ Event.observe(window, 'load', function() {
22
+ window.xmlbrowserForm = new varienForm('xmlbrowser_search_form');
23
+ });
24
+ </script>
25
+
26
+ <style type="text/css">
27
+ .span-matched { font-weight: bold; background-color: #6EC462; }
28
+ </style>
29
+
30
+ <h2><?=$this->__('Search file: "%s"<br>for substring: "%s"', $this->getSearchFile(), $this->getSearchString())?></h2>
31
+
32
+ <?php
33
+ function printCode($source_code)
34
+ {
35
+
36
+ if (is_array($source_code))
37
+ return false;
38
+
39
+ $source_code = explode("\n", str_replace(array("\r\n", "\r"), "\n", $source_code));
40
+ $line_count = 1;
41
+
42
+ $formatted_code = '';
43
+ foreach ($source_code as $code_line)
44
+ {
45
+ $formatted_code .= '<tr><td>'.$line_count.'&nbsp;</td>';
46
+ $line_count++;
47
+
48
+ if (preg_match('/<\?(php)?[^[:graph:]]/', $code_line))
49
+ $formatted_code .= '<td>'. str_replace(array('<code>', '</code>'), '', highlight_string($code_line, true)).'</td></tr>';
50
+ else
51
+ $formatted_code .= '<td>'.preg_replace('/(&lt;\?php&nbsp;)+/', '', str_replace(array('<code>', '</code>'), '', highlight_string('<?php '.$code_line, true))).'</td></tr>';
52
+ }
53
+
54
+ return '<table style="font: 1em Consolas, \'andale mono\', \'monotype.com\', \'lucida console\', monospace;">'.$formatted_code.'</table>';
55
+ }
56
+ ?>
57
+
58
+ <?php
59
+ $code = printCode(file_get_contents($this->getSearchFile()));
60
+ $modifier = $this->getSearchCaseSensitive()? '' : 'i';
61
+ echo preg_replace('/(?<=\>)([^<]*)('.preg_quote($this->getSearchString(),'/').')([^<]*)(?=\<)/'.$modifier, '$1<span class="span-matched">$2</span>$3', $code);
62
+ ?>
app/etc/modules/Bricks_Xmlbrowser.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento XML Configuration Browser
5
+ *
6
+ * @category Bricks
7
+ * @package Bricks_Xmlbrowser
8
+ * @author Alexander Egelsky ( alexegelsky@gmail.com )
9
+ * @copyright If you edit or copy it - leave my credentials in it - that's all requirements for now
10
+ *
11
+ * All suggestions, bugs or typos you will find in this extension you can send to @author
12
+ */
13
+ -->
14
+ <config>
15
+ <modules>
16
+ <Bricks_Xmlbrowser>
17
+ <active>true</active>
18
+ <codePool>community</codePool>
19
+ </Bricks_Xmlbrowser>
20
+ </modules>
21
+ </config>
package.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Config_XML_Browser</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>It shows ALL xml configs that were loaded to Mage:&#xD;
10
+ - shows rewrites for any entity&#xD;
11
+ - shows modules in the order Mage uses them&#xD;
12
+ - shows all observers for all events, in one place&#xD;
13
+ - search whole config or whole project code for some string&#xD;
14
+ - and many more&#xD;
15
+ &#xD;
16
+ Key benefits of using it:&#xD;
17
+ - very useful for multiple rewrites, to know what is actually used after all rewrites, and shows where did each came from.&#xD;
18
+ - you can see all events/models/blocks the way Mage gets it, in one place&#xD;
19
+ - if you think something should be rewrited/handled, but it's not - you can look for this reason here&#xD;
20
+ - custom search in project code, eliminating searching for substring in files by some third party software&#xD;
21
+ &#xD;
22
+ This extension often saves a lot of time and many of my friends asked for it.&#xD;
23
+ I wanted to use it too, but it didn't existed - so I've made it.&#xD;
24
+ &#xD;
25
+ This is a "MUST HAVE!" extension for beginners and it is very useful for professionals too.</summary>
26
+ <description>No changes to the core needed,&#xD;
27
+ no dependent modules.&#xD;
28
+ &#xD;
29
+ Tested on Mage 1.3-1.6.&#xD;
30
+ &#xD;
31
+ Lots of code, but small amount of Mage key code,&#xD;
32
+ so it should work on future releases too.&#xD;
33
+ &#xD;
34
+ It was a dream of many, but some were not capable to build this extension,&#xD;
35
+ and some were too lazy to do it.&#xD;
36
+ I just needed it more than others I guess.&#xD;
37
+ &#xD;
38
+ I've spent a lot of time to build it, so I want to share it with community.</description>
39
+ <notes>Stable v1.0.0</notes>
40
+ <authors><author><name>Alexander Egelsky</name><user>aegelsky</user><email>alexegelsky@gmail.com</email></author></authors>
41
+ <date>2012-05-26</date>
42
+ <time>16:19:54</time>
43
+ <contents><target name="magecommunity"><dir name="Bricks"><dir name="Xmlbrowser"><dir name="Block"><dir name="Adminhtml"><file name="Preparesearch.php" hash="7bd4be0c93c86bf145f5de5f3f25b858"/><file name="Report.php" hash="d44009b79612bc73572a695d7ebb6111"/><file name="Search.php" hash="afb6926b383779ef0863c7932c3c2bbf"/><file name="View.php" hash="14bc8713ce5e51bdc57b2ba464a9c376"/></dir></dir><dir name="Helper"><file name="Data.php" hash="4e77299a8b1efaa1584ee3f6cfc18792"/></dir><dir name="Model"><file name="Config.php" hash="36d3fc95ce0301ff1e31c43eceec712e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ReportController.php" hash="e78929bf408e0fe41951e247d8211c39"/></dir></dir><dir name="etc"><file name="config.xml" hash="39e8e72aa9783a84414b5d0c6e1ee5f5"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="report"><dir name="xmlbrowser"><file name="preparesearch.phtml" hash="7c832c347a654a0fe658096d06a3e279"/><file name="report.phtml" hash="897d4337967c9af25699650914d24274"/><file name="search.phtml" hash="370385597d4cbbfc10bcc22c13d7cbf2"/><file name="view.phtml" hash="d58ff40a6223de39d1b6aee60e97f11d"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bricks_Xmlbrowser.xml" hash="f59c9995c9d4b6144b4698815b316d1d"/></dir></target></contents>
44
+ <compatible/>
45
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
46
+ </package>