Skip to content

Commit 4c7da1f

Browse files
committed
Fix autoloader for Composer installs
1 parent daea774 commit 4c7da1f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

post-content-to-markdown.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
}
1616

1717
// Load the appropriate autoloader
18-
if (file_exists(__DIR__.'/vendor/autoload.php')) {
19-
// Composer installation
20-
require_once __DIR__.'/vendor/autoload.php';
21-
} else {
22-
// Standalone plugin with prefixed dependencies
23-
require_once __DIR__.'/vendor_prefixed/vendor/autoload.php';
18+
if (!class_exists('\League\HTMLToMarkdown\HtmlConverter')) {
19+
if (file_exists(__DIR__.'/vendor/autoload.php')) {
20+
// Composer installation
21+
require_once __DIR__.'/vendor/autoload.php';
22+
} elseif (file_exists(__DIR__.'/vendor_prefixed/vendor/autoload.php')) {
23+
// Standalone plugin with prefixed dependencies
24+
require_once __DIR__.'/vendor_prefixed/vendor/autoload.php';
25+
}
2426
}
2527

2628
/**

0 commit comments

Comments
 (0)