YBM_Common - Version 2.1.0

Version Notes

--

Download this release

Release Info

Developer DHL Vertriebs GmbH
Extension YBM_Common
Version 2.1.0
Comparing to
See all releases


Code changes from version 1.0.0 to 2.1.0

app/code/community/YBM/Common/Helper/Log/Abstract.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class YBM_Common_Helper_Log_Abstract extends Mage_Core_Helper_Abstract {
3
+ /**
4
+ *
5
+ * @return boolean
6
+ */
7
+ public abstract function isLoggingEnabled();
8
+
9
+ /**
10
+ *
11
+ * @return int
12
+ */
13
+ public abstract function getMaxLogLevel();
14
+
15
+ /**
16
+ *
17
+ * @return string
18
+ */
19
+ public function getLogfile() {
20
+ return 'ybm.log';
21
+ }
22
+
23
+ /**
24
+ * Log exceptions
25
+ *
26
+ * @param Exception $e
27
+ */
28
+ public function logException(Exception $e, $logToSession = true) {
29
+ if ($logToSession) {
30
+ $this->logToSession ( "\n" . $e->getMessage (), Zend_Log::ERR );
31
+ }
32
+ $this->logToFile ( "\n" . $e->__toString (), Zend_Log::ERR );
33
+ }
34
+ /**
35
+ * Log to Mage::log
36
+ *
37
+ * @param unknown $message
38
+ * @param string $level
39
+ */
40
+ public function log($message, $level = null) {
41
+ $this->logToSession ( $message, $level );
42
+ $this->logToFile ( $message, $level );
43
+ }
44
+
45
+ /**
46
+ * Log to file only.
47
+ *
48
+ * @param unknown $message
49
+ * @param string $level
50
+ */
51
+ public function logToFile($message, $level = null) {
52
+ $level = is_null ( $level ) ? Zend_Log::DEBUG : ( int ) $level;
53
+
54
+ if (! $this->isLoggingEnabled ()) {
55
+ return;
56
+ }
57
+
58
+ if ($this->getMaxLogLevel () >= $level) {
59
+ Mage::log ( $message, $level, $this->getLogfile(), true );
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Log to session only.
65
+ *
66
+ * @param unknown $message
67
+ * @param string $level
68
+ */
69
+ public function logToSession($message, $level = null) {
70
+ $level = is_null ( $level ) ? Zend_Log::DEBUG : ( int ) $level;
71
+
72
+ $adminSession = Mage::getSingleton ( 'admin/session' );
73
+ /* @var $adminSession Mage_Admin_Model_Session */
74
+
75
+ // verify if the user is logged in to the backend
76
+ if ($adminSession->isLoggedIn ()) {
77
+ /* @var $adminhtmlSession Mage_Adminhtml_Model_Session */
78
+ $adminhtmlSession = Mage::getSingleton ( 'adminhtml/session' );
79
+
80
+ switch ($level) {
81
+ case Zend_Log::EMERG :
82
+ $adminhtmlSession->addError ( $message );
83
+ break;
84
+ case Zend_Log::ALERT :
85
+ $adminhtmlSession->addError ( $message );
86
+ break;
87
+ case Zend_Log::CRIT :
88
+ $adminhtmlSession->addError ( $message );
89
+ break;
90
+ case Zend_Log::ERR :
91
+ $adminhtmlSession->addError ( $message );
92
+ break;
93
+ case Zend_Log::WARN :
94
+ $adminhtmlSession->addWarning ( $message );
95
+ break;
96
+ case Zend_Log::NOTICE :
97
+ $adminhtmlSession->addNotice ( $message );
98
+ break;
99
+ case Zend_Log::INFO :
100
+ $adminhtmlSession->addSuccess ( $message );
101
+ break;
102
+ }
103
+ }
104
+ }
105
+ }
app/code/community/YBM/Common/Model/System/Config/Source/LogLevels.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class YBM_Common_Model_System_Config_Source_LogLevels {
3
+ protected $attributes;
4
+ public function __construct() {
5
+ $this->attributes = array (
6
+ array (
7
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'Disabled' ),
8
+ 'value' => - 1
9
+ ),
10
+ array (
11
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'EMERG' ),
12
+ 'value' => Zend_Log::EMERG
13
+ ),
14
+ array (
15
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'ALERT' ),
16
+ 'value' => Zend_Log::ALERT
17
+ ),
18
+ array (
19
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'CRIT' ),
20
+ 'value' => Zend_Log::CRIT
21
+ ),
22
+ array (
23
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'ERR' ),
24
+ 'value' => Zend_Log::ERR
25
+ ),
26
+ array (
27
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'WARN' ),
28
+ 'value' => Zend_Log::WARN
29
+ ),
30
+ array (
31
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'NOTICE' ),
32
+ 'value' => Zend_Log::NOTICE
33
+ ),
34
+ array (
35
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'INFO' ),
36
+ 'value' => Zend_Log::INFO
37
+ ),
38
+ array (
39
+ 'label' => Mage::helper ( 'ybmcommon/data' )->__ ( 'DEBUG' ),
40
+ 'value' => Zend_Log::DEBUG
41
+ )
42
+ );
43
+ }
44
+ public function toOptionArray($addEmpty = true) {
45
+ return $this->attributes;
46
+ }
47
+ public function toSelectArray() {
48
+ $result = array ();
49
+
50
+ foreach ( $this->attributes as $attribute ) {
51
+ $result [$attribute ['value']] = $attribute ['label'];
52
+ }
53
+
54
+ return $result;
55
+ }
56
+ }
app/code/community/YBM/Common/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <ybmcommon translate="title" module="ybmcommon">
12
+ <title>YBM Common Section</title>
13
+ </ybmcommon>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/community/YBM/Common/etc/config.xml CHANGED
@@ -8,7 +8,7 @@
8
  <config>
