misc.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * The Zoo
  4. *
  5. * @copyright (c) 2007 OSI
  6. * @author Frédéric G. MARAND
  7. * @license Licensed under the CeCILL 2.0
  8. * @version CVS: $Id: misc.php,v 1.2 2007-06-03 21:25:11 marand Exp $
  9. * @link http://drupal.org/project/offload
  10. * @since Not applicable yet
  11. * @package default
  12. */
  13. interface Comparable_Interface
  14. {
  15. /**
  16. * Compare the current instance
  17. *
  18. * @param Comparable_Interface $other
  19. * @return int
  20. */
  21. public function cmp(Comparable_Interface $other);
  22. }
  23. function _debug($msg)
  24. {
  25. global $_debug_active ;
  26. if ($_debug_active)
  27. echo $msg;
  28. }
  29. function __autoload($name)
  30. {
  31. _debug("Autoloading $name\n");
  32. require_once("$name.php");
  33. }
  34. function get_temp_dir()
  35. {
  36. return 'e:/src/OsinetOffice/tmp';
  37. }
  38. function output_encoder($s)
  39. {
  40. return iconv('UTF-8', 'IBM850', $s);
  41. }
  42. // Activate the OB handler:
  43. ob_start("output_encoder", 2);
  44. /**
  45. * automatically find the glade file for a class file
  46. *
  47. */
  48. function load_glade()
  49. {
  50. return new GladeXML(basename($_SERVER['PHP_SELF'], 'php') . 'glade');
  51. }
  52. /**
  53. * returns the name of the invoking function/method
  54. * if it's a method, it is prefixed by the class name
  55. *
  56. * @return string
  57. */
  58. function func_name()
  59. {
  60. $trace = debug_backtrace();
  61. $func = $trace[1]['function'];
  62. if (isset($trace[1]['class']))
  63. $func = $trace[1]['class'] . '::' . $func;
  64. return $func;
  65. }