Skip to content

Commit

Permalink
Merge branch 'release/v1.8.29'
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosescri committed Jul 16, 2019
2 parents 7b10ceb + 4ca6202 commit 8513b58
Show file tree
Hide file tree
Showing 55 changed files with 105 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Adminhtml_Log_View extends Mage_Adminhtml_Block_Widget_Grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Adminhtml_Map_Additional extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Doofinder/Feed/Block/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Banner extends Mage_Core_Block_Template
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Doofinder/Feed/Block/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Integration extends Mage_Core_Block_Abstract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Buttons_Generate extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Buttons_ViewLog extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Doofinder/Feed/Block/Settings/Locks.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Locks extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_AtomicUpdates extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_CronDescription extends Doofinder_Feed_Block_Settings_Panel_Description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_Datetime extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_Description extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_DynamicFeedUrl extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_File extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_LayerDescription extends Doofinder_Feed_Block_Settings_Panel_Description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category blocks
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Block_Settings_Panel_Message extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Doofinder/Feed/Helper/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Helpers
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Data helper for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
class Doofinder_Feed_Helper_Banner extends Mage_Core_Helper_Abstract
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Doofinder/Feed/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Helpers
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Data helper for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
class Doofinder_Feed_Helper_Data extends Mage_Core_Helper_Abstract
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Doofinder/Feed/Helper/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Helpers
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Log helper for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
class Doofinder_Feed_Helper_Log extends Mage_Core_Helper_Abstract
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Doofinder/Feed/Helper/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category Helpers
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Helper_Tax extends Mage_Tax_Helper_Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Model_Adminhtml_System_Config_Backend_Cron extends Mage_Core_Model_Config_Data
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Doofinder/Feed/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Config model for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
class Doofinder_Feed_Model_Config extends Mage_Core_Model_Config_Data
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Doofinder/Feed/Model/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Model_Cron extends Mage_Core_Model_Abstract
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Doofinder/Feed/Model/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Generator model for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
if (!defined('DS'))
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Doofinder/Feed/Model/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

class Doofinder_Feed_Model_Log extends Mage_Core_Model_Abstract
Expand Down
42 changes: 28 additions & 14 deletions app/code/community/Doofinder/Feed/Model/Map/Product/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Abstract Product Map Model for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
class Doofinder_Feed_Model_Map_Product_Abstract extends Varien_Object
Expand All @@ -26,6 +26,15 @@ class Doofinder_Feed_Model_Map_Product_Abstract extends Varien_Object
*/
protected $_log;

// Default attributes which shouldn't be escaped from slash
private $defaultNonEscapedSlash = [
'name',
'description',
'short_description',
'sku',
'id',
];

/**
* Initialize log
*/
Expand Down Expand Up @@ -144,7 +153,7 @@ protected function mapAttribute($params = array())

$fieldData = $this->getAttributeValue($product, $attribute);

return $this->cleanField($fieldData);
return $this->cleanField($fieldData, $attribute->getAttributeCode());
}

protected function mapAttributeDescription($params = array())
Expand All @@ -160,7 +169,7 @@ protected function mapAttributeDescription($params = array())

$description = $this->getAttributeValue($product, $attribute);

return $this->cleanField($description);
return $this->cleanField($description, $attribute->getAttributeCode());
}

protected function mapDirectiveId()
Expand Down Expand Up @@ -425,15 +434,15 @@ public function loadAssocIds($product, $storeId)
return $assocIds;
}

protected function cleanField($field)
protected function cleanField($field, $code = '')
{
if (is_array($field)) {
foreach ($field as &$value) {
$value = $this->cleanFieldValue($value);
$value = $this->cleanFieldValue($value, $code);
unset($value);
}
} else {
$field = $this->cleanFieldValue($field);
$field = $this->cleanFieldValue($field, $code);
}

return $field;
Expand All @@ -443,22 +452,23 @@ protected function cleanField($field)
* Cleans invalid utf8 characters, strips tags and trims
*
* @param string|array $field
* @param string $code
*/
protected function cleanFieldValue($field)
protected function cleanFieldValue($field, $code = '')
{
// Do nothing if field is empty
if (!$field) return $field;

$cleaned = $this->cleanFieldValueArray((array) $field);
$cleaned = $this->cleanFieldValueArray((array) $field, (array) $code);
return is_array($field) ? $cleaned : $cleaned[0];
}

protected function cleanFieldValueArray($fields)
protected function cleanFieldValueArray($fields, $code)
{
return array_map(array($this, '_cleanFieldValue'), $fields);
return array_map(array($this, '_cleanFieldValue'), $fields, $code);
}

protected function _cleanFieldValue($field)
protected function _cleanFieldValue($field, $code)
{
// http://stackoverflow.com/questions/4224141/php-removing-invalid-utf-8-characters-in-xml-using-filter
$validUtf = '/([\x09\x0A\x0D\x20-\x7E]|[\xC2-\xDF][\x80-\xBF]|' .
Expand All @@ -470,8 +480,12 @@ protected function _cleanFieldValue($field)
$field = strip_tags($field);
$field = preg_replace('/[ ]{2,}/', ' ', $field);
$field = trim($field);
// Use a double slash to prevent the doofinder from treating it as a separator
$field = str_replace('/', '//', $field);

if (!in_array($code, $this->defaultNonEscapedSlash)) {
// Use a double slash to prevent the doofinder from treating it as a separator
$field = str_replace('/', '//', $field);
}

// @codingStandardsIgnoreStart
$field = html_entity_decode($field, null, 'UTF-8');
// @codingStandardsIgnoreEnd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Associated Product Map Model for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
class Doofinder_Feed_Model_Map_Product_Associated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/**
* @category Models
* @package Doofinder_Feed
* @version 1.8.28
* @version 1.8.29
*/

/**
* Bundle Product Map Model for Doofinder Feed
*
* @version 1.8.28
* @version 1.8.29
* @package Doofinder_Feed
*/
class Doofinder_Feed_Model_Map_Product_Bundle
Expand Down
Loading

0 comments on commit 8513b58

Please sign in to comment.