Пример #1
0
/** Bar dump */
function dd($var)
{
    if (func_num_args() > 1) {
        $var = func_get_args();
    } else {
        if (is_array($var)) {
            $var = array(NULL => $var);
        }
    }
    Debugger::barDump($var);
    return func_get_arg(0);
}
Пример #2
0
/**
 * Bar dump shortcut.
 * @see Nette\Diagnostics\Debugger::barDump
 * @author Filip Procházka <*****@*****.**>
 *
 * @param mixed $var
 * @param string $title
 *
 * @return mixed
 */
function bd($var, $title = NULL)
{
    if (Debugger::$productionMode) {
        return $var;
    }
    $trace = debug_backtrace();
    $traceTitle = (isset($trace[1]['class']) ? htmlspecialchars($trace[1]['class']) . "->" : NULL) . htmlspecialchars($trace[1]['function']) . '()' . ':' . $trace[0]['line'];
    if (!is_scalar($title) && $title !== NULL) {
        foreach (func_get_args() as $arg) {
            Nette\Diagnostics\Debugger::barDump($arg, $traceTitle);
        }
        return $var;
    }
    return Nette\Diagnostics\Debugger::barDump($var, $title ?: $traceTitle);
}
Пример #3
0
 /**
  * @param  string|null              $strategy
  * @return IOpauthIdentity
  * @throws InvalidArgumentException
  * @throws InvalidLoginException
  */
 public function callback($strategy)
 {
     if ($strategy === NULL) {
         throw new InvalidLoginException('No auth response. Probably user cancelled the process.');
     }
     if ($this->isFakeStrategy($strategy)) {
         if ($this->config['debug'] != true) {
             throw new InvalidLoginException("Fake login available only in debug mode!");
         }
         return $this->createIdentity(array('uid' => "123123123", 'info' => array('name' => "Chuck Norris", 'image' => "http://placekitten.com/465/465"), 'raw' => array('link' => "http://www.google.com/search?q=chuck+norris", 'email' => "*****@*****.**", 'given_name' => "Chuck", 'family_name' => "Norris"), 'provider' => 'Google'));
     }
     $Opauth = new \Opauth($this->config, false);
     $response = null;
     switch ($Opauth->env['callback_transport']) {
         case 'session':
             $response = $_SESSION['opauth'];
             unset($_SESSION['opauth']);
             break;
         case 'post':
             $response = unserialize(base64_decode($_POST['opauth']));
             break;
         case 'get':
             $response = unserialize(base64_decode($_GET['opauth']));
             break;
         default:
             throw new InvalidArgumentException("Unsupported callback transport.");
             break;
     }
     if (array_key_exists('error', $response)) {
         throw new InvalidLoginException($response['error']['message']);
     }
     if (empty($response['auth']) || empty($response['timestamp']) || empty($response['signature']) || empty($response['auth']['provider']) || empty($response['auth']['uid'])) {
         throw new InvalidLoginException('Invalid auth response: Missing key auth response components');
     } elseif (!$Opauth->validate(sha1(print_r($response['auth'], true)), $response['timestamp'], $response['signature'], $reason)) {
         throw new InvalidLoginException('Invalid auth response: ' . $reason);
     }
     \Nette\Diagnostics\Debugger::barDump($response['auth'], 'authInfo');
     return $this->createIdentity($response['auth']);
 }
Пример #4
0
 public function dump($value)
 {
     Debugger::barDump($value);
 }
Пример #5
0
/**
 * Shortcut for Debugger::barDump
 *
 * @author   Jan Tvrdík
 * @param    mixed
 * @param    mixed $var, ...       optional additional variable(s) to dump
 * @return   mixed                 the first dumped variable
 */
function bd($var, $title = NULL)
{
    return Debugger::barDump($var, $title);
}
Пример #6
0
function bd()
{
    foreach (func_get_args() as $m) {
        Nette\Diagnostics\Debugger::barDump($m);
    }
}