PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | modules/logs/classes/class-log-connector.php +28 -0 5.2.1 → 6.2.1 View file →
@@ -8,8 +8,13 @@
8 8 */
9 9
10 10 namespace MainWP\Dashboard\Module\Log;
11 11
12 +// Exit if accessed directly.
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit;
15 +}
16 +
12 17 /**
13 18 * Class Log_Connector
14 19 *
15 20 * @package MainWP\Dashboard
@@ -28,8 +33,14 @@
28 33 * @var array
29 34 */
30 35 public $actions = array();
31 36
37 + /**
38 + * Filter registered for this connector
39 + *
40 + * @var array
41 + */
42 + public $filters = array();
32 43
33 44 /**
34 45 * Holds connector registration status flag.
35 46 *
@@ -58,8 +69,14 @@
58 69 foreach ( $this->actions as $action ) {
59 70 add_action( $action, array( $this, 'callback' ), 10, 99 );
60 71 }
61 72
73 + if ( ! empty( $this->filters ) && is_array( $this->filters ) ) {
74 + foreach ( $this->filters as $filter ) {
75 + add_action( $filter, array( $this, 'callback' ), 10, 99 );
76 + }
77 + }
78 +
62 79 $this->is_registered = true;
63 80 }
64 81
65 82 /**
@@ -110,8 +127,19 @@
110 127 $user_id = $data['user_id'];
111 128 $state = $data['state'];
112 129 }
113 130 return call_user_func_array( array( Log_Manager::instance()->log, 'log' ), compact( 'connector', 'message', 'args', 'site_id', 'context', 'action', 'state', 'user_id' ) );
131 + }
132 +
133 + /**
134 + * Log record.
135 + *
136 + * @param array $recordarr sprintf (and extra) arguments to use.
137 + *
138 + * @return bool|WP_Error True if updated, otherwise false|WP_Error
139 + */
140 + public function log_record( $recordarr ) { //phpcs:ignore -- NOSONAR - compatible.
141 + return call_user_func_array( array( Log_Manager::instance()->log, 'log_record' ), compact( 'recordarr' ) );
114 142 }
115 143
116 144 /**
117 145 * Compare two values and return changed keys if they are arrays