Esempio n. 1
0
function dbm_enqueue_scripts()
{
    wp_enqueue_script('bootstrap_js', plugins_url('/bootstrap/bootstrap.min.js', __FILE__), array('jquery'));
    wp_enqueue_style('bootstrap_css', plugins_url('/bootstrap/bootstrap.min.css', __FILE__));
    wp_enqueue_style('bootstrap_css_mods', plugins_url('/bootstrap/bootstrap_style_modifications.css', __FILE__));
    // soundcloud shit
    // maybe this should all be concat and uglified together as well
    wp_enqueue_script('waveform_js', plugins_url('/soundcloud/waveform.js', __FILE__), array('jquery'));
    wp_enqueue_script('soundcloud_api_js', plugins_url('/soundcloud/soundcloud.player.api.js', __FILE__), array('jquery'));
    wp_enqueue_script('soundcloud_player_js', plugins_url('/soundcloud/sc-player.js', __FILE__), array('jquery'));
    wp_enqueue_style('soundcloud_css', plugins_url('/soundcloud/sc-player.css', __FILE__));
    //**
    // this file concats all custom scripts
    // located inside /src/js/*.js
    // any folders inside /src/js/ are NOT included
    //**
    wp_enqueue_script('db_network_js', plugins_url('/js/db-network.js', __FILE__), array('jquery'));
    /*                     *\	
    	 **        UGLIFY         **
    	**   /src/js/uglify/*.js   **
    
    	history_js  _ history.js - ajax across all sites
    	stickem     - sticky 
    	blazy lazy  - loading
    	dotdotdot   - truncate text
    	pushmenu    - cabinet
    	waypoints   - not entirely sure what we use this for
    	marquee     - for soundcloud
    	modernizrr  - for browser shit
    
    	*/
    wp_enqueue_script('db_network_uglify_js', plugins_url('/js/db-network-uglify.js', __FILE__), array('jquery'));
    wp_enqueue_style('db_network_css', plugins_url('/style.css', __FILE__));
    wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');
    // create ajax functionality for my custom js
    wp_localize_script('db_network_js', 'DB_Ajax', array('ajaxurl' => admin_url('admin-ajax.php')));
    wp_localize_script('db_network_js', 'DB_Ajax', array('ajaxurl' => admin_url('admin-ajax.php'), 'postCommentNonce' => wp_create_nonce('myajax-post-comment-nonce')));
    wp_localize_script('soundcloud_player_js', 'sc_params', get_theme_colors());
}
Esempio n. 2
0
function render_db(EurekaProfiler_Session $session)
{
    $queries = $session->events_of_type('db');
    $colors = get_theme_colors();
    if (empty($queries)) {
        echo '<h2>This panel has no log items.</h2>';
        return;
    }
    ?>
    <table class="summary">
        <tr>
            <td style="background: #953FA1;">
                <h3><?php 
    echo EurekaProfiler_Tools::readable_interval($session->total_query_time());
    ?>
</h3>
                <h4>Total time</h4>
            </td>
        </tr>
        <tr>
            <td style="background: #7B3384;padding-top:0" class="border">
                <?php 
    $chart_rows = array();
    $i = 0;
    foreach ($queries as $query) {
        $i++;
        $chart_rows[] = array($i . ': ' . (empty($query->text) ? $query->query : $query->text), $query->duration);
    }
    echo render_chart($chart_rows, 'Query');
    ?>
                <h4>Time chart</h4>
            </td>
        </tr>
    </table>

    <!-- Query Data-->
    <div class="data-wrapper">
        <table class="data data-db">
            <?php 
    $i = 0;
    foreach ($queries as $query) {
        /* @var $query ProfilerQuery */
        //EXPLAIN info
        if (empty($query->explain)) {
            $explain_html = 'No EXPLAIN info';
        } else {
            $explain_html = array();
            foreach ($query->explain as $key => $value) {
                $name = ucwords(str_replace('_', ' ', $key));
                $explain_html[] = "{$name}: <strong>{$value}</strong>";
            }
            $explain_html = implode(' &middot ', $explain_html);
        }
        //Query Info
        if (empty($query->text)) {
            $query_html = htmlspecialchars($query->query);
        } else {
            $query_html = $query->text;
            $original_query = $query->query;
            if (class_exists('Dump') && method_exists('Dump', 'source')) {
                $original_query = Dump::source($original_query, 'mysql');
            }
            $explain_html = '<a class="show-original-query" title="Show full original query" href="#" onclick="app_show_popup(' . htmlspecialchars(json_encode($original_query)) . ', \'Original query\');return false;">[SHOW]</a>&nbsp;' . $explain_html;
        }
        $html = '<div class="query">' . $query_html . '</div>' . '<div class="query-explain">' . $explain_html . '</div>';
        basic_row($i + 1, $html, EurekaProfiler_Tools::readable_interval($query->duration), $colors[$i % count($colors)]);
        $i++;
    }
    ?>
        </table>
    </div>
<?php 
}