本文整理汇总了PHP中Debug::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::init方法的具体用法?PHP Debug::init怎么用?PHP Debug::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::init方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrap
public static function bootstrap(array $config)
{
if (!isset($config['mode'])) {
$config['mode'] = Config::get('deploy')->mode;
}
Debug::init($config['debug']);
self::$_MODE = $config['mode'];
self::setErrorReporting($config['mode'] !== self::MODE_PRODUCTION);
Cache::init();
Debug::getInstance()->addCheckpoint('bootstrapped');
}
示例2: makeRequest
/**
* This method is the primary mechanism for forwarding {@link Request} objects to AT&T APIs using PHP cURL. The response from the API
* is automatically received, parsed and returned by this method as a {@link Response} object.
*
* @method makeRequest
*
* @param {string} method The http request method [GET|POST|PUT]
* @param {string} url Target URL of the request.
* @param {Request} request Request object to send to API.
*
* @return {Response} Returns a Response object
*
*/
public function makeRequest($method, $url, $request = null)
{
try {
$headers = $request->getHeaders();
$postfields = $request->getPostfields();
$curl = curl_init($url);
$options = array(CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYHOST => ENABLE_SSL_CHECK, CURLOPT_SSL_VERIFYPEER => ENABLE_SSL_CHECK, CURLOPT_HEADER => true, CURLINFO_HEADER_OUT => true);
curl_setopt_array($curl, $options);
if ($method === "POST" || $method === "PUT") {
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
}
if ($method === "PUT") {
if ($postfields === '[]') {
curl_setopt($curl, CURLOPT_PUT, 1);
} else {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
}
}
//
// If debugging, set the options before executing the request
//
if (DEBUG) {
$fp = Debug::init();
curl_setopt($curl, CURLOPT_STDERR, $fp);
curl_setopt($curl, CURLOPT_VERBOSE, true);
}
$curl_response = curl_exec($curl);
$curl_info = curl_getinfo($curl);
// If debugging, capture the response body after the request has been sent, but before the curl instance is closed
if (DEBUG) {
Debug::write("\n>>>>> [ REQUEST HEADERS AND CONTENT ] >>>>>>>>>>>>\n");
Debug::write("{$curl_info['request_header']}");
if ($method == "POST") {
Debug::write("{$postfields}\n");
}
Debug::write(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n");
Debug::write("\n<<<<< [ RESPONSE HEADERS AND CONTENT ] <<<<<<<<<<<<\n{$curl_response}\n");
Debug::write("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
Debug::dumpBacktrace();
curl_close($curl);
Debug::end();
} else {
curl_close($curl);
}
return new Response(array("curl_info" => $curl_info, "curl_response" => $curl_response));
} catch (Exception $e) {
return new Response($e);
}
}
示例3: load
public static function load($classname)
{
//we need debug, so include it
if (!class_exists('Debug')) {
require_once CORE_PATH . '/debug.php';
}
$classname = ltrim($classname, '\\');
$filename = '';
$namespace = '';
if ($lastNsPos = strrpos($classname, '\\')) {
$namespace = substr($classname, 0, $lastNsPos);
$classname = substr($classname, $lastNsPos + 1);
$filename = SITE_PATH . '/' . strtolower(str_replace('\\', DS, $namespace) . DS);
}
$filename .= strtolower($classname) . '.php';
if (file_exists($filename) and !class_exists(basename($classname))) {
Debug::init('file')->add(array('message' => str_replace(SITE_PATH, '', $filename), 'filesize' => filesize($filename), 'class' => __METHOD__, 'status' => 'success', 'backtrace' => Debug::backtrace()));
require_once $filename;
return;
}
Debug::init('file')->add(array('message' => 'Failed to load ' . $filename, 'class' => __METHOD__, 'status' => 'error', 'backtrace' => Debug::backtrace()));
return $filename !== false;
}
示例4: header
header("X-Wf-nette-{$index}-1-n{$num}: |{$s}|\\");
}
header("X-Wf-nette-{$index}-1-n{$num}: |{$s}|");
return TRUE;
}
/**
* fireLog helper.
* @param mixed
* @return mixed
*/
private static function replaceObjects($val)
{
if (is_object($val)) {
return 'object ' . get_class($val) . '';
} elseif (is_string($val)) {
return $val = @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', $val));
// intentionally @
} elseif (is_array($val)) {
foreach ($val as $k => $v) {
unset($val[$k]);
$k = @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', $k));
// intentionally @
$val[$k] = self::replaceObjects($v);
}
}
return $val;
}
}
Debug::init();
// hint:
// if (!function_exists('dump')) { function dump($var, $return = FALSE) { return Debug::dump($var, $return); } }
示例5: setStyle
/**
* Set Text Style
*
* Either:
* @param String $style - (bold, italic, oblique, normal, overline, line-through, underline )
* @param Array $style - Any Key=>Pair Css value;
*/
public function setStyle($style)
{
//This Function Requires Inistigating
if (!isset($this) || isset($this) && get_class($this) != __CLASS__) {
return Debug::init()->setStyle($style);
}
if (!is_array($style)) {
if ($fontStyle = $this->validateStyle($style)) {
$this->currentStyle[$fontStyle[0]] = $fontStyle[1];
}
} else {
$this->currentStyle = array_merge($this->currentStyle, $style);
}
return $this;
}
示例6: revokeConsentToken
public function revokeConsentToken($scope)
{
// Create service for requesting an OAuth token
$osrvc = new OAuthTokenService($this->base_url, $this->client_id, $this->client_secret);
$refresh_token_string = isset($_SESSION['consent_refresh_tokens'][$scope]) ? $_SESSION['consent_refresh_tokens'][$scope] : '';
if (empty($refresh_token_string)) {
return;
}
if (DEBUG) {
Debug::init();
$a = $refresh_token_string;
Debug::write("Revoke Consent Refresh token: {$a}.\n");
Debug::end();
}
$this->revokeRefreshToken($refresh_token_string);
// Parse the consent_tokens array and update each taken that matches old_token
$consent_tokens = isset($_SESSION['consent_refresh_tokens']) ? $_SESSION['consent_refresh_tokens'] : '';
foreach ($consent_tokens as $key => $value) {
if ($_SESSION['consent_refresh_tokens'][$key] == $refresh_token_string) {
unset($_SESSION['consent_tokens'][$key]);
unset($_SESSION['consent_refresh_tokens'][$key]);
unset($_SESSION['consent_expires_at'][$key]);
}
}
}
示例7: view
/**
* accepts $viewname as a php file name,
* or alternatively module::filename could be used to specify the target app
*
* @param viewname string The name of the view file
* @param data array Extra data that is to be passed to the view
* @param template string The template file to be used to render the required view
*
* @return html string
*/
static function view($viewname, $data = null, $template = 'default')
{
//check for the default mvc location
$view = MODULE_PATH . '/views/' . $viewname . '.php';
if (!is_file($view)) {
//get the class that the request is coming from
$calling_class = get_called_class();
//get the class name and swap \ for / as well as controllers for views to check HMVC
$class = strtolower(str_replace('controllers', 'views', str_replace('\\', '/', $calling_class)));
$view = SITE_PATH . '/' . $class . '/' . $viewname . '.php';
}
//specify a particular app to use by searching for :: in the viewname
// so member::viewname would look in ... app/member/views/viewname
if (!is_file($view) and strpos($viewname, '::')) {
$segments = explode('::', $viewname);
$class = $segments[0];
$viewname = $segments[1];
$view = MODULE_PATH . '/' . strtolower($class) . '/views/' . strtolower($viewname) . '.php';
}
if (is_file($view)) {
if (!empty($data) and is_array($data)) {
extract($data);
}
ob_start();
require $view;
$content = ob_get_contents();
ob_end_clean();
Debug::init('log')->add(array('message' => 'Including view: ' . $view, 'class' => __METHOD__, 'status' => 'success', 'backtrace' => Debug::backtrace()));
//render the template file with the compiled view data
self::template($template, $content);
//if the view file cannot be found
} else {
throw new MeagrException('The requested view file "' . $view . '" could not be found');
}
}