Пример #1
0
 public static function render($type, $owner)
 {
     $view = new ViewModel('views/user/comments.php');
     $view->registerVar('type', $type);
     $view->registerVar('owner', $owner);
     return $view->render();
 }
Пример #2
0
$container_id = 'cdc_' . mt_rand();
$wrapper_id = 'cdw_' . mt_rand();
$header->embedCss('#' . $wrapper_id . '{' . 'z-index:999;' . 'position:fixed;' . 'right:0;' . 'bottom:0;' . 'margin:2px;' . 'padding:2px;' . 'padding-top:0px;' . 'border:1px dashed #aaa;' . 'color:#000;' . 'background-color:#fafafa;' . 'font:9px verdana;' . '}' . 'a.closebtn' . '{' . 'display:block;' . 'float:right;' . 'width:7px;' . 'height:7px;' . 'margin-left:4px;' . 'margin-top:4px;' . 'background:url("' . relurl('core_dev/gfx/close.gif') . '");' . '}' . 'a.closebtn:hover' . '{' . 'background-position:0px -7px;' . '}' . 'a.expandbtn' . '{' . 'display:block;' . 'float:left;' . 'width:7px;' . 'height:7px;' . 'margin-right:4px;' . 'margin-top:4px;' . 'background:url("' . relurl('core_dev/gfx/close.gif') . '");' . 'background-position:0px -28px;' . '}' . 'a.expandbtn:hover' . '{' . '}');
echo '<div id="' . $wrapper_id . '">';
// outer wrapper
echo ahref_js('', "return toggle_el('" . $container_id . "');", 'expandbtn');
echo 'core_dev';
echo '<div id="' . $container_id . '" style="display:none;">';
// inner container
if (class_exists('cd\\SqlHandler')) {
    $view = new ViewModel('views/profiler/mysql.php');
    echo $view->render();
}
if (class_exists('cd\\TempStore')) {
    $view = new ViewModel('views/profiler/tempstore.php');
    echo $view->render();
}
$prof_id = 'prof_' . mt_rand();
$total_time = microtime(true) - $page->getStartTime();
if (isset($db) && $db instanceof DatabaseMySQLProfiler) {
    $sql_time = $db->getTotalQueryTime();
    $php_time = $total_time - $sql_time - $db->time_connect;
}
echo '| ' . ahref_js(round($total_time, 2) . 's web', "return toggle_el('" . $prof_id . "')");
$css = 'display:none;' . 'width:400px;' . 'padding:4px;' . 'border:#000 1px solid;';
echo '<div id="' . $prof_id . '" style="' . $css . '">';
if (isset($db) && $db instanceof DatabaseMySQLProfiler) {
    echo 'Load: <b>' . round($total_time, 2) . 's</b> ';
    echo ' (DB connect: ' . round($db->time_connect, 2) . 's, ';
    echo 'SQL: ' . round($sql_time, 2) . 's, ';
    echo 'PHP: ' . round($php_time, 2) . 's)';
Пример #3
0
 function render()
 {
     $head = '';
     $foot = '';
     if ($this->enable_design) {
         if ($this->design_head) {
             $view = new ViewModel($this->design_head);
             $head .= $view->render();
         }
         $view = new ViewModel('views/core/required_js.php');
         $head .= $view->render();
         if ($this->design_foot) {
             $view = new ViewModel($this->design_foot);
             $foot .= $view->render();
         }
     }
     $main = '';
     foreach ($this->objs as $obj) {
         $main .= $obj->render();
     }
     if ($this->enable_design && $this->enable_profiler) {
         $view = new ViewModel('views/profiler/page.php');
         $main .= $view->render();
     }
     $this->sendHeaders();
     $header = XhtmlHeader::getInstance();
     $enable_fb = false;
     if ($this->enable_design && class_exists('\\cd\\SessionHandler') && SessionHandler::getInstance()->facebook_app_id) {
         $enable_fb = true;
         $header->includeJs($this->getScheme() . '://connect.facebook.net/en_US/all.js');
         $this->registerXmlNs('fb', 'http://www.facebook.com/2008/fbml');
         $header->embedJs('window.fbAsyncInit = function() {' . 'FB.init({' . 'appId:"' . SessionHandler::getInstance()->facebook_app_id . '",' . 'status:true,' . 'cookie:true,' . 'xfbml:true,' . 'channelUrl:"' . $this->getUrl() . 'c/fbchannel",' . '});' . '};' . '(function() {' . 'var e = document.createElement("script"); e.async = true;' . 'e.src = document.location.protocol + "//connect.facebook.net/en_US/all.js";' . 'e.async = true;' . 'document.getElementById("fb-root").appendChild(e);' . '}());');
     }
     if ($this->enable_html_headers) {
         switch ($this->html_mode) {
             case 'xhtml':
                 // XHTML 1.0 Transitional
                 echo '<!DOCTYPE html' . ' PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' . ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n" . '<html' . ' xmlns="http://www.w3.org/1999/xhtml"';
                 break;
             case 'html5':
                 // HTML 5
                 echo '<!DOCTYPE html>' . "\n" . '<html';
                 //            ' manifest="cache.manifest"'.   // The "HTML5" manifest="cache.manifest" property on the <html> tag is how the browser knows that we want to cache this web page offline.
                 break;
         }
         //            ' xml:lang="'.$this->language_code.'" lang="'.$this->language_code.'"'
         foreach ($this->xmlns as $name => $uri) {
             echo ' xmlns:' . $name . '="' . $uri . '"';
         }
         echo '>' . "\n";
         echo $header->render();
         if ($enable_fb) {
             echo '<div id="fb-root"></div>';
         }
         // required for Facebook API
     }
     if ($this->enable_design) {
         echo $head;
     }
     echo $main;
     if ($this->enable_design) {
         echo $foot;
     }
     if ($this->enable_design) {
         echo '</body>';
         // <body> tag is opened in XhtmlHeader->render()
         echo '</html>';
     }
 }