LoginForm.php
68 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 | * @package AAM |
| 14 | * @version 6.6.0 |
| 15 | */ |
| 16 | class AAM_Shortcode_Handler_LoginForm |
| 17 | implements AAM_Core_Contract_ShortcodeInterface |
| 18 | { |
| 19 | |
| 20 | /** |
| 21 | * Shortcode arguments |
| 22 | * |
| 23 | * @var array |
| 24 | * |
| 25 | * @access protected |
| 26 | * @version 6.6.0 |
| 27 | */ |
| 28 | protected $args; |
| 29 | |
| 30 | /** |
| 31 | * Initialize shortcode decorator |
| 32 | * |
| 33 | * Expecting attributes in $args are: |
| 34 | * "class" => CSS class for login form |
| 35 | * "redirect" => Redirect to URL after successful login |
| 36 | * |
| 37 | * @param array $args |
| 38 | * |
| 39 | * @return void |
| 40 | * |
| 41 | * @access public |
| 42 | * @version 6.6.0 |
| 43 | */ |
| 44 | public function __construct($args, $content = null) |
| 45 | { |
| 46 | $this->args = array_merge( |
| 47 | array('class' => '', 'redirect' => ''), |
| 48 | $args |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Process the shortcode |
| 54 | * |
| 55 | * @return string |
| 56 | * |
| 57 | * @access public |
| 58 | * @version 6.6.0 |
| 59 | */ |
| 60 | public function run() |
| 61 | { |
| 62 | return AAM_Backend_View::loadPartial('login-form', array_merge( |
| 63 | $this->args, |
| 64 | array('id' => uniqid()) |
| 65 | )); |
| 66 | } |
| 67 | |
| 68 | } |