function BB_ProcessPage($retcache, $dumpcache, $easyedit)
{
    global $bb_page, $bb_langpage, $bb_doctypes, $bb_mode, $bb_css, $bb_js, $bb_use_premainjs, $bb_paths;
    $bb_mode = "prehtml";
    BB_ProcessMasterWidget("root");
    $result = "";
    if ($retcache) {
        ob_start();
    }
    echo $bb_doctypes[$bb_page["doctype"]];
    echo "<head>\n";
    echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n";
    if ($bb_langpage["title"] != "") {
        echo "<title>" . htmlspecialchars($bb_langpage["title"]) . "</title>\n";
    }
    if ($bb_langpage["metadesc"] != "") {
        echo "<meta name=\"description\" content=\"" . htmlspecialchars($bb_langpage["metadesc"]) . "\" />\n";
    }
    if ($bb_page["metarobots"] != "") {
        echo "<meta name=\"robots\" content=\"" . htmlspecialchars($bb_page["metarobots"]) . "\" />\n";
    }
    if (defined("BB_MODE_EDIT")) {
        echo "<base target=\"_top\" />\n";
    }
    $bb_css = array();
    $bb_js = array();
    $bb_mode = "head";
    $bb_use_premainjs = false;
    BB_ProcessMasterWidget("root");
    foreach ($bb_css as $url => $path) {
        echo "<link rel=\"stylesheet\" href=\"" . htmlspecialchars($url) . "\" type=\"text/css\" media=\"" . (is_array($path) ? htmlspecialchars($path[1]) : "all") . "\" />\n";
    }
    if ($bb_use_premainjs && function_exists("BB_PreMainJS")) {
        BB_PreMainJS();
    }
    foreach ($bb_js as $url => $path) {
        echo "<script type=\"text/javascript\" src=\"" . htmlspecialchars($url) . "\"></script>\n";
    }
    echo "</head>\n";
    echo "<body>\n";
    if ($bb_page["easyedit"] && $easyedit) {
        echo "<script type=\"text/javascript\" src=\"" . htmlspecialchars(isset($bb_paths) ? $bb_paths["ROOT_URL"] . "/" . $bb_paths["SUPPORT_PATH"] : ROOT_URL . "/" . SUPPORT_PATH) . "/js/easyedit.js\"></script>\n";
    }
    if ($retcache) {
        $result .= ob_get_contents();
        if ($dumpcache) {
            ob_end_flush();
        } else {
            ob_end_clean();
        }
        ob_start();
    }
    $bb_mode = "body";
    BB_ProcessMasterWidget("root");
    if ($retcache) {
        $result .= ob_get_contents();
        if ($dumpcache) {
            ob_end_flush();
        } else {
            ob_end_clean();
        }
        ob_start();
    }
    $bb_mode = "foot";
    BB_ProcessMasterWidget("root");
    echo "</body>\n";
    echo "</html>\n";
    if ($retcache) {
        $result .= ob_get_contents();
        if ($dumpcache) {
            ob_end_flush();
        } else {
            ob_end_clean();
        }
    }
    return $result;
}
Example #2
0
 public function Process()
 {
     global $bb_mode, $bb_widget, $bb_widget_id, $bb_css, $bb_js, $bb_extra, $bb_profile;
     if ($bb_widget->layout == "") {
         return;
     }
     if (!isset($this->info[$bb_profile])) {
         $profile = "";
     } else {
         $profile = $bb_profile;
     }
     if (!isset($this->info[$profile])) {
         return;
     }
     if ($bb_mode == "head") {
         $pos = strrpos($bb_widget->layout, ".");
         $name = substr($bb_widget->layout, 0, $pos) . ($bb_profile != "" ? "." . $bb_profile : "") . ".css";
         $bb_css[ROOT_URL . "/" . WIDGET_PATH . "/" . $this->layoutpath . "/" . $name] = ROOT_PATH . "/" . WIDGET_PATH . "/" . $this->layoutpath . "/" . $name;
         foreach ($this->info[$profile]["widgets"] as $num => $name) {
             if (substr($name, 0, 1) != "\$") {
                 $multi = true;
             } else {
                 $multi = false;
                 $name = substr($name, 1);
             }
             BB_ProcessMasterWidget($bb_widget_id . "_" . $name, $multi);
         }
     } else {
         if ($bb_mode == "body") {
             if (defined("BB_MODE_EDIT")) {
                 echo $this->info[$profile]["edit"];
             }
             foreach ($this->info[$profile]["widgets"] as $num => $name) {
                 echo $this->info[$profile]["chunks"][$num];
                 if (substr($name, 0, 1) != "\$") {
                     $multi = true;
                 } else {
                     $multi = false;
                     $name = substr($name, 1);
                 }
                 BB_ProcessMasterWidget($bb_widget_id . "_" . $name, $multi);
             }
             echo $this->info[$profile]["chunks"][count($this->info[$profile]["chunks"]) - 1];
         } else {
             foreach ($this->info[$profile]["widgets"] as $num => $name) {
                 if (substr($name, 0, 1) != "\$") {
                     $multi = true;
                 } else {
                     $multi = false;
                     $name = substr($name, 1);
                 }
                 BB_ProcessMasterWidget($bb_widget_id . "_" . $name, $multi);
             }
         }
     }
 }