@@ 1171-1250 (lines=80) @@ | ||
1168 | * |
|
1169 | * modified by ci-phpunit-test |
|
1170 | */ |
|
1171 | protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name) |
|
1172 | { |
|
1173 | $prefix = 'CI_'; |
|
1174 | ||
1175 | // if (class_exists($prefix.$library_name, FALSE)) |
|
1176 | { |
|
1177 | if (class_exists(config_item('subclass_prefix').$library_name, FALSE)) |
|
1178 | { |
|
1179 | $prefix = config_item('subclass_prefix'); |
|
1180 | } |
|
1181 | ||
1182 | // Before we deem this to be a duplicate request, let's see |
|
1183 | // if a custom object name is being supplied. If so, we'll |
|
1184 | // return a new instance of the object |
|
1185 | if ($object_name !== NULL) |
|
1186 | { |
|
1187 | $CI =& get_instance(); |
|
1188 | if ( ! isset($CI->$object_name)) |
|
1189 | { |
|
1190 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
|
1191 | } |
|
1192 | } |
|
1193 | ||
1194 | // log_message('debug', $library_name.' class already loaded. Second attempt ignored.'); |
|
1195 | // return; |
|
1196 | } |
|
1197 | ||
1198 | $paths = $this->_ci_library_paths; |
|
1199 | array_pop($paths); // BASEPATH |
|
1200 | array_pop($paths); // APPPATH (needs to be the first path checked) |
|
1201 | array_unshift($paths, APPPATH); |
|
1202 | ||
1203 | foreach ($paths as $path) |
|
1204 | { |
|
1205 | if (file_exists($path = $path.'libraries/'.$file_path.$library_name.'.php')) |
|
1206 | { |
|
1207 | // Override |
|
1208 | include_once($path); |
|
1209 | // if (class_exists($prefix.$library_name, FALSE)) |
|
1210 | { |
|
1211 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
|
1212 | } |
|
1213 | // else |
|
1214 | // { |
|
1215 | // log_message('debug', $path.' exists, but does not declare '.$prefix.$library_name); |
|
1216 | // } |
|
1217 | } |
|
1218 | } |
|
1219 | ||
1220 | // Replace library in ci-phpuni-test |
|
1221 | if (file_exists(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
|
1222 | { |
|
1223 | include_once(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
|
1224 | } |
|
1225 | else |
|
1226 | { |
|
1227 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
|
1228 | } |
|
1229 | ||
1230 | // Check for extensions |
|
1231 | $subclass = config_item('subclass_prefix').$library_name; |
|
1232 | foreach ($paths as $path) |
|
1233 | { |
|
1234 | if (file_exists($path = $path.'libraries/'.$file_path.$subclass.'.php')) |
|
1235 | { |
|
1236 | include_once($path); |
|
1237 | if (class_exists($subclass, FALSE)) |
|
1238 | { |
|
1239 | $prefix = config_item('subclass_prefix'); |
|
1240 | break; |
|
1241 | } |
|
1242 | else |
|
1243 | { |
|
1244 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
|
1245 | } |
|
1246 | } |
|
1247 | } |
|
1248 | ||
1249 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
|
1250 | } |
|
1251 | ||
1252 | // -------------------------------------------------------------------- |
|
1253 |
@@ 1160-1239 (lines=80) @@ | ||
1157 | * |
|
1158 | * modified by ci-phpunit-test |
|
1159 | */ |
|
1160 | protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name) |
|
1161 | { |
|
1162 | $prefix = 'CI_'; |
|
1163 | ||
1164 | // if (class_exists($prefix.$library_name, FALSE)) |
|
1165 | { |
|
1166 | if (class_exists(config_item('subclass_prefix').$library_name, FALSE)) |
|
1167 | { |
|
1168 | $prefix = config_item('subclass_prefix'); |
|
1169 | } |
|
1170 | ||
1171 | // Before we deem this to be a duplicate request, let's see |
|
1172 | // if a custom object name is being supplied. If so, we'll |
|
1173 | // return a new instance of the object |
|
1174 | if ($object_name !== NULL) |
|
1175 | { |
|
1176 | $CI =& get_instance(); |
|
1177 | if ( ! isset($CI->$object_name)) |
|
1178 | { |
|
1179 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
|
1180 | } |
|
1181 | } |
|
1182 | ||
1183 | // log_message('debug', $library_name.' class already loaded. Second attempt ignored.'); |
|
1184 | // return; |
|
1185 | } |
|
1186 | ||
1187 | $paths = $this->_ci_library_paths; |
|
1188 | array_pop($paths); // BASEPATH |
|
1189 | array_pop($paths); // APPPATH (needs to be the first path checked) |
|
1190 | array_unshift($paths, APPPATH); |
|
1191 | ||
1192 | foreach ($paths as $path) |
|
1193 | { |
|
1194 | if (file_exists($path = $path.'libraries/'.$file_path.$library_name.'.php')) |
|
1195 | { |
|
1196 | // Override |
|
1197 | include_once($path); |
|
1198 | // if (class_exists($prefix.$library_name, FALSE)) |
|
1199 | { |
|
1200 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
|
1201 | } |
|
1202 | // else |
|
1203 | // { |
|
1204 | // log_message('debug', $path.' exists, but does not declare '.$prefix.$library_name); |
|
1205 | // } |
|
1206 | } |
|
1207 | } |
|
1208 | ||
1209 | // Replace library in ci-phpuni-test |
|
1210 | if (file_exists(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
|
1211 | { |
|
1212 | include_once(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
|
1213 | } |
|
1214 | else |
|
1215 | { |
|
1216 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
|
1217 | } |
|
1218 | ||
1219 | // Check for extensions |
|
1220 | $subclass = config_item('subclass_prefix').$library_name; |
|
1221 | foreach ($paths as $path) |
|
1222 | { |
|
1223 | if (file_exists($path = $path.'libraries/'.$file_path.$subclass.'.php')) |
|
1224 | { |
|
1225 | include_once($path); |
|
1226 | if (class_exists($subclass, FALSE)) |
|
1227 | { |
|
1228 | $prefix = config_item('subclass_prefix'); |
|
1229 | break; |
|
1230 | } |
|
1231 | else |
|
1232 | { |
|
1233 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
|
1234 | } |
|
1235 | } |
|
1236 | } |
|
1237 | ||
1238 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
|
1239 | } |
|
1240 | ||
1241 | // -------------------------------------------------------------------- |
|
1242 |