JSError.php 741 B

12345678910111213141516171819202122
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. class NF_AJAX_Controllers_JSError
  3. {
  4. public function __construct()
  5. {
  6. add_action( 'wp_ajax_nf_log_js_error', array( $this, 'log_error' ) );
  7. add_action( 'wp_ajax_nopriv_nf_log_js_error', array( $this, 'log_error' ) );
  8. }
  9. public function log_error()
  10. {
  11. check_ajax_referer( 'ninja_forms_display_nonce', 'security' );
  12. $message = esc_html( stripslashes( $_REQUEST[ 'message' ] ) );
  13. $url = esc_html( stripslashes( $_REQUEST[ 'url' ] ) );
  14. $lineNumber = esc_html( stripslashes( $_REQUEST[ 'lineNumber' ] ) );
  15. Ninja_Forms()->logger()->emergency( $message . ' in ' . $url . ' on line ' . $lineNumber );
  16. die( 1 );
  17. }
  18. }