| 1 |
<?php |
| 2 |
/** |
| 3 |
* Module Logs Installer connector class. |
| 4 |
* |
| 5 |
* @package MainWP\Dashboard |
| 6 |
* @version 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_Non_Mainwp_Changes extends Log_Connector { |
| 21 |
|
| 22 |
/** |
| 23 |
* Connector name. |
| 24 |
* |
| 25 |
* @var string Connector slug. |
| 26 |
* */ |
| 27 |
public $name = 'non-mainwp-changes'; |
| 28 |
|
| 29 |
/** |
| 30 |
* Actions names. |
| 31 |
* |
| 32 |
* @var array Actions registered for this connector. |
| 33 |
* */ |
| 34 |
public $actions = array( |
| 35 |
'mainwp_sync_site_log_install_actions', |
| 36 |
); |
| 37 |
|
| 38 |
|
| 39 |
/** |
| 40 |
* Return translated connector label. |
| 41 |
* |
| 42 |
* @return string Translated connector label. |
| 43 |
*/ |
| 44 |
public function get_label() { |
| 45 |
return esc_html__( 'Non-MainWP Changes', 'mainwp' ); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Return translated action labels. |
| 50 |
* |
| 51 |
* @return array Action label translations. |
| 52 |
*/ |
| 53 |
public function get_action_labels() { |
| 54 |
return array( |
| 55 |
'install' => esc_html__( 'Installed', 'mainwp' ), |
| 56 |
'activate' => esc_html__( 'Activated', 'mainwp' ), |
| 57 |
'deactivate' => esc_html__( 'Deactivated', 'mainwp' ), |
| 58 |
'delete' => esc_html__( 'Deleted', 'mainwp' ), |
| 59 |
'updated' => esc_html__( 'Updated', 'mainwp' ), |
| 60 |
); |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Return translated context labels. |
| 65 |
* |
| 66 |
* @return array Context label translations. |
| 67 |
*/ |
| 68 |
public function get_context_labels() { |
| 69 |
return array( |
| 70 |
'plugins' => esc_html__( 'Plugins', 'mainwp' ), |
| 71 |
'themes' => esc_html__( 'Themes', 'mainwp' ), |
| 72 |
'core' => esc_html__( 'Core', 'mainwp' ), |
| 73 |
'translation' => esc_html__( 'Translation', 'mainwp' ), |
| 74 |
); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Log site action. |
| 79 |
* |
| 80 |
* @action mainwp_sync_site_log_install_actions. |
| 81 |
* |
| 82 |
* @param object $website website. |
| 83 |
* @param array $record meta data. |
| 84 |
*/ |
| 85 |
public function callback_mainwp_sync_site_log_install_actions( $website, $record ) { //phpcs:ignore -- NOSONAR - complex method. |
| 86 |
|
| 87 |
if ( empty( $website ) || ! is_array( $record ) ) { |
| 88 |
return; |
| 89 |
} |
| 90 |
$record['connector'] = $this->name; |
| 91 |
$this->log_record( $record ); |
| 92 |
} |
| 93 |
} |
| 94 |
|