source: sandbox/newExpressoMail/newExpressoMail/Assetic/Filter/PhpCssEmbedFilter.php @ 7265

Revision 7265, 1.1 KB checked in by gustavo, 12 years ago (diff)

Ticket #0000 - Criado novo modulo para o desenvolvimento do novo ExpressoMail?

  • Property svn:executable set to *
Line 
1<?php
2
3/*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2012 OpenSky Project Inc
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Assetic\Filter;
13
14use CssEmbed\CssEmbed;
15use Assetic\Asset\AssetInterface;
16
17/**
18 * A filter that embed url directly into css
19 *
20 * @author Pierre Tachoire <pierre.tachoire@gmail.com>
21 * @link https://github.com/krichprollsch/phpCssEmbed
22 */
23class PhpCssEmbedFilter implements FilterInterface
24{
25    private $presets = array();
26
27    public function setPresets(array $presets)
28    {
29        $this->presets = $presets;
30    }
31
32    public function filterLoad(AssetInterface $asset)
33    {
34        $root = $asset->getSourceRoot();
35        $path = $asset->getSourcePath();
36
37        $pce = new CssEmbed();
38        if ($root && $path) {
39            $pce->setRootDir(dirname($root.'/'.$path));
40        }
41
42        $asset->setContent($pce->embedString($asset->getContent()));
43    }
44
45    public function filterDump(AssetInterface $asset)
46    {
47    }
48}
Note: See TracBrowser for help on using the repository browser.