-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/vendor | ||
/composer.lock | ||
/tools/create-phar/tracy.phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
// creates tracy.phar | ||
if (!class_exists('Phar') || ini_get('phar.readonly')) { | ||
echo "Enable Phar extension and set directive 'phar.readonly=off'"; | ||
die(1); | ||
} | ||
|
||
unlink('tracy.phar'); | ||
|
||
$p = new Phar('tracy.phar'); | ||
$p->setStub('<?php | ||
require "src/tracy.php"; | ||
__halt_compiler(); | ||
'); | ||
|
||
$p->startBuffering(); | ||
foreach ($iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/../../src')) as $file) { | ||
echo "adding: {$iterator->getSubPathname()}\n"; | ||
$p[$iterator->getSubPathname()] = php_strip_whitespace($file); | ||
} | ||
|
||
$p->stopBuffering(); | ||
$p->compressFiles(Phar::GZ); | ||
|
||
echo 'OK'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php ob_start(); // needed by FireLogger ?> | ||
|
||
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css"> | ||
|
||
<h1>FireLogger demo</h1> | ||
|
||
<p>Requires Firefox, Firebug and <a href="http://firelogger.binaryage.com">FireLogger</a>.</p> | ||
|
||
<?php | ||
|
||
require __DIR__ . '/../../src/tracy.php'; | ||
|
||
use Tracy\Debugger; | ||
|
||
|
||
$arr = array(10, 20, array('key1' => 'val1', 'key2' => TRUE)); | ||
|
||
// will show in FireLogger tab in Firebug | ||
Debugger::fireLog('Hello World'); | ||
Debugger::fireLog($arr); | ||
|
||
|
||
function first($arg1, $arg2) | ||
{ | ||
second(TRUE, FALSE); | ||
} | ||
|
||
|
||
|
||
function second($arg1, $arg2) | ||
{ | ||
third(array(1, 2, 3)); | ||
} | ||
|
||
|
||
function third($arg1) | ||
{ | ||
throw new Exception('The my exception', 123); | ||
} | ||
|
||
try { | ||
first(10, 'any string'); | ||
} catch (Exception $e) { | ||
Debugger::fireLog($e); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
body { | ||
font: 15px/1.5 Tahoma, Verdana, Myriad Web, Syntax, sans-serif; | ||
color: #333; | ||
background: #fff url('dibi-powered.gif') no-repeat 99% 1em; | ||
margin: 1.6em; | ||
padding: 0; | ||
} | ||
|
||
h1 { | ||
font-size: 210%; | ||
font-weight: normal; | ||
color: #036; | ||
} | ||
|
||
pre.tracy-dump { | ||
border: 1px solid silver; | ||
padding: 1em; | ||
margin: 1em 0; | ||
} | ||
|
||
a { | ||
color: #000080; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css"> | ||
|
||
<style> html { background: url(assets/arrow.png) no-repeat bottom right; height: 100%; } </style> | ||
|
||
<h1>Tracy Debug Bar demo</h1> | ||
|
||
<p>You can dump variables to bar in rightmost bottom egde.</p> | ||
|
||
<?php | ||
|
||
require __DIR__ . '/../../src/tracy.php'; | ||
|
||
use Tracy\Debugger; | ||
|
||
Debugger::enable(); | ||
|
||
$arr = array(10, 20.2, TRUE, NULL, 'hello', (object) NULL, array()); | ||
|
||
|
||
Debugger::barDump(get_defined_vars()); | ||
|
||
Debugger::barDump($arr, 'The Array'); | ||
|
||
Debugger::barDump('<a href="#">test</a>', 'String'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css"> | ||
|
||
<h1>Tracy Dumper demo</h1> | ||
|
||
<?php | ||
|
||
require __DIR__ . '/../../src/tracy.php'; | ||
|
||
use Tracy\Debugger; | ||
|
||
|
||
Debugger::enable(); | ||
|
||
class Test | ||
{ | ||
public $x = array(10, NULL); | ||
|
||
private $y = 'hello'; | ||
|
||
protected $z = 30; | ||
} | ||
|
||
$arr = array(10, 20.2, TRUE, NULL, 'hello', (object) NULL, array(), fopen(__FILE__, 'r')); | ||
|
||
$obj = new Test; | ||
|
||
|
||
dump('<a href="#">test</a>'); | ||
|
||
dump($arr); | ||
|
||
dump($obj); | ||
|
||
|
||
echo "<h2>With location</h2>\n"; | ||
|
||
Debugger::$showLocation = TRUE; | ||
|
||
dump($arr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css"> | ||
|
||
<h1>Tracy Exception demo</h1> | ||
|
||
<?php | ||
|
||
require __DIR__ . '/../../src/tracy.php'; | ||
|
||
use Tracy\Debugger; | ||
|
||
Debugger::enable(); | ||
|
||
|
||
function first($arg1, $arg2) | ||
{ | ||
second(TRUE, FALSE); | ||
} | ||
|
||
|
||
|
||
function second($arg1, $arg2) | ||
{ | ||
third(array(1, 2, 3)); | ||
} | ||
|
||
|
||
function third($arg1) | ||
{ | ||
throw new Exception('The my exception', 123); | ||
} | ||
|
||
|
||
first(10, 'any string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css"> | ||
|
||
<h1>Tracy Fatal Error demo</h1> | ||
|
||
<?php | ||
|
||
require __DIR__ . '/../../src/tracy.php'; | ||
|
||
use Tracy\Debugger; | ||
|
||
|
||
Debugger::enable(); | ||
|
||
|
||
|
||
function first($arg1, $arg2) | ||
{ | ||
second(TRUE, FALSE); | ||
} | ||
|
||
|
||
|
||
function second($arg1, $arg2) | ||
{ | ||
third(array(1, 2, 3)); | ||
} | ||
|
||
|
||
function third($arg1) | ||
{ | ||
missing_funcion(); | ||
} | ||
|
||
|
||
first(10, 'any string'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@echo off | ||
:: This Windows batch file sets open-editor.js as handler for editor:// protocol | ||
|
||
if defined PROCESSOR_ARCHITEW6432 (set reg="%systemroot%\sysnative\reg.exe") else (set reg=reg) | ||
|
||
%reg% ADD HKCR\editor /ve /d "URL:editor Protocol" /f | ||
%reg% ADD HKCR\editor /v "URL Protocol" /d "" /f | ||
%reg% ADD HKCR\editor\shell\open\command /ve /d "wscript \"%~dp0open-editor.js\" \"%%1\"" /f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// NetBeans | ||
// var editor = '"C:\\Program Files\\NetBeans 6.9.1\\bin\\netbeans.exe" "%file%:%line%" --console suppress'; | ||
|
||
// Nusphere PHPEd | ||
// var editor = '"C:\\Program Files\\NuSphere\\PhpED\\phped.exe" "%file%" --line=%line%'; | ||
|
||
// SciTE | ||
// var editor = '"C:\\Program Files\\SciTE\\scite.exe" "-open:%file%" -goto:%line%'; | ||
|
||
// EmEditor | ||
// var editor = '"C:\\Program Files\\EmEditor\\EmEditor.exe" "%file%" /l %line%'; | ||
|
||
// PSPad Editor | ||
// var editor = '"C:\\Program Files\\PSPad editor\\PSPad.exe" -%line% "%file%"'; | ||
|
||
// gVim | ||
// var editor = '"C:\\Program Files\\Vim\\vim73\\gvim.exe" "%file%" +%line%'; | ||
|
||
// Sublime Text 2 | ||
// var editor = '"C:\\Program Files\\Sublime Text 2\\sublime_text.exe" "%file%:%line%"'; | ||
|
||
var mappings = { | ||
// '/remotepath': '/localpath' | ||
}; | ||
|
||
if (typeof editor === 'undefined') { | ||
WScript.Echo('Create variable "editor" in ' + WScript.ScriptFullName); | ||
WScript.Quit(); | ||
} | ||
|
||
var url = WScript.Arguments(0); | ||
var match = /^editor:\/\/open\/\?file=(.+)&line=(\d+)/.exec(url); | ||
if (match) { | ||
var file = decodeURIComponent(match[1]).replace(/\+/g, ' '); | ||
for (var id in mappings) { | ||
if (file.indexOf(id) === 0) { | ||
file = mappings[id] + file.substr(id.length); | ||
break; | ||
} | ||
} | ||
var command = editor.replace(/%line%/g, match[2]).replace(/%file%/g, file); | ||
var shell = new ActiveXObject("WScript.Shell"); | ||
shell.Exec(command.replace(/\\/g, '\\\\')); | ||
} |