Ejemplo n.º 1
0
 /**
  * Read a Marker File Template from FileSystem or from Persistent (Memory) Cache if exists
  * !!! This is intended for very special usage ... !!! This is used automatically by the render_file_template() and used in combination with render_mixed_template() may produce the same results ... it make non-sense using it with render_template() as this should be used for internal (php) templates as all external templates should be loaded with render_file_template()
  *
  * @access 		private
  * @internal
  *
  * @param 	STRING 		$y_file_path 					:: The relative path to the file markers template
  *
  * @return 	STRING										:: The template string
  *
  */
 public static function read_template_file($y_file_path)
 {
     //--
     $use_pcache = false;
     if ((string) SMART_FRAMEWORK_DEBUG_MODE != 'yes') {
         if (defined('SMART_SOFTWARE_MKTPL_PCACHETIME')) {
             if (is_int(SMART_SOFTWARE_MKTPL_PCACHETIME)) {
                 if ((int) SMART_SOFTWARE_MKTPL_PCACHETIME >= 0 and (int) SMART_SOFTWARE_MKTPL_PCACHETIME <= 31622400) {
                     // 0 unlimited ; 1 sec .. 366 days
                     $use_pcache = true;
                 }
                 //end if
             }
             //end if
         }
         //end if
     }
     //end if
     if ($use_pcache === true and SmartPersistentCache::isActive() and SmartPersistentCache::isMemoryBased()) {
         $the_cache_key = 'tpl__' . Smart::safe_pathname((string) Smart::base_name((string) $y_file_path)) . '__' . sha1((string) $y_file_path);
     } else {
         $the_cache_key = '';
     }
     //end if else
     //--
     $tpl = '';
     //--
     if ((string) $the_cache_key != '') {
         if (SmartPersistentCache::keyExists('smart-markers-templating', (string) $the_cache_key)) {
             $tpl = (string) SmartPersistentCache::getKey('smart-markers-templating', (string) $the_cache_key);
             if ((string) $tpl != '') {
                 //Smart::log_notice('TPL found in cache: '.$y_file_path);
                 return (string) $tpl;
                 // return from persistent cache
             }
             //end if
         }
         //end if
     }
     //end if
     //--
     $tpl = (string) SmartFileSystem::staticread((string) $y_file_path);
     if ((string) $the_cache_key != '') {
         if ((string) $tpl != '') {
             SmartPersistentCache::setKey('smart-markers-templating', (string) $the_cache_key . '__path', (string) $y_file_path, (int) SMART_SOFTWARE_MKTPL_PCACHETIME);
             // set to persistent cache
             SmartPersistentCache::setKey('smart-markers-templating', (string) $the_cache_key, (string) $tpl, (int) SMART_SOFTWARE_MKTPL_PCACHETIME);
             // set to persistent cache
         }
         //end if
     }
     //end if
     //--
     return (string) $tpl;
     // return from fs read
     //--
 }
 /**
  * Class constructor.
  * This is marked as FINAL and cannot be customized.
  */
 public final function __construct($y_module_path, $y_url_script, $y_url_path, $y_url_addr, $y_url_page, $y_controller)
 {
     //--
     if (SMART_FRAMEWORK_ADMIN_AREA === true) {
         $this->modulearea = 'admin';
     } else {
         $this->modulearea = 'index';
     }
     //end if else
     //--
     $this->modulepath = (string) $y_module_path;
     $this->modulename = (string) Smart::base_name($y_module_path);
     $this->urlscript = (string) $y_url_script;
     $this->urlpath = (string) $y_url_path;
     $this->urladdr = (string) $y_url_addr;
     $this->urlpage = (string) $y_url_page;
     $this->controller = (string) $y_controller;
     //--
     $this->pagesettings = array();
     $this->pageview = array();
     //--
 }