Smarty
[ class tree: Smarty ] [ index: Smarty ] [ all elements ]

Source for file resource._custom.php

Documentation is available at resource._custom.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * -------------------------------------------------------------
  5.  * File:     resource._custom.php
  6.  * Type:     resource
  7.  * Name:     _custom
  8.  * Purpose:  Fetches templates from the correct package
  9.  * -------------------------------------------------------------
  10.  * @package Smarty
  11.  * @subpackage plugins
  12.  */
  13.  
  14. /**
  15.  * Smarty _Custom class
  16.  */
  17. class Smarty_Resource__Custom extends Smarty_Resource_Custom {
  18.  
  19.     protected function fetch $pTplName&$pTplSource&$pTplTime {
  20.         global $gBitLanguage$gBitThemes$gBitSmarty;
  21.         $ret '';
  22.  
  23.         // We're gonna run our own cache mechanism for user_modules
  24.         // the cache is here to avoid calls to consumming queries,
  25.         // each module is different for each language because of the strings
  26.         $cacheDir TEMP_PKG_PATH.'modules/cache/';
  27.         if!is_dir$cacheDir )) {
  28.             mkdir_p$cacheDir );
  29.         }
  30.         list$package$template explode(  '/'$pTplName );
  31.         $cacheFile $cacheDir.'_custom.'.$gBitLanguage->mLanguage.'.'.$template.'.tpl.cache';
  32.  
  33.         if!empty$r["cache_time"&& file_exists$cacheFile && !(( $gBitSystem->getUTCTime(filemtime$cacheFile )) $r["cache_time")) {
  34.             $pTplSource file_get_contents$cacheFile );
  35.         else {
  36.             global $moduleParams;
  37.             if$moduleParams $gBitThemes->getCustomModule$template )) {
  38.                 $gBitSmarty->assign_by_ref'moduleParams'$moduleParams );
  39.                 $pTplSource $gBitSmarty->fetch'bitpackage:themes/custom_module.tpl' );
  40.                 // write to chache file
  41.                 $fp fopen$cacheFile"w+" );
  42.                 fwrite$fp$datastrlen$data ));
  43.                 fclose$fp );
  44.             }
  45.         }
  46.         $pTplTime filemtime$cacheFile );
  47.     }
  48.  
  49.     protected function fetchTimestamp$pTplName {
  50.         return null;
  51.     }
  52.  
  53. }

Documentation generated on Wed, 29 Jul 2015 13:57:19 +0000 by phpDocumentor 1.5.0-lsces