PageRenderTime 22ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/sites/all/libraries/FirePHPCore/FirePHPCore/demo/oo.php

https://github.com/zzolo/incl
PHP | 89 lines | 29 code | 20 blank | 40 comment | 0 complexity | 3a484b1627af73c9d5ca53d433f03399 MD5 | raw file
  1. <?php
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. *
  4. * This file is part of FirePHP (http://www.firephp.org/).
  5. *
  6. * Software License Agreement (New BSD License)
  7. *
  8. * Copyright (c) 2006-2009, Christoph Dorn
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. *
  14. * * Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. *
  17. * * Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. *
  21. * * Neither the name of Christoph Dorn nor the names of its
  22. * contributors may be used to endorse or promote products derived from this
  23. * software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  26. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  27. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  28. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  29. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  30. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  31. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  32. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  34. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /* NOTE: You must have the FirePHPCore library in your include path */
  38. set_include_path('./../lib/'.PATH_SEPARATOR.get_include_path());
  39. require('FirePHPCore/FirePHP.class.php');
  40. /* NOTE: You must have Output Buffering enabled via
  41. ob_start() or output_buffering ini directive. */
  42. $firephp = FirePHP::getInstance(true);
  43. $firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */
  44. $firephp->fb('Log message' ,FirePHP::LOG);
  45. $firephp->fb('Info message' ,FirePHP::INFO);
  46. $firephp->fb('Warn message' ,FirePHP::WARN);
  47. $firephp->fb('Error message',FirePHP::ERROR);
  48. $firephp->fb('Message with label','Label',FirePHP::LOG);
  49. $firephp->fb(array('key1'=>'val1',
  50. 'key2'=>array(array('v1','v2'),'v3')),
  51. 'TestArray',FirePHP::LOG);
  52. function test($Arg1) {
  53. throw new Exception('Test Exception');
  54. }
  55. try {
  56. test(array('Hello'=>'World'));
  57. } catch(Exception $e) {
  58. /* Log exception including stack trace & variables */
  59. $firephp->fb($e);
  60. }
  61. $firephp->fb('Backtrace to here',FirePHP::TRACE);
  62. $firephp->fb(array('2 SQL queries took 0.06 seconds',array(
  63. array('SQL Statement','Time','Result'),
  64. array('SELECT * FROM Foo','0.02',array('row1','row2')),
  65. array('SELECT * FROM Bar','0.04',array('row1','row2'))
  66. )),FirePHP::TABLE);
  67. /* Will show only in "Server" tab for the request */
  68. $firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP);
  69. print 'Hello World';