Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove dependency on PHP 5.3.2 or newer, should work with 5.2 again now

  • Loading branch information...
commit 1d509e125d0d00f2fef18af7c01d49b06a1893b6 1 parent e7a3ccd
@Vinai authored
Showing with 20 additions and 7 deletions.
  1. +20 −7 app/code/community/Netzarbeiter/CustomerActivation/Helper/Data.php
View
27 app/code/community/Netzarbeiter/CustomerActivation/Helper/Data.php
@@ -139,14 +139,27 @@ protected function _sendNotificationEmail($to, $customer, $templateConfigPath, $
*/
protected function _setEmailDesignConfig(Mage_Core_Model_Email_Template $mailTemplate, $storeId)
{
- // Workaround for bug in Mage_Core_Model_Template
- $method = new ReflectionMethod($mailTemplate, 'getDesignConfig');
- if ($method->isProtected()) {
- $method->setAccessible(true);
+ $this->_origEmailDesignConfig = null;
+
+ // Workaround for bug in Mage_Core_Model_Template where getDesignConfig is protected
+ if (is_callable(array($mailTemplate, 'getDesignConfig'))) {
+ // Use standard way to fetch the current design config (if possible)
+ $this->_origEmailDesignConfig = $mailTemplate->getDesignConfig();
+
+ } elseif (version_compare(phpversion(), '5.3.2', '>=')) {
+ // ReflectionMethod::setAccessible() is only available in 5.3.2 or newer
+ $method = new ReflectionMethod($mailTemplate, 'getDesignConfig');
+ if ($method->isProtected()) {
+ $method->setAccessible(true);
+ }
+ if ($this->_origEmailDesignConfig = $method->invoke($mailTemplate)) {
+ $this->_origEmailDesignConfig = $this->_origEmailDesignConfig->getData();
+ }
}
- if ($this->_origEmailDesignConfig = $method->invoke($mailTemplate)) {
- $this->_origEmailDesignConfig = $this->_origEmailDesignConfig->getData();
- } else {
+
+ // Fallback if neither of the previous versions is available or if
+ // there was no design configuration set on the mail template instance
+ if (! $this->_origEmailDesignConfig) {
$this->_origEmailDesignConfig = array(
'area' => Mage::app()->getStore()->isAdmin() ? 'adminhtml' : 'frontend',
'store' => Mage::app()->getStore()->getId()
Please sign in to comment.
Something went wrong with that request. Please try again.