PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.1
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / logger / module.php
jetformbuilder / modules / logger Last commit date
interfaces 2 years ago empty-logger.php 2 years ago error-log-logger.php 2 years ago module.php 2 years ago
module.php
81 lines
1 <?php
2
3
4 namespace JFB_Modules\Logger;
5
6 use JFB_Components\Module\Base_Module_It;
7 use JFB_Components\Module\Base_Module_Static_Instance_It;
8 use JFB_Components\Module\Base_Module_Static_Instance_Trait;
9
10 // If this file is called directly, abort.
11 if ( ! defined( 'WPINC' ) ) {
12 die;
13 }
14
15 /**
16 * @method static Module instance()
17 *
18 * Class Logger
19 * @package Jet_Form_Builder\Dev_Mode
20 */
21 final class Module implements Base_Module_It, Base_Module_Static_Instance_It {
22
23 use Base_Module_Static_Instance_Trait;
24
25 private $logged = array();
26
27 public static function get_instance_id(): string {
28 return 'logger';
29 }
30
31 public function condition(): bool {
32 return true;
33 }
34
35 public function init_hooks() {
36 }
37
38 public function remove_hooks() {
39 }
40
41 public function get_logs(): array {
42 return $this->logged;
43 }
44
45 public function push_log( string $name, $data ) {
46 if ( ! array_key_exists( $name, $this->logged ) ) {
47 $this->logged[ $name ] = array();
48 }
49
50 $this->logged[ $name ][] = $data;
51 }
52
53 public function unset_last( string $key ) {
54 $exceptions = $this->logged[ $key ] ?? array();
55
56 if ( ! count( $exceptions ) ) {
57 return;
58 }
59
60 array_pop( $this->logged[ $key ] );
61 }
62
63
64 /**
65 * @since 3.1.0
66 *
67 * @param string $slug
68 *
69 * @return bool
70 */
71 public function has_log( string $slug ): bool {
72 foreach ( $this->logged as $exception_name => $args ) {
73 if ( $slug === $exception_name ) {
74 return true;
75 }
76 }
77
78 return false;
79 }
80 }
81