當前位置: 首頁>>代碼示例>>PHP>>正文


PHP QM_Collectors類代碼示例

本文整理匯總了PHP中QM_Collectors的典型用法代碼示例。如果您正苦於以下問題:PHP QM_Collectors類的具體用法?PHP QM_Collectors怎麽用?PHP QM_Collectors使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了QM_Collectors類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: register_qm_output_html_transients

function register_qm_output_html_transients(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('transients')) {
        $output['transients'] = new QM_Output_Html_Transients($collector);
    }
    return $output;
}
開發者ID:pfkellogg,項目名稱:hooks_good_one,代碼行數:7,代碼來源:transients.php

示例2: test_admin_toolbar_for_home_page

 public function test_admin_toolbar_for_home_page()
 {
     $this->go_to_with_template(home_url());
     $this->assertTrue($this->html->is_active());
     $this->assertTrue($this->html->should_dispatch());
     ob_start();
     $this->html->dispatch();
     $output = ob_get_clean();
     $this->assertNotEmpty($output);
     $expected = array('admin' => false, 'assets' => true, 'conditionals' => false, 'db_callers' => true, 'db_components' => true, 'db_queries' => true, 'debug_bar' => false, 'environment' => true, 'hooks' => true, 'http' => true, 'languages' => true, 'overview' => false, 'php_errors' => false, 'redirects' => false, 'request' => true, 'theme' => true, 'transients' => true);
     $collectors = QM_Collectors::init();
     $menu = $this->html->js_admin_bar_menu();
     $this->assertInternalType('array', $menu);
     $this->assertArrayHasKey('top', $menu);
     $this->assertArrayHasKey('sub', $menu);
     $this->assertNotEmpty($menu['sub']);
     foreach ($collectors as $collector) {
         $this->assertArrayHasKey($collector->id, $expected, sprintf('%s is not present in the test menu', $collector->id));
         if ($expected[$collector->id]) {
             $this->assertArrayHasKey('query-monitor-' . $collector->id, $menu['sub']);
         } else {
             $this->assertArrayNotHasKey('query-monitor-' . $collector->id, $menu['sub']);
         }
     }
 }
開發者ID:rene-hermenau,項目名稱:query-monitor,代碼行數:25,代碼來源:test-dispatcher-html.php

示例3: process

 public function process()
 {
     global $wp_actions, $wp_filter;
     $this->hide_qm = (defined('QM_HIDE_SELF') and QM_HIDE_SELF);
     $this->hide_core = (defined('QM_HIDE_CORE_HOOKS') and QM_HIDE_CORE_HOOKS);
     if (is_admin() and $admin = QM_Collectors::get('admin')) {
         $this->data['screen'] = $admin->data['base'];
     } else {
         $this->data['screen'] = '';
     }
     $hooks = $all_parts = $components = array();
     if (has_filter('all')) {
         $hooks['all'] = $this->process_action('all', $wp_filter);
     }
     if (defined('QM_SHOW_ALL_HOOKS') && QM_SHOW_ALL_HOOKS) {
         // Show all hooks
         $hook_names = array_keys($wp_filter);
     } else {
         // Only show action hooks that have been called at least once
         $hook_names = array_keys($wp_actions);
     }
     foreach ($hook_names as $name) {
         $hooks[$name] = $this->process_action($name, $wp_filter);
         $all_parts = array_merge($all_parts, $hooks[$name]['parts']);
         $components = array_merge($components, $hooks[$name]['components']);
     }
     $this->data['hooks'] = $hooks;
     $this->data['parts'] = array_unique(array_filter($all_parts));
     $this->data['components'] = array_unique(array_filter($components));
 }
開發者ID:darbymanning,項目名稱:Family-Church,代碼行數:30,代碼來源:hooks.php

示例4: register_qm_output_headers_redirects

function register_qm_output_headers_redirects(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('redirects')) {
        $output['redirects'] = new QM_Output_Headers_Redirects($collector);
    }
    return $output;
}
開發者ID:giridhar9,項目名稱:Portfolio,代碼行數:7,代碼來源:redirects.php

示例5: register_qm_output_html_rewrites

function register_qm_output_html_rewrites(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('rewrites')) {
        $output['rewrites'] = new QM_Output_Html_Rewrites($collector);
    }
    return $output;
}
開發者ID:johnbillion,項目名稱:query-monitor,代碼行數:7,代碼來源:rewrites.php

示例6: register_qm_output_headers_php_errors

function register_qm_output_headers_php_errors(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('php_errors')) {
        $output['php_errors'] = new QM_Output_Headers_PHP_Errors($collector);
    }
    return $output;
}
開發者ID:pfkellogg,項目名稱:hooks_good_one,代碼行數:7,代碼來源:php_errors.php

示例7: register_qm_output_html_theme

function register_qm_output_html_theme(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('theme')) {
        $output['theme'] = new QM_Output_Html_Theme($collector);
    }
    return $output;
}
開發者ID:giridhar9,項目名稱:Portfolio,代碼行數:7,代碼來源:theme.php

示例8: register_qm_output_html_languages

