コード例 #1
0
ファイル: class.jscss.php プロジェクト: ValenokPC/tabernacms
 /**
  * Add html tag to the <head> section
  * @static
  * @param $module
  * @param $filename
  * @param $html
  */
 public static function addFile($module, $filename, $html, $priority = 0)
 {
     //TODO: decide what should we do if the same $module/$filename is called multiple times with different $html.
     $isMain = rad_instances::isMainTemplate();
     $_isMain = $isMain ? 0 : 1;
     //Main template files first!
     if (isset(self::$file_info[$module][$filename])) {
         self::$file_info[$module][$filename]['templates'][] = rad_instances::getCurrentTemplate();
         if ($_isMain > self::$file_info[$module][$filename]['main']) {
             return;
         }
         //NB: We don't need to update priority, since files added in the main template are always loaded
         //before files, added in other templates.
         $old = self::$file_info[$module][$filename];
         if ($old['priority'] > $priority || $old['main'] > $_isMain) {
             self::$file_info[$module][$filename]['main'] = $_isMain;
             self::$file_info[$module][$filename]['priority'] = $priority;
             unset(self::$files[$old['main']][$old['priority']][$module][$filename]);
             self::$files[$_isMain][$priority][$module][$filename] = $html;
         }
     } else {
         self::$file_info[$module][$filename] = array('templates' => array(rad_instances::getCurrentTemplate()), 'main' => $_isMain, 'priority' => $priority);
         self::$files[$_isMain][$priority][$module][$filename] = $html;
     }
 }