0 && ! isset( $backtrace[ $bt_index ] ) ) { $bt_index--; } // We need two stacks to get all the data we need so let's go down one more $bt_index--; } $stack = $backtrace[ $bt_index ]; $file = self::$_->array_get( $stack, 'file', '' ); $line = self::$_->array_get( $stack, 'line', '' ); // Name of the function and class (if applicable) are in the previous stack (stacks are in reverse order) $stack = $backtrace[ $bt_index + 1 ]; $class = self::$_->array_get( $stack, 'class', '' ); $function = self::$_->array_get( $stack, 'function', '' ); if ( $class ) { $class .= '::'; } if ( '' !== $file ) { $file = _et_core_normalize_path( $file ); $parts = explode( '/', $file ); $parts = array_slice( $parts, -2 ); $file = ".../{$parts[0]}/{$parts[1]}"; } $message = " {$file}:{$line} {$class}{$function}():\n{$message}\n"; error_log( $message ); } /** * Writes message to the logs if {@link WP_DEBUG} is `true`, otherwise does nothing. * * @since 1.1.0 * * @param mixed $message * @param int $bt_index * @param boolean $log_ajax Whether or not to log on AJAX calls. */ public static function debug( $message, $bt_index = 4, $log_ajax = true ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { self::_maybe_write_log( $message, $bt_index, $log_ajax ); } } public static function disable_php_notices() { $error_reporting = error_reporting(); $notices_enabled = $error_reporting & E_NOTICE; if ( $notices_enabled ) { error_reporting( $error_reporting & ~E_NOTICE ); } } /** * Writes an error message to the logs regardless of whether or not debug mode is enabled. * * @since 1.1.0 * * @param mixed $message * @param int $bt_index */ public static function error( $message, $bt_index = 4 ) { self::_maybe_write_log( $message, $bt_index ); } public static function enable_php_notices() { $error_reporting = error_reporting(); $notices_enabled = $error_reporting & E_NOTICE; if ( ! $notices_enabled ) { error_reporting( $error_reporting | E_NOTICE ); } } public static function initialize() { self::$_ = ET_Core_Data_Utils::instance(); } public static function php_notices_enabled() { $error_reporting = error_reporting(); return $error_reporting & E_NOTICE; } } ET_Core_Logger::initialize();