本文整理汇总了PHP中wp_debug_backtrace_summary函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_debug_backtrace_summary函数的具体用法?PHP wp_debug_backtrace_summary怎么用?PHP wp_debug_backtrace_summary使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_debug_backtrace_summary函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error_handler
function error_handler($type, $message, $file, $line)
{
$_key = md5($file . ':' . $line . ':' . $message);
switch ($type) {
case E_WARNING:
case E_USER_WARNING:
$this->warnings[$_key] = array($file . ':' . $line, $message, wp_debug_backtrace_summary(__CLASS__));
break;
case E_NOTICE:
case E_USER_NOTICE:
$this->notices[$_key] = array($file . ':' . $line, $message, wp_debug_backtrace_summary(__CLASS__));
break;
case E_STRICT:
// TODO
break;
case E_DEPRECATED:
case E_USER_DEPRECATED:
// TODO
break;
case 0:
// TODO
break;
}
if (null != $this->real_error_handler) {
return call_user_func($this->real_error_handler, $type, $message, $file, $line);
} else {
return false;
}
}
示例2: start
public function start($false, $args, $url)
{
$log = array('url' => $url, 'method' => !empty($args['method']) ? $args['method'] : '', 'start' => microtime(true), 'backtrace' => wp_debug_backtrace_summary(__CLASS__));
if (isset($_GET['dbrr_full'])) {
$log['args'] = $args;
}
$this->log[] = $log;
return $false;
}
示例3: log_error
static function log_error($message = '', $data = null)
{
$function = self::get_print_function();
$error = array('message' => $message, 'data' => $data, 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary(null, 3) : '');
if (!in_array($error, self::$errors)) {
self::$errors[] = $error;
}
if (class_exists("GFLogging")) {
GFLogging::include_logger();
GFLogging::log_message('gravityview', $function($message, true) . $function($data, true), KLogger::ERROR);
}
}
示例4: log
/**
* Log
* Writes to PHP error logs if DEBUG is enabled.
*
* @param string $subject short title
* @param array $data data
* @return null
*/
public static function log($subject = '', $data = array())
{
if (self::DEBUG) {
error_log('+++' . $subject . ' +++++++++++++++++++++');
if (!empty($data)) {
error_log(print_r($data, true));
error_log('backtrace: ' . print_r(wp_debug_backtrace_summary(null, 0, false), true));
error_log('--------------------- ' . $subject . ' END ---------------------');
}
}
if (self::$record_logs) {
if (function_exists('wp_get_current_user')) {
self::record_log($subject, $data);
} else {
self::$recorded_logs[$subject] = $data;
}
}
}
示例5: edited_term_taxonomy_action
/**
* Used to suspend cache invalidation, if a term is being edited
*/
public function edited_term_taxonomy_action($tt_id, $taxonomy)
{
global $wpdb, $_wp_suspend_cache_invalidation;
$this->was_suspended = $_wp_suspend_cache_invalidation;
// If cache is already disabled, then we don't need to do so again
if ($this->was_suspended) {
return;
}
$objects = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->term_relationships} WHERE term_taxonomy_id = %d", $tt_id));
//no action needed if there is less that $limimt number of objects to purge
if (intval($objects) < $this->limit) {
return;
}
// Make sure we're in `wp_update_term` - the only place we want this to happen
$backtrace = wp_debug_backtrace_summary(null, null, false);
if (!in_array('wp_update_term', $backtrace)) {
return;
}
wp_suspend_cache_invalidation(true);
//schedule WP Cron event for purging the cache
wp_schedule_single_event(time(), 'wpcom_vip_clean_tax_relations_cache', array($tt_id, $taxonomy));
}
示例6: get_caller
/**
* Retrieve the name of the function that called wpdb.
*
* Searches up the list of functions until it reaches
* the one that would most logically had called this method.
*
* @since 2.5.0
*
* @return string|array The name of the calling function
*/
public function get_caller()
{
return wp_debug_backtrace_summary(__CLASS__);
}
示例7: log_http_request_result
function log_http_request_result($response, $context, $transport, $args, $url)
{
if ('response' != $context) {
return;
}
if (!isset($this->total_time)) {
$this->total_time = 0;
}
// We don't have an easy way to match exact requests initiated with those completed since $args can be changed before it gets to us here
if (isset($this->current_request['url']) && $url == $this->current_request['url']) {
$time_elapsed = microtime(true) - $this->current_request['start'];
} else {
$time_elapsed = -1;
// hm, some other request got in the way
}
// clear the values
$this->current_request = array();
if (!$response || is_wp_error($response)) {
$message = is_wp_error($response) ? $response->get_error_message() : 'Something clearly went very wrong...';
$status = 'fail';
} else {
$message = $response['response']['message'];
$status = $response['response']['code'];
}
$this->requests[$url][] = array('message' => $message, 'status' => $status, 'time' => $time_elapsed, 'backtrace' => wp_debug_backtrace_summary());
if (-1 < $time_elapsed) {
$this->total_time += $time_elapsed;
}
// Prevent debug notice if no request counts exist yet
if (empty($this->status_counts['Total Requests'])) {
$this->status_counts['Total Requests'] = 0;
}
$this->status_counts['Total Requests']++;
switch (substr($status, 0, 1)) {
case 1:
$this->status_counts['Informational (1xx)']++;
case 2:
$this->status_counts['Success (2xx)']++;
break;
case 3:
$this->status_counts['Multiple Choices (3xx)']++;
break;
case 4:
$this->status_counts['Client Error (4xx)']++;
break;
case 5:
$this->status_counts['Server Error (5xx)']++;
break;
default:
$this->status_counts['Unknown']++;
break;
}
}
示例8: _nullify_current_user
function _nullify_current_user() {
// Prevents fatal errors in ::tearDown()'s and other uses of restore_current_blog()
$function_stack = wp_debug_backtrace_summary( null, 0, false );
if ( in_array( 'restore_current_blog', $function_stack ) ) {
return;
}
$GLOBALS['current_user'] = null;
}
示例9: wp_trim_words
function wp_trim_words($text = '', $num_words = 110, $more = '', $original_text = '')
{
if ('characters' != _x('words', 'word count: words or characters?')) {
return $text;
}
// If the caller is wp_dashboard_recent_drafts()
if (false !== $this->conf['patch_dashboard_recent_drafts'] && 10 === $num_words && is_admin() && strpos(wp_debug_backtrace_summary(), 'wp_dashboard_recent_drafts')) {
$num_words = $this->conf['dashboard_recent_drafts_mblength'];
}
$text = $original_text;
$text = wp_strip_all_tags($text);
$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
if (mb_strlen($text, $this->blog_encoding) > $num_words) {
$text = mb_substr($text, 0, $num_words, $this->blog_encoding) . $more;
}
return $text;
}
示例10: PrintDebugTrace
static function PrintDebugTrace($tag = "")
{
if (!empty($_GET['debug'])) {
wpfb_loadclass('Output');
$ms = self::GetMemStats();
echo "<!-- [{$tag}] (MEM: " . WPFB_Output::FormatFilesize($ms['used']) . " / {$ms['limit']}) BACKTRACE:\n";
echo esc_html(print_r(wp_debug_backtrace_summary(), true));
echo "\nEND -->";
self::UpdateMemBar();
}
}
示例11: get_caller
/**
* Get the name of the function that called wpdb()
*
* @return string the name of the calling function
*/
public function get_caller()
{
if (function_exists('wp_debug_backtrace_summary')) {
return wp_debug_backtrace_summary(__CLASS__);
}
// requires PHP 4.3+
if (!is_callable('debug_backtrace')) {
return '';
}
$bt = debug_backtrace(false);
$caller = '';
foreach ((array) $bt as $trace) {
if (isset($trace['class']) && is_a($this, $trace['class'])) {
continue;
} elseif (!isset($trace['function'])) {
continue;
} elseif (strtolower($trace['function']) === 'call_user_func_array') {
continue;
} elseif (strtolower($trace['function']) === 'apply_filters') {
continue;
} elseif (strtolower($trace['function']) === 'do_action') {
continue;
}
if (isset($trace['class'])) {
$caller = $trace['class'] . '::' . $trace['function'];
} else {
$caller = $trace['function'];
}
break;
}
return $caller;
}
示例12: _vip_contrib_add_upload_cap
/**
* Helper function for vip_contrib_add_upload_cap() to change the user roles
*
* @link http://vip.wordpress.com/documentation/allow-contributors-to-upload-images/ Allow Contributors to Upload Images
* @see vip_contrib_add_upload_cap()
*/
function _vip_contrib_add_upload_cap()
{
if (!is_admin() && !defined('XMLRPC_REQUEST')) {
return;
}
if (function_exists('wpcom_vip_add_role_caps')) {
wpcom_vip_add_role_caps('contributor', array('upload_files'));
} else {
// Temp debug to track down broken themes
if (function_exists('send_vip_team_irc_alert')) {
send_vip_team_irc_alert('[vip-helper fatal] ' . site_url() . ' add_role_cap no exist for _vip_contrib_add_upload_cap: ' . wp_debug_backtrace_summary());
}
}
}
示例13: test_print_log
public function test_print_log($message = '', $data = null)
{
$error = array('message' => $message, 'data' => $data, 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary(null, 3) : '');
fwrite(STDERR, print_r($error, true));
}
示例14: init
/**
* @since 2.5.2
*/
public function init()
{
/**
* Fires before Simple History does it's init stuff
*
* @since 2.0
*
* @param SimpleHistory $SimpleHistory This class.
*/
do_action("simple_history/before_init", $this);
$this->setup_variables();
// Actions and filters, ordered by order specified in codex: http://codex.wordpress.org/Plugin_API/Action_Reference
add_action('after_setup_theme', array($this, 'load_plugin_textdomain'));
add_action('after_setup_theme', array($this, 'add_default_settings_tabs'));
// Plugins and dropins are loaded using the "after_setup_theme" filter so
// themes can use filters to modify the loading of them.
// The drawback with this is that for example logouts done when plugins like
// iThemes Security is installed is not logged, because those plugins fire wp_logout()
// using filter "plugins_loaded", i.e. before simple history has loaded its filters.
add_action('after_setup_theme', array($this, 'load_loggers'));
add_action('after_setup_theme', array($this, 'load_dropins'));
// Run before loading of loggers and before menu items are added
add_action('after_setup_theme', array($this, 'check_for_upgrade'), 5);
add_action('after_setup_theme', array($this, 'setup_cron'));
// Filters and actions not called during regular boot
add_filter("gettext", array($this, 'filter_gettext'), 20, 3);
add_filter("gettext_with_context", array($this, 'filter_gettext_with_context'), 20, 4);
add_filter('gettext', array($this, "filter_gettext_storeLatestTranslations"), 10, 3);
add_action('admin_bar_menu', array($this, 'add_admin_bar_network_menu_item'), 40);
add_action('admin_bar_menu', array($this, 'add_admin_bar_menu_item'), 40);
/**
* Filter that is used to log things, without the need to check that simple history is available
* i.e. you can have simple history acivated and log things and then you can disable the plugin
* and no errors will occur
*
* Usage:
* apply_filters("simple_history_log", "This is the log message");
* apply_filters("simple_history_log", "This is the log message with some extra data/info", ["extraThing1" => $variableWIihThing]);
* apply_filters("simple_history_log", "This is the log message with severity debug", null, "debug");
* apply_filters("simple_history_log", "This is the log message with severity debug and with some extra info/data logged", ["userData" => $userData, "shoppingCartDebugData" => $shopDebugData], "debug",);
*
* @since 2.13
*/
add_filter('simple_history_log', array($this, "on_filter_simple_history_log"), 10, 3);
if (is_admin()) {
$this->add_admin_actions();
}
/**
* Fires after Simple History has done it's init stuff
*
* @since 2.0
*
* @param SimpleHistory $SimpleHistory This class.
*/
do_action("simple_history/after_init", $this);
// Add some extra info to each logged context when SIMPLE_HISTORY_LOG_DEBUG is set and true
if (defined("SIMPLE_HISTORY_LOG_DEBUG") && SIMPLE_HISTORY_LOG_DEBUG) {
add_filter("simple_history/log_argument/context", function ($context, $level, $message, $logger) {
$sh = SimpleHistory::get_instance();
$context["_debug_get"] = $sh->json_encode($_GET);
$context["_debug_post"] = $sh->json_encode($_POST);
$context["_debug_server"] = $sh->json_encode($_SERVER);
$context["_debug_files"] = $sh->json_encode($_FILES);
$context["_debug_php_sapi_name"] = php_sapi_name();
global $argv;
$context["_debug_argv"] = $sh->json_encode($argv);
$consts = get_defined_constants(true);
$consts = $consts["user"];
$context["_debug_user_constants"] = $sh->json_encode($consts);
$postdata = file_get_contents("php://input");
$context["_debug_http_raw_post_data"] = $sh->json_encode($postdata);
$context["_debug_wp_debug_backtrace_summary"] = wp_debug_backtrace_summary();
$context["_debug_is_admin"] = json_encode(is_admin());
$context["_debug_is_doing_cron"] = json_encode(defined('DOING_CRON') && DOING_CRON);
return $context;
}, 10, 4);
}
}
示例15: esc_html_e
/**
* Wrapper around esc_html__
* @param string $string
* @return
*/
public static function esc_html_e($string)
{
if (self::DEBUG) {
error_log('backtrace: ' . print_r(wp_debug_backtrace_summary(null, 0, false), true));
_deprecated_function(__CLASS__ . '::' . __FUNCTION__, '9.0', '__');
}
return esc_html_e($string, self::TEXT_DOMAIN);
}