PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
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 +40 -0 6.1.3 → 6.2.2 View file →
@@ -331,8 +331,48 @@
331 331 return $defaults;
332 332 }
333 333
334 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;
372 + }
373 +
374 + /**
335 375 * Method get_history_changes().
336 376 *
337 377 * @param array $args Arguments.
338 378 *