File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 5
5
use TweakPHP \Client \Loaders \ComposerLoader ;
6
6
use TweakPHP \Client \Loaders \LaravelLoader ;
7
7
use TweakPHP \Client \Loaders \LoaderInterface ;
8
+ use TweakPHP \Client \Loaders \WordPressLoader ;
8
9
9
10
class Loader
10
11
{
@@ -22,6 +23,10 @@ public static function load(string $path)
22
23
return new ComposerLoader ($ path );
23
24
}
24
25
26
+ if (file_exists ($ path . '/wp-load.php ' )) {
27
+ return new WordPressLoader ($ path );
28
+ }
29
+
25
30
return null ;
26
31
}
27
32
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace TweakPHP \Client \Loaders ;
4
+
5
+ use Throwable ;
6
+
7
+ class WordPressLoader extends BaseLoader
8
+ {
9
+ /**
10
+ * @param string $path
11
+ */
12
+ public function __construct (string $ path )
13
+ {
14
+ require_once $ path . '/wp-load.php ' ;
15
+ require_once $ path . '/wp-admin/includes/admin.php ' ;
16
+ require_once $ path . '/wp-includes/pluggable.php ' ;
17
+ }
18
+
19
+ public function name (): string
20
+ {
21
+ return 'WordPress ' ;
22
+ }
23
+
24
+ /**
25
+ * @return string
26
+ */
27
+ public function version (): string
28
+ {
29
+ try {
30
+ return get_bloginfo ('version ' );
31
+ } catch (Throwable $ e ) {
32
+ //
33
+ }
34
+
35
+ return "" ;
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments