trimString = intval( $options['trimString'] ); if( isset( $options['autoCollapsed'] ) ) $this->autoCollapsed = $options['autoCollapsed']; if( isset( $options['autoOpen'] ) ){ $options['autoOpen'] = (array)$options['autoOpen']; $this->autoOpen = $options['autoOpen']; $this->autoCollapsed = TRUE; } } /** * Guesses the options */ function parseOptions(){ $options = func_get_args(); if( sizeof( $options ) == 0 ) // default return $options; if( is_array( $options[0] ) ) // trivial options return $options[0]; $newOptions = array(); foreach( $options as $opt ){ switch( gettype( $opt ) ){ case 'boolean': $newOptions['autoCollapsed'] = $opt; break; case 'integer': $newOptions['trimString'] = $opt; break; case 'string': case 'array': $newOptions['autoOpen'] = $opt; break; } } return $newOptions; } function pp( $val, $curLevel = 0, $key = NULL, $isLast = true ){ if( $curLevel == 0 ){ $this->arRecursion = array(); // drop recursion cache between top-level funciton calls $domId = 'pp_' . ++self::$callCntr; echo '
'; $this->backtrace(); echo ''; $this->p_css(); $this->p_jsfunc(); $this->p_jsinit( $domId ); echo '
'; } } protected function p_bool( $val ){ echo ''.strtoupper( var_export( $val, TRUE ) ).''; } protected function p_null( $val ){ echo ''.strtoupper( var_export( $val, TRUE ) ).''; } protected function p_basic( $val ){ echo ''.$val.''; } protected function p_string( $val ){ $val = htmlspecialchars( $val ); if( $this->trimString > 0 && strlen( $val ) > $this->trimString ){ if( $this->trimString > 3 ) $val = substr( $val, 0, $this->trimString - 3 ).'...'; else $val = substr( $val, 0, $this->trimString ); } echo ''.$val.''; } protected function p_array( $val, $curLevel ){ $size = sizeof( $val ); echo 'Array('.$size.')'; echo ''; } protected function p_object( $val, $curLevel ){ $className = get_class( $val ); $val = (array)$val; $size = sizeof( $val ); echo 'Object <'.$className.'>('.$size.')'; echo ''; } protected function p_res( $val ){ echo ''.$val.' <'.get_resource_type( $val ).'>'; } protected function p_unknown( $val ){ echo '"'.$val.'"'; } /** * Prints a mark before the tree */ protected function backtrace(){ $backtrace = debug_backtrace(); if( $backtrace[2]['function'] == 'pp' ) $arToPrint = $backtrace[2 + self::TRACE_DEPTH]; // run as a function else $arToPrint = $backtrace[1 + self::TRACE_DEPTH]; // run as a method echo '
'.$arToPrint['file'].' '.$arToPrint['line'].'
'; } protected function p_jsfunc(){ if( self::$jsFuncDisp ) return; else self::$jsFuncDisp = TRUE; echo ''; } protected function p_jsinit( $id ){ echo ''; } protected function p_css(){ if( self::$cssDisp ) return; else self::$cssDisp = TRUE; echo ''; } } function dd(){ $options = func_get_args(); $val = array_shift( $options ); // trim first argument $die = array_shift( $options ); // exit? $die = ($die === false || $die === 0) ? $die = false : $die = true; // crazy thing to call constructor with variable arguments number $reflection = new ReflectionClass( 'hf_pp' ); $pp = $reflection->newInstanceArgs( $options ); $pp->pp( $val ); unset( $pp, $reflection, $val, $options ); if ($die) exit; } Сайт временно недоступен

Сайт временно недоступен

Идет разработка сайта... сорян