From cddc6a72142c66f67e40e855f82196ec39da4450 Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Tue, 31 Jan 2017 10:39:53 -0800 Subject: [PATCH] whitespace --- .gitignore | 2 ++ .../Block/Adminhtml/Customer/Email.php | 1 - .../Block/Adminhtml/Customer/Email/Grid.php | 1 - .../Block/Adminhtml/Event/Container.php | 1 - .../MailGun/Block/Adminhtml/Event/Grid.php | 3 +- .../Adminhtml/Event/Renderer/Timestamp.php | 4 +-- .../Block/Adminhtml/Event/Renderer/Type.php | 4 +-- .../Block/Adminhtml/Global/Container.php | 1 - .../MailGun/Block/Adminhtml/Global/Grid.php | 3 +- .../MailGun/Model/Email/Template.php | 6 ++-- .../Model/Exceptions/InvalidParameter.php | 2 -- .../Model/Exceptions/InvalidParameterType.php | 2 -- .../MissingRequiredMIMEParameters.php | 2 -- .../Model/Exceptions/TooManyParameters.php | 2 -- .../FreeLunchLabs/MailGun/Model/Mailgun.php | 4 --- .../MailGun/Model/Messagebuilder.php | 30 ++++++++++++++++--- .../Adminhtml/EmailtrackingController.php | 6 ++-- 17 files changed, 40 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 3309871..b048214 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.idea/ + .modgit/ app/code/community/Find/ app/code/community/Phoenix/ diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email.php index 95cd488..1407081 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email.php @@ -8,6 +8,5 @@ class FreeLunchLabs_MailGun_Block_Adminhtml_Customer_Email extends Mage_Adminhtm $this->_blockGroup = 'freelunchlabs_mailgun'; $this->_controller = 'adminhtml_customer_email'; $this->_headerText = false; - } } \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email/Grid.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email/Grid.php index 0e5f525..d2c366c 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email/Grid.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Customer/Email/Grid.php @@ -22,7 +22,6 @@ class FreeLunchLabs_MailGun_Block_Adminhtml_Customer_Email_Grid extends Mage_Adm } protected function _prepareColumns() { - $this->addColumn('subject', array( 'header' => 'Subject', 'type' => 'text', diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Container.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Container.php index 8bbd5ba..c8b3994 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Container.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Container.php @@ -8,6 +8,5 @@ class FreeLunchLabs_MailGun_Block_Adminhtml_Event_Container extends Mage_Adminht $this->_blockGroup = 'freelunchlabs_mailgun'; $this->_controller = 'adminhtml_event'; $this->_headerText = false; - } } \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Grid.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Grid.php index 7925c06..2a61e29 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Grid.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Grid.php @@ -14,13 +14,12 @@ class FreeLunchLabs_MailGun_Block_Adminhtml_Event_Grid extends Mage_Adminhtml_Bl protected function _prepareCollection() { $collection = Mage::getResourceModel('freelunchlabs_mailgun/event_collection'); $collection->addFieldToFilter('email_id', Mage::registry('current_email')->getId()); - $this->setCollection($collection); + return parent::_prepareCollection(); } protected function _prepareColumns() { - $this->addColumn('event_type', array( 'header' => 'Event', 'index' => 'event_type', diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Timestamp.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Timestamp.php index 718297d..200a438 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Timestamp.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Timestamp.php @@ -1,10 +1,10 @@ <?php class FreeLunchLabs_MailGun_Block_Adminhtml_Event_Renderer_Timestamp extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract { - public function render(Varien_Object $row) - { + public function render(Varien_Object $row) { $value = $row->getData($this->getColumn()->getIndex()); $date = Mage::getSingleton('core/date')->timestamp($value); + return Mage::helper('core')->formatDate(new Zend_Date($date), 'medium', true); } } \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Type.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Type.php index 74ed449..77d26e8 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Type.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Event/Renderer/Type.php @@ -1,9 +1,9 @@ <?php class FreeLunchLabs_MailGun_Block_Adminhtml_Event_Renderer_Type extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract { - public function render(Varien_Object $row) - { + public function render(Varien_Object $row) { $value = $row->getData($this->getColumn()->getIndex()); + return ucwords($value); } } \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Container.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Container.php index 210fd15..46a6bd6 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Container.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Container.php @@ -8,6 +8,5 @@ class FreeLunchLabs_MailGun_Block_Adminhtml_Global_Container extends Mage_Adminh $this->_blockGroup = 'freelunchlabs_mailgun'; $this->_controller = 'adminhtml_global'; $this->_headerText = false; - } } \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Grid.php b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Grid.php index fb353d1..5483be0 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Grid.php +++ b/app/code/community/FreeLunchLabs/MailGun/Block/Adminhtml/Global/Grid.php @@ -13,13 +13,12 @@ class FreeLunchLabs_MailGun_Block_Adminhtml_Global_Grid extends Mage_Adminhtml_B protected function _prepareCollection() { $collection = Mage::getResourceModel('freelunchlabs_mailgun/email_collection')->getGridCollection(); - $this->setCollection($collection); + return parent::_prepareCollection(); } protected function _prepareColumns() { - $this->addColumn('subject', array( 'header' => 'Subject', 'type' => 'text', diff --git a/app/code/community/FreeLunchLabs/MailGun/Model/Email/Template.php b/app/code/community/FreeLunchLabs/MailGun/Model/Email/Template.php index d174ddf..c0fc15d 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Model/Email/Template.php +++ b/app/code/community/FreeLunchLabs/MailGun/Model/Email/Template.php @@ -4,7 +4,7 @@ class FreeLunchLabs_MailGun_Model_Email_Template extends Mage_Core_Model_Email_T var $bcc = null; var $replyto = null; - var $returnPath = null; //This is not used because MailGun overides it for their internal purposes. + var $returnPath = null; //This is not used because MailGun overrides it for their internal purposes. public function send($email, $name = null, array $variables = array()) { //Get appropriate store @@ -125,17 +125,19 @@ class FreeLunchLabs_MailGun_Model_Email_Template extends Mage_Core_Model_Email_T public function addBcc($bcc) { $this->bcc = $bcc; + return parent::addBcc($bcc); } public function setReturnPath($email) { $this->returnPath = $email; + return parent::setReturnPath($email); - } public function setReplyTo($email) { $this->replyto = $email; + return parent::setReplyTo($email); } diff --git a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameter.php b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameter.php index 433686a..136a18d 100755 --- a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameter.php +++ b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameter.php @@ -1,5 +1,3 @@ <?php class FreeLunchLabs_MailGun_Model_Exceptions_InvalidParameter extends \Exception{} - -?> \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameterType.php b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameterType.php index 9c4e533..d5e5547 100755 --- a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameterType.php +++ b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/InvalidParameterType.php @@ -1,5 +1,3 @@ <?php class FreeLunchLabs_MailGun_Model_Exceptions_InvalidParameterType extends \Exception{} - -?> \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/MissingRequiredMIMEParameters.php b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/MissingRequiredMIMEParameters.php index e4badc8..2d30ee8 100755 --- a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/MissingRequiredMIMEParameters.php +++ b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/MissingRequiredMIMEParameters.php @@ -1,5 +1,3 @@ <?php class FreeLunchLabs_MailGun_Model_Exceptions_MissingRequiredMIMEParameters extends \Exception{} - -?> \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/TooManyParameters.php b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/TooManyParameters.php index df12fc6..d72100a 100755 --- a/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/TooManyParameters.php +++ b/app/code/community/FreeLunchLabs/MailGun/Model/Exceptions/TooManyParameters.php @@ -1,5 +1,3 @@ <?php class FreeLunchLabs_MailGun_Model_Exceptions_TooManyParameters extends \Exception{} - -?> \ No newline at end of file diff --git a/app/code/community/FreeLunchLabs/MailGun/Model/Mailgun.php b/app/code/community/FreeLunchLabs/MailGun/Model/Mailgun.php index c7a2845..952a831 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Model/Mailgun.php +++ b/app/code/community/FreeLunchLabs/MailGun/Model/Mailgun.php @@ -5,7 +5,6 @@ class FreeLunchLabs_MailGun_Model_Mailgun extends Mage_Core_Model_Abstract { public $apiUrl = "https://api.mailgun.net/v2/"; public function mailgunRequest($type, $domain, $apiKey, $data, $method = Zend_Http_Client::GET, $uriOveride = false, $files = null) { - $client = new Zend_Http_Client(); $client->setAuth("api", $apiKey); $client->setMethod($method); @@ -47,7 +46,6 @@ class FreeLunchLabs_MailGun_Model_Mailgun extends Mage_Core_Model_Abstract { } public function send($message) { - $domain = $message->getStore()->getConfig('mailgun/general/domain'); $apiKey = $message->getStore()->getConfig('mailgun/general/key'); $files = null; @@ -68,7 +66,6 @@ class FreeLunchLabs_MailGun_Model_Mailgun extends Mage_Core_Model_Abstract { } public function processEmailEventsForAllStores() { - $stores = Mage::getModel('core/store')->getCollection(); foreach($stores as $store) { @@ -79,7 +76,6 @@ class FreeLunchLabs_MailGun_Model_Mailgun extends Mage_Core_Model_Abstract { } public function processEmailEventsForSingleStore(Mage_Core_Model_Store $store) { - if($store->getConfig('mailgun/events/store')) { $data = array( diff --git a/app/code/community/FreeLunchLabs/MailGun/Model/Messagebuilder.php b/app/code/community/FreeLunchLabs/MailGun/Model/Messagebuilder.php index a3294f2..99616b5 100644 --- a/app/code/community/FreeLunchLabs/MailGun/Model/Messagebuilder.php +++ b/app/code/community/FreeLunchLabs/MailGun/Model/Messagebuilder.php @@ -26,19 +26,25 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { protected $variables = array(); protected $files = array(); protected $attachments = array(); - protected $counters = array('recipients' => array('to' => 0, + protected $counters = array( + 'recipients' => array( + 'to' => 0, 'cc' => 0, - 'bcc' => 0), - 'attributes' => array('attachment' => 0, + 'bcc' => 0, + ), + 'attributes' => array( + 'attachment' => 0, 'campaign_id' => 0, 'custom_option' => 0, - 'tag' => 0) + 'tag' => 0, + ), ); protected function safeGet($params, $key, $default) { if (array_key_exists($key, $params)) { return $params[$key]; } + return $default; } @@ -48,6 +54,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $last = $this->safeGet($params, "last", ""); return trim("$first $last"); } + return $this->safeGet($params, "full_name", ""); } @@ -59,6 +66,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { if ($fullName != null) { return "'$fullName' <$address>"; } + return $address; } @@ -82,6 +90,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { throw new FreeLunchLabs_MailGun_Model_Exceptions_TooManyParameters(TOO_MANY_PARAMETERS_RECIPIENT); } $this->addRecipient("to", $address, $variables); + return end($this->message['to']); } @@ -90,6 +99,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { throw new FreeLunchLabs_MailGun_Model_Exceptions_TooManyParameters(TOO_MANY_PARAMETERS_RECIPIENT); } $this->addRecipient("cc", $address, $variables); + return end($this->message['cc']); } @@ -98,16 +108,19 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { throw new FreeLunchLabs_MailGun_Model_Exceptions_TooManyParameters(TOO_MANY_PARAMETERS_RECIPIENT); } $this->addRecipient("bcc", $address, $variables); + return end($this->message['bcc']); } public function setFromAddress($address, $variables = null) { $this->addRecipient("from", $address, $variables); + return $this->message['from']; } public function setReplyToAddress($address, $variables = null) { $this->addRecipient("h:reply-to", $address, $variables); + return $this->message['h:reply-to']; } @@ -116,6 +129,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $subject = " "; } $this->message['subject'] = $subject; + return $this->message['subject']; } @@ -128,6 +142,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $headerName = "h:" . $headerName; } $this->message[$headerName] = array($headerData); + return $this->message[$headerName]; } @@ -136,6 +151,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $textBody = " "; } $this->message['text'] = $textBody; + return $this->message['text']; } @@ -144,6 +160,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $htmlBody = " "; } $this->message['html'] = $htmlBody; + return $this->message['html']; } @@ -187,6 +204,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $testMode = "no"; } $this->message['o:testmode'] = $testMode; + return $this->message['o:testmode']; } @@ -225,6 +243,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $enabled = "no"; } $this->message["o:dkim"] = $enabled; + return $this->message["o:dkim"]; } @@ -235,6 +254,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $enabled = "no"; } $this->message['o:tracking-opens'] = $enabled; + return $this->message['o:tracking-opens']; } @@ -247,6 +267,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $enabled = "no"; } $this->message['o:tracking-clicks'] = $enabled; + return $this->message['o:tracking-clicks']; } @@ -260,6 +281,7 @@ class FreeLunchLabs_MailGun_Model_Messagebuilder extends Varien_Object { $dateTimeObj = new DateTime($timeDate, $timeZoneObj); $formattedTimeDate = $dateTimeObj->format(DateTime::RFC2822); $this->message['o:deliverytime'] = $formattedTimeDate; + return $this->message['o:deliverytime']; } diff --git a/app/code/community/FreeLunchLabs/MailGun/controllers/Adminhtml/EmailtrackingController.php b/app/code/community/FreeLunchLabs/MailGun/controllers/Adminhtml/EmailtrackingController.php index 4a0af6d..7e3717a 100644 --- a/app/code/community/FreeLunchLabs/MailGun/controllers/Adminhtml/EmailtrackingController.php +++ b/app/code/community/FreeLunchLabs/MailGun/controllers/Adminhtml/EmailtrackingController.php @@ -2,8 +2,7 @@ class FreeLunchLabs_MailGun_Adminhtml_EmailtrackingController extends Mage_Adminhtml_Controller_Action { - protected function _initCustomer($idFieldName = 'id') - { + protected function _initCustomer($idFieldName = 'id') { $this->_title($this->__('Customers'))->_title($this->__('Manage Customers')); $customerId = (int) $this->getRequest()->getParam($idFieldName); @@ -29,8 +28,7 @@ class FreeLunchLabs_MailGun_Adminhtml_EmailtrackingController extends Mage_Admin return $this; } - public function emailGridAction() - { + public function emailGridAction() { $this->_initCustomer(); $this->loadLayout(); $gridBlock = $this->getLayout()->createBlock('freelunchlabs_mailgun/adminhtml_customer_email'); -- GitLab