Content.php
1 year ago
LoginForm.php
1 year ago
LoginRedirect.php
1 year ago
PostList.php
1 year ago
LoginForm.php
73 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * ====================================================================== |
| 5 | * LICENSE: This file is subject to the terms and conditions defined in * |
| 6 | * file 'license.txt', which is part of this source code package. * |
| 7 | * ====================================================================== |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * AAM shortcode strategy for login form |
| 12 | * |
| 13 | * @since 6.9.17 https://github.com/aamplugin/advanced-access-manager/issues/318 |
| 14 | * @since 6.6.0 Initial implementation of the class |
| 15 | * |
| 16 | * @package AAM |
| 17 | * @version 6.6.17 |
| 18 | */ |
| 19 | class AAM_Service_Shortcode_Handler_LoginForm |
| 20 | { |
| 21 | |
| 22 | /** |
| 23 | * Shortcode arguments |
| 24 | * |
| 25 | * @var array |
| 26 | * |
| 27 | * @access protected |
| 28 | * @version 6.6.0 |
| 29 | */ |
| 30 | protected $args; |
| 31 | |
| 32 | /** |
| 33 | * Initialize shortcode decorator |
| 34 | * |
| 35 | * Expecting attributes in $args are: |
| 36 | * "class" => CSS class for login form |
| 37 | * "redirect" => Redirect to URL after successful login |
| 38 | * |
| 39 | * @param array $args |
| 40 | * |
| 41 | * @return void |
| 42 | * |
| 43 | * @since 6.9.17 https://github.com/aamplugin/advanced-access-manager/issues/318 |
| 44 | * @since 6.6.0 Initial implementation of the method |
| 45 | * |
| 46 | * @access public |
| 47 | * @version 6.6.17 |
| 48 | */ |
| 49 | public function __construct($args, $content = null) |
| 50 | { |
| 51 | $this->args = array_merge( |
| 52 | array('class' => '', 'redirect' => ''), |
| 53 | is_array($args) ? $args : array() |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Process the shortcode |
| 59 | * |
| 60 | * @return string |
| 61 | * |
| 62 | * @access public |
| 63 | * @version 6.6.0 |
| 64 | */ |
| 65 | public function run() |
| 66 | { |
| 67 | return AAM_Backend_View::loadPartial('login-form', array_merge( |
| 68 | $this->args, |
| 69 | array('id' => uniqid()) |
| 70 | )); |
| 71 | } |
| 72 | |
| 73 | } |