Skip to content

Commit

Permalink
Mage_AdminNotification - DOC block update (#695)
Browse files Browse the repository at this point in the history
* Mage_AdminNotification - DOC block update

- fixed wrong translation call

* PSR2 update
  • Loading branch information
sreichel authored May 14, 2020
1 parent 7b566ca commit 22bca85
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 24 deletions.
15 changes: 8 additions & 7 deletions app/code/core/Mage/AdminNotification/Model/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class Mage_AdminNotification_Model_Feed extends Mage_Core_Model_Abstract
*
*/
protected function _construct()
{}
{
}

/**
* Retrieve feed url
Expand Down Expand Up @@ -95,7 +96,6 @@ public function checkUpdate()
if ($feedData) {
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
}

}
$this->setLastUpdate();

Expand Down Expand Up @@ -151,7 +151,7 @@ public function setLastUpdate()
/**
* Retrieve feed data as XML element
*
* @return SimpleXMLElement
* @return SimpleXMLElement|false
*/
public function getFeedData()
{
Expand All @@ -170,21 +170,22 @@ public function getFeedData()

try {
$xml = new SimpleXMLElement($data);
}
catch (Exception $e) {
} catch (Exception $e) {
return false;
}

return $xml;
}

/**
* @return SimpleXMLElement
*/
public function getFeedXml()
{
try {
$data = $this->getFeedData();
$xml = new SimpleXMLElement($data);
}
catch (Exception $e) {
} catch (Exception $e) {
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?>');
}

Expand Down
5 changes: 3 additions & 2 deletions app/code/core/Mage/AdminNotification/Model/Inbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ protected function _construct()
/**
* Retrieve Severity collection array
*
* @return array|string
* @param int|null $severity
* @return array|string|null
*/
public function getSeverities($severity = null)
{
Expand Down Expand Up @@ -131,7 +132,7 @@ public function parse(array $data)
public function add($severity, $title, $description, $url = '', $isInternal = true)
{
if (!$this->getSeverities($severity)) {
Mage::throwException($this->__('Wrong message type'));
Mage::throwException(Mage::helper('adminnotification')->__('Wrong message type'));
}
if (is_array($description)) {
$description = '<ul><li>' . implode('</li><li>', $description) . '</li></ul>';
Expand Down
6 changes: 1 addition & 5 deletions app/code/core/Mage/AdminNotification/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ class Mage_AdminNotification_Model_Observer
*/
public function preDispatch(Varien_Event_Observer $observer)
{

if (Mage::getSingleton('admin/session')->isLoggedIn()) {

$feedModel = Mage::getModel('adminnotification/feed');
/* @var $feedModel Mage_AdminNotification_Model_Feed */
/* @var Mage_AdminNotification_Model_Feed $feedModel */

$feedModel->checkUpdate();

}

}
}
2 changes: 1 addition & 1 deletion app/code/core/Mage/AdminNotification/Model/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Mage_AdminNotification_Model_Survey
/**
* Check if survey url valid (exists) or not
*
* @return boolen
* @return bool
*/
public static function isSurveyUrlValid()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author Magento Core Team <core@magentocommerce.com>
*/
$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */

$installer->startSetup();
/**
Expand Down Expand Up @@ -71,12 +71,18 @@
'nullable' => false,
'default' => '0',
), 'Flag if notification might be removed')
->addIndex($installer->getIdxName('adminnotification/inbox', array('severity')),
array('severity'))
->addIndex($installer->getIdxName('adminnotification/inbox', array('is_read')),
array('is_read'))
->addIndex($installer->getIdxName('adminnotification/inbox', array('is_remove')),
array('is_remove'))
->addIndex(
$installer->getIdxName('adminnotification/inbox', array('severity')),
array('severity')
)
->addIndex(
$installer->getIdxName('adminnotification/inbox', array('is_read')),
array('is_read')
)
->addIndex(
$installer->getIdxName('adminnotification/inbox', array('is_remove')),
array('is_remove')
)
->setComment('Adminnotification Inbox');
$installer->getConnection()->createTable($table);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */

$installer->startSetup();
$installer->run("
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */
$installer = $this;
$installer->startSetup();

Expand Down

0 comments on commit 22bca85

Please sign in to comment.