IG_Cmslevels - Version 1.0.2

Version Notes

Enjoy it ;)

Download this release

Release Info

Developer Riccardo Tempesta
Extension IG_Cmslevels
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/IG/Cmslevels/Block/Cms/Page.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * IDEALIAGroup srl
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
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://www.idealiagroup.com/magento-ext-license.html
11
+ *
12
+ * @category IG
13
+ * @package IG_Cmslevels
14
+ * @copyright Copyright (c) 2011-2012 IDEALIAGroup srl (http://www.idealiagroup.com)
15
+ * @license http://www.idealiagroup.com/magento-ext-license.html
16
+ */
17
+
18
+ class IG_Cmslevels_Block_Cms_Page extends Mage_Cms_Block_Page
19
+ {
20
+ /**
21
+ * Check if component is enabled or not
22
+ *
23
+ * @return bool
24
+ */
25
+ public function getIsEnabled()
26
+ {
27
+ return Mage::helper('ig_cmslevels')->getIsEnabled();
28
+ }
29
+
30
+ /**
31
+ * Check if component is enabled or not
32
+ *
33
+ * @return bool
34
+ */
35
+ public function getLevelSeparator()
36
+ {
37
+ return Mage::helper('ig_cmslevels')->getLevelSeparator();
38
+ }
39
+
40
+ /**
41
+ * Prepare global layout
42
+ *
43
+ * @return IG_Cmslevels_Block_Cms_Page
44
+ */
45
+ protected function _prepareLayout()
46
+ {
47
+ if (!$this->getIsEnabled())
48
+ return parent::_prepareLayout();
49
+
50
+ $page = $this->getPage();
51
+
52
+ // show breadcrumbs
53
+ if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs') &&
54
+ ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) &&
55
+ ($page->getIdentifier()!==Mage::getStoreConfig('web/default/cms_home_page')) &&
56
+ ($page->getIdentifier()!==Mage::getStoreConfig('web/default/cms_no_route'))
57
+ ) {
58
+ $titleParts = explode($this->getLevelSeparator(), $page->getTitle());
59
+ $urlParts = explode('/', $page->getIdentifier());
60
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Go to Home Page'), 'link'=>Mage::getBaseUrl()));
61
+
62
+ $link = array();
63
+ for ($i=0; $i<count($titleParts); $i++)
64
+ {
65
+ $linkUrl = '';
66
+
67
+ $titlePart = trim($titleParts[$i]);
68
+ if (count($urlParts)-1 > $i)
69
+ {
70
+ $link[] = $urlParts[$i];
71
+ $identifier = implode('/', $link);
72
+
73
+ $parent = Mage::getModel('cms/page')->load($identifier, 'identifier');
74
+
75
+ if ($parent->getId())
76
+ {
77
+ $linkUrl = Mage::getBaseUrl().$parent->getIdentifier();
78
+ }
79
+
80
+ if (!$linkUrl)
81
+ {
82
+ $parent = Mage::getModel('cms/page')->load($identifier.'.html', 'identifier');
83
+
84
+ if ($parent->getId())
85
+ $linkUrl = Mage::getBaseUrl().$parent->getIdentifier();
86
+ }
87
+ }
88
+
89
+ if ($linkUrl)
90
+ {
91
+ $breadcrumbs->addCrumb($titlePart, array('label'=>$titlePart, 'title'=>$titlePart, 'link' => $linkUrl));
92
+ $page->setTitle($titlePart);
93
+ }
94
+ else
95
+ {
96
+ $breadcrumbs->addCrumb($titlePart, array('label'=>$titlePart, 'title'=>$titlePart));
97
+ $page->setTitle($titlePart);
98
+ }
99
+ }
100
+ }
101
+
102
+ $root = $this->getLayout()->getBlock('root');
103
+ if ($root)
104
+ {
105
+ $root->addBodyClass('cms-'.$page->getIdentifier());
106
+ }
107
+
108
+ $head = $this->getLayout()->getBlock('head');
109
+ if ($head) {
110
+ $head->setTitle($page->getTitle());
111
+ $head->setKeywords($page->getMetaKeywords());
112
+ $head->setDescription($page->getMetaDescription());
113
+ }
114
+
115
+ return $this;
116
+ }
117
+ }
app/code/community/IG/Cmslevels/CHANGELOG.txt CHANGED
@@ -1,2 +1,5 @@
1
- 1.0.1:
2
- Label fix on system config
 
 
 
