2017 © Pedro Peláez
 

library text-formatter

A tool for handling the filtering of content.

image

chi-teck/text-formatter

A tool for handling the filtering of content.

  • Friday, January 10, 2014
  • by chi-teck
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Text Formatter

A tool for handling the filtering of content., (*1)

The code based on Drupal text filters system. Check out the documentation about how Drupal text filters work., (*2)

Usage

<?php

use ChiTeck\TextFormatter\TextFormatter;
use ChiTeck\TextFormatter\Filters\Html;
use ChiTeck\TextFormatter\Filters\Autop;
use ChiTeck\TextFormatter\Filters\Corrector;

$formatter = new TextFormatter([
    new Html(['allowedTags' => '<a>

<

ul><li>

<

p><br>']),
    new Autop(),
    new Corrector(),
]);

$safeText = $formatter->checkMarkup($text);

Supported filters

  • Html – Limits allowed HTML tags.
  • Autop – Converts line breaks into <p> and <br> in an intelligent fashion.
  • Corrector – Makes sure that HTML tags are properly closed.
  • Escape – Escapes all HTML tags, so they will be visible instead of being effective.
  • Nofollow – Adds rel="nofollow" to all links.

License

Text Formatter licensed under GPLv2., (*3)

The Versions

10/01 2014

dev-master

9999999-dev

A tool for handling the filtering of content.

  Sources   Download

GPL-2

The Requires

  • php >=5.3.3

 

filter html text formatter markup format