sfTidyPlugin - 1.0.2

Code fixing plugin.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfTidyPlugin

The sfTidyPlugin is a symfony plugin that provides automated code repair (ex. users input from TinyMCE or FCKEditor). The TidyHelper produce valid XHTML or XML code. Plugin requires PHP Tidy extension.

The TidyHelper extesnion can fix sample broken code:

<p>ala <b> ma kota & psa<br />Lorem ipsum

to valid XHTML:

<p>ala <b> ma kota &amp; psa<br />Lorem ipsum</b></p>

Installation

  • Install PHP Tidy

    Installation instructions can be found on PHP Manual - Tidy

  • Install the plugin

    $ php symfony plugin:install sfTidyPlugin
    
  • Clear cache

    $ php symfony cc
    
  • Optionally add the TidyHelper to global helpers list. Add the following to settings.yml:

    all:
      .settings:
      standard_helpers: [Partial, Cache, Form, Tidy]

Usage

If there are no the Tidy in standard_helpers list you should add:

<?php use_helper('Tidy') ?>

The sfTidyHelper contain two metods. First to cleanup XHTML code: tidy and second to cleanup XML code tidy_xml.

<?php echo tidy('<p>ala <b> ma kota & psa<br />Lorem ipsum') ?>
<!-- Output: <p>ala <b> ma kota &amp; psa<br />Lorem ipsum</b></p> -->