本文整理汇总了PHP中QM_Collectors::init方法的典型用法代码示例。如果您正苦于以下问题:PHP QM_Collectors::init方法的具体用法?PHP QM_Collectors::init怎么用?PHP QM_Collectors::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QM_Collectors
的用法示例。
在下文中一共展示了QM_Collectors::init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
}
}
示例2: get_outputters
public function get_outputters($outputter_id)
{
$out = array();
$collectors = QM_Collectors::init();
$collectors->process();
$this->outputters = apply_filters("qm/outputter/{$outputter_id}", array(), $collectors);
/* @var QM_Output[] */
foreach ($this->outputters as $id => $outputter) {
$out[$id] = $outputter;
}
return $out;
}
示例3: register_qm_collectors_debug_bar
function register_qm_collectors_debug_bar()
{
global $debug_bar;
if (class_exists('Debug_Bar') || qm_debug_bar_being_activated()) {
return;
}
$collectors = QM_Collectors::init();
$qm = QueryMonitor::init();
require_once $qm->plugin_path('classes/debug_bar.php');
$debug_bar = new Debug_Bar();
$redundant = array('debug_bar_actions_addon_panel', 'debug_bar_remote_requests_panel', 'debug_bar_screen_info_panel', 'ps_listdeps_debug_bar_panel');
foreach ($debug_bar->panels as $panel) {
$panel_id = strtolower(get_class($panel));
if (in_array($panel_id, $redundant)) {
continue;
}
$collector = new QM_Collector_Debug_Bar();
$collector->set_id("debug_bar_{$panel_id}");
$collector->set_panel($panel);
$collectors->add($collector);
}
}
示例4: after_output
protected function after_output()
{
$collectors = QM_Collectors::init();
echo '<div class="qm qm-half qm-clear" id="qm-authentication">';
echo '<table cellspacing="0">';
echo '<thead>';
echo '<tr>';
echo '<th>' . esc_html__('Authentication', 'query-monitor') . '</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
if (!self::user_verified()) {
echo '<tr>';
echo '<td>' . esc_html__('You can set an authentication cookie which allows you to view Query Monitor output when you’re not logged in.', 'query-monitor') . '</td>';
echo '</tr>';
echo '<tr>';
echo '<td><a href="#" class="qm-auth" data-action="on">' . esc_html__('Set authentication cookie', 'query-monitor') . '</a></td>';
echo '</tr>';
} else {
echo '<tr>';
echo '<td>' . esc_html__('You currently have an authentication cookie which allows you to view Query Monitor output.', 'query-monitor') . '</td>';
echo '</tr>';
echo '<tr>';
echo '<td><a href="#" class="qm-auth" data-action="off">' . esc_html__('Clear authentication cookie', 'query-monitor') . '</a></td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div>';
echo '</div>';
echo '</div>';
$json = array('menu' => $this->js_admin_bar_menu(), 'ajax_errors' => array());
echo '<script type="text/javascript">' . "\n\n";
echo 'var qm = ' . json_encode($json) . ';' . "\n\n";
?>
if ( 'undefined' === typeof QM_i18n ) {
document.getElementById( 'qm' ).style.display = 'block';
}
<?php
echo '</script>' . "\n\n";
}
示例5: action_shutdown
public function action_shutdown()
{
# @TODO this should move to each dispatcher so it can decide when it wants to do its output
# eg. the JSON dispatcher needs to output inside the 'json_post_dispatch' filter, not on shutdown
if (!$this->should_process()) {
return;
}
$collectors = QM_Collectors::init();
$dispatchers = QM_Dispatchers::init();
foreach ($collectors as $collector) {
$collector->tear_down();
$collector->process();
}
foreach ($dispatchers as $dispatcher) {
if (!$dispatcher->is_active()) {
continue;
}
$dispatcher->before_output();
$outputters = apply_filters("qm/outputter/{$dispatcher->id}", array(), $collectors);
foreach ($outputters as $outputter) {
$outputter->output();
}
$dispatcher->after_output();
}
}