Skip to content

Commit 1a90ce1

Browse files
authored
Merge pull request #10 from jazzsequence:use-root-autoloader
Use-root-autoloader
2 parents 6100817 + 4dd4ffa commit 1a90ce1

File tree

1 file changed

+2
-31
lines changed

1 file changed

+2
-31
lines changed

inc/namespace.php

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
function bootstrap() {
1616
Widget\bootstrap();
1717

18-
if ( parsedown_enabled() ) {
19-
require_once composer_autoloader();
20-
}
21-
2218
if ( ! defined( 'JSDC_REPOSITORY' ) ) {
2319
add_action( 'admin_init', __NAMESPACE__ . '\\add_setting' );
2420
}
@@ -30,39 +26,14 @@ function bootstrap() {
3026
* @return bool
3127
*/
3228
function parsedown_enabled() : bool {
33-
// Bail if the autoloader doesn't exist.
34-
if ( ! file_exists( composer_autoloader() ) ) {
35-
error_log( __( 'Autoloader file not found.', 'dashboard-changelog' ) );
36-
return false;
37-
}
38-
39-
// Bail if the Parsedown library doesn't exist.
40-
if ( ! file_exists( get_vendor_dir() . 'erusev/parsedown/Parsedown.php' ) ) {
41-
error_log( __( 'Parsedown file does not exist', 'dashboard-changelog' ) );
29+
if ( ! class_exists( 'Parsedown' ) ) { var_dump( 'no parsedown' );
30+
error_log( __( 'Parsedown class does not exist.', 'dashboard-changelog' ) );
4231
return false;
4332
}
4433

4534
return true;
4635
}
4736

48-
/**
49-
* Returns the vendor directory.
50-
*
51-
* @return string
52-
*/
53-
function get_vendor_dir() : string {
54-
return dirname( __DIR__ ) . '/vendor/';
55-
}
56-
57-
/**
58-
* Returns the path to the Composer autoload file.
59-
*
60-
* @return string
61-
*/
62-
function composer_autoloader() : string {
63-
return get_vendor_dir() . 'autoload.php';
64-
}
65-
6637
/**
6738
* Get the cache expiration time.
6839
* We default to one day, but this can be filtered.

0 commit comments

Comments
 (0)