Textpattern | PHP Cross Reference | Content Management Systems |
Description: Nl2Br filter.
1 <?php 2 3 /* 4 * Textpattern Content Management System 5 * http://textpattern.com 6 * 7 * Copyright (C) 2016 The Textpattern Development Team 8 * 9 * This file is part of Textpattern. 10 * 11 * Textpattern is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation, version 2. 14 * 15 * Textpattern is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with Textpattern. If not, see <http://www.gnu.org/licenses/>. 22 */ 23 24 /** 25 * Nl2Br filter. 26 * 27 * This filter converts line breaks to HTML <br /> tags. 28 * 29 * @since 4.6.0 30 * @package Textfilter 31 */ 32 33 namespace Textpattern\Textfilter; 34 35 class Nl2Br extends Base implements TextfilterInterface 36 { 37 /** 38 * Constructor. 39 */ 40 41 public function __construct() 42 { 43 parent::__construct(CONVERT_LINEBREAKS, gTxt('convert_linebreaks')); 44 } 45 46 /** 47 * Filter. 48 * 49 * @param string $thing 50 * @param array $options 51 */ 52 53 public function filter($thing, $options) 54 { 55 parent::filter($thing, $options); 56 57 return nl2br(trim($thing)); 58 } 59 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title