PATH:
home
/
lab2454c
/
nfsin.com
/
wp-content
/
plugins
/
insert-headers-and-footers
/
includes
<?php /** * This class handles PHP errors, keeping tabs of errors thrown * and the messages displayed back to the user. * * @package wpcode */ /** * WPCode_Error class. */ class WPCode_Error { /** * An array of errors already caught. * * @var array */ private $errors = array(); /** * The error object caught when running the code. * * @param ParseError|Exception|Error|array $error The caught error. * * @return void */ public function add_error( $error ) { $this->errors[] = $error; $this->write_error_to_log( $error ); } /** * Check if an error has been recorded. * * @return bool */ public function has_error() { return ! empty( $this->errors ); } /** * Empty the errors record, useful if you want to * make sure the last error was thrown by your code. * * @return void */ public function clear_errors() { $this->errors = array(); } /** * Store the error in the logs. * * @param array|Exception $error The error object. * * @return void */ private function write_error_to_log( $error ) { $handle = 'error'; if ( is_array( $error ) && isset( $error['snippet'] ) ) { $handle = 'snippet-' . $error['snippet']; } wpcode()->logger->handle( time(), $this->get_error_message( $error ), $handle ); } /** * Get the last error message. * * @return string */ public function get_last_error_message() { if ( empty( $this->errors ) ) { return ''; } $last_error = end( $this->errors ); return $this->get_error_message( $last_error ); } /** * Get the error message from the error object, either an array or an Exception object. * * @param array|Exception $error The error object. * * @return string */ public function get_error_message( $error ) { if ( is_array( $error ) && isset( $error['message'] ) ) { return $error['message']; } if ( ! is_array( $error ) && method_exists( $error, 'getMessage' ) ) { return $error->getMessage(); } return ''; } }
[-] class-wpcode-error.php
[edit]
[+]
admin
[+]
..
[-] legacy.php
[edit]
[+]
conditional-logic
[-] icons.php
[edit]
[+]
execute
[-] class-wpcode-file-cache.php
[edit]
[+]
generator
[-] class-wpcode-library-auth.php
[edit]
[-] class-wpcode-generator.php
[edit]
[-] class-wpcode-file-logger.php
[edit]
[-] class-wpcode-library.php
[edit]
[-] compat.php
[edit]
[-] global-output.php
[edit]
[-] shortcode.php
[edit]
[-] ihaf.php
[edit]
[-] safe-mode.php
[edit]
[-] helpers.php
[edit]
[-] class-wpcode-capabilities.php
[edit]
[-] class-wpcode-conditional-logic.php
[edit]
[-] .htaccess
[edit]
[+]
auto-insert
[-] class-wpcode-snippet-cache.php
[edit]
[-] class-wpcode-snippet-execute.php
[edit]
[-] class-wpcode-install.php
[edit]
[-] class-wpcode-settings.php
[edit]
[-] class-wpcode-snippet.php
[edit]
[-] post-type.php
[edit]
[+]
lite
[-] class-wpcode-auto-insert.php
[edit]