Changeset 10616 for trunk/include/template.class.php
- Timestamp:
- Apr 25, 2011, 9:06:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r10503 r10616 923 923 private $did_head; 924 924 private $head_done_scripts; 925 private $did_footer; 925 926 926 927 private static $known_paths = array( … … 947 948 $this->inline_scripts = array(); 948 949 $this->head_done_scripts = array(); 949 $this->did_head = false;950 $this->did_head = $this->did_footer = false; 950 951 } 951 952 … … 957 958 function add_inline($code, $require) 958 959 { 960 !$this->did_footer || trigger_error("Attempt to add inline script but the footer has been written", E_USER_WARNING); 959 961 if(!empty($require)) 960 962 { … … 973 975 function add($id, $load_mode, $require, $path, $version=0) 974 976 { 975 if ($this->did_head && $load_mode==0 ) 976 { 977 trigger_error("Attempt to add a new script $id but the head has been written", E_USER_WARNING); 977 if ($this->did_head && $load_mode==0) 978 { 979 trigger_error("Attempt to add script $id but the head has been written", E_USER_WARNING); 980 } 981 elseif ($this->did_footer) 982 { 983 trigger_error("Attempt to add script $id but the footer has been written", E_USER_WARNING); 978 984 } 979 985 if (! isset( $this->registered_scripts[$id] ) ) … … 982 988 self::fill_well_known($id, $script); 983 989 $this->registered_scripts[$id] = $script; 990 991 // Load or modify all UI core files 992 if ($id == 'jquery.ui' and $script->path == self::$known_paths['jquery.ui']) 993 { 994 foreach (self::$ui_core_dependencies as $script_id => $required_ids) 995 $this->add($script_id, $load_mode, $required_ids, null, $version); 996 } 997 998 // Try to load undefined required script 999 foreach ($script->precedents as $script_id) 1000 { 1001 if (! isset( $this->registered_scripts[$script_id] ) ) 1002 $this->load_known_required_script($script_id, $load_mode); 1003 } 984 1004 } 985 1005 else 986 1006 { 987 $script = &$this->registered_scripts[$id];1007 $script = $this->registered_scripts[$id]; 988 1008 if (count($require)) 989 1009 { … … 996 1016 $script->load_mode = $load_mode; 997 1017 } 998 // Load or modify all UI core files 999 if ($id == 'jquery.ui' and $script->path == self::$known_paths['jquery.ui']) 1000 { 1001 foreach (self::$ui_core_dependencies as $script_id => $required_ids) 1002 $this->add($script_id, $load_mode, $required_ids, null, $version); 1003 } 1004 1005 // Try to load undefined required script 1006 foreach ($script->precedents as $script_id) 1007 { 1008 if (! isset( $this->registered_scripts[$script_id] ) ) 1009 $this->load_known_required_script($script_id, $load_mode); 1010 } 1018 1011 1019 } 1012 1020 … … 1041 1049 function get_footer_scripts() 1042 1050 { 1051 $this->did_head || trigger_error("Footer scripts before header scripts ?", E_USER_WARNING); 1052 $this->did_footer = true; 1043 1053 $todo = array(); 1044 1054 foreach( $this->registered_scripts as $id => $script) … … 1102 1112 { 1103 1113 $load = $script->load_mode; 1104 /*if ($load==0)1105 continue;*/1106 1114 foreach( $script->precedents as $precedent) 1107 1115 { … … 1177 1185 } 1178 1186 $recursion_limiter<5 or fatal_error("combined script circular dependency"); 1179 $script = &$this->registered_scripts[$script_id];1187 $script = $this->registered_scripts[$script_id]; 1180 1188 if (isset($script->extra['order'])) 1181 1189 return $script->extra['order'];
Note: See TracChangeset
for help on using the changeset viewer.