PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / trunk
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets vtrunk
3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / classes / error.php
wp-all-import / classes Last commit date
XmlStreamReader 3 weeks ago partner-discount-sdk 3 weeks ago api.php 3 weeks ago arraytoxml.php 3 weeks ago chunk.php 3 weeks ago config.php 2 years ago download.php 3 weeks ago error.php 3 weeks ago handler.php 3 weeks ago helper.php 3 weeks ago input.php 3 weeks ago nested.php 3 weeks ago rapidaddon.php 3 weeks ago render.php 3 weeks ago session.php 9 months ago upload.php 3 weeks ago zip.php 10 years ago
error.php
85 lines
1 <?php
2
3 class PMXI_Error{
4
5 public $recordNumber;
6
7 public function __construct($recordNumber = false) {
8 $this->recordNumber = $recordNumber;
9 }
10
11 public function handle(){
12
13 $error = $this->getLastError();
14 $trace = $this->trace();
15 if($error && strpos($error['file'], 'functions.php') !== false){
16 $wp_uploads = $this->getUploadsDir();
17 $functions = 'in '.$wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_EXPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php:'.$error['line'];
18 $error['message'] = str_replace($functions, '', $error['message']);
19 $error['message'] = str_replace("\\n",'',$error['message']);
20 $errorParts = explode('Stack trace', $error['message']);
21 $error['message'] = $errorParts[0];
22 $error['message'] .=' on line '.$error['line'];
23 $error['message'] = str_replace("\n",'',$error['message']);
24 $error['message'] = str_replace("Uncaught Error:", '', $error['message']);
25 $error['message'] = 'PHP Error: ' . $error['message'];
26 $error['message'] = str_replace(' ', ' ', $error['message']);
27 echo "[[ERROR]]";
28 if($error['message'] == '') {
29 $error['message'] = __('An unknown error occurred', 'wp-all-import');
30 }
31 $this->terminate(json_encode(array('error' => '<span class="error">'.$error['message'].' of the Functions Editor'.'</span>', 'line' => $error['line'], 'title' => __('PHP Error','wp-all-import'))));
32 } else if(strpos($error['file'], 'XMLWriter.php') !== false ) {
33 if(strpos($error['message'],'syntax error, unexpected') !== false) {
34 echo "[[ERROR]]";
35 $this->terminate(json_encode(array('error'=>__('You probably forgot to close a quote', 'wp-all-import'),'title' => __('PHP Error','wp-all-import'))));
36 }
37 }
38 }
39
40 /**
41 * @return array
42 */
43 protected function getLastError()
44 {
45 return error_get_last();
46 }
47
48 /**
49 * @return mixed
50 */
51 protected function getUploadsDir()
52 {
53 return wp_upload_dir();
54 }
55
56 /**
57 * Hack to be able to test the class in isolation
58 *
59 * @param $message
60 */
61 protected function terminate($message)
62 {
63 exit($message); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- JSON payload consumed by JS client.
64 }
65
66 protected function trace(){
67 $e = new Exception();
68 return $e->getTraceAsString();
69 // return debug_backtrace();
70 }
71
72 public function import_data_handler($errno, $errstr, $errfile, $errline) {
73 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
74 error_log('Found import exception: ' . $errstr . ' ' . $errno . ' ' . $errfile . ' ' . $errline . ' for record #' . $this->recordNumber);
75 // trigger_error('TEST');
76 // throw new XmlImportException($errstr, $errno, 0, $errfile, $errline);
77 }
78
79 public function parse_data_handler($errno, $errstr, $errfile, $errline) {
80 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
81 error_log('Found parse exception: ' . $errstr . ' ' . $errno . ' ' . $errfile . ' ' . $errline);
82 throw new XmlImportException(esc_html($errstr), intval($errno));
83 }
84 }
85