1 | <?php |
||
12 | final class Application extends Container |
||
13 | { |
||
14 | const PREFIX = 'pollux_'; |
||
15 | |||
16 | public $config; |
||
17 | public $file; |
||
18 | public $gatekeeper; |
||
19 | public $id; |
||
20 | public $name; |
||
21 | public $notices = []; |
||
22 | public $version; |
||
23 | |||
24 | /** |
||
25 | * @return string |
||
26 | */ |
||
27 | public static function prefix() |
||
31 | |||
32 | public function __construct() |
||
47 | |||
48 | /** |
||
49 | * The Application entry point |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | public function init() |
||
71 | |||
72 | /** |
||
73 | * @param string $checkFor |
||
74 | * @return string|bool |
||
75 | */ |
||
76 | public function environment( $checkFor = '' ) |
||
84 | |||
85 | /** |
||
86 | * @param string $filename |
||
87 | * @return string|null |
||
88 | */ |
||
89 | public function getFile( $filename ) |
||
90 | { |
||
91 | $theme = wp_get_theme(); |
||
92 | $filename = apply_filters( 'pollux/file', $filename ); |
||
93 | $locations = apply_filters( 'pollux/file/locations', [ |
||
94 | trailingslashit( trailingslashit( $theme->theme_root ) . $theme->stylesheet ), |
||
95 | trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ), |
||
96 | trailingslashit( WP_CONTENT_DIR ), |
||
97 | trailingslashit( ABSPATH ), |
||
98 | trailingslashit( dirname( ABSPATH )), |
||
99 | trailingslashit( dirname( dirname( ABSPATH ))), |
||
100 | ]); |
||
101 | foreach( (array) $locations as $location ) { |
||
102 | if( !file_exists( $location . $filename ))continue; |
||
103 | return $location . $filename; |
||
104 | } |
||
105 | return null; |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * @return void |
||
110 | */ |
||
111 | 14 | public function onActivation() |
|
112 | { |
||
113 | 14 | } |
|
114 | |||
115 | /** |
||
116 | * @return void |
||
117 | */ |
||
118 | public function onDeactivation() |
||
121 | |||
122 | /** |
||
123 | * @param string $file |
||
124 | * @return string |
||
125 | */ |
||
126 | public function path( $file = '' ) |
||
130 | |||
131 | /** |
||
132 | * @param string $view |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function render( $view, array $data = [] ) |
||
148 | |||
149 | /** |
||
150 | * @param string $path |
||
151 | * @return string |
||
152 | */ |
||
153 | public function url( $path = '' ) |
||
157 | |||
158 | /** |
||
159 | * @return void |
||
160 | */ |
||
161 | protected function bootstrap() |
||
181 | |||
182 | /** |
||
183 | * @return void |
||
184 | */ |
||
185 | protected function loadHooks() |
||
191 | |||
192 | /** |
||
193 | * @return void |
||
194 | */ |
||
195 | protected function registerAliases() |
||
203 | } |
||
204 |