-
-
Save boettner-it/110413b6e122237adfb1f0edf46965fb to your computer and use it in GitHub Desktop.
Text converter for Aimeos import jobs to respect linebreaks, newline, linefeeds, carriage returns and the like. Docs: https://aimeos.org/docs/Developers/Controller/Import_products_from_CSV#Data_converters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 | |
* @copyright Aimeos (aimeos.org), 2015-2018 | |
* @package MW | |
* @subpackage Convert | |
*/ | |
namespace Aimeos\MW\Convert\Text; | |
/** | |
* Converts latin text into UTF-8 | |
* | |
* @package MW | |
* @subpackage Convert | |
*/ | |
class Nl2Br implements \Aimeos\MW\Convert\Iface | |
{ | |
/** | |
* Translates a value to another one. | |
* | |
* @param mixed $value Value to translate | |
* @return mixed Translated value | |
*/ | |
public function translate( $value ) | |
{ | |
return nl2br( $value ); | |
} | |
/** | |
* Reverses the translation of the value. | |
* | |
* @param mixed $value Value to reverse | |
* @return mixed Reversed translation | |
*/ | |
public function reverse( $value ) | |
{ | |
return str_replace('<br/>', chr(10), $value ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment