WordPress.org

Plugin Directory

Changeset 332780


Ignore:
Timestamp:
01/15/11 06:59:56 (7 years ago)
Author:
koopersmith
Message:

Add support for multiple MySQL queries, add query to output, and improve output CSS.

Location:
debug-bar-console/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • debug-bar-console/trunk/class-debug-bar-console.php

    r332764 r332780  
    3838 
    3939        if ( preg_match( "/^SELECT|UPDATE|ALTER|DELETE|CREATE|INSERT'/i", $data ) ) { 
    40             $this->print_mysql_table( $wpdb->get_results( $data, ARRAY_A ) ); 
     40            $data = explode( ";\n", $data ); 
     41            foreach ( $data as $query ) { 
     42                $this->print_mysql_table( $wpdb->get_results( $query, ARRAY_A ), $query ); 
     43            } 
    4144            die(); 
    4245        } 
     
    4649    } 
    4750 
    48     function print_mysql_table( $data ) { 
     51    function print_mysql_table( $data, $query='' ) { 
    4952        if ( empty( $data ) ) 
    5053            return; 
    5154 
    5255        $keys = array_keys( $data[0] ); 
    53         echo '<table class="mysql" cellpadding="0"><thead><tr>'; 
    5456 
     57        echo '<table class="mysql" cellpadding="0"><thead>'; 
     58 
     59        if ( ! empty( $query ) ) 
     60            echo "<tr class='query'><td colspan='" . count($keys) . "'>$query</td></tr>"; 
     61 
     62        echo '<tr>'; 
    5563        foreach ( $keys as $key ) { 
    5664            echo "<th class='$key'>$key</th>"; 
    5765        } 
    58  
    5966        echo '</tr></thead><tbody>'; 
    6067 
     
    6774        } 
    6875 
    69         echo '</tbody></table>'; 
     76        echo '</tbody></table></div>'; 
    7077    } 
    7178} 
  • debug-bar-console/trunk/css/iframe.css

    r332766 r332780  
    1 html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{background:transparent;border:0;margin:0;padding:0;vertical-align:baseline;}body{line-height:1;}h1,h2,h3,h4,h5,h6{clear:both;font-weight:normal;}ol,ul{list-style:none;}blockquote{quotes:none;}blockquote:before,blockquote:after{content:'';content:none;}del{text-decoration:line-through;}table{border-collapse:collapse;border-spacing:0;}a img{border:none;}body{padding:5px;font-family:Consolas,Monaco,Courier,monospace;font-size:12px;color:#666;}table{font-size:12px;}th{color:#333;background:#f9f9f9;}th,td{text-align:left;padding:3px 5px 0;border:1px solid #f4f4f4;} 
     1html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{background:transparent;border:0;margin:0;padding:0;vertical-align:baseline;}body{line-height:1;}h1,h2,h3,h4,h5,h6{clear:both;font-weight:normal;}ol,ul{list-style:none;}blockquote{quotes:none;}blockquote:before,blockquote:after{content:'';content:none;}del{text-decoration:line-through;}table{border-collapse:collapse;border-spacing:0;}a img{border:none;}body{padding:5px;font-family:Consolas,Monaco,Courier,monospace;font-size:12px;color:#666;}table{font-size:12px;}.mysql{min-width:100%;margin-bottom:5px;}th{color:#333;background:#f9f9f9;}th,td{text-align:left;padding:3px 5px 0;border:1px solid #ccc;}.query{padding:5px;color:#555;background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));text-shadow:0 1px 0 #f4f4f4;} 
  • debug-bar-console/trunk/css/iframe.dev.css

    r332766 r332780  
    5757    font-size: 12px; 
    5858} 
     59.mysql { 
     60    min-width: 100%; 
     61    margin-bottom: 5px; 
     62} 
     63 
    5964th { 
    6065    color: #333; 
     
    6469    text-align: left; 
    6570    padding: 3px 5px 0; 
    66     border: 1px solid #f4f4f4; 
     71    border: 1px solid #ccc; 
    6772} 
     73.query { 
     74    padding: 5px; 
     75    color: #555; 
     76    background: #d9d9d9; /* fallback color */ 
     77    background:-moz-linear-gradient(bottom,  #d7d7d7,  #e4e4e4); 
     78    background:-webkit-gradient(linear, left bottom, left top, from(#d7d7d7), to(#e4e4e4)); 
     79    text-shadow: 0 1px 0 #f4f4f4; 
     80} 
Note: See TracChangeset for help on using the changeset viewer.