iturgeon/fuelfilter

Allows View Filtering with custom filters in FuelPHP framework

1.0.0 2014-02-22 18:52 UTC

This package is not auto-updated.

Last update: 2024-03-26 02:47:33 UTC


README

This little add-on lets you create new FuelPHP View Filters that process the strings generated by a rendered View.

No Follow Filter

Included in the code is a sample No Follow Filter. This filter injects rel="nofollow" into html links.

Usage:

	// create a new view (these extend FuelPHP's View Class)
	$view = \Filter\View::forge('myView');
	$view->add_filters(\Filter\NoFollow::forge());
	echo($view);

Creating Custom Filters

Create a new Filter class that extends our Filter class.

For example: this class named /fuel/app/classes/reversefilter.php

<?
namespace \Filter;

class ReverseFilter extends Filter
{
	public static function process($string)
	{
		return strrev($string);
	}
}

Usage:

	// create a new view (these extend FuelPHP's View Class)
	$view = \Filter\View::forge('myView');
	$view->add_filters(ReverseFilter::forge());
	echo($view);

Installation

The easiest way to install in Fuel is to use composer.

  1. Add "iturgeon/fuelfilter" : "1.0.*" to your require section in composer.json
  2. Run php composer.phar update

Sample Section of composer.json:

"require": {
    ...
    "iturgeon/fuelfilter" : "1.0.*"
}