Skip to content

Commit

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

#678 is on wrong repo ...

- added missing DOCs
- flipped @var annotations

* PSR2 fixes
  • Loading branch information
sreichel committed May 14, 2020
1 parent 321a946 commit 1bed2e9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 18 deletions.
12 changes: 10 additions & 2 deletions app/code/core/Mage/Contacts/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@
*/
class Mage_Contacts_Helper_Data extends Mage_Core_Helper_Abstract
{

const XML_PATH_ENABLED = 'contacts/contacts/enabled';

/**
* @return bool
*/
public function isEnabled()
{
return Mage::getStoreConfig( self::XML_PATH_ENABLED );
return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED);
}

/**
* @return string
*/
public function getUserName()
{
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
Expand All @@ -50,6 +55,9 @@ public function getUserName()
return trim($customer->getName());
}

/**
* @return string
*/
public function getUserEmail()
{
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ class Mage_Contacts_Model_System_Config_Backend_Links extends Mage_Adminhtml_Mod
* @var array
*/
protected $_cacheTags = array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG);

}
20 changes: 10 additions & 10 deletions app/code/core/Mage/Contacts/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@
*/
class Mage_Contacts_IndexController extends Mage_Core_Controller_Front_Action
{

const XML_PATH_EMAIL_RECIPIENT = 'contacts/email/recipient_email';
const XML_PATH_EMAIL_SENDER = 'contacts/email/sender_email_identity';
const XML_PATH_EMAIL_TEMPLATE = 'contacts/email/email_template';
const XML_PATH_ENABLED = 'contacts/contacts/enabled';

/**
* @return Mage_Core_Controller_Front_Action|void
*/
public function preDispatch()
{
parent::preDispatch();

if( !Mage::getStoreConfigFlag(self::XML_PATH_ENABLED) ) {
if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
$this->norouteAction();
}
}
Expand All @@ -52,7 +54,7 @@ public function indexAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('contactForm')
->setFormAction( Mage::getUrl('*/*/post', array('_secure' => $this->getRequest()->isSecure())) );
->setFormAction(Mage::getUrl('*/*/post', array('_secure' => $this->getRequest()->isSecure())));

$this->_initLayoutMessages('customer/session');
$this->_initLayoutMessages('catalog/session');
Expand All @@ -62,21 +64,21 @@ public function indexAction()
public function postAction()
{
$post = $this->getRequest()->getPost();
if ( $post ) {
if ($post) {
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
/* @var Mage_Core_Model_Translate $translate */
$translate->setTranslateInline(false);
try {
$postObject = new Varien_Object();
$postObject->setData($post);

$error = false;

if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
if (!Zend_Validate::is(trim($post['name']), 'NotEmpty')) {
$error = true;
}

if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) {
if (!Zend_Validate::is(trim($post['comment']), 'NotEmpty')) {
$error = true;
}

Expand All @@ -92,7 +94,7 @@ public function postAction()
throw new Exception();
}
$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
/* @var Mage_Core_Model_Email_Template $mailTemplate */
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
->setReplyTo($post['email'])
->sendTransactional(
Expand Down Expand Up @@ -120,10 +122,8 @@ public function postAction()
$this->_redirect('*/*/');
return;
}

} else {
$this->_redirect('*/*/');
}
}

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


/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */

$installer = $this;

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();

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

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */
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();

Expand Down

0 comments on commit 1bed2e9

Please sign in to comment.