function register_qm_output_html_languages(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('languages')) {
        $output['languages'] = new QM_Output_Html_Languages($collector);
    }
    return $output;
}
開發者ID:Automattic,項目名稱:vip-mu-plugins-public,代碼行數:7,代碼來源:languages.php

示例9: register_qm_output_headers_overview

function register_qm_output_headers_overview(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('overview')) {
        $output['overview'] = new QM_Output_Headers_Overview($collector);
    }
    return $output;
}
開發者ID:rene-hermenau,項目名稱:query-monitor,代碼行數:7,代碼來源:overview.php

示例10: register_qm_output_html_admin

function register_qm_output_html_admin(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('admin')) {
        $output['admin'] = new QM_Output_Html_Admin($collector);
    }
    return $output;
}
開發者ID:johnbillion,項目名稱:query-monitor,代碼行數:7,代碼來源:admin.php

示例11: register_qm_output_html_conditionals

function register_qm_output_html_conditionals(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('conditionals')) {
        $output['conditionals'] = new QM_Output_Html_Conditionals($collector);
    }
    return $output;
}
開發者ID:giridhar9,項目名稱:Portfolio,代碼行數:7,代碼來源:conditionals.php

示例12: output

 public function output()
 {
     $data = $this->collector->get_data();
     $db_query_num = null;
     $db_query_types = array();
     $db_queries = QM_Collectors::get('db_queries');
     if ($db_queries) {
         # @TODO: make this less derpy:
         $db_queries_data = $db_queries->get_data();
         if (isset($db_queries_data['types']) && isset($db_queries_data['total_time'])) {
             $db_query_num = $db_queries_data['types'];
         }
     }
     echo '<div class="qm" id="' . esc_attr($this->collector->id()) . '">';
     echo '<table cellspacing="0">';
     echo '<thead>';
     echo '<tr>';
     echo '<th scope="col">' . esc_html__('Page generation time', 'query-monitor') . '</th>';
     echo '<th scope="col">' . esc_html__('Peak memory usage', 'query-monitor') . '</th>';
     if (isset($db_query_num)) {
         echo '<th scope="col">' . esc_html__('Database query time', 'query-monitor') . '</th>';
         echo '<th scope="col">' . esc_html__('Database queries', 'query-monitor') . '</th>';
     }
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     echo '<tr>';
     echo '<td>';
     echo esc_html(number_format_i18n($data['time'], 4));
     echo '<br><span class="qm-info">';
     echo esc_html(sprintf(__('%1$s%% of %2$ss limit', 'query-monitor'), number_format_i18n($data['time_usage'], 1), number_format_i18n($data['time_limit'])));
     echo '</span>';
     echo '</td>';
     if (empty($data['memory'])) {
         echo '<td><em>' . esc_html__('Unknown', 'query-monitor') . '</em></td>';
     } else {
         echo '<td>';
         echo esc_html(sprintf(__('%s kB', 'query-monitor'), number_format_i18n($data['memory'] / 1024)));
         echo '<br><span class="qm-info">';
         echo esc_html(sprintf(__('%1$s%% of %2$s kB limit', 'query-monitor'), number_format_i18n($data['memory_usage'], 1), number_format_i18n($data['memory_limit'] / 1024)));
         echo '</span>';
         echo '</td>';
     }
     if (isset($db_query_num)) {
         echo '<td>';
         echo esc_html(number_format_i18n($db_queries_data['total_time'], 4));
         echo '</td>';
         echo '<td>';
         foreach ($db_query_num as $type_name => $type_count) {
             $db_query_types[] = sprintf('%1$s: %2$s', $type_name, number_format_i18n($type_count));
         }
         echo implode('<br>', array_map('esc_html', $db_query_types));
         echo '</td>';
     }
     echo '</tr>';
     echo '</tbody>';
     echo '</table>';
     echo '</div>';
 }
開發者ID:L0k1slnk,項目名稱:weddly,代碼行數:59,代碼來源:overview.php

示例13: register_output

 static function register_output(array $output, QM_Collectors $collectors)
 {
     if ($collector = QM_Collectors::get('variable_checking')) {
         require_once QMCV_CLASS_DIR . 'query_monitor/output.php';
         $output['variable_checking'] = new QMCV_Output_Variable_Checking($collector);
     }
     return $output;
 }
開發者ID:alpipego,項目名稱:query-monitor-variable-values,代碼行數:8,代碼來源:collector.php

示例14: register_qm_output

function register_qm_output(array $output, \QM_Collectors $collectors)
{
    if ($collector = \QM_Collectors::get('flamegraph')) {
        include_once dirname(__FILE__) . '/inc/class-qm-output-html.php';
        $output['flamegraph'] = new QM_Output_Html($collector);
    }
    return $output;
}
開發者ID:humanmade,項目名稱:query-monitor-flamegraph,代碼行數:8,代碼來源:query-monitor-flamegraph.php

示例15: get_theme_data

 protected static function get_theme_data($item)
 {
     // @TODO this should be abstracted into a more general method which can be used for any of the collectors
     $theme = QM_Collectors::get('theme');
     $theme->process();
     $data = $theme->get_data();
     return $data[$item];
 }
開發者ID:johnbillion,項目名稱:query-monitor,代碼行數:8,代碼來源:test-collector-theme.php


注:本文中的QM_Collectors類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。