/[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.1 by joko, Sat Apr 5 19:53:45 2003 UTC revision 1.7 by joko, Wed Jun 25 23:41:14 2003 UTC
# Line 13  Line 13 
13   * $Id$   * $Id$
14   *   *
15   * $Log$   * $Log$
16     * Revision 1.7  2003/06/25 23:41:14  joko
17     * now using "global $Dumper_mode"
18     *
19     * Revision 1.6  2003/04/16 16:24:23  joko
20     * + odd and even from php.net
21     *
22     * Revision 1.5  2003/04/11 01:31:50  joko
23     * + function log (from flib-shortcuts)
24     *
25     * Revision 1.4  2003/04/09 07:55:47  joko
26     * + function untwingle_reference
27     *
28     * Revision 1.3  2003/04/08 22:35:16  joko
29     * + 'function yesno' from utils/links.php
30     *
31     * Revision 1.2  2003/04/06 01:37:31  jonen
32     * + added functions to generate and handle unique ID's
33     *
34   * Revision 1.1  2003/04/05 19:53:45  joko   * Revision 1.1  2003/04/05 19:53:45  joko
35   * moved here from ../   * moved here from ../
36   *   *
# Line 163  class php { Line 181  class php {
181    }    }
182    
183    function Dumper() {    function Dumper() {
184        global $Dumper_mode;
185      $arg_list = func_get_args();      $arg_list = func_get_args();
186      $count = 1;      $count = 1;
187    
# Line 180  class php { Line 199  class php {
199        ob_end_clean();        ob_end_clean();
200    
201      //print "mode: " . $this->Dumper_mode . "<br/>";      //print "mode: " . $this->Dumper_mode . "<br/>";
202      //if ($this->Dumper_mode == HTML) {      if ($Dumper_mode == 'single_line') {
203          $var_dump = str_replace("\n", ' ', $var_dump);
204        } else {
205        $var_dump = str_replace("\n", '<br/>', $var_dump);        $var_dump = str_replace("\n", '<br/>', $var_dump);
206        $var_dump = str_replace(" ", '&nbsp;', $var_dump);        $var_dump = str_replace(" ", '&nbsp;', $var_dump);
207      //}      }
208            
209      //if (sizeof($args) == 1) { $var_dump .= '<br/>'; }      //if (sizeof($args) == 1) { $var_dump .= '<br/>'; }
210            
# Line 507  class php { Line 528  class php {
528  */  */
529    
530      if (!class_exists($classname)) {      if (!class_exists($classname)) {
531        user_error("Class '$classname' doesn't exist.");        php::log( "Class '$classname' doesn't exist.", PEAR_LOG_ERR );
532        return;        return;
533      }      }
534    
# Line 637  Bitte versuchen Sie es später nocheinmal Line 658  Bitte versuchen Sie es später nocheinmal
658    
659    }    }
660    
661      //examples on howto create unique id's
662      // from: http://www.php.net/manual/en/function.uniqid.php
663      function CreateGUID(){
664        srand((double)microtime()*1000000);
665        $r = rand ;
666        $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
667        $m = md5 ($u);
668        return($m);
669      }
670    
671      function CompressID( $ID ){
672        return(Base64_encode(pack("H*",$ID)));
673      }
674    
675      function ExpandID ($ID){
676        return ( implode(unpack("H*",Base64_decode($ID)), '') );
677      }
678    
679      // from: utils/links.php
680      function yesno($bool) {
681        return $bool ? 'yes' : 'no';
682      }
683    
684      function untwingle_reference($item, $options = array()) {
685        
686        // default
687        if (!$options['seperator']) { $options['seperator'] = '_'; }
688        
689        if ( is_string($item) && (substr($item, 0, 2) == "o_") ) {
690          //print "YAI!<br/>";
691          $parts = split($options['seperator'], $item);
692          $result = array(
693            ident => $parts[1],
694            type => $parts[2],
695          );
696          return $result;
697        }
698      }
699    
700      // wrapper-function for getting the logger instance
701      // TODO: review! what about php::append_log?
702      function log($string, $level = PEAR_LOG_DEBUG) {
703        global $app;
704        $app->log($string, $level);
705      }
706    
707      // from: http://www.php.net/manual/en/function.array-filter.php#AEN7432
708      function odd($var) {
709          return ($var % 2 == 1);
710      }
711      function even($var) {
712          return ($var % 2 == 0);
713      }
714    
715  }  }
716    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

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