Skip to content

Commit 7076ad2

Browse files
committed
Fix so only files is loaded in plugins_loaded action
1 parent 87dbb25 commit 7076ad2

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

src/class-elda.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Elda {
5151
protected function __construct( $base_path, array $options = [] ) {
5252
$this->set_base_path( $base_path );
5353
$this->set_options( $options );
54+
$this->load_textdomain();
5455
$this->load_composer();
5556
$this->register_autoload();
5657
}
@@ -60,6 +61,8 @@ protected function __construct( $base_path, array $options = [] ) {
6061
*
6162
* @param string $base_path
6263
* @param array $options
64+
*
65+
* @throws Exception if plugin is loaded
6366
*/
6467
public static function boot( $base_path, array $options = [] ) {
6568
$name = plugin_basename( $base_path );
@@ -72,7 +75,7 @@ public static function boot( $base_path, array $options = [] ) {
7275

7376
// @codeCoverageIgnoreStart
7477
add_action( 'plugins_loaded', function () use ( $instance, $name ) {
75-
return static::$instances[$name] = $instance->load()->get_instance();
78+
return static::$instances[$name] = $instance->load_files()->get_instance();
7679
} );
7780
// @codeCoverageIgnoreEnd
7881
}
@@ -117,17 +120,6 @@ protected function get_src_path( $path = '' ) {
117120
( strlen( $path ) ? '/' . $path : '' );
118121
}
119122

120-
/**
121-
* Load files and textdomain.
122-
*
123-
* @return \Frozzare\Elda\Elda
124-
*/
125-
protected function load() {
126-
$this->load_textdomain();
127-
$this->load_files();
128-
return $this;
129-
}
130-
131123
/**
132124
* Load Composer autoload if it exists.
133125
*/
@@ -150,6 +142,8 @@ protected function load_files() {
150142
}
151143

152144
unset( $file );
145+
146+
return $this;
153147
}
154148

155149
/**

0 commit comments

Comments
 (0)