| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | * @author Tobias Bäthge |
| 8 | 8 | * @since 2.0.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +declare(strict_types=1); | |
| 12 | + | |
| 11 | 13 | // Prohibit direct script loading. |
| 12 | 14 | defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 13 | 15 | |
| 14 | 16 | /** |
| @@ -27,9 +29,9 @@ | ||
| 27 | 29 | * @since 2.0.0 |
| 28 | 30 | */ |
| 29 | 31 | public function __construct() { |
| 30 | 32 | // Load PHPSpreadsheet via its autoloading mechanism. |
| 31 | - TablePress::load_file( 'autoload.php', 'libraries' ); | |
| 33 | + TablePress::load_file( 'autoload.php', 'libraries/vendor' ); | |
| 32 | 34 | } |
| 33 | 35 | |
| 34 | 36 | /** |
| 35 | 37 | * Evaluates formulas in the passed table. |
| @@ -113,9 +115,9 @@ | ||
| 113 | 115 | } |
| 114 | 116 | |
| 115 | 117 | // Sanitize the output of the evaluated formula. |
| 116 | 118 | $cell_content = wp_kses_post( $cell_content ); // Equals wp_filter_post_kses(), but without the unnecessary slashes handling. |
| 117 | - } catch ( \TablePress\PhpOffice\PhpSpreadsheet\Calculation\Exception $exception ) { | |
| 119 | + } catch ( \Throwable $exception ) { | |
| 118 | 120 | $message = str_replace( 'Worksheet!', '', $exception->getMessage() ); |
| 119 | 121 | $cell_content = "!ERROR! {$message}"; |
| 120 | 122 | } |
| 121 | 123 | } |
| @@ -126,9 +128,9 @@ | ||
| 126 | 128 | |
| 127 | 129 | // Save PHP memory. |
| 128 | 130 | $spreadsheet->disconnectWorksheets(); |
| 129 | 131 | unset( $cell_collection, $worksheet, $spreadsheet ); |
| 130 | - } catch ( \TablePress\PhpOffice\PhpSpreadsheet\Calculation\Exception $exception ) { | |
| 132 | + } catch ( \Throwable $exception ) { | |
| 131 | 133 | $message = str_replace( 'Worksheet!', '', $exception->getMessage() ); |
| 132 | 134 | $table_data = array( array( "!ERROR! {$message}" ) ); |
| 133 | 135 | } |
| 134 | 136 | |