Bolt\Helpers\Html::decorateTT PHP 메소드

decorateTT() 공개 정적인 메소드

Transforms plain text to HTML. Plot twist: text between backticks (`) is wrapped in a element.
public static decorateTT ( string $str ) : string
$str string Input string. Treated as plain text.
리턴 string The resulting HTML
    public static function decorateTT($str)
    {
        $str = htmlspecialchars($str, ENT_QUOTES);
        $str = preg_replace('/`([^`]*)`/', '<tt>\\1</tt>', $str);
        return $str;
    }

Usage Example

예제 #1
0
 public function testDecorateTT()
 {
     $input = 'Lorem `ipsum` dolor.';
     $this->assertEquals('Lorem <tt>ipsum</tt> dolor.', Html::decorateTT($input));
 }
All Usage Examples Of Bolt\Helpers\Html::decorateTT