123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- /**
- * The Zoo
- *
- * @copyright (c) 2007 OSI
- * @author Frédéric G. MARAND
- * @license Licensed under the CeCILL 2.0
- * @version CVS: $Id: misc.php,v 1.4 2007-06-10 19:39:54 marand Exp $
- * @link http://drupal.org/project/offload
- * @since Not applicable yet
- * @package default
- */
- /**
- * Interface used by function providing non-standard comparisons
- * @package default
- */
- interface Comparable_Interface
- {
- /**
- * Compare the current instance
- *
- * @param Comparable_Interface $other
- * @return int
- */
- public function cmp(Comparable_Interface $other);
- }
- function _debug($msg)
- {
- global $_debug_active ;
- if ($_debug_active)
- echo $msg;
- }
- /**
- * Old school autoloader.
- */
- /*
- function __autoload($name)
- {
- _debug("Autoloading $name\n");
- require_once("$name.php");
- }
- */
- /**
- * Sample PSR-0 autoloader.
- *
- * Do not use as such: it is only placed here to show use of the FSM classes in
- * a PSR-0 application.
- *
- * Straight from the PSR-0 standard.
- *
- * @param string $className
- */
- function psr0_autoload($className) {
- $className = ltrim($className, '\\');
- $fileName = '';
- $namespace = '';
- if ($lastNsPos = strripos($className, '\\')) {
- $namespace = substr($className, 0, $lastNsPos);
- $className = substr($className, $lastNsPos + 1);
- $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
- }
- $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
- //print_r(debug_backtrace());
- $sts = require $fileName;
- }
- function get_temp_dir()
- {
- return 'e:/src/OsinetOffice/tmp';
- }
- /**
- * @link http://blog.riff.org/2006_11_19_console_encoding_in_php_gtk_apps
- *
- * @param string $s
- * @return string
- */
- function output_encoder($s)
- {
- return iconv('UTF-8', 'IBM850', $s);
- }
- // Activate the OB handler:
- ob_start("output_encoder", 2);
- /**
- * automatically find the glade file for a class file
- *
- */
- function load_glade()
- {
- return new GladeXML(basename($_SERVER['PHP_SELF'], 'php') . 'glade');
- }
- /**
- * returns the name of the invoking function/method
- * if it's a method, it is prefixed by the class name
- *
- * @return string
- */
- function func_name($level = 1)
- {
- $trace = debug_backtrace();
- $func = $trace[$level]['function'];
- if (isset($trace[$level]['class']))
- $func = $trace[$level]['class'] . '::' . $func;
- return $func;
- }
|