← All changes
|
modules/logs/connectors/class-connector-compact.php
+76
-76
4.6.0.1
→
6.2.1
View file →
| @@ -13,93 +13,93 @@ | ||
| 13 | 13 | /** |
| 14 | 14 | * Class Connector_User |
| 15 | 15 | */ |
| 16 | 16 | class Connector_Compact extends Log_Connector { |
| 17 | - /** | |
| 18 | - * Connector slug | |
| 19 | - * | |
| 20 | - * @var string | |
| 21 | - */ | |
| 22 | - public $name = 'compact'; | |
| 17 | + /** | |
| 18 | + * Connector slug | |
| 19 | + * | |
| 20 | + * @var string | |
| 21 | + */ | |
| 22 | + public $name = 'compact'; | |
| 23 | 23 | |
| 24 | 24 | |
| 25 | - /** | |
| 26 | - * Actions registered for this connector | |
| 27 | - * | |
| 28 | - * @var array | |
| 29 | - */ | |
| 30 | - public $actions = array( | |
| 31 | - 'mainwp_compact_action', | |
| 32 | - ); | |
| 25 | + /** | |
| 26 | + * Actions registered for this connector | |
| 27 | + * | |
| 28 | + * @var array | |
| 29 | + */ | |
| 30 | + public $actions = array( | |
| 31 | + 'mainwp_compact_action', | |
| 32 | + ); | |
| 33 | 33 | |
| 34 | - /** | |
| 35 | - * Return translated connector label | |
| 36 | - * | |
| 37 | - * @return string Translated connector label | |
| 38 | - */ | |
| 39 | - public function get_label() { | |
| 40 | - return esc_html__( 'Compact', 'mainwp' ); | |
| 41 | - } | |
| 34 | + /** | |
| 35 | + * Return translated connector label | |
| 36 | + * | |
| 37 | + * @return string Translated connector label | |
| 38 | + */ | |
| 39 | + public function get_label() { | |
| 40 | + return esc_html__( 'Compact', 'mainwp' ); | |
| 41 | + } | |
| 42 | 42 | |
| 43 | - /** | |
| 44 | - * Return translated action term labels | |
| 45 | - * | |
| 46 | - * @return array Action terms label translation | |
| 47 | - */ | |
| 48 | - public function get_action_labels() { | |
| 49 | - return array( | |
| 50 | - 'saved' => esc_html__( 'Saved', 'mainwp' ), | |
| 51 | - ); | |
| 52 | - } | |
| 43 | + /** | |
| 44 | + * Return translated action term labels | |
| 45 | + * | |
| 46 | + * @return array Action terms label translation | |
| 47 | + */ | |
| 48 | + public function get_action_labels() { | |
| 49 | + return array( | |
| 50 | + 'saved' => esc_html__( 'Saved', 'mainwp' ), | |
| 51 | + ); | |
| 52 | + } | |
| 53 | 53 | |
| 54 | - /** | |
| 55 | - * Return translated context labels | |
| 56 | - * | |
| 57 | - * @return array Context label translations | |
| 58 | - */ | |
| 59 | - public function get_context_labels() { | |
| 60 | - return array( | |
| 61 | - 'compact' => esc_html__( 'Compact', 'mainwp' ), | |
| 62 | - ); | |
| 63 | - } | |
| 54 | + /** | |
| 55 | + * Return translated context labels | |
| 56 | + * | |
| 57 | + * @return array Context label translations | |
| 58 | + */ | |
| 59 | + public function get_context_labels() { | |
| 60 | + return array( | |
| 61 | + 'compact' => esc_html__( 'Compact', 'mainwp' ), | |
| 62 | + ); | |
| 63 | + } | |
| 64 | 64 | |
| 65 | - /** | |
| 66 | - * Log compact actions. | |
| 67 | - * | |
| 68 | - * @action mainwp_compact_action | |
| 69 | - * | |
| 70 | - * @param string $action post action. | |
| 71 | - * @param int $year compact year. | |
| 72 | - * @param array $data data array. | |
| 73 | - * @param array $start_time data array. | |
| 74 | - * @param array $end_time data array. | |
| 75 | - */ | |
| 76 | - public function callback_mainwp_compact_action( $action, $year, $data, $start_time, $end_time ) { | |
| 65 | + /** | |
| 66 | + * Log compact actions. | |
| 67 | + * | |
| 68 | + * @action mainwp_compact_action | |
| 69 | + * | |
| 70 | + * @param string $action post action. | |
| 71 | + * @param int $year compact year. | |
| 72 | + * @param array $data data array. | |
| 73 | + * @param array $start_time data array. | |
| 74 | + * @param array $end_time data array. | |
| 75 | + */ | |
| 76 | + public function callback_mainwp_compact_action( $action, $year, $data, $start_time, $end_time ) { | |
| 77 | 77 | |
| 78 | - if ( 'saved' !== $action || empty( $year ) || ! is_numeric( $year ) || ! is_array( $data ) ) { | |
| 79 | - return; | |
| 80 | - } | |
| 78 | + if ( 'saved' !== $action || empty( $year ) || ! is_numeric( $year ) || ! is_array( $data ) ) { | |
| 79 | + return; | |
| 80 | + } | |
| 81 | 81 | |
| 82 | - // translators: Placeholder refers log item. | |
| 83 | - $message = esc_html__( '%s', 'mainwp' ); | |
| 82 | + // translators: %s: Compact log item name. | |
| 83 | + $message = esc_html__( 'Compact log: %s', 'mainwp' ); | |
| 84 | 84 | |
| 85 | - $context = $year; | |
| 85 | + $context = $year; | |
| 86 | 86 | |
| 87 | - $args = array( | |
| 88 | - 'item' => esc_html__( 'Compact Logs', 'mainwp' ), | |
| 89 | - 'start_time' => $start_time, | |
| 90 | - 'end_time' => $end_time, | |
| 91 | - 'compact_logs' => wp_json_encode( $data ), | |
| 92 | - ); | |
| 87 | + $args = array( | |
| 88 | + 'item' => esc_html__( 'Compact Logs', 'mainwp' ), | |
| 89 | + 'start_time' => $start_time, | |
| 90 | + 'end_time' => $end_time, | |
| 91 | + 'compact_logs' => wp_json_encode( $data ), | |
| 92 | + ); | |
| 93 | 93 | |
| 94 | - $state = 1; | |
| 94 | + $state = 1; | |
| 95 | 95 | |
| 96 | - $this->log( | |
| 97 | - $message, | |
| 98 | - $args, | |
| 99 | - 0, | |
| 100 | - $context, | |
| 101 | - $action, | |
| 102 | - $state | |
| 103 | - ); | |
| 104 | - } | |
| 96 | + $this->log( | |
| 97 | + $message, | |
| 98 | + $args, | |
| 99 | + 0, | |
| 100 | + $context, | |
| 101 | + $action, | |
| 102 | + $state | |
| 103 | + ); | |
| 104 | + } | |
| 105 | 105 | } |