]> git.mxchange.org Git - friendica.git/blob - vendor/smarty/smarty/demo/plugins/cacheresource.pdo_gzip.php
Add Smarty to Composer
[friendica.git] / vendor / smarty / smarty / demo / plugins / cacheresource.pdo_gzip.php
1 <?php
2
3 /**
4  * PDO Cache Handler with GZIP support
5  * Example usage :
6  *      $cnx    =   new PDO("mysql:host=localhost;dbname=mydb", "username", "password");
7  *      $smarty->setCachingType('pdo_gzip');
8  *      $smarty->loadPlugin('Smarty_CacheResource_Pdo_Gzip');
9  *      $smarty->registerCacheResource('pdo_gzip', new Smarty_CacheResource_Pdo_Gzip($cnx, 'smarty_cache'));
10  *
11  * @require Smarty_CacheResource_Pdo class
12  * @author  Beno!t POLASZEK - 2014
13  */
14 require_once 'cacheresource.pdo.php';
15
16 class Smarty_CacheResource_Pdo_Gzip extends Smarty_CacheResource_Pdo
17 {
18
19     /* 
20      * Encodes the content before saving to database 
21      * 
22      * @param string $content 
23      * @return string $content 
24      * @access protected 
25      */
26     protected function inputContent($content)
27     {
28         return gzdeflate($content);
29     }
30
31     /* 
32      * Decodes the content before saving to database 
33      * 
34      * @param string $content 
35      * @return string $content 
36      * @access protected 
37      */
38     protected function outputContent($content)
39     {
40         return gzinflate($content);
41     }
42
43