wordpress-seo
/
vendor
/
wordproof
/
wordpress-sdk
/
app
/
Controllers
/
AuthenticationController.php
AuthenticationController.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.4, at vendor/wordproof/wordpress-sdk/app/Controllers/AuthenticationController.php
| 1 | <?php |
| 2 | |
| 3 | namespace WordProof\SDK\Controllers; |
| 4 | |
| 5 | use WordProof\SDK\Support\Authentication; |
| 6 | |
| 7 | class AuthenticationController |
| 8 | { |
| 9 | /** |
| 10 | * Triggers the authentication flow. |
| 11 | * |
| 12 | * @param null $redirectUrl |
| 13 | */ |
| 14 | public function authenticate($redirectUrl = null) |
| 15 | { |
| 16 | return Authentication::authorize($redirectUrl); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Adds admin page that redirects to the authentication flow. |
| 21 | */ |
| 22 | public function addRedirectPage() |
| 23 | { |
| 24 | add_submenu_page( |
| 25 | null, |
| 26 | 'WordProof Authenticate', |
| 27 | 'WordProof Authenticate', |
| 28 | 'publish_pages', |
| 29 | 'wordproof-redirect-authenticate', |
| 30 | [$this, 'redirectPageContent'] |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * The content for the redirect page. |
| 36 | */ |
| 37 | public function redirectPageContent() |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Gets triggered by the 'load-admin_page_' hook of the redirect page |
| 43 | */ |
| 44 | public function redirectOnLoad() |
| 45 | { |
| 46 | do_action('wordproof_authenticate', admin_url('admin.php?page=wordproof-close-after-redirect')); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Adds self destruct admin page. |
| 51 | */ |
| 52 | public function addSelfDestructPage() |
| 53 | { |
| 54 | add_submenu_page( |
| 55 | null, |
| 56 | 'WordProof After Authenticate', |
| 57 | 'WordProof After Authenticate', |
| 58 | 'publish_pages', |
| 59 | 'wordproof-close-after-redirect', |
| 60 | [$this, 'closeOnLoadContent'] |
| 61 | ); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Adds a script to the loaded page to close on load. |
| 66 | */ |
| 67 | public function closeOnLoadContent() |
| 68 | { |
| 69 | echo '<script type="text/javascript">'; |
| 70 | echo 'window.close();'; |
| 71 | echo '</script>'; |
| 72 | } |
| 73 | } |
| 74 |