9
  <modules>
10
  <YBM_Common>
11
- <version>2.0.0</version>
12
  </YBM_Common>
13
  </modules>
14
  <adminhtml>
8
  <config>
9
  <modules>
10
  <YBM_Common>
11
+ <version>2.1.0</version>
12
  </YBM_Common>
13
  </modules>
14
  <adminhtml>
app/code/community/YBM/Common/etc/system.xml CHANGED
@@ -1,19 +1,19 @@
1
  <?xml version="1.0"?>
2
- <!-- /** * @category YBM * @package YBM_AdvancedPicklist * @copyright Copyright
3
- (c) 2013 Stephan Wienczny <stephan.wienczny@ybm-deutschland.de> */ -->
 
 
 
 
4
  <config>
5
  <tabs>
6
- <ybm
7
- translate="label"
8
- module="ybmcommon">
9
  <label>YBM Extensions</label>
10
  <sort_order>300</sort_order>
11
  </ybm>
12
  </tabs>
13
  <sections>
14
- <ybmcommon
15
- translate="label"
16
- module="ybmcommon">
17
  <label>Versions</label>
18
  <tab>ybm</tab>
19
  <frontend_type>text</frontend_type>
@@ -21,6 +21,7 @@
21
  <show_in_default>1</show_in_default>
22
  <show_in_website>1</show_in_website>
23
  <show_in_store>1</show_in_store>
 
24
  <groups>
25
  <version translate="label">
26
  <label>Version</label>
@@ -29,6 +30,7 @@
29
  <show_in_default>1</show_in_default>
30
  <show_in_website>1</show_in_website>
31
  <show_in_store>1</show_in_store>
 
32
  <fields>
33
  <common translate="label comment">
34
  <label>YBM_Common</label>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category YBM * @package YBM_Common
5
+ * @copyright Copyright (c) 2011-2015 Stephan Wienczny <stephan.wienczny@ybm-deutschland.de>
6
+ */
7
+ -->
8
  <config>
9
  <tabs>
10
+ <ybm translate="label" module="ybmcommon">
 
 
11
  <label>YBM Extensions</label>
