/[cvs]/nfo/php/libs/org.netfrag.glib/utils/extensions.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/utils/extensions.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by joko, Wed Apr 9 07:55:47 2003 UTC revision 1.9 by jonen, Thu Aug 11 14:06:26 2005 UTC
# Line 13  Line 13 
13   * $Id$   * $Id$
14   *   *
15   * $Log$   * $Log$
16     * Revision 1.9  2005/08/11 14:06:26  jonen
17     * + added generic array-key sorting function
18     *
19     * Revision 1.8  2004/07/21 12:56:19  joko
20     * php5 compatibility
21     *
22     * Revision 1.7  2003/06/25 23:41:14  joko
23     * now using "global $Dumper_mode"
24     *
25     * Revision 1.6  2003/04/16 16:24:23  joko
26     * + odd and even from php.net
27     *
28     * Revision 1.5  2003/04/11 01:31:50  joko
29     * + function log (from flib-shortcuts)
30     *
31   * Revision 1.4  2003/04/09 07:55:47  joko   * Revision 1.4  2003/04/09 07:55:47  joko
32   * + function untwingle_reference   * + function untwingle_reference
33   *   *
# Line 172  class php { Line 187  class php {
187    }    }
188    
189    function Dumper() {    function Dumper() {
190        global $Dumper_mode;
191      $arg_list = func_get_args();      $arg_list = func_get_args();
192      $count = 1;      $count = 1;
193    
# Line 189  class php { Line 205  class php {
205        ob_end_clean();        ob_end_clean();
206    
207      //print "mode: " . $this->Dumper_mode . "<br/>";      //print "mode: " . $this->Dumper_mode . "<br/>";
208      //if ($this->Dumper_mode == HTML) {      if ($Dumper_mode == 'single_line') {
209          $var_dump = str_replace("\n", ' ', $var_dump);
210        } else {
211        $var_dump = str_replace("\n", '<br/>', $var_dump);        $var_dump = str_replace("\n", '<br/>', $var_dump);
212        $var_dump = str_replace(" ", '&nbsp;', $var_dump);        $var_dump = str_replace(" ", '&nbsp;', $var_dump);
213      //}      }
214            
215      //if (sizeof($args) == 1) { $var_dump .= '<br/>'; }      //if (sizeof($args) == 1) { $var_dump .= '<br/>'; }
216            
# Line 417  class php { Line 435  class php {
435    
436    // from: http://www.php.net/manual/en/function.method-exists.php    // from: http://www.php.net/manual/en/function.method-exists.php
437    function class_has_method($className, $methodName) {    function class_has_method($className, $methodName) {
438      $bool_exists = (in_array(strtolower($methodName), get_class_methods($className)));  
439        // new as of 2004-07-21: php5 compatibility
440        // taken from http://php.net/manual/en/function.version-compare.php
441        if (version_compare(phpversion(), "5.0.0", "<")) {
442          $methodName = strtolower($methodName);
443        }
444        
445        $bool_exists = (in_array($methodName, get_class_methods($className)));
446      return $bool_exists;      return $bool_exists;
447    }    }
448    
# Line 516  class php { Line 541  class php {
541  */  */
542    
543      if (!class_exists($classname)) {      if (!class_exists($classname)) {
544        user_error("Class '$classname' doesn't exist.");        php::log( "Class '$classname' doesn't exist.", PEAR_LOG_ERR );
545        return;        return;
546      }      }
547    
# Line 685  Bitte versuchen Sie es später nocheinmal Line 710  Bitte versuchen Sie es später nocheinmal
710      }      }
711    }    }
712    
713      // wrapper-function for getting the logger instance
714      // TODO: review! what about php::append_log?
715      function log($string, $level = PEAR_LOG_DEBUG) {
716        global $app;
717        $app->log($string, $level);
718      }
719    
720      // from: http://www.php.net/manual/en/function.array-filter.php#AEN7432
721      function odd($var) {
722          return ($var % 2 == 1);
723      }
724      function even($var) {
725          return ($var % 2 == 0);
726      }
727      
728      // modified version from: http://de.php.net/manual/en/function.array-multisort.php
729      // compare values of two array-keys
730      // usage: asort($array, "comparar_caption");
731      function comparar_caption($a, $b, $key_name="caption") {
732           return strnatcasecmp($a[$key_name], $b[$key_name]);
733      }
734      
735    
736  }  }
737    
738    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.9

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed