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 55use TweakPHP \Client \Loaders \ComposerLoader ;
66use TweakPHP \Client \Loaders \LaravelLoader ;
77use TweakPHP \Client \Loaders \LoaderInterface ;
8+ use TweakPHP \Client \Loaders \WordPressLoader ;
89
910class Loader
1011{
@@ -22,6 +23,10 @@ public static function load(string $path)
2223 return new ComposerLoader ($ path );
2324 }
2425
26+ if (file_exists ($ path . '/wp-load.php ' )) {
27+ return new WordPressLoader ($ path );
28+ }
29+
2530 return null ;
2631 }
2732}
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