WC_Log_Handler_DB::get_log_source
Get appropriate source based on file name.
Try to provide an appropriate source in case none is provided.
Метод класса: WC_Log_Handler_DB{}
Хуков нет.
Возвращает
Строку. Text to use as log source. "" (empty string) if none is found.
Использование
$result = WC_Log_Handler_DB::get_log_source();
Код WC_Log_Handler_DB::get_log_source() WC Log Handler DB::get log source WC 10.4.2
protected static function get_log_source() {
static $ignore_files = array( 'class-wc-log-handler-db', 'class-wc-logger' );
/**
* PHP < 5.3.6 correct behavior
*
* @see http://php.net/manual/en/function.debug-backtrace.php#refsect1-function.debug-backtrace-parameters
*/
if ( Constants::is_defined( 'DEBUG_BACKTRACE_IGNORE_ARGS' ) ) {
$debug_backtrace_arg = DEBUG_BACKTRACE_IGNORE_ARGS; // phpcs:ignore PHPCompatibility.Constants.NewConstants.debug_backtrace_ignore_argsFound
} else {
$debug_backtrace_arg = false;
}
$trace = debug_backtrace( $debug_backtrace_arg ); // @codingStandardsIgnoreLine.
foreach ( $trace as $t ) {
if ( isset( $t['file'] ) ) {
$filename = pathinfo( $t['file'], PATHINFO_FILENAME );
if ( ! in_array( $filename, $ignore_files, true ) ) {
return $filename;
}
}
}
return '';
}