views
2 years ago
Frontend.php
2 years ago
FrontendServiceProvider.php
2 years ago
LoginAfterRestore.php
3 years ago
LoginForm.php
2 years ago
LoginNotice.php
5 years ago
FrontendServiceProvider.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Frontend; |
| 4 | |
| 5 | use WPStaging\Framework\DI\ServiceProvider; |
| 6 | |
| 7 | class FrontendServiceProvider extends ServiceProvider |
| 8 | { |
| 9 | |
| 10 | public function register() |
| 11 | { |
| 12 | $this->registerLoginAfterRestore(); |
| 13 | } |
| 14 | |
| 15 | private function registerLoginAfterRestore() |
| 16 | { |
| 17 | // Available in WordPress 4.6+ |
| 18 | $action = 'login_header'; |
| 19 | |
| 20 | /** @see wp_version_check() */ |
| 21 | if (file_exists(ABSPATH . WPINC . '/version.php')) { |
| 22 | require ABSPATH . WPINC . '/version.php'; |
| 23 | |
| 24 | if (isset($GLOBALS['wp_version']) && version_compare($GLOBALS['wp_version'], '4.6', '<')) { |
| 25 | // Available in WordPress >3.1 |
| 26 | $action = 'login_footer'; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | add_action($action, [$this->container->make(LoginAfterRestore::class), 'showMessage'], 10, 0); // phpcs:ignore WPStaging.Security.FirstArgNotAString, WPStaging.Security.AuthorizationChecked |
| 31 | } |
| 32 | } |
| 33 |