PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.9.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.9.1
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Core / Form / FormHandler.php

FormHandler.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.9.1, at includes/Core/Form/FormHandler.php

73 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Core\Form;
4
5 use BitCode\BitForm\Admin\Form\AdminFormHandler;
6 use BitCode\BitForm\Core\Capability\Request;
7 use BitCode\BitForm\Frontend\Form\FrontendFormHandler;
8
9 final class FormHandler
10 {
11 private $_container = [];
12 private static $_instance = null;
13
14 /**
15 * Undocumented function
16 */
17 public static function getInstance()
18 {
19 if (null === self::$_instance) {
20 self::$_instance = new FormHandler();
21 }
22 return self::$_instance;
23 }
24
25 public function __construct()
26 {
27 if (Request::Check('frontend')) {
28 $this->load_public_form_handler();
29 }
30 if (Request::Check('admin')) {
31 $this->load_admin_form_handler();
32 }
33 }
34
35 /**
36 * Magic getter function
37 *
38 * @param $object
39 *
40 * @return mixed
41 */
42 public function __get($object)
43 {
44 if (array_key_exists($object, $this->_container)) {
45 return $this->_container[$object];
46 }
47
48 return $this->{$object};
49 }
50
51 /**
52 * Magic isset function
53 *
54 * @param $object
55 *
56 * @return mixed
57 */
58 public function __isset($object)
59 {
60 return isset($this->{$object}) || isset($this->container[$object]);
61 }
62
63 public function load_admin_form_handler()
64 {
65 $this->_container['admin'] = new AdminFormHandler();
66 }
67
68 protected function load_public_form_handler()
69 {
70 $this->_container['frontend'] = new FrontendFormHandler();
71 }
72 }
73