1. Go to this page and download the library: Download joetannenbaum/mr-clean library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
joetannenbaum / mr-clean example snippets
$cleaner = new MrClean\MrClean();
$scrubbers = [
'trim',
'stripslashes',
'strip_tags',
'remove_weird_characters',
];
$scrubbed = $cleaner->scrubbers($scrubbers)->scrub('I\'m not that dirty.');
$cleaner->pre(['trim']);
$cleaner->post(['htmlentities']);
// trim will run before each of these, htmlentities after each
$cleaner->scrubbers(['strip_tags'])->scrub('This should be cleaned.')
$cleaner->scrubbers(['remove_weird_characters'])->scrub('So should this.')
$movies_seen = [
'The Dark Knight' => 'y',
'The Green Lantern' => 'n',
'The Avengers' => 'yes',
];
$scrubbed = $cleaner->scrubbers(['boolean'])->scrub( $movies_seen );
/*
[
'The Dark Knight' => true,
'The Green Lantern' => false,
'The Avengers' => true,
];
*/
$dirty = '<p><p>Some bad HTML here.</p><hr /><em></em><div>Soon to be cleaner.</div>';
$scrubbed = $cleaner->scrubbers(['html'])->scrub( $dirty );
// <p>Some bad HTML here.</p><div>Soon to be cleaner.</div>
$dirty = '<p style="font-weight:bold;" id="bold-el" class="boldest">This was once bold.</p>';
$scrubbed = $cleaner->scrubbers(['strip_css_attributes'])->scrub($dirty);
// <p>This was once bold.</p>
namespace Your\Namespace;
use MrClean\Scrubber\BaseScrubber;
class YourCustomScrubber extends BaseScrubber {
public function scrub()
{
return str_replace('!', '.', $this->value);
}
}