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
mainwp / modules / logs / connectors / class-connector-changes-logs.php

class-connector-changes-logs.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 6.2.1, at modules/logs/connectors/class-connector-changes-logs.php

105 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Module Logs connector class.
4 *
5 * @package MainWP\Dashboard
6 * @since 4.5.1
7 */
8
9 namespace MainWP\Dashboard\Module\Log;
10
11 use MainWP\Dashboard\MainWP_DB;
12
13 defined( 'ABSPATH' ) || exit;
14
15 /**
16 * Class Connector_Installer
17 *
18 * @package MainWP\Dashboard
19 */
20 class Connector_Changes_Logs extends Log_Connector {
21
22 /**
23 * Connector name.
24 *
25 * @var string Connector slug.
26 * */
27 public $name = 'changes-logs'; // same connector with connector at the file: class-connector-non-mainwp-changes.php.
28
29
30 /**
31 * Specific connector.
32 *
33 * @var string Specific connector slug.
34 * */
35 public $connector = 'non-mainwp-changes'; // same connector with connector at the file: class-connector-non-mainwp-changes.php.
36
37
38 /**
39 * Actions names.
40 *
41 * @var array Actions registered for this connector.
42 * */
43 public $filters = array(
44 'mainwp_sync_site_log_changes_logs',
45 );
46
47 /**
48 * Return translated connector label.
49 *
50 * @return string Translated connector label.
51 */
52 public function get_label() {
53 return esc_html__( 'Non-MainWP Changes', 'mainwp' );
54 }
55
56 /**
57 * Return translated action labels.
58 *
59 * @return array Action label translations.
60 */
61 public function get_action_labels() {
62 return array(
63 'install' => esc_html__( 'Installed', 'mainwp' ),
64 'activate' => esc_html__( 'Activated', 'mainwp' ),
65 'deactivate' => esc_html__( 'Deactivated', 'mainwp' ),
66 'delete' => esc_html__( 'Deleted', 'mainwp' ),
67 'updated' => esc_html__( 'Updated', 'mainwp' ),
68 );
69 }
70
71 /**
72 * Return translated context labels.
73 *
74 * @return array Context label translations.
75 */
76 public function get_context_labels() {
77 return array(
78 'plugins' => esc_html__( 'Plugins', 'mainwp' ),
79 'themes' => esc_html__( 'Themes', 'mainwp' ),
80 'core' => esc_html__( 'Core', 'mainwp' ),
81 'translation' => esc_html__( 'Translation', 'mainwp' ),
82 );
83 }
84
85 /**
86 * Log site changes logs.
87 *
88 * @action mainwp_sync_site_log_changes_logs.
89 * @param mixed $val Iuput value.
90 * @param object $website Website.
91 * @param array $record Logs data.
92 *
93 * @return mixed
94 */
95 public function callback_mainwp_sync_site_log_changes_logs( $val, $website, $record ) { //phpcs:ignore -- NOSONAR - complex method.
96 if ( empty( $website ) || ! is_array( $record ) || empty( $record['created'] ) ) {
97 return $val;
98 }
99
100 $record['connector'] = $this->connector;
101
102 return $this->log_record( $record );
103 }
104 }
105