Revision 1701
Added by Luisehahne about 13 years ago
| frontend.functions.php | ||
|---|---|---|
| 3 | 3 |
* |
| 4 | 4 |
* @category framework |
| 5 | 5 |
* @package frontend.functions |
| 6 |
* @author WebsiteBaker Project |
|
| 7 |
* @copyright 2004-2009, Ryan Djurovich |
|
| 8 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
| 6 |
* @author Ryan Djurovich, WebsiteBaker Project |
|
| 7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V. |
|
| 9 | 8 |
* @link http://www.websitebaker2.org/ |
| 10 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 11 | 10 |
* @platform WebsiteBaker 2.8.x |
| ... | ... | |
| 79 | 78 |
* get relative link from database based on pages_dir |
| 80 | 79 |
* @global <type> $database |
| 81 | 80 |
* @param <type> $id |
| 82 |
* @return <type>
|
|
| 81 |
* @return <type> |
|
| 83 | 82 |
*/ |
| 84 | 83 |
function get_page_link( $id ) |
| 85 | 84 |
{
|
| ... | ... | |
| 238 | 237 |
* @global wb $wb |
| 239 | 238 |
* @global string $global_name |
| 240 | 239 |
* @param int $block |
| 240 |
* @param boolean true to print $content, false return $content |
|
| 241 | 241 |
* @return void |
| 242 | 242 |
*/ |
| 243 |
function page_content($block = 1) {
|
|
| 243 |
function page_content($block = 1, $echo=true) {
|
|
| 244 | 244 |
// Get outside objects |
| 245 | 245 |
global $TEXT,$MENU,$HEADING,$MESSAGE; |
| 246 | 246 |
global $globals; |
| ... | ... | |
| 248 | 248 |
global $wb; |
| 249 | 249 |
$admin = $wb; |
| 250 | 250 |
if ($wb->page_access_denied==true) {
|
| 251 |
echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'];
|
|
| 251 |
echo $MESSAGE['FRONTEND_SORRY_NO_VIEWING_PERMISSIONS'];
|
|
| 252 | 252 |
return; |
| 253 | 253 |
} |
| 254 | 254 |
if ($wb->page_no_active_sections==true) {
|
| 255 |
echo $MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'];
|
|
| 255 |
echo $MESSAGE['FRONTEND_SORRY_NO_ACTIVE_SECTIONS'];
|
|
| 256 | 256 |
return; |
| 257 | 257 |
} |
| 258 | 258 |
if(isset($globals) AND is_array($globals)) {
|
| ... | ... | |
| 288 | 288 |
$page_id = $wb->default_block_content; |
| 289 | 289 |
} else {
|
| 290 | 290 |
$page_id = $wb->default_page_id; |
| 291 |
}
|
|
| 291 |
} |
|
| 292 | 292 |
$sql = 'SELECT `section_id`, `module`, `publ_start`, `publ_end` '; |
| 293 | 293 |
$sql .= 'FROM `'.TABLE_PREFIX.'sections` '; |
| 294 | 294 |
$sql .= 'WHERE `page_id`='.$page_id.' AND `block`='.$block.' '; |
| ... | ... | |
| 326 | 326 |
$arr_string[0] = str_replace("_", " ", $arr_string[0]);
|
| 327 | 327 |
} |
| 328 | 328 |
echo search_highlight($content, $arr_string); |
| 329 |
} elseif($echo==true) {
|
|
| 330 |
echo $content; |
|
| 329 | 331 |
} else {
|
| 330 |
echo $content;
|
|
| 332 |
return $content;
|
|
| 331 | 333 |
} |
| 332 | 334 |
} |
| 333 |
} |
|
| 334 |
else {
|
|
| 335 |
} else {
|
|
| 335 | 336 |
require(PAGE_CONTENT); |
| 336 | 337 |
} |
| 337 | 338 |
} |
| ... | ... | |
| 640 | 641 |
print $head_links; |
| 641 | 642 |
} |
| 642 | 643 |
} |
| 643 |
|
|
| 644 |
/* |
|
| 644 | 645 |
function moveCssToHead($content) {
|
| 645 | 646 |
// move css definitions into head section |
| 646 | 647 |
$pattern1 = '/(?:<body.*?)(<link[^>]*?\"text\/css\".*?\/>)/si'; |
| 647 |
$pattern2 = '/(?:<body.*?)(<style[^>]*?\"text\/css\"[^>]*?>.*?<\/style>)/si'; |
|
| 648 |
$pattern2 = '/(?:<body.*?)(<style[^>]*?\"text\/css\"[^>]* ?>.*?<\/style>)/si';
|
|
| 648 | 649 |
while(preg_match($pattern1, $content, $matches)==1) {
|
| 649 | 650 |
// loop through all linked CSS |
| 650 | 651 |
$insert = $matches[1]; |
| ... | ... | |
| 661 | 662 |
} |
| 662 | 663 |
return $content; |
| 663 | 664 |
} |
| 665 |
*/ |
|
Also available in: Unified diff
! /framework/frontend.functions
! change multi-dimensional arrays (variables) to similar arrays
! method page_content, add parameter $echo true to print $content, false return $content