PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
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.0, at includes/Core/Form/FormHandler.php

66 lines 1.3 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 private $_container = [];
11 private static $_instance = null;
12
13 /**
14 * Undocumented function
15 */
16 public static function getInstance() {
17 if (null === self::$_instance) {
18 self::$_instance = new FormHandler();
19 }
20 return self::$_instance;
21 }
22
23 public function __construct() {
24 if (Request::Check('frontend')) {
25 $this->load_public_form_handler();
26 }
27 if (Request::Check('admin')) {
28 $this->load_admin_form_handler();
29 }
30 }
31
32 /**
33 * Magic getter function
34 *
35 * @param $object
36 *
37 * @return mixed
38 */
39 public function __get($object) {
40 if (array_key_exists($object, $this->_container)) {
41 return $this->_container[$object];
42 }
43
44 return $this->{$object};
45 }
46
47 /**
48 * Magic isset function
49 *
50 * @param $object
51 *
52 * @return mixed
53 */
54 public function __isset($object) {
55 return isset($this->{$object}) || isset($this->container[$object]);
56 }
57
58 public function load_admin_form_handler() {
59 $this->_container['admin'] = new AdminFormHandler();
60 }
61
62 protected function load_public_form_handler() {
63 $this->_container['frontend'] = new FrontendFormHandler();
64 }
65 }
66