1
+ 1.0.1:
2
+ Label fix on system config
3
+
4
+ 1.0.2:
5
+ Minor fixes
app/code/community/IG/Cmslevels/COMPATIBILITY.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ This file reports the compatibility table for this extension.
2
+ If your Magento version is not included in this list you may try
3
+ using the extension but AT YOUR OWN RISK.
4
+
5
+ CE 1.4.2
6
+ CE 1.5.0
7
+ CE 1.5.1
8
+ CE 1.6.0
9
+ CE 1.6.1
10
+ CE 1.6.2
11
+ CE 1.7.x
app/code/community/IG/Cmslevels/Helper/Data.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * IDEALIAGroup srl
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
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://www.idealiagroup.com/magento-ext-license.html
11
+ *
12
+ * @category IG
13
+ * @package IG_Cmslevels
14
+ * @copyright Copyright (c) 2011-2012 IDEALIAGroup srl (http://www.idealiagroup.com)
15
+ * @license http://www.idealiagroup.com/magento-ext-license.html
16
+ */
17
+
18
+ class IG_Cmslevels_Helper_Data extends Mage_Core_Helper_Abstract
19
+ {
20
+ const XML_PATH_GENERAL_ENABLED = 'ig_cmslevels/general/enabled';
21
+ const XML_PATH_GENERAL_LEVEL_SEPARATOR = 'ig_cmslevels/general/level_separator';
22
+
23
+ /**
24
+ * Check if component is enabled or not
25
+ *
26
+ * @return bool
27
+ */
28
+ public function getIsEnabled()
29
+ {
30
+ return Mage::getStoreConfig(self::XML_PATH_GENERAL_ENABLED) ? true : false;
31
+ }
32
+
33
+ /**
34
+ * Get CMS level separator
35
+ *
36
+ * @return string
37
+ */
38
+ public function getLevelSeparator()
39
+ {
40
+ return trim(Mage::getStoreConfig(self::XML_PATH_GENERAL_LEVEL_SEPARATOR));
41
+ }
42
+ }
app/code/community/IG/Cmslevels/etc/config.xml CHANGED
@@ -1,77 +1,77 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * IDEALIAGroup srl
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the EULA
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://www.idealiagroup.com/magento-ext-license.html
12
- *
13
- * @category IG
14
- * @package IG_Cmslevels
15
- * @copyright Copyright (c) 2011-2012 IDEALIAGroup srl (http://www.idealiagroup.com)
16
- * @license http://www.idealiagroup.com/magento-ext-license.html
17
- */
18
- -->
19
- <config>
20
- <modules>
21
- <IG_Cmslevels>
22
- <version>1.0.1</version>
23
- </IG_Cmslevels>
24
- </modules>
25
-
26
- <global>
27
- <helpers>
28
- <ig_cmslevels>
29
- <class>IG_Cmslevels_Helper</class>
30
- </ig_cmslevels>
31
- </helpers>
32
-
33
- <blocks>
34
- <ig_cmslevels>
35
- <class>IG_Cmslevels_Block</class>
36
- </ig_cmslevels>
37
-
38
- <cms>
39
- <rewrite>
40
- <page>IG_Cmslevels_Block_Cms_Page</page>
41
- </rewrite>
42
- </cms>
43
- </blocks>
44
- </global>
45
-
46
- <adminhtml>
47
- <acl>
48
- <resources>
49
- <admin>
50
- <children>
51
- <system>
52
- <children>
53
- <config>
54
- <children>
55
- <ig_cmslevels translate="title" module="ig_cmslevels">
56
- <title>IG Cmslevels</title>
57
- <sort_order>1000</sort_order>
58
- </ig_cmslevels>
59
- </children>
60
- </config>
61
- </children>
62
- </system>
63
- </children>
64
- </admin>
65
- </resources>
66
- </acl>
67
- </adminhtml>
68
-
69
- <default>
70
- <ig_cmslevels>
71
- <general>
72
- <enabled>1</enabled>
73
- <level_separator>/</level_separator>
74
- </general>
75
- </ig_cmslevels>
76
- </default>
77
- </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * IDEALIAGroup srl
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.idealiagroup.com/magento-ext-license.html
12
+ *
13
+ * @category IG
14
+ * @package IG_Cmslevels
15
+ * @copyright Copyright (c) 2011-2012 IDEALIAGroup srl (http://www.idealiagroup.com)
16
+ * @license http://www.idealiagroup.com/magento-ext-license.html
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <IG_Cmslevels>
22
+ <version>1.0.2</version>
23
+ </IG_Cmslevels>
24
+ </modules>
25
+
26
+ <global>
27
+ <helpers>
28
+ <ig_cmslevels>
29
+ <class>IG_Cmslevels_Helper</class>
30
+ </ig_cmslevels>
31
+ </helpers>
32
+
33
+ <blocks>
34
+ <ig_cmslevels>
35
+ <class>IG_Cmslevels_Block</class>
36
+ </ig_cmslevels>
37
+
38
+ <cms>
39
+ <rewrite>
40
+ <page>IG_Cmslevels_Block_Cms_Page</page>
41
+ </rewrite>
42
+ </cms>
43
+ </blocks>
44
+ </global>
45
+
46
+ <adminhtml>
47
+ <acl>
48
+ <resources>
49
+ <admin>
50
+ <children>
51
+ <system>
52
+ <children>
53
+ <config>
54
+ <children>
55
+ <ig_cmslevels translate="title" module="ig_cmslevels">
56
+ <title>IG Cmslevels</title>
57
+ <sort_order>1000</sort_order>
58
+ </ig_cmslevels>
59
+ </children>
60
+ </config>
61
+ </children>
62
+ </system>
63
+ </children>
64
+ </admin>
65
+ </resources>
66
+ </acl>
67
+ </adminhtml>
68
+
69
+ <default>
70
+ <ig_cmslevels>
71
+ <general>
72
+ <enabled>1</enabled>
73
+ <level_separator>/</level_separator>
74
+ </general>
75
+ </ig_cmslevels>
76
+ </default>
77
+ </config>
app/code/community/IG/Cmslevels/etc/system.xml CHANGED
@@ -1,67 +1,67 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * IDEALIAGroup srl
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the EULA
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://www.idealiagroup.com/magento-ext-license.html
12
- *
13
- * @category IG
14
- * @package IG_Cmslevels
15
- * @copyright Copyright (c) 2011-2012 IDEALIAGroup srl (http://www.idealiagroup.com)
16
- * @license http://www.idealiagroup.com/magento-ext-license.html
17
- */
18
- -->
19
- <config>
20
- <tabs>
21
- <ig translate="label" module="ig_cmslevels">
22
- <label>IdealiaGroup</label>
23
- <sort_order>200</sort_order>
24
- </ig>
25
- </tabs>
26
- <sections>
27
- <ig_cmslevels translate="label" module="ig_cmslevels">
28
- <label>IG Cms Levels</label>
29
- <tab>ig</tab>
30
- <frontend_type>text</frontend_type>
31
- <sort_order>10</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
- <groups>
36
- <general translate="label">
37
- <label>General</label>
38
- <frontend_type>text</frontend_type>
39
- <sort_order>10</sort_order>
40
- <show_in_default>1</show_in_default>
41
- <show_in_website>1</show_in_website>
42
- <show_in_store>1</show_in_store>
43
- <fields>
44
- <enabled translate="label">
45
- <label>Enable CMS Levels</label>
46
- <frontend_type>select</frontend_type>
47
- <source_model>adminhtml/system_config_source_yesno</source_model>
48
- <sort_order>10</sort_order>
49
- <show_in_default>1</show_in_default>
50
- <show_in_website>1</show_in_website>
51
- <show_in_store>1</show_in_store>
52
- </enabled>
53
- <level_separator translate="label">
54
- <label>Level Separator</label>
55
- <frontend_type>text</frontend_type>
56
- <sort_order>20</sort_order>
57
- <show_in_default>1</show_in_default>
58
- <show_in_website>1</show_in_website>
59
- <show_in_store>1</show_in_store>
60
- <comment>To be used in page's title</comment>
61
- </level_separator>
62
- </fields>
63
- </general>
64
- </groups>
65
- </ig_cmslevels>
66
- </sections>
67
  </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * IDEALIAGroup srl
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.idealiagroup.com/magento-ext-license.html
12
+ *
13
+ * @category IG
14
+ * @package IG_Cmslevels
15
+ * @copyright Copyright (c) 2011-2012 IDEALIAGroup srl (http://www.idealiagroup.com)
16
+ * @license http://www.idealiagroup.com/magento-ext-license.html
17
+ */
18
+ -->
19
+ <config>
20
+ <tabs>
21
+ <ig translate="label" module="ig_cmslevels">
22
+ <label>IdealiaGroup</label>
23
+ <sort_order>200</sort_order>
24
+ </ig>
25
+ </tabs>
26
+ <sections>
27
+ <ig_cmslevels translate="label" module="ig_cmslevels">
28
+ <label>IG Cms Levels</label>
29
+ <tab>ig</tab>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>10</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
+ <groups>
36
+ <general translate="label">
37
+ <label>General</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>10</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <fields>
44
+ <enabled translate="label">
45
+ <label>Enable CMS Levels</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>adminhtml/system_config_source_yesno</source_model>
48
+ <sort_order>10</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </enabled>
53
+ <level_separator translate="label">
54
+ <label>Level Separator</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>20</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ <comment>To be used in page's title</comment>
61
+ </level_separator>
62
+ </fields>
63
+ </general>
64
+ </groups>
65
+ </ig_cmslevels>
66
+ </sections>
67
  </config>
app/etc/modules/IG_Cmslevels.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * IDEALIAGroup srl
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.idealiagroup.com/magento-ext-license.html
12
+ *
13
+ * @category IG
14
+ * @package IG_Cmslevels
15
+ * @copyright Copyright (c) 2012 IDEALIAGroup srl (http://www.idealiagroup.com)
16
+ * @license http://www.idealiagroup.com/magento-ext-license.html
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <IG_Cmslevels>
22
+ <active>true</active>
23
+ <codePool>community</codePool>
24
+ </IG_Cmslevels>
25
+ </modules>
26
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>IG_Cmslevels</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.idealiagroup.com/magento-ext-license.html">Commercial</license>
7
  <channel>community</channel>
@@ -11,8 +11,8 @@
11
  <notes>Enjoy it ;)</notes>
12
  <authors><author><name>Riccardo Tempesta</name><user>idealiagroup</user><email>tempesta@idealiagroup.com</email></author><author><name>Marco Giorgetti</name><user>idealiagroup</user><email>giorgetti@idealiagroup.com</email></author></authors>
13
  <date>2012-10-08</date>
14
- <time>09:52:20</time>
15
- <contents><target name="magecommunity"><dir name="IG"><dir name="Cmslevels"><file name="CHANGELOG.txt" hash="1fbd83665001ce46aa43d0aa6f839eb6"/><dir name="etc"><file name="config.xml" hash="aca980490b19c99394d72877ac8c771a"/><file name="system.xml" hash="d9650abee9761ecbdd6fe1e5ace919bb"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="IG_Cmslevels.xml" hash=""/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>IG_Cmslevels</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.idealiagroup.com/magento-ext-license.html">Commercial</license>
7
  <channel>community</channel>
11
  <notes>Enjoy it ;)</notes>
12
  <authors><author><name>Riccardo Tempesta</name><user>idealiagroup</user><email>tempesta@idealiagroup.com</email></author><author><name>Marco Giorgetti</name><user>idealiagroup</user><email>giorgetti@idealiagroup.com</email></author></authors>
13
  <date>2012-10-08</date>
14
+ <time>10:20:16</time>
15
+ <contents><target name="magecommunity"><dir name="IG"><dir name="Cmslevels"><dir name="Block"><dir name="Cms"><file name="Page.php" hash="4cf99dc1fcb74f333fe416a85f742370"/></dir></dir><file name="CHANGELOG.txt" hash="6264ca5f9e5f2a12f2b0629a1e9155d2"/><file name="COMPATIBILITY.txt" hash="6bb2c49c0f5769be900306be6d15ce8b"/><dir name="Helper"><file name="Data.php" hash="f3baf716105b6e4a618ec264ac506db6"/></dir><dir name="etc"><file name="config.xml" hash="6575bde67db7e618391f056ccb6b5eb0"/><file name="system.xml" hash="5937574d8bbca74515f082b545a11215"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="IG_Cmslevels.xml" hash="5c2e3a31ecdee37a66e1fc6d1136ed5c"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>