Revision 989
Added by aldus over 15 years ago
frontend.functions.php | ||
---|---|---|
338 | 338 |
// define default baselink and filename for optional module javascript and stylesheet files |
339 | 339 |
$head_links = ""; |
340 | 340 |
if($file_id == "css") { |
341 |
$base_link = '<link href="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.css"';
|
|
341 |
$base_link = '<link href="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.css"';
|
|
342 | 342 |
$base_link.= ' rel="stylesheet" type="text/css" media="screen" />'; |
343 | 343 |
$base_file = "frontend.css"; |
344 | 344 |
} else { |
... | ... | |
346 | 346 |
$base_file = "frontend.js"; |
347 | 347 |
} |
348 | 348 |
|
349 |
// gather information for all models embedded on actual page
|
|
349 |
// gather information for all models embedded on actual page
|
|
350 | 350 |
$page_id = $wb->page_id; |
351 |
$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
|
|
352 |
WHERE page_id=$page_id AND module<>'wysiwyg'"); |
|
351 |
$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
|
|
352 |
WHERE page_id=$page_id AND module<>'wysiwyg'");
|
|
353 | 353 |
|
354 |
while($row = $query_modules->fetchRow()) {
|
|
355 |
// check if page module directory contains a frontend.js or frontend.css file |
|
356 |
if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
|
|
357 |
// create link with frontend.js or frontend.css source for the current module |
|
354 |
while($row = $query_modules->fetchRow()) {
|
|
355 |
// check if page module directory contains a frontend.js or frontend.css file
|
|
356 |
if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
|
|
357 |
// create link with frontend.js or frontend.css source for the current module
|
|
358 | 358 |
$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link); |
359 | 359 |
|
360 |
// define constant indicating that the register_frontent_files was invoked
|
|
360 |
// define constant indicating that the register_frontent_files was invoked
|
|
361 | 361 |
if($file_id == 'css') { |
362 | 362 |
if(!defined('MOD_FRONTEND_CSS_REGISTERED')) define('MOD_FRONTEND_CSS_REGISTERED', true); |
363 | 363 |
} else { |
364 | 364 |
if(!defined('MOD_FRONTEND_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_JAVASCRIPT_REGISTERED', true); |
365 | 365 |
} |
366 |
|
|
367 |
// ensure that frontend.js or frontend.css is only added once per module type |
|
368 |
if(strpos($head_links, $tmp_link) === false) { |
|
366 |
// ensure that frontend.js or frontend.css is only added once per module type |
|
367 |
if(strpos($head_links, $tmp_link) === false) { |
|
369 | 368 |
$head_links .= $tmp_link ."\n"; |
370 | 369 |
} |
371 |
} |
|
372 |
} |
|
373 |
// include the Javascript email protection function |
|
374 |
if($file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js')) { |
|
375 |
$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/output_filter/js/mdcr.js"></script>' ."\n"; |
|
370 |
}; |
|
376 | 371 |
} |
377 |
|
|
378 |
// write out links with all external module javascript/CSS files, remove last line feed |
|
372 |
|
|
373 |
// include the Javascript email protection function |
|
374 |
if( $file_id != 'css' && file_exists(WB_PATH .'/modules/droplets/js/mdcr.js')) { |
|
375 |
$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/droplets/js/mdcr.js"></script>\n'; |
|
376 |
} elseif( $file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js')) { |
|
377 |
$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/output_filter/js/mdcr.js"></script>\n'; |
|
378 |
} |
|
379 | 379 |
echo $head_links; |
380 | 380 |
} |
381 | 381 |
} |
Also available in: Unified diff
Add Droplets Modul to the project and the modificated files (index, seach and frontendfunctions)