PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.3.1
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.3.1
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / libraries / WpaePhpInterpreterErrorHandler.php
wp-all-export / libraries Last commit date
VariableProductTitle 9 years ago .gitkeep 10 years ago WpaeInvalidPhpException.php 9 years ago WpaeInvalidStringException.php 9 years ago WpaeMethodNotFoundException.php 9 years ago WpaePhpInterpreterErrorHandler.php 8 years ago WpaeString.php 8 years ago WpaeTooMuchRecursionException.php 9 years ago WpaeXmlProcessor.php 7 years ago XmlCsvExport.php 4 years ago XmlExportComment.php 8 years ago XmlExportCpt.php 4 years ago XmlExportEngine.php 4 years ago XmlExportFiltering.php 9 years ago XmlExportMediaGallery.php 6 years ago XmlExportTaxonomy.php 9 years ago XmlGoogleMerchants.php 9 years ago XmlSpec.php 9 years ago
WpaePhpInterpreterErrorHandler.php
59 lines
1 <?php
2
3 class WpaePhpInterpreterErrorHandler
4 {
5 public function handle(){
6
7 $error = $this->getLastError();
8
9 if($error && strpos($error['file'], 'uploads/wpallexport/functions.php') !== false){
10 $wp_uploads = $this->getUploadsDir();
11 $functions = 'in '.$wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_EXPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php:'.$error['line'];
12 $error['message'] = str_replace($functions, '', $error['message']);
13 $error['message'] = str_replace("\\n",'',$error['message']);
14 $errorParts = explode('Stack trace', $error['message']);
15 $error['message'] = $errorParts[0];
16 $error['message'] .=' on line '.$error['line'];
17 $error['message'] = str_replace("\n",'',$error['message']);
18 $error['message'] = str_replace("Uncaught Error:", '', $error['message']);
19 $error['message'] = 'PHP Error: ' . $error['message'];
20 $error['message'] = str_replace(' ', ' ', $error['message']);
21 echo "[[ERROR]]";
22 if($error['message'] == '') {
23 $error['message'] = __('An unknown error occured', 'wp_all_import_plugin');
24 }
25 $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_plugin'))));
26 } else if(strpos($error['file'], 'XMLWriter.php') !== false ) {
27 if(strpos($error['message'],'syntax error, unexpected') !== false) {
28 echo "[[ERROR]]";
29 $this->terminate(json_encode(array('error'=>__('You probably forgot to close a quote', 'wp_all_import_plugin'),'title' => __('PHP Error','wp_all_import_plugin'))));
30 }
31 }
32 }
33
34 /**
35 * @return array
36 */
37 protected function getLastError()
38 {
39 return error_get_last();
40 }
41
42 /**
43 * @return mixed
44 */
45 protected function getUploadsDir()
46 {
47 return wp_upload_dir();
48 }
49
50 /**
51 * Hack to be able to test the class in isolation
52 *
53 * @param $message
54 */
55 protected function terminate($message)
56 {
57 exit($message);
58 }
59 }