12
  <sort_order>300</sort_order>
13
  </ybm>
14
  </tabs>
15
  <sections>
16
+ <ybmcommon translate="label" module="ybmcommon">
 
 
17
  <label>Versions</label>
18
  <tab>ybm</tab>
19
  <frontend_type>text</frontend_type>
21
  <show_in_default>1</show_in_default>
22
  <show_in_website>1</show_in_website>
23
  <show_in_store>1</show_in_store>
24
+ <expanded>0</expanded>
25
  <groups>
26
  <version translate="label">
27
  <label>Version</label>
30
  <show_in_default>1</show_in_default>
31
  <show_in_website>1</show_in_website>
32
  <show_in_store>1</show_in_store>
33
+ <expanded>1</expanded>
34
  <fields>
35
  <common translate="label comment">
36
  <label>YBM_Common</label>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>YBM_Common</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license>--</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>The extension contains shared code</description>
11
  <notes>--</notes>
12
  <authors><author><name>Puderbach und Wienczny GbR</name><user>ybmdeutschland</user><email>info@ybm-deutschland.de</email></author></authors>
13
- <date>2015-01-21</date>
14
- <time>14:29:17</time>
15
- <contents><target name="magecommunity"><dir><dir name="YBM"><dir name="Common"><dir><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="660c2eebeeaabdfb3756f98c06ee3b49"/></dir></dir><dir name="Helper"><file name="Abstract.php" hash="cec5fa6e4b7e0935ba9abf22e4376550"/><file name="Data.php" hash="83012aa0a33af6cfe0a3348bc0972cd1"/></dir><dir name="Model"><file name="Feed.php" hash="491453c871a560a9595970e0c4c9b1a2"/></dir><dir name="etc"><file name="config.xml" hash="03a33103ff318ea33057cb1ce66a63e0"/><file name="system.xml" hash="b3fce7f1f873f59ac26a033915abca84"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="YBM_Common.xml" hash="0d74806873be02797c6a6b5009e66a4f"/></dir></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="YBM_Common.csv" hash="896a5a381e91040585281d563d000a76"/></dir><dir name="en_US"><file name="YBM_Common.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></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>YBM_Common</name>
4
+ <version>2.1.0</version>
5
  <stability>stable</stability>
6
  <license>--</license>
7
  <channel>community</channel>
10
  <description>The extension contains shared code</description>
11
  <notes>--</notes>
12
  <authors><author><name>Puderbach und Wienczny GbR</name><user>ybmdeutschland</user><email>info@ybm-deutschland.de</email></author></authors>
13
+ <date>2015-07-23</date>
14
+ <time>12:55:52</time>
15
+ <contents><target name="magecommunity"><dir><dir name="YBM"><dir name="Common"><dir><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="660c2eebeeaabdfb3756f98c06ee3b49"/></dir></dir><dir name="Helper"><file name="Abstract.php" hash="cec5fa6e4b7e0935ba9abf22e4376550"/><file name="Data.php" hash="83012aa0a33af6cfe0a3348bc0972cd1"/><dir name="Log"><file name="Abstract.php" hash="d3d1b94240bc2f4532604542f7469958"/></dir></dir><dir name="Model"><file name="Feed.php" hash="491453c871a560a9595970e0c4c9b1a2"/><dir name="System"><dir name="Config"><dir name="Source"><file name="LogLevels.php" hash="42e9b0b8408dacc7805b30ee93b65ab3"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d27ef0e3f4de10e5cc18a3dc39a4803b"/><file name="config.xml" hash="756e3e418e3d4f700f52ee809018c41a"/><file name="system.xml" hash="dc9ca7b4367b45a5b448029e5e791c49"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="YBM_Common.xml" hash="0d74806873be02797c6a6b5009e66a4f"/></dir></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="YBM_Common.csv" hash="896a5a381e91040585281d563d000a76"/></dir><dir name="en_US"><file name="YBM_Common.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>