本文整理汇总了PHP中Debug类的典型用法代码示例。如果您正苦于以下问题:PHP Debug类的具体用法?PHP Debug怎么用?PHP Debug使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Debug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DisableModule
public function DisableModule()
{
$database = Mysql::getConnection();
$database->Query("UPDATE " . TABLE_PREFIX . "modules SET moduleStatus='0' WHERE moduleId='{$this->moduleId}';");
$debug = new Debug();
$debug->debugMessage = Lang::$langData['moduleDisabled'] . " ({$this->moduleName})";
$debug->debugType = 0;
$debug->StartDebug();
}
示例2: SystemStop
public static function SystemStop()
{
$stoppedFrom = debug_backtrace();
$stoppedFile = $stoppedFrom[0]['file'];
$debug = new Debug();
$debug->debugMessage = 'System has been stopped from file: ' . $stoppedFile;
$debug->StartDebug();
die("System has been stopped, check your debug!");
}
示例3: Install
public static function Install($template)
{
require_once ABS_PATH . '/temp/' . $template . '/install.php';
$database = Mysql::getConnection();
$database->Query("INSERT INTO " . TABLE_PREFIX . "templates VALUES ('', '" . $installData['templateName'] . "', '" . $installData['templateAuthor'] . "', '" . $installData['templateVersion'] . "', '0','" . $installData['templateDescription'] . "');");
$debug = new Debug();
$debug->debugType = 0;
$debug->debugMessage = Lang::$langData['installTemplate'] . " (" . $template . ")";
$debug->StartDebug();
}
示例4: doEmail
/**
* Send emails - Note: properties must be set before calling this function
*/
public function doEmail()
{
if (!$this->body) {
return false;
}
if (!$this->to) {
$this->to = SITE_NAME . ' <' . SITE_EMAIL . '>';
}
if (!$this->from) {
$this->from = SITE_NAME . ' <' . SITE_EMAIL . '>';
}
if (SMTP == 'true') {
// note: this overwrites headers passed to this function:
if (is_array($this->to)) {
$to = $this->to['To'];
} else {
$to = $this->to;
}
$this->headers = array('From' => $this->from, 'To' => $to, 'Subject' => $this->subject);
} else {
// if not using SMTP and no headers passed to this function, use default
if (!$this->headers) {
$this->headers = "From: " . $this->from . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n";
}
}
switch ($this->type) {
case 'log':
require_once LIBS . 'Debug.php';
$debug = new Debug();
$debug->openLog('email_log', 'a+');
$content = $this->headers . "\r\n" . $this->to . "\r\n" . $this->subject . "\r\n" . $this->body . "\r\n\r\n";
$content .= "**************************************************************\r\n\r\n";
$debug->writeLog('email_log', $content);
$debug->closeLog('email_log');
break;
case 'screen':
echo "Headers: " . $this->headers . "<br /><br />";
echo "To: " . $this->to . "<br /><br />";
echo "Subject: " . $this->subject . "<br /><br />";
$this->body = nl2br($this->body);
echo "Body: " . $this->body . "<br /><br />";
break;
case 'return':
return array('headers' => $this->headers, 'to' => $this->to, 'subject' => $this->subject, 'body' => $this->body, 'type' => $this->type);
break;
default:
if (SMTP == 'true') {
$this->doSmtpEmail();
} else {
mail($this->to, $this->subject, $this->body, $this->headers);
}
}
}
示例5: SaveConfig
public function SaveConfig()
{
$filename = ABS_PATH . '/config.php';
//if(file_exists($filename))unlink($filename);
$configData = "<?php" . PHP_EOL . "/*" . PHP_EOL . " *\t@author: Tomáš Mičulka" . PHP_EOL . " *\t@version: 2.0" . PHP_EOL . " *\t@last_update: 6.1.2014 " . PHP_EOL . " */" . PHP_EOL . "defined('IN_INNE') or die('Acces denied!');" . PHP_EOL . "" . PHP_EOL . "//Database config" . PHP_EOL . "define('DB_HOST', '{$this->dbHost}');" . PHP_EOL . "define('DB_USER', '{$this->dbUser}');" . PHP_EOL . "define('DB_PASS', '{$this->dbPass}');" . PHP_EOL . "define('DB_NAME', '{$this->dbName}');" . PHP_EOL . "define('DB_VERSION', '{$this->dbVersion}');" . PHP_EOL . "define('TABLE_PREFIX', '{$this->tablePrefix}');" . PHP_EOL . "" . PHP_EOL . "//System config" . PHP_EOL . "define('SYS_LANG', '{$this->sysLang}');" . PHP_EOL . "define('SYS_DEBUG', '{$this->sysDebug}');" . PHP_EOL . "define('DEBUG_FILE', '{$this->sysDebugFile}');" . PHP_EOL . "define('SYS_TEMP', '{$this->webTemplate}');" . PHP_EOL . "define('ADM_VER', '{$this->sysAdmVer}');" . PHP_EOL . "define('ERROR_LEVEL', '{$this->sysErrorLevel}');" . PHP_EOL . "error_reporting({$this->sysErrorLevel});" . PHP_EOL . "define('GET_UPDATE', '{$this->update}');" . PHP_EOL . "define('USING_EXTERN', '{$this->extern}');" . PHP_EOL . "define('ABS_PATH', dirname(__FILE__));" . PHP_EOL . "" . PHP_EOL . "//Website config" . PHP_EOL . "define('WEBSITE_NAME', '{$this->webTitle}');" . PHP_EOL . "define('WEBSITE_DESCRIPTION', '{$this->webDescription}');" . PHP_EOL . "define('WEBSITE_AUTHOR', '{$this->webAuthor}');" . PHP_EOL . "define('WEBSITE_KEYWORDS', '{$this->webKeywords}');" . PHP_EOL . "define('WEBSITE_DEFAULT_PAGE', '{$this->webDefaultPage}');" . PHP_EOL . "define('WEBSITE_ADDRESS', '{$this->webAddress}');" . PHP_EOL . "";
$file = fopen($filename, "w+");
file_put_contents($filename, $configData);
fclose($file);
$debug = new Debug();
$debug->debugType = 0;
$debug->debugMessage = Lang::$langData["debugChangeConfig"];
$debug->StartDebug();
}
示例6: fetchPayablesList
public function fetchPayablesList($showFilter = self::FILTER_ACTIVE, $fromDate = null, $toDate = null, $supplierId = null)
{
$this->db->select('ie.*, s.supplierId, s.name as supplierName, i.itemId, i.description as itemDescription, i.productCode as itemProductCode')->from('ItemExpense ie')->join('Supplier s', 'ie.supplierId=s.supplierId', 'left')->join('Item i', 'i.itemId = ie.itemId')->where('ie.isCredit = 1');
switch ($showFilter) {
case self::FILTER_PAID:
$this->db->where('ie.isFullyPaid = 1');
break;
default:
$this->db->where('ie.isFullyPaid = 0');
break;
}
if (!empty($fromDate) && !empty($toDate)) {
$this->db->where('DATE(ie.dateAdded) >= ', $fromDate);
$this->db->where('DATE(ie.dateAdded) <= ', $toDate);
} elseif (!empty($fromDate) && empty($toDate)) {
$this->db->where('DATE(ie.dateAdded) >= ', $fromDate);
$this->db->where('DATE(ie.dateAdded) <= ', date('Y-m-d'));
} elseif (empty($fromDate) && !empty($toDate)) {
$this->db->where('DATE(ie.dateAdded) <= ', $toDate);
}
if (!empty($supplierId)) {
$this->db->where('ie.supplierId', $supplierId);
}
$query = $this->db->get();
Debug::log($this->db->last_query());
return $query->result_array();
}
示例7: action_index
public function action_index()
{
if (!file_exists(DOCROOT . $this->sitemap_directory_base)) {
throw new HTTP_Exception_404();
}
$this->site_code = ORM::factory('site', $this->request->site_id)->code;
$this->sitemap_directory = $this->sitemap_directory_base . DIRECTORY_SEPARATOR . $this->site_code;
$this->response->headers('Content-Type', 'text/xml')->headers('cache-control', 'max-age=0, must-revalidate, public')->headers('expires', gmdate('D, d M Y H:i:s', time()) . ' GMT');
try {
$dir = new DirectoryIterator(DOCROOT . $this->sitemap_directory);
$xml = new DOMDocument('1.0', Kohana::$charset);
$xml->formatOutput = TRUE;
$root = $xml->createElement('sitemapindex');
$root->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$xml->appendChild($root);
foreach ($dir as $fileinfo) {
if ($fileinfo->isDot() or $fileinfo->isDir()) {
continue;
}
$_file_path = str_replace(DOCROOT, '', $fileinfo->getPathName());
$_file_url = $this->domain . '/' . str_replace(DIRECTORY_SEPARATOR, '/', $_file_path);
$sitemap = $xml->createElement('sitemap');
$root->appendChild($sitemap);
$sitemap->appendChild(new DOMElement('loc', $_file_url));
$_last_mod = Sitemap::date_format($fileinfo->getCTime());
$sitemap->appendChild(new DOMElement('lastmod', $_last_mod));
}
} catch (Exception $e) {
echo Debug::vars($e->getMessage());
die;
}
echo $xml->saveXML();
}
示例8: display
function display($resource_name = null, $cache_id = null, $compile_id = null)
{
if (is_null($resource_name)) {
$resource_name = "{$_GET["m"]}/{$_GET["a"]}" . C('TPL_SUFFIX');
} else {
if (strstr($resource_name, "/")) {
$resource_name = $resource_name . C('TPL_SUFFIX');
} else {
$resource_name = $_GET["m"] . "/" . $resource_name . C('TPL_SUFFIX');
}
}
$tplpath = rtrim(C('TPL_DIR'), '/') . '/' . $resource_name;
if (!file_exists($tplpath)) {
if (C('DEBUG')) {
Debug::addmsg("<font style='color:red'>当前访问的模板文件: {$tplpath} 不存在</font>");
} else {
$this->error('抱歉, 访问的页面不存在!');
}
} else {
if (C('DEBUG')) {
Debug::addmsg("当前访问的模板文件: {$tplpath}");
}
//预定义目录
$root = rtrim(substr(C('PRO_PATH'), strlen(rtrim($_SERVER["DOCUMENT_ROOT"], "/\\"))), '/\\');
$resource = rtrim(dirname($_SERVER["SCRIPT_NAME"]), "/\\") . '/' . ltrim(C('APP_PATH'), './') . "/View/" . C('TPL_STYLE') . "/Resource/";
$url = $_SERVER['SCRIPT_NAME'] . '/' . $_GET['m'];
$this->assign('root', $root);
$this->assign('public', $root . '/Public');
$this->assign('res', $resource);
$this->assign('url', $url);
parent::display($resource_name, $cache_id, $compile_id);
}
}
示例9: query
public function query($sql, $errorLevel = E_USER_ERROR)
{
if (isset($_REQUEST['previewwrite']) && in_array(strtolower(substr($sql, 0, strpos($sql, ' '))), array('insert', 'update', 'delete', 'replace'))) {
Debug::message("Will execute: {$sql}");
return;
}
if (isset($_REQUEST['showqueries'])) {
$starttime = microtime(true);
}
// @todo This is a very ugly hack to rewrite the update statement of SiteTree::doPublish()
// @see SiteTree::doPublish() There is a hack for MySQL already, maybe it's worth moving this to SiteTree or that other hack to Database...
if (preg_replace('/[\\W\\d]*/i', '', $sql) == 'UPDATESiteTree_LiveSETSortSiteTreeSortFROMSiteTreeWHERESiteTree_LiveIDSiteTreeIDANDSiteTree_LiveParentID') {
preg_match('/\\d+/i', $sql, $matches);
$sql = 'UPDATE "SiteTree_Live"
SET "Sort" = (SELECT "SiteTree"."Sort" FROM "SiteTree" WHERE "SiteTree_Live"."ID" = "SiteTree"."ID")
WHERE "ParentID" = ' . $matches[0];
}
@($handle = $this->dbConn->query($sql));
if (isset($_REQUEST['showqueries'])) {
$endtime = round(microtime(true) - $starttime, 4);
Debug::message("\n{$sql}\n{$endtime}ms\n", false);
}
DB::$lastQuery = $handle;
if (!$handle && $errorLevel) {
$msg = $this->dbConn->errorInfo();
$this->databaseError("Couldn't run query: {$sql} | " . $msg[2], $errorLevel);
}
return new SQLitePDOQuery($this, $handle);
}
示例10: dump
/**
* Debug::dump shortcut.
*/
function dump($var)
{
foreach (func_get_args() as $arg) {
Debug::dump($arg);
}
return $var;
}
示例11: inspect
public static function inspect($obj, $die = true)
{
\Debug::dump($obj);
if ($die) {
die;
}
}
示例12: action_index
public function action_index()
{
// Statusモデルから結果を取得する
$results = Model_Status::find_body_by_username('foo');
// $resultsをダンプして確認する
Debug::dump($results);
}
示例13: output
public function output()
{
// TODO: Refactor into a content-type option
if (\Director::is_ajax()) {
return $this->friendlyErrorMessage;
} else {
// TODO: Refactor this into CMS
if (class_exists('ErrorPage')) {
$errorFilePath = \ErrorPage::get_filepath_for_errorcode($this->statusCode, class_exists('Translatable') ? \Translatable::get_current_locale() : null);
if (file_exists($errorFilePath)) {
$content = file_get_contents($errorFilePath);
if (!headers_sent()) {
header('Content-Type: text/html');
}
// $BaseURL is left dynamic in error-###.html, so that multi-domain sites don't get broken
return str_replace('$BaseURL', \Director::absoluteBaseURL(), $content);
}
}
$renderer = \Debug::create_debug_view();
$output = $renderer->renderHeader();
$output .= $renderer->renderInfo("Website Error", $this->friendlyErrorMessage, $this->friendlyErrorDetail);
if (\Email::config()->admin_email) {
$mailto = \Email::obfuscate(\Email::config()->admin_email);
$output .= $renderer->renderParagraph('Contact an administrator: ' . $mailto . '');
}
$output .= $renderer->renderFooter();
return $output;
}
}
示例14: save
public static function save(array $file, $filename = NULL, $directory = NULL, $chmod = 0644)
{
if (!isset($file['tmp_name']) or !is_uploaded_file($file['tmp_name'])) {
return FALSE;
}
if ($filename === NULL) {
$filename = uniqid() . $file['name'];
}
if (Upload::$remove_spaces === TRUE) {
$filename = preg_replace('/\\s+/', '_', $filename);
}
if ($directory === NULL) {
$directory = Upload::$default_directory;
}
if (!is_dir($directory) or !is_writable(realpath($directory))) {
throw new Kohana_Exception('Directory :dir must be writable', array(':dir' => Debug::path($directory)));
}
$filename = realpath($directory) . DIRECTORY_SEPARATOR . $filename;
if (move_uploaded_file($file['tmp_name'], $filename)) {
if ($chmod !== FALSE) {
chmod($filename, $chmod);
}
return $filename;
}
return FALSE;
}
示例15: validate_authorize_params
/**
*
* @return array
*/
public function validate_authorize_params()
{
$request_params = $this->_get_authorize_params();
$validation = Validation::factory($request_params)->rule('client_id', 'not_empty')->rule('client_id', 'uuid::valid')->rule('response_type', 'not_empty')->rule('response_type', 'in_array', array(':value', OAuth2::$supported_response_types))->rule('scope', 'in_array', array(':value', OAuth2::$supported_scopes))->rule('redirect_uri', 'url');
if (!$validation->check()) {
throw new OAuth2_Exception_InvalidRequest("Invalid Request: " . Debug::vars($validation->errors()));
}
// Check we have a valid client
$client = Model_OAuth2_Client::find_client($request_params['client_id']);
if (!$client->loaded()) {
throw new OAuth2_Exception_InvalidClient('Invalid client');
}
// Lookup the redirect_uri if none was supplied in the URL
if (!Valid::url($request_params['redirect_uri'])) {
$request_params['redirect_uri'] = $client->redirect_uri;
// Is the redirect_uri still empty? Error if so..
if (!Valid::url($request_params['redirect_uri'])) {
throw new OAuth2_Exception_InvalidRequest('\'redirect_uri\' is required');
}
} else {
if ($client->redirect_uri != $request_params['redirect_uri']) {
throw new OAuth2_Exception_InvalidGrant('redirect_uri mismatch');
}
}
// Check if this client is allowed use this response_type
if (!in_array($request_params['response_type'], $client->allowed_response_types())) {
throw new OAuth2_Exception_UnauthorizedClient('You are not allowed use the \':response_type\' response_type', array(':response_type' => $request_params['response_type']));
}
return $request_params;
}