About 119,042 results: "php is_string"
Page 1 of 50
Filter Results
Sources
Languages
Filter Results
Try Search On


is_string.php in hppg http://hppg.googlecode.com/svn/trunk/ | 55 lines | PHP
  1.     {
  2.         return is_string( $value );












  1. translate(array$args){$this->identifiers=new
  2. DibiHashMap(array($this,'delimite'));$this->driver=$this->connection->getDriver();$args=array_values($args);while(count($args)===1&&is_array($args[0])){$args=array_values($args[0]);}$this->args=$args;$this->limit=-1;$this->offset=0;$this->hasError=FALSE;$commandIns=NULL;$lastArr=NULL;$cursor=&$this->cursor;$cursor=0;$this->ifLevel=$this->ifLevelStart=0;$comment=&$this->comment;$comment=FALSE;$sql=array();while($cursor<count($this->args)){$arg=$this->args[$cursor];$cursor++;if(is_string($arg)){$toSkip=strcspn($arg,'`[\'":%?');if(strlen($arg)===$toSkip){$sql[]=$arg;}else{$sql[]=substr($arg,0,$toSkip).preg_replace_callback('/(?=[`[\'":%?])(?:`(.+?)`|\[(.+?)\]|(\')((?:\'\'|[^\'])*)\'|(")((?:""|[^"])*)"|(\'|")|:(\S*?:)([a-zA-Z0-9._]?)|%([a-zA-Z~][a-zA-Z0-9~]{0,5})|(\?))/s',array($this,'cb'),substr($arg,$toSkip));if(preg_last_error())throw
  3. instanceof
  4. Traversable){$arg=iterator_to_array($arg);}if(is_array($arg)){if(is_string(key($arg))){if($commandIns===NULL){$commandIns=strtoupper(substr(ltrim($this->args[0]),0,6));$commandIns=$commandIns==='INSERT'||$commandIns==='REPLAC';$sql[]=$this->formatValue($arg,$commandIns?'v':'a');}else{if($lastArr===$cursor-1)$sql[]=',';$sql[]=$this->formatValue($arg,$commandIns?'l':'a');}$lastArr=$cursor;continue;}}$sql[]=$this->formatValue($arg,FALSE);}if($comment)$sql[]="*/";$sql=implode(' ',$sql);if($this->hasError){throw
  5. Traversable){$value=iterator_to_array($value);}if(is_array($value)){$vx=$kx=array();switch($modifier){case'and':case'or':if(empty($value)){return'1=1';}foreach($value
  6. as$k=>$v){if(is_string($k)){$pair=explode('%',$k,2);$k=$this->identifiers->{$pair[0]}.' ';if(!isset($pair[1])){$v=$this->formatValue($v,FALSE);$vx[]=$k.($v==='NULL'?'IS ':'= ').$v;}elseif($pair[1]==='ex'){$vx[]=$k.$this->formatValue($v,'ex');}else{$v=$this->formatValue($v,$pair[1]);if($pair[1]==='l'||$pair[1]==='in'){$op='IN ';}elseif(strpos($pair[1],'like')!==FALSE){$op='LIKE ';}elseif($v==='NULL'){$op='IS ';}else{$op='= ';}$vx[]=$k.$op.$v;}}else{$vx[]=$this->formatValue($v,'ex');}}return'('.implode(') '.strtoupper($modifier).' (',$vx).')';case'n':foreach($value
  7. as$k=>$v){if(is_string($k)){$vx[]=$this->identifiers->$k.(empty($v)?'':' AS '.$this->identifiers->$v);}else{$pair=explode('%',$v,2);$vx[]=$this->identifiers->{$pair[0]};}}return
  8. implode(', ',$vx);case'a':foreach($value
  9. as$k=>$v){$vx[$k]='('.implode(', ',$v).')';}return'('.implode(', ',$kx).') VALUES '.implode(', ',$vx);case'by':foreach($value
  10. as$k=>$v){if(is_array($v)){$vx[]=$this->formatValue($v,'ex');}elseif(is_string($k)){$v=(is_string($v)&&strncasecmp($v,'d',1))||$v>0?'ASC':'DESC';$vx[]=$this->identifiers->$k.' '.$v;}else{$vx[]=$this->identifiers->$v;}}return
  11. instanceof
  12. DateTime)){$this->hasError=TRUE;return'**Unexpected type '.gettype($value).'**';}switch($modifier){case's':case'bin':case'b':return$value===NULL?'NULL':$this->driver->escape($value,$modifier);case'sN':case'sn':return$value==''?'NULL':$this->driver->escape($value,dibi::TEXT);case'iN':case'in':if($value=='')$value=NULL;case'i':case'u':if(is_string($value)&&preg_match('#[+-]?\d++(e\d+)?$#A',$value)){return$value;}else{return$value===NULL?'NULL':(string)(int)($value+0);}case'f':if(is_string($value)&&is_numeric($value)&&strpos($value,'x')===FALSE){return$value;}else{return$value===NULL?'NULL':rtrim(rtrim(number_format($value+0,5,'.',''),'0'),'.');}case'd':case't':if($value===NULL){return'NULL';}else{if(is_numeric($value)){$value=(int)$value;}elseif(is_string($value)){$value=new
  13. new
  14. DibiPcreException;}return$value;case'SQL':return(string)$value;case'like~':return$this->driver->escapeLike($value,1);case'~like':return$this->driver->escapeLike($value,-1);case'~like~':return$this->driver->escapeLike($value,0);case'and':case'or':case'a':case'l':case'v':$this->hasError=TRUE;return'**Unexpected type '.gettype($value).'**';default:$this->hasError=TRUE;return"**Unknown or invalid modifier %$modifier**";}}if(is_string($value)){return$this->driver->escape($value,dibi::TEXT);}elseif(is_int($value)){return(string)$value;}elseif(is_float($value)){return
  15. getPanel(){$s=NULL;$h='htmlSpecialChars';foreach($this->events
  16. as$event){$explain=NULL;if($this->explain&&$event->type===DibiEvent::SELECT){try{$backup=array($event->connection->onEvent,dibi::$numOfQueries,dibi::$totalTime);$event->connection->onEvent=NULL;$cmd=is_string($this->explain)?$this->explain:($event->connection->getConfig('driver')==='oracle'?'EXPLAIN PLAN':'EXPLAIN');$explain=dibi::dump($event->connection->nativeQuery("$cmd $event->sql"),TRUE);}catch(DibiException$e){}list($event->connection->onEvent,dibi::$numOfQueries,dibi::$totalTime)=$backup;}$s.='<tr><td>'.sprintf('%0.3f',$event->time*1000);if($explain){static$counter;$counter++;$s.="<br /><a href='#' class='nette-toggler' rel='#nette-debug-DibiProfiler-row-$counter'>explain&nbsp;&#x25ba;</a>";}$s.='</td><td class="nette-DibiProfiler-sql">'.dibi::dump(strlen($event->sql)>self::$maxLength?substr($event->sql,0,self::$maxLength).'...':$event->sql,TRUE);if($explain){$s.="<div id='nette-debug-DibiProfiler-row-$counter' class='nette-collapsed'>{$explain}</div>";}if($event->source){$helpers='Nette\Diagnostics\Helpers';if(!class_exists($helpers)){$helpers=class_exists('NDebugHelpers')?'NDebugHelpers':'DebugHelpers';}$s.=call_user_func(array($helpers,'editorLink'),$event->source[0],$event->source[1])->class('nette-DibiProfiler-source');}$s.="</td><td>{$event->count}</td><td>{$h($event->connection->getConfig('driver').'/'.$event->connection->getConfig('name'))}</td></tr>";}return






Back to Top