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-changes-logs-helper.php +48 -1 6.0.12 → 6.2.1 View file →
@@ -276,9 +276,16 @@
276 276
277 277 $title = '';
278 278
279 279 if ( 'action' === $type ) {
280 - $title = isset( static::get_changes_logs_types( $log_type_id )['msg'] ) ? static::get_changes_logs_types( $log_type_id )['msg'] : '';
280 + if ( 1965 === (int) $log_type_id ) {
281 + $title = isset( static::get_changes_logs_types( $log_type_id )['action_name'] ) ? static::get_changes_logs_types( $log_type_id )['action_name'] : '';
282 + if ( ! empty( $title ) ) {
283 + $title = ucfirst( $title );
284 + }
285 + } else {
286 + $title = isset( static::get_changes_logs_types( $log_type_id )['msg'] ) ? static::get_changes_logs_types( $log_type_id )['msg'] : '';
287 + }
281 288 } elseif ( 'object' === $type ) {
282 289 $title = isset( static::get_changes_logs_types( $log_type_id )['object_msg'] ) ? static::get_changes_logs_types( $log_type_id )['object_msg'] : '';
283 290 }
284 291
@@ -321,8 +328,48 @@
321 328 if ( null !== $type_id ) {
322 329 return is_scalar( $type_id ) && isset( $defaults[ $type_id ] ) ? $defaults[ $type_id ] : array();
323 330 }
324 331 return $defaults;
332 + }
333 +
334 + /**
335 + * Method get_changes_logs_object_title().
336 + *
337 + * @param object $item Logs type code.
338 + * @param string $default_title Default title.
339 + *
340 + * @return strinng Object title.
341 + */
342 + public static function get_changes_logs_object_title( $item = null, $default_title = '' ) { //phpcs:ignore -- NOSONAR - long function.
343 + $title = '';
344 + if ( ! empty( $item->log_type_id ) ) {
345 + $meta = isset( $item->meta ) && is_array( $item->meta )
346 + ? $item->meta
347 + : array();
348 + if ( 'system-setting' === $item->context ) {
349 + $title = isset( self::get_changes_logs_types( $item->log_type_id )['title'] ) ? self::get_changes_logs_types( $item->log_type_id )['title'] : '';
350 + if ( empty( $title ) ) {
351 + $title = esc_html__( 'System Setting', 'mainwp' );
352 + }
353 + } elseif ( 'database' === $item->context ) {
354 + if ( ! empty( $meta['tablenames'] ) ) {
355 + $title = is_array( $meta['tablenames'] ) ? implode( ', ', $meta['tablenames'] ) : esc_html( $meta['tablenames'] );
356 + $title = esc_html( $title );
357 + }
358 + if ( empty( $title ) ) {
359 + $title = esc_html__( 'Database Table', 'mainwp' );
360 + }
361 + } elseif ( ( 1970 === (int) $item->log_type_id || 1980 === (int) $item->log_type_id ) ) {
362 + if ( ! empty( $meta['name'] ) && is_scalar( $meta['name'] ) ) {
363 + $title = esc_html( $meta['name'] );
364 + } elseif ( empty( $default_title ) ) {
365 + $title = 1970 === (int) $item->log_type_id
366 + ? esc_html__( 'Plugin', 'mainwp' )
367 + : esc_html__( 'Theme', 'mainwp' );
368 + }
369 + }
370 + }
371 + return ! empty( $title ) ? $title : $default_title;
325 372 }
326 373
327 374 /**
328 375 * Method get_history_changes().