Changeset 1367


Ignore:
Timestamp:
03/21/10 09:03:53 (3 years ago)
Author:
shibuya246
Message:

[branch 1.2] recursive loop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/libs/Debug.php

    r1366 r1367  
    189189        $plugins = $h->db->get_results($h->db->prepare($sql)); 
    190190        if ($plugins) { 
    191             foreach ($plugins as $plugin) { 
    192                 if (is_serialized($plugin->plugin_value)) { 
    193                     $plugin->plugin_value = unserialize($plugin->plugin_value); 
    194                     if (is_array($plugin->plugin_value)) { 
    195                         foreach ($plugin->plugin_value as $key => $value) { 
    196                             if (is_array($value)) { 
    197                                 foreach ($value as $k => $v) { 
    198                                     if (is_array($v)) { 
    199                                         $v = serialize($v); 
    200                                         $plugin->plugin_value[$key][$k] = preg_replace("/[a-zA-Z0-9]/", "*", $v); 
    201                                     } else { 
    202                                         $plugin->plugin_value[$key][$k] = preg_replace("/[a-zA-Z0-9]/", "*", $v); 
    203                                     } 
    204                                 } 
    205                             } else { 
    206                                 $plugin->plugin_value[$key] = preg_replace("/[a-zA-Z0-9]/", "*", $value); 
    207                             } 
    208                         } 
    209                         $plugin->plugin_value = serialize($plugin->plugin_value); 
    210                     } 
    211                 } else { 
    212                     $plugin->plugin_value = preg_replace("/[a-zA-Z0-9]/", "*", $plugin->plugin_value); 
    213                 } 
    214                 $report['hotaru_plugin_settings'][$plugin->plugin_folder][$plugin->plugin_setting] = $plugin->plugin_value; 
    215             } 
     191//            foreach ($plugins as $plugin) { 
     192//                if (is_serialized($plugin->plugin_value)) { 
     193//                    $plugin->plugin_value = unserialize($plugin->plugin_value); 
     194//                    if (is_array($plugin->plugin_value)) { 
     195//                        foreach ($plugin->plugin_value as $key => $value) { 
     196//                            if (is_array($value)) { 
     197//                                foreach ($value as $k => $v) { 
     198//                                    if (is_array($v)) { 
     199//                                        $v = serialize($v); 
     200//                                        $plugin->plugin_value[$key][$k] = $this->aaa($v); 
     201//                                    } else { 
     202//                                        $plugin->plugin_value[$key][$k] = preg_replace("/[a-zA-Z0-9]/", "*", $v); 
     203//                                    } 
     204//                                } 
     205//                            } else { 
     206//                                $plugin->plugin_value[$key] = preg_replace("/[a-zA-Z0-9]/", "*", $value); 
     207//                            } 
     208//                        } 
     209//                        $plugin->plugin_value = serialize($plugin->plugin_value); 
     210//                    } 
     211//                } else { 
     212//                    $plugin->plugin_value = preg_replace("/[a-zA-Z0-9]/", "*", $plugin->plugin_value); 
     213//                } 
     214//                $report['hotaru_plugin_settings'][$plugin->plugin_folder][$plugin->plugin_setting] = $plugin->plugin_value; 
     215//            } 
     216 
     217            print_r ($this->loop_through_array($h, $plugins)); 
     218             
    216219        } 
    217220         
     
    256259        return $report; 
    257260    } 
    258      
     261 
     262     function loop_through_array ($h, $array, &$out = array () ) { 
     263        foreach ( (array) $array as $key => $value ) { 
     264            if ( ! is_array ( $value ) ) {                 
     265                $value = serialize($value); 
     266                array_push ( $out, preg_replace("/[a-zA-Z0-9]/", "*", $value) ); 
     267            } 
     268            else { 
     269                $this->loop_through_array ( $value, &$out ); 
     270            } 
     271        } 
     272        return $out; 
     273    } 
     274 
    259275     
    260276    /** 
Note: See TracChangeset for help on using the changeset viewer.