Skip to content

Commit 651206c

Browse files
authored
Merge pull request #222 from GravityKit/issue/221-conflict-with-webtoffee-import-export-wordpress-users-and-woo-customers
Add GFEXCEL_AVOID_CLASS_ALIAS constant to prevent class alias conflicts
2 parents 6eca854 + 13dbb5e commit 651206c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

gfexcel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@
7171
$autoload_file = __DIR__ . '/build/vendor/autoload.php';
7272

7373
$is_build = true;
74+
$can_add_class_alias = ! defined( 'GFEXCEL_AVOID_CLASS_ALIAS' ) || ! GFEXCEL_AVOID_CLASS_ALIAS;
7475
if ( ! file_exists( $autoload_file ) ) {
7576
$autoload_file = __DIR__ . '/vendor/autoload.php';
7677
$is_build = false;
7778
}
7879

7980
require_once $autoload_file;
8081

81-
if ( $is_build ) {
82+
if ( $is_build && $can_add_class_alias ) {
8283
// Make old class names available as aliases if possible.
8384
$class_aliases = [
8485
'PhpOffice\PhpSpreadsheet\Document\Properties',

readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ You can hide a row by adding a hook. Checkout this example:
256256

257257
== Changelog ==
258258

259+
= develop =
260+
261+
* Enhancement: Defining a `GFEXCEL_AVOID_CLASS_ALIAS` constant as `true` will avoid registering PHPSpreadsheet class aliases.
262+
259263
= 2.4.0 on July 10, 2025 =
260264

261265
* Changed: Updated download link handling to allow future enhancements.

0 commit comments

Comments
 (0)