本文整理汇总了PHP中QM_Collectors::add方法的典型用法代码示例。如果您正苦于以下问题:PHP QM_Collectors::add方法的具体用法?PHP QM_Collectors::add怎么用?PHP QM_Collectors::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QM_Collectors
的用法示例。
在下文中一共展示了QM_Collectors::add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_plugins_loaded
public function action_plugins_loaded()
{
# Register additional collectors:
foreach (apply_filters('qm/collectors', array(), $this) as $collector) {
QM_Collectors::add($collector);
}
# Dispatchers:
QM_Util::include_files($this->plugin_path('dispatchers'));
# Register built-in and additional dispatchers:
foreach (apply_filters('qm/dispatchers', array(), $this) as $dispatcher) {
QM_Dispatchers::add($dispatcher);
}
}
示例2: action_plugins_loaded
public function action_plugins_loaded()
{
# Register additional collectors:
foreach (apply_filters('qm/collectors', array(), $this) as $collector) {
QM_Collectors::add($collector);
}
# Load dispatchers:
foreach (glob($this->plugin_path('dispatchers/*.php')) as $file) {
include $file;
}
# Register built-in and additional dispatchers:
foreach (apply_filters('qm/dispatchers', array(), $this) as $dispatcher) {
QM_Dispatchers::add($dispatcher);
}
}
示例3: QM_Backtrace
$trace = new QM_Backtrace();
$filtered = $trace->get_filtered_trace();
$caller = array();
foreach ($filtered as $i => $item) {
if (in_array($item['function'], array('load_plugin_textdomain', 'load_theme_textdomain', 'load_default_textdomain'), true)) {
$caller = $item;
$display = $i + 1;
if (isset($filtered[$display])) {
$caller['display'] = $filtered[$display]['display'];
}
break;
}
}
if (empty($caller)) {
if (isset($filtered[1])) {
$caller = $filtered[1];
} else {
$caller = $filtered[0];
}
}
if (!isset($caller['file']) && isset($filtered[0]['file']) && isset($filtered[0]['line'])) {
$caller['file'] = $filtered[0]['file'];
$caller['line'] = $filtered[0]['line'];
}
$this->data['languages'][] = array('caller' => $caller, 'domain' => $domain, 'mofile' => $mofile, 'found' => file_exists($mofile) ? filesize($mofile) : false);
return $override;
}
}
# Load early to catch early errors
QM_Collectors::add(new QM_Collector_Languages());
示例4: __construct
}
public function __construct()
{
parent::__construct();
# See http://core.trac.wordpress.org/ticket/24583
add_action('setted_site_transient', array($this, 'action_setted_site_transient'), 10, 3);
add_action('setted_transient', array($this, 'action_setted_blog_transient'), 10, 3);
}
public function tear_down()
{
parent::tear_down();
remove_action('setted_site_transient', array($this, 'action_setted_site_transient'), 10);
remove_action('setted_transient', array($this, 'action_setted_blog_transient'), 10);
}
public function action_setted_site_transient($transient, $value = null, $expiration = null)
{
$this->setted_transient($transient, 'site', $value, $expiration);
}
public function action_setted_blog_transient($transient, $value = null, $expiration = null)
{
$this->setted_transient($transient, 'blog', $value, $expiration);
}
public function setted_transient($transient, $type, $value = null, $expiration = null)
{
$trace = new QM_Backtrace(array('ignore_items' => 1));
$this->data['trans'][] = array('transient' => $transient, 'trace' => $trace, 'type' => $type, 'value' => $value, 'expiration' => $expiration);
}
}
# Load early in case a plugin is setting transients when it initialises instead of after the `plugins_loaded` hook
QM_Collectors::add(new QM_Collector_Transients());
示例5: xdebug_print_function_stack
if (empty($this->display_errors)) {
return;
}
if (empty($e) or !($e['type'] & (E_ERROR | E_PARSE | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_RECOVERABLE_ERROR))) {
return;
}
if ($e['type'] & E_RECOVERABLE_ERROR) {
$error = 'Catchable fatal error';
} else {
if ($e['type'] & E_COMPILE_WARNING) {
$error = 'Warning';
} else {
$error = 'Fatal error';
}
}
if (function_exists('xdebug_print_function_stack')) {
xdebug_print_function_stack(sprintf('%1$s: %2$s in %3$s on line %4$d. Output triggered ', $error, $e['message'], $e['file'], $e['line']));
} else {
printf('<br /><b>%1$s</b>: %2$s in <b>%3$s</b> on line <b>%4$d</b><br />', htmlentities($error), htmlentities($e['message']), htmlentities($e['file']), intval($e['line']));
}
}
public function tear_down()
{
parent::tear_down();
ini_set('display_errors', $this->display_errors);
restore_error_handler();
}
}
# Load early to catch early errors
QM_Collectors::add(new QM_Collector_PHP_Errors());
示例6: apply_filters
return;
}
$silent = apply_filters('qm/collect/silent_http_errors', array('http_request_not_executed', 'airplane_mode_enabled'));
foreach ($this->data['http'] as $key => &$http) {
if (!isset($http['response'])) {
// Timed out
$http['response'] = new WP_Error('http_request_timed_out', __('Request timed out', 'query-monitor'));
$http['end'] = floatval($http['start'] + $http['args']['timeout']);
}
if (is_wp_error($http['response'])) {
if (!in_array($http['response']->get_error_code(), $silent)) {
$this->data['errors']['error'][] = $key;
}
$http['type'] = __('Error', 'query-monitor');
} else {
$http['type'] = intval(wp_remote_retrieve_response_code($http['response']));
if ($http['type'] >= 400) {
$this->data['errors']['warning'][] = $key;
}
}
$http['ltime'] = $http['end'] - $http['start'];
$this->data['ltime'] += $http['ltime'];
$http['component'] = $http['trace']->get_component();
$this->log_type($http['type']);
$this->log_component($http['component'], $http['ltime'], $http['type']);
}
}
}
# Load early in case a plugin is doing an HTTP request when it initialises instead of after the `plugins_loaded` hook
QM_Collectors::add(new QM_Collector_HTTP());
示例7: initialize
public static function initialize()
{
add_filter('qm/outputter/html', array('QMCV_Collector_Variable_Checking', 'register_output'), 10, 2);
QM_Collectors::add(new QMCV_Collector_Variable_Checking());
}
示例8: name
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
class QM_Collector_Redirects extends QM_Collector
{
public $id = 'redirects';
public function name()
{
return __('Redirects', 'query-monitor');
}
public function __construct()
{
parent::__construct();
add_filter('wp_redirect', array($this, 'filter_wp_redirect'), 999, 2);
}
public function filter_wp_redirect($location, $status)
{
if (!$location) {
return $location;
}
$trace = new QM_Backtrace();
$this->data['trace'] = $trace;
$this->data['location'] = $location;
$this->data['status'] = $status;
return $location;
}
}
# Load early in case a plugin is doing a redirect when it initialises instead of after the `plugins_loaded` hook
QM_Collectors::add(new QM_Collector_Redirects());