_isAjaxOutput = $this->_isAjaxRequest(); } function plank($sTitle, $sContent = '') { static $i = 0; $i++; if ($this->_isAjaxOutput) { if (!headers_sent() && function_exists('fb')) { if ($sContent && is_array($sContent)) fb($sContent, $sTitle, FirePHP::TABLE); else fb($sTitle . $sContent); } elseif (!headers_sent()) { if ($sContent && is_array($sContent)) { $sContentEnc = json_encode($sContent); header("X-Una-Profiler-$i: $sTitle" . ($sContent && $sContentEnc < 4000 ? '; ' . $sContentEnc : '')); } else { header("X-Una-Profiler-$i: $sTitle" . ($sContent && $sContent < 4000 ? '; ' . $sContent : '')); } } return ''; } if ($sContent) $sContent = '
+
'.$sContent.'
'; return '
' . $sTitle . '' . $sContent . '
'; } function nameValue ($sName, $sVal) { return $this->_isAjaxOutput ? "{$sName}{$sVal} | " : "$sName$sVal"; } function table ($a, $sHighlight = '') { if ($this->_isAjaxOutput) { $table = array(); foreach ($a as $r) { if (!$table) $table[] = array_keys($r); $rr = array_values($r); if (false !== strpos($rr[0], ' ')) $rr[0] = str_replace(' ', '-', $rr[0]); $table[] = $rr; } return $table; } $sId = md5(time() . rand()); $s = ''; $th = ''; foreach ($a as $r) { if (!$th) { foreach ($r as $k => $v) $th .= ""; $s .= "$th"; } $s .= ''; foreach ($r as $k => $v) { $sClass = ''; if ($sHighlight && $k == $sHighlight) $sClass = ' class="highlight" '; $s .= ""; } $s .= ''; } $s .= '
$k
".htmlspecialchars_adv($v)."
'; $s .= ''; return $s; } function _isAjaxRequest () { if ('application/json' == $this->getHeaderContentType()) return true; if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') return true; if (isset($_GET['bx_profiler_ajax_request'])) return true; if (preg_match('/vote\.php/', bx_html_attribute($_SERVER['PHP_SELF']))) return true; if (preg_match('/image_transcoder\.php/', bx_html_attribute($_SERVER['PHP_SELF']))) return true; if (preg_match('/storage\.php/', bx_html_attribute($_SERVER['PHP_SELF']))) return true; if (preg_match('/storage_uploader\.php/', bx_html_attribute($_SERVER['PHP_SELF']))) return true; if (preg_match('/searchKeywordContent\.php/', bx_html_attribute($_SERVER['PHP_SELF']))) return true; if (preg_match('/menu\.php/', bx_html_attribute($_SERVER['PHP_SELF']))) return true; if (preg_match('/gzip_loader\.php/', $_SERVER['PHP_SELF'])) return true; if (preg_match('/get_rss_feed\.php/', $_SERVER['PHP_SELF'])) return true; return false; } function addCss($mixedFiles, $bDynamic = false) { if ($this->_isAjaxOutput) return ''; return parent::addCss($mixedFiles, $bDynamic); } function addJs($mixedFiles, $bDynamic = false) { if ($this->_isAjaxOutput) return ''; return parent::addJs($mixedFiles, $bDynamic); } function getHeaderContentType() { $aHeaders = headers_list(); foreach ($aHeaders as $s) { $a = explode(':', $s); if (isset($a[0]) && isset($a[1]) && 'content-type' == strtolower(trim($a[0]))) { $aa = explode(';', $a[1]); return strtolower(trim($aa[0])); } } return false; } } /** @} */