Revision 1770
Added by Luisehahne about 13 years ago
| frontend.functions.php | ||
|---|---|---|
| 39 | 39 |
if(($resSnippets = $database->query($sql))) {
|
| 40 | 40 |
while($recSnippet = $resSnippets->fetchRow()) {
|
| 41 | 41 |
$module_dir = $recSnippet['directory']; |
| 42 |
if (file_exists(WB_PATH.'/modules/'.$module_dir.'/include.php')) {
|
|
| 42 |
if (is_readable(WB_PATH.'/modules/'.$module_dir.'/include.php')) {
|
|
| 43 | 43 |
include(WB_PATH.'/modules/'.$module_dir.'/include.php'); |
| 44 | 44 |
// check if frontend.css file needs to be included into the <head></head> of index.php |
| 45 |
if( file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.css')) {
|
|
| 45 |
|
|
| 46 |
if( is_readable(WB_PATH .'/modules/'.$module_dir.'/frontend.css')) {
|
|
| 46 | 47 |
$include_head_link_css .= '<link href="'.WB_URL.'/modules/'.$module_dir.'/frontend.css"'; |
| 47 | 48 |
$include_head_link_css .= ' rel="stylesheet" type="text/css" media="screen" />'."\n"; |
| 48 | 49 |
$include_head_file = 'frontend.css'; |
| 49 | 50 |
} |
| 50 | 51 |
// check if frontend.js file needs to be included into the <body></body> of index.php |
| 51 |
if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.js')) {
|
|
| 52 |
if(is_readable(WB_PATH .'/modules/'.$module_dir.'/frontend.js')) {
|
|
| 52 | 53 |
$include_head_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend.js" type="text/javascript"></script>'."\n"; |
| 53 | 54 |
$include_head_file = 'frontend.js'; |
| 54 | 55 |
} |
| 55 | 56 |
// check if frontend_body.js file needs to be included into the <body></body> of index.php |
| 56 |
if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend_body.js')) {
|
|
| 57 |
if(is_readable(WB_PATH .'/modules/'.$module_dir.'/frontend_body.js')) {
|
|
| 57 | 58 |
$include_body_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend_body.js" type="text/javascript"></script>'."\n"; |
| 58 | 59 |
$include_body_file = 'frontend_body.js'; |
| 59 | 60 |
} |
| ... | ... | |
| 468 | 469 |
$jquery_links .= '<script src="'.WB_URL.'/include/jquery/jquery-include.js" type="text/javascript"></script>'."\n"; |
| 469 | 470 |
/* workout to insert ui.css and theme */ |
| 470 | 471 |
$jquery_theme = WB_PATH.'/modules/jquery/jquery_theme.js'; |
| 471 |
$jquery_links .= file_exists($jquery_theme)
|
|
| 472 |
$jquery_links .= is_readable($jquery_theme)
|
|
| 472 | 473 |
? '<script src="'.WB_URL.'/modules/jquery/jquery_theme.js" type="text/javascript"></script>'."\n" |
| 473 | 474 |
: '<script src="'.WB_URL.'/include/jquery/jquery_theme.js" type="text/javascript"></script>'."\n"; |
| 474 | 475 |
/* workout to insert plugins functions, set in templatedir */ |
| 475 | 476 |
$jquery_frontend_file = TEMPLATE_DIR.'/jquery_frontend.js'; |
| 476 |
$jquery_links .= file_exists(str_replace( WB_URL, WB_PATH, $jquery_frontend_file))
|
|
| 477 |
$jquery_links .= is_readable(str_replace( WB_URL, WB_PATH, $jquery_frontend_file))
|
|
| 477 | 478 |
? '<script src="'.$jquery_frontend_file.'" type="text/javascript"></script>'."\n" |
| 478 | 479 |
: ''; |
| 479 | 480 |
} |
| ... | ... | |
| 525 | 526 |
while($row = $query_modules->fetchRow()) |
| 526 | 527 |
{
|
| 527 | 528 |
// check if page module directory contains a frontend_body.js file |
| 528 |
if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
|
|
| 529 |
if(is_readable(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
|
|
| 529 | 530 |
{
|
| 530 | 531 |
// create link with frontend_body.js source for the current module |
| 531 | 532 |
$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
|
| ... | ... | |
| 603 | 604 |
while($row = $query_modules->fetchRow()) |
| 604 | 605 |
{
|
| 605 | 606 |
// check if page module directory contains a frontend.js or frontend.css file |
| 606 |
if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
|
|
| 607 |
if(is_readable(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
|
|
| 607 | 608 |
{
|
| 608 | 609 |
// create link with frontend.js or frontend.css source for the current module |
| 609 | 610 |
$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
|
| ... | ... | |
| 637 | 638 |
print $head_links; |
| 638 | 639 |
} |
| 639 | 640 |
} |
| 640 |
/* |
|
| 641 |
function moveCssToHead($content) {
|
|
| 642 |
// move css definitions into head section |
|
| 643 |
$pattern1 = '/(?:<body.*?)(<link[^>]*?\"text\/css\".*?\/>)/si'; |
|
| 644 |
$pattern2 = '/(?:<body.*?)(<style[^>]*?\"text\/css\"[^>]* ?>.*?<\/style>)/si'; |
|
| 645 |
while(preg_match($pattern1, $content, $matches)==1) {
|
|
| 646 |
// loop through all linked CSS |
|
| 647 |
$insert = $matches[1]; |
|
| 648 |
$content = str_replace($insert, '', $content); |
|
| 649 |
$insert = "\n".$insert."\n</head>\n<body"; |
|
| 650 |
$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
|
|
| 651 |
} |
|
| 652 |
while(preg_match($pattern2, $content, $matches)==1) {
|
|
| 653 |
// loop through all inline CSS |
|
| 654 |
$insert = $matches[1]; |
|
| 655 |
$content = str_replace($insert, '', $content); |
|
| 656 |
$insert = "\n".$insert."\n</head>\n<body"; |
|
| 657 |
$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
|
|
| 658 |
} |
|
| 659 |
return $content; |
|
| 660 |
} |
|
| 661 |
*/ |
|
Also available in: Unified diff
WbDatabase::getTableEngine() changed SQL statement to strikt.
! remove empty warning box if you aren't sysadmin
! change order errorhandling in installation save.php
! Framework/frontend.functions.php change file_exists to is_readable