本文整理汇总了PHP中FB::send方法的典型用法代码示例。如果您正苦于以下问题:PHP FB::send方法的具体用法?PHP FB::send怎么用?PHP FB::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FB
的用法示例。
在下文中一共展示了FB::send方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
*
* {@inheritDoc}
*
* @see \Psr\Log\LoggerInterface::log()
*/
public function log($level, $message, array $context = array())
{
foreach ($context as $property => $val) {
if (property_exists($this, $property)) {
$this->{$property} = $val;
}
}
$fb = new \FB();
if (!empty($this->options)) {
$fb->setOptions($this->options);
}
$fb->send($message, $this->label, $level);
if ($level == LogLevel::DEBUG) {
foreach ($context as $label => $object) {
$fb->send($object, $label, $level);
}
}
}
示例2:
|| Jeremy Bloomstrom ||
|| Ingenious Design ||
|| jeremy@in.genio.us ||
|| November 27, 2012 ||
|| ||
|________________________________________________________________________________________________________________________________|
|| ||
|| ||
|| minimal.php ||
|| ||
|| ||
*********************************************************************************************************************************/
/***** ***** ***** ***** ***** ***** ***** ***** ***** ***** DEBUGGING ***** ***** ***** ***** ***** ***** ***** ***** ***** *****/
require_once 'FirePHPCore/FirePHP.class.php';
$firephp = FirePHP::getInstance(true);
require_once 'FirePHPCore/fb.php';
$firephp->setEnabled(true);
// or FB::
FB::send('firephp enabled');
/***** ***** ***** ***** ***** ***** ***** ***** ***** ***** GLOBAL VARS ***** ***** ***** ***** ***** ***** ***** ***** ***** *****/
global $session_length;
$session_length = 60 * 10 - 2;
// 30 second sessions for debugging; 10 mins for production
include_once "./models/db.php";
/***** ***** ***** ***** ***** ***** ***** ***** ***** ***** CLASSES ***** ***** ***** ***** ***** ***** ***** ***** ***** *****/
include_once "classes/class_session.php";
include_once "classes/class_req.php";
include_once "classes/class_document.php";
include_once "classes/class_date.php";
/***** ***** ***** ***** ***** ***** ***** ***** ***** ***** OTHERS ***** ***** ***** ***** ***** ***** ***** ***** ***** *****/
include_once "php/functions.php";
示例3: error
/**
* Display Error Message in debug mode.
*
* <pre>
*
* @param string $heading Headding
* @param string $subheading Sub headding
* @param mixed $info error info
* @param array $options options
*
* $options key:
*
* string $options['file'] file name
* int $options['line'] line
* array $options['trace'] backtrace
* bool $options['return'] return string(no echo)
* </pre>
*
* @return void
*/
public static function error($heading, $subheading = "", $info = "", array $options = array())
{
// return if live
if (self::$_config[self::CONFIG_DEBUG] !== true) {
return;
}
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
if (class_exists('FB', false)) {
$in = isset($options['file']) ? "- in {$options['file']} on line {$options['line']}" : '';
$msg = "{$heading} - {$subheading} {$in}";
if ($info) {
FB::group($msg);
FB::error($info);
FB::groupEnd();
return;
}
}
}
static $num = 1;
//div id number
$heading = is_numeric($heading) ? self::$packageName[$heading] : $heading;
// Application error callback
if (is_callable(self::$_config[self::CONFIG_ON_ERROR_FIRED])) {
call_user_func(self::$_config[self::CONFIG_ON_ERROR_FIRED], $heading, $subheading, $info, $options);
}
$fileInfoString = isset($options['file']) ? "in {$options['file']} on line {$options['line']}" : 'in unknown file';
if (self::$_config[self::CONFIG_ENABLE_FIREPHP] && isset($options['severity'])) {
$fireLevel = FirePHP::ERROR;
switch (true) {
case $options['severity'] == E_WARNING || $options['severity'] == E_USER_WARNING:
$fireLevel = FirePHP::WARN;
break;
case $options['severity'] == E_NOTICE || $options['severity'] == E_USER_NOTICE:
$fireLevel = FirePHP::INFO;
break;
case $options['severity'] == E_STRICT:
$fireLevel = FirePHP::LOG;
break;
default:
$fireLevel = FirePHP::ERROR;
break;
}
FB::send("{$subheading} - {$fileInfoString}", $heading, $fireLevel);
}
self::GrowlNotify($heading, $subheading . "\n{$fileInfoString}");
$defaultOptions = array('file' => null, 'line' => null, 'trace' => array(), 'return' => false, 'no_screen' => false);
$options = array_merge($defaultOptions, $options);
if ($options['no_screen']) {
return '';
}
$output = self::_getDebugCss();
if ($options['trace']) {
$traceId = uniqid();
$traceFile = self::getTempDir() . '/trace-' . $traceId . '.log';
$refData = self::__addReflectInfo($options['trace']);
file_put_contents($traceFile, serialize($options['trace']));
file_put_contents("{$traceFile}.ref.log", serialize($refData));
}
if (PHP_SAPI == 'cli' || call_user_func(self::$_config[self::CONFIG_IS_API_CHECK])) {
$output .= $heading . PHP_EOL;
$output .= $subheading . PHP_EOL;
$output .= $info . PHP_EOL;
return $output;
} else {
if (is_array($info) || is_object($info)) {
if (isset($options['package']) && $options['package'] === self::PACKAGE_PHP) {
$info = self::_getContextString($info, '$');
} else {
$info = self::_getContextString($info);
}
}
header('Content-Type: text/html; charset=utf-8');
$output .= '<div id="panda-' . $num . '"class="panda">';
$output .= '<div class="panda-header">';
$output .= '<h1>' . $heading . '</h1>';
$output .= isset($options['file']) ? '<p class="panda-file">' . self::getEditorLink($options['file'], $options['line'], 0) . '</p>' : '';
$output .= '<h2>' . $subheading . '</h2>';
$output .= '<p class="panda-cmd">';
if ($options['trace']) {
$output .= '<a target="_panda_trace_' . $traceId . '" href="' . "http://{$_SERVER['SERVER_NAME']}" . self::$_config[self::CONFIG_PANDA_PATH] . '__panda/trace/?id=' . $traceId . '">trace</a> | ';
//.........这里部分代码省略.........
示例4: printDebug
/**
* Prints debug information if debug is set to true.
* $msg is used as header/footer in the output.
*
* if FirePHP is available it will be used instead of
* dumping the debug info into the document.
*
* It uses print_r and encapsulates it in HTML/XML comments.
* (<!-- -->)
*
* @param string $msg Debug identifier, e.g. "my array".
* @param mixed $mixed Object, type, etc, to be debugged.
* @return void
*/
public static function printDebug($msg, $mixed)
{
if (self::$debug) {
if (class_exists('FB', false)) {
FB::send($mixed, $msg);
} else {
echo "\n<!-- " . $msg . ": \n";
print_r($mixed);
echo "\n end " . $msg . " -->\n";
}
}
}
示例5: test
function test($table)
{
FB::table('Test deep table', $table);
FB::send(array('Test deep table', $table), FirePHP::TABLE);
throw new Exception('Test Exception');
}
示例6:
<?php
$firephp = FirePHP::getInstance(true);
if ($firephp->getEnabled()) {
$firephp->info('Enabled');
}
$firephp->fb('This should show');
$firephp->setEnabled(false);
if (!$firephp->getEnabled()) {
$firephp->info('Disabled');
}
$firephp->fb('This should NOT show');
$firephp->setEnabled(true);
if ($firephp->getEnabled()) {
$firephp->info('Enabled');
}
$firephp->fb('This should show');
if (FB::getEnabled()) {
FB::info('Enabled');
}
FB::log('This should show');
FB::setEnabled(false);
if (!FB::getEnabled()) {
FB::info('Disabled');
}
FB::send('This should NOT show');
FB::setEnabled(true);
if (FB::getEnabled()) {
FB::info('Enabled');
}
FB::log('This should show');
示例7: getImages
/**
* Loads the class variable with
*
* @return void
* @access public
*/
public function getImages()
{
FB::group("Image Loading Data");
FB::send($this->dir, "Directory");
if (($cache = Utilities::check_cache($this->dir)) !== FALSE) {
$this->_imageArray = $cache;
} else {
if (is_dir($this->dir)) {
// Open the directory for reading
if ($folder = opendir($this->dir)) {
// Loop through the files in the directory
while (($file = readdir($folder)) !== FALSE) {
/*
* Verifies that the current value of $file
* refers to an existing file and that the
* file is big enough not to throw an error.
*/
if (is_file($this->dir . $file) && is_readable($this->dir . $file) && filesize($this->dir . $file) > 11) {
// Verify that the file is an image
//XXX Add EXIF check and fallback
if (exif_imagetype($this->dir . $file) !== FALSE) {
FB::send("The file is an image. Added to array.");
// Adds the image to the array
$this->_imageArray[] = $file;
}
}
}
// Sort the images according using natural sorting
natsort($this->_imageArray);
FB::send($this->_imageArray, "Image Array");
Utilities::save_cache($this->dir, $this->_imageArray);
}
}
}
FB::groupEnd();
}
示例8: table
/**
* Log a table in the firebug console
*
* @see FirePHP::TABLE
* @param string $Label
* @param string $Table
* @return true
*/
function table($Label, $Table)
{
return FB::send($Table, $Label, FirePHP_TABLE);
}
示例9: onShutdownDebug
/**
* 最後のエラーを取得
*
* <pre>
* _errorクエリーで最後のエラーを表示させます。
* エラー表示がうまく行かない時に使用します。
* </pre>
*
* <code>
* ?_error エラー表示
* ?_error=koriyama@bear-project.net エラーメール送信
* ?_error=/tmp/error.log エラーログファイルを書き込み
* </code>
*
* @return void
*/
public static function onShutdownDebug()
{
if (function_exists('FB')) {
$errors = Panda::getOuterPathErrors();
FB::group('errors', array('Collapsed' => true, 'Color' => 'gray'));
foreach ($errors as $code => $error) {
switch (true) {
case $code == E_WARNING || $code == E_USER_WARNING:
$fireLevel = FirePHP::WARN;
break;
case $code == E_NOTICE || $code == E_USER_NOTICE:
$fireLevel = FirePHP::INFO;
break;
case $code == E_STRICT || $code == E_DEPRECATED:
$fireLevel = FirePHP::LOG;
break;
default:
$fireLevel = FirePHP::ERROR;
break;
}
FB::send($error, '', $fireLevel);
}
FB::groupEnd();
}
$lastError = error_get_last();
$err = print_r($lastError, true);
if (isset($_GET['_error'])) {
$errorTo = $_GET['_error'];
if ($errorTo == '') {
$errorCode = Panda::$phpError[$lastError['type']];
Panda::error("{$errorCode} (Last Error)", "{$lastError['message']}", '', (array) $lastError);
return;
} elseif (strpos($errorTo, '@')) {
error_log($err, 1, $errorTo);
} elseif (is_writable(dirname($errorTo))) {
error_log("{$err}\n\n", 3, $errorTo);
} else {
echo "<p style=\"color:red\">Error: Invalid destination for _error [{$errorTo}]</p>";
}
}
}
示例10: array
<?php
FB::group('Test Group');
FB::send('Hello World');
FB::groupEnd();
FB::log('Log Message');
FB::info('Info Message');
FB::warn('Info Message');
FB::error('Info Message');
FB::trace('Trace to here');
FB::send('Trace to here', FirePHP::TRACE);
FB::table('2 SQL queries took 0.06 seconds', array(array('SQL Statement', 'Time', 'Result'), array('SELECT * FROM Foo', '0.02', array('row1', 'row2')), array('SELECT * FROM Bar', '0.04', array('row1', 'row2'))));
FB::dump('PHP Version', phpversion());
示例11: _validate_comment_data
/**
* Validates a posted comment and sets error codes where applicable
*
* @return mixed bool FALSE on failure, object w/comment data on success
*/
private function _validate_comment_data()
{
// Sanitize the user input
$comment = $this->_store_comment_data();
// Verify that all required fields were properly filled out
//----------------------------------------------------------------------
// Name was left blank
if (empty($comment->name)) {
$this->_sdata->error = '0001';
FB::send("No name supplied");
return FALSE;
} else {
if (!SIV::validate($comment->name, SIV::STRING)) {
$this->_sdata->error = '0002';
FB::send("Invalid name supplied");
return FALSE;
} else {
if (empty($comment->email)) {
$this->_sdata->error = '0003';
FB::send("No email supplied");
return FALSE;
} else {
if (!SIV::validate($comment->email, SIV::EMAIL)) {
$this->_sdata->error = '0004';
FB::send("Invalid email supplied");
return FALSE;
} else {
if (empty($comment->comment)) {
$this->_sdata->error = '0005';
FB::send("No comment supplied");
return FALSE;
} else {
if (!$this->_verify_spam_challenge()) {
// The user gets five chances to answer the anti-spam question
if ($this->_track_post_attempts() < 5) {
$this->_sdata->error = '0006';
FB::send("Failed spam verification");
} else {
$this->_suspend_commenter();
$this->_sdata->attempts = 0;
$this->_sdata->error = '0009';
FB::send("Too many failed spam attempts");
}
return FALSE;
} else {
if ($this->_sdata->suspend_until > time() && ($this->_sdata->error === '0009' || $this->_sdata->error === '0011')) {
$this->_suspend_commenter();
$this->_sdata->error = '0011';
FB::send("Suspended for two minutes");
return FALSE;
} else {
if ($this->_sdata->suspend_until > time() && $this->_sdata->error === '0000' || $this->_sdata->error === '0012') {
$this->_suspend_commenter(15);
$this->_sdata->error = '0012';
FB::send("Too many posts in 15 seconds. ");
return FALSE;
} else {
// Send the success code
$this->_sdata->error = '0000';
// Reset the comment attempts
$this->_sdata->attempts = 0;
return $comment;
}
}
}
}
}
}
}
}
}
示例12: vardump
/**
* (non-PHPdoc)
* @see debugObject::vardump()
*/
public function vardump($var, $name = null)
{
if ($this->_level & DEBUG_LOG) {
FB::send($var, $name);
}
}
示例13: debug
/**
* Write's to a debug log.
*
* @param string $text log entry
*/
public static function debug($text, $config = false)
{
if (self::config()->debug || self::config()->debug_log || self::config()->firephp) {
if (!isset($_REQUEST['r']) || $_REQUEST['r'] != 'core/debug') {
if (self::config()->firephp) {
if (class_exists('FB')) {
ob_start();
FB::send($text);
}
}
// if (self::config()->debug_log) {
if (!is_string($text)) {
$text = var_export($text, true);
}
if ($text == '') {
$text = '(empty string)';
}
if ($text == 'undefined') {
throw new \Exception();
}
//$username=\GO::user() ? \GO::user()->username : 'nobody';
//$trace = debug_backtrace();
//$prefix = "\n[".date("Ymd G:i:s")."][".$trace[0]['file'].":".$trace[0]['line']."]\n";
//$lines = explode("\n", $text);
//$text = $prefix.$text;
$user = isset(\GO::session()->values['username']) ? \GO::session()->values['username'] : 'notloggedin';
$text = "[{$user}] " . str_replace("\n", "\n[{$user}] ", $text);
file_put_contents(self::config()->file_storage_path . 'log/debug.log', $text . "\n", FILE_APPEND);
// }
}
}
}