| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | * @author Tobias Bäthge |
| 8 | 8 | * @since 1.5.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 | /** |
| @@ -47,13 +49,8 @@ | ||
| 47 | 49 | if ( ! $phpspreadsheet_requirements_fulfilled ) { |
| 48 | 50 | return true; |
| 49 | 51 | } |
| 50 | 52 | |
| 51 | - // Use the legacy evaluate class, if the PHPSpreadsheet files do not exist (e.g. because `composer install` was not run). | |
| 52 | - if ( ! file_exists( TABLEPRESS_ABSPATH . 'libraries/autoload.php' ) ) { | |
| 53 | - return true; | |
| 54 | - } | |
| 55 | - | |
| 56 | 53 | return false; |
| 57 | 54 | } |
| 58 | 55 | |
| 59 | 56 | /** |
| @@ -65,12 +62,10 @@ | ||
| 65 | 62 | * @param string $table_id ID of the passed table. |
| 66 | 63 | * @return array<int, array<int, string>> Table data with evaluated formulas. |
| 67 | 64 | */ |
| 68 | 65 | public function evaluate_table_data( array $table_data, string $table_id ): array { |
| 69 | - $use_legacy_evaluate_class = $this->_should_use_legacy_evaluate_class(); | |
| 70 | - | |
| 71 | 66 | // Choose the Table Evaluate library based on the PHP version and the filter hook value. |
| 72 | - if ( $use_legacy_evaluate_class ) { | |
| 67 | + if ( $this->_should_use_legacy_evaluate_class() ) { | |
| 73 | 68 | $evaluate_class = TablePress::load_class( 'TablePress_Evaluate_Legacy', 'class-evaluate-legacy.php', 'classes' ); |
| 74 | 69 | } else { |
| 75 | 70 | $evaluate_class = TablePress::load_class( 'TablePress_Evaluate_PHPSpreadsheet', 'class-evaluate-phpspreadsheet.php', 'classes' ); |
| 76 | 71